diff --git a/assets/Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js b/assets/Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js similarity index 90% rename from assets/Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js rename to assets/Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js index 8d3e1e48a2469492330d91ec899a8da0d15487f1..a84af5b7a9425a737e6c7b0c8cb659555bdaf1b1 100644 --- a/assets/Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js +++ b/assets/Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js @@ -1 +1 @@ -import{d,bI as c,bJ as f,g as s,w as p,A as v,bE as x,o as h,c as y,n as _}from"./index-20XXNHAB.js";const g=d({__name:"Basic",props:{modelValue:{default:""},modelModifiers:{}},emits:c(["submit"],["update:modelValue"]),setup(n,{emit:u}){const r=u,e=f(n,"modelValue"),a=s(),o=s("auto");function i(t){t.code==="Enter"&&!t.shiftKey&&(t.preventDefault(),r("submit",e.value))}return p(e,()=>{o.value="auto",requestAnimationFrame(()=>{a.value&&(o.value=`${a.value.scrollHeight}px`)})},{immediate:!0}),(t,l)=>v((h(),y("textarea",{ref_key:"textareaRef",ref:a,"onUpdate:modelValue":l[0]||(l[0]=m=>e.value=m),style:_({height:o.value}),onKeydown:i},null,36)),[[x,e.value]])}});export{g as _}; +import{d,bI as c,bJ as f,g as s,w as p,A as v,bE as x,o as h,c as y,n as _}from"./index-D8Nm21zW.js";const g=d({__name:"Basic",props:{modelValue:{default:""},modelModifiers:{}},emits:c(["submit"],["update:modelValue"]),setup(n,{emit:u}){const r=u,e=f(n,"modelValue"),a=s(),o=s("auto");function i(t){t.code==="Enter"&&!t.shiftKey&&(t.preventDefault(),r("submit",e.value))}return p(e,()=>{o.value="auto",requestAnimationFrame(()=>{a.value&&(o.value=`${a.value.scrollHeight}px`)})},{immediate:!0}),(t,l)=>v((h(),y("textarea",{ref_key:"textareaRef",ref:a,"onUpdate:modelValue":l[0]||(l[0]=m=>e.value=m),style:_({height:o.value}),onKeydown:i},null,36)),[[x,e.value]])}});export{g as _}; diff --git a/assets/CardDetailDialog-DErGu3Xy.js b/assets/CardDetailDialog-DErGu3Xy.js deleted file mode 100644 index 083e42b33164336380e87b6bb35056717e4484fc..0000000000000000000000000000000000000000 --- a/assets/CardDetailDialog-DErGu3Xy.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as o}from"./CardDetailDialog.vue_vue_type_script_setup_true_lang-w9SFWGFR.js";import"./DeleteCardDialog.vue_vue_type_script_setup_true_lang-CPUl-rMo.js";import"./index-20XXNHAB.js";import"./index-qOh3wAiY.js";import"./live2d-zip-loader-52aPyiCh.js";import"./airi-card-DmHEm3BO.js";import"./consciousness-D04GkOp_.js";import"./providers-BqZLRXH1.js";import"./index-Be1NqeGb.js";import"./speech-CF8Au8j4.js";export{o as default}; diff --git a/assets/CardDetailDialog-Dxt-FHQW.js b/assets/CardDetailDialog-Dxt-FHQW.js new file mode 100644 index 0000000000000000000000000000000000000000..acf3f87083d789bd122fcc3c41d72f99a318734d --- /dev/null +++ b/assets/CardDetailDialog-Dxt-FHQW.js @@ -0,0 +1 @@ +import{_ as o}from"./CardDetailDialog.vue_vue_type_script_setup_true_lang-DAwVKIUC.js";import"./DeleteCardDialog.vue_vue_type_script_setup_true_lang-NzJTgSSI.js";import"./index-D8Nm21zW.js";import"./index-BUaUWOtl.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import"./airi-card-DeGSbHPj.js";import"./consciousness-CgTB9b9w.js";import"./providers-DUDq6kdm.js";import"./index-Be1NqeGb.js";import"./speech-B27BwGQ-.js";export{o as default}; diff --git a/assets/CardDetailDialog.vue_vue_type_script_setup_true_lang-DAwVKIUC.js b/assets/CardDetailDialog.vue_vue_type_script_setup_true_lang-DAwVKIUC.js new file mode 100644 index 0000000000000000000000000000000000000000..0a6253152dd6f9801852a549c13398503595b9f5 --- /dev/null +++ b/assets/CardDetailDialog.vue_vue_type_script_setup_true_lang-DAwVKIUC.js @@ -0,0 +1 @@ +import{a as O,_ as q}from"./DeleteCardDialog.vue_vue_type_script_setup_true_lang-NzJTgSSI.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as E,q as U,s as F,h as x,g as L,c as n,o,bx as f,b as m,u as l,y as k,a as e,C as v,bL as u,D as i,z as $,by as j}from"./index-D8Nm21zW.js";import{u as R}from"./airi-card-DeGSbHPj.js";import{n as G,I as J,$ as K,P as Q,B as W}from"./index-BUaUWOtl.js";const X={key:0,class:"w-full flex flex-col gap-5"},Y={flex:"~ col","gap-3":""},Z={flex:"~ row","items-center":"","justify-between":""},ee={flex:"~ row","items-center":"","gap-2":""},te={key:0,class:"bg-primary-100 text-primary-600 dark:bg-primary-900/40 dark:text-primary-400 flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium"},ae={"mt-1":"","text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},re={"font-medium":""},se={flex:"~ row","gap-2":""},le={class:"mt-4"},ne={class:"border-b border-neutral-200 dark:border-neutral-700"},oe={class:"flex justify-center -mb-px sm:justify-start space-x-1"},ie=["onClick"],de={class:"flex items-center gap-1"},ue={key:0},ce=["innerHTML"],me={key:1},ve=["innerHTML"],pe={key:2},ge={flex:"~ col","max-h-60":"","gap-4":"","overflow-auto":"","pr-1":"","sm:max-h-80":""},xe={key:0,flex:"~ col","gap-2":""},be={"text-lg":"","text-neutral-500":"","font-medium":"","dark:text-neutral-400":""},fe=["innerHTML"],he={key:3},_e={grid:"~ cols-1 sm:cols-3","gap-4":""},ke={flex:"~ col",bg:"white/60 dark:black/30","gap-1":"","rounded-lg":"","p-3":"",border:"~ neutral-200/50 dark:neutral-700/30",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40"},we={flex:"~ row","items-center":"","gap-2":"","text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},ye={truncate:"","font-medium":""},Ce={flex:"~ col",bg:"white/60 dark:black/30","gap-2":"","rounded-lg":"","p-3":"",border:"~ neutral-200/50 dark:neutral-700/30",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40"},Ie={flex:"~ row","items-center":"","gap-2":"","text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},Te={truncate:"","font-medium":""},Ve={flex:"~ col",bg:"white/60 dark:black/30","gap-2":"","rounded-lg":"","p-3":"",border:"~ neutral-200/50 dark:neutral-700/30",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40"},He={flex:"~ row","items-center":"","gap-2":"","text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},Le={truncate:"","font-medium":""},$e={key:1,bg:"neutral-50/50 dark:neutral-900/50","rounded-xl":"","p-8":"","text-center":"",border:"~ neutral-200/50 dark:neutral-700/30",shadow:"sm"},ze=E({__name:"CardDetailDialog",props:{modelValue:{type:Boolean},cardId:null},emits:["update:modelValue"],setup(B,{emit:z}){const b=B,D=z,{t:d}=U(),w=R(),{removeCard:A}=w,{activeCardId:M}=F(w),a=x(()=>{if(b.cardId)return w.getCard(b.cardId)}),y=x(()=>{var t,c,r,g,S;if(!a.value||!((c=(t=a.value.extensions)==null?void 0:t.airi)!=null&&c.modules))return{consciousness:"",speech:"",voice:""};const s=a.value.extensions.airi.modules;return{consciousness:((r=s.consciousness)==null?void 0:r.model)||"",speech:((g=s.speech)==null?void 0:g.model)||"",voice:((S=s.speech)==null?void 0:S.voice_id)||""}}),C=x(()=>a.value?{personality:a.value.personality,scenario:a.value.scenario,systemPrompt:a.value.systemPrompt,postHistoryInstructions:a.value.postHistoryInstructions}:{}),h=x(()=>b.cardId===M.value),I=L(!1);function N(){I.value=!0,setTimeout(()=>{M.value=b.cardId,I.value=!1},300)}function T(s){return s==null?void 0:s.replace(/\{\{(.*?)\}\}/g,'{{ $1 }}').trim()}const _=L(!1);function P(){a.value&&(A(b.cardId),D("update:modelValue",!1)),_.value=!1}const V=L(""),H=x(()=>{var t,c;const s=[];return(t=a.value)!=null&&t.description&&s.push({id:"description",label:d("settings.pages.card.description_label"),icon:"i-solar:document-text-linear"}),(c=a.value)!=null&&c.notes&&s.push({id:"notes",label:d("settings.pages.card.creator_notes"),icon:"i-solar:notes-linear"}),Object.values(C.value).some(r=>!!r)&&s.push({id:"character",label:d("settings.pages.card.character"),icon:"i-solar:user-rounded-linear"}),s.push({id:"modules",label:d("settings.pages.card.modules"),icon:"i-solar:tuning-square-linear"}),s}),p=x({get:()=>{var s;return H.value.find(t=>t.id===V.value)?V.value:((s=H.value[0])==null?void 0:s.id)||""},set:s=>{V.value=s}});return(s,t)=>{var c;return o(),n(f,null,[m(l(G),{open:B.modelValue,"onUpdate:open":t[0]||(t[0]=r=>D("update:modelValue",r))},{default:k(()=>[m(l(J),null,{default:k(()=>[m(l(K),{class:"data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"}),m(l(Q),{class:"data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-50 m-0 max-h-[90vh] max-w-6xl w-[92vw] flex flex-col overflow-auto border border-neutral-200 rounded-xl bg-white p-5 shadow-xl 2xl:w-[60vw] lg:w-[80vw] md:w-[85vw] xl:w-[70vw] -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800 sm:p-6"},{default:k(()=>[a.value?(o(),n("div",X,[e("div",Y,[e("div",Z,[e("div",null,[e("div",ee,[m(l(W),{"text-2xl":"","font-bold":"",class:"from-primary-500 to-primary-400 bg-gradient-to-r bg-clip-text text-transparent"},{default:k(()=>[u(i(a.value.name),1)]),_:1}),h.value?(o(),n("div",te,[t[3]||(t[3]=e("div",{"i-solar:check-circle-bold-duotone":"","text-xs":""},null,-1)),u(" "+i(l(d)("settings.pages.card.active_badge")),1)])):v("",!0)]),e("div",ae,[u(" v"+i(a.value.version)+" ",1),a.value.creator?(o(),n(f,{key:0},[u(" · "+i(l(d)("settings.pages.card.created_by"))+" ",1),e("span",re,i(a.value.creator),1)],64)):v("",!0)])]),e("div",se,[m(l(O),{variant:"primary",icon:h.value?"i-solar:check-circle-bold-duotone":"i-solar:play-circle-broken",label:h.value?l(d)("settings.pages.card.active"):l(d)("settings.pages.card.activate"),disabled:h.value,class:$({"animate-pulse":I.value}),onClick:N},null,8,["icon","label","disabled","class"])])]),e("div",le,[e("div",ne,[e("div",oe,[(o(!0),n(f,null,j(H.value,r=>(o(),n("button",{key:r.id,class:$(["px-4 py-2 text-sm font-medium",[p.value===r.id?"text-primary-600 dark:text-primary-400 border-b-2 border-primary-500 dark:border-primary-400":"text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300"]]),onClick:g=>p.value=r.id},[e("div",de,[e("div",{class:$(r.icon)},null,2),u(" "+i(r.label),1)])],10,ie))),128))])])]),p.value==="notes"&&a.value.notes?(o(),n("div",ue,[e("div",{bg:"white/60 dark:black/30",border:"~ neutral-200/50 dark:neutral-700/30","max-h-60":"","overflow-auto":"","whitespace-pre-line":"","rounded-lg":"","p-4":"","text-neutral-700":"","sm:max-h-80":"","dark:text-neutral-300":"",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40",innerHTML:T(a.value.notes)},null,8,ce)])):v("",!0),p.value==="description"&&a.value.description?(o(),n("div",me,[e("div",{bg:"white/60 dark:black/30","max-h-60":"","overflow-auto":"","whitespace-pre-line":"","rounded-lg":"","p-4":"","sm:max-h-80":"",text:"neutral-600 dark:neutral-300",border:"~ neutral-200/50 dark:neutral-700/30",innerHTML:T(a.value.description)},null,8,ve)])):v("",!0),p.value==="character"&&Object.values(C.value).some(r=>!!r)?(o(),n("div",pe,[e("div",ge,[(o(!0),n(f,null,j(C.value,(r,g)=>(o(),n(f,{key:g},[r?(o(),n("div",xe,[e("h2",be,i(l(d)(`settings.pages.card.${g.toLowerCase()}`)),1),e("div",{bg:"white/60 dark:black/30",border:"~ neutral-200/50 dark:neutral-700/30",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40","max-h-none":"","overflow-auto":"","whitespace-pre-line":"","rounded-lg":"","p-3":"","text-neutral-700":"","dark:text-neutral-300":"",innerHTML:T(r)},null,8,fe)])):v("",!0)],64))),128))])])):v("",!0),p.value==="modules"?(o(),n("div",he,[e("div",_e,[e("div",ke,[e("span",we,[t[4]||(t[4]=e("div",{"i-lucide:ghost":""},null,-1)),u(" "+i(l(d)("settings.pages.card.consciousness.model")),1)]),e("div",ye,i(y.value.consciousness??"default"),1)]),e("div",Ce,[e("span",Ie,[t[5]||(t[5]=e("div",{"i-lucide:mic":""},null,-1)),u(" "+i(l(d)("settings.pages.card.speech.model")),1)]),e("div",Te,i(y.value.speech??"default"),1)]),e("div",Ve,[e("span",He,[t[6]||(t[6]=e("div",{"i-lucide:music":""},null,-1)),u(" "+i(l(d)("settings.pages.card.speech.voice")),1)]),e("div",Le,i(y.value.voice??"default"),1)])])])):v("",!0)])])):(o(),n("div",$e,[t[7]||(t[7]=e("div",{"i-solar:card-search-broken":"","mx-auto":"","mb-3":"","text-6xl":"","text-neutral-400":""},null,-1)),u(" "+i(l(d)("settings.pages.card.card_not_found")),1)]))]),_:1})]),_:1})]),_:1},8,["open"]),m(q,{modelValue:_.value,"onUpdate:modelValue":t[1]||(t[1]=r=>_.value=r),"card-name":(c=a.value)==null?void 0:c.name,onConfirm:P,onCancel:t[2]||(t[2]=r=>_.value=!1)},null,8,["modelValue","card-name"])],64)}}});export{ze as _}; diff --git a/assets/CardDetailDialog.vue_vue_type_script_setup_true_lang-w9SFWGFR.js b/assets/CardDetailDialog.vue_vue_type_script_setup_true_lang-w9SFWGFR.js deleted file mode 100644 index 22bc0e41af5a4c3363bb28c27a3eaed70478caea..0000000000000000000000000000000000000000 --- a/assets/CardDetailDialog.vue_vue_type_script_setup_true_lang-w9SFWGFR.js +++ /dev/null @@ -1 +0,0 @@ -import{a as O,_ as q}from"./DeleteCardDialog.vue_vue_type_script_setup_true_lang-CPUl-rMo.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as E,q as U,s as F,h as x,g as L,c as n,o,bx as f,b as m,u as l,y as k,a as e,C as v,bL as u,D as i,z as $,by as j}from"./index-20XXNHAB.js";import{u as R}from"./airi-card-DmHEm3BO.js";import{n as G,I as J,$ as K,P as Q,B as W}from"./index-qOh3wAiY.js";const X={key:0,class:"w-full flex flex-col gap-5"},Y={flex:"~ col","gap-3":""},Z={flex:"~ row","items-center":"","justify-between":""},ee={flex:"~ row","items-center":"","gap-2":""},te={key:0,class:"bg-primary-100 text-primary-600 dark:bg-primary-900/40 dark:text-primary-400 flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium"},ae={"mt-1":"","text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},re={"font-medium":""},se={flex:"~ row","gap-2":""},le={class:"mt-4"},ne={class:"border-b border-neutral-200 dark:border-neutral-700"},oe={class:"flex justify-center -mb-px sm:justify-start space-x-1"},ie=["onClick"],de={class:"flex items-center gap-1"},ue={key:0},ce=["innerHTML"],me={key:1},ve=["innerHTML"],pe={key:2},ge={flex:"~ col","max-h-60":"","gap-4":"","overflow-auto":"","pr-1":"","sm:max-h-80":""},xe={key:0,flex:"~ col","gap-2":""},be={"text-lg":"","text-neutral-500":"","font-medium":"","dark:text-neutral-400":""},fe=["innerHTML"],he={key:3},_e={grid:"~ cols-1 sm:cols-3","gap-4":""},ke={flex:"~ col",bg:"white/60 dark:black/30","gap-1":"","rounded-lg":"","p-3":"",border:"~ neutral-200/50 dark:neutral-700/30",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40"},we={flex:"~ row","items-center":"","gap-2":"","text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},ye={truncate:"","font-medium":""},Ce={flex:"~ col",bg:"white/60 dark:black/30","gap-2":"","rounded-lg":"","p-3":"",border:"~ neutral-200/50 dark:neutral-700/30",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40"},Ie={flex:"~ row","items-center":"","gap-2":"","text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},Te={truncate:"","font-medium":""},Ve={flex:"~ col",bg:"white/60 dark:black/30","gap-2":"","rounded-lg":"","p-3":"",border:"~ neutral-200/50 dark:neutral-700/30",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40"},He={flex:"~ row","items-center":"","gap-2":"","text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},Le={truncate:"","font-medium":""},$e={key:1,bg:"neutral-50/50 dark:neutral-900/50","rounded-xl":"","p-8":"","text-center":"",border:"~ neutral-200/50 dark:neutral-700/30",shadow:"sm"},ze=E({__name:"CardDetailDialog",props:{modelValue:{type:Boolean},cardId:null},emits:["update:modelValue"],setup(B,{emit:z}){const b=B,D=z,{t:d}=U(),w=R(),{removeCard:A}=w,{activeCardId:M}=F(w),a=x(()=>{if(b.cardId)return w.getCard(b.cardId)}),y=x(()=>{var t,c,r,g,S;if(!a.value||!((c=(t=a.value.extensions)==null?void 0:t.airi)!=null&&c.modules))return{consciousness:"",speech:"",voice:""};const s=a.value.extensions.airi.modules;return{consciousness:((r=s.consciousness)==null?void 0:r.model)||"",speech:((g=s.speech)==null?void 0:g.model)||"",voice:((S=s.speech)==null?void 0:S.voice_id)||""}}),C=x(()=>a.value?{personality:a.value.personality,scenario:a.value.scenario,systemPrompt:a.value.systemPrompt,postHistoryInstructions:a.value.postHistoryInstructions}:{}),h=x(()=>b.cardId===M.value),I=L(!1);function N(){I.value=!0,setTimeout(()=>{M.value=b.cardId,I.value=!1},300)}function T(s){return s==null?void 0:s.replace(/\{\{(.*?)\}\}/g,'{{ $1 }}').trim()}const _=L(!1);function P(){a.value&&(A(b.cardId),D("update:modelValue",!1)),_.value=!1}const V=L(""),H=x(()=>{var t,c;const s=[];return(t=a.value)!=null&&t.description&&s.push({id:"description",label:d("settings.pages.card.description_label"),icon:"i-solar:document-text-linear"}),(c=a.value)!=null&&c.notes&&s.push({id:"notes",label:d("settings.pages.card.creator_notes"),icon:"i-solar:notes-linear"}),Object.values(C.value).some(r=>!!r)&&s.push({id:"character",label:d("settings.pages.card.character"),icon:"i-solar:user-rounded-linear"}),s.push({id:"modules",label:d("settings.pages.card.modules"),icon:"i-solar:tuning-square-linear"}),s}),p=x({get:()=>{var s;return H.value.find(t=>t.id===V.value)?V.value:((s=H.value[0])==null?void 0:s.id)||""},set:s=>{V.value=s}});return(s,t)=>{var c;return o(),n(f,null,[m(l(G),{open:B.modelValue,"onUpdate:open":t[0]||(t[0]=r=>D("update:modelValue",r))},{default:k(()=>[m(l(J),null,{default:k(()=>[m(l(K),{class:"data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"}),m(l(Q),{class:"data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-50 m-0 max-h-[90vh] max-w-6xl w-[92vw] flex flex-col overflow-auto border border-neutral-200 rounded-xl bg-white p-5 shadow-xl 2xl:w-[60vw] lg:w-[80vw] md:w-[85vw] xl:w-[70vw] -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800 sm:p-6"},{default:k(()=>[a.value?(o(),n("div",X,[e("div",Y,[e("div",Z,[e("div",null,[e("div",ee,[m(l(W),{"text-2xl":"","font-bold":"",class:"from-primary-500 to-primary-400 bg-gradient-to-r bg-clip-text text-transparent"},{default:k(()=>[u(i(a.value.name),1)]),_:1}),h.value?(o(),n("div",te,[t[3]||(t[3]=e("div",{"i-solar:check-circle-bold-duotone":"","text-xs":""},null,-1)),u(" "+i(l(d)("settings.pages.card.active_badge")),1)])):v("",!0)]),e("div",ae,[u(" v"+i(a.value.version)+" ",1),a.value.creator?(o(),n(f,{key:0},[u(" · "+i(l(d)("settings.pages.card.created_by"))+" ",1),e("span",re,i(a.value.creator),1)],64)):v("",!0)])]),e("div",se,[m(l(O),{variant:"primary",icon:h.value?"i-solar:check-circle-bold-duotone":"i-solar:play-circle-broken",label:h.value?l(d)("settings.pages.card.active"):l(d)("settings.pages.card.activate"),disabled:h.value,class:$({"animate-pulse":I.value}),onClick:N},null,8,["icon","label","disabled","class"])])]),e("div",le,[e("div",ne,[e("div",oe,[(o(!0),n(f,null,j(H.value,r=>(o(),n("button",{key:r.id,class:$(["px-4 py-2 text-sm font-medium",[p.value===r.id?"text-primary-600 dark:text-primary-400 border-b-2 border-primary-500 dark:border-primary-400":"text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-300"]]),onClick:g=>p.value=r.id},[e("div",de,[e("div",{class:$(r.icon)},null,2),u(" "+i(r.label),1)])],10,ie))),128))])])]),p.value==="notes"&&a.value.notes?(o(),n("div",ue,[e("div",{bg:"white/60 dark:black/30",border:"~ neutral-200/50 dark:neutral-700/30","max-h-60":"","overflow-auto":"","whitespace-pre-line":"","rounded-lg":"","p-4":"","text-neutral-700":"","sm:max-h-80":"","dark:text-neutral-300":"",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40",innerHTML:T(a.value.notes)},null,8,ce)])):v("",!0),p.value==="description"&&a.value.description?(o(),n("div",me,[e("div",{bg:"white/60 dark:black/30","max-h-60":"","overflow-auto":"","whitespace-pre-line":"","rounded-lg":"","p-4":"","sm:max-h-80":"",text:"neutral-600 dark:neutral-300",border:"~ neutral-200/50 dark:neutral-700/30",innerHTML:T(a.value.description)},null,8,ve)])):v("",!0),p.value==="character"&&Object.values(C.value).some(r=>!!r)?(o(),n("div",pe,[e("div",ge,[(o(!0),n(f,null,j(C.value,(r,g)=>(o(),n(f,{key:g},[r?(o(),n("div",xe,[e("h2",be,i(l(d)(`settings.pages.card.${g.toLowerCase()}`)),1),e("div",{bg:"white/60 dark:black/30",border:"~ neutral-200/50 dark:neutral-700/30",transition:"all duration-200",hover:"bg-white/80 dark:bg-black/40","max-h-none":"","overflow-auto":"","whitespace-pre-line":"","rounded-lg":"","p-3":"","text-neutral-700":"","dark:text-neutral-300":"",innerHTML:T(r)},null,8,fe)])):v("",!0)],64))),128))])])):v("",!0),p.value==="modules"?(o(),n("div",he,[e("div",_e,[e("div",ke,[e("span",we,[t[4]||(t[4]=e("div",{"i-lucide:ghost":""},null,-1)),u(" "+i(l(d)("settings.pages.card.consciousness.model")),1)]),e("div",ye,i(y.value.consciousness??"default"),1)]),e("div",Ce,[e("span",Ie,[t[5]||(t[5]=e("div",{"i-lucide:mic":""},null,-1)),u(" "+i(l(d)("settings.pages.card.speech.model")),1)]),e("div",Te,i(y.value.speech??"default"),1)]),e("div",Ve,[e("span",He,[t[6]||(t[6]=e("div",{"i-lucide:music":""},null,-1)),u(" "+i(l(d)("settings.pages.card.speech.voice")),1)]),e("div",Le,i(y.value.voice??"default"),1)])])])):v("",!0)])])):(o(),n("div",$e,[t[7]||(t[7]=e("div",{"i-solar:card-search-broken":"","mx-auto":"","mb-3":"","text-6xl":"","text-neutral-400":""},null,-1)),u(" "+i(l(d)("settings.pages.card.card_not_found")),1)]))]),_:1})]),_:1})]),_:1},8,["open"]),m(q,{modelValue:_.value,"onUpdate:modelValue":t[1]||(t[1]=r=>_.value=r),"card-name":(c=a.value)==null?void 0:c.name,onConfirm:P,onCancel:t[2]||(t[2]=r=>_.value=!1)},null,8,["modelValue","card-name"])],64)}}});export{ze as _}; diff --git a/assets/CardListItem-B48Rt3Tq.css b/assets/CardListItem-B48Rt3Tq.css deleted file mode 100644 index 93f5c125c7c95d5d46de759791c0d683649c65b7..0000000000000000000000000000000000000000 --- a/assets/CardListItem-B48Rt3Tq.css +++ /dev/null @@ -1 +0,0 @@ -.card-hover-effect[data-v-895421da]{transform-style:preserve-3d;transform-origin:center;will-change:transform;transition:transform .3s cubic-bezier(.23,1,.32,1)}.card-hover-effect[data-v-895421da]:before,.card-hover-effect[data-v-895421da]:after{content:"";position:absolute;left:0;right:0;bottom:0;top:0;background-repeat:no-repeat;transition:all .33s ease;pointer-events:none}.card-hover-effect[data-v-895421da]:before{background-position:var(--card-position-x) var(--card-position-y);background-size:300% 300%;background-image:linear-gradient(115deg,transparent 0%,rgba(var(--color-primary-500),calc(.3 * var(--effect-intensity))) 25%,transparent 47%,transparent 53%,rgba(var(--color-primary-600),calc(.3 * var(--effect-intensity))) 75%,transparent 100%);opacity:calc(.5 * var(--effect-intensity));filter:brightness(.5) contrast(1);z-index:1;mix-blend-mode:color-dodge}.card-hover-effect[data-v-895421da]:after{background-position:var(--sparkle-position-x) var(--sparkle-position-y);background-size:160%;background-image:linear-gradient(125deg,rgba(var(--color-primary-500),calc(.3 * var(--effect-intensity))) 15%,rgba(var(--color-primary-400),calc(.25 * var(--effect-intensity))) 30%,rgba(var(--color-primary-300),calc(.2 * var(--effect-intensity))) 40%,rgba(var(--color-primary-200),calc(.1 * var(--effect-intensity))) 60%,rgba(var(--color-primary-400),calc(.25 * var(--effect-intensity))) 70%,rgba(var(--color-primary-500),calc(.3 * var(--effect-intensity))) 85%);background-blend-mode:overlay;opacity:calc(var(--sparkle-opacity) * var(--effect-intensity));filter:brightness(1) contrast(1);z-index:2;mix-blend-mode:color-dodge}.card-hover-effect[data-v-895421da]:hover:before{opacity:calc(.88 * var(--effect-intensity));filter:brightness(.66) contrast(1.33)}.card-hover-effect[data-v-895421da]:hover:after{opacity:var(--effect-intensity);filter:brightness(1.1) contrast(1.2)} diff --git a/assets/CardListItem-CmKnCrTs.js b/assets/CardListItem-CmKnCrTs.js new file mode 100644 index 0000000000000000000000000000000000000000..43ccfc8b13f474b3104b952e3abbca38f9d89fae --- /dev/null +++ b/assets/CardListItem-CmKnCrTs.js @@ -0,0 +1 @@ +import{_ as o}from"./CardListItem.vue_vue_type_script_setup_true_lang-DG6xnm5K.js";import"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";export{o as default}; diff --git a/assets/CardListItem-DNxJE0hr.js b/assets/CardListItem-DNxJE0hr.js deleted file mode 100644 index 3be64bb75485a92002ed7fcef10aa7ea3a7c05b4..0000000000000000000000000000000000000000 --- a/assets/CardListItem-DNxJE0hr.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as o}from"./CardListItem.vue_vue_type_script_setup_true_lang-LNBk-ntG.js";import"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";export{o as default}; diff --git a/assets/CardListItem.vue_vue_type_script_setup_true_lang-DG6xnm5K.js b/assets/CardListItem.vue_vue_type_script_setup_true_lang-DG6xnm5K.js new file mode 100644 index 0000000000000000000000000000000000000000..4b5dcea0d3c2f29ef30029b52e38e04f653e9b79 --- /dev/null +++ b/assets/CardListItem.vue_vue_type_script_setup_true_lang-DG6xnm5K.js @@ -0,0 +1 @@ +import{d as M,g as s,l as R,c as p,o as d,m as D,n as F,bn as H,x as I,y as N,a as t,C as v,D as l,bM as k,z as h,u as V}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";const W=M({__name:"CursorFloating",props:{intensity:{default:1.5}},setup(r){const n=r,o=s(null),a=s(""),e=s("50% 50%"),i=s("50% 50%"),y=s(.5);function w(c){if(!o.value)return;const u=o.value,b=u.getBoundingClientRect(),C=c.clientX-b.left,_=c.clientY-b.top,z=u.offsetWidth,B=u.offsetHeight,f=Math.abs(Math.floor(100/z*C)-100),m=Math.abs(Math.floor(100/B*_)-100),x=50+(f-50)/1.5,g=50+(m-50)/1.5,P=50+(f-50)/7,S=50+(m-50)/7,X=(x-50)/1.5*.2*n.intensity,Y=(g-50)/2*-1*.2*n.intensity,A=50-f+(50-m),j=.5+Math.abs(A)*.008*n.intensity;a.value=`perspective(1200px) rotateX(${Y}deg) rotateY(${X}deg) scale3d(${1+.015*n.intensity}, ${1+.015*n.intensity}, ${1+.015*n.intensity})`,e.value=`${x}% ${g}%`,i.value=`${P}% ${S}%`,y.value=j}function $(){a.value="perspective(1200px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)",e.value="50% 50%",i.value="50% 50%",y.value=.5}return R(()=>{a.value="perspective(1200px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)"}),(c,u)=>(d(),p("div",{ref_key:"cardRef",ref:o,class:"card-hover-effect",style:F({transform:a.value,"--effect-intensity":r.intensity}),onMousemove:w,onMouseleave:$},[D(c.$slots,"default",{},void 0,!0)],36))}}),E=H(W,[["__scopeId","data-v-895421da"]]),L={relative:"",flex:"~ col 1","justify-between":"","gap-3":"","overflow-hidden":"","rounded-lg":"",bg:"white dark:neutral-900","p-5":"",transition:"all ease-in-out duration-400",after:"content-empty absolute inset-0 z--2 w-full h-full bg-dotted-[neutral-200/80] bg-size-10px mask-image-[linear-gradient(165deg,white_30%,transparent_50%)] transition-all duration-400 ease-in-out",hover:"after:bg-dotted-[primary-300/50] dark:after:bg-dotted-[primary-200/20] text-primary-600/80 dark:text-primary-300/80"},O={"z-1":"",flex:"","items-start":"","justify-between":"","gap-2":""},q={"flex-1":"",truncate:"","text-lg":"","font-bold":""},G={key:0,"shrink-0":"","rounded-md":"","p-1":"",bg:"primary-100 dark:primary-900/40",text:"primary-600 dark:primary-400"},J={key:0,"line-clamp-3":"","min-h-40px":"","flex-1":"","text-sm":"",text:"neutral-500 dark:neutral-400"},K={"z-1":"",flex:"","items-center":"","justify-between":"","text-xs":"",text:"neutral-500 dark:neutral-400"},Q={flex:"","items-center":"","gap-1.5":""},T={flex:"","items-center":"","gap-0.5":""},U={flex:"","items-center":"","gap-0.5":""},Z={flex:"","items-center":"","justify-end":"","px-2":"","py-1.5":""},ee=["disabled"],ne=M({__name:"CardListItem",props:{id:null,name:null,description:null,isActive:{type:Boolean},isSelected:{type:Boolean},version:null,consciousnessModel:null,voiceModel:null},emits:["select","activate","delete"],setup(r,{emit:n}){const o=n;return(a,e)=>(d(),I(V(E),{relative:"","min-h-120px":"",flex:"~ col","cursor-pointer":"","overflow-hidden":"","rounded-xl":"",class:h([r.isSelected?"border-2 border-primary-400 dark:border-primary-600":"border-2 border-neutral-100 dark:border-neutral-800/25"]),bg:"neutral-200/50 dark:neutral-800/50","drop-shadow":"none hover:[0px_4px_4px_rgba(220,220,220,0.4)] active:[0px_0px_0px_rgba(220,220,220,0.25)] dark:hover:none",transition:"all ease-in-out duration-400",before:"content-empty absolute inset-0 z-0 w-25% h-full transition-all duration-400 ease-in-out bg-gradient-to-r from-primary-500/0 to-primary-500/0 dark:from-primary-400/0 dark:to-primary-400/0 mask-image-[linear-gradient(120deg,white_100%)] opacity-0",hover:"before:w-50% before:opacity-100 before:bg-gradient-to-r before:from-primary-500/20 before:via-primary-500/10 before:to-transparent before:dark:from-primary-400/20 before:dark:via-primary-400/10 before:dark:to-transparent",onClick:e[2]||(e[2]=i=>o("select"))},{default:N(()=>[t("div",L,[t("div",O,[t("h3",q,l(r.name),1),r.isActive?(d(),p("div",G,e[3]||(e[3]=[t("div",{"i-solar:check-circle-bold-duotone":"","text-sm":""},null,-1)]))):v("",!0)]),r.description?(d(),p("p",J,l(r.description),1)):v("",!0),t("div",K,[t("div",null,"v"+l(r.version),1),t("div",Q,[t("div",T,[e[4]||(e[4]=t("div",{"i-lucide:ghost":"","text-xs":""},null,-1)),t("span",null,l(r.consciousnessModel),1)]),t("div",U,[e[5]||(e[5]=t("div",{"i-lucide:mic":"","text-xs":""},null,-1)),t("span",null,l(r.voiceModel),1)])])])]),t("div",Z,[t("button",{"rounded-lg":"","p-1.5":"","transition-colors":"",hover:"bg-neutral-200 dark:bg-neutral-700/50",disabled:r.isActive,onClick:e[0]||(e[0]=k(i=>o("activate"),["stop"]))},[t("div",{class:h([r.isActive?"i-solar:check-circle-bold-duotone text-primary-500 dark:text-primary-400":"i-solar:play-circle-broken text-neutral-500 dark:text-neutral-400"])},null,2)],8,ee),r.id!=="default"?(d(),p("button",{key:0,"rounded-lg":"","p-1.5":"","transition-colors":"",hover:"bg-neutral-200 dark:bg-neutral-700/50",onClick:e[1]||(e[1]=k(i=>o("delete"),["stop"]))},e[6]||(e[6]=[t("div",{"i-solar:trash-bin-trash-linear":"",text:"neutral-500 dark:neutral-400"},null,-1)]))):v("",!0)])]),_:1},8,["class"]))}});export{ne as _}; diff --git a/assets/CardListItem.vue_vue_type_script_setup_true_lang-LNBk-ntG.js b/assets/CardListItem.vue_vue_type_script_setup_true_lang-LNBk-ntG.js deleted file mode 100644 index 21f744f1d3277c125a729dfb819dfc5e29e9aa36..0000000000000000000000000000000000000000 --- a/assets/CardListItem.vue_vue_type_script_setup_true_lang-LNBk-ntG.js +++ /dev/null @@ -1 +0,0 @@ -import{d as M,g as s,l as R,c as p,o as d,m as D,n as F,bn as H,x as I,y as N,a as t,C as v,D as l,bM as k,z as h,u as V}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";const W=M({__name:"CursorFloating",props:{intensity:{default:1.5}},setup(r){const n=r,o=s(null),a=s(""),e=s("50% 50%"),i=s("50% 50%"),y=s(.5);function w(c){if(!o.value)return;const u=o.value,b=u.getBoundingClientRect(),C=c.clientX-b.left,_=c.clientY-b.top,z=u.offsetWidth,B=u.offsetHeight,f=Math.abs(Math.floor(100/z*C)-100),m=Math.abs(Math.floor(100/B*_)-100),x=50+(f-50)/1.5,g=50+(m-50)/1.5,P=50+(f-50)/7,S=50+(m-50)/7,X=(x-50)/1.5*.2*n.intensity,Y=(g-50)/2*-1*.2*n.intensity,A=50-f+(50-m),j=.5+Math.abs(A)*.008*n.intensity;a.value=`perspective(1200px) rotateX(${Y}deg) rotateY(${X}deg) scale3d(${1+.015*n.intensity}, ${1+.015*n.intensity}, ${1+.015*n.intensity})`,e.value=`${x}% ${g}%`,i.value=`${P}% ${S}%`,y.value=j}function $(){a.value="perspective(1200px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)",e.value="50% 50%",i.value="50% 50%",y.value=.5}return R(()=>{a.value="perspective(1200px) rotateX(0deg) rotateY(0deg) scale3d(1, 1, 1)"}),(c,u)=>(d(),p("div",{ref_key:"cardRef",ref:o,class:"card-hover-effect",style:F({transform:a.value,"--effect-intensity":r.intensity}),onMousemove:w,onMouseleave:$},[D(c.$slots,"default",{},void 0,!0)],36))}}),E=H(W,[["__scopeId","data-v-895421da"]]),L={relative:"",flex:"~ col 1","justify-between":"","gap-3":"","overflow-hidden":"","rounded-lg":"",bg:"white dark:neutral-900","p-5":"",transition:"all ease-in-out duration-400",after:"content-empty absolute inset-0 z--2 w-full h-full bg-dotted-[neutral-200/80] bg-size-10px mask-image-[linear-gradient(165deg,white_30%,transparent_50%)] transition-all duration-400 ease-in-out",hover:"after:bg-dotted-[primary-300/50] dark:after:bg-dotted-[primary-200/20] text-primary-600/80 dark:text-primary-300/80"},O={"z-1":"",flex:"","items-start":"","justify-between":"","gap-2":""},q={"flex-1":"",truncate:"","text-lg":"","font-bold":""},G={key:0,"shrink-0":"","rounded-md":"","p-1":"",bg:"primary-100 dark:primary-900/40",text:"primary-600 dark:primary-400"},J={key:0,"line-clamp-3":"","min-h-40px":"","flex-1":"","text-sm":"",text:"neutral-500 dark:neutral-400"},K={"z-1":"",flex:"","items-center":"","justify-between":"","text-xs":"",text:"neutral-500 dark:neutral-400"},Q={flex:"","items-center":"","gap-1.5":""},T={flex:"","items-center":"","gap-0.5":""},U={flex:"","items-center":"","gap-0.5":""},Z={flex:"","items-center":"","justify-end":"","px-2":"","py-1.5":""},ee=["disabled"],ne=M({__name:"CardListItem",props:{id:null,name:null,description:null,isActive:{type:Boolean},isSelected:{type:Boolean},version:null,consciousnessModel:null,voiceModel:null},emits:["select","activate","delete"],setup(r,{emit:n}){const o=n;return(a,e)=>(d(),I(V(E),{relative:"","min-h-120px":"",flex:"~ col","cursor-pointer":"","overflow-hidden":"","rounded-xl":"",class:h([r.isSelected?"border-2 border-primary-400 dark:border-primary-600":"border-2 border-neutral-100 dark:border-neutral-800/25"]),bg:"neutral-200/50 dark:neutral-800/50","drop-shadow":"none hover:[0px_4px_4px_rgba(220,220,220,0.4)] active:[0px_0px_0px_rgba(220,220,220,0.25)] dark:hover:none",transition:"all ease-in-out duration-400",before:"content-empty absolute inset-0 z-0 w-25% h-full transition-all duration-400 ease-in-out bg-gradient-to-r from-primary-500/0 to-primary-500/0 dark:from-primary-400/0 dark:to-primary-400/0 mask-image-[linear-gradient(120deg,white_100%)] opacity-0",hover:"before:w-50% before:opacity-100 before:bg-gradient-to-r before:from-primary-500/20 before:via-primary-500/10 before:to-transparent before:dark:from-primary-400/20 before:dark:via-primary-400/10 before:dark:to-transparent",onClick:e[2]||(e[2]=i=>o("select"))},{default:N(()=>[t("div",L,[t("div",O,[t("h3",q,l(r.name),1),r.isActive?(d(),p("div",G,e[3]||(e[3]=[t("div",{"i-solar:check-circle-bold-duotone":"","text-sm":""},null,-1)]))):v("",!0)]),r.description?(d(),p("p",J,l(r.description),1)):v("",!0),t("div",K,[t("div",null,"v"+l(r.version),1),t("div",Q,[t("div",T,[e[4]||(e[4]=t("div",{"i-lucide:ghost":"","text-xs":""},null,-1)),t("span",null,l(r.consciousnessModel),1)]),t("div",U,[e[5]||(e[5]=t("div",{"i-lucide:mic":"","text-xs":""},null,-1)),t("span",null,l(r.voiceModel),1)])])])]),t("div",Z,[t("button",{"rounded-lg":"","p-1.5":"","transition-colors":"",hover:"bg-neutral-200 dark:bg-neutral-700/50",disabled:r.isActive,onClick:e[0]||(e[0]=k(i=>o("activate"),["stop"]))},[t("div",{class:h([r.isActive?"i-solar:check-circle-bold-duotone text-primary-500 dark:text-primary-400":"i-solar:play-circle-broken text-neutral-500 dark:text-neutral-400"])},null,2)],8,ee),r.id!=="default"?(d(),p("button",{key:0,"rounded-lg":"","p-1.5":"","transition-colors":"",hover:"bg-neutral-200 dark:bg-neutral-700/50",onClick:e[1]||(e[1]=k(i=>o("delete"),["stop"]))},e[6]||(e[6]=[t("div",{"i-solar:trash-bin-trash-linear":"",text:"neutral-500 dark:neutral-400"},null,-1)]))):v("",!0)])]),_:1},8,["class"]))}});export{ne as _}; diff --git a/assets/Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js b/assets/Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js similarity index 87% rename from assets/Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js rename to assets/Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js index 9f510c8cbb4c650528c213d535ff2b4a973289d3..07ba2131c5611d6e8895ec820119ca79b80c0a5e 100644 --- a/assets/Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js +++ b/assets/Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js @@ -1 +1 @@ -import{_ as d}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import{d as p,bI as m,bJ as f,af as b,c,o as v,m as r,b as V,bU as u,bV as y,y as C,C as g,bW as k,a as s,bL as x,D as i}from"./index-20XXNHAB.js";const B={op50:""},w=p({__name:"Collapsable",props:m({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,e=f(o,"modelValue");b(()=>{t.default!=null&&(e.value=!!t.default)});function n(l){return e.value=l,l}return(l,a)=>(v(),c("div",null,[r(l.$slots,"trigger",u(y({visible:e.value,setVisible:n})),()=>[s("button",{sticky:"","top-0":"","z-10":"",flex:"","items-center":"","justify-between":"",px2:"",py1:"","text-sm":"","backdrop-blur-xl":"",onClick:a[0]||(a[0]=_=>e.value=!e.value)},[s("span",null,i(t.label??"Collapsable"),1),a[1]||(a[1]=x()),s("span",B,i(e.value?"▲":"▼"),1)])]),V(d,null,{default:C(()=>[e.value?r(l.$slots,"default",u(k({key:0},{visible:e.value,setVisible:n}))):g("",!0)]),_:3})]))}});export{w as _}; +import{_ as d}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import{d as p,bI as m,bJ as f,af as b,c,o as v,m as r,b as V,bU as u,bV as y,y as C,C as g,bW as k,a as s,bL as x,D as i}from"./index-D8Nm21zW.js";const B={op50:""},w=p({__name:"Collapsable",props:m({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,e=f(o,"modelValue");b(()=>{t.default!=null&&(e.value=!!t.default)});function n(l){return e.value=l,l}return(l,a)=>(v(),c("div",null,[r(l.$slots,"trigger",u(y({visible:e.value,setVisible:n})),()=>[s("button",{sticky:"","top-0":"","z-10":"",flex:"","items-center":"","justify-between":"",px2:"",py1:"","text-sm":"","backdrop-blur-xl":"",onClick:a[0]||(a[0]=_=>e.value=!e.value)},[s("span",null,i(t.label??"Collapsable"),1),a[1]||(a[1]=x()),s("span",B,i(e.value?"▲":"▼"),1)])]),V(d,null,{default:C(()=>[e.value?r(l.$slots,"default",u(k({key:0},{visible:e.value,setVisible:n}))):g("",!0)]),_:3})]))}});export{w as _}; diff --git a/assets/ColorPalette.vue_vue_type_script_setup_true_lang-B9Kdi_g7.js b/assets/ColorPalette.vue_vue_type_script_setup_true_lang-B9Kdi_g7.js deleted file mode 100644 index 585b08a4321e018b81f60689134cc92fda0dcb03..0000000000000000000000000000000000000000 --- a/assets/ColorPalette.vue_vue_type_script_setup_true_lang-B9Kdi_g7.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as b}from"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import{d as c,x as m,o as i,y as l,a as n,z as u,m as y,bL as f,D as g,v as C,c as d,C as k,bx as v,by as x,b as s,u as e,n as h,bS as w}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{W as S,j as $,q as z,U as B,G as E,H as V}from"./index-qOh3wAiY.js";const F=["onClick"],H={flex:"","gap-1.5":""},q=c({__name:"Section",props:{title:null,icon:null,innerClass:null,expand:{type:Boolean,default:!0}},setup(t){return(r,_)=>(i(),m(b,{default:t.expand},{trigger:l(o=>[n("button",{class:"w-full flex items-center justify-between rounded-lg px-4 py-3 outline-none transition-all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700",onClick:a=>o.setVisible(!o.visible)},[n("div",H,[n("div",{class:u(t.icon),"size-6":""},null,2),f(" "+g(t.title),1)]),n("div",{"i-solar:alt-arrow-down-bold-duotone":"",transition:"transform duration-250",class:u({"rotate-180":o.visible})},null,2)],8,F)]),default:l(()=>[n("div",{grid:"","gap-4":"","p-4":"",class:u(t.innerClass)},[y(r.$slots,"default")],2)]),_:3},8,["default"]))}}),L={key:0,flex:"","gap-2":""},G=c({__name:"ColorPalette",props:{colors:null},setup(t){const r=C();return(_,o)=>t.colors.length?(i(),d("div",L,[(i(!0),d(v,null,x(t.colors,({hex:a,name:p})=>(i(),m(e(V),{key:a||"default"},{default:l(()=>[s(e(S),null,{default:l(()=>[s(e($),{transition:"all ease-in-out duration-250","bg-primary-500":"","size-6":"","cursor-pointer":"","rounded-full":"",style:h(a?{background:a}:{"--theme-colors-hue":e(w)}),class:u(e(r).isColorSelectedForPrimary(a)?"scale-150 mx-1":"hover:scale-110"),onClick:N=>e(r).applyPrimaryColorFrom(a)},null,8,["style","class","onClick"]),s(e(z),null,{default:l(()=>[s(e(B),{bg:"white dark:neutral-800","rounded-lg":"","px-3":"","py-1.5":"","text-sm":"","shadow-md":""},{default:l(()=>[f(g(p)+" ",1),s(e(E),{"fill-white":"","dark:fill-neutral-800":""})]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))])):k("",!0)}});export{q as _,G as a}; diff --git a/assets/ColorPalette.vue_vue_type_script_setup_true_lang-Dh84R3gB.js b/assets/ColorPalette.vue_vue_type_script_setup_true_lang-Dh84R3gB.js new file mode 100644 index 0000000000000000000000000000000000000000..6980e86d8c3ae691c13ea7df9766356d878081cd --- /dev/null +++ b/assets/ColorPalette.vue_vue_type_script_setup_true_lang-Dh84R3gB.js @@ -0,0 +1 @@ +import{_ as b}from"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import{d as c,x as m,o as i,y as l,a as n,z as u,m as y,bL as f,D as g,v as C,c as d,C as k,bx as v,by as x,b as s,u as e,n as h,bS as w}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{W as S,j as $,q as z,U as B,G as E,H as V}from"./index-BUaUWOtl.js";const F=["onClick"],H={flex:"","gap-1.5":""},q=c({__name:"Section",props:{title:null,icon:null,innerClass:null,expand:{type:Boolean,default:!0}},setup(t){return(r,_)=>(i(),m(b,{default:t.expand},{trigger:l(o=>[n("button",{class:"w-full flex items-center justify-between rounded-lg px-4 py-3 outline-none transition-all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700",onClick:a=>o.setVisible(!o.visible)},[n("div",H,[n("div",{class:u(t.icon),"size-6":""},null,2),f(" "+g(t.title),1)]),n("div",{"i-solar:alt-arrow-down-bold-duotone":"",transition:"transform duration-250",class:u({"rotate-180":o.visible})},null,2)],8,F)]),default:l(()=>[n("div",{grid:"","gap-4":"","p-4":"",class:u(t.innerClass)},[y(r.$slots,"default")],2)]),_:3},8,["default"]))}}),L={key:0,flex:"","gap-2":""},G=c({__name:"ColorPalette",props:{colors:null},setup(t){const r=C();return(_,o)=>t.colors.length?(i(),d("div",L,[(i(!0),d(v,null,x(t.colors,({hex:a,name:p})=>(i(),m(e(V),{key:a||"default"},{default:l(()=>[s(e(S),null,{default:l(()=>[s(e($),{transition:"all ease-in-out duration-250","bg-primary-500":"","size-6":"","cursor-pointer":"","rounded-full":"",style:h(a?{background:a}:{"--theme-colors-hue":e(w)}),class:u(e(r).isColorSelectedForPrimary(a)?"scale-150 mx-1":"hover:scale-110"),onClick:N=>e(r).applyPrimaryColorFrom(a)},null,8,["style","class","onClick"]),s(e(z),null,{default:l(()=>[s(e(B),{bg:"white dark:neutral-800","rounded-lg":"","px-3":"","py-1.5":"","text-sm":"","shadow-md":""},{default:l(()=>[f(g(p)+" ",1),s(e(E),{"fill-white":"","dark:fill-neutral-800":""})]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))])):k("",!0)}});export{q as _,G as a}; diff --git a/assets/DeleteCardDialog-BfLGvfow.js b/assets/DeleteCardDialog-BfLGvfow.js new file mode 100644 index 0000000000000000000000000000000000000000..1ea0d4b944fbc0fcae2b4c9686071ac6fa3ad384 --- /dev/null +++ b/assets/DeleteCardDialog-BfLGvfow.js @@ -0,0 +1 @@ +import{_ as o}from"./DeleteCardDialog.vue_vue_type_script_setup_true_lang-NzJTgSSI.js";import"./index-D8Nm21zW.js";import"./index-BUaUWOtl.js";export{o as default}; diff --git a/assets/DeleteCardDialog-CSdJRueh.js b/assets/DeleteCardDialog-CSdJRueh.js deleted file mode 100644 index ec033bf8adbd785ac26adce42c87f758f7b29c8a..0000000000000000000000000000000000000000 --- a/assets/DeleteCardDialog-CSdJRueh.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as o}from"./DeleteCardDialog.vue_vue_type_script_setup_true_lang-CPUl-rMo.js";import"./index-20XXNHAB.js";import"./index-qOh3wAiY.js";export{o as default}; diff --git a/assets/DeleteCardDialog.vue_vue_type_script_setup_true_lang-CPUl-rMo.js b/assets/DeleteCardDialog.vue_vue_type_script_setup_true_lang-NzJTgSSI.js similarity index 93% rename from assets/DeleteCardDialog.vue_vue_type_script_setup_true_lang-CPUl-rMo.js rename to assets/DeleteCardDialog.vue_vue_type_script_setup_true_lang-NzJTgSSI.js index 8f1d1c6aa8c2800700679612a42081ce81519fe4..180b4bbf88567e1ded802800edd67f65b444a3cb 100644 --- a/assets/DeleteCardDialog.vue_vue_type_script_setup_true_lang-CPUl-rMo.js +++ b/assets/DeleteCardDialog.vue_vue_type_script_setup_true_lang-NzJTgSSI.js @@ -1 +1 @@ -import{d as v,h as p,c as r,o as d,z as g,a as m,C as h,m as _,D as i,q as w,x as C,y as n,b as t,u as e,bL as x}from"./index-20XXNHAB.js";import{A as V,k as B,O as N,V as z,F as D,M as O,N as S,T}from"./index-qOh3wAiY.js";const $=["disabled"],j={class:"flex flex-row items-center justify-center gap-2"},A={key:0,class:"i-lucide:loader-circle animate-spin"},F={key:2},y=v({__name:"Button",props:{icon:null,label:null,disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},variant:{default:"primary"},size:{default:"md"},block:{type:Boolean,default:!1}},setup(a){const s=a,l=p(()=>s.disabled||s.loading),o={primary:"bg-primary-500 hover:bg-primary-600 dark:bg-primary-400 dark:hover:bg-primary-500 text-white",secondary:"bg-neutral-100 hover:bg-neutral-200 dark:bg-neutral-600 dark:hover:bg-neutral-500 text-neutral-900 dark:text-neutral-100",danger:"bg-red-500 hover:bg-red-600 dark:bg-red-400 dark:hover:bg-red-500 text-white"},c={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u=p(()=>["rounded-lg font-medium outline-none transition-all duration-200 ease-in-out","disabled:cursor-not-allowed disabled:opacity-50",s.block?"w-full":"",c[s.size],o[s.variant],{"opacity-50 cursor-not-allowed":l.value},"focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-neutral-900","focus:ring-primary-500/50 dark:focus:ring-primary-400/50"]);return(b,f)=>(d(),r("button",{disabled:l.value,class:g(u.value)},[m("div",j,[a.loading?(d(),r("div",A)):a.icon?(d(),r("div",{key:1,class:g(a.icon)},null,2)):h("",!0),a.label?(d(),r("span",F,i(a.label),1)):_(b.$slots,"default",{key:3})])],10,$))}}),I={class:"flex flex-row justify-end gap-3"},E=v({__name:"DeleteCardDialog",props:{modelValue:{type:Boolean},cardName:null},emits:["update:modelValue","confirm","cancel"],setup(a,{emit:s}){const l=s,{t:o}=w();function c(){l("update:modelValue",!1),l("cancel")}function u(){l("update:modelValue",!1),l("confirm")}return(b,f)=>(d(),C(e(T),{open:a.modelValue,"onUpdate:open":f[0]||(f[0]=k=>l("update:modelValue",k))},{default:n(()=>[t(e(V),null,{default:n(()=>[t(e(B),{class:"data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-50 bg-black/50"}),t(e(N),{class:"data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-50 max-w-md w-full border border-neutral-200 rounded-xl bg-white p-6 shadow-xl -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800"},{default:n(()=>[t(e(z),{class:"mb-4 text-xl font-bold"},{default:n(()=>[x(i(e(o)("settings.pages.card.delete_card")),1)]),_:1}),t(e(D),{class:"mb-6"},{default:n(()=>[x(i(e(o)("settings.pages.card.delete_confirmation"))+" ",1),m("b",null,'"'+i(a.cardName||"")+'"',1)]),_:1}),m("div",I,[t(e(O),{"as-child":""},{default:n(()=>[t(e(y),{variant:"secondary",label:e(o)("settings.pages.card.cancel"),onClick:c},null,8,["label"])]),_:1}),t(e(S),{"as-child":""},{default:n(()=>[t(e(y),{variant:"danger",label:e(o)("settings.pages.card.delete"),onClick:u},null,8,["label"])]),_:1})])]),_:1})]),_:1})]),_:1},8,["open"]))}});export{E as _,y as a}; +import{d as v,h as p,c as r,o as d,z as g,a as m,C as h,m as _,D as i,q as w,x as C,y as n,b as t,u as e,bL as x}from"./index-D8Nm21zW.js";import{A as V,k as B,O as N,V as z,F as D,M as O,N as S,T}from"./index-BUaUWOtl.js";const $=["disabled"],j={class:"flex flex-row items-center justify-center gap-2"},A={key:0,class:"i-lucide:loader-circle animate-spin"},F={key:2},y=v({__name:"Button",props:{icon:null,label:null,disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},variant:{default:"primary"},size:{default:"md"},block:{type:Boolean,default:!1}},setup(a){const s=a,l=p(()=>s.disabled||s.loading),o={primary:"bg-primary-500 hover:bg-primary-600 dark:bg-primary-400 dark:hover:bg-primary-500 text-white",secondary:"bg-neutral-100 hover:bg-neutral-200 dark:bg-neutral-600 dark:hover:bg-neutral-500 text-neutral-900 dark:text-neutral-100",danger:"bg-red-500 hover:bg-red-600 dark:bg-red-400 dark:hover:bg-red-500 text-white"},c={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u=p(()=>["rounded-lg font-medium outline-none transition-all duration-200 ease-in-out","disabled:cursor-not-allowed disabled:opacity-50",s.block?"w-full":"",c[s.size],o[s.variant],{"opacity-50 cursor-not-allowed":l.value},"focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-neutral-900","focus:ring-primary-500/50 dark:focus:ring-primary-400/50"]);return(b,f)=>(d(),r("button",{disabled:l.value,class:g(u.value)},[m("div",j,[a.loading?(d(),r("div",A)):a.icon?(d(),r("div",{key:1,class:g(a.icon)},null,2)):h("",!0),a.label?(d(),r("span",F,i(a.label),1)):_(b.$slots,"default",{key:3})])],10,$))}}),I={class:"flex flex-row justify-end gap-3"},E=v({__name:"DeleteCardDialog",props:{modelValue:{type:Boolean},cardName:null},emits:["update:modelValue","confirm","cancel"],setup(a,{emit:s}){const l=s,{t:o}=w();function c(){l("update:modelValue",!1),l("cancel")}function u(){l("update:modelValue",!1),l("confirm")}return(b,f)=>(d(),C(e(T),{open:a.modelValue,"onUpdate:open":f[0]||(f[0]=k=>l("update:modelValue",k))},{default:n(()=>[t(e(V),null,{default:n(()=>[t(e(B),{class:"data-[state=open]:animate-fadeIn data-[state=closed]:animate-fadeOut fixed inset-0 z-50 bg-black/50"}),t(e(N),{class:"data-[state=open]:animate-contentShow data-[state=closed]:animate-contentHide fixed left-1/2 top-1/2 z-50 max-w-md w-full border border-neutral-200 rounded-xl bg-white p-6 shadow-xl -translate-x-1/2 -translate-y-1/2 dark:border-neutral-700 dark:bg-neutral-800"},{default:n(()=>[t(e(z),{class:"mb-4 text-xl font-bold"},{default:n(()=>[x(i(e(o)("settings.pages.card.delete_card")),1)]),_:1}),t(e(D),{class:"mb-6"},{default:n(()=>[x(i(e(o)("settings.pages.card.delete_confirmation"))+" ",1),m("b",null,'"'+i(a.cardName||"")+'"',1)]),_:1}),m("div",I,[t(e(O),{"as-child":""},{default:n(()=>[t(e(y),{variant:"secondary",label:e(o)("settings.pages.card.cancel"),onClick:c},null,8,["label"])]),_:1}),t(e(S),{"as-child":""},{default:n(()=>[t(e(y),{variant:"danger",label:e(o)("settings.pages.card.delete"),onClick:u},null,8,["label"])]),_:1})])]),_:1})]),_:1})]),_:1},8,["open"]))}});export{E as _,y as a}; diff --git a/assets/FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js b/assets/FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js similarity index 81% rename from assets/FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js rename to assets/FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js index 070971a75195d39867c0deeb45d032999f0a3c4d..02dc4ac4b8f8bc44c8d959a6bb6aee05ed19577a 100644 --- a/assets/FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js +++ b/assets/FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js @@ -1 +1 @@ -import{_ as u}from"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import{d as i,bI as c,bJ as p,c as o,o as d,a as l,b as m,bL as _,C as x,D as n,z as f}from"./index-20XXNHAB.js";const V={"max-w-full":""},h={flex:"~ col gap-4"},b={class:"flex items-center gap-1 text-sm font-medium"},y={key:0,class:"text-red-500"},v={class:"text-xs text-neutral-500 dark:text-neutral-400","text-nowrap":""},B=i({__name:"FieldInput",props:c({label:null,description:null,placeholder:null,required:{type:Boolean},type:null,inputClass:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=t,a=p(t,"modelValue");return(C,s)=>(d(),o("div",V,[l("label",h,[l("div",null,[l("div",b,[_(n(e.label)+" ",1),e.required!==!1?(d(),o("span",y,"*")):x("",!0)]),l("div",v,n(e.description),1)]),m(u,{modelValue:a.value,"onUpdate:modelValue":s[0]||(s[0]=r=>a.value=r),type:e.type,placeholder:e.placeholder,class:f(e.inputClass)},null,8,["modelValue","type","placeholder","class"])])]))}});export{B as _}; +import{_ as u}from"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import{d as i,bI as c,bJ as p,c as o,o as d,a as l,b as m,bL as _,C as x,D as n,z as f}from"./index-D8Nm21zW.js";const V={"max-w-full":""},h={flex:"~ col gap-4"},b={class:"flex items-center gap-1 text-sm font-medium"},y={key:0,class:"text-red-500"},v={class:"text-xs text-neutral-500 dark:text-neutral-400","text-nowrap":""},B=i({__name:"FieldInput",props:c({label:null,description:null,placeholder:null,required:{type:Boolean},type:null,inputClass:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=t,a=p(t,"modelValue");return(C,s)=>(d(),o("div",V,[l("label",h,[l("div",null,[l("div",b,[_(n(e.label)+" ",1),e.required!==!1?(d(),o("span",y,"*")):x("",!0)]),l("div",v,n(e.description),1)]),m(u,{modelValue:a.value,"onUpdate:modelValue":s[0]||(s[0]=r=>a.value=r),type:e.type,placeholder:e.placeholder,class:f(e.inputClass)},null,8,["modelValue","type","placeholder","class"])])]))}});export{B as _}; diff --git a/assets/FieldRange-D662BETn.css b/assets/FieldRange-D662BETn.css deleted file mode 100644 index 0772761bb87781cfbd2db1b8d43872af289087b9..0000000000000000000000000000000000000000 --- a/assets/FieldRange-D662BETn.css +++ /dev/null @@ -1 +0,0 @@ -.form_input-range[data-v-6ca6d31c]{--height: 2em;min-height:var(--height);-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border-radius:4px;transition:background-color .2s ease;--thumb-width: 4px;--thumb-height: var(--height);--thumb-box-shadow: 0 0 0px #e6e6e6;--thumb-border: none;--thumb-border-radius: 999px;--thumb-background: oklch(80% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--thumb-background-hover: oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--thumb-background-active: oklch(70% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--track-height: calc(var(--height) - var(--track-value-padding) * 2);--track-box-shadow: none;--track-border: solid 2px rgb(238, 238, 238);--track-border-radius: 6px;--track-background: rgb(238, 238, 238);--track-background-hover: rgb(238, 238, 238);--track-background-active: rgb(238, 238, 238);--track-value-background: rgb(255, 255, 255);--track-value-background-hover: rgb(255, 255, 255);--track-value-background-active: rgb(255, 255, 255);--track-value-padding: 2px}.dark .form_input-range[data-v-6ca6d31c]{--thumb-background: oklch(70% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--thumb-background-hover: oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--thumb-background-active: oklch(80% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--track-border: solid 2px rgb(44, 44, 44);--track-background: rgb(44, 44, 44);--track-background-hover: rgb(44, 44, 44);--track-background-active: rgb(44, 44, 44);--track-value-background: rgb(164, 164, 164);--track-value-background-hover: rgb(164, 164, 164);--track-value-background-active: rgb(164, 164, 164)}.form_input-range.slider-progress[data-v-6ca6d31c]{--range: calc(var(--max) - var(--min));--ratio: calc((var(--value) - var(--min)) / var(--range));--sx: calc(.5 * 0em + var(--ratio) * (100% - 0em))}.form_input-range[data-v-6ca6d31c]:focus{outline:none}.form_input-range[data-v-6ca6d31c]::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:var(--thumb-width);height:var(--thumb-height);border-radius:var(--thumb-border-radius);background:var(--thumb-background);border:var(--thumb-border);box-shadow:var(--thumb-box-shadow);margin-top:calc(var(--track-height) * .5 - var(--thumb-height) * .5 - 2px);margin-left:calc(0 - var(--track-value-padding));cursor:col-resize;transition:background .2s ease-in-out,box-shadow .2s ease-in-out,border-color .2s ease-in-out,transform .2s ease-in-out}.form_input-range[data-v-6ca6d31c]::-webkit-slider-runnable-track{height:var(--track-height);border:var(--track-border);border-radius:var(--track-border-radius);background:var(--track-background);box-shadow:var(--track-box-shadow);position:relative;cursor:col-resize;transition:box-shadow .2s ease-in-out,border-color .2s ease-in-out}.form_input-range[data-v-6ca6d31c]::-webkit-slider-thumb:hover{background:var(--thumb-background-hover)}.form_input-range[data-v-6ca6d31c]:hover::-webkit-slider-runnable-track{background:var(--track-background-hover)}.form_input-range[data-v-6ca6d31c]::-webkit-slider-thumb:active{background:var(--thumb-background-active)}.form_input-range[data-v-6ca6d31c]:active::-webkit-slider-runnable-track{background:var(--track-background-active)}.form_input-range.slider-progress[data-v-6ca6d31c]::-webkit-slider-runnable-track{margin-right:calc(0 - var(--track-value-padding));background:linear-gradient(var(--track-value-background),var(--track-value-background)) 0 / var(--sx) 100% no-repeat,var(--track-background)}.form_input-range.slider-progress[data-v-6ca6d31c]:hover::-webkit-slider-runnable-track{background:linear-gradient(var(--track-value-background-hover),var(--track-value-background-hover)) 0 / var(--sx) 100% no-repeat,var(--track-background-hover)}.form_input-range.slider-progress[data-v-6ca6d31c]:active::-webkit-slider-runnable-track{background:linear-gradient(var(--track-value-background-active),var(--track-value-background-active)) 0 / var(--sx) 100% no-repeat,var(--track-background-active)}.form_input-range[data-v-6ca6d31c]::-moz-range-thumb{width:var(--thumb-width);height:var(--thumb-height);border-radius:var(--thumb-border-radius);background:var(--thumb-background);border:none;box-shadow:var(--thumb-box-shadow);cursor:col-resize;margin-left:calc(0 - var(--track-value-padding))}.form_input-range[data-v-6ca6d31c]::-moz-range-track{height:var(--track-height);border:var(--track-border);border-radius:var(--track-border-radius);background:var(--track-background);box-shadow:var(--track-box-shadow);cursor:col-resize;width:calc(100% - var(--track-value-padding) * 2)}.form_input-range[data-v-6ca6d31c]::-moz-range-thumb:hover{background:var(--thumb-background-hover)}.form_input-range[data-v-6ca6d31c]:hover::-moz-range-track{background:var(--track-background-hover)}.form_input-range[data-v-6ca6d31c]::-moz-range-thumb:active{background:var(--thumb-background-active)}.form_input-range[data-v-6ca6d31c]:active::-moz-range-track{background:var(--track-background-active)}.form_input-range.slider-progress[data-v-6ca6d31c]::-moz-range-track{background:linear-gradient(var(--track-value-background),var(--track-value-background)) 0 / var(--sx) 100% no-repeat,var(--track-background)}.form_input-range.slider-progress[data-v-6ca6d31c]:hover::-moz-range-track{background:linear-gradient(var(--track-value-background-hover),var(--track-value-background-hover)) 0 / var(--sx) 100% no-repeat,var(--track-background-hover)}.form_input-range.slider-progress[data-v-6ca6d31c]:active::-moz-range-track{background:linear-gradient(var(--track-value-background-active),var(--track-value-background-active)) 0 / var(--sx) 100% no-repeat,var(--track-background-active)}.form_input-range[data-v-6ca6d31c]::-ms-fill-upper{background:transparent;border-color:transparent}.form_input-range[data-v-6ca6d31c]::-ms-fill-lower{background:transparent;border-color:transparent}.form_input-range[data-v-6ca6d31c]::-ms-thumb{width:var(--thumb-width);height:var(--thumb-height);border-radius:var(--thumb-border-radius);background:var(--thumb-background);border:var(--thumb-border);box-shadow:var(--thumb-box-shadow);margin-top:0;margin-left:calc(0 - var(--track-value-padding));box-sizing:border-box;cursor:col-resize}.form_input-range[data-v-6ca6d31c]::-ms-track{height:var(--track-height);border-radius:var(--track-border-radius);background:var(--track-background);border:var(--track-border);box-shadow:var(--track-box-shadow);box-sizing:border-box;cursor:col-resize}.form_input-range[data-v-6ca6d31c]::-ms-thumb:hover{background:var(--thumb-background-hover)}.form_input-range[data-v-6ca6d31c]:hover::-ms-track{background:var(--track-background-hover)}.form_input-range[data-v-6ca6d31c]::-ms-thumb:active{background:var(--thumb-background-active)}.form_input-range[data-v-6ca6d31c]:active::-ms-track{background:var(--track-background-active)}.form_input-range.slider-progress[data-v-6ca6d31c]::-ms-fill-lower{height:var(--track-height);border-radius:var(--track-border-radius) 0 0 var(--track-border-radius);margin:0;background:var(--track-value-background);border:none;border-right-width:0;margin-left:calc(var(--track-value-padding));margin-right:calc(0 - var(--track-value-padding))}.form_input-range.slider-progress[data-v-6ca6d31c]:hover::-ms-fill-lower{background:var(--track-value-background-hover)}.form_input-range.slider-progress[data-v-6ca6d31c]:active::-ms-fill-lower{background:var(--track-value-background-active)} diff --git a/assets/FieldRange.vue_vue_type_script_setup_true_lang-B670Jjy-.js b/assets/FieldRange.vue_vue_type_script_setup_true_lang-B670Jjy-.js new file mode 100644 index 0000000000000000000000000000000000000000..06042058618ad43c0d07e31c26aefbf7bc4fb274 --- /dev/null +++ b/assets/FieldRange.vue_vue_type_script_setup_true_lang-B670Jjy-.js @@ -0,0 +1 @@ +import{d as v,bI as x,bJ as g,h as r,g as y,l as b,A as M,bE as h,o as V,c as _,bn as k,a as o,D as i,b as C}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";const R=["min","max","step"],w=v({__name:"Range",props:x({min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1},thumbColor:{default:"#9090906e"},trackColor:{default:"gray"},trackValueColor:{default:"red"}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,l=g(t,"modelValue"),m=r(()=>a.min*1e4),s=r(()=>a.max*1e4),n=r(()=>a.step*1e4),e=y(),c=r({get:()=>l.value*1e4,set:p=>{l.value=p/1e4,f()}});b(()=>{f()});function f(){e.value&&(e.value.style.setProperty("--value",e.value.value),e.value.style.setProperty("--min",e.value.min?e.value.min:a.min.toString()),e.value.style.setProperty("--max",e.value.max?e.value.max:a.max.toString()))}return(p,u)=>M((V(),_("input",{ref_key:"sliderRef",ref:e,"onUpdate:modelValue":u[0]||(u[0]=d=>c.value=d),type:"range",min:m.value,max:s.value,step:n.value,class:"slider-progress form_input-range",onInput:u[1]||(u[1]=d=>{d.target.style.setProperty("--value",d.target.value)})},null,40,R)),[[h,c.value,void 0,{number:!0}]])}}),B=k(w,[["__scopeId","data-v-6ca6d31c"]]),P={flex:"~ col gap-4"},S={flex:"~ row","items-center":"","gap-2":""},D={flex:"1"},I={class:"flex items-center gap-1 text-sm font-medium"},q={class:"text-xs text-neutral-500 dark:text-neutral-400"},E={"font-mono":""},F={flex:"~ row","items-center":"","gap-2":""},U=v({__name:"FieldRange",props:x({min:null,max:null,step:null,label:null,description:null,formatValue:{type:Function}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,l=g(t,"modelValue");return(m,s)=>{var n;return V(),_("label",P,[o("div",S,[o("div",D,[o("div",I,i(t.label),1),o("div",q,i(t.description),1)]),o("span",E,i(((n=a.formatValue)==null?void 0:n.call(a,l.value))||l.value),1)]),o("div",F,[C(B,{modelValue:l.value,"onUpdate:modelValue":s[0]||(s[0]=e=>l.value=e),min:t.min||0,max:t.max||1,step:t.step||.01,"w-full":""},null,8,["modelValue","min","max","step"])])])}}});export{U as _}; diff --git a/assets/FieldRange.vue_vue_type_script_setup_true_lang-BtFz1_fe.js b/assets/FieldRange.vue_vue_type_script_setup_true_lang-BtFz1_fe.js deleted file mode 100644 index aba6deb4365f9bb7197df9bea83f84ae726d1094..0000000000000000000000000000000000000000 --- a/assets/FieldRange.vue_vue_type_script_setup_true_lang-BtFz1_fe.js +++ /dev/null @@ -1 +0,0 @@ -import{d as p,bI as x,bJ as g,h as r,g as y,l as b,A as M,bE as h,o as V,c as _,bn as k,a as s,D as i,b as C}from"./index-20XXNHAB.js";const R=["min","max","step"],w=p({__name:"Range",props:x({min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1},thumbColor:{default:"#9090906e"},trackColor:{default:"gray"},trackValueColor:{default:"red"}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,l=g(t,"modelValue"),m=r(()=>a.min*1e4),o=r(()=>a.max*1e4),n=r(()=>a.step*1e4),e=y(),c=r({get:()=>l.value*1e4,set:v=>{l.value=v/1e4,f()}});b(()=>{f()});function f(){e.value&&(e.value.style.setProperty("--value",e.value.value),e.value.style.setProperty("--min",e.value.min?e.value.min:a.min.toString()),e.value.style.setProperty("--max",e.value.max?e.value.max:a.max.toString()))}return(v,u)=>M((V(),_("input",{ref_key:"sliderRef",ref:e,"onUpdate:modelValue":u[0]||(u[0]=d=>c.value=d),type:"range",min:m.value,max:o.value,step:n.value,class:"slider-progress form_input-range",onInput:u[1]||(u[1]=d=>{d.target.style.setProperty("--value",d.target.value)})},null,40,R)),[[h,c.value,void 0,{number:!0}]])}}),B=k(w,[["__scopeId","data-v-6ca6d31c"]]),P={flex:"~ col gap-4"},S={flex:"~ row","items-center":"","gap-2":""},D={flex:"1"},I={class:"flex items-center gap-1 text-sm font-medium"},q={class:"text-xs text-neutral-500 dark:text-neutral-400"},E={"font-mono":""},F={flex:"~ row","items-center":"","gap-2":""},T=p({__name:"FieldRange",props:x({min:null,max:null,step:null,label:null,description:null,formatValue:{type:Function}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=t,l=g(t,"modelValue");return(m,o)=>{var n;return V(),_("label",P,[s("div",S,[s("div",D,[s("div",I,i(t.label),1),s("div",q,i(t.description),1)]),s("span",E,i(((n=a.formatValue)==null?void 0:n.call(a,l.value))||l.value),1)]),s("div",F,[C(B,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=e=>l.value=e),min:t.min||0,max:t.max||1,step:t.step||.01,"w-full":""},null,8,["modelValue","min","max","step"])])])}}});export{T as _}; diff --git a/assets/HeaderLink-Ctrr6qTq.js b/assets/HeaderLink-yHEt2vbv.js similarity index 90% rename from assets/HeaderLink-Ctrr6qTq.js rename to assets/HeaderLink-yHEt2vbv.js index ae53313dee4cff9e3b422aad365e2dbf7bcf3a40..7b118a66ef992fe794465cf0b51d5996e5a25077 100644 --- a/assets/HeaderLink-Ctrr6qTq.js +++ b/assets/HeaderLink-yHEt2vbv.js @@ -1 +1 @@ -import{d as r,bC as c,x as l,u as e,bo as d,o as s,y as _,c as t,a,bn as i}from"./index-20XXNHAB.js";const k="/assets/logo-dark-CO0kwKsz.svg",p="/assets/logo-D6zeZTFl.svg",u=["src"],m=["src"],x=r({__name:"HeaderLink",setup(g){const n=c();return(f,o)=>(s(),l(e(d),{to:"/",flex:"~","items-center":"","gap-2":"","px-2":"","text-nowrap":"","text-2xl":"","outline-none":""},{default:_(()=>[e(n)?(s(),t("img",{key:0,src:e(k),"h-8":"","w-8":"",class:"theme-colored"},null,8,u)):(s(),t("img",{key:1,src:e(p),"h-8":"","w-8":"",class:"theme-colored"},null,8,m)),o[0]||(o[0]=a("div",{"font-cute":""},[a("span",null,"アイリ")],-1))]),_:1}))}}),w=i(x,[["__scopeId","data-v-496b6cde"]]);export{w as H}; +import{d as r,bC as c,x as l,u as e,bo as d,o as s,y as _,c as t,a,bn as i}from"./index-D8Nm21zW.js";const k="/assets/logo-dark-CO0kwKsz.svg",p="/assets/logo-D6zeZTFl.svg",u=["src"],m=["src"],x=r({__name:"HeaderLink",setup(g){const n=c();return(f,o)=>(s(),l(e(d),{to:"/",flex:"~","items-center":"","gap-2":"","px-2":"","text-nowrap":"","text-2xl":"","outline-none":""},{default:_(()=>[e(n)?(s(),t("img",{key:0,src:e(k),"h-8":"","w-8":"",class:"theme-colored"},null,8,u)):(s(),t("img",{key:1,src:e(p),"h-8":"","w-8":"",class:"theme-colored"},null,8,m)),o[0]||(o[0]=a("div",{"font-cute":""},[a("span",null,"アイリ")],-1))]),_:1}))}}),w=i(x,[["__scopeId","data-v-496b6cde"]]);export{w as H}; diff --git a/assets/IconAnimation.vue_vue_type_script_setup_true_lang-BF7ZejO-.js b/assets/IconAnimation.vue_vue_type_script_setup_true_lang-CRr1ZQyH.js similarity index 95% rename from assets/IconAnimation.vue_vue_type_script_setup_true_lang-BF7ZejO-.js rename to assets/IconAnimation.vue_vue_type_script_setup_true_lang-CRr1ZQyH.js index c8e5fde91e66f96d8b11da9f4b1565ecb05503c1..e148feea77b56d9fd2d460c1e5a4b3882e82a306 100644 --- a/assets/IconAnimation.vue_vue_type_script_setup_true_lang-BF7ZejO-.js +++ b/assets/IconAnimation.vue_vue_type_script_setup_true_lang-CRr1ZQyH.js @@ -1 +1 @@ -import{d as m,g as s,w as p,h,c as f,o as x,n as l,a as u,z as y}from"./index-20XXNHAB.js";const C=m({__name:"IconAnimation",props:{icon:null,iconSize:null,position:null,duration:null,started:{type:Boolean},textColor:null,isReverse:{type:Boolean},zIndex:null},emits:["animationEnded"],setup(a,{emit:d}){const e=a,c=d,n=s(!1);p(()=>e.started,o=>{o&&requestAnimationFrame(()=>{n.value=!0})});const t=h(()=>({opacity:n.value!==e.isReverse?1:0,size:n.value!==e.isReverse?25:e.iconSize,position:n.value!==e.isReverse?"calc(50dvw - 12.5rem), calc(50dvh - 12.5rem)":e.position,textColor:n.value!==e.isReverse?"text-white":e.textColor})),i=s([]),r=s(!1);function v(o){i.value.push(o.propertyName),i.value.includes("color")&&i.value.includes("width")&&i.value.includes("height")&&i.value.includes("transform")&&(r.value=!0,c("animationEnded"))}return(o,z)=>(x(),f("div",{"pointer-events-none":"",fixed:"",w:"100dvw",h:"100dvh",style:l({zIndex:r.value?a.zIndex:void 0})},[u("div",{"bg-primary-500":"",fixed:"","inset-0":"","transition-opacity":"","ease-linear":"",style:l({opacity:t.value.opacity,transitionDuration:`${a.duration}ms`})},null,4),u("div",{fixed:"","inset-0":"","ease-in-out":"",style:l({width:`${t.value.size}rem`,height:`${t.value.size}rem`,transform:`translate(${t.value.position})`,transitionDuration:`${a.duration}ms`}),class:y([t.value.textColor,e.icon,{"transition-all":n.value}]),onTransitionend:v},null,38)],4))}});export{C as _}; +import{d as m,g as s,w as p,h,c as f,o as x,n as l,a as u,z as y}from"./index-D8Nm21zW.js";const C=m({__name:"IconAnimation",props:{icon:null,iconSize:null,position:null,duration:null,started:{type:Boolean},textColor:null,isReverse:{type:Boolean},zIndex:null},emits:["animationEnded"],setup(a,{emit:d}){const e=a,c=d,n=s(!1);p(()=>e.started,o=>{o&&requestAnimationFrame(()=>{n.value=!0})});const t=h(()=>({opacity:n.value!==e.isReverse?1:0,size:n.value!==e.isReverse?25:e.iconSize,position:n.value!==e.isReverse?"calc(50dvw - 12.5rem), calc(50dvh - 12.5rem)":e.position,textColor:n.value!==e.isReverse?"text-white":e.textColor})),i=s([]),r=s(!1);function v(o){i.value.push(o.propertyName),i.value.includes("color")&&i.value.includes("width")&&i.value.includes("height")&&i.value.includes("transform")&&(r.value=!0,c("animationEnded"))}return(o,z)=>(x(),f("div",{"pointer-events-none":"",fixed:"",w:"100dvw",h:"100dvh",style:l({zIndex:r.value?a.zIndex:void 0})},[u("div",{"bg-primary-500":"",fixed:"","inset-0":"","transition-opacity":"","ease-linear":"",style:l({opacity:t.value.opacity,transitionDuration:`${a.duration}ms`})},null,4),u("div",{fixed:"","inset-0":"","ease-in-out":"",style:l({width:`${t.value.size}rem`,height:`${t.value.size}rem`,transform:`translate(${t.value.position})`,transitionDuration:`${a.duration}ms`}),class:y([t.value.textColor,e.icon,{"transition-all":n.value}]),onTransitionend:v},null,38)],4))}});export{C as _}; diff --git a/assets/IconStatusItem-BzE_9TF3.js b/assets/IconStatusItem-BzE_9TF3.js new file mode 100644 index 0000000000000000000000000000000000000000..c844285eec7e460e154547c76cd0909f5e12da77 --- /dev/null +++ b/assets/IconStatusItem-BzE_9TF3.js @@ -0,0 +1 @@ +import{d as u,r as c,c as e,o as n,b as d,a as o,y as m,C as a,D as i,z as s,bn as _}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";const p={flex:"~ col",bg:"neutral-50 dark:neutral-800",border:"neutral-100 dark:neutral-800/25 hover:primary-500/30 dark:hover:primary-400/30 solid 2","drop-shadow":"none hover:[0px_4px_4px_rgba(220,220,220,0.4)] active:[0px_0px_0px_rgba(220,220,220,0.25)] dark:hover:none",class:"menu-icon-status-item",transition:"all ease-in-out duration-400","w-full":"","cursor-pointer":"","of-hidden":"","rounded-xl":""},g={"z-1":"","flex-1":""},h={"text-lg":"","font-bold":"",class:"menu-icon-status-item-title",transition:"all ease-in-out duration-400"},k={text:"sm neutral-500 dark:neutral-400",class:"menu-icon-status-item-description",transition:"all ease-in-out duration-400"},f=["src"],x={"p-2":""},v={key:0,"size-3":"",bg:"green-500 dark:green-600","rounded-full":""},y={key:1,"size-3":"",bg:"neutral-400 dark:neutral-500","rounded-full":""},b=u({__name:"IconStatusItem",props:{title:null,description:null,icon:null,iconColor:null,iconImage:null,to:null,configured:{type:Boolean}},setup(r){const t=r;return(C,I)=>{const l=c("RouterLink");return n(),e("div",p,[d(l,{flex:"~ row",class:"menu-icon-status-item-link",bg:"white dark:neutral-900",transition:"all ease-in-out duration-400",relative:"","h-full":"","w-full":"","items-center":"","overflow-hidden":"","rounded-lg":"","p-5":"","text-left":"",to:t.to},{default:m(()=>[o("div",g,[o("div",h,i(t.title),1),o("div",k,[o("span",null,i(t.description),1)])]),t.icon?(n(),e("div",{key:0,class:s(["menu-icon-status-item-icon",[t.icon]]),transition:"all ease-in-out duration-400",absolute:"","right-0":"","size-16":"","translate-y-2":"",text:"neutral-400/50 dark:neutral-600/50","grayscale-100":""},null,2)):a("",!0),t.iconColor?(n(),e("div",{key:1,class:s(["menu-icon-status-item-icon-color",[t.iconColor]]),transition:"all ease-in-out duration-400",absolute:"","right-0":"","size-16":"","translate-y-2":"",text:"neutral-400/50 dark:neutral-600/50","grayscale-100":""},null,2)):a("",!0),t.iconImage?(n(),e("img",{key:2,src:t.iconImage,class:"menu-icon-status-item-icon-image",transition:"all ease-in-out duration-400",absolute:"","right-0":"","size-16":"","translate-y-2":"","grayscale-100":""},null,8,f)):a("",!0)]),_:1},8,["to"]),o("div",x,[t.configured?(n(),e("div",v)):(n(),e("div",y))])])}}}),B=_(b,[["__scopeId","data-v-6e5b5c9c"]]);export{B as I}; diff --git a/assets/IconStatusItem-Cwiz6NP4.js b/assets/IconStatusItem-Cwiz6NP4.js deleted file mode 100644 index 72b768b3df7478a7e580b65849683cf96f60425e..0000000000000000000000000000000000000000 --- a/assets/IconStatusItem-Cwiz6NP4.js +++ /dev/null @@ -1 +0,0 @@ -import{d as u,r as c,c as e,o as n,b as d,a as o,y as m,C as a,D as i,z as s,bn as _}from"./index-20XXNHAB.js";const p={flex:"~ col",bg:"neutral-50 dark:neutral-800",border:"neutral-100 dark:neutral-800/25 hover:primary-500/30 dark:hover:primary-400/30 solid 2","drop-shadow":"none hover:[0px_4px_4px_rgba(220,220,220,0.4)] active:[0px_0px_0px_rgba(220,220,220,0.25)] dark:hover:none",class:"menu-icon-status-item",transition:"all ease-in-out duration-400","w-full":"","cursor-pointer":"","of-hidden":"","rounded-xl":""},g={"z-1":"","flex-1":""},h={"text-lg":"","font-bold":"",class:"menu-icon-status-item-title",transition:"all ease-in-out duration-400"},k={text:"sm neutral-500 dark:neutral-400",class:"menu-icon-status-item-description",transition:"all ease-in-out duration-400"},f=["src"],x={"p-2":""},v={key:0,"size-3":"",bg:"green-500 dark:green-600","rounded-full":""},y={key:1,"size-3":"",bg:"neutral-400 dark:neutral-500","rounded-full":""},b=u({__name:"IconStatusItem",props:{title:null,description:null,icon:null,iconColor:null,iconImage:null,to:null,configured:{type:Boolean}},setup(r){const t=r;return(C,I)=>{const l=c("RouterLink");return n(),e("div",p,[d(l,{flex:"~ row",class:"menu-icon-status-item-link",bg:"white dark:neutral-900",transition:"all ease-in-out duration-400",relative:"","h-full":"","w-full":"","items-center":"","overflow-hidden":"","rounded-lg":"","p-5":"","text-left":"",to:t.to},{default:m(()=>[o("div",g,[o("div",h,i(t.title),1),o("div",k,[o("span",null,i(t.description),1)])]),t.icon?(n(),e("div",{key:0,class:s(["menu-icon-status-item-icon",[t.icon]]),transition:"all ease-in-out duration-400",absolute:"","right-0":"","size-16":"","translate-y-2":"",text:"neutral-400/50 dark:neutral-600/50","grayscale-100":""},null,2)):a("",!0),t.iconColor?(n(),e("div",{key:1,class:s(["menu-icon-status-item-icon-color",[t.iconColor]]),transition:"all ease-in-out duration-400",absolute:"","right-0":"","size-16":"","translate-y-2":"",text:"neutral-400/50 dark:neutral-600/50","grayscale-100":""},null,2)):a("",!0),t.iconImage?(n(),e("img",{key:2,src:t.iconImage,class:"menu-icon-status-item-icon-image",transition:"all ease-in-out duration-400",absolute:"","right-0":"","size-16":"","translate-y-2":"","grayscale-100":""},null,8,f)):a("",!0)]),_:1},8,["to"]),o("div",x,[t.configured?(n(),e("div",v)):(n(),e("div",y))])])}}}),w=_(b,[["__scopeId","data-v-6e5b5c9c"]]);export{w as I}; diff --git a/assets/IconStatusItem-c1ZFIKre.css b/assets/IconStatusItem-c1ZFIKre.css deleted file mode 100644 index e38698529ad3c8b2f346bc9fa55be45b615ee39c..0000000000000000000000000000000000000000 --- a/assets/IconStatusItem-c1ZFIKre.css +++ /dev/null @@ -1 +0,0 @@ -.menu-icon-status-item[data-v-6e5b5c9c]{position:relative;overflow:hidden}.menu-icon-status-item[data-v-6e5b5c9c]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .4s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .menu-icon-status-item[data-v-6e5b5c9c]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.menu-icon-status-item[data-v-6e5b5c9c]:hover:before,.menu-icon-status-item._hover[data-v-6e5b5c9c]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:50%;opacity:1}.dark .menu-icon-status-item[data-v-6e5b5c9c]:hover:before,.dark .menu-icon-status-item._hover[data-v-6e5b5c9c]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.menu-icon-status-item-link[data-v-6e5b5c9c]:after{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.8;position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;width:100%;height:100%;background-size:10px 10px;content:"";-webkit-mask-image:linear-gradient(165deg,white 30%,transparent 50%);mask-image:linear-gradient(165deg,white 30%,transparent 50%);transition:all .4s ease-in-out}.menu-icon-status-item-link[data-v-6e5b5c9c]:after:hover{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.dark .menu-icon-status-item-link[data-v-6e5b5c9c]:after{background-image:radial-gradient(circle at 1px 1px,rgb(64 64 64 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.4}.dark .menu-icon-status-item-link[data-v-6e5b5c9c]:after:hover{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}.menu-icon-status-item-icon-color[data-v-6e5b5c9c]{opacity:.5}.menu-icon-status-item:hover .menu-icon-status-item-title[data-v-6e5b5c9c],.menu-icon-status-item._hover .menu-icon-status-item-title[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.menu-icon-status-item:hover .menu-icon-status-item-description[data-v-6e5b5c9c],.menu-icon-status-item._hover .menu-icon-status-item-description[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));opacity:.8}.menu-icon-status-item:hover .menu-icon-status-item-icon[data-v-6e5b5c9c],.menu-icon-status-item._hover .menu-icon-status-item-icon[data-v-6e5b5c9c],.menu-icon-status-item:hover .menu-icon-status-item-icon-color[data-v-6e5b5c9c],.menu-icon-status-item._hover .menu-icon-status-item-icon-color[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));scale:1.2}.dark .menu-icon-status-item:hover .menu-icon-status-item-title[data-v-6e5b5c9c],.dark .menu-icon-status-item._hover .menu-icon-status-item-title[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .menu-icon-status-item:hover .menu-icon-status-item-description[data-v-6e5b5c9c],.dark .menu-icon-status-item._hover .menu-icon-status-item-description[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));opacity:.8}.dark .menu-icon-status-item:hover .menu-icon-status-item-icon[data-v-6e5b5c9c],.dark .menu-icon-status-item._hover .menu-icon-status-item-icon[data-v-6e5b5c9c],.dark .menu-icon-status-item:hover .menu-icon-status-item-icon-color[data-v-6e5b5c9c],.dark .menu-icon-status-item._hover .menu-icon-status-item-icon-color[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))} diff --git a/assets/Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js b/assets/Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js similarity index 91% rename from assets/Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js rename to assets/Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js index da87e66a4ff4e9c61a187db9db2978e664b65e6f..f1317a32ada0f495677e745006673fb65a3f3197 100644 --- a/assets/Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js +++ b/assets/Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js @@ -1 +1 @@ -import{d as r,bI as n,bJ as u,A as s,co as d,o as i,c as p}from"./index-20XXNHAB.js";const m=["type"],y=r({__name:"Input",props:n({type:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const o=e,t=u(e,"modelValue");return(c,a)=>s((i(),p("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>t.value=l),type:o.type||"text",border:"focus:primary-300 dark:focus:primary-400/50 2 solid neutral-100 dark:neutral-900",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-50 dark:neutral-950 focus:neutral-50 dark:focus:neutral-900"},null,8,m)),[[d,t.value]])}});export{y as _}; +import{d as r,bI as n,bJ as u,A as s,co as d,o as i,c as p}from"./index-D8Nm21zW.js";const m=["type"],y=r({__name:"Input",props:n({type:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const o=e,t=u(e,"modelValue");return(c,a)=>s((i(),p("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>t.value=l),type:o.type||"text",border:"focus:primary-300 dark:focus:primary-400/50 2 solid neutral-100 dark:neutral-900",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-50 dark:neutral-950 focus:neutral-50 dark:focus:neutral-900"},null,8,m)),[[d,t.value]])}});export{y as _}; diff --git a/assets/InputFile.vue_vue_type_script_setup_true_lang-61TbqfJt.js b/assets/InputFile.vue_vue_type_script_setup_true_lang-aVfE3xzX.js similarity index 96% rename from assets/InputFile.vue_vue_type_script_setup_true_lang-61TbqfJt.js rename to assets/InputFile.vue_vue_type_script_setup_true_lang-aVfE3xzX.js index e7395de95a56a4e01e4220ab2a9c126cfdf1baca..d45f2eb3006424f03f9c72b1301d71c2f64366d0 100644 --- a/assets/InputFile.vue_vue_type_script_setup_true_lang-61TbqfJt.js +++ b/assets/InputFile.vue_vue_type_script_setup_true_lang-aVfE3xzX.js @@ -1 +1 @@ -import{d as g,bI as b,bJ as v,g as p,bK as y,c as i,o as n,z as m,u as t,a as l,m as x}from"./index-20XXNHAB.js";const k=["accept","multiple"],h={key:0,text:"center","text-sm":""},D={key:1,text:"center","text-sm":""},C=g({__name:"InputFile",props:b({accept:null,multiple:{type:Boolean}},{modelValue:{required:!1,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const d=v(o,"modelValue"),u=p(),a=p(!1),r=y(a,150);function f(s){const e=s.target;e.files&&e.files.length>0&&(u.value=e.files[0]),d.value=Array.from(e.files||[]),a.value=!1}return(s,e)=>(n(),i("label",{relative:"",class:m(["min-h-[120px] flex flex-col cursor-pointer items-center justify-center rounded-xl p-6",[t(r)?"border-primary-400 dark:border-primary-600 hover:border-primary-300 dark:hover:border-primary-700":"border-neutral-200 dark:border-neutral-700 hover:border-primary-300 dark:hover:border-primary-700",t(r)?"bg-primary-50/5 dark:bg-primary-900/5":"bg-white/60 dark:bg-black/30 hover:bg-white/80 dark:hover:bg-black/40"]]),border:"dashed 2",transition:"all duration-300","cursor-pointer":"","opacity-95":"",hover:"scale-100 opacity-100 shadow-md dark:shadow-lg",onDragover:e[0]||(e[0]=c=>a.value=!0),onDragleave:e[1]||(e[1]=c=>a.value=!1)},[l("input",{type:"file",accept:o.accept,multiple:o.multiple,"cursor-pointer":"",class:"absolute inset-0 h-full w-full opacity-0",onChange:f},null,40,k),x(s.$slots,"default",{isDragging:t(r),firstFile:u.value,files:d.value},()=>[l("div",{class:m(["flex flex-col items-center",[t(r)?"text-primary-500 dark:text-primary-400":"text-neutral-400 dark:text-neutral-500"]])},[e[2]||(e[2]=l("div",{"i-solar:upload-square-line-duotone":"","mb-2":"","text-5xl":""},null,-1)),e[3]||(e[3]=l("p",{"font-medium":"",text:"center lg"}," Upload ",-1)),t(r)?(n(),i("p",h," Release to upload ")):(n(),i("p",D," Click or drag and drop a file here "))],2)])],34))}});export{C as _}; +import{d as g,bI as b,bJ as v,g as p,bK as y,c as i,o as n,z as m,u as t,a as l,m as x}from"./index-D8Nm21zW.js";const k=["accept","multiple"],h={key:0,text:"center","text-sm":""},D={key:1,text:"center","text-sm":""},C=g({__name:"InputFile",props:b({accept:null,multiple:{type:Boolean}},{modelValue:{required:!1,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const d=v(o,"modelValue"),u=p(),a=p(!1),r=y(a,150);function f(s){const e=s.target;e.files&&e.files.length>0&&(u.value=e.files[0]),d.value=Array.from(e.files||[]),a.value=!1}return(s,e)=>(n(),i("label",{relative:"",class:m(["min-h-[120px] flex flex-col cursor-pointer items-center justify-center rounded-xl p-6",[t(r)?"border-primary-400 dark:border-primary-600 hover:border-primary-300 dark:hover:border-primary-700":"border-neutral-200 dark:border-neutral-700 hover:border-primary-300 dark:hover:border-primary-700",t(r)?"bg-primary-50/5 dark:bg-primary-900/5":"bg-white/60 dark:bg-black/30 hover:bg-white/80 dark:hover:bg-black/40"]]),border:"dashed 2",transition:"all duration-300","cursor-pointer":"","opacity-95":"",hover:"scale-100 opacity-100 shadow-md dark:shadow-lg",onDragover:e[0]||(e[0]=c=>a.value=!0),onDragleave:e[1]||(e[1]=c=>a.value=!1)},[l("input",{type:"file",accept:o.accept,multiple:o.multiple,"cursor-pointer":"",class:"absolute inset-0 h-full w-full opacity-0",onChange:f},null,40,k),x(s.$slots,"default",{isDragging:t(r),firstFile:u.value,files:d.value},()=>[l("div",{class:m(["flex flex-col items-center",[t(r)?"text-primary-500 dark:text-primary-400":"text-neutral-400 dark:text-neutral-500"]])},[e[2]||(e[2]=l("div",{"i-solar:upload-square-line-duotone":"","mb-2":"","text-5xl":""},null,-1)),e[3]||(e[3]=l("p",{"font-medium":"",text:"center lg"}," Upload ",-1)),t(r)?(n(),i("p",h," Release to upload ")):(n(),i("p",D," Click or drag and drop a file here "))],2)])],34))}});export{C as _}; diff --git a/assets/Model.vue_vue_type_script_setup_true_lang-CCvvNTt3.js b/assets/Model.vue_vue_type_script_setup_true_lang-CCvvNTt3.js deleted file mode 100644 index 22bd946aa6225c75cbca74fac4339e143efeddf1..0000000000000000000000000000000000000000 --- a/assets/Model.vue_vue_type_script_setup_true_lang-CCvvNTt3.js +++ /dev/null @@ -1 +0,0 @@ -import{n as C,T as Y,A as re,L as F,o as $,r as ue,D as se,I as de,m as R,M as ce,p as T}from"./live2d-zip-loader-52aPyiCh.js";import{bP as ve,d as G,g as h,w as p,l as N,H as X,c as j,o as q,m as Q,br as z,h as O,bC as pe,i as he,G as fe,s as me,v as ge,bQ as Me,bR as we,bx as ye,a as be,p as Se}from"./index-20XXNHAB.js";const xe=o=>Math.max(0,Math.min(1,o||0)),B=o=>Math.round(xe(o)*255),Pe=ve("rgb"),Be=o=>{if(o===void 0)return;let l=B(o.r),t=B(o.g),d=B(o.b);return"#"+(1<<24|l<<16|t<<8|d).toString(16).slice(1)},Ce=o=>Be(Pe(o)),ke=G({__name:"Canvas",props:{width:null,height:null},setup(o,{expose:l}){const t=o,d=h(),e=h(),i=h();async function c(n){F.registerTicker($),C.add(Y),e.value=new re({width:t.width,height:t.height,backgroundAlpha:0,preserveDrawingBuffer:!0}),i.value=e.value.view,i.value.style.objectFit="contain",n.appendChild(e.value.view)}function y(){var n;e.value&&e.value.renderer.resize(t.width,t.height),(n=e.value)!=null&&n.view&&(e.value.view.width=t.width,e.value.view.height=t.height)}p([()=>t.width,()=>t.height],()=>y()),N(async()=>d.value&&await c(d.value)),X(()=>{var n;return(n=e.value)==null?void 0:n.destroy()});async function P(){return new Promise(g=>{if(!i.value||!e.value)return g(null);e.value.render(),i.value.toBlob(g)})}return l({captureFrame:P}),(n,g)=>(q(),j("div",{ref_key:"containerRef",ref:d,"h-full":"","w-full":""},[Q(n.$slots,"default",{app:e.value})],512))}});function V(o,l,t){return(1-t)*o+t*l}function H(o,l){return o+Math.random()*(l-o)}function Fe(){let o=-1,l,t=-1;function d(e,i){(i>=o||il.app),d=z(()=>l.paused),e=h(),i=h(0),c=h(0),y=O(()=>Math.max(0,Math.min(100,l.mouthOpenSize))),P=pe(),n=he(Se),g=O(()=>n.between("sm","md").value||n.smaller("sm").value),U=Fe(),I=fe(new se({alpha:.2,blur:0,distance:20,rotation:45}));function W(){return e.value.internalModel.coreModel}function D(a){if(!a.value)return;let r=2.2;g.value&&(r=2.2);const f=l.height*.95/c.value*r,s=l.width*.95/i.value*r,m=Math.min(f,s);a.value.scale.set(m,m)}const{live2dModelFile:b,loadingLive2dModel:M,live2dCurrentMotion:J,availableLive2dMotions:K,live2dLoadSource:S,live2dModelUrl:k,themeColorsHue:Z,themeColorsHueDynamic:_}=me(ge()),ee=h({group:"Idle",index:0});async function ae(){var L;if(!t.value)return;e.value&&(t.value.stage.removeChild(e.value),e.value.destroy(),e.value=void 0);const a=new F;S.value==="file"?await T.setupLive2DModel(a,[b.value]):S.value==="url"&&await T.setupLive2DModel(a,k.value),e.value=a,t.value.stage.addChild(e.value),i.value=e.value.width,c.value=e.value.height,e.value.x=l.width/2,e.value.y=l.height,e.value.rotation=Math.PI,e.value.skew.x=Math.PI,e.value.anchor.set(.5,.5),D(e),e.value.on("hit",v=>{e.value&&v.includes("body")&&e.value.motion("tap_body")});const r=e.value.internalModel,f=r.coreModel,s=r.motionManager;f.setParameterValueById("ParamMouthOpenY",y.value),K.value=Object.entries(s.definitions).flatMap(([v,u])=>u?u.map((ie,ne)=>({motionName:v,motionIndex:ne,fileName:ie.File})):[]).filter(Boolean),s.groups.idle&&((L=s.motionGroups[s.groups.idle])==null||L.forEach(v=>{v._motionData.curves.forEach(u=>{(u.id==="ParamEyeBallX"||u.id==="ParamEyeBallY")&&(u.id=`_${u.id}`)})}));const m=s.update;s.update=function(v,u){return m==null||m.call(this,v,u),s.state.currentGroup===s.groups.idle&&U.update(r,u),!0},s.on("motionStart",(v,u)=>{ee.value={group:v,index:u}}),b.value&&await R.setItem("live2dModel",b.value),M.value=!1}async function te(){if(!t.value)return;F.registerTicker($),C.add(Y),C.add(de);const a=await R.getItem("live2dModel");if(a){b.value=a,S.value="file",M.value=!0;return}if(k.value){S.value="url",M.value=!0;return}M.value=!1}async function le(a,r){await e.value.motion(a,r,ce.FORCE)}const oe=Me(()=>{e.value&&(e.value.x=l.width/2,e.value.y=l.height,D(e))},100),A=h(),w=h(0);function x(){if(e.value){const a=getComputedStyle(A.value).backgroundColor;I.value.color=Number(Ce(a).replace("#","0x")),e.value.filters=[I.value]}}p([()=>l.width,()=>l.height],()=>oe()),p(P,x,{immediate:!0}),p([e,Z],x);function E(){x(),w.value=requestAnimationFrame(E)}return p(_,()=>{_.value?w.value=requestAnimationFrame(E):(cancelAnimationFrame(w.value),w.value=0)},{immediate:!0}),p(y,a=>W().setParameterValueById("ParamMouthOpenY",a)),p(t,te),p(J,a=>le(a.group,a.index)),p(d,a=>{var r,f;a?(r=t.value)==null||r.stop():(f=t.value)==null||f.start()}),we(M,a=>{a&&ae()},{debounce:1e3}),N(x),X(()=>{var a;cancelAnimationFrame(w.value),e.value&&((a=t.value)==null||a.stage.removeChild(e.value))}),(a,r)=>(q(),j(ye,null,[be("div",{ref_key:"dropShadowColorComputer",ref:A,hidden:"",bg:"primary-400 dark:primary-500"},null,512),Q(a.$slots,"default")],64))}});export{_e as _,ke as a,H as r}; diff --git a/assets/Model.vue_vue_type_script_setup_true_lang-xbmtXrdQ.js b/assets/Model.vue_vue_type_script_setup_true_lang-xbmtXrdQ.js new file mode 100644 index 0000000000000000000000000000000000000000..34f446c1eea28bc83c7e06d0d167d0951a21deb7 --- /dev/null +++ b/assets/Model.vue_vue_type_script_setup_true_lang-xbmtXrdQ.js @@ -0,0 +1 @@ +import{n as C,T as Y,A as re,L as F,o as $,r as ue,D as se,I as de,m as R,M as ce,p as T}from"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{bP as ve,d as G,g as h,w as p,l as N,H as X,c as j,o as q,m as Q,br as z,h as O,bC as pe,i as he,G as fe,s as me,v as ge,bQ as Me,bR as we,bx as ye,a as be,p as Se}from"./index-D8Nm21zW.js";const xe=o=>Math.max(0,Math.min(1,o||0)),B=o=>Math.round(xe(o)*255),Pe=ve("rgb"),Be=o=>{if(o===void 0)return;let l=B(o.r),t=B(o.g),d=B(o.b);return"#"+(1<<24|l<<16|t<<8|d).toString(16).slice(1)},Ce=o=>Be(Pe(o)),ke=G({__name:"Canvas",props:{width:null,height:null},setup(o,{expose:l}){const t=o,d=h(),e=h(),i=h();async function c(n){F.registerTicker($),C.add(Y),e.value=new re({width:t.width,height:t.height,backgroundAlpha:0,preserveDrawingBuffer:!0}),i.value=e.value.view,i.value.style.objectFit="contain",n.appendChild(e.value.view)}function y(){var n;e.value&&e.value.renderer.resize(t.width,t.height),(n=e.value)!=null&&n.view&&(e.value.view.width=t.width,e.value.view.height=t.height)}p([()=>t.width,()=>t.height],()=>y()),N(async()=>d.value&&await c(d.value)),X(()=>{var n;return(n=e.value)==null?void 0:n.destroy()});async function P(){return new Promise(g=>{if(!i.value||!e.value)return g(null);e.value.render(),i.value.toBlob(g)})}return l({captureFrame:P}),(n,g)=>(q(),j("div",{ref_key:"containerRef",ref:d,"h-full":"","w-full":""},[Q(n.$slots,"default",{app:e.value})],512))}});function V(o,l,t){return(1-t)*o+t*l}function H(o,l){return o+Math.random()*(l-o)}function Fe(){let o=-1,l,t=-1;function d(e,i){(i>=o||il.app),d=z(()=>l.paused),e=h(),i=h(0),c=h(0),y=O(()=>Math.max(0,Math.min(100,l.mouthOpenSize))),P=pe(),n=he(Se),g=O(()=>n.between("sm","md").value||n.smaller("sm").value),U=Fe(),I=fe(new se({alpha:.2,blur:0,distance:20,rotation:45}));function W(){return e.value.internalModel.coreModel}function D(a){if(!a.value)return;let r=2.2;g.value&&(r=2.2);const f=l.height*.95/c.value*r,s=l.width*.95/i.value*r,m=Math.min(f,s);a.value.scale.set(m,m)}const{live2dModelFile:b,loadingLive2dModel:M,live2dCurrentMotion:J,availableLive2dMotions:K,live2dLoadSource:S,live2dModelUrl:k,themeColorsHue:Z,themeColorsHueDynamic:_}=me(ge()),ee=h({group:"Idle",index:0});async function ae(){var L;if(!t.value)return;e.value&&(t.value.stage.removeChild(e.value),e.value.destroy(),e.value=void 0);const a=new F;S.value==="file"?await T.setupLive2DModel(a,[b.value]):S.value==="url"&&await T.setupLive2DModel(a,k.value),e.value=a,t.value.stage.addChild(e.value),i.value=e.value.width,c.value=e.value.height,e.value.x=l.width/2,e.value.y=l.height,e.value.rotation=Math.PI,e.value.skew.x=Math.PI,e.value.anchor.set(.5,.5),D(e),e.value.on("hit",v=>{e.value&&v.includes("body")&&e.value.motion("tap_body")});const r=e.value.internalModel,f=r.coreModel,s=r.motionManager;f.setParameterValueById("ParamMouthOpenY",y.value),K.value=Object.entries(s.definitions).flatMap(([v,u])=>u?u.map((ie,ne)=>({motionName:v,motionIndex:ne,fileName:ie.File})):[]).filter(Boolean),s.groups.idle&&((L=s.motionGroups[s.groups.idle])==null||L.forEach(v=>{v._motionData.curves.forEach(u=>{(u.id==="ParamEyeBallX"||u.id==="ParamEyeBallY")&&(u.id=`_${u.id}`)})}));const m=s.update;s.update=function(v,u){return m==null||m.call(this,v,u),s.state.currentGroup===s.groups.idle&&U.update(r,u),!0},s.on("motionStart",(v,u)=>{ee.value={group:v,index:u}}),b.value&&await R.setItem("live2dModel",b.value),M.value=!1}async function te(){if(!t.value)return;F.registerTicker($),C.add(Y),C.add(de);const a=await R.getItem("live2dModel");if(a){b.value=a,S.value="file",M.value=!0;return}if(k.value){S.value="url",M.value=!0;return}M.value=!1}async function le(a,r){await e.value.motion(a,r,ce.FORCE)}const oe=Me(()=>{e.value&&(e.value.x=l.width/2,e.value.y=l.height,D(e))},100),A=h(),w=h(0);function x(){if(e.value){const a=getComputedStyle(A.value).backgroundColor;I.value.color=Number(Ce(a).replace("#","0x")),e.value.filters=[I.value]}}p([()=>l.width,()=>l.height],()=>oe()),p(P,x,{immediate:!0}),p([e,Z],x);function E(){x(),w.value=requestAnimationFrame(E)}return p(_,()=>{_.value?w.value=requestAnimationFrame(E):(cancelAnimationFrame(w.value),w.value=0)},{immediate:!0}),p(y,a=>W().setParameterValueById("ParamMouthOpenY",a)),p(t,te),p(J,a=>le(a.group,a.index)),p(d,a=>{var r,f;a?(r=t.value)==null||r.stop():(f=t.value)==null||f.start()}),we(M,a=>{a&&ae()},{debounce:1e3}),N(x),X(()=>{var a;cancelAnimationFrame(w.value),e.value&&((a=t.value)==null||a.stage.removeChild(e.value))}),(a,r)=>(q(),j(ye,null,[be("div",{ref_key:"dropShadowColorComputer",ref:A,hidden:"",bg:"primary-400 dark:primary-500"},null,512),Q(a.$slots,"default")],64))}});export{_e as _,ke as a,H as r}; diff --git a/assets/PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js b/assets/PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js similarity index 93% rename from assets/PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js rename to assets/PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js index 06a339cf94b91501bc8a6d462d6dbd037cdc154b..e6d824b9aa23793caff87c63b50b6bcd0cbc8002 100644 --- a/assets/PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js +++ b/assets/PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js @@ -1 +1 @@ -import{d as l,bG as u,bw as c,A as d,o as n,c as s,a as t,u as p,C as x,D as i}from"./index-20XXNHAB.js";const f={initial:{opacity:0,x:10},enter:{opacity:1,x:0},duration:250,style:{top:"env(safe-area-inset-top, 0px)",right:"env(safe-area-inset-right, 0px)",left:"env(safe-area-inset-left, 0px)"},sticky:"","inset-x-0":"","top-0":"","z-99":"","w-full":"","pb-6":"","pt-10":"",flex:"~ row items-center gap-2",bg:"$bg-color"},v={relative:""},b={key:0,absolute:"","left-0":"","top-0":"","translate-y":"[-80%]"},m={text:"neutral-300 dark:neutral-500","text-nowrap":""},_={"text-nowrap":"","text-3xl":"","font-semibold":""},y=l({__name:"PageHeader",props:{title:null,subtitle:null},setup(o){const a=u();return(g,e)=>{const r=c("motion");return d((n(),s("div",f,[t("button",{onClick:e[0]||(e[0]=k=>p(a).back())},e[1]||(e[1]=[t("div",{"i-solar:alt-arrow-left-line-duotone":"","text-2xl":""},null,-1)])),t("h1",v,[o.subtitle?(n(),s("div",b,[t("span",m,i(o.subtitle),1)])):x("",!0),t("div",_,i(o.title),1)])])),[[r]])}}});export{y as _}; +import{d as l,bG as u,bw as c,A as d,o as n,c as s,a as t,u as p,C as x,D as i}from"./index-D8Nm21zW.js";const f={initial:{opacity:0,x:10},enter:{opacity:1,x:0},duration:250,style:{top:"env(safe-area-inset-top, 0px)",right:"env(safe-area-inset-right, 0px)",left:"env(safe-area-inset-left, 0px)"},sticky:"","inset-x-0":"","top-0":"","z-99":"","w-full":"","pb-6":"","pt-10":"",flex:"~ row items-center gap-2",bg:"$bg-color"},v={relative:""},b={key:0,absolute:"","left-0":"","top-0":"","translate-y":"[-80%]"},m={text:"neutral-300 dark:neutral-500","text-nowrap":""},_={"text-nowrap":"","text-3xl":"","font-semibold":""},y=l({__name:"PageHeader",props:{title:null,subtitle:null},setup(o){const a=u();return(g,e)=>{const r=c("motion");return d((n(),s("div",f,[t("button",{onClick:e[0]||(e[0]=k=>p(a).back())},e[1]||(e[1]=[t("div",{"i-solar:alt-arrow-left-line-duotone":"","text-2xl":""},null,-1)])),t("h1",v,[o.subtitle?(n(),s("div",b,[t("span",m,i(o.subtitle),1)])):x("",!0),t("div",_,i(o.title),1)])])),[[r]])}}});export{y as _}; diff --git a/assets/ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js b/assets/ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js similarity index 84% rename from assets/ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js rename to assets/ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js index c3464dd7d31794ead3dfc5a7324965f537917cad..b4569b56128153788c7cb62c37b4090e667c9200 100644 --- a/assets/ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js +++ b/assets/ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js @@ -1 +1 @@ -import{_ as u}from"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import{d as i,bI as n,q as t,bJ as p,h as m,x as c,o as f,u as b}from"./index-20XXNHAB.js";const y=i({__name:"ProviderApiKeyInput",props:n({providerName:null,placeholder:null,required:{type:Boolean},label:null,description:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,{t:a}=t(),o=p(e,"modelValue"),d=m(()=>l.description||`API Key for ${l.providerName}`);return(v,r)=>(f(),c(u,{modelValue:o.value,"onUpdate:modelValue":r[0]||(r[0]=s=>o.value=s),label:e.label||b(a)("settings.pages.providers.common.fields.field.api-key.label"),description:d.value,placeholder:e.placeholder,required:e.required,type:"password"},null,8,["modelValue","label","description","placeholder","required"]))}});export{y as _}; +import{_ as u}from"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import{d as i,bI as n,q as t,bJ as p,h as m,x as c,o as f,u as b}from"./index-D8Nm21zW.js";const y=i({__name:"ProviderApiKeyInput",props:n({providerName:null,placeholder:null,required:{type:Boolean},label:null,description:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const l=e,{t:a}=t(),o=p(e,"modelValue"),d=m(()=>l.description||`API Key for ${l.providerName}`);return(v,r)=>(f(),c(u,{modelValue:o.value,"onUpdate:modelValue":r[0]||(r[0]=s=>o.value=s),label:e.label||b(a)("settings.pages.providers.common.fields.field.api-key.label"),description:d.value,placeholder:e.placeholder,required:e.required,type:"password"},null,8,["modelValue","label","description","placeholder","required"]))}});export{y as _}; diff --git a/assets/ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js b/assets/ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js similarity index 88% rename from assets/ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js rename to assets/ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js index b59e359033a118a3955e57c6005704af71f20ef7..4e5b30b3168339094764df7e605cb7cf023684de 100644 --- a/assets/ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js +++ b/assets/ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js @@ -1 +1 @@ -import{_ as p}from"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import{d,g as m,x as u,o as c,y as n,a as e,m as f,D as _,z as v,bI as b,bJ as g}from"./index-20XXNHAB.js";import{_ as V}from"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";const x=["onClick"],h={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},y={"mt-4":""},q=d({__name:"ProviderAdvancedSettings",props:{title:null,initialVisible:{type:Boolean}},setup(l){const a=m(l.initialVisible||!1);function r(){a.value=!a.value}return(o,i)=>(c(),u(p,{"w-full":""},{trigger:n(s=>[e("button",{transition:"all ease-in-out duration-250","w-full":"",flex:"","items-center":"","gap-1.5":"","outline-none":"",class:"[&_.provider-icon]:grayscale-100 [&_.provider-icon]:hover:grayscale-0",onClick:()=>s.setVisible(!s.visible)&&r()},[e("h2",h,[e("span",null,_(l.title||"Advanced"),1)]),e("div",{transform:"",transition:"transform duration-250",class:v({"rotate-180":s.visible})},i[0]||(i[0]=[e("div",{"i-solar:alt-arrow-down-bold-duotone":""},null,-1)]),2)],8,x)]),default:n(()=>[e("div",y,[f(o.$slots,"default")])]),_:3}))}}),w=d({__name:"ProviderBaseUrlInput",props:b({placeholder:null,required:{type:Boolean},label:null,description:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,a=g(l,"modelValue");return(r,o)=>(c(),u(V,{modelValue:a.value,"onUpdate:modelValue":o[0]||(o[0]=i=>a.value=i),label:t.label||"Base URL",description:t.description||"Custom base URL (optional)",placeholder:t.placeholder,required:t.required,type:"text"},null,8,["modelValue","label","description","placeholder","required"]))}});export{q as _,w as a}; +import{_ as p}from"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import{d,g as m,x as u,o as c,y as n,a as e,m as f,D as _,z as v,bI as b,bJ as g}from"./index-D8Nm21zW.js";import{_ as V}from"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";const x=["onClick"],h={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},y={"mt-4":""},q=d({__name:"ProviderAdvancedSettings",props:{title:null,initialVisible:{type:Boolean}},setup(l){const a=m(l.initialVisible||!1);function r(){a.value=!a.value}return(o,i)=>(c(),u(p,{"w-full":""},{trigger:n(s=>[e("button",{transition:"all ease-in-out duration-250","w-full":"",flex:"","items-center":"","gap-1.5":"","outline-none":"",class:"[&_.provider-icon]:grayscale-100 [&_.provider-icon]:hover:grayscale-0",onClick:()=>s.setVisible(!s.visible)&&r()},[e("h2",h,[e("span",null,_(l.title||"Advanced"),1)]),e("div",{transform:"",transition:"transform duration-250",class:v({"rotate-180":s.visible})},i[0]||(i[0]=[e("div",{"i-solar:alt-arrow-down-bold-duotone":""},null,-1)]),2)],8,x)]),default:n(()=>[e("div",y,[f(o.$slots,"default")])]),_:3}))}}),w=d({__name:"ProviderBaseUrlInput",props:b({placeholder:null,required:{type:Boolean},label:null,description:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,a=g(l,"modelValue");return(r,o)=>(c(),u(V,{modelValue:a.value,"onUpdate:modelValue":o[0]||(o[0]=i=>a.value=i),label:t.label||"Base URL",description:t.description||"Custom base URL (optional)",placeholder:t.placeholder,required:t.required,type:"text"},null,8,["modelValue","label","description","placeholder","required"]))}});export{q as _,w as a}; diff --git a/assets/ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js b/assets/ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js similarity index 94% rename from assets/ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js rename to assets/ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js index f59a0b8696ffe180354cae769a30db699cb0cc6e..efbe1918d64e76a7a625b9db074239bcbb6aca81 100644 --- a/assets/ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js +++ b/assets/ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js @@ -1 +1 @@ -import{d as o,c as s,o as a,a as e,m as i,C as u,D as l}from"./index-20XXNHAB.js";const c={flex:"~ col gap-6"},x={flex:"~ row","items-center":"","justify-between":""},f={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},m={text:"neutral-400 dark:neutral-500"},g=o({__name:"ProviderBasicSettings",props:{title:null,description:null,onReset:{type:Function}},setup(t){return(r,n)=>(a(),s("div",c,[e("div",x,[e("div",null,[e("h2",f,l(t.title||"Basic"),1),e("div",m,[e("span",null,l(t.description||"Essential settings"),1)])]),t.onReset?(a(),s("button",{key:0,title:"Reset settings",flex:"","items-center":"","justify-center":"","rounded-full":"","p-2":"",transition:"all duration-250 ease-in-out",text:"neutral-500 dark:neutral-400",bg:"transparent dark:transparent hover:neutral-200 dark:hover:neutral-800 active:neutral-300 dark:active:neutral-700",onClick:n[0]||(n[0]=(...d)=>t.onReset&&t.onReset(...d))},n[1]||(n[1]=[e("div",{"i-solar:refresh-bold-duotone":"","text-xl":""},null,-1)]))):u("",!0)]),i(r.$slots,"default")]))}}),p={bg:"neutral-50 dark:[rgba(0,0,0,0.3)]","rounded-xl":"","p-4":"",flex:"~ col gap-6"},k=o({__name:"ProviderSettingsContainer",setup(t){return(r,n)=>(a(),s("div",p,[i(r.$slots,"default")]))}});export{k as _,g as a}; +import{d as o,c as s,o as a,a as e,m as i,C as u,D as l}from"./index-D8Nm21zW.js";const c={flex:"~ col gap-6"},x={flex:"~ row","items-center":"","justify-between":""},f={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},m={text:"neutral-400 dark:neutral-500"},g=o({__name:"ProviderBasicSettings",props:{title:null,description:null,onReset:{type:Function}},setup(t){return(r,n)=>(a(),s("div",c,[e("div",x,[e("div",null,[e("h2",f,l(t.title||"Basic"),1),e("div",m,[e("span",null,l(t.description||"Essential settings"),1)])]),t.onReset?(a(),s("button",{key:0,title:"Reset settings",flex:"","items-center":"","justify-center":"","rounded-full":"","p-2":"",transition:"all duration-250 ease-in-out",text:"neutral-500 dark:neutral-400",bg:"transparent dark:transparent hover:neutral-200 dark:hover:neutral-800 active:neutral-300 dark:active:neutral-700",onClick:n[0]||(n[0]=(...d)=>t.onReset&&t.onReset(...d))},n[1]||(n[1]=[e("div",{"i-solar:refresh-bold-duotone":"","text-xl":""},null,-1)]))):u("",!0)]),i(r.$slots,"default")]))}}),p={bg:"neutral-50 dark:[rgba(0,0,0,0.3)]","rounded-xl":"","p-4":"",flex:"~ col gap-6"},k=o({__name:"ProviderSettingsContainer",setup(t){return(r,n)=>(a(),s("div",p,[i(r.$slots,"default")]))}});export{k as _,g as a}; diff --git a/assets/ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js b/assets/ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js similarity index 85% rename from assets/ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js rename to assets/ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js index 00acc2b7a5f343e0fa8e2ea02cbd8efb6735a38f..86434b677728face6e8c6b07cfa7faf1fc1e507b 100644 --- a/assets/ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js +++ b/assets/ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js @@ -1 +1 @@ -import{_ as a}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import{d as s,q as l,bw as c,c as t,o,b as d,m as u,A as m,u as p,a as v,z as _,bx as f}from"./index-20XXNHAB.js";const x={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":""},I=s({__name:"ProviderSettingsLayout",props:{providerName:null,providerIcon:null,providerIconColor:null,onBack:{type:Function}},setup(e){const{t:r}=l();return(n,b)=>{const i=c("motion");return o(),t(f,null,[d(a,{title:e.providerName,subtitle:p(r)("settings.pages.providers.title")},null,8,["title","subtitle"]),u(n.$slots,"default"),m((o(),t("div",x,[v("div",{text:"60",class:_(e.providerIcon||e.providerIconColor)},null,2)])),[[i]])],64)}}});export{I as _}; +import{_ as a}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{d as s,q as l,bw as c,c as t,o,b as d,m as u,A as m,u as p,a as v,z as _,bx as f}from"./index-D8Nm21zW.js";const x={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":""},I=s({__name:"ProviderSettingsLayout",props:{providerName:null,providerIcon:null,providerIconColor:null,onBack:{type:Function}},setup(e){const{t:r}=l();return(n,b)=>{const i=c("motion");return o(),t(f,null,[d(a,{title:e.providerName,subtitle:p(r)("settings.pages.providers.title")},null,8,["title","subtitle"]),u(n.$slots,"default"),m((o(),t("div",x,[v("div",{text:"60",class:_(e.providerIcon||e.providerIconColor)},null,2)])),[[i]])],64)}}});export{I as _}; diff --git a/assets/RadioCardDetailManySelect-6Dh1XQsR.js b/assets/RadioCardDetailManySelect-6Dh1XQsR.js new file mode 100644 index 0000000000000000000000000000000000000000..47fccd7b4f29b7b4bdd3ab2d11b137edeb867f14 --- /dev/null +++ b/assets/RadioCardDetailManySelect-6Dh1XQsR.js @@ -0,0 +1 @@ +import{d as g,bI as f,bJ as w,g as b,c as n,o as d,z as o,A as V,a as t,bA as B,C as v,D as c,b as $,y as M,bM as k,bn as C,h as S,bE as T,bx as z,by as D,x as E}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as N}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import{_ as P}from"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";const U=["checked","name","value"],q={class:"relative mr-3 mt-0.5 flex-shrink-0"},L={class:"w-full flex flex-col gap-2"},j={class:"flex items-center"},A={key:0,class:"relative"},F=["title"],J={key:1,class:"mt-2"},Q=g({__name:"RadioCardDetail",props:f({id:null,name:null,value:null,title:null,description:null,deprecated:{type:Boolean,default:!1},showExpandCollapse:{type:Boolean,default:!0},expandCollapseThreshold:{default:100},customInputValue:{default:""},customInputPlaceholder:{default:""},showCustomInput:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const a=w(e,"modelValue"),m=b(!1);function s(){m.value=!m.value}return(x,r)=>(d(),n("label",{key:e.id,class:o(["form_radio-card-detail relative flex cursor-pointer items-start rounded-xl p-3 pr-[20px]",[a.value===e.value?"bg-primary-50 dark:bg-primary-900/20 border-primary-100 dark:border-primary-900 hover:border-primary-500/30 dark:hover:border-primary-400/30":"bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30",a.value===e.value?"form_radio-card-detail-active":"",e.deprecated?"opacity-60":""]]),transition:"all duration-200 ease-in-out",border:"2 solid"},[V(t("input",{"onUpdate:modelValue":r[0]||(r[0]=i=>a.value=i),checked:a.value===e.value,type:"radio",name:e.name,value:e.value,class:"absolute opacity-0"},null,8,U),[[B,a.value]]),t("div",q,[t("div",{class:o(["size-5 border-2 rounded-full transition-colors duration-200",[a.value===e.value?"border-primary-500 dark:border-primary-400":"border-neutral-300 dark:border-neutral-600"]])},[t("div",{class:o(["absolute left-1/2 top-1/2 size-3 rounded-full transition-opacity duration-200 -translate-x-1/2 -translate-y-1/2",[a.value===e.value?"opacity-100 bg-primary-500 dark:bg-primary-400":"opacity-0"]])},null,2)],2)]),t("div",L,[t("div",j,[t("span",{class:o(["line-clamp-1 font-medium",[a.value===e.value?"text-neutral-700 dark:text-neutral-300":"text-neutral-700 dark:text-neutral-400"]])},c(e.title),3)]),e.description?(d(),n("div",A,[$(N,null,{default:M(()=>[!m.value||!e.showExpandCollapse?(d(),n("div",{key:0,class:o(["line-clamp-2 cursor-pointer text-xs",[a.value===e.value?"text-neutral-600 dark:text-neutral-400":"text-neutral-500 dark:text-neutral-500"]]),title:e.description,onClick:k(s,["prevent"])},c(e.description),11,F)):(d(),n("div",{key:1,class:o(["cursor-pointer text-xs",[a.value===e.value?"text-neutral-600 dark:text-neutral-400":"text-neutral-500 dark:text-neutral-500"]]),onClick:k(s,["prevent"])},c(e.description),3))]),_:1}),e.showExpandCollapse&&e.description.length>e.expandCollapseThreshold?(d(),n("button",{key:0,class:"text-primary-500 dark:text-primary-600 mt-0.5 inline-flex items-center text-xs",onClick:k(s,["prevent"])},[t("span",null,c(m.value?"Show less":"Show more"),1),t("div",{class:o([{"rotate-180":m.value},"transition-transform duration-200"])},r[2]||(r[2]=[t("div",{"i-solar:alt-arrow-down-bold-duotone":"","ml-0.5":"","text-xs":""},null,-1)]),2)])):v("",!0)])):v("",!0),e.showCustomInput&&a.value===e.value?(d(),n("div",J,[$(P,{modelValue:a.value,"onUpdate:modelValue":r[1]||(r[1]=i=>a.value=i),type:"text",class:"w-full border border-neutral-300 rounded bg-white px-2 py-1 text-sm dark:border-neutral-700 dark:bg-neutral-900",placeholder:e.customInputPlaceholder},null,8,["modelValue","placeholder"])])):v("",!0)])],2))}}),G=C(Q,[["__scopeId","data-v-c9195151"]]),H=["checked","name","value"],K={flex:"~ col","min-h-16":"","w-full":"","items-start":"","justify-center":"","pb-2":"","pl-5":"","pr-4":"","pt-2":""},O=g({__name:"RadioCardSimple",props:f({id:null,name:null,value:null,title:null,description:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const a=w(e,"modelValue");return(m,s)=>(d(),n("label",{key:e.id,border:"2px solid",class:o(["form_radio-card-simple relative",[a.value===e.value?"bg-primary-50 dark:bg-primary-900/20 border-primary-100 dark:border-primary-900 hover:border-primary-500/30 dark:hover:border-primary-400/30":"bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30",a.value===e.value?"form_radio-card-simple-active":""]]),transition:"all duration-200 ease-in-out",flex:"~ col",block:"","min-w-50":"","w-fit":"","cursor-pointer":"","items-start":"","rounded-xl":"","p-4":"","text-left":""},[V(t("input",{"onUpdate:modelValue":s[0]||(s[0]=x=>a.value=x),checked:a.value===e.value,type:"radio",name:e.name,value:e.value,class:"[&:checked+div]:border-primary-500 dark:[&:checked+div]:border-primary-400 absolute opacity-0 [&:checked+div_.radio-dot]:opacity-100"},null,8,H),[[B,a.value]]),s[1]||(s[1]=t("div",{class:"radio-circle absolute left-2 top-2 size-5 rounded-full",border:"2 solid neutral-300 dark:neutral-600",transition:"all duration-200 ease-in-out"},[t("div",{class:"radio-dot absolute left-1/2 top-1/2 size-3 rounded-full opacity-0 -translate-x-1/2 -translate-y-1/2",transition:"all duration-200 ease-in-out",bg:"primary-500 dark:primary-400"})],-1)),t("div",K,[t("span",{class:o(["radio-item-name font-bold",[a.value===e.value?"text-neutral-700 dark:text-neutral-300":"text-neutral-500 dark:text-neutral-500"]]),text:"md",transition:"all duration-200 ease-in-out"},c(e.title),3),e.description?(d(),n("span",{key:0,class:o(["radio-item-description",[a.value===e.value?"text-neutral-600 dark:text-neutral-400":"text-neutral-400 dark:text-neutral-600"]]),transition:"all duration-200 ease-in-out"},c(e.description),3)):v("",!0)]),s[2]||(s[2]=t("div",{class:"bg-dotted-neutral-200/80 dark:bg-dotted-neutral-700/50 [input:checked~&]:bg-dotted-primary-300/50 dark:[input:checked~&]:bg-dotted-primary-200/20",absolute:"","inset-0":"","z--1":"",style:{"background-size":"10px 10px","mask-image":"linear-gradient(165deg, white 30%, transparent 50%)"}},null,-1))],2))}}),ue=C(O,[["__scopeId","data-v-dd41bc0b"]]),W={class:"radio-card-detail-many-select"},X={key:0,class:"relative","inline-flex":"~","w-full":"","items-center":""},Y=["placeholder"],Z={class:"mt-4 space-y-2"},_={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},ee={key:1,class:"flex items-center gap-3 border border-2 border-amber-200 rounded-xl bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},te={class:"flex flex-col"},ae={class:"font-medium"},le={class:"text-sm text-amber-600 dark:text-amber-400"},re={class:"relative"},oe=g({__name:"RadioCardDetailManySelect",props:f({items:null,searchable:{type:Boolean,default:!0},searchPlaceholder:{default:"Search..."},searchNoResultsTitle:{default:"No results found"},searchNoResultsDescription:{default:"Try a different search term"},searchResultsText:{default:"{count} of {total} results"},customInputPlaceholder:{default:"Enter custom value"},expandButtonText:{default:"Show more"},collapseButtonText:{default:"Show less"},showMore:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{}}),emits:f(["update:customValue"],["update:modelValue"]),setup(e,{emit:a}){const m=e,s=a,x=w(e,"modelValue"),r=b(""),i=b(!1),R=b(""),h=S(()=>{if(!r.value)return m.items;const p=r.value.toLowerCase();return m.items.filter(l=>l.name.toLowerCase().includes(p)||l.description&&l.description.toLowerCase().includes(p))});function I(p){R.value=p,s("update:customValue",p)}return(p,l)=>(d(),n("div",W,[e.searchable?(d(),n("div",X,[l[4]||(l[4]=t("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[t("div",{"i-solar:magnifer-line-duotone":"",class:"text-neutral-500 dark:text-neutral-400"})],-1)),V(t("input",{"onUpdate:modelValue":l[0]||(l[0]=u=>r.value=u),type:"search",class:"w-full rounded-xl p-2.5 pl-10 text-sm outline-none",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",bg:"white dark:neutral-900",placeholder:e.searchPlaceholder},null,8,Y),[[T,r.value]])])):v("",!0),t("div",Z,[r.value?(d(),n("div",_,c(e.searchResultsText.replace("{count}",h.value.length.toString()).replace("{total}",e.items.length.toString())),1)):v("",!0),r.value&&h.value.length===0?(d(),n("div",ee,[l[5]||(l[5]=t("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),t("div",te,[t("span",ae,c(e.searchNoResultsTitle),1),t("span",le,c(e.searchNoResultsDescription.replace("{query}",r.value)),1)])])):v("",!0),t("div",re,[t("div",{class:o(["scrollbar-hide grid auto-cols-[350px] grid-flow-col max-h-[calc(100dvh-7lh)] gap-4 overflow-x-auto pb-4",[i.value?"grid-cols-1 md:grid-cols-2 grid-flow-row auto-cols-auto":""]]),transition:"all duration-200 ease-in-out",style:{"scroll-snap-type":"x mandatory"}},[(d(!0),n(z,null,D(h.value,u=>(d(),E(G,{id:u.id,key:u.id,modelValue:x.value,"onUpdate:modelValue":l[1]||(l[1]=y=>x.value=y),value:u.id,title:u.name,description:u.description,deprecated:u.deprecated,"show-expand-collapse":e.showMore,"expand-collapse-threshold":100,"show-custom-input":u.customizable,"custom-input-value":R.value,"custom-input-placeholder":e.customInputPlaceholder,name:"radio-card-detail-many-select",class:"scroll-snap-align-start","onUpdate:customInputValue":l[2]||(l[2]=y=>I(y))},null,8,["id","modelValue","value","title","description","deprecated","show-expand-collapse","show-custom-input","custom-input-value","custom-input-placeholder"]))),128))],2),t("div",{bg:"neutral-100 dark:[rgba(0,0,0,0.3)]","rounded-xl":"",class:o([i.value?"w-full":"mt-4 w-full rounded-lg"])},[t("button",{"w-full":"",flex:"","items-center":"","justify-center":"","gap-2":"","rounded-lg":"","py-2":"",transition:"all duration-200 ease-in-out",class:o([i.value?"bg-primary-500 hover:bg-primary-600 text-white":"bg-white dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800"]),onClick:l[3]||(l[3]=u=>i.value=!i.value)},[t("span",null,c(i.value?e.collapseButtonText:e.expandButtonText),1),t("div",{class:o([i.value?"rotate-180":"","text-lg"]),"i-solar:alt-arrow-down-bold-duotone":"",transition:"transform duration-200 ease-in-out"},null,2)],2)],2)])])]))}}),ce=C(oe,[["__scopeId","data-v-0c2329bf"]]);export{ce as R,ue as a}; diff --git a/assets/RadioCardDetailManySelect-CYbSNUGq.js b/assets/RadioCardDetailManySelect-CYbSNUGq.js deleted file mode 100644 index ec30aff65f313e78254d0560a84fda1f587b5250..0000000000000000000000000000000000000000 --- a/assets/RadioCardDetailManySelect-CYbSNUGq.js +++ /dev/null @@ -1 +0,0 @@ -import{d as g,bI as f,bJ as w,g as b,c as n,o as d,z as o,A as V,a as t,bA as B,C as v,D as c,b as $,y as M,bM as k,bn as C,h as S,bE as T,bx as z,by as D,x as E}from"./index-20XXNHAB.js";import{_ as N}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import{_ as P}from"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";const U=["checked","name","value"],q={class:"relative mr-3 mt-0.5 flex-shrink-0"},L={class:"w-full flex flex-col gap-2"},j={class:"flex items-center"},A={key:0,class:"relative"},F=["title"],J={key:1,class:"mt-2"},Q=g({__name:"RadioCardDetail",props:f({id:null,name:null,value:null,title:null,description:null,deprecated:{type:Boolean,default:!1},showExpandCollapse:{type:Boolean,default:!0},expandCollapseThreshold:{default:100},customInputValue:{default:""},customInputPlaceholder:{default:""},showCustomInput:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const a=w(e,"modelValue"),m=b(!1);function s(){m.value=!m.value}return(x,r)=>(d(),n("label",{key:e.id,class:o(["form_radio-card-detail relative flex cursor-pointer items-start rounded-xl p-3 pr-[20px]",[a.value===e.value?"bg-primary-50 dark:bg-primary-900/20 border-primary-100 dark:border-primary-900 hover:border-primary-500/30 dark:hover:border-primary-400/30":"bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30",a.value===e.value?"form_radio-card-detail-active":"",e.deprecated?"opacity-60":""]]),transition:"all duration-200 ease-in-out",border:"2 solid"},[V(t("input",{"onUpdate:modelValue":r[0]||(r[0]=i=>a.value=i),checked:a.value===e.value,type:"radio",name:e.name,value:e.value,class:"absolute opacity-0"},null,8,U),[[B,a.value]]),t("div",q,[t("div",{class:o(["size-5 border-2 rounded-full transition-colors duration-200",[a.value===e.value?"border-primary-500 dark:border-primary-400":"border-neutral-300 dark:border-neutral-600"]])},[t("div",{class:o(["absolute left-1/2 top-1/2 size-3 rounded-full transition-opacity duration-200 -translate-x-1/2 -translate-y-1/2",[a.value===e.value?"opacity-100 bg-primary-500 dark:bg-primary-400":"opacity-0"]])},null,2)],2)]),t("div",L,[t("div",j,[t("span",{class:o(["line-clamp-1 font-medium",[a.value===e.value?"text-neutral-700 dark:text-neutral-300":"text-neutral-700 dark:text-neutral-400"]])},c(e.title),3)]),e.description?(d(),n("div",A,[$(N,null,{default:M(()=>[!m.value||!e.showExpandCollapse?(d(),n("div",{key:0,class:o(["line-clamp-2 cursor-pointer text-xs",[a.value===e.value?"text-neutral-600 dark:text-neutral-400":"text-neutral-500 dark:text-neutral-500"]]),title:e.description,onClick:k(s,["prevent"])},c(e.description),11,F)):(d(),n("div",{key:1,class:o(["cursor-pointer text-xs",[a.value===e.value?"text-neutral-600 dark:text-neutral-400":"text-neutral-500 dark:text-neutral-500"]]),onClick:k(s,["prevent"])},c(e.description),3))]),_:1}),e.showExpandCollapse&&e.description.length>e.expandCollapseThreshold?(d(),n("button",{key:0,class:"text-primary-500 dark:text-primary-600 mt-0.5 inline-flex items-center text-xs",onClick:k(s,["prevent"])},[t("span",null,c(m.value?"Show less":"Show more"),1),t("div",{class:o([{"rotate-180":m.value},"transition-transform duration-200"])},r[2]||(r[2]=[t("div",{"i-solar:alt-arrow-down-bold-duotone":"","ml-0.5":"","text-xs":""},null,-1)]),2)])):v("",!0)])):v("",!0),e.showCustomInput&&a.value===e.value?(d(),n("div",J,[$(P,{modelValue:a.value,"onUpdate:modelValue":r[1]||(r[1]=i=>a.value=i),type:"text",class:"w-full border border-neutral-300 rounded bg-white px-2 py-1 text-sm dark:border-neutral-700 dark:bg-neutral-900",placeholder:e.customInputPlaceholder},null,8,["modelValue","placeholder"])])):v("",!0)])],2))}}),G=C(Q,[["__scopeId","data-v-c9195151"]]),H=["checked","name","value"],K={flex:"~ col","min-h-16":"","w-full":"","items-start":"","justify-center":"","pb-2":"","pl-5":"","pr-4":"","pt-2":""},O=g({__name:"RadioCardSimple",props:f({id:null,name:null,value:null,title:null,description:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const a=w(e,"modelValue");return(m,s)=>(d(),n("label",{key:e.id,border:"2px solid",class:o(["form_radio-card-simple relative",[a.value===e.value?"bg-primary-50 dark:bg-primary-900/20 border-primary-100 dark:border-primary-900 hover:border-primary-500/30 dark:hover:border-primary-400/30":"bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30",a.value===e.value?"form_radio-card-simple-active":""]]),transition:"all duration-200 ease-in-out",flex:"~ col",block:"","min-w-50":"","w-fit":"","cursor-pointer":"","items-start":"","rounded-xl":"","p-4":"","text-left":""},[V(t("input",{"onUpdate:modelValue":s[0]||(s[0]=x=>a.value=x),checked:a.value===e.value,type:"radio",name:e.name,value:e.value,class:"[&:checked+div]:border-primary-500 dark:[&:checked+div]:border-primary-400 absolute opacity-0 [&:checked+div_.radio-dot]:opacity-100"},null,8,H),[[B,a.value]]),s[1]||(s[1]=t("div",{class:"radio-circle absolute left-2 top-2 size-5 rounded-full",border:"2 solid neutral-300 dark:neutral-600",transition:"all duration-200 ease-in-out"},[t("div",{class:"radio-dot absolute left-1/2 top-1/2 size-3 rounded-full opacity-0 -translate-x-1/2 -translate-y-1/2",transition:"all duration-200 ease-in-out",bg:"primary-500 dark:primary-400"})],-1)),t("div",K,[t("span",{class:o(["radio-item-name font-bold",[a.value===e.value?"text-neutral-700 dark:text-neutral-300":"text-neutral-500 dark:text-neutral-500"]]),text:"md",transition:"all duration-200 ease-in-out"},c(e.title),3),e.description?(d(),n("span",{key:0,class:o(["radio-item-description",[a.value===e.value?"text-neutral-600 dark:text-neutral-400":"text-neutral-400 dark:text-neutral-600"]]),transition:"all duration-200 ease-in-out"},c(e.description),3)):v("",!0)]),s[2]||(s[2]=t("div",{class:"bg-dotted-neutral-200/80 dark:bg-dotted-neutral-700/50 [input:checked~&]:bg-dotted-primary-300/50 dark:[input:checked~&]:bg-dotted-primary-200/20",absolute:"","inset-0":"","z--1":"",style:{"background-size":"10px 10px","mask-image":"linear-gradient(165deg, white 30%, transparent 50%)"}},null,-1))],2))}}),ie=C(O,[["__scopeId","data-v-dd41bc0b"]]),W={class:"radio-card-detail-many-select"},X={key:0,class:"relative","inline-flex":"~","w-full":"","items-center":""},Y=["placeholder"],Z={class:"mt-4 space-y-2"},_={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},ee={key:1,class:"flex items-center gap-3 border border-2 border-amber-200 rounded-xl bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},te={class:"flex flex-col"},ae={class:"font-medium"},le={class:"text-sm text-amber-600 dark:text-amber-400"},re={class:"relative"},oe=g({__name:"RadioCardDetailManySelect",props:f({items:null,searchable:{type:Boolean,default:!0},searchPlaceholder:{default:"Search..."},searchNoResultsTitle:{default:"No results found"},searchNoResultsDescription:{default:"Try a different search term"},searchResultsText:{default:"{count} of {total} results"},customInputPlaceholder:{default:"Enter custom value"},expandButtonText:{default:"Show more"},collapseButtonText:{default:"Show less"},showMore:{type:Boolean,default:!0}},{modelValue:{required:!0},modelModifiers:{}}),emits:f(["update:customValue"],["update:modelValue"]),setup(e,{emit:a}){const m=e,s=a,x=w(e,"modelValue"),r=b(""),i=b(!1),R=b(""),h=S(()=>{if(!r.value)return m.items;const p=r.value.toLowerCase();return m.items.filter(l=>l.name.toLowerCase().includes(p)||l.description&&l.description.toLowerCase().includes(p))});function I(p){R.value=p,s("update:customValue",p)}return(p,l)=>(d(),n("div",W,[e.searchable?(d(),n("div",X,[l[4]||(l[4]=t("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[t("div",{"i-solar:magnifer-line-duotone":"",class:"text-neutral-500 dark:text-neutral-400"})],-1)),V(t("input",{"onUpdate:modelValue":l[0]||(l[0]=u=>r.value=u),type:"search",class:"w-full rounded-xl p-2.5 pl-10 text-sm outline-none",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",bg:"white dark:neutral-900",placeholder:e.searchPlaceholder},null,8,Y),[[T,r.value]])])):v("",!0),t("div",Z,[r.value?(d(),n("div",_,c(e.searchResultsText.replace("{count}",h.value.length.toString()).replace("{total}",e.items.length.toString())),1)):v("",!0),r.value&&h.value.length===0?(d(),n("div",ee,[l[5]||(l[5]=t("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),t("div",te,[t("span",ae,c(e.searchNoResultsTitle),1),t("span",le,c(e.searchNoResultsDescription.replace("{query}",r.value)),1)])])):v("",!0),t("div",re,[t("div",{class:o(["scrollbar-hide grid auto-cols-[350px] grid-flow-col max-h-[calc(100dvh-7lh)] gap-4 overflow-x-auto pb-4",[i.value?"grid-cols-1 md:grid-cols-2 grid-flow-row auto-cols-auto":""]]),transition:"all duration-200 ease-in-out",style:{"scroll-snap-type":"x mandatory"}},[(d(!0),n(z,null,D(h.value,u=>(d(),E(G,{id:u.id,key:u.id,modelValue:x.value,"onUpdate:modelValue":l[1]||(l[1]=y=>x.value=y),value:u.id,title:u.name,description:u.description,deprecated:u.deprecated,"show-expand-collapse":e.showMore,"expand-collapse-threshold":100,"show-custom-input":u.customizable,"custom-input-value":R.value,"custom-input-placeholder":e.customInputPlaceholder,name:"radio-card-detail-many-select",class:"scroll-snap-align-start","onUpdate:customInputValue":l[2]||(l[2]=y=>I(y))},null,8,["id","modelValue","value","title","description","deprecated","show-expand-collapse","show-custom-input","custom-input-value","custom-input-placeholder"]))),128))],2),t("div",{bg:"neutral-100 dark:[rgba(0,0,0,0.3)]","rounded-xl":"",class:o([i.value?"w-full":"mt-4 w-full rounded-lg"])},[t("button",{"w-full":"",flex:"","items-center":"","justify-center":"","gap-2":"","rounded-lg":"","py-2":"",transition:"all duration-200 ease-in-out",class:o([i.value?"bg-primary-500 hover:bg-primary-600 text-white":"bg-white dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800"]),onClick:l[3]||(l[3]=u=>i.value=!i.value)},[t("span",null,c(i.value?e.collapseButtonText:e.expandButtonText),1),t("div",{class:o([i.value?"rotate-180":"","text-lg"]),"i-solar:alt-arrow-down-bold-duotone":"",transition:"transform duration-200 ease-in-out"},null,2)],2)],2)])])]))}}),ue=C(oe,[["__scopeId","data-v-0c2329bf"]]);export{ue as R,ie as a}; diff --git a/assets/RadioCardDetailManySelect-DctfBiRo.css b/assets/RadioCardDetailManySelect-DctfBiRo.css deleted file mode 100644 index 0b611729ada1e85623d369530ac71df382217b8e..0000000000000000000000000000000000000000 --- a/assets/RadioCardDetailManySelect-DctfBiRo.css +++ /dev/null @@ -1 +0,0 @@ -.form_radio-card-detail[data-v-c9195151]{position:relative;overflow:hidden}.form_radio-card-detail[data-v-c9195151]:before{pointer-events:none;--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .35s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .form_radio-card-detail[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.form_radio-card-detail[data-v-c9195151]:hover:before,.form_radio-card-detail._hover[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .form_radio-card-detail[data-v-c9195151]:hover:before,.dark .form_radio-card-detail._hover[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.form_radio-card-detail-active[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:.5}.dark .form_radio-card-detail-active[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.form_radio-card-simple[data-v-dd41bc0b]{position:relative;overflow:hidden}.form_radio-card-simple[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .35s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .form_radio-card-simple[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.form_radio-card-simple[data-v-dd41bc0b]:hover:before,.form_radio-card-simple._hover[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .form_radio-card-simple[data-v-dd41bc0b]:hover:before,.dark .form_radio-card-simple._hover[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.form_radio-card-simple-active[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:.5}.dark .form_radio-card-simple-active[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}input[type=search][data-v-0c2329bf]::-webkit-search-cancel-button{display:none} diff --git a/assets/SpeechProviderSettings.vue_vue_type_script_setup_true_lang-B6yYYFHK.js b/assets/SpeechProviderSettings.vue_vue_type_script_setup_true_lang-B6yYYFHK.js deleted file mode 100644 index 6cb214560b3a9fee468c79e099b39bcdd0e5d2cd..0000000000000000000000000000000000000000 --- a/assets/SpeechProviderSettings.vue_vue_type_script_setup_true_lang-B6yYYFHK.js +++ /dev/null @@ -1 +0,0 @@ -import{d as B,q as N,bw as ee,c as b,o as f,b as I,m as T,A as O,u as l,a,z as H,bx as q,g as u,w as K,H as Q,D as S,C as R,bE as F,bH as te,by as oe,bG as ae,s as le,h as C,l as se,x as re,y as M,bU as A,bV as G,bQ as ie}from"./index-20XXNHAB.js";import{a as ne,_ as ue}from"./TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as de,g as ve}from"./speech-CF8Au8j4.js";import{u as ce}from"./providers-BqZLRXH1.js";import{_ as pe,a as me}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as ge}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as fe,a as be}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as _e}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const he={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":""},xe=B({__name:"ProviderSettingsLayout2",props:{providerName:null,providerIcon:null,providerIconColor:null,onBack:{type:Function}},setup(_){const{t:o}=N();return(y,d)=>{const v=ee("motion");return f(),b(q,null,[I(_e,{title:_.providerName,subtitle:l(o)("settings.pages.providers.title")},null,8,["title","subtitle"]),T(y.$slots,"default"),O((f(),b("div",he,[a("div",{text:"60",class:H(_.providerIcon||_.providerIconColor)},null,2)])),[[v]])],64)}}}),ye={"w-full":"","rounded-xl":""},ke={class:"mb-4 text-lg text-neutral-500 md:text-2xl dark:text-neutral-400","w-full":""},Se={class:"inline-flex items-center gap-4"},Ue={flex:"~ col gap-4"},we=["placeholder"],Ie=["placeholder"],Ve={flex:"~ col gap-6"},$e={grid:"~ cols-2 gap-4"},Te={class:"flex items-center gap-1 text-sm font-medium"},Le={class:"text-xs text-neutral-500 dark:text-neutral-400"},Re=["value"],Pe={flex:"~ row","gap-4":""},Ce=["disabled"],Me={flex:"~ row","items-center":"","gap-2":""},Oe={flex:"~ row","items-center":"","gap-2":""},ze={key:2,class:"mt-2 text-sm text-red-500"},Ke={key:3,class:"mt-2 text-sm text-red-500"},Be={key:4,class:"mt-2 text-sm text-red-500"},Ne=["src"],tt=B({__name:"SpeechPlayground",props:{defaultText:null,availableVoices:null,generateSpeech:{type:Function},apiKeyConfigured:{type:Boolean}},setup(_,{expose:o}){const y=_,{t:d}=N(),v=u(y.defaultText||"Hello! This is a test of the voice synthesis."),U=u(!1),t=u(""),p=u(""),g=u(null),i=u(!1),h=u(""),m=u("");K(()=>y.availableVoices,n=>{var r;n.length>0&&!m.value&&(m.value=((r=n[0])==null?void 0:r.id)||"")},{immediate:!0});async function x(){if(!(!v.value.trim()&&!i.value||i.value&&!h.value.trim()||!m.value)){U.value=!0,p.value="";try{t.value&&V();const n=i.value?h.value:v.value,r=await y.generateSpeech(n,m.value,i.value);t.value=URL.createObjectURL(new Blob([r])),setTimeout(()=>{g.value&&g.value.play()},100)}catch(n){console.error("Error generating speech:",n),p.value=n instanceof Error?n.message:"An unknown error occurred"}finally{U.value=!1}}}function V(){g.value&&(g.value.pause(),g.value.currentTime=0),t.value&&(URL.revokeObjectURL(t.value),t.value="")}return Q(()=>{t.value&&URL.revokeObjectURL(t.value)}),o({testText:v,ssmlText:h,useSSML:i,selectedVoice:m,isGenerating:U,audioUrl:t,errorMessage:p,audioPlayer:g,generateTestSpeech:x,stopTestAudio:V}),(n,r)=>(f(),b("div",ye,[a("h2",ke,[a("div",Se,[I(l(ne)),a("div",null,S(l(d)("settings.pages.providers.provider.elevenlabs.playground.title")),1)])]),a("div",Ue,[I(l(ue),{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=c=>i.value=c),label:l(d)("settings.pages.modules.speech.sections.section.voice-settings.use-ssml.label"),description:l(d)("settings.pages.modules.speech.sections.section.voice-settings.use-ssml.description")},null,8,["modelValue","label","description"]),i.value?O((f(),b("textarea",{key:1,"onUpdate:modelValue":r[2]||(r[2]=c=>h.value=c),placeholder:l(d)("settings.pages.modules.speech.sections.section.voice-settings.input-ssml.placeholder"),border:"neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700",transition:"all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900","h-48":"","w-full":"","rounded-lg":"","px-3":"","py-2":"","text-sm":"","font-mono":"","outline-none":""},null,8,Ie)),[[F,h.value]]):O((f(),b("textarea",{key:0,"onUpdate:modelValue":r[1]||(r[1]=c=>v.value=c),placeholder:l(d)("settings.pages.providers.provider.elevenlabs.playground.fields.field.input.placeholder"),border:"neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700",transition:"all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900","h-24":"","w-full":"","rounded-lg":"","px-3":"","py-2":"","text-sm":"","outline-none":""},null,8,we)),[[F,v.value]]),a("div",Ve,[a("label",$e,[a("div",null,[a("div",Te,S(l(d)("settings.pages.providers.provider.elevenlabs.playground.fields.field.voice.label")),1),a("div",Le,S(l(d)("settings.pages.providers.provider.elevenlabs.playground.fields.field.voice.description")),1)]),O(a("select",{"onUpdate:modelValue":r[3]||(r[3]=c=>m.value=c),border:"neutral-300 dark:neutral-800 solid 2 focus:neutral-400 dark:focus:neutral-600",transition:"border duration-250 ease-in-out","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":""},[(f(!0),b(q,null,oe(_.availableVoices,c=>(f(),b("option",{key:c.id,value:c.id},S(c.name),9,Re))),128))],512),[[te,m.value]])])]),a("div",Pe,[a("button",{border:"neutral-800 dark:neutral-200 solid 2",transition:"border duration-250 ease-in-out","rounded-lg":"","px-4":"",text:"neutral-100 dark:neutral-900","py-2":"","text-sm":"",disabled:U.value||!v.value.trim()&&!i.value||i.value&&!h.value.trim()||!m.value||!_.apiKeyConfigured,class:H({"opacity-50 cursor-not-allowed":U.value||!v.value.trim()&&!i.value||i.value&&!h.value.trim()||!m.value||!_.apiKeyConfigured}),bg:"neutral-700 dark:neutral-300",onClick:x},[a("div",Me,[r[4]||(r[4]=a("div",{"i-solar:play-circle-bold-duotone":""},null,-1)),a("span",null,S(U.value?l(d)("settings.pages.providers.provider.elevenlabs.playground.buttons.button.test-voice.generating"):l(d)("settings.pages.providers.provider.elevenlabs.playground.buttons.button.test-voice.label")),1)])],10,Ce),t.value?(f(),b("button",{key:0,border:"primary-300 dark:primary-800 solid 2",transition:"border duration-250 ease-in-out","rounded-lg":"","px-4":"","py-2":"","text-sm":"",onClick:V},[a("div",Oe,[r[5]||(r[5]=a("div",{"i-solar:stop-circle-bold-duotone":""},null,-1)),a("span",null,S(l(d)("settings.pages.modules.speech.sections.section.playground.buttons.stop.label")),1)])])):R("",!0)]),_.apiKeyConfigured?R("",!0):(f(),b("div",ze,S(l(d)("settings.pages.providers.provider.elevenlabs.playground.validation.error-missing-api-key")),1)),m.value?R("",!0):(f(),b("div",Ke,S(l(d)("settings.pages.modules.speech.sections.section.playground.select-voice.required")),1)),p.value?(f(),b("div",Be,S(p.value),1)):R("",!0),t.value?(f(),b("audio",{key:5,ref_key:"audioPlayer",ref:g,src:t.value,controls:"",class:"mt-2 w-full"},null,8,Ne)):R("",!0)]),T(n.$slots,"default")]))}}),je={flex:"~ col md:row gap-6"},De={flex:"~ col gap-6"},Ee={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},Fe={flex:"~ col gap-4"},Ae={flex:"~ col gap-6",class:"w-full md:w-[60%]"},Ge={"w-full":"","rounded-xl":""},ot=B({__name:"SpeechProviderSettings",props:{providerId:null,defaultModel:null,additionalSettings:null},setup(_){const o=_,{t:y}=N(),d=ae(),v=ce(),U=de(),{providers:t}=le(v),p=C(()=>v.getProviderMetadata(o.providerId)),g=C({get:()=>{var e;return((e=t.value[o.providerId])==null?void 0:e.apiKey)||""},set:e=>{t.value[o.providerId]||(t.value[o.providerId]={}),t.value[o.providerId].apiKey=e}}),i=C({get:()=>{var e,s,k;return((e=t.value[o.providerId])==null?void 0:e.baseUrl)||((k=(s=p.value)==null?void 0:s.defaultOptions)==null?void 0:k.baseUrl)||""},set:e=>{t.value[o.providerId]||(t.value[o.providerId]={}),t.value[o.providerId].baseUrl=e}}),h=u("Hello! This is a test of voice synthesis."),m=u(!1),x=u(""),V=u(""),n=u(null),r=u(!1),c=u(""),j=u(""),w=u({});function J(){var e;(e=t.value[o.providerId])!=null&&e.voiceSettings?w.value={...t.value[o.providerId].voiceSettings}:w.value={pitch:0,speed:1,volume:0,...o.additionalSettings}}se(()=>{var e,s,k,$;v.initializeProvider(o.providerId),g.value=((e=t.value[o.providerId])==null?void 0:e.apiKey)||"",i.value=((s=t.value[o.providerId])==null?void 0:s.baseUrl)||(($=(k=p.value)==null?void 0:k.defaultOptions)==null?void 0:$.baseUrl)||"",J(),v.configuredProviders[o.providerId]&&U.loadVoicesForProvider(o.providerId)});const z=ie(()=>{var e,s;t.value[o.providerId]={...t.value[o.providerId],apiKey:g.value,baseUrl:i.value||((s=(e=p.value)==null?void 0:e.defaultOptions)==null?void 0:s.baseUrl)||"",voiceSettings:{...w.value}}},1e3);K([g,i],z),K(w,z,{deep:!0});async function W(){if(!h.value.trim()&&!r.value||r.value&&!c.value.trim())return;const e=v.getProviderInstance(o.providerId);if(!e){console.error("Failed to initialize speech provider");return}if(!j.value){console.error("No active speech voice selected");return}m.value=!0,V.value="";try{x.value&&D();const s=o.defaultModel||"default",k=r.value?c.value:h.value,$=await ve({...e.speech(s,{voiceSettings:w.value}),input:k,voice:j.value});x.value=URL.createObjectURL(new Blob([$])),setTimeout(()=>{n.value&&n.value.play()},100)}catch(s){console.error("Error generating speech:",s),V.value=s instanceof Error?s.message:"An unknown error occurred"}finally{m.value=!1}}function D(){n.value&&(n.value.pause(),n.value.currentTime=0),x.value&&(URL.revokeObjectURL(x.value),x.value="")}Q(()=>{x.value&&URL.revokeObjectURL(x.value)});function X(){var e,s;w.value={...((s=(e=p.value)==null?void 0:e.defaultOptions)==null?void 0:s.voiceSettings)||{}},z()}function Y(e,s){w.value[e]=s}const E=C(()=>({voiceSettings:w.value,updateVoiceSettings:Y,isGenerating:m.value,testText:h.value,useSSML:r.value,ssmlText:c.value,generateTestSpeech:W,stopTestAudio:D,audioUrl:x.value,audioPlayer:n.value,errorMessage:V.value}));return(e,s)=>{var k,$;return f(),re(xe,{"provider-name":(k=p.value)==null?void 0:k.localizedName,"provider-icon":($=p.value)==null?void 0:$.icon,"on-back":()=>l(d).back()},{default:M(()=>[a("div",je,[I(l(fe),{class:"w-full md:w-[40%]"},{default:M(()=>[I(l(be),{title:l(y)("settings.pages.providers.common.section.basic.title"),description:l(y)("settings.pages.providers.common.section.basic.description"),"on-reset":X},{default:M(()=>{var L;return[I(l(ge),{modelValue:g.value,"onUpdate:modelValue":s[0]||(s[0]=P=>g.value=P),"provider-name":(L=p.value)==null?void 0:L.localizedName,placeholder:"sk-"},null,8,["modelValue","provider-name"]),T(e.$slots,"basic-settings")]}),_:3},8,["title","description"]),a("div",De,[a("h2",Ee,S(l(y)("settings.pages.providers.common.section.voice.title")),1),a("div",Fe,[T(e.$slots,"voice-settings",A(G(E.value)))])]),I(l(pe),{title:l(y)("settings.pages.providers.common.section.advanced.title")},{default:M(()=>{var L,P;return[I(l(me),{modelValue:i.value,"onUpdate:modelValue":s[1]||(s[1]=Z=>i.value=Z),placeholder:((P=(L=p.value)==null?void 0:L.defaultOptions)==null?void 0:P.baseUrl)||"",required:""},null,8,["modelValue","placeholder"]),T(e.$slots,"advanced-settings")]}),_:3},8,["title"])]),_:3}),a("div",Ae,[a("div",Ge,[T(e.$slots,"playground",A(G(E.value)))])])])]),_:3},8,["provider-name","provider-icon","on-back"])}}});export{tt as _,ot as a}; diff --git a/assets/SpeechProviderSettings.vue_vue_type_script_setup_true_lang-Cscdqs1L.js b/assets/SpeechProviderSettings.vue_vue_type_script_setup_true_lang-Cscdqs1L.js new file mode 100644 index 0000000000000000000000000000000000000000..c07645d52c4854168964ffaba69057c468cc8485 --- /dev/null +++ b/assets/SpeechProviderSettings.vue_vue_type_script_setup_true_lang-Cscdqs1L.js @@ -0,0 +1 @@ +import{d as B,q as N,bw as ee,c as b,o as f,b as I,m as T,A as O,u as l,a,z as H,bx as q,g as u,w as K,H as Q,D as S,C as R,bE as F,bH as te,by as oe,bG as ae,s as le,h as C,l as se,x as re,y as M,bU as A,bV as G,bQ as ie}from"./index-D8Nm21zW.js";import{a as ne,_ as ue}from"./TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{u as de,g as ve}from"./speech-B27BwGQ-.js";import{u as ce}from"./providers-DUDq6kdm.js";import{_ as pe,a as me}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as ge}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as fe,a as be}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as _e}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const he={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":""},xe=B({__name:"ProviderSettingsLayout2",props:{providerName:null,providerIcon:null,providerIconColor:null,onBack:{type:Function}},setup(_){const{t:o}=N();return(y,d)=>{const v=ee("motion");return f(),b(q,null,[I(_e,{title:_.providerName,subtitle:l(o)("settings.pages.providers.title")},null,8,["title","subtitle"]),T(y.$slots,"default"),O((f(),b("div",he,[a("div",{text:"60",class:H(_.providerIcon||_.providerIconColor)},null,2)])),[[v]])],64)}}}),ye={"w-full":"","rounded-xl":""},ke={class:"mb-4 text-lg text-neutral-500 md:text-2xl dark:text-neutral-400","w-full":""},Se={class:"inline-flex items-center gap-4"},Ue={flex:"~ col gap-4"},we=["placeholder"],Ie=["placeholder"],Ve={flex:"~ col gap-6"},$e={grid:"~ cols-2 gap-4"},Te={class:"flex items-center gap-1 text-sm font-medium"},Le={class:"text-xs text-neutral-500 dark:text-neutral-400"},Re=["value"],Pe={flex:"~ row","gap-4":""},Ce=["disabled"],Me={flex:"~ row","items-center":"","gap-2":""},Oe={flex:"~ row","items-center":"","gap-2":""},ze={key:2,class:"mt-2 text-sm text-red-500"},Ke={key:3,class:"mt-2 text-sm text-red-500"},Be={key:4,class:"mt-2 text-sm text-red-500"},Ne=["src"],tt=B({__name:"SpeechPlayground",props:{defaultText:null,availableVoices:null,generateSpeech:{type:Function},apiKeyConfigured:{type:Boolean}},setup(_,{expose:o}){const y=_,{t:d}=N(),v=u(y.defaultText||"Hello! This is a test of the voice synthesis."),U=u(!1),t=u(""),p=u(""),g=u(null),i=u(!1),h=u(""),m=u("");K(()=>y.availableVoices,n=>{var r;n.length>0&&!m.value&&(m.value=((r=n[0])==null?void 0:r.id)||"")},{immediate:!0});async function x(){if(!(!v.value.trim()&&!i.value||i.value&&!h.value.trim()||!m.value)){U.value=!0,p.value="";try{t.value&&V();const n=i.value?h.value:v.value,r=await y.generateSpeech(n,m.value,i.value);t.value=URL.createObjectURL(new Blob([r])),setTimeout(()=>{g.value&&g.value.play()},100)}catch(n){console.error("Error generating speech:",n),p.value=n instanceof Error?n.message:"An unknown error occurred"}finally{U.value=!1}}}function V(){g.value&&(g.value.pause(),g.value.currentTime=0),t.value&&(URL.revokeObjectURL(t.value),t.value="")}return Q(()=>{t.value&&URL.revokeObjectURL(t.value)}),o({testText:v,ssmlText:h,useSSML:i,selectedVoice:m,isGenerating:U,audioUrl:t,errorMessage:p,audioPlayer:g,generateTestSpeech:x,stopTestAudio:V}),(n,r)=>(f(),b("div",ye,[a("h2",ke,[a("div",Se,[I(l(ne)),a("div",null,S(l(d)("settings.pages.providers.provider.elevenlabs.playground.title")),1)])]),a("div",Ue,[I(l(ue),{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=c=>i.value=c),label:l(d)("settings.pages.modules.speech.sections.section.voice-settings.use-ssml.label"),description:l(d)("settings.pages.modules.speech.sections.section.voice-settings.use-ssml.description")},null,8,["modelValue","label","description"]),i.value?O((f(),b("textarea",{key:1,"onUpdate:modelValue":r[2]||(r[2]=c=>h.value=c),placeholder:l(d)("settings.pages.modules.speech.sections.section.voice-settings.input-ssml.placeholder"),border:"neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700",transition:"all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900","h-48":"","w-full":"","rounded-lg":"","px-3":"","py-2":"","text-sm":"","font-mono":"","outline-none":""},null,8,Ie)),[[F,h.value]]):O((f(),b("textarea",{key:0,"onUpdate:modelValue":r[1]||(r[1]=c=>v.value=c),placeholder:l(d)("settings.pages.providers.provider.elevenlabs.playground.fields.field.input.placeholder"),border:"neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700",transition:"all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900","h-24":"","w-full":"","rounded-lg":"","px-3":"","py-2":"","text-sm":"","outline-none":""},null,8,we)),[[F,v.value]]),a("div",Ve,[a("label",$e,[a("div",null,[a("div",Te,S(l(d)("settings.pages.providers.provider.elevenlabs.playground.fields.field.voice.label")),1),a("div",Le,S(l(d)("settings.pages.providers.provider.elevenlabs.playground.fields.field.voice.description")),1)]),O(a("select",{"onUpdate:modelValue":r[3]||(r[3]=c=>m.value=c),border:"neutral-300 dark:neutral-800 solid 2 focus:neutral-400 dark:focus:neutral-600",transition:"border duration-250 ease-in-out","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":""},[(f(!0),b(q,null,oe(_.availableVoices,c=>(f(),b("option",{key:c.id,value:c.id},S(c.name),9,Re))),128))],512),[[te,m.value]])])]),a("div",Pe,[a("button",{border:"neutral-800 dark:neutral-200 solid 2",transition:"border duration-250 ease-in-out","rounded-lg":"","px-4":"",text:"neutral-100 dark:neutral-900","py-2":"","text-sm":"",disabled:U.value||!v.value.trim()&&!i.value||i.value&&!h.value.trim()||!m.value||!_.apiKeyConfigured,class:H({"opacity-50 cursor-not-allowed":U.value||!v.value.trim()&&!i.value||i.value&&!h.value.trim()||!m.value||!_.apiKeyConfigured}),bg:"neutral-700 dark:neutral-300",onClick:x},[a("div",Me,[r[4]||(r[4]=a("div",{"i-solar:play-circle-bold-duotone":""},null,-1)),a("span",null,S(U.value?l(d)("settings.pages.providers.provider.elevenlabs.playground.buttons.button.test-voice.generating"):l(d)("settings.pages.providers.provider.elevenlabs.playground.buttons.button.test-voice.label")),1)])],10,Ce),t.value?(f(),b("button",{key:0,border:"primary-300 dark:primary-800 solid 2",transition:"border duration-250 ease-in-out","rounded-lg":"","px-4":"","py-2":"","text-sm":"",onClick:V},[a("div",Oe,[r[5]||(r[5]=a("div",{"i-solar:stop-circle-bold-duotone":""},null,-1)),a("span",null,S(l(d)("settings.pages.modules.speech.sections.section.playground.buttons.stop.label")),1)])])):R("",!0)]),_.apiKeyConfigured?R("",!0):(f(),b("div",ze,S(l(d)("settings.pages.providers.provider.elevenlabs.playground.validation.error-missing-api-key")),1)),m.value?R("",!0):(f(),b("div",Ke,S(l(d)("settings.pages.modules.speech.sections.section.playground.select-voice.required")),1)),p.value?(f(),b("div",Be,S(p.value),1)):R("",!0),t.value?(f(),b("audio",{key:5,ref_key:"audioPlayer",ref:g,src:t.value,controls:"",class:"mt-2 w-full"},null,8,Ne)):R("",!0)]),T(n.$slots,"default")]))}}),je={flex:"~ col md:row gap-6"},De={flex:"~ col gap-6"},Ee={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},Fe={flex:"~ col gap-4"},Ae={flex:"~ col gap-6",class:"w-full md:w-[60%]"},Ge={"w-full":"","rounded-xl":""},ot=B({__name:"SpeechProviderSettings",props:{providerId:null,defaultModel:null,additionalSettings:null},setup(_){const o=_,{t:y}=N(),d=ae(),v=ce(),U=de(),{providers:t}=le(v),p=C(()=>v.getProviderMetadata(o.providerId)),g=C({get:()=>{var e;return((e=t.value[o.providerId])==null?void 0:e.apiKey)||""},set:e=>{t.value[o.providerId]||(t.value[o.providerId]={}),t.value[o.providerId].apiKey=e}}),i=C({get:()=>{var e,s,k;return((e=t.value[o.providerId])==null?void 0:e.baseUrl)||((k=(s=p.value)==null?void 0:s.defaultOptions)==null?void 0:k.baseUrl)||""},set:e=>{t.value[o.providerId]||(t.value[o.providerId]={}),t.value[o.providerId].baseUrl=e}}),h=u("Hello! This is a test of voice synthesis."),m=u(!1),x=u(""),V=u(""),n=u(null),r=u(!1),c=u(""),j=u(""),w=u({});function J(){var e;(e=t.value[o.providerId])!=null&&e.voiceSettings?w.value={...t.value[o.providerId].voiceSettings}:w.value={pitch:0,speed:1,volume:0,...o.additionalSettings}}se(()=>{var e,s,k,$;v.initializeProvider(o.providerId),g.value=((e=t.value[o.providerId])==null?void 0:e.apiKey)||"",i.value=((s=t.value[o.providerId])==null?void 0:s.baseUrl)||(($=(k=p.value)==null?void 0:k.defaultOptions)==null?void 0:$.baseUrl)||"",J(),v.configuredProviders[o.providerId]&&U.loadVoicesForProvider(o.providerId)});const z=ie(()=>{var e,s;t.value[o.providerId]={...t.value[o.providerId],apiKey:g.value,baseUrl:i.value||((s=(e=p.value)==null?void 0:e.defaultOptions)==null?void 0:s.baseUrl)||"",voiceSettings:{...w.value}}},1e3);K([g,i],z),K(w,z,{deep:!0});async function W(){if(!h.value.trim()&&!r.value||r.value&&!c.value.trim())return;const e=v.getProviderInstance(o.providerId);if(!e){console.error("Failed to initialize speech provider");return}if(!j.value){console.error("No active speech voice selected");return}m.value=!0,V.value="";try{x.value&&D();const s=o.defaultModel||"default",k=r.value?c.value:h.value,$=await ve({...e.speech(s,{voiceSettings:w.value}),input:k,voice:j.value});x.value=URL.createObjectURL(new Blob([$])),setTimeout(()=>{n.value&&n.value.play()},100)}catch(s){console.error("Error generating speech:",s),V.value=s instanceof Error?s.message:"An unknown error occurred"}finally{m.value=!1}}function D(){n.value&&(n.value.pause(),n.value.currentTime=0),x.value&&(URL.revokeObjectURL(x.value),x.value="")}Q(()=>{x.value&&URL.revokeObjectURL(x.value)});function X(){var e,s;w.value={...((s=(e=p.value)==null?void 0:e.defaultOptions)==null?void 0:s.voiceSettings)||{}},z()}function Y(e,s){w.value[e]=s}const E=C(()=>({voiceSettings:w.value,updateVoiceSettings:Y,isGenerating:m.value,testText:h.value,useSSML:r.value,ssmlText:c.value,generateTestSpeech:W,stopTestAudio:D,audioUrl:x.value,audioPlayer:n.value,errorMessage:V.value}));return(e,s)=>{var k,$;return f(),re(xe,{"provider-name":(k=p.value)==null?void 0:k.localizedName,"provider-icon":($=p.value)==null?void 0:$.icon,"on-back":()=>l(d).back()},{default:M(()=>[a("div",je,[I(l(fe),{class:"w-full md:w-[40%]"},{default:M(()=>[I(l(be),{title:l(y)("settings.pages.providers.common.section.basic.title"),description:l(y)("settings.pages.providers.common.section.basic.description"),"on-reset":X},{default:M(()=>{var L;return[I(l(ge),{modelValue:g.value,"onUpdate:modelValue":s[0]||(s[0]=P=>g.value=P),"provider-name":(L=p.value)==null?void 0:L.localizedName,placeholder:"sk-"},null,8,["modelValue","provider-name"]),T(e.$slots,"basic-settings")]}),_:3},8,["title","description"]),a("div",De,[a("h2",Ee,S(l(y)("settings.pages.providers.common.section.voice.title")),1),a("div",Fe,[T(e.$slots,"voice-settings",A(G(E.value)))])]),I(l(pe),{title:l(y)("settings.pages.providers.common.section.advanced.title")},{default:M(()=>{var L,P;return[I(l(me),{modelValue:i.value,"onUpdate:modelValue":s[1]||(s[1]=Z=>i.value=Z),placeholder:((P=(L=p.value)==null?void 0:L.defaultOptions)==null?void 0:P.baseUrl)||"",required:""},null,8,["modelValue","placeholder"]),T(e.$slots,"advanced-settings")]}),_:3},8,["title"])]),_:3}),a("div",Ae,[a("div",Ge,[T(e.$slots,"playground",A(G(E.value)))])])])]),_:3},8,["provider-name","provider-icon","on-back"])}}});export{tt as _,ot as a}; diff --git a/assets/Stage-BMdJCq4V.css b/assets/Stage-BMdJCq4V.css new file mode 100644 index 0000000000000000000000000000000000000000..cccb6ea05050dd21b51847a9bf93a475426c1ba7 --- /dev/null +++ b/assets/Stage-BMdJCq4V.css @@ -0,0 +1 @@ +.form_input-range[data-v-6ca6d31c]{--height: 2em;min-height:var(--height);-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border-radius:4px;transition:background-color .2s ease;--thumb-width: 4px;--thumb-height: var(--height);--thumb-box-shadow: 0 0 0px #e6e6e6;--thumb-border: none;--thumb-border-radius: 999px;--thumb-background: oklch(80% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--thumb-background-hover: oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--thumb-background-active: oklch(70% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--track-height: calc(var(--height) - var(--track-value-padding) * 2);--track-box-shadow: none;--track-border: solid 2px rgb(238, 238, 238);--track-border-radius: 6px;--track-background: rgb(238, 238, 238);--track-background-hover: rgb(238, 238, 238);--track-background-active: rgb(238, 238, 238);--track-value-background: rgb(255, 255, 255);--track-value-background-hover: rgb(255, 255, 255);--track-value-background-active: rgb(255, 255, 255);--track-value-padding: 2px}.dark .form_input-range[data-v-6ca6d31c]{--thumb-background: oklch(70% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--thumb-background-hover: oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--thumb-background-active: oklch(80% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0));--track-border: solid 2px rgb(44, 44, 44);--track-background: rgb(44, 44, 44);--track-background-hover: rgb(44, 44, 44);--track-background-active: rgb(44, 44, 44);--track-value-background: rgb(164, 164, 164);--track-value-background-hover: rgb(164, 164, 164);--track-value-background-active: rgb(164, 164, 164)}.form_input-range.slider-progress[data-v-6ca6d31c]{--range: calc(var(--max) - var(--min));--ratio: calc((var(--value) - var(--min)) / var(--range));--sx: calc(.5 * 0em + var(--ratio) * (100% - 0em))}.form_input-range[data-v-6ca6d31c]:focus{outline:none}.form_input-range[data-v-6ca6d31c]::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:var(--thumb-width);height:var(--thumb-height);border-radius:var(--thumb-border-radius);background:var(--thumb-background);border:var(--thumb-border);box-shadow:var(--thumb-box-shadow);margin-top:calc(var(--track-height) * .5 - var(--thumb-height) * .5 - 2px);margin-left:calc(0 - var(--track-value-padding));cursor:col-resize;transition:background .2s ease-in-out,box-shadow .2s ease-in-out,border-color .2s ease-in-out,transform .2s ease-in-out}.form_input-range[data-v-6ca6d31c]::-webkit-slider-runnable-track{height:var(--track-height);border:var(--track-border);border-radius:var(--track-border-radius);background:var(--track-background);box-shadow:var(--track-box-shadow);position:relative;cursor:col-resize;transition:box-shadow .2s ease-in-out,border-color .2s ease-in-out}.form_input-range[data-v-6ca6d31c]::-webkit-slider-thumb:hover{background:var(--thumb-background-hover)}.form_input-range[data-v-6ca6d31c]:hover::-webkit-slider-runnable-track{background:var(--track-background-hover)}.form_input-range[data-v-6ca6d31c]::-webkit-slider-thumb:active{background:var(--thumb-background-active)}.form_input-range[data-v-6ca6d31c]:active::-webkit-slider-runnable-track{background:var(--track-background-active)}.form_input-range.slider-progress[data-v-6ca6d31c]::-webkit-slider-runnable-track{margin-right:calc(0 - var(--track-value-padding));background:linear-gradient(var(--track-value-background),var(--track-value-background)) 0 / var(--sx) 100% no-repeat,var(--track-background)}.form_input-range.slider-progress[data-v-6ca6d31c]:hover::-webkit-slider-runnable-track{background:linear-gradient(var(--track-value-background-hover),var(--track-value-background-hover)) 0 / var(--sx) 100% no-repeat,var(--track-background-hover)}.form_input-range.slider-progress[data-v-6ca6d31c]:active::-webkit-slider-runnable-track{background:linear-gradient(var(--track-value-background-active),var(--track-value-background-active)) 0 / var(--sx) 100% no-repeat,var(--track-background-active)}.form_input-range[data-v-6ca6d31c]::-moz-range-thumb{width:var(--thumb-width);height:var(--thumb-height);border-radius:var(--thumb-border-radius);background:var(--thumb-background);border:none;box-shadow:var(--thumb-box-shadow);cursor:col-resize;margin-left:calc(0 - var(--track-value-padding))}.form_input-range[data-v-6ca6d31c]::-moz-range-track{height:var(--track-height);border:var(--track-border);border-radius:var(--track-border-radius);background:var(--track-background);box-shadow:var(--track-box-shadow);cursor:col-resize;width:calc(100% - var(--track-value-padding) * 2)}.form_input-range[data-v-6ca6d31c]::-moz-range-thumb:hover{background:var(--thumb-background-hover)}.form_input-range[data-v-6ca6d31c]:hover::-moz-range-track{background:var(--track-background-hover)}.form_input-range[data-v-6ca6d31c]::-moz-range-thumb:active{background:var(--thumb-background-active)}.form_input-range[data-v-6ca6d31c]:active::-moz-range-track{background:var(--track-background-active)}.form_input-range.slider-progress[data-v-6ca6d31c]::-moz-range-track{background:linear-gradient(var(--track-value-background),var(--track-value-background)) 0 / var(--sx) 100% no-repeat,var(--track-background)}.form_input-range.slider-progress[data-v-6ca6d31c]:hover::-moz-range-track{background:linear-gradient(var(--track-value-background-hover),var(--track-value-background-hover)) 0 / var(--sx) 100% no-repeat,var(--track-background-hover)}.form_input-range.slider-progress[data-v-6ca6d31c]:active::-moz-range-track{background:linear-gradient(var(--track-value-background-active),var(--track-value-background-active)) 0 / var(--sx) 100% no-repeat,var(--track-background-active)}.form_input-range[data-v-6ca6d31c]::-ms-fill-upper{background:transparent;border-color:transparent}.form_input-range[data-v-6ca6d31c]::-ms-fill-lower{background:transparent;border-color:transparent}.form_input-range[data-v-6ca6d31c]::-ms-thumb{width:var(--thumb-width);height:var(--thumb-height);border-radius:var(--thumb-border-radius);background:var(--thumb-background);border:var(--thumb-border);box-shadow:var(--thumb-box-shadow);margin-top:0;margin-left:calc(0 - var(--track-value-padding));box-sizing:border-box;cursor:col-resize}.form_input-range[data-v-6ca6d31c]::-ms-track{height:var(--track-height);border-radius:var(--track-border-radius);background:var(--track-background);border:var(--track-border);box-shadow:var(--track-box-shadow);box-sizing:border-box;cursor:col-resize}.form_input-range[data-v-6ca6d31c]::-ms-thumb:hover{background:var(--thumb-background-hover)}.form_input-range[data-v-6ca6d31c]:hover::-ms-track{background:var(--track-background-hover)}.form_input-range[data-v-6ca6d31c]::-ms-thumb:active{background:var(--thumb-background-active)}.form_input-range[data-v-6ca6d31c]:active::-ms-track{background:var(--track-background-active)}.form_input-range.slider-progress[data-v-6ca6d31c]::-ms-fill-lower{height:var(--track-height);border-radius:var(--track-border-radius) 0 0 var(--track-border-radius);margin:0;background:var(--track-value-background);border:none;border-right-width:0;margin-left:calc(var(--track-value-padding));margin-right:calc(0 - var(--track-value-padding))}.form_input-range.slider-progress[data-v-6ca6d31c]:hover::-ms-fill-lower{background:var(--track-value-background-hover)}.form_input-range.slider-progress[data-v-6ca6d31c]:active::-ms-fill-lower{background:var(--track-value-background-active)}.form_radio-card-detail[data-v-c9195151]{position:relative;overflow:hidden}.form_radio-card-detail[data-v-c9195151]:before{pointer-events:none;--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .35s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .form_radio-card-detail[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.form_radio-card-detail[data-v-c9195151]:hover:before,.form_radio-card-detail._hover[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .form_radio-card-detail[data-v-c9195151]:hover:before,.dark .form_radio-card-detail._hover[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.form_radio-card-detail-active[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:.5}.dark .form_radio-card-detail-active[data-v-c9195151]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.form_radio-card-simple[data-v-dd41bc0b]{position:relative;overflow:hidden}.form_radio-card-simple[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .35s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .form_radio-card-simple[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.form_radio-card-simple[data-v-dd41bc0b]:hover:before,.form_radio-card-simple._hover[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .form_radio-card-simple[data-v-dd41bc0b]:hover:before,.dark .form_radio-card-simple._hover[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.form_radio-card-simple-active[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:.5}.dark .form_radio-card-simple-active[data-v-dd41bc0b]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}input[type=search][data-v-0c2329bf]::-webkit-search-cancel-button{display:none}.form_voice-card[data-v-dbab964e]{position:relative;overflow:hidden;display:flex;flex-direction:column}.form_voice-card[data-v-dbab964e]:before{pointer-events:none;--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .35s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .form_voice-card[data-v-dbab964e]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.form_voice-card[data-v-dbab964e]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .form_voice-card[data-v-dbab964e]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}input[type=search][data-v-070104a7]::-webkit-search-cancel-button{display:none}.voice-card[data-v-070104a7]{position:relative;overflow:hidden;display:flex;flex-direction:column}.voice-card[data-v-070104a7]:before{pointer-events:none;--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .35s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .voice-card[data-v-070104a7]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.voice-card[data-v-070104a7]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .voice-card[data-v-070104a7]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.volumed[data-v-568551bc]{transform-style:preserve-3d;width:fit-content;height:fit-content}.test-dummy-flat[data-v-b4ef37ac]{display:inline-block;position:relative}.test-dummy-flat .marker[data-v-b4ef37ac]{position:absolute;top:0;right:0;bottom:0;left:0;background:conic-gradient(#ffeb3b,#ffeb3b 90deg,#000 90deg,#000 180deg,#ffeb3b 180deg,#ffeb3b 270deg,#000 270deg,#000 360deg);border-radius:50%;box-shadow:0 4px 12px #b9b9b933}.dark .test-dummy-flat .marker[data-v-b4ef37ac]{box-shadow:0 4px 12px #0003}.menu-icon-item[data-v-656e0116]{position:relative;overflow:hidden}.menu-icon-item[data-v-656e0116]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;width:25%;height:100%;-webkit-mask-image:linear-gradient(120deg,white 30%,transparent 50%);mask-image:linear-gradient(120deg,white 30%,transparent 50%);opacity:0;transition:all .4s ease-in-out}.dark .menu-icon-item[data-v-656e0116]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.menu-icon-item[data-v-656e0116]:hover:before,.menu-icon-item._hover[data-v-656e0116]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .menu-icon-item[data-v-656e0116]:hover:before,.dark .menu-icon-item._hover[data-v-656e0116]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.menu-icon-item[data-v-656e0116]:after{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.6;position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;width:100%;height:100%;background-size:10px 10px;content:"";-webkit-mask-image:linear-gradient(165deg,white 30%,transparent 50%);mask-image:linear-gradient(165deg,white 30%,transparent 50%);transition:all .4s ease-in-out}.menu-icon-item[data-v-656e0116]:after:hover{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.dark .menu-icon-item[data-v-656e0116]:after{background-image:radial-gradient(circle at 1px 1px,rgb(64 64 64 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.25}.dark .menu-icon-item[data-v-656e0116]:after:hover{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}.menu-icon-item-icon[data-v-656e0116]{opacity:.5}.menu-icon-item:hover .menu-icon-item-title[data-v-656e0116],.menu-icon-item._hover .menu-icon-item-title[data-v-656e0116]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.menu-icon-item:hover .menu-icon-item-description[data-v-656e0116],.menu-icon-item._hover .menu-icon-item-description[data-v-656e0116]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));opacity:.8}.menu-icon-item:hover .menu-icon-item-icon[data-v-656e0116],.menu-icon-item._hover .menu-icon-item-icon[data-v-656e0116]{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));scale:1.2}.dark .menu-icon-item:hover .menu-icon-item-title[data-v-656e0116],.dark .menu-icon-item._hover .menu-icon-item-title[data-v-656e0116]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .menu-icon-item:hover .menu-icon-item-description[data-v-656e0116],.dark .menu-icon-item._hover .menu-icon-item-description[data-v-656e0116]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));opacity:.8}.dark .menu-icon-item:hover .menu-icon-item-icon[data-v-656e0116],.dark .menu-icon-item._hover .menu-icon-item-icon[data-v-656e0116]{--un-text-opacity:1;color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.menu-icon-status-item[data-v-6e5b5c9c]{position:relative;overflow:hidden}.menu-icon-status-item[data-v-6e5b5c9c]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .4s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .menu-icon-status-item[data-v-6e5b5c9c]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.menu-icon-status-item[data-v-6e5b5c9c]:hover:before,.menu-icon-status-item._hover[data-v-6e5b5c9c]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:50%;opacity:1}.dark .menu-icon-status-item[data-v-6e5b5c9c]:hover:before,.dark .menu-icon-status-item._hover[data-v-6e5b5c9c]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.menu-icon-status-item-link[data-v-6e5b5c9c]:after{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.8;position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;width:100%;height:100%;background-size:10px 10px;content:"";-webkit-mask-image:linear-gradient(165deg,white 30%,transparent 50%);mask-image:linear-gradient(165deg,white 30%,transparent 50%);transition:all .4s ease-in-out}.menu-icon-status-item-link[data-v-6e5b5c9c]:after:hover{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.dark .menu-icon-status-item-link[data-v-6e5b5c9c]:after{background-image:radial-gradient(circle at 1px 1px,rgb(64 64 64 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.4}.dark .menu-icon-status-item-link[data-v-6e5b5c9c]:after:hover{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}.menu-icon-status-item-icon-color[data-v-6e5b5c9c]{opacity:.5}.menu-icon-status-item:hover .menu-icon-status-item-title[data-v-6e5b5c9c],.menu-icon-status-item._hover .menu-icon-status-item-title[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.menu-icon-status-item:hover .menu-icon-status-item-description[data-v-6e5b5c9c],.menu-icon-status-item._hover .menu-icon-status-item-description[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));opacity:.8}.menu-icon-status-item:hover .menu-icon-status-item-icon[data-v-6e5b5c9c],.menu-icon-status-item._hover .menu-icon-status-item-icon[data-v-6e5b5c9c],.menu-icon-status-item:hover .menu-icon-status-item-icon-color[data-v-6e5b5c9c],.menu-icon-status-item._hover .menu-icon-status-item-icon-color[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));scale:1.2}.dark .menu-icon-status-item:hover .menu-icon-status-item-title[data-v-6e5b5c9c],.dark .menu-icon-status-item._hover .menu-icon-status-item-title[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .menu-icon-status-item:hover .menu-icon-status-item-description[data-v-6e5b5c9c],.dark .menu-icon-status-item._hover .menu-icon-status-item-description[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));opacity:.8}.dark .menu-icon-status-item:hover .menu-icon-status-item-icon[data-v-6e5b5c9c],.dark .menu-icon-status-item._hover .menu-icon-status-item-icon[data-v-6e5b5c9c],.dark .menu-icon-status-item:hover .menu-icon-status-item-icon-color[data-v-6e5b5c9c],.dark .menu-icon-status-item._hover .menu-icon-status-item-icon-color[data-v-6e5b5c9c]{--un-text-opacity:1;color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.skeleton[data-v-f404da2a]{position:relative;transition:all .2s ease-in-out}.skeleton-pulse[data-v-f404da2a]{animation:skeleton-pulse-f404da2a 1.5s ease-in-out .5s infinite}@keyframes skeleton-pulse-f404da2a{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.skeleton-wave[data-v-f404da2a]:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background:linear-gradient(90deg,transparent,rgba(255,255,255,.2),transparent);animation:skeleton-wave-f404da2a 1.5s infinite;border-radius:inherit}.dark .skeleton-wave[data-v-f404da2a]:after{background:linear-gradient(90deg,transparent,rgba(255,255,255,.1),transparent)}@keyframes skeleton-wave-f404da2a{0%{transform:translate(-100%)}60%{transform:translate(100%)}to{transform:translate(100%)}}.card-hover-effect[data-v-895421da]{transform-style:preserve-3d;transform-origin:center;will-change:transform;transition:transform .3s cubic-bezier(.23,1,.32,1)}.card-hover-effect[data-v-895421da]:before,.card-hover-effect[data-v-895421da]:after{content:"";position:absolute;left:0;right:0;bottom:0;top:0;background-repeat:no-repeat;transition:all .33s ease;pointer-events:none}.card-hover-effect[data-v-895421da]:before{background-position:var(--card-position-x) var(--card-position-y);background-size:300% 300%;background-image:linear-gradient(115deg,transparent 0%,rgba(var(--color-primary-500),calc(.3 * var(--effect-intensity))) 25%,transparent 47%,transparent 53%,rgba(var(--color-primary-600),calc(.3 * var(--effect-intensity))) 75%,transparent 100%);opacity:calc(.5 * var(--effect-intensity));filter:brightness(.5) contrast(1);z-index:1;mix-blend-mode:color-dodge}.card-hover-effect[data-v-895421da]:after{background-position:var(--sparkle-position-x) var(--sparkle-position-y);background-size:160%;background-image:linear-gradient(125deg,rgba(var(--color-primary-500),calc(.3 * var(--effect-intensity))) 15%,rgba(var(--color-primary-400),calc(.25 * var(--effect-intensity))) 30%,rgba(var(--color-primary-300),calc(.2 * var(--effect-intensity))) 40%,rgba(var(--color-primary-200),calc(.1 * var(--effect-intensity))) 60%,rgba(var(--color-primary-400),calc(.25 * var(--effect-intensity))) 70%,rgba(var(--color-primary-500),calc(.3 * var(--effect-intensity))) 85%);background-blend-mode:overlay;opacity:calc(var(--sparkle-opacity) * var(--effect-intensity));filter:brightness(1) contrast(1);z-index:2;mix-blend-mode:color-dodge}.card-hover-effect[data-v-895421da]:hover:before{opacity:calc(.88 * var(--effect-intensity));filter:brightness(.66) contrast(1.33)}.card-hover-effect[data-v-895421da]:hover:after{opacity:var(--effect-intensity);filter:brightness(1.1) contrast(1.2)}.animate-stripe[data-v-3380f248]{background-image:repeating-linear-gradient(-45deg,#f472b6,#f472b6 25px,#f9a8d4 25px,#f9a8d4 50px);animation:progress-3380f248 2s linear infinite;background-size:150% 100%}@-webkit-keyframes progress-3380f248{0%{background-position:0 0}to{background-position:-75px 0px}}@-moz-keyframes progress-3380f248{0%{background-position:0 0}to{background-position:-75px 0px}}@-ms-keyframes progress-3380f248{0%{background-position:0 0}to{background-position:-75px 0px}}@keyframes progress-3380f248{0%{background-position:0 0}to{background-position:-70px 0px}} diff --git a/assets/live2d-zip-loader-52aPyiCh.js b/assets/Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js similarity index 91% rename from assets/live2d-zip-loader-52aPyiCh.js rename to assets/Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js index 96fbc76088619a1165824f38f7786ca41f50a1c6..bd3ec9f45919df001a58d9b563dc6c6a15c38115 100644 --- a/assets/live2d-zip-loader-52aPyiCh.js +++ b/assets/Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js @@ -1,18 +1,18 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/default-node-DXqP3VzA.js","assets/index-20XXNHAB.js","assets/index-a5yooE5o.css","assets/import-url-browser-CPN8ipMD.js","assets/duckdb-mvp-CaaD-olE.js","assets/import-url-node-BfNoxhRr.js"])))=>i.map(i=>d[i]); -var f1=Object.defineProperty;var p1=(r,t,e)=>t in r?f1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var W=(r,t,e)=>p1(r,typeof t!="symbol"?t+"":t,e);import{bm as Ef,ce as Dn,b2 as m1,a0 as g1,a9 as Fe,V as mt,Q as ne,a3 as Ps,ba as No,av as Xp,ag as Yp,ak as qp,b3 as ec,b6 as Af,cf as y1,$ as v1,cg as _1,a1 as b1,ch as Ho,ci as xn,W as qr,a4 as Wn,a_ as Ca,as as nr,cj as w1,X as Ui,b7 as x1,b5 as S1,ck as Qp,bb as Mf,cl as T1,aj as Jl,J as co,bc as I1,bf as E1,bg as A1,bp as M1,cm as Ei}from"./index-20XXNHAB.js";/*! +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/default-node-C_5jnHCL.js","assets/index-D8Nm21zW.js","assets/index-D4Du7g_x.css","assets/import-url-browser-CPN8ipMD.js","assets/duckdb-mvp-CaaD-olE.js","assets/import-url-node-BfNoxhRr.js"])))=>i.map(i=>d[i]); +var f1=Object.defineProperty;var p1=(r,t,e)=>t in r?f1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var W=(r,t,e)=>p1(r,typeof t!="symbol"?t+"":t,e);import{bm as Ef,ce as Dn,b2 as m1,a0 as g1,a9 as Fe,V as mt,Q as ne,a3 as Ps,ba as No,av as Xp,ag as Yp,ak as qp,b3 as ec,b6 as Af,cf as y1,$ as v1,cg as _1,a1 as b1,ch as Ho,ci as xn,W as qr,a4 as Wn,a_ as Ca,as as nr,cj as w1,X as hi,b7 as x1,b5 as S1,ck as Qp,bb as Mf,cl as T1,aj as Jl,J as co,bc as I1,bf as E1,bg as A1,bp as M1,cm as Ai}from"./index-D8Nm21zW.js";/*! * @pixi/constants - v6.5.10 * Compiled Thu, 06 Jul 2023 15:25:11 UTC * * @pixi/constants is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license - */var li;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(li||(li={}));var Oa;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Oa||(Oa={}));var tu;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(tu||(tu={}));var Qt;(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"})(Qt||(Qt={}));var Pa;(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"})(Pa||(Pa={}));var xt;(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"})(xt||(xt={}));var _s;(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"})(_s||(_s={}));var fe;(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"})(fe||(fe={}));var eu;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(eu||(eu={}));var Pr;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Pr||(Pr={}));var ru;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(ru||(ru={}));var Un;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(Un||(Un={}));var Ci;(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"})(Ci||(Ci={}));var hn;(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"})(hn||(hn={}));var nu;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(nu||(nu={}));var Rr;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(Rr||(Rr={}));var He;(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"})(He||(He={}));var Zp;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(Zp||(Zp={}));var Ve;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(Ve||(Ve={}));var Nn;(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"})(Nn||(Nn={}));/*! + */var li;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(li||(li={}));var Oa;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Oa||(Oa={}));var tu;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(tu||(tu={}));var Qt;(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"})(Qt||(Qt={}));var Pa;(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"})(Pa||(Pa={}));var xt;(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"})(xt||(xt={}));var _s;(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"})(_s||(_s={}));var fe;(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"})(fe||(fe={}));var eu;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(eu||(eu={}));var Pr;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Pr||(Pr={}));var ru;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(ru||(ru={}));var Un;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(Un||(Un={}));var Oi;(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"})(Oi||(Oi={}));var hn;(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"})(hn||(hn={}));var nu;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(nu||(nu={}));var Rr;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(Rr||(Rr={}));var He;(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"})(He||(He={}));var Zp;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(Zp||(Zp={}));var Ve;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(Ve||(Ve={}));var Nn;(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"})(Nn||(Nn={}));/*! * @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 C1={createCanvas:function(r,t){var e=document.createElement("canvas");return e.width=r,e.height=t,e},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,t){return fetch(r,t)}},Nc=/iPhone/i,Kp=/iPod/i,Jp=/iPad/i,tm=/\biOS-universal(?:.+)Mac\b/i,Bc=/\bAndroid(?:.+)Mobile\b/i,em=/Android/i,ks=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,fl=/Silk/i,qn=/Windows Phone/i,rm=/\bWindows(?:.+)ARM\b/i,nm=/BlackBerry/i,im=/BB10/i,sm=/Opera Mini/i,om=/\b(CriOS|Chrome)(?:.+)Mobile/i,am=/Mobile(?:.+)Firefox\b/i,lm=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function O1(r){return function(t){return t.test(r)}}function P1(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,n=e.split("[FBAN");typeof n[1]<"u"&&(e=n[0]),n=e.split("Twitter"),typeof n[1]<"u"&&(e=n[0]);var i=O1(e),s={apple:{phone:i(Nc)&&!i(qn),ipod:i(Kp),tablet:!i(Nc)&&(i(Jp)||lm(t))&&!i(qn),universal:i(tm),device:(i(Nc)||i(Kp)||i(Jp)||i(tm)||lm(t))&&!i(qn)},amazon:{phone:i(ks),tablet:!i(ks)&&i(fl),device:i(ks)||i(fl)},android:{phone:!i(qn)&&i(ks)||!i(qn)&&i(Bc),tablet:!i(qn)&&!i(ks)&&!i(Bc)&&(i(fl)||i(em)),device:!i(qn)&&(i(ks)||i(fl)||i(Bc)||i(em))||i(/\bokhttp\b/i)},windows:{phone:i(qn),tablet:i(rm),device:i(qn)||i(rm)},other:{blackberry:i(nm),blackberry10:i(im),opera:i(sm),firefox:i(am),chrome:i(om),device:i(nm)||i(im)||i(sm)||i(am)||i(om)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var ms=P1(globalThis.navigator);function R1(){return!ms.apple.device}function F1(r){var t=!0;if(ms.tablet||ms.phone){if(ms.apple.device){var e=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(e){var n=parseInt(e[1],10);n<11&&(t=!1)}}if(ms.android.device){var e=navigator.userAgent.match(/Android\s([0-9.]*)/);if(e){var n=parseInt(e[1],10);n<7&&(t=!1)}}}return t?r:4}var At={ADAPTER:C1,MIPMAP_TEXTURES:Un.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:Ve.NONE,SPRITE_MAX_TEXTURES:F1(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:nu.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:ru.CLAMP,SCALE_MODE:Pr.LINEAR,PRECISION_VERTEX:Rr.HIGH,PRECISION_FRAGMENT:ms.apple.device?Rr.HIGH:Rr.MEDIUM,CAN_UPLOAD_SAME_BUFFER:R1(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},Uc={exports:{}},um;function D1(){return um||(um=1,function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function s(l,u,c,h,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new i(c,h||l,f),m=e?e+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],d]:l._events[m].push(d):(l._events[m]=d,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,d=h.length,m=new Array(d);f80*R){j=tt=P[0],et=gt=P[1];for(var vt=R;vttt&&(tt=_t),ct>gt&&(gt=ct);bt=Math.max(tt-j,gt-et),bt=bt!==0?32767/bt:0}return n(M,O,R,j,et,bt,0),O}function t(P,C,R,z,U){var M,O;if(U===nt(P,C,R,z)>0)for(M=C;M=C;M-=z)O=I(M,P[M],P[M+1],O);return O&&T(O,O.next)&&(Z(O),O=O.next),O}function e(P,C){if(!P)return P;C||(C=P);var R=P,z;do if(z=!1,!R.steiner&&(T(R,R.next)||S(R.prev,R,R.next)===0)){if(Z(R),R=C=R.prev,R===R.next)break;z=!0}else R=R.next;while(z||R!==C);return C}function n(P,C,R,z,U,M,O){if(P){!O&&M&&d(P,z,U,M);for(var j=P,et,tt;P.prev!==P.next;){if(et=P.prev,tt=P.next,M?s(P,z,U,M):i(P)){C.push(et.i/R|0),C.push(P.i/R|0),C.push(tt.i/R|0),Z(P),P=tt.next,j=tt.next;continue}if(P=tt,P===j){O?O===1?(P=o(e(P),C,R),n(P,C,R,z,U,M,2)):O===2&&a(P,C,R,z,U,M):n(e(P),C,R,z,U,M,1);break}}}}function i(P){var C=P.prev,R=P,z=P.next;if(S(C,R,z)>=0)return!1;for(var U=C.x,M=R.x,O=z.x,j=C.y,et=R.y,tt=z.y,gt=UM?U>O?U:O:M>O?M:O,bt=j>et?j>tt?j:tt:et>tt?et:tt,vt=z.next;vt!==C;){if(vt.x>=gt&&vt.x<=ct&&vt.y>=_t&&vt.y<=bt&&y(U,j,M,et,O,tt,vt.x,vt.y)&&S(vt.prev,vt,vt.next)>=0)return!1;vt=vt.next}return!0}function s(P,C,R,z){var U=P.prev,M=P,O=P.next;if(S(U,M,O)>=0)return!1;for(var j=U.x,et=M.x,tt=O.x,gt=U.y,_t=M.y,ct=O.y,bt=jet?j>tt?j:tt:et>tt?et:tt,re=gt>_t?gt>ct?gt:ct:_t>ct?_t:ct,ue=g(bt,vt,C,R,z),b=g(Et,re,C,R,z),K=P.prevZ,Q=P.nextZ;K&&K.z>=ue&&Q&&Q.z<=b;){if(K.x>=bt&&K.x<=Et&&K.y>=vt&&K.y<=re&&K!==U&&K!==O&&y(j,gt,et,_t,tt,ct,K.x,K.y)&&S(K.prev,K,K.next)>=0||(K=K.prevZ,Q.x>=bt&&Q.x<=Et&&Q.y>=vt&&Q.y<=re&&Q!==U&&Q!==O&&y(j,gt,et,_t,tt,ct,Q.x,Q.y)&&S(Q.prev,Q,Q.next)>=0))return!1;Q=Q.nextZ}for(;K&&K.z>=ue;){if(K.x>=bt&&K.x<=Et&&K.y>=vt&&K.y<=re&&K!==U&&K!==O&&y(j,gt,et,_t,tt,ct,K.x,K.y)&&S(K.prev,K,K.next)>=0)return!1;K=K.prevZ}for(;Q&&Q.z<=b;){if(Q.x>=bt&&Q.x<=Et&&Q.y>=vt&&Q.y<=re&&Q!==U&&Q!==O&&y(j,gt,et,_t,tt,ct,Q.x,Q.y)&&S(Q.prev,Q,Q.next)>=0)return!1;Q=Q.nextZ}return!0}function o(P,C,R){var z=P;do{var U=z.prev,M=z.next.next;!T(U,M)&&v(U,z,z.next,M)&&N(U,M)&&N(M,U)&&(C.push(U.i/R|0),C.push(z.i/R|0),C.push(M.i/R|0),Z(z),Z(z.next),z=P=M),z=z.next}while(z!==P);return e(z)}function a(P,C,R,z,U,M){var O=P;do{for(var j=O.next.next;j!==O.prev;){if(O.i!==j.i&&_(O,j)){var et=it(O,j);O=e(O,O.next),et=e(et,et.next),n(O,C,R,z,U,M,0),n(et,C,R,z,U,M,0);return}j=j.next}O=O.next}while(O!==P)}function l(P,C,R,z){var U=[],M,O,j,et,tt;for(M=0,O=C.length;M=R.next.y&&R.next.y!==R.y){var j=R.x+(U-R.y)*(R.next.x-R.x)/(R.next.y-R.y);if(j<=z&&j>M&&(M=j,O=R.x=R.x&&R.x>=tt&&z!==R.x&&y(UO.x||R.x===O.x&&f(O,R)))&&(O=R,_t=ct)),R=R.next;while(R!==et);return O}function f(P,C){return S(P.prev,P,C.prev)<0&&S(C.next,P,P.next)<0}function d(P,C,R,z){var U=P;do U.z===0&&(U.z=g(U.x,U.y,C,R,z)),U.prevZ=U.prev,U.nextZ=U.next,U=U.next;while(U!==P);U.prevZ.nextZ=null,U.prevZ=null,m(U)}function m(P){var C,R,z,U,M,O,j,et,tt=1;do{for(R=P,P=null,M=null,O=0;R;){for(O++,z=R,j=0,C=0;C0||et>0&&z;)j!==0&&(et===0||!z||R.z<=z.z)?(U=R,R=R.nextZ,j--):(U=z,z=z.nextZ,et--),M?M.nextZ=U:P=U,U.prevZ=M,M=U;R=z}M.nextZ=null,tt*=2}while(O>1);return P}function g(P,C,R,z,U){return P=(P-R)*U|0,C=(C-z)*U|0,P=(P|P<<8)&16711935,P=(P|P<<4)&252645135,P=(P|P<<2)&858993459,P=(P|P<<1)&1431655765,C=(C|C<<8)&16711935,C=(C|C<<4)&252645135,C=(C|C<<2)&858993459,C=(C|C<<1)&1431655765,P|C<<1}function p(P){var C=P,R=P;do(C.x=(P-O)*(M-j)&&(P-O)*(z-j)>=(R-O)*(C-j)&&(R-O)*(M-j)>=(U-O)*(z-j)}function _(P,C){return P.next.i!==C.i&&P.prev.i!==C.i&&!B(P,C)&&(N(P,C)&&N(C,P)&&$(P,C)&&(S(P.prev,P,C.prev)||S(P,C.prev,C))||T(P,C)&&S(P.prev,P,P.next)>0&&S(C.prev,C,C.next)>0)}function S(P,C,R){return(C.y-P.y)*(R.x-C.x)-(C.x-P.x)*(R.y-C.y)}function T(P,C){return P.x===C.x&&P.y===C.y}function v(P,C,R,z){var U=w(S(P,C,R)),M=w(S(P,C,z)),O=w(S(R,z,P)),j=w(S(R,z,C));return!!(U!==M&&O!==j||U===0&&E(P,R,C)||M===0&&E(P,z,C)||O===0&&E(R,P,z)||j===0&&E(R,C,z))}function E(P,C,R){return C.x<=Math.max(P.x,R.x)&&C.x>=Math.min(P.x,R.x)&&C.y<=Math.max(P.y,R.y)&&C.y>=Math.min(P.y,R.y)}function w(P){return P>0?1:P<0?-1:0}function B(P,C){var R=P;do{if(R.i!==P.i&&R.next.i!==P.i&&R.i!==C.i&&R.next.i!==C.i&&v(R,R.next,P,C))return!0;R=R.next}while(R!==P);return!1}function N(P,C){return S(P.prev,P,P.next)<0?S(P,C,P.next)>=0&&S(P,P.prev,C)>=0:S(P,C,P.prev)<0||S(P,P.next,C)<0}function $(P,C){var R=P,z=!1,U=(P.x+C.x)/2,M=(P.y+C.y)/2;do R.y>M!=R.next.y>M&&R.next.y!==R.y&&U<(R.next.x-R.x)*(M-R.y)/(R.next.y-R.y)+R.x&&(z=!z),R=R.next;while(R!==P);return z}function it(P,C){var R=new x(P.i,P.x,P.y),z=new x(C.i,C.x,C.y),U=P.next,M=C.prev;return P.next=C,C.prev=P,R.next=U,U.prev=R,z.next=R,R.prev=z,M.next=z,z.prev=M,z}function I(P,C,R,z){var U=new x(P,C,R);return z?(U.next=z.next,U.prev=z,z.next.prev=U,z.next=U):(U.prev=U,U.next=U),U}function Z(P){P.next.prev=P.prev,P.prev.next=P.next,P.prevZ&&(P.prevZ.nextZ=P.nextZ),P.nextZ&&(P.nextZ.prevZ=P.prevZ)}function x(P,C,R){this.i=P,this.x=C,this.y=R,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(P,C,R,z){var U=C&&C.length,M=U?C[0]*R:P.length,O=Math.abs(nt(P,0,M,R));if(U)for(var j=0,et=C.length;j0&&(z+=P[U-1].length,R.holes.push(z))}return R},pl.exports}N1();var Hi={},aa={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var B1=aa.exports,hm;function U1(){return hm||(hm=1,function(r,t){(function(e){var n=t&&!t.nodeType&&t,i=r&&!r.nodeType&&r,s=typeof Dn=="object"&&Dn;(s.global===s||s.window===s||s.self===s)&&(e=s);var o,a=2147483647,l=36,u=1,c=26,h=38,f=700,d=72,m=128,g="-",p=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=l-u,v=Math.floor,E=String.fromCharCode,w;function B(U){throw new RangeError(S[U])}function N(U,M){for(var O=U.length,j=[];O--;)j[O]=M(U[O]);return j}function $(U,M){var O=U.split("@"),j="";O.length>1&&(j=O[0]+"@",U=O[1]),U=U.replace(_,".");var et=U.split("."),tt=N(et,M).join(".");return j+tt}function it(U){for(var M=[],O=0,j=U.length,et,tt;O=55296&&et<=56319&&O65535&&(M-=65536,O+=E(M>>>10&1023|55296),M=56320|M&1023),O+=E(M),O}).join("")}function Z(U){return U-48<10?U-22:U-65<26?U-65:U-97<26?U-97:l}function x(U,M){return U+22+75*(U<26)-((M!=0)<<5)}function nt(U,M,O){var j=0;for(U=O?v(U/f):U>>1,U+=v(U/M);U>T*c>>1;j+=l)U=v(U/T);return v(j+(T+1)*U/(U+h))}function P(U){var M=[],O=U.length,j,et=0,tt=m,gt=d,_t,ct,bt,vt,Et,re,ue,b,K;for(_t=U.lastIndexOf(g),_t<0&&(_t=0),ct=0;ct<_t;++ct)U.charCodeAt(ct)>=128&&B("not-basic"),M.push(U.charCodeAt(ct));for(bt=_t>0?_t+1:0;bt=O&&B("invalid-input"),ue=Z(U.charCodeAt(bt++)),(ue>=l||ue>v((a-et)/Et))&&B("overflow"),et+=ue*Et,b=re<=gt?u:re>=gt+c?c:re-gt,!(uev(a/K)&&B("overflow"),Et*=K;j=M.length+1,gt=nt(et-vt,j,vt==0),v(et/j)>a-tt&&B("overflow"),tt+=v(et/j),et%=j,M.splice(et++,0,tt)}return I(M)}function C(U){var M,O,j,et,tt,gt,_t,ct,bt,vt,Et,re=[],ue,b,K,Q;for(U=it(U),ue=U.length,M=m,O=0,tt=d,gt=0;gt=M&&Et<_t&&(_t=Et);for(b=j+1,_t-M>v((a-O)/b)&&B("overflow"),O+=(_t-M)*b,M=_t,gt=0;gta&&B("overflow"),Et==M){for(ct=O,bt=l;vt=bt<=tt?u:bt>=tt+c?c:bt-tt,!(ct{if(u&&(typeof u=="object"||typeof u=="function")){if(n)return n.get(u)}else if(i)return i.get(u)},o=(u,c)=>{u&&(typeof u=="object"||typeof u=="function")?(n||(n=new WeakMap),n.set(u,c)):(i||(i=new Map),i.set(u,c))},a=u=>{if(u&&(typeof u=="object"||typeof u=="function")){if(n)return n.has(u)}else if(i)return i.has(u);return!1};return{get:s,set:o,has:a,assert:u=>{if(!a(u))throw new TypeError("Side channel does not contain the given key")}}}t.default=e,(typeof t.default=="object"&&t.default!==null||typeof t.default=="function")&&(Object.assign(t.default,t),r.exports=t.default)}(ml,ml.exports)),ml.exports}var kc,fm;function Cf(){if(fm)return kc;fm=1;var r=String.prototype.replace,t=/%20/g,e={RFC1738:"RFC1738",RFC3986:"RFC3986"};return kc={default:e.RFC3986,formatters:{RFC1738:function(n){return r.call(n,t,"+")},RFC3986:function(n){return String(n)}},RFC1738:e.RFC1738,RFC3986:e.RFC3986},kc}var zc,pm;function S0(){if(pm)return zc;pm=1;var r=Cf(),t=Object.prototype.hasOwnProperty,e=Array.isArray,n=function(){for(var p=[],y=0;y<256;++y)p.push("%"+((y<16?"0":"")+y.toString(16)).toUpperCase());return p}(),i=function(y){for(;y.length>1;){var _=y.pop(),S=_.obj[_.prop];if(e(S)){for(var T=[],v=0;v=u?E.slice(B,B+u):E,$=[],it=0;it=48&&I<=57||I>=65&&I<=90||I>=97&&I<=122||v===r.RFC1738&&(I===40||I===41)){$[$.length]=N.charAt(it);continue}if(I<128){$[$.length]=n[I];continue}if(I<2048){$[$.length]=n[192|I>>6]+n[128|I&63];continue}if(I<55296||I>=57344){$[$.length]=n[224|I>>12]+n[128|I>>6&63]+n[128|I&63];continue}it+=1,I=65536+((I&1023)<<10|N.charCodeAt(it)&1023),$[$.length]=n[240|I>>18]+n[128|I>>12&63]+n[128|I>>6&63]+n[128|I&63]}w+=$.join("")}return w},h=function(y){for(var _=[{obj:{o:y},prop:"o"}],S=[],T=0;T<_.length;++T)for(var v=_[T],E=v.obj[v.prop],w=Object.keys(E),B=0;B"u"&&(U=0)}if(typeof N=="function"?R=N(y,R):R instanceof Date?R=I(R):_==="comma"&&s(R)&&(R=t.maybeMap(R,function(K){return K instanceof Date?I(K):K})),R===null){if(v)return B&&!nt?B(y,c.encoder,P,"key",Z):y;R=""}if(h(R)||t.isBuffer(R)){if(B){var j=nt?y:B(y,c.encoder,P,"key",Z);return[x(j)+"="+x(B(R,c.encoder,P,"value",Z))]}return[x(y)+"="+x(String(R))]}var et=[];if(typeof R>"u")return et;var tt;if(_==="comma"&&s(R))nt&&B&&(R=t.maybeMap(R,B)),tt=[{value:R.length>0?R.join(",")||null:void 0}];else if(s(N))tt=N;else{var gt=Object.keys(R);tt=$?gt.sort($):gt}var _t=w?String(y).replace(/\./g,"%2E"):String(y),ct=S&&s(R)&&R.length===1?_t+"[]":_t;if(T&&s(R)&&R.length===0)return ct+"[]";for(var bt=0;bt"u"?p.encodeDotInKeys===!0?!0:c.allowDots:!!p.allowDots;return{addQueryPrefix:typeof p.addQueryPrefix=="boolean"?p.addQueryPrefix:c.addQueryPrefix,allowDots:E,allowEmptyArrays:typeof p.allowEmptyArrays=="boolean"?!!p.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:v,charset:y,charsetSentinel:typeof p.charsetSentinel=="boolean"?p.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!p.commaRoundTrip,delimiter:typeof p.delimiter>"u"?c.delimiter:p.delimiter,encode:typeof p.encode=="boolean"?p.encode:c.encode,encodeDotInKeys:typeof p.encodeDotInKeys=="boolean"?p.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof p.encoder=="function"?p.encoder:c.encoder,encodeValuesOnly:typeof p.encodeValuesOnly=="boolean"?p.encodeValuesOnly:c.encodeValuesOnly,filter:T,format:_,formatter:S,serializeDate:typeof p.serializeDate=="function"?p.serializeDate:c.serializeDate,skipNulls:typeof p.skipNulls=="boolean"?p.skipNulls:c.skipNulls,sort:typeof p.sort=="function"?p.sort:null,strictNullHandling:typeof p.strictNullHandling=="boolean"?p.strictNullHandling:c.strictNullHandling}};return Vc=function(g,p){var y=g,_=m(p),S,T;typeof _.filter=="function"?(T=_.filter,y=T("",y)):s(_.filter)&&(T=_.filter,S=T);var v=[];if(typeof y!="object"||y===null)return"";var E=i[_.arrayFormat],w=E==="comma"&&_.commaRoundTrip;S||(S=Object.keys(y)),_.sort&&S.sort(_.sort);for(var B=r(),N=0;N0?Z+I:""},Vc}var jc,gm;function V1(){if(gm)return jc;gm=1;var r=S0(),t=Object.prototype.hasOwnProperty,e=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,throwOnLimitExceeded:!1},i=function(f){return f.replace(/&#(\d+);/g,function(d,m){return String.fromCharCode(parseInt(m,10))})},s=function(f,d,m){if(f&&typeof f=="string"&&d.comma&&f.indexOf(",")>-1)return f.split(",");if(d.throwOnLimitExceeded&&m>=d.arrayLimit)throw new RangeError("Array limit exceeded. Only "+d.arrayLimit+" element"+(d.arrayLimit===1?"":"s")+" allowed in an array.");return f},o="utf8=%26%2310003%3B",a="utf8=%E2%9C%93",l=function(d,m){var g={__proto__:null},p=m.ignoreQueryPrefix?d.replace(/^\?/,""):d;p=p.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var y=m.parameterLimit===1/0?void 0:m.parameterLimit,_=p.split(m.delimiter,m.throwOnLimitExceeded?y+1:y);if(m.throwOnLimitExceeded&&_.length>y)throw new RangeError("Parameter limit exceeded. Only "+y+" parameter"+(y===1?"":"s")+" allowed.");var S=-1,T,v=m.charset;if(m.charsetSentinel)for(T=0;T<_.length;++T)_[T].indexOf("utf8=")===0&&(_[T]===a?v="utf-8":_[T]===o&&(v="iso-8859-1"),S=T,T=_.length);for(T=0;T<_.length;++T)if(T!==S){var E=_[T],w=E.indexOf("]="),B=w===-1?E.indexOf("="):w+1,N,$;B===-1?(N=m.decoder(E,n.decoder,v,"key"),$=m.strictNullHandling?null:""):(N=m.decoder(E.slice(0,B),n.decoder,v,"key"),$=r.maybeMap(s(E.slice(B+1),m,e(g[N])?g[N].length:0),function(I){return m.decoder(I,n.decoder,v,"value")})),$&&m.interpretNumericEntities&&v==="iso-8859-1"&&($=i(String($))),E.indexOf("[]=")>-1&&($=e($)?[$]:$);var it=t.call(g,N);it&&m.duplicates==="combine"?g[N]=r.combine(g[N],$):(!it||m.duplicates==="last")&&(g[N]=$)}return g},u=function(f,d,m,g){var p=0;if(f.length>0&&f[f.length-1]==="[]"){var y=f.slice(0,-1).join("");p=Array.isArray(d)&&d[y]?d[y].length:0}for(var _=g?d:s(d,m,p),S=f.length-1;S>=0;--S){var T,v=f[S];if(v==="[]"&&m.parseArrays)T=m.allowEmptyArrays&&(_===""||m.strictNullHandling&&_===null)?[]:r.combine([],_);else{T=m.plainObjects?{__proto__:null}:{};var E=v.charAt(0)==="["&&v.charAt(v.length-1)==="]"?v.slice(1,-1):v,w=m.decodeDotInKeys?E.replace(/%2E/g,"."):E,B=parseInt(w,10);!m.parseArrays&&w===""?T={0:_}:!isNaN(B)&&v!==w&&String(B)===w&&B>=0&&m.parseArrays&&B<=m.arrayLimit?(T=[],T[B]=_):w!=="__proto__"&&(T[w]=_)}_=T}return _},c=function(d,m,g,p){if(d){var y=g.allowDots?d.replace(/\.([^.[]+)/g,"[$1]"):d,_=/(\[[^[\]]*])/,S=/(\[[^[\]]*])/g,T=g.depth>0&&_.exec(y),v=T?y.slice(0,T.index):y,E=[];if(v){if(!g.plainObjects&&t.call(Object.prototype,v)&&!g.allowPrototypes)return;E.push(v)}for(var w=0;g.depth>0&&(T=S.exec(y))!==null&&w"u"?n.charset:d.charset,g=typeof d.duplicates>"u"?n.duplicates:d.duplicates;if(g!=="combine"&&g!=="first"&&g!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var p=typeof d.allowDots>"u"?d.decodeDotInKeys===!0?!0:n.allowDots:!!d.allowDots;return{allowDots:p,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof d.allowPrototypes=="boolean"?d.allowPrototypes:n.allowPrototypes,allowSparse:typeof d.allowSparse=="boolean"?d.allowSparse:n.allowSparse,arrayLimit:typeof d.arrayLimit=="number"?d.arrayLimit:n.arrayLimit,charset:m,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:n.charsetSentinel,comma:typeof d.comma=="boolean"?d.comma:n.comma,decodeDotInKeys:typeof d.decodeDotInKeys=="boolean"?d.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof d.decoder=="function"?d.decoder:n.decoder,delimiter:typeof d.delimiter=="string"||r.isRegExp(d.delimiter)?d.delimiter:n.delimiter,depth:typeof d.depth=="number"||d.depth===!1?+d.depth:n.depth,duplicates:g,ignoreQueryPrefix:d.ignoreQueryPrefix===!0,interpretNumericEntities:typeof d.interpretNumericEntities=="boolean"?d.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof d.parameterLimit=="number"?d.parameterLimit:n.parameterLimit,parseArrays:d.parseArrays!==!1,plainObjects:typeof d.plainObjects=="boolean"?d.plainObjects:n.plainObjects,strictDepth:typeof d.strictDepth=="boolean"?!!d.strictDepth:n.strictDepth,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:n.strictNullHandling,throwOnLimitExceeded:typeof d.throwOnLimitExceeded=="boolean"?d.throwOnLimitExceeded:!1}};return jc=function(f,d){var m=h(d);if(f===""||f===null||typeof f>"u")return m.plainObjects?{__proto__:null}:{};for(var g=typeof f=="string"?l(f,m):f,p=m.plainObjects?{__proto__:null}:{},y=Object.keys(g),_=0;_",'"',"`"," ","\r",` -`," "],o=["{","}","|","\\","^","`"].concat(s),a=["'"].concat(o),l=["%","/","?",";","#"].concat(a),u=["/","?","#"],c=255,h=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},p=j1();function y(v,E,w){if(v&&typeof v=="object"&&v instanceof t)return v;var B=new t;return B.parse(v,E,w),B}t.prototype.parse=function(v,E,w){if(typeof v!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof v);var B=v.indexOf("?"),N=B!==-1&&B127?gt+="x":gt+=tt[_t];if(!gt.match(h)){var bt=j.slice(0,R),vt=j.slice(R+1),Et=tt.match(f);Et&&(bt.push(Et[1]),vt.unshift(Et[2])),vt.length&&(I="/"+vt.join(".")+I),this.hostname=bt.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=r.toASCII(this.hostname));var re=this.port?":"+this.port:"",ue=this.hostname||"";this.host=ue+re,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),I[0]!=="/"&&(I="/"+I))}if(!d[nt])for(var R=0,et=a.length;R0?w.host.split("@"):!1;gt&&(w.auth=gt.shift(),w.hostname=gt.shift(),w.host=w.hostname)}return w.search=v.search,w.query=v.query,(w.pathname!==null||w.search!==null)&&(w.path=(w.pathname?w.pathname:"")+(w.search?w.search:"")),w.href=w.format(),w}if(!j.length)return w.pathname=null,w.search?w.path="/"+w.search:w.path=null,w.href=w.format(),w;for(var _t=j.slice(-1)[0],ct=(w.host||v.host||j.length>1)&&(_t==="."||_t==="..")||_t==="",bt=0,vt=j.length;vt>=0;vt--)_t=j[vt],_t==="."?j.splice(vt,1):_t===".."?(j.splice(vt,1),bt++):bt&&(j.splice(vt,1),bt--);if(!M&&!O)for(;bt--;bt)j.unshift("..");M&&j[0]!==""&&(!j[0]||j[0].charAt(0)!=="/")&&j.unshift(""),ct&&j.join("/").substr(-1)!=="/"&&j.push("");var Et=j[0]===""||j[0]&&j[0].charAt(0)==="/";if(tt){w.hostname=Et?"":j.length?j.shift():"",w.host=w.hostname;var gt=w.host&&w.host.indexOf("@")>0?w.host.split("@"):!1;gt&&(w.auth=gt.shift(),w.hostname=gt.shift(),w.host=w.hostname)}return M=M||w.host&&j.length,M&&!Et&&j.unshift(""),j.length>0?w.pathname=j.join("/"):(w.pathname=null,w.path=null),(w.pathname!==null||w.search!==null)&&(w.path=(w.pathname?w.pathname:"")+(w.search?w.search:"")),w.auth=v.auth||w.auth,w.slashes=w.slashes||v.slashes,w.href=w.format(),w},t.prototype.parseHost=function(){var v=this.host,E=n.exec(v);E&&(E=E[0],E!==":"&&(this.port=E.substr(1)),v=v.substr(0,v.length-E.length)),v&&(this.hostname=v)},Hi.parse=y,Hi.resolve=S,Hi.resolveObject=T,Hi.format=_,Hi.Url=t,Hi}var Gc=$1();/*! + */var C1={createCanvas:function(r,t){var e=document.createElement("canvas");return e.width=r,e.height=t,e},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,t){return fetch(r,t)}},Nc=/iPhone/i,Kp=/iPod/i,Jp=/iPad/i,tm=/\biOS-universal(?:.+)Mac\b/i,Bc=/\bAndroid(?:.+)Mobile\b/i,em=/Android/i,ks=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,fl=/Silk/i,qn=/Windows Phone/i,rm=/\bWindows(?:.+)ARM\b/i,nm=/BlackBerry/i,im=/BB10/i,sm=/Opera Mini/i,om=/\b(CriOS|Chrome)(?:.+)Mobile/i,am=/Mobile(?:.+)Firefox\b/i,lm=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function O1(r){return function(t){return t.test(r)}}function P1(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,n=e.split("[FBAN");typeof n[1]<"u"&&(e=n[0]),n=e.split("Twitter"),typeof n[1]<"u"&&(e=n[0]);var i=O1(e),s={apple:{phone:i(Nc)&&!i(qn),ipod:i(Kp),tablet:!i(Nc)&&(i(Jp)||lm(t))&&!i(qn),universal:i(tm),device:(i(Nc)||i(Kp)||i(Jp)||i(tm)||lm(t))&&!i(qn)},amazon:{phone:i(ks),tablet:!i(ks)&&i(fl),device:i(ks)||i(fl)},android:{phone:!i(qn)&&i(ks)||!i(qn)&&i(Bc),tablet:!i(qn)&&!i(ks)&&!i(Bc)&&(i(fl)||i(em)),device:!i(qn)&&(i(ks)||i(fl)||i(Bc)||i(em))||i(/\bokhttp\b/i)},windows:{phone:i(qn),tablet:i(rm),device:i(qn)||i(rm)},other:{blackberry:i(nm),blackberry10:i(im),opera:i(sm),firefox:i(am),chrome:i(om),device:i(nm)||i(im)||i(sm)||i(am)||i(om)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}var ms=P1(globalThis.navigator);function R1(){return!ms.apple.device}function F1(r){var t=!0;if(ms.tablet||ms.phone){if(ms.apple.device){var e=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(e){var n=parseInt(e[1],10);n<11&&(t=!1)}}if(ms.android.device){var e=navigator.userAgent.match(/Android\s([0-9.]*)/);if(e){var n=parseInt(e[1],10);n<7&&(t=!1)}}}return t?r:4}var At={ADAPTER:C1,MIPMAP_TEXTURES:Un.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:Ve.NONE,SPRITE_MAX_TEXTURES:F1(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:nu.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:ru.CLAMP,SCALE_MODE:Pr.LINEAR,PRECISION_VERTEX:Rr.HIGH,PRECISION_FRAGMENT:ms.apple.device?Rr.HIGH:Rr.MEDIUM,CAN_UPLOAD_SAME_BUFFER:R1(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},Uc={exports:{}},um;function D1(){return um||(um=1,function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function s(l,u,c,h,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new i(c,h||l,f),m=e?e+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],d]:l._events[m].push(d):(l._events[m]=d,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var f=0,d=h.length,m=new Array(d);f80*R){j=tt=P[0],et=gt=P[1];for(var vt=R;vttt&&(tt=_t),ct>gt&&(gt=ct);bt=Math.max(tt-j,gt-et),bt=bt!==0?32767/bt:0}return n(M,O,R,j,et,bt,0),O}function t(P,C,R,z,U){var M,O;if(U===nt(P,C,R,z)>0)for(M=C;M=C;M-=z)O=I(M,P[M],P[M+1],O);return O&&T(O,O.next)&&(Z(O),O=O.next),O}function e(P,C){if(!P)return P;C||(C=P);var R=P,z;do if(z=!1,!R.steiner&&(T(R,R.next)||S(R.prev,R,R.next)===0)){if(Z(R),R=C=R.prev,R===R.next)break;z=!0}else R=R.next;while(z||R!==C);return C}function n(P,C,R,z,U,M,O){if(P){!O&&M&&d(P,z,U,M);for(var j=P,et,tt;P.prev!==P.next;){if(et=P.prev,tt=P.next,M?s(P,z,U,M):i(P)){C.push(et.i/R|0),C.push(P.i/R|0),C.push(tt.i/R|0),Z(P),P=tt.next,j=tt.next;continue}if(P=tt,P===j){O?O===1?(P=o(e(P),C,R),n(P,C,R,z,U,M,2)):O===2&&a(P,C,R,z,U,M):n(e(P),C,R,z,U,M,1);break}}}}function i(P){var C=P.prev,R=P,z=P.next;if(S(C,R,z)>=0)return!1;for(var U=C.x,M=R.x,O=z.x,j=C.y,et=R.y,tt=z.y,gt=UM?U>O?U:O:M>O?M:O,bt=j>et?j>tt?j:tt:et>tt?et:tt,vt=z.next;vt!==C;){if(vt.x>=gt&&vt.x<=ct&&vt.y>=_t&&vt.y<=bt&&y(U,j,M,et,O,tt,vt.x,vt.y)&&S(vt.prev,vt,vt.next)>=0)return!1;vt=vt.next}return!0}function s(P,C,R,z){var U=P.prev,M=P,O=P.next;if(S(U,M,O)>=0)return!1;for(var j=U.x,et=M.x,tt=O.x,gt=U.y,_t=M.y,ct=O.y,bt=jet?j>tt?j:tt:et>tt?et:tt,re=gt>_t?gt>ct?gt:ct:_t>ct?_t:ct,ue=g(bt,vt,C,R,z),b=g(Et,re,C,R,z),K=P.prevZ,Q=P.nextZ;K&&K.z>=ue&&Q&&Q.z<=b;){if(K.x>=bt&&K.x<=Et&&K.y>=vt&&K.y<=re&&K!==U&&K!==O&&y(j,gt,et,_t,tt,ct,K.x,K.y)&&S(K.prev,K,K.next)>=0||(K=K.prevZ,Q.x>=bt&&Q.x<=Et&&Q.y>=vt&&Q.y<=re&&Q!==U&&Q!==O&&y(j,gt,et,_t,tt,ct,Q.x,Q.y)&&S(Q.prev,Q,Q.next)>=0))return!1;Q=Q.nextZ}for(;K&&K.z>=ue;){if(K.x>=bt&&K.x<=Et&&K.y>=vt&&K.y<=re&&K!==U&&K!==O&&y(j,gt,et,_t,tt,ct,K.x,K.y)&&S(K.prev,K,K.next)>=0)return!1;K=K.prevZ}for(;Q&&Q.z<=b;){if(Q.x>=bt&&Q.x<=Et&&Q.y>=vt&&Q.y<=re&&Q!==U&&Q!==O&&y(j,gt,et,_t,tt,ct,Q.x,Q.y)&&S(Q.prev,Q,Q.next)>=0)return!1;Q=Q.nextZ}return!0}function o(P,C,R){var z=P;do{var U=z.prev,M=z.next.next;!T(U,M)&&v(U,z,z.next,M)&&L(U,M)&&L(M,U)&&(C.push(U.i/R|0),C.push(z.i/R|0),C.push(M.i/R|0),Z(z),Z(z.next),z=P=M),z=z.next}while(z!==P);return e(z)}function a(P,C,R,z,U,M){var O=P;do{for(var j=O.next.next;j!==O.prev;){if(O.i!==j.i&&_(O,j)){var et=it(O,j);O=e(O,O.next),et=e(et,et.next),n(O,C,R,z,U,M,0),n(et,C,R,z,U,M,0);return}j=j.next}O=O.next}while(O!==P)}function l(P,C,R,z){var U=[],M,O,j,et,tt;for(M=0,O=C.length;M=R.next.y&&R.next.y!==R.y){var j=R.x+(U-R.y)*(R.next.x-R.x)/(R.next.y-R.y);if(j<=z&&j>M&&(M=j,O=R.x=R.x&&R.x>=tt&&z!==R.x&&y(UO.x||R.x===O.x&&f(O,R)))&&(O=R,_t=ct)),R=R.next;while(R!==et);return O}function f(P,C){return S(P.prev,P,C.prev)<0&&S(C.next,P,P.next)<0}function d(P,C,R,z){var U=P;do U.z===0&&(U.z=g(U.x,U.y,C,R,z)),U.prevZ=U.prev,U.nextZ=U.next,U=U.next;while(U!==P);U.prevZ.nextZ=null,U.prevZ=null,m(U)}function m(P){var C,R,z,U,M,O,j,et,tt=1;do{for(R=P,P=null,M=null,O=0;R;){for(O++,z=R,j=0,C=0;C0||et>0&&z;)j!==0&&(et===0||!z||R.z<=z.z)?(U=R,R=R.nextZ,j--):(U=z,z=z.nextZ,et--),M?M.nextZ=U:P=U,U.prevZ=M,M=U;R=z}M.nextZ=null,tt*=2}while(O>1);return P}function g(P,C,R,z,U){return P=(P-R)*U|0,C=(C-z)*U|0,P=(P|P<<8)&16711935,P=(P|P<<4)&252645135,P=(P|P<<2)&858993459,P=(P|P<<1)&1431655765,C=(C|C<<8)&16711935,C=(C|C<<4)&252645135,C=(C|C<<2)&858993459,C=(C|C<<1)&1431655765,P|C<<1}function p(P){var C=P,R=P;do(C.x=(P-O)*(M-j)&&(P-O)*(z-j)>=(R-O)*(C-j)&&(R-O)*(M-j)>=(U-O)*(z-j)}function _(P,C){return P.next.i!==C.i&&P.prev.i!==C.i&&!B(P,C)&&(L(P,C)&&L(C,P)&&$(P,C)&&(S(P.prev,P,C.prev)||S(P,C.prev,C))||T(P,C)&&S(P.prev,P,P.next)>0&&S(C.prev,C,C.next)>0)}function S(P,C,R){return(C.y-P.y)*(R.x-C.x)-(C.x-P.x)*(R.y-C.y)}function T(P,C){return P.x===C.x&&P.y===C.y}function v(P,C,R,z){var U=w(S(P,C,R)),M=w(S(P,C,z)),O=w(S(R,z,P)),j=w(S(R,z,C));return!!(U!==M&&O!==j||U===0&&E(P,R,C)||M===0&&E(P,z,C)||O===0&&E(R,P,z)||j===0&&E(R,C,z))}function E(P,C,R){return C.x<=Math.max(P.x,R.x)&&C.x>=Math.min(P.x,R.x)&&C.y<=Math.max(P.y,R.y)&&C.y>=Math.min(P.y,R.y)}function w(P){return P>0?1:P<0?-1:0}function B(P,C){var R=P;do{if(R.i!==P.i&&R.next.i!==P.i&&R.i!==C.i&&R.next.i!==C.i&&v(R,R.next,P,C))return!0;R=R.next}while(R!==P);return!1}function L(P,C){return S(P.prev,P,P.next)<0?S(P,C,P.next)>=0&&S(P,P.prev,C)>=0:S(P,C,P.prev)<0||S(P,P.next,C)<0}function $(P,C){var R=P,z=!1,U=(P.x+C.x)/2,M=(P.y+C.y)/2;do R.y>M!=R.next.y>M&&R.next.y!==R.y&&U<(R.next.x-R.x)*(M-R.y)/(R.next.y-R.y)+R.x&&(z=!z),R=R.next;while(R!==P);return z}function it(P,C){var R=new x(P.i,P.x,P.y),z=new x(C.i,C.x,C.y),U=P.next,M=C.prev;return P.next=C,C.prev=P,R.next=U,U.prev=R,z.next=R,R.prev=z,M.next=z,z.prev=M,z}function I(P,C,R,z){var U=new x(P,C,R);return z?(U.next=z.next,U.prev=z,z.next.prev=U,z.next=U):(U.prev=U,U.next=U),U}function Z(P){P.next.prev=P.prev,P.prev.next=P.next,P.prevZ&&(P.prevZ.nextZ=P.nextZ),P.nextZ&&(P.nextZ.prevZ=P.prevZ)}function x(P,C,R){this.i=P,this.x=C,this.y=R,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(P,C,R,z){var U=C&&C.length,M=U?C[0]*R:P.length,O=Math.abs(nt(P,0,M,R));if(U)for(var j=0,et=C.length;j0&&(z+=P[U-1].length,R.holes.push(z))}return R},pl.exports}N1();var Hi={},aa={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var B1=aa.exports,hm;function U1(){return hm||(hm=1,function(r,t){(function(e){var n=t&&!t.nodeType&&t,i=r&&!r.nodeType&&r,s=typeof Dn=="object"&&Dn;(s.global===s||s.window===s||s.self===s)&&(e=s);var o,a=2147483647,l=36,u=1,c=26,h=38,f=700,d=72,m=128,g="-",p=/^xn--/,y=/[^\x20-\x7E]/,_=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=l-u,v=Math.floor,E=String.fromCharCode,w;function B(U){throw new RangeError(S[U])}function L(U,M){for(var O=U.length,j=[];O--;)j[O]=M(U[O]);return j}function $(U,M){var O=U.split("@"),j="";O.length>1&&(j=O[0]+"@",U=O[1]),U=U.replace(_,".");var et=U.split("."),tt=L(et,M).join(".");return j+tt}function it(U){for(var M=[],O=0,j=U.length,et,tt;O=55296&&et<=56319&&O65535&&(M-=65536,O+=E(M>>>10&1023|55296),M=56320|M&1023),O+=E(M),O}).join("")}function Z(U){return U-48<10?U-22:U-65<26?U-65:U-97<26?U-97:l}function x(U,M){return U+22+75*(U<26)-((M!=0)<<5)}function nt(U,M,O){var j=0;for(U=O?v(U/f):U>>1,U+=v(U/M);U>T*c>>1;j+=l)U=v(U/T);return v(j+(T+1)*U/(U+h))}function P(U){var M=[],O=U.length,j,et=0,tt=m,gt=d,_t,ct,bt,vt,Et,re,ue,b,K;for(_t=U.lastIndexOf(g),_t<0&&(_t=0),ct=0;ct<_t;++ct)U.charCodeAt(ct)>=128&&B("not-basic"),M.push(U.charCodeAt(ct));for(bt=_t>0?_t+1:0;bt=O&&B("invalid-input"),ue=Z(U.charCodeAt(bt++)),(ue>=l||ue>v((a-et)/Et))&&B("overflow"),et+=ue*Et,b=re<=gt?u:re>=gt+c?c:re-gt,!(uev(a/K)&&B("overflow"),Et*=K;j=M.length+1,gt=nt(et-vt,j,vt==0),v(et/j)>a-tt&&B("overflow"),tt+=v(et/j),et%=j,M.splice(et++,0,tt)}return I(M)}function C(U){var M,O,j,et,tt,gt,_t,ct,bt,vt,Et,re=[],ue,b,K,Q;for(U=it(U),ue=U.length,M=m,O=0,tt=d,gt=0;gt=M&&Et<_t&&(_t=Et);for(b=j+1,_t-M>v((a-O)/b)&&B("overflow"),O+=(_t-M)*b,M=_t,gt=0;gta&&B("overflow"),Et==M){for(ct=O,bt=l;vt=bt<=tt?u:bt>=tt+c?c:bt-tt,!(ct{if(u&&(typeof u=="object"||typeof u=="function")){if(n)return n.get(u)}else if(i)return i.get(u)},o=(u,c)=>{u&&(typeof u=="object"||typeof u=="function")?(n||(n=new WeakMap),n.set(u,c)):(i||(i=new Map),i.set(u,c))},a=u=>{if(u&&(typeof u=="object"||typeof u=="function")){if(n)return n.has(u)}else if(i)return i.has(u);return!1};return{get:s,set:o,has:a,assert:u=>{if(!a(u))throw new TypeError("Side channel does not contain the given key")}}}t.default=e,(typeof t.default=="object"&&t.default!==null||typeof t.default=="function")&&(Object.assign(t.default,t),r.exports=t.default)}(ml,ml.exports)),ml.exports}var kc,fm;function Cf(){if(fm)return kc;fm=1;var r=String.prototype.replace,t=/%20/g,e={RFC1738:"RFC1738",RFC3986:"RFC3986"};return kc={default:e.RFC3986,formatters:{RFC1738:function(n){return r.call(n,t,"+")},RFC3986:function(n){return String(n)}},RFC1738:e.RFC1738,RFC3986:e.RFC3986},kc}var zc,pm;function S0(){if(pm)return zc;pm=1;var r=Cf(),t=Object.prototype.hasOwnProperty,e=Array.isArray,n=function(){for(var p=[],y=0;y<256;++y)p.push("%"+((y<16?"0":"")+y.toString(16)).toUpperCase());return p}(),i=function(y){for(;y.length>1;){var _=y.pop(),S=_.obj[_.prop];if(e(S)){for(var T=[],v=0;v=u?E.slice(B,B+u):E,$=[],it=0;it=48&&I<=57||I>=65&&I<=90||I>=97&&I<=122||v===r.RFC1738&&(I===40||I===41)){$[$.length]=L.charAt(it);continue}if(I<128){$[$.length]=n[I];continue}if(I<2048){$[$.length]=n[192|I>>6]+n[128|I&63];continue}if(I<55296||I>=57344){$[$.length]=n[224|I>>12]+n[128|I>>6&63]+n[128|I&63];continue}it+=1,I=65536+((I&1023)<<10|L.charCodeAt(it)&1023),$[$.length]=n[240|I>>18]+n[128|I>>12&63]+n[128|I>>6&63]+n[128|I&63]}w+=$.join("")}return w},h=function(y){for(var _=[{obj:{o:y},prop:"o"}],S=[],T=0;T<_.length;++T)for(var v=_[T],E=v.obj[v.prop],w=Object.keys(E),B=0;B"u"&&(U=0)}if(typeof L=="function"?R=L(y,R):R instanceof Date?R=I(R):_==="comma"&&s(R)&&(R=t.maybeMap(R,function(K){return K instanceof Date?I(K):K})),R===null){if(v)return B&&!nt?B(y,c.encoder,P,"key",Z):y;R=""}if(h(R)||t.isBuffer(R)){if(B){var j=nt?y:B(y,c.encoder,P,"key",Z);return[x(j)+"="+x(B(R,c.encoder,P,"value",Z))]}return[x(y)+"="+x(String(R))]}var et=[];if(typeof R>"u")return et;var tt;if(_==="comma"&&s(R))nt&&B&&(R=t.maybeMap(R,B)),tt=[{value:R.length>0?R.join(",")||null:void 0}];else if(s(L))tt=L;else{var gt=Object.keys(R);tt=$?gt.sort($):gt}var _t=w?String(y).replace(/\./g,"%2E"):String(y),ct=S&&s(R)&&R.length===1?_t+"[]":_t;if(T&&s(R)&&R.length===0)return ct+"[]";for(var bt=0;bt"u"?p.encodeDotInKeys===!0?!0:c.allowDots:!!p.allowDots;return{addQueryPrefix:typeof p.addQueryPrefix=="boolean"?p.addQueryPrefix:c.addQueryPrefix,allowDots:E,allowEmptyArrays:typeof p.allowEmptyArrays=="boolean"?!!p.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:v,charset:y,charsetSentinel:typeof p.charsetSentinel=="boolean"?p.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!p.commaRoundTrip,delimiter:typeof p.delimiter>"u"?c.delimiter:p.delimiter,encode:typeof p.encode=="boolean"?p.encode:c.encode,encodeDotInKeys:typeof p.encodeDotInKeys=="boolean"?p.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof p.encoder=="function"?p.encoder:c.encoder,encodeValuesOnly:typeof p.encodeValuesOnly=="boolean"?p.encodeValuesOnly:c.encodeValuesOnly,filter:T,format:_,formatter:S,serializeDate:typeof p.serializeDate=="function"?p.serializeDate:c.serializeDate,skipNulls:typeof p.skipNulls=="boolean"?p.skipNulls:c.skipNulls,sort:typeof p.sort=="function"?p.sort:null,strictNullHandling:typeof p.strictNullHandling=="boolean"?p.strictNullHandling:c.strictNullHandling}};return Vc=function(g,p){var y=g,_=m(p),S,T;typeof _.filter=="function"?(T=_.filter,y=T("",y)):s(_.filter)&&(T=_.filter,S=T);var v=[];if(typeof y!="object"||y===null)return"";var E=i[_.arrayFormat],w=E==="comma"&&_.commaRoundTrip;S||(S=Object.keys(y)),_.sort&&S.sort(_.sort);for(var B=r(),L=0;L0?Z+I:""},Vc}var jc,gm;function V1(){if(gm)return jc;gm=1;var r=S0(),t=Object.prototype.hasOwnProperty,e=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,throwOnLimitExceeded:!1},i=function(f){return f.replace(/&#(\d+);/g,function(d,m){return String.fromCharCode(parseInt(m,10))})},s=function(f,d,m){if(f&&typeof f=="string"&&d.comma&&f.indexOf(",")>-1)return f.split(",");if(d.throwOnLimitExceeded&&m>=d.arrayLimit)throw new RangeError("Array limit exceeded. Only "+d.arrayLimit+" element"+(d.arrayLimit===1?"":"s")+" allowed in an array.");return f},o="utf8=%26%2310003%3B",a="utf8=%E2%9C%93",l=function(d,m){var g={__proto__:null},p=m.ignoreQueryPrefix?d.replace(/^\?/,""):d;p=p.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var y=m.parameterLimit===1/0?void 0:m.parameterLimit,_=p.split(m.delimiter,m.throwOnLimitExceeded?y+1:y);if(m.throwOnLimitExceeded&&_.length>y)throw new RangeError("Parameter limit exceeded. Only "+y+" parameter"+(y===1?"":"s")+" allowed.");var S=-1,T,v=m.charset;if(m.charsetSentinel)for(T=0;T<_.length;++T)_[T].indexOf("utf8=")===0&&(_[T]===a?v="utf-8":_[T]===o&&(v="iso-8859-1"),S=T,T=_.length);for(T=0;T<_.length;++T)if(T!==S){var E=_[T],w=E.indexOf("]="),B=w===-1?E.indexOf("="):w+1,L,$;B===-1?(L=m.decoder(E,n.decoder,v,"key"),$=m.strictNullHandling?null:""):(L=m.decoder(E.slice(0,B),n.decoder,v,"key"),$=r.maybeMap(s(E.slice(B+1),m,e(g[L])?g[L].length:0),function(I){return m.decoder(I,n.decoder,v,"value")})),$&&m.interpretNumericEntities&&v==="iso-8859-1"&&($=i(String($))),E.indexOf("[]=")>-1&&($=e($)?[$]:$);var it=t.call(g,L);it&&m.duplicates==="combine"?g[L]=r.combine(g[L],$):(!it||m.duplicates==="last")&&(g[L]=$)}return g},u=function(f,d,m,g){var p=0;if(f.length>0&&f[f.length-1]==="[]"){var y=f.slice(0,-1).join("");p=Array.isArray(d)&&d[y]?d[y].length:0}for(var _=g?d:s(d,m,p),S=f.length-1;S>=0;--S){var T,v=f[S];if(v==="[]"&&m.parseArrays)T=m.allowEmptyArrays&&(_===""||m.strictNullHandling&&_===null)?[]:r.combine([],_);else{T=m.plainObjects?{__proto__:null}:{};var E=v.charAt(0)==="["&&v.charAt(v.length-1)==="]"?v.slice(1,-1):v,w=m.decodeDotInKeys?E.replace(/%2E/g,"."):E,B=parseInt(w,10);!m.parseArrays&&w===""?T={0:_}:!isNaN(B)&&v!==w&&String(B)===w&&B>=0&&m.parseArrays&&B<=m.arrayLimit?(T=[],T[B]=_):w!=="__proto__"&&(T[w]=_)}_=T}return _},c=function(d,m,g,p){if(d){var y=g.allowDots?d.replace(/\.([^.[]+)/g,"[$1]"):d,_=/(\[[^[\]]*])/,S=/(\[[^[\]]*])/g,T=g.depth>0&&_.exec(y),v=T?y.slice(0,T.index):y,E=[];if(v){if(!g.plainObjects&&t.call(Object.prototype,v)&&!g.allowPrototypes)return;E.push(v)}for(var w=0;g.depth>0&&(T=S.exec(y))!==null&&w"u"?n.charset:d.charset,g=typeof d.duplicates>"u"?n.duplicates:d.duplicates;if(g!=="combine"&&g!=="first"&&g!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var p=typeof d.allowDots>"u"?d.decodeDotInKeys===!0?!0:n.allowDots:!!d.allowDots;return{allowDots:p,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof d.allowPrototypes=="boolean"?d.allowPrototypes:n.allowPrototypes,allowSparse:typeof d.allowSparse=="boolean"?d.allowSparse:n.allowSparse,arrayLimit:typeof d.arrayLimit=="number"?d.arrayLimit:n.arrayLimit,charset:m,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:n.charsetSentinel,comma:typeof d.comma=="boolean"?d.comma:n.comma,decodeDotInKeys:typeof d.decodeDotInKeys=="boolean"?d.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof d.decoder=="function"?d.decoder:n.decoder,delimiter:typeof d.delimiter=="string"||r.isRegExp(d.delimiter)?d.delimiter:n.delimiter,depth:typeof d.depth=="number"||d.depth===!1?+d.depth:n.depth,duplicates:g,ignoreQueryPrefix:d.ignoreQueryPrefix===!0,interpretNumericEntities:typeof d.interpretNumericEntities=="boolean"?d.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof d.parameterLimit=="number"?d.parameterLimit:n.parameterLimit,parseArrays:d.parseArrays!==!1,plainObjects:typeof d.plainObjects=="boolean"?d.plainObjects:n.plainObjects,strictDepth:typeof d.strictDepth=="boolean"?!!d.strictDepth:n.strictDepth,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:n.strictNullHandling,throwOnLimitExceeded:typeof d.throwOnLimitExceeded=="boolean"?d.throwOnLimitExceeded:!1}};return jc=function(f,d){var m=h(d);if(f===""||f===null||typeof f>"u")return m.plainObjects?{__proto__:null}:{};for(var g=typeof f=="string"?l(f,m):f,p=m.plainObjects?{__proto__:null}:{},y=Object.keys(g),_=0;_",'"',"`"," ","\r",` +`," "],o=["{","}","|","\\","^","`"].concat(s),a=["'"].concat(o),l=["%","/","?",";","#"].concat(a),u=["/","?","#"],c=255,h=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},p=j1();function y(v,E,w){if(v&&typeof v=="object"&&v instanceof t)return v;var B=new t;return B.parse(v,E,w),B}t.prototype.parse=function(v,E,w){if(typeof v!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof v);var B=v.indexOf("?"),L=B!==-1&&B127?gt+="x":gt+=tt[_t];if(!gt.match(h)){var bt=j.slice(0,R),vt=j.slice(R+1),Et=tt.match(f);Et&&(bt.push(Et[1]),vt.unshift(Et[2])),vt.length&&(I="/"+vt.join(".")+I),this.hostname=bt.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=r.toASCII(this.hostname));var re=this.port?":"+this.port:"",ue=this.hostname||"";this.host=ue+re,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),I[0]!=="/"&&(I="/"+I))}if(!d[nt])for(var R=0,et=a.length;R0?w.host.split("@"):!1;gt&&(w.auth=gt.shift(),w.hostname=gt.shift(),w.host=w.hostname)}return w.search=v.search,w.query=v.query,(w.pathname!==null||w.search!==null)&&(w.path=(w.pathname?w.pathname:"")+(w.search?w.search:"")),w.href=w.format(),w}if(!j.length)return w.pathname=null,w.search?w.path="/"+w.search:w.path=null,w.href=w.format(),w;for(var _t=j.slice(-1)[0],ct=(w.host||v.host||j.length>1)&&(_t==="."||_t==="..")||_t==="",bt=0,vt=j.length;vt>=0;vt--)_t=j[vt],_t==="."?j.splice(vt,1):_t===".."?(j.splice(vt,1),bt++):bt&&(j.splice(vt,1),bt--);if(!M&&!O)for(;bt--;bt)j.unshift("..");M&&j[0]!==""&&(!j[0]||j[0].charAt(0)!=="/")&&j.unshift(""),ct&&j.join("/").substr(-1)!=="/"&&j.push("");var Et=j[0]===""||j[0]&&j[0].charAt(0)==="/";if(tt){w.hostname=Et?"":j.length?j.shift():"",w.host=w.hostname;var gt=w.host&&w.host.indexOf("@")>0?w.host.split("@"):!1;gt&&(w.auth=gt.shift(),w.hostname=gt.shift(),w.host=w.hostname)}return M=M||w.host&&j.length,M&&!Et&&j.unshift(""),j.length>0?w.pathname=j.join("/"):(w.pathname=null,w.path=null),(w.pathname!==null||w.search!==null)&&(w.path=(w.pathname?w.pathname:"")+(w.search?w.search:"")),w.auth=v.auth||w.auth,w.slashes=w.slashes||v.slashes,w.href=w.format(),w},t.prototype.parseHost=function(){var v=this.host,E=n.exec(v);E&&(E=E[0],E!==":"&&(this.port=E.substr(1)),v=v.substr(0,v.length-E.length)),v&&(this.hostname=v)},Hi.parse=y,Hi.resolve=S,Hi.resolveObject=T,Hi.format=_,Hi.Url=t,Hi}var Gc=$1();/*! * @pixi/utils - v6.5.10 * Compiled Thu, 06 Jul 2023 15:25:11 UTC * @@ -57,13 +57,13 @@ PERFORMANCE OF THIS SOFTWARE. * * @pixi/ticker is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license - */At.TARGET_FPMS=.06;var Ao;(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"})(Ao||(Ao={}));var Hc=function(){function r(t,e,n,i){e===void 0&&(e=null),n===void 0&&(n=0),i===void 0&&(i=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=n,this.once=i}return r.prototype.match=function(t,e){return e===void 0&&(e=null),this.fn===t&&this.context===e},r.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},r.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},r.prototype.destroy=function(t){t===void 0&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},r}(),Mn=function(){function r(){var t=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 Hc(null,null,1/0),this.deltaMS=1/At.TARGET_FPMS,this.elapsedMS=1/At.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&t._requestId===null&&t._head.next&&(t._requestId=requestAnimationFrame(t._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(t,e,n){return n===void 0&&(n=Ao.NORMAL),this._addListener(new Hc(t,e,n))},r.prototype.addOnce=function(t,e,n){return n===void 0&&(n=Ao.NORMAL),this._addListener(new Hc(t,e,n,!0))},r.prototype._addListener=function(t){var e=this._head.next,n=this._head;if(!e)t.connect(n);else{for(;e;){if(t.priority>e.priority){t.connect(n);break}n=e,e=e.next}t.previous||t.connect(n)}return this._startIfPossible(),this},r.prototype.remove=function(t,e){for(var n=this._head.next;n;)n.match(t,e)?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 t=0,e=this._head;e=e.next;)t++;return t},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 t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(t){t===void 0&&(t=performance.now());var e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var n=t-this._lastFrame|0;if(ne.priority){t.connect(n);break}n=e,e=e.next}t.previous||t.connect(n)}return this._startIfPossible(),this},r.prototype.remove=function(t,e){for(var n=this._head.next;n;)n.match(t,e)?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 t=0,e=this._head;e=e.next;)t++;return t},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 t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(t){t===void 0&&(t=performance.now());var e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var n=t-this._lastFrame|0;if(n=this.x&&t=this.y&&et.right?t.right:this.right;if(i<=n)return!1;var s=this.yt.bottom?t.bottom:this.bottom;return o>s}var a=this.left,l=this.right,u=this.top,c=this.bottom;if(l<=a||c<=u)return!1;var h=yl[0].set(t.left,t.top),f=yl[1].set(t.left,t.bottom),d=yl[2].set(t.right,t.top),m=yl[3].set(t.right,t.bottom);if(d.x<=h.x||f.y<=h.y)return!1;var g=Math.sign(e.a*e.d-e.b*e.c);if(g===0||(e.apply(h,h),e.apply(f,f),e.apply(d,d),e.apply(m,m),Math.max(h.x,f.x,d.x,m.x)<=a||Math.min(h.x,f.x,d.x,m.x)>=l||Math.max(h.y,f.y,d.y,m.y)<=u||Math.min(h.y,f.y,d.y,m.y)>=c))return!1;var p=g*(f.y-h.y),y=g*(h.x-f.x),_=p*a+y*u,S=p*l+y*u,T=p*a+y*c,v=p*l+y*c;if(Math.max(_,S,T,v)<=p*h.x+y*h.y||Math.min(_,S,T,v)>=p*m.x+y*m.y)return!1;var E=g*(h.y-d.y),w=g*(d.x-h.x),B=E*a+w*u,N=E*l+w*u,$=E*a+w*c,it=E*l+w*c;return!(Math.max(B,N,$,it)<=E*h.x+w*h.y||Math.min(B,N,$,it)>=E*m.x+w*m.y)},r.prototype.pad=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this},r.prototype.fit=function(t){var e=Math.max(this.x,t.x),n=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(n-e,0),this.y=i,this.height=Math.max(s-i,0),this},r.prototype.ceil=function(t,e){t===void 0&&(t=1),e===void 0&&(e=.001);var n=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=n-this.x,this.height=i-this.y,this},r.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),n=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=n-e,this.y=i,this.height=s-i,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),ho=function(){function r(t,e,n,i){n===void 0&&(n=0),i===void 0&&(i=0),this._x=n,this._y=i,this.cb=t,this.scope=e}return r.prototype.clone=function(t,e){return t===void 0&&(t=this.cb),e===void 0&&(e=this.scope),new r(t,e,this._x,this._y)},r.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(t){return t.set(this._x,this._y),t},r.prototype.equals=function(t){return t.x===this._x&&t.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(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),ir=function(){function r(t,e,n,i,s,o){t===void 0&&(t=1),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=1),s===void 0&&(s=0),o===void 0&&(o=0),this.array=null,this.a=t,this.b=e,this.c=n,this.d=i,this.tx=s,this.ty=o}return r.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},r.prototype.set=function(t,e,n,i,s,o){return this.a=t,this.b=e,this.c=n,this.d=i,this.tx=s,this.ty=o,this},r.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var n=e||this.array;return t?(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(t,e){e=e||new Oe;var n=t.x,i=t.y;return e.x=this.a*n+this.c*i+this.tx,e.y=this.b*n+this.d*i+this.ty,e},r.prototype.applyInverse=function(t,e){e=e||new Oe;var n=1/(this.a*this.d+this.c*-this.b),i=t.x,s=t.y;return e.x=this.d*n*i+-this.c*n*s+(this.ty*this.c-this.tx*this.d)*n,e.y=this.a*n*s+-this.b*n*i+(-this.ty*this.a+this.tx*this.b)*n,e},r.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},r.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},r.prototype.rotate=function(t){var e=Math.cos(t),n=Math.sin(t),i=this.a,s=this.c,o=this.tx;return this.a=i*e-this.b*n,this.b=i*n+this.b*e,this.c=s*e-this.d*n,this.d=s*n+this.d*e,this.tx=o*e-this.ty*n,this.ty=o*n+this.ty*e,this},r.prototype.append=function(t){var e=this.a,n=this.b,i=this.c,s=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*n+t.b*s,this.c=t.c*e+t.d*i,this.d=t.c*n+t.d*s,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*n+t.ty*s+this.ty,this},r.prototype.setTransform=function(t,e,n,i,s,o,a,l,u){return this.a=Math.cos(a+u)*s,this.b=Math.sin(a+u)*s,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(n*this.a+i*this.c),this.ty=e-(n*this.b+i*this.d),this},r.prototype.prepend=function(t){var e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){var n=this.a,i=this.c;this.a=n*t.a+this.b*t.c,this.b=n*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},r.prototype.decompose=function(t){var e=this.a,n=this.b,i=this.c,s=this.d,o=t.pivot,a=-Math.atan2(-i,s),l=Math.atan2(n,e),u=Math.abs(a+l);return u<1e-5||Math.abs(K1-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+n*n),t.scale.y=Math.sqrt(i*i+s*s),t.position.x=this.tx+(o.x*e+o.y*i),t.position.y=this.ty+(o.x*n+o.y*s),t},r.prototype.invert=function(){var t=this.a,e=this.b,n=this.c,i=this.d,s=this.tx,o=t*i-e*n;return this.a=i/o,this.b=-e/o,this.c=-n/o,this.d=t/o,this.tx=(n*this.ty-i*s)/o,this.ty=-(t*this.ty-e*s)/o,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 t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},r.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},r.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},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}(),es=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],rs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ns=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],is=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Hh=[],I0=[],vl=Math.sign;function tI(){for(var r=0;r<16;r++){var t=[];Hh.push(t);for(var e=0;e<16;e++)for(var n=vl(es[r]*es[e]+ns[r]*rs[e]),i=vl(rs[r]*es[e]+is[r]*rs[e]),s=vl(es[r]*ns[e]+ns[r]*is[e]),o=vl(rs[r]*ns[e]+is[r]*is[e]),a=0;a<16;a++)if(es[a]===n&&rs[a]===i&&ns[a]===s&&is[a]===o){t.push(a);break}}for(var r=0;r<16;r++){var l=new ir;l.set(es[r],rs[r],ns[r],is[r],0,0),I0.push(l)}}tI();var Re={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 es[r]},uY:function(r){return rs[r]},vX:function(r){return ns[r]},vY:function(r){return is[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,t){return Hh[r][t]},sub:function(r,t){return Hh[r][Re.inv(t)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,t){return Math.abs(r)*2<=Math.abs(t)?t>=0?Re.S:Re.N:Math.abs(t)*2<=Math.abs(r)?r>0?Re.E:Re.W:t>0?r>0?Re.SE:Re.SW:r>0?Re.NE:Re.NW},matrixAppendRotationInv:function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=I0[Re.inv(t)];i.tx=e,i.ty=n,r.append(i)}},E0=function(){function r(){this.worldTransform=new ir,this.localTransform=new ir,this.position=new ho(this.onChange,this,0,0),this.scale=new ho(this.onChange,this,1,1),this.pivot=new ho(this.onChange,this,0,0),this.skew=new ho(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 t=this.localTransform;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)},r.prototype.updateTransform=function(t){var e=this.localTransform;if(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),this._parentID!==t._worldID){var n=t.worldTransform,i=this.worldTransform;i.a=e.a*n.a+e.b*n.c,i.b=e.a*n.b+e.b*n.d,i.c=e.c*n.a+e.d*n.c,i.d=e.c*n.b+e.d*n.d,i.tx=e.tx*n.a+e.ty*n.c+n.tx,i.ty=e.tx*n.b+e.ty*n.d+n.ty,this._parentID=t._worldID,this._worldID++}},r.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();/*! + */var K1=Math.PI*2,J1=180/Math.PI,Ts=Math.PI/180,Wh;(function(r){r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC"})(Wh||(Wh={}));var Oe=function(){function r(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return r.prototype.clone=function(){return new r(this.x,this.y)},r.prototype.copyFrom=function(t){return this.set(t.x,t.y),this},r.prototype.copyTo=function(t){return t.set(this.x,this.y),t},r.prototype.equals=function(t){return t.x===this.x&&t.y===this.y},r.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x=t,this.y=e,this},r.prototype.toString=function(){return"[@pixi/math:Point x="+this.x+" y="+this.y+"]"},r}(),yl=[new Oe,new Oe,new Oe,new Oe],$e=function(){function r(t,e,n,i){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=0),this.x=Number(t),this.y=Number(e),this.width=Number(n),this.height=Number(i),this.type=Wh.RECT}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r,"EMPTY",{get:function(){return new r(0,0,0,0)},enumerable:!1,configurable:!0}),r.prototype.clone=function(){return new r(this.x,this.y,this.width,this.height)},r.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this},r.prototype.copyTo=function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},r.prototype.contains=function(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&et.right?t.right:this.right;if(i<=n)return!1;var s=this.yt.bottom?t.bottom:this.bottom;return o>s}var a=this.left,l=this.right,u=this.top,c=this.bottom;if(l<=a||c<=u)return!1;var h=yl[0].set(t.left,t.top),f=yl[1].set(t.left,t.bottom),d=yl[2].set(t.right,t.top),m=yl[3].set(t.right,t.bottom);if(d.x<=h.x||f.y<=h.y)return!1;var g=Math.sign(e.a*e.d-e.b*e.c);if(g===0||(e.apply(h,h),e.apply(f,f),e.apply(d,d),e.apply(m,m),Math.max(h.x,f.x,d.x,m.x)<=a||Math.min(h.x,f.x,d.x,m.x)>=l||Math.max(h.y,f.y,d.y,m.y)<=u||Math.min(h.y,f.y,d.y,m.y)>=c))return!1;var p=g*(f.y-h.y),y=g*(h.x-f.x),_=p*a+y*u,S=p*l+y*u,T=p*a+y*c,v=p*l+y*c;if(Math.max(_,S,T,v)<=p*h.x+y*h.y||Math.min(_,S,T,v)>=p*m.x+y*m.y)return!1;var E=g*(h.y-d.y),w=g*(d.x-h.x),B=E*a+w*u,L=E*l+w*u,$=E*a+w*c,it=E*l+w*c;return!(Math.max(B,L,$,it)<=E*h.x+w*h.y||Math.min(B,L,$,it)>=E*m.x+w*m.y)},r.prototype.pad=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this},r.prototype.fit=function(t){var e=Math.max(this.x,t.x),n=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),s=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(n-e,0),this.y=i,this.height=Math.max(s-i,0),this},r.prototype.ceil=function(t,e){t===void 0&&(t=1),e===void 0&&(e=.001);var n=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=n-this.x,this.height=i-this.y,this},r.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),n=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),s=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=n-e,this.y=i,this.height=s-i,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),ho=function(){function r(t,e,n,i){n===void 0&&(n=0),i===void 0&&(i=0),this._x=n,this._y=i,this.cb=t,this.scope=e}return r.prototype.clone=function(t,e){return t===void 0&&(t=this.cb),e===void 0&&(e=this.scope),new r(t,e,this._x,this._y)},r.prototype.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(t){return t.set(this._x,this._y),t},r.prototype.equals=function(t){return t.x===this._x&&t.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(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),ir=function(){function r(t,e,n,i,s,o){t===void 0&&(t=1),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=1),s===void 0&&(s=0),o===void 0&&(o=0),this.array=null,this.a=t,this.b=e,this.c=n,this.d=i,this.tx=s,this.ty=o}return r.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},r.prototype.set=function(t,e,n,i,s,o){return this.a=t,this.b=e,this.c=n,this.d=i,this.tx=s,this.ty=o,this},r.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var n=e||this.array;return t?(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(t,e){e=e||new Oe;var n=t.x,i=t.y;return e.x=this.a*n+this.c*i+this.tx,e.y=this.b*n+this.d*i+this.ty,e},r.prototype.applyInverse=function(t,e){e=e||new Oe;var n=1/(this.a*this.d+this.c*-this.b),i=t.x,s=t.y;return e.x=this.d*n*i+-this.c*n*s+(this.ty*this.c-this.tx*this.d)*n,e.y=this.a*n*s+-this.b*n*i+(-this.ty*this.a+this.tx*this.b)*n,e},r.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},r.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},r.prototype.rotate=function(t){var e=Math.cos(t),n=Math.sin(t),i=this.a,s=this.c,o=this.tx;return this.a=i*e-this.b*n,this.b=i*n+this.b*e,this.c=s*e-this.d*n,this.d=s*n+this.d*e,this.tx=o*e-this.ty*n,this.ty=o*n+this.ty*e,this},r.prototype.append=function(t){var e=this.a,n=this.b,i=this.c,s=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*n+t.b*s,this.c=t.c*e+t.d*i,this.d=t.c*n+t.d*s,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*n+t.ty*s+this.ty,this},r.prototype.setTransform=function(t,e,n,i,s,o,a,l,u){return this.a=Math.cos(a+u)*s,this.b=Math.sin(a+u)*s,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(n*this.a+i*this.c),this.ty=e-(n*this.b+i*this.d),this},r.prototype.prepend=function(t){var e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){var n=this.a,i=this.c;this.a=n*t.a+this.b*t.c,this.b=n*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},r.prototype.decompose=function(t){var e=this.a,n=this.b,i=this.c,s=this.d,o=t.pivot,a=-Math.atan2(-i,s),l=Math.atan2(n,e),u=Math.abs(a+l);return u<1e-5||Math.abs(K1-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+n*n),t.scale.y=Math.sqrt(i*i+s*s),t.position.x=this.tx+(o.x*e+o.y*i),t.position.y=this.ty+(o.x*n+o.y*s),t},r.prototype.invert=function(){var t=this.a,e=this.b,n=this.c,i=this.d,s=this.tx,o=t*i-e*n;return this.a=i/o,this.b=-e/o,this.c=-n/o,this.d=t/o,this.tx=(n*this.ty-i*s)/o,this.ty=-(t*this.ty-e*s)/o,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 t=new r;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},r.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},r.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},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}(),es=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],rs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ns=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],is=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Hh=[],I0=[],vl=Math.sign;function tI(){for(var r=0;r<16;r++){var t=[];Hh.push(t);for(var e=0;e<16;e++)for(var n=vl(es[r]*es[e]+ns[r]*rs[e]),i=vl(rs[r]*es[e]+is[r]*rs[e]),s=vl(es[r]*ns[e]+ns[r]*is[e]),o=vl(rs[r]*ns[e]+is[r]*is[e]),a=0;a<16;a++)if(es[a]===n&&rs[a]===i&&ns[a]===s&&is[a]===o){t.push(a);break}}for(var r=0;r<16;r++){var l=new ir;l.set(es[r],rs[r],ns[r],is[r],0,0),I0.push(l)}}tI();var Re={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 es[r]},uY:function(r){return rs[r]},vX:function(r){return ns[r]},vY:function(r){return is[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,t){return Hh[r][t]},sub:function(r,t){return Hh[r][Re.inv(t)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,t){return Math.abs(r)*2<=Math.abs(t)?t>=0?Re.S:Re.N:Math.abs(t)*2<=Math.abs(r)?r>0?Re.E:Re.W:t>0?r>0?Re.SE:Re.SW:r>0?Re.NE:Re.NW},matrixAppendRotationInv:function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=I0[Re.inv(t)];i.tx=e,i.ty=n,r.append(i)}},E0=function(){function r(){this.worldTransform=new ir,this.localTransform=new ir,this.position=new ho(this.onChange,this,0,0),this.scale=new ho(this.onChange,this,1,1),this.pivot=new ho(this.onChange,this,0,0),this.skew=new ho(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 t=this.localTransform;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)},r.prototype.updateTransform=function(t){var e=this.localTransform;if(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),this._parentID!==t._worldID){var n=t.worldTransform,i=this.worldTransform;i.a=e.a*n.a+e.b*n.c,i.b=e.a*n.b+e.b*n.d,i.c=e.c*n.a+e.d*n.c,i.d=e.c*n.b+e.d*n.d,i.tx=e.tx*n.a+e.ty*n.c+n.tx,i.ty=e.tx*n.b+e.ty*n.d+n.ty,this._parentID=t._worldID,this._worldID++}},r.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,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 * @@ -82,7 +82,7 @@ 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 Yh=function(r,t){return Yh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},Yh(r,t)};function Ce(r,t){Yh(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var qh=function(){return qh=Object.assign||function(t){for(var e=arguments,n,i=1,s=arguments.length;i0&&c>0,i.textureCacheIds=[],i.destroyed=!1,i.resource=null,i._batchEnabled=0,i._batchLocation=0,i.parentTextureArray=null,i.setResource(e),i}return Object.defineProperty(t.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mipmap",{get:function(){return this._mipmap},set:function(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),t.prototype.setStyle=function(e,n){var i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),n!==void 0&&n!==this.mipmap&&(this.mipmap=n,i=!0),i&&this.dirtyStyleId++,this},t.prototype.setSize=function(e,n,i){return i=i||this.resolution,this.setRealSize(e*i,n*i,i)},t.prototype.setRealSize=function(e,n,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(n)/this.resolution,this._refreshPOT(),this.update(),this},t.prototype._refreshPOT=function(){this.isPowerOfTwo=wm(this.realWidth)&&wm(this.realHeight)},t.prototype.setResolution=function(e){var n=this.resolution;return n===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*n)/e,this.height=Math.round(this.height*n)/e,this.emit("update",this)),this._refreshPOT(),this)},t.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},t.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))},t.prototype.onError=function(e){this.emit("error",this,e)},t.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Xi[this.cacheId],delete Qn[this.cacheId],this.cacheId=null),this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},t.prototype.dispose=function(){this.emit("dispose",this)},t.prototype.castToBaseTexture=function(){return this},t.from=function(e,n,i){i===void 0&&(i=At.STRICT_TEXTURE_CACHE);var s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){var a=n&&n.pixiIdPrefix||"pixiid";e._pixiId=a+"_"+Ra()}o=e._pixiId}var l=Xi[o];if(s&&i&&!l)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return l||(l=new t(e,n),l.cacheId=o,t.addToCache(l,o)),l},t.fromBuffer=function(e,n,i,s){e=e||new Float32Array(n*i*4);var o=new Of(e,{width:n,height:i}),a=e instanceof Float32Array?fe.FLOAT:fe.UNSIGNED_BYTE;return new t(o,Object.assign({},rI,s||{width:n,height:i,type:a}))},t.addToCache=function(e,n){n&&(e.textureCacheIds.indexOf(n)===-1&&e.textureCacheIds.push(n),Xi[n]&&console.warn("BaseTexture added to the cache with an id ["+n+"] that already had an entry"),Xi[n]=e)},t.removeFromCache=function(e){if(typeof e=="string"){var n=Xi[e];if(n){var i=n.textureCacheIds.indexOf(e);return i>-1&&n.textureCacheIds.splice(i,1),delete Xi[e],n}}else if(e&&e.textureCacheIds){for(var s=0;s0)if(e.resource)this.addResourceAt(e.resource,n);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=_s.TEXTURE_CUBE_MAP_POSITIVE_X+n,e.parentTextureArray=this.baseTexture,this.items[n]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[n]=e,this},t.prototype.upload=function(e,n,i){for(var s=this.itemDirtyIds,o=0;o)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,t}(Oi),aI=function(r){Ce(t,r);function t(e,n){var i=this;if(n=n||{},!(e instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof e=="string"&&(e=[e]);var o=e[0].src||e[0];Oi.crossOrigin(s,o,n.crossorigin);for(var a=0;a2},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Mn.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Mn.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var n=this.valid;this.resize(e.videoWidth,e.videoHeight),!n&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&(Mn.shared.remove(this.update,this),this._isConnectedToTicker=!1);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),r.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Mn.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Mn.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,n){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(n)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(Oi),lI=function(r){Ce(t,r);function t(e){return r.call(this,e)||this}return t.test=function(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap},t}(Oi);Xh.push(C0,lI,iI,aI,oI,Of,sI,nI);var uI=function(r){Ce(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.upload=function(e,n,i){var s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.alphaMode===Ci.UNPACK);var o=n.realWidth,a=n.realHeight;return i.width===o&&i.height===a?s.texSubImage2D(n.target,0,0,0,o,a,n.format,i.type,this.data):(i.width=o,i.height=a,s.texImage2D(n.target,0,i.internalFormat,o,a,0,n.format,i.type,this.data)),!0},t}(Of),Qh=function(){function r(t,e){this.width=Math.round(t||100),this.height=Math.round(e||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 tr("disposeFramebuffer"),this.multisample=Ve.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(t,e){return t===void 0&&(t=0),this.colorTextures[t]=e||new Xe(null,{scaleMode:Pr.NEAREST,resolution:1,mipmap:Un.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(t){return this.depthTexture=t||new Xe(new uI(null,{width:this.width,height:this.height}),{scaleMode:Pr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Un.OFF,format:xt.DEPTH_COMPONENT,type:fe.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(t,e){if(t=Math.round(t),e=Math.round(e),!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var n=0;n-1&&n.textureCacheIds.splice(i,1),delete Qn[e],n}}else if(e&&e.textureCacheIds){for(var s=0;sthis.baseTexture.width,l=i+o>this.baseTexture.height;if(a||l){var u=a&&l?"and":"or",c="X: "+n+" + "+s+" = "+(n+s)+" > "+this.baseTexture.width,h="Y: "+i+" + "+o+" = "+(i+o)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(c+" "+u+" "+h))}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),t.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(t,"EMPTY",{get:function(){return t._EMPTY||(t._EMPTY=new t(new Xe),_l(t._EMPTY),_l(t._EMPTY.baseTexture)),t._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(t,"WHITE",{get:function(){if(!t._WHITE){var e=At.ADAPTER.createCanvas(16,16),n=e.getContext("2d");e.width=16,e.height=16,n.fillStyle="white",n.fillRect(0,0,16,16),t._WHITE=new t(Xe.from(e)),_l(t._WHITE),_l(t._WHITE.baseTexture)}return t._WHITE},enumerable:!1,configurable:!0}),t}(ki),Pf=function(r){Ce(t,r);function t(e,n){var i=r.call(this,e,n)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,n,i){i===void 0&&(i=!0);var s=this.baseTexture.resolution,o=Math.round(e*s)/s,a=Math.round(n*s)/s;this.valid=o>0&&a>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=a,i&&this.baseTexture.resize(o,a),this.updateUvs()},t.prototype.setResolution=function(e){var n=this.baseTexture;n.resolution!==e&&(n.setResolution(e),this.resize(n.width,n.height,!1))},t.create=function(e){for(var n=arguments,i=[],s=1;s>>0,i>1&&(s+=i*4294967296)):s=i>1?-i:-1,this.texturePool[s]||(this.texturePool[s]=[]);var o=this.texturePool[s].pop();return o||(o=this.createTexture(t,e,i)),o.filterPoolKey=s,o.setResolution(n),o},r.prototype.getFilterTexture=function(t,e,n){var i=this.getOptimalTexture(t.width,t.height,e||t.resolution,n||Ve.NONE);return i.filterFrame=t.filterFrame,i},r.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},r.prototype.returnFilterTexture=function(t){this.returnTexture(t)},r.prototype.clear=function(t){if(t=t!==!1,t)for(var e in this.texturePool){var n=this.texturePool[e];if(n)for(var i=0;i0&&t.height>0;for(var e in this.texturePool)if(Number(e)<0){var n=this.texturePool[e];if(n)for(var i=0;i1){for(var c=0;c1&&(h=this.getOptimalFilterTexture(c.width,c.height,e.resolution),h.filterFrame=c.filterFrame),n[f].apply(this,c,h,hn.CLEAR,e);var d=c;c=h,h=d}n[f].apply(this,c,u.renderTexture,hn.BLEND,e),f>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(h)}e.clear(),this.statePool.push(e)},r.prototype.bindAndClear=function(t,e){e===void 0&&(e=hn.CLEAR);var n=this.renderer,i=n.renderTexture,s=n.state;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t&&t.filterFrame){var o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var a=s.stateId&1||this.forceClear;(e===hn.CLEAR||e===hn.BLIT&&a)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(t,e,n,i){var s=this.renderer;s.state.set(t.state),this.bindAndClear(n,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(Pa.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(Pa.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(t,e){var n=this.activeState,i=n.sourceFrame,s=n.destinationFrame,o=e._texture.orig,a=t.set(s.width,0,0,s.height,i.x,i.y),l=e.worldTransform.copyTo(ir.TEMP_MATRIX);return l.invert(),a.prepend(l),a.scale(1/o.width,1/o.height),a.translate(e.anchor.x,e.anchor.y),a},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(t,e,n,i){return n===void 0&&(n=1),i===void 0&&(i=Ve.NONE),this.texturePool.getOptimalTexture(t,e,n,i)},r.prototype.getFilterTexture=function(t,e,n){if(typeof t=="number"){var i=t;t=e,e=i}t=t||this.activeState.renderTexture;var s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,n||Ve.NONE);return s.filterFrame=t.filterFrame,s},r.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(t,e){var n=bl[0],i=bl[1],s=bl[2],o=bl[3];n.set(e.left,e.top),i.set(e.left,e.bottom),s.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(n,n),t.apply(i,i),t.apply(s,s),t.apply(o,o);var a=Math.min(n.x,i.x,s.x,o.x),l=Math.min(n.y,i.y,s.y,o.y),u=Math.max(n.x,i.x,s.x,o.x),c=Math.max(n.y,i.y,s.y,o.y);e.x=a,e.y=l,e.width=u-a,e.height=c-l},r.prototype.roundFrame=function(t,e,n,i,s){if(!(t.width<=0||t.height<=0||n.width<=0||n.height<=0)){if(s){var o=s.a,a=s.b,l=s.c,u=s.d;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(u)>1e-4))return}s=s?Xc.copyFrom(s):Xc.identity(),s.translate(-n.x,-n.y).scale(i.width/n.width,i.height/n.height).translate(i.x,i.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}},r}(),R0=function(){function r(t){this.renderer=t}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(t){},r}(),wI=function(){function r(t){this.renderer=t,this.emptyRenderer=new R0(t),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(t,e){for(var n=this.renderer.texture.boundTextures,i=e-1;i>=0;--i)t[i]=n[i]||null,t[i]&&(t[i]._batchLocation=i)},r.prototype.boundArray=function(t,e,n,i){for(var s=t.elements,o=t.ids,a=t.count,l=0,u=0;u=0&&h=li.WEBGL2&&(n=t.getContext("webgl2",e)),n)this.webGLVersion=2;else if(this.webGLVersion=1,n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!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 t=this.gl,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(t){var e=this;t.preventDefault(),setTimeout(function(){e.gl.isContextLost()&&e.extensions.loseContext&&e.extensions.loseContext.restoreContext()},0)},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var t=this.renderer.view;this.renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.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(t){var e=t.getContextAttributes(),n="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;n&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=n||!!t.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}(),SI=function(){function r(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ve.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),TI=new $e,II=function(){function r(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Qh(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new $e,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){var e=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;At.PREFER_ENV===li.WEBGL_LEGACY&&(e=null,n=null),e?t.drawBuffers=function(i){return e.drawBuffersWEBGL(i)}:(this.hasMRT=!1,t.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)},r.prototype.bind=function(t,e,n){n===void 0&&(n=0);var i=this.gl;if(t){var s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==n&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=n),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,n)):s.dirtySize!==t.dirtySize&&(s.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var o=0;o>n,u=e.height>>n,c=l/e.width;this.setViewport(e.x*c,e.y*c,l,u)}else{var l=t.width>>n,u=t.height>>n;this.setViewport(0,0,l,u)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(t,e,n,i){var s=this.viewport;t=Math.round(t),e=Math.round(e),n=Math.round(n),i=Math.round(i),(s.width!==n||s.height!==i||s.x!==t||s.y!==e)&&(s.x=t,s.y=e,s.width=n,s.height=i,this.gl.viewport(t,e,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(t,e,n,i,s){s===void 0&&(s=tu.COLOR|tu.DEPTH);var o=this.gl;o.clearColor(t,e,n,i),o.clear(s)},r.prototype.initFramebuffer=function(t){var e=this.gl,n=new SI(e.createFramebuffer());return n.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=n,this.managedFramebuffers.push(t),t.disposeRunner.add(this),n},r.prototype.resizeFramebuffer=function(t){var e=this.gl,n=t.glFramebuffers[this.CONTEXT_UID];n.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,n.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,n.multisample,e.RGBA8,t.width,t.height)),n.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,n.stencil),n.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,n.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var i=t.colorTextures,s=i.length;e.drawBuffers||(s=Math.min(s,1));for(var o=0;o1&&this.canMultisampleFramebuffer(t)?(i.msaaBuffer=i.msaaBuffer||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.msaaBuffer),n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.RGBA8,t.width,t.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 a=[],l=0;l1&&n.drawBuffers(a),t.depthTexture){var h=this.writeDepthTexture;if(h){var f=t.depthTexture;this.renderer.texture.bind(f,0),n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,f._glTextures[this.CONTEXT_UID].texture,e)}}(t.stencil||t.depth)&&!(t.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,t.width,t.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,t.width,t.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(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture},r.prototype.detectSamples=function(t){var e=this.msaaSamples,n=Ve.NONE;if(t<=1||e===null)return n;for(var i=0;i=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(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(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var n=0;n0&&c>0,i.textureCacheIds=[],i.destroyed=!1,i.resource=null,i._batchEnabled=0,i._batchLocation=0,i.parentTextureArray=null,i.setResource(e),i}return Object.defineProperty(t.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mipmap",{get:function(){return this._mipmap},set:function(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),t.prototype.setStyle=function(e,n){var i;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,i=!0),n!==void 0&&n!==this.mipmap&&(this.mipmap=n,i=!0),i&&this.dirtyStyleId++,this},t.prototype.setSize=function(e,n,i){return i=i||this.resolution,this.setRealSize(e*i,n*i,i)},t.prototype.setRealSize=function(e,n,i){return this.resolution=i||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(n)/this.resolution,this._refreshPOT(),this.update(),this},t.prototype._refreshPOT=function(){this.isPowerOfTwo=wm(this.realWidth)&&wm(this.realHeight)},t.prototype.setResolution=function(e){var n=this.resolution;return n===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*n)/e,this.height=Math.round(this.height*n)/e,this.emit("update",this)),this._refreshPOT(),this)},t.prototype.setResource=function(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this},t.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))},t.prototype.onError=function(e){this.emit("error",this,e)},t.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Xi[this.cacheId],delete Qn[this.cacheId],this.cacheId=null),this.dispose(),t.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},t.prototype.dispose=function(){this.emit("dispose",this)},t.prototype.castToBaseTexture=function(){return this},t.from=function(e,n,i){i===void 0&&(i=At.STRICT_TEXTURE_CACHE);var s=typeof e=="string",o=null;if(s)o=e;else{if(!e._pixiId){var a=n&&n.pixiIdPrefix||"pixiid";e._pixiId=a+"_"+Ra()}o=e._pixiId}var l=Xi[o];if(s&&i&&!l)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return l||(l=new t(e,n),l.cacheId=o,t.addToCache(l,o)),l},t.fromBuffer=function(e,n,i,s){e=e||new Float32Array(n*i*4);var o=new Of(e,{width:n,height:i}),a=e instanceof Float32Array?fe.FLOAT:fe.UNSIGNED_BYTE;return new t(o,Object.assign({},rI,s||{width:n,height:i,type:a}))},t.addToCache=function(e,n){n&&(e.textureCacheIds.indexOf(n)===-1&&e.textureCacheIds.push(n),Xi[n]&&console.warn("BaseTexture added to the cache with an id ["+n+"] that already had an entry"),Xi[n]=e)},t.removeFromCache=function(e){if(typeof e=="string"){var n=Xi[e];if(n){var i=n.textureCacheIds.indexOf(e);return i>-1&&n.textureCacheIds.splice(i,1),delete Xi[e],n}}else if(e&&e.textureCacheIds){for(var s=0;s0)if(e.resource)this.addResourceAt(e.resource,n);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=_s.TEXTURE_CUBE_MAP_POSITIVE_X+n,e.parentTextureArray=this.baseTexture,this.items[n]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[n]=e,this},t.prototype.upload=function(e,n,i){for(var s=this.itemDirtyIds,o=0;o)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,t}(Pi),aI=function(r){Ce(t,r);function t(e,n){var i=this;if(n=n||{},!(e instanceof HTMLVideoElement)){var s=document.createElement("video");s.setAttribute("preload","auto"),s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline",""),typeof e=="string"&&(e=[e]);var o=e[0].src||e[0];Pi.crossOrigin(s,o,n.crossorigin);for(var a=0;a2},t.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Mn.shared.add(this.update,this),this._isConnectedToTicker=!0)},t.prototype._onPlayStop=function(){this._isConnectedToTicker&&(Mn.shared.remove(this.update,this),this._isConnectedToTicker=!1)},t.prototype._onCanPlay=function(){var e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);var n=this.valid;this.resize(e.videoWidth,e.videoHeight),!n&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()},t.prototype.dispose=function(){this._isConnectedToTicker&&(Mn.shared.remove(this.update,this),this._isConnectedToTicker=!1);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),r.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Mn.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Mn.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(e){e!==this._updateFPS&&(this._updateFPS=e)},enumerable:!1,configurable:!0}),t.test=function(e,n){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||t.TYPES.indexOf(n)>-1},t.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],t.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},t}(Pi),lI=function(r){Ce(t,r);function t(e){return r.call(this,e)||this}return t.test=function(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap},t}(Pi);Xh.push(C0,lI,iI,aI,oI,Of,sI,nI);var uI=function(r){Ce(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.upload=function(e,n,i){var s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.alphaMode===Oi.UNPACK);var o=n.realWidth,a=n.realHeight;return i.width===o&&i.height===a?s.texSubImage2D(n.target,0,0,0,o,a,n.format,i.type,this.data):(i.width=o,i.height=a,s.texImage2D(n.target,0,i.internalFormat,o,a,0,n.format,i.type,this.data)),!0},t}(Of),Qh=function(){function r(t,e){this.width=Math.round(t||100),this.height=Math.round(e||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 tr("disposeFramebuffer"),this.multisample=Ve.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(t,e){return t===void 0&&(t=0),this.colorTextures[t]=e||new Xe(null,{scaleMode:Pr.NEAREST,resolution:1,mipmap:Un.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(t){return this.depthTexture=t||new Xe(new uI(null,{width:this.width,height:this.height}),{scaleMode:Pr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Un.OFF,format:xt.DEPTH_COMPONENT,type:fe.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(t,e){if(t=Math.round(t),e=Math.round(e),!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var n=0;n-1&&n.textureCacheIds.splice(i,1),delete Qn[e],n}}else if(e&&e.textureCacheIds){for(var s=0;sthis.baseTexture.width,l=i+o>this.baseTexture.height;if(a||l){var u=a&&l?"and":"or",c="X: "+n+" + "+s+" = "+(n+s)+" > "+this.baseTexture.width,h="Y: "+i+" + "+o+" = "+(i+o)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(c+" "+u+" "+h))}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotate",{get:function(){return this._rotate},set:function(e){this._rotate=e,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),t.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(t,"EMPTY",{get:function(){return t._EMPTY||(t._EMPTY=new t(new Xe),_l(t._EMPTY),_l(t._EMPTY.baseTexture)),t._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(t,"WHITE",{get:function(){if(!t._WHITE){var e=At.ADAPTER.createCanvas(16,16),n=e.getContext("2d");e.width=16,e.height=16,n.fillStyle="white",n.fillRect(0,0,16,16),t._WHITE=new t(Xe.from(e)),_l(t._WHITE),_l(t._WHITE.baseTexture)}return t._WHITE},enumerable:!1,configurable:!0}),t}(ki),Pf=function(r){Ce(t,r);function t(e,n){var i=r.call(this,e,n)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return Object.defineProperty(t.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(e){this.framebuffer.multisample=e},enumerable:!1,configurable:!0}),t.prototype.resize=function(e,n,i){i===void 0&&(i=!0);var s=this.baseTexture.resolution,o=Math.round(e*s)/s,a=Math.round(n*s)/s;this.valid=o>0&&a>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=a,i&&this.baseTexture.resize(o,a),this.updateUvs()},t.prototype.setResolution=function(e){var n=this.baseTexture;n.resolution!==e&&(n.setResolution(e),this.resize(n.width,n.height,!1))},t.create=function(e){for(var n=arguments,i=[],s=1;s>>0,i>1&&(s+=i*4294967296)):s=i>1?-i:-1,this.texturePool[s]||(this.texturePool[s]=[]);var o=this.texturePool[s].pop();return o||(o=this.createTexture(t,e,i)),o.filterPoolKey=s,o.setResolution(n),o},r.prototype.getFilterTexture=function(t,e,n){var i=this.getOptimalTexture(t.width,t.height,e||t.resolution,n||Ve.NONE);return i.filterFrame=t.filterFrame,i},r.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},r.prototype.returnFilterTexture=function(t){this.returnTexture(t)},r.prototype.clear=function(t){if(t=t!==!1,t)for(var e in this.texturePool){var n=this.texturePool[e];if(n)for(var i=0;i0&&t.height>0;for(var e in this.texturePool)if(Number(e)<0){var n=this.texturePool[e];if(n)for(var i=0;i1){for(var c=0;c1&&(h=this.getOptimalFilterTexture(c.width,c.height,e.resolution),h.filterFrame=c.filterFrame),n[f].apply(this,c,h,hn.CLEAR,e);var d=c;c=h,h=d}n[f].apply(this,c,u.renderTexture,hn.BLEND,e),f>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(h)}e.clear(),this.statePool.push(e)},r.prototype.bindAndClear=function(t,e){e===void 0&&(e=hn.CLEAR);var n=this.renderer,i=n.renderTexture,s=n.state;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t&&t.filterFrame){var o=this.tempRect;o.x=0,o.y=0,o.width=t.filterFrame.width,o.height=t.filterFrame.height,i.bind(t,t.filterFrame,o)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var a=s.stateId&1||this.forceClear;(e===hn.CLEAR||e===hn.BLIT&&a)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(t,e,n,i){var s=this.renderer;s.state.set(t.state),this.bindAndClear(n,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,s.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),s.geometry.bind(this.quadUv),s.geometry.draw(Pa.TRIANGLES)):(s.geometry.bind(this.quad),s.geometry.draw(Pa.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(t,e){var n=this.activeState,i=n.sourceFrame,s=n.destinationFrame,o=e._texture.orig,a=t.set(s.width,0,0,s.height,i.x,i.y),l=e.worldTransform.copyTo(ir.TEMP_MATRIX);return l.invert(),a.prepend(l),a.scale(1/o.width,1/o.height),a.translate(e.anchor.x,e.anchor.y),a},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(t,e,n,i){return n===void 0&&(n=1),i===void 0&&(i=Ve.NONE),this.texturePool.getOptimalTexture(t,e,n,i)},r.prototype.getFilterTexture=function(t,e,n){if(typeof t=="number"){var i=t;t=e,e=i}t=t||this.activeState.renderTexture;var s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,n||Ve.NONE);return s.filterFrame=t.filterFrame,s},r.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(t,e){var n=bl[0],i=bl[1],s=bl[2],o=bl[3];n.set(e.left,e.top),i.set(e.left,e.bottom),s.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(n,n),t.apply(i,i),t.apply(s,s),t.apply(o,o);var a=Math.min(n.x,i.x,s.x,o.x),l=Math.min(n.y,i.y,s.y,o.y),u=Math.max(n.x,i.x,s.x,o.x),c=Math.max(n.y,i.y,s.y,o.y);e.x=a,e.y=l,e.width=u-a,e.height=c-l},r.prototype.roundFrame=function(t,e,n,i,s){if(!(t.width<=0||t.height<=0||n.width<=0||n.height<=0)){if(s){var o=s.a,a=s.b,l=s.c,u=s.d;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(u)>1e-4))return}s=s?Xc.copyFrom(s):Xc.identity(),s.translate(-n.x,-n.y).scale(i.width/n.width,i.height/n.height).translate(i.x,i.y),this.transformAABB(s,t),t.ceil(e),this.transformAABB(s.invert(),t)}},r}(),R0=function(){function r(t){this.renderer=t}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(t){},r}(),wI=function(){function r(t){this.renderer=t,this.emptyRenderer=new R0(t),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(t,e){for(var n=this.renderer.texture.boundTextures,i=e-1;i>=0;--i)t[i]=n[i]||null,t[i]&&(t[i]._batchLocation=i)},r.prototype.boundArray=function(t,e,n,i){for(var s=t.elements,o=t.ids,a=t.count,l=0,u=0;u=0&&h=li.WEBGL2&&(n=t.getContext("webgl2",e)),n)this.webGLVersion=2;else if(this.webGLVersion=1,n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!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 t=this.gl,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(t){var e=this;t.preventDefault(),setTimeout(function(){e.gl.isContextLost()&&e.extensions.loseContext&&e.extensions.loseContext.restoreContext()},0)},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var t=this.renderer.view;this.renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.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(t){var e=t.getContextAttributes(),n="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;n&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=n||!!t.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}(),SI=function(){function r(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ve.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),TI=new $e,II=function(){function r(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Qh(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){this.disposeAll(!0);var t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new $e,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){var e=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;At.PREFER_ENV===li.WEBGL_LEGACY&&(e=null,n=null),e?t.drawBuffers=function(i){return e.drawBuffersWEBGL(i)}:(this.hasMRT=!1,t.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)},r.prototype.bind=function(t,e,n){n===void 0&&(n=0);var i=this.gl;if(t){var s=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,s.framebuffer)),s.mipLevel!==n&&(t.dirtyId++,t.dirtyFormat++,s.mipLevel=n),s.dirtyId!==t.dirtyId&&(s.dirtyId=t.dirtyId,s.dirtyFormat!==t.dirtyFormat?(s.dirtyFormat=t.dirtyFormat,s.dirtySize=t.dirtySize,this.updateFramebuffer(t,n)):s.dirtySize!==t.dirtySize&&(s.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var o=0;o>n,u=e.height>>n,c=l/e.width;this.setViewport(e.x*c,e.y*c,l,u)}else{var l=t.width>>n,u=t.height>>n;this.setViewport(0,0,l,u)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(t,e,n,i){var s=this.viewport;t=Math.round(t),e=Math.round(e),n=Math.round(n),i=Math.round(i),(s.width!==n||s.height!==i||s.x!==t||s.y!==e)&&(s.x=t,s.y=e,s.width=n,s.height=i,this.gl.viewport(t,e,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(t,e,n,i,s){s===void 0&&(s=tu.COLOR|tu.DEPTH);var o=this.gl;o.clearColor(t,e,n,i),o.clear(s)},r.prototype.initFramebuffer=function(t){var e=this.gl,n=new SI(e.createFramebuffer());return n.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=n,this.managedFramebuffers.push(t),t.disposeRunner.add(this),n},r.prototype.resizeFramebuffer=function(t){var e=this.gl,n=t.glFramebuffers[this.CONTEXT_UID];n.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,n.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,n.multisample,e.RGBA8,t.width,t.height)),n.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,n.stencil),n.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,n.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var i=t.colorTextures,s=i.length;e.drawBuffers||(s=Math.min(s,1));for(var o=0;o1&&this.canMultisampleFramebuffer(t)?(i.msaaBuffer=i.msaaBuffer||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.msaaBuffer),n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.RGBA8,t.width,t.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 a=[],l=0;l1&&n.drawBuffers(a),t.depthTexture){var h=this.writeDepthTexture;if(h){var f=t.depthTexture;this.renderer.texture.bind(f,0),n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,f._glTextures[this.CONTEXT_UID].texture,e)}}(t.stencil||t.depth)&&!(t.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,t.width,t.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,t.width,t.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(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture},r.prototype.detectSamples=function(t){var e=this.msaaSamples,n=Ve.NONE;if(t<=1||e===null)return n;for(var i=0;i=0&&this.managedFramebuffers.splice(s,1),t.disposeRunner.remove(this),e||(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(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var n=0;n=li.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Xo=t}return Xo}var wl;function OI(){if(!wl){wl=Rr.MEDIUM;var r=CI();if(r&&r.getShaderPrecisionFormat){var t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);wl=t.precision?Rr.HIGH:Rr.MEDIUM}}return wl}function Fm(r,t,e){if(r.substring(0,9)!=="precision"){var n=t;return t===Rr.HIGH&&e!==Rr.HIGH&&(n=Rr.MEDIUM),"precision "+n+` float; @@ -562,20 +562,20 @@ PERFORMANCE OF THIS SOFTWARE. * * @pixi/app is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license - */var NE=function(){function r(){}return r.init=function(t){var e=this;Object.defineProperty(this,"resizeTo",{set:function(n){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=n,n&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){e._resizeTo&&(e.cancelResize(),e._resizeId=requestAnimationFrame(function(){return e.resize()}))},this.cancelResize=function(){e._resizeId&&(cancelAnimationFrame(e._resizeId),e._resizeId=null)},this.resize=function(){if(e._resizeTo){e.cancelResize();var n,i;if(e._resizeTo===globalThis.window)n=globalThis.innerWidth,i=globalThis.innerHeight;else{var s=e._resizeTo,o=s.clientWidth,a=s.clientHeight;n=o,i=a}e.renderer.resize(n,i)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},r.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},r.extension=rn.Application,r}(),BE=function(){function r(t){var e=this;this.stage=new su,t=Object.assign({forceCanvas:!1},t),this.renderer=TE(t),r._plugins.forEach(function(n){n.init.call(e,t)})}return r.registerPlugin=function(t){bs("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),qa.add({type:rn.Application,ref:t})},r.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(r.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),r.prototype.destroy=function(t,e){var n=this,i=r._plugins.slice(0);i.reverse(),i.forEach(function(s){s.destroy.call(n)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null},r._plugins=[],r}();qa.handleByList(rn.Application,BE._plugins);qa.add(NE);var qi=Math.pow,De=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())});class Nf{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new Nf}setParameters(t){this._breathParameters=t}getParameters(){return this._breathParameters}updateParameters(t,e){this._currentTime+=e;const n=this._currentTime*2*3.14159;for(let i=0;i=1&&(n=1,this._blinkingState=Gr.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),e=1-n;break;case Gr.EyeState_Closed:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,n>=1&&(this._blinkingState=Gr.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),e=0;break;case Gr.EyeState_Opening:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,n>=1&&(n=1,this._blinkingState=Gr.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),e=n;break;case Gr.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))(Gr||{});const UE=.001,Vm=.5;class Bf{static create(t){const e=new Bf;typeof t.FadeInTime=="number"&&(e._fadeTimeSeconds=t.FadeInTime,e._fadeTimeSeconds<=0&&(e._fadeTimeSeconds=Vm));const n=t.Groups,i=n.length;for(let s=0;sUE){if(s>=0)break;s=u,o=t.getPartOpacityByIndex(c),o+=e/this._fadeTimeSeconds,o>1&&(o=1)}}s<0&&(s=0,o=1);for(let u=n;ul&&(f=1-l/(1-o)),h>f&&(h=f),t.setPartOpacityByIndex(c,h)}}}constructor(){this._fadeTimeSeconds=Vm,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class ou{constructor(t){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],t!=null&&this.assignment(t)}assignment(t){return this.partId=t.partId,this.link=t.link.map(e=>e.clone()),this}initialize(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)}clone(){const t=new ou;return t.partId=this.partId,t.parameterIndex=this.parameterIndex,t.partIndex=this.partIndex,t.link=this.link.map(e=>e.clone()),t}}class ee{constructor(t,e){this.x=t||0,this.y=e||0}add(t){const e=new ee(0,0);return e.x=this.x+t.x,e.y=this.y+t.y,e}substract(t){const e=new ee(0,0);return e.x=this.x-t.x,e.y=this.y-t.y,e}multiply(t){const e=new ee(0,0);return e.x=this.x*t.x,e.y=this.y*t.y,e}multiplyByScaler(t){return this.multiply(new ee(t,t))}division(t){const e=new ee(0,0);return e.x=this.x/t.x,e.y=this.y/t.y,e}divisionByScalar(t){return this.division(new ee(t,t))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(t){return Math.sqrt((this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y))}dot(t){return this.x*t.x+this.y*t.y}normalize(){const t=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/t,this.y=this.y/t}isEqual(t){return this.x==t.x&&this.y==t.y}isNotEqual(t){return!this.isEqual(t)}}const Bl=class{static range(r,t,e){return re&&(r=e),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 t=r;const e=t<0;e&&(t=-t);let n;return t===1/0?n=1/0:(n=Math.exp(Math.log(t)/3),n=(t/(n*n)+2*n)/3),e?-n:n}static getEasingSine(r){return r<0?0:r>1?1:.5-.5*this.cos(r*Math.PI)}static max(r,t){return r>t?r:t}static min(r,t){return r>t?t:r}static degreesToRadian(r){return r/180*Math.PI}static radianToDegrees(r){return r*180/Math.PI}static directionToRadian(r,t){const e=Math.atan2(t.y,t.x),n=Math.atan2(r.y,r.x);let i=e-n;for(;i<-Math.PI;)i+=Math.PI*2;for(;i>Math.PI;)i-=Math.PI*2;return i}static directionToDegrees(r,t){const e=this.directionToRadian(r,t);let n=this.radianToDegrees(e);return t.x-r.x>0&&(n=-n),n}static radianToDirection(r){const t=new ee;return t.x=this.sin(r),t.y=this.cos(r),t}static quadraticEquation(r,t,e){return this.abs(r)1&&(t=1),e<0?e=0:e>1&&(e=1),n<0?n=0:n>1&&(n=1),i<0?i=0:i>1&&(i=1),this._modelColor.R=t,this._modelColor.G=e,this._modelColor.B=n,this._modelColor.A=i}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(t){this._isPremultipliedAlpha=t}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(t){this._isCulling=t}isCulling(){return this._isCulling}setAnisotropy(t){this._anisortopy=t}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new la,this._mvpMatrix4x4=new Jr,this._mvpMatrix4x4.loadIdentity()}}var Mi=(r=>(r[r.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",r[r.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",r[r.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",r))(Mi||{});class la{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let vn=!1,zs=!1,Vs;const ih={vertexOffset:0,vertexStep:2};class La{static startUp(t){if(vn)return Zo("CubismFramework.startUp() is already done."),vn;if(Live2DCubismCore._isStarted)return vn=!0,!0;if(Live2DCubismCore._isStarted=!0,Vs=t,Vs&&Live2DCubismCore.Logging.csmSetLogFunction(Vs.logFunction),vn=!0,vn){const e=Live2DCubismCore.Version.csmGetVersion(),n=(e&4278190080)>>24,i=(e&16711680)>>16,s=e&65535,o=e;Zo("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+n).slice(-2),("00"+i).slice(-2),("0000"+s).slice(-4),o)}return Zo("CubismFramework.startUp() is complete."),vn}static cleanUp(){vn=!1,zs=!1,Vs=void 0}static initialize(){if(!vn){ua("CubismFramework is not started.");return}if(zs){ua("CubismFramework.initialize() skipped, already initialized.");return}zs=!0,Zo("CubismFramework.initialize() is complete.")}static dispose(){if(!vn){ua("CubismFramework is not started.");return}if(!zs){ua("CubismFramework.dispose() skipped, not initialized.");return}Uf.staticRelease(),zs=!1,Zo("CubismFramework.dispose() is complete.")}static isStarted(){return vn}static isInitialized(){return zs}static coreLogFunction(t){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(t)}static getLoggingLevel(){return Vs!=null?Vs.loggingLevel:Rs.LogLevel_Off}constructor(){}}var Rs=(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))(Rs||{});const Il=()=>{};function jm(r,...t){nc.print(Rs.LogLevel_Debug,"[CSM][D]"+r+` + */var NE=function(){function r(){}return r.init=function(t){var e=this;Object.defineProperty(this,"resizeTo",{set:function(n){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=n,n&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get:function(){return this._resizeTo}}),this.queueResize=function(){e._resizeTo&&(e.cancelResize(),e._resizeId=requestAnimationFrame(function(){return e.resize()}))},this.cancelResize=function(){e._resizeId&&(cancelAnimationFrame(e._resizeId),e._resizeId=null)},this.resize=function(){if(e._resizeTo){e.cancelResize();var n,i;if(e._resizeTo===globalThis.window)n=globalThis.innerWidth,i=globalThis.innerHeight;else{var s=e._resizeTo,o=s.clientWidth,a=s.clientHeight;n=o,i=a}e.renderer.resize(n,i)}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null},r.destroy=function(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null},r.extension=rn.Application,r}(),BE=function(){function r(t){var e=this;this.stage=new su,t=Object.assign({forceCanvas:!1},t),this.renderer=TE(t),r._plugins.forEach(function(n){n.init.call(e,t)})}return r.registerPlugin=function(t){bs("6.5.0","Application.registerPlugin() is deprecated, use extensions.add()"),qa.add({type:rn.Application,ref:t})},r.prototype.render=function(){this.renderer.render(this.stage)},Object.defineProperty(r.prototype,"view",{get:function(){return this.renderer.view},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"screen",{get:function(){return this.renderer.screen},enumerable:!1,configurable:!0}),r.prototype.destroy=function(t,e){var n=this,i=r._plugins.slice(0);i.reverse(),i.forEach(function(s){s.destroy.call(n)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null},r._plugins=[],r}();qa.handleByList(rn.Application,BE._plugins);qa.add(NE);var qi=Math.pow,De=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())});class Nf{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new Nf}setParameters(t){this._breathParameters=t}getParameters(){return this._breathParameters}updateParameters(t,e){this._currentTime+=e;const n=this._currentTime*2*3.14159;for(let i=0;i=1&&(n=1,this._blinkingState=Gr.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),e=1-n;break;case Gr.EyeState_Closed:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,n>=1&&(this._blinkingState=Gr.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),e=0;break;case Gr.EyeState_Opening:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,n>=1&&(n=1,this._blinkingState=Gr.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),e=n;break;case Gr.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))(Gr||{});const UE=.001,Vm=.5;class Bf{static create(t){const e=new Bf;typeof t.FadeInTime=="number"&&(e._fadeTimeSeconds=t.FadeInTime,e._fadeTimeSeconds<=0&&(e._fadeTimeSeconds=Vm));const n=t.Groups,i=n.length;for(let s=0;sUE){if(s>=0)break;s=u,o=t.getPartOpacityByIndex(c),o+=e/this._fadeTimeSeconds,o>1&&(o=1)}}s<0&&(s=0,o=1);for(let u=n;ul&&(f=1-l/(1-o)),h>f&&(h=f),t.setPartOpacityByIndex(c,h)}}}constructor(){this._fadeTimeSeconds=Vm,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class ou{constructor(t){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],t!=null&&this.assignment(t)}assignment(t){return this.partId=t.partId,this.link=t.link.map(e=>e.clone()),this}initialize(t){this.parameterIndex=t.getParameterIndex(this.partId),this.partIndex=t.getPartIndex(this.partId),t.setParameterValueByIndex(this.parameterIndex,1)}clone(){const t=new ou;return t.partId=this.partId,t.parameterIndex=this.parameterIndex,t.partIndex=this.partIndex,t.link=this.link.map(e=>e.clone()),t}}class ee{constructor(t,e){this.x=t||0,this.y=e||0}add(t){const e=new ee(0,0);return e.x=this.x+t.x,e.y=this.y+t.y,e}substract(t){const e=new ee(0,0);return e.x=this.x-t.x,e.y=this.y-t.y,e}multiply(t){const e=new ee(0,0);return e.x=this.x*t.x,e.y=this.y*t.y,e}multiplyByScaler(t){return this.multiply(new ee(t,t))}division(t){const e=new ee(0,0);return e.x=this.x/t.x,e.y=this.y/t.y,e}divisionByScalar(t){return this.division(new ee(t,t))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(t){return Math.sqrt((this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y))}dot(t){return this.x*t.x+this.y*t.y}normalize(){const t=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/t,this.y=this.y/t}isEqual(t){return this.x==t.x&&this.y==t.y}isNotEqual(t){return!this.isEqual(t)}}const Bl=class{static range(r,t,e){return re&&(r=e),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 t=r;const e=t<0;e&&(t=-t);let n;return t===1/0?n=1/0:(n=Math.exp(Math.log(t)/3),n=(t/(n*n)+2*n)/3),e?-n:n}static getEasingSine(r){return r<0?0:r>1?1:.5-.5*this.cos(r*Math.PI)}static max(r,t){return r>t?r:t}static min(r,t){return r>t?t:r}static degreesToRadian(r){return r/180*Math.PI}static radianToDegrees(r){return r*180/Math.PI}static directionToRadian(r,t){const e=Math.atan2(t.y,t.x),n=Math.atan2(r.y,r.x);let i=e-n;for(;i<-Math.PI;)i+=Math.PI*2;for(;i>Math.PI;)i-=Math.PI*2;return i}static directionToDegrees(r,t){const e=this.directionToRadian(r,t);let n=this.radianToDegrees(e);return t.x-r.x>0&&(n=-n),n}static radianToDirection(r){const t=new ee;return t.x=this.sin(r),t.y=this.cos(r),t}static quadraticEquation(r,t,e){return this.abs(r)1&&(t=1),e<0?e=0:e>1&&(e=1),n<0?n=0:n>1&&(n=1),i<0?i=0:i>1&&(i=1),this._modelColor.R=t,this._modelColor.G=e,this._modelColor.B=n,this._modelColor.A=i}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(t){this._isPremultipliedAlpha=t}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(t){this._isCulling=t}isCulling(){return this._isCulling}setAnisotropy(t){this._anisortopy=t}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new la,this._mvpMatrix4x4=new Jr,this._mvpMatrix4x4.loadIdentity()}}var Ci=(r=>(r[r.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",r[r.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",r[r.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",r))(Ci||{});class la{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let vn=!1,zs=!1,Vs;const ih={vertexOffset:0,vertexStep:2};class La{static startUp(t){if(vn)return Zo("CubismFramework.startUp() is already done."),vn;if(Live2DCubismCore._isStarted)return vn=!0,!0;if(Live2DCubismCore._isStarted=!0,Vs=t,Vs&&Live2DCubismCore.Logging.csmSetLogFunction(Vs.logFunction),vn=!0,vn){const e=Live2DCubismCore.Version.csmGetVersion(),n=(e&4278190080)>>24,i=(e&16711680)>>16,s=e&65535,o=e;Zo("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+n).slice(-2),("00"+i).slice(-2),("0000"+s).slice(-4),o)}return Zo("CubismFramework.startUp() is complete."),vn}static cleanUp(){vn=!1,zs=!1,Vs=void 0}static initialize(){if(!vn){ua("CubismFramework is not started.");return}if(zs){ua("CubismFramework.initialize() skipped, already initialized.");return}zs=!0,Zo("CubismFramework.initialize() is complete.")}static dispose(){if(!vn){ua("CubismFramework is not started.");return}if(!zs){ua("CubismFramework.dispose() skipped, not initialized.");return}Uf.staticRelease(),zs=!1,Zo("CubismFramework.dispose() is complete.")}static isStarted(){return vn}static isInitialized(){return zs}static coreLogFunction(t){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(t)}static getLoggingLevel(){return Vs!=null?Vs.loggingLevel:Rs.LogLevel_Off}constructor(){}}var Rs=(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))(Rs||{});const Il=()=>{};function jm(r,...t){nc.print(Rs.LogLevel_Debug,"[CSM][D]"+r+` `,t)}function Zo(r,...t){nc.print(Rs.LogLevel_Info,"[CSM][I]"+r+` `,t)}function ua(r,...t){nc.print(Rs.LogLevel_Warning,"[CSM][W]"+r+` `,t)}function Ys(r,...t){nc.print(Rs.LogLevel_Error,"[CSM][E]"+r+` `,t)}class nc{static print(t,e,n){if(tn[a]);i(s)}static dumpBytes(t,e,n){for(let i=0;i0?this.print(t,` `):i%8==0&&i>0&&this.print(t," "),this.print(t,"{0} ",[e[i]&255]);this.print(t,` -`)}constructor(){}}class kE{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 t=this._model.parameters.count,e=this._savedParameters.length;for(let n=0;ne&&(e=this._model.parameters.minimumValues[t]),this._parameterValues[t]=n==1?e:this._parameterValues[t]=this._parameterValues[t]*(1-n)+e*n}setParameterValueById(t,e,n=1){const i=this.getParameterIndex(t);this.setParameterValueByIndex(i,e,n)}addParameterValueByIndex(t,e,n=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+e*n)}addParameterValueById(t,e,n=1){const i=this.getParameterIndex(t);this.addParameterValueByIndex(i,e,n)}multiplyParameterValueById(t,e,n=1){const i=this.getParameterIndex(t);this.multiplyParameterValueByIndex(i,e,n)}multiplyParameterValueByIndex(t,e,n=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(e-1)*n))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(t){const e=this._model.drawables.count;for(let n=0;ne&&(t=e);for(let n=0;n0&&e.getEndTime()(r[r.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",r[r.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",r[r.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",r))(ss||{}),Na;(r=>{r.supportMoreMaskDivisions=!0,r.setOpacityFromMotion=!1})(Na||(Na={}));var os=(r=>(r[r.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",r[r.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",r[r.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",r))(os||{}),Tn=(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))(Tn||{});class xi{constructor(t=0,e=0){this.time=t,this.value=e}}class zE{constructor(){this.basePointIndex=0,this.segmentType=0}}class VE{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class jE{constructor(){this.fireTime=0,this.value=""}}class $E{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 G0{constructor(t){this._json=t}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(t){return Vf.EvaluationOptionFlag_AreBeziersRistricted==t?!!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(t){return this._json.Curves[t].Target}getMotionCurveId(t){return this._json.Curves[t].Id}getMotionCurveFadeInTime(t){return this._json.Curves[t].FadeInTime}getMotionCurveFadeOutTime(t){return this._json.Curves[t].FadeOutTime}getMotionCurveSegmentCount(t){return this._json.Curves[t].Segments.length}getMotionCurveSegment(t,e){return this._json.Curves[t].Segments[e]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(t){return this._json.UserData[t].Time}getEventValue(t){return this._json.UserData[t].Value}}var Vf=(r=>(r[r.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",r))(Vf||{});const GE="EyeBlink",WE="LipSync",HE="Model",XE="Parameter",YE="PartOpacity",qE=!1;function Qr(r,t,e){const n=new xi;return n.time=r.time+(t.time-r.time)*e,n.value=r.value+(t.value-r.value)*e,n}function QE(r,t){let e=(t-r[0].time)/(r[1].time-r[0].time);return e<0&&(e=0),r[0].value+(r[1].value-r[0].value)*e}function ZE(r,t){let e=(t-r[0].time)/(r[3].time-r[0].time);e<0&&(e=0);const n=Qr(r[0],r[1],e),i=Qr(r[1],r[2],e),s=Qr(r[2],r[3],e),o=Qr(n,i,e),a=Qr(i,s,e);return Qr(o,a,e).value}function KE(r,t){const e=t,n=r[0].time,i=r[3].time,s=r[1].time,o=r[2].time,a=i-3*o+3*s-n,l=3*o-6*s+3*n,u=3*s-3*n,c=n-e,h=Me.cardanoAlgorithmForBezier(a,l,u,c),f=Qr(r[0],r[1],h),d=Qr(r[1],r[2],h),m=Qr(r[2],r[3],h),g=Qr(f,d,h),p=Qr(d,m,h);return Qr(g,p,h).value}function JE(r,t){return r[0].value}function tA(r,t){return r[1].value}function sh(r,t,e){const n=r.curves[t];let i=-1;const s=n.baseSegmentIndex+n.segmentCount;let o=0;for(let l=n.baseSegmentIndex;le){i=l;break}if(i==-1)return r.points[o].value;const a=r.segments[i];return a.evaluate(r.points.slice(a.basePointIndex),e)}class jf extends $0{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(t,e){const n=new jf;return n.parse(t),n._sourceFrameRate=n._motionData.fps,n._loopDurationSeconds=n._motionData.duration,n._onFinishedMotion=e,n}doUpdateParameters(t,e,n,i){this._modelCurveIdEyeBlink==null&&(this._modelCurveIdEyeBlink=GE),this._modelCurveIdLipSync==null&&(this._modelCurveIdLipSync=WE);let s=e-i.getStartTime();s<0&&(s=0);let o=Number.MAX_VALUE,a=Number.MAX_VALUE;const l=64;let u=0,c=0;this._eyeBlinkParameterIds.length>l&&jm("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>l&&jm("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const h=this._fadeInSeconds<=0?1:Me.getEasingSine((e-i.getFadeInStartTime())/this._fadeInSeconds),f=this._fadeOutSeconds<=0||i.getEndTime()<0?1:Me.getEasingSine((i.getEndTime()-e)/this._fadeOutSeconds);let d,m,g,p=s;if(this._isLoop)for(;p>this._motionData.duration;)p-=this._motionData.duration;const y=this._motionData.curves;for(m=0;m>_&1)continue;const T=S+(a-S)*n;t.setParameterValueById(this._eyeBlinkParameterIds[_],T)}if(o!=Number.MAX_VALUE)for(let _=0;_>_&1)continue;const T=S+(o-S)*n;t.setParameterValueById(this._lipSyncParameterIds[_],T)}}for(;m=this._motionData.duration&&(this._isLoop?(i.setStartTime(e),this._isLoopFadeIn&&i.setFadeInStartTime(e)):(this._onFinishedMotion&&this._onFinishedMotion(this),i.setIsFinished(!0))),this._lastWeight=n}setIsLoop(t){this._isLoop=t}isLoop(){return this._isLoop}setIsLoopFadeIn(t){this._isLoopFadeIn=t}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(t,e){const n=this._motionData.curves;for(let i=0;inew VE),this._motionData.segments=Array.from({length:e.getMotionTotalSegmentCount()}).map(()=>new zE),this._motionData.events=Array.from({length:this._motionData.eventCount}).map(()=>new jE),this._motionData.points=[];let o=0,a=0;for(let l=0;lt&&this._motionData.events[n].fireTime<=e&&this._firedEventValues.push(this._motionData.events[n].value);return this._firedEventValues}}class eA{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(t){this._fadeOutSeconds=t,this._isTriggeredFadeOut=!0}startFadeOut(t,e){const n=e+t;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||ne!=null&&e._motionQueueEntryHandle==t)}setEventCallback(t,e=null){this._eventCallBack=t,this._eventCustomData=e}doUpdateMotion(t,e){let n=!1,i=0;for(;i(r[r.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",r))(Jh||{}),as=(r=>(r[r.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",r[r.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",r[r.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",r))(as||{});class nA{constructor(){this.initialPosition=new ee(0,0),this.position=new ee(0,0),this.lastPosition=new ee(0,0),this.lastGravity=new ee(0,0),this.force=new ee(0,0),this.velocity=new ee(0,0)}}class iA{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class sA{constructor(){this.source={}}}class oA{constructor(){this.destination={},this.translationScale=new ee(0,0)}}class aA{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new ee(0,0),this.wind=new ee(0,0)}}class lA{constructor(t){this._json=t}release(){this._json=void 0}getGravity(){const t=new ee(0,0);return t.x=this._json.Meta.EffectiveForces.Gravity.X,t.y=this._json.Meta.EffectiveForces.Gravity.Y,t}getWind(){const t=new ee(0,0);return t.x=this._json.Meta.EffectiveForces.Wind.X,t.y=this._json.Meta.EffectiveForces.Wind.Y,t}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(t){return this._json.PhysicsSettings[t].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Default}getNormalizationAngleMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Default}getInputCount(t){return this._json.PhysicsSettings[t].Input.length}getInputWeight(t,e){return this._json.PhysicsSettings[t].Input[e].Weight}getInputReflect(t,e){return this._json.PhysicsSettings[t].Input[e].Reflect}getInputType(t,e){return this._json.PhysicsSettings[t].Input[e].Type}getInputSourceId(t,e){return this._json.PhysicsSettings[t].Input[e].Source.Id}getOutputCount(t){return this._json.PhysicsSettings[t].Output.length}getOutputVertexIndex(t,e){return this._json.PhysicsSettings[t].Output[e].VertexIndex}getOutputAngleScale(t,e){return this._json.PhysicsSettings[t].Output[e].Scale}getOutputWeight(t,e){return this._json.PhysicsSettings[t].Output[e].Weight}getOutputDestinationId(t,e){return this._json.PhysicsSettings[t].Output[e].Destination.Id}getOutputType(t,e){return this._json.PhysicsSettings[t].Output[e].Type}getOutputReflect(t,e){return this._json.PhysicsSettings[t].Output[e].Reflect}getParticleCount(t){return this._json.PhysicsSettings[t].Vertices.length}getParticleMobility(t,e){return this._json.PhysicsSettings[t].Vertices[e].Mobility}getParticleDelay(t,e){return this._json.PhysicsSettings[t].Vertices[e].Delay}getParticleAcceleration(t,e){return this._json.PhysicsSettings[t].Vertices[e].Acceleration}getParticleRadius(t,e){return this._json.PhysicsSettings[t].Vertices[e].Radius}getParticlePosition(t,e){const n=new ee(0,0);return n.x=this._json.PhysicsSettings[t].Vertices[e].Position.X,n.y=this._json.PhysicsSettings[t].Vertices[e].Position.Y,n}}const Gm="X",Wm="Y",Hm="Angle",uA=5,H0=100,cA=.001;class $f{static create(t){const e=new $f;return e.parse(t),e._physicsRig.gravity.y=0,e}evaluate(t,e){let n,i,s,o;const a=new ee;let l,u,c,h,f,d,m,g;f=t.getModel().parameters.values,d=t.getModel().parameters.maximumValues,m=t.getModel().parameters.minimumValues,g=t.getModel().parameters.defaultValues;for(let p=0;p=l.particleCount)break;c[y].destinationParameterIndex==-1&&(c[y].destinationParameterIndex=t.getParameterIndex(c[y].destination.id));const S=new ee;S.x=h[_].position.x-h[_-1].position.x,S.y=h[_].position.y-h[_-1].position.y,o=c[y].getValue(S,h,_,c[y].reflect,this._options.gravity);const T=c[y].destinationParameterIndex,v=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(f.subarray(T))):f.slice(T);TA(v,m[T],d[T],o,c[y]);for(let E=T,w=0;E=2?i=t[e-1].position.substract(t[e-2].position):i=i.multiplyByScaler(-1),s=Me.directionToRadian(i,r),n&&(s*=-1),s}function vA(r,t){return Math.abs(Math.max(r,t)-Math.min(r,t))}function _A(r,t){return Math.min(r,t)+vA(r,t)/2}function bA(r,t){return r.x}function wA(r,t){return r.y}function xA(r,t){return t}function SA(r,t,e,n,i,s,o,a){let l,u,c,h,f=new ee(0,0),d=new ee(0,0),m=new ee(0,0),g=new ee(0,0);r[0].position=new ee(e.x,e.y),l=Me.degreesToRadian(n),h=Me.radianToDirection(l),h.normalize();for(let p=1;pe&&(o>i.valueExceededMaximum&&(i.valueExceededMaximum=o),o=e),a=i.weight/H0,a>=1||(o=r[0]*(1-a)+o*a),r[0]=o}function Gf(r,t,e,n,i,s,o,a){let l=0;const u=Me.max(e,t);ur&&(r=c);const h=Me.min(i,s),f=Me.max(i,s),d=o,m=_A(c,u),g=r-m;switch(Math.sign(g)){case 1:{const p=f-d,y=u-m;y!=0&&(l=g*(p/y),l+=d);break}case-1:{const p=h-d,y=c-m;y!=0&&(l=g*(p/y),l+=d);break}case 0:{l=d;break}}return a?l:l*-1}class td{constructor(t=0,e=0,n=0,i=0){this.x=t,this.y=e,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(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}expand(t,e){this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2}}const oh=4,IA=10;let Qi,ca,ed;class ah{getChannelFlagAsColor(t){return this._channelColors[t]}getMaskRenderTexture(){let t=0;if(this._maskTexture&&this._maskTexture.texture!=0&&(this._maskTexture.frameNo=this._currentFrameNo,t=this._maskTexture.texture),t==0){const e=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,e,e,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),t=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,ed),this._maskTexture=new EA(this._currentFrameNo,t)}return t}setGL(t){this.gl=t}calcClippedDrawTotalBounds(t,e){let n=Number.MAX_VALUE,i=Number.MAX_VALUE,s=Number.MIN_VALUE,o=Number.MIN_VALUE;const a=e._clippedDrawableIndexList.length;for(let l=0;lm&&(m=_),Sg&&(g=S)}if(f!=Number.MAX_VALUE)if(fs&&(s=m),g>o&&(o=g),n==Number.MAX_VALUE)e._allClippedDrawRect.x=0,e._allClippedDrawRect.y=0,e._allClippedDrawRect.width=0,e._allClippedDrawRect.height=0,e._isUsing=!1;else{e._isUsing=!0;const y=s-n,_=o-i;e._allClippedDrawRect.x=n,e._allClippedDrawRect.y=i,e._allClippedDrawRect.width=y,e._allClippedDrawRect.height=_}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new td,this._tmpMatrix=new Jr,this._tmpMatrixForMask=new Jr,this._tmpMatrixForDraw=new Jr;let t=new la;t.R=1,t.G=0,t.B=0,t.A=0,this._channelColors.push(t),t=new la,t.R=0,t.G=1,t.B=0,t.A=0,this._channelColors.push(t),t=new la,t.R=0,t.G=0,t.B=1,t.A=0,this._channelColors.push(t),t=new la,t.R=0,t.G=0,t.B=0,t.A=1,this._channelColors.push(t)}release(){var t,e,n;const i=this;for(let s=0;s0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),e.getMvpMatrix(),e.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))(ha||{});const MA="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;}",CA="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;}",OA="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;}",Xm="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;}",PA="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;}",RA="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;}",FA="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 X0 extends Uf{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new ah,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(t){t.isUsingMasking()&&(this._clippingManager=new ah,this._clippingManager.initialize(t,t.getDrawableCount(),t.getDrawableMasks(),t.getDrawableMaskCounts()));for(let e=t.getDrawableCount()-1;e>=0;e--)this._sortedDrawableIndexList[e]=0;super.initialize(t)}bindTexture(t,e){this._textures[t]=e}getBindedTextures(){return this._textures}setClippingMaskBufferSize(t){this._clippingManager.release(),this._clippingManager=new ah,this._clippingManager.setClippingMaskBufferSize(t),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var t,e,n;const i=this;this._clippingManager.release(),i._clippingManager=void 0,(t=this.gl)==null||t.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,(e=this.gl)==null||e.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 t=this.getModel().getDrawableCount(),e=this.getModel().getDrawableRenderOrders();for(let n=0;n{X0.doStaticRelease()};class Y0{constructor(t){this.groups=t.Groups,this.hitAreas=t.HitAreas,this.layout=t.Layout,this.moc=t.FileReferences.Moc,this.expressions=t.FileReferences.Expressions,this.motions=t.FileReferences.Motions,this.textures=t.FileReferences.Textures,this.physics=t.FileReferences.Physics,this.pose=t.FileReferences.Pose}getEyeBlinkParameters(){var t,e;return(e=(t=this.groups)==null?void 0:t.find(n=>n.Name==="EyeBlink"))==null?void 0:e.Ids}getLipSyncParameters(){var t,e;return(e=(t=this.groups)==null?void 0:t.find(n=>n.Name==="LipSync"))==null?void 0:e.Ids}}const DA="ParamAngleX",LA="ParamAngleY",NA="ParamAngleZ",BA="ParamEyeBallX",UA="ParamEyeBallY",kA="ParamBodyAngleX",zA="ParamBreath",Ym=2,qm=2;var Mr;(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=Na})(Mr||(Mr={}));const Se={log(r,...t){Mr.logLevel<=Mr.LOG_LEVEL_VERBOSE&&console.log(`[${r}]`,...t)},warn(r,...t){Mr.logLevel<=Mr.LOG_LEVEL_WARNING&&console.warn(`[${r}]`,...t)},error(r,...t){Mr.logLevel<=Mr.LOG_LEVEL_ERROR&&console.error(`[${r}]`,...t)}};function Qm(r,t,e){return re?e:r}function q0(r,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})}function VA(r){let t=r.lastIndexOf("/");return t!=-1&&(r=r.slice(0,t)),t=r.lastIndexOf("/"),t!==-1&&(r=r.slice(t+1)),r}function jA(r,t){const e=r.indexOf(t);e!==-1&&r.splice(e,1)}class Q0 extends ki{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return De(this,null,function*(){if(!this.definitions[t]){Se.warn(this.tag,`Undefined expression at [${t}]`);return}if(this.expressions[t]===null){Se.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);return}if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e})}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return De(this,null,function*(){if(this.definitions.length){const t=[];for(let e=0;e-1&&tu&&(o*=u/l,a*=u/l),this.vx+=o,this.vy+=a;const c=Math.sqrt(qi(this.vx,2)+qi(this.vy,2)),h=.5*(Math.sqrt(qi(u,2)+8*u*i)-u);c>h&&(this.vx*=h/c,this.vy*=h/c),this.x+=this.vx,this.y+=this.vy}}class Wf{constructor(t){this.json=t;let e=t.url;if(typeof e!="string")throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=VA(this.url)}resolveURL(t){return rc.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),this.pose!==void 0&&(this.pose=t(this.pose,"pose")),this.physics!==void 0&&(this.physics=t(this.physics,"physics"));for(let e=0;e(t.push(e),e)),t}validateFiles(t){const e=(s,o)=>{const a=this.resolveURL(s);if(!t.includes(a)){if(o)throw new Error(`File "${s}" is defined in settings, but doesn't exist in given files`);return!1}return!0};return[this.moc,...this.textures].forEach(s=>e(s,!0)),this.getDefinedFiles().filter(s=>e(s,!1))}}var rd=(r=>(r[r.NONE=0]="NONE",r[r.IDLE=1]="IDLE",r[r.NORMAL=2]="NORMAL",r[r.FORCE=3]="FORCE",r))(rd||{});class HA{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,n){if(n<=0)return Se.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return Se.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return Se.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(n===1){if(this.currentPriority!==0)return Se.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(this.reservedIdleGroup!==void 0)return Se.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(n<3){if(n<=this.currentPriority)return Se.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(n<=this.reservePriority)return Se.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,n)}return!0}start(t,e,n,i){if(i===1){if(this.setReservedIdle(void 0,void 0),this.currentPriority!==0)return Se.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,n)),!1}else{if(e!==this.reservedGroup||n!==this.reservedIndex)return Se.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,n)),!1;this.setReserved(void 0,void 0,0)}return t?(this.setCurrent(e,n,i),!0):!1}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,n){this.currentPriority=n,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,n){this.reservePriority=n,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===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!Mr.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){const n=["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"];return` +`)}constructor(){}}class kE{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 t=this._model.parameters.count,e=this._savedParameters.length;for(let n=0;ne&&(e=this._model.parameters.minimumValues[t]),this._parameterValues[t]=n==1?e:this._parameterValues[t]=this._parameterValues[t]*(1-n)+e*n}setParameterValueById(t,e,n=1){const i=this.getParameterIndex(t);this.setParameterValueByIndex(i,e,n)}addParameterValueByIndex(t,e,n=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)+e*n)}addParameterValueById(t,e,n=1){const i=this.getParameterIndex(t);this.addParameterValueByIndex(i,e,n)}multiplyParameterValueById(t,e,n=1){const i=this.getParameterIndex(t);this.multiplyParameterValueByIndex(i,e,n)}multiplyParameterValueByIndex(t,e,n=1){this.setParameterValueByIndex(t,this.getParameterValueByIndex(t)*(1+(e-1)*n))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(t){const e=this._model.drawables.count;for(let n=0;ne&&(t=e);for(let n=0;n0&&e.getEndTime()(r[r.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",r[r.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",r[r.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",r))(ss||{}),Na;(r=>{r.supportMoreMaskDivisions=!0,r.setOpacityFromMotion=!1})(Na||(Na={}));var os=(r=>(r[r.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",r[r.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",r[r.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",r))(os||{}),Tn=(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))(Tn||{});class Si{constructor(t=0,e=0){this.time=t,this.value=e}}class zE{constructor(){this.basePointIndex=0,this.segmentType=0}}class VE{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class jE{constructor(){this.fireTime=0,this.value=""}}class $E{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 G0{constructor(t){this._json=t}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(t){return Vf.EvaluationOptionFlag_AreBeziersRistricted==t?!!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(t){return this._json.Curves[t].Target}getMotionCurveId(t){return this._json.Curves[t].Id}getMotionCurveFadeInTime(t){return this._json.Curves[t].FadeInTime}getMotionCurveFadeOutTime(t){return this._json.Curves[t].FadeOutTime}getMotionCurveSegmentCount(t){return this._json.Curves[t].Segments.length}getMotionCurveSegment(t,e){return this._json.Curves[t].Segments[e]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(t){return this._json.UserData[t].Time}getEventValue(t){return this._json.UserData[t].Value}}var Vf=(r=>(r[r.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",r))(Vf||{});const GE="EyeBlink",WE="LipSync",HE="Model",XE="Parameter",YE="PartOpacity",qE=!1;function Qr(r,t,e){const n=new Si;return n.time=r.time+(t.time-r.time)*e,n.value=r.value+(t.value-r.value)*e,n}function QE(r,t){let e=(t-r[0].time)/(r[1].time-r[0].time);return e<0&&(e=0),r[0].value+(r[1].value-r[0].value)*e}function ZE(r,t){let e=(t-r[0].time)/(r[3].time-r[0].time);e<0&&(e=0);const n=Qr(r[0],r[1],e),i=Qr(r[1],r[2],e),s=Qr(r[2],r[3],e),o=Qr(n,i,e),a=Qr(i,s,e);return Qr(o,a,e).value}function KE(r,t){const e=t,n=r[0].time,i=r[3].time,s=r[1].time,o=r[2].time,a=i-3*o+3*s-n,l=3*o-6*s+3*n,u=3*s-3*n,c=n-e,h=Me.cardanoAlgorithmForBezier(a,l,u,c),f=Qr(r[0],r[1],h),d=Qr(r[1],r[2],h),m=Qr(r[2],r[3],h),g=Qr(f,d,h),p=Qr(d,m,h);return Qr(g,p,h).value}function JE(r,t){return r[0].value}function tA(r,t){return r[1].value}function sh(r,t,e){const n=r.curves[t];let i=-1;const s=n.baseSegmentIndex+n.segmentCount;let o=0;for(let l=n.baseSegmentIndex;le){i=l;break}if(i==-1)return r.points[o].value;const a=r.segments[i];return a.evaluate(r.points.slice(a.basePointIndex),e)}class jf extends $0{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(t,e){const n=new jf;return n.parse(t),n._sourceFrameRate=n._motionData.fps,n._loopDurationSeconds=n._motionData.duration,n._onFinishedMotion=e,n}doUpdateParameters(t,e,n,i){this._modelCurveIdEyeBlink==null&&(this._modelCurveIdEyeBlink=GE),this._modelCurveIdLipSync==null&&(this._modelCurveIdLipSync=WE);let s=e-i.getStartTime();s<0&&(s=0);let o=Number.MAX_VALUE,a=Number.MAX_VALUE;const l=64;let u=0,c=0;this._eyeBlinkParameterIds.length>l&&jm("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>l&&jm("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const h=this._fadeInSeconds<=0?1:Me.getEasingSine((e-i.getFadeInStartTime())/this._fadeInSeconds),f=this._fadeOutSeconds<=0||i.getEndTime()<0?1:Me.getEasingSine((i.getEndTime()-e)/this._fadeOutSeconds);let d,m,g,p=s;if(this._isLoop)for(;p>this._motionData.duration;)p-=this._motionData.duration;const y=this._motionData.curves;for(m=0;m>_&1)continue;const T=S+(a-S)*n;t.setParameterValueById(this._eyeBlinkParameterIds[_],T)}if(o!=Number.MAX_VALUE)for(let _=0;_>_&1)continue;const T=S+(o-S)*n;t.setParameterValueById(this._lipSyncParameterIds[_],T)}}for(;m=this._motionData.duration&&(this._isLoop?(i.setStartTime(e),this._isLoopFadeIn&&i.setFadeInStartTime(e)):(this._onFinishedMotion&&this._onFinishedMotion(this),i.setIsFinished(!0))),this._lastWeight=n}setIsLoop(t){this._isLoop=t}isLoop(){return this._isLoop}setIsLoopFadeIn(t){this._isLoopFadeIn=t}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(t,e){const n=this._motionData.curves;for(let i=0;inew VE),this._motionData.segments=Array.from({length:e.getMotionTotalSegmentCount()}).map(()=>new zE),this._motionData.events=Array.from({length:this._motionData.eventCount}).map(()=>new jE),this._motionData.points=[];let o=0,a=0;for(let l=0;lt&&this._motionData.events[n].fireTime<=e&&this._firedEventValues.push(this._motionData.events[n].value);return this._firedEventValues}}class eA{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(t){this._fadeOutSeconds=t,this._isTriggeredFadeOut=!0}startFadeOut(t,e){const n=e+t;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||ne!=null&&e._motionQueueEntryHandle==t)}setEventCallback(t,e=null){this._eventCallBack=t,this._eventCustomData=e}doUpdateMotion(t,e){let n=!1,i=0;for(;i(r[r.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",r))(Jh||{}),as=(r=>(r[r.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",r[r.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",r[r.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",r))(as||{});class nA{constructor(){this.initialPosition=new ee(0,0),this.position=new ee(0,0),this.lastPosition=new ee(0,0),this.lastGravity=new ee(0,0),this.force=new ee(0,0),this.velocity=new ee(0,0)}}class iA{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class sA{constructor(){this.source={}}}class oA{constructor(){this.destination={},this.translationScale=new ee(0,0)}}class aA{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new ee(0,0),this.wind=new ee(0,0)}}class lA{constructor(t){this._json=t}release(){this._json=void 0}getGravity(){const t=new ee(0,0);return t.x=this._json.Meta.EffectiveForces.Gravity.X,t.y=this._json.Meta.EffectiveForces.Gravity.Y,t}getWind(){const t=new ee(0,0);return t.x=this._json.Meta.EffectiveForces.Wind.X,t.y=this._json.Meta.EffectiveForces.Wind.Y,t}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(t){return this._json.PhysicsSettings[t].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Position.Default}getNormalizationAngleMinimumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(t){return this._json.PhysicsSettings[t].Normalization.Angle.Default}getInputCount(t){return this._json.PhysicsSettings[t].Input.length}getInputWeight(t,e){return this._json.PhysicsSettings[t].Input[e].Weight}getInputReflect(t,e){return this._json.PhysicsSettings[t].Input[e].Reflect}getInputType(t,e){return this._json.PhysicsSettings[t].Input[e].Type}getInputSourceId(t,e){return this._json.PhysicsSettings[t].Input[e].Source.Id}getOutputCount(t){return this._json.PhysicsSettings[t].Output.length}getOutputVertexIndex(t,e){return this._json.PhysicsSettings[t].Output[e].VertexIndex}getOutputAngleScale(t,e){return this._json.PhysicsSettings[t].Output[e].Scale}getOutputWeight(t,e){return this._json.PhysicsSettings[t].Output[e].Weight}getOutputDestinationId(t,e){return this._json.PhysicsSettings[t].Output[e].Destination.Id}getOutputType(t,e){return this._json.PhysicsSettings[t].Output[e].Type}getOutputReflect(t,e){return this._json.PhysicsSettings[t].Output[e].Reflect}getParticleCount(t){return this._json.PhysicsSettings[t].Vertices.length}getParticleMobility(t,e){return this._json.PhysicsSettings[t].Vertices[e].Mobility}getParticleDelay(t,e){return this._json.PhysicsSettings[t].Vertices[e].Delay}getParticleAcceleration(t,e){return this._json.PhysicsSettings[t].Vertices[e].Acceleration}getParticleRadius(t,e){return this._json.PhysicsSettings[t].Vertices[e].Radius}getParticlePosition(t,e){const n=new ee(0,0);return n.x=this._json.PhysicsSettings[t].Vertices[e].Position.X,n.y=this._json.PhysicsSettings[t].Vertices[e].Position.Y,n}}const Gm="X",Wm="Y",Hm="Angle",uA=5,H0=100,cA=.001;class $f{static create(t){const e=new $f;return e.parse(t),e._physicsRig.gravity.y=0,e}evaluate(t,e){let n,i,s,o;const a=new ee;let l,u,c,h,f,d,m,g;f=t.getModel().parameters.values,d=t.getModel().parameters.maximumValues,m=t.getModel().parameters.minimumValues,g=t.getModel().parameters.defaultValues;for(let p=0;p=l.particleCount)break;c[y].destinationParameterIndex==-1&&(c[y].destinationParameterIndex=t.getParameterIndex(c[y].destination.id));const S=new ee;S.x=h[_].position.x-h[_-1].position.x,S.y=h[_].position.y-h[_-1].position.y,o=c[y].getValue(S,h,_,c[y].reflect,this._options.gravity);const T=c[y].destinationParameterIndex,v=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(f.subarray(T))):f.slice(T);TA(v,m[T],d[T],o,c[y]);for(let E=T,w=0;E=2?i=t[e-1].position.substract(t[e-2].position):i=i.multiplyByScaler(-1),s=Me.directionToRadian(i,r),n&&(s*=-1),s}function vA(r,t){return Math.abs(Math.max(r,t)-Math.min(r,t))}function _A(r,t){return Math.min(r,t)+vA(r,t)/2}function bA(r,t){return r.x}function wA(r,t){return r.y}function xA(r,t){return t}function SA(r,t,e,n,i,s,o,a){let l,u,c,h,f=new ee(0,0),d=new ee(0,0),m=new ee(0,0),g=new ee(0,0);r[0].position=new ee(e.x,e.y),l=Me.degreesToRadian(n),h=Me.radianToDirection(l),h.normalize();for(let p=1;pe&&(o>i.valueExceededMaximum&&(i.valueExceededMaximum=o),o=e),a=i.weight/H0,a>=1||(o=r[0]*(1-a)+o*a),r[0]=o}function Gf(r,t,e,n,i,s,o,a){let l=0;const u=Me.max(e,t);ur&&(r=c);const h=Me.min(i,s),f=Me.max(i,s),d=o,m=_A(c,u),g=r-m;switch(Math.sign(g)){case 1:{const p=f-d,y=u-m;y!=0&&(l=g*(p/y),l+=d);break}case-1:{const p=h-d,y=c-m;y!=0&&(l=g*(p/y),l+=d);break}case 0:{l=d;break}}return a?l:l*-1}class td{constructor(t=0,e=0,n=0,i=0){this.x=t,this.y=e,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(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}expand(t,e){this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2}}const oh=4,IA=10;let Qi,ca,ed;class ah{getChannelFlagAsColor(t){return this._channelColors[t]}getMaskRenderTexture(){let t=0;if(this._maskTexture&&this._maskTexture.texture!=0&&(this._maskTexture.frameNo=this._currentFrameNo,t=this._maskTexture.texture),t==0){const e=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,e,e,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),t=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,t),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,ed),this._maskTexture=new EA(this._currentFrameNo,t)}return t}setGL(t){this.gl=t}calcClippedDrawTotalBounds(t,e){let n=Number.MAX_VALUE,i=Number.MAX_VALUE,s=Number.MIN_VALUE,o=Number.MIN_VALUE;const a=e._clippedDrawableIndexList.length;for(let l=0;lm&&(m=_),Sg&&(g=S)}if(f!=Number.MAX_VALUE)if(fs&&(s=m),g>o&&(o=g),n==Number.MAX_VALUE)e._allClippedDrawRect.x=0,e._allClippedDrawRect.y=0,e._allClippedDrawRect.width=0,e._allClippedDrawRect.height=0,e._isUsing=!1;else{e._isUsing=!0;const y=s-n,_=o-i;e._allClippedDrawRect.x=n,e._allClippedDrawRect.y=i,e._allClippedDrawRect.width=y,e._allClippedDrawRect.height=_}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new td,this._tmpMatrix=new Jr,this._tmpMatrixForMask=new Jr,this._tmpMatrixForDraw=new Jr;let t=new la;t.R=1,t.G=0,t.B=0,t.A=0,this._channelColors.push(t),t=new la,t.R=0,t.G=1,t.B=0,t.A=0,this._channelColors.push(t),t=new la,t.R=0,t.G=0,t.B=1,t.A=0,this._channelColors.push(t),t=new la,t.R=0,t.G=0,t.B=0,t.A=1,this._channelColors.push(t)}release(){var t,e,n;const i=this;for(let s=0;s0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),e.getMvpMatrix(),e.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))(ha||{});const MA="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;}",CA="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;}",OA="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;}",Xm="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;}",PA="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;}",RA="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;}",FA="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 X0 extends Uf{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new ah,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(t){t.isUsingMasking()&&(this._clippingManager=new ah,this._clippingManager.initialize(t,t.getDrawableCount(),t.getDrawableMasks(),t.getDrawableMaskCounts()));for(let e=t.getDrawableCount()-1;e>=0;e--)this._sortedDrawableIndexList[e]=0;super.initialize(t)}bindTexture(t,e){this._textures[t]=e}getBindedTextures(){return this._textures}setClippingMaskBufferSize(t){this._clippingManager.release(),this._clippingManager=new ah,this._clippingManager.setClippingMaskBufferSize(t),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var t,e,n;const i=this;this._clippingManager.release(),i._clippingManager=void 0,(t=this.gl)==null||t.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,(e=this.gl)==null||e.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 t=this.getModel().getDrawableCount(),e=this.getModel().getDrawableRenderOrders();for(let n=0;n{X0.doStaticRelease()};class Y0{constructor(t){this.groups=t.Groups,this.hitAreas=t.HitAreas,this.layout=t.Layout,this.moc=t.FileReferences.Moc,this.expressions=t.FileReferences.Expressions,this.motions=t.FileReferences.Motions,this.textures=t.FileReferences.Textures,this.physics=t.FileReferences.Physics,this.pose=t.FileReferences.Pose}getEyeBlinkParameters(){var t,e;return(e=(t=this.groups)==null?void 0:t.find(n=>n.Name==="EyeBlink"))==null?void 0:e.Ids}getLipSyncParameters(){var t,e;return(e=(t=this.groups)==null?void 0:t.find(n=>n.Name==="LipSync"))==null?void 0:e.Ids}}const DA="ParamAngleX",LA="ParamAngleY",NA="ParamAngleZ",BA="ParamEyeBallX",UA="ParamEyeBallY",kA="ParamBodyAngleX",zA="ParamBreath",Ym=2,qm=2;var Mr;(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=Na})(Mr||(Mr={}));const Se={log(r,...t){Mr.logLevel<=Mr.LOG_LEVEL_VERBOSE&&console.log(`[${r}]`,...t)},warn(r,...t){Mr.logLevel<=Mr.LOG_LEVEL_WARNING&&console.warn(`[${r}]`,...t)},error(r,...t){Mr.logLevel<=Mr.LOG_LEVEL_ERROR&&console.error(`[${r}]`,...t)}};function Qm(r,t,e){return re?e:r}function q0(r,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n))})})}function VA(r){let t=r.lastIndexOf("/");return t!=-1&&(r=r.slice(0,t)),t=r.lastIndexOf("/"),t!==-1&&(r=r.slice(t+1)),r}function jA(r,t){const e=r.indexOf(t);e!==-1&&r.splice(e,1)}class Q0 extends ki{constructor(t,e){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=t,this.tag=`ExpressionManager(${t.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(t){return De(this,null,function*(){if(!this.definitions[t]){Se.warn(this.tag,`Undefined expression at [${t}]`);return}if(this.expressions[t]===null){Se.warn(this.tag,`Cannot set expression at [${t}] because it's already failed in loading.`);return}if(this.expressions[t])return this.expressions[t];const e=yield this._loadExpression(t);return this.expressions[t]=e,e})}_loadExpression(t){throw new Error("Not implemented.")}setRandomExpression(){return De(this,null,function*(){if(this.definitions.length){const t=[];for(let e=0;e-1&&tu&&(o*=u/l,a*=u/l),this.vx+=o,this.vy+=a;const c=Math.sqrt(qi(this.vx,2)+qi(this.vy,2)),h=.5*(Math.sqrt(qi(u,2)+8*u*i)-u);c>h&&(this.vx*=h/c,this.vy*=h/c),this.x+=this.vx,this.y+=this.vy}}class Wf{constructor(t){this.json=t;let e=t.url;if(typeof e!="string")throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=e,this.name=VA(this.url)}resolveURL(t){return rc.resolve(this.url,t)}replaceFiles(t){this.moc=t(this.moc,"moc"),this.pose!==void 0&&(this.pose=t(this.pose,"pose")),this.physics!==void 0&&(this.physics=t(this.physics,"physics"));for(let e=0;e(t.push(e),e)),t}validateFiles(t){const e=(s,o)=>{const a=this.resolveURL(s);if(!t.includes(a)){if(o)throw new Error(`File "${s}" is defined in settings, but doesn't exist in given files`);return!1}return!0};return[this.moc,...this.textures].forEach(s=>e(s,!0)),this.getDefinedFiles().filter(s=>e(s,!1))}}var rd=(r=>(r[r.NONE=0]="NONE",r[r.IDLE=1]="IDLE",r[r.NORMAL=2]="NORMAL",r[r.FORCE=3]="FORCE",r))(rd||{});class HA{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(t,e,n){if(n<=0)return Se.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(t===this.currentGroup&&e===this.currentIndex)return Se.log(this.tag,"Motion is already playing.",this.dump(t,e)),!1;if(t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===this.reservedIdleIndex)return Se.log(this.tag,"Motion is already reserved.",this.dump(t,e)),!1;if(n===1){if(this.currentPriority!==0)return Se.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,e)),!1;if(this.reservedIdleGroup!==void 0)return Se.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(t,e)),!1;this.setReservedIdle(t,e)}else{if(n<3){if(n<=this.currentPriority)return Se.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(t,e)),!1;if(n<=this.reservePriority)return Se.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(t,e)),!1}this.setReserved(t,e,n)}return!0}start(t,e,n,i){if(i===1){if(this.setReservedIdle(void 0,void 0),this.currentPriority!==0)return Se.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,n)),!1}else{if(e!==this.reservedGroup||n!==this.reservedIndex)return Se.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(e,n)),!1;this.setReserved(void 0,void 0,0)}return t?(this.setCurrent(e,n,i),!0):!1}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(t,e,n){this.currentPriority=n,this.currentGroup=t,this.currentIndex=e}setReserved(t,e,n){this.reservePriority=n,this.reservedGroup=t,this.reservedIndex=e}setReservedIdle(t,e){this.reservedIdleGroup=t,this.reservedIdleIndex=e}isActive(t,e){return t===this.currentGroup&&e===this.currentIndex||t===this.reservedGroup&&e===this.reservedIndex||t===this.reservedIdleGroup&&e===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!Mr.preserveExpressionOnMotion&&this.currentPriority>1}dump(t,e){if(this.debug){const n=["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"];return` group = "${t}", index = ${e} `+n.map(i=>"["+i+"] "+this[i]).join(` -`)}return""}}const XA="SoundManager",YA=.5;class ds{static get volume(){return this._volume}static set volume(t){this._volume=(t>1?1:t<0?0:t)||0,this.audios.forEach(e=>e.volume=this._volume)}static add(t,e,n){const i=new Audio(t);return i.volume=this._volume,i.preload="auto",i.addEventListener("ended",()=>{this.dispose(i),e==null||e()}),i.addEventListener("error",s=>{this.dispose(i),Se.warn(XA,`Error occurred on "${t}"`,s.error),n==null||n(s.error)}),this.audios.push(i),i}static play(t){return new Promise((e,n)=>{var i;(i=t.play())==null||i.catch(s=>{t.dispatchEvent(new ErrorEvent("error",{error:s})),n(s)}),t.readyState===t.HAVE_ENOUGH_DATA?e():t.addEventListener("canplaythrough",e)})}static dispose(t){t.pause(),t.removeAttribute("src"),jA(this.audios,t)}static destroy(){for(let t=this.audios.length-1;t>=0;t--)this.dispose(this.audios[t])}}ds.audios=[];ds._volume=YA;class Hf extends ki{constructor(t,e){super(),this.motionGroups={},this.state=new HA,this.playing=!1,this.destroyed=!1,this.settings=t,this.tag=`MotionManager(${t.name})`,this.state.tag=this.tag}init(t){t!=null&&t.idleMotionGroup&&(this.groups.idle=t.idleMotionGroup),this.setupMotions(t),this.stopAllMotions()}setupMotions(t){for(const n of Object.keys(this.definitions))this.motionGroups[n]=[];let e;switch(t==null?void 0:t.motionPreload){case"NONE":return;case"ALL":e=Object.keys(this.definitions);break;case"IDLE":default:e=[this.groups.idle];break}for(const n of e)if(this.definitions[n])for(let i=0;ithis.currentAudio=void 0,()=>this.currentAudio=void 0),this.currentAudio=l}catch(h){Se.warn(this.tag,"Failed to create audio",c,h)}}const u=yield this.loadMotion(n,i);if(l){const c=ds.play(l).catch(h=>Se.warn(this.tag,"Failed to play audio",l.src,h));Mr.motionSync&&(yield c)}return this.state.start(u,n,i,s)?(Se.log(this.tag,"Start motion:",this.getMotionName(a)),this.emit("motionStart",n,i,l),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(u),!0):(l&&(ds.dispose(l),this.currentAudio=void 0),!1)})}startRandomMotion(t,e){return De(this,null,function*(){const n=this.definitions[t];if(n!=null&&n.length){const i=[];for(let s=0;se.index>=0);for(const e of t)this.hitAreas[e.name]=e}hitTest(t,e){return Object.keys(this.hitAreas).filter(n=>this.isHit(n,t,e))}isHit(t,e,n){if(!this.hitAreas[t])return!1;const i=this.hitAreas[t].index,s=this.getDrawableBounds(i,qA);return s.x<=e&&e<=s.x+s.width&&s.y<=n&&n<=s.y+s.height}getDrawableBounds(t,e){const n=this.getDrawableVertices(t);let i=n[0],s=n[0],o=n[1],a=n[1];for(let l=0;l{(s.status===200||s.status===0)&&s.response?n(s.response):s.onerror()},s.onerror=()=>{Se.warn(ZA,`Failed to load resource as ${s.responseType} (Status ${s.status}): ${t}`),i(new Km("Network error.",t,s.status))},s.onabort=()=>i(new Km("Aborted.",t,s.status,!0)),s.onloadend=()=>{var o;hr.allXhrSet.delete(s),r&&((o=hr.xhrMap.get(r))==null||o.delete(s))},s}static cancelXHRs(){var r;(r=hr.xhrMap.get(this))==null||r.forEach(t=>{t.abort(),hr.allXhrSet.delete(t)}),hr.xhrMap.delete(this)}static release(){hr.allXhrSet.forEach(r=>r.abort()),hr.allXhrSet.clear(),hr.xhrMap=new WeakMap}};let ic=hr;ic.xhrMap=new WeakMap;ic.allXhrSet=new Set;ic.loader=(r,t)=>new Promise((e,n)=>{hr.createXHR(r.target,r.settings?r.settings.resolveURL(r.url):r.url,r.type,s=>{r.result=s,e()},n).send()});function Z0(r,t){let e=-1;return n(0);function n(i,s){if(s)return Promise.reject(s);if(i<=e)return Promise.reject(new Error("next() called multiple times"));e=i;const o=r[i];if(!o)return Promise.resolve();try{return Promise.resolve(o(t,n.bind(null,i+1)))}catch(a){return Promise.reject(a)}}}class Pi{static load(t){return Z0(this.middlewares,t).then(()=>t.result)}}Pi.middlewares=[ic.loader];function KA(r,t={}){var e;const n={resourceOptions:{crossorigin:t.crossOrigin}};if(ws.fromURL)return ws.fromURL(r,n).catch(o=>{if(o instanceof Error)throw o;const a=new Error("Texture loading error");throw a.event=o,a});n.resourceOptions.autoLoad=!1;const i=ws.from(r,n);if(i.baseTexture.valid)return Promise.resolve(i);const s=i.baseTexture.resource;return(e=s._live2d_load)!=null||(s._live2d_load=new Promise((o,a)=>{const l=u=>{s.source.removeEventListener("error",l);const c=new Error("Texture loading error");c.event=u,a(c)};s.source.addEventListener("error",l),s.load().then(()=>o(i)).catch(l)})),s._live2d_load}const Jm="Live2DFactory",K0=(r,t)=>De(void 0,null,function*(){if(typeof r.source=="string"){const e=yield Pi.load({url:r.source,type:"json",target:r.live2dModel});e.url=r.source,r.source=e,r.live2dModel.emit("settingsJSONLoaded",e)}return t()}),J0=(r,t)=>De(void 0,null,function*(){if(r.source instanceof Wf)return r.settings=r.source,t();if(typeof r.source=="object"){const e=Ue.findRuntime(r.source);if(e){const n=e.createModelSettings(r.source);return r.settings=n,r.live2dModel.emit("settingsLoaded",n),t()}}throw new TypeError("Unknown settings format.")}),tb=(r,t)=>{if(r.settings){const e=Ue.findRuntime(r.settings);if(e)return e.ready().then(t)}return t()},eb=(r,t)=>De(void 0,null,function*(){yield t();const e=r.internalModel;if(e){const n=r.settings,i=Ue.findRuntime(n);if(i){const s=[];n.pose&&s.push(Pi.load({settings:n,url:n.pose,type:"json",target:e}).then(o=>{e.pose=i.createPose(e.coreModel,o),r.live2dModel.emit("poseLoaded",e.pose)}).catch(o=>{r.live2dModel.emit("poseLoadError",o),Se.warn(Jm,"Failed to load pose.",o)})),n.physics&&s.push(Pi.load({settings:n,url:n.physics,type:"json",target:e}).then(o=>{e.physics=i.createPhysics(e.coreModel,o),r.live2dModel.emit("physicsLoaded",e.physics)}).catch(o=>{r.live2dModel.emit("physicsLoadError",o),Se.warn(Jm,"Failed to load physics.",o)})),s.length&&(yield Promise.all(s))}}}),rb=(r,t)=>De(void 0,null,function*(){if(r.settings){const e=r.live2dModel,n=r.settings.textures.map(i=>{const s=r.settings.resolveURL(i);return KA(s,{crossOrigin:r.options.crossOrigin})});if(yield t(),r.internalModel)e.internalModel=r.internalModel,e.emit("modelLoaded",r.internalModel);else throw new TypeError("Missing internal model.");e.textures=yield Promise.all(n),e.emit("textureLoaded",e.textures)}else throw new TypeError("Missing settings.")}),nb=(r,t)=>De(void 0,null,function*(){const e=r.settings;if(e instanceof Wf){const n=Ue.findRuntime(e);if(!n)throw new TypeError("Unknown model settings.");const i=yield Pi.load({settings:e,url:e.moc,type:"arraybuffer",target:r.live2dModel});if(!n.isValidMoc(i))throw new Error("Invalid moc data");const s=n.createCoreModel(i);return r.internalModel=n.createInternalModel(s,e,r.options),t()}throw new TypeError("Missing settings.")}),Je=class{static registerRuntime(r){Je.runtimes.push(r),Je.runtimes.sort((t,e)=>e.version-t.version)}static findRuntime(r){for(const t of Je.runtimes)if(t.test(r))return t}static setupLive2DModel(r,t,e){return De(this,null,function*(){const n=new Promise(o=>r.once("textureLoaded",o)),i=new Promise(o=>r.once("modelLoaded",o)),s=Promise.all([n,i]).then(()=>r.emit("ready"));yield Z0(Je.live2DModelMiddlewares,{live2dModel:r,source:t,options:e||{}}),yield s,r.emit("load")})}static loadMotion(r,t,e){var n,i;const s=o=>r.emit("motionLoadError",t,e,o);try{const o=(n=r.definitions[t])==null?void 0:n[e];if(!o)return Promise.resolve(void 0);r.listeners("destroy").includes(Je.releaseTasks)||r.once("destroy",Je.releaseTasks);let a=Je.motionTasksMap.get(r);a||(a={},Je.motionTasksMap.set(r,a));let l=a[t];l||(l=[],a[t]=l);const u=r.getMotionFile(o);return(i=l[e])!=null||(l[e]=Pi.load({url:u,settings:r.settings,type:r.motionDataType,target:r}).then(c=>{var h;const f=(h=Je.motionTasksMap.get(r))==null?void 0:h[t];f&&delete f[e];const d=r.createMotion(c,t,o);return r.emit("motionLoaded",t,e,d),d}).catch(c=>{Se.warn(r.tag,`Failed to load motion: ${u} +`)}return""}}const XA="SoundManager",YA=.5;class ds{static get volume(){return this._volume}static set volume(t){this._volume=(t>1?1:t<0?0:t)||0,this.audios.forEach(e=>e.volume=this._volume)}static add(t,e,n){const i=new Audio(t);return i.volume=this._volume,i.preload="auto",i.addEventListener("ended",()=>{this.dispose(i),e==null||e()}),i.addEventListener("error",s=>{this.dispose(i),Se.warn(XA,`Error occurred on "${t}"`,s.error),n==null||n(s.error)}),this.audios.push(i),i}static play(t){return new Promise((e,n)=>{var i;(i=t.play())==null||i.catch(s=>{t.dispatchEvent(new ErrorEvent("error",{error:s})),n(s)}),t.readyState===t.HAVE_ENOUGH_DATA?e():t.addEventListener("canplaythrough",e)})}static dispose(t){t.pause(),t.removeAttribute("src"),jA(this.audios,t)}static destroy(){for(let t=this.audios.length-1;t>=0;t--)this.dispose(this.audios[t])}}ds.audios=[];ds._volume=YA;class Hf extends ki{constructor(t,e){super(),this.motionGroups={},this.state=new HA,this.playing=!1,this.destroyed=!1,this.settings=t,this.tag=`MotionManager(${t.name})`,this.state.tag=this.tag}init(t){t!=null&&t.idleMotionGroup&&(this.groups.idle=t.idleMotionGroup),this.setupMotions(t),this.stopAllMotions()}setupMotions(t){for(const n of Object.keys(this.definitions))this.motionGroups[n]=[];let e;switch(t==null?void 0:t.motionPreload){case"NONE":return;case"ALL":e=Object.keys(this.definitions);break;case"IDLE":default:e=[this.groups.idle];break}for(const n of e)if(this.definitions[n])for(let i=0;ithis.currentAudio=void 0,()=>this.currentAudio=void 0),this.currentAudio=l}catch(h){Se.warn(this.tag,"Failed to create audio",c,h)}}const u=yield this.loadMotion(n,i);if(l){const c=ds.play(l).catch(h=>Se.warn(this.tag,"Failed to play audio",l.src,h));Mr.motionSync&&(yield c)}return this.state.start(u,n,i,s)?(Se.log(this.tag,"Start motion:",this.getMotionName(a)),this.emit("motionStart",n,i,l),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(u),!0):(l&&(ds.dispose(l),this.currentAudio=void 0),!1)})}startRandomMotion(t,e){return De(this,null,function*(){const n=this.definitions[t];if(n!=null&&n.length){const i=[];for(let s=0;se.index>=0);for(const e of t)this.hitAreas[e.name]=e}hitTest(t,e){return Object.keys(this.hitAreas).filter(n=>this.isHit(n,t,e))}isHit(t,e,n){if(!this.hitAreas[t])return!1;const i=this.hitAreas[t].index,s=this.getDrawableBounds(i,qA);return s.x<=e&&e<=s.x+s.width&&s.y<=n&&n<=s.y+s.height}getDrawableBounds(t,e){const n=this.getDrawableVertices(t);let i=n[0],s=n[0],o=n[1],a=n[1];for(let l=0;l{(s.status===200||s.status===0)&&s.response?n(s.response):s.onerror()},s.onerror=()=>{Se.warn(ZA,`Failed to load resource as ${s.responseType} (Status ${s.status}): ${t}`),i(new Km("Network error.",t,s.status))},s.onabort=()=>i(new Km("Aborted.",t,s.status,!0)),s.onloadend=()=>{var o;hr.allXhrSet.delete(s),r&&((o=hr.xhrMap.get(r))==null||o.delete(s))},s}static cancelXHRs(){var r;(r=hr.xhrMap.get(this))==null||r.forEach(t=>{t.abort(),hr.allXhrSet.delete(t)}),hr.xhrMap.delete(this)}static release(){hr.allXhrSet.forEach(r=>r.abort()),hr.allXhrSet.clear(),hr.xhrMap=new WeakMap}};let ic=hr;ic.xhrMap=new WeakMap;ic.allXhrSet=new Set;ic.loader=(r,t)=>new Promise((e,n)=>{hr.createXHR(r.target,r.settings?r.settings.resolveURL(r.url):r.url,r.type,s=>{r.result=s,e()},n).send()});function Z0(r,t){let e=-1;return n(0);function n(i,s){if(s)return Promise.reject(s);if(i<=e)return Promise.reject(new Error("next() called multiple times"));e=i;const o=r[i];if(!o)return Promise.resolve();try{return Promise.resolve(o(t,n.bind(null,i+1)))}catch(a){return Promise.reject(a)}}}class Ri{static load(t){return Z0(this.middlewares,t).then(()=>t.result)}}Ri.middlewares=[ic.loader];function KA(r,t={}){var e;const n={resourceOptions:{crossorigin:t.crossOrigin}};if(ws.fromURL)return ws.fromURL(r,n).catch(o=>{if(o instanceof Error)throw o;const a=new Error("Texture loading error");throw a.event=o,a});n.resourceOptions.autoLoad=!1;const i=ws.from(r,n);if(i.baseTexture.valid)return Promise.resolve(i);const s=i.baseTexture.resource;return(e=s._live2d_load)!=null||(s._live2d_load=new Promise((o,a)=>{const l=u=>{s.source.removeEventListener("error",l);const c=new Error("Texture loading error");c.event=u,a(c)};s.source.addEventListener("error",l),s.load().then(()=>o(i)).catch(l)})),s._live2d_load}const Jm="Live2DFactory",K0=(r,t)=>De(void 0,null,function*(){if(typeof r.source=="string"){const e=yield Ri.load({url:r.source,type:"json",target:r.live2dModel});e.url=r.source,r.source=e,r.live2dModel.emit("settingsJSONLoaded",e)}return t()}),J0=(r,t)=>De(void 0,null,function*(){if(r.source instanceof Wf)return r.settings=r.source,t();if(typeof r.source=="object"){const e=Ue.findRuntime(r.source);if(e){const n=e.createModelSettings(r.source);return r.settings=n,r.live2dModel.emit("settingsLoaded",n),t()}}throw new TypeError("Unknown settings format.")}),tb=(r,t)=>{if(r.settings){const e=Ue.findRuntime(r.settings);if(e)return e.ready().then(t)}return t()},eb=(r,t)=>De(void 0,null,function*(){yield t();const e=r.internalModel;if(e){const n=r.settings,i=Ue.findRuntime(n);if(i){const s=[];n.pose&&s.push(Ri.load({settings:n,url:n.pose,type:"json",target:e}).then(o=>{e.pose=i.createPose(e.coreModel,o),r.live2dModel.emit("poseLoaded",e.pose)}).catch(o=>{r.live2dModel.emit("poseLoadError",o),Se.warn(Jm,"Failed to load pose.",o)})),n.physics&&s.push(Ri.load({settings:n,url:n.physics,type:"json",target:e}).then(o=>{e.physics=i.createPhysics(e.coreModel,o),r.live2dModel.emit("physicsLoaded",e.physics)}).catch(o=>{r.live2dModel.emit("physicsLoadError",o),Se.warn(Jm,"Failed to load physics.",o)})),s.length&&(yield Promise.all(s))}}}),rb=(r,t)=>De(void 0,null,function*(){if(r.settings){const e=r.live2dModel,n=r.settings.textures.map(i=>{const s=r.settings.resolveURL(i);return KA(s,{crossOrigin:r.options.crossOrigin})});if(yield t(),r.internalModel)e.internalModel=r.internalModel,e.emit("modelLoaded",r.internalModel);else throw new TypeError("Missing internal model.");e.textures=yield Promise.all(n),e.emit("textureLoaded",e.textures)}else throw new TypeError("Missing settings.")}),nb=(r,t)=>De(void 0,null,function*(){const e=r.settings;if(e instanceof Wf){const n=Ue.findRuntime(e);if(!n)throw new TypeError("Unknown model settings.");const i=yield Ri.load({settings:e,url:e.moc,type:"arraybuffer",target:r.live2dModel});if(!n.isValidMoc(i))throw new Error("Invalid moc data");const s=n.createCoreModel(i);return r.internalModel=n.createInternalModel(s,e,r.options),t()}throw new TypeError("Missing settings.")}),Je=class{static registerRuntime(r){Je.runtimes.push(r),Je.runtimes.sort((t,e)=>e.version-t.version)}static findRuntime(r){for(const t of Je.runtimes)if(t.test(r))return t}static setupLive2DModel(r,t,e){return De(this,null,function*(){const n=new Promise(o=>r.once("textureLoaded",o)),i=new Promise(o=>r.once("modelLoaded",o)),s=Promise.all([n,i]).then(()=>r.emit("ready"));yield Z0(Je.live2DModelMiddlewares,{live2dModel:r,source:t,options:e||{}}),yield s,r.emit("load")})}static loadMotion(r,t,e){var n,i;const s=o=>r.emit("motionLoadError",t,e,o);try{const o=(n=r.definitions[t])==null?void 0:n[e];if(!o)return Promise.resolve(void 0);r.listeners("destroy").includes(Je.releaseTasks)||r.once("destroy",Je.releaseTasks);let a=Je.motionTasksMap.get(r);a||(a={},Je.motionTasksMap.set(r,a));let l=a[t];l||(l=[],a[t]=l);const u=r.getMotionFile(o);return(i=l[e])!=null||(l[e]=Ri.load({url:u,settings:r.settings,type:r.motionDataType,target:r}).then(c=>{var h;const f=(h=Je.motionTasksMap.get(r))==null?void 0:h[t];f&&delete f[e];const d=r.createMotion(c,t,o);return r.emit("motionLoaded",t,e,d),d}).catch(c=>{Se.warn(r.tag,`Failed to load motion: ${u} `,c),s(c)})),l[e]}catch(o){Se.warn(r.tag,`Failed to load motion at "${t}"[${e}] -`,o),s(o)}return Promise.resolve(void 0)}static loadExpression(r,t){var e;const n=i=>r.emit("expressionLoadError",t,i);try{const i=r.definitions[t];if(!i)return Promise.resolve(void 0);r.listeners("destroy").includes(Je.releaseTasks)||r.once("destroy",Je.releaseTasks);let s=Je.expressionTasksMap.get(r);s||(s=[],Je.expressionTasksMap.set(r,s));const o=r.getExpressionFile(i);return(e=s[t])!=null||(s[t]=Pi.load({url:o,settings:r.settings,type:"json",target:r}).then(a=>{const l=Je.expressionTasksMap.get(r);l&&delete l[t];const u=r.createExpression(a,i);return r.emit("expressionLoaded",t,u),u}).catch(a=>{Se.warn(r.tag,`Failed to load expression: ${o} +`,o),s(o)}return Promise.resolve(void 0)}static loadExpression(r,t){var e;const n=i=>r.emit("expressionLoadError",t,i);try{const i=r.definitions[t];if(!i)return Promise.resolve(void 0);r.listeners("destroy").includes(Je.releaseTasks)||r.once("destroy",Je.releaseTasks);let s=Je.expressionTasksMap.get(r);s||(s=[],Je.expressionTasksMap.set(r,s));const o=r.getExpressionFile(i);return(e=s[t])!=null||(s[t]=Ri.load({url:o,settings:r.settings,type:"json",target:r}).then(a=>{const l=Je.expressionTasksMap.get(r);l&&delete l[t];const u=r.createExpression(a,i);return r.emit("expressionLoaded",t,u),u}).catch(a=>{Se.warn(r.tag,`Failed to load expression: ${o} `,a),n(a)})),s[t]}catch(i){Se.warn(r.tag,`Failed to load expression at [${t}] -`,i),n(i)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof Hf?Je.motionTasksMap.delete(this):Je.expressionTasksMap.delete(this)}};let Ue=Je;Ue.runtimes=[];Ue.urlToJSON=K0;Ue.jsonToSettings=J0;Ue.waitUntilReady=tb;Ue.setupOptionals=eb;Ue.setupEssentials=rb;Ue.createInternalModel=nb;Ue.live2DModelMiddlewares=[K0,J0,tb,eb,rb,nb];Ue.motionTasksMap=new WeakMap;Ue.expressionTasksMap=new WeakMap;Hf.prototype._loadMotion=function(r,t){return Ue.loadMotion(this,r,t)};Q0.prototype._loadExpression=function(r){return Ue.loadExpression(this,r)};class JA{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(t){t!==this._autoInteract&&(t?this.on("pointertap",tg,this):this.off("pointertap",tg,this),this._autoInteract=t)}registerInteraction(t){t!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&t&&(this.interactionManager=t,t.on("pointermove",eg,this)))}unregisterInteraction(){var t;this.interactionManager&&((t=this.interactionManager)==null||t.off("pointermove",eg,this),this.interactionManager=void 0)}}function tg(r){this.tap(r.data.global.x,r.data.global.y)}function eg(r){this.focus(r.data.global.x,r.data.global.y)}class tM extends E0{}const jr=new Oe,eM=new ir;let vi;class rM extends su{constructor(t){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new tM,this.anchor=new ho(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",()=>this.init(t))}static from(t,e){const n=new this(e);return Ue.setupLive2DModel(n,t,e).then(()=>n)}static fromSync(t,e){const n=new this(e);return Ue.setupLive2DModel(n,t,e).then(e==null?void 0:e.onLoad).catch(e==null?void 0:e.onError),n}static registerTicker(t){vi=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){var e;vi||(vi=(e=window.PIXI)==null?void 0:e.Ticker),t?this._destroyed||(vi?(vi.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):Se.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(vi==null||vi.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(t){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const e=Object.assign({autoUpdate:!0,autoInteract:!0},t);e.autoInteract&&(this.interactive=!0),this.autoInteract=e.autoInteract,this.autoUpdate=e.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(t,e,n){return e===void 0?this.internalModel.motionManager.startRandomMotion(t,n):this.internalModel.motionManager.startMotion(t,e,n)}expression(t){return this.internalModel.motionManager.expressionManager?t===void 0?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(t):Promise.resolve(!1)}focus(t,e,n=!1){jr.x=t,jr.y=e,this.toModelPosition(jr,jr,!0);let i=jr.x/this.internalModel.originalWidth*2-1,s=jr.y/this.internalModel.originalHeight*2-1,o=Math.atan2(s,i);this.internalModel.focusController.focus(Math.cos(o),-Math.sin(o),n)}tap(t,e){const n=this.hitTest(t,e);n.length&&(Se.log(this.tag,"Hit",n),this.emit("hit",n))}hitTest(t,e){return jr.x=t,jr.y=e,this.toModelPosition(jr,jr),this.internalModel.hitTest(jr.x,jr.y)}toModelPosition(t,e=t.clone(),n){return n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(t,e),this.internalModel.localTransform.applyInverse(e,e),e}containsPoint(t){return this.getBounds(!0).contains(t.x,t.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(vi.shared.deltaMS)}update(t){this.deltaTime+=t,this.elapsedTime+=t}_render(t){this.registerInteraction(t.plugins.interaction),t.batch.reset(),t.geometry.reset(),t.shader.reset(),t.state.reset();let e=!1;this.glContextID!==t.CONTEXT_UID&&(this.glContextID=t.CONTEXT_UID,this.internalModel.updateWebGLContext(t.gl,this.glContextID),e=!0);for(let s=0;se.destroy(t.baseTexture)),this.internalModel.destroy(),super.destroy(t)}}q0(rM,[JA]);const Cn=class{static resolveURL(r,t){var e;const n=(e=Cn.filesMap[r])==null?void 0:e[t];if(n===void 0)throw new Error("Cannot find this file from uploaded files: "+t);return n}static upload(r,t){return De(this,null,function*(){const e={};for(const n of t.getDefinedFiles()){const i=decodeURI(rc.resolve(t.url,n)),s=r.find(o=>o.webkitRelativePath===i);s&&(e[n]=URL.createObjectURL(s))}Cn.filesMap[t._objectURL]=e})}static createSettings(r){return De(this,null,function*(){const t=r.find(o=>o.name.endsWith("model.json")||o.name.endsWith("model3.json"));if(!t)throw new TypeError("Settings file not found");const e=yield Cn.readText(t),n=JSON.parse(e);n.url=t.webkitRelativePath;const i=Ue.findRuntime(n);if(!i)throw new Error("Unknown settings JSON");const s=i.createModelSettings(n);return s._objectURL=URL.createObjectURL(t),s})}static readText(r){return De(this,null,function*(){return new Promise((t,e)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=e,n.readAsText(r,"utf8")})})}};let Xf=Cn;Xf.filesMap={};Xf.factory=(r,t)=>De(void 0,null,function*(){if(Array.isArray(r.source)&&r.source[0]instanceof File){const e=r.source;let n=e.settings;if(!n)n=yield Cn.createSettings(e);else if(!n._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings');n.validateFiles(e.map(i=>encodeURI(i.webkitRelativePath))),yield Cn.upload(e,n),n.resolveURL=function(i){return Cn.resolveURL(this._objectURL,i)},r.source=n,r.live2dModel.once("modelLoaded",i=>{i.once("destroy",function(){const s=this.settings._objectURL;if(URL.revokeObjectURL(s),Cn.filesMap[s])for(const o of Object.values(Cn.filesMap[s]))URL.revokeObjectURL(o);delete Cn.filesMap[s]})})}return t()});Ue.live2DModelMiddlewares.unshift(Xf.factory);const yr=class{static unzip(r,t){return De(this,null,function*(){const e=yield yr.getFilePaths(r),n=[];for(const s of t.getDefinedFiles()){const o=decodeURI(rc.resolve(t.url,s));e.includes(o)&&n.push(o)}const i=yield yr.getFiles(r,n);for(let s=0;so.endsWith("model.json")||o.endsWith("model3.json"));if(!e)throw new Error("Settings file not found");const n=yield yr.readText(r,e);if(!n)throw new Error("Empty settings file: "+e);const i=JSON.parse(n);i.url=e;const s=Ue.findRuntime(i);if(!s)throw new Error("Unknown settings JSON");return s.createModelSettings(i)})}static zipReader(r,t){return De(this,null,function*(){throw new Error("Not implemented")})}static getFilePaths(r){return De(this,null,function*(){throw new Error("Not implemented")})}static getFiles(r,t){return De(this,null,function*(){throw new Error("Not implemented")})}static readText(r,t){return De(this,null,function*(){throw new Error("Not implemented")})}static releaseReader(r){}};let Hn=yr;Hn.ZIP_PROTOCOL="zip://";Hn.uid=0;Hn.factory=(r,t)=>De(void 0,null,function*(){const e=r.source;let n,i,s;if(typeof e=="string"&&(e.endsWith(".zip")||e.startsWith(yr.ZIP_PROTOCOL))?(e.startsWith(yr.ZIP_PROTOCOL)?n=e.slice(yr.ZIP_PROTOCOL.length):n=e,i=yield Pi.load({url:n,type:"blob",target:r.live2dModel})):Array.isArray(e)&&e.length===1&&e[0]instanceof File&&e[0].name.endsWith(".zip")&&(i=e[0],n=URL.createObjectURL(i),s=e.settings),i){if(!i.size)throw new Error("Empty zip file");const o=yield yr.zipReader(i,n);s||(s=yield yr.createSettings(o)),s._objectURL=yr.ZIP_PROTOCOL+yr.uid+"/"+s.url;const a=yield yr.unzip(o,s);a.settings=s,r.source=a,n.startsWith("blob:")&&r.live2dModel.once("modelLoaded",l=>{l.once("destroy",function(){URL.revokeObjectURL(n)})}),yr.releaseReader(o)}return t()});Ue.live2DModelMiddlewares.unshift(Hn.factory);if(!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class nM extends Q0{constructor(t,e){var n;super(t,e),this.queueManager=new W0,this.definitions=(n=t.expressions)!=null?n:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex(e=>e.Name===t)}getExpressionFile(t){return t.File}createExpression(t,e){return zf.create(t)}_setExpression(t){return this.queueManager.startMotion(t,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}}class xs extends Wf{constructor(t){if(super(t),!xs.isValidJSON(t))throw new TypeError("Invalid JSON.");Object.assign(this,new Y0(t))}static isValidJSON(t){var e;return!!(t!=null&&t.FileReferences)&&typeof t.FileReferences.Moc=="string"&&((e=t.FileReferences.Textures)==null?void 0:e.length)>0&&t.FileReferences.Textures.every(n=>typeof n=="string")}replaceFiles(t){if(super.replaceFiles(t),this.motions)for(const[e,n]of Object.entries(this.motions))for(let i=0;i{this.emit("motion:"+n)})}isFinished(){return this.queueManager.isFinished()}_startMotion(t,e){return t.setFinishedMotionHandler(e),this.queueManager.stopAllMotions(),this.queueManager.startMotion(t,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(t,e,n){const i=jf.create(t),s=new G0(t),o=(e===this.groups.idle?Mr.idleMotionFadingDuration:Mr.motionFadingDuration)/1e3;return s.getMotionFadeInTime()===void 0&&i.setFadeInTime(n.FadeInTime>0?n.FadeInTime:o),s.getMotionFadeOutTime()===void 0&&i.setFadeOutTime(n.FadeOutTime>0?n.FadeOutTime:o),i.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),i}getMotionFile(t){return t.File}getMotionName(t){return t.File}getSoundFile(t){return t.Sound}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}const rg=new Jr;class sM extends QA{constructor(t,e,n){super(),this.lipSync=!0,this.breath=Nf.create(),this.renderer=new X0,this.idParamAngleX=DA,this.idParamAngleY=LA,this.idParamAngleZ=NA,this.idParamEyeBallX=BA,this.idParamEyeBallY=UA,this.idParamBodyAngleX=kA,this.idParamBreath=zA,this.pixelsPerUnit=1,this.centeringTransform=new ir,this.coreModel=t,this.settings=e,this.motionManager=new iM(e,n),this.init()}init(){var t;super.init(),((t=this.settings.getEyeBlinkParameters())==null?void 0:t.length)>0&&(this.eyeBlink=j0.create(this.settings)),this.breath.setParameters([new Qo(this.idParamAngleX,0,15,6.5345,.5),new Qo(this.idParamAngleY,0,8,3.5345,.5),new Qo(this.idParamAngleZ,0,10,5.5345,.5),new Qo(this.idParamBodyAngleX,0,4,15.5345,.5),new Qo(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 t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){const n=e.charAt(0).toLowerCase()+e.slice(1);t[n]=this.settings.layout[e]}return t}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(t,e){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(t),this.renderer._clippingManager._currentFrameNo=e,this.renderer._clippingManager._maskTexture=void 0,yo.getInstance()._shaderSets=[]}bindTexture(t,e){this.renderer.bindTexture(t,e)}getHitAreaDefs(){var t,e;return(e=(t=this.settings.hitAreas)==null?void 0:t.map(n=>({id:n.Id,name:n.Name,index:this.coreModel.getDrawableIndex(n.Id)})))!=null?e:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(t){return this.coreModel.getDrawableIndex(t)}getDrawableVertices(t){if(typeof t=="string"&&(t=this.coreModel.getDrawableIndex(t),t===-1))throw new TypeError("Unable to find drawable ID: "+t);const e=this.coreModel.getDrawableVertices(t).slice();for(let n=0;n{function e(){try{aM(),r()}catch(n){if(ng--,ng<0){const i=new Error("Failed to start up Cubism 4 framework.");i.cause=n,t(i);return}Se.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(e,10)}}e()})),El)}function aM(r){r=Object.assign({logFunction:console.log,loggingLevel:Rs.LogLevel_Verbose},r),La.startUp(r),La.initialize()}Ue.registerRuntime({version:4,ready:oM,test(r){return r instanceof xs||xs.isValidJSON(r)},isValidMoc(r){if(r.byteLength<4)return!1;const t=new Int8Array(r,0,4);return String.fromCharCode(...t)==="MOC3"},createModelSettings(r){return new xs(r)},createCoreModel(r){const t=kf.create(r);try{const e=t.createModel();return e.__moc=t,e}catch(e){try{t.release()}catch{}throw e}},createInternalModel(r,t,e){const n=new sM(r,t,e),i=r;return i.__moc&&(n.__moc=i.__moc,delete i.__moc,n.once("destroy",lM)),n},createPhysics(r,t){return $f.create(t)},createPose(r,t){return Bf.create(t)}});function lM(){var r;(r=this.__moc)==null||r.release()}/*! +`,i),n(i)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof Hf?Je.motionTasksMap.delete(this):Je.expressionTasksMap.delete(this)}};let Ue=Je;Ue.runtimes=[];Ue.urlToJSON=K0;Ue.jsonToSettings=J0;Ue.waitUntilReady=tb;Ue.setupOptionals=eb;Ue.setupEssentials=rb;Ue.createInternalModel=nb;Ue.live2DModelMiddlewares=[K0,J0,tb,eb,rb,nb];Ue.motionTasksMap=new WeakMap;Ue.expressionTasksMap=new WeakMap;Hf.prototype._loadMotion=function(r,t){return Ue.loadMotion(this,r,t)};Q0.prototype._loadExpression=function(r){return Ue.loadExpression(this,r)};class JA{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(t){t!==this._autoInteract&&(t?this.on("pointertap",tg,this):this.off("pointertap",tg,this),this._autoInteract=t)}registerInteraction(t){t!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&t&&(this.interactionManager=t,t.on("pointermove",eg,this)))}unregisterInteraction(){var t;this.interactionManager&&((t=this.interactionManager)==null||t.off("pointermove",eg,this),this.interactionManager=void 0)}}function tg(r){this.tap(r.data.global.x,r.data.global.y)}function eg(r){this.focus(r.data.global.x,r.data.global.y)}class tM extends E0{}const jr=new Oe,eM=new ir;let _i;class rM extends su{constructor(t){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new tM,this.anchor=new ho(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",()=>this.init(t))}static from(t,e){const n=new this(e);return Ue.setupLive2DModel(n,t,e).then(()=>n)}static fromSync(t,e){const n=new this(e);return Ue.setupLive2DModel(n,t,e).then(e==null?void 0:e.onLoad).catch(e==null?void 0:e.onError),n}static registerTicker(t){_i=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){var e;_i||(_i=(e=window.PIXI)==null?void 0:e.Ticker),t?this._destroyed||(_i?(_i.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):Se.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(_i==null||_i.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(t){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const e=Object.assign({autoUpdate:!0,autoInteract:!0},t);e.autoInteract&&(this.interactive=!0),this.autoInteract=e.autoInteract,this.autoUpdate=e.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(t,e,n){return e===void 0?this.internalModel.motionManager.startRandomMotion(t,n):this.internalModel.motionManager.startMotion(t,e,n)}expression(t){return this.internalModel.motionManager.expressionManager?t===void 0?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(t):Promise.resolve(!1)}focus(t,e,n=!1){jr.x=t,jr.y=e,this.toModelPosition(jr,jr,!0);let i=jr.x/this.internalModel.originalWidth*2-1,s=jr.y/this.internalModel.originalHeight*2-1,o=Math.atan2(s,i);this.internalModel.focusController.focus(Math.cos(o),-Math.sin(o),n)}tap(t,e){const n=this.hitTest(t,e);n.length&&(Se.log(this.tag,"Hit",n),this.emit("hit",n))}hitTest(t,e){return jr.x=t,jr.y=e,this.toModelPosition(jr,jr),this.internalModel.hitTest(jr.x,jr.y)}toModelPosition(t,e=t.clone(),n){return n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(t,e),this.internalModel.localTransform.applyInverse(e,e),e}containsPoint(t){return this.getBounds(!0).contains(t.x,t.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(_i.shared.deltaMS)}update(t){this.deltaTime+=t,this.elapsedTime+=t}_render(t){this.registerInteraction(t.plugins.interaction),t.batch.reset(),t.geometry.reset(),t.shader.reset(),t.state.reset();let e=!1;this.glContextID!==t.CONTEXT_UID&&(this.glContextID=t.CONTEXT_UID,this.internalModel.updateWebGLContext(t.gl,this.glContextID),e=!0);for(let s=0;se.destroy(t.baseTexture)),this.internalModel.destroy(),super.destroy(t)}}q0(rM,[JA]);const Cn=class{static resolveURL(r,t){var e;const n=(e=Cn.filesMap[r])==null?void 0:e[t];if(n===void 0)throw new Error("Cannot find this file from uploaded files: "+t);return n}static upload(r,t){return De(this,null,function*(){const e={};for(const n of t.getDefinedFiles()){const i=decodeURI(rc.resolve(t.url,n)),s=r.find(o=>o.webkitRelativePath===i);s&&(e[n]=URL.createObjectURL(s))}Cn.filesMap[t._objectURL]=e})}static createSettings(r){return De(this,null,function*(){const t=r.find(o=>o.name.endsWith("model.json")||o.name.endsWith("model3.json"));if(!t)throw new TypeError("Settings file not found");const e=yield Cn.readText(t),n=JSON.parse(e);n.url=t.webkitRelativePath;const i=Ue.findRuntime(n);if(!i)throw new Error("Unknown settings JSON");const s=i.createModelSettings(n);return s._objectURL=URL.createObjectURL(t),s})}static readText(r){return De(this,null,function*(){return new Promise((t,e)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=e,n.readAsText(r,"utf8")})})}};let Xf=Cn;Xf.filesMap={};Xf.factory=(r,t)=>De(void 0,null,function*(){if(Array.isArray(r.source)&&r.source[0]instanceof File){const e=r.source;let n=e.settings;if(!n)n=yield Cn.createSettings(e);else if(!n._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings');n.validateFiles(e.map(i=>encodeURI(i.webkitRelativePath))),yield Cn.upload(e,n),n.resolveURL=function(i){return Cn.resolveURL(this._objectURL,i)},r.source=n,r.live2dModel.once("modelLoaded",i=>{i.once("destroy",function(){const s=this.settings._objectURL;if(URL.revokeObjectURL(s),Cn.filesMap[s])for(const o of Object.values(Cn.filesMap[s]))URL.revokeObjectURL(o);delete Cn.filesMap[s]})})}return t()});Ue.live2DModelMiddlewares.unshift(Xf.factory);const yr=class{static unzip(r,t){return De(this,null,function*(){const e=yield yr.getFilePaths(r),n=[];for(const s of t.getDefinedFiles()){const o=decodeURI(rc.resolve(t.url,s));e.includes(o)&&n.push(o)}const i=yield yr.getFiles(r,n);for(let s=0;so.endsWith("model.json")||o.endsWith("model3.json"));if(!e)throw new Error("Settings file not found");const n=yield yr.readText(r,e);if(!n)throw new Error("Empty settings file: "+e);const i=JSON.parse(n);i.url=e;const s=Ue.findRuntime(i);if(!s)throw new Error("Unknown settings JSON");return s.createModelSettings(i)})}static zipReader(r,t){return De(this,null,function*(){throw new Error("Not implemented")})}static getFilePaths(r){return De(this,null,function*(){throw new Error("Not implemented")})}static getFiles(r,t){return De(this,null,function*(){throw new Error("Not implemented")})}static readText(r,t){return De(this,null,function*(){throw new Error("Not implemented")})}static releaseReader(r){}};let Hn=yr;Hn.ZIP_PROTOCOL="zip://";Hn.uid=0;Hn.factory=(r,t)=>De(void 0,null,function*(){const e=r.source;let n,i,s;if(typeof e=="string"&&(e.endsWith(".zip")||e.startsWith(yr.ZIP_PROTOCOL))?(e.startsWith(yr.ZIP_PROTOCOL)?n=e.slice(yr.ZIP_PROTOCOL.length):n=e,i=yield Ri.load({url:n,type:"blob",target:r.live2dModel})):Array.isArray(e)&&e.length===1&&e[0]instanceof File&&e[0].name.endsWith(".zip")&&(i=e[0],n=URL.createObjectURL(i),s=e.settings),i){if(!i.size)throw new Error("Empty zip file");const o=yield yr.zipReader(i,n);s||(s=yield yr.createSettings(o)),s._objectURL=yr.ZIP_PROTOCOL+yr.uid+"/"+s.url;const a=yield yr.unzip(o,s);a.settings=s,r.source=a,n.startsWith("blob:")&&r.live2dModel.once("modelLoaded",l=>{l.once("destroy",function(){URL.revokeObjectURL(n)})}),yr.releaseReader(o)}return t()});Ue.live2DModelMiddlewares.unshift(Hn.factory);if(!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class nM extends Q0{constructor(t,e){var n;super(t,e),this.queueManager=new W0,this.definitions=(n=t.expressions)!=null?n:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(t){return this.definitions.findIndex(e=>e.Name===t)}getExpressionFile(t){return t.File}createExpression(t,e){return zf.create(t)}_setExpression(t){return this.queueManager.startMotion(t,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}}class xs extends Wf{constructor(t){if(super(t),!xs.isValidJSON(t))throw new TypeError("Invalid JSON.");Object.assign(this,new Y0(t))}static isValidJSON(t){var e;return!!(t!=null&&t.FileReferences)&&typeof t.FileReferences.Moc=="string"&&((e=t.FileReferences.Textures)==null?void 0:e.length)>0&&t.FileReferences.Textures.every(n=>typeof n=="string")}replaceFiles(t){if(super.replaceFiles(t),this.motions)for(const[e,n]of Object.entries(this.motions))for(let i=0;i{this.emit("motion:"+n)})}isFinished(){return this.queueManager.isFinished()}_startMotion(t,e){return t.setFinishedMotionHandler(e),this.queueManager.stopAllMotions(),this.queueManager.startMotion(t,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(t,e,n){const i=jf.create(t),s=new G0(t),o=(e===this.groups.idle?Mr.idleMotionFadingDuration:Mr.motionFadingDuration)/1e3;return s.getMotionFadeInTime()===void 0&&i.setFadeInTime(n.FadeInTime>0?n.FadeInTime:o),s.getMotionFadeOutTime()===void 0&&i.setFadeOutTime(n.FadeOutTime>0?n.FadeOutTime:o),i.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),i}getMotionFile(t){return t.File}getMotionName(t){return t.File}getSoundFile(t){return t.Sound}updateParameters(t,e){return this.queueManager.doUpdateMotion(t,e)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}const rg=new Jr;class sM extends QA{constructor(t,e,n){super(),this.lipSync=!0,this.breath=Nf.create(),this.renderer=new X0,this.idParamAngleX=DA,this.idParamAngleY=LA,this.idParamAngleZ=NA,this.idParamEyeBallX=BA,this.idParamEyeBallY=UA,this.idParamBodyAngleX=kA,this.idParamBreath=zA,this.pixelsPerUnit=1,this.centeringTransform=new ir,this.coreModel=t,this.settings=e,this.motionManager=new iM(e,n),this.init()}init(){var t;super.init(),((t=this.settings.getEyeBlinkParameters())==null?void 0:t.length)>0&&(this.eyeBlink=j0.create(this.settings)),this.breath.setParameters([new Qo(this.idParamAngleX,0,15,6.5345,.5),new Qo(this.idParamAngleY,0,8,3.5345,.5),new Qo(this.idParamAngleZ,0,10,5.5345,.5),new Qo(this.idParamBodyAngleX,0,4,15.5345,.5),new Qo(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 t={};if(this.settings.layout)for(const e of Object.keys(this.settings.layout)){const n=e.charAt(0).toLowerCase()+e.slice(1);t[n]=this.settings.layout[e]}return t}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(t,e){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(t),this.renderer._clippingManager._currentFrameNo=e,this.renderer._clippingManager._maskTexture=void 0,yo.getInstance()._shaderSets=[]}bindTexture(t,e){this.renderer.bindTexture(t,e)}getHitAreaDefs(){var t,e;return(e=(t=this.settings.hitAreas)==null?void 0:t.map(n=>({id:n.Id,name:n.Name,index:this.coreModel.getDrawableIndex(n.Id)})))!=null?e:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(t){return this.coreModel.getDrawableIndex(t)}getDrawableVertices(t){if(typeof t=="string"&&(t=this.coreModel.getDrawableIndex(t),t===-1))throw new TypeError("Unable to find drawable ID: "+t);const e=this.coreModel.getDrawableVertices(t).slice();for(let n=0;n{function e(){try{aM(),r()}catch(n){if(ng--,ng<0){const i=new Error("Failed to start up Cubism 4 framework.");i.cause=n,t(i);return}Se.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(e,10)}}e()})),El)}function aM(r){r=Object.assign({logFunction:console.log,loggingLevel:Rs.LogLevel_Verbose},r),La.startUp(r),La.initialize()}Ue.registerRuntime({version:4,ready:oM,test(r){return r instanceof xs||xs.isValidJSON(r)},isValidMoc(r){if(r.byteLength<4)return!1;const t=new Int8Array(r,0,4);return String.fromCharCode(...t)==="MOC3"},createModelSettings(r){return new xs(r)},createCoreModel(r){const t=kf.create(r);try{const e=t.createModel();return e.__moc=t,e}catch(e){try{t.release()}catch{}throw e}},createInternalModel(r,t,e){const n=new sM(r,t,e),i=r;return i.__moc&&(n.__moc=i.__moc,delete i.__moc,n.once("destroy",lM)),n},createPhysics(r,t){return $f.create(t)},createPose(r,t){return Bf.create(t)}});function lM(){var r;(r=this.__moc)==null||r.release()}/*! * @pixi/interaction - v6.5.10 * Compiled Thu, 06 Jul 2023 15:25:11 UTC * @@ -594,12 +594,12 @@ 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 nd=function(r,t){return nd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},nd(r,t)};function uM(r,t){nd(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var cM=function(){function r(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return r.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},r.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},r}(),lh=function(){function r(t){this._pointerId=t,this._flags=r.FLAGS.NONE}return r.prototype._doSet=function(t,e){e?this._flags=this._flags|t:this._flags=this._flags&~t},Object.defineProperty(r.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"none",{get:function(){return this._flags===r.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"over",{get:function(){return(this._flags&r.FLAGS.OVER)!==0},set:function(t){this._doSet(r.FLAGS.OVER,t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rightDown",{get:function(){return(this._flags&r.FLAGS.RIGHT_DOWN)!==0},set:function(t){this._doSet(r.FLAGS.RIGHT_DOWN,t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"leftDown",{get:function(){return(this._flags&r.FLAGS.LEFT_DOWN)!==0},set:function(t){this._doSet(r.FLAGS.LEFT_DOWN,t)},enumerable:!1,configurable:!0}),r.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),r}(),hM=function(){function r(){this._tempPoint=new Oe}return r.prototype.recursiveFindHit=function(t,e,n,i,s){var o;if(!e||!e.visible)return!1;var a=t.data.global;s=e.interactive||s;var l=!1,u=s,c=!0;if(e.hitArea)i&&(e.worldTransform.applyInverse(a,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?l=!0:(i=!1,c=!1)),u=!1;else if(e._mask&&i){var h=e._mask.isMaskData?e._mask.maskObject:e._mask;h&&!(!((o=h.containsPoint)===null||o===void 0)&&o.call(h,a))&&(i=!1)}if(c&&e.interactiveChildren&&e.children)for(var f=e.children,d=f.length-1;d>=0;d--){var m=f[d],g=this.recursiveFindHit(t,m,n,i,u);if(g){if(!m.parent)continue;u=!1,g&&(t.target&&(i=!1),l=!0)}}return s&&(i&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(a)&&(l=!0),e.interactive&&(l&&!t.target&&(t.target=e),n&&n(t,e,!!l))),l},r.prototype.findHit=function(t,e,n,i){this.recursiveFindHit(t,e,n,i,!1)},r}(),dM={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return this.cursor==="pointer"},set buttonMode(r){r?this.cursor="pointer":this.cursor==="pointer"&&(this.cursor=null)},cursor:null,get trackedPointers(){return this._trackedPointers===void 0&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Da.mixin(dM);var Al=1,Ml={target:null,data:{global:null}},Zk=function(r){uM(t,r);function t(e,n){var i=r.call(this)||this;return n=n||{},i.renderer=e,i.autoPreventDefault=n.autoPreventDefault!==void 0?n.autoPreventDefault:!0,i.interactionFrequency=n.interactionFrequency||10,i.mouse=new ig,i.mouse.identifier=Al,i.mouse.global.set(-999999),i.activeInteractionData={},i.activeInteractionData[Al]=i.mouse,i.interactionDataPool=[],i.eventData=new cM,i.interactionDOMElement=null,i.moveWhenInside=!1,i.eventsAdded=!1,i.tickerAdded=!1,i.mouseOverRenderer=!("PointerEvent"in globalThis),i.supportsTouchEvents="ontouchstart"in globalThis,i.supportsPointerEvents=!!globalThis.PointerEvent,i.onPointerUp=i.onPointerUp.bind(i),i.processPointerUp=i.processPointerUp.bind(i),i.onPointerCancel=i.onPointerCancel.bind(i),i.processPointerCancel=i.processPointerCancel.bind(i),i.onPointerDown=i.onPointerDown.bind(i),i.processPointerDown=i.processPointerDown.bind(i),i.onPointerMove=i.onPointerMove.bind(i),i.processPointerMove=i.processPointerMove.bind(i),i.onPointerOut=i.onPointerOut.bind(i),i.processPointerOverOut=i.processPointerOverOut.bind(i),i.onPointerOver=i.onPointerOver.bind(i),i.cursorStyles={default:"inherit",pointer:"pointer"},i.currentCursorMode=null,i.cursor=null,i.resolution=1,i.delayedEvents=[],i.search=new hM,i._tempDisplayObject=new V0,i._eventListenerOptions={capture:!0,passive:!1},i._useSystemTicker=n.useSystemTicker!==void 0?n.useSystemTicker:!0,i.setTargetElement(i.renderer.view,i.renderer.resolution),i}return Object.defineProperty(t.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(e){this._useSystemTicker=e,e?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),t.prototype.hitTest=function(e,n){return Ml.target=null,Ml.data.global=e,n||(n=this.lastObjectRendered),this.processInteractive(Ml,n,null,!0),Ml.target},t.prototype.setTargetElement=function(e,n){n===void 0&&(n=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=e,this.resolution=n,this.addEvents(),this.addTickerListener()},t.prototype.addTickerListener=function(){this.tickerAdded||!this.interactionDOMElement||!this._useSystemTicker||(Mn.system.add(this.tickerUpdate,this,Ao.INTERACTION),this.tickerAdded=!0)},t.prototype.removeTickerListener=function(){this.tickerAdded&&(Mn.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},t.prototype.addEvents=function(){if(!(this.eventsAdded||!this.interactionDOMElement)){var e=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(!(!this.eventsAdded||!this.interactionDOMElement)){var e=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},t.prototype.tickerUpdate=function(e){this._deltaTime+=e,!(this._deltaTime0&&(a=e.composedPath()[0]);for(var l=a!==this.interactionDOMElement?"outside":"",u=0;u"u"&&(o.button=e.touches.length?1:0),typeof o.buttons>"u"&&(o.buttons=e.touches.length?1:0),typeof o.isPrimary>"u"&&(o.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,n.push(o)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){var a=e;typeof a.isPrimary>"u"&&(a.isPrimary=!0),typeof a.width>"u"&&(a.width=1),typeof a.height>"u"&&(a.height=1),typeof a.tiltX>"u"&&(a.tiltX=0),typeof a.tiltY>"u"&&(a.tiltY=0),typeof a.pointerType>"u"&&(a.pointerType="mouse"),typeof a.pointerId>"u"&&(a.pointerId=Al),typeof a.pressure>"u"&&(a.pressure=.5),typeof a.twist>"u"&&(a.twist=0),typeof a.tangentialPressure>"u"&&(a.tangentialPressure=0),a.isNormalized=!0,n.push(a)}else n.push(e);return n},t.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},t.extension={name:"interaction",type:[rn.RendererPlugin,rn.CanvasRendererPlugin]},t}(ki);function Ai(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 uh={exports:{}};/*! +***************************************************************************** */var nd=function(r,t){return nd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])},nd(r,t)};function uM(r,t){nd(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var cM=function(){function r(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return r.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},r.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},r}(),lh=function(){function r(t){this._pointerId=t,this._flags=r.FLAGS.NONE}return r.prototype._doSet=function(t,e){e?this._flags=this._flags|t:this._flags=this._flags&~t},Object.defineProperty(r.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"none",{get:function(){return this._flags===r.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"over",{get:function(){return(this._flags&r.FLAGS.OVER)!==0},set:function(t){this._doSet(r.FLAGS.OVER,t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"rightDown",{get:function(){return(this._flags&r.FLAGS.RIGHT_DOWN)!==0},set:function(t){this._doSet(r.FLAGS.RIGHT_DOWN,t)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"leftDown",{get:function(){return(this._flags&r.FLAGS.LEFT_DOWN)!==0},set:function(t){this._doSet(r.FLAGS.LEFT_DOWN,t)},enumerable:!1,configurable:!0}),r.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),r}(),hM=function(){function r(){this._tempPoint=new Oe}return r.prototype.recursiveFindHit=function(t,e,n,i,s){var o;if(!e||!e.visible)return!1;var a=t.data.global;s=e.interactive||s;var l=!1,u=s,c=!0;if(e.hitArea)i&&(e.worldTransform.applyInverse(a,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?l=!0:(i=!1,c=!1)),u=!1;else if(e._mask&&i){var h=e._mask.isMaskData?e._mask.maskObject:e._mask;h&&!(!((o=h.containsPoint)===null||o===void 0)&&o.call(h,a))&&(i=!1)}if(c&&e.interactiveChildren&&e.children)for(var f=e.children,d=f.length-1;d>=0;d--){var m=f[d],g=this.recursiveFindHit(t,m,n,i,u);if(g){if(!m.parent)continue;u=!1,g&&(t.target&&(i=!1),l=!0)}}return s&&(i&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(a)&&(l=!0),e.interactive&&(l&&!t.target&&(t.target=e),n&&n(t,e,!!l))),l},r.prototype.findHit=function(t,e,n,i){this.recursiveFindHit(t,e,n,i,!1)},r}(),dM={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return this.cursor==="pointer"},set buttonMode(r){r?this.cursor="pointer":this.cursor==="pointer"&&(this.cursor=null)},cursor:null,get trackedPointers(){return this._trackedPointers===void 0&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Da.mixin(dM);var Al=1,Ml={target:null,data:{global:null}},Kk=function(r){uM(t,r);function t(e,n){var i=r.call(this)||this;return n=n||{},i.renderer=e,i.autoPreventDefault=n.autoPreventDefault!==void 0?n.autoPreventDefault:!0,i.interactionFrequency=n.interactionFrequency||10,i.mouse=new ig,i.mouse.identifier=Al,i.mouse.global.set(-999999),i.activeInteractionData={},i.activeInteractionData[Al]=i.mouse,i.interactionDataPool=[],i.eventData=new cM,i.interactionDOMElement=null,i.moveWhenInside=!1,i.eventsAdded=!1,i.tickerAdded=!1,i.mouseOverRenderer=!("PointerEvent"in globalThis),i.supportsTouchEvents="ontouchstart"in globalThis,i.supportsPointerEvents=!!globalThis.PointerEvent,i.onPointerUp=i.onPointerUp.bind(i),i.processPointerUp=i.processPointerUp.bind(i),i.onPointerCancel=i.onPointerCancel.bind(i),i.processPointerCancel=i.processPointerCancel.bind(i),i.onPointerDown=i.onPointerDown.bind(i),i.processPointerDown=i.processPointerDown.bind(i),i.onPointerMove=i.onPointerMove.bind(i),i.processPointerMove=i.processPointerMove.bind(i),i.onPointerOut=i.onPointerOut.bind(i),i.processPointerOverOut=i.processPointerOverOut.bind(i),i.onPointerOver=i.onPointerOver.bind(i),i.cursorStyles={default:"inherit",pointer:"pointer"},i.currentCursorMode=null,i.cursor=null,i.resolution=1,i.delayedEvents=[],i.search=new hM,i._tempDisplayObject=new V0,i._eventListenerOptions={capture:!0,passive:!1},i._useSystemTicker=n.useSystemTicker!==void 0?n.useSystemTicker:!0,i.setTargetElement(i.renderer.view,i.renderer.resolution),i}return Object.defineProperty(t.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(e){this._useSystemTicker=e,e?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),t.prototype.hitTest=function(e,n){return Ml.target=null,Ml.data.global=e,n||(n=this.lastObjectRendered),this.processInteractive(Ml,n,null,!0),Ml.target},t.prototype.setTargetElement=function(e,n){n===void 0&&(n=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=e,this.resolution=n,this.addEvents(),this.addTickerListener()},t.prototype.addTickerListener=function(){this.tickerAdded||!this.interactionDOMElement||!this._useSystemTicker||(Mn.system.add(this.tickerUpdate,this,Ao.INTERACTION),this.tickerAdded=!0)},t.prototype.removeTickerListener=function(){this.tickerAdded&&(Mn.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},t.prototype.addEvents=function(){if(!(this.eventsAdded||!this.interactionDOMElement)){var e=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},t.prototype.removeEvents=function(){if(!(!this.eventsAdded||!this.interactionDOMElement)){var e=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},t.prototype.tickerUpdate=function(e){this._deltaTime+=e,!(this._deltaTime0&&(a=e.composedPath()[0]);for(var l=a!==this.interactionDOMElement?"outside":"",u=0;u"u"&&(o.button=e.touches.length?1:0),typeof o.buttons>"u"&&(o.buttons=e.touches.length?1:0),typeof o.isPrimary>"u"&&(o.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,n.push(o)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){var a=e;typeof a.isPrimary>"u"&&(a.isPrimary=!0),typeof a.width>"u"&&(a.width=1),typeof a.height>"u"&&(a.height=1),typeof a.tiltX>"u"&&(a.tiltX=0),typeof a.tiltY>"u"&&(a.tiltY=0),typeof a.pointerType>"u"&&(a.pointerType="mouse"),typeof a.pointerId>"u"&&(a.pointerId=Al),typeof a.pressure>"u"&&(a.pressure=.5),typeof a.twist>"u"&&(a.twist=0),typeof a.tangentialPressure>"u"&&(a.tangentialPressure=0),a.isNormalized=!0,n.push(a)}else n.push(e);return n},t.prototype.destroy=function(){this.removeEvents(),this.removeTickerListener(),this.removeAllListeners(),this.renderer=null,this.mouse=null,this.eventData=null,this.interactionDOMElement=null,this.onPointerDown=null,this.processPointerDown=null,this.onPointerUp=null,this.processPointerUp=null,this.onPointerCancel=null,this.processPointerCancel=null,this.onPointerMove=null,this.processPointerMove=null,this.onPointerOut=null,this.processPointerOverOut=null,this.onPointerOver=null,this.search=null},t.extension={name:"interaction",type:[rn.RendererPlugin,rn.CanvasRendererPlugin]},t}(ki);function Mi(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 uh={exports:{}};/*! localForage -- Offline Storage, Improved Version 1.10.0 https://localforage.github.io/localForage (c) 2013-2017 Mozilla, Apache License 2.0 -*/var sg;function fM(){return sg||(sg=1,function(r,t){(function(e){r.exports=e()})(function(){return function e(n,i,s){function o(u,c){if(!i[u]){if(!n[u]){var h=typeof Ai=="function"&&Ai;if(!c&&h)return h(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[u]={exports:{}};n[u][0].call(d.exports,function(m){var g=n[u][1][m];return o(g||m)},d,d.exports,e,n,i,s)}return i[u].exports}for(var a=typeof Ai=="function"&&Ai,l=0;l"u"&&e(3);var h=Promise;function f(A,V){V&&A.then(function(F){V(null,F)},function(F){V(F)})}function d(A,V,F){typeof V=="function"&&A.then(V),typeof F=="function"&&A.catch(F)}function m(A){return typeof A!="string"&&(console.warn(A+" used as a key, but it is not a string."),A=String(A)),A}function g(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",y=void 0,_={},S=Object.prototype.toString,T="readonly",v="readwrite";function E(A){for(var V=A.length,F=new ArrayBuffer(V),X=new Uint8Array(F),J=0;J=43)}}).catch(function(){return!1})}function B(A){return typeof y=="boolean"?h.resolve(y):w(A).then(function(V){return y=V,y})}function N(A){var V=_[A.name],F={};F.promise=new h(function(X,J){F.resolve=X,F.reject=J}),V.deferredOperations.push(F),V.dbReady?V.dbReady=V.dbReady.then(function(){return F.promise}):V.dbReady=F.promise}function $(A){var V=_[A.name],F=V.deferredOperations.pop();if(F)return F.resolve(),F.promise}function it(A,V){var F=_[A.name],X=F.deferredOperations.pop();if(X)return X.reject(V),X.promise}function I(A,V){return new h(function(F,X){if(_[A.name]=_[A.name]||O(),A.db)if(V)N(A),A.db.close();else return F(A.db);var J=[A.name];V&&J.push(A.version);var G=l.open.apply(l,J);V&&(G.onupgradeneeded=function(st){var ut=G.result;try{ut.createObjectStore(A.storeName),st.oldVersion<=1&&ut.createObjectStore(p)}catch(dt){if(dt.name==="ConstraintError")console.warn('The database "'+A.name+'" has been upgraded from version '+st.oldVersion+" to version "+st.newVersion+', but the storage "'+A.storeName+'" already exists.');else throw dt}}),G.onerror=function(st){st.preventDefault(),X(G.error)},G.onsuccess=function(){var st=G.result;st.onversionchange=function(ut){ut.target.close()},F(st),$(A)}})}function Z(A){return I(A,!1)}function x(A){return I(A,!0)}function nt(A,V){if(!A.db)return!0;var F=!A.db.objectStoreNames.contains(A.storeName),X=A.versionA.db.version;if(X&&(A.version!==V&&console.warn('The database "'+A.name+`" can't be downgraded from version `+A.db.version+" to version "+A.version+"."),A.version=A.db.version),J||F){if(F){var G=A.db.version+1;G>A.version&&(A.version=G)}return!0}return!1}function P(A){return new h(function(V,F){var X=new FileReader;X.onerror=F,X.onloadend=function(J){var G=btoa(J.target.result||"");V({__local_forage_encoded_blob:!0,data:G,type:A.type})},X.readAsBinaryString(A)})}function C(A){var V=E(atob(A.data));return c([V],{type:A.type})}function R(A){return A&&A.__local_forage_encoded_blob}function z(A){var V=this,F=V._initReady().then(function(){var X=_[V._dbInfo.name];if(X&&X.dbReady)return X.dbReady});return d(F,A,A),F}function U(A){N(A);for(var V=_[A.name],F=V.forages,X=0;X0&&(!A.db||G.name==="InvalidStateError"||G.name==="NotFoundError"))return h.resolve().then(function(){if(!A.db||G.name==="NotFoundError"&&!A.db.objectStoreNames.contains(A.storeName)&&A.version<=A.db.version)return A.db&&(A.version=A.db.version+1),x(A)}).then(function(){return U(A).then(function(){M(A,V,F,X-1)})}).catch(F);F(G)}}function O(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function j(A){var V=this,F={db:null};if(A)for(var X in A)F[X]=A[X];var J=_[F.name];J||(J=O(),_[F.name]=J),J.forages.push(V),V._initReady||(V._initReady=V.ready,V.ready=z);var G=[];function st(){return h.resolve()}for(var ut=0;ut>4,yt[J++]=(st&15)<<4|ut>>2,yt[J++]=(ut&3)<<6|dt&63;return pt}function yn(A){var V=new Uint8Array(A),F="",X;for(X=0;X>2],F+=K[(V[X]&3)<<4|V[X+1]>>4],F+=K[(V[X+1]&15)<<2|V[X+2]>>6],F+=K[V[X+2]&63];return V.length%3===2?F=F.substring(0,F.length-1)+"=":V.length%3===1&&(F=F.substring(0,F.length-2)+"=="),F}function gi(A,V){var F="";if(A&&(F=ln.call(A)),A&&(F==="[object ArrayBuffer]"||A.buffer&&ln.call(A.buffer)==="[object ArrayBuffer]")){var X,J=D;A instanceof ArrayBuffer?(X=A,J+=ot):(X=A.buffer,F==="[object Int8Array]"?J+=rt:F==="[object Uint8Array]"?J+=ht:F==="[object Uint8ClampedArray]"?J+=wt:F==="[object Int16Array]"?J+=ft:F==="[object Uint16Array]"?J+=ge:F==="[object Int32Array]"?J+=Mt:F==="[object Uint32Array]"?J+=oe:F==="[object Float32Array]"?J+=Ke:F==="[object Float64Array]"?J+=sr:V(new Error("Failed to get type for BinaryArray"))),V(J+yn(X))}else if(F==="[object Blob]"){var G=new FileReader;G.onload=function(){var st=Q+A.type+"~"+yn(this.result);V(D+at+st)},G.readAsArrayBuffer(A)}else try{V(JSON.stringify(A))}catch(st){console.error("Couldn't convert value into a JSON string: ",A),V(null,st)}}function Ir(A){if(A.substring(0,q)!==D)return JSON.parse(A);var V=A.substring(cr),F=A.substring(q,cr),X;if(F===at&&L.test(V)){var J=V.match(L);X=J[1],V=V.substring(J[0].length)}var G=Ie(V);switch(F){case ot:return G;case at:return c([G],{type:X});case rt:return new Int8Array(G);case ht:return new Uint8Array(G);case wt:return new Uint8ClampedArray(G);case ft:return new Int16Array(G);case ge:return new Uint16Array(G);case Mt:return new Int32Array(G);case oe:return new Uint32Array(G);case Ke:return new Float32Array(G);case sr:return new Float64Array(G);default:throw new Error("Unkown type: "+F)}}var yi={serialize:gi,deserialize:Ir,stringToBuffer:Ie,bufferToString:yn};function Gi(A,V,F,X){A.executeSql("CREATE TABLE IF NOT EXISTS "+V.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],F,X)}function Vo(A){var V=this,F={db:null};if(A)for(var X in A)F[X]=typeof A[X]!="string"?A[X].toString():A[X];var J=new h(function(G,st){try{F.db=openDatabase(F.name,String(F.version),F.description,F.size)}catch(ut){return st(ut)}F.db.transaction(function(ut){Gi(ut,F,function(){V._dbInfo=F,G()},function(dt,pt){st(pt)})},st)});return F.serializer=yi,J}function kr(A,V,F,X,J,G){A.executeSql(F,X,J,function(st,ut){ut.code===ut.SYNTAX_ERR?st.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[V.storeName],function(dt,pt){pt.rows.length?G(dt,ut):Gi(dt,V,function(){dt.executeSql(F,X,J,G)},G)},G):G(st,ut)},G)}function Wi(A,V){var F=this;A=m(A);var X=new h(function(J,G){F.ready().then(function(){var st=F._dbInfo;st.db.transaction(function(ut){kr(ut,st,"SELECT * FROM "+st.storeName+" WHERE key = ? LIMIT 1",[A],function(dt,pt){var yt=pt.rows.length?pt.rows.item(0).value:null;yt&&(yt=st.serializer.deserialize(yt)),J(yt)},function(dt,pt){G(pt)})})}).catch(G)});return f(X,V),X}function Yn(A,V){var F=this,X=new h(function(J,G){F.ready().then(function(){var st=F._dbInfo;st.db.transaction(function(ut){kr(ut,st,"SELECT * FROM "+st.storeName,[],function(dt,pt){for(var yt=pt.rows,Tt=yt.length,ae=0;ae0){st(zr.apply(J,[A,dt,F,X-1]));return}ut(ae)}})})}).catch(ut)});return f(G,F),G}function Ns(A,V,F){return zr.apply(this,[A,V,F,1])}function sl(A,V){var F=this;A=m(A);var X=new h(function(J,G){F.ready().then(function(){var st=F._dbInfo;st.db.transaction(function(ut){kr(ut,st,"DELETE FROM "+st.storeName+" WHERE key = ?",[A],function(){J()},function(dt,pt){G(pt)})})}).catch(G)});return f(X,V),X}function yc(A){var V=this,F=new h(function(X,J){V.ready().then(function(){var G=V._dbInfo;G.db.transaction(function(st){kr(st,G,"DELETE FROM "+G.storeName,[],function(){X()},function(ut,dt){J(dt)})})}).catch(J)});return f(F,A),F}function jo(A){var V=this,F=new h(function(X,J){V.ready().then(function(){var G=V._dbInfo;G.db.transaction(function(st){kr(st,G,"SELECT COUNT(key) as c FROM "+G.storeName,[],function(ut,dt){var pt=dt.rows.item(0).c;X(pt)},function(ut,dt){J(dt)})})}).catch(J)});return f(F,A),F}function vc(A,V){var F=this,X=new h(function(J,G){F.ready().then(function(){var st=F._dbInfo;st.db.transaction(function(ut){kr(ut,st,"SELECT key FROM "+st.storeName+" WHERE id = ? LIMIT 1",[A+1],function(dt,pt){var yt=pt.rows.length?pt.rows.item(0).key:null;J(yt)},function(dt,pt){G(pt)})})}).catch(G)});return f(X,V),X}function _c(A){var V=this,F=new h(function(X,J){V.ready().then(function(){var G=V._dbInfo;G.db.transaction(function(st){kr(st,G,"SELECT key FROM "+G.storeName,[],function(ut,dt){for(var pt=[],yt=0;yt '__WebKitDatabaseInfoTable__'",[],function(J,G){for(var st=[],ut=0;ut0}function $o(A){var V=this,F={};if(A)for(var X in A)F[X]=A[X];return F.keyPrefix=al(A,V._defaultConfig),Tc()?(V._dbInfo=F,F.serializer=yi,h.resolve()):h.reject()}function ll(A){var V=this,F=V.ready().then(function(){for(var X=V._dbInfo.keyPrefix,J=localStorage.length-1;J>=0;J--){var G=localStorage.key(J);G.indexOf(X)===0&&localStorage.removeItem(G)}});return f(F,A),F}function Ic(A,V){var F=this;A=m(A);var X=F.ready().then(function(){var J=F._dbInfo,G=localStorage.getItem(J.keyPrefix+A);return G&&(G=J.serializer.deserialize(G)),G});return f(X,V),X}function Ec(A,V){var F=this,X=F.ready().then(function(){for(var J=F._dbInfo,G=J.keyPrefix,st=G.length,ut=localStorage.length,dt=1,pt=0;pt=0;st--){var ut=localStorage.key(st);ut.indexOf(G)===0&&localStorage.removeItem(ut)}}):J=h.reject("Invalid arguments"),f(J,V),J}var Oc={_driver:"localStorageWrapper",_initStorage:$o,_support:xc(),iterate:Ec,getItem:Ic,setItem:Cc,removeItem:Mc,clear:ll,length:ul,key:Gp,keys:Ac,dropInstance:Bs},Pc=function(V,F){return V===F||typeof V=="number"&&typeof F=="number"&&isNaN(V)&&isNaN(F)},cl=function(V,F){for(var X=V.length,J=0;J"u"?"undefined":s(F))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var X in F){if(X==="storeName"&&(F[X]=F[X].replace(/\W/g,"_")),X==="version"&&typeof F[X]!="number")return new Error("Database version must be a number.");this._config[X]=F[X]}return"driver"in F&&F.driver?this.setDriver(this._config.driver):!0}else return typeof F=="string"?this._config[F]:this._config},A.prototype.defineDriver=function(F,X,J){var G=new h(function(st,ut){try{var dt=F._driver,pt=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!F._driver){ut(pt);return}for(var yt=Rc.concat("_initStorage"),Tt=0,ae=yt.length;Tt"u"&&e(3);var h=Promise;function f(A,V){V&&A.then(function(F){V(null,F)},function(F){V(F)})}function d(A,V,F){typeof V=="function"&&A.then(V),typeof F=="function"&&A.catch(F)}function m(A){return typeof A!="string"&&(console.warn(A+" used as a key, but it is not a string."),A=String(A)),A}function g(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",y=void 0,_={},S=Object.prototype.toString,T="readonly",v="readwrite";function E(A){for(var V=A.length,F=new ArrayBuffer(V),X=new Uint8Array(F),J=0;J=43)}}).catch(function(){return!1})}function B(A){return typeof y=="boolean"?h.resolve(y):w(A).then(function(V){return y=V,y})}function L(A){var V=_[A.name],F={};F.promise=new h(function(X,J){F.resolve=X,F.reject=J}),V.deferredOperations.push(F),V.dbReady?V.dbReady=V.dbReady.then(function(){return F.promise}):V.dbReady=F.promise}function $(A){var V=_[A.name],F=V.deferredOperations.pop();if(F)return F.resolve(),F.promise}function it(A,V){var F=_[A.name],X=F.deferredOperations.pop();if(X)return X.reject(V),X.promise}function I(A,V){return new h(function(F,X){if(_[A.name]=_[A.name]||O(),A.db)if(V)L(A),A.db.close();else return F(A.db);var J=[A.name];V&&J.push(A.version);var G=l.open.apply(l,J);V&&(G.onupgradeneeded=function(st){var ut=G.result;try{ut.createObjectStore(A.storeName),st.oldVersion<=1&&ut.createObjectStore(p)}catch(dt){if(dt.name==="ConstraintError")console.warn('The database "'+A.name+'" has been upgraded from version '+st.oldVersion+" to version "+st.newVersion+', but the storage "'+A.storeName+'" already exists.');else throw dt}}),G.onerror=function(st){st.preventDefault(),X(G.error)},G.onsuccess=function(){var st=G.result;st.onversionchange=function(ut){ut.target.close()},F(st),$(A)}})}function Z(A){return I(A,!1)}function x(A){return I(A,!0)}function nt(A,V){if(!A.db)return!0;var F=!A.db.objectStoreNames.contains(A.storeName),X=A.versionA.db.version;if(X&&(A.version!==V&&console.warn('The database "'+A.name+`" can't be downgraded from version `+A.db.version+" to version "+A.version+"."),A.version=A.db.version),J||F){if(F){var G=A.db.version+1;G>A.version&&(A.version=G)}return!0}return!1}function P(A){return new h(function(V,F){var X=new FileReader;X.onerror=F,X.onloadend=function(J){var G=btoa(J.target.result||"");V({__local_forage_encoded_blob:!0,data:G,type:A.type})},X.readAsBinaryString(A)})}function C(A){var V=E(atob(A.data));return c([V],{type:A.type})}function R(A){return A&&A.__local_forage_encoded_blob}function z(A){var V=this,F=V._initReady().then(function(){var X=_[V._dbInfo.name];if(X&&X.dbReady)return X.dbReady});return d(F,A,A),F}function U(A){L(A);for(var V=_[A.name],F=V.forages,X=0;X0&&(!A.db||G.name==="InvalidStateError"||G.name==="NotFoundError"))return h.resolve().then(function(){if(!A.db||G.name==="NotFoundError"&&!A.db.objectStoreNames.contains(A.storeName)&&A.version<=A.db.version)return A.db&&(A.version=A.db.version+1),x(A)}).then(function(){return U(A).then(function(){M(A,V,F,X-1)})}).catch(F);F(G)}}function O(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function j(A){var V=this,F={db:null};if(A)for(var X in A)F[X]=A[X];var J=_[F.name];J||(J=O(),_[F.name]=J),J.forages.push(V),V._initReady||(V._initReady=V.ready,V.ready=z);var G=[];function st(){return h.resolve()}for(var ut=0;ut>4,yt[J++]=(st&15)<<4|ut>>2,yt[J++]=(ut&3)<<6|dt&63;return pt}function yn(A){var V=new Uint8Array(A),F="",X;for(X=0;X>2],F+=K[(V[X]&3)<<4|V[X+1]>>4],F+=K[(V[X+1]&15)<<2|V[X+2]>>6],F+=K[V[X+2]&63];return V.length%3===2?F=F.substring(0,F.length-1)+"=":V.length%3===1&&(F=F.substring(0,F.length-2)+"=="),F}function yi(A,V){var F="";if(A&&(F=ln.call(A)),A&&(F==="[object ArrayBuffer]"||A.buffer&&ln.call(A.buffer)==="[object ArrayBuffer]")){var X,J=D;A instanceof ArrayBuffer?(X=A,J+=ot):(X=A.buffer,F==="[object Int8Array]"?J+=rt:F==="[object Uint8Array]"?J+=ht:F==="[object Uint8ClampedArray]"?J+=wt:F==="[object Int16Array]"?J+=ft:F==="[object Uint16Array]"?J+=ge:F==="[object Int32Array]"?J+=Mt:F==="[object Uint32Array]"?J+=oe:F==="[object Float32Array]"?J+=Ke:F==="[object Float64Array]"?J+=sr:V(new Error("Failed to get type for BinaryArray"))),V(J+yn(X))}else if(F==="[object Blob]"){var G=new FileReader;G.onload=function(){var st=Q+A.type+"~"+yn(this.result);V(D+at+st)},G.readAsArrayBuffer(A)}else try{V(JSON.stringify(A))}catch(st){console.error("Couldn't convert value into a JSON string: ",A),V(null,st)}}function Ir(A){if(A.substring(0,q)!==D)return JSON.parse(A);var V=A.substring(cr),F=A.substring(q,cr),X;if(F===at&&N.test(V)){var J=V.match(N);X=J[1],V=V.substring(J[0].length)}var G=Ie(V);switch(F){case ot:return G;case at:return c([G],{type:X});case rt:return new Int8Array(G);case ht:return new Uint8Array(G);case wt:return new Uint8ClampedArray(G);case ft:return new Int16Array(G);case ge:return new Uint16Array(G);case Mt:return new Int32Array(G);case oe:return new Uint32Array(G);case Ke:return new Float32Array(G);case sr:return new Float64Array(G);default:throw new Error("Unkown type: "+F)}}var vi={serialize:yi,deserialize:Ir,stringToBuffer:Ie,bufferToString:yn};function Gi(A,V,F,X){A.executeSql("CREATE TABLE IF NOT EXISTS "+V.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],F,X)}function Vo(A){var V=this,F={db:null};if(A)for(var X in A)F[X]=typeof A[X]!="string"?A[X].toString():A[X];var J=new h(function(G,st){try{F.db=openDatabase(F.name,String(F.version),F.description,F.size)}catch(ut){return st(ut)}F.db.transaction(function(ut){Gi(ut,F,function(){V._dbInfo=F,G()},function(dt,pt){st(pt)})},st)});return F.serializer=vi,J}function kr(A,V,F,X,J,G){A.executeSql(F,X,J,function(st,ut){ut.code===ut.SYNTAX_ERR?st.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[V.storeName],function(dt,pt){pt.rows.length?G(dt,ut):Gi(dt,V,function(){dt.executeSql(F,X,J,G)},G)},G):G(st,ut)},G)}function Wi(A,V){var F=this;A=m(A);var X=new h(function(J,G){F.ready().then(function(){var st=F._dbInfo;st.db.transaction(function(ut){kr(ut,st,"SELECT * FROM "+st.storeName+" WHERE key = ? LIMIT 1",[A],function(dt,pt){var yt=pt.rows.length?pt.rows.item(0).value:null;yt&&(yt=st.serializer.deserialize(yt)),J(yt)},function(dt,pt){G(pt)})})}).catch(G)});return f(X,V),X}function Yn(A,V){var F=this,X=new h(function(J,G){F.ready().then(function(){var st=F._dbInfo;st.db.transaction(function(ut){kr(ut,st,"SELECT * FROM "+st.storeName,[],function(dt,pt){for(var yt=pt.rows,Tt=yt.length,ae=0;ae0){st(zr.apply(J,[A,dt,F,X-1]));return}ut(ae)}})})}).catch(ut)});return f(G,F),G}function Ns(A,V,F){return zr.apply(this,[A,V,F,1])}function sl(A,V){var F=this;A=m(A);var X=new h(function(J,G){F.ready().then(function(){var st=F._dbInfo;st.db.transaction(function(ut){kr(ut,st,"DELETE FROM "+st.storeName+" WHERE key = ?",[A],function(){J()},function(dt,pt){G(pt)})})}).catch(G)});return f(X,V),X}function yc(A){var V=this,F=new h(function(X,J){V.ready().then(function(){var G=V._dbInfo;G.db.transaction(function(st){kr(st,G,"DELETE FROM "+G.storeName,[],function(){X()},function(ut,dt){J(dt)})})}).catch(J)});return f(F,A),F}function jo(A){var V=this,F=new h(function(X,J){V.ready().then(function(){var G=V._dbInfo;G.db.transaction(function(st){kr(st,G,"SELECT COUNT(key) as c FROM "+G.storeName,[],function(ut,dt){var pt=dt.rows.item(0).c;X(pt)},function(ut,dt){J(dt)})})}).catch(J)});return f(F,A),F}function vc(A,V){var F=this,X=new h(function(J,G){F.ready().then(function(){var st=F._dbInfo;st.db.transaction(function(ut){kr(ut,st,"SELECT key FROM "+st.storeName+" WHERE id = ? LIMIT 1",[A+1],function(dt,pt){var yt=pt.rows.length?pt.rows.item(0).key:null;J(yt)},function(dt,pt){G(pt)})})}).catch(G)});return f(X,V),X}function _c(A){var V=this,F=new h(function(X,J){V.ready().then(function(){var G=V._dbInfo;G.db.transaction(function(st){kr(st,G,"SELECT key FROM "+G.storeName,[],function(ut,dt){for(var pt=[],yt=0;yt '__WebKitDatabaseInfoTable__'",[],function(J,G){for(var st=[],ut=0;ut0}function $o(A){var V=this,F={};if(A)for(var X in A)F[X]=A[X];return F.keyPrefix=al(A,V._defaultConfig),Tc()?(V._dbInfo=F,F.serializer=vi,h.resolve()):h.reject()}function ll(A){var V=this,F=V.ready().then(function(){for(var X=V._dbInfo.keyPrefix,J=localStorage.length-1;J>=0;J--){var G=localStorage.key(J);G.indexOf(X)===0&&localStorage.removeItem(G)}});return f(F,A),F}function Ic(A,V){var F=this;A=m(A);var X=F.ready().then(function(){var J=F._dbInfo,G=localStorage.getItem(J.keyPrefix+A);return G&&(G=J.serializer.deserialize(G)),G});return f(X,V),X}function Ec(A,V){var F=this,X=F.ready().then(function(){for(var J=F._dbInfo,G=J.keyPrefix,st=G.length,ut=localStorage.length,dt=1,pt=0;pt=0;st--){var ut=localStorage.key(st);ut.indexOf(G)===0&&localStorage.removeItem(ut)}}):J=h.reject("Invalid arguments"),f(J,V),J}var Oc={_driver:"localStorageWrapper",_initStorage:$o,_support:xc(),iterate:Ec,getItem:Ic,setItem:Cc,removeItem:Mc,clear:ll,length:ul,key:Gp,keys:Ac,dropInstance:Bs},Pc=function(V,F){return V===F||typeof V=="number"&&typeof F=="number"&&isNaN(V)&&isNaN(F)},cl=function(V,F){for(var X=V.length,J=0;J"u"?"undefined":s(F))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var X in F){if(X==="storeName"&&(F[X]=F[X].replace(/\W/g,"_")),X==="version"&&typeof F[X]!="number")return new Error("Database version must be a number.");this._config[X]=F[X]}return"driver"in F&&F.driver?this.setDriver(this._config.driver):!0}else return typeof F=="string"?this._config[F]:this._config},A.prototype.defineDriver=function(F,X,J){var G=new h(function(st,ut){try{var dt=F._driver,pt=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!F._driver){ut(pt);return}for(var yt=Rc.concat("_initStorage"),Tt=0,ae=yt.length;Tt(r.Idle="<|EMOTE_NEUTRAL|>",r.Happy="<|EMOTE_HAPPY|>",r.Sad="<|EMOTE_SAD|>",r.Angry="<|EMOTE_ANGRY|>",r.Think="<|EMOTE_THINK|>",r.Surprise="<|EMOTE_SURPRISE|>",r.Awkward="<|EMOTE_AWKWARD|>",r.Question="<|EMOTE_QUESTION|>",r))(lb||{});const e3=Object.values(lb),fO="Happy",pO="Sad",mO="Angry",gO="Awkward",yO="Think",vO="Surprise",_O="Question",bO="Idle",r3={"<|EMOTE_HAPPY|>":fO,"<|EMOTE_SAD|>":pO,"<|EMOTE_ANGRY|>":mO,"<|EMOTE_THINK|>":yO,"<|EMOTE_SURPRISE|>":vO,"<|EMOTE_AWKWARD|>":gO,"<|EMOTE_QUESTION|>":_O,"<|EMOTE_NEUTRAL|>":bO},n3={"<|EMOTE_HAPPY|>":"happy","<|EMOTE_SAD|>":"sad","<|EMOTE_ANGRY|>":"angry","<|EMOTE_THINK|>":void 0,"<|EMOTE_SURPRISE|>":"surprised","<|EMOTE_AWKWARD|>":void 0,"<|EMOTE_QUESTION|>":void 0,"<|EMOTE_NEUTRAL|>":void 0};/*! - * @pixiv/three-vrm v3.3.6 +`;(function(r){uO(t,r);function t(e){var n=this,i=Object.assign(t.defaults,e),s=i.maxKernelSize,o=cO(i,["maxKernelSize"]);return n=r.call(this,hO,dO.replace("${maxKernelSize}",s.toFixed(1)))||this,Object.assign(n,o),n}return Object.defineProperty(t.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(e){this.uniforms.uCenter=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strength",{get:function(){return this.uniforms.uStrength},set:function(e){this.uniforms.uStrength=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"innerRadius",{get:function(){return this.uniforms.uInnerRadius},set:function(e){this.uniforms.uInnerRadius=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},enumerable:!1,configurable:!0}),t.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32},t})(ie);const Ud=400,On=[[.075,800],[.11,0],[.125,0],[.14,0],[.125,0],[.05,0],[.04,0],[.03,0],[.02,0],[1,0]];for(let r=1;r(r.Idle="<|EMOTE_NEUTRAL|>",r.Happy="<|EMOTE_HAPPY|>",r.Sad="<|EMOTE_SAD|>",r.Angry="<|EMOTE_ANGRY|>",r.Think="<|EMOTE_THINK|>",r.Surprise="<|EMOTE_SURPRISE|>",r.Awkward="<|EMOTE_AWKWARD|>",r.Question="<|EMOTE_QUESTION|>",r))(lb||{});const r3=Object.values(lb),fO="Happy",pO="Sad",mO="Angry",gO="Awkward",yO="Think",vO="Surprise",_O="Question",bO="Idle",n3={"<|EMOTE_HAPPY|>":fO,"<|EMOTE_SAD|>":pO,"<|EMOTE_ANGRY|>":mO,"<|EMOTE_THINK|>":yO,"<|EMOTE_SURPRISE|>":vO,"<|EMOTE_AWKWARD|>":gO,"<|EMOTE_QUESTION|>":_O,"<|EMOTE_NEUTRAL|>":bO},i3={"<|EMOTE_HAPPY|>":"happy","<|EMOTE_SAD|>":"sad","<|EMOTE_ANGRY|>":"angry","<|EMOTE_THINK|>":void 0,"<|EMOTE_SURPRISE|>":"surprised","<|EMOTE_AWKWARD|>":void 0,"<|EMOTE_QUESTION|>":void 0,"<|EMOTE_NEUTRAL|>":void 0};/*! + * @pixiv/three-vrm v3.4.0 * VRM file loader for three.js. * * Copyright (c) 2019-2025 pixiv Inc. * @pixiv/three-vrm is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */var Cl=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),pe=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),og=class extends Ca{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 t=this._binds.indexOf(r);t>=0&&this._binds.splice(t,1)}applyWeight(r){var t;let e=this.outputWeight;e*=(t=r==null?void 0:r.multiplier)!=null?t:1,this.isBinary&&e<1&&(e=0),this._binds.forEach(n=>n.applyWeight(e))}clearAppliedWeight(){this._binds.forEach(r=>r.clearAppliedWeight())}};function ub(r,t,e){var n,i;const s=r.parser.json,o=(n=s.nodes)==null?void 0:n[t];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${t}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const u=l.primitives.length,c=[];return e.traverse(h=>{c.length{const s=ub(r,i,n);s!=null&&e.set(i,s)}),e})}var kd={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 cb(r){return Math.max(Math.min(r,1),0)}var ug=class hb{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 t={},e=new Set(Object.values(kd));return Object.entries(this._expressionMap).forEach(([n,i])=>{e.has(n)&&(t[n]=i)}),t}get customExpressionMap(){const t={},e=new Set(Object.values(kd));return Object.entries(this._expressionMap).forEach(([n,i])=>{e.has(n)||(t[n]=i)}),t}copy(t){return this._expressions.concat().forEach(n=>{this.unregisterExpression(n)}),t._expressions.forEach(n=>{this.registerExpression(n)}),this.blinkExpressionNames=t.blinkExpressionNames.concat(),this.lookAtExpressionNames=t.lookAtExpressionNames.concat(),this.mouthExpressionNames=t.mouthExpressionNames.concat(),this}clone(){return new hb().copy(this)}getExpression(t){var e;return(e=this._expressionMap[t])!=null?e:null}registerExpression(t){this._expressions.push(t),this._expressionMap[t.expressionName]=t}unregisterExpression(t){const e=this._expressions.indexOf(t);e===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(e,1),delete this._expressionMap[t.expressionName]}getValue(t){var e;const n=this.getExpression(t);return(e=n==null?void 0:n.weight)!=null?e:null}setValue(t,e){const n=this.getExpression(t);n&&(n.weight=cb(e))}resetValues(){this._expressions.forEach(t=>{t.weight=0})}getExpressionTrackName(t){const e=this.getExpression(t);return e?`${e.name}.weight`:null}update(){const t=this._calculateWeightMultipliers();this._expressions.forEach(e=>{e.clearAppliedWeight()}),this._expressions.forEach(e=>{let n=1;const i=e.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(n*=t.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(n*=t.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(n*=t.mouth),e.applyWeight({multiplier:n})})}_calculateWeightMultipliers(){let t=1,e=1,n=1;return this._expressions.forEach(i=>{t-=i.overrideBlinkAmount,e-=i.overrideLookAtAmount,n-=i.overrideMouthAmount}),t=Math.max(0,t),e=Math.max(0,e),n=Math.max(0,n),{blink:t,lookAt:e,mouth:n}}},Ko={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},wO={_Color:Ko.Color,_EmissionColor:Ko.EmissionColor,_ShadeColor:Ko.ShadeColor,_RimColor:Ko.RimColor,_OutlineColor:Ko.OutlineColor},xO=new qr,db=class fb{constructor({material:t,type:e,targetValue:n,targetAlpha:i}){this.material=t,this.type=e,this.targetValue=n,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(t){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:i,deltaValue:s}=e,o=this.material[i];o!=null&&o.add(xO.copy(s).multiplyScalar(t))}if(n!=null){const{propertyName:i,deltaValue:s}=n;this.material[i]!=null&&(this.material[i]+=s*t)}}clearAppliedWeight(){const{color:t,alpha:e}=this._state;if(t!=null){const{propertyName:n,initialValue:i}=t,s=this.material[n];s!=null&&s.copy(i)}if(e!=null){const{propertyName:n,initialValue:i}=e;this.material[n]!=null&&(this.material[n]=i)}}_initColorBindState(){var t,e,n;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(e=(t=a==null?void 0:a[s])==null?void 0:t[0])!=null?e:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(n=i.name)!=null?n:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const c=i[l].clone(),h=new qr(o.r-c.r,o.g-c.g,o.b-c.b);return{propertyName:l,initialValue:c,deltaValue:h}}_initAlphaBindState(){var t,e,n;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(e=(t=a==null?void 0:a[s])==null?void 0:t[1])!=null?e:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(n=i.name)!=null?n:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const u=i[l],c=o-u;return{propertyName:l,initialValue:u,deltaValue:c}}_getPropertyNameMap(){var t,e;return(e=(t=Object.entries(fb._propertyNameMapMap).find(([n])=>this.material[n]===!0))==null?void 0:t[1])!=null?e:null}};db._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 cg=db,cu=class{constructor({primitives:r,index:t,weight:e}){this.primitives=r,this.index=t,this.weight=e}applyWeight(r){this.primitives.forEach(t=>{var e;((e=t.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(t.morphTargetInfluences[this.index]+=this.weight*r)})}clearAppliedWeight(){this.primitives.forEach(r=>{var t;((t=r.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(r.morphTargetInfluences[this.index]=0)})}},hg=new co,pb=class mb{constructor({material:t,scale:e,offset:n}){var i,s;this.material=t,this.scale=e,this.offset=n;const o=(i=Object.entries(mb._propertyNamesMap).find(([a])=>t[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=t.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const u=(l=t[a])==null?void 0:l.clone();if(!u)return null;t[a]=u;const c=u.offset.clone(),h=u.repeat.clone(),f=n.clone().sub(c),d=e.clone().sub(h);this._properties.push({name:a,initialOffset:c,deltaOffset:f,initialScale:h,deltaScale:d})}))}applyWeight(t){this._properties.forEach(e=>{const n=this.material[e.name];n!==void 0&&(n.offset.add(hg.copy(e.deltaOffset).multiplyScalar(t)),n.repeat.add(hg.copy(e.deltaScale).multiplyScalar(t)))})}clearAppliedWeight(){this._properties.forEach(t=>{const e=this.material[t.name];e!==void 0&&(e.offset.copy(t.initialOffset),e.repeat.copy(t.initialScale))})}};pb._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var dg=pb,SO=new Set(["1.0","1.0-beta"]),gb=class yb{get name(){return"VRMExpressionLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return pe(this,null,function*(){t.userData.vrmExpressionManager=yield this._import(t)})}_import(t){return pe(this,null,function*(){const e=yield this._v1Import(t);if(e)return e;const n=yield this._v0Import(t);return n||null})}_v1Import(t){return pe(this,null,function*(){var e,n;const i=this.parser.json;if(!(((e=i.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const o=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!SO.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const u=new Set(Object.values(kd)),c=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([f,d])=>{if(d!=null){if(!u.has(f)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${f}" detected. Ignoring the expression`);return}c.set(f,d)}}),l.custom!=null&&Object.entries(l.custom).forEach(([f,d])=>{if(u.has(f)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${f}". Ignoring the expression`);return}c.set(f,d)});const h=new ug;return yield Promise.all(Array.from(c.entries()).map(f=>pe(this,[f],function*([d,m]){var g,p,y,_,S,T,v;const E=new og(d);if(t.scene.add(E),E.isBinary=(g=m.isBinary)!=null?g:!1,E.overrideBlink=(p=m.overrideBlink)!=null?p:"none",E.overrideLookAt=(y=m.overrideLookAt)!=null?y:"none",E.overrideMouth=(_=m.overrideMouth)!=null?_:"none",(S=m.morphTargetBinds)==null||S.forEach(w=>pe(this,null,function*(){var B;if(w.node===void 0||w.index===void 0)return;const N=yield ag(t,w.node),$=w.index;if(!N.every(it=>Array.isArray(it.morphTargetInfluences)&&${const N=B.material;N&&(Array.isArray(N)?w.push(...N):w.push(N))}),(T=m.materialColorBinds)==null||T.forEach(B=>pe(this,null,function*(){w.filter($=>{var it;const I=(it=this.parser.associations.get($))==null?void 0:it.materials;return B.material===I}).forEach($=>{E.addBind(new cg({material:$,type:B.type,targetValue:new qr().fromArray(B.targetValue),targetAlpha:B.targetValue[3]}))})})),(v=m.textureTransformBinds)==null||v.forEach(B=>pe(this,null,function*(){w.filter($=>{var it;const I=(it=this.parser.associations.get($))==null?void 0:it.materials;return B.material===I}).forEach($=>{var it,I;E.addBind(new dg({material:$,offset:new co().fromArray((it=B.offset)!=null?it:[0,0]),scale:new co().fromArray((I=B.scale)!=null?I:[1,1])}))})}))}h.registerExpression(E)}))),h})}_v0Import(t){return pe(this,null,function*(){var e;const n=this.parser.json,i=(e=n.extensions)==null?void 0:e.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new ug,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(u=>pe(this,null,function*(){var c;const h=u.presetName,f=h!=null&&yb.v0v1PresetNameMap[h]||null,d=f??u.name;if(d==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(d)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${h} has duplicated entries. Ignoring the expression`);return}l.add(d);const m=new og(d);t.scene.add(m),m.isBinary=(c=u.isBinary)!=null?c:!1,u.binds&&u.binds.forEach(p=>pe(this,null,function*(){var y;if(p.mesh===void 0||p.index===void 0)return;const _=[];(y=n.nodes)==null||y.forEach((T,v)=>{T.mesh===p.mesh&&_.push(v)});const S=p.index;yield Promise.all(_.map(T=>pe(this,null,function*(){var v;const E=yield ag(t,T);if(!E.every(w=>Array.isArray(w.morphTargetInfluences)&&S{if(p.materialName===void 0||p.propertyName===void 0||p.targetValue===void 0)return;const y=[];t.scene.traverse(S=>{if(S.material){const T=S.material;Array.isArray(T)?y.push(...T.filter(v=>(v.name===p.materialName||v.name===p.materialName+" (Outline)")&&y.indexOf(v)===-1)):T.name===p.materialName&&y.indexOf(T)===-1&&y.push(T)}});const _=p.propertyName;y.forEach(S=>{if(_==="_MainTex_ST"){const v=new co(p.targetValue[0],p.targetValue[1]),E=new co(p.targetValue[2],p.targetValue[3]);E.y=1-E.y-v.y,m.addBind(new dg({material:S,scale:v,offset:E}));return}const T=wO[_];if(T){m.addBind(new cg({material:S,type:T,targetValue:new qr().fromArray(p.targetValue),targetAlpha:p.targetValue[3]}));return}console.warn(_+" is not supported")})}),o.registerExpression(m)}))),o})}};gb.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 TO=gb,Yf=class qs{constructor(t,e){this._firstPersonOnlyLayer=qs.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=qs.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=t,this.meshAnnotations=e}copy(t){if(this.humanoid!==t.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=t.meshAnnotations.map(e=>({meshes:e.meshes.concat(),type:e.type})),this}clone(){return new qs(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:t=qs.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:e=qs.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=t,this._thirdPersonOnlyLayer=e,this.meshAnnotations.forEach(n=>{n.meshes.forEach(i=>{n.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):n.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):n.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(t,e,n,i){let s=0;if(e!=null&&e.length>0)for(let o=0;o0&&i.includes(h[0])||c[1]>0&&i.includes(h[1])||c[2]>0&&i.includes(h[2])||c[3]>0&&i.includes(h[3]))continue;const f=e[l],d=n[l];if(f[0]>0&&i.includes(d[0])||f[1]>0&&i.includes(d[1])||f[2]>0&&i.includes(d[2])||f[3]>0&&i.includes(d[3]))continue;const m=e[u],g=n[u];m[0]>0&&i.includes(g[0])||m[1]>0&&i.includes(g[1])||m[2]>0&&i.includes(g[2])||m[3]>0&&i.includes(g[3])||(t[s++]=a,t[s++]=l,t[s++]=u)}return s}_createErasedMesh(t,e){const n=new S1(t.geometry.clone(),t.material);n.name=`${t.name}(erase)`,n.frustumCulled=t.frustumCulled,n.layers.set(this._firstPersonOnlyLayer);const i=n.geometry,s=i.getAttribute("skinIndex"),o=s instanceof Qp?[]:s.array,a=[];for(let g=0;g{this._isEraseTarget(s)&&n.push(o)}),!n.length){e.layers.enable(this._thirdPersonOnlyLayer),e.layers.enable(this._firstPersonOnlyLayer);return}e.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(e,n);t.add(i)}_createHeadlessModel(t){if(t.type==="Group")if(t.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(t))t.traverse(e=>e.layers.set(this._thirdPersonOnlyLayer));else{const e=new No;e.name=`_headless_${t.name}`,e.layers.set(this._firstPersonOnlyLayer),t.parent.add(e),t.children.filter(n=>n.type==="SkinnedMesh").forEach(n=>{const i=n;this._createHeadlessModelForSkinnedMesh(e,i)})}else if(t.type==="SkinnedMesh"){const e=t;this._createHeadlessModelForSkinnedMesh(t.parent,e)}else this._isEraseTarget(t)&&(t.layers.set(this._thirdPersonOnlyLayer),t.traverse(e=>e.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(t){return t===this.humanoid.getRawBoneNode("head")?!0:t.parent?this._isEraseTarget(t.parent):!1}};Yf.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;Yf.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var fg=Yf,IO=new Set(["1.0","1.0-beta"]),EO=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(r){this.parser=r}afterRoot(r){return pe(this,null,function*(){const t=r.userData.vrmHumanoid;if(t!==null){if(t===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");r.userData.vrmFirstPerson=yield this._import(r,t)}})}_import(r,t){return pe(this,null,function*(){if(t==null)return null;const e=yield this._v1Import(r,t);if(e)return e;const n=yield this._v0Import(r,t);return n||null})}_v1Import(r,t){return pe(this,null,function*(){var e,n;const i=this.parser.json;if(!(((e=i.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const o=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!IO.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,u=[],c=yield lg(r);return Array.from(c.entries()).forEach(([h,f])=>{var d,m;const g=(d=l==null?void 0:l.meshAnnotations)==null?void 0:d.find(p=>p.node===h);u.push({meshes:f,type:(m=g==null?void 0:g.type)!=null?m:"auto"})}),new fg(t,u)})}_v0Import(r,t){return pe(this,null,function*(){var e;const n=this.parser.json,i=(e=n.extensions)==null?void 0:e.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield lg(r);return Array.from(a.entries()).forEach(([l,u])=>{const c=n.nodes[l],h=s.meshAnnotations?s.meshAnnotations.find(f=>f.mesh===c.mesh):void 0;o.push({meshes:u,type:this._convertV0FlagToV1Type(h==null?void 0:h.firstPersonFlag)})}),new fg(t,o)})}_convertV0FlagToV1Type(r){return r==="FirstPersonOnly"?"firstPersonOnly":r==="ThirdPersonOnly"?"thirdPersonOnly":r==="Both"?"both":"auto"}},pg=new mt,mg=new mt,AO=new ne,gg=class extends No{constructor(r){super(),this.vrmHumanoid=r,this._boneAxesMap=new Map,Object.values(r.humanBones).forEach(t=>{const e=new T1(1);e.matrixAutoUpdate=!1,e.material.depthTest=!1,e.material.depthWrite=!1,this.add(e),this._boneAxesMap.set(t,e)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(r=>{r.geometry.dispose(),r.material.dispose()})}updateMatrixWorld(r){Array.from(this._boneAxesMap.entries()).forEach(([t,e])=>{t.node.updateWorldMatrix(!0,!1),t.node.matrixWorld.decompose(pg,AO,mg);const n=pg.set(.1,.1,.1).divide(mg);e.matrix.copy(t.node.matrixWorld).scale(n)}),super.updateMatrixWorld(r)}},ch=["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"],MO={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 vb(r){return r.invert?r.invert():r.inverse(),r}var Zi=new mt,Ki=new ne,zd=class{constructor(r){this.humanBones=r,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const r={};return Object.keys(this.humanBones).forEach(t=>{const e=t,n=this.getBoneNode(e);n&&(Zi.copy(n.position),Ki.copy(n.quaternion),r[e]={position:Zi.toArray(),rotation:Ki.toArray()})}),r}getPose(){const r={};return Object.keys(this.humanBones).forEach(t=>{const e=t,n=this.getBoneNode(e);if(!n)return;Zi.set(0,0,0),Ki.identity();const i=this.restPose[e];i!=null&&i.position&&Zi.fromArray(i.position).negate(),i!=null&&i.rotation&&vb(Ki.fromArray(i.rotation)),Zi.add(n.position),Ki.premultiply(n.quaternion),r[e]={position:Zi.toArray(),rotation:Ki.toArray()}}),r}setPose(r){Object.entries(r).forEach(([t,e])=>{const n=t,i=this.getBoneNode(n);if(!i)return;const s=this.restPose[n];s&&(e!=null&&e.position&&(i.position.fromArray(e.position),s.position&&i.position.add(Zi.fromArray(s.position))),e!=null&&e.rotation&&(i.quaternion.fromArray(e.rotation),s.rotation&&i.quaternion.multiply(Ki.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([r,t])=>{const e=this.getBoneNode(r);e&&(t!=null&&t.position&&e.position.fromArray(t.position),t!=null&&t.rotation&&e.quaternion.fromArray(t.rotation))})}getBone(r){var t;return(t=this.humanBones[r])!=null?t:void 0}getBoneNode(r){var t,e;return(e=(t=this.humanBones[r])==null?void 0:t.node)!=null?e:null}},hh=new mt,CO=new ne,OO=new mt,yg=class _b extends zd{static _setupTransforms(t){const e=new Ca;e.name="VRMHumanoidRig";const n={},i={},s={};ch.forEach(a=>{var l;const u=t.getBoneNode(a);if(u){const c=new mt,h=new ne;u.updateWorldMatrix(!0,!1),u.matrixWorld.decompose(c,h,hh),n[a]=c,i[a]=u.quaternion.clone();const f=new ne;(l=u.parent)==null||l.matrixWorld.decompose(hh,f,hh),s[a]=f}});const o={};return ch.forEach(a=>{var l;const u=t.getBoneNode(a);if(u){const c=n[a];let h=a,f;for(;f==null&&(h=MO[h],h!=null);)f=n[h];const d=new Ca;d.name="Normalized_"+u.name,(h?(l=o[h])==null?void 0:l.node:e).add(d),d.position.copy(c),f&&d.position.sub(f),o[a]={node:d}}}),{rigBones:o,root:e,parentWorldRotations:s,boneRotations:i}}constructor(t){const{rigBones:e,root:n,parentWorldRotations:i,boneRotations:s}=_b._setupTransforms(t);super(e),this.original=t,this.root=n,this._parentWorldRotations=i,this._boneRotations=s}update(){ch.forEach(t=>{const e=this.original.getBoneNode(t);if(e!=null){const n=this.getBoneNode(t),i=this._parentWorldRotations[t],s=CO.copy(i).invert(),o=this._boneRotations[t];if(e.quaternion.copy(n.quaternion).multiply(i).premultiply(s).multiply(o),t==="hips"){const a=n.getWorldPosition(OO);e.parent.updateWorldMatrix(!0,!1);const l=e.parent.matrixWorld,u=a.applyMatrix4(l.invert());e.position.copy(u)}}})}},vg=class bb{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(t,e){var n;this.autoUpdateHumanBones=(n=e==null?void 0:e.autoUpdateHumanBones)!=null?n:!0,this._rawHumanBones=new zd(t),this._normalizedHumanBones=new yg(this._rawHumanBones)}copy(t){return this.autoUpdateHumanBones=t.autoUpdateHumanBones,this._rawHumanBones=new zd(t.humanBones),this._normalizedHumanBones=new yg(this._rawHumanBones),this}clone(){return new bb(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(t){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(t)}setRawPose(t){return this._rawHumanBones.setPose(t)}setNormalizedPose(t){return this._normalizedHumanBones.setPose(t)}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(t){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(t)}getRawBone(t){return this._rawHumanBones.getBone(t)}getNormalizedBone(t){return this._normalizedHumanBones.getBone(t)}getBoneNode(t){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(t)}getRawBoneNode(t){return this._rawHumanBones.getBoneNode(t)}getNormalizedBoneNode(t){return this._normalizedHumanBones.getBoneNode(t)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},PO={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"},RO=new Set(["1.0","1.0-beta"]),_g={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},FO=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(r,t){this.parser=r,this.helperRoot=t==null?void 0:t.helperRoot,this.autoUpdateHumanBones=t==null?void 0:t.autoUpdateHumanBones}afterRoot(r){return pe(this,null,function*(){r.userData.vrmHumanoid=yield this._import(r)})}_import(r){return pe(this,null,function*(){const t=yield this._v1Import(r);if(t)return t;const e=yield this._v0Import(r);return e||null})}_v1Import(r){return pe(this,null,function*(){var t,e;const n=this.parser.json;if(!(((t=n.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const s=(e=n.extensions)==null?void 0:e.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!RO.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,u={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(h=>pe(this,[h],function*([f,d]){let m=f;const g=d.node;if(l){const y=_g[m];y!=null&&(m=y)}const p=yield this.parser.getDependency("node",g);if(p==null){console.warn(`A glTF node bound to the humanoid bone ${m} (index = ${g}) does not exist`);return}u[m]={node:p}}))));const c=new vg(this._ensureRequiredBonesExist(u),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(r.scene.add(c.normalizedHumanBonesRoot),this.helperRoot){const h=new gg(c);this.helperRoot.add(h),h.renderOrder=this.helperRoot.renderOrder}return c})}_v0Import(r){return pe(this,null,function*(){var t;const n=(t=this.parser.json.extensions)==null?void 0:t.VRM;if(!n)return null;const i=n.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>pe(this,null,function*(){const l=a.bone,u=a.node;if(l==null||u==null)return;const c=yield this.parser.getDependency("node",u);if(c==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${u}) does not exist`);return}const h=_g[l],f=h??l;if(s[f]!=null){console.warn(`Multiple bone entries for ${f} detected (index = ${u}), ignoring duplicated entries.`);return}s[f]={node:c}}))));const o=new vg(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(r.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new gg(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(r){const t=Object.values(PO).filter(e=>r[e]==null);if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return r}},bg=class extends Ui{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new nr(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(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 t=r/63*this._currentTheta;this._attrPos.setXYZ(r+1,this._currentRadius*Math.sin(t),0,this._currentRadius*Math.cos(t))}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}},DO=class extends Ui{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new mt,this._currentTail=new mt,this._attrPos=new nr(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(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 t=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+r,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+r,Math.sin(t),0,Math.cos(t))}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 t=(r+1)%32;this._attrIndex.setXY(r*2,r,t),this._attrIndex.setXY(64+r*2,32+r,32+t),this._attrIndex.setXY(128+r*2,64+r,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},Ol=new ne,wg=new ne,Jo=new mt,xg=new mt,Sg=Math.sqrt(2)/2,LO=new ne(0,0,-Sg,Sg),NO=new mt(0,1,0),BO=class extends No{constructor(r){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=r;{const t=new bg;t.radius=.5;const e=new Xp({color:65280,transparent:!0,opacity:.5,side:Yp,depthTest:!1,depthWrite:!1});this._meshPitch=new qp(t,e),this.add(this._meshPitch)}{const t=new bg;t.radius=.5;const e=new Xp({color:16711680,transparent:!0,opacity:.5,side:Yp,depthTest:!1,depthWrite:!1});this._meshYaw=new qp(t,e),this.add(this._meshYaw)}{const t=new DO;t.radius=.1;const e=new ec({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new Af(t,e),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 t=Fe.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=t,this._meshYaw.geometry.update();const e=Fe.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=e,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Jo),this.vrmLookAt.getLookAtWorldQuaternion(Ol),Ol.multiply(this.vrmLookAt.getFaceFrontQuaternion(wg)),this._meshYaw.position.copy(Jo),this._meshYaw.quaternion.copy(Ol),this._meshPitch.position.copy(Jo),this._meshPitch.quaternion.copy(Ol),this._meshPitch.quaternion.multiply(wg.setFromAxisAngle(NO,t)),this._meshPitch.quaternion.multiply(LO);const{target:n,autoUpdate:i}=this.vrmLookAt;n!=null&&i&&(n.getWorldPosition(xg).sub(Jo),this._lineTarget.geometry.tail.copy(xg),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Jo)),super.updateMatrixWorld(r)}},UO=new mt,kO=new mt;function Vd(r,t){return r.matrixWorld.decompose(UO,t,kO),t}function Ul(r){return[Math.atan2(-r.z,r.x),Math.atan2(r.y,Math.sqrt(r.x*r.x+r.z*r.z))]}function Tg(r){const t=Math.round(r/2/Math.PI);return r-2*Math.PI*t}var Ig=new mt(0,0,1),zO=new mt,VO=new mt,jO=new mt,$O=new ne,dh=new ne,Eg=new ne,GO=new ne,fh=new Ps,wb=class xb{constructor(t,e){this.offsetFromHeadBone=new mt,this.autoUpdate=!0,this.faceFront=new mt(0,0,1),this.humanoid=t,this.applier=e,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new ne)}get yaw(){return this._yaw}set yaw(t){this._yaw=t,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(t){this._pitch=t,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new Ps)}getEuler(t){return t.set(Fe.DEG2RAD*this._pitch,Fe.DEG2RAD*this._yaw,0,"YXZ")}copy(t){if(this.humanoid!==t.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(t.offsetFromHeadBone),this.applier=t.applier,this.autoUpdate=t.autoUpdate,this.target=t.target,this.faceFront.copy(t.faceFront),this}clone(){return new xb(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(t){const e=this.humanoid.getRawBoneNode("head");return t.copy(this.offsetFromHeadBone).applyMatrix4(e.matrixWorld)}getLookAtWorldQuaternion(t){const e=this.humanoid.getRawBoneNode("head");return Vd(e,t)}getFaceFrontQuaternion(t){if(this.faceFront.distanceToSquared(Ig)<.01)return t.copy(this._restHeadWorldQuaternion).invert();const[e,n]=Ul(this.faceFront);return fh.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(fh).premultiply(GO.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(t){return this.getLookAtWorldQuaternion(dh),this.getFaceFrontQuaternion(Eg),t.copy(Ig).applyQuaternion(dh).applyQuaternion(Eg).applyEuler(this.getEuler(fh))}lookAt(t){const e=$O.copy(this._restHeadWorldQuaternion).multiply(vb(this.getLookAtWorldQuaternion(dh))),n=this.getLookAtWorldPosition(VO),i=jO.copy(t).sub(n).applyQuaternion(e).normalize(),[s,o]=Ul(this.faceFront),[a,l]=Ul(i),u=Tg(a-s),c=Tg(o-l);this._yaw=Fe.RAD2DEG*u,this._pitch=Fe.RAD2DEG*c,this._needsUpdate=!0}update(t){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(zO)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};wb.EULER_ORDER="YXZ";var WO=wb,HO=new mt(0,0,1),_n=new ne,js=new ne,$r=new Ps(0,0,0,"YXZ"),kl=class{constructor(r,t,e,n,i){this.humanoid=r,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=e,this.rangeMapVerticalDown=n,this.rangeMapVerticalUp=i,this.faceFront=new mt(0,0,1),this._restQuatLeftEye=new ne,this._restQuatRightEye=new ne,this._restLeftEyeParentWorldQuat=new ne,this._restRightEyeParentWorldQuat=new ne;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),Vd(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),Vd(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(r,t){const e=this.humanoid.getRawBoneNode("leftEye"),n=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");e&&(t<0?$r.x=-Fe.DEG2RAD*this.rangeMapVerticalDown.map(-t):$r.x=Fe.DEG2RAD*this.rangeMapVerticalUp.map(t),r<0?$r.y=-Fe.DEG2RAD*this.rangeMapHorizontalInner.map(-r):$r.y=Fe.DEG2RAD*this.rangeMapHorizontalOuter.map(r),_n.setFromEuler($r),this._getWorldFaceFrontQuat(js),i.quaternion.copy(js).multiply(_n).multiply(js.invert()),_n.copy(this._restLeftEyeParentWorldQuat),e.quaternion.copy(i.quaternion).multiply(_n).premultiply(_n.invert()).multiply(this._restQuatLeftEye)),n&&(t<0?$r.x=-Fe.DEG2RAD*this.rangeMapVerticalDown.map(-t):$r.x=Fe.DEG2RAD*this.rangeMapVerticalUp.map(t),r<0?$r.y=-Fe.DEG2RAD*this.rangeMapHorizontalOuter.map(-r):$r.y=Fe.DEG2RAD*this.rangeMapHorizontalInner.map(r),_n.setFromEuler($r),this._getWorldFaceFrontQuat(js),s.quaternion.copy(js).multiply(_n).multiply(js.invert()),_n.copy(this._restRightEyeParentWorldQuat),n.quaternion.copy(s.quaternion).multiply(_n).premultiply(_n.invert()).multiply(this._restQuatRightEye))}lookAt(r){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const t=Fe.RAD2DEG*r.y,e=Fe.RAD2DEG*r.x;this.applyYawPitch(t,e)}_getWorldFaceFrontQuat(r){if(this.faceFront.distanceToSquared(HO)<.01)return r.identity();const[t,e]=Ul(this.faceFront);return $r.set(0,.5*Math.PI+t,e,"YZX"),r.setFromEuler($r)}};kl.type="bone";var jd=class{constructor(r,t,e,n,i){this.expressions=r,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=e,this.rangeMapVerticalDown=n,this.rangeMapVerticalUp=i}applyYawPitch(r,t){t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),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 t=Fe.RAD2DEG*r.y,e=Fe.RAD2DEG*r.x;this.applyYawPitch(t,e)}};jd.type="expression";var Ag=class{constructor(r,t){this.inputMaxValue=r,this.outputScale=t}map(r){return this.outputScale*cb(r/this.inputMaxValue)}},XO=new Set(["1.0","1.0-beta"]),Pl=.01,YO=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(r,t){this.parser=r,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(r){return pe(this,null,function*(){const t=r.userData.vrmHumanoid;if(t===null)return;if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const e=r.userData.vrmExpressionManager;if(e!==null){if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");r.userData.vrmLookAt=yield this._import(r,t,e)}})}_import(r,t,e){return pe(this,null,function*(){if(t==null||e==null)return null;const n=yield this._v1Import(r,t,e);if(n)return n;const i=yield this._v0Import(r,t,e);return i||null})}_v1Import(r,t,e){return pe(this,null,function*(){var n,i,s;const o=this.parser.json;if(!(((n=o.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const u=l.specVersion;if(!XO.has(u))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${u}"`),null;const c=l.lookAt;if(!c)return null;const h=c.type==="expression"?1:10,f=this._v1ImportRangeMap(c.rangeMapHorizontalInner,h),d=this._v1ImportRangeMap(c.rangeMapHorizontalOuter,h),m=this._v1ImportRangeMap(c.rangeMapVerticalDown,h),g=this._v1ImportRangeMap(c.rangeMapVerticalUp,h);let p;c.type==="expression"?p=new jd(e,f,d,m,g):p=new kl(t,f,d,m,g);const y=this._importLookAt(t,p);return y.offsetFromHeadBone.fromArray((s=c.offsetFromHeadBone)!=null?s:[0,.06,0]),y})}_v1ImportRangeMap(r,t){var e,n;let i=(e=r==null?void 0:r.inputMaxValue)!=null?e:90;const s=(n=r==null?void 0:r.outputScale)!=null?n:t;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},KO=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()}},JO=class extends KO{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(t=>{t.update&&t.update(r)})}},tP=Object.defineProperty,Mg=Object.getOwnPropertySymbols,eP=Object.prototype.hasOwnProperty,rP=Object.prototype.propertyIsEnumerable,Cg=(r,t,e)=>t in r?tP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Og=(r,t)=>{for(var e in t||(t={}))eP.call(t,e)&&Cg(r,e,t[e]);if(Mg)for(var e of Mg(t))rP.call(t,e)&&Cg(r,e,t[e]);return r},gs=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),nP={"":3e3,srgb:3001};function iP(r,t){parseInt(Jl,10)>=152?r.colorSpace=t:r.encoding=nP[t]}var sP=class{get pending(){return Promise.all(this._pendings)}constructor(r,t){this._parser=r,this._materialParams=t,this._pendings=[]}assignPrimitive(r,t){t!=null&&(this._materialParams[r]=t)}assignColor(r,t,e){t!=null&&(this._materialParams[r]=new qr().fromArray(t),e&&this._materialParams[r].convertSRGBToLinear())}assignTexture(r,t,e){return gs(this,null,function*(){const n=gs(this,null,function*(){t!=null&&(yield this._parser.assignTexture(this._materialParams,r,t),e&&iP(this._materialParams[r],"srgb"))});return this._pendings.push(n),n})}assignTextureByIndex(r,t,e){return gs(this,null,function*(){return this.assignTexture(r,t!=null?{index:t}:void 0,e)})}},oP=`// #define PHONG + */var Cl=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),pe=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),og=class extends Ca{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 t=this._binds.indexOf(r);t>=0&&this._binds.splice(t,1)}applyWeight(r){var t;let e=this.outputWeight;e*=(t=r==null?void 0:r.multiplier)!=null?t:1,this.isBinary&&e<1&&(e=0),this._binds.forEach(n=>n.applyWeight(e))}clearAppliedWeight(){this._binds.forEach(r=>r.clearAppliedWeight())}};function ub(r,t,e){var n,i;const s=r.parser.json,o=(n=s.nodes)==null?void 0:n[t];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${t}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const u=l.primitives.length,c=[];return e.traverse(h=>{c.length{const s=ub(r,i,n);s!=null&&e.set(i,s)}),e})}var kd={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 cb(r){return Math.max(Math.min(r,1),0)}var ug=class hb{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 t={},e=new Set(Object.values(kd));return Object.entries(this._expressionMap).forEach(([n,i])=>{e.has(n)&&(t[n]=i)}),t}get customExpressionMap(){const t={},e=new Set(Object.values(kd));return Object.entries(this._expressionMap).forEach(([n,i])=>{e.has(n)||(t[n]=i)}),t}copy(t){return this._expressions.concat().forEach(n=>{this.unregisterExpression(n)}),t._expressions.forEach(n=>{this.registerExpression(n)}),this.blinkExpressionNames=t.blinkExpressionNames.concat(),this.lookAtExpressionNames=t.lookAtExpressionNames.concat(),this.mouthExpressionNames=t.mouthExpressionNames.concat(),this}clone(){return new hb().copy(this)}getExpression(t){var e;return(e=this._expressionMap[t])!=null?e:null}registerExpression(t){this._expressions.push(t),this._expressionMap[t.expressionName]=t}unregisterExpression(t){const e=this._expressions.indexOf(t);e===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(e,1),delete this._expressionMap[t.expressionName]}getValue(t){var e;const n=this.getExpression(t);return(e=n==null?void 0:n.weight)!=null?e:null}setValue(t,e){const n=this.getExpression(t);n&&(n.weight=cb(e))}resetValues(){this._expressions.forEach(t=>{t.weight=0})}getExpressionTrackName(t){const e=this.getExpression(t);return e?`${e.name}.weight`:null}update(){const t=this._calculateWeightMultipliers();this._expressions.forEach(e=>{e.clearAppliedWeight()}),this._expressions.forEach(e=>{let n=1;const i=e.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(n*=t.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(n*=t.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(n*=t.mouth),e.applyWeight({multiplier:n})})}_calculateWeightMultipliers(){let t=1,e=1,n=1;return this._expressions.forEach(i=>{t-=i.overrideBlinkAmount,e-=i.overrideLookAtAmount,n-=i.overrideMouthAmount}),t=Math.max(0,t),e=Math.max(0,e),n=Math.max(0,n),{blink:t,lookAt:e,mouth:n}}},Ko={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},wO={_Color:Ko.Color,_EmissionColor:Ko.EmissionColor,_ShadeColor:Ko.ShadeColor,_RimColor:Ko.RimColor,_OutlineColor:Ko.OutlineColor},xO=new qr,db=class fb{constructor({material:t,type:e,targetValue:n,targetAlpha:i}){this.material=t,this.type=e,this.targetValue=n,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(t){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:i,deltaValue:s}=e,o=this.material[i];o!=null&&o.add(xO.copy(s).multiplyScalar(t))}if(n!=null){const{propertyName:i,deltaValue:s}=n;this.material[i]!=null&&(this.material[i]+=s*t)}}clearAppliedWeight(){const{color:t,alpha:e}=this._state;if(t!=null){const{propertyName:n,initialValue:i}=t,s=this.material[n];s!=null&&s.copy(i)}if(e!=null){const{propertyName:n,initialValue:i}=e;this.material[n]!=null&&(this.material[n]=i)}}_initColorBindState(){var t,e,n;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(e=(t=a==null?void 0:a[s])==null?void 0:t[0])!=null?e:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(n=i.name)!=null?n:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const c=i[l].clone(),h=new qr(o.r-c.r,o.g-c.g,o.b-c.b);return{propertyName:l,initialValue:c,deltaValue:h}}_initAlphaBindState(){var t,e,n;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(e=(t=a==null?void 0:a[s])==null?void 0:t[1])!=null?e:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(n=i.name)!=null?n:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const u=i[l],c=o-u;return{propertyName:l,initialValue:u,deltaValue:c}}_getPropertyNameMap(){var t,e;return(e=(t=Object.entries(fb._propertyNameMapMap).find(([n])=>this.material[n]===!0))==null?void 0:t[1])!=null?e:null}};db._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 cg=db,cu=class{constructor({primitives:r,index:t,weight:e}){this.primitives=r,this.index=t,this.weight=e}applyWeight(r){this.primitives.forEach(t=>{var e;((e=t.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(t.morphTargetInfluences[this.index]+=this.weight*r)})}clearAppliedWeight(){this.primitives.forEach(r=>{var t;((t=r.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(r.morphTargetInfluences[this.index]=0)})}},hg=new co,pb=class mb{constructor({material:t,scale:e,offset:n}){var i,s;this.material=t,this.scale=e,this.offset=n;const o=(i=Object.entries(mb._propertyNamesMap).find(([a])=>t[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=t.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const u=(l=t[a])==null?void 0:l.clone();if(!u)return null;t[a]=u;const c=u.offset.clone(),h=u.repeat.clone(),f=n.clone().sub(c),d=e.clone().sub(h);this._properties.push({name:a,initialOffset:c,deltaOffset:f,initialScale:h,deltaScale:d})}))}applyWeight(t){this._properties.forEach(e=>{const n=this.material[e.name];n!==void 0&&(n.offset.add(hg.copy(e.deltaOffset).multiplyScalar(t)),n.repeat.add(hg.copy(e.deltaScale).multiplyScalar(t)))})}clearAppliedWeight(){this._properties.forEach(t=>{const e=this.material[t.name];e!==void 0&&(e.offset.copy(t.initialOffset),e.repeat.copy(t.initialScale))})}};pb._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var dg=pb,SO=new Set(["1.0","1.0-beta"]),gb=class yb{get name(){return"VRMExpressionLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return pe(this,null,function*(){t.userData.vrmExpressionManager=yield this._import(t)})}_import(t){return pe(this,null,function*(){const e=yield this._v1Import(t);if(e)return e;const n=yield this._v0Import(t);return n||null})}_v1Import(t){return pe(this,null,function*(){var e,n;const i=this.parser.json;if(!(((e=i.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const o=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!SO.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const u=new Set(Object.values(kd)),c=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([f,d])=>{if(d!=null){if(!u.has(f)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${f}" detected. Ignoring the expression`);return}c.set(f,d)}}),l.custom!=null&&Object.entries(l.custom).forEach(([f,d])=>{if(u.has(f)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${f}". Ignoring the expression`);return}c.set(f,d)});const h=new ug;return yield Promise.all(Array.from(c.entries()).map(f=>pe(this,[f],function*([d,m]){var g,p,y,_,S,T,v;const E=new og(d);if(t.scene.add(E),E.isBinary=(g=m.isBinary)!=null?g:!1,E.overrideBlink=(p=m.overrideBlink)!=null?p:"none",E.overrideLookAt=(y=m.overrideLookAt)!=null?y:"none",E.overrideMouth=(_=m.overrideMouth)!=null?_:"none",(S=m.morphTargetBinds)==null||S.forEach(w=>pe(this,null,function*(){var B;if(w.node===void 0||w.index===void 0)return;const L=yield ag(t,w.node),$=w.index;if(!L.every(it=>Array.isArray(it.morphTargetInfluences)&&${const L=B.material;L&&(Array.isArray(L)?w.push(...L):w.push(L))}),(T=m.materialColorBinds)==null||T.forEach(B=>pe(this,null,function*(){w.filter($=>{var it;const I=(it=this.parser.associations.get($))==null?void 0:it.materials;return B.material===I}).forEach($=>{E.addBind(new cg({material:$,type:B.type,targetValue:new qr().fromArray(B.targetValue),targetAlpha:B.targetValue[3]}))})})),(v=m.textureTransformBinds)==null||v.forEach(B=>pe(this,null,function*(){w.filter($=>{var it;const I=(it=this.parser.associations.get($))==null?void 0:it.materials;return B.material===I}).forEach($=>{var it,I;E.addBind(new dg({material:$,offset:new co().fromArray((it=B.offset)!=null?it:[0,0]),scale:new co().fromArray((I=B.scale)!=null?I:[1,1])}))})}))}h.registerExpression(E)}))),h})}_v0Import(t){return pe(this,null,function*(){var e;const n=this.parser.json,i=(e=n.extensions)==null?void 0:e.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new ug,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(u=>pe(this,null,function*(){var c;const h=u.presetName,f=h!=null&&yb.v0v1PresetNameMap[h]||null,d=f??u.name;if(d==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(d)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${h} has duplicated entries. Ignoring the expression`);return}l.add(d);const m=new og(d);t.scene.add(m),m.isBinary=(c=u.isBinary)!=null?c:!1,u.binds&&u.binds.forEach(p=>pe(this,null,function*(){var y;if(p.mesh===void 0||p.index===void 0)return;const _=[];(y=n.nodes)==null||y.forEach((T,v)=>{T.mesh===p.mesh&&_.push(v)});const S=p.index;yield Promise.all(_.map(T=>pe(this,null,function*(){var v;const E=yield ag(t,T);if(!E.every(w=>Array.isArray(w.morphTargetInfluences)&&S{if(p.materialName===void 0||p.propertyName===void 0||p.targetValue===void 0)return;const y=[];t.scene.traverse(S=>{if(S.material){const T=S.material;Array.isArray(T)?y.push(...T.filter(v=>(v.name===p.materialName||v.name===p.materialName+" (Outline)")&&y.indexOf(v)===-1)):T.name===p.materialName&&y.indexOf(T)===-1&&y.push(T)}});const _=p.propertyName;y.forEach(S=>{if(_==="_MainTex_ST"){const v=new co(p.targetValue[0],p.targetValue[1]),E=new co(p.targetValue[2],p.targetValue[3]);E.y=1-E.y-v.y,m.addBind(new dg({material:S,scale:v,offset:E}));return}const T=wO[_];if(T){m.addBind(new cg({material:S,type:T,targetValue:new qr().fromArray(p.targetValue),targetAlpha:p.targetValue[3]}));return}console.warn(_+" is not supported")})}),o.registerExpression(m)}))),o})}};gb.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 TO=gb,Yf=class qs{constructor(t,e){this._firstPersonOnlyLayer=qs.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=qs.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=t,this.meshAnnotations=e}copy(t){if(this.humanoid!==t.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=t.meshAnnotations.map(e=>({meshes:e.meshes.concat(),type:e.type})),this}clone(){return new qs(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:t=qs.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:e=qs.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=t,this._thirdPersonOnlyLayer=e,this.meshAnnotations.forEach(n=>{n.meshes.forEach(i=>{n.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):n.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):n.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(t,e,n,i){let s=0;if(e!=null&&e.length>0)for(let o=0;o0&&i.includes(h[0])||c[1]>0&&i.includes(h[1])||c[2]>0&&i.includes(h[2])||c[3]>0&&i.includes(h[3]))continue;const f=e[l],d=n[l];if(f[0]>0&&i.includes(d[0])||f[1]>0&&i.includes(d[1])||f[2]>0&&i.includes(d[2])||f[3]>0&&i.includes(d[3]))continue;const m=e[u],g=n[u];m[0]>0&&i.includes(g[0])||m[1]>0&&i.includes(g[1])||m[2]>0&&i.includes(g[2])||m[3]>0&&i.includes(g[3])||(t[s++]=a,t[s++]=l,t[s++]=u)}return s}_createErasedMesh(t,e){const n=new S1(t.geometry.clone(),t.material);n.name=`${t.name}(erase)`,n.frustumCulled=t.frustumCulled,n.layers.set(this._firstPersonOnlyLayer);const i=n.geometry,s=i.getAttribute("skinIndex"),o=s instanceof Qp?[]:s.array,a=[];for(let g=0;g{this._isEraseTarget(s)&&n.push(o)}),!n.length){e.layers.enable(this._thirdPersonOnlyLayer),e.layers.enable(this._firstPersonOnlyLayer);return}e.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(e,n);t.add(i)}_createHeadlessModel(t){if(t.type==="Group")if(t.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(t))t.traverse(e=>e.layers.set(this._thirdPersonOnlyLayer));else{const e=new No;e.name=`_headless_${t.name}`,e.layers.set(this._firstPersonOnlyLayer),t.parent.add(e),t.children.filter(n=>n.type==="SkinnedMesh").forEach(n=>{const i=n;this._createHeadlessModelForSkinnedMesh(e,i)})}else if(t.type==="SkinnedMesh"){const e=t;this._createHeadlessModelForSkinnedMesh(t.parent,e)}else this._isEraseTarget(t)&&(t.layers.set(this._thirdPersonOnlyLayer),t.traverse(e=>e.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(t){return t===this.humanoid.getRawBoneNode("head")?!0:t.parent?this._isEraseTarget(t.parent):!1}};Yf.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;Yf.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var fg=Yf,IO=new Set(["1.0","1.0-beta"]),EO=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(r){this.parser=r}afterRoot(r){return pe(this,null,function*(){const t=r.userData.vrmHumanoid;if(t!==null){if(t===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");r.userData.vrmFirstPerson=yield this._import(r,t)}})}_import(r,t){return pe(this,null,function*(){if(t==null)return null;const e=yield this._v1Import(r,t);if(e)return e;const n=yield this._v0Import(r,t);return n||null})}_v1Import(r,t){return pe(this,null,function*(){var e,n;const i=this.parser.json;if(!(((e=i.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const o=(n=i.extensions)==null?void 0:n.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!IO.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,u=[],c=yield lg(r);return Array.from(c.entries()).forEach(([h,f])=>{var d,m;const g=(d=l==null?void 0:l.meshAnnotations)==null?void 0:d.find(p=>p.node===h);u.push({meshes:f,type:(m=g==null?void 0:g.type)!=null?m:"auto"})}),new fg(t,u)})}_v0Import(r,t){return pe(this,null,function*(){var e;const n=this.parser.json,i=(e=n.extensions)==null?void 0:e.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield lg(r);return Array.from(a.entries()).forEach(([l,u])=>{const c=n.nodes[l],h=s.meshAnnotations?s.meshAnnotations.find(f=>f.mesh===c.mesh):void 0;o.push({meshes:u,type:this._convertV0FlagToV1Type(h==null?void 0:h.firstPersonFlag)})}),new fg(t,o)})}_convertV0FlagToV1Type(r){return r==="FirstPersonOnly"?"firstPersonOnly":r==="ThirdPersonOnly"?"thirdPersonOnly":r==="Both"?"both":"auto"}},pg=new mt,mg=new mt,AO=new ne,gg=class extends No{constructor(r){super(),this.vrmHumanoid=r,this._boneAxesMap=new Map,Object.values(r.humanBones).forEach(t=>{const e=new T1(1);e.matrixAutoUpdate=!1,e.material.depthTest=!1,e.material.depthWrite=!1,this.add(e),this._boneAxesMap.set(t,e)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(r=>{r.geometry.dispose(),r.material.dispose()})}updateMatrixWorld(r){Array.from(this._boneAxesMap.entries()).forEach(([t,e])=>{t.node.updateWorldMatrix(!0,!1),t.node.matrixWorld.decompose(pg,AO,mg);const n=pg.set(.1,.1,.1).divide(mg);e.matrix.copy(t.node.matrixWorld).scale(n)}),super.updateMatrixWorld(r)}},ch=["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"],MO={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 vb(r){return r.invert?r.invert():r.inverse(),r}var Zi=new mt,Ki=new ne,zd=class{constructor(r){this.humanBones=r,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const r={};return Object.keys(this.humanBones).forEach(t=>{const e=t,n=this.getBoneNode(e);n&&(Zi.copy(n.position),Ki.copy(n.quaternion),r[e]={position:Zi.toArray(),rotation:Ki.toArray()})}),r}getPose(){const r={};return Object.keys(this.humanBones).forEach(t=>{const e=t,n=this.getBoneNode(e);if(!n)return;Zi.set(0,0,0),Ki.identity();const i=this.restPose[e];i!=null&&i.position&&Zi.fromArray(i.position).negate(),i!=null&&i.rotation&&vb(Ki.fromArray(i.rotation)),Zi.add(n.position),Ki.premultiply(n.quaternion),r[e]={position:Zi.toArray(),rotation:Ki.toArray()}}),r}setPose(r){Object.entries(r).forEach(([t,e])=>{const n=t,i=this.getBoneNode(n);if(!i)return;const s=this.restPose[n];s&&(e!=null&&e.position&&(i.position.fromArray(e.position),s.position&&i.position.add(Zi.fromArray(s.position))),e!=null&&e.rotation&&(i.quaternion.fromArray(e.rotation),s.rotation&&i.quaternion.multiply(Ki.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([r,t])=>{const e=this.getBoneNode(r);e&&(t!=null&&t.position&&e.position.fromArray(t.position),t!=null&&t.rotation&&e.quaternion.fromArray(t.rotation))})}getBone(r){var t;return(t=this.humanBones[r])!=null?t:void 0}getBoneNode(r){var t,e;return(e=(t=this.humanBones[r])==null?void 0:t.node)!=null?e:null}},hh=new mt,CO=new ne,OO=new mt,yg=class _b extends zd{static _setupTransforms(t){const e=new Ca;e.name="VRMHumanoidRig";const n={},i={},s={};ch.forEach(a=>{var l;const u=t.getBoneNode(a);if(u){const c=new mt,h=new ne;u.updateWorldMatrix(!0,!1),u.matrixWorld.decompose(c,h,hh),n[a]=c,i[a]=u.quaternion.clone();const f=new ne;(l=u.parent)==null||l.matrixWorld.decompose(hh,f,hh),s[a]=f}});const o={};return ch.forEach(a=>{var l;const u=t.getBoneNode(a);if(u){const c=n[a];let h=a,f;for(;f==null&&(h=MO[h],h!=null);)f=n[h];const d=new Ca;d.name="Normalized_"+u.name,(h?(l=o[h])==null?void 0:l.node:e).add(d),d.position.copy(c),f&&d.position.sub(f),o[a]={node:d}}}),{rigBones:o,root:e,parentWorldRotations:s,boneRotations:i}}constructor(t){const{rigBones:e,root:n,parentWorldRotations:i,boneRotations:s}=_b._setupTransforms(t);super(e),this.original=t,this.root=n,this._parentWorldRotations=i,this._boneRotations=s}update(){ch.forEach(t=>{const e=this.original.getBoneNode(t);if(e!=null){const n=this.getBoneNode(t),i=this._parentWorldRotations[t],s=CO.copy(i).invert(),o=this._boneRotations[t];if(e.quaternion.copy(n.quaternion).multiply(i).premultiply(s).multiply(o),t==="hips"){const a=n.getWorldPosition(OO);e.parent.updateWorldMatrix(!0,!1);const l=e.parent.matrixWorld,u=a.applyMatrix4(l.invert());e.position.copy(u)}}})}},vg=class bb{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(t,e){var n;this.autoUpdateHumanBones=(n=e==null?void 0:e.autoUpdateHumanBones)!=null?n:!0,this._rawHumanBones=new zd(t),this._normalizedHumanBones=new yg(this._rawHumanBones)}copy(t){return this.autoUpdateHumanBones=t.autoUpdateHumanBones,this._rawHumanBones=new zd(t.humanBones),this._normalizedHumanBones=new yg(this._rawHumanBones),this}clone(){return new bb(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(t){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(t)}setRawPose(t){return this._rawHumanBones.setPose(t)}setNormalizedPose(t){return this._normalizedHumanBones.setPose(t)}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(t){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(t)}getRawBone(t){return this._rawHumanBones.getBone(t)}getNormalizedBone(t){return this._normalizedHumanBones.getBone(t)}getBoneNode(t){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(t)}getRawBoneNode(t){return this._rawHumanBones.getBoneNode(t)}getNormalizedBoneNode(t){return this._normalizedHumanBones.getBoneNode(t)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},PO={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"},RO=new Set(["1.0","1.0-beta"]),_g={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},FO=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(r,t){this.parser=r,this.helperRoot=t==null?void 0:t.helperRoot,this.autoUpdateHumanBones=t==null?void 0:t.autoUpdateHumanBones}afterRoot(r){return pe(this,null,function*(){r.userData.vrmHumanoid=yield this._import(r)})}_import(r){return pe(this,null,function*(){const t=yield this._v1Import(r);if(t)return t;const e=yield this._v0Import(r);return e||null})}_v1Import(r){return pe(this,null,function*(){var t,e;const n=this.parser.json;if(!(((t=n.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const s=(e=n.extensions)==null?void 0:e.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!RO.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,u={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(h=>pe(this,[h],function*([f,d]){let m=f;const g=d.node;if(l){const y=_g[m];y!=null&&(m=y)}const p=yield this.parser.getDependency("node",g);if(p==null){console.warn(`A glTF node bound to the humanoid bone ${m} (index = ${g}) does not exist`);return}u[m]={node:p}}))));const c=new vg(this._ensureRequiredBonesExist(u),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(r.scene.add(c.normalizedHumanBonesRoot),this.helperRoot){const h=new gg(c);this.helperRoot.add(h),h.renderOrder=this.helperRoot.renderOrder}return c})}_v0Import(r){return pe(this,null,function*(){var t;const n=(t=this.parser.json.extensions)==null?void 0:t.VRM;if(!n)return null;const i=n.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>pe(this,null,function*(){const l=a.bone,u=a.node;if(l==null||u==null)return;const c=yield this.parser.getDependency("node",u);if(c==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${u}) does not exist`);return}const h=_g[l],f=h??l;if(s[f]!=null){console.warn(`Multiple bone entries for ${f} detected (index = ${u}), ignoring duplicated entries.`);return}s[f]={node:c}}))));const o=new vg(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(r.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new gg(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(r){const t=Object.values(PO).filter(e=>r[e]==null);if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return r}},bg=class extends hi{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new nr(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(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 t=r/63*this._currentTheta;this._attrPos.setXYZ(r+1,this._currentRadius*Math.sin(t),0,this._currentRadius*Math.cos(t))}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}},DO=class extends hi{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new mt,this._currentTail=new mt,this._attrPos=new nr(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(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 t=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+r,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+r,Math.sin(t),0,Math.cos(t))}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 t=(r+1)%32;this._attrIndex.setXY(r*2,r,t),this._attrIndex.setXY(64+r*2,32+r,32+t),this._attrIndex.setXY(128+r*2,64+r,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},Ol=new ne,wg=new ne,Jo=new mt,xg=new mt,Sg=Math.sqrt(2)/2,LO=new ne(0,0,-Sg,Sg),NO=new mt(0,1,0),BO=class extends No{constructor(r){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=r;{const t=new bg;t.radius=.5;const e=new Xp({color:65280,transparent:!0,opacity:.5,side:Yp,depthTest:!1,depthWrite:!1});this._meshPitch=new qp(t,e),this.add(this._meshPitch)}{const t=new bg;t.radius=.5;const e=new Xp({color:16711680,transparent:!0,opacity:.5,side:Yp,depthTest:!1,depthWrite:!1});this._meshYaw=new qp(t,e),this.add(this._meshYaw)}{const t=new DO;t.radius=.1;const e=new ec({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new Af(t,e),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 t=Fe.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=t,this._meshYaw.geometry.update();const e=Fe.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=e,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Jo),this.vrmLookAt.getLookAtWorldQuaternion(Ol),Ol.multiply(this.vrmLookAt.getFaceFrontQuaternion(wg)),this._meshYaw.position.copy(Jo),this._meshYaw.quaternion.copy(Ol),this._meshPitch.position.copy(Jo),this._meshPitch.quaternion.copy(Ol),this._meshPitch.quaternion.multiply(wg.setFromAxisAngle(NO,t)),this._meshPitch.quaternion.multiply(LO);const{target:n,autoUpdate:i}=this.vrmLookAt;n!=null&&i&&(n.getWorldPosition(xg).sub(Jo),this._lineTarget.geometry.tail.copy(xg),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Jo)),super.updateMatrixWorld(r)}},UO=new mt,kO=new mt;function Vd(r,t){return r.matrixWorld.decompose(UO,t,kO),t}function Ul(r){return[Math.atan2(-r.z,r.x),Math.atan2(r.y,Math.sqrt(r.x*r.x+r.z*r.z))]}function Tg(r){const t=Math.round(r/2/Math.PI);return r-2*Math.PI*t}var Ig=new mt(0,0,1),zO=new mt,VO=new mt,jO=new mt,$O=new ne,dh=new ne,Eg=new ne,GO=new ne,fh=new Ps,wb=class xb{constructor(t,e){this.offsetFromHeadBone=new mt,this.autoUpdate=!0,this.faceFront=new mt(0,0,1),this.humanoid=t,this.applier=e,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new ne)}get yaw(){return this._yaw}set yaw(t){this._yaw=t,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(t){this._pitch=t,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new Ps)}getEuler(t){return t.set(Fe.DEG2RAD*this._pitch,Fe.DEG2RAD*this._yaw,0,"YXZ")}copy(t){if(this.humanoid!==t.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(t.offsetFromHeadBone),this.applier=t.applier,this.autoUpdate=t.autoUpdate,this.target=t.target,this.faceFront.copy(t.faceFront),this}clone(){return new xb(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(t){const e=this.humanoid.getRawBoneNode("head");return t.copy(this.offsetFromHeadBone).applyMatrix4(e.matrixWorld)}getLookAtWorldQuaternion(t){const e=this.humanoid.getRawBoneNode("head");return Vd(e,t)}getFaceFrontQuaternion(t){if(this.faceFront.distanceToSquared(Ig)<.01)return t.copy(this._restHeadWorldQuaternion).invert();const[e,n]=Ul(this.faceFront);return fh.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(fh).premultiply(GO.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(t){return this.getLookAtWorldQuaternion(dh),this.getFaceFrontQuaternion(Eg),t.copy(Ig).applyQuaternion(dh).applyQuaternion(Eg).applyEuler(this.getEuler(fh))}lookAt(t){const e=$O.copy(this._restHeadWorldQuaternion).multiply(vb(this.getLookAtWorldQuaternion(dh))),n=this.getLookAtWorldPosition(VO),i=jO.copy(t).sub(n).applyQuaternion(e).normalize(),[s,o]=Ul(this.faceFront),[a,l]=Ul(i),u=Tg(a-s),c=Tg(o-l);this._yaw=Fe.RAD2DEG*u,this._pitch=Fe.RAD2DEG*c,this._needsUpdate=!0}update(t){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(zO)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};wb.EULER_ORDER="YXZ";var WO=wb,HO=new mt(0,0,1),_n=new ne,js=new ne,$r=new Ps(0,0,0,"YXZ"),kl=class{constructor(r,t,e,n,i){this.humanoid=r,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=e,this.rangeMapVerticalDown=n,this.rangeMapVerticalUp=i,this.faceFront=new mt(0,0,1),this._restQuatLeftEye=new ne,this._restQuatRightEye=new ne,this._restLeftEyeParentWorldQuat=new ne,this._restRightEyeParentWorldQuat=new ne;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),Vd(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),Vd(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(r,t){const e=this.humanoid.getRawBoneNode("leftEye"),n=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");e&&(t<0?$r.x=-Fe.DEG2RAD*this.rangeMapVerticalDown.map(-t):$r.x=Fe.DEG2RAD*this.rangeMapVerticalUp.map(t),r<0?$r.y=-Fe.DEG2RAD*this.rangeMapHorizontalInner.map(-r):$r.y=Fe.DEG2RAD*this.rangeMapHorizontalOuter.map(r),_n.setFromEuler($r),this._getWorldFaceFrontQuat(js),i.quaternion.copy(js).multiply(_n).multiply(js.invert()),_n.copy(this._restLeftEyeParentWorldQuat),e.quaternion.copy(i.quaternion).multiply(_n).premultiply(_n.invert()).multiply(this._restQuatLeftEye)),n&&(t<0?$r.x=-Fe.DEG2RAD*this.rangeMapVerticalDown.map(-t):$r.x=Fe.DEG2RAD*this.rangeMapVerticalUp.map(t),r<0?$r.y=-Fe.DEG2RAD*this.rangeMapHorizontalOuter.map(-r):$r.y=Fe.DEG2RAD*this.rangeMapHorizontalInner.map(r),_n.setFromEuler($r),this._getWorldFaceFrontQuat(js),s.quaternion.copy(js).multiply(_n).multiply(js.invert()),_n.copy(this._restRightEyeParentWorldQuat),n.quaternion.copy(s.quaternion).multiply(_n).premultiply(_n.invert()).multiply(this._restQuatRightEye))}lookAt(r){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const t=Fe.RAD2DEG*r.y,e=Fe.RAD2DEG*r.x;this.applyYawPitch(t,e)}_getWorldFaceFrontQuat(r){if(this.faceFront.distanceToSquared(HO)<.01)return r.identity();const[t,e]=Ul(this.faceFront);return $r.set(0,.5*Math.PI+t,e,"YZX"),r.setFromEuler($r)}};kl.type="bone";var jd=class{constructor(r,t,e,n,i){this.expressions=r,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=e,this.rangeMapVerticalDown=n,this.rangeMapVerticalUp=i}applyYawPitch(r,t){t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),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 t=Fe.RAD2DEG*r.y,e=Fe.RAD2DEG*r.x;this.applyYawPitch(t,e)}};jd.type="expression";var Ag=class{constructor(r,t){this.inputMaxValue=r,this.outputScale=t}map(r){return this.outputScale*cb(r/this.inputMaxValue)}},XO=new Set(["1.0","1.0-beta"]),Pl=.01,YO=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(r,t){this.parser=r,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(r){return pe(this,null,function*(){const t=r.userData.vrmHumanoid;if(t===null)return;if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const e=r.userData.vrmExpressionManager;if(e!==null){if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");r.userData.vrmLookAt=yield this._import(r,t,e)}})}_import(r,t,e){return pe(this,null,function*(){if(t==null||e==null)return null;const n=yield this._v1Import(r,t,e);if(n)return n;const i=yield this._v0Import(r,t,e);return i||null})}_v1Import(r,t,e){return pe(this,null,function*(){var n,i,s;const o=this.parser.json;if(!(((n=o.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const u=l.specVersion;if(!XO.has(u))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${u}"`),null;const c=l.lookAt;if(!c)return null;const h=c.type==="expression"?1:10,f=this._v1ImportRangeMap(c.rangeMapHorizontalInner,h),d=this._v1ImportRangeMap(c.rangeMapHorizontalOuter,h),m=this._v1ImportRangeMap(c.rangeMapVerticalDown,h),g=this._v1ImportRangeMap(c.rangeMapVerticalUp,h);let p;c.type==="expression"?p=new jd(e,f,d,m,g):p=new kl(t,f,d,m,g);const y=this._importLookAt(t,p);return y.offsetFromHeadBone.fromArray((s=c.offsetFromHeadBone)!=null?s:[0,.06,0]),y})}_v1ImportRangeMap(r,t){var e,n;let i=(e=r==null?void 0:r.inputMaxValue)!=null?e:90;const s=(n=r==null?void 0:r.outputScale)!=null?n:t;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},KO=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()}},JO=class extends KO{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(t=>{t.update&&t.update(r)})}},tP=Object.defineProperty,Mg=Object.getOwnPropertySymbols,eP=Object.prototype.hasOwnProperty,rP=Object.prototype.propertyIsEnumerable,Cg=(r,t,e)=>t in r?tP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Og=(r,t)=>{for(var e in t||(t={}))eP.call(t,e)&&Cg(r,e,t[e]);if(Mg)for(var e of Mg(t))rP.call(t,e)&&Cg(r,e,t[e]);return r},gs=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),nP={"":3e3,srgb:3001};function iP(r,t){parseInt(Jl,10)>=152?r.colorSpace=t:r.encoding=nP[t]}var sP=class{get pending(){return Promise.all(this._pendings)}constructor(r,t){this._parser=r,this._materialParams=t,this._pendings=[]}assignPrimitive(r,t){t!=null&&(this._materialParams[r]=t)}assignColor(r,t,e){t!=null&&(this._materialParams[r]=new qr().fromArray(t),e&&this._materialParams[r].convertSRGBToLinear())}assignTexture(r,t,e){return gs(this,null,function*(){const n=gs(this,null,function*(){t!=null&&(yield this._parser.assignTexture(this._materialParams,r,t),e&&iP(this._materialParams[r],"srgb"))});return this._pendings.push(n),n})}assignTextureByIndex(r,t,e){return gs(this,null,function*(){return this.assignTexture(r,t!=null?{index:t}:void 0,e)})}},oP=`// #define PHONG varying vec3 vViewPosition; @@ -4010,72 +4010,72 @@ void main() { } `,lP={None:"none"},Pg={None:"none",ScreenCoordinates:"screenCoordinates"},uP={3e3:"",3001:"srgb"};function ph(r){return parseInt(Jl,10)>=152?r.colorSpace:uP[r.encoding]}var cP=class extends v1{constructor(r={}){var t;super({vertexShader:oP,fragmentShader:aP}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=_1,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=lP.None,this._outlineWidthMode=Pg.None,this._isOutline=!1,r.transparentWithZWrite&&(r.depthWrite=!0),delete r.transparentWithZWrite,r.fog=!0,r.lights=!0,r.clipping=!0,this.uniforms=b1.merge([Ho.common,Ho.normalmap,Ho.emissivemap,Ho.fog,Ho.lights,{litFactor:{value:new qr(1,1,1)},mapUvTransform:{value:new xn},colorAlpha:{value:1},normalMapUvTransform:{value:new xn},shadeColorFactor:{value:new qr(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new xn},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new xn},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new qr(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new xn},parametricRimColorFactor:{value:new qr(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new xn},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new qr(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new xn},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new xn},outlineWidthFactor:{value:0},outlineColorFactor:{value:new qr(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new xn},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(t=r.uniforms)!=null?t:{}]),this.setValues(r),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([e,n])=>`${e}:${n}`),this.matcapTexture?`matcapTextureColorSpace:${ph(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${ph(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${ph(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=e=>{const n=parseInt(Jl,10),i=Object.entries(Og(Og({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` `)+` -`;e.vertexShader=i+e.vertexShader,e.fragmentShader=i+e.fragmentShader,n<154&&(e.fragmentShader=e.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(Jl,10),t=this.outlineWidthMultiplyTexture!==null,e=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:t||e,MTOON_UVS_VERTEX_ONLY:t&&!e,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===Pg.ScreenCoordinates}}_updateTextureMatrix(r,t){r.value&&(r.value.matrixAutoUpdate&&r.value.updateMatrix(),t.value.copy(r.value.matrix))}},hP=new Set(["1.0","1.0-beta"]),Sb=class zl{get name(){return zl.EXTENSION_NAME}constructor(t,e={}){var n,i,s,o;this.parser=t,this.materialType=(n=e.materialType)!=null?n:cP,this.renderOrderOffset=(i=e.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=e.v0CompatShade)!=null?s:!1,this.debugMode=(o=e.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return gs(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(t){return gs(this,null,function*(){t.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(t){return this._getMToonExtension(t)?this.materialType:null}extendMaterialParams(t,e){const n=this._getMToonExtension(t);return n?this._extendMaterialParams(n,e):null}loadMesh(t){return gs(this,null,function*(){var e;const n=this.parser,s=(e=n.json.meshes)==null?void 0:e[t];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${t}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield n.loadMesh(t);if(o.length===1){const l=a,u=o[0].material;u!=null&&this._setupPrimitive(l,u)}else{const l=a;for(let u=0;u{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(t){var e,n;const o=(e=this.parser.json.materials)==null?void 0:e[t];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${t}] of glTF but the material doesn't exist`);return}const a=(n=o.extensions)==null?void 0:n[zl.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!hP.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${zl.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(t,e){return gs(this,null,function*(){var n;delete e.metalness,delete e.roughness;const i=new sP(this.parser,e);i.assignPrimitive("transparentWithZWrite",t.transparentWithZWrite),i.assignColor("shadeColorFactor",t.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",t.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",t.shadingShiftFactor),i.assignTexture("shadingShiftTexture",t.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(n=t.shadingShiftTexture)==null?void 0:n.scale),i.assignPrimitive("shadingToonyFactor",t.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",t.giEqualizationFactor),i.assignColor("matcapFactor",t.matcapFactor),i.assignTexture("matcapTexture",t.matcapTexture,!0),i.assignColor("parametricRimColorFactor",t.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",t.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",t.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",t.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",t.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",t.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",t.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",t.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",t.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",t.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",t.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",t.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",t.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",t.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(t,e){const n=this._getMToonExtension(e);if(n){const i=this._parseRenderOrder(n);t.renderOrder=i+this.renderOrderOffset,this._generateOutline(t),this._addToMaterialSet(t);return}}_shouldGenerateOutline(t){return typeof t.outlineWidthMode=="string"&&t.outlineWidthMode!=="none"&&typeof t.outlineWidthFactor=="number"&&t.outlineWidthFactor>0}_generateOutline(t){const e=t.material;if(!(e instanceof m1)||!this._shouldGenerateOutline(e))return;t.material=[e];const n=e.clone();n.name+=" (Outline)",n.isOutline=!0,n.side=g1,t.material.push(n);const i=t.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(t){const e=t.material,n=new Set;Array.isArray(e)?e.forEach(i=>n.add(i)):n.add(e);for(const i of n)this._mToonMaterialSet.add(i)}_parseRenderOrder(t){var e;return(t.transparentWithZWrite?0:19)+((e=t.renderQueueOffsetNumber)!=null?e:0)}};Sb.EXTENSION_NAME="VRMC_materials_mtoon";var dP=Sb,fP=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),Tb=class $d{get name(){return $d.EXTENSION_NAME}constructor(t){this.parser=t}extendMaterialParams(t,e){return fP(this,null,function*(){const n=this._getHDREmissiveMultiplierExtension(t);if(n==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=n.emissiveMultiplier;e.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(t){var e,n;const o=(e=this.parser.json.materials)==null?void 0:e[t];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${t}] of glTF but the material doesn't exist`);return}const a=(n=o.extensions)==null?void 0:n[$d.EXTENSION_NAME];if(a!=null)return a}};Tb.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var pP=Tb,mP=Object.defineProperty,gP=Object.defineProperties,yP=Object.getOwnPropertyDescriptors,Rg=Object.getOwnPropertySymbols,vP=Object.prototype.hasOwnProperty,_P=Object.prototype.propertyIsEnumerable,Fg=(r,t,e)=>t in r?mP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,bn=(r,t)=>{for(var e in t||(t={}))vP.call(t,e)&&Fg(r,e,t[e]);if(Rg)for(var e of Rg(t))_P.call(t,e)&&Fg(r,e,t[e]);return r},Dg=(r,t)=>gP(r,yP(t)),bP=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())});function $s(r){return Math.pow(r,2.2)}var wP=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(r){var t;this.parser=r,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const e=this.parser.json;e.extensionsUsed=(t=e.extensionsUsed)!=null?t:[],e.extensionsUsed.indexOf("KHR_texture_transform")===-1&&e.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return bP(this,null,function*(){var r;const t=this.parser.json,e=(r=t.extensions)==null?void 0:r.VRM,n=e==null?void 0:e.materialProperties;n&&(this._populateRenderQueueMap(n),n.forEach((i,s)=>{var o,a;const l=(o=t.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const u=this._parseV0MToonProperties(i,l);t.materials[s]=u}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const u=this._parseV0UnlitProperties(i,l);t.materials[s]=u}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(r,t){var e,n,i,s,o,a,l,u,c,h,f,d,m,g,p,y,_,S,T,v,E,w,B,N,$,it,I,Z,x,nt,P,C,R,z,U,M,O,j,et,tt,gt,_t,ct,bt,vt,Et,re,ue,b,K,Q,L,D,q,ot;const at=(n=(e=r.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null?n:!1,ht=((i=r.floatProperties)==null?void 0:i._ZWrite)===1&&at,wt=this._v0ParseRenderQueue(r),ft=(o=(s=r.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,Mt=at?"BLEND":ft?"MASK":"OPAQUE",ge=ft?(l=(a=r.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,Ke=((c=(u=r.floatProperties)==null?void 0:u._CullMode)!=null?c:2)===0,sr=this._portTextureTransform(r),cr=((f=(h=r.vectorProperties)==null?void 0:h._Color)!=null?f:[1,1,1,1]).map((cl,hl)=>hl===3?cl:$s(cl)),ln=(d=r.textureProperties)==null?void 0:d._MainTex,Ie=ln!=null?{index:ln,extensions:bn({},sr)}:void 0,yn=(g=(m=r.floatProperties)==null?void 0:m._BumpScale)!=null?g:1,gi=(p=r.textureProperties)==null?void 0:p._BumpMap,Ir=gi!=null?{index:gi,scale:yn,extensions:bn({},sr)}:void 0,yi=((_=(y=r.vectorProperties)==null?void 0:y._EmissionColor)!=null?_:[0,0,0,1]).map($s),Gi=(S=r.textureProperties)==null?void 0:S._EmissionMap,Vo=Gi!=null?{index:Gi,extensions:bn({},sr)}:void 0,kr=((v=(T=r.vectorProperties)==null?void 0:T._ShadeColor)!=null?v:[.97,.81,.86,1]).map($s),Wi=(E=r.textureProperties)==null?void 0:E._ShadeTexture,Yn=Wi!=null?{index:Wi,extensions:bn({},sr)}:void 0;let zr=(B=(w=r.floatProperties)==null?void 0:w._ShadeShift)!=null?B:0,Ns=($=(N=r.floatProperties)==null?void 0:N._ShadeToony)!=null?$:.9;Ns=Fe.lerp(Ns,1,.5+.5*zr),zr=-zr-(1-Ns);const sl=(I=(it=r.floatProperties)==null?void 0:it._IndirectLightIntensity)!=null?I:.1,yc=sl?1-sl:void 0,jo=(Z=r.textureProperties)==null?void 0:Z._SphereAdd,vc=jo!=null?[1,1,1]:void 0,_c=jo!=null?{index:jo}:void 0,bc=(nt=(x=r.floatProperties)==null?void 0:x._RimLightingMix)!=null?nt:0,ol=(P=r.textureProperties)==null?void 0:P._RimTexture,wc=ol!=null?{index:ol,extensions:bn({},sr)}:void 0,xc=((R=(C=r.vectorProperties)==null?void 0:C._RimColor)!=null?R:[0,0,0,1]).map($s),al=(U=(z=r.floatProperties)==null?void 0:z._RimFresnelPower)!=null?U:1,Sc=(O=(M=r.floatProperties)==null?void 0:M._RimLift)!=null?O:0,Tc=["none","worldCoordinates","screenCoordinates"][(et=(j=r.floatProperties)==null?void 0:j._OutlineWidthMode)!=null?et:0];let $o=(gt=(tt=r.floatProperties)==null?void 0:tt._OutlineWidth)!=null?gt:0;$o=.01*$o;const ll=(_t=r.textureProperties)==null?void 0:_t._OutlineWidthTexture,Ic=ll!=null?{index:ll,extensions:bn({},sr)}:void 0,Ec=((bt=(ct=r.vectorProperties)==null?void 0:ct._OutlineColor)!=null?bt:[0,0,0]).map($s),Ac=((Et=(vt=r.floatProperties)==null?void 0:vt._OutlineColorMode)!=null?Et:0)===1?(ue=(re=r.floatProperties)==null?void 0:re._OutlineLightingMix)!=null?ue:1:0,ul=(b=r.textureProperties)==null?void 0:b._UvAnimMaskTexture,Mc=ul!=null?{index:ul,extensions:bn({},sr)}:void 0,Cc=(Q=(K=r.floatProperties)==null?void 0:K._UvAnimScrollX)!=null?Q:0;let Bs=(D=(L=r.floatProperties)==null?void 0:L._UvAnimScrollY)!=null?D:0;Bs!=null&&(Bs=-Bs);const Oc=(ot=(q=r.floatProperties)==null?void 0:q._UvAnimRotation)!=null?ot:0,Pc={specVersion:"1.0",transparentWithZWrite:ht,renderQueueOffsetNumber:wt,shadeColorFactor:kr,shadeMultiplyTexture:Yn,shadingShiftFactor:zr,shadingToonyFactor:Ns,giEqualizationFactor:yc,matcapFactor:vc,matcapTexture:_c,rimLightingMixFactor:bc,rimMultiplyTexture:wc,parametricRimColorFactor:xc,parametricRimFresnelPowerFactor:al,parametricRimLiftFactor:Sc,outlineWidthMode:Tc,outlineWidthFactor:$o,outlineWidthMultiplyTexture:Ic,outlineColorFactor:Ec,outlineLightingMixFactor:Ac,uvAnimationMaskTexture:Mc,uvAnimationScrollXSpeedFactor:Cc,uvAnimationScrollYSpeedFactor:Bs,uvAnimationRotationSpeedFactor:Oc};return Dg(bn({},t),{pbrMetallicRoughness:{baseColorFactor:cr,baseColorTexture:Ie},normalTexture:Ir,emissiveTexture:Vo,emissiveFactor:yi,alphaMode:Mt,alphaCutoff:ge,doubleSided:Ke,extensions:{VRMC_materials_mtoon:Pc}})}_parseV0UnlitProperties(r,t){var e,n,i,s,o;const a=r.shader==="VRM/UnlitTransparentZWrite",l=r.shader==="VRM/UnlitTransparent"||a,u=this._v0ParseRenderQueue(r),c=r.shader==="VRM/UnlitCutout",h=l?"BLEND":c?"MASK":"OPAQUE",f=c?(n=(e=r.floatProperties)==null?void 0:e._Cutoff)!=null?n:.5:void 0,d=this._portTextureTransform(r),m=((s=(i=r.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map($s),g=(o=r.textureProperties)==null?void 0:o._MainTex,p=g!=null?{index:g,extensions:bn({},d)}:void 0,y={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:u,shadeColorFactor:m,shadeMultiplyTexture:p};return Dg(bn({},t),{pbrMetallicRoughness:{baseColorFactor:m,baseColorTexture:p},alphaMode:h,alphaCutoff:f,extensions:{VRMC_materials_mtoon:y}})}_portTextureTransform(r){var t,e,n,i,s;const o=(t=r.vectorProperties)==null?void 0:t._MainTex;if(o==null)return{};const a=[(e=o==null?void 0:o[0])!=null?e:0,(n=o==null?void 0:o[1])!=null?n:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(r){var t,e;const n=r.shader==="VRM/UnlitTransparentZWrite",i=((t=r.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||n,s=((e=r.floatProperties)==null?void 0:e._ZWrite)===1||n;let o=0;if(i){const a=r.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(r){const t=new Set,e=new Set;r.forEach(n=>{var i,s;const o=n.shader==="VRM/UnlitTransparentZWrite",a=((i=n.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||o,l=((s=n.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const u=n.renderQueue;u!=null&&(l?e.add(u):t.add(u))}}),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.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(t).sort().forEach((n,i)=>{const s=Math.min(Math.max(i-t.size+1,-9),0);this._renderQueueMapTransparent.set(n,s)}),Array.from(e).sort().forEach((n,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(n,s)})}},Lg=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),_i=new mt,mh=class extends No{constructor(r){super(),this._attrPosition=new nr(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(w1);const t=new Ui;t.setAttribute("position",this._attrPosition);const e=new ec({color:16711935,depthTest:!1,depthWrite:!1});this._line=new x1(t,e),this.add(this._line),this.constraint=r}updateMatrixWorld(r){_i.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,_i.x,_i.y,_i.z),this.constraint.source&&_i.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,_i.x,_i.y,_i.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(r)}};function Ng(r,t){return t.set(r.elements[12],r.elements[13],r.elements[14])}var xP=new mt,SP=new mt;function TP(r,t){return r.decompose(xP,t,SP),t}function hu(r){return r.invert?r.invert():r.inverse(),r}var qf=class{constructor(r,t){this.destination=r,this.source=t,this.weight=1}},IP=new mt,EP=new mt,AP=new mt,MP=new ne,CP=new ne,OP=new ne,PP=class extends qf{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,t){super(r,t),this._aimAxis="PositiveX",this._v3AimAxis=new mt(1,0,0),this._dstRestQuat=new ne}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const r=MP.identity(),t=CP.identity();this.destination.parent&&(TP(this.destination.parent.matrixWorld,r),hu(t.copy(r)));const e=IP.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(r),n=Ng(this.source.matrixWorld,EP).sub(Ng(this.destination.matrixWorld,AP)).normalize(),i=OP.setFromUnitVectors(e,n).premultiply(t).multiply(r).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function RP(r,t){const e=[r];let n=r.parent;for(;n!==null;)e.unshift(n),n=n.parent;e.forEach(i=>{t(i)})}var FP=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(r){this._constraints.add(r);let t=this._objectConstraintsMap.get(r.destination);t==null&&(t=new Set,this._objectConstraintsMap.set(r.destination,t)),t.add(r)}deleteConstraint(r){this._constraints.delete(r),this._objectConstraintsMap.get(r.destination).delete(r)}setInitState(){const r=new Set,t=new Set;for(const e of this._constraints)this._processConstraint(e,r,t,n=>n.setInitState())}update(){const r=new Set,t=new Set;for(const e of this._constraints)this._processConstraint(e,r,t,n=>n.update())}_processConstraint(r,t,e,n){if(e.has(r))return;if(t.has(r))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");t.add(r);const i=r.dependencies;for(const s of i)RP(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,t,e,n)});n(r),e.add(r)}},DP=new ne,LP=new ne,NP=class extends qf{get dependencies(){return new Set([this.source])}constructor(r,t){super(r,t),this._dstRestQuat=new ne,this._invSrcRestQuat=new ne}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),hu(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const r=DP.copy(this._invSrcRestQuat).multiply(this.source.quaternion),t=LP.copy(this._dstRestQuat).multiply(r);this.destination.quaternion.copy(this._dstRestQuat).slerp(t,this.weight)}},BP=new mt,UP=new ne,kP=new ne,zP=class extends qf{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,t){super(r,t),this._rollAxis="X",this._v3RollAxis=new mt(1,0,0),this._dstRestQuat=new ne,this._invDstRestQuat=new ne,this._invSrcRestQuatMulDstRestQuat=new ne}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),hu(this._invDstRestQuat.copy(this._dstRestQuat)),hu(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const r=UP.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),t=BP.copy(this._v3RollAxis).applyQuaternion(r),n=kP.setFromUnitVectors(t,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(r);this.destination.quaternion.copy(this._dstRestQuat).slerp(n,this.weight)}},VP=new Set(["1.0","1.0-beta"]),Ib=class da{get name(){return da.EXTENSION_NAME}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return Lg(this,null,function*(){t.userData.vrmNodeConstraintManager=yield this._import(t)})}_import(t){return Lg(this,null,function*(){var e;const n=this.parser.json;if(!(((e=n.extensionsUsed)==null?void 0:e.indexOf(da.EXTENSION_NAME))!==-1))return null;const s=new FP,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var u;const c=n.nodes[l],h=(u=c==null?void 0:c.extensions)==null?void 0:u[da.EXTENSION_NAME];if(h==null)return;const f=h.specVersion;if(!VP.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${da.EXTENSION_NAME} specVersion "${f}"`);return}const d=h.constraint;if(d.roll!=null){const m=this._importRollConstraint(a,o,d.roll);s.addConstraint(m)}else if(d.aim!=null){const m=this._importAimConstraint(a,o,d.aim);s.addConstraint(m)}else if(d.rotation!=null){const m=this._importRotationConstraint(a,o,d.rotation);s.addConstraint(m)}}),t.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(t,e,n){const{source:i,rollAxis:s,weight:o}=n,a=e[i],l=new zP(t,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const u=new mh(l);this.helperRoot.add(u)}return l}_importAimConstraint(t,e,n){const{source:i,aimAxis:s,weight:o}=n,a=e[i],l=new PP(t,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const u=new mh(l);this.helperRoot.add(u)}return l}_importRotationConstraint(t,e,n){const{source:i,weight:s}=n,o=e[i],a=new NP(t,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new mh(a);this.helperRoot.add(l)}return a}};Ib.EXTENSION_NAME="VRMC_node_constraint";var jP=Ib,Rl=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),Qf=class{},gh=new mt,Ji=new mt,Eb=class extends Qf{get type(){return"capsule"}constructor(r){var t,e,n,i;super(),this.offset=(t=r==null?void 0:r.offset)!=null?t:new mt(0,0,0),this.tail=(e=r==null?void 0:r.tail)!=null?e:new mt(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,t,e,n){gh.setFromMatrixPosition(r),Ji.subVectors(this.tail,this.offset).applyMatrix4(r),Ji.sub(gh);const i=Ji.lengthSq();n.copy(t).sub(gh);const s=Ji.dot(n);s<=0||(i<=s||Ji.multiplyScalar(s/i),n.sub(Ji));const o=n.length(),a=this.inside?this.radius-e-o:o-e-this.radius;return a<0&&(n.multiplyScalar(1/o),this.inside&&n.negate()),a}},yh=new mt,Bg=new xn,Ab=class extends Qf{get type(){return"plane"}constructor(r){var t,e;super(),this.offset=(t=r==null?void 0:r.offset)!=null?t:new mt(0,0,0),this.normal=(e=r==null?void 0:r.normal)!=null?e:new mt(0,0,1)}calculateCollision(r,t,e,n){n.setFromMatrixPosition(r),n.negate().add(t),Bg.getNormalMatrix(r),yh.copy(this.normal).applyNormalMatrix(Bg).normalize();const i=n.dot(yh)-e;return n.copy(yh),i}},$P=new mt,Mb=class extends Qf{get type(){return"sphere"}constructor(r){var t,e,n;super(),this.offset=(t=r==null?void 0:r.offset)!=null?t:new mt(0,0,0),this.radius=(e=r==null?void 0:r.radius)!=null?e:0,this.inside=(n=r==null?void 0:r.inside)!=null?n:!1}calculateCollision(r,t,e,n){n.subVectors(t,$P.setFromMatrixPosition(r));const i=n.length(),s=this.inside?this.radius-e-i:i-e-this.radius;return s<0&&(n.multiplyScalar(1/i),this.inside&&n.negate()),s}},wn=new mt,GP=class extends Ui{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new mt,this._currentTail=new mt,this._shape=r,this._attrPos=new nr(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,r=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),r=!0);const e=wn.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(e)>1e-10&&(this._currentTail.copy(e),r=!0),r&&this._buildPosition()}_buildPosition(){wn.copy(this._currentTail).sub(this._currentOffset);const r=wn.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 t=Math.atan2(wn.y,Math.sqrt(wn.x*wn.x+wn.z*wn.z)),e=-Math.atan2(wn.z,wn.x);this.rotateZ(t),this.rotateY(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<34;r++){const t=(r+1)%34;this._attrIndex.setXY(r*2,r,t),this._attrIndex.setXY(68+r*2,34+r,34+t)}for(let r=0;r<32;r++){const t=(r+1)%32;this._attrIndex.setXY(136+r*2,68+r,68+t),this._attrIndex.setXY(200+r*2,100+r,100+t)}this._attrIndex.needsUpdate=!0}},WP=class extends Ui{constructor(r){super(),this.worldScale=1,this._currentOffset=new mt,this._currentNormal=new mt,this._shape=r,this._attrPos=new nr(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(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}},HP=class extends Ui{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new mt,this._shape=r,this._attrPos=new nr(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,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 t=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+r,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+r,Math.sin(t),0,Math.cos(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<32;r++){const t=(r+1)%32;this._attrIndex.setXY(r*2,r,t),this._attrIndex.setXY(64+r*2,32+r,32+t),this._attrIndex.setXY(128+r*2,64+r,64+t)}this._attrIndex.needsUpdate=!0}},XP=new mt,vh=class extends No{constructor(r){if(super(),this.matrixAutoUpdate=!1,this.collider=r,this.collider.shape instanceof Mb)this._geometry=new HP(this.collider.shape);else if(this.collider.shape instanceof Eb)this._geometry=new GP(this.collider.shape);else if(this.collider.shape instanceof Ab)this._geometry=new WP(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new ec({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Af(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(r){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=XP.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(r)}},YP=class extends Ui{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new mt,this._springBone=r,this._attrPos=new nr(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,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 t=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+r,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+r,Math.sin(t),0,Math.cos(t))}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 t=(r+1)%32;this._attrIndex.setXY(r*2,r,t),this._attrIndex.setXY(64+r*2,32+r,32+t),this._attrIndex.setXY(128+r*2,64+r,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},qP=new mt,QP=class extends No{constructor(r){super(),this.matrixAutoUpdate=!1,this.springBone=r,this._geometry=new YP(this.springBone);const t=new ec({color:16776960,depthTest:!1,depthWrite:!1});this._line=new Af(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(r){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=qP.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(r)}},_h=class extends Ca{constructor(r){super(),this.colliderMatrix=new Wn,this.shape=r}updateWorldMatrix(r,t){super.updateWorldMatrix(r,t),ZP(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function ZP(r,t,e){const n=t.elements;r.copy(t),e&&(r.elements[12]=n[0]*e.x+n[4]*e.y+n[8]*e.z+n[12],r.elements[13]=n[1]*e.x+n[5]*e.y+n[9]*e.z+n[13],r.elements[14]=n[2]*e.x+n[6]*e.y+n[10]*e.z+n[14])}var KP=new Wn;function JP(r){return r.invert?r.invert():r.getInverse(KP.copy(r)),r}var tR=class{constructor(r){this._inverseCache=new Wn,this._shouldUpdateInverse=!0,this.matrix=r;const t={set:(e,n,i)=>(this._shouldUpdateInverse=!0,e[n]=i,!0)};this._originalElements=r.elements,r.elements=new Proxy(r.elements,t)}get inverse(){return this._shouldUpdateInverse&&(JP(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},bh=new Wn,Gs=new mt,ta=new mt,ea=new mt,ra=new mt,eR=new Wn,rR=class{constructor(r,t,e={},n=[]){this._currentTail=new mt,this._prevTail=new mt,this._boneAxis=new mt,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Wn,this._initialLocalRotation=new ne,this._initialLocalChildPosition=new mt;var i,s,o,a,l,u;this.bone=r,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(i=e.hitRadius)!=null?i:0,stiffness:(s=e.stiffness)!=null?s:1,gravityPower:(o=e.gravityPower)!=null?o:0,gravityDir:(l=(a=e.gravityDir)==null?void 0:a.clone())!=null?l:new mt(0,-1,0),dragForce:(u=e.dragForce)!=null?u:.4},this.colliderGroups=n}get dependencies(){const r=new Set,t=this.bone.parent;t&&r.add(t);for(let e=0;e{t(i)})}function Gd(r,t){r.children.forEach(e=>{t(e)||Gd(e,t)})}function iR(r){var t;const e=new Map;for(const n of r){let i=n;do{const s=((t=e.get(i))!=null?t:0)+1;if(s===r.size)return i;e.set(i,s),i=i.parent}while(i!==null)}return null}var Ug=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(t=>{t.colliderGroups.forEach(e=>{r.add(e)})}),Array.from(r)}get colliders(){const r=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(e=>{r.add(e)})}),Array.from(r)}addJoint(r){this._joints.add(r);let t=this._objectSpringBonesMap.get(r.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(r.bone,t)),t.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 o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(r,t,e,n,i){if(e.has(r))return;if(t.has(r)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}t.add(r);const s=r.dependencies;for(const o of s){let a=!1,l=null;nR(o,u=>{const c=this._objectSpringBonesMap.get(u);if(c)for(const h of c)a=!0,this._insertJointSort(h,t,e,n,i);else a||(l=u)}),l&&i.add(l)}n.push(r),e.add(r)}_relevantChildrenUpdated(r){var t,e;return((e=(t=this._objectSpringBonesMap.get(r))==null?void 0:t.size)!=null?e:0)>0?!0:(r.updateWorldMatrix(!1,!1),!1)}},kg="VRMC_springBone_extended_collider",sR=new Set(["1.0","1.0-beta"]),oR=new Set(["1.0"]),Cb=class Qs{get name(){return Qs.EXTENSION_NAME}constructor(t,e){var n;this.parser=t,this.jointHelperRoot=e==null?void 0:e.jointHelperRoot,this.colliderHelperRoot=e==null?void 0:e.colliderHelperRoot,this.useExtendedColliders=(n=e==null?void 0:e.useExtendedColliders)!=null?n:!0}afterRoot(t){return Rl(this,null,function*(){t.userData.vrmSpringBoneManager=yield this._import(t)})}_import(t){return Rl(this,null,function*(){const e=yield this._v1Import(t);if(e!=null)return e;const n=yield this._v0Import(t);return n??null})}_v1Import(t){return Rl(this,null,function*(){var e,n,i,s,o;const a=t.parser.json;if(!(((e=a.extensionsUsed)==null?void 0:e.indexOf(Qs.EXTENSION_NAME))!==-1))return null;const u=new Ug,c=yield t.parser.getDependencies("node"),h=(n=a.extensions)==null?void 0:n[Qs.EXTENSION_NAME];if(!h)return null;const f=h.specVersion;if(!sR.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Qs.EXTENSION_NAME} specVersion "${f}"`),null;const d=(i=h.colliders)==null?void 0:i.map((g,p)=>{var y,_,S,T,v,E,w,B,N,$,it,I,Z,x,nt;const P=c[g.node];if(P==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${p} attempted to use the node #${g.node} but not found`),null;const C=g.shape,R=(y=g.extensions)==null?void 0:y[kg];if(this.useExtendedColliders&&R!=null){const z=R.specVersion;if(!oR.has(z))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${kg} specVersion "${z}". Fallbacking to the ${Qs.EXTENSION_NAME} definition`);else{const U=R.shape;if(U.sphere)return this._importSphereCollider(P,{offset:new mt().fromArray((_=U.sphere.offset)!=null?_:[0,0,0]),radius:(S=U.sphere.radius)!=null?S:0,inside:(T=U.sphere.inside)!=null?T:!1});if(U.capsule)return this._importCapsuleCollider(P,{offset:new mt().fromArray((v=U.capsule.offset)!=null?v:[0,0,0]),radius:(E=U.capsule.radius)!=null?E:0,tail:new mt().fromArray((w=U.capsule.tail)!=null?w:[0,0,0]),inside:(B=U.capsule.inside)!=null?B:!1});if(U.plane)return this._importPlaneCollider(P,{offset:new mt().fromArray((N=U.plane.offset)!=null?N:[0,0,0]),normal:new mt().fromArray(($=U.plane.normal)!=null?$:[0,0,1])})}}if(C.sphere)return this._importSphereCollider(P,{offset:new mt().fromArray((it=C.sphere.offset)!=null?it:[0,0,0]),radius:(I=C.sphere.radius)!=null?I:0,inside:!1});if(C.capsule)return this._importCapsuleCollider(P,{offset:new mt().fromArray((Z=C.capsule.offset)!=null?Z:[0,0,0]),radius:(x=C.capsule.radius)!=null?x:0,tail:new mt().fromArray((nt=C.capsule.tail)!=null?nt:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${p} has no valid shape`)}),m=(s=h.colliderGroups)==null?void 0:s.map((g,p)=>{var y;return{colliders:((y=g.colliders)!=null?y:[]).flatMap(S=>{const T=d==null?void 0:d[S];return T??(console.warn(`VRMSpringBoneLoaderPlugin: The colliderGroup #${p} attempted to use a collider #${S} but not found`),[])}),name:g.name}});return(o=h.springs)==null||o.forEach((g,p)=>{var y;const _=g.joints,S=(y=g.colliderGroups)==null?void 0:y.map(E=>{const w=m==null?void 0:m[E];if(w==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${E} but not found`);return w}),T=g.center!=null?c[g.center]:void 0;let v;_.forEach(E=>{if(v){const w=v.node,B=c[w],N=E.node,$=c[N],it={hitRadius:v.hitRadius,dragForce:v.dragForce,gravityPower:v.gravityPower,stiffness:v.stiffness,gravityDir:v.gravityDir!=null?new mt().fromArray(v.gravityDir):void 0},I=this._importJoint(B,$,it,S);T&&(I.center=T),u.addJoint(I)}v=E})}),u.setInitState(),u})}_v0Import(t){return Rl(this,null,function*(){var e,n,i;const s=t.parser.json;if(!(((e=s.extensionsUsed)==null?void 0:e.indexOf("VRM"))!==-1))return null;const a=(n=s.extensions)==null?void 0:n.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const u=l==null?void 0:l.boneGroups;if(!u)return null;const c=new Ug,h=yield t.parser.getDependencies("node"),f=(i=l.colliderGroups)==null?void 0:i.map(d=>{var m;const g=h[d.node];return{colliders:((m=d.colliders)!=null?m:[]).map((y,_)=>{var S,T,v;const E=new mt(0,0,0);return y.offset&&E.set((S=y.offset.x)!=null?S:0,(T=y.offset.y)!=null?T:0,y.offset.z?-y.offset.z:0),this._importSphereCollider(g,{offset:E,radius:(v=y.radius)!=null?v:0,inside:!1})})}});return u==null||u.forEach((d,m)=>{const g=d.bones;g&&g.forEach(p=>{var y,_,S,T;const v=h[p],E=new mt;d.gravityDir?E.set((y=d.gravityDir.x)!=null?y:0,(_=d.gravityDir.y)!=null?_:0,(S=d.gravityDir.z)!=null?S:0):E.set(0,-1,0);const w=d.center!=null?h[d.center]:void 0,B={hitRadius:d.hitRadius,dragForce:d.dragForce,gravityPower:d.gravityPower,stiffness:d.stiffiness,gravityDir:E},N=(T=d.colliderGroups)==null?void 0:T.map($=>{const it=f==null?void 0:f[$];if(it==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${m} attempted to use a colliderGroup ${$} but not found`);return it});v.traverse($=>{var it;const I=(it=$.children[0])!=null?it:null,Z=this._importJoint($,I,B,N);w&&(Z.center=w),c.addJoint(Z)})})}),t.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(t,e,n,i){const s=new rR(t,e,n,i);if(this.jointHelperRoot){const o=new QP(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(t,e){const n=new Mb(e),i=new _h(n);if(t.add(i),this.colliderHelperRoot){const s=new vh(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(t,e){const n=new Eb(e),i=new _h(n);if(t.add(i),this.colliderHelperRoot){const s=new vh(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(t,e){const n=new Ab(e),i=new _h(n);if(t.add(i),this.colliderHelperRoot){const s=new vh(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};Cb.EXTENSION_NAME="VRMC_springBone";var aR=Cb,i3=class{get name(){return"VRMLoaderPlugin"}constructor(r,t){var e,n,i,s,o,a,l,u,c,h;this.parser=r;const f=t==null?void 0:t.helperRoot,d=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(e=t==null?void 0:t.expressionPlugin)!=null?e:new TO(r),this.firstPersonPlugin=(n=t==null?void 0:t.firstPersonPlugin)!=null?n:new EO(r),this.humanoidPlugin=(i=t==null?void 0:t.humanoidPlugin)!=null?i:new FO(r,{helperRoot:f,autoUpdateHumanBones:d}),this.lookAtPlugin=(s=t==null?void 0:t.lookAtPlugin)!=null?s:new YO(r,{helperRoot:f}),this.metaPlugin=(o=t==null?void 0:t.metaPlugin)!=null?o:new ZO(r),this.mtoonMaterialPlugin=(a=t==null?void 0:t.mtoonMaterialPlugin)!=null?a:new dP(r),this.materialsHDREmissiveMultiplierPlugin=(l=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!=null?l:new pP(r),this.materialsV0CompatPlugin=(u=t==null?void 0:t.materialsV0CompatPlugin)!=null?u:new wP(r),this.springBonePlugin=(c=t==null?void 0:t.springBonePlugin)!=null?c:new aR(r,{colliderHelperRoot:f,jointHelperRoot:f}),this.nodeConstraintPlugin=(h=t==null?void 0:t.nodeConstraintPlugin)!=null?h:new jP(r,{helperRoot:f})}beforeRoot(){return Cl(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(r){return Cl(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(r)})}getMaterialType(r){const t=this.mtoonMaterialPlugin.getMaterialType(r);return t??null}extendMaterialParams(r,t){return Cl(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(r,t),yield this.mtoonMaterialPlugin.extendMaterialParams(r,t)})}afterRoot(r){return Cl(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 t=r.userData.vrmMeta,e=r.userData.vrmHumanoid;if(t&&e){const n=new JO({scene:r.scene,expressionManager:r.userData.vrmExpressionManager,firstPerson:r.userData.vrmFirstPerson,humanoid:e,lookAt:r.userData.vrmLookAt,meta:t,materials:r.userData.vrmMToonMaterials,springBoneManager:r.userData.vrmSpringBoneManager,nodeConstraintManager:r.userData.vrmNodeConstraintManager});r.userData.vrm=n}})}};function lR(r){const t=new Set;return r.traverse(e=>{if(!e.isMesh)return;const n=e;t.add(n)}),t}function zg(r,t,e){if(t.size===1){const o=t.values().next().value;if(o.weight===1)return r[o.index]}const n=new Float32Array(r[0].count*3);let i=0;if(e)i=1;else for(const o of t)i+=o.weight;for(const o of t){const a=r[o.index],l=o.weight/i;for(let u=0;uu.getOrCreate(B)).join(","),E=`${S};${p};${v}`;let w=o.get(E);w==null&&(w=_.clone(),mR(w,T,d),o.set(E,w)),y.geometry.setAttribute("skinIndex",w)}for(const y of f)y.bind(g,new Wn)}}function hR(r){const t=new Set;return r.traverse(e=>{if(!e.isSkinnedMesh)return;const n=e;t.add(n)}),t}function dR(r,t){const e=new Set;for(let n=0;ne)return!1;return!0}var wh=class{constructor(){this._objectIndexMap=new Map,this._index=0}get(r){return this._objectIndexMap.get(r)}getOrCreate(r){let t=this._objectIndexMap.get(r);return t==null&&(t=this._index,this._objectIndexMap.set(r,t),this._index++),t}};function Vg(r){if(Object.values(r).forEach(t=>{t!=null&&t.isTexture&&t.dispose()}),r.isShaderMaterial){const t=r.uniforms;t&&Object.values(t).forEach(e=>{const n=e.value;n!=null&&n.isTexture&&n.dispose()})}r.dispose()}function yR(r){const t=r.geometry;t&&t.dispose();const e=r.skeleton;e&&e.dispose();const n=r.material;n&&(Array.isArray(n)?n.forEach(i=>Vg(i)):n&&Vg(n))}function vR(r){r.traverse(yR)}function _R(r,t){var e,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=(e=t==null?void 0:t.experimentalSameBoneCounts)!=null?e:!1,s=[];r.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const c=l.geometry.getAttribute("skinIndex");if(o.has(c))continue;const h=new Map,f=new Map;for(let d=0;d{var n,i,s,o;if(!e.isMesh)return;const a=e,l=a.geometry,u=l.index;if(u==null)return;const c=t.get(l);if(c!=null){a.geometry=c;return}const h=Object.values(l.attributes)[0].count,f=new Array(h);let d=0;const m=u.array;for(let T=0;T{_.addGroup(T.start,T.count,T.materialIndex)}),_.boundingBox=(i=(n=l.boundingBox)==null?void 0:n.clone())!=null?i:null,_.boundingSphere=(o=(s=l.boundingSphere)==null?void 0:s.clone())!=null?o:null,_.setDrawRange(l.drawRange.start,l.drawRange.count),_.userData=l.userData,t.set(l,_);{const T=u.array,v=new T.constructor(T.length);for(let E=0;E{const v=l.attributes[T];if(v.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const E=v.array,{itemSize:w,normalized:B}=v,N=new E.constructor(p.length*w);p.forEach(($,it)=>{for(let I=0;I{_.morphAttributes[T]=[];const v=l.morphAttributes[T];for(let E=0;E{for(let x=0;xI===0),_.morphAttributes[T][E]=new nr(it,N,$)}}),S&&(_.morphAttributes={}),a.geometry=_}),Array.from(t.keys()).forEach(e=>{e.dispose()})}function wR(r){var t;((t=r.meta)==null?void 0:t.metaVersion)==="0"&&(r.scene.rotation.y=Math.PI)}var Bo=class{constructor(){}};Bo.combineMorphs=uR;Bo.combineSkeletons=cR;Bo.deepDispose=vR;Bo.removeUnnecessaryJoints=_R;Bo.removeUnnecessaryVertices=bR;Bo.rotateVRM0=wR;/*! - * @pixiv/three-vrm-core v3.3.6 +`;e.vertexShader=i+e.vertexShader,e.fragmentShader=i+e.fragmentShader,n<154&&(e.fragmentShader=e.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(Jl,10),t=this.outlineWidthMultiplyTexture!==null,e=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:t||e,MTOON_UVS_VERTEX_ONLY:t&&!e,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===Pg.ScreenCoordinates}}_updateTextureMatrix(r,t){r.value&&(r.value.matrixAutoUpdate&&r.value.updateMatrix(),t.value.copy(r.value.matrix))}},hP=new Set(["1.0","1.0-beta"]),Sb=class zl{get name(){return zl.EXTENSION_NAME}constructor(t,e={}){var n,i,s,o;this.parser=t,this.materialType=(n=e.materialType)!=null?n:cP,this.renderOrderOffset=(i=e.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=e.v0CompatShade)!=null?s:!1,this.debugMode=(o=e.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return gs(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(t){return gs(this,null,function*(){t.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(t){return this._getMToonExtension(t)?this.materialType:null}extendMaterialParams(t,e){const n=this._getMToonExtension(t);return n?this._extendMaterialParams(n,e):null}loadMesh(t){return gs(this,null,function*(){var e;const n=this.parser,s=(e=n.json.meshes)==null?void 0:e[t];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${t}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield n.loadMesh(t);if(o.length===1){const l=a,u=o[0].material;u!=null&&this._setupPrimitive(l,u)}else{const l=a;for(let u=0;u{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(t){var e,n;const o=(e=this.parser.json.materials)==null?void 0:e[t];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${t}] of glTF but the material doesn't exist`);return}const a=(n=o.extensions)==null?void 0:n[zl.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!hP.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${zl.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(t,e){return gs(this,null,function*(){var n;delete e.metalness,delete e.roughness;const i=new sP(this.parser,e);i.assignPrimitive("transparentWithZWrite",t.transparentWithZWrite),i.assignColor("shadeColorFactor",t.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",t.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",t.shadingShiftFactor),i.assignTexture("shadingShiftTexture",t.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(n=t.shadingShiftTexture)==null?void 0:n.scale),i.assignPrimitive("shadingToonyFactor",t.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",t.giEqualizationFactor),i.assignColor("matcapFactor",t.matcapFactor),i.assignTexture("matcapTexture",t.matcapTexture,!0),i.assignColor("parametricRimColorFactor",t.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",t.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",t.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",t.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",t.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",t.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",t.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",t.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",t.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",t.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",t.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",t.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",t.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",t.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(t,e){const n=this._getMToonExtension(e);if(n){const i=this._parseRenderOrder(n);t.renderOrder=i+this.renderOrderOffset,this._generateOutline(t),this._addToMaterialSet(t);return}}_shouldGenerateOutline(t){return typeof t.outlineWidthMode=="string"&&t.outlineWidthMode!=="none"&&typeof t.outlineWidthFactor=="number"&&t.outlineWidthFactor>0}_generateOutline(t){const e=t.material;if(!(e instanceof m1)||!this._shouldGenerateOutline(e))return;t.material=[e];const n=e.clone();n.name+=" (Outline)",n.isOutline=!0,n.side=g1,t.material.push(n);const i=t.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(t){const e=t.material,n=new Set;Array.isArray(e)?e.forEach(i=>n.add(i)):n.add(e);for(const i of n)this._mToonMaterialSet.add(i)}_parseRenderOrder(t){var e;return(t.transparentWithZWrite?0:19)+((e=t.renderQueueOffsetNumber)!=null?e:0)}};Sb.EXTENSION_NAME="VRMC_materials_mtoon";var dP=Sb,fP=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),Tb=class $d{get name(){return $d.EXTENSION_NAME}constructor(t){this.parser=t}extendMaterialParams(t,e){return fP(this,null,function*(){const n=this._getHDREmissiveMultiplierExtension(t);if(n==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=n.emissiveMultiplier;e.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(t){var e,n;const o=(e=this.parser.json.materials)==null?void 0:e[t];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${t}] of glTF but the material doesn't exist`);return}const a=(n=o.extensions)==null?void 0:n[$d.EXTENSION_NAME];if(a!=null)return a}};Tb.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var pP=Tb,mP=Object.defineProperty,gP=Object.defineProperties,yP=Object.getOwnPropertyDescriptors,Rg=Object.getOwnPropertySymbols,vP=Object.prototype.hasOwnProperty,_P=Object.prototype.propertyIsEnumerable,Fg=(r,t,e)=>t in r?mP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,bn=(r,t)=>{for(var e in t||(t={}))vP.call(t,e)&&Fg(r,e,t[e]);if(Rg)for(var e of Rg(t))_P.call(t,e)&&Fg(r,e,t[e]);return r},Dg=(r,t)=>gP(r,yP(t)),bP=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())});function $s(r){return Math.pow(r,2.2)}var wP=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(r){var t;this.parser=r,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const e=this.parser.json;e.extensionsUsed=(t=e.extensionsUsed)!=null?t:[],e.extensionsUsed.indexOf("KHR_texture_transform")===-1&&e.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return bP(this,null,function*(){var r;const t=this.parser.json,e=(r=t.extensions)==null?void 0:r.VRM,n=e==null?void 0:e.materialProperties;n&&(this._populateRenderQueueMap(n),n.forEach((i,s)=>{var o,a;const l=(o=t.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const u=this._parseV0MToonProperties(i,l);t.materials[s]=u}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const u=this._parseV0UnlitProperties(i,l);t.materials[s]=u}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(r,t){var e,n,i,s,o,a,l,u,c,h,f,d,m,g,p,y,_,S,T,v,E,w,B,L,$,it,I,Z,x,nt,P,C,R,z,U,M,O,j,et,tt,gt,_t,ct,bt,vt,Et,re,ue,b,K,Q,N,D,q,ot;const at=(n=(e=r.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null?n:!1,ht=((i=r.floatProperties)==null?void 0:i._ZWrite)===1&&at,wt=this._v0ParseRenderQueue(r),ft=(o=(s=r.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,Mt=at?"BLEND":ft?"MASK":"OPAQUE",ge=ft?(l=(a=r.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,Ke=((c=(u=r.floatProperties)==null?void 0:u._CullMode)!=null?c:2)===0,sr=this._portTextureTransform(r),cr=((f=(h=r.vectorProperties)==null?void 0:h._Color)!=null?f:[1,1,1,1]).map((cl,hl)=>hl===3?cl:$s(cl)),ln=(d=r.textureProperties)==null?void 0:d._MainTex,Ie=ln!=null?{index:ln,extensions:bn({},sr)}:void 0,yn=(g=(m=r.floatProperties)==null?void 0:m._BumpScale)!=null?g:1,yi=(p=r.textureProperties)==null?void 0:p._BumpMap,Ir=yi!=null?{index:yi,scale:yn,extensions:bn({},sr)}:void 0,vi=((_=(y=r.vectorProperties)==null?void 0:y._EmissionColor)!=null?_:[0,0,0,1]).map($s),Gi=(S=r.textureProperties)==null?void 0:S._EmissionMap,Vo=Gi!=null?{index:Gi,extensions:bn({},sr)}:void 0,kr=((v=(T=r.vectorProperties)==null?void 0:T._ShadeColor)!=null?v:[.97,.81,.86,1]).map($s),Wi=(E=r.textureProperties)==null?void 0:E._ShadeTexture,Yn=Wi!=null?{index:Wi,extensions:bn({},sr)}:void 0;let zr=(B=(w=r.floatProperties)==null?void 0:w._ShadeShift)!=null?B:0,Ns=($=(L=r.floatProperties)==null?void 0:L._ShadeToony)!=null?$:.9;Ns=Fe.lerp(Ns,1,.5+.5*zr),zr=-zr-(1-Ns);const sl=(I=(it=r.floatProperties)==null?void 0:it._IndirectLightIntensity)!=null?I:.1,yc=sl?1-sl:void 0,jo=(Z=r.textureProperties)==null?void 0:Z._SphereAdd,vc=jo!=null?[1,1,1]:void 0,_c=jo!=null?{index:jo}:void 0,bc=(nt=(x=r.floatProperties)==null?void 0:x._RimLightingMix)!=null?nt:0,ol=(P=r.textureProperties)==null?void 0:P._RimTexture,wc=ol!=null?{index:ol,extensions:bn({},sr)}:void 0,xc=((R=(C=r.vectorProperties)==null?void 0:C._RimColor)!=null?R:[0,0,0,1]).map($s),al=(U=(z=r.floatProperties)==null?void 0:z._RimFresnelPower)!=null?U:1,Sc=(O=(M=r.floatProperties)==null?void 0:M._RimLift)!=null?O:0,Tc=["none","worldCoordinates","screenCoordinates"][(et=(j=r.floatProperties)==null?void 0:j._OutlineWidthMode)!=null?et:0];let $o=(gt=(tt=r.floatProperties)==null?void 0:tt._OutlineWidth)!=null?gt:0;$o=.01*$o;const ll=(_t=r.textureProperties)==null?void 0:_t._OutlineWidthTexture,Ic=ll!=null?{index:ll,extensions:bn({},sr)}:void 0,Ec=((bt=(ct=r.vectorProperties)==null?void 0:ct._OutlineColor)!=null?bt:[0,0,0]).map($s),Ac=((Et=(vt=r.floatProperties)==null?void 0:vt._OutlineColorMode)!=null?Et:0)===1?(ue=(re=r.floatProperties)==null?void 0:re._OutlineLightingMix)!=null?ue:1:0,ul=(b=r.textureProperties)==null?void 0:b._UvAnimMaskTexture,Mc=ul!=null?{index:ul,extensions:bn({},sr)}:void 0,Cc=(Q=(K=r.floatProperties)==null?void 0:K._UvAnimScrollX)!=null?Q:0;let Bs=(D=(N=r.floatProperties)==null?void 0:N._UvAnimScrollY)!=null?D:0;Bs!=null&&(Bs=-Bs);const Oc=(ot=(q=r.floatProperties)==null?void 0:q._UvAnimRotation)!=null?ot:0,Pc={specVersion:"1.0",transparentWithZWrite:ht,renderQueueOffsetNumber:wt,shadeColorFactor:kr,shadeMultiplyTexture:Yn,shadingShiftFactor:zr,shadingToonyFactor:Ns,giEqualizationFactor:yc,matcapFactor:vc,matcapTexture:_c,rimLightingMixFactor:bc,rimMultiplyTexture:wc,parametricRimColorFactor:xc,parametricRimFresnelPowerFactor:al,parametricRimLiftFactor:Sc,outlineWidthMode:Tc,outlineWidthFactor:$o,outlineWidthMultiplyTexture:Ic,outlineColorFactor:Ec,outlineLightingMixFactor:Ac,uvAnimationMaskTexture:Mc,uvAnimationScrollXSpeedFactor:Cc,uvAnimationScrollYSpeedFactor:Bs,uvAnimationRotationSpeedFactor:Oc};return Dg(bn({},t),{pbrMetallicRoughness:{baseColorFactor:cr,baseColorTexture:Ie},normalTexture:Ir,emissiveTexture:Vo,emissiveFactor:vi,alphaMode:Mt,alphaCutoff:ge,doubleSided:Ke,extensions:{VRMC_materials_mtoon:Pc}})}_parseV0UnlitProperties(r,t){var e,n,i,s,o;const a=r.shader==="VRM/UnlitTransparentZWrite",l=r.shader==="VRM/UnlitTransparent"||a,u=this._v0ParseRenderQueue(r),c=r.shader==="VRM/UnlitCutout",h=l?"BLEND":c?"MASK":"OPAQUE",f=c?(n=(e=r.floatProperties)==null?void 0:e._Cutoff)!=null?n:.5:void 0,d=this._portTextureTransform(r),m=((s=(i=r.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map($s),g=(o=r.textureProperties)==null?void 0:o._MainTex,p=g!=null?{index:g,extensions:bn({},d)}:void 0,y={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:u,shadeColorFactor:m,shadeMultiplyTexture:p};return Dg(bn({},t),{pbrMetallicRoughness:{baseColorFactor:m,baseColorTexture:p},alphaMode:h,alphaCutoff:f,extensions:{VRMC_materials_mtoon:y}})}_portTextureTransform(r){var t,e,n,i,s;const o=(t=r.vectorProperties)==null?void 0:t._MainTex;if(o==null)return{};const a=[(e=o==null?void 0:o[0])!=null?e:0,(n=o==null?void 0:o[1])!=null?n:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(r){var t,e;const n=r.shader==="VRM/UnlitTransparentZWrite",i=((t=r.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||n,s=((e=r.floatProperties)==null?void 0:e._ZWrite)===1||n;let o=0;if(i){const a=r.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(r){const t=new Set,e=new Set;r.forEach(n=>{var i,s;const o=n.shader==="VRM/UnlitTransparentZWrite",a=((i=n.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||o,l=((s=n.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const u=n.renderQueue;u!=null&&(l?e.add(u):t.add(u))}}),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.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(t).sort().forEach((n,i)=>{const s=Math.min(Math.max(i-t.size+1,-9),0);this._renderQueueMapTransparent.set(n,s)}),Array.from(e).sort().forEach((n,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(n,s)})}},Lg=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),bi=new mt,mh=class extends No{constructor(r){super(),this._attrPosition=new nr(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(w1);const t=new hi;t.setAttribute("position",this._attrPosition);const e=new ec({color:16711935,depthTest:!1,depthWrite:!1});this._line=new x1(t,e),this.add(this._line),this.constraint=r}updateMatrixWorld(r){bi.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,bi.x,bi.y,bi.z),this.constraint.source&&bi.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,bi.x,bi.y,bi.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(r)}};function Ng(r,t){return t.set(r.elements[12],r.elements[13],r.elements[14])}var xP=new mt,SP=new mt;function TP(r,t){return r.decompose(xP,t,SP),t}function hu(r){return r.invert?r.invert():r.inverse(),r}var qf=class{constructor(r,t){this.destination=r,this.source=t,this.weight=1}},IP=new mt,EP=new mt,AP=new mt,MP=new ne,CP=new ne,OP=new ne,PP=class extends qf{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,t){super(r,t),this._aimAxis="PositiveX",this._v3AimAxis=new mt(1,0,0),this._dstRestQuat=new ne}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const r=MP.identity(),t=CP.identity();this.destination.parent&&(TP(this.destination.parent.matrixWorld,r),hu(t.copy(r)));const e=IP.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(r),n=Ng(this.source.matrixWorld,EP).sub(Ng(this.destination.matrixWorld,AP)).normalize(),i=OP.setFromUnitVectors(e,n).premultiply(t).multiply(r).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function RP(r,t){const e=[r];let n=r.parent;for(;n!==null;)e.unshift(n),n=n.parent;e.forEach(i=>{t(i)})}var FP=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(r){this._constraints.add(r);let t=this._objectConstraintsMap.get(r.destination);t==null&&(t=new Set,this._objectConstraintsMap.set(r.destination,t)),t.add(r)}deleteConstraint(r){this._constraints.delete(r),this._objectConstraintsMap.get(r.destination).delete(r)}setInitState(){const r=new Set,t=new Set;for(const e of this._constraints)this._processConstraint(e,r,t,n=>n.setInitState())}update(){const r=new Set,t=new Set;for(const e of this._constraints)this._processConstraint(e,r,t,n=>n.update())}_processConstraint(r,t,e,n){if(e.has(r))return;if(t.has(r))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");t.add(r);const i=r.dependencies;for(const s of i)RP(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,t,e,n)});n(r),e.add(r)}},DP=new ne,LP=new ne,NP=class extends qf{get dependencies(){return new Set([this.source])}constructor(r,t){super(r,t),this._dstRestQuat=new ne,this._invSrcRestQuat=new ne}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),hu(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const r=DP.copy(this._invSrcRestQuat).multiply(this.source.quaternion),t=LP.copy(this._dstRestQuat).multiply(r);this.destination.quaternion.copy(this._dstRestQuat).slerp(t,this.weight)}},BP=new mt,UP=new ne,kP=new ne,zP=class extends qf{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,t){super(r,t),this._rollAxis="X",this._v3RollAxis=new mt(1,0,0),this._dstRestQuat=new ne,this._invDstRestQuat=new ne,this._invSrcRestQuatMulDstRestQuat=new ne}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),hu(this._invDstRestQuat.copy(this._dstRestQuat)),hu(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const r=UP.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),t=BP.copy(this._v3RollAxis).applyQuaternion(r),n=kP.setFromUnitVectors(t,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(r);this.destination.quaternion.copy(this._dstRestQuat).slerp(n,this.weight)}},VP=new Set(["1.0","1.0-beta"]),Ib=class da{get name(){return da.EXTENSION_NAME}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return Lg(this,null,function*(){t.userData.vrmNodeConstraintManager=yield this._import(t)})}_import(t){return Lg(this,null,function*(){var e;const n=this.parser.json;if(!(((e=n.extensionsUsed)==null?void 0:e.indexOf(da.EXTENSION_NAME))!==-1))return null;const s=new FP,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var u;const c=n.nodes[l],h=(u=c==null?void 0:c.extensions)==null?void 0:u[da.EXTENSION_NAME];if(h==null)return;const f=h.specVersion;if(!VP.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${da.EXTENSION_NAME} specVersion "${f}"`);return}const d=h.constraint;if(d.roll!=null){const m=this._importRollConstraint(a,o,d.roll);s.addConstraint(m)}else if(d.aim!=null){const m=this._importAimConstraint(a,o,d.aim);s.addConstraint(m)}else if(d.rotation!=null){const m=this._importRotationConstraint(a,o,d.rotation);s.addConstraint(m)}}),t.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(t,e,n){const{source:i,rollAxis:s,weight:o}=n,a=e[i],l=new zP(t,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const u=new mh(l);this.helperRoot.add(u)}return l}_importAimConstraint(t,e,n){const{source:i,aimAxis:s,weight:o}=n,a=e[i],l=new PP(t,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const u=new mh(l);this.helperRoot.add(u)}return l}_importRotationConstraint(t,e,n){const{source:i,weight:s}=n,o=e[i],a=new NP(t,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new mh(a);this.helperRoot.add(l)}return a}};Ib.EXTENSION_NAME="VRMC_node_constraint";var jP=Ib,Rl=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),Qf=class{},gh=new mt,Ji=new mt,Eb=class extends Qf{get type(){return"capsule"}constructor(r){var t,e,n,i;super(),this.offset=(t=r==null?void 0:r.offset)!=null?t:new mt(0,0,0),this.tail=(e=r==null?void 0:r.tail)!=null?e:new mt(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,t,e,n){gh.setFromMatrixPosition(r),Ji.subVectors(this.tail,this.offset).applyMatrix4(r),Ji.sub(gh);const i=Ji.lengthSq();n.copy(t).sub(gh);const s=Ji.dot(n);s<=0||(i<=s||Ji.multiplyScalar(s/i),n.sub(Ji));const o=n.length(),a=this.inside?this.radius-e-o:o-e-this.radius;return a<0&&(n.multiplyScalar(1/o),this.inside&&n.negate()),a}},yh=new mt,Bg=new xn,Ab=class extends Qf{get type(){return"plane"}constructor(r){var t,e;super(),this.offset=(t=r==null?void 0:r.offset)!=null?t:new mt(0,0,0),this.normal=(e=r==null?void 0:r.normal)!=null?e:new mt(0,0,1)}calculateCollision(r,t,e,n){n.setFromMatrixPosition(r),n.negate().add(t),Bg.getNormalMatrix(r),yh.copy(this.normal).applyNormalMatrix(Bg).normalize();const i=n.dot(yh)-e;return n.copy(yh),i}},$P=new mt,Mb=class extends Qf{get type(){return"sphere"}constructor(r){var t,e,n;super(),this.offset=(t=r==null?void 0:r.offset)!=null?t:new mt(0,0,0),this.radius=(e=r==null?void 0:r.radius)!=null?e:0,this.inside=(n=r==null?void 0:r.inside)!=null?n:!1}calculateCollision(r,t,e,n){n.subVectors(t,$P.setFromMatrixPosition(r));const i=n.length(),s=this.inside?this.radius-e-i:i-e-this.radius;return s<0&&(n.multiplyScalar(1/i),this.inside&&n.negate()),s}},wn=new mt,GP=class extends hi{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new mt,this._currentTail=new mt,this._shape=r,this._attrPos=new nr(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,r=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),r=!0);const e=wn.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(e)>1e-10&&(this._currentTail.copy(e),r=!0),r&&this._buildPosition()}_buildPosition(){wn.copy(this._currentTail).sub(this._currentOffset);const r=wn.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 t=Math.atan2(wn.y,Math.sqrt(wn.x*wn.x+wn.z*wn.z)),e=-Math.atan2(wn.z,wn.x);this.rotateZ(t),this.rotateY(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<34;r++){const t=(r+1)%34;this._attrIndex.setXY(r*2,r,t),this._attrIndex.setXY(68+r*2,34+r,34+t)}for(let r=0;r<32;r++){const t=(r+1)%32;this._attrIndex.setXY(136+r*2,68+r,68+t),this._attrIndex.setXY(200+r*2,100+r,100+t)}this._attrIndex.needsUpdate=!0}},WP=class extends hi{constructor(r){super(),this.worldScale=1,this._currentOffset=new mt,this._currentNormal=new mt,this._shape=r,this._attrPos=new nr(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(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}},HP=class extends hi{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new mt,this._shape=r,this._attrPos=new nr(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,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 t=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+r,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+r,Math.sin(t),0,Math.cos(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<32;r++){const t=(r+1)%32;this._attrIndex.setXY(r*2,r,t),this._attrIndex.setXY(64+r*2,32+r,32+t),this._attrIndex.setXY(128+r*2,64+r,64+t)}this._attrIndex.needsUpdate=!0}},XP=new mt,vh=class extends No{constructor(r){if(super(),this.matrixAutoUpdate=!1,this.collider=r,this.collider.shape instanceof Mb)this._geometry=new HP(this.collider.shape);else if(this.collider.shape instanceof Eb)this._geometry=new GP(this.collider.shape);else if(this.collider.shape instanceof Ab)this._geometry=new WP(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new ec({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Af(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(r){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=XP.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(r)}},YP=class extends hi{constructor(r){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new mt,this._springBone=r,this._attrPos=new nr(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nr(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let r=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,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 t=r/16*Math.PI;this._attrPos.setXYZ(r,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+r,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+r,Math.sin(t),0,Math.cos(t))}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 t=(r+1)%32;this._attrIndex.setXY(r*2,r,t),this._attrIndex.setXY(64+r*2,32+r,32+t),this._attrIndex.setXY(128+r*2,64+r,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},qP=new mt,QP=class extends No{constructor(r){super(),this.matrixAutoUpdate=!1,this.springBone=r,this._geometry=new YP(this.springBone);const t=new ec({color:16776960,depthTest:!1,depthWrite:!1});this._line=new Af(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(r){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=qP.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(r)}},_h=class extends Ca{constructor(r){super(),this.colliderMatrix=new Wn,this.shape=r}updateWorldMatrix(r,t){super.updateWorldMatrix(r,t),ZP(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function ZP(r,t,e){const n=t.elements;r.copy(t),e&&(r.elements[12]=n[0]*e.x+n[4]*e.y+n[8]*e.z+n[12],r.elements[13]=n[1]*e.x+n[5]*e.y+n[9]*e.z+n[13],r.elements[14]=n[2]*e.x+n[6]*e.y+n[10]*e.z+n[14])}var KP=new Wn;function JP(r){return r.invert?r.invert():r.getInverse(KP.copy(r)),r}var tR=class{constructor(r){this._inverseCache=new Wn,this._shouldUpdateInverse=!0,this.matrix=r;const t={set:(e,n,i)=>(this._shouldUpdateInverse=!0,e[n]=i,!0)};this._originalElements=r.elements,r.elements=new Proxy(r.elements,t)}get inverse(){return this._shouldUpdateInverse&&(JP(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},bh=new Wn,Gs=new mt,ta=new mt,ea=new mt,ra=new mt,eR=new Wn,rR=class{constructor(r,t,e={},n=[]){this._currentTail=new mt,this._prevTail=new mt,this._boneAxis=new mt,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Wn,this._initialLocalRotation=new ne,this._initialLocalChildPosition=new mt;var i,s,o,a,l,u;this.bone=r,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(i=e.hitRadius)!=null?i:0,stiffness:(s=e.stiffness)!=null?s:1,gravityPower:(o=e.gravityPower)!=null?o:0,gravityDir:(l=(a=e.gravityDir)==null?void 0:a.clone())!=null?l:new mt(0,-1,0),dragForce:(u=e.dragForce)!=null?u:.4},this.colliderGroups=n}get dependencies(){const r=new Set,t=this.bone.parent;t&&r.add(t);for(let e=0;e{t(i)})}function Gd(r,t){r.children.forEach(e=>{t(e)||Gd(e,t)})}function iR(r){var t;const e=new Map;for(const n of r){let i=n;do{const s=((t=e.get(i))!=null?t:0)+1;if(s===r.size)return i;e.set(i,s),i=i.parent}while(i!==null)}return null}var Ug=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(t=>{t.colliderGroups.forEach(e=>{r.add(e)})}),Array.from(r)}get colliders(){const r=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(e=>{r.add(e)})}),Array.from(r)}addJoint(r){this._joints.add(r);let t=this._objectSpringBonesMap.get(r.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(r.bone,t)),t.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 o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(r,t,e,n,i){if(e.has(r))return;if(t.has(r)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}t.add(r);const s=r.dependencies;for(const o of s){let a=!1,l=null;nR(o,u=>{const c=this._objectSpringBonesMap.get(u);if(c)for(const h of c)a=!0,this._insertJointSort(h,t,e,n,i);else a||(l=u)}),l&&i.add(l)}n.push(r),e.add(r)}_relevantChildrenUpdated(r){var t,e;return((e=(t=this._objectSpringBonesMap.get(r))==null?void 0:t.size)!=null?e:0)>0?!0:(r.updateWorldMatrix(!1,!1),!1)}},kg="VRMC_springBone_extended_collider",sR=new Set(["1.0","1.0-beta"]),oR=new Set(["1.0"]),Cb=class Qs{get name(){return Qs.EXTENSION_NAME}constructor(t,e){var n;this.parser=t,this.jointHelperRoot=e==null?void 0:e.jointHelperRoot,this.colliderHelperRoot=e==null?void 0:e.colliderHelperRoot,this.useExtendedColliders=(n=e==null?void 0:e.useExtendedColliders)!=null?n:!0}afterRoot(t){return Rl(this,null,function*(){t.userData.vrmSpringBoneManager=yield this._import(t)})}_import(t){return Rl(this,null,function*(){const e=yield this._v1Import(t);if(e!=null)return e;const n=yield this._v0Import(t);return n??null})}_v1Import(t){return Rl(this,null,function*(){var e,n,i,s,o;const a=t.parser.json;if(!(((e=a.extensionsUsed)==null?void 0:e.indexOf(Qs.EXTENSION_NAME))!==-1))return null;const u=new Ug,c=yield t.parser.getDependencies("node"),h=(n=a.extensions)==null?void 0:n[Qs.EXTENSION_NAME];if(!h)return null;const f=h.specVersion;if(!sR.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Qs.EXTENSION_NAME} specVersion "${f}"`),null;const d=(i=h.colliders)==null?void 0:i.map((g,p)=>{var y,_,S,T,v,E,w,B,L,$,it,I,Z,x,nt;const P=c[g.node];if(P==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${p} attempted to use the node #${g.node} but not found`),null;const C=g.shape,R=(y=g.extensions)==null?void 0:y[kg];if(this.useExtendedColliders&&R!=null){const z=R.specVersion;if(!oR.has(z))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${kg} specVersion "${z}". Fallbacking to the ${Qs.EXTENSION_NAME} definition`);else{const U=R.shape;if(U.sphere)return this._importSphereCollider(P,{offset:new mt().fromArray((_=U.sphere.offset)!=null?_:[0,0,0]),radius:(S=U.sphere.radius)!=null?S:0,inside:(T=U.sphere.inside)!=null?T:!1});if(U.capsule)return this._importCapsuleCollider(P,{offset:new mt().fromArray((v=U.capsule.offset)!=null?v:[0,0,0]),radius:(E=U.capsule.radius)!=null?E:0,tail:new mt().fromArray((w=U.capsule.tail)!=null?w:[0,0,0]),inside:(B=U.capsule.inside)!=null?B:!1});if(U.plane)return this._importPlaneCollider(P,{offset:new mt().fromArray((L=U.plane.offset)!=null?L:[0,0,0]),normal:new mt().fromArray(($=U.plane.normal)!=null?$:[0,0,1])})}}if(C.sphere)return this._importSphereCollider(P,{offset:new mt().fromArray((it=C.sphere.offset)!=null?it:[0,0,0]),radius:(I=C.sphere.radius)!=null?I:0,inside:!1});if(C.capsule)return this._importCapsuleCollider(P,{offset:new mt().fromArray((Z=C.capsule.offset)!=null?Z:[0,0,0]),radius:(x=C.capsule.radius)!=null?x:0,tail:new mt().fromArray((nt=C.capsule.tail)!=null?nt:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${p} has no valid shape`)}),m=(s=h.colliderGroups)==null?void 0:s.map((g,p)=>{var y;return{colliders:((y=g.colliders)!=null?y:[]).flatMap(S=>{const T=d==null?void 0:d[S];return T??(console.warn(`VRMSpringBoneLoaderPlugin: The colliderGroup #${p} attempted to use a collider #${S} but not found`),[])}),name:g.name}});return(o=h.springs)==null||o.forEach((g,p)=>{var y;const _=g.joints,S=(y=g.colliderGroups)==null?void 0:y.map(E=>{const w=m==null?void 0:m[E];if(w==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${E} but not found`);return w}),T=g.center!=null?c[g.center]:void 0;let v;_.forEach(E=>{if(v){const w=v.node,B=c[w],L=E.node,$=c[L],it={hitRadius:v.hitRadius,dragForce:v.dragForce,gravityPower:v.gravityPower,stiffness:v.stiffness,gravityDir:v.gravityDir!=null?new mt().fromArray(v.gravityDir):void 0},I=this._importJoint(B,$,it,S);T&&(I.center=T),u.addJoint(I)}v=E})}),u.setInitState(),u})}_v0Import(t){return Rl(this,null,function*(){var e,n,i;const s=t.parser.json;if(!(((e=s.extensionsUsed)==null?void 0:e.indexOf("VRM"))!==-1))return null;const a=(n=s.extensions)==null?void 0:n.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const u=l==null?void 0:l.boneGroups;if(!u)return null;const c=new Ug,h=yield t.parser.getDependencies("node"),f=(i=l.colliderGroups)==null?void 0:i.map(d=>{var m;const g=h[d.node];return{colliders:((m=d.colliders)!=null?m:[]).map((y,_)=>{var S,T,v;const E=new mt(0,0,0);return y.offset&&E.set((S=y.offset.x)!=null?S:0,(T=y.offset.y)!=null?T:0,y.offset.z?-y.offset.z:0),this._importSphereCollider(g,{offset:E,radius:(v=y.radius)!=null?v:0,inside:!1})})}});return u==null||u.forEach((d,m)=>{const g=d.bones;g&&g.forEach(p=>{var y,_,S,T;const v=h[p],E=new mt;d.gravityDir?E.set((y=d.gravityDir.x)!=null?y:0,(_=d.gravityDir.y)!=null?_:0,(S=d.gravityDir.z)!=null?S:0):E.set(0,-1,0);const w=d.center!=null?h[d.center]:void 0,B={hitRadius:d.hitRadius,dragForce:d.dragForce,gravityPower:d.gravityPower,stiffness:d.stiffiness,gravityDir:E},L=(T=d.colliderGroups)==null?void 0:T.map($=>{const it=f==null?void 0:f[$];if(it==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${m} attempted to use a colliderGroup ${$} but not found`);return it});v.traverse($=>{var it;const I=(it=$.children[0])!=null?it:null,Z=this._importJoint($,I,B,L);w&&(Z.center=w),c.addJoint(Z)})})}),t.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(t,e,n,i){const s=new rR(t,e,n,i);if(this.jointHelperRoot){const o=new QP(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(t,e){const n=new Mb(e),i=new _h(n);if(t.add(i),this.colliderHelperRoot){const s=new vh(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(t,e){const n=new Eb(e),i=new _h(n);if(t.add(i),this.colliderHelperRoot){const s=new vh(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(t,e){const n=new Ab(e),i=new _h(n);if(t.add(i),this.colliderHelperRoot){const s=new vh(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};Cb.EXTENSION_NAME="VRMC_springBone";var aR=Cb,s3=class{get name(){return"VRMLoaderPlugin"}constructor(r,t){var e,n,i,s,o,a,l,u,c,h;this.parser=r;const f=t==null?void 0:t.helperRoot,d=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(e=t==null?void 0:t.expressionPlugin)!=null?e:new TO(r),this.firstPersonPlugin=(n=t==null?void 0:t.firstPersonPlugin)!=null?n:new EO(r),this.humanoidPlugin=(i=t==null?void 0:t.humanoidPlugin)!=null?i:new FO(r,{helperRoot:f,autoUpdateHumanBones:d}),this.lookAtPlugin=(s=t==null?void 0:t.lookAtPlugin)!=null?s:new YO(r,{helperRoot:f}),this.metaPlugin=(o=t==null?void 0:t.metaPlugin)!=null?o:new ZO(r),this.mtoonMaterialPlugin=(a=t==null?void 0:t.mtoonMaterialPlugin)!=null?a:new dP(r),this.materialsHDREmissiveMultiplierPlugin=(l=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!=null?l:new pP(r),this.materialsV0CompatPlugin=(u=t==null?void 0:t.materialsV0CompatPlugin)!=null?u:new wP(r),this.springBonePlugin=(c=t==null?void 0:t.springBonePlugin)!=null?c:new aR(r,{colliderHelperRoot:f,jointHelperRoot:f}),this.nodeConstraintPlugin=(h=t==null?void 0:t.nodeConstraintPlugin)!=null?h:new jP(r,{helperRoot:f})}beforeRoot(){return Cl(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(r){return Cl(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(r)})}getMaterialType(r){const t=this.mtoonMaterialPlugin.getMaterialType(r);return t??null}extendMaterialParams(r,t){return Cl(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(r,t),yield this.mtoonMaterialPlugin.extendMaterialParams(r,t)})}afterRoot(r){return Cl(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 t=r.userData.vrmMeta,e=r.userData.vrmHumanoid;if(t&&e){const n=new JO({scene:r.scene,expressionManager:r.userData.vrmExpressionManager,firstPerson:r.userData.vrmFirstPerson,humanoid:e,lookAt:r.userData.vrmLookAt,meta:t,materials:r.userData.vrmMToonMaterials,springBoneManager:r.userData.vrmSpringBoneManager,nodeConstraintManager:r.userData.vrmNodeConstraintManager});r.userData.vrm=n}})}};function lR(r){const t=new Set;return r.traverse(e=>{if(!e.isMesh)return;const n=e;t.add(n)}),t}function zg(r,t,e){if(t.size===1){const o=t.values().next().value;if(o.weight===1)return r[o.index]}const n=new Float32Array(r[0].count*3);let i=0;if(e)i=1;else for(const o of t)i+=o.weight;for(const o of t){const a=r[o.index],l=o.weight/i;for(let u=0;uc.getOrCreate(L)).join(","),w=`${T};${y};${E}`;let B=a.get(w);B==null&&(B=S.clone(),mR(B,v,m),a.set(w,B)),_.geometry.setAttribute("skinIndex",B)}for(const _ of d)_.bind(p,new Wn)}}function hR(r){const t=new Set;return r.traverse(e=>{if(!e.isSkinnedMesh)return;const n=e;t.add(n)}),t}function dR(r,t){const e=new Set;for(let n=0;ne)return!1;return!0}var wh=class{constructor(){this._objectIndexMap=new Map,this._index=0}get(r){return this._objectIndexMap.get(r)}getOrCreate(r){let t=this._objectIndexMap.get(r);return t==null&&(t=this._index,this._objectIndexMap.set(r,t),this._index++),t}};function yR(r){var t,e,n,i;const s=new hi;s.name=r.name,s.setIndex(r.index);for(const[o,a]of Object.entries(r.attributes))s.setAttribute(o,a);for(const[o,a]of Object.entries(r.morphAttributes))s.morphAttributes[o]=a.concat();s.morphTargetsRelative=r.morphTargetsRelative,s.groups=[];for(const o of r.groups)s.addGroup(o.start,o.count,o.materialIndex);return s.boundingSphere=(e=(t=r.boundingSphere)==null?void 0:t.clone())!=null?e:null,s.boundingBox=(i=(n=r.boundingBox)==null?void 0:n.clone())!=null?i:null,s.drawRange.start=r.drawRange.start,s.drawRange.count=r.drawRange.count,s.userData=r.userData,s}function Vg(r){if(Object.values(r).forEach(t=>{t!=null&&t.isTexture&&t.dispose()}),r.isShaderMaterial){const t=r.uniforms;t&&Object.values(t).forEach(e=>{const n=e.value;n!=null&&n.isTexture&&n.dispose()})}r.dispose()}function vR(r){const t=r.geometry;t&&t.dispose();const e=r.skeleton;e&&e.dispose();const n=r.material;n&&(Array.isArray(n)?n.forEach(i=>Vg(i)):n&&Vg(n))}function _R(r){r.traverse(vR)}function bR(r,t){var e,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=(e=t==null?void 0:t.experimentalSameBoneCounts)!=null?e:!1,s=[];r.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const c=l.geometry.getAttribute("skinIndex");if(o.has(c))continue;const h=new Map,f=new Map;for(let d=0;d{var n,i,s,o;if(!e.isMesh)return;const a=e,l=a.geometry,u=l.index;if(u==null)return;const c=t.get(l);if(c!=null){a.geometry=c;return}const h=Object.values(l.attributes)[0].count,f=new Array(h);let d=0;const m=u.array;for(let T=0;T{_.addGroup(T.start,T.count,T.materialIndex)}),_.boundingBox=(i=(n=l.boundingBox)==null?void 0:n.clone())!=null?i:null,_.boundingSphere=(o=(s=l.boundingSphere)==null?void 0:s.clone())!=null?o:null,_.setDrawRange(l.drawRange.start,l.drawRange.count),_.userData=l.userData,t.set(l,_);{const T=u.array,v=new T.constructor(T.length);for(let E=0;E{const v=l.attributes[T];if(v.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const E=v.array,{itemSize:w,normalized:B}=v,L=new E.constructor(p.length*w);p.forEach(($,it)=>{for(let I=0;I{_.morphAttributes[T]=[];const v=l.morphAttributes[T];for(let E=0;E{for(let x=0;xI===0),_.morphAttributes[T][E]=new nr(it,L,$)}}),S&&(_.morphAttributes={}),a.geometry=_}),Array.from(t.keys()).forEach(e=>{e.dispose()})}function xR(r){var t;((t=r.meta)==null?void 0:t.metaVersion)==="0"&&(r.scene.rotation.y=Math.PI)}var Bo=class{constructor(){}};Bo.combineMorphs=uR;Bo.combineSkeletons=cR;Bo.deepDispose=_R;Bo.removeUnnecessaryJoints=bR;Bo.removeUnnecessaryVertices=wR;Bo.rotateVRM0=xR;/*! + * @pixiv/three-vrm-core v3.4.0 * The implementation of core features of VRM, for @pixiv/three-vrm * * Copyright (c) 2019-2025 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.6 + * @pixiv/three-vrm-materials-mtoon v3.4.0 * MToon (toon material) module for @pixiv/three-vrm * * Copyright (c) 2019-2025 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.6 + * @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.4.0 * Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm * * Copyright (c) 2019-2025 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.6 + * @pixiv/three-vrm-materials-v0compat v3.4.0 * VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm * * Copyright (c) 2019-2025 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.6 + * @pixiv/three-vrm-node-constraint v3.4.0 * Node constraint module for @pixiv/three-vrm * * Copyright (c) 2019-2025 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.6 + * @pixiv/three-vrm-springbone v3.4.0 * Spring bone module for @pixiv/three-vrm * * Copyright (c) 2019-2025 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE *//*! - * @pixiv/three-vrm-animation v3.3.6 + * @pixiv/three-vrm-animation v3.4.0 * The implementation of VRM Animation * * Copyright (c) 2019-2025 pixiv Inc. * @pixiv/three-vrm-animation is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */var jg=(r,t,e)=>new Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),xR={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 qr;new co;new mt;new mt;var $g={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 SR(r){return r.invert?r.invert():r.inverse(),r}new mt;new mt;new mt;new mt;new mt;new mt(0,1,0);var TR=new mt,IR=new mt;function ER(r,t){return r.matrixWorld.decompose(TR,t,IR),t}function xh(r){return[Math.atan2(-r.z,r.x),Math.atan2(r.y,Math.sqrt(r.x*r.x+r.z*r.z))]}function Gg(r){const t=Math.round(r/2/Math.PI);return r-2*Math.PI*t}var Wg=new mt(0,0,1),AR=new mt,MR=new mt,CR=new mt,OR=new ne,Sh=new ne,Hg=new ne,PR=new ne,Th=new Ps,Ob=class Pb{constructor(t,e){this.offsetFromHeadBone=new mt,this.autoUpdate=!0,this.faceFront=new mt(0,0,1),this.humanoid=t,this.applier=e,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new ne)}get yaw(){return this._yaw}set yaw(t){this._yaw=t,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(t){this._pitch=t,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new Ps)}getEuler(t){return t.set(Fe.DEG2RAD*this._pitch,Fe.DEG2RAD*this._yaw,0,"YXZ")}copy(t){if(this.humanoid!==t.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(t.offsetFromHeadBone),this.applier=t.applier,this.autoUpdate=t.autoUpdate,this.target=t.target,this.faceFront.copy(t.faceFront),this}clone(){return new Pb(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(t){const e=this.humanoid.getRawBoneNode("head");return t.copy(this.offsetFromHeadBone).applyMatrix4(e.matrixWorld)}getLookAtWorldQuaternion(t){const e=this.humanoid.getRawBoneNode("head");return ER(e,t)}getFaceFrontQuaternion(t){if(this.faceFront.distanceToSquared(Wg)<.01)return t.copy(this._restHeadWorldQuaternion).invert();const[e,n]=xh(this.faceFront);return Th.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Th).premultiply(PR.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(t){return this.getLookAtWorldQuaternion(Sh),this.getFaceFrontQuaternion(Hg),t.copy(Wg).applyQuaternion(Sh).applyQuaternion(Hg).applyEuler(this.getEuler(Th))}lookAt(t){const e=OR.copy(this._restHeadWorldQuaternion).multiply(SR(this.getLookAtWorldQuaternion(Sh))),n=this.getLookAtWorldPosition(MR),i=CR.copy(t).sub(n).applyQuaternion(e).normalize(),[s,o]=xh(this.faceFront),[a,l]=xh(i),u=Gg(a-s),c=Gg(o-l);this._yaw=Fe.RAD2DEG*u,this._pitch=Fe.RAD2DEG*c,this._needsUpdate=!0}update(t){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(AR)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};Ob.EULER_ORDER="YXZ";var RR=Ob;new mt(0,0,1);new Ps(0,0,0,"YXZ");var Xg=180/Math.PI,Ih=new Ps,Yg=class extends Ca{constructor(r){super(),this.vrmLookAt=r,this.type="VRMLookAtQuaternionProxy";const t=this.rotation._onChangeCallback;this.rotation._onChange(()=>{t(),this._applyToLookAt()});const e=this.quaternion._onChangeCallback;this.quaternion._onChange(()=>{e(),this._applyToLookAt()})}_applyToLookAt(){Ih.setFromQuaternion(this.quaternion,RR.EULER_ORDER),this.vrmLookAt.yaw=Xg*Ih.y,this.vrmLookAt.pitch=Xg*Ih.x}};function FR(r,t,e){var n,i;const s=new Map,o=new Map;for(const[a,l]of r.humanoidTracks.rotation.entries()){const u=(n=t.getNormalizedBoneNode(a))==null?void 0:n.name;if(u!=null){const c=new A1(`${u}.quaternion`,l.times,l.values.map((h,f)=>e==="0"&&f%2===0?-h:h));o.set(a,c)}}for(const[a,l]of r.humanoidTracks.translation.entries()){const u=(i=t.getNormalizedBoneNode(a))==null?void 0:i.name;if(u!=null){const c=r.restHipsPosition.y,f=t.normalizedRestPose.hips.position[1]/c,d=l.clone();d.values=d.values.map((m,g)=>(e==="0"&&g%3!==1?-m:m)*f),d.name=`${u}.position`,s.set(a,d)}}return{translation:s,rotation:o}}function DR(r,t){const e=new Map,n=new Map;for(const[i,s]of r.expressionTracks.preset.entries()){const o=t.getExpressionTrackName(i);if(o!=null){const a=s.clone();a.name=o,e.set(i,a)}}for(const[i,s]of r.expressionTracks.custom.entries()){const o=t.getExpressionTrackName(i);if(o!=null){const a=s.clone();a.name=o,n.set(i,a)}}return{preset:e,custom:n}}function LR(r,t){if(r.lookAtTrack==null)return null;const e=r.lookAtTrack.clone();return e.name=t,e}function s3(r,t){const e=[],n=FR(r,t.humanoid,t.meta.metaVersion);if(e.push(...n.translation.values()),e.push(...n.rotation.values()),t.expressionManager!=null){const i=DR(r,t.expressionManager);e.push(...i.preset.values()),e.push(...i.custom.values())}if(t.lookAt!=null){let i=t.scene.children.find(o=>o instanceof Yg);i==null?(console.warn("createVRMAnimationClip: VRMLookAtQuaternionProxy is not found. Creating a new one automatically. To suppress this warning, create a VRMLookAtQuaternionProxy manually"),i=new Yg(t.lookAt),i.name="VRMLookAtQuaternionProxy",t.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 s=LR(r,`${i.name}.quaternion`);s!=null&&e.push(s)}return new I1("Clip",r.duration,e)}var NR=class{constructor(){this.duration=0,this.restHipsPosition=new mt,this.humanoidTracks={translation:new Map,rotation:new Map},this.expressionTracks={preset:new Map,custom:new Map},this.lookAtTrack=null}};function qg(r,t){const e=r.length,n=[];let i=[],s=0;for(let o=0;o{const y=i.animations[p],_=this._parseAnimation(g,y,l,u);return _.restHipsPosition=f,_});r.userData.vrmAnimations=m})}_createNodeMap(r){var t,e,n,i,s;const o=new Map,a=new Map,l=(t=r.humanoid)==null?void 0:t.humanBones;l&&Object.entries(l).forEach(([f,d])=>{const m=d==null?void 0:d.node;m!=null&&o.set(m,f)});const u=(e=r.expressions)==null?void 0:e.preset;u&&Object.entries(u).forEach(([f,d])=>{const m=d==null?void 0:d.node;m!=null&&a.set(m,f)});const c=(n=r.expressions)==null?void 0:n.custom;c&&Object.entries(c).forEach(([f,d])=>{const{node:m}=d;a.set(m,f)});const h=(s=(i=r.lookAt)==null?void 0:i.node)!=null?s:null;return{humanoidIndexToName:o,expressionsIndexToName:a,lookAtIndex:h}}_createBoneWorldMatrixMap(r,t){return jg(this,null,function*(){var e,n;r.scene.updateWorldMatrix(!1,!0);const i=yield r.parser.getDependencies("node"),s=new Map;if(t.humanoid==null)return s;for(const[o,a]of Object.entries(t.humanoid.humanBones)){const l=a==null?void 0:a.node;if(l!=null){const u=i[l];s.set(o,u.matrixWorld),o==="hips"&&s.set("hipsParent",(n=(e=u.parent)==null?void 0:e.matrixWorld)!=null?n:BR)}}return s})}_parseAnimation(r,t,e,n){const i=r.tracks,s=t.channels,o=new NR;return o.duration=r.duration,s.forEach((a,l)=>{const{node:u,path:c}=a.target,h=i[l];if(u==null)return;const f=e.humanoidIndexToName.get(u);if(f!=null){let m=$g[f];for(;m!=null&&n.get(m)==null;)m=$g[m];if(m==null&&(m="hipsParent"),c==="translation")if(f!=="hips")console.warn(`The loading animation contains a translation track for ${f}, which is not permitted in the VRMC_vrm_animation spec. ignoring the track`);else{const g=n.get("hipsParent"),p=qg(h.values,3).flatMap(_=>na.fromArray(_).applyMatrix4(g).toArray()),y=h.clone();y.values=new Float32Array(p),o.humanoidTracks.translation.set(f,y)}else if(c==="rotation"){const g=n.get(f),p=n.get(m);g.decompose(na,Eh,na),Eh.invert(),p.decompose(na,Qg,na);const y=qg(h.values,4).flatMap(S=>UR.fromArray(S).premultiply(Qg).multiply(Eh).toArray()),_=h.clone();_.values=new Float32Array(y),o.humanoidTracks.rotation.set(f,_)}else throw new Error(`Invalid path "${c}"`);return}const d=e.expressionsIndexToName.get(u);if(d!=null){if(c==="translation"){const m=h.times,g=new Float32Array(h.values.length/3);for(let y=0;ynew Promise((n,i)=>{var s=l=>{try{a(e.next(l))}catch(u){i(u)}},o=l=>{try{a(e.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((e=e.apply(r,t)).next())}),SR={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 qr;new co;new mt;new mt;var $g={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 TR(r){return r.invert?r.invert():r.inverse(),r}new mt;new mt;new mt;new mt;new mt;new mt(0,1,0);var IR=new mt,ER=new mt;function AR(r,t){return r.matrixWorld.decompose(IR,t,ER),t}function xh(r){return[Math.atan2(-r.z,r.x),Math.atan2(r.y,Math.sqrt(r.x*r.x+r.z*r.z))]}function Gg(r){const t=Math.round(r/2/Math.PI);return r-2*Math.PI*t}var Wg=new mt(0,0,1),MR=new mt,CR=new mt,OR=new mt,PR=new ne,Sh=new ne,Hg=new ne,RR=new ne,Th=new Ps,Ob=class Pb{constructor(t,e){this.offsetFromHeadBone=new mt,this.autoUpdate=!0,this.faceFront=new mt(0,0,1),this.humanoid=t,this.applier=e,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new ne)}get yaw(){return this._yaw}set yaw(t){this._yaw=t,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(t){this._pitch=t,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new Ps)}getEuler(t){return t.set(Fe.DEG2RAD*this._pitch,Fe.DEG2RAD*this._yaw,0,"YXZ")}copy(t){if(this.humanoid!==t.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(t.offsetFromHeadBone),this.applier=t.applier,this.autoUpdate=t.autoUpdate,this.target=t.target,this.faceFront.copy(t.faceFront),this}clone(){return new Pb(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(t){const e=this.humanoid.getRawBoneNode("head");return t.copy(this.offsetFromHeadBone).applyMatrix4(e.matrixWorld)}getLookAtWorldQuaternion(t){const e=this.humanoid.getRawBoneNode("head");return AR(e,t)}getFaceFrontQuaternion(t){if(this.faceFront.distanceToSquared(Wg)<.01)return t.copy(this._restHeadWorldQuaternion).invert();const[e,n]=xh(this.faceFront);return Th.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Th).premultiply(RR.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(t){return this.getLookAtWorldQuaternion(Sh),this.getFaceFrontQuaternion(Hg),t.copy(Wg).applyQuaternion(Sh).applyQuaternion(Hg).applyEuler(this.getEuler(Th))}lookAt(t){const e=PR.copy(this._restHeadWorldQuaternion).multiply(TR(this.getLookAtWorldQuaternion(Sh))),n=this.getLookAtWorldPosition(CR),i=OR.copy(t).sub(n).applyQuaternion(e).normalize(),[s,o]=xh(this.faceFront),[a,l]=xh(i),u=Gg(a-s),c=Gg(o-l);this._yaw=Fe.RAD2DEG*u,this._pitch=Fe.RAD2DEG*c,this._needsUpdate=!0}update(t){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(MR)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};Ob.EULER_ORDER="YXZ";var FR=Ob;new mt(0,0,1);new Ps(0,0,0,"YXZ");var Xg=180/Math.PI,Ih=new Ps,Yg=class extends Ca{constructor(r){super(),this.vrmLookAt=r,this.type="VRMLookAtQuaternionProxy";const t=this.rotation._onChangeCallback;this.rotation._onChange(()=>{t(),this._applyToLookAt()});const e=this.quaternion._onChangeCallback;this.quaternion._onChange(()=>{e(),this._applyToLookAt()})}_applyToLookAt(){Ih.setFromQuaternion(this.quaternion,FR.EULER_ORDER),this.vrmLookAt.yaw=Xg*Ih.y,this.vrmLookAt.pitch=Xg*Ih.x}};function DR(r,t,e){var n,i;const s=new Map,o=new Map;for(const[a,l]of r.humanoidTracks.rotation.entries()){const u=(n=t.getNormalizedBoneNode(a))==null?void 0:n.name;if(u!=null){const c=new A1(`${u}.quaternion`,l.times,l.values.map((h,f)=>e==="0"&&f%2===0?-h:h));o.set(a,c)}}for(const[a,l]of r.humanoidTracks.translation.entries()){const u=(i=t.getNormalizedBoneNode(a))==null?void 0:i.name;if(u!=null){const c=r.restHipsPosition.y,f=t.normalizedRestPose.hips.position[1]/c,d=l.clone();d.values=d.values.map((m,g)=>(e==="0"&&g%3!==1?-m:m)*f),d.name=`${u}.position`,s.set(a,d)}}return{translation:s,rotation:o}}function LR(r,t){const e=new Map,n=new Map;for(const[i,s]of r.expressionTracks.preset.entries()){const o=t.getExpressionTrackName(i);if(o!=null){const a=s.clone();a.name=o,e.set(i,a)}}for(const[i,s]of r.expressionTracks.custom.entries()){const o=t.getExpressionTrackName(i);if(o!=null){const a=s.clone();a.name=o,n.set(i,a)}}return{preset:e,custom:n}}function NR(r,t){if(r.lookAtTrack==null)return null;const e=r.lookAtTrack.clone();return e.name=t,e}function o3(r,t){const e=[],n=DR(r,t.humanoid,t.meta.metaVersion);if(e.push(...n.translation.values()),e.push(...n.rotation.values()),t.expressionManager!=null){const i=LR(r,t.expressionManager);e.push(...i.preset.values()),e.push(...i.custom.values())}if(t.lookAt!=null){let i=t.scene.children.find(o=>o instanceof Yg);i==null?(console.warn("createVRMAnimationClip: VRMLookAtQuaternionProxy is not found. Creating a new one automatically. To suppress this warning, create a VRMLookAtQuaternionProxy manually"),i=new Yg(t.lookAt),i.name="VRMLookAtQuaternionProxy",t.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 s=NR(r,`${i.name}.quaternion`);s!=null&&e.push(s)}return new I1("Clip",r.duration,e)}var BR=class{constructor(){this.duration=0,this.restHipsPosition=new mt,this.humanoidTracks={translation:new Map,rotation:new Map},this.expressionTracks={preset:new Map,custom:new Map},this.lookAtTrack=null}};function qg(r,t){const e=r.length,n=[];let i=[],s=0;for(let o=0;o{const y=i.animations[p],_=this._parseAnimation(g,y,l,u);return _.restHipsPosition=f,_});r.userData.vrmAnimations=m})}_createNodeMap(r){var t,e,n,i,s;const o=new Map,a=new Map,l=(t=r.humanoid)==null?void 0:t.humanBones;l&&Object.entries(l).forEach(([f,d])=>{const m=d==null?void 0:d.node;m!=null&&o.set(m,f)});const u=(e=r.expressions)==null?void 0:e.preset;u&&Object.entries(u).forEach(([f,d])=>{const m=d==null?void 0:d.node;m!=null&&a.set(m,f)});const c=(n=r.expressions)==null?void 0:n.custom;c&&Object.entries(c).forEach(([f,d])=>{const{node:m}=d;a.set(m,f)});const h=(s=(i=r.lookAt)==null?void 0:i.node)!=null?s:null;return{humanoidIndexToName:o,expressionsIndexToName:a,lookAtIndex:h}}_createBoneWorldMatrixMap(r,t){return jg(this,null,function*(){var e,n;r.scene.updateWorldMatrix(!1,!0);const i=yield r.parser.getDependencies("node"),s=new Map;if(t.humanoid==null)return s;for(const[o,a]of Object.entries(t.humanoid.humanBones)){const l=a==null?void 0:a.node;if(l!=null){const u=i[l];s.set(o,u.matrixWorld),o==="hips"&&s.set("hipsParent",(n=(e=u.parent)==null?void 0:e.matrixWorld)!=null?n:UR)}}return s})}_parseAnimation(r,t,e,n){const i=r.tracks,s=t.channels,o=new BR;return o.duration=r.duration,s.forEach((a,l)=>{const{node:u,path:c}=a.target,h=i[l];if(u==null)return;const f=e.humanoidIndexToName.get(u);if(f!=null){let m=$g[f];for(;m!=null&&n.get(m)==null;)m=$g[m];if(m==null&&(m="hipsParent"),c==="translation")if(f!=="hips")console.warn(`The loading animation contains a translation track for ${f}, which is not permitted in the VRMC_vrm_animation spec. ignoring the track`);else{const g=n.get("hipsParent"),p=qg(h.values,3).flatMap(_=>na.fromArray(_).applyMatrix4(g).toArray()),y=h.clone();y.values=new Float32Array(p),o.humanoidTracks.translation.set(f,y)}else if(c==="rotation"){const g=n.get(f),p=n.get(m);g.decompose(na,Eh,na),Eh.invert(),p.decompose(na,Qg,na);const y=qg(h.values,4).flatMap(S=>kR.fromArray(S).premultiply(Qg).multiply(Eh).toArray()),_=h.clone();_.values=new Float32Array(y),o.humanoidTracks.rotation.set(f,_)}else throw new Error(`Invalid path "${c}"`);return}const d=e.expressionsIndexToName.get(u);if(d!=null){if(c==="translation"){const m=h.times,g=new Float32Array(h.values.length/3);for(let y=0;y=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rt(r){return this instanceof Rt?(this.v=r,this):new Rt(r)}function br(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(d){return function(m){return Promise.resolve(m).then(d,h)}}function a(d,m){n[d]&&(i[d]=function(g){return new Promise(function(p,y){s.push([d,g,p,y])>1||l(d,g)})},m&&(i[d]=m(i[d])))}function l(d,m){try{u(n[d](m))}catch(g){f(s[0][3],g)}}function u(d){d.value instanceof Rt?Promise.resolve(d.value.v).then(c,h):f(s[0][2],d)}function c(d){l("next",d)}function h(d){l("throw",d)}function f(d,m){d(m),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Ss(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=r[i]?function(o){return(e=!e)?{value:Rt(r[i](o)),done:!1}:s?s(o):o}:s}}function Bn(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Zg=="function"?Zg(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,l){o=r[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(u){s({value:u,done:a})},o)}}const VR=new TextDecoder("utf-8"),Wd=r=>VR.decode(r),jR=new TextEncoder,Zf=r=>jR.encode(r),$R=r=>typeof r=="number",Rb=r=>typeof r=="boolean",Ye=r=>typeof r=="function",wr=r=>r!=null&&Object(r)===r,Is=r=>wr(r)&&Ye(r.then),Qa=r=>wr(r)&&Ye(r[Symbol.iterator]),Uo=r=>wr(r)&&Ye(r[Symbol.asyncIterator]),Hd=r=>wr(r)&&wr(r.schema),Fb=r=>wr(r)&&"done"in r&&"value"in r,Db=r=>wr(r)&&Ye(r.stat)&&$R(r.fd),Lb=r=>wr(r)&&Kf(r.body),oc=r=>"_getDOMStream"in r&&"_getNodeStream"in r,GR=r=>wr(r)&&Ye(r.abort)&&Ye(r.getWriter)&&!oc(r),Kf=r=>wr(r)&&Ye(r.cancel)&&Ye(r.getReader)&&!oc(r),WR=r=>wr(r)&&Ye(r.end)&&Ye(r.write)&&Rb(r.writable)&&!oc(r),Nb=r=>wr(r)&&Ye(r.read)&&Ye(r.pipe)&&Rb(r.readable)&&!oc(r),HR=r=>wr(r)&&Ye(r.clear)&&Ye(r.bytes)&&Ye(r.position)&&Ye(r.setPosition)&&Ye(r.capacity)&&Ye(r.getBufferIdentifier)&&Ye(r.createLong),Jf=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function XR(r){const t=r[0]?[r[0]]:[];let e,n,i,s;for(let o,a,l=0,u=0,c=r.length;++lc+h.byteLength,0);let i,s,o,a=0,l=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,n);for(const c=e.length;++lxe(Int32Array,r),Jg=r=>xe(BigInt64Array,r),ce=r=>xe(Uint8Array,r),Xd=r=>(r.next(),r);function*YR(r,t){const e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Jf?e(t):Qa(t)?t:e(t);return yield*Xd(function*(i){let s=null;do s=i.next(yield xe(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}const qR=r=>YR(Uint8Array,r);function Bb(r,t){return br(this,arguments,function*(){if(Is(t))return yield Rt(yield Rt(yield*Ss(Bn(Bb(r,yield Rt(t))))));const n=function(o){return br(this,arguments,function*(){yield yield Rt(yield Rt(o))})},i=function(o){return br(this,arguments,function*(){yield Rt(yield*Ss(Bn(Xd(function*(a){let l=null;do l=a.next(yield l==null?void 0:l.value);while(!l.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Jf?n(t):Qa(t)?i(t):Uo(t)?t:n(t);return yield Rt(yield*Ss(Bn(Xd(function(o){return br(this,arguments,function*(){let a=null;do a=yield Rt(o.next(yield yield Rt(xe(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield Rt(new r)})}const QR=r=>Bb(Uint8Array,r);function Ub(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n0)do if(r[e]!==t[e])return!1;while(++e(r.next(),r);function*KR(r){let t,e=!1,n=[],i,s,o,a=0;function l(){return s==="peek"?kn(n,o)[0]:([i,n,a]=kn(n,o),i)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});const u=qR(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?u.next():u.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield l());while(o0&&(i.push(s),l+=s.byteLength),e||a<=l)do({cmd:o,size:a}=yield yield Rt(u()));while(a0&&(i.push(ce(s)),l+=s.byteLength),e||a<=l)do({cmd:o,size:a}=yield yield Rt(u()));while(a{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Jt(this,void 0,void 0,function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Jt(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=ce(e)),e})}}const Ah=(r,t)=>{const e=i=>n([t,i]);let n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function rF(r){return br(this,arguments,function*(){const e=[];let n="error",i=!1,s=null,o,a,l=0,u=[],c;function h(){return o==="peek"?kn(u,a)[0]:([c,u,l]=kn(u,a),c)}if({cmd:o,size:a}=(yield yield Rt(null))||{cmd:"read",size:0},r.isTTY)return yield yield Rt(new Uint8Array(0)),yield Rt(null);try{e[0]=Ah(r,"end"),e[1]=Ah(r,"error");do{if(e[2]=Ah(r,"readable"),[n,s]=yield Rt(Promise.race(e.map(d=>d[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-l)?(c=ce(r.read(a-l)),c.byteLength0&&(u.push(c),l+=c.byteLength)),i||a<=l)do({cmd:o,size:a}=yield yield Rt(h()));while(a{for(const[y,_]of d)r.off(y,_);try{const y=r.destroy;y&&y.call(r,m),m=void 0}catch(y){m=y||m}finally{m!=null?p(m):g()}})}})}var je;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(je||(je={}));var lr;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(lr||(lr={}));var ar;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(ar||(ar={}));var nn;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(nn||(nn={}));var Vt;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Vt||(Vt={}));var zn;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(zn||(zn={}));const Mh=2,Pn=4,oi=4,_e=4,Ti=new Int32Array(2),ty=new Float32Array(Ti.buffer),ey=new Float64Array(Ti.buffer),Dl=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Yd;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Yd||(Yd={}));let Mo=class kb{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new kb(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){ty[0]=e,this.writeInt32(t,Ti[0])}writeFloat64(t,e){ey[0]=e,this.writeInt32(t,Ti[Dl?0:1]),this.writeInt32(t+4,Ti[Dl?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);const n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space=0&&this.vtable[e]==0;e--);const n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const i=2;this.addInt16(t-this.object_start);const s=(n+i)*Mh;this.addInt16(s);let o=0;const a=this.space;t:for(e=0;e=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Pn+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return vr.startUnion(t),vr.addMode(t,e),vr.addTypeIds(t,n),vr.endUnion(t)}}let ly=class _a{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new _a).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+_e),(e||new _a).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return _a.startUtf8(t),_a.endUtf8(t)}};var Ee;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(Ee||(Ee={}));let Wr=class Hl{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new Hl).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+_e),(e||new Hl).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Ee.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new ai).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new Hl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,16);return n?(e||new qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,Ee.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}},In=class Zn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Zn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+_e),(e||new Zn).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Co.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Wr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Co.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return Zn.startSchema(t),Zn.addEndianness(t,e),Zn.addFields(t,n),Zn.addCustomMetadata(t,i),Zn.addFeatures(t,s),Zn.endSchema(t)}};var me;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(me||(me={}));var k;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(k||(k={}));var ni;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(ni||(ni={}));const nF=void 0;function Ba(r){if(r===null)return"null";if(r===nF)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>Ba(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}function Te(r){if(typeof r=="bigint"&&(rNumber.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Gb(r,t){return Te(r/t)+Te(r%t)/Te(t)}const iF=Symbol.for("isArrowBigNum");function pn(r,...t){return t.length===0?Object.setPrototypeOf(xe(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}pn.prototype[iF]=!0;pn.prototype.toJSON=function(){return`"${ka(this)}"`};pn.prototype.valueOf=function(r){return Wb(this,r)};pn.prototype.toString=function(){return ka(this)};pn.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Wb(this);case"string":return ka(this);case"default":return aF(this)}return ka(this)};function vo(...r){return pn.apply(this,r)}function _o(...r){return pn.apply(this,r)}function Ua(...r){return pn.apply(this,r)}Object.setPrototypeOf(vo.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(_o.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Ua.prototype,Object.create(Uint32Array.prototype));Object.assign(vo.prototype,pn.prototype,{constructor:vo,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(_o.prototype,pn.prototype,{constructor:_o,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Ua.prototype,pn.prototype,{constructor:Ua,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const sF=BigInt(4294967296)*BigInt(4294967296),oF=sF-BigInt(1);function Wb(r,t){const{buffer:e,byteOffset:n,byteLength:i,signed:s}=r,o=new BigUint64Array(e,n,i/8),a=s&&o.at(-1)&BigInt(1)<=0)return Ch(r);t=t.slice();let n=1;for(let s=0;s(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(Ot.prototype);let Ri=class extends Ot{constructor(){super(k.Null)}toString(){return"Null"}};Yb=Symbol.toStringTag;Ri[Yb]=(r=>r[Symbol.toStringTag]="Null")(Ri.prototype);let Es=class extends Ot{constructor(t,e){super(k.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};qb=Symbol.toStringTag;Es[qb]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Es.prototype);class za extends Es{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(za.prototype,"ArrayType",{value:Int32Array});let mu=class extends Ot{constructor(t){super(k.Float),this.precision=t}get ArrayType(){switch(this.precision){case ar.HALF:return Uint16Array;case ar.SINGLE:return Float32Array;case ar.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Qb=Symbol.toStringTag;mu[Qb]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(mu.prototype);let gu=class extends Ot{constructor(){super(k.Binary)}toString(){return"Binary"}};Zb=Symbol.toStringTag;gu[Zb]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(gu.prototype);let yu=class extends Ot{constructor(){super(k.LargeBinary)}toString(){return"LargeBinary"}};Kb=Symbol.toStringTag;yu[Kb]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(yu.prototype);let vu=class extends Ot{constructor(){super(k.Utf8)}toString(){return"Utf8"}};Jb=Symbol.toStringTag;vu[Jb]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(vu.prototype);let _u=class extends Ot{constructor(){super(k.LargeUtf8)}toString(){return"LargeUtf8"}};tw=Symbol.toStringTag;_u[tw]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(_u.prototype);let bu=class extends Ot{constructor(){super(k.Bool)}toString(){return"Bool"}};ew=Symbol.toStringTag;bu[ew]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(bu.prototype);let wu=class extends Ot{constructor(t,e,n=128){super(k.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};rw=Symbol.toStringTag;wu[rw]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(wu.prototype);let xu=class extends Ot{constructor(t){super(k.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${nn[this.unit]}>`}get ArrayType(){return this.unit===nn.DAY?Int32Array:BigInt64Array}};nw=Symbol.toStringTag;xu[nw]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(xu.prototype);let Su=class extends Ot{constructor(t,e){super(k.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${Vt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};iw=Symbol.toStringTag;Su[iw]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Su.prototype);let Tu=class extends Ot{constructor(t,e){super(k.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${Vt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};sw=Symbol.toStringTag;Tu[sw]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Tu.prototype);let Iu=class extends Ot{constructor(t){super(k.Interval),this.unit=t}toString(){return`Interval<${zn[this.unit]}>`}};ow=Symbol.toStringTag;Iu[ow]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Iu.prototype);let Eu=class extends Ot{constructor(t){super(k.Duration),this.unit=t}toString(){return`Duration<${Vt[this.unit]}>`}};aw=Symbol.toStringTag;Eu[aw]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Eu.prototype);let Au=class extends Ot{constructor(t){super(k.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};lw=Symbol.toStringTag;Au[lw]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Au.prototype);let dr=class extends Ot{constructor(t){super(k.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};uw=Symbol.toStringTag;dr[uw]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(dr.prototype);let Mu=class extends Ot{constructor(t,e,n){super(k.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};cw=Symbol.toStringTag;Mu[cw]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Mu.prototype);let Cu=class extends Ot{constructor(t){super(k.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};hw=Symbol.toStringTag;Cu[hw]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Cu.prototype);let Ou=class extends Ot{constructor(t,e){super(k.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};dw=Symbol.toStringTag;Ou[dw]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ou.prototype);let Pu=class extends Ot{constructor(t,e=!1){var n,i,s;if(super(k.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){const o=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};fw=Symbol.toStringTag;Pu[fw]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Pu.prototype);const uF=(r=>()=>++r)(-1);let Oo=class extends Ot{constructor(t,e,n,i){super(k.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?uF():Te(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};pw=Symbol.toStringTag;Oo[pw]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Oo.prototype);function ii(r){const t=r;switch(r.typeId){case k.Decimal:return r.bitWidth/32;case k.Interval:return 1+t.unit;case k.FixedSizeList:return t.listSize;case k.FixedSizeBinary:return t.byteWidth;default:return 1}}let se=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return cF(this,t,e)}getVisitFnByTypeId(t,e=!0){return io(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function cF(r,t,e=!0){return typeof t=="number"?io(r,t,e):typeof t=="string"&&t in k?io(r,k[t],e):t&&t instanceof Ot?io(r,uy(t),e):t!=null&&t.type&&t.type instanceof Ot?io(r,uy(t.type),e):io(r,k.NONE,e)}function io(r,t,e=!0){let n=null;switch(t){case k.Null:n=r.visitNull;break;case k.Bool:n=r.visitBool;break;case k.Int:n=r.visitInt;break;case k.Int8:n=r.visitInt8||r.visitInt;break;case k.Int16:n=r.visitInt16||r.visitInt;break;case k.Int32:n=r.visitInt32||r.visitInt;break;case k.Int64:n=r.visitInt64||r.visitInt;break;case k.Uint8:n=r.visitUint8||r.visitInt;break;case k.Uint16:n=r.visitUint16||r.visitInt;break;case k.Uint32:n=r.visitUint32||r.visitInt;break;case k.Uint64:n=r.visitUint64||r.visitInt;break;case k.Float:n=r.visitFloat;break;case k.Float16:n=r.visitFloat16||r.visitFloat;break;case k.Float32:n=r.visitFloat32||r.visitFloat;break;case k.Float64:n=r.visitFloat64||r.visitFloat;break;case k.Utf8:n=r.visitUtf8;break;case k.LargeUtf8:n=r.visitLargeUtf8;break;case k.Binary:n=r.visitBinary;break;case k.LargeBinary:n=r.visitLargeBinary;break;case k.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case k.Date:n=r.visitDate;break;case k.DateDay:n=r.visitDateDay||r.visitDate;break;case k.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case k.Timestamp:n=r.visitTimestamp;break;case k.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case k.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case k.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case k.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case k.Time:n=r.visitTime;break;case k.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case k.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case k.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case k.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case k.Decimal:n=r.visitDecimal;break;case k.List:n=r.visitList;break;case k.Struct:n=r.visitStruct;break;case k.Union:n=r.visitUnion;break;case k.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case k.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case k.Dictionary:n=r.visitDictionary;break;case k.Interval:n=r.visitInterval;break;case k.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case k.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case k.Duration:n=r.visitDuration;break;case k.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case k.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case k.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case k.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case k.FixedSizeList:n=r.visitFixedSizeList;break;case k.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${k[t]}'`)}function uy(r){switch(r.typeId){case k.Null:return k.Null;case k.Int:{const{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?k.Int8:k.Uint8;case 16:return e?k.Int16:k.Uint16;case 32:return e?k.Int32:k.Uint32;case 64:return e?k.Int64:k.Uint64}return k.Int}case k.Float:switch(r.precision){case ar.HALF:return k.Float16;case ar.SINGLE:return k.Float32;case ar.DOUBLE:return k.Float64}return k.Float;case k.Binary:return k.Binary;case k.LargeBinary:return k.LargeBinary;case k.Utf8:return k.Utf8;case k.LargeUtf8:return k.LargeUtf8;case k.Bool:return k.Bool;case k.Decimal:return k.Decimal;case k.Time:switch(r.unit){case Vt.SECOND:return k.TimeSecond;case Vt.MILLISECOND:return k.TimeMillisecond;case Vt.MICROSECOND:return k.TimeMicrosecond;case Vt.NANOSECOND:return k.TimeNanosecond}return k.Time;case k.Timestamp:switch(r.unit){case Vt.SECOND:return k.TimestampSecond;case Vt.MILLISECOND:return k.TimestampMillisecond;case Vt.MICROSECOND:return k.TimestampMicrosecond;case Vt.NANOSECOND:return k.TimestampNanosecond}return k.Timestamp;case k.Date:switch(r.unit){case nn.DAY:return k.DateDay;case nn.MILLISECOND:return k.DateMillisecond}return k.Date;case k.Interval:switch(r.unit){case zn.DAY_TIME:return k.IntervalDayTime;case zn.YEAR_MONTH:return k.IntervalYearMonth}return k.Interval;case k.Duration:switch(r.unit){case Vt.SECOND:return k.DurationSecond;case Vt.MILLISECOND:return k.DurationMillisecond;case Vt.MICROSECOND:return k.DurationMicrosecond;case Vt.NANOSECOND:return k.DurationNanosecond}return k.Duration;case k.Map:return k.Map;case k.List:return k.List;case k.Struct:return k.Struct;case k.Union:switch(r.mode){case lr.Dense:return k.DenseUnion;case lr.Sparse:return k.SparseUnion}return k.Union;case k.FixedSizeBinary:return k.FixedSizeBinary;case k.FixedSizeList:return k.FixedSizeList;case k.Dictionary:return k.Dictionary}throw new Error(`Unrecognized type '${k[r.typeId]}'`)}se.prototype.visitInt8=null;se.prototype.visitInt16=null;se.prototype.visitInt32=null;se.prototype.visitInt64=null;se.prototype.visitUint8=null;se.prototype.visitUint16=null;se.prototype.visitUint32=null;se.prototype.visitUint64=null;se.prototype.visitFloat16=null;se.prototype.visitFloat32=null;se.prototype.visitFloat64=null;se.prototype.visitDateDay=null;se.prototype.visitDateMillisecond=null;se.prototype.visitTimestampSecond=null;se.prototype.visitTimestampMillisecond=null;se.prototype.visitTimestampMicrosecond=null;se.prototype.visitTimestampNanosecond=null;se.prototype.visitTimeSecond=null;se.prototype.visitTimeMillisecond=null;se.prototype.visitTimeMicrosecond=null;se.prototype.visitTimeNanosecond=null;se.prototype.visitDenseUnion=null;se.prototype.visitSparseUnion=null;se.prototype.visitIntervalDayTime=null;se.prototype.visitIntervalYearMonth=null;se.prototype.visitDuration=null;se.prototype.visitDurationSecond=null;se.prototype.visitDurationMillisecond=null;se.prototype.visitDurationMicrosecond=null;se.prototype.visitDurationNanosecond=null;const mw=new Float64Array(1),Ws=new Uint32Array(mw.buffer);function gw(r){const t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function hF(r){if(r!==r)return 32256;mw[0]=r;const t=(Ws[1]&2147483648)>>16&65535;let e=Ws[1]&2146435072,n=0;return e>=1089470464?Ws[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Ws[1]&1048575)>>10):e<=1056964608?(n=1048576+(Ws[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Ws[1]&1048575)+512>>10),t|e|n&65535}let jt=class extends se{};function Yt(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}const dF=(r,t,e)=>{r[t]=Math.floor(e/864e5)},yw=(r,t,e,n)=>{if(e+1{const i=r+e;n?t[i>>3]|=1<>3]&=~(1<{r[t]=e},tp=({values:r},t,e)=>{r[t]=e},vw=({values:r},t,e)=>{r[t]=hF(e)},pF=(r,t,e)=>{switch(r.type.precision){case ar.HALF:return vw(r,t,e);case ar.SINGLE:case ar.DOUBLE:return tp(r,t,e)}},_w=({values:r},t,e)=>{dF(r,t,e.valueOf())},bw=({values:r},t,e)=>{r[t]=BigInt(e)},mF=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},ww=({values:r,valueOffsets:t},e,n)=>yw(r,t,e,n),xw=({values:r,valueOffsets:t},e,n)=>yw(r,t,e,Zf(n)),gF=(r,t,e)=>{r.type.unit===nn.DAY?_w(r,t,e):bw(r,t,e)},Sw=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},Tw=({values:r},t,e)=>{r[t]=BigInt(e)},Iw=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},Ew=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},yF=(r,t,e)=>{switch(r.type.unit){case Vt.SECOND:return Sw(r,t,e);case Vt.MILLISECOND:return Tw(r,t,e);case Vt.MICROSECOND:return Iw(r,t,e);case Vt.NANOSECOND:return Ew(r,t,e)}},Aw=({values:r},t,e)=>{r[t]=e},Mw=({values:r},t,e)=>{r[t]=e},Cw=({values:r},t,e)=>{r[t]=e},Ow=({values:r},t,e)=>{r[t]=e},vF=(r,t,e)=>{switch(r.type.unit){case Vt.SECOND:return Aw(r,t,e);case Vt.MILLISECOND:return Mw(r,t,e);case Vt.MICROSECOND:return Cw(r,t,e);case Vt.NANOSECOND:return Ow(r,t,e)}},_F=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},bF=(r,t,e)=>{const n=r.children[0],i=r.valueOffsets,s=sn.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],l=i[t+1];a{const n=r.children[0],{valueOffsets:i}=r,s=sn.getVisitFn(n);let{[t]:o,[t+1]:a}=i;const l=e instanceof Map?e.entries():Object.entries(e);for(const u of l)if(s(n,o,u),++o>=a)break},xF=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),SF=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),TF=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),IF=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),EF=(r,t,e)=>{const n=r.type.children.map(s=>sn.getVisitFn(s.type)),i=e instanceof Map?TF(t,e):e instanceof Ne?SF(t,e):Array.isArray(e)?xF(t,e):IF(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},AF=(r,t,e)=>{r.type.mode===lr.Dense?Pw(r,t,e):Rw(r,t,e)},Pw=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];sn.visit(i,r.valueOffsets[t],e)},Rw=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];sn.visit(i,t,e)},MF=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},CF=(r,t,e)=>{r.type.unit===zn.DAY_TIME?Fw(r,t,e):Dw(r,t,e)},Fw=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Dw=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Lw=({values:r},t,e)=>{r[t]=e},Nw=({values:r},t,e)=>{r[t]=e},Bw=({values:r},t,e)=>{r[t]=e},Uw=({values:r},t,e)=>{r[t]=e},OF=(r,t,e)=>{switch(r.type.unit){case Vt.SECOND:return Lw(r,t,e);case Vt.MILLISECOND:return Nw(r,t,e);case Vt.MICROSECOND:return Bw(r,t,e);case Vt.NANOSECOND:return Uw(r,t,e)}},PF=(r,t,e)=>{const{stride:n}=r,i=r.children[0],s=sn.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o`${Ba(t)}: ${Ba(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new RF(this[un],this[bo])}},RF=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return te.name)}has(t,e){return t[un].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[un].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[un].type.children.findIndex(i=>i.name===e);if(n!==-1){const i=xr.visit(t[un].children[n],t[bo]);return Reflect.set(t,e,i),i}}set(t,e,n){const i=t[un].type.children.findIndex(s=>s.name===e);return i!==-1?(sn.visit(t[un].children[i],t[bo],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}},Ft=class extends se{};function $t(r){return(t,e)=>t.getValid(e)?r(t,e):null}const DF=(r,t)=>864e5*r[t],LF=(r,t)=>null,kw=(r,t,e)=>{if(e+1>=t.length)return null;const n=Te(t[e]),i=Te(t[e+1]);return r.subarray(n,i)},NF=({offset:r,values:t},e)=>{const n=r+e;return(t[n>>3]&1<DF(r,t),Vw=({values:r},t)=>Te(r[t]),zi=({stride:r,values:t},e)=>t[r*e],BF=({stride:r,values:t},e)=>gw(t[r*e]),jw=({values:r},t)=>r[t],UF=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),$w=({values:r,valueOffsets:t},e)=>kw(r,t,e),Gw=({values:r,valueOffsets:t},e)=>{const n=kw(r,t,e);return n!==null?Wd(n):null},kF=({values:r},t)=>r[t],zF=({type:r,values:t},e)=>r.precision!==ar.HALF?t[e]:gw(t[e]),VF=(r,t)=>r.type.unit===nn.DAY?zw(r,t):Vw(r,t),Ww=({values:r},t)=>1e3*Te(r[t]),Hw=({values:r},t)=>Te(r[t]),Xw=({values:r},t)=>Gb(r[t],BigInt(1e3)),Yw=({values:r},t)=>Gb(r[t],BigInt(1e6)),jF=(r,t)=>{switch(r.type.unit){case Vt.SECOND:return Ww(r,t);case Vt.MILLISECOND:return Hw(r,t);case Vt.MICROSECOND:return Xw(r,t);case Vt.NANOSECOND:return Yw(r,t)}},qw=({values:r},t)=>r[t],Qw=({values:r},t)=>r[t],Zw=({values:r},t)=>r[t],Kw=({values:r},t)=>r[t],$F=(r,t)=>{switch(r.type.unit){case Vt.SECOND:return qw(r,t);case Vt.MILLISECOND:return Qw(r,t);case Vt.MICROSECOND:return Zw(r,t);case Vt.NANOSECOND:return Kw(r,t)}},GF=({values:r,stride:t},e)=>lF.decimal(r.subarray(t*e,t*(e+1))),WF=(r,t)=>{const{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,l=i[0].slice(s,o-s);return new Ne([l])},HF=(r,t)=>{const{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new rp(o.slice(i,s-i))},XF=(r,t)=>new ep(r,t),YF=(r,t)=>r.type.mode===lr.Dense?Jw(r,t):tx(r,t),Jw=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return xr.visit(n,r.valueOffsets[t])},tx=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return xr.visit(n,t)},qF=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},QF=(r,t)=>r.type.unit===zn.DAY_TIME?ex(r,t):rx(r,t),ex=({values:r},t)=>r.subarray(2*t,2*(t+1)),rx=({values:r},t)=>{const e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},nx=({values:r},t)=>r[t],ix=({values:r},t)=>r[t],sx=({values:r},t)=>r[t],ox=({values:r},t)=>r[t],ZF=(r,t)=>{switch(r.type.unit){case Vt.SECOND:return nx(r,t);case Vt.MILLISECOND:return ix(r,t);case Vt.MICROSECOND:return sx(r,t);case Vt.NANOSECOND:return ox(r,t)}},KF=(r,t)=>{const{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new Ne([s])};Ft.prototype.visitNull=$t(LF);Ft.prototype.visitBool=$t(NF);Ft.prototype.visitInt=$t(kF);Ft.prototype.visitInt8=$t(zi);Ft.prototype.visitInt16=$t(zi);Ft.prototype.visitInt32=$t(zi);Ft.prototype.visitInt64=$t(jw);Ft.prototype.visitUint8=$t(zi);Ft.prototype.visitUint16=$t(zi);Ft.prototype.visitUint32=$t(zi);Ft.prototype.visitUint64=$t(jw);Ft.prototype.visitFloat=$t(zF);Ft.prototype.visitFloat16=$t(BF);Ft.prototype.visitFloat32=$t(zi);Ft.prototype.visitFloat64=$t(zi);Ft.prototype.visitUtf8=$t(Gw);Ft.prototype.visitLargeUtf8=$t(Gw);Ft.prototype.visitBinary=$t($w);Ft.prototype.visitLargeBinary=$t($w);Ft.prototype.visitFixedSizeBinary=$t(UF);Ft.prototype.visitDate=$t(VF);Ft.prototype.visitDateDay=$t(zw);Ft.prototype.visitDateMillisecond=$t(Vw);Ft.prototype.visitTimestamp=$t(jF);Ft.prototype.visitTimestampSecond=$t(Ww);Ft.prototype.visitTimestampMillisecond=$t(Hw);Ft.prototype.visitTimestampMicrosecond=$t(Xw);Ft.prototype.visitTimestampNanosecond=$t(Yw);Ft.prototype.visitTime=$t($F);Ft.prototype.visitTimeSecond=$t(qw);Ft.prototype.visitTimeMillisecond=$t(Qw);Ft.prototype.visitTimeMicrosecond=$t(Zw);Ft.prototype.visitTimeNanosecond=$t(Kw);Ft.prototype.visitDecimal=$t(GF);Ft.prototype.visitList=$t(WF);Ft.prototype.visitStruct=$t(XF);Ft.prototype.visitUnion=$t(YF);Ft.prototype.visitDenseUnion=$t(Jw);Ft.prototype.visitSparseUnion=$t(tx);Ft.prototype.visitDictionary=$t(qF);Ft.prototype.visitInterval=$t(QF);Ft.prototype.visitIntervalDayTime=$t(ex);Ft.prototype.visitIntervalYearMonth=$t(rx);Ft.prototype.visitDuration=$t(ZF);Ft.prototype.visitDurationSecond=$t(nx);Ft.prototype.visitDurationMillisecond=$t(ix);Ft.prototype.visitDurationMicrosecond=$t(sx);Ft.prototype.visitDurationNanosecond=$t(ox);Ft.prototype.visitFixedSizeList=$t(KF);Ft.prototype.visitMap=$t(HF);const xr=new Ft,so=Symbol.for("keys"),wo=Symbol.for("vals"),oo=Symbol.for("kKeysAsStrings"),Kd=Symbol.for("_kKeysAsStrings");let rp=class{constructor(t){return this[so]=new Ne([t.children[0]]).memoize(),this[wo]=t.children[1],new Proxy(this,new t2)}get[oo](){return this[Kd]||(this[Kd]=Array.from(this[so].toArray(),String))}[Symbol.iterator](){return new JF(this[so],this[wo])}get size(){return this[so].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[so],e=this[wo],n={};for(let i=-1,s=t.length;++i`${Ba(t)}: ${Ba(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},JF=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),xr.visit(this.vals,t)]})}},t2=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[oo]}has(t,e){return t[oo].includes(e)}getOwnPropertyDescriptor(t,e){if(t[oo].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[oo].indexOf(e);if(n!==-1){const i=xr.visit(Reflect.get(t,wo),n);return Reflect.set(t,e,i),i}}set(t,e,n){const i=t[oo].indexOf(e);return i!==-1?(sn.visit(Reflect.get(t,wo),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(rp.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[so]:{writable:!0,enumerable:!1,configurable:!1,value:null},[wo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Kd]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let cy;function ax(r,t,e,n){const{length:i=0}=r;let s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),n?n(r,s,o):[s,o]}const np=(r,t)=>r<0?t+r:r,hy=r=>r!==r;function ko(r){if(typeof r!=="object"||r===null)return hy(r)?hy:e=>e===r;if(r instanceof Date){const e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?ZR(r,e):!1:r instanceof Map?r2(r):Array.isArray(r)?e2(r):r instanceof Ne?n2(r):i2(r,!0)}function e2(r){const t=[];for(let e=-1,n=r.length;++e!1;const n=[];for(let i=-1,s=e.length;++i{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return s2(r,e);case Map:return dy(r,e,e.keys());case rp:case ep:case Object:case void 0:return dy(r,e,t||Object.keys(e))}return e instanceof Ne?o2(r,e):!1}}function s2(r,t){const e=r.length;if(t.length!==e)return!1;for(let n=-1;++n>n}function Ru(r,t,e){const n=e.byteLength+7&-8;if(r>0||e.byteLength>3):Fu(new ip(e,r,t,null,lx)).subarray(0,n)),i}return e}function Fu(r){const t=[];let e=0,n=0,i=0;for(const o of r)o&&(i|=1<0)&&(t[e++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}let ip=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8===0?0:8-t%8);return Jd(r,t,i)+Jd(r,n,e)+l2(r,i>>3,n-i>>3)}function l2(r,t,e){let n=0,i=Math.trunc(t);const s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=Oh(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Oh(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Oh(s.getUint8(i)),i+=1;return n}function Oh(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const u2=-1;let Ae=class tf{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return Ot.isSparseUnion(t)?this.children.some(e=>e.nullable):Ot.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(Ot.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=u2&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-Jd(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof tf?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=ii(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:e}=this;if(Ot.isUnion(e)){const n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===lr.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<>3;(!s||s.byteLength<=c)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(Ru(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const h=s[c];n=(h&u)!==0,s[c]=e?h|u:h&~u}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new tf(t,e,n,i,s,o,this.dictionary)}slice(t,e){const{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,l=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===k.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<0&&i.set(Ru(this.offset,e,this.nullBitmap),0);const s=this.buffers;return s[ni.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s;const{buffers:o}=this;return(s=o[ni.TYPE])&&(o[ni.TYPE]=s.subarray(t,t+e)),(s=o[ni.OFFSET])&&(o[ni.OFFSET]=s.subarray(t,t+e+1))||(s=o[ni.DATA])&&(o[ni.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};Ae.prototype.children=Object.freeze([]);class Sa extends se{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new Ae(e,n,i,i)}visitBool(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitInt(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitFloat(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitUtf8(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.data),s=ce(t.nullBitmap),o=ia(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,i,s])}visitLargeUtf8(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.data),s=ce(t.nullBitmap),o=Jg(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,i,s])}visitBinary(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.data),s=ce(t.nullBitmap),o=ia(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,i,s])}visitLargeBinary(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.data),s=ce(t.nullBitmap),o=Jg(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,i,s])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitDate(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitTimestamp(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitTime(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitDecimal(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitList(t){const{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=ce(t.nullBitmap),o=ia(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,void 0,s],[i])}visitStruct(t){const{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=ce(t.nullBitmap),{length:o=i.reduce((l,{length:u})=>Math.max(l,u),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=xe(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(Ot.isSparseUnion(e))return new Ae(e,n,o,a,[void 0,void 0,void 0,s],i);const l=ia(t.valueOffsets);return new Ae(e,n,o,a,[l,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.indices.ArrayType,t.data),{["dictionary"]:o=new Ne([new Sa().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[void 0,s,i],[],o)}visitInterval(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitDuration(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:e,["offset"]:n=0,["child"]:i=new Sa().visit({type:e.valueType})}=t,s=ce(t.nullBitmap),{["length"]:o=i.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:e,["offset"]:n=0,["child"]:i=new Sa().visit({type:e.childType})}=t,s=ce(t.nullBitmap),o=ia(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,void 0,s],[i])}}const c2=new Sa;function le(r){return c2.visit(r)}let fy=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function ux(r){return r.reduce((t,e)=>t+e.nullCount,0)}function cx(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function hx(r,t,e,n){const i=[];for(let s=-1,o=r.length;++s=n)break;if(e>=l+u)continue;if(l>=e&&l+u<=n){i.push(a);continue}const c=Math.max(0,e-l),h=Math.min(n-l,u);i.push(a.slice(c,h-c))}return i.length===0&&i.push(r[0].slice(0,0)),i}function sp(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e0?0:-1}function f2(r,t){const{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(const i of new ip(e,r.offset+(t||0),r.length,e,lx)){if(!i)return n;++n}return-1}function Zt(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case k.Union:break;case k.Dictionary:break;default:return f2(r,e)}const n=xr.getVisitFn(r),i=ko(t);for(let s=(e||0)-1,o=r.length;++s{const i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new fy(r.data.length,n=>{const s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new p2(o)})}let p2=class{constructor(t){this.vector=t,this.index=0}next(){return this.indexa.data):t;if(s.length===0||s.some(a=>!(a instanceof Ae)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:u}=gx[o.typeId],c=s[0];this.isValid=h=>op(c,h),this.get=h=>a(c,h),this.set=(h,f)=>l(c,h,f),this.indexOf=h=>u(c,h),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,yx[o.typeId]),this._offsets=cx(s);break}this.data=s,this.type=o,this.stride=ii(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return h2(this.data)}get nullCount(){return ux(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${k[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(np(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return ap.visit(this)}concat(...t){return new ls(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new ls(ax(this,t,e,({data:n,_offsets:i},s,o)=>hx(n,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case k.Int:case k.Float:case k.Decimal:case k.Time:case k.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return Ot.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Ot.isDictionary(this.type)){const t=new py(this.data[0].dictionary),e=this.data.map(n=>{const i=n.clone();return i.dictionary=t,i});return new ls(e)}return new py(this)}unmemoize(){if(Ot.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const i=n.clone();return i.dictionary=t,i});return new ls(e)}return this}};mx=Symbol.toStringTag;Ne[mx]=(r=>{r.type=Ot.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const t=Object.keys(k).map(e=>k[e]).filter(e=>typeof e=="number"&&e!==k.NONE);for(const e of t){const n=xr.getVisitFnByTypeId(e),i=sn.getVisitFnByTypeId(e),s=Lu.getVisitFnByTypeId(e);gx[e]={get:n,set:i,indexOf:s},yx[e]=Object.create(r,{isValid:{value:Du(op)},get:{value:Du(xr.getVisitFnByTypeId(e))},set:{value:dx(sn.getVisitFnByTypeId(e))},indexOf:{value:fx(Lu.getVisitFnByTypeId(e))}})}return"Vector"})(Ne.prototype);let py=class vx extends Ne{constructor(t){super(t.data);const e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const l=e.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new vx(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ne(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};class ef{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}}class Er{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Er).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+_e),(e||new Er).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):je.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new In).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new ef).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const n=this.bb.__offset(this.bb_pos,10);return n?(e||new ef).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,je.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}let Le=class us{constructor(t=[],e,n,i=je.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=rf(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){const e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new us(n,this.metadata)}selectAt(t){const e=t.map(n=>this.fields[n]).filter(Boolean);return new us(e,this.metadata)}assign(...t){const e=t[0]instanceof us?t[0]:Array.isArray(t[0])?new us(t[0]):new us(t),n=[...this.fields],i=Ll(Ll(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{const l=n.findIndex(u=>u.name===a.name);return~l?(n[l]=a.clone({metadata:Ll(Ll(new Map,n[l].metadata),a.metadata)}))&&!1:!0}),o=rf(s,new Map);return new us([...n,...s],i,new Map([...this.dictionaries,...o]))}};Le.prototype.fields=null;Le.prototype.metadata=null;Le.prototype.dictionaries=null;class Pe{static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new Pe(`${e}`,n,i,s)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],Pe.new(e,n,i,s)}}Pe.prototype.type=null;Pe.prototype.name=null;Pe.prototype.nullable=null;Pe.prototype.metadata=null;function Ll(r,t){return new Map([...r||new Map,...t||new Map])}function rf(r,t=new Map){for(let e=-1,n=r.length;++e0&&rf(s.children,t)}return t}var m2=zb,g2=Mo;class Va{static decode(t){t=new g2(ce(t));const e=Er.getRootAsFooter(t),n=Le.decode(e.schema(),new Map,e.version());return new y2(n,e)}static encode(t){const e=new m2,n=Le.encode(e,t.schema);Er.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())Fi.encode(e,o);const i=e.endVector();Er.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())Fi.encode(e,o);const s=e.endVector();return Er.startFooter(e),Er.addSchema(e,n),Er.addVersion(e,je.V5),Er.addRecordBatches(e,i),Er.addDictionaries(e,s),Er.finishFooterBuffer(e,Er.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=je.V5,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Jt(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Be);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Yr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Yr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Jt(this,void 0,void 0,function*(){return yield this.abort(t),Be})}return(t){return Jt(this,void 0,void 0,function*(){return yield this.close(),Be})}read(t){return Jt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Jt(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(Be)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Xl extends v2{write(t){if((t=ce(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Wd(this.toUint8Array(!0)):this.toUint8Array(!1).then(Wd)}toUint8Array(t=!1){return t?kn(this._values)[0]:Jt(this,void 0,void 0,function*(){var e,n,i,s;const o=[];let a=0;try{for(var l=!0,u=Bn(this),c;c=yield u.next(),e=c.done,!e;l=!0){s=c.value,l=!1;const h=s;o.push(h),a+=h.byteLength}}catch(h){n={error:h}}finally{try{!l&&!e&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return kn(o,a)[0]})}}class Nu{constructor(t){t&&(this.source=new _2(Yr.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Po{constructor(t){t instanceof Po?this.source=t.source:t instanceof Xl?this.source=new ts(Yr.fromAsyncIterable(t)):Nb(t)?this.source=new ts(Yr.fromNodeStream(t)):Kf(t)?this.source=new ts(Yr.fromDOMStream(t)):Lb(t)?this.source=new ts(Yr.fromDOMStream(t.body)):Qa(t)?this.source=new ts(Yr.fromIterable(t)):Is(t)?this.source=new ts(Yr.fromAsyncIterable(t)):Uo(t)&&(this.source=new ts(Yr.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class _2{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Be)}return(t){return Object.create(this.source.return&&this.source.return(t)||Be)}}class ts{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return Jt(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Jt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Jt(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Jt(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return Jt(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||Be;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return Jt(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||Be;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class gy extends Nu{constructor(t,e){super(),this.position=0,this.buffer=ce(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${fo(this.buffer[3])} ${fo(this.buffer[2])} ${fo(this.buffer[1])} ${fo(this.buffer[0])}`}static multiply(t,e){return new ti(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ti(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return ti.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return ti.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),i=t.length,s=new ti(e);for(let o=n?1:0;o0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class x2 extends bx{constructor(t,e,n,i,s){super(new Uint8Array(0),e,n,i,s),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Fu(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return xe(Uint8Array,xe(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return xe(Uint8Array,xe(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return Ot.isTimestamp(t)||(Ot.isInt(t)||Ot.isTime(t))&&t.bitWidth===64||Ot.isDuration(t)||Ot.isDate(t)&&t.unit===nn.MILLISECOND?xe(Uint8Array,Ta.convertArray(n[e])):Ot.isDecimal(t)?xe(Uint8Array,w2.convertArray(n[e])):Ot.isBinary(t)||Ot.isLargeBinary(t)||Ot.isFixedSizeBinary(t)?S2(n[e]):Ot.isBool(t)?Fu(n[e]):Ot.isUtf8(t)||Ot.isLargeUtf8(t)?Zf(n[e].join("")):xe(Uint8Array,xe(t.ArrayType,n[e].map(i=>+i)))}}function S2(r){const t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n>1]=Number.parseInt(t.slice(n,n+2),16);return e}let Nt=class extends se{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function mr(r,t){return t instanceof r.constructor}function Fs(r,t){return r===t||mr(r,t)}function di(r,t){return r===t||mr(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function lc(r,t){return r===t||mr(r,t)&&r.precision===t.precision}function T2(r,t){return r===t||mr(r,t)&&r.byteWidth===t.byteWidth}function cp(r,t){return r===t||mr(r,t)&&r.unit===t.unit}function Za(r,t){return r===t||mr(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Ka(r,t){return r===t||mr(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function I2(r,t){return r===t||mr(r,t)&&r.children.length===t.children.length&&Di.compareManyFields(r.children,t.children)}function E2(r,t){return r===t||mr(r,t)&&r.children.length===t.children.length&&Di.compareManyFields(r.children,t.children)}function hp(r,t){return r===t||mr(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Di.compareManyFields(r.children,t.children)}function A2(r,t){return r===t||mr(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Di.visit(r.indices,t.indices)&&Di.visit(r.dictionary,t.dictionary)}function dp(r,t){return r===t||mr(r,t)&&r.unit===t.unit}function Ja(r,t){return r===t||mr(r,t)&&r.unit===t.unit}function M2(r,t){return r===t||mr(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Di.compareManyFields(r.children,t.children)}function C2(r,t){return r===t||mr(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Di.compareManyFields(r.children,t.children)}Nt.prototype.visitNull=Fs;Nt.prototype.visitBool=Fs;Nt.prototype.visitInt=di;Nt.prototype.visitInt8=di;Nt.prototype.visitInt16=di;Nt.prototype.visitInt32=di;Nt.prototype.visitInt64=di;Nt.prototype.visitUint8=di;Nt.prototype.visitUint16=di;Nt.prototype.visitUint32=di;Nt.prototype.visitUint64=di;Nt.prototype.visitFloat=lc;Nt.prototype.visitFloat16=lc;Nt.prototype.visitFloat32=lc;Nt.prototype.visitFloat64=lc;Nt.prototype.visitUtf8=Fs;Nt.prototype.visitLargeUtf8=Fs;Nt.prototype.visitBinary=Fs;Nt.prototype.visitLargeBinary=Fs;Nt.prototype.visitFixedSizeBinary=T2;Nt.prototype.visitDate=cp;Nt.prototype.visitDateDay=cp;Nt.prototype.visitDateMillisecond=cp;Nt.prototype.visitTimestamp=Za;Nt.prototype.visitTimestampSecond=Za;Nt.prototype.visitTimestampMillisecond=Za;Nt.prototype.visitTimestampMicrosecond=Za;Nt.prototype.visitTimestampNanosecond=Za;Nt.prototype.visitTime=Ka;Nt.prototype.visitTimeSecond=Ka;Nt.prototype.visitTimeMillisecond=Ka;Nt.prototype.visitTimeMicrosecond=Ka;Nt.prototype.visitTimeNanosecond=Ka;Nt.prototype.visitDecimal=Fs;Nt.prototype.visitList=I2;Nt.prototype.visitStruct=E2;Nt.prototype.visitUnion=hp;Nt.prototype.visitDenseUnion=hp;Nt.prototype.visitSparseUnion=hp;Nt.prototype.visitDictionary=A2;Nt.prototype.visitInterval=dp;Nt.prototype.visitIntervalDayTime=dp;Nt.prototype.visitIntervalYearMonth=dp;Nt.prototype.visitDuration=Ja;Nt.prototype.visitDurationSecond=Ja;Nt.prototype.visitDurationMillisecond=Ja;Nt.prototype.visitDurationMicrosecond=Ja;Nt.prototype.visitDurationNanosecond=Ja;Nt.prototype.visitFixedSizeList=M2;Nt.prototype.visitMap=C2;const Di=new Nt;function nf(r,t){return Di.compareSchemas(r,t)}function Ph(r,t){return O2(r,t.map(e=>e.data.concat()))}function O2(r,t){const e=[...r.fields],n=[],i={numBatches:t.reduce((h,f)=>Math.max(h,f.length),0)};let s=0,o=0,a=-1;const l=t.length;let u,c=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a0&&(n[s++]=le({type:new dr(e),length:o,nullCount:0,children:c.slice()})))}return[r=r.assign(e),n.map(h=>new _r(r,h))]}function P2(r,t,e,n,i){var s;const o=(t+63&-64)>>3;for(let a=-1,l=n.length;++a=t)c===t?e[a]=u:(e[a]=u.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(u.slice(t,c-t))));else{const h=r[a];r[a]=h.clone({nullable:!0}),e[a]=(s=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:le({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var wx;let Li=class cs{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new Le([]),this._offsets=[0],this;let i,s;t[0]instanceof Le&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());const o=l=>{if(l){if(l instanceof _r)return[l];if(l instanceof cs)return l.batches;if(l instanceof Ae){if(l.type instanceof dr)return[new _r(new Le(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(u=>o(u));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(u=>o(u));if(typeof l=="object"){const u=Object.keys(l),c=u.map(d=>new Ne([l[d]])),h=i??new Le(u.map((d,m)=>new Pe(String(d),c[m].type,c[m].nullable))),[,f]=Ph(h,c);return f.length===0?[new _r(l)]:f}}}return[]},a=t.flatMap(l=>o(l));if(i=(n=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new Le([]),!(i instanceof Le))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of a){if(!(l instanceof _r))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!nf(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??cx(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=ux(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(np(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?ap.visit(new Ne(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ + */function Jt(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(c){try{u(n.next(c))}catch(h){o(h)}}function l(c){try{u(n.throw(c))}catch(h){o(h)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((n=n.apply(r,t||[])).next())})}function Zg(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Rt(r){return this instanceof Rt?(this.v=r,this):new Rt(r)}function br(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(d){return function(m){return Promise.resolve(m).then(d,h)}}function a(d,m){n[d]&&(i[d]=function(g){return new Promise(function(p,y){s.push([d,g,p,y])>1||l(d,g)})},m&&(i[d]=m(i[d])))}function l(d,m){try{u(n[d](m))}catch(g){f(s[0][3],g)}}function u(d){d.value instanceof Rt?Promise.resolve(d.value.v).then(c,h):f(s[0][2],d)}function c(d){l("next",d)}function h(d){l("throw",d)}function f(d,m){d(m),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Ss(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=r[i]?function(o){return(e=!e)?{value:Rt(r[i](o)),done:!1}:s?s(o):o}:s}}function Bn(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Zg=="function"?Zg(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,l){o=r[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(u){s({value:u,done:a})},o)}}const jR=new TextDecoder("utf-8"),Wd=r=>jR.decode(r),$R=new TextEncoder,Zf=r=>$R.encode(r),GR=r=>typeof r=="number",Rb=r=>typeof r=="boolean",Ye=r=>typeof r=="function",wr=r=>r!=null&&Object(r)===r,Is=r=>wr(r)&&Ye(r.then),Qa=r=>wr(r)&&Ye(r[Symbol.iterator]),Uo=r=>wr(r)&&Ye(r[Symbol.asyncIterator]),Hd=r=>wr(r)&&wr(r.schema),Fb=r=>wr(r)&&"done"in r&&"value"in r,Db=r=>wr(r)&&Ye(r.stat)&&GR(r.fd),Lb=r=>wr(r)&&Kf(r.body),oc=r=>"_getDOMStream"in r&&"_getNodeStream"in r,WR=r=>wr(r)&&Ye(r.abort)&&Ye(r.getWriter)&&!oc(r),Kf=r=>wr(r)&&Ye(r.cancel)&&Ye(r.getReader)&&!oc(r),HR=r=>wr(r)&&Ye(r.end)&&Ye(r.write)&&Rb(r.writable)&&!oc(r),Nb=r=>wr(r)&&Ye(r.read)&&Ye(r.pipe)&&Rb(r.readable)&&!oc(r),XR=r=>wr(r)&&Ye(r.clear)&&Ye(r.bytes)&&Ye(r.position)&&Ye(r.setPosition)&&Ye(r.capacity)&&Ye(r.getBufferIdentifier)&&Ye(r.createLong),Jf=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function YR(r){const t=r[0]?[r[0]]:[];let e,n,i,s;for(let o,a,l=0,u=0,c=r.length;++lc+h.byteLength,0);let i,s,o,a=0,l=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,n);for(const c=e.length;++lxe(Int32Array,r),Jg=r=>xe(BigInt64Array,r),ce=r=>xe(Uint8Array,r),Xd=r=>(r.next(),r);function*qR(r,t){const e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Jf?e(t):Qa(t)?t:e(t);return yield*Xd(function*(i){let s=null;do s=i.next(yield xe(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}const QR=r=>qR(Uint8Array,r);function Bb(r,t){return br(this,arguments,function*(){if(Is(t))return yield Rt(yield Rt(yield*Ss(Bn(Bb(r,yield Rt(t))))));const n=function(o){return br(this,arguments,function*(){yield yield Rt(yield Rt(o))})},i=function(o){return br(this,arguments,function*(){yield Rt(yield*Ss(Bn(Xd(function*(a){let l=null;do l=a.next(yield l==null?void 0:l.value);while(!l.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Jf?n(t):Qa(t)?i(t):Uo(t)?t:n(t);return yield Rt(yield*Ss(Bn(Xd(function(o){return br(this,arguments,function*(){let a=null;do a=yield Rt(o.next(yield yield Rt(xe(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield Rt(new r)})}const ZR=r=>Bb(Uint8Array,r);function Ub(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n0)do if(r[e]!==t[e])return!1;while(++e(r.next(),r);function*JR(r){let t,e=!1,n=[],i,s,o,a=0;function l(){return s==="peek"?kn(n,o)[0]:([i,n,a]=kn(n,o),i)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});const u=QR(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?u.next():u.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield l());while(o0&&(i.push(s),l+=s.byteLength),e||a<=l)do({cmd:o,size:a}=yield yield Rt(u()));while(a0&&(i.push(ce(s)),l+=s.byteLength),e||a<=l)do({cmd:o,size:a}=yield yield Rt(u()));while(a{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Jt(this,void 0,void 0,function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Jt(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=ce(e)),e})}}const Ah=(r,t)=>{const e=i=>n([t,i]);let n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function nF(r){return br(this,arguments,function*(){const e=[];let n="error",i=!1,s=null,o,a,l=0,u=[],c;function h(){return o==="peek"?kn(u,a)[0]:([c,u,l]=kn(u,a),c)}if({cmd:o,size:a}=(yield yield Rt(null))||{cmd:"read",size:0},r.isTTY)return yield yield Rt(new Uint8Array(0)),yield Rt(null);try{e[0]=Ah(r,"end"),e[1]=Ah(r,"error");do{if(e[2]=Ah(r,"readable"),[n,s]=yield Rt(Promise.race(e.map(d=>d[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-l)?(c=ce(r.read(a-l)),c.byteLength0&&(u.push(c),l+=c.byteLength)),i||a<=l)do({cmd:o,size:a}=yield yield Rt(h()));while(a{for(const[y,_]of d)r.off(y,_);try{const y=r.destroy;y&&y.call(r,m),m=void 0}catch(y){m=y||m}finally{m!=null?p(m):g()}})}})}var je;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(je||(je={}));var lr;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(lr||(lr={}));var ar;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(ar||(ar={}));var nn;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(nn||(nn={}));var Vt;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Vt||(Vt={}));var zn;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(zn||(zn={}));const Mh=2,Pn=4,oi=4,_e=4,Ii=new Int32Array(2),ty=new Float32Array(Ii.buffer),ey=new Float64Array(Ii.buffer),Dl=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Yd;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Yd||(Yd={}));let Mo=class kb{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new kb(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){ty[0]=e,this.writeInt32(t,Ii[0])}writeFloat64(t,e){ey[0]=e,this.writeInt32(t,Ii[Dl?0:1]),this.writeInt32(t+4,Ii[Dl?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);const n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space=0&&this.vtable[e]==0;e--);const n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const i=2;this.addInt16(t-this.object_start);const s=(n+i)*Mh;this.addInt16(s);let o=0;const a=this.space;t:for(e=0;e=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Pn+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return vr.startUnion(t),vr.addMode(t,e),vr.addTypeIds(t,n),vr.endUnion(t)}}let ly=class _a{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new _a).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+_e),(e||new _a).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return _a.startUtf8(t),_a.endUtf8(t)}};var Ee;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(Ee||(Ee={}));let Wr=class Hl{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new Hl).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+_e),(e||new Hl).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Ee.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new ai).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new Hl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,16);return n?(e||new qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,Ee.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}},In=class Zn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Zn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+_e),(e||new Zn).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Co.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Wr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Co.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return Zn.startSchema(t),Zn.addEndianness(t,e),Zn.addFields(t,n),Zn.addCustomMetadata(t,i),Zn.addFeatures(t,s),Zn.endSchema(t)}};var me;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(me||(me={}));var k;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(k||(k={}));var ni;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(ni||(ni={}));const iF=void 0;function Ba(r){if(r===null)return"null";if(r===iF)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>Ba(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}function Te(r){if(typeof r=="bigint"&&(rNumber.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Gb(r,t){return Te(r/t)+Te(r%t)/Te(t)}const sF=Symbol.for("isArrowBigNum");function pn(r,...t){return t.length===0?Object.setPrototypeOf(xe(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}pn.prototype[sF]=!0;pn.prototype.toJSON=function(){return`"${ka(this)}"`};pn.prototype.valueOf=function(r){return Wb(this,r)};pn.prototype.toString=function(){return ka(this)};pn.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Wb(this);case"string":return ka(this);case"default":return lF(this)}return ka(this)};function vo(...r){return pn.apply(this,r)}function _o(...r){return pn.apply(this,r)}function Ua(...r){return pn.apply(this,r)}Object.setPrototypeOf(vo.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(_o.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Ua.prototype,Object.create(Uint32Array.prototype));Object.assign(vo.prototype,pn.prototype,{constructor:vo,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(_o.prototype,pn.prototype,{constructor:_o,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Ua.prototype,pn.prototype,{constructor:Ua,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const oF=BigInt(4294967296)*BigInt(4294967296),aF=oF-BigInt(1);function Wb(r,t){const{buffer:e,byteOffset:n,byteLength:i,signed:s}=r,o=new BigUint64Array(e,n,i/8),a=s&&o.at(-1)&BigInt(1)<=0)return Ch(r);t=t.slice();let n=1;for(let s=0;s(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(Ot.prototype);let Fi=class extends Ot{constructor(){super(k.Null)}toString(){return"Null"}};Yb=Symbol.toStringTag;Fi[Yb]=(r=>r[Symbol.toStringTag]="Null")(Fi.prototype);let Es=class extends Ot{constructor(t,e){super(k.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};qb=Symbol.toStringTag;Es[qb]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Es.prototype);class za extends Es{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(za.prototype,"ArrayType",{value:Int32Array});let mu=class extends Ot{constructor(t){super(k.Float),this.precision=t}get ArrayType(){switch(this.precision){case ar.HALF:return Uint16Array;case ar.SINGLE:return Float32Array;case ar.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Qb=Symbol.toStringTag;mu[Qb]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(mu.prototype);let gu=class extends Ot{constructor(){super(k.Binary)}toString(){return"Binary"}};Zb=Symbol.toStringTag;gu[Zb]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(gu.prototype);let yu=class extends Ot{constructor(){super(k.LargeBinary)}toString(){return"LargeBinary"}};Kb=Symbol.toStringTag;yu[Kb]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(yu.prototype);let vu=class extends Ot{constructor(){super(k.Utf8)}toString(){return"Utf8"}};Jb=Symbol.toStringTag;vu[Jb]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(vu.prototype);let _u=class extends Ot{constructor(){super(k.LargeUtf8)}toString(){return"LargeUtf8"}};tw=Symbol.toStringTag;_u[tw]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(_u.prototype);let bu=class extends Ot{constructor(){super(k.Bool)}toString(){return"Bool"}};ew=Symbol.toStringTag;bu[ew]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(bu.prototype);let wu=class extends Ot{constructor(t,e,n=128){super(k.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};rw=Symbol.toStringTag;wu[rw]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(wu.prototype);let xu=class extends Ot{constructor(t){super(k.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${nn[this.unit]}>`}get ArrayType(){return this.unit===nn.DAY?Int32Array:BigInt64Array}};nw=Symbol.toStringTag;xu[nw]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(xu.prototype);let Su=class extends Ot{constructor(t,e){super(k.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${Vt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};iw=Symbol.toStringTag;Su[iw]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Su.prototype);let Tu=class extends Ot{constructor(t,e){super(k.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${Vt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};sw=Symbol.toStringTag;Tu[sw]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Tu.prototype);let Iu=class extends Ot{constructor(t){super(k.Interval),this.unit=t}toString(){return`Interval<${zn[this.unit]}>`}};ow=Symbol.toStringTag;Iu[ow]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Iu.prototype);let Eu=class extends Ot{constructor(t){super(k.Duration),this.unit=t}toString(){return`Duration<${Vt[this.unit]}>`}};aw=Symbol.toStringTag;Eu[aw]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Eu.prototype);let Au=class extends Ot{constructor(t){super(k.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};lw=Symbol.toStringTag;Au[lw]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Au.prototype);let dr=class extends Ot{constructor(t){super(k.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};uw=Symbol.toStringTag;dr[uw]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(dr.prototype);let Mu=class extends Ot{constructor(t,e,n){super(k.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};cw=Symbol.toStringTag;Mu[cw]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Mu.prototype);let Cu=class extends Ot{constructor(t){super(k.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};hw=Symbol.toStringTag;Cu[hw]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Cu.prototype);let Ou=class extends Ot{constructor(t,e){super(k.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};dw=Symbol.toStringTag;Ou[dw]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ou.prototype);let Pu=class extends Ot{constructor(t,e=!1){var n,i,s;if(super(k.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){const o=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};fw=Symbol.toStringTag;Pu[fw]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Pu.prototype);const cF=(r=>()=>++r)(-1);let Oo=class extends Ot{constructor(t,e,n,i){super(k.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?cF():Te(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};pw=Symbol.toStringTag;Oo[pw]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Oo.prototype);function ii(r){const t=r;switch(r.typeId){case k.Decimal:return r.bitWidth/32;case k.Interval:return 1+t.unit;case k.FixedSizeList:return t.listSize;case k.FixedSizeBinary:return t.byteWidth;default:return 1}}let se=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return hF(this,t,e)}getVisitFnByTypeId(t,e=!0){return io(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function hF(r,t,e=!0){return typeof t=="number"?io(r,t,e):typeof t=="string"&&t in k?io(r,k[t],e):t&&t instanceof Ot?io(r,uy(t),e):t!=null&&t.type&&t.type instanceof Ot?io(r,uy(t.type),e):io(r,k.NONE,e)}function io(r,t,e=!0){let n=null;switch(t){case k.Null:n=r.visitNull;break;case k.Bool:n=r.visitBool;break;case k.Int:n=r.visitInt;break;case k.Int8:n=r.visitInt8||r.visitInt;break;case k.Int16:n=r.visitInt16||r.visitInt;break;case k.Int32:n=r.visitInt32||r.visitInt;break;case k.Int64:n=r.visitInt64||r.visitInt;break;case k.Uint8:n=r.visitUint8||r.visitInt;break;case k.Uint16:n=r.visitUint16||r.visitInt;break;case k.Uint32:n=r.visitUint32||r.visitInt;break;case k.Uint64:n=r.visitUint64||r.visitInt;break;case k.Float:n=r.visitFloat;break;case k.Float16:n=r.visitFloat16||r.visitFloat;break;case k.Float32:n=r.visitFloat32||r.visitFloat;break;case k.Float64:n=r.visitFloat64||r.visitFloat;break;case k.Utf8:n=r.visitUtf8;break;case k.LargeUtf8:n=r.visitLargeUtf8;break;case k.Binary:n=r.visitBinary;break;case k.LargeBinary:n=r.visitLargeBinary;break;case k.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case k.Date:n=r.visitDate;break;case k.DateDay:n=r.visitDateDay||r.visitDate;break;case k.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case k.Timestamp:n=r.visitTimestamp;break;case k.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case k.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case k.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case k.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case k.Time:n=r.visitTime;break;case k.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case k.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case k.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case k.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case k.Decimal:n=r.visitDecimal;break;case k.List:n=r.visitList;break;case k.Struct:n=r.visitStruct;break;case k.Union:n=r.visitUnion;break;case k.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case k.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case k.Dictionary:n=r.visitDictionary;break;case k.Interval:n=r.visitInterval;break;case k.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case k.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case k.Duration:n=r.visitDuration;break;case k.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case k.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case k.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case k.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case k.FixedSizeList:n=r.visitFixedSizeList;break;case k.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${k[t]}'`)}function uy(r){switch(r.typeId){case k.Null:return k.Null;case k.Int:{const{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?k.Int8:k.Uint8;case 16:return e?k.Int16:k.Uint16;case 32:return e?k.Int32:k.Uint32;case 64:return e?k.Int64:k.Uint64}return k.Int}case k.Float:switch(r.precision){case ar.HALF:return k.Float16;case ar.SINGLE:return k.Float32;case ar.DOUBLE:return k.Float64}return k.Float;case k.Binary:return k.Binary;case k.LargeBinary:return k.LargeBinary;case k.Utf8:return k.Utf8;case k.LargeUtf8:return k.LargeUtf8;case k.Bool:return k.Bool;case k.Decimal:return k.Decimal;case k.Time:switch(r.unit){case Vt.SECOND:return k.TimeSecond;case Vt.MILLISECOND:return k.TimeMillisecond;case Vt.MICROSECOND:return k.TimeMicrosecond;case Vt.NANOSECOND:return k.TimeNanosecond}return k.Time;case k.Timestamp:switch(r.unit){case Vt.SECOND:return k.TimestampSecond;case Vt.MILLISECOND:return k.TimestampMillisecond;case Vt.MICROSECOND:return k.TimestampMicrosecond;case Vt.NANOSECOND:return k.TimestampNanosecond}return k.Timestamp;case k.Date:switch(r.unit){case nn.DAY:return k.DateDay;case nn.MILLISECOND:return k.DateMillisecond}return k.Date;case k.Interval:switch(r.unit){case zn.DAY_TIME:return k.IntervalDayTime;case zn.YEAR_MONTH:return k.IntervalYearMonth}return k.Interval;case k.Duration:switch(r.unit){case Vt.SECOND:return k.DurationSecond;case Vt.MILLISECOND:return k.DurationMillisecond;case Vt.MICROSECOND:return k.DurationMicrosecond;case Vt.NANOSECOND:return k.DurationNanosecond}return k.Duration;case k.Map:return k.Map;case k.List:return k.List;case k.Struct:return k.Struct;case k.Union:switch(r.mode){case lr.Dense:return k.DenseUnion;case lr.Sparse:return k.SparseUnion}return k.Union;case k.FixedSizeBinary:return k.FixedSizeBinary;case k.FixedSizeList:return k.FixedSizeList;case k.Dictionary:return k.Dictionary}throw new Error(`Unrecognized type '${k[r.typeId]}'`)}se.prototype.visitInt8=null;se.prototype.visitInt16=null;se.prototype.visitInt32=null;se.prototype.visitInt64=null;se.prototype.visitUint8=null;se.prototype.visitUint16=null;se.prototype.visitUint32=null;se.prototype.visitUint64=null;se.prototype.visitFloat16=null;se.prototype.visitFloat32=null;se.prototype.visitFloat64=null;se.prototype.visitDateDay=null;se.prototype.visitDateMillisecond=null;se.prototype.visitTimestampSecond=null;se.prototype.visitTimestampMillisecond=null;se.prototype.visitTimestampMicrosecond=null;se.prototype.visitTimestampNanosecond=null;se.prototype.visitTimeSecond=null;se.prototype.visitTimeMillisecond=null;se.prototype.visitTimeMicrosecond=null;se.prototype.visitTimeNanosecond=null;se.prototype.visitDenseUnion=null;se.prototype.visitSparseUnion=null;se.prototype.visitIntervalDayTime=null;se.prototype.visitIntervalYearMonth=null;se.prototype.visitDuration=null;se.prototype.visitDurationSecond=null;se.prototype.visitDurationMillisecond=null;se.prototype.visitDurationMicrosecond=null;se.prototype.visitDurationNanosecond=null;const mw=new Float64Array(1),Ws=new Uint32Array(mw.buffer);function gw(r){const t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function dF(r){if(r!==r)return 32256;mw[0]=r;const t=(Ws[1]&2147483648)>>16&65535;let e=Ws[1]&2146435072,n=0;return e>=1089470464?Ws[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Ws[1]&1048575)>>10):e<=1056964608?(n=1048576+(Ws[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Ws[1]&1048575)+512>>10),t|e|n&65535}let jt=class extends se{};function Yt(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}const fF=(r,t,e)=>{r[t]=Math.floor(e/864e5)},yw=(r,t,e,n)=>{if(e+1{const i=r+e;n?t[i>>3]|=1<>3]&=~(1<{r[t]=e},tp=({values:r},t,e)=>{r[t]=e},vw=({values:r},t,e)=>{r[t]=dF(e)},mF=(r,t,e)=>{switch(r.type.precision){case ar.HALF:return vw(r,t,e);case ar.SINGLE:case ar.DOUBLE:return tp(r,t,e)}},_w=({values:r},t,e)=>{fF(r,t,e.valueOf())},bw=({values:r},t,e)=>{r[t]=BigInt(e)},gF=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},ww=({values:r,valueOffsets:t},e,n)=>yw(r,t,e,n),xw=({values:r,valueOffsets:t},e,n)=>yw(r,t,e,Zf(n)),yF=(r,t,e)=>{r.type.unit===nn.DAY?_w(r,t,e):bw(r,t,e)},Sw=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},Tw=({values:r},t,e)=>{r[t]=BigInt(e)},Iw=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},Ew=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},vF=(r,t,e)=>{switch(r.type.unit){case Vt.SECOND:return Sw(r,t,e);case Vt.MILLISECOND:return Tw(r,t,e);case Vt.MICROSECOND:return Iw(r,t,e);case Vt.NANOSECOND:return Ew(r,t,e)}},Aw=({values:r},t,e)=>{r[t]=e},Mw=({values:r},t,e)=>{r[t]=e},Cw=({values:r},t,e)=>{r[t]=e},Ow=({values:r},t,e)=>{r[t]=e},_F=(r,t,e)=>{switch(r.type.unit){case Vt.SECOND:return Aw(r,t,e);case Vt.MILLISECOND:return Mw(r,t,e);case Vt.MICROSECOND:return Cw(r,t,e);case Vt.NANOSECOND:return Ow(r,t,e)}},bF=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},wF=(r,t,e)=>{const n=r.children[0],i=r.valueOffsets,s=sn.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],l=i[t+1];a{const n=r.children[0],{valueOffsets:i}=r,s=sn.getVisitFn(n);let{[t]:o,[t+1]:a}=i;const l=e instanceof Map?e.entries():Object.entries(e);for(const u of l)if(s(n,o,u),++o>=a)break},SF=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),TF=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),IF=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),EF=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),AF=(r,t,e)=>{const n=r.type.children.map(s=>sn.getVisitFn(s.type)),i=e instanceof Map?IF(t,e):e instanceof Ne?TF(t,e):Array.isArray(e)?SF(t,e):EF(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},MF=(r,t,e)=>{r.type.mode===lr.Dense?Pw(r,t,e):Rw(r,t,e)},Pw=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];sn.visit(i,r.valueOffsets[t],e)},Rw=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];sn.visit(i,t,e)},CF=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},OF=(r,t,e)=>{r.type.unit===zn.DAY_TIME?Fw(r,t,e):Dw(r,t,e)},Fw=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Dw=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Lw=({values:r},t,e)=>{r[t]=e},Nw=({values:r},t,e)=>{r[t]=e},Bw=({values:r},t,e)=>{r[t]=e},Uw=({values:r},t,e)=>{r[t]=e},PF=(r,t,e)=>{switch(r.type.unit){case Vt.SECOND:return Lw(r,t,e);case Vt.MILLISECOND:return Nw(r,t,e);case Vt.MICROSECOND:return Bw(r,t,e);case Vt.NANOSECOND:return Uw(r,t,e)}},RF=(r,t,e)=>{const{stride:n}=r,i=r.children[0],s=sn.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o`${Ba(t)}: ${Ba(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new FF(this[un],this[bo])}},FF=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return te.name)}has(t,e){return t[un].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[un].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[un].type.children.findIndex(i=>i.name===e);if(n!==-1){const i=xr.visit(t[un].children[n],t[bo]);return Reflect.set(t,e,i),i}}set(t,e,n){const i=t[un].type.children.findIndex(s=>s.name===e);return i!==-1?(sn.visit(t[un].children[i],t[bo],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}},Ft=class extends se{};function $t(r){return(t,e)=>t.getValid(e)?r(t,e):null}const LF=(r,t)=>864e5*r[t],NF=(r,t)=>null,kw=(r,t,e)=>{if(e+1>=t.length)return null;const n=Te(t[e]),i=Te(t[e+1]);return r.subarray(n,i)},BF=({offset:r,values:t},e)=>{const n=r+e;return(t[n>>3]&1<LF(r,t),Vw=({values:r},t)=>Te(r[t]),zi=({stride:r,values:t},e)=>t[r*e],UF=({stride:r,values:t},e)=>gw(t[r*e]),jw=({values:r},t)=>r[t],kF=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),$w=({values:r,valueOffsets:t},e)=>kw(r,t,e),Gw=({values:r,valueOffsets:t},e)=>{const n=kw(r,t,e);return n!==null?Wd(n):null},zF=({values:r},t)=>r[t],VF=({type:r,values:t},e)=>r.precision!==ar.HALF?t[e]:gw(t[e]),jF=(r,t)=>r.type.unit===nn.DAY?zw(r,t):Vw(r,t),Ww=({values:r},t)=>1e3*Te(r[t]),Hw=({values:r},t)=>Te(r[t]),Xw=({values:r},t)=>Gb(r[t],BigInt(1e3)),Yw=({values:r},t)=>Gb(r[t],BigInt(1e6)),$F=(r,t)=>{switch(r.type.unit){case Vt.SECOND:return Ww(r,t);case Vt.MILLISECOND:return Hw(r,t);case Vt.MICROSECOND:return Xw(r,t);case Vt.NANOSECOND:return Yw(r,t)}},qw=({values:r},t)=>r[t],Qw=({values:r},t)=>r[t],Zw=({values:r},t)=>r[t],Kw=({values:r},t)=>r[t],GF=(r,t)=>{switch(r.type.unit){case Vt.SECOND:return qw(r,t);case Vt.MILLISECOND:return Qw(r,t);case Vt.MICROSECOND:return Zw(r,t);case Vt.NANOSECOND:return Kw(r,t)}},WF=({values:r,stride:t},e)=>uF.decimal(r.subarray(t*e,t*(e+1))),HF=(r,t)=>{const{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,l=i[0].slice(s,o-s);return new Ne([l])},XF=(r,t)=>{const{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new rp(o.slice(i,s-i))},YF=(r,t)=>new ep(r,t),qF=(r,t)=>r.type.mode===lr.Dense?Jw(r,t):tx(r,t),Jw=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return xr.visit(n,r.valueOffsets[t])},tx=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return xr.visit(n,t)},QF=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},ZF=(r,t)=>r.type.unit===zn.DAY_TIME?ex(r,t):rx(r,t),ex=({values:r},t)=>r.subarray(2*t,2*(t+1)),rx=({values:r},t)=>{const e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},nx=({values:r},t)=>r[t],ix=({values:r},t)=>r[t],sx=({values:r},t)=>r[t],ox=({values:r},t)=>r[t],KF=(r,t)=>{switch(r.type.unit){case Vt.SECOND:return nx(r,t);case Vt.MILLISECOND:return ix(r,t);case Vt.MICROSECOND:return sx(r,t);case Vt.NANOSECOND:return ox(r,t)}},JF=(r,t)=>{const{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new Ne([s])};Ft.prototype.visitNull=$t(NF);Ft.prototype.visitBool=$t(BF);Ft.prototype.visitInt=$t(zF);Ft.prototype.visitInt8=$t(zi);Ft.prototype.visitInt16=$t(zi);Ft.prototype.visitInt32=$t(zi);Ft.prototype.visitInt64=$t(jw);Ft.prototype.visitUint8=$t(zi);Ft.prototype.visitUint16=$t(zi);Ft.prototype.visitUint32=$t(zi);Ft.prototype.visitUint64=$t(jw);Ft.prototype.visitFloat=$t(VF);Ft.prototype.visitFloat16=$t(UF);Ft.prototype.visitFloat32=$t(zi);Ft.prototype.visitFloat64=$t(zi);Ft.prototype.visitUtf8=$t(Gw);Ft.prototype.visitLargeUtf8=$t(Gw);Ft.prototype.visitBinary=$t($w);Ft.prototype.visitLargeBinary=$t($w);Ft.prototype.visitFixedSizeBinary=$t(kF);Ft.prototype.visitDate=$t(jF);Ft.prototype.visitDateDay=$t(zw);Ft.prototype.visitDateMillisecond=$t(Vw);Ft.prototype.visitTimestamp=$t($F);Ft.prototype.visitTimestampSecond=$t(Ww);Ft.prototype.visitTimestampMillisecond=$t(Hw);Ft.prototype.visitTimestampMicrosecond=$t(Xw);Ft.prototype.visitTimestampNanosecond=$t(Yw);Ft.prototype.visitTime=$t(GF);Ft.prototype.visitTimeSecond=$t(qw);Ft.prototype.visitTimeMillisecond=$t(Qw);Ft.prototype.visitTimeMicrosecond=$t(Zw);Ft.prototype.visitTimeNanosecond=$t(Kw);Ft.prototype.visitDecimal=$t(WF);Ft.prototype.visitList=$t(HF);Ft.prototype.visitStruct=$t(YF);Ft.prototype.visitUnion=$t(qF);Ft.prototype.visitDenseUnion=$t(Jw);Ft.prototype.visitSparseUnion=$t(tx);Ft.prototype.visitDictionary=$t(QF);Ft.prototype.visitInterval=$t(ZF);Ft.prototype.visitIntervalDayTime=$t(ex);Ft.prototype.visitIntervalYearMonth=$t(rx);Ft.prototype.visitDuration=$t(KF);Ft.prototype.visitDurationSecond=$t(nx);Ft.prototype.visitDurationMillisecond=$t(ix);Ft.prototype.visitDurationMicrosecond=$t(sx);Ft.prototype.visitDurationNanosecond=$t(ox);Ft.prototype.visitFixedSizeList=$t(JF);Ft.prototype.visitMap=$t(XF);const xr=new Ft,so=Symbol.for("keys"),wo=Symbol.for("vals"),oo=Symbol.for("kKeysAsStrings"),Kd=Symbol.for("_kKeysAsStrings");let rp=class{constructor(t){return this[so]=new Ne([t.children[0]]).memoize(),this[wo]=t.children[1],new Proxy(this,new e2)}get[oo](){return this[Kd]||(this[Kd]=Array.from(this[so].toArray(),String))}[Symbol.iterator](){return new t2(this[so],this[wo])}get size(){return this[so].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[so],e=this[wo],n={};for(let i=-1,s=t.length;++i`${Ba(t)}: ${Ba(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},t2=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),xr.visit(this.vals,t)]})}},e2=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[oo]}has(t,e){return t[oo].includes(e)}getOwnPropertyDescriptor(t,e){if(t[oo].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[oo].indexOf(e);if(n!==-1){const i=xr.visit(Reflect.get(t,wo),n);return Reflect.set(t,e,i),i}}set(t,e,n){const i=t[oo].indexOf(e);return i!==-1?(sn.visit(Reflect.get(t,wo),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(rp.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[so]:{writable:!0,enumerable:!1,configurable:!1,value:null},[wo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Kd]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let cy;function ax(r,t,e,n){const{length:i=0}=r;let s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),n?n(r,s,o):[s,o]}const np=(r,t)=>r<0?t+r:r,hy=r=>r!==r;function ko(r){if(typeof r!=="object"||r===null)return hy(r)?hy:e=>e===r;if(r instanceof Date){const e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?KR(r,e):!1:r instanceof Map?n2(r):Array.isArray(r)?r2(r):r instanceof Ne?i2(r):s2(r,!0)}function r2(r){const t=[];for(let e=-1,n=r.length;++e!1;const n=[];for(let i=-1,s=e.length;++i{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return o2(r,e);case Map:return dy(r,e,e.keys());case rp:case ep:case Object:case void 0:return dy(r,e,t||Object.keys(e))}return e instanceof Ne?a2(r,e):!1}}function o2(r,t){const e=r.length;if(t.length!==e)return!1;for(let n=-1;++n>n}function Ru(r,t,e){const n=e.byteLength+7&-8;if(r>0||e.byteLength>3):Fu(new ip(e,r,t,null,lx)).subarray(0,n)),i}return e}function Fu(r){const t=[];let e=0,n=0,i=0;for(const o of r)o&&(i|=1<0)&&(t[e++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}let ip=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8===0?0:8-t%8);return Jd(r,t,i)+Jd(r,n,e)+u2(r,i>>3,n-i>>3)}function u2(r,t,e){let n=0,i=Math.trunc(t);const s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=Oh(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Oh(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Oh(s.getUint8(i)),i+=1;return n}function Oh(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const c2=-1;let Ae=class tf{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return Ot.isSparseUnion(t)?this.children.some(e=>e.nullable):Ot.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(Ot.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=c2&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-Jd(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof tf?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=ii(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:e}=this;if(Ot.isUnion(e)){const n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===lr.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<>3;(!s||s.byteLength<=c)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(Ru(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const h=s[c];n=(h&u)!==0,s[c]=e?h|u:h&~u}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new tf(t,e,n,i,s,o,this.dictionary)}slice(t,e){const{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,l=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===k.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<0&&i.set(Ru(this.offset,e,this.nullBitmap),0);const s=this.buffers;return s[ni.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s;const{buffers:o}=this;return(s=o[ni.TYPE])&&(o[ni.TYPE]=s.subarray(t,t+e)),(s=o[ni.OFFSET])&&(o[ni.OFFSET]=s.subarray(t,t+e+1))||(s=o[ni.DATA])&&(o[ni.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};Ae.prototype.children=Object.freeze([]);class Sa extends se{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new Ae(e,n,i,i)}visitBool(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitInt(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitFloat(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitUtf8(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.data),s=ce(t.nullBitmap),o=ia(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,i,s])}visitLargeUtf8(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.data),s=ce(t.nullBitmap),o=Jg(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,i,s])}visitBinary(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.data),s=ce(t.nullBitmap),o=ia(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,i,s])}visitLargeBinary(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.data),s=ce(t.nullBitmap),o=Jg(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,i,s])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitDate(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitTimestamp(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitTime(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitDecimal(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitList(t){const{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=ce(t.nullBitmap),o=ia(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,void 0,s],[i])}visitStruct(t){const{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=ce(t.nullBitmap),{length:o=i.reduce((l,{length:u})=>Math.max(l,u),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=xe(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(Ot.isSparseUnion(e))return new Ae(e,n,o,a,[void 0,void 0,void 0,s],i);const l=ia(t.valueOffsets);return new Ae(e,n,o,a,[l,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.indices.ArrayType,t.data),{["dictionary"]:o=new Ne([new Sa().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[void 0,s,i],[],o)}visitInterval(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitDuration(t){const{["type"]:e,["offset"]:n=0}=t,i=ce(t.nullBitmap),s=xe(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:e,["offset"]:n=0,["child"]:i=new Sa().visit({type:e.valueType})}=t,s=ce(t.nullBitmap),{["length"]:o=i.length/ii(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Ae(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:e,["offset"]:n=0,["child"]:i=new Sa().visit({type:e.childType})}=t,s=ce(t.nullBitmap),o=ia(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new Ae(e,n,a,l,[o,void 0,s],[i])}}const h2=new Sa;function le(r){return h2.visit(r)}let fy=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function ux(r){return r.reduce((t,e)=>t+e.nullCount,0)}function cx(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function hx(r,t,e,n){const i=[];for(let s=-1,o=r.length;++s=n)break;if(e>=l+u)continue;if(l>=e&&l+u<=n){i.push(a);continue}const c=Math.max(0,e-l),h=Math.min(n-l,u);i.push(a.slice(c,h-c))}return i.length===0&&i.push(r[0].slice(0,0)),i}function sp(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e0?0:-1}function p2(r,t){const{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(const i of new ip(e,r.offset+(t||0),r.length,e,lx)){if(!i)return n;++n}return-1}function Zt(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case k.Union:break;case k.Dictionary:break;default:return p2(r,e)}const n=xr.getVisitFn(r),i=ko(t);for(let s=(e||0)-1,o=r.length;++s{const i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new fy(r.data.length,n=>{const s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new m2(o)})}let m2=class{constructor(t){this.vector=t,this.index=0}next(){return this.indexa.data):t;if(s.length===0||s.some(a=>!(a instanceof Ae)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:u}=gx[o.typeId],c=s[0];this.isValid=h=>op(c,h),this.get=h=>a(c,h),this.set=(h,f)=>l(c,h,f),this.indexOf=h=>u(c,h),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,yx[o.typeId]),this._offsets=cx(s);break}this.data=s,this.type=o,this.stride=ii(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return d2(this.data)}get nullCount(){return ux(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${k[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(np(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return ap.visit(this)}concat(...t){return new ls(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new ls(ax(this,t,e,({data:n,_offsets:i},s,o)=>hx(n,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case k.Int:case k.Float:case k.Decimal:case k.Time:case k.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return Ot.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Ot.isDictionary(this.type)){const t=new py(this.data[0].dictionary),e=this.data.map(n=>{const i=n.clone();return i.dictionary=t,i});return new ls(e)}return new py(this)}unmemoize(){if(Ot.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const i=n.clone();return i.dictionary=t,i});return new ls(e)}return this}};mx=Symbol.toStringTag;Ne[mx]=(r=>{r.type=Ot.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const t=Object.keys(k).map(e=>k[e]).filter(e=>typeof e=="number"&&e!==k.NONE);for(const e of t){const n=xr.getVisitFnByTypeId(e),i=sn.getVisitFnByTypeId(e),s=Lu.getVisitFnByTypeId(e);gx[e]={get:n,set:i,indexOf:s},yx[e]=Object.create(r,{isValid:{value:Du(op)},get:{value:Du(xr.getVisitFnByTypeId(e))},set:{value:dx(sn.getVisitFnByTypeId(e))},indexOf:{value:fx(Lu.getVisitFnByTypeId(e))}})}return"Vector"})(Ne.prototype);let py=class vx extends Ne{constructor(t){super(t.data);const e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const l=e.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new vx(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ne(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};class ef{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}}class Er{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Er).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+_e),(e||new Er).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):je.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new In).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new ef).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const n=this.bb.__offset(this.bb_pos,10);return n?(e||new ef).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,je.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}let Le=class us{constructor(t=[],e,n,i=je.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=rf(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){const e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new us(n,this.metadata)}selectAt(t){const e=t.map(n=>this.fields[n]).filter(Boolean);return new us(e,this.metadata)}assign(...t){const e=t[0]instanceof us?t[0]:Array.isArray(t[0])?new us(t[0]):new us(t),n=[...this.fields],i=Ll(Ll(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{const l=n.findIndex(u=>u.name===a.name);return~l?(n[l]=a.clone({metadata:Ll(Ll(new Map,n[l].metadata),a.metadata)}))&&!1:!0}),o=rf(s,new Map);return new us([...n,...s],i,new Map([...this.dictionaries,...o]))}};Le.prototype.fields=null;Le.prototype.metadata=null;Le.prototype.dictionaries=null;class Pe{static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new Pe(`${e}`,n,i,s)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],Pe.new(e,n,i,s)}}Pe.prototype.type=null;Pe.prototype.name=null;Pe.prototype.nullable=null;Pe.prototype.metadata=null;function Ll(r,t){return new Map([...r||new Map,...t||new Map])}function rf(r,t=new Map){for(let e=-1,n=r.length;++e0&&rf(s.children,t)}return t}var g2=zb,y2=Mo;class Va{static decode(t){t=new y2(ce(t));const e=Er.getRootAsFooter(t),n=Le.decode(e.schema(),new Map,e.version());return new v2(n,e)}static encode(t){const e=new g2,n=Le.encode(e,t.schema);Er.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())Di.encode(e,o);const i=e.endVector();Er.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())Di.encode(e,o);const s=e.endVector();return Er.startFooter(e),Er.addSchema(e,n),Er.addVersion(e,je.V5),Er.addRecordBatches(e,i),Er.addDictionaries(e,s),Er.finishFooterBuffer(e,Er.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=je.V5,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Jt(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Be);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Yr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Yr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Jt(this,void 0,void 0,function*(){return yield this.abort(t),Be})}return(t){return Jt(this,void 0,void 0,function*(){return yield this.close(),Be})}read(t){return Jt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Jt(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(Be)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Xl extends _2{write(t){if((t=ce(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Wd(this.toUint8Array(!0)):this.toUint8Array(!1).then(Wd)}toUint8Array(t=!1){return t?kn(this._values)[0]:Jt(this,void 0,void 0,function*(){var e,n,i,s;const o=[];let a=0;try{for(var l=!0,u=Bn(this),c;c=yield u.next(),e=c.done,!e;l=!0){s=c.value,l=!1;const h=s;o.push(h),a+=h.byteLength}}catch(h){n={error:h}}finally{try{!l&&!e&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return kn(o,a)[0]})}}class Nu{constructor(t){t&&(this.source=new b2(Yr.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Po{constructor(t){t instanceof Po?this.source=t.source:t instanceof Xl?this.source=new ts(Yr.fromAsyncIterable(t)):Nb(t)?this.source=new ts(Yr.fromNodeStream(t)):Kf(t)?this.source=new ts(Yr.fromDOMStream(t)):Lb(t)?this.source=new ts(Yr.fromDOMStream(t.body)):Qa(t)?this.source=new ts(Yr.fromIterable(t)):Is(t)?this.source=new ts(Yr.fromAsyncIterable(t)):Uo(t)&&(this.source=new ts(Yr.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class b2{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Be)}return(t){return Object.create(this.source.return&&this.source.return(t)||Be)}}class ts{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return Jt(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Jt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Jt(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Jt(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return Jt(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||Be;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return Jt(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||Be;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class gy extends Nu{constructor(t,e){super(),this.position=0,this.buffer=ce(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${fo(this.buffer[3])} ${fo(this.buffer[2])} ${fo(this.buffer[1])} ${fo(this.buffer[0])}`}static multiply(t,e){return new ti(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ti(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return ti.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return ti.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),i=t.length,s=new ti(e);for(let o=n?1:0;o0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class S2 extends bx{constructor(t,e,n,i,s){super(new Uint8Array(0),e,n,i,s),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Fu(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return xe(Uint8Array,xe(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return xe(Uint8Array,xe(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return Ot.isTimestamp(t)||(Ot.isInt(t)||Ot.isTime(t))&&t.bitWidth===64||Ot.isDuration(t)||Ot.isDate(t)&&t.unit===nn.MILLISECOND?xe(Uint8Array,Ta.convertArray(n[e])):Ot.isDecimal(t)?xe(Uint8Array,x2.convertArray(n[e])):Ot.isBinary(t)||Ot.isLargeBinary(t)||Ot.isFixedSizeBinary(t)?T2(n[e]):Ot.isBool(t)?Fu(n[e]):Ot.isUtf8(t)||Ot.isLargeUtf8(t)?Zf(n[e].join("")):xe(Uint8Array,xe(t.ArrayType,n[e].map(i=>+i)))}}function T2(r){const t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n>1]=Number.parseInt(t.slice(n,n+2),16);return e}let Nt=class extends se{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function mr(r,t){return t instanceof r.constructor}function Fs(r,t){return r===t||mr(r,t)}function fi(r,t){return r===t||mr(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function lc(r,t){return r===t||mr(r,t)&&r.precision===t.precision}function I2(r,t){return r===t||mr(r,t)&&r.byteWidth===t.byteWidth}function cp(r,t){return r===t||mr(r,t)&&r.unit===t.unit}function Za(r,t){return r===t||mr(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Ka(r,t){return r===t||mr(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function E2(r,t){return r===t||mr(r,t)&&r.children.length===t.children.length&&Li.compareManyFields(r.children,t.children)}function A2(r,t){return r===t||mr(r,t)&&r.children.length===t.children.length&&Li.compareManyFields(r.children,t.children)}function hp(r,t){return r===t||mr(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Li.compareManyFields(r.children,t.children)}function M2(r,t){return r===t||mr(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Li.visit(r.indices,t.indices)&&Li.visit(r.dictionary,t.dictionary)}function dp(r,t){return r===t||mr(r,t)&&r.unit===t.unit}function Ja(r,t){return r===t||mr(r,t)&&r.unit===t.unit}function C2(r,t){return r===t||mr(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Li.compareManyFields(r.children,t.children)}function O2(r,t){return r===t||mr(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Li.compareManyFields(r.children,t.children)}Nt.prototype.visitNull=Fs;Nt.prototype.visitBool=Fs;Nt.prototype.visitInt=fi;Nt.prototype.visitInt8=fi;Nt.prototype.visitInt16=fi;Nt.prototype.visitInt32=fi;Nt.prototype.visitInt64=fi;Nt.prototype.visitUint8=fi;Nt.prototype.visitUint16=fi;Nt.prototype.visitUint32=fi;Nt.prototype.visitUint64=fi;Nt.prototype.visitFloat=lc;Nt.prototype.visitFloat16=lc;Nt.prototype.visitFloat32=lc;Nt.prototype.visitFloat64=lc;Nt.prototype.visitUtf8=Fs;Nt.prototype.visitLargeUtf8=Fs;Nt.prototype.visitBinary=Fs;Nt.prototype.visitLargeBinary=Fs;Nt.prototype.visitFixedSizeBinary=I2;Nt.prototype.visitDate=cp;Nt.prototype.visitDateDay=cp;Nt.prototype.visitDateMillisecond=cp;Nt.prototype.visitTimestamp=Za;Nt.prototype.visitTimestampSecond=Za;Nt.prototype.visitTimestampMillisecond=Za;Nt.prototype.visitTimestampMicrosecond=Za;Nt.prototype.visitTimestampNanosecond=Za;Nt.prototype.visitTime=Ka;Nt.prototype.visitTimeSecond=Ka;Nt.prototype.visitTimeMillisecond=Ka;Nt.prototype.visitTimeMicrosecond=Ka;Nt.prototype.visitTimeNanosecond=Ka;Nt.prototype.visitDecimal=Fs;Nt.prototype.visitList=E2;Nt.prototype.visitStruct=A2;Nt.prototype.visitUnion=hp;Nt.prototype.visitDenseUnion=hp;Nt.prototype.visitSparseUnion=hp;Nt.prototype.visitDictionary=M2;Nt.prototype.visitInterval=dp;Nt.prototype.visitIntervalDayTime=dp;Nt.prototype.visitIntervalYearMonth=dp;Nt.prototype.visitDuration=Ja;Nt.prototype.visitDurationSecond=Ja;Nt.prototype.visitDurationMillisecond=Ja;Nt.prototype.visitDurationMicrosecond=Ja;Nt.prototype.visitDurationNanosecond=Ja;Nt.prototype.visitFixedSizeList=C2;Nt.prototype.visitMap=O2;const Li=new Nt;function nf(r,t){return Li.compareSchemas(r,t)}function Ph(r,t){return P2(r,t.map(e=>e.data.concat()))}function P2(r,t){const e=[...r.fields],n=[],i={numBatches:t.reduce((h,f)=>Math.max(h,f.length),0)};let s=0,o=0,a=-1;const l=t.length;let u,c=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a0&&(n[s++]=le({type:new dr(e),length:o,nullCount:0,children:c.slice()})))}return[r=r.assign(e),n.map(h=>new _r(r,h))]}function R2(r,t,e,n,i){var s;const o=(t+63&-64)>>3;for(let a=-1,l=n.length;++a=t)c===t?e[a]=u:(e[a]=u.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(u.slice(t,c-t))));else{const h=r[a];r[a]=h.clone({nullable:!0}),e[a]=(s=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:le({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var wx;let Ni=class cs{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new Le([]),this._offsets=[0],this;let i,s;t[0]instanceof Le&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());const o=l=>{if(l){if(l instanceof _r)return[l];if(l instanceof cs)return l.batches;if(l instanceof Ae){if(l.type instanceof dr)return[new _r(new Le(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(u=>o(u));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(u=>o(u));if(typeof l=="object"){const u=Object.keys(l),c=u.map(d=>new Ne([l[d]])),h=i??new Le(u.map((d,m)=>new Pe(String(d),c[m].type,c[m].nullable))),[,f]=Ph(h,c);return f.length===0?[new _r(l)]:f}}}return[]},a=t.flatMap(l=>o(l));if(i=(n=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new Le([]),!(i instanceof Le))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of a){if(!(l instanceof _r))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!nf(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??cx(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=ux(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(np(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?ap.visit(new Ne(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ ${this.toArray().join(`, `)} -]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new cs(e,n.map(i=>new _r(e,i)))}slice(t,e){const n=this.schema;[t,e]=ax({length:this.numRows},t,e);const i=hx(this.data,this._offsets,t,e);return new cs(n,i.map(s=>new _r(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&tn.children[t]);if(e.length===0){const{type:n}=this.schema.fields[t],i=le({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Ne(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&tthis.getChildAt(u));[s[t],a[t]]=[o,e],[n,i]=Ph(n,a)}return new cs(n,i)}select(t){const e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new cs(e,n)}assign(t){const e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,l,u)=>{const[c,h]=a,f=e.findIndex(d=>d.name===l.name);return~f?h[f]=u:c.push(u),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,l)=>[l,i[l]]).map(([a,l])=>l===void 0?this.getChildAt(a):t.getChildAt(l)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new cs(...Ph(s,o))}};wx=Symbol.toStringTag;Li[wx]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Du(op),r.get=Du(xr.getVisitFn(k.Struct)),r.set=dx(sn.getVisitFn(k.Struct)),r.indexOf=fx(Lu.getVisitFn(k.Struct)),"Table"))(Li.prototype);var xx;let _r=class ba{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Le))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=le({nullCount:0,type:new dr(this.schema.fields),children:this.schema.fields.map(e=>le({type:e.type,nullCount:0}))})]=t,!(this.data instanceof Ae))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=yy(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((l,u,c)=>(l.children[c]=e[u],l.length=Math.max(l.length,e[u].length),l.fields[c]=Pe.new({name:u,type:e[u].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),o=new Le(n),a=le({type:new dr(n),length:s,children:i,nullCount:0});[this.schema,this.data]=yy(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Sx(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return xr.visit(this.data,t)}at(t){return this.get(np(t,this.numRows))}set(t,e){return sn.visit(this.data,t,e)}indexOf(t,e){return Lu.visit(this.data,t,e)}[Symbol.iterator](){return ap.visit(new Ne([this.data]))}toArray(){return[...this]}concat(...t){return new Li(this.schema,[this,...t])}slice(t,e){const[n]=new Ne([this.data]).slice(t,e).data;return new ba(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&ti.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&ta.name===s);~o&&(i[o]=this.data.children[o])}return new ba(e,le({type:n,length:this.numRows,children:i}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=le({type:new dr(e.fields),length:this.numRows,children:n});return new ba(e,i)}};xx=Symbol.toStringTag;_r[xx]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(_r.prototype);function yy(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;const i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(const[a,l]of r.fields.entries()){const u=t[a];(!u||u.length!==e)&&(i[a]=l.clone({nullable:!0}),s[a]=(n=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:le({type:l.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),le({type:new dr(i),length:e,children:s})]}function Sx(r,t,e=new Map){var n,i;if(((n=r==null?void 0:r.length)!==null&&n!==void 0?n:0)>0&&(r==null?void 0:r.length)===(t==null?void 0:t.length))for(let s=-1,o=r.length;++sle({type:i.type})),n=le({type:new dr(t.fields),nullCount:0,children:e});super(t,n)}}let bi=class Sn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new Sn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+_e),(e||new Sn).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):je.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):me.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,je.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,me.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return Sn.startMessage(t),Sn.addVersion(t,e),Sn.addHeaderType(t,n),Sn.addHeader(t,i),Sn.addBodyLength(t,s),Sn.addCustomMetadata(t,o),Sn.endMessage(t)}};class R2 extends se{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return ay.startNull(e),ay.endNull(e)}visitInt(t,e){return Cr.startInt(e),Cr.addBitWidth(e,t.bitWidth),Cr.addIsSigned(e,t.isSigned),Cr.endInt(e)}visitFloat(t,e){return Rn.startFloatingPoint(e),Rn.addPrecision(e,t.precision),Rn.endFloatingPoint(e)}visitBinary(t,e){return ry.startBinary(e),ry.endBinary(e)}visitLargeBinary(t,e){return iy.startLargeBinary(e),iy.endLargeBinary(e)}visitBool(t,e){return ny.startBool(e),ny.endBool(e)}visitUtf8(t,e){return ly.startUtf8(e),ly.endUtf8(e)}visitLargeUtf8(t,e){return sy.startLargeUtf8(e),sy.endLargeUtf8(e)}visitDecimal(t,e){return Js.startDecimal(e),Js.addScale(e,t.scale),Js.addPrecision(e,t.precision),Js.addBitWidth(e,t.bitWidth),Js.endDecimal(e)}visitDate(t,e){return Vl.startDate(e),Vl.addUnit(e,t.unit),Vl.endDate(e)}visitTime(t,e){return Zr.startTime(e),Zr.addUnit(e,t.unit),Zr.addBitWidth(e,t.bitWidth),Zr.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return Kr.startTimestamp(e),Kr.addUnit(e,t.unit),n!==void 0&&Kr.addTimezone(e,n),Kr.endTimestamp(e)}visitInterval(t,e){return Fn.startInterval(e),Fn.addUnit(e,t.unit),Fn.endInterval(e)}visitDuration(t,e){return jl.startDuration(e),jl.addUnit(e,t.unit),jl.endDuration(e)}visitList(t,e){return oy.startList(e),oy.endList(e)}visitStruct(t,e){return ys.startStruct_(e),ys.endStruct_(e)}visitUnion(t,e){vr.startTypeIdsVector(e,t.typeIds.length);const n=vr.createTypeIdsVector(e,t.typeIds);return vr.startUnion(e),vr.addMode(e,t.mode),vr.addTypeIds(e,n),vr.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return ai.startDictionaryEncoding(e),ai.addId(e,BigInt(t.id)),ai.addIsOrdered(e,t.isOrdered),n!==void 0&&ai.addIndexType(e,n),ai.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return $l.startFixedSizeBinary(e),$l.addByteWidth(e,t.byteWidth),$l.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Gl.startFixedSizeList(e),Gl.addListSize(e,t.listSize),Gl.endFixedSizeList(e)}visitMap(t,e){return Wl.startMap(e),Wl.addKeysSorted(e,t.keysSorted),Wl.endMap(e)}}const Rh=new R2;function F2(r,t=new Map){return new Le(L2(r,t),Yl(r.metadata),t)}function Tx(r){return new Br(r.count,Ix(r.columns),Ex(r.columns))}function D2(r){return new Vn(Tx(r.data),r.id,r.isDelta)}function L2(r,t){return(r.fields||[]).filter(Boolean).map(e=>Pe.fromJSON(e,t))}function vy(r,t){return(r.children||[]).filter(Boolean).map(e=>Pe.fromJSON(e,t))}function Ix(r){return(r||[]).reduce((t,e)=>[...t,new Ni(e.count,N2(e.VALIDITY)),...Ix(e.children)],[])}function Ex(r,t=[]){for(let e=-1,n=(r||[]).length;++et+ +(e===0),0)}function B2(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=by(r,vy(r,t)),i=new Pe(r.name,o,r.nullable,Yl(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?_y(n):new za,a=new Oo(t.get(e),n,e,s.isOrdered),i=new Pe(r.name,a,r.nullable,Yl(r.metadata))):(n=(n=s.indexType)?_y(n):new za,t.set(e,o=by(r,vy(r,t))),a=new Oo(o,n,e,s.isOrdered),i=new Pe(r.name,a,r.nullable,Yl(r.metadata))),i||null}function Yl(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function _y(r){return new Es(r.isSigned,r.bitWidth)}function by(r,t){const e=r.type.name;switch(e){case"NONE":return new Ri;case"null":return new Ri;case"binary":return new gu;case"largebinary":return new yu;case"utf8":return new vu;case"largeutf8":return new _u;case"bool":return new bu;case"list":return new Au((t||[])[0]);case"struct":return new dr(t||[]);case"struct_":return new dr(t||[])}switch(e){case"int":{const n=r.type;return new Es(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=r.type;return new mu(ar[n.precision])}case"decimal":{const n=r.type;return new wu(n.scale,n.precision,n.bitWidth)}case"date":{const n=r.type;return new xu(nn[n.unit])}case"time":{const n=r.type;return new Su(Vt[n.unit],n.bitWidth)}case"timestamp":{const n=r.type;return new Tu(Vt[n.unit],n.timezone)}case"interval":{const n=r.type;return new Iu(zn[n.unit])}case"duration":{const n=r.type;return new Eu(Vt[n.unit])}case"union":{const n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new Mu(lr[o],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=r.type;return new Cu(n.byteWidth)}case"fixedsizelist":{const n=r.type;return new Ou(n.listSize,(t||[])[0])}case"map":{const n=r.type;return new Pu((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var U2=zb,k2=Mo;class fr{static fromJSON(t,e){const n=new fr(0,je.V5,e);return n._createHeader=z2(t,e),n}static decode(t){t=new k2(ce(t));const e=bi.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new fr(n,i,s);return o._createHeader=V2(e,s),o}static encode(t){const e=new U2;let n=-1;return t.isSchema()?n=Le.encode(e,t.header()):t.isRecordBatch()?n=Br.encode(e,t.header()):t.isDictionaryBatch()&&(n=Vn.encode(e,t.header())),bi.startMessage(e),bi.addVersion(e,je.V5),bi.addHeader(e,n),bi.addHeaderType(e,t.headerType),bi.addBodyLength(e,BigInt(t.bodyLength)),bi.finishMessageBuffer(e,bi.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof Le)return new fr(0,je.V5,me.Schema,t);if(t instanceof Br)return new fr(e,je.V5,me.RecordBatch,t);if(t instanceof Vn)return new fr(e,je.V5,me.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===me.Schema}isRecordBatch(){return this.headerType===me.RecordBatch}isDictionaryBatch(){return this.headerType===me.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=Te(t)}}class Br{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=Te(t)}}class Vn{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=Te(e)}}class Ln{constructor(t,e){this.offset=Te(t),this.length=Te(e)}}class Ni{constructor(t,e){this.length=Te(t),this.nullCount=Te(e)}}function z2(r,t){return()=>{switch(t){case me.Schema:return Le.fromJSON(r);case me.RecordBatch:return Br.fromJSON(r);case me.DictionaryBatch:return Vn.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${me[t]}, type: ${t} }`)}}function V2(r,t){return()=>{switch(t){case me.Schema:return Le.decode(r.header(new In),new Map,r.version());case me.RecordBatch:return Br.decode(r.header(new ri),r.version());case me.DictionaryBatch:return Vn.decode(r.header(new Zs),r.version())}throw new Error(`Unrecognized Message type: { name: ${me[t]}, type: ${t} }`)}}Pe.encode=K2;Pe.decode=Q2;Pe.fromJSON=B2;Le.encode=Z2;Le.decode=j2;Le.fromJSON=F2;Br.encode=J2;Br.decode=$2;Br.fromJSON=Tx;Vn.encode=tD;Vn.decode=G2;Vn.fromJSON=D2;Ni.encode=eD;Ni.decode=H2;Ln.encode=rD;Ln.decode=W2;function j2(r,t=new Map,e=je.V5){const n=q2(r,t);return new Le(n,ql(r),t,e)}function $2(r,t=je.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Br(r.length(),X2(r),Y2(r,t))}function G2(r,t=je.V5){return new Vn(Br.decode(r.data(),t),r.id(),r.isDelta())}function W2(r){return new Ln(r.offset(),r.length())}function H2(r){return new Ni(r.length(),r.nullCount())}function X2(r){const t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++nPe.encode(r,s));In.startFieldsVector(r,e.length);const n=In.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?In.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{const a=r.createString(`${s}`),l=r.createString(`${o}`);return qe.startKeyValue(r),qe.addKey(r,a),qe.addValue(r,l),qe.endKeyValue(r)})):-1;return In.startSchema(r),In.addFields(r,n),In.addEndianness(r,nD?Co.Little:Co.Big),i!==-1&&In.addCustomMetadata(r,i),In.endSchema(r)}function K2(r,t){let e=-1,n=-1,i=-1;const s=t.type;let o=t.typeId;Ot.isDictionary(s)?(o=s.dictionary.typeId,i=Rh.visit(s,r),n=Rh.visit(s.dictionary,r)):n=Rh.visit(s,r);const a=(s.children||[]).map(c=>Pe.encode(r,c)),l=Wr.createChildrenVector(r,a),u=t.metadata&&t.metadata.size>0?Wr.createCustomMetadataVector(r,[...t.metadata].map(([c,h])=>{const f=r.createString(`${c}`),d=r.createString(`${h}`);return qe.startKeyValue(r),qe.addKey(r,f),qe.addValue(r,d),qe.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Wr.startField(r),Wr.addType(r,n),Wr.addTypeType(r,o),Wr.addChildren(r,l),Wr.addNullable(r,!!t.nullable),e!==-1&&Wr.addName(r,e),i!==-1&&Wr.addDictionary(r,i),u!==-1&&Wr.addCustomMetadata(r,u),Wr.endField(r)}function J2(r,t){const e=t.nodes||[],n=t.buffers||[];ri.startNodesVector(r,e.length);for(const o of e.slice().reverse())Ni.encode(r,o);const i=r.endVector();ri.startBuffersVector(r,n.length);for(const o of n.slice().reverse())Ln.encode(r,o);const s=r.endVector();return ri.startRecordBatch(r),ri.addLength(r,BigInt(t.length)),ri.addNodes(r,i),ri.addBuffers(r,s),ri.endRecordBatch(r)}function tD(r,t){const e=Br.encode(r,t.data);return Zs.startDictionaryBatch(r),Zs.addId(r,BigInt(t.id)),Zs.addIsDelta(r,t.isDelta),Zs.addData(r,e),Zs.endDictionaryBatch(r)}function eD(r,t){return $b.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function rD(r,t){return jb.createBuffer(r,BigInt(t.offset),BigInt(t.length))}const nD=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),pp=r=>`Expected ${me[r]} Message in stream, but was null or length 0.`,mp=r=>`Header pointer of flatbuffer-encoded ${me[r]} Message is null or length 0.`,Ax=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Mx=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`;class Cx{constructor(t){this.source=t instanceof Nu?t:new Nu(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?Be:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(pp(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=ce(this.source.read(t));if(e.byteLength[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(pp(t));return e.value}readSchema(){const t=me.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(mp(t));return n}}const uc=4,sf="ARROW1",ja=new Uint8Array(sf.length);for(let r=0;rthis):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Yr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Yr.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof tn?t:Hd(t)?cD(t):Db(t)?fD(t):Is(t)?Jt(this,void 0,void 0,function*(){return yield tn.from(yield t)}):Lb(t)||Kf(t)||Nb(t)||Uo(t)?dD(new Po(t)):hD(new Nu(t))}static readAll(t){return t instanceof tn?t.isSync()?Ty(t):Iy(t):Hd(t)||ArrayBuffer.isView(t)||Qa(t)||Fb(t)?Ty(t):Iy(t)}}class Uu extends tn{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return br(this,arguments,function*(){yield Rt(yield*Ss(Bn(this[Symbol.iterator]())))})}}class ku extends tn{constructor(t){super(t),this._impl=t}readAll(){return Jt(this,void 0,void 0,function*(){var t,e,n,i;const s=new Array;try{for(var o=!0,a=Bn(this),l;l=yield a.next(),t=l.done,!t;o=!0){i=l.value,o=!1;const u=i;s.push(u)}}catch(u){e={error:u}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Px extends Uu{constructor(t){super(t),this._impl=t}}class aD extends ku{constructor(t){super(t),this._impl=t}}class Rx{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const n=this._loadVectors(t,e,this.schema.fields),i=le({type:new dr(this.schema.fields),length:t.length,children:n});return new _r(this.schema,i)}_loadDictionaryBatch(t,e){const{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n),l=o.dictionaries.get(n),u=this._loadVectors(t.data,e,[l]);return(a&&i?a.concat(new Ne(u)):new Ne(u)).memoize()}_loadVectors(t,e,n){return new bx(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class zu extends Rx{constructor(t,e){super(e),this._reader=Hd(t)?new sD(this._handle=t):new Cx(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Dx(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Be}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Be}next(){if(this.closed)return Be;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new fp(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Vu extends Rx{constructor(t,e){super(e),this._reader=new iD(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Jt(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Jt(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Dx(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Jt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Be})}return(t){return Jt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Be})}next(){return Jt(this,void 0,void 0,function*(){if(this.closed)return Be;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new fp(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Jt(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Fx extends zu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof gy?t:new gy(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const i=this._reader.readMessage(me.RecordBatch);if(i!=null&&i.isRecordBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const i=this._reader.readMessage(me.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-Ox,n=t.readInt32(e),i=t.readAt(e-n,n);return Va.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return Jt(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return Jt(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const i=yield this._reader.readMessage(me.RecordBatch);if(i!=null&&i.isRecordBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return Jt(this,void 0,void 0,function*(){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const i=yield this._reader.readMessage(me.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return Jt(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-Ox,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Va.decode(i)})}_readNextMessageAndValidate(t){return Jt(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?gp(t)?new Px(new Fx(r.read())):new Uu(new zu(r)):new Uu(new zu(function*(){}()))}function dD(r){return Jt(this,void 0,void 0,function*(){const t=yield r.peek(tl+7&-8);return t&&t.byteLength>=4?gp(t)?new Px(new Fx(yield r.read())):new ku(new Vu(r)):new ku(new Vu(function(){return br(this,arguments,function*(){})}()))})}function fD(r){return Jt(this,void 0,void 0,function*(){const{size:t}=yield r.stat(),e=new Bu(r,t);return t>=oD&&gp(yield e.readAt(0,tl+7&-8))?new aD(new lD(e)):new ku(new Vu(e))})}class ke extends se{static assemble(...t){const e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof _r?s.data.children:s.data),n=new ke;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Ne)return this.visitMany(t.data),this;const{type:e}=t;if(!Ot.isDictionary(e)){const{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(Ot.isUnion(e))this.nodes.push(new Ni(n,0));else{const{nullCount:i}=t;Ot.isNull(e)||dn.call(this,i<=0?new Uint8Array(0):Ru(t.offset,n,t.nullBitmap)),this.nodes.push(new Ni(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function dn(r){const t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Ln(this._byteLength,t)),this._byteLength+=t,this}function pD(r){var t;const{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(dn.call(this,i),e.mode===lr.Sparse)return of.call(this,r);if(e.mode===lr.Dense){if(r.offset<=0)return dn.call(this,s),of.call(this,r);{const o=new Int32Array(n),a=Object.create(null),l=Object.create(null);for(let u,c,h=-1;++h{const h=e.typeIds[c],f=a[h],d=l[h];return u.slice(f,Math.min(n,d))}))}}return this}function mD(r){let t;return r.nullCount>=r.length?dn.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?dn.call(this,Ru(r.offset,r.length,t)):dn.call(this,Fu(r.values))}function fi(r){return dn.call(this,r.values.subarray(0,r.length*r.stride))}function cc(r){const{length:t,values:e,valueOffsets:n}=r,i=Te(n[0]),s=Te(n[t]),o=Math.min(s-i,e.byteLength-i);return dn.call(this,Ub(-i,t+1,n)),dn.call(this,e.subarray(i,i+o)),this}function yp(r){const{length:t,valueOffsets:e}=r;if(e){const{[0]:n,[t]:i}=e;return dn.call(this,Ub(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function of(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}ke.prototype.visitBool=mD;ke.prototype.visitInt=fi;ke.prototype.visitFloat=fi;ke.prototype.visitUtf8=cc;ke.prototype.visitLargeUtf8=cc;ke.prototype.visitBinary=cc;ke.prototype.visitLargeBinary=cc;ke.prototype.visitFixedSizeBinary=fi;ke.prototype.visitDate=fi;ke.prototype.visitTimestamp=fi;ke.prototype.visitTime=fi;ke.prototype.visitDecimal=fi;ke.prototype.visitList=yp;ke.prototype.visitStruct=of;ke.prototype.visitUnion=pD;ke.prototype.visitInterval=fi;ke.prototype.visitDuration=fi;ke.prototype.visitFixedSizeList=yp;ke.prototype.visitMap=yp;class Lx extends lp{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Xl,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,wr(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Is(t)?t.then(e=>this.writeAll(e)):Uo(t)?wp(this,t):bp(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Xl?this._sink=t:(this._sink=new Xl,t&&GR(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&WR(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!nf(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Li&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof _r&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!nf(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof _r?t instanceof fp||this._writeRecordBatch(t):t instanceof Li?this.writeAll(t.batches):Qa(t)&&this.writeAll(t)}_writeMessage(t,e=8){const n=e-1,i=fr.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,l=a-s-o;return t.headerType===me.RecordBatch?this._recordBatchBlocks.push(new Fi(a,t.bodyLength,this._position)):t.headerType===me.DictionaryBatch&&this._dictionaryBlocks.push(new Fi(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){const e=ce(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(fr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ja)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=ke.assemble(t),o=new Br(t.numRows,n,i),a=fr.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){const{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=ke.assemble(new Ne([t])),l=new Br(t.length,s,o),u=new Vn(l,e,n),c=fr.from(u,i);return this._writeMessage(c)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var e,n;for(const[i,s]of t.dictionaries){const o=(e=s==null?void 0:s.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(i),l=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(const[u,c]of o.entries())this._writeDictionaryBatch(c,i,u>0);else if(ln.writeAll(i)):Uo(t)?wp(n,t):bp(n,t)}}class _p extends Lx{static writeAll(t){const e=new _p;return Is(t)?t.then(n=>e.writeAll(n)):Uo(t)?wp(e,t):bp(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){const e=Va.encode(new Va(t,je.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function bp(r,t){let e=t;t instanceof Li&&(e=t.batches,r.reset(void 0,t.schema));for(const n of e)r.write(n);return r.finish()}function wp(r,t){return Jt(this,void 0,void 0,function*(){var e,n,i,s,o,a,l;try{for(e=!0,n=Bn(t);i=yield n.next(),s=i.done,!s;e=!0){l=i.value,e=!1;const u=l;r.write(u)}}catch(u){o={error:u}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function gD(r,t="stream"){return(t==="stream"?vp:_p).writeAll(r).toUint8Array(!0)}var yD=Object.create,Nx=Object.defineProperty,vD=Object.getOwnPropertyDescriptor,_D=Object.getOwnPropertyNames,bD=Object.getPrototypeOf,wD=Object.prototype.hasOwnProperty,xD=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),SD=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _D(t))!wD.call(r,i)&&i!==e&&Nx(r,i,{get:()=>t[i],enumerable:!(n=vD(t,i))||n.enumerable});return r},TD=(r,t,e)=>(e=r!=null?yD(bD(r)):{},SD(!r||!r.__esModule?Nx(e,"default",{value:r,enumerable:!0}):e,r)),ID=xD((r,t)=>{t.exports=Worker}),Bx=(r=>(r[r.UNDEFINED=0]="UNDEFINED",r[r.AUTOMATIC=1]="AUTOMATIC",r[r.READ_ONLY=2]="READ_ONLY",r[r.READ_WRITE=3]="READ_WRITE",r))(Bx||{}),ED=(r=>(r[r.IDENTIFIER=0]="IDENTIFIER",r[r.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",r[r.STRING_CONSTANT=2]="STRING_CONSTANT",r[r.OPERATOR=3]="OPERATOR",r[r.KEYWORD=4]="KEYWORD",r[r.COMMENT=5]="COMMENT",r))(ED||{}),AD=(r=>(r[r.NONE=0]="NONE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR",r))(AD||{}),MD=(r=>(r[r.NONE=0]="NONE",r[r.CONNECT=1]="CONNECT",r[r.DISCONNECT=2]="DISCONNECT",r[r.OPEN=3]="OPEN",r[r.QUERY=4]="QUERY",r[r.INSTANTIATE=5]="INSTANTIATE",r))(MD||{}),CD=(r=>(r[r.NONE=0]="NONE",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR",r[r.START=3]="START",r[r.RUN=4]="RUN",r[r.CAPTURE=5]="CAPTURE",r))(CD||{}),OD=(r=>(r[r.NONE=0]="NONE",r[r.WEB_WORKER=1]="WEB_WORKER",r[r.NODE_WORKER=2]="NODE_WORKER",r[r.BINDINGS=3]="BINDINGS",r[r.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",r))(OD||{}),PD=class{log(r){}},Ux=class{constructor(r=2){this.level=r}log(r){r.level>=this.level&&console.log(r)}},RD=(r=>(r[r.SUCCESS=0]="SUCCESS",r))(RD||{}),FD=class{constructor(r,t){this._bindings=r,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(r){return r(this._bindings,this._conn)}async query(r){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:r});let t=await this._bindings.runQuery(this._conn,r),e=tn.from(t);return console.assert(e.isSync(),"Reader is not sync"),console.assert(e.isFile(),"Reader is not file"),new Li(e)}async send(r,t=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:r});let e=await this._bindings.startPendingQuery(this._conn,r,t);for(;e==null;)e=await this._bindings.pollPendingQuery(this._conn);let n=new kx(this._bindings,this._conn,e),i=await tn.from(n);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(r){return await this._bindings.getTableNames(this._conn,r)}async prepare(r){let t=await this._bindings.createPrepared(this._conn,r);return new DD(this._bindings,this._conn,t)}async insertArrowTable(r,t){let e=gD(r,"stream");await this.insertArrowFromIPCStream(e,t)}async insertArrowFromIPCStream(r,t){await this._bindings.insertArrowFromIPCStream(this._conn,r,t)}async insertCSVFromPath(r,t){await this._bindings.insertCSVFromPath(this._conn,r,t)}async insertJSONFromPath(r,t){await this._bindings.insertJSONFromPath(this._conn,r,t)}},kx=class{constructor(r,t,e){this.db=r,this.conn=t,this.header=e,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let r;return this._inFlight!=null?(r=await this._inFlight,this._inFlight=null):r=await this.db.fetchQueryResults(this.conn),this._depleted=r.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:r}}[Symbol.asyncIterator](){return this}},DD=class{constructor(r,t,e){this.bindings=r,this.connectionId=t,this.statementId=e}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...r){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,r),e=tn.from(t);return console.assert(e.isSync()),console.assert(e.isFile()),new Li(e)}async send(...r){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,r),e=new kx(this.bindings,this.connectionId,t),n=await tn.from(e);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},LD=(r=>(r.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",r.CLOSE_PREPARED="CLOSE_PREPARED",r.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",r.REGISTER_OPFS_FILE_NAME="REGISTER_OPFS_FILE_NAME",r.CONNECT="CONNECT",r.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",r.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",r.CREATE_PREPARED="CREATE_PREPARED",r.DISCONNECT="DISCONNECT",r.DROP_FILE="DROP_FILE",r.DROP_FILES="DROP_FILES",r.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",r.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",r.FLUSH_FILES="FLUSH_FILES",r.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",r.GET_TABLE_NAMES="GET_TABLE_NAMES",r.GET_VERSION="GET_VERSION",r.GLOB_FILE_INFOS="GLOB_FILE_INFOS",r.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",r.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",r.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",r.INSTANTIATE="INSTANTIATE",r.OPEN="OPEN",r.PING="PING",r.POLL_PENDING_QUERY="POLL_PENDING_QUERY",r.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",r.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",r.REGISTER_FILE_URL="REGISTER_FILE_URL",r.RESET="RESET",r.RUN_PREPARED="RUN_PREPARED",r.RUN_QUERY="RUN_QUERY",r.SEND_PREPARED="SEND_PREPARED",r.START_PENDING_QUERY="START_PENDING_QUERY",r.TOKENIZE="TOKENIZE",r))(LD||{}),ND=(r=>(r.CONNECTION_INFO="CONNECTION_INFO",r.ERROR="ERROR",r.FEATURE_FLAGS="FEATURE_FLAGS",r.FILE_BUFFER="FILE_BUFFER",r.FILE_INFOS="FILE_INFOS",r.FILE_SIZE="FILE_SIZE",r.FILE_STATISTICS="FILE_STATISTICS",r.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",r.LOG="LOG",r.OK="OK",r.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",r.QUERY_PLAN="QUERY_PLAN",r.QUERY_RESULT="QUERY_RESULT",r.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",r.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",r.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",r.REGISTERED_FILE="REGISTERED_FILE",r.SCRIPT_TOKENS="SCRIPT_TOKENS",r.SUCCESS="SUCCESS",r.TABLE_NAMES="TABLE_NAMES",r.VERSION_STRING="VERSION_STRING",r))(ND||{}),de=class{constructor(r,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=r,this.data=t,this.promise=new Promise((e,n)=>{this.promiseResolver=e,this.promiseRejecter=n})}};function Ql(r){switch(r.typeId){case k.Binary:return{sqlType:"binary"};case k.Bool:return{sqlType:"bool"};case k.Date:return{sqlType:"date"};case k.DateDay:return{sqlType:"date32[d]"};case k.DateMillisecond:return{sqlType:"date64[ms]"};case k.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case k.Float:return{sqlType:"float"};case k.Float16:return{sqlType:"float16"};case k.Float32:return{sqlType:"float32"};case k.Float64:return{sqlType:"float64"};case k.Int:return{sqlType:"int32"};case k.Int16:return{sqlType:"int16"};case k.Int32:return{sqlType:"int32"};case k.Int64:return{sqlType:"int64"};case k.Uint16:return{sqlType:"uint16"};case k.Uint32:return{sqlType:"uint32"};case k.Uint64:return{sqlType:"uint64"};case k.Uint8:return{sqlType:"uint8"};case k.IntervalDayTime:return{sqlType:"interval[dt]"};case k.IntervalYearMonth:return{sqlType:"interval[m]"};case k.List:return{sqlType:"list",valueType:Ql(r.valueType)};case k.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case k.Null:return{sqlType:"null"};case k.Utf8:return{sqlType:"utf8"};case k.Struct:return{sqlType:"struct",fields:r.children.map(t=>af(t.name,t.type))};case k.Map:{let t=r;return{sqlType:"map",keyType:Ql(t.keyType),valueType:Ql(t.valueType)}}case k.Time:return{sqlType:"time[s]"};case k.TimeMicrosecond:return{sqlType:"time[us]"};case k.TimeMillisecond:return{sqlType:"time[ms]"};case k.TimeNanosecond:return{sqlType:"time[ns]"};case k.TimeSecond:return{sqlType:"time[s]"};case k.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case k.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case k.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case k.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case k.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function af(r,t){let e=Ql(t);return e.name=r,e}var BD=new TextEncoder,UD=class{constructor(r,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=r,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(r){this._worker=r,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,e)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(r,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let e=this._nextMessageId++;return this._pendingRequests.set(e,r),this._worker.postMessage({messageId:e,type:r.type,data:r.data},t),await r.promise}onMessage(r){var t;let e=r.data;switch(e.type){case"LOG":{this._logger.log(e.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(e.data);return}}let n=this._pendingRequests.get(e.requestId);if(!n){console.warn("unassociated response: [".concat(e.requestId,", ").concat(e.type.toString(),"]"));return}if(this._pendingRequests.delete(e.requestId),e.type=="ERROR"){let i=new Error(e.data.message);i.name=e.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=e.data.stack),n.promiseRejecter(i);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"REGISTER_OPFS_FILE_NAME":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(e.type=="OK"){n.promiseResolver(e.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],e.type=="OK"){n.promiseResolver(e.data);return}break;case"GLOB_FILE_INFOS":if(e.type=="FILE_INFOS"){n.promiseResolver(e.data);return}break;case"GET_VERSION":if(e.type=="VERSION_STRING"){n.promiseResolver(e.data);return}break;case"GET_FEATURE_FLAGS":if(e.type=="FEATURE_FLAGS"){n.promiseResolver(e.data);return}break;case"GET_TABLE_NAMES":if(e.type=="TABLE_NAMES"){n.promiseResolver(e.data);return}break;case"TOKENIZE":if(e.type=="SCRIPT_TOKENS"){n.promiseResolver(e.data);return}break;case"COPY_FILE_TO_BUFFER":if(e.type=="FILE_BUFFER"){n.promiseResolver(e.data);return}break;case"EXPORT_FILE_STATISTICS":if(e.type=="FILE_STATISTICS"){n.promiseResolver(e.data);return}break;case"CONNECT":if(e.type=="CONNECTION_INFO"){n.promiseResolver(e.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(e.type=="QUERY_RESULT"){n.promiseResolver(e.data);return}break;case"SEND_PREPARED":if(e.type=="QUERY_RESULT_HEADER"){n.promiseResolver(e.data);return}break;case"START_PENDING_QUERY":if(e.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(e.data);return}break;case"POLL_PENDING_QUERY":if(e.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(e.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],e.type=="SUCCESS"){n.promiseResolver(e.data);return}break;case"FETCH_QUERY_RESULTS":if(e.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(e.data);return}break;case"CREATE_PREPARED":if(e.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(e.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(e.type.toString())))}onError(r){console.error(r),console.error("error in duckdb worker: ".concat(r.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let r=new de("RESET",null);return await this.postTask(r)}async ping(){let r=new de("PING",null);await this.postTask(r)}async dropFile(r){let t=new de("DROP_FILE",r);return await this.postTask(t)}async dropFiles(){let r=new de("DROP_FILES",null);return await this.postTask(r)}async flushFiles(){let r=new de("FLUSH_FILES",null);return await this.postTask(r)}async instantiate(r,t=null,e=n=>{}){this._onInstantiationProgress.push(e);let n=new de("INSTANTIATE",[r,t]);return await this.postTask(n)}async getVersion(){let r=new de("GET_VERSION",null);return await this.postTask(r)}async getFeatureFlags(){let r=new de("GET_FEATURE_FLAGS",null);return await this.postTask(r)}async open(r){let t=new de("OPEN",r);await this.postTask(t)}async tokenize(r){let t=new de("TOKENIZE",r);return await this.postTask(t)}async connectInternal(){let r=new de("CONNECT",null);return await this.postTask(r)}async connect(){let r=await this.connectInternal();return new FD(this,r)}async disconnect(r){let t=new de("DISCONNECT",r);await this.postTask(t)}async runQuery(r,t){let e=new de("RUN_QUERY",[r,t]);return await this.postTask(e)}async startPendingQuery(r,t,e=!1){let n=new de("START_PENDING_QUERY",[r,t,e]);return await this.postTask(n)}async pollPendingQuery(r){let t=new de("POLL_PENDING_QUERY",r);return await this.postTask(t)}async cancelPendingQuery(r){let t=new de("CANCEL_PENDING_QUERY",r);return await this.postTask(t)}async fetchQueryResults(r){let t=new de("FETCH_QUERY_RESULTS",r);return await this.postTask(t)}async getTableNames(r,t){let e=new de("GET_TABLE_NAMES",[r,t]);return await this.postTask(e)}async createPrepared(r,t){let e=new de("CREATE_PREPARED",[r,t]);return await this.postTask(e)}async closePrepared(r,t){let e=new de("CLOSE_PREPARED",[r,t]);await this.postTask(e)}async runPrepared(r,t,e){let n=new de("RUN_PREPARED",[r,t,e]);return await this.postTask(n)}async sendPrepared(r,t,e){let n=new de("SEND_PREPARED",[r,t,e]);return await this.postTask(n)}async globFiles(r){let t=new de("GLOB_FILE_INFOS",r);return await this.postTask(t)}async registerFileText(r,t){let e=BD.encode(t);await this.registerFileBuffer(r,e)}async registerFileURL(r,t,e,n){t===void 0&&(t=r);let i=new de("REGISTER_FILE_URL",[r,t,e,n]);await this.postTask(i)}async registerEmptyFileBuffer(r){}async registerFileBuffer(r,t){let e=new de("REGISTER_FILE_BUFFER",[r,t]);await this.postTask(e,[t.buffer])}async registerFileHandle(r,t,e,n){let i=new de("REGISTER_FILE_HANDLE",[r,t,e,n]);await this.postTask(i,[])}async registerOPFSFileName(r){let t=new de("REGISTER_OPFS_FILE_NAME",[r]);await this.postTask(t,[])}async collectFileStatistics(r,t){let e=new de("COLLECT_FILE_STATISTICS",[r,t]);await this.postTask(e,[])}async exportFileStatistics(r){let t=new de("EXPORT_FILE_STATISTICS",r);return await this.postTask(t,[])}async copyFileToBuffer(r){let t=new de("COPY_FILE_TO_BUFFER",r);return await this.postTask(t)}async copyFileToPath(r,t){let e=new de("COPY_FILE_TO_PATH",[r,t]);await this.postTask(e)}async insertArrowFromIPCStream(r,t,e){if(t.length==0)return;let n=new de("INSERT_ARROW_FROM_IPC_STREAM",[r,t,e]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(r,t,e){if(e.columns!==void 0){let i=[];for(let s in e.columns){let o=e.columns[s];i.push(af(s,o))}e.columnsFlat=i,delete e.columns}let n=new de("IMPORT_CSV_FROM_PATH",[r,t,e]);await this.postTask(n)}async insertJSONFromPath(r,t,e){if(e.columns!==void 0){let i=[];for(let s in e.columns){let o=e.columns[s];i.push(af(s,o))}e.columnsFlat=i,delete e.columns}let n=new de("IMPORT_JSON_FROM_PATH",[r,t,e]);await this.postTask(n)}};function kD(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}kD();var zD=(r=>(r[r.BUFFER=0]="BUFFER",r[r.NODE_FS=1]="NODE_FS",r[r.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",r[r.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",r[r.HTTP=4]="HTTP",r[r.S3=5]="S3",r))(zD||{}),VD=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),jD=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),$D=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),GD=()=>(async r=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(r)}catch{return!1}})(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])),WD={version:"1.29.1-dev68.0"},xp=WD.version.split(".");xp[0];xp[1];xp[2];var HD=()=>typeof navigator>"u",Fh=null,Dh=null,Lh=null,Nh=null,Bh=null;async function XD(){return Fh==null&&(Fh=typeof BigInt64Array<"u"),Dh==null&&(Dh=await jD()),Lh==null&&(Lh=await GD()),Nh==null&&(Nh=await $D()),Bh==null&&(Bh=await VD()),{bigInt64Array:Fh,crossOriginIsolated:HD()||globalThis.crossOriginIsolated||!1,wasmExceptions:Dh,wasmSIMD:Nh,wasmThreads:Lh,wasmBulkMemory:Bh}}async function Ey(r){let t=await XD();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&r.coi)return{mainModule:r.coi.mainModule,mainWorker:r.coi.mainWorker,pthreadWorker:r.coi.pthreadWorker};if(r.eh)return{mainModule:r.eh.mainModule,mainWorker:r.eh.mainWorker,pthreadWorker:null}}return{mainModule:r.mvp.mainModule,mainWorker:r.mvp.mainWorker,pthreadWorker:null}}TD(ID());const Uh={},wa={};function Ia(r,t){try{const n=(Uh[r]||(Uh[r]=new Intl.DateTimeFormat("en-GB",{timeZone:r,hour:"numeric",timeZoneName:"longOffset"}).format))(t).split("GMT")[1]||"";return n in wa?wa[n]:Ay(n,n.split(":"))}catch{if(r in wa)return wa[r];const e=r==null?void 0:r.match(YD);return e?Ay(r,e.slice(1)):NaN}}const YD=/([+-]\d\d):?(\d\d)?/;function Ay(r,t){const e=+t[0],n=+(t[1]||0);return wa[r]=e>0?e*60+n:e*60-n}class Fr extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Ia(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),zx(this),lf(this)):this.setTime(Date.now())}static tz(t,...e){return e.length?new Fr(...e,t):new Fr(Date.now(),t)}withTimeZone(t){return new Fr(+this,t)}getTimezoneOffset(){return-Ia(this.timeZone,this)}setTime(t){return Date.prototype.setTime.apply(this,arguments),lf(this),+this}[Symbol.for("constructDateFrom")](t){return new Fr(+new Date(t),this.timeZone)}}const My=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(r=>{if(!My.test(r))return;const t=r.replace(My,"$1UTC");Fr.prototype[t]&&(r.startsWith("get")?Fr.prototype[r]=function(){return this.internal[t]()}:(Fr.prototype[r]=function(){return Date.prototype[t].apply(this.internal,arguments),qD(this),+this},Fr.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),lf(this),+this}))});function lf(r){r.internal.setTime(+r),r.internal.setUTCMinutes(r.internal.getUTCMinutes()-r.getTimezoneOffset())}function qD(r){Date.prototype.setFullYear.call(r,r.internal.getUTCFullYear(),r.internal.getUTCMonth(),r.internal.getUTCDate()),Date.prototype.setHours.call(r,r.internal.getUTCHours(),r.internal.getUTCMinutes(),r.internal.getUTCSeconds(),r.internal.getUTCMilliseconds()),zx(r)}function zx(r){const t=Ia(r.timeZone,r),e=new Date(+r);e.setUTCHours(e.getUTCHours()-1);const n=-new Date(+r).getTimezoneOffset(),i=-new Date(+e).getTimezoneOffset(),s=n-i,o=Date.prototype.getHours.apply(r)!==r.internal.getUTCHours();s&&o&&r.internal.setUTCMinutes(r.internal.getUTCMinutes()+s);const a=n-t;a&&Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+a);const l=Ia(r.timeZone,r),c=-new Date(+r).getTimezoneOffset()-l,h=l!==t,f=c-a;if(h&&f){Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+f);const d=Ia(r.timeZone,r),m=l-d;m&&(r.internal.setUTCMinutes(r.internal.getUTCMinutes()+m),Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+m))}}const QD=new TextDecoder("utf-8"),ZD=r=>QD.decode(r),KD=new TextEncoder,Vx=r=>KD.encode(r),An=r=>typeof r=="function",el=r=>r!=null&&Object(r)===r,JD=r=>el(r)&&An(r.then),jx=r=>el(r)&&An(r[Symbol.iterator]),tL=r=>el(r)&&An(r[Symbol.asyncIterator]),eL=r=>el(r)&&"done"in r&&"value"in r,rL=r=>el(r)&&An(r.clear)&&An(r.bytes)&&An(r.position)&&An(r.setPosition)&&An(r.capacity)&&An(r.getBufferIdentifier)&&An(r.createLong),Sp=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function nL(r){const t=r[0]?[r[0]]:[];let e,n,i,s;for(let o,a,l=0,u=0,c=r.length;++lc+h.byteLength,0);let i,s,o,a=0,l=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,n);for(const c=e.length;++lur(Int8Array,r),oL=r=>ur(Int16Array,r),aL=r=>ur(Int32Array,r),lL=r=>ur(BigInt64Array,r),uL=r=>ur(Uint8Array,r),cL=r=>ur(Uint16Array,r),hL=r=>ur(Uint32Array,r),dL=r=>ur(BigUint64Array,r),fL=r=>ur(Float32Array,r),pL=r=>ur(Float64Array,r),mL=r=>ur(Uint8ClampedArray,r),cf=r=>(r.next(),r);function*Xn(r,t){const e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Sp?e(t):jx(t)?t:e(t);return yield*cf(function*(i){let s=null;do s=i.next(yield ur(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}const gL=r=>Xn(Int8Array,r),yL=r=>Xn(Int16Array,r),vL=r=>Xn(Int32Array,r),_L=r=>Xn(Uint8Array,r),bL=r=>Xn(Uint16Array,r),wL=r=>Xn(Uint32Array,r),xL=r=>Xn(Float32Array,r),SL=r=>Xn(Float64Array,r),TL=r=>Xn(Uint8ClampedArray,r);function mn(r,t){return br(this,arguments,function*(){if(JD(t))return yield Rt(yield Rt(yield*Ss(Bn(mn(r,yield Rt(t))))));const n=function(o){return br(this,arguments,function*(){yield yield Rt(yield Rt(o))})},i=function(o){return br(this,arguments,function*(){yield Rt(yield*Ss(Bn(cf(function*(a){let l=null;do l=a.next(yield l==null?void 0:l.value);while(!l.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Sp?n(t):jx(t)?i(t):tL(t)?t:n(t);return yield Rt(yield*Ss(Bn(cf(function(o){return br(this,arguments,function*(){let a=null;do a=yield Rt(o.next(yield yield Rt(ur(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield Rt(new r)})}const IL=r=>mn(Int8Array,r),EL=r=>mn(Int16Array,r),AL=r=>mn(Int32Array,r),ML=r=>mn(Uint8Array,r),CL=r=>mn(Uint16Array,r),OL=r=>mn(Uint32Array,r),PL=r=>mn(Float32Array,r),RL=r=>mn(Float64Array,r),FL=r=>mn(Uint8ClampedArray,r);function DL(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n0)do if(r[e]!==t[e])return!1;while(++eFo(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}const BL=Object.freeze(Object.defineProperty({__proto__:null,valueToString:Fo},Symbol.toStringTag,{value:"Module"}));function pr(r){if(typeof r=="bigint"&&(rNumber.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Gx(r,t){return pr(r/t)+pr(r%t)/pr(t)}const Wx=Symbol.for("isArrowBigNum");function gn(r,...t){return t.length===0?Object.setPrototypeOf(ur(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}gn.prototype[Wx]=!0;gn.prototype.toJSON=function(){return`"${Do(this)}"`};gn.prototype.valueOf=function(r){return Tp(this,r)};gn.prototype.toString=function(){return Do(this)};gn.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Tp(this);case"string":return Do(this);case"default":return Hx(this)}return Do(this)};function xo(...r){return gn.apply(this,r)}function So(...r){return gn.apply(this,r)}function $a(...r){return gn.apply(this,r)}Object.setPrototypeOf(xo.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(So.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf($a.prototype,Object.create(Uint32Array.prototype));Object.assign(xo.prototype,gn.prototype,{constructor:xo,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(So.prototype,gn.prototype,{constructor:So,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign($a.prototype,gn.prototype,{constructor:$a,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const UL=BigInt(4294967296)*BigInt(4294967296),kL=UL-BigInt(1);function Tp(r,t){const{buffer:e,byteOffset:n,byteLength:i,signed:s}=r,o=new BigUint64Array(e,n,i/8),a=s&&o.at(-1)&BigInt(1)<=0)return kh(r);t=t.slice();let n=1;for(let s=0;s(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(Ct.prototype);class Cy extends Ct{constructor(){super(H.Null)}toString(){return"Null"}}Yx=Symbol.toStringTag;Cy[Yx]=(r=>r[Symbol.toStringTag]="Null")(Cy.prototype);class Oy extends Ct{constructor(t,e){super(H.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}qx=Symbol.toStringTag;Oy[qx]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Oy.prototype);class Py extends Ct{constructor(t){super(H.Float),this.precision=t}get ArrayType(){switch(this.precision){case Dr.HALF:return Uint16Array;case Dr.SINGLE:return Float32Array;case Dr.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Qx=Symbol.toStringTag;Py[Qx]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Py.prototype);class Ry extends Ct{constructor(){super(H.Binary)}toString(){return"Binary"}}Zx=Symbol.toStringTag;Ry[Zx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Ry.prototype);class Fy extends Ct{constructor(){super(H.LargeBinary)}toString(){return"LargeBinary"}}Kx=Symbol.toStringTag;Fy[Kx]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Fy.prototype);class Dy extends Ct{constructor(){super(H.Utf8)}toString(){return"Utf8"}}Jx=Symbol.toStringTag;Dy[Jx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Dy.prototype);class Ly extends Ct{constructor(){super(H.LargeUtf8)}toString(){return"LargeUtf8"}}tS=Symbol.toStringTag;Ly[tS]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Ly.prototype);class Ny extends Ct{constructor(){super(H.Bool)}toString(){return"Bool"}}eS=Symbol.toStringTag;Ny[eS]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Ny.prototype);class By extends Ct{constructor(t,e,n=128){super(H.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}rS=Symbol.toStringTag;By[rS]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(By.prototype);class Uy extends Ct{constructor(t){super(H.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Bi[this.unit]}>`}get ArrayType(){return this.unit===Bi.DAY?Int32Array:BigInt64Array}}nS=Symbol.toStringTag;Uy[nS]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Uy.prototype);class ky extends Ct{constructor(t,e){super(H.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${te[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}iS=Symbol.toStringTag;ky[iS]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(ky.prototype);class zy extends Ct{constructor(t,e){super(H.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${te[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}sS=Symbol.toStringTag;zy[sS]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(zy.prototype);class Vy extends Ct{constructor(t){super(H.Interval),this.unit=t}toString(){return`Interval<${As[this.unit]}>`}}oS=Symbol.toStringTag;Vy[oS]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Vy.prototype);class jy extends Ct{constructor(t){super(H.Duration),this.unit=t}toString(){return`Duration<${te[this.unit]}>`}}aS=Symbol.toStringTag;jy[aS]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(jy.prototype);class $y extends Ct{constructor(t){super(H.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}lS=Symbol.toStringTag;$y[lS]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))($y.prototype);class hf extends Ct{constructor(t){super(H.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}uS=Symbol.toStringTag;hf[uS]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(hf.prototype);class Gy extends Ct{constructor(t,e,n){super(H.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}cS=Symbol.toStringTag;Gy[cS]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Gy.prototype);class Wy extends Ct{constructor(t){super(H.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}hS=Symbol.toStringTag;Wy[hS]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Wy.prototype);class Hy extends Ct{constructor(t,e){super(H.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}dS=Symbol.toStringTag;Hy[dS]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Hy.prototype);class Xy extends Ct{constructor(t,e=!1){var n,i,s;if(super(H.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){const o=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}fS=Symbol.toStringTag;Xy[fS]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Xy.prototype);const VL=(r=>()=>++r)(-1);class Yy extends Ct{constructor(t,e,n,i){super(H.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?VL():pr(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}pS=Symbol.toStringTag;Yy[pS]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Yy.prototype);function mS(r){const t=r;switch(r.typeId){case H.Decimal:return r.bitWidth/32;case H.Interval:return 1+t.unit;case H.FixedSizeList:return t.listSize;case H.FixedSizeBinary:return t.byteWidth;default:return 1}}class he{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return jL(this,t,e)}getVisitFnByTypeId(t,e=!0){return ao(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function jL(r,t,e=!0){return typeof t=="number"?ao(r,t,e):typeof t=="string"&&t in H?ao(r,H[t],e):t&&t instanceof Ct?ao(r,qy(t),e):t!=null&&t.type&&t.type instanceof Ct?ao(r,qy(t.type),e):ao(r,H.NONE,e)}function ao(r,t,e=!0){let n=null;switch(t){case H.Null:n=r.visitNull;break;case H.Bool:n=r.visitBool;break;case H.Int:n=r.visitInt;break;case H.Int8:n=r.visitInt8||r.visitInt;break;case H.Int16:n=r.visitInt16||r.visitInt;break;case H.Int32:n=r.visitInt32||r.visitInt;break;case H.Int64:n=r.visitInt64||r.visitInt;break;case H.Uint8:n=r.visitUint8||r.visitInt;break;case H.Uint16:n=r.visitUint16||r.visitInt;break;case H.Uint32:n=r.visitUint32||r.visitInt;break;case H.Uint64:n=r.visitUint64||r.visitInt;break;case H.Float:n=r.visitFloat;break;case H.Float16:n=r.visitFloat16||r.visitFloat;break;case H.Float32:n=r.visitFloat32||r.visitFloat;break;case H.Float64:n=r.visitFloat64||r.visitFloat;break;case H.Utf8:n=r.visitUtf8;break;case H.LargeUtf8:n=r.visitLargeUtf8;break;case H.Binary:n=r.visitBinary;break;case H.LargeBinary:n=r.visitLargeBinary;break;case H.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case H.Date:n=r.visitDate;break;case H.DateDay:n=r.visitDateDay||r.visitDate;break;case H.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case H.Timestamp:n=r.visitTimestamp;break;case H.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case H.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case H.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case H.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case H.Time:n=r.visitTime;break;case H.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case H.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case H.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case H.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case H.Decimal:n=r.visitDecimal;break;case H.List:n=r.visitList;break;case H.Struct:n=r.visitStruct;break;case H.Union:n=r.visitUnion;break;case H.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case H.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case H.Dictionary:n=r.visitDictionary;break;case H.Interval:n=r.visitInterval;break;case H.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case H.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case H.Duration:n=r.visitDuration;break;case H.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case H.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case H.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case H.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case H.FixedSizeList:n=r.visitFixedSizeList;break;case H.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${H[t]}'`)}function qy(r){switch(r.typeId){case H.Null:return H.Null;case H.Int:{const{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?H.Int8:H.Uint8;case 16:return e?H.Int16:H.Uint16;case 32:return e?H.Int32:H.Uint32;case 64:return e?H.Int64:H.Uint64}return H.Int}case H.Float:switch(r.precision){case Dr.HALF:return H.Float16;case Dr.SINGLE:return H.Float32;case Dr.DOUBLE:return H.Float64}return H.Float;case H.Binary:return H.Binary;case H.LargeBinary:return H.LargeBinary;case H.Utf8:return H.Utf8;case H.LargeUtf8:return H.LargeUtf8;case H.Bool:return H.Bool;case H.Decimal:return H.Decimal;case H.Time:switch(r.unit){case te.SECOND:return H.TimeSecond;case te.MILLISECOND:return H.TimeMillisecond;case te.MICROSECOND:return H.TimeMicrosecond;case te.NANOSECOND:return H.TimeNanosecond}return H.Time;case H.Timestamp:switch(r.unit){case te.SECOND:return H.TimestampSecond;case te.MILLISECOND:return H.TimestampMillisecond;case te.MICROSECOND:return H.TimestampMicrosecond;case te.NANOSECOND:return H.TimestampNanosecond}return H.Timestamp;case H.Date:switch(r.unit){case Bi.DAY:return H.DateDay;case Bi.MILLISECOND:return H.DateMillisecond}return H.Date;case H.Interval:switch(r.unit){case As.DAY_TIME:return H.IntervalDayTime;case As.YEAR_MONTH:return H.IntervalYearMonth}return H.Interval;case H.Duration:switch(r.unit){case te.SECOND:return H.DurationSecond;case te.MILLISECOND:return H.DurationMillisecond;case te.MICROSECOND:return H.DurationMicrosecond;case te.NANOSECOND:return H.DurationNanosecond}return H.Duration;case H.Map:return H.Map;case H.List:return H.List;case H.Struct:return H.Struct;case H.Union:switch(r.mode){case jn.Dense:return H.DenseUnion;case jn.Sparse:return H.SparseUnion}return H.Union;case H.FixedSizeBinary:return H.FixedSizeBinary;case H.FixedSizeList:return H.FixedSizeList;case H.Dictionary:return H.Dictionary}throw new Error(`Unrecognized type '${H[r.typeId]}'`)}he.prototype.visitInt8=null;he.prototype.visitInt16=null;he.prototype.visitInt32=null;he.prototype.visitInt64=null;he.prototype.visitUint8=null;he.prototype.visitUint16=null;he.prototype.visitUint32=null;he.prototype.visitUint64=null;he.prototype.visitFloat16=null;he.prototype.visitFloat32=null;he.prototype.visitFloat64=null;he.prototype.visitDateDay=null;he.prototype.visitDateMillisecond=null;he.prototype.visitTimestampSecond=null;he.prototype.visitTimestampMillisecond=null;he.prototype.visitTimestampMicrosecond=null;he.prototype.visitTimestampNanosecond=null;he.prototype.visitTimeSecond=null;he.prototype.visitTimeMillisecond=null;he.prototype.visitTimeMicrosecond=null;he.prototype.visitTimeNanosecond=null;he.prototype.visitDenseUnion=null;he.prototype.visitSparseUnion=null;he.prototype.visitIntervalDayTime=null;he.prototype.visitIntervalYearMonth=null;he.prototype.visitDuration=null;he.prototype.visitDurationSecond=null;he.prototype.visitDurationMillisecond=null;he.prototype.visitDurationMicrosecond=null;he.prototype.visitDurationNanosecond=null;const gS=new Float64Array(1),Hs=new Uint32Array(gS.buffer);function Ip(r){const t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function yS(r){if(r!==r)return 32256;gS[0]=r;const t=(Hs[1]&2147483648)>>16&65535;let e=Hs[1]&2146435072,n=0;return e>=1089470464?Hs[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Hs[1]&1048575)>>10):e<=1056964608?(n=1048576+(Hs[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Hs[1]&1048575)+512>>10),t|e|n&65535}const $L=Object.freeze(Object.defineProperty({__proto__:null,float64ToUint16:yS,uint16ToFloat64:Ip},Symbol.toStringTag,{value:"Module"}));class Wt extends he{}function qt(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}const GL=(r,t,e)=>{r[t]=Math.floor(e/864e5)},vS=(r,t,e,n)=>{if(e+1{const i=r+e;n?t[i>>3]|=1<>3]&=~(1<{r[t]=e},Ep=({values:r},t,e)=>{r[t]=e},_S=({values:r},t,e)=>{r[t]=yS(e)},HL=(r,t,e)=>{switch(r.type.precision){case Dr.HALF:return _S(r,t,e);case Dr.SINGLE:case Dr.DOUBLE:return Ep(r,t,e)}},bS=({values:r},t,e)=>{GL(r,t,e.valueOf())},wS=({values:r},t,e)=>{r[t]=BigInt(e)},XL=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},xS=({values:r,valueOffsets:t},e,n)=>vS(r,t,e,n),SS=({values:r,valueOffsets:t},e,n)=>vS(r,t,e,Vx(n)),YL=(r,t,e)=>{r.type.unit===Bi.DAY?bS(r,t,e):wS(r,t,e)},TS=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},IS=({values:r},t,e)=>{r[t]=BigInt(e)},ES=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},AS=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},qL=(r,t,e)=>{switch(r.type.unit){case te.SECOND:return TS(r,t,e);case te.MILLISECOND:return IS(r,t,e);case te.MICROSECOND:return ES(r,t,e);case te.NANOSECOND:return AS(r,t,e)}},MS=({values:r},t,e)=>{r[t]=e},CS=({values:r},t,e)=>{r[t]=e},OS=({values:r},t,e)=>{r[t]=e},PS=({values:r},t,e)=>{r[t]=e},QL=(r,t,e)=>{switch(r.type.unit){case te.SECOND:return MS(r,t,e);case te.MILLISECOND:return CS(r,t,e);case te.MICROSECOND:return OS(r,t,e);case te.NANOSECOND:return PS(r,t,e)}},ZL=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},KL=(r,t,e)=>{const n=r.children[0],i=r.valueOffsets,s=$n.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],l=i[t+1];a{const n=r.children[0],{valueOffsets:i}=r,s=$n.getVisitFn(n);let{[t]:o,[t+1]:a}=i;const l=e instanceof Map?e.entries():Object.entries(e);for(const u of l)if(s(n,o,u),++o>=a)break},tN=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),eN=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),rN=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),nN=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),iN=(r,t,e)=>{const n=r.type.children.map(s=>$n.getVisitFn(s.type)),i=e instanceof Map?rN(t,e):e instanceof er?eN(t,e):Array.isArray(e)?tN(t,e):nN(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},sN=(r,t,e)=>{r.type.mode===jn.Dense?RS(r,t,e):FS(r,t,e)},RS=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];$n.visit(i,r.valueOffsets[t],e)},FS=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];$n.visit(i,t,e)},oN=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},aN=(r,t,e)=>{r.type.unit===As.DAY_TIME?DS(r,t,e):LS(r,t,e)},DS=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},LS=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},NS=({values:r},t,e)=>{r[t]=e},BS=({values:r},t,e)=>{r[t]=e},US=({values:r},t,e)=>{r[t]=e},kS=({values:r},t,e)=>{r[t]=e},lN=(r,t,e)=>{switch(r.type.unit){case te.SECOND:return NS(r,t,e);case te.MILLISECOND:return BS(r,t,e);case te.MICROSECOND:return US(r,t,e);case te.NANOSECOND:return kS(r,t,e)}},uN=(r,t,e)=>{const{stride:n}=r,i=r.children[0],s=$n.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o`${Fo(t)}: ${Fo(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new cN(this[cn],this[To])}}class cN{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return te.name)}has(t,e){return t[cn].type.children.some(n=>n.name===e)}getOwnPropertyDescriptor(t,e){if(t[cn].type.children.some(n=>n.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[cn].type.children.findIndex(i=>i.name===e);if(n!==-1){const i=on.visit(t[cn].children[n],t[To]);return Reflect.set(t,e,i),i}}set(t,e,n){const i=t[cn].type.children.findIndex(s=>s.name===e);return i!==-1?($n.visit(t[cn].children[i],t[To],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}}const dN=new hN;class Bt extends he{}function Ht(r){return(t,e)=>t.getValid(e)?r(t,e):null}const fN=(r,t)=>864e5*r[t],pN=(r,t)=>null,zS=(r,t,e)=>{if(e+1>=t.length)return null;const n=pr(t[e]),i=pr(t[e+1]);return r.subarray(n,i)},mN=({offset:r,values:t},e)=>{const n=r+e;return(t[n>>3]&1<fN(r,t),jS=({values:r},t)=>pr(r[t]),Vi=({stride:r,values:t},e)=>t[r*e],gN=({stride:r,values:t},e)=>Ip(t[r*e]),$S=({values:r},t)=>r[t],yN=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),GS=({values:r,valueOffsets:t},e)=>zS(r,t,e),WS=({values:r,valueOffsets:t},e)=>{const n=zS(r,t,e);return n!==null?ZD(n):null},vN=({values:r},t)=>r[t],_N=({type:r,values:t},e)=>r.precision!==Dr.HALF?t[e]:Ip(t[e]),bN=(r,t)=>r.type.unit===Bi.DAY?VS(r,t):jS(r,t),HS=({values:r},t)=>1e3*pr(r[t]),XS=({values:r},t)=>pr(r[t]),YS=({values:r},t)=>Gx(r[t],BigInt(1e3)),qS=({values:r},t)=>Gx(r[t],BigInt(1e6)),wN=(r,t)=>{switch(r.type.unit){case te.SECOND:return HS(r,t);case te.MILLISECOND:return XS(r,t);case te.MICROSECOND:return YS(r,t);case te.NANOSECOND:return qS(r,t)}},QS=({values:r},t)=>r[t],ZS=({values:r},t)=>r[t],KS=({values:r},t)=>r[t],JS=({values:r},t)=>r[t],xN=(r,t)=>{switch(r.type.unit){case te.SECOND:return QS(r,t);case te.MILLISECOND:return ZS(r,t);case te.MICROSECOND:return KS(r,t);case te.NANOSECOND:return JS(r,t)}},SN=({values:r,stride:t},e)=>hc.decimal(r.subarray(t*e,t*(e+1))),TN=(r,t)=>{const{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,l=i[0].slice(s,o-s);return new er([l])},IN=(r,t)=>{const{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new Mp(o.slice(i,s-i))},EN=(r,t)=>new Ap(r,t),AN=(r,t)=>r.type.mode===jn.Dense?tT(r,t):eT(r,t),tT=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return on.visit(n,r.valueOffsets[t])},eT=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return on.visit(n,t)},MN=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},CN=(r,t)=>r.type.unit===As.DAY_TIME?rT(r,t):nT(r,t),rT=({values:r},t)=>r.subarray(2*t,2*(t+1)),nT=({values:r},t)=>{const e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},iT=({values:r},t)=>r[t],sT=({values:r},t)=>r[t],oT=({values:r},t)=>r[t],aT=({values:r},t)=>r[t],ON=(r,t)=>{switch(r.type.unit){case te.SECOND:return iT(r,t);case te.MILLISECOND:return sT(r,t);case te.MICROSECOND:return oT(r,t);case te.NANOSECOND:return aT(r,t)}},PN=(r,t)=>{const{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new er([s])};Bt.prototype.visitNull=Ht(pN);Bt.prototype.visitBool=Ht(mN);Bt.prototype.visitInt=Ht(vN);Bt.prototype.visitInt8=Ht(Vi);Bt.prototype.visitInt16=Ht(Vi);Bt.prototype.visitInt32=Ht(Vi);Bt.prototype.visitInt64=Ht($S);Bt.prototype.visitUint8=Ht(Vi);Bt.prototype.visitUint16=Ht(Vi);Bt.prototype.visitUint32=Ht(Vi);Bt.prototype.visitUint64=Ht($S);Bt.prototype.visitFloat=Ht(_N);Bt.prototype.visitFloat16=Ht(gN);Bt.prototype.visitFloat32=Ht(Vi);Bt.prototype.visitFloat64=Ht(Vi);Bt.prototype.visitUtf8=Ht(WS);Bt.prototype.visitLargeUtf8=Ht(WS);Bt.prototype.visitBinary=Ht(GS);Bt.prototype.visitLargeBinary=Ht(GS);Bt.prototype.visitFixedSizeBinary=Ht(yN);Bt.prototype.visitDate=Ht(bN);Bt.prototype.visitDateDay=Ht(VS);Bt.prototype.visitDateMillisecond=Ht(jS);Bt.prototype.visitTimestamp=Ht(wN);Bt.prototype.visitTimestampSecond=Ht(HS);Bt.prototype.visitTimestampMillisecond=Ht(XS);Bt.prototype.visitTimestampMicrosecond=Ht(YS);Bt.prototype.visitTimestampNanosecond=Ht(qS);Bt.prototype.visitTime=Ht(xN);Bt.prototype.visitTimeSecond=Ht(QS);Bt.prototype.visitTimeMillisecond=Ht(ZS);Bt.prototype.visitTimeMicrosecond=Ht(KS);Bt.prototype.visitTimeNanosecond=Ht(JS);Bt.prototype.visitDecimal=Ht(SN);Bt.prototype.visitList=Ht(TN);Bt.prototype.visitStruct=Ht(EN);Bt.prototype.visitUnion=Ht(AN);Bt.prototype.visitDenseUnion=Ht(tT);Bt.prototype.visitSparseUnion=Ht(eT);Bt.prototype.visitDictionary=Ht(MN);Bt.prototype.visitInterval=Ht(CN);Bt.prototype.visitIntervalDayTime=Ht(rT);Bt.prototype.visitIntervalYearMonth=Ht(nT);Bt.prototype.visitDuration=Ht(ON);Bt.prototype.visitDurationSecond=Ht(iT);Bt.prototype.visitDurationMillisecond=Ht(sT);Bt.prototype.visitDurationMicrosecond=Ht(oT);Bt.prototype.visitDurationNanosecond=Ht(aT);Bt.prototype.visitFixedSizeList=Ht(PN);Bt.prototype.visitMap=Ht(IN);const on=new Bt,lo=Symbol.for("keys"),Io=Symbol.for("vals"),uo=Symbol.for("kKeysAsStrings"),df=Symbol.for("_kKeysAsStrings");class Mp{constructor(t){return this[lo]=new er([t.children[0]]).memoize(),this[Io]=t.children[1],new Proxy(this,new FN)}get[uo](){return this[df]||(this[df]=Array.from(this[lo].toArray(),String))}[Symbol.iterator](){return new RN(this[lo],this[Io])}get size(){return this[lo].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[lo],e=this[Io],n={};for(let i=-1,s=t.length;++i`${Fo(t)}: ${Fo(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class RN{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),on.visit(this.vals,t)]})}}class FN{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[uo]}has(t,e){return t[uo].includes(e)}getOwnPropertyDescriptor(t,e){if(t[uo].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[uo].indexOf(e);if(n!==-1){const i=on.visit(Reflect.get(t,Io),n);return Reflect.set(t,e,i),i}}set(t,e,n){const i=t[uo].indexOf(e);return i!==-1?($n.visit(Reflect.get(t,Io),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}}Object.defineProperties(Mp.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[lo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Io]:{writable:!0,enumerable:!1,configurable:!1,value:null},[df]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Qy;function lT(r,t,e,n){const{length:i=0}=r;let s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),n?n(r,s,o):[s,o]}const uT=(r,t)=>r<0?t+r:r,Zy=r=>r!==r;function Ds(r){if(typeof r!=="object"||r===null)return Zy(r)?Zy:e=>e===r;if(r instanceof Date){const e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?$x(r,e):!1:r instanceof Map?LN(r):Array.isArray(r)?DN(r):r instanceof er?NN(r):BN(r,!0)}function DN(r){const t=[];for(let e=-1,n=r.length;++e!1;const n=[];for(let i=-1,s=e.length;++i{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return UN(r,e);case Map:return Ky(r,e,e.keys());case Mp:case Ap:case Object:case void 0:return Ky(r,e,t||Object.keys(e))}return e instanceof er?kN(r,e):!1}}function UN(r,t){const e=r.length;if(t.length!==e)return!1;for(let n=-1;++n>n}function VN(r,t,e){return e?!!(r[t>>3]|=1<>3]&=~(1<0||e.byteLength>3):hT(new fc(e,r,t,null,Cp)).subarray(0,n)),i}return e}function hT(r){const t=[];let e=0,n=0,i=0;for(const o of r)o&&(i|=1<0)&&(t[e++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class fc{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8===0?0:8-t%8);return ju(r,t,i)+ju(r,n,e)+dT(r,i>>3,n-i>>3)}function dT(r,t,e){let n=0,i=Math.trunc(t);const s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=Zl(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Zl(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Zl(s.getUint8(i)),i+=1;return n}function Zl(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const jN=Object.freeze(Object.defineProperty({__proto__:null,BitIterator:fc,getBit:cT,getBool:Cp,packBools:hT,popcnt_array:dT,popcnt_bit_range:ju,popcnt_uint32:Zl,setBool:VN,truncateBitmap:ff},Symbol.toStringTag,{value:"Module"})),$N=-1;class Ga{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return Ct.isSparseUnion(t)?this.children.some(e=>e.nullable):Ct.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(Ct.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=$N&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ju(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof Ga?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=mS(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:e}=this;if(Ct.isUnion(e)){const n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===jn.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<>3;(!s||s.byteLength<=c)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(ff(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const h=s[c];n=(h&u)!==0,s[c]=e?h|u:h&~u}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new Ga(t,e,n,i,s,o,this.dictionary)}slice(t,e){const{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,l=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===H.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<0&&i.set(ff(this.offset,e,this.nullBitmap),0);const s=this.buffers;return s[si.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s;const{buffers:o}=this;return(s=o[si.TYPE])&&(o[si.TYPE]=s.subarray(t,t+e)),(s=o[si.OFFSET])&&(o[si.OFFSET]=s.subarray(t,t+e+1))||(s=o[si.DATA])&&(o[si.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}}Ga.prototype.children=Object.freeze([]);class Jy{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function WN(r){return r.reduce((t,e)=>t+e.nullCount,0)}function HN(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function XN(r,t,e,n){const i=[];for(let s=-1,o=r.length;++s=n)break;if(e>=l+u)continue;if(l>=e&&l+u<=n){i.push(a);continue}const c=Math.max(0,e-l),h=Math.min(n-l,u);i.push(a.slice(c,h-c))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Op(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e0?0:-1}function ZN(r,t){const{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(const i of new fc(e,r.offset+(t||0),r.length,e,Cp)){if(!i)return n;++n}return-1}function Kt(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case H.Union:break;case H.Dictionary:break;default:return ZN(r,e)}const n=on.getVisitFn(r),i=Ds(t);for(let s=(e||0)-1,o=r.length;++s{const i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new Jy(r.data.length,n=>{const s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new KN(o)})}class KN{constructor(t){this.vector=t,this.index=0}next(){return this.indexa.data):t;if(s.length===0||s.some(a=>!(a instanceof Ga)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:u}=gT[o.typeId],c=s[0];this.isValid=h=>fT(c,h),this.get=h=>a(c,h),this.set=(h,f)=>l(c,h,f),this.indexOf=h=>u(c,h),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,yT[o.typeId]),this._offsets=HN(s);break}this.data=s,this.type=o,this.stride=mS(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return GN(this.data)}get nullCount(){return WN(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${H[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(uT(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return JN.visit(this)}concat(...t){return new er(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new er(lT(this,t,e,({data:n,_offsets:i},s,o)=>XN(n,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case H.Int:case H.Float:case H.Decimal:case H.Time:case H.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return Ct.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Ct.isDictionary(this.type)){const t=new $u(this.data[0].dictionary),e=this.data.map(n=>{const i=n.clone();return i.dictionary=t,i});return new er(e)}return new $u(this)}unmemoize(){if(Ct.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const i=n.clone();return i.dictionary=t,i});return new er(e)}return this}}mT=Symbol.toStringTag;er[mT]=(r=>{r.type=Ct.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const t=Object.keys(H).map(e=>H[e]).filter(e=>typeof e=="number"&&e!==H.NONE);for(const e of t){const n=on.getVisitFnByTypeId(e),i=$n.getVisitFnByTypeId(e),s=ev.getVisitFnByTypeId(e);gT[e]={get:n,set:i,indexOf:s},yT[e]=Object.create(r,{isValid:{value:tv(fT)},get:{value:tv(on.getVisitFnByTypeId(e))},set:{value:YN($n.getVisitFnByTypeId(e))},indexOf:{value:qN(ev.getVisitFnByTypeId(e))}})}return"Vector"})(er.prototype);class $u extends er{constructor(t){super(t.data);const e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const l=e.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new $u(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new er(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}const tB=65536;function po(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}const Lo=8,Pp=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Rp{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${po(this.buffer[3])} ${po(this.buffer[2])} ${po(this.buffer[1])} ${po(this.buffer[0])}`}static multiply(t,e){return new En(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new En(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return En.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return En.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),i=t.length,s=new En(e);for(let o=n?1:0;othis.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function gr(r,t){return t instanceof r.constructor}function Ls(r,t){return r===t||gr(r,t)}function mi(r,t){return r===t||gr(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function pc(r,t){return r===t||gr(r,t)&&r.precision===t.precision}function rB(r,t){return r===t||gr(r,t)&&r.byteWidth===t.byteWidth}function Fp(r,t){return r===t||gr(r,t)&&r.unit===t.unit}function rl(r,t){return r===t||gr(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function nl(r,t){return r===t||gr(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function nB(r,t){return r===t||gr(r,t)&&r.children.length===t.children.length&&Gn.compareManyFields(r.children,t.children)}function iB(r,t){return r===t||gr(r,t)&&r.children.length===t.children.length&&Gn.compareManyFields(r.children,t.children)}function Dp(r,t){return r===t||gr(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Gn.compareManyFields(r.children,t.children)}function sB(r,t){return r===t||gr(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Gn.visit(r.indices,t.indices)&&Gn.visit(r.dictionary,t.dictionary)}function Lp(r,t){return r===t||gr(r,t)&&r.unit===t.unit}function il(r,t){return r===t||gr(r,t)&&r.unit===t.unit}function oB(r,t){return r===t||gr(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Gn.compareManyFields(r.children,t.children)}function aB(r,t){return r===t||gr(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Gn.compareManyFields(r.children,t.children)}zt.prototype.visitNull=Ls;zt.prototype.visitBool=Ls;zt.prototype.visitInt=mi;zt.prototype.visitInt8=mi;zt.prototype.visitInt16=mi;zt.prototype.visitInt32=mi;zt.prototype.visitInt64=mi;zt.prototype.visitUint8=mi;zt.prototype.visitUint16=mi;zt.prototype.visitUint32=mi;zt.prototype.visitUint64=mi;zt.prototype.visitFloat=pc;zt.prototype.visitFloat16=pc;zt.prototype.visitFloat32=pc;zt.prototype.visitFloat64=pc;zt.prototype.visitUtf8=Ls;zt.prototype.visitLargeUtf8=Ls;zt.prototype.visitBinary=Ls;zt.prototype.visitLargeBinary=Ls;zt.prototype.visitFixedSizeBinary=rB;zt.prototype.visitDate=Fp;zt.prototype.visitDateDay=Fp;zt.prototype.visitDateMillisecond=Fp;zt.prototype.visitTimestamp=rl;zt.prototype.visitTimestampSecond=rl;zt.prototype.visitTimestampMillisecond=rl;zt.prototype.visitTimestampMicrosecond=rl;zt.prototype.visitTimestampNanosecond=rl;zt.prototype.visitTime=nl;zt.prototype.visitTimeSecond=nl;zt.prototype.visitTimeMillisecond=nl;zt.prototype.visitTimeMicrosecond=nl;zt.prototype.visitTimeNanosecond=nl;zt.prototype.visitDecimal=Ls;zt.prototype.visitList=nB;zt.prototype.visitStruct=iB;zt.prototype.visitUnion=Dp;zt.prototype.visitDenseUnion=Dp;zt.prototype.visitSparseUnion=Dp;zt.prototype.visitDictionary=sB;zt.prototype.visitInterval=Lp;zt.prototype.visitIntervalDayTime=Lp;zt.prototype.visitIntervalYearMonth=Lp;zt.prototype.visitDuration=il;zt.prototype.visitDurationSecond=il;zt.prototype.visitDurationMillisecond=il;zt.prototype.visitDurationMicrosecond=il;zt.prototype.visitDurationNanosecond=il;zt.prototype.visitFixedSizeList=oB;zt.prototype.visitMap=aB;const Gn=new zt;function lB(r,t){return Gn.compareSchemas(r,t)}function uB(r,t){return Gn.compareFields(r,t)}function cB(r,t){return Gn.visit(r,t)}const rv=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},zL),eB),jN),$L),LL),zN),BL),{compareSchemas:lB,compareFields:uB,compareTypes:cB}),vT=6048e5,hB=864e5,nv=Symbol.for("constructDateFrom");function ui(r,t){return typeof r=="function"?r(t):r&&typeof r=="object"&&nv in r?r[nv](t):r instanceof Date?new r.constructor(t):new Date(t)}function an(r,t){return ui(t||r,r)}let dB={};function mc(){return dB}function Wa(r,t){var a,l,u,c;const e=mc(),n=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((c=(u=e.locale)==null?void 0:u.options)==null?void 0:c.weekStartsOn)??0,i=an(r,t==null?void 0:t.in),s=i.getDay(),o=(s=s.getTime()?n+1:e.getTime()>=a.getTime()?n:n-1}function iv(r){const t=an(r),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+r-+e}function fB(r,...t){const e=ui.bind(null,t.find(n=>typeof n=="object"));return t.map(e)}function sv(r,t){const e=an(r,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function pB(r,t,e){const[n,i]=fB(e==null?void 0:e.in,r,t),s=sv(n),o=sv(i),a=+s-iv(s),l=+o-iv(o);return Math.round((a-l)/hB)}function mB(r,t){const e=_T(r,t),n=ui(r,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),Gu(n)}function gB(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function yB(r){return!(!gB(r)&&typeof r!="number"||isNaN(+an(r)))}function vB(r,t){const e=an(r,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}const _B={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},bB=(r,t,e)=>{let n;const i=_B[r];return typeof i=="string"?n=i:t===1?n=i.one:n=i.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+n:n+" ago":n};function zh(r){return(t={})=>{const e=t.width?String(t.width):r.defaultWidth;return r.formats[e]||r.formats[r.defaultWidth]}}const wB={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xB={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},SB={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},TB={date:zh({formats:wB,defaultWidth:"full"}),time:zh({formats:xB,defaultWidth:"full"}),dateTime:zh({formats:SB,defaultWidth:"full"})},IB={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},EB=(r,t,e,n)=>IB[r];function sa(r){return(t,e)=>{const n=e!=null&&e.context?String(e.context):"standalone";let i;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,a=e!=null&&e.width?String(e.width):o;i=r.formattingValues[a]||r.formattingValues[o]}else{const o=r.defaultWidth,a=e!=null&&e.width?String(e.width):r.defaultWidth;i=r.values[a]||r.values[o]}const s=r.argumentCallback?r.argumentCallback(t):t;return i[s]}}const AB={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},MB={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},CB={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},OB={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},PB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},RB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},FB=(r,t)=>{const e=Number(r),n=e%100;if(n>20||n<10)switch(n%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},DB={ordinalNumber:FB,era:sa({values:AB,defaultWidth:"wide"}),quarter:sa({values:MB,defaultWidth:"wide",argumentCallback:r=>r-1}),month:sa({values:CB,defaultWidth:"wide"}),day:sa({values:OB,defaultWidth:"wide"}),dayPeriod:sa({values:PB,defaultWidth:"wide",formattingValues:RB,defaultFormattingWidth:"wide"})};function oa(r){return(t,e={})=>{const n=e.width,i=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=t.match(i);if(!s)return null;const o=s[0],a=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],l=Array.isArray(a)?NB(a,h=>h.test(o)):LB(a,h=>h.test(o));let u;u=r.valueCallback?r.valueCallback(l):l,u=e.valueCallback?e.valueCallback(u):u;const c=t.slice(o.length);return{value:u,rest:c}}}function LB(r,t){for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&t(r[e]))return e}function NB(r,t){for(let e=0;e{const n=t.match(r.matchPattern);if(!n)return null;const i=n[0],s=t.match(r.parsePattern);if(!s)return null;let o=r.valueCallback?r.valueCallback(s[0]):s[0];o=e.valueCallback?e.valueCallback(o):o;const a=t.slice(i.length);return{value:o,rest:a}}}const UB=/^(\d+)(th|st|nd|rd)?/i,kB=/\d+/i,zB={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},VB={any:[/^b/i,/^(a|c)/i]},jB={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},$B={any:[/1/i,/2/i,/3/i,/4/i]},GB={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},WB={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},HB={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},XB={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},YB={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},qB={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},QB={ordinalNumber:BB({matchPattern:UB,parsePattern:kB,valueCallback:r=>parseInt(r,10)}),era:oa({matchPatterns:zB,defaultMatchWidth:"wide",parsePatterns:VB,defaultParseWidth:"any"}),quarter:oa({matchPatterns:jB,defaultMatchWidth:"wide",parsePatterns:$B,defaultParseWidth:"any",valueCallback:r=>r+1}),month:oa({matchPatterns:GB,defaultMatchWidth:"wide",parsePatterns:WB,defaultParseWidth:"any"}),day:oa({matchPatterns:HB,defaultMatchWidth:"wide",parsePatterns:XB,defaultParseWidth:"any"}),dayPeriod:oa({matchPatterns:YB,defaultMatchWidth:"any",parsePatterns:qB,defaultParseWidth:"any"})},ZB={code:"en-US",formatDistance:bB,formatLong:TB,formatRelative:EB,localize:DB,match:QB,options:{weekStartsOn:0,firstWeekContainsDate:1}};function KB(r,t){const e=an(r,t==null?void 0:t.in);return pB(e,vB(e))+1}function JB(r,t){const e=an(r,t==null?void 0:t.in),n=+Gu(e)-+mB(e);return Math.round(n/vT)+1}function bT(r,t){var c,h,f,d;const e=an(r,t==null?void 0:t.in),n=e.getFullYear(),i=mc(),s=(t==null?void 0:t.firstWeekContainsDate)??((h=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:h.firstWeekContainsDate)??i.firstWeekContainsDate??((d=(f=i.locale)==null?void 0:f.options)==null?void 0:d.firstWeekContainsDate)??1,o=ui((t==null?void 0:t.in)||r,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=Wa(o,t),l=ui((t==null?void 0:t.in)||r,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const u=Wa(l,t);return+e>=+a?n+1:+e>=+u?n:n-1}function tU(r,t){var a,l,u,c;const e=mc(),n=(t==null?void 0:t.firstWeekContainsDate)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((c=(u=e.locale)==null?void 0:u.options)==null?void 0:c.firstWeekContainsDate)??1,i=bT(r,t),s=ui((t==null?void 0:t.in)||r,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),Wa(s,t)}function eU(r,t){const e=an(r,t==null?void 0:t.in),n=+Wa(e,t)-+tU(e,t);return Math.round(n/vT)+1}function we(r,t){const e=r<0?"-":"",n=Math.abs(r).toString().padStart(t,"0");return e+n}const wi={y(r,t){const e=r.getFullYear(),n=e>0?e:1-e;return we(t==="yy"?n%100:n,t.length)},M(r,t){const e=r.getMonth();return t==="M"?String(e+1):we(e+1,2)},d(r,t){return we(r.getDate(),t.length)},a(r,t){const e=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(r,t){return we(r.getHours()%12||12,t.length)},H(r,t){return we(r.getHours(),t.length)},m(r,t){return we(r.getMinutes(),t.length)},s(r,t){return we(r.getSeconds(),t.length)},S(r,t){const e=t.length,n=r.getMilliseconds(),i=Math.trunc(n*Math.pow(10,e-3));return we(i,t.length)}},Xs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ov={G:function(r,t,e){const n=r.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(n,{width:"abbreviated"});case"GGGGG":return e.era(n,{width:"narrow"});case"GGGG":default:return e.era(n,{width:"wide"})}},y:function(r,t,e){if(t==="yo"){const n=r.getFullYear(),i=n>0?n:1-n;return e.ordinalNumber(i,{unit:"year"})}return wi.y(r,t)},Y:function(r,t,e,n){const i=bT(r,n),s=i>0?i:1-i;if(t==="YY"){const o=s%100;return we(o,2)}return t==="Yo"?e.ordinalNumber(s,{unit:"year"}):we(s,t.length)},R:function(r,t){const e=_T(r);return we(e,t.length)},u:function(r,t){const e=r.getFullYear();return we(e,t.length)},Q:function(r,t,e){const n=Math.ceil((r.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return we(n,2);case"Qo":return e.ordinalNumber(n,{unit:"quarter"});case"QQQ":return e.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,t,e){const n=Math.ceil((r.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return we(n,2);case"qo":return e.ordinalNumber(n,{unit:"quarter"});case"qqq":return e.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,t,e){const n=r.getMonth();switch(t){case"M":case"MM":return wi.M(r,t);case"Mo":return e.ordinalNumber(n+1,{unit:"month"});case"MMM":return e.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(n,{width:"wide",context:"formatting"})}},L:function(r,t,e){const n=r.getMonth();switch(t){case"L":return String(n+1);case"LL":return we(n+1,2);case"Lo":return e.ordinalNumber(n+1,{unit:"month"});case"LLL":return e.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(n,{width:"wide",context:"standalone"})}},w:function(r,t,e,n){const i=eU(r,n);return t==="wo"?e.ordinalNumber(i,{unit:"week"}):we(i,t.length)},I:function(r,t,e){const n=JB(r);return t==="Io"?e.ordinalNumber(n,{unit:"week"}):we(n,t.length)},d:function(r,t,e){return t==="do"?e.ordinalNumber(r.getDate(),{unit:"date"}):wi.d(r,t)},D:function(r,t,e){const n=KB(r);return t==="Do"?e.ordinalNumber(n,{unit:"dayOfYear"}):we(n,t.length)},E:function(r,t,e){const n=r.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(n,{width:"short",context:"formatting"});case"EEEE":default:return e.day(n,{width:"wide",context:"formatting"})}},e:function(r,t,e,n){const i=r.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return we(s,2);case"eo":return e.ordinalNumber(s,{unit:"day"});case"eee":return e.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(i,{width:"short",context:"formatting"});case"eeee":default:return e.day(i,{width:"wide",context:"formatting"})}},c:function(r,t,e,n){const i=r.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return we(s,t.length);case"co":return e.ordinalNumber(s,{unit:"day"});case"ccc":return e.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(i,{width:"narrow",context:"standalone"});case"cccccc":return e.day(i,{width:"short",context:"standalone"});case"cccc":default:return e.day(i,{width:"wide",context:"standalone"})}},i:function(r,t,e){const n=r.getDay(),i=n===0?7:n;switch(t){case"i":return String(i);case"ii":return we(i,t.length);case"io":return e.ordinalNumber(i,{unit:"day"});case"iii":return e.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(n,{width:"short",context:"formatting"});case"iiii":default:return e.day(n,{width:"wide",context:"formatting"})}},a:function(r,t,e){const i=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,t,e){const n=r.getHours();let i;switch(n===12?i=Xs.noon:n===0?i=Xs.midnight:i=n/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,t,e){const n=r.getHours();let i;switch(n>=17?i=Xs.evening:n>=12?i=Xs.afternoon:n>=4?i=Xs.morning:i=Xs.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,t,e){if(t==="ho"){let n=r.getHours()%12;return n===0&&(n=12),e.ordinalNumber(n,{unit:"hour"})}return wi.h(r,t)},H:function(r,t,e){return t==="Ho"?e.ordinalNumber(r.getHours(),{unit:"hour"}):wi.H(r,t)},K:function(r,t,e){const n=r.getHours()%12;return t==="Ko"?e.ordinalNumber(n,{unit:"hour"}):we(n,t.length)},k:function(r,t,e){let n=r.getHours();return n===0&&(n=24),t==="ko"?e.ordinalNumber(n,{unit:"hour"}):we(n,t.length)},m:function(r,t,e){return t==="mo"?e.ordinalNumber(r.getMinutes(),{unit:"minute"}):wi.m(r,t)},s:function(r,t,e){return t==="so"?e.ordinalNumber(r.getSeconds(),{unit:"second"}):wi.s(r,t)},S:function(r,t){return wi.S(r,t)},X:function(r,t,e){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return lv(n);case"XXXX":case"XX":return hs(n);case"XXXXX":case"XXX":default:return hs(n,":")}},x:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"x":return lv(n);case"xxxx":case"xx":return hs(n);case"xxxxx":case"xxx":default:return hs(n,":")}},O:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+av(n,":");case"OOOO":default:return"GMT"+hs(n,":")}},z:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+av(n,":");case"zzzz":default:return"GMT"+hs(n,":")}},t:function(r,t,e){const n=Math.trunc(+r/1e3);return we(n,t.length)},T:function(r,t,e){return we(+r,t.length)}};function av(r,t=""){const e=r>0?"-":"+",n=Math.abs(r),i=Math.trunc(n/60),s=n%60;return s===0?e+String(i):e+String(i)+t+we(s,2)}function lv(r,t){return r%60===0?(r>0?"-":"+")+we(Math.abs(r)/60,2):hs(r,t)}function hs(r,t=""){const e=r>0?"-":"+",n=Math.abs(r),i=we(Math.trunc(n/60),2),s=we(n%60,2);return e+i+t+s}const uv=(r,t)=>{switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},wT=(r,t)=>{switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},rU=(r,t)=>{const e=r.match(/(P+)(p+)?/)||[],n=e[1],i=e[2];if(!i)return uv(r,t);let s;switch(n){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",uv(n,t)).replace("{{time}}",wT(i,t))},nU={p:wT,P:rU},iU=/^D+$/,sU=/^Y+$/,oU=["D","DD","YY","YYYY"];function aU(r){return iU.test(r)}function lU(r){return sU.test(r)}function uU(r,t,e){const n=cU(r,t,e);if(console.warn(n),oU.includes(r))throw new RangeError(n)}function cU(r,t,e){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${t}\`) for formatting ${n} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const hU=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,dU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,fU=/^'([^]*?)'?$/,pU=/''/g,mU=/[a-zA-Z]/;function xT(r,t,e){var c,h,f,d;const n=mc(),i=n.locale??ZB,s=n.firstWeekContainsDate??((h=(c=n.locale)==null?void 0:c.options)==null?void 0:h.firstWeekContainsDate)??1,o=n.weekStartsOn??((d=(f=n.locale)==null?void 0:f.options)==null?void 0:d.weekStartsOn)??0,a=an(r,e==null?void 0:e.in);if(!yB(a))throw new RangeError("Invalid time value");let l=t.match(dU).map(m=>{const g=m[0];if(g==="p"||g==="P"){const p=nU[g];return p(m,i.formatLong)}return m}).join("").match(hU).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const g=m[0];if(g==="'")return{isToken:!1,value:gU(m)};if(ov[g])return{isToken:!0,value:m};if(g.match(mU))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const u={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(m=>{if(!m.isToken)return m.value;const g=m.value;(lU(g)||aU(g))&&uU(g,t,String(r));const p=ov[g[0]];return p(a,g,i.localize,u)}).join("")}function gU(r){const t=r.match(fU);return t?t[1].replace(pU,"'"):r}function yU(r,t){return an(r*1e3,t==null?void 0:t.in)}function vU(r,t){const e=_U(t)?new t(0):ui(t,0);return e.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),e.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),e}function _U(r){var t;return typeof r=="function"&&((t=r.prototype)==null?void 0:t.constructor)===r}function bU(r,t){let e=r.length;switch("string"){case"string":{for(;e>0&&r[e-1]===t;)e--;break}}return r.substring(0,e)}function Tr(r){return r==null}function wU(r){return r!=null}async function pf(){if(typeof window<"u"&&window!==null)return"browser";try{const r=await Ei(()=>import("./__vite-browser-external-FmFgRqLi.js"),[]);return typeof r<"u"&&r.versions!=null&&r.versions.node!=null?"node":"unknown"}catch{return"unknown"}}function xU(r){return Tr(r)?!1:Ct.isInt(r.type)&&!ST(r)||SU(r)}function SU(r){return Tr(r)?!1:Ct.isInt(r.type)&&r.type.isSigned===!1}function TU(r){return Tr(r)?!1:Ct.isFloat(r.type)??!1}function IU(r){return Tr(r)?!1:Ct.isDecimal(r.type)}function EU(r){return Tr(r)?!1:Ct.isBool(r.type)}function AU(r){return Tr(r)?!1:Ct.isDuration(r.type)}function ST(r){return Tr(r)?!1:Ct.isInt(r.type)&&r.metadata.get("ARROW:extension:name")==="period"}function MU(r){return Tr(r)?!1:Ct.isTimestamp(r.type)}function CU(r){return Tr(r)?!1:Ct.isDate(r.type)}function OU(r){return Tr(r)?!1:Ct.isTime(r.type)}function PU(r){return Tr(r)?!1:Ct.isList(r.type)||Ct.isFixedSizeList(r.type)}function RU(r){return Tr(r)?!1:Ct.isStruct(r.type)||Ct.isMap(r.type)}function FU(r){return Tr(r)?!1:Ct.isStruct(r.type)&&r.metadata.get("ARROW:extension:name")==="interval"||Ct.isInterval(r.type)}function DU(r,t){let e;if(t===te.MILLISECOND)e=1e3;else if(t===te.MICROSECOND)e=1e3*1e3;else if(t===te.NANOSECOND)e=1e3*1e3*1e3;else return Number(r);return typeof r=="bigint"&&!Number.isSafeInteger(Number(r))?Number(r/BigInt(e)):Number(r)/e}function LU(r,t){var n;const e=DU(r,((n=t==null?void 0:t.type)==null?void 0:n.unit)??te.SECOND);return yU(e)}function NU(r,t){const e=LU(r,t);return xT(e,e.getMilliseconds()===0?"HH:mm:ss":"HH:mm:ss.SSS")}function BU(r){const t="yyyy-MM-dd";return r instanceof Date||typeof r=="number"&&Number.isFinite(r)?xT(r,t):(console.warn(`Unsupported date value: ${r}`),String(r))}function UU(r,t){var i;if(!(r instanceof Date||typeof r=="number"&&Number.isFinite(r)))return console.warn(`Unsupported datetime value: ${r}`),null;let e;const n=(i=t==null?void 0:t.type)==null?void 0:i.timezone;return typeof r=="number"?n?e=new Fr(r,n):e=new Fr(r):n?e=new Fr(r,n):e=new Fr(r),vU(e,Date)}function kU(r,t){var a;const e=((a=t==null?void 0:t.type)==null?void 0:a.scale)||0;let n=rv.bigNumToString(new rv.BN(r)).padStart(e,"0");if(e===0)return n;let i="";n.startsWith("-")&&(i="-",n=n.slice(1));const s=n.slice(0,-e)||"0",o=bU(n.slice(-e),"0")||"";return`${i}${s}${o?`.${o}`:""}`}function zU(r){const t=r[0],e=r[1],n=[];return t!==0&&n.push(`${t} year${t>1?"s":""}`),e!==0&&n.push(`${e} month${e>1?"s":""}`),n.length?n.join(" "):"0 months"}function VU(r,t){var n,i,s,o;if(Ct.isInterval(t==null?void 0:t.type))return zU(r);const e=t&&t.metadata.get("ARROW:extension:name");if(e&&e==="pandas.interval"){const a=JSON.parse(t.metadata.get("ARROW:extension:metadata")),{closed:l}=a,u=r.toJSON(),c=l==="both"||l==="left"?"[":"(",h=l==="both"||l==="right"?"]":")",f=mf(u.left,(i=(n=t.type)==null?void 0:n.children)==null?void 0:i[0]),d=mf(u.right,(o=(s=t.type)==null?void 0:s.children)==null?void 0:o[1]);return`${c+f}, ${d+h}`}return String(r)}function jU(r,t){return(t==null?void 0:t.type)instanceof hf?JSON.parse(JSON.stringify(r,(e,n)=>{if(wU(n))return typeof n=="bigint"?Number(n):n})):JSON.parse(JSON.stringify(r,(e,n)=>typeof n=="bigint"?Number(n):n))}function mf(r,t){if(Tr(r))return null;const e=r instanceof Date||Number.isFinite(r);if(e&&CU(t))return BU(r);if(typeof r=="bigint"&&OU(t))return NU(Number(r),t);if(e&&MU(t))return UU(r,t);if(ST(t))throw new Error("Period type is not supported yet");if(FU(t))return VU(r,t);if(AU(t))throw new Error("Duration type is not supported yet");return IU(t)?kU(r,t):TU(t)&&Number.isFinite(r)||xU(t)?r:RU(t)||PU(t)?jU(r,t):EU(t)?!!r:String(r)}function cv(r){return((r.toArray()||[]).map(n=>n.toJSON())||[]).map(n=>(r.schema.fields.forEach(i=>n[i.name]=mf(n[i.name],i)),n))}var Ha=(r=>(r.ORIGIN_PRIVATE_FS="origin-private-fs",r.NODE_FS="node-fs",r))(Ha||{});async function TT(r){const t=M1(r,{logger:!1});let e,n;const i=await pf();if(i==="browser"){if(typeof t.bundles>"u"){const{getBundles:l}=await Ei(async()=>{const{getBundles:u}=await import("./default-browser-BrgSDbLD.js");return{getBundles:u}},[]);t.bundles=await l()}n=await Ey(await t.bundles),e=new Worker(n.mainWorker)}else if(i==="node"){if(typeof t.bundles>"u"){const{getBundles:c}=await Ei(async()=>{const{getBundles:h}=await import("./default-node-DXqP3VzA.js");return{getBundles:h}},__vite__mapDeps([0,1,2]));t.bundles=await c()}n=await Ey(await t.bundles);let l=n.mainWorker;l.startsWith("/@fs/")&&(l=l.replace("/@fs/","file://"));const u=await Ei(()=>import("./index-Cp8iQ_hy.js"),[]);e=new u.default(l,{type:"module"})}else throw new Error(`Unsupported environment: ${i}`);let s;t.logger===!0?s=new Ux:t.logger===!1?s=new PD:s=t.logger;const o=new UD(s,e);if(await o.instantiate(n.mainModule,n.pthreadWorker),t.storage)switch(t.storage.type){case Ha.ORIGIN_PRIVATE_FS:{try{let l=t.storage.path;l.startsWith("/")&&(l=l.slice(1)),await o.open({path:`opfs://${l}`,accessMode:t.storage.accessMode})}catch(l){throw await o.terminate(),await e.terminate(),l}break}case Ha.NODE_FS:{try{await o.open({path:t.storage.path,accessMode:t.storage.accessMode,useDirectIO:!0})}catch(l){throw await o.terminate(),await e.terminate(),l}break}}const a=await o.connect();return{worker:e,db:o,conn:a,query:async(l,u=[])=>{if(!u||u.length===0){const d=await a.query(l);return cv(d)}const c=await a.prepare(l),h=await c.query(...u),f=cv(h);return c.close(),f},close:async()=>{await a.close(),await o.terminate(),await e.terminate()}}}async function $U(r,t){await(await r).conn.send("BEGIN TRANSACTION");try{const e=await t(r);return await(await r).conn.send("COMMIT"),e}catch(e){throw await(await r).conn.send("ROLLBACK"),e}}async function GU(r,t,e){await(await r).conn.send(`SAVEPOINT ${t}`);try{const n=await e(r);return await(await r).conn.send(`RELEASE SAVEPOINT ${t}`),n}catch(n){throw await(await r).conn.send(`ROLLBACK TO SAVEPOINT ${t}`),n}}const St=Symbol.for("drizzle:entityKind");function lt(r,t){if(!r||typeof r!="object")return!1;if(r instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,St))throw new Error(`Class "${t.name??""}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let e=Object.getPrototypeOf(r).constructor;if(e)for(;e;){if(St in e&&e[St]===t[St])return!0;e=Object.getPrototypeOf(e)}return!1}var wv;wv=St;class rr{constructor(t,e){W(this,"name");W(this,"keyAsName");W(this,"primary");W(this,"notNull");W(this,"default");W(this,"defaultFn");W(this,"onUpdateFn");W(this,"hasDefault");W(this,"isUnique");W(this,"uniqueName");W(this,"uniqueType");W(this,"dataType");W(this,"columnType");W(this,"enumValues");W(this,"generated");W(this,"generatedIdentity");W(this,"config");this.table=t,this.config=e,this.name=e.name,this.keyAsName=e.keyAsName,this.notNull=e.notNull,this.default=e.default,this.defaultFn=e.defaultFn,this.onUpdateFn=e.onUpdateFn,this.hasDefault=e.hasDefault,this.primary=e.primaryKey,this.isUnique=e.isUnique,this.uniqueName=e.uniqueName,this.uniqueType=e.uniqueType,this.dataType=e.dataType,this.columnType=e.columnType,this.generated=e.generated,this.generatedIdentity=e.generatedIdentity}mapFromDriverValue(t){return t}mapToDriverValue(t){return t}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}W(rr,wv,"Column");const Eo=Symbol.for("drizzle:Name");function WU(r,t){return`${r[Eo]}_${t.join("_")}_unique`}var xv,Sv;class Lr extends(Sv=rr,xv=St,Sv){constructor(t,e){e.uniqueName||(e.uniqueName=WU(t,[e.name])),super(t,e),this.table=t}}W(Lr,xv,"PgColumn");const hv=Symbol.for("drizzle:isPgEnum");function HU(r){return!!r&&typeof r=="function"&&hv in r&&r[hv]===!0}var Tv;Tv=St;class Nr{constructor(t,e,n,i=!1){this._={brand:"Subquery",sql:t,selectedFields:e,alias:n,isWith:i}}}W(Nr,Tv,"Subquery");var Iv,Ev;class Np extends(Ev=Nr,Iv=St,Ev){}W(Np,Iv,"WithSubquery");const Ur={startActiveSpan(r,t){return t()}},Qe=Symbol.for("drizzle:ViewBaseConfig"),Kl=Symbol.for("drizzle:Schema"),gf=Symbol.for("drizzle:Columns"),dv=Symbol.for("drizzle:ExtraConfigColumns"),Vh=Symbol.for("drizzle:OriginalName"),jh=Symbol.for("drizzle:BaseName"),Wu=Symbol.for("drizzle:IsAlias"),fv=Symbol.for("drizzle:ExtraConfigBuilder"),XU=Symbol.for("drizzle:IsDrizzleTable");var Av,Mv,Cv,Ov,Pv,Rv,Fv,Dv,Lv,Nv;Nv=St,Lv=Eo,Dv=Vh,Fv=Kl,Rv=gf,Pv=dv,Ov=jh,Cv=Wu,Mv=XU,Av=fv;class It{constructor(t,e,n){W(this,Lv);W(this,Dv);W(this,Fv);W(this,Rv);W(this,Pv);W(this,Ov);W(this,Cv,!1);W(this,Mv,!0);W(this,Av);this[Eo]=this[Vh]=t,this[Kl]=e,this[jh]=n}}W(It,Nv,"Table"),W(It,"Symbol",{Name:Eo,Schema:Kl,OriginalName:Vh,Columns:gf,ExtraConfigColumns:dv,BaseName:jh,IsAlias:Wu,ExtraConfigBuilder:fv});function vs(r){return r[Eo]}function Xa(r){return`${r[Kl]??"public"}.${r[Eo]}`}function IT(r){return r!=null&&typeof r.getSQL=="function"}function YU(r){var e;const t={sql:"",params:[]};for(const n of r)t.sql+=n.sql,t.params.push(...n.params),(e=n.typings)!=null&&e.length&&(t.typings||(t.typings=[]),t.typings.push(...n.typings));return t}var Bv;Bv=St;class Ze{constructor(t){W(this,"value");this.value=Array.isArray(t)?t:[t]}getSQL(){return new Pt([this])}}W(Ze,Bv,"StringChunk");var Uv;Uv=St;const ps=class ps{constructor(t){W(this,"decoder",ET);W(this,"shouldInlineParams",!1);this.queryChunks=t}append(t){return this.queryChunks.push(...t.queryChunks),this}toQuery(t){return Ur.startActiveSpan("drizzle.buildSQL",e=>{const n=this.buildQueryFromSourceParams(this.queryChunks,t);return e==null||e.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(t,e){const n=Object.assign({},e,{inlineParams:e.inlineParams||this.shouldInlineParams,paramStartIndex:e.paramStartIndex||{value:0}}),{casing:i,escapeName:s,escapeParam:o,prepareTyping:a,inlineParams:l,paramStartIndex:u}=n;return YU(t.map(c=>{var h;if(lt(c,Ze))return{sql:c.value.join(""),params:[]};if(lt(c,Hu))return{sql:s(c.value),params:[]};if(c===void 0)return{sql:"",params:[]};if(Array.isArray(c)){const f=[new Ze("(")];for(const[d,m]of c.entries())f.push(m),dr},AT={mapToDriverValue:r=>r};({...ET,...AT});var zv;zv=St;class ci{constructor(t,e=AT){W(this,"brand");this.value=t,this.encoder=e}getSQL(){return new Pt([this])}}W(ci,zv,"Param");function Y(r,...t){const e=[];(t.length>0||r.length>0&&r[0]!=="")&&e.push(new Ze(r[0]));for(const[n,i]of t.entries())e.push(i,new Ze(r[n+1]));return new Pt(e)}(r=>{function t(){return new Pt([])}r.empty=t;function e(l){return new Pt(l)}r.fromList=e;function n(l){return new Pt([new Ze(l)])}r.raw=n;function i(l,u){const c=[];for(const[h,f]of l.entries())h>0&&u!==void 0&&c.push(u),c.push(f);return new Pt(c)}r.join=i;function s(l){return new Hu(l)}r.identifier=s;function o(l){return new Ms(l)}r.placeholder=o;function a(l,u){return new ci(l,u)}r.param=a})(Y||(Y={}));(r=>{var e;e=St;const n=class n{constructor(s,o){W(this,"isSelectionField",!1);this.sql=s,this.fieldAlias=o}getSQL(){return this.sql}clone(){return new n(this.sql,this.fieldAlias)}};W(n,e,"SQL.Aliased");let t=n;r.Aliased=t})(Pt||(Pt={}));var Vv;Vv=St;class Ms{constructor(t){this.name=t}getSQL(){return new Pt([this])}}W(Ms,Vv,"Placeholder");function pv(r,t){return r.map(e=>{if(lt(e,Ms)){if(!(e.name in t))throw new Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(lt(e,ci)&<(e.value,Ms)){if(!(e.value.name in t))throw new Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}const QU=Symbol.for("drizzle:IsDrizzleView");var jv,$v,Gv;Gv=St,$v=Qe,jv=QU;class ji{constructor({name:t,schema:e,selectedFields:n,query:i}){W(this,$v);W(this,jv,!0);this[Qe]={name:t,originalName:t,schema:e,selectedFields:n,query:i,isExisting:!i,isAlias:!1}}getSQL(){return new Pt([this])}}W(ji,Gv,"View");rr.prototype.getSQL=function(){return new Pt([this])};It.prototype.getSQL=function(){return new Pt([this])};Nr.prototype.getSQL=function(){return new Pt([this])};var Wv;Wv=St;class Ya{constructor(t){this.table=t}get(t,e){return e==="table"?this.table:t[e]}}W(Ya,Wv,"ColumnAliasProxyHandler");var Hv;Hv=St;class gc{constructor(t,e){this.alias=t,this.replaceOriginalName=e}get(t,e){if(e===It.Symbol.IsAlias)return!0;if(e===It.Symbol.Name)return this.alias;if(this.replaceOriginalName&&e===It.Symbol.OriginalName)return this.alias;if(e===Qe)return{...t[Qe],name:this.alias,isAlias:!0};if(e===It.Symbol.Columns){const i=t[It.Symbol.Columns];if(!i)return i;const s={};return Object.keys(i).map(o=>{s[o]=new Proxy(i[o],new Ya(new Proxy(t,this)))}),s}const n=t[e];return lt(n,rr)?new Proxy(n,new Ya(new Proxy(t,this))):n}}W(gc,Hv,"TableAliasProxyHandler");function $h(r,t){return new Proxy(r,new gc(t,!1))}function ei(r,t){return new Proxy(r,new Ya(new Proxy(r.table,new gc(t,!1))))}function MT(r,t){return new Pt.Aliased(Xu(r.sql,t),r.fieldAlias)}function Xu(r,t){return Y.join(r.queryChunks.map(e=>lt(e,rr)?ei(e,t):lt(e,Pt)?Xu(e,t):lt(e,Pt.Aliased)?MT(e,t):e))}var Xv,Yv;class Bp extends(Yv=Error,Xv=St,Yv){constructor({message:t,cause:e}){super(t),this.name="DrizzleError",this.cause=e}}W(Bp,Xv,"DrizzleError");var qv,Qv;class CT extends(Qv=Bp,qv=St,Qv){constructor(){super({message:"Rollback"})}}W(CT,qv,"TransactionRollbackError");function Sr(r,t){return qU(t)&&!IT(r)&&!lt(r,ci)&&!lt(r,Ms)&&!lt(r,rr)&&!lt(r,It)&&!lt(r,ji)?new ci(r,t):r}const OT=(r,t)=>Y`${r} = ${Sr(t,r)}`,ZU=(r,t)=>Y`${r} <> ${Sr(t,r)}`;function yf(...r){const t=r.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new Pt(t):new Pt([new Ze("("),Y.join(t,new Ze(" and ")),new Ze(")")])}function KU(...r){const t=r.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new Pt(t):new Pt([new Ze("("),Y.join(t,new Ze(" or ")),new Ze(")")])}function JU(r){return Y`not ${r}`}const tk=(r,t)=>Y`${r} > ${Sr(t,r)}`,ek=(r,t)=>Y`${r} >= ${Sr(t,r)}`,rk=(r,t)=>Y`${r} < ${Sr(t,r)}`,nk=(r,t)=>Y`${r} <= ${Sr(t,r)}`;function ik(r,t){return Array.isArray(t)?t.length===0?Y`false`:Y`${r} in ${t.map(e=>Sr(e,r))}`:Y`${r} in ${Sr(t,r)}`}function sk(r,t){return Array.isArray(t)?t.length===0?Y`true`:Y`${r} not in ${t.map(e=>Sr(e,r))}`:Y`${r} not in ${Sr(t,r)}`}function ok(r){return Y`${r} is null`}function ak(r){return Y`${r} is not null`}function lk(r){return Y`exists ${r}`}function uk(r){return Y`not exists ${r}`}function ck(r,t,e){return Y`${r} between ${Sr(t,r)} and ${Sr(e,r)}`}function hk(r,t,e){return Y`${r} not between ${Sr(t,r)} and ${Sr(e,r)}`}function dk(r,t){return Y`${r} like ${t}`}function fk(r,t){return Y`${r} not like ${t}`}function pk(r,t){return Y`${r} ilike ${t}`}function mk(r,t){return Y`${r} not ilike ${t}`}function gk(r){return Y`${r} asc`}function yk(r){return Y`${r} desc`}var Zv;Zv=St;class PT{write(t){console.log(t)}}W(PT,Zv,"ConsoleLogWriter");var Kv;Kv=St;class RT{constructor(t){W(this,"writer");this.writer=(t==null?void 0:t.writer)??new PT}logQuery(t,e){const n=e.map(s=>{try{return JSON.stringify(s)}catch{return String(s)}}),i=n.length?` -- params: [${n.join(", ")}]`:"";this.writer.write(`Query: ${t}${i}`)}}W(RT,Kv,"DefaultLogger");var Jv;Jv=St;class FT{logQuery(){}}W(FT,Jv,"NoopLogger");var t_,e_;e_=St,t_=Symbol.toStringTag;class $i{constructor(){W(this,t_,"QueryPromise")}catch(t){return this.then(void 0,t)}finally(t){return this.then(e=>(t==null||t(),e),e=>{throw t==null||t(),e})}then(t,e){return this.execute().then(t,e)}}W($i,e_,"QueryPromise");function Cs(r,t){return Object.entries(r).reduce((e,[n,i])=>{if(typeof n!="string")return e;const s=t?[...t,n]:[n];return lt(i,rr)||lt(i,Pt)||lt(i,Pt.Aliased)?e.push({path:s,field:i}):lt(i,It)?e.push(...Cs(i[It.Symbol.Columns],s)):e.push(...Cs(i,s)),e},[])}function Up(r,t){const e=Object.keys(r),n=Object.keys(t);if(e.length!==n.length)return!1;for(const[i,s]of e.entries())if(s!==n[i])return!1;return!0}function DT(r,t){const e=Object.entries(t).filter(([,n])=>n!==void 0).map(([n,i])=>lt(i,Pt)||lt(i,rr)?[n,i]:[n,new ci(i,r[It.Symbol.Columns][n])]);if(e.length===0)throw new Error("No values to set");return Object.fromEntries(e)}function vk(r,t){for(const e of t)for(const n of Object.getOwnPropertyNames(e.prototype))n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n)||Object.create(null))}function _k(r){return r[It.Symbol.Columns]}function fs(r){return lt(r,Nr)?r._.alias:lt(r,ji)?r[Qe].name:lt(r,Pt)?void 0:r[It.Symbol.IsAlias]?r[It.Symbol.Name]:r[It.Symbol.BaseName]}function bk(r){if(typeof r!="object"||r===null||r.constructor.name!=="Object")return!1;if("logger"in r){const t=typeof r.logger;return!(t!=="boolean"&&(t!=="object"||typeof r.logger.logQuery!="function")&&t!=="undefined")}if("schema"in r){const t=typeof r.schema;return!(t!=="object"&&t!=="undefined")}if("casing"in r){const t=typeof r.casing;return!(t!=="string"&&t!=="undefined")}if("mode"in r)return!(r.mode!=="default"||r.mode!=="planetscale"||r.mode!==void 0);if("connection"in r){const t=typeof r.connection;return!(t!=="string"&&t!=="object"&&t!=="undefined")}if("client"in r){const t=typeof r.client;return!(t!=="object"&&t!=="function"&&t!=="undefined")}return Object.keys(r).length===0}var r_,n_;class LT extends(n_=Lr,r_=St,n_){getSQLType(){return"date"}mapFromDriverValue(t){return new Date(t)}mapToDriverValue(t){return t.toISOString()}}W(LT,r_,"PgDate");var i_,s_;class NT extends(s_=Lr,i_=St,s_){getSQLType(){return"date"}}W(NT,i_,"PgDateString");var o_,a_;class BT extends(a_=Lr,o_=St,a_){constructor(t,e){super(t,e)}getSQLType(){return"json"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}W(BT,o_,"PgJson");var l_,u_;class UT extends(u_=Lr,l_=St,u_){constructor(t,e){super(t,e)}getSQLType(){return"jsonb"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}W(UT,l_,"PgJsonb");var c_,h_;class kT extends(h_=Lr,c_=St,h_){constructor(e,n){super(e,n);W(this,"precision");W(this,"scale");this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(e){return typeof e=="string"?e:String(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}W(kT,c_,"PgNumeric");var d_,f_;class zT extends(f_=Lr,d_=St,f_){constructor(e,n){super(e,n);W(this,"withTimezone");W(this,"precision");this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}W(zT,d_,"PgTime");var p_,m_;class VT extends(m_=Lr,p_=St,m_){constructor(e,n){super(e,n);W(this,"withTimezone");W(this,"precision");W(this,"mapFromDriverValue",e=>new Date(this.withTimezone?e:e+"+0000"));W(this,"mapToDriverValue",e=>e.toISOString());this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}}W(VT,p_,"PgTimestamp");var g_,y_;class jT extends(y_=Lr,g_=St,y_){constructor(e,n){super(e,n);W(this,"withTimezone");W(this,"precision");this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}W(jT,g_,"PgTimestampString");var v_,__;class $T extends(__=Lr,v_=St,__){getSQLType(){return"uuid"}}W($T,v_,"PgUUID");const mv=Symbol.for("drizzle:PgInlineForeignKeys"),gv=Symbol.for("drizzle:EnableRLS");var b_,w_,x_,S_,T_,I_;class Xr extends(I_=It,T_=St,S_=mv,x_=gv,w_=It.Symbol.ExtraConfigBuilder,b_=It.Symbol.ExtraConfigColumns,I_){constructor(){super(...arguments);W(this,S_,[]);W(this,x_,!1);W(this,w_);W(this,b_,{})}}W(Xr,T_,"PgTable"),W(Xr,"Symbol",Object.assign({},It.Symbol,{InlineForeignKeys:mv,EnableRLS:gv}));var E_;E_=St;class GT{constructor(t,e){W(this,"columns");W(this,"name");this.columns=t,this.name=e}build(t){return new WT(t,this.columns,this.name)}}W(GT,E_,"PgPrimaryKeyBuilder");var A_;A_=St;class WT{constructor(t,e,n){W(this,"columns");W(this,"name");this.table=t,this.columns=e,this.name=n}getName(){return this.name??`${this.table[Xr.Symbol.Name]}_${this.columns.map(t=>t.name).join("_")}_pk`}}W(WT,A_,"PgPrimaryKey");var M_;M_=St;class kp{constructor(t,e,n){W(this,"referencedTableName");W(this,"fieldName");this.sourceTable=t,this.referencedTable=e,this.relationName=n,this.referencedTableName=e[It.Symbol.Name]}}W(kp,M_,"Relation");var C_;C_=St;class HT{constructor(t,e){this.table=t,this.config=e}}W(HT,C_,"Relations");var O_,P_;const Qu=class Qu extends(P_=kp,O_=St,P_){constructor(t,e,n,i){super(t,e,n==null?void 0:n.relationName),this.config=n,this.isNullable=i}withFieldName(t){const e=new Qu(this.sourceTable,this.referencedTable,this.config,this.isNullable);return e.fieldName=t,e}};W(Qu,O_,"One");let Os=Qu;var R_,F_;const Zu=class Zu extends(F_=kp,R_=St,F_){constructor(t,e,n){super(t,e,n==null?void 0:n.relationName),this.config=n}withFieldName(t){const e=new Zu(this.sourceTable,this.referencedTable,this.config);return e.fieldName=t,e}};W(Zu,R_,"Many");let Yu=Zu;function wk(){return{and:yf,between:ck,eq:OT,exists:lk,gt:tk,gte:ek,ilike:pk,inArray:ik,isNull:ok,isNotNull:ak,like:dk,lt:rk,lte:nk,ne:ZU,not:JU,notBetween:hk,notExists:uk,notLike:fk,notIlike:mk,notInArray:sk,or:KU,sql:Y}}function xk(){return{sql:Y,asc:gk,desc:yk}}function Sk(r,t){var s;Object.keys(r).length===1&&"default"in r&&!lt(r.default,It)&&(r=r.default);const e={},n={},i={};for(const[o,a]of Object.entries(r))if(lt(a,It)){const l=Xa(a),u=n[l];e[l]=o,i[o]={tsName:o,dbName:a[It.Symbol.Name],schema:a[It.Symbol.Schema],columns:a[It.Symbol.Columns],relations:(u==null?void 0:u.relations)??{},primaryKey:(u==null?void 0:u.primaryKey)??[]};for(const h of Object.values(a[It.Symbol.Columns]))h.primary&&i[o].primaryKey.push(h);const c=(s=a[It.Symbol.ExtraConfigBuilder])==null?void 0:s.call(a,a[It.Symbol.ExtraConfigColumns]);if(c)for(const h of Object.values(c))lt(h,GT)&&i[o].primaryKey.push(...h.columns)}else if(lt(a,HT)){const l=Xa(a.table),u=e[l],c=a.config(t(a.table));let h;for(const[f,d]of Object.entries(c))if(u){const m=i[u];m.relations[f]=d}else l in n||(n[l]={relations:{},primaryKey:h}),n[l].relations[f]=d}return{tables:i,tableNamesMap:e}}function Tk(r){return function(e,n){return new Os(r,e,n,(n==null?void 0:n.fields.reduce((i,s)=>i&&s.notNull,!0))??!1)}}function Ik(r){return function(e,n){return new Yu(r,e,n)}}function Ek(r,t,e){if(lt(e,Os)&&e.config)return{fields:e.config.fields,references:e.config.references};const n=t[Xa(e.referencedTable)];if(!n)throw new Error(`Table "${e.referencedTable[It.Symbol.Name]}" not found in schema`);const i=r[n];if(!i)throw new Error(`Table "${n}" not found in schema`);const s=e.sourceTable,o=t[Xa(s)];if(!o)throw new Error(`Table "${s[It.Symbol.Name]}" not found in schema`);const a=[];for(const l of Object.values(i.relations))(e.relationName&&e!==l&&l.relationName===e.relationName||!e.relationName&&l.referencedTable===e.sourceTable)&&a.push(l);if(a.length>1)throw e.relationName?new Error(`There are multiple relations with name "${e.relationName}" in table "${n}"`):new Error(`There are multiple relations between "${n}" and "${e.sourceTable[It.Symbol.Name]}". Please specify relation name`);if(a[0]&<(a[0],Os)&&a[0].config)return{fields:a[0].config.references,references:a[0].config.fields};throw new Error(`There is not enough information to infer relation "${o}.${e.fieldName}"`)}function Ak(r){return{one:Tk(r),many:Ik(r)}}function vf(r,t,e,n,i=s=>s){const s={};for(const[o,a]of n.entries())if(a.isJson){const l=t.relations[a.tsKey],u=e[o],c=typeof u=="string"?JSON.parse(u):u;s[a.tsKey]=lt(l,Os)?c&&vf(r,r[a.relationTableTsKey],c,a.selection,i):c.map(h=>vf(r,r[a.relationTableTsKey],h,a.selection,i))}else{const l=i(e[o]),u=a.field;let c;lt(u,rr)?c=u:lt(u,Pt)?c=u.decoder:c=u.sql.decoder,s[a.tsKey]=l===null?null:c.mapFromDriverValue(l)}return s}var D_;D_=St;const Ku=class Ku{constructor(t){W(this,"config");this.config={...t}}get(t,e){if(e==="_")return{...t._,selectedFields:new Proxy(t._.selectedFields,this)};if(e===Qe)return{...t[Qe],selectedFields:new Proxy(t[Qe].selectedFields,this)};if(typeof e=="symbol")return t[e];const i=(lt(t,Nr)?t._.selectedFields:lt(t,ji)?t[Qe].selectedFields:t)[e];if(lt(i,Pt.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!i.isSelectionField)return i.sql;const s=i.clone();return s.isSelectionField=!0,s}if(lt(i,Pt)){if(this.config.sqlBehavior==="sql")return i;throw new Error(`You tried to reference "${e}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return lt(i,rr)?this.config.alias?new Proxy(i,new Ya(new Proxy(i.table,new gc(this.config.alias,this.config.replaceOriginalName??!1)))):i:typeof i!="object"||i===null?i:new Proxy(i,new Ku(this.config))}};W(Ku,D_,"SelectionProxyHandler");let or=Ku;var L_,N_;class _f extends(N_=$i,L_=St,N_){constructor(e,n,i,s){super();W(this,"config");W(this,"authToken");W(this,"execute",e=>Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken)));this.session=n,this.dialect=i,this.config={table:e,withList:s}}where(e){return this.config.where=e,this}returning(e=this.config.table[It.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=Cs(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}_prepare(e){return Ur.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new or({alias:vs(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}W(_f,L_,"PgDelete");function Mk(r){return(r.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function Ck(r){return(r.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,n,i)=>{const s=i===0?n.toLowerCase():`${n[0].toUpperCase()}${n.slice(1)}`;return e+s},"")}function Ok(r){return r}var B_;B_=St;class XT{constructor(t){W(this,"cache",{});W(this,"cachedTables",{});W(this,"convert");this.convert=t==="snake_case"?Mk:t==="camelCase"?Ck:Ok}getColumnCasing(t){if(!t.keyAsName)return t.name;const e=t.table[It.Symbol.Schema]??"public",n=t.table[It.Symbol.OriginalName],i=`${e}.${n}.${t.name}`;return this.cache[i]||this.cacheTable(t.table),this.cache[i]}cacheTable(t){const e=t[It.Symbol.Schema]??"public",n=t[It.Symbol.OriginalName],i=`${e}.${n}`;if(!this.cachedTables[i]){for(const s of Object.values(t[It.Symbol.Columns])){const o=`${i}.${s.name}`;this.cache[o]=this.convert(s.name)}this.cachedTables[i]=!0}}clearCache(){this.cache={},this.cachedTables={}}}W(XT,B_,"CasingCache");var U_,k_;class zp extends(k_=ji,U_=St,k_){}W(zp,U_,"PgViewBase");var z_;z_=St;class Ea{constructor(t){W(this,"casing");this.casing=new XT(t==null?void 0:t.casing)}async migrate(t,e,n){const i=typeof n=="string"?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",s=typeof n=="string"?"drizzle":n.migrationsSchema??"drizzle",o=Y` +]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new cs(e,n.map(i=>new _r(e,i)))}slice(t,e){const n=this.schema;[t,e]=ax({length:this.numRows},t,e);const i=hx(this.data,this._offsets,t,e);return new cs(n,i.map(s=>new _r(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&tn.children[t]);if(e.length===0){const{type:n}=this.schema.fields[t],i=le({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Ne(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&tthis.getChildAt(u));[s[t],a[t]]=[o,e],[n,i]=Ph(n,a)}return new cs(n,i)}select(t){const e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new cs(e,n)}assign(t){const e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,l,u)=>{const[c,h]=a,f=e.findIndex(d=>d.name===l.name);return~f?h[f]=u:c.push(u),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,l)=>[l,i[l]]).map(([a,l])=>l===void 0?this.getChildAt(a):t.getChildAt(l)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new cs(...Ph(s,o))}};wx=Symbol.toStringTag;Ni[wx]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Du(op),r.get=Du(xr.getVisitFn(k.Struct)),r.set=dx(sn.getVisitFn(k.Struct)),r.indexOf=fx(Lu.getVisitFn(k.Struct)),"Table"))(Ni.prototype);var xx;let _r=class ba{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Le))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=le({nullCount:0,type:new dr(this.schema.fields),children:this.schema.fields.map(e=>le({type:e.type,nullCount:0}))})]=t,!(this.data instanceof Ae))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=yy(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((l,u,c)=>(l.children[c]=e[u],l.length=Math.max(l.length,e[u].length),l.fields[c]=Pe.new({name:u,type:e[u].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),o=new Le(n),a=le({type:new dr(n),length:s,children:i,nullCount:0});[this.schema,this.data]=yy(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Sx(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return xr.visit(this.data,t)}at(t){return this.get(np(t,this.numRows))}set(t,e){return sn.visit(this.data,t,e)}indexOf(t,e){return Lu.visit(this.data,t,e)}[Symbol.iterator](){return ap.visit(new Ne([this.data]))}toArray(){return[...this]}concat(...t){return new Ni(this.schema,[this,...t])}slice(t,e){const[n]=new Ne([this.data]).slice(t,e).data;return new ba(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&ti.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&ta.name===s);~o&&(i[o]=this.data.children[o])}return new ba(e,le({type:n,length:this.numRows,children:i}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=le({type:new dr(e.fields),length:this.numRows,children:n});return new ba(e,i)}};xx=Symbol.toStringTag;_r[xx]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(_r.prototype);function yy(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;const i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(const[a,l]of r.fields.entries()){const u=t[a];(!u||u.length!==e)&&(i[a]=l.clone({nullable:!0}),s[a]=(n=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:le({type:l.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),le({type:new dr(i),length:e,children:s})]}function Sx(r,t,e=new Map){var n,i;if(((n=r==null?void 0:r.length)!==null&&n!==void 0?n:0)>0&&(r==null?void 0:r.length)===(t==null?void 0:t.length))for(let s=-1,o=r.length;++sle({type:i.type})),n=le({type:new dr(t.fields),nullCount:0,children:e});super(t,n)}}let wi=class Sn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new Sn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+_e),(e||new Sn).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):je.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):me.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new qe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,je.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,me.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return Sn.startMessage(t),Sn.addVersion(t,e),Sn.addHeaderType(t,n),Sn.addHeader(t,i),Sn.addBodyLength(t,s),Sn.addCustomMetadata(t,o),Sn.endMessage(t)}};class F2 extends se{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return ay.startNull(e),ay.endNull(e)}visitInt(t,e){return Cr.startInt(e),Cr.addBitWidth(e,t.bitWidth),Cr.addIsSigned(e,t.isSigned),Cr.endInt(e)}visitFloat(t,e){return Rn.startFloatingPoint(e),Rn.addPrecision(e,t.precision),Rn.endFloatingPoint(e)}visitBinary(t,e){return ry.startBinary(e),ry.endBinary(e)}visitLargeBinary(t,e){return iy.startLargeBinary(e),iy.endLargeBinary(e)}visitBool(t,e){return ny.startBool(e),ny.endBool(e)}visitUtf8(t,e){return ly.startUtf8(e),ly.endUtf8(e)}visitLargeUtf8(t,e){return sy.startLargeUtf8(e),sy.endLargeUtf8(e)}visitDecimal(t,e){return Js.startDecimal(e),Js.addScale(e,t.scale),Js.addPrecision(e,t.precision),Js.addBitWidth(e,t.bitWidth),Js.endDecimal(e)}visitDate(t,e){return Vl.startDate(e),Vl.addUnit(e,t.unit),Vl.endDate(e)}visitTime(t,e){return Zr.startTime(e),Zr.addUnit(e,t.unit),Zr.addBitWidth(e,t.bitWidth),Zr.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return Kr.startTimestamp(e),Kr.addUnit(e,t.unit),n!==void 0&&Kr.addTimezone(e,n),Kr.endTimestamp(e)}visitInterval(t,e){return Fn.startInterval(e),Fn.addUnit(e,t.unit),Fn.endInterval(e)}visitDuration(t,e){return jl.startDuration(e),jl.addUnit(e,t.unit),jl.endDuration(e)}visitList(t,e){return oy.startList(e),oy.endList(e)}visitStruct(t,e){return ys.startStruct_(e),ys.endStruct_(e)}visitUnion(t,e){vr.startTypeIdsVector(e,t.typeIds.length);const n=vr.createTypeIdsVector(e,t.typeIds);return vr.startUnion(e),vr.addMode(e,t.mode),vr.addTypeIds(e,n),vr.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return ai.startDictionaryEncoding(e),ai.addId(e,BigInt(t.id)),ai.addIsOrdered(e,t.isOrdered),n!==void 0&&ai.addIndexType(e,n),ai.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return $l.startFixedSizeBinary(e),$l.addByteWidth(e,t.byteWidth),$l.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Gl.startFixedSizeList(e),Gl.addListSize(e,t.listSize),Gl.endFixedSizeList(e)}visitMap(t,e){return Wl.startMap(e),Wl.addKeysSorted(e,t.keysSorted),Wl.endMap(e)}}const Rh=new F2;function D2(r,t=new Map){return new Le(N2(r,t),Yl(r.metadata),t)}function Tx(r){return new Br(r.count,Ix(r.columns),Ex(r.columns))}function L2(r){return new Vn(Tx(r.data),r.id,r.isDelta)}function N2(r,t){return(r.fields||[]).filter(Boolean).map(e=>Pe.fromJSON(e,t))}function vy(r,t){return(r.children||[]).filter(Boolean).map(e=>Pe.fromJSON(e,t))}function Ix(r){return(r||[]).reduce((t,e)=>[...t,new Bi(e.count,B2(e.VALIDITY)),...Ix(e.children)],[])}function Ex(r,t=[]){for(let e=-1,n=(r||[]).length;++et+ +(e===0),0)}function U2(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=by(r,vy(r,t)),i=new Pe(r.name,o,r.nullable,Yl(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?_y(n):new za,a=new Oo(t.get(e),n,e,s.isOrdered),i=new Pe(r.name,a,r.nullable,Yl(r.metadata))):(n=(n=s.indexType)?_y(n):new za,t.set(e,o=by(r,vy(r,t))),a=new Oo(o,n,e,s.isOrdered),i=new Pe(r.name,a,r.nullable,Yl(r.metadata))),i||null}function Yl(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function _y(r){return new Es(r.isSigned,r.bitWidth)}function by(r,t){const e=r.type.name;switch(e){case"NONE":return new Fi;case"null":return new Fi;case"binary":return new gu;case"largebinary":return new yu;case"utf8":return new vu;case"largeutf8":return new _u;case"bool":return new bu;case"list":return new Au((t||[])[0]);case"struct":return new dr(t||[]);case"struct_":return new dr(t||[])}switch(e){case"int":{const n=r.type;return new Es(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=r.type;return new mu(ar[n.precision])}case"decimal":{const n=r.type;return new wu(n.scale,n.precision,n.bitWidth)}case"date":{const n=r.type;return new xu(nn[n.unit])}case"time":{const n=r.type;return new Su(Vt[n.unit],n.bitWidth)}case"timestamp":{const n=r.type;return new Tu(Vt[n.unit],n.timezone)}case"interval":{const n=r.type;return new Iu(zn[n.unit])}case"duration":{const n=r.type;return new Eu(Vt[n.unit])}case"union":{const n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new Mu(lr[o],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=r.type;return new Cu(n.byteWidth)}case"fixedsizelist":{const n=r.type;return new Ou(n.listSize,(t||[])[0])}case"map":{const n=r.type;return new Pu((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var k2=zb,z2=Mo;class fr{static fromJSON(t,e){const n=new fr(0,je.V5,e);return n._createHeader=V2(t,e),n}static decode(t){t=new z2(ce(t));const e=wi.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new fr(n,i,s);return o._createHeader=j2(e,s),o}static encode(t){const e=new k2;let n=-1;return t.isSchema()?n=Le.encode(e,t.header()):t.isRecordBatch()?n=Br.encode(e,t.header()):t.isDictionaryBatch()&&(n=Vn.encode(e,t.header())),wi.startMessage(e),wi.addVersion(e,je.V5),wi.addHeader(e,n),wi.addHeaderType(e,t.headerType),wi.addBodyLength(e,BigInt(t.bodyLength)),wi.finishMessageBuffer(e,wi.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof Le)return new fr(0,je.V5,me.Schema,t);if(t instanceof Br)return new fr(e,je.V5,me.RecordBatch,t);if(t instanceof Vn)return new fr(e,je.V5,me.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===me.Schema}isRecordBatch(){return this.headerType===me.RecordBatch}isDictionaryBatch(){return this.headerType===me.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=Te(t)}}class Br{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=Te(t)}}class Vn{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=Te(e)}}class Ln{constructor(t,e){this.offset=Te(t),this.length=Te(e)}}class Bi{constructor(t,e){this.length=Te(t),this.nullCount=Te(e)}}function V2(r,t){return()=>{switch(t){case me.Schema:return Le.fromJSON(r);case me.RecordBatch:return Br.fromJSON(r);case me.DictionaryBatch:return Vn.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${me[t]}, type: ${t} }`)}}function j2(r,t){return()=>{switch(t){case me.Schema:return Le.decode(r.header(new In),new Map,r.version());case me.RecordBatch:return Br.decode(r.header(new ri),r.version());case me.DictionaryBatch:return Vn.decode(r.header(new Zs),r.version())}throw new Error(`Unrecognized Message type: { name: ${me[t]}, type: ${t} }`)}}Pe.encode=J2;Pe.decode=Z2;Pe.fromJSON=U2;Le.encode=K2;Le.decode=$2;Le.fromJSON=D2;Br.encode=tD;Br.decode=G2;Br.fromJSON=Tx;Vn.encode=eD;Vn.decode=W2;Vn.fromJSON=L2;Bi.encode=rD;Bi.decode=X2;Ln.encode=nD;Ln.decode=H2;function $2(r,t=new Map,e=je.V5){const n=Q2(r,t);return new Le(n,ql(r),t,e)}function G2(r,t=je.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Br(r.length(),Y2(r),q2(r,t))}function W2(r,t=je.V5){return new Vn(Br.decode(r.data(),t),r.id(),r.isDelta())}function H2(r){return new Ln(r.offset(),r.length())}function X2(r){return new Bi(r.length(),r.nullCount())}function Y2(r){const t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++nPe.encode(r,s));In.startFieldsVector(r,e.length);const n=In.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?In.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{const a=r.createString(`${s}`),l=r.createString(`${o}`);return qe.startKeyValue(r),qe.addKey(r,a),qe.addValue(r,l),qe.endKeyValue(r)})):-1;return In.startSchema(r),In.addFields(r,n),In.addEndianness(r,iD?Co.Little:Co.Big),i!==-1&&In.addCustomMetadata(r,i),In.endSchema(r)}function J2(r,t){let e=-1,n=-1,i=-1;const s=t.type;let o=t.typeId;Ot.isDictionary(s)?(o=s.dictionary.typeId,i=Rh.visit(s,r),n=Rh.visit(s.dictionary,r)):n=Rh.visit(s,r);const a=(s.children||[]).map(c=>Pe.encode(r,c)),l=Wr.createChildrenVector(r,a),u=t.metadata&&t.metadata.size>0?Wr.createCustomMetadataVector(r,[...t.metadata].map(([c,h])=>{const f=r.createString(`${c}`),d=r.createString(`${h}`);return qe.startKeyValue(r),qe.addKey(r,f),qe.addValue(r,d),qe.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Wr.startField(r),Wr.addType(r,n),Wr.addTypeType(r,o),Wr.addChildren(r,l),Wr.addNullable(r,!!t.nullable),e!==-1&&Wr.addName(r,e),i!==-1&&Wr.addDictionary(r,i),u!==-1&&Wr.addCustomMetadata(r,u),Wr.endField(r)}function tD(r,t){const e=t.nodes||[],n=t.buffers||[];ri.startNodesVector(r,e.length);for(const o of e.slice().reverse())Bi.encode(r,o);const i=r.endVector();ri.startBuffersVector(r,n.length);for(const o of n.slice().reverse())Ln.encode(r,o);const s=r.endVector();return ri.startRecordBatch(r),ri.addLength(r,BigInt(t.length)),ri.addNodes(r,i),ri.addBuffers(r,s),ri.endRecordBatch(r)}function eD(r,t){const e=Br.encode(r,t.data);return Zs.startDictionaryBatch(r),Zs.addId(r,BigInt(t.id)),Zs.addIsDelta(r,t.isDelta),Zs.addData(r,e),Zs.endDictionaryBatch(r)}function rD(r,t){return $b.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function nD(r,t){return jb.createBuffer(r,BigInt(t.offset),BigInt(t.length))}const iD=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),pp=r=>`Expected ${me[r]} Message in stream, but was null or length 0.`,mp=r=>`Header pointer of flatbuffer-encoded ${me[r]} Message is null or length 0.`,Ax=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Mx=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`;class Cx{constructor(t){this.source=t instanceof Nu?t:new Nu(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?Be:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(pp(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=ce(this.source.read(t));if(e.byteLength[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(pp(t));return e.value}readSchema(){const t=me.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(mp(t));return n}}const uc=4,sf="ARROW1",ja=new Uint8Array(sf.length);for(let r=0;rthis):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Yr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Yr.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof tn?t:Hd(t)?hD(t):Db(t)?pD(t):Is(t)?Jt(this,void 0,void 0,function*(){return yield tn.from(yield t)}):Lb(t)||Kf(t)||Nb(t)||Uo(t)?fD(new Po(t)):dD(new Nu(t))}static readAll(t){return t instanceof tn?t.isSync()?Ty(t):Iy(t):Hd(t)||ArrayBuffer.isView(t)||Qa(t)||Fb(t)?Ty(t):Iy(t)}}class Uu extends tn{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return br(this,arguments,function*(){yield Rt(yield*Ss(Bn(this[Symbol.iterator]())))})}}class ku extends tn{constructor(t){super(t),this._impl=t}readAll(){return Jt(this,void 0,void 0,function*(){var t,e,n,i;const s=new Array;try{for(var o=!0,a=Bn(this),l;l=yield a.next(),t=l.done,!t;o=!0){i=l.value,o=!1;const u=i;s.push(u)}}catch(u){e={error:u}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Px extends Uu{constructor(t){super(t),this._impl=t}}class lD extends ku{constructor(t){super(t),this._impl=t}}class Rx{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const n=this._loadVectors(t,e,this.schema.fields),i=le({type:new dr(this.schema.fields),length:t.length,children:n});return new _r(this.schema,i)}_loadDictionaryBatch(t,e){const{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n),l=o.dictionaries.get(n),u=this._loadVectors(t.data,e,[l]);return(a&&i?a.concat(new Ne(u)):new Ne(u)).memoize()}_loadVectors(t,e,n){return new bx(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class zu extends Rx{constructor(t,e){super(e),this._reader=Hd(t)?new oD(this._handle=t):new Cx(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Dx(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Be}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Be}next(){if(this.closed)return Be;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new fp(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Vu extends Rx{constructor(t,e){super(e),this._reader=new sD(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Jt(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Jt(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Dx(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Jt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Be})}return(t){return Jt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Be})}next(){return Jt(this,void 0,void 0,function*(){if(this.closed)return Be;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new fp(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Jt(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Fx extends zu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof gy?t:new gy(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const i=this._reader.readMessage(me.RecordBatch);if(i!=null&&i.isRecordBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const i=this._reader.readMessage(me.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-Ox,n=t.readInt32(e),i=t.readAt(e-n,n);return Va.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return Jt(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return Jt(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const i=yield this._reader.readMessage(me.RecordBatch);if(i!=null&&i.isRecordBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return Jt(this,void 0,void 0,function*(){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const i=yield this._reader.readMessage(me.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return Jt(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-Ox,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Va.decode(i)})}_readNextMessageAndValidate(t){return Jt(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?gp(t)?new Px(new Fx(r.read())):new Uu(new zu(r)):new Uu(new zu(function*(){}()))}function fD(r){return Jt(this,void 0,void 0,function*(){const t=yield r.peek(tl+7&-8);return t&&t.byteLength>=4?gp(t)?new Px(new Fx(yield r.read())):new ku(new Vu(r)):new ku(new Vu(function(){return br(this,arguments,function*(){})}()))})}function pD(r){return Jt(this,void 0,void 0,function*(){const{size:t}=yield r.stat(),e=new Bu(r,t);return t>=aD&&gp(yield e.readAt(0,tl+7&-8))?new lD(new uD(e)):new ku(new Vu(e))})}class ke extends se{static assemble(...t){const e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof _r?s.data.children:s.data),n=new ke;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Ne)return this.visitMany(t.data),this;const{type:e}=t;if(!Ot.isDictionary(e)){const{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(Ot.isUnion(e))this.nodes.push(new Bi(n,0));else{const{nullCount:i}=t;Ot.isNull(e)||dn.call(this,i<=0?new Uint8Array(0):Ru(t.offset,n,t.nullBitmap)),this.nodes.push(new Bi(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function dn(r){const t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Ln(this._byteLength,t)),this._byteLength+=t,this}function mD(r){var t;const{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(dn.call(this,i),e.mode===lr.Sparse)return of.call(this,r);if(e.mode===lr.Dense){if(r.offset<=0)return dn.call(this,s),of.call(this,r);{const o=new Int32Array(n),a=Object.create(null),l=Object.create(null);for(let u,c,h=-1;++h{const h=e.typeIds[c],f=a[h],d=l[h];return u.slice(f,Math.min(n,d))}))}}return this}function gD(r){let t;return r.nullCount>=r.length?dn.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?dn.call(this,Ru(r.offset,r.length,t)):dn.call(this,Fu(r.values))}function pi(r){return dn.call(this,r.values.subarray(0,r.length*r.stride))}function cc(r){const{length:t,values:e,valueOffsets:n}=r,i=Te(n[0]),s=Te(n[t]),o=Math.min(s-i,e.byteLength-i);return dn.call(this,Ub(-i,t+1,n)),dn.call(this,e.subarray(i,i+o)),this}function yp(r){const{length:t,valueOffsets:e}=r;if(e){const{[0]:n,[t]:i}=e;return dn.call(this,Ub(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function of(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}ke.prototype.visitBool=gD;ke.prototype.visitInt=pi;ke.prototype.visitFloat=pi;ke.prototype.visitUtf8=cc;ke.prototype.visitLargeUtf8=cc;ke.prototype.visitBinary=cc;ke.prototype.visitLargeBinary=cc;ke.prototype.visitFixedSizeBinary=pi;ke.prototype.visitDate=pi;ke.prototype.visitTimestamp=pi;ke.prototype.visitTime=pi;ke.prototype.visitDecimal=pi;ke.prototype.visitList=yp;ke.prototype.visitStruct=of;ke.prototype.visitUnion=mD;ke.prototype.visitInterval=pi;ke.prototype.visitDuration=pi;ke.prototype.visitFixedSizeList=yp;ke.prototype.visitMap=yp;class Lx extends lp{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Xl,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,wr(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Is(t)?t.then(e=>this.writeAll(e)):Uo(t)?wp(this,t):bp(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Xl?this._sink=t:(this._sink=new Xl,t&&WR(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&HR(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!nf(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Ni&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof _r&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!nf(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof _r?t instanceof fp||this._writeRecordBatch(t):t instanceof Ni?this.writeAll(t.batches):Qa(t)&&this.writeAll(t)}_writeMessage(t,e=8){const n=e-1,i=fr.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,l=a-s-o;return t.headerType===me.RecordBatch?this._recordBatchBlocks.push(new Di(a,t.bodyLength,this._position)):t.headerType===me.DictionaryBatch&&this._dictionaryBlocks.push(new Di(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){const e=ce(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(fr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ja)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=ke.assemble(t),o=new Br(t.numRows,n,i),a=fr.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){const{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=ke.assemble(new Ne([t])),l=new Br(t.length,s,o),u=new Vn(l,e,n),c=fr.from(u,i);return this._writeMessage(c)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var e,n;for(const[i,s]of t.dictionaries){const o=(e=s==null?void 0:s.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(i),l=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(const[u,c]of o.entries())this._writeDictionaryBatch(c,i,u>0);else if(ln.writeAll(i)):Uo(t)?wp(n,t):bp(n,t)}}class _p extends Lx{static writeAll(t){const e=new _p;return Is(t)?t.then(n=>e.writeAll(n)):Uo(t)?wp(e,t):bp(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){const e=Va.encode(new Va(t,je.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function bp(r,t){let e=t;t instanceof Ni&&(e=t.batches,r.reset(void 0,t.schema));for(const n of e)r.write(n);return r.finish()}function wp(r,t){return Jt(this,void 0,void 0,function*(){var e,n,i,s,o,a,l;try{for(e=!0,n=Bn(t);i=yield n.next(),s=i.done,!s;e=!0){l=i.value,e=!1;const u=l;r.write(u)}}catch(u){o={error:u}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function yD(r,t="stream"){return(t==="stream"?vp:_p).writeAll(r).toUint8Array(!0)}var vD=Object.create,Nx=Object.defineProperty,_D=Object.getOwnPropertyDescriptor,bD=Object.getOwnPropertyNames,wD=Object.getPrototypeOf,xD=Object.prototype.hasOwnProperty,SD=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),TD=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of bD(t))!xD.call(r,i)&&i!==e&&Nx(r,i,{get:()=>t[i],enumerable:!(n=_D(t,i))||n.enumerable});return r},ID=(r,t,e)=>(e=r!=null?vD(wD(r)):{},TD(!r||!r.__esModule?Nx(e,"default",{value:r,enumerable:!0}):e,r)),ED=SD((r,t)=>{t.exports=Worker}),Bx=(r=>(r[r.UNDEFINED=0]="UNDEFINED",r[r.AUTOMATIC=1]="AUTOMATIC",r[r.READ_ONLY=2]="READ_ONLY",r[r.READ_WRITE=3]="READ_WRITE",r))(Bx||{}),AD=(r=>(r[r.IDENTIFIER=0]="IDENTIFIER",r[r.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",r[r.STRING_CONSTANT=2]="STRING_CONSTANT",r[r.OPERATOR=3]="OPERATOR",r[r.KEYWORD=4]="KEYWORD",r[r.COMMENT=5]="COMMENT",r))(AD||{}),MD=(r=>(r[r.NONE=0]="NONE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR",r))(MD||{}),CD=(r=>(r[r.NONE=0]="NONE",r[r.CONNECT=1]="CONNECT",r[r.DISCONNECT=2]="DISCONNECT",r[r.OPEN=3]="OPEN",r[r.QUERY=4]="QUERY",r[r.INSTANTIATE=5]="INSTANTIATE",r))(CD||{}),OD=(r=>(r[r.NONE=0]="NONE",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR",r[r.START=3]="START",r[r.RUN=4]="RUN",r[r.CAPTURE=5]="CAPTURE",r))(OD||{}),PD=(r=>(r[r.NONE=0]="NONE",r[r.WEB_WORKER=1]="WEB_WORKER",r[r.NODE_WORKER=2]="NODE_WORKER",r[r.BINDINGS=3]="BINDINGS",r[r.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",r))(PD||{}),RD=class{log(r){}},Ux=class{constructor(r=2){this.level=r}log(r){r.level>=this.level&&console.log(r)}},FD=(r=>(r[r.SUCCESS=0]="SUCCESS",r))(FD||{}),DD=class{constructor(r,t){this._bindings=r,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(r){return r(this._bindings,this._conn)}async query(r){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:r});let t=await this._bindings.runQuery(this._conn,r),e=tn.from(t);return console.assert(e.isSync(),"Reader is not sync"),console.assert(e.isFile(),"Reader is not file"),new Ni(e)}async send(r,t=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:r});let e=await this._bindings.startPendingQuery(this._conn,r,t);for(;e==null;)e=await this._bindings.pollPendingQuery(this._conn);let n=new kx(this._bindings,this._conn,e),i=await tn.from(n);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(r){return await this._bindings.getTableNames(this._conn,r)}async prepare(r){let t=await this._bindings.createPrepared(this._conn,r);return new LD(this._bindings,this._conn,t)}async insertArrowTable(r,t){let e=yD(r,"stream");await this.insertArrowFromIPCStream(e,t)}async insertArrowFromIPCStream(r,t){await this._bindings.insertArrowFromIPCStream(this._conn,r,t)}async insertCSVFromPath(r,t){await this._bindings.insertCSVFromPath(this._conn,r,t)}async insertJSONFromPath(r,t){await this._bindings.insertJSONFromPath(this._conn,r,t)}},kx=class{constructor(r,t,e){this.db=r,this.conn=t,this.header=e,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let r;return this._inFlight!=null?(r=await this._inFlight,this._inFlight=null):r=await this.db.fetchQueryResults(this.conn),this._depleted=r.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:r}}[Symbol.asyncIterator](){return this}},LD=class{constructor(r,t,e){this.bindings=r,this.connectionId=t,this.statementId=e}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...r){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,r),e=tn.from(t);return console.assert(e.isSync()),console.assert(e.isFile()),new Ni(e)}async send(...r){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,r),e=new kx(this.bindings,this.connectionId,t),n=await tn.from(e);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},ND=(r=>(r.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",r.CLOSE_PREPARED="CLOSE_PREPARED",r.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",r.REGISTER_OPFS_FILE_NAME="REGISTER_OPFS_FILE_NAME",r.CONNECT="CONNECT",r.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",r.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",r.CREATE_PREPARED="CREATE_PREPARED",r.DISCONNECT="DISCONNECT",r.DROP_FILE="DROP_FILE",r.DROP_FILES="DROP_FILES",r.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",r.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",r.FLUSH_FILES="FLUSH_FILES",r.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",r.GET_TABLE_NAMES="GET_TABLE_NAMES",r.GET_VERSION="GET_VERSION",r.GLOB_FILE_INFOS="GLOB_FILE_INFOS",r.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",r.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",r.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",r.INSTANTIATE="INSTANTIATE",r.OPEN="OPEN",r.PING="PING",r.POLL_PENDING_QUERY="POLL_PENDING_QUERY",r.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",r.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",r.REGISTER_FILE_URL="REGISTER_FILE_URL",r.RESET="RESET",r.RUN_PREPARED="RUN_PREPARED",r.RUN_QUERY="RUN_QUERY",r.SEND_PREPARED="SEND_PREPARED",r.START_PENDING_QUERY="START_PENDING_QUERY",r.TOKENIZE="TOKENIZE",r))(ND||{}),BD=(r=>(r.CONNECTION_INFO="CONNECTION_INFO",r.ERROR="ERROR",r.FEATURE_FLAGS="FEATURE_FLAGS",r.FILE_BUFFER="FILE_BUFFER",r.FILE_INFOS="FILE_INFOS",r.FILE_SIZE="FILE_SIZE",r.FILE_STATISTICS="FILE_STATISTICS",r.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",r.LOG="LOG",r.OK="OK",r.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",r.QUERY_PLAN="QUERY_PLAN",r.QUERY_RESULT="QUERY_RESULT",r.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",r.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",r.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",r.REGISTERED_FILE="REGISTERED_FILE",r.SCRIPT_TOKENS="SCRIPT_TOKENS",r.SUCCESS="SUCCESS",r.TABLE_NAMES="TABLE_NAMES",r.VERSION_STRING="VERSION_STRING",r))(BD||{}),de=class{constructor(r,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=r,this.data=t,this.promise=new Promise((e,n)=>{this.promiseResolver=e,this.promiseRejecter=n})}};function Ql(r){switch(r.typeId){case k.Binary:return{sqlType:"binary"};case k.Bool:return{sqlType:"bool"};case k.Date:return{sqlType:"date"};case k.DateDay:return{sqlType:"date32[d]"};case k.DateMillisecond:return{sqlType:"date64[ms]"};case k.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case k.Float:return{sqlType:"float"};case k.Float16:return{sqlType:"float16"};case k.Float32:return{sqlType:"float32"};case k.Float64:return{sqlType:"float64"};case k.Int:return{sqlType:"int32"};case k.Int16:return{sqlType:"int16"};case k.Int32:return{sqlType:"int32"};case k.Int64:return{sqlType:"int64"};case k.Uint16:return{sqlType:"uint16"};case k.Uint32:return{sqlType:"uint32"};case k.Uint64:return{sqlType:"uint64"};case k.Uint8:return{sqlType:"uint8"};case k.IntervalDayTime:return{sqlType:"interval[dt]"};case k.IntervalYearMonth:return{sqlType:"interval[m]"};case k.List:return{sqlType:"list",valueType:Ql(r.valueType)};case k.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case k.Null:return{sqlType:"null"};case k.Utf8:return{sqlType:"utf8"};case k.Struct:return{sqlType:"struct",fields:r.children.map(t=>af(t.name,t.type))};case k.Map:{let t=r;return{sqlType:"map",keyType:Ql(t.keyType),valueType:Ql(t.valueType)}}case k.Time:return{sqlType:"time[s]"};case k.TimeMicrosecond:return{sqlType:"time[us]"};case k.TimeMillisecond:return{sqlType:"time[ms]"};case k.TimeNanosecond:return{sqlType:"time[ns]"};case k.TimeSecond:return{sqlType:"time[s]"};case k.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case k.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case k.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case k.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case k.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function af(r,t){let e=Ql(t);return e.name=r,e}var UD=new TextEncoder,kD=class{constructor(r,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=r,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(r){this._worker=r,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,e)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(r,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let e=this._nextMessageId++;return this._pendingRequests.set(e,r),this._worker.postMessage({messageId:e,type:r.type,data:r.data},t),await r.promise}onMessage(r){var t;let e=r.data;switch(e.type){case"LOG":{this._logger.log(e.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(e.data);return}}let n=this._pendingRequests.get(e.requestId);if(!n){console.warn("unassociated response: [".concat(e.requestId,", ").concat(e.type.toString(),"]"));return}if(this._pendingRequests.delete(e.requestId),e.type=="ERROR"){let i=new Error(e.data.message);i.name=e.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=e.data.stack),n.promiseRejecter(i);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"REGISTER_OPFS_FILE_NAME":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(e.type=="OK"){n.promiseResolver(e.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],e.type=="OK"){n.promiseResolver(e.data);return}break;case"GLOB_FILE_INFOS":if(e.type=="FILE_INFOS"){n.promiseResolver(e.data);return}break;case"GET_VERSION":if(e.type=="VERSION_STRING"){n.promiseResolver(e.data);return}break;case"GET_FEATURE_FLAGS":if(e.type=="FEATURE_FLAGS"){n.promiseResolver(e.data);return}break;case"GET_TABLE_NAMES":if(e.type=="TABLE_NAMES"){n.promiseResolver(e.data);return}break;case"TOKENIZE":if(e.type=="SCRIPT_TOKENS"){n.promiseResolver(e.data);return}break;case"COPY_FILE_TO_BUFFER":if(e.type=="FILE_BUFFER"){n.promiseResolver(e.data);return}break;case"EXPORT_FILE_STATISTICS":if(e.type=="FILE_STATISTICS"){n.promiseResolver(e.data);return}break;case"CONNECT":if(e.type=="CONNECTION_INFO"){n.promiseResolver(e.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(e.type=="QUERY_RESULT"){n.promiseResolver(e.data);return}break;case"SEND_PREPARED":if(e.type=="QUERY_RESULT_HEADER"){n.promiseResolver(e.data);return}break;case"START_PENDING_QUERY":if(e.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(e.data);return}break;case"POLL_PENDING_QUERY":if(e.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(e.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],e.type=="SUCCESS"){n.promiseResolver(e.data);return}break;case"FETCH_QUERY_RESULTS":if(e.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(e.data);return}break;case"CREATE_PREPARED":if(e.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(e.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(e.type.toString())))}onError(r){console.error(r),console.error("error in duckdb worker: ".concat(r.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let r=new de("RESET",null);return await this.postTask(r)}async ping(){let r=new de("PING",null);await this.postTask(r)}async dropFile(r){let t=new de("DROP_FILE",r);return await this.postTask(t)}async dropFiles(){let r=new de("DROP_FILES",null);return await this.postTask(r)}async flushFiles(){let r=new de("FLUSH_FILES",null);return await this.postTask(r)}async instantiate(r,t=null,e=n=>{}){this._onInstantiationProgress.push(e);let n=new de("INSTANTIATE",[r,t]);return await this.postTask(n)}async getVersion(){let r=new de("GET_VERSION",null);return await this.postTask(r)}async getFeatureFlags(){let r=new de("GET_FEATURE_FLAGS",null);return await this.postTask(r)}async open(r){let t=new de("OPEN",r);await this.postTask(t)}async tokenize(r){let t=new de("TOKENIZE",r);return await this.postTask(t)}async connectInternal(){let r=new de("CONNECT",null);return await this.postTask(r)}async connect(){let r=await this.connectInternal();return new DD(this,r)}async disconnect(r){let t=new de("DISCONNECT",r);await this.postTask(t)}async runQuery(r,t){let e=new de("RUN_QUERY",[r,t]);return await this.postTask(e)}async startPendingQuery(r,t,e=!1){let n=new de("START_PENDING_QUERY",[r,t,e]);return await this.postTask(n)}async pollPendingQuery(r){let t=new de("POLL_PENDING_QUERY",r);return await this.postTask(t)}async cancelPendingQuery(r){let t=new de("CANCEL_PENDING_QUERY",r);return await this.postTask(t)}async fetchQueryResults(r){let t=new de("FETCH_QUERY_RESULTS",r);return await this.postTask(t)}async getTableNames(r,t){let e=new de("GET_TABLE_NAMES",[r,t]);return await this.postTask(e)}async createPrepared(r,t){let e=new de("CREATE_PREPARED",[r,t]);return await this.postTask(e)}async closePrepared(r,t){let e=new de("CLOSE_PREPARED",[r,t]);await this.postTask(e)}async runPrepared(r,t,e){let n=new de("RUN_PREPARED",[r,t,e]);return await this.postTask(n)}async sendPrepared(r,t,e){let n=new de("SEND_PREPARED",[r,t,e]);return await this.postTask(n)}async globFiles(r){let t=new de("GLOB_FILE_INFOS",r);return await this.postTask(t)}async registerFileText(r,t){let e=UD.encode(t);await this.registerFileBuffer(r,e)}async registerFileURL(r,t,e,n){t===void 0&&(t=r);let i=new de("REGISTER_FILE_URL",[r,t,e,n]);await this.postTask(i)}async registerEmptyFileBuffer(r){}async registerFileBuffer(r,t){let e=new de("REGISTER_FILE_BUFFER",[r,t]);await this.postTask(e,[t.buffer])}async registerFileHandle(r,t,e,n){let i=new de("REGISTER_FILE_HANDLE",[r,t,e,n]);await this.postTask(i,[])}async registerOPFSFileName(r){let t=new de("REGISTER_OPFS_FILE_NAME",[r]);await this.postTask(t,[])}async collectFileStatistics(r,t){let e=new de("COLLECT_FILE_STATISTICS",[r,t]);await this.postTask(e,[])}async exportFileStatistics(r){let t=new de("EXPORT_FILE_STATISTICS",r);return await this.postTask(t,[])}async copyFileToBuffer(r){let t=new de("COPY_FILE_TO_BUFFER",r);return await this.postTask(t)}async copyFileToPath(r,t){let e=new de("COPY_FILE_TO_PATH",[r,t]);await this.postTask(e)}async insertArrowFromIPCStream(r,t,e){if(t.length==0)return;let n=new de("INSERT_ARROW_FROM_IPC_STREAM",[r,t,e]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(r,t,e){if(e.columns!==void 0){let i=[];for(let s in e.columns){let o=e.columns[s];i.push(af(s,o))}e.columnsFlat=i,delete e.columns}let n=new de("IMPORT_CSV_FROM_PATH",[r,t,e]);await this.postTask(n)}async insertJSONFromPath(r,t,e){if(e.columns!==void 0){let i=[];for(let s in e.columns){let o=e.columns[s];i.push(af(s,o))}e.columnsFlat=i,delete e.columns}let n=new de("IMPORT_JSON_FROM_PATH",[r,t,e]);await this.postTask(n)}};function zD(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}zD();var VD=(r=>(r[r.BUFFER=0]="BUFFER",r[r.NODE_FS=1]="NODE_FS",r[r.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",r[r.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",r[r.HTTP=4]="HTTP",r[r.S3=5]="S3",r))(VD||{}),jD=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),$D=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),GD=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),WD=()=>(async r=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(r)}catch{return!1}})(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])),HD={version:"1.29.1-dev68.0"},xp=HD.version.split(".");xp[0];xp[1];xp[2];var XD=()=>typeof navigator>"u",Fh=null,Dh=null,Lh=null,Nh=null,Bh=null;async function YD(){return Fh==null&&(Fh=typeof BigInt64Array<"u"),Dh==null&&(Dh=await $D()),Lh==null&&(Lh=await WD()),Nh==null&&(Nh=await GD()),Bh==null&&(Bh=await jD()),{bigInt64Array:Fh,crossOriginIsolated:XD()||globalThis.crossOriginIsolated||!1,wasmExceptions:Dh,wasmSIMD:Nh,wasmThreads:Lh,wasmBulkMemory:Bh}}async function Ey(r){let t=await YD();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&r.coi)return{mainModule:r.coi.mainModule,mainWorker:r.coi.mainWorker,pthreadWorker:r.coi.pthreadWorker};if(r.eh)return{mainModule:r.eh.mainModule,mainWorker:r.eh.mainWorker,pthreadWorker:null}}return{mainModule:r.mvp.mainModule,mainWorker:r.mvp.mainWorker,pthreadWorker:null}}ID(ED());const Uh={},wa={};function Ia(r,t){try{const n=(Uh[r]||(Uh[r]=new Intl.DateTimeFormat("en-GB",{timeZone:r,hour:"numeric",timeZoneName:"longOffset"}).format))(t).split("GMT")[1]||"";return n in wa?wa[n]:Ay(n,n.split(":"))}catch{if(r in wa)return wa[r];const e=r==null?void 0:r.match(qD);return e?Ay(r,e.slice(1)):NaN}}const qD=/([+-]\d\d):?(\d\d)?/;function Ay(r,t){const e=+t[0],n=+(t[1]||0);return wa[r]=e>0?e*60+n:e*60-n}class Fr extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(Ia(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),zx(this),lf(this)):this.setTime(Date.now())}static tz(t,...e){return e.length?new Fr(...e,t):new Fr(Date.now(),t)}withTimeZone(t){return new Fr(+this,t)}getTimezoneOffset(){return-Ia(this.timeZone,this)}setTime(t){return Date.prototype.setTime.apply(this,arguments),lf(this),+this}[Symbol.for("constructDateFrom")](t){return new Fr(+new Date(t),this.timeZone)}}const My=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(r=>{if(!My.test(r))return;const t=r.replace(My,"$1UTC");Fr.prototype[t]&&(r.startsWith("get")?Fr.prototype[r]=function(){return this.internal[t]()}:(Fr.prototype[r]=function(){return Date.prototype[t].apply(this.internal,arguments),QD(this),+this},Fr.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),lf(this),+this}))});function lf(r){r.internal.setTime(+r),r.internal.setUTCMinutes(r.internal.getUTCMinutes()-r.getTimezoneOffset())}function QD(r){Date.prototype.setFullYear.call(r,r.internal.getUTCFullYear(),r.internal.getUTCMonth(),r.internal.getUTCDate()),Date.prototype.setHours.call(r,r.internal.getUTCHours(),r.internal.getUTCMinutes(),r.internal.getUTCSeconds(),r.internal.getUTCMilliseconds()),zx(r)}function zx(r){const t=Ia(r.timeZone,r),e=new Date(+r);e.setUTCHours(e.getUTCHours()-1);const n=-new Date(+r).getTimezoneOffset(),i=-new Date(+e).getTimezoneOffset(),s=n-i,o=Date.prototype.getHours.apply(r)!==r.internal.getUTCHours();s&&o&&r.internal.setUTCMinutes(r.internal.getUTCMinutes()+s);const a=n-t;a&&Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+a);const l=Ia(r.timeZone,r),c=-new Date(+r).getTimezoneOffset()-l,h=l!==t,f=c-a;if(h&&f){Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+f);const d=Ia(r.timeZone,r),m=l-d;m&&(r.internal.setUTCMinutes(r.internal.getUTCMinutes()+m),Date.prototype.setUTCMinutes.call(r,Date.prototype.getUTCMinutes.call(r)+m))}}const ZD=new TextDecoder("utf-8"),KD=r=>ZD.decode(r),JD=new TextEncoder,Vx=r=>JD.encode(r),An=r=>typeof r=="function",el=r=>r!=null&&Object(r)===r,tL=r=>el(r)&&An(r.then),jx=r=>el(r)&&An(r[Symbol.iterator]),eL=r=>el(r)&&An(r[Symbol.asyncIterator]),rL=r=>el(r)&&"done"in r&&"value"in r,nL=r=>el(r)&&An(r.clear)&&An(r.bytes)&&An(r.position)&&An(r.setPosition)&&An(r.capacity)&&An(r.getBufferIdentifier)&&An(r.createLong),Sp=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function iL(r){const t=r[0]?[r[0]]:[];let e,n,i,s;for(let o,a,l=0,u=0,c=r.length;++lc+h.byteLength,0);let i,s,o,a=0,l=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,n);for(const c=e.length;++lur(Int8Array,r),aL=r=>ur(Int16Array,r),lL=r=>ur(Int32Array,r),uL=r=>ur(BigInt64Array,r),cL=r=>ur(Uint8Array,r),hL=r=>ur(Uint16Array,r),dL=r=>ur(Uint32Array,r),fL=r=>ur(BigUint64Array,r),pL=r=>ur(Float32Array,r),mL=r=>ur(Float64Array,r),gL=r=>ur(Uint8ClampedArray,r),cf=r=>(r.next(),r);function*Xn(r,t){const e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Sp?e(t):jx(t)?t:e(t);return yield*cf(function*(i){let s=null;do s=i.next(yield ur(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}const yL=r=>Xn(Int8Array,r),vL=r=>Xn(Int16Array,r),_L=r=>Xn(Int32Array,r),bL=r=>Xn(Uint8Array,r),wL=r=>Xn(Uint16Array,r),xL=r=>Xn(Uint32Array,r),SL=r=>Xn(Float32Array,r),TL=r=>Xn(Float64Array,r),IL=r=>Xn(Uint8ClampedArray,r);function mn(r,t){return br(this,arguments,function*(){if(tL(t))return yield Rt(yield Rt(yield*Ss(Bn(mn(r,yield Rt(t))))));const n=function(o){return br(this,arguments,function*(){yield yield Rt(yield Rt(o))})},i=function(o){return br(this,arguments,function*(){yield Rt(yield*Ss(Bn(cf(function*(a){let l=null;do l=a.next(yield l==null?void 0:l.value);while(!l.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Sp?n(t):jx(t)?i(t):eL(t)?t:n(t);return yield Rt(yield*Ss(Bn(cf(function(o){return br(this,arguments,function*(){let a=null;do a=yield Rt(o.next(yield yield Rt(ur(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield Rt(new r)})}const EL=r=>mn(Int8Array,r),AL=r=>mn(Int16Array,r),ML=r=>mn(Int32Array,r),CL=r=>mn(Uint8Array,r),OL=r=>mn(Uint16Array,r),PL=r=>mn(Uint32Array,r),RL=r=>mn(Float32Array,r),FL=r=>mn(Float64Array,r),DL=r=>mn(Uint8ClampedArray,r);function LL(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n0)do if(r[e]!==t[e])return!1;while(++eFo(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}const UL=Object.freeze(Object.defineProperty({__proto__:null,valueToString:Fo},Symbol.toStringTag,{value:"Module"}));function pr(r){if(typeof r=="bigint"&&(rNumber.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Gx(r,t){return pr(r/t)+pr(r%t)/pr(t)}const Wx=Symbol.for("isArrowBigNum");function gn(r,...t){return t.length===0?Object.setPrototypeOf(ur(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}gn.prototype[Wx]=!0;gn.prototype.toJSON=function(){return`"${Do(this)}"`};gn.prototype.valueOf=function(r){return Tp(this,r)};gn.prototype.toString=function(){return Do(this)};gn.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Tp(this);case"string":return Do(this);case"default":return Hx(this)}return Do(this)};function xo(...r){return gn.apply(this,r)}function So(...r){return gn.apply(this,r)}function $a(...r){return gn.apply(this,r)}Object.setPrototypeOf(xo.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(So.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf($a.prototype,Object.create(Uint32Array.prototype));Object.assign(xo.prototype,gn.prototype,{constructor:xo,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(So.prototype,gn.prototype,{constructor:So,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign($a.prototype,gn.prototype,{constructor:$a,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const kL=BigInt(4294967296)*BigInt(4294967296),zL=kL-BigInt(1);function Tp(r,t){const{buffer:e,byteOffset:n,byteLength:i,signed:s}=r,o=new BigUint64Array(e,n,i/8),a=s&&o.at(-1)&BigInt(1)<=0)return kh(r);t=t.slice();let n=1;for(let s=0;s(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(Ct.prototype);class Cy extends Ct{constructor(){super(H.Null)}toString(){return"Null"}}Yx=Symbol.toStringTag;Cy[Yx]=(r=>r[Symbol.toStringTag]="Null")(Cy.prototype);class Oy extends Ct{constructor(t,e){super(H.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}qx=Symbol.toStringTag;Oy[qx]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Oy.prototype);class Py extends Ct{constructor(t){super(H.Float),this.precision=t}get ArrayType(){switch(this.precision){case Dr.HALF:return Uint16Array;case Dr.SINGLE:return Float32Array;case Dr.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Qx=Symbol.toStringTag;Py[Qx]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Py.prototype);class Ry extends Ct{constructor(){super(H.Binary)}toString(){return"Binary"}}Zx=Symbol.toStringTag;Ry[Zx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Ry.prototype);class Fy extends Ct{constructor(){super(H.LargeBinary)}toString(){return"LargeBinary"}}Kx=Symbol.toStringTag;Fy[Kx]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Fy.prototype);class Dy extends Ct{constructor(){super(H.Utf8)}toString(){return"Utf8"}}Jx=Symbol.toStringTag;Dy[Jx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Dy.prototype);class Ly extends Ct{constructor(){super(H.LargeUtf8)}toString(){return"LargeUtf8"}}tS=Symbol.toStringTag;Ly[tS]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Ly.prototype);class Ny extends Ct{constructor(){super(H.Bool)}toString(){return"Bool"}}eS=Symbol.toStringTag;Ny[eS]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Ny.prototype);class By extends Ct{constructor(t,e,n=128){super(H.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}rS=Symbol.toStringTag;By[rS]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(By.prototype);class Uy extends Ct{constructor(t){super(H.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Ui[this.unit]}>`}get ArrayType(){return this.unit===Ui.DAY?Int32Array:BigInt64Array}}nS=Symbol.toStringTag;Uy[nS]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Uy.prototype);class ky extends Ct{constructor(t,e){super(H.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${te[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}iS=Symbol.toStringTag;ky[iS]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(ky.prototype);class zy extends Ct{constructor(t,e){super(H.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${te[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}sS=Symbol.toStringTag;zy[sS]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(zy.prototype);class Vy extends Ct{constructor(t){super(H.Interval),this.unit=t}toString(){return`Interval<${As[this.unit]}>`}}oS=Symbol.toStringTag;Vy[oS]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Vy.prototype);class jy extends Ct{constructor(t){super(H.Duration),this.unit=t}toString(){return`Duration<${te[this.unit]}>`}}aS=Symbol.toStringTag;jy[aS]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(jy.prototype);class $y extends Ct{constructor(t){super(H.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}lS=Symbol.toStringTag;$y[lS]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))($y.prototype);class hf extends Ct{constructor(t){super(H.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}uS=Symbol.toStringTag;hf[uS]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(hf.prototype);class Gy extends Ct{constructor(t,e,n){super(H.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}cS=Symbol.toStringTag;Gy[cS]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Gy.prototype);class Wy extends Ct{constructor(t){super(H.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}hS=Symbol.toStringTag;Wy[hS]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Wy.prototype);class Hy extends Ct{constructor(t,e){super(H.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}dS=Symbol.toStringTag;Hy[dS]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Hy.prototype);class Xy extends Ct{constructor(t,e=!1){var n,i,s;if(super(H.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){const o=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}fS=Symbol.toStringTag;Xy[fS]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Xy.prototype);const jL=(r=>()=>++r)(-1);class Yy extends Ct{constructor(t,e,n,i){super(H.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?jL():pr(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}pS=Symbol.toStringTag;Yy[pS]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Yy.prototype);function mS(r){const t=r;switch(r.typeId){case H.Decimal:return r.bitWidth/32;case H.Interval:return 1+t.unit;case H.FixedSizeList:return t.listSize;case H.FixedSizeBinary:return t.byteWidth;default:return 1}}class he{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return $L(this,t,e)}getVisitFnByTypeId(t,e=!0){return ao(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function $L(r,t,e=!0){return typeof t=="number"?ao(r,t,e):typeof t=="string"&&t in H?ao(r,H[t],e):t&&t instanceof Ct?ao(r,qy(t),e):t!=null&&t.type&&t.type instanceof Ct?ao(r,qy(t.type),e):ao(r,H.NONE,e)}function ao(r,t,e=!0){let n=null;switch(t){case H.Null:n=r.visitNull;break;case H.Bool:n=r.visitBool;break;case H.Int:n=r.visitInt;break;case H.Int8:n=r.visitInt8||r.visitInt;break;case H.Int16:n=r.visitInt16||r.visitInt;break;case H.Int32:n=r.visitInt32||r.visitInt;break;case H.Int64:n=r.visitInt64||r.visitInt;break;case H.Uint8:n=r.visitUint8||r.visitInt;break;case H.Uint16:n=r.visitUint16||r.visitInt;break;case H.Uint32:n=r.visitUint32||r.visitInt;break;case H.Uint64:n=r.visitUint64||r.visitInt;break;case H.Float:n=r.visitFloat;break;case H.Float16:n=r.visitFloat16||r.visitFloat;break;case H.Float32:n=r.visitFloat32||r.visitFloat;break;case H.Float64:n=r.visitFloat64||r.visitFloat;break;case H.Utf8:n=r.visitUtf8;break;case H.LargeUtf8:n=r.visitLargeUtf8;break;case H.Binary:n=r.visitBinary;break;case H.LargeBinary:n=r.visitLargeBinary;break;case H.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case H.Date:n=r.visitDate;break;case H.DateDay:n=r.visitDateDay||r.visitDate;break;case H.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case H.Timestamp:n=r.visitTimestamp;break;case H.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case H.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case H.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case H.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case H.Time:n=r.visitTime;break;case H.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case H.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case H.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case H.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case H.Decimal:n=r.visitDecimal;break;case H.List:n=r.visitList;break;case H.Struct:n=r.visitStruct;break;case H.Union:n=r.visitUnion;break;case H.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case H.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case H.Dictionary:n=r.visitDictionary;break;case H.Interval:n=r.visitInterval;break;case H.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case H.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case H.Duration:n=r.visitDuration;break;case H.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case H.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case H.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case H.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case H.FixedSizeList:n=r.visitFixedSizeList;break;case H.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${H[t]}'`)}function qy(r){switch(r.typeId){case H.Null:return H.Null;case H.Int:{const{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?H.Int8:H.Uint8;case 16:return e?H.Int16:H.Uint16;case 32:return e?H.Int32:H.Uint32;case 64:return e?H.Int64:H.Uint64}return H.Int}case H.Float:switch(r.precision){case Dr.HALF:return H.Float16;case Dr.SINGLE:return H.Float32;case Dr.DOUBLE:return H.Float64}return H.Float;case H.Binary:return H.Binary;case H.LargeBinary:return H.LargeBinary;case H.Utf8:return H.Utf8;case H.LargeUtf8:return H.LargeUtf8;case H.Bool:return H.Bool;case H.Decimal:return H.Decimal;case H.Time:switch(r.unit){case te.SECOND:return H.TimeSecond;case te.MILLISECOND:return H.TimeMillisecond;case te.MICROSECOND:return H.TimeMicrosecond;case te.NANOSECOND:return H.TimeNanosecond}return H.Time;case H.Timestamp:switch(r.unit){case te.SECOND:return H.TimestampSecond;case te.MILLISECOND:return H.TimestampMillisecond;case te.MICROSECOND:return H.TimestampMicrosecond;case te.NANOSECOND:return H.TimestampNanosecond}return H.Timestamp;case H.Date:switch(r.unit){case Ui.DAY:return H.DateDay;case Ui.MILLISECOND:return H.DateMillisecond}return H.Date;case H.Interval:switch(r.unit){case As.DAY_TIME:return H.IntervalDayTime;case As.YEAR_MONTH:return H.IntervalYearMonth}return H.Interval;case H.Duration:switch(r.unit){case te.SECOND:return H.DurationSecond;case te.MILLISECOND:return H.DurationMillisecond;case te.MICROSECOND:return H.DurationMicrosecond;case te.NANOSECOND:return H.DurationNanosecond}return H.Duration;case H.Map:return H.Map;case H.List:return H.List;case H.Struct:return H.Struct;case H.Union:switch(r.mode){case jn.Dense:return H.DenseUnion;case jn.Sparse:return H.SparseUnion}return H.Union;case H.FixedSizeBinary:return H.FixedSizeBinary;case H.FixedSizeList:return H.FixedSizeList;case H.Dictionary:return H.Dictionary}throw new Error(`Unrecognized type '${H[r.typeId]}'`)}he.prototype.visitInt8=null;he.prototype.visitInt16=null;he.prototype.visitInt32=null;he.prototype.visitInt64=null;he.prototype.visitUint8=null;he.prototype.visitUint16=null;he.prototype.visitUint32=null;he.prototype.visitUint64=null;he.prototype.visitFloat16=null;he.prototype.visitFloat32=null;he.prototype.visitFloat64=null;he.prototype.visitDateDay=null;he.prototype.visitDateMillisecond=null;he.prototype.visitTimestampSecond=null;he.prototype.visitTimestampMillisecond=null;he.prototype.visitTimestampMicrosecond=null;he.prototype.visitTimestampNanosecond=null;he.prototype.visitTimeSecond=null;he.prototype.visitTimeMillisecond=null;he.prototype.visitTimeMicrosecond=null;he.prototype.visitTimeNanosecond=null;he.prototype.visitDenseUnion=null;he.prototype.visitSparseUnion=null;he.prototype.visitIntervalDayTime=null;he.prototype.visitIntervalYearMonth=null;he.prototype.visitDuration=null;he.prototype.visitDurationSecond=null;he.prototype.visitDurationMillisecond=null;he.prototype.visitDurationMicrosecond=null;he.prototype.visitDurationNanosecond=null;const gS=new Float64Array(1),Hs=new Uint32Array(gS.buffer);function Ip(r){const t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function yS(r){if(r!==r)return 32256;gS[0]=r;const t=(Hs[1]&2147483648)>>16&65535;let e=Hs[1]&2146435072,n=0;return e>=1089470464?Hs[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Hs[1]&1048575)>>10):e<=1056964608?(n=1048576+(Hs[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Hs[1]&1048575)+512>>10),t|e|n&65535}const GL=Object.freeze(Object.defineProperty({__proto__:null,float64ToUint16:yS,uint16ToFloat64:Ip},Symbol.toStringTag,{value:"Module"}));class Wt extends he{}function qt(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}const WL=(r,t,e)=>{r[t]=Math.floor(e/864e5)},vS=(r,t,e,n)=>{if(e+1{const i=r+e;n?t[i>>3]|=1<>3]&=~(1<{r[t]=e},Ep=({values:r},t,e)=>{r[t]=e},_S=({values:r},t,e)=>{r[t]=yS(e)},XL=(r,t,e)=>{switch(r.type.precision){case Dr.HALF:return _S(r,t,e);case Dr.SINGLE:case Dr.DOUBLE:return Ep(r,t,e)}},bS=({values:r},t,e)=>{WL(r,t,e.valueOf())},wS=({values:r},t,e)=>{r[t]=BigInt(e)},YL=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},xS=({values:r,valueOffsets:t},e,n)=>vS(r,t,e,n),SS=({values:r,valueOffsets:t},e,n)=>vS(r,t,e,Vx(n)),qL=(r,t,e)=>{r.type.unit===Ui.DAY?bS(r,t,e):wS(r,t,e)},TS=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},IS=({values:r},t,e)=>{r[t]=BigInt(e)},ES=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},AS=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},QL=(r,t,e)=>{switch(r.type.unit){case te.SECOND:return TS(r,t,e);case te.MILLISECOND:return IS(r,t,e);case te.MICROSECOND:return ES(r,t,e);case te.NANOSECOND:return AS(r,t,e)}},MS=({values:r},t,e)=>{r[t]=e},CS=({values:r},t,e)=>{r[t]=e},OS=({values:r},t,e)=>{r[t]=e},PS=({values:r},t,e)=>{r[t]=e},ZL=(r,t,e)=>{switch(r.type.unit){case te.SECOND:return MS(r,t,e);case te.MILLISECOND:return CS(r,t,e);case te.MICROSECOND:return OS(r,t,e);case te.NANOSECOND:return PS(r,t,e)}},KL=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},JL=(r,t,e)=>{const n=r.children[0],i=r.valueOffsets,s=$n.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],l=i[t+1];a{const n=r.children[0],{valueOffsets:i}=r,s=$n.getVisitFn(n);let{[t]:o,[t+1]:a}=i;const l=e instanceof Map?e.entries():Object.entries(e);for(const u of l)if(s(n,o,u),++o>=a)break},eN=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),rN=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),nN=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),iN=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),sN=(r,t,e)=>{const n=r.type.children.map(s=>$n.getVisitFn(s.type)),i=e instanceof Map?nN(t,e):e instanceof er?rN(t,e):Array.isArray(e)?eN(t,e):iN(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},oN=(r,t,e)=>{r.type.mode===jn.Dense?RS(r,t,e):FS(r,t,e)},RS=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];$n.visit(i,r.valueOffsets[t],e)},FS=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];$n.visit(i,t,e)},aN=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},lN=(r,t,e)=>{r.type.unit===As.DAY_TIME?DS(r,t,e):LS(r,t,e)},DS=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},LS=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},NS=({values:r},t,e)=>{r[t]=e},BS=({values:r},t,e)=>{r[t]=e},US=({values:r},t,e)=>{r[t]=e},kS=({values:r},t,e)=>{r[t]=e},uN=(r,t,e)=>{switch(r.type.unit){case te.SECOND:return NS(r,t,e);case te.MILLISECOND:return BS(r,t,e);case te.MICROSECOND:return US(r,t,e);case te.NANOSECOND:return kS(r,t,e)}},cN=(r,t,e)=>{const{stride:n}=r,i=r.children[0],s=$n.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o`${Fo(t)}: ${Fo(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new hN(this[cn],this[To])}}class hN{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return te.name)}has(t,e){return t[cn].type.children.some(n=>n.name===e)}getOwnPropertyDescriptor(t,e){if(t[cn].type.children.some(n=>n.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[cn].type.children.findIndex(i=>i.name===e);if(n!==-1){const i=on.visit(t[cn].children[n],t[To]);return Reflect.set(t,e,i),i}}set(t,e,n){const i=t[cn].type.children.findIndex(s=>s.name===e);return i!==-1?($n.visit(t[cn].children[i],t[To],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}}const fN=new dN;class Bt extends he{}function Ht(r){return(t,e)=>t.getValid(e)?r(t,e):null}const pN=(r,t)=>864e5*r[t],mN=(r,t)=>null,zS=(r,t,e)=>{if(e+1>=t.length)return null;const n=pr(t[e]),i=pr(t[e+1]);return r.subarray(n,i)},gN=({offset:r,values:t},e)=>{const n=r+e;return(t[n>>3]&1<pN(r,t),jS=({values:r},t)=>pr(r[t]),Vi=({stride:r,values:t},e)=>t[r*e],yN=({stride:r,values:t},e)=>Ip(t[r*e]),$S=({values:r},t)=>r[t],vN=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),GS=({values:r,valueOffsets:t},e)=>zS(r,t,e),WS=({values:r,valueOffsets:t},e)=>{const n=zS(r,t,e);return n!==null?KD(n):null},_N=({values:r},t)=>r[t],bN=({type:r,values:t},e)=>r.precision!==Dr.HALF?t[e]:Ip(t[e]),wN=(r,t)=>r.type.unit===Ui.DAY?VS(r,t):jS(r,t),HS=({values:r},t)=>1e3*pr(r[t]),XS=({values:r},t)=>pr(r[t]),YS=({values:r},t)=>Gx(r[t],BigInt(1e3)),qS=({values:r},t)=>Gx(r[t],BigInt(1e6)),xN=(r,t)=>{switch(r.type.unit){case te.SECOND:return HS(r,t);case te.MILLISECOND:return XS(r,t);case te.MICROSECOND:return YS(r,t);case te.NANOSECOND:return qS(r,t)}},QS=({values:r},t)=>r[t],ZS=({values:r},t)=>r[t],KS=({values:r},t)=>r[t],JS=({values:r},t)=>r[t],SN=(r,t)=>{switch(r.type.unit){case te.SECOND:return QS(r,t);case te.MILLISECOND:return ZS(r,t);case te.MICROSECOND:return KS(r,t);case te.NANOSECOND:return JS(r,t)}},TN=({values:r,stride:t},e)=>hc.decimal(r.subarray(t*e,t*(e+1))),IN=(r,t)=>{const{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,l=i[0].slice(s,o-s);return new er([l])},EN=(r,t)=>{const{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new Mp(o.slice(i,s-i))},AN=(r,t)=>new Ap(r,t),MN=(r,t)=>r.type.mode===jn.Dense?tT(r,t):eT(r,t),tT=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return on.visit(n,r.valueOffsets[t])},eT=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return on.visit(n,t)},CN=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},ON=(r,t)=>r.type.unit===As.DAY_TIME?rT(r,t):nT(r,t),rT=({values:r},t)=>r.subarray(2*t,2*(t+1)),nT=({values:r},t)=>{const e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},iT=({values:r},t)=>r[t],sT=({values:r},t)=>r[t],oT=({values:r},t)=>r[t],aT=({values:r},t)=>r[t],PN=(r,t)=>{switch(r.type.unit){case te.SECOND:return iT(r,t);case te.MILLISECOND:return sT(r,t);case te.MICROSECOND:return oT(r,t);case te.NANOSECOND:return aT(r,t)}},RN=(r,t)=>{const{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new er([s])};Bt.prototype.visitNull=Ht(mN);Bt.prototype.visitBool=Ht(gN);Bt.prototype.visitInt=Ht(_N);Bt.prototype.visitInt8=Ht(Vi);Bt.prototype.visitInt16=Ht(Vi);Bt.prototype.visitInt32=Ht(Vi);Bt.prototype.visitInt64=Ht($S);Bt.prototype.visitUint8=Ht(Vi);Bt.prototype.visitUint16=Ht(Vi);Bt.prototype.visitUint32=Ht(Vi);Bt.prototype.visitUint64=Ht($S);Bt.prototype.visitFloat=Ht(bN);Bt.prototype.visitFloat16=Ht(yN);Bt.prototype.visitFloat32=Ht(Vi);Bt.prototype.visitFloat64=Ht(Vi);Bt.prototype.visitUtf8=Ht(WS);Bt.prototype.visitLargeUtf8=Ht(WS);Bt.prototype.visitBinary=Ht(GS);Bt.prototype.visitLargeBinary=Ht(GS);Bt.prototype.visitFixedSizeBinary=Ht(vN);Bt.prototype.visitDate=Ht(wN);Bt.prototype.visitDateDay=Ht(VS);Bt.prototype.visitDateMillisecond=Ht(jS);Bt.prototype.visitTimestamp=Ht(xN);Bt.prototype.visitTimestampSecond=Ht(HS);Bt.prototype.visitTimestampMillisecond=Ht(XS);Bt.prototype.visitTimestampMicrosecond=Ht(YS);Bt.prototype.visitTimestampNanosecond=Ht(qS);Bt.prototype.visitTime=Ht(SN);Bt.prototype.visitTimeSecond=Ht(QS);Bt.prototype.visitTimeMillisecond=Ht(ZS);Bt.prototype.visitTimeMicrosecond=Ht(KS);Bt.prototype.visitTimeNanosecond=Ht(JS);Bt.prototype.visitDecimal=Ht(TN);Bt.prototype.visitList=Ht(IN);Bt.prototype.visitStruct=Ht(AN);Bt.prototype.visitUnion=Ht(MN);Bt.prototype.visitDenseUnion=Ht(tT);Bt.prototype.visitSparseUnion=Ht(eT);Bt.prototype.visitDictionary=Ht(CN);Bt.prototype.visitInterval=Ht(ON);Bt.prototype.visitIntervalDayTime=Ht(rT);Bt.prototype.visitIntervalYearMonth=Ht(nT);Bt.prototype.visitDuration=Ht(PN);Bt.prototype.visitDurationSecond=Ht(iT);Bt.prototype.visitDurationMillisecond=Ht(sT);Bt.prototype.visitDurationMicrosecond=Ht(oT);Bt.prototype.visitDurationNanosecond=Ht(aT);Bt.prototype.visitFixedSizeList=Ht(RN);Bt.prototype.visitMap=Ht(EN);const on=new Bt,lo=Symbol.for("keys"),Io=Symbol.for("vals"),uo=Symbol.for("kKeysAsStrings"),df=Symbol.for("_kKeysAsStrings");class Mp{constructor(t){return this[lo]=new er([t.children[0]]).memoize(),this[Io]=t.children[1],new Proxy(this,new DN)}get[uo](){return this[df]||(this[df]=Array.from(this[lo].toArray(),String))}[Symbol.iterator](){return new FN(this[lo],this[Io])}get size(){return this[lo].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[lo],e=this[Io],n={};for(let i=-1,s=t.length;++i`${Fo(t)}: ${Fo(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class FN{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),on.visit(this.vals,t)]})}}class DN{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[uo]}has(t,e){return t[uo].includes(e)}getOwnPropertyDescriptor(t,e){if(t[uo].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[uo].indexOf(e);if(n!==-1){const i=on.visit(Reflect.get(t,Io),n);return Reflect.set(t,e,i),i}}set(t,e,n){const i=t[uo].indexOf(e);return i!==-1?($n.visit(Reflect.get(t,Io),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}}Object.defineProperties(Mp.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[lo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Io]:{writable:!0,enumerable:!1,configurable:!1,value:null},[df]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Qy;function lT(r,t,e,n){const{length:i=0}=r;let s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),n?n(r,s,o):[s,o]}const uT=(r,t)=>r<0?t+r:r,Zy=r=>r!==r;function Ds(r){if(typeof r!=="object"||r===null)return Zy(r)?Zy:e=>e===r;if(r instanceof Date){const e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?$x(r,e):!1:r instanceof Map?NN(r):Array.isArray(r)?LN(r):r instanceof er?BN(r):UN(r,!0)}function LN(r){const t=[];for(let e=-1,n=r.length;++e!1;const n=[];for(let i=-1,s=e.length;++i{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return kN(r,e);case Map:return Ky(r,e,e.keys());case Mp:case Ap:case Object:case void 0:return Ky(r,e,t||Object.keys(e))}return e instanceof er?zN(r,e):!1}}function kN(r,t){const e=r.length;if(t.length!==e)return!1;for(let n=-1;++n>n}function jN(r,t,e){return e?!!(r[t>>3]|=1<>3]&=~(1<0||e.byteLength>3):hT(new fc(e,r,t,null,Cp)).subarray(0,n)),i}return e}function hT(r){const t=[];let e=0,n=0,i=0;for(const o of r)o&&(i|=1<0)&&(t[e++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class fc{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=t+(t%8===0?0:8-t%8);return ju(r,t,i)+ju(r,n,e)+dT(r,i>>3,n-i>>3)}function dT(r,t,e){let n=0,i=Math.trunc(t);const s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=Zl(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Zl(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Zl(s.getUint8(i)),i+=1;return n}function Zl(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const $N=Object.freeze(Object.defineProperty({__proto__:null,BitIterator:fc,getBit:cT,getBool:Cp,packBools:hT,popcnt_array:dT,popcnt_bit_range:ju,popcnt_uint32:Zl,setBool:jN,truncateBitmap:ff},Symbol.toStringTag,{value:"Module"})),GN=-1;class Ga{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return Ct.isSparseUnion(t)?this.children.some(e=>e.nullable):Ct.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(Ct.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=GN&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ju(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof Ga?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=mS(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:e}=this;if(Ct.isUnion(e)){const n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===jn.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<>3;(!s||s.byteLength<=c)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(ff(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const h=s[c];n=(h&u)!==0,s[c]=e?h|u:h&~u}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new Ga(t,e,n,i,s,o,this.dictionary)}slice(t,e){const{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,l=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===H.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<0&&i.set(ff(this.offset,e,this.nullBitmap),0);const s=this.buffers;return s[si.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s;const{buffers:o}=this;return(s=o[si.TYPE])&&(o[si.TYPE]=s.subarray(t,t+e)),(s=o[si.OFFSET])&&(o[si.OFFSET]=s.subarray(t,t+e+1))||(s=o[si.DATA])&&(o[si.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}}Ga.prototype.children=Object.freeze([]);class Jy{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function HN(r){return r.reduce((t,e)=>t+e.nullCount,0)}function XN(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function YN(r,t,e,n){const i=[];for(let s=-1,o=r.length;++s=n)break;if(e>=l+u)continue;if(l>=e&&l+u<=n){i.push(a);continue}const c=Math.max(0,e-l),h=Math.min(n-l,u);i.push(a.slice(c,h-c))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Op(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e0?0:-1}function KN(r,t){const{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(const i of new fc(e,r.offset+(t||0),r.length,e,Cp)){if(!i)return n;++n}return-1}function Kt(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case H.Union:break;case H.Dictionary:break;default:return KN(r,e)}const n=on.getVisitFn(r),i=Ds(t);for(let s=(e||0)-1,o=r.length;++s{const i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new Jy(r.data.length,n=>{const s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new JN(o)})}class JN{constructor(t){this.vector=t,this.index=0}next(){return this.indexa.data):t;if(s.length===0||s.some(a=>!(a instanceof Ga)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:u}=gT[o.typeId],c=s[0];this.isValid=h=>fT(c,h),this.get=h=>a(c,h),this.set=(h,f)=>l(c,h,f),this.indexOf=h=>u(c,h),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,yT[o.typeId]),this._offsets=XN(s);break}this.data=s,this.type=o,this.stride=mS(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return WN(this.data)}get nullCount(){return HN(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${H[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(uT(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return tB.visit(this)}concat(...t){return new er(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new er(lT(this,t,e,({data:n,_offsets:i},s,o)=>YN(n,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case H.Int:case H.Float:case H.Decimal:case H.Time:case H.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return Ct.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Ct.isDictionary(this.type)){const t=new $u(this.data[0].dictionary),e=this.data.map(n=>{const i=n.clone();return i.dictionary=t,i});return new er(e)}return new $u(this)}unmemoize(){if(Ct.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const i=n.clone();return i.dictionary=t,i});return new er(e)}return this}}mT=Symbol.toStringTag;er[mT]=(r=>{r.type=Ct.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const t=Object.keys(H).map(e=>H[e]).filter(e=>typeof e=="number"&&e!==H.NONE);for(const e of t){const n=on.getVisitFnByTypeId(e),i=$n.getVisitFnByTypeId(e),s=ev.getVisitFnByTypeId(e);gT[e]={get:n,set:i,indexOf:s},yT[e]=Object.create(r,{isValid:{value:tv(fT)},get:{value:tv(on.getVisitFnByTypeId(e))},set:{value:qN($n.getVisitFnByTypeId(e))},indexOf:{value:QN(ev.getVisitFnByTypeId(e))}})}return"Vector"})(er.prototype);class $u extends er{constructor(t){super(t.data);const e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const l=e.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new $u(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new er(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}const eB=65536;function po(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}const Lo=8,Pp=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Rp{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${po(this.buffer[3])} ${po(this.buffer[2])} ${po(this.buffer[1])} ${po(this.buffer[0])}`}static multiply(t,e){return new En(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new En(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return En.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return En.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),i=t.length,s=new En(e);for(let o=n?1:0;othis.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function gr(r,t){return t instanceof r.constructor}function Ls(r,t){return r===t||gr(r,t)}function gi(r,t){return r===t||gr(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function pc(r,t){return r===t||gr(r,t)&&r.precision===t.precision}function nB(r,t){return r===t||gr(r,t)&&r.byteWidth===t.byteWidth}function Fp(r,t){return r===t||gr(r,t)&&r.unit===t.unit}function rl(r,t){return r===t||gr(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function nl(r,t){return r===t||gr(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function iB(r,t){return r===t||gr(r,t)&&r.children.length===t.children.length&&Gn.compareManyFields(r.children,t.children)}function sB(r,t){return r===t||gr(r,t)&&r.children.length===t.children.length&&Gn.compareManyFields(r.children,t.children)}function Dp(r,t){return r===t||gr(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Gn.compareManyFields(r.children,t.children)}function oB(r,t){return r===t||gr(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Gn.visit(r.indices,t.indices)&&Gn.visit(r.dictionary,t.dictionary)}function Lp(r,t){return r===t||gr(r,t)&&r.unit===t.unit}function il(r,t){return r===t||gr(r,t)&&r.unit===t.unit}function aB(r,t){return r===t||gr(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Gn.compareManyFields(r.children,t.children)}function lB(r,t){return r===t||gr(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Gn.compareManyFields(r.children,t.children)}zt.prototype.visitNull=Ls;zt.prototype.visitBool=Ls;zt.prototype.visitInt=gi;zt.prototype.visitInt8=gi;zt.prototype.visitInt16=gi;zt.prototype.visitInt32=gi;zt.prototype.visitInt64=gi;zt.prototype.visitUint8=gi;zt.prototype.visitUint16=gi;zt.prototype.visitUint32=gi;zt.prototype.visitUint64=gi;zt.prototype.visitFloat=pc;zt.prototype.visitFloat16=pc;zt.prototype.visitFloat32=pc;zt.prototype.visitFloat64=pc;zt.prototype.visitUtf8=Ls;zt.prototype.visitLargeUtf8=Ls;zt.prototype.visitBinary=Ls;zt.prototype.visitLargeBinary=Ls;zt.prototype.visitFixedSizeBinary=nB;zt.prototype.visitDate=Fp;zt.prototype.visitDateDay=Fp;zt.prototype.visitDateMillisecond=Fp;zt.prototype.visitTimestamp=rl;zt.prototype.visitTimestampSecond=rl;zt.prototype.visitTimestampMillisecond=rl;zt.prototype.visitTimestampMicrosecond=rl;zt.prototype.visitTimestampNanosecond=rl;zt.prototype.visitTime=nl;zt.prototype.visitTimeSecond=nl;zt.prototype.visitTimeMillisecond=nl;zt.prototype.visitTimeMicrosecond=nl;zt.prototype.visitTimeNanosecond=nl;zt.prototype.visitDecimal=Ls;zt.prototype.visitList=iB;zt.prototype.visitStruct=sB;zt.prototype.visitUnion=Dp;zt.prototype.visitDenseUnion=Dp;zt.prototype.visitSparseUnion=Dp;zt.prototype.visitDictionary=oB;zt.prototype.visitInterval=Lp;zt.prototype.visitIntervalDayTime=Lp;zt.prototype.visitIntervalYearMonth=Lp;zt.prototype.visitDuration=il;zt.prototype.visitDurationSecond=il;zt.prototype.visitDurationMillisecond=il;zt.prototype.visitDurationMicrosecond=il;zt.prototype.visitDurationNanosecond=il;zt.prototype.visitFixedSizeList=aB;zt.prototype.visitMap=lB;const Gn=new zt;function uB(r,t){return Gn.compareSchemas(r,t)}function cB(r,t){return Gn.compareFields(r,t)}function hB(r,t){return Gn.visit(r,t)}const rv=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},VL),rB),$N),GL),NL),VN),UL),{compareSchemas:uB,compareFields:cB,compareTypes:hB}),vT=6048e5,dB=864e5,nv=Symbol.for("constructDateFrom");function ui(r,t){return typeof r=="function"?r(t):r&&typeof r=="object"&&nv in r?r[nv](t):r instanceof Date?new r.constructor(t):new Date(t)}function an(r,t){return ui(t||r,r)}let fB={};function mc(){return fB}function Wa(r,t){var a,l,u,c;const e=mc(),n=(t==null?void 0:t.weekStartsOn)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.weekStartsOn)??e.weekStartsOn??((c=(u=e.locale)==null?void 0:u.options)==null?void 0:c.weekStartsOn)??0,i=an(r,t==null?void 0:t.in),s=i.getDay(),o=(s=s.getTime()?n+1:e.getTime()>=a.getTime()?n:n-1}function iv(r){const t=an(r),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+r-+e}function pB(r,...t){const e=ui.bind(null,t.find(n=>typeof n=="object"));return t.map(e)}function sv(r,t){const e=an(r,t==null?void 0:t.in);return e.setHours(0,0,0,0),e}function mB(r,t,e){const[n,i]=pB(e==null?void 0:e.in,r,t),s=sv(n),o=sv(i),a=+s-iv(s),l=+o-iv(o);return Math.round((a-l)/dB)}function gB(r,t){const e=_T(r,t),n=ui(r,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),Gu(n)}function yB(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function vB(r){return!(!yB(r)&&typeof r!="number"||isNaN(+an(r)))}function _B(r,t){const e=an(r,t==null?void 0:t.in);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}const bB={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},wB=(r,t,e)=>{let n;const i=bB[r];return typeof i=="string"?n=i:t===1?n=i.one:n=i.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+n:n+" ago":n};function zh(r){return(t={})=>{const e=t.width?String(t.width):r.defaultWidth;return r.formats[e]||r.formats[r.defaultWidth]}}const xB={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},SB={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},TB={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},IB={date:zh({formats:xB,defaultWidth:"full"}),time:zh({formats:SB,defaultWidth:"full"}),dateTime:zh({formats:TB,defaultWidth:"full"})},EB={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},AB=(r,t,e,n)=>EB[r];function sa(r){return(t,e)=>{const n=e!=null&&e.context?String(e.context):"standalone";let i;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,a=e!=null&&e.width?String(e.width):o;i=r.formattingValues[a]||r.formattingValues[o]}else{const o=r.defaultWidth,a=e!=null&&e.width?String(e.width):r.defaultWidth;i=r.values[a]||r.values[o]}const s=r.argumentCallback?r.argumentCallback(t):t;return i[s]}}const MB={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},CB={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},OB={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},PB={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},RB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},FB={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},DB=(r,t)=>{const e=Number(r),n=e%100;if(n>20||n<10)switch(n%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},LB={ordinalNumber:DB,era:sa({values:MB,defaultWidth:"wide"}),quarter:sa({values:CB,defaultWidth:"wide",argumentCallback:r=>r-1}),month:sa({values:OB,defaultWidth:"wide"}),day:sa({values:PB,defaultWidth:"wide"}),dayPeriod:sa({values:RB,defaultWidth:"wide",formattingValues:FB,defaultFormattingWidth:"wide"})};function oa(r){return(t,e={})=>{const n=e.width,i=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=t.match(i);if(!s)return null;const o=s[0],a=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],l=Array.isArray(a)?BB(a,h=>h.test(o)):NB(a,h=>h.test(o));let u;u=r.valueCallback?r.valueCallback(l):l,u=e.valueCallback?e.valueCallback(u):u;const c=t.slice(o.length);return{value:u,rest:c}}}function NB(r,t){for(const e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&t(r[e]))return e}function BB(r,t){for(let e=0;e{const n=t.match(r.matchPattern);if(!n)return null;const i=n[0],s=t.match(r.parsePattern);if(!s)return null;let o=r.valueCallback?r.valueCallback(s[0]):s[0];o=e.valueCallback?e.valueCallback(o):o;const a=t.slice(i.length);return{value:o,rest:a}}}const kB=/^(\d+)(th|st|nd|rd)?/i,zB=/\d+/i,VB={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},jB={any:[/^b/i,/^(a|c)/i]},$B={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},GB={any:[/1/i,/2/i,/3/i,/4/i]},WB={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},HB={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},XB={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},YB={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},qB={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},QB={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ZB={ordinalNumber:UB({matchPattern:kB,parsePattern:zB,valueCallback:r=>parseInt(r,10)}),era:oa({matchPatterns:VB,defaultMatchWidth:"wide",parsePatterns:jB,defaultParseWidth:"any"}),quarter:oa({matchPatterns:$B,defaultMatchWidth:"wide",parsePatterns:GB,defaultParseWidth:"any",valueCallback:r=>r+1}),month:oa({matchPatterns:WB,defaultMatchWidth:"wide",parsePatterns:HB,defaultParseWidth:"any"}),day:oa({matchPatterns:XB,defaultMatchWidth:"wide",parsePatterns:YB,defaultParseWidth:"any"}),dayPeriod:oa({matchPatterns:qB,defaultMatchWidth:"any",parsePatterns:QB,defaultParseWidth:"any"})},KB={code:"en-US",formatDistance:wB,formatLong:IB,formatRelative:AB,localize:LB,match:ZB,options:{weekStartsOn:0,firstWeekContainsDate:1}};function JB(r,t){const e=an(r,t==null?void 0:t.in);return mB(e,_B(e))+1}function tU(r,t){const e=an(r,t==null?void 0:t.in),n=+Gu(e)-+gB(e);return Math.round(n/vT)+1}function bT(r,t){var c,h,f,d;const e=an(r,t==null?void 0:t.in),n=e.getFullYear(),i=mc(),s=(t==null?void 0:t.firstWeekContainsDate)??((h=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:h.firstWeekContainsDate)??i.firstWeekContainsDate??((d=(f=i.locale)==null?void 0:f.options)==null?void 0:d.firstWeekContainsDate)??1,o=ui((t==null?void 0:t.in)||r,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const a=Wa(o,t),l=ui((t==null?void 0:t.in)||r,0);l.setFullYear(n,0,s),l.setHours(0,0,0,0);const u=Wa(l,t);return+e>=+a?n+1:+e>=+u?n:n-1}function eU(r,t){var a,l,u,c;const e=mc(),n=(t==null?void 0:t.firstWeekContainsDate)??((l=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:l.firstWeekContainsDate)??e.firstWeekContainsDate??((c=(u=e.locale)==null?void 0:u.options)==null?void 0:c.firstWeekContainsDate)??1,i=bT(r,t),s=ui((t==null?void 0:t.in)||r,0);return s.setFullYear(i,0,n),s.setHours(0,0,0,0),Wa(s,t)}function rU(r,t){const e=an(r,t==null?void 0:t.in),n=+Wa(e,t)-+eU(e,t);return Math.round(n/vT)+1}function we(r,t){const e=r<0?"-":"",n=Math.abs(r).toString().padStart(t,"0");return e+n}const xi={y(r,t){const e=r.getFullYear(),n=e>0?e:1-e;return we(t==="yy"?n%100:n,t.length)},M(r,t){const e=r.getMonth();return t==="M"?String(e+1):we(e+1,2)},d(r,t){return we(r.getDate(),t.length)},a(r,t){const e=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(r,t){return we(r.getHours()%12||12,t.length)},H(r,t){return we(r.getHours(),t.length)},m(r,t){return we(r.getMinutes(),t.length)},s(r,t){return we(r.getSeconds(),t.length)},S(r,t){const e=t.length,n=r.getMilliseconds(),i=Math.trunc(n*Math.pow(10,e-3));return we(i,t.length)}},Xs={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ov={G:function(r,t,e){const n=r.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(n,{width:"abbreviated"});case"GGGGG":return e.era(n,{width:"narrow"});case"GGGG":default:return e.era(n,{width:"wide"})}},y:function(r,t,e){if(t==="yo"){const n=r.getFullYear(),i=n>0?n:1-n;return e.ordinalNumber(i,{unit:"year"})}return xi.y(r,t)},Y:function(r,t,e,n){const i=bT(r,n),s=i>0?i:1-i;if(t==="YY"){const o=s%100;return we(o,2)}return t==="Yo"?e.ordinalNumber(s,{unit:"year"}):we(s,t.length)},R:function(r,t){const e=_T(r);return we(e,t.length)},u:function(r,t){const e=r.getFullYear();return we(e,t.length)},Q:function(r,t,e){const n=Math.ceil((r.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return we(n,2);case"Qo":return e.ordinalNumber(n,{unit:"quarter"});case"QQQ":return e.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,t,e){const n=Math.ceil((r.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return we(n,2);case"qo":return e.ordinalNumber(n,{unit:"quarter"});case"qqq":return e.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,t,e){const n=r.getMonth();switch(t){case"M":case"MM":return xi.M(r,t);case"Mo":return e.ordinalNumber(n+1,{unit:"month"});case"MMM":return e.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(n,{width:"wide",context:"formatting"})}},L:function(r,t,e){const n=r.getMonth();switch(t){case"L":return String(n+1);case"LL":return we(n+1,2);case"Lo":return e.ordinalNumber(n+1,{unit:"month"});case"LLL":return e.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(n,{width:"wide",context:"standalone"})}},w:function(r,t,e,n){const i=rU(r,n);return t==="wo"?e.ordinalNumber(i,{unit:"week"}):we(i,t.length)},I:function(r,t,e){const n=tU(r);return t==="Io"?e.ordinalNumber(n,{unit:"week"}):we(n,t.length)},d:function(r,t,e){return t==="do"?e.ordinalNumber(r.getDate(),{unit:"date"}):xi.d(r,t)},D:function(r,t,e){const n=JB(r);return t==="Do"?e.ordinalNumber(n,{unit:"dayOfYear"}):we(n,t.length)},E:function(r,t,e){const n=r.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(n,{width:"short",context:"formatting"});case"EEEE":default:return e.day(n,{width:"wide",context:"formatting"})}},e:function(r,t,e,n){const i=r.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return we(s,2);case"eo":return e.ordinalNumber(s,{unit:"day"});case"eee":return e.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(i,{width:"short",context:"formatting"});case"eeee":default:return e.day(i,{width:"wide",context:"formatting"})}},c:function(r,t,e,n){const i=r.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return we(s,t.length);case"co":return e.ordinalNumber(s,{unit:"day"});case"ccc":return e.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(i,{width:"narrow",context:"standalone"});case"cccccc":return e.day(i,{width:"short",context:"standalone"});case"cccc":default:return e.day(i,{width:"wide",context:"standalone"})}},i:function(r,t,e){const n=r.getDay(),i=n===0?7:n;switch(t){case"i":return String(i);case"ii":return we(i,t.length);case"io":return e.ordinalNumber(i,{unit:"day"});case"iii":return e.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(n,{width:"short",context:"formatting"});case"iiii":default:return e.day(n,{width:"wide",context:"formatting"})}},a:function(r,t,e){const i=r.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,t,e){const n=r.getHours();let i;switch(n===12?i=Xs.noon:n===0?i=Xs.midnight:i=n/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,t,e){const n=r.getHours();let i;switch(n>=17?i=Xs.evening:n>=12?i=Xs.afternoon:n>=4?i=Xs.morning:i=Xs.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,t,e){if(t==="ho"){let n=r.getHours()%12;return n===0&&(n=12),e.ordinalNumber(n,{unit:"hour"})}return xi.h(r,t)},H:function(r,t,e){return t==="Ho"?e.ordinalNumber(r.getHours(),{unit:"hour"}):xi.H(r,t)},K:function(r,t,e){const n=r.getHours()%12;return t==="Ko"?e.ordinalNumber(n,{unit:"hour"}):we(n,t.length)},k:function(r,t,e){let n=r.getHours();return n===0&&(n=24),t==="ko"?e.ordinalNumber(n,{unit:"hour"}):we(n,t.length)},m:function(r,t,e){return t==="mo"?e.ordinalNumber(r.getMinutes(),{unit:"minute"}):xi.m(r,t)},s:function(r,t,e){return t==="so"?e.ordinalNumber(r.getSeconds(),{unit:"second"}):xi.s(r,t)},S:function(r,t){return xi.S(r,t)},X:function(r,t,e){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return lv(n);case"XXXX":case"XX":return hs(n);case"XXXXX":case"XXX":default:return hs(n,":")}},x:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"x":return lv(n);case"xxxx":case"xx":return hs(n);case"xxxxx":case"xxx":default:return hs(n,":")}},O:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+av(n,":");case"OOOO":default:return"GMT"+hs(n,":")}},z:function(r,t,e){const n=r.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+av(n,":");case"zzzz":default:return"GMT"+hs(n,":")}},t:function(r,t,e){const n=Math.trunc(+r/1e3);return we(n,t.length)},T:function(r,t,e){return we(+r,t.length)}};function av(r,t=""){const e=r>0?"-":"+",n=Math.abs(r),i=Math.trunc(n/60),s=n%60;return s===0?e+String(i):e+String(i)+t+we(s,2)}function lv(r,t){return r%60===0?(r>0?"-":"+")+we(Math.abs(r)/60,2):hs(r,t)}function hs(r,t=""){const e=r>0?"-":"+",n=Math.abs(r),i=we(Math.trunc(n/60),2),s=we(n%60,2);return e+i+t+s}const uv=(r,t)=>{switch(r){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},wT=(r,t)=>{switch(r){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},nU=(r,t)=>{const e=r.match(/(P+)(p+)?/)||[],n=e[1],i=e[2];if(!i)return uv(r,t);let s;switch(n){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",uv(n,t)).replace("{{time}}",wT(i,t))},iU={p:wT,P:nU},sU=/^D+$/,oU=/^Y+$/,aU=["D","DD","YY","YYYY"];function lU(r){return sU.test(r)}function uU(r){return oU.test(r)}function cU(r,t,e){const n=hU(r,t,e);if(console.warn(n),aU.includes(r))throw new RangeError(n)}function hU(r,t,e){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${t}\`) for formatting ${n} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const dU=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fU=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,pU=/^'([^]*?)'?$/,mU=/''/g,gU=/[a-zA-Z]/;function xT(r,t,e){var c,h,f,d;const n=mc(),i=n.locale??KB,s=n.firstWeekContainsDate??((h=(c=n.locale)==null?void 0:c.options)==null?void 0:h.firstWeekContainsDate)??1,o=n.weekStartsOn??((d=(f=n.locale)==null?void 0:f.options)==null?void 0:d.weekStartsOn)??0,a=an(r,e==null?void 0:e.in);if(!vB(a))throw new RangeError("Invalid time value");let l=t.match(fU).map(m=>{const g=m[0];if(g==="p"||g==="P"){const p=iU[g];return p(m,i.formatLong)}return m}).join("").match(dU).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const g=m[0];if(g==="'")return{isToken:!1,value:yU(m)};if(ov[g])return{isToken:!0,value:m};if(g.match(gU))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(l=i.localize.preprocessor(a,l));const u={firstWeekContainsDate:s,weekStartsOn:o,locale:i};return l.map(m=>{if(!m.isToken)return m.value;const g=m.value;(uU(g)||lU(g))&&cU(g,t,String(r));const p=ov[g[0]];return p(a,g,i.localize,u)}).join("")}function yU(r){const t=r.match(pU);return t?t[1].replace(mU,"'"):r}function vU(r,t){return an(r*1e3,t==null?void 0:t.in)}function _U(r,t){const e=bU(t)?new t(0):ui(t,0);return e.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),e.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),e}function bU(r){var t;return typeof r=="function"&&((t=r.prototype)==null?void 0:t.constructor)===r}function wU(r,t){let e=r.length;switch("string"){case"string":{if(t.length!==1)throw new Error("The 'chars' parameter should be a single character string.");for(;e>0&&r[e-1]===t;)e--;break}}return r.substring(0,e)}function Tr(r){return r==null}function xU(r){return r!=null}async function pf(){if(typeof window<"u"&&window!==null)return"browser";try{const r=await Ai(()=>import("./__vite-browser-external-FmFgRqLi.js"),[]);return typeof r<"u"&&r.versions!=null&&r.versions.node!=null?"node":"unknown"}catch{return"unknown"}}function SU(r){return Tr(r)?!1:Ct.isInt(r.type)&&!ST(r)||TU(r)}function TU(r){return Tr(r)?!1:Ct.isInt(r.type)&&r.type.isSigned===!1}function IU(r){return Tr(r)?!1:Ct.isFloat(r.type)??!1}function EU(r){return Tr(r)?!1:Ct.isDecimal(r.type)}function AU(r){return Tr(r)?!1:Ct.isBool(r.type)}function MU(r){return Tr(r)?!1:Ct.isDuration(r.type)}function ST(r){return Tr(r)?!1:Ct.isInt(r.type)&&r.metadata.get("ARROW:extension:name")==="period"}function CU(r){return Tr(r)?!1:Ct.isTimestamp(r.type)}function OU(r){return Tr(r)?!1:Ct.isDate(r.type)}function PU(r){return Tr(r)?!1:Ct.isTime(r.type)}function RU(r){return Tr(r)?!1:Ct.isList(r.type)||Ct.isFixedSizeList(r.type)}function FU(r){return Tr(r)?!1:Ct.isStruct(r.type)||Ct.isMap(r.type)}function DU(r){return Tr(r)?!1:Ct.isStruct(r.type)&&r.metadata.get("ARROW:extension:name")==="interval"||Ct.isInterval(r.type)}function LU(r,t){let e;if(t===te.MILLISECOND)e=1e3;else if(t===te.MICROSECOND)e=1e3*1e3;else if(t===te.NANOSECOND)e=1e3*1e3*1e3;else return Number(r);return typeof r=="bigint"&&!Number.isSafeInteger(Number(r))?Number(r/BigInt(e)):Number(r)/e}function NU(r,t){var n;const e=LU(r,((n=t==null?void 0:t.type)==null?void 0:n.unit)??te.SECOND);return vU(e)}function BU(r,t){const e=NU(r,t);return xT(e,e.getMilliseconds()===0?"HH:mm:ss":"HH:mm:ss.SSS")}function UU(r){const t="yyyy-MM-dd";return r instanceof Date||typeof r=="number"&&Number.isFinite(r)?xT(r,t):(console.warn(`Unsupported date value: ${r}`),String(r))}function kU(r,t){var i;if(!(r instanceof Date||typeof r=="number"&&Number.isFinite(r)))return console.warn(`Unsupported datetime value: ${r}`),null;let e;const n=(i=t==null?void 0:t.type)==null?void 0:i.timezone;return typeof r=="number"?n?e=new Fr(r,n):e=new Fr(r):n?e=new Fr(r,n):e=new Fr(r),_U(e,Date)}function zU(r,t){var a;const e=((a=t==null?void 0:t.type)==null?void 0:a.scale)||0;let n=rv.bigNumToString(new rv.BN(r)).padStart(e,"0");if(e===0)return n;let i="";n.startsWith("-")&&(i="-",n=n.slice(1));const s=n.slice(0,-e)||"0",o=wU(n.slice(-e),"0")||"";return`${i}${s}${o?`.${o}`:""}`}function VU(r){const t=r[0],e=r[1],n=[];return t!==0&&n.push(`${t} year${t>1?"s":""}`),e!==0&&n.push(`${e} month${e>1?"s":""}`),n.length?n.join(" "):"0 months"}function jU(r,t){var n,i,s,o;if(Ct.isInterval(t==null?void 0:t.type))return VU(r);const e=t&&t.metadata.get("ARROW:extension:name");if(e&&e==="pandas.interval"){const a=JSON.parse(t.metadata.get("ARROW:extension:metadata")),{closed:l}=a,u=r.toJSON(),c=l==="both"||l==="left"?"[":"(",h=l==="both"||l==="right"?"]":")",f=mf(u.left,(i=(n=t.type)==null?void 0:n.children)==null?void 0:i[0]),d=mf(u.right,(o=(s=t.type)==null?void 0:s.children)==null?void 0:o[1]);return`${c+f}, ${d+h}`}return String(r)}function $U(r,t){return(t==null?void 0:t.type)instanceof hf?JSON.parse(JSON.stringify(r,(e,n)=>{if(xU(n))return typeof n=="bigint"?Number(n):n})):JSON.parse(JSON.stringify(r,(e,n)=>typeof n=="bigint"?Number(n):n))}function mf(r,t){if(Tr(r))return null;const e=r instanceof Date||Number.isFinite(r);if(e&&OU(t))return UU(r);if(typeof r=="bigint"&&PU(t))return BU(Number(r),t);if(e&&CU(t))return kU(r,t);if(ST(t))throw new Error("Period type is not supported yet");if(DU(t))return jU(r,t);if(MU(t))throw new Error("Duration type is not supported yet");return EU(t)?zU(r,t):IU(t)&&Number.isFinite(r)||SU(t)?r:FU(t)||RU(t)?$U(r,t):AU(t)?!!r:String(r)}function cv(r){return((r.toArray()||[]).map(n=>n.toJSON())||[]).map(n=>(r.schema.fields.forEach(i=>n[i.name]=mf(n[i.name],i)),n))}var Ha=(r=>(r.ORIGIN_PRIVATE_FS="origin-private-fs",r.NODE_FS="node-fs",r))(Ha||{});async function TT(r){const t=M1(r,{logger:!1});let e,n;const i=await pf();if(i==="browser"){if(typeof t.bundles>"u"){const{getBundles:l}=await Ai(async()=>{const{getBundles:u}=await import("./default-browser-BrgSDbLD.js");return{getBundles:u}},[]);t.bundles=await l()}n=await Ey(await t.bundles),e=new Worker(n.mainWorker)}else if(i==="node"){if(typeof t.bundles>"u"){const{getBundles:c}=await Ai(async()=>{const{getBundles:h}=await import("./default-node-C_5jnHCL.js");return{getBundles:h}},__vite__mapDeps([0,1,2]));t.bundles=await c()}n=await Ey(await t.bundles);let l=n.mainWorker;l.startsWith("/@fs/")&&(l=l.replace("/@fs/","file://"));const u=await Ai(()=>import("./index-Cp8iQ_hy.js"),[]);e=new u.default(l,{type:"module"})}else throw new Error(`Unsupported environment: ${i}`);let s;t.logger===!0?s=new Ux:t.logger===!1?s=new RD:s=t.logger;const o=new kD(s,e);if(await o.instantiate(n.mainModule,n.pthreadWorker),t.storage)switch(t.storage.type){case Ha.ORIGIN_PRIVATE_FS:{try{let l=t.storage.path;l.startsWith("/")&&(l=l.slice(1)),await o.open({path:`opfs://${l}`,accessMode:t.storage.accessMode})}catch(l){throw await o.terminate(),await e.terminate(),l}break}case Ha.NODE_FS:{try{await o.open({path:t.storage.path,accessMode:t.storage.accessMode,useDirectIO:!0})}catch(l){throw await o.terminate(),await e.terminate(),l}break}}const a=await o.connect();return{worker:e,db:o,conn:a,query:async(l,u=[])=>{if(!u||u.length===0){const d=await a.query(l);return cv(d)}const c=await a.prepare(l),h=await c.query(...u),f=cv(h);return c.close(),f},close:async()=>{await a.close(),await o.terminate(),await e.terminate()}}}async function GU(r,t){await(await r).conn.send("BEGIN TRANSACTION");try{const e=await t(r);return await(await r).conn.send("COMMIT"),e}catch(e){throw await(await r).conn.send("ROLLBACK"),e}}async function WU(r,t,e){await(await r).conn.send(`SAVEPOINT ${t}`);try{const n=await e(r);return await(await r).conn.send(`RELEASE SAVEPOINT ${t}`),n}catch(n){throw await(await r).conn.send(`ROLLBACK TO SAVEPOINT ${t}`),n}}const St=Symbol.for("drizzle:entityKind");function lt(r,t){if(!r||typeof r!="object")return!1;if(r instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,St))throw new Error(`Class "${t.name??""}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let e=Object.getPrototypeOf(r).constructor;if(e)for(;e;){if(St in e&&e[St]===t[St])return!0;e=Object.getPrototypeOf(e)}return!1}var wv;wv=St;class rr{constructor(t,e){W(this,"name");W(this,"keyAsName");W(this,"primary");W(this,"notNull");W(this,"default");W(this,"defaultFn");W(this,"onUpdateFn");W(this,"hasDefault");W(this,"isUnique");W(this,"uniqueName");W(this,"uniqueType");W(this,"dataType");W(this,"columnType");W(this,"enumValues");W(this,"generated");W(this,"generatedIdentity");W(this,"config");this.table=t,this.config=e,this.name=e.name,this.keyAsName=e.keyAsName,this.notNull=e.notNull,this.default=e.default,this.defaultFn=e.defaultFn,this.onUpdateFn=e.onUpdateFn,this.hasDefault=e.hasDefault,this.primary=e.primaryKey,this.isUnique=e.isUnique,this.uniqueName=e.uniqueName,this.uniqueType=e.uniqueType,this.dataType=e.dataType,this.columnType=e.columnType,this.generated=e.generated,this.generatedIdentity=e.generatedIdentity}mapFromDriverValue(t){return t}mapToDriverValue(t){return t}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}W(rr,wv,"Column");const Eo=Symbol.for("drizzle:Name");function HU(r,t){return`${r[Eo]}_${t.join("_")}_unique`}var xv,Sv;class Lr extends(Sv=rr,xv=St,Sv){constructor(t,e){e.uniqueName||(e.uniqueName=HU(t,[e.name])),super(t,e),this.table=t}}W(Lr,xv,"PgColumn");const hv=Symbol.for("drizzle:isPgEnum");function XU(r){return!!r&&typeof r=="function"&&hv in r&&r[hv]===!0}var Tv;Tv=St;class Nr{constructor(t,e,n,i=!1){this._={brand:"Subquery",sql:t,selectedFields:e,alias:n,isWith:i}}}W(Nr,Tv,"Subquery");var Iv,Ev;class Np extends(Ev=Nr,Iv=St,Ev){}W(Np,Iv,"WithSubquery");const Ur={startActiveSpan(r,t){return t()}},Qe=Symbol.for("drizzle:ViewBaseConfig"),Kl=Symbol.for("drizzle:Schema"),gf=Symbol.for("drizzle:Columns"),dv=Symbol.for("drizzle:ExtraConfigColumns"),Vh=Symbol.for("drizzle:OriginalName"),jh=Symbol.for("drizzle:BaseName"),Wu=Symbol.for("drizzle:IsAlias"),fv=Symbol.for("drizzle:ExtraConfigBuilder"),YU=Symbol.for("drizzle:IsDrizzleTable");var Av,Mv,Cv,Ov,Pv,Rv,Fv,Dv,Lv,Nv;Nv=St,Lv=Eo,Dv=Vh,Fv=Kl,Rv=gf,Pv=dv,Ov=jh,Cv=Wu,Mv=YU,Av=fv;class It{constructor(t,e,n){W(this,Lv);W(this,Dv);W(this,Fv);W(this,Rv);W(this,Pv);W(this,Ov);W(this,Cv,!1);W(this,Mv,!0);W(this,Av);this[Eo]=this[Vh]=t,this[Kl]=e,this[jh]=n}}W(It,Nv,"Table"),W(It,"Symbol",{Name:Eo,Schema:Kl,OriginalName:Vh,Columns:gf,ExtraConfigColumns:dv,BaseName:jh,IsAlias:Wu,ExtraConfigBuilder:fv});function vs(r){return r[Eo]}function Xa(r){return`${r[Kl]??"public"}.${r[Eo]}`}function IT(r){return r!=null&&typeof r.getSQL=="function"}function qU(r){var e;const t={sql:"",params:[]};for(const n of r)t.sql+=n.sql,t.params.push(...n.params),(e=n.typings)!=null&&e.length&&(t.typings||(t.typings=[]),t.typings.push(...n.typings));return t}var Bv;Bv=St;class Ze{constructor(t){W(this,"value");this.value=Array.isArray(t)?t:[t]}getSQL(){return new Pt([this])}}W(Ze,Bv,"StringChunk");var Uv;Uv=St;const ps=class ps{constructor(t){W(this,"decoder",ET);W(this,"shouldInlineParams",!1);this.queryChunks=t}append(t){return this.queryChunks.push(...t.queryChunks),this}toQuery(t){return Ur.startActiveSpan("drizzle.buildSQL",e=>{const n=this.buildQueryFromSourceParams(this.queryChunks,t);return e==null||e.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(t,e){const n=Object.assign({},e,{inlineParams:e.inlineParams||this.shouldInlineParams,paramStartIndex:e.paramStartIndex||{value:0}}),{casing:i,escapeName:s,escapeParam:o,prepareTyping:a,inlineParams:l,paramStartIndex:u}=n;return qU(t.map(c=>{var h;if(lt(c,Ze))return{sql:c.value.join(""),params:[]};if(lt(c,Hu))return{sql:s(c.value),params:[]};if(c===void 0)return{sql:"",params:[]};if(Array.isArray(c)){const f=[new Ze("(")];for(const[d,m]of c.entries())f.push(m),dr},AT={mapToDriverValue:r=>r};({...ET,...AT});var zv;zv=St;class ci{constructor(t,e=AT){W(this,"brand");this.value=t,this.encoder=e}getSQL(){return new Pt([this])}}W(ci,zv,"Param");function Y(r,...t){const e=[];(t.length>0||r.length>0&&r[0]!=="")&&e.push(new Ze(r[0]));for(const[n,i]of t.entries())e.push(i,new Ze(r[n+1]));return new Pt(e)}(r=>{function t(){return new Pt([])}r.empty=t;function e(l){return new Pt(l)}r.fromList=e;function n(l){return new Pt([new Ze(l)])}r.raw=n;function i(l,u){const c=[];for(const[h,f]of l.entries())h>0&&u!==void 0&&c.push(u),c.push(f);return new Pt(c)}r.join=i;function s(l){return new Hu(l)}r.identifier=s;function o(l){return new Ms(l)}r.placeholder=o;function a(l,u){return new ci(l,u)}r.param=a})(Y||(Y={}));(r=>{var e;e=St;const n=class n{constructor(s,o){W(this,"isSelectionField",!1);this.sql=s,this.fieldAlias=o}getSQL(){return this.sql}clone(){return new n(this.sql,this.fieldAlias)}};W(n,e,"SQL.Aliased");let t=n;r.Aliased=t})(Pt||(Pt={}));var Vv;Vv=St;class Ms{constructor(t){this.name=t}getSQL(){return new Pt([this])}}W(Ms,Vv,"Placeholder");function pv(r,t){return r.map(e=>{if(lt(e,Ms)){if(!(e.name in t))throw new Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(lt(e,ci)&<(e.value,Ms)){if(!(e.value.name in t))throw new Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}const ZU=Symbol.for("drizzle:IsDrizzleView");var jv,$v,Gv;Gv=St,$v=Qe,jv=ZU;class ji{constructor({name:t,schema:e,selectedFields:n,query:i}){W(this,$v);W(this,jv,!0);this[Qe]={name:t,originalName:t,schema:e,selectedFields:n,query:i,isExisting:!i,isAlias:!1}}getSQL(){return new Pt([this])}}W(ji,Gv,"View");rr.prototype.getSQL=function(){return new Pt([this])};It.prototype.getSQL=function(){return new Pt([this])};Nr.prototype.getSQL=function(){return new Pt([this])};var Wv;Wv=St;class Ya{constructor(t){this.table=t}get(t,e){return e==="table"?this.table:t[e]}}W(Ya,Wv,"ColumnAliasProxyHandler");var Hv;Hv=St;class gc{constructor(t,e){this.alias=t,this.replaceOriginalName=e}get(t,e){if(e===It.Symbol.IsAlias)return!0;if(e===It.Symbol.Name)return this.alias;if(this.replaceOriginalName&&e===It.Symbol.OriginalName)return this.alias;if(e===Qe)return{...t[Qe],name:this.alias,isAlias:!0};if(e===It.Symbol.Columns){const i=t[It.Symbol.Columns];if(!i)return i;const s={};return Object.keys(i).map(o=>{s[o]=new Proxy(i[o],new Ya(new Proxy(t,this)))}),s}const n=t[e];return lt(n,rr)?new Proxy(n,new Ya(new Proxy(t,this))):n}}W(gc,Hv,"TableAliasProxyHandler");function $h(r,t){return new Proxy(r,new gc(t,!1))}function ei(r,t){return new Proxy(r,new Ya(new Proxy(r.table,new gc(t,!1))))}function MT(r,t){return new Pt.Aliased(Xu(r.sql,t),r.fieldAlias)}function Xu(r,t){return Y.join(r.queryChunks.map(e=>lt(e,rr)?ei(e,t):lt(e,Pt)?Xu(e,t):lt(e,Pt.Aliased)?MT(e,t):e))}var Xv,Yv;class Bp extends(Yv=Error,Xv=St,Yv){constructor({message:t,cause:e}){super(t),this.name="DrizzleError",this.cause=e}}W(Bp,Xv,"DrizzleError");var qv,Qv;class CT extends(Qv=Bp,qv=St,Qv){constructor(){super({message:"Rollback"})}}W(CT,qv,"TransactionRollbackError");function Sr(r,t){return QU(t)&&!IT(r)&&!lt(r,ci)&&!lt(r,Ms)&&!lt(r,rr)&&!lt(r,It)&&!lt(r,ji)?new ci(r,t):r}const OT=(r,t)=>Y`${r} = ${Sr(t,r)}`,KU=(r,t)=>Y`${r} <> ${Sr(t,r)}`;function yf(...r){const t=r.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new Pt(t):new Pt([new Ze("("),Y.join(t,new Ze(" and ")),new Ze(")")])}function JU(...r){const t=r.filter(e=>e!==void 0);if(t.length!==0)return t.length===1?new Pt(t):new Pt([new Ze("("),Y.join(t,new Ze(" or ")),new Ze(")")])}function tk(r){return Y`not ${r}`}const ek=(r,t)=>Y`${r} > ${Sr(t,r)}`,rk=(r,t)=>Y`${r} >= ${Sr(t,r)}`,nk=(r,t)=>Y`${r} < ${Sr(t,r)}`,ik=(r,t)=>Y`${r} <= ${Sr(t,r)}`;function sk(r,t){return Array.isArray(t)?t.length===0?Y`false`:Y`${r} in ${t.map(e=>Sr(e,r))}`:Y`${r} in ${Sr(t,r)}`}function ok(r,t){return Array.isArray(t)?t.length===0?Y`true`:Y`${r} not in ${t.map(e=>Sr(e,r))}`:Y`${r} not in ${Sr(t,r)}`}function ak(r){return Y`${r} is null`}function lk(r){return Y`${r} is not null`}function uk(r){return Y`exists ${r}`}function ck(r){return Y`not exists ${r}`}function hk(r,t,e){return Y`${r} between ${Sr(t,r)} and ${Sr(e,r)}`}function dk(r,t,e){return Y`${r} not between ${Sr(t,r)} and ${Sr(e,r)}`}function fk(r,t){return Y`${r} like ${t}`}function pk(r,t){return Y`${r} not like ${t}`}function mk(r,t){return Y`${r} ilike ${t}`}function gk(r,t){return Y`${r} not ilike ${t}`}function yk(r){return Y`${r} asc`}function vk(r){return Y`${r} desc`}var Zv;Zv=St;class PT{write(t){console.log(t)}}W(PT,Zv,"ConsoleLogWriter");var Kv;Kv=St;class RT{constructor(t){W(this,"writer");this.writer=(t==null?void 0:t.writer)??new PT}logQuery(t,e){const n=e.map(s=>{try{return JSON.stringify(s)}catch{return String(s)}}),i=n.length?` -- params: [${n.join(", ")}]`:"";this.writer.write(`Query: ${t}${i}`)}}W(RT,Kv,"DefaultLogger");var Jv;Jv=St;class FT{logQuery(){}}W(FT,Jv,"NoopLogger");var t_,e_;e_=St,t_=Symbol.toStringTag;class $i{constructor(){W(this,t_,"QueryPromise")}catch(t){return this.then(void 0,t)}finally(t){return this.then(e=>(t==null||t(),e),e=>{throw t==null||t(),e})}then(t,e){return this.execute().then(t,e)}}W($i,e_,"QueryPromise");function Cs(r,t){return Object.entries(r).reduce((e,[n,i])=>{if(typeof n!="string")return e;const s=t?[...t,n]:[n];return lt(i,rr)||lt(i,Pt)||lt(i,Pt.Aliased)?e.push({path:s,field:i}):lt(i,It)?e.push(...Cs(i[It.Symbol.Columns],s)):e.push(...Cs(i,s)),e},[])}function Up(r,t){const e=Object.keys(r),n=Object.keys(t);if(e.length!==n.length)return!1;for(const[i,s]of e.entries())if(s!==n[i])return!1;return!0}function DT(r,t){const e=Object.entries(t).filter(([,n])=>n!==void 0).map(([n,i])=>lt(i,Pt)||lt(i,rr)?[n,i]:[n,new ci(i,r[It.Symbol.Columns][n])]);if(e.length===0)throw new Error("No values to set");return Object.fromEntries(e)}function _k(r,t){for(const e of t)for(const n of Object.getOwnPropertyNames(e.prototype))n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n)||Object.create(null))}function bk(r){return r[It.Symbol.Columns]}function fs(r){return lt(r,Nr)?r._.alias:lt(r,ji)?r[Qe].name:lt(r,Pt)?void 0:r[It.Symbol.IsAlias]?r[It.Symbol.Name]:r[It.Symbol.BaseName]}function wk(r){if(typeof r!="object"||r===null||r.constructor.name!=="Object")return!1;if("logger"in r){const t=typeof r.logger;return!(t!=="boolean"&&(t!=="object"||typeof r.logger.logQuery!="function")&&t!=="undefined")}if("schema"in r){const t=typeof r.schema;return!(t!=="object"&&t!=="undefined")}if("casing"in r){const t=typeof r.casing;return!(t!=="string"&&t!=="undefined")}if("mode"in r)return!(r.mode!=="default"||r.mode!=="planetscale"||r.mode!==void 0);if("connection"in r){const t=typeof r.connection;return!(t!=="string"&&t!=="object"&&t!=="undefined")}if("client"in r){const t=typeof r.client;return!(t!=="object"&&t!=="function"&&t!=="undefined")}return Object.keys(r).length===0}var r_,n_;class LT extends(n_=Lr,r_=St,n_){getSQLType(){return"date"}mapFromDriverValue(t){return new Date(t)}mapToDriverValue(t){return t.toISOString()}}W(LT,r_,"PgDate");var i_,s_;class NT extends(s_=Lr,i_=St,s_){getSQLType(){return"date"}}W(NT,i_,"PgDateString");var o_,a_;class BT extends(a_=Lr,o_=St,a_){constructor(t,e){super(t,e)}getSQLType(){return"json"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}W(BT,o_,"PgJson");var l_,u_;class UT extends(u_=Lr,l_=St,u_){constructor(t,e){super(t,e)}getSQLType(){return"jsonb"}mapToDriverValue(t){return JSON.stringify(t)}mapFromDriverValue(t){if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t}}W(UT,l_,"PgJsonb");var c_,h_;class kT extends(h_=Lr,c_=St,h_){constructor(e,n){super(e,n);W(this,"precision");W(this,"scale");this.precision=n.precision,this.scale=n.scale}mapFromDriverValue(e){return typeof e=="string"?e:String(e)}getSQLType(){return this.precision!==void 0&&this.scale!==void 0?`numeric(${this.precision}, ${this.scale})`:this.precision===void 0?"numeric":`numeric(${this.precision})`}}W(kT,c_,"PgNumeric");var d_,f_;class zT extends(f_=Lr,d_=St,f_){constructor(e,n){super(e,n);W(this,"withTimezone");W(this,"precision");this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}W(zT,d_,"PgTime");var p_,m_;class VT extends(m_=Lr,p_=St,m_){constructor(e,n){super(e,n);W(this,"withTimezone");W(this,"precision");W(this,"mapFromDriverValue",e=>new Date(this.withTimezone?e:e+"+0000"));W(this,"mapToDriverValue",e=>e.toISOString());this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}}W(VT,p_,"PgTimestamp");var g_,y_;class jT extends(y_=Lr,g_=St,y_){constructor(e,n){super(e,n);W(this,"withTimezone");W(this,"precision");this.withTimezone=n.withTimezone,this.precision=n.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}}W(jT,g_,"PgTimestampString");var v_,__;class $T extends(__=Lr,v_=St,__){getSQLType(){return"uuid"}}W($T,v_,"PgUUID");const mv=Symbol.for("drizzle:PgInlineForeignKeys"),gv=Symbol.for("drizzle:EnableRLS");var b_,w_,x_,S_,T_,I_;class Xr extends(I_=It,T_=St,S_=mv,x_=gv,w_=It.Symbol.ExtraConfigBuilder,b_=It.Symbol.ExtraConfigColumns,I_){constructor(){super(...arguments);W(this,S_,[]);W(this,x_,!1);W(this,w_);W(this,b_,{})}}W(Xr,T_,"PgTable"),W(Xr,"Symbol",Object.assign({},It.Symbol,{InlineForeignKeys:mv,EnableRLS:gv}));var E_;E_=St;class GT{constructor(t,e){W(this,"columns");W(this,"name");this.columns=t,this.name=e}build(t){return new WT(t,this.columns,this.name)}}W(GT,E_,"PgPrimaryKeyBuilder");var A_;A_=St;class WT{constructor(t,e,n){W(this,"columns");W(this,"name");this.table=t,this.columns=e,this.name=n}getName(){return this.name??`${this.table[Xr.Symbol.Name]}_${this.columns.map(t=>t.name).join("_")}_pk`}}W(WT,A_,"PgPrimaryKey");var M_;M_=St;class kp{constructor(t,e,n){W(this,"referencedTableName");W(this,"fieldName");this.sourceTable=t,this.referencedTable=e,this.relationName=n,this.referencedTableName=e[It.Symbol.Name]}}W(kp,M_,"Relation");var C_;C_=St;class HT{constructor(t,e){this.table=t,this.config=e}}W(HT,C_,"Relations");var O_,P_;const Qu=class Qu extends(P_=kp,O_=St,P_){constructor(t,e,n,i){super(t,e,n==null?void 0:n.relationName),this.config=n,this.isNullable=i}withFieldName(t){const e=new Qu(this.sourceTable,this.referencedTable,this.config,this.isNullable);return e.fieldName=t,e}};W(Qu,O_,"One");let Os=Qu;var R_,F_;const Zu=class Zu extends(F_=kp,R_=St,F_){constructor(t,e,n){super(t,e,n==null?void 0:n.relationName),this.config=n}withFieldName(t){const e=new Zu(this.sourceTable,this.referencedTable,this.config);return e.fieldName=t,e}};W(Zu,R_,"Many");let Yu=Zu;function xk(){return{and:yf,between:hk,eq:OT,exists:uk,gt:ek,gte:rk,ilike:mk,inArray:sk,isNull:ak,isNotNull:lk,like:fk,lt:nk,lte:ik,ne:KU,not:tk,notBetween:dk,notExists:ck,notLike:pk,notIlike:gk,notInArray:ok,or:JU,sql:Y}}function Sk(){return{sql:Y,asc:yk,desc:vk}}function Tk(r,t){var s;Object.keys(r).length===1&&"default"in r&&!lt(r.default,It)&&(r=r.default);const e={},n={},i={};for(const[o,a]of Object.entries(r))if(lt(a,It)){const l=Xa(a),u=n[l];e[l]=o,i[o]={tsName:o,dbName:a[It.Symbol.Name],schema:a[It.Symbol.Schema],columns:a[It.Symbol.Columns],relations:(u==null?void 0:u.relations)??{},primaryKey:(u==null?void 0:u.primaryKey)??[]};for(const h of Object.values(a[It.Symbol.Columns]))h.primary&&i[o].primaryKey.push(h);const c=(s=a[It.Symbol.ExtraConfigBuilder])==null?void 0:s.call(a,a[It.Symbol.ExtraConfigColumns]);if(c)for(const h of Object.values(c))lt(h,GT)&&i[o].primaryKey.push(...h.columns)}else if(lt(a,HT)){const l=Xa(a.table),u=e[l],c=a.config(t(a.table));let h;for(const[f,d]of Object.entries(c))if(u){const m=i[u];m.relations[f]=d}else l in n||(n[l]={relations:{},primaryKey:h}),n[l].relations[f]=d}return{tables:i,tableNamesMap:e}}function Ik(r){return function(e,n){return new Os(r,e,n,(n==null?void 0:n.fields.reduce((i,s)=>i&&s.notNull,!0))??!1)}}function Ek(r){return function(e,n){return new Yu(r,e,n)}}function Ak(r,t,e){if(lt(e,Os)&&e.config)return{fields:e.config.fields,references:e.config.references};const n=t[Xa(e.referencedTable)];if(!n)throw new Error(`Table "${e.referencedTable[It.Symbol.Name]}" not found in schema`);const i=r[n];if(!i)throw new Error(`Table "${n}" not found in schema`);const s=e.sourceTable,o=t[Xa(s)];if(!o)throw new Error(`Table "${s[It.Symbol.Name]}" not found in schema`);const a=[];for(const l of Object.values(i.relations))(e.relationName&&e!==l&&l.relationName===e.relationName||!e.relationName&&l.referencedTable===e.sourceTable)&&a.push(l);if(a.length>1)throw e.relationName?new Error(`There are multiple relations with name "${e.relationName}" in table "${n}"`):new Error(`There are multiple relations between "${n}" and "${e.sourceTable[It.Symbol.Name]}". Please specify relation name`);if(a[0]&<(a[0],Os)&&a[0].config)return{fields:a[0].config.references,references:a[0].config.fields};throw new Error(`There is not enough information to infer relation "${o}.${e.fieldName}"`)}function Mk(r){return{one:Ik(r),many:Ek(r)}}function vf(r,t,e,n,i=s=>s){const s={};for(const[o,a]of n.entries())if(a.isJson){const l=t.relations[a.tsKey],u=e[o],c=typeof u=="string"?JSON.parse(u):u;s[a.tsKey]=lt(l,Os)?c&&vf(r,r[a.relationTableTsKey],c,a.selection,i):c.map(h=>vf(r,r[a.relationTableTsKey],h,a.selection,i))}else{const l=i(e[o]),u=a.field;let c;lt(u,rr)?c=u:lt(u,Pt)?c=u.decoder:c=u.sql.decoder,s[a.tsKey]=l===null?null:c.mapFromDriverValue(l)}return s}var D_;D_=St;const Ku=class Ku{constructor(t){W(this,"config");this.config={...t}}get(t,e){if(e==="_")return{...t._,selectedFields:new Proxy(t._.selectedFields,this)};if(e===Qe)return{...t[Qe],selectedFields:new Proxy(t[Qe].selectedFields,this)};if(typeof e=="symbol")return t[e];const i=(lt(t,Nr)?t._.selectedFields:lt(t,ji)?t[Qe].selectedFields:t)[e];if(lt(i,Pt.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!i.isSelectionField)return i.sql;const s=i.clone();return s.isSelectionField=!0,s}if(lt(i,Pt)){if(this.config.sqlBehavior==="sql")return i;throw new Error(`You tried to reference "${e}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return lt(i,rr)?this.config.alias?new Proxy(i,new Ya(new Proxy(i.table,new gc(this.config.alias,this.config.replaceOriginalName??!1)))):i:typeof i!="object"||i===null?i:new Proxy(i,new Ku(this.config))}};W(Ku,D_,"SelectionProxyHandler");let or=Ku;var L_,N_;class _f extends(N_=$i,L_=St,N_){constructor(e,n,i,s){super();W(this,"config");W(this,"authToken");W(this,"execute",e=>Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken)));this.session=n,this.dialect=i,this.config={table:e,withList:s}}where(e){return this.config.where=e,this}returning(e=this.config.table[It.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=Cs(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}_prepare(e){return Ur.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new or({alias:vs(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}W(_f,L_,"PgDelete");function Ck(r){return(r.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function Ok(r){return(r.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,n,i)=>{const s=i===0?n.toLowerCase():`${n[0].toUpperCase()}${n.slice(1)}`;return e+s},"")}function Pk(r){return r}var B_;B_=St;class XT{constructor(t){W(this,"cache",{});W(this,"cachedTables",{});W(this,"convert");this.convert=t==="snake_case"?Ck:t==="camelCase"?Ok:Pk}getColumnCasing(t){if(!t.keyAsName)return t.name;const e=t.table[It.Symbol.Schema]??"public",n=t.table[It.Symbol.OriginalName],i=`${e}.${n}.${t.name}`;return this.cache[i]||this.cacheTable(t.table),this.cache[i]}cacheTable(t){const e=t[It.Symbol.Schema]??"public",n=t[It.Symbol.OriginalName],i=`${e}.${n}`;if(!this.cachedTables[i]){for(const s of Object.values(t[It.Symbol.Columns])){const o=`${i}.${s.name}`;this.cache[o]=this.convert(s.name)}this.cachedTables[i]=!0}}clearCache(){this.cache={},this.cachedTables={}}}W(XT,B_,"CasingCache");var U_,k_;class zp extends(k_=ji,U_=St,k_){}W(zp,U_,"PgViewBase");var z_;z_=St;class Ea{constructor(t){W(this,"casing");this.casing=new XT(t==null?void 0:t.casing)}async migrate(t,e,n){const i=typeof n=="string"?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",s=typeof n=="string"?"drizzle":n.migrationsSchema??"drizzle",o=Y` CREATE TABLE IF NOT EXISTS ${Y.identifier(s)}.${Y.identifier(i)} ( id SERIAL PRIMARY KEY, hash text NOT NULL, created_at bigint ) - `;await e.execute(Y`CREATE SCHEMA IF NOT EXISTS ${Y.identifier(s)}`),await e.execute(o);const l=(await e.all(Y`select id, hash, created_at from ${Y.identifier(s)}.${Y.identifier(i)} order by created_at desc limit 1`))[0];await e.transaction(async u=>{for await(const c of t)if(!l||Number(l.created_at){var a;return e[o]!==void 0||((a=n[o])==null?void 0:a.onUpdateFn)!==void 0}),s=i.length;return Y.join(i.flatMap((o,a)=>{const l=n[o],u=e[o]??Y.param(l.onUpdateFn(),l),c=Y`${Y.identifier(this.casing.getColumnCasing(l))} = ${u}`;return a{const a=[];if(lt(s,Pt.Aliased)&&s.isSelectionField)a.push(Y.identifier(s.fieldAlias));else if(lt(s,Pt.Aliased)||lt(s,Pt)){const l=lt(s,Pt.Aliased)?s.sql:s;e?a.push(new Pt(l.queryChunks.map(u=>lt(u,Lr)?Y.identifier(this.casing.getColumnCasing(u)):u))):a.push(l),lt(s,Pt.Aliased)&&a.push(Y` as ${Y.identifier(s.fieldAlias)}`)}else lt(s,rr)&&(e?a.push(Y.identifier(this.casing.getColumnCasing(s))):a.push(s));return oa==null?void 0:a.some(({alias:P})=>P===(nt[It.Symbol.IsAlias]?vs(nt):nt[It.Symbol.BaseName])))(x.field.table)){const nt=vs(x.field.table);throw new Error(`Your "${x.path.join("->")}" field references a column "${nt}"."${x.field.name}", but the table "${nt}" is not part of the query! Did you forget to join it?`)}const p=!a||a.length===0,y=this.buildWithCTE(t);let _;d&&(_=d===!0?Y` distinct`:Y` distinct on (${Y.join(d.on,Y`, `)})`);const S=this.buildSelection(g,{isSingleTable:p}),T=this.buildFromTable(o),v=this.buildJoins(a),E=i?Y` where ${i}`:void 0,w=s?Y` having ${s}`:void 0;let B;l&&l.length>0&&(B=Y` order by ${Y.join(l,Y`, `)}`);let N;u&&u.length>0&&(N=Y` group by ${Y.join(u,Y`, `)}`);const $=typeof c=="object"||typeof c=="number"&&c>=0?Y` limit ${c}`:void 0,it=h?Y` offset ${h}`:void 0,I=Y.empty();if(f){const x=Y` for ${Y.raw(f.strength)}`;f.config.of&&x.append(Y` of ${Y.join(Array.isArray(f.config.of)?f.config.of:[f.config.of],Y`, `)}`),f.config.noWait?x.append(Y` no wait`):f.config.skipLocked&&x.append(Y` skip locked`),I.append(x)}const Z=Y`${y}select${_} ${S} from ${T}${v}${E}${N}${w}${B}${$}${it}${I}`;return m.length>0?this.buildSetOperations(Z,m):Z}buildSetOperations(t,e){const[n,...i]=e;if(!n)throw new Error("Cannot pass undefined values to any set operator");return i.length===0?this.buildSetOperationQuery({leftSelect:t,setOperator:n}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:t,setOperator:n}),i)}buildSetOperationQuery({leftSelect:t,setOperator:{type:e,isAll:n,rightSelect:i,limit:s,orderBy:o,offset:a}}){const l=Y`(${t.getSQL()}) `,u=Y`(${i.getSQL()})`;let c;if(o&&o.length>0){const m=[];for(const g of o)if(lt(g,Lr))m.push(Y.identifier(g.name));else if(lt(g,Pt)){for(let p=0;p=0?Y` limit ${s}`:void 0,f=Y.raw(`${e} ${n?"all ":""}`),d=a?Y` offset ${a}`:void 0;return Y`${l}${f}${u}${c}${h}${d}`}buildInsertQuery({table:t,values:e,onConflict:n,returning:i,withList:s,select:o,overridingSystemValue_:a}){const l=[],u=t[It.Symbol.Columns],c=Object.entries(u).filter(([y,_])=>!_.shouldDisableInsert()),h=c.map(([,y])=>Y.identifier(this.casing.getColumnCasing(y)));if(o){const y=e;lt(y,Pt)?l.push(y):l.push(y.getSQL())}else{const y=e;l.push(Y.raw("values "));for(const[_,S]of y.entries()){const T=[];for(const[v,E]of c){const w=S[v];if(w===void 0||lt(w,ci)&&w.value===void 0)if(E.defaultFn!==void 0){const B=E.defaultFn(),N=lt(B,Pt)?B:Y.param(B,E);T.push(N)}else if(!E.default&&E.onUpdateFn!==void 0){const B=E.onUpdateFn(),N=lt(B,Pt)?B:Y.param(B,E);T.push(N)}else T.push(Y`default`);else T.push(w)}l.push(T),_({dbKey:S.name,tsKey:_,field:ei(S,a),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{const y=Object.fromEntries(Object.entries(s.columns).map(([w,B])=>[w,ei(B,a)]));if(o.where){const w=typeof o.where=="function"?o.where(y,wk()):o.where;m=w&&Xu(w,a)}const _=[];let S=[];if(o.columns){let w=!1;for(const[B,N]of Object.entries(o.columns))N!==void 0&&B in s.columns&&(!w&&N===!0&&(w=!0),S.push(B));S.length>0&&(S=w?S.filter(B=>{var N;return((N=o.columns)==null?void 0:N[B])===!0}):Object.keys(s.columns).filter(B=>!S.includes(B)))}else S=Object.keys(s.columns);for(const w of S){const B=s.columns[w];_.push({tsKey:w,value:B})}let T=[];o.with&&(T=Object.entries(o.with).filter(w=>!!w[1]).map(([w,B])=>({tsKey:w,queryConfig:B,relation:s.relations[w]})));let v;if(o.extras){v=typeof o.extras=="function"?o.extras(y,{sql:Y}):o.extras;for(const[w,B]of Object.entries(v))_.push({tsKey:w,value:MT(B,a)})}for(const{tsKey:w,value:B}of _)c.push({dbKey:lt(B,Pt.Aliased)?B.fieldAlias:s.columns[w].name,tsKey:w,field:lt(B,rr)?ei(B,a):B,relationTableTsKey:void 0,isJson:!1,selection:[]});let E=typeof o.orderBy=="function"?o.orderBy(y,xk()):o.orderBy??[];Array.isArray(E)||(E=[E]),d=E.map(w=>lt(w,rr)?ei(w,a):Xu(w,a)),h=o.limit,f=o.offset;for(const{tsKey:w,queryConfig:B,relation:N}of T){const $=Ek(e,n,N),it=Xa(N.referencedTable),I=n[it],Z=`${a}_${w}`,x=yf(...$.fields.map((C,R)=>OT(ei($.references[R],Z),ei(C,a)))),nt=this.buildRelationalQueryWithoutPK({fullSchema:t,schema:e,tableNamesMap:n,table:t[I],tableConfig:e[I],queryConfig:lt(N,Os)?B===!0?{limit:1}:{...B,limit:1}:B,tableAlias:Z,joinOn:x,nestedQueryRelation:N}),P=Y`${Y.identifier(Z)}.${Y.identifier("data")}`.as(w);g.push({on:Y`true`,table:new Nr(nt.sql,{},Z),alias:Z,joinType:"left",lateral:!0}),c.push({dbKey:w,tsKey:w,field:P,relationTableTsKey:I,isJson:!0,selection:nt.selection})}}if(c.length===0)throw new Bp({message:`No fields selected for table "${s.tsName}" ("${a}")`});let p;if(m=yf(u,m),l){let y=Y`json_build_array(${Y.join(c.map(({field:T,tsKey:v,isJson:E})=>E?Y`${Y.identifier(`${a}_${v}`)}.${Y.identifier("data")}`:lt(T,Pt.Aliased)?T.sql:T),Y`, `)})`;lt(l,Yu)&&(y=Y`coalesce(json_agg(${y}${d.length>0?Y` order by ${Y.join(d,Y`, `)}`:void 0}), '[]'::json)`);const _=[{dbKey:"data",tsKey:"data",field:y.as("data"),isJson:!0,relationTableTsKey:s.tsName,selection:c}];h!==void 0||f!==void 0||d.length>0?(p=this.buildSelectQuery({table:$h(i,a),fields:{},fieldsFlat:[{path:[],field:Y.raw("*")}],where:m,limit:h,offset:f,orderBy:d,setOperators:[]}),m=void 0,h=void 0,f=void 0,d=[]):p=$h(i,a),p=this.buildSelectQuery({table:lt(p,Xr)?p:new Nr(p,{},a),fields:{},fieldsFlat:_.map(({field:T})=>({path:[],field:lt(T,rr)?ei(T,a):T})),joins:g,where:m,limit:h,offset:f,orderBy:d,setOperators:[]})}else p=this.buildSelectQuery({table:$h(i,a),fields:{},fieldsFlat:c.map(({field:y})=>({path:[],field:lt(y,rr)?ei(y,a):y})),joins:g,where:m,limit:h,offset:f,orderBy:d,setOperators:[]});return{tableTsKey:s.tsName,sql:p,selection:c}}}W(Ea,z_,"PgDialect");var V_;V_=St;class YT{getSelectedFields(){return this._.selectedFields}}W(YT,V_,"TypedQueryBuilder");var j_;j_=St;class Or{constructor(t){W(this,"fields");W(this,"session");W(this,"dialect");W(this,"withList",[]);W(this,"distinct");W(this,"authToken");this.fields=t.fields,this.session=t.session,this.dialect=t.dialect,t.withList&&(this.withList=t.withList),this.distinct=t.distinct}setToken(t){return this.authToken=t,this}from(t){const e=!!this.fields,n=t;let i;return this.fields?i=this.fields:lt(n,Nr)?i=Object.fromEntries(Object.keys(n._.selectedFields).map(s=>[s,n[s]])):lt(n,zp)?i=n[Qe].selectedFields:lt(n,Pt)?i={}:i=_k(n),new Vp({table:n,fields:i,isPartialSelect:e,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}W(Or,j_,"PgSelectBuilder");var $_,G_;class qT extends(G_=YT,$_=St,G_){constructor({table:e,fields:n,isPartialSelect:i,session:s,dialect:o,withList:a,distinct:l}){super();W(this,"_");W(this,"config");W(this,"joinsNotNullableMap");W(this,"tableName");W(this,"isPartialSelect");W(this,"session");W(this,"dialect");W(this,"leftJoin",this.createJoin("left"));W(this,"rightJoin",this.createJoin("right"));W(this,"innerJoin",this.createJoin("inner"));W(this,"fullJoin",this.createJoin("full"));W(this,"union",this.createSetOperator("union",!1));W(this,"unionAll",this.createSetOperator("union",!0));W(this,"intersect",this.createSetOperator("intersect",!1));W(this,"intersectAll",this.createSetOperator("intersect",!0));W(this,"except",this.createSetOperator("except",!1));W(this,"exceptAll",this.createSetOperator("except",!0));this.config={withList:a,table:e,fields:{...n},distinct:l,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=o,this._={selectedFields:n},this.tableName=fs(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:!0}:{}}createJoin(e){return(n,i)=>{var a;const s=this.tableName,o=fs(n);if(typeof o=="string"&&((a=this.config.joins)!=null&&a.some(l=>l.alias===o)))throw new Error(`Alias "${o}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof s=="string"&&(this.config.fields={[s]:this.config.fields}),typeof o=="string"&&!lt(n,Pt))){const l=lt(n,Nr)?n._.selectedFields:lt(n,ji)?n[Qe].selectedFields:n[It.Symbol.Columns];this.config.fields[o]=l}if(typeof i=="function"&&(i=i(new Proxy(this.config.fields,new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:n,joinType:e,alias:o}),typeof o=="string")switch(e){case"left":{this.joinsNotNullableMap[o]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([l])=>[l,!1])),this.joinsNotNullableMap[o]=!0;break}case"inner":{this.joinsNotNullableMap[o]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([l])=>[l,!1])),this.joinsNotNullableMap[o]=!1;break}}return this}}createSetOperator(e,n){return i=>{const s=typeof i=="function"?i(Pk()):i;if(!Up(this.getSelectedFields(),s.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:n,rightSelect:s}),this}}addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]=="function"){const n=e[0](new Proxy(this.config.fields,new or({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(n)?n:[n]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]=="function"){const n=e[0](new Proxy(this.config.fields,new or({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(n)?n:[n];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else{const n=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=n:this.config.orderBy=n}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}for(e,n={}){return this.config.lockingClause={strength:e,config:n},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}as(e){return new Proxy(new Nr(this.getSQL(),this.config.fields,e),new or({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new or({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}W(qT,$_,"PgSelectQueryBuilder");var W_,H_;class Vp extends(H_=qT,W_=St,H_){constructor(){super(...arguments);W(this,"authToken");W(this,"execute",e=>Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken)))}_prepare(e){const{session:n,config:i,dialect:s,joinsNotNullableMap:o,authToken:a}=this;if(!n)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");return Ur.startActiveSpan("drizzle.prepareQuery",()=>{const l=Cs(i.fields),u=n.prepareQuery(s.sqlToQuery(this.getSQL()),l,e,!0);return u.joinsNotNullableMap=o,u.setToken(a)})}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}}W(Vp,W_,"PgSelect");vk(Vp,[$i]);function zo(r,t){return(e,n,...i)=>{const s=[n,...i].map(o=>({type:r,isAll:t,rightSelect:o}));for(const o of s)if(!Up(e.getSelectedFields(),o.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return e.addSetOperators(s)}}const Pk=()=>({union:Rk,unionAll:Fk,intersect:Dk,intersectAll:Lk,except:Nk,exceptAll:Bk}),Rk=zo("union",!1),Fk=zo("union",!0),Dk=zo("intersect",!1),Lk=zo("intersect",!0),Nk=zo("except",!1),Bk=zo("except",!0);var X_;X_=St;class jp{constructor(t){W(this,"dialect");W(this,"dialectConfig");W(this,"$with",(t,e)=>{const n=this;return{as:s=>(typeof s=="function"&&(s=s(n)),new Proxy(new Np(s.getSQL(),e??("getSelectedFields"in s?s.getSelectedFields()??{}:{}),t,!0),new or({alias:t,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}});this.dialect=lt(t,Ea)?t:void 0,this.dialectConfig=lt(t,Ea)?void 0:t}with(...t){const e=this;function n(o){return new Or({fields:o??void 0,session:void 0,dialect:e.getDialect(),withList:t})}function i(o){return new Or({fields:o??void 0,session:void 0,dialect:e.getDialect(),distinct:!0})}function s(o,a){return new Or({fields:a??void 0,session:void 0,dialect:e.getDialect(),distinct:{on:o}})}return{select:n,selectDistinct:i,selectDistinctOn:s}}select(t){return new Or({fields:t??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(t){return new Or({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(t,e){return new Or({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:t}})}getDialect(){return this.dialect||(this.dialect=new Ea(this.dialectConfig)),this.dialect}}W(jp,X_,"PgQueryBuilder");var Y_;Y_=St;class bf{constructor(t,e,n,i,s){W(this,"authToken");this.table=t,this.session=e,this.dialect=n,this.withList=i,this.overridingSystemValue_=s}setToken(t){return this.authToken=t,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values(t){if(t=Array.isArray(t)?t:[t],t.length===0)throw new Error("values() must be called with at least one value");const e=t.map(n=>{const i={},s=this.table[It.Symbol.Columns];for(const o of Object.keys(n)){const a=n[o];i[o]=lt(a,Pt)?a:new ci(a,s[o])}return i});return new wf(this.table,e,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select(t){const e=typeof t=="function"?t(new jp):t;if(!lt(e,Pt)&&!Up(this.table[gf],e._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new wf(this.table,e,this.session,this.dialect,this.withList,!0)}}W(bf,Y_,"PgInsertBuilder");var q_,Q_;class wf extends(Q_=$i,q_=St,Q_){constructor(e,n,i,s,o,a,l){super();W(this,"config");W(this,"authToken");W(this,"execute",e=>Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken)));this.session=i,this.dialect=s,this.config={table:e,values:n,withList:o,select:a,overridingSystemValue_:l}}returning(e=this.config.table[It.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=Cs(e),this}onConflictDoNothing(e={}){if(e.target===void 0)this.config.onConflict=Y`do nothing`;else{let n="";n=Array.isArray(e.target)?e.target.map(s=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(s))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target));const i=e.where?Y` where ${e.where}`:void 0;this.config.onConflict=Y`(${Y.raw(n)})${i} do nothing`}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');const n=e.where?Y` where ${e.where}`:void 0,i=e.targetWhere?Y` where ${e.targetWhere}`:void 0,s=e.setWhere?Y` where ${e.setWhere}`:void 0,o=this.dialect.buildUpdateSet(this.config.table,DT(this.config.table,e.set));let a="";return a=Array.isArray(e.target)?e.target.map(l=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(l))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target)),this.config.onConflict=Y`(${Y.raw(a)})${i} do update set ${o}${n}${s}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}_prepare(e){return Ur.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new or({alias:vs(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}W(wf,q_,"PgInsert");var Z_,K_;class QT extends(K_=$i,Z_=St,K_){constructor(e,n,i){super();W(this,"config");W(this,"authToken");W(this,"execute",e=>Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken)));this.session=n,this.dialect=i,this.config={view:e}}concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}_prepare(e){return Ur.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,e,!0))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}}W(QT,Z_,"PgRefreshMaterializedView");var J_;J_=St;class xf{constructor(t,e,n,i){W(this,"authToken");this.table=t,this.session=e,this.dialect=n,this.withList=i}setToken(t){return this.authToken=t,this}set(t){return new ZT(this.table,DT(this.table,t),this.session,this.dialect,this.withList).setToken(this.authToken)}}W(xf,J_,"PgUpdateBuilder");var t0,e0;class ZT extends(e0=$i,t0=St,e0){constructor(e,n,i,s,o){super();W(this,"config");W(this,"tableName");W(this,"joinsNotNullableMap");W(this,"leftJoin",this.createJoin("left"));W(this,"rightJoin",this.createJoin("right"));W(this,"innerJoin",this.createJoin("inner"));W(this,"fullJoin",this.createJoin("full"));W(this,"authToken");W(this,"execute",e=>this._prepare().execute(e,this.authToken));this.session=i,this.dialect=s,this.config={set:n,table:e,withList:o,joins:[]},this.tableName=fs(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:!0}:{}}from(e){const n=e,i=fs(n);return typeof i=="string"&&(this.joinsNotNullableMap[i]=!0),this.config.from=n,this}getTableLikeFields(e){return lt(e,Xr)?e[It.Symbol.Columns]:lt(e,Nr)?e._.selectedFields:e[Qe].selectedFields}createJoin(e){return(n,i)=>{const s=fs(n);if(typeof s=="string"&&this.config.joins.some(o=>o.alias===s))throw new Error(`Alias "${s}" is already used in this query`);if(typeof i=="function"){const o=this.config.from&&!lt(this.config.from,Pt)?this.getTableLikeFields(this.config.from):void 0;i=i(new Proxy(this.config.table[It.Symbol.Columns],new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),o&&new Proxy(o,new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:i,table:n,joinType:e,alias:s}),typeof s=="string")switch(e){case"left":{this.joinsNotNullableMap[s]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([o])=>[o,!1])),this.joinsNotNullableMap[s]=!0;break}case"inner":{this.joinsNotNullableMap[s]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([o])=>[o,!1])),this.joinsNotNullableMap[s]=!1;break}}return this}}where(e){return this.config.where=e,this}returning(e){if(!e&&(e=Object.assign({},this.config.table[It.Symbol.Columns]),this.config.from)){const n=fs(this.config.from);if(typeof n=="string"&&this.config.from&&!lt(this.config.from,Pt)){const i=this.getTableLikeFields(this.config.from);e[n]=i}for(const i of this.config.joins){const s=fs(i.table);if(typeof s=="string"&&!lt(i.table,Pt)){const o=this.getTableLikeFields(i.table);e[s]=o}}}return this.config.returningFields=e,this.config.returning=Cs(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}_prepare(e){const n=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0);return n.joinsNotNullableMap=this.joinsNotNullableMap,n}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new or({alias:vs(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}W(ZT,t0,"PgUpdate");var r0,n0,i0;const Ma=class Ma extends(i0=Pt,n0=St,r0=Symbol.toStringTag,i0){constructor(e){super(Ma.buildEmbeddedCount(e.source,e.filters).queryChunks);W(this,"sql");W(this,"token");W(this,r0,"PgCountBuilder");W(this,"session");this.params=e,this.mapWith(Number),this.session=e.session,this.sql=Ma.buildCount(e.source,e.filters)}static buildEmbeddedCount(e,n){return Y`(select count(*) from ${e}${Y.raw(" where ").if(n)}${n})`}static buildCount(e,n){return Y`select count(*) as count from ${e}${Y.raw(" where ").if(n)}${n};`}setToken(e){return this.token=e,this}then(e,n){return Promise.resolve(this.session.count(this.sql,this.token)).then(e,n)}catch(e){return this.then(void 0,e)}finally(e){return this.then(n=>(e==null||e(),n),n=>{throw e==null||e(),n})}};W(Ma,n0,"PgCountBuilder");let Sf=Ma;var s0;s0=St;class KT{constructor(t,e,n,i,s,o,a){this.fullSchema=t,this.schema=e,this.tableNamesMap=n,this.table=i,this.tableConfig=s,this.dialect=o,this.session=a}findMany(t){return new Tf(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,t||{},"many")}findFirst(t){return new Tf(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,t?{...t,limit:1}:{limit:1},"first")}}W(KT,s0,"PgRelationalQueryBuilder");var o0,a0;class Tf extends(a0=$i,o0=St,a0){constructor(e,n,i,s,o,a,l,u,c){super();W(this,"authToken");this.fullSchema=e,this.schema=n,this.tableNamesMap=i,this.table=s,this.tableConfig=o,this.dialect=a,this.session=l,this.config=u,this.mode=c}_prepare(e){return Ur.startActiveSpan("drizzle.prepareQuery",()=>{const{query:n,builtQuery:i}=this._toSQL();return this.session.prepareQuery(i,void 0,e,!0,(s,o)=>{const a=s.map(l=>vf(this.schema,this.tableConfig,l,n.selection,o));return this.mode==="first"?a[0]:a})})}prepare(e){return this._prepare(e)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){const e=this._getQuery(),n=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:n}}toSQL(){return this._toSQL().builtQuery}setToken(e){return this.authToken=e,this}execute(){return Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(void 0,this.authToken))}}W(Tf,o0,"PgRelationalQuery");var l0,u0;class JT extends(u0=$i,l0=St,u0){constructor(t,e,n,i){super(),this.execute=t,this.sql=e,this.query=n,this.mapBatchResult=i}getSQL(){return this.sql}getQuery(){return this.query}mapResult(t,e){return e?this.mapBatchResult(t):t}_prepare(){return this}isResponseInArrayMode(){return!1}}W(JT,l0,"PgRaw");var c0;c0=St;class $p{constructor(t,e,n){W(this,"query");W(this,"$with",(t,e)=>{const n=this;return{as:s=>(typeof s=="function"&&(s=s(new jp(n.dialect))),new Proxy(new Np(s.getSQL(),e??("getSelectedFields"in s?s.getSelectedFields()??{}:{}),t,!0),new or({alias:t,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}});W(this,"authToken");if(this.dialect=t,this.session=e,this._=n?{schema:n.schema,fullSchema:n.fullSchema,tableNamesMap:n.tableNamesMap,session:e}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:e},this.query={},this._.schema)for(const[i,s]of Object.entries(this._.schema))this.query[i]=new KT(n.fullSchema,this._.schema,this._.tableNamesMap,n.fullSchema[i],s,t,e)}$count(t,e){return new Sf({source:t,filters:e,session:this.session})}with(...t){const e=this;function n(u){return new Or({fields:u??void 0,session:e.session,dialect:e.dialect,withList:t})}function i(u){return new Or({fields:u??void 0,session:e.session,dialect:e.dialect,withList:t,distinct:!0})}function s(u,c){return new Or({fields:c??void 0,session:e.session,dialect:e.dialect,withList:t,distinct:{on:u}})}function o(u){return new xf(u,e.session,e.dialect,t)}function a(u){return new bf(u,e.session,e.dialect,t)}function l(u){return new _f(u,e.session,e.dialect,t)}return{select:n,selectDistinct:i,selectDistinctOn:s,update:o,insert:a,delete:l}}select(t){return new Or({fields:t??void 0,session:this.session,dialect:this.dialect})}selectDistinct(t){return new Or({fields:t??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(t,e){return new Or({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:{on:t}})}update(t){return new xf(t,this.session,this.dialect)}insert(t){return new bf(t,this.session,this.dialect)}delete(t){return new _f(t,this.session,this.dialect)}refreshMaterializedView(t){return new QT(t,this.session,this.dialect)}execute(t){const e=typeof t=="string"?Y.raw(t):t.getSQL(),n=this.dialect.sqlToQuery(e),i=this.session.prepareQuery(n,void 0,void 0,!1);return new JT(()=>i.execute(void 0,this.authToken),e,n,s=>i.mapResult(s,!0))}transaction(t,e){return this.session.transaction(t,e)}}W($p,c0,"PgDatabase");var h0;h0=St;class t1{constructor(t){W(this,"authToken");W(this,"joinsNotNullableMap");this.query=t}getQuery(){return this.query}mapResult(t,e){return t}setToken(t){return this.authToken=t,this}}W(t1,h0,"PgPreparedQuery");var d0;d0=St;class e1{constructor(t){this.dialect=t}execute(t,e){return Ur.startActiveSpan("drizzle.operation",()=>Ur.startActiveSpan("drizzle.prepareQuery",()=>this.prepareQuery(this.dialect.sqlToQuery(t),void 0,void 0,!1)).setToken(e).execute(void 0,e))}all(t){return this.prepareQuery(this.dialect.sqlToQuery(t),void 0,void 0,!1).all()}async count(t,e){const n=await this.execute(t,e);return Number(n[0].count)}}W(e1,d0,"PgSession");var f0,p0;class r1 extends(p0=$p,f0=St,p0){constructor(t,e,n,i=0){super(t,e,n),this.schema=n,this.nestedIndex=i}rollback(){throw new CT}getTransactionConfigSQL(t){const e=[];return t.isolationLevel&&e.push(`isolation level ${t.isolationLevel}`),t.accessMode&&e.push(t.accessMode),typeof t.deferrable=="boolean"&&e.push(t.deferrable?"deferrable":"not deferrable"),Y.raw(e.join(" "))}setTransaction(t){return this.session.execute(Y`set transaction ${this.getTransactionConfigSQL(t)}`)}}W(r1,f0,"PgTransaction");function yv(r){return typeof r=="string"&&/^true$/i.test(r)}function Uk(r){const t={scheme:"duckdb-wasm:"},e=new URL(r);if(!e.protocol.startsWith("duckdb-wasm:"))throw new Error(`Expected scheme to be "duckdb-wasm:" but got "${e.protocol}"`);e.searchParams.get("bundles")==="import-url"&&(t.bundles="import-url");const n=e.searchParams.get("logger");n&&yv(n)&&(t.logger=!0);const i=e.searchParams.get("storage");switch(i){case Ha.ORIGIN_PRIVATE_FS:{e.host.length>0&&console.warn(`Host "${e.host}" will be ignored while using Origin Private FS`);const s=e.searchParams.get("write");t.storage={type:Ha.ORIGIN_PRIVATE_FS,path:e.pathname.startsWith("/")?e.pathname.slice(1):e.pathname,...s&&yv(s)&&{accessMode:Bx.READ_WRITE}};break}case null:break;default:console.warn(`Unknown storage type "${i}"`);break}return t}var m0,g0;class n1 extends(g0=t1,m0=St,g0){constructor(t,e,n,i,s,o){super({sql:e,params:n}),this.client=t,this.queryString=e,this.params=n,this.logger=i,this.fields=s,this.customResultMapper=o}async execute(t={}){const e=pv(this.params,t);this.logger.logQuery(this.queryString,e);const{fields:n,queryString:i,client:s,customResultMapper:o}=this,a=await s;return a.query(i,e)}async all(t={}){const e=pv(this.params,t);return this.logger.logQuery(this.queryString,e),(await this.client).query(this.queryString,e)}}W(n1,m0,"DuckDBWasmPreparedQuery");var y0,v0;const Ju=class Ju extends(v0=e1,y0=St,v0){constructor(e,n,i,s={}){super(n);W(this,"logger");this.client=e,this.schema=i,this.options=s,this.logger=s.logger??new FT}prepareQuery(e,n,i,s,o){return new n1(this.client,e.sql,e.params,this.logger,n,o)}async query(e,n){return this.logger.logQuery(e,n),(await this.client).query(e,n)}async queryObjects(e,n){return this.logger.logQuery(e,n),(await this.client).query(e,n)}transaction(e,n){return $U(this.client,async i=>{const s=new Ju(i,this.dialect,this.schema,this.options),o=new If(this.dialect,s,this.schema);return n&&await o.setTransaction(n),e(o)})}};W(Ju,y0,"DuckDBWasmSession");let qu=Ju;var _0,b0;const tc=class tc extends(b0=r1,_0=St,b0){constructor(e,n,i,s=0){super(e,n,i,s);W(this,"dialect");W(this,"session");this.dialect=e,this.session=n}async transaction(e){return GU(this.session.client,"",async n=>{const i=new qu(n,this.dialect,this.schema,this.session.options),s=new tc(this.dialect,i,this.schema);return e(s)})}};W(tc,_0,"DuckDBWasmTransaction");let If=tc;var w0,x0;class i1 extends(x0=$p,w0=St,x0){}W(i1,w0,"DuckDBWasmDatabase");function Aa(r,t={}){const e=new Ea({casing:t.casing});let n;t.logger===!0?n=new RT:t.logger!==!1&&(n=t.logger);let i;if(t.schema){const a=Sk(t.schema,Ak);i={fullSchema:t.schema,schema:a.tables,tableNamesMap:a.tableNamesMap}}const s=new qu(r,e,i,{logger:n}),o=new i1(e,s,i);return o.$client=r,o}function vv(r,t){const e=Uk(r);let n;return e.bundles==="import-url"?n=(async()=>{const s=await pf();switch(s){case"browser":return(await Ei(async()=>{const{getImportUrlBundles:o}=await import("./import-url-browser-CPN8ipMD.js");return{getImportUrlBundles:o}},__vite__mapDeps([3,4]))).getImportUrlBundles();case"node":return await(await Ei(async()=>{const{getImportUrlBundles:o}=await import("./import-url-node-BfNoxhRr.js");return{getImportUrlBundles:o}},__vite__mapDeps([5,4]))).getImportUrlBundles();default:throw new Error(`Unsupported environment: "${s}"`)}})():n=(async()=>{const s=await pf();switch(s){case"browser":return(await Ei(async()=>{const{getBundles:o}=await import("./default-browser-BrgSDbLD.js");return{getBundles:o}},[])).getBundles();case"node":return await(await Ei(async()=>{const{getBundles:o}=await import("./default-node-DXqP3VzA.js");return{getBundles:o}},__vite__mapDeps([0,1,2]))).getBundles();default:throw new Error(`Unsupported environment: "${s}"`)}})(),Aa(TT({bundles:n,logger:e.logger?new Ux:void 0,storage:e.storage}),t)}function _v(...r){if(typeof r[0]=="string")return vv(r[0],r[1]);if(bk(r[0])){const{connection:t,client:e,...n}=r[0];if(e)return Aa(e,n);if(typeof t=="string")return vv(t,n);if(typeof t>"u")throw new Error("connection option is required");return Aa(TT({bundles:t.bundles,logger:t.logger,storage:t.storage}),n)}return Aa(r[0],r[1])}(r=>{function t(e){return Aa({options:{parsers:{},serializers:{}}},e)}r.mock=t})(_v||(_v={}));var Gh={exports:{}};/*! + `;await e.execute(Y`CREATE SCHEMA IF NOT EXISTS ${Y.identifier(s)}`),await e.execute(o);const l=(await e.all(Y`select id, hash, created_at from ${Y.identifier(s)}.${Y.identifier(i)} order by created_at desc limit 1`))[0];await e.transaction(async u=>{for await(const c of t)if(!l||Number(l.created_at){var a;return e[o]!==void 0||((a=n[o])==null?void 0:a.onUpdateFn)!==void 0}),s=i.length;return Y.join(i.flatMap((o,a)=>{const l=n[o],u=e[o]??Y.param(l.onUpdateFn(),l),c=Y`${Y.identifier(this.casing.getColumnCasing(l))} = ${u}`;return a{const a=[];if(lt(s,Pt.Aliased)&&s.isSelectionField)a.push(Y.identifier(s.fieldAlias));else if(lt(s,Pt.Aliased)||lt(s,Pt)){const l=lt(s,Pt.Aliased)?s.sql:s;e?a.push(new Pt(l.queryChunks.map(u=>lt(u,Lr)?Y.identifier(this.casing.getColumnCasing(u)):u))):a.push(l),lt(s,Pt.Aliased)&&a.push(Y` as ${Y.identifier(s.fieldAlias)}`)}else lt(s,rr)&&(e?a.push(Y.identifier(this.casing.getColumnCasing(s))):a.push(s));return oa==null?void 0:a.some(({alias:P})=>P===(nt[It.Symbol.IsAlias]?vs(nt):nt[It.Symbol.BaseName])))(x.field.table)){const nt=vs(x.field.table);throw new Error(`Your "${x.path.join("->")}" field references a column "${nt}"."${x.field.name}", but the table "${nt}" is not part of the query! Did you forget to join it?`)}const p=!a||a.length===0,y=this.buildWithCTE(t);let _;d&&(_=d===!0?Y` distinct`:Y` distinct on (${Y.join(d.on,Y`, `)})`);const S=this.buildSelection(g,{isSingleTable:p}),T=this.buildFromTable(o),v=this.buildJoins(a),E=i?Y` where ${i}`:void 0,w=s?Y` having ${s}`:void 0;let B;l&&l.length>0&&(B=Y` order by ${Y.join(l,Y`, `)}`);let L;u&&u.length>0&&(L=Y` group by ${Y.join(u,Y`, `)}`);const $=typeof c=="object"||typeof c=="number"&&c>=0?Y` limit ${c}`:void 0,it=h?Y` offset ${h}`:void 0,I=Y.empty();if(f){const x=Y` for ${Y.raw(f.strength)}`;f.config.of&&x.append(Y` of ${Y.join(Array.isArray(f.config.of)?f.config.of:[f.config.of],Y`, `)}`),f.config.noWait?x.append(Y` no wait`):f.config.skipLocked&&x.append(Y` skip locked`),I.append(x)}const Z=Y`${y}select${_} ${S} from ${T}${v}${E}${L}${w}${B}${$}${it}${I}`;return m.length>0?this.buildSetOperations(Z,m):Z}buildSetOperations(t,e){const[n,...i]=e;if(!n)throw new Error("Cannot pass undefined values to any set operator");return i.length===0?this.buildSetOperationQuery({leftSelect:t,setOperator:n}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:t,setOperator:n}),i)}buildSetOperationQuery({leftSelect:t,setOperator:{type:e,isAll:n,rightSelect:i,limit:s,orderBy:o,offset:a}}){const l=Y`(${t.getSQL()}) `,u=Y`(${i.getSQL()})`;let c;if(o&&o.length>0){const m=[];for(const g of o)if(lt(g,Lr))m.push(Y.identifier(g.name));else if(lt(g,Pt)){for(let p=0;p=0?Y` limit ${s}`:void 0,f=Y.raw(`${e} ${n?"all ":""}`),d=a?Y` offset ${a}`:void 0;return Y`${l}${f}${u}${c}${h}${d}`}buildInsertQuery({table:t,values:e,onConflict:n,returning:i,withList:s,select:o,overridingSystemValue_:a}){const l=[],u=t[It.Symbol.Columns],c=Object.entries(u).filter(([y,_])=>!_.shouldDisableInsert()),h=c.map(([,y])=>Y.identifier(this.casing.getColumnCasing(y)));if(o){const y=e;lt(y,Pt)?l.push(y):l.push(y.getSQL())}else{const y=e;l.push(Y.raw("values "));for(const[_,S]of y.entries()){const T=[];for(const[v,E]of c){const w=S[v];if(w===void 0||lt(w,ci)&&w.value===void 0)if(E.defaultFn!==void 0){const B=E.defaultFn(),L=lt(B,Pt)?B:Y.param(B,E);T.push(L)}else if(!E.default&&E.onUpdateFn!==void 0){const B=E.onUpdateFn(),L=lt(B,Pt)?B:Y.param(B,E);T.push(L)}else T.push(Y`default`);else T.push(w)}l.push(T),_({dbKey:S.name,tsKey:_,field:ei(S,a),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{const y=Object.fromEntries(Object.entries(s.columns).map(([w,B])=>[w,ei(B,a)]));if(o.where){const w=typeof o.where=="function"?o.where(y,xk()):o.where;m=w&&Xu(w,a)}const _=[];let S=[];if(o.columns){let w=!1;for(const[B,L]of Object.entries(o.columns))L!==void 0&&B in s.columns&&(!w&&L===!0&&(w=!0),S.push(B));S.length>0&&(S=w?S.filter(B=>{var L;return((L=o.columns)==null?void 0:L[B])===!0}):Object.keys(s.columns).filter(B=>!S.includes(B)))}else S=Object.keys(s.columns);for(const w of S){const B=s.columns[w];_.push({tsKey:w,value:B})}let T=[];o.with&&(T=Object.entries(o.with).filter(w=>!!w[1]).map(([w,B])=>({tsKey:w,queryConfig:B,relation:s.relations[w]})));let v;if(o.extras){v=typeof o.extras=="function"?o.extras(y,{sql:Y}):o.extras;for(const[w,B]of Object.entries(v))_.push({tsKey:w,value:MT(B,a)})}for(const{tsKey:w,value:B}of _)c.push({dbKey:lt(B,Pt.Aliased)?B.fieldAlias:s.columns[w].name,tsKey:w,field:lt(B,rr)?ei(B,a):B,relationTableTsKey:void 0,isJson:!1,selection:[]});let E=typeof o.orderBy=="function"?o.orderBy(y,Sk()):o.orderBy??[];Array.isArray(E)||(E=[E]),d=E.map(w=>lt(w,rr)?ei(w,a):Xu(w,a)),h=o.limit,f=o.offset;for(const{tsKey:w,queryConfig:B,relation:L}of T){const $=Ak(e,n,L),it=Xa(L.referencedTable),I=n[it],Z=`${a}_${w}`,x=yf(...$.fields.map((C,R)=>OT(ei($.references[R],Z),ei(C,a)))),nt=this.buildRelationalQueryWithoutPK({fullSchema:t,schema:e,tableNamesMap:n,table:t[I],tableConfig:e[I],queryConfig:lt(L,Os)?B===!0?{limit:1}:{...B,limit:1}:B,tableAlias:Z,joinOn:x,nestedQueryRelation:L}),P=Y`${Y.identifier(Z)}.${Y.identifier("data")}`.as(w);g.push({on:Y`true`,table:new Nr(nt.sql,{},Z),alias:Z,joinType:"left",lateral:!0}),c.push({dbKey:w,tsKey:w,field:P,relationTableTsKey:I,isJson:!0,selection:nt.selection})}}if(c.length===0)throw new Bp({message:`No fields selected for table "${s.tsName}" ("${a}")`});let p;if(m=yf(u,m),l){let y=Y`json_build_array(${Y.join(c.map(({field:T,tsKey:v,isJson:E})=>E?Y`${Y.identifier(`${a}_${v}`)}.${Y.identifier("data")}`:lt(T,Pt.Aliased)?T.sql:T),Y`, `)})`;lt(l,Yu)&&(y=Y`coalesce(json_agg(${y}${d.length>0?Y` order by ${Y.join(d,Y`, `)}`:void 0}), '[]'::json)`);const _=[{dbKey:"data",tsKey:"data",field:y.as("data"),isJson:!0,relationTableTsKey:s.tsName,selection:c}];h!==void 0||f!==void 0||d.length>0?(p=this.buildSelectQuery({table:$h(i,a),fields:{},fieldsFlat:[{path:[],field:Y.raw("*")}],where:m,limit:h,offset:f,orderBy:d,setOperators:[]}),m=void 0,h=void 0,f=void 0,d=[]):p=$h(i,a),p=this.buildSelectQuery({table:lt(p,Xr)?p:new Nr(p,{},a),fields:{},fieldsFlat:_.map(({field:T})=>({path:[],field:lt(T,rr)?ei(T,a):T})),joins:g,where:m,limit:h,offset:f,orderBy:d,setOperators:[]})}else p=this.buildSelectQuery({table:$h(i,a),fields:{},fieldsFlat:c.map(({field:y})=>({path:[],field:lt(y,rr)?ei(y,a):y})),joins:g,where:m,limit:h,offset:f,orderBy:d,setOperators:[]});return{tableTsKey:s.tsName,sql:p,selection:c}}}W(Ea,z_,"PgDialect");var V_;V_=St;class YT{getSelectedFields(){return this._.selectedFields}}W(YT,V_,"TypedQueryBuilder");var j_;j_=St;class Or{constructor(t){W(this,"fields");W(this,"session");W(this,"dialect");W(this,"withList",[]);W(this,"distinct");W(this,"authToken");this.fields=t.fields,this.session=t.session,this.dialect=t.dialect,t.withList&&(this.withList=t.withList),this.distinct=t.distinct}setToken(t){return this.authToken=t,this}from(t){const e=!!this.fields,n=t;let i;return this.fields?i=this.fields:lt(n,Nr)?i=Object.fromEntries(Object.keys(n._.selectedFields).map(s=>[s,n[s]])):lt(n,zp)?i=n[Qe].selectedFields:lt(n,Pt)?i={}:i=bk(n),new Vp({table:n,fields:i,isPartialSelect:e,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}W(Or,j_,"PgSelectBuilder");var $_,G_;class qT extends(G_=YT,$_=St,G_){constructor({table:e,fields:n,isPartialSelect:i,session:s,dialect:o,withList:a,distinct:l}){super();W(this,"_");W(this,"config");W(this,"joinsNotNullableMap");W(this,"tableName");W(this,"isPartialSelect");W(this,"session");W(this,"dialect");W(this,"leftJoin",this.createJoin("left"));W(this,"rightJoin",this.createJoin("right"));W(this,"innerJoin",this.createJoin("inner"));W(this,"fullJoin",this.createJoin("full"));W(this,"union",this.createSetOperator("union",!1));W(this,"unionAll",this.createSetOperator("union",!0));W(this,"intersect",this.createSetOperator("intersect",!1));W(this,"intersectAll",this.createSetOperator("intersect",!0));W(this,"except",this.createSetOperator("except",!1));W(this,"exceptAll",this.createSetOperator("except",!0));this.config={withList:a,table:e,fields:{...n},distinct:l,setOperators:[]},this.isPartialSelect=i,this.session=s,this.dialect=o,this._={selectedFields:n},this.tableName=fs(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:!0}:{}}createJoin(e){return(n,i)=>{var a;const s=this.tableName,o=fs(n);if(typeof o=="string"&&((a=this.config.joins)!=null&&a.some(l=>l.alias===o)))throw new Error(`Alias "${o}" is already used in this query`);if(!this.isPartialSelect&&(Object.keys(this.joinsNotNullableMap).length===1&&typeof s=="string"&&(this.config.fields={[s]:this.config.fields}),typeof o=="string"&&!lt(n,Pt))){const l=lt(n,Nr)?n._.selectedFields:lt(n,ji)?n[Qe].selectedFields:n[It.Symbol.Columns];this.config.fields[o]=l}if(typeof i=="function"&&(i=i(new Proxy(this.config.fields,new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:i,table:n,joinType:e,alias:o}),typeof o=="string")switch(e){case"left":{this.joinsNotNullableMap[o]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([l])=>[l,!1])),this.joinsNotNullableMap[o]=!0;break}case"inner":{this.joinsNotNullableMap[o]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([l])=>[l,!1])),this.joinsNotNullableMap[o]=!1;break}}return this}}createSetOperator(e,n){return i=>{const s=typeof i=="function"?i(Rk()):i;if(!Up(this.getSelectedFields(),s.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:n,rightSelect:s}),this}}addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return typeof e=="function"&&(e=e(new Proxy(this.config.fields,new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if(typeof e[0]=="function"){const n=e[0](new Proxy(this.config.fields,new or({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(n)?n:[n]}else this.config.groupBy=e;return this}orderBy(...e){if(typeof e[0]=="function"){const n=e[0](new Proxy(this.config.fields,new or({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(n)?n:[n];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else{const n=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=n:this.config.orderBy=n}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}for(e,n={}){return this.config.lockingClause={strength:e,config:n},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}as(e){return new Proxy(new Nr(this.getSQL(),this.config.fields,e),new or({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new or({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}W(qT,$_,"PgSelectQueryBuilder");var W_,H_;class Vp extends(H_=qT,W_=St,H_){constructor(){super(...arguments);W(this,"authToken");W(this,"execute",e=>Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken)))}_prepare(e){const{session:n,config:i,dialect:s,joinsNotNullableMap:o,authToken:a}=this;if(!n)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");return Ur.startActiveSpan("drizzle.prepareQuery",()=>{const l=Cs(i.fields),u=n.prepareQuery(s.sqlToQuery(this.getSQL()),l,e,!0);return u.joinsNotNullableMap=o,u.setToken(a)})}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}}W(Vp,W_,"PgSelect");_k(Vp,[$i]);function zo(r,t){return(e,n,...i)=>{const s=[n,...i].map(o=>({type:r,isAll:t,rightSelect:o}));for(const o of s)if(!Up(e.getSelectedFields(),o.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return e.addSetOperators(s)}}const Rk=()=>({union:Fk,unionAll:Dk,intersect:Lk,intersectAll:Nk,except:Bk,exceptAll:Uk}),Fk=zo("union",!1),Dk=zo("union",!0),Lk=zo("intersect",!1),Nk=zo("intersect",!0),Bk=zo("except",!1),Uk=zo("except",!0);var X_;X_=St;class jp{constructor(t){W(this,"dialect");W(this,"dialectConfig");W(this,"$with",(t,e)=>{const n=this;return{as:s=>(typeof s=="function"&&(s=s(n)),new Proxy(new Np(s.getSQL(),e??("getSelectedFields"in s?s.getSelectedFields()??{}:{}),t,!0),new or({alias:t,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}});this.dialect=lt(t,Ea)?t:void 0,this.dialectConfig=lt(t,Ea)?void 0:t}with(...t){const e=this;function n(o){return new Or({fields:o??void 0,session:void 0,dialect:e.getDialect(),withList:t})}function i(o){return new Or({fields:o??void 0,session:void 0,dialect:e.getDialect(),distinct:!0})}function s(o,a){return new Or({fields:a??void 0,session:void 0,dialect:e.getDialect(),distinct:{on:o}})}return{select:n,selectDistinct:i,selectDistinctOn:s}}select(t){return new Or({fields:t??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(t){return new Or({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(t,e){return new Or({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:t}})}getDialect(){return this.dialect||(this.dialect=new Ea(this.dialectConfig)),this.dialect}}W(jp,X_,"PgQueryBuilder");var Y_;Y_=St;class bf{constructor(t,e,n,i,s){W(this,"authToken");this.table=t,this.session=e,this.dialect=n,this.withList=i,this.overridingSystemValue_=s}setToken(t){return this.authToken=t,this}overridingSystemValue(){return this.overridingSystemValue_=!0,this}values(t){if(t=Array.isArray(t)?t:[t],t.length===0)throw new Error("values() must be called with at least one value");const e=t.map(n=>{const i={},s=this.table[It.Symbol.Columns];for(const o of Object.keys(n)){const a=n[o];i[o]=lt(a,Pt)?a:new ci(a,s[o])}return i});return new wf(this.table,e,this.session,this.dialect,this.withList,!1,this.overridingSystemValue_).setToken(this.authToken)}select(t){const e=typeof t=="function"?t(new jp):t;if(!lt(e,Pt)&&!Up(this.table[gf],e._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new wf(this.table,e,this.session,this.dialect,this.withList,!0)}}W(bf,Y_,"PgInsertBuilder");var q_,Q_;class wf extends(Q_=$i,q_=St,Q_){constructor(e,n,i,s,o,a,l){super();W(this,"config");W(this,"authToken");W(this,"execute",e=>Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken)));this.session=i,this.dialect=s,this.config={table:e,values:n,withList:o,select:a,overridingSystemValue_:l}}returning(e=this.config.table[It.Symbol.Columns]){return this.config.returningFields=e,this.config.returning=Cs(e),this}onConflictDoNothing(e={}){if(e.target===void 0)this.config.onConflict=Y`do nothing`;else{let n="";n=Array.isArray(e.target)?e.target.map(s=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(s))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target));const i=e.where?Y` where ${e.where}`:void 0;this.config.onConflict=Y`(${Y.raw(n)})${i} do nothing`}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');const n=e.where?Y` where ${e.where}`:void 0,i=e.targetWhere?Y` where ${e.targetWhere}`:void 0,s=e.setWhere?Y` where ${e.setWhere}`:void 0,o=this.dialect.buildUpdateSet(this.config.table,DT(this.config.table,e.set));let a="";return a=Array.isArray(e.target)?e.target.map(l=>this.dialect.escapeName(this.dialect.casing.getColumnCasing(l))).join(","):this.dialect.escapeName(this.dialect.casing.getColumnCasing(e.target)),this.config.onConflict=Y`(${Y.raw(a)})${i} do update set ${o}${n}${s}`,this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}_prepare(e){return Ur.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new or({alias:vs(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}W(wf,q_,"PgInsert");var Z_,K_;class QT extends(K_=$i,Z_=St,K_){constructor(e,n,i){super();W(this,"config");W(this,"authToken");W(this,"execute",e=>Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken)));this.session=n,this.dialect=i,this.config={view:e}}concurrently(){if(this.config.withNoData!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.concurrently=!0,this}withNoData(){if(this.config.concurrently!==void 0)throw new Error("Cannot use concurrently and withNoData together");return this.config.withNoData=!0,this}getSQL(){return this.dialect.buildRefreshMaterializedViewQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}_prepare(e){return Ur.startActiveSpan("drizzle.prepareQuery",()=>this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),void 0,e,!0))}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}}W(QT,Z_,"PgRefreshMaterializedView");var J_;J_=St;class xf{constructor(t,e,n,i){W(this,"authToken");this.table=t,this.session=e,this.dialect=n,this.withList=i}setToken(t){return this.authToken=t,this}set(t){return new ZT(this.table,DT(this.table,t),this.session,this.dialect,this.withList).setToken(this.authToken)}}W(xf,J_,"PgUpdateBuilder");var t0,e0;class ZT extends(e0=$i,t0=St,e0){constructor(e,n,i,s,o){super();W(this,"config");W(this,"tableName");W(this,"joinsNotNullableMap");W(this,"leftJoin",this.createJoin("left"));W(this,"rightJoin",this.createJoin("right"));W(this,"innerJoin",this.createJoin("inner"));W(this,"fullJoin",this.createJoin("full"));W(this,"authToken");W(this,"execute",e=>this._prepare().execute(e,this.authToken));this.session=i,this.dialect=s,this.config={set:n,table:e,withList:o,joins:[]},this.tableName=fs(e),this.joinsNotNullableMap=typeof this.tableName=="string"?{[this.tableName]:!0}:{}}from(e){const n=e,i=fs(n);return typeof i=="string"&&(this.joinsNotNullableMap[i]=!0),this.config.from=n,this}getTableLikeFields(e){return lt(e,Xr)?e[It.Symbol.Columns]:lt(e,Nr)?e._.selectedFields:e[Qe].selectedFields}createJoin(e){return(n,i)=>{const s=fs(n);if(typeof s=="string"&&this.config.joins.some(o=>o.alias===s))throw new Error(`Alias "${s}" is already used in this query`);if(typeof i=="function"){const o=this.config.from&&!lt(this.config.from,Pt)?this.getTableLikeFields(this.config.from):void 0;i=i(new Proxy(this.config.table[It.Symbol.Columns],new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),o&&new Proxy(o,new or({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}if(this.config.joins.push({on:i,table:n,joinType:e,alias:s}),typeof s=="string")switch(e){case"left":{this.joinsNotNullableMap[s]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([o])=>[o,!1])),this.joinsNotNullableMap[s]=!0;break}case"inner":{this.joinsNotNullableMap[s]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([o])=>[o,!1])),this.joinsNotNullableMap[s]=!1;break}}return this}}where(e){return this.config.where=e,this}returning(e){if(!e&&(e=Object.assign({},this.config.table[It.Symbol.Columns]),this.config.from)){const n=fs(this.config.from);if(typeof n=="string"&&this.config.from&&!lt(this.config.from,Pt)){const i=this.getTableLikeFields(this.config.from);e[n]=i}for(const i of this.config.joins){const s=fs(i.table);if(typeof s=="string"&&!lt(i.table,Pt)){const o=this.getTableLikeFields(i.table);e[s]=o}}}return this.config.returningFields=e,this.config.returning=Cs(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){const{typings:e,...n}=this.dialect.sqlToQuery(this.getSQL());return n}_prepare(e){const n=this.session.prepareQuery(this.dialect.sqlToQuery(this.getSQL()),this.config.returning,e,!0);return n.joinsNotNullableMap=this.joinsNotNullableMap,n}prepare(e){return this._prepare(e)}setToken(e){return this.authToken=e,this}getSelectedFields(){return this.config.returningFields?new Proxy(this.config.returningFields,new or({alias:vs(this.config.table),sqlAliasedBehavior:"alias",sqlBehavior:"error"})):void 0}$dynamic(){return this}}W(ZT,t0,"PgUpdate");var r0,n0,i0;const Ma=class Ma extends(i0=Pt,n0=St,r0=Symbol.toStringTag,i0){constructor(e){super(Ma.buildEmbeddedCount(e.source,e.filters).queryChunks);W(this,"sql");W(this,"token");W(this,r0,"PgCountBuilder");W(this,"session");this.params=e,this.mapWith(Number),this.session=e.session,this.sql=Ma.buildCount(e.source,e.filters)}static buildEmbeddedCount(e,n){return Y`(select count(*) from ${e}${Y.raw(" where ").if(n)}${n})`}static buildCount(e,n){return Y`select count(*) as count from ${e}${Y.raw(" where ").if(n)}${n};`}setToken(e){return this.token=e,this}then(e,n){return Promise.resolve(this.session.count(this.sql,this.token)).then(e,n)}catch(e){return this.then(void 0,e)}finally(e){return this.then(n=>(e==null||e(),n),n=>{throw e==null||e(),n})}};W(Ma,n0,"PgCountBuilder");let Sf=Ma;var s0;s0=St;class KT{constructor(t,e,n,i,s,o,a){this.fullSchema=t,this.schema=e,this.tableNamesMap=n,this.table=i,this.tableConfig=s,this.dialect=o,this.session=a}findMany(t){return new Tf(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,t||{},"many")}findFirst(t){return new Tf(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,t?{...t,limit:1}:{limit:1},"first")}}W(KT,s0,"PgRelationalQueryBuilder");var o0,a0;class Tf extends(a0=$i,o0=St,a0){constructor(e,n,i,s,o,a,l,u,c){super();W(this,"authToken");this.fullSchema=e,this.schema=n,this.tableNamesMap=i,this.table=s,this.tableConfig=o,this.dialect=a,this.session=l,this.config=u,this.mode=c}_prepare(e){return Ur.startActiveSpan("drizzle.prepareQuery",()=>{const{query:n,builtQuery:i}=this._toSQL();return this.session.prepareQuery(i,void 0,e,!0,(s,o)=>{const a=s.map(l=>vf(this.schema,this.tableConfig,l,n.selection,o));return this.mode==="first"?a[0]:a})})}prepare(e){return this._prepare(e)}_getQuery(){return this.dialect.buildRelationalQueryWithoutPK({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName})}getSQL(){return this._getQuery().sql}_toSQL(){const e=this._getQuery(),n=this.dialect.sqlToQuery(e.sql);return{query:e,builtQuery:n}}toSQL(){return this._toSQL().builtQuery}setToken(e){return this.authToken=e,this}execute(){return Ur.startActiveSpan("drizzle.operation",()=>this._prepare().execute(void 0,this.authToken))}}W(Tf,o0,"PgRelationalQuery");var l0,u0;class JT extends(u0=$i,l0=St,u0){constructor(t,e,n,i){super(),this.execute=t,this.sql=e,this.query=n,this.mapBatchResult=i}getSQL(){return this.sql}getQuery(){return this.query}mapResult(t,e){return e?this.mapBatchResult(t):t}_prepare(){return this}isResponseInArrayMode(){return!1}}W(JT,l0,"PgRaw");var c0;c0=St;class $p{constructor(t,e,n){W(this,"query");W(this,"$with",(t,e)=>{const n=this;return{as:s=>(typeof s=="function"&&(s=s(new jp(n.dialect))),new Proxy(new Np(s.getSQL(),e??("getSelectedFields"in s?s.getSelectedFields()??{}:{}),t,!0),new or({alias:t,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}});W(this,"authToken");if(this.dialect=t,this.session=e,this._=n?{schema:n.schema,fullSchema:n.fullSchema,tableNamesMap:n.tableNamesMap,session:e}:{schema:void 0,fullSchema:{},tableNamesMap:{},session:e},this.query={},this._.schema)for(const[i,s]of Object.entries(this._.schema))this.query[i]=new KT(n.fullSchema,this._.schema,this._.tableNamesMap,n.fullSchema[i],s,t,e)}$count(t,e){return new Sf({source:t,filters:e,session:this.session})}with(...t){const e=this;function n(u){return new Or({fields:u??void 0,session:e.session,dialect:e.dialect,withList:t})}function i(u){return new Or({fields:u??void 0,session:e.session,dialect:e.dialect,withList:t,distinct:!0})}function s(u,c){return new Or({fields:c??void 0,session:e.session,dialect:e.dialect,withList:t,distinct:{on:u}})}function o(u){return new xf(u,e.session,e.dialect,t)}function a(u){return new bf(u,e.session,e.dialect,t)}function l(u){return new _f(u,e.session,e.dialect,t)}return{select:n,selectDistinct:i,selectDistinctOn:s,update:o,insert:a,delete:l}}select(t){return new Or({fields:t??void 0,session:this.session,dialect:this.dialect})}selectDistinct(t){return new Or({fields:t??void 0,session:this.session,dialect:this.dialect,distinct:!0})}selectDistinctOn(t,e){return new Or({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:{on:t}})}update(t){return new xf(t,this.session,this.dialect)}insert(t){return new bf(t,this.session,this.dialect)}delete(t){return new _f(t,this.session,this.dialect)}refreshMaterializedView(t){return new QT(t,this.session,this.dialect)}execute(t){const e=typeof t=="string"?Y.raw(t):t.getSQL(),n=this.dialect.sqlToQuery(e),i=this.session.prepareQuery(n,void 0,void 0,!1);return new JT(()=>i.execute(void 0,this.authToken),e,n,s=>i.mapResult(s,!0))}transaction(t,e){return this.session.transaction(t,e)}}W($p,c0,"PgDatabase");var h0;h0=St;class t1{constructor(t){W(this,"authToken");W(this,"joinsNotNullableMap");this.query=t}getQuery(){return this.query}mapResult(t,e){return t}setToken(t){return this.authToken=t,this}}W(t1,h0,"PgPreparedQuery");var d0;d0=St;class e1{constructor(t){this.dialect=t}execute(t,e){return Ur.startActiveSpan("drizzle.operation",()=>Ur.startActiveSpan("drizzle.prepareQuery",()=>this.prepareQuery(this.dialect.sqlToQuery(t),void 0,void 0,!1)).setToken(e).execute(void 0,e))}all(t){return this.prepareQuery(this.dialect.sqlToQuery(t),void 0,void 0,!1).all()}async count(t,e){const n=await this.execute(t,e);return Number(n[0].count)}}W(e1,d0,"PgSession");var f0,p0;class r1 extends(p0=$p,f0=St,p0){constructor(t,e,n,i=0){super(t,e,n),this.schema=n,this.nestedIndex=i}rollback(){throw new CT}getTransactionConfigSQL(t){const e=[];return t.isolationLevel&&e.push(`isolation level ${t.isolationLevel}`),t.accessMode&&e.push(t.accessMode),typeof t.deferrable=="boolean"&&e.push(t.deferrable?"deferrable":"not deferrable"),Y.raw(e.join(" "))}setTransaction(t){return this.session.execute(Y`set transaction ${this.getTransactionConfigSQL(t)}`)}}W(r1,f0,"PgTransaction");function yv(r){return typeof r=="string"&&/^true$/i.test(r)}function kk(r){const t={scheme:"duckdb-wasm:"},e=new URL(r);if(!e.protocol.startsWith("duckdb-wasm:"))throw new Error(`Expected scheme to be "duckdb-wasm:" but got "${e.protocol}"`);e.searchParams.get("bundles")==="import-url"&&(t.bundles="import-url");const n=e.searchParams.get("logger");n&&yv(n)&&(t.logger=!0);const i=e.searchParams.get("storage");switch(i){case Ha.ORIGIN_PRIVATE_FS:{e.host.length>0&&console.warn(`Host "${e.host}" will be ignored while using Origin Private FS`);const s=e.searchParams.get("write");t.storage={type:Ha.ORIGIN_PRIVATE_FS,path:e.pathname.startsWith("/")?e.pathname.slice(1):e.pathname,...s&&yv(s)&&{accessMode:Bx.READ_WRITE}};break}case null:break;default:console.warn(`Unknown storage type "${i}"`);break}return t}var m0,g0;class n1 extends(g0=t1,m0=St,g0){constructor(t,e,n,i,s,o){super({sql:e,params:n}),this.client=t,this.queryString=e,this.params=n,this.logger=i,this.fields=s,this.customResultMapper=o}async execute(t={}){const e=pv(this.params,t);this.logger.logQuery(this.queryString,e);const{fields:n,queryString:i,client:s,customResultMapper:o}=this,a=await s;return a.query(i,e)}async all(t={}){const e=pv(this.params,t);return this.logger.logQuery(this.queryString,e),(await this.client).query(this.queryString,e)}}W(n1,m0,"DuckDBWasmPreparedQuery");var y0,v0;const Ju=class Ju extends(v0=e1,y0=St,v0){constructor(e,n,i,s={}){super(n);W(this,"logger");this.client=e,this.schema=i,this.options=s,this.logger=s.logger??new FT}prepareQuery(e,n,i,s,o){return new n1(this.client,e.sql,e.params,this.logger,n,o)}async query(e,n){return this.logger.logQuery(e,n),(await this.client).query(e,n)}async queryObjects(e,n){return this.logger.logQuery(e,n),(await this.client).query(e,n)}transaction(e,n){return GU(this.client,async i=>{const s=new Ju(i,this.dialect,this.schema,this.options),o=new If(this.dialect,s,this.schema);return n&&await o.setTransaction(n),e(o)})}};W(Ju,y0,"DuckDBWasmSession");let qu=Ju;var _0,b0;const tc=class tc extends(b0=r1,_0=St,b0){constructor(e,n,i,s=0){super(e,n,i,s);W(this,"dialect");W(this,"session");this.dialect=e,this.session=n}async transaction(e){return WU(this.session.client,"",async n=>{const i=new qu(n,this.dialect,this.schema,this.session.options),s=new tc(this.dialect,i,this.schema);return e(s)})}};W(tc,_0,"DuckDBWasmTransaction");let If=tc;var w0,x0;class i1 extends(x0=$p,w0=St,x0){}W(i1,w0,"DuckDBWasmDatabase");function Aa(r,t={}){const e=new Ea({casing:t.casing});let n;t.logger===!0?n=new RT:t.logger!==!1&&(n=t.logger);let i;if(t.schema){const a=Tk(t.schema,Mk);i={fullSchema:t.schema,schema:a.tables,tableNamesMap:a.tableNamesMap}}const s=new qu(r,e,i,{logger:n}),o=new i1(e,s,i);return o.$client=r,o}function vv(r,t){const e=kk(r);let n;return e.bundles==="import-url"?n=(async()=>{const s=await pf();switch(s){case"browser":return(await Ai(async()=>{const{getImportUrlBundles:o}=await import("./import-url-browser-CPN8ipMD.js");return{getImportUrlBundles:o}},__vite__mapDeps([3,4]))).getImportUrlBundles();case"node":return await(await Ai(async()=>{const{getImportUrlBundles:o}=await import("./import-url-node-BfNoxhRr.js");return{getImportUrlBundles:o}},__vite__mapDeps([5,4]))).getImportUrlBundles();default:throw new Error(`Unsupported environment: "${s}"`)}})():n=(async()=>{const s=await pf();switch(s){case"browser":return(await Ai(async()=>{const{getBundles:o}=await import("./default-browser-BrgSDbLD.js");return{getBundles:o}},[])).getBundles();case"node":return await(await Ai(async()=>{const{getBundles:o}=await import("./default-node-C_5jnHCL.js");return{getBundles:o}},__vite__mapDeps([0,1,2]))).getBundles();default:throw new Error(`Unsupported environment: "${s}"`)}})(),Aa(TT({bundles:n,logger:e.logger?new Ux:void 0,storage:e.storage}),t)}function _v(...r){if(typeof r[0]=="string")return vv(r[0],r[1]);if(wk(r[0])){const{connection:t,client:e,...n}=r[0];if(e)return Aa(e,n);if(typeof t=="string")return vv(t,n);if(typeof t>"u")throw new Error("connection option is required");return Aa(TT({bundles:t.bundles,logger:t.logger,storage:t.storage}),n)}return Aa(r[0],r[1])}(r=>{function t(e){return Aa({options:{parsers:{},serializers:{}}},e)}r.mock=t})(_v||(_v={}));var Gh={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -4085,5 +4085,5 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/var bv;function kk(){return bv||(bv=1,function(r,t){(function(e){r.exports=e()})(function(){return function e(n,i,s){function o(u,c){if(!i[u]){if(!n[u]){var h=typeof Ai=="function"&&Ai;if(!c&&h)return h(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[u]={exports:{}};n[u][0].call(d.exports,function(m){var g=n[u][1][m];return o(g||m)},d,d.exports,e,n,i,s)}return i[u].exports}for(var a=typeof Ai=="function"&&Ai,l=0;l>2,d=(3&u)<<4|c>>4,m=1>6:64,g=2>4,c=(15&f)<<4|(d=a.indexOf(l.charAt(g++)))>>2,h=(3&d)<<6|(m=a.indexOf(l.charAt(g++))),_[p++]=u,d!==64&&(_[p++]=c),m!==64&&(_[p++]=h);return _}},{"./support":30,"./utils":32}],2:[function(e,n,i){var s=e("./external"),o=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),l=e("./stream/DataLengthProbe");function u(c,h,f,d,m){this.compressedSize=c,this.uncompressedSize=h,this.crc32=f,this.compression=d,this.compressedContent=m}u.prototype={getContentWorker:function(){var c=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),h=this;return c.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,h,f){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,n,i){var s=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,n,i){var s=e("./utils"),o=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();n.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(u,c,h,f){var d=o,m=f+h;u^=-1;for(var g=f;g>>8^d[255&(u^c[g])];return-1^u}(0|l,a,a.length,0):function(u,c,h,f){var d=o,m=f+h;u^=-1;for(var g=f;g>>8^d[255&(u^c.charCodeAt(g))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(e,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(e,n,i){var s=null;s=typeof Promise<"u"?Promise:e("lie"),n.exports={Promise:s}},{lie:37}],7:[function(e,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=e("pako"),a=e("./utils"),l=e("./stream/GenericWorker"),u=s?"uint8array":"array";function c(h,f){l.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,h.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},i.compressWorker=function(h){return new c("Deflate",h)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,n,i){function s(d,m){var g,p="";for(g=0;g>>=8;return p}function o(d,m,g,p,y,_){var S,T,v=d.file,E=d.compression,w=_!==u.utf8encode,B=a.transformTo("string",_(v.name)),N=a.transformTo("string",u.utf8encode(v.name)),$=v.comment,it=a.transformTo("string",_($)),I=a.transformTo("string",u.utf8encode($)),Z=N.length!==v.name.length,x=I.length!==$.length,nt="",P="",C="",R=v.dir,z=v.date,U={crc32:0,compressedSize:0,uncompressedSize:0};m&&!g||(U.crc32=d.crc32,U.compressedSize=d.compressedSize,U.uncompressedSize=d.uncompressedSize);var M=0;m&&(M|=8),w||!Z&&!x||(M|=2048);var O=0,j=0;R&&(O|=16),y==="UNIX"?(j=798,O|=function(tt,gt){var _t=tt;return tt||(_t=gt?16893:33204),(65535&_t)<<16}(v.unixPermissions,R)):(j=20,O|=function(tt){return 63&(tt||0)}(v.dosPermissions)),S=z.getUTCHours(),S<<=6,S|=z.getUTCMinutes(),S<<=5,S|=z.getUTCSeconds()/2,T=z.getUTCFullYear()-1980,T<<=4,T|=z.getUTCMonth()+1,T<<=5,T|=z.getUTCDate(),Z&&(P=s(1,1)+s(c(B),4)+N,nt+="up"+s(P.length,2)+P),x&&(C=s(1,1)+s(c(it),4)+I,nt+="uc"+s(C.length,2)+C);var et="";return et+=` -\0`,et+=s(M,2),et+=E.magic,et+=s(S,2),et+=s(T,2),et+=s(U.crc32,4),et+=s(U.compressedSize,4),et+=s(U.uncompressedSize,4),et+=s(B.length,2),et+=s(nt.length,2),{fileRecord:h.LOCAL_FILE_HEADER+et+B+nt,dirRecord:h.CENTRAL_FILE_HEADER+s(j,2)+et+s(it.length,2)+"\0\0\0\0"+s(O,4)+s(p,4)+B+nt+it}}var a=e("../utils"),l=e("../stream/GenericWorker"),u=e("../utf8"),c=e("../crc32"),h=e("../signature");function f(d,m,g,p){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=g,this.encodeFileName=p,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(d){var m=d.meta.percent||0,g=this.entriesCount,p=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,l.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:g?(m+100*(g-p-1))/g:100}}))},f.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var m=this.streamFiles&&!d.file.dir;if(m){var g=o(d,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(d){this.accumulate=!1;var m=this.streamFiles&&!d.file.dir,g=o(d,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),m)this.push({data:function(p){return h.DATA_DESCRIPTOR+s(p.crc32,4)+s(p.compressedSize,4)+s(p.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var d=this.bytesWritten,m=0;m=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=o},{"../utils":32}],19:[function(e,n,i){var s=e("./Uint8ArrayReader");function o(a){s.call(this,a)}e("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,n,i){var s=e("./DataReader");function o(a){s.call(this,a)}e("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(e,n,i){var s=e("./ArrayReader");function o(a){s.call(this,a)}e("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(e,n,i){var s=e("../utils"),o=e("../support"),a=e("./ArrayReader"),l=e("./StringReader"),u=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");n.exports=function(h){var f=s.getTypeOf(h);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(h):o.uint8array?new c(s.transformTo("uint8array",h)):new a(s.transformTo("array",h)):new l(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,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(e,n,i){var s=e("./GenericWorker"),o=e("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,n,i){var s=e("./GenericWorker"),o=e("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,n,i){var s=e("../utils"),o=e("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}o.prototype.processChunk.call(this,l)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,n,i){var s=e("../utils"),o=e("./GenericWorker");function a(l){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=s.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,n,i){function s(o){this.name=o||"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}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},n.exports=s},{}],29:[function(e,n,i){var s=e("../utils"),o=e("./ConvertWorker"),a=e("./GenericWorker"),l=e("../base64"),u=e("../support"),c=e("../external"),h=null;if(u.nodestream)try{h=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(m,g){return new c.Promise(function(p,y){var _=[],S=m._internalType,T=m._outputType,v=m._mimeType;m.on("data",function(E,w){_.push(E),g&&g(w)}).on("error",function(E){_=[],y(E)}).on("end",function(){try{var E=function(w,B,N){switch(w){case"blob":return s.newBlob(s.transformTo("arraybuffer",B),N);case"base64":return l.encode(B);default:return s.transformTo(w,B)}}(T,function(w,B){var N,$=0,it=null,I=0;for(N=0;N"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(e,n,i){for(var s=e("./utils"),o=e("./support"),a=e("./nodejsUtils"),l=e("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function h(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}i.utf8encode=function(d){return o.nodebuffer?a.newBufferFrom(d,"utf-8"):function(m){var g,p,y,_,S,T=m.length,v=0;for(_=0;_>>6:(p<65536?g[S++]=224|p>>>12:(g[S++]=240|p>>>18,g[S++]=128|p>>>12&63),g[S++]=128|p>>>6&63),g[S++]=128|63&p);return g}(d)},i.utf8decode=function(d){return o.nodebuffer?s.transformTo("nodebuffer",d).toString("utf-8"):function(m){var g,p,y,_,S=m.length,T=new Array(2*S);for(g=p=0;g>10&1023,T[p++]=56320|1023&y)}return T.length!==p&&(T.subarray?T=T.subarray(0,p):T.length=p),s.applyFromCharCode(T)}(d=s.transformTo(o.uint8array?"uint8array":"array",d))},s.inherits(h,l),h.prototype.processChunk=function(d){var m=s.transformTo(o.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var g=m;(m=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),m.set(g,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var p=function(_,S){var T;for((S=S||_.length)>_.length&&(S=_.length),T=S-1;0<=T&&(192&_[T])==128;)T--;return T<0||T===0?S:T+u[_[T]]>S?T:S}(m),y=m;p!==m.length&&(o.uint8array?(y=m.subarray(0,p),this.leftOver=m.subarray(p,m.length)):(y=m.slice(0,p),this.leftOver=m.slice(p,m.length))),this.push({data:i.utf8decode(y),meta:d.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=h,s.inherits(f,l),f.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,n,i){var s=e("./support"),o=e("./base64"),a=e("./nodejsUtils"),l=e("./external");function u(g){return g}function c(g,p){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var m,g,p,y=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4>>6:(d<65536?f[p++]=224|d>>>12:(f[p++]=240|d>>>18,f[p++]=128|d>>>12&63),f[p++]=128|d>>>6&63),f[p++]=128|63&d);return f},i.buf2binstring=function(h){return c(h,h.length)},i.binstring2buf=function(h){for(var f=new s.Buf8(h.length),d=0,m=f.length;d>10&1023,_[m++]=56320|1023&g)}return c(_,m)},i.utf8border=function(h,f){var d;for((f=f||h.length)>h.length&&(f=h.length),d=f-1;0<=d&&(192&h[d])==128;)d--;return d<0||d===0?f:d+l[h[d]]>f?d:f}},{"./common":41}],43:[function(e,n,i){n.exports=function(s,o,a,l){for(var u=65535&s|0,c=s>>>16&65535|0,h=0;a!==0;){for(a-=h=2e3>>1:o>>>1;a[l]=o}return a}();n.exports=function(o,a,l,u){var c=s,h=u+l;o^=-1;for(var f=u;f>>8^c[255&(o^a[f])];return-1^o}},{}],46:[function(e,n,i){var s,o=e("../utils/common"),a=e("./trees"),l=e("./adler32"),u=e("./crc32"),c=e("./messages"),h=0,f=4,d=0,m=-2,g=-1,p=4,y=2,_=8,S=9,T=286,v=30,E=19,w=2*T+1,B=15,N=3,$=258,it=$+N+1,I=42,Z=113,x=1,nt=2,P=3,C=4;function R(b,K){return b.msg=c[K],K}function z(b){return(b<<1)-(4b.avail_out&&(Q=b.avail_out),Q!==0&&(o.arraySet(b.output,K.pending_buf,K.pending_out,Q,b.next_out),b.next_out+=Q,K.pending_out+=Q,b.total_out+=Q,b.avail_out-=Q,K.pending-=Q,K.pending===0&&(K.pending_out=0))}function O(b,K){a._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,K),b.block_start=b.strstart,M(b.strm)}function j(b,K){b.pending_buf[b.pending++]=K}function et(b,K){b.pending_buf[b.pending++]=K>>>8&255,b.pending_buf[b.pending++]=255&K}function tt(b,K){var Q,L,D=b.max_chain_length,q=b.strstart,ot=b.prev_length,at=b.nice_match,rt=b.strstart>b.w_size-it?b.strstart-(b.w_size-it):0,ht=b.window,wt=b.w_mask,ft=b.prev,Mt=b.strstart+$,ge=ht[q+ot-1],oe=ht[q+ot];b.prev_length>=b.good_match&&(D>>=2),at>b.lookahead&&(at=b.lookahead);do if(ht[(Q=K)+ot]===oe&&ht[Q+ot-1]===ge&&ht[Q]===ht[q]&&ht[++Q]===ht[q+1]){q+=2,Q++;do;while(ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&qrt&&--D!=0);return ot<=b.lookahead?ot:b.lookahead}function gt(b){var K,Q,L,D,q,ot,at,rt,ht,wt,ft=b.w_size;do{if(D=b.window_size-b.lookahead-b.strstart,b.strstart>=ft+(ft-it)){for(o.arraySet(b.window,b.window,ft,ft,0),b.match_start-=ft,b.strstart-=ft,b.block_start-=ft,K=Q=b.hash_size;L=b.head[--K],b.head[K]=ft<=L?L-ft:0,--Q;);for(K=Q=ft;L=b.prev[--K],b.prev[K]=ft<=L?L-ft:0,--Q;);D+=ft}if(b.strm.avail_in===0)break;if(ot=b.strm,at=b.window,rt=b.strstart+b.lookahead,ht=D,wt=void 0,wt=ot.avail_in,ht=N)for(q=b.strstart-b.insert,b.ins_h=b.window[q],b.ins_h=(b.ins_h<=N&&(b.ins_h=(b.ins_h<=N)if(L=a._tr_tally(b,b.strstart-b.match_start,b.match_length-N),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=N){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<=N&&(b.ins_h=(b.ins_h<=N&&b.match_length<=b.prev_length){for(D=b.strstart+b.lookahead-N,L=a._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-N),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=D&&(b.ins_h=(b.ins_h<b.pending_buf_size-5&&(Q=b.pending_buf_size-5);;){if(b.lookahead<=1){if(gt(b),b.lookahead===0&&K===h)return x;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var L=b.block_start+Q;if((b.strstart===0||b.strstart>=L)&&(b.lookahead=b.strstart-L,b.strstart=L,O(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-it&&(O(b,!1),b.strm.avail_out===0))return x}return b.insert=0,K===f?(O(b,!0),b.strm.avail_out===0?P:C):(b.strstart>b.block_start&&(O(b,!1),b.strm.avail_out),x)}),new bt(4,4,8,4,_t),new bt(4,5,16,8,_t),new bt(4,6,32,32,_t),new bt(4,4,16,16,ct),new bt(8,16,32,32,ct),new bt(8,16,128,128,ct),new bt(8,32,128,256,ct),new bt(32,128,258,1024,ct),new bt(32,258,258,4096,ct)],i.deflateInit=function(b,K){return ue(b,K,_,15,8,0)},i.deflateInit2=ue,i.deflateReset=re,i.deflateResetKeep=Et,i.deflateSetHeader=function(b,K){return b&&b.state?b.state.wrap!==2?m:(b.state.gzhead=K,d):m},i.deflate=function(b,K){var Q,L,D,q;if(!b||!b.state||5>8&255),j(L,L.gzhead.time>>16&255),j(L,L.gzhead.time>>24&255),j(L,L.level===9?2:2<=L.strategy||L.level<2?4:0),j(L,255&L.gzhead.os),L.gzhead.extra&&L.gzhead.extra.length&&(j(L,255&L.gzhead.extra.length),j(L,L.gzhead.extra.length>>8&255)),L.gzhead.hcrc&&(b.adler=u(b.adler,L.pending_buf,L.pending,0)),L.gzindex=0,L.status=69):(j(L,0),j(L,0),j(L,0),j(L,0),j(L,0),j(L,L.level===9?2:2<=L.strategy||L.level<2?4:0),j(L,3),L.status=Z);else{var ot=_+(L.w_bits-8<<4)<<8;ot|=(2<=L.strategy||L.level<2?0:L.level<6?1:L.level===6?2:3)<<6,L.strstart!==0&&(ot|=32),ot+=31-ot%31,L.status=Z,et(L,ot),L.strstart!==0&&(et(L,b.adler>>>16),et(L,65535&b.adler)),b.adler=1}if(L.status===69)if(L.gzhead.extra){for(D=L.pending;L.gzindex<(65535&L.gzhead.extra.length)&&(L.pending!==L.pending_buf_size||(L.gzhead.hcrc&&L.pending>D&&(b.adler=u(b.adler,L.pending_buf,L.pending-D,D)),M(b),D=L.pending,L.pending!==L.pending_buf_size));)j(L,255&L.gzhead.extra[L.gzindex]),L.gzindex++;L.gzhead.hcrc&&L.pending>D&&(b.adler=u(b.adler,L.pending_buf,L.pending-D,D)),L.gzindex===L.gzhead.extra.length&&(L.gzindex=0,L.status=73)}else L.status=73;if(L.status===73)if(L.gzhead.name){D=L.pending;do{if(L.pending===L.pending_buf_size&&(L.gzhead.hcrc&&L.pending>D&&(b.adler=u(b.adler,L.pending_buf,L.pending-D,D)),M(b),D=L.pending,L.pending===L.pending_buf_size)){q=1;break}q=L.gzindexD&&(b.adler=u(b.adler,L.pending_buf,L.pending-D,D)),q===0&&(L.gzindex=0,L.status=91)}else L.status=91;if(L.status===91)if(L.gzhead.comment){D=L.pending;do{if(L.pending===L.pending_buf_size&&(L.gzhead.hcrc&&L.pending>D&&(b.adler=u(b.adler,L.pending_buf,L.pending-D,D)),M(b),D=L.pending,L.pending===L.pending_buf_size)){q=1;break}q=L.gzindexD&&(b.adler=u(b.adler,L.pending_buf,L.pending-D,D)),q===0&&(L.status=103)}else L.status=103;if(L.status===103&&(L.gzhead.hcrc?(L.pending+2>L.pending_buf_size&&M(b),L.pending+2<=L.pending_buf_size&&(j(L,255&b.adler),j(L,b.adler>>8&255),b.adler=0,L.status=Z)):L.status=Z),L.pending!==0){if(M(b),b.avail_out===0)return L.last_flush=-1,d}else if(b.avail_in===0&&z(K)<=z(Q)&&K!==f)return R(b,-5);if(L.status===666&&b.avail_in!==0)return R(b,-5);if(b.avail_in!==0||L.lookahead!==0||K!==h&&L.status!==666){var at=L.strategy===2?function(rt,ht){for(var wt;;){if(rt.lookahead===0&&(gt(rt),rt.lookahead===0)){if(ht===h)return x;break}if(rt.match_length=0,wt=a._tr_tally(rt,0,rt.window[rt.strstart]),rt.lookahead--,rt.strstart++,wt&&(O(rt,!1),rt.strm.avail_out===0))return x}return rt.insert=0,ht===f?(O(rt,!0),rt.strm.avail_out===0?P:C):rt.last_lit&&(O(rt,!1),rt.strm.avail_out===0)?x:nt}(L,K):L.strategy===3?function(rt,ht){for(var wt,ft,Mt,ge,oe=rt.window;;){if(rt.lookahead<=$){if(gt(rt),rt.lookahead<=$&&ht===h)return x;if(rt.lookahead===0)break}if(rt.match_length=0,rt.lookahead>=N&&0rt.lookahead&&(rt.match_length=rt.lookahead)}if(rt.match_length>=N?(wt=a._tr_tally(rt,1,rt.match_length-N),rt.lookahead-=rt.match_length,rt.strstart+=rt.match_length,rt.match_length=0):(wt=a._tr_tally(rt,0,rt.window[rt.strstart]),rt.lookahead--,rt.strstart++),wt&&(O(rt,!1),rt.strm.avail_out===0))return x}return rt.insert=0,ht===f?(O(rt,!0),rt.strm.avail_out===0?P:C):rt.last_lit&&(O(rt,!1),rt.strm.avail_out===0)?x:nt}(L,K):s[L.level].func(L,K);if(at!==P&&at!==C||(L.status=666),at===x||at===P)return b.avail_out===0&&(L.last_flush=-1),d;if(at===nt&&(K===1?a._tr_align(L):K!==5&&(a._tr_stored_block(L,0,0,!1),K===3&&(U(L.head),L.lookahead===0&&(L.strstart=0,L.block_start=0,L.insert=0))),M(b),b.avail_out===0))return L.last_flush=-1,d}return K!==f?d:L.wrap<=0?1:(L.wrap===2?(j(L,255&b.adler),j(L,b.adler>>8&255),j(L,b.adler>>16&255),j(L,b.adler>>24&255),j(L,255&b.total_in),j(L,b.total_in>>8&255),j(L,b.total_in>>16&255),j(L,b.total_in>>24&255)):(et(L,b.adler>>>16),et(L,65535&b.adler)),M(b),0=Q.w_size&&(q===0&&(U(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),ht=new o.Buf8(Q.w_size),o.arraySet(ht,K,wt-Q.w_size,Q.w_size,0),K=ht,wt=Q.w_size),ot=b.avail_in,at=b.next_in,rt=b.input,b.avail_in=wt,b.next_in=0,b.input=K,gt(Q);Q.lookahead>=N;){for(L=Q.strstart,D=Q.lookahead-(N-1);Q.ins_h=(Q.ins_h<>>=N=B>>>24,S-=N,(N=B>>>16&255)===0)nt[c++]=65535&B;else{if(!(16&N)){if((64&N)==0){B=T[(65535&B)+(_&(1<>>=N,S-=N),S<15&&(_+=x[l++]<>>=N=B>>>24,S-=N,!(16&(N=B>>>16&255))){if((64&N)==0){B=v[(65535&B)+(_&(1<>>=N,S-=N,(N=c-h)>3,_&=(1<<(S-=$<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function _(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function S(I){var Z;return I&&I.state?(Z=I.state,I.total_in=I.total_out=Z.total=0,I.msg="",Z.wrap&&(I.adler=1&Z.wrap),Z.mode=m,Z.last=0,Z.havedict=0,Z.dmax=32768,Z.head=null,Z.hold=0,Z.bits=0,Z.lencode=Z.lendyn=new s.Buf32(g),Z.distcode=Z.distdyn=new s.Buf32(p),Z.sane=1,Z.back=-1,f):d}function T(I){var Z;return I&&I.state?((Z=I.state).wsize=0,Z.whave=0,Z.wnext=0,S(I)):d}function v(I,Z){var x,nt;return I&&I.state?(nt=I.state,Z<0?(x=0,Z=-Z):(x=1+(Z>>4),Z<48&&(Z&=15)),Z&&(Z<8||15=C.wsize?(s.arraySet(C.window,Z,x-C.wsize,C.wsize,0),C.wnext=0,C.whave=C.wsize):(nt<(P=C.wsize-C.wnext)&&(P=nt),s.arraySet(C.window,Z,x-nt,P,C.wnext),(nt-=P)?(s.arraySet(C.window,Z,x-nt,nt,0),C.wnext=nt,C.whave=C.wsize):(C.wnext+=P,C.wnext===C.wsize&&(C.wnext=0),C.whave>>8&255,x.check=a(x.check,q,2,0),O=M=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&M)<<8)+(M>>8))%31){I.msg="incorrect header check",x.mode=30;break}if((15&M)!=8){I.msg="unknown compression method",x.mode=30;break}if(O-=4,b=8+(15&(M>>>=4)),x.wbits===0)x.wbits=b;else if(b>x.wbits){I.msg="invalid window size",x.mode=30;break}x.dmax=1<>8&1),512&x.flags&&(q[0]=255&M,q[1]=M>>>8&255,x.check=a(x.check,q,2,0)),O=M=0,x.mode=3;case 3:for(;O<32;){if(z===0)break t;z--,M+=nt[C++]<>>8&255,q[2]=M>>>16&255,q[3]=M>>>24&255,x.check=a(x.check,q,4,0)),O=M=0,x.mode=4;case 4:for(;O<16;){if(z===0)break t;z--,M+=nt[C++]<>8),512&x.flags&&(q[0]=255&M,q[1]=M>>>8&255,x.check=a(x.check,q,2,0)),O=M=0,x.mode=5;case 5:if(1024&x.flags){for(;O<16;){if(z===0)break t;z--,M+=nt[C++]<>>8&255,x.check=a(x.check,q,2,0)),O=M=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(z<(tt=x.length)&&(tt=z),tt&&(x.head&&(b=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),s.arraySet(x.head.extra,nt,C,tt,b)),512&x.flags&&(x.check=a(x.check,nt,tt,C)),z-=tt,C+=tt,x.length-=tt),x.length))break t;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(z===0)break t;for(tt=0;b=nt[C+tt++],x.head&&b&&x.length<65536&&(x.head.name+=String.fromCharCode(b)),b&&tt>9&1,x.head.done=!0),I.adler=x.check=0,x.mode=12;break;case 10:for(;O<32;){if(z===0)break t;z--,M+=nt[C++]<>>=7&O,O-=7&O,x.mode=27;break}for(;O<3;){if(z===0)break t;z--,M+=nt[C++]<>>=1)){case 0:x.mode=14;break;case 1:if($(x),x.mode=20,Z!==6)break;M>>>=2,O-=2;break t;case 2:x.mode=17;break;case 3:I.msg="invalid block type",x.mode=30}M>>>=2,O-=2;break;case 14:for(M>>>=7&O,O-=7&O;O<32;){if(z===0)break t;z--,M+=nt[C++]<>>16^65535)){I.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&M,O=M=0,x.mode=15,Z===6)break t;case 15:x.mode=16;case 16:if(tt=x.length){if(z>>=5,O-=5,x.ndist=1+(31&M),M>>>=5,O-=5,x.ncode=4+(15&M),M>>>=4,O-=4,286>>=3,O-=3}for(;x.have<19;)x.lens[ot[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,Q={bits:x.lenbits},K=u(0,x.lens,0,19,x.lencode,0,x.work,Q),x.lenbits=Q.bits,K){I.msg="invalid code lengths set",x.mode=30;break}x.have=0,x.mode=19;case 19:for(;x.have>>16&255,vt=65535&D,!((ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>>=ct,O-=ct,x.lens[x.have++]=vt;else{if(vt===16){for(L=ct+2;O>>=ct,O-=ct,x.have===0){I.msg="invalid bit length repeat",x.mode=30;break}b=x.lens[x.have-1],tt=3+(3&M),M>>>=2,O-=2}else if(vt===17){for(L=ct+3;O>>=ct)),M>>>=3,O-=3}else{for(L=ct+7;O>>=ct)),M>>>=7,O-=7}if(x.have+tt>x.nlen+x.ndist){I.msg="invalid bit length repeat",x.mode=30;break}for(;tt--;)x.lens[x.have++]=b}}if(x.mode===30)break;if(x.lens[256]===0){I.msg="invalid code -- missing end-of-block",x.mode=30;break}if(x.lenbits=9,Q={bits:x.lenbits},K=u(c,x.lens,0,x.nlen,x.lencode,0,x.work,Q),x.lenbits=Q.bits,K){I.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,Q={bits:x.distbits},K=u(h,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,Q),x.distbits=Q.bits,K){I.msg="invalid distances set",x.mode=30;break}if(x.mode=20,Z===6)break t;case 20:x.mode=21;case 21:if(6<=z&&258<=U){I.next_out=R,I.avail_out=U,I.next_in=C,I.avail_in=z,x.hold=M,x.bits=O,l(I,et),R=I.next_out,P=I.output,U=I.avail_out,C=I.next_in,nt=I.input,z=I.avail_in,M=x.hold,O=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;bt=(D=x.lencode[M&(1<>>16&255,vt=65535&D,!((ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>Et)])>>>16&255,vt=65535&D,!(Et+(ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>>=Et,O-=Et,x.back+=Et}if(M>>>=ct,O-=ct,x.back+=ct,x.length=vt,bt===0){x.mode=26;break}if(32&bt){x.back=-1,x.mode=12;break}if(64&bt){I.msg="invalid literal/length code",x.mode=30;break}x.extra=15&bt,x.mode=22;case 22:if(x.extra){for(L=x.extra;O>>=x.extra,O-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;bt=(D=x.distcode[M&(1<>>16&255,vt=65535&D,!((ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>Et)])>>>16&255,vt=65535&D,!(Et+(ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>>=Et,O-=Et,x.back+=Et}if(M>>>=ct,O-=ct,x.back+=ct,64&bt){I.msg="invalid distance code",x.mode=30;break}x.offset=vt,x.extra=15&bt,x.mode=24;case 24:if(x.extra){for(L=x.extra;O>>=x.extra,O-=x.extra,x.back+=x.extra}if(x.offset>x.dmax){I.msg="invalid distance too far back",x.mode=30;break}x.mode=25;case 25:if(U===0)break t;if(tt=et-U,x.offset>tt){if((tt=x.offset-tt)>x.whave&&x.sane){I.msg="invalid distance too far back",x.mode=30;break}gt=tt>x.wnext?(tt-=x.wnext,x.wsize-tt):x.wnext-tt,tt>x.length&&(tt=x.length),_t=x.window}else _t=P,gt=R-x.offset,tt=x.length;for(Uw?(N=gt[_t+p[Z]],O[j+p[Z]]):(N=96,0),_=1<>R)+(S-=_)]=B<<24|N<<16|$|0,S!==0;);for(_=1<>=1;if(_!==0?(M&=_-1,M+=_):M=0,Z++,--et[I]==0){if(I===nt)break;I=h[f+p[Z]]}if(P>>7)]}function j(D,q){D.pending_buf[D.pending++]=255&q,D.pending_buf[D.pending++]=q>>>8&255}function et(D,q,ot){D.bi_valid>y-ot?(D.bi_buf|=q<>y-D.bi_valid,D.bi_valid+=ot-y):(D.bi_buf|=q<>>=1,ot<<=1,0<--q;);return ot>>>1}function _t(D,q,ot){var at,rt,ht=new Array(p+1),wt=0;for(at=1;at<=p;at++)ht[at]=wt=wt+ot[at-1]<<1;for(rt=0;rt<=q;rt++){var ft=D[2*rt+1];ft!==0&&(D[2*rt]=gt(ht[ft]++,ft))}}function ct(D){var q;for(q=0;q>1;1<=ot;ot--)Et(D,ht,ot);for(rt=Mt;ot=D.heap[1],D.heap[1]=D.heap[D.heap_len--],Et(D,ht,1),at=D.heap[1],D.heap[--D.heap_max]=ot,D.heap[--D.heap_max]=at,ht[2*rt]=ht[2*ot]+ht[2*at],D.depth[rt]=(D.depth[ot]>=D.depth[at]?D.depth[ot]:D.depth[at])+1,ht[2*ot+1]=ht[2*at+1]=rt,D.heap[1]=rt++,Et(D,ht,1),2<=D.heap_len;);D.heap[--D.heap_max]=D.heap[1],function(oe,Ke){var sr,cr,ln,Ie,yn,gi,Ir=Ke.dyn_tree,yi=Ke.max_code,Gi=Ke.stat_desc.static_tree,Vo=Ke.stat_desc.has_stree,kr=Ke.stat_desc.extra_bits,Wi=Ke.stat_desc.extra_base,Yn=Ke.stat_desc.max_length,zr=0;for(Ie=0;Ie<=p;Ie++)oe.bl_count[Ie]=0;for(Ir[2*oe.heap[oe.heap_max]+1]=0,sr=oe.heap_max+1;sr>=7;rt>>=1)if(1&ge&&ft.dyn_ltree[2*Mt]!==0)return o;if(ft.dyn_ltree[18]!==0||ft.dyn_ltree[20]!==0||ft.dyn_ltree[26]!==0)return a;for(Mt=32;Mt>>3,(ht=D.static_len+3+7>>>3)<=rt&&(rt=ht)):rt=ht=ot+5,ot+4<=rt&&q!==-1?L(D,q,ot,at):D.strategy===4||ht===rt?(et(D,2+(at?1:0),3),re(D,it,I)):(et(D,4+(at?1:0),3),function(ft,Mt,ge,oe){var Ke;for(et(ft,Mt-257,5),et(ft,ge-1,5),et(ft,oe-4,4),Ke=0;Ke>>8&255,D.pending_buf[D.d_buf+2*D.last_lit+1]=255&q,D.pending_buf[D.l_buf+D.last_lit]=255&ot,D.last_lit++,q===0?D.dyn_ltree[2*ot]++:(D.matches++,q--,D.dyn_ltree[2*(x[ot]+h+1)]++,D.dyn_dtree[2*O(q)]++),D.last_lit===D.lit_bufsize-1},i._tr_align=function(D){et(D,2,3),tt(D,S,it),function(q){q.bi_valid===16?(j(q,q.bi_buf),q.bi_buf=0,q.bi_valid=0):8<=q.bi_valid&&(q.pending_buf[q.pending++]=255&q.bi_buf,q.bi_buf>>=8,q.bi_valid-=8)}(D)}},{"../utils/common":41}],53:[function(e,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(e,n,i){(function(s){(function(o,a){if(!o.setImmediate){var l,u,c,h,f=1,d={},m=!1,g=o.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(o);p=p&&p.setTimeout?p:o,l={}.toString.call(o.process)==="[object process]"?function(T){process.nextTick(function(){_(T)})}:function(){if(o.postMessage&&!o.importScripts){var T=!0,v=o.onmessage;return o.onmessage=function(){T=!1},o.postMessage("","*"),o.onmessage=v,T}}()?(h="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",S,!1):o.attachEvent("onmessage",S),function(T){o.postMessage(h+T,"*")}):o.MessageChannel?((c=new MessageChannel).port1.onmessage=function(T){_(T.data)},function(T){c.port2.postMessage(T)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(T){var v=g.createElement("script");v.onreadystatechange=function(){_(T),v.onreadystatechange=null,u.removeChild(v),v=null},u.appendChild(v)}):function(T){setTimeout(_,0,T)},p.setImmediate=function(T){typeof T!="function"&&(T=new Function(""+T));for(var v=new Array(arguments.length-1),E=0;E"u"?s===void 0?this:s:self)}).call(this,typeof Dn<"u"?Dn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(Gh)),Gh.exports}var zk=kk();const Vk=Ef(zk);Hn.zipReader=(r,t)=>Vk.loadAsync(r);const jk=Hn.createSettings;Hn.createSettings=async r=>{const t=Object.keys(r.files);return t.find(e=>$k(e))?jk(r):Hk(t)};function $k(r){return r.endsWith("model3.json")}function Gk(r){return r.endsWith(".moc3")}function Wk(r){return r.split(/[\\/]/).pop()}function Hk(r){const t=r.filter(u=>Gk(u));if(t.length!==1){const u=t.length?`(${t.map(c=>`"${c}"`).join(",")})`:"";throw new Error(`Expected exactly one moc file, got ${t.length} ${u}`)}const e=t[0],n=Wk(e).replace(/\.moc3?/,""),i=r.filter(u=>u.endsWith(".png"));if(!i.length)throw new Error("Textures not found");const s=r.filter(u=>u.endsWith(".mtn")||u.endsWith(".motion3.json")),o=r.find(u=>u.includes("physics")),a=r.find(u=>u.includes("pose")),l=new xs({url:`${n}.model3.json`,Version:3,FileReferences:{Moc:e,Textures:i,Physics:o,Pose:a,Motions:s.length?{"":s.map(u=>({File:u}))}:void 0}});return l.name=n,l._objectURL=`example://${l.url}`,l}Hn.readText=(r,t)=>{const e=r.file(t);if(!e)throw new Error(`Cannot find file: ${t}`);return e.async("text")};Hn.getFilePaths=r=>{const t=[];return r.forEach(e=>t.push(e)),Promise.resolve(t)};Hn.getFiles=(r,t)=>Promise.all(t.map(async e=>{const n=e.slice(e.lastIndexOf("/")+1),i=await r.file(e).async("blob");return new File([i],n)}));export{BE as A,Jk as D,yO as E,Zk as I,Vk as J,rM as L,rd as M,Qk as T,i3 as V,o3 as a,Bo as b,s3 as c,Yg as d,mO as e,fO as f,_v as g,n3 as h,r3 as i,e3 as j,lb as k,bO as l,Kk as m,qa as n,Mn as o,Ue as p,t3 as r,Y as s}; +*/var bv;function zk(){return bv||(bv=1,function(r,t){(function(e){r.exports=e()})(function(){return function e(n,i,s){function o(u,c){if(!i[u]){if(!n[u]){var h=typeof Mi=="function"&&Mi;if(!c&&h)return h(u,!0);if(a)return a(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var d=i[u]={exports:{}};n[u][0].call(d.exports,function(m){var g=n[u][1][m];return o(g||m)},d,d.exports,e,n,i,s)}return i[u].exports}for(var a=typeof Mi=="function"&&Mi,l=0;l>2,d=(3&u)<<4|c>>4,m=1>6:64,g=2>4,c=(15&f)<<4|(d=a.indexOf(l.charAt(g++)))>>2,h=(3&d)<<6|(m=a.indexOf(l.charAt(g++))),_[p++]=u,d!==64&&(_[p++]=c),m!==64&&(_[p++]=h);return _}},{"./support":30,"./utils":32}],2:[function(e,n,i){var s=e("./external"),o=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),l=e("./stream/DataLengthProbe");function u(c,h,f,d,m){this.compressedSize=c,this.uncompressedSize=h,this.crc32=f,this.compression=d,this.compressedContent=m}u.prototype={getContentWorker:function(){var c=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),h=this;return c.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,h,f){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(h.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",h)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,n,i){var s=e("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,n,i){var s=e("./utils"),o=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();n.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(u,c,h,f){var d=o,m=f+h;u^=-1;for(var g=f;g>>8^d[255&(u^c[g])];return-1^u}(0|l,a,a.length,0):function(u,c,h,f){var d=o,m=f+h;u^=-1;for(var g=f;g>>8^d[255&(u^c.charCodeAt(g))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(e,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(e,n,i){var s=null;s=typeof Promise<"u"?Promise:e("lie"),n.exports={Promise:s}},{lie:37}],7:[function(e,n,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=e("pako"),a=e("./utils"),l=e("./stream/GenericWorker"),u=s?"uint8array":"array";function c(h,f){l.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,h.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(f){h.push({data:f,meta:h.meta})}},i.compressWorker=function(h){return new c("Deflate",h)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,n,i){function s(d,m){var g,p="";for(g=0;g>>=8;return p}function o(d,m,g,p,y,_){var S,T,v=d.file,E=d.compression,w=_!==u.utf8encode,B=a.transformTo("string",_(v.name)),L=a.transformTo("string",u.utf8encode(v.name)),$=v.comment,it=a.transformTo("string",_($)),I=a.transformTo("string",u.utf8encode($)),Z=L.length!==v.name.length,x=I.length!==$.length,nt="",P="",C="",R=v.dir,z=v.date,U={crc32:0,compressedSize:0,uncompressedSize:0};m&&!g||(U.crc32=d.crc32,U.compressedSize=d.compressedSize,U.uncompressedSize=d.uncompressedSize);var M=0;m&&(M|=8),w||!Z&&!x||(M|=2048);var O=0,j=0;R&&(O|=16),y==="UNIX"?(j=798,O|=function(tt,gt){var _t=tt;return tt||(_t=gt?16893:33204),(65535&_t)<<16}(v.unixPermissions,R)):(j=20,O|=function(tt){return 63&(tt||0)}(v.dosPermissions)),S=z.getUTCHours(),S<<=6,S|=z.getUTCMinutes(),S<<=5,S|=z.getUTCSeconds()/2,T=z.getUTCFullYear()-1980,T<<=4,T|=z.getUTCMonth()+1,T<<=5,T|=z.getUTCDate(),Z&&(P=s(1,1)+s(c(B),4)+L,nt+="up"+s(P.length,2)+P),x&&(C=s(1,1)+s(c(it),4)+I,nt+="uc"+s(C.length,2)+C);var et="";return et+=` +\0`,et+=s(M,2),et+=E.magic,et+=s(S,2),et+=s(T,2),et+=s(U.crc32,4),et+=s(U.compressedSize,4),et+=s(U.uncompressedSize,4),et+=s(B.length,2),et+=s(nt.length,2),{fileRecord:h.LOCAL_FILE_HEADER+et+B+nt,dirRecord:h.CENTRAL_FILE_HEADER+s(j,2)+et+s(it.length,2)+"\0\0\0\0"+s(O,4)+s(p,4)+B+nt+it}}var a=e("../utils"),l=e("../stream/GenericWorker"),u=e("../utf8"),c=e("../crc32"),h=e("../signature");function f(d,m,g,p){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=g,this.encodeFileName=p,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(d){var m=d.meta.percent||0,g=this.entriesCount,p=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,l.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:g?(m+100*(g-p-1))/g:100}}))},f.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var m=this.streamFiles&&!d.file.dir;if(m){var g=o(d,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(d){this.accumulate=!1;var m=this.streamFiles&&!d.file.dir,g=o(d,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),m)this.push({data:function(p){return h.DATA_DESCRIPTOR+s(p.crc32,4)+s(p.compressedSize,4)+s(p.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var d=this.bytesWritten,m=0;m=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=o},{"../utils":32}],19:[function(e,n,i){var s=e("./Uint8ArrayReader");function o(a){s.call(this,a)}e("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,n,i){var s=e("./DataReader");function o(a){s.call(this,a)}e("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./DataReader":18}],21:[function(e,n,i){var s=e("./ArrayReader");function o(a){s.call(this,a)}e("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(e,n,i){var s=e("../utils"),o=e("../support"),a=e("./ArrayReader"),l=e("./StringReader"),u=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");n.exports=function(h){var f=s.getTypeOf(h);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new u(h):o.uint8array?new c(s.transformTo("uint8array",h)):new a(s.transformTo("array",h)):new l(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,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(e,n,i){var s=e("./GenericWorker"),o=e("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,n,i){var s=e("./GenericWorker"),o=e("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,n,i){var s=e("../utils"),o=e("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}o.prototype.processChunk.call(this,l)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,n,i){var s=e("../utils"),o=e("./GenericWorker");function a(l){o.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=s.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,n,i){function s(o){this.name=o||"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}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},n.exports=s},{}],29:[function(e,n,i){var s=e("../utils"),o=e("./ConvertWorker"),a=e("./GenericWorker"),l=e("../base64"),u=e("../support"),c=e("../external"),h=null;if(u.nodestream)try{h=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(m,g){return new c.Promise(function(p,y){var _=[],S=m._internalType,T=m._outputType,v=m._mimeType;m.on("data",function(E,w){_.push(E),g&&g(w)}).on("error",function(E){_=[],y(E)}).on("end",function(){try{var E=function(w,B,L){switch(w){case"blob":return s.newBlob(s.transformTo("arraybuffer",B),L);case"base64":return l.encode(B);default:return s.transformTo(w,B)}}(T,function(w,B){var L,$=0,it=null,I=0;for(L=0;L"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!e("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(e,n,i){for(var s=e("./utils"),o=e("./support"),a=e("./nodejsUtils"),l=e("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function h(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}i.utf8encode=function(d){return o.nodebuffer?a.newBufferFrom(d,"utf-8"):function(m){var g,p,y,_,S,T=m.length,v=0;for(_=0;_>>6:(p<65536?g[S++]=224|p>>>12:(g[S++]=240|p>>>18,g[S++]=128|p>>>12&63),g[S++]=128|p>>>6&63),g[S++]=128|63&p);return g}(d)},i.utf8decode=function(d){return o.nodebuffer?s.transformTo("nodebuffer",d).toString("utf-8"):function(m){var g,p,y,_,S=m.length,T=new Array(2*S);for(g=p=0;g>10&1023,T[p++]=56320|1023&y)}return T.length!==p&&(T.subarray?T=T.subarray(0,p):T.length=p),s.applyFromCharCode(T)}(d=s.transformTo(o.uint8array?"uint8array":"array",d))},s.inherits(h,l),h.prototype.processChunk=function(d){var m=s.transformTo(o.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var g=m;(m=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),m.set(g,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var p=function(_,S){var T;for((S=S||_.length)>_.length&&(S=_.length),T=S-1;0<=T&&(192&_[T])==128;)T--;return T<0||T===0?S:T+u[_[T]]>S?T:S}(m),y=m;p!==m.length&&(o.uint8array?(y=m.subarray(0,p),this.leftOver=m.subarray(p,m.length)):(y=m.slice(0,p),this.leftOver=m.slice(p,m.length))),this.push({data:i.utf8decode(y),meta:d.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=h,s.inherits(f,l),f.prototype.processChunk=function(d){this.push({data:i.utf8encode(d.data),meta:d.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,n,i){var s=e("./support"),o=e("./base64"),a=e("./nodejsUtils"),l=e("./external");function u(g){return g}function c(g,p){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var m,g,p,y=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4>>6:(d<65536?f[p++]=224|d>>>12:(f[p++]=240|d>>>18,f[p++]=128|d>>>12&63),f[p++]=128|d>>>6&63),f[p++]=128|63&d);return f},i.buf2binstring=function(h){return c(h,h.length)},i.binstring2buf=function(h){for(var f=new s.Buf8(h.length),d=0,m=f.length;d>10&1023,_[m++]=56320|1023&g)}return c(_,m)},i.utf8border=function(h,f){var d;for((f=f||h.length)>h.length&&(f=h.length),d=f-1;0<=d&&(192&h[d])==128;)d--;return d<0||d===0?f:d+l[h[d]]>f?d:f}},{"./common":41}],43:[function(e,n,i){n.exports=function(s,o,a,l){for(var u=65535&s|0,c=s>>>16&65535|0,h=0;a!==0;){for(a-=h=2e3>>1:o>>>1;a[l]=o}return a}();n.exports=function(o,a,l,u){var c=s,h=u+l;o^=-1;for(var f=u;f>>8^c[255&(o^a[f])];return-1^o}},{}],46:[function(e,n,i){var s,o=e("../utils/common"),a=e("./trees"),l=e("./adler32"),u=e("./crc32"),c=e("./messages"),h=0,f=4,d=0,m=-2,g=-1,p=4,y=2,_=8,S=9,T=286,v=30,E=19,w=2*T+1,B=15,L=3,$=258,it=$+L+1,I=42,Z=113,x=1,nt=2,P=3,C=4;function R(b,K){return b.msg=c[K],K}function z(b){return(b<<1)-(4b.avail_out&&(Q=b.avail_out),Q!==0&&(o.arraySet(b.output,K.pending_buf,K.pending_out,Q,b.next_out),b.next_out+=Q,K.pending_out+=Q,b.total_out+=Q,b.avail_out-=Q,K.pending-=Q,K.pending===0&&(K.pending_out=0))}function O(b,K){a._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,K),b.block_start=b.strstart,M(b.strm)}function j(b,K){b.pending_buf[b.pending++]=K}function et(b,K){b.pending_buf[b.pending++]=K>>>8&255,b.pending_buf[b.pending++]=255&K}function tt(b,K){var Q,N,D=b.max_chain_length,q=b.strstart,ot=b.prev_length,at=b.nice_match,rt=b.strstart>b.w_size-it?b.strstart-(b.w_size-it):0,ht=b.window,wt=b.w_mask,ft=b.prev,Mt=b.strstart+$,ge=ht[q+ot-1],oe=ht[q+ot];b.prev_length>=b.good_match&&(D>>=2),at>b.lookahead&&(at=b.lookahead);do if(ht[(Q=K)+ot]===oe&&ht[Q+ot-1]===ge&&ht[Q]===ht[q]&&ht[++Q]===ht[q+1]){q+=2,Q++;do;while(ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&ht[++q]===ht[++Q]&&qrt&&--D!=0);return ot<=b.lookahead?ot:b.lookahead}function gt(b){var K,Q,N,D,q,ot,at,rt,ht,wt,ft=b.w_size;do{if(D=b.window_size-b.lookahead-b.strstart,b.strstart>=ft+(ft-it)){for(o.arraySet(b.window,b.window,ft,ft,0),b.match_start-=ft,b.strstart-=ft,b.block_start-=ft,K=Q=b.hash_size;N=b.head[--K],b.head[K]=ft<=N?N-ft:0,--Q;);for(K=Q=ft;N=b.prev[--K],b.prev[K]=ft<=N?N-ft:0,--Q;);D+=ft}if(b.strm.avail_in===0)break;if(ot=b.strm,at=b.window,rt=b.strstart+b.lookahead,ht=D,wt=void 0,wt=ot.avail_in,ht=L)for(q=b.strstart-b.insert,b.ins_h=b.window[q],b.ins_h=(b.ins_h<=L&&(b.ins_h=(b.ins_h<=L)if(N=a._tr_tally(b,b.strstart-b.match_start,b.match_length-L),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=L){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<=L&&(b.ins_h=(b.ins_h<=L&&b.match_length<=b.prev_length){for(D=b.strstart+b.lookahead-L,N=a._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-L),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=D&&(b.ins_h=(b.ins_h<b.pending_buf_size-5&&(Q=b.pending_buf_size-5);;){if(b.lookahead<=1){if(gt(b),b.lookahead===0&&K===h)return x;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var N=b.block_start+Q;if((b.strstart===0||b.strstart>=N)&&(b.lookahead=b.strstart-N,b.strstart=N,O(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-it&&(O(b,!1),b.strm.avail_out===0))return x}return b.insert=0,K===f?(O(b,!0),b.strm.avail_out===0?P:C):(b.strstart>b.block_start&&(O(b,!1),b.strm.avail_out),x)}),new bt(4,4,8,4,_t),new bt(4,5,16,8,_t),new bt(4,6,32,32,_t),new bt(4,4,16,16,ct),new bt(8,16,32,32,ct),new bt(8,16,128,128,ct),new bt(8,32,128,256,ct),new bt(32,128,258,1024,ct),new bt(32,258,258,4096,ct)],i.deflateInit=function(b,K){return ue(b,K,_,15,8,0)},i.deflateInit2=ue,i.deflateReset=re,i.deflateResetKeep=Et,i.deflateSetHeader=function(b,K){return b&&b.state?b.state.wrap!==2?m:(b.state.gzhead=K,d):m},i.deflate=function(b,K){var Q,N,D,q;if(!b||!b.state||5>8&255),j(N,N.gzhead.time>>16&255),j(N,N.gzhead.time>>24&255),j(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),j(N,255&N.gzhead.os),N.gzhead.extra&&N.gzhead.extra.length&&(j(N,255&N.gzhead.extra.length),j(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(b.adler=u(b.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=69):(j(N,0),j(N,0),j(N,0),j(N,0),j(N,0),j(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),j(N,3),N.status=Z);else{var ot=_+(N.w_bits-8<<4)<<8;ot|=(2<=N.strategy||N.level<2?0:N.level<6?1:N.level===6?2:3)<<6,N.strstart!==0&&(ot|=32),ot+=31-ot%31,N.status=Z,et(N,ot),N.strstart!==0&&(et(N,b.adler>>>16),et(N,65535&b.adler)),b.adler=1}if(N.status===69)if(N.gzhead.extra){for(D=N.pending;N.gzindex<(65535&N.gzhead.extra.length)&&(N.pending!==N.pending_buf_size||(N.gzhead.hcrc&&N.pending>D&&(b.adler=u(b.adler,N.pending_buf,N.pending-D,D)),M(b),D=N.pending,N.pending!==N.pending_buf_size));)j(N,255&N.gzhead.extra[N.gzindex]),N.gzindex++;N.gzhead.hcrc&&N.pending>D&&(b.adler=u(b.adler,N.pending_buf,N.pending-D,D)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=73)}else N.status=73;if(N.status===73)if(N.gzhead.name){D=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>D&&(b.adler=u(b.adler,N.pending_buf,N.pending-D,D)),M(b),D=N.pending,N.pending===N.pending_buf_size)){q=1;break}q=N.gzindexD&&(b.adler=u(b.adler,N.pending_buf,N.pending-D,D)),q===0&&(N.gzindex=0,N.status=91)}else N.status=91;if(N.status===91)if(N.gzhead.comment){D=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>D&&(b.adler=u(b.adler,N.pending_buf,N.pending-D,D)),M(b),D=N.pending,N.pending===N.pending_buf_size)){q=1;break}q=N.gzindexD&&(b.adler=u(b.adler,N.pending_buf,N.pending-D,D)),q===0&&(N.status=103)}else N.status=103;if(N.status===103&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&M(b),N.pending+2<=N.pending_buf_size&&(j(N,255&b.adler),j(N,b.adler>>8&255),b.adler=0,N.status=Z)):N.status=Z),N.pending!==0){if(M(b),b.avail_out===0)return N.last_flush=-1,d}else if(b.avail_in===0&&z(K)<=z(Q)&&K!==f)return R(b,-5);if(N.status===666&&b.avail_in!==0)return R(b,-5);if(b.avail_in!==0||N.lookahead!==0||K!==h&&N.status!==666){var at=N.strategy===2?function(rt,ht){for(var wt;;){if(rt.lookahead===0&&(gt(rt),rt.lookahead===0)){if(ht===h)return x;break}if(rt.match_length=0,wt=a._tr_tally(rt,0,rt.window[rt.strstart]),rt.lookahead--,rt.strstart++,wt&&(O(rt,!1),rt.strm.avail_out===0))return x}return rt.insert=0,ht===f?(O(rt,!0),rt.strm.avail_out===0?P:C):rt.last_lit&&(O(rt,!1),rt.strm.avail_out===0)?x:nt}(N,K):N.strategy===3?function(rt,ht){for(var wt,ft,Mt,ge,oe=rt.window;;){if(rt.lookahead<=$){if(gt(rt),rt.lookahead<=$&&ht===h)return x;if(rt.lookahead===0)break}if(rt.match_length=0,rt.lookahead>=L&&0rt.lookahead&&(rt.match_length=rt.lookahead)}if(rt.match_length>=L?(wt=a._tr_tally(rt,1,rt.match_length-L),rt.lookahead-=rt.match_length,rt.strstart+=rt.match_length,rt.match_length=0):(wt=a._tr_tally(rt,0,rt.window[rt.strstart]),rt.lookahead--,rt.strstart++),wt&&(O(rt,!1),rt.strm.avail_out===0))return x}return rt.insert=0,ht===f?(O(rt,!0),rt.strm.avail_out===0?P:C):rt.last_lit&&(O(rt,!1),rt.strm.avail_out===0)?x:nt}(N,K):s[N.level].func(N,K);if(at!==P&&at!==C||(N.status=666),at===x||at===P)return b.avail_out===0&&(N.last_flush=-1),d;if(at===nt&&(K===1?a._tr_align(N):K!==5&&(a._tr_stored_block(N,0,0,!1),K===3&&(U(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),M(b),b.avail_out===0))return N.last_flush=-1,d}return K!==f?d:N.wrap<=0?1:(N.wrap===2?(j(N,255&b.adler),j(N,b.adler>>8&255),j(N,b.adler>>16&255),j(N,b.adler>>24&255),j(N,255&b.total_in),j(N,b.total_in>>8&255),j(N,b.total_in>>16&255),j(N,b.total_in>>24&255)):(et(N,b.adler>>>16),et(N,65535&b.adler)),M(b),0=Q.w_size&&(q===0&&(U(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),ht=new o.Buf8(Q.w_size),o.arraySet(ht,K,wt-Q.w_size,Q.w_size,0),K=ht,wt=Q.w_size),ot=b.avail_in,at=b.next_in,rt=b.input,b.avail_in=wt,b.next_in=0,b.input=K,gt(Q);Q.lookahead>=L;){for(N=Q.strstart,D=Q.lookahead-(L-1);Q.ins_h=(Q.ins_h<>>=L=B>>>24,S-=L,(L=B>>>16&255)===0)nt[c++]=65535&B;else{if(!(16&L)){if((64&L)==0){B=T[(65535&B)+(_&(1<>>=L,S-=L),S<15&&(_+=x[l++]<>>=L=B>>>24,S-=L,!(16&(L=B>>>16&255))){if((64&L)==0){B=v[(65535&B)+(_&(1<>>=L,S-=L,(L=c-h)>3,_&=(1<<(S-=$<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function _(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function S(I){var Z;return I&&I.state?(Z=I.state,I.total_in=I.total_out=Z.total=0,I.msg="",Z.wrap&&(I.adler=1&Z.wrap),Z.mode=m,Z.last=0,Z.havedict=0,Z.dmax=32768,Z.head=null,Z.hold=0,Z.bits=0,Z.lencode=Z.lendyn=new s.Buf32(g),Z.distcode=Z.distdyn=new s.Buf32(p),Z.sane=1,Z.back=-1,f):d}function T(I){var Z;return I&&I.state?((Z=I.state).wsize=0,Z.whave=0,Z.wnext=0,S(I)):d}function v(I,Z){var x,nt;return I&&I.state?(nt=I.state,Z<0?(x=0,Z=-Z):(x=1+(Z>>4),Z<48&&(Z&=15)),Z&&(Z<8||15=C.wsize?(s.arraySet(C.window,Z,x-C.wsize,C.wsize,0),C.wnext=0,C.whave=C.wsize):(nt<(P=C.wsize-C.wnext)&&(P=nt),s.arraySet(C.window,Z,x-nt,P,C.wnext),(nt-=P)?(s.arraySet(C.window,Z,x-nt,nt,0),C.wnext=nt,C.whave=C.wsize):(C.wnext+=P,C.wnext===C.wsize&&(C.wnext=0),C.whave>>8&255,x.check=a(x.check,q,2,0),O=M=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&M)<<8)+(M>>8))%31){I.msg="incorrect header check",x.mode=30;break}if((15&M)!=8){I.msg="unknown compression method",x.mode=30;break}if(O-=4,b=8+(15&(M>>>=4)),x.wbits===0)x.wbits=b;else if(b>x.wbits){I.msg="invalid window size",x.mode=30;break}x.dmax=1<>8&1),512&x.flags&&(q[0]=255&M,q[1]=M>>>8&255,x.check=a(x.check,q,2,0)),O=M=0,x.mode=3;case 3:for(;O<32;){if(z===0)break t;z--,M+=nt[C++]<>>8&255,q[2]=M>>>16&255,q[3]=M>>>24&255,x.check=a(x.check,q,4,0)),O=M=0,x.mode=4;case 4:for(;O<16;){if(z===0)break t;z--,M+=nt[C++]<>8),512&x.flags&&(q[0]=255&M,q[1]=M>>>8&255,x.check=a(x.check,q,2,0)),O=M=0,x.mode=5;case 5:if(1024&x.flags){for(;O<16;){if(z===0)break t;z--,M+=nt[C++]<>>8&255,x.check=a(x.check,q,2,0)),O=M=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(z<(tt=x.length)&&(tt=z),tt&&(x.head&&(b=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),s.arraySet(x.head.extra,nt,C,tt,b)),512&x.flags&&(x.check=a(x.check,nt,tt,C)),z-=tt,C+=tt,x.length-=tt),x.length))break t;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(z===0)break t;for(tt=0;b=nt[C+tt++],x.head&&b&&x.length<65536&&(x.head.name+=String.fromCharCode(b)),b&&tt>9&1,x.head.done=!0),I.adler=x.check=0,x.mode=12;break;case 10:for(;O<32;){if(z===0)break t;z--,M+=nt[C++]<>>=7&O,O-=7&O,x.mode=27;break}for(;O<3;){if(z===0)break t;z--,M+=nt[C++]<>>=1)){case 0:x.mode=14;break;case 1:if($(x),x.mode=20,Z!==6)break;M>>>=2,O-=2;break t;case 2:x.mode=17;break;case 3:I.msg="invalid block type",x.mode=30}M>>>=2,O-=2;break;case 14:for(M>>>=7&O,O-=7&O;O<32;){if(z===0)break t;z--,M+=nt[C++]<>>16^65535)){I.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&M,O=M=0,x.mode=15,Z===6)break t;case 15:x.mode=16;case 16:if(tt=x.length){if(z>>=5,O-=5,x.ndist=1+(31&M),M>>>=5,O-=5,x.ncode=4+(15&M),M>>>=4,O-=4,286>>=3,O-=3}for(;x.have<19;)x.lens[ot[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,Q={bits:x.lenbits},K=u(0,x.lens,0,19,x.lencode,0,x.work,Q),x.lenbits=Q.bits,K){I.msg="invalid code lengths set",x.mode=30;break}x.have=0,x.mode=19;case 19:for(;x.have>>16&255,vt=65535&D,!((ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>>=ct,O-=ct,x.lens[x.have++]=vt;else{if(vt===16){for(N=ct+2;O>>=ct,O-=ct,x.have===0){I.msg="invalid bit length repeat",x.mode=30;break}b=x.lens[x.have-1],tt=3+(3&M),M>>>=2,O-=2}else if(vt===17){for(N=ct+3;O>>=ct)),M>>>=3,O-=3}else{for(N=ct+7;O>>=ct)),M>>>=7,O-=7}if(x.have+tt>x.nlen+x.ndist){I.msg="invalid bit length repeat",x.mode=30;break}for(;tt--;)x.lens[x.have++]=b}}if(x.mode===30)break;if(x.lens[256]===0){I.msg="invalid code -- missing end-of-block",x.mode=30;break}if(x.lenbits=9,Q={bits:x.lenbits},K=u(c,x.lens,0,x.nlen,x.lencode,0,x.work,Q),x.lenbits=Q.bits,K){I.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,Q={bits:x.distbits},K=u(h,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,Q),x.distbits=Q.bits,K){I.msg="invalid distances set",x.mode=30;break}if(x.mode=20,Z===6)break t;case 20:x.mode=21;case 21:if(6<=z&&258<=U){I.next_out=R,I.avail_out=U,I.next_in=C,I.avail_in=z,x.hold=M,x.bits=O,l(I,et),R=I.next_out,P=I.output,U=I.avail_out,C=I.next_in,nt=I.input,z=I.avail_in,M=x.hold,O=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;bt=(D=x.lencode[M&(1<>>16&255,vt=65535&D,!((ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>Et)])>>>16&255,vt=65535&D,!(Et+(ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>>=Et,O-=Et,x.back+=Et}if(M>>>=ct,O-=ct,x.back+=ct,x.length=vt,bt===0){x.mode=26;break}if(32&bt){x.back=-1,x.mode=12;break}if(64&bt){I.msg="invalid literal/length code",x.mode=30;break}x.extra=15&bt,x.mode=22;case 22:if(x.extra){for(N=x.extra;O>>=x.extra,O-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;bt=(D=x.distcode[M&(1<>>16&255,vt=65535&D,!((ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>Et)])>>>16&255,vt=65535&D,!(Et+(ct=D>>>24)<=O);){if(z===0)break t;z--,M+=nt[C++]<>>=Et,O-=Et,x.back+=Et}if(M>>>=ct,O-=ct,x.back+=ct,64&bt){I.msg="invalid distance code",x.mode=30;break}x.offset=vt,x.extra=15&bt,x.mode=24;case 24:if(x.extra){for(N=x.extra;O>>=x.extra,O-=x.extra,x.back+=x.extra}if(x.offset>x.dmax){I.msg="invalid distance too far back",x.mode=30;break}x.mode=25;case 25:if(U===0)break t;if(tt=et-U,x.offset>tt){if((tt=x.offset-tt)>x.whave&&x.sane){I.msg="invalid distance too far back",x.mode=30;break}gt=tt>x.wnext?(tt-=x.wnext,x.wsize-tt):x.wnext-tt,tt>x.length&&(tt=x.length),_t=x.window}else _t=P,gt=R-x.offset,tt=x.length;for(Uw?(L=gt[_t+p[Z]],O[j+p[Z]]):(L=96,0),_=1<>R)+(S-=_)]=B<<24|L<<16|$|0,S!==0;);for(_=1<>=1;if(_!==0?(M&=_-1,M+=_):M=0,Z++,--et[I]==0){if(I===nt)break;I=h[f+p[Z]]}if(P>>7)]}function j(D,q){D.pending_buf[D.pending++]=255&q,D.pending_buf[D.pending++]=q>>>8&255}function et(D,q,ot){D.bi_valid>y-ot?(D.bi_buf|=q<>y-D.bi_valid,D.bi_valid+=ot-y):(D.bi_buf|=q<>>=1,ot<<=1,0<--q;);return ot>>>1}function _t(D,q,ot){var at,rt,ht=new Array(p+1),wt=0;for(at=1;at<=p;at++)ht[at]=wt=wt+ot[at-1]<<1;for(rt=0;rt<=q;rt++){var ft=D[2*rt+1];ft!==0&&(D[2*rt]=gt(ht[ft]++,ft))}}function ct(D){var q;for(q=0;q>1;1<=ot;ot--)Et(D,ht,ot);for(rt=Mt;ot=D.heap[1],D.heap[1]=D.heap[D.heap_len--],Et(D,ht,1),at=D.heap[1],D.heap[--D.heap_max]=ot,D.heap[--D.heap_max]=at,ht[2*rt]=ht[2*ot]+ht[2*at],D.depth[rt]=(D.depth[ot]>=D.depth[at]?D.depth[ot]:D.depth[at])+1,ht[2*ot+1]=ht[2*at+1]=rt,D.heap[1]=rt++,Et(D,ht,1),2<=D.heap_len;);D.heap[--D.heap_max]=D.heap[1],function(oe,Ke){var sr,cr,ln,Ie,yn,yi,Ir=Ke.dyn_tree,vi=Ke.max_code,Gi=Ke.stat_desc.static_tree,Vo=Ke.stat_desc.has_stree,kr=Ke.stat_desc.extra_bits,Wi=Ke.stat_desc.extra_base,Yn=Ke.stat_desc.max_length,zr=0;for(Ie=0;Ie<=p;Ie++)oe.bl_count[Ie]=0;for(Ir[2*oe.heap[oe.heap_max]+1]=0,sr=oe.heap_max+1;sr>=7;rt>>=1)if(1&ge&&ft.dyn_ltree[2*Mt]!==0)return o;if(ft.dyn_ltree[18]!==0||ft.dyn_ltree[20]!==0||ft.dyn_ltree[26]!==0)return a;for(Mt=32;Mt>>3,(ht=D.static_len+3+7>>>3)<=rt&&(rt=ht)):rt=ht=ot+5,ot+4<=rt&&q!==-1?N(D,q,ot,at):D.strategy===4||ht===rt?(et(D,2+(at?1:0),3),re(D,it,I)):(et(D,4+(at?1:0),3),function(ft,Mt,ge,oe){var Ke;for(et(ft,Mt-257,5),et(ft,ge-1,5),et(ft,oe-4,4),Ke=0;Ke>>8&255,D.pending_buf[D.d_buf+2*D.last_lit+1]=255&q,D.pending_buf[D.l_buf+D.last_lit]=255&ot,D.last_lit++,q===0?D.dyn_ltree[2*ot]++:(D.matches++,q--,D.dyn_ltree[2*(x[ot]+h+1)]++,D.dyn_dtree[2*O(q)]++),D.last_lit===D.lit_bufsize-1},i._tr_align=function(D){et(D,2,3),tt(D,S,it),function(q){q.bi_valid===16?(j(q,q.bi_buf),q.bi_buf=0,q.bi_valid=0):8<=q.bi_valid&&(q.pending_buf[q.pending++]=255&q.bi_buf,q.bi_buf>>=8,q.bi_valid-=8)}(D)}},{"../utils/common":41}],53:[function(e,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(e,n,i){(function(s){(function(o,a){if(!o.setImmediate){var l,u,c,h,f=1,d={},m=!1,g=o.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(o);p=p&&p.setTimeout?p:o,l={}.toString.call(o.process)==="[object process]"?function(T){process.nextTick(function(){_(T)})}:function(){if(o.postMessage&&!o.importScripts){var T=!0,v=o.onmessage;return o.onmessage=function(){T=!1},o.postMessage("","*"),o.onmessage=v,T}}()?(h="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",S,!1):o.attachEvent("onmessage",S),function(T){o.postMessage(h+T,"*")}):o.MessageChannel?((c=new MessageChannel).port1.onmessage=function(T){_(T.data)},function(T){c.port2.postMessage(T)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(T){var v=g.createElement("script");v.onreadystatechange=function(){_(T),v.onreadystatechange=null,u.removeChild(v),v=null},u.appendChild(v)}):function(T){setTimeout(_,0,T)},p.setImmediate=function(T){typeof T!="function"&&(T=new Function(""+T));for(var v=new Array(arguments.length-1),E=0;E"u"?s===void 0?this:s:self)}).call(this,typeof Dn<"u"?Dn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(Gh)),Gh.exports}var Vk=zk();const jk=Ef(Vk);Hn.zipReader=(r,t)=>jk.loadAsync(r);const $k=Hn.createSettings;Hn.createSettings=async r=>{const t=Object.keys(r.files);return t.find(e=>Gk(e))?$k(r):Xk(t)};function Gk(r){return r.endsWith("model3.json")}function Wk(r){return r.endsWith(".moc3")}function Hk(r){return r.split(/[\\/]/).pop()}function Xk(r){const t=r.filter(u=>Wk(u));if(t.length!==1){const u=t.length?`(${t.map(c=>`"${c}"`).join(",")})`:"";throw new Error(`Expected exactly one moc file, got ${t.length} ${u}`)}const e=t[0],n=Hk(e).replace(/\.moc3?/,""),i=r.filter(u=>u.endsWith(".png"));if(!i.length)throw new Error("Textures not found");const s=r.filter(u=>u.endsWith(".mtn")||u.endsWith(".motion3.json")),o=r.find(u=>u.includes("physics")),a=r.find(u=>u.includes("pose")),l=new xs({url:`${n}.model3.json`,Version:3,FileReferences:{Moc:e,Textures:i,Physics:o,Pose:a,Motions:s.length?{"":s.map(u=>({File:u}))}:void 0}});return l.name=n,l._objectURL=`example://${l.url}`,l}Hn.readText=(r,t)=>{const e=r.file(t);if(!e)throw new Error(`Cannot find file: ${t}`);return e.async("text")};Hn.getFilePaths=r=>{const t=[];return r.forEach(e=>t.push(e)),Promise.resolve(t)};Hn.getFiles=(r,t)=>Promise.all(t.map(async e=>{const n=e.slice(e.lastIndexOf("/")+1),i=await r.file(e).async("blob");return new File([i],n)}));export{BE as A,t3 as D,yO as E,Kk as I,jk as J,rM as L,rd as M,Zk as T,s3 as V,a3 as a,Bo as b,o3 as c,Yg as d,mO as e,fO as f,_v as g,i3 as h,n3 as i,r3 as j,lb as k,bO as l,Jk as m,qa as n,Mn as o,Ue as p,e3 as r}; diff --git a/assets/TestDummyMarker-C0ucr5S2.css b/assets/TestDummyMarker-C0ucr5S2.css deleted file mode 100644 index 1883295d13ba6307e91d1a0246075badfba76d60..0000000000000000000000000000000000000000 --- a/assets/TestDummyMarker-C0ucr5S2.css +++ /dev/null @@ -1 +0,0 @@ -.volumed[data-v-568551bc]{transform-style:preserve-3d;width:fit-content;height:fit-content}.test-dummy-flat[data-v-b4ef37ac]{display:inline-block;position:relative}.test-dummy-flat .marker[data-v-b4ef37ac]{position:absolute;top:0;right:0;bottom:0;left:0;background:conic-gradient(#ffeb3b,#ffeb3b 90deg,#000 90deg,#000 180deg,#ffeb3b 180deg,#ffeb3b 270deg,#000 270deg,#000 360deg);border-radius:50%;box-shadow:0 4px 12px #b9b9b933}.dark .test-dummy-flat .marker[data-v-b4ef37ac]{box-shadow:0 4px 12px #0003} diff --git a/assets/TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js b/assets/TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js new file mode 100644 index 0000000000000000000000000000000000000000..f0bbdb7432571dfa47ed63622b48338151691330 --- /dev/null +++ b/assets/TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js @@ -0,0 +1 @@ +import{bx as A,d as m,c3 as I,bW as g,c4 as T,c0 as x,x as f,o as c,y,m as w,u as i,b$ as R,cd as N,g as $,h as b,cp as E,bY as D,cq as L,w as z,c as V,by as H,E as K,cr as U,C as W,cs as Y,bM as G,bJ as q,b as k,bI as X,a as _,D as M,n as S,bn as F,br as C,l as J,H as Q}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";function O(t){return t?t.flatMap(e=>e.type===A?O(e.children):[e]):[]}const Z=m({name:"PrimitiveSlot",inheritAttrs:!1,setup(t,{attrs:e,slots:r}){return()=>{var p,v;if(!r.default)return null;const a=O(r.default()),n=a.findIndex(d=>d.type!==I);if(n===-1)return a;const l=a[n];(p=l.props)==null||delete p.ref;const o=l.props?g(e,l.props):e;e.class&&((v=l.props)!=null&&v.class)&&delete l.props.class;const u=T(l,o);for(const d in o)d.startsWith("on")&&(u.props||(u.props={}),u.props[d]=o[d]);return a.length===1?u:(a[n]=u,a)}}}),ee=["area","img","input"],B=m({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(t,{attrs:e,slots:r}){const a=t.asChild?"template":t.as;return typeof a=="string"&&ee.includes(a)?()=>x(a,e):a!=="template"?()=>x(t.as,e,{default:r.default}):()=>x(Z,e,{default:r.default})}}),te=m({__name:"VisuallyHidden",props:{feature:{default:"focusable"},asChild:{type:Boolean},as:{default:"span"}},setup(t){return(e,r)=>(c(),f(i(B),{as:e.as,"as-child":e.asChild,"aria-hidden":e.feature==="focusable"?"true":void 0,"data-hidden":e.feature==="fully-hidden"?"":void 0,tabindex:e.feature==="fully-hidden"?"-1":void 0,style:{position:"absolute",border:0,width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",wordWrap:"normal"}},{default:y(()=>[w(e.$slots,"default")]),_:3},8,["as","as-child","aria-hidden","data-hidden","tabindex"]))}});function ae(t,e){const r=`${t}Context`,a=Symbol(r);return[o=>{const u=R(a,o);if(u||u===null)return u;throw new Error(`Injection \`${a.toString()}\` not found. Component must be used within ${Array.isArray(t)?`one of the following components: ${t.join(", ")}`:`\`${t}\``}`)},o=>(N(a,o),o)]}function P(){const t=D(),e=$(),r=b(()=>{var o,u;return["#text","#comment"].includes((o=e.value)==null?void 0:o.$el.nodeName)?(u=e.value)==null?void 0:u.$el.nextElementSibling:E(e)}),a=Object.assign({},t.exposed),n={};for(const o in t.props)Object.defineProperty(n,o,{enumerable:!0,configurable:!0,get:()=>t.props[o]});if(Object.keys(a).length>0)for(const o in a)Object.defineProperty(n,o,{enumerable:!0,configurable:!0,get:()=>a[o]});Object.defineProperty(n,"$el",{enumerable:!0,configurable:!0,get:()=>t.vnode.el}),t.exposed=n;function l(o){e.value=o,o&&(Object.defineProperty(n,"$el",{enumerable:!0,configurable:!0,get:()=>o instanceof Element?o:o.$el}),t.exposed=n)}return{forwardRef:l,currentRef:e,currentElement:r}}function ne(){const t=$(),e=b(()=>{var r,a;return["#text","#comment"].includes((r=t.value)==null?void 0:r.$el.nodeName)?(a=t.value)==null?void 0:a.$el.nextElementSibling:E(t)});return{primitiveElement:t,currentElement:e}}function re(t){return b(()=>{var e;return L(t)?!!((e=E(t))!=null&&e.closest("form")):!0})}const j=m({inheritAttrs:!1,__name:"VisuallyHiddenInputBubble",props:{name:{},value:{},checked:{type:Boolean,default:void 0},required:{type:Boolean},disabled:{type:Boolean},feature:{default:"fully-hidden"}},setup(t){const e=t,{primitiveElement:r,currentElement:a}=ne(),n=b(()=>e.checked??e.value);return z(n,(l,o)=>{if(!a.value)return;const u=a.value,p=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(p,"value").set;if(d&&l!==o){const s=new Event("input",{bubbles:!0}),h=new Event("change",{bubbles:!0});d.call(u,l),u.dispatchEvent(s),u.dispatchEvent(h)}}),(l,o)=>(c(),f(te,g({ref_key:"primitiveElement",ref:r},{...e,...l.$attrs},{as:"input"}),null,16))}}),oe=m({inheritAttrs:!1,__name:"VisuallyHiddenInput",props:{name:{},value:{},checked:{type:Boolean,default:void 0},required:{type:Boolean},disabled:{type:Boolean},feature:{default:"fully-hidden"}},setup(t){const e=t,r=b(()=>typeof e.value=="object"&&Array.isArray(e.value)&&e.value.length===0&&e.required),a=b(()=>typeof e.value=="string"||typeof e.value=="number"||typeof e.value=="boolean"?[{name:e.name,value:e.value}]:typeof e.value=="object"&&Array.isArray(e.value)?e.value.flatMap((n,l)=>typeof n=="object"?Object.entries(n).map(([o,u])=>({name:`[${e.name}][${l}][${o}]`,value:u})):{name:`[${e.name}][${l}]`,value:n}):e.value!==null&&typeof e.value=="object"&&!Array.isArray(e.value)?Object.entries(e.value).map(([n,l])=>({name:`[${e.name}][${n}]`,value:l})):[]);return(n,l)=>r.value?(c(),f(j,g({key:n.name},{...e,...n.$attrs},{name:n.name,value:n.value}),null,16,["name","value"])):(c(!0),V(A,{key:1},H(a.value,o=>(c(),f(j,g({key:o.name,ref_for:!0},{...e,...n.$attrs},{name:o.name,value:o.value}),null,16,["name","value"]))),128))}}),[le,se]=ae("SwitchRoot"),ue=m({__name:"SwitchRoot",props:{defaultValue:{type:Boolean},modelValue:{type:[Boolean,null],default:void 0},disabled:{type:Boolean},id:{},value:{default:"on"},asChild:{type:Boolean},as:{default:"button"},name:{},required:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:e}){const r=t,a=e,{disabled:n}=K(r),l=U(r,"modelValue",a,{defaultValue:r.defaultValue,passive:r.modelValue===void 0});function o(){n.value||(l.value=!l.value)}const{forwardRef:u,currentElement:p}=P(),v=re(p),d=b(()=>{var s;return r.id&&p.value?(s=document.querySelector(`[for="${r.id}"]`))==null?void 0:s.innerText:void 0});return se({modelValue:l,toggleCheck:o,disabled:n}),(s,h)=>(c(),f(i(B),g(s.$attrs,{id:s.id,ref:i(u),role:"switch",type:s.as==="button"?"button":void 0,value:s.value,"aria-label":s.$attrs["aria-label"]||d.value,"aria-checked":i(l),"aria-required":s.required,"data-state":i(l)?"checked":"unchecked","data-disabled":i(n)?"":void 0,"as-child":s.asChild,as:s.as,disabled:i(n),onClick:o,onKeydown:Y(G(o,["prevent"]),["enter"])}),{default:y(()=>[w(s.$slots,"default",{modelValue:i(l)}),i(v)&&s.name?(c(),f(i(oe),{key:0,type:"checkbox",name:s.name,disabled:i(n),required:s.required,value:s.value,checked:!!i(l)},null,8,["name","disabled","required","value","checked"])):W("",!0)]),_:3},16,["id","type","value","aria-label","aria-checked","aria-required","data-state","data-disabled","as-child","as","disabled","onKeydown"]))}}),ie=m({__name:"SwitchThumb",props:{asChild:{type:Boolean},as:{default:"span"}},setup(t){const e=le();return P(),(r,a)=>{var n;return c(),f(i(B),{"data-state":(n=i(e).modelValue)!=null&&n.value?"checked":"unchecked","data-disabled":i(e).disabled.value?"":void 0,"as-child":r.asChild,as:r.as},{default:y(()=>[w(r.$slots,"default")]),_:3},8,["data-state","data-disabled","as-child","as"])}}}),de=m({__name:"Checkbox",props:{modelValue:{type:Boolean,required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(t){const e=q(t,"modelValue");return(r,a)=>(c(),f(i(ue),{modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=n=>e.value=n),transition:"background duration-250 ease-in-out",outline:"focus-within:none",flex:"~",border:"neutral-300 dark:neutral-700 data-[state=checked]:primary-200 data-[state=unchecked]:neutral-300 focus-within:neutral-800",bg:"data-[state=checked]:primary-400 data-[state=unchecked]:neutral-300 data-[state=checked]:dark:primary-400/80 dark:data-[state=unchecked]:neutral-800",relative:"","h-7":"",w:"12.5","rounded-full":"",shadow:"sm focus-within:shadow-neutral-800 focus-within:[0_0_0_1px] "},{default:y(()=>[k(i(ie),{"my-auto":"","size-6":"",flex:"","items-center":"","justify-center":"","translate-x":"0.5 data-[state=checked]:full","rounded-full":"","bg-white":"","text-xs":"","shadow-xl":"",transition:"transform duration-250 ease-in-out","will-change-transform":""})]),_:1},8,["modelValue"]))}}),ce={flex:"~ col gap-4"},me={flex:"~ row","items-center":"","gap-2":""},pe={flex:"1"},fe={class:"flex items-center gap-1 text-sm font-medium"},ve={class:"text-xs text-neutral-500 dark:text-neutral-400"},ke=m({__name:"FieldCheckbox",props:X({label:null,description:null},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=t,r=q(t,"modelValue");return(a,n)=>(c(),V("label",ce,[_("div",me,[_("div",pe,[_("div",fe,M(e.label),1),_("div",ve,M(e.description),1)]),k(de,{modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=l=>r.value=l)},null,8,["modelValue"])])]))}}),he=m({__name:"Volumed",props:{perspective:null,transform:null},setup(t){return(e,r)=>(c(),V("div",{class:"volumed",style:S({perspective:`${t.perspective}px`,transform:t.transform})},[w(e.$slots,"default",{},void 0,!0)],4))}}),be=F(he,[["__scopeId","data-v-568551bc"]]),ye=m({__name:"CursorMomentum",props:{baseSpeed:{default:.1},friction:{default:.95},momentumFactor:{default:.005}},setup(t,{expose:e}){const r=t,a=$(1),n=$(0);let l=0;const o=C(()=>r.friction),u=C(()=>r.baseSpeed),p=C(()=>r.momentumFactor);function v(s){l||(l=s);const h=s-l;l=s,a.value=u.value+(a.value-u.value)*o.value,n.value+=a.value*h,requestAnimationFrame(v)}function d(s){const h=Math.sqrt(s.movementX**2+s.movementY**2);a.value+=h*p.value}return J(()=>{window.addEventListener("mousemove",d),requestAnimationFrame(v)}),Q(()=>{window.removeEventListener("mousemove",d)}),e({momentum:a,currentValue:n}),(s,h)=>w(s.$slots,"default",{momentum:a.value,currentValue:n.value})}}),_e=m({__name:"TestDummyMarkerFlat",props:{size:null},setup(t){return(e,r)=>(c(),V("div",{class:"test-dummy-flat",style:S({width:`${t.size}px`,height:`${t.size}px`})},r[0]||(r[0]=[_("div",{class:"marker"},null,-1)]),4))}}),ge=F(_e,[["__scopeId","data-v-b4ef37ac"]]),Ve=m({__name:"TestDummyMarker",setup(t){return(e,r)=>(c(),f(ye,{"base-speed":.1,friction:.95,"momentum-factor":5e-4},{default:y(({currentValue:a})=>[k(be,{perspective:800,transform:"rotateX(45deg) translateY(3px)"},{default:y(()=>[k(ge,{size:24,style:S({transform:`rotate(${a}deg)`})},null,8,["style"])]),_:2},1024)]),_:1}))}});export{ke as _,Ve as a}; diff --git a/assets/TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js b/assets/TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js deleted file mode 100644 index 30f1e5b967cb9d5fbcd191fda69179aa3e6f0d53..0000000000000000000000000000000000000000 --- a/assets/TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js +++ /dev/null @@ -1 +0,0 @@ -import{bx as A,d as m,c3 as I,bW as g,c4 as T,c0 as x,x as f,o as c,y,m as w,u as i,b$ as R,cd as N,g as $,h as b,cp as E,bY as D,cq as L,w as z,c as V,by as H,E as K,cr as U,C as W,cs as Y,bM as G,bJ as q,b as k,bI as X,a as _,D as M,n as S,bn as F,br as C,l as J,H as Q}from"./index-20XXNHAB.js";function O(t){return t?t.flatMap(e=>e.type===A?O(e.children):[e]):[]}const Z=m({name:"PrimitiveSlot",inheritAttrs:!1,setup(t,{attrs:e,slots:r}){return()=>{var p,v;if(!r.default)return null;const a=O(r.default()),n=a.findIndex(d=>d.type!==I);if(n===-1)return a;const l=a[n];(p=l.props)==null||delete p.ref;const o=l.props?g(e,l.props):e;e.class&&((v=l.props)!=null&&v.class)&&delete l.props.class;const u=T(l,o);for(const d in o)d.startsWith("on")&&(u.props||(u.props={}),u.props[d]=o[d]);return a.length===1?u:(a[n]=u,a)}}}),ee=["area","img","input"],B=m({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(t,{attrs:e,slots:r}){const a=t.asChild?"template":t.as;return typeof a=="string"&&ee.includes(a)?()=>x(a,e):a!=="template"?()=>x(t.as,e,{default:r.default}):()=>x(Z,e,{default:r.default})}}),te=m({__name:"VisuallyHidden",props:{feature:{default:"focusable"},asChild:{type:Boolean},as:{default:"span"}},setup(t){return(e,r)=>(c(),f(i(B),{as:e.as,"as-child":e.asChild,"aria-hidden":e.feature==="focusable"?"true":void 0,"data-hidden":e.feature==="fully-hidden"?"":void 0,tabindex:e.feature==="fully-hidden"?"-1":void 0,style:{position:"absolute",border:0,width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",wordWrap:"normal"}},{default:y(()=>[w(e.$slots,"default")]),_:3},8,["as","as-child","aria-hidden","data-hidden","tabindex"]))}});function ae(t,e){const r=`${t}Context`,a=Symbol(r);return[o=>{const u=R(a,o);if(u||u===null)return u;throw new Error(`Injection \`${a.toString()}\` not found. Component must be used within ${Array.isArray(t)?`one of the following components: ${t.join(", ")}`:`\`${t}\``}`)},o=>(N(a,o),o)]}function P(){const t=D(),e=$(),r=b(()=>{var o,u;return["#text","#comment"].includes((o=e.value)==null?void 0:o.$el.nodeName)?(u=e.value)==null?void 0:u.$el.nextElementSibling:E(e)}),a=Object.assign({},t.exposed),n={};for(const o in t.props)Object.defineProperty(n,o,{enumerable:!0,configurable:!0,get:()=>t.props[o]});if(Object.keys(a).length>0)for(const o in a)Object.defineProperty(n,o,{enumerable:!0,configurable:!0,get:()=>a[o]});Object.defineProperty(n,"$el",{enumerable:!0,configurable:!0,get:()=>t.vnode.el}),t.exposed=n;function l(o){e.value=o,o&&(Object.defineProperty(n,"$el",{enumerable:!0,configurable:!0,get:()=>o instanceof Element?o:o.$el}),t.exposed=n)}return{forwardRef:l,currentRef:e,currentElement:r}}function ne(){const t=$(),e=b(()=>{var r,a;return["#text","#comment"].includes((r=t.value)==null?void 0:r.$el.nodeName)?(a=t.value)==null?void 0:a.$el.nextElementSibling:E(t)});return{primitiveElement:t,currentElement:e}}function re(t){return b(()=>{var e;return L(t)?!!((e=E(t))!=null&&e.closest("form")):!0})}const j=m({inheritAttrs:!1,__name:"VisuallyHiddenInputBubble",props:{name:{},value:{},checked:{type:Boolean,default:void 0},required:{type:Boolean},disabled:{type:Boolean},feature:{default:"fully-hidden"}},setup(t){const e=t,{primitiveElement:r,currentElement:a}=ne(),n=b(()=>e.checked??e.value);return z(n,(l,o)=>{if(!a.value)return;const u=a.value,p=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(p,"value").set;if(d&&l!==o){const s=new Event("input",{bubbles:!0}),h=new Event("change",{bubbles:!0});d.call(u,l),u.dispatchEvent(s),u.dispatchEvent(h)}}),(l,o)=>(c(),f(te,g({ref_key:"primitiveElement",ref:r},{...e,...l.$attrs},{as:"input"}),null,16))}}),oe=m({inheritAttrs:!1,__name:"VisuallyHiddenInput",props:{name:{},value:{},checked:{type:Boolean,default:void 0},required:{type:Boolean},disabled:{type:Boolean},feature:{default:"fully-hidden"}},setup(t){const e=t,r=b(()=>typeof e.value=="object"&&Array.isArray(e.value)&&e.value.length===0&&e.required),a=b(()=>typeof e.value=="string"||typeof e.value=="number"||typeof e.value=="boolean"?[{name:e.name,value:e.value}]:typeof e.value=="object"&&Array.isArray(e.value)?e.value.flatMap((n,l)=>typeof n=="object"?Object.entries(n).map(([o,u])=>({name:`[${e.name}][${l}][${o}]`,value:u})):{name:`[${e.name}][${l}]`,value:n}):e.value!==null&&typeof e.value=="object"&&!Array.isArray(e.value)?Object.entries(e.value).map(([n,l])=>({name:`[${e.name}][${n}]`,value:l})):[]);return(n,l)=>r.value?(c(),f(j,g({key:n.name},{...e,...n.$attrs},{name:n.name,value:n.value}),null,16,["name","value"])):(c(!0),V(A,{key:1},H(a.value,o=>(c(),f(j,g({key:o.name,ref_for:!0},{...e,...n.$attrs},{name:o.name,value:o.value}),null,16,["name","value"]))),128))}}),[le,se]=ae("SwitchRoot"),ue=m({__name:"SwitchRoot",props:{defaultValue:{type:Boolean},modelValue:{type:[Boolean,null],default:void 0},disabled:{type:Boolean},id:{},value:{default:"on"},asChild:{type:Boolean},as:{default:"button"},name:{},required:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:e}){const r=t,a=e,{disabled:n}=K(r),l=U(r,"modelValue",a,{defaultValue:r.defaultValue,passive:r.modelValue===void 0});function o(){n.value||(l.value=!l.value)}const{forwardRef:u,currentElement:p}=P(),v=re(p),d=b(()=>{var s;return r.id&&p.value?(s=document.querySelector(`[for="${r.id}"]`))==null?void 0:s.innerText:void 0});return se({modelValue:l,toggleCheck:o,disabled:n}),(s,h)=>(c(),f(i(B),g(s.$attrs,{id:s.id,ref:i(u),role:"switch",type:s.as==="button"?"button":void 0,value:s.value,"aria-label":s.$attrs["aria-label"]||d.value,"aria-checked":i(l),"aria-required":s.required,"data-state":i(l)?"checked":"unchecked","data-disabled":i(n)?"":void 0,"as-child":s.asChild,as:s.as,disabled:i(n),onClick:o,onKeydown:Y(G(o,["prevent"]),["enter"])}),{default:y(()=>[w(s.$slots,"default",{modelValue:i(l)}),i(v)&&s.name?(c(),f(i(oe),{key:0,type:"checkbox",name:s.name,disabled:i(n),required:s.required,value:s.value,checked:!!i(l)},null,8,["name","disabled","required","value","checked"])):W("",!0)]),_:3},16,["id","type","value","aria-label","aria-checked","aria-required","data-state","data-disabled","as-child","as","disabled","onKeydown"]))}}),ie=m({__name:"SwitchThumb",props:{asChild:{type:Boolean},as:{default:"span"}},setup(t){const e=le();return P(),(r,a)=>{var n;return c(),f(i(B),{"data-state":(n=i(e).modelValue)!=null&&n.value?"checked":"unchecked","data-disabled":i(e).disabled.value?"":void 0,"as-child":r.asChild,as:r.as},{default:y(()=>[w(r.$slots,"default")]),_:3},8,["data-state","data-disabled","as-child","as"])}}}),de=m({__name:"Checkbox",props:{modelValue:{type:Boolean,required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(t){const e=q(t,"modelValue");return(r,a)=>(c(),f(i(ue),{modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=n=>e.value=n),transition:"background duration-250 ease-in-out",outline:"focus-within:none",flex:"~",border:"neutral-300 dark:neutral-700 data-[state=checked]:primary-200 data-[state=unchecked]:neutral-300 focus-within:neutral-800",bg:"data-[state=checked]:primary-400 data-[state=unchecked]:neutral-300 data-[state=checked]:dark:primary-400/80 dark:data-[state=unchecked]:neutral-800",relative:"","h-7":"",w:"12.5","rounded-full":"",shadow:"sm focus-within:shadow-neutral-800 focus-within:[0_0_0_1px] "},{default:y(()=>[k(i(ie),{"my-auto":"","size-6":"",flex:"","items-center":"","justify-center":"","translate-x":"0.5 data-[state=checked]:full","rounded-full":"","bg-white":"","text-xs":"","shadow-xl":"",transition:"transform duration-250 ease-in-out","will-change-transform":""})]),_:1},8,["modelValue"]))}}),ce={flex:"~ col gap-4"},me={flex:"~ row","items-center":"","gap-2":""},pe={flex:"1"},fe={class:"flex items-center gap-1 text-sm font-medium"},ve={class:"text-xs text-neutral-500 dark:text-neutral-400"},$e=m({__name:"FieldCheckbox",props:X({label:null,description:null},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const e=t,r=q(t,"modelValue");return(a,n)=>(c(),V("label",ce,[_("div",me,[_("div",pe,[_("div",fe,M(e.label),1),_("div",ve,M(e.description),1)]),k(de,{modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=l=>r.value=l)},null,8,["modelValue"])])]))}}),he=m({__name:"Volumed",props:{perspective:null,transform:null},setup(t){return(e,r)=>(c(),V("div",{class:"volumed",style:S({perspective:`${t.perspective}px`,transform:t.transform})},[w(e.$slots,"default",{},void 0,!0)],4))}}),be=F(he,[["__scopeId","data-v-568551bc"]]),ye=m({__name:"CursorMomentum",props:{baseSpeed:{default:.1},friction:{default:.95},momentumFactor:{default:.005}},setup(t,{expose:e}){const r=t,a=$(1),n=$(0);let l=0;const o=C(()=>r.friction),u=C(()=>r.baseSpeed),p=C(()=>r.momentumFactor);function v(s){l||(l=s);const h=s-l;l=s,a.value=u.value+(a.value-u.value)*o.value,n.value+=a.value*h,requestAnimationFrame(v)}function d(s){const h=Math.sqrt(s.movementX**2+s.movementY**2);a.value+=h*p.value}return J(()=>{window.addEventListener("mousemove",d),requestAnimationFrame(v)}),Q(()=>{window.removeEventListener("mousemove",d)}),e({momentum:a,currentValue:n}),(s,h)=>w(s.$slots,"default",{momentum:a.value,currentValue:n.value})}}),_e=m({__name:"TestDummyMarkerFlat",props:{size:null},setup(t){return(e,r)=>(c(),V("div",{class:"test-dummy-flat",style:S({width:`${t.size}px`,height:`${t.size}px`})},r[0]||(r[0]=[_("div",{class:"marker"},null,-1)]),4))}}),ge=F(_e,[["__scopeId","data-v-b4ef37ac"]]),ke=m({__name:"TestDummyMarker",setup(t){return(e,r)=>(c(),f(ye,{"base-speed":.1,friction:.95,"momentum-factor":5e-4},{default:y(({currentValue:a})=>[k(be,{perspective:800,transform:"rotateX(45deg) translateY(3px)"},{default:y(()=>[k(ge,{size:24,style:S({transform:`rotate(${a}deg)`})},null,8,["style"])]),_:2},1024)]),_:1}))}});export{$e as _,ke as a}; diff --git a/assets/Textarea.vue_vue_type_script_setup_true_lang-BPvpJbgL.js b/assets/Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js similarity index 71% rename from assets/Textarea.vue_vue_type_script_setup_true_lang-BPvpJbgL.js rename to assets/Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js index 6f58d8556a95943ef093e4cf08075f838213de71..0ac3ecaecd10250fcd346234d67222ec84b045c1 100644 --- a/assets/Textarea.vue_vue_type_script_setup_true_lang-BPvpJbgL.js +++ b/assets/Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js @@ -1 +1 @@ -import{_ as u}from"./Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js";import{d as t,bJ as r,x as n,o as d}from"./index-20XXNHAB.js";const p=t({__name:"Textarea",props:{modelValue:{default:""},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=r(o,"modelValue");return(s,a)=>(d(),n(u,{modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=l=>e.value=l),border:"neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700",transition:"all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900","rounded-lg":"","px-3":"","py-2":"","text-sm":"","outline-none":""},null,8,["modelValue"]))}});export{p as _}; +import{_ as u}from"./Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js";import{d as t,bJ as r,x as n,o as d}from"./index-D8Nm21zW.js";const p=t({__name:"Textarea",props:{modelValue:{default:""},modelModifiers:{}},emits:["update:modelValue"],setup(o){const e=r(o,"modelValue");return(s,a)=>(d(),n(u,{modelValue:e.value,"onUpdate:modelValue":a[0]||(a[0]=l=>e.value=l),border:"neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700",transition:"all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900","rounded-lg":"","px-3":"","py-2":"","text-sm":"","outline-none":""},null,8,["modelValue"]))}});export{p as _}; diff --git a/assets/TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js b/assets/TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js similarity index 93% rename from assets/TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js rename to assets/TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js index fd8f4530b248575b8b174c7667587d8bb54edf23..a09670422d5929a16a56beb8fa4618446a0efe8e 100644 --- a/assets/TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js +++ b/assets/TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js @@ -1 +1 @@ -import{d as m,x as T,o as l,bB as B,y as b,m as v}from"./index-20XXNHAB.js";const n="0px",W=m({__name:"TransitionVertical",props:{duration:{default:250},easingEnter:{default:"ease-in-out"},easingLeave:{default:"ease-in-out"},opacityClosed:{default:0},opacityOpened:{default:1}},setup(c){const r=c;function p(o){return{height:o.style.height,width:o.style.width,position:o.style.position,visibility:o.style.visibility,overflow:o.style.overflow,paddingTop:o.style.paddingTop,paddingBottom:o.style.paddingBottom,borderTopWidth:o.style.borderTopWidth,borderBottomWidth:o.style.borderBottomWidth,marginTop:o.style.marginTop,marginBottom:o.style.marginBottom}}function y(o,t){const{width:i}=getComputedStyle(o);o.style.width=i,o.style.position="absolute",o.style.visibility="hidden",o.style.height="";const{height:s}=getComputedStyle(o);return o.style.width=t.width,o.style.position=t.position,o.style.visibility=t.visibility,o.style.height=n,o.style.overflow="hidden",t.height&&t.height!==n?t.height:s}function h(o,t,i,s,d){const e=o.animate(s,d);o.style.height=t.height,e.onfinish=()=>{o.style.overflow=t.overflow,i()}}function g(o,t){return[{height:n,opacity:r.opacityClosed,paddingTop:n,paddingBottom:n,borderTopWidth:n,borderBottomWidth:n,marginTop:n,marginBottom:n},{height:o,opacity:r.opacityOpened,paddingTop:t.paddingTop,paddingBottom:t.paddingBottom,borderTopWidth:t.borderTopWidth,borderBottomWidth:t.borderBottomWidth,marginTop:t.marginTop,marginBottom:t.marginBottom}]}function u(o,t){const i=o,s=p(i),d=y(i,s),e=g(d,s),a={duration:r.duration,easing:r.easingEnter};h(i,s,t,e,a)}function f(o,t){const i=o,s=p(i),{height:d}=getComputedStyle(i);i.style.height=d,i.style.overflow="hidden";const e=g(d,s).reverse(),a={duration:r.duration,easing:r.easingLeave};h(i,s,t,e,a)}return(o,t)=>(l(),T(B,{css:!1,onEnter:u,onLeave:f},{default:b(()=>[v(o.$slots,"default")]),_:3}))}});export{W as _}; +import{d as m,x as T,o as l,bB as B,y as b,m as v}from"./index-D8Nm21zW.js";const n="0px",W=m({__name:"TransitionVertical",props:{duration:{default:250},easingEnter:{default:"ease-in-out"},easingLeave:{default:"ease-in-out"},opacityClosed:{default:0},opacityOpened:{default:1}},setup(c){const r=c;function p(o){return{height:o.style.height,width:o.style.width,position:o.style.position,visibility:o.style.visibility,overflow:o.style.overflow,paddingTop:o.style.paddingTop,paddingBottom:o.style.paddingBottom,borderTopWidth:o.style.borderTopWidth,borderBottomWidth:o.style.borderBottomWidth,marginTop:o.style.marginTop,marginBottom:o.style.marginBottom}}function y(o,t){const{width:i}=getComputedStyle(o);o.style.width=i,o.style.position="absolute",o.style.visibility="hidden",o.style.height="";const{height:s}=getComputedStyle(o);return o.style.width=t.width,o.style.position=t.position,o.style.visibility=t.visibility,o.style.height=n,o.style.overflow="hidden",t.height&&t.height!==n?t.height:s}function h(o,t,i,s,d){const e=o.animate(s,d);o.style.height=t.height,e.onfinish=()=>{o.style.overflow=t.overflow,i()}}function g(o,t){return[{height:n,opacity:r.opacityClosed,paddingTop:n,paddingBottom:n,borderTopWidth:n,borderBottomWidth:n,marginTop:n,marginBottom:n},{height:o,opacity:r.opacityOpened,paddingTop:t.paddingTop,paddingBottom:t.paddingBottom,borderTopWidth:t.borderTopWidth,borderBottomWidth:t.borderBottomWidth,marginTop:t.marginTop,marginBottom:t.marginBottom}]}function u(o,t){const i=o,s=p(i),d=y(i,s),e=g(d,s),a={duration:r.duration,easing:r.easingEnter};h(i,s,t,e,a)}function f(o,t){const i=o,s=p(i),{height:d}=getComputedStyle(i);i.style.height=d,i.style.overflow="hidden";const e=g(d,s).reverse(),a={duration:r.duration,easing:r.easingLeave};h(i,s,t,e,a)}return(o,t)=>(l(),T(B,{css:!1,onEnter:u,onLeave:f},{default:b(()=>[v(o.$slots,"default")]),_:3}))}});export{W as _}; diff --git a/assets/_...all_-UwSaXocp.js b/assets/_...all_-D8yjOAQK.js similarity index 64% rename from assets/_...all_-UwSaXocp.js rename to assets/_...all_-D8yjOAQK.js index 5845899f29ea117349078145eaaef598f072cf4d..9f84c20eb6ae0acb27d1792b2a535ebceaa2ee24 100644 --- a/assets/_...all_-UwSaXocp.js +++ b/assets/_...all_-D8yjOAQK.js @@ -1 +1 @@ -import{bn as e,c as n,o as c}from"./index-20XXNHAB.js";const o={};function _(t,r){return c(),n("div",null," 404 - Page not found ")}const s=e(o,[["render",_]]);export{s as default}; +import{bn as e,c as n,o as c}from"./index-D8Nm21zW.js";const o={};function _(t,r){return c(),n("div",null," 404 - Page not found ")}const s=e(o,[["render",_]]);export{s as default}; diff --git a/assets/airi-card-DmHEm3BO.js b/assets/airi-card-DeGSbHPj.js similarity index 91% rename from assets/airi-card-DmHEm3BO.js rename to assets/airi-card-DeGSbHPj.js index e3e050e064bc64c7f0fc3caed9c1de412db0c49a..7fcae970f5f2fb615ed8b2cf5bc8b06a212b5649 100644 --- a/assets/airi-card-DmHEm3BO.js +++ b/assets/airi-card-DeGSbHPj.js @@ -1,4 +1,4 @@ -import{f as W,bD as L,h as g,s as O,l as $,q as b,w as q}from"./index-20XXNHAB.js";import{j as G}from"./live2d-zip-loader-52aPyiCh.js";import{u as H}from"./consciousness-D04GkOp_.js";import{u as N}from"./speech-CF8Au8j4.js";function k(a,u){return{role:"system",content:[a,G.map(n=>`- ${n}`).join(` +import{f as W,bD as L,h as g,s as O,l as $,q as b,w as q}from"./index-D8Nm21zW.js";import{j as G}from"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{u as H}from"./consciousness-CgTB9b9w.js";import{u as N}from"./speech-B27BwGQ-.js";function k(a,u){return{role:"system",content:[a,G.map(n=>`- ${n}`).join(` `),u].join(` `)}}const Q=W("airi-card",()=>{const a=L("airi-cards",new Map),u=L("airi-card-active-id","default"),n=g(()=>a.value.get(u.value)),P=H(),R=N(),{activeModel:l}=O(P),{activeSpeechVoiceId:m,activeSpeechModel:p}=O(R),B=s=>{const e=crypto.randomUUID();return a.value.set(e,h(s)),e},D=s=>{a.value.delete(s)},V=s=>a.value.get(s);function v(s){var t,r,i,c,d,f,_,y,S,x,C,M,I,w,E,A,j,T,U;const e="data"in s?(r=(t=s.data)==null?void 0:t.extensions)==null?void 0:r.airi:(i=s.extensions)==null?void 0:i.airi,o={consciousness:{model:l.value},speech:{model:p.value,voice_id:m.value}};return e?{modules:{consciousness:{model:((d=(c=e.modules)==null?void 0:c.consciousness)==null?void 0:d.model)??o.consciousness.model},speech:{model:((_=(f=e.modules)==null?void 0:f.speech)==null?void 0:_.model)??o.speech.model,voice_id:((S=(y=e.modules)==null?void 0:y.speech)==null?void 0:S.voice_id)??o.speech.voice_id,pitch:(C=(x=e.modules)==null?void 0:x.speech)==null?void 0:C.pitch,rate:(I=(M=e.modules)==null?void 0:M.speech)==null?void 0:I.rate,ssml:(E=(w=e.modules)==null?void 0:w.speech)==null?void 0:E.ssml,language:(j=(A=e.modules)==null?void 0:A.speech)==null?void 0:j.language},vrm:(T=e.modules)==null?void 0:T.vrm,live2d:(U=e.modules)==null?void 0:U.live2d},agents:e.agents??{}}:{modules:o,agents:{}}}function h(s){if("data"in s){const e=s;return{name:e.data.name,version:e.data.character_version??"1.0.0",description:e.data.description??"",creator:e.data.creator??"",notes:e.data.creator_notes??"",notesMultilingual:e.data.creator_notes_multilingual,personality:e.data.personality??"",scenario:e.data.scenario??"",greetings:[e.data.first_mes,...e.data.alternate_greetings??[]],greetingsGroupOnly:e.data.group_only_greetings??[],systemPrompt:e.data.system_prompt??"",postHistoryInstructions:e.data.post_history_instructions??"",messageExample:e.data.mes_example?e.data.mes_example.split(` diff --git a/assets/alibaba-cloud-model-studio-BPTuNUid.js b/assets/alibaba-cloud-model-studio-BPTuNUid.js new file mode 100644 index 0000000000000000000000000000000000000000..564c7c8b1e4fec684de54690d378cacf5ce59ea6 --- /dev/null +++ b/assets/alibaba-cloud-model-studio-BPTuNUid.js @@ -0,0 +1 @@ +import{_ as m}from"./FieldRange.vue_vue_type_script_setup_true_lang-B670Jjy-.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as M,g as u,s as S,q as F,h as V,l as $,w as v,x as k,o as B,y as h,b as c,u as i,a as I}from"./index-D8Nm21zW.js";import{u as U}from"./providers-DUDq6kdm.js";import{u as E}from"./speech-B27BwGQ-.js";import{_ as K,a as L}from"./SpeechProviderSettings.vue_vue_type_script_setup_true_lang-Cscdqs1L.js";import"./index-Be1NqeGb.js";import"./TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js";import"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const N={flex:"~ col gap-4"},o="alibaba-cloud-model-studio",y="cosyvoice-v1",oe=M({__name:"alibaba-cloud-model-studio",setup(T){const f={speed:1},d=u(0),l=u(1),n=u(0),p=E(),a=U(),{providers:g}=S(a),{t:s}=F(),P=V(()=>{var e;return!!((e=g.value[o])!=null&&e.apiKey)}),_=V(()=>p.availableVoices[o]||[]);async function w(e,r,t){const b=a.getProviderInstance(o);if(!b)throw new Error("Failed to initialize speech provider");const C=a.getProviderConfig(o),x=C.model||y;return await p.speech(b,x,e,r,{...C,...f})}return $(async()=>{const e=a.getProviderConfig(o);await a.getProviderMetadata(o).validators.validateProviderConfig(e)?await p.loadVoicesForProvider(o):console.error("Failed to validate provider config",e)}),v(d,async()=>{const e=a.getProviderConfig(o);e.pitch=d.value}),v(l,async()=>{const e=a.getProviderConfig(o);e.speed=l.value}),v(n,async()=>{const e=a.getProviderConfig(o);e.volume=n.value}),v(g,async()=>{const e=a.getProviderConfig(o);await a.getProviderMetadata(o).validators.validateProviderConfig(e)?await p.loadVoicesForProvider(o):console.error("Failed to validate provider config",e)},{immediate:!0}),(e,r)=>(B(),k(i(L),{"provider-id":o,"default-model":y,"additional-settings":f},{"voice-settings":h(()=>[I("div",N,[c(i(m),{modelValue:d.value,"onUpdate:modelValue":r[0]||(r[0]=t=>d.value=t),label:i(s)("settings.pages.providers.provider.common.fields.field.pitch.label"),description:i(s)("settings.pages.providers.provider.common.fields.field.pitch.description"),min:-100,max:100,step:1,"format-value":t=>`${t}%`},null,8,["modelValue","label","description","format-value"]),c(i(m),{modelValue:l.value,"onUpdate:modelValue":r[1]||(r[1]=t=>l.value=t),label:i(s)("settings.pages.providers.provider.common.fields.field.speed.label"),description:i(s)("settings.pages.providers.provider.common.fields.field.speed.description"),min:.5,max:2,step:.01},null,8,["modelValue","label","description"]),c(i(m),{modelValue:n.value,"onUpdate:modelValue":r[2]||(r[2]=t=>n.value=t),label:i(s)("settings.pages.providers.provider.common.fields.field.volume.label"),description:i(s)("settings.pages.providers.provider.common.fields.field.volume.description"),min:-100,max:100,step:1,"format-value":t=>`${t}%`},null,8,["modelValue","label","description","format-value"])])]),playground:h(()=>[c(i(K),{"available-voices":_.value,"generate-speech":w,"api-key-configured":P.value,"default-text":"Hello! This is a test of the ElevenLabs voice synthesis."},null,8,["available-voices","api-key-configured"])]),_:1}))}});export{oe as default}; diff --git a/assets/alibaba-cloud-model-studio-PH9TE4P8.js b/assets/alibaba-cloud-model-studio-PH9TE4P8.js deleted file mode 100644 index a759e4a1468c4723e73ec32bbff6d7bc6460151d..0000000000000000000000000000000000000000 --- a/assets/alibaba-cloud-model-studio-PH9TE4P8.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as m}from"./FieldRange.vue_vue_type_script_setup_true_lang-BtFz1_fe.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as M,g as u,s as S,q as F,h as V,l as $,w as v,x as k,o as B,y as h,b as c,u as i,a as I}from"./index-20XXNHAB.js";import{u as U}from"./providers-BqZLRXH1.js";import{u as E}from"./speech-CF8Au8j4.js";import{_ as K,a as L}from"./SpeechProviderSettings.vue_vue_type_script_setup_true_lang-B6yYYFHK.js";import"./index-Be1NqeGb.js";import"./TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js";import"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const N={flex:"~ col gap-4"},o="alibaba-cloud-model-studio",y="cosyvoice-v1",oe=M({__name:"alibaba-cloud-model-studio",setup(T){const f={speed:1},d=u(0),l=u(1),n=u(0),p=E(),a=U(),{providers:g}=S(a),{t:s}=F(),P=V(()=>{var e;return!!((e=g.value[o])!=null&&e.apiKey)}),_=V(()=>p.availableVoices[o]||[]);async function w(e,r,t){const b=a.getProviderInstance(o);if(!b)throw new Error("Failed to initialize speech provider");const C=a.getProviderConfig(o),x=C.model||y;return await p.speech(b,x,e,r,{...C,...f})}return $(async()=>{const e=a.getProviderConfig(o);await a.getProviderMetadata(o).validators.validateProviderConfig(e)?await p.loadVoicesForProvider(o):console.error("Failed to validate provider config",e)}),v(d,async()=>{const e=a.getProviderConfig(o);e.pitch=d.value}),v(l,async()=>{const e=a.getProviderConfig(o);e.speed=l.value}),v(n,async()=>{const e=a.getProviderConfig(o);e.volume=n.value}),v(g,async()=>{const e=a.getProviderConfig(o);await a.getProviderMetadata(o).validators.validateProviderConfig(e)?await p.loadVoicesForProvider(o):console.error("Failed to validate provider config",e)},{immediate:!0}),(e,r)=>(B(),k(i(L),{"provider-id":o,"default-model":y,"additional-settings":f},{"voice-settings":h(()=>[I("div",N,[c(i(m),{modelValue:d.value,"onUpdate:modelValue":r[0]||(r[0]=t=>d.value=t),label:i(s)("settings.pages.providers.provider.common.fields.field.pitch.label"),description:i(s)("settings.pages.providers.provider.common.fields.field.pitch.description"),min:-100,max:100,step:1,"format-value":t=>`${t}%`},null,8,["modelValue","label","description","format-value"]),c(i(m),{modelValue:l.value,"onUpdate:modelValue":r[1]||(r[1]=t=>l.value=t),label:i(s)("settings.pages.providers.provider.common.fields.field.speed.label"),description:i(s)("settings.pages.providers.provider.common.fields.field.speed.description"),min:.5,max:2,step:.01},null,8,["modelValue","label","description"]),c(i(m),{modelValue:n.value,"onUpdate:modelValue":r[2]||(r[2]=t=>n.value=t),label:i(s)("settings.pages.providers.provider.common.fields.field.volume.label"),description:i(s)("settings.pages.providers.provider.common.fields.field.volume.description"),min:-100,max:100,step:1,"format-value":t=>`${t}%`},null,8,["modelValue","label","description","format-value"])])]),playground:h(()=>[c(i(K),{"available-voices":_.value,"generate-speech":w,"api-key-configured":P.value,"default-text":"Hello! This is a test of the ElevenLabs voice synthesis."},null,8,["available-voices","api-key-configured"])]),_:1}))}});export{oe as default}; diff --git a/assets/anthropic-BLDeI_4x.js b/assets/anthropic-BLDeI_4x.js deleted file mode 100644 index cbc6e04ba9e39baa0b3cfceafc2c966ccdd1216c..0000000000000000000000000000000000000000 --- a/assets/anthropic-BLDeI_4x.js +++ /dev/null @@ -1 +0,0 @@ -import{d as k,q as x,bG as S,s as U,h as v,l as w,w as V,x as C,o as K,y as u,a as i,b as l,bL as p,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as R}from"./providers-BqZLRXH1.js";import{_ as O,a as $}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as A}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as I,a as N}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as B}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const e="anthropic",Q=k({__name:"anthropic",setup(T){const{t:c}=x(),_=S(),h=R(),{providers:a}=U(h),m=v(()=>h.getProviderMetadata(e)),s=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.apiKey)||""},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].apiKey=o}}),n=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.baseUrl)||"https://api.anthropic.com/v1/"},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].baseUrl=o}});w(()=>{var o,r;a.value[e]||(a.value[e]={baseUrl:"https://api.anthropic.com/v1/"}),s.value=((o=a.value[e])==null?void 0:o.apiKey)||"",n.value=((r=a.value[e])==null?void 0:r.baseUrl)||"https://api.anthropic.com/v1/"}),V([s,n],()=>{a.value[e]={...a.value[e],apiKey:s.value,baseUrl:n.value||"https://api.anthropic.com/v1/"}});function g(){a.value[e]={baseUrl:"https://api.anthropic.com/v1/"}}return(o,r)=>{var f,b;return K(),C(t(B),{"provider-name":((f=m.value)==null?void 0:f.localizedName)||"Anthropic | Claude","provider-icon":(b=m.value)==null?void 0:b.icon,"on-back":()=>t(_).back()},{default:u(()=>[r[2]||(r[2]=i("div",{bg:"orange-50 dark:orange-900/20","rounded-xl":"","p-4":"",flex:"~ col gap-3"},[i("h2",{"text-xl":"","font-bold":"",text:"orange-700 dark:orange-500"}," Before you start "),i("p",null,[p(" While Anthropic recently did announce that they are having a beta support for OpenAI SDK compatibility "),i("a",{underline:"",href:"https://docs.anthropic.com/en/api/openai-sdk"},"(you can read more here)"),p(", but due to the implementation details comes with "),i("a",{underline:"",href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS"},"CORS"),p(" restrictions which not aligned with the OpenAI SDK, it's currently not possible to use this provider in the browser. ")]),i("p",null,[p(" If you do need to use this provider, you will need a dedicated proxy backend like a Serverless Function running on "),i("a",{underline:"",href:"https://workers.cloudflare.com/"},"Cloudflare Workers"),p(" or some CORS bypassing services to bypass the CORS restrictions. ")])],-1)),l(t(I),null,{default:u(()=>[l(t(N),{title:t(c)("settings.pages.providers.common.section.basic.title"),description:t(c)("settings.pages.providers.common.section.basic.description"),"on-reset":g},{default:u(()=>{var d;return[l(t(A),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=y=>s.value=y),"provider-name":((d=m.value)==null?void 0:d.localizedName)||"Anthropic",placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(O),{title:t(c)("settings.pages.providers.common.section.advanced.title")},{default:u(()=>[l(t($),{modelValue:n.value,"onUpdate:modelValue":r[1]||(r[1]=d=>n.value=d),placeholder:"https://api.anthropic.com/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{Q as default}; diff --git a/assets/anthropic-BVw1aKkH.js b/assets/anthropic-BVw1aKkH.js new file mode 100644 index 0000000000000000000000000000000000000000..acdd960e1b72f793ea5f869e10854e1c2fab0ead --- /dev/null +++ b/assets/anthropic-BVw1aKkH.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as k,q as x,bG as S,s as U,h as v,l as w,w as V,x as C,o as K,y as u,a as i,b as l,bL as p,u as t}from"./index-D8Nm21zW.js";import{u as R}from"./providers-DUDq6kdm.js";import{_ as O,a as $}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as A}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as I,a as N}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as B}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const e="anthropic",Q=k({__name:"anthropic",setup(T){const{t:c}=x(),_=S(),h=R(),{providers:a}=U(h),m=v(()=>h.getProviderMetadata(e)),s=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.apiKey)||""},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].apiKey=o}}),n=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.baseUrl)||"https://api.anthropic.com/v1/"},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].baseUrl=o}});w(()=>{var o,r;a.value[e]||(a.value[e]={baseUrl:"https://api.anthropic.com/v1/"}),s.value=((o=a.value[e])==null?void 0:o.apiKey)||"",n.value=((r=a.value[e])==null?void 0:r.baseUrl)||"https://api.anthropic.com/v1/"}),V([s,n],()=>{a.value[e]={...a.value[e],apiKey:s.value,baseUrl:n.value||"https://api.anthropic.com/v1/"}});function g(){a.value[e]={baseUrl:"https://api.anthropic.com/v1/"}}return(o,r)=>{var f,b;return K(),C(t(B),{"provider-name":((f=m.value)==null?void 0:f.localizedName)||"Anthropic | Claude","provider-icon":(b=m.value)==null?void 0:b.icon,"on-back":()=>t(_).back()},{default:u(()=>[r[2]||(r[2]=i("div",{bg:"orange-50 dark:orange-900/20","rounded-xl":"","p-4":"",flex:"~ col gap-3"},[i("h2",{"text-xl":"","font-bold":"",text:"orange-700 dark:orange-500"}," Before you start "),i("p",null,[p(" While Anthropic recently did announce that they are having a beta support for OpenAI SDK compatibility "),i("a",{underline:"",href:"https://docs.anthropic.com/en/api/openai-sdk"},"(you can read more here)"),p(", but due to the implementation details comes with "),i("a",{underline:"",href:"https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS"},"CORS"),p(" restrictions which not aligned with the OpenAI SDK, it's currently not possible to use this provider in the browser. ")]),i("p",null,[p(" If you do need to use this provider, you will need a dedicated proxy backend like a Serverless Function running on "),i("a",{underline:"",href:"https://workers.cloudflare.com/"},"Cloudflare Workers"),p(" or some CORS bypassing services to bypass the CORS restrictions. ")])],-1)),l(t(I),null,{default:u(()=>[l(t(N),{title:t(c)("settings.pages.providers.common.section.basic.title"),description:t(c)("settings.pages.providers.common.section.basic.description"),"on-reset":g},{default:u(()=>{var d;return[l(t(A),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=y=>s.value=y),"provider-name":((d=m.value)==null?void 0:d.localizedName)||"Anthropic",placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(O),{title:t(c)("settings.pages.providers.common.section.advanced.title")},{default:u(()=>[l(t($),{modelValue:n.value,"onUpdate:modelValue":r[1]||(r[1]=d=>n.value=d),placeholder:"https://api.anthropic.com/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{Q as default}; diff --git a/assets/audio-DGArmC-t.js b/assets/audio-DVqTW1PB.js similarity index 88% rename from assets/audio-DGArmC-t.js rename to assets/audio-DVqTW1PB.js index fd52ec18e5b69a8a5e7808a6ac931447d6250da1..fe93358b7225070b09eb66f2622691c7e5f0c7f2 100644 --- a/assets/audio-DGArmC-t.js +++ b/assets/audio-DVqTW1PB.js @@ -1 +1 @@ -import{d as s,g as f,c as d,o as p,a as t}from"./index-20XXNHAB.js";const R=s({__name:"audio",setup(_){const a=f(),l=f();function u(o){var r,c,i;if(!o)return;const n=(c=(r=l.value)==null?void 0:r.files)==null?void 0:c[0];if(!n)return;const e=document.createElement("audio");(i=a.value)==null||i.appendChild(e),e.src=URL.createObjectURL(n),e.controls=!0,e.load(),e.play()}return(o,n)=>(p(),d("div",null,[t("div",null,[t("div",{ref_key:"containerRef",ref:a},null,512),t("input",{ref_key:"fileInputRef",ref:l,type:"file",onChange:u},null,544)])]))}});export{R as default}; +import{d as s,g as f,c as d,o as p,a as t}from"./index-D8Nm21zW.js";const R=s({__name:"audio",setup(_){const a=f(),l=f();function u(o){var r,c,i;if(!o)return;const n=(c=(r=l.value)==null?void 0:r.files)==null?void 0:c[0];if(!n)return;const e=document.createElement("audio");(i=a.value)==null||i.appendChild(e),e.src=URL.createObjectURL(n),e.controls=!0,e.load(),e.play()}return(o,n)=>(p(),d("div",null,[t("div",null,[t("div",{ref_key:"containerRef",ref:a},null,512),t("input",{ref_key:"fileInputRef",ref:l,type:"file",onChange:u},null,544)])]))}});export{R as default}; diff --git a/assets/background-remove-CJBtSoWZ.js b/assets/background-remove-CJBtSoWZ.js deleted file mode 100644 index 69975c4fb9e150a8eccebd81bd4634005e74e87c..0000000000000000000000000000000000000000 --- a/assets/background-remove-CJBtSoWZ.js +++ /dev/null @@ -1,2846 +0,0 @@ -var Zb=Object.defineProperty;var ev=(e,r,t)=>r in e?Zb(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var re=(e,r,t)=>ev(e,typeof r!="symbol"?r+"":r,t);import{_ as tv}from"./InputFile.vue_vue_type_script_setup_true_lang-61TbqfJt.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as rv,g as Ns,h as sv,l as nv,c as xn,o as Tn,a as Ar,b as ov,D as uf,bx as pf,by as hf,C as mf,n as iv,u as av}from"./index-20XXNHAB.js";const Yl=new Map,$n=[],lv=(e,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){const s=Yl.get(e);if(s===void 0)Yl.set(e,{backend:r,priority:t});else{if(s.priority>t)return;if(s.priority===t&&s.backend!==r)throw new Error(`cannot register backend "${e}" using priority ${t}`)}if(t>=0){const o=$n.indexOf(e);o!==-1&&$n.splice(o,1);for(let n=0;n<$n.length;n++)if(Yl.get($n[n]).priority<=t){$n.splice(n,0,e);return}$n.push(e)}return}throw new TypeError("not a valid backend")},dv=async e=>{const r=Yl.get(e);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{const t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(e)),await r.initPromise,r.initialized=!0,r.backend}catch(s){return t||(r.error=`${s}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},cv=async e=>{const r=e.executionProviders||[],t=r.map(l=>typeof l=="string"?l:l.name),s=t.length===0?$n:t;let o;const n=[],i=new Set;for(const l of s){const c=await dv(l);typeof c=="string"?n.push({name:l,err:c}):(o||(o=c),o===c&&i.add(l))}if(!o)throw new Error(`no available backend found. ERR: ${n.map(l=>`[${l.name}] ${l.err}`).join(", ")}`);for(const{name:l,err:c}of n)t.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${c}`);const a=r.filter(l=>i.has(typeof l=="string"?l:l.name));return[o,new Proxy(e,{get:(l,c)=>c==="executionProviders"?a:Reflect.get(l,c)})]},uv="1.21.0";let ff="warning";const ws={wasm:{},webgl:{},webgpu:{},versions:{common:uv},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}`);ff=e}},get logLevel(){return ff}};Object.defineProperty(ws,"logLevel",{enumerable:!0});const pv=ws,hv=(e,r)=>{const t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=e.dims[3],t.height=e.dims[2];const s=t.getContext("2d");if(s!=null){let o,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[3]):(o=e.dims[3],n=e.dims[2]);const i=(r==null?void 0:r.format)!==void 0?r.format:"RGB",a=r==null?void 0:r.norm;let l,c;a===void 0||a.mean===void 0?l=[255,255,255,255]:typeof a.mean=="number"?l=[a.mean,a.mean,a.mean,a.mean]:(l=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(l[3]=a.mean[3])),a===void 0||a.bias===void 0?c=[0,0,0,0]:typeof a.bias=="number"?c=[a.bias,a.bias,a.bias,a.bias]:(c=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(c[3]=a.bias[3]));const p=n*o;let u=0,h=p,g=p*2,_=-1;i==="RGBA"?(u=0,h=p,g=p*2,_=p*3):i==="RGB"?(u=0,h=p,g=p*2):i==="RBG"&&(u=0,g=p,h=p*2);for(let E=0;E{const t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d");let s;if(t!=null){let o,n,i;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[1],i=e.dims[3]):(o=e.dims[3],n=e.dims[2],i=e.dims[1]);const a=r!==void 0&&r.format!==void 0?r.format:"RGB",l=r==null?void 0:r.norm;let c,p;l===void 0||l.mean===void 0?c=[255,255,255,255]:typeof l.mean=="number"?c=[l.mean,l.mean,l.mean,l.mean]:(c=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(c[3]=l.mean[3])),l===void 0||l.bias===void 0?p=[0,0,0,0]:typeof l.bias=="number"?p=[l.bias,l.bias,l.bias,l.bias]:(p=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(p[3]=l.bias[3]));const u=n*o;if(r!==void 0&&(r.format!==void 0&&i===4&&r.format!=="RGBA"||i===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");const h=4;let g=0,_=1,E=2,I=3,M=0,y=u,$=u*2,P=-1;a==="RGBA"?(M=0,y=u,$=u*2,P=u*3):a==="RGB"?(M=0,y=u,$=u*2):a==="RBG"&&(M=0,$=u,y=u*2),s=t.createImageData(o,n);for(let b=0;b{if(e===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");const{height:t,width:s}=r,o=r.norm??{mean:255,bias:0};let n,i;typeof o.mean=="number"?n=[o.mean,o.mean,o.mean,o.mean]:n=[o.mean[0],o.mean[1],o.mean[2],o.mean[3]??255],typeof o.bias=="number"?i=[o.bias,o.bias,o.bias,o.bias]:i=[o.bias[0],o.bias[1],o.bias[2],o.bias[3]??0];const a=r.format!==void 0?r.format:"RGBA",l=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",c=t*s,p=l==="RGBA"?new Float32Array(c*4):new Float32Array(c*3);let u=4,h=0,g=1,_=2,E=3,I=0,M=c,y=c*2,$=-1;a==="RGB"&&(u=3,h=0,g=1,_=2,E=-1),l==="RGBA"?$=c*3:l==="RBG"?(I=0,y=c,M=c*2):l==="BGR"&&(y=0,M=c,I=c*2);for(let b=0;b{const t=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,s=typeof ImageData<"u"&&e instanceof ImageData,o=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string";let i,a=r??{};const l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},c=p=>typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||p instanceof OffscreenCanvas?p.getContext("2d"):null;if(t){const p=l();p.width=e.width,p.height=e.height;const u=c(p);if(u!=null){let h=e.height,g=e.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(h=r.resizedHeight,g=r.resizedWidth),r!==void 0){if(a=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");a.tensorFormat="RGBA",a.height=h,a.width=g}else a.tensorFormat="RGBA",a.height=h,a.width=g;u.drawImage(e,0,0),i=u.getImageData(0,0,g,h).data}else throw new Error("Can not access image data")}else if(s){let p,u;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(p=r.resizedHeight,u=r.resizedWidth):(p=e.height,u=e.width),r!==void 0&&(a=r),a.format="RGBA",a.height=p,a.width=u,r!==void 0){const h=l();h.width=u,h.height=p;const g=c(h);if(g!=null)g.putImageData(e,0,0),i=g.getImageData(0,0,u,p).data;else throw new Error("Can not access image data")}else i=e.data}else if(o){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");const p=l();p.width=e.width,p.height=e.height;const u=c(p);if(u!=null){const h=e.height,g=e.width;return u.drawImage(e,0,0,g,h),i=u.getImageData(0,0,g,h).data,a.height=h,a.width=g,Kd(i,a)}else throw new Error("Can not access image data")}else{if(n)return new Promise((p,u)=>{const h=l(),g=c(h);if(!e||!g)return u();const _=new Image;_.crossOrigin="Anonymous",_.src=e,_.onload=()=>{h.width=_.width,h.height=_.height,g.drawImage(_,0,0,h.width,h.height);const E=g.getImageData(0,0,h.width,h.height);a.height=h.height,a.width=h.width,p(Kd(E.data,a))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(i!==void 0)return Kd(i,a);throw new Error("Input data provided is not supported - aborted tensor creation")},_v=(e,r)=>{const{width:t,height:s,download:o,dispose:n}=r,i=[1,s,t,4];return new Yr({location:"texture",type:"float32",texture:e,dims:i,download:o,dispose:n})},gv=(e,r)=>{const{dataType:t,dims:s,download:o,dispose:n}=r;return new Yr({location:"gpu-buffer",type:t??"float32",gpuBuffer:e,dims:s,download:o,dispose:n})},wv=(e,r)=>{const{dataType:t,dims:s,download:o,dispose:n}=r;return new Yr({location:"ml-tensor",type:t??"float32",mlTensor:e,dims:s,download:o,dispose:n})},yv=(e,r,t)=>new Yr({location:"cpu-pinned",type:e,data:r,dims:t??[r.length]}),Po=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),Zl=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);let _f=!1;const Mv=()=>{if(!_f){_f=!0;const e=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=globalThis.Float16Array,s=typeof t<"u"&&t.from;e&&(Po.set("int64",BigInt64Array),Zl.set(BigInt64Array,"int64")),r&&(Po.set("uint64",BigUint64Array),Zl.set(BigUint64Array,"uint64")),s?(Po.set("float16",t),Zl.set(t,"float16")):Po.set("float16",Uint16Array)}},bv=e=>{let r=1;for(let t=0;t{switch(e.location){case"cpu":return new Yr(e.type,e.data,r);case"cpu-pinned":return new Yr({location:"cpu-pinned",data:e.data,type:e.type,dims:r});case"texture":return new Yr({location:"texture",texture:e.texture,type:e.type,dims:r});case"gpu-buffer":return new Yr({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:r});case"ml-tensor":return new Yr({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}};let Yr=class{constructor(r,t,s){Mv();let o,n;if(typeof r=="object"&&"location"in r)switch(this.dataLocation=r.location,o=r.type,n=r.dims,r.location){case"cpu-pinned":{const a=Po.get(o);if(!a)throw new TypeError(`unsupported type "${o}" to create tensor from pinned buffer`);if(!(r.data instanceof a))throw new TypeError(`buffer should be of type ${a.name}`);this.cpuData=r.data;break}case"texture":{if(o!=="float32")throw new TypeError(`unsupported type "${o}" to create tensor from texture`);this.gpuTextureData=r.texture,this.downloader=r.download,this.disposer=r.dispose;break}case"gpu-buffer":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint8"&&o!=="bool"&&o!=="uint4"&&o!=="int4")throw new TypeError(`unsupported type "${o}" to create tensor from gpu buffer`);this.gpuBufferData=r.gpuBuffer,this.downloader=r.download,this.disposer=r.dispose;break}case"ml-tensor":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint64"&&o!=="int8"&&o!=="uint8"&&o!=="bool"&&o!=="uint4"&&o!=="int4")throw new TypeError(`unsupported type "${o}" to create tensor from MLTensor`);this.mlTensorData=r.mlTensor,this.downloader=r.download,this.disposer=r.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,l;if(typeof r=="string")if(o=r,l=s,r==="string"){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");a=t}else{const c=Po.get(r);if(c===void 0)throw new TypeError(`Unsupported tensor type: ${r}.`);if(Array.isArray(t)){if(r==="float16"&&c===Uint16Array||r==="uint4"||r==="int4")throw new TypeError(`Creating a ${r} tensor from number array is not supported. Please use ${c.name} as data.`);r==="uint64"||r==="int64"?a=c.from(t,BigInt):a=c.from(t)}else if(t instanceof c)a=t;else if(t instanceof Uint8ClampedArray)if(r==="uint8")a=Uint8Array.from(t);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(r==="float16"&&t instanceof Uint16Array&&c!==Uint16Array)a=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw new TypeError(`A ${o} tensor's data must be type of ${c}`)}else if(l=t,Array.isArray(r)){if(r.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");const c=typeof r[0];if(c==="string")o="string",a=r;else if(c==="boolean")o="bool",a=Uint8Array.from(r);else throw new TypeError(`Invalid element type of data array: ${c}.`)}else if(r instanceof Uint8ClampedArray)o="uint8",a=Uint8Array.from(r);else{const c=Zl.get(r.constructor);if(c===void 0)throw new TypeError(`Unsupported type for tensor data: ${r.constructor}.`);o=c,a=r}if(l===void 0)l=[a.length];else if(!Array.isArray(l))throw new TypeError("A tensor's dims must be a number array");n=l,this.cpuData=a,this.dataLocation="cpu"}const i=bv(n);if(this.cpuData&&i!==this.cpuData.length&&!((o==="uint4"||o==="int4")&&Math.ceil(i/2)===this.cpuData.length))throw new Error(`Tensor's size(${i}) does not match data length(${this.cpuData.length}).`);this.type=o,this.dims=n,this.size=i}static async fromImage(r,t){return fv(r,t)}static fromTexture(r,t){return _v(r,t)}static fromGpuBuffer(r,t){return gv(r,t)}static fromMLTensor(r,t){return wv(r,t)}static fromPinnedBuffer(r,t,s){return yv(r,t,s)}toDataURL(r){return hv(this,r)}toImageData(r){return mv(this,r)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(r){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;const t=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=t,r&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(r){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return vv(this,r)}};const To=Yr,Xw=(e,r)=>{(typeof ws.trace>"u"?!ws.wasm.trace:!ws.trace)||console.timeStamp(`${e}::ORT::${r}`)},Jw=(e,r)=>{var o;const t=((o=new Error().stack)==null?void 0:o.split(/\r\n|\r|\n/g))||[];let s=!1;for(let n=0;n{(typeof ws.trace>"u"?!ws.wasm.trace:!ws.trace)||Jw("BEGIN",e)},Uc=e=>{(typeof ws.trace>"u"?!ws.wasm.trace:!ws.trace)||Jw("END",e)};let xv=class Yw{constructor(r){this.handler=r}async run(r,t,s){Vc();const o={};let n={};if(typeof r!="object"||r===null||r instanceof To||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let i=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof To)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");i=!1;for(const c of t){if(typeof c!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(c)===-1)throw new RangeError(`'fetches' contains invalid output name: ${c}.`);o[c]=null}if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else{let c=!1;const p=Object.getOwnPropertyNames(t);for(const u of this.outputNames)if(p.indexOf(u)!==-1){const h=t[u];(h===null||h instanceof To)&&(c=!0,i=!1,o[u]=h)}if(c){if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else n=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(const c of this.inputNames)if(typeof r[c]>"u")throw new Error(`input '${c}' is missing in 'feeds'.`);if(i)for(const c of this.outputNames)o[c]=null;const a=await this.handler.run(r,o,n),l={};for(const c in a)if(Object.hasOwnProperty.call(a,c)){const p=a[c];p instanceof To?l[c]=p:l[c]=new To(p.type,p.data,p.dims)}return Uc(),l}async release(){return this.handler.dispose()}static async create(r,t,s,o){Vc();let n,i={};if(typeof r=="string"){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){const p=r;let u=0,h=r.byteLength;if(typeof t=="object"&&t!==null)i=t;else if(typeof t=="number"){if(u=t,!Number.isSafeInteger(u))throw new RangeError("'byteOffset' must be an integer.");if(u<0||u>=p.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${p.byteLength}).`);if(h=r.byteLength-u,typeof s=="number"){if(h=s,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||u+h>p.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${p.byteLength-u}].`);if(typeof o=="object"&&o!==null)i=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof s<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(p,u,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const[a,l]=await cv(i),c=await a.createInferenceSessionHandler(n,l);return Uc(),new Yw(c)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}};const Tv=xv,Ev=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession:Tv,TRACE:Xw,TRACE_FUNC_BEGIN:Vc,TRACE_FUNC_END:Uc,Tensor:To,env:pv,registerBackend:lv},Symbol.toStringTag,{value:"Module"}));/*! - * ONNX Runtime Web v1.22.0-dev.20250306-ccf8fdd9ea - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. - */var ou=Object.defineProperty,Pv=Object.getOwnPropertyDescriptor,Cv=Object.getOwnPropertyNames,Sv=Object.prototype.hasOwnProperty,$v=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Ve=(e,r)=>()=>(e&&(r=e(e=0)),r),ma=(e,r)=>{for(var t in r)ou(e,t,{get:r[t],enumerable:!0})},kv=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Cv(r))!Sv.call(e,o)&&o!==t&&ou(e,o,{get:()=>r[o],enumerable:!(s=Pv(r,o))||s.enumerable});return e},rd=e=>kv(ou({},"__esModule",{value:!0}),e),Yi,on,Fn,gf,Zw,ey=Ve(()=>{Yi=new Map,on=[],Fn=(e,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){let s=Yi.get(e);if(s===void 0)Yi.set(e,{backend:r,priority:t});else{if(s.priority>t)return;if(s.priority===t&&s.backend!==r)throw new Error(`cannot register backend "${e}" using priority ${t}`)}if(t>=0){let o=on.indexOf(e);o!==-1&&on.splice(o,1);for(let n=0;n{let r=Yi.get(e);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{let t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(e)),await r.initPromise,r.initialized=!0,r.backend}catch(s){return t||(r.error=`${s}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},Zw=async e=>{let r=e.executionProviders||[],t=r.map(l=>typeof l=="string"?l:l.name),s=t.length===0?on:t,o,n=[],i=new Set;for(let l of s){let c=await gf(l);typeof c=="string"?n.push({name:l,err:c}):(o||(o=c),o===c&&i.add(l))}if(!o)throw new Error(`no available backend found. ERR: ${n.map(l=>`[${l.name}] ${l.err}`).join(", ")}`);for(let{name:l,err:c}of n)t.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${c}`);let a=r.filter(l=>i.has(typeof l=="string"?l:l.name));return[o,new Proxy(e,{get:(l,c)=>c==="executionProviders"?a:Reflect.get(l,c)})]}}),Iv=Ve(()=>{ey()}),ty,Av=Ve(()=>{ty="1.22.0-dev.20250306-aafa8d170a"}),Hd,Jr,ry=Ve(()=>{Av(),Hd="warning",Jr={wasm:{},webgl:{},webgpu:{},versions:{common:ty},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}`);Hd=e}},get logLevel(){return Hd}},Object.defineProperty(Jr,"logLevel",{enumerable:!0})}),Kt,Fv=Ve(()=>{ry(),Kt=Jr}),sy,ny,Ov=Ve(()=>{sy=(e,r)=>{let t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=e.dims[3],t.height=e.dims[2];let s=t.getContext("2d");if(s!=null){let o,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[3]):(o=e.dims[3],n=e.dims[2]);let i=(r==null?void 0:r.format)!==void 0?r.format:"RGB",a=r==null?void 0:r.norm,l,c;a===void 0||a.mean===void 0?l=[255,255,255,255]:typeof a.mean=="number"?l=[a.mean,a.mean,a.mean,a.mean]:(l=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(l[3]=a.mean[3])),a===void 0||a.bias===void 0?c=[0,0,0,0]:typeof a.bias=="number"?c=[a.bias,a.bias,a.bias,a.bias]:(c=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(c[3]=a.bias[3]));let p=n*o,u=0,h=p,g=p*2,_=-1;i==="RGBA"?(u=0,h=p,g=p*2,_=p*3):i==="RGB"?(u=0,h=p,g=p*2):i==="RBG"&&(u=0,g=p,h=p*2);for(let E=0;E{let t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),s;if(t!=null){let o,n,i;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[1],i=e.dims[3]):(o=e.dims[3],n=e.dims[2],i=e.dims[1]);let a=r!==void 0&&r.format!==void 0?r.format:"RGB",l=r==null?void 0:r.norm,c,p;l===void 0||l.mean===void 0?c=[255,255,255,255]:typeof l.mean=="number"?c=[l.mean,l.mean,l.mean,l.mean]:(c=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(c[3]=l.mean[3])),l===void 0||l.bias===void 0?p=[0,0,0,0]:typeof l.bias=="number"?p=[l.bias,l.bias,l.bias,l.bias]:(p=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(p[3]=l.bias[3]));let u=n*o;if(r!==void 0&&(r.format!==void 0&&i===4&&r.format!=="RGBA"||i===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let h=4,g=0,_=1,E=2,I=3,M=0,y=u,$=u*2,P=-1;a==="RGBA"?(M=0,y=u,$=u*2,P=u*3):a==="RGB"?(M=0,y=u,$=u*2):a==="RBG"&&(M=0,$=u,y=u*2),s=t.createImageData(o,n);for(let b=0;b{iu(),Bl=(e,r)=>{if(e===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:t,width:s}=r,o=r.norm??{mean:255,bias:0},n,i;typeof o.mean=="number"?n=[o.mean,o.mean,o.mean,o.mean]:n=[o.mean[0],o.mean[1],o.mean[2],o.mean[3]??255],typeof o.bias=="number"?i=[o.bias,o.bias,o.bias,o.bias]:i=[o.bias[0],o.bias[1],o.bias[2],o.bias[3]??0];let a=r.format!==void 0?r.format:"RGBA",l=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",c=t*s,p=l==="RGBA"?new Float32Array(c*4):new Float32Array(c*3),u=4,h=0,g=1,_=2,E=3,I=0,M=c,y=c*2,$=-1;a==="RGB"&&(u=3,h=0,g=1,_=2,E=-1),l==="RGBA"?$=c*3:l==="RBG"?(I=0,y=c,M=c*2):l==="BGR"&&(y=0,M=c,I=c*2);for(let P=0;P{let t=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,s=typeof ImageData<"u"&&e instanceof ImageData,o=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string",i,a=r??{},l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},c=p=>typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||p instanceof OffscreenCanvas?p.getContext("2d"):null;if(t){let p=l();p.width=e.width,p.height=e.height;let u=c(p);if(u!=null){let h=e.height,g=e.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(h=r.resizedHeight,g=r.resizedWidth),r!==void 0){if(a=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");a.tensorFormat="RGBA",a.height=h,a.width=g}else a.tensorFormat="RGBA",a.height=h,a.width=g;u.drawImage(e,0,0),i=u.getImageData(0,0,g,h).data}else throw new Error("Can not access image data")}else if(s){let p,u;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(p=r.resizedHeight,u=r.resizedWidth):(p=e.height,u=e.width),r!==void 0&&(a=r),a.format="RGBA",a.height=p,a.width=u,r!==void 0){let h=l();h.width=u,h.height=p;let g=c(h);if(g!=null)g.putImageData(e,0,0),i=g.getImageData(0,0,u,p).data;else throw new Error("Can not access image data")}else i=e.data}else if(o){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");let p=l();p.width=e.width,p.height=e.height;let u=c(p);if(u!=null){let h=e.height,g=e.width;return u.drawImage(e,0,0,g,h),i=u.getImageData(0,0,g,h).data,a.height=h,a.width=g,Bl(i,a)}else throw new Error("Can not access image data")}else{if(n)return new Promise((p,u)=>{let h=l(),g=c(h);if(!e||!g)return u();let _=new Image;_.crossOrigin="Anonymous",_.src=e,_.onload=()=>{h.width=_.width,h.height=_.height,g.drawImage(_,0,0,h.width,h.height);let E=g.getImageData(0,0,h.width,h.height);a.height=h.height,a.width=h.width,p(Bl(E.data,a))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(i!==void 0)return Bl(i,a);throw new Error("Input data provided is not supported - aborted tensor creation")},iy=(e,r)=>{let{width:t,height:s,download:o,dispose:n}=r,i=[1,s,t,4];return new Ur({location:"texture",type:"float32",texture:e,dims:i,download:o,dispose:n})},ay=(e,r)=>{let{dataType:t,dims:s,download:o,dispose:n}=r;return new Ur({location:"gpu-buffer",type:t??"float32",gpuBuffer:e,dims:s,download:o,dispose:n})},ly=(e,r)=>{let{dataType:t,dims:s,download:o,dispose:n}=r;return new Ur({location:"ml-tensor",type:t??"float32",mlTensor:e,dims:s,download:o,dispose:n})},dy=(e,r,t)=>new Ur({location:"cpu-pinned",type:e,data:r,dims:t??[r.length]})}),kn,aa,qd,cy,Lv=Ve(()=>{kn=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),aa=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),qd=!1,cy=()=>{if(!qd){qd=!0;let e=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=globalThis.Float16Array,s=typeof t<"u"&&t.from;e&&(kn.set("int64",BigInt64Array),aa.set(BigInt64Array,"int64")),r&&(kn.set("uint64",BigUint64Array),aa.set(BigUint64Array,"uint64")),s?(kn.set("float16",t),aa.set(t,"float16")):kn.set("float16",Uint16Array)}}}),uy,py,zv=Ve(()=>{iu(),uy=e=>{let r=1;for(let t=0;t{switch(e.location){case"cpu":return new Ur(e.type,e.data,r);case"cpu-pinned":return new Ur({location:"cpu-pinned",data:e.data,type:e.type,dims:r});case"texture":return new Ur({location:"texture",texture:e.texture,type:e.type,dims:r});case"gpu-buffer":return new Ur({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:r});case"ml-tensor":return new Ur({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}}}),Ur,iu=Ve(()=>{Ov(),Dv(),Lv(),zv(),Ur=class{constructor(e,r,t){cy();let s,o;if(typeof e=="object"&&"location"in e)switch(this.dataLocation=e.location,s=e.type,o=e.dims,e.location){case"cpu-pinned":{let i=kn.get(s);if(!i)throw new TypeError(`unsupported type "${s}" to create tensor from pinned buffer`);if(!(e.data instanceof i))throw new TypeError(`buffer should be of type ${i.name}`);this.cpuData=e.data;break}case"texture":{if(s!=="float32")throw new TypeError(`unsupported type "${s}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break}case"gpu-buffer":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint8"&&s!=="bool"&&s!=="uint4"&&s!=="int4")throw new TypeError(`unsupported type "${s}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break}case"ml-tensor":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint64"&&s!=="int8"&&s!=="uint8"&&s!=="bool"&&s!=="uint4"&&s!=="int4")throw new TypeError(`unsupported type "${s}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let i,a;if(typeof e=="string")if(s=e,a=t,e==="string"){if(!Array.isArray(r))throw new TypeError("A string tensor's data must be a string array.");i=r}else{let l=kn.get(e);if(l===void 0)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(r)){if(e==="float16"&&l===Uint16Array||e==="uint4"||e==="int4")throw new TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${l.name} as data.`);e==="uint64"||e==="int64"?i=l.from(r,BigInt):i=l.from(r)}else if(r instanceof l)i=r;else if(r instanceof Uint8ClampedArray)if(e==="uint8")i=Uint8Array.from(r);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(e==="float16"&&r instanceof Uint16Array&&l!==Uint16Array)i=new globalThis.Float16Array(r.buffer,r.byteOffset,r.length);else throw new TypeError(`A ${s} tensor's data must be type of ${l}`)}else if(a=r,Array.isArray(e)){if(e.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let l=typeof e[0];if(l==="string")s="string",i=e;else if(l==="boolean")s="bool",i=Uint8Array.from(e);else throw new TypeError(`Invalid element type of data array: ${l}.`)}else if(e instanceof Uint8ClampedArray)s="uint8",i=Uint8Array.from(e);else{let l=aa.get(e.constructor);if(l===void 0)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);s=l,i=e}if(a===void 0)a=[i.length];else if(!Array.isArray(a))throw new TypeError("A tensor's dims must be a number array");o=a,this.cpuData=i,this.dataLocation="cpu"}let n=uy(o);if(this.cpuData&&n!==this.cpuData.length&&!((s==="uint4"||s==="int4")&&Math.ceil(n/2)===this.cpuData.length))throw new Error(`Tensor's size(${n}) does not match data length(${this.cpuData.length}).`);this.type=s,this.dims=o,this.size=n}static async fromImage(e,r){return oy(e,r)}static fromTexture(e,r){return iy(e,r)}static fromGpuBuffer(e,r){return ay(e,r)}static fromMLTensor(e,r){return ly(e,r)}static fromPinnedBuffer(e,r,t){return dy(e,r,t)}toDataURL(e){return sy(this,e)}toImageData(e){return ny(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let r=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=r,e&&this.disposer&&(this.disposer(),this.disposer=void 0),r}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return py(this,e)}}}),gs,hy=Ve(()=>{iu(),gs=Ur}),pa,Qd,ys,Zr,my=Ve(()=>{ry(),pa=(e,r)=>{(typeof Jr.trace>"u"?!Jr.wasm.trace:!Jr.trace)||console.timeStamp(`${e}::ORT::${r}`)},Qd=(e,r)=>{var o;let t=((o=new Error().stack)==null?void 0:o.split(/\r\n|\r|\n/g))||[],s=!1;for(let n=0;n{(typeof Jr.trace>"u"?!Jr.wasm.trace:!Jr.trace)||Qd("BEGIN",e)},Zr=e=>{(typeof Jr.trace>"u"?!Jr.wasm.trace:!Jr.trace)||Qd("END",e)}}),fy,Bv=Ve(()=>{ey(),hy(),my(),fy=class _y{constructor(r){this.handler=r}async run(r,t,s){ys();let o={},n={};if(typeof r!="object"||r===null||r instanceof gs||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let i=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof gs)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");i=!1;for(let c of t){if(typeof c!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(c)===-1)throw new RangeError(`'fetches' contains invalid output name: ${c}.`);o[c]=null}if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else{let c=!1,p=Object.getOwnPropertyNames(t);for(let u of this.outputNames)if(p.indexOf(u)!==-1){let h=t[u];(h===null||h instanceof gs)&&(c=!0,i=!1,o[u]=h)}if(c){if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else n=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let c of this.inputNames)if(typeof r[c]>"u")throw new Error(`input '${c}' is missing in 'feeds'.`);if(i)for(let c of this.outputNames)o[c]=null;let a=await this.handler.run(r,o,n),l={};for(let c in a)if(Object.hasOwnProperty.call(a,c)){let p=a[c];p instanceof gs?l[c]=p:l[c]=new gs(p.type,p.data,p.dims)}return Zr(),l}async release(){return this.handler.dispose()}static async create(r,t,s,o){ys();let n,i={};if(typeof r=="string"){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){let p=r,u=0,h=r.byteLength;if(typeof t=="object"&&t!==null)i=t;else if(typeof t=="number"){if(u=t,!Number.isSafeInteger(u))throw new RangeError("'byteOffset' must be an integer.");if(u<0||u>=p.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${p.byteLength}).`);if(h=r.byteLength-u,typeof s=="number"){if(h=s,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||u+h>p.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${p.byteLength-u}].`);if(typeof o=="object"&&o!==null)i=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof s<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(p,u,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[a,l]=await Zw(i),c=await a.createInferenceSessionHandler(n,l);return Zr(),new _y(c)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}}),au,Rv=Ve(()=>{Bv(),au=fy}),Nv=Ve(()=>{}),jv=Ve(()=>{}),Vv=Ve(()=>{}),Uv=Ve(()=>{}),gy={};ma(gy,{InferenceSession:()=>au,TRACE:()=>pa,TRACE_FUNC_BEGIN:()=>ys,TRACE_FUNC_END:()=>Zr,Tensor:()=>gs,env:()=>Kt,registerBackend:()=>Fn});var Ms=Ve(()=>{Iv(),Fv(),Rv(),hy(),Nv(),jv(),my(),Vv(),Uv()}),lu=Ve(()=>{}),wy={};ma(wy,{default:()=>yy});var Xd,Jd,yy,Wv=Ve(()=>{var e;vb(),zn(),du(),Xd="ort-wasm-proxy-worker",Jd=((e=globalThis.self)==null?void 0:e.name)===Xd,Jd&&(self.onmessage=r=>{let{type:t,in:s}=r.data;try{switch(t){case"init-wasm":cu(s.wasm).then(()=>{Su(s).then(()=>{postMessage({type:t})},o=>{postMessage({type:t,err:o})})},o=>{postMessage({type:t,err:o})});break;case"init-ep":{let{epName:o,env:n}=s;$u(n,o).then(()=>{postMessage({type:t})},i=>{postMessage({type:t,err:i})});break}case"copy-from":{let{buffer:o}=s,n=ld(o);postMessage({type:t,out:n});break}case"create":{let{model:o,options:n}=s;ku(o,n).then(i=>{postMessage({type:t,out:i})},i=>{postMessage({type:t,err:i})});break}case"release":Iu(s),postMessage({type:t});break;case"run":{let{sessionId:o,inputIndices:n,inputs:i,outputIndices:a,options:l}=s;Au(o,n,i,a,new Array(a.length).fill(null),l).then(c=>{c.some(p=>p[3]!=="cpu")?postMessage({type:t,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:t,out:c},Ou([...i,...c]))},c=>{postMessage({type:t,err:c})});break}case"end-profiling":Fu(s),postMessage({type:t});break;default:}}catch(o){postMessage({type:t,err:o})}}),yy=Jd?null:r=>new Worker(r??Vr,{type:"module",name:Xd})}),My={};ma(My,{default:()=>by});var Yd,Zd,by,wf,Gv=Ve(()=>{var e,r;Zd=(Yd=import.meta.url,async function(t={}){var Xi;var s,o,n=t,i=new Promise((d,m)=>{s=d,o=m}),a=typeof window=="object",l=typeof WorkerGlobalScope<"u",c=l&&((Xi=self.name)==null?void 0:Xi.startsWith("em-pthread"));n.mountExternalData=(d,m)=>{d.startsWith("./")&&(d=d.substring(2)),(n.Bd||(n.Bd=new Map)).set(d,m)},n.unmountExternalData=()=>{delete n.Bd};var p=globalThis.SharedArrayBuffer??new WebAssembly.Memory({initial:0,maximum:0,shared:!0}).buffer.constructor;let u=()=>{let d=(x,C,A)=>(...W)=>{let ne=Rt,ye=C==null?void 0:C();W=x(...W);let Ee=C==null?void 0:C();return ye!==Ee&&(x=Ee,A(ye),C=A=null),Rt!=ne?new Promise((ze,Ye)=>{Ys={resolve:ze,reject:Ye}}):W},m=x=>async(...C)=>{var A;try{if(n.Cd)throw Error("Session already started");let W=n.Cd={be:C[0],errors:[]},ne=await x(...C);if(n.Cd!==W)throw Error("Session mismatch");(A=n.Dd)==null||A.flush();let ye=W.errors;if(0ze),0n._OrtCreateSession,x=>n._OrtCreateSession=x),n._OrtRun=m(d(n._OrtRun,()=>n._OrtRun,x=>n._OrtRun=x)),n._OrtRunWithBinding=m(d(n._OrtRunWithBinding,()=>n._OrtRunWithBinding,x=>n._OrtRunWithBinding=x)),n._OrtBindInput=d(n._OrtBindInput,()=>n._OrtBindInput,x=>n._OrtBindInput=x),u=void 0};n.jsepInit=(d,m)=>{if(u==null||u(),d==="webgpu"){[n.Dd,n.Rd,n.Vd,n.Hd,n.Ud,n.hc,n.Wd,n.Zd,n.Sd,n.Td,n.Xd]=m;let x=n.Dd;n.jsepRegisterBuffer=(C,A,W,ne)=>x.registerBuffer(C,A,W,ne),n.jsepGetBuffer=C=>x.getBuffer(C),n.jsepCreateDownloader=(C,A,W)=>x.createDownloader(C,A,W),n.jsepOnCreateSession=C=>{x.onCreateSession(C)},n.jsepOnReleaseSession=C=>{x.onReleaseSession(C)},n.jsepOnRunStart=C=>x.onRunStart(C),n.$d=(C,A)=>{x.upload(C,A)}}else if(d==="webnn"){[n.Dd,n.Yd,n.Id,n.jsepEnsureTensor,n.Jd,n.jsepDownloadTensor]=m,n.jsepReleaseTensorId=n.Id,n.jsepUploadTensor=n.Jd;let x=n.Dd;n.jsepOnRunStart=C=>x.onRunStart(C),n.jsepOnRunEnd=x.onRunEnd.bind(x),n.jsepRegisterMLContext=(C,A)=>{x.registerMLContext(C,A)},n.jsepOnReleaseSession=C=>{x.onReleaseSession(C)},n.jsepCreateMLTensorDownloader=(C,A)=>x.createMLTensorDownloader(C,A),n.jsepRegisterMLTensor=(C,A,W,ne)=>x.registerMLTensor(C,A,W,ne),n.jsepCreateMLContext=C=>x.createMLContext(C),n.jsepRegisterMLConstant=(C,A,W,ne,ye)=>x.registerMLConstant(C,A,W,ne,ye,n.Bd),n.jsepRegisterGraphInput=x.registerGraphInput.bind(x),n.jsepIsGraphInput=x.isGraphInput.bind(x),n.jsepCreateTemporaryTensor=x.createTemporaryTensor.bind(x)}};var h,g,_=Object.assign({},n),E=(d,m)=>{throw m},I="";(a||l)&&(l?I=self.location.href:typeof document<"u"&&document.currentScript&&(I=document.currentScript.src),Yd&&(I=Yd),I=I.startsWith("blob:")?"":I.slice(0,I.replace(/[?#].*/,"").lastIndexOf("/")+1),l&&(g=d=>{var m=new XMLHttpRequest;return m.open("GET",d,!1),m.responseType="arraybuffer",m.send(null),new Uint8Array(m.response)}),h=async d=>{if(he(d))return new Promise((x,C)=>{var A=new XMLHttpRequest;A.open("GET",d,!0),A.responseType="arraybuffer",A.onload=()=>{A.status==200||A.status==0&&A.response?x(A.response):C(A.status)},A.onerror=C,A.send(null)});var m=await fetch(d,{credentials:"same-origin"});if(m.ok)return m.arrayBuffer();throw Error(m.status+" : "+m.url)});var M=console.log.bind(console),y=console.error.bind(console),$=M,P=y;Object.assign(n,_),_=null;var b,w,T,k,z,R,Q,q,U,Z,H,J,oe,ae=n.wasmBinary,ce=!1,he=d=>d.startsWith("file://");function N(){return b.buffer!=k.buffer&&K(),k}function O(){return b.buffer!=k.buffer&&K(),z}function G(){return b.buffer!=k.buffer&&K(),R}function se(){return b.buffer!=k.buffer&&K(),Q}function X(){return b.buffer!=k.buffer&&K(),q}function we(){return b.buffer!=k.buffer&&K(),U}function _e(){return b.buffer!=k.buffer&&K(),Z}function ke(){return b.buffer!=k.buffer&&K(),oe}if(c){let d=function(m){try{var x=m.data,C=x.yd;if(C==="load"){let A=[];self.onmessage=W=>A.push(W),self.startWorker=()=>{postMessage({yd:"loaded"});for(let W of A)d(W);self.onmessage=d};for(let W of x.Od)n[W]&&!n[W].proxy||(n[W]=(...ne)=>{postMessage({yd:"callHandler",Nd:W,args:ne})},W=="print"&&($=n[W]),W=="printErr"&&(P=n[W]));b=x.he,K(),He(x.ie)}else if(C==="run"){ks(x.xd),Xn(x.xd,0,0,1,0,0),jt(),At(x.xd),Me||(Qn(),Me=!0);try{Or(x.de,x.Fd)}catch(A){if(A!="unwind")throw A}}else x.target!=="setimmediate"&&(C==="checkMailbox"?Me&&Vt():C&&(P(`worker: received unknown command ${C}`),P(x)))}catch(A){throw Jo(),A}};var He,Me=!1;P=function(...m){m=m.join(" "),console.error(m)},self.alert=function(...m){postMessage({yd:"alert",text:m.join(" "),fe:wn()})},self.onunhandledrejection=m=>{throw m.reason||m},self.onmessage=d}function K(){var d=b.buffer;n.HEAP8=k=new Int8Array(d),n.HEAP16=R=new Int16Array(d),n.HEAPU8=z=new Uint8Array(d),n.HEAPU16=Q=new Uint16Array(d),n.HEAP32=q=new Int32Array(d),n.HEAPU32=U=new Uint32Array(d),n.HEAPF32=Z=new Float32Array(d),n.HEAPF64=oe=new Float64Array(d),n.HEAP64=H=new BigInt64Array(d),n.HEAPU64=J=new BigUint64Array(d)}function j(){c?startWorker(n):Oe.Bb()}c||(b=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),K());var me,Pe=0,Te=null;function Ae(){if(--Pe==0&&Te){var d=Te;Te=null,d()}}function Ie(d){throw P(d="Aborted("+d+")"),ce=!0,d=new WebAssembly.RuntimeError(d+". Build with -sASSERTIONS for more info."),o(d),d}function Le(){return{a:{Ta:D,Va:We,W:Is,la:dt,b:bs,u:vs,R:xs,Za:As,d:hr,pb:et,g:Rr,T:Sr,Ga:ss,lb:os,nb:is,Ha:Kr,Ea:Ts,wb:Ws,Da:Gs,pa:Ks,mb:Hs,jb:as,Fa:qs,kb:Qs,Ma:Es,za:un,eb:pn,cb:Ps,ya:pe,V:F,N:V,db:Y,ma:pt,fb:Ct,zb:$t,hb:br,qb:Qr,ab:vr,Aa:ls,yb:At,Ja:Wt,S:Xr,Wa:ds,$:_a,H:ga,E:ya,l:qr,F:Ao,B:va,X:Fo,J:xa,v:Oo,O:dd,D:Ta,t:Do,A:Ea,z:Nn,w:Pa,r:Ca,tb:Sa,ub:$a,vb:jn,rb:Vn,sb:Ro,bb:No,Oa:cd,La:ud,y:Ia,ja:Aa,Ba:Fa,Ka:ka,qa:Oa,Ia:Da,ib:Gn,U:Bs,fa:La,Sa:za,gb:Ba,Qa:Vo,Pa:Ra,Ab:Wo,Ca:Hn,ob:je,aa:Go,oa:Ko,xb:qn,na:Ho,$a:ol,ia:Hi,sa:fl,ga:Vi,da:dl,ua:yo,p:rl,e:Wa,c:Va,ea:Wi,f:Ga,n:Ka,k:Ni,Y:qa,ka:el,j:sl,wa:al,Ra:Qi,ca:Ki,Ua:gl,P:ll,K:Ri,_:Gi,Q:nl,Z:hl,x:Qa,m:Ua,va:ul,i:zi,h:Ha,ra:_l,ta:qi,o:Bi,q:Xa,s:Ya,I:Za,C:ji,L:tl,xa:il,_a:Ui,G:pl,Ya:wo,ba:ml,M:Ja,Xa:cl,ha:qo,a:b,Na:Re}}}var Ne={1320978:()=>typeof wasmOffsetConverter<"u",1321035:(d,m,x,C,A)=>{if(n===void 0||!n.Bd)return 1;if((d=zt(Number(d>>>0))).startsWith("./")&&(d=d.substring(2)),!(d=n.Bd.get(d)))return 2;if(m=Number(m>>>0),x=Number(x>>>0),C=Number(C>>>0),m+x>d.byteLength)return 3;try{let W=d.subarray(m,m+x);switch(A){case 0:O().set(W,C>>>0);break;case 1:n.$d(C,W);break;default:return 4}return 0}catch{return 4}},1321750:(d,m,x)=>{n.Jd(d,O().subarray(m>>>0,m+x>>>0))},1321813:()=>n.Yd(),1321854:d=>{n.Id(d)},1321890:()=>{n.Sd()},1321921:()=>{n.Td()},1321950:()=>{n.Xd()},1321975:d=>n.Rd(d),1322008:d=>n.Vd(d),1322040:(d,m,x)=>{n.Hd(Number(d),Number(m),Number(x),!0)},1322103:(d,m,x)=>{n.Hd(Number(d),Number(m),Number(x))},1322160:d=>{n.hc("Abs",d,void 0)},1322211:d=>{n.hc("Neg",d,void 0)},1322262:d=>{n.hc("Floor",d,void 0)},1322315:d=>{n.hc("Ceil",d,void 0)},1322367:d=>{n.hc("Reciprocal",d,void 0)},1322425:d=>{n.hc("Sqrt",d,void 0)},1322477:d=>{n.hc("Exp",d,void 0)},1322528:d=>{n.hc("Erf",d,void 0)},1322579:d=>{n.hc("Sigmoid",d,void 0)},1322634:(d,m,x)=>{n.hc("HardSigmoid",d,{alpha:m,beta:x})},1322713:d=>{n.hc("Log",d,void 0)},1322764:d=>{n.hc("Sin",d,void 0)},1322815:d=>{n.hc("Cos",d,void 0)},1322866:d=>{n.hc("Tan",d,void 0)},1322917:d=>{n.hc("Asin",d,void 0)},1322969:d=>{n.hc("Acos",d,void 0)},1323021:d=>{n.hc("Atan",d,void 0)},1323073:d=>{n.hc("Sinh",d,void 0)},1323125:d=>{n.hc("Cosh",d,void 0)},1323177:d=>{n.hc("Asinh",d,void 0)},1323230:d=>{n.hc("Acosh",d,void 0)},1323283:d=>{n.hc("Atanh",d,void 0)},1323336:d=>{n.hc("Tanh",d,void 0)},1323388:d=>{n.hc("Not",d,void 0)},1323439:(d,m,x)=>{n.hc("Clip",d,{min:m,max:x})},1323508:d=>{n.hc("Clip",d,void 0)},1323560:(d,m)=>{n.hc("Elu",d,{alpha:m})},1323618:d=>{n.hc("Gelu",d,void 0)},1323670:d=>{n.hc("Relu",d,void 0)},1323722:(d,m)=>{n.hc("LeakyRelu",d,{alpha:m})},1323786:(d,m)=>{n.hc("ThresholdedRelu",d,{alpha:m})},1323856:(d,m)=>{n.hc("Cast",d,{to:m})},1323914:d=>{n.hc("Add",d,void 0)},1323965:d=>{n.hc("Sub",d,void 0)},1324016:d=>{n.hc("Mul",d,void 0)},1324067:d=>{n.hc("Div",d,void 0)},1324118:d=>{n.hc("Pow",d,void 0)},1324169:d=>{n.hc("Equal",d,void 0)},1324222:d=>{n.hc("Greater",d,void 0)},1324277:d=>{n.hc("GreaterOrEqual",d,void 0)},1324339:d=>{n.hc("Less",d,void 0)},1324391:d=>{n.hc("LessOrEqual",d,void 0)},1324450:(d,m,x,C,A)=>{n.hc("ReduceMean",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1324625:(d,m,x,C,A)=>{n.hc("ReduceMax",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1324799:(d,m,x,C,A)=>{n.hc("ReduceMin",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1324973:(d,m,x,C,A)=>{n.hc("ReduceProd",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1325148:(d,m,x,C,A)=>{n.hc("ReduceSum",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1325322:(d,m,x,C,A)=>{n.hc("ReduceL1",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1325495:(d,m,x,C,A)=>{n.hc("ReduceL2",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1325668:(d,m,x,C,A)=>{n.hc("ReduceLogSum",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1325845:(d,m,x,C,A)=>{n.hc("ReduceSumSquare",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1326025:(d,m,x,C,A)=>{n.hc("ReduceLogSumExp",d,{keepDims:!!m,noopWithEmptyAxes:!!x,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1326205:d=>{n.hc("Where",d,void 0)},1326258:(d,m,x)=>{n.hc("Transpose",d,{perm:m?Array.from(X().subarray(Number(m)>>>0,Number(x)>>>0)):[]})},1326382:(d,m,x,C)=>{n.hc("DepthToSpace",d,{blocksize:m,mode:zt(x),format:C?"NHWC":"NCHW"})},1326515:(d,m,x,C)=>{n.hc("DepthToSpace",d,{blocksize:m,mode:zt(x),format:C?"NHWC":"NCHW"})},1326648:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt,Ir)=>{n.hc("ConvTranspose",d,{format:Ee?"NHWC":"NCHW",autoPad:m,dilations:[x],group:C,kernelShape:[A],pads:[W,ne],strides:[ye],wIsConst:()=>!!N()[ze>>>0],outputPadding:Ye?Array.from(X().subarray(Number(Ye)>>>0,Number(it)>>>0)):[],outputShape:_t?Array.from(X().subarray(Number(_t)>>>0,Number(Bt)>>>0)):[],activation:zt(Ir)})},1327081:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt)=>{n.hc("ConvTranspose",d,{format:ye?"NHWC":"NCHW",autoPad:m,dilations:Array.from(X().subarray(Number(x)>>>0,2+(Number(x)>>>0)>>>0)),group:C,kernelShape:Array.from(X().subarray(Number(A)>>>0,2+(Number(A)>>>0)>>>0)),pads:Array.from(X().subarray(Number(W)>>>0,4+(Number(W)>>>0)>>>0)),strides:Array.from(X().subarray(Number(ne)>>>0,2+(Number(ne)>>>0)>>>0)),wIsConst:()=>!!N()[Ee>>>0],outputPadding:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],outputShape:it?Array.from(X().subarray(Number(it)>>>0,Number(_t)>>>0)):[],activation:zt(Bt)})},1327742:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt,Ir)=>{n.hc("ConvTranspose",d,{format:Ee?"NHWC":"NCHW",autoPad:m,dilations:[x],group:C,kernelShape:[A],pads:[W,ne],strides:[ye],wIsConst:()=>!!N()[ze>>>0],outputPadding:Ye?Array.from(X().subarray(Number(Ye)>>>0,Number(it)>>>0)):[],outputShape:_t?Array.from(X().subarray(Number(_t)>>>0,Number(Bt)>>>0)):[],activation:zt(Ir)})},1328175:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt)=>{n.hc("ConvTranspose",d,{format:ye?"NHWC":"NCHW",autoPad:m,dilations:Array.from(X().subarray(Number(x)>>>0,2+(Number(x)>>>0)>>>0)),group:C,kernelShape:Array.from(X().subarray(Number(A)>>>0,2+(Number(A)>>>0)>>>0)),pads:Array.from(X().subarray(Number(W)>>>0,4+(Number(W)>>>0)>>>0)),strides:Array.from(X().subarray(Number(ne)>>>0,2+(Number(ne)>>>0)>>>0)),wIsConst:()=>!!N()[Ee>>>0],outputPadding:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],outputShape:it?Array.from(X().subarray(Number(it)>>>0,Number(_t)>>>0)):[],activation:zt(Bt)})},1328836:(d,m)=>{n.hc("GlobalAveragePool",d,{format:m?"NHWC":"NCHW"})},1328927:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt)=>{n.hc("AveragePool",d,{format:Bt?"NHWC":"NCHW",auto_pad:m,ceil_mode:x,count_include_pad:C,storage_order:A,dilations:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],kernel_shape:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],pads:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],strides:it?Array.from(X().subarray(Number(it)>>>0,Number(_t)>>>0)):[]})},1329406:(d,m)=>{n.hc("GlobalAveragePool",d,{format:m?"NHWC":"NCHW"})},1329497:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt)=>{n.hc("AveragePool",d,{format:Bt?"NHWC":"NCHW",auto_pad:m,ceil_mode:x,count_include_pad:C,storage_order:A,dilations:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],kernel_shape:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],pads:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],strides:it?Array.from(X().subarray(Number(it)>>>0,Number(_t)>>>0)):[]})},1329976:(d,m)=>{n.hc("GlobalMaxPool",d,{format:m?"NHWC":"NCHW"})},1330063:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt)=>{n.hc("MaxPool",d,{format:Bt?"NHWC":"NCHW",auto_pad:m,ceil_mode:x,count_include_pad:C,storage_order:A,dilations:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],kernel_shape:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],pads:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],strides:it?Array.from(X().subarray(Number(it)>>>0,Number(_t)>>>0)):[]})},1330538:(d,m)=>{n.hc("GlobalMaxPool",d,{format:m?"NHWC":"NCHW"})},1330625:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt)=>{n.hc("MaxPool",d,{format:Bt?"NHWC":"NCHW",auto_pad:m,ceil_mode:x,count_include_pad:C,storage_order:A,dilations:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],kernel_shape:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],pads:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],strides:it?Array.from(X().subarray(Number(it)>>>0,Number(_t)>>>0)):[]})},1331100:(d,m,x,C,A)=>{n.hc("Gemm",d,{alpha:m,beta:x,transA:C,transB:A})},1331204:d=>{n.hc("MatMul",d,void 0)},1331258:(d,m,x,C)=>{n.hc("ArgMax",d,{keepDims:!!m,selectLastIndex:!!x,axis:C})},1331366:(d,m,x,C)=>{n.hc("ArgMin",d,{keepDims:!!m,selectLastIndex:!!x,axis:C})},1331474:(d,m)=>{n.hc("Softmax",d,{axis:m})},1331537:(d,m)=>{n.hc("Concat",d,{axis:m})},1331597:(d,m,x,C,A)=>{n.hc("Split",d,{axis:m,numOutputs:x,splitSizes:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1331753:d=>{n.hc("Expand",d,void 0)},1331807:(d,m)=>{n.hc("Gather",d,{axis:Number(m)})},1331878:(d,m)=>{n.hc("GatherElements",d,{axis:Number(m)})},1331957:(d,m)=>{n.hc("GatherND",d,{batch_dims:Number(m)})},1332036:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye)=>{n.hc("Resize",d,{antialias:m,axes:x?Array.from(X().subarray(Number(x)>>>0,Number(C)>>>0)):[],coordinateTransformMode:zt(A),cubicCoeffA:W,excludeOutside:ne,extrapolationValue:ye,keepAspectRatioPolicy:zt(Ee),mode:zt(ze),nearestMode:zt(Ye)})},1332398:(d,m,x,C,A,W,ne)=>{n.hc("Slice",d,{starts:m?Array.from(X().subarray(Number(m)>>>0,Number(x)>>>0)):[],ends:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[],axes:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[]})},1332662:d=>{n.hc("Tile",d,void 0)},1332714:(d,m,x)=>{n.hc("InstanceNormalization",d,{epsilon:m,format:x?"NHWC":"NCHW"})},1332828:(d,m,x)=>{n.hc("InstanceNormalization",d,{epsilon:m,format:x?"NHWC":"NCHW"})},1332942:d=>{n.hc("Range",d,void 0)},1332995:(d,m)=>{n.hc("Einsum",d,{equation:zt(m)})},1333076:(d,m,x,C,A)=>{n.hc("Pad",d,{mode:m,value:x,pads:C?Array.from(X().subarray(Number(C)>>>0,Number(A)>>>0)):[]})},1333219:(d,m,x,C,A,W)=>{n.hc("BatchNormalization",d,{epsilon:m,momentum:x,spatial:!!A,trainingMode:!!C,format:W?"NHWC":"NCHW"})},1333388:(d,m,x,C,A,W)=>{n.hc("BatchNormalization",d,{epsilon:m,momentum:x,spatial:!!A,trainingMode:!!C,format:W?"NHWC":"NCHW"})},1333557:(d,m,x)=>{n.hc("CumSum",d,{exclusive:Number(m),reverse:Number(x)})},1333654:(d,m,x)=>{n.hc("DequantizeLinear",d,{axis:m,blockSize:x})},1333744:(d,m,x,C,A)=>{n.hc("GridSample",d,{align_corners:m,mode:zt(x),padding_mode:zt(C),format:A?"NHWC":"NCHW"})},1333914:(d,m,x,C,A)=>{n.hc("GridSample",d,{align_corners:m,mode:zt(x),padding_mode:zt(C),format:A?"NHWC":"NCHW"})},1334084:(d,m)=>{n.hc("ScatterND",d,{reduction:zt(m)})},1334169:(d,m,x,C,A,W,ne,ye,Ee)=>{n.hc("Attention",d,{numHeads:m,isUnidirectional:x,maskFilterValue:C,scale:A,doRotary:W,qkvHiddenSizes:ne?Array.from(X().subarray(Number(ye)>>>0,Number(ye)+ne>>>0)):[],pastPresentShareBuffer:!!Ee})},1334441:d=>{n.hc("BiasAdd",d,void 0)},1334496:d=>{n.hc("BiasSplitGelu",d,void 0)},1334557:d=>{n.hc("FastGelu",d,void 0)},1334613:(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt,Ir,Cs)=>{n.hc("Conv",d,{format:it?"NHWC":"NCHW",auto_pad:m,dilations:x?Array.from(X().subarray(Number(x)>>>0,Number(C)>>>0)):[],group:A,kernel_shape:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],pads:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],strides:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],w_is_const:()=>!!N()[Number(_t)>>>0],activation:zt(Bt),activation_params:Ir?Array.from(_e().subarray(Number(Ir)>>>0,Number(Cs)>>>0)):[]})},1335197:d=>{n.hc("Gelu",d,void 0)},1335249:(d,m,x,C,A,W,ne,ye,Ee)=>{n.hc("GroupQueryAttention",d,{numHeads:m,kvNumHeads:x,scale:C,softcap:A,doRotary:W,rotaryInterleaved:ne,smoothSoftmax:ye,localWindowSize:Ee})},1335466:(d,m,x,C)=>{n.hc("LayerNormalization",d,{axis:m,epsilon:x,simplified:!!C})},1335577:(d,m,x,C)=>{n.hc("LayerNormalization",d,{axis:m,epsilon:x,simplified:!!C})},1335688:(d,m,x,C,A,W)=>{n.hc("MatMulNBits",d,{k:m,n:x,accuracyLevel:C,bits:A,blockSize:W})},1335815:(d,m,x,C,A,W)=>{n.hc("MultiHeadAttention",d,{numHeads:m,isUnidirectional:x,maskFilterValue:C,scale:A,doRotary:W})},1335974:(d,m)=>{n.hc("QuickGelu",d,{alpha:m})},1336038:(d,m,x,C,A)=>{n.hc("RotaryEmbedding",d,{interleaved:!!m,numHeads:x,rotaryEmbeddingDim:C,scale:A})},1336177:(d,m,x)=>{n.hc("SkipLayerNormalization",d,{epsilon:m,simplified:!!x})},1336279:(d,m,x)=>{n.hc("SkipLayerNormalization",d,{epsilon:m,simplified:!!x})},1336381:(d,m,x,C)=>{n.hc("GatherBlockQuantized",d,{gatherAxis:m,quantizeAxis:x,blockSize:C})},1336502:d=>{n.Wd(d)},1336536:(d,m)=>n.Zd(Number(d),Number(m),n.Cd.be,n.Cd.errors)};function We(d,m,x){return ko(async()=>{await n.Ud(Number(d),Number(m),Number(x))})}function D(){return typeof wasmOffsetConverter<"u"}class ee{constructor(m){re(this,"name","ExitStatus");this.message=`Program terminated with exit(${m})`,this.status=m}}var B=d=>{d.terminate(),d.onmessage=()=>{}},te=[],de=d=>{qe.length==0&&(es(),ar(qe[0]));var m=qe.pop();if(!m)return 6;Xe.push(m),wt[d.xd]=m,m.xd=d.xd;var x={yd:"run",de:d.ce,Fd:d.Fd,xd:d.xd};return m.postMessage(x,d.Ld),0},be=0,ve=(d,m,...x)=>{for(var C=2*x.length,A=ft(),W=yn(8*C),ne=W>>>3,ye=0;ye>>0]=Ee)}return d=Jn(d,0,C,W,m),ht(A),d};function Re(d){if(c)return ve(0,1,d);if(T=d,!(0{if(T=d,c)throw Fe(d),"unwind";Re(d)},qe=[],Xe=[],ut=[],wt={},nr=d=>{var m=d.xd;delete wt[m],qe.push(d),Xe.splice(Xe.indexOf(d),1),d.xd=0,Yo(m)};function jt(){ut.forEach(d=>d())}var ar=d=>new Promise(m=>{d.onmessage=A=>{var W=(A=A.data).yd;if(A.Ed&&A.Ed!=wn()){var ne=wt[A.Ed];ne?ne.postMessage(A,A.Ld):P(`Internal error! Worker sent a message "${W}" to target pthread ${A.Ed}, but that thread no longer exists!`)}else W==="checkMailbox"?Vt():W==="spawnThread"?de(A):W==="cleanupThread"?nr(wt[A.ee]):W==="loaded"?(d.loaded=!0,m(d)):W==="alert"?alert(`Thread ${A.fe}: ${A.text}`):A.target==="setimmediate"?d.postMessage(A):W==="callHandler"?n[A.Nd](...A.args):W&&P(`worker sent an unknown command ${W}`)},d.onerror=A=>{throw P(`worker sent an error! ${A.filename}:${A.lineno}: ${A.message}`),A};var x,C=[];for(x of[])n.propertyIsEnumerable(x)&&C.push(x);d.postMessage({yd:"load",Od:C,he:b,ie:w})});function es(){var d=new Worker((()=>{let m=URL;return import.meta.url>"file:"&&import.meta.url<"file;"?new m("ort.bundle.min.mjs",import.meta.url):new URL(import.meta.url)})(),{type:"module",workerData:"em-pthread",name:"em-pthread"});qe.push(d)}var ks=d=>{K();var m=we()[d+52>>>2>>>0];d=we()[d+56>>>2>>>0],ei(m,m-d),ht(m)},Or=(d,m)=>{be=0,d=ro(d,m),0>>=0);if(N()[m.wd+12>>>0]==0){var x=1;N()[m.wd+12>>>0]=x}return x=0,N()[m.wd+13>>>0]=x,ts.push(m),eo(d),si(d)}var Br=0,dt=()=>{gt(0,0);var d=ts.pop();ti(d.Gd),Br=0};class Gr{constructor(m){this.Gd=m,this.wd=m-24}}function Rr(d){throw Br||(Br=d>>>0),Br}var rs=d=>{var m=Br;if(!m)return Rs(0),0;var x=new Gr(m);we()[x.wd+16>>>2>>>0]=m;var C=we()[x.wd+4>>>2>>>0];if(!C)return Rs(0),m;for(var A of d){if(A===0||A===C)break;if(ri(A,C,x.wd+16))return Rs(A),m}return Rs(C),m};function bs(){return rs([])}function vs(d){return rs([d>>>0])}function xs(d,m){return rs([d>>>0,m>>>0])}var As=()=>{var d=ts.pop();d||Ie("no exception to throw");var m=d.Gd;if(N()[d.wd+13>>>0]==0){ts.push(d);var x=1;N()[d.wd+13>>>0]=x,x=0,N()[d.wd+12>>>0]=x}throw Br=m};function hr(d,m,x){var C=new Gr(d>>>=0);throw m>>>=0,x>>>=0,we()[C.wd+16>>>2>>>0]=0,we()[C.wd+4>>>2>>>0]=m,we()[C.wd+8>>>2>>>0]=x,Br=d}function Be(d,m,x,C){return c?ve(2,1,d,m,x,C):et(d,m,x,C)}function et(d,m,x,C){if(d>>>=0,x>>>=0,C>>>=0,p===void 0)return 6;var A=[];return c&&A.length===0?Be(d,m>>>=0,x,C):(d={ce:x,xd:d,Fd:C,Ld:A},c?(d.yd="spawnThread",postMessage(d,A),0):de(d))}var ot=typeof TextDecoder<"u"?new TextDecoder:void 0,rr=(d,m=0,x=NaN)=>{var C=(m>>>=0)+x;for(x=m;d[x]&&!(x>=C);)++x;if(16(A=(240&A)==224?(15&A)<<12|W<<6|ne:(7&A)<<18|W<<12|ne<<6|63&d[m++])?C+=String.fromCharCode(A):(A-=65536,C+=String.fromCharCode(55296|A>>10,56320|1023&A))}}else C+=String.fromCharCode(A)}return C},zt=(d,m)=>(d>>>=0)?rr(O(),d,m):"";function Sr(d,m,x){return c?ve(3,1,d,m,x):0}function ss(d,m){if(c)return ve(4,1,d,m)}var ns=d=>{for(var m=0,x=0;x=C?m++:2047>=C?m+=2:55296<=C&&57343>=C?(m+=4,++x):m+=3}return m},Tr=(d,m,x)=>{var C=O();if(m>>>=0,0=ne&&(ne=65536+((1023&ne)<<10)|1023&d.charCodeAt(++W)),127>=ne){if(m>=x)break;C[m++>>>0]=ne}else{if(2047>=ne){if(m+1>=x)break;C[m++>>>0]=192|ne>>6}else{if(65535>=ne){if(m+2>=x)break;C[m++>>>0]=224|ne>>12}else{if(m+3>=x)break;C[m++>>>0]=240|ne>>18,C[m++>>>0]=128|ne>>12&63}C[m++>>>0]=128|ne>>6&63}C[m++>>>0]=128|63&ne}}C[m>>>0]=0,d=m-A}else d=0;return d};function os(d,m){if(c)return ve(5,1,d,m)}function is(d,m,x){if(c)return ve(6,1,d,m,x)}function Kr(d,m,x){return c?ve(7,1,d,m,x):0}function Ts(d,m){if(c)return ve(8,1,d,m)}function Ws(d,m,x){if(c)return ve(9,1,d,m,x)}function Gs(d,m,x,C){if(c)return ve(10,1,d,m,x,C)}function Ks(d,m,x,C){if(c)return ve(11,1,d,m,x,C)}function Hs(d,m,x,C){if(c)return ve(12,1,d,m,x,C)}function as(d){if(c)return ve(13,1,d)}function qs(d,m){if(c)return ve(14,1,d,m)}function Qs(d,m,x){if(c)return ve(15,1,d,m,x)}var Xs,Dr,Es=()=>Ie(""),Mr=d=>{for(var m="";O()[d>>>0];)m+=Xs[O()[d++>>>0]];return m},Fs={},Os={};function $r(d,m,x={}){return function(C,A,W={}){var ne=A.name;if(!C)throw new Dr(`type "${ne}" must have a positive integer typeid pointer`);if(Os.hasOwnProperty(C)){if(W.Pd)return;throw new Dr(`Cannot register type '${ne}' twice`)}Os[C]=A,Fs.hasOwnProperty(C)&&(A=Fs[C],delete Fs[C],A.forEach(ye=>ye()))}(d,m,x)}var Hr=(d,m,x)=>{switch(m){case 1:return x?C=>N()[C>>>0]:C=>O()[C>>>0];case 2:return x?C=>G()[C>>>1>>>0]:C=>se()[C>>>1>>>0];case 4:return x?C=>X()[C>>>2>>>0]:C=>we()[C>>>2>>>0];case 8:return x?C=>H[C>>>3]:C=>J[C>>>3];default:throw new TypeError(`invalid integer width (${m}): ${d}`)}};function un(d,m,x){x>>>=0,$r(d>>>=0,{name:m=Mr(m>>>0),fromWireType:C=>C,toWireType:function(C,A){if(typeof A!="bigint"&&typeof A!="number")throw A=A===null?"null":(C=typeof A)=="object"||C==="array"||C==="function"?A.toString():""+A,new TypeError(`Cannot convert "${A}" to ${this.name}`);return typeof A=="number"&&(A=BigInt(A)),A},zd:Lr,readValueFromPointer:Hr(m,x,m.indexOf("u")==-1),Ad:null})}var Lr=8;function pn(d,m,x,C){$r(d>>>=0,{name:m=Mr(m>>>0),fromWireType:function(A){return!!A},toWireType:function(A,W){return W?x:C},zd:Lr,readValueFromPointer:function(A){return this.fromWireType(O()[A>>>0])},Ad:null})}var Ds=[],kr=[];function qr(d){9<(d>>>=0)&&--kr[d+1]==0&&(kr[d]=void 0,Ds.push(d))}var lr=d=>{if(!d)throw new Dr("Cannot use deleted val. handle = "+d);return kr[d]},mr=d=>{switch(d){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:let m=Ds.pop()||kr.length;return kr[m]=d,kr[m+1]=1,m}};function Ls(d){return this.fromWireType(we()[d>>>2>>>0])}var hn={name:"emscripten::val",fromWireType:d=>{var m=lr(d);return qr(d),m},toWireType:(d,m)=>mr(m),zd:Lr,readValueFromPointer:Ls,Ad:null};function Ps(d){return $r(d>>>0,hn)}var mn=(d,m)=>{switch(m){case 4:return function(x){return this.fromWireType(_e()[x>>>2>>>0])};case 8:return function(x){return this.fromWireType(ke()[x>>>3>>>0])};default:throw new TypeError(`invalid float width (${m}): ${d}`)}};function pe(d,m,x){x>>>=0,$r(d>>>=0,{name:m=Mr(m>>>0),fromWireType:C=>C,toWireType:(C,A)=>A,zd:Lr,readValueFromPointer:mn(m,x),Ad:null})}function F(d,m,x,C,A){if(d>>>=0,x>>>=0,m=Mr(m>>>0),A===-1&&(A=4294967295),A=ye=>ye,C===0){var W=32-8*x;A=ye=>ye<>>W}var ne=m.includes("unsigned")?function(ye,Ee){return Ee>>>0}:function(ye,Ee){return Ee};$r(d,{name:m,fromWireType:A,toWireType:ne,zd:Lr,readValueFromPointer:Hr(m,x,C!==0),Ad:null})}function V(d,m,x){function C(W){var ne=we()[W>>>2>>>0];return W=we()[W+4>>>2>>>0],new A(N().buffer,W,ne)}var A=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][m];$r(d>>>=0,{name:x=Mr(x>>>0),fromWireType:C,zd:Lr,readValueFromPointer:C},{Pd:!0})}function Y(d,m){$r(d>>>=0,{name:m=Mr(m>>>0),fromWireType:function(x){for(var C,A=we()[x>>>2>>>0],W=x+4,ne=W,ye=0;ye<=A;++ye){var Ee=W+ye;ye!=A&&O()[Ee>>>0]!=0||(ne=zt(ne,Ee-ne),C===void 0?C=ne:(C+="\0",C+=ne),ne=Ee+1)}return Nr(x),C},toWireType:function(x,C){C instanceof ArrayBuffer&&(C=new Uint8Array(C));var A=typeof C=="string";if(!(A||C instanceof Uint8Array||C instanceof Uint8ClampedArray||C instanceof Int8Array))throw new Dr("Cannot pass non-string to std::string");var W=A?ns(C):C.length,ne=tn(4+W+1),ye=ne+4;if(we()[ne>>>2>>>0]=W,A)Tr(C,ye,W+1);else if(A)for(A=0;A>>0]=Ee}else for(A=0;A>>0]=C[A];return x!==null&&x.push(Nr,ne),ne},zd:Lr,readValueFromPointer:Ls,Ad(x){Nr(x)}})}var le=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,ue=(d,m)=>{for(var x=d>>1,C=x+m/2;!(x>=C)&&se()[x>>>0];)++x;if(32<(x<<=1)-d&&le)return le.decode(O().slice(d,x));for(x="",C=0;!(C>=m/2);++C){var A=G()[d+2*C>>>1>>>0];if(A==0)break;x+=String.fromCharCode(A)}return x},Ce=(d,m,x)=>{if(x??(x=2147483647),2>x)return 0;var C=m;x=(x-=2)<2*d.length?x/2:d.length;for(var A=0;A>>1>>>0]=W,m+=2}return G()[m>>>1>>>0]=0,m-C},Ue=d=>2*d.length,Qe=(d,m)=>{for(var x=0,C="";!(x>=m/4);){var A=X()[d+4*x>>>2>>>0];if(A==0)break;++x,65536<=A?(A-=65536,C+=String.fromCharCode(55296|A>>10,56320|1023&A)):C+=String.fromCharCode(A)}return C},Ke=(d,m,x)=>{if(m>>>=0,x??(x=2147483647),4>x)return 0;var C=m;x=C+x-4;for(var A=0;A=W&&(W=65536+((1023&W)<<10)|1023&d.charCodeAt(++A)),X()[m>>>2>>>0]=W,(m+=4)+4>x)break}return X()[m>>>2>>>0]=0,m-C},Ze=d=>{for(var m=0,x=0;x=C&&++x,m+=4}return m};function pt(d,m,x){if(d>>>=0,m>>>=0,x=Mr(x>>>=0),m===2)var C=ue,A=Ce,W=Ue,ne=ye=>se()[ye>>>1>>>0];else m===4&&(C=Qe,A=Ke,W=Ze,ne=ye=>we()[ye>>>2>>>0]);$r(d,{name:x,fromWireType:ye=>{for(var Ee,ze=we()[ye>>>2>>>0],Ye=ye+4,it=0;it<=ze;++it){var _t=ye+4+it*m;it!=ze&&ne(_t)!=0||(Ye=C(Ye,_t-Ye),Ee===void 0?Ee=Ye:(Ee+="\0",Ee+=Ye),Ye=_t+m)}return Nr(ye),Ee},toWireType:(ye,Ee)=>{if(typeof Ee!="string")throw new Dr(`Cannot pass non-string to C++ string type ${x}`);var ze=W(Ee),Ye=tn(4+ze+m);return we()[Ye>>>2>>>0]=ze/m,A(Ee,Ye+4,ze+m),ye!==null&&ye.push(Nr,Ye),Ye},zd:Lr,readValueFromPointer:Ls,Ad(ye){Nr(ye)}})}function Ct(d,m){$r(d>>>=0,{Qd:!0,name:m=Mr(m>>>0),zd:0,fromWireType:()=>{},toWireType:()=>{}})}function $t(d){Xn(d>>>0,!l,1,!a,131072,!1),jt()}var Ut=d=>{if(!ce)try{if(d(),!(0>>=0,typeof Atomics.ge=="function"&&(Atomics.ge(X(),d>>>2,d).value.then(Vt),d+=128,Atomics.store(X(),d>>>2,1))}var Vt=()=>{var d=wn();d&&(At(d),Ut(Zo))};function br(d,m){(d>>>=0)==m>>>0?setTimeout(Vt):c?postMessage({Ed:d,yd:"checkMailbox"}):(d=wt[d])&&d.postMessage({yd:"checkMailbox"})}var fr=[];function Qr(d,m,x,C,A){for(m>>>=0,C/=2,fr.length=C,x=A>>>0>>>3,A=0;A>>0];return(m?Ne[m]:ja[d])(...fr)}var vr=()=>{be=0};function ls(d){d>>>=0,c?postMessage({yd:"cleanupThread",ee:d}):nr(wt[d])}function Wt(d){}var Yt=(d,m)=>{var x=Os[d];if(x===void 0)throw d=Xo(d),x=Mr(d),Nr(d),new Dr(`${m} has unknown type ${x}`);return x},_r=(d,m,x)=>{var C=[];return d=d.toWireType(C,x),C.length&&(we()[m>>>2>>>0]=mr(C)),d};function Xr(d,m,x){return m>>>=0,x>>>=0,d=lr(d>>>0),m=Yt(m,"emval::as"),_r(m,x,d)}function ds(d,m){return m>>>=0,d=lr(d>>>0),(m=Yt(m,"emval::as")).toWireType(null,d)}var Ht=d=>{try{d()}catch(m){Ie(m)}},dr=0,Rt=null,Xt=0,qt=[],Zt={},or={},Js=0,Ys=null,fa=[];function ko(d){return function(m){if(!ce){if(dr===0){var x=!1,C=!1;m((A=0)=>{if(!ce&&(Xt=A,x=!0,C)){dr=2,Ht(()=>Di(Rt)),typeof MainLoop<"u"&&MainLoop.Md&&MainLoop.resume(),A=!1;try{var W=function(){var Ee=X()[Rt+8>>>2>>>0];return Ee=Oe[or[Ee]],--be,Ee()}()}catch(Ee){W=Ee,A=!0}var ne=!1;if(!Rt){var ye=Ys;ye&&(Ys=null,(A?ye.reject:ye.resolve)(W),ne=!0)}if(A&&!ne)throw W}}),C=!0,x||(dr=1,Rt=function(){var A=tn(65548),W=A+12;we()[A>>>2>>>0]=W,we()[A+4>>>2>>>0]=W+65536,W=qt[0];var ne=Zt[W];return ne===void 0&&(ne=Js++,Zt[W]=ne,or[ne]=W),W=ne,X()[A+8>>>2>>>0]=W,A}(),typeof MainLoop<"u"&&MainLoop.Md&&MainLoop.pause(),Ht(()=>Fi(Rt)))}else dr===2?(dr=0,Ht(Li),Nr(Rt),Rt=null,fa.forEach(Ut)):Ie(`invalid state: ${dr}`);return Xt}}(m=>{d().then(m)})}function _a(d){return d>>>=0,ko(async()=>{var m=await lr(d);return mr(m)})}var cs=[];function ga(d,m,x,C){return x>>>=0,C>>>=0,(d=cs[d>>>0])(null,m=lr(m>>>0),x,C)}var wa={},fn=d=>{var m=wa[d];return m===void 0?Mr(d):m};function ya(d,m,x,C,A){return x>>>=0,C>>>=0,A>>>=0,(d=cs[d>>>0])(m=lr(m>>>0),m[x=fn(x)],C,A)}var Io=()=>typeof globalThis=="object"?globalThis:Function("return this")();function Ao(d){return(d>>>=0)==0?mr(Io()):(d=fn(d),mr(Io()[d]))}var Ma=d=>{var m=cs.length;return cs.push(d),m},ba=(d,m)=>{for(var x=Array(d),C=0;C>>2>>>0],"parameter "+C);return x},Rn=(d,m)=>Object.defineProperty(m,"name",{value:d});function va(d,m,x){var C=(m=ba(d,m>>>0)).shift();d--;var A=`return function (obj, func, destructorsRef, args) { -`,W=0,ne=[];x===0&&ne.push("obj");for(var ye=["retType"],Ee=[C],ze=0;zeYe.name).join(", ")}) => ${C.name}>`,Ma(Rn(x,d))}function Fo(d){return d=fn(d>>>0),mr(n[d])}function xa(d,m){return m>>>=0,d=lr(d>>>0),m=lr(m),mr(d[m])}function Oo(d){9<(d>>>=0)&&(kr[d+1]+=1)}function dd(){return mr([])}function Ta(d){d=lr(d>>>0);for(var m=Array(d.length),x=0;x>>0))}function Ea(){return mr({})}function Nn(d){for(var m=lr(d>>>=0);m.length;){var x=m.pop();m.pop()(x)}qr(d)}function Pa(d,m,x){m>>>=0,x>>>=0,d=lr(d>>>0),m=lr(m),x=lr(x),d[m]=x}function Ca(d,m){return m>>>=0,d=(d=Yt(d>>>0,"_emval_take_value")).readValueFromPointer(m),mr(d)}function Sa(d,m){d=-9007199254740992>d||9007199254740992>>=0,d=new Date(1e3*d),X()[m>>>2>>>0]=d.getUTCSeconds(),X()[m+4>>>2>>>0]=d.getUTCMinutes(),X()[m+8>>>2>>>0]=d.getUTCHours(),X()[m+12>>>2>>>0]=d.getUTCDate(),X()[m+16>>>2>>>0]=d.getUTCMonth(),X()[m+20>>>2>>>0]=d.getUTCFullYear()-1900,X()[m+24>>>2>>>0]=d.getUTCDay(),d=(d.getTime()-Date.UTC(d.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,X()[m+28>>>2>>>0]=d}var Lo=d=>d%4==0&&(d%100!=0||d%400==0),zo=[0,31,60,91,121,152,182,213,244,274,305,335],Bo=[0,31,59,90,120,151,181,212,243,273,304,334];function $a(d,m){d=-9007199254740992>d||9007199254740992>>=0,d=new Date(1e3*d),X()[m>>>2>>>0]=d.getSeconds(),X()[m+4>>>2>>>0]=d.getMinutes(),X()[m+8>>>2>>>0]=d.getHours(),X()[m+12>>>2>>>0]=d.getDate(),X()[m+16>>>2>>>0]=d.getMonth(),X()[m+20>>>2>>>0]=d.getFullYear()-1900,X()[m+24>>>2>>>0]=d.getDay();var x=(Lo(d.getFullYear())?zo:Bo)[d.getMonth()]+d.getDate()-1|0;X()[m+28>>>2>>>0]=x,X()[m+36>>>2>>>0]=-60*d.getTimezoneOffset(),x=new Date(d.getFullYear(),6,1).getTimezoneOffset();var C=new Date(d.getFullYear(),0,1).getTimezoneOffset();d=0|(x!=C&&d.getTimezoneOffset()==Math.min(C,x)),X()[m+32>>>2>>>0]=d}function jn(d){d>>>=0;var m=new Date(X()[d+20>>>2>>>0]+1900,X()[d+16>>>2>>>0],X()[d+12>>>2>>>0],X()[d+8>>>2>>>0],X()[d+4>>>2>>>0],X()[d>>>2>>>0],0),x=X()[d+32>>>2>>>0],C=m.getTimezoneOffset(),A=new Date(m.getFullYear(),6,1).getTimezoneOffset(),W=new Date(m.getFullYear(),0,1).getTimezoneOffset(),ne=Math.min(W,A);return 0>x?X()[d+32>>>2>>>0]=+(A!=W&&ne==C):0>>2>>>0]=m.getDay(),x=(Lo(m.getFullYear())?zo:Bo)[m.getMonth()]+m.getDate()-1|0,X()[d+28>>>2>>>0]=x,X()[d>>>2>>>0]=m.getSeconds(),X()[d+4>>>2>>>0]=m.getMinutes(),X()[d+8>>>2>>>0]=m.getHours(),X()[d+12>>>2>>>0]=m.getDate(),X()[d+16>>>2>>>0]=m.getMonth(),X()[d+20>>>2>>>0]=m.getYear(),d=m.getTime(),BigInt(isNaN(d)?-1:d/1e3)}function Vn(d,m,x,C,A,W,ne){return c?ve(16,1,d,m,x,C,A,W,ne):-52}function Ro(d,m,x,C,A,W){if(c)return ve(17,1,d,m,x,C,A,W)}var zs={},Bs=()=>performance.timeOrigin+performance.now();function No(d,m){if(c)return ve(18,1,d,m);if(zs[d]&&(clearTimeout(zs[d].id),delete zs[d]),!m)return 0;var x=setTimeout(()=>{delete zs[d],Ut(()=>Zn(d,performance.timeOrigin+performance.now()))},m);return zs[d]={id:x,ke:m},0}function cd(d,m,x,C){d>>>=0,m>>>=0,x>>>=0,C>>>=0;var A=new Date().getFullYear(),W=new Date(A,0,1).getTimezoneOffset();A=new Date(A,6,1).getTimezoneOffset();var ne=Math.max(W,A);we()[d>>>2>>>0]=60*ne,X()[m>>>2>>>0]=+(W!=A),d=(m=ye=>{var Ee=Math.abs(ye);return`UTC${0<=ye?"-":"+"}${String(Math.floor(Ee/60)).padStart(2,"0")}${String(Ee%60).padStart(2,"0")}`})(W),m=m(A),ADate.now();function ud(d,m,x){return 0<=d&&3>=d?(d===0?d=Date.now():d=performance.timeOrigin+performance.now(),H[x>>>0>>>3]=BigInt(Math.round(1e6*d)),0):28}var Un=[],Wn=(d,m)=>{Un.length=0;for(var x;x=O()[d++>>>0];){var C=x!=105;m+=(C&=x!=112)&&m%8?4:0,Un.push(x==112?we()[m>>>2>>>0]:x==106?H[m>>>3]:x==105?X()[m>>>2>>>0]:ke()[m>>>3>>>0]),m+=C?8:4}return Un};function Ia(d,m,x){return d>>>=0,m=Wn(m>>>0,x>>>0),Ne[d](...m)}function Aa(d,m,x){return d>>>=0,m=Wn(m>>>0,x>>>0),Ne[d](...m)}var Fa=()=>{};function Oa(d,m){return P(zt(d>>>0,m>>>0))}var Da=()=>{throw be+=1,"unwind"};function Gn(){return 4294901760}var La=()=>navigator.hardwareConcurrency;function za(){return Ie("Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER"),0}function Ba(d){d>>>=0;var m=O().length;if(d<=m||4294901760=x;x*=2){var C=m*(1+.2/x);C=Math.min(C,d+100663296);e:{C=(Math.min(4294901760,65536*Math.ceil(Math.max(d,C)/65536))-b.buffer.byteLength+65535)/65536|0;try{b.grow(C),K();var A=1;break e}catch{}A=void 0}if(A)return!0}return!1}var Zs=()=>(Ie("Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER"),0),en={},jo=d=>{d.forEach(m=>{Zs()})};function Vo(){var d=Error().stack.toString().split(` -`);return d[0]=="Error"&&d.shift(),jo(d),en.Kd=Zs(),en.ae=d,en.Kd}function Ra(d,m,x){if(d>>>=0,m>>>=0,en.Kd==d)var C=en.ae;else(C=Error().stack.toString().split(` -`))[0]=="Error"&&C.shift(),jo(C);for(var A=3;C[A]&&Zs()!=d;)++A;for(d=0;d>>2>>>0]=Zs();return d}var Kn,_n={},Uo=()=>{if(!Kn){var d,m={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(d in _n)_n[d]===void 0?delete m[d]:m[d]=_n[d];var x=[];for(d in m)x.push(`${d}=${m[d]}`);Kn=x}return Kn};function Wo(d,m){if(c)return ve(19,1,d,m);d>>>=0,m>>>=0;var x=0;return Uo().forEach((C,A)=>{var W=m+x;for(A=we()[d+4*A>>>2>>>0]=W,W=0;W>>0]=C.charCodeAt(W);N()[A>>>0]=0,x+=C.length+1}),0}function Hn(d,m){if(c)return ve(20,1,d,m);d>>>=0,m>>>=0;var x=Uo();we()[d>>>2>>>0]=x.length;var C=0;return x.forEach(A=>C+=A.length+1),we()[m>>>2>>>0]=C,0}function Go(d){return c?ve(21,1,d):52}function Ko(d,m,x,C){return c?ve(22,1,d,m,x,C):52}function qn(d,m,x,C){return c?ve(23,1,d,m,x,C):70}var Na=[null,[],[]];function Ho(d,m,x,C){if(c)return ve(24,1,d,m,x,C);m>>>=0,x>>>=0,C>>>=0;for(var A=0,W=0;W>>2>>>0],ye=we()[m+4>>>2>>>0];m+=8;for(var Ee=0;Ee>>0],Ye=Na[d];ze===0||ze===10?((d===1?$:P)(rr(Ye)),Ye.length=0):Ye.push(ze)}A+=ye}return we()[C>>>2>>>0]=A,0}function qo(d){return d>>>0}c||function(){for(var d=n.numThreads-1;d--;)es();te.unshift(()=>{Pe++,function(m){c?m():Promise.all(qe.map(ar)).then(m)}(()=>Ae())})}();for(var Qo=Array(256),gn=0;256>gn;++gn)Qo[gn]=String.fromCharCode(gn);Xs=Qo,Dr=n.BindingError=class extends Error{constructor(d){super(d),this.name="BindingError"}},n.InternalError=class extends Error{constructor(d){super(d),this.name="InternalError"}},kr.push(0,1,void 0,1,null,1,!0,1,!1,1),n.count_emval_handles=()=>kr.length/2-5-Ds.length;var Oe,ja=[Re,Fe,Be,Sr,ss,os,is,Kr,Ts,Ws,Gs,Ks,Hs,as,qs,Qs,Vn,Ro,No,Wo,Hn,Go,Ko,qn,Ho];(async function(){function d(C,A){return Oe=C.exports,Oe=function(){var W=Oe,ne={};for(let[ye,Ee]of Object.entries(W))ne[ye]=typeof Ee=="function"?(...ze)=>{qt.push(ye);try{return Ee(...ze)}finally{ce||(qt.pop(),Rt&&dr===1&&qt.length===0&&(dr=0,be+=1,Ht(Oi),typeof Fibers<"u"&&Fibers.le()))}}:Ee;return ne}(),Oe=function(){var W=Oe,ne=Ee=>ze=>Ee(ze)>>>0,ye=Ee=>()=>Ee()>>>0;return(W=Object.assign({},W)).Cb=ne(W.Cb),W.fc=ye(W.fc),W.ic=ne(W.ic),W.vc=ne(W.vc),W.wc=ye(W.wc),W.Ac=ne(W.Ac),W}(),ut.push(Oe.jc),w=A,Ae(),Oe}Pe++;var m=Le();if(n.instantiateWasm)return new Promise(C=>{n.instantiateWasm(m,(A,W)=>{d(A,W),C(A.exports)})});if(c)return new Promise(C=>{He=A=>{var W=new WebAssembly.Instance(A,Le());C(d(W,A))}});me??(me=n.locateFile?n.locateFile?n.locateFile("ort-wasm-simd-threaded.jsep.wasm",I):I+"ort-wasm-simd-threaded.jsep.wasm":new URL("/assets/ort-wasm-simd-threaded.jsep-BAR87mbD.wasm",import.meta.url).href);try{var x=await async function(C){var A=me;if(!ae&&typeof WebAssembly.instantiateStreaming=="function"&&!he(A))try{var W=fetch(A,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(W,C)}catch(ne){P(`wasm streaming compile failed: ${ne}`),P("falling back to ArrayBuffer instantiation")}return async function(ne,ye){try{var Ee=await async function(ze){if(!ae)try{var Ye=await h(ze);return new Uint8Array(Ye)}catch{}if(ze==me&&ae)ze=new Uint8Array(ae);else{if(!g)throw"both async and sync fetching of the wasm failed";ze=g(ze)}return ze}(ne);return await WebAssembly.instantiate(Ee,ye)}catch(ze){P(`failed to asynchronously prepare wasm: ${ze}`),Ie(ze)}}(A,C)}(m);return d(x.instance,x.module)}catch(C){return o(C),Promise.reject(C)}})();var Xo=d=>(Xo=Oe.Cb)(d),Qn=()=>(Qn=Oe.Db)();n._OrtInit=(d,m)=>(n._OrtInit=Oe.Eb)(d,m),n._OrtGetLastError=(d,m)=>(n._OrtGetLastError=Oe.Fb)(d,m),n._OrtCreateSessionOptions=(d,m,x,C,A,W,ne,ye,Ee,ze)=>(n._OrtCreateSessionOptions=Oe.Gb)(d,m,x,C,A,W,ne,ye,Ee,ze),n._OrtAppendExecutionProvider=(d,m)=>(n._OrtAppendExecutionProvider=Oe.Hb)(d,m),n._OrtAddFreeDimensionOverride=(d,m,x)=>(n._OrtAddFreeDimensionOverride=Oe.Ib)(d,m,x),n._OrtAddSessionConfigEntry=(d,m,x)=>(n._OrtAddSessionConfigEntry=Oe.Jb)(d,m,x),n._OrtReleaseSessionOptions=d=>(n._OrtReleaseSessionOptions=Oe.Kb)(d),n._OrtCreateSession=(d,m,x)=>(n._OrtCreateSession=Oe.Lb)(d,m,x),n._OrtReleaseSession=d=>(n._OrtReleaseSession=Oe.Mb)(d),n._OrtGetInputOutputCount=(d,m,x)=>(n._OrtGetInputOutputCount=Oe.Nb)(d,m,x),n._OrtGetInputName=(d,m)=>(n._OrtGetInputName=Oe.Ob)(d,m),n._OrtGetOutputName=(d,m)=>(n._OrtGetOutputName=Oe.Pb)(d,m),n._OrtFree=d=>(n._OrtFree=Oe.Qb)(d),n._OrtCreateTensor=(d,m,x,C,A,W)=>(n._OrtCreateTensor=Oe.Rb)(d,m,x,C,A,W),n._OrtGetTensorData=(d,m,x,C,A)=>(n._OrtGetTensorData=Oe.Sb)(d,m,x,C,A),n._OrtReleaseTensor=d=>(n._OrtReleaseTensor=Oe.Tb)(d),n._OrtCreateRunOptions=(d,m,x,C)=>(n._OrtCreateRunOptions=Oe.Ub)(d,m,x,C),n._OrtAddRunConfigEntry=(d,m,x)=>(n._OrtAddRunConfigEntry=Oe.Vb)(d,m,x),n._OrtReleaseRunOptions=d=>(n._OrtReleaseRunOptions=Oe.Wb)(d),n._OrtCreateBinding=d=>(n._OrtCreateBinding=Oe.Xb)(d),n._OrtBindInput=(d,m,x)=>(n._OrtBindInput=Oe.Yb)(d,m,x),n._OrtBindOutput=(d,m,x,C)=>(n._OrtBindOutput=Oe.Zb)(d,m,x,C),n._OrtClearBoundOutputs=d=>(n._OrtClearBoundOutputs=Oe._b)(d),n._OrtReleaseBinding=d=>(n._OrtReleaseBinding=Oe.$b)(d),n._OrtRunWithBinding=(d,m,x,C,A)=>(n._OrtRunWithBinding=Oe.ac)(d,m,x,C,A),n._OrtRun=(d,m,x,C,A,W,ne,ye)=>(n._OrtRun=Oe.bc)(d,m,x,C,A,W,ne,ye),n._OrtEndProfiling=d=>(n._OrtEndProfiling=Oe.cc)(d),n._JsepOutput=(d,m,x)=>(n._JsepOutput=Oe.dc)(d,m,x),n._JsepGetNodeName=d=>(n._JsepGetNodeName=Oe.ec)(d);var wn=()=>(wn=Oe.fc)(),Nr=n._free=d=>(Nr=n._free=Oe.gc)(d),tn=n._malloc=d=>(tn=n._malloc=Oe.ic)(d),Xn=(d,m,x,C,A,W)=>(Xn=Oe.kc)(d,m,x,C,A,W),Jo=()=>(Jo=Oe.lc)(),Jn=(d,m,x,C,A)=>(Jn=Oe.mc)(d,m,x,C,A),Yo=d=>(Yo=Oe.nc)(d),Yn=d=>(Yn=Oe.oc)(d),Zn=(d,m)=>(Zn=Oe.pc)(d,m),Zo=()=>(Zo=Oe.qc)(),gt=(d,m)=>(gt=Oe.rc)(d,m),Rs=d=>(Rs=Oe.sc)(d),ei=(d,m)=>(ei=Oe.tc)(d,m),ht=d=>(ht=Oe.uc)(d),yn=d=>(yn=Oe.vc)(d),ft=()=>(ft=Oe.wc)(),ti=d=>(ti=Oe.xc)(d),eo=d=>(eo=Oe.yc)(d),ri=(d,m,x)=>(ri=Oe.zc)(d,m,x),si=d=>(si=Oe.Ac)(d),to=n.dynCall_iii=(d,m,x)=>(to=n.dynCall_iii=Oe.Bc)(d,m,x),ni=n.dynCall_vi=(d,m)=>(ni=n.dynCall_vi=Oe.Cc)(d,m),ro=n.dynCall_ii=(d,m)=>(ro=n.dynCall_ii=Oe.Dc)(d,m),so=n.dynCall_vii=(d,m,x)=>(so=n.dynCall_vii=Oe.Ec)(d,m,x),oi=n.dynCall_iiii=(d,m,x,C)=>(oi=n.dynCall_iiii=Oe.Fc)(d,m,x,C),ii=n.dynCall_viii=(d,m,x,C)=>(ii=n.dynCall_viii=Oe.Gc)(d,m,x,C),no=n.dynCall_iiiii=(d,m,x,C,A)=>(no=n.dynCall_iiiii=Oe.Hc)(d,m,x,C,A),ai=n.dynCall_viiii=(d,m,x,C,A)=>(ai=n.dynCall_viiii=Oe.Ic)(d,m,x,C,A),li=n.dynCall_viiiiii=(d,m,x,C,A,W,ne)=>(li=n.dynCall_viiiiii=Oe.Jc)(d,m,x,C,A,W,ne),oo=n.dynCall_viiiiiii=(d,m,x,C,A,W,ne,ye)=>(oo=n.dynCall_viiiiiii=Oe.Kc)(d,m,x,C,A,W,ne,ye),di=n.dynCall_ji=(d,m)=>(di=n.dynCall_ji=Oe.Lc)(d,m),ci=n.dynCall_v=d=>(ci=n.dynCall_v=Oe.Mc)(d),io=n.dynCall_viiiii=(d,m,x,C,A,W)=>(io=n.dynCall_viiiii=Oe.Nc)(d,m,x,C,A,W),ui=n.dynCall_i=d=>(ui=n.dynCall_i=Oe.Oc)(d),pi=n.dynCall_fii=(d,m,x)=>(pi=n.dynCall_fii=Oe.Pc)(d,m,x),ao=n.dynCall_viiiiiiii=(d,m,x,C,A,W,ne,ye,Ee)=>(ao=n.dynCall_viiiiiiii=Oe.Qc)(d,m,x,C,A,W,ne,ye,Ee),hi=n.dynCall_viiiiiiiiii=(d,m,x,C,A,W,ne,ye,Ee,ze,Ye)=>(hi=n.dynCall_viiiiiiiiii=Oe.Rc)(d,m,x,C,A,W,ne,ye,Ee,ze,Ye),mi=n.dynCall_jiii=(d,m,x,C)=>(mi=n.dynCall_jiii=Oe.Sc)(d,m,x,C),lo=n.dynCall_dii=(d,m,x)=>(lo=n.dynCall_dii=Oe.Tc)(d,m,x),fi=n.dynCall_viiiiiiiii=(d,m,x,C,A,W,ne,ye,Ee,ze)=>(fi=n.dynCall_viiiiiiiii=Oe.Uc)(d,m,x,C,A,W,ne,ye,Ee,ze),_i=n.dynCall_viiiiiiiiiii=(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it)=>(_i=n.dynCall_viiiiiiiiiii=Oe.Vc)(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it),co=n.dynCall_iiiiii=(d,m,x,C,A,W)=>(co=n.dynCall_iiiiii=Oe.Wc)(d,m,x,C,A,W),gi=n.dynCall_iij=(d,m,x)=>(gi=n.dynCall_iij=Oe.Xc)(d,m,x),wi=n.dynCall_iiiiiiiiii=(d,m,x,C,A,W,ne,ye,Ee,ze)=>(wi=n.dynCall_iiiiiiiiii=Oe.Yc)(d,m,x,C,A,W,ne,ye,Ee,ze),yi=n.dynCall_iiiiiiiiiii=(d,m,x,C,A,W,ne,ye,Ee,ze,Ye)=>(yi=n.dynCall_iiiiiiiiiii=Oe.Zc)(d,m,x,C,A,W,ne,ye,Ee,ze,Ye),Mi=n.dynCall_vij=(d,m,x)=>(Mi=n.dynCall_vij=Oe._c)(d,m,x),uo=n.dynCall_iiif=(d,m,x,C)=>(uo=n.dynCall_iiif=Oe.$c)(d,m,x,C),bi=n.dynCall_iiij=(d,m,x,C)=>(bi=n.dynCall_iiij=Oe.ad)(d,m,x,C),vi=n.dynCall_fiii=(d,m,x,C)=>(vi=n.dynCall_fiii=Oe.bd)(d,m,x,C),po=n.dynCall_viiiiiiiiiiiii=(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt)=>(po=n.dynCall_viiiiiiiiiiiii=Oe.cd)(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt),xi=n.dynCall_vjiii=(d,m,x,C,A)=>(xi=n.dynCall_vjiii=Oe.dd)(d,m,x,C,A),Ti=n.dynCall_vif=(d,m,x)=>(Ti=n.dynCall_vif=Oe.ed)(d,m,x),ho=n.dynCall_iiiiiii=(d,m,x,C,A,W,ne)=>(ho=n.dynCall_iiiiiii=Oe.fd)(d,m,x,C,A,W,ne),Ei=n.dynCall_iiiij=(d,m,x,C,A)=>(Ei=n.dynCall_iiiij=Oe.gd)(d,m,x,C,A),Pi=n.dynCall_iiiiiiii=(d,m,x,C,A,W,ne,ye)=>(Pi=n.dynCall_iiiiiiii=Oe.hd)(d,m,x,C,A,W,ne,ye),mo=n.dynCall_viiiiiiiiiiii=(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t)=>(mo=n.dynCall_viiiiiiiiiiii=Oe.id)(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t),Ci=n.dynCall_diii=(d,m,x,C)=>(Ci=n.dynCall_diii=Oe.jd)(d,m,x,C),Si=n.dynCall_jiiii=(d,m,x,C,A)=>(Si=n.dynCall_jiiii=Oe.kd)(d,m,x,C,A),fo=n.dynCall_viiij=(d,m,x,C,A)=>(fo=n.dynCall_viiij=Oe.ld)(d,m,x,C,A),$i=n.dynCall_fiiii=(d,m,x,C,A)=>($i=n.dynCall_fiiii=Oe.md)(d,m,x,C,A),ki=n.dynCall_viiif=(d,m,x,C,A)=>(ki=n.dynCall_viiif=Oe.nd)(d,m,x,C,A),_o=n.dynCall_diiii=(d,m,x,C,A)=>(_o=n.dynCall_diiii=Oe.od)(d,m,x,C,A),Ii=n.dynCall_viiid=(d,m,x,C,A)=>(Ii=n.dynCall_viiid=Oe.pd)(d,m,x,C,A),Ai=n.dynCall_iiiijii=(d,m,x,C,A,W,ne)=>(Ai=n.dynCall_iiiijii=Oe.qd)(d,m,x,C,A,W,ne),go=n.dynCall_iiiiiij=(d,m,x,C,A,W,ne)=>(go=n.dynCall_iiiiiij=Oe.rd)(d,m,x,C,A,W,ne),Fi=d=>(Fi=Oe.sd)(d),Oi=()=>(Oi=Oe.td)(),Di=d=>(Di=Oe.ud)(d),Li=()=>(Li=Oe.vd)();function zi(d,m,x){var C=ft();try{so(d,m,x)}catch(A){if(ht(C),A!==A+0)throw A;gt(1,0)}}function Va(d,m,x){var C=ft();try{return to(d,m,x)}catch(A){if(ht(C),A!==A+0)throw A;gt(1,0)}}function Ua(d,m){var x=ft();try{ni(d,m)}catch(C){if(ht(x),C!==C+0)throw C;gt(1,0)}}function Wa(d,m){var x=ft();try{return ro(d,m)}catch(C){if(ht(x),C!==C+0)throw C;gt(1,0)}}function Ga(d,m,x,C){var A=ft();try{return oi(d,m,x,C)}catch(W){if(ht(A),W!==W+0)throw W;gt(1,0)}}function Bi(d,m,x,C,A){var W=ft();try{ai(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function Ka(d,m,x,C,A){var W=ft();try{return no(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function Ha(d,m,x,C){var A=ft();try{ii(d,m,x,C)}catch(W){if(ht(A),W!==W+0)throw W;gt(1,0)}}function qa(d,m,x,C,A,W,ne){var ye=ft();try{return ho(d,m,x,C,A,W,ne)}catch(Ee){if(ht(ye),Ee!==Ee+0)throw Ee;gt(1,0)}}function Qa(d){var m=ft();try{ci(d)}catch(x){if(ht(m),x!==x+0)throw x;gt(1,0)}}function Ri(d,m,x){var C=ft();try{return gi(d,m,x)}catch(A){if(ht(C),A!==A+0)throw A;gt(1,0)}}function Xa(d,m,x,C,A,W){var ne=ft();try{io(d,m,x,C,A,W)}catch(ye){if(ht(ne),ye!==ye+0)throw ye;gt(1,0)}}function Ja(d,m,x){var C=ft();try{Mi(d,m,x)}catch(A){if(ht(C),A!==A+0)throw A;gt(1,0)}}function Ya(d,m,x,C,A,W,ne){var ye=ft();try{li(d,m,x,C,A,W,ne)}catch(Ee){if(ht(ye),Ee!==Ee+0)throw Ee;gt(1,0)}}function Za(d,m,x,C,A,W,ne,ye){var Ee=ft();try{oo(d,m,x,C,A,W,ne,ye)}catch(ze){if(ht(Ee),ze!==ze+0)throw ze;gt(1,0)}}function Ni(d,m,x,C,A,W){var ne=ft();try{return co(d,m,x,C,A,W)}catch(ye){if(ht(ne),ye!==ye+0)throw ye;gt(1,0)}}function el(d,m,x,C,A,W,ne,ye){var Ee=ft();try{return Pi(d,m,x,C,A,W,ne,ye)}catch(ze){if(ht(Ee),ze!==ze+0)throw ze;gt(1,0)}}function tl(d,m,x,C,A,W,ne,ye,Ee,ze){var Ye=ft();try{fi(d,m,x,C,A,W,ne,ye,Ee,ze)}catch(it){if(ht(Ye),it!==it+0)throw it;gt(1,0)}}function ji(d,m,x,C,A,W,ne,ye,Ee){var ze=ft();try{ao(d,m,x,C,A,W,ne,ye,Ee)}catch(Ye){if(ht(ze),Ye!==Ye+0)throw Ye;gt(1,0)}}function rl(d){var m=ft();try{return ui(d)}catch(x){if(ht(m),x!==x+0)throw x;gt(1,0)}}function sl(d,m,x,C,A,W,ne,ye,Ee,ze){var Ye=ft();try{return wi(d,m,x,C,A,W,ne,ye,Ee,ze)}catch(it){if(ht(Ye),it!==it+0)throw it;gt(1,0)}}function Vi(d,m,x){var C=ft();try{return pi(d,m,x)}catch(A){if(ht(C),A!==A+0)throw A;gt(1,0)}}function nl(d,m,x,C){var A=ft();try{return mi(d,m,x,C)}catch(W){if(ht(A),W!==W+0)throw W;return gt(1,0),0n}}function ol(d,m,x){var C=ft();try{return lo(d,m,x)}catch(A){if(ht(C),A!==A+0)throw A;gt(1,0)}}function Ui(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it){var _t=ft();try{_i(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it)}catch(Bt){if(ht(_t),Bt!==Bt+0)throw Bt;gt(1,0)}}function il(d,m,x,C,A,W,ne,ye,Ee,ze,Ye){var it=ft();try{hi(d,m,x,C,A,W,ne,ye,Ee,ze,Ye)}catch(_t){if(ht(it),_t!==_t+0)throw _t;gt(1,0)}}function al(d,m,x,C,A,W,ne,ye,Ee,ze,Ye){var it=ft();try{return yi(d,m,x,C,A,W,ne,ye,Ee,ze,Ye)}catch(_t){if(ht(it),_t!==_t+0)throw _t;gt(1,0)}}function Wi(d,m,x,C){var A=ft();try{return uo(d,m,x,C)}catch(W){if(ht(A),W!==W+0)throw W;gt(1,0)}}function ll(d,m,x,C){var A=ft();try{return bi(d,m,x,C)}catch(W){if(ht(A),W!==W+0)throw W;gt(1,0)}}function dl(d,m,x,C){var A=ft();try{return vi(d,m,x,C)}catch(W){if(ht(A),W!==W+0)throw W;gt(1,0)}}function wo(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt){var Ir=ft();try{po(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t,Bt)}catch(Cs){if(ht(Ir),Cs!==Cs+0)throw Cs;gt(1,0)}}function cl(d,m,x,C,A){var W=ft();try{xi(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function ul(d,m,x){var C=ft();try{Ti(d,m,x)}catch(A){if(ht(C),A!==A+0)throw A;gt(1,0)}}function Gi(d,m){var x=ft();try{return di(d,m)}catch(C){if(ht(x),C!==C+0)throw C;return gt(1,0),0n}}function Ki(d,m,x,C,A){var W=ft();try{return Ei(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function pl(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t){var Bt=ft();try{mo(d,m,x,C,A,W,ne,ye,Ee,ze,Ye,it,_t)}catch(Ir){if(ht(Bt),Ir!==Ir+0)throw Ir;gt(1,0)}}function Hi(d,m,x,C){var A=ft();try{return Ci(d,m,x,C)}catch(W){if(ht(A),W!==W+0)throw W;gt(1,0)}}function hl(d,m,x,C,A){var W=ft();try{return Si(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;return gt(1,0),0n}}function ml(d,m,x,C,A){var W=ft();try{fo(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function yo(d,m,x,C,A){var W=ft();try{return $i(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function qi(d,m,x,C,A){var W=ft();try{ki(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function fl(d,m,x,C,A){var W=ft();try{return _o(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function _l(d,m,x,C,A){var W=ft();try{Ii(d,m,x,C,A)}catch(ne){if(ht(W),ne!==ne+0)throw ne;gt(1,0)}}function gl(d,m,x,C,A,W,ne){var ye=ft();try{return Ai(d,m,x,C,A,W,ne)}catch(Ee){if(ht(ye),Ee!==Ee+0)throw Ee;gt(1,0)}}function Qi(d,m,x,C,A,W,ne){var ye=ft();try{return go(d,m,x,C,A,W,ne)}catch(Ee){if(ht(ye),Ee!==Ee+0)throw Ee;gt(1,0)}}return n.stackSave=()=>ft(),n.stackRestore=d=>ht(d),n.stackAlloc=d=>yn(d),n.setValue=function(d,m,x="i8"){switch(x.endsWith("*")&&(x="*"),x){case"i1":case"i8":N()[d>>>0]=m;break;case"i16":G()[d>>>1>>>0]=m;break;case"i32":X()[d>>>2>>>0]=m;break;case"i64":H[d>>>3]=BigInt(m);break;case"float":_e()[d>>>2>>>0]=m;break;case"double":ke()[d>>>3>>>0]=m;break;case"*":we()[d>>>2>>>0]=m;break;default:Ie(`invalid type for setValue: ${x}`)}},n.getValue=function(d,m="i8"){switch(m.endsWith("*")&&(m="*"),m){case"i1":case"i8":return N()[d>>>0];case"i16":return G()[d>>>1>>>0];case"i32":return X()[d>>>2>>>0];case"i64":return H[d>>>3];case"float":return _e()[d>>>2>>>0];case"double":return ke()[d>>>3>>>0];case"*":return we()[d>>>2>>>0];default:Ie(`invalid type for getValue: ${m}`)}},n.UTF8ToString=zt,n.stringToUTF8=Tr,n.lengthBytesUTF8=ns,function d(){if(0{lu(),ec=typeof location>"u"?void 0:location.origin,Wc=import.meta.url>"file:"&&import.meta.url<"file;",yf=()=>{{if(Wc){let e=URL;return new URL(new e("ort.bundle.min.mjs",import.meta.url).href,ec).href}return import.meta.url}},Vr=yf(),vy=()=>{if(Vr&&!Vr.startsWith("blob:"))return Vr.substring(0,Vr.lastIndexOf("/")+1)},Rl=(e,r)=>{try{let t=r??Vr;return(t?new URL(e,t):new URL(e)).origin===ec}catch{return!1}},Mf=(e,r)=>{let t=r??Vr;try{return(t?new URL(e,t):new URL(e)).href}catch{return}},bf=(e,r)=>`${r??"./"}${e}`,tc=async e=>{let r=await(await fetch(e,{credentials:"same-origin"})).blob();return URL.createObjectURL(r)},vf=async e=>(await import(e)).default,rc=(Wv(),rd(wy)).default,xy=async()=>{if(!Vr)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(Rl(Vr))return[void 0,rc()];let e=await tc(Vr);return[e,rc(e)]},sc=(Gv(),rd(My)).default,Ty=async(e,r,t)=>{if(!e&&!r&&sc&&Vr&&Rl(Vr))return[void 0,sc];{let s="ort-wasm-simd-threaded.jsep.mjs",o=e??Mf(s,r),n=t&&o&&!Rl(o,r),i=n?await tc(o):o??bf(s,r);return[n?i:void 0,await vf(i)]}}}),nc,Nl,Zi,oc,xf,Tf,cu,ur,zn=Ve(()=>{du(),Nl=!1,Zi=!1,oc=!1,xf=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return 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}},Tf=()=>{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}},cu=async e=>{if(Nl)return Promise.resolve();if(Zi)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(oc)throw new Error("previous call to 'initializeWebAssembly()' failed.");Zi=!0;let r=e.initTimeout,t=e.numThreads;if(!Tf())throw new Error("WebAssembly SIMD is not supported in the current environment.");let s=xf();t>1&&!s&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+t+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),e.numThreads=t=1);let o=e.wasmPaths,n=typeof o=="string"?o:void 0,i=o==null?void 0:o.mjs,a=(i==null?void 0:i.href)??i,l=o==null?void 0:o.wasm,c=(l==null?void 0:l.href)??l,p=e.wasmBinary,[u,h]=await Ty(a,n,t>1),g=!1,_=[];if(r>0&&_.push(new Promise(E=>{setTimeout(()=>{g=!0,E()},r)})),_.push(new Promise((E,I)=>{let M={numThreads:t};if(p)M.wasmBinary=p;else if(c||n)M.locateFile=y=>c??n+y;else if(a&&a.indexOf("blob:")!==0)M.locateFile=y=>new URL(y,a).href;else if(u){let y=vy();y&&(M.locateFile=$=>y+$)}h(M).then(y=>{Zi=!1,Nl=!0,nc=y,E(),u&&URL.revokeObjectURL(u)},y=>{Zi=!1,oc=!0,I(y)})})),await Promise.race(_),g)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},ur=()=>{if(Nl&&nc)return nc;throw new Error("WebAssembly is not initialized yet.")}}),xr,sd,Ot,uu=Ve(()=>{zn(),xr=(e,r)=>{let t=ur(),s=t.lengthBytesUTF8(e)+1,o=t._malloc(s);return t.stringToUTF8(e,o,s),r.push(o),o},sd=(e,r,t,s)=>{if(typeof e=="object"&&e!==null){if(t.has(e))throw new Error("Circular reference in options");t.add(e)}Object.entries(e).forEach(([o,n])=>{let i=r?r+o:o;if(typeof n=="object")sd(n,i+".",t,s);else if(typeof n=="string"||typeof n=="number")s(i,n.toString());else if(typeof n=="boolean")s(i,n?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof n}`)})},Ot=e=>{let r=ur(),t=r.stackSave();try{let s=r.PTR_SIZE,o=r.stackAlloc(2*s);r._OrtGetLastError(o,o+s);let n=Number(r.getValue(o,s===4?"i32":"i64")),i=r.getValue(o+s,"*"),a=i?r.UTF8ToString(i):"";throw new Error(`${e} ERROR_CODE: ${n}, ERROR_MESSAGE: ${a}`)}finally{r.stackRestore(t)}}}),Ey,Kv=Ve(()=>{zn(),uu(),Ey=e=>{let r=ur(),t=0,s=[],o=e||{};try{if((e==null?void 0:e.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof e.logSeverityLevel!="number"||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if((e==null?void 0:e.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!="number"||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);(e==null?void 0:e.terminate)===void 0&&(o.terminate=!1);let n=0;return(e==null?void 0:e.tag)!==void 0&&(n=xr(e.tag,s)),t=r._OrtCreateRunOptions(o.logSeverityLevel,o.logVerbosityLevel,!!o.terminate,n),t===0&&Ot("Can't create run options."),(e==null?void 0:e.extra)!==void 0&&sd(e.extra,"",new WeakSet,(i,a)=>{let l=xr(i,s),c=xr(a,s);r._OrtAddRunConfigEntry(t,l,c)!==0&&Ot(`Can't set a run config entry: ${i} - ${a}.`)}),[t,s]}catch(n){throw t!==0&&r._OrtReleaseRunOptions(t),s.forEach(i=>r._free(i)),n}}}),Ef,Pf,Cf,Sf,Py,Hv=Ve(()=>{zn(),uu(),Ef=e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}},Pf=e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}},Cf=e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});let r=e.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some(t=>(typeof t=="string"?t:t.name)==="webgpu")&&(e.enableMemPattern=!1)},Sf=(e,r,t)=>{for(let s of r){let o=typeof s=="string"?s:s.name;switch(o){case"webnn":if(o="WEBNN",typeof s!="string"){let i=s==null?void 0:s.deviceType;if(i){let a=xr("deviceType",t),l=xr(i,t);ur()._OrtAddSessionConfigEntry(e,a,l)!==0&&Ot(`Can't set a session config entry: 'deviceType' - ${i}.`)}}break;case"webgpu":if(o="JS",typeof s!="string"){let i=s;if(i!=null&&i.preferredLayout){if(i.preferredLayout!=="NCHW"&&i.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${i.preferredLayout}`);let a=xr("preferredLayout",t),l=xr(i.preferredLayout,t);ur()._OrtAddSessionConfigEntry(e,a,l)!==0&&Ot(`Can't set a session config entry: 'preferredLayout' - ${i.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${o}`)}let n=xr(o,t);ur()._OrtAppendExecutionProvider(e,n)!==0&&Ot(`Can't append execution provider: ${o}.`)}},Py=e=>{let r=ur(),t=0,s=[],o=e||{};Cf(o);try{let n=Ef(o.graphOptimizationLevel??"all"),i=Pf(o.executionMode??"sequential"),a=typeof o.logId=="string"?xr(o.logId,s):0,l=o.logSeverityLevel??2;if(!Number.isInteger(l)||l<0||l>4)throw new Error(`log serverity level is not valid: ${l}`);let c=o.logVerbosityLevel??0;if(!Number.isInteger(c)||c<0||c>4)throw new Error(`log verbosity level is not valid: ${c}`);let p=typeof o.optimizedModelFilePath=="string"?xr(o.optimizedModelFilePath,s):0;if(t=r._OrtCreateSessionOptions(n,!!o.enableCpuMemArena,!!o.enableMemPattern,i,!!o.enableProfiling,0,a,l,c,p),t===0&&Ot("Can't create session options."),o.executionProviders&&Sf(t,o.executionProviders,s),o.enableGraphCapture!==void 0){if(typeof o.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${o.enableGraphCapture}`);let u=xr("enableGraphCapture",s),h=xr(o.enableGraphCapture.toString(),s);r._OrtAddSessionConfigEntry(t,u,h)!==0&&Ot(`Can't set a session config entry: 'enableGraphCapture' - ${o.enableGraphCapture}.`)}if(o.freeDimensionOverrides)for(let[u,h]of Object.entries(o.freeDimensionOverrides)){if(typeof u!="string")throw new Error(`free dimension override name must be a string: ${u}`);if(typeof h!="number"||!Number.isInteger(h)||h<0)throw new Error(`free dimension override value must be a non-negative integer: ${h}`);let g=xr(u,s);r._OrtAddFreeDimensionOverride(t,g,h)!==0&&Ot(`Can't set a free dimension override: ${u} - ${h}.`)}return o.extra!==void 0&&sd(o.extra,"",new WeakSet,(u,h)=>{let g=xr(u,s),_=xr(h,s);r._OrtAddSessionConfigEntry(t,g,_)!==0&&Ot(`Can't set a session config entry: ${u} - ${h}.`)}),[t,s]}catch(n){throw t!==0&&r._OrtReleaseSessionOptions(t)!==0&&Ot("Can't release session options."),s.forEach(i=>r._free(i)),n}}}),Eo,In,An,pu,nd,hu,mu,Gc,mt=Ve(()=>{Eo=e=>{switch(e){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"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${e}`)}},In=e=>{switch(e){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 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${e}`)}},An=(e,r)=>{let t=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],s=typeof r=="number"?r:r.reduce((o,n)=>o*n,1);return t>0?Math.ceil(s*t):void 0},pu=e=>{switch(e){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}},nd=e=>{switch(e){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: ${e}`)}},hu=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",mu=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint64"||e==="int8"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",Gc=e=>{switch(e){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${e}`)}}}),fu,Cy=Ve(()=>{lu(),fu=async e=>{if(typeof e=="string"){let r=await fetch(e);if(!r.ok)throw new Error(`failed to load external data file: ${e}`);let t=r.headers.get("Content-Length"),s=t?parseInt(t,10):0;if(s<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${e}, no response body.`);let o=r.body.getReader(),n;try{n=new ArrayBuffer(s)}catch(a){if(a instanceof RangeError){let l=Math.ceil(s/65536);n=new WebAssembly.Memory({initial:l,maximum:l}).buffer}else throw a}let i=0;for(;;){let{done:a,value:l}=await o.read();if(a)break;let c=l.byteLength;new Uint8Array(n,i,c).set(l),i+=c}return new Uint8Array(n,0,s)}}else return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),$f,kf,If,Af,_u,Ff,St,Us=Ve(()=>{mt(),$f=["V","I","W","E","F"],kf=(e,r)=>{console.log(`[${$f[e]},${new Date().toISOString()}]${r}`)},_u=(e,r)=>{If=e,Af=r},Ff=(e,r)=>{let t=nd(e),s=nd(If);t>=s&&kf(t,typeof r=="function"?r():r)},St=(...e)=>{Af&&Ff(...e)}}),gu,Sy=Ve(()=>{mt(),gu=(e,r)=>new(pu(r))(e)}),wu=Ve(()=>{}),ic,jl,Vl,Of,Df,ac,Kc,Lf,$y,qv=Ve(()=>{Us(),wu(),ic=new Map([[64,250],[128,200],[256,200],[512,200],[2048,230],[4096,200],[8192,50],[16384,50],[32768,50],[65536,50],[131072,50],[262144,50],[524288,50],[1048576,50],[2097152,30],[4194304,20],[8388608,10],[12582912,10],[16777216,10],[26214400,15],[33554432,22],[44236800,2],[58982400,6],[67108864,6],[134217728,6],[167772160,6]]),jl=[],Vl=e=>Math.ceil(Number(e)/16)*16,Of=e=>{for(let r=0;rDf++,Kc=async(e,r,t,s)=>{let o=Vl(t),n=e.device.createBuffer({size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});try{let i=e.getCommandEncoder();e.endComputePass(),i.copyBufferToBuffer(r,0,n,0,o),e.flush(),await n.mapAsync(GPUMapMode.READ);let a=n.getMappedRange();if(s){let l=s();return l.set(new Uint8Array(a,0,t)),l}else return new Uint8Array(a.slice(0,t))}finally{n.destroy()}},Lf=class{constructor(e){this.backend=e,this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.buffersPending=[],this.capturedPendingBuffers=new Map;for(let[r]of ic)jl.push(r),this.freeBuffers.set(r,[]),this.freeUniformBuffers.set(r,[]);this.sessionCount=0}upload(e,r){let t=r.buffer,s=r.byteOffset,o=r.byteLength,n=Vl(o),i=this.storageCache.get(e);if(!i)throw new Error("gpu data for uploading does not exist");if(Number(i.originalSize)!==o)throw new Error(`inconsistent data size. gpu data size=${i.originalSize}, data size=${o}`);let a=this.backend.device.createBuffer({mappedAtCreation:!0,size:n,usage:GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC}),l=a.getMappedRange();new Uint8Array(l).set(new Uint8Array(t,s,o)),a.unmap();let c=this.backend.device.createCommandEncoder();c.copyBufferToBuffer(a,0,i.gpuData.buffer,0,n),this.backend.device.queue.submit([c.finish()]),a.destroy(),St("verbose",()=>`[WebGPU] GpuDataManager.upload(id=${e})`)}memcpy(e,r){let t=this.storageCache.get(e);if(!t)throw new Error("source gpu data for memcpy does not exist");let s=this.storageCache.get(r);if(!s)throw new Error("destination gpu data for memcpy does not exist");if(t.originalSize!==s.originalSize)throw new Error("inconsistent source and destination gpu data size");let o=Vl(t.originalSize),n=this.backend.getCommandEncoder();this.backend.endComputePass(),n.copyBufferToBuffer(t.gpuData.buffer,0,s.gpuData.buffer,0,o)}registerExternalBuffer(e,r,t){let s;if(t){if(s=t[0],e===t[1])return St("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, buffer is the same, skip.`),s;if(this.backend.capturedCommandList.has(this.backend.currentSessionId))throw new Error(`Registering a different external buffer under graph capture mode is not supported yet. - Please use the previous external buffer!`)}else s=ac();return this.storageCache.set(s,{gpuData:{id:s,type:0,buffer:e},originalSize:r}),St("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, registered.`),s}unregisterExternalBuffer(e){e!==void 0&&(this.storageCache.delete(e),St("verbose",()=>`[WebGPU] GpuDataManager.unregisterExternalBuffer() => id=${e}`))}create(e,r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST){let t=Of(e),s,o=(r&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE,n=(r&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM;if(o||n){let a=(o?this.freeBuffers:this.freeUniformBuffers).get(t);a?a.length>0?s=a.pop():s=this.backend.device.createBuffer({size:t,usage:r}):s=this.backend.device.createBuffer({size:t,usage:r})}else s=this.backend.device.createBuffer({size:t,usage:r});let i={id:ac(),type:0,buffer:s};return this.storageCache.set(i.id,{gpuData:i,originalSize:Number(e)}),St("verbose",()=>`[WebGPU] GpuDataManager.create(size=${e}) => id=${i.id}`),i}get(e){var r;return(r=this.storageCache.get(e))==null?void 0:r.gpuData}release(e){let r=typeof e=="bigint"?Number(e):e,t=this.storageCache.get(r);if(!t){if(this.storageCache.size===0)return 0;throw new Error("releasing data does not exist")}return St("verbose",()=>`[WebGPU] GpuDataManager.release(id=${r}), gpuDataId=${t.gpuData.id}`),this.storageCache.delete(r),this.buffersPending.push(t.gpuData.buffer),t.originalSize}async download(e,r){let t=this.storageCache.get(Number(e));if(!t)throw new Error("data does not exist");await Kc(this.backend,t.gpuData.buffer,t.originalSize,r)}refreshPendingBuffers(){if(this.buffersPending.length!==0)if(this.backend.sessionStatus==="default"){for(let e of this.buffersPending){let r=ic.get(e.size);if((e.usage&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE){let t=this.freeBuffers.get(e.size)||[];r===void 0||t.length>=r?e.destroy():t.push(e)}else if((e.usage&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM){let t=this.freeUniformBuffers.get(e.size)||[];r===void 0||t.length>=r?e.destroy():t.push(e)}else e.destroy()}this.buffersPending=[]}else{let e=this.capturedPendingBuffers.get(this.backend.currentSessionId);e||(e=[],this.capturedPendingBuffers.set(this.backend.currentSessionId,e));for(let r of this.buffersPending)e.push(r);this.buffersPending=[]}}dispose(){this.freeBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.freeUniformBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache.forEach(e=>{e.gpuData.buffer.destroy()}),this.capturedPendingBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.capturedPendingBuffers=new Map}onCreateSession(){this.sessionCount+=1}onReleaseSession(e){let r=this.capturedPendingBuffers.get(e);r&&(r.forEach(t=>{t.destroy()}),this.capturedPendingBuffers.delete(e)),this.sessionCount-=1,this.sessionCount===0&&(St("warning",()=>"[WebGPU] Clearing webgpu buffer cache"),this.storageCache.forEach(t=>{t.gpuData.buffer.destroy()}),this.storageCache=new Map)}},$y=(...e)=>new Lf(...e)}),zf,Lt,tr=Ve(()=>{zf=class{constructor(e){Object.assign(this,e)}get cacheKey(){return this.key||(this.key=Object.getOwnPropertyNames(this).sort().map(e=>`${this[e]}`).join(";")),this.key}},Lt=e=>new zf(e)}),Bf,So,xe,od,ky,Iy,Ay,bt=Ve(()=>{Bf=class{static calcMatMulShape(e,r){return e[1]!==r[0]?void 0:[e[0],r[1]]}},So=class{static calcShape(e,r,t=!1){let s=e.length,o=r.length;if(s===0)return r;if(o===0)return e;let n=Math.max(e.length,r.length),i=new Array(n);if(t){if(s<2||o<2)return;let a=Bf.calcMatMulShape([e[s-2],e[s-1]],[r[o-2],r[o-1]]);if(a===void 0)return;[i[n-2],i[n-1]]=a}for(let a=t?3:1;a<=n;a++){let l=s-a<0?1:e[s-a],c=o-a<0?1:r[o-a];if(l!==c&&l>1&&c>1)return;let p=Math.max(l,c);if(l&&c)i[n-a]=Math.max(l,c);else{if(p>1)return;i[n-a]=0}}return i}static isValidBroadcast(e,r){let t=e.length,s=r.length;if(t>s)return!1;for(let o=1;o<=t;o++)if(e[t-o]!==1&&e[t-o]!==r[s-o])return!1;return!0}},xe=class ed{static size(r){return ed.getSizeFromDimensionRange(r,0,r.length)}static convertShape(r,t=4){let s=r.length;if(s===0)return[];let o=new Array(s),n=s-1;for(;n>=0;){if(r[n]%t===0){o[n]=r[n]/t;break}if(t%r[n]!==0)throw new Error("cannot convert shape");o[n]=1,t/=r[n],n--}for(n--;n>=0;n--)o[n]=r[n];return o}static sizeFromDimension(r,t){if(t<0||t>r.length)throw new Error(`invalid dimension of ${t} for sizeFromDimension as Tensor has ${r.length} dimensions.`);return ed.getSizeFromDimensionRange(r,t,r.length)}static sizeToDimension(r,t){if(t<0||t>r.length)throw new Error(`invalid dimension of ${t} for sizeToDimension as Tensor has ${r.length} dimensions.`);return ed.getSizeFromDimensionRange(r,0,t)}static getSizeFromDimensionRange(r,t,s){let o=1;for(let n=t;n=0;--o)s[o]=s[o+1]*r[o+1];return s}static normalizeAxis(r,t){if(r<-t&&r>=t)throw new Error("unsupported axis for this operation.");return r<0?r+t:r}static normalizeAxes(r,t){return r.map(s=>this.normalizeAxis(s,t??r.length))}static sortBasedOnPerm(r,t){return t?t.map(s=>r[s]):r.slice().reverse()}static padShape(r,t){let s=r.length;return r.map((o,n)=>o+t[n]+t[n+s])}static areEqual(r,t){return r.length!==t.length?!1:r.every((s,o)=>s===t[o])}},od=class la{static adjustPoolAttributes(r,t,s,o,n,i){if(!r&&s.length!==t.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(r)for(let a=0;a=s.length?s.push(t[a+2]):s[a]=t[a+2];for(let a=0;a=s[a]||i[a+s.length]>=s[a])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(r,t,s,o,n,i,a){if(a){if(n.length!==2*(r.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(t.length!==r.length-2)throw new Error("length of strides should be the length of data dimensions");if(o.length!==r.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let l=0;l{mt(),bt(),$o=64,Ul=(e,r)=>{if(r===3)throw new Error("vec3 has same alignment as vec4, use vec4 instead");switch(Number(e)){case 10:return r>1?`vec${r}`:"f16";case 1:return r>1?`vec${r}`:"f32";case 6:return r>1?`vec${r}`:"i32";case 12:return r>1?`vec${r}`:"u32";case 7:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","i32"];case 13:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","u32"];case 9:if(r!==4)throw new Error("bool must be vec4");return["u32","vec4"];case 22:return"i32";case 21:return"u32";default:throw new Error(`Unknown data type: ${e}`)}},pr=(e,r=1)=>{let t=Ul(e,r);return typeof t=="string"?t:t[0]},Cr=(e,r=1)=>{let t=Ul(e,r);return typeof t=="string"?t:t[1]},nt=(...e)=>{let r=[];return e.forEach(t=>{t.length!==0&&r.push({type:12,data:t},{type:12,data:xe.computeStrides(t)})}),r},Jt=e=>e%4===0?4:e%2===0?2:1,Hc=(e="f32",r,t="0")=>!r||r===1?`${e}(${t})`:`vec${r}<${e}>(${t})`,Co=(e,r,t)=>e==="f32"?t:r===1?`f32(${t})`:`vec${r}(${t})`,dn=(e,r)=>r===4?`(${e}.x + ${e}.y + ${e}.z + ${e}.w)`:r===2?`(${e}.x + ${e}.y)`:r===3?`(${e}.x + ${e}.y + ${e}.z)`:e,rt=(e,r,t,s)=>e.startsWith("uniforms.")&&t>4?typeof r=="string"?s==="f16"?`${e}[(${r}) / 8][(${r}) % 8 / 4][(${r}) % 8 % 4]`:`${e}[(${r}) / 4][(${r}) % 4]`:s==="f16"?`${e}[${Math.floor(r/8)}][${Math.floor(r%8/4)}][${r%8%4}]`:`${e}[${Math.floor(r/4)}][${r%4}]`:t>1?`${e}[${r}]`:e,ea=(e,r,t,s,o)=>{let n=typeof t=="number",i=n?t:t.length,a=[...new Array(i).keys()],l=i<2?"u32":i<=4?`vec${i}`:`array`,c=Ul(r,o),p=typeof c=="string"?c:c[1],u=typeof c=="string"?c:c[0],h={indices:l,value:p,storage:u,tensor:r},g=N=>typeof N=="string"?N:`${N}u`,_={offsetToIndices:!1,indicesToOffset:!1,broadcastedIndicesToOffset:!1,set:!1,setByIndices:!1,get:!1,getByIndices:!1},E=n?"uniforms.":"",I=`${E}${e}_shape`,M=`${E}${e}_strides`,y="";for(let N=0;N ${h.indices} { - var indices: ${h.indices}; - var current = offset; - ${y} - return indices; - }`,P=N=>(_.offsetToIndices=!0,i<2?N:`o2i_${e}(${N})`),b=[];if(i>=2)for(let N=i-1;N>=0;N--)b.push(`${rt(M,N,i)} * (indices[${N}])`);let w=i<2?"":` - fn i2o_${e}(indices: ${h.indices}) -> u32 { - return ${b.join("+")}; - }`,T=N=>(_.indicesToOffset=!0,i<2?N:`i2o_${e}(${N})`),k=(...N)=>i===0?"0u":`${h.indices}(${N.map(g).join(",")})`,z=(N,O)=>i<2?`${N}`:`${rt(N,O,i)}`,R=(N,O,G)=>i<2?`${N}=${G};`:`${rt(N,O,i)}=${G};`,Q={},q=(N,O)=>{_.broadcastedIndicesToOffset=!0;let G=`${O.name}broadcastedIndicesTo${e}Offset`;if(G in Q)return`${G}(${N})`;let se=[];for(let X=i-1;X>=0;X--){let we=O.indicesGet("outputIndices",X+O.rank-i);se.push(`${z(M,X)} * (${we} % ${z(I,X)})`)}return Q[G]=`fn ${G}(outputIndices: ${O.type.indices}) -> u32 { - return ${se.length>0?se.join("+"):"0u"}; - }`,`${G}(${N})`},U=(N,O)=>(()=>{if(h.storage===h.value)return`${e}[${N}]=${O};`;if(h.storage==="vec2"&&h.value==="i32")return`${e}[${N}]=vec2(u32(${O}), select(0u, 0xFFFFFFFFu, ${O} < 0));`;if(h.storage==="vec2"&&h.value==="u32")return`${e}[${N}]=vec2(u32(${O}), 0u);`;if(h.storage==="u32"&&h.value==="vec4")return`${e}[${N}]=dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(${O}));`;throw new Error(`not supported combination of storage type ${h.storage} and value type ${h.value} yet`)})(),Z=N=>(()=>{if(h.storage===h.value)return`${e}[${N}]`;if(h.storage==="vec2"&&h.value==="i32")return`i32(${e}[${N}].x)`;if(h.storage==="vec2"&&h.value==="u32")return`u32(${e}[${N}].x)`;if(h.storage==="u32"&&h.value==="vec4")return`vec4(bool(${e}[${N}] & 0xFFu), bool(${e}[${N}] & 0xFF00u), bool(${e}[${N}] & 0xFF0000u), bool(${e}[${N}] & 0xFF000000u))`;throw new Error(`not supported combination of storage type ${h.storage} and value type ${h.value} yet`)})(),H=i<2?"":` - fn get_${e}ByIndices(indices: ${h.indices}) -> ${p} { - return ${Z(`i2o_${e}(indices)`)}; - }`,J=i<2?"":(()=>{let N=a.map(G=>`d${G}: u32`).join(", "),O=a.map(G=>`d${G}`).join(", ");return` - fn get_${e}(${N}) -> ${p} { - return get_${e}ByIndices(${k(O)}); - }`})(),oe=(...N)=>{if(N.length!==i)throw new Error(`indices length must be ${i}`);let O=N.map(g).join(",");return i===0?Z("0u"):i===1?Z(O[0]):(_.get=!0,_.getByIndices=!0,_.indicesToOffset=!0,`get_${e}(${O})`)},ae=N=>i<2?Z(N):(_.getByIndices=!0,_.indicesToOffset=!0,`get_${e}ByIndices(${N})`),ce=i<2?"":` - fn set_${e}ByIndices(indices: ${h.indices}, value: ${p}) { - ${U(`i2o_${e}(indices)`,"value")} - }`,he=i<2?"":(()=>{let N=a.map(G=>`d${G}: u32`).join(", "),O=a.map(G=>`d${G}`).join(", ");return` - fn set_${e}(${N}, value: ${p}) { - set_${e}ByIndices(${k(O)}, value); - }`})();return{impl:()=>{let N=[],O=!1;return _.offsetToIndices&&(N.push($),O=!0),_.indicesToOffset&&(N.push(w),O=!0),_.broadcastedIndicesToOffset&&(Object.values(Q).forEach(G=>N.push(G)),O=!0),_.set&&(N.push(he),O=!0),_.setByIndices&&(N.push(ce),O=!0),_.get&&(N.push(J),O=!0),_.getByIndices&&(N.push(H),O=!0),!n&&O&&N.unshift(`const ${I} = ${h.indices}(${t.join(",")});`,`const ${M} = ${h.indices}(${xe.computeStrides(t).join(",")});`),N.join(` -`)},type:h,offsetToIndices:P,indicesToOffset:T,broadcastedIndicesToOffset:q,indices:k,indicesGet:z,indicesSet:R,set:(...N)=>{if(N.length!==i+1)throw new Error(`indices length must be ${i}`);let O=N[i];if(typeof O!="string")throw new Error("value must be string");let G=N.slice(0,i).map(g).join(",");return i===0?U("0u",O):i===1?U(G[0],O):(_.set=!0,_.setByIndices=!0,_.indicesToOffset=!0,`set_${e}(${G}, ${O})`)},setByOffset:U,setByIndices:(N,O)=>i<2?U(N,O):(_.setByIndices=!0,_.indicesToOffset=!0,`set_${e}ByIndices(${N}, ${O});`),get:oe,getByOffset:Z,getByIndices:ae,usage:s,name:e,strides:M,shape:I,rank:i}},$e=(e,r,t,s=1)=>ea(e,r,t,"input",s),tt=(e,r,t,s=1)=>ea(e,r,t,"output",s),Fy=(e,r,t)=>ea(e,r,t,"atomicOutput",1),yu=(e,r,t,s=1)=>ea(e,r,t,"internal",s),Rf=class{constructor(e,r){this.normalizedDispatchGroup=e,this.limits=r,this.internalVariables=[],this.variables=[],this.uniforms=[],this.variableIndex=0}guardAgainstOutOfBoundsWorkgroupSizes(e){return`if (global_idx >= ${typeof e=="number"?`${e}u`:e}) { return; }`}mainStart(e=$o){let r=typeof e=="number"?e:e[0],t=typeof e=="number"?1:e[1],s=typeof e=="number"?1:e[2];if(r>this.limits.maxComputeWorkgroupSizeX||t>this.limits.maxComputeWorkgroupSizeY||s>this.limits.maxComputeWorkgroupSizeZ)throw new Error(`workgroup size [${r}, ${t}, ${s}] exceeds the maximum workgroup size [${this.limits.maxComputeWorkgroupSizeX}, ${this.limits.maxComputeWorkgroupSizeY}, ${this.limits.maxComputeWorkgroupSizeZ}].`);if(r*t*s>this.limits.maxComputeInvocationsPerWorkgroup)throw new Error(`workgroup size [${r}, ${t}, ${s}] exceeds the maximum workgroup invocations ${this.limits.maxComputeInvocationsPerWorkgroup}.`);let o=this.normalizedDispatchGroup[1]===1&&this.normalizedDispatchGroup[2]===1,n=o?`@builtin(global_invocation_id) global_id : vec3, - @builtin(workgroup_id) workgroup_id : vec3, - @builtin(local_invocation_index) local_idx : u32, - @builtin(local_invocation_id) local_id : vec3`:`@builtin(global_invocation_id) global_id : vec3, - @builtin(local_invocation_id) local_id : vec3, - @builtin(local_invocation_index) local_idx : u32, - @builtin(workgroup_id) workgroup_id : vec3, - @builtin(num_workgroups) num_workgroups : vec3`,i=o?`let global_idx = global_id.x; - let workgroup_index = workgroup_id.x;`:`let workgroup_index = workgroup_id.z * num_workgroups[0] * num_workgroups[1] + - workgroup_id.y * num_workgroups[0] + workgroup_id.x; - let global_idx = workgroup_index * ${r*t*s}u + local_idx;`;return`@compute @workgroup_size(${r}, ${t}, ${s}) - fn main(${n}) { - ${i} - `}appendVariableUniforms(e){e.rank!==0&&(e.shape.startsWith("uniforms.")&&this.uniforms.push({name:e.shape.replace("uniforms.",""),type:"u32",length:e.rank}),e.strides.startsWith("uniforms.")&&this.uniforms.push({name:e.strides.replace("uniforms.",""),type:"u32",length:e.rank}))}declareVariable(e,r){if(e.usage==="internal")throw new Error("cannot use internal variable with declareVariable(). use registerInternalVariables() instead.");this.variables.push(e),this.appendVariableUniforms(e);let t=e.usage==="input"?"read":"read_write",s=e.usage==="atomicOutput"?"atomic":e.type.storage;return`@group(0) @binding(${r}) var ${e.name}: array<${s}>;`}declareVariables(...e){return e.map(r=>this.declareVariable(r,this.variableIndex++)).join(` -`)}registerInternalVariable(e){if(e.usage!=="internal")throw new Error("cannot use input or output variable with registerInternalVariable(). use declareVariables() instead.");this.internalVariables.push(e),this.appendVariableUniforms(e)}registerInternalVariables(...e){return e.forEach(r=>this.registerInternalVariable(r)),this}registerUniform(e,r,t=1){return this.uniforms.push({name:e,type:r,length:t}),this}registerUniforms(e){return this.uniforms=this.uniforms.concat(e),this}uniformDeclaration(){if(this.uniforms.length===0)return"";let e=[];for(let{name:r,type:t,length:s}of this.uniforms)if(s&&s>4)t==="f16"?e.push(`@align(16) ${r}:array, ${Math.ceil(s/8)}>`):e.push(`${r}:array, ${Math.ceil(s/4)}>`);else{let o=s==null||s===1?t:`vec${s}<${t}>`;e.push(`${r}:${o}`)}return` - struct Uniforms { ${e.join(", ")} }; - @group(0) @binding(${this.variableIndex}) var uniforms: Uniforms;`}get additionalImplementations(){return this.uniformDeclaration()+this.variables.map(e=>e.impl()).join(` -`)+this.internalVariables.map(e=>e.impl()).join(` -`)}get variablesInfo(){if(this.uniforms.length===0)return;let e=r=>[12,10,1,6][["u32","f16","f32","i32"].indexOf(r)];return this.uniforms.map(r=>[e(r.type),r.length??1])}},Oy=(e,r)=>new Rf(e,r)}),Nf,lc,jf,Vf,Uf,Wf,Wr,Dy,Ly,cn=Ve(()=>{mt(),bt(),tr(),xt(),Nf=(e,r)=>{if(!e||e.length!==1)throw new Error("Transpose requires 1 input.");if(r.length!==0&&r.length!==e[0].dims.length)throw new Error(`perm size ${r.length} does not match input rank ${e[0].dims.length}`)},lc=(e,r)=>r.length!==0?r:[...new Array(e).keys()].reverse(),jf=(e,r)=>xe.sortBasedOnPerm(e,lc(e.length,r)),Vf=(e,r,t,s)=>{let o=`fn perm(i: ${s.type.indices}) -> ${t.type.indices} { - var a: ${t.type.indices};`;for(let n=0;n{let t=[],s=[];for(let o=0;o{let t=0;for(let s=0;s{let t=e.dataType,s=e.dims.length,o=lc(s,r),n=jf(e.dims,o),i=e.dims,a=n,l=s<2||Wf(o,e.dims),c;if(l)return c=_=>{let E=$e("input",t,i,4),I=tt("output",t,a,4);return` - ${_.registerUniform("output_size","u32").declareVariables(E,I)} - ${_.mainStart()} - ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - output[global_idx] = input[global_idx]; - }`},{name:"TransposeCopy",shaderCache:{inputDependencies:["type"]},getRunData:()=>{let _=xe.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(_/64/4)},programUniforms:[{type:12,data:Math.ceil(_/4)}]}},getShaderSource:c};let{newShape:p,newPerm:u}=Uf(e.dims,o),h=xe.areEqual(u,[2,3,1]),g=xe.areEqual(u,[3,1,2]);if(p.length===2||h||g){i=h?[p[0],p[1]*p[2]]:g?[p[0]*p[1],p[2]]:p,a=[i[1],i[0]];let _=16;return c=E=>{let I=$e("a",t,i.length),M=tt("output",t,a.length);return` - ${E.registerUniform("output_size","u32").declareVariables(I,M)} - var tile : array, ${_}>; - ${E.mainStart([_,_,1])} - let stride = (uniforms.output_shape[1] - 1) / ${_} + 1; - let workgroup_id_x = workgroup_index % stride; - let workgroup_id_y = workgroup_index / stride; - let input_col = workgroup_id_y * ${_}u + local_id.x; - let input_row = workgroup_id_x * ${_}u + local_id.y; - if (input_row < uniforms.a_shape[0] && input_col < uniforms.a_shape[1]) { - tile[local_id.y][local_id.x] = ${I.getByIndices(`${I.type.indices}(input_row, input_col)`)}; - } - workgroupBarrier(); - - let output_col = workgroup_id_x * ${_}u + local_id.x; - let output_row = workgroup_id_y * ${_}u + local_id.y; - if (output_row < uniforms.output_shape[0] && output_col < uniforms.output_shape[1]) { - ${M.setByIndices(`${M.type.indices}(output_row, output_col)`,"tile[local_id.x][local_id.y]")} - } - }`},{name:"TransposeShared",shaderCache:{inputDependencies:["type"]},getRunData:()=>{let E=xe.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(a[1]/_),y:Math.ceil(a[0]/_)},programUniforms:[{type:12,data:E},...nt(i,a)]}},getShaderSource:c}}return c=_=>{let E=$e("a",t,i.length),I=tt("output",t,a.length);return` - ${_.registerUniform("output_size","u32").declareVariables(E,I)} - - ${Vf(o,s,E,I)} - - ${_.mainStart()} - ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let indices = ${I.offsetToIndices("global_idx")}; - let aIndices = perm(indices); - - ${I.setByOffset("global_idx",E.getByIndices("aIndices"))} - }`},{name:"Transpose",shaderCache:{hint:`${r}`,inputDependencies:["rank"]},getRunData:()=>{let _=xe.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:[{type:12,data:_},...nt(i,a)]}},getShaderSource:c}},Dy=(e,r)=>{Nf(e.inputs,r.perm),e.compute(Wr(e.inputs[0],r.perm))},Ly=e=>Lt({perm:e.perm})}),Gf,Kf,Hf,qf,Qf,Xf,Jf,Yf,Zf,e_,ps,zy,By,Ry,Ny,jy,Vy,Uy,Wy,Gy,Ky,Qv=Ve(()=>{mt(),bt(),xt(),Mu(),cn(),Gf={max:"select(bestValue, candidate, candidate > bestValue)",min:"select(bestValue, candidate, candidate < bestValue)",mean:"bestValue + candidate",sum:"bestValue + candidate",prod:"bestValue * candidate",sumSquare:"bestValue + candidate * candidate",logSumExp:"bestValue + exp(candidate)",l1:"bestValue + abs(candidate)",l2:"bestValue + candidate * candidate",logSum:"bestValue + candidate"},Kf={max:"select(bestValue, candidate, candidate > bestValue)",min:"select(bestValue, candidate, candidate < bestValue)",mean:"bestValue + candidate",sum:"bestValue + candidate",prod:"bestValue * candidate",sumSquare:"bestValue + candidate",logSumExp:"bestValue + candidate",l1:"bestValue + candidate",l2:"bestValue + candidate",logSum:"bestValue + candidate"},Hf={max:"_A[offset]",min:"_A[offset]",mean:"0",sum:"0",prod:"1",sumSquare:"0",logSumExp:"0",l1:"0",l2:"0",logSum:"0"},qf={max:"bestValue",min:"bestValue",sum:"bestValue",prod:"bestValue",sumSquare:"bestValue",logSumExp:"log(bestValue)",l1:"bestValue",l2:"sqrt(bestValue)",logSum:"log(bestValue)"},Qf=(e,r)=>{let t=[];for(let s=r-e;s{let t=[],s=e.length;for(let n=0;ne[n]);return[t,o]},Jf=(e,r)=>{let t=e.length+r.length,s=[],o=0;for(let n=0;n{for(let t=0;t{let t=[];if(!Yf(e,r)){for(let s=0;st.push(s))}return t},e_=(e,r,t,s,o,n,i)=>{let a=t[0].dims,l=xe.size(n),c=xe.size(i),p=$e("_A",t[0].dataType,a),u=tt("output",o,n),h=64;l===1&&(h=256);let g=` - var aBestValues : array; - `,_=E=>` - ${E.registerUniform("reduceSize","u32").declareVariables(p,u)} - ${g} - fn DIV_CEIL(a : u32, b : u32) -> u32 { - return ((a - 1u) / b + 1u); - } - ${E.mainStart(h)} - - let outputIndex = global_idx / ${h}; - let offset = outputIndex * uniforms.reduceSize; - - var bestValue = f32(${Hf[s]}); - let Length = uniforms.reduceSize; - for (var k = local_idx; k < Length; k = k + ${h}) { - let candidate = f32(${p.getByOffset("offset + k")}); - bestValue = ${Gf[s]}; - } - aBestValues[local_idx] = bestValue; - workgroupBarrier(); - - var reduceSize = min(Length, ${h}u); - for (var currentSize = reduceSize / 2u; reduceSize > 1u; - currentSize = reduceSize / 2u) { - let interval = DIV_CEIL(reduceSize, 2u); - if (local_idx < currentSize) { - let candidate = aBestValues[local_idx + interval]; - bestValue = ${Kf[s]}; - aBestValues[local_idx] = bestValue; - } - reduceSize = interval; - workgroupBarrier(); - } - - if (local_idx == 0u) { - ${u.setByOffset("outputIndex",`${s==="mean"?`${u.type.storage}(bestValue / f32(uniforms.reduceSize))`:`${u.type.storage}(${qf[s]})`}`)}; - } - }`;return{name:e,shaderCache:{hint:`${r};${h}`,inputDependencies:["type"]},getShaderSource:_,getRunData:()=>({outputs:[{dims:n,dataType:o}],dispatchGroup:{x:l},programUniforms:[{type:12,data:c}]})}},ps=(e,r,t,s)=>{let o=e.inputs.length===1?t:qc(e.inputs,t),n=o.axes;n.length===0&&!o.noopWithEmptyAxes&&(n=e.inputs[0].dims.map((g,_)=>_));let i=xe.normalizeAxes(n,e.inputs[0].dims.length),a=i,l=e.inputs[0],c=Zf(a,e.inputs[0].dims.length);c.length>0&&(l=e.compute(Wr(e.inputs[0],c),{inputs:[0],outputs:[-1]})[0],a=Qf(a.length,l.dims.length));let[p,u]=Xf(l.dims,a),h=p;o.keepDims&&(h=Jf(p,i)),e.compute(e_(r,o.cacheKey,[l],s,e.inputs[0].dataType,h,u),{inputs:[l]})},zy=(e,r)=>{ps(e,"ReduceMeanShared",r,"mean")},By=(e,r)=>{ps(e,"ReduceL1Shared",r,"l1")},Ry=(e,r)=>{ps(e,"ReduceL2Shared",r,"l2")},Ny=(e,r)=>{ps(e,"ReduceLogSumExpShared",r,"logSumExp")},jy=(e,r)=>{ps(e,"ReduceMaxShared",r,"max")},Vy=(e,r)=>{ps(e,"ReduceMinShared",r,"min")},Uy=(e,r)=>{ps(e,"ReduceProdShared",r,"prod")},Wy=(e,r)=>{ps(e,"ReduceSumShared",r,"sum")},Gy=(e,r)=>{ps(e,"ReduceSumSquareShared",r,"sumSquare")},Ky=(e,r)=>{ps(e,"ReduceLogSumShared",r,"logSum")}}),hs,t_,id,qc,ms,r_,s_,n_,o_,i_,a_,l_,d_,c_,u_,fs,Hy,qy,Qy,Xy,Jy,Yy,Zy,eM,tM,rM,Mu=Ve(()=>{mt(),bt(),tr(),xt(),Qv(),hs=e=>{if(!e||e.length===0||e.length>2)throw new Error("Reduce op requires 1 or 2 inputs.");if(e.length===2&&e[1].dims.length!==1)throw new Error("Invalid axes input dims.")},t_=e=>["","",`var value = ${e.getByIndices("input_indices")};`,""],id=(e,r,t,s,o,n,i=!1,a=!1)=>{let l=[],c=t[0].dims,p=c.length,u=xe.normalizeAxes(o,p),h=!a&&u.length===0;c.forEach((E,I)=>{h||u.indexOf(I)>=0?i&&l.push(1):l.push(E)});let g=l.length,_=xe.size(l);return{name:e,shaderCache:r,getShaderSource:E=>{let I=[],M=$e("_A",t[0].dataType,p),y=tt("output",n,g),$=s(M,y,u),P=$[2];for(let b=0,w=0;b=0?(i&&w++,P=`for(var j${b}: u32 = 0; j${b} < ${c[b]}; j${b}++) { - ${$[2].includes("last_index")?`let last_index = j${b};`:""} - ${M.indicesSet("input_indices",b,`j${b}`)} - ${P} - }`):(I.push(`${M.indicesSet("input_indices",b,y.indicesGet("output_indices",w))};`),w++);return` - - ${E.registerUniform("output_size","u32").declareVariables(M,y)} - - ${E.mainStart()} - ${E.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - var input_indices: ${M.type.indices}; - let output_indices = ${y.offsetToIndices("global_idx")}; - - ${I.join(` -`)} - ${$[0]} // init ops for reduce max/min - ${$[1]} - ${P} - ${$[3]} - ${$.length===4?y.setByOffset("global_idx","value"):$.slice(4).join(` -`)} - }`},getRunData:()=>({outputs:[{dims:l,dataType:n}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:[{type:12,data:_},...nt(c,l)]})}},qc=(e,r)=>{let t=[];return e[1].dims[0]>0&&e[1].getBigInt64Array().forEach(s=>t.push(Number(s))),Lt({axes:t,keepDims:r.keepDims,noopWithEmptyAxes:r.noopWithEmptyAxes})},ms=(e,r,t,s)=>{let o=e.inputs,n=o.length===1?t:qc(o,t);e.compute(id(r,{hint:n.cacheKey,inputDependencies:["rank"]},[o[0]],n.noopWithEmptyAxes&&n.axes.length===0?t_:s,n.axes,o[0].dataType,n.keepDims,n.noopWithEmptyAxes),{inputs:[0]})},r_=(e,r)=>{hs(e.inputs),ms(e,"ReduceLogSum",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += ${t.getByIndices("input_indices")};`,"value = log(value);"])},s_=(e,r)=>{hs(e.inputs),ms(e,"ReduceL1",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += abs(${t.getByIndices("input_indices")});`,""])},n_=(e,r)=>{hs(e.inputs),ms(e,"ReduceL2",r,(t,s)=>[`var t = ${s.type.value}(0); var value = ${s.type.value}(0);`,"",`t = ${t.getByIndices("input_indices")}; value += (t * t);`,"value = sqrt(value);"])},o_=(e,r)=>{hs(e.inputs),ms(e,"ReduceLogSumExp",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += exp(${t.getByIndices("input_indices")});`,"value = log(value);"])},i_=(e,r)=>{hs(e.inputs),ms(e,"ReduceMax",r,(t,s,o)=>{let n=[];for(let i=0;i=0||o.length===0)&&n.push(t.indicesSet("input_indices",i,0));return[`${n.join(` -`)}`,`var value = ${t.getByIndices("input_indices")};`,`value = max(value, ${t.getByIndices("input_indices")});`,""]})},a_=(e,r)=>{hs(e.inputs),ms(e,"ReduceMean",r,(t,s,o)=>{let n=1;for(let i=0;i=0||o.length===0)&&(n*=e.inputs[0].dims[i]);return["var sum = f32(0);","",`sum += f32(${t.getByIndices("input_indices")});`,`let value = ${s.type.value}(sum / ${n});`]})},l_=(e,r)=>{hs(e.inputs),ms(e,"ReduceMin",r,(t,s,o)=>{let n=[];for(let i=0;i=0||o.length===0)&&n.push(`input_indices[${i}] = 0;`);return[`${n.join(` -`)}`,`var value = ${t.getByIndices("input_indices")};`,`value = min(value, ${t.getByIndices("input_indices")});`,""]})},d_=(e,r)=>{hs(e.inputs),ms(e,"ReduceProd",r,(t,s)=>[`var value = ${s.type.storage}(1);`,"",`value *= ${t.getByIndices("input_indices")};`,""])},c_=(e,r)=>{hs(e.inputs),ms(e,"ReduceSum",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += ${t.getByIndices("input_indices")};`,""])},u_=(e,r)=>{hs(e.inputs),ms(e,"ReduceSumSquare",r,(t,s)=>[`var t = ${s.type.value}(0); var value = ${s.type.value}(0);`,"",`t = ${t.getByIndices("input_indices")}; value += t * t;`,""])},fs=(e,r,t)=>{if(r.length===0)return t;let s=1,o=1;for(let n=0;n1024},Hy=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?a_(e,r):zy(e,r)},qy=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?s_(e,r):By(e,r)},Qy=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?n_(e,r):Ry(e,r)},Xy=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?o_(e,r):Ny(e,r)},Jy=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?i_(e,r):jy(e,r)},Yy=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?l_(e,r):Vy(e,r)},Zy=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?d_(e,r):Uy(e,r)},eM=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?c_(e,r):Wy(e,r)},tM=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?u_(e,r):Gy(e,r)},rM=(e,r)=>{fs(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?r_(e,r):Ky(e,r)}}),dc,sM,nM,Qc,Xv=Ve(()=>{mt(),tr(),Mu(),dc=e=>{if(!e||e.length===0||e.length>2)throw new Error("ArgMinMaxOp op requires 1 or 2 inputs.");if(e[0].dataType!==1)throw new Error("Invalid input type.")},sM=(e,r)=>{dc(e.inputs);let t=(s,o,n)=>{let i=[];for(let a=0;a=0||n.length===0)&&i.push(`input_indices[${a}] = 0;`);return[`${i.join(` -`)}`,`var value = ${s.getByIndices("input_indices")}; -var best_index : i32 = 0;`,`if (${s.getByIndices("input_indices")} ${r.selectLastIndex>0?"<=":"<"} value) { - value = ${s.getByIndices("input_indices")}; - best_index = i32(last_index); - }`,"",o.setByOffset("global_idx","best_index")]};e.compute(id("ArgMin",{hint:r.cacheKey,inputDependencies:["rank"]},[e.inputs[0]],t,[r.axis],7,r.keepDims),{inputs:[0]})},nM=(e,r)=>{dc(e.inputs);let t=(s,o,n)=>{let i=[];for(let a=0;a=0||n.length===0)&&i.push(`input_indices[${a}] = 0;`);return[`${i.join(` -`)}`,`var value = ${s.getByIndices("input_indices")}; -var best_index : i32 = 0;`,`if (${s.getByIndices("input_indices")} ${r.selectLastIndex>0?">=":">"} value) { - value = ${s.getByIndices("input_indices")}; - best_index = i32(last_index); - }`,"",o.setByOffset("global_idx","best_index")]};e.compute(id("argMax",{hint:r.cacheKey,inputDependencies:["rank"]},[e.inputs[0]],t,[r.axis],7,r.keepDims),{inputs:[0]})},Qc=e=>Lt(e)}),p_,Wl,h_,m_,f_,ha,__,oM,bu=Ve(()=>{mt(),bt(),wu(),xt(),p_=(e,r)=>{let t=e[0],s=e[1],o=e[2],n=e[3],i=e[4],a=e[5];if(i&&a)throw new Error("Attention cannot have both past and attention_bias");if(t.dims.length!==3)throw new Error('Input "input" must have 3 dimensions');let l=t.dims[0],c=t.dims[1],p=t.dims[2];if(o.dims.length!==1)throw new Error('Input "bias" is expected to have 1 dimensions');if(s.dims.length!==2)throw new Error('Input "weights" is expected to have 2 dimensions');if(s.dims[0]!==p)throw new Error("Input 1 dimension 0 should have same length as dimension 2 of input 0");if(o.dims[0]!==s.dims[1])throw new Error('Input "bias" dimension 0 should have same length as dimension 1 of input "weights"');let u=o.dims[0]/3,h=u,g=h;if(r.qkvHiddenSizes.length>0){if(r.qkvHiddenSizes.length!==3)throw new Error("qkv_hidden_sizes attribute should have 3 elements");for(let $ of r.qkvHiddenSizes)if($%r.numHeads!==0)throw new Error("qkv_hidden_sizes should be divisible by num_heads");u=r.qkvHiddenSizes[0],h=r.qkvHiddenSizes[1],g=r.qkvHiddenSizes[2]}let _=c;if(u!==h)throw new Error("qkv_hidden_sizes first element should be same as the second");if(o.dims[0]!==u+h+g)throw new Error('Input "bias" dimension 0 should have same length as sum of Q/K/V hidden sizes');let E=0;if(i){if(h!==g)throw new Error('Input "past" expect k_hidden_size == v_hidden_size');if(i.dims.length!==5)throw new Error('Input "past" must have 5 dimensions');if(i.dims[0]!==2)throw new Error('Input "past" first dimension must be 2');if(i.dims[1]!==l)throw new Error('Input "past" second dimension must be batch_size');if(i.dims[2]!==r.numHeads)throw new Error('Input "past" third dimension must be num_heads');if(i.dims[4]!==h/r.numHeads)throw new Error('Input "past" fifth dimension must be k_hidden_size / num_heads');r.pastPresentShareBuffer||(E=i.dims[3])}let I=_+E,M=-1,y=0;if(n)throw new Error("Mask not supported");if(i)throw new Error("past is not supported");if(a){if(a.dims.length!==4)throw new Error('Input "attention_bias" must have 4 dimensions');if(a.dims[0]!==l||a.dims[1]!==r.numHeads||a.dims[2]!==c||a.dims[3]!==I)throw new Error('Expect "attention_bias" shape (batch_size, num_heads, sequence_length, total_sequence_length)')}return{batchSize:l,sequenceLength:c,pastSequenceLength:E,kvSequenceLength:_,totalSequenceLength:I,maxSequenceLength:M,inputHiddenSize:p,hiddenSize:u,vHiddenSize:g,headSize:Math.floor(u/r.numHeads),vHeadSize:Math.floor(g/r.numHeads),numHeads:r.numHeads,isUnidirectional:!1,pastPresentShareBuffer:!1,maskFilterValue:r.maskFilterValue,maskType:y,scale:r.scale,broadcastResPosBias:!1,passPastInKv:!1,qkvFormat:1}},Wl=(e,r,t)=>r&&e?` - let total_sequence_length_input = u32(${r.getByOffset("0")}); - let present_sequence_length = max(total_sequence_length_input, uniforms.past_sequence_length); - let is_subsequent_prompt: bool = sequence_length > 1 && sequence_length != total_sequence_length_input; - let is_first_prompt: bool = is_subsequent_prompt == false && sequence_length == total_sequence_length_input; - total_sequence_length = u32(${e==null?void 0:e.getByOffset("batchIdx")}) + 1; - var past_sequence_length: u32 = 0; - if (is_first_prompt == false) { - past_sequence_length = total_sequence_length - sequence_length; - } - `:` - ${t?"let past_sequence_length = uniforms.past_sequence_length":""}; - let present_sequence_length = total_sequence_length; - `,h_=(e,r,t,s,o,n,i,a)=>{let l=Jt(i?1:n),c=64,p=n/l;p{let y=tt("x",e.dataType,e.dims,l),$=[y],P=i?$e("seq_lens",i.dataType,i.dims):void 0;P&&$.push(P);let b=a?$e("total_sequence_length_input",a.dataType,a.dims):void 0;b&&$.push(b);let w=Cr(e.dataType),T=[{name:"batch_size",type:"u32"},{name:"num_heads",type:"u32"},{name:"past_sequence_length",type:"u32"},{name:"sequence_length",type:"u32"},{name:"total_sequence_length",type:"u32"},{name:"elements_per_thread",type:"u32"}];return` - var thread_max: array; - var thread_sum: array; - ${M.registerUniforms(T).declareVariables(...$)} - ${M.mainStart([c,1,1])} - let batchIdx = workgroup_id.z / uniforms.num_heads; - let headIdx = workgroup_id.z % uniforms.num_heads; - let sequence_length = uniforms.sequence_length; - var total_sequence_length = uniforms.total_sequence_length; - ${Wl(P,b,!1)} - let local_offset = local_idx * uniforms.elements_per_thread; - let offset = (global_idx / ${c}) * uniforms.total_sequence_length + local_offset; - let seq_causal_length = ${i?"u32(past_sequence_length + workgroup_id.y + 1)":"total_sequence_length"}; - var thread_max_vector = ${_}(-3.402823e+38f); - for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { - thread_max_vector = max(${_}(x[offset + i]), thread_max_vector); - } - thread_max[local_idx] = ${(()=>{switch(l){case 1:return"thread_max_vector";case 2:return"max(thread_max_vector.x, thread_max_vector.y)";case 4:return"max(max(thread_max_vector.x, thread_max_vector.y), max(thread_max_vector.z, thread_max_vector.w))";default:throw new Error(`Unsupported components: ${l}`)}})()}; - workgroupBarrier(); - - var max_value = f32(-3.402823e+38f); - for (var i = 0u; i < ${c}; i++) { - max_value = max(thread_max[i], max_value); - } - - var sum_vector = ${_}(0); - for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { - sum_vector += exp(${_}(x[offset + i]) - max_value); - } - thread_sum[local_idx] = ${(()=>{switch(l){case 1:return"sum_vector";case 2:return"sum_vector.x + sum_vector.y";case 4:return"sum_vector.x + sum_vector.y + sum_vector.z + sum_vector.w";default:throw new Error(`Unsupported components: ${l}`)}})()}; - workgroupBarrier(); - - var sum: f32 = 0; - for (var i = 0u; i < ${c}; i++) { - sum += thread_sum[i]; - } - - if (sum == 0) { - for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { - x[offset + i] = ${y.type.value}(${w}(1.0) / ${w}(seq_causal_length)); - } - } else { - for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { - var f32input = ${_}(x[offset + i]); - x[offset + i] = ${y.type.value}(exp(f32input - max_value) / sum); - } - } - ${i?` - for (var total_seq_id: u32 = seq_causal_length; total_seq_id + local_offset < uniforms.total_sequence_length; total_seq_id++) { - x[offset + total_seq_id] = ${y.type.value}(${w}(0)); - }`:""}; - }`};return{name:"AttentionProbsSoftmax",shaderCache:{hint:`${c};${g};${l}`,inputDependencies:E},getShaderSource:I,getRunData:()=>({outputs:[],dispatchGroup:{x:1,y:o,z:r*t},programUniforms:h})}},m_=(e,r,t,s,o,n,i,a,l)=>{let c=i+n.kvSequenceLength,p=[n.batchSize,n.numHeads,n.sequenceLength,c],u=e>1&&s,h=n.kvNumHeads?n.kvNumHeads:n.numHeads,g=u?[n.batchSize,h,c,n.headSize]:void 0,_=n.nReps?n.nReps:1,E=n.scale===0?1/Math.sqrt(n.headSize):n.scale,I=Jt(n.headSize),M=n.headSize/I,y=12,$={x:Math.ceil(c/y),y:Math.ceil(n.sequenceLength/y),z:n.batchSize*n.numHeads},P=[{type:12,data:n.sequenceLength},{type:12,data:M},{type:12,data:c},{type:12,data:n.numHeads},{type:12,data:n.headSize},{type:1,data:E},{type:12,data:i},{type:12,data:n.kvSequenceLength},{type:12,data:_}],b=u&&s&&xe.size(s.dims)>0,w=["type","type"];b&&w.push("type"),o&&w.push("type"),a&&w.push("type"),l&&w.push("type");let T=[{dims:p,dataType:r.dataType,gpuDataType:0}];u&&T.push({dims:g,dataType:r.dataType,gpuDataType:0});let k=z=>{let R=$e("q",r.dataType,r.dims,I),Q=$e("key",t.dataType,t.dims,I),q=[R,Q];if(b){let ce=$e("past_key",s.dataType,s.dims,I);q.push(ce)}o&&q.push($e("attention_bias",o.dataType,o.dims));let U=a?$e("seq_lens",a.dataType,a.dims):void 0;U&&q.push(U);let Z=l?$e("total_sequence_length_input",l.dataType,l.dims):void 0;Z&&q.push(Z);let H=tt("output",r.dataType,p),J=[H];u&&J.push(tt("present_key",r.dataType,g,I));let oe=Cr(1,I),ae=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"alpha",type:"f32"},{name:"past_sequence_length",type:"u32"},{name:"kv_sequence_length",type:"u32"},{name:"n_reps",type:"u32"}];return` - const TILE_SIZE = ${y}u; - - var tileQ: array<${R.type.storage}, ${y*y}>; - var tileK: array<${R.type.storage}, ${y*y}>; - ${z.registerUniforms(ae).declareVariables(...q,...J)} - ${z.mainStart([y,y,1])} - // x holds the N and y holds the M - let headIdx = workgroup_id.z % uniforms.num_heads; - let kvHeadIdx = ${_===1?"headIdx":"headIdx / uniforms.n_reps"}; - let kv_num_heads = ${_===1?"uniforms.num_heads":"uniforms.num_heads / uniforms.n_reps"}; - let batchIdx = workgroup_id.z / uniforms.num_heads; - let m = workgroup_id.y * TILE_SIZE; - let n = workgroup_id.x * TILE_SIZE; - let sequence_length = uniforms.M; - var total_sequence_length = uniforms.N; - ${Wl(U,Z,!0)} - let absKvHeadIdx = batchIdx * kv_num_heads + kvHeadIdx; - let qOffset = workgroup_id.z * uniforms.M * uniforms.K + m * uniforms.K; - ${b&&u?"let pastKeyOffset = absKvHeadIdx * uniforms.past_sequence_length * uniforms.K;":""}; - let kOffset = absKvHeadIdx * uniforms.kv_sequence_length * uniforms.K; - ${u?"let presentKeyOffset = absKvHeadIdx * uniforms.N * uniforms.K;":""} - var value = ${oe}(0); - for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { - if (global_id.y < uniforms.M && w + local_id.x < uniforms.K) { - tileQ[TILE_SIZE * local_id.y + local_id.x] = q[qOffset + local_id.y * uniforms.K + w + local_id.x]; - } - if (n + local_id.y < uniforms.N && w + local_id.x < uniforms.K) { - var idx = TILE_SIZE * local_id.y + local_id.x; - ${b&&u?` - if (n + local_id.y < past_sequence_length) { - tileK[idx] = past_key[pastKeyOffset + (n + local_id.y) * uniforms.K + w + local_id.x]; - } else if (n + local_id.y - past_sequence_length < uniforms.kv_sequence_length) { - tileK[idx] = key[kOffset + (n + local_id.y - past_sequence_length) * uniforms.K + w + local_id.x]; - }`:` - if (n + local_id.y < uniforms.kv_sequence_length) { - tileK[idx] = key[kOffset + (n + local_id.y) * uniforms.K + w + local_id.x]; - }`} - ${u?`if (n + local_id.y < present_sequence_length) { - present_key[presentKeyOffset + (n + local_id.y) * uniforms.K + w + local_id.x] = tileK[idx]; - }`:""} - } - workgroupBarrier(); - - for (var k: u32 = 0u; k < TILE_SIZE && w+k < uniforms.K; k++) { - value += ${oe}(tileQ[TILE_SIZE * local_id.y + k] * tileK[TILE_SIZE * local_id.x + k]); - } - - workgroupBarrier(); - } - - if (global_id.y < uniforms.M && global_id.x < total_sequence_length) { - let headOffset = workgroup_id.z * uniforms.M * uniforms.N; - let outputIdx = headOffset + global_id.y * uniforms.N + global_id.x; - var sum: f32 = ${(()=>{switch(I){case 1:return"value";case 2:return"value.x + value.y";case 4:return"value.x + value.y + value.z + value.w";default:throw new Error(`Unsupported components: ${I}`)}})()}; - output[outputIdx] = ${H.type.value} (sum * uniforms.alpha) + ${o?"attention_bias[outputIdx]":"0.0"}; - } - }`};return{name:"AttentionProbs",shaderCache:{hint:`${I};${o!==void 0};${s!==void 0};${e}`,inputDependencies:w},getRunData:()=>({outputs:T,dispatchGroup:$,programUniforms:P}),getShaderSource:k}},f_=(e,r,t,s,o,n,i=void 0,a=void 0)=>{let l=n+o.kvSequenceLength,c=o.nReps?o.nReps:1,p=o.vHiddenSize*c,u=e>1&&s,h=o.kvNumHeads?o.kvNumHeads:o.numHeads,g=u?[o.batchSize,h,l,o.headSize]:void 0,_=[o.batchSize,o.sequenceLength,p],E=12,I={x:Math.ceil(o.vHeadSize/E),y:Math.ceil(o.sequenceLength/E),z:o.batchSize*o.numHeads},M=[{type:12,data:o.sequenceLength},{type:12,data:l},{type:12,data:o.vHeadSize},{type:12,data:o.numHeads},{type:12,data:o.headSize},{type:12,data:p},{type:12,data:n},{type:12,data:o.kvSequenceLength},{type:12,data:c}],y=u&&s&&xe.size(s.dims)>0,$=["type","type"];y&&$.push("type"),i&&$.push("type"),a&&$.push("type");let P=[{dims:_,dataType:r.dataType,gpuDataType:0}];u&&P.push({dims:g,dataType:r.dataType,gpuDataType:0});let b=w=>{let T=$e("probs",r.dataType,r.dims),k=$e("v",t.dataType,t.dims),z=[T,k];y&&z.push($e("past_value",s.dataType,s.dims));let R=i?$e("seq_lens",i.dataType,i.dims):void 0;i&&z.push(R);let Q=a?$e("total_sequence_length_input",a.dataType,a.dims):void 0;a&&z.push(Q);let q=[tt("output",r.dataType,_)];u&&q.push(tt("present_value",r.dataType,g));let U=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"v_hidden_size",type:"u32"},{name:"past_sequence_length",type:"u32"},{name:"kv_sequence_length",type:"u32"},{name:"n_reps",type:"u32"}];return` - const TILE_SIZE = ${E}u; - var tileQ: array<${T.type.value}, ${E*E}>; - var tileV: array<${T.type.value}, ${E*E}>; - ${w.registerUniforms(U).declareVariables(...z,...q)} - ${w.mainStart([E,E,1])} - let headIdx = workgroup_id.z % uniforms.num_heads; - let batchIdx = workgroup_id.z / uniforms.num_heads; - let kvHeadIdx = ${c===1?"headIdx":"headIdx / uniforms.n_reps"}; - let kv_num_heads = ${c===1?"uniforms.num_heads":"uniforms.num_heads / uniforms.n_reps"}; - let m = global_id.y; - let n = global_id.x; - let sequence_length = uniforms.M; - var total_sequence_length = uniforms.K; - ${Wl(R,Q,!0)} - let offsetA = workgroup_id.z * uniforms.M * uniforms.K + m * uniforms.K; - let absKvHeadIdx = batchIdx * kv_num_heads + kvHeadIdx; // kvHeadIdx is relative to the batch - ${y&&u?"let pastValueOffset = absKvHeadIdx * uniforms.N * uniforms.past_sequence_length + n;":""}; - let vOffset = absKvHeadIdx * uniforms.N * uniforms.kv_sequence_length + n; - ${u?"let presentValueOffset = absKvHeadIdx * uniforms.N * uniforms.K + n;":""} - var value = ${T.type.storage}(0); - for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { - if (m < uniforms.M && w + local_id.x < uniforms.K) { - tileQ[TILE_SIZE * local_id.y + local_id.x] = probs[offsetA + w + local_id.x]; - } - if (n < uniforms.N && w + local_id.y < uniforms.K) { - var idx = TILE_SIZE * local_id.y + local_id.x; - ${y&&u?` - if (w + local_id.y < past_sequence_length) { - tileV[idx] = past_value[pastValueOffset + (w + local_id.y) * uniforms.N]; - } else if (w + local_id.y - past_sequence_length < uniforms.kv_sequence_length) { - tileV[idx] = v[vOffset + (w + local_id.y - past_sequence_length) * uniforms.N]; - } - `:` - if (w + local_id.y < uniforms.kv_sequence_length) { - tileV[idx] = v[vOffset + (w + local_id.y) * uniforms.N]; - }`} - ${u?` - if (w + local_id.y < present_sequence_length) { - present_value[presentValueOffset + (w + local_id.y) * uniforms.N] = tileV[idx]; - }`:""} - } - workgroupBarrier(); - for (var k: u32 = 0u; k < TILE_SIZE && w+k < total_sequence_length; k++) { - value += tileQ[TILE_SIZE * local_id.y + k] * tileV[TILE_SIZE * k + local_id.x]; - } - workgroupBarrier(); - } - - // we need to transpose output from BNSH_v to BSND_v - if (m < uniforms.M && n < uniforms.N) { - let outputIdx = batchIdx * uniforms.M * uniforms.v_hidden_size + m * uniforms.v_hidden_size - + headIdx * uniforms.N + n; - output[outputIdx] = value; - } - }`};return{name:"AttentionScore",shaderCache:{hint:`${s!==void 0};${e}`,inputDependencies:$},getRunData:()=>({outputs:P,dispatchGroup:I,programUniforms:M}),getShaderSource:b}},ha=(e,r,t,s,o,n,i,a,l,c,p=void 0,u=void 0)=>{let h=Math.min(e.outputCount,1+(i?1:0)+(a?1:0)),g=h>1?c.pastSequenceLength:0,_=g+c.kvSequenceLength,E=l&&xe.size(l.dims)>0?l:void 0,I=[r,t];h>1&&i&&xe.size(i.dims)>0&&I.push(i),E&&I.push(E),p&&I.push(p),u&&I.push(u);let M=e.compute(m_(h,r,t,i,E,c,g,p,u),{inputs:I,outputs:h>1?[-1,1]:[-1]})[0];e.compute(h_(M,c.batchSize,c.numHeads,g,c.sequenceLength,_,p,u),{inputs:p&&u?[M,p,u]:[M],outputs:[]});let y=[M,s];h>1&&a&&xe.size(a.dims)>0&&y.push(a),p&&y.push(p),u&&y.push(u),e.compute(f_(h,M,s,a,c,g,p,u),{inputs:y,outputs:h>1?[0,2]:[0]})},__=(e,r)=>{let t=[r.batchSize,r.numHeads,r.sequenceLength,r.headSize],s=r.sequenceLength,o=r.inputHiddenSize,n=r.headSize,i=12,a={x:Math.ceil(r.headSize/i),y:Math.ceil(r.sequenceLength/i),z:r.batchSize*r.numHeads},l=[e.inputs[0],e.inputs[1],e.inputs[2]],c=[{type:12,data:s},{type:12,data:o},{type:12,data:n},{type:12,data:r.numHeads},{type:12,data:r.headSize},{type:12,data:r.hiddenSize},{type:12,data:r.hiddenSize+r.hiddenSize+r.vHiddenSize}],p=u=>{let h=tt("output_q",l[0].dataType,t),g=tt("output_k",l[0].dataType,t),_=tt("output_v",l[0].dataType,t),E=$e("input",l[0].dataType,l[0].dims),I=$e("weight",l[1].dataType,l[1].dims),M=$e("bias",l[2].dataType,l[2].dims),y=E.type.storage,$=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"hidden_size",type:"u32"},{name:"ldb",type:"u32"}];return` - const TILE_SIZE = ${i}u; - var tileInput: array<${y}, ${i*i}>; - var tileWeightQ: array<${y}, ${i*i}>; - var tileWeightK: array<${y}, ${i*i}>; - var tileWeightV: array<${y}, ${i*i}>; - ${u.registerUniforms($).declareVariables(E,I,M,h,g,_)} - ${u.mainStart([i,i,1])} - let batchIndex = workgroup_id.z / uniforms.num_heads; - let headNumber = workgroup_id.z % uniforms.num_heads; - let m = global_id.y; - let n = global_id.x; - - let inputOffset = batchIndex * (uniforms.M * uniforms.K) + m * uniforms.K; - let biasOffsetQ = headNumber * uniforms.head_size; - let biasOffsetK = uniforms.hidden_size + biasOffsetQ; - let biasOffsetV = uniforms.hidden_size + biasOffsetK; - - var valueQ = ${y}(0); - var valueK = ${y}(0); - var valueV = ${y}(0); - for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { - if (m < uniforms.M && w + local_id.x < uniforms.K) { - tileInput[TILE_SIZE * local_id.y + local_id.x] = input[inputOffset + w + local_id.x]; - } - if (n < uniforms.N && w + local_id.y < uniforms.K) { - let offset = n + (w + local_id.y) * uniforms.ldb; - tileWeightQ[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetQ + offset]; - tileWeightK[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetK + offset]; - tileWeightV[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetV + offset]; - } - workgroupBarrier(); - for (var k: u32 = 0u; k({outputs:[{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0},{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0},{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0}],dispatchGroup:a,programUniforms:c}),getShaderSource:p},{inputs:l,outputs:[-1,-1,-1]})},oM=(e,r)=>{let t=p_(e.inputs,r),[s,o,n]=__(e,t);return ha(e,s,o,n,e.inputs[4],void 0,void 0,void 0,e.inputs[5],t)}}),g_,w_,y_,iM,Jv=Ve(()=>{Ms(),mt(),bt(),tr(),xt(),g_=(e,r)=>{if(!e||e.length!==5)throw new Error("BatchNormalization requires 5 inputs");let t=(s,o,n)=>{let i=o.length;if(i!==s.length)throw new Error(`${n}: num dimensions != ${i}`);o.forEach((a,l)=>{if(a!==s[l])throw new Error(`${n}: dim[${l}] do not match`)})};if(e[0].dims.length>1){let s=r.format==="NHWC"?r.spatial?e[0].dims.slice(-1):e[0].dims.slice(-1).concat(e[0].dims.slice(1,e[0].dims.length-1)):e[0].dims.slice(1,r.spatial?2:void 0);t(e[1].dims,s,"Invalid input scale"),t(e[2].dims,s,"Invalid input B"),t(e[3].dims,s,"Invalid input mean"),t(e[4].dims,s,"Invalid input var")}else t(e[1].dims,[1],"Invalid input scale"),t(e[2].dims,[1],"Invalid input B"),t(e[3].dims,[1],"Invalid input mean"),t(e[4].dims,[1],"Invalid input var")},w_=(e,r)=>{let{epsilon:t,spatial:s,format:o}=r,n=e[0].dims,i=s?Jt(n[n.length-1]):1,a=o==="NHWC"&&n.length>1?i:1,l=xe.size(n)/i,c=s,p=c?n.length:n,u=$e("x",e[0].dataType,e[0].dims,i),h=$e("scale",e[1].dataType,e[1].dims,a),g=$e("bias",e[2].dataType,e[2].dims,a),_=$e("inputMean",e[3].dataType,e[3].dims,a),E=$e("inputVar",e[4].dataType,e[4].dims,a),I=tt("y",e[0].dataType,p,i),M=()=>{let $="";if(s)$=`let cOffset = ${n.length===1?"0u":o==="NHWC"?`outputIndices[${n.length-1}] / ${i}`:"outputIndices[1]"};`;else if(o==="NCHW")$=` - ${I.indicesSet("outputIndices","0","0")} - let cOffset = ${I.indicesToOffset("outputIndices")};`;else{$=`var cIndices = ${h.type.indices}(0); - cIndices[0] = outputIndices[${n.length-1}];`;for(let P=1;P` - const epsilon = ${t}; - ${$.registerUniform("outputSize","u32").declareVariables(u,h,g,_,E,I)} - ${$.mainStart()} - ${$.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - var outputIndices = ${I.offsetToIndices(`global_idx * ${i}`)}; - ${M()} - let scale = ${h.getByOffset("cOffset")}; - let bias = ${g.getByOffset("cOffset")}; - let inputMean = ${_.getByOffset("cOffset")}; - let inputVar = ${E.getByOffset("cOffset")}; - let x = ${u.getByOffset("global_idx")}; - let value = (x - inputMean) * inverseSqrt(inputVar + epsilon) * scale + bias; - ${I.setByOffset("global_idx","value")} - }`;return{name:"BatchNormalization",shaderCache:{hint:`${r.epsilon}_${r.format}_${s}_${i}`,inputDependencies:c?["rank","type","type","type","type"]:void 0},getShaderSource:y,getRunData:()=>({outputs:[{dims:e[0].dims,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:c?[{type:12,data:l},...nt(n)]:[{type:12,data:l}]})}},y_=e=>Lt(e),iM=(e,r)=>{let{inputs:t,outputCount:s}=e,o=y_({...r,outputCount:s});if(Kt.webgpu.validateInputContent&&g_(t,o),r.trainingMode)throw new Error("BatchNormalization trainingMode is not supported yet.");e.compute(w_(t,o))}}),M_,b_,aM,Yv=Ve(()=>{bt(),xt(),M_=e=>{if(e[0].dims.length!==3)throw new Error("input should have 3 dimensions");if(![320,640,1280].includes(e[0].dims[2]))throw new Error("number of channels should be 320, 640 or 1280");if(e[1].dims.length!==1)throw new Error("bias is expected to have 1 dimensions");if(e[0].dims[2]!==e[1].dims[0])throw new Error("last dimension of input and bias are not the same")},b_=e=>{let r=e[0].dims,t=e[0].dims[2],s=xe.size(r)/4,o=e[0].dataType,n=$e("input",o,r,4),i=$e("bias",o,[t],4),a=$e("residual",o,r,4),l=tt("output",o,r,4);return{name:"BiasAdd",getRunData:()=>({outputs:[{dims:r,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(s/64)}}),getShaderSource:c=>` - const channels = ${t}u / 4; - ${c.declareVariables(n,i,a,l)} - - ${c.mainStart()} - ${c.guardAgainstOutOfBoundsWorkgroupSizes(s)} - let value = ${n.getByOffset("global_idx")} - + ${i.getByOffset("global_idx % channels")} + ${a.getByOffset("global_idx")}; - ${l.setByOffset("global_idx","value")} - }`}},aM=e=>{M_(e.inputs),e.compute(b_(e.inputs))}}),v_,It,lM,dM,cM,uM,pM,hM,mM,fM,_M,x_,gM,wM,yM,MM,da,bM,td,vM,xM,TM,EM,PM,CM,SM,$M,kM,IM,AM,FM,OM,DM,LM,zM,cc,BM,Xc,Jc,RM,NM,jM,T_,E_,VM,vu=Ve(()=>{mt(),bt(),tr(),xt(),v_=(e,r,t,s,o,n,i)=>{let a=Math.ceil(r/4),l="";typeof o=="string"?l=`${o}(a)`:l=o("a");let c=$e("inputData",t,[a],4),p=tt("outputData",s,[a],4),u=[{name:"vec_size",type:"u32"}];return i&&u.push(...i),` - ${e.registerUniforms(u).declareVariables(c,p)} - - ${n??""} - - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} - - let a = ${c.getByOffset("global_idx")}; - ${p.setByOffset("global_idx",l)} - }`},It=(e,r,t,s,o,n=e.dataType,i,a)=>{let l=[{type:12,data:Math.ceil(xe.size(e.dims)/4)}];return i&&l.push(...i),{name:r,shaderCache:{hint:o,inputDependencies:["type"]},getShaderSource:c=>v_(c,xe.size(e.dims),e.dataType,n,t,s,a),getRunData:c=>({outputs:[{dims:e.dims,dataType:n}],dispatchGroup:{x:Math.ceil(xe.size(c[0].dims)/64/4)},programUniforms:l})}},lM=e=>{e.compute(It(e.inputs[0],"Abs","abs"))},dM=e=>{e.compute(It(e.inputs[0],"Acos","acos"))},cM=e=>{e.compute(It(e.inputs[0],"Acosh","acosh"))},uM=e=>{e.compute(It(e.inputs[0],"Asin","asin"))},pM=e=>{e.compute(It(e.inputs[0],"Asinh","asinh"))},hM=e=>{e.compute(It(e.inputs[0],"Atan","atan"))},mM=e=>{e.compute(It(e.inputs[0],"Atanh","atanh"))},fM=e=>Lt(e),_M=(e,r)=>{let t;switch(r.to){case 10:t="vec4";break;case 1:t="vec4";break;case 12:t="vec4";break;case 6:t="vec4";break;case 9:t="vec4";break;default:throw new RangeError(`not supported type (specified in attribute 'to' from 'Cast' operator): ${r.to}`)}e.compute(It(e.inputs[0],"Cast",t,void 0,r.cacheKey,r.to))},x_=e=>{let r,t,s=e.length>=2&&e[1].data!==0,o=e.length>=3&&e[2].data!==0;switch(e[0].dataType){case 1:r=s?e[1].getFloat32Array()[0]:-34028234663852886e22,t=o?e[2].getFloat32Array()[0]:34028234663852886e22;break;case 10:r=s?e[1].getUint16Array()[0]:64511,t=o?e[2].getUint16Array()[0]:31743;break;default:throw new Error("Unsupport data type")}return Lt({min:r,max:t})},gM=(e,r)=>{let t=r||x_(e.inputs),s=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"Clip",o=>`clamp(${o}, vec4<${s}>(uniforms.min), vec4<${s}>(uniforms.max))`,void 0,t.cacheKey,void 0,[{type:e.inputs[0].dataType,data:t.min},{type:e.inputs[0].dataType,data:t.max}],[{name:"min",type:s},{name:"max",type:s}]),{inputs:[0]})},wM=e=>{e.compute(It(e.inputs[0],"Ceil","ceil"))},yM=e=>{e.compute(It(e.inputs[0],"Cos","cos"))},MM=e=>{e.compute(It(e.inputs[0],"Cosh","cosh"))},da=e=>Lt(e),bM=(e,r)=>{let t=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"Elu",s=>`elu_vf32(${s})`,` - const elu_alpha_ = ${t}(${r.alpha}); - - fn elu_f32(a: ${t}) -> ${t} { - return select((exp(a) - 1.0) * elu_alpha_, a, a >= 0.0); - } - - fn elu_vf32(v: vec4<${t}>) -> vec4<${t}> { - return vec4(elu_f32(v.x), elu_f32(v.y), elu_f32(v.z), elu_f32(v.w)); - }`,r.cacheKey))},td=(e="f32")=>` -const r0: ${e} = 0.3275911; -const r1: ${e} = 0.254829592; -const r2: ${e} = -0.284496736; -const r3: ${e} = 1.421413741; -const r4: ${e} = -1.453152027; -const r5: ${e} = 1.061405429; - -fn erf_vf32(v: vec4<${e}>) -> vec4<${e}> { - let absv = abs(v); - let x = 1.0 / (1.0 + r0 * absv); - return sign(v) * (1.0 - ((((r5 * x + r4) * x + r3) * x + r2) * x + r1) * x * exp(-absv * absv)); -}`,vM=e=>{let r=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"Erf",t=>`erf_vf32(${t})`,td(r)))},xM=e=>{e.compute(It(e.inputs[0],"Exp","exp"))},TM=e=>{e.compute(It(e.inputs[0],"Floor","floor"))},EM=e=>{let r=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"Gelu",t=>`0.5 * ${t} * (1.0 + erf_vf32(${t} * 0.7071067811865475))`,td(r)))},PM=(e,r)=>{let t=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"LeakyRelu",s=>`select(leaky_relu_alpha_ * ${s}, ${s}, ${s} >= vec4<${t}>(0.0))`,`const leaky_relu_alpha_ = ${t}(${r.alpha});`,r.cacheKey))},CM=e=>{e.compute(It(e.inputs[0],"Not",r=>`!${r}`))},SM=e=>{e.compute(It(e.inputs[0],"Neg",r=>`-${r}`))},$M=e=>{e.compute(It(e.inputs[0],"Reciprocal",r=>`1.0/${r}`))},kM=e=>{let r=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"Relu",t=>`select(vec4<${r}>(0.0), ${t}, ${t} > vec4<${r}>(0.0))`))},IM=e=>{e.compute(It(e.inputs[0],"Sigmoid",r=>`(1.0 / (1.0 + exp(-${r})))`))},AM=e=>Lt(e),FM=(e,r)=>{let t=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"HardSigmoid",s=>`max(vec4<${t}>(0.0), min(vec4<${t}>(1.0), ${r.alpha} * ${s} + vec4<${t}>(${r.beta})))`,void 0,r.cacheKey))},OM=e=>{e.compute(It(e.inputs[0],"Sin","sin"))},DM=e=>{e.compute(It(e.inputs[0],"Sinh","sinh"))},LM=e=>{e.compute(It(e.inputs[0],"Sqrt","sqrt"))},zM=e=>{e.compute(It(e.inputs[0],"Tan","tan"))},cc=e=>`sign(${e}) * (1 - exp(-2 * abs(${e}))) / (1 + exp(-2 * abs(${e})))`,BM=e=>{e.compute(It(e.inputs[0],"Tanh",cc))},Xc=(e="f32")=>` -const fast_gelu_a: ${e} = 0.5; -const fast_gelu_b: ${e} = 0.7978845608028654; -const fast_gelu_c: ${e} = 0.035677408136300125; - -fn tanh_v(v: vec4<${e}>) -> vec4<${e}> { - return ${cc("v")}; -} -`,Jc=e=>`(fast_gelu_a + fast_gelu_a * tanh_v(${e} * (fast_gelu_c * ${e} * ${e} + fast_gelu_b))) * ${e}`,RM=e=>{let r=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"FastGelu",Jc,Xc(r),void 0,e.inputs[0].dataType))},NM=(e,r)=>{let t=Cr(e.inputs[0].dataType);return e.compute(It(e.inputs[0],"ThresholdedRelu",s=>`select(vec4<${t}>(0.0), ${s}, ${s} > thresholded_relu_alpha_)`,`const thresholded_relu_alpha_ = vec4<${t}>(${r.alpha});`,r.cacheKey)),0},jM=e=>{e.compute(It(e.inputs[0],"Log","log"))},T_=(e,r)=>` -const alpha = vec4<${e}>(${r}); -const one = ${e}(1.0); -const zero = ${e}(0.0); - -fn quick_gelu_impl(x: vec4<${e}>) -> vec4<${e}> { - let v = x *alpha; - var x1 : vec4<${e}>; - for (var i = 0; i < 4; i = i + 1) { - if (v[i] >= zero) { - x1[i] = one / (one + exp(-v[i])); - } else { - x1[i] = one - one / (one + exp(v[i])); - } - } - return x * x1; -} -`,E_=e=>`quick_gelu_impl(${e})`,VM=(e,r)=>{let t=Cr(e.inputs[0].dataType);e.compute(It(e.inputs[0],"QuickGelu",E_,T_(t,r.alpha),r.cacheKey,e.inputs[0].dataType))}}),P_,C_,UM,Zv=Ve(()=>{bt(),xt(),vu(),P_=e=>{if(e[0].dims.length!==3)throw new Error("input should have 3 dimensions");if(![2560,5120,10240].includes(e[0].dims[2]))throw new Error("hidden state should be 2560, 5120 or 10240");if(e[1].dims.length!==1)throw new Error("bias is expected to have 1 dimensions");if(e[0].dims[2]!==e[1].dims[0])throw new Error("last dimension of input and bias are not the same")},C_=e=>{let r=e[0].dims.slice();r[2]=r[2]/2;let t=$e("input",e[0].dataType,e[0].dims,4),s=$e("bias",e[0].dataType,[e[0].dims[2]],4),o=tt("output",e[0].dataType,r,4),n=xe.size(r)/4,i=pr(e[0].dataType);return{name:"BiasSplitGelu",getRunData:()=>({outputs:[{dims:r,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(n/64)}}),getShaderSource:a=>` - const M_SQRT2 = sqrt(2.0); - const halfChannels = ${e[0].dims[2]/4/2}u; - - ${a.declareVariables(t,s,o)} - - ${td(i)} - - ${a.mainStart()} - ${a.guardAgainstOutOfBoundsWorkgroupSizes(n)} - let biasIdx = global_idx % halfChannels; - let batchIndex = global_idx / halfChannels; - let inputOffset = biasIdx + batchIndex * halfChannels * 2; - let valueLeft = input[inputOffset] + bias[biasIdx]; - let valueRight = input[inputOffset + halfChannels] + bias[biasIdx + halfChannels]; - let geluRight = valueRight * 0.5 * (erf_vf32(valueRight / M_SQRT2) + 1); - - ${o.setByOffset("global_idx","valueLeft * geluRight")} - }`}},UM=e=>{P_(e.inputs),e.compute(C_(e.inputs))}}),S_,$_,_s,WM,GM,KM,HM,qM,QM,XM,JM,YM,ZM,ex=Ve(()=>{mt(),bt(),xt(),S_=(e,r,t,s,o,n,i,a,l,c,p,u)=>{let h,g;typeof a=="string"?h=g=(y,$)=>`${a}((${y}),(${$}))`:typeof a=="function"?h=g=a:(h=a.scalar,g=a.vector);let _=tt("outputData",p,s.length,4),E=$e("aData",l,r.length,4),I=$e("bData",c,t.length,4),M;if(o)if(n){let y=xe.size(r)===1,$=xe.size(t)===1,P=r.length>0&&r[r.length-1]%4===0,b=t.length>0&&t[t.length-1]%4===0;y||$?M=_.setByOffset("global_idx",g(y?`${E.type.value}(${E.getByOffset("0")}.x)`:E.getByOffset("global_idx"),$?`${I.type.value}(${I.getByOffset("0")}.x)`:I.getByOffset("global_idx"))):M=` - let outputIndices = ${_.offsetToIndices("global_idx * 4u")}; - let offsetA = ${E.broadcastedIndicesToOffset("outputIndices",_)}; - let offsetB = ${I.broadcastedIndicesToOffset("outputIndices",_)}; - ${_.setByOffset("global_idx",g(i||P?E.getByOffset("offsetA / 4u"):`${E.type.value}(${E.getByOffset("offsetA / 4u")}[offsetA % 4u])`,i||b?I.getByOffset("offsetB / 4u"):`${I.type.value}(${I.getByOffset("offsetB / 4u")}[offsetB % 4u])`))} - `}else M=_.setByOffset("global_idx",g(E.getByOffset("global_idx"),I.getByOffset("global_idx")));else{if(!n)throw new Error("no necessary to use scalar implementation for element-wise binary op implementation.");let y=($,P,b="")=>{let w=`aData[indexA${P}][componentA${P}]`,T=`bData[indexB${P}][componentB${P}]`;return` - let outputIndices${P} = ${_.offsetToIndices(`global_idx * 4u + ${P}u`)}; - let offsetA${P} = ${E.broadcastedIndicesToOffset(`outputIndices${P}`,_)}; - let offsetB${P} = ${I.broadcastedIndicesToOffset(`outputIndices${P}`,_)}; - let indexA${P} = offsetA${P} / 4u; - let indexB${P} = offsetB${P} / 4u; - let componentA${P} = offsetA${P} % 4u; - let componentB${P} = offsetB${P} % 4u; - ${$}[${P}] = ${b}(${h(w,T)}); - `};p===9?M=` - var data = vec4(0); - ${y("data",0,"u32")} - ${y("data",1,"u32")} - ${y("data",2,"u32")} - ${y("data",3,"u32")} - outputData[global_idx] = dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(data));`:M=` - ${y("outputData[global_idx]",0)} - ${y("outputData[global_idx]",1)} - ${y("outputData[global_idx]",2)} - ${y("outputData[global_idx]",3)} - `}return` - ${e.registerUniform("vec_size","u32").declareVariables(E,I,_)} - - ${u??""} - - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} - ${M} - }`},$_=(e,r,t,s,o,n,i=t.dataType)=>{let a=t.dims.map(E=>Number(E)??1),l=s.dims.map(E=>Number(E)??1),c=!xe.areEqual(a,l),p=a,u=xe.size(a),h=!1,g=!1,_=[c];if(c){let E=So.calcShape(a,l,!1);if(!E)throw new Error("Can't perform binary op on the given tensors");p=E.slice(),u=xe.size(p);let I=xe.size(a)===1,M=xe.size(l)===1,y=a.length>0&&a[a.length-1]%4===0,$=l.length>0&&l[l.length-1]%4===0;_.push(I),_.push(M),_.push(y),_.push($);let P=1;for(let b=1;bE.toString()).join("_"),inputDependencies:["rank","rank"]},getShaderSource:E=>S_(E,a,l,p,h,c,g,o,t.dataType,s.dataType,i,n),getRunData:()=>({outputs:[{dims:p,dataType:i}],dispatchGroup:{x:Math.ceil(u/64/4)},programUniforms:[{type:12,data:Math.ceil(xe.size(p)/4)},...nt(a,l,p)]})}},_s=(e,r,t,s,o,n)=>{e.compute($_(r,o??"",e.inputs[0],e.inputs[1],t,s,n))},WM=e=>{_s(e,"Add",(r,t)=>`${r}+${t}`)},GM=e=>{_s(e,"Div",(r,t)=>`${r}/${t}`)},KM=e=>{_s(e,"Equal",{scalar:(r,t)=>`u32(${r}==${t})`,vector:(r,t)=>`vec4(${r}==${t})`},void 0,void 0,9)},HM=e=>{_s(e,"Mul",(r,t)=>`${r}*${t}`)},qM=e=>{let r=$e("input",e.inputs[0].dataType,e.inputs[0].dims).type.value;_s(e,"Pow",{scalar:(t,s)=>`pow_custom(${t},${s})`,vector:(t,s)=>`pow_vector_custom(${t},${s})`},` - fn pow_custom(a : ${r}, b : ${r}) -> ${r} { - if (b == ${r}(0.0)) { - return ${r}(1.0); - } else if (a < ${r}(0.0) && f32(b) != floor(f32(b))) { - return ${r}(pow(f32(a), f32(b))); // NaN - } - return select(sign(a), ${r}(1.0), round(f32(abs(b) % ${r}(2.0))) != 1.0) * ${r}(${r==="i32"?"round":""}(pow(f32(abs(a)), f32(b)))); - } - fn pow_vector_custom(a : vec4<${r}>, b : vec4<${r}>) -> vec4<${r}> { - // TODO: implement vectorized pow - return vec4<${r}>(pow_custom(a.x, b.x), pow_custom(a.y, b.y), pow_custom(a.z, b.z), pow_custom(a.w, b.w)); - } - `)},QM=e=>{_s(e,"Sub",(r,t)=>`${r}-${t}`)},XM=e=>{_s(e,"Greater",{scalar:(r,t)=>`u32(${r}>${t})`,vector:(r,t)=>`vec4(${r}>${t})`},void 0,void 0,9)},JM=e=>{_s(e,"Less",{scalar:(r,t)=>`u32(${r}<${t})`,vector:(r,t)=>`vec4(${r}<${t})`},void 0,void 0,9)},YM=e=>{_s(e,"GreaterOrEqual",{scalar:(r,t)=>`u32(${r}>=${t})`,vector:(r,t)=>`vec4(${r}>=${t})`},void 0,void 0,9)},ZM=e=>{_s(e,"LessOrEqual",{scalar:(r,t)=>`u32(${r}<=${t})`,vector:(r,t)=>`vec4(${r}<=${t})`},void 0,void 0,9)}}),k_,I_,A_,F_,e0,t0,tx=Ve(()=>{mt(),bt(),tr(),xt(),k_=(e,r)=>{if(!e||e.length<1)throw new Error("too few inputs");let t=0,s=e[t],o=s.dataType,n=s.dims.length;e.forEach((i,a)=>{if(a!==t){if(i.dataType!==o)throw new Error("input tensors should be one type");if(i.dims.length!==n)throw new Error("input tensors should have the same shape");i.dims.forEach((l,c)=>{if(c!==r&&l!==s.dims[c])throw new Error("non concat dimensions must match")})}})},I_=(e,r)=>` - fn calculateInputIndex(index: u32) -> u32 { - let sizeInConcatAxis = array(${r}); - for (var i: u32 = 0u; i < ${e}; i += 1u ) { - if (index < sizeInConcatAxis[i]) { - return i; - } - } - return ${e}u; - }`,A_=(e,r)=>{let t=e.length,s=[];for(let o=0;o{let o=xe.size(t),n=new Array(e.length),i=new Array(e.length),a=0,l=[],c=[],p=[{type:12,data:o}];for(let E=0;E`uniforms.sizeInConcatAxis${E}`).join(","),_=E=>` - - ${(()=>{E.registerUniform("outputSize","u32");for(let I=0;I(${g}); - ${h} -= sizeInConcatAxis[inputIndex - 1u]; - } - - ${A_(i,u)} - }`;return{name:"Concat",shaderCache:{hint:`${r}`,inputDependencies:l},getRunData:()=>({outputs:[{dims:t,dataType:s}],dispatchGroup:{x:Math.ceil(o/64)},programUniforms:p}),getShaderSource:_}},e0=(e,r)=>{let t=e.inputs,s=t[0].dims,o=xe.normalizeAxis(r.axis,s.length);k_(t,o);let n=s.slice();n[o]=t.reduce((a,l)=>a+(l.dims.length>o?l.dims[o]:0),0);let i=t.filter(a=>xe.size(a.dims)>0);e.compute(F_(i,o,n,t[0].dataType),{inputs:i})},t0=e=>Lt({axis:e.axis})}),On,Dn,Ln,xu,Bn=Ve(()=>{mt(),bt(),On=(e,r,t="f32")=>{switch(e.activation){case"Relu":return`value = max(value, ${r}(0.0));`;case"Sigmoid":return`value = (${r}(1.0) / (${r}(1.0) + exp(-value)));`;case"Clip":return`value = clamp(value, ${r}(${t}(uniforms.clip_min)), ${r}(${t}(uniforms.clip_max)));`;case"HardSigmoid":return`value = max(${r}(0.0), min(${r}(1.0), ${t}(uniforms.alpha) * value + ${t}(uniforms.beta)));`;case"LeakyRelu":return`value = select(${t}(uniforms.alpha) * value, value, value >= ${r}(0.0));`;case"Tanh":return`let e2x = exp(-2.0 * abs(value)); - value = sign(value) * (1.0 - e2x) / (1.0 + e2x); - `;case"":return"";default:throw new Error(`Unsupported activation ${e.activation}`)}},Dn=(e,r)=>{e.activation==="Clip"?r.push({type:1,data:e.clipMax},{type:1,data:e.clipMin}):e.activation==="HardSigmoid"?r.push({type:1,data:e.alpha},{type:1,data:e.beta}):e.activation==="LeakyRelu"&&r.push({type:1,data:e.alpha})},Ln=(e,r)=>{e.activation==="Clip"?r.push({name:"clip_max",type:"f32"},{name:"clip_min",type:"f32"}):e.activation==="HardSigmoid"?r.push({name:"alpha",type:"f32"},{name:"beta",type:"f32"}):e.activation==="LeakyRelu"&&r.push({name:"alpha",type:"f32"})},xu=e=>{let r=(e==null?void 0:e.activation)||"";if(r==="HardSigmoid"){let[t,s]=(e==null?void 0:e.activation_params)||[.2,.5];return{activation:r,alpha:t,beta:s}}else if(r==="Clip"){let[t,s]=(e==null?void 0:e.activation_params)||[Iy,Ay];return{activation:r,clipMax:s,clipMin:t}}else if(r==="LeakyRelu"){let[t]=(e==null?void 0:e.activation_params)||[.01];return{activation:r,alpha:t}}return{activation:r}}}),yr,r0,Tu=Ve(()=>{yr=(e,r)=>{switch(e){case 1:return r;case 2:return`vec2<${r}>`;case 3:return`vec3<${r}>`;case 4:return`vec4<${r}>`;default:throw new Error(`${e}-component is not supported.`)}},r0=e=>` - ${e?"value = value + getBiasByOutputCoords(coords);":""} - `}),s0,rx=Ve(()=>{s0=e=>` -fn getIndexFromCoords4D(coords : vec4, shape : vec4) -> i32 { - return dot(coords, vec4( - shape.y * shape.z * shape.w, shape.z * shape.w, shape.w, 1)); -} -fn getOutputIndexFromCoords(coords : vec4) -> i32 { - return dot(coords, vec4( - i32(${e}.x), i32(${e}.y), i32(${e}.z), 1)); -} -`}),ua,Eu,Pu=Ve(()=>{mt(),bt(),xt(),Bn(),ua=(e,r,t,s,o)=>{let n=s-t;return` - ${Array.from({length:t}).map((i,a)=>` - if (${rt(r.shape,a,r.rank)} != 1) { - ${r.indicesSet(e,a,rt(o,a+n,s))} - } else { - ${r.indicesSet(e,a,0)} - }`).join("")} -`},Eu=(e,r,t,s,o=!1,n)=>{let i=e[0].dims,a=e[1].dims,l=i[i.length-2],c=a[a.length-1],p=i[i.length-1],u=Jt(c),h=Jt(p),g=Jt(l),_=xe.size(t)/u/g,E=e.length>2,I=s?s.slice(0,-2):t.slice(0,-2),M=[xe.size(I),l,c],y=[{type:12,data:_},{type:12,data:l},{type:12,data:c},{type:12,data:p}];Dn(r,y),y.push(...nt(I,i,a)),E&&y.push(...nt(e[2].dims)),y.push(...nt(M));let $=P=>{let b=yu("batch_dims",e[0].dataType,I.length),w=$e("a",e[0].dataType,i.length,h),T=$e("b",e[1].dataType,a.length,u),k=tt("output",e[0].dataType,M.length,u),z=pr(k.type.tensor),R=On(r,k.type.value,z),Q=[w,T],q="";if(E){let H=o?u:1;Q.push($e("bias",e[2].dataType,e[2].dims.length,H)),q=`${o?`value += bias[col / ${H}];`:`value += ${k.type.value}(bias[row + i]);`}`}let U=[{name:"output_size",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"}];Ln(r,U);let Z=()=>{let H=`var a_data: ${w.type.value};`;for(let J=0;J; - for (var k: u32 = 0u; k < uniforms.K; k = k + ${h}) { - ${Z()} - } - for (var i = 0u; i < ${g}u; i++) { - var value = values[i]; - ${q} - ${R} - let cur_indices = ${k.type.indices}(batch, row + i, col); - let offset = ${k.indicesToOffset("cur_indices")}; - ${k.setByOffset(`offset / ${u}`,"value")}; - } - } - `};return{name:"MatMulNaive",shaderCache:{hint:`${r.activation};${u};${h};${g};${o}`,inputDependencies:E?["rank","rank","rank"]:["rank","rank"]},getRunData:()=>({outputs:[{dims:n?n(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:y}),getShaderSource:$}}}),O_,D_,Yc,uc,L_,Zc,z_,ad,Cu=Ve(()=>{mt(),bt(),xt(),Bn(),Pu(),Tu(),O_=(e,r)=>e?` - mm_Asub[inputRow][inputCol] = mm_readA(batch, - kStart + inputRow, - globalRowStart / innerElementSize + inputCol${r?", batchIndices":""}); - `:` - mm_Asub[inputRow][inputCol] = mm_readA(batch, - globalRow + innerRow, - kStart / innerElementSize + inputCol${r?", batchIndices":""}); - `,D_=(e,r)=>e?` - let ACached0 = mm_Asub[k * innerElementSize][localRow]; - let ACached1 = mm_Asub[k * innerElementSize + 1][localRow]; - let ACached2 = mm_Asub[k * innerElementSize + 2][localRow]; - ${r===3?"":"let ACached3 = mm_Asub[k * innerElementSize + 3][localRow];"} - for (var i = 0; i < rowPerThread; i = i + 1) { - acc[i] = BCached0 * ACached0[i] + acc[i]; - acc[i] = BCached1 * ACached1[i] + acc[i]; - acc[i] = BCached2 * ACached2[i] + acc[i]; - ${r===3?"":"acc[i] = BCached3 * ACached3[i] + acc[i];"} - }`:` - for (var i = 0; i < rowPerThread; i = i + 1) { - let ACached = mm_Asub[tileRow + i][k]; - acc[i] = BCached0 * ACached.x + acc[i]; - acc[i] = BCached1 * ACached.y + acc[i]; - acc[i] = BCached2 * ACached.z + acc[i]; - ${r===3?"":"acc[i] = BCached3 * ACached.w + acc[i];"} - }`,Yc=(e,r,t="f32",s,o=!1,n=32,i=!1,a=32)=>{let l=r[1]*e[1],c=r[0]*e[0],p=o?l:n,u=o?n:l,h=p/r[0],g=n/r[1];if(!((o&&h===4&&e[1]===4||!o&&(h===3||h===4))&&p%r[0]===0&&n%r[1]===0&&e[0]===4))throw new Error(`If transposeA ${o} is true, innerElementSize ${h} and workPerThread[1] ${e[1]} must be 4. - Otherwise, innerElementSize ${h} must be 3 or 4. - tileAWidth ${p} must be divisible by workgroupSize[0]${r[0]}. tileInner ${n} must be divisible by workgroupSize[1] ${r[1]}. colPerThread ${e[0]} must be 4.`);return` -var mm_Asub: array, ${p/h}>, ${u}>; -var mm_Bsub: array, ${c/e[0]}>, ${n}>; - -const rowPerThread = ${e[1]}; -const colPerThread = ${e[0]}; -const innerElementSize = ${h}; -const tileInner = ${n}; - -@compute @workgroup_size(${r[0]}, ${r[1]}, ${r[2]}) -fn main(@builtin(local_invocation_id) localId : vec3, - @builtin(global_invocation_id) globalId : vec3, - @builtin(workgroup_id) workgroupId : vec3) { - let localRow = i32(localId.y); - let tileRow = localRow * rowPerThread; - let tileCol = i32(localId.x); - - let globalRow =i32(globalId.y) * rowPerThread; - let globalCol = i32(globalId.x); - let batch = ${i?"0":"i32(globalId.z)"}; - ${s?`let batchIndices = ${s.offsetToIndices("u32(batch)")};`:""} - let globalRowStart = i32(workgroupId.y) * ${l}; - - let num_tiles = ${i?`${Math.ceil(a/n)}`:"(uniforms.dim_inner - 1) / tileInner + 1"}; - var kStart = ${i?`i32(globalId.z) * ${a}`:"0"}; - - var acc: array, rowPerThread>; - - // Loop over shared dimension. - let tileRowB = localRow * ${g}; - for (var t = 0; t < num_tiles; t = t + 1) { - // Load one tile of A into local memory. - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - let inputRow = tileRow + innerRow; - let inputCol = tileCol; - ${O_(o,s)} - } - - // Load one tile of B into local memory. - for (var innerRow = 0; innerRow < ${g}; innerRow = innerRow + 1) { - let inputRow = tileRowB + innerRow; - let inputCol = tileCol; - mm_Bsub[inputRow][inputCol] = mm_readB(batch, kStart + inputRow, globalCol${s?", batchIndices":""}); - } - kStart = kStart + tileInner; - workgroupBarrier(); - - // Compute acc values for a single thread. - for (var k = 0; k < tileInner / innerElementSize; k = k + 1) { - let BCached0 = mm_Bsub[k * innerElementSize][tileCol]; - let BCached1 = mm_Bsub[k * innerElementSize + 1][tileCol]; - let BCached2 = mm_Bsub[k * innerElementSize + 2][tileCol]; - ${h===3?"":"let BCached3 = mm_Bsub[k * innerElementSize + 3][tileCol];"} - - ${D_(o,h)} - } - - workgroupBarrier(); - } - - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - mm_write(batch, globalRow + innerRow, globalCol, acc[innerRow]); - } -}`},uc=(e,r)=>e?` - mm_Asub[inputRow][inputCol] = mm_readA(batch, - kStart + inputRow, - globalRowStart + inputCol${r?", batchIndices":""}); - `:` - mm_Asub[inputRow][inputCol] = mm_readA(batch, - globalRowStart + inputRow, - kStart + inputCol${r?", batchIndices":""}); - `,L_=e=>e?"let ACached = mm_Asub[k][tileRow + innerRow];":"let ACached = mm_Asub[tileRow + innerRow][k];",Zc=(e,r,t="f32",s,o=!1,n=32,i=!1,a=32,l=!1)=>{let c=e[1]*r[1],p=e[0]*r[0],u=o?c:n,h=o?n:c;if(!(h%r[1]===0&&u%r[0]===0&&n%r[1]===0))throw new Error(`tileAHight ${h} must be divisible by workgroupSize[1]${r[1]}, tileAWidth ${u} must be divisible by workgroupSize[0]${r[0]}, tileInner ${n} must be divisible by workgroupSize[1]${r[1]}`);let g=h/r[1],_=u/r[0],E=n/r[1],I=l?` - let localRow = i32(localId.y); - let localCol = i32(localId.x); - let globalRowStart = i32(workgroupId.y) * ${c}; - let globalColStart = i32(workgroupId.x) * ${p}; - - // Loop over shared dimension. - for (var t = 0; t < num_tiles; t = t + 1) { - // Load one tile of A into local memory. - for (var inputRow = localRow; inputRow < ${h}; inputRow = inputRow + ${r[1]}) { - for (var inputCol = localCol; inputCol < ${u}; inputCol = inputCol + ${r[0]}) { - ${uc(o,s)} - } - } - // Load one tile of B into local memory. - for (var inputRow = localRow; inputRow < ${n}; inputRow = inputRow + ${r[1]}) { - for (var inputCol = localCol; inputCol < ${p}; inputCol = inputCol + ${r[0]}) { - mm_Bsub[inputRow][inputCol] = mm_readB(batch, - kStart + inputRow, - globalColStart + inputCol${s?", batchIndices":""}); - } - } - kStart = kStart + tileInner; - workgroupBarrier(); - - // Compute acc values for a single thread. - var BCached : array<${t}, colPerThread>; - for (var k = 0; k < tileInner; k = k + 1) { - for (var inner = 0; inner < colPerThread; inner = inner + 1) { - BCached[inner] = mm_Bsub[k][localCol + inner * ${r[0]}]; - } - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - let ACached = ${o?`mm_Asub[k][localRow + innerRow * ${r[1]}];`:`mm_Asub[localRow + innerRow * ${r[1]}][k];`} - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - acc[innerRow][innerCol] = acc[innerRow][innerCol] + - ACached * BCached[innerCol]; - } - } - } - workgroupBarrier(); - } - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - let gRow = globalRowStart + localRow + innerRow * ${r[1]}; - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - let gCol = globalColStart + localCol + innerCol * ${r[0]}; - mm_write(batch, gRow, gCol, acc[innerRow][innerCol]); - } - } - `:` -let tileRow = i32(localId.y) * rowPerThread; -let tileCol = i32(localId.x) * colPerThread; - -let globalRow = i32(globalId.y) * rowPerThread; -let globalCol = i32(globalId.x) * colPerThread; -let globalRowStart = i32(workgroupId.y) * ${c}; - -let tileRowA = i32(localId.y) * ${g}; -let tileColA = i32(localId.x) * ${_}; -let tileRowB = i32(localId.y) * ${E}; -// Loop over shared dimension. -for (var t = 0; t < num_tiles; t = t + 1) { - // Load one tile of A into local memory. - for (var innerRow = 0; innerRow < ${g}; innerRow = innerRow + 1) { - for (var innerCol = 0; innerCol < ${_}; innerCol = innerCol + 1) { - let inputRow = tileRowA + innerRow; - let inputCol = tileColA + innerCol; - ${uc(o,s)} - } - } - - // Load one tile of B into local memory. - for (var innerRow = 0; innerRow < ${E}; innerRow = innerRow + 1) { - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - let inputRow = tileRowB + innerRow; - let inputCol = tileCol + innerCol; - mm_Bsub[inputRow][inputCol] = mm_readB(batch, - kStart + inputRow, - globalCol + innerCol${s?", batchIndices":""}); - } - } - kStart = kStart + tileInner; - workgroupBarrier(); - - // Compute acc values for a single thread. - var BCached : array<${t}, colPerThread>; - for (var k = 0; k < tileInner; k = k + 1) { - for (var inner = 0; inner < colPerThread; inner = inner + 1) { - BCached[inner] = mm_Bsub[k][tileCol + inner]; - } - - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - ${L_(o)} - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - acc[innerRow][innerCol] = acc[innerRow][innerCol] + ACached * BCached[innerCol]; - } - } - } - - workgroupBarrier(); -} - -for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - mm_write(batch, globalRow + innerRow, globalCol + innerCol, - acc[innerRow][innerCol]); - } -} -`;return` - var mm_Asub : array, ${h}>; - var mm_Bsub : array, ${n}>; - const rowPerThread = ${e[1]}; - const colPerThread = ${e[0]}; - const tileInner = ${n}; - -@compute @workgroup_size(${r[0]}, ${r[1]}, ${r[2]}) -fn main(@builtin(local_invocation_id) localId : vec3, - @builtin(global_invocation_id) globalId : vec3, - @builtin(workgroup_id) workgroupId : vec3) { - let batch = ${i?"0":"i32(globalId.z)"}; - ${s?`let batchIndices = ${s.offsetToIndices("u32(batch)")};`:""} - let num_tiles = ${i?`${Math.ceil(a/n)}`:"(uniforms.dim_inner - 1) / tileInner + 1"}; - var kStart = ${i?`i32(globalId.z) * ${a}`:"0"}; - - var acc : array, rowPerThread>; - ${I} - } -`},z_=(e,r,t,s,o=!1)=>{let[n,i,a,l]=s,c=pr(s[0].type.tensor);return` - fn mm_readA(batch: i32, row: i32, colIn: i32, batchIndices: ${n.type.indices}) -> ${yr(e,c)} { - var value = ${yr(e,c)}(0.0); - let col = colIn * ${e}; - if(row < uniforms.dim_a_outer && col < uniforms.dim_inner) - { - var aIndices: ${i.type.indices}; - ${ua("aIndices",i,i.rank-2,n.rank,"batchIndices")} - ${i.indicesSet("aIndices",i.rank-2,"u32(row)")} - ${i.indicesSet("aIndices",i.rank-1,"u32(colIn)")} - value = ${i.getByIndices("aIndices")}; - } - return value; - } - - fn mm_readB(batch: i32, row: i32, colIn: i32, batchIndices: ${n.type.indices}) -> ${yr(e,c)} { - var value = ${yr(e,c)}(0.0); - let col = colIn * ${e}; - if(row < uniforms.dim_inner && col < uniforms.dim_b_outer) - { - var bIndices: ${a.type.indices}; - ${ua("bIndices",a,a.rank-2,n.rank,"batchIndices")} - ${a.indicesSet("bIndices",a.rank-2,"u32(row)")} - ${a.indicesSet("bIndices",a.rank-1,"u32(colIn)")} - value = ${a.getByIndices("bIndices")}; - } - return value; - } - - fn mm_write(batch: i32, row: i32, colIn: i32, valueIn: ${yr(e,c)}) { - let col = colIn * ${e}; - if (row < uniforms.dim_a_outer && col < uniforms.dim_b_outer) { - var value = valueIn; - let coords = vec3(batch, row, colIn); - ${r?`value = value + ${o?"bias[colIn]":`${yr(e,c)}(bias[row])`};`:""} - ${t} - ${l.setByIndices("vec3(coords)","value")} - } - } - `},ad=(e,r,t,s,o=!1,n)=>{let i=e[0].dims,a=e[1].dims,l=i.slice(0,-2),c=a.slice(0,-2),p=s?s.slice(0,-2):t.slice(0,-2),u=xe.size(p),h=i[i.length-2],g=i[i.length-1],_=a[a.length-1],E=g%4===0&&_%4===0,I=h<=8?[4,1,1]:[4,4,1],M=[8,8,1],y=[Math.ceil(_/M[0]/I[0]),Math.ceil(h/M[1]/I[1]),Math.ceil(u/M[2]/I[2])],$=E?4:1,P=[...l,h,g/$],b=P.length,w=[...c,g,_/$],T=w.length,k=[u,h,_/$],z=[{type:6,data:h},{type:6,data:_},{type:6,data:g}];Dn(r,z),z.push(...nt(p,P,w));let R=["rank","rank"],Q=e.length>2;Q&&(z.push(...nt(e[2].dims)),R.push("rank")),z.push(...nt(k));let q=U=>{let Z=p.length,H=yu("batchDims",e[0].dataType,Z,1),J=pr(e[0].dataType),oe=$e("a",e[0].dataType,b,$),ae=$e("b",e[1].dataType,T,$),ce=tt("result",e[0].dataType,k.length,$),he=[oe,ae];if(Q){let X=o?$:1;he.push($e("bias",e[2].dataType,e[2].dims.length,X))}let N=[{name:"dim_a_outer",type:"i32"},{name:"dim_b_outer",type:"i32"},{name:"dim_inner",type:"i32"}];Ln(r,N);let O=pr(ce.type.tensor),G=On(r,ce.type.value,O),se=z_($,Q,G,[H,oe,ae,ce],o);return` - ${U.registerUniforms(N).registerInternalVariables(H).declareVariables(...he,ce)} - ${se} - ${E?Yc(I,M,J,H):Zc(I,M,J,H)} - `};return{name:"MatMul",shaderCache:{hint:`${I};${r.activation};${E};${o}`,inputDependencies:R},getRunData:()=>({outputs:[{dims:n?n(t):t,dataType:e[0].dataType}],dispatchGroup:{x:y[0],y:y[1],z:y[2]},programUniforms:z}),getShaderSource:q}}}),B_,n0,sx=Ve(()=>{mt(),Us(),xt(),Bn(),Tu(),rx(),Cu(),B_=(e,r,t,s,o=!1,n,i=4,a=4,l=4,c="f32")=>{let p=z=>{switch(z){case 1:return"resData = x[xIndex];";case 3:return`resData = vec3<${c}>(x[xIndex], x[xIndex + 1], x[xIndex + 2]);`;case 4:return"resData = x[xIndex / 4];";default:throw new Error(`innerElementSize ${z} is not supported.`)}},u=z=>{switch(z){case 1:return"return w[row * i32(uniforms.w_shape[3]) + colIn];";case 4:return"return w[row * i32(uniforms.w_shape[3]) / 4 + colIn];";default:throw new Error(`innerElementSize ${z} is not supported.`)}},h=e?` - let coord = vec4(batch, xRow, xCol, xCh); - `:` - let coord = vec4(batch, xCh, xRow, xCol); - `,g=e?` - let coords = vec4( - batch, - row / outWidth, - row % outWidth, - col); - `:` - let coords = vec4( - batch, - row, - col / outWidth, - col % outWidth); - `,_=e?"i32(uniforms.x_shape[1])":"i32(uniforms.x_shape[2])",E=e?"i32(uniforms.x_shape[2])":"i32(uniforms.x_shape[3])",I=e?"row":"col",M=e?"col":"row",y=` - let inChannels = i32(uniforms.w_shape[2]); - let outWidth = ${e?"i32(uniforms.result_shape[2])":"i32(uniforms.result_shape[3])"}; - let outRow = ${I} / outWidth; - let outCol = ${I} % outWidth; - - let WRow = ${M} / (i32(uniforms.w_shape[1]) * inChannels); - let WCol = ${M} / inChannels % i32(uniforms.w_shape[1]); - let xRow = outRow * uniforms.stride[0] + uniforms.dilation[0] * WRow - uniforms.pad[0]; - let xCol = outCol * uniforms.stride[1] + uniforms.dilation[1] * WCol - uniforms.pad[1]; - let xCh = ${M} % inChannels; - var resData = ${yr(i,c)}(0.0); - // The bounds checking is always needed since we use it to pad zero for - // the 'same' padding type. - if (xRow >= 0 && xRow < ${_} && xCol >= 0 && xCol < ${E}) { - ${h} - let xIndex = getIndexFromCoords4D(coord, vec4(uniforms.x_shape)); - ${p(i)} - } - return resData;`,$=e?r&&s?` - let col = colIn * ${i}; - ${y}`:` - let col = colIn * ${i}; - if (row < uniforms.dim_a_outer && col < uniforms.dim_inner) { - ${y} - } - return ${yr(i,c)}(0.0);`:s&&t?` - let col = colIn * ${i}; - ${y}`:` - let col = colIn * ${i}; - if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) { - ${y} - } - return ${yr(i,c)}(0.0);`,P=e?s&&t?u(a):` - let col = colIn * ${a}; - if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) { - ${u(a)} - } - return ${yr(a,c)}(0.0);`:` - let col = colIn * ${a}; - if (row < uniforms.dim_inner && col < uniforms.dim_a_outer) { - ${u(a)} - } - return ${yr(a,c)}(0.0);`,b=yr(l,c),w=yr(e?i:a,c),T=yr(e?a:i,c),k=On(n,b,c);return` - fn mm_readA(batch: i32, row : i32, colIn : i32) -> ${w} { - ${e?$:P} - } - - fn mm_readB(batch: i32, row : i32, colIn : i32) -> ${T} { - ${e?P:$} - } - - fn mm_write(batch: i32, row : i32, colIn : i32, valueIn : ${b}) { - let col = colIn * ${l}; - if (row < uniforms.dim_a_outer && col < uniforms.dim_b_outer) - { - var value = valueIn; - let outWidth = ${e?"i32(uniforms.result_shape[2])":"i32(uniforms.result_shape[3])"}; - ${g} - ${r0(o)} - ${k} - setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value); - } - }`},n0=(e,r,t,s,o,n,i,a,l)=>{let c=r.format==="NHWC",p=c?e[0].dims[3]:e[0].dims[1],u=t[0],h=c?t[2]:t[3],g=c?t[1]:t[2],_=c?t[3]:t[1],E=c&&(p%4===0||p%3===0)&&_%4===0,I=c?_:h*g,M=c?h*g:_,y=[8,8,1],$=s<=8?[4,1,1]:[4,4,1],P=[Math.ceil(I/y[0]/$[0]),Math.ceil(M/y[1]/$[1]),Math.ceil(u/y[2]/$[2])];St("verbose",()=>`[conv2d_mm_webgpu] dispatch = ${P}`);let b=E?c&&p%4!==0?3:4:1,w=y[1]*$[1],T=y[0]*$[0],k=Math.max(y[0]*b,y[1]),z=s%w===0,R=o%T===0,Q=n%k===0,q=E?[b,4,4]:[1,1,1],U=[{type:6,data:s},{type:6,data:o},{type:6,data:n},{type:6,data:[r.pads[0],r.pads[1]]},{type:6,data:r.strides},{type:6,data:r.dilations}];Dn(r,U),U.push(...nt(e[0].dims,e[1].dims));let Z=["rank","rank"];i&&(U.push(...nt(e[2].dims)),Z.push("rank")),U.push(...nt(t));let H=J=>{let oe=[{name:"dim_a_outer",type:"i32"},{name:"dim_b_outer",type:"i32"},{name:"dim_inner",type:"i32"},{name:"pad",type:"i32",length:2},{name:"stride",type:"i32",length:2},{name:"dilation",type:"i32",length:2}];Ln(r,oe);let ae=E?4:1,ce=pr(e[0].dataType),he=` - fn setOutputAtIndex(flatIndex : i32, value : ${E?`vec4<${ce}>`:ce}) { - result[flatIndex] = ${E?`vec4<${ce}>`:ce}(value); - } - fn setOutputAtCoords(d0 : i32, d1 : i32, d2 : i32, d3 : i32, value : ${E?`vec4<${ce}>`:ce}) { - let flatIndex = getOutputIndexFromCoords(vec4(d0, d1, d2, d3)); - setOutputAtIndex(flatIndex ${E?"/ 4":""}, value); - }`,N=$e("x",e[0].dataType,e[0].dims.length,b===3?1:b),O=$e("w",e[1].dataType,e[1].dims.length,ae),G=[N,O],se=tt("result",e[0].dataType,t.length,ae);if(i){let X=$e("bias",e[2].dataType,e[2].dims.length,ae);G.push(X),he+=` - fn getBiasByOutputCoords(coords : vec4) -> ${E?`vec4<${ce}>`:ce} { - return bias[coords.${c?"w":"y"}${E?"/ 4":""}]; - }`}return` - ${s0("uniforms.result_strides")} - //struct Uniforms { xShape : vec4, wShape : vec4, outShape : vec4, - // outShapeStrides: vec3, filterDims : vec2, pad : vec2, stride : vec2, - // dilation : vec2, dimAOuter : i32, dimBOuter : i32, dimInner : i32 }; - ${J.registerUniforms(oe).declareVariables(...G,se)} - ${he} - ${B_(c,z,R,Q,i,r,q[0],q[1],q[2],ce)} - ${E?Yc($,y,ce,void 0,!c,k):Zc($,y,ce,void 0,!c,k,!1,void 0,a)}`};return{name:"Conv2DMatMul",shaderCache:{hint:`${r.cacheKey};${b};${E};${z};${R};${Q};${w};${T};${k}`,inputDependencies:Z},getRunData:()=>({outputs:[{dims:l?l(t):t,dataType:e[0].dataType}],dispatchGroup:{x:P[0],y:P[1],z:P[2]},programUniforms:U}),getShaderSource:H}}}),R_,pc,ta,N_,hc,j_,o0,i0,nx=Ve(()=>{mt(),Us(),bt(),xt(),Bn(),Tu(),R_=e=>{let r=1;for(let t=0;ttypeof e=="number"?[e,e,e]:e,ta=(e,r)=>r<=1?e:e+(e-1)*(r-1),N_=(e,r,t,s=1)=>{let o=ta(r,s);return Math.floor((e[0]*(t-1)-t+o)/2)},hc=(e,r,t,s,o)=>{o==null&&(o=N_(e,r[0],s[0]));let n=[0,0,0,t];for(let i=0;i<3;i++)e[i]+2*o>=r[i]&&(n[i]=Math.trunc((e[i]-r[i]+2*o)/s[i]+1));return n},j_=(e,r,t,s,o,n,i,a,l,c)=>{let p,u,h,g;if(e==="VALID"&&(e=0),typeof e=="number"){p={top:e,bottom:e,left:e,right:e,front:e,back:e};let _=hc([r,t,s,1],[a,l,c],1,[o,n,i],e);u=_[0],h=_[1],g=_[2]}else if(Array.isArray(e)){if(!e.every((E,I,M)=>E===M[0]))throw Error(`Unsupported padding parameter: ${e}`);p={top:e[0],bottom:e[1],left:e[2],right:e[3],front:e[4],back:e[5]};let _=hc([r,t,s,1],[a,l,c],1,[o,n,i],e[0]);u=_[0],h=_[1],g=_[2]}else if(e==="SAME_UPPER"){u=Math.ceil(r/o),h=Math.ceil(t/n),g=Math.ceil(s/i);let _=(u-1)*o+a-r,E=(h-1)*n+l-t,I=(g-1)*i+c-s,M=Math.floor(_/2),y=_-M,$=Math.floor(E/2),P=E-$,b=Math.floor(I/2),w=I-b;p={top:$,bottom:P,left:b,right:w,front:M,back:y}}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:p,outDepth:u,outHeight:h,outWidth:g}},o0=(e,r,t,s,o,n=!1,i="channelsLast")=>{let a,l,c,p,u;if(i==="channelsLast")[a,l,c,p,u]=e;else if(i==="channelsFirst")[a,u,l,c,p]=e;else throw new Error(`Unknown dataFormat ${i}`);let[h,,g,_,E]=r,[I,M,y]=pc(t),[$,P,b]=pc(s),w=ta(g,$),T=ta(_,P),k=ta(E,b),{padInfo:z,outDepth:R,outHeight:Q,outWidth:q}=j_(o,l,c,p,I,M,y,w,T,k),U=n?h*u:h,Z=[0,0,0,0,0];return i==="channelsFirst"?Z=[a,U,R,Q,q]:i==="channelsLast"&&(Z=[a,R,Q,q,U]),{batchSize:a,dataFormat:i,inDepth:l,inHeight:c,inWidth:p,inChannels:u,outDepth:R,outHeight:Q,outWidth:q,outChannels:U,padInfo:z,strideDepth:I,strideHeight:M,strideWidth:y,filterDepth:g,filterHeight:_,filterWidth:E,effectiveFilterDepth:w,effectiveFilterHeight:T,effectiveFilterWidth:k,dilationDepth:$,dilationHeight:P,dilationWidth:b,inShape:e,outShape:Z,filterShape:r}},i0=(e,r,t,s,o,n)=>{let i=n==="channelsLast";i?e[0].dims[3]:e[0].dims[1];let a=[64,1,1],l={x:t.map((I,M)=>M)},c=[Math.ceil(R_(l.x.map(I=>t[I]))/a[0]),1,1];St("verbose",()=>`[conv3d_naive_webgpu] dispatch = ${c}`);let p=1,u=xe.size(t),h=[{type:12,data:u},{type:12,data:s},{type:12,data:o},{type:12,data:r.strides},{type:12,data:r.dilations}];Dn(r,h),h.push(...nt(e[0].dims,e[1].dims));let g=["rank","rank"],_=e.length===3;_&&(h.push(...nt(e[2].dims)),g.push("rank")),h.push(...nt(t));let E=I=>{let M=[{name:"output_size",type:"u32"},{name:"filter_dims",type:"u32",length:s.length},{name:"pads",type:"u32",length:o.length},{name:"strides",type:"u32",length:r.strides.length},{name:"dilations",type:"u32",length:r.dilations.length}];Ln(r,M);let y=1,$=pr(e[0].dataType),P=$e("x",e[0].dataType,e[0].dims.length,p),b=$e("W",e[1].dataType,e[1].dims.length,y),w=[P,b],T=tt("result",e[0].dataType,t.length,y),k="";if(_){let Q=$e("bias",e[2].dataType,e[2].dims.length,y);w.push(Q),k+=` - fn getBiasByOutputCoords(coords : array) -> ${$} { - return bias[${i?rt("coords",4,5):rt("coords",1,5)}]; - }`}let z=yr(p,$),R=On(r,z,$);return` - ${k} - fn getX(d0 : u32, d1 : u32, d2 : u32, d3 : u32, d4 : u32) -> f32 { - let aIndices = array(d0, d1, d2, d3, d4); - return ${P.getByIndices("aIndices")}; - } - fn getW(d0 : u32, d1 : u32, d2 : u32, d3 : u32, d4 : u32) -> f32 { - let aIndices = array(d0, d1, d2, d3, d4); - return ${b.getByIndices("aIndices")}; - } - ${I.registerUniforms(M).declareVariables(...w,T)} - ${I.mainStart()} - ${I.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let coords = ${T.offsetToIndices("global_idx")}; - let batch = ${rt("coords",0,P.rank)}; - let d2 = ${i?rt("coords",P.rank-1,P.rank):rt("coords",1,P.rank)}; - let xFRCCorner = vec3(${i?rt("coords",1,P.rank):rt("coords",2,P.rank)}, - ${i?rt("coords",2,P.rank):rt("coords",3,P.rank)}, - ${i?rt("coords",3,P.rank):rt("coords",4,P.rank)}) * uniforms.strides - uniforms.pads; - let xFCorner = xFRCCorner.x; - let xRCorner = xFRCCorner.y; - let xCCorner = xFRCCorner.z; - let xShapeY = ${i?rt("uniforms.x_shape",1,P.rank):rt("uniforms.x_shape",2,P.rank)}; - let xShapeZ = ${i?rt("uniforms.x_shape",2,P.rank):rt("uniforms.x_shape",3,P.rank)}; - let xShapeW = ${i?rt("uniforms.x_shape",3,P.rank):rt("uniforms.x_shape",4,P.rank)}; - let xShapeU = ${i?rt("uniforms.x_shape",4,P.rank):rt("uniforms.x_shape",1,P.rank)}; - let inputDepthNearestVec4 = (xShapeU / 4) * 4; - let inputDepthVec4Remainder = xShapeU % 4; - - var value = 0.0; - for (var wF = 0u; wF < uniforms.filter_dims[0]; wF++) { - let xF = xFCorner + wF * uniforms.dilations[0]; - if (xF < 0 || xF >= xShapeY) { - continue; - } - - for (var wR = 0u; wR < uniforms.filter_dims[1]; wR++) { - let xR = xRCorner + wR * uniforms.dilations[1]; - if (xR < 0 || xR >= xShapeZ) { - continue; - } - - for (var wC = 0u; wC < uniforms.filter_dims[2]; wC++) { - let xC = xCCorner + wC * uniforms.dilations[2]; - if (xC < 0 || xC >= xShapeW) { - continue; - } - - for (var d1 = 0u; d1 < inputDepthNearestVec4; d1 += 4) { - ${i?`let xValues = vec4( - getX(batch, xF, xR, xC, d1), - getX(batch, xF, xR, xC, d1 + 1), - getX(batch, xF, xR, xC, d1 + 2), - getX(batch, xF, xR, xC, d1 + 3)); - `:`let xValues = vec4( - getX(batch, d1, xF, xR, xC), - getX(batch, d1 + 1, xF, xR, xC), - getX(batch, d1 + 2, xF, xR, xC), - getX(batch, d1 + 3, xF, xR, xC)); - `} - let wValues = vec4( - getW(d2, d1, wF, wR, wC), - getW(d2, d1 + 1, wF, wR, wC), - getW(d2, d1 + 2, wF, wR, wC), - getW(d2, d1 + 3, wF, wR, wC)); - value += dot(xValues, wValues); - } - if (inputDepthVec4Remainder == 1) { - ${i?`value += getX(batch, xF, xR, xC, inputDepthNearestVec4) - * getW(d2, inputDepthNearestVec4, wF, wR, wC);`:`value += getX(batch, inputDepthNearestVec4, xF, xR, xC) - * getW(d2, inputDepthNearestVec4, wF, wR, wC);`} - } else if (inputDepthVec4Remainder == 2) { - ${i?`let xValues = vec2( - getX(batch, xF, xR, xC, inputDepthNearestVec4), - getX(batch, xF, xR, xC, inputDepthNearestVec4 + 1)); - `:`let xValues = vec2( - getX(batch, inputDepthNearestVec4, xF, xR, xC), - getX(batch, inputDepthNearestVec4 + 1, xF, xR, xC)); - `} - let wValues = vec2( - getW(d2, inputDepthNearestVec4, wF, wR, wC), - getW(d2, inputDepthNearestVec4 + 1, wF, wR, wC)); - value += dot(xValues, wValues); - } else if (inputDepthVec4Remainder == 3) { - ${i?`let xValues = vec3( - getX(batch, xF, xR, xC, inputDepthNearestVec4), - getX(batch, xF, xR, xC, inputDepthNearestVec4 + 1), - getX(batch, xF, xR, xC, inputDepthNearestVec4 + 2)); - `:`let xValues = vec3( - getX(batch, inputDepthNearestVec4, xF, xR, xC), - getX(batch, inputDepthNearestVec4 + 1, xF, xR, xC), - getX(batch, inputDepthNearestVec4 + 2, xF, xR, xC)); - `} - let wValues = vec3( - getW(d2, inputDepthNearestVec4, wF, wR, wC), - getW(d2, inputDepthNearestVec4 + 1, wF, wR, wC), - getW(d2, inputDepthNearestVec4 + 2, wF, wR, wC)); - value += dot(xValues, wValues); - } - } - } - } - ${_?"value = value + getBiasByOutputCoords(coords)":""}; - ${R} - result[global_idx] = f32(value); - }`};return{name:"Conv3DNaive",shaderCache:{hint:`${r.cacheKey};${i};${p};${_}`,inputDependencies:g},getRunData:()=>({outputs:[{dims:t,dataType:e[0].dataType}],dispatchGroup:{x:c[0],y:c[1],z:c[2]},programUniforms:h}),getShaderSource:E}}}),a0,l0,ox=Ve(()=>{mt(),bt(),xt(),Bn(),a0=(e,r,t,s)=>{let o=e.length>2,n=o?"value += b[output_channel];":"",i=e[0].dims,a=e[1].dims,l=r.format==="NHWC",c=l?t[3]:t[1],p=c/r.group,u=l&&p>=4?Jt(c):1,h=xe.size(t)/u,g=[{type:12,data:h},{type:12,data:r.dilations},{type:12,data:[r.strides[0],r.strides[1]]},{type:12,data:[r.pads[0],r.pads[1]]},{type:12,data:p}];Dn(r,g),g.push(...nt(i,[a[0],a[1],a[2],a[3]/u]));let _=o?["rank","rank","rank"]:["rank","rank"];g.push(...nt([t[0],t[1],t[2],t[3]/u]));let E=I=>{let M=tt("output",e[0].dataType,t.length,u),y=pr(M.type.tensor),$=On(r,M.type.value,y),P=$e("x",e[0].dataType,i.length),b=$e("w",e[1].dataType,a.length,u),w=[P,b];o&&w.push($e("b",e[2].dataType,e[2].dims,u));let T=[{name:"output_size",type:"u32"},{name:"dilations",type:"u32",length:r.dilations.length},{name:"strides",type:"u32",length:2},{name:"pads",type:"u32",length:2},{name:"output_channels_per_group",type:"u32"}];Ln(r,T);let k=l?` - for (var wHeight: u32 = 0u; wHeight < uniforms.w_shape[0]; wHeight++) { - let xHeight = xRCCorner.x + wHeight * uniforms.dilations[0]; - - if (xHeight < 0u || xHeight >= uniforms.x_shape[1]) { - continue; - } - - for (var wWidth: u32 = 0u; wWidth < uniforms.w_shape[1]; wWidth++) { - let xWidth = xRCCorner.y + wWidth * uniforms.dilations[1]; - if (xWidth < 0u || xWidth >= uniforms.x_shape[2]) { - continue; - } - - for (var wInChannel: u32 = 0u; wInChannel < uniforms.w_shape[2]; wInChannel++) { - let input_channel = in_channel_offset + wInChannel; - let xVal = ${P.get("batch","xHeight","xWidth","input_channel")}; - let wVal = ${b.get("wHeight","wWidth","wInChannel","output_channel")}; - value += xVal * wVal; - } - } - } - `:` - for (var wInChannel: u32 = 0u; wInChannel < uniforms.w_shape[1]; wInChannel++) { - let input_channel = in_channel_offset + wInChannel; - for (var wHeight: u32 = 0u; wHeight < uniforms.w_shape[2]; wHeight++) { - let xHeight = xRCCorner.x + wHeight * uniforms.dilations[0]; - - if (xHeight < 0u || xHeight >= uniforms.x_shape[2]) { - continue; - } - - for (var wWidth: u32 = 0u; wWidth < uniforms.w_shape[3]; wWidth++) { - let xWidth = xRCCorner.y + wWidth * uniforms.dilations[1]; - if (xWidth < 0u || xWidth >= uniforms.x_shape[3]) { - continue; - } - - let xVal = ${P.get("batch","input_channel","xHeight","xWidth")}; - let wVal = ${b.get("output_channel","wInChannel","wHeight","wWidth")}; - value += xVal * wVal; - } - } - } - `;return` - ${I.registerUniforms(T).declareVariables(...w,M)} - - ${I.mainStart()} - ${I.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let outputIndices = ${M.offsetToIndices("global_idx")}; - let batch: u32 = outputIndices[0]; - let output_channel: u32 = outputIndices[${l?3:1}]; - let xRCCorner: vec2 = vec2(outputIndices[${l?1:2}], outputIndices[${l?2:3}]) * uniforms.strides - uniforms.pads; - let group_id: u32 = output_channel * ${u} / uniforms.output_channels_per_group; - var in_channel_offset = group_id * uniforms.w_shape[${l?2:1}]; - - var value: ${M.type.value} = ${M.type.value}(0); - ${k} - ${n} - ${$} - ${M.setByOffset("global_idx","value")} - }`};return{name:"GroupedConv",shaderCache:{hint:`${r.cacheKey}_${u}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:s?s(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(h/64)},programUniforms:g}),getShaderSource:E}},l0=(e,r,t,s)=>{let o=e.length>2,n=Jt(t[3]),i=Jt(t[2]),a=xe.size(t)/n/i,l=[e[0].dims[0],e[0].dims[1],e[0].dims[2],e[0].dims[3]/n],c=[e[1].dims[0],e[1].dims[1],e[1].dims[2],e[1].dims[3]/n],p=[t[0],t[1],t[2],t[3]/n],u=[{type:12,data:a},{type:6,data:[r.strides[0],r.strides[1]]},{type:6,data:[r.pads[0],r.pads[1]]}];Dn(r,u),u.push(...nt(l,c,p));let h=(i-1)*r.strides[1]+c[1],g=_=>{let E=tt("output",e[0].dataType,p.length,n),I=pr(E.type.tensor),M=On(r,E.type.value,I),y=$e("x",e[0].dataType,l.length,n),$=$e("w",e[1].dataType,c.length,n),P=[y,$];o&&P.push($e("b",e[2].dataType,e[2].dims,n));let b=o?"value += b[output_channel];":"",w=[{name:"output_size",type:"u32"},{name:"strides",type:"i32",length:2},{name:"pads",type:"i32",length:2}];return Ln(r,w),` - ${_.registerUniforms(w).declareVariables(...P,E)} - ${_.mainStart()} - ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let width0 = uniforms.output_shape[3]; - let output_channel = global_idx % width0; - var index1 = global_idx / width0; - let width1 = uniforms.output_shape[2] / ${i}u; - let col = (index1 % width1) * ${i}u; - index1 = index1 / width1; - let row = index1 % uniforms.output_shape[1]; - let batch = index1 / uniforms.output_shape[1]; - - let x_corner = vec2(i32(row), i32(col)) * uniforms.strides - uniforms.pads; - - var x_vals: array<${y.type.value}, ${h}>; - var values: array<${E.type.value}, ${i}>; - let input_channel = output_channel; - // Use constant instead of uniform can give better performance for w's height/width. - for (var w_height: u32 = 0u; w_height < ${c[0]}; w_height++) { - let x_height = x_corner.x + i32(w_height); - if (x_height >= 0 && u32(x_height) < uniforms.x_shape[1]) { - for (var i = 0; i < ${h}; i++) { - let x_width = x_corner.y + i; - if (x_width >= 0 && u32(x_width) < uniforms.x_shape[2]) { - x_vals[i] = ${y.get("batch","u32(x_height)","u32(x_width)","input_channel")}; - } else { - x_vals[i] = ${y.type.value}(0); - } - } - for (var w_width: u32 = 0u; w_width < ${c[1]}; w_width++) { - let w_val = ${$.get("w_height","w_width","0","output_channel")}; - for (var i = 0u; i < ${i}u; i++) { - values[i] = fma(x_vals[i * u32(uniforms.strides[1]) + w_width], w_val, values[i]); - } - } - } - } - - for (var i = 0u; i < ${i}u; i++) { - var value = values[i]; - ${b} - ${M} - ${E.set("batch","row","col + i","output_channel","value")}; - } - }`};return{name:"GroupedConv-Vectorize",shaderCache:{hint:`${r.cacheKey};${n};${i};${h};${c[0]};${c[1]}`,inputDependencies:o?["rank","rank","type"]:["rank","rank"]},getRunData:()=>({outputs:[{dims:s?s(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(a/64)},programUniforms:u}),getShaderSource:g}}}),V_,Gl,U_,Kl,eu,mc,W_,G_,tu,ix=Ve(()=>{bt(),sx(),nx(),Cu(),ox(),Bn(),Pu(),cn(),V_=(e,r,t,s,o,n)=>{let i=e[0],a=e.slice(n?1:2,n?3:4),l=a.length,c=r[0],p=r.slice(2).map((h,g)=>h+(h-1)*(t[g]-1)),u=a.map((h,g)=>h+s[g]+s[g+l]).map((h,g)=>Math.floor((h-p[g]+o[g])/o[g]));return u.splice(0,0,i),u.splice(n?3:1,0,c),u},Gl=[2,3,1,0],U_=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length>5)throw new Error("greater than 5D is not supported");if(e[0].dims.length!==e[1].dims.length)throw new Error("filter does not have same dimension as input");let t=e[0].dims[r.format==="NHWC"?e[0].dims.length-1:1],s=e[1].dims[1]*r.group;if(t!==s)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(e.length===3&&(e[2].dims.length!==1||e[1].dims[0]!==e[2].dims[0]))throw new Error("invalid bias");let o=e[0].dims.length-2;if(r.dilations.length!==o)throw new Error(`dilations should be ${o}D`);if(r.strides.length!==o)throw new Error(`strides should be ${o}D`);if(r.pads.length!==o*2)throw new Error(`pads should be ${o*2}D`);if(r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape")},Kl=(e,r)=>{let t=e.kernelShape.slice();t.length{let r=xu(e),t=e.format,s=["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][e.auto_pad],o=e.dilations,n=e.group,i=e.kernel_shape,a=e.pads,l=e.strides,c=e.w_is_const();return{autoPad:s,format:t,dilations:o,group:n,kernelShape:i,pads:a,strides:l,wIsConst:c,...r,cacheKey:`${e.format};${r.activation};`}},mc=(e,r,t,s)=>{let o=t.format==="NHWC",n=V_(r[0].dims,r[1].dims,t.dilations,t.pads,t.strides,o);if(t.group!==1){let w=[r[0]];if(o){let T=e.kernelCustomData.wT??e.compute(Wr(r[1],Gl),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=T),w.push(T)}else w.push(r[1]);r.length===3&&w.push(r[2]),!e.adapterInfo.isArchitecture("ampere")&&o&&r[1].dims[0]===t.group&&r[1].dims[1]===1&&t.dilations[0]===1&&t.dilations[1]===1?e.compute(l0(w,t,n,s),{inputs:w}):e.compute(a0(w,t,n,s),{inputs:w});return}let i=r.length===3,a=r[0].dims[o?1:2],l=r[0].dims[o?2:3],c=r[0].dims[o?3:1],p=r[1].dims[2],u=r[1].dims[3],h=n[o?1:2],g=n[o?2:3],_=n[o?3:1],E=o&&p===a&&u===l&&t.pads[0]===0&&t.pads[1]===0;if(E||p===1&&u===1&&t.dilations[0]===1&&t.dilations[1]===1&&t.strides[0]===1&&t.strides[1]===1&&t.pads[0]===0&&t.pads[1]===0){let w=n[0],T,k,z,R=[];if(o){let U=e.kernelCustomData.wT??e.compute(Wr(r[1],Gl),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];if(t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=U),E){let Z=a*l*c;T=r[0].reshape([1,w,Z]),k=U.reshape([1,Z,_]),z=[1,w,_]}else T=r[0].reshape([w,a*l,c]),k=U.reshape([1,c,_]),z=[w,h*g,_];R.push(T),R.push(k)}else T=r[0].reshape([w,c,a*l]),k=r[1].reshape([1,_,c]),z=[w,_,h*g],R.push(k),R.push(T);i&&R.push(r[2]);let Q=z[2],q=R[0].dims[R[0].dims.length-1];Q<8&&q<8?e.compute(Eu(R,t,n,z,o,s),{inputs:R}):e.compute(ad(R,t,n,z,o,s),{inputs:R});return}let I=!0,M=e.kernelCustomData.wT??e.compute(Wr(r[1],Gl),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=M);let y=[r[0],M];i&&y.push(r[2]);let $=o?h*g:_,P=o?_:h*g,b=p*u*c;e.compute(n0(y,t,n,$,P,b,i,I,s),{inputs:y})},W_=(e,r)=>{let t=r.format==="NHWC",s=[e.inputs[0].reshape(t?[e.inputs[0].dims[0],1,e.inputs[0].dims[1],e.inputs[0].dims[2]]:[e.inputs[0].dims[0],e.inputs[0].dims[1],1,e.inputs[0].dims[2]]),e.inputs[1].reshape([e.inputs[1].dims[0],e.inputs[1].dims[1],1,e.inputs[1].dims[2]])];e.inputs.length===3&&s.push(e.inputs[2]);let o=[0,r.pads[0],0,r.pads[1]],n=[1].concat(r.strides),i=[1].concat(r.dilations),a=[1].concat(r.kernelShape),l=Kl({...r,pads:o,strides:n,dilations:i,kernelShape:a},s);mc(e,s,l,c=>t?[c[0],c[2],c[3]]:[c[0],c[1],c[3]])},G_=(e,r,t)=>{let s=t.format==="NHWC"?"channelsLast":"channelsFirst",o=Kl(t,r),n=t.autoPad==="NOTSET"?t.pads:t.autoPad,i=o0(r[0].dims,r[1].dims,t.strides,t.dilations,n,!1,s);e.compute(i0(r,o,i.outShape,[i.filterDepth,i.filterHeight,i.filterWidth],[i.padInfo.front,i.padInfo.top,i.padInfo.left],s))},tu=(e,r)=>{if(U_(e.inputs,r),e.inputs[0].dims.length===3)W_(e,r);else if(e.inputs[0].dims.length===5)G_(e,e.inputs,r);else{let t=Kl(r,e.inputs);mc(e,e.inputs,t)}}}),d0,ax=Ve(()=>{mt(),Us(),bt(),xt(),d0=(e,r,t)=>{let s=e.length>2,o=r.outputShape,n=r.format==="NHWC",i=r.group,a=e[1].dims,l=a[2]/i,c=a[3],p=n?Jt(l):1,u=n&&c===1&&l>=4,h=u?Math.floor(l/4)*4:Math.floor(l/p)*p,g=l-h,_=n?Jt(c):1,E=n?c===1?p:_:1,I=xe.size(o)/_,M=[Math.ceil(I/64),1,1];St("verbose",()=>`[conv2d_backprop_webgpu] dispatch = ${M}`);let y=["rank","rank"],$=[r.strides[0],r.strides[1]],P=[r.kernelShape[n?1:2],r.kernelShape[n?2:3]],b=[r.dilations[0],r.dilations[1]],w=[P[0]+(r.dilations[0]<=1?0:(r.kernelShape[n?1:2]-1)*(r.dilations[0]-1)),P[1]+(r.dilations[1]<=1?0:(r.kernelShape[n?2:3]-1)*(r.dilations[1]-1))],T=[w[0]-1-Math.floor((r.pads[0]+r.pads[2])/2),w[1]-1-Math.floor((r.pads[1]+r.pads[3])/2)],k=[{type:12,data:I},{type:12,data:$},{type:12,data:P},{type:12,data:b},{type:12,data:w},{type:6,data:T},{type:12,data:h},{type:12,data:l},{type:12,data:c},...nt(e[0].dims,e[1].dims)];s&&(k.push(...nt(e[2].dims)),y.push("rank")),k.push(...nt(o));let z=R=>{let Q=[{name:"output_size",type:"u32"},{name:"strides",type:"u32",length:$.length},{name:"filter_dims",type:"u32",length:P.length},{name:"dilations",type:"u32",length:P.length},{name:"effective_filter_dims",type:"u32",length:w.length},{name:"pads",type:"i32",length:T.length},{name:"input_channels_per_group_int",type:"u32"},{name:"input_channels_per_group",type:"u32"},{name:"output_channels_per_group",type:"u32"}],q=pr(e[0].dataType),U=n?1:2,Z=n?2:3,H=n?3:1,J=$e("W",e[1].dataType,e[1].dims.length,E),oe=$e("Dy",e[0].dataType,e[0].dims.length,p),ae=[oe,J];s&&ae.push($e("bias",e[2].dataType,[o[H]].length,_));let ce=tt("result",e[0].dataType,o.length,_),he=()=>{let G="";if(u)p===4?G+=` - let xValue = ${oe.getByOffset("x_offset")}; - let wValue = ${J.getByOffset("w_offset")}; - dotProd = dotProd + dot(xValue, wValue); - x_offset += 1u; - w_offset += 1u;`:p===2?G+=` - dotProd = dotProd + dot(vec4<${q}>(${oe.getByOffset("x_offset")}, ${oe.getByOffset("x_offset + 1u")}), vec4<${q}>(${J.getByOffset("w_offset")}, ${J.getByOffset("w_offset + 1u")})); - x_offset += 2u; - w_offset += 2u;`:p===1&&(G+=` - dotProd = dotProd + dot(vec4<${q}>(${oe.getByOffset("x_offset")}, ${oe.getByOffset("x_offset + 1u")}, ${oe.getByOffset("x_offset + 2u")}, ${oe.getByOffset("x_offset + 3u")}), vec4<${q}>(${J.getByOffset("w_offset")}, ${J.getByOffset("w_offset + 1u")}, ${J.getByOffset("w_offset + 2u")}, ${J.getByOffset("w_offset + 3u")})); - x_offset += 4u; - w_offset += 4u;`);else if(G+=` - let xValue = ${n?oe.getByOffset(`${oe.indicesToOffset(`${oe.type.indices}(batch, idyR, idyC, inputChannel)`)} / ${p}`):oe.get("batch","inputChannel","idyR","idyC")}; - `,p===1)G+=` - let w_offset = ${J.indicesToOffset(`${J.type.indices}(u32(wRPerm), u32(wCPerm), inputChannel, wOutChannel)`)}; - let wValue = ${J.getByOffset(`w_offset / ${E}`)}; - dotProd = dotProd + xValue * wValue;`;else for(let se=0;se{if(g===0)return"";if(!u)throw new Error(`packInputAs4 ${u} is not true.`);let G="";if(p===1){G+="dotProd = dotProd";for(let se=0;se(i32(r), i32(c)) - uniforms.pads; - let dyRCorner = dyCorner.x; - let dyCCorner = dyCorner.y; - let groupId = d1 / uniforms.output_channels_per_group; - let wOutChannel = d1 - groupId * uniforms.output_channels_per_group; - // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1). - // ? = to be determined. : = across all values in that axis. - var dotProd = ${ce.type.value}(0.0); - var wR: u32 = 0; - if (uniforms.dilations.x == 1) { - // Minimum wR >= 0 that satisfies (dyRCorner + wR) % (uniforms.strides.x) == 0 - wR = u32(((dyRCorner + i32(uniforms.strides.x) - 1) / i32(uniforms.strides.x)) * i32(uniforms.strides.x) - dyRCorner); - } - for (; wR < uniforms.effective_filter_dims.x; wR = wR + 1) { - if (wR % uniforms.dilations.x != 0) { - continue; - } - let dyR = (${q}(dyRCorner) + ${q}(wR)) / ${q}(uniforms.strides[0]); - let wRPerm = uniforms.filter_dims.x - 1 - wR / uniforms.dilations.x; - if (dyR < 0.0 || dyR >= ${q}(uniforms.Dy_shape[${U}]) || fract(dyR) > 0.0 || - wRPerm < 0) { - continue; - } - let idyR: u32 = u32(dyR); - var wC: u32 = 0; - if (uniforms.dilations.y == 1) { - // Minimum wC >= 0 that satisfies (dyCCorner + wC) % (uniforms.strides.y) == 0 - wC = u32(((dyCCorner + i32(uniforms.strides.y) - 1) / i32(uniforms.strides.y)) * i32(uniforms.strides.y) - dyCCorner); - } - for (; wC < uniforms.effective_filter_dims.y; wC = wC + 1) { - if (wC % uniforms.dilations.y != 0) { - continue; - } - let dyC = (${q}(dyCCorner) + ${q}(wC)) / ${q}(uniforms.strides.y); - let wCPerm = uniforms.filter_dims.y - 1 - wC / uniforms.dilations.y; - if (dyC < 0.0 || dyC >= ${q}(uniforms.Dy_shape[${Z}]) || - fract(dyC) > 0.0 || wCPerm < 0) { - continue; - } - let idyC: u32 = u32(dyC); - var inputChannel = groupId * uniforms.input_channels_per_group; - ${u?` - var x_offset = ${oe.indicesToOffset(`${oe.type.indices}(batch, idyR, idyC, inputChannel)`)} / ${p}; - var w_offset = ${J.indicesToOffset(`${J.type.indices}(wRPerm, wCPerm, inputChannel, wOutChannel)`)} / ${E}; - `:""} - for (var d2: u32 = 0; d2 < uniforms.input_channels_per_group_int; d2 = d2 + ${u?4:p}) { - ${he()} - inputChannel = inputChannel + ${u?4:p}; - } - ${N()} - wC = wC + uniforms.strides.y - 1; - } - wR = wR + uniforms.strides[0] - 1; - } - let value = dotProd${s?` + bias[d1 / ${_}]`:""}; - ${ce.setByOffset("global_idx","value")}; - `;return` - ${R.registerUniforms(Q).declareVariables(...ae,ce)} - ${R.mainStart()} - ${R.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")}; - ${O}}`};return{name:"ConvTranspose2D",shaderCache:{hint:`${r.cacheKey};${p}${E}${_}${u}${g}`,inputDependencies:y},getRunData:()=>({dispatchGroup:{x:M[0],y:M[1],z:M[2]},outputs:[{dims:t?t(o):o,dataType:e[0].dataType}],programUniforms:k}),getShaderSource:z}}}),K_,H_,q_,fc,c0,Q_,_c,X_,u0,lx=Ve(()=>{ax(),Bn(),cn(),K_=(e,r,t,s,o,n)=>(e-1)*r+t+(s-1)*o+1-n,H_=(e,r,t,s,o)=>{let n=Math.floor(e/2);r==="SAME_UPPER"?(t[s]=n,t[o]=e-n):r==="SAME_LOWER"&&(t[s]=e-n,t[o]=n)},q_=(e,r,t,s,o,n,i,a,l,c)=>{let p=e.length-2,u=c.length===0;l.length{let t=e.kernelShape.slice();if(e.kernelShape.length===0||e.kernelShape.reduce((u,h)=>u*h,1)===0){t.length=0;for(let u=2;uu+h,0)===0){let u=r[0].dims.length-2;l=new Array(u).fill(1)}let c=e.strides.slice();if(c.reduce((u,h)=>u+h,0)===0){let u=r[0].dims.length-2;c=new Array(u).fill(1)}q_(a,t,l,e.autoPad,e.group,o,c,s,i,n);let p=Object.assign({},e);return Object.assign(p,{kernelShape:t,pads:o,outputPadding:i,outputShape:n,dilations:l,strides:c}),p},c0=e=>{let r=xu(e),t=e.format,s=["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][typeof e.autoPad>"u"?0:e.autoPad],o=e.dilations,n=e.group,i=e.kernelShape,a=e.pads,l=e.strides,c=e.wIsConst(),p=e.outputPadding,u=e.outputShape;return{autoPad:s,format:t,dilations:o,group:n,kernelShape:i,outputPadding:p,outputShape:u,pads:a,strides:l,wIsConst:c,...r,cacheKey:`${e.format};${r.activation};`}},Q_=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length!==4&&e[0].dims.length!==3)throw new Error("currently only support 2-dimensional conv");if(e[0].dims.length!==e[1].dims.length)throw new Error("filter does not have same dimension as input");let t=e[0].dims[r.format==="NHWC"?e[0].dims.length-1:1],s=e[1].dims[0];if(t!==s)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");let o=e[1].dims[1]*r.group;if(e.length===3&&(e[2].dims.length!==1||e[2].dims[0]!==o))throw new Error("invalid bias");let n=e[0].dims.length-2;if(r.dilations.reduce((i,a)=>i+a,0)>0&&r.dilations.length!==n)throw new Error(`dilations should be ${n}D`);if(r.strides.reduce((i,a)=>i+a,0)>0&&r.strides.length!==n)throw new Error(`strides should be ${n}D`);if(r.pads.reduce((i,a)=>i+a,0)>0&&r.pads.length!==n*2)throw new Error(`pads should be ${n*2}D`);if(r.outputPadding.length!==n&&r.outputPadding.length!==0)throw new Error(`output_padding should be ${n}D`);if(r.kernelShape.reduce((i,a)=>i+a,0)>0&&r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape");if(r.outputShape.length!==0&&r.outputShape.length!==e[0].dims.length-2)throw new Error("invalid output shape")},_c=(e,r,t,s)=>{let o=e.kernelCustomData.wT??e.compute(Wr(r[1],[2,3,0,1]),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=o);let n=[r[0],o];r.length===3&&n.push(r[2]),e.compute(d0(n,t,s),{inputs:n})},X_=(e,r)=>{let t=r.format==="NHWC",s=[e.inputs[0].reshape(t?[e.inputs[0].dims[0],1,e.inputs[0].dims[1],e.inputs[0].dims[2]]:[e.inputs[0].dims[0],e.inputs[0].dims[1],1,e.inputs[0].dims[2]]),e.inputs[1].reshape([e.inputs[1].dims[0],e.inputs[1].dims[1],1,e.inputs[1].dims[2]])];e.inputs.length===3&&s.push(e.inputs[2]);let o=r.kernelShape;(o.length===0||o[0]===0)&&(o=[e.inputs[1].dims[2]]);let n=r.dilations;(n.length===0||n[0]===0)&&(n=[1]);let i=r.strides;(i.length===0||i[0]===0)&&(i=[1]);let a=r.pads;a.length===0&&(a=[0,0]),a=[0,a[0],0,a[1]],i=[1].concat(i),n=[1].concat(n),o=[1].concat(o);let l=r.outputPadding;l=[0].concat(l);let c=fc({...r,pads:a,strides:i,dilations:n,kernelShape:o,outputPadding:l},s);_c(e,s,c,p=>t?[p[0],p[2],p[3]]:[p[0],p[1],p[3]])},u0=(e,r)=>{if(Q_(e.inputs,r),e.inputs[0].dims.length===3)X_(e,r);else{let t=fc(r,e.inputs);_c(e,e.inputs,t)}}}),J_,p0,h0,dx=Ve(()=>{mt(),bt(),tr(),xt(),J_=(e,r,t,s)=>{let o=xe.size(r),n=r.length,i=$e("input",e,n),a=tt("output",e,n),l=t.dataType===6?t.getInt32Array()[0]:Number(t.getBigInt64Array()[0]),c=xe.normalizeAxis(l,n),p=u=>{let h=` i32(${i.indicesGet("inputIndices","uniforms.axis")}) `,g=rt("uniforms.input_shape","uniforms.axis",n),_=s.reverse?h+(s.exclusive?" + 1":""):"0",E=s.reverse?g:h+(s.exclusive?"":" + 1");return` - ${u.registerUniform("outputSize","u32").registerUniform("axis","u32").declareVariables(i,a)} - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - var inputIndices = ${a.offsetToIndices("global_idx")}; - var sum = ${a.type.value}(0); - let first : i32 = ${_}; - let last : i32 = ${E}; - for (var i : i32 = first; i < last; i++) { - ${i.indicesSet("inputIndices","uniforms.axis","u32(i)")}; - sum = sum + ${i.getByIndices("inputIndices")}; - } - ${a.setByOffset("global_idx","sum")}; - }`};return{name:"CumSum",shaderCache:{hint:s.cacheKey,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:r,dataType:e}],dispatchGroup:{x:Math.ceil(o/64)},programUniforms:[{type:12,data:o},{type:12,data:c},...nt(r,r)]}),getShaderSource:p}},p0=(e,r)=>{let t=e.inputs[0].dims,s=e.inputs[0].dataType,o=e.inputs[1];e.compute(J_(s,t,o,r),{inputs:[0]})},h0=e=>{let r=e.exclusive===1,t=e.reverse===1;return Lt({exclusive:r,reverse:t})}}),Y_,Z_,eg,m0,f0,cx=Ve(()=>{mt(),bt(),tr(),xt(),Y_=e=>{if(!e||e.length!==1)throw new Error("DepthToSpace requires 1 input.");if(e[0].dims.length!==4)throw new Error("DepthToSpace requires 4D input.")},Z_=(e,r,t,s)=>{let o=[];o.push(`fn perm(i: ${s.type.indices}) -> ${t.type.indices} { - var a: ${t.type.indices};`);for(let n=0;n{let t,s,o,n,i,a,l=r.format==="NHWC",c=r.blocksize,p=r.mode==="DCR";l?([t,s,o,n]=e.dims,i=p?[t,s,o,c,c,n/c**2]:[t,s,o,n/c**2,c,c],a=p?[0,1,3,2,4,5]:[0,1,4,2,5,3]):([t,s,o,n]=[e.dims[0],e.dims[2],e.dims[3],e.dims[1]],i=p?[t,c,c,n/c**2,s,o]:[t,n/c**2,c,c,s,o],a=p?[0,3,4,1,5,2]:[0,1,4,2,5,3]);let u=e.reshape(i),h=u.dims.length,g=e.dataType,_=$e("a",g,h),E=tt("output",g,h),I=M=>` - ${M.registerUniform("output_size","u32").declareVariables(_,E)} - - ${Z_(a,h,_,E)} - - ${M.mainStart()} - ${M.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let indices = ${E.offsetToIndices("global_idx")}; - let aIndices = perm(indices); - - ${E.setByOffset("global_idx",_.getByIndices("aIndices"))} - }`;return{name:"DepthToSpace",shaderCache:{hint:`${e.dims};${r.blocksize};${r.mode}`,inputDependencies:["rank"]},getRunData:M=>{let y=l?[t,s*c,o*c,n/c**2]:[t,n/c**2,s*c,o*c],$=xe.size(y),P=u.dims,b=xe.sortBasedOnPerm(P,a);return{outputs:[{dims:y,dataType:M[0].dataType}],dispatchGroup:{x:Math.ceil($/64)},programUniforms:[{type:12,data:$},...nt(P,b)]}},getShaderSource:I}},m0=(e,r)=>{Y_(e.inputs),e.compute(eg(e.inputs[0],r))},f0=e=>Lt({blocksize:e.blocksize,mode:e.mode,format:e.format})}),Hl,ra,gc,tg,rg,sg,ng,wc,og,_0,g0,ux=Ve(()=>{mt(),bt(),tr(),xt(),Hl="[a-zA-Z]|\\.\\.\\.",ra="("+Hl+")+",gc="^"+ra+"$",tg="("+ra+",)*"+ra,rg="^"+tg+"$",sg=class{constructor(e=-1){this.symbolToIndices=new Map,this.inputIndex=e}addSymbol(e,r){let t=this.symbolToIndices.get(e);t===void 0?t=[r]:t.push(r),this.symbolToIndices.set(e,t)}},ng=class{constructor(e,r){var o;this.equation=r,this.hasEllipsis=!1,this.symbolToInfo=new Map,this.lhs=new Array,this.outputDims=[];let[t,s]=r.includes("->")?r.split("->",2):[r,""];if(!t.match(RegExp(rg)))throw new Error("Invalid LHS term");if(t.split(",").forEach((n,i)=>{let a=e[i].dims.slice();if(!n.match(RegExp(gc)))throw new Error("Invalid LHS term");let l=this.processTerm(n,!0,a,i);this.lhs.push(l)}),s==="")s+=[...this.symbolToInfo.entries()].filter(([n,i])=>i.count===1||n==="...").map(([n])=>n).join("");else if(!s.match(RegExp(ra)))throw new Error("Invalid RHS");(o=s.match(RegExp(Hl,"g")))==null||o.forEach(n=>{if(n==="...")this.outputDims=this.outputDims.concat(this.ellipsisDims);else{let i=this.symbolToInfo.get(n);if(i===void 0)throw new Error("Invalid RHS symbol");this.outputDims.push(i.dimValue)}}),this.rhs=this.processTerm(s,!1,this.outputDims)}addSymbol(e,r,t){let s=this.symbolToInfo.get(e);if(s!==void 0){if(s.dimValue!==r&&s.count!==1)throw new Error("Dimension mismatch");s.count++,s.inputIndices.push(t)}else s={count:1,dimValue:r,inputIndices:[t]};this.symbolToInfo.set(e,s)}processTerm(e,r,t,s=-1){let o=t.length,n=!1,i=[],a=0;if(!e.match(RegExp(gc))&&!r&&e!=="")throw new Error("Invalid LHS term");let l=e.match(RegExp(Hl,"g")),c=new sg(s);return l==null||l.forEach((p,u)=>{if(p==="..."){if(n)throw new Error("Only one ellipsis is allowed per input term");n=!0;let h=o-l.length+1;if(h<0)throw new Error("Ellipsis out of bounds");if(i=t.slice(a,a+h),this.hasEllipsis){if(this.ellipsisDims.length!==i.length||this.ellipsisDims.toString()!==i.toString())throw new Error("Ellipsis dimensions mismatch")}else if(r)this.hasEllipsis=!0,this.ellipsisDims=i;else throw new Error("Ellipsis must be specified in the LHS");for(let g=0;ge+"_max",og=(e,r,t,s)=>{let o=e.map(c=>c.length).map((c,p)=>$e(`input${p}`,r,c)),n=xe.size(s),i=tt("output",r,s.length),a=[...t.symbolToInfo.keys()].filter(c=>!t.rhs.symbolToIndices.has(c)),l=c=>{let p=[],u="var prod = 1.0;",h="var sum = 0.0;",g="sum += prod;",_=[],E=[],I=[],M=[],y=t.symbolToInfo.size===t.rhs.symbolToIndices.size;t.symbolToInfo.forEach((P,b)=>{var w;if(t.rhs.symbolToIndices.has(b)){let T=(w=t.rhs.symbolToIndices.get(b))==null?void 0:w[0];T!==void 0&&t.lhs.forEach((k,z)=>{if(P.inputIndices.includes(z)){let R=k.symbolToIndices.get(b);if(R===void 0)throw new Error("Invalid symbol error");R.forEach(Q=>{p.push(`${o[z].indicesSet(`input${z}Indices`,Q,i.indicesGet("outputIndices",T))}`)})}})}else t.lhs.forEach((T,k)=>{if(P.inputIndices.includes(k)){let z=T.symbolToIndices.get(b);if(z===void 0)throw new Error("Invalid symbol error");z.forEach(R=>{_.push(`${o[k].indicesSet(`input${k}Indices`,R,`${b}`)}`)}),M.push(`prod *= ${o[k].getByIndices(`input${k}Indices`)};`)}}),E.push(`for(var ${b}: u32 = 0; ${b} < uniforms.${wc(b)}; ${b}++) {`),I.push("}")});let $=y?[...p,`let sum = ${o.map((P,b)=>P.getByIndices(`input${b}Indices`)).join(" * ")};`]:[...p,h,...E,..._,u,...M,g,...I];return` - ${c.registerUniforms(a.map(P=>({name:`${wc(P)}`,type:"u32"}))).registerUniform("outputSize","u32").declareVariables(...o,i)} - - ${c.mainStart()} - ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - var outputIndices = ${i.offsetToIndices("global_idx")}; - ${o.map((P,b)=>`var input${b}Indices: ${o[b].type.indices};`).join(` -`)} - ${$.join(` -`)}; - ${i.setByOffset("global_idx","sum")}; - }`};return{name:"Einsum",shaderCache:{hint:t.equation,inputDependencies:e.map(()=>"rank")},getRunData:()=>{let c=a.filter(u=>t.symbolToInfo.has(u)).map(u=>{var h;return{type:12,data:((h=t.symbolToInfo.get(u))==null?void 0:h.dimValue)||0}});c.push({type:12,data:n});let p=e.map((u,h)=>[...nt(u)]).reduce((u,h)=>u.concat(h),c);return p.push(...nt(s)),{outputs:[{dims:s,dataType:r}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:p}},getShaderSource:l}},_0=(e,r)=>{let t=new ng(e.inputs,r.equation),s=t.outputDims,o=e.inputs.map((n,i)=>n.dims);e.compute(og(o,e.inputs[0].dataType,t,s))},g0=e=>{let r=e.equation.replace(/\s+/g,"");return Lt({equation:r})}}),ig,yc,ag,lg,w0,px=Ve(()=>{mt(),bt(),xt(),ig=e=>{if(!e||e.length!==2)throw new Error("Expand requires 2 input.");let r=e[0].dims,t=Array.from(e[1].getBigInt64Array(),Number),s=t.length{let t=e.length-r.length,s=[];for(let o=0;oe.length>r.length?yc(e,r):yc(r,e),lg=e=>{let r=e[0].dims,t=Array.from(e[1].getBigInt64Array(),Number),s=ag(r,t),o=e[0].dataType,n=o===9||xe.size(r)===1,i=o===9||r.length>0&&r[r.length-1]%4===0?4:1,a=n||s.length>0&&s[s.length-1]%4===0?4:1,l=Math.ceil(xe.size(s)/a),c=u=>{let h=$e("input",o,r.length,i),g=tt("output",o,s.length,a),_;if(o===9){let E=(I,M,y="")=>` - let outputIndices${M} = ${g.offsetToIndices(`outputOffset + ${M}u`)}; - let offset${M} = ${h.broadcastedIndicesToOffset(`outputIndices${M}`,g)}; - let index${M} = offset${M} / 4u; - let component${M} = offset${M} % 4u; - ${I}[${M}] = ${y}(${h.getByOffset(`index${M}`)}[component${M}]); - `;_=` - let outputOffset = global_idx * ${a}; - var data = vec4(0); - ${E("data",0,"u32")} - ${E("data",1,"u32")} - ${E("data",2,"u32")} - ${E("data",3,"u32")} - ${g.setByOffset("global_idx","data")} - }`}else _=` - let outputIndices = ${g.offsetToIndices(`global_idx * ${a}`)}; - let inputOffset = ${h.broadcastedIndicesToOffset("outputIndices",g)}; - let data = ${g.type.value}(${h.getByOffset(`inputOffset / ${i}`)}); - ${g.setByOffset("global_idx","data")} - }`;return` - ${u.registerUniform("vec_size","u32").declareVariables(h,g)} - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} - ${_}`},p=[{type:12,data:l},...nt(r,s)];return{name:"Expand",shaderCache:{hint:`${s.length};${i}${a}`,inputDependencies:["rank"]},getShaderSource:c,getRunData:()=>({outputs:[{dims:s,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:p})}},w0=e=>{ig(e.inputs),e.compute(lg(e.inputs),{inputs:[0]})}}),dg,y0,hx=Ve(()=>{mt(),bt(),xt(),vu(),dg=e=>{let r=e[0].dataType,t=xe.size(e[0].dims),s=xe.size(e[1].dims),o=s%4===0,n=i=>{let a=$e("x",r,[1],4),l=$e("bias",r,[1],4),c=tt("y",r,[1],4),p=[{name:"output_vec_size",type:"u32"},{name:"bias_size",type:"u32"}],u=g=>` - let bias${g}_offset: u32 = (global_idx * 4 + ${g}) % uniforms.bias_size; - let bias${g} = ${l.getByOffset(`bias${g}_offset / 4`)}[bias${g}_offset % 4];`,h=o?` - let bias = ${l.getByOffset("global_idx % (uniforms.bias_size / 4)")};`:`${u(0)}${u(1)}${u(2)}${u(3)} - let bias = ${a.type.value}(bias0, bias1, bias2, bias3);`;return`${i.registerUniforms(p).declareVariables(a,l,c)} - - ${Xc(Cr(r))} - - ${i.mainStart($o)} - ${i.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_vec_size")} - - let x = ${a.getByOffset("global_idx")}; - ${h} - let x_in = x + bias; - ${c.setByOffset("global_idx",Jc("x_in"))} - }`};return{name:"FastGeluWithBias",shaderCache:{hint:`${o}`,inputDependencies:["type","type"]},getShaderSource:n,getRunData:i=>({outputs:[{dims:i[0].dims,dataType:i[0].dataType}],programUniforms:[{type:12,data:Math.ceil(t/4)},{type:12,data:s}],dispatchGroup:{x:Math.ceil(t/$o/4)}})}},y0=e=>{e.inputs.length<2||xe.size(e.inputs[1].dims)===0?RM(e):e.compute(dg(e.inputs))}}),cg,ug,M0,b0,mx=Ve(()=>{mt(),bt(),tr(),xt(),cg=e=>{if(!e||e.length!==2)throw new Error("Gather requires 2 inputs.")},ug=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t.length,n=xe.normalizeAxis(r.axis,o),i=t.slice(0);i.splice(n,1,...s);let a=t[n],l=e[0].dataType===9?4:1,c=Math.ceil(xe.size(i)/l),p=[{type:12,data:c},{type:6,data:a},{type:12,data:n},...nt(e[0].dims,e[1].dims,i)],u=h=>{let g=$e("data",e[0].dataType,e[0].dims.length,l),_=$e("inputIndices",e[1].dataType,e[1].dims.length),E=tt("output",e[0].dataType,i.length,l),I=y=>{let $=s.length,P=`var indicesIndices${y} = ${_.type.indices}(0);`;for(let b=0;b<$;b++)P+=`${$>1?`indicesIndices${y}[${b}]`:`indicesIndices${y}`} = ${i.length>1?`outputIndices${y}[uniforms.axis + ${b}]`:`outputIndices${y}`};`;P+=` - var idx${y} = ${_.getByIndices(`indicesIndices${y}`)}; - if (idx${y} < 0) { - idx${y} = idx${y} + uniforms.axisDimLimit; - } - var dataIndices${y} : ${g.type.indices}; - `;for(let b=0,w=0;b1?`dataIndices${y}[${b}]`:`dataIndices${y}`} = u32(idx${y});`,w+=$):(P+=`${o>1?`dataIndices${y}[${b}]`:`dataIndices${y}`} = ${i.length>1?`outputIndices${y}[${w}]`:`outputIndices${y}`};`,w++);return P},M;if(e[0].dataType===9){let y=($,P,b="")=>` - let outputIndices${P} = ${E.offsetToIndices(`outputOffset + ${P}u`)}; - ${I(P)}; - let offset${P} = ${g.indicesToOffset(`dataIndices${P}`)}; - let index${P} = offset${P} / 4u; - let component${P} = offset${P} % 4u; - ${$}[${P}] = ${b}(${g.getByOffset(`index${P}`)}[component${P}]); - `;M=` - let outputOffset = global_idx * ${l}; - var value = vec4(0); - ${y("value",0,"u32")} - ${y("value",1,"u32")} - ${y("value",2,"u32")} - ${y("value",3,"u32")} - ${E.setByOffset("global_idx","value")} - `}else M=` - let outputIndices = ${E.offsetToIndices("global_idx")}; - ${I("")}; - let value = ${g.getByIndices("dataIndices")}; - ${E.setByOffset("global_idx","value")}; - `;return` - ${h.registerUniform("outputSize","u32").registerUniform("axisDimLimit","i32").registerUniform("axis","u32").declareVariables(g,_,E)} - ${h.mainStart()} - ${h.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - ${M} - }`};return{name:"Gather",shaderCache:{hint:r.cacheKey,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:i,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:p}),getShaderSource:u}},M0=e=>Lt({axis:e.axis}),b0=(e,r)=>{let t=e.inputs;cg(t),e.compute(ug(e.inputs,r))}}),pg,v0,x0,fx=Ve(()=>{mt(),bt(),xt(),pg=(e,r,t,s,o,n,i,a,l)=>{let c=[{type:12,data:n},{type:12,data:s},{type:12,data:o},{type:12,data:t},{type:12,data:i},{type:12,data:a},{type:12,data:l}],p=[n];c.push(...nt(r.dims,p));let u=h=>{let g=$e("indices_data",r.dataType,r.dims.length),_=tt("input_slice_offsets_data",12,1,1),E=[g,_],I=[{name:"output_size",type:"u32"},{name:"batch_dims",type:"u32"},{name:"input_dims",type:"u32",length:o.length},{name:"sizes_from_slice_dims_data",type:"u32",length:t.length},{name:"num_slices_per_batch",type:"u32"},{name:"input_batch_stride",type:"u32"},{name:"num_slice_dims",type:"u32"}];return` - ${h.registerUniforms(I).declareVariables(...E)} - ${h.mainStart()} - ${h.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let batch_idx = global_idx / uniforms.num_slices_per_batch; - let base_offset = batch_idx * uniforms.input_batch_stride; - - let slice_indices_base_offset = global_idx * uniforms.num_slice_dims; - var relative_slice_offset = 0; - for (var dim_idx = 0u; dim_idx < uniforms.num_slice_dims; dim_idx ++) { - var index = i32(indices_data[dim_idx + slice_indices_base_offset].x); - let input_dim_idx = uniforms.batch_dims + dim_idx; - if (index < 0) { - ${o.length===1?"index += i32(uniforms.input_dims);":"index += i32(uniforms.input_dims[input_dim_idx]);"} - } - ${t.length===1?"relative_slice_offset += index * i32(uniforms.sizes_from_slice_dims_data);":"relative_slice_offset += index * i32(uniforms.sizes_from_slice_dims_data[dim_idx]);"} - } - - input_slice_offsets_data[global_idx] = base_offset + u32(relative_slice_offset); - }`};return e.compute({name:"computeSliceOffsets",shaderCache:{hint:`${o.length}_${t.length}`,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:p,dataType:e.inputs[1].dataType}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:c}),getShaderSource:u},{inputs:[r],outputs:[-1]})[0]},v0=(e,r)=>{let t=e.inputs,s=t[0].dims,o=t[0].dataType,n=t[1].dims,i=n[n.length-1],a=xe.sizeToDimension(n,n.length-1),l=xe.sizeFromDimension(s,r.batchDims+i),c=xe.sizeToDimension(s,r.batchDims),p=xe.sizeFromDimension(s,r.batchDims),u=a/c,h=new Array(i),g=l;for(let P=0;Ps.length)throw new Error("last dimension of indices must not be larger than rank of input tensor");let I=n.slice(0,-1).concat(s.slice(E)),M=xe.size(I),y=[{type:12,data:M},{type:12,data:l},...nt(t[0].dims,_.dims,I)],$=P=>{let b=$e("data",t[0].dataType,t[0].dims.length),w=$e("slice_offsets",12,_.dims.length),T=tt("output",t[0].dataType,I.length);return` - ${P.registerUniform("output_size","u32").registerUniform("slice_size","u32").declareVariables(b,w,T)} - ${P.mainStart()} - ${P.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let slice_offset = slice_offsets[global_idx / uniforms.slice_size]; - output[global_idx] = data[u32(slice_offset) + global_idx % uniforms.slice_size]; - }`};e.compute({name:"GatherND",shaderCache:{hint:r.cacheKey,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:I,dataType:o}],dispatchGroup:{x:Math.ceil(M/64)},programUniforms:y}),getShaderSource:$},{inputs:[t[0],_]})},x0=e=>({batchDims:e.batch_dims,cacheKey:""})}),hg,mg,T0,E0,_x=Ve(()=>{mt(),bt(),tr(),xt(),hg=(e,r)=>{if(e.length<3||e.length>4)throw new Error("GatherBlockQuantized requires 3 or 4 inputs.");let t=xe.normalizeAxis(r.quantizeAxis,e[0].dims.length),s=r.blockSize,o=e[0],n=e[2],i=e.length===4?e[3]:void 0;if(n.dims.length!==o.dims.length||!o.dims.map((a,l)=>l===t?Math.ceil(a/s)===n.dims[l]:a===n.dims[l]).reduce((a,l)=>a&&l,!0))throw new Error("Scales must have the same rank as the input tensor and the dims should match except on gatherAxis.");if(i){if(i.dataType!==o.dataType)throw new Error("Zero point must have the same data type as the input tensor.");if(i.dims.length!==n.dims.length||!i.dims.map((a,l)=>a===n.dims[l]).reduce((a,l)=>a&&l,!0))throw new Error("Zero point must have the same rank as the input tensor and the dims should match except on quantizeAxis.")}},mg=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t.length,n=xe.normalizeAxis(r.gatherAxis,o),i=xe.normalizeAxis(r.quantizeAxis,o),a=t.slice(0);a.splice(n,1,...s);let l=xe.size(a),c=e[2].dataType,p=e[0].dataType===22,u=[{type:12,data:l},{type:12,data:i},{type:12,data:n},{type:12,data:r.blockSize},...nt(...e.map((g,_)=>g.dims),a)],h=g=>{let _=$e("data",e[0].dataType,e[0].dims.length),E=$e("inputIndices",e[1].dataType,e[1].dims.length),I=$e("scales",e[2].dataType,e[2].dims.length),M=e.length>3?$e("zeroPoint",e[3].dataType,e[3].dims.length):void 0,y=tt("output",c,a.length),$=[_,E,I];M&&$.push(M);let P=[{name:"output_size",type:"u32"},{name:"quantize_axis",type:"u32"},{name:"gather_axis",type:"u32"},{name:"block_size",type:"u32"}];return` - ${g.registerUniforms(P).declareVariables(...$,y)} - ${g.mainStart()} - let output_indices = ${y.offsetToIndices("global_idx")}; - var indices_indices = ${E.type.indices}(0); - ${s.length>1?` - for (var i: u32 = 0; i < ${s.length}; i++) { - let index = ${y.indicesGet("output_indices","uniforms.gather_axis + i")}; - ${E.indicesSet("indices_indices","i","index")}; - }`:`indices_indices = ${y.indicesGet("output_indices","uniforms.gather_axis")};`}; - var data_indices = ${_.type.indices}(0); - for (var i: u32 = 0; i < uniforms.gather_axis; i++) { - let index = ${y.indicesGet("output_indices","i")}; - ${_.indicesSet("data_indices","i","index")}; - } - var index_from_indices = ${E.getByIndices("indices_indices")}; - if (index_from_indices < 0) { - index_from_indices += ${t[n]}; - } - ${_.indicesSet("data_indices","uniforms.gather_axis","u32(index_from_indices)")}; - for (var i = uniforms.gather_axis + 1; i < ${a.length}; i++) { - let index = ${y.indicesGet("output_indices",`i + ${s.length} - 1`)}; - ${_.indicesSet("data_indices","i","index")}; - } - let data_offset = ${_.indicesToOffset("data_indices")}; - let data_index = data_offset % 8; - // Convert 4-bit packed data to 8-bit packed data. - let packed_4bit_quantized_data = ${_.getByOffset("data_offset / 8")}; - let packed_8bit_quantized_data = (packed_4bit_quantized_data >> (4 * (data_index % 2))) & 0x0f0f0f0f; - let quantized_data_vec = ${p?"unpack4xI8":"unpack4xU8"}(u32(packed_8bit_quantized_data)); - let quantized_data = quantized_data_vec[data_index / 2]; - var scale_indices = data_indices; - let quantize_axis_index = ${I.indicesGet("data_indices","uniforms.quantize_axis")} / uniforms.block_size; - ${I.indicesSet("scale_indices","uniforms.quantize_axis","quantize_axis_index")}; - var scale = ${I.getByIndices("scale_indices")}; - ${M?` - let zero_point_indices = scale_indices; - let zero_point_offset = ${M.indicesToOffset("zero_point_indices")}; - let zero_point_index = zero_point_offset % 8; - let packed_4bit_zero_points = ${M.getByOffset("zero_point_offset / 8")}; - let packed_8bit_zero_points = (packed_4bit_zero_points >> (4 * (zero_point_index % 2))) & 0x0f0f0f0f; - let zero_point_vec = ${p?"unpack4xI8":"unpack4xU8"}(u32(packed_8bit_zero_points)); - let zero_point = zero_point_vec[zero_point_index / 2];`:"var zero_point = 0"}; - let dequantized_data = ${Cr(c)}(quantized_data - zero_point) * scale; - ${y.setByOffset("global_idx","dequantized_data")}; - }`};return{name:"GatherBlockQuantized",shaderCache:{hint:`${r.cacheKey};${e.filter((g,_)=>_!==1).map(g=>g.dims.join("_")).join(";")}`,inputDependencies:Array.from({length:e.length},(g,_)=>"rank")},getRunData:()=>({outputs:[{dims:a,dataType:c}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:u}),getShaderSource:h}},T0=(e,r)=>{let t=e.inputs;hg(t,r),e.compute(mg(e.inputs,r))},E0=e=>Lt({blockSize:e.blockSize,gatherAxis:e.gatherAxis,quantizeAxis:e.quantizeAxis})}),fg,_g,P0,C0,gx=Ve(()=>{mt(),bt(),tr(),xt(),fg=e=>{if(!e||e.length!==2)throw new Error("GatherElements requires 2 inputs.");if(e[0].dims.length<1)throw new Error("GatherElements requires that the data input be rank >= 1.");if(e[0].dims.length!==e[1].dims.length)throw new Error(`GatherElements requires that the data input and - indices input tensors be of same rank.`)},_g=(e,r)=>{let t=e[0].dims,s=e[0].dataType,o=t.length,n=e[1].dims,i=e[1].dataType,a=xe.normalizeAxis(r.axis,o),l=t[a],c=n.slice(0),p=xe.size(c),u=$e("input",s,o),h=$e("indicesInput",i,n.length),g=tt("output",s,c.length),_=[{type:12,data:p},{type:6,data:l},{type:12,data:a}];return _.push(...nt(t,n,c)),{name:"GatherElements",shaderCache:{inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:c,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(p/64)},programUniforms:_}),getShaderSource:E=>` - ${E.registerUniform("outputSize","u32").registerUniform("axisDimLimit","i32").registerUniform("axis","u32").declareVariables(u,h,g)} - ${E.mainStart()} - ${E.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - - let outputIndices = ${g.offsetToIndices("global_idx")}; - - var idx = ${h.getByOffset("global_idx")}; - if (idx < 0) { - idx = idx + uniforms.axisDimLimit; - } - var inputIndices = ${u.type.indices}(outputIndices); - ${u.indicesSet("inputIndices","uniforms.axis","u32(idx)")}; - let value = ${u.getByIndices("inputIndices")}; - - ${g.setByOffset("global_idx","value")}; - }`}},P0=e=>Lt({axis:e.axis}),C0=(e,r)=>{let t=e.inputs;fg(t),e.compute(_g(e.inputs,r))}}),gg,wg,S0,$0,wx=Ve(()=>{mt(),bt(),xt(),gg=e=>{if(!e)throw new Error("Input is missing");if(e.length<2||e.length>3)throw new Error("Invaid input number.");if(e.length===3&&e[2].dims.length>2)throw new Error("Invalid input shape of C");if(e[0].dataType!==e[1].dataType||e.length===3&&e[0].dataType!==e[2].dataType)throw new Error("Input types are mismatched")},wg=(e,r)=>{let t=e[0].dims.slice(),s=e[1].dims.slice(),[o,n,i]=ky.getShapeOfGemmResult(t,r.transA,s,r.transB,e.length===3?e[2].dims:void 0),a=[o,n];if(!a)throw new Error("Can't use gemm on the given tensors");let l=16,c=Math.ceil(n/l),p=Math.ceil(o/l),u=!0,h=xe.size(a),g=[{type:12,data:u?c:h},{type:12,data:o},{type:12,data:n},{type:12,data:i},{type:1,data:r.alpha},{type:1,data:r.beta}],_=["type","type"];e.length===3&&(g.push(...nt(e[2].dims)),_.push("rank")),g.push(...nt(a));let E=M=>{let y="";r.transA&&r.transB?y="value += a[k * uniforms.M + m] * b[n * uniforms.K + k];":r.transA&&!r.transB?y="value += a[k * uniforms.M + m] * b[k * uniforms.N + n];":!r.transA&&r.transB?y="value += a[m * uniforms.K + k] * b[n * uniforms.K + k];":!r.transA&&!r.transB&&(y="value += a[m * uniforms.K + k] * b[k * uniforms.N + n];");let $=r.alpha===1?"":"value *= uniforms.alpha;",P=$e("a",e[0].dataType,e[0].dims),b=$e("b",e[1].dataType,e[1].dims),w=P.type.value,T=null,k=[P,b];e.length===3&&(T=$e("c",e[2].dataType,e[2].dims.length),k.push(T));let z=tt("output",e[0].dataType,a.length);k.push(z);let R=[{name:"output_size",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"},{name:"alpha",type:"f32"},{name:"beta",type:"f32"}];return` - ${M.registerUniforms(R).declareVariables(...k)} - - ${M.mainStart()} - ${M.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let m = global_idx / uniforms.N; - let n = global_idx % uniforms.N; - - var value = ${w}(0); - for (var k: u32 = 0u; k < uniforms.K; k++) { - ${y} - } - - ${$} - ${T!=null?`let cOffset = ${T.broadcastedIndicesToOffset("vec2(m, n)",z)}; value += ${w}(uniforms.beta) * ${T.getByOffset("cOffset")};`:""} - output[global_idx] = value; - }`},I=M=>{let y=$e("a",e[0].dataType,e[0].dims),$=$e("b",e[1].dataType,e[1].dims),P=null,b=[y,$];e.length===3&&(P=$e("c",e[2].dataType,e[2].dims.length),b.push(P));let w=tt("output",e[0].dataType,a.length);b.push(w);let T=[{name:"num_tile_n",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"},{name:"alpha",type:"f32"},{name:"beta",type:"f32"}],k="",z="";r.transA&&r.transB?(z=` - var col = tile_row_start + local_id.x; - var row = k_start + local_id.y; - if (col < uniforms.M && row < uniforms.K) { - tile_a[local_id.y][local_id.x] = a[row * uniforms.M + col]; - } else { - tile_a[local_id.y][local_id.x] = ${y.type.value}(0); - } - - col = k_start + local_id.x; - row = tile_col_start + local_id.y; - if (col < uniforms.K && row < uniforms.N) { - tile_b[local_id.y][local_id.x] = b[row * uniforms.K + col]; - } else { - tile_b[local_id.y][local_id.x] = ${$.type.value}(0); - } - `,k="value += tile_a[k][local_id.y] * tile_b[local_id.x][k];"):r.transA&&!r.transB?(z=` - var col = tile_row_start + local_id.x; - var row = k_start + local_id.y; - if (col < uniforms.M && row < uniforms.K) { - tile_a[local_id.y][local_id.x] = a[row * uniforms.M + col]; - } else { - tile_a[local_id.y][local_id.x] = ${y.type.value}(0); - } - - col = tile_col_start + local_id.x; - row = k_start + local_id.y; - if (col < uniforms.N && row < uniforms.K) { - tile_b[local_id.y][local_id.x] = b[row * uniforms.N + col]; - } else { - tile_b[local_id.y][local_id.x] = ${$.type.value}(0); - } - `,k="value += tile_a[k][local_id.y] * tile_b[k][local_id.x];"):!r.transA&&r.transB?(z=` - var col = k_start + local_id.x; - var row = tile_row_start + local_id.y; - if (col < uniforms.K && row < uniforms.M) { - tile_a[local_id.y][local_id.x] = a[row * uniforms.K + col]; - } else { - tile_a[local_id.y][local_id.x] = ${y.type.value}(0); - } - - col = k_start + local_id.x; - row = tile_col_start + local_id.y; - if (col < uniforms.K && row < uniforms.N) { - tile_b[local_id.y][local_id.x] = b[row * uniforms.K + col]; - } else { - tile_b[local_id.y][local_id.x] = ${$.type.value}(0); - } - `,k="value += tile_a[local_id.y][k] * tile_b[local_id.x][k];"):!r.transA&&!r.transB&&(z=` - var col = k_start + local_id.x; - var row = tile_row_start + local_id.y; - if (col < uniforms.K && row < uniforms.M) { - tile_a[local_id.y][local_id.x] = a[row * uniforms.K + col]; - } else { - tile_a[local_id.y][local_id.x] = ${y.type.value}(0); - } - - col = tile_col_start + local_id.x; - row = k_start + local_id.y; - if (col < uniforms.N && row < uniforms.K) { - tile_b[local_id.y][local_id.x] = b[row * uniforms.N + col]; - } else { - tile_b[local_id.y][local_id.x] = ${$.type.value}(0); - } - `,k="value += tile_a[local_id.y][k] * tile_b[k][local_id.x];");let R=r.alpha===1?"":"value *= uniforms.alpha;";return` - ${M.registerUniforms(T).declareVariables(...b)} - var tile_a: array, ${l}>; - var tile_b: array, ${l}>; - ${M.mainStart([l,l,1])} - let tile_col_start = (workgroup_index % uniforms.num_tile_n) * ${l}; - let tile_row_start = (workgroup_index / uniforms.num_tile_n) * ${l}; - let num_tiles = (uniforms.K - 1) / ${l} + 1; - var k_start = 0u; - var value = ${w.type.value}(0); - for (var t: u32 = 0u; t < num_tiles; t++) { - ${z} - k_start = k_start + ${l}; - workgroupBarrier(); - - for (var k: u32 = 0u; k < ${l}; k++) { - ${k} - } - workgroupBarrier(); - } - - ${R} - let m = tile_row_start + local_id.y; - let n = tile_col_start + local_id.x; - ${P!=null?`let cOffset = ${P.broadcastedIndicesToOffset("vec2(m, n)",w)}; value += ${w.type.value}(uniforms.beta) * ${P.getByOffset("cOffset")};`:""} - if (m < uniforms.M && n < uniforms.N) { - output[m * uniforms.N + n] = value; - } - }`};return u?{name:"GemmShared",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:a,dataType:e[0].dataType}],dispatchGroup:{x:c*p},programUniforms:g}),getShaderSource:I}:{name:"Gemm",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:a,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(h/64)},programUniforms:g}),getShaderSource:E}},S0=e=>{let r=e.transA,t=e.transB,s=e.alpha,o=e.beta;return{transA:r,transB:t,alpha:s,beta:o,cacheKey:`${e.transA};${e.transB};${e.alpha===1}`}},$0=(e,r)=>{gg(e.inputs),e.compute(wg(e.inputs,r))}}),$s,js,En,Pn,yg,Mg,bg,vg,xg,Tg,Eg,Pg,k0,I0,yx=Ve(()=>{mt(),bt(),tr(),xt(),[$s,js,En,Pn]=[0,1,2,3],yg=e=>{if(e[0].dims.length!==4)throw new Error("only 4-D tensor is supported.");if(e[0].dims.length!==e[1].dims.length)throw new Error("input dimensions must be equal to grid dimensions");if(e[0].dims.length-2!==e[1].dims[e[1].dims.length-1])throw new Error(`last dimension of grid must be equal to ${e[0].dims.length-2}`);if(e[0].dims[0]!==e[1].dims[0])throw new Error("grid batch size must match input batch size")},Mg=` - fn gs_get_cubic_coeffs(x: f32) -> vec4 { - let cubic_alpha = -0.75f; - let x_abs = abs(x); - var coeffs: vec4; - coeffs[0] = (((cubic_alpha * (x_abs + 1) - 5 * cubic_alpha) * (x_abs + 1) + 8 * cubic_alpha) * (x_abs + 1) - 4 * cubic_alpha); - coeffs[1] = (((cubic_alpha + 2) * x_abs - (cubic_alpha + 3)) * x_abs * x_abs + 1); - coeffs[2] = (((cubic_alpha + 2) * (1 - x_abs) - (cubic_alpha + 3)) * (1 - x_abs) * (1 - x_abs) + 1); - coeffs[3] = (((cubic_alpha * (2 - x_abs) - 5 * cubic_alpha) * (2 - x_abs) + 8 * cubic_alpha) * (2 - x_abs) - 4 * cubic_alpha); - return coeffs; - } -`,bg=e=>` - fn gs_bicubic_interpolate(p: mat4x4<${e}>, x: f32, y: f32) -> ${e} { - var v: vec4; - var coeffs = gs_get_cubic_coeffs(x); - for (var i = 0; i < 4; i++) { - v[i] = coeffs[0] * p[i][0] + coeffs[1] * p[i][1] + coeffs[2] * p[i][2] + coeffs[3] * p[i][3]; - } - coeffs = gs_get_cubic_coeffs(y); - let pixel = ${e}(coeffs[0] * v[0] + coeffs[1] * v[1] + coeffs[2] * v[2] + coeffs[3] * v[3]); - return pixel; - } -`,vg=e=>` - fn gs_denormalize(n: f32, length: i32) -> f32 { - ${e.alignCorners===0?` - // alignCorners: false => [-1, 1] to [-0.5, length - 0.5] - return ((n + 1.0) * f32(length) - 1.0) / 2.0; - `:` - // alignCorners: true => [-1, 1] to [0, length - 1] - return (n + 1.0) / 2.0 * (f32(length - 1)); - `} - } -`,xg=e=>` - ${e.paddingMode==="reflection"?` - fn gs_reflect(x: i32, x_min: f32, x_max: f32) -> u32 { - var dx = 0.0; - var fx = f32(x); - let range = x_max - x_min; - if (fx < x_min) { - dx = x_min - fx; - let n = u32(dx / range); - let r = dx - f32(n) * range; - if (n % 2 == 0) { - fx = x_min + r; - } else { - fx = x_max - r; - } - } else if (fx > x_max) { - dx = fx - x_max; - let n = u32(dx / range); - let r = dx - f32(n) * range; - if (n % 2 == 0) { - fx = x_max - r; - } else { - fx = x_min + r; - } - } - return u32(fx); - }`:""} -`,Tg=(e,r,t)=>` - fn pixel_at_grid(r: i32, c: i32, H: i32, W: i32, batch: u32, channel: u32, border: vec4) -> ${r} { - var pixel = ${r}(0); - var indices = vec4(0); - indices[${$s}] = batch; - indices[${js}] = channel;`+(()=>{switch(t.paddingMode){case"zeros":return` - if (r >= 0 && r < H && c >=0 && c < W) { - indices[${En}] = u32(r); - indices[${Pn}] = u32(c); - } - `;case"border":return` - indices[${En}] = u32(clamp(r, 0, H - 1)); - indices[${Pn}] = u32(clamp(c, 0, W - 1)); - `;case"reflection":return` - indices[${En}] = gs_reflect(r, border[1], border[3]); - indices[${Pn}] = gs_reflect(c, border[0], border[2]); - `;default:throw new Error(`padding mode ${t.paddingMode} is not supported`)}})()+` - return ${e.getByIndices("indices")}; - } -`,Eg=(e,r,t)=>(()=>{switch(t.mode){case"nearest":return` - let result = pixel_at_grid(i32(round(y)), i32(round(x)), H_in, W_in, indices[${$s}], indices[${js}], border); - `;case"bilinear":return` - let x1 = i32(floor(x)); - let y1 = i32(floor(y)); - let x2 = x1 + 1; - let y2 = y1 + 1; - - let p11 = pixel_at_grid(y1, x1, H_in, W_in, indices[${$s}], indices[${js}], border); - let p12 = pixel_at_grid(y1, x2, H_in, W_in, indices[${$s}], indices[${js}], border); - let p21 = pixel_at_grid(y2, x1, H_in, W_in, indices[${$s}], indices[${js}], border); - let p22 = pixel_at_grid(y2, x2, H_in, W_in, indices[${$s}], indices[${js}], border); - - let dx2 = ${r}(f32(x2) - x); - let dx1 = ${r}(x - f32(x1)); - let dy2 = ${r}(f32(y2) - y); - let dy1 = ${r}(y - f32(y1)); - let result = dy2 * (dx2 * p11 + dx1 * p12) + dy1 * (dx2 * p21 + dx1 * p22); - `;case"bicubic":return` - let x0 = i32(floor(x)) - 1; - let y0 = i32(floor(y)) - 1; - var p: mat4x4<${r}>; - for (var h = 0; h < 4; h++) { - for (var w = 0; w < 4; w++) { - p[h][w] = pixel_at_grid(h + y0, w + x0, H_in, W_in, indices[${$s}], indices[${js}], border); - } - } - - let dx = x - f32(x0 + 1); - let dy = y - f32(y0 + 1); - let result = gs_bicubic_interpolate(p, dx, dy); - `;default:throw new Error(`mode ${t.mode} is not supported`)}})()+`${e.setByOffset("global_idx","result")}`,Pg=(e,r)=>{let t=$e("x",e[0].dataType,e[0].dims.length),s=[e[1].dims[0],e[1].dims[1],e[1].dims[2]],o=$e("grid",e[1].dataType,s.length,2),n=[e[0].dims[0],e[0].dims[1],e[1].dims[1],e[1].dims[2]];r.format==="NHWC"&&(n=[e[0].dims[0],e[1].dims[1],e[1].dims[2],e[0].dims[3]],[$s,js,En,Pn]=[0,3,1,2]);let i=tt("output",e[0].dataType,n.length),a=t.type.value,l=xe.size(n),c=[{type:12,data:l},...nt(e[0].dims,s,n)],p=u=>` - ${u.registerUniform("output_size","u32").declareVariables(t,o,i)} - ${Mg} - ${bg(a)} - ${vg(r)} - ${xg(r)} - ${Tg(t,a,r)} - - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let H_in = i32(uniforms.x_shape[${En}]); - let W_in = i32(uniforms.x_shape[${Pn}]); - - ${r.alignCorners===0?` - let x_min = -0.5; - let x_max = f32(W_in) - 0.5; - let y_min = -0.5; - let y_max = f32(H_in) - 0.5; - `:` - let x_min = 0.0; - let x_max = f32(W_in) - 1.0; - let y_min = 0.0; - let y_max = f32(H_in) - 1.0; - `}; - let border = vec4(x_min, y_min, x_max, y_max); - - let indices = ${i.offsetToIndices("global_idx")}; - var grid_indices = vec3(indices[${$s}], indices[${En}], indices[${Pn}]); - let nxy = ${o.getByIndices("grid_indices")}; - var x = gs_denormalize(f32(nxy[0]), W_in); - var y = gs_denormalize(f32(nxy[1]), H_in); - - ${Eg(i,a,r)} - }`;return{name:"GridSample",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:["type","type"]},getRunData:u=>{let h=xe.size(n);return{outputs:[{dims:n,dataType:u[0].dataType}],dispatchGroup:{x:Math.ceil(h/64)},programUniforms:c}},getShaderSource:p}},k0=(e,r)=>{yg(e.inputs),e.compute(Pg(e.inputs,r))},I0=e=>Lt({alignCorners:e.align_corners,mode:e.mode,paddingMode:e.padding_mode,format:e.format})}),Fr,Cg,A0,Mc,Sg,ca,F0,O0=Ve(()=>{mt(),bt(),tr(),wu(),bu(),xt(),cn(),Fr=(e,r)=>e.length>r&&e[r].dims.length>0?e[r]:void 0,Cg=(e,r)=>{let t=e[0],s=Fr(e,1),o=Fr(e,2),n=Fr(e,3),i=Fr(e,4),a=Fr(e,5),l=Fr(e,6),c=Fr(e,7);if(t.dims.length!==3&&t.dims.length!==5)throw new Error("Input query is expected to have 3 or 5 dimensions");let p=t.dims[0],u=t.dims[1],h=t.dims.length===3?t.dims[2]:r.numHeads*t.dims[4],g=u,_=0,E=0,I=Math.floor(h/r.numHeads);if(l&&c&&xe.size(l.dims)&&xe.size(c.dims)){if(l.dims.length!==4)throw new Error('Input "past_key" is expected to have 4 dimensions');if(l.dims[0]!==p||l.dims[1]!==r.numHeads||l.dims[3]!==I)throw new Error('Input "past_key" shape (batch_size, num_heads, past_sequence_length, head_size)');if(c.dims[0]!==p||c.dims[1]!==r.numHeads||c.dims[3]!==I)throw new Error('Input "past_value" shape (batch_size, num_heads, past_sequence_length, head_size)');if(l.dims[2]!==c.dims[2])throw new Error('Input "past_key" and "past_value" shall have same dim 2 (past_sequence_length)');if(c.dims.length!==4)throw new Error('Input "past_value" is expected to have 4 dimensions');_=l.dims[2],E=l.dims[2]}else if(l&&xe.size(l.dims)||c&&xe.size(c.dims))throw new Error('Input "past_key" and "past_value" shall be both present or both absent');let M;if(s&&xe.size(s.dims)>0){if(t.dims.length!==3)throw new Error('Input "query" is expected to have 3 dimensions when key is given');if(s.dims.length<3||s.dims.length>5)throw new Error('Input "key" is expected to have 3, 4, or 5 dimensions');if(t.dims[0]!==s.dims[0])throw new Error('Input "query" and "key" shall have same dim 0 (batch size)');if(s.dims.length===3){if(s.dims[2]!==t.dims[2])throw new Error('Input "query" and "key" shall have same dim 2 (hidden_size)');M=2,g=s.dims[1]}else if(s.dims.length===5){if(s.dims[2]!==r.numHeads||s.dims[3]!==2||s.dims[4]!==I)throw new Error('Expect "key" shape (batch_size, kv_sequence_length, num_heads, 2, head_size) for packed kv');if(o)throw new Error('Expect "value" be none when "key" has packed kv format.');M=5,g=s.dims[1]}else{if(s.dims[1]!==r.numHeads||s.dims[3]!==I)throw new Error('Expect "key" shape (batch_size, num_heads, kv_sequence_length, head_size) for past_key');M=0,g=s.dims[2]}}else{if(t.dims.length!==5)throw new Error('Input "query" is expected to have 5 dimensions when key is empty');if(t.dims[2]!==r.numHeads||t.dims[3]!==3)throw new Error('Expect "query" shape (batch_size, kv_sequence_length, num_heads, 3, head_size) for packed kv');M=3}if(n&&xe.size(n.dims)>0){if(n.dims.length!==1)throw new Error('Input "bias" is expected to have 1 dimension');if(s&&s.dims.length===5&&s.dims[3]===2)throw new Error("bias is not allowed for packed kv.")}let y=_+g,$=0;if(i&&xe.size(i.dims)>0){$=8;let T=i.dims;throw T.length===1?T[0]===p?$=1:T[0]===3*p+2&&($=3):T.length===2&&T[0]===p&&T[1]===y&&($=5),$===8?new Error('Input "key_padding_mask" shape shall be (batch_size) or (batch_size, total_sequence_length)'):new Error("Mask not supported")}let P=!1,b=h;if(o&&xe.size(o.dims)>0){if(o.dims.length!==3&&o.dims.length!==4)throw new Error('Input "value" is expected to have 3 or 4 dimensions');if(t.dims[0]!==o.dims[0])throw new Error('Input "query" and "value" shall have same dim 0 (batch_size)');if(o.dims.length===3){if(g!==o.dims[1])throw new Error('Input "key" and "value" shall have the same dim 1 (kv_sequence_length)');b=o.dims[2]}else{if(g!==o.dims[2])throw new Error('Input "key" and "value" shall have the same dim 2 (kv_sequence_length)');b=o.dims[1]*o.dims[3],P=!0}}let w=!1;if(i&&xe.size(i.dims)>0)throw new Error("Key padding mask is not supported");if(a&&xe.size(a.dims)>0){if(a.dims.length!==4)throw new Error('Input "attention_bias" is expected to have 4 dimensions');if(a.dims[0]!==p||a.dims[1]!==r.numHeads||a.dims[2]!==u||a.dims[3]!==y)throw new Error('Expect "attention_bias" shape (batch_size, num_heads, sequence_length, total_sequence_length)')}return{batchSize:p,sequenceLength:u,pastSequenceLength:_,kvSequenceLength:g,totalSequenceLength:y,maxSequenceLength:E,inputHiddenSize:0,hiddenSize:h,vHiddenSize:b,headSize:I,vHeadSize:Math.floor(b/r.numHeads),numHeads:r.numHeads,isUnidirectional:!1,pastPresentShareBuffer:!1,maskFilterValue:r.maskFilterValue,maskType:$,scale:r.scale,broadcastResPosBias:w,passPastInKv:P,qkvFormat:M}},A0=e=>Lt({...e}),Mc=Lt({perm:[0,2,1,3]}),Sg=(e,r,t,s,o,n,i)=>{let a=[s,o,n],l=xe.size(a),c=[{type:12,data:l},{type:12,data:i},{type:12,data:n}],p=u=>{let h=tt("qkv_with_bias",r.dataType,a),g=$e("qkv",r.dataType,a),_=$e("bias",t.dataType,a),E=[{name:"output_size",type:"u32"},{name:"bias_offset",type:"u32"},{name:"hidden_size",type:"u32"}];return` - ${u.registerUniforms(E).declareVariables(g,_,h)} - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let bias_offset_idx = (global_idx % uniforms.hidden_size) + uniforms.bias_offset; - - qkv_with_bias[global_idx] = qkv[global_idx] + bias[bias_offset_idx]; - }`};return e.compute({name:"MultiHeadAttentionAddBias",shaderCache:{inputDependencies:["type","type"]},getRunData:()=>({outputs:[{dims:a,dataType:r.dataType,gpuDataType:0}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:c}),getShaderSource:p},{inputs:[r,t],outputs:[-1]})[0]},ca=(e,r,t,s,o,n,i,a)=>{let l=n;if(i&&xe.size(i.dims)>0){if(s===1)throw new Error("AddBiasReshape is not implemented. Please export your model with packed QKV or KV");return l=Sg(e,n,i,r,s,t*o,a),l=l.reshape([r,s,t,o]),t===1||s===1?l:e.compute(Wr(l,Mc.perm),{inputs:[l],outputs:[-1]})[0]}else return n.dims.length===3&&(l=n.reshape([r,s,t,o])),t===1||s===1?l:e.compute(Wr(l,Mc.perm),{inputs:[l],outputs:[-1]})[0]},F0=(e,r)=>{let t=Cg(e.inputs,r),s=e.inputs[0],o=Fr(e.inputs,1),n=Fr(e.inputs,2),i=Fr(e.inputs,3),a=Fr(e.inputs,4),l=Fr(e.inputs,5),c=Fr(e.inputs,6),p=Fr(e.inputs,7);if(s.dims.length===5)throw new Error("Packed QKV is not implemented");if((o==null?void 0:o.dims.length)===5)throw new Error("Packed KV is not implemented");let u=o&&n&&o.dims.length===4&&n.dims.length===4,h=ca(e,t.batchSize,t.numHeads,t.sequenceLength,t.headSize,s,i,0);if(u)return ha(e,h,o,n,a,void 0,c,p,l,t);if(!o||!n)throw new Error("key and value must be provided");let g=ca(e,t.batchSize,t.numHeads,t.kvSequenceLength,t.headSize,o,i,t.hiddenSize),_=ca(e,t.batchSize,t.numHeads,t.kvSequenceLength,t.vHeadSize,n,i,2*t.hiddenSize);ha(e,h,g,_,a,void 0,c,p,l,t)}}),$g,kg,Ig,Ag,ru,D0,L0,z0=Ve(()=>{mt(),bt(),tr(),xt(),$g=e=>{if(!e||e.length<1)throw new Error("too few inputs")},kg=(e,r)=>{let t=[],s=r.numOutputs;return e[1].dims[0]>0&&(e[1].getBigInt64Array().forEach(o=>t.push(Number(o))),s=t.length),Lt({numOutputs:s,axis:r.axis,splitSizes:t})},Ig=e=>` -fn calculateOutputIndex(index: u32) -> u32 { - for (var i: u32 = 0u; i < ${e}u; i += 1u ) { - if (index < ${rt("uniforms.size_in_split_axis","i",e)}) { - return i; - } - } - return ${e}u; -}`,Ag=e=>{let r=e.length,t=[];for(let s=0;s{let t=e[0].dims,s=xe.size(t),o=e[0].dataType,n=xe.normalizeAxis(r.axis,t.length),i=new Array(r.numOutputs),a=$e("input",o,t.length),l=new Array(r.numOutputs),c=[],p=[],u=0,h=[{type:12,data:s}];for(let _=0;_` - ${_.registerUniform("input_size","u32").registerUniform("size_in_split_axis","u32",l.length).declareVariables(a,...i)} - ${Ig(l.length)} - ${Ag(i)} - - ${_.mainStart()} - ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.input_size")} - - var indices = ${a.offsetToIndices("global_idx")}; - var index = ${a.indicesGet("indices",n)}; - let output_number = calculateOutputIndex(index); - if (output_number != 0) { - index -= ${rt("uniforms.size_in_split_axis","output_number - 1u",l.length)}; - ${a.indicesSet("indices",n,"index")}; - } - writeBufferData(output_number, indices, global_idx); - }`;return{name:"Split",shaderCache:{hint:r.cacheKey,inputDependencies:["rank"]},getShaderSource:g,getRunData:()=>({outputs:c,dispatchGroup:{x:Math.ceil(s/64)},programUniforms:h})}},D0=(e,r)=>{$g(e.inputs);let t=e.inputs.length===1?r:kg(e.inputs,r);e.compute(ru(e.inputs,t),{inputs:[0]})},L0=e=>{let r=e.axis,t=e.splitSizes,s=e.numOutputs<0?t.length:e.numOutputs;if(s!==t.length)throw new Error("numOutputs and splitSizes lengh must be equal");return Lt({axis:r,numOutputs:s,splitSizes:t})}}),Fg,Og,bc,B0,Mx=Ve(()=>{tr(),bu(),O0(),z0(),cn(),Fg=(e,r)=>{if(r.doRotary)throw new Error("GroupQuerryAttention do_rotary attribute is not supported");if(r.doRotary&&e.length<=7)throw new Error("cos_cache and sin_cache inputs are required if do_rotary is specified");let t=e[0],s=e[1],o=e[2],n=e[3],i=e[4];if(r.localWindowSize!==-1)throw new Error("Local attention is not supported");if(r.softcap!==0)throw new Error("Softcap is not supported");if(r.rotaryInterleaved!==0)throw new Error("Rotary interleaved is not supported");if(r.smoothSoftmax)throw new Error("Smooth softmax is not supported");if(t.dims.length!==3&&t.dims.length!==5)throw new Error("Input query is expected to have 3 or 5 dimensions");let a=!1,l=t.dims[0],c=t.dims[1],p=t.dims.length===3?a?t.dims[2]/3:t.dims[2]:r.numHeads*t.dims[4],u=c,h=0,g=!s||s.dims.length===0,_=Math.floor(g?p/(r.numHeads+2*r.kvNumHeads):p/r.numHeads);g&&(p=_*r.numHeads);let E=n&&n.dims.length!==0,I=i&&i.dims.length!==0;if(E&&n.dims.length===4&&n.dims[0]===l&&n.dims[1]!==r.kvNumHeads&&n.dims[2]===r.kvNumHeads&&n.dims[3]===_)throw new Error("BSNH pastKey/pastValue is not supported");if(E&&I){if(n.dims.length!==4)throw new Error('Input "past_key" is expected to have 4 dimensions');if(i.dims.length!==4)throw new Error('Input "past_value" is expected to have 4 dimensions');h=n.dims[2]}else if(E||I)throw new Error('Input "past_key" and "past_value" shall be both present or both absent');let M=1;if(s&&s.dims.length>0){if(t.dims.length!==3)throw new Error('Input "query" is expected to have 3 dimensions when key is given');if(s.dims.length<3||s.dims.length>5)throw new Error('Input "key" is expected to have 3, 4, or 5 dimensions');if(t.dims[0]!==s.dims[0])throw new Error('Input "query" and "key" shall have same dim 0 (batch size)');if(s.dims.length===3){if(t.dims[2]%s.dims[2]!==0)throw new Error('Dimension 2 of "query" should be a multiple of "key"');u=s.dims[1]}else if(s.dims.length===5){if(s.dims[2]!==r.numHeads||s.dims[3]!==2||s.dims[4]!==_)throw new Error('Expect "key" shape (batch_size, kv_sequence_length, num_heads, 2, head_size) for packed kv');if(o)throw new Error('Expect "value" be none when "key" has packed kv format.');u=s.dims[1]}else{if(s.dims[1]!==r.numHeads||s.dims[3]!==_)throw new Error('Expect "key" shape (batch_size, num_heads, kv_sequence_length, head_size) for past_key');u=s.dims[2]}}else{if(t.dims.length!==3&&t.dims.length!==5)throw new Error('Input "query" is expected to have 3 or 5 dimensions when key is empty');if(t.dims.length===5&&(t.dims[2]!==r.numHeads||t.dims[3]!==3))throw new Error('Expect "query" shape (batch_size, kv_sequence_length, num_heads, 3, head_size) for packed kv');M=3}let y=0,$=!1,P=r.kvNumHeads?_*r.kvNumHeads:p;if(o&&o.dims.length>0){if(o.dims.length!==3&&o.dims.length!==4)throw new Error('Input "value" is expected to have 3 or 4 dimensions');if(t.dims[0]!==o.dims[0])throw new Error('Input "query" and "value" shall have same dim 0 (batch_size)');if(o.dims.length===3){if(u!==o.dims[1])throw new Error('Input "key" and "value" shall have the same dim 1 (kv_sequence_length)');P=o.dims[2]}else{if(u!==o.dims[2])throw new Error('Input "past_key" and "past_value" shall have the same dim 2 (kv_sequence_length)');P=o.dims[1]*o.dims[3],$=!0}}let b=e.length>4?e[5]:void 0;if(b&&b.dims.length!==1&&b.dims[0]!==l)throw new Error('Input "seqlens" is expected to have 1 dimension and the same dim 0 as batch_size');return{batchSize:l,sequenceLength:c,pastSequenceLength:h,kvSequenceLength:u,totalSequenceLength:-1,maxSequenceLength:-1,inputHiddenSize:0,hiddenSize:p,vHiddenSize:P,headSize:_,vHeadSize:Math.floor(P/r.kvNumHeads),numHeads:r.numHeads,kvNumHeads:r.kvNumHeads,nReps:r.numHeads/r.kvNumHeads,pastPresentShareBuffer:!1,maskType:y,scale:r.scale,broadcastResPosBias:!1,passPastInKv:$,qkvFormat:M}},Og=Lt({perm:[0,2,1,3]}),bc=(e,r,t)=>{let s=r,o=t.kvNumHeads;return r.dims.length===3&&t.kvSequenceLength!==0&&(s=r.reshape([t.batchSize,t.kvSequenceLength,o,t.headSize]),s=e.compute(Wr(s,Og.perm),{inputs:[s],outputs:[-1]})[0]),s},B0=(e,r)=>{var I;let t=Fg(e.inputs,r);if(e.inputs[0].dims.length===5)throw new Error("Packed QKV is not implemented");if(((I=e.inputs[1])==null?void 0:I.dims.length)===5)throw new Error("Packed KV is not implemented");let s=e.inputs[0],o=e.inputs[1]&&e.inputs[1].dims.length>0?e.inputs[1]:void 0,n=e.inputs[2]&&e.inputs[2].dims.length>0?e.inputs[2]:void 0,i=e.inputs[3]&&e.inputs[3].dims.length!==0?e.inputs[3]:void 0,a=e.inputs[4]&&e.inputs[4].dims.length!==0?e.inputs[4]:void 0,l=e.inputs.length>4?e.inputs[5]:void 0,c=e.inputs.length>5?e.inputs[6]:void 0,p=t.kvNumHeads?t.kvNumHeads:t.numHeads,u=Lt({axis:2,numOutputs:3,splitSizes:[t.numHeads*t.headSize,p*t.headSize,p*t.headSize]}),[h,g,_]=!o&&!n?e.compute(ru([s],u),{inputs:[s],outputs:[-1,-1,-1]}):[s,o,n],E=ca(e,t.batchSize,t.numHeads,t.sequenceLength,t.headSize,h,void 0,0);ha(e,E,bc(e,g,t),bc(e,_,t),void 0,void 0,i,a,void 0,t,l,c)}}),vc,Dg,Lg,R0,bx=Ve(()=>{mt(),bt(),cn(),xt(),vc=(e,r,t,s,o,n,i,a)=>{let l=Jt(n),c=l===1?"f32":`vec${l}f`,p=l===1?"vec2f":`mat2x${l}f`,u=o*i,h=64;u===1&&(h=256);let g=[o,i,n/l],_=[o,i,2],E=["rank","type","type"],I=[];I.push(...nt(g,_));let M=y=>{let $=$e("x",r.dataType,3,l),P=$e("scale",t.dataType,t.dims),b=$e("bias",s.dataType,s.dims),w=tt("output",1,3,2),T=[$,P,b,w];return` - var workgroup_shared : array<${p}, ${h}>; - const workgroup_size = ${h}u; - ${y.declareVariables(...T)} - ${y.mainStart(h)} - let batch = workgroup_index / uniforms.x_shape[1]; - let channel = workgroup_index % uniforms.x_shape[1]; - let hight = uniforms.x_shape[2]; - // initialize workgroup memory - var sum = ${c}(0); - var squared_sum = ${c}(0); - for (var h = local_idx; h < hight; h += workgroup_size) { - let value = ${c}(${$.get("batch","channel","h")}); - sum += value; - squared_sum += value * value; - } - workgroup_shared[local_idx] = ${p}(sum, squared_sum); - workgroupBarrier(); - - for (var currSize = workgroup_size >> 1; currSize > 0; currSize = currSize >> 1) { - if (local_idx < currSize) { - workgroup_shared[local_idx] = workgroup_shared[local_idx] + workgroup_shared[local_idx + currSize]; - } - workgroupBarrier(); - } - if (local_idx == 0) { - let sum_final = ${dn("workgroup_shared[0][0]",l)} / f32(hight * ${l}); - let squared_sum_final = ${dn("workgroup_shared[0][1]",l)} / f32(hight * ${l}); - - let inv_std_dev = inverseSqrt(squared_sum_final - sum_final * sum_final + f32(${a})); - let channel_scale = inv_std_dev * f32(scale[channel]); - let channel_shift = f32(bias[channel]) - sum_final * channel_scale; - output[workgroup_index] = vec2f(channel_scale, channel_shift); - } - }`};return e.compute({name:"InstanceNormComputeChannelScaleShift",shaderCache:{hint:`${l};${a};${h}`,inputDependencies:E},getRunData:()=>({outputs:[{dims:_,dataType:1}],dispatchGroup:{x:u},programUniforms:I}),getShaderSource:M},{inputs:[r,t,s],outputs:[-1]})[0]},Dg=(e,r,t)=>{let s=r[0].dims,o=s,n=2,i=s[0],a=s[1],l=xe.sizeFromDimension(s,n),c=Jt(l),p=xe.size(o)/c,u=vc(e,r[0],r[1],r[2],i,l,a,t.epsilon),h=[i,a,l/c],g=[i,a],_=["type","none"],E=I=>{let M=$e("x",r[0].dataType,h.length,c),y=$e("scale_shift",1,g.length,2),$=tt("output",r[0].dataType,h.length,c),P=[M,y,$];return` - ${I.registerUniform("output_size","u32").declareVariables(...P)} - ${I.mainStart()} - ${I.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let outputIndices = ${$.offsetToIndices("global_idx")}; - let batch = outputIndices[0]; - let channel = outputIndices[1]; - let scale_shift = ${y.getByIndices("vec2(batch, channel)")}; - let value = ${M.getByOffset("global_idx")} * ${$.type.value}(scale_shift.x) + ${$.type.value}(scale_shift.y); - ${$.setByOffset("global_idx","value")}; - }`};e.compute({name:"InstanceNormalization",shaderCache:{hint:`${c}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:o,dataType:r[0].dataType}],dispatchGroup:{x:Math.ceil(p/64)},programUniforms:[{type:12,data:p},...nt(h,g,h)]}),getShaderSource:E},{inputs:[r[0],u]})},Lg=(e,r,t)=>{let s=r[0].dims,o=s,n=s[0],i=s[s.length-1],a=xe.sizeFromDimension(s,1)/i,l=Jt(i),c=xe.size(o)/l,p=[{type:12,data:a},{type:12,data:Math.floor(i/l)}],u=["type","type"],h=!1,g=[0,s.length-1];for(let M=0;Ms[g[y]])),E=vc(e,_,r[1],r[2],n,a,i,t.epsilon),I=M=>{let y=pr(r[0].dataType),$=l===1?"vec2f":`mat${l}x2f`,P=T=>{let k=T===0?"x":"y",z=l===1?"f32":`vec${l}f`;switch(l){case 1:return`${y}(${z}(scale.${k}))`;case 2:return`vec2<${y}>(${z}(scale[0].${k}, scale[1].${k}))`;case 4:return`vec4<${y}>(${z}(scale[0].${k}, scale[1].${k}, scale[2].${k}, scale[3].${k}))`;default:throw new Error(`Not supported compoents ${l}`)}},b=$e("input",r[0].dataType,r[0].dims,l),w=tt("output",r[0].dataType,o,l);return` - @group(0) @binding(0) var input : array<${b.type.storage}>; - @group(0) @binding(1) var scale_input : array<${$}>; - @group(0) @binding(2) var output : array<${w.type.storage}>; - struct Uniforms {H: u32, C : u32}; - @group(0) @binding(3) var uniforms: Uniforms; - - ${M.mainStart()} - let current_image_number = global_idx / (uniforms.C * uniforms.H); - let current_channel_number = global_idx % uniforms.C; - - let scale_offset = current_image_number * uniforms.C + current_channel_number; - let scale = scale_input[scale_offset]; - output[global_idx] = fma(input[global_idx], ${P(0)}, ${P(1)}); - }`};e.compute({name:"InstanceNormalizationNHWC",shaderCache:{hint:`${l}`,inputDependencies:u},getRunData:()=>({outputs:[{dims:o,dataType:r[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:p}),getShaderSource:I},{inputs:[r[0],E]})},R0=(e,r)=>{r.format==="NHWC"?Lg(e,e.inputs,r):Dg(e,e.inputs,r)}}),zg,Bg,N0,vx=Ve(()=>{mt(),bt(),xt(),zg=e=>{if(!e||e.length<2)throw new Error("layerNorm requires at least 2 inputs.")},Bg=(e,r,t)=>{let s=r.simplified,o=e[0].dims,n=e[1],i=!s&&e[2],a=o,l=xe.normalizeAxis(r.axis,o.length),c=xe.sizeToDimension(o,l),p=xe.sizeFromDimension(o,l),u=xe.size(n.dims),h=i?xe.size(i.dims):0;if(u!==p||i&&h!==p)throw new Error(`Size of X.shape()[axis:] == ${p}. - Size of scale and bias (if provided) must match this. - Got scale size of ${u} and bias size of ${h}`);let g=[];for(let b=0;b1,y=t>2,$=b=>{let w=pr(e[0].dataType),T=[$e("x",e[0].dataType,e[0].dims,_),$e("scale",n.dataType,n.dims,_)];i&&T.push($e("bias",i.dataType,i.dims,_)),T.push(tt("output",e[0].dataType,a,_)),M&&T.push(tt("mean_data_output",1,g)),y&&T.push(tt("inv_std_output",1,g));let k=[{name:"norm_count",type:"u32"},{name:"norm_size",type:"f32"},{name:"norm_size_vectorized",type:"u32"},{name:"epsilon",type:"f32"}];return` - ${b.registerUniforms(k).declareVariables(...T)} - ${b.mainStart()} - ${b.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.norm_count")} - let offset = global_idx * uniforms.norm_size_vectorized; - var mean_vector = ${Hc("f32",_)}; - var mean_square_vector = ${Hc("f32",_)}; - - for (var h: u32 = 0u; h < uniforms.norm_size_vectorized; h++) { - let value = ${Co(w,_,"x[h + offset]")}; - mean_vector += value; - mean_square_vector += value * value; - } - let mean = ${dn("mean_vector",_)} / uniforms.norm_size; - let inv_std_dev = inverseSqrt(${dn("mean_square_vector",_)} / uniforms.norm_size ${s?"":"- mean * mean"} + uniforms.epsilon); - - for (var j: u32 = 0; j < uniforms.norm_size_vectorized; j++) { - let f32input = ${Co(w,_,"x[j + offset]")}; - let f32scale = ${Co(w,_,"scale[j]")}; - output[j + offset] = ${T[0].type.value}((f32input ${s?"":"- mean"}) * inv_std_dev * f32scale - ${i?`+ ${Co(w,_,"bias[j]")}`:""} - ); - } - - ${M?"mean_data_output[global_idx] = mean":""}; - ${y?"inv_std_output[global_idx] = inv_std_dev":""}; - }`},P=[{dims:a,dataType:e[0].dataType}];return M&&P.push({dims:g,dataType:1}),y&&P.push({dims:g,dataType:1}),{name:"LayerNormalization",shaderCache:{hint:`${_};${t};${s}`,inputDependencies:E},getRunData:()=>({outputs:P,dispatchGroup:{x:Math.ceil(c/64)},programUniforms:I}),getShaderSource:$}},N0=(e,r)=>{zg(e.inputs),e.compute(Bg(e.inputs,r,e.outputCount))}}),Rg,j0,xx=Ve(()=>{bt(),Pu(),Cu(),Rg=e=>{if(!e||e.length!==2)throw new Error("MatMul requires 2 inputs.");if(e[0].dims[e[0].dims.length-1]!==e[1].dims[e[1].dims.length-2])throw new Error("shared dimension does not match.")},j0=e=>{Rg(e.inputs);let r=So.calcShape(e.inputs[0].dims,e.inputs[1].dims,!0);if(!r)throw new Error("Can't use matmul on the given tensors");let t=r[r.length-1],s=e.inputs[0].dims[e.inputs[0].dims.length-1];if(t<8&&s<8)e.compute(Eu(e.inputs,{activation:""},r));else{let o=r[r.length-2],n=xe.size(e.inputs[0].dims.slice(0,-2)),i=xe.size(e.inputs[1].dims.slice(0,-2));if(n!==1&&o===1&&i===1){let a=e.inputs[0].reshape([1,n,s]),l=e.inputs[1].reshape([1,s,t]),c=[1,n,t],p=[a,l];e.compute(ad(p,{activation:""},r,c),{inputs:p})}else e.compute(ad(e.inputs,{activation:""},r))}}}),Ng,jg,Vg,V0,U0,Tx=Ve(()=>{mt(),bt(),tr(),xt(),Ng=(e,r)=>{if(e.length<3||e.length>4)throw new Error("MatMulNBits requires 3 or 4 inputs");let t=e[0],s=t.dims.length;if(t.dims[s-1]!==r.k)throw new Error("The last dim of input shape does not match the k value");let o=Math.floor((r.k+r.blockSize-1)/r.blockSize),n=r.blockSize/8*r.bits,i=e[1];if(!xe.areEqual(i.dims,[r.n,o,n]))throw new Error("The second inputs must be 3D tensor with shape N X nBlocksPerCol X blobSize");let a=e[2].dims;if(xe.size(a)!==r.n*o)throw new Error("scales input size error.");if(e.length===4){let l=e[3].dims,c=r.bits>4?r.n*o:r.n*Math.floor((o+1)/2);if(xe.size(l)!==c)throw new Error("zeroPoints input size error.")}},jg=(e,r)=>{let t=e[0].dims,s=t.length,o=t[s-2],n=r.k,i=r.n,a=t.slice(0,s-2),l=xe.size(a),c=e[1].dims[2]/4,p=e[0].dataType,u=Jt(r.k),h=Jt(c),g=Jt(i),_=a.concat([o,i]),E=o>1&&i/g%2===0?2:1,I=xe.size(_)/g/E,M=64,y=[],$=[l,o,n/u],P=xe.convertShape(e[1].dims).slice();P.splice(-1,1,c/h),y.push(...nt($)),y.push(...nt(P)),y.push(...nt(e[2].dims)),e.length===4&&y.push(...nt(xe.convertShape(e[3].dims)));let b=[l,o,i/g];y.push(...nt(b));let w=T=>{let k=$.length,z=$e("a",e[0].dataType,k,u),R=$e("b",12,P.length,h),Q=$e("scales",e[2].dataType,e[2].dims.length),q=[z,R,Q],U=e.length===4?$e("zero_points",12,e[3].dims.length):void 0;U&&q.push(U);let Z=b.length,H=tt("output",e[0].dataType,Z,g),J=pr(e[0].dataType),oe=(()=>{switch(u){case 1:return`array<${J}, 8>`;case 2:return`mat4x2<${J}>`;case 4:return`mat2x4<${J}>`;default:throw new Error(`${u}-component is not supported.`)}})(),ae=()=>{let N=` - // reuse a data - var input_offset = ${z.indicesToOffset(`${z.type.indices}(batch, row, word_offset)`)}; - var a_data: ${oe}; - for (var j: u32 = 0; j < ${8/u}; j++) { - a_data[j] = ${z.getByOffset("input_offset")}; - input_offset++; - } - `;for(let O=0;O> 4) & b_mask); - b_quantized_values = ${oe}(${Array.from({length:4},(G,se)=>`${J}(b_value_lower[${se}]), ${J}(b_value_upper[${se}])`).join(", ")}); - b_dequantized_values = ${u===1?`${oe}(${Array.from({length:8},(G,se)=>`(b_quantized_values[${se}] - ${U?`zero_point${O}`:"zero_point"}) * scale${O}`).join(", ")});`:`(b_quantized_values - ${oe}(${Array(8).fill(`${U?`zero_point${O}`:"zero_point"}`).join(",")})) * scale${O};`}; - workgroup_shared[local_id.x * ${E} + ${Math.floor(O/g)}]${g>1?`[${O%g}]`:""} += ${Array.from({length:8/u},(G,se)=>`${u===1?`a_data[${se}] * b_dequantized_values[${se}]`:`dot(a_data[${se}], b_dequantized_values[${se}])`}`).join(" + ")}; - `;return N},ce=()=>{let N=` - var col_index = col * ${g}; - ${U?` - let zero_point_bytes_per_col = (nBlocksPerCol + 1) / 2; - var zero_point_byte_count: u32; - var zero_point_word_index: u32; - var zero_point_byte_offset: u32; - let zero_point_nibble_offset: u32 = block & 0x1u; - var zero_point_bits_offset: u32; - var zero_point_word: u32;`:` - // The default zero point is 8 for unsigned 4-bit quantization. - let zero_point = ${J}(8);`} - `;for(let O=0;O> 0x1u); - zero_point_word_index = zero_point_byte_count >> 0x2u; - zero_point_byte_offset = zero_point_byte_count & 0x3u; - zero_point_bits_offset = (zero_point_byte_offset << 3) + (zero_point_nibble_offset << 2); - zero_point_word = ${U.getByOffset("zero_point_word_index")} >> zero_point_bits_offset; - let zero_point${O} = ${J}((zero_point_word) & 0xFu);`:""} - col_index += 1;`;return N},he=()=>{let N=`col_index = col * ${g};`;for(let O=0;O; - var b_value_upper: vec4; - var b_quantized_values: ${oe}; - var b_dequantized_values: ${oe};`,N};return` - var workgroup_shared: array<${H.type.value}, ${E*M}>; - ${T.declareVariables(...q,H)} - ${T.mainStart([M,1,1])} - let output_indices = ${H.offsetToIndices(`(global_idx / ${M}) * ${E}`)}; - let col = output_indices[2]; - let row = output_indices[1]; - let batch = output_indices[0]; - let nBlocksPerCol = uniforms.b_shape[1]; - - for (var block = local_id.x; block < nBlocksPerCol; block += ${M}) { - //process one block - var word_offset: u32 = block * ${r.blockSize/u}; - ${ce()} - for (var word: u32 = 0; word < ${c}; word += ${h}) { - ${he()} - for (var i: u32 = 0; i < ${h}; i++) { - ${ae()} - word_offset += ${8/u}; - } - } - } - workgroupBarrier(); - - if (local_id.x < ${E}) { - var output_value: ${H.type.value} = ${H.type.value}(0); - var workgroup_shared_offset: u32 = local_id.x; - for (var b: u32 = 0u; b < ${M}u; b++) { - output_value += workgroup_shared[workgroup_shared_offset]; - workgroup_shared_offset += ${E}; - } - ${H.setByIndices(`${H.type.indices}(batch, row, col + local_id.x)`,"output_value")}; - } - }`};return{name:"MatMulNBits",shaderCache:{hint:`${r.blockSize};${r.bits};${u};${h};${g};${E};${M}`,inputDependencies:Array(e.length).fill("rank")},getRunData:()=>({outputs:[{dims:_,dataType:p}],dispatchGroup:{x:I},programUniforms:y}),getShaderSource:w}},Vg=(e,r)=>{let t=e[0].dims,s=t.length,o=t[s-2],n=r.k,i=r.n,a=t.slice(0,s-2),l=xe.size(a),c=e[1].dims[2]/4,p=e[0].dataType,u=Jt(r.k),h=Jt(c),g=a.concat([o,i]),_=128,E=i%8===0?8:i%4===0?4:1,I=_/E,M=I*h*8,y=M/u,$=M/r.blockSize,P=xe.size(g)/E,b=[],w=[l,o,n/u],T=xe.convertShape(e[1].dims).slice();T.splice(-1,1,c/h),b.push(...nt(w)),b.push(...nt(T)),b.push(...nt(e[2].dims)),e.length===4&&b.push(...nt(xe.convertShape(e[3].dims)));let k=[l,o,i];b.push(...nt(k));let z=R=>{let Q=w.length,q=$e("a",e[0].dataType,Q,u),U=$e("b",12,T.length,h),Z=$e("scales",e[2].dataType,e[2].dims.length),H=[q,U,Z],J=e.length===4?$e("zero_points",12,e[3].dims.length):void 0;J&&H.push(J);let oe=k.length,ae=tt("output",e[0].dataType,oe),ce=pr(e[0].dataType),he=()=>{switch(u){case 1:return` - let a_data0 = vec4<${ce}>(sub_a[word_offset], sub_a[word_offset + 1], sub_a[word_offset + 2], sub_a[word_offset + 3]); - let a_data1 = vec4<${ce}>(sub_a[word_offset + 4], sub_a[word_offset + 5], sub_a[word_offset + 6], sub_a[word_offset + 7]);`;case 2:return` - let a_data0 = vec4<${ce}>(sub_a[word_offset], sub_a[word_offset + 1]); - let a_data1 = vec4<${ce}>(sub_a[word_offset + 2], sub_a[word_offset + 3]);`;case 4:return` - let a_data0 = sub_a[word_offset]; - let a_data1 = sub_a[word_offset + 1];`;default:throw new Error(`${u}-component is not supported.`)}};return` - var sub_a: array<${q.type.value}, ${y}>; - var inter_results: array, ${E}>; - ${R.declareVariables(...H,ae)} - ${R.mainStart([I,E,1])} - let output_indices = ${ae.offsetToIndices(`workgroup_index * ${E}`)}; - let col = output_indices[2]; - let row = output_indices[1]; - let batch = output_indices[0]; - let n_blocks_per_col = uniforms.b_shape[1]; - let num_tiles = (n_blocks_per_col - 1) / ${$} + 1; - - // Loop over shared dimension. - for (var tile: u32 = 0; tile < num_tiles; tile += 1) { - let a_col_start = tile * ${y}; - // load one tile A data into shared memory. - for (var a_offset = local_idx; a_offset < ${y}; a_offset += ${_}) - { - let a_col = a_col_start + a_offset; - if (a_col < uniforms.a_shape[2]) - { - sub_a[a_offset] = ${q.getByIndices(`${q.type.indices}(batch, row, a_col)`)}; - } else { - sub_a[a_offset] = ${q.type.value}(0); - } - } - workgroupBarrier(); - - // each thread process one block - let b_row = col + local_id.y; - let block = tile * ${$} + local_id.x; - ${J?` - let zero_point_bytes_per_col = (n_blocks_per_col + 1) / 2; - let zero_point_byte_count = b_row * zero_point_bytes_per_col + (block >> 0x1u); - let zero_point_word_index = zero_point_byte_count >> 0x2u; - let zero_point_byte_offset = zero_point_byte_count & 0x3u; - let zero_point_nibble_offset: u32 = block & 0x1u; - let zero_point_bits_offset = (zero_point_byte_offset << 3) + (zero_point_nibble_offset << 2); - let zero_point_word = ${J.getByOffset("zero_point_word_index")} >> zero_point_bits_offset; - let zero_point = ${ce}((zero_point_word) & 0xFu);`:` - // The default zero point is 8 for unsigned 4-bit quantization. - let zero_point = ${ce}(8);`} - let scale = ${Z.getByOffset("b_row * n_blocks_per_col + block")}; - let b_data = ${U.getByIndices(`${U.type.indices}(b_row, block, 0)`)}; - var word_offset = local_id.x * ${r.blockSize/u}; - for (var i: u32 = 0; i < ${h}; i++) { - ${he()} - let b_value = ${h===1?"b_data":"b_data[i]"}; - let b_value_lower = unpack4xU8(b_value & 0x0F0F0F0Fu); - let b_value_upper = unpack4xU8((b_value >> 4) & 0x0F0F0F0Fu); - let b_quantized_values = mat2x4<${ce}>(${Array.from({length:4},(N,O)=>`${ce}(b_value_lower[${O}]), ${ce}(b_value_upper[${O}])`).join(", ")}); - let b_dequantized_values = (b_quantized_values - mat2x4<${ce}>(${Array(8).fill("zero_point").join(",")})) * scale; - inter_results[local_id.y][local_id.x] += ${Array.from({length:2},(N,O)=>`${`dot(a_data${O}, b_dequantized_values[${O}])`}`).join(" + ")}; - word_offset += ${8/u}; - } - workgroupBarrier(); - } - - if (local_idx < ${E}) { - var output_value: ${ae.type.value} = ${ae.type.value}(0); - for (var b = 0u; b < ${I}; b++) { - output_value += inter_results[local_idx][b]; - } - if (col + local_idx < uniforms.output_shape[2]) - { - ${ae.setByIndices(`${ae.type.indices}(batch, row, col + local_idx)`,"output_value")} - } - } - }`};return{name:"BlockwiseMatMulNBits32",shaderCache:{hint:`${r.blockSize};${u};${h};${I};${E}`,inputDependencies:Array(e.length).fill("rank")},getRunData:()=>({outputs:[{dims:g,dataType:p}],dispatchGroup:{x:P},programUniforms:b}),getShaderSource:z}},V0=(e,r)=>{Ng(e.inputs,r),r.blockSize===32&&e.adapterInfo.isVendor("intel")&&e.adapterInfo.isArchitecture("gen-12lp")?e.compute(Vg(e.inputs,r)):e.compute(jg(e.inputs,r))},U0=e=>Lt(e)}),Ug,Wg,Gg,Kg,Hg,qg,Qg,Xg,W0,Ex=Ve(()=>{mt(),bt(),xt(),Ug=e=>{if(!e||e.length<1)throw new Error("Too few inputs");if(e[0].dataType!==1&&e[0].dataType!==10)throw new Error("Input type must be float or float16.");if(e.length>=2){let r=e[0].dims.length*2===e[1].dims[0];if(e.length===4&&(r=e[3].dims[0]*2===e[1].dims[0]),!r)throw new Error("The pads should be a 1D tensor of shape [2 * input_rank] or [2 * num_axes].")}},Wg=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` - k = i32(${e.indicesGet("indices",o)}) - ${rt("uniforms.pads",o,t)}; - if (k < 0) { - break; - } - if (k >= i32(${rt("uniforms.x_shape",o,r)})) { - break; - } - offset += k * i32(${rt("uniforms.x_strides",o,r)}); - `;return` - value = ${e.type.value}(uniforms.constant_value); - for (var i = 0; i < 1; i++) { - var offset = 0; - var k = 0; - ${s} - value = x[offset]; - } - `},Gg=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` - k = i32(${e.indicesGet("indices",o)}) - ${rt("uniforms.pads",o,t)}; - if (k < 0) { - k = -k; - } - { - let _2n_1 = 2 * (i32(${rt("uniforms.x_shape",o,r)}) - 1); - k = k % _2n_1; - if(k >= i32(${rt("uniforms.x_shape",o,r)})) { - k = _2n_1 - k; - } - } - offset += k * i32(${rt("uniforms.x_strides",o,r)}); - `;return` - var offset = 0; - var k = 0; - ${s} - value = x[offset]; - `},Kg=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` - k = i32(${e.indicesGet("indices",o)}) - ${rt("uniforms.pads",o,t)}; - if (k < 0) { - k = 0; - } - if (k >= i32(${rt("uniforms.x_shape",o,r)})) { - k = i32(${rt("uniforms.x_shape",o,r)}) - 1; - } - offset += k * i32(${rt("uniforms.x_strides",o,r)}); - `;return` - var offset = 0; - var k = 0; - ${s} - value = x[offset]; - `},Hg=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` - k = i32(${e.indicesGet("indices",o)}) - ${rt("uniforms.pads",o,t)}; - if (k < 0) { - k += i32(${rt("uniforms.x_shape",o,r)}]); - } - if (k >= i32(${rt("uniforms.x_shape",o,r)})) { - k -= i32(${rt("uniforms.x_shape",o,r)}); - } - offset += k * i32(${rt("uniforms.x_strides",o,r)}); - `;return` - var offset = 0; - var k = 0; - ${s} - value = x[offset]; - `},qg=(e,r,t)=>{switch(t.mode){case 0:return Wg(e,r,t.pads.length);case 1:return Gg(e,r,t.pads.length);case 2:return Kg(e,r,t.pads.length);case 3:return Hg(e,r,t.pads.length);default:throw new Error("Invalid mode")}},Qg=(e,r)=>{let t=xe.padShape(e[0].dims.slice(),r.pads),s=e[0].dims,o=xe.size(t),n=[{type:12,data:o},{type:6,data:r.pads}],i=e.length>=3&&e[2].data;r.mode===0&&n.push({type:i?e[2].dataType:1,data:r.value}),n.push(...nt(e[0].dims,t));let a=["rank"],l=c=>{let p=tt("output",e[0].dataType,t.length),u=$e("x",e[0].dataType,s.length),h=u.type.value,g=qg(p,s.length,r),_=[{name:"output_size",type:"u32"},{name:"pads",type:"i32",length:r.pads.length}];return r.mode===0&&_.push({name:"constant_value",type:i?h:"f32"}),` - ${c.registerUniforms(_).declareVariables(u,p)} - ${c.mainStart()} - ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let indices = ${p.offsetToIndices("global_idx")}; - - var value = ${h}(0); - ${g} - output[global_idx] = value; - }`};return{name:"Pad",shaderCache:{hint:`${r.mode}${i}`,inputDependencies:a},getRunData:()=>({outputs:[{dims:t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(xe.size(t)/64)},programUniforms:n}),getShaderSource:l}},Xg=(e,r)=>{if(e.length>1){let t=e[1].getBigInt64Array(),s=e.length>=3&&e[2].data?e[2].dataType===10?e[2].getUint16Array()[0]:e[2].getFloat32Array()[0]:0,o=e[0].dims.length,n=new Int32Array(2*o).fill(0);if(e.length>=4){let a=e[3].getBigInt64Array();for(let l=0;ln[Number(l)]=Number(a));let i=[];return n.forEach(a=>i.push(a)),{mode:r.mode,value:s,pads:i}}else return r},W0=(e,r)=>{Ug(e.inputs);let t=Xg(e.inputs,r);e.compute(Qg(e.inputs,t),{inputs:[0]})}}),sa,xc,Tc,Ec,Pc,Jg,Yg,Cc,Sc,G0,K0,$c,H0,q0,kc,Q0,X0,J0,Y0,Px=Ve(()=>{Ms(),mt(),bt(),xt(),sa=e=>{if(Kt.webgpu.validateInputContent&&(!e||e.length!==1))throw new Error("Pool ops requires 1 input.")},xc=(e,r,t)=>{let s=r.format==="NHWC",o=e.dims.slice();s&&o.splice(1,0,o.pop());let n=Object.hasOwnProperty.call(r,"dilations"),i=r.kernelShape.slice(),a=r.strides.slice(),l=n?r.dilations.slice():[],c=r.pads.slice();od.adjustPoolAttributes(t,o,i,a,l,c);let p=od.computePoolOutputShape(t,o,a,l,i,c,r.autoPad),u=Object.assign({},r);n?Object.assign(u,{kernelShape:i,strides:a,pads:c,dilations:l,cacheKey:r.cacheKey}):Object.assign(u,{kernelShape:i,strides:a,pads:c,cacheKey:r.cacheKey});let h=p.slice();return h.push(h.splice(1,1)[0]),[u,s?h:p]},Tc=(e,r)=>{let t=r.format==="NHWC",s=xe.size(e),o=xe.size(r.kernelShape),n=[{type:12,data:s},{type:12,data:o}],i=[{name:"outputSize",type:"u32"},{name:"kernelSize",type:"u32"}];if(r.kernelShape.length<=2){let a=r.kernelShape[r.kernelShape.length-1],l=r.strides[r.strides.length-1],c=r.pads[r.pads.length/2-1],p=r.pads[r.pads.length-1],u=!!(c+p);n.push({type:12,data:a},{type:12,data:l},{type:12,data:c},{type:12,data:p}),i.push({name:"kw",type:"u32"},{name:"sw",type:"u32"},{name:"pwStart",type:"u32"},{name:"pwEnd",type:"u32"});let h=!1;if(r.kernelShape.length===2){let g=r.kernelShape[r.kernelShape.length-2],_=r.strides[r.strides.length-2],E=r.pads[r.pads.length/2-2],I=r.pads[r.pads.length-2];h=!!(E+I),n.push({type:12,data:g},{type:12,data:_},{type:12,data:E},{type:12,data:I}),i.push({name:"kh",type:"u32"},{name:"sh",type:"u32"},{name:"phStart",type:"u32"},{name:"phEnd",type:"u32"})}return[n,i,!0,u,h]}else{if(t)throw new Error("Pooling with kernelShape.length > 2 is not supported for NHWC format.");let a=xe.computeStrides(r.kernelShape);n.push({type:12,data:a},{type:12,data:r.pads},{type:12,data:r.strides}),i.push({name:"kernelStrides",type:"u32",length:a.length},{name:"pads",type:"u32",length:r.pads.length},{name:"strides",type:"u32",length:r.strides.length});let l=r.pads.reduce((c,p)=>c+p);return[n,i,!!l,!1,!1]}},Ec=(e,r,t,s,o,n,i,a,l,c,p,u)=>{let h=o.format==="NHWC",g=r.type.value,_=tt("output",r.type.tensor,s);if(o.kernelShape.length<=2){let E="",I="",M="",y=t-(h?2:1);if(p?E=` - for (var i: u32 = 0u; i < uniforms.kw; i++) { - xIndices[${y}] = indices[${y}] * uniforms.sw - uniforms.pwStart + i; - if (xIndices[${y}] < 0 || xIndices[${y}] - >= uniforms.x_shape[${y}]) { - pad++; - continue; - } - let x_val = x[${r.indicesToOffset("xIndices")}]; - ${n} - }`:E=` - for (var i: u32 = 0u; i < uniforms.kw; i++) { - xIndices[${y}] = indices[${y}] * uniforms.sw - uniforms.pwStart + i; - let x_val = x[${r.indicesToOffset("xIndices")}]; - ${n} - }`,o.kernelShape.length===2){let $=t-(h?3:2);u?I=` - for (var j: u32 = 0u; j < uniforms.kh; j++) { - xIndices[${$}] = indices[${$}] * uniforms.sh - uniforms.phStart + j; - if (xIndices[${$}] < 0 || xIndices[${$}] >= uniforms.x_shape[${$}]) { - pad += i32(uniforms.kw); - continue; - } - `:I=` - for (var j: u32 = 0u; j < uniforms.kh; j++) { - xIndices[${$}] = indices[${$}] * uniforms.sh - uniforms.phStart + j; - `,M=` - } - `}return` - ${e.registerUniforms(l).declareVariables(r,_)} - - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - - let indices = ${_.offsetToIndices("global_idx")}; - var xIndices = ${_.offsetToIndices("global_idx")}; - - var value = ${g}(${a}); - var pad = 0; - ${I} - ${E} - ${M} - ${i} - - output[global_idx] = value; - }`}else{if(h)throw new Error("Pooling with kernelShape.length > 2 is not supported for NHWC format.");let E=o.kernelShape.length,I=o.pads.length,M="";return c?M=` - if (xIndices[j] >= uniforms.x_shape[j]) { - pad++; - isPad = true; - break; - } - } - if (!isPad) { - let x_val = x[${r.indicesToOffset("xIndices")}]; - ${n} - }`:M=` - } - let x_val = x[${r.indicesToOffset("xIndices")}]; - ${n} - `,` - ${e.registerUniforms(l).declareVariables(r,_)} - - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - let indices = ${_.offsetToIndices("global_idx")}; - var xIndices = ${_.offsetToIndices("global_idx")}; - - var offsets: array; - - var value = ${g}(${a}); - var pad = 0; - var isPad = false; - - for (var i: u32 = 0u; i < uniforms.kernelSize; i++) { - var offset = i; - for (var j = 0u; j < ${E-1}u; j++) { - offsets[j] = offset / ${rt("uniforms.kernelStrides","j",E)}; - offset -= offsets[j] * ${rt("uniforms.kernelStrides","j",E)}; - } - offsets[${E-1}] = offset; - - isPad = false; - for (var j = ${t-E}u; j < ${t}u; j++) { - xIndices[j] = indices[j] * ${rt("uniforms.strides",`j - ${t-E}u`,E)} - + offsets[j - ${t-E}u] - ${rt("uniforms.pads","j - 2u",I)}; - ${M} - } - ${i} - - output[global_idx] = value; - }`}},Pc=e=>`${e.format};${e.ceilMode};${e.autoPad};${e.kernelShape.length}`,Jg=e=>`${Pc(e)};${e.countIncludePad}`,Yg=e=>`${Pc(e)};${e.storageOrder};${e.dilations}`,Cc=e=>({format:e.format,autoPad:["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][e.auto_pad],ceilMode:e.ceil_mode,kernelShape:e.kernel_shape,strides:e.strides,pads:e.pads}),Sc=(e,r,t,s)=>{let[o,n]=xc(r,s,t),i=$e("x",r.dataType,r.dims.length),a=i.type.value,l="value += x_val;",c="";o.countIncludePad?c+=`value /= ${a}(uniforms.kernelSize);`:c+=`value /= ${a}(i32(uniforms.kernelSize) - pad);`;let[p,u,h,g,_]=Tc(n,o);p.push(...nt(r.dims,n));let E=["rank"];return{name:e,shaderCache:{hint:`${s.cacheKey};${h};${g};${_}`,inputDependencies:E},getRunData:()=>({outputs:[{dims:n,dataType:r.dataType}],dispatchGroup:{x:Math.ceil(xe.size(n)/64)},programUniforms:p}),getShaderSource:I=>Ec(I,i,r.dims.length,n.length,o,l,c,0,u,h,g,_)}},G0=e=>{let r=e.count_include_pad!==0,t=Cc(e);if(t.ceilMode!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");let s={countIncludePad:r,...t,cacheKey:""};return{...s,cacheKey:Jg(s)}},K0=(e,r)=>{sa(e.inputs),e.compute(Sc("AveragePool",e.inputs[0],!1,r))},$c={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[]},H0=e=>{let r=e.format;return{format:r,...$c,cacheKey:r}},q0=(e,r)=>{sa(e.inputs),e.compute(Sc("GlobalAveragePool",e.inputs[0],!0,r))},kc=(e,r,t,s)=>{let[o,n]=xc(r,s,t),i=` - value = max(x_val, value); - `,a="",l=$e("x",r.dataType,r.dims.length),c=["rank"],[p,u,h,g,_]=Tc(n,o);return p.push(...nt(r.dims,n)),{name:e,shaderCache:{hint:`${s.cacheKey};${h};${g};${_}`,inputDependencies:c},getRunData:()=>({outputs:[{dims:n,dataType:r.dataType}],dispatchGroup:{x:Math.ceil(xe.size(n)/64)},programUniforms:p}),getShaderSource:E=>Ec(E,l,r.dims.length,n.length,o,i,a,r.dataType===10?-65504:-1e5,u,h,g,_)}},Q0=(e,r)=>{sa(e.inputs),e.compute(kc("MaxPool",e.inputs[0],!1,r))},X0=e=>{let r=e.storage_order,t=e.dilations,s=Cc(e);if(r!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(s.ceilMode!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");let o={storageOrder:r,dilations:t,...s,cacheKey:""};return{...o,cacheKey:Yg(o)}},J0=e=>{let r=e.format;return{format:r,...$c,cacheKey:r}},Y0=(e,r)=>{sa(e.inputs),e.compute(kc("GlobalMaxPool",e.inputs[0],!0,r))}}),Zg,ew,Z0,eb,Cx=Ve(()=>{mt(),bt(),tr(),xt(),Zg=(e,r)=>{if(e.length<2||e.length>3)throw new Error("DequantizeLinear requires 2 or 3 inputs.");if(e.length===3&&e[1].dims===e[2].dims)throw new Error("x-scale and x-zero-point must have the same shape.");if(e.length===3&&e[0].dataType!==e[2].dataType)throw new Error("x and x-zero-point must have the same data type.");if(e[0].dataType===6&&e.length>2)throw new Error("In the case of dequantizing int32 there is no zero point.");if(e[1].dims.length!==0&&e[1].dims.length!==1&&e[1].dims.length!==e[0].dims.length)throw new Error("scale input must be a scalar, a 1D tensor, or have the same rank as the input tensor.");if(e.length>2){if(e[0].dataType!==e[2].dataType)throw new Error("x and x-zero-point must have the same data type.");if(e[1].dims.length!==e[2].dims.length)throw new Error("scale and zero-point inputs must have the same rank.");if(!e[1].dims.map((t,s)=>t===e[2].dims[s]).reduce((t,s)=>t&&s,!0))throw new Error("scale and zero-point inputs must have the same shape.")}if(r.blockSize>0){if(e[1].dims.length===0||e[1].dims.length===1&&e[1].dims[0]===1)throw new Error("blockSize must be set only for block quantization.");if(!e[1].dims.map((o,n)=>n===r.axis||o===e[0].dims[n]).reduce((o,n)=>o&&n,!0))throw new Error("For block qunatization, scale input shape to match the input shape except for the axis");if(e[1].dims.length!==e[0].dims.length)throw new Error("For block qunatization the scale input rank must be the same as the x rank.");let t=e[0].dims[r.axis],s=e[1].dims[r.axis];if(r.blockSizeMath.ceil(t/(s-1)-1))throw new Error("blockSize must be with in the range [ceil(dI / Si), ceil(dI / (Si - 1) - 1)].")}},ew=(e,r)=>{let t=xe.normalizeAxis(r.axis,e[0].dims.length),s=e[0].dataType,o=s===3,n=e[0].dims,i=e[1].dataType,a=xe.size(n),l=s===3||s===2,c=l?[Math.ceil(xe.size(e[0].dims)/4)]:e[0].dims,p=e[1].dims,u=e.length>2?e[2]:void 0,h=u?l?[Math.ceil(xe.size(u.dims)/4)]:u.dims:void 0,g=p.length===0||p.length===1&&p[0]===1,_=g===!1&&p.length===1,E=Jt(a),I=g&&(!l||E===4),M=I?E:1,y=I&&!l?E:1,$=$e("input",l?12:s,c.length,y),P=$e("scale",i,p.length),b=u?$e("zero_point",l?12:s,h.length):void 0,w=tt("output",i,n.length,M),T=[$,P];b&&T.push(b);let k=[c,p];u&&k.push(h);let z=[{type:12,data:a/M},{type:12,data:t},{type:12,data:r.blockSize},...nt(...k,n)],R=Q=>{let q=[{name:"output_size",type:"u32"},{name:"axis",type:"u32"},{name:"block_size",type:"u32"}];return` - ${Q.registerUniforms(q).declareVariables(...T,w)} - ${Q.mainStart()} - ${Q.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let output_indices = ${w.offsetToIndices("global_idx")}; - - // Set input x - ${l?` - let input = ${$.getByOffset("global_idx / 4")}; - let x_vec = ${o?"unpack4xI8(input)":"unpack4xU8(input)"}; - let x_value = ${M===1?"x_vec[global_idx % 4]":"x_vec"};`:`let x_value = ${$.getByOffset("global_idx")};`}; - - // Set scale input - ${g?`let scale_value= ${P.getByOffset("0")}`:_?` - let scale_index = ${w.indicesGet("output_indices","uniforms.axis")}; - let scale_value= ${P.getByOffset("scale_index")};`:` - var scale_indices: ${P.type.indices} = output_indices; - let index = ${P.indicesGet("scale_indices","uniforms.axis")} / uniforms.block_size; - ${P.indicesSet("scale_indices","uniforms.axis","index")}; - let scale_value= ${P.getByIndices("scale_indices")};`}; - - // Set zero-point input - ${b?g?l?` - let zero_point_input = ${b.getByOffset("0")}; - let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; - let zero_point_value= zero_point_vec[0]`:`let zero_point_value = ${b.getByOffset("0")}`:_?l?` - let zero_point_index = ${w.indicesGet("output_indices","uniforms.axis")}; - let zero_point_input = ${b.getByOffset("zero_point_index / 4")}; - let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; - let zero_point_value = zero_point_vec[zero_point_index % 4]`:` - let zero_point_index = ${w.indicesGet("output_indices","uniforms.axis")}; - let zero_point_value = ${b.getByOffset("zero_point_index")};`:l?` - let zero_point_offset = ${P.indicesToOffset("scale_indices")}; - let zero_point_input = ${b.getByOffset("zero_point_offset / 4")}; - let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; - let zero_point_value = zero_point_vec[zero_point_offset % 4];`:`let zero_point_value = ${b.getByIndices("scale_indices")};`:`let zero_point_value = ${l?o?"i32":"u32":$.type.value}(0);`}; - // Compute and write output - ${w.setByOffset("global_idx",`${w.type.value}(x_value - zero_point_value) * scale_value`)}; - }`};return{name:"DequantizeLinear",shaderCache:{hint:r.cacheKey,inputDependencies:b?["rank","rank","rank"]:["rank","rank"]},getShaderSource:R,getRunData:()=>({outputs:[{dims:n,dataType:i}],dispatchGroup:{x:Math.ceil(a/M/64),y:1,z:1},programUniforms:z})}},Z0=(e,r)=>{Zg(e.inputs,r),e.compute(ew(e.inputs,r))},eb=e=>Lt({axis:e.axis,blockSize:e.blockSize})}),tw,rw,tb,Sx=Ve(()=>{Ms(),mt(),xt(),tw=(e,r,t)=>{let s=e===r,o=er&&t>0;if(s||o||n)throw new Error("Range these inputs' contents are invalid.")},rw=(e,r,t,s)=>{let o=Math.abs(Math.ceil((r-e)/t)),n=[o],i=o,a=[{type:12,data:i},{type:s,data:e},{type:s,data:t},...nt(n)],l=c=>{let p=tt("output",s,n.length),u=p.type.value,h=[{name:"outputSize",type:"u32"},{name:"start",type:u},{name:"delta",type:u}];return` - ${c.registerUniforms(h).declareVariables(p)} - ${c.mainStart()} - ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - output[global_idx] = uniforms.start + ${u}(global_idx) * uniforms.delta; - }`};return{name:"Range",shaderCache:{hint:`${s}`},getShaderSource:l,getRunData:()=>({outputs:[{dims:n,dataType:s}],dispatchGroup:{x:Math.ceil(i/64)},programUniforms:a})}},tb=e=>{let r=0,t=0,s=0;e.inputs[0].dataType===6?(r=e.inputs[0].getInt32Array()[0],t=e.inputs[1].getInt32Array()[0],s=e.inputs[2].getInt32Array()[0]):e.inputs[0].dataType===1&&(r=e.inputs[0].getFloat32Array()[0],t=e.inputs[1].getFloat32Array()[0],s=e.inputs[2].getFloat32Array()[0]),Kt.webgpu.validateInputContent&&tw(r,t,s),e.compute(rw(r,t,s,e.inputs[0].dataType),{inputs:[]})}}),sw,nw,rb,sb,$x=Ve(()=>{mt(),bt(),tr(),xt(),sw=(e,r,t,s)=>{if(e!=="none"&&s!=="i32"&&s!=="u32"&&s!=="f32")throw new Error(`Input ${s} is not supported with reduction ${e}.`);let o=`{ - var oldValue = 0; - loop { - let newValueF32 =`,n=`; - let newValue = bitcast(newValueF32); - let res = atomicCompareExchangeWeak(&${r}, oldValue, newValue); - if res.exchanged { - break; - } - oldValue = res.old_value; - } - }`;switch(e){case"none":return`${r}=${t};`;case"add":return s==="i32"||s==="u32"?`atomicAdd(&${r}, bitcast<${s}>(${t}));`:` - ${o}bitcast<${s}>(oldValue) + (${t})${n}`;case"max":return s==="i32"||s==="u32"?`atomicMax(&${r}, bitcast<${s}>(${t}));`:` - ${o}max(bitcast(oldValue), (${t}))${n}`;case"min":return s==="i32"||s==="u32"?`atomicMin(&${r}, bitcast<${s}>(${t}));`:`${o}min(bitcast<${s}>(oldValue), (${t}))${n}`;case"mul":return`${o}(bitcast<${s}>(oldValue) * (${t}))${n}`;default:throw new Error(`Reduction ${e} is not supported.`)}},nw=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t,n=1,i=Math.ceil(xe.size(s)/n),a=s[s.length-1],l=xe.sizeFromDimension(t,a),c=[{type:12,data:i},{type:12,data:a},{type:12,data:l},...nt(e[1].dims,e[2].dims,o)],p=u=>{let h=$e("indices",e[1].dataType,e[1].dims.length),g=$e("updates",e[2].dataType,e[2].dims.length,n),_=r.reduction!=="none"&&r.reduction!==""?Fy("output",e[0].dataType,o.length):tt("output",e[0].dataType,o.length,n);return` - ${u.registerUniform("output_size","u32").registerUniform("last_index_dimension","u32").registerUniform("num_updates_elements","u32").declareVariables(h,g,_)} - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - var hasDuplicates = false; - if (${r.reduction==="none"}) { - let n = ${xe.size(s)}; - for (var i = 0; i < n; i = i + 1) { - for (var j = i + 1; j < n; j = j + 1) { - var index_i = i32(indices[i].x); - var index_j = i32(indices[j].x); - if (index_i == index_j) { - hasDuplicates = true; - break; - } - } - if (hasDuplicates) { - break; - } - } - } - - var data_offset = 0u; - var indices_start = uniforms.last_index_dimension * global_idx; - if (${r.reduction==="none"} && hasDuplicates) { - if (global_idx != 0u) { - return; - } - indices_start = 0u; - } - let indices_end = indices_start + uniforms.last_index_dimension; - for (var i = indices_start; i < indices_end; i++) { - var index = i32(indices[i].x); - ${e[0].dims.length===1?` - let element_count_dim = uniforms.output_strides; - let dim_value = uniforms.output_shape;`:` - let element_count_dim = uniforms.output_strides[i - indices_start]; - let dim_value = uniforms.output_shape[i - indices_start + uniforms.last_index_dimension];`} - if (index >= 0) { - if (index >= i32(dim_value)) { - index = i32(dim_value - 1); - } - } else { - if (index < -i32(dim_value)) { - index = 0; - } else { - index += i32(dim_value); - } - } - data_offset += u32((u32(index) * element_count_dim)); - } - - for (var i = 0u; i < uniforms.num_updates_elements; i++) { - let value = updates[uniforms.num_updates_elements * global_idx + i]; - ${sw(r.reduction,"output[data_offset + i]","value",_.type.value)} - } - - }`};return{name:"ScatterND",shaderCache:{hint:`${r.cacheKey}_${r.reduction}`,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:o,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(i/64)},programUniforms:c}),getShaderSource:p}},rb=e=>Lt({reduction:e.reduction}),sb=(e,r)=>{e.compute(nw(e.inputs,r),{inputs:[e.inputs[1],e.inputs[2]],outputs:[]})}}),ow,iw,aw,Ic,lw,dw,cw,uw,pw,hw,mw,fw,Ac,_w,gw,ww,yw,Mw,nb,ob,kx=Ve(()=>{mt(),bt(),tr(),xt(),ow=(e,r)=>{if(e.every(t=>t>0||(()=>{throw new Error("Resize requires scales input values to be positive")})),e.length>0){if(r.mode==="linear"){if(!(e.length===2||e.length===3||e.length===4&&e[0]===1&&e[1]===1||e.length===4&&e[0]===1&&e[3]===1||e.length===5&&e[0]===1&&e[1]===1))throw new Error(`For linear mode, Resize requires scales to be 2D, 3D, 4D with either two outermost or one innermost and - one outermost scale values equal to 1, or 5D with two outermost scale values equal to 1`)}else if(r.mode==="cubic"&&!(e.length===2||e.length===4&&e[0]===1&&e[1]===1||e.length===4&&e[0]===1&&e[3]===1))throw new Error("Resize requires scales input size to be 2 or 4 for cubic mode")}},iw=(e,r,t)=>{r.every(o=>o>=0&&o{throw new Error("Resize requires axes input values to be positive and less than rank")}));let s=new Array(t).fill(1);return r.forEach((o,n)=>s[o]=e[n]),s},aw=(e,r,t,s,o,n)=>{let[i,a,l]=t>10?[1,2,3]:[-1,e.length>1?1:-1,-1],c=e[0].dims.length;if(i>0&&e.length>i&&e[i].dims.length>0)e[i].getFloat32Array().forEach(p=>n.push(p));else if(r.coordinateTransformMode==="tf_crop_and_resize")throw new Error("Resize requires RoI input to be specified when coordinateTransformMode is tfCropAndResize");if(a>0&&e.length>a&&e[a].dims.length===1&&e[a].dims[0]>0){if(e[a].getFloat32Array().forEach(p=>s.push(p)),s.length!==0&&s.length!==c&&t>=18&&s.length!==r.axes.length)throw new Error("Resize requires scales input size to be same as input rank or axes size for opset 18 and up");ow(s,r),r.axes.length>0&&iw(s,r.axes,c).forEach((p,u)=>s[u]=p)}if(l>0&&e.length>l&&e[l].dims.length===1&&e[l].dims[0]>0&&(e[l].getBigInt64Array().forEach(p=>o.push(Number(p))),o.length!==0&&o.length!==c&&t>=18&&o.length!==r.axes.length))throw new Error("Resize requires sizes input size to be same as input rank or axes size for opset 18 and up");if(r.axes.length>0){if(s.length!==0&&s.length!==r.axes.length)throw new Error('Resize requires "scales" input size to be of axes rank when axes attributes is specified');if(o.length!==0&&o.length!==r.axes.length)throw new Error('Resize requires "sizes" input size to be of rank axes rank when axes attributes is specified')}if(typeof s<"u"&&typeof o<"u"&&s.length>0&&o.length>c)throw new Error("Resize requires only of scales or sizes to be specified")},Ic=(e,r,t,s)=>` - // The whole part and the fractional part are calculated separately due to inaccuracy of floating - // point division. As an example, f32(21) / f32(7) may evaluate to 2.99... instead of 3, causing an - // offset-by-one error later in floor(). - let big = (${e}) * (${r}); - let whole = ${s}(big / (${t})); - let fract = ${s}(big % (${t})) / ${s}(${t}); - return whole + fract; -`,lw=(e,r)=>`fn getOriginalCoordinateFromResizedCoordinate(xResized: u32, xScale: f32, lengthResized: u32, - lengthOriginal: u32, roiStart: f32, roiEnd: f32) -> ${r} { `+(()=>{switch(e){case"asymmetric":return` - if (xScale < 1.0 || floor(xScale) != xScale) { - return ${r}(xResized) / ${r}(xScale); - } else { - ${Ic("xResized","lengthOriginal","lengthResized",r)} - } - `;case"pytorch_half_pixel":return`if (lengthResized > 1) { - return (${r}(xResized) + 0.5) / ${r}(xScale) - 0.5; - } else { - return 0.0; - }`;case"tf_half_pixel_for_nn":return`return (${r}(xResized) + 0.5) / ${r}(xScale);`;case"align_corners":return`if (lengthResized == 1) { - return 0.0; - } else { - ${Ic("xResized","lengthOriginal - 1","lengthResized - 1",r)} - }`;case"tf_crop_and_resize":return`if (lengthResized > 1) { - return ${r}(roiStart) * ${r}(lengthOriginal - 1) + - (${r}(xResized) * ${r}(roiEnd - roiStart) * ${r}(lengthOriginal - 1)) / - ${r}(lengthResized - 1); - } else { - return 0.5 * ${r}(roiStart + roiEnd) * ${r}(lengthOriginal - 1); - }`;case"half_pixel_symmetric":return`const outputWidth = ${r}xScale * ${r}(lengthResized); - const adjustment = ${r}(lengthResized) / outputWidth; - const center = ${r}(lengthOriginal) / 2; - const offset = center * (1 - adjustment); - return offset + ((${r}(xResized) + 0.5) / ${r}(xScale)) - 0.5;`;case"half_pixel":return`return ((${r}(xResized) + 0.5) / ${r}(xScale)) - 0.5;`;default:throw new Error(`Coordinate transform mode ${e} is not supported`)}})()+"}",dw=(e,r,t)=>`fn getNearestPixelFromOriginal(xOriginal: ${t}, isDownSample: bool) -> ${t} {`+(()=>{switch(e){case"round_prefer_ceil":return"if (fract(xOriginal) == 0.5) { return ceil(xOriginal); } else { return round(xOriginal); }";case"floor":return"return floor(xOriginal);";case"ceil":return"return ceil(xOriginal);";case"round_prefer_floor":return"if (fract(xOriginal) == 0.5) { return floor(xOriginal); } else { return round(xOriginal); }";case"simple":default:if(r<11)return"if (isDownSample) { return ceil(xOriginal); } else { return xOriginal; }";throw new Error(`Nearest mode ${e} is not supported`)}})()+"}",cw=(e,r,t)=>{let s=new Array(t).fill(0).concat(new Array(t).fill(1)),o=e.length===0?s:e.slice();return r.length>0?(r.forEach((n,i)=>{s[n]=o[i],s[i+t]=o[r.length+i]}),s):o},uw=(e,r,t,s)=>{let o=[];if(t.length>0)if(s.length>0){if(e.forEach(n=>o.push(n)),Math.max(...s)>e.length)throw new Error("axes is out of bound");s.forEach((n,i)=>o[n]=t[i])}else t.forEach(n=>o.push(n));else{if(r.length===0)throw new Error("Resize requires either scales or sizes.");o=e.map((n,i)=>Math.round(n*r[i]))}return o},pw=(e,r,t)=>{let s=(()=>{switch(t.keepAspectRatioPolicy){case"not_larger":return t.axes.length>0?Math.min(...t.axes.map(n=>r[n]),Number.MAX_VALUE):Math.min(...r,Number.MAX_VALUE);case"not_smaller":return t.axes.length>0?Math.max(...t.axes.map(n=>r[n]),Number.MIN_VALUE):Math.max(...r,Number.MIN_VALUE);default:throw new Error(`Keep aspect ratio policy ${t.keepAspectRatioPolicy} is not supported`)}})();r.fill(1,0,r.length);let o=e.slice();return t.axes.length>0?(t.axes.forEach(n=>r[n]=s),t.axes.forEach(n=>o[n]=Math.round(e[n]*r[n]))):(r.fill(s,0,r.length),o.forEach((n,i)=>o[i]=Math.round(n*r[i]))),o},hw=(e,r,t,s,o)=>` - fn calculateOriginalIndicesFromOutputIndices(output_indices: ${e.type.indices}) -> array<${e.type.value}, ${t.length}> { - var original_indices: array<${e.type.value}, ${t.length}>; - for (var i:u32 = 0; i < ${t.length}; i++) { - var output_index = ${e.indicesGet("output_indices","i")}; - var scale = ${rt("uniforms.scales","i",s)}; - var roi_low = ${rt("uniforms.roi","i",o)}; - var roi_hi = ${rt("uniforms.roi",`i + ${r.length}`,o)}; - if (scale == 1.0) { - original_indices[i] = ${e.type.value}(output_index); - } else { - var input_shape_i = ${rt("uniforms.input_shape","i",r.length)}; - var output_shape_i = ${rt("uniforms.output_shape","i",t.length)}; - original_indices[i] = getOriginalCoordinateFromResizedCoordinate(output_index, scale, output_shape_i, - input_shape_i, roi_low, roi_hi); - } - } - return original_indices; - }`,mw=(e,r,t,s,o,n,i)=>` - fn calculateInputIndicesFromOutputIndices(output_indices: ${r.type.indices}) -> ${e.type.indices} { - var input_indices: ${e.type.indices}; - for (var i:u32 = 0; i < ${s.length}; i++) { - var output_index = ${r.indicesGet("output_indices","i")}; - var input_index: u32; - var scale = ${rt("uniforms.scales","i",o)}; - if (scale == 1.0) { - input_index = output_index; - } else { - var roi_low = ${rt("uniforms.roi","i",n)}; - var roi_hi = ${rt("uniforms.roi",`i + ${t.length}`,n)}; - var input_shape_i = ${rt("uniforms.input_shape","i",t.length)}; - var output_shape_i = ${rt("uniforms.output_shape","i",s.length)}; - var original_idx = getOriginalCoordinateFromResizedCoordinate(output_index, scale, output_shape_i, - input_shape_i, roi_low, roi_hi); - if (!${i} || (original_idx >= 0 && original_idx < ${r.type.value}(input_shape_i))) { - if (original_idx < 0) { - input_index = 0; - } else if (original_idx > ${r.type.value}(input_shape_i - 1)) { - input_index = input_shape_i - 1; - } else { - input_index = u32(getNearestPixelFromOriginal(original_idx, scale < 1)); - } - } else { - input_index = u32(original_idx); - } - } - ${e.indicesSet("input_indices","i","input_index")} - } - return input_indices; - }`,fw=(e,r)=>` - fn checkInputIndices(input_indices: ${e.type.indices}) -> bool { - for (var i:u32 = 0; i < ${r.length}; i++) { - var input_index = ${e.indicesGet("input_indices","i")}; - if (input_index < 0 || input_index >= ${rt("uniforms.input_shape","i",r.length)}) { - return false; - } - } - return true; - }`,Ac=(e,r,t,s)=>e.rank>s?` - ${e.indicesSet("input_indices",r,"channel")}; - ${e.indicesSet("input_indices",t,"batch")}; -`:"",_w=(e,r,t,s,o)=>{let[n,i,a,l]=t.length===2?[-1,0,1,-1]:[0,2,3,1],c=e.type.value;return` - fn getInputValue(batch: u32, channel: u32, row: u32, col: u32) -> ${c} { - var input_indices: ${e.type.indices}; - ${e.indicesSet("input_indices",i,`max(0, min(row, ${t[i]} - 1))`)}; - ${e.indicesSet("input_indices",a,`max(0, min(col, ${t[a]} - 1))`)}; - ${Ac(e,l,n,2)} - return ${e.getByIndices("input_indices")}; - } - - fn bilinearInterpolation(output_indices: ${r.type.indices}) -> ${c} { - var originalIndices = calculateOriginalIndicesFromOutputIndices(output_indices); - var row:${c} = originalIndices[${i}]; - var col:${c} = originalIndices[${a}]; - ${s?`if (row < 0 || row > (${t[i]} - 1) || col < 0 || col > (${t[a]} - 1)) { - return ${o}; - }`:""}; - row = max(0, min(row, ${t[i]} - 1)); - col = max(0, min(col, ${t[a]} - 1)); - var row1: u32 = u32(row); - var col1: u32 = u32(col); - var row2: u32 = u32(row + 1); - var col2: u32 = u32(col + 1); - var channel: u32 = ${t.length>2?`u32(originalIndices[${l}])`:"0"}; - var batch: u32 = ${t.length>2?`u32(originalIndices[${n}])`:"0"}; - var x11: ${c} = getInputValue(batch, channel, row1, col1); - var x12: ${c} = getInputValue(batch, channel, row1, col2); - var x21: ${c} = getInputValue(batch, channel, row2, col1); - var x22: ${c} = getInputValue(batch, channel, row2, col2); - var dx1: ${c} = abs(row - ${c}(row1)); - var dx2: ${c} = abs(${c}(row2) - row); - var dy1: ${c} = abs(col - ${c}(col1)); - var dy2: ${c} = abs(${c}(col2) - col); - if (row1 == row2) { - dx1 = 0.5; - dx2 = 0.5; - } - if (col1 == col2) { - dy1 = 0.5; - dy2 = 0.5; - } - return (x11 * dx2 * dy2 + x12 * dx2 * dy1 + x21 * dx1 * dy2 + x22 * dx1 * dy1); - }`},gw=(e,r,t,s,o,n,i,a,l,c)=>{let p=t.length===2,[u,h]=p?[0,1]:[2,3],g=e.type.value,_=E=>{let I=E===u?"row":"col";return` - fn ${I}CubicInterpolation(input_indices: ${e.type.indices}, output_indices: ${r.type.indices}) -> ${g} { - var output_index = ${r.indicesGet("output_indices",E)}; - var originalIdx: ${g} = getOriginalCoordinateFromResizedCoordinate(output_index, ${o[E]}, - ${s[E]}, ${t[E]}, ${n[E]}, ${n[E]} + ${t.length}); - var fractOriginalIdx: ${g} = originalIdx - floor(originalIdx); - var coefs = getCubicInterpolationCoefs(fractOriginalIdx); - - if (${a} && (originalIdx < 0 || originalIdx > (${t[E]} - 1))) { - return ${l}; - } - var data: array<${g}, 4> = array<${g}, 4>(0.0, 0.0, 0.0, 0.0); - for (var i: i32 = -1; i < 3; i++) { - var ${I}: ${g} = originalIdx + ${g}(i); - if (${I} < 0 || ${I} >= ${t[E]}) { - ${c?`coefs[i + 1] = 0.0; - continue;`:a?`return ${l};`:`${I} = max(0, min(${I}, ${t[E]} - 1));`}; - } - var input_indices_copy: ${e.type.indices} = input_indices; - ${e.indicesSet("input_indices_copy",E,`u32(${I})`)}; - data[i + 1] = ${E===u?e.getByIndices("input_indices_copy"):"rowCubicInterpolation(input_indices_copy, output_indices)"}; - } - return cubicInterpolation1D(data, coefs); - }`};return` - ${_(u)}; - ${_(h)}; - fn getCubicInterpolationCoefs(s: ${g}) -> array<${g}, 4> { - var absS = abs(s); - var coeffs: array<${g}, 4> = array<${g}, 4>(0.0, 0.0, 0.0, 0.0); - var oneMinusAbsS: ${g} = 1.0 - absS; - var twoMinusAbsS: ${g} = 2.0 - absS; - var onePlusAbsS: ${g} = 1.0 + absS; - coeffs[0] = ((${i} * onePlusAbsS - 5 * ${i}) * onePlusAbsS + 8 * ${i}) * onePlusAbsS - 4 * ${i}; - coeffs[1] = ((${i} + 2) * absS - (${i} + 3)) * absS * absS + 1; - coeffs[2] = ((${i} + 2) * oneMinusAbsS - (${i} + 3)) * oneMinusAbsS * oneMinusAbsS + 1; - coeffs[3] = ((${i} * twoMinusAbsS - 5 * ${i}) * twoMinusAbsS + 8 * ${i}) * twoMinusAbsS - 4 * ${i}; - return coeffs; - } - - fn cubicInterpolation1D(x: array<${g}, 4>, coefs: array<${g}, 4>) -> ${g} { - var coefsSum: ${g} = coefs[0] + coefs[1] + coefs[2] + coefs[3]; - return (x[0] * coefs[0] + x[1] * coefs[1]+ x[2] * coefs[2]+ x[3] * coefs[3]) / coefsSum; - } - - fn bicubicInterpolation(output_indices: ${r.type.indices}) -> ${g} { - var input_indices: ${e.type.indices} = output_indices; - return colCubicInterpolation(input_indices, output_indices); - } - `},ww=(e,r,t,s,o)=>{let[n,i,a,l,c]=t.length===3?[-1,0,1,2,-1]:[0,2,3,4,1],p=e.type.value;return` - fn getInputValue(batch: u32, channel: u32, depth:u32, height: u32, width: u32) -> ${p} { - var input_indices: ${e.type.indices}; - ${e.indicesSet("input_indices",i,`max(0, min(depth, ${t[i]} - 1))`)}; - ${e.indicesSet("input_indices",a,`max(0, min(height, ${t[a]} - 1))`)}; - ${e.indicesSet("input_indices",l,`max(0, min(width, ${t[l]} - 1))`)}; - ${Ac(e,c,n,3)} - return ${e.getByIndices("input_indices")}; - } - - fn trilinearInterpolation(output_indices: ${r.type.indices}) -> ${p} { - var originalIndices = calculateOriginalIndicesFromOutputIndices(output_indices); - var depth:${p} = originalIndices[${i}]; - var height:${p} = originalIndices[${a}]; - var width:${p} = originalIndices[${l}]; - ${s?`if (depth < 0 || depth > (${t[i]} - 1) || height < 0 || height > (${t[a]} - 1) || width < 0 || (width > ${t[l]} - 1)) { - return ${o}; - }`:""}; - - depth = max(0, min(depth, ${t[i]} - 1)); - height = max(0, min(height, ${t[a]} - 1)); - width = max(0, min(width, ${t[l]} - 1)); - var depth1: u32 = u32(depth); - var height1: u32 = u32(height); - var width1: u32 = u32(width); - var depth2: u32 = u32(depth + 1); - var height2: u32 = u32(height + 1); - var width2: u32 = u32(width + 1); - var channel: u32 = ${t.length>3?`u32(originalIndices[${c}])`:"0"}; - var batch: u32 = ${t.length>3?`u32(originalIndices[${n}])`:"0"}; - - var x111: ${p} = getInputValue(batch, channel, depth1, height1, width1); - var x112: ${p} = getInputValue(batch, channel, depth1, height1, width2); - var x121: ${p} = getInputValue(batch, channel, depth1, height2, width1); - var x122: ${p} = getInputValue(batch, channel, depth1, height2, width2); - var x211: ${p} = getInputValue(batch, channel, depth2, height1, width1); - var x212: ${p} = getInputValue(batch, channel, depth2, height1, width2); - var x221: ${p} = getInputValue(batch, channel, depth2, height2, width1); - var x222: ${p} = getInputValue(batch, channel, depth2, height2, width2); - var dx1: ${p} = abs(depth - ${p}(depth1)); - var dx2: ${p} = abs(${p}(depth2) - depth); - var dy1: ${p} = abs(height - ${p}(height1)); - var dy2: ${p} = abs(${p}(height2) - height); - var dz1: ${p} = abs(width - ${p}(width1)); - var dz2: ${p} = abs(${p}(width2) - width); - if (depth1 == depth2) { - dx1 = 0.5; - dx2 = 0.5; - } - if (height1 == height2) { - dy1 = 0.5; - dy2 = 0.5; - } - if (width1 == width2) { - dz1 = 0.5; - dz2 = 0.5; - } - return (x111 * dx2 * dy2 * dz2 + x112 * dx2 * dy2 * dz1 + x121 * dx2 * dy1 *dz2 + x122 * dx2 * dy1 * dz1 + - x211 * dx1 * dy2 * dz2 + x212 * dx1 * dy2 * dz1 + x221 * dx1 * dy1 *dz2 + x222 * dx1 * dy1 * dz1); - }`},yw=(e,r,t,s,o,n)=>{let i=e.dims,a=cw(n,r.axes,i.length),l=uw(i,s,o,r.axes),c=s.slice();s.length===0&&(c=i.map((y,$)=>y===0?1:l[$]/y),r.keepAspectRatioPolicy!=="stretch"&&(l=pw(i,c,r)));let p=tt("output",e.dataType,l.length),u=$e("input",e.dataType,i.length),h=xe.size(l),g=i.length===l.length&&i.every((y,$)=>y===l[$]),_=r.coordinateTransformMode==="tf_crop_and_resize",E=r.extrapolationValue,I=u.type.value,M=y=>` - ${g?"":` - ${lw(r.coordinateTransformMode,I)}; - ${(()=>{switch(r.mode){case"nearest":return` - ${fw(u,i)}; - ${dw(r.nearestMode,t,I)}; - ${mw(u,p,i,l,c.length,a.length,_)}; - `;case"linear":return` - ${hw(p,i,l,c.length,a.length)}; - ${(()=>{if(i.length===2||i.length===4)return`${_w(u,p,i,_,E)}`;if(i.length===3||i.length===5)return`${ww(u,p,i,_,E)}`;throw Error("Linear mode only supports input dims 2, 3, 4 and 5 are supported in linear mode.")})()}; - `;case"cubic":return` - ${(()=>{if(i.length===2||i.length===4)return`${gw(u,p,i,l,c,a,r.cubicCoeffA,_,r.extrapolationValue,r.excludeOutside)}`;throw Error("Cubic mode only supports input dims 2 and 4 are supported in linear mode.")})()}; - `;default:throw Error("Invalid resize mode")}})()}; - `} - ${y.registerUniform("output_size","u32").registerUniform("scales","f32",c.length).registerUniform("roi","f32",a.length).declareVariables(u,p)} - ${y.mainStart()} - ${y.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - ${g?"output[global_idx] = input[global_idx];":` - let output_indices = ${p.offsetToIndices("global_idx")}; - var input_indices: ${u.type.indices}; - ${(()=>{switch(r.mode){case"nearest":return`input_indices = calculateInputIndicesFromOutputIndices(output_indices); - if (checkInputIndices(input_indices)) { - output[global_idx] = ${u.getByIndices("input_indices")}; - } else { - output[global_idx] = ${r.extrapolationValue}; - }`;case"linear":return`output[global_idx] = ${i.length===2||i.length===4?"bilinearInterpolation":"trilinearInterpolation"}(output_indices);`;case"cubic":return"output[global_idx] = bicubicInterpolation(output_indices);";default:throw Error(`Unsupported resize mode: ${r.mode}`)}})()}; -`} - }`;return{name:"Resize",shaderCache:{hint:`${r.cacheKey}|${t}|${c.length>0?r.mode==="cubic"?c:c.length:""}|${o.length>0?o:""}|${a.length>0?a:""}|${g}|${r.mode==="nearest"?i.length:i}`,inputDependencies:["rank"]},getShaderSource:M,getRunData:()=>({outputs:[{dims:l,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(h/64)},programUniforms:[{type:12,data:h},{type:1,data:c},{type:1,data:a},...nt(i,l)]})}},Mw=e=>{let r=e.customDataBuffer;return new Uint32Array(r,r.byteOffset,1)[0]},nb=(e,r)=>{let t=[],s=[],o=[],n=Mw(e);if(r.antialias!==0)throw Error("Only default value (0) for Antialias attribute is supported");aw(e.inputs,r,n,t,s,o),e.compute(yw(e.inputs[0],r,n,t,s,o),{inputs:[0]})},ob=e=>{let r=e.antialias,t=e.axes,s=e.coordinateTransformMode,o=e.cubicCoeffA,n=e.excludeOutside!==0,i=e.extrapolationValue,a=e.keepAspectRatioPolicy,l=e.mode,c=e.nearestMode===""?"simple":e.nearestMode;return Lt({antialias:r,axes:t,coordinateTransformMode:s,cubicCoeffA:o,excludeOutside:n,extrapolationValue:i,keepAspectRatioPolicy:a,mode:l,nearestMode:c})}}),bw,vw,ib,Ix=Ve(()=>{mt(),bt(),tr(),xt(),bw=(e,r)=>{let[t,s,o,n]=e,{numHeads:i,rotaryEmbeddingDim:a}=r;if(t.dims.length!==3&&t.dims.length!==4)throw new Error(`Input 'x' is expected to have 3 or 4 dimensions, got ${t.dims.length}`);if(!xe.areEqual(s.dims,[])&&!xe.areEqual(s.dims,[1])&&s.dims.length!==2)throw new Error(`Input 'position_ids' is expected to have 0, 1, or 2 dimensions, got ${s.dims.length}`);if(o.dims.length!==2)throw new Error(`Input 'cos_cache' is expected to have 2 dimensions, got ${o.dims.length}`);if(n.dims.length!==2)throw new Error(`Input 'sin_cache' is expected to have 2 dimensions, got ${n.dims.length}`);if(!xe.areEqual(o.dims,n.dims))throw new Error("Inputs 'cos_cache' and 'sin_cache' are expected to have the same shape");if(a>0&&i===0)throw new Error("num_heads must be provided if rotary_embedding_dim is specified");let l=t.dims[0],c=t.dims[t.dims.length-2],p=o.dims[0],u=xe.sizeFromDimension(t.dims,1)/c,h=a===0?o.dims[1]*2:u/i;if(a>h)throw new Error("rotary_embedding_dim must be less than or equal to head_size");if(s.dims.length===2){if(l!==s.dims[0])throw new Error(`Input 'position_ids' dimension 0 should be of size batch_size, got ${s.dims[0]}`);if(c!==s.dims[1])throw new Error(`Input 'position_ids' dimension 1 should be of size sequence_length, got ${s.dims[1]}`)}if(h/2!==o.dims[1]&&a/2!==o.dims[1])throw new Error(`Input 'cos_cache' dimension 1 should be same as head_size / 2 or rotary_embedding_dim / 2, got ${o.dims[1]}`);if(c>p)throw new Error("Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported")},vw=(e,r)=>{let{interleaved:t,numHeads:s,rotaryEmbeddingDim:o,scale:n}=r,i=e[0].dims[0],a=xe.sizeFromDimension(e[0].dims,1),l=e[0].dims[e[0].dims.length-2],c=a/l,p=e[2].dims[1],u=o===0?p*2:c/s,h=new Array(i,l,c/u,u-p),g=xe.computeStrides(h),_=[{type:1,data:n},{type:12,data:h},{type:12,data:g},...e[0].dims.length===3?new Array({type:12,data:[a,c,u,1]}):[],...e[0].dims.length===4?new Array({type:12,data:[a,u,l*u,1]}):[],...nt(e[0].dims,e[1].dims,e[2].dims,e[3].dims,e[0].dims)],E=I=>{let M=$e("input",e[0].dataType,e[0].dims.length),y=$e("position_ids",e[1].dataType,e[1].dims.length),$=$e("cos_cache",e[2].dataType,e[2].dims.length),P=$e("sin_cache",e[3].dataType,e[3].dims.length),b=tt("output",e[0].dataType,e[0].dims.length);return I.registerUniforms([{name:"scale",type:"f32"},{name:"global_shape",type:"u32",length:h.length},{name:"global_strides",type:"u32",length:g.length},{name:"input_output_strides",type:"u32",length:g.length}]),` - ${I.declareVariables(M,y,$,P,b)} - - ${I.mainStart($o)} - let half_rotary_emb_dim = uniforms.${$.name}_shape[1]; - let bsnh = global_idx / uniforms.global_strides % uniforms.global_shape; - let size = uniforms.global_shape[0] * uniforms.global_strides[0]; - ${I.guardAgainstOutOfBoundsWorkgroupSizes("size")} - - if (bsnh[3] < half_rotary_emb_dim) { - let position_ids_idx = - ${y.broadcastedIndicesToOffset("bsnh.xy",tt("",y.type.tensor,2))}; - let position_id = - u32(${y.getByOffset("position_ids_idx")}) + select(0, bsnh[1], position_ids_idx == 0); - let i = dot(bsnh, uniforms.input_output_strides) + select(0, bsnh[3], ${t}); - let j = i + select(half_rotary_emb_dim, 1, ${t}); - let re = ${M.getByOffset("i")} * ${$.get("position_id","bsnh[3]")} - - ${M.getByOffset("j")} * ${P.get("position_id","bsnh[3]")}; - ${b.setByOffset("i","re")} - let im = ${M.getByOffset("i")} * ${P.get("position_id","bsnh[3]")} + - ${M.getByOffset("j")} * ${$.get("position_id","bsnh[3]")}; - ${b.setByOffset("j","im")} - } else { - let k = dot(bsnh, uniforms.input_output_strides) + half_rotary_emb_dim; - ${b.setByOffset("k",M.getByOffset("k"))} - } - }`};return{name:"RotaryEmbedding",shaderCache:{hint:Lt({interleaved:t}).cacheKey,inputDependencies:["rank","rank","rank","rank"]},getShaderSource:E,getRunData:()=>({outputs:[{dims:e[0].dims,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(xe.size(h)/$o)},programUniforms:_})}},ib=(e,r)=>{bw(e.inputs,r),e.compute(vw(e.inputs,r))}}),xw,Tw,ab,Ax=Ve(()=>{mt(),bt(),xt(),xw=e=>{if(!e||e.length<3)throw new Error("layerNorm requires at least 3 inputs.");let r=e[0],t=e[1],s=e[2];if(r.dataType!==t.dataType||r.dataType!==s.dataType)throw new Error("All inputs must have the same data type");if(r.dims.length!==3&&r.dims.length!==2)throw new Error("Input must be 2D or 3D");if(t.dims.length!==3&&t.dims.length!==2)throw new Error("Skip must be 2D or 3D");let o=r.dims[r.dims.length-1],n=r.dims[r.dims.length-2];if(t.dims[t.dims.length-1]!==o)throw new Error("Skip must have the same hidden size as input");if(t.dims[t.dims.length-2]!==n)throw new Error("Skip must have the same sequence length as input");if(s.dims.length!==1)throw new Error("Gamma must be 1D");if(s.dims[s.dims.length-1]!==o)throw new Error("Gamma must have the same hidden size as input");if(e.length>3){let i=e[3];if(i.dims.length!==1)throw new Error("Beta must be 1D");if(i.dims[i.dims.length-1]!==o)throw new Error("Beta must have the same hidden size as input")}if(e.length>4){let i=e[4];if(i.dims.length!==1)throw new Error("Bias must be 1D");if(i.dims[i.dims.length-1]!==o)throw new Error("Bias must have the same hidden size as input")}},Tw=(e,r,t,s)=>{let o=r.simplified,n=e[0].dims,i=xe.size(n),a=n,l=i,c=n.slice(-1)[0],p=s?n.slice(0,-1).concat(1):[],u=!o&&e.length>3,h=e.length>4,g=s&&t>1,_=s&&t>2,E=t>3,I=64,M=Jt(c),y=[{type:12,data:l},{type:12,data:M},{type:12,data:c},{type:1,data:r.epsilon}],$=b=>{let w=[{name:"output_size",type:"u32"},{name:"components",type:"u32"},{name:"hidden_size",type:"u32"},{name:"epsilon",type:"f32"}],T=[$e("x",e[0].dataType,e[0].dims,M),$e("skip",e[1].dataType,e[1].dims,M),$e("gamma",e[2].dataType,e[2].dims,M)];u&&T.push($e("beta",e[3].dataType,e[3].dims,M)),h&&T.push($e("bias",e[4].dataType,e[4].dims,M)),T.push(tt("output",e[0].dataType,a,M)),g&&T.push(tt("mean_output",1,p)),_&&T.push(tt("inv_std_output",1,p)),E&&T.push(tt("input_skip_bias_sum",e[0].dataType,a,M));let k=pr(e[0].dataType),z=pr(1,M);return` - - ${b.registerUniforms(w).declareVariables(...T)} - var sum_shared : array<${z}, ${I}>; - var sum_squared_shared : array<${z}, ${I}>; - - ${b.mainStart([I,1,1])} - let ix = local_id.x; - let iy = global_id.x / ${I}; - - let hidden_size_vectorized: u32 = uniforms.hidden_size / uniforms.components; - var stride = hidden_size_vectorized / ${I}; - let offset = ix * stride + iy * hidden_size_vectorized; - let offset1d = stride * ix; - if (ix == ${I-1}) { - stride = hidden_size_vectorized - stride * ix; - } - for (var i: u32 = 0; i < stride; i++) { - let skip_value = skip[offset + i]; - let bias_value = ${h?"bias[offset1d + i]":k+"(0.0)"}; - let input_value = x[offset + i]; - let value = input_value + skip_value + bias_value; - ${E?"input_skip_bias_sum[offset + i] = value;":""} - output[offset + i] = value; - let f32_value = ${Co(k,M,"value")}; - sum_shared[ix] += f32_value; - sum_squared_shared[ix] += f32_value * f32_value; - } - workgroupBarrier(); - - var reduce_size : u32 = ${I}; - for (var curr_size = reduce_size >> 1; curr_size > 0; curr_size = reduce_size >> 1) { - reduce_size = curr_size + (reduce_size & 1); - if (ix < curr_size) { - sum_shared[ix] += sum_shared[ix + reduce_size]; - sum_squared_shared[ix] += sum_squared_shared[ix + reduce_size]; - } - workgroupBarrier(); - } - - let sum = sum_shared[0]; - let square_sum = sum_squared_shared[0]; - let mean = ${dn("sum",M)} / f32(uniforms.hidden_size); - let inv_std_dev = inverseSqrt(${dn("square_sum",M)} / f32(uniforms.hidden_size) ${o?"":"- mean * mean"} + uniforms.epsilon); - ${g?"mean_output[global_idx] = mean;":""} - ${_?"inv_std_output[global_idx] = inv_std_dev;":""} - - for (var i: u32 = 0; i < stride; i++) { - output[offset + i] = (output[offset + i] ${o?"":`- ${k}(mean)`}) * - ${k}(inv_std_dev) * gamma[offset1d + i] - ${u?"+ beta[offset1d + i]":""}; - } - }`},P=[{dims:a,dataType:e[0].dataType}];return t>1&&P.push({dims:p,dataType:1}),t>2&&P.push({dims:p,dataType:1}),t>3&&P.push({dims:n,dataType:e[0].dataType}),{name:"SkipLayerNormalization",shaderCache:{hint:`${M};${g};${_};${E}`,inputDependencies:e.map((b,w)=>"type")},getShaderSource:$,getRunData:()=>({outputs:P,dispatchGroup:{x:Math.ceil(l/c)},programUniforms:y})}},ab=(e,r)=>{xw(e.inputs);let t=[0];e.outputCount>1&&t.push(-3),e.outputCount>2&&t.push(-3),e.outputCount>3&&t.push(3),e.compute(Tw(e.inputs,r,e.outputCount,!1),{outputs:t})}}),Ew,na,Pw,Fc,Cw,Sw,lb,db,Fx=Ve(()=>{mt(),bt(),tr(),xt(),Ew=(e,r)=>{if(!e||e.length<1)throw new Error("too few inputs");if(r.axes.length!==0){if(r.axes.length!==r.starts.length||r.axes.length!==r.ends.length)throw new Error("axes, starts and ends must have the same length")}else if(r.starts.length!==r.ends.length)throw new Error("starts and ends must have the same length");e.slice(1).forEach((t,s)=>{if(e[s+1].dataType!==6&&e[s+1].dataType!==7)throw new Error(`Input ${s} must be an array of int32 or int64`)})},na=(e,r)=>{let t=[];if(e.length>r)if(e[r].dataType===7)e[r].getBigInt64Array().forEach(s=>t.push(Number(s)));else if(e[r].dataType===6)e[r].getInt32Array().forEach(s=>t.push(Number(s)));else throw new Error(`Input ${r} must be an array of int32 or int64`);return t},Pw=(e,r)=>{if(e.length>1){let t=na(e,1),s=na(e,2),o=na(e,3);return o.length===0&&(o=[...Array(e[0].dims.length).keys()]),Lt({starts:t,ends:s,axes:o})}else return r},Fc=(e,r,t,s,o)=>{let n=e;return e<0&&(n+=t[s[r]]),o[r]<0?Math.max(0,Math.min(n,t[s[r]]-1)):Math.max(0,Math.min(n,t[s[r]]))},Cw=(e,r,t)=>`fn calculateInputIndices(output_indices: ${r.type.indices}) -> ${e.type.indices} { - var input_indices: ${e.type.indices}; - var carry = 0u; - for (var i = ${t.length}; i >= 0; i--) { - let input_shape_i = ${rt("uniforms.input_shape","i",t.length)}; - let steps_i = ${rt("uniforms.steps","i",t.length)}; - let signs_i = ${rt("uniforms.signs","i",t.length)}; - let starts_i = ${rt("uniforms.starts","i",t.length)}; - var output_index = ${r.indicesGet("output_indices","i")}; - var input_index = output_index * steps_i + starts_i + carry; - carry = input_index / input_shape_i; - input_index = input_index % input_shape_i; - if (signs_i < 0) { - input_index = input_shape_i - input_index - 1u + starts_i; - } - ${e.indicesSet("input_indices","i","input_index")}; - } - return input_indices; - }`,Sw=(e,r)=>{let t=e[0].dims,s=xe.size(t),o=r.axes.length>0?xe.normalizeAxes(r.axes,t.length):[...Array(t.length).keys()],n=na(e,4);n.forEach(M=>M!==0||(()=>{throw new Error("step cannot be 0")})),n.length===0&&(n=Array(o.length).fill(1));let i=r.starts.map((M,y)=>Fc(M,y,t,o,n)),a=r.ends.map((M,y)=>Fc(M,y,t,o,n));if(o.length!==i.length||o.length!==a.length)throw new Error("start, ends and axes should have the same number of elements");if(o.length!==t.length)for(let M=0;MMath.sign(M));n.forEach((M,y,$)=>{if(M<0){let P=(a[y]-i[y])/M,b=i[y],w=b+P*n[y];i[y]=w,a[y]=b,$[y]=-M}});let c=t.slice(0);o.forEach((M,y)=>{c[M]=Math.ceil((a[M]-i[M])/n[M])});let p={dims:c,dataType:e[0].dataType},u=tt("output",e[0].dataType,c.length),h=$e("input",e[0].dataType,e[0].dims.length),g=xe.size(c),_=[{name:"outputSize",type:"u32"},{name:"starts",type:"u32",length:i.length},{name:"signs",type:"i32",length:l.length},{name:"steps",type:"u32",length:n.length}],E=[{type:12,data:g},{type:12,data:i},{type:6,data:l},{type:12,data:n},...nt(e[0].dims,c)],I=M=>` - ${M.registerUniforms(_).declareVariables(h,u)} - ${Cw(h,u,t)} - ${M.mainStart()} - ${M.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - let output_indices = ${u.offsetToIndices("global_idx")}; - let input_indices = calculateInputIndices(output_indices); - ${u.setByOffset("global_idx",h.getByIndices("input_indices"))} - }`;return{name:"Slice",shaderCache:{hint:`${l.length}_${i.length}_${n.length}`,inputDependencies:["rank"]},getShaderSource:I,getRunData:()=>({outputs:[p],dispatchGroup:{x:Math.ceil(s/64)},programUniforms:E})}},lb=(e,r)=>{Ew(e.inputs,r);let t=Pw(e.inputs,r);e.compute(Sw(e.inputs,t),{inputs:[0]})},db=e=>{let r=e.starts,t=e.ends,s=e.axes;return Lt({starts:r,ends:t,axes:s})}}),$w,kw,cb,ub,Ox=Ve(()=>{mt(),bt(),tr(),cn(),xt(),$w=e=>{if(!e||e.length!==1)throw new Error("Softmax op requires 1 input.")},kw=(e,r)=>{let t=e.inputs[0],s=t.dims,o=xe.size(s),n=s.length,i=xe.normalizeAxis(r.axis,n),a=ik),c[i]=n-1,c[n-1]=i,l=e.compute(Wr(t,c),{inputs:[t],outputs:[-1]})[0]):l=t;let p=l.dims,u=p[n-1],h=o/u,g=Jt(u),_=u/g,E=64;h===1&&(E=256);let I=(T,k)=>k===4?`max(max(${T}.x, ${T}.y), max(${T}.z, ${T}.w))`:k===2?`max(${T}.x, ${T}.y)`:k===3?`max(max(${T}.x, ${T}.y), ${T}.z)`:T,M=$e("x",l.dataType,l.dims,g),y=tt("result",l.dataType,l.dims,g),$=M.type.value,P=pr(l.dataType)==="f32"?`var threadMax = ${$}(-3.402823e+38f);`:`var threadMax = ${$}(-65504.0h);`,b=T=>` - var rowMaxShared : ${$}; - var rowSumShared : ${$}; - var threadShared : array<${$}, ${E}>; - - fn getValue(row: i32, col: i32, row_stride: i32) -> ${$} { - let index = row * row_stride + col; - return x[index]; - } - - fn setValue(row: i32, col: i32, row_stride: i32, value: ${$}) { - let index = row * row_stride + col; - result[index] = value; - } - ${T.registerUniform("packedCols","i32").declareVariables(M,y)} - ${T.mainStart(E)} - let gindex = i32(global_idx); - let lindex = i32(local_idx); - const wg = ${E}; - let row = gindex / wg; - let cols = uniforms.packedCols; - let row_stride : i32 = uniforms.packedCols; - - // find the rows max - ${P} - for (var col = lindex; col < cols; col += wg) { - let value = getValue(row, col, row_stride); - threadMax = max(threadMax, value); - } - if (lindex < cols) { - threadShared[lindex] = threadMax; - } - workgroupBarrier(); - - var reduceSize = min(cols, wg); - for (var currSize = reduceSize >> 1; currSize > 0; currSize = reduceSize >> 1) { - reduceSize = currSize + (reduceSize & 1); - if (lindex < currSize) { - threadShared[lindex] = max(threadShared[lindex], threadShared[lindex + reduceSize]); - } - workgroupBarrier(); - } - if (lindex == 0) { - rowMaxShared = ${$}(${I("threadShared[0]",g)}); - } - workgroupBarrier(); - - // find the rows sum - var threadSum = ${$}(0.0); - for (var col = lindex; col < cols; col += wg) { - let subExp = exp(getValue(row, col, row_stride) - rowMaxShared); - threadSum += subExp; - } - threadShared[lindex] = threadSum; - workgroupBarrier(); - - for (var currSize = wg >> 1; currSize > 0; currSize = currSize >> 1) { - if (lindex < currSize) { - threadShared[lindex] = threadShared[lindex] + threadShared[lindex + currSize]; - } - workgroupBarrier(); - } - if (lindex == 0) { - rowSumShared = ${$}(${dn("threadShared[0]",g)}); - } - workgroupBarrier(); - - // calculate final value for each element in the row - for (var col = lindex; col < cols; col += wg) { - let value = exp(getValue(row, col, row_stride) - rowMaxShared) / rowSumShared; - setValue(row, col, row_stride, value); - } - }`,w=e.compute({name:"Softmax",shaderCache:{hint:`${g};${E}`,inputDependencies:["type"]},getRunData:()=>({outputs:[{dims:p,dataType:l.dataType}],dispatchGroup:{x:h},programUniforms:[{type:6,data:_}]}),getShaderSource:b},{inputs:[l],outputs:[a?-1:0]})[0];a&&e.compute(Wr(w,c),{inputs:[w]})},cb=(e,r)=>{$w(e.inputs),kw(e,r)},ub=e=>Lt({axis:e.axis})}),Oc,Iw,Aw,Fw,pb,Dx=Ve(()=>{mt(),bt(),xt(),Oc=e=>Array.from(e.getBigInt64Array(),Number),Iw=e=>{if(!e||e.length!==2)throw new Error("Tile requires 2 inputs.");if(e[0].dataType!==1&&e[0].dataType!==10&&e[0].dataType!==6&&e[0].dataType!==12)throw new Error("Tile only support float, float16, int32, and uint32 data types");if(e[1].dataType!==7)throw new Error("Tile `repeats` input should be of int64 data type");if(e[1].dims.length!==1)throw new Error("Tile `repeats` input should be 1-D");if(Oc(e[1]).length!==e[0].dims.length)throw new Error("Tile `repeats` input should have same number of elements as rank of input data tensor")},Aw=(e,r)=>{let t=[];for(let s=0;s{let t=e[0].dims,s=r??Oc(e[1]),o=Aw(t,s),n=xe.size(o),i=e[0].dataType,a=$e("input",i,t.length),l=tt("output",i,o.length),c=p=>` - const inputShape = ${a.indices(...t)}; - ${p.registerUniform("output_size","u32").declareVariables(a,l)} - ${p.mainStart()} - ${p.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let output_indices = ${l.offsetToIndices("global_idx")}; - var input_indices: ${a.type.indices}; - for (var i = 0; i < ${t.length}; i++) { - let input_dim_i = ${a.indicesGet("uniforms.input_shape","i")}; - let input_dim_value = ${l.indicesGet("output_indices","i")} % input_dim_i; - - ${a.indicesSet("input_indices","i","input_dim_value")} - } - ${l.setByOffset("global_idx",a.getByIndices("input_indices"))} - }`;return{name:"Tile",shaderCache:{hint:`${s}`,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:o,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:[{type:12,data:n},...nt(e[0].dims,o)]}),getShaderSource:c}},pb=e=>{Iw(e.inputs),e.compute(Fw(e.inputs),{inputs:[0]})}}),Ow,Dw,hb,Lx=Ve(()=>{mt(),bt(),xt(),Ow=(e,r,t,s,o)=>{let n=tt("output_data",o,t.length,4),i=$e("a_data",r[1].dataType,r[1].dims.length,4),a=$e("b_data",r[2].dataType,r[2].dims.length,4),l=$e("c_data",r[0].dataType,r[0].dims.length,4),c,p=(u,h,g)=>`select(${h}, ${u}, ${g})`;if(!s)c=n.setByOffset("global_idx",p(i.getByOffset("global_idx"),a.getByOffset("global_idx"),l.getByOffset("global_idx")));else{let u=(h,g,_="")=>{let E=`a_data[index_a${g}][component_a${g}]`,I=`b_data[index_b${g}][component_b${g}]`,M=`bool(c_data[index_c${g}] & (0xffu << (component_c${g} * 8)))`;return` - let output_indices${g} = ${n.offsetToIndices(`global_idx * 4u + ${g}u`)}; - let offset_a${g} = ${i.broadcastedIndicesToOffset(`output_indices${g}`,n)}; - let offset_b${g} = ${a.broadcastedIndicesToOffset(`output_indices${g}`,n)}; - let offset_c${g} = ${l.broadcastedIndicesToOffset(`output_indices${g}`,n)}; - let index_a${g} = offset_a${g} / 4u; - let index_b${g} = offset_b${g} / 4u; - let index_c${g} = offset_c${g} / 4u; - let component_a${g} = offset_a${g} % 4u; - let component_b${g} = offset_b${g} % 4u; - let component_c${g} = offset_c${g} % 4u; - ${h}[${g}] = ${_}(${p(E,I,M)}); - `};o===9?c=` - var data = vec4(0); - ${u("data",0,"u32")} - ${u("data",1,"u32")} - ${u("data",2,"u32")} - ${u("data",3,"u32")} - output_data[global_idx] = dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(data));`:c=` - ${u("output_data[global_idx]",0)} - ${u("output_data[global_idx]",1)} - ${u("output_data[global_idx]",2)} - ${u("output_data[global_idx]",3)} - `}return` - ${e.registerUniform("vec_size","u32").declareVariables(l,i,a,n)} - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} - ${c} - }`},Dw=e=>{let r=e[1].dims,t=e[2].dims,s=e[0].dims,o=e[1].dataType,n=!(xe.areEqual(r,t)&&xe.areEqual(t,s)),i=r,a=xe.size(r);if(n){let c=So.calcShape(So.calcShape(r,t,!1),s,!1);if(!c)throw new Error("Can't perform where op on the given tensors");i=c,a=xe.size(i)}let l=Math.ceil(a/4);return{name:"Where",shaderCache:{inputDependencies:["rank","rank","rank"]},getShaderSource:c=>Ow(c,e,i,n,o),getRunData:()=>({outputs:[{dims:i,dataType:o}],dispatchGroup:{x:Math.ceil(a/64/4)},programUniforms:[{type:12,data:l},...nt(s,r,t,i)]})}},hb=e=>{e.compute(Dw(e.inputs))}}),mb,zx=Ve(()=>{Xv(),bu(),Jv(),Yv(),Zv(),ex(),tx(),ix(),lx(),dx(),cx(),ux(),px(),hx(),mx(),fx(),_x(),gx(),wx(),yx(),Mx(),bx(),vx(),xx(),Tx(),O0(),Ex(),Px(),Cx(),Sx(),$x(),Mu(),kx(),Ix(),Ax(),Fx(),Ox(),z0(),Dx(),cn(),vu(),Lx(),mb=new Map([["Abs",[lM]],["Acos",[dM]],["Acosh",[cM]],["Add",[WM]],["ArgMax",[nM,Qc]],["ArgMin",[sM,Qc]],["Asin",[uM]],["Asinh",[pM]],["Atan",[hM]],["Atanh",[mM]],["Attention",[oM]],["AveragePool",[K0,G0]],["BatchNormalization",[iM]],["BiasAdd",[aM]],["BiasSplitGelu",[UM]],["Cast",[_M,fM]],["Ceil",[wM]],["Clip",[gM]],["Concat",[e0,t0]],["Conv",[tu,eu]],["ConvTranspose",[u0,c0]],["Cos",[yM]],["Cosh",[MM]],["CumSum",[p0,h0]],["DepthToSpace",[m0,f0]],["DequantizeLinear",[Z0,eb]],["Div",[GM]],["Einsum",[_0,g0]],["Elu",[bM,da]],["Equal",[KM]],["Erf",[vM]],["Exp",[xM]],["Expand",[w0]],["FastGelu",[y0]],["Floor",[TM]],["FusedConv",[tu,eu]],["Gather",[b0,M0]],["GatherElements",[C0,P0]],["GatherBlockQuantized",[T0,E0]],["GatherND",[v0,x0]],["Gelu",[EM]],["Gemm",[$0,S0]],["GlobalAveragePool",[q0,H0]],["GlobalMaxPool",[Y0,J0]],["Greater",[XM]],["GreaterOrEqual",[YM]],["GridSample",[k0,I0]],["GroupQueryAttention",[B0]],["HardSigmoid",[FM,AM]],["InstanceNormalization",[R0]],["LayerNormalization",[N0]],["LeakyRelu",[PM,da]],["Less",[JM]],["LessOrEqual",[ZM]],["Log",[jM]],["MatMul",[j0]],["MatMulNBits",[V0,U0]],["MaxPool",[Q0,X0]],["Mul",[HM]],["MultiHeadAttention",[F0,A0]],["Neg",[SM]],["Not",[CM]],["Pad",[W0]],["Pow",[qM]],["QuickGelu",[VM,da]],["Range",[tb]],["Reciprocal",[$M]],["ReduceMin",[Yy]],["ReduceMean",[Hy]],["ReduceMax",[Jy]],["ReduceSum",[eM]],["ReduceProd",[Zy]],["ReduceL1",[qy]],["ReduceL2",[Qy]],["ReduceLogSum",[rM]],["ReduceLogSumExp",[Xy]],["ReduceSumSquare",[tM]],["Relu",[kM]],["Resize",[nb,ob]],["RotaryEmbedding",[ib]],["ScatterND",[sb,rb]],["Sigmoid",[IM]],["Sin",[OM]],["Sinh",[DM]],["Slice",[lb,db]],["SkipLayerNormalization",[ab]],["Split",[D0,L0]],["Sqrt",[LM]],["Softmax",[cb,ub]],["Sub",[QM]],["Tan",[zM]],["Tanh",[BM]],["ThresholdedRelu",[NM,da]],["Tile",[pb]],["Transpose",[Dy,Ly]],["Where",[hb]]])}),fb,Bx=Ve(()=>{Ms(),Us(),xt(),fb=class{constructor(e){this.backend=e,this.repo=new Map,this.attributesBound=!1}getArtifact(e){return this.repo.get(e)}setArtifact(e,r){this.repo.set(e,r)}run(e,r,t,s,o){ys(e.programInfo.name);let n=this.backend.device,i=this.backend.getComputePassEncoder();this.backend.writeTimestamp(this.backend.pendingDispatchNumber*2);let a=[];for(let c of r)a.push({binding:a.length,resource:{buffer:c.buffer}});for(let c of t)a.push({binding:a.length,resource:{buffer:c.buffer}});o&&a.push({binding:a.length,resource:o});let l=n.createBindGroup({layout:e.computePipeline.getBindGroupLayout(0),entries:a,label:e.programInfo.name});if(this.backend.sessionStatus==="capturing"){let c={kernelId:this.backend.currentKernelId,computePipeline:e.computePipeline,bindGroup:l,dispatchGroup:s};this.backend.capturedCommandList.get(this.backend.currentSessionId).push(c)}i.setPipeline(e.computePipeline),i.setBindGroup(0,l),i.dispatchWorkgroups(...s),this.backend.writeTimestamp(this.backend.pendingDispatchNumber*2+1),this.backend.pendingDispatchNumber++,(this.backend.pendingDispatchNumber>=this.backend.maxDispatchNumber||this.backend.queryType==="at-passes")&&this.backend.endComputePass(),this.backend.pendingDispatchNumber>=this.backend.maxDispatchNumber&&this.backend.flush(),Zr(e.programInfo.name)}dispose(){}build(e,r){ys(e.name);let t=this.backend.device,s=[];[{feature:"shader-f16",extension:"f16"},{feature:"subgroups",extension:"subgroups"}].forEach(c=>{t.features.has(c.feature)&&s.push(`enable ${c.extension};`)});let o=Oy(r,this.backend.device.limits),n=e.getShaderSource(o),i=`${s.join(` -`)} -${o.additionalImplementations} -${n}`,a=t.createShaderModule({code:i,label:e.name});St("verbose",()=>`[WebGPU] ${e.name} shader code: ${i}`);let l=t.createComputePipeline({compute:{module:a,entryPoint:"main"},layout:"auto",label:e.name});return Zr(e.name),{programInfo:e,computePipeline:l,uniformVariablesInfo:o.variablesInfo}}normalizeDispatchGroupSize(e){let r=typeof e=="number"?e:e.x,t=typeof e=="number"?1:e.y||1,s=typeof e=="number"?1:e.z||1,o=this.backend.device.limits.maxComputeWorkgroupsPerDimension;if(r<=o&&t<=o&&s<=o)return[r,t,s];let n=r*t*s,i=Math.ceil(Math.sqrt(n));if(i>o){if(i=Math.ceil(Math.cbrt(n)),i>o)throw new Error("Total dispatch size exceeds WebGPU maximum.");return[i,i,i]}else return[i,i,1]}}}),Lw,zw,Bw,_b,Rx=Ve(()=>{Ms(),mt(),Us(),Sy(),qv(),zx(),Bx(),Lw=(e,r)=>{if(r.length!==e.length)throw new Error(`inputDependencies length ${r.length} is not equal to inputTensors length ${e.length}.`);let t=[];for(let s=0;s{var o,n;let s=e.name;return(o=e.shaderCache)!=null&&o.hint&&(s+="["+e.shaderCache.hint+"]"),s+=":"+t+`:${Lw(r,((n=e.shaderCache)==null?void 0:n.inputDependencies)??new Array(r.length).fill("dims"))}`,s},Bw=class{constructor(e){e&&(this.architecture=e.architecture,this.vendor=e.vendor)}isArchitecture(e){return this.architecture===e}isVendor(e){return this.vendor===e}},_b=class{constructor(){this.currentSessionId=null,this.currentKernelId=null,this.commandEncoder=null,this.computePassEncoder=null,this.maxDispatchNumber=16,this.pendingDispatchNumber=0,this.pendingKernels=[],this.pendingQueries=new Map,this.sessionStatus="default",this.capturedCommandList=new Map,this.capturedPendingKernels=new Map,this.sessionExternalDataMapping=new Map}get currentKernelCustomData(){if(this.currentKernelId===null)throw new Error("currentKernelCustomData(): currentKernelId is null. (should not happen)");let e=this.kernelCustomData.get(this.currentKernelId);return e||(e={},this.kernelCustomData.set(this.currentKernelId,e)),e}async initialize(e,r){this.env=e;let t=[],s={requiredLimits:{maxComputeWorkgroupStorageSize:r.limits.maxComputeWorkgroupStorageSize,maxComputeWorkgroupsPerDimension:r.limits.maxComputeWorkgroupsPerDimension,maxStorageBufferBindingSize:r.limits.maxStorageBufferBindingSize,maxBufferSize:r.limits.maxBufferSize,maxComputeInvocationsPerWorkgroup:r.limits.maxComputeInvocationsPerWorkgroup,maxComputeWorkgroupSizeX:r.limits.maxComputeWorkgroupSizeX,maxComputeWorkgroupSizeY:r.limits.maxComputeWorkgroupSizeY,maxComputeWorkgroupSizeZ:r.limits.maxComputeWorkgroupSizeZ},requiredFeatures:t},o=n=>r.features.has(n)&&t.push(n)&&!0;o("chromium-experimental-timestamp-query-inside-passes")||o("timestamp-query"),o("shader-f16"),o("subgroups"),this.device=await r.requestDevice(s),this.adapterInfo=new Bw(r.info||await r.requestAdapterInfo()),this.gpuDataManager=$y(this),this.programManager=new fb(this),this.kernels=new Map,this.kernelPersistentData=new Map,this.kernelCustomData=new Map,_u(e.logLevel,!!e.debug),this.device.onuncapturederror=n=>{n.error instanceof GPUValidationError&&console.error(`An uncaught WebGPU validation error was raised: ${n.error.message}`)},Object.defineProperty(this.env.webgpu,"device",{value:this.device,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(this.env.webgpu,"adapter",{value:r,writable:!1,enumerable:!0,configurable:!1}),this.setQueryType()}dispose(){typeof this.querySet<"u"&&this.querySet.destroy(),this.gpuDataManager.dispose()}getCommandEncoder(){return this.commandEncoder||(this.commandEncoder=this.device.createCommandEncoder()),this.commandEncoder}getComputePassEncoder(){if(!this.computePassEncoder){let e=this.getCommandEncoder(),r={};this.queryType==="at-passes"&&(r.timestampWrites={querySet:this.querySet,beginningOfPassWriteIndex:this.pendingDispatchNumber*2,endOfPassWriteIndex:this.pendingDispatchNumber*2+1}),this.computePassEncoder=e.beginComputePass(r)}return this.computePassEncoder}endComputePass(){this.computePassEncoder&&(this.computePassEncoder.end(),this.computePassEncoder=null)}flush(){if(!this.commandEncoder)return;ys(),this.endComputePass();let e;this.queryType!=="none"&&(this.commandEncoder.resolveQuerySet(this.querySet,0,this.pendingDispatchNumber*2,this.queryResolveBuffer,0),e=this.device.createBuffer({size:this.pendingDispatchNumber*2*8,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.pendingQueries.set(e,this.pendingKernels),this.pendingKernels=[],this.commandEncoder.copyBufferToBuffer(this.queryResolveBuffer,0,e,0,this.pendingDispatchNumber*2*8)),this.device.queue.submit([this.commandEncoder.finish()]),this.gpuDataManager.refreshPendingBuffers(),this.commandEncoder=null,this.pendingDispatchNumber=0,this.queryType!=="none"&&e.mapAsync(GPUMapMode.READ).then(()=>{var s;let r=new BigUint64Array(e.getMappedRange()),t=this.pendingQueries.get(e);for(let o=0;o"u"&&(this.queryTimeBase=g);let E=Number(g-this.queryTimeBase),I=Number(_-this.queryTimeBase);if(!Number.isSafeInteger(E)||!Number.isSafeInteger(I))throw new RangeError("incorrect timestamp range");if((s=this.env.webgpu.profiling)!=null&&s.ondata)this.env.webgpu.profiling.ondata({version:1,inputsMetadata:u.map(M=>({dims:M.dims,dataType:In(M.dataType)})),outputsMetadata:h.map(M=>({dims:M.dims,dataType:In(M.dataType)})),kernelId:i,kernelType:l,kernelName:c,programName:p,startTime:E,endTime:I});else{let M="";u.forEach(($,P)=>{M+=`input[${P}]: [${$.dims}] | ${In($.dataType)}, `});let y="";h.forEach(($,P)=>{y+=`output[${P}]: [${$.dims}] | ${In($.dataType)}, `}),console.log(`[profiling] kernel "${i}|${l}|${c}|${p}" ${M}${y}execution time: ${I-E} ns`)}pa("GPU",`${p}::${g}::${_}`)}e.unmap(),this.pendingQueries.delete(e)}),Zr()}run(e,r,t,s,o,n){ys(e.name);let i=[];for(let y=0;y$):t;if(p.length!==a.length)throw new Error(`Output size ${p.length} must be equal to ${a.length}.`);let u=[],h=[];for(let y=0;y=n)throw new Error(`Invalid output index: ${p[y]}`);if(p[y]===-3)continue;let $=p[y]===-1,P=p[y]===-2,b=$||P?o(a[y].dataType,a[y].dims):s(p[y],a[y].dataType,a[y].dims);if(u.push(b),b.data===0)continue;let w=this.gpuDataManager.get(b.data);if(!w)throw new Error(`no GPU data for output: ${b.data}`);if($&&this.temporaryData.push(w),P){let T=this.kernelPersistentData.get(this.currentKernelId);T||(T=[],this.kernelPersistentData.set(this.currentKernelId,T)),T.push(w)}h.push(w)}if(i.length!==r.length||h.length!==u.length){if(h.length===0)return Zr(e.name),u;throw new Error(`Program ${e.name} has zero-sized tensor(s) in inputs or outputs. This is not supported now.`)}let g;if(c){let y=0,$=[];c.forEach(T=>{let k=typeof T.data=="number"?[T.data]:T.data;if(k.length===0)return;let z=T.type===10?2:4,R,Q;T.type===10?(Q=k.length>4?16:k.length>2?8:k.length*z,R=k.length>4?16:z*k.length):(Q=k.length<=2?k.length*z:16,R=16),y=Math.ceil(y/Q)*Q,$.push(y);let q=T.type===10?8:4;y+=k.length>4?Math.ceil(k.length/q)*R:k.length*z});let P=16;y=Math.ceil(y/P)*P;let b=new ArrayBuffer(y);c.forEach((T,k)=>{let z=$[k],R=typeof T.data=="number"?[T.data]:T.data;if(T.type===6)new Int32Array(b,z,R.length).set(R);else if(T.type===12)new Uint32Array(b,z,R.length).set(R);else if(T.type===10)new Uint16Array(b,z,R.length).set(R);else if(T.type===1)new Float32Array(b,z,R.length).set(R);else throw new Error(`Unsupported uniform type: ${In(T.type)}`)});let w=this.gpuDataManager.create(y,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM);this.device.queue.writeBuffer(w.buffer,0,b,0,y),this.gpuDataManager.release(w.id),g={offset:0,size:y,buffer:w.buffer}}let _=this.programManager.normalizeDispatchGroupSize(l),E=_[1]===1&&_[2]===1,I=zw(e,r,E),M=this.programManager.getArtifact(I);if(M||(M=this.programManager.build(e,_),this.programManager.setArtifact(I,M),St("info",()=>`[artifact] key: ${I}, programName: ${e.name}`)),c&&M.uniformVariablesInfo){if(c.length!==M.uniformVariablesInfo.length)throw new Error(`Uniform variables count mismatch: expect ${M.uniformVariablesInfo.length}, got ${c.length} in program "${M.programInfo.name}".`);for(let y=0;y`[ProgramManager] run "${e.name}" (key=${I}) with ${_[0]}x${_[1]}x${_[2]}`),this.queryType!=="none"||this.sessionStatus==="capturing"){let y={kernelId:this.currentKernelId,programName:M.programInfo.name,inputTensorViews:r,outputTensorViews:u};this.pendingKernels.push(y),this.sessionStatus==="capturing"&&this.capturedPendingKernels.get(this.currentSessionId).push(y)}return this.programManager.run(M,i,h,_,g),Zr(e.name),u}upload(e,r){this.gpuDataManager.upload(e,r)}memcpy(e,r){this.gpuDataManager.memcpy(e,r)}async download(e,r){await this.gpuDataManager.download(e,r)}alloc(e){return this.gpuDataManager.create(e).id}free(e){return this.gpuDataManager.release(e)}createKernel(e,r,t,s){let o=mb.get(e);if(!o)throw new Error(`kernel not implemented: ${e}`);let n={kernelType:e,kernelName:s,kernelEntry:o[0],attributes:[o[1],t]};this.kernels.set(r,n)}releaseKernel(e){let r=this.kernelPersistentData.get(e);if(r){for(let t of r)this.gpuDataManager.release(t.id);this.kernelPersistentData.delete(e)}this.kernelCustomData.delete(e),this.kernels.delete(e)}computeKernel(e,r,t){let s=this.kernels.get(e);if(!s)throw new Error(`kernel not created: ${e}`);let o=s.kernelType,n=s.kernelName,i=s.kernelEntry,a=s.attributes;if(this.currentKernelId!==null)throw new Error(`kernel "[${o}] ${n}" is not allowed to be called recursively`);this.currentKernelId=e,a[0]&&(a[1]=a[0](a[1]),a[0]=void 0),St("info",()=>`[WebGPU] Start to run kernel "[${o}] ${n}"...`);let l=this.env.debug;this.temporaryData=[];try{return l&&this.device.pushErrorScope("validation"),i(r,a[1]),0}catch(c){return t.push(Promise.resolve(`[WebGPU] Kernel "[${o}] ${n}" failed. ${c}`)),1}finally{l&&t.push(this.device.popErrorScope().then(c=>c?`GPU validation error for kernel "[${o}] ${n}": ${c.message}`:null));for(let c of this.temporaryData)this.gpuDataManager.release(c.id);this.temporaryData=[],this.currentKernelId=null}}registerBuffer(e,r,t,s){let o=this.sessionExternalDataMapping.get(e);o||(o=new Map,this.sessionExternalDataMapping.set(e,o));let n=o.get(r),i=this.gpuDataManager.registerExternalBuffer(t,s,n);return o.set(r,[i,t]),i}unregisterBuffers(e){let r=this.sessionExternalDataMapping.get(e);r&&(r.forEach(t=>this.gpuDataManager.unregisterExternalBuffer(t[0])),this.sessionExternalDataMapping.delete(e))}getBuffer(e){let r=this.gpuDataManager.get(e);if(!r)throw new Error(`no GPU data for buffer: ${e}`);return r.buffer}createDownloader(e,r,t){return async()=>{let s=await Kc(this,e,r);return gu(s.buffer,t)}}writeTimestamp(e){this.queryType==="inside-passes"&&this.computePassEncoder.writeTimestamp(this.querySet,e)}setQueryType(){var e;this.queryType="none",(((e=this.env.webgpu.profiling)==null?void 0:e.mode)==="default"||(typeof this.env.trace>"u"?this.env.wasm.trace:this.env.trace))&&(this.device.features.has("chromium-experimental-timestamp-query-inside-passes")?this.queryType="inside-passes":this.device.features.has("timestamp-query")&&(this.queryType="at-passes"),this.queryType!=="none"&&typeof this.querySet>"u"&&(this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxDispatchNumber*2}),this.queryResolveBuffer=this.device.createBuffer({size:this.maxDispatchNumber*2*8,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.QUERY_RESOLVE})))}captureBegin(){St("info","captureBegin"),this.capturedCommandList.get(this.currentSessionId)||this.capturedCommandList.set(this.currentSessionId,[]),this.capturedPendingKernels.get(this.currentSessionId)||this.capturedPendingKernels.set(this.currentSessionId,[]),this.flush(),this.sessionStatus="capturing"}captureEnd(){St("info","captureEnd"),this.flush(),this.sessionStatus="default"}replay(){St("info","replay"),this.sessionStatus="replaying";let e=this.capturedCommandList.get(this.currentSessionId),r=this.capturedPendingKernels.get(this.currentSessionId),t=e.length;this.pendingKernels=[];for(let s=0;s=this.maxDispatchNumber||this.queryType==="at-passes")&&this.endComputePass(),this.pendingDispatchNumber>=this.maxDispatchNumber&&this.flush()}this.flush(),this.sessionStatus="default"}onCreateSession(){this.gpuDataManager.onCreateSession()}onReleaseSession(e){this.unregisterBuffers(e),this.capturedCommandList.has(e)&&this.capturedCommandList.delete(e),this.capturedPendingKernels.has(e)&&this.capturedPendingKernels.delete(e),this.gpuDataManager.onReleaseSession(e)}onRunStart(e){this.currentSessionId=e,this.setQueryType()}}}),Rw,Dc,Nw,Lc,zc,Bc,jw,gb,Nx=Ve(()=>{Us(),Rw=1,Dc=()=>Rw++,Nw=new Map([["float32",32],["float16",16],["int32",32],["uint32",32],["int64",64],["uint64",64],["int8",8],["uint8",8],["int4",4],["uint4",4]]),Lc=(e,r)=>{let t=Nw.get(e);if(!t)throw new Error("Unsupported data type.");return r.length>0?Math.ceil(r.reduce((s,o)=>s*o)*t/8):0},zc=class{constructor(e){this.sessionId=e.sessionId,this.mlContext=e.context,this.mlTensor=e.tensor,this.dataType=e.dataType,this.tensorShape=e.shape}get tensor(){return this.mlTensor}get type(){return this.dataType}get shape(){return this.tensorShape}get byteLength(){return Lc(this.dataType,this.tensorShape)}destroy(){St("verbose",()=>"[WebNN] TensorWrapper.destroy"),this.mlTensor.destroy()}write(e){this.mlContext.writeTensor(this.mlTensor,e)}async read(e){return e?this.mlContext.readTensor(this.mlTensor,e):this.mlContext.readTensor(this.mlTensor)}canReuseTensor(e,r,t){return this.mlContext===e&&this.dataType===r&&this.tensorShape.length===t.length&&this.tensorShape.every((s,o)=>s===t[o])}},Bc=class{constructor(e,r){this.tensorManager=e,this.wrapper=r}get tensorWrapper(){return this.wrapper}releaseTensor(){this.tensorWrapper&&(this.tensorManager.releaseTensor(this.tensorWrapper),this.wrapper=void 0)}async ensureTensor(e,r,t,s){let o=this.tensorManager.getMLContext(e);if(this.wrapper){if(this.wrapper.canReuseTensor(o,r,t))return this.wrapper.tensor;if(s){if(this.wrapper.byteLength!==Lc(r,t))throw new Error("Unable to copy data to tensor with different size.");this.activeUpload=new Uint8Array(await this.wrapper.read())}this.tensorManager.releaseTensor(this.wrapper)}let n=typeof MLTensorUsage>"u"?void 0:MLTensorUsage.READ|MLTensorUsage.WRITE;return this.wrapper=await this.tensorManager.getCachedTensor(e,r,t,n,!0,!0),s&&this.activeUpload&&(this.wrapper.write(this.activeUpload),this.activeUpload=void 0),this.wrapper.tensor}upload(e){if(this.wrapper)if(e.byteLength===this.wrapper.byteLength){this.wrapper.write(e);return}else St("verbose",()=>"Data size does not match tensor size. Releasing tensor."),this.releaseTensor();this.activeUpload?this.activeUpload.set(e):this.activeUpload=new Uint8Array(e)}async download(e){if(this.activeUpload)if(e){e instanceof ArrayBuffer?new Uint8Array(e).set(this.activeUpload):new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(this.activeUpload);return}else return this.activeUpload.buffer;if(!this.wrapper)throw new Error("Tensor has not been created.");return e?this.wrapper.read(e):this.wrapper.read()}},jw=class{constructor(e){this.backend=e,this.tensorTrackersById=new Map,this.freeTensors=[],this.externalTensors=new Set}getMLContext(e){let r=this.backend.getMLContext(e);if(!r)throw new Error("MLContext not found for session.");return r}reserveTensorId(){let e=Dc();return this.tensorTrackersById.set(e,new Bc(this)),e}releaseTensorId(e){let r=this.tensorTrackersById.get(e);r&&(this.tensorTrackersById.delete(e),r.tensorWrapper&&this.releaseTensor(r.tensorWrapper))}async ensureTensor(e,r,t,s,o){St("verbose",()=>`[WebNN] TensorManager.ensureTensor {tensorId: ${r}, dataType: ${t}, shape: ${s}, copyOld: ${o}}`);let n=this.tensorTrackersById.get(r);if(!n)throw new Error("Tensor not found.");return n.ensureTensor(e,t,s,o)}upload(e,r){let t=this.tensorTrackersById.get(e);if(!t)throw new Error("Tensor not found.");t.upload(r)}async download(e,r){St("verbose",()=>`[WebNN] TensorManager.download {tensorId: ${e}, dstBuffer: ${r==null?void 0:r.byteLength}}`);let t=this.tensorTrackersById.get(e);if(!t)throw new Error("Tensor not found.");return t.download(r)}releaseTensorsForSession(e){for(let r of this.freeTensors)r.sessionId===e&&r.destroy();this.freeTensors=this.freeTensors.filter(r=>r.sessionId!==e)}registerTensor(e,r,t,s){let o=this.getMLContext(e),n=Dc(),i=new zc({sessionId:e,context:o,tensor:r,dataType:t,shape:s});return this.tensorTrackersById.set(n,new Bc(this,i)),this.externalTensors.add(i),n}async getCachedTensor(e,r,t,s,o,n){let i=this.getMLContext(e);for(let[l,c]of this.freeTensors.entries())if(c.canReuseTensor(i,r,t)){St("verbose",()=>`[WebNN] Reusing tensor {dataType: ${r}, shape: ${t}}`);let p=this.freeTensors.splice(l,1)[0];return p.sessionId=e,p}St("verbose",()=>`[WebNN] MLContext.createTensor {dataType: ${r}, shape: ${t}}`);let a=await i.createTensor({dataType:r,shape:t,dimensions:t,usage:s,writable:o,readable:n});return new zc({sessionId:e,context:i,tensor:a,dataType:r,shape:t})}releaseTensor(e){this.externalTensors.has(e)&&this.externalTensors.delete(e),this.freeTensors.push(e)}},gb=(...e)=>new jw(...e)}),ql,Vw,wb,jx=Ve(()=>{mt(),zn(),Sy(),Nx(),Us(),ql=new Map([[1,"float32"],[10,"float16"],[6,"int32"],[12,"uint32"],[7,"int64"],[13,"uint64"],[22,"int4"],[21,"uint4"],[3,"int8"],[2,"uint8"],[9,"uint8"]]),Vw=(e,r)=>{if(e===r)return!0;if(e===void 0||r===void 0)return!1;let t=Object.keys(e).sort(),s=Object.keys(r).sort();return t.length===s.length&&t.every((o,n)=>o===s[n]&&e[o]===r[o])},wb=class{constructor(e){this.tensorManager=gb(this),this.mlContextBySessionId=new Map,this.sessionIdsByMLContext=new Map,this.mlContextCache=[],this.sessionGraphInputs=new Map,this.temporaryGraphInputs=[],this.temporarySessionTensorIds=new Map,_u(e.logLevel,!!e.debug)}get currentSessionId(){if(this.activeSessionId===void 0)throw new Error("No active session");return this.activeSessionId}onRunStart(e){St("verbose",()=>`[WebNN] onRunStart {sessionId: ${e}}`),this.activeSessionId=e}onRunEnd(e){St("verbose",()=>`[WebNN] onRunEnd {sessionId: ${e}}`);let r=this.temporarySessionTensorIds.get(e);if(r){for(let t of r)St("verbose",()=>`[WebNN] releasing temporary tensor {tensorId: ${t}}`),this.tensorManager.releaseTensorId(t);this.temporarySessionTensorIds.delete(e),this.activeSessionId=void 0}}async createMLContext(e){if(e instanceof GPUDevice){let t=this.mlContextCache.findIndex(s=>s.gpuDevice===e);if(t!==-1)return this.mlContextCache[t].mlContext;{let s=await navigator.ml.createContext(e);return this.mlContextCache.push({gpuDevice:e,mlContext:s}),s}}else if(e===void 0){let t=this.mlContextCache.findIndex(s=>s.options===void 0&&s.gpuDevice===void 0);if(t!==-1)return this.mlContextCache[t].mlContext;{let s=await navigator.ml.createContext();return this.mlContextCache.push({mlContext:s}),s}}let r=this.mlContextCache.findIndex(t=>Vw(t.options,e));if(r!==-1)return this.mlContextCache[r].mlContext;{let t=await navigator.ml.createContext(e);return this.mlContextCache.push({options:e,mlContext:t}),t}}registerMLContext(e,r){this.mlContextBySessionId.set(e,r);let t=this.sessionIdsByMLContext.get(r);t||(t=new Set,this.sessionIdsByMLContext.set(r,t)),t.add(e),this.temporaryGraphInputs.length>0&&(this.sessionGraphInputs.set(e,this.temporaryGraphInputs),this.temporaryGraphInputs=[])}onReleaseSession(e){this.sessionGraphInputs.delete(e);let r=this.mlContextBySessionId.get(e);if(!r)return;this.tensorManager.releaseTensorsForSession(e),this.mlContextBySessionId.delete(e);let t=this.sessionIdsByMLContext.get(r);if(t.delete(e),t.size===0){this.sessionIdsByMLContext.delete(r);let s=this.mlContextCache.findIndex(o=>o.mlContext===r);s!==-1&&this.mlContextCache.splice(s,1)}}getMLContext(e){return this.mlContextBySessionId.get(e)}reserveTensorId(){return this.tensorManager.reserveTensorId()}releaseTensorId(e){St("verbose",()=>`[WebNN] releaseTensorId {tensorId: ${e}}`),this.tensorManager.releaseTensorId(e)}async ensureTensor(e,r,t,s,o){let n=ql.get(t);if(!n)throw new Error(`Unsupported ONNX data type: ${t}`);return this.tensorManager.ensureTensor(e??this.currentSessionId,r,n,s,o)}async createTemporaryTensor(e,r,t){St("verbose",()=>`[WebNN] createTemporaryTensor {onnxDataType: ${r}, shape: ${t}}`);let s=ql.get(r);if(!s)throw new Error(`Unsupported ONNX data type: ${r}`);let o=this.tensorManager.reserveTensorId();await this.tensorManager.ensureTensor(e,o,s,t,!1);let n=this.temporarySessionTensorIds.get(e);return n?n.push(o):this.temporarySessionTensorIds.set(e,[o]),o}uploadTensor(e,r){if(!ur().shouldTransferToMLTensor)throw new Error("Trying to upload to a MLTensor while shouldTransferToMLTensor is false");St("verbose",()=>`[WebNN] uploadTensor {tensorId: ${e}, data: ${r.byteLength}}`),this.tensorManager.upload(e,r)}async downloadTensor(e,r){return this.tensorManager.download(e,r)}createMLTensorDownloader(e,r){return async()=>{let t=await this.tensorManager.download(e);return gu(t,r)}}registerMLTensor(e,r,t,s){let o=ql.get(t);if(!o)throw new Error(`Unsupported ONNX data type: ${t}`);let n=this.tensorManager.registerTensor(e,r,o,s);return St("verbose",()=>`[WebNN] registerMLTensor {tensor: ${r}, dataType: ${o}, dimensions: ${s}} -> {tensorId: ${n}}`),n}registerMLConstant(e,r,t,s,o,n){if(!n)throw new Error("External mounted files are not available.");let i=e;e.startsWith("./")&&(i=e.substring(2));let a=n.get(i);if(!a)throw new Error(`File with name ${i} not found in preloaded files.`);if(r+t>a.byteLength)throw new Error("Out of bounds: data offset and length exceed the external file data size.");let l=a.slice(r,r+t).buffer,c;switch(o.dataType){case"float32":c=new Float32Array(l);break;case"float16":c=typeof Float16Array<"u"&&Float16Array.from?new Float16Array(l):new Uint16Array(l);break;case"int32":c=new Int32Array(l);break;case"uint32":c=new Uint32Array(l);break;case"int64":c=new BigInt64Array(l);break;case"uint64":c=new BigUint64Array(l);break;case"int8":c=new Int8Array(l);break;case"int4":case"uint4":case"uint8":c=new Uint8Array(l);break;default:throw new Error(`Unsupported data type: ${o.dataType} in creating WebNN Constant from external data.`)}return St("verbose",()=>`[WebNN] registerMLConstant {dataType: ${o.dataType}, shape: ${o.shape}}}`),s.constant(o,c)}registerGraphInput(e){this.temporaryGraphInputs.push(e)}isGraphInput(e,r){let t=this.sessionGraphInputs.get(e);return t?t.includes(r):!1}flush(){}}}),yb={};ma(yb,{init:()=>Mb});var Ql,Uw,Mb,Vx=Ve(()=>{mt(),Rx(),Us(),bt(),jx(),Ql=class bb{constructor(r,t,s,o){this.module=r,this.dataType=t,this.data=s,this.dims=o}getFloat32Array(){if(this.dataType!==1)throw new Error("Invalid data type");let r=xe.size(this.dims);return r===0?new Float32Array:new Float32Array(this.module.HEAP8.buffer,this.data,r)}getBigInt64Array(){if(this.dataType!==7)throw new Error("Invalid data type");let r=xe.size(this.dims);return r===0?new BigInt64Array:new BigInt64Array(this.module.HEAP8.buffer,this.data,r)}getInt32Array(){if(this.dataType!==6)throw new Error("Invalid data type");let r=xe.size(this.dims);return r===0?new Int32Array:new Int32Array(this.module.HEAP8.buffer,this.data,r)}getUint16Array(){if(this.dataType!==10&&this.dataType!==4)throw new Error("Invalid data type");let r=xe.size(this.dims);return r===0?new Uint16Array:new Uint16Array(this.module.HEAP8.buffer,this.data,r)}reshape(r){if(xe.size(r)!==xe.size(this.dims))throw new Error("Invalid new shape");return new bb(this.module,this.dataType,this.data,r)}},Uw=class{constructor(e,r,t){this.module=e,this.backend=r,this.customDataOffset=0,this.customDataSize=0,this.adapterInfo=r.adapterInfo;let s=e.PTR_SIZE,o=t/e.PTR_SIZE,n=s===4?"i32":"i64";this.opKernelContext=Number(e.getValue(s*o++,n));let i=Number(e.getValue(s*o++,n));this.outputCount=Number(e.getValue(s*o++,n)),this.customDataOffset=Number(e.getValue(s*o++,"*")),this.customDataSize=Number(e.getValue(s*o++,n));let a=[];for(let l=0;ltypeof a=="number"?this.inputs[a]:a))??this.inputs,s=(r==null?void 0:r.outputs)??[],o=(a,l,c)=>new Ql(this.module,l,this.output(a,c),c),n=(a,l)=>{let c=An(a,l);if(!c)throw new Error(`Unsupported data type: ${a}`);let p=c>0?this.backend.gpuDataManager.create(c).id:0;return new Ql(this.module,a,p,l)};return this.backend.run(e,t,s,o,n,this.outputCount)}output(e,r){let t=this.module.stackSave();try{let s=this.module.PTR_SIZE,o=s===4?"i32":"i64",n=this.module.stackAlloc((1+r.length)*s);this.module.setValue(n,r.length,o);for(let i=0;i{let o=r.jsepInit;if(!o)throw new Error("Failed to initialize JSEP. The WebAssembly module is not built with JSEP support.");if(e==="webgpu"){let n=new _b;await n.initialize(t,s),o("webgpu",[n,i=>n.alloc(Number(i)),i=>n.free(i),(i,a,l,c=!1)=>{if(c)St("verbose",()=>`[WebGPU] jsepCopyGpuToGpu: src=${Number(i)}, dst=${Number(a)}, size=${Number(l)}`),n.memcpy(Number(i),Number(a));else{St("verbose",()=>`[WebGPU] jsepCopyCpuToGpu: dataOffset=${Number(i)}, gpuDataId=${Number(a)}, size=${Number(l)}`);let p=r.HEAPU8.subarray(Number(i>>>0),Number(i>>>0)+Number(l));n.upload(Number(a),p)}},async(i,a,l)=>{St("verbose",()=>`[WebGPU] jsepCopyGpuToCpu: gpuDataId=${i}, dataOffset=${a}, size=${l}`),await n.download(Number(i),()=>r.HEAPU8.subarray(Number(a)>>>0,Number(a+l)>>>0))},(i,a,l)=>n.createKernel(i,Number(a),l,r.UTF8ToString(r._JsepGetNodeName(Number(a)))),i=>n.releaseKernel(i),(i,a,l,c)=>{St("verbose",()=>`[WebGPU] jsepRun: sessionHandle=${l}, kernel=${i}, contextDataOffset=${a}`);let p=new Uw(r,n,Number(a));return n.computeKernel(Number(i),p,c)},()=>n.captureBegin(),()=>n.captureEnd(),()=>n.replay()])}else{let n=new wb(t);o("webnn",[n,()=>n.reserveTensorId(),i=>n.releaseTensorId(i),async(i,a,l,c,p)=>n.ensureTensor(i,a,l,c,p),(i,a)=>{n.uploadTensor(i,a)},async(i,a)=>n.downloadTensor(i,a)])}}}),Ww,Su,$u,an,Gw,ld,ku,Iu,Rc,Au,Fu,Ou,vb=Ve(()=>{Kv(),Hv(),mt(),zn(),uu(),Cy(),Ww=(e,r)=>{ur()._OrtInit(e,r)!==0&&Ot("Can't initialize onnxruntime.")},Su=async e=>{Ww(e.wasm.numThreads,nd(e.logLevel))},$u=async(e,r)=>{{let t=(Vx(),rd(yb)).init;if(r==="webgpu"){if(typeof navigator>"u"||!navigator.gpu)throw new Error("WebGPU is not supported in current environment");let s=e.webgpu.adapter;if(s){if(typeof s.limits!="object"||typeof s.features!="object"||typeof s.requestDevice!="function")throw new Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let o=e.webgpu.powerPreference;if(o!==void 0&&o!=="low-power"&&o!=="high-performance")throw new Error(`Invalid powerPreference setting: "${o}"`);let n=e.webgpu.forceFallbackAdapter;if(n!==void 0&&typeof n!="boolean")throw new Error(`Invalid forceFallbackAdapter setting: "${n}"`);if(s=await navigator.gpu.requestAdapter({powerPreference:o,forceFallbackAdapter:n}),!s)throw new Error('Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.')}await t("webgpu",ur(),e,s)}if(r==="webnn"){if(typeof navigator>"u"||!navigator.ml)throw new Error("WebNN is not supported in current environment");await t("webnn",ur(),e)}}},an=new Map,Gw=e=>{let r=ur(),t=r.stackSave();try{let s=r.PTR_SIZE,o=r.stackAlloc(2*s);r._OrtGetInputOutputCount(e,o,o+s)!==0&&Ot("Can't get session input/output count.");let n=s===4?"i32":"i64";return[Number(r.getValue(o,n)),Number(r.getValue(o+s,n))]}finally{r.stackRestore(t)}},ld=e=>{let r=ur(),t=r._malloc(e.byteLength);if(t===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${e.byteLength}.`);return r.HEAPU8.set(e,t),[t,e.byteLength]},ku=async(e,r)=>{var u,h,g;let t,s,o=ur();Array.isArray(e)?[t,s]=e:e.buffer===o.HEAPU8.buffer?[t,s]=[e.byteOffset,e.byteLength]:[t,s]=ld(e);let n=0,i=0,a=0,l=[],c=[],p=[];try{if([i,l]=Py(r),(r==null?void 0:r.externalData)&&o.mountExternalData){let b=[];for(let w of r.externalData){let T=typeof w=="string"?w:w.path;b.push(fu(typeof w=="string"?w:w.data).then(k=>{o.mountExternalData(T,k)}))}await Promise.all(b)}for(let b of(r==null?void 0:r.executionProviders)??[])if((typeof b=="string"?b:b.name)==="webnn"){if(o.shouldTransferToMLTensor=!1,typeof b!="string"){let w=b,T=w==null?void 0:w.context,k=w==null?void 0:w.gpuDevice,z=w==null?void 0:w.deviceType,R=w==null?void 0:w.powerPreference;T?o.currentContext=T:k?o.currentContext=await o.jsepCreateMLContext(k):o.currentContext=await o.jsepCreateMLContext({deviceType:z,powerPreference:R})}else o.currentContext=await o.jsepCreateMLContext();break}n=await o._OrtCreateSession(t,s,i),n===0&&Ot("Can't create a session."),(u=o.jsepOnCreateSession)==null||u.call(o),o.currentContext&&(o.jsepRegisterMLContext(n,o.currentContext),o.currentContext=void 0,o.shouldTransferToMLTensor=!0);let[_,E]=Gw(n),I=!!(r!=null&&r.enableGraphCapture),M=[],y=[],$=[];for(let b=0;b<_;b++){let w=o._OrtGetInputName(n,b);w===0&&Ot("Can't get an input name."),c.push(w),M.push(o.UTF8ToString(w))}for(let b=0;bb==="gpu-buffer"||b==="ml-tensor")&&(a=o._OrtCreateBinding(n),a===0&&Ot("Can't create IO binding."),P={handle:a,outputPreferredLocations:$,outputPreferredLocationsEncoded:$.map(b=>Gc(b))}),an.set(n,[n,c,p,P,I,!1]),[n,M,y]}catch(_){throw c.forEach(E=>o._OrtFree(E)),p.forEach(E=>o._OrtFree(E)),a!==0&&o._OrtReleaseBinding(a)!==0&&Ot("Can't release IO binding."),n!==0&&o._OrtReleaseSession(n)!==0&&Ot("Can't release session."),_}finally{o._free(t),i!==0&&o._OrtReleaseSessionOptions(i)!==0&&Ot("Can't release session options."),l.forEach(_=>o._free(_)),(g=o.unmountExternalData)==null||g.call(o)}},Iu=e=>{var l;let r=ur(),t=an.get(e);if(!t)throw new Error(`cannot release session. invalid session id: ${e}`);let[s,o,n,i,a]=t;i&&(a&&r._OrtClearBoundOutputs(i.handle)!==0&&Ot("Can't clear bound outputs."),r._OrtReleaseBinding(i.handle)!==0&&Ot("Can't release IO binding.")),(l=r.jsepOnReleaseSession)==null||l.call(r,e),o.forEach(c=>r._OrtFree(c)),n.forEach(c=>r._OrtFree(c)),r._OrtReleaseSession(s)!==0&&Ot("Can't release session."),an.delete(e)},Rc=async(e,r,t,s,o,n=!1)=>{if(!e){r.push(0);return}let i=ur(),a=i.PTR_SIZE,l=e[0],c=e[1],p=e[3],u=p,h,g;if(l==="string"&&(p==="gpu-buffer"||p==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(n&&p!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${o} when enableGraphCapture is true.`);if(p==="gpu-buffer"){let I=e[2].gpuBuffer;g=An(Eo(l),c);let M=i.jsepRegisterBuffer;if(!M)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');h=M(s,o,I,g)}else if(p==="ml-tensor"){let I=e[2].mlTensor;g=An(Eo(l),c);let M=i.jsepRegisterMLTensor;if(!M)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');h=M(s,I,Eo(l),c)}else{let I=e[2];if(Array.isArray(I)){g=a*I.length,h=i._malloc(g),t.push(h);for(let M=0;Mi.setValue(E+y*a,M,a===4?"i32":"i64"));let I=i._OrtCreateTensor(Eo(l),h,g,E,c.length,Gc(u));I===0&&Ot(`Can't create tensor for input/output. session=${s}, index=${o}.`),r.push(I)}finally{i.stackRestore(_)}},Au=async(e,r,t,s,o,n)=>{var Q,q,U;let i=ur(),a=i.PTR_SIZE,l=an.get(e);if(!l)throw new Error(`cannot run inference. invalid session id: ${e}`);let c=l[0],p=l[1],u=l[2],h=l[3],g=l[4],_=l[5],E=r.length,I=s.length,M=0,y=[],$=[],P=[],b=[],w=i.stackSave(),T=i.stackAlloc(E*a),k=i.stackAlloc(E*a),z=i.stackAlloc(I*a),R=i.stackAlloc(I*a);try{[M,y]=Ey(n);for(let J=0;JMe*K,1);N=In(se);let He=h==null?void 0:h.outputPreferredLocations[s[J]];if(N==="string"){if(He==="gpu-buffer"||He==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let Me=[];for(let K=0;K0){let Me=i.jsepGetBuffer;if(!Me)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let K=Me(O),j=An(se,ke);if(j===void 0||!hu(N))throw new Error(`Unsupported data type: ${N}`);he=!0,H.push([N,_e,{gpuBuffer:K,download:i.jsepCreateDownloader(K,j,N),dispose:()=>{i._OrtReleaseTensor(oe)!==0&&Ot("Can't release tensor.")}},"gpu-buffer"])}else if(He==="ml-tensor"&&ke>0){let Me=i.jsepEnsureTensor;if(!Me)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(An(se,ke)===void 0||!mu(N))throw new Error(`Unsupported data type: ${N}`);let K=await Me(e,O,se,_e,!1);he=!0,H.push([N,_e,{mlTensor:K,download:i.jsepCreateMLTensorDownloader(O,N),dispose:()=>{i.jsepReleaseTensorId(O),i._OrtReleaseTensor(oe)}},"ml-tensor"])}else{let Me=pu(N),K=new Me(ke);new Uint8Array(K.buffer,K.byteOffset,K.byteLength).set(i.HEAPU8.subarray(O,O+K.byteLength)),H.push([N,_e,K,"cpu"])}}finally{i.stackRestore(ae),N==="string"&&O&&i._free(O),he||i._OrtReleaseTensor(oe),(U=i.jsepOnRunEnd)==null||U.call(i,c)}}return h&&!g&&(i._OrtClearBoundOutputs(h.handle)!==0&&Ot("Can't clear bound outputs."),an.set(e,[c,p,u,h,g,!1])),H}finally{i.stackRestore(w),$.forEach(Z=>i._OrtReleaseTensor(Z)),P.forEach(Z=>i._OrtReleaseTensor(Z)),b.forEach(Z=>i._free(Z)),M!==0&&i._OrtReleaseRunOptions(M),y.forEach(Z=>i._free(Z))}},Fu=e=>{let r=ur(),t=an.get(e);if(!t)throw new Error("invalid session id");let s=t[0],o=r._OrtEndProfiling(s);o===0&&Ot("Can't get an profile file name."),r._OrtFree(o)},Ou=e=>{let r=[];for(let t of e){let s=t[2];!Array.isArray(s)&&"buffer"in s&&r.push(s.buffer)}return r}}),ln,zr,xo,oa,ia,Xl,Nc,Jl,Cn,Sn,Kw,xb,Tb,Eb,Pb,Cb,Sb,$b,kb=Ve(()=>{Ms(),vb(),zn(),du(),ln=()=>!!Kt.wasm.proxy&&typeof document<"u",xo=!1,oa=!1,ia=!1,Jl=new Map,Cn=(e,r)=>{let t=Jl.get(e);t?t.push(r):Jl.set(e,[r])},Sn=()=>{if(xo||!oa||ia||!zr)throw new Error("worker not ready")},Kw=e=>{switch(e.data.type){case"init-wasm":xo=!1,e.data.err?(ia=!0,Nc[1](e.data.err)):(oa=!0,Nc[0]()),Xl&&(URL.revokeObjectURL(Xl),Xl=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let r=Jl.get(e.data.type);e.data.err?r.shift()[1](e.data.err):r.shift()[0](e.data.out);break}}},xb=async()=>{if(!oa){if(xo)throw new Error("multiple calls to 'initWasm()' detected.");if(ia)throw new Error("previous call to 'initWasm()' failed.");if(xo=!0,ln())return new Promise((e,r)=>{zr==null||zr.terminate(),xy().then(([t,s])=>{try{zr=s,zr.onerror=n=>r(n),zr.onmessage=Kw,Nc=[e,r];let o={type:"init-wasm",in:Kt};!o.in.wasm.wasmPaths&&(t||Wc)&&(o.in.wasm.wasmPaths={wasm:new URL("/assets/ort-wasm-simd-threaded.jsep-BAR87mbD.wasm",import.meta.url).href}),zr.postMessage(o),Xl=t}catch(o){r(o)}},r)});try{await cu(Kt.wasm),await Su(Kt),oa=!0}catch(e){throw ia=!0,e}finally{xo=!1}}},Tb=async e=>{if(ln())return Sn(),new Promise((r,t)=>{Cn("init-ep",[r,t]);let s={type:"init-ep",in:{epName:e,env:Kt}};zr.postMessage(s)});await $u(Kt,e)},Eb=async e=>ln()?(Sn(),new Promise((r,t)=>{Cn("copy-from",[r,t]);let s={type:"copy-from",in:{buffer:e}};zr.postMessage(s,[e.buffer])})):ld(e),Pb=async(e,r)=>{if(ln()){if(r!=null&&r.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return Sn(),new Promise((t,s)=>{Cn("create",[t,s]);let o={type:"create",in:{model:e,options:{...r}}},n=[];e instanceof Uint8Array&&n.push(e.buffer),zr.postMessage(o,n)})}else return ku(e,r)},Cb=async e=>{if(ln())return Sn(),new Promise((r,t)=>{Cn("release",[r,t]);let s={type:"release",in:e};zr.postMessage(s)});Iu(e)},Sb=async(e,r,t,s,o,n)=>{if(ln()){if(t.some(i=>i[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(o.some(i=>i))throw new Error("pre-allocated output tensor is not supported for proxy.");return Sn(),new Promise((i,a)=>{Cn("run",[i,a]);let l=t,c={type:"run",in:{sessionId:e,inputIndices:r,inputs:l,outputIndices:s,options:n}};zr.postMessage(c,Ou(l))})}else return Au(e,r,t,s,o,n)},$b=async e=>{if(ln())return Sn(),new Promise((r,t)=>{Cn("end-profiling",[r,t]);let s={type:"end-profiling",in:e};zr.postMessage(s)});Fu(e)}}),jc,Hw,Ib,Ux=Ve(()=>{Ms(),kb(),mt(),lu(),Cy(),jc=(e,r)=>{switch(e.location){case"cpu":return[e.type,e.dims,e.data,"cpu"];case"gpu-buffer":return[e.type,e.dims,{gpuBuffer:e.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[e.type,e.dims,{mlTensor:e.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${e.location} for ${r()}`)}},Hw=e=>{switch(e[3]){case"cpu":return new gs(e[0],e[2],e[1]);case"gpu-buffer":{let r=e[0];if(!hu(r))throw new Error(`not supported data type: ${r} for deserializing GPU tensor`);let{gpuBuffer:t,download:s,dispose:o}=e[2];return gs.fromGpuBuffer(t,{dataType:r,dims:e[1],download:s,dispose:o})}case"ml-tensor":{let r=e[0];if(!mu(r))throw new Error(`not supported data type: ${r} for deserializing MLTensor tensor`);let{mlTensor:t,download:s,dispose:o}=e[2];return gs.fromMLTensor(t,{dataType:r,dims:e[1],download:s,dispose:o})}default:throw new Error(`invalid data location: ${e[3]}`)}},Ib=class{async fetchModelAndCopyToWasmMemory(e){return Eb(await fu(e))}async loadModel(e,r){ys();let t;typeof e=="string"?t=await this.fetchModelAndCopyToWasmMemory(e):t=e,[this.sessionId,this.inputNames,this.outputNames]=await Pb(t,r),Zr()}async dispose(){return Cb(this.sessionId)}async run(e,r,t){ys();let s=[],o=[];Object.entries(e).forEach(u=>{let h=u[0],g=u[1],_=this.inputNames.indexOf(h);if(_===-1)throw new Error(`invalid input '${h}'`);s.push(g),o.push(_)});let n=[],i=[];Object.entries(r).forEach(u=>{let h=u[0],g=u[1],_=this.outputNames.indexOf(h);if(_===-1)throw new Error(`invalid output '${h}'`);n.push(g),i.push(_)});let a=s.map((u,h)=>jc(u,()=>`input "${this.inputNames[o[h]]}"`)),l=n.map((u,h)=>u?jc(u,()=>`output "${this.outputNames[i[h]]}"`):null),c=await Sb(this.sessionId,o,a,i,l,t),p={};for(let u=0;unu,initializeFlags:()=>su,wasmBackend:()=>Fb});var su,nu,Fb,Wx=Ve(()=>{Ms(),kb(),Ux(),su=()=>{if((typeof Kt.wasm.initTimeout!="number"||Kt.wasm.initTimeout<0)&&(Kt.wasm.initTimeout=0),Kt.wasm.simd===!1&&console.warn('Deprecated property "env.wasm.simd" is set to false. non-SIMD build is no longer provided, and this setting will be ignored.'),typeof Kt.wasm.proxy!="boolean"&&(Kt.wasm.proxy=!1),typeof Kt.wasm.trace!="boolean"&&(Kt.wasm.trace=!1),typeof Kt.wasm.numThreads!="number"||!Number.isInteger(Kt.wasm.numThreads)||Kt.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)Kt.wasm.numThreads=1;else{let e=typeof navigator>"u"?$v("node:os").cpus().length:navigator.hardwareConcurrency;Kt.wasm.numThreads=Math.min(4,Math.ceil((e||1)/2))}},nu=class{async init(e){su(),await xb(),await Tb(e)}async createInferenceSessionHandler(e,r){let t=new Ib;return await t.loadModel(e,r),Promise.resolve(t)}},Fb=new nu});Ms();Ms();Ms();var Gx="1.22.0-dev.20250306-ccf8fdd9ea",Kx=gy;{let e=(Wx(),rd(Ab)).wasmBackend;Fn("webgpu",e,5),Fn("webnn",e,5),Fn("cpu",e,10),Fn("wasm",e,10)}Object.defineProperty(Kt.versions,"web",{value:Gx,enumerable:!0});/** -* @license -* Copyright 2021 Google LLC. All Rights Reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============================================================================= -*//** - * @license - * Copyright 2020 Google LLC. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================================= - *//** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================================= - */const Hx=Object.freeze(Object.defineProperty({__proto__:null,get InferenceSession(){return au},get TRACE(){return pa},get TRACE_FUNC_BEGIN(){return ys},get TRACE_FUNC_END(){return Zr},get Tensor(){return gs},default:Kx,get env(){return Kt},get registerBackend(){return Fn}},Symbol.toStringTag,{value:"Module"}));var Vs={},qx={"onnxruntime-common":e=>{e.exports=Ev},"onnxruntime-web":e=>{e.exports=Hx},"?2ce3":()=>{},"?7a2c":()=>{},"?a42a":()=>{},"?2b25":()=>{},"?569f":()=>{},"?3f59":()=>{},"?154a":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,r,t)=>{t.r(r),t.d(r,{Environment:()=>Ae,Interpreter:()=>Ie,Template:()=>We,parse:()=>N,tokenize:()=>u});var s=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",NullLiteral:"NullLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator",Macro:"Macro",EndMacro:"EndMacro"}),o=Object.freeze({set:s.Set,for:s.For,in:s.In,is:s.Is,if:s.If,else:s.Else,endif:s.EndIf,elif:s.ElseIf,endfor:s.EndFor,and:s.And,or:s.Or,not:s.Not,"not in":s.NotIn,macro:s.Macro,endmacro:s.EndMacro,true:s.BooleanLiteral,false:s.BooleanLiteral,none:s.NullLiteral,True:s.BooleanLiteral,False:s.BooleanLiteral,None:s.NullLiteral}),n=class{constructor(D,ee){this.value=D,this.type=ee}};function i(D){return/\w/.test(D)}function a(D){return/[0-9]/.test(D)}var l=[["{%",s.OpenStatement],["%}",s.CloseStatement],["{{",s.OpenExpression],["}}",s.CloseExpression],["(",s.OpenParen],[")",s.CloseParen],["{",s.OpenCurlyBracket],["}",s.CloseCurlyBracket],["[",s.OpenSquareBracket],["]",s.CloseSquareBracket],[",",s.Comma],[".",s.Dot],[":",s.Colon],["|",s.Pipe],["<=",s.ComparisonBinaryOperator],[">=",s.ComparisonBinaryOperator],["==",s.ComparisonBinaryOperator],["!=",s.ComparisonBinaryOperator],["<",s.ComparisonBinaryOperator],[">",s.ComparisonBinaryOperator],["+",s.AdditiveBinaryOperator],["-",s.AdditiveBinaryOperator],["*",s.MultiplicativeBinaryOperator],["/",s.MultiplicativeBinaryOperator],["%",s.MultiplicativeBinaryOperator],["=",s.Equals]],c=new Map([["n",` -`],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function p(D,ee={}){return D.endsWith(` -`)&&(D=D.slice(0,-1)),D=D.replace(/{#.*?#}/gs,"{##}"),ee.lstrip_blocks&&(D=D.replace(/^[ \t]*({[#%])/gm,"$1")),ee.trim_blocks&&(D=D.replace(/([#%]})\n/g,"$1")),D.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}function u(D,ee={}){var ve,Re,Fe;const B=[],te=p(D,ee);let de=0;const be=je=>{let qe="";for(;je(te[de]);){if(te[de]==="\\"){if(++de,de>=te.length)throw new SyntaxError("Unexpected end of input");const Xe=te[de++],ut=c.get(Xe);if(ut===void 0)throw new SyntaxError(`Unexpected escaped character: ${Xe}`);qe+=ut;continue}if(qe+=te[de++],de>=te.length)throw new SyntaxError("Unexpected end of input")}return qe};e:for(;de0){B.push(new n(Xe,s.Text));continue}}be(Xe=>/\s/.test(Xe));const qe=te[de];if(qe==="-"||qe==="+"){const Xe=(Re=B.at(-1))==null?void 0:Re.type;if(Xe===s.Text||Xe===void 0)throw new SyntaxError(`Unexpected character: ${qe}`);switch(Xe){case s.Identifier:case s.NumericLiteral:case s.BooleanLiteral:case s.NullLiteral:case s.StringLiteral:case s.CloseParen:case s.CloseSquareBracket:break;default:{++de;const ut=be(a);B.push(new n(`${qe}${ut}`,ut.length>0?s.NumericLiteral:s.UnaryOperator));continue}}}for(const[Xe,ut]of l)if(te.slice(de,de+Xe.length)===Xe){B.push(new n(Xe,ut)),de+=Xe.length;continue e}if(qe==="'"||qe==='"'){++de;const Xe=be(ut=>ut!==qe);B.push(new n(Xe,s.StringLiteral)),++de;continue}if(a(qe)){const Xe=be(a);B.push(new n(Xe,s.NumericLiteral));continue}if(i(qe)){const Xe=be(i),ut=Object.hasOwn(o,Xe)?o[Xe]:s.Identifier;ut===s.In&&((Fe=B.at(-1))==null?void 0:Fe.type)===s.Not?(B.pop(),B.push(new n("not in",s.NotIn))):B.push(new n(Xe,ut));continue}throw new SyntaxError(`Unexpected character: ${qe}`)}return B}var h=class{constructor(){re(this,"type","Statement")}},g=class extends h{constructor(ee){super();re(this,"type","Program");this.body=ee}},_=class extends h{constructor(ee,B,te){super();re(this,"type","If");this.test=ee,this.body=B,this.alternate=te}},E=class extends h{constructor(ee,B,te,de){super();re(this,"type","For");this.loopvar=ee,this.iterable=B,this.body=te,this.defaultBlock=de}},I=class extends h{constructor(ee,B){super();re(this,"type","Set");this.assignee=ee,this.value=B}},M=class extends h{constructor(ee,B,te){super();re(this,"type","Macro");this.name=ee,this.args=B,this.body=te}},y=class extends h{constructor(){super(...arguments);re(this,"type","Expression")}},$=class extends y{constructor(ee,B,te){super();re(this,"type","MemberExpression");this.object=ee,this.property=B,this.computed=te}},P=class extends y{constructor(ee,B){super();re(this,"type","CallExpression");this.callee=ee,this.args=B}},b=class extends y{constructor(ee){super();re(this,"type","Identifier");this.value=ee}},w=class extends y{constructor(ee){super();re(this,"type","Literal");this.value=ee}},T=class extends w{constructor(){super(...arguments);re(this,"type","NumericLiteral")}},k=class extends w{constructor(){super(...arguments);re(this,"type","StringLiteral")}},z=class extends w{constructor(){super(...arguments);re(this,"type","BooleanLiteral")}},R=class extends w{constructor(){super(...arguments);re(this,"type","NullLiteral")}},Q=class extends w{constructor(){super(...arguments);re(this,"type","ArrayLiteral")}},q=class extends w{constructor(){super(...arguments);re(this,"type","TupleLiteral")}},U=class extends w{constructor(){super(...arguments);re(this,"type","ObjectLiteral")}},Z=class extends y{constructor(ee,B,te){super();re(this,"type","BinaryExpression");this.operator=ee,this.left=B,this.right=te}},H=class extends y{constructor(ee,B){super();re(this,"type","FilterExpression");this.operand=ee,this.filter=B}},J=class extends y{constructor(ee,B){super();re(this,"type","SelectExpression");this.iterable=ee,this.test=B}},oe=class extends y{constructor(ee,B,te){super();re(this,"type","TestExpression");this.operand=ee,this.negate=B,this.test=te}},ae=class extends y{constructor(ee,B){super();re(this,"type","UnaryExpression");this.operator=ee,this.argument=B}},ce=class extends y{constructor(ee=void 0,B=void 0,te=void 0){super();re(this,"type","SliceExpression");this.start=ee,this.stop=B,this.step=te}},he=class extends y{constructor(ee,B){super();re(this,"type","KeywordArgumentExpression");this.key=ee,this.value=B}};function N(D){const ee=new g([]);let B=0;function te(Be,et){const ot=D[B++];if(!ot||ot.type!==Be)throw new Error(`Parser Error: ${et}. ${ot.type} !== ${Be}.`);return ot}function de(){switch(D[B].type){case s.Text:return Re();case s.OpenStatement:return Fe();case s.OpenExpression:return je();default:throw new SyntaxError(`Unexpected token type: ${D[B].type}`)}}function be(...Be){return B+Be.length<=D.length&&Be.some((et,ot)=>et!==D[B+ot].type)}function ve(...Be){return B+Be.length<=D.length&&Be.every((et,ot)=>et===D[B+ot].type)}function Re(){return new k(te(s.Text,"Expected text token").value)}function Fe(){te(s.OpenStatement,"Expected opening statement token");let Be;switch(D[B].type){case s.Set:++B,Be=qe(),te(s.CloseStatement,"Expected closing statement token");break;case s.If:++B,Be=Xe(),te(s.OpenStatement,"Expected {% token"),te(s.EndIf,"Expected endif token"),te(s.CloseStatement,"Expected %} token");break;case s.Macro:++B,Be=ut(),te(s.OpenStatement,"Expected {% token"),te(s.EndMacro,"Expected endmacro token"),te(s.CloseStatement,"Expected %} token");break;case s.For:++B,Be=nr(),te(s.OpenStatement,"Expected {% token"),te(s.EndFor,"Expected endfor token"),te(s.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${D[B].type}`)}return Be}function je(){te(s.OpenExpression,"Expected opening expression token");const Be=jt();return te(s.CloseExpression,"Expected closing expression token"),Be}function qe(){const Be=jt();if(ve(s.Equals)){++B;const et=qe();return new I(Be,et)}return Be}function Xe(){var rr,zt,Sr,ss,ns,Tr,os,is;const Be=jt();te(s.CloseStatement,"Expected closing statement token");const et=[],ot=[];for(;!(((rr=D[B])==null?void 0:rr.type)===s.OpenStatement&&(((zt=D[B+1])==null?void 0:zt.type)===s.ElseIf||((Sr=D[B+1])==null?void 0:Sr.type)===s.Else||((ss=D[B+1])==null?void 0:ss.type)===s.EndIf));)et.push(de());if(((ns=D[B])==null?void 0:ns.type)===s.OpenStatement&&((Tr=D[B+1])==null?void 0:Tr.type)!==s.EndIf)if(++B,ve(s.ElseIf))te(s.ElseIf,"Expected elseif token"),ot.push(Xe());else for(te(s.Else,"Expected else token"),te(s.CloseStatement,"Expected closing statement token");!(((os=D[B])==null?void 0:os.type)===s.OpenStatement&&((is=D[B+1])==null?void 0:is.type)===s.EndIf);)ot.push(de());return new _(Be,et,ot)}function ut(){const Be=hr();if(Be.type!=="Identifier")throw new SyntaxError("Expected identifier following macro statement");const et=Gr();te(s.CloseStatement,"Expected closing statement token");const ot=[];for(;be(s.OpenStatement,s.EndMacro);)ot.push(de());return new M(Be,et,ot)}function wt(Be=!1){const et=Be?hr:jt,ot=[et()],rr=ve(s.Comma);for(;rr&&(++B,ot.push(et()),!!ve(s.Comma)););return rr?new q(ot):ot[0]}function nr(){const Be=wt(!0);if(!(Be instanceof b||Be instanceof q))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${Be.type} instead`);te(s.In,"Expected `in` keyword following loop variable");const et=jt();te(s.CloseStatement,"Expected closing statement token");const ot=[];for(;be(s.OpenStatement,s.EndFor)&&be(s.OpenStatement,s.Else);)ot.push(de());const rr=[];if(ve(s.OpenStatement,s.Else))for(++B,++B,te(s.CloseStatement,"Expected closing statement token");be(s.OpenStatement,s.EndFor);)rr.push(de());return new E(Be,et,ot,rr)}function jt(){return ar()}function ar(){const Be=es();if(ve(s.If)){++B;const et=es();if(ve(s.Else)){++B;const ot=es();return new _(et,[Be],[ot])}else return new J(Be,et)}return Be}function es(){let Be=ks();for(;ve(s.Or);){const et=D[B];++B;const ot=ks();Be=new Z(et,Be,ot)}return Be}function ks(){let Be=Or();for(;ve(s.And);){const et=D[B];++B;const ot=Or();Be=new Z(et,Be,ot)}return Be}function Or(){let Be;for(;ve(s.Not);){const et=D[B];++B;const ot=Or();Be=new ae(et,ot)}return Be??ts()}function ts(){let Be=Is();for(;ve(s.ComparisonBinaryOperator)||ve(s.In)||ve(s.NotIn);){const et=D[B];++B;const ot=Is();Be=new Z(et,Be,ot)}return Be}function Is(){let Be=vs();for(;ve(s.AdditiveBinaryOperator);){const et=D[B];++B;const ot=vs();Be=new Z(et,Be,ot)}return Be}function Br(){const Be=bs(hr());return ve(s.OpenParen)?dt(Be):Be}function dt(Be){let et=new P(Be,Gr());return et=bs(et),ve(s.OpenParen)&&(et=dt(et)),et}function Gr(){te(s.OpenParen,"Expected opening parenthesis for arguments list");const Be=Rr();return te(s.CloseParen,"Expected closing parenthesis for arguments list"),Be}function Rr(){const Be=[];for(;!ve(s.CloseParen);){let et=jt();if(ve(s.Equals)){if(++B,!(et instanceof b))throw new SyntaxError("Expected identifier for keyword argument");const ot=jt();et=new he(et,ot)}Be.push(et),ve(s.Comma)&&++B}return Be}function rs(){const Be=[];let et=!1;for(;!ve(s.CloseSquareBracket);)ve(s.Colon)?(Be.push(void 0),++B,et=!0):(Be.push(jt()),ve(s.Colon)&&(++B,et=!0));if(Be.length===0)throw new SyntaxError("Expected at least one argument for member/slice expression");if(et){if(Be.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new ce(...Be)}return Be[0]}function bs(Be){for(;ve(s.Dot)||ve(s.OpenSquareBracket);){const et=D[B];++B;let ot;const rr=et.type!==s.Dot;if(rr)ot=rs(),te(s.CloseSquareBracket,"Expected closing square bracket");else if(ot=hr(),ot.type!=="Identifier")throw new SyntaxError("Expected identifier following dot operator");Be=new $(Be,ot,rr)}return Be}function vs(){let Be=xs();for(;ve(s.MultiplicativeBinaryOperator);){const et=D[B];++B;const ot=xs();Be=new Z(et,Be,ot)}return Be}function xs(){let Be=As();for(;ve(s.Is);){++B;const et=ve(s.Not);et&&++B;let ot=hr();if(ot instanceof z?ot=new b(ot.value.toString()):ot instanceof R&&(ot=new b("none")),!(ot instanceof b))throw new SyntaxError("Expected identifier for the test");Be=new oe(Be,et,ot)}return Be}function As(){let Be=Br();for(;ve(s.Pipe);){++B;let et=hr();if(!(et instanceof b))throw new SyntaxError("Expected identifier for the filter");ve(s.OpenParen)&&(et=dt(et)),Be=new H(Be,et)}return Be}function hr(){const Be=D[B];switch(Be.type){case s.NumericLiteral:return++B,new T(Number(Be.value));case s.StringLiteral:return++B,new k(Be.value);case s.BooleanLiteral:return++B,new z(Be.value.toLowerCase()==="true");case s.NullLiteral:return++B,new R(null);case s.Identifier:return++B,new b(Be.value);case s.OpenParen:{++B;const et=wt();if(D[B].type!==s.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${D[B].type} instead`);return++B,et}case s.OpenSquareBracket:{++B;const et=[];for(;!ve(s.CloseSquareBracket);)et.push(jt()),ve(s.Comma)&&++B;return++B,new Q(et)}case s.OpenCurlyBracket:{++B;const et=new Map;for(;!ve(s.CloseCurlyBracket);){const ot=jt();te(s.Colon,"Expected colon between key and value in object literal");const rr=jt();et.set(ot,rr),ve(s.Comma)&&++B}return++B,new U(et)}default:throw new SyntaxError(`Unexpected token: ${Be.type}`)}}for(;B=0?(ee=(ee??(ee=0))<0?Math.max(D.length+ee,0):Math.min(ee,D.length),B=(B??(B=D.length))<0?Math.max(D.length+B,0):Math.min(B,D.length)):(ee=(ee??(ee=D.length-1))<0?Math.max(D.length+ee,-1):Math.min(ee,D.length-1),B=(B??(B=-1))<-1?Math.max(D.length+B,-1):Math.min(B,D.length-1));const be=[];for(let ve=ee;de*veee.toUpperCase())}var X=class{constructor(D=void 0){re(this,"type","RuntimeValue");re(this,"value");re(this,"builtins",new Map);this.value=D}__bool__(){return new ke(!!this.value)}},we=class extends X{constructor(){super(...arguments);re(this,"type","NumericValue")}},_e=class extends X{constructor(){super(...arguments);re(this,"type","StringValue");re(this,"builtins",new Map([["upper",new me(()=>new _e(this.value.toUpperCase()))],["lower",new me(()=>new _e(this.value.toLowerCase()))],["strip",new me(()=>new _e(this.value.trim()))],["title",new me(()=>new _e(se(this.value)))],["length",new we(this.value.length)],["rstrip",new me(()=>new _e(this.value.trimEnd()))],["lstrip",new me(()=>new _e(this.value.trimStart()))],["split",new me(ee=>{const B=ee[0]??new Pe;if(!(B instanceof _e||B instanceof Pe))throw new Error("sep argument must be a string or null");const te=ee[1]??new we(-1);if(!(te instanceof we))throw new Error("maxsplit argument must be a number");let de=[];if(B instanceof Pe){const be=this.value.trimStart();for(const{0:ve,index:Re}of be.matchAll(/\S+/g)){if(te.value!==-1&&de.length>=te.value&&Re!==void 0){de.push(ve+be.slice(Re+ve.length));break}de.push(ve)}}else{if(B.value==="")throw new Error("empty separator");de=this.value.split(B.value),te.value!==-1&&de.length>te.value&&de.push(de.splice(te.value).join(B.value))}return new K(de.map(be=>new _e(be)))})]]))}},ke=class extends X{constructor(){super(...arguments);re(this,"type","BooleanValue")}},He=class extends X{constructor(){super(...arguments);re(this,"type","ObjectValue");re(this,"builtins",new Map([["get",new me(([ee,B])=>{if(!(ee instanceof _e))throw new Error(`Object key must be a string: got ${ee.type}`);return this.value.get(ee.value)??B??new Pe})],["items",new me(()=>new K(Array.from(this.value.entries()).map(([ee,B])=>new K([new _e(ee),B]))))]]))}__bool__(){return new ke(this.value.size>0)}},Me=class extends He{constructor(){super(...arguments);re(this,"type","KeywordArgumentsValue")}},K=class extends X{constructor(){super(...arguments);re(this,"type","ArrayValue");re(this,"builtins",new Map([["length",new we(this.value.length)]]))}__bool__(){return new ke(this.value.length>0)}},j=class extends K{constructor(){super(...arguments);re(this,"type","TupleValue")}},me=class extends X{constructor(){super(...arguments);re(this,"type","FunctionValue")}},Pe=class extends X{constructor(){super(...arguments);re(this,"type","NullValue")}},Te=class extends X{constructor(){super(...arguments);re(this,"type","UndefinedValue")}},Ae=class{constructor(D){re(this,"variables",new Map([["namespace",new me(D=>{if(D.length===0)return new He(new Map);if(D.length!==1||!(D[0]instanceof He))throw new Error("`namespace` expects either zero arguments or a single object argument");return D[0]})]]));re(this,"tests",new Map([["boolean",D=>D.type==="BooleanValue"],["callable",D=>D instanceof me],["odd",D=>{if(D.type!=="NumericValue")throw new Error(`Cannot apply test "odd" to type: ${D.type}`);return D.value%2!==0}],["even",D=>{if(D.type!=="NumericValue")throw new Error(`Cannot apply test "even" to type: ${D.type}`);return D.value%2===0}],["false",D=>D.type==="BooleanValue"&&!D.value],["true",D=>D.type==="BooleanValue"&&D.value],["none",D=>D.type==="NullValue"],["string",D=>D.type==="StringValue"],["number",D=>D.type==="NumericValue"],["integer",D=>D.type==="NumericValue"&&Number.isInteger(D.value)],["iterable",D=>D.type==="ArrayValue"||D.type==="StringValue"],["mapping",D=>D.type==="ObjectValue"],["lower",D=>{const ee=D.value;return D.type==="StringValue"&&ee===ee.toLowerCase()}],["upper",D=>{const ee=D.value;return D.type==="StringValue"&&ee===ee.toUpperCase()}],["none",D=>D.type==="NullValue"],["defined",D=>D.type!=="UndefinedValue"],["undefined",D=>D.type==="UndefinedValue"],["equalto",(D,ee)=>D.value===ee.value],["eq",(D,ee)=>D.value===ee.value]]));this.parent=D}set(D,ee){return this.declareVariable(D,Le(ee))}declareVariable(D,ee){if(this.variables.has(D))throw new SyntaxError(`Variable already declared: ${D}`);return this.variables.set(D,ee),ee}setVariable(D,ee){return this.variables.set(D,ee),ee}resolve(D){if(this.variables.has(D))return this;if(this.parent)return this.parent.resolve(D);throw new Error(`Unknown variable: ${D}`)}lookupVariable(D){try{return this.resolve(D).variables.get(D)??new Te}catch{return new Te}}},Ie=class{constructor(D){re(this,"global");this.global=D??new Ae}run(D){return this.evaluate(D,this.global)}evaluateBinaryExpression(D,ee){const B=this.evaluate(D.left,ee);switch(D.operator.value){case"and":return B.__bool__().value?this.evaluate(D.right,ee):B;case"or":return B.__bool__().value?B:this.evaluate(D.right,ee)}const te=this.evaluate(D.right,ee);switch(D.operator.value){case"==":return new ke(B.value==te.value);case"!=":return new ke(B.value!=te.value)}if(B instanceof Te||te instanceof Te)throw new Error("Cannot perform operation on undefined values");if(B instanceof Pe||te instanceof Pe)throw new Error("Cannot perform operation on null values");if(B instanceof we&&te instanceof we)switch(D.operator.value){case"+":return new we(B.value+te.value);case"-":return new we(B.value-te.value);case"*":return new we(B.value*te.value);case"/":return new we(B.value/te.value);case"%":return new we(B.value%te.value);case"<":return new ke(B.value":return new ke(B.value>te.value);case">=":return new ke(B.value>=te.value);case"<=":return new ke(B.value<=te.value)}else if(B instanceof K&&te instanceof K)switch(D.operator.value){case"+":return new K(B.value.concat(te.value))}else if(te instanceof K){const de=te.value.find(be=>be.value===B.value)!==void 0;switch(D.operator.value){case"in":return new ke(de);case"not in":return new ke(!de)}}if(B instanceof _e||te instanceof _e)switch(D.operator.value){case"+":return new _e(B.value.toString()+te.value.toString())}if(B instanceof _e&&te instanceof _e)switch(D.operator.value){case"in":return new ke(te.value.includes(B.value));case"not in":return new ke(!te.value.includes(B.value))}if(B instanceof _e&&te instanceof He)switch(D.operator.value){case"in":return new ke(te.value.has(B.value));case"not in":return new ke(!te.value.has(B.value))}throw new SyntaxError(`Unknown operator "${D.operator.value}" between ${B.type} and ${te.type}`)}evaluateArguments(D,ee){const B=[],te=new Map;for(const de of D)if(de.type==="KeywordArgumentExpression"){const be=de;te.set(be.key.value,this.evaluate(be.value,ee))}else{if(te.size>0)throw new Error("Positional arguments must come before keyword arguments");B.push(this.evaluate(de,ee))}return[B,te]}evaluateFilterExpression(D,ee){const B=this.evaluate(D.operand,ee);if(D.filter.type==="Identifier"){const te=D.filter;if(te.value==="tojson")return new _e(Ne(B));if(B instanceof K)switch(te.value){case"list":return B;case"first":return B.value[0];case"last":return B.value[B.value.length-1];case"length":return new we(B.value.length);case"reverse":return new K(B.value.reverse());case"sort":return new K(B.value.sort((de,be)=>{if(de.type!==be.type)throw new Error(`Cannot compare different types: ${de.type} and ${be.type}`);switch(de.type){case"NumericValue":return de.value-be.value;case"StringValue":return de.value.localeCompare(be.value);default:throw new Error(`Cannot compare type: ${de.type}`)}}));case"join":return new _e(B.value.map(de=>de.value).join(""));default:throw new Error(`Unknown ArrayValue filter: ${te.value}`)}else if(B instanceof _e)switch(te.value){case"length":return new we(B.value.length);case"upper":return new _e(B.value.toUpperCase());case"lower":return new _e(B.value.toLowerCase());case"title":return new _e(se(B.value));case"capitalize":return new _e(B.value.charAt(0).toUpperCase()+B.value.slice(1));case"trim":return new _e(B.value.trim());case"indent":return new _e(B.value.split(` -`).map((de,be)=>be===0||de.length===0?de:" "+de).join(` -`));case"join":case"string":return B;default:throw new Error(`Unknown StringValue filter: ${te.value}`)}else if(B instanceof we)switch(te.value){case"abs":return new we(Math.abs(B.value));default:throw new Error(`Unknown NumericValue filter: ${te.value}`)}else if(B instanceof He)switch(te.value){case"items":return new K(Array.from(B.value.entries()).map(([de,be])=>new K([new _e(de),be])));case"length":return new we(B.value.size);default:throw new Error(`Unknown ObjectValue filter: ${te.value}`)}throw new Error(`Cannot apply filter "${te.value}" to type: ${B.type}`)}else if(D.filter.type==="CallExpression"){const te=D.filter;if(te.callee.type!=="Identifier")throw new Error(`Unknown filter: ${te.callee.type}`);const de=te.callee.value;if(de==="tojson"){const[,be]=this.evaluateArguments(te.args,ee),ve=be.get("indent")??new Pe;if(!(ve instanceof we||ve instanceof Pe))throw new Error("If set, indent must be a number");return new _e(Ne(B,ve.value))}else if(de==="join"){let be;if(B instanceof _e)be=Array.from(B.value);else if(B instanceof K)be=B.value.map(je=>je.value);else throw new Error(`Cannot apply filter "${de}" to type: ${B.type}`);const[ve,Re]=this.evaluateArguments(te.args,ee),Fe=ve.at(0)??Re.get("separator")??new _e("");if(!(Fe instanceof _e))throw new Error("separator must be a string");return new _e(be.join(Fe.value))}if(B instanceof K){switch(de){case"selectattr":case"rejectattr":{const be=de==="selectattr";if(B.value.some(Xe=>!(Xe instanceof He)))throw new Error(`\`${de}\` can only be applied to array of objects`);if(te.args.some(Xe=>Xe.type!=="StringLiteral"))throw new Error(`arguments of \`${de}\` must be strings`);const[ve,Re,Fe]=te.args.map(Xe=>this.evaluate(Xe,ee));let je;if(Re){const Xe=ee.tests.get(Re.value);if(!Xe)throw new Error(`Unknown test: ${Re.value}`);je=Xe}else je=(...Xe)=>Xe[0].__bool__().value;const qe=B.value.filter(Xe=>{const ut=Xe.value.get(ve.value),wt=ut?je(ut,Fe):!1;return be?wt:!wt});return new K(qe)}case"map":{const[,be]=this.evaluateArguments(te.args,ee);if(be.has("attribute")){const ve=be.get("attribute");if(!(ve instanceof _e))throw new Error("attribute must be a string");const Re=be.get("default"),Fe=B.value.map(je=>{if(!(je instanceof He))throw new Error("items in map must be an object");return je.value.get(ve.value)??Re??new Te});return new K(Fe)}else throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${de}`)}else if(B instanceof _e){switch(de){case"indent":{const[be,ve]=this.evaluateArguments(te.args,ee),Re=be.at(0)??ve.get("width")??new we(4);if(!(Re instanceof we))throw new Error("width must be a number");const Fe=be.at(1)??ve.get("first")??new ke(!1),je=be.at(2)??ve.get("blank")??new ke(!1),qe=B.value.split(` -`),Xe=" ".repeat(Re.value),ut=qe.map((wt,nr)=>!Fe.value&&nr===0||!je.value&&wt.length===0?wt:Xe+wt);return new _e(ut.join(` -`))}}throw new Error(`Unknown StringValue filter: ${de}`)}else throw new Error(`Cannot apply filter "${de}" to type: ${B.type}`)}throw new Error(`Unknown filter: ${D.filter.type}`)}evaluateTestExpression(D,ee){const B=this.evaluate(D.operand,ee),te=ee.tests.get(D.test.value);if(!te)throw new Error(`Unknown test: ${D.test.value}`);const de=te(B);return new ke(D.negate?!de:de)}evaluateUnaryExpression(D,ee){const B=this.evaluate(D.argument,ee);switch(D.operator.value){case"not":return new ke(!B.value);default:throw new SyntaxError(`Unknown operator: ${D.operator.value}`)}}evalProgram(D,ee){return this.evaluateBlock(D.body,ee)}evaluateBlock(D,ee){let B="";for(const te of D){const de=this.evaluate(te,ee);de.type!=="NullValue"&&de.type!=="UndefinedValue"&&(B+=de.value)}return new _e(B)}evaluateIdentifier(D,ee){return ee.lookupVariable(D.value)}evaluateCallExpression(D,ee){const[B,te]=this.evaluateArguments(D.args,ee);te.size>0&&B.push(new Me(te));const de=this.evaluate(D.callee,ee);if(de.type!=="FunctionValue")throw new Error(`Cannot call something that is not a function: got ${de.type}`);return de.value(B,ee)}evaluateSliceExpression(D,ee,B){if(!(D instanceof K||D instanceof _e))throw new Error("Slice object must be an array or string");const te=this.evaluate(ee.start,B),de=this.evaluate(ee.stop,B),be=this.evaluate(ee.step,B);if(!(te instanceof we||te instanceof Te))throw new Error("Slice start must be numeric or undefined");if(!(de instanceof we||de instanceof Te))throw new Error("Slice stop must be numeric or undefined");if(!(be instanceof we||be instanceof Te))throw new Error("Slice step must be numeric or undefined");return D instanceof K?new K(G(D.value,te.value,de.value,be.value)):new _e(G(Array.from(D.value),te.value,de.value,be.value).join(""))}evaluateMemberExpression(D,ee){const B=this.evaluate(D.object,ee);let te;if(D.computed){if(D.property.type==="SliceExpression")return this.evaluateSliceExpression(B,D.property,ee);te=this.evaluate(D.property,ee)}else te=new _e(D.property.value);let de;if(B instanceof He){if(!(te instanceof _e))throw new Error(`Cannot access property with non-string: got ${te.type}`);de=B.value.get(te.value)??B.builtins.get(te.value)}else if(B instanceof K||B instanceof _e)if(te instanceof we)de=B.value.at(te.value),B instanceof _e&&(de=new _e(B.value.at(te.value)));else if(te instanceof _e)de=B.builtins.get(te.value);else throw new Error(`Cannot access property with non-string/non-number: got ${te.type}`);else{if(!(te instanceof _e))throw new Error(`Cannot access property with non-string: got ${te.type}`);de=B.builtins.get(te.value)}return de instanceof X?de:new Te}evaluateSet(D,ee){const B=this.evaluate(D.value,ee);if(D.assignee.type==="Identifier"){const te=D.assignee.value;ee.setVariable(te,B)}else if(D.assignee.type==="MemberExpression"){const te=D.assignee,de=this.evaluate(te.object,ee);if(!(de instanceof He))throw new Error("Cannot assign to member of non-object");if(te.property.type!=="Identifier")throw new Error("Cannot assign to member with non-identifier property");de.value.set(te.property.value,B)}else throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(D.assignee)}`);return new Pe}evaluateIf(D,ee){const B=this.evaluate(D.test,ee);return this.evaluateBlock(B.__bool__().value?D.body:D.alternate,ee)}evaluateFor(D,ee){const B=new Ae(ee);let te,de;if(D.iterable.type==="SelectExpression"){const je=D.iterable;de=this.evaluate(je.iterable,B),te=je.test}else de=this.evaluate(D.iterable,B);if(!(de instanceof K))throw new Error(`Expected iterable type in for loop: got ${de.type}`);const be=[],ve=[];for(let je=0;jewt.setVariable(D.loopvar.value,Xe);else if(D.loopvar.type==="TupleLiteral"){const wt=D.loopvar;if(Xe.type!=="ArrayValue")throw new Error(`Cannot unpack non-iterable type: ${Xe.type}`);const nr=Xe;if(wt.value.length!==nr.value.length)throw new Error(`Too ${wt.value.length>nr.value.length?"few":"many"} items to unpack`);ut=jt=>{for(let ar=0;ar0?be[je-1]:new Te],["nextitem",je{var ve;const de=new Ae(te);B=B.slice();let be;((ve=B.at(-1))==null?void 0:ve.type)==="KeywordArgumentsValue"&&(be=B.pop());for(let Re=0;Rethis.evaluate(B,ee)));case"TupleLiteral":return new j(D.value.map(B=>this.evaluate(B,ee)));case"ObjectLiteral":{const B=new Map;for(const[te,de]of D.value){const be=this.evaluate(te,ee);if(!(be instanceof _e))throw new Error(`Object keys must be strings: got ${be.type}`);B.set(be.value,this.evaluate(de,ee))}return new He(B)}case"Identifier":return this.evaluateIdentifier(D,ee);case"CallExpression":return this.evaluateCallExpression(D,ee);case"MemberExpression":return this.evaluateMemberExpression(D,ee);case"UnaryExpression":return this.evaluateUnaryExpression(D,ee);case"BinaryExpression":return this.evaluateBinaryExpression(D,ee);case"FilterExpression":return this.evaluateFilterExpression(D,ee);case"TestExpression":return this.evaluateTestExpression(D,ee);default:throw new SyntaxError(`Unknown node type: ${D.type}`)}}};function Le(D){switch(typeof D){case"number":return new we(D);case"string":return new _e(D);case"boolean":return new ke(D);case"undefined":return new Te;case"object":return D===null?new Pe:Array.isArray(D)?new K(D.map(Le)):new He(new Map(Object.entries(D).map(([ee,B])=>[ee,Le(B)])));case"function":return new me((ee,B)=>{const te=D(...ee.map(de=>de.value))??null;return Le(te)});default:throw new Error(`Cannot convert to runtime value: ${D}`)}}function Ne(D,ee,B){const te=B??0;switch(D.type){case"NullValue":case"UndefinedValue":return"null";case"NumericValue":case"StringValue":case"BooleanValue":return JSON.stringify(D.value);case"ArrayValue":case"ObjectValue":{const de=ee?" ".repeat(ee):"",be=` -`+de.repeat(te),ve=be+de;if(D.type==="ArrayValue"){const Re=D.value.map(Fe=>Ne(Fe,ee,te+1));return ee?`[${ve}${Re.join(`,${ve}`)}${be}]`:`[${Re.join(", ")}]`}else{const Re=Array.from(D.value.entries()).map(([Fe,je])=>{const qe=`"${Fe}": ${Ne(je,ee,te+1)}`;return ee?`${ve}${qe}`:qe});return ee?`{${Re.join(",")}${be}}`:`{${Re.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${D.type}`)}}var We=class{constructor(D){re(this,"parsed");const ee=u(D,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=N(ee)}render(D){const ee=new Ae;if(ee.set("false",!1),ee.set("true",!0),ee.set("raise_exception",de=>{throw new Error(de)}),ee.set("range",O),D)for(const[de,be]of Object.entries(D))ee.set(de,be);return new Ie(ee).run(this.parsed).value}}},"./src/backends/onnx.js":(e,r,t)=>{var s;t.r(r),t.d(r,{Tensor:()=>a.Tensor,createInferenceSession:()=>I,deviceToExecutionProviders:()=>_,isONNXProxy:()=>$,isONNXTensor:()=>M});var o=t("./src/env.js"),n=t("?2ce3"),i=t("onnxruntime-web"),a=t("onnxruntime-common");const l=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}}),c=[];let p,u;const h=Symbol.for("onnxruntime");if(h in globalThis)u=globalThis[h];else if(o.apis.IS_NODE_ENV){switch(u=n??(s||(s=t.t(n,2))),process.platform){case"win32":c.push("dml");break;case"linux":process.arch==="x64"&&c.push("cuda");break}c.push("cpu"),p=["cpu"]}else u=i,o.apis.IS_WEBNN_AVAILABLE&&c.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),o.apis.IS_WEBGPU_AVAILABLE&&c.push("webgpu"),c.push("wasm"),p=["wasm"];const g=u.InferenceSession;function _(P=null){if(!P)return p;switch(P){case"auto":return c;case"gpu":return c.filter(b=>["webgpu","cuda","dml","webnn-gpu"].includes(b))}if(c.includes(P))return[l[P]??P];throw new Error(`Unsupported device: "${P}". Should be one of: ${c.join(", ")}.`)}let E=null;async function I(P,b,w){E&&await E;const T=g.create(P,b);E??(E=T);const k=await T;return k.config=w,k}function M(P){return P instanceof u.Tensor}const y=u==null?void 0:u.env;y!=null&&y.wasm&&(!(typeof ServiceWorkerGlobalScope<"u"&&self instanceof ServiceWorkerGlobalScope)&&!y.wasm.wasmPaths&&(y.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${o.env.version}/dist/`),y.wasm.proxy=!1),y!=null&&y.webgpu&&(y.webgpu.powerPreference="high-performance");function $(){var P;return(P=y==null?void 0:y.wasm)==null?void 0:P.proxy}o.env.backends.onnx=y},"./src/base/feature_extraction_utils.js":(e,r,t)=>{t.r(r),t.d(r,{FeatureExtractor:()=>i,validate_audio_inputs:()=>a});var s=t("./src/utils/constants.js"),o=t("./src/utils/generic.js"),n=t("./src/utils/hub.js");class i extends o.Callable{constructor(c){super(),this.config=c}static async from_pretrained(c,p){const u=await(0,n.getModelJSON)(c,s.FEATURE_EXTRACTOR_NAME,!0,p);return new this(u)}}function a(l,c){var p;if(!(l instanceof Float32Array||l instanceof Float64Array))throw new Error(`${c} expects input to be a Float32Array or a Float64Array, but got ${((p=l==null?void 0:l.constructor)==null?void 0:p.name)??typeof l} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}},"./src/base/image_processors_utils.js":(e,r,t)=>{t.r(r),t.d(r,{ImageProcessor:()=>P,center_to_corners_format:()=>u,post_process_instance_segmentation:()=>$,post_process_object_detection:()=>h,post_process_panoptic_segmentation:()=>y,post_process_semantic_segmentation:()=>g});var s=t("./src/utils/generic.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");t("./src/utils/image.js");var i=t("./src/utils/core.js"),a=t("./src/utils/hub.js"),l=t("./src/utils/constants.js");function c(b,w,T=0,k=null){const z=b/w;let R=(0,n.bankers_round)(z)*w;return k!==null&&R>k&&(R=Math.floor(z)*w),Rw&&O.push(se)}else{let se=(0,n.max)(N.data)[1];if(se===U-1||(G=(0,n.softmax)(N.data),G[se]we*J[(_e+1)%2])),oe.boxes.push(X),oe.classes.push(se),oe.scores.push(G[se])}}Z.push(oe)}return Z}function g(b,w=null){const T=b.logits,k=T.dims[0];if(w!==null&&w.length!==k)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const z=[];for(let R=0;RJ[O]&&(J[O]=N[O],oe[O]=he)}const ae=new Array(q.dims[0]);for(let he=0;hehe!==void 0);z.push({segmentation:H,labels:ce})}return z}function _(b,w,T,k){const z=[],R=[],Q=[];for(let q=0;qT&&(z.push(Z),R.push(oe),Q.push(H))}return[z,R,Q]}function E(b,w,T,k=.5,z=.8){const R=[];let Q=0,q=0;const U=w[T].data;for(let H=0;H=k&&++q;let Z=Q>0&&q>0;return Z&&(Z=Q/q>z),[Z,R]}function I(b,w,T,k,z,R=null,Q=null){const[q,U]=Q??b[0].dims,Z=new o.Tensor("int32",new Int32Array(q*U),[q,U]),H=[];if(Q!==null)for(let he=0;heoe[G]&&(J[G]=he,oe[G]=O[G])}let ae=0;const ce=Z.data;for(let he=0;he200)throw new Error(`absolute aspect ratio must be smaller than 200, got ${Math.max(b,w)/Math.min(b,w)}`);let R=Math.round(b/T)*T,Q=Math.round(w/T)*T;if(R*Q>z){const q=Math.sqrt(b*w/z);R=Math.floor(b/q/T)*T,Q=Math.floor(w/q/T)*T}else if(R*QR?Z=Math.floor(R*U/z):R>z&&(U=Math.floor(z*Z/R)),await w.resize(Z,U,{resample:k}))}async crop_margin(w,T=200){const k=w.clone().grayscale(),z=(0,n.min)(k.data)[0],Q=(0,n.max)(k.data)[0]-z;if(Q===0)return w;const q=T/255;let U=k.width,Z=k.height,H=0,J=0;const oe=k.data;for(let ae=0;aethis.preprocess(R)));return{pixel_values:(0,o.stack)(k.map(R=>R.pixel_values),0),original_sizes:k.map(R=>R.original_size),reshaped_input_sizes:k.map(R=>R.reshaped_input_size)}}static async from_pretrained(w,T){const k=await(0,a.getModelJSON)(w,l.IMAGE_PROCESSOR_NAME,!0,T);return new this(k)}}},"./src/base/processing_utils.js":(e,r,t)=>{t.r(r),t.d(r,{Processor:()=>i});var s=t("./src/utils/constants.js"),o=t("./src/utils/generic.js"),n=t("./src/utils/hub.js");class i extends o.Callable{constructor(l,c){super(),this.config=l,this.components=c}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(l,c={}){if(!this.tokenizer)throw new Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(l,{tokenize:!1,...c})}batch_decode(...l){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...l)}decode(...l){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...l)}async _call(l,...c){for(const p of[this.image_processor,this.feature_extractor,this.tokenizer])if(p)return p(l,...c);throw new Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(l,c){const[p,u]=await Promise.all([this.uses_processor_config?(0,n.getModelJSON)(l,s.PROCESSOR_NAME,!0,c):{},Promise.all(this.classes.filter(h=>h in this).map(async h=>{const g=await this[h].from_pretrained(l,c);return[h.replace(/_class$/,""),g]})).then(Object.fromEntries)]);return new this(p,u)}}re(i,"classes",["image_processor_class","tokenizer_class","feature_extractor_class"]),re(i,"uses_processor_config",!1)},"./src/configs.js":(e,r,t)=>{t.r(r),t.d(r,{AutoConfig:()=>c,PretrainedConfig:()=>l,getKeyValueShapes:()=>a});var s=t("./src/utils/core.js"),o=t("./src/utils/hub.js");async function n(p,u){return await(0,o.getModelJSON)(p,"config.json",!0,u)}function i(p){const u={};let h={};switch(p.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"smolvlm":h=i(p.text_config);break;case"moondream1":h=i(p.phi_config);break;case"musicgen":h=i(p.decoder);break;case"multi_modality":h=i(p.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":u.num_heads="n_head",u.num_layers="n_layer",u.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":u.num_heads="num_attention_heads",u.num_layers="num_hidden_layers",u.hidden_size="hidden_size";break;case"llama":case"olmo":case"olmo2":case"mobilellm":case"granite":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":u.num_heads="num_key_value_heads",u.num_layers="num_hidden_layers",u.hidden_size="hidden_size",u.num_attention_heads="num_attention_heads";break;case"gemma":case"gemma2":case"gemma3_text":case"glm":case"helium":u.num_heads="num_key_value_heads",u.num_layers="num_hidden_layers",u.dim_kv="head_dim";break;case"openelm":u.num_heads="num_kv_heads",u.num_layers="num_transformer_layers",u.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":u.num_heads="num_heads",u.num_layers="num_layers",u.hidden_size="hidden_size";break;case"bloom":u.num_heads="n_head",u.num_layers="n_layer",u.hidden_size="hidden_size";break;case"mpt":u.num_heads="n_heads",u.num_layers="n_layers",u.hidden_size="d_model";break;case"exaone":u.num_heads="num_key_value_heads",u.num_layers="num_layers",u.dim_kv="head_dim",u.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":u.num_decoder_layers="num_decoder_layers",u.num_decoder_heads="num_heads",u.decoder_dim_kv="d_kv",u.num_encoder_layers="num_layers",u.num_encoder_heads="num_heads",u.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":u.num_decoder_layers="decoder_layers",u.num_decoder_heads="decoder_attention_heads",u.decoder_hidden_size="d_model",u.num_encoder_layers="encoder_layers",u.num_encoder_heads="encoder_attention_heads",u.encoder_hidden_size="d_model";break;case"speecht5":u.num_decoder_layers="decoder_layers",u.num_decoder_heads="decoder_attention_heads",u.decoder_hidden_size="hidden_size",u.num_encoder_layers="encoder_layers",u.num_encoder_heads="encoder_attention_heads",u.encoder_hidden_size="hidden_size";break;case"trocr":u.num_encoder_layers=u.num_decoder_layers="decoder_layers",u.num_encoder_heads=u.num_decoder_heads="decoder_attention_heads",u.encoder_hidden_size=u.decoder_hidden_size="d_model";break;case"musicgen_decoder":u.num_encoder_layers=u.num_decoder_layers="num_hidden_layers",u.num_encoder_heads=u.num_decoder_heads="num_attention_heads",u.encoder_hidden_size=u.decoder_hidden_size="hidden_size";break;case"moonshine":u.num_decoder_layers="decoder_num_hidden_layers",u.num_decoder_heads="decoder_num_key_value_heads",u.num_encoder_layers="encoder_num_hidden_layers",u.num_encoder_heads="encoder_num_key_value_heads",u.encoder_hidden_size=u.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":const _=i(p.decoder),E="num_decoder_layers"in _,I=(0,s.pick)(p,["model_type","is_encoder_decoder"]);return E?(I.num_decoder_layers=_.num_decoder_layers,I.num_decoder_heads=_.num_decoder_heads,I.decoder_hidden_size=_.decoder_hidden_size,I.num_encoder_layers=_.num_encoder_layers,I.num_encoder_heads=_.num_encoder_heads,I.encoder_hidden_size=_.encoder_hidden_size):(I.num_layers=_.num_layers,I.num_heads=_.num_heads,I.hidden_size=_.hidden_size),I}const g={...h,...(0,s.pick)(p,["model_type","multi_query","is_encoder_decoder"])};for(const _ in u)g[_]=p[u[_]];return g}function a(p,{prefix:u="past_key_values",batch_size:h=1}={}){const g={},_=p.normalized_config;if(_.is_encoder_decoder&&"num_encoder_heads"in _&&"num_decoder_heads"in _){const E=_.encoder_dim_kv??_.encoder_hidden_size/_.num_encoder_heads,I=_.decoder_dim_kv??_.decoder_hidden_size/_.num_decoder_heads,M=[h,_.num_encoder_heads,0,E],y=[h,_.num_decoder_heads,0,I];for(let $=0;$<_.num_decoder_layers;++$)g[`${u}.${$}.encoder.key`]=M,g[`${u}.${$}.encoder.value`]=M,g[`${u}.${$}.decoder.key`]=y,g[`${u}.${$}.decoder.value`]=y}else{const E=_.num_heads,I=_.num_layers,M=_.dim_kv??_.hidden_size/(_.num_attention_heads??E);if(_.model_type==="falcon"){const y=[h*E,0,M];for(let $=0;${var k,z;t.r(r),t.d(r,{apis:()=>I,env:()=>w});var s=t("?569f"),o=t("?3f59"),n=t("?154a");const i="3.4.2",a=typeof window<"u"&&typeof window.document<"u",l=typeof self<"u"&&((k=self.constructor)==null?void 0:k.name)==="DedicatedWorkerGlobalScope",c=typeof self<"u"&&"caches"in self,p=typeof navigator<"u"&&"gpu"in navigator,u=typeof navigator<"u"&&"ml"in navigator,h=typeof process<"u",g=h&&((z=process==null?void 0:process.release)==null?void 0:z.name)==="node",_=!T(s),E=!T(o),I=Object.freeze({IS_BROWSER_ENV:a,IS_WEBWORKER_ENV:l,IS_WEB_CACHE_AVAILABLE:c,IS_WEBGPU_AVAILABLE:p,IS_WEBNN_AVAILABLE:u,IS_PROCESS_AVAILABLE:h,IS_NODE_ENV:g,IS_FS_AVAILABLE:_,IS_PATH_AVAILABLE:E}),M=_&&E;let y="./";if(M){const R=Object(import.meta).url;R?y=o.dirname(o.dirname(n.fileURLToPath(R))):typeof __dirname<"u"&&(y=o.dirname(__dirname))}const $=M?o.join(y,"/.cache/"):null,P="/models/",b=M?o.join(y,P):P,w={version:i,backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(a||l),localModelPath:b,useFS:_,useBrowserCache:c,useFSCache:_,cacheDir:$,useCustomCache:!1,customCache:null};function T(R){return Object.keys(R).length===0}},"./src/generation/configuration_utils.js":(e,r,t)=>{t.r(r),t.d(r,{GenerationConfig:()=>o});var s=t("./src/utils/core.js");class o{constructor(i){re(this,"max_length",20);re(this,"max_new_tokens",null);re(this,"min_length",0);re(this,"min_new_tokens",null);re(this,"early_stopping",!1);re(this,"max_time",null);re(this,"do_sample",!1);re(this,"num_beams",1);re(this,"num_beam_groups",1);re(this,"penalty_alpha",null);re(this,"use_cache",!0);re(this,"temperature",1);re(this,"top_k",50);re(this,"top_p",1);re(this,"typical_p",1);re(this,"epsilon_cutoff",0);re(this,"eta_cutoff",0);re(this,"diversity_penalty",0);re(this,"repetition_penalty",1);re(this,"encoder_repetition_penalty",1);re(this,"length_penalty",1);re(this,"no_repeat_ngram_size",0);re(this,"bad_words_ids",null);re(this,"force_words_ids",null);re(this,"renormalize_logits",!1);re(this,"constraints",null);re(this,"forced_bos_token_id",null);re(this,"forced_eos_token_id",null);re(this,"remove_invalid_values",!1);re(this,"exponential_decay_length_penalty",null);re(this,"suppress_tokens",null);re(this,"streamer",null);re(this,"begin_suppress_tokens",null);re(this,"forced_decoder_ids",null);re(this,"guidance_scale",null);re(this,"num_return_sequences",1);re(this,"output_attentions",!1);re(this,"output_hidden_states",!1);re(this,"output_scores",!1);re(this,"return_dict_in_generate",!1);re(this,"pad_token_id",null);re(this,"bos_token_id",null);re(this,"eos_token_id",null);re(this,"encoder_no_repeat_ngram_size",0);re(this,"decoder_start_token_id",null);re(this,"generation_kwargs",{});Object.assign(this,(0,s.pick)(i,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":(e,r,t)=>{t.r(r),t.d(r,{ClassifierFreeGuidanceLogitsProcessor:()=>M,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>c,LogitsProcessor:()=>n,LogitsProcessorList:()=>a,LogitsWarper:()=>i,MinLengthLogitsProcessor:()=>_,MinNewTokensLengthLogitsProcessor:()=>E,NoBadWordsLogitsProcessor:()=>I,NoRepeatNGramLogitsProcessor:()=>h,RepetitionPenaltyLogitsProcessor:()=>g,SuppressTokensAtBeginLogitsProcessor:()=>p,TemperatureLogitsWarper:()=>y,TopKLogitsWarper:()=>P,TopPLogitsWarper:()=>$,WhisperTimeStampLogitsProcessor:()=>u});var s=t("./src/utils/generic.js");t("./src/utils/tensor.js");var o=t("./src/utils/maths.js");class n extends s.Callable{_call(w,T){throw Error("`_call` should be implemented in a subclass")}}class i extends s.Callable{_call(w,T){throw Error("`_call` should be implemented in a subclass")}}class a extends s.Callable{constructor(){super(),this.processors=[]}push(w){this.processors.push(w)}extend(w){this.processors.push(...w)}_call(w,T){let k=T;for(const z of this.processors)k=z(w,k);return k}[Symbol.iterator](){return this.processors.values()}}class l extends n{constructor(w){super(),this.bos_token_id=w}_call(w,T){for(let k=0;k=1&&R[R.length-1]>=this.timestamp_begin,q=R.length<2||R[R.length-2]>=this.timestamp_begin;if(Q&&(q?z.subarray(this.timestamp_begin).fill(-1/0):z.subarray(0,this.eos_token_id).fill(-1/0)),w[k].length===this.begin_index&&this.max_initial_timestamp_index!==null){const J=this.timestamp_begin+this.max_initial_timestamp_index;z.subarray(J+1).fill(-1/0)}const U=(0,o.log_softmax)(z),Z=Math.log(U.subarray(this.timestamp_begin).map(Math.exp).reduce((J,oe)=>J+oe)),H=(0,o.max)(U.subarray(0,this.timestamp_begin))[0];Z>H&&z.subarray(0,this.timestamp_begin).fill(-1/0)}return T}}class h extends n{constructor(w){super(),this.no_repeat_ngram_size=w}getNgrams(w){const T=w.length,k=[];for(let R=0;R1 to use the classifier free guidance processor, got guidance scale ${w}.`);this.guidance_scale=w}_call(w,T){if(T.dims[0]!==2*w.length)throw new Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${T.dims[0]} for the logits and ${w.length} for the input ids.`);const k=w.length,z=T.slice([0,k],null),R=T.slice([k,T.dims[0]],null);for(let Q=0;Q1)throw new Error(`\`top_p\` must be a float > 0 and < 1, but is ${w}`);if(!Number.isInteger(k)||k<1)throw new Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${k}`);this.top_p=w,this.filter_value=T,this.min_tokens_to_keep=k}}class P extends i{constructor(w,{filter_value:T=-1/0,min_tokens_to_keep:k=1}={}){if(super(),!Number.isInteger(w)||w<0)throw new Error(`\`top_k\` must be a positive integer, but is ${w}`);this.top_k=Math.max(w,k),this.filter_value=T}}},"./src/generation/logits_sampler.js":(e,r,t)=>{t.r(r),t.d(r,{LogitsSampler:()=>i});var s=t("./src/utils/generic.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");t("./src/generation/configuration_utils.js");class i extends s.Callable{constructor(u){super(),this.generation_config=u}async _call(u){return this.sample(u)}async sample(u){throw Error("sample should be implemented in subclasses.")}getLogits(u,h){let g=u.dims.at(-1),_=u.data;if(h===-1)_=_.slice(-g);else{let E=h*g;_=_.slice(E,E+g)}return _}randomSelect(u){let h=0;for(let _=0;_1)return new c(u);if(u.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${u.num_return_sequences}.`);return new a(u)}}class a extends i{async sample(u){const h=(0,n.max)(u.data)[1];return[[BigInt(h),0]]}}class l extends i{async sample(u){let h=u.dims.at(-1);this.generation_config.top_k>0&&(h=Math.min(this.generation_config.top_k,h));const[g,_]=await(0,o.topk)(u,h),E=(0,n.softmax)(g.data);return Array.from({length:this.generation_config.num_beams},()=>{const I=this.randomSelect(E);return[_.data[I],Math.log(E[I])]})}}class c extends i{async sample(u){let h=u.dims.at(-1);this.generation_config.top_k>0&&(h=Math.min(this.generation_config.top_k,h));const[g,_]=await(0,o.topk)(u,h),E=(0,n.softmax)(g.data);return Array.from({length:this.generation_config.num_beams},(I,M)=>[_.data[M],Math.log(E[M])])}}},"./src/generation/stopping_criteria.js":(e,r,t)=>{t.r(r),t.d(r,{EosTokenCriteria:()=>a,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>i,StoppingCriteria:()=>o,StoppingCriteriaList:()=>n});var s=t("./src/utils/generic.js");class o extends s.Callable{_call(p,u){throw Error("StoppingCriteria needs to be subclassed")}}class n extends s.Callable{constructor(){super(),this.criteria=[]}push(p){this.criteria.push(p)}extend(p){p instanceof n?p=p.criteria:p instanceof o&&(p=[p]),this.criteria.push(...p)}_call(p,u){const h=new Array(p.length).fill(!1);for(const g of this.criteria){const _=g(p,u);for(let E=0;Eu.length>=this.max_length)}}class a extends o{constructor(p){super(),Array.isArray(p)||(p=[p]),this.eos_token_id=p}_call(p,u){return p.map(h=>{const g=h.at(-1);return this.eos_token_id.some(_=>g==_)})}}class l extends o{constructor(){super(),this.interrupted=!1}interrupt(){this.interrupted=!0}reset(){this.interrupted=!1}_call(p,u){return new Array(p.length).fill(this.interrupted)}}},"./src/generation/streamers.js":(e,r,t)=>{t.r(r),t.d(r,{BaseStreamer:()=>i,TextStreamer:()=>l,WhisperTextStreamer:()=>c});var s=t("./src/utils/core.js"),o=t("./src/tokenizers.js"),n=t("./src/env.js");class i{put(u){throw Error("Not implemented")}end(){throw Error("Not implemented")}}const a=n.apis.IS_PROCESS_AVAILABLE?p=>process.stdout.write(p):p=>console.log(p);class l extends i{constructor(u,{skip_prompt:h=!1,callback_function:g=null,token_callback_function:_=null,skip_special_tokens:E=!0,decode_kwargs:I={},...M}={}){super(),this.tokenizer=u,this.skip_prompt=h,this.callback_function=g??a,this.token_callback_function=_,this.decode_kwargs={skip_special_tokens:E,...I,...M},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(u){var I;if(u.length>1)throw Error("TextStreamer only supports batch size of 1");const h=this.next_tokens_are_prompt;if(h&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;const g=u[0];(I=this.token_callback_function)==null||I.call(this,g),this.token_cache=(0,s.mergeArrays)(this.token_cache,g);const _=this.tokenizer.decode(this.token_cache,this.decode_kwargs);let E;h||_.endsWith(` -`)?(E=_.slice(this.print_len),this.token_cache=[],this.print_len=0):_.length>0&&(0,o.is_chinese_char)(_.charCodeAt(_.length-1))?(E=_.slice(this.print_len),this.print_len+=E.length):(E=_.slice(this.print_len,_.lastIndexOf(" ")+1),this.print_len+=E.length),this.on_finalized_text(E,!1)}end(){let u;this.token_cache.length>0?(u=this.tokenizer.decode(this.token_cache,this.decode_kwargs).slice(this.print_len),this.token_cache=[],this.print_len=0):u="",this.next_tokens_are_prompt=!0,this.on_finalized_text(u,!0)}on_finalized_text(u,h){var g,_;u.length>0&&((g=this.callback_function)==null||g.call(this,u)),h&&this.callback_function===a&&n.apis.IS_PROCESS_AVAILABLE&&((_=this.callback_function)==null||_.call(this,` -`))}}class c extends l{constructor(u,{skip_prompt:h=!1,callback_function:g=null,token_callback_function:_=null,on_chunk_start:E=null,on_chunk_end:I=null,on_finalize:M=null,time_precision:y=.02,skip_special_tokens:$=!0,decode_kwargs:P={}}={}){super(u,{skip_prompt:h,skip_special_tokens:$,callback_function:g,token_callback_function:_,decode_kwargs:P}),this.timestamp_begin=u.timestamp_begin,this.on_chunk_start=E,this.on_chunk_end=I,this.on_finalize=M,this.time_precision=y,this.waiting_for_timestamp=!1}put(u){var g,_;if(u.length>1)throw Error("WhisperTextStreamer only supports batch size of 1");const h=u[0];if(h.length===1){const E=Number(h[0])-this.timestamp_begin;if(E>=0){const I=E*this.time_precision;this.waiting_for_timestamp?(g=this.on_chunk_end)==null||g.call(this,I):(_=this.on_chunk_start)==null||_.call(this,I),this.waiting_for_timestamp=!this.waiting_for_timestamp,u=[[]]}}return super.put(u)}end(){var u;super.end(),(u=this.on_finalize)==null||u.call(this)}}},"./src/models.js":(e,r,t)=>{t.r(r),t.d(r,{ASTForAudioClassification:()=>ba,ASTModel:()=>Ma,ASTPreTrainedModel:()=>Ao,AlbertForMaskedLM:()=>V,AlbertForQuestionAnswering:()=>F,AlbertForSequenceClassification:()=>pe,AlbertModel:()=>mn,AlbertPreTrainedModel:()=>Ps,AutoModel:()=>Bd,AutoModelForAudioClassification:()=>qm,AutoModelForAudioFrameClassification:()=>Xm,AutoModelForAudioTextToText:()=>of,AutoModelForCTC:()=>Hm,AutoModelForCausalLM:()=>Lm,AutoModelForDepthEstimation:()=>ef,AutoModelForDocumentQuestionAnswering:()=>Jm,AutoModelForImageClassification:()=>Nm,AutoModelForImageFeatureExtraction:()=>sf,AutoModelForImageMatting:()=>Ym,AutoModelForImageSegmentation:()=>jm,AutoModelForImageTextToText:()=>nf,AutoModelForImageToImage:()=>Zm,AutoModelForMaskGeneration:()=>Km,AutoModelForMaskedLM:()=>zm,AutoModelForNormalEstimation:()=>tf,AutoModelForObjectDetection:()=>Wm,AutoModelForPoseEstimation:()=>rf,AutoModelForQuestionAnswering:()=>Bm,AutoModelForSemanticSegmentation:()=>Vm,AutoModelForSeq2SeqLM:()=>Am,AutoModelForSequenceClassification:()=>km,AutoModelForSpeechSeq2Seq:()=>Fm,AutoModelForTextToSpectrogram:()=>Om,AutoModelForTextToWaveform:()=>Dm,AutoModelForTokenClassification:()=>Im,AutoModelForUniversalSegmentation:()=>Um,AutoModelForVision2Seq:()=>Rm,AutoModelForXVector:()=>Qm,AutoModelForZeroShotObjectDetection:()=>Gm,BartForConditionalGeneration:()=>Ut,BartForSequenceClassification:()=>At,BartModel:()=>$t,BartPretrainedModel:()=>Ct,BaseModelOutput:()=>Pe,BeitForImageClassification:()=>dl,BeitModel:()=>ll,BeitPreTrainedModel:()=>Wi,BertForMaskedLM:()=>Ie,BertForQuestionAnswering:()=>We,BertForSequenceClassification:()=>Le,BertForTokenClassification:()=>Ne,BertModel:()=>Ae,BertPreTrainedModel:()=>Te,BlenderbotForConditionalGeneration:()=>Yt,BlenderbotModel:()=>Wt,BlenderbotPreTrainedModel:()=>ls,BlenderbotSmallForConditionalGeneration:()=>ds,BlenderbotSmallModel:()=>Xr,BlenderbotSmallPreTrainedModel:()=>_r,BloomForCausalLM:()=>Pi,BloomModel:()=>Ei,BloomPreTrainedModel:()=>ho,CLIPModel:()=>No,CLIPPreTrainedModel:()=>Bs,CLIPSegForImageSegmentation:()=>jo,CLIPSegModel:()=>en,CLIPSegPreTrainedModel:()=>Zs,CLIPTextModel:()=>cd,CLIPTextModelWithProjection:()=>ka,CLIPVisionModel:()=>ud,CLIPVisionModelWithProjection:()=>Un,CamembertForMaskedLM:()=>bs,CamembertForQuestionAnswering:()=>As,CamembertForSequenceClassification:()=>vs,CamembertForTokenClassification:()=>xs,CamembertModel:()=>rs,CamembertPreTrainedModel:()=>Rr,CausalLMOutput:()=>Mn,CausalLMOutputWithPast:()=>qb,ChineseCLIPModel:()=>Da,ChineseCLIPPreTrainedModel:()=>Oa,ClapAudioModelWithProjection:()=>ph,ClapModel:()=>ch,ClapPreTrainedModel:()=>vl,ClapTextModelWithProjection:()=>uh,CodeGenForCausalLM:()=>Nr,CodeGenModel:()=>wn,CodeGenPreTrainedModel:()=>Qn,CohereForCausalLM:()=>li,CohereModel:()=>ai,CoherePreTrainedModel:()=>no,ConvBertForMaskedLM:()=>jt,ConvBertForQuestionAnswering:()=>ks,ConvBertForSequenceClassification:()=>ar,ConvBertForTokenClassification:()=>es,ConvBertModel:()=>nr,ConvBertPreTrainedModel:()=>wt,ConvNextForImageClassification:()=>ip,ConvNextModel:()=>op,ConvNextPreTrainedModel:()=>_d,ConvNextV2ForImageClassification:()=>lp,ConvNextV2Model:()=>ap,ConvNextV2PreTrainedModel:()=>gd,DPTForDepthEstimation:()=>ju,DPTModel:()=>Nu,DPTPreTrainedModel:()=>hd,DacDecoderModel:()=>em,DacDecoderOutput:()=>Jh,DacEncoderModel:()=>Zh,DacEncoderOutput:()=>Xh,DacModel:()=>Yh,DacPreTrainedModel:()=>$l,DebertaForMaskedLM:()=>et,DebertaForQuestionAnswering:()=>zt,DebertaForSequenceClassification:()=>ot,DebertaForTokenClassification:()=>rr,DebertaModel:()=>Be,DebertaPreTrainedModel:()=>hr,DebertaV2ForMaskedLM:()=>ns,DebertaV2ForQuestionAnswering:()=>is,DebertaV2ForSequenceClassification:()=>Tr,DebertaV2ForTokenClassification:()=>os,DebertaV2Model:()=>ss,DebertaV2PreTrainedModel:()=>Sr,DecisionTransformerModel:()=>Fh,DecisionTransformerPreTrainedModel:()=>Ah,DeiTForImageClassification:()=>Ee,DeiTModel:()=>ye,DeiTPreTrainedModel:()=>ne,DepthAnythingForDepthEstimation:()=>Uu,DepthAnythingPreTrainedModel:()=>Vu,DepthProForDepthEstimation:()=>qu,DepthProPreTrainedModel:()=>Hu,DetrForObjectDetection:()=>ul,DetrForSegmentation:()=>Gi,DetrModel:()=>cl,DetrObjectDetectionOutput:()=>Ki,DetrPreTrainedModel:()=>wo,DetrSegmentationOutput:()=>pl,Dinov2ForImageClassification:()=>cp,Dinov2Model:()=>dp,Dinov2PreTrainedModel:()=>wd,Dinov2WithRegistersForImageClassification:()=>pp,Dinov2WithRegistersModel:()=>up,Dinov2WithRegistersPreTrainedModel:()=>yd,DistilBertForMaskedLM:()=>Hs,DistilBertForQuestionAnswering:()=>Ks,DistilBertForSequenceClassification:()=>Ws,DistilBertForTokenClassification:()=>Gs,DistilBertModel:()=>Ts,DistilBertPreTrainedModel:()=>Kr,DonutSwinModel:()=>np,DonutSwinPreTrainedModel:()=>sp,EfficientNetForImageClassification:()=>yh,EfficientNetModel:()=>wh,EfficientNetPreTrainedModel:()=>$d,ElectraForMaskedLM:()=>Is,ElectraForQuestionAnswering:()=>Gr,ElectraForSequenceClassification:()=>Br,ElectraForTokenClassification:()=>dt,ElectraModel:()=>ts,ElectraPreTrainedModel:()=>Or,EsmForMaskedLM:()=>Qs,EsmForSequenceClassification:()=>Xs,EsmForTokenClassification:()=>Dr,EsmModel:()=>qs,EsmPreTrainedModel:()=>as,ExaoneForCausalLM:()=>ht,ExaoneModel:()=>ei,ExaonePreTrainedModel:()=>Rs,FalconForCausalLM:()=>dh,FalconModel:()=>lh,FalconPreTrainedModel:()=>Pd,FastViTForImageClassification:()=>Ja,FastViTModel:()=>Xa,FastViTPreTrainedModel:()=>Ri,Florence2ForConditionalGeneration:()=>Lo,Florence2PreTrainedModel:()=>Sa,GLPNForDepthEstimation:()=>rp,GLPNModel:()=>tp,GLPNPreTrainedModel:()=>fd,GPT2LMHeadModel:()=>Kn,GPT2Model:()=>Ra,GPT2PreTrainedModel:()=>Vo,GPTBigCodeForCausalLM:()=>Xo,GPTBigCodeModel:()=>ja,GPTBigCodePreTrainedModel:()=>Oe,GPTJForCausalLM:()=>gn,GPTJModel:()=>Qo,GPTJPreTrainedModel:()=>qo,GPTNeoForCausalLM:()=>Ko,GPTNeoModel:()=>Go,GPTNeoPreTrainedModel:()=>Hn,GPTNeoXForCausalLM:()=>Ho,GPTNeoXModel:()=>Na,GPTNeoXPreTrainedModel:()=>qn,Gemma2ForCausalLM:()=>pi,Gemma2Model:()=>ui,Gemma2PreTrainedModel:()=>io,Gemma3ForCausalLM:()=>mi,Gemma3Model:()=>hi,Gemma3PreTrainedModel:()=>ao,GemmaForCausalLM:()=>ci,GemmaModel:()=>di,GemmaPreTrainedModel:()=>oo,GlmForCausalLM:()=>gt,GlmModel:()=>Zo,GlmPreTrainedModel:()=>Zn,GraniteForCausalLM:()=>ii,GraniteModel:()=>oi,GranitePreTrainedModel:()=>so,GroundingDinoForObjectDetection:()=>mp,GroundingDinoPreTrainedModel:()=>hp,GroupViTModel:()=>Qa,GroupViTPreTrainedModel:()=>qa,HeliumForCausalLM:()=>Yn,HeliumModel:()=>Yo,HeliumPreTrainedModel:()=>Jn,HieraForImageClassification:()=>it,HieraModel:()=>Ye,HieraPreTrainedModel:()=>ze,HubertForCTC:()=>Wp,HubertForSequenceClassification:()=>Gp,HubertModel:()=>Up,HubertPreTrainedModel:()=>Ob,IJepaForImageClassification:()=>Oi,IJepaModel:()=>Fi,IJepaPreTrainedModel:()=>go,Idefics3ForConditionalGeneration:()=>jn,Idefics3PreTrainedModel:()=>$a,ImageMattingOutput:()=>lf,JAISLMHeadModel:()=>Wo,JAISModel:()=>Uo,JAISPreTrainedModel:()=>_n,JinaCLIPModel:()=>La,JinaCLIPPreTrainedModel:()=>Gn,JinaCLIPTextModel:()=>za,JinaCLIPVisionModel:()=>Ba,LiteWhisperForConditionalGeneration:()=>xa,LlamaForCausalLM:()=>Jo,LlamaModel:()=>Xn,LlamaPreTrainedModel:()=>tn,LlavaForConditionalGeneration:()=>Nn,LlavaOnevisionForConditionalGeneration:()=>Pa,LlavaPreTrainedModel:()=>Ea,LongT5ForConditionalGeneration:()=>Qe,LongT5Model:()=>Ue,LongT5PreTrainedModel:()=>Ce,M2M100ForConditionalGeneration:()=>Tp,M2M100Model:()=>xp,M2M100PreTrainedModel:()=>vd,MBartForCausalLM:()=>vr,MBartForConditionalGeneration:()=>fr,MBartForSequenceClassification:()=>Qr,MBartModel:()=>br,MBartPreTrainedModel:()=>Vt,MPNetForMaskedLM:()=>Lr,MPNetForQuestionAnswering:()=>kr,MPNetForSequenceClassification:()=>pn,MPNetForTokenClassification:()=>Ds,MPNetModel:()=>un,MPNetPreTrainedModel:()=>Hr,MT5ForConditionalGeneration:()=>pt,MT5Model:()=>Ze,MT5PreTrainedModel:()=>Ke,MarianMTModel:()=>vp,MarianModel:()=>bp,MarianPreTrainedModel:()=>bd,MaskFormerForInstanceSegmentation:()=>ep,MaskFormerModel:()=>Zu,MaskFormerPreTrainedModel:()=>md,MaskedLMOutput:()=>gr,Metric3DForDepthEstimation:()=>Xu,Metric3DPreTrainedModel:()=>Qu,Metric3Dv2ForDepthEstimation:()=>Yu,Metric3Dv2PreTrainedModel:()=>Ju,MgpstrForSceneTextRecognition:()=>Bh,MgpstrModelOutput:()=>Lh,MgpstrPreTrainedModel:()=>zh,MimiDecoderModel:()=>Qh,MimiDecoderOutput:()=>Kh,MimiEncoderModel:()=>qh,MimiEncoderOutput:()=>Gh,MimiModel:()=>Hh,MimiPreTrainedModel:()=>Sl,MistralForCausalLM:()=>oh,MistralModel:()=>nh,MistralPreTrainedModel:()=>Td,MobileBertForMaskedLM:()=>Fs,MobileBertForQuestionAnswering:()=>$r,MobileBertForSequenceClassification:()=>Os,MobileBertModel:()=>Mr,MobileBertPreTrainedModel:()=>Es,MobileLLMForCausalLM:()=>ti,MobileLLMModel:()=>ft,MobileLLMPreTrainedModel:()=>yn,MobileNetV1ForImageClassification:()=>bh,MobileNetV1ForSemanticSegmentation:()=>vh,MobileNetV1Model:()=>Mh,MobileNetV1PreTrainedModel:()=>Tl,MobileNetV2ForImageClassification:()=>Th,MobileNetV2ForSemanticSegmentation:()=>Eh,MobileNetV2Model:()=>xh,MobileNetV2PreTrainedModel:()=>El,MobileNetV3ForImageClassification:()=>Ch,MobileNetV3ForSemanticSegmentation:()=>Sh,MobileNetV3Model:()=>Ph,MobileNetV3PreTrainedModel:()=>Pl,MobileNetV4ForImageClassification:()=>kh,MobileNetV4ForSemanticSegmentation:()=>Ih,MobileNetV4Model:()=>$h,MobileNetV4PreTrainedModel:()=>Cl,MobileViTForImageClassification:()=>tl,MobileViTModel:()=>el,MobileViTPreTrainedModel:()=>Ni,MobileViTV2ForImageClassification:()=>sl,MobileViTV2Model:()=>rl,MobileViTV2PreTrainedModel:()=>ji,ModelOutput:()=>me,ModernBertForMaskedLM:()=>B,ModernBertForSequenceClassification:()=>te,ModernBertForTokenClassification:()=>de,ModernBertModel:()=>ee,ModernBertPreTrainedModel:()=>D,Moondream1ForConditionalGeneration:()=>Ca,MoonshineForConditionalGeneration:()=>Ta,MoonshineModel:()=>dd,MoonshinePreTrainedModel:()=>Oo,MptForCausalLM:()=>Si,MptModel:()=>Ci,MptPreTrainedModel:()=>mo,MultiModalityCausalLM:()=>Dh,MultiModalityPreTrainedModel:()=>Oh,MusicgenForCausalLM:()=>Bb,MusicgenForConditionalGeneration:()=>Id,MusicgenModel:()=>zb,MusicgenPreTrainedModel:()=>kd,NomicBertModel:()=>ve,NomicBertPreTrainedModel:()=>be,OPTForCausalLM:()=>ki,OPTModel:()=>$i,OPTPreTrainedModel:()=>fo,Olmo2ForCausalLM:()=>ro,Olmo2Model:()=>ni,Olmo2PreTrainedModel:()=>to,OlmoForCausalLM:()=>si,OlmoModel:()=>ri,OlmoPreTrainedModel:()=>eo,OpenELMForCausalLM:()=>_i,OpenELMModel:()=>fi,OpenELMPreTrainedModel:()=>lo,OwlViTForObjectDetection:()=>ol,OwlViTModel:()=>nl,OwlViTPreTrainedModel:()=>Vi,Owlv2ForObjectDetection:()=>al,Owlv2Model:()=>il,Owlv2PreTrainedModel:()=>Ui,PaliGemmaForConditionalGeneration:()=>Bo,PaliGemmaPreTrainedModel:()=>zo,PatchTSMixerForPrediction:()=>Vh,PatchTSMixerModel:()=>jh,PatchTSMixerPreTrainedModel:()=>Fd,PatchTSTForPrediction:()=>Nh,PatchTSTModel:()=>Rh,PatchTSTPreTrainedModel:()=>Ad,Phi3ForCausalLM:()=>Ti,Phi3Model:()=>xi,Phi3PreTrainedModel:()=>po,Phi3VForCausalLM:()=>zs,Phi3VPreTrainedModel:()=>Ro,PhiForCausalLM:()=>vi,PhiModel:()=>bi,PhiPreTrainedModel:()=>uo,PreTrainedModel:()=>j,PretrainedMixin:()=>kt,PvtForImageClassification:()=>Ua,PvtModel:()=>Va,PvtPreTrainedModel:()=>zi,PyAnnoteForAudioFrameClassification:()=>kp,PyAnnoteModel:()=>$p,PyAnnotePreTrainedModel:()=>xd,QuestionAnsweringModelOutput:()=>Er,Qwen2ForCausalLM:()=>wi,Qwen2Model:()=>gi,Qwen2PreTrainedModel:()=>co,Qwen2VLForConditionalGeneration:()=>Mi,Qwen2VLPreTrainedModel:()=>yi,RFDetrForObjectDetection:()=>d,RFDetrModel:()=>Xi,RFDetrObjectDetectionOutput:()=>m,RFDetrPreTrainedModel:()=>Qi,RTDetrForObjectDetection:()=>ml,RTDetrModel:()=>hl,RTDetrObjectDetectionOutput:()=>yo,RTDetrPreTrainedModel:()=>Hi,RTDetrV2ForObjectDetection:()=>_l,RTDetrV2Model:()=>fl,RTDetrV2ObjectDetectionOutput:()=>gl,RTDetrV2PreTrainedModel:()=>qi,ResNetForImageClassification:()=>Ir,ResNetModel:()=>Bt,ResNetPreTrainedModel:()=>_t,RoFormerForMaskedLM:()=>je,RoFormerForQuestionAnswering:()=>ut,RoFormerForSequenceClassification:()=>qe,RoFormerForTokenClassification:()=>Xe,RoFormerModel:()=>Fe,RoFormerPreTrainedModel:()=>Re,RobertaForMaskedLM:()=>Rt,RobertaForQuestionAnswering:()=>Zt,RobertaForSequenceClassification:()=>Xt,RobertaForTokenClassification:()=>qt,RobertaModel:()=>dr,RobertaPreTrainedModel:()=>Ht,SamImageSegmentationOutput:()=>Mp,SamModel:()=>yp,SamPreTrainedModel:()=>wp,SapiensForDepthEstimation:()=>Gu,SapiensForNormalEstimation:()=>Ku,SapiensForSemanticSegmentation:()=>Wu,SapiensPreTrainedModel:()=>wl,SegformerForImageClassification:()=>mh,SegformerForSemanticSegmentation:()=>fh,SegformerModel:()=>Lb,SegformerPreTrainedModel:()=>xl,Seq2SeqLMOutput:()=>Hb,SequenceClassifierOutput:()=>Mt,SiglipModel:()=>Ia,SiglipPreTrainedModel:()=>Wn,SiglipTextModel:()=>Aa,SiglipVisionModel:()=>Fa,SmolVLMForConditionalGeneration:()=>Vn,SnacDecoderModel:()=>sm,SnacEncoderModel:()=>rm,SnacModel:()=>tm,SnacPreTrainedModel:()=>kl,SpeechT5ForSpeechToText:()=>Zp,SpeechT5ForTextToSpeech:()=>eh,SpeechT5HifiGan:()=>th,SpeechT5Model:()=>Db,SpeechT5PreTrainedModel:()=>bl,SqueezeBertForMaskedLM:()=>mr,SqueezeBertForQuestionAnswering:()=>hn,SqueezeBertForSequenceClassification:()=>Ls,SqueezeBertModel:()=>lr,SqueezeBertPreTrainedModel:()=>qr,StableLmForCausalLM:()=>gh,StableLmModel:()=>_h,StableLmPreTrainedModel:()=>Sd,Starcoder2ForCausalLM:()=>ah,Starcoder2Model:()=>ih,Starcoder2PreTrainedModel:()=>Ed,StyleTextToSpeech2Model:()=>Yp,StyleTextToSpeech2PreTrainedModel:()=>Jp,Swin2SRForImageSuperResolution:()=>Ru,Swin2SRModel:()=>Bu,Swin2SRPreTrainedModel:()=>pd,SwinForImageClassification:()=>Lu,SwinForSemanticSegmentation:()=>zu,SwinModel:()=>Du,SwinPreTrainedModel:()=>Cs,T5ForConditionalGeneration:()=>ue,T5Model:()=>le,T5PreTrainedModel:()=>Y,TableTransformerForObjectDetection:()=>A,TableTransformerModel:()=>C,TableTransformerObjectDetectionOutput:()=>W,TableTransformerPreTrainedModel:()=>x,TokenClassifierOutput:()=>cr,TrOCRForCausalLM:()=>sh,TrOCRPreTrainedModel:()=>rh,UltravoxModel:()=>Wh,UltravoxPreTrainedModel:()=>Uh,UniSpeechForCTC:()=>Op,UniSpeechForSequenceClassification:()=>Dp,UniSpeechModel:()=>Fp,UniSpeechPreTrainedModel:()=>yl,UniSpeechSatForAudioFrameClassification:()=>Rp,UniSpeechSatForCTC:()=>zp,UniSpeechSatForSequenceClassification:()=>Bp,UniSpeechSatModel:()=>Lp,UniSpeechSatPreTrainedModel:()=>Ji,ViTForImageClassification:()=>Ai,ViTMAEModel:()=>Ga,ViTMAEPreTrainedModel:()=>Wa,ViTMSNForImageClassification:()=>Ha,ViTMSNModel:()=>Ka,ViTMSNPreTrainedModel:()=>Bi,ViTModel:()=>Ii,ViTPreTrainedModel:()=>_o,VisionEncoderDecoderModel:()=>Do,VitMatteForImageMatting:()=>Za,VitMattePreTrainedModel:()=>Ya,VitPoseForPoseEstimation:()=>Li,VitPosePreTrainedModel:()=>Di,VitsModel:()=>Cd,VitsModelOutput:()=>df,VitsPreTrainedModel:()=>hh,Wav2Vec2BertForCTC:()=>jp,Wav2Vec2BertForSequenceClassification:()=>Vp,Wav2Vec2BertModel:()=>Np,Wav2Vec2BertPreTrainedModel:()=>Ml,Wav2Vec2ForAudioFrameClassification:()=>Sp,Wav2Vec2ForCTC:()=>Pp,Wav2Vec2ForSequenceClassification:()=>Cp,Wav2Vec2Model:()=>Ep,Wav2Vec2PreTrainedModel:()=>rn,WavLMForAudioFrameClassification:()=>Xp,WavLMForCTC:()=>Hp,WavLMForSequenceClassification:()=>qp,WavLMForXVector:()=>Qp,WavLMModel:()=>Kp,WavLMPreTrainedModel:()=>Mo,WeSpeakerResNetModel:()=>Ap,WeSpeakerResNetPreTrainedModel:()=>Ip,WhisperForConditionalGeneration:()=>Fo,WhisperModel:()=>va,WhisperPreTrainedModel:()=>Rn,XLMForQuestionAnswering:()=>_a,XLMForSequenceClassification:()=>fa,XLMForTokenClassification:()=>ko,XLMModel:()=>Js,XLMPreTrainedModel:()=>or,XLMRobertaForMaskedLM:()=>wa,XLMRobertaForQuestionAnswering:()=>Io,XLMRobertaForSequenceClassification:()=>fn,XLMRobertaForTokenClassification:()=>ya,XLMRobertaModel:()=>ga,XLMRobertaPreTrainedModel:()=>cs,XLMWithLMHeadModel:()=>Ys,XVectorOutput:()=>af,YolosForObjectDetection:()=>_p,YolosModel:()=>fp,YolosObjectDetectionOutput:()=>gp,YolosPreTrainedModel:()=>Md});var s=t("./src/configs.js"),o=t("./src/backends/onnx.js"),n=t("./src/utils/dtypes.js"),i=t("./src/utils/generic.js"),a=t("./src/utils/core.js"),l=t("./src/utils/hub.js"),c=t("./src/utils/constants.js"),p=t("./src/generation/logits_process.js"),u=t("./src/generation/configuration_utils.js"),h=t("./src/utils/tensor.js"),g=t("./src/utils/image.js"),_=t("./src/utils/maths.js"),E=t("./src/generation/stopping_criteria.js"),I=t("./src/generation/logits_sampler.js"),M=t("./src/env.js"),y=t("./src/models/whisper/generation_whisper.js"),$=t("./src/models/whisper/common_whisper.js");const P={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5,ImageTextToText:6,Musicgen:7,MultiModality:8,Phi3V:9,AudioTextToText:10,AutoEncoder:11},b=new Map,w=new Map,T=new Map;async function k(v,S,L){var wr;const ie=((wr=L.config)==null?void 0:wr["transformers.js_config"])??{};let ge=L.device??ie.device;ge&&typeof ge!="string"&&(ge.hasOwnProperty(S)?ge=ge[S]:(console.warn(`device not specified for "${S}". Using the default device.`),ge=null));const fe=ge??(M.apis.IS_NODE_ENV?"cpu":"wasm"),Se=(0,o.deviceToExecutionProviders)(fe);let De=L.dtype??ie.dtype;if(typeof De!="string"&&(De&&De.hasOwnProperty(S)?De=De[S]:(De=n.DEFAULT_DEVICE_DTYPE_MAPPING[fe]??n.DATA_TYPES.fp32,console.warn(`dtype not specified for "${S}". Using the default dtype (${De}) for this device (${fe}).`))),De===n.DATA_TYPES.auto){let Pt=ie.dtype;typeof Pt!="string"&&(Pt=Pt[S]),Pt&&Pt!==n.DATA_TYPES.auto&&n.DATA_TYPES.hasOwnProperty(Pt)?De=Pt:De=n.DEFAULT_DEVICE_DTYPE_MAPPING[fe]??n.DATA_TYPES.fp32}const Ge=De;if(n.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(Ge)){if(Ge===n.DATA_TYPES.fp16&&fe==="webgpu"&&!await(0,n.isWebGpuFp16Supported)())throw new Error(`The device (${fe}) does not support fp16.`)}else throw new Error(`Invalid dtype: ${Ge}. Should be one of: ${Object.keys(n.DATA_TYPES).join(", ")}`);const Je=ie.kv_cache_dtype?typeof ie.kv_cache_dtype=="string"?ie.kv_cache_dtype:ie.kv_cache_dtype[Ge]??"float32":void 0;if(Je&&!["float32","float16"].includes(Je))throw new Error(`Invalid kv_cache_dtype: ${Je}. Should be one of: float32, float16`);const lt={dtype:Ge,kv_cache_dtype:Je},yt=n.DEFAULT_DTYPE_SUFFIX_MAPPING[Ge],st=`${S}${yt}.onnx`,Et=`${L.subfolder??""}/${st}`,at={...L.session_options};at.executionProviders??(at.executionProviders=Se);const vt=ie.free_dimension_overrides;vt?at.freeDimensionOverrides??(at.freeDimensionOverrides=vt):fe.startsWith("webnn")&&!at.freeDimensionOverrides&&console.warn('WebNN does not currently support dynamic shapes and requires `free_dimension_overrides` to be set in config.json as a field within "transformers.js_config". When `free_dimension_overrides` is not set, you may experience significant performance degradation.');const ct=(0,l.getModelFile)(v,Et,!0,L,M.apis.IS_NODE_ENV),Tt=L.use_external_data_format??ie.use_external_data_format;let Dt=[];if(Tt){let Pt;typeof Tt=="object"?Tt.hasOwnProperty(st)?Pt=Tt[st]:Tt.hasOwnProperty(S)?Pt=Tt[S]:Pt=!1:Pt=Tt;const Nt=+Pt;if(Nt>l.MAX_EXTERNAL_DATA_CHUNKS)throw new Error(`The number of external data chunks (${Nt}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let er=0;er{const Pr=await(0,l.getModelFile)(v,jr,!0,L,M.apis.IS_NODE_ENV);sn(Pr instanceof Uint8Array?{path:sr,data:Pr}:sr)}))}}else at.externalData!==void 0&&(Dt=at.externalData.map(async Pt=>{if(typeof Pt.data=="string"){const Nt=await(0,l.getModelFile)(v,Pt.data,!0,L);return{...Pt,data:Nt}}return Pt}));if(Dt.length>0){const Pt=await Promise.all(Dt);M.apis.IS_NODE_ENV||(at.externalData=Pt)}if(fe==="webgpu"){const Pt=(0,s.getKeyValueShapes)(L.config,{prefix:"present"});if(Object.keys(Pt).length>0&&!(0,o.isONNXProxy)()){const Nt={};for(const er in Pt)Nt[er]="gpu-buffer";at.preferredOutputLocation=Nt}}return{buffer_or_path:await ct,session_options:at,session_config:lt}}async function z(v,S,L){return Object.fromEntries(await Promise.all(Object.keys(S).map(async ie=>{const{buffer_or_path:ge,session_options:fe,session_config:Se}=await k(v,S[ie],L),De=await(0,o.createInferenceSession)(ge,fe,Se);return[ie,De]})))}async function R(v,S,L){return Object.fromEntries(await Promise.all(Object.keys(S).map(async ie=>{const ge=await(0,l.getModelJSON)(v,S[ie],!1,L);return[ie,ge]})))}function Q(v,S){const L=Object.create(null),ie=[];for(const Se of v.inputNames){const De=S[Se];if(!(De instanceof h.Tensor)){ie.push(Se);continue}L[Se]=(0,o.isONNXProxy)()?De.clone():De}if(ie.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${ie.join(", ")}.`);const ge=Object.keys(S).length,fe=v.inputNames.length;if(ge>fe){let Se=Object.keys(S).filter(De=>!v.inputNames.includes(De));console.warn(`WARNING: Too many inputs were provided (${ge} > ${fe}). The following inputs will be ignored: "${Se.join(", ")}".`)}return L}async function q(v,S){const L=Q(v,S);try{const ie=Object.fromEntries(Object.entries(L).map(([fe,Se])=>[fe,Se.ort_tensor]));let ge=await v.run(ie);return ge=U(ge),ge}catch(ie){const ge=Object.fromEntries(Object.entries(L).map(([fe,{type:Se,dims:De,data:Ge}])=>[fe,{type:Se,dims:De,data:Ge}]));throw console.error(`An error occurred during model execution: "${ie}".`),console.error("Inputs given to model:",ge),ie}}function U(v){for(let S in v)(0,o.isONNXTensor)(v[S])?v[S]=new h.Tensor(v[S]):typeof v[S]=="object"&&U(v[S]);return v}function Z(v){if(v instanceof h.Tensor)return v;if(v.length===0)throw Error("items must be non-empty");if(Array.isArray(v[0])){if(v.some(S=>S.length!==v[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new h.Tensor("int64",BigInt64Array.from(v.flat().map(S=>BigInt(S))),[v.length,v[0].length])}else return new h.Tensor("int64",BigInt64Array.from(v.map(S=>BigInt(S))),[1,v.length])}function H(v){return new h.Tensor("bool",[v],[1])}async function J(v,S){let{encoder_outputs:L,input_ids:ie,decoder_input_ids:ge,...fe}=S;if(!L){const De=(0,a.pick)(S,v.sessions.model.inputNames);L=(await oe(v,De)).last_hidden_state}return fe.input_ids=ge,fe.encoder_hidden_states=L,v.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(fe.encoder_attention_mask=S.attention_mask),await ce(v,fe,!0)}async function oe(v,S){const L=v.sessions.model,ie=(0,a.pick)(S,L.inputNames);if(L.inputNames.includes("inputs_embeds")&&!ie.inputs_embeds){if(!S.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");ie.inputs_embeds=await v.encode_text({input_ids:S.input_ids})}if(L.inputNames.includes("token_type_ids")&&!ie.token_type_ids){if(!ie.input_ids)throw new Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");ie.token_type_ids=(0,h.zeros_like)(ie.input_ids)}if(L.inputNames.includes("pixel_mask")&&!ie.pixel_mask){if(!ie.pixel_values)throw new Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");const ge=ie.pixel_values.dims;ie.pixel_mask=(0,h.ones)([ge[0],ge[2],ge[3]])}return await q(L,ie)}async function ae(v,S){const L=await v.encode(S);return await v.decode(L)}async function ce(v,S,L=!1){const ie=v.sessions[L?"decoder_model_merged":"model"],{past_key_values:ge,...fe}=S;if(ie.inputNames.includes("use_cache_branch")&&(fe.use_cache_branch=H(!!ge)),ie.inputNames.includes("position_ids")&&fe.attention_mask&&!fe.position_ids){const De=["paligemma","gemma3_text","gemma3"].includes(v.config.model_type)?1:0;fe.position_ids=_e(fe,ge,De)}v.addPastKeyValues(fe,ge);const Se=(0,a.pick)(fe,ie.inputNames);return await q(ie,Se)}function he({modality_token_id:v,inputs_embeds:S,modality_features:L,input_ids:ie,attention_mask:ge}){const fe=ie.tolist().map(Je=>Je.reduce((lt,yt,st)=>(yt==v&<.push(st),lt),[])),Se=fe.reduce((Je,lt)=>Je+lt.length,0),De=L.dims[0];if(Se!==De)throw new Error(`Number of tokens and features do not match: tokens: ${Se}, features ${De}`);let Ge=0;for(let Je=0;Jefe.dims[1])){if(geDe==v.config.image_token_index)){const De=v.config.num_image_tokens;if(!De)throw new Error("`num_image_tokens` is missing in the model configuration.");const Ge=fe.dims[1]-(ge-De);L.input_ids=fe.slice(null,[-Ge,null]),L.attention_mask=(0,h.ones)([1,ge+Ge])}}}return L}function He(v,S,L,ie){return L.past_key_values&&(S=S.map(ge=>[ge.at(-1)])),{...L,decoder_input_ids:Z(S)}}function Me(v,...S){return v.config.is_encoder_decoder?He(v,...S):ke(v,...S)}function K(v,S,L,ie){const ge=!!L.past_key_values;return ie.guidance_scale!==null&&ie.guidance_scale>1&&(ge?L.input_ids=(0,h.cat)([L.input_ids,L.input_ids],0):(L.input_ids=(0,h.cat)([L.input_ids,(0,h.full_like)(L.input_ids,BigInt(ie.pad_token_id))],0),L.attention_mask=(0,h.cat)([L.attention_mask,(0,h.full_like)(L.attention_mask,0n)],0))),(ge||!L.pixel_values)&&(L.pixel_values=(0,h.full)([0,0,3,384,384],1)),ge&&(L.images_seq_mask=new h.Tensor("bool",new Array(1).fill(!0).fill(!1,0,1),[1,1]),L.images_emb_mask=new h.Tensor("bool",new Array(0).fill(!1),[1,1,0])),L}class j extends i.Callable{constructor(L,ie,ge){super();re(this,"main_input_name","input_ids");re(this,"forward_params",["input_ids","attention_mask"]);this.config=L,this.sessions=ie,this.configs=ge;const fe=T.get(this.constructor),Se=b.get(fe);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,Se){case P.DecoderOnly:this.can_generate=!0,this._forward=ce,this._prepare_inputs_for_generation=ke;break;case P.Seq2Seq:case P.Vision2Seq:case P.Musicgen:this.can_generate=!0,this._forward=J,this._prepare_inputs_for_generation=He;break;case P.EncoderDecoder:this._forward=J;break;case P.ImageTextToText:this.can_generate=!0,this._forward=X,this._prepare_inputs_for_generation=Me;break;case P.AudioTextToText:this.can_generate=!0,this._forward=se,this._prepare_inputs_for_generation=Me;break;case P.Phi3V:this.can_generate=!0,this._prepare_inputs_for_generation=Me;break;case P.MultiModality:this.can_generate=!0,this._prepare_inputs_for_generation=K;break;case P.AutoEncoder:this._forward=ae;break;default:this._forward=oe;break}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){var ie;const L=[];for(const ge of Object.values(this.sessions))(ie=ge==null?void 0:ge.handler)!=null&&ie.dispose&&L.push(ge.handler.dispose());return await Promise.all(L)}static async from_pretrained(L,{progress_callback:ie=null,config:ge=null,cache_dir:fe=null,local_files_only:Se=!1,revision:De="main",model_file_name:Ge=null,subfolder:Je="onnx",device:lt=null,dtype:yt=null,use_external_data_format:st=null,session_options:Et={}}={}){let at={progress_callback:ie,config:ge,cache_dir:fe,local_files_only:Se,revision:De,model_file_name:Ge,subfolder:Je,device:lt,dtype:yt,use_external_data_format:st,session_options:Et};const vt=T.get(this),ct=b.get(vt);ge=at.config=await s.AutoConfig.from_pretrained(L,at);let Tt;if(ct===P.DecoderOnly)Tt=await Promise.all([z(L,{model:at.model_file_name??"model"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===P.Seq2Seq||ct===P.Vision2Seq)Tt=await Promise.all([z(L,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===P.MaskGeneration)Tt=await Promise.all([z(L,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},at)]);else if(ct===P.EncoderDecoder)Tt=await Promise.all([z(L,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},at)]);else if(ct===P.ImageTextToText){const Dt={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};ge.is_encoder_decoder&&(Dt.model="encoder_model"),Tt=await Promise.all([z(L,Dt,at),R(L,{generation_config:"generation_config.json"},at)])}else if(ct===P.AudioTextToText){const Dt={embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"};Tt=await Promise.all([z(L,Dt,at),R(L,{generation_config:"generation_config.json"},at)])}else if(ct===P.Musicgen)Tt=await Promise.all([z(L,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===P.MultiModality)Tt=await Promise.all([z(L,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===P.Phi3V)Tt=await Promise.all([z(L,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===P.AutoEncoder)Tt=await Promise.all([z(L,{encoder_model:"encoder_model",decoder_model:"decoder_model"},at)]);else{if(ct!==P.EncoderOnly){const Dt=vt??(ge==null?void 0:ge.model_type);Dt!=="custom"&&console.warn(`Model type for '${Dt}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`)}Tt=await Promise.all([z(L,{model:at.model_file_name??"model"},at)])}return new this(ge,...Tt)}async _call(L){return await this.forward(L)}async forward(L){return await this._forward(this,L)}get generation_config(){var L;return((L=this.configs)==null?void 0:L.generation_config)??null}_get_logits_warper(L){const ie=new p.LogitsProcessorList;return L.temperature!==null&&L.temperature!==1&&ie.push(new p.TemperatureLogitsWarper(L.temperature)),L.top_k!==null&&L.top_k!==0&&ie.push(new p.TopKLogitsWarper(L.top_k)),L.top_p!==null&&L.top_p<1&&ie.push(new p.TopPLogitsWarper(L.top_p)),ie}_get_logits_processor(L,ie,ge=null){const fe=new p.LogitsProcessorList;if(L.repetition_penalty!==null&&L.repetition_penalty!==1&&fe.push(new p.RepetitionPenaltyLogitsProcessor(L.repetition_penalty)),L.no_repeat_ngram_size!==null&&L.no_repeat_ngram_size>0&&fe.push(new p.NoRepeatNGramLogitsProcessor(L.no_repeat_ngram_size)),L.bad_words_ids!==null&&fe.push(new p.NoBadWordsLogitsProcessor(L.bad_words_ids,L.eos_token_id)),L.min_length!==null&&L.eos_token_id!==null&&L.min_length>0&&fe.push(new p.MinLengthLogitsProcessor(L.min_length,L.eos_token_id)),L.min_new_tokens!==null&&L.eos_token_id!==null&&L.min_new_tokens>0&&fe.push(new p.MinNewTokensLengthLogitsProcessor(ie,L.min_new_tokens,L.eos_token_id)),L.forced_bos_token_id!==null&&fe.push(new p.ForcedBOSTokenLogitsProcessor(L.forced_bos_token_id)),L.forced_eos_token_id!==null&&fe.push(new p.ForcedEOSTokenLogitsProcessor(L.max_length,L.forced_eos_token_id)),L.begin_suppress_tokens!==null){const Se=ie>1||L.forced_bos_token_id===null?ie:ie+1;fe.push(new p.SuppressTokensAtBeginLogitsProcessor(L.begin_suppress_tokens,Se))}return L.guidance_scale!==null&&L.guidance_scale>1&&fe.push(new p.ClassifierFreeGuidanceLogitsProcessor(L.guidance_scale)),ge!==null&&fe.extend(ge),fe}_prepare_generation_config(L,ie,ge=u.GenerationConfig){const fe={...this.config};for(const De of["decoder","generator","text_config"])De in fe&&Object.assign(fe,fe[De]);const Se=new ge(fe);return Object.assign(Se,this.generation_config??{}),L&&Object.assign(Se,L),ie&&Object.assign(Se,(0,a.pick)(ie,Object.getOwnPropertyNames(Se))),Se}_get_stopping_criteria(L,ie=null){const ge=new E.StoppingCriteriaList;return L.max_length!==null&&ge.push(new E.MaxLengthCriteria(L.max_length,this.config.max_position_embeddings??null)),L.eos_token_id!==null&&ge.push(new E.EosTokenCriteria(L.eos_token_id)),ie&&ge.extend(ie),ge}_validate_model_class(){if(!this.can_generate){const L=[Ld,zd,Dd,Od],ie=T.get(this.constructor),ge=new Set,fe=this.config.model_type;for(const De of L){const Ge=De.get(fe);Ge&&ge.add(Ge[0])}let Se=`The current model class (${ie}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw ge.size>0&&(Se+=` Please use the following class instead: ${[...ge].join(", ")}`),Error(Se)}}prepare_inputs_for_generation(...L){return this._prepare_inputs_for_generation(this,...L)}_update_model_kwargs_for_generation({generated_input_ids:L,outputs:ie,model_inputs:ge,is_encoder_decoder:fe}){return ge.past_key_values=this.getPastKeyValues(ie,ge.past_key_values),ge.input_ids=new h.Tensor("int64",L.flat(),[L.length,1]),fe||(ge.attention_mask=(0,h.cat)([ge.attention_mask,(0,h.ones)([ge.attention_mask.dims[0],1])],1)),ge.position_ids=null,ge}_prepare_model_inputs({inputs:L,bos_token_id:ie,model_kwargs:ge}){const fe=(0,a.pick)(ge,this.forward_params),Se=this.main_input_name;if(Se in fe){if(L)throw new Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else fe[Se]=L;return{inputs_tensor:fe[Se],model_inputs:fe,model_input_name:Se}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:L,model_inputs:ie,model_input_name:ge,generation_config:fe}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!ie.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:De,pixel_values:Ge,attention_mask:Je,...lt}=ie,yt=await this._prepare_inputs_embeds(ie);ie={...lt,...(0,a.pick)(yt,["inputs_embeds","attention_mask"])}}let{last_hidden_state:Se}=await oe(this,ie);if(fe.guidance_scale!==null&&fe.guidance_scale>1)Se=(0,h.cat)([Se,(0,h.full_like)(Se,0)],0),"attention_mask"in ie&&(ie.attention_mask=(0,h.cat)([ie.attention_mask,(0,h.zeros_like)(ie.attention_mask)],0));else if(ie.decoder_input_ids){const De=Z(ie.decoder_input_ids).dims[0];if(De!==Se.dims[0]){if(Se.dims[0]!==1)throw new Error(`The encoder outputs have a different batch size (${Se.dims[0]}) than the decoder inputs (${De}).`);Se=(0,h.cat)(Array.from({length:De},()=>Se),0)}}return ie.encoder_outputs=Se,ie}_prepare_decoder_input_ids_for_generation({batch_size:L,model_input_name:ie,model_kwargs:ge,decoder_start_token_id:fe,bos_token_id:Se,generation_config:De}){let{decoder_input_ids:Ge,...Je}=ge;if(!(Ge instanceof h.Tensor)){if(Ge)Array.isArray(Ge[0])||(Ge=Array.from({length:L},()=>Ge));else if(fe??(fe=Se),this.config.model_type==="musicgen")Ge=Array.from({length:L*this.config.decoder.num_codebooks},()=>[fe]);else if(Array.isArray(fe)){if(fe.length!==L)throw new Error(`\`decoder_start_token_id\` expcted to have length ${L} but got ${fe.length}`);Ge=fe}else Ge=Array.from({length:L},()=>[fe]);Ge=Z(Ge)}return ge.decoder_attention_mask=(0,h.ones_like)(Ge),{input_ids:Ge,model_inputs:Je}}async generate({inputs:L=null,generation_config:ie=null,logits_processor:ge=null,stopping_criteria:fe=null,streamer:Se=null,...De}){this._validate_model_class(),ie=this._prepare_generation_config(ie,De);let{inputs_tensor:Ge,model_inputs:Je,model_input_name:lt}=this._prepare_model_inputs({inputs:L,model_kwargs:De});const yt=this.config.is_encoder_decoder;yt&&("encoder_outputs"in Je||(Je=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:Ge,model_inputs:Je,model_input_name:lt,generation_config:ie})));let st;yt?{input_ids:st,model_inputs:Je}=this._prepare_decoder_input_ids_for_generation({batch_size:Je[lt].dims.at(0),model_input_name:lt,model_kwargs:Je,decoder_start_token_id:ie.decoder_start_token_id,bos_token_id:ie.bos_token_id,generation_config:ie}):st=Je[lt];let Et=st.dims.at(-1);ie.max_new_tokens!==null&&(ie.max_length=Et+ie.max_new_tokens);const at=this._get_logits_processor(ie,Et,ge),vt=this._get_stopping_criteria(ie,fe),ct=Je[lt].dims.at(0),Tt=I.LogitsSampler.getSampler(ie),Dt=new Array(ct).fill(0),Qt=st.tolist();Se&&Se.put(Qt);let wr,Pt={};for(;;){if(Je=this.prepare_inputs_for_generation(Qt,Je,ie),wr=await this.forward(Je),ie.output_attentions&&ie.return_dict_in_generate){const Pr=this.getAttentions(wr);for(const Ss in Pr)Ss in Pt||(Pt[Ss]=[]),Pt[Ss].push(Pr[Ss])}const sr=wr.logits.slice(null,-1,null),jr=at(Qt,sr),sn=[];for(let Pr=0;PrPr))break;Je=this._update_model_kwargs_for_generation({generated_input_ids:sn,outputs:wr,model_inputs:Je,is_encoder_decoder:yt})}Se&&Se.end();const Nt=this.getPastKeyValues(wr,Je.past_key_values,!0),er=new h.Tensor("int64",Qt.flat(),[Qt.length,Qt[0].length]);if(ie.return_dict_in_generate)return{sequences:er,past_key_values:Nt,...Pt};for(const sr of Object.values(wr))sr.location==="gpu-buffer"&&sr.dispose();return er}getPastKeyValues(L,ie,ge=!1){const fe=Object.create(null);for(const Se in L)if(Se.startsWith("present")){const De=Se.replace("present","past_key_values"),Ge=Se.includes("encoder");if(Ge&&ie?fe[De]=ie[De]:fe[De]=L[Se],ie&&(!Ge||ge)){const Je=ie[De];Je.location==="gpu-buffer"&&Je.dispose()}}return fe}getAttentions(L){const ie={};for(const ge of["cross_attentions","encoder_attentions","decoder_attentions"])for(const fe in L)fe.startsWith(ge)&&(ge in ie||(ie[ge]=[]),ie[ge].push(L[fe]));return ie}addPastKeyValues(L,ie){var ge,fe,Se;if(ie)Object.assign(L,ie);else{const De=this.sessions.decoder_model_merged??this.sessions.model,Ge=((ge=De==null?void 0:De.config)==null?void 0:ge.kv_cache_dtype)??"float32",Je=Ge==="float16"?new h.DataTypeMap.float16:[],lt=((Se=(fe=L[this.main_input_name]??L.attention_mask)==null?void 0:fe.dims)==null?void 0:Se[0])??1,yt=(0,s.getKeyValueShapes)(this.config,{batch_size:lt});for(const st in yt)L[st]=new h.Tensor(Ge,Je,yt[st])}}async encode_image({pixel_values:L}){const ie=(await q(this.sessions.vision_encoder,{pixel_values:L})).image_features;return this.config.num_image_tokens||(console.warn(`The number of image tokens was not set in the model configuration. Setting it to the number of features detected by the vision encoder (${ie.dims[1]}).`),this.config.num_image_tokens=ie.dims[1]),ie}async encode_text({input_ids:L}){return(await q(this.sessions.embed_tokens,{input_ids:L})).inputs_embeds}async encode_audio({audio_values:L}){return(await q(this.sessions.audio_encoder,{audio_values:L})).audio_features}}class me{}class Pe extends me{constructor({last_hidden_state:S,hidden_states:L=null,attentions:ie=null}){super(),this.last_hidden_state=S,this.hidden_states=L,this.attentions=ie}}class Te extends j{}class Ae extends Te{}class Ie extends Te{async _call(S){return new gr(await super._call(S))}}class Le extends Te{async _call(S){return new Mt(await super._call(S))}}class Ne extends Te{async _call(S){return new cr(await super._call(S))}}class We extends Te{async _call(S){return new Er(await super._call(S))}}class D extends j{}class ee extends D{}class B extends D{async _call(S){return new gr(await super._call(S))}}class te extends D{async _call(S){return new Mt(await super._call(S))}}class de extends D{async _call(S){return new cr(await super._call(S))}}class be extends j{}class ve extends be{}class Re extends j{}class Fe extends Re{}class je extends Re{async _call(S){return new gr(await super._call(S))}}class qe extends Re{async _call(S){return new Mt(await super._call(S))}}class Xe extends Re{async _call(S){return new cr(await super._call(S))}}class ut extends Re{async _call(S){return new Er(await super._call(S))}}class wt extends j{}class nr extends wt{}class jt extends wt{async _call(S){return new gr(await super._call(S))}}class ar extends wt{async _call(S){return new Mt(await super._call(S))}}class es extends wt{async _call(S){return new cr(await super._call(S))}}class ks extends wt{async _call(S){return new Er(await super._call(S))}}class Or extends j{}class ts extends Or{}class Is extends Or{async _call(S){return new gr(await super._call(S))}}class Br extends Or{async _call(S){return new Mt(await super._call(S))}}class dt extends Or{async _call(S){return new cr(await super._call(S))}}class Gr extends Or{async _call(S){return new Er(await super._call(S))}}class Rr extends j{}class rs extends Rr{}class bs extends Rr{async _call(S){return new gr(await super._call(S))}}class vs extends Rr{async _call(S){return new Mt(await super._call(S))}}class xs extends Rr{async _call(S){return new cr(await super._call(S))}}class As extends Rr{async _call(S){return new Er(await super._call(S))}}class hr extends j{}class Be extends hr{}class et extends hr{async _call(S){return new gr(await super._call(S))}}class ot extends hr{async _call(S){return new Mt(await super._call(S))}}class rr extends hr{async _call(S){return new cr(await super._call(S))}}class zt extends hr{async _call(S){return new Er(await super._call(S))}}class Sr extends j{}class ss extends Sr{}class ns extends Sr{async _call(S){return new gr(await super._call(S))}}class Tr extends Sr{async _call(S){return new Mt(await super._call(S))}}class os extends Sr{async _call(S){return new cr(await super._call(S))}}class is extends Sr{async _call(S){return new Er(await super._call(S))}}class Kr extends j{}class Ts extends Kr{}class Ws extends Kr{async _call(S){return new Mt(await super._call(S))}}class Gs extends Kr{async _call(S){return new cr(await super._call(S))}}class Ks extends Kr{async _call(S){return new Er(await super._call(S))}}class Hs extends Kr{async _call(S){return new gr(await super._call(S))}}class as extends j{}class qs extends as{}class Qs extends as{async _call(S){return new gr(await super._call(S))}}class Xs extends as{async _call(S){return new Mt(await super._call(S))}}class Dr extends as{async _call(S){return new cr(await super._call(S))}}class Es extends j{}class Mr extends Es{}class Fs extends Es{async _call(S){return new gr(await super._call(S))}}class Os extends Es{async _call(S){return new Mt(await super._call(S))}}class $r extends Es{async _call(S){return new Er(await super._call(S))}}class Hr extends j{}class un extends Hr{}class Lr extends Hr{async _call(S){return new gr(await super._call(S))}}class pn extends Hr{async _call(S){return new Mt(await super._call(S))}}class Ds extends Hr{async _call(S){return new cr(await super._call(S))}}class kr extends Hr{async _call(S){return new Er(await super._call(S))}}class qr extends j{}class lr extends qr{}class mr extends qr{async _call(S){return new gr(await super._call(S))}}class Ls extends qr{async _call(S){return new Mt(await super._call(S))}}class hn extends qr{async _call(S){return new Er(await super._call(S))}}class Ps extends j{}class mn extends Ps{}class pe extends Ps{async _call(S){return new Mt(await super._call(S))}}class F extends Ps{async _call(S){return new Er(await super._call(S))}}class V extends Ps{async _call(S){return new gr(await super._call(S))}}class Y extends j{constructor(){super(...arguments);re(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}}class le extends Y{}class ue extends Y{}class Ce extends j{}class Ue extends Ce{}class Qe extends Ce{}class Ke extends j{}class Ze extends Ke{}class pt extends Ke{}class Ct extends j{}class $t extends Ct{}class Ut extends Ct{}class At extends Ct{async _call(S){return new Mt(await super._call(S))}}class Vt extends j{}class br extends Vt{}class fr extends Vt{}class Qr extends Vt{async _call(S){return new Mt(await super._call(S))}}class vr extends Vt{}class ls extends j{}class Wt extends ls{}class Yt extends ls{}class _r extends j{}class Xr extends _r{}class ds extends _r{}class Ht extends j{}class dr extends Ht{}class Rt extends Ht{async _call(S){return new gr(await super._call(S))}}class Xt extends Ht{async _call(S){return new Mt(await super._call(S))}}class qt extends Ht{async _call(S){return new cr(await super._call(S))}}class Zt extends Ht{async _call(S){return new Er(await super._call(S))}}class or extends j{}class Js extends or{}class Ys extends or{async _call(S){return new gr(await super._call(S))}}class fa extends or{async _call(S){return new Mt(await super._call(S))}}class ko extends or{async _call(S){return new cr(await super._call(S))}}class _a extends or{async _call(S){return new Er(await super._call(S))}}class cs extends j{}class ga extends cs{}class wa extends cs{async _call(S){return new gr(await super._call(S))}}class fn extends cs{async _call(S){return new Mt(await super._call(S))}}class ya extends cs{async _call(S){return new cr(await super._call(S))}}class Io extends cs{async _call(S){return new Er(await super._call(S))}}class Ao extends j{}class Ma extends Ao{}class ba extends Ao{}class Rn extends j{constructor(){super(...arguments);re(this,"requires_attention_mask",!1);re(this,"main_input_name","input_features");re(this,"forward_params",["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"])}}class va extends Rn{}class Fo extends Rn{_prepare_generation_config(S,L){return super._prepare_generation_config(S,L,y.WhisperGenerationConfig)}_retrieve_init_tokens(S){const L=[S.decoder_start_token_id];let ie=S.language;const ge=S.task;if(S.is_multilingual){ie||(console.warn("No language specified - defaulting to English (en)."),ie="en");const Se=`<|${(0,$.whisper_language_to_code)(ie)}|>`;L.push(S.lang_to_id[Se]),L.push(S.task_to_id[ge??"transcribe"])}else if(ie||ge)throw new Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!S.return_timestamps&&S.no_timestamps_token_id&&L.at(-1)!==S.no_timestamps_token_id?L.push(S.no_timestamps_token_id):S.return_timestamps&&L.at(-1)===S.no_timestamps_token_id&&(console.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),L.pop()),L.filter(fe=>fe!=null)}async generate({inputs:S=null,generation_config:L=null,logits_processor:ie=null,stopping_criteria:ge=null,...fe}){L=this._prepare_generation_config(L,fe);const Se=fe.decoder_input_ids??this._retrieve_init_tokens(L);if(L.return_timestamps&&(ie??(ie=new p.LogitsProcessorList),ie.push(new p.WhisperTimeStampLogitsProcessor(L,Se))),L.begin_suppress_tokens&&(ie??(ie=new p.LogitsProcessorList),ie.push(new p.SuppressTokensAtBeginLogitsProcessor(L.begin_suppress_tokens,Se.length))),L.return_token_timestamps){if(!L.alignment_heads)throw new Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");L.task==="translate"&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),L.output_attentions=!0,L.return_dict_in_generate=!0}const De=await super.generate({inputs:S,generation_config:L,logits_processor:ie,decoder_input_ids:Se,...fe});return L.return_token_timestamps&&(De.token_timestamps=this._extract_token_timestamps(De,L.alignment_heads,L.num_frames)),De}_extract_token_timestamps(S,L,ie=null,ge=.02){if(!S.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");ie==null&&console.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let fe=this.config.median_filter_width;fe===void 0&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),fe=7);const Se=S.cross_attentions,De=Array.from({length:this.config.decoder_layers},(vt,ct)=>(0,h.cat)(Se.map(Tt=>Tt[ct]),2)),Ge=(0,h.stack)(L.map(([vt,ct])=>{if(vt>=De.length)throw new Error(`Layer index ${vt} is out of bounds for cross attentions (length ${De.length}).`);return ie?De[vt].slice(null,ct,null,[0,ie]):De[vt].slice(null,ct)})).transpose(1,0,2,3),[Je,lt]=(0,h.std_mean)(Ge,-2,0,!0),yt=Ge.clone();for(let vt=0;vtTt[er+1]-Tt[er]),wr=(0,a.mergeArrays)([1],Qt).map(Nt=>!!Nt),Pt=[];for(let Nt=0;Ntst.findIndex(Et=>Et==fe)),Ge=De.every(st=>st===-1),Je=De.every(st=>st!==-1);if(!Ge&&!Je)throw new Error("Every input should contain either 0 or 1 image token.");if(Ge)return{inputs_embeds:S,attention_mask:ge};const lt=[],yt=[];for(let st=0;stArray.from({length:S.dims[0]},Qt=>Array.from({length:S.dims[1]},wr=>1))),at=L?L.tolist():[],vt=ie?ie.tolist():[];let ct=0,Tt=0;for(let Dt=0;Dtst[Dt][ir]==1),Pt=Qt.reduce((Gt,ir,nn)=>(ir==Ge&&Gt.push(nn),Gt),[]).map(Gt=>Qt[Gt+1]),Nt=Pt.filter(Gt=>Gt==Se).length,er=Pt.filter(Gt=>Gt==De).length;let sr=[],jr=0,sn=Nt,Il=er;for(let Gt=0;Gtus>jr&&vn==Se),nn=Qt.findIndex((vn,us)=>us>jr&&vn==De),bn=sn>0&&ir!==-1?ir:Qt.length+1,vo=Il>0&&nn!==-1?nn:Qt.length+1;let Dl,Nd,jd,Vd;bn0?(0,_.max)(sr.at(-1))[0]+1:0;sr.push(Array.from({length:3*Wd},(vn,us)=>cf+us%Wd));const Gd=Wd+cf,zl=Qb*Ud*Ll,Xb=Array.from({length:zl},(vn,us)=>Gd+Math.floor(us/(Ud*Ll))),Jb=Array.from({length:zl},(vn,us)=>Gd+Math.floor(us/Ll)%Ud),Yb=Array.from({length:zl},(vn,us)=>Gd+us%Ll);sr.push([Xb,Jb,Yb].flat()),jr=Dl+zl}if(jr0?(0,_.max)(sr.at(-1))[0]+1:0,ir=Qt.length-jr;sr.push(Array.from({length:3*ir},(nn,bn)=>Gt+bn%ir))}const Pr=sr.reduce((Gt,ir)=>Gt+ir.length,0),Ss=new Array(Pr);let Rd=0;for(let Gt=0;Gt<3;++Gt)for(let ir=0;iryt[ct%yt.length]),at=Array.from({length:st[0]},(vt,ct)=>(0,_.max)(yt.subarray(st[1]*ct,st[1]*(ct+1)))[0]+1n+BigInt(st[1]));return[new h.Tensor("int64",Et,[3,...st]),new h.Tensor("int64",at,[at.length,1])]}else{const[yt,st]=S.dims,Et=BigInt64Array.from({length:3*yt*st},(at,vt)=>BigInt(Math.floor(vt%st/yt)));return[new h.Tensor("int64",Et,[3,...S.dims]),(0,h.zeros)([yt,1])]}}async encode_image({pixel_values:S,image_grid_thw:L}){return(await q(this.sessions.vision_encoder,{pixel_values:S,grid_thw:L})).image_features}_merge_input_ids_with_image_features(S){return N({image_token_id:this.config.image_token_id,...S})}prepare_inputs_for_generation(S,L,ie){if(L.attention_mask&&!L.position_ids)if(!L.past_key_values)[L.position_ids,L.rope_deltas]=this.get_rope_index(L.input_ids,L.image_grid_thw,L.video_grid_thw,L.attention_mask);else{L.pixel_values=null;const ge=BigInt(Object.values(L.past_key_values)[0].dims.at(-2)),fe=L.rope_deltas.map(Se=>ge+Se);L.position_ids=(0,h.stack)([fe,fe,fe],0)}return L}}class uo extends j{}class bi extends uo{}class vi extends uo{}class po extends j{}class xi extends po{}class Ti extends po{}class ho extends j{}class Ei extends ho{}class Pi extends ho{}class mo extends j{}class Ci extends mo{}class Si extends mo{}class fo extends j{}class $i extends fo{}class ki extends fo{}class _o extends j{}class Ii extends _o{}class Ai extends _o{async _call(S){return new Mt(await super._call(S))}}class go extends j{}class Fi extends go{}class Oi extends go{async _call(S){return new Mt(await super._call(S))}}class Di extends j{}class Li extends Di{}class zi extends j{}class Va extends zi{}class Ua extends zi{async _call(S){return new Mt(await super._call(S))}}class Wa extends j{}class Ga extends Wa{}class Bi extends j{}class Ka extends Bi{}class Ha extends Bi{async _call(S){return new Mt(await super._call(S))}}class qa extends j{}class Qa extends qa{}class Ri extends j{}class Xa extends Ri{}class Ja extends Ri{async _call(S){return new Mt(await super._call(S))}}class Ya extends j{}class Za extends Ya{async _call(S){return new lf(await super._call(S))}}class Ni extends j{}class el extends Ni{}class tl extends Ni{async _call(S){return new Mt(await super._call(S))}}class ji extends j{}class rl extends ji{}class sl extends ji{async _call(S){return new Mt(await super._call(S))}}class Vi extends j{}class nl extends Vi{}class ol extends Vi{}class Ui extends j{}class il extends Ui{}class al extends Ui{}class Wi extends j{}class ll extends Wi{}class dl extends Wi{async _call(S){return new Mt(await super._call(S))}}class wo extends j{}class cl extends wo{}class ul extends wo{async _call(S){return new Ki(await super._call(S))}}class Gi extends wo{async _call(S){return new pl(await super._call(S))}}class Ki extends me{constructor({logits:S,pred_boxes:L}){super(),this.logits=S,this.pred_boxes=L}}class pl extends me{constructor({logits:S,pred_boxes:L,pred_masks:ie}){super(),this.logits=S,this.pred_boxes=L,this.pred_masks=ie}}class Hi extends j{}class hl extends Hi{}class ml extends Hi{async _call(S){return new yo(await super._call(S))}}class yo extends me{constructor({logits:S,pred_boxes:L}){super(),this.logits=S,this.pred_boxes=L}}class qi extends j{}class fl extends qi{}class _l extends qi{async _call(S){return new gl(await super._call(S))}}class gl extends yo{}class Qi extends j{}class Xi extends Qi{}class d extends Qi{async _call(S){return new m(await super._call(S))}}class m extends yo{}class x extends j{}class C extends x{}class A extends x{async _call(S){return new W(await super._call(S))}}class W extends Ki{}class ne extends j{}class ye extends ne{}class Ee extends ne{async _call(S){return new Mt(await super._call(S))}}class ze extends j{}class Ye extends ze{}class it extends ze{async _call(S){return new Mt(await super._call(S))}}class _t extends j{}class Bt extends _t{}class Ir extends _t{async _call(S){return new Mt(await super._call(S))}}class Cs extends j{}class Du extends Cs{}class Lu extends Cs{async _call(S){return new Mt(await super._call(S))}}class zu extends Cs{}class pd extends j{}class Bu extends pd{}class Ru extends pd{}class hd extends j{}class Nu extends hd{}class ju extends hd{}class Vu extends j{}class Uu extends Vu{}class wl extends j{}class Wu extends wl{}class Gu extends wl{}class Ku extends wl{}class Hu extends j{}class qu extends Hu{}class Qu extends j{}class Xu extends Qu{}class Ju extends j{}class Yu extends Ju{}class md extends j{}class Zu extends md{}class ep extends md{}class fd extends j{}class tp extends fd{}class rp extends fd{}class sp extends j{}class np extends sp{}class _d extends j{}class op extends _d{}class ip extends _d{async _call(S){return new Mt(await super._call(S))}}class gd extends j{}class ap extends gd{}class lp extends gd{async _call(S){return new Mt(await super._call(S))}}class wd extends j{}class dp extends wd{}class cp extends wd{async _call(S){return new Mt(await super._call(S))}}class yd extends j{}class up extends yd{}class pp extends yd{async _call(S){return new Mt(await super._call(S))}}class hp extends j{}class mp extends hp{}class Md extends j{}class fp extends Md{}class _p extends Md{async _call(S){return new gp(await super._call(S))}}class gp extends me{constructor({logits:S,pred_boxes:L}){super(),this.logits=S,this.pred_boxes=L}}class wp extends j{}class yp extends wp{async get_image_embeddings({pixel_values:S}){return await oe(this,{pixel_values:S})}async forward(S){if((!S.image_embeddings||!S.image_positional_embeddings)&&(S={...S,...await this.get_image_embeddings(S)}),!S.input_labels&&S.input_points){const ie=S.input_points.dims.slice(0,-1),ge=ie.reduce((fe,Se)=>fe*Se,1);S.input_labels=new h.Tensor("int64",new BigInt64Array(ge).fill(1n),ie)}const L={image_embeddings:S.image_embeddings,image_positional_embeddings:S.image_positional_embeddings};return S.input_points&&(L.input_points=S.input_points),S.input_labels&&(L.input_labels=S.input_labels),S.input_boxes&&(L.input_boxes=S.input_boxes),await q(this.sessions.prompt_encoder_mask_decoder,L)}async _call(S){return new Mp(await super._call(S))}}class Mp extends me{constructor({iou_scores:S,pred_masks:L}){super(),this.iou_scores=S,this.pred_masks=L}}class bd extends j{}class bp extends bd{}class vp extends bd{}class vd extends j{}class xp extends vd{}class Tp extends vd{}class rn extends j{}class Ep extends rn{}class Pp extends rn{async _call(S){return new Mn(await super._call(S))}}class Cp extends rn{async _call(S){return new Mt(await super._call(S))}}class Sp extends rn{async _call(S){return new cr(await super._call(S))}}class xd extends j{}class $p extends xd{}class kp extends xd{async _call(S){return new cr(await super._call(S))}}class Ip extends j{}class Ap extends Ip{}class yl extends j{}class Fp extends yl{}class Op extends yl{async _call(S){return new Mn(await super._call(S))}}class Dp extends yl{async _call(S){return new Mt(await super._call(S))}}class Ji extends j{}class Lp extends Ji{}class zp extends Ji{async _call(S){return new Mn(await super._call(S))}}class Bp extends Ji{async _call(S){return new Mt(await super._call(S))}}class Rp extends Ji{async _call(S){return new cr(await super._call(S))}}class Ml extends j{}class Np extends Ml{}class jp extends Ml{async _call(S){return new Mn(await super._call(S))}}class Vp extends Ml{async _call(S){return new Mt(await super._call(S))}}class Ob extends j{}class Up extends rn{}class Wp extends rn{async _call(S){return new Mn(await super._call(S))}}class Gp extends rn{async _call(S){return new Mt(await super._call(S))}}class Mo extends j{}class Kp extends Mo{}class Hp extends Mo{async _call(S){return new Mn(await super._call(S))}}class qp extends Mo{async _call(S){return new Mt(await super._call(S))}}class Qp extends Mo{async _call(S){return new af(await super._call(S))}}class Xp extends Mo{async _call(S){return new cr(await super._call(S))}}class Jp extends j{}class Yp extends Jp{}class bl extends j{}class Db extends bl{}class Zp extends bl{}class eh extends bl{async generate_speech(S,L,{threshold:ie=.5,minlenratio:ge=0,maxlenratio:fe=20,vocoder:Se=null}={}){const De={input_ids:S},{encoder_outputs:Ge,encoder_attention_mask:Je}=await oe(this,De),lt=Ge.dims[1]/this.config.reduction_factor,yt=Math.floor(lt*fe),st=Math.floor(lt*ge),Et=this.config.num_mel_bins;let at=[],vt=null,ct=null,Tt=0;for(;;){++Tt;const wr=H(!!ct);let Pt;ct?Pt=ct.output_sequence_out:Pt=new h.Tensor("float32",new Float32Array(Et),[1,1,Et]);let Nt={use_cache_branch:wr,output_sequence:Pt,encoder_attention_mask:Je,speaker_embeddings:L,encoder_hidden_states:Ge};this.addPastKeyValues(Nt,vt),ct=await q(this.sessions.decoder_model_merged,Nt),vt=this.getPastKeyValues(ct,vt);const{prob:er,spectrum:sr}=ct;if(at.push(sr),Tt>=st&&(Array.from(er.data).filter(jr=>jr>=ie).length>0||Tt>=yt))break}const Dt=(0,h.cat)(at),{waveform:Qt}=await q(Se.sessions.model,{spectrogram:Dt});return{spectrogram:Dt,waveform:Qt}}}class th extends j{constructor(){super(...arguments);re(this,"main_input_name","spectrogram")}}class rh extends j{}class sh extends rh{}class Td extends j{}class nh extends Td{}class oh extends Td{}class Ed extends j{}class ih extends Ed{}class ah extends Ed{}class Pd extends j{}class lh extends Pd{}class dh extends Pd{}class vl extends j{}class ch extends vl{}class uh extends vl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"text_model"})}}class ph extends vl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"audio_model"})}}class hh extends j{}class Cd extends hh{async _call(S){return new df(await super._call(S))}}class xl extends j{}class Lb extends xl{}class mh extends xl{}class fh extends xl{}class Sd extends j{}class _h extends Sd{}class gh extends Sd{}class $d extends j{}class wh extends $d{}class yh extends $d{async _call(S){return new Mt(await super._call(S))}}class kd extends j{}class zb extends kd{}class Bb extends kd{}class Id extends j{constructor(){super(...arguments);re(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}_apply_and_filter_by_delay_pattern_mask(L){const[ie,ge]=L.dims,fe=this.config.decoder.num_codebooks,Se=ge-fe;let De=0;for(let lt=0;lt0&&Et<=Se&&(L.data[De++]=L.data[lt])}const Ge=Math.floor(ie/fe),Je=De/(Ge*fe);return new h.Tensor(L.type,L.data.slice(0,De),[Ge,fe,Je])}prepare_inputs_for_generation(L,ie,ge){let fe=structuredClone(L);for(let De=0;De=Ge&&(fe[De][Ge]=BigInt(this.config.decoder.pad_token_id));return ge.guidance_scale!==null&&ge.guidance_scale>1&&(fe=fe.concat(fe)),super.prepare_inputs_for_generation(fe,ie,ge)}async generate(L){const ie=await super.generate(L),ge=this._apply_and_filter_by_delay_pattern_mask(ie).unsqueeze_(0),{audio_values:fe}=await q(this.sessions.encodec_decode,{audio_codes:ge});return fe}}class Tl extends j{}class Mh extends Tl{}class bh extends Tl{async _call(S){return new Mt(await super._call(S))}}class vh extends Tl{}class El extends j{}class xh extends El{}class Th extends El{async _call(S){return new Mt(await super._call(S))}}class Eh extends El{}class Pl extends j{}class Ph extends Pl{}class Ch extends Pl{async _call(S){return new Mt(await super._call(S))}}class Sh extends Pl{}class Cl extends j{}class $h extends Cl{}class kh extends Cl{async _call(S){return new Mt(await super._call(S))}}class Ih extends Cl{}class Ah extends j{}class Fh extends Ah{}class Oh extends j{}class Dh extends Oh{constructor(...L){super(...L);re(this,"forward_params",["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"]);this._generation_mode="text"}async forward(L){const ie=this._generation_mode??"text";let ge;if(ie==="text"||!L.past_key_values){const Je=this.sessions.prepare_inputs_embeds,lt=(0,a.pick)(L,Je.inputNames);ge=await q(Je,lt)}else{const Je=this.sessions.gen_img_embeds,lt=(0,a.pick)({image_ids:L.input_ids},Je.inputNames);ge=await q(Je,lt)}const fe={...L,...ge},Se=await ce(this,fe),De=this.sessions[ie==="text"?"lm_head":"gen_head"];if(!De)throw new Error(`Unable to find "${De}" generation head`);const Ge=await q(De,(0,a.pick)(Se,De.inputNames));return{...ge,...Se,...Ge}}async generate(L){return this._generation_mode="text",super.generate(L)}async generate_images(L){this._generation_mode="image";const ie=(L.inputs??L[this.main_input_name]).dims[1],fe=(await super.generate(L)).slice(null,[ie,null]),Se=this.sessions.image_decode,{decoded_image:De}=await q(Se,{generated_tokens:fe}),Ge=De.add_(1).mul_(255/2).clamp_(0,255).to("uint8"),Je=[];for(const lt of Ge){const yt=g.RawImage.fromTensor(lt);Je.push(yt)}return Je}}class Lh extends me{constructor({char_logits:S,bpe_logits:L,wp_logits:ie}){super(),this.char_logits=S,this.bpe_logits=L,this.wp_logits=ie}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class zh extends j{}class Bh extends zh{async _call(S){return new Lh(await super._call(S))}}class Ad extends j{}class Rh extends Ad{}class Nh extends Ad{}class Fd extends j{}class jh extends Fd{}class Vh extends Fd{}class Uh extends j{constructor(){super(...arguments);re(this,"forward_params",["input_ids","attention_mask","position_ids","audio_values","past_key_values"])}}class Wh extends Uh{_merge_input_ids_with_audio_features(S){const L=S.audio_features.dims.at(-1),ie=S.audio_features.view(-1,L);return O({audio_token_id:this.config.ignore_index,...S,audio_features:ie})}}class Sl extends j{constructor(){super(...arguments);re(this,"main_input_name","input_values");re(this,"forward_params",["input_values"])}}class Gh extends me{constructor({audio_codes:S}){super(),this.audio_codes=S}}class Kh extends me{constructor({audio_values:S}){super(),this.audio_values=S}}class Hh extends Sl{async encode(S){return new Gh(await q(this.sessions.encoder_model,S))}async decode(S){return new Kh(await q(this.sessions.decoder_model,S))}}class qh extends Sl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"encoder_model"})}}class Qh extends Sl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"decoder_model"})}}class $l extends j{constructor(){super(...arguments);re(this,"main_input_name","input_values");re(this,"forward_params",["input_values"])}}class Xh extends me{constructor({audio_codes:S}){super(),this.audio_codes=S}}class Jh extends me{constructor({audio_values:S}){super(),this.audio_values=S}}class Yh extends $l{async encode(S){return new Xh(await q(this.sessions.encoder_model,S))}async decode(S){return new Jh(await q(this.sessions.decoder_model,S))}}class Zh extends $l{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"encoder_model"})}}class em extends $l{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"decoder_model"})}}class kl extends j{constructor(){super(...arguments);re(this,"main_input_name","input_values");re(this,"forward_params",["input_values"])}}class tm extends kl{async encode(S){return await q(this.sessions.encoder_model,S)}async decode(S){return await q(this.sessions.decoder_model,S)}}class rm extends kl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"encoder_model"})}}class sm extends kl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"decoder_model"})}}class kt{static async from_pretrained(S,{progress_callback:L=null,config:ie=null,cache_dir:ge=null,local_files_only:fe=!1,revision:Se="main",model_file_name:De=null,subfolder:Ge="onnx",device:Je=null,dtype:lt=null,use_external_data_format:yt=null,session_options:st={}}={}){const Et={progress_callback:L,config:ie,cache_dir:ge,local_files_only:fe,revision:Se,model_file_name:De,subfolder:Ge,device:Je,dtype:lt,use_external_data_format:yt,session_options:st};if(Et.config=await s.AutoConfig.from_pretrained(S,Et),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);const at=Et.config.model_type;for(const vt of this.MODEL_CLASS_MAPPINGS){let ct=vt.get(at);if(!ct){for(const Tt of vt.values())if(Tt[0]===at){ct=Tt;break}if(!ct)continue}return await ct[1].from_pretrained(S,Et)}if(this.BASE_IF_FAIL)return $m.has(at)||console.warn(`Unknown model class "${at}", attempting to construct from base class.`),await j.from_pretrained(S,Et);throw Error(`Unsupported model type: ${at}`)}}re(kt,"MODEL_CLASS_MAPPINGS",null),re(kt,"BASE_IF_FAIL",!1);const Rb=new Map([["bert",["BertModel",Ae]],["modernbert",["ModernBertModel",ee]],["nomic_bert",["NomicBertModel",ve]],["roformer",["RoFormerModel",Fe]],["electra",["ElectraModel",ts]],["esm",["EsmModel",qs]],["convbert",["ConvBertModel",nr]],["camembert",["CamembertModel",rs]],["deberta",["DebertaModel",Be]],["deberta-v2",["DebertaV2Model",ss]],["mpnet",["MPNetModel",un]],["albert",["AlbertModel",mn]],["distilbert",["DistilBertModel",Ts]],["roberta",["RobertaModel",dr]],["xlm",["XLMModel",Js]],["xlm-roberta",["XLMRobertaModel",ga]],["clap",["ClapModel",ch]],["clip",["CLIPModel",No]],["clipseg",["CLIPSegModel",en]],["chinese_clip",["ChineseCLIPModel",Da]],["siglip",["SiglipModel",Ia]],["jina_clip",["JinaCLIPModel",La]],["mobilebert",["MobileBertModel",Mr]],["squeezebert",["SqueezeBertModel",lr]],["wav2vec2",["Wav2Vec2Model",Ep]],["wav2vec2-bert",["Wav2Vec2BertModel",Np]],["unispeech",["UniSpeechModel",Fp]],["unispeech-sat",["UniSpeechSatModel",Lp]],["hubert",["HubertModel",Up]],["wavlm",["WavLMModel",Kp]],["audio-spectrogram-transformer",["ASTModel",Ma]],["vits",["VitsModel",Cd]],["pyannote",["PyAnnoteModel",$p]],["wespeaker-resnet",["WeSpeakerResNetModel",Ap]],["detr",["DetrModel",cl]],["rt_detr",["RTDetrModel",hl]],["rt_detr_v2",["RTDetrV2Model",fl]],["rf_detr",["RFDetrModel",Xi]],["table-transformer",["TableTransformerModel",C]],["vit",["ViTModel",Ii]],["ijepa",["IJepaModel",Fi]],["pvt",["PvtModel",Va]],["vit_msn",["ViTMSNModel",Ka]],["vit_mae",["ViTMAEModel",Ga]],["groupvit",["GroupViTModel",Qa]],["fastvit",["FastViTModel",Xa]],["mobilevit",["MobileViTModel",el]],["mobilevitv2",["MobileViTV2Model",rl]],["owlvit",["OwlViTModel",nl]],["owlv2",["Owlv2Model",il]],["beit",["BeitModel",ll]],["deit",["DeiTModel",ye]],["hiera",["HieraModel",Ye]],["convnext",["ConvNextModel",op]],["convnextv2",["ConvNextV2Model",ap]],["dinov2",["Dinov2Model",dp]],["dinov2_with_registers",["Dinov2WithRegistersModel",up]],["resnet",["ResNetModel",Bt]],["swin",["SwinModel",Du]],["swin2sr",["Swin2SRModel",Bu]],["donut-swin",["DonutSwinModel",np]],["yolos",["YolosModel",fp]],["dpt",["DPTModel",Nu]],["glpn",["GLPNModel",tp]],["hifigan",["SpeechT5HifiGan",th]],["efficientnet",["EfficientNetModel",wh]],["decision_transformer",["DecisionTransformerModel",Fh]],["patchtst",["PatchTSTForPrediction",Rh]],["patchtsmixer",["PatchTSMixerForPrediction",jh]],["mobilenet_v1",["MobileNetV1Model",Mh]],["mobilenet_v2",["MobileNetV2Model",xh]],["mobilenet_v3",["MobileNetV3Model",Ph]],["mobilenet_v4",["MobileNetV4Model",$h]],["maskformer",["MaskFormerModel",Zu]],["mgp-str",["MgpstrForSceneTextRecognition",Bh]],["style_text_to_speech_2",["StyleTextToSpeech2Model",Yp]]]),Nb=new Map([["t5",["T5Model",le]],["longt5",["LongT5Model",Ue]],["mt5",["MT5Model",Ze]],["bart",["BartModel",$t]],["mbart",["MBartModel",br]],["marian",["MarianModel",bp]],["whisper",["WhisperModel",va]],["m2m_100",["M2M100Model",xp]],["blenderbot",["BlenderbotModel",Wt]],["blenderbot-small",["BlenderbotSmallModel",Xr]]]),jb=new Map([["mimi",["MimiModel",Hh]],["dac",["DacModel",Yh]],["snac",["SnacModel",tm]]]),Vb=new Map([["bloom",["BloomModel",Ei]],["jais",["JAISModel",Uo]],["gpt2",["GPT2Model",Ra]],["gptj",["GPTJModel",Qo]],["gpt_bigcode",["GPTBigCodeModel",ja]],["gpt_neo",["GPTNeoModel",Go]],["gpt_neox",["GPTNeoXModel",Na]],["codegen",["CodeGenModel",wn]],["llama",["LlamaModel",Xn]],["exaone",["ExaoneModel",ei]],["olmo",["OlmoModel",ri]],["olmo2",["Olmo2Model",ni]],["mobilellm",["MobileLLMModel",ft]],["granite",["GraniteModel",oi]],["cohere",["CohereModel",ai]],["gemma",["GemmaModel",di]],["gemma2",["Gemma2Model",ui]],["gemma3_text",["Gemma3Model",hi]],["helium",["HeliumModel",Yo]],["glm",["GlmModel",Zo]],["openelm",["OpenELMModel",fi]],["qwen2",["Qwen2Model",gi]],["phi",["PhiModel",bi]],["phi3",["Phi3Model",xi]],["mpt",["MptModel",Ci]],["opt",["OPTModel",$i]],["mistral",["MistralModel",nh]],["starcoder2",["Starcoder2Model",ih]],["falcon",["FalconModel",lh]],["stablelm",["StableLmModel",_h]]]),Od=new Map([["speecht5",["SpeechT5ForSpeechToText",Zp]],["whisper",["WhisperForConditionalGeneration",Fo]],["lite-whisper",["LiteWhisperForConditionalGeneration",xa]],["moonshine",["MoonshineForConditionalGeneration",Ta]]]),nm=new Map([["speecht5",["SpeechT5ForTextToSpeech",eh]]]),om=new Map([["vits",["VitsModel",Cd]],["musicgen",["MusicgenForConditionalGeneration",Id]]]),im=new Map([["bert",["BertForSequenceClassification",Le]],["modernbert",["ModernBertForSequenceClassification",te]],["roformer",["RoFormerForSequenceClassification",qe]],["electra",["ElectraForSequenceClassification",Br]],["esm",["EsmForSequenceClassification",Xs]],["convbert",["ConvBertForSequenceClassification",ar]],["camembert",["CamembertForSequenceClassification",vs]],["deberta",["DebertaForSequenceClassification",ot]],["deberta-v2",["DebertaV2ForSequenceClassification",Tr]],["mpnet",["MPNetForSequenceClassification",pn]],["albert",["AlbertForSequenceClassification",pe]],["distilbert",["DistilBertForSequenceClassification",Ws]],["roberta",["RobertaForSequenceClassification",Xt]],["xlm",["XLMForSequenceClassification",fa]],["xlm-roberta",["XLMRobertaForSequenceClassification",fn]],["bart",["BartForSequenceClassification",At]],["mbart",["MBartForSequenceClassification",Qr]],["mobilebert",["MobileBertForSequenceClassification",Os]],["squeezebert",["SqueezeBertForSequenceClassification",Ls]]]),am=new Map([["bert",["BertForTokenClassification",Ne]],["modernbert",["ModernBertForTokenClassification",de]],["roformer",["RoFormerForTokenClassification",Xe]],["electra",["ElectraForTokenClassification",dt]],["esm",["EsmForTokenClassification",Dr]],["convbert",["ConvBertForTokenClassification",es]],["camembert",["CamembertForTokenClassification",xs]],["deberta",["DebertaForTokenClassification",rr]],["deberta-v2",["DebertaV2ForTokenClassification",os]],["mpnet",["MPNetForTokenClassification",Ds]],["distilbert",["DistilBertForTokenClassification",Gs]],["roberta",["RobertaForTokenClassification",qt]],["xlm",["XLMForTokenClassification",ko]],["xlm-roberta",["XLMRobertaForTokenClassification",ya]]]),Dd=new Map([["t5",["T5ForConditionalGeneration",ue]],["longt5",["LongT5ForConditionalGeneration",Qe]],["mt5",["MT5ForConditionalGeneration",pt]],["bart",["BartForConditionalGeneration",Ut]],["mbart",["MBartForConditionalGeneration",fr]],["marian",["MarianMTModel",vp]],["m2m_100",["M2M100ForConditionalGeneration",Tp]],["blenderbot",["BlenderbotForConditionalGeneration",Yt]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",ds]]]),Ld=new Map([["bloom",["BloomForCausalLM",Pi]],["gpt2",["GPT2LMHeadModel",Kn]],["jais",["JAISLMHeadModel",Wo]],["gptj",["GPTJForCausalLM",gn]],["gpt_bigcode",["GPTBigCodeForCausalLM",Xo]],["gpt_neo",["GPTNeoForCausalLM",Ko]],["gpt_neox",["GPTNeoXForCausalLM",Ho]],["codegen",["CodeGenForCausalLM",Nr]],["llama",["LlamaForCausalLM",Jo]],["exaone",["ExaoneForCausalLM",ht]],["olmo",["OlmoForCausalLM",si]],["olmo2",["Olmo2ForCausalLM",ro]],["mobilellm",["MobileLLMForCausalLM",ti]],["granite",["GraniteForCausalLM",ii]],["cohere",["CohereForCausalLM",li]],["gemma",["GemmaForCausalLM",ci]],["gemma2",["Gemma2ForCausalLM",pi]],["gemma3_text",["Gemma3ForCausalLM",mi]],["helium",["HeliumForCausalLM",Yn]],["glm",["GlmForCausalLM",gt]],["openelm",["OpenELMForCausalLM",_i]],["qwen2",["Qwen2ForCausalLM",wi]],["phi",["PhiForCausalLM",vi]],["phi3",["Phi3ForCausalLM",Ti]],["mpt",["MptForCausalLM",Si]],["opt",["OPTForCausalLM",ki]],["mbart",["MBartForCausalLM",vr]],["mistral",["MistralForCausalLM",oh]],["starcoder2",["Starcoder2ForCausalLM",ah]],["falcon",["FalconForCausalLM",dh]],["trocr",["TrOCRForCausalLM",sh]],["stablelm",["StableLmForCausalLM",gh]],["phi3_v",["Phi3VForCausalLM",zs]]]),Ub=new Map([["multi_modality",["MultiModalityCausalLM",Dh]]]),lm=new Map([["bert",["BertForMaskedLM",Ie]],["modernbert",["ModernBertForMaskedLM",B]],["roformer",["RoFormerForMaskedLM",je]],["electra",["ElectraForMaskedLM",Is]],["esm",["EsmForMaskedLM",Qs]],["convbert",["ConvBertForMaskedLM",jt]],["camembert",["CamembertForMaskedLM",bs]],["deberta",["DebertaForMaskedLM",et]],["deberta-v2",["DebertaV2ForMaskedLM",ns]],["mpnet",["MPNetForMaskedLM",Lr]],["albert",["AlbertForMaskedLM",V]],["distilbert",["DistilBertForMaskedLM",Hs]],["roberta",["RobertaForMaskedLM",Rt]],["xlm",["XLMWithLMHeadModel",Ys]],["xlm-roberta",["XLMRobertaForMaskedLM",wa]],["mobilebert",["MobileBertForMaskedLM",Fs]],["squeezebert",["SqueezeBertForMaskedLM",mr]]]),dm=new Map([["bert",["BertForQuestionAnswering",We]],["roformer",["RoFormerForQuestionAnswering",ut]],["electra",["ElectraForQuestionAnswering",Gr]],["convbert",["ConvBertForQuestionAnswering",ks]],["camembert",["CamembertForQuestionAnswering",As]],["deberta",["DebertaForQuestionAnswering",zt]],["deberta-v2",["DebertaV2ForQuestionAnswering",is]],["mpnet",["MPNetForQuestionAnswering",kr]],["albert",["AlbertForQuestionAnswering",F]],["distilbert",["DistilBertForQuestionAnswering",Ks]],["roberta",["RobertaForQuestionAnswering",Zt]],["xlm",["XLMForQuestionAnswering",_a]],["xlm-roberta",["XLMRobertaForQuestionAnswering",Io]],["mobilebert",["MobileBertForQuestionAnswering",$r]],["squeezebert",["SqueezeBertForQuestionAnswering",hn]]]),zd=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Do]],["idefics3",["Idefics3ForConditionalGeneration",jn]],["smolvlm",["SmolVLMForConditionalGeneration",Vn]]]),cm=new Map([["llava",["LlavaForConditionalGeneration",Nn]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",Pa]],["moondream1",["Moondream1ForConditionalGeneration",Ca]],["florence2",["Florence2ForConditionalGeneration",Lo]],["qwen2-vl",["Qwen2VLForConditionalGeneration",Mi]],["idefics3",["Idefics3ForConditionalGeneration",jn]],["smolvlm",["SmolVLMForConditionalGeneration",Vn]],["paligemma",["PaliGemmaForConditionalGeneration",Bo]]]),um=new Map([["ultravox",["UltravoxModel",Wh]]]),Wb=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Do]]]),pm=new Map([["vit",["ViTForImageClassification",Ai]],["ijepa",["IJepaForImageClassification",Oi]],["pvt",["PvtForImageClassification",Ua]],["vit_msn",["ViTMSNForImageClassification",Ha]],["fastvit",["FastViTForImageClassification",Ja]],["mobilevit",["MobileViTForImageClassification",tl]],["mobilevitv2",["MobileViTV2ForImageClassification",sl]],["beit",["BeitForImageClassification",dl]],["deit",["DeiTForImageClassification",Ee]],["hiera",["HieraForImageClassification",it]],["convnext",["ConvNextForImageClassification",ip]],["convnextv2",["ConvNextV2ForImageClassification",lp]],["dinov2",["Dinov2ForImageClassification",cp]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",pp]],["resnet",["ResNetForImageClassification",Ir]],["swin",["SwinForImageClassification",Lu]],["segformer",["SegformerForImageClassification",mh]],["efficientnet",["EfficientNetForImageClassification",yh]],["mobilenet_v1",["MobileNetV1ForImageClassification",bh]],["mobilenet_v2",["MobileNetV2ForImageClassification",Th]],["mobilenet_v3",["MobileNetV3ForImageClassification",Ch]],["mobilenet_v4",["MobileNetV4ForImageClassification",kh]]]),hm=new Map([["detr",["DetrForObjectDetection",ul]],["rt_detr",["RTDetrForObjectDetection",ml]],["rt_detr_v2",["RTDetrV2ForObjectDetection",_l]],["rf_detr",["RFDetrForObjectDetection",d]],["table-transformer",["TableTransformerForObjectDetection",A]],["yolos",["YolosForObjectDetection",_p]]]),mm=new Map([["owlvit",["OwlViTForObjectDetection",ol]],["owlv2",["Owlv2ForObjectDetection",al]],["grounding-dino",["GroundingDinoForObjectDetection",mp]]]),bo=new Map([["detr",["DetrForSegmentation",Gi]],["clipseg",["CLIPSegForImageSegmentation",jo]]]),fm=new Map([["segformer",["SegformerForSemanticSegmentation",fh]],["sapiens",["SapiensForSemanticSegmentation",Wu]],["swin",["SwinForSemanticSegmentation",zu]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",vh]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",Eh]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",Sh]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",Ih]]]),_m=new Map([["detr",["DetrForSegmentation",Gi]],["maskformer",["MaskFormerForInstanceSegmentation",ep]]]),gm=new Map([["sam",["SamModel",yp]]]),wm=new Map([["wav2vec2",["Wav2Vec2ForCTC",Pp]],["wav2vec2-bert",["Wav2Vec2BertForCTC",jp]],["unispeech",["UniSpeechForCTC",Op]],["unispeech-sat",["UniSpeechSatForCTC",zp]],["wavlm",["WavLMForCTC",Hp]],["hubert",["HubertForCTC",Wp]]]),ym=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Cp]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",Vp]],["unispeech",["UniSpeechForSequenceClassification",Dp]],["unispeech-sat",["UniSpeechSatForSequenceClassification",Bp]],["wavlm",["WavLMForSequenceClassification",qp]],["hubert",["HubertForSequenceClassification",Gp]],["audio-spectrogram-transformer",["ASTForAudioClassification",ba]]]),Mm=new Map([["wavlm",["WavLMForXVector",Qp]]]),bm=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",Rp]],["wavlm",["WavLMForAudioFrameClassification",Xp]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",Sp]],["pyannote",["PyAnnoteForAudioFrameClassification",kp]]]),vm=new Map([["vitmatte",["VitMatteForImageMatting",Za]]]),Gb=new Map([["patchtst",["PatchTSTForPrediction",Nh]],["patchtsmixer",["PatchTSMixerForPrediction",Vh]]]),xm=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Ru]]]),Tm=new Map([["dpt",["DPTForDepthEstimation",ju]],["depth_anything",["DepthAnythingForDepthEstimation",Uu]],["glpn",["GLPNForDepthEstimation",rp]],["sapiens",["SapiensForDepthEstimation",Gu]],["depth_pro",["DepthProForDepthEstimation",qu]],["metric3d",["Metric3DForDepthEstimation",Xu]],["metric3dv2",["Metric3Dv2ForDepthEstimation",Yu]]]),Em=new Map([["sapiens",["SapiensForNormalEstimation",Ku]]]),Pm=new Map([["vitpose",["VitPoseForPoseEstimation",Li]]]),Cm=new Map([["clip",["CLIPVisionModelWithProjection",Un]],["siglip",["SiglipVisionModel",Fa]],["jina_clip",["JinaCLIPVisionModel",Ba]]]),Sm=[[Rb,P.EncoderOnly],[Nb,P.EncoderDecoder],[Vb,P.DecoderOnly],[jb,P.AutoEncoder],[im,P.EncoderOnly],[am,P.EncoderOnly],[Dd,P.Seq2Seq],[Od,P.Seq2Seq],[Ld,P.DecoderOnly],[Ub,P.MultiModality],[lm,P.EncoderOnly],[dm,P.EncoderOnly],[zd,P.Vision2Seq],[cm,P.ImageTextToText],[um,P.AudioTextToText],[pm,P.EncoderOnly],[bo,P.EncoderOnly],[_m,P.EncoderOnly],[fm,P.EncoderOnly],[vm,P.EncoderOnly],[Gb,P.EncoderOnly],[xm,P.EncoderOnly],[Tm,P.EncoderOnly],[Em,P.EncoderOnly],[Pm,P.EncoderOnly],[hm,P.EncoderOnly],[mm,P.EncoderOnly],[gm,P.MaskGeneration],[wm,P.EncoderOnly],[ym,P.EncoderOnly],[nm,P.Seq2Seq],[om,P.EncoderOnly],[Mm,P.EncoderOnly],[bm,P.EncoderOnly],[Cm,P.EncoderOnly]];for(const[v,S]of Sm)for(const[L,ie]of v.values())b.set(L,S),T.set(ie,L),w.set(L,ie);const Kb=[["MusicgenForConditionalGeneration",Id,P.Musicgen],["Phi3VForCausalLM",zs,P.Phi3V],["CLIPTextModelWithProjection",ka,P.EncoderOnly],["SiglipTextModel",Aa,P.EncoderOnly],["JinaCLIPTextModel",za,P.EncoderOnly],["ClapTextModelWithProjection",uh,P.EncoderOnly],["ClapAudioModelWithProjection",ph,P.EncoderOnly],["DacEncoderModel",Zh,P.EncoderOnly],["DacDecoderModel",em,P.EncoderOnly],["MimiEncoderModel",qh,P.EncoderOnly],["MimiDecoderModel",Qh,P.EncoderOnly],["SnacEncoderModel",rm,P.EncoderOnly],["SnacDecoderModel",sm,P.EncoderOnly]];for(const[v,S,L]of Kb)b.set(v,L),T.set(S,v),w.set(v,S);const $m=new Map([["modnet",bo],["birefnet",bo],["isnet",bo],["ben",bo]]);for(const[v,S]of $m.entries())S.set(v,["PreTrainedModel",j]),b.set(v,P.EncoderOnly),T.set(j,v),w.set(v,j);class Bd extends kt{}re(Bd,"MODEL_CLASS_MAPPINGS",Sm.map(S=>S[0])),re(Bd,"BASE_IF_FAIL",!0);class km extends kt{}re(km,"MODEL_CLASS_MAPPINGS",[im]);class Im extends kt{}re(Im,"MODEL_CLASS_MAPPINGS",[am]);class Am extends kt{}re(Am,"MODEL_CLASS_MAPPINGS",[Dd]);class Fm extends kt{}re(Fm,"MODEL_CLASS_MAPPINGS",[Od]);class Om extends kt{}re(Om,"MODEL_CLASS_MAPPINGS",[nm]);class Dm extends kt{}re(Dm,"MODEL_CLASS_MAPPINGS",[om]);class Lm extends kt{}re(Lm,"MODEL_CLASS_MAPPINGS",[Ld]);class zm extends kt{}re(zm,"MODEL_CLASS_MAPPINGS",[lm]);class Bm extends kt{}re(Bm,"MODEL_CLASS_MAPPINGS",[dm]);class Rm extends kt{}re(Rm,"MODEL_CLASS_MAPPINGS",[zd]);class Nm extends kt{}re(Nm,"MODEL_CLASS_MAPPINGS",[pm]);class jm extends kt{}re(jm,"MODEL_CLASS_MAPPINGS",[bo]);class Vm extends kt{}re(Vm,"MODEL_CLASS_MAPPINGS",[fm]);class Um extends kt{}re(Um,"MODEL_CLASS_MAPPINGS",[_m]);class Wm extends kt{}re(Wm,"MODEL_CLASS_MAPPINGS",[hm]);class Gm extends kt{}re(Gm,"MODEL_CLASS_MAPPINGS",[mm]);class Km extends kt{}re(Km,"MODEL_CLASS_MAPPINGS",[gm]);class Hm extends kt{}re(Hm,"MODEL_CLASS_MAPPINGS",[wm]);class qm extends kt{}re(qm,"MODEL_CLASS_MAPPINGS",[ym]);class Qm extends kt{}re(Qm,"MODEL_CLASS_MAPPINGS",[Mm]);class Xm extends kt{}re(Xm,"MODEL_CLASS_MAPPINGS",[bm]);class Jm extends kt{}re(Jm,"MODEL_CLASS_MAPPINGS",[Wb]);class Ym extends kt{}re(Ym,"MODEL_CLASS_MAPPINGS",[vm]);class Zm extends kt{}re(Zm,"MODEL_CLASS_MAPPINGS",[xm]);class ef extends kt{}re(ef,"MODEL_CLASS_MAPPINGS",[Tm]);class tf extends kt{}re(tf,"MODEL_CLASS_MAPPINGS",[Em]);class rf extends kt{}re(rf,"MODEL_CLASS_MAPPINGS",[Pm]);class sf extends kt{}re(sf,"MODEL_CLASS_MAPPINGS",[Cm]);class nf extends kt{}re(nf,"MODEL_CLASS_MAPPINGS",[cm]);class of extends kt{}re(of,"MODEL_CLASS_MAPPINGS",[um]);class Hb extends me{constructor({logits:S,past_key_values:L,encoder_outputs:ie,decoder_attentions:ge=null,cross_attentions:fe=null}){super(),this.logits=S,this.past_key_values=L,this.encoder_outputs=ie,this.decoder_attentions=ge,this.cross_attentions=fe}}class Mt extends me{constructor({logits:S,...L}){super(),this.logits=S;const ie=Object.values(L);ie.length>0&&(this.attentions=ie)}}class af extends me{constructor({logits:S,embeddings:L}){super(),this.logits=S,this.embeddings=L}}class cr extends me{constructor({logits:S}){super(),this.logits=S}}class gr extends me{constructor({logits:S}){super(),this.logits=S}}class Er extends me{constructor({start_logits:S,end_logits:L}){super(),this.start_logits=S,this.end_logits=L}}class Mn extends me{constructor({logits:S}){super(),this.logits=S}}class qb extends me{constructor({logits:S,past_key_values:L}){super(),this.logits=S,this.past_key_values=L}}class lf extends me{constructor({alphas:S}){super(),this.alphas=S}}class df extends me{constructor({waveform:S,spectrogram:L}){super(),this.waveform=S,this.spectrogram=L}}},"./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js":(e,r,t)=>{t.r(r),t.d(r,{ASTFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a);const l=this.config.sampling_rate,c=(0,o.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(l/2),l,null,"kaldi",!0);for(let p=0;p{t.r(r),t.d(r,{AutoFeatureExtractor:()=>i});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js");t("./src/base/feature_extraction_utils.js");var n=t("./src/models/feature_extractors.js");class i{static async from_pretrained(l,c={}){const p=await(0,o.getModelJSON)(l,s.FEATURE_EXTRACTOR_NAME,!0,c),u=p.feature_extractor_type,h=n[u];if(!h)throw new Error(`Unknown feature_extractor_type: '${u}'. Please report this at ${s.GITHUB_ISSUE_URL}.`);return new h(p)}}},"./src/models/auto/image_processing_auto.js":(e,r,t)=>{t.r(r),t.d(r,{AutoImageProcessor:()=>a});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js"),n=t("./src/base/image_processors_utils.js"),i=t("./src/models/image_processors.js");class a{static async from_pretrained(c,p={}){const u=await(0,o.getModelJSON)(c,s.IMAGE_PROCESSOR_NAME,!0,p),h=u.image_processor_type??u.feature_extractor_type;let g=i[h];return g||(h!==void 0&&console.warn(`Image processor type '${h}' not found, assuming base ImageProcessor. Please report this at ${s.GITHUB_ISSUE_URL}.`),g=n.ImageProcessor),new g(u)}}},"./src/models/auto/processing_auto.js":(e,r,t)=>{t.r(r),t.d(r,{AutoProcessor:()=>c});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js"),n=t("./src/base/processing_utils.js"),i=t("./src/models/processors.js"),a=t("./src/models/image_processors.js"),l=t("./src/models/feature_extractors.js");class c{static async from_pretrained(u,h={}){const g=await(0,o.getModelJSON)(u,s.IMAGE_PROCESSOR_NAME,!0,h),{image_processor_type:_,feature_extractor_type:E,processor_class:I}=g;if(I&&i[I])return i[I].from_pretrained(u,h);if(!_&&!E)throw new Error("No `image_processor_type` or `feature_extractor_type` found in the config.");const M={};if(_){const $=a[_];if(!$)throw new Error(`Unknown image_processor_type: '${_}'.`);M.image_processor=new $(g)}if(E){const $=a[E];if($)M.image_processor=new $(g);else{const P=l[E];if(!P)throw new Error(`Unknown feature_extractor_type: '${E}'.`);M.feature_extractor=new P(g)}}const y={};return new n.Processor(y,M)}}},"./src/models/beit/image_processing_beit.js":(e,r,t)=>{t.r(r),t.d(r,{BeitFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/bit/image_processing_bit.js":(e,r,t)=>{t.r(r),t.d(r,{BitImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,r,t)=>{t.r(r),t.d(r,{ChineseCLIPFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/clap/feature_extraction_clap.js":(e,r,t)=>{t.r(r),t.d(r,{ClapFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a),this.mel_filters=(0,o.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=(0,o.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=(0,o.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(a,l,c,p){let u;const h=a.length-l;if(h>0)if(c==="rand_trunc"){const g=Math.floor(Math.random()*(h+1));a=a.subarray(g,g+l),u=await this._extract_fbank_features(a,this.mel_filters_slaney,this.config.nb_max_samples)}else throw new Error(`Truncation strategy "${c}" not implemented`);else{if(h<0){let g=new Float64Array(l);if(g.set(a),p==="repeat")for(let _=a.length;_{t.r(r),t.d(r,{CLIPFeatureExtractor:()=>n,CLIPImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/convnext/image_processing_convnext.js":(e,r,t)=>{t.r(r),t.d(r,{ConvNextFeatureExtractor:()=>n,ConvNextImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(a){super(a),this.crop_pct=this.config.crop_pct??224/256}async resize(a){var c;const l=(c=this.size)==null?void 0:c.shortest_edge;if(l===void 0)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(l<384){const p=Math.floor(l/this.crop_pct),[u,h]=this.get_resize_output_image_size(a,{shortest_edge:p});a=await a.resize(u,h,{resample:this.resample}),a=await a.center_crop(l,l)}else a=await a.resize(l,l,{resample:this.resample});return a}}class n extends o{}},"./src/models/dac/feature_extraction_dac.js":(e,r,t)=>{t.r(r),t.d(r,{DacFeatureExtractor:()=>o});var s=t("./src/models/encodec/feature_extraction_encodec.js");class o extends s.EncodecFeatureExtractor{}},"./src/models/deit/image_processing_deit.js":(e,r,t)=>{t.r(r),t.d(r,{DeiTFeatureExtractor:()=>n,DeiTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/detr/image_processing_detr.js":(e,r,t)=>{t.r(r),t.d(r,{DetrFeatureExtractor:()=>i,DetrImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(l){const c=await super._call(l),p=[c.pixel_values.dims[0],64,64],u=(0,o.full)(p,1n);return{...c,pixel_mask:u}}post_process_object_detection(...l){return(0,s.post_process_object_detection)(...l)}post_process_panoptic_segmentation(...l){return(0,s.post_process_panoptic_segmentation)(...l)}post_process_instance_segmentation(...l){return(0,s.post_process_instance_segmentation)(...l)}}class i extends n{}},"./src/models/donut/image_processing_donut.js":(e,r,t)=>{t.r(r),t.d(r,{DonutFeatureExtractor:()=>n,DonutImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(a,l,c,p={}){const[u,h,g]=l;let _=this.image_mean;Array.isArray(this.image_mean)||(_=new Array(g).fill(_));let E=this.image_std;Array.isArray(E)||(E=new Array(g).fill(_));const I=_.map((M,y)=>-M/E[y]);return super.pad_image(a,l,c,{center:!0,constant_values:I,...p})}}class n extends o{}},"./src/models/dpt/image_processing_dpt.js":(e,r,t)=>{t.r(r),t.d(r,{DPTFeatureExtractor:()=>n,DPTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/efficientnet/image_processing_efficientnet.js":(e,r,t)=>{t.r(r),t.d(r,{EfficientNetImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){super(i),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(a=>a*a))}}},"./src/models/encodec/feature_extraction_encodec.js":(e,r,t)=>{t.r(r),t.d(r,{EncodecFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(a){(0,s.validate_audio_inputs)(a,"EncodecFeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));const l=this.config.feature_size;if(a.length%l!==0)throw new Error(`The length of the audio data must be a multiple of the number of channels (${l}).`);const c=[1,l,a.length/l];return{input_values:new o.Tensor("float32",a,c)}}}},"./src/models/feature_extractors.js":(e,r,t)=>{t.r(r),t.d(r,{ASTFeatureExtractor:()=>s.ASTFeatureExtractor,ClapFeatureExtractor:()=>n.ClapFeatureExtractor,DacFeatureExtractor:()=>i.DacFeatureExtractor,EncodecFeatureExtractor:()=>o.EncodecFeatureExtractor,ImageFeatureExtractor:()=>E.ImageProcessor,MoonshineFeatureExtractor:()=>a.MoonshineFeatureExtractor,PyAnnoteFeatureExtractor:()=>l.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>c.SeamlessM4TFeatureExtractor,SnacFeatureExtractor:()=>p.SnacFeatureExtractor,SpeechT5FeatureExtractor:()=>u.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>h.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>g.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>_.WhisperFeatureExtractor});var s=t("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),o=t("./src/models/encodec/feature_extraction_encodec.js"),n=t("./src/models/clap/feature_extraction_clap.js"),i=t("./src/models/dac/feature_extraction_dac.js"),a=t("./src/models/moonshine/feature_extraction_moonshine.js"),l=t("./src/models/pyannote/feature_extraction_pyannote.js"),c=t("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),p=t("./src/models/snac/feature_extraction_snac.js"),u=t("./src/models/speecht5/feature_extraction_speecht5.js"),h=t("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),g=t("./src/models/wespeaker/feature_extraction_wespeaker.js"),_=t("./src/models/whisper/feature_extraction_whisper.js"),E=t("./src/base/image_processors_utils.js")},"./src/models/florence2/processing_florence2.js":(e,r,t)=>{t.r(r),t.d(r,{Florence2Processor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{constructor(l,c){super(l,c);const{tasks_answer_post_processing_type:p,task_prompts_without_inputs:u,task_prompts_with_input:h}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(p??{})),this.task_prompts_without_inputs=new Map(Object.entries(u??{})),this.task_prompts_with_input=new Map(Object.entries(h??{})),this.regexes={quad_boxes:/(.+?)/gm,bboxes:/([^<]+)?/gm},this.size_per_bin=1e3}construct_prompts(l){typeof l=="string"&&(l=[l]);const c=[];for(const p of l)if(this.task_prompts_without_inputs.has(p))c.push(this.task_prompts_without_inputs.get(p));else{for(const[u,h]of this.task_prompts_with_input)if(p.includes(u)){c.push(h.replaceAll("{input}",p).replaceAll(u,""));break}c.length!==l.length&&c.push(p)}return c}post_process_generation(l,c,p){const u=this.tasks_answer_post_processing_type.get(c)??"pure_text";l=l.replaceAll("","").replaceAll("","");let h;switch(u){case"pure_text":h=l;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const g=u==="ocr"?"quad_boxes":"bboxes",_=l.matchAll(this.regexes[g]),E=[],I=[];for(const[M,y,...$]of _)E.push(y?y.trim():E.at(-1)??""),I.push($.map((P,b)=>(Number(P)+.5)/this.size_per_bin*p[b%2]));h={labels:E,[g]:I};break;default:throw new Error(`Task "${c}" (of type "${u}") not yet implemented.`)}return{[c]:h}}async _call(l,c=null,p={}){if(!l&&!c)throw new Error("Either text or images must be provided");const u=await this.image_processor(l,p),h=c?this.tokenizer(c,p):{};return{...u,...h}}}re(i,"tokenizer_class",n.AutoTokenizer),re(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/glpn/image_processing_glpn.js":(e,r,t)=>{t.r(r),t.d(r,{GLPNFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,r,t)=>{t.r(r),t.d(r,{GroundingDinoImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a){const l=await super._call(a),c=l.pixel_values.dims,p=(0,o.ones)([c[0],c[2],c[3]]);return{...l,pixel_mask:p}}}},"./src/models/grounding_dino/processing_grounding_dino.js":(e,r,t)=>{t.r(r),t.d(r,{GroundingDinoProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/base/image_processors_utils.js");function a(c,p){const h=c.dims.at(-1)-1,g=c.tolist();g.fill(!1,0,1),g.fill(!1,h);const _=p.tolist();return g.map((E,I)=>E?I:null).filter(E=>E!==null).map(E=>_[E])}class l extends s.Processor{async _call(p,u,h={}){const g=p?await this.image_processor(p,h):{};return{...u?this.tokenizer(u,h):{},...g}}post_process_grounded_object_detection(p,u,{box_threshold:h=.25,text_threshold:g=.25,target_sizes:_=null}={}){const{logits:E,pred_boxes:I}=p,M=E.dims[0];if(_!==null&&_.length!==M)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const y=E.dims.at(1),$=E.sigmoid(),P=$.max(-1).tolist(),b=I.tolist().map(T=>T.map(k=>(0,i.center_to_corners_format)(k))),w=[];for(let T=0;TU.map((Z,H)=>Z*k[(H+1)%2])));const z=P[T],R=[],Q=[],q=[];for(let U=0;U{t.r(r),t.d(r,{Idefics3ImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{constructor(a){super(a),this.do_image_splitting=a.do_image_splitting??!0,this.max_image_size=a.max_image_size}get_resize_for_vision_encoder(a,l){let[c,p]=a.dims.slice(-2);const u=p/c;return p>=c?(p=Math.ceil(p/l)*l,c=Math.floor(p/u),c=Math.ceil(c/l)*l):(c=Math.ceil(c/l)*l,p=Math.floor(c*u),p=Math.ceil(p/l)*l),{height:c,width:p}}async _call(a,{do_image_splitting:l=null,return_row_col_info:c=!1}={}){let p;if(!Array.isArray(a))p=[[a]];else{if(a.length===0||!a[0])throw new Error("No images provided.");Array.isArray(a[0])?p=a:p=[a]}let u=[],h=[],g=[];const _=[],E=[];for(const T of p){let k=await Promise.all(T.map(Q=>this.preprocess(Q)));_.push(...k.map(Q=>Q.original_size)),E.push(...k.map(Q=>Q.reshaped_input_size)),k.forEach(Q=>Q.pixel_values.unsqueeze_(0));const{longest_edge:z}=this.max_image_size;let R;if(l??this.do_image_splitting){let Q=new Array(k.length),q=new Array(k.length);R=await Promise.all(k.map(async(U,Z)=>{const H=this.get_resize_for_vision_encoder(U.pixel_values,z),J=await(0,o.interpolate_4d)(U.pixel_values,{size:[H.height,H.width]}),{frames:oe,num_splits_h:ae,num_splits_w:ce}=await this.split_image(J,this.max_image_size);return Q[Z]=ae,q[Z]=ce,(0,o.cat)(oe,0)})),h.push(Q),g.push(q)}else{const Q=[z,z];R=await Promise.all(k.map(q=>(0,o.interpolate_4d)(q.pixel_values,{size:Q}))),h.push(new Array(k.length).fill(0)),g.push(new Array(k.length).fill(0))}u.push((0,o.cat)(R,0))}const I=u.length,[M,y,$,P]=u[0].dims;let b,w;if(I===1)b=u[0].unsqueeze_(0),w=(0,o.full)([I,M,$,P],!0);else{const T=Math.max(...u.map(R=>R.dims.at(0)));w=(0,o.full)([I,T,$,P],!0);const k=w.data,z=T*$*P;for(let R=0;Rc||g>p){_=Math.ceil(h/c),E=Math.ceil(g/p);const I=Math.ceil(h/_),M=Math.ceil(g/E);for(let P=0;P<_;++P)for(let b=0;b{t.r(r),t.d(r,{Idefics3Processor:()=>p});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");var i=t("./src/utils/core.js");function a(u,h,g,_,E,I){let M="";for(let y=0;y`+E.repeat(u);M+=` -`}return M+=` -${_}${I}`+E.repeat(u)+`${_}`,M}function l(u,h,g,_){return`${h}${_}`+g.repeat(u)+`${h}`}function c(u,h,g,_,E,I){return u===0&&h===0?l(g,_,E,I):a(g,u,h,_,E,I)}class p extends s.Processor{constructor(){super(...arguments);re(this,"fake_image_token","");re(this,"image_token","");re(this,"global_img_token","")}async _call(g,_=null,E={}){E.return_row_col_info??(E.return_row_col_info=!0);let I;_&&(I=await this.image_processor(_,E)),Array.isArray(g)||(g=[g]);const M=I.rows??[new Array(g.length).fill(0)],y=I.cols??[new Array(g.length).fill(0)],$=this.config.image_seq_len,P=[],b=[];for(let T=0;Tc(Z,R[H],$,this.fake_image_token,this.image_token,this.global_img_token)),q=k.split(this.image_token);if(q.length===0)throw new Error("The image token should be present in the text.");let U=q[0];for(let Z=0;Z{t.r(r),t.d(r,{BeitFeatureExtractor:()=>s.BeitFeatureExtractor,BitImageProcessor:()=>o.BitImageProcessor,CLIPFeatureExtractor:()=>i.CLIPFeatureExtractor,CLIPImageProcessor:()=>i.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>n.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>a.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>a.ConvNextImageProcessor,DPTFeatureExtractor:()=>u.DPTFeatureExtractor,DPTImageProcessor:()=>u.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>c.DetrFeatureExtractor,DetrImageProcessor:()=>c.DetrImageProcessor,DonutFeatureExtractor:()=>p.DonutFeatureExtractor,DonutImageProcessor:()=>p.DonutImageProcessor,EfficientNetImageProcessor:()=>h.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>g.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>_.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>E.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>M.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>y.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>$.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>P.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>P.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>b.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>b.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>w.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>w.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>T.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>T.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>k.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>k.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>z.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>z.MobileViTImageProcessor,NougatImageProcessor:()=>R.NougatImageProcessor,OwlViTFeatureExtractor:()=>q.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>q.OwlViTImageProcessor,Owlv2ImageProcessor:()=>Q.Owlv2ImageProcessor,Phi3VImageProcessor:()=>U.Phi3VImageProcessor,PvtImageProcessor:()=>Z.PvtImageProcessor,Qwen2VLImageProcessor:()=>H.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>J.RTDetrImageProcessor,SamImageProcessor:()=>oe.SamImageProcessor,SegformerFeatureExtractor:()=>ae.SegformerFeatureExtractor,SegformerImageProcessor:()=>ae.SegformerImageProcessor,SiglipImageProcessor:()=>ce.SiglipImageProcessor,SmolVLMImageProcessor:()=>he.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>N.Swin2SRImageProcessor,VLMImageProcessor:()=>I.VLMImageProcessor,ViTFeatureExtractor:()=>O.ViTFeatureExtractor,ViTImageProcessor:()=>O.ViTImageProcessor,VitMatteImageProcessor:()=>G.VitMatteImageProcessor,VitPoseImageProcessor:()=>se.VitPoseImageProcessor,YolosFeatureExtractor:()=>X.YolosFeatureExtractor,YolosImageProcessor:()=>X.YolosImageProcessor});var s=t("./src/models/beit/image_processing_beit.js"),o=t("./src/models/bit/image_processing_bit.js"),n=t("./src/models/chinese_clip/image_processing_chinese_clip.js"),i=t("./src/models/clip/image_processing_clip.js"),a=t("./src/models/convnext/image_processing_convnext.js"),l=t("./src/models/deit/image_processing_deit.js"),c=t("./src/models/detr/image_processing_detr.js"),p=t("./src/models/donut/image_processing_donut.js"),u=t("./src/models/dpt/image_processing_dpt.js"),h=t("./src/models/efficientnet/image_processing_efficientnet.js"),g=t("./src/models/glpn/image_processing_glpn.js"),_=t("./src/models/grounding_dino/image_processing_grounding_dino.js"),E=t("./src/models/idefics3/image_processing_idefics3.js"),I=t("./src/models/janus/image_processing_janus.js"),M=t("./src/models/jina_clip/image_processing_jina_clip.js"),y=t("./src/models/llava_onevision/image_processing_llava_onevision.js"),$=t("./src/models/mask2former/image_processing_mask2former.js"),P=t("./src/models/maskformer/image_processing_maskformer.js"),b=t("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),w=t("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),T=t("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),k=t("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),z=t("./src/models/mobilevit/image_processing_mobilevit.js"),R=t("./src/models/nougat/image_processing_nougat.js"),Q=t("./src/models/owlv2/image_processing_owlv2.js"),q=t("./src/models/owlvit/image_processing_owlvit.js"),U=t("./src/models/phi3_v/image_processing_phi3_v.js"),Z=t("./src/models/pvt/image_processing_pvt.js"),H=t("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),J=t("./src/models/rt_detr/image_processing_rt_detr.js"),oe=t("./src/models/sam/image_processing_sam.js"),ae=t("./src/models/segformer/image_processing_segformer.js"),ce=t("./src/models/siglip/image_processing_siglip.js"),he=t("./src/models/smolvlm/image_processing_smolvlm.js"),N=t("./src/models/swin2sr/image_processing_swin2sr.js"),O=t("./src/models/vit/image_processing_vit.js"),G=t("./src/models/vitmatte/image_processing_vitmatte.js"),se=t("./src/models/vitpose/image_processing_vitpose.js"),X=t("./src/models/yolos/image_processing_yolos.js")},"./src/models/janus/image_processing_janus.js":(e,r,t)=>{t.r(r),t.d(r,{VLMImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){super({do_pad:!0,pad_size:{width:i.image_size,height:i.image_size},...i}),this.constant_values=this.config.background_color.map(a=>a*this.rescale_factor)}pad_image(i,a,l,c){return super.pad_image(i,a,l,{constant_values:this.constant_values,center:!0,...c})}}},"./src/models/janus/processing_janus.js":(e,r,t)=>{t.r(r),t.d(r,{VLChatProcessor:()=>c});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/utils/core.js"),a=t("./src/utils/tensor.js"),l=t("./src/utils/image.js");class c extends s.Processor{constructor(u,h){super(u,h),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(u,{images:h=null,chat_template:g="default"}={}){h?Array.isArray(h)||(h=[h]):h=await Promise.all(u.filter(R=>R.images).flatMap(R=>R.images).map(R=>l.RawImage.read(R)));const _=this.tokenizer,E=_.apply_chat_template(u,{tokenize:!1,add_generation_prompt:!0,chat_template:g}),I=R=>_.encode(R,{add_special_tokens:!1}),M=E.split(this.image_tag),y=M.length-1;if(h.length!==y)throw new Error(`Number of images provided (${h.length}) does not match number of "${this.image_tag}" image tags (${y})`);const[$,P,b]=_.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]);let w=I(M[0]),T=new Array(w.length).fill(!1);for(let R=1;R0){const R=await this.image_processor(h);return R.pixel_values.unsqueeze_(0),{...z,...R}}return z}}re(c,"image_processor_class",o.AutoImageProcessor),re(c,"tokenizer_class",n.AutoTokenizer),re(c,"uses_processor_config",!0)},"./src/models/jina_clip/image_processing_jina_clip.js":(e,r,t)=>{t.r(r),t.d(r,{JinaCLIPImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){const{resize_mode:a,fill_color:l,interpolation:c,size:p,...u}=i,h=a==="squash"?{width:p,height:p}:a==="shortest"?{shortest_edge:p}:{longest_edge:p},g=c==="bicubic"?3:2;super({...u,size:h,resample:g,do_center_crop:!0,crop_size:p,do_normalize:!0})}}},"./src/models/jina_clip/processing_jina_clip.js":(e,r,t)=>{t.r(r),t.d(r,{JinaCLIPProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{async _call(l=null,c=null,p={}){if(!l&&!c)throw new Error("Either text or images must be provided");const u=l?this.tokenizer(l,p):{},h=c?await this.image_processor(c,p):{};return{...u,...h}}}re(i,"tokenizer_class",n.AutoTokenizer),re(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/llava_onevision/image_processing_llava_onevision.js":(e,r,t)=>{t.r(r),t.d(r,{LlavaOnevisionImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/mask2former/image_processing_mask2former.js":(e,r,t)=>{t.r(r),t.d(r,{Mask2FormerImageProcessor:()=>o});var s=t("./src/models/maskformer/image_processing_maskformer.js");class o extends s.MaskFormerImageProcessor{}},"./src/models/maskformer/image_processing_maskformer.js":(e,r,t)=>{t.r(r),t.d(r,{MaskFormerFeatureExtractor:()=>n,MaskFormerImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_panoptic_segmentation(...a){return(0,s.post_process_panoptic_segmentation)(...a)}post_process_instance_segmentation(...a){return(0,s.post_process_instance_segmentation)(...a)}}class n extends o{}},"./src/models/mgp_str/processing_mgp_str.js":(e,r,t)=>{t.r(r),t.d(r,{MgpstrProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/utils/maths.js");const a={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends s.Processor{get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(p,u){if(!a.hasOwnProperty(u))throw new Error(`Format ${u} is not supported.`);const[h,g]=a[u],_=this[h].bind(this),[E,I]=p.dims,M=[],y=[],$=p.tolist();for(let b=0;b0?k.reduce((R,Q)=>R*Q,1):0;y.push(T),M.push(z)}return[_(y),M]}char_decode(p){return this.char_tokenizer.batch_decode(p).map(u=>u.replaceAll(" ",""))}bpe_decode(p){return this.bpe_tokenizer.batch_decode(p)}wp_decode(p){return this.wp_tokenizer.batch_decode(p).map(u=>u.replaceAll(" ",""))}batch_decode([p,u,h]){const[g,_]=this._decode_helper(p,"char"),[E,I]=this._decode_helper(u,"bpe"),[M,y]=this._decode_helper(h,"wp"),$=[],P=[];for(let b=0;b{t.r(r),t.d(r,{MobileNetV1FeatureExtractor:()=>n,MobileNetV1ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV2FeatureExtractor:()=>n,MobileNetV2ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV3FeatureExtractor:()=>n,MobileNetV3ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV4FeatureExtractor:()=>n,MobileNetV4ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilevit/image_processing_mobilevit.js":(e,r,t)=>{t.r(r),t.d(r,{MobileViTFeatureExtractor:()=>n,MobileViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/moonshine/feature_extraction_moonshine.js":(e,r,t)=>{t.r(r),t.d(r,{MoonshineFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(a){(0,s.validate_audio_inputs)(a,"MoonshineFeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));const l=[1,a.length];return{input_values:new o.Tensor("float32",a,l)}}}},"./src/models/moonshine/processing_moonshine.js":(e,r,t)=>{t.r(r),t.d(r,{MoonshineProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}re(i,"tokenizer_class",o.AutoTokenizer),re(i,"feature_extractor_class",s.AutoFeatureExtractor)},"./src/models/nougat/image_processing_nougat.js":(e,r,t)=>{t.r(r),t.d(r,{NougatImageProcessor:()=>o});var s=t("./src/models/donut/image_processing_donut.js");class o extends s.DonutImageProcessor{}},"./src/models/owlv2/image_processing_owlv2.js":(e,r,t)=>{t.r(r),t.d(r,{Owlv2ImageProcessor:()=>o});var s=t("./src/models/owlvit/image_processing_owlvit.js");class o extends s.OwlViTImageProcessor{}},"./src/models/owlvit/image_processing_owlvit.js":(e,r,t)=>{t.r(r),t.d(r,{OwlViTFeatureExtractor:()=>n,OwlViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...a){return(0,s.post_process_object_detection)(...a)}}class n extends o{}},"./src/models/owlvit/processing_owlvit.js":(e,r,t)=>{t.r(r),t.d(r,{OwlViTProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{}re(i,"tokenizer_class",n.AutoTokenizer),re(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/paligemma/processing_paligemma.js":(e,r,t)=>{t.r(r),t.d(r,{PaliGemmaProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");const i="";function a(c,p,u,h,g){return`${h.repeat(u*g)}${p}${c} -`}class l extends s.Processor{async _call(p,u=null,h={}){u||(console.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),u=""),Array.isArray(p)||(p=[p]),Array.isArray(u)||(u=[u]);const g=this.tokenizer.bos_token,_=this.image_processor.config.image_seq_length;let E;u.some(y=>y.includes(i))?E=u.map(y=>{const $=y.replaceAll(i,i.repeat(_)),P=$.lastIndexOf(i),b=P===-1?0:P+i.length;return $.slice(0,b)+g+$.slice(b)+` -`}):(console.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),E=u.map(y=>a(y,g,_,i,p.length)));const I=this.tokenizer(E,h);return{...await this.image_processor(p,h),...I}}}re(l,"tokenizer_class",n.AutoTokenizer),re(l,"image_processor_class",o.AutoImageProcessor),re(l,"uses_processor_config",!1)},"./src/models/phi3_v/image_processing_phi3_v.js":(e,r,t)=>{t.r(r),t.d(r,{Phi3VImageProcessor:()=>p});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");const n=336,i=[2,3],{ceil:a,floor:l,sqrt:c}=Math;class p extends s.ImageProcessor{constructor(h){super({...h,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=h.num_crops}calc_num_image_tokens_from_image_size(h,g){const{num_img_tokens:_}=this.config;return l((l(g/n)*l(h/n)+1)*_+1+(l(g/n)+1)*c(_))}get_resize_output_image_size(h,g){const _=this._num_crops,[E,I]=h.size;let M=E/I,y=1;for(;y*Math.ceil(y/M)<=_;)y+=1;y-=1;const $=Math.floor(y*336),P=Math.floor($/M);return[$,P]}pad_image(h,g,_,E={}){const[I,M]=g,y=n*a(I/n),$=n*a(M/n),P=[1,1,1].map((b,w)=>(b-this.image_mean[w])/this.image_std[w]);return super.pad_image(h,g,{width:$,height:y},{center:!0,constant_values:P,...E})}async _call(h,{num_crops:g=null}={}){if(this._num_crops=g??(g=this.config.num_crops),g<4||c(g)%1!==0)throw new Error("num_crops must be a square number >= 4");Array.isArray(h)||(h=[h]);const _=h.length,E=await Promise.all(h.map(T=>this.preprocess(T))),I=E.map(T=>T.original_size),M=E.map(T=>T.reshaped_input_size),y=[];for(const{pixel_values:T}of E){T.unsqueeze_(0);const[k,z]=T.dims.slice(-2),R=await(0,o.interpolate_4d)(T,{size:[n,n],mode:"bicubic"});if(g>0){const Q=[],q=c(g),U=l(z/q),Z=l(k/q);for(let J=0;JT.map(k=>n*a(k/n))),b=new o.Tensor("int64",P.flat(),[_,2]),w=P.map(([T,k])=>this.calc_num_image_tokens_from_image_size(k,T));return{pixel_values:$,original_sizes:I,reshaped_input_sizes:M,image_sizes:b,num_img_tokens:w}}}},"./src/models/phi3_v/processing_phi3_v.js":(e,r,t)=>{t.r(r),t.d(r,{Phi3VProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");const i="<|image|>",a=/<\|image_\d+\|>/g;class l extends s.Processor{async _call(p,u=null,{padding:h=!0,truncation:g=!0,num_crops:_=null}={}){Array.isArray(p)||(p=[p]);let E,I;if(u){I=await this.image_processor(u,{num_crops:_});const{num_img_tokens:M}=I,y=p.map((P,b)=>P.split(a).join(i.repeat(M[b])));E=this.tokenizer(y,{padding:h,truncation:g});const $=this.tokenizer.model.convert_tokens_to_ids([i])[0];E.input_ids.map_(P=>P==$?-P:P)}else E=this.tokenizer(p);return{...E,...I}}}re(l,"image_processor_class",o.AutoImageProcessor),re(l,"tokenizer_class",n.AutoTokenizer)},"./src/models/processors.js":(e,r,t)=>{t.r(r),t.d(r,{Florence2Processor:()=>s.Florence2Processor,GroundingDinoProcessor:()=>o.GroundingDinoProcessor,Idefics3Processor:()=>n.Idefics3Processor,JinaCLIPProcessor:()=>a.JinaCLIPProcessor,MgpstrProcessor:()=>l.MgpstrProcessor,MoonshineProcessor:()=>c.MoonshineProcessor,OwlViTProcessor:()=>p.OwlViTProcessor,PaliGemmaProcessor:()=>h.PaliGemmaProcessor,Phi3VProcessor:()=>u.Phi3VProcessor,PyAnnoteProcessor:()=>g.PyAnnoteProcessor,Qwen2VLProcessor:()=>_.Qwen2VLProcessor,SamProcessor:()=>E.SamProcessor,SmolVLMProcessor:()=>I.SmolVLMProcessor,SpeechT5Processor:()=>M.SpeechT5Processor,UltravoxProcessor:()=>y.UltravoxProcessor,VLChatProcessor:()=>i.VLChatProcessor,Wav2Vec2Processor:()=>$.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>P.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>b.WhisperProcessor});var s=t("./src/models/florence2/processing_florence2.js"),o=t("./src/models/grounding_dino/processing_grounding_dino.js"),n=t("./src/models/idefics3/processing_idefics3.js"),i=t("./src/models/janus/processing_janus.js"),a=t("./src/models/jina_clip/processing_jina_clip.js"),l=t("./src/models/mgp_str/processing_mgp_str.js"),c=t("./src/models/moonshine/processing_moonshine.js"),p=t("./src/models/owlvit/processing_owlvit.js"),u=t("./src/models/phi3_v/processing_phi3_v.js"),h=t("./src/models/paligemma/processing_paligemma.js"),g=t("./src/models/pyannote/processing_pyannote.js"),_=t("./src/models/qwen2_vl/processing_qwen2_vl.js"),E=t("./src/models/sam/processing_sam.js"),I=t("./src/models/smolvlm/processing_smolvlm.js"),M=t("./src/models/speecht5/processing_speecht5.js"),y=t("./src/models/ultravox/processing_ultravox.js"),$=t("./src/models/wav2vec2/processing_wav2vec2.js"),P=t("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),b=t("./src/models/whisper/processing_whisper.js")},"./src/models/pvt/image_processing_pvt.js":(e,r,t)=>{t.r(r),t.d(r,{PvtImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/pyannote/feature_extraction_pyannote.js":(e,r,t)=>{t.r(r),t.d(r,{PyAnnoteFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");class i extends s.FeatureExtractor{async _call(l){(0,s.validate_audio_inputs)(l,"PyAnnoteFeatureExtractor"),l instanceof Float64Array&&(l=new Float32Array(l));const c=[1,1,l.length];return{input_values:new o.Tensor("float32",l,c)}}samples_to_frames(l){return(l-this.config.offset)/this.config.step}post_process_speaker_diarization(l,c){const p=c/this.samples_to_frames(c)/this.config.sampling_rate,u=[];for(const h of l.tolist()){const g=[];let _=-1;for(let E=0;E({id:E,start:I*p,end:M*p,confidence:y/(M-I)})))}return u}}},"./src/models/pyannote/processing_pyannote.js":(e,r,t)=>{t.r(r),t.d(r,{PyAnnoteProcessor:()=>n});var s=t("./src/base/processing_utils.js"),o=t("./src/models/pyannote/feature_extraction_pyannote.js");class n extends s.Processor{async _call(a){return await this.feature_extractor(a)}post_process_speaker_diarization(...a){return this.feature_extractor.post_process_speaker_diarization(...a)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}}re(n,"feature_extractor_class",o.PyAnnoteFeatureExtractor)},"./src/models/qwen2_vl/image_processing_qwen2_vl.js":(e,r,t)=>{t.r(r),t.d(r,{Qwen2VLImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a,...l){const{pixel_values:c,original_sizes:p,reshaped_input_sizes:u}=await super._call(a,...l);let h=c;const{temporal_patch_size:g,merge_size:_,patch_size:E}=this.config;h.dims[0]===1&&(h=(0,o.cat)(Array.from({length:g},()=>h),0));const I=h.dims[0]/g,M=h.dims[1],y=Math.floor(h.dims[2]/E),$=Math.floor(h.dims[3]/E),P=h.view(I,g,M,Math.floor(y/_),_,E,Math.floor($/_),_,E).permute(0,3,6,4,7,2,1,5,8).view(I*y*$,M*g*E*E),b=new o.Tensor("int64",[I,y,$],[1,3]);return{pixel_values:P,image_grid_thw:b,original_sizes:p,reshaped_input_sizes:u}}}},"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,r,t)=>{t.r(r),t.d(r,{Qwen2VLProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");class i extends s.Processor{async _call(l,c=null,...p){Array.isArray(l)||(l=[l]);let u,h;if(c&&(u=await this.image_processor(c),h=u.image_grid_thw),h){let _=this.image_processor.config.merge_size**2,E=0;const I=h.tolist();l=l.map(M=>{for(;M.includes("<|image_pad|>");){const y=Number(I[E++].reduce(($,P)=>$*P,1n));M=M.replace("<|image_pad|>","<|placeholder|>".repeat(Math.floor(y/_)))}return M.replaceAll("<|placeholder|>","<|image_pad|>")})}return{...this.tokenizer(l),...u}}}re(i,"image_processor_class",o.AutoImageProcessor),re(i,"tokenizer_class",n.AutoTokenizer)},"./src/models/rt_detr/image_processing_rt_detr.js":(e,r,t)=>{t.r(r),t.d(r,{RTDetrImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...i){return(0,s.post_process_object_detection)(...i)}}},"./src/models/sam/image_processing_sam.js":(e,r,t)=>{t.r(r),t.d(r,{SamImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/core.js"),n=t("./src/utils/tensor.js");class i extends s.ImageProcessor{reshape_input_points(l,c,p,u=!1){l=structuredClone(l);let h=(0,o.calculateDimensions)(l);if(h.length===3)u||(h=[1,...h]),l=[l];else if(h.length!==4)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let g=0;gu!==c.dims[h]))throw Error(`The first ${p.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new n.Tensor("int64",l.flat(1/0).map(BigInt),p)}async _call(l,{input_points:c=null,input_labels:p=null,input_boxes:u=null}={}){const h=await super._call(l);if(c&&(h.input_points=this.reshape_input_points(c,h.original_sizes,h.reshaped_input_sizes)),p){if(!h.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");h.input_labels=this.add_input_labels(p,h.input_points)}return u&&(h.input_boxes=this.reshape_input_points(u,h.original_sizes,h.reshaped_input_sizes,!0)),h}async post_process_masks(l,c,p,{mask_threshold:u=0,binarize:h=!0,pad_size:g=null}={}){const _=[];g=g??this.pad_size;const E=[g.height,g.width];for(let I=0;Iu&&(b[w]=1);$=new n.Tensor("bool",b,$.dims)}_.push($)}return _}generate_crop_boxes(l,c,{crop_n_layers:p=0,overlap_ratio:u=512/1500,points_per_crop:h=32,crop_n_points_downscale_factor:g=1}={}){}}},"./src/models/sam/processing_sam.js":(e,r,t)=>{t.r(r),t.d(r,{SamProcessor:()=>n});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js");class n extends s.Processor{async _call(...a){return await this.image_processor(...a)}post_process_masks(...a){return this.image_processor.post_process_masks(...a)}reshape_input_points(...a){return this.image_processor.reshape_input_points(...a)}}re(n,"image_processor_class",o.AutoImageProcessor)},"./src/models/seamless_m4t/feature_extraction_seamless_m4t.js":(e,r,t)=>{t.r(r),t.d(r,{SeamlessM4TFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/audio.js");class i extends s.FeatureExtractor{constructor(l){super(l);const c=this.config.sampling_rate,p=(0,n.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(c/2),c,null,"kaldi",!0);for(let u=0;up*32768),(0,n.spectrogram)(l,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:c,transpose:!0})}async _call(l,{padding:c=!0,pad_to_multiple_of:p=2,do_normalize_per_mel_bins:u=!0,return_attention_mask:h=!0}={}){(0,s.validate_audio_inputs)(l,"SeamlessM4TFeatureExtractor");let g=await this._extract_fbank_features(l,this.config.max_length);if(u){const[b,w]=g.dims,T=g.data;for(let k=0;k0){const z=new Float32Array(w*(b+k));z.set(T),z.fill(this.config.padding_value,T.length);const R=b+k;g=new o.Tensor(g.type,z,[R,w]),h&&(_=new o.Tensor("int64",new BigInt64Array(R),[1,R]),_.data.fill(1n,0,b))}}const[E,I]=g.dims,M=this.config.stride;if(E%M!==0)throw new Error(`The number of frames (${E}) must be a multiple of the stride (${M}).`);const $=g.view(1,Math.floor(E/M),I*M),P={input_features:$};if(h){const b=$.dims[1],w=new BigInt64Array(b);if(_){const T=_.data;for(let k=1,z=0;k{t.r(r),t.d(r,{SegformerFeatureExtractor:()=>n,SegformerImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_semantic_segmentation(...a){return(0,s.post_process_semantic_segmentation)(...a)}}class n extends o{}},"./src/models/siglip/image_processing_siglip.js":(e,r,t)=>{t.r(r),t.d(r,{SiglipImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/smolvlm/image_processing_smolvlm.js":(e,r,t)=>{t.r(r),t.d(r,{SmolVLMImageProcessor:()=>s.Idefics3ImageProcessor});var s=t("./src/models/idefics3/image_processing_idefics3.js")},"./src/models/smolvlm/processing_smolvlm.js":(e,r,t)=>{t.r(r),t.d(r,{SmolVLMProcessor:()=>s.Idefics3Processor});var s=t("./src/models/idefics3/processing_idefics3.js")},"./src/models/snac/feature_extraction_snac.js":(e,r,t)=>{t.r(r),t.d(r,{SnacFeatureExtractor:()=>o});var s=t("./src/models/dac/feature_extraction_dac.js");class o extends s.DacFeatureExtractor{}},"./src/models/speecht5/feature_extraction_speecht5.js":(e,r,t)=>{t.r(r),t.d(r,{SpeechT5FeatureExtractor:()=>o});var s=t("./src/base/feature_extraction_utils.js");class o extends s.FeatureExtractor{}},"./src/models/speecht5/processing_speecht5.js":(e,r,t)=>{t.r(r),t.d(r,{SpeechT5Processor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/tokenizers.js"),n=t("./src/models/auto/feature_extraction_auto.js");class i extends s.Processor{async _call(l){return await this.feature_extractor(l)}}re(i,"tokenizer_class",o.AutoTokenizer),re(i,"feature_extractor_class",n.AutoFeatureExtractor)},"./src/models/swin2sr/image_processing_swin2sr.js":(e,r,t)=>{t.r(r),t.d(r,{Swin2SRImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(i,a,l,c={}){const[p,u,h]=a;return super.pad_image(i,a,{width:u+(l-u%l)%l,height:p+(l-p%l)%l},{mode:"symmetric",center:!1,constant_values:-1,...c})}}},"./src/models/ultravox/processing_ultravox.js":(e,r,t)=>{t.r(r),t.d(r,{UltravoxProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l,c=null,p={}){if(Array.isArray(l))throw new Error("Batched inputs are not supported yet.");let u={};if(c){const g=c.length,{input_features:_}=await this.feature_extractor(c,{...p,max_length:g}),E=Math.round(g/this.config.encoder_ds_factor+1e-4),I=1+Math.ceil(E/this.config.stack_factor);u.audio_token_len=[I],u.audio_values=_;const M=this.config.audio_placeholder;if(!l.includes(M))throw new Error(`The input text does not contain the image token ${M}.`);l=l.replaceAll(M,M.repeat(I))}return{...this.tokenizer(l,{add_special_tokens:!1,...p}),...u}}}re(i,"tokenizer_class",o.AutoTokenizer),re(i,"feature_extractor_class",s.AutoFeatureExtractor),re(i,"uses_processor_config",!0)},"./src/models/vit/image_processing_vit.js":(e,r,t)=>{t.r(r),t.d(r,{ViTFeatureExtractor:()=>n,ViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/vitmatte/image_processing_vitmatte.js":(e,r,t)=>{t.r(r),t.d(r,{VitMatteImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a,l){Array.isArray(a)||(a=[a]),Array.isArray(l)||(l=[l]);const c=await Promise.all(a.map(h=>this.preprocess(h))),p=await Promise.all(l.map(h=>this.preprocess(h,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,o.stack)(c.map((h,g)=>(0,o.cat)([h.pixel_values,p[g].pixel_values],0)),0),original_sizes:c.map(h=>h.original_size),reshaped_input_sizes:c.map(h=>h.reshaped_input_size)}}}},"./src/models/vitpose/image_processing_vitpose.js":(e,r,t)=>{t.r(r),t.d(r,{VitPoseImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_pose_estimation(i,a,{threshold:l=null}={}){const c=i.tolist(),[p,u,h,g]=i.dims,_=[];for(let E=0;E{t.r(r),t.d(r,{Wav2Vec2FeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{_zero_mean_unit_var_norm(a){const c=a.reduce((u,h)=>u+h,0)/a.length,p=a.reduce((u,h)=>u+(h-c)**2,0)/a.length;return a.map(u=>(u-c)/Math.sqrt(p+1e-7))}async _call(a){(0,s.validate_audio_inputs)(a,"Wav2Vec2FeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));let l=a;this.config.do_normalize&&(l=this._zero_mean_unit_var_norm(l));const c=[1,l.length];return{input_values:new o.Tensor("float32",l,c),attention_mask:new o.Tensor("int64",new BigInt64Array(l.length).fill(1n),c)}}}},"./src/models/wav2vec2/processing_wav2vec2.js":(e,r,t)=>{t.r(r),t.d(r,{Wav2Vec2Processor:()=>i});var s=t("./src/tokenizers.js"),o=t("./src/models/auto/feature_extraction_auto.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}re(i,"tokenizer_class",s.AutoTokenizer),re(i,"feature_extractor_class",o.AutoFeatureExtractor)},"./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js":(e,r,t)=>{t.r(r),t.d(r,{Wav2Vec2ProcessorWithLM:()=>i});var s=t("./src/tokenizers.js"),o=t("./src/models/auto/feature_extraction_auto.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}re(i,"tokenizer_class",s.AutoTokenizer),re(i,"feature_extractor_class",o.AutoFeatureExtractor)},"./src/models/wespeaker/feature_extraction_wespeaker.js":(e,r,t)=>{t.r(r),t.d(r,{WeSpeakerFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a);const l=this.config.sampling_rate,c=(0,o.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(l/2),l,null,"kaldi",!0);for(let p=0;pl*32768),(0,o.spectrogram)(a,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(a){(0,s.validate_audio_inputs)(a,"WeSpeakerFeatureExtractor");const l=(await this._extract_fbank_features(a)).unsqueeze_(0);if(this.config.fbank_centering_span===null){const c=l.mean(1).data,p=l.data,[u,h,g]=l.dims;for(let _=0;_{t.r(r),t.d(r,{WHISPER_LANGUAGE_MAPPING:()=>o,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>n,whisper_language_to_code:()=>i});const s=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],o=new Map(s),n=new Map([...s.map(([a,l])=>[l,a]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function i(a){a=a.toLowerCase();let l=n.get(a);if(l===void 0){const c=a.match(/^<\|([a-z]{2})\|>$/);if(c&&(a=c[1]),o.has(a))l=a;else{const u=a.length===2?o.keys():o.values();throw new Error(`Language "${a}" is not supported. Must be one of: ${JSON.stringify(Array.from(u))}`)}}return l}},"./src/models/whisper/feature_extraction_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js"),n=t("./src/utils/maths.js");class i extends s.FeatureExtractor{constructor(l){var c;super(l),(c=this.config).mel_filters??(c.mel_filters=(0,o.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney")),this.window=(0,o.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(l){const c=await(0,o.spectrogram)(l,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:Math.min(Math.floor(l.length/this.config.hop_length),this.config.nb_max_frames)}),p=c.data,u=(0,n.max)(p)[0];for(let h=0;hu?(l.length>this.config.n_samples&&console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),p=l.slice(0,u)):(p=new Float32Array(u),p.set(l)),{input_features:(await this._extract_fbank_features(p)).unsqueeze_(0)}}}},"./src/models/whisper/generation_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperGenerationConfig:()=>o});var s=t("./src/generation/configuration_utils.js");class o extends s.GenerationConfig{constructor(){super(...arguments);re(this,"return_timestamps",null);re(this,"return_token_timestamps",null);re(this,"num_frames",null);re(this,"alignment_heads",null);re(this,"task",null);re(this,"language",null);re(this,"no_timestamps_token_id",null);re(this,"prompt_ids",null);re(this,"is_multilingual",null);re(this,"lang_to_id",null);re(this,"task_to_id",null);re(this,"max_initial_timestamp_index",1)}}},"./src/models/whisper/processing_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}re(i,"tokenizer_class",o.AutoTokenizer),re(i,"feature_extractor_class",s.AutoFeatureExtractor)},"./src/models/yolos/image_processing_yolos.js":(e,r,t)=>{t.r(r),t.d(r,{YolosFeatureExtractor:()=>n,YolosImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...a){return(0,s.post_process_object_detection)(...a)}}class n extends o{}},"./src/ops/registry.js":(e,r,t)=>{t.r(r),t.d(r,{TensorOpRegistry:()=>l});var s=t("./src/backends/onnx.js"),o=t("./src/utils/tensor.js"),n=t("./src/env.js");const i=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV,a=async(c,p,u)=>{const h=await(0,s.createInferenceSession)(new Uint8Array(c),p);let g=Promise.resolve();return async _=>{const E=(0,s.isONNXProxy)(),I=Object.fromEntries(Object.entries(_).map(([y,$])=>[y,(E?$.clone():$).ort_tensor])),M=await(g=i?g.then(()=>h.run(I)):h.run(I));return Array.isArray(u)?u.map(y=>new o.Tensor(M[y])):new o.Tensor(M[u])}};class l{static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=a([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=a([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=a([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=a([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=a([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=a([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=a([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=a([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}}re(l,"session_options",{})},"./src/pipelines.js":(e,r,t)=>{t.r(r),t.d(r,{AudioClassificationPipeline:()=>q,AutomaticSpeechRecognitionPipeline:()=>Z,BackgroundRemovalPipeline:()=>ae,DepthEstimationPipeline:()=>X,DocumentQuestionAnsweringPipeline:()=>O,FeatureExtractionPipeline:()=>R,FillMaskPipeline:()=>$,ImageClassificationPipeline:()=>J,ImageFeatureExtractionPipeline:()=>Q,ImageSegmentationPipeline:()=>oe,ImageToImagePipeline:()=>se,ImageToTextPipeline:()=>H,ObjectDetectionPipeline:()=>he,Pipeline:()=>E,QuestionAnsweringPipeline:()=>y,SummarizationPipeline:()=>b,Text2TextGenerationPipeline:()=>P,TextClassificationPipeline:()=>I,TextGenerationPipeline:()=>k,TextToAudioPipeline:()=>G,TokenClassificationPipeline:()=>M,TranslationPipeline:()=>w,ZeroShotAudioClassificationPipeline:()=>U,ZeroShotClassificationPipeline:()=>z,ZeroShotImageClassificationPipeline:()=>ce,ZeroShotObjectDetectionPipeline:()=>N,pipeline:()=>ke});var s=t("./src/tokenizers.js"),o=t("./src/models.js"),n=t("./src/models/auto/processing_auto.js");t("./src/base/processing_utils.js");var i=t("./src/utils/generic.js"),a=t("./src/utils/core.js"),l=t("./src/utils/maths.js"),c=t("./src/utils/audio.js"),p=t("./src/utils/tensor.js"),u=t("./src/utils/image.js");async function h(Me){return Array.isArray(Me)||(Me=[Me]),await Promise.all(Me.map(K=>u.RawImage.read(K)))}async function g(Me,K){return Array.isArray(Me)||(Me=[Me]),await Promise.all(Me.map(j=>typeof j=="string"||j instanceof URL?(0,c.read_audio)(j,K):j instanceof Float64Array?new Float32Array(j):j))}function _(Me,K){K&&(Me=Me.map(Ae=>Ae|0));const[j,me,Pe,Te]=Me;return{xmin:j,ymin:me,xmax:Pe,ymax:Te}}class E extends i.Callable{constructor({task:K,model:j,tokenizer:me=null,processor:Pe=null}){super(),this.task=K,this.model=j,this.tokenizer=me,this.processor=Pe}async dispose(){await this.model.dispose()}}class I extends E{constructor(K){super(K)}async _call(K,{top_k:j=1}={}){const me=this.tokenizer(K,{padding:!0,truncation:!0}),Pe=await this.model(me),Te=this.model.config.problem_type==="multi_label_classification"?Le=>Le.sigmoid():Le=>new p.Tensor("float32",(0,l.softmax)(Le.data),Le.dims),Ae=this.model.config.id2label,Ie=[];for(const Le of Pe.logits){const Ne=Te(Le),We=await(0,p.topk)(Ne,j),D=We[0].tolist(),B=We[1].tolist().map((te,de)=>({label:Ae?Ae[te]:`LABEL_${te}`,score:D[de]}));j===1?Ie.push(...B):Ie.push(B)}return Array.isArray(K)||j===1?Ie:Ie[0]}}class M extends E{constructor(K){super(K)}async _call(K,{ignore_labels:j=["O"]}={}){const me=Array.isArray(K),Pe=this.tokenizer(me?K:[K],{padding:!0,truncation:!0}),Ae=(await this.model(Pe)).logits,Ie=this.model.config.id2label,Le=[];for(let Ne=0;NeFe==this.tokenizer.sep_token_id);Le[D].map((Fe,je)=>Fe==1&&(je===0||je>B&&Ne.findIndex(qe=>qe==ee[je])===-1));const te=Te[D].tolist(),de=Ae[D].tolist();for(let Fe=1;Feje==ee[Fe])!==-1)&&(te[Fe]=-1/0,de[Fe]=-1/0);const be=(0,l.softmax)(te).map((Fe,je)=>[Fe,je]),ve=(0,l.softmax)(de).map((Fe,je)=>[Fe,je]);be[0][0]=0,ve[0][0]=0;const Re=(0,a.product)(be,ve).filter(Fe=>Fe[0][1]<=Fe[1][1]).map(Fe=>[Fe[0][1],Fe[1][1],Fe[0][0]*Fe[1][0]]).sort((Fe,je)=>je[2]-Fe[2]);for(let Fe=0;Fete==this.tokenizer.mask_token_id);if(Ne===-1)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);const We=Pe[Ie][Ne],D=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(We.data),We.dims),j),ee=D[0].tolist(),B=D[1].tolist();Te.push(B.map((te,de)=>{const be=Le.slice();return be[Ne]=te,{score:ee[de],token:Number(te),token_str:this.tokenizer.decode([te]),sequence:this.tokenizer.decode(be,{skip_special_tokens:!0})}}))}return Array.isArray(K)?Te:Te[0]}}class P extends E{constructor(j){super(j);re(this,"_key","generated_text")}async _call(j,me={}){Array.isArray(j)||(j=[j]),this.model.config.prefix&&(j=j.map(Ne=>this.model.config.prefix+Ne));const Pe=this.model.config.task_specific_params;Pe&&Pe[this.task]&&Pe[this.task].prefix&&(j=j.map(Ne=>Pe[this.task].prefix+Ne));const Te=this.tokenizer,Ae={padding:!0,truncation:!0};let Ie;this instanceof w&&"_build_translation_inputs"in Te?Ie=Te._build_translation_inputs(j,Ae,me):Ie=Te(j,Ae);const Le=await this.model.generate({...Ie,...me});return Te.batch_decode(Le,{skip_special_tokens:!0}).map(Ne=>({[this._key]:Ne}))}}class b extends P{constructor(j){super(j);re(this,"_key","summary_text")}}class w extends P{constructor(j){super(j);re(this,"_key","translation_text")}}function T(Me){return Array.isArray(Me)&&Me.every(K=>"role"in K&&"content"in K)}class k extends E{constructor(K){super(K)}async _call(K,j={}){let me=!1,Pe=!1,Te;if(typeof K=="string")Te=K=[K];else if(Array.isArray(K)&&K.every(B=>typeof B=="string"))me=!0,Te=K;else{if(T(K))K=[K];else if(Array.isArray(K)&&K.every(T))me=!0;else throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");Pe=!0,Te=K.map(B=>this.tokenizer.apply_chat_template(B,{tokenize:!1,add_generation_prompt:!0}))}const Ae=j.add_special_tokens??!1,Ie=Pe?!1:j.return_full_text??!0;this.tokenizer.padding_side="left";const Le=this.tokenizer(Te,{add_special_tokens:Ae,padding:!0,truncation:!0}),Ne=await this.model.generate({...Le,...j}),We=this.tokenizer.batch_decode(Ne,{skip_special_tokens:!0});let D;!Ie&&Le.input_ids.dims.at(-1)>0&&(D=this.tokenizer.batch_decode(Le.input_ids,{skip_special_tokens:!0}).map(B=>B.length));const ee=Array.from({length:K.length},B=>[]);for(let B=0;B[j.toLowerCase(),me])),this.entailment_id=this.label2id.entailment,this.entailment_id===void 0&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,this.contradiction_id===void 0&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(K,j,{hypothesis_template:me="This example is {}.",multi_label:Pe=!1}={}){const Te=Array.isArray(K);Te||(K=[K]),Array.isArray(j)||(j=[j]);const Ae=j.map(Ne=>me.replace("{}",Ne)),Ie=Pe||j.length===1,Le=[];for(const Ne of K){const We=[];for(const B of Ae){const te=this.tokenizer(Ne,{text_pair:B,padding:!0,truncation:!0}),de=await this.model(te);Ie?We.push([de.logits.data[this.contradiction_id],de.logits.data[this.entailment_id]]):We.push(de.logits.data[this.entailment_id])}const ee=(Ie?We.map(B=>(0,l.softmax)(B)[1]):(0,l.softmax)(We)).map((B,te)=>[B,te]).sort((B,te)=>te[0]-B[0]);Le.push({sequence:Ne,labels:ee.map(B=>j[B[1]]),scores:ee.map(B=>B[0])})}return Te?Le:Le[0]}}class R extends E{constructor(K){super(K)}async _call(K,{pooling:j="none",normalize:me=!1,quantize:Pe=!1,precision:Te="binary"}={}){const Ae=this.tokenizer(K,{padding:!0,truncation:!0}),Ie=await this.model(Ae);let Le=Ie.last_hidden_state??Ie.logits??Ie.token_embeddings;if(j!=="none")if(j==="mean")Le=(0,p.mean_pooling)(Le,Ae.attention_mask);else if(j==="cls")Le=Le.slice(null,0);else throw Error(`Pooling method '${j}' not supported.`);return me&&(Le=Le.normalize(2,-1)),Pe&&(Le=(0,p.quantize_embeddings)(Le,Te)),Le}}class Q extends E{constructor(K){super(K)}async _call(K,{pool:j=null}={}){const me=await h(K),{pixel_values:Pe}=await this.processor(me),Te=await this.model({pixel_values:Pe});let Ae;if(j){if(!("pooler_output"in Te))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");Ae=Te.pooler_output}else Ae=Te.last_hidden_state??Te.logits??Te.image_embeds;return Ae}}class q extends E{constructor(K){super(K)}async _call(K,{top_k:j=5}={}){const me=this.processor.feature_extractor.config.sampling_rate,Pe=await g(K,me),Te=this.model.config.id2label,Ae=[];for(const Ie of Pe){const Le=await this.processor(Ie),We=(await this.model(Le)).logits[0],D=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(We.data),We.dims),j),ee=D[0].tolist(),te=D[1].tolist().map((de,be)=>({label:Te?Te[de]:`LABEL_${de}`,score:ee[be]}));Ae.push(te)}return Array.isArray(K)?Ae:Ae[0]}}class U extends E{constructor(K){super(K)}async _call(K,j,{hypothesis_template:me="This is a sound of {}."}={}){const Pe=!Array.isArray(K);Pe&&(K=[K]);const Te=j.map(We=>me.replace("{}",We)),Ae=this.tokenizer(Te,{padding:!0,truncation:!0}),Ie=this.processor.feature_extractor.config.sampling_rate,Le=await g(K,Ie),Ne=[];for(const We of Le){const D=await this.processor(We),ee=await this.model({...Ae,...D}),B=(0,l.softmax)(ee.logits_per_audio.data);Ne.push([...B].map((te,de)=>({score:te,label:j[de]})))}return Pe?Ne[0]:Ne}}class Z extends E{constructor(K){super(K)}async _call(K,j={}){switch(this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(K,j);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(K,j);case"moonshine":return this._call_moonshine(K,j);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(K,j){j.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),j.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const me=!Array.isArray(K);me&&(K=[K]);const Pe=this.processor.feature_extractor.config.sampling_rate,Te=await g(K,Pe),Ae=[];for(const Ie of Te){const Le=await this.processor(Ie),We=(await this.model(Le)).logits[0],D=[];for(const B of We)D.push((0,l.max)(B.data)[1]);const ee=this.tokenizer.decode(D);Ae.push({text:ee})}return me?Ae[0]:Ae}async _call_whisper(K,j){const me=j.return_timestamps??!1,Pe=j.chunk_length_s??0,Te=j.force_full_sequences??!1;let Ae=j.stride_length_s??null;const Ie={...j};me==="word"&&(Ie.return_token_timestamps=!0,Ie.return_timestamps=!1);const Le=!Array.isArray(K);Le&&(K=[K]);const Ne=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,We=this.processor.feature_extractor.config.hop_length,D=this.processor.feature_extractor.config.sampling_rate,ee=await g(K,D),B=[];for(const te of ee){let de=[];if(Pe>0){if(Ae===null)Ae=Pe/6;else if(Pe<=Ae)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const Re=D*Pe,Fe=D*Ae,je=Re-2*Fe;let qe=0;for(;;){const Xe=qe+Re,ut=te.subarray(qe,Xe),wt=await this.processor(ut),nr=qe===0,jt=Xe>=te.length;if(de.push({stride:[ut.length,nr?0:Fe,jt?0:Fe],input_features:wt.input_features,is_last:jt}),jt)break;qe+=je}}else de=[{stride:[te.length,0,0],input_features:(await this.processor(te)).input_features,is_last:!0}];for(const Re of de){Ie.num_frames=Math.floor(Re.stride[0]/We);const Fe=await this.model.generate({inputs:Re.input_features,...Ie});me==="word"?(Re.tokens=Fe.sequences.tolist()[0],Re.token_timestamps=Fe.token_timestamps.tolist()[0].map(je=>(0,l.round)(je,2))):Re.tokens=Fe[0].tolist(),Re.stride=Re.stride.map(je=>je/D)}const[be,ve]=this.tokenizer._decode_asr(de,{time_precision:Ne,return_timestamps:me,force_full_sequences:Te});B.push({text:be,...ve})}return Le?B[0]:B}async _call_moonshine(K,j){const me=!Array.isArray(K);me&&(K=[K]);const Pe=this.processor.feature_extractor.config.sampling_rate,Te=await g(K,Pe),Ae=[];for(const Ie of Te){const Le=await this.processor(Ie),Ne=Math.floor(Ie.length/Pe)*6,We=await this.model.generate({max_new_tokens:Ne,...j,...Le}),D=this.processor.batch_decode(We,{skip_special_tokens:!0})[0];Ae.push({text:D})}return me?Ae[0]:Ae}}class H extends E{constructor(K){super(K)}async _call(K,j={}){const me=Array.isArray(K),Pe=await h(K),{pixel_values:Te}=await this.processor(Pe),Ae=[];for(const Ie of Te){Ie.dims=[1,...Ie.dims];const Le=await this.model.generate({inputs:Ie,...j}),Ne=this.tokenizer.batch_decode(Le,{skip_special_tokens:!0}).map(We=>({generated_text:We.trim()}));Ae.push(Ne)}return me?Ae:Ae[0]}}class J extends E{constructor(K){super(K)}async _call(K,{top_k:j=5}={}){const me=await h(K),{pixel_values:Pe}=await this.processor(me),Te=await this.model({pixel_values:Pe}),Ae=this.model.config.id2label,Ie=[];for(const Le of Te.logits){const Ne=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(Le.data),Le.dims),j),We=Ne[0].tolist(),ee=Ne[1].tolist().map((B,te)=>({label:Ae?Ae[B]:`LABEL_${B}`,score:We[te]}));Ie.push(ee)}return Array.isArray(K)?Ie:Ie[0]}}class oe extends E{constructor(K){super(K),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(K,{threshold:j=.5,mask_threshold:me=.5,overlap_mask_area_threshold:Pe=.8,label_ids_to_fuse:Te=null,target_sizes:Ae=null,subtask:Ie=null}={}){if(Array.isArray(K)&&K.length!==1)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const Ne=await h(K),We=Ne.map(Re=>[Re.height,Re.width]),D=await this.processor(Ne),{inputNames:ee,outputNames:B}=this.model.sessions.model;if(!ee.includes("pixel_values")){if(ee.length!==1)throw Error(`Expected a single input name, but got ${ee.length} inputs: ${ee}.`);const Re=ee[0];if(Re in D)throw Error(`Input name ${Re} already exists in the inputs.`);D[Re]=D.pixel_values}const te=await this.model(D);let de=null;if(Ie!==null)de=this.subtasks_mapping[Ie];else if(this.processor.image_processor){for(const[Re,Fe]of Object.entries(this.subtasks_mapping))if(Fe in this.processor.image_processor){de=this.processor.image_processor[Fe].bind(this.processor.image_processor),Ie=Re;break}}const be=this.model.config.id2label,ve=[];if(Ie)if(Ie==="panoptic"||Ie==="instance"){const Re=de(te,j,me,Pe,Te,Ae??We)[0],Fe=Re.segmentation;for(const je of Re.segments_info){const qe=new Uint8ClampedArray(Fe.data.length);for(let ut=0;utwt<-1e-5||wt>1+1e-5)&&Xe.sigmoid_();const ut=await u.RawImage.fromTensor(Xe.mul_(255).to("uint8")).resize(qe[1],qe[0]);ve.push({label:null,score:null,mask:ut})}}return ve}}class ae extends oe{constructor(K){super(K)}async _call(K,j={}){if(Array.isArray(K)&&K.length!==1)throw Error("Background removal pipeline currently only supports a batch size of 1.");const Pe=await h(K),Te=await super._call(K,j);return Pe.map((Ie,Le)=>{const Ne=Ie.clone();return Ne.putAlpha(Te[Le].mask),Ne})}}class ce extends E{constructor(K){super(K)}async _call(K,j,{hypothesis_template:me="This is a photo of {}"}={}){const Pe=Array.isArray(K),Te=await h(K),Ae=j.map(ee=>me.replace("{}",ee)),Ie=this.tokenizer(Ae,{padding:this.model.config.model_type==="siglip"?"max_length":!0,truncation:!0}),{pixel_values:Le}=await this.processor(Te),Ne=await this.model({...Ie,pixel_values:Le}),We=this.model.config.model_type==="siglip"?ee=>ee.sigmoid().data:ee=>(0,l.softmax)(ee.data),D=[];for(const ee of Ne.logits_per_image){const te=[...We(ee)].map((de,be)=>({score:de,label:j[be]}));te.sort((de,be)=>be.score-de.score),D.push(te)}return Pe?D:D[0]}}class he extends E{constructor(K){super(K)}async _call(K,{threshold:j=.9,percentage:me=!1}={}){const Pe=Array.isArray(K);if(Pe&&K.length!==1)throw Error("Object detection pipeline currently only supports a batch size of 1.");const Te=await h(K),Ae=me?null:Te.map(B=>[B.height,B.width]),{pixel_values:Ie,pixel_mask:Le}=await this.processor(Te),Ne=await this.model({pixel_values:Ie,pixel_mask:Le}),We=this.processor.image_processor.post_process_object_detection(Ne,j,Ae),D=this.model.config.id2label,ee=We.map(B=>B.boxes.map((te,de)=>({score:B.scores[de],label:D[B.classes[de]],box:_(te,!me)})));return Pe?ee:ee[0]}}class N extends E{constructor(K){super(K)}async _call(K,j,{threshold:me=.1,top_k:Pe=null,percentage:Te=!1}={}){const Ae=Array.isArray(K),Ie=await h(K),Le=this.tokenizer(j,{padding:!0,truncation:!0}),Ne=await this.processor(Ie),We=[];for(let D=0;D({score:ve.scores[Fe],label:ve.labels[Fe],box:_(Re,!Te)}))}else{const ve=this.processor.image_processor.post_process_object_detection(de,me,B,!0)[0];be=ve.boxes.map((Re,Fe)=>({score:ve.scores[Fe],label:j[ve.classes[Fe]],box:_(Re,!Te)}))}be.sort((ve,Re)=>Re.score-ve.score),Pe!==null&&(be=be.slice(0,Pe)),We.push(be)}return Ae?We:We[0]}}class O extends E{constructor(K){super(K)}async _call(K,j,me={}){const Pe=(await h(K))[0],{pixel_values:Te}=await this.processor(Pe),Ae=`${j}`,Ie=this.tokenizer(Ae,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,Le=await this.model.generate({inputs:Te,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:Ie,...me}),We=this.tokenizer.batch_decode(Le)[0].match(/(.*?)<\/s_answer>/);let D=null;return We&&We.length>=2&&(D=We[1].trim()),[{answer:D}]}}class G extends E{constructor(j){super(j);re(this,"DEFAULT_VOCODER_ID","Xenova/speecht5_hifigan");this.vocoder=j.vocoder??null}async _call(j,{speaker_embeddings:me=null}={}){return this.processor?this._call_text_to_spectrogram(j,{speaker_embeddings:me}):this._call_text_to_waveform(j)}async _call_text_to_waveform(j){const me=this.tokenizer(j,{padding:!0,truncation:!0}),{waveform:Pe}=await this.model(me),Te=this.model.config.sampling_rate;return new c.RawAudio(Pe.data,Te)}async _call_text_to_spectrogram(j,{speaker_embeddings:me}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"})),(typeof me=="string"||me instanceof URL)&&(me=new Float32Array(await(await fetch(me)).arrayBuffer())),me instanceof Float32Array)me=new p.Tensor("float32",me,[1,me.length]);else if(!(me instanceof p.Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");const{input_ids:Pe}=this.tokenizer(j,{padding:!0,truncation:!0}),{waveform:Te}=await this.model.generate_speech(Pe,me,{vocoder:this.vocoder}),Ae=this.processor.feature_extractor.config.sampling_rate;return new c.RawAudio(Te.data,Ae)}}class se extends E{constructor(K){super(K)}async _call(K){const j=await h(K),me=await this.processor(j),Pe=await this.model(me),Te=[];for(const Ae of Pe.reconstruction){const Ie=Ae.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");Te.push(u.RawImage.fromTensor(Ie))}return Te.length>1?Te:Te[0]}}class X extends E{constructor(K){super(K)}async _call(K){const j=await h(K),me=await this.processor(j),{predicted_depth:Pe}=await this.model(me),Te=[];for(let Ae=0;Ae1?Te:Te[0]}}const we=Object.freeze({"text-classification":{tokenizer:s.AutoTokenizer,pipeline:I,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:s.AutoTokenizer,pipeline:M,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:s.AutoTokenizer,pipeline:y,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:s.AutoTokenizer,pipeline:$,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:s.AutoTokenizer,pipeline:b,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:s.AutoTokenizer,pipeline:w,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:s.AutoTokenizer,pipeline:P,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:s.AutoTokenizer,pipeline:k,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:s.AutoTokenizer,pipeline:z,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:q,model:o.AutoModelForAudioClassification,processor:n.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:s.AutoTokenizer,pipeline:U,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:s.AutoTokenizer,pipeline:Z,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:n.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:s.AutoTokenizer,pipeline:G,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[n.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:s.AutoTokenizer,pipeline:H,model:o.AutoModelForVision2Seq,processor:n.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:J,model:o.AutoModelForImageClassification,processor:n.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:oe,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:ae,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{tokenizer:s.AutoTokenizer,pipeline:ce,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:he,model:o.AutoModelForObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:s.AutoTokenizer,pipeline:N,model:o.AutoModelForZeroShotObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:s.AutoTokenizer,pipeline:O,model:o.AutoModelForDocumentQuestionAnswering,processor:n.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:se,model:o.AutoModelForImageToImage,processor:n.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:X,model:o.AutoModelForDepthEstimation,processor:n.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:s.AutoTokenizer,pipeline:R,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:n.AutoProcessor,pipeline:Q,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),_e=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function ke(Me,K=null,{progress_callback:j=null,config:me=null,cache_dir:Pe=null,local_files_only:Te=!1,revision:Ae="main",device:Ie=null,dtype:Le=null,subfolder:Ne="onnx",use_external_data_format:We=null,model_file_name:D=null,session_options:ee={}}={}){Me=_e[Me]??Me;const B=we[Me.split("_",1)[0]];if(!B)throw Error(`Unsupported pipeline: ${Me}. Must be one of [${Object.keys(we)}]`);K||(K=B.default.model,console.log(`No model specified. Using default model: "${K}".`));const te={progress_callback:j,config:me,cache_dir:Pe,local_files_only:Te,revision:Ae,device:Ie,dtype:Le,subfolder:Ne,use_external_data_format:We,model_file_name:D,session_options:ee},de=new Map([["tokenizer",B.tokenizer],["model",B.model],["processor",B.processor]]),be=await He(de,K,te);be.task=Me,(0,a.dispatchCallback)(j,{status:"ready",task:Me,model:K});const ve=B.pipeline;return new ve(be)}async function He(Me,K,j){const me=Object.create(null),Pe=[];for(const[Te,Ae]of Me.entries()){if(!Ae)continue;let Ie;Array.isArray(Ae)?Ie=new Promise(async(Le,Ne)=>{var D,ee;let We;for(const B of Ae){if(B===null){Le(null);return}try{Le(await B.from_pretrained(K,j));return}catch(te){if((D=te.message)!=null&&D.includes("Unsupported model type"))We=te;else if((ee=te.message)!=null&&ee.includes("Could not locate file"))We=te;else{Ne(te);return}}}Ne(We)}):Ie=Ae.from_pretrained(K,j),me[Te]=Ie,Pe.push(Ie)}await Promise.all(Pe);for(const[Te,Ae]of Object.entries(me))me[Te]=await Ae;return me}},"./src/tokenizers.js":(e,r,t)=>{t.r(r),t.d(r,{AlbertTokenizer:()=>Rr,AutoTokenizer:()=>mn,BartTokenizer:()=>ns,BertTokenizer:()=>Gr,BlenderbotSmallTokenizer:()=>qr,BlenderbotTokenizer:()=>kr,BloomTokenizer:()=>Kr,CLIPTokenizer:()=>un,CamembertTokenizer:()=>ot,CodeGenTokenizer:()=>Hr,CodeLlamaTokenizer:()=>Gs,CohereTokenizer:()=>hn,ConvBertTokenizer:()=>hr,DebertaTokenizer:()=>vs,DebertaV2Tokenizer:()=>xs,DistilBertTokenizer:()=>et,ElectraTokenizer:()=>zt,EsmTokenizer:()=>Qs,FalconTokenizer:()=>as,GPT2Tokenizer:()=>ss,GPTNeoXTokenizer:()=>qs,GemmaTokenizer:()=>Dr,Grok1Tokenizer:()=>Es,HerbertTokenizer:()=>As,LlamaTokenizer:()=>Ws,M2M100Tokenizer:()=>Os,MBart50Tokenizer:()=>os,MBartTokenizer:()=>Tr,MPNetTokenizer:()=>Hs,MarianTokenizer:()=>pn,MgpstrTokenizer:()=>Ps,MobileBertTokenizer:()=>rs,NllbTokenizer:()=>Fs,NougatTokenizer:()=>mr,PreTrainedTokenizer:()=>dt,Qwen2Tokenizer:()=>Xs,RoFormerTokenizer:()=>Be,RobertaTokenizer:()=>is,SiglipTokenizer:()=>Lr,SpeechT5Tokenizer:()=>lr,SqueezeBertTokenizer:()=>bs,T5Tokenizer:()=>Sr,TokenizerModel:()=>Q,VitsTokenizer:()=>Ls,Wav2Vec2CTCTokenizer:()=>Ds,WhisperTokenizer:()=>$r,XLMRobertaTokenizer:()=>Ks,XLMTokenizer:()=>rr,is_chinese_char:()=>$});var s=t("./src/utils/generic.js"),o=t("./src/utils/core.js"),n=t("./src/utils/hub.js"),i=t("./src/utils/maths.js"),a=t("./src/utils/tensor.js"),l=t("./src/utils/data-structures.js"),c=t("./node_modules/@huggingface/jinja/dist/index.js"),p=t("./src/models/whisper/common_whisper.js");async function u(pe,F){const V=await Promise.all([(0,n.getModelJSON)(pe,"tokenizer.json",!0,F),(0,n.getModelJSON)(pe,"tokenizer_config.json",!0,F)]);return F.legacy!==null&&(V[1].legacy=F.legacy),V}function h(pe,F){const V=[];let Y=0;for(const le of pe.matchAll(F)){const ue=le[0];Y0&&V.push(ue),Y=le.index+ue.length}return Y=19968&&pe<=40959||pe>=13312&&pe<=19903||pe>=131072&&pe<=173791||pe>=173824&&pe<=177983||pe>=177984&&pe<=178207||pe>=178208&&pe<=183983||pe>=63744&&pe<=64255||pe>=194560&&pe<=195103}function P(pe,F,V){const Y=[];let le=0;for(;lethis.tokens_to_ids.get(V)??this.unk_token_id)}convert_ids_to_tokens(F){return F.map(V=>this.vocab[V]??this.unk_token)}}class q extends Q{constructor(F){super(F),this.tokens_to_ids=_(F.vocab),this.unk_token_id=this.tokens_to_ids.get(F.unk_token),this.unk_token=F.unk_token,this.max_input_chars_per_word=F.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[V,Y]of this.tokens_to_ids)this.vocab[Y]=V}encode(F){const V=[];for(const Y of F){const le=[...Y];if(le.length>this.max_input_chars_per_word){V.push(this.unk_token);continue}let ue=!1,Ce=0;const Ue=[];for(;Ce0&&(Ze=this.config.continuing_subword_prefix+Ze),this.tokens_to_ids.has(Ze)){Ke=Ze;break}--Qe}if(Ke===null){ue=!0;break}Ue.push(Ke),Ce=Qe}ue?V.push(this.unk_token):V.push(...Ue)}return V}}class U extends Q{constructor(F,V){super(F);const Y=F.vocab.length;this.vocab=new Array(Y),this.scores=new Array(Y);for(let le=0;le[le,ue])),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=V.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.minScore=(0,i.min)(this.scores)[0],this.unk_score=this.minScore-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new l.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(F){const V=F.chars,Y=1;let le=0;for(;le{const pe=[...Array.from({length:94},(le,ue)=>ue+33),...Array.from({length:12},(le,ue)=>ue+161),...Array.from({length:82},(le,ue)=>ue+174)],F=pe.slice();let V=0;for(let le=0;le<256;++le)pe.includes(le)||(pe.push(le),F.push(256+V),V+=1);const Y=F.map(le=>String.fromCharCode(le));return Object.fromEntries(pe.map((le,ue)=>[le,Y[ue]]))})(),H=(0,o.reverseDictionary)(Z);class J extends Q{constructor(F){super(F),this.tokens_to_ids=_(F.vocab),this.unk_token_id=this.tokens_to_ids.get(F.unk_token),this.unk_token=F.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[Y,le]of this.tokens_to_ids)this.vocab[le]=Y;const V=Array.isArray(F.merges[0]);this.merges=V?F.merges:F.merges.map(Y=>Y.split(" ",2)),this.bpe_ranks=new Map(this.merges.map((Y,le)=>[JSON.stringify(Y),le])),this.end_of_word_suffix=F.end_of_word_suffix,this.continuing_subword_suffix=F.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.cache=new Map}bpe(F){if(F.length===0)return[];const V=this.cache.get(F);if(V!==void 0)return V;const Y=Array.from(F);this.end_of_word_suffix&&(Y[Y.length-1]+=this.end_of_word_suffix);let le=[];if(Y.length>1){const ue=new l.PriorityQueue((Qe,Ke)=>Qe.score`<0x${Ue.toString(16).toUpperCase().padStart(2,"0")}>`);Ce.every(Ue=>this.tokens_to_ids.has(Ue))?V.push(...Ce):V.push(this.unk_token)}else V.push(this.unk_token)}return V}}class oe extends Q{constructor(F,V){super(F),this.tokens_to_ids=_(V.target_lang?F.vocab[V.target_lang]:F.vocab),this.bos_token=V.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=V.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=V.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=V.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[Y,le]of this.tokens_to_ids)this.vocab[le]=Y}encode(F){return F}}class ae extends s.Callable{constructor(F){super(),this.config=F}static fromConfig(F){if(F===null)return null;switch(F.type){case"BertNormalizer":return new Me(F);case"Precompiled":return new jt(F);case"Sequence":return new He(F);case"Replace":return new ce(F);case"NFC":return new N(F);case"NFD":return new O(F);case"NFKC":return new G(F);case"NFKD":return new se(F);case"Strip":return new X(F);case"StripAccents":return new we(F);case"Lowercase":return new _e(F);case"Prepend":return new ke(F);default:throw new Error(`Unknown Normalizer type: ${F.type}`)}}normalize(F){throw Error("normalize should be implemented in subclass.")}_call(F){return this.normalize(F)}}class ce extends ae{normalize(F){const V=g(this.config.pattern);return V===null?F:F.replaceAll(V,this.config.content)}}class he extends ae{constructor(){super(...arguments);re(this,"form")}normalize(V){return V=V.normalize(this.form),V}}class N extends he{constructor(){super(...arguments);re(this,"form","NFC")}}class O extends he{constructor(){super(...arguments);re(this,"form","NFD")}}class G extends he{constructor(){super(...arguments);re(this,"form","NFKC")}}class se extends he{constructor(){super(...arguments);re(this,"form","NFKD")}}class X extends ae{normalize(F){return this.config.strip_left&&this.config.strip_right?F=F.trim():(this.config.strip_left&&(F=F.trimStart()),this.config.strip_right&&(F=F.trimEnd())),F}}class we extends ae{normalize(F){return F=M(F),F}}class _e extends ae{normalize(F){return F=F.toLowerCase(),F}}class ke extends ae{normalize(F){return F=this.config.prepend+F,F}}class He extends ae{constructor(F){super(F),this.normalizers=F.normalizers.map(V=>ae.fromConfig(V))}normalize(F){return this.normalizers.reduce((V,Y)=>Y.normalize(V),F)}}class Me extends ae{_tokenize_chinese_chars(F){const V=[];for(let Y=0;Ythis.pre_tokenize_text(Y,V)):this.pre_tokenize_text(F,V)).flat()}_call(F,V){return this.pre_tokenize(F,V)}}class j extends K{constructor(F){super(),this.pattern=new RegExp(`[^\\s${w}]+|[${w}]`,"gu")}pre_tokenize_text(F,V){return F.trim().match(this.pattern)||[]}}class me extends K{constructor(F){super(),this.config=F,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=new RegExp("'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)|\\s+","gu"),this.byte_encoder=Z,this.text_encoder=new TextEncoder}pre_tokenize_text(F,V){return this.add_prefix_space&&!F.startsWith(" ")&&(F=" "+F),(this.use_regex?F.match(this.pattern)||[]:[F]).map(le=>Array.from(this.text_encoder.encode(le),ue=>this.byte_encoder[ue]).join(""))}}class Pe extends K{constructor(F){super(),this.config=F,this.pattern=g(this.config.pattern,this.config.invert)}pre_tokenize_text(F,V){var Y;return this.pattern===null?[]:this.config.invert?F.match(this.pattern)||[]:((Y=this.config.behavior)==null?void 0:Y.toLowerCase())==="removed"?F.split(this.pattern).filter(le=>le):h(F,this.pattern)}}class Te extends K{constructor(F){super(),this.config=F,this.pattern=new RegExp(`[^${w}]+|[${w}]+`,"gu")}pre_tokenize_text(F,V){return F.match(this.pattern)||[]}}class Ae extends K{constructor(F){super(),this.config=F;const V=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=new RegExp(V,"gu")}pre_tokenize_text(F,V){return F.match(this.pattern)||[]}}class Ie extends s.Callable{constructor(F){super(),this.config=F}static fromConfig(F){if(F===null)return null;switch(F.type){case"TemplateProcessing":return new We(F);case"ByteLevel":return new D(F);case"RobertaProcessing":return new Ne(F);case"BertProcessing":return new Le(F);case"Sequence":return new ee(F);default:throw new Error(`Unknown PostProcessor type: ${F.type}`)}}post_process(F,...V){throw Error("post_process should be implemented in subclass.")}_call(F,...V){return this.post_process(F,...V)}}class Le extends Ie{constructor(F){super(F),this.cls=F.cls[0],this.sep=F.sep[0]}post_process(F,V=null,{add_special_tokens:Y=!0}={}){Y&&(F=(0,o.mergeArrays)([this.cls],F,[this.sep]));let le=new Array(F.length).fill(0);if(V!==null){const ue=Y&&this instanceof Ne?[this.sep]:[],Ce=Y?[this.sep]:[];F=(0,o.mergeArrays)(F,ue,V,Ce),le=(0,o.mergeArrays)(le,new Array(V.length+ue.length+Ce.length).fill(1))}return{tokens:F,token_type_ids:le}}}class Ne extends Le{}class We extends Ie{constructor(F){super(F),this.single=F.single,this.pair=F.pair}post_process(F,V=null,{add_special_tokens:Y=!0}={}){const le=V===null?this.single:this.pair;let ue=[],Ce=[];for(const Ue of le)"SpecialToken"in Ue?Y&&(ue.push(Ue.SpecialToken.id),Ce.push(Ue.SpecialToken.type_id)):"Sequence"in Ue&&(Ue.Sequence.id==="A"?(ue=(0,o.mergeArrays)(ue,F),Ce=(0,o.mergeArrays)(Ce,new Array(F.length).fill(Ue.Sequence.type_id))):Ue.Sequence.id==="B"&&(ue=(0,o.mergeArrays)(ue,V),Ce=(0,o.mergeArrays)(Ce,new Array(V.length).fill(Ue.Sequence.type_id))));return{tokens:ue,token_type_ids:Ce}}}class D extends Ie{post_process(F,V=null){return V&&(F=(0,o.mergeArrays)(F,V)),{tokens:F}}}class ee extends Ie{constructor(F){super(F),this.processors=F.processors.map(V=>Ie.fromConfig(V))}post_process(F,V=null,Y={}){let le;for(const ue of this.processors)if(ue instanceof D)F=ue.post_process(F).tokens,V&&(V=ue.post_process(V).tokens);else{const Ce=ue.post_process(F,V,Y);F=Ce.tokens,le=Ce.token_type_ids}return{tokens:F,token_type_ids:le}}}class B extends s.Callable{constructor(F){super(),this.config=F,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=F.trim_offsets}static fromConfig(F){if(F===null)return null;switch(F.type){case"WordPiece":return new Re(F);case"Metaspace":return new nr(F);case"ByteLevel":return new Fe(F);case"Replace":return new te(F);case"ByteFallback":return new de(F);case"Fuse":return new be(F);case"Strip":return new ve(F);case"Sequence":return new qe(F);case"CTC":return new je(F);case"BPEDecoder":return new Xe(F);default:throw new Error(`Unknown Decoder type: ${F.type}`)}}_call(F){return this.decode(F)}decode(F){return this.decode_chain(F).join("")}decode_chain(F){throw Error("`decode_chain` should be implemented in subclass.")}}class te extends B{decode_chain(F){const V=g(this.config.pattern);return V===null?F:F.map(Y=>Y.replaceAll(V,this.config.content))}}class de extends B{constructor(F){super(F),this.text_decoder=new TextDecoder}decode_chain(F){const V=[];let Y=[];for(const le of F){let ue=null;if(le.length===6&&le.startsWith("<0x")&&le.endsWith(">")){const Ce=parseInt(le.slice(3,5),16);isNaN(Ce)||(ue=Ce)}if(ue!==null)Y.push(ue);else{if(Y.length>0){const Ce=this.text_decoder.decode(Uint8Array.from(Y));V.push(Ce),Y=[]}V.push(le)}}if(Y.length>0){const le=this.text_decoder.decode(Uint8Array.from(Y));V.push(le),Y=[]}return V}}class be extends B{decode_chain(F){return[F.join("")]}}class ve extends B{constructor(F){super(F),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(F){return F.map(V=>{let Y=0;for(let ue=0;ue(Y!==0&&(V.startsWith(this.config.prefix)?V=V.replace(this.config.prefix,""):V=" "+V),this.cleanup&&(V=I(V)),V))}}class Fe extends B{constructor(F){super(F),this.byte_decoder=H,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(F){const V=F.join(""),Y=new Uint8Array([...V].map(ue=>this.byte_decoder[ue]));return this.text_decoder.decode(Y)}decode_chain(F){const V=[];let Y=[];for(const le of F)this.added_tokens.find(ue=>ue.content===le)!==void 0?(Y.length>0&&(V.push(this.convert_tokens_to_string(Y)),Y=[]),V.push(le)):Y.push(le);return Y.length>0&&V.push(this.convert_tokens_to_string(Y)),V}}class je extends B{constructor(F){super(F),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(F){if(F.length===0)return"";const V=[F[0]];for(let ue=1;ueue!==this.pad_token).join("");return this.cleanup&&(le=I(le).replaceAll(this.word_delimiter_token," ").trim()),le}decode_chain(F){return[this.convert_tokens_to_string(F)]}}class qe extends B{constructor(F){super(F),this.decoders=F.decoders.map(V=>B.fromConfig(V))}decode_chain(F){return this.decoders.reduce((V,Y)=>Y.decode_chain(V),F)}}class Xe extends B{constructor(F){super(F),this.suffix=this.config.suffix}decode_chain(F){return F.map((V,Y)=>V.replaceAll(this.suffix,Y===F.length-1?"":" "))}}class ut extends B{decode_chain(F){let V="";for(let Y=1;YY.normalize("NFKC")).join("~"):F=F.normalize("NFKC"),F}}class ar extends K{constructor(F){super(),this.tokenizers=F.pretokenizers.map(V=>K.fromConfig(V))}pre_tokenize_text(F,V){return this.tokenizers.reduce((Y,le)=>le.pre_tokenize(Y,V),[F])}}class es extends K{constructor(F){super()}pre_tokenize_text(F,V){return F.match(/\w+|[^\w\s]+/g)||[]}}class ks extends K{constructor(F){super()}pre_tokenize_text(F,V){return b(F)}}class Or extends K{constructor(F){super(),this.config=F,this.pattern=g(this.config.pattern),this.content=this.config.content}pre_tokenize_text(F,V){return this.pattern===null?[F]:[F.replaceAll(this.pattern,this.config.content)]}}const ts=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function Is(pe,F,V,Y){for(const le of Object.keys(pe)){const ue=F-pe[le].length,Ce=V(le),Ue=new Array(ue).fill(Ce);pe[le]=Y==="right"?(0,o.mergeArrays)(pe[le],Ue):(0,o.mergeArrays)(Ue,pe[le])}}function Br(pe,F){for(const V of Object.keys(pe))pe[V].length=F}class dt extends s.Callable{constructor(V,Y){super();re(this,"return_token_type_ids",!1);re(this,"padding_side","right");this._tokenizer_config=Y,this.normalizer=ae.fromConfig(V.normalizer),this.pre_tokenizer=K.fromConfig(V.pre_tokenizer),this.model=Q.fromConfig(V.model,Y),this.post_processor=Ie.fromConfig(V.post_processor),this.decoder=B.fromConfig(V.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(const le of V.added_tokens){const ue=new R(le);this.added_tokens.push(ue),this.model.tokens_to_ids.set(ue.content,ue.id),this.model.vocab[ue.id]=ue.content,ue.special&&(this.special_tokens.push(ue.content),this.all_special_ids.push(ue.id))}if(this.additional_special_tokens=Y.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_splitter=new l.DictionarySplitter(this.added_tokens.map(le=>le.content)),this.added_tokens_map=new Map(this.added_tokens.map(le=>[le.content,le])),this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.bos_token=this.getToken("bos_token"),this.bos_token_id=this.model.tokens_to_ids.get(this.bos_token),this.eos_token=this.getToken("eos_token"),this.eos_token_id=this.model.tokens_to_ids.get(this.eos_token),this.model_max_length=Y.model_max_length,this.remove_space=Y.remove_space,this.clean_up_tokenization_spaces=Y.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=Y.do_lowercase_and_remove_accent??!1,Y.padding_side&&(this.padding_side=Y.padding_side),this.legacy=!1,this.chat_template=Y.chat_template??null,Array.isArray(this.chat_template)){const le=Object.create(null);for(const{name:ue,template:Ce}of this.chat_template){if(typeof ue!="string"||typeof Ce!="string")throw new Error('Chat template must be a list of objects with "name" and "template" properties');le[ue]=Ce}this.chat_template=le}this._compiled_template_cache=new Map}getToken(...V){for(const Y of V){const le=this._tokenizer_config[Y];if(le)if(typeof le=="object"){if(le.__type==="AddedToken")return le.content;throw Error(`Unknown token: ${le}`)}else return le}return null}static async from_pretrained(V,{progress_callback:Y=null,config:le=null,cache_dir:ue=null,local_files_only:Ce=!1,revision:Ue="main",legacy:Qe=null}={}){const Ke=await u(V,{progress_callback:Y,config:le,cache_dir:ue,local_files_only:Ce,revision:Ue,legacy:Qe});return new this(...Ke)}_call(V,{text_pair:Y=null,add_special_tokens:le=!0,padding:ue=!1,truncation:Ce=null,max_length:Ue=null,return_tensor:Qe=!0,return_token_type_ids:Ke=null}={}){const Ze=Array.isArray(V);let pt;if(Ze){if(V.length===0)throw Error("text array must be non-empty");if(Y!==null){if(Array.isArray(Y)){if(V.length!==Y.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");pt=V.map(($t,Ut)=>this._encode_plus($t,{text_pair:Y[Ut],add_special_tokens:le,return_token_type_ids:Ke}))}else pt=V.map($t=>this._encode_plus($t,{add_special_tokens:le,return_token_type_ids:Ke}))}else{if(V==null)throw Error("text may not be null or undefined");if(Array.isArray(Y))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");pt=[this._encode_plus(V,{text_pair:Y,add_special_tokens:le,return_token_type_ids:Ke})]}if(Ue===null?ue==="max_length"?Ue=this.model_max_length:Ue=(0,i.max)(pt.map($t=>$t.input_ids.length))[0]:Ce||console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."),Ue=Math.min(Ue,this.model_max_length??1/0),ue||Ce)for(let $t=0;$tUe?Ce&&Br(pt[$t],Ue):ue&&Is(pt[$t],Ue,Ut=>Ut==="input_ids"?this.pad_token_id:0,this.padding_side));const Ct={};if(Qe){if(!(ue&&Ce)&&pt.some(Ut=>{var At;for(const Vt of Object.keys(Ut))if(Ut[Vt].length!==((At=pt[0][Vt])==null?void 0:At.length))return!0;return!1}))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const $t=[pt.length,pt[0].input_ids.length];for(const Ut of Object.keys(pt[0]))Ct[Ut]=new a.Tensor("int64",BigInt64Array.from(pt.flatMap(At=>At[Ut]).map(BigInt)),$t)}else{for(const $t of Object.keys(pt[0]))Ct[$t]=pt.map(Ut=>Ut[$t]);if(!Ze)for(const $t of Object.keys(Ct))Ct[$t]=Ct[$t][0]}return Ct}_encode_text(V){if(V===null)return null;const Y=this.added_tokens_splitter.split(V);for(let ue=0;ue0&&(Y[ue-1]=Y[ue-1].trimEnd()),Ce.rstrip&&ue{if(ue.length===0)return[];if(this.added_tokens_map.has(ue))return[ue];if(this.remove_space===!0&&(ue=ue.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(ue=y(ue)),this.normalizer!==null&&(ue=this.normalizer(ue)),ue.length===0)return[];const Ue=this.pre_tokenizer!==null?this.pre_tokenizer(ue,{section_index:Ce}):[ue];return this.model(Ue)})}_encode_plus(V,{text_pair:Y=null,add_special_tokens:le=!0,return_token_type_ids:ue=null}={}){const{tokens:Ce,token_type_ids:Ue}=this._tokenize_helper(V,{pair:Y,add_special_tokens:le}),Qe=this.model.convert_tokens_to_ids(Ce),Ke={input_ids:Qe,attention_mask:new Array(Qe.length).fill(1)};return(ue??this.return_token_type_ids)&&Ue&&(Ke.token_type_ids=Ue),Ke}_tokenize_helper(V,{pair:Y=null,add_special_tokens:le=!1}={}){const ue=this._encode_text(V),Ce=this._encode_text(Y);return this.post_processor?this.post_processor(ue,Ce,{add_special_tokens:le}):{tokens:(0,o.mergeArrays)(ue??[],Ce??[])}}tokenize(V,{pair:Y=null,add_special_tokens:le=!1}={}){return this._tokenize_helper(V,{pair:Y,add_special_tokens:le}).tokens}encode(V,{text_pair:Y=null,add_special_tokens:le=!0,return_token_type_ids:ue=null}={}){return this._encode_plus(V,{text_pair:Y,add_special_tokens:le,return_token_type_ids:ue}).input_ids}batch_decode(V,Y={}){return V instanceof a.Tensor&&(V=V.tolist()),V.map(le=>this.decode(le,Y))}decode(V,Y={}){if(V instanceof a.Tensor&&(V=E(V)),!Array.isArray(V)||V.length===0||!(0,o.isIntegralNumber)(V[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(V,Y)}decode_single(V,{skip_special_tokens:Y=!1,clean_up_tokenization_spaces:le=null}){let ue=this.model.convert_ids_to_tokens(V);Y&&(ue=ue.filter(Ue=>!this.special_tokens.includes(Ue)));let Ce=this.decoder?this.decoder(ue):ue.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(Ce=Ce.replaceAll(this.decoder.end_of_word_suffix," "),Y&&(Ce=Ce.trim())),(le??this.clean_up_tokenization_spaces)&&(Ce=I(Ce)),Ce}get_chat_template({chat_template:V=null,tools:Y=null}={}){if(this.chat_template&&typeof this.chat_template=="object"){const le=this.chat_template;if(V!==null&&Object.hasOwn(le,V))V=le[V];else if(V===null)if(Y!==null&&"tool_use"in le)V=le.tool_use;else if("default"in le)V=le.default;else throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(le).sort()}.`)}else if(V===null)if(this.chat_template)V=this.chat_template;else throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");return V}apply_chat_template(V,{tools:Y=null,documents:le=null,chat_template:ue=null,add_generation_prompt:Ce=!1,tokenize:Ue=!0,padding:Qe=!1,truncation:Ke=!1,max_length:Ze=null,return_tensor:pt=!0,return_dict:Ct=!1,tokenizer_kwargs:$t={},...Ut}={}){if(ue=this.get_chat_template({chat_template:ue,tools:Y}),typeof ue!="string")throw Error(`chat_template must be a string, but got ${typeof ue}`);let At=this._compiled_template_cache.get(ue);At===void 0&&(At=new c.Template(ue),this._compiled_template_cache.set(ue,At));const Vt=Object.create(null);for(const fr of ts){const Qr=this.getToken(fr);Qr&&(Vt[fr]=Qr)}const br=At.render({messages:V,add_generation_prompt:Ce,tools:Y,documents:le,...Vt,...Ut});if(Ue){const fr=this._call(br,{add_special_tokens:!1,padding:Qe,truncation:Ke,max_length:Ze,return_tensor:pt,...$t});return Ct?fr:fr.input_ids}return br}}class Gr extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class Rr extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class rs extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class bs extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class vs extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class xs extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class As extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class hr extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class Be extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class et extends dt{}class ot extends dt{}class rr extends dt{constructor(V,Y){super(V,Y);re(this,"return_token_type_ids",!0);console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class zt extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class Sr extends dt{}class ss extends dt{}class ns extends dt{}class Tr extends dt{constructor(F,V){super(F,V),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter(Y=>this.languageRegex.test(Y)),this.lang_to_token=Y=>Y}_build_translation_inputs(F,V,Y){return Mr(this,F,V,Y)}}class os extends Tr{}class is extends dt{}class Kr extends dt{}const Ts="▁";class Ws extends dt{constructor(V,Y){super(V,Y);re(this,"padding_side","left");this.legacy=Y.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new wt({replacement:Ts,add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(V){if(V===null)return null;if(this.legacy||V.length===0)return super._encode_text(V);let Y=super._encode_text(Ts+V.replaceAll(Ts," "));return Y.length>1&&Y[0]===Ts&&this.special_tokens.includes(Y[1])&&(Y=Y.slice(1)),Y}}class Gs extends dt{}class Ks extends dt{}class Hs extends dt{}class as extends dt{}class qs extends dt{}class Qs extends dt{}class Xs extends dt{}class Dr extends dt{}class Es extends dt{}function Mr(pe,F,V,Y){if(!("language_codes"in pe)||!Array.isArray(pe.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in pe)||!(pe.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in pe)||typeof pe.lang_to_token!="function")throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const le=Y.src_lang,ue=Y.tgt_lang;if(!pe.language_codes.includes(ue))throw new Error(`Target language code "${ue}" is not valid. Must be one of: {${pe.language_codes.join(", ")}}`);if(le!==void 0){if(!pe.language_codes.includes(le))throw new Error(`Source language code "${le}" is not valid. Must be one of: {${pe.language_codes.join(", ")}}`);for(const Ce of pe.post_processor.config.single)if("SpecialToken"in Ce&&pe.languageRegex.test(Ce.SpecialToken.id)){Ce.SpecialToken.id=pe.lang_to_token(le);break}}return Y.forced_bos_token_id=pe.model.convert_tokens_to_ids([pe.lang_to_token(ue)])[0],pe._call(F,V)}class Fs extends dt{constructor(F,V){super(F,V),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(Y=>this.languageRegex.test(Y)),this.lang_to_token=Y=>Y}_build_translation_inputs(F,V,Y){return Mr(this,F,V,Y)}}class Os extends dt{constructor(F,V){super(F,V),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter(Y=>this.languageRegex.test(Y)).map(Y=>Y.slice(2,-2)),this.lang_to_token=Y=>`__${Y}__`}_build_translation_inputs(F,V,Y){return Mr(this,F,V,Y)}}class $r extends dt{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(F,{return_timestamps:V=!1,return_language:Y=!1,time_precision:le=null,force_full_sequences:ue=!0}={}){if(le===null)throw Error("Must specify time_precision");let Ce=null;const Ue=V==="word";function Qe(){return{language:Ce,timestamp:[null,null],text:""}}const Ke=[];let Ze=Qe(),pt=0;const Ct=this.timestamp_begin,Ut=Ct+1500;let At=[],Vt=[],br=!1,fr=null;const Qr=new Set(this.all_special_ids);for(const Wt of F){const Yt=Wt.tokens,_r=Ue?Wt.token_timestamps:null;let Xr=null,ds=Ct;if("stride"in Wt){const[Rt,Xt,qt]=Wt.stride;if(pt-=Xt,fr=Rt-qt,Xt&&(ds=Xt/le+Ct),qt)for(let Zt=Yt.length-1;Zt>=0;--Zt){const or=Number(Yt[Zt]);if(or>=Ct){if(Xr!==null&&(or-Ct)*le=Ct&&Xt<=Ut){const qt=(Xt-Ct)*le+pt,Zt=(0,i.round)(qt,2);if(Xr!==null&&Xt>=Xr)br=!0;else if(br||At.length>0&&Xt0?(At.push(Ht),Ue&&Vt.push(dr)):At.every(Rt=>Rt.length===0)&&(Ze=Qe(),At=[],Ht=[],Vt=[],dr=[])}if(At.length>0){if(ue&&V)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[Wt,Yt]=this.findLongestCommonSequence(At,Vt),_r=this.decode(Wt);Ze.text=_r,Ue&&(Ze.words=this.collateWordTimestamps(Wt,Yt,Ce)),Ke.push(Ze)}let vr=Object.create(null);const ls=Ke.map(Wt=>Wt.text).join("");if(V||Y){for(let Wt=0;Wt0;let Ue=Ce?[]:null,Qe=Ce?V[0]:null;for(let Ke=1;KeXt===ds[qt]&&Qe[ls+qt]<=V[Ke][_r+qt]).length:Ht=Yt.filter((Xt,qt)=>Xt===ds[qt]).length;const dr=vr/1e4,Rt=Ht/vr+dr;Ht>1&&Rt>pt&&(pt=Rt,Ct=[ls,Wt,_r,Xr])}const[Ut,At,Vt,br]=Ct,fr=Math.floor((At+Ut)/2),Qr=Math.floor((br+Vt)/2);ue.push(...Y.slice(0,fr)),Y=Ze.slice(Qr),le=Y.length,Ce&&(Ue.push(...Qe.slice(0,fr)),Qe=V[Ke].slice(Qr))}return ue.push(...Y),Ce?(Ue.push(...Qe),[ue,Ue]):[ue,[]]}collateWordTimestamps(F,V,Y){const[le,ue,Ce]=this.combineTokensIntoWords(F,Y),Ue=[];for(let Qe=0;Qe=le){const Ue=((Ce-le)*Y).toFixed(2);ue.push(`<|${Ue}|>`),ue.push([])}else ue[ue.length-1].push(Ce);return ue=ue.map(Ce=>typeof Ce=="string"?Ce:super.decode(Ce,V)),ue.join("")}splitTokensOnUnicode(F){const V=this.decode(F,{decode_with_timestamps:!0}),Y="�",le=[],ue=[],Ce=[];let Ue=[],Qe=[],Ke=0;for(let Ze=0;Ze=this.model.tokens_to_ids.get("<|endoftext|>"),Ut=Ze.startsWith(" "),At=Ze.trim(),Vt=Qe.test(At);if($t||Ut||Vt||ue.length===0)ue.push(Ze),Ce.push(pt),Ue.push(Ct);else{const br=ue.length-1;ue[br]+=Ze,Ce[br].push(...pt),Ue[br].push(...Ct)}}return[ue,Ce,Ue]}mergePunctuations(F,V,Y,le,ue){const Ce=structuredClone(F),Ue=structuredClone(V),Qe=structuredClone(Y);let Ke=Ce.length-2,Ze=Ce.length-1;for(;Ke>=0;)Ce[Ke].startsWith(" ")&&le.includes(Ce[Ke].trim())?(Ce[Ze]=Ce[Ke]+Ce[Ze],Ue[Ze]=(0,o.mergeArrays)(Ue[Ke],Ue[Ze]),Qe[Ze]=(0,o.mergeArrays)(Qe[Ke],Qe[Ze]),Ce[Ke]="",Ue[Ke]=[],Qe[Ke]=[]):Ze=Ke,--Ke;for(Ke=0,Ze=1;Zept),Ue.filter(pt=>pt.length>0),Qe.filter(pt=>pt.length>0)]}}class Hr extends dt{}class un extends dt{}class Lr extends dt{}class pn extends dt{constructor(F,V){super(F,V),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(Y=>this.languageRegex.test(Y)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(F){if(F===null)return null;const[V,...Y]=F.trim().split(this.languageRegex);if(Y.length===0)return super._encode_text(V);if(Y.length===2){const[le,ue]=Y;return this.supported_language_codes.includes(le)||console.warn(`Unsupported language code "${le}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,o.mergeArrays)([le],super._encode_text(ue))}}}class Ds extends dt{}class kr extends dt{}class qr extends dt{}class lr extends dt{}class mr extends dt{}class Ls extends dt{constructor(F,V){super(F,V),this.decoder=new ut({})}}class hn extends dt{}class Ps extends dt{}class mn{static async from_pretrained(F,{progress_callback:V=null,config:Y=null,cache_dir:le=null,local_files_only:ue=!1,revision:Ce="main",legacy:Ue=null}={}){var Ct;const[Qe,Ke]=await u(F,{progress_callback:V,config:Y,cache_dir:le,local_files_only:ue,revision:Ce,legacy:Ue}),Ze=((Ct=Ke.tokenizer_class)==null?void 0:Ct.replace(/Fast$/,""))??"PreTrainedTokenizer";let pt=this.TOKENIZER_CLASS_MAPPING[Ze];return pt||(console.warn(`Unknown tokenizer class "${Ze}", attempting to construct from base class.`),pt=dt),new pt(Qe,Ke)}}re(mn,"TOKENIZER_CLASS_MAPPING",{T5Tokenizer:Sr,DistilBertTokenizer:et,CamembertTokenizer:ot,DebertaTokenizer:vs,DebertaV2Tokenizer:xs,BertTokenizer:Gr,HerbertTokenizer:As,ConvBertTokenizer:hr,RoFormerTokenizer:Be,XLMTokenizer:rr,ElectraTokenizer:zt,MobileBertTokenizer:rs,SqueezeBertTokenizer:bs,AlbertTokenizer:Rr,GPT2Tokenizer:ss,BartTokenizer:ns,MBartTokenizer:Tr,MBart50Tokenizer:os,RobertaTokenizer:is,WhisperTokenizer:$r,CodeGenTokenizer:Hr,CLIPTokenizer:un,SiglipTokenizer:Lr,MarianTokenizer:pn,BloomTokenizer:Kr,NllbTokenizer:Fs,M2M100Tokenizer:Os,LlamaTokenizer:Ws,CodeLlamaTokenizer:Gs,XLMRobertaTokenizer:Ks,MPNetTokenizer:Hs,FalconTokenizer:as,GPTNeoXTokenizer:qs,EsmTokenizer:Qs,Wav2Vec2CTCTokenizer:Ds,BlenderbotTokenizer:kr,BlenderbotSmallTokenizer:qr,SpeechT5Tokenizer:lr,NougatTokenizer:mr,VitsTokenizer:Ls,Qwen2Tokenizer:Xs,GemmaTokenizer:Dr,Grok1Tokenizer:Es,CohereTokenizer:hn,MgpstrTokenizer:Ps,PreTrainedTokenizer:dt})},"./src/utils/audio.js":(e,r,t)=>{t.r(r),t.d(r,{RawAudio:()=>q,hamming:()=>h,hanning:()=>u,mel_filter_bank:()=>$,read_audio:()=>c,spectrogram:()=>k,window_function:()=>z});var s=t("./src/utils/hub.js"),o=t("./src/utils/maths.js"),n=t("./src/utils/core.js"),i=t("./src/env.js"),a=t("?7a2c"),l=t("./src/utils/tensor.js");async function c(U,Z){if(typeof AudioContext>"u")throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const H=await(await(0,s.getFile)(U)).arrayBuffer(),J=new AudioContext({sampleRate:Z});typeof Z>"u"&&console.warn(`No sampling rate provided, using default of ${J.sampleRate}Hz.`);const oe=await J.decodeAudioData(H);let ae;if(oe.numberOfChannels===2){const ce=Math.sqrt(2),he=oe.getChannelData(0),N=oe.getChannelData(1);ae=new Float32Array(he.length);for(let O=0;O2595*Math.log10(1+U/700),kaldi:U=>1127*Math.log(1+U/700),slaney:(U,Z=1e3,H=15,J=27/Math.log(6.4))=>U>=Z?H+Math.log(U/Z)*J:3*U/200};function _(U,Z="htk"){const H=g[Z];if(!H)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof U=="number"?H(U):U.map(J=>H(J))}const E={htk:U=>700*(10**(U/2595)-1),kaldi:U=>700*(Math.exp(U/1127)-1),slaney:(U,Z=1e3,H=15,J=Math.log(6.4)/27)=>U>=H?Z*Math.exp(J*(U-H)):200*U/3};function I(U,Z="htk"){const H=E[Z];if(!H)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof U=="number"?H(U):U.map(J=>H(J))}function M(U,Z){const H=Float64Array.from({length:Z.length-1},(ce,he)=>Z[he+1]-Z[he]),J=Array.from({length:U.length},()=>new Array(Z.length));for(let ce=0;cenew Array(U.length));for(let ce=0;ceU+J*ae)}function $(U,Z,H,J,oe,ae=null,ce="htk",he=!1){if(ae!==null&&ae!=="slaney")throw new Error('norm must be one of null or "slaney"');const N=_(H,ce),O=_(J,ce),G=y(N,O,Z+2);let se=I(G,ce),X;if(he){const _e=oe/(U*2);X=_(Float64Array.from({length:U},(ke,He)=>He*_e),ce),se=G}else X=y(0,Math.floor(oe/2),U);const we=M(X,se);if(ae!==null&&ae==="slaney")for(let _e=0;_eoe)throw Error(`frame_length (${H}) may not be larger than fft_length (${oe})`);if(Pe!==H)throw new Error(`Length of the window (${Pe}) must equal frame_length (${H})`);if(J<=0)throw new Error("hop_length must be greater than zero");if(ae===null&&G!==null)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(ce){if(he!=="reflect")throw new Error(`pad_mode="${he}" not implemented yet.`);const be=Math.floor((oe-1)/2)+1;U=P(U,be,be)}let Te=Math.floor(1+Math.floor((U.length-H)/J));Me!==null&&TeTe?j&&(Le=K):Le=Ie=K);const Ne=new o.FFT(oe),We=new Float64Array(oe),D=new Float64Array(Ne.outputBufferSize),ee=new Float32Array(Ae*Le);for(let be=0;be=1;--Fe)We[Fe]-=O*We[Fe-1];We[0]*=1-O}for(let Fe=0;FeMath.pow(he,.85));break;default:throw new Error(`Unknown window type ${Z}.`)}if(H&&(ce=ce.subarray(0,U)),J===null)return ce;if(U>J)throw new Error(`Length of the window (${U}) may not be larger than frame_length (${J})`);return ce}function R(U,Z){let H=44;const J=new ArrayBuffer(H+U.length*4),oe=new DataView(J);Q(oe,0,"RIFF"),oe.setUint32(4,36+U.length*4,!0),Q(oe,8,"WAVE"),Q(oe,12,"fmt "),oe.setUint32(16,16,!0),oe.setUint16(20,3,!0),oe.setUint16(22,1,!0),oe.setUint32(24,Z,!0),oe.setUint32(28,Z*4,!0),oe.setUint16(32,4,!0),oe.setUint16(34,32,!0),Q(oe,36,"data"),oe.setUint32(40,U.length*4,!0);for(let ae=0;ae{let ae=await oe.arrayBuffer();a.writeFileSync(J,Buffer.from(ae))};else throw new Error("Unable to save because filesystem is disabled in this environment.");await H(Z,this.toBlob())}}},"./src/utils/constants.js":(e,r,t)=>{t.r(r),t.d(r,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>o,FEATURE_EXTRACTOR_NAME:()=>n,GENERATION_CONFIG_NAME:()=>c,GITHUB_ISSUE_URL:()=>s,IMAGE_PROCESSOR_NAME:()=>i,PROCESSOR_NAME:()=>a});const s="https://github.com/huggingface/transformers.js/issues/new/choose",o="config.json",n="preprocessor_config.json",i=n,a="processor_config.json",l="chat_template.json",c="generation_config.json"},"./src/utils/core.js":(e,r,t)=>{t.r(r),t.d(r,{calculateDimensions:()=>c,calculateReflectOffset:()=>g,count:()=>M,dispatchCallback:()=>s,escapeRegExp:()=>n,isIntegralNumber:()=>a,isNullishDimension:()=>l,isTypedArray:()=>i,len:()=>I,mergeArrays:()=>u,pick:()=>E,pop:()=>p,product:()=>h,reverseDictionary:()=>o,saveBlob:()=>_});function s(y,$){y&&y($)}function o(y){return Object.fromEntries(Object.entries(y).map(([$,P])=>[P,$]))}function n(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i(y){var $,P,b;return((b=(P=($=y==null?void 0:y.prototype)==null?void 0:$.__proto__)==null?void 0:P.constructor)==null?void 0:b.name)==="TypedArray"}function a(y){return Number.isInteger(y)||typeof y=="bigint"}function l(y){return y==null||y===-1}function c(y){const $=[];let P=y;for(;Array.isArray(P);)$.push(P.length),P=P[0];return $}function p(y,$,P=void 0){const b=y[$];if(b!==void 0)return delete y[$],b;if(P===void 0)throw Error(`Key ${$} does not exist in object.`);return P}function u(...y){return Array.prototype.concat.apply([],y)}function h(...y){return y.reduce(($,P)=>$.flatMap(b=>P.map(w=>[b,w])))}function g(y,$){return Math.abs((y+$)%(2*$)-$)}function _(y,$){const P=URL.createObjectURL($),b=document.createElement("a");b.href=P,b.download=y,b.click(),b.remove(),URL.revokeObjectURL(P)}function E(y,$){return Object.assign({},...$.map(P=>{if(y[P]!==void 0)return{[P]:y[P]}}))}function I(y){let $=0;for(const P of y)++$;return $}function M(y,$){let P=0;for(const b of y)b===$&&++P;return P}},"./src/utils/data-structures.js":(e,r,t)=>{t.r(r),t.d(r,{CharTrie:()=>o,DictionarySplitter:()=>l,PriorityQueue:()=>s,TokenLattice:()=>i});class s{constructor(p=(h,g)=>h>g,u=1/0){this._heap=[],this._comparator=p,this._maxSize=u}get size(){return this._heap.length}isEmpty(){return this.size===0}peek(){return this._heap[0]}push(...p){return this.extend(p)}extend(p){for(const u of p)if(this.size0&&this._swap(0,u),this._heap.pop(),this._siftDown(),p}replace(p){const u=this.peek();return this._heap[0]=p,this._siftDown(),u}_parent(p){return(p+1>>>1)-1}_left(p){return(p<<1)+1}_right(p){return p+1<<1}_greater(p,u){return this._comparator(this._heap[p],this._heap[u])}_swap(p,u){const h=this._heap[p];this._heap[p]=this._heap[u],this._heap[u]=h}_siftUp(){this._siftUpFrom(this.size-1)}_siftUpFrom(p){for(;p>0&&this._greater(p,this._parent(p));)this._swap(p,this._parent(p)),p=this._parent(p)}_siftDown(){let p=0;for(;this._left(p)[]),this.endNodes=Array.from({length:this.len+1},()=>[]);const g=new a(this.bosTokenId,0,0,0,0),_=new a(this.eosTokenId,1,this.len,0,0);this.nodes.push(g.clone()),this.nodes.push(_.clone()),this.beginNodes[this.len].push(_),this.endNodes[0].push(g)}insert(p,u,h,g){const _=this.nodes.length,E=new a(g,_,p,u,h);this.beginNodes[p].push(E),this.endNodes[p+u].push(E),this.nodes.push(E)}viterbi(){const p=this.len;let u=0;for(;u<=p;){if(this.beginNodes[u].length==0)return[];for(let I of this.beginNodes[u]){I.prev=null;let M=0,y=null;for(let $ of this.endNodes[u]){const P=$.backtraceScore+I.score;(y===null||P>M)&&(y=$.clone(),M=P)}if(y!==null)I.prev=y,I.backtraceScore=M;else return[]}++u}const h=[],_=this.beginNodes[p][0].prev;if(_===null)return[];let E=_.clone();for(;E.prev!==null;)h.push(E.clone()),E=E.clone().prev.clone();return h.reverse(),h}piece(p){return this.chars.slice(p.pos,p.pos+p.length).join("")}tokens(){return this.viterbi().map(u=>this.piece(u))}tokenIds(){return this.viterbi().map(u=>u.tokenId)}}class a{constructor(p,u,h,g,_){this.tokenId=p,this.nodeId=u,this.pos=h,this.length=g,this.score=_,this.prev=null,this.backtraceScore=0}clone(){const p=new a(this.tokenId,this.nodeId,this.pos,this.length,this.score);return p.prev=this.prev,p.backtraceScore=this.backtraceScore,p}}class l{constructor(p){this.trie=this._buildTrie(p)}_buildTrie(p){var h;const u=Object.create(null);for(const g of p){let _=u;for(let E=0;Eg&&u.push(p.slice(g,_)),u.push(I),_+=I.length,g=_):++_}return g{t.r(r),t.d(r,{DEVICE_TYPES:()=>s});const s=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"})},"./src/utils/dtypes.js":(e,r,t)=>{t.r(r),t.d(r,{DATA_TYPES:()=>i,DEFAULT_DEVICE_DTYPE_MAPPING:()=>a,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>n});var s=t("./src/env.js"),o=t("./src/utils/devices.js");const n=function(){let c;return async function(){if(c===void 0)if(!s.apis.IS_WEBGPU_AVAILABLE)c=!1;else try{c=(await navigator.gpu.requestAdapter()).features.has("shader-f16")}catch{c=!1}return c}}(),i=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16"}),a=Object.freeze({[o.DEVICE_TYPES.wasm]:i.q8}),l=Object.freeze({[i.fp32]:"",[i.fp16]:"_fp16",[i.int8]:"_int8",[i.uint8]:"_uint8",[i.q8]:"_quantized",[i.q4]:"_q4",[i.q4f16]:"_q4f16",[i.bnb4]:"_bnb4"})},"./src/utils/generic.js":(e,r,t)=>{t.r(r),t.d(r,{Callable:()=>s});const s=class{constructor(){let o=function(...n){return o._call(...n)};return Object.setPrototypeOf(o,new.target.prototype)}_call(...o){throw Error("Must implement _call method in subclass")}}},"./src/utils/hub.js":(e,r,t)=>{t.r(r),t.d(r,{MAX_EXTERNAL_DATA_CHUNKS:()=>a,getFile:()=>g,getModelFile:()=>y,getModelJSON:()=>$});var s=t("?7a2c"),o=t("?a42a"),n=t("./src/env.js"),i=t("./src/utils/core.js");const a=100,l={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};class c{constructor(T){if(this.filePath=T,this.headers=new Headers,this.exists=s.existsSync(T),this.exists){this.status=200,this.statusText="OK";let k=s.statSync(T);this.headers.set("content-length",k.size.toString()),this.updateContentType();const z=s.createReadStream(T);this.body=new ReadableStream({start(R){z.on("data",Q=>R.enqueue(Q)),z.on("end",()=>R.close()),z.on("error",Q=>R.error(Q))},cancel(){z.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const T=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",l[T]??"application/octet-stream")}clone(){let T=new c(this.filePath);return T.exists=this.exists,T.status=this.status,T.statusText=this.statusText,T.headers=new Headers(this.headers),T}async arrayBuffer(){return(await s.promises.readFile(this.filePath)).buffer}async blob(){const T=await s.promises.readFile(this.filePath);return new Blob([T],{type:this.headers.get("content-type")})}async text(){return await s.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function p(w,T=null,k=null){let z;try{z=new URL(w)}catch{return!1}return!(T&&!T.includes(z.protocol)||k&&!k.includes(z.hostname))}const u=/^(\b[\w\-.]+\b\/)?\b[\w\-.]{1,96}\b$/;function h(w){return!(!u.test(w)||w.includes("..")||w.includes("--")||w.endsWith(".git")||w.endsWith(".ipynb"))}async function g(w){var T;if(n.env.useFS&&!p(w,["http:","https:","blob:"]))return new c(w.toString());if(typeof process<"u"&&((T=process==null?void 0:process.release)==null?void 0:T.name)==="node"){const k=!!(Vs!=null&&Vs.TESTING_REMOTELY),z=n.env.version,R=new Headers;if(R.set("User-Agent",`transformers.js/${z}; is_ci/${k};`),p(w,["http:","https:"],["huggingface.co","hf.co"])){const q=(Vs==null?void 0:Vs.HF_TOKEN)??(Vs==null?void 0:Vs.HF_ACCESS_TOKEN);q&&R.set("Authorization",`Bearer ${q}`)}return fetch(w,{headers:R})}else return fetch(w)}const _={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};function E(w,T,k){if(!k)return null;const z=_[w]??`Error (${w}) occurred while trying to load file`;throw Error(`${z}: "${T}".`)}class I{constructor(T){this.path=T}async match(T){let k=o.join(this.path,T),z=new c(k);if(z.exists)return z}async put(T,k,z=void 0){let R=o.join(this.path,T);try{const Q=k.headers.get("Content-Length"),q=parseInt(Q??"0");let U=0;await s.promises.mkdir(o.dirname(R),{recursive:!0});const Z=s.createWriteStream(R),H=k.body.getReader();for(;;){const{done:J,value:oe}=await H.read();if(J)break;await new Promise((ce,he)=>{Z.write(oe,N=>{if(N){he(N);return}ce()})}),U+=oe.length;const ae=q?U/q*100:0;z==null||z({progress:ae,loaded:U,total:q})}Z.close()}catch(Q){try{await s.promises.unlink(R)}catch{}throw Q}}}async function M(w,...T){for(let k of T)try{let z=await w.match(k);if(z)return z}catch{continue}}async function y(w,T,k=!0,z={},R=!1){if(!n.env.allowLocalModels){if(z.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!n.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}(0,i.dispatchCallback)(z.progress_callback,{status:"initiate",name:w,file:T});let Q;if(!Q&&n.env.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");try{Q=await caches.open("transformers-cache")}catch(se){console.warn("An error occurred while opening the browser cache:",se)}}if(!Q&&n.env.useFSCache&&(Q=new I(z.cache_dir??n.env.cacheDir)),!Q&&n.env.useCustomCache){if(!n.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!n.env.customCache.match||!n.env.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");Q=n.env.customCache}const q=z.revision??"main",U=b(w,T),Z=h(w),H=Z?b(n.env.localModelPath,U):U,J=b(n.env.remoteHost,n.env.remotePathTemplate.replaceAll("{model}",w).replaceAll("{revision}",encodeURIComponent(q)),T);let oe;const ae=Q instanceof I?q==="main"?U:b(w,q,T):J;let ce=!1,he;Q&&(he=await M(Q,H,ae));const N=he!==void 0;if(he===void 0){if(n.env.allowLocalModels)if(p(U,["http:","https:"])){if(z.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${U}.`);if(!n.env.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${U}.`)}else try{he=await g(H),oe=H}catch(X){console.warn(`Unable to load from local path "${H}": "${X}"`)}if(he===void 0||he.status===404){if(z.local_files_only||!n.env.allowRemoteModels){if(k)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${H}".`);return null}if(!Z)throw Error(`Local file missing at "${H}" and download aborted due to invalid model ID "${w}".`);if(he=await g(J),he.status!==200)return E(he.status,J,k);oe=ae}ce=Q&&typeof Response<"u"&&he instanceof Response&&he.status===200}(0,i.dispatchCallback)(z.progress_callback,{status:"download",name:w,file:T});let O;if(!(n.apis.IS_NODE_ENV&&R)){let se;z.progress_callback?N&&typeof navigator<"u"&&/firefox/i.test(navigator.userAgent)?(se=new Uint8Array(await he.arrayBuffer()),(0,i.dispatchCallback)(z.progress_callback,{status:"progress",name:w,file:T,progress:100,loaded:se.length,total:se.length})):se=await P(he,X=>{(0,i.dispatchCallback)(z.progress_callback,{status:"progress",name:w,file:T,...X})}):se=new Uint8Array(await he.arrayBuffer()),O=se}if(ce&&oe&&await Q.match(oe)===void 0&&(O?await Q.put(oe,new Response(O,{headers:he.headers})).catch(se=>{console.warn(`Unable to add response to browser cache: ${se}.`)}):await Q.put(oe,he,z.progress_callback)),(0,i.dispatchCallback)(z.progress_callback,{status:"done",name:w,file:T}),O){if(R)throw new Error("Cannot return path in a browser environment.");return O}if(he instanceof c)return he.filePath;const G=await Q.match(oe);if(G instanceof c)return G.filePath;throw new Error("Unable to return path for response.")}async function $(w,T,k=!0,z={}){const R=await y(w,T,k,z,!1);if(R===null)return{};const q=new TextDecoder("utf-8").decode(R);return JSON.parse(q)}async function P(w,T){const k=w.headers.get("Content-Length");k===null&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let z=parseInt(k??"0"),R=new Uint8Array(z),Q=0;const q=w.body.getReader();async function U(){const{done:Z,value:H}=await q.read();if(Z)return;const J=Q+H.length;if(J>z){z=J;const ae=new Uint8Array(z);ae.set(R),R=ae}R.set(H,Q),Q=J;const oe=Q/z*100;return T({progress:oe,loaded:Q,total:z}),U()}return await U(),R}function b(...w){return w=w.map((T,k)=>(k&&(T=T.replace(new RegExp("^/"),"")),k!==w.length-1&&(T=T.replace(new RegExp("/$"),"")),T)),w.join("/")}},"./src/utils/image.js":(e,r,t)=>{t.r(r),t.d(r,{RawImage:()=>_,load_image:()=>E});var s=t("./src/utils/core.js"),o=t("./src/utils/hub.js"),n=t("./src/env.js"),i=t("./src/utils/tensor.js"),a=t("?2b25");let l,c,p;const u=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV;if(u)l=(I,M)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(I,M)},p=self.createImageBitmap,c=self.ImageData;else if(a)p=async I=>{const y=(await I.metadata()).channels,{data:$,info:P}=await I.rotate().raw().toBuffer({resolveWithObject:!0}),b=new _(new Uint8ClampedArray($),P.width,P.height,P.channels);return y!==void 0&&y!==P.channels&&b.convert(y),b};else throw new Error("Unable to load image processing library.");const h={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},g=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class _{constructor(M,y,$,P){this.data=M,this.width=y,this.height=$,this.channels=P}get size(){return[this.width,this.height]}static async read(M){if(M instanceof _)return M;if(typeof M=="string"||M instanceof URL)return await this.fromURL(M);if(M instanceof Blob)return await this.fromBlob(M);if(typeof HTMLCanvasElement<"u"&&M instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&M instanceof OffscreenCanvas)return this.fromCanvas(M);throw new Error(`Unsupported input type: ${typeof M}`)}static fromCanvas(M){if(!u)throw new Error("fromCanvas() is only supported in browser environments.");const $=M.getContext("2d").getImageData(0,0,M.width,M.height).data;return new _($,M.width,M.height,4)}static async fromURL(M){const y=await(0,o.getFile)(M);if(y.status!==200)throw new Error(`Unable to read image from "${M}" (${y.status} ${y.statusText})`);const $=await y.blob();return this.fromBlob($)}static async fromBlob(M){if(u){const y=await p(M),$=l(y.width,y.height).getContext("2d");return $.drawImage(y,0,0),new this($.getImageData(0,0,y.width,y.height).data,y.width,y.height,4)}else{const y=a(await M.arrayBuffer());return await p(y)}}static fromTensor(M,y="CHW"){if(M.dims.length!==3)throw new Error(`Tensor should have 3 dimensions, but has ${M.dims.length} dimensions.`);if(y==="CHW")M=M.transpose(1,2,0);else if(y!=="HWC")throw new Error(`Unsupported channel format: ${y}`);if(!(M.data instanceof Uint8ClampedArray||M.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${M.type}`);switch(M.dims[2]){case 1:case 2:case 3:case 4:return new _(M.data,M.dims[1],M.dims[0],M.dims[2]);default:throw new Error(`Unsupported number of channels: ${M.dims[2]}`)}}grayscale(){if(this.channels===1)return this;const M=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let y=0,$=0;y=0?k=$:R=-$,P>=0?z=P:Q=-P,T.drawImage(w,k,z,M,y,R,Q,M,y),new _(T.getImageData(0,0,M,y).data,M,y,4).convert(b)}else{let b=this.toSharp();if($>=0&&P>=0)b=b.extract({left:Math.floor($),top:Math.floor(P),width:M,height:y});else if($<=0&&P<=0){const w=Math.floor(-P),T=Math.floor(-$);b=b.extend({top:w,left:T,right:M-this.width-T,bottom:y-this.height-w})}else{let w=[0,0],T=0;P<0?(w[0]=Math.floor(-P),w[1]=y-this.height-w[0]):T=Math.floor(P);let k=[0,0],z=0;$<0?(k[0]=Math.floor(-$),k[1]=M-this.width-k[0]):z=Math.floor($),b=b.extend({top:w[0],bottom:w[1],left:k[0],right:k[1]}).extract({left:z,top:T,width:M,height:y})}return await p(b)}}async toBlob(M="image/png",y=1){if(!u)throw new Error("toBlob() is only supported in browser environments.");return await this.toCanvas().convertToBlob({type:M,quality:y})}toTensor(M="CHW"){let y=new i.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if(M!=="HWC")if(M==="CHW")y=y.permute(2,0,1);else throw new Error(`Unsupported channel format: ${M}`);return y}toCanvas(){if(!u)throw new Error("toCanvas() is only supported in browser environments.");const M=this.clone().rgba(),y=l(M.width,M.height),$=new c(M.data,M.width,M.height);return y.getContext("2d").putImageData($,0,0),y}split(){const{data:M,width:y,height:$,channels:P}=this,b=M.constructor,w=M.length/P,T=Array.from({length:P},()=>new b(w));for(let k=0;knew _(k,y,$,1))}_update(M,y,$,P=null){return this.data=M,this.width=y,this.height=$,P!==null&&(this.channels=P),this}clone(){return new _(this.data.slice(),this.width,this.height,this.channels)}convert(M){if(this.channels===M)return this;switch(M){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(M){if(u){if(n.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const y=M.split(".").pop().toLowerCase(),$=g.get(y)??"image/png",P=await this.toBlob($);(0,s.saveBlob)(M,P)}else{if(n.apis.IS_FS_AVAILABLE)return await this.toSharp().toFile(M);throw new Error("Unable to save the image because filesystem is disabled in this environment.")}}toSharp(){if(u)throw new Error("toSharp() is only supported in server-side environments.");return a(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}const E=_.read.bind(_)},"./src/utils/maths.js":(e,r,t)=>{t.r(r),t.d(r,{FFT:()=>E,bankers_round:()=>y,cos_sim:()=>l,dot:()=>a,dynamic_time_warping:()=>$,interpolate_data:()=>s,log_softmax:()=>i,magnitude:()=>c,max:()=>u,medianFilter:()=>I,min:()=>p,permute_data:()=>o,round:()=>M,softmax:()=>n});function s(P,[b,w,T],[k,z],R="bilinear",Q=!1){const q=z/T,U=k/w,Z=new P.constructor(k*z*b),H=w*T,J=k*z;for(let oe=0;oe=0;--Q)k[Q]=q,T[Q]=b[w[Q]],q*=T[Q];const z=w.map((Q,q)=>k[w.indexOf(q)]),R=new P.constructor(P.length);for(let Q=0;Q=0;--U)q+=Z%b[U]*z[U],Z=Math.floor(Z/b[U]);R[q]=P[Q]}return[R,T]}function n(P){const b=u(P)[0],w=P.map(z=>Math.exp(z-b)),T=w.reduce((z,R)=>z+R,0);return w.map(z=>z/T)}function i(P){const b=u(P)[0];let w=0;for(let z=0;zz-b-T)}function a(P,b){let w=0;for(let T=0;Tb+w*w,0))}function p(P){if(P.length===0)throw Error("Array must not be empty");let b=P[0],w=0;for(let T=1;Tb&&(b=P[T],w=T);return[b,w]}function h(P){return P>0&&(P&P-1)===0}class g{constructor(b){if(this.size=b|0,this.size<=1||!h(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=b<<1,this.table=new Float64Array(this.size*2);for(let T=0;TT;T<<=1)++w;this._width=w%2===0?w-1:w,this._bitrev=new Int32Array(1<>>k&3)<>>1);for(let k=0;k>>1]=b[k];return T}toComplexArray(b,w){const T=w||this.createComplexArray();for(let k=0;k>>1],T[k+1]=0;return T}transform(b,w){if(b===w)throw new Error("Input and output buffers must be different");this._transform4(b,w,1)}realTransform(b,w){if(b===w)throw new Error("Input and output buffers must be different");this._realTransform4(b,w,1)}inverseTransform(b,w){if(b===w)throw new Error("Input and output buffers must be different");this._transform4(b,w,-1);for(let T=0;T>=2;R>=2;R>>=2){Q=k/R<<1;const J=Q>>>2;for(q=0;q>>1,R>>>1)}else for(q=0,U=0;q>>1,R>>>1,T)}const H=this.table;for(R>>=2;R>=2;R>>=2){Q=k/R<<1;const oe=Q>>>1,ae=oe>>>1,ce=ae>>>1;for(q=0;q>>1;for(let oe=2;oe>1;++Z){const H=(Z+1-b)**2/2,J=Math.sqrt(q**2+U**2)**H,oe=H*Math.atan2(U,q),ae=2*Z;z[ae]=J*Math.cos(oe),z[ae+1]=J*Math.sin(oe),R[ae]=z[ae],R[ae+1]=-z[ae+1]}this._slicedChirpBuffer=z.subarray(w,T),this._f=new g(k>>1),this._f.transform(this._chirpBuffer,R)}_transform(b,w,T){const k=this._buffer1,z=this._buffer2,R=this._outBuffer1,Q=this._outBuffer2,q=this._chirpBuffer,U=this._slicedChirpBuffer,Z=this._a;if(T)for(let H=0;H>1,ae=w[oe];k[H]=ae*U[H],k[J]=ae*U[J]}else for(let H=0;H=P.length&&(q=2*(P.length-1)-q),T[R++]=P[q]}T.sort(),w[z]=T[k]}return w}function M(P,b){const w=Math.pow(10,b);return Math.round(P*w)/w}function y(P){const b=Math.round(P);return Math.abs(P)%1===.5?b%2===0?b:b-1:b}function $(P){const b=P.length,w=P[0].length,T=[b+1,w+1],k=Array.from({length:T[0]},()=>Array(T[1]).fill(1/0));k[0][0]=0;const z=Array.from({length:T[0]},()=>Array(T[1]).fill(-1));for(let Z=1;Z0||Q>0;)switch(q.push(R-1),U.push(Q-1),z[R][Q]){case 0:--R,--Q;break;case 1:--R;break;case 2:--Q;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${R}, ${Q}]. Please file a bug report.`)}return q.reverse(),U.reverse(),[q,U]}},"./src/utils/tensor.js":(e,r,t)=>{t.r(r),t.d(r,{DataTypeMap:()=>i,Tensor:()=>a,cat:()=>w,full:()=>U,full_like:()=>Z,interpolate:()=>p,interpolate_4d:()=>u,layer_norm:()=>y,matmul:()=>h,mean:()=>R,mean_pooling:()=>M,ones:()=>H,ones_like:()=>J,permute:()=>c,quantize_embeddings:()=>he,rand:()=>ce,rfft:()=>g,slice:()=>I,stack:()=>T,std_mean:()=>z,topk:()=>_,zeros:()=>oe,zeros_like:()=>ae});var s=t("./src/utils/maths.js"),o=t("./src/backends/onnx.js"),n=t("./src/ops/registry.js");const i=Object.freeze({float32:Float32Array,float16:typeof Float16Array<"u"?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array});class a{constructor(...O){re(this,"ort_tensor");return(0,o.isONNXTensor)(O[0])?this.ort_tensor=O[0]:this.ort_tensor=new o.Tensor(O[0],O[1],O[2]),new Proxy(this,{get:(G,se)=>{if(typeof se=="string"){let X=Number(se);if(Number.isInteger(X))return G._getitem(X)}return G[se]},set:(G,se,X)=>G[se]=X})}get dims(){return this.ort_tensor.dims}set dims(O){this.ort_tensor.dims=O}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[O,...G]=this.dims;if(G.length>0){const se=G.reduce((X,we)=>X*we);for(let X=0;X0){const X=se.reduce((we,_e)=>we*_e);return this._subarray(O,X,se)}else return new a(this.type,[this.data[O]],se)}indexOf(O){const G=this.data;for(let se=0;seme)throw new Error(`Invalid slice: ${K}`);const Pe=[Math.max(j,0),Math.min(me,this.dims[Me])];se.push(Pe),G.push(Pe[1]-Pe[0])}else throw new Error(`Invalid slice: ${K}`)}const X=se.map(([Me,K])=>K-Me),we=X.reduce((Me,K)=>Me*K),_e=this.data,ke=new _e.constructor(we),He=this.stride();for(let Me=0;Me=0;--j){const Pe=X[j];K+=(me%Pe+se[j][0])*He[j],me=Math.floor(me/Pe)}ke[Me]=_e[K]}return new a(this.type,ke,G)}permute(...O){return c(this,O)}transpose(...O){return this.permute(...O)}sum(O=null,G=!1){return this.norm(1,O,G)}norm(O="fro",G=null,se=!1){if(O==="fro")O=2;else if(typeof O=="string")throw Error(`Unsupported norm: ${O}`);const X=this.data,we=(Me,K)=>Me+K**O;if(G===null){const Me=X.reduce(we,0)**(1/O);return new a(this.type,[Me],[])}const[_e,ke,He]=k(we,this,G,se);if(O!==1)for(let Me=0;Me=0;--He){const j=this.dims[He];if(He!==G){const me=Me%j;ke+=me*K,K*=this.dims[He]}Me=Math.floor(Me/j)}X[_e]/=we[ke]}return this}normalize(O=2,G=1){return this.clone().normalize_(O,G)}stride(){return Q(this.dims)}squeeze(O=null){return new a(this.type,this.data,$(this.dims,O))}squeeze_(O=null){return this.dims=$(this.dims,O),this}unsqueeze(O=null){return new a(this.type,this.data,P(this.dims,O))}unsqueeze_(O=null){return this.dims=P(this.dims,O),this}flatten_(O=0,G=-1){G=(G+this.dims.length)%this.dims.length;let se=this.dims.slice(0,O),X=this.dims.slice(O,G+1),we=this.dims.slice(G+1);return this.dims=[...se,X.reduce((_e,ke)=>_e*ke,1),...we],this}flatten(O=0,G=-1){return this.clone().flatten_(O,G)}view(...O){let G=-1;for(let X=0;Xke!==G?we*_e:we,1);O[G]=se.length/X}return new a(this.type,se,O)}neg_(){const O=this.data;for(let G=0;GO?1:0;return new a("bool",G,this.dims)}lt(O){const G=new Uint8Array(this.data.length),se=this.data;for(let X=0;XMath.min(_e,ke),this,O,G,1/0);return new a(se,X,we)}max(O=null,G=!1){if(O===null){const _e=(0,s.max)(this.data)[0];return new a(this.type,[_e],[])}const[se,X,we]=k((_e,ke)=>Math.max(_e,ke),this,O,G,-1/0);return new a(se,X,we)}argmin(O=null,G=!1){if(O!==null)throw new Error("`dim !== null` not yet implemented.");const se=(0,s.min)(this.data)[1];return new a("int64",[BigInt(se)],[])}argmax(O=null,G=!1){if(O!==null)throw new Error("`dim !== null` not yet implemented.");const se=(0,s.max)(this.data)[1];return new a("int64",[BigInt(se)],[])}to(O){if(this.type===O)return this;if(!i.hasOwnProperty(O))throw new Error(`Unsupported type: ${O}`);let G;const se=["int64","uint64"].includes(this.type),X=["int64","uint64"].includes(O);return se&&!X?G=Number:!se&&X&&(G=BigInt),new a(O,i[O].from(this.data,G),this.dims)}}function l(N,O){const G=N.length,se=O.reduce((we,_e)=>we*_e);if(G!==se)throw Error(`cannot reshape array of size ${G} into shape (${O})`);let X=N;for(let we=O.length-1;we>=0;we--)X=X.reduce((_e,ke)=>{let He=_e[_e.length-1];return He.lengthnew a("int64",N,[N.length]);async function I(N,O,G,se,X){return await(await n.TensorOpRegistry.slice)({x:N,s:E(O),e:E(G),a:E(se),t:E(X??new Array(se.length).fill(1))})}function M(N,O){const G=N.data,se=O.data,X=[N.dims[0],N.dims[2]],we=new G.constructor(X[0]*X[1]),[_e,ke,He]=N.dims;let Me=0;for(let K=0;K<_e;++K){const j=K*He*ke;for(let me=0;meG!==1):typeof O=="number"?N[O]===1&&N.splice(O,1):Array.isArray(O)&&(N=N.filter((G,se)=>G!==1||!O.includes(se))),N}function P(N,O){return O=b(O,N.length+1),N=N.slice(),N.splice(O,0,1),N}function b(N,O,G=null,se=!0){if(N<-O||N>=O){if(se)throw new Error(`IndexError: index ${N} is out of bounds for dimension${G===null?"":" "+G} with size ${O}`);return N<-O?0:O}return N<0&&(N=(N%O+O)%O),N}function w(N,O=0){O=b(O,N[0].dims.length);const G=N[0].dims.slice();G[O]=N.reduce((_e,ke)=>_e+ke.dims[O],0);const se=G.reduce((_e,ke)=>_e*ke,1),X=new N[0].data.constructor(se),we=N[0].type;if(O===0){let _e=0;for(const ke of N){const He=ke.data;X.set(He,_e),_e+=He.length}}else{let _e=0;for(let ke=0;ke=0;--me){const Ae=Me[me];let Ie=Pe%Ae;me===O&&(Ie+=_e),j+=Ie*Te,Te*=G[me],Pe=Math.floor(Pe/Ae)}X[j]=He[K]}_e+=Me[O]}}return new a(we,X,G)}function T(N,O=0){return w(N.map(G=>G.unsqueeze(O)),O)}function k(N,O,G=null,se=!1,X=null){const we=O.data,_e=O.dims;G=b(G,_e.length);const ke=_e.slice();ke[G]=1;const He=new we.constructor(we.length/_e[G]);X!==null&&He.fill(X);for(let Me=0;Me=0;--j){const Te=_e[j];if(j!==G){const Ae=me%Te;K+=Ae*Pe,Pe*=ke[j]}me=Math.floor(me/Te)}He[K]=N(He[K],we[Me],Me,K)}return se||ke.splice(G,1),[O.type,He,ke]}function z(N,O=null,G=1,se=!1){const X=N.data,we=N.dims;if(O===null){const Pe=X.reduce((Le,Ne)=>Le+Ne,0)/X.length,Te=Math.sqrt(X.reduce((Le,Ne)=>Le+(Ne-Pe)**2,0)/(X.length-G)),Ae=new a(N.type,[Pe],[]);return[new a(N.type,[Te],[]),Ae]}O=b(O,we.length);const _e=R(N,O,se),ke=_e.data,[He,Me,K]=k((me,Pe,Te,Ae)=>me+(Pe-ke[Ae])**2,N,O,se);for(let me=0;meMe+K,0);return new a(N.type,[He/X.length],[])}O=b(O,se.length);const[we,_e,ke]=k((He,Me)=>He+Me,N,O,G);if(se[O]!==1)for(let He=0;He<_e.length;++He)_e[He]/=se[O];return new a(we,_e,ke)}function Q(N){const O=new Array(N.length);for(let G=N.length-1,se=1;G>=0;--G)O[G]=se,se*=N[G];return O}function q(N,O,G,se){const X=N.reduce((we,_e)=>we*_e,1);return new a(G,new se(X).fill(O),N)}function U(N,O){let G,se;if(typeof O=="number")G="float32",se=Float32Array;else if(typeof O=="bigint")G="int64",se=BigInt64Array;else if(typeof O=="boolean")G="bool",se=Uint8Array;else throw new Error(`Unsupported data type: ${typeof O}`);return q(N,O,G,se)}function Z(N,O){return U(N.dims,O)}function H(N){return q(N,1n,"int64",BigInt64Array)}function J(N){return H(N.dims)}function oe(N){return q(N,0n,"int64",BigInt64Array)}function ae(N){return oe(N.dims)}function ce(N){const O=N.reduce((G,se)=>G*se,1);return new a("float32",Float32Array.from({length:O},()=>Math.random()),N)}function he(N,O){if(N.dims.length!==2)throw new Error("The tensor must have 2 dimensions");if(N.dims.at(-1)%8!==0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(O))throw new Error("The precision must be either 'binary' or 'ubinary'");const G=O==="binary",se=G?"int8":"uint8",X=G?Int8Array:Uint8Array,we=N.data,_e=new X(we.length/8);for(let ke=0;ke0?1:0,Me=Math.floor(ke/8),K=ke%8;_e[Me]|=He<<7-K,G&&K===0&&(_e[Me]-=128)}return new a(se,_e,[N.dims[0],N.dims[1]/8])}},"./src/utils/video.js":(e,r,t)=>{t.r(r),t.d(r,{RawVideo:()=>i,RawVideoFrame:()=>n,load_video:()=>a});var s=t("./src/utils/image.js"),o=t("./src/env.js");class n{constructor(c,p){this.image=c,this.timestamp=p}}class i{constructor(c,p){c.length>0&&c[0]instanceof s.RawImage&&(c=c.map((u,h)=>new n(u,(h+1)/(c.length+1)*p))),this.frames=c,this.duration=p}get width(){return this.frames[0].image.width}get height(){return this.frames[0].image.height}get fps(){return this.frames.length/this.duration}}async function a(l,{num_frames:c=null,fps:p=null}={}){if(!o.apis.IS_BROWSER_ENV)throw new Error("`load_video` is currently only supported in browser environments.");if(c==null&&p==null)throw new Error("Either num_frames or fps must be provided.");const u=[],h=document.createElement("video");if(h.crossOrigin="anonymous",h.muted=!0,typeof l=="string")h.src=l;else if(l instanceof Blob)h.src=URL.createObjectURL(l);else if(l instanceof HTMLVideoElement)h.src=l.src;else throw new Error("Invalid URL or video element provided.");if(await new Promise($=>h.onloadedmetadata=$),h.seekable.start(0)===h.seekable.end(0)){const P=await(await fetch(h.src)).blob();h.src=URL.createObjectURL(P),await new Promise(b=>h.onloadedmetadata=b)}const g=h.duration;let _,E;c!=null?(_=c,E=c===1?0:g/(c-1)):(E=1/p,_=Math.floor(g/E));let I=[];for(let $=0;$<_;++$)I.push(c===1?g/2:$*E);const M=document.createElement("canvas");M.width=h.videoWidth,M.height=h.videoHeight;const y=M.getContext("2d",{willReadFrequently:!0});for(const $ of I){h.currentTime=$,await new Promise(T=>{h.onseeked=T}),y.drawImage(h,0,0,M.width,M.height);const P=y.getImageData(0,0,M.width,M.height),b=new s.RawImage(P.data,M.width,M.height,4),w=new n(b,$);u.push(w)}return h.remove(),new i(u,g)}}},qw={};function Ft(e){var r=qw[e];if(r!==void 0)return r.exports;var t=qw[e]={exports:{}};return qx[e](t,t.exports,Ft),t.exports}(()=>{var e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,r;Ft.t=function(t,s){if(s&1&&(t=this(t)),s&8||typeof t=="object"&&t&&(s&4&&t.__esModule||s&16&&typeof t.then=="function"))return t;var o=Object.create(null);Ft.r(o);var n={};r=r||[null,e({}),e([]),e(e)];for(var i=s&2&&t;typeof i=="object"&&!~r.indexOf(i);i=e(i))Object.getOwnPropertyNames(i).forEach(a=>n[a]=()=>t[a]);return n.default=()=>t,Ft.d(o,n),o}})();Ft.d=(e,r)=>{for(var t in r)Ft.o(r,t)&&!Ft.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})};Ft.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);Ft.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};(()=>{/*!*****************************!*\ - !*** ./src/transformers.js ***! - \*****************************/Ft.r(f),Ft.d(f,{ASTFeatureExtractor:()=>u.ASTFeatureExtractor,ASTForAudioClassification:()=>t.ASTForAudioClassification,ASTModel:()=>t.ASTModel,ASTPreTrainedModel:()=>t.ASTPreTrainedModel,AlbertForMaskedLM:()=>t.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>t.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>t.AlbertForSequenceClassification,AlbertModel:()=>t.AlbertModel,AlbertPreTrainedModel:()=>t.AlbertPreTrainedModel,AlbertTokenizer:()=>s.AlbertTokenizer,AudioClassificationPipeline:()=>r.AudioClassificationPipeline,AutoConfig:()=>o.AutoConfig,AutoFeatureExtractor:()=>h.AutoFeatureExtractor,AutoImageProcessor:()=>E.AutoImageProcessor,AutoModel:()=>t.AutoModel,AutoModelForAudioClassification:()=>t.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>t.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>t.AutoModelForAudioTextToText,AutoModelForCTC:()=>t.AutoModelForCTC,AutoModelForCausalLM:()=>t.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>t.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>t.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>t.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>t.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>t.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>t.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>t.AutoModelForImageTextToText,AutoModelForImageToImage:()=>t.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>t.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>t.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>t.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>t.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>t.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>t.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>t.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>t.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>t.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>t.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>t.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>t.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>t.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>t.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>t.AutoModelForVision2Seq,AutoModelForXVector:()=>t.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>t.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>y.AutoProcessor,AutoTokenizer:()=>s.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>r.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>r.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>t.BartForConditionalGeneration,BartForSequenceClassification:()=>t.BartForSequenceClassification,BartModel:()=>t.BartModel,BartPretrainedModel:()=>t.BartPretrainedModel,BartTokenizer:()=>s.BartTokenizer,BaseModelOutput:()=>t.BaseModelOutput,BaseStreamer:()=>$.BaseStreamer,BeitFeatureExtractor:()=>_.BeitFeatureExtractor,BeitForImageClassification:()=>t.BeitForImageClassification,BeitModel:()=>t.BeitModel,BeitPreTrainedModel:()=>t.BeitPreTrainedModel,BertForMaskedLM:()=>t.BertForMaskedLM,BertForQuestionAnswering:()=>t.BertForQuestionAnswering,BertForSequenceClassification:()=>t.BertForSequenceClassification,BertForTokenClassification:()=>t.BertForTokenClassification,BertModel:()=>t.BertModel,BertPreTrainedModel:()=>t.BertPreTrainedModel,BertTokenizer:()=>s.BertTokenizer,BitImageProcessor:()=>_.BitImageProcessor,BlenderbotForConditionalGeneration:()=>t.BlenderbotForConditionalGeneration,BlenderbotModel:()=>t.BlenderbotModel,BlenderbotPreTrainedModel:()=>t.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>t.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>t.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>t.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>s.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>s.BlenderbotTokenizer,BloomForCausalLM:()=>t.BloomForCausalLM,BloomModel:()=>t.BloomModel,BloomPreTrainedModel:()=>t.BloomPreTrainedModel,BloomTokenizer:()=>s.BloomTokenizer,CLIPFeatureExtractor:()=>_.CLIPFeatureExtractor,CLIPImageProcessor:()=>_.CLIPImageProcessor,CLIPModel:()=>t.CLIPModel,CLIPPreTrainedModel:()=>t.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>t.CLIPSegForImageSegmentation,CLIPSegModel:()=>t.CLIPSegModel,CLIPSegPreTrainedModel:()=>t.CLIPSegPreTrainedModel,CLIPTextModel:()=>t.CLIPTextModel,CLIPTextModelWithProjection:()=>t.CLIPTextModelWithProjection,CLIPTokenizer:()=>s.CLIPTokenizer,CLIPVisionModel:()=>t.CLIPVisionModel,CLIPVisionModelWithProjection:()=>t.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>t.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>t.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>t.CamembertForSequenceClassification,CamembertForTokenClassification:()=>t.CamembertForTokenClassification,CamembertModel:()=>t.CamembertModel,CamembertPreTrainedModel:()=>t.CamembertPreTrainedModel,CamembertTokenizer:()=>s.CamembertTokenizer,CausalLMOutput:()=>t.CausalLMOutput,CausalLMOutputWithPast:()=>t.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>_.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>t.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>t.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>t.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>u.ClapFeatureExtractor,ClapModel:()=>t.ClapModel,ClapPreTrainedModel:()=>t.ClapPreTrainedModel,ClapTextModelWithProjection:()=>t.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>b.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>t.CodeGenForCausalLM,CodeGenModel:()=>t.CodeGenModel,CodeGenPreTrainedModel:()=>t.CodeGenPreTrainedModel,CodeGenTokenizer:()=>s.CodeGenTokenizer,CodeLlamaTokenizer:()=>s.CodeLlamaTokenizer,CohereForCausalLM:()=>t.CohereForCausalLM,CohereModel:()=>t.CohereModel,CoherePreTrainedModel:()=>t.CoherePreTrainedModel,CohereTokenizer:()=>s.CohereTokenizer,ConvBertForMaskedLM:()=>t.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>t.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>t.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>t.ConvBertForTokenClassification,ConvBertModel:()=>t.ConvBertModel,ConvBertPreTrainedModel:()=>t.ConvBertPreTrainedModel,ConvBertTokenizer:()=>s.ConvBertTokenizer,ConvNextFeatureExtractor:()=>_.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>t.ConvNextForImageClassification,ConvNextImageProcessor:()=>_.ConvNextImageProcessor,ConvNextModel:()=>t.ConvNextModel,ConvNextPreTrainedModel:()=>t.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>t.ConvNextV2ForImageClassification,ConvNextV2Model:()=>t.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>t.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>_.DPTFeatureExtractor,DPTForDepthEstimation:()=>t.DPTForDepthEstimation,DPTImageProcessor:()=>_.DPTImageProcessor,DPTModel:()=>t.DPTModel,DPTPreTrainedModel:()=>t.DPTPreTrainedModel,DacDecoderModel:()=>t.DacDecoderModel,DacDecoderOutput:()=>t.DacDecoderOutput,DacEncoderModel:()=>t.DacEncoderModel,DacEncoderOutput:()=>t.DacEncoderOutput,DacFeatureExtractor:()=>u.DacFeatureExtractor,DacModel:()=>t.DacModel,DacPreTrainedModel:()=>t.DacPreTrainedModel,DataTypeMap:()=>l.DataTypeMap,DebertaForMaskedLM:()=>t.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>t.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>t.DebertaForSequenceClassification,DebertaForTokenClassification:()=>t.DebertaForTokenClassification,DebertaModel:()=>t.DebertaModel,DebertaPreTrainedModel:()=>t.DebertaPreTrainedModel,DebertaTokenizer:()=>s.DebertaTokenizer,DebertaV2ForMaskedLM:()=>t.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>t.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>t.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>t.DebertaV2ForTokenClassification,DebertaV2Model:()=>t.DebertaV2Model,DebertaV2PreTrainedModel:()=>t.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>s.DebertaV2Tokenizer,DecisionTransformerModel:()=>t.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>t.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>_.DeiTFeatureExtractor,DeiTForImageClassification:()=>t.DeiTForImageClassification,DeiTImageProcessor:()=>_.DeiTImageProcessor,DeiTModel:()=>t.DeiTModel,DeiTPreTrainedModel:()=>t.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>t.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>t.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>r.DepthEstimationPipeline,DepthProForDepthEstimation:()=>t.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>t.DepthProPreTrainedModel,DetrFeatureExtractor:()=>_.DetrFeatureExtractor,DetrForObjectDetection:()=>t.DetrForObjectDetection,DetrForSegmentation:()=>t.DetrForSegmentation,DetrImageProcessor:()=>_.DetrImageProcessor,DetrModel:()=>t.DetrModel,DetrObjectDetectionOutput:()=>t.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>t.DetrPreTrainedModel,DetrSegmentationOutput:()=>t.DetrSegmentationOutput,Dinov2ForImageClassification:()=>t.Dinov2ForImageClassification,Dinov2Model:()=>t.Dinov2Model,Dinov2PreTrainedModel:()=>t.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>t.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>t.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>t.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>t.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>t.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>t.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>t.DistilBertForTokenClassification,DistilBertModel:()=>t.DistilBertModel,DistilBertPreTrainedModel:()=>t.DistilBertPreTrainedModel,DistilBertTokenizer:()=>s.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>r.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>_.DonutFeatureExtractor,DonutImageProcessor:()=>_.DonutImageProcessor,DonutSwinModel:()=>t.DonutSwinModel,DonutSwinPreTrainedModel:()=>t.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>t.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>_.EfficientNetImageProcessor,EfficientNetModel:()=>t.EfficientNetModel,EfficientNetPreTrainedModel:()=>t.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>t.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>t.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>t.ElectraForSequenceClassification,ElectraForTokenClassification:()=>t.ElectraForTokenClassification,ElectraModel:()=>t.ElectraModel,ElectraPreTrainedModel:()=>t.ElectraPreTrainedModel,ElectraTokenizer:()=>s.ElectraTokenizer,EncodecFeatureExtractor:()=>u.EncodecFeatureExtractor,EosTokenCriteria:()=>P.EosTokenCriteria,EsmForMaskedLM:()=>t.EsmForMaskedLM,EsmForSequenceClassification:()=>t.EsmForSequenceClassification,EsmForTokenClassification:()=>t.EsmForTokenClassification,EsmModel:()=>t.EsmModel,EsmPreTrainedModel:()=>t.EsmPreTrainedModel,EsmTokenizer:()=>s.EsmTokenizer,ExaoneForCausalLM:()=>t.ExaoneForCausalLM,ExaoneModel:()=>t.ExaoneModel,ExaonePreTrainedModel:()=>t.ExaonePreTrainedModel,FFT:()=>c.FFT,FalconForCausalLM:()=>t.FalconForCausalLM,FalconModel:()=>t.FalconModel,FalconPreTrainedModel:()=>t.FalconPreTrainedModel,FalconTokenizer:()=>s.FalconTokenizer,FastViTForImageClassification:()=>t.FastViTForImageClassification,FastViTModel:()=>t.FastViTModel,FastViTPreTrainedModel:()=>t.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>r.FeatureExtractionPipeline,FeatureExtractor:()=>p.FeatureExtractor,FillMaskPipeline:()=>r.FillMaskPipeline,Florence2ForConditionalGeneration:()=>t.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>t.Florence2PreTrainedModel,Florence2Processor:()=>M.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>b.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>b.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>_.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>t.GLPNForDepthEstimation,GLPNModel:()=>t.GLPNModel,GLPNPreTrainedModel:()=>t.GLPNPreTrainedModel,GPT2LMHeadModel:()=>t.GPT2LMHeadModel,GPT2Model:()=>t.GPT2Model,GPT2PreTrainedModel:()=>t.GPT2PreTrainedModel,GPT2Tokenizer:()=>s.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>t.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>t.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>t.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>t.GPTJForCausalLM,GPTJModel:()=>t.GPTJModel,GPTJPreTrainedModel:()=>t.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>t.GPTNeoForCausalLM,GPTNeoModel:()=>t.GPTNeoModel,GPTNeoPreTrainedModel:()=>t.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>t.GPTNeoXForCausalLM,GPTNeoXModel:()=>t.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>t.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>s.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>t.Gemma2ForCausalLM,Gemma2Model:()=>t.Gemma2Model,Gemma2PreTrainedModel:()=>t.Gemma2PreTrainedModel,Gemma3ForCausalLM:()=>t.Gemma3ForCausalLM,Gemma3Model:()=>t.Gemma3Model,Gemma3PreTrainedModel:()=>t.Gemma3PreTrainedModel,GemmaForCausalLM:()=>t.GemmaForCausalLM,GemmaModel:()=>t.GemmaModel,GemmaPreTrainedModel:()=>t.GemmaPreTrainedModel,GemmaTokenizer:()=>s.GemmaTokenizer,GlmForCausalLM:()=>t.GlmForCausalLM,GlmModel:()=>t.GlmModel,GlmPreTrainedModel:()=>t.GlmPreTrainedModel,GraniteForCausalLM:()=>t.GraniteForCausalLM,GraniteModel:()=>t.GraniteModel,GranitePreTrainedModel:()=>t.GranitePreTrainedModel,Grok1Tokenizer:()=>s.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>t.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>_.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>t.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>M.GroundingDinoProcessor,GroupViTModel:()=>t.GroupViTModel,GroupViTPreTrainedModel:()=>t.GroupViTPreTrainedModel,HeliumForCausalLM:()=>t.HeliumForCausalLM,HeliumModel:()=>t.HeliumModel,HeliumPreTrainedModel:()=>t.HeliumPreTrainedModel,HerbertTokenizer:()=>s.HerbertTokenizer,HieraForImageClassification:()=>t.HieraForImageClassification,HieraModel:()=>t.HieraModel,HieraPreTrainedModel:()=>t.HieraPreTrainedModel,HubertForCTC:()=>t.HubertForCTC,HubertForSequenceClassification:()=>t.HubertForSequenceClassification,HubertModel:()=>t.HubertModel,HubertPreTrainedModel:()=>t.HubertPreTrainedModel,IJepaForImageClassification:()=>t.IJepaForImageClassification,IJepaModel:()=>t.IJepaModel,IJepaPreTrainedModel:()=>t.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>t.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>_.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>t.Idefics3PreTrainedModel,Idefics3Processor:()=>M.Idefics3Processor,ImageClassificationPipeline:()=>r.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>r.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>u.ImageFeatureExtractor,ImageMattingOutput:()=>t.ImageMattingOutput,ImageProcessor:()=>g.ImageProcessor,ImageSegmentationPipeline:()=>r.ImageSegmentationPipeline,ImageToImagePipeline:()=>r.ImageToImagePipeline,ImageToTextPipeline:()=>r.ImageToTextPipeline,InterruptableStoppingCriteria:()=>P.InterruptableStoppingCriteria,JAISLMHeadModel:()=>t.JAISLMHeadModel,JAISModel:()=>t.JAISModel,JAISPreTrainedModel:()=>t.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>_.JinaCLIPImageProcessor,JinaCLIPModel:()=>t.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>t.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>M.JinaCLIPProcessor,JinaCLIPTextModel:()=>t.JinaCLIPTextModel,JinaCLIPVisionModel:()=>t.JinaCLIPVisionModel,LiteWhisperForConditionalGeneration:()=>t.LiteWhisperForConditionalGeneration,LlamaForCausalLM:()=>t.LlamaForCausalLM,LlamaModel:()=>t.LlamaModel,LlamaPreTrainedModel:()=>t.LlamaPreTrainedModel,LlamaTokenizer:()=>s.LlamaTokenizer,LlavaForConditionalGeneration:()=>t.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>t.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>_.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>t.LlavaPreTrainedModel,LogitsProcessor:()=>b.LogitsProcessor,LogitsProcessorList:()=>b.LogitsProcessorList,LogitsWarper:()=>b.LogitsWarper,LongT5ForConditionalGeneration:()=>t.LongT5ForConditionalGeneration,LongT5Model:()=>t.LongT5Model,LongT5PreTrainedModel:()=>t.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>t.M2M100ForConditionalGeneration,M2M100Model:()=>t.M2M100Model,M2M100PreTrainedModel:()=>t.M2M100PreTrainedModel,M2M100Tokenizer:()=>s.M2M100Tokenizer,MBart50Tokenizer:()=>s.MBart50Tokenizer,MBartForCausalLM:()=>t.MBartForCausalLM,MBartForConditionalGeneration:()=>t.MBartForConditionalGeneration,MBartForSequenceClassification:()=>t.MBartForSequenceClassification,MBartModel:()=>t.MBartModel,MBartPreTrainedModel:()=>t.MBartPreTrainedModel,MBartTokenizer:()=>s.MBartTokenizer,MPNetForMaskedLM:()=>t.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>t.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>t.MPNetForSequenceClassification,MPNetForTokenClassification:()=>t.MPNetForTokenClassification,MPNetModel:()=>t.MPNetModel,MPNetPreTrainedModel:()=>t.MPNetPreTrainedModel,MPNetTokenizer:()=>s.MPNetTokenizer,MT5ForConditionalGeneration:()=>t.MT5ForConditionalGeneration,MT5Model:()=>t.MT5Model,MT5PreTrainedModel:()=>t.MT5PreTrainedModel,MarianMTModel:()=>t.MarianMTModel,MarianModel:()=>t.MarianModel,MarianPreTrainedModel:()=>t.MarianPreTrainedModel,MarianTokenizer:()=>s.MarianTokenizer,Mask2FormerImageProcessor:()=>_.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>_.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>t.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>_.MaskFormerImageProcessor,MaskFormerModel:()=>t.MaskFormerModel,MaskFormerPreTrainedModel:()=>t.MaskFormerPreTrainedModel,MaskedLMOutput:()=>t.MaskedLMOutput,MaxLengthCriteria:()=>P.MaxLengthCriteria,Metric3DForDepthEstimation:()=>t.Metric3DForDepthEstimation,Metric3DPreTrainedModel:()=>t.Metric3DPreTrainedModel,Metric3Dv2ForDepthEstimation:()=>t.Metric3Dv2ForDepthEstimation,Metric3Dv2PreTrainedModel:()=>t.Metric3Dv2PreTrainedModel,MgpstrForSceneTextRecognition:()=>t.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>t.MgpstrModelOutput,MgpstrPreTrainedModel:()=>t.MgpstrPreTrainedModel,MgpstrProcessor:()=>M.MgpstrProcessor,MgpstrTokenizer:()=>s.MgpstrTokenizer,MimiDecoderModel:()=>t.MimiDecoderModel,MimiDecoderOutput:()=>t.MimiDecoderOutput,MimiEncoderModel:()=>t.MimiEncoderModel,MimiEncoderOutput:()=>t.MimiEncoderOutput,MimiModel:()=>t.MimiModel,MimiPreTrainedModel:()=>t.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>b.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>b.MinNewTokensLengthLogitsProcessor,MistralForCausalLM:()=>t.MistralForCausalLM,MistralModel:()=>t.MistralModel,MistralPreTrainedModel:()=>t.MistralPreTrainedModel,MobileBertForMaskedLM:()=>t.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>t.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>t.MobileBertForSequenceClassification,MobileBertModel:()=>t.MobileBertModel,MobileBertPreTrainedModel:()=>t.MobileBertPreTrainedModel,MobileBertTokenizer:()=>s.MobileBertTokenizer,MobileLLMForCausalLM:()=>t.MobileLLMForCausalLM,MobileLLMModel:()=>t.MobileLLMModel,MobileLLMPreTrainedModel:()=>t.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>_.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>t.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>t.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>_.MobileNetV1ImageProcessor,MobileNetV1Model:()=>t.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>t.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>_.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>t.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>t.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>_.MobileNetV2ImageProcessor,MobileNetV2Model:()=>t.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>t.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>_.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>t.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>t.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>_.MobileNetV3ImageProcessor,MobileNetV3Model:()=>t.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>t.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>_.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>t.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>t.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>_.MobileNetV4ImageProcessor,MobileNetV4Model:()=>t.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>t.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>_.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>t.MobileViTForImageClassification,MobileViTImageProcessor:()=>_.MobileViTImageProcessor,MobileViTModel:()=>t.MobileViTModel,MobileViTPreTrainedModel:()=>t.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>t.MobileViTV2ForImageClassification,MobileViTV2Model:()=>t.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>t.MobileViTV2PreTrainedModel,ModelOutput:()=>t.ModelOutput,ModernBertForMaskedLM:()=>t.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>t.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>t.ModernBertForTokenClassification,ModernBertModel:()=>t.ModernBertModel,ModernBertPreTrainedModel:()=>t.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>t.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>u.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>t.MoonshineForConditionalGeneration,MoonshineModel:()=>t.MoonshineModel,MoonshinePreTrainedModel:()=>t.MoonshinePreTrainedModel,MoonshineProcessor:()=>M.MoonshineProcessor,MptForCausalLM:()=>t.MptForCausalLM,MptModel:()=>t.MptModel,MptPreTrainedModel:()=>t.MptPreTrainedModel,MultiModalityCausalLM:()=>t.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>t.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>t.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>t.MusicgenForConditionalGeneration,MusicgenModel:()=>t.MusicgenModel,MusicgenPreTrainedModel:()=>t.MusicgenPreTrainedModel,NllbTokenizer:()=>s.NllbTokenizer,NoBadWordsLogitsProcessor:()=>b.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>b.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>t.NomicBertModel,NomicBertPreTrainedModel:()=>t.NomicBertPreTrainedModel,NougatImageProcessor:()=>_.NougatImageProcessor,NougatTokenizer:()=>s.NougatTokenizer,OPTForCausalLM:()=>t.OPTForCausalLM,OPTModel:()=>t.OPTModel,OPTPreTrainedModel:()=>t.OPTPreTrainedModel,ObjectDetectionPipeline:()=>r.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>t.Olmo2ForCausalLM,Olmo2Model:()=>t.Olmo2Model,Olmo2PreTrainedModel:()=>t.Olmo2PreTrainedModel,OlmoForCausalLM:()=>t.OlmoForCausalLM,OlmoModel:()=>t.OlmoModel,OlmoPreTrainedModel:()=>t.OlmoPreTrainedModel,OpenELMForCausalLM:()=>t.OpenELMForCausalLM,OpenELMModel:()=>t.OpenELMModel,OpenELMPreTrainedModel:()=>t.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>_.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>t.OwlViTForObjectDetection,OwlViTImageProcessor:()=>_.OwlViTImageProcessor,OwlViTModel:()=>t.OwlViTModel,OwlViTPreTrainedModel:()=>t.OwlViTPreTrainedModel,OwlViTProcessor:()=>M.OwlViTProcessor,Owlv2ForObjectDetection:()=>t.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>_.Owlv2ImageProcessor,Owlv2Model:()=>t.Owlv2Model,Owlv2PreTrainedModel:()=>t.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>t.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>t.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>M.PaliGemmaProcessor,PatchTSMixerForPrediction:()=>t.PatchTSMixerForPrediction,PatchTSMixerModel:()=>t.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>t.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>t.PatchTSTForPrediction,PatchTSTModel:()=>t.PatchTSTModel,PatchTSTPreTrainedModel:()=>t.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>t.Phi3ForCausalLM,Phi3Model:()=>t.Phi3Model,Phi3PreTrainedModel:()=>t.Phi3PreTrainedModel,Phi3VForCausalLM:()=>t.Phi3VForCausalLM,Phi3VImageProcessor:()=>_.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>t.Phi3VPreTrainedModel,Phi3VProcessor:()=>M.Phi3VProcessor,PhiForCausalLM:()=>t.PhiForCausalLM,PhiModel:()=>t.PhiModel,PhiPreTrainedModel:()=>t.PhiPreTrainedModel,Pipeline:()=>r.Pipeline,PreTrainedModel:()=>t.PreTrainedModel,PreTrainedTokenizer:()=>s.PreTrainedTokenizer,PretrainedConfig:()=>o.PretrainedConfig,PretrainedMixin:()=>t.PretrainedMixin,Processor:()=>I.Processor,PvtForImageClassification:()=>t.PvtForImageClassification,PvtImageProcessor:()=>_.PvtImageProcessor,PvtModel:()=>t.PvtModel,PvtPreTrainedModel:()=>t.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>u.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>t.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>t.PyAnnoteModel,PyAnnotePreTrainedModel:()=>t.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>M.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>t.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>r.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>t.Qwen2ForCausalLM,Qwen2Model:()=>t.Qwen2Model,Qwen2PreTrainedModel:()=>t.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>s.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>t.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>_.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>t.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>M.Qwen2VLProcessor,RFDetrForObjectDetection:()=>t.RFDetrForObjectDetection,RFDetrModel:()=>t.RFDetrModel,RFDetrObjectDetectionOutput:()=>t.RFDetrObjectDetectionOutput,RFDetrPreTrainedModel:()=>t.RFDetrPreTrainedModel,RTDetrForObjectDetection:()=>t.RTDetrForObjectDetection,RTDetrImageProcessor:()=>_.RTDetrImageProcessor,RTDetrModel:()=>t.RTDetrModel,RTDetrObjectDetectionOutput:()=>t.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>t.RTDetrPreTrainedModel,RTDetrV2ForObjectDetection:()=>t.RTDetrV2ForObjectDetection,RTDetrV2Model:()=>t.RTDetrV2Model,RTDetrV2ObjectDetectionOutput:()=>t.RTDetrV2ObjectDetectionOutput,RTDetrV2PreTrainedModel:()=>t.RTDetrV2PreTrainedModel,RawAudio:()=>n.RawAudio,RawImage:()=>i.RawImage,RawVideo:()=>a.RawVideo,RawVideoFrame:()=>a.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>b.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>t.ResNetForImageClassification,ResNetModel:()=>t.ResNetModel,ResNetPreTrainedModel:()=>t.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>t.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>t.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>t.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>t.RoFormerForTokenClassification,RoFormerModel:()=>t.RoFormerModel,RoFormerPreTrainedModel:()=>t.RoFormerPreTrainedModel,RoFormerTokenizer:()=>s.RoFormerTokenizer,RobertaForMaskedLM:()=>t.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>t.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>t.RobertaForSequenceClassification,RobertaForTokenClassification:()=>t.RobertaForTokenClassification,RobertaModel:()=>t.RobertaModel,RobertaPreTrainedModel:()=>t.RobertaPreTrainedModel,RobertaTokenizer:()=>s.RobertaTokenizer,SamImageProcessor:()=>_.SamImageProcessor,SamImageSegmentationOutput:()=>t.SamImageSegmentationOutput,SamModel:()=>t.SamModel,SamPreTrainedModel:()=>t.SamPreTrainedModel,SamProcessor:()=>M.SamProcessor,SapiensForDepthEstimation:()=>t.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>t.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>t.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>t.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>u.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>_.SegformerFeatureExtractor,SegformerForImageClassification:()=>t.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>t.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>_.SegformerImageProcessor,SegformerModel:()=>t.SegformerModel,SegformerPreTrainedModel:()=>t.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>t.Seq2SeqLMOutput,SequenceClassifierOutput:()=>t.SequenceClassifierOutput,SiglipImageProcessor:()=>_.SiglipImageProcessor,SiglipModel:()=>t.SiglipModel,SiglipPreTrainedModel:()=>t.SiglipPreTrainedModel,SiglipTextModel:()=>t.SiglipTextModel,SiglipTokenizer:()=>s.SiglipTokenizer,SiglipVisionModel:()=>t.SiglipVisionModel,SmolVLMForConditionalGeneration:()=>t.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>_.SmolVLMImageProcessor,SmolVLMProcessor:()=>M.SmolVLMProcessor,SnacDecoderModel:()=>t.SnacDecoderModel,SnacEncoderModel:()=>t.SnacEncoderModel,SnacFeatureExtractor:()=>u.SnacFeatureExtractor,SnacModel:()=>t.SnacModel,SnacPreTrainedModel:()=>t.SnacPreTrainedModel,SpeechT5FeatureExtractor:()=>u.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>t.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>t.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>t.SpeechT5HifiGan,SpeechT5Model:()=>t.SpeechT5Model,SpeechT5PreTrainedModel:()=>t.SpeechT5PreTrainedModel,SpeechT5Processor:()=>M.SpeechT5Processor,SpeechT5Tokenizer:()=>s.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>t.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>t.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>t.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>t.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>t.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>s.SqueezeBertTokenizer,StableLmForCausalLM:()=>t.StableLmForCausalLM,StableLmModel:()=>t.StableLmModel,StableLmPreTrainedModel:()=>t.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>t.Starcoder2ForCausalLM,Starcoder2Model:()=>t.Starcoder2Model,Starcoder2PreTrainedModel:()=>t.Starcoder2PreTrainedModel,StoppingCriteria:()=>P.StoppingCriteria,StoppingCriteriaList:()=>P.StoppingCriteriaList,StyleTextToSpeech2Model:()=>t.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>t.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>r.SummarizationPipeline,SuppressTokensAtBeginLogitsProcessor:()=>b.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>t.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>_.Swin2SRImageProcessor,Swin2SRModel:()=>t.Swin2SRModel,Swin2SRPreTrainedModel:()=>t.Swin2SRPreTrainedModel,SwinForImageClassification:()=>t.SwinForImageClassification,SwinForSemanticSegmentation:()=>t.SwinForSemanticSegmentation,SwinModel:()=>t.SwinModel,SwinPreTrainedModel:()=>t.SwinPreTrainedModel,T5ForConditionalGeneration:()=>t.T5ForConditionalGeneration,T5Model:()=>t.T5Model,T5PreTrainedModel:()=>t.T5PreTrainedModel,T5Tokenizer:()=>s.T5Tokenizer,TableTransformerForObjectDetection:()=>t.TableTransformerForObjectDetection,TableTransformerModel:()=>t.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>t.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>t.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>b.TemperatureLogitsWarper,Tensor:()=>l.Tensor,Text2TextGenerationPipeline:()=>r.Text2TextGenerationPipeline,TextClassificationPipeline:()=>r.TextClassificationPipeline,TextGenerationPipeline:()=>r.TextGenerationPipeline,TextStreamer:()=>$.TextStreamer,TextToAudioPipeline:()=>r.TextToAudioPipeline,TokenClassificationPipeline:()=>r.TokenClassificationPipeline,TokenClassifierOutput:()=>t.TokenClassifierOutput,TokenizerModel:()=>s.TokenizerModel,TopKLogitsWarper:()=>b.TopKLogitsWarper,TopPLogitsWarper:()=>b.TopPLogitsWarper,TrOCRForCausalLM:()=>t.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>t.TrOCRPreTrainedModel,TranslationPipeline:()=>r.TranslationPipeline,UltravoxModel:()=>t.UltravoxModel,UltravoxPreTrainedModel:()=>t.UltravoxPreTrainedModel,UltravoxProcessor:()=>M.UltravoxProcessor,UniSpeechForCTC:()=>t.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>t.UniSpeechForSequenceClassification,UniSpeechModel:()=>t.UniSpeechModel,UniSpeechPreTrainedModel:()=>t.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>t.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>t.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>t.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>t.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>t.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>M.VLChatProcessor,VLMImageProcessor:()=>_.VLMImageProcessor,ViTFeatureExtractor:()=>_.ViTFeatureExtractor,ViTForImageClassification:()=>t.ViTForImageClassification,ViTImageProcessor:()=>_.ViTImageProcessor,ViTMAEModel:()=>t.ViTMAEModel,ViTMAEPreTrainedModel:()=>t.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>t.ViTMSNForImageClassification,ViTMSNModel:()=>t.ViTMSNModel,ViTMSNPreTrainedModel:()=>t.ViTMSNPreTrainedModel,ViTModel:()=>t.ViTModel,ViTPreTrainedModel:()=>t.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>t.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>t.VitMatteForImageMatting,VitMatteImageProcessor:()=>_.VitMatteImageProcessor,VitMattePreTrainedModel:()=>t.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>t.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>_.VitPoseImageProcessor,VitPosePreTrainedModel:()=>t.VitPosePreTrainedModel,VitsModel:()=>t.VitsModel,VitsModelOutput:()=>t.VitsModelOutput,VitsPreTrainedModel:()=>t.VitsPreTrainedModel,VitsTokenizer:()=>s.VitsTokenizer,Wav2Vec2BertForCTC:()=>t.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>t.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>t.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>t.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>s.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>u.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>t.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>t.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>t.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>t.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>t.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>M.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>M.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>t.WavLMForAudioFrameClassification,WavLMForCTC:()=>t.WavLMForCTC,WavLMForSequenceClassification:()=>t.WavLMForSequenceClassification,WavLMForXVector:()=>t.WavLMForXVector,WavLMModel:()=>t.WavLMModel,WavLMPreTrainedModel:()=>t.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>u.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>t.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>t.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>u.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>t.WhisperForConditionalGeneration,WhisperModel:()=>t.WhisperModel,WhisperPreTrainedModel:()=>t.WhisperPreTrainedModel,WhisperProcessor:()=>M.WhisperProcessor,WhisperTextStreamer:()=>$.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>b.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>s.WhisperTokenizer,XLMForQuestionAnswering:()=>t.XLMForQuestionAnswering,XLMForSequenceClassification:()=>t.XLMForSequenceClassification,XLMForTokenClassification:()=>t.XLMForTokenClassification,XLMModel:()=>t.XLMModel,XLMPreTrainedModel:()=>t.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>t.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>t.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>t.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>t.XLMRobertaForTokenClassification,XLMRobertaModel:()=>t.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>t.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>s.XLMRobertaTokenizer,XLMTokenizer:()=>s.XLMTokenizer,XLMWithLMHeadModel:()=>t.XLMWithLMHeadModel,XVectorOutput:()=>t.XVectorOutput,YolosFeatureExtractor:()=>_.YolosFeatureExtractor,YolosForObjectDetection:()=>t.YolosForObjectDetection,YolosImageProcessor:()=>_.YolosImageProcessor,YolosModel:()=>t.YolosModel,YolosObjectDetectionOutput:()=>t.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>t.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>r.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>r.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>r.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>r.ZeroShotObjectDetectionPipeline,bankers_round:()=>c.bankers_round,cat:()=>l.cat,cos_sim:()=>c.cos_sim,dot:()=>c.dot,dynamic_time_warping:()=>c.dynamic_time_warping,env:()=>e.env,full:()=>l.full,full_like:()=>l.full_like,getKeyValueShapes:()=>o.getKeyValueShapes,hamming:()=>n.hamming,hanning:()=>n.hanning,interpolate:()=>l.interpolate,interpolate_4d:()=>l.interpolate_4d,interpolate_data:()=>c.interpolate_data,is_chinese_char:()=>s.is_chinese_char,layer_norm:()=>l.layer_norm,load_image:()=>i.load_image,load_video:()=>a.load_video,log_softmax:()=>c.log_softmax,magnitude:()=>c.magnitude,matmul:()=>l.matmul,max:()=>c.max,mean:()=>l.mean,mean_pooling:()=>l.mean_pooling,medianFilter:()=>c.medianFilter,mel_filter_bank:()=>n.mel_filter_bank,min:()=>c.min,ones:()=>l.ones,ones_like:()=>l.ones_like,permute:()=>l.permute,permute_data:()=>c.permute_data,pipeline:()=>r.pipeline,quantize_embeddings:()=>l.quantize_embeddings,rand:()=>l.rand,read_audio:()=>n.read_audio,rfft:()=>l.rfft,round:()=>c.round,slice:()=>l.slice,softmax:()=>c.softmax,spectrogram:()=>n.spectrogram,stack:()=>l.stack,std_mean:()=>l.std_mean,topk:()=>l.topk,window_function:()=>n.window_function,zeros:()=>l.zeros,zeros_like:()=>l.zeros_like});var e=Ft("./src/env.js"),r=Ft("./src/pipelines.js"),t=Ft("./src/models.js"),s=Ft("./src/tokenizers.js"),o=Ft("./src/configs.js"),n=Ft("./src/utils/audio.js"),i=Ft("./src/utils/image.js"),a=Ft("./src/utils/video.js"),l=Ft("./src/utils/tensor.js"),c=Ft("./src/utils/maths.js"),p=Ft("./src/base/feature_extraction_utils.js"),u=Ft("./src/models/feature_extractors.js"),h=Ft("./src/models/auto/feature_extraction_auto.js"),g=Ft("./src/base/image_processors_utils.js"),_=Ft("./src/models/image_processors.js"),E=Ft("./src/models/auto/image_processing_auto.js"),I=Ft("./src/base/processing_utils.js"),M=Ft("./src/models/processors.js"),y=Ft("./src/models/auto/processing_auto.js"),$=Ft("./src/generation/streamers.js"),P=Ft("./src/generation/stopping_criteria.js"),b=Ft("./src/generation/logits_process.js")})();f.ASTFeatureExtractor;f.ASTForAudioClassification;f.ASTModel;f.ASTPreTrainedModel;f.AlbertForMaskedLM;f.AlbertForQuestionAnswering;f.AlbertForSequenceClassification;f.AlbertModel;f.AlbertPreTrainedModel;f.AlbertTokenizer;f.AudioClassificationPipeline;f.AutoConfig;f.AutoFeatureExtractor;f.AutoImageProcessor;var Qx=f.AutoModel;f.AutoModelForAudioClassification;f.AutoModelForAudioFrameClassification;f.AutoModelForAudioTextToText;f.AutoModelForCTC;f.AutoModelForCausalLM;f.AutoModelForDepthEstimation;f.AutoModelForDocumentQuestionAnswering;f.AutoModelForImageClassification;f.AutoModelForImageFeatureExtraction;f.AutoModelForImageMatting;f.AutoModelForImageSegmentation;f.AutoModelForImageTextToText;f.AutoModelForImageToImage;f.AutoModelForMaskGeneration;f.AutoModelForMaskedLM;f.AutoModelForNormalEstimation;f.AutoModelForObjectDetection;f.AutoModelForPoseEstimation;f.AutoModelForQuestionAnswering;f.AutoModelForSemanticSegmentation;f.AutoModelForSeq2SeqLM;f.AutoModelForSequenceClassification;f.AutoModelForSpeechSeq2Seq;f.AutoModelForTextToSpectrogram;f.AutoModelForTextToWaveform;f.AutoModelForTokenClassification;f.AutoModelForUniversalSegmentation;f.AutoModelForVision2Seq;f.AutoModelForXVector;f.AutoModelForZeroShotObjectDetection;var Xx=f.AutoProcessor;f.AutoTokenizer;f.AutomaticSpeechRecognitionPipeline;f.BackgroundRemovalPipeline;f.BartForConditionalGeneration;f.BartForSequenceClassification;f.BartModel;f.BartPretrainedModel;f.BartTokenizer;f.BaseModelOutput;f.BaseStreamer;f.BeitFeatureExtractor;f.BeitForImageClassification;f.BeitModel;f.BeitPreTrainedModel;f.BertForMaskedLM;f.BertForQuestionAnswering;f.BertForSequenceClassification;f.BertForTokenClassification;f.BertModel;f.BertPreTrainedModel;f.BertTokenizer;f.BitImageProcessor;f.BlenderbotForConditionalGeneration;f.BlenderbotModel;f.BlenderbotPreTrainedModel;f.BlenderbotSmallForConditionalGeneration;f.BlenderbotSmallModel;f.BlenderbotSmallPreTrainedModel;f.BlenderbotSmallTokenizer;f.BlenderbotTokenizer;f.BloomForCausalLM;f.BloomModel;f.BloomPreTrainedModel;f.BloomTokenizer;f.CLIPFeatureExtractor;f.CLIPImageProcessor;f.CLIPModel;f.CLIPPreTrainedModel;f.CLIPSegForImageSegmentation;f.CLIPSegModel;f.CLIPSegPreTrainedModel;f.CLIPTextModel;f.CLIPTextModelWithProjection;f.CLIPTokenizer;f.CLIPVisionModel;f.CLIPVisionModelWithProjection;f.CamembertForMaskedLM;f.CamembertForQuestionAnswering;f.CamembertForSequenceClassification;f.CamembertForTokenClassification;f.CamembertModel;f.CamembertPreTrainedModel;f.CamembertTokenizer;f.CausalLMOutput;f.CausalLMOutputWithPast;f.ChineseCLIPFeatureExtractor;f.ChineseCLIPModel;f.ChineseCLIPPreTrainedModel;f.ClapAudioModelWithProjection;f.ClapFeatureExtractor;f.ClapModel;f.ClapPreTrainedModel;f.ClapTextModelWithProjection;f.ClassifierFreeGuidanceLogitsProcessor;f.CodeGenForCausalLM;f.CodeGenModel;f.CodeGenPreTrainedModel;f.CodeGenTokenizer;f.CodeLlamaTokenizer;f.CohereForCausalLM;f.CohereModel;f.CoherePreTrainedModel;f.CohereTokenizer;f.ConvBertForMaskedLM;f.ConvBertForQuestionAnswering;f.ConvBertForSequenceClassification;f.ConvBertForTokenClassification;f.ConvBertModel;f.ConvBertPreTrainedModel;f.ConvBertTokenizer;f.ConvNextFeatureExtractor;f.ConvNextForImageClassification;f.ConvNextImageProcessor;f.ConvNextModel;f.ConvNextPreTrainedModel;f.ConvNextV2ForImageClassification;f.ConvNextV2Model;f.ConvNextV2PreTrainedModel;f.DPTFeatureExtractor;f.DPTForDepthEstimation;f.DPTImageProcessor;f.DPTModel;f.DPTPreTrainedModel;f.DacDecoderModel;f.DacDecoderOutput;f.DacEncoderModel;f.DacEncoderOutput;f.DacFeatureExtractor;f.DacModel;f.DacPreTrainedModel;f.DataTypeMap;f.DebertaForMaskedLM;f.DebertaForQuestionAnswering;f.DebertaForSequenceClassification;f.DebertaForTokenClassification;f.DebertaModel;f.DebertaPreTrainedModel;f.DebertaTokenizer;f.DebertaV2ForMaskedLM;f.DebertaV2ForQuestionAnswering;f.DebertaV2ForSequenceClassification;f.DebertaV2ForTokenClassification;f.DebertaV2Model;f.DebertaV2PreTrainedModel;f.DebertaV2Tokenizer;f.DecisionTransformerModel;f.DecisionTransformerPreTrainedModel;f.DeiTFeatureExtractor;f.DeiTForImageClassification;f.DeiTImageProcessor;f.DeiTModel;f.DeiTPreTrainedModel;f.DepthAnythingForDepthEstimation;f.DepthAnythingPreTrainedModel;f.DepthEstimationPipeline;f.DepthProForDepthEstimation;f.DepthProPreTrainedModel;f.DetrFeatureExtractor;f.DetrForObjectDetection;f.DetrForSegmentation;f.DetrImageProcessor;f.DetrModel;f.DetrObjectDetectionOutput;f.DetrPreTrainedModel;f.DetrSegmentationOutput;f.Dinov2ForImageClassification;f.Dinov2Model;f.Dinov2PreTrainedModel;f.Dinov2WithRegistersForImageClassification;f.Dinov2WithRegistersModel;f.Dinov2WithRegistersPreTrainedModel;f.DistilBertForMaskedLM;f.DistilBertForQuestionAnswering;f.DistilBertForSequenceClassification;f.DistilBertForTokenClassification;f.DistilBertModel;f.DistilBertPreTrainedModel;f.DistilBertTokenizer;f.DocumentQuestionAnsweringPipeline;f.DonutFeatureExtractor;f.DonutImageProcessor;f.DonutSwinModel;f.DonutSwinPreTrainedModel;f.EfficientNetForImageClassification;f.EfficientNetImageProcessor;f.EfficientNetModel;f.EfficientNetPreTrainedModel;f.ElectraForMaskedLM;f.ElectraForQuestionAnswering;f.ElectraForSequenceClassification;f.ElectraForTokenClassification;f.ElectraModel;f.ElectraPreTrainedModel;f.ElectraTokenizer;f.EncodecFeatureExtractor;f.EosTokenCriteria;f.EsmForMaskedLM;f.EsmForSequenceClassification;f.EsmForTokenClassification;f.EsmModel;f.EsmPreTrainedModel;f.EsmTokenizer;f.ExaoneForCausalLM;f.ExaoneModel;f.ExaonePreTrainedModel;f.FFT;f.FalconForCausalLM;f.FalconModel;f.FalconPreTrainedModel;f.FalconTokenizer;f.FastViTForImageClassification;f.FastViTModel;f.FastViTPreTrainedModel;f.FeatureExtractionPipeline;f.FeatureExtractor;f.FillMaskPipeline;f.Florence2ForConditionalGeneration;f.Florence2PreTrainedModel;f.Florence2Processor;f.ForcedBOSTokenLogitsProcessor;f.ForcedEOSTokenLogitsProcessor;f.GLPNFeatureExtractor;f.GLPNForDepthEstimation;f.GLPNModel;f.GLPNPreTrainedModel;f.GPT2LMHeadModel;f.GPT2Model;f.GPT2PreTrainedModel;f.GPT2Tokenizer;f.GPTBigCodeForCausalLM;f.GPTBigCodeModel;f.GPTBigCodePreTrainedModel;f.GPTJForCausalLM;f.GPTJModel;f.GPTJPreTrainedModel;f.GPTNeoForCausalLM;f.GPTNeoModel;f.GPTNeoPreTrainedModel;f.GPTNeoXForCausalLM;f.GPTNeoXModel;f.GPTNeoXPreTrainedModel;f.GPTNeoXTokenizer;f.Gemma2ForCausalLM;f.Gemma2Model;f.Gemma2PreTrainedModel;f.Gemma3ForCausalLM;f.Gemma3Model;f.Gemma3PreTrainedModel;f.GemmaForCausalLM;f.GemmaModel;f.GemmaPreTrainedModel;f.GemmaTokenizer;f.GlmForCausalLM;f.GlmModel;f.GlmPreTrainedModel;f.GraniteForCausalLM;f.GraniteModel;f.GranitePreTrainedModel;f.Grok1Tokenizer;f.GroundingDinoForObjectDetection;f.GroundingDinoImageProcessor;f.GroundingDinoPreTrainedModel;f.GroundingDinoProcessor;f.GroupViTModel;f.GroupViTPreTrainedModel;f.HeliumForCausalLM;f.HeliumModel;f.HeliumPreTrainedModel;f.HerbertTokenizer;f.HieraForImageClassification;f.HieraModel;f.HieraPreTrainedModel;f.HubertForCTC;f.HubertForSequenceClassification;f.HubertModel;f.HubertPreTrainedModel;f.IJepaForImageClassification;f.IJepaModel;f.IJepaPreTrainedModel;f.Idefics3ForConditionalGeneration;f.Idefics3ImageProcessor;f.Idefics3PreTrainedModel;f.Idefics3Processor;f.ImageClassificationPipeline;f.ImageFeatureExtractionPipeline;f.ImageFeatureExtractor;f.ImageMattingOutput;f.ImageProcessor;f.ImageSegmentationPipeline;f.ImageToImagePipeline;f.ImageToTextPipeline;f.InterruptableStoppingCriteria;f.JAISLMHeadModel;f.JAISModel;f.JAISPreTrainedModel;f.JinaCLIPImageProcessor;f.JinaCLIPModel;f.JinaCLIPPreTrainedModel;f.JinaCLIPProcessor;f.JinaCLIPTextModel;f.JinaCLIPVisionModel;f.LiteWhisperForConditionalGeneration;f.LlamaForCausalLM;f.LlamaModel;f.LlamaPreTrainedModel;f.LlamaTokenizer;f.LlavaForConditionalGeneration;f.LlavaOnevisionForConditionalGeneration;f.LlavaOnevisionImageProcessor;f.LlavaPreTrainedModel;f.LogitsProcessor;f.LogitsProcessorList;f.LogitsWarper;f.LongT5ForConditionalGeneration;f.LongT5Model;f.LongT5PreTrainedModel;f.M2M100ForConditionalGeneration;f.M2M100Model;f.M2M100PreTrainedModel;f.M2M100Tokenizer;f.MBart50Tokenizer;f.MBartForCausalLM;f.MBartForConditionalGeneration;f.MBartForSequenceClassification;f.MBartModel;f.MBartPreTrainedModel;f.MBartTokenizer;f.MPNetForMaskedLM;f.MPNetForQuestionAnswering;f.MPNetForSequenceClassification;f.MPNetForTokenClassification;f.MPNetModel;f.MPNetPreTrainedModel;f.MPNetTokenizer;f.MT5ForConditionalGeneration;f.MT5Model;f.MT5PreTrainedModel;f.MarianMTModel;f.MarianModel;f.MarianPreTrainedModel;f.MarianTokenizer;f.Mask2FormerImageProcessor;f.MaskFormerFeatureExtractor;f.MaskFormerForInstanceSegmentation;f.MaskFormerImageProcessor;f.MaskFormerModel;f.MaskFormerPreTrainedModel;f.MaskedLMOutput;f.MaxLengthCriteria;f.Metric3DForDepthEstimation;f.Metric3DPreTrainedModel;f.Metric3Dv2ForDepthEstimation;f.Metric3Dv2PreTrainedModel;f.MgpstrForSceneTextRecognition;f.MgpstrModelOutput;f.MgpstrPreTrainedModel;f.MgpstrProcessor;f.MgpstrTokenizer;f.MimiDecoderModel;f.MimiDecoderOutput;f.MimiEncoderModel;f.MimiEncoderOutput;f.MimiModel;f.MimiPreTrainedModel;f.MinLengthLogitsProcessor;f.MinNewTokensLengthLogitsProcessor;f.MistralForCausalLM;f.MistralModel;f.MistralPreTrainedModel;f.MobileBertForMaskedLM;f.MobileBertForQuestionAnswering;f.MobileBertForSequenceClassification;f.MobileBertModel;f.MobileBertPreTrainedModel;f.MobileBertTokenizer;f.MobileLLMForCausalLM;f.MobileLLMModel;f.MobileLLMPreTrainedModel;f.MobileNetV1FeatureExtractor;f.MobileNetV1ForImageClassification;f.MobileNetV1ForSemanticSegmentation;f.MobileNetV1ImageProcessor;f.MobileNetV1Model;f.MobileNetV1PreTrainedModel;f.MobileNetV2FeatureExtractor;f.MobileNetV2ForImageClassification;f.MobileNetV2ForSemanticSegmentation;f.MobileNetV2ImageProcessor;f.MobileNetV2Model;f.MobileNetV2PreTrainedModel;f.MobileNetV3FeatureExtractor;f.MobileNetV3ForImageClassification;f.MobileNetV3ForSemanticSegmentation;f.MobileNetV3ImageProcessor;f.MobileNetV3Model;f.MobileNetV3PreTrainedModel;f.MobileNetV4FeatureExtractor;f.MobileNetV4ForImageClassification;f.MobileNetV4ForSemanticSegmentation;f.MobileNetV4ImageProcessor;f.MobileNetV4Model;f.MobileNetV4PreTrainedModel;f.MobileViTFeatureExtractor;f.MobileViTForImageClassification;f.MobileViTImageProcessor;f.MobileViTModel;f.MobileViTPreTrainedModel;f.MobileViTV2ForImageClassification;f.MobileViTV2Model;f.MobileViTV2PreTrainedModel;f.ModelOutput;f.ModernBertForMaskedLM;f.ModernBertForSequenceClassification;f.ModernBertForTokenClassification;f.ModernBertModel;f.ModernBertPreTrainedModel;f.Moondream1ForConditionalGeneration;f.MoonshineFeatureExtractor;f.MoonshineForConditionalGeneration;f.MoonshineModel;f.MoonshinePreTrainedModel;f.MoonshineProcessor;f.MptForCausalLM;f.MptModel;f.MptPreTrainedModel;f.MultiModalityCausalLM;f.MultiModalityPreTrainedModel;f.MusicgenForCausalLM;f.MusicgenForConditionalGeneration;f.MusicgenModel;f.MusicgenPreTrainedModel;f.NllbTokenizer;f.NoBadWordsLogitsProcessor;f.NoRepeatNGramLogitsProcessor;f.NomicBertModel;f.NomicBertPreTrainedModel;f.NougatImageProcessor;f.NougatTokenizer;f.OPTForCausalLM;f.OPTModel;f.OPTPreTrainedModel;f.ObjectDetectionPipeline;f.Olmo2ForCausalLM;f.Olmo2Model;f.Olmo2PreTrainedModel;f.OlmoForCausalLM;f.OlmoModel;f.OlmoPreTrainedModel;f.OpenELMForCausalLM;f.OpenELMModel;f.OpenELMPreTrainedModel;f.OwlViTFeatureExtractor;f.OwlViTForObjectDetection;f.OwlViTImageProcessor;f.OwlViTModel;f.OwlViTPreTrainedModel;f.OwlViTProcessor;f.Owlv2ForObjectDetection;f.Owlv2ImageProcessor;f.Owlv2Model;f.Owlv2PreTrainedModel;f.PaliGemmaForConditionalGeneration;f.PaliGemmaPreTrainedModel;f.PaliGemmaProcessor;f.PatchTSMixerForPrediction;f.PatchTSMixerModel;f.PatchTSMixerPreTrainedModel;f.PatchTSTForPrediction;f.PatchTSTModel;f.PatchTSTPreTrainedModel;f.Phi3ForCausalLM;f.Phi3Model;f.Phi3PreTrainedModel;f.Phi3VForCausalLM;f.Phi3VImageProcessor;f.Phi3VPreTrainedModel;f.Phi3VProcessor;f.PhiForCausalLM;f.PhiModel;f.PhiPreTrainedModel;f.Pipeline;f.PreTrainedModel;f.PreTrainedTokenizer;f.PretrainedConfig;f.PretrainedMixin;f.Processor;f.PvtForImageClassification;f.PvtImageProcessor;f.PvtModel;f.PvtPreTrainedModel;f.PyAnnoteFeatureExtractor;f.PyAnnoteForAudioFrameClassification;f.PyAnnoteModel;f.PyAnnotePreTrainedModel;f.PyAnnoteProcessor;f.QuestionAnsweringModelOutput;f.QuestionAnsweringPipeline;f.Qwen2ForCausalLM;f.Qwen2Model;f.Qwen2PreTrainedModel;f.Qwen2Tokenizer;f.Qwen2VLForConditionalGeneration;f.Qwen2VLImageProcessor;f.Qwen2VLPreTrainedModel;f.Qwen2VLProcessor;f.RFDetrForObjectDetection;f.RFDetrModel;f.RFDetrObjectDetectionOutput;f.RFDetrPreTrainedModel;f.RTDetrForObjectDetection;f.RTDetrImageProcessor;f.RTDetrModel;f.RTDetrObjectDetectionOutput;f.RTDetrPreTrainedModel;f.RTDetrV2ForObjectDetection;f.RTDetrV2Model;f.RTDetrV2ObjectDetectionOutput;f.RTDetrV2PreTrainedModel;f.RawAudio;var Qw=f.RawImage;f.RawVideo;f.RawVideoFrame;f.RepetitionPenaltyLogitsProcessor;f.ResNetForImageClassification;f.ResNetModel;f.ResNetPreTrainedModel;f.RoFormerForMaskedLM;f.RoFormerForQuestionAnswering;f.RoFormerForSequenceClassification;f.RoFormerForTokenClassification;f.RoFormerModel;f.RoFormerPreTrainedModel;f.RoFormerTokenizer;f.RobertaForMaskedLM;f.RobertaForQuestionAnswering;f.RobertaForSequenceClassification;f.RobertaForTokenClassification;f.RobertaModel;f.RobertaPreTrainedModel;f.RobertaTokenizer;f.SamImageProcessor;f.SamImageSegmentationOutput;f.SamModel;f.SamPreTrainedModel;f.SamProcessor;f.SapiensForDepthEstimation;f.SapiensForNormalEstimation;f.SapiensForSemanticSegmentation;f.SapiensPreTrainedModel;f.SeamlessM4TFeatureExtractor;f.SegformerFeatureExtractor;f.SegformerForImageClassification;f.SegformerForSemanticSegmentation;f.SegformerImageProcessor;f.SegformerModel;f.SegformerPreTrainedModel;f.Seq2SeqLMOutput;f.SequenceClassifierOutput;f.SiglipImageProcessor;f.SiglipModel;f.SiglipPreTrainedModel;f.SiglipTextModel;f.SiglipTokenizer;f.SiglipVisionModel;f.SmolVLMForConditionalGeneration;f.SmolVLMImageProcessor;f.SmolVLMProcessor;f.SnacDecoderModel;f.SnacEncoderModel;f.SnacFeatureExtractor;f.SnacModel;f.SnacPreTrainedModel;f.SpeechT5FeatureExtractor;f.SpeechT5ForSpeechToText;f.SpeechT5ForTextToSpeech;f.SpeechT5HifiGan;f.SpeechT5Model;f.SpeechT5PreTrainedModel;f.SpeechT5Processor;f.SpeechT5Tokenizer;f.SqueezeBertForMaskedLM;f.SqueezeBertForQuestionAnswering;f.SqueezeBertForSequenceClassification;f.SqueezeBertModel;f.SqueezeBertPreTrainedModel;f.SqueezeBertTokenizer;f.StableLmForCausalLM;f.StableLmModel;f.StableLmPreTrainedModel;f.Starcoder2ForCausalLM;f.Starcoder2Model;f.Starcoder2PreTrainedModel;f.StoppingCriteria;f.StoppingCriteriaList;f.StyleTextToSpeech2Model;f.StyleTextToSpeech2PreTrainedModel;f.SummarizationPipeline;f.SuppressTokensAtBeginLogitsProcessor;f.Swin2SRForImageSuperResolution;f.Swin2SRImageProcessor;f.Swin2SRModel;f.Swin2SRPreTrainedModel;f.SwinForImageClassification;f.SwinForSemanticSegmentation;f.SwinModel;f.SwinPreTrainedModel;f.T5ForConditionalGeneration;f.T5Model;f.T5PreTrainedModel;f.T5Tokenizer;f.TableTransformerForObjectDetection;f.TableTransformerModel;f.TableTransformerObjectDetectionOutput;f.TableTransformerPreTrainedModel;f.TemperatureLogitsWarper;f.Tensor;f.Text2TextGenerationPipeline;f.TextClassificationPipeline;f.TextGenerationPipeline;f.TextStreamer;f.TextToAudioPipeline;f.TokenClassificationPipeline;f.TokenClassifierOutput;f.TokenizerModel;f.TopKLogitsWarper;f.TopPLogitsWarper;f.TrOCRForCausalLM;f.TrOCRPreTrainedModel;f.TranslationPipeline;f.UltravoxModel;f.UltravoxPreTrainedModel;f.UltravoxProcessor;f.UniSpeechForCTC;f.UniSpeechForSequenceClassification;f.UniSpeechModel;f.UniSpeechPreTrainedModel;f.UniSpeechSatForAudioFrameClassification;f.UniSpeechSatForCTC;f.UniSpeechSatForSequenceClassification;f.UniSpeechSatModel;f.UniSpeechSatPreTrainedModel;f.VLChatProcessor;f.VLMImageProcessor;f.ViTFeatureExtractor;f.ViTForImageClassification;f.ViTImageProcessor;f.ViTMAEModel;f.ViTMAEPreTrainedModel;f.ViTMSNForImageClassification;f.ViTMSNModel;f.ViTMSNPreTrainedModel;f.ViTModel;f.ViTPreTrainedModel;f.VisionEncoderDecoderModel;f.VitMatteForImageMatting;f.VitMatteImageProcessor;f.VitMattePreTrainedModel;f.VitPoseForPoseEstimation;f.VitPoseImageProcessor;f.VitPosePreTrainedModel;f.VitsModel;f.VitsModelOutput;f.VitsPreTrainedModel;f.VitsTokenizer;f.Wav2Vec2BertForCTC;f.Wav2Vec2BertForSequenceClassification;f.Wav2Vec2BertModel;f.Wav2Vec2BertPreTrainedModel;f.Wav2Vec2CTCTokenizer;f.Wav2Vec2FeatureExtractor;f.Wav2Vec2ForAudioFrameClassification;f.Wav2Vec2ForCTC;f.Wav2Vec2ForSequenceClassification;f.Wav2Vec2Model;f.Wav2Vec2PreTrainedModel;f.Wav2Vec2Processor;f.Wav2Vec2ProcessorWithLM;f.WavLMForAudioFrameClassification;f.WavLMForCTC;f.WavLMForSequenceClassification;f.WavLMForXVector;f.WavLMModel;f.WavLMPreTrainedModel;f.WeSpeakerFeatureExtractor;f.WeSpeakerResNetModel;f.WeSpeakerResNetPreTrainedModel;f.WhisperFeatureExtractor;f.WhisperForConditionalGeneration;f.WhisperModel;f.WhisperPreTrainedModel;f.WhisperProcessor;f.WhisperTextStreamer;f.WhisperTimeStampLogitsProcessor;f.WhisperTokenizer;f.XLMForQuestionAnswering;f.XLMForSequenceClassification;f.XLMForTokenClassification;f.XLMModel;f.XLMPreTrainedModel;f.XLMRobertaForMaskedLM;f.XLMRobertaForQuestionAnswering;f.XLMRobertaForSequenceClassification;f.XLMRobertaForTokenClassification;f.XLMRobertaModel;f.XLMRobertaPreTrainedModel;f.XLMRobertaTokenizer;f.XLMTokenizer;f.XLMWithLMHeadModel;f.XVectorOutput;f.YolosFeatureExtractor;f.YolosForObjectDetection;f.YolosImageProcessor;f.YolosModel;f.YolosObjectDetectionOutput;f.YolosPreTrainedModel;f.ZeroShotAudioClassificationPipeline;f.ZeroShotClassificationPipeline;f.ZeroShotImageClassificationPipeline;f.ZeroShotObjectDetectionPipeline;f.bankers_round;f.cat;f.cos_sim;f.dot;f.dynamic_time_warping;var Jx=f.env;f.full;f.full_like;f.getKeyValueShapes;f.hamming;f.hanning;f.interpolate;f.interpolate_4d;f.interpolate_data;f.is_chinese_char;f.layer_norm;f.load_image;f.load_video;f.log_softmax;f.magnitude;f.matmul;f.max;f.mean;f.mean_pooling;f.medianFilter;f.mel_filter_bank;f.min;f.ones;f.ones_like;f.permute;f.permute_data;f.pipeline;f.quantize_embeddings;f.rand;f.read_audio;f.rfft;f.round;f.slice;f.softmax;f.spectrogram;f.stack;f.std_mean;f.topk;f.window_function;f.zeros;f.zeros_like;async function Yx(){try{if(Zx())return{supported:!1,isNode:!0,reason:"",fp16Supported:!1};if(typeof navigator>"u"||!navigator.gpu)return{supported:!1,isNode:!1,reason:"WebGPU is not available (navigator.gpu is undefined)",fp16Supported:!1};const e=await navigator.gpu.requestAdapter();return e?{supported:!0,isNode:!1,reason:"",adapter:e,fp16Supported:e.features.has("shader-f16")}:{supported:!1,isNode:!1,reason:"WebGPU is not supported (no adapter found)",fp16Supported:!1}}catch(e){return{supported:!1,isNode:!1,reason:e instanceof Error?e.toString():String(e),fp16Supported:!1}}}function Zx(){return typeof process<"u"&&"versions"in process&&process.versions!=null&&typeof process.versions=="object"&&"node"in process.versions&&process.versions.node!=null}const eT={flex:"","flex-col":"","items-center":"","gap-4":""},tT=["disabled"],rT={"h-full":"","w-full":"",flex:"","gap-2":""},sT={w:"[50%]",border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","min-h":"120",h:"auto","overflow-hidden":"","rounded-lg":""},nT=["src"],oT={w:"[50%]",border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","min-h":"120",h:"auto",relative:"","overflow-hidden":"","rounded-lg":""},iT={key:0,bg:"black/50",absolute:"","inset-0":"","z-10":"",flex:"","flex-col":"","items-center":"","justify-center":""},aT={"mb-4":"","text-white":"","font-medium":""},lT={bg:"gray-200/30",w:"70%","h-2":"","overflow-hidden":"","rounded-full":""},dT=["src"],cT={bg:"black/0 group-hover:black/20",absolute:"","inset-0":"",flex:"","items-center":"","justify-center":"","transition-all":"","duration-200":""},uT=["onClick"],pT={key:1,absolute:"","bottom-2":"","right-2":""},wT=rv({__name:"background-remove",setup(e){const r=Ns(),t=Ns(),s=Ns(),o=Ns(),n=Ns(!1),i=Ns(0),a=Ns(),l=Ns(),c=Ns([]),p=sv(()=>c.value.map(_=>URL.createObjectURL(_)));nv(async()=>{try{if(!(await Yx()).supported)throw new Error("WebGPU is not supported in this browser.");const _="Xenova/modnet";Jx.backends.onnx.wasm.proxy=!1,r.value??(r.value=await Qx.from_pretrained(_,{device:"webgpu"})),t.value??(t.value=await Xx.from_pretrained(_,{}))}catch(_){s.value=_}o.value=!1});async function u(){if(!r.value||!t.value)return;n.value=!0,i.value=0,a.value=[];const _=p.value.length;for(let E=0;E<_;++E){const I=await Qw.fromURL(p.value[E]),{pixel_values:M}=await t.value(I),{output:y}=await r.value({input:M}),$=(await Qw.fromTensor(y[0].mul(255).to("uint8")).resize(I.width,I.height)).data,P=document.createElement("canvas");P.width=I.width,P.height=I.height;const b=P.getContext("2d");if(!b)return;b.drawImage(I.toCanvas(),0,0);const w=b.getImageData(0,0,I.width,I.height);for(let T=0;T<$.length;++T)w.data[4*T+3]=$[T];b.putImageData(w,0,0),a.value.push(P.toDataURL("image/png")),i.value=Math.round((E+1)/_*100)}n.value=!1,l.value=!0}function h(_){if(!a.value||_>=a.value.length||!c.value[_])return;const E=c.value[_].name,I=E.substring(0,E.lastIndexOf("."))||E,M=E.substring(E.lastIndexOf("."))||".png",y=`${I}-background-removed${M}`,$=document.createElement("a");$.href=a.value[_],$.download=y,document.body.appendChild($),$.click(),document.body.removeChild($)}function g(){!a.value||a.value.length===0||a.value.forEach((_,E)=>{setTimeout(()=>h(E),E*100)})}return(_,E)=>(Tn(),xn("div",eT,[Ar("button",{bg:"neutral-100 dark:neutral-800","w-full":"","cursor-pointer":"","rounded-lg":"","px-3":"","py-2":"",disabled:n.value,onClick:u},uf(n.value?"Processing...":"Process"),9,tT),Ar("div",rT,[Ar("div",sT,[(Tn(!0),xn(pf,null,hf(p.value,(I,M)=>(Tn(),xn("img",{key:M,src:I,"h-full":"","w-full":"","object-cover":""},null,8,nT))),128))]),Ar("div",oT,[n.value?(Tn(),xn("div",iT,[Ar("div",aT,uf(i.value)+"% ",1),Ar("div",lT,[Ar("div",{bg:"emerald-500","h-full":"",style:iv({width:`${i.value}%`}),"transition-all":"","duration-200":""},null,4)])])):mf("",!0),(Tn(!0),xn(pf,null,hf(a.value,(I,M)=>(Tn(),xn("div",{key:M,relative:"",class:"group","h-full":"","w-full":""},[Ar("img",{src:I,"h-full":"","w-full":"","object-cover":""},null,8,dT),Ar("div",cT,[Ar("button",{bg:"emerald-500 hover:emerald-600","rounded-full":"","p-2":"","text-white":"","opacity-0":"","transition-all":"","duration-200":"","group-hover:opacity-100":"",onClick:y=>h(M)},E[1]||(E[1]=[Ar("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[Ar("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})],-1)]),8,uT)])]))),128)),a.value&&a.value.length>1?(Tn(),xn("div",pT,[Ar("button",{bg:"emerald-500 hover:emerald-600","rounded-full":"","p-2":"","text-white":"",onClick:g},E[2]||(E[2]=[Ar("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[Ar("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})],-1)]))])):mf("",!0)])]),ov(av(tv),{modelValue:c.value,"onUpdate:modelValue":E[0]||(E[0]=I=>c.value=I),"w-full":""},null,8,["modelValue"])]))}});export{wT as default}; diff --git a/assets/background-remove-xa-QFjKj.js b/assets/background-remove-xa-QFjKj.js new file mode 100644 index 0000000000000000000000000000000000000000..d4a5b7de90fd906b08fccb5b93a2f10391353b8f --- /dev/null +++ b/assets/background-remove-xa-QFjKj.js @@ -0,0 +1,2887 @@ +var uv=Object.defineProperty;var dv=(e,r,t)=>r in e?uv(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var te=(e,r,t)=>dv(e,typeof r!="symbol"?r+"":r,t);import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as cv}from"./InputFile.vue_vue_type_script_setup_true_lang-aVfE3xzX.js";import{d as pv,g as ks,h as hv,l as mv,c as Tn,o as En,a as Sr,b as fv,D as wf,bx as bf,by as Mf,C as yf,n as _v,u as gv}from"./index-D8Nm21zW.js";const la=new Map,kn=[],wv=(e,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){const s=la.get(e);if(s===void 0)la.set(e,{backend:r,priority:t});else{if(s.priority>t)return;if(s.priority===t&&s.backend!==r)throw new Error(`cannot register backend "${e}" using priority ${t}`)}if(t>=0){const o=kn.indexOf(e);o!==-1&&kn.splice(o,1);for(let n=0;n{const r=la.get(e);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{const t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(e)),await r.initPromise,r.initialized=!0,r.backend}catch(s){return t||(r.error=`${s}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},Mv=async e=>{const r=e.executionProviders||[],t=r.map(l=>typeof l=="string"?l:l.name),s=t.length===0?kn:t;let o;const n=[],i=new Set;for(const l of s){const u=await bv(l);typeof u=="string"?n.push({name:l,err:u}):(o||(o=u),o===u&&i.add(l))}if(!o)throw new Error(`no available backend found. ERR: ${n.map(l=>`[${l.name}] ${l.err}`).join(", ")}`);for(const{name:l,err:u}of n)t.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${u}`);const a=r.filter(l=>i.has(typeof l=="string"?l:l.name));return[o,new Proxy(e,{get:(l,u)=>u==="executionProviders"?a:Reflect.get(l,u)})]},yv="1.21.0";let vf="warning";const ms={wasm:{},webgl:{},webgpu:{},versions:{common:yv},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}`);vf=e}},get logLevel(){return vf}};Object.defineProperty(ms,"logLevel",{enumerable:!0});const vv=ms,xv=(e,r)=>{const t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=e.dims[3],t.height=e.dims[2];const s=t.getContext("2d");if(s!=null){let o,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[3]):(o=e.dims[3],n=e.dims[2]);const i=(r==null?void 0:r.format)!==void 0?r.format:"RGB",a=r==null?void 0:r.norm;let l,u;a===void 0||a.mean===void 0?l=[255,255,255,255]:typeof a.mean=="number"?l=[a.mean,a.mean,a.mean,a.mean]:(l=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(l[3]=a.mean[3])),a===void 0||a.bias===void 0?u=[0,0,0,0]:typeof a.bias=="number"?u=[a.bias,a.bias,a.bias,a.bias]:(u=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(u[3]=a.bias[3]));const p=n*o;let d=0,c=p,_=p*2,f=-1;i==="RGBA"?(d=0,c=p,_=p*2,f=p*3):i==="RGB"?(d=0,c=p,_=p*2):i==="RBG"&&(d=0,_=p,c=p*2);for(let v=0;v{const t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d");let s;if(t!=null){let o,n,i;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[1],i=e.dims[3]):(o=e.dims[3],n=e.dims[2],i=e.dims[1]);const a=r!==void 0&&r.format!==void 0?r.format:"RGB",l=r==null?void 0:r.norm;let u,p;l===void 0||l.mean===void 0?u=[255,255,255,255]:typeof l.mean=="number"?u=[l.mean,l.mean,l.mean,l.mean]:(u=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(u[3]=l.mean[3])),l===void 0||l.bias===void 0?p=[0,0,0,0]:typeof l.bias=="number"?p=[l.bias,l.bias,l.bias,l.bias]:(p=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(p[3]=l.bias[3]));const d=n*o;if(r!==void 0&&(r.format!==void 0&&i===4&&r.format!=="RGBA"||i===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");const c=4;let _=0,f=1,v=2,$=3,w=0,g=d,C=d*2,E=-1;a==="RGBA"?(w=0,g=d,C=d*2,E=d*3):a==="RGB"?(w=0,g=d,C=d*2):a==="RBG"&&(w=0,C=d,g=d*2),s=t.createImageData(o,n);for(let y=0;y{if(e===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");const{height:t,width:s}=r,o=r.norm??{mean:255,bias:0};let n,i;typeof o.mean=="number"?n=[o.mean,o.mean,o.mean,o.mean]:n=[o.mean[0],o.mean[1],o.mean[2],o.mean[3]??255],typeof o.bias=="number"?i=[o.bias,o.bias,o.bias,o.bias]:i=[o.bias[0],o.bias[1],o.bias[2],o.bias[3]??0];const a=r.format!==void 0?r.format:"RGBA",l=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",u=t*s,p=l==="RGBA"?new Float32Array(u*4):new Float32Array(u*3);let d=4,c=0,_=1,f=2,v=3,$=0,w=u,g=u*2,C=-1;a==="RGB"&&(d=3,c=0,_=1,f=2,v=-1),l==="RGBA"?C=u*3:l==="RBG"?($=0,g=u,w=u*2):l==="BGR"&&(g=0,w=u,$=u*2);for(let y=0;y{const t=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,s=typeof ImageData<"u"&&e instanceof ImageData,o=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string";let i,a=r??{};const l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},u=p=>typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||p instanceof OffscreenCanvas?p.getContext("2d"):null;if(t){const p=l();p.width=e.width,p.height=e.height;const d=u(p);if(d!=null){let c=e.height,_=e.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(c=r.resizedHeight,_=r.resizedWidth),r!==void 0){if(a=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");a.tensorFormat="RGBA",a.height=c,a.width=_}else a.tensorFormat="RGBA",a.height=c,a.width=_;d.drawImage(e,0,0),i=d.getImageData(0,0,_,c).data}else throw new Error("Can not access image data")}else if(s){let p,d;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(p=r.resizedHeight,d=r.resizedWidth):(p=e.height,d=e.width),r!==void 0&&(a=r),a.format="RGBA",a.height=p,a.width=d,r!==void 0){const c=l();c.width=d,c.height=p;const _=u(c);if(_!=null)_.putImageData(e,0,0),i=_.getImageData(0,0,d,p).data;else throw new Error("Can not access image data")}else i=e.data}else if(o){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");const p=l();p.width=e.width,p.height=e.height;const d=u(p);if(d!=null){const c=e.height,_=e.width;return d.drawImage(e,0,0,_,c),i=d.getImageData(0,0,_,c).data,a.height=c,a.width=_,kl(i,a)}else throw new Error("Can not access image data")}else{if(n)return new Promise((p,d)=>{const c=l(),_=u(c);if(!e||!_)return d();const f=new Image;f.crossOrigin="Anonymous",f.src=e,f.onload=()=>{c.width=f.width,c.height=f.height,_.drawImage(f,0,0,c.width,c.height);const v=_.getImageData(0,0,c.width,c.height);a.height=c.height,a.width=c.width,p(kl(v.data,a))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(i!==void 0)return kl(i,a);throw new Error("Input data provided is not supported - aborted tensor creation")},Pv=(e,r)=>{const{width:t,height:s,download:o,dispose:n}=r,i=[1,s,t,4];return new Qr({location:"texture",type:"float32",texture:e,dims:i,download:o,dispose:n})},Cv=(e,r)=>{const{dataType:t,dims:s,download:o,dispose:n}=r;return new Qr({location:"gpu-buffer",type:t??"float32",gpuBuffer:e,dims:s,download:o,dispose:n})},Sv=(e,r)=>{const{dataType:t,dims:s,download:o,dispose:n}=r;return new Qr({location:"ml-tensor",type:t??"float32",mlTensor:e,dims:s,download:o,dispose:n})},$v=(e,r,t)=>new Qr({location:"cpu-pinned",type:e,data:r,dims:t??[r.length]}),so=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),ua=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);let xf=!1;const kv=()=>{if(!xf){xf=!0;const e=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=globalThis.Float16Array,s=typeof t<"u"&&t.from;e&&(so.set("int64",BigInt64Array),ua.set(BigInt64Array,"int64")),r&&(so.set("uint64",BigUint64Array),ua.set(BigUint64Array,"uint64")),s?(so.set("float16",t),ua.set(t,"float16")):so.set("float16",Uint16Array)}},Iv=e=>{let r=1;for(let t=0;t{switch(e.location){case"cpu":return new Qr(e.type,e.data,r);case"cpu-pinned":return new Qr({location:"cpu-pinned",data:e.data,type:e.type,dims:r});case"texture":return new Qr({location:"texture",texture:e.texture,type:e.type,dims:r});case"gpu-buffer":return new Qr({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:r});case"ml-tensor":return new Qr({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}};let Qr=class{constructor(r,t,s){kv();let o,n;if(typeof r=="object"&&"location"in r)switch(this.dataLocation=r.location,o=r.type,n=r.dims,r.location){case"cpu-pinned":{const a=so.get(o);if(!a)throw new TypeError(`unsupported type "${o}" to create tensor from pinned buffer`);if(!(r.data instanceof a))throw new TypeError(`buffer should be of type ${a.name}`);this.cpuData=r.data;break}case"texture":{if(o!=="float32")throw new TypeError(`unsupported type "${o}" to create tensor from texture`);this.gpuTextureData=r.texture,this.downloader=r.download,this.disposer=r.dispose;break}case"gpu-buffer":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint8"&&o!=="bool"&&o!=="uint4"&&o!=="int4")throw new TypeError(`unsupported type "${o}" to create tensor from gpu buffer`);this.gpuBufferData=r.gpuBuffer,this.downloader=r.download,this.disposer=r.dispose;break}case"ml-tensor":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint64"&&o!=="int8"&&o!=="uint8"&&o!=="bool"&&o!=="uint4"&&o!=="int4")throw new TypeError(`unsupported type "${o}" to create tensor from MLTensor`);this.mlTensorData=r.mlTensor,this.downloader=r.download,this.disposer=r.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,l;if(typeof r=="string")if(o=r,l=s,r==="string"){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");a=t}else{const u=so.get(r);if(u===void 0)throw new TypeError(`Unsupported tensor type: ${r}.`);if(Array.isArray(t)){if(r==="float16"&&u===Uint16Array||r==="uint4"||r==="int4")throw new TypeError(`Creating a ${r} tensor from number array is not supported. Please use ${u.name} as data.`);r==="uint64"||r==="int64"?a=u.from(t,BigInt):a=u.from(t)}else if(t instanceof u)a=t;else if(t instanceof Uint8ClampedArray)if(r==="uint8")a=Uint8Array.from(t);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(r==="float16"&&t instanceof Uint16Array&&u!==Uint16Array)a=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw new TypeError(`A ${o} tensor's data must be type of ${u}`)}else if(l=t,Array.isArray(r)){if(r.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");const u=typeof r[0];if(u==="string")o="string",a=r;else if(u==="boolean")o="bool",a=Uint8Array.from(r);else throw new TypeError(`Invalid element type of data array: ${u}.`)}else if(r instanceof Uint8ClampedArray)o="uint8",a=Uint8Array.from(r);else{const u=ua.get(r.constructor);if(u===void 0)throw new TypeError(`Unsupported type for tensor data: ${r.constructor}.`);o=u,a=r}if(l===void 0)l=[a.length];else if(!Array.isArray(l))throw new TypeError("A tensor's dims must be a number array");n=l,this.cpuData=a,this.dataLocation="cpu"}const i=Iv(n);if(this.cpuData&&i!==this.cpuData.length&&!((o==="uint4"||o==="int4")&&Math.ceil(i/2)===this.cpuData.length))throw new Error(`Tensor's size(${i}) does not match data length(${this.cpuData.length}).`);this.type=o,this.dims=n,this.size=i}static async fromImage(r,t){return Ev(r,t)}static fromTexture(r,t){return Pv(r,t)}static fromGpuBuffer(r,t){return Cv(r,t)}static fromMLTensor(r,t){return Sv(r,t)}static fromPinnedBuffer(r,t,s){return $v(r,t,s)}toDataURL(r){return xv(this,r)}toImageData(r){return Tv(this,r)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(r){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;const t=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=t,r&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(r){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Av(this,r)}};const to=Qr,nb=(e,r)=>{(typeof ms.trace>"u"?!ms.wasm.trace:!ms.trace)||console.timeStamp(`${e}::ORT::${r}`)},ob=(e,r)=>{var o;const t=((o=new Error().stack)==null?void 0:o.split(/\r\n|\r|\n/g))||[];let s=!1;for(let n=0;n{(typeof ms.trace>"u"?!ms.wasm.trace:!ms.trace)||ob("BEGIN",e)},Iu=e=>{(typeof ms.trace>"u"?!ms.wasm.trace:!ms.trace)||ob("END",e)};let Fv=class ib{constructor(r){this.handler=r}async run(r,t,s){ku();const o={};let n={};if(typeof r!="object"||r===null||r instanceof to||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let i=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof to)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");i=!1;for(const u of t){if(typeof u!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(u)===-1)throw new RangeError(`'fetches' contains invalid output name: ${u}.`);o[u]=null}if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else{let u=!1;const p=Object.getOwnPropertyNames(t);for(const d of this.outputNames)if(p.indexOf(d)!==-1){const c=t[d];(c===null||c instanceof to)&&(u=!0,i=!1,o[d]=c)}if(u){if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else n=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(const u of this.inputNames)if(typeof r[u]>"u")throw new Error(`input '${u}' is missing in 'feeds'.`);if(i)for(const u of this.outputNames)o[u]=null;const a=await this.handler.run(r,o,n),l={};for(const u in a)if(Object.hasOwnProperty.call(a,u)){const p=a[u];p instanceof to?l[u]=p:l[u]=new to(p.type,p.data,p.dims)}return Iu(),l}async release(){return this.handler.dispose()}static async create(r,t,s,o){ku();let n,i={};if(typeof r=="string"){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){const p=r;let d=0,c=r.byteLength;if(typeof t=="object"&&t!==null)i=t;else if(typeof t=="number"){if(d=t,!Number.isSafeInteger(d))throw new RangeError("'byteOffset' must be an integer.");if(d<0||d>=p.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${p.byteLength}).`);if(c=r.byteLength-d,typeof s=="number"){if(c=s,!Number.isSafeInteger(c))throw new RangeError("'byteLength' must be an integer.");if(c<=0||d+c>p.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${p.byteLength-d}].`);if(typeof o=="object"&&o!==null)i=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof s<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(p,d,c)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const[a,l]=await Mv(i),u=await a.createInferenceSessionHandler(n,l);return Iu(),new ib(u)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}};const Ov=Fv,Dv=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession:Ov,TRACE:nb,TRACE_FUNC_BEGIN:ku,TRACE_FUNC_END:Iu,Tensor:to,env:vv,registerBackend:wv},Symbol.toStringTag,{value:"Module"}));/*! + * ONNX Runtime Web v1.22.0-dev.20250409-89f8206ba4 + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */var qu=Object.defineProperty,Lv=Object.getOwnPropertyDescriptor,zv=Object.getOwnPropertyNames,Bv=Object.prototype.hasOwnProperty,Rv=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Re=(e,r)=>()=>(e&&(r=e(e=0)),r),ao=(e,r)=>{for(var t in r)qu(e,t,{get:r[t],enumerable:!0})},jv=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of zv(r))!Bv.call(e,o)&&o!==t&&qu(e,o,{get:()=>r[o],enumerable:!(s=Lv(r,o))||s.enumerable});return e},Jo=e=>jv(qu({},"__esModule",{value:!0}),e),Lo,Hs,Fn,Tf,ab,lb=Re(()=>{Lo=new Map,Hs=[],Fn=(e,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){let s=Lo.get(e);if(s===void 0)Lo.set(e,{backend:r,priority:t});else{if(s.priority>t)return;if(s.priority===t&&s.backend!==r)throw new Error(`cannot register backend "${e}" using priority ${t}`)}if(t>=0){let o=Hs.indexOf(e);o!==-1&&Hs.splice(o,1);for(let n=0;n{let r=Lo.get(e);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{let t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(e)),await r.initPromise,r.initialized=!0,r.backend}catch(s){return t||(r.error=`${s}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},ab=async e=>{let r=e.executionProviders||[],t=r.map(l=>typeof l=="string"?l:l.name),s=t.length===0?Hs:t,o,n=[],i=new Set;for(let l of s){let u=await Tf(l);typeof u=="string"?n.push({name:l,err:u}):(o||(o=u),o===u&&i.add(l))}if(!o)throw new Error(`no available backend found. ERR: ${n.map(l=>`[${l.name}] ${l.err}`).join(", ")}`);for(let{name:l,err:u}of n)t.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${u}`);let a=r.filter(l=>i.has(typeof l=="string"?l:l.name));return[o,new Proxy(e,{get:(l,u)=>u==="executionProviders"?a:Reflect.get(l,u)})]}}),Nv=Re(()=>{lb()}),ub,Vv=Re(()=>{ub="1.22.0-dev.20250409-89f8206ba4"}),Il,Xr,db=Re(()=>{Vv(),Il="warning",Xr={wasm:{},webgl:{},webgpu:{},versions:{common:ub},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}`);Il=e}},get logLevel(){return Il}},Object.defineProperty(Xr,"logLevel",{enumerable:!0})}),jt,Uv=Re(()=>{db(),jt=Xr}),cb,pb,Wv=Re(()=>{cb=(e,r)=>{let t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=e.dims[3],t.height=e.dims[2];let s=t.getContext("2d");if(s!=null){let o,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[3]):(o=e.dims[3],n=e.dims[2]);let i=(r==null?void 0:r.format)!==void 0?r.format:"RGB",a=r==null?void 0:r.norm,l,u;a===void 0||a.mean===void 0?l=[255,255,255,255]:typeof a.mean=="number"?l=[a.mean,a.mean,a.mean,a.mean]:(l=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(l[3]=a.mean[3])),a===void 0||a.bias===void 0?u=[0,0,0,0]:typeof a.bias=="number"?u=[a.bias,a.bias,a.bias,a.bias]:(u=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(u[3]=a.bias[3]));let p=n*o,d=0,c=p,_=p*2,f=-1;i==="RGBA"?(d=0,c=p,_=p*2,f=p*3):i==="RGB"?(d=0,c=p,_=p*2):i==="RBG"&&(d=0,_=p,c=p*2);for(let v=0;v{let t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),s;if(t!=null){let o,n,i;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[1],i=e.dims[3]):(o=e.dims[3],n=e.dims[2],i=e.dims[1]);let a=r!==void 0&&r.format!==void 0?r.format:"RGB",l=r==null?void 0:r.norm,u,p;l===void 0||l.mean===void 0?u=[255,255,255,255]:typeof l.mean=="number"?u=[l.mean,l.mean,l.mean,l.mean]:(u=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(u[3]=l.mean[3])),l===void 0||l.bias===void 0?p=[0,0,0,0]:typeof l.bias=="number"?p=[l.bias,l.bias,l.bias,l.bias]:(p=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(p[3]=l.bias[3]));let d=n*o;if(r!==void 0&&(r.format!==void 0&&i===4&&r.format!=="RGBA"||i===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let c=4,_=0,f=1,v=2,$=3,w=0,g=d,C=d*2,E=-1;a==="RGBA"?(w=0,g=d,C=d*2,E=d*3):a==="RGB"?(w=0,g=d,C=d*2):a==="RBG"&&(w=0,C=d,g=d*2),s=t.createImageData(o,n);for(let y=0;y{Xu(),qi=(e,r)=>{if(e===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:t,width:s}=r,o=r.norm??{mean:255,bias:0},n,i;typeof o.mean=="number"?n=[o.mean,o.mean,o.mean,o.mean]:n=[o.mean[0],o.mean[1],o.mean[2],o.mean[3]??255],typeof o.bias=="number"?i=[o.bias,o.bias,o.bias,o.bias]:i=[o.bias[0],o.bias[1],o.bias[2],o.bias[3]??0];let a=r.format!==void 0?r.format:"RGBA",l=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",u=t*s,p=l==="RGBA"?new Float32Array(u*4):new Float32Array(u*3),d=4,c=0,_=1,f=2,v=3,$=0,w=u,g=u*2,C=-1;a==="RGB"&&(d=3,c=0,_=1,f=2,v=-1),l==="RGBA"?C=u*3:l==="RBG"?($=0,g=u,w=u*2):l==="BGR"&&(g=0,w=u,$=u*2);for(let E=0;E{let t=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,s=typeof ImageData<"u"&&e instanceof ImageData,o=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string",i,a=r??{},l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},u=p=>typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||p instanceof OffscreenCanvas?p.getContext("2d"):null;if(t){let p=l();p.width=e.width,p.height=e.height;let d=u(p);if(d!=null){let c=e.height,_=e.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(c=r.resizedHeight,_=r.resizedWidth),r!==void 0){if(a=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");a.tensorFormat="RGBA",a.height=c,a.width=_}else a.tensorFormat="RGBA",a.height=c,a.width=_;d.drawImage(e,0,0),i=d.getImageData(0,0,_,c).data}else throw new Error("Can not access image data")}else if(s){let p,d;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(p=r.resizedHeight,d=r.resizedWidth):(p=e.height,d=e.width),r!==void 0&&(a=r),a.format="RGBA",a.height=p,a.width=d,r!==void 0){let c=l();c.width=d,c.height=p;let _=u(c);if(_!=null)_.putImageData(e,0,0),i=_.getImageData(0,0,d,p).data;else throw new Error("Can not access image data")}else i=e.data}else if(o){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");let p=l();p.width=e.width,p.height=e.height;let d=u(p);if(d!=null){let c=e.height,_=e.width;return d.drawImage(e,0,0,_,c),i=d.getImageData(0,0,_,c).data,a.height=c,a.width=_,qi(i,a)}else throw new Error("Can not access image data")}else{if(n)return new Promise((p,d)=>{let c=l(),_=u(c);if(!e||!_)return d();let f=new Image;f.crossOrigin="Anonymous",f.src=e,f.onload=()=>{c.width=f.width,c.height=f.height,_.drawImage(f,0,0,c.width,c.height);let v=_.getImageData(0,0,c.width,c.height);a.height=c.height,a.width=c.width,p(qi(v.data,a))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(i!==void 0)return qi(i,a);throw new Error("Input data provided is not supported - aborted tensor creation")},mb=(e,r)=>{let{width:t,height:s,download:o,dispose:n}=r,i=[1,s,t,4];return new Nr({location:"texture",type:"float32",texture:e,dims:i,download:o,dispose:n})},fb=(e,r)=>{let{dataType:t,dims:s,download:o,dispose:n}=r;return new Nr({location:"gpu-buffer",type:t??"float32",gpuBuffer:e,dims:s,download:o,dispose:n})},_b=(e,r)=>{let{dataType:t,dims:s,download:o,dispose:n}=r;return new Nr({location:"ml-tensor",type:t??"float32",mlTensor:e,dims:s,download:o,dispose:n})},gb=(e,r,t)=>new Nr({location:"cpu-pinned",type:e,data:r,dims:t??[r.length]})}),In,Ko,Al,wb,Kv=Re(()=>{In=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),Ko=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),Al=!1,wb=()=>{if(!Al){Al=!0;let e=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=globalThis.Float16Array,s=typeof t<"u"&&t.from;e&&(In.set("int64",BigInt64Array),Ko.set(BigInt64Array,"int64")),r&&(In.set("uint64",BigUint64Array),Ko.set(BigUint64Array,"uint64")),s?(In.set("float16",t),Ko.set(t,"float16")):In.set("float16",Uint16Array)}}}),bb,Mb,Hv=Re(()=>{Xu(),bb=e=>{let r=1;for(let t=0;t{switch(e.location){case"cpu":return new Nr(e.type,e.data,r);case"cpu-pinned":return new Nr({location:"cpu-pinned",data:e.data,type:e.type,dims:r});case"texture":return new Nr({location:"texture",texture:e.texture,type:e.type,dims:r});case"gpu-buffer":return new Nr({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:r});case"ml-tensor":return new Nr({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}}}),Nr,Xu=Re(()=>{Wv(),Gv(),Kv(),Hv(),Nr=class{constructor(e,r,t){wb();let s,o;if(typeof e=="object"&&"location"in e)switch(this.dataLocation=e.location,s=e.type,o=e.dims,e.location){case"cpu-pinned":{let i=In.get(s);if(!i)throw new TypeError(`unsupported type "${s}" to create tensor from pinned buffer`);if(!(e.data instanceof i))throw new TypeError(`buffer should be of type ${i.name}`);this.cpuData=e.data;break}case"texture":{if(s!=="float32")throw new TypeError(`unsupported type "${s}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break}case"gpu-buffer":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint8"&&s!=="bool"&&s!=="uint4"&&s!=="int4")throw new TypeError(`unsupported type "${s}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break}case"ml-tensor":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint64"&&s!=="int8"&&s!=="uint8"&&s!=="bool"&&s!=="uint4"&&s!=="int4")throw new TypeError(`unsupported type "${s}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let i,a;if(typeof e=="string")if(s=e,a=t,e==="string"){if(!Array.isArray(r))throw new TypeError("A string tensor's data must be a string array.");i=r}else{let l=In.get(e);if(l===void 0)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(r)){if(e==="float16"&&l===Uint16Array||e==="uint4"||e==="int4")throw new TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${l.name} as data.`);e==="uint64"||e==="int64"?i=l.from(r,BigInt):i=l.from(r)}else if(r instanceof l)i=r;else if(r instanceof Uint8ClampedArray)if(e==="uint8")i=Uint8Array.from(r);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(e==="float16"&&r instanceof Uint16Array&&l!==Uint16Array)i=new globalThis.Float16Array(r.buffer,r.byteOffset,r.length);else throw new TypeError(`A ${s} tensor's data must be type of ${l}`)}else if(a=r,Array.isArray(e)){if(e.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let l=typeof e[0];if(l==="string")s="string",i=e;else if(l==="boolean")s="bool",i=Uint8Array.from(e);else throw new TypeError(`Invalid element type of data array: ${l}.`)}else if(e instanceof Uint8ClampedArray)s="uint8",i=Uint8Array.from(e);else{let l=Ko.get(e.constructor);if(l===void 0)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);s=l,i=e}if(a===void 0)a=[i.length];else if(!Array.isArray(a))throw new TypeError("A tensor's dims must be a number array");o=a,this.cpuData=i,this.dataLocation="cpu"}let n=bb(o);if(this.cpuData&&n!==this.cpuData.length&&!((s==="uint4"||s==="int4")&&Math.ceil(n/2)===this.cpuData.length))throw new Error(`Tensor's size(${n}) does not match data length(${this.cpuData.length}).`);this.type=s,this.dims=o,this.size=n}static async fromImage(e,r){return hb(e,r)}static fromTexture(e,r){return mb(e,r)}static fromGpuBuffer(e,r){return fb(e,r)}static fromMLTensor(e,r){return _b(e,r)}static fromPinnedBuffer(e,r,t){return gb(e,r,t)}toDataURL(e){return cb(this,e)}toImageData(e){return pb(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let r=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=r,e&&this.disposer&&(this.disposer(),this.disposer=void 0),r}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Mb(this,e)}}}),hs,yb=Re(()=>{Xu(),hs=Nr}),Yo,Fl,fs,Jr,vb=Re(()=>{db(),Yo=(e,r)=>{(typeof Xr.trace>"u"?!Xr.wasm.trace:!Xr.trace)||console.timeStamp(`${e}::ORT::${r}`)},Fl=(e,r)=>{var o;let t=((o=new Error().stack)==null?void 0:o.split(/\r\n|\r|\n/g))||[],s=!1;for(let n=0;n{(typeof Xr.trace>"u"?!Xr.wasm.trace:!Xr.trace)||Fl("BEGIN",e)},Jr=e=>{(typeof Xr.trace>"u"?!Xr.wasm.trace:!Xr.trace)||Fl("END",e)}}),xb,qv=Re(()=>{lb(),yb(),vb(),xb=class Tb{constructor(r){this.handler=r}async run(r,t,s){fs();let o={},n={};if(typeof r!="object"||r===null||r instanceof hs||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let i=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof hs)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");i=!1;for(let u of t){if(typeof u!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(u)===-1)throw new RangeError(`'fetches' contains invalid output name: ${u}.`);o[u]=null}if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else{let u=!1,p=Object.getOwnPropertyNames(t);for(let d of this.outputNames)if(p.indexOf(d)!==-1){let c=t[d];(c===null||c instanceof hs)&&(u=!0,i=!1,o[d]=c)}if(u){if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else n=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let u of this.inputNames)if(typeof r[u]>"u")throw new Error(`input '${u}' is missing in 'feeds'.`);if(i)for(let u of this.outputNames)o[u]=null;let a=await this.handler.run(r,o,n),l={};for(let u in a)if(Object.hasOwnProperty.call(a,u)){let p=a[u];p instanceof hs?l[u]=p:l[u]=new hs(p.type,p.data,p.dims)}return Jr(),l}async release(){return this.handler.dispose()}static async create(r,t,s,o){fs();let n,i={};if(typeof r=="string"){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){let p=r,d=0,c=r.byteLength;if(typeof t=="object"&&t!==null)i=t;else if(typeof t=="number"){if(d=t,!Number.isSafeInteger(d))throw new RangeError("'byteOffset' must be an integer.");if(d<0||d>=p.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${p.byteLength}).`);if(c=r.byteLength-d,typeof s=="number"){if(c=s,!Number.isSafeInteger(c))throw new RangeError("'byteLength' must be an integer.");if(c<=0||d+c>p.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${p.byteLength-d}].`);if(typeof o=="object"&&o!==null)i=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof s<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(p,d,c)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[a,l]=await ab(i),u=await a.createInferenceSessionHandler(n,l);return Jr(),new Tb(u)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),Qu,Xv=Re(()=>{qv(),Qu=xb}),Qv=Re(()=>{}),Jv=Re(()=>{}),Yv=Re(()=>{}),Zv=Re(()=>{}),Eb={};ao(Eb,{InferenceSession:()=>Qu,TRACE:()=>Yo,TRACE_FUNC_BEGIN:()=>fs,TRACE_FUNC_END:()=>Jr,Tensor:()=>hs,env:()=>jt,registerBackend:()=>Fn});var _s=Re(()=>{Nv(),Uv(),Xv(),yb(),Qv(),Jv(),vb(),Yv(),Zv()}),Ju=Re(()=>{}),Pb={};ao(Pb,{default:()=>Cb});var Ol,Dl,Cb,ex=Re(()=>{var e;A0(),zn(),Yu(),Ol="ort-wasm-proxy-worker",Dl=((e=globalThis.self)==null?void 0:e.name)===Ol,Dl&&(self.onmessage=r=>{let{type:t,in:s}=r.data;try{switch(t){case"init-wasm":Zu(s.wasm).then(()=>{gd(s).then(()=>{postMessage({type:t})},o=>{postMessage({type:t,err:o})})},o=>{postMessage({type:t,err:o})});break;case"init-ep":{let{epName:o,env:n}=s;wd(n,o).then(()=>{postMessage({type:t})},i=>{postMessage({type:t,err:i})});break}case"copy-from":{let{buffer:o}=s,n=wa(o);postMessage({type:t,out:n});break}case"create":{let{model:o,options:n}=s;bd(o,n).then(i=>{postMessage({type:t,out:i})},i=>{postMessage({type:t,err:i})});break}case"release":Md(s),postMessage({type:t});break;case"run":{let{sessionId:o,inputIndices:n,inputs:i,outputIndices:a,options:l}=s;yd(o,n,i,a,new Array(a.length).fill(null),l).then(u=>{u.some(p=>p[3]!=="cpu")?postMessage({type:t,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:t,out:u},xd([...i,...u]))},u=>{postMessage({type:t,err:u})});break}case"end-profiling":vd(s),postMessage({type:t});break;default:}}catch(o){postMessage({type:t,err:o})}}),Cb=Dl?null:r=>new Worker(r??jr,{type:"module",name:Ol})}),Sb={};ao(Sb,{default:()=>$b});var Ll,zl,$b,Ef,tx=Re(()=>{var e,r;zl=(Ll=import.meta.url,async function(t={}){var Oo;var s,o,n=t,i=new Promise((h,T)=>{s=h,o=T}),a=typeof window=="object",l=typeof WorkerGlobalScope<"u",u=l&&((Oo=self.name)==null?void 0:Oo.startsWith("em-pthread"));n.mountExternalData=(h,T)=>{h.startsWith("./")&&(h=h.substring(2)),(n.Eb||(n.Eb=new Map)).set(h,T)},n.unmountExternalData=()=>{delete n.Eb};var p=globalThis.SharedArrayBuffer??new WebAssembly.Memory({initial:0,maximum:0,pc:!0}).buffer.constructor;let d=h=>async(...T)=>{var I;try{if(n.Fb)throw Error("Session already started");let L=n.Fb={dc:T[0],errors:[]},U=await h(...T);if(n.Fb!==L)throw Error("Session mismatch");(I=n.Jb)==null||I.flush();let ue=L.errors;if(0Oe),0{if(h==="webgpu"){[n.Jb,n.Ub,n.Yb,n.Kb,n.Xb,n.jb,n.Zb,n.ac,n.Vb,n.Wb,n.$b]=T;let I=n.Jb;n.jsepRegisterBuffer=(L,U,ue,Te)=>I.registerBuffer(L,U,ue,Te),n.jsepGetBuffer=L=>I.getBuffer(L),n.jsepCreateDownloader=(L,U,ue)=>I.createDownloader(L,U,ue),n.jsepOnCreateSession=L=>{I.onCreateSession(L)},n.jsepOnReleaseSession=L=>{I.onReleaseSession(L)},n.jsepOnRunStart=L=>I.onRunStart(L),n.bc=(L,U)=>{I.upload(L,U)}}else if(h==="webnn"){let I=T[0];[n.nc,n.Nb,n.webnnEnsureTensor,n.Ob,n.webnnDownloadTensor]=T.slice(1),n.webnnReleaseTensorId=n.Nb,n.webnnUploadTensor=n.Ob,n.webnnOnRunStart=L=>I.onRunStart(L),n.webnnOnRunEnd=I.onRunEnd.bind(I),n.webnnRegisterMLContext=(L,U)=>{I.registerMLContext(L,U)},n.webnnOnReleaseSession=L=>{I.onReleaseSession(L)},n.webnnCreateMLTensorDownloader=(L,U)=>I.createMLTensorDownloader(L,U),n.webnnRegisterMLTensor=(L,U,ue,Te)=>I.registerMLTensor(L,U,ue,Te),n.webnnCreateMLContext=L=>I.createMLContext(L),n.webnnRegisterMLConstant=(L,U,ue,Te,Oe,Ke)=>I.registerMLConstant(L,U,ue,Te,Oe,n.Eb,Ke),n.webnnRegisterGraphInput=I.registerGraphInput.bind(I),n.webnnIsGraphInput=I.isGraphInput.bind(I),n.webnnCreateTemporaryTensor=I.createTemporaryTensor.bind(I),n.webnnIsInt64Supported=I.isInt64Supported.bind(I)}};let c=()=>{let h=(T,I,L)=>(...U)=>{let ue=Nt,Te=I==null?void 0:I();U=T(...U);let Oe=I==null?void 0:I();return Te!==Oe&&(T=Oe,L(Te),I=L=null),Nt!=ue?new Promise((Ke,Ye)=>{Lr={resolve:Ke,reject:Ye}}):U};(()=>{for(let T of["_OrtAppendExecutionProvider","_OrtCreateSession","_OrtRun","_OrtRunWithBinding","_OrtBindInput"])n[T]=h(n[T],()=>n[T],I=>n[T]=I)})(),d!==void 0&&(n._OrtRun=d(n._OrtRun),n._OrtRunWithBinding=d(n._OrtRunWithBinding)),c=void 0};n.asyncInit=()=>{c==null||c()};var _,f,v=Object.assign({},n),$=(h,T)=>{throw T},w="";(a||l)&&(l?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),Ll&&(w=Ll),w=w.startsWith("blob:")?"":w.slice(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1),l&&(f=h=>{var T=new XMLHttpRequest;return T.open("GET",h,!1),T.responseType="arraybuffer",T.send(null),new Uint8Array(T.response)}),_=async h=>{if(V(h))return new Promise((I,L)=>{var U=new XMLHttpRequest;U.open("GET",h,!0),U.responseType="arraybuffer",U.onload=()=>{U.status==200||U.status==0&&U.response?I(U.response):L(U.status)},U.onerror=L,U.send(null)});var T=await fetch(h,{credentials:"same-origin"});if(T.ok)return T.arrayBuffer();throw Error(T.status+" : "+T.url)});var g=console.log.bind(console),C=console.error.bind(console),E=g,y=C;Object.assign(n,v),v=null;var b,x,S,A,B,K,G,j,ee,H,Z,X,oe,me=n.wasmBinary,ae=!1,V=h=>h.startsWith("file://");function F(){return b.buffer!=A.buffer&&R(),A}function W(){return b.buffer!=A.buffer&&R(),B}function re(){return b.buffer!=A.buffer&&R(),K}function fe(){return b.buffer!=A.buffer&&R(),G}function se(){return b.buffer!=A.buffer&&R(),j}function ce(){return b.buffer!=A.buffer&&R(),ee}function $e(){return b.buffer!=A.buffer&&R(),H}function Ue(){return b.buffer!=A.buffer&&R(),oe}if(u){let h=function(T){try{var I=T.data,L=I.Bb;if(L==="load"){let U=[];self.onmessage=ue=>U.push(ue),self.startWorker=()=>{postMessage({Bb:"loaded"});for(let ue of U)h(ue);self.onmessage=h};for(let ue of I.Rb)n[ue]&&!n[ue].proxy||(n[ue]=(...Te)=>{postMessage({Bb:"callHandler",Qb:ue,args:Te})},ue=="print"&&(E=n[ue]),ue=="printErr"&&(y=n[ue]));b=I.kc,R(),we(I.lc)}else if(L==="run"){kr(I.Ab),_n(I.Ab,0,0,1,0,0),lr(),ve(I.Ab),q||(Po(),q=!0);try{Ds(I.fc,I.Hb)}catch(U){if(U!="unwind")throw U}}else I.target!=="setimmediate"&&(L==="checkMailbox"?q&&je():L&&(y(`worker: received unknown command ${L}`),y(I)))}catch(U){throw Co(),U}};var we,q=!1;y=function(...T){T=T.join(" "),console.error(T)},self.alert=function(...T){postMessage({Bb:"alert",text:T.join(" "),ic:Ws()})},self.onunhandledrejection=T=>{throw T.reason||T},self.onmessage=h}function R(){var h=b.buffer;n.HEAP8=A=new Int8Array(h),n.HEAP16=K=new Int16Array(h),n.HEAPU8=B=new Uint8Array(h),n.HEAPU16=G=new Uint16Array(h),n.HEAP32=j=new Int32Array(h),n.HEAPU32=ee=new Uint32Array(h),n.HEAPF32=H=new Float32Array(h),n.HEAPF64=oe=new Float64Array(h),n.HEAP64=Z=new BigInt64Array(h),n.HEAPU64=X=new BigUint64Array(h)}function pe(){u?startWorker(n):nt.Ca()}u||(b=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),R());var xe,Me=0,Se=null;function Ae(){if(--Me==0&&Se){var h=Se;Se=null,h()}}function Fe(h){throw y(h="Aborted("+h+")"),ae=!0,h=new WebAssembly.RuntimeError(h+". Build with -sASSERTIONS for more info."),o(h),h}function ze(){return{a:{L:Y,Aa:O,b:Ls,$:Zr,A:es,pa:ts,X:De,Z:Qe,qa:et,na:Bt,ga:Or,ma:Pr,J:rs,Y:ss,V:Ur,oa:ns,W:os,va:Ys,E:Zs,Q:en,O:rn,D:nn,u:on,r:Ms,P:an,z:N,R:Q,ja:ie,T:He,aa:Je,M:dt,F:vt,ia:ve,sa:Et,t:Kt,Ba:Mr,w:or,o:Zt,l:Rs,c:Ps,n:ei,j:si,v:ni,p:oi,f:ii,s:ai,m:lo,e:li,k:ui,i:uo,g:di,d:co,da:ci,ea:ho,fa:hi,ba:pn,ca:mo,N:fo,xa:fi,ua:gi,h:wi,C:_o,G:Ss,ta:_i,x:bi,ra:ba,U:Mi,q:mi,y:Ma,K:yi,S:go,za:vi,ya:xi,ka:Mo,la:Vn,_:Xe,B:yo,I:vo,ha:Un,H:xo,a:b,wa:Ie}}}var Ve={829644:(h,T,I,L,U)=>{if(n===void 0||!n.Eb)return 1;if((h=Ft(Number(h>>>0))).startsWith("./")&&(h=h.substring(2)),!(h=n.Eb.get(h)))return 2;if(T=Number(T>>>0),I=Number(I>>>0),L=Number(L>>>0),T+I>h.byteLength)return 3;try{let ue=h.subarray(T,T+I);switch(U){case 0:W().set(ue,L>>>0);break;case 1:n.mc?n.mc(L,ue):n.bc(L,ue);break;default:return 4}return 0}catch{return 4}},830468:(h,T,I)=>{n.Ob(h,W().subarray(T>>>0,T+I>>>0))},830532:()=>n.nc(),830574:h=>{n.Nb(h)},830611:()=>{n.Vb()},830642:()=>{n.Wb()},830671:()=>{n.$b()},830696:h=>n.Ub(h),830729:h=>n.Yb(h),830761:(h,T,I)=>{n.Kb(Number(h),Number(T),Number(I),!0)},830824:(h,T,I)=>{n.Kb(Number(h),Number(T),Number(I))},830881:()=>typeof wasmOffsetConverter<"u",830938:h=>{n.jb("Abs",h,void 0)},830989:h=>{n.jb("Neg",h,void 0)},831040:h=>{n.jb("Floor",h,void 0)},831093:h=>{n.jb("Ceil",h,void 0)},831145:h=>{n.jb("Reciprocal",h,void 0)},831203:h=>{n.jb("Sqrt",h,void 0)},831255:h=>{n.jb("Exp",h,void 0)},831306:h=>{n.jb("Erf",h,void 0)},831357:h=>{n.jb("Sigmoid",h,void 0)},831412:(h,T,I)=>{n.jb("HardSigmoid",h,{alpha:T,beta:I})},831491:h=>{n.jb("Log",h,void 0)},831542:h=>{n.jb("Sin",h,void 0)},831593:h=>{n.jb("Cos",h,void 0)},831644:h=>{n.jb("Tan",h,void 0)},831695:h=>{n.jb("Asin",h,void 0)},831747:h=>{n.jb("Acos",h,void 0)},831799:h=>{n.jb("Atan",h,void 0)},831851:h=>{n.jb("Sinh",h,void 0)},831903:h=>{n.jb("Cosh",h,void 0)},831955:h=>{n.jb("Asinh",h,void 0)},832008:h=>{n.jb("Acosh",h,void 0)},832061:h=>{n.jb("Atanh",h,void 0)},832114:h=>{n.jb("Tanh",h,void 0)},832166:h=>{n.jb("Not",h,void 0)},832217:(h,T,I)=>{n.jb("Clip",h,{min:T,max:I})},832286:h=>{n.jb("Clip",h,void 0)},832338:(h,T)=>{n.jb("Elu",h,{alpha:T})},832396:h=>{n.jb("Gelu",h,void 0)},832448:h=>{n.jb("Relu",h,void 0)},832500:(h,T)=>{n.jb("LeakyRelu",h,{alpha:T})},832564:(h,T)=>{n.jb("ThresholdedRelu",h,{alpha:T})},832634:(h,T)=>{n.jb("Cast",h,{to:T})},832692:h=>{n.jb("Add",h,void 0)},832743:h=>{n.jb("Sub",h,void 0)},832794:h=>{n.jb("Mul",h,void 0)},832845:h=>{n.jb("Div",h,void 0)},832896:h=>{n.jb("Pow",h,void 0)},832947:h=>{n.jb("Equal",h,void 0)},833e3:h=>{n.jb("Greater",h,void 0)},833055:h=>{n.jb("GreaterOrEqual",h,void 0)},833117:h=>{n.jb("Less",h,void 0)},833169:h=>{n.jb("LessOrEqual",h,void 0)},833228:(h,T,I,L,U)=>{n.jb("ReduceMean",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},833403:(h,T,I,L,U)=>{n.jb("ReduceMax",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},833577:(h,T,I,L,U)=>{n.jb("ReduceMin",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},833751:(h,T,I,L,U)=>{n.jb("ReduceProd",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},833926:(h,T,I,L,U)=>{n.jb("ReduceSum",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834100:(h,T,I,L,U)=>{n.jb("ReduceL1",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834273:(h,T,I,L,U)=>{n.jb("ReduceL2",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834446:(h,T,I,L,U)=>{n.jb("ReduceLogSum",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834623:(h,T,I,L,U)=>{n.jb("ReduceSumSquare",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834803:(h,T,I,L,U)=>{n.jb("ReduceLogSumExp",h,{keepDims:!!T,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834983:h=>{n.jb("Where",h,void 0)},835036:(h,T,I)=>{n.jb("Transpose",h,{perm:T?Array.from(se().subarray(Number(T)>>>0,Number(I)>>>0)):[]})},835160:(h,T,I,L)=>{n.jb("DepthToSpace",h,{blocksize:T,mode:Ft(I),format:L?"NHWC":"NCHW"})},835293:(h,T,I,L)=>{n.jb("DepthToSpace",h,{blocksize:T,mode:Ft(I),format:L?"NHWC":"NCHW"})},835426:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr,$s)=>{n.jb("ConvTranspose",h,{format:Ke?"NHWC":"NCHW",autoPad:T,dilations:[I],group:L,kernelShape:[U],pads:[ue,Te],strides:[Oe],wIsConst:()=>!!F()[Ye>>>0],outputPadding:ht?Array.from(se().subarray(Number(ht)>>>0,Number(xt)>>>0)):[],outputShape:It?Array.from(se().subarray(Number(It)>>>0,Number(sr)>>>0)):[],activation:Ft($s)})},835859:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr)=>{n.jb("ConvTranspose",h,{format:Oe?"NHWC":"NCHW",autoPad:T,dilations:Array.from(se().subarray(Number(I)>>>0,2+(Number(I)>>>0)>>>0)),group:L,kernelShape:Array.from(se().subarray(Number(U)>>>0,2+(Number(U)>>>0)>>>0)),pads:Array.from(se().subarray(Number(ue)>>>0,4+(Number(ue)>>>0)>>>0)),strides:Array.from(se().subarray(Number(Te)>>>0,2+(Number(Te)>>>0)>>>0)),wIsConst:()=>!!F()[Ke>>>0],outputPadding:Ye?Array.from(se().subarray(Number(Ye)>>>0,Number(ht)>>>0)):[],outputShape:xt?Array.from(se().subarray(Number(xt)>>>0,Number(It)>>>0)):[],activation:Ft(sr)})},836520:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr,$s)=>{n.jb("ConvTranspose",h,{format:Ke?"NHWC":"NCHW",autoPad:T,dilations:[I],group:L,kernelShape:[U],pads:[ue,Te],strides:[Oe],wIsConst:()=>!!F()[Ye>>>0],outputPadding:ht?Array.from(se().subarray(Number(ht)>>>0,Number(xt)>>>0)):[],outputShape:It?Array.from(se().subarray(Number(It)>>>0,Number(sr)>>>0)):[],activation:Ft($s)})},836953:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr)=>{n.jb("ConvTranspose",h,{format:Oe?"NHWC":"NCHW",autoPad:T,dilations:Array.from(se().subarray(Number(I)>>>0,2+(Number(I)>>>0)>>>0)),group:L,kernelShape:Array.from(se().subarray(Number(U)>>>0,2+(Number(U)>>>0)>>>0)),pads:Array.from(se().subarray(Number(ue)>>>0,4+(Number(ue)>>>0)>>>0)),strides:Array.from(se().subarray(Number(Te)>>>0,2+(Number(Te)>>>0)>>>0)),wIsConst:()=>!!F()[Ke>>>0],outputPadding:Ye?Array.from(se().subarray(Number(Ye)>>>0,Number(ht)>>>0)):[],outputShape:xt?Array.from(se().subarray(Number(xt)>>>0,Number(It)>>>0)):[],activation:Ft(sr)})},837614:(h,T)=>{n.jb("GlobalAveragePool",h,{format:T?"NHWC":"NCHW"})},837705:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr)=>{n.jb("AveragePool",h,{format:sr?"NHWC":"NCHW",auto_pad:T,ceil_mode:I,count_include_pad:L,storage_order:U,dilations:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],kernel_shape:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],pads:Ye?Array.from(se().subarray(Number(Ye)>>>0,Number(ht)>>>0)):[],strides:xt?Array.from(se().subarray(Number(xt)>>>0,Number(It)>>>0)):[]})},838184:(h,T)=>{n.jb("GlobalAveragePool",h,{format:T?"NHWC":"NCHW"})},838275:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr)=>{n.jb("AveragePool",h,{format:sr?"NHWC":"NCHW",auto_pad:T,ceil_mode:I,count_include_pad:L,storage_order:U,dilations:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],kernel_shape:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],pads:Ye?Array.from(se().subarray(Number(Ye)>>>0,Number(ht)>>>0)):[],strides:xt?Array.from(se().subarray(Number(xt)>>>0,Number(It)>>>0)):[]})},838754:(h,T)=>{n.jb("GlobalMaxPool",h,{format:T?"NHWC":"NCHW"})},838841:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr)=>{n.jb("MaxPool",h,{format:sr?"NHWC":"NCHW",auto_pad:T,ceil_mode:I,count_include_pad:L,storage_order:U,dilations:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],kernel_shape:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],pads:Ye?Array.from(se().subarray(Number(Ye)>>>0,Number(ht)>>>0)):[],strides:xt?Array.from(se().subarray(Number(xt)>>>0,Number(It)>>>0)):[]})},839316:(h,T)=>{n.jb("GlobalMaxPool",h,{format:T?"NHWC":"NCHW"})},839403:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr)=>{n.jb("MaxPool",h,{format:sr?"NHWC":"NCHW",auto_pad:T,ceil_mode:I,count_include_pad:L,storage_order:U,dilations:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],kernel_shape:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],pads:Ye?Array.from(se().subarray(Number(Ye)>>>0,Number(ht)>>>0)):[],strides:xt?Array.from(se().subarray(Number(xt)>>>0,Number(It)>>>0)):[]})},839878:(h,T,I,L,U)=>{n.jb("Gemm",h,{alpha:T,beta:I,transA:L,transB:U})},839982:h=>{n.jb("MatMul",h,void 0)},840036:(h,T,I,L)=>{n.jb("ArgMax",h,{keepDims:!!T,selectLastIndex:!!I,axis:L})},840144:(h,T,I,L)=>{n.jb("ArgMin",h,{keepDims:!!T,selectLastIndex:!!I,axis:L})},840252:(h,T)=>{n.jb("Softmax",h,{axis:T})},840315:(h,T)=>{n.jb("Concat",h,{axis:T})},840375:(h,T,I,L,U)=>{n.jb("Split",h,{axis:T,numOutputs:I,splitSizes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},840531:h=>{n.jb("Expand",h,void 0)},840585:(h,T)=>{n.jb("Gather",h,{axis:Number(T)})},840656:(h,T)=>{n.jb("GatherElements",h,{axis:Number(T)})},840735:(h,T)=>{n.jb("GatherND",h,{batch_dims:Number(T)})},840814:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht)=>{n.jb("Resize",h,{antialias:T,axes:I?Array.from(se().subarray(Number(I)>>>0,Number(L)>>>0)):[],coordinateTransformMode:Ft(U),cubicCoeffA:ue,excludeOutside:Te,extrapolationValue:Oe,keepAspectRatioPolicy:Ft(Ke),mode:Ft(Ye),nearestMode:Ft(ht)})},841176:(h,T,I,L,U,ue,Te)=>{n.jb("Slice",h,{starts:T?Array.from(se().subarray(Number(T)>>>0,Number(I)>>>0)):[],ends:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[],axes:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[]})},841440:h=>{n.jb("Tile",h,void 0)},841492:(h,T,I)=>{n.jb("InstanceNormalization",h,{epsilon:T,format:I?"NHWC":"NCHW"})},841606:(h,T,I)=>{n.jb("InstanceNormalization",h,{epsilon:T,format:I?"NHWC":"NCHW"})},841720:h=>{n.jb("Range",h,void 0)},841773:(h,T)=>{n.jb("Einsum",h,{equation:Ft(T)})},841854:(h,T,I,L,U)=>{n.jb("Pad",h,{mode:T,value:I,pads:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},841997:(h,T,I,L,U,ue)=>{n.jb("BatchNormalization",h,{epsilon:T,momentum:I,spatial:!!U,trainingMode:!!L,format:ue?"NHWC":"NCHW"})},842166:(h,T,I,L,U,ue)=>{n.jb("BatchNormalization",h,{epsilon:T,momentum:I,spatial:!!U,trainingMode:!!L,format:ue?"NHWC":"NCHW"})},842335:(h,T,I)=>{n.jb("CumSum",h,{exclusive:Number(T),reverse:Number(I)})},842432:(h,T,I)=>{n.jb("DequantizeLinear",h,{axis:T,blockSize:I})},842522:(h,T,I,L,U)=>{n.jb("GridSample",h,{align_corners:T,mode:Ft(I),padding_mode:Ft(L),format:U?"NHWC":"NCHW"})},842692:(h,T,I,L,U)=>{n.jb("GridSample",h,{align_corners:T,mode:Ft(I),padding_mode:Ft(L),format:U?"NHWC":"NCHW"})},842862:(h,T)=>{n.jb("ScatterND",h,{reduction:Ft(T)})},842947:(h,T,I,L,U,ue,Te,Oe,Ke)=>{n.jb("Attention",h,{numHeads:T,isUnidirectional:I,maskFilterValue:L,scale:U,doRotary:ue,qkvHiddenSizes:Te?Array.from(se().subarray(Number(Oe)>>>0,Number(Oe)+Te>>>0)):[],pastPresentShareBuffer:!!Ke})},843219:h=>{n.jb("BiasAdd",h,void 0)},843274:h=>{n.jb("BiasSplitGelu",h,void 0)},843335:h=>{n.jb("FastGelu",h,void 0)},843391:(h,T,I,L,U,ue,Te,Oe,Ke,Ye,ht,xt,It,sr,$s,Ei)=>{n.jb("Conv",h,{format:xt?"NHWC":"NCHW",auto_pad:T,dilations:I?Array.from(se().subarray(Number(I)>>>0,Number(L)>>>0)):[],group:U,kernel_shape:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],pads:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],strides:Ye?Array.from(se().subarray(Number(Ye)>>>0,Number(ht)>>>0)):[],w_is_const:()=>!!F()[Number(It)>>>0],activation:Ft(sr),activation_params:$s?Array.from($e().subarray(Number($s)>>>0,Number(Ei)>>>0)):[]})},843975:h=>{n.jb("Gelu",h,void 0)},844027:(h,T,I,L,U,ue,Te,Oe,Ke)=>{n.jb("GroupQueryAttention",h,{numHeads:T,kvNumHeads:I,scale:L,softcap:U,doRotary:ue,rotaryInterleaved:Te,smoothSoftmax:Oe,localWindowSize:Ke})},844244:(h,T,I,L)=>{n.jb("LayerNormalization",h,{axis:T,epsilon:I,simplified:!!L})},844355:(h,T,I,L)=>{n.jb("LayerNormalization",h,{axis:T,epsilon:I,simplified:!!L})},844466:(h,T,I,L,U,ue)=>{n.jb("MatMulNBits",h,{k:T,n:I,accuracyLevel:L,bits:U,blockSize:ue})},844593:(h,T,I,L,U,ue)=>{n.jb("MultiHeadAttention",h,{numHeads:T,isUnidirectional:I,maskFilterValue:L,scale:U,doRotary:ue})},844752:(h,T)=>{n.jb("QuickGelu",h,{alpha:T})},844816:(h,T,I,L,U)=>{n.jb("RotaryEmbedding",h,{interleaved:!!T,numHeads:I,rotaryEmbeddingDim:L,scale:U})},844955:(h,T,I)=>{n.jb("SkipLayerNormalization",h,{epsilon:T,simplified:!!I})},845057:(h,T,I)=>{n.jb("SkipLayerNormalization",h,{epsilon:T,simplified:!!I})},845159:(h,T,I,L)=>{n.jb("GatherBlockQuantized",h,{gatherAxis:T,quantizeAxis:I,blockSize:L})},845280:h=>{n.Zb(h)},845314:(h,T)=>n.ac(Number(h),Number(T),n.Fb.dc,n.Fb.errors)};function O(h,T,I){return zr(async()=>{await n.Xb(Number(h),Number(T),Number(I))})}function Y(){return typeof wasmOffsetConverter<"u"}class z{constructor(T){te(this,"name","ExitStatus");this.message=`Program terminated with exit(${T})`,this.status=T}}var J=h=>{h.terminate(),h.onmessage=()=>{}},le=[],ye=h=>{Ge.length==0&&(gs(),Yr(Ge[0]));var T=Ge.pop();if(!T)return 6;lt.push(T),Gt[h.Ab]=T,T.Ab=h.Ab;var I={Bb:"run",fc:h.ec,Hb:h.Hb,Ab:h.Ab};return T.postMessage(I,h.Mb),0},Ee=0,ke=(h,T,...I)=>{for(var L=2*I.length,U=qn(),ue=wn(8*L),Te=ue>>>3,Oe=0;Oe>>0]=Ke)}return h=So(h,0,L,ue,T),gn(U),h};function Ie(h){if(u)return ke(0,1,h);if(S=h,!(0{if(S=h,u)throw Be(h),"unwind";Ie(h)},Ge=[],lt=[],wt=[],Gt={},Ot=h=>{var T=h.Ab;delete Gt[T],Ge.push(h),lt.splice(lt.indexOf(h),1),h.Ab=0,Gn(T)};function lr(){wt.forEach(h=>h())}var Yr=h=>new Promise(T=>{h.onmessage=U=>{var ue=(U=U.data).Bb;if(U.Gb&&U.Gb!=Ws()){var Te=Gt[U.Gb];Te?Te.postMessage(U,U.Mb):y(`Internal error! Worker sent a message "${ue}" to target pthread ${U.Gb}, but that thread no longer exists!`)}else ue==="checkMailbox"?je():ue==="spawnThread"?ye(U):ue==="cleanupThread"?Ot(Gt[U.hc]):ue==="loaded"?(h.loaded=!0,T(h)):ue==="alert"?alert(`Thread ${U.ic}: ${U.text}`):U.target==="setimmediate"?h.postMessage(U):ue==="callHandler"?n[U.Qb](...U.args):ue&&y(`worker sent an unknown command ${ue}`)},h.onerror=U=>{throw y(`worker sent an error! ${U.filename}:${U.lineno}: ${U.message}`),U};var I,L=[];for(I of[])n.propertyIsEnumerable(I)&&L.push(I);h.postMessage({Bb:"load",Rb:L,kc:b,lc:x})});function gs(){var h=new Worker((()=>{let T=URL;return import.meta.url>"file:"&&import.meta.url<"file;"?new T("ort.bundle.min.mjs",import.meta.url):new URL(import.meta.url)})(),{type:"module",workerData:"em-pthread",name:"em-pthread"});Ge.push(h)}var kr=h=>{R();var T=ce()[h+52>>>2>>>0];h=ce()[h+56>>>2>>>0],ko(T,T-h),gn(T)},Ds=(h,T)=>{Ee=0,h=Io(h,T),0>>=0);throw T>>>=0,I>>>=0,ce()[L.Ib+16>>>2>>>0]=0,ce()[L.Ib+4>>>2>>>0]=T,ce()[L.Ib+8>>>2>>>0]=I,h}function at(h,T,I,L){return u?ke(2,1,h,T,I,L):Zr(h,T,I,L)}function Zr(h,T,I,L){if(h>>>=0,I>>>=0,L>>>=0,p===void 0)return 6;var U=[];return u&&U.length===0?at(h,T>>>=0,I,L):(h={ec:I,Ab:h,Hb:L,Mb:U},u?(h.Bb="spawnThread",postMessage(h,U),0):ye(h))}var Ir=typeof TextDecoder<"u"?new TextDecoder:void 0,ws=(h,T=0,I=NaN)=>{var L=(T>>>=0)+I;for(I=T;h[I]&&!(I>=L);)++I;if(16(U=(240&U)==224?(15&U)<<12|ue<<6|Te:(7&U)<<18|ue<<12|Te<<6|63&h[T++])?L+=String.fromCharCode(U):(U-=65536,L+=String.fromCharCode(55296|U>>10,56320|1023&U))}}else L+=String.fromCharCode(U)}return L},Ft=(h,T)=>(h>>>=0)?ws(W(),h,T):"";function es(h,T,I){return u?ke(3,1,h,T,I):0}function ts(h,T){if(u)return ke(4,1,h,T)}var bs=h=>{for(var T=0,I=0;I=L?T++:2047>=L?T+=2:55296<=L&&57343>=L?(T+=4,++I):T+=3}return T},Xt=(h,T,I)=>{var L=W();if(T>>>=0,0=Te&&(Te=65536+((1023&Te)<<10)|1023&h.charCodeAt(++ue)),127>=Te){if(T>=I)break;L[T++>>>0]=Te}else{if(2047>=Te){if(T+1>=I)break;L[T++>>>0]=192|Te>>6}else{if(65535>=Te){if(T+2>=I)break;L[T++>>>0]=224|Te>>12}else{if(T+3>=I)break;L[T++>>>0]=240|Te>>18,L[T++>>>0]=128|Te>>12&63}L[T++>>>0]=128|Te>>6&63}L[T++>>>0]=128|63&Te}}L[T>>>0]=0,h=T-U}else h=0;return h};function De(h,T){if(u)return ke(5,1,h,T)}function Qe(h,T,I){if(u)return ke(6,1,h,T,I)}function et(h,T,I){return u?ke(7,1,h,T,I):0}function Bt(h,T){if(u)return ke(8,1,h,T)}function Or(h,T,I){if(u)return ke(9,1,h,T,I)}function Pr(h,T,I,L){if(u)return ke(10,1,h,T,I,L)}function rs(h,T,I,L){if(u)return ke(11,1,h,T,I,L)}function ss(h,T,I,L){if(u)return ke(12,1,h,T,I,L)}function Ur(h){if(u)return ke(13,1,h)}function ns(h,T){if(u)return ke(14,1,h,T)}function os(h,T,I){if(u)return ke(15,1,h,T,I)}var Wr,yr,Ys=()=>Fe(""),vr=h=>{for(var T="";W()[h>>>0];)T+=Wr[W()[h++>>>0]];return T},Ts={},Es={};function fr(h,T,I={}){return function(L,U,ue={}){var Te=U.name;if(!L)throw new yr(`type "${Te}" must have a positive integer typeid pointer`);if(Es.hasOwnProperty(L)){if(ue.Sb)return;throw new yr(`Cannot register type '${Te}' twice`)}Es[L]=U,Ts.hasOwnProperty(L)&&(U=Ts[L],delete Ts[L],U.forEach(Oe=>Oe()))}(h,T,I)}var zs=(h,T,I)=>{switch(T){case 1:return I?L=>F()[L>>>0]:L=>W()[L>>>0];case 2:return I?L=>re()[L>>>1>>>0]:L=>fe()[L>>>1>>>0];case 4:return I?L=>se()[L>>>2>>>0]:L=>ce()[L>>>2>>>0];case 8:return I?L=>Z[L>>>3]:L=>X[L>>>3];default:throw new TypeError(`invalid integer width (${T}): ${h}`)}};function Zs(h,T,I){I>>>=0,fr(h>>>=0,{name:T=vr(T>>>0),fromWireType:L=>L,toWireType:function(L,U){if(typeof U!="bigint"&&typeof U!="number")throw U=U===null?"null":(L=typeof U)=="object"||L==="array"||L==="function"?U.toString():""+U,new TypeError(`Cannot convert "${U}" to ${this.name}`);return typeof U=="number"&&(U=BigInt(U)),U},Cb:Ar,readValueFromPointer:zs(T,I,T.indexOf("u")==-1),Db:null})}var Ar=8;function en(h,T,I,L){fr(h>>>=0,{name:T=vr(T>>>0),fromWireType:function(U){return!!U},toWireType:function(U,ue){return ue?I:L},Cb:Ar,readValueFromPointer:function(U){return this.fromWireType(W()[U>>>0])},Db:null})}var Gr=[],xr=[];function Ps(h){9<(h>>>=0)&&--xr[h+1]==0&&(xr[h]=void 0,Gr.push(h))}var ur=h=>{if(!h)throw new yr("Cannot use deleted val. handle = "+h);return xr[h]},_r=h=>{switch(h){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:let T=Gr.pop()||xr.length;return xr[T]=h,xr[T+1]=1,T}};function Dr(h){return this.fromWireType(ce()[h>>>2>>>0])}var tn={name:"emscripten::val",fromWireType:h=>{var T=ur(h);return Ps(h),T},toWireType:(h,T)=>_r(T),Cb:Ar,readValueFromPointer:Dr,Db:null};function rn(h){return fr(h>>>0,tn)}var sn=(h,T)=>{switch(T){case 4:return function(I){return this.fromWireType($e()[I>>>2>>>0])};case 8:return function(I){return this.fromWireType(Ue()[I>>>3>>>0])};default:throw new TypeError(`invalid float width (${T}): ${h}`)}};function nn(h,T,I){I>>>=0,fr(h>>>=0,{name:T=vr(T>>>0),fromWireType:L=>L,toWireType:(L,U)=>U,Cb:Ar,readValueFromPointer:sn(T,I),Db:null})}function on(h,T,I,L,U){if(h>>>=0,I>>>=0,T=vr(T>>>0),U===-1&&(U=4294967295),U=Oe=>Oe,L===0){var ue=32-8*I;U=Oe=>Oe<>>ue}var Te=T.includes("unsigned")?function(Oe,Ke){return Ke>>>0}:function(Oe,Ke){return Ke};fr(h,{name:T,fromWireType:U,toWireType:Te,Cb:Ar,readValueFromPointer:zs(T,I,L!==0),Db:null})}function Ms(h,T,I){function L(ue){var Te=ce()[ue>>>2>>>0];return ue=ce()[ue+4>>>2>>>0],new U(F().buffer,ue,Te)}var U=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][T];fr(h>>>=0,{name:I=vr(I>>>0),fromWireType:L,Cb:Ar,readValueFromPointer:L},{Sb:!0})}function an(h,T){fr(h>>>=0,{name:T=vr(T>>>0),fromWireType:function(I){for(var L,U=ce()[I>>>2>>>0],ue=I+4,Te=ue,Oe=0;Oe<=U;++Oe){var Ke=ue+Oe;Oe!=U&&W()[Ke>>>0]!=0||(Te=Ft(Te,Ke-Te),L===void 0?L=Te:(L+="\0",L+=Te),Te=Ke+1)}return Br(I),L},toWireType:function(I,L){L instanceof ArrayBuffer&&(L=new Uint8Array(L));var U=typeof L=="string";if(!(U||L instanceof Uint8Array||L instanceof Uint8ClampedArray||L instanceof Int8Array))throw new yr("Cannot pass non-string to std::string");var ue=U?bs(L):L.length,Te=fn(4+ue+1),Oe=Te+4;if(ce()[Te>>>2>>>0]=ue,U)Xt(L,Oe,ue+1);else if(U)for(U=0;U>>0]=Ke}else for(U=0;U>>0]=L[U];return I!==null&&I.push(Br,Te),Te},Cb:Ar,readValueFromPointer:Dr,Db(I){Br(I)}})}var Bs=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,ln=(h,T)=>{for(var I=h>>1,L=I+T/2;!(I>=L)&&fe()[I>>>0];)++I;if(32<(I<<=1)-h&&Bs)return Bs.decode(W().slice(h,I));for(I="",L=0;!(L>=T/2);++L){var U=re()[h+2*L>>>1>>>0];if(U==0)break;I+=String.fromCharCode(U)}return I},un=(h,T,I)=>{if(I??(I=2147483647),2>I)return 0;var L=T;I=(I-=2)<2*h.length?I/2:h.length;for(var U=0;U>>1>>>0]=ue,T+=2}return re()[T>>>1>>>0]=0,T-L},ys=h=>2*h.length,dn=(h,T)=>{for(var I=0,L="";!(I>=T/4);){var U=se()[h+4*I>>>2>>>0];if(U==0)break;++I,65536<=U?(U-=65536,L+=String.fromCharCode(55296|U>>10,56320|1023&U)):L+=String.fromCharCode(U)}return L},he=(h,T,I)=>{if(T>>>=0,I??(I=2147483647),4>I)return 0;var L=T;I=L+I-4;for(var U=0;U=ue&&(ue=65536+((1023&ue)<<10)|1023&h.charCodeAt(++U)),se()[T>>>2>>>0]=ue,(T+=4)+4>I)break}return se()[T>>>2>>>0]=0,T-L},k=h=>{for(var T=0,I=0;I=L&&++I,T+=4}return T};function N(h,T,I){if(h>>>=0,T>>>=0,I=vr(I>>>=0),T===2)var L=ln,U=un,ue=ys,Te=Oe=>fe()[Oe>>>1>>>0];else T===4&&(L=dn,U=he,ue=k,Te=Oe=>ce()[Oe>>>2>>>0]);fr(h,{name:I,fromWireType:Oe=>{for(var Ke,Ye=ce()[Oe>>>2>>>0],ht=Oe+4,xt=0;xt<=Ye;++xt){var It=Oe+4+xt*T;xt!=Ye&&Te(It)!=0||(ht=L(ht,It-ht),Ke===void 0?Ke=ht:(Ke+="\0",Ke+=ht),ht=It+T)}return Br(Oe),Ke},toWireType:(Oe,Ke)=>{if(typeof Ke!="string")throw new yr(`Cannot pass non-string to C++ string type ${I}`);var Ye=ue(Ke),ht=fn(4+Ye+T);return ce()[ht>>>2>>>0]=Ye/T,U(Ke,ht+4,Ye+T),Oe!==null&&Oe.push(Br,ht),ht},Cb:Ar,readValueFromPointer:Dr,Db(Oe){Br(Oe)}})}function Q(h,T){fr(h>>>=0,{Tb:!0,name:T=vr(T>>>0),Cb:0,fromWireType:()=>{},toWireType:()=>{}})}function ie(h){_n(h>>>0,!l,1,!a,131072,!1),lr()}var de=h=>{if(!ae)try{if(h(),!(0>>=0,typeof Atomics.jc=="function"&&(Atomics.jc(se(),h>>>2,h).value.then(je),h+=128,Atomics.store(se(),h>>>2,1))}var je=()=>{var h=Ws();h&&(ve(h),de(Hn))};function He(h,T){(h>>>=0)==T>>>0?setTimeout(je):u?postMessage({Gb:h,Bb:"checkMailbox"}):(h=Gt[h])&&h.postMessage({Bb:"checkMailbox"})}var We=[];function Je(h,T,I,L,U){for(T>>>=0,L/=2,We.length=L,I=U>>>0>>>3,U=0;U>>0];return(T?Ve[T]:To[h])(...We)}var dt=()=>{Ee=0};function vt(h){h>>>=0,u?postMessage({Bb:"cleanupThread",hc:h}):Ot(Gt[h])}function Et(h){}var Rt=(h,T)=>{var I=Es[h];if(I===void 0)throw h=Eo(h),I=vr(h),Br(h),new yr(`${T} has unknown type ${I}`);return I},kt=(h,T,I)=>{var L=[];return h=h.toWireType(L,I),L.length&&(ce()[T>>>2>>>0]=_r(L)),h};function Kt(h,T,I){return T>>>=0,I>>>=0,h=ur(h>>>0),T=Rt(T,"emval::as"),kt(T,I,h)}function Mr(h,T){return T>>>=0,h=ur(h>>>0),(T=Rt(T,"emval::as")).toWireType(null,h)}var dr=h=>{try{h()}catch(T){Fe(T)}},cr=0,Nt=null,Kr=0,Dt=[],rr={},gr={},Hr=0,Lr=null,Yt=[];function zr(h){return function(T){if(!ae){if(cr===0){var I=!1,L=!1;T((U=0)=>{if(!ae&&(Kr=U,I=!0,L)){cr=2,dr(()=>Fo(Nt)),typeof MainLoop<"u"&&MainLoop.Pb&&MainLoop.resume(),U=!1;try{var ue=function(){var Ke=se()[Nt+8>>>2>>>0];return Ke=nt[gr[Ke]],--Ee,Ke()}()}catch(Ke){ue=Ke,U=!0}var Te=!1;if(!Nt){var Oe=Lr;Oe&&(Lr=null,(U?Oe.reject:Oe.resolve)(ue),Te=!0)}if(U&&!Te)throw ue}}),L=!0,I||(cr=1,Nt=function(){var U=fn(65548),ue=U+12;ce()[U>>>2>>>0]=ue,ce()[U+4>>>2>>>0]=ue+65536,ue=Dt[0];var Te=rr[ue];return Te===void 0&&(Te=Hr++,rr[ue]=Te,gr[Te]=ue),ue=Te,se()[U+8>>>2>>>0]=ue,U}(),typeof MainLoop<"u"&&MainLoop.Pb&&MainLoop.pause(),dr(()=>Xn(Nt)))}else cr===2?(cr=0,dr(Qn),Br(Nt),Nt=null,Yt.forEach(de)):Fe(`invalid state: ${cr}`);return Kr}}(T=>{h().then(T)})}function or(h){return h>>>=0,zr(async()=>{var T=await ur(h);return _r(T)})}var Vt=[];function Zt(h,T,I,L){return I>>>=0,L>>>=0,(h=Vt[h>>>0])(null,T=ur(T>>>0),I,L)}var er={},tr=h=>{var T=er[h];return T===void 0?vr(h):T};function Rs(h,T,I,L,U){return I>>>=0,L>>>=0,U>>>=0,(h=Vt[h>>>0])(T=ur(T>>>0),T[I=tr(I)],L,U)}var cn=()=>typeof globalThis=="object"?globalThis:Function("return this")();function ei(h){return(h>>>=0)==0?_r(cn()):(h=tr(h),_r(cn()[h]))}var ti=h=>{var T=Vt.length;return Vt.push(h),T},ri=(h,T)=>{for(var I=Array(h),L=0;L>>2>>>0],"parameter "+L);return I},Cs=(h,T)=>Object.defineProperty(T,"name",{value:h});function si(h,T,I){var L=(T=ri(h,T>>>0)).shift();h--;var U=`return function (obj, func, destructorsRef, args) { +`,ue=0,Te=[];I===0&&Te.push("obj");for(var Oe=["retType"],Ke=[L],Ye=0;Yeht.name).join(", ")}) => ${L.name}>`,ti(Cs(I,h))}function ni(h){return h=tr(h>>>0),_r(n[h])}function oi(h,T){return T>>>=0,h=ur(h>>>0),T=ur(T),_r(h[T])}function ii(h){9<(h>>>=0)&&(xr[h+1]+=1)}function ai(){return _r([])}function lo(h){h=ur(h>>>0);for(var T=Array(h.length),I=0;I>>0))}function ui(){return _r({})}function uo(h){for(var T=ur(h>>>=0);T.length;){var I=T.pop();T.pop()(I)}Ps(h)}function di(h,T,I){T>>>=0,I>>>=0,h=ur(h>>>0),T=ur(T),I=ur(I),h[T]=I}function co(h,T){return T>>>=0,h=(h=Rt(h>>>0,"_emval_take_value")).readValueFromPointer(T),_r(h)}function ci(h,T){h=-9007199254740992>h||9007199254740992>>=0,h=new Date(1e3*h),se()[T>>>2>>>0]=h.getUTCSeconds(),se()[T+4>>>2>>>0]=h.getUTCMinutes(),se()[T+8>>>2>>>0]=h.getUTCHours(),se()[T+12>>>2>>>0]=h.getUTCDate(),se()[T+16>>>2>>>0]=h.getUTCMonth(),se()[T+20>>>2>>>0]=h.getUTCFullYear()-1900,se()[T+24>>>2>>>0]=h.getUTCDay(),h=(h.getTime()-Date.UTC(h.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,se()[T+28>>>2>>>0]=h}var Rn=h=>h%4==0&&(h%100!=0||h%400==0),pi=[0,31,60,91,121,152,182,213,244,274,305,335],po=[0,31,59,90,120,151,181,212,243,273,304,334];function ho(h,T){h=-9007199254740992>h||9007199254740992>>=0,h=new Date(1e3*h),se()[T>>>2>>>0]=h.getSeconds(),se()[T+4>>>2>>>0]=h.getMinutes(),se()[T+8>>>2>>>0]=h.getHours(),se()[T+12>>>2>>>0]=h.getDate(),se()[T+16>>>2>>>0]=h.getMonth(),se()[T+20>>>2>>>0]=h.getFullYear()-1900,se()[T+24>>>2>>>0]=h.getDay();var I=(Rn(h.getFullYear())?pi:po)[h.getMonth()]+h.getDate()-1|0;se()[T+28>>>2>>>0]=I,se()[T+36>>>2>>>0]=-60*h.getTimezoneOffset(),I=new Date(h.getFullYear(),6,1).getTimezoneOffset();var L=new Date(h.getFullYear(),0,1).getTimezoneOffset();h=0|(I!=L&&h.getTimezoneOffset()==Math.min(L,I)),se()[T+32>>>2>>>0]=h}function hi(h){h>>>=0;var T=new Date(se()[h+20>>>2>>>0]+1900,se()[h+16>>>2>>>0],se()[h+12>>>2>>>0],se()[h+8>>>2>>>0],se()[h+4>>>2>>>0],se()[h>>>2>>>0],0),I=se()[h+32>>>2>>>0],L=T.getTimezoneOffset(),U=new Date(T.getFullYear(),6,1).getTimezoneOffset(),ue=new Date(T.getFullYear(),0,1).getTimezoneOffset(),Te=Math.min(ue,U);return 0>I?se()[h+32>>>2>>>0]=+(U!=ue&&Te==L):0>>2>>>0]=T.getDay(),I=(Rn(T.getFullYear())?pi:po)[T.getMonth()]+T.getDate()-1|0,se()[h+28>>>2>>>0]=I,se()[h>>>2>>>0]=T.getSeconds(),se()[h+4>>>2>>>0]=T.getMinutes(),se()[h+8>>>2>>>0]=T.getHours(),se()[h+12>>>2>>>0]=T.getDate(),se()[h+16>>>2>>>0]=T.getMonth(),se()[h+20>>>2>>>0]=T.getYear(),h=T.getTime(),BigInt(isNaN(h)?-1:h/1e3)}function pn(h,T,I,L,U,ue,Te){return u?ke(16,1,h,T,I,L,U,ue,Te):-52}function mo(h,T,I,L,U,ue){if(u)return ke(17,1,h,T,I,L,U,ue)}var js={},mi=()=>performance.timeOrigin+performance.now();function fo(h,T){if(u)return ke(18,1,h,T);if(js[h]&&(clearTimeout(js[h].id),delete js[h]),!T)return 0;var I=setTimeout(()=>{delete js[h],de(()=>$o(h,performance.timeOrigin+performance.now()))},T);return js[h]={id:I,qc:T},0}function fi(h,T,I,L){h>>>=0,T>>>=0,I>>>=0,L>>>=0;var U=new Date().getFullYear(),ue=new Date(U,0,1).getTimezoneOffset();U=new Date(U,6,1).getTimezoneOffset();var Te=Math.max(ue,U);ce()[h>>>2>>>0]=60*Te,se()[T>>>2>>>0]=+(ue!=U),h=(T=Oe=>{var Ke=Math.abs(Oe);return`UTC${0<=Oe?"-":"+"}${String(Math.floor(Ke/60)).padStart(2,"0")}${String(Ke%60).padStart(2,"0")}`})(ue),T=T(U),UDate.now();function gi(h,T,I){return 0<=h&&3>=h?(h===0?h=Date.now():h=performance.timeOrigin+performance.now(),Z[I>>>0>>>3]=BigInt(Math.round(1e6*h)),0):28}var Ns=[],jn=(h,T)=>{Ns.length=0;for(var I;I=W()[h++>>>0];){var L=I!=105;T+=(L&=I!=112)&&T%8?4:0,Ns.push(I==112?ce()[T>>>2>>>0]:I==106?Z[T>>>3]:I==105?se()[T>>>2>>>0]:Ue()[T>>>3>>>0]),T+=L?8:4}return Ns};function wi(h,T,I){return h>>>=0,T=jn(T>>>0,I>>>0),Ve[h](...T)}function _o(h,T,I){return h>>>=0,T=jn(T>>>0,I>>>0),Ve[h](...T)}var Ss=()=>{};function bi(h,T){return y(Ft(h>>>0,T>>>0))}var ba=()=>{throw Ee+=1,"unwind"};function Mi(){return 4294901760}var Ma=()=>navigator.hardwareConcurrency;function yi(){return Fe("Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER"),0}function go(h){h>>>=0;var T=W().length;if(h<=T||4294901760=I;I*=2){var L=T*(1+.2/I);L=Math.min(L,h+100663296);e:{L=(Math.min(4294901760,65536*Math.ceil(Math.max(h,L)/65536))-b.buffer.byteLength+65535)/65536|0;try{b.grow(L),R();var U=1;break e}catch{}U=void 0}if(U)return!0}return!1}var hn=()=>(Fe("Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER"),0),Vs={},wo=h=>{h.forEach(T=>{hn()})};function vi(){var h=Error().stack.toString().split(` +`);return h[0]=="Error"&&h.shift(),wo(h),Vs.Lb=hn(),Vs.cc=h,Vs.Lb}function xi(h,T,I){if(h>>>=0,T>>>=0,Vs.Lb==h)var L=Vs.cc;else(L=Error().stack.toString().split(` +`))[0]=="Error"&&L.shift(),wo(L);for(var U=3;L[U]&&hn()!=h;)++U;for(h=0;h>>2>>>0]=hn();return h}var Us,Nn={},bo=()=>{if(!Us){var h,T={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(h in Nn)Nn[h]===void 0?delete T[h]:T[h]=Nn[h];var I=[];for(h in T)I.push(`${h}=${T[h]}`);Us=I}return Us};function Mo(h,T){if(u)return ke(19,1,h,T);h>>>=0,T>>>=0;var I=0;return bo().forEach((L,U)=>{var ue=T+I;for(U=ce()[h+4*U>>>2>>>0]=ue,ue=0;ue>>0]=L.charCodeAt(ue);F()[U>>>0]=0,I+=L.length+1}),0}function Vn(h,T){if(u)return ke(20,1,h,T);h>>>=0,T>>>=0;var I=bo();ce()[h>>>2>>>0]=I.length;var L=0;return I.forEach(U=>L+=U.length+1),ce()[T>>>2>>>0]=L,0}function yo(h){return u?ke(21,1,h):52}function vo(h,T,I,L){return u?ke(22,1,h,T,I,L):52}function Un(h,T,I,L){return u?ke(23,1,h,T,I,L):70}var Ti=[null,[],[]];function xo(h,T,I,L){if(u)return ke(24,1,h,T,I,L);T>>>=0,I>>>=0,L>>>=0;for(var U=0,ue=0;ue>>2>>>0],Oe=ce()[T+4>>>2>>>0];T+=8;for(var Ke=0;Ke>>0],ht=Ti[h];Ye===0||Ye===10?((h===1?E:y)(ws(ht)),ht.length=0):ht.push(Ye)}U+=Oe}return ce()[L>>>2>>>0]=U,0}u||function(){for(var h=n.numThreads-1;h--;)gs();le.unshift(()=>{Me++,function(T){u?T():Promise.all(Ge.map(Yr)).then(T)}(()=>Ae())})}();for(var Wn=Array(256),mn=0;256>mn;++mn)Wn[mn]=String.fromCharCode(mn);Wr=Wn,yr=n.BindingError=class extends Error{constructor(h){super(h),this.name="BindingError"}},n.InternalError=class extends Error{constructor(h){super(h),this.name="InternalError"}},xr.push(0,1,void 0,1,null,1,!0,1,!1,1),n.count_emval_handles=()=>xr.length/2-5-Gr.length;var nt,To=[Ie,Be,at,es,ts,De,Qe,et,Bt,Or,Pr,rs,ss,Ur,ns,os,pn,mo,fo,Mo,Vn,yo,vo,Un,xo];(async function(){function h(L,U){return nt=L.exports,nt=function(){var ue=nt,Te={};for(let[Oe,Ke]of Object.entries(ue))Te[Oe]=typeof Ke=="function"?(...Ye)=>{Dt.push(Oe);try{return Ke(...Ye)}finally{ae||(Dt.pop(),Nt&&cr===1&&Dt.length===0&&(cr=0,Ee+=1,dr(Ao),typeof Fibers<"u"&&Fibers.rc()))}}:Ke;return Te}(),nt=function(){var ue=nt,Te=Ke=>Ye=>Ke(Ye)>>>0,Oe=Ke=>()=>Ke()>>>0;return(ue=Object.assign({},ue)).Da=Te(ue.Da),ue.fb=Oe(ue.fb),ue.hb=Te(ue.hb),ue.tb=Te(ue.tb),ue.ub=Oe(ue.ub),ue.__cxa_get_exception_ptr=Te(ue.__cxa_get_exception_ptr),ue}(),wt.push(nt.ib),x=U,Ae(),nt}Me++;var T=ze();if(n.instantiateWasm)return new Promise(L=>{n.instantiateWasm(T,(U,ue)=>{h(U,ue),L(U.exports)})});if(u)return new Promise(L=>{we=U=>{var ue=new WebAssembly.Instance(U,ze());L(h(ue,U))}});xe??(xe=n.locateFile?n.locateFile?n.locateFile("ort-wasm-simd-threaded.jsep.wasm",w):w+"ort-wasm-simd-threaded.jsep.wasm":new URL("/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm",import.meta.url).href);try{var I=await async function(L){var U=xe;if(!me&&typeof WebAssembly.instantiateStreaming=="function"&&!V(U))try{var ue=fetch(U,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(ue,L)}catch(Te){y(`wasm streaming compile failed: ${Te}`),y("falling back to ArrayBuffer instantiation")}return async function(Te,Oe){try{var Ke=await async function(Ye){if(!me)try{var ht=await _(Ye);return new Uint8Array(ht)}catch{}if(Ye==xe&&me)Ye=new Uint8Array(me);else{if(!f)throw"both async and sync fetching of the wasm failed";Ye=f(Ye)}return Ye}(Te);return await WebAssembly.instantiate(Ke,Oe)}catch(Ye){y(`failed to asynchronously prepare wasm: ${Ye}`),Fe(Ye)}}(U,L)}(T);return h(I.instance,I.module)}catch(L){return o(L),Promise.reject(L)}})();var Eo=h=>(Eo=nt.Da)(h),Po=()=>(Po=nt.Ea)();n._OrtInit=(h,T)=>(n._OrtInit=nt.Fa)(h,T),n._OrtGetLastError=(h,T)=>(n._OrtGetLastError=nt.Ga)(h,T),n._OrtCreateSessionOptions=(h,T,I,L,U,ue,Te,Oe,Ke,Ye)=>(n._OrtCreateSessionOptions=nt.Ha)(h,T,I,L,U,ue,Te,Oe,Ke,Ye),n._OrtAppendExecutionProvider=(h,T,I,L,U)=>(n._OrtAppendExecutionProvider=nt.Ia)(h,T,I,L,U),n._OrtAddFreeDimensionOverride=(h,T,I)=>(n._OrtAddFreeDimensionOverride=nt.Ja)(h,T,I),n._OrtAddSessionConfigEntry=(h,T,I)=>(n._OrtAddSessionConfigEntry=nt.Ka)(h,T,I),n._OrtReleaseSessionOptions=h=>(n._OrtReleaseSessionOptions=nt.La)(h),n._OrtCreateSession=(h,T,I)=>(n._OrtCreateSession=nt.Ma)(h,T,I),n._OrtReleaseSession=h=>(n._OrtReleaseSession=nt.Na)(h),n._OrtGetInputOutputCount=(h,T,I)=>(n._OrtGetInputOutputCount=nt.Oa)(h,T,I),n._OrtGetInputOutputMetadata=(h,T,I,L)=>(n._OrtGetInputOutputMetadata=nt.Pa)(h,T,I,L),n._OrtFree=h=>(n._OrtFree=nt.Qa)(h),n._OrtCreateTensor=(h,T,I,L,U,ue)=>(n._OrtCreateTensor=nt.Ra)(h,T,I,L,U,ue),n._OrtGetTensorData=(h,T,I,L,U)=>(n._OrtGetTensorData=nt.Sa)(h,T,I,L,U),n._OrtReleaseTensor=h=>(n._OrtReleaseTensor=nt.Ta)(h),n._OrtCreateRunOptions=(h,T,I,L)=>(n._OrtCreateRunOptions=nt.Ua)(h,T,I,L),n._OrtAddRunConfigEntry=(h,T,I)=>(n._OrtAddRunConfigEntry=nt.Va)(h,T,I),n._OrtReleaseRunOptions=h=>(n._OrtReleaseRunOptions=nt.Wa)(h),n._OrtCreateBinding=h=>(n._OrtCreateBinding=nt.Xa)(h),n._OrtBindInput=(h,T,I)=>(n._OrtBindInput=nt.Ya)(h,T,I),n._OrtBindOutput=(h,T,I,L)=>(n._OrtBindOutput=nt.Za)(h,T,I,L),n._OrtClearBoundOutputs=h=>(n._OrtClearBoundOutputs=nt._a)(h),n._OrtReleaseBinding=h=>(n._OrtReleaseBinding=nt.$a)(h),n._OrtRunWithBinding=(h,T,I,L,U)=>(n._OrtRunWithBinding=nt.ab)(h,T,I,L,U),n._OrtRun=(h,T,I,L,U,ue,Te,Oe)=>(n._OrtRun=nt.bb)(h,T,I,L,U,ue,Te,Oe),n._OrtEndProfiling=h=>(n._OrtEndProfiling=nt.cb)(h),n._JsepOutput=(h,T,I)=>(n._JsepOutput=nt.db)(h,T,I),n._JsepGetNodeName=h=>(n._JsepGetNodeName=nt.eb)(h);var Ws=()=>(Ws=nt.fb)(),Br=n._free=h=>(Br=n._free=nt.gb)(h),fn=n._malloc=h=>(fn=n._malloc=nt.hb)(h),_n=(h,T,I,L,U,ue)=>(_n=nt.kb)(h,T,I,L,U,ue),Co=()=>(Co=nt.lb)(),So=(h,T,I,L,U)=>(So=nt.mb)(h,T,I,L,U),Gn=h=>(Gn=nt.nb)(h),Kn=h=>(Kn=nt.ob)(h),$o=(h,T)=>($o=nt.pb)(h,T),Hn=()=>(Hn=nt.qb)(),ko=(h,T)=>(ko=nt.rb)(h,T),gn=h=>(gn=nt.sb)(h),wn=h=>(wn=nt.tb)(h),qn=()=>(qn=nt.ub)(),Io=n.dynCall_ii=(h,T)=>(Io=n.dynCall_ii=nt.vb)(h,T),Xn=h=>(Xn=nt.wb)(h),Ao=()=>(Ao=nt.xb)(),Fo=h=>(Fo=nt.yb)(h),Qn=()=>(Qn=nt.zb)();return n.stackSave=()=>qn(),n.stackRestore=h=>gn(h),n.stackAlloc=h=>wn(h),n.setValue=function(h,T,I="i8"){switch(I.endsWith("*")&&(I="*"),I){case"i1":case"i8":F()[h>>>0]=T;break;case"i16":re()[h>>>1>>>0]=T;break;case"i32":se()[h>>>2>>>0]=T;break;case"i64":Z[h>>>3]=BigInt(T);break;case"float":$e()[h>>>2>>>0]=T;break;case"double":Ue()[h>>>3>>>0]=T;break;case"*":ce()[h>>>2>>>0]=T;break;default:Fe(`invalid type for setValue: ${I}`)}},n.getValue=function(h,T="i8"){switch(T.endsWith("*")&&(T="*"),T){case"i1":case"i8":return F()[h>>>0];case"i16":return re()[h>>>1>>>0];case"i32":return se()[h>>>2>>>0];case"i64":return Z[h>>>3];case"float":return $e()[h>>>2>>>0];case"double":return Ue()[h>>>3>>>0];case"*":return ce()[h>>>2>>>0];default:Fe(`invalid type for getValue: ${T}`)}},n.UTF8ToString=Ft,n.stringToUTF8=Xt,n.lengthBytesUTF8=bs,function h(){if(0{Ju(),Bl=typeof location>"u"?void 0:location.origin,Au=import.meta.url>"file:"&&import.meta.url<"file;",Pf=()=>{{if(Au){let e=URL;return new URL(new e("ort.bundle.min.mjs",import.meta.url).href,Bl).href}return import.meta.url}},jr=Pf(),kb=()=>{if(jr&&!jr.startsWith("blob:"))return jr.substring(0,jr.lastIndexOf("/")+1)},Xi=(e,r)=>{try{let t=r??jr;return(t?new URL(e,t):new URL(e)).origin===Bl}catch{return!1}},Cf=(e,r)=>{let t=r??jr;try{return(t?new URL(e,t):new URL(e)).href}catch{return}},Sf=(e,r)=>`${r??"./"}${e}`,Rl=async e=>{let r=await(await fetch(e,{credentials:"same-origin"})).blob();return URL.createObjectURL(r)},$f=async e=>(await import(e)).default,jl=(ex(),Jo(Pb)).default,Ib=async()=>{if(!jr)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(Xi(jr))return[void 0,jl()];let e=await Rl(jr);return[e,jl(e)]},Nl=(tx(),Jo(Sb)).default,Ab=async(e,r,t)=>{if(!e&&!r&&Nl&&jr&&Xi(jr))return[void 0,Nl];{let s="ort-wasm-simd-threaded.jsep.mjs",o=e??Cf(s,r),n=t&&o&&!Xi(o,r),i=n?await Rl(o):o??Sf(s,r);return[n?i:void 0,await $f(i)]}}}),Vl,Qi,zo,Ul,kf,If,Af,Zu,zt,zn=Re(()=>{Yu(),Qi=!1,zo=!1,Ul=!1,kf=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return 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}},If=()=>{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}},Af=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},Zu=async e=>{if(Qi)return Promise.resolve();if(zo)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(Ul)throw new Error("previous call to 'initializeWebAssembly()' failed.");zo=!0;let r=e.initTimeout,t=e.numThreads;if(e.simd!==!1){if(e.simd==="relaxed"){if(!Af())throw new Error("Relaxed WebAssembly SIMD is not supported in the current environment.")}else if(!If())throw new Error("WebAssembly SIMD is not supported in the current environment.")}let s=kf();t>1&&!s&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+t+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),e.numThreads=t=1);let o=e.wasmPaths,n=typeof o=="string"?o:void 0,i=o==null?void 0:o.mjs,a=(i==null?void 0:i.href)??i,l=o==null?void 0:o.wasm,u=(l==null?void 0:l.href)??l,p=e.wasmBinary,[d,c]=await Ab(a,n,t>1),_=!1,f=[];if(r>0&&f.push(new Promise(v=>{setTimeout(()=>{_=!0,v()},r)})),f.push(new Promise((v,$)=>{let w={numThreads:t};if(p)w.wasmBinary=p;else if(u||n)w.locateFile=g=>u??n+g;else if(a&&a.indexOf("blob:")!==0)w.locateFile=g=>new URL(g,a).href;else if(d){let g=kb();g&&(w.locateFile=C=>g+C)}c(w).then(g=>{zo=!1,Qi=!0,Vl=g,v(),d&&URL.revokeObjectURL(d)},g=>{zo=!1,Ul=!0,$(g)})})),await Promise.race(f),_)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},zt=()=>{if(Qi&&Vl)return Vl;throw new Error("WebAssembly is not initialized yet.")}}),ps,pa,At,ed=Re(()=>{zn(),ps=(e,r)=>{let t=zt(),s=t.lengthBytesUTF8(e)+1,o=t._malloc(s);return t.stringToUTF8(e,o,s),r.push(o),o},pa=(e,r,t,s)=>{if(typeof e=="object"&&e!==null){if(t.has(e))throw new Error("Circular reference in options");t.add(e)}Object.entries(e).forEach(([o,n])=>{let i=r?r+o:o;if(typeof n=="object")pa(n,i+".",t,s);else if(typeof n=="string"||typeof n=="number")s(i,n.toString());else if(typeof n=="boolean")s(i,n?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof n}`)})},At=e=>{let r=zt(),t=r.stackSave();try{let s=r.PTR_SIZE,o=r.stackAlloc(2*s);r._OrtGetLastError(o,o+s);let n=Number(r.getValue(o,s===4?"i32":"i64")),i=r.getValue(o+s,"*"),a=i?r.UTF8ToString(i):"";throw new Error(`${e} ERROR_CODE: ${n}, ERROR_MESSAGE: ${a}`)}finally{r.stackRestore(t)}}}),Fb,rx=Re(()=>{zn(),ed(),Fb=e=>{let r=zt(),t=0,s=[],o=e||{};try{if((e==null?void 0:e.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof e.logSeverityLevel!="number"||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if((e==null?void 0:e.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!="number"||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);(e==null?void 0:e.terminate)===void 0&&(o.terminate=!1);let n=0;return(e==null?void 0:e.tag)!==void 0&&(n=ps(e.tag,s)),t=r._OrtCreateRunOptions(o.logSeverityLevel,o.logVerbosityLevel,!!o.terminate,n),t===0&&At("Can't create run options."),(e==null?void 0:e.extra)!==void 0&&pa(e.extra,"",new WeakSet,(i,a)=>{let l=ps(i,s),u=ps(a,s);r._OrtAddRunConfigEntry(t,l,u)!==0&&At(`Can't set a run config entry: ${i} - ${a}.`)}),[t,s]}catch(n){throw t!==0&&r._OrtReleaseRunOptions(t),s.forEach(i=>r._free(i)),n}}}),Ff,Of,Df,Bo,Lf,Ob,sx=Re(()=>{zn(),ed(),Ff=e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}},Of=e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}},Df=e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});let r=e.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some(t=>(typeof t=="string"?t:t.name)==="webgpu")&&(e.enableMemPattern=!1)},Bo=(e,r,t,s)=>{let o=ps(r,s),n=ps(t,s);zt()._OrtAddSessionConfigEntry(e,o,n)!==0&&At(`Can't set a session config entry: ${r} - ${t}.`)},Lf=async(e,r,t)=>{for(let s of r){let o=typeof s=="string"?s:s.name,n=[];switch(o){case"webnn":if(o="WEBNN",typeof s!="string"){let p=s==null?void 0:s.deviceType;p&&Bo(e,"deviceType",p,t)}break;case"webgpu":if(o="JS",typeof s!="string"){let p=s;if(p!=null&&p.preferredLayout){if(p.preferredLayout!=="NCHW"&&p.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${p.preferredLayout}`);Bo(e,"preferredLayout",p.preferredLayout,t)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${o}`)}let i=ps(o,t),a=n.length,l=0,u=0;if(a>0){l=zt()._malloc(a*zt().PTR_SIZE),t.push(l),u=zt()._malloc(a*zt().PTR_SIZE),t.push(u);for(let p=0;p{let r=zt(),t=0,s=[],o=e||{};Df(o);try{let n=Ff(o.graphOptimizationLevel??"all"),i=Of(o.executionMode??"sequential"),a=typeof o.logId=="string"?ps(o.logId,s):0,l=o.logSeverityLevel??2;if(!Number.isInteger(l)||l<0||l>4)throw new Error(`log serverity level is not valid: ${l}`);let u=o.logVerbosityLevel??0;if(!Number.isInteger(u)||u<0||u>4)throw new Error(`log verbosity level is not valid: ${u}`);let p=typeof o.optimizedModelFilePath=="string"?ps(o.optimizedModelFilePath,s):0;if(t=r._OrtCreateSessionOptions(n,!!o.enableCpuMemArena,!!o.enableMemPattern,i,!!o.enableProfiling,0,a,l,u,p),t===0&&At("Can't create session options."),o.executionProviders&&await Lf(t,o.executionProviders,s),o.enableGraphCapture!==void 0){if(typeof o.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${o.enableGraphCapture}`);Bo(t,"enableGraphCapture",o.enableGraphCapture.toString(),s)}if(o.freeDimensionOverrides)for(let[d,c]of Object.entries(o.freeDimensionOverrides)){if(typeof d!="string")throw new Error(`free dimension override name must be a string: ${d}`);if(typeof c!="number"||!Number.isInteger(c)||c<0)throw new Error(`free dimension override value must be a non-negative integer: ${c}`);let _=ps(d,s);r._OrtAddFreeDimensionOverride(t,_,c)!==0&&At(`Can't set a free dimension override: ${d} - ${c}.`)}return o.extra!==void 0&&pa(o.extra,"",new WeakSet,(d,c)=>{Bo(t,d,c,s)}),[t,s]}catch(n){throw t!==0&&r._OrtReleaseSessionOptions(t)!==0&&At("Can't release session options."),s.forEach(i=>r._free(i)),n}}}),ro,Fs,An,td,ha,rd,sd,Fu,ut=Re(()=>{ro=e=>{switch(e){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"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${e}`)}},Fs=e=>{switch(e){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 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${e}`)}},An=(e,r)=>{let t=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],s=typeof r=="number"?r:r.reduce((o,n)=>o*n,1);return t>0?Math.ceil(s*t):void 0},td=e=>{switch(e){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}},ha=e=>{switch(e){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: ${e}`)}},rd=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",sd=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint64"||e==="int8"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",Fu=e=>{switch(e){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${e}`)}}}),nd,Db=Re(()=>{Ju(),nd=async e=>{if(typeof e=="string"){let r=await fetch(e);if(!r.ok)throw new Error(`failed to load external data file: ${e}`);let t=r.headers.get("Content-Length"),s=t?parseInt(t,10):0;if(s<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${e}, no response body.`);let o=r.body.getReader(),n;try{n=new ArrayBuffer(s)}catch(a){if(a instanceof RangeError){let l=Math.ceil(s/65536);n=new WebAssembly.Memory({initial:l,maximum:l}).buffer}else throw a}let i=0;for(;;){let{done:a,value:l}=await o.read();if(a)break;let u=l.byteLength;new Uint8Array(n,i,u).set(l),i+=u}return new Uint8Array(n,0,s)}}else return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),zf,Bf,Rf,jf,od,Nf,Tt,Os=Re(()=>{ut(),zf=["V","I","W","E","F"],Bf=(e,r)=>{console.log(`[${zf[e]},${new Date().toISOString()}]${r}`)},od=(e,r)=>{Rf=e,jf=r},Nf=(e,r)=>{let t=ha(e),s=ha(Rf);t>=s&&Bf(t,typeof r=="function"?r():r)},Tt=(...e)=>{jf&&Nf(...e)}}),Vf,oo,be,ma,Lb,zb,Bb,ft=Re(()=>{Vf=class{static calcMatMulShape(e,r){return e[1]!==r[0]?void 0:[e[0],r[1]]}},oo=class{static calcShape(e,r,t=!1){let s=e.length,o=r.length;if(s===0)return r;if(o===0)return e;let n=Math.max(e.length,r.length),i=new Array(n);if(t){if(s<2||o<2)return;let a=Vf.calcMatMulShape([e[s-2],e[s-1]],[r[o-2],r[o-1]]);if(a===void 0)return;[i[n-2],i[n-1]]=a}for(let a=t?3:1;a<=n;a++){let l=s-a<0?1:e[s-a],u=o-a<0?1:r[o-a];if(l!==u&&l>1&&u>1)return;let p=Math.max(l,u);if(l&&u)i[n-a]=Math.max(l,u);else{if(p>1)return;i[n-a]=0}}return i}static isValidBroadcast(e,r){let t=e.length,s=r.length;if(t>s)return!1;for(let o=1;o<=t;o++)if(e[t-o]!==1&&e[t-o]!==r[s-o])return!1;return!0}},be=class da{static size(r){return da.getSizeFromDimensionRange(r,0,r.length)}static convertShape(r,t=4){let s=r.length;if(s===0)return[];let o=new Array(s),n=s-1;for(;n>=0;){if(r[n]%t===0){o[n]=r[n]/t;break}if(t%r[n]!==0)throw new Error("cannot convert shape");o[n]=1,t/=r[n],n--}for(n--;n>=0;n--)o[n]=r[n];return o}static sizeFromDimension(r,t){if(t<0||t>r.length)throw new Error(`invalid dimension of ${t} for sizeFromDimension as Tensor has ${r.length} dimensions.`);return da.getSizeFromDimensionRange(r,t,r.length)}static sizeToDimension(r,t){if(t<0||t>r.length)throw new Error(`invalid dimension of ${t} for sizeToDimension as Tensor has ${r.length} dimensions.`);return da.getSizeFromDimensionRange(r,0,t)}static getSizeFromDimensionRange(r,t,s){let o=1;for(let n=t;n=0;--o)s[o]=s[o+1]*r[o+1];return s}static normalizeAxis(r,t){if(r<-t&&r>=t)throw new Error("unsupported axis for this operation.");return r<0?r+t:r}static normalizeAxes(r,t){return r.map(s=>this.normalizeAxis(s,t??r.length))}static sortBasedOnPerm(r,t){return t?t.map(s=>r[s]):r.slice().reverse()}static padShape(r,t){let s=r.length;return r.map((o,n)=>o+t[n]+t[n+s])}static areEqual(r,t){return r.length!==t.length?!1:r.every((s,o)=>s===t[o])}},ma=class Ho{static adjustPoolAttributes(r,t,s,o,n,i){if(!r&&s.length!==t.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(r)for(let a=0;a=s.length?s.push(t[a+2]):s[a]=t[a+2];for(let a=0;a=s[a]||i[a+s.length]>=s[a])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(r,t,s,o,n,i,a){if(a){if(n.length!==2*(r.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(t.length!==r.length-2)throw new Error("length of strides should be the length of data dimensions");if(o.length!==r.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let l=0;l{ut(),id=(e,r)=>new(td(r))(e)}),Ou,Wl,Uf,Gl,Wf,Kl,Hl,ql,Gf,jb,nx=Re(()=>{Os(),Ou=(e,r=!0)=>{if(e.byteLength%8!==0)throw new Error("Invalid Uint8Array length - must be a multiple of 8 (BigInt).");let t=e.byteLength/8,s=new BigInt64Array(e.buffer,e.byteOffset,t),o=new Int32Array(t);for(let n=0;n2147483647n||i<-2147483648n)throw new Error(`Overflow occurred when converting BigInt to Int32 at index ${n}: ${i}`);o[n]=Number(i)}return r?new Uint8Array(o.buffer):o},Wl=(e,r=!0)=>{if(e.byteLength%4!==0)throw new Error("Invalid Uint8Array length - must be a multiple of 4 (Int32).");let t=e.byteLength/4,s=new Int32Array(e.buffer,e.byteOffset,t),o=BigInt64Array.from(s,BigInt);return r?new Uint8Array(o.buffer):o},Uf=1,Gl=()=>Uf++,Wf=new Map([["float32",32],["float16",16],["int32",32],["uint32",32],["int64",64],["uint64",64],["int8",8],["uint8",8],["int4",4],["uint4",4]]),Kl=(e,r)=>{let t=Wf.get(e);if(!t)throw new Error("Unsupported data type.");return r.length>0?Math.ceil(r.reduce((s,o)=>s*o)*t/8):0},Hl=class{constructor(e){this.shouldConvertInt64toInt32=!1,this.isInt64ToInt32Converted=!1;let{sessionId:r,context:t,tensor:s,dataType:o,shape:n,shouldConvertInt64toInt32:i=!1}=e;this.sessionId=r,this.mlContext=t,this.mlTensor=s,this.dataType=o,this.tensorShape=n,this.shouldConvertInt64toInt32=i}get tensor(){return this.mlTensor}get type(){return this.dataType}get shape(){return this.tensorShape}get byteLength(){return Kl(this.dataType,this.tensorShape)}destroy(){Tt("verbose",()=>"[WebNN] TensorWrapper.destroy"),this.mlTensor.destroy()}write(e){this.mlContext.writeTensor(this.mlTensor,e)}async read(e,r){if(e){let t=await this.mlContext.readTensor(this.mlTensor),s=Wl(new Uint8Array(t));if(r){(r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).set(s);return}else return s.buffer}else return r?this.mlContext.readTensor(this.mlTensor,r):this.mlContext.readTensor(this.mlTensor)}canReuseTensor(e,r,t){return this.mlContext===e&&this.dataType===r&&this.tensorShape.length===t.length&&this.tensorShape.every((s,o)=>s===t[o])}setIsInt64ToInt32Converted(e){this.isInt64ToInt32Converted=e}},ql=class{constructor(e,r){this.tensorManager=e,this.wrapper=r}get tensorWrapper(){return this.wrapper}releaseTensor(){this.tensorWrapper&&(this.tensorManager.releaseTensor(this.tensorWrapper),this.wrapper=void 0)}async ensureTensor(e,r,t,s){let o=r,n=this.tensorManager.getMLContext(e),i=o==="int64"&&!n.opSupportLimits().input.dataTypes.includes("int64");if(i&&(o="int32",Tt("verbose",()=>"[WebNN] TensorIdTracker.ensureTensor: convert dataType from int64 to int32")),this.wrapper){if(this.wrapper.canReuseTensor(n,o,t))return this.wrapper.tensor;if(s){if(this.wrapper.byteLength!==Kl(o,t))throw new Error("Unable to copy data to tensor with different size.");this.activeUpload=new Uint8Array(await this.wrapper.read())}this.tensorManager.releaseTensor(this.wrapper)}let a=typeof MLTensorUsage>"u"?void 0:MLTensorUsage.READ|MLTensorUsage.WRITE;return this.wrapper=await this.tensorManager.getCachedTensor(e,o,t,a,!0,!0,i),s&&this.activeUpload&&(this.wrapper.write(this.activeUpload),this.activeUpload=void 0),this.wrapper.tensor}upload(e){let r=e;if(this.wrapper)if(this.wrapper.shouldConvertInt64toInt32&&(r=Ou(e,!0),this.wrapper.setIsInt64ToInt32Converted(!0)),r.byteLength===this.wrapper.byteLength){this.wrapper.write(r);return}else Tt("verbose",()=>"Data size does not match tensor size. Releasing tensor."),this.releaseTensor();this.activeUpload?this.activeUpload.set(r):this.activeUpload=new Uint8Array(r)}async download(e){var r,t,s;if(this.activeUpload){let o=(r=this.wrapper)!=null&&r.isInt64ToInt32Converted?Wl(this.activeUpload):this.activeUpload;if(e){e instanceof ArrayBuffer?new Uint8Array(e).set(o):new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(o);return}else return o.buffer}if(!this.wrapper)throw new Error("Tensor has not been created.");return e?this.wrapper.read((t=this.wrapper)==null?void 0:t.shouldConvertInt64toInt32,e):this.wrapper.read((s=this.wrapper)==null?void 0:s.shouldConvertInt64toInt32)}},Gf=class{constructor(e){this.backend=e,this.tensorTrackersById=new Map,this.freeTensors=[],this.externalTensors=new Set}getMLContext(e){let r=this.backend.getMLContext(e);if(!r)throw new Error("MLContext not found for session.");return r}reserveTensorId(){let e=Gl();return this.tensorTrackersById.set(e,new ql(this)),e}releaseTensorId(e){let r=this.tensorTrackersById.get(e);r&&(this.tensorTrackersById.delete(e),r.tensorWrapper&&this.releaseTensor(r.tensorWrapper))}async ensureTensor(e,r,t,s,o){Tt("verbose",()=>`[WebNN] TensorManager.ensureTensor {tensorId: ${r}, dataType: ${t}, shape: ${s}, copyOld: ${o}}`);let n=this.tensorTrackersById.get(r);if(!n)throw new Error("Tensor not found.");return n.ensureTensor(e,t,s,o)}upload(e,r){let t=this.tensorTrackersById.get(e);if(!t)throw new Error("Tensor not found.");t.upload(r)}async download(e,r){Tt("verbose",()=>`[WebNN] TensorManager.download {tensorId: ${e}, dstBuffer: ${r==null?void 0:r.byteLength}}`);let t=this.tensorTrackersById.get(e);if(!t)throw new Error("Tensor not found.");return t.download(r)}releaseTensorsForSession(e){for(let r of this.freeTensors)r.sessionId===e&&r.destroy();this.freeTensors=this.freeTensors.filter(r=>r.sessionId!==e)}registerTensor(e,r,t,s){let o=this.getMLContext(e),n=Gl(),i=new Hl({sessionId:e,context:o,tensor:r,dataType:t,shape:s});return this.tensorTrackersById.set(n,new ql(this,i)),this.externalTensors.add(i),n}async getCachedTensor(e,r,t,s,o,n,i=!1){let a=this.getMLContext(e);for(let[u,p]of this.freeTensors.entries())if(p.canReuseTensor(a,r,t)){Tt("verbose",()=>`[WebNN] Reusing tensor {dataType: ${r}, shape: ${t}}`);let d=this.freeTensors.splice(u,1)[0];return d.sessionId=e,d}Tt("verbose",()=>`[WebNN] MLContext.createTensor {dataType: ${r}, shape: ${t}}`);let l=await a.createTensor({dataType:r,shape:t,dimensions:t,usage:s,writable:o,readable:n});return new Hl({sessionId:e,context:a,tensor:l,dataType:r,shape:t,shouldConvertInt64toInt32:i})}releaseTensor(e){this.externalTensors.has(e)&&this.externalTensors.delete(e),this.freeTensors.push(e)}},jb=(...e)=>new Gf(...e)}),Ji,Kf,Nb,ox=Re(()=>{ut(),zn(),Rb(),nx(),Os(),Ji=new Map([[1,"float32"],[10,"float16"],[6,"int32"],[12,"uint32"],[7,"int64"],[13,"uint64"],[22,"int4"],[21,"uint4"],[3,"int8"],[2,"uint8"],[9,"uint8"]]),Kf=(e,r)=>{if(e===r)return!0;if(e===void 0||r===void 0)return!1;let t=Object.keys(e).sort(),s=Object.keys(r).sort();return t.length===s.length&&t.every((o,n)=>o===s[n]&&e[o]===r[o])},Nb=class{constructor(e){this.tensorManager=jb(this),this.mlContextBySessionId=new Map,this.sessionIdsByMLContext=new Map,this.mlContextCache=[],this.sessionGraphInputs=new Map,this.temporaryGraphInputs=[],this.temporarySessionTensorIds=new Map,od(e.logLevel,!!e.debug)}get currentSessionId(){if(this.activeSessionId===void 0)throw new Error("No active session");return this.activeSessionId}onRunStart(e){Tt("verbose",()=>`[WebNN] onRunStart {sessionId: ${e}}`),this.activeSessionId=e}onRunEnd(e){Tt("verbose",()=>`[WebNN] onRunEnd {sessionId: ${e}}`);let r=this.temporarySessionTensorIds.get(e);if(r){for(let t of r)Tt("verbose",()=>`[WebNN] releasing temporary tensor {tensorId: ${t}}`),this.tensorManager.releaseTensorId(t);this.temporarySessionTensorIds.delete(e),this.activeSessionId=void 0}}async createMLContext(e){if(e instanceof GPUDevice){let t=this.mlContextCache.findIndex(s=>s.gpuDevice===e);if(t!==-1)return this.mlContextCache[t].mlContext;{let s=await navigator.ml.createContext(e);return this.mlContextCache.push({gpuDevice:e,mlContext:s}),s}}else if(e===void 0){let t=this.mlContextCache.findIndex(s=>s.options===void 0&&s.gpuDevice===void 0);if(t!==-1)return this.mlContextCache[t].mlContext;{let s=await navigator.ml.createContext();return this.mlContextCache.push({mlContext:s}),s}}let r=this.mlContextCache.findIndex(t=>Kf(t.options,e));if(r!==-1)return this.mlContextCache[r].mlContext;{let t=await navigator.ml.createContext(e);return this.mlContextCache.push({options:e,mlContext:t}),t}}registerMLContext(e,r){this.mlContextBySessionId.set(e,r);let t=this.sessionIdsByMLContext.get(r);t||(t=new Set,this.sessionIdsByMLContext.set(r,t)),t.add(e),this.temporaryGraphInputs.length>0&&(this.sessionGraphInputs.set(e,this.temporaryGraphInputs),this.temporaryGraphInputs=[])}onReleaseSession(e){this.sessionGraphInputs.delete(e);let r=this.mlContextBySessionId.get(e);if(!r)return;this.tensorManager.releaseTensorsForSession(e),this.mlContextBySessionId.delete(e);let t=this.sessionIdsByMLContext.get(r);if(t.delete(e),t.size===0){this.sessionIdsByMLContext.delete(r);let s=this.mlContextCache.findIndex(o=>o.mlContext===r);s!==-1&&this.mlContextCache.splice(s,1)}}getMLContext(e){return this.mlContextBySessionId.get(e)}reserveTensorId(){return this.tensorManager.reserveTensorId()}releaseTensorId(e){Tt("verbose",()=>`[WebNN] releaseTensorId {tensorId: ${e}}`),this.tensorManager.releaseTensorId(e)}async ensureTensor(e,r,t,s,o){let n=Ji.get(t);if(!n)throw new Error(`Unsupported ONNX data type: ${t}`);return this.tensorManager.ensureTensor(e??this.currentSessionId,r,n,s,o)}async createTemporaryTensor(e,r,t){Tt("verbose",()=>`[WebNN] createTemporaryTensor {onnxDataType: ${r}, shape: ${t}}`);let s=Ji.get(r);if(!s)throw new Error(`Unsupported ONNX data type: ${r}`);let o=this.tensorManager.reserveTensorId();await this.tensorManager.ensureTensor(e,o,s,t,!1);let n=this.temporarySessionTensorIds.get(e);return n?n.push(o):this.temporarySessionTensorIds.set(e,[o]),o}uploadTensor(e,r){if(!zt().shouldTransferToMLTensor)throw new Error("Trying to upload to a MLTensor while shouldTransferToMLTensor is false");Tt("verbose",()=>`[WebNN] uploadTensor {tensorId: ${e}, data: ${r.byteLength}}`),this.tensorManager.upload(e,r)}async downloadTensor(e,r){return this.tensorManager.download(e,r)}createMLTensorDownloader(e,r){return async()=>{let t=await this.tensorManager.download(e);return id(t,r)}}registerMLTensor(e,r,t,s){let o=Ji.get(t);if(!o)throw new Error(`Unsupported ONNX data type: ${t}`);let n=this.tensorManager.registerTensor(e,r,o,s);return Tt("verbose",()=>`[WebNN] registerMLTensor {tensor: ${r}, dataType: ${o}, dimensions: ${s}} -> {tensorId: ${n}}`),n}registerMLConstant(e,r,t,s,o,n,i=!1){if(!n)throw new Error("External mounted files are not available.");let a=e;e.startsWith("./")&&(a=e.substring(2));let l=n.get(a);if(!l)throw new Error(`File with name ${a} not found in preloaded files.`);if(r+t>l.byteLength)throw new Error("Out of bounds: data offset and length exceed the external file data size.");let u=l.slice(r,r+t).buffer,p;switch(o.dataType){case"float32":p=new Float32Array(u);break;case"float16":p=typeof Float16Array<"u"&&Float16Array.from?new Float16Array(u):new Uint16Array(u);break;case"int32":p=new Int32Array(u);break;case"uint32":p=new Uint32Array(u);break;case"int64":i?(p=Ou(new Uint8Array(u),!1),o.dataType="int32"):p=new BigInt64Array(u);break;case"uint64":p=new BigUint64Array(u);break;case"int8":p=new Int8Array(u);break;case"int4":case"uint4":case"uint8":p=new Uint8Array(u);break;default:throw new Error(`Unsupported data type: ${o.dataType} in creating WebNN Constant from external data.`)}return Tt("verbose",()=>`[WebNN] registerMLConstant {dataType: ${o.dataType}, shape: ${o.shape}}} ${i?"(Note: it was int64 data type and registered to int32 as workaround)":""}`),s.constant(o,p)}registerGraphInput(e){this.temporaryGraphInputs.push(e)}isGraphInput(e,r){let t=this.sessionGraphInputs.get(e);return t?t.includes(r):!1}isInt64Supported(e){var r;return!!((r=this.mlContextBySessionId.get(e))!=null&&r.opSupportLimits().input.dataTypes.includes("int64"))}flush(){}}}),ad=Re(()=>{}),Xl,Yi,Zi,Hf,qf,Ql,Du,Xf,Vb,ix=Re(()=>{Os(),ad(),Xl=new Map([[64,250],[128,200],[256,200],[512,200],[2048,230],[4096,200],[8192,50],[16384,50],[32768,50],[65536,50],[131072,50],[262144,50],[524288,50],[1048576,50],[2097152,30],[4194304,20],[8388608,10],[12582912,10],[16777216,10],[26214400,15],[33554432,22],[44236800,2],[58982400,6],[67108864,6],[134217728,6],[167772160,6]]),Yi=[],Zi=e=>Math.ceil(Number(e)/16)*16,Hf=e=>{for(let r=0;rqf++,Du=async(e,r,t,s)=>{let o=Zi(t),n=e.device.createBuffer({size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});try{let i=e.getCommandEncoder();e.endComputePass(),i.copyBufferToBuffer(r,0,n,0,o),e.flush(),await n.mapAsync(GPUMapMode.READ);let a=n.getMappedRange();if(s){let l=s();return l.set(new Uint8Array(a,0,t)),l}else return new Uint8Array(a.slice(0,t))}finally{n.destroy()}},Xf=class{constructor(e){this.backend=e,this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.buffersPending=[],this.capturedPendingBuffers=new Map;for(let[r]of Xl)Yi.push(r),this.freeBuffers.set(r,[]),this.freeUniformBuffers.set(r,[]);this.sessionCount=0}upload(e,r){let t=r.buffer,s=r.byteOffset,o=r.byteLength,n=Zi(o),i=this.storageCache.get(e);if(!i)throw new Error("gpu data for uploading does not exist");if(Number(i.originalSize)!==o)throw new Error(`inconsistent data size. gpu data size=${i.originalSize}, data size=${o}`);let a=this.backend.device.createBuffer({mappedAtCreation:!0,size:n,usage:GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC}),l=a.getMappedRange();new Uint8Array(l).set(new Uint8Array(t,s,o)),a.unmap();let u=this.backend.device.createCommandEncoder();u.copyBufferToBuffer(a,0,i.gpuData.buffer,0,n),this.backend.device.queue.submit([u.finish()]),a.destroy(),Tt("verbose",()=>`[WebGPU] GpuDataManager.upload(id=${e})`)}memcpy(e,r){let t=this.storageCache.get(e);if(!t)throw new Error("source gpu data for memcpy does not exist");let s=this.storageCache.get(r);if(!s)throw new Error("destination gpu data for memcpy does not exist");if(t.originalSize!==s.originalSize)throw new Error("inconsistent source and destination gpu data size");let o=Zi(t.originalSize),n=this.backend.getCommandEncoder();this.backend.endComputePass(),n.copyBufferToBuffer(t.gpuData.buffer,0,s.gpuData.buffer,0,o)}registerExternalBuffer(e,r,t){let s;if(t){if(s=t[0],e===t[1])return Tt("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, buffer is the same, skip.`),s;if(this.backend.capturedCommandList.has(this.backend.currentSessionId))throw new Error(`Registering a different external buffer under graph capture mode is not supported yet. + Please use the previous external buffer!`)}else s=Ql();return this.storageCache.set(s,{gpuData:{id:s,type:0,buffer:e},originalSize:r}),Tt("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, registered.`),s}unregisterExternalBuffer(e){e!==void 0&&(this.storageCache.delete(e),Tt("verbose",()=>`[WebGPU] GpuDataManager.unregisterExternalBuffer() => id=${e}`))}create(e,r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST){let t=Hf(e),s,o=(r&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE,n=(r&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM;if(o||n){let a=(o?this.freeBuffers:this.freeUniformBuffers).get(t);a?a.length>0?s=a.pop():s=this.backend.device.createBuffer({size:t,usage:r}):s=this.backend.device.createBuffer({size:t,usage:r})}else s=this.backend.device.createBuffer({size:t,usage:r});let i={id:Ql(),type:0,buffer:s};return this.storageCache.set(i.id,{gpuData:i,originalSize:Number(e)}),Tt("verbose",()=>`[WebGPU] GpuDataManager.create(size=${e}) => id=${i.id}`),i}get(e){var r;return(r=this.storageCache.get(e))==null?void 0:r.gpuData}release(e){let r=typeof e=="bigint"?Number(e):e,t=this.storageCache.get(r);if(!t){if(this.storageCache.size===0)return 0;throw new Error("releasing data does not exist")}return Tt("verbose",()=>`[WebGPU] GpuDataManager.release(id=${r}), gpuDataId=${t.gpuData.id}`),this.storageCache.delete(r),this.buffersPending.push(t.gpuData.buffer),t.originalSize}async download(e,r){let t=this.storageCache.get(Number(e));if(!t)throw new Error("data does not exist");await Du(this.backend,t.gpuData.buffer,t.originalSize,r)}refreshPendingBuffers(){if(this.buffersPending.length!==0)if(this.backend.sessionStatus==="default"){for(let e of this.buffersPending){let r=Xl.get(e.size);if((e.usage&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE){let t=this.freeBuffers.get(e.size)||[];r===void 0||t.length>=r?e.destroy():t.push(e)}else if((e.usage&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM){let t=this.freeUniformBuffers.get(e.size)||[];r===void 0||t.length>=r?e.destroy():t.push(e)}else e.destroy()}this.buffersPending=[]}else{let e=this.capturedPendingBuffers.get(this.backend.currentSessionId);e||(e=[],this.capturedPendingBuffers.set(this.backend.currentSessionId,e));for(let r of this.buffersPending)e.push(r);this.buffersPending=[]}}dispose(){this.freeBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.freeUniformBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache.forEach(e=>{e.gpuData.buffer.destroy()}),this.capturedPendingBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.capturedPendingBuffers=new Map}onCreateSession(){this.sessionCount+=1}onReleaseSession(e){let r=this.capturedPendingBuffers.get(e);r&&(r.forEach(t=>{t.destroy()}),this.capturedPendingBuffers.delete(e)),this.sessionCount-=1,this.sessionCount===0&&(Tt("warning",()=>"[WebGPU] Clearing webgpu buffer cache"),this.storageCache.forEach(t=>{t.gpuData.buffer.destroy()}),this.storageCache=new Map)}},Vb=(...e)=>new Xf(...e)}),Qf,$t,Jt=Re(()=>{Qf=class{constructor(e){Object.assign(this,e)}get cacheKey(){return this.key||(this.key=Object.getOwnPropertyNames(this).sort().map(e=>`${this[e]}`).join(";")),this.key}},$t=e=>new Qf(e)}),io,ea,mr,Er,st,qt,Lu,no,Qs,rt,Ro,Pe,Ze,Ub,ld,Jf,Wb,_t=Re(()=>{ut(),ft(),io=64,ea=(e,r)=>{if(r===3)throw new Error("vec3 has same alignment as vec4, use vec4 instead");switch(Number(e)){case 10:return r>1?`vec${r}`:"f16";case 1:return r>1?`vec${r}`:"f32";case 6:return r>1?`vec${r}`:"i32";case 12:return r>1?`vec${r}`:"u32";case 7:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","i32"];case 13:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","u32"];case 9:if(r!==4)throw new Error("bool must be vec4");return["u32","vec4"];case 22:return"i32";case 21:return"u32";default:throw new Error(`Unknown data type: ${e}`)}},mr=(e,r=1)=>{let t=ea(e,r);return typeof t=="string"?t:t[0]},Er=(e,r=1)=>{let t=ea(e,r);return typeof t=="string"?t:t[1]},st=(...e)=>{let r=[];return e.forEach(t=>{t.length!==0&&r.push({type:12,data:t},{type:12,data:be.computeStrides(t)})}),r},qt=e=>e%4===0?4:e%2===0?2:1,Lu=(e="f32",r,t="0")=>!r||r===1?`${e}(${t})`:`vec${r}<${e}>(${t})`,no=(e,r,t)=>e==="f32"?t:r===1?`f32(${t})`:`vec${r}(${t})`,Qs=(e,r)=>r===4?`(${e}.x + ${e}.y + ${e}.z + ${e}.w)`:r===2?`(${e}.x + ${e}.y)`:r===3?`(${e}.x + ${e}.y + ${e}.z)`:e,rt=(e,r,t,s)=>e.startsWith("uniforms.")&&t>4?typeof r=="string"?s==="f16"?`${e}[(${r}) / 8][(${r}) % 8 / 4][(${r}) % 8 % 4]`:`${e}[(${r}) / 4][(${r}) % 4]`:s==="f16"?`${e}[${Math.floor(r/8)}][${Math.floor(r%8/4)}][${r%8%4}]`:`${e}[${Math.floor(r/4)}][${r%4}]`:t>1?`${e}[${r}]`:e,Ro=(e,r,t,s,o)=>{let n=typeof t=="number",i=n?t:t.length,a=[...new Array(i).keys()],l=i<2?"u32":i<=4?`vec${i}`:`array`,u=ea(r,o),p=typeof u=="string"?u:u[1],d=typeof u=="string"?u:u[0],c={indices:l,value:p,storage:d,tensor:r},_=V=>typeof V=="string"?V:`${V}u`,f={offsetToIndices:!1,indicesToOffset:!1,broadcastedIndicesToOffset:!1,set:!1,setByIndices:!1,get:!1,getByIndices:!1},v=n?"uniforms.":"",$=`${v}${e}_shape`,w=`${v}${e}_strides`,g="";for(let V=0;V ${c.indices} { + var indices: ${c.indices}; + var current = offset; + ${g} + return indices; + }`,E=V=>(f.offsetToIndices=!0,i<2?V:`o2i_${e}(${V})`),y=[];if(i>=2)for(let V=i-1;V>=0;V--)y.push(`${rt(w,V,i)} * (indices[${V}])`);let b=i<2?"":` + fn i2o_${e}(indices: ${c.indices}) -> u32 { + return ${y.join("+")}; + }`,x=V=>(f.indicesToOffset=!0,i<2?V:`i2o_${e}(${V})`),S=(...V)=>i===0?"0u":`${c.indices}(${V.map(_).join(",")})`,A=(V,F)=>i<2?`${V}`:`${rt(V,F,i)}`,B=(V,F,W)=>i<2?`${V}=${W};`:`${rt(V,F,i)}=${W};`,K={},G=(V,F)=>{f.broadcastedIndicesToOffset=!0;let W=`${F.name}broadcastedIndicesTo${e}Offset`;if(W in K)return`${W}(${V})`;let re=[];for(let fe=i-1;fe>=0;fe--){let se=F.indicesGet("outputIndices",fe+F.rank-i);re.push(`${A(w,fe)} * (${se} % ${A($,fe)})`)}return K[W]=`fn ${W}(outputIndices: ${F.type.indices}) -> u32 { + return ${re.length>0?re.join("+"):"0u"}; + }`,`${W}(${V})`},j=(V,F)=>(()=>{if(c.storage===c.value)return`${e}[${V}]=${F};`;if(c.storage==="vec2"&&c.value==="i32")return`${e}[${V}]=vec2(u32(${F}), select(0u, 0xFFFFFFFFu, ${F} < 0));`;if(c.storage==="vec2"&&c.value==="u32")return`${e}[${V}]=vec2(u32(${F}), 0u);`;if(c.storage==="u32"&&c.value==="vec4")return`${e}[${V}]=dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(${F}));`;throw new Error(`not supported combination of storage type ${c.storage} and value type ${c.value} yet`)})(),ee=V=>(()=>{if(c.storage===c.value)return`${e}[${V}]`;if(c.storage==="vec2"&&c.value==="i32")return`i32(${e}[${V}].x)`;if(c.storage==="vec2"&&c.value==="u32")return`u32(${e}[${V}].x)`;if(c.storage==="u32"&&c.value==="vec4")return`vec4(bool(${e}[${V}] & 0xFFu), bool(${e}[${V}] & 0xFF00u), bool(${e}[${V}] & 0xFF0000u), bool(${e}[${V}] & 0xFF000000u))`;throw new Error(`not supported combination of storage type ${c.storage} and value type ${c.value} yet`)})(),H=i<2?"":` + fn get_${e}ByIndices(indices: ${c.indices}) -> ${p} { + return ${ee(`i2o_${e}(indices)`)}; + }`,Z=i<2?"":(()=>{let V=a.map(W=>`d${W}: u32`).join(", "),F=a.map(W=>`d${W}`).join(", ");return` + fn get_${e}(${V}) -> ${p} { + return get_${e}ByIndices(${S(F)}); + }`})(),X=(...V)=>{if(V.length!==i)throw new Error(`indices length must be ${i}`);let F=V.map(_).join(",");return i===0?ee("0u"):i===1?ee(F[0]):(f.get=!0,f.getByIndices=!0,f.indicesToOffset=!0,`get_${e}(${F})`)},oe=V=>i<2?ee(V):(f.getByIndices=!0,f.indicesToOffset=!0,`get_${e}ByIndices(${V})`),me=i<2?"":` + fn set_${e}ByIndices(indices: ${c.indices}, value: ${p}) { + ${j(`i2o_${e}(indices)`,"value")} + }`,ae=i<2?"":(()=>{let V=a.map(W=>`d${W}: u32`).join(", "),F=a.map(W=>`d${W}`).join(", ");return` + fn set_${e}(${V}, value: ${p}) { + set_${e}ByIndices(${S(F)}, value); + }`})();return{impl:()=>{let V=[],F=!1;return f.offsetToIndices&&(V.push(C),F=!0),f.indicesToOffset&&(V.push(b),F=!0),f.broadcastedIndicesToOffset&&(Object.values(K).forEach(W=>V.push(W)),F=!0),f.set&&(V.push(ae),F=!0),f.setByIndices&&(V.push(me),F=!0),f.get&&(V.push(Z),F=!0),f.getByIndices&&(V.push(H),F=!0),!n&&F&&V.unshift(`const ${$} = ${c.indices}(${t.join(",")});`,`const ${w} = ${c.indices}(${be.computeStrides(t).join(",")});`),V.join(` +`)},type:c,offsetToIndices:E,indicesToOffset:x,broadcastedIndicesToOffset:G,indices:S,indicesGet:A,indicesSet:B,set:(...V)=>{if(V.length!==i+1)throw new Error(`indices length must be ${i}`);let F=V[i];if(typeof F!="string")throw new Error("value must be string");let W=V.slice(0,i).map(_).join(",");return i===0?j("0u",F):i===1?j(W[0],F):(f.set=!0,f.setByIndices=!0,f.indicesToOffset=!0,`set_${e}(${W}, ${F})`)},setByOffset:j,setByIndices:(V,F)=>i<2?j(V,F):(f.setByIndices=!0,f.indicesToOffset=!0,`set_${e}ByIndices(${V}, ${F});`),get:X,getByOffset:ee,getByIndices:oe,usage:s,name:e,strides:w,shape:$,rank:i}},Pe=(e,r,t,s=1)=>Ro(e,r,t,"input",s),Ze=(e,r,t,s=1)=>Ro(e,r,t,"output",s),Ub=(e,r,t)=>Ro(e,r,t,"atomicOutput",1),ld=(e,r,t,s=1)=>Ro(e,r,t,"internal",s),Jf=class{constructor(e,r){this.normalizedDispatchGroup=e,this.limits=r,this.internalVariables=[],this.variables=[],this.uniforms=[],this.variableIndex=0}guardAgainstOutOfBoundsWorkgroupSizes(e){return`if (global_idx >= ${typeof e=="number"?`${e}u`:e}) { return; }`}mainStart(e=io){let r=typeof e=="number"?e:e[0],t=typeof e=="number"?1:e[1],s=typeof e=="number"?1:e[2];if(r>this.limits.maxComputeWorkgroupSizeX||t>this.limits.maxComputeWorkgroupSizeY||s>this.limits.maxComputeWorkgroupSizeZ)throw new Error(`workgroup size [${r}, ${t}, ${s}] exceeds the maximum workgroup size [${this.limits.maxComputeWorkgroupSizeX}, ${this.limits.maxComputeWorkgroupSizeY}, ${this.limits.maxComputeWorkgroupSizeZ}].`);if(r*t*s>this.limits.maxComputeInvocationsPerWorkgroup)throw new Error(`workgroup size [${r}, ${t}, ${s}] exceeds the maximum workgroup invocations ${this.limits.maxComputeInvocationsPerWorkgroup}.`);let o=this.normalizedDispatchGroup[1]===1&&this.normalizedDispatchGroup[2]===1,n=o?`@builtin(global_invocation_id) global_id : vec3, + @builtin(workgroup_id) workgroup_id : vec3, + @builtin(local_invocation_index) local_idx : u32, + @builtin(local_invocation_id) local_id : vec3`:`@builtin(global_invocation_id) global_id : vec3, + @builtin(local_invocation_id) local_id : vec3, + @builtin(local_invocation_index) local_idx : u32, + @builtin(workgroup_id) workgroup_id : vec3, + @builtin(num_workgroups) num_workgroups : vec3`,i=o?`let global_idx = global_id.x; + let workgroup_index = workgroup_id.x;`:`let workgroup_index = workgroup_id.z * num_workgroups[0] * num_workgroups[1] + + workgroup_id.y * num_workgroups[0] + workgroup_id.x; + let global_idx = workgroup_index * ${r*t*s}u + local_idx;`;return`@compute @workgroup_size(${r}, ${t}, ${s}) + fn main(${n}) { + ${i} + `}appendVariableUniforms(e){e.rank!==0&&(e.shape.startsWith("uniforms.")&&this.uniforms.push({name:e.shape.replace("uniforms.",""),type:"u32",length:e.rank}),e.strides.startsWith("uniforms.")&&this.uniforms.push({name:e.strides.replace("uniforms.",""),type:"u32",length:e.rank}))}declareVariable(e,r){if(e.usage==="internal")throw new Error("cannot use internal variable with declareVariable(). use registerInternalVariables() instead.");this.variables.push(e),this.appendVariableUniforms(e);let t=e.usage==="input"?"read":"read_write",s=e.usage==="atomicOutput"?"atomic":e.type.storage;return`@group(0) @binding(${r}) var ${e.name}: array<${s}>;`}declareVariables(...e){return e.map(r=>this.declareVariable(r,this.variableIndex++)).join(` +`)}registerInternalVariable(e){if(e.usage!=="internal")throw new Error("cannot use input or output variable with registerInternalVariable(). use declareVariables() instead.");this.internalVariables.push(e),this.appendVariableUniforms(e)}registerInternalVariables(...e){return e.forEach(r=>this.registerInternalVariable(r)),this}registerUniform(e,r,t=1){return this.uniforms.push({name:e,type:r,length:t}),this}registerUniforms(e){return this.uniforms=this.uniforms.concat(e),this}uniformDeclaration(){if(this.uniforms.length===0)return"";let e=[];for(let{name:r,type:t,length:s}of this.uniforms)if(s&&s>4)t==="f16"?e.push(`@align(16) ${r}:array, ${Math.ceil(s/8)}>`):e.push(`${r}:array, ${Math.ceil(s/4)}>`);else{let o=s==null||s===1?t:`vec${s}<${t}>`;e.push(`${r}:${o}`)}return` + struct Uniforms { ${e.join(", ")} }; + @group(0) @binding(${this.variableIndex}) var uniforms: Uniforms;`}get additionalImplementations(){return this.uniformDeclaration()+this.variables.map(e=>e.impl()).join(` +`)+this.internalVariables.map(e=>e.impl()).join(` +`)}get variablesInfo(){if(this.uniforms.length===0)return;let e=r=>[12,10,1,6][["u32","f16","f32","i32"].indexOf(r)];return this.uniforms.map(r=>[e(r.type),r.length??1])}},Wb=(e,r)=>new Jf(e,r)}),Yf,Jl,Zf,e_,t_,r_,Vr,Gb,Kb,Js=Re(()=>{ut(),ft(),Jt(),_t(),Yf=(e,r)=>{if(!e||e.length!==1)throw new Error("Transpose requires 1 input.");if(r.length!==0&&r.length!==e[0].dims.length)throw new Error(`perm size ${r.length} does not match input rank ${e[0].dims.length}`)},Jl=(e,r)=>r.length!==0?r:[...new Array(e).keys()].reverse(),Zf=(e,r)=>be.sortBasedOnPerm(e,Jl(e.length,r)),e_=(e,r,t,s)=>{let o=`fn perm(i: ${s.type.indices}) -> ${t.type.indices} { + var a: ${t.type.indices};`;for(let n=0;n{let t=[],s=[];for(let o=0;o{let t=0;for(let s=0;s{let t=e.dataType,s=e.dims.length,o=Jl(s,r),n=Zf(e.dims,o),i=e.dims,a=n,l=s<2||r_(o,e.dims),u;if(l)return u=f=>{let v=Pe("input",t,i,4),$=Ze("output",t,a,4);return` + ${f.registerUniform("output_size","u32").declareVariables(v,$)} + ${f.mainStart()} + ${f.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + output[global_idx] = input[global_idx]; + }`},{name:"TransposeCopy",shaderCache:{inputDependencies:["type"]},getRunData:()=>{let f=be.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(f/64/4)},programUniforms:[{type:12,data:Math.ceil(f/4)}]}},getShaderSource:u};let{newShape:p,newPerm:d}=t_(e.dims,o),c=be.areEqual(d,[2,3,1]),_=be.areEqual(d,[3,1,2]);if(p.length===2||c||_){i=c?[p[0],p[1]*p[2]]:_?[p[0]*p[1],p[2]]:p,a=[i[1],i[0]];let f=16;return u=v=>{let $=Pe("a",t,i.length),w=Ze("output",t,a.length);return` + ${v.registerUniform("output_size","u32").declareVariables($,w)} + var tile : array, ${f}>; + ${v.mainStart([f,f,1])} + let stride = (uniforms.output_shape[1] - 1) / ${f} + 1; + let workgroup_id_x = workgroup_index % stride; + let workgroup_id_y = workgroup_index / stride; + let input_col = workgroup_id_y * ${f}u + local_id.x; + let input_row = workgroup_id_x * ${f}u + local_id.y; + if (input_row < uniforms.a_shape[0] && input_col < uniforms.a_shape[1]) { + tile[local_id.y][local_id.x] = ${$.getByIndices(`${$.type.indices}(input_row, input_col)`)}; + } + workgroupBarrier(); + + let output_col = workgroup_id_x * ${f}u + local_id.x; + let output_row = workgroup_id_y * ${f}u + local_id.y; + if (output_row < uniforms.output_shape[0] && output_col < uniforms.output_shape[1]) { + ${w.setByIndices(`${w.type.indices}(output_row, output_col)`,"tile[local_id.x][local_id.y]")} + } + }`},{name:"TransposeShared",shaderCache:{inputDependencies:["type"]},getRunData:()=>{let v=be.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(a[1]/f),y:Math.ceil(a[0]/f)},programUniforms:[{type:12,data:v},...st(i,a)]}},getShaderSource:u}}return u=f=>{let v=Pe("a",t,i.length),$=Ze("output",t,a.length);return` + ${f.registerUniform("output_size","u32").declareVariables(v,$)} + + ${e_(o,s,v,$)} + + ${f.mainStart()} + ${f.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let indices = ${$.offsetToIndices("global_idx")}; + let aIndices = perm(indices); + + ${$.setByOffset("global_idx",v.getByIndices("aIndices"))} + }`},{name:"Transpose",shaderCache:{hint:`${r}`,inputDependencies:["rank"]},getRunData:()=>{let f=be.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(f/64)},programUniforms:[{type:12,data:f},...st(i,a)]}},getShaderSource:u}},Gb=(e,r)=>{Yf(e.inputs,r.perm),e.compute(Vr(e.inputs[0],r.perm))},Kb=e=>$t({perm:e.perm})}),s_,n_,o_,i_,a_,l_,u_,d_,c_,p_,as,Hb,qb,Xb,Qb,Jb,Yb,Zb,eM,tM,rM,ax=Re(()=>{ut(),ft(),_t(),ud(),Js(),s_={max:"select(bestValue, candidate, candidate > bestValue)",min:"select(bestValue, candidate, candidate < bestValue)",mean:"bestValue + candidate",sum:"bestValue + candidate",prod:"bestValue * candidate",sumSquare:"bestValue + candidate * candidate",logSumExp:"bestValue + exp(candidate)",l1:"bestValue + abs(candidate)",l2:"bestValue + candidate * candidate",logSum:"bestValue + candidate"},n_={max:"select(bestValue, candidate, candidate > bestValue)",min:"select(bestValue, candidate, candidate < bestValue)",mean:"bestValue + candidate",sum:"bestValue + candidate",prod:"bestValue * candidate",sumSquare:"bestValue + candidate",logSumExp:"bestValue + candidate",l1:"bestValue + candidate",l2:"bestValue + candidate",logSum:"bestValue + candidate"},o_={max:"_A[offset]",min:"_A[offset]",mean:"0",sum:"0",prod:"1",sumSquare:"0",logSumExp:"0",l1:"0",l2:"0",logSum:"0"},i_={max:"bestValue",min:"bestValue",sum:"bestValue",prod:"bestValue",sumSquare:"bestValue",logSumExp:"log(bestValue)",l1:"bestValue",l2:"sqrt(bestValue)",logSum:"log(bestValue)"},a_=(e,r)=>{let t=[];for(let s=r-e;s{let t=[],s=e.length;for(let n=0;ne[n]);return[t,o]},u_=(e,r)=>{let t=e.length+r.length,s=[],o=0;for(let n=0;n{for(let t=0;t{let t=[];if(!d_(e,r)){for(let s=0;st.push(s))}return t},p_=(e,r,t,s,o,n,i)=>{let a=t[0].dims,l=be.size(n),u=be.size(i),p=Pe("_A",t[0].dataType,a),d=Ze("output",o,n),c=64;l===1&&(c=256);let _=` + var aBestValues : array; + `,f=v=>` + ${v.registerUniform("reduceSize","u32").declareVariables(p,d)} + ${_} + fn DIV_CEIL(a : u32, b : u32) -> u32 { + return ((a - 1u) / b + 1u); + } + ${v.mainStart(c)} + + let outputIndex = global_idx / ${c}; + let offset = outputIndex * uniforms.reduceSize; + + var bestValue = f32(${o_[s]}); + let Length = uniforms.reduceSize; + for (var k = local_idx; k < Length; k = k + ${c}) { + let candidate = f32(${p.getByOffset("offset + k")}); + bestValue = ${s_[s]}; + } + aBestValues[local_idx] = bestValue; + workgroupBarrier(); + + var reduceSize = min(Length, ${c}u); + for (var currentSize = reduceSize / 2u; reduceSize > 1u; + currentSize = reduceSize / 2u) { + let interval = DIV_CEIL(reduceSize, 2u); + if (local_idx < currentSize) { + let candidate = aBestValues[local_idx + interval]; + bestValue = ${n_[s]}; + aBestValues[local_idx] = bestValue; + } + reduceSize = interval; + workgroupBarrier(); + } + + if (local_idx == 0u) { + ${d.setByOffset("outputIndex",`${s==="mean"?`${d.type.storage}(bestValue / f32(uniforms.reduceSize))`:`${d.type.storage}(${i_[s]})`}`)}; + } + }`;return{name:e,shaderCache:{hint:`${r};${c}`,inputDependencies:["type"]},getShaderSource:f,getRunData:()=>({outputs:[{dims:n,dataType:o}],dispatchGroup:{x:l},programUniforms:[{type:12,data:u}]})}},as=(e,r,t,s)=>{let o=e.inputs.length===1?t:zu(e.inputs,t),n=o.axes;n.length===0&&!o.noopWithEmptyAxes&&(n=e.inputs[0].dims.map((_,f)=>f));let i=be.normalizeAxes(n,e.inputs[0].dims.length),a=i,l=e.inputs[0],u=c_(a,e.inputs[0].dims.length);u.length>0&&(l=e.compute(Vr(e.inputs[0],u),{inputs:[0],outputs:[-1]})[0],a=a_(a.length,l.dims.length));let[p,d]=l_(l.dims,a),c=p;o.keepDims&&(c=u_(p,i)),e.compute(p_(r,o.cacheKey,[l],s,e.inputs[0].dataType,c,d),{inputs:[l]})},Hb=(e,r)=>{as(e,"ReduceMeanShared",r,"mean")},qb=(e,r)=>{as(e,"ReduceL1Shared",r,"l1")},Xb=(e,r)=>{as(e,"ReduceL2Shared",r,"l2")},Qb=(e,r)=>{as(e,"ReduceLogSumExpShared",r,"logSumExp")},Jb=(e,r)=>{as(e,"ReduceMaxShared",r,"max")},Yb=(e,r)=>{as(e,"ReduceMinShared",r,"min")},Zb=(e,r)=>{as(e,"ReduceProdShared",r,"prod")},eM=(e,r)=>{as(e,"ReduceSumShared",r,"sum")},tM=(e,r)=>{as(e,"ReduceSumSquareShared",r,"sumSquare")},rM=(e,r)=>{as(e,"ReduceLogSumShared",r,"logSum")}}),ls,h_,fa,zu,us,m_,f_,__,g_,w_,b_,M_,y_,v_,x_,ds,sM,nM,oM,iM,aM,lM,uM,dM,cM,pM,ud=Re(()=>{ut(),ft(),Jt(),_t(),ax(),ls=e=>{if(!e||e.length===0||e.length>2)throw new Error("Reduce op requires 1 or 2 inputs.");if(e.length===2&&e[1].dims.length!==1)throw new Error("Invalid axes input dims.")},h_=e=>["","",`var value = ${e.getByIndices("input_indices")};`,""],fa=(e,r,t,s,o,n,i=!1,a=!1)=>{let l=[],u=t[0].dims,p=u.length,d=be.normalizeAxes(o,p),c=!a&&d.length===0;u.forEach((v,$)=>{c||d.indexOf($)>=0?i&&l.push(1):l.push(v)});let _=l.length,f=be.size(l);return{name:e,shaderCache:r,getShaderSource:v=>{let $=[],w=Pe("_A",t[0].dataType,p),g=Ze("output",n,_),C=s(w,g,d),E=C[2];for(let y=0,b=0;y=0?(i&&b++,E=`for(var j${y}: u32 = 0; j${y} < ${u[y]}; j${y}++) { + ${C[2].includes("last_index")?`let last_index = j${y};`:""} + ${w.indicesSet("input_indices",y,`j${y}`)} + ${E} + }`):($.push(`${w.indicesSet("input_indices",y,g.indicesGet("output_indices",b))};`),b++);return` + + ${v.registerUniform("output_size","u32").declareVariables(w,g)} + + ${v.mainStart()} + ${v.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + var input_indices: ${w.type.indices}; + let output_indices = ${g.offsetToIndices("global_idx")}; + + ${$.join(` +`)} + ${C[0]} // init ops for reduce max/min + ${C[1]} + ${E} + ${C[3]} + ${C.length===4?g.setByOffset("global_idx","value"):C.slice(4).join(` +`)} + }`},getRunData:()=>({outputs:[{dims:l,dataType:n}],dispatchGroup:{x:Math.ceil(f/64)},programUniforms:[{type:12,data:f},...st(u,l)]})}},zu=(e,r)=>{let t=[];return e[1].dims[0]>0&&e[1].getBigInt64Array().forEach(s=>t.push(Number(s))),$t({axes:t,keepDims:r.keepDims,noopWithEmptyAxes:r.noopWithEmptyAxes})},us=(e,r,t,s)=>{let o=e.inputs,n=o.length===1?t:zu(o,t);e.compute(fa(r,{hint:n.cacheKey,inputDependencies:["rank"]},[o[0]],n.noopWithEmptyAxes&&n.axes.length===0?h_:s,n.axes,o[0].dataType,n.keepDims,n.noopWithEmptyAxes),{inputs:[0]})},m_=(e,r)=>{ls(e.inputs),us(e,"ReduceLogSum",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += ${t.getByIndices("input_indices")};`,"value = log(value);"])},f_=(e,r)=>{ls(e.inputs),us(e,"ReduceL1",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += abs(${t.getByIndices("input_indices")});`,""])},__=(e,r)=>{ls(e.inputs),us(e,"ReduceL2",r,(t,s)=>[`var t = ${s.type.value}(0); var value = ${s.type.value}(0);`,"",`t = ${t.getByIndices("input_indices")}; value += (t * t);`,"value = sqrt(value);"])},g_=(e,r)=>{ls(e.inputs),us(e,"ReduceLogSumExp",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += exp(${t.getByIndices("input_indices")});`,"value = log(value);"])},w_=(e,r)=>{ls(e.inputs),us(e,"ReduceMax",r,(t,s,o)=>{let n=[];for(let i=0;i=0||o.length===0)&&n.push(t.indicesSet("input_indices",i,0));return[`${n.join(` +`)}`,`var value = ${t.getByIndices("input_indices")};`,`value = max(value, ${t.getByIndices("input_indices")});`,""]})},b_=(e,r)=>{ls(e.inputs),us(e,"ReduceMean",r,(t,s,o)=>{let n=1;for(let i=0;i=0||o.length===0)&&(n*=e.inputs[0].dims[i]);return["var sum = f32(0);","",`sum += f32(${t.getByIndices("input_indices")});`,`let value = ${s.type.value}(sum / ${n});`]})},M_=(e,r)=>{ls(e.inputs),us(e,"ReduceMin",r,(t,s,o)=>{let n=[];for(let i=0;i=0||o.length===0)&&n.push(`input_indices[${i}] = 0;`);return[`${n.join(` +`)}`,`var value = ${t.getByIndices("input_indices")};`,`value = min(value, ${t.getByIndices("input_indices")});`,""]})},y_=(e,r)=>{ls(e.inputs),us(e,"ReduceProd",r,(t,s)=>[`var value = ${s.type.storage}(1);`,"",`value *= ${t.getByIndices("input_indices")};`,""])},v_=(e,r)=>{ls(e.inputs),us(e,"ReduceSum",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += ${t.getByIndices("input_indices")};`,""])},x_=(e,r)=>{ls(e.inputs),us(e,"ReduceSumSquare",r,(t,s)=>[`var t = ${s.type.value}(0); var value = ${s.type.value}(0);`,"",`t = ${t.getByIndices("input_indices")}; value += t * t;`,""])},ds=(e,r,t)=>{if(r.length===0)return t;let s=1,o=1;for(let n=0;n1024},sM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?b_(e,r):Hb(e,r)},nM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?f_(e,r):qb(e,r)},oM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?__(e,r):Xb(e,r)},iM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?g_(e,r):Qb(e,r)},aM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?w_(e,r):Jb(e,r)},lM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?M_(e,r):Yb(e,r)},uM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?y_(e,r):Zb(e,r)},dM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?v_(e,r):eM(e,r)},cM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?x_(e,r):tM(e,r)},pM=(e,r)=>{ds(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?m_(e,r):rM(e,r)}}),Yl,hM,mM,Bu,lx=Re(()=>{ut(),Jt(),ud(),Yl=e=>{if(!e||e.length===0||e.length>2)throw new Error("ArgMinMaxOp op requires 1 or 2 inputs.");if(e[0].dataType!==1)throw new Error("Invalid input type.")},hM=(e,r)=>{Yl(e.inputs);let t=(s,o,n)=>{let i=[];for(let a=0;a=0||n.length===0)&&i.push(`input_indices[${a}] = 0;`);return[`${i.join(` +`)}`,`var value = ${s.getByIndices("input_indices")}; +var best_index : i32 = 0;`,`if (${s.getByIndices("input_indices")} ${r.selectLastIndex>0?"<=":"<"} value) { + value = ${s.getByIndices("input_indices")}; + best_index = i32(last_index); + }`,"",o.setByOffset("global_idx","best_index")]};e.compute(fa("ArgMin",{hint:r.cacheKey,inputDependencies:["rank"]},[e.inputs[0]],t,[r.axis],7,r.keepDims),{inputs:[0]})},mM=(e,r)=>{Yl(e.inputs);let t=(s,o,n)=>{let i=[];for(let a=0;a=0||n.length===0)&&i.push(`input_indices[${a}] = 0;`);return[`${i.join(` +`)}`,`var value = ${s.getByIndices("input_indices")}; +var best_index : i32 = 0;`,`if (${s.getByIndices("input_indices")} ${r.selectLastIndex>0?">=":">"} value) { + value = ${s.getByIndices("input_indices")}; + best_index = i32(last_index); + }`,"",o.setByOffset("global_idx","best_index")]};e.compute(fa("argMax",{hint:r.cacheKey,inputDependencies:["rank"]},[e.inputs[0]],t,[r.axis],7,r.keepDims),{inputs:[0]})},Bu=e=>$t(e)}),T_,ta,E_,P_,C_,Zo,S_,fM,dd=Re(()=>{ut(),ft(),ad(),_t(),T_=(e,r)=>{let t=e[0],s=e[1],o=e[2],n=e[3],i=e[4],a=e[5];if(i&&a)throw new Error("Attention cannot have both past and attention_bias");if(t.dims.length!==3)throw new Error('Input "input" must have 3 dimensions');let l=t.dims[0],u=t.dims[1],p=t.dims[2];if(o.dims.length!==1)throw new Error('Input "bias" is expected to have 1 dimensions');if(s.dims.length!==2)throw new Error('Input "weights" is expected to have 2 dimensions');if(s.dims[0]!==p)throw new Error("Input 1 dimension 0 should have same length as dimension 2 of input 0");if(o.dims[0]!==s.dims[1])throw new Error('Input "bias" dimension 0 should have same length as dimension 1 of input "weights"');let d=o.dims[0]/3,c=d,_=c;if(r.qkvHiddenSizes.length>0){if(r.qkvHiddenSizes.length!==3)throw new Error("qkv_hidden_sizes attribute should have 3 elements");for(let C of r.qkvHiddenSizes)if(C%r.numHeads!==0)throw new Error("qkv_hidden_sizes should be divisible by num_heads");d=r.qkvHiddenSizes[0],c=r.qkvHiddenSizes[1],_=r.qkvHiddenSizes[2]}let f=u;if(d!==c)throw new Error("qkv_hidden_sizes first element should be same as the second");if(o.dims[0]!==d+c+_)throw new Error('Input "bias" dimension 0 should have same length as sum of Q/K/V hidden sizes');let v=0;if(i){if(c!==_)throw new Error('Input "past" expect k_hidden_size == v_hidden_size');if(i.dims.length!==5)throw new Error('Input "past" must have 5 dimensions');if(i.dims[0]!==2)throw new Error('Input "past" first dimension must be 2');if(i.dims[1]!==l)throw new Error('Input "past" second dimension must be batch_size');if(i.dims[2]!==r.numHeads)throw new Error('Input "past" third dimension must be num_heads');if(i.dims[4]!==c/r.numHeads)throw new Error('Input "past" fifth dimension must be k_hidden_size / num_heads');r.pastPresentShareBuffer||(v=i.dims[3])}let $=f+v,w=-1,g=0;if(n)throw new Error("Mask not supported");if(i)throw new Error("past is not supported");if(a){if(a.dims.length!==4)throw new Error('Input "attention_bias" must have 4 dimensions');if(a.dims[0]!==l||a.dims[1]!==r.numHeads||a.dims[2]!==u||a.dims[3]!==$)throw new Error('Expect "attention_bias" shape (batch_size, num_heads, sequence_length, total_sequence_length)')}return{batchSize:l,sequenceLength:u,pastSequenceLength:v,kvSequenceLength:f,totalSequenceLength:$,maxSequenceLength:w,inputHiddenSize:p,hiddenSize:d,vHiddenSize:_,headSize:Math.floor(d/r.numHeads),vHeadSize:Math.floor(_/r.numHeads),numHeads:r.numHeads,isUnidirectional:!1,pastPresentShareBuffer:!1,maskFilterValue:r.maskFilterValue,maskType:g,scale:r.scale,broadcastResPosBias:!1,passPastInKv:!1,qkvFormat:1}},ta=(e,r,t)=>r&&e?` + let total_sequence_length_input = u32(${r.getByOffset("0")}); + let present_sequence_length = max(total_sequence_length_input, uniforms.past_sequence_length); + let is_subsequent_prompt: bool = sequence_length > 1 && sequence_length != total_sequence_length_input; + let is_first_prompt: bool = is_subsequent_prompt == false && sequence_length == total_sequence_length_input; + total_sequence_length = u32(${e==null?void 0:e.getByOffset("batchIdx")}) + 1; + var past_sequence_length: u32 = 0; + if (is_first_prompt == false) { + past_sequence_length = total_sequence_length - sequence_length; + } + `:` + ${t?"let past_sequence_length = uniforms.past_sequence_length":""}; + let present_sequence_length = total_sequence_length; + `,E_=(e,r,t,s,o,n,i,a)=>{let l=qt(i?1:n),u=64,p=n/l;p{let g=Ze("x",e.dataType,e.dims,l),C=[g],E=i?Pe("seq_lens",i.dataType,i.dims):void 0;E&&C.push(E);let y=a?Pe("total_sequence_length_input",a.dataType,a.dims):void 0;y&&C.push(y);let b=Er(e.dataType),x=[{name:"batch_size",type:"u32"},{name:"num_heads",type:"u32"},{name:"past_sequence_length",type:"u32"},{name:"sequence_length",type:"u32"},{name:"total_sequence_length",type:"u32"},{name:"elements_per_thread",type:"u32"}];return` + var thread_max: array; + var thread_sum: array; + ${w.registerUniforms(x).declareVariables(...C)} + ${w.mainStart([u,1,1])} + let batchIdx = workgroup_id.z / uniforms.num_heads; + let headIdx = workgroup_id.z % uniforms.num_heads; + let sequence_length = uniforms.sequence_length; + var total_sequence_length = uniforms.total_sequence_length; + ${ta(E,y,!1)} + let local_offset = local_idx * uniforms.elements_per_thread; + let offset = (global_idx / ${u}) * uniforms.total_sequence_length + local_offset; + let seq_causal_length = ${i?"u32(past_sequence_length + workgroup_id.y + 1)":"total_sequence_length"}; + var thread_max_vector = ${f}(-3.402823e+38f); + for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { + thread_max_vector = max(${f}(x[offset + i]), thread_max_vector); + } + thread_max[local_idx] = ${(()=>{switch(l){case 1:return"thread_max_vector";case 2:return"max(thread_max_vector.x, thread_max_vector.y)";case 4:return"max(max(thread_max_vector.x, thread_max_vector.y), max(thread_max_vector.z, thread_max_vector.w))";default:throw new Error(`Unsupported components: ${l}`)}})()}; + workgroupBarrier(); + + var max_value = f32(-3.402823e+38f); + for (var i = 0u; i < ${u}; i++) { + max_value = max(thread_max[i], max_value); + } + + var sum_vector = ${f}(0); + for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { + sum_vector += exp(${f}(x[offset + i]) - max_value); + } + thread_sum[local_idx] = ${(()=>{switch(l){case 1:return"sum_vector";case 2:return"sum_vector.x + sum_vector.y";case 4:return"sum_vector.x + sum_vector.y + sum_vector.z + sum_vector.w";default:throw new Error(`Unsupported components: ${l}`)}})()}; + workgroupBarrier(); + + var sum: f32 = 0; + for (var i = 0u; i < ${u}; i++) { + sum += thread_sum[i]; + } + + if (sum == 0) { + for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { + x[offset + i] = ${g.type.value}(${b}(1.0) / ${b}(seq_causal_length)); + } + } else { + for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { + var f32input = ${f}(x[offset + i]); + x[offset + i] = ${g.type.value}(exp(f32input - max_value) / sum); + } + } + ${i?` + for (var total_seq_id: u32 = seq_causal_length; total_seq_id + local_offset < uniforms.total_sequence_length; total_seq_id++) { + x[offset + total_seq_id] = ${g.type.value}(${b}(0)); + }`:""}; + }`};return{name:"AttentionProbsSoftmax",shaderCache:{hint:`${u};${_};${l}`,inputDependencies:v},getShaderSource:$,getRunData:()=>({outputs:[],dispatchGroup:{x:1,y:o,z:r*t},programUniforms:c})}},P_=(e,r,t,s,o,n,i,a,l)=>{let u=i+n.kvSequenceLength,p=[n.batchSize,n.numHeads,n.sequenceLength,u],d=e>1&&s,c=n.kvNumHeads?n.kvNumHeads:n.numHeads,_=d?[n.batchSize,c,u,n.headSize]:void 0,f=n.nReps?n.nReps:1,v=n.scale===0?1/Math.sqrt(n.headSize):n.scale,$=qt(n.headSize),w=n.headSize/$,g=12,C={x:Math.ceil(u/g),y:Math.ceil(n.sequenceLength/g),z:n.batchSize*n.numHeads},E=[{type:12,data:n.sequenceLength},{type:12,data:w},{type:12,data:u},{type:12,data:n.numHeads},{type:12,data:n.headSize},{type:1,data:v},{type:12,data:i},{type:12,data:n.kvSequenceLength},{type:12,data:f}],y=d&&s&&be.size(s.dims)>0,b=["type","type"];y&&b.push("type"),o&&b.push("type"),a&&b.push("type"),l&&b.push("type");let x=[{dims:p,dataType:r.dataType,gpuDataType:0}];d&&x.push({dims:_,dataType:r.dataType,gpuDataType:0});let S=A=>{let B=Pe("q",r.dataType,r.dims,$),K=Pe("key",t.dataType,t.dims,$),G=[B,K];if(y){let me=Pe("past_key",s.dataType,s.dims,$);G.push(me)}o&&G.push(Pe("attention_bias",o.dataType,o.dims));let j=a?Pe("seq_lens",a.dataType,a.dims):void 0;j&&G.push(j);let ee=l?Pe("total_sequence_length_input",l.dataType,l.dims):void 0;ee&&G.push(ee);let H=Ze("output",r.dataType,p),Z=[H];d&&Z.push(Ze("present_key",r.dataType,_,$));let X=Er(1,$),oe=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"alpha",type:"f32"},{name:"past_sequence_length",type:"u32"},{name:"kv_sequence_length",type:"u32"},{name:"n_reps",type:"u32"}];return` + const TILE_SIZE = ${g}u; + + var tileQ: array<${B.type.storage}, ${g*g}>; + var tileK: array<${B.type.storage}, ${g*g}>; + ${A.registerUniforms(oe).declareVariables(...G,...Z)} + ${A.mainStart([g,g,1])} + // x holds the N and y holds the M + let headIdx = workgroup_id.z % uniforms.num_heads; + let kvHeadIdx = ${f===1?"headIdx":"headIdx / uniforms.n_reps"}; + let kv_num_heads = ${f===1?"uniforms.num_heads":"uniforms.num_heads / uniforms.n_reps"}; + let batchIdx = workgroup_id.z / uniforms.num_heads; + let m = workgroup_id.y * TILE_SIZE; + let n = workgroup_id.x * TILE_SIZE; + let sequence_length = uniforms.M; + var total_sequence_length = uniforms.N; + ${ta(j,ee,!0)} + let absKvHeadIdx = batchIdx * kv_num_heads + kvHeadIdx; + let qOffset = workgroup_id.z * uniforms.M * uniforms.K + m * uniforms.K; + ${y&&d?"let pastKeyOffset = absKvHeadIdx * uniforms.past_sequence_length * uniforms.K;":""}; + let kOffset = absKvHeadIdx * uniforms.kv_sequence_length * uniforms.K; + ${d?"let presentKeyOffset = absKvHeadIdx * uniforms.N * uniforms.K;":""} + var value = ${X}(0); + for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { + if (global_id.y < uniforms.M && w + local_id.x < uniforms.K) { + tileQ[TILE_SIZE * local_id.y + local_id.x] = q[qOffset + local_id.y * uniforms.K + w + local_id.x]; + } + if (n + local_id.y < uniforms.N && w + local_id.x < uniforms.K) { + var idx = TILE_SIZE * local_id.y + local_id.x; + ${y&&d?` + if (n + local_id.y < past_sequence_length) { + tileK[idx] = past_key[pastKeyOffset + (n + local_id.y) * uniforms.K + w + local_id.x]; + } else if (n + local_id.y - past_sequence_length < uniforms.kv_sequence_length) { + tileK[idx] = key[kOffset + (n + local_id.y - past_sequence_length) * uniforms.K + w + local_id.x]; + }`:` + if (n + local_id.y < uniforms.kv_sequence_length) { + tileK[idx] = key[kOffset + (n + local_id.y) * uniforms.K + w + local_id.x]; + }`} + ${d?`if (n + local_id.y < present_sequence_length) { + present_key[presentKeyOffset + (n + local_id.y) * uniforms.K + w + local_id.x] = tileK[idx]; + }`:""} + } + workgroupBarrier(); + + for (var k: u32 = 0u; k < TILE_SIZE && w+k < uniforms.K; k++) { + value += ${X}(tileQ[TILE_SIZE * local_id.y + k] * tileK[TILE_SIZE * local_id.x + k]); + } + + workgroupBarrier(); + } + + if (global_id.y < uniforms.M && global_id.x < total_sequence_length) { + let headOffset = workgroup_id.z * uniforms.M * uniforms.N; + let outputIdx = headOffset + global_id.y * uniforms.N + global_id.x; + var sum: f32 = ${(()=>{switch($){case 1:return"value";case 2:return"value.x + value.y";case 4:return"value.x + value.y + value.z + value.w";default:throw new Error(`Unsupported components: ${$}`)}})()}; + output[outputIdx] = ${H.type.value} (sum * uniforms.alpha) + ${o?"attention_bias[outputIdx]":"0.0"}; + } + }`};return{name:"AttentionProbs",shaderCache:{hint:`${$};${o!==void 0};${s!==void 0};${e}`,inputDependencies:b},getRunData:()=>({outputs:x,dispatchGroup:C,programUniforms:E}),getShaderSource:S}},C_=(e,r,t,s,o,n,i=void 0,a=void 0)=>{let l=n+o.kvSequenceLength,u=o.nReps?o.nReps:1,p=o.vHiddenSize*u,d=e>1&&s,c=o.kvNumHeads?o.kvNumHeads:o.numHeads,_=d?[o.batchSize,c,l,o.headSize]:void 0,f=[o.batchSize,o.sequenceLength,p],v=12,$={x:Math.ceil(o.vHeadSize/v),y:Math.ceil(o.sequenceLength/v),z:o.batchSize*o.numHeads},w=[{type:12,data:o.sequenceLength},{type:12,data:l},{type:12,data:o.vHeadSize},{type:12,data:o.numHeads},{type:12,data:o.headSize},{type:12,data:p},{type:12,data:n},{type:12,data:o.kvSequenceLength},{type:12,data:u}],g=d&&s&&be.size(s.dims)>0,C=["type","type"];g&&C.push("type"),i&&C.push("type"),a&&C.push("type");let E=[{dims:f,dataType:r.dataType,gpuDataType:0}];d&&E.push({dims:_,dataType:r.dataType,gpuDataType:0});let y=b=>{let x=Pe("probs",r.dataType,r.dims),S=Pe("v",t.dataType,t.dims),A=[x,S];g&&A.push(Pe("past_value",s.dataType,s.dims));let B=i?Pe("seq_lens",i.dataType,i.dims):void 0;i&&A.push(B);let K=a?Pe("total_sequence_length_input",a.dataType,a.dims):void 0;a&&A.push(K);let G=[Ze("output",r.dataType,f)];d&&G.push(Ze("present_value",r.dataType,_));let j=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"v_hidden_size",type:"u32"},{name:"past_sequence_length",type:"u32"},{name:"kv_sequence_length",type:"u32"},{name:"n_reps",type:"u32"}];return` + const TILE_SIZE = ${v}u; + var tileQ: array<${x.type.value}, ${v*v}>; + var tileV: array<${x.type.value}, ${v*v}>; + ${b.registerUniforms(j).declareVariables(...A,...G)} + ${b.mainStart([v,v,1])} + let headIdx = workgroup_id.z % uniforms.num_heads; + let batchIdx = workgroup_id.z / uniforms.num_heads; + let kvHeadIdx = ${u===1?"headIdx":"headIdx / uniforms.n_reps"}; + let kv_num_heads = ${u===1?"uniforms.num_heads":"uniforms.num_heads / uniforms.n_reps"}; + let m = global_id.y; + let n = global_id.x; + let sequence_length = uniforms.M; + var total_sequence_length = uniforms.K; + ${ta(B,K,!0)} + let offsetA = workgroup_id.z * uniforms.M * uniforms.K + m * uniforms.K; + let absKvHeadIdx = batchIdx * kv_num_heads + kvHeadIdx; // kvHeadIdx is relative to the batch + ${g&&d?"let pastValueOffset = absKvHeadIdx * uniforms.N * uniforms.past_sequence_length + n;":""}; + let vOffset = absKvHeadIdx * uniforms.N * uniforms.kv_sequence_length + n; + ${d?"let presentValueOffset = absKvHeadIdx * uniforms.N * uniforms.K + n;":""} + var value = ${x.type.storage}(0); + for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { + if (m < uniforms.M && w + local_id.x < uniforms.K) { + tileQ[TILE_SIZE * local_id.y + local_id.x] = probs[offsetA + w + local_id.x]; + } + if (n < uniforms.N && w + local_id.y < uniforms.K) { + var idx = TILE_SIZE * local_id.y + local_id.x; + ${g&&d?` + if (w + local_id.y < past_sequence_length) { + tileV[idx] = past_value[pastValueOffset + (w + local_id.y) * uniforms.N]; + } else if (w + local_id.y - past_sequence_length < uniforms.kv_sequence_length) { + tileV[idx] = v[vOffset + (w + local_id.y - past_sequence_length) * uniforms.N]; + } + `:` + if (w + local_id.y < uniforms.kv_sequence_length) { + tileV[idx] = v[vOffset + (w + local_id.y) * uniforms.N]; + }`} + ${d?` + if (w + local_id.y < present_sequence_length) { + present_value[presentValueOffset + (w + local_id.y) * uniforms.N] = tileV[idx]; + }`:""} + } + workgroupBarrier(); + for (var k: u32 = 0u; k < TILE_SIZE && w+k < total_sequence_length; k++) { + value += tileQ[TILE_SIZE * local_id.y + k] * tileV[TILE_SIZE * k + local_id.x]; + } + workgroupBarrier(); + } + + // we need to transpose output from BNSH_v to BSND_v + if (m < uniforms.M && n < uniforms.N) { + let outputIdx = batchIdx * uniforms.M * uniforms.v_hidden_size + m * uniforms.v_hidden_size + + headIdx * uniforms.N + n; + output[outputIdx] = value; + } + }`};return{name:"AttentionScore",shaderCache:{hint:`${s!==void 0};${e}`,inputDependencies:C},getRunData:()=>({outputs:E,dispatchGroup:$,programUniforms:w}),getShaderSource:y}},Zo=(e,r,t,s,o,n,i,a,l,u,p=void 0,d=void 0)=>{let c=Math.min(e.outputCount,1+(i?1:0)+(a?1:0)),_=c>1?u.pastSequenceLength:0,f=_+u.kvSequenceLength,v=l&&be.size(l.dims)>0?l:void 0,$=[r,t];c>1&&i&&be.size(i.dims)>0&&$.push(i),v&&$.push(v),p&&$.push(p),d&&$.push(d);let w=e.compute(P_(c,r,t,i,v,u,_,p,d),{inputs:$,outputs:c>1?[-1,1]:[-1]})[0];e.compute(E_(w,u.batchSize,u.numHeads,_,u.sequenceLength,f,p,d),{inputs:p&&d?[w,p,d]:[w],outputs:[]});let g=[w,s];c>1&&a&&be.size(a.dims)>0&&g.push(a),p&&g.push(p),d&&g.push(d),e.compute(C_(c,w,s,a,u,_,p,d),{inputs:g,outputs:c>1?[0,2]:[0]})},S_=(e,r)=>{let t=[r.batchSize,r.numHeads,r.sequenceLength,r.headSize],s=r.sequenceLength,o=r.inputHiddenSize,n=r.headSize,i=12,a={x:Math.ceil(r.headSize/i),y:Math.ceil(r.sequenceLength/i),z:r.batchSize*r.numHeads},l=[e.inputs[0],e.inputs[1],e.inputs[2]],u=[{type:12,data:s},{type:12,data:o},{type:12,data:n},{type:12,data:r.numHeads},{type:12,data:r.headSize},{type:12,data:r.hiddenSize},{type:12,data:r.hiddenSize+r.hiddenSize+r.vHiddenSize}],p=d=>{let c=Ze("output_q",l[0].dataType,t),_=Ze("output_k",l[0].dataType,t),f=Ze("output_v",l[0].dataType,t),v=Pe("input",l[0].dataType,l[0].dims),$=Pe("weight",l[1].dataType,l[1].dims),w=Pe("bias",l[2].dataType,l[2].dims),g=v.type.storage,C=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"hidden_size",type:"u32"},{name:"ldb",type:"u32"}];return` + const TILE_SIZE = ${i}u; + var tileInput: array<${g}, ${i*i}>; + var tileWeightQ: array<${g}, ${i*i}>; + var tileWeightK: array<${g}, ${i*i}>; + var tileWeightV: array<${g}, ${i*i}>; + ${d.registerUniforms(C).declareVariables(v,$,w,c,_,f)} + ${d.mainStart([i,i,1])} + let batchIndex = workgroup_id.z / uniforms.num_heads; + let headNumber = workgroup_id.z % uniforms.num_heads; + let m = global_id.y; + let n = global_id.x; + + let inputOffset = batchIndex * (uniforms.M * uniforms.K) + m * uniforms.K; + let biasOffsetQ = headNumber * uniforms.head_size; + let biasOffsetK = uniforms.hidden_size + biasOffsetQ; + let biasOffsetV = uniforms.hidden_size + biasOffsetK; + + var valueQ = ${g}(0); + var valueK = ${g}(0); + var valueV = ${g}(0); + for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { + if (m < uniforms.M && w + local_id.x < uniforms.K) { + tileInput[TILE_SIZE * local_id.y + local_id.x] = input[inputOffset + w + local_id.x]; + } + if (n < uniforms.N && w + local_id.y < uniforms.K) { + let offset = n + (w + local_id.y) * uniforms.ldb; + tileWeightQ[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetQ + offset]; + tileWeightK[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetK + offset]; + tileWeightV[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetV + offset]; + } + workgroupBarrier(); + for (var k: u32 = 0u; k({outputs:[{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0},{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0},{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0}],dispatchGroup:a,programUniforms:u}),getShaderSource:p},{inputs:l,outputs:[-1,-1,-1]})},fM=(e,r)=>{let t=T_(e.inputs,r),[s,o,n]=S_(e,t);return Zo(e,s,o,n,e.inputs[4],void 0,void 0,void 0,e.inputs[5],t)}}),$_,k_,I_,_M,ux=Re(()=>{_s(),ut(),ft(),Jt(),_t(),$_=(e,r)=>{if(!e||e.length!==5)throw new Error("BatchNormalization requires 5 inputs");let t=(s,o,n)=>{let i=o.length;if(i!==s.length)throw new Error(`${n}: num dimensions != ${i}`);o.forEach((a,l)=>{if(a!==s[l])throw new Error(`${n}: dim[${l}] do not match`)})};if(e[0].dims.length>1){let s=r.format==="NHWC"?r.spatial?e[0].dims.slice(-1):e[0].dims.slice(-1).concat(e[0].dims.slice(1,e[0].dims.length-1)):e[0].dims.slice(1,r.spatial?2:void 0);t(e[1].dims,s,"Invalid input scale"),t(e[2].dims,s,"Invalid input B"),t(e[3].dims,s,"Invalid input mean"),t(e[4].dims,s,"Invalid input var")}else t(e[1].dims,[1],"Invalid input scale"),t(e[2].dims,[1],"Invalid input B"),t(e[3].dims,[1],"Invalid input mean"),t(e[4].dims,[1],"Invalid input var")},k_=(e,r)=>{let{epsilon:t,spatial:s,format:o}=r,n=e[0].dims,i=s?qt(n[n.length-1]):1,a=o==="NHWC"&&n.length>1?i:1,l=be.size(n)/i,u=s,p=u?n.length:n,d=Pe("x",e[0].dataType,e[0].dims,i),c=Pe("scale",e[1].dataType,e[1].dims,a),_=Pe("bias",e[2].dataType,e[2].dims,a),f=Pe("inputMean",e[3].dataType,e[3].dims,a),v=Pe("inputVar",e[4].dataType,e[4].dims,a),$=Ze("y",e[0].dataType,p,i),w=()=>{let C="";if(s)C=`let cOffset = ${n.length===1?"0u":o==="NHWC"?`outputIndices[${n.length-1}] / ${i}`:"outputIndices[1]"};`;else if(o==="NCHW")C=` + ${$.indicesSet("outputIndices","0","0")} + let cOffset = ${$.indicesToOffset("outputIndices")};`;else{C=`var cIndices = ${c.type.indices}(0); + cIndices[0] = outputIndices[${n.length-1}];`;for(let E=1;E` + const epsilon = ${t}; + ${C.registerUniform("outputSize","u32").declareVariables(d,c,_,f,v,$)} + ${C.mainStart()} + ${C.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + var outputIndices = ${$.offsetToIndices(`global_idx * ${i}`)}; + ${w()} + let scale = ${c.getByOffset("cOffset")}; + let bias = ${_.getByOffset("cOffset")}; + let inputMean = ${f.getByOffset("cOffset")}; + let inputVar = ${v.getByOffset("cOffset")}; + let x = ${d.getByOffset("global_idx")}; + let value = (x - inputMean) * inverseSqrt(inputVar + epsilon) * scale + bias; + ${$.setByOffset("global_idx","value")} + }`;return{name:"BatchNormalization",shaderCache:{hint:`${r.epsilon}_${r.format}_${s}_${i}`,inputDependencies:u?["rank","type","type","type","type"]:void 0},getShaderSource:g,getRunData:()=>({outputs:[{dims:e[0].dims,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:u?[{type:12,data:l},...st(n)]:[{type:12,data:l}]})}},I_=e=>$t(e),_M=(e,r)=>{let{inputs:t,outputCount:s}=e,o=I_({...r,outputCount:s});if(jt.webgpu.validateInputContent&&$_(t,o),r.trainingMode)throw new Error("BatchNormalization trainingMode is not supported yet.");e.compute(k_(t,o))}}),A_,F_,gM,dx=Re(()=>{ft(),_t(),A_=e=>{if(e[0].dims.length!==3)throw new Error("input should have 3 dimensions");if(![320,640,1280].includes(e[0].dims[2]))throw new Error("number of channels should be 320, 640 or 1280");if(e[1].dims.length!==1)throw new Error("bias is expected to have 1 dimensions");if(e[0].dims[2]!==e[1].dims[0])throw new Error("last dimension of input and bias are not the same")},F_=e=>{let r=e[0].dims,t=e[0].dims[2],s=be.size(r)/4,o=e[0].dataType,n=Pe("input",o,r,4),i=Pe("bias",o,[t],4),a=Pe("residual",o,r,4),l=Ze("output",o,r,4);return{name:"BiasAdd",getRunData:()=>({outputs:[{dims:r,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(s/64)}}),getShaderSource:u=>` + const channels = ${t}u / 4; + ${u.declareVariables(n,i,a,l)} + + ${u.mainStart()} + ${u.guardAgainstOutOfBoundsWorkgroupSizes(s)} + let value = ${n.getByOffset("global_idx")} + + ${i.getByOffset("global_idx % channels")} + ${a.getByOffset("global_idx")}; + ${l.setByOffset("global_idx","value")} + }`}},gM=e=>{A_(e.inputs),e.compute(F_(e.inputs))}}),O_,Ct,wM,bM,MM,yM,vM,xM,TM,EM,PM,D_,CM,SM,$M,kM,qo,IM,ca,AM,FM,OM,DM,LM,zM,BM,RM,jM,NM,VM,UM,WM,GM,KM,HM,Zl,qM,Ru,ju,XM,QM,JM,L_,z_,YM,cd=Re(()=>{ut(),ft(),Jt(),_t(),O_=(e,r,t,s,o,n,i)=>{let a=Math.ceil(r/4),l="";typeof o=="string"?l=`${o}(a)`:l=o("a");let u=Pe("inputData",t,[a],4),p=Ze("outputData",s,[a],4),d=[{name:"vec_size",type:"u32"}];return i&&d.push(...i),` + ${e.registerUniforms(d).declareVariables(u,p)} + + ${n??""} + + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} + + let a = ${u.getByOffset("global_idx")}; + ${p.setByOffset("global_idx",l)} + }`},Ct=(e,r,t,s,o,n=e.dataType,i,a)=>{let l=[{type:12,data:Math.ceil(be.size(e.dims)/4)}];return i&&l.push(...i),{name:r,shaderCache:{hint:o,inputDependencies:["type"]},getShaderSource:u=>O_(u,be.size(e.dims),e.dataType,n,t,s,a),getRunData:u=>({outputs:[{dims:e.dims,dataType:n}],dispatchGroup:{x:Math.ceil(be.size(u[0].dims)/64/4)},programUniforms:l})}},wM=e=>{e.compute(Ct(e.inputs[0],"Abs","abs"))},bM=e=>{e.compute(Ct(e.inputs[0],"Acos","acos"))},MM=e=>{e.compute(Ct(e.inputs[0],"Acosh","acosh"))},yM=e=>{e.compute(Ct(e.inputs[0],"Asin","asin"))},vM=e=>{e.compute(Ct(e.inputs[0],"Asinh","asinh"))},xM=e=>{e.compute(Ct(e.inputs[0],"Atan","atan"))},TM=e=>{e.compute(Ct(e.inputs[0],"Atanh","atanh"))},EM=e=>$t(e),PM=(e,r)=>{let t;switch(r.to){case 10:t="vec4";break;case 1:t="vec4";break;case 12:t="vec4";break;case 6:t="vec4";break;case 9:t="vec4";break;default:throw new RangeError(`not supported type (specified in attribute 'to' from 'Cast' operator): ${r.to}`)}e.compute(Ct(e.inputs[0],"Cast",t,void 0,r.cacheKey,r.to))},D_=e=>{let r,t,s=e.length>=2&&e[1].data!==0,o=e.length>=3&&e[2].data!==0;switch(e[0].dataType){case 1:r=s?e[1].getFloat32Array()[0]:-34028234663852886e22,t=o?e[2].getFloat32Array()[0]:34028234663852886e22;break;case 10:r=s?e[1].getUint16Array()[0]:64511,t=o?e[2].getUint16Array()[0]:31743;break;default:throw new Error("Unsupport data type")}return $t({min:r,max:t})},CM=(e,r)=>{let t=r||D_(e.inputs),s=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"Clip",o=>`clamp(${o}, vec4<${s}>(uniforms.min), vec4<${s}>(uniforms.max))`,void 0,t.cacheKey,void 0,[{type:e.inputs[0].dataType,data:t.min},{type:e.inputs[0].dataType,data:t.max}],[{name:"min",type:s},{name:"max",type:s}]),{inputs:[0]})},SM=e=>{e.compute(Ct(e.inputs[0],"Ceil","ceil"))},$M=e=>{e.compute(Ct(e.inputs[0],"Cos","cos"))},kM=e=>{e.compute(Ct(e.inputs[0],"Cosh","cosh"))},qo=e=>$t(e),IM=(e,r)=>{let t=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"Elu",s=>`elu_vf32(${s})`,` + const elu_alpha_ = ${t}(${r.alpha}); + + fn elu_f32(a: ${t}) -> ${t} { + return select((exp(a) - 1.0) * elu_alpha_, a, a >= 0.0); + } + + fn elu_vf32(v: vec4<${t}>) -> vec4<${t}> { + return vec4(elu_f32(v.x), elu_f32(v.y), elu_f32(v.z), elu_f32(v.w)); + }`,r.cacheKey))},ca=(e="f32")=>` +const r0: ${e} = 0.3275911; +const r1: ${e} = 0.254829592; +const r2: ${e} = -0.284496736; +const r3: ${e} = 1.421413741; +const r4: ${e} = -1.453152027; +const r5: ${e} = 1.061405429; + +fn erf_vf32(v: vec4<${e}>) -> vec4<${e}> { + let absv = abs(v); + let x = 1.0 / (1.0 + r0 * absv); + return sign(v) * (1.0 - ((((r5 * x + r4) * x + r3) * x + r2) * x + r1) * x * exp(-absv * absv)); +}`,AM=e=>{let r=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"Erf",t=>`erf_vf32(${t})`,ca(r)))},FM=e=>{e.compute(Ct(e.inputs[0],"Exp","exp"))},OM=e=>{e.compute(Ct(e.inputs[0],"Floor","floor"))},DM=e=>{let r=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"Gelu",t=>`0.5 * ${t} * (1.0 + erf_vf32(${t} * 0.7071067811865475))`,ca(r)))},LM=(e,r)=>{let t=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"LeakyRelu",s=>`select(leaky_relu_alpha_ * ${s}, ${s}, ${s} >= vec4<${t}>(0.0))`,`const leaky_relu_alpha_ = ${t}(${r.alpha});`,r.cacheKey))},zM=e=>{e.compute(Ct(e.inputs[0],"Not",r=>`!${r}`))},BM=e=>{e.compute(Ct(e.inputs[0],"Neg",r=>`-${r}`))},RM=e=>{e.compute(Ct(e.inputs[0],"Reciprocal",r=>`1.0/${r}`))},jM=e=>{let r=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"Relu",t=>`select(vec4<${r}>(0.0), ${t}, ${t} > vec4<${r}>(0.0))`))},NM=e=>{e.compute(Ct(e.inputs[0],"Sigmoid",r=>`(1.0 / (1.0 + exp(-${r})))`))},VM=e=>$t(e),UM=(e,r)=>{let t=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"HardSigmoid",s=>`max(vec4<${t}>(0.0), min(vec4<${t}>(1.0), ${r.alpha} * ${s} + vec4<${t}>(${r.beta})))`,void 0,r.cacheKey))},WM=e=>{e.compute(Ct(e.inputs[0],"Sin","sin"))},GM=e=>{e.compute(Ct(e.inputs[0],"Sinh","sinh"))},KM=e=>{e.compute(Ct(e.inputs[0],"Sqrt","sqrt"))},HM=e=>{e.compute(Ct(e.inputs[0],"Tan","tan"))},Zl=e=>`sign(${e}) * (1 - exp(-2 * abs(${e}))) / (1 + exp(-2 * abs(${e})))`,qM=e=>{e.compute(Ct(e.inputs[0],"Tanh",Zl))},Ru=(e="f32")=>` +const fast_gelu_a: ${e} = 0.5; +const fast_gelu_b: ${e} = 0.7978845608028654; +const fast_gelu_c: ${e} = 0.035677408136300125; + +fn tanh_v(v: vec4<${e}>) -> vec4<${e}> { + return ${Zl("v")}; +} +`,ju=e=>`(fast_gelu_a + fast_gelu_a * tanh_v(${e} * (fast_gelu_c * ${e} * ${e} + fast_gelu_b))) * ${e}`,XM=e=>{let r=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"FastGelu",ju,Ru(r),void 0,e.inputs[0].dataType))},QM=(e,r)=>{let t=Er(e.inputs[0].dataType);return e.compute(Ct(e.inputs[0],"ThresholdedRelu",s=>`select(vec4<${t}>(0.0), ${s}, ${s} > thresholded_relu_alpha_)`,`const thresholded_relu_alpha_ = vec4<${t}>(${r.alpha});`,r.cacheKey)),0},JM=e=>{e.compute(Ct(e.inputs[0],"Log","log"))},L_=(e,r)=>` +const alpha = vec4<${e}>(${r}); +const one = ${e}(1.0); +const zero = ${e}(0.0); + +fn quick_gelu_impl(x: vec4<${e}>) -> vec4<${e}> { + let v = x *alpha; + var x1 : vec4<${e}>; + for (var i = 0; i < 4; i = i + 1) { + if (v[i] >= zero) { + x1[i] = one / (one + exp(-v[i])); + } else { + x1[i] = one - one / (one + exp(v[i])); + } + } + return x * x1; +} +`,z_=e=>`quick_gelu_impl(${e})`,YM=(e,r)=>{let t=Er(e.inputs[0].dataType);e.compute(Ct(e.inputs[0],"QuickGelu",z_,L_(t,r.alpha),r.cacheKey,e.inputs[0].dataType))}}),B_,R_,ZM,cx=Re(()=>{ft(),_t(),cd(),B_=e=>{if(e[0].dims.length!==3)throw new Error("input should have 3 dimensions");if(![2560,5120,10240].includes(e[0].dims[2]))throw new Error("hidden state should be 2560, 5120 or 10240");if(e[1].dims.length!==1)throw new Error("bias is expected to have 1 dimensions");if(e[0].dims[2]!==e[1].dims[0])throw new Error("last dimension of input and bias are not the same")},R_=e=>{let r=e[0].dims.slice();r[2]=r[2]/2;let t=Pe("input",e[0].dataType,e[0].dims,4),s=Pe("bias",e[0].dataType,[e[0].dims[2]],4),o=Ze("output",e[0].dataType,r,4),n=be.size(r)/4,i=mr(e[0].dataType);return{name:"BiasSplitGelu",getRunData:()=>({outputs:[{dims:r,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(n/64)}}),getShaderSource:a=>` + const M_SQRT2 = sqrt(2.0); + const halfChannels = ${e[0].dims[2]/4/2}u; + + ${a.declareVariables(t,s,o)} + + ${ca(i)} + + ${a.mainStart()} + ${a.guardAgainstOutOfBoundsWorkgroupSizes(n)} + let biasIdx = global_idx % halfChannels; + let batchIndex = global_idx / halfChannels; + let inputOffset = biasIdx + batchIndex * halfChannels * 2; + let valueLeft = input[inputOffset] + bias[biasIdx]; + let valueRight = input[inputOffset + halfChannels] + bias[biasIdx + halfChannels]; + let geluRight = valueRight * 0.5 * (erf_vf32(valueRight / M_SQRT2) + 1); + + ${o.setByOffset("global_idx","valueLeft * geluRight")} + }`}},ZM=e=>{B_(e.inputs),e.compute(R_(e.inputs))}}),j_,N_,cs,ey,ty,ry,sy,ny,oy,iy,ay,ly,uy,px=Re(()=>{ut(),ft(),_t(),j_=(e,r,t,s,o,n,i,a,l,u,p,d)=>{let c,_;typeof a=="string"?c=_=(g,C)=>`${a}((${g}),(${C}))`:typeof a=="function"?c=_=a:(c=a.scalar,_=a.vector);let f=Ze("outputData",p,s.length,4),v=Pe("aData",l,r.length,4),$=Pe("bData",u,t.length,4),w;if(o)if(n){let g=be.size(r)===1,C=be.size(t)===1,E=r.length>0&&r[r.length-1]%4===0,y=t.length>0&&t[t.length-1]%4===0;g||C?w=f.setByOffset("global_idx",_(g?`${v.type.value}(${v.getByOffset("0")}.x)`:v.getByOffset("global_idx"),C?`${$.type.value}(${$.getByOffset("0")}.x)`:$.getByOffset("global_idx"))):w=` + let outputIndices = ${f.offsetToIndices("global_idx * 4u")}; + let offsetA = ${v.broadcastedIndicesToOffset("outputIndices",f)}; + let offsetB = ${$.broadcastedIndicesToOffset("outputIndices",f)}; + ${f.setByOffset("global_idx",_(i||E?v.getByOffset("offsetA / 4u"):`${v.type.value}(${v.getByOffset("offsetA / 4u")}[offsetA % 4u])`,i||y?$.getByOffset("offsetB / 4u"):`${$.type.value}(${$.getByOffset("offsetB / 4u")}[offsetB % 4u])`))} + `}else w=f.setByOffset("global_idx",_(v.getByOffset("global_idx"),$.getByOffset("global_idx")));else{if(!n)throw new Error("no necessary to use scalar implementation for element-wise binary op implementation.");let g=(C,E,y="")=>{let b=`aData[indexA${E}][componentA${E}]`,x=`bData[indexB${E}][componentB${E}]`;return` + let outputIndices${E} = ${f.offsetToIndices(`global_idx * 4u + ${E}u`)}; + let offsetA${E} = ${v.broadcastedIndicesToOffset(`outputIndices${E}`,f)}; + let offsetB${E} = ${$.broadcastedIndicesToOffset(`outputIndices${E}`,f)}; + let indexA${E} = offsetA${E} / 4u; + let indexB${E} = offsetB${E} / 4u; + let componentA${E} = offsetA${E} % 4u; + let componentB${E} = offsetB${E} % 4u; + ${C}[${E}] = ${y}(${c(b,x)}); + `};p===9?w=` + var data = vec4(0); + ${g("data",0,"u32")} + ${g("data",1,"u32")} + ${g("data",2,"u32")} + ${g("data",3,"u32")} + outputData[global_idx] = dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(data));`:w=` + ${g("outputData[global_idx]",0)} + ${g("outputData[global_idx]",1)} + ${g("outputData[global_idx]",2)} + ${g("outputData[global_idx]",3)} + `}return` + ${e.registerUniform("vec_size","u32").declareVariables(v,$,f)} + + ${d??""} + + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} + ${w} + }`},N_=(e,r,t,s,o,n,i=t.dataType)=>{let a=t.dims.map(v=>Number(v)??1),l=s.dims.map(v=>Number(v)??1),u=!be.areEqual(a,l),p=a,d=be.size(a),c=!1,_=!1,f=[u];if(u){let v=oo.calcShape(a,l,!1);if(!v)throw new Error("Can't perform binary op on the given tensors");p=v.slice(),d=be.size(p);let $=be.size(a)===1,w=be.size(l)===1,g=a.length>0&&a[a.length-1]%4===0,C=l.length>0&&l[l.length-1]%4===0;f.push($),f.push(w),f.push(g),f.push(C);let E=1;for(let y=1;yv.toString()).join("_"),inputDependencies:["rank","rank"]},getShaderSource:v=>j_(v,a,l,p,c,u,_,o,t.dataType,s.dataType,i,n),getRunData:()=>({outputs:[{dims:p,dataType:i}],dispatchGroup:{x:Math.ceil(d/64/4)},programUniforms:[{type:12,data:Math.ceil(be.size(p)/4)},...st(a,l,p)]})}},cs=(e,r,t,s,o,n)=>{e.compute(N_(r,o??"",e.inputs[0],e.inputs[1],t,s,n))},ey=e=>{cs(e,"Add",(r,t)=>`${r}+${t}`)},ty=e=>{cs(e,"Div",(r,t)=>`${r}/${t}`)},ry=e=>{cs(e,"Equal",{scalar:(r,t)=>`u32(${r}==${t})`,vector:(r,t)=>`vec4(${r}==${t})`},void 0,void 0,9)},sy=e=>{cs(e,"Mul",(r,t)=>`${r}*${t}`)},ny=e=>{let r=Pe("input",e.inputs[0].dataType,e.inputs[0].dims).type.value;cs(e,"Pow",{scalar:(t,s)=>`pow_custom(${t},${s})`,vector:(t,s)=>`pow_vector_custom(${t},${s})`},` + fn pow_custom(a : ${r}, b : ${r}) -> ${r} { + if (b == ${r}(0.0)) { + return ${r}(1.0); + } else if (a < ${r}(0.0) && f32(b) != floor(f32(b))) { + return ${r}(pow(f32(a), f32(b))); // NaN + } + return select(sign(a), ${r}(1.0), round(f32(abs(b) % ${r}(2.0))) != 1.0) * ${r}(${r==="i32"?"round":""}(pow(f32(abs(a)), f32(b)))); + } + fn pow_vector_custom(a : vec4<${r}>, b : vec4<${r}>) -> vec4<${r}> { + // TODO: implement vectorized pow + return vec4<${r}>(pow_custom(a.x, b.x), pow_custom(a.y, b.y), pow_custom(a.z, b.z), pow_custom(a.w, b.w)); + } + `)},oy=e=>{cs(e,"Sub",(r,t)=>`${r}-${t}`)},iy=e=>{cs(e,"Greater",{scalar:(r,t)=>`u32(${r}>${t})`,vector:(r,t)=>`vec4(${r}>${t})`},void 0,void 0,9)},ay=e=>{cs(e,"Less",{scalar:(r,t)=>`u32(${r}<${t})`,vector:(r,t)=>`vec4(${r}<${t})`},void 0,void 0,9)},ly=e=>{cs(e,"GreaterOrEqual",{scalar:(r,t)=>`u32(${r}>=${t})`,vector:(r,t)=>`vec4(${r}>=${t})`},void 0,void 0,9)},uy=e=>{cs(e,"LessOrEqual",{scalar:(r,t)=>`u32(${r}<=${t})`,vector:(r,t)=>`vec4(${r}<=${t})`},void 0,void 0,9)}}),V_,U_,W_,G_,dy,cy,hx=Re(()=>{ut(),ft(),Jt(),_t(),V_=(e,r)=>{if(!e||e.length<1)throw new Error("too few inputs");let t=0,s=e[t],o=s.dataType,n=s.dims.length;e.forEach((i,a)=>{if(a!==t){if(i.dataType!==o)throw new Error("input tensors should be one type");if(i.dims.length!==n)throw new Error("input tensors should have the same shape");i.dims.forEach((l,u)=>{if(u!==r&&l!==s.dims[u])throw new Error("non concat dimensions must match")})}})},U_=(e,r)=>` + fn calculateInputIndex(index: u32) -> u32 { + let sizeInConcatAxis = array(${r}); + for (var i: u32 = 0u; i < ${e}; i += 1u ) { + if (index < sizeInConcatAxis[i]) { + return i; + } + } + return ${e}u; + }`,W_=(e,r)=>{let t=e.length,s=[];for(let o=0;o{let o=be.size(t),n=new Array(e.length),i=new Array(e.length),a=0,l=[],u=[],p=[{type:12,data:o}];for(let v=0;v`uniforms.sizeInConcatAxis${v}`).join(","),f=v=>` + + ${(()=>{v.registerUniform("outputSize","u32");for(let $=0;$(${_}); + ${c} -= sizeInConcatAxis[inputIndex - 1u]; + } + + ${W_(i,d)} + }`;return{name:"Concat",shaderCache:{hint:`${r}`,inputDependencies:l},getRunData:()=>({outputs:[{dims:t,dataType:s}],dispatchGroup:{x:Math.ceil(o/64)},programUniforms:p}),getShaderSource:f}},dy=(e,r)=>{let t=e.inputs,s=t[0].dims,o=be.normalizeAxis(r.axis,s.length);V_(t,o);let n=s.slice();n[o]=t.reduce((a,l)=>a+(l.dims.length>o?l.dims[o]:0),0);let i=t.filter(a=>be.size(a.dims)>0);e.compute(G_(i,o,n,t[0].dataType),{inputs:i})},cy=e=>$t({axis:e.axis})}),On,Dn,Ln,pd,Bn=Re(()=>{ut(),ft(),On=(e,r,t="f32")=>{switch(e.activation){case"Relu":return`value = max(value, ${r}(0.0));`;case"Sigmoid":return`value = (${r}(1.0) / (${r}(1.0) + exp(-value)));`;case"Clip":return`value = clamp(value, ${r}(${t}(uniforms.clip_min)), ${r}(${t}(uniforms.clip_max)));`;case"HardSigmoid":return`value = max(${r}(0.0), min(${r}(1.0), ${t}(uniforms.alpha) * value + ${t}(uniforms.beta)));`;case"LeakyRelu":return`value = select(${t}(uniforms.alpha) * value, value, value >= ${r}(0.0));`;case"Tanh":return`let e2x = exp(-2.0 * abs(value)); + value = sign(value) * (1.0 - e2x) / (1.0 + e2x); + `;case"":return"";default:throw new Error(`Unsupported activation ${e.activation}`)}},Dn=(e,r)=>{e.activation==="Clip"?r.push({type:1,data:e.clipMax},{type:1,data:e.clipMin}):e.activation==="HardSigmoid"?r.push({type:1,data:e.alpha},{type:1,data:e.beta}):e.activation==="LeakyRelu"&&r.push({type:1,data:e.alpha})},Ln=(e,r)=>{e.activation==="Clip"?r.push({name:"clip_max",type:"f32"},{name:"clip_min",type:"f32"}):e.activation==="HardSigmoid"?r.push({name:"alpha",type:"f32"},{name:"beta",type:"f32"}):e.activation==="LeakyRelu"&&r.push({name:"alpha",type:"f32"})},pd=e=>{let r=(e==null?void 0:e.activation)||"";if(r==="HardSigmoid"){let[t,s]=(e==null?void 0:e.activation_params)||[.2,.5];return{activation:r,alpha:t,beta:s}}else if(r==="Clip"){let[t,s]=(e==null?void 0:e.activation_params)||[zb,Bb];return{activation:r,clipMax:s,clipMin:t}}else if(r==="LeakyRelu"){let[t]=(e==null?void 0:e.activation_params)||[.01];return{activation:r,alpha:t}}return{activation:r}}}),br,py,hd=Re(()=>{br=(e,r)=>{switch(e){case 1:return r;case 2:return`vec2<${r}>`;case 3:return`vec3<${r}>`;case 4:return`vec4<${r}>`;default:throw new Error(`${e}-component is not supported.`)}},py=e=>` + ${e?"value = value + getBiasByOutputCoords(coords);":""} + `}),hy,mx=Re(()=>{hy=e=>` +fn getIndexFromCoords4D(coords : vec4, shape : vec4) -> i32 { + return dot(coords, vec4( + shape.y * shape.z * shape.w, shape.z * shape.w, shape.w, 1)); +} +fn getOutputIndexFromCoords(coords : vec4) -> i32 { + return dot(coords, vec4( + i32(${e}.x), i32(${e}.y), i32(${e}.z), 1)); +} +`}),Qo,md,fd=Re(()=>{ut(),ft(),_t(),Bn(),Qo=(e,r,t,s,o)=>{let n=s-t;return` + ${Array.from({length:t}).map((i,a)=>` + if (${rt(r.shape,a,r.rank)} != 1) { + ${r.indicesSet(e,a,rt(o,a+n,s))} + } else { + ${r.indicesSet(e,a,0)} + }`).join("")} +`},md=(e,r,t,s,o=!1,n)=>{let i=e[0].dims,a=e[1].dims,l=i[i.length-2],u=a[a.length-1],p=i[i.length-1],d=qt(u),c=qt(p),_=qt(l),f=be.size(t)/d/_,v=e.length>2,$=s?s.slice(0,-2):t.slice(0,-2),w=[be.size($),l,u],g=[{type:12,data:f},{type:12,data:l},{type:12,data:u},{type:12,data:p}];Dn(r,g),g.push(...st($,i,a)),v&&g.push(...st(e[2].dims)),g.push(...st(w));let C=E=>{let y=ld("batch_dims",e[0].dataType,$.length),b=Pe("a",e[0].dataType,i.length,c),x=Pe("b",e[1].dataType,a.length,d),S=Ze("output",e[0].dataType,w.length,d),A=mr(S.type.tensor),B=On(r,S.type.value,A),K=[b,x],G="";if(v){let H=o?d:1;K.push(Pe("bias",e[2].dataType,e[2].dims.length,H)),G=`${o?`value += bias[col / ${H}];`:`value += ${S.type.value}(bias[row + i]);`}`}let j=[{name:"output_size",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"}];Ln(r,j);let ee=()=>{let H=`var a_data: ${b.type.value};`;for(let Z=0;Z; + for (var k: u32 = 0u; k < uniforms.K; k = k + ${c}) { + ${ee()} + } + for (var i = 0u; i < ${_}u; i++) { + var value = values[i]; + ${G} + ${B} + let cur_indices = ${S.type.indices}(batch, row + i, col); + let offset = ${S.indicesToOffset("cur_indices")}; + ${S.setByOffset(`offset / ${d}`,"value")}; + } + } + `};return{name:"MatMulNaive",shaderCache:{hint:`${r.activation};${d};${c};${_};${o}`,inputDependencies:v?["rank","rank","rank"]:["rank","rank"]},getRunData:()=>({outputs:[{dims:n?n(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(f/64)},programUniforms:g}),getShaderSource:C}}}),K_,H_,Nu,eu,q_,Vu,X_,_a,_d=Re(()=>{ut(),ft(),_t(),Bn(),fd(),hd(),K_=(e,r)=>e?` + mm_Asub[inputRow][inputCol] = mm_readA(batch, + kStart + inputRow, + globalRowStart / innerElementSize + inputCol${r?", batchIndices":""}); + `:` + mm_Asub[inputRow][inputCol] = mm_readA(batch, + globalRow + innerRow, + kStart / innerElementSize + inputCol${r?", batchIndices":""}); + `,H_=(e,r)=>e?` + let ACached0 = mm_Asub[k * innerElementSize][localRow]; + let ACached1 = mm_Asub[k * innerElementSize + 1][localRow]; + let ACached2 = mm_Asub[k * innerElementSize + 2][localRow]; + ${r===3?"":"let ACached3 = mm_Asub[k * innerElementSize + 3][localRow];"} + for (var i = 0; i < rowPerThread; i = i + 1) { + acc[i] = BCached0 * ACached0[i] + acc[i]; + acc[i] = BCached1 * ACached1[i] + acc[i]; + acc[i] = BCached2 * ACached2[i] + acc[i]; + ${r===3?"":"acc[i] = BCached3 * ACached3[i] + acc[i];"} + }`:` + for (var i = 0; i < rowPerThread; i = i + 1) { + let ACached = mm_Asub[tileRow + i][k]; + acc[i] = BCached0 * ACached.x + acc[i]; + acc[i] = BCached1 * ACached.y + acc[i]; + acc[i] = BCached2 * ACached.z + acc[i]; + ${r===3?"":"acc[i] = BCached3 * ACached.w + acc[i];"} + }`,Nu=(e,r,t="f32",s,o=!1,n=32,i=!1,a=32)=>{let l=r[1]*e[1],u=r[0]*e[0],p=o?l:n,d=o?n:l,c=p/r[0],_=n/r[1];if(!((o&&c===4&&e[1]===4||!o&&(c===3||c===4))&&p%r[0]===0&&n%r[1]===0&&e[0]===4))throw new Error(`If transposeA ${o} is true, innerElementSize ${c} and workPerThread[1] ${e[1]} must be 4. + Otherwise, innerElementSize ${c} must be 3 or 4. + tileAWidth ${p} must be divisible by workgroupSize[0]${r[0]}. tileInner ${n} must be divisible by workgroupSize[1] ${r[1]}. colPerThread ${e[0]} must be 4.`);return` +var mm_Asub: array, ${p/c}>, ${d}>; +var mm_Bsub: array, ${u/e[0]}>, ${n}>; + +const rowPerThread = ${e[1]}; +const colPerThread = ${e[0]}; +const innerElementSize = ${c}; +const tileInner = ${n}; + +@compute @workgroup_size(${r[0]}, ${r[1]}, ${r[2]}) +fn main(@builtin(local_invocation_id) localId : vec3, + @builtin(global_invocation_id) globalId : vec3, + @builtin(workgroup_id) workgroupId : vec3) { + let localRow = i32(localId.y); + let tileRow = localRow * rowPerThread; + let tileCol = i32(localId.x); + + let globalRow =i32(globalId.y) * rowPerThread; + let globalCol = i32(globalId.x); + let batch = ${i?"0":"i32(globalId.z)"}; + ${s?`let batchIndices = ${s.offsetToIndices("u32(batch)")};`:""} + let globalRowStart = i32(workgroupId.y) * ${l}; + + let num_tiles = ${i?`${Math.ceil(a/n)}`:"(uniforms.dim_inner - 1) / tileInner + 1"}; + var kStart = ${i?`i32(globalId.z) * ${a}`:"0"}; + + var acc: array, rowPerThread>; + + // Loop over shared dimension. + let tileRowB = localRow * ${_}; + for (var t = 0; t < num_tiles; t = t + 1) { + // Load one tile of A into local memory. + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + let inputRow = tileRow + innerRow; + let inputCol = tileCol; + ${K_(o,s)} + } + + // Load one tile of B into local memory. + for (var innerRow = 0; innerRow < ${_}; innerRow = innerRow + 1) { + let inputRow = tileRowB + innerRow; + let inputCol = tileCol; + mm_Bsub[inputRow][inputCol] = mm_readB(batch, kStart + inputRow, globalCol${s?", batchIndices":""}); + } + kStart = kStart + tileInner; + workgroupBarrier(); + + // Compute acc values for a single thread. + for (var k = 0; k < tileInner / innerElementSize; k = k + 1) { + let BCached0 = mm_Bsub[k * innerElementSize][tileCol]; + let BCached1 = mm_Bsub[k * innerElementSize + 1][tileCol]; + let BCached2 = mm_Bsub[k * innerElementSize + 2][tileCol]; + ${c===3?"":"let BCached3 = mm_Bsub[k * innerElementSize + 3][tileCol];"} + + ${H_(o,c)} + } + + workgroupBarrier(); + } + + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + mm_write(batch, globalRow + innerRow, globalCol, acc[innerRow]); + } +}`},eu=(e,r)=>e?` + mm_Asub[inputRow][inputCol] = mm_readA(batch, + kStart + inputRow, + globalRowStart + inputCol${r?", batchIndices":""}); + `:` + mm_Asub[inputRow][inputCol] = mm_readA(batch, + globalRowStart + inputRow, + kStart + inputCol${r?", batchIndices":""}); + `,q_=e=>e?"let ACached = mm_Asub[k][tileRow + innerRow];":"let ACached = mm_Asub[tileRow + innerRow][k];",Vu=(e,r,t="f32",s,o=!1,n=32,i=!1,a=32,l=!1)=>{let u=e[1]*r[1],p=e[0]*r[0],d=o?u:n,c=o?n:u;if(!(c%r[1]===0&&d%r[0]===0&&n%r[1]===0))throw new Error(`tileAHight ${c} must be divisible by workgroupSize[1]${r[1]}, tileAWidth ${d} must be divisible by workgroupSize[0]${r[0]}, tileInner ${n} must be divisible by workgroupSize[1]${r[1]}`);let _=c/r[1],f=d/r[0],v=n/r[1],$=l?` + let localRow = i32(localId.y); + let localCol = i32(localId.x); + let globalRowStart = i32(workgroupId.y) * ${u}; + let globalColStart = i32(workgroupId.x) * ${p}; + + // Loop over shared dimension. + for (var t = 0; t < num_tiles; t = t + 1) { + // Load one tile of A into local memory. + for (var inputRow = localRow; inputRow < ${c}; inputRow = inputRow + ${r[1]}) { + for (var inputCol = localCol; inputCol < ${d}; inputCol = inputCol + ${r[0]}) { + ${eu(o,s)} + } + } + // Load one tile of B into local memory. + for (var inputRow = localRow; inputRow < ${n}; inputRow = inputRow + ${r[1]}) { + for (var inputCol = localCol; inputCol < ${p}; inputCol = inputCol + ${r[0]}) { + mm_Bsub[inputRow][inputCol] = mm_readB(batch, + kStart + inputRow, + globalColStart + inputCol${s?", batchIndices":""}); + } + } + kStart = kStart + tileInner; + workgroupBarrier(); + + // Compute acc values for a single thread. + var BCached : array<${t}, colPerThread>; + for (var k = 0; k < tileInner; k = k + 1) { + for (var inner = 0; inner < colPerThread; inner = inner + 1) { + BCached[inner] = mm_Bsub[k][localCol + inner * ${r[0]}]; + } + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + let ACached = ${o?`mm_Asub[k][localRow + innerRow * ${r[1]}];`:`mm_Asub[localRow + innerRow * ${r[1]}][k];`} + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + acc[innerRow][innerCol] = acc[innerRow][innerCol] + + ACached * BCached[innerCol]; + } + } + } + workgroupBarrier(); + } + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + let gRow = globalRowStart + localRow + innerRow * ${r[1]}; + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + let gCol = globalColStart + localCol + innerCol * ${r[0]}; + mm_write(batch, gRow, gCol, acc[innerRow][innerCol]); + } + } + `:` +let tileRow = i32(localId.y) * rowPerThread; +let tileCol = i32(localId.x) * colPerThread; + +let globalRow = i32(globalId.y) * rowPerThread; +let globalCol = i32(globalId.x) * colPerThread; +let globalRowStart = i32(workgroupId.y) * ${u}; + +let tileRowA = i32(localId.y) * ${_}; +let tileColA = i32(localId.x) * ${f}; +let tileRowB = i32(localId.y) * ${v}; +// Loop over shared dimension. +for (var t = 0; t < num_tiles; t = t + 1) { + // Load one tile of A into local memory. + for (var innerRow = 0; innerRow < ${_}; innerRow = innerRow + 1) { + for (var innerCol = 0; innerCol < ${f}; innerCol = innerCol + 1) { + let inputRow = tileRowA + innerRow; + let inputCol = tileColA + innerCol; + ${eu(o,s)} + } + } + + // Load one tile of B into local memory. + for (var innerRow = 0; innerRow < ${v}; innerRow = innerRow + 1) { + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + let inputRow = tileRowB + innerRow; + let inputCol = tileCol + innerCol; + mm_Bsub[inputRow][inputCol] = mm_readB(batch, + kStart + inputRow, + globalCol + innerCol${s?", batchIndices":""}); + } + } + kStart = kStart + tileInner; + workgroupBarrier(); + + // Compute acc values for a single thread. + var BCached : array<${t}, colPerThread>; + for (var k = 0; k < tileInner; k = k + 1) { + for (var inner = 0; inner < colPerThread; inner = inner + 1) { + BCached[inner] = mm_Bsub[k][tileCol + inner]; + } + + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + ${q_(o)} + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + acc[innerRow][innerCol] = acc[innerRow][innerCol] + ACached * BCached[innerCol]; + } + } + } + + workgroupBarrier(); +} + +for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + mm_write(batch, globalRow + innerRow, globalCol + innerCol, + acc[innerRow][innerCol]); + } +} +`;return` + var mm_Asub : array, ${c}>; + var mm_Bsub : array, ${n}>; + const rowPerThread = ${e[1]}; + const colPerThread = ${e[0]}; + const tileInner = ${n}; + +@compute @workgroup_size(${r[0]}, ${r[1]}, ${r[2]}) +fn main(@builtin(local_invocation_id) localId : vec3, + @builtin(global_invocation_id) globalId : vec3, + @builtin(workgroup_id) workgroupId : vec3) { + let batch = ${i?"0":"i32(globalId.z)"}; + ${s?`let batchIndices = ${s.offsetToIndices("u32(batch)")};`:""} + let num_tiles = ${i?`${Math.ceil(a/n)}`:"(uniforms.dim_inner - 1) / tileInner + 1"}; + var kStart = ${i?`i32(globalId.z) * ${a}`:"0"}; + + var acc : array, rowPerThread>; + ${$} + } +`},X_=(e,r,t,s,o=!1)=>{let[n,i,a,l]=s,u=mr(s[0].type.tensor);return` + fn mm_readA(batch: i32, row: i32, colIn: i32, batchIndices: ${n.type.indices}) -> ${br(e,u)} { + var value = ${br(e,u)}(0.0); + let col = colIn * ${e}; + if(row < uniforms.dim_a_outer && col < uniforms.dim_inner) + { + var aIndices: ${i.type.indices}; + ${Qo("aIndices",i,i.rank-2,n.rank,"batchIndices")} + ${i.indicesSet("aIndices",i.rank-2,"u32(row)")} + ${i.indicesSet("aIndices",i.rank-1,"u32(colIn)")} + value = ${i.getByIndices("aIndices")}; + } + return value; + } + + fn mm_readB(batch: i32, row: i32, colIn: i32, batchIndices: ${n.type.indices}) -> ${br(e,u)} { + var value = ${br(e,u)}(0.0); + let col = colIn * ${e}; + if(row < uniforms.dim_inner && col < uniforms.dim_b_outer) + { + var bIndices: ${a.type.indices}; + ${Qo("bIndices",a,a.rank-2,n.rank,"batchIndices")} + ${a.indicesSet("bIndices",a.rank-2,"u32(row)")} + ${a.indicesSet("bIndices",a.rank-1,"u32(colIn)")} + value = ${a.getByIndices("bIndices")}; + } + return value; + } + + fn mm_write(batch: i32, row: i32, colIn: i32, valueIn: ${br(e,u)}) { + let col = colIn * ${e}; + if (row < uniforms.dim_a_outer && col < uniforms.dim_b_outer) { + var value = valueIn; + let coords = vec3(batch, row, colIn); + ${r?`value = value + ${o?"bias[colIn]":`${br(e,u)}(bias[row])`};`:""} + ${t} + ${l.setByIndices("vec3(coords)","value")} + } + } + `},_a=(e,r,t,s,o=!1,n)=>{let i=e[0].dims,a=e[1].dims,l=i.slice(0,-2),u=a.slice(0,-2),p=s?s.slice(0,-2):t.slice(0,-2),d=be.size(p),c=i[i.length-2],_=i[i.length-1],f=a[a.length-1],v=_%4===0&&f%4===0,$=c<=8?[4,1,1]:[4,4,1],w=[8,8,1],g=[Math.ceil(f/w[0]/$[0]),Math.ceil(c/w[1]/$[1]),Math.ceil(d/w[2]/$[2])],C=v?4:1,E=[...l,c,_/C],y=E.length,b=[...u,_,f/C],x=b.length,S=[d,c,f/C],A=[{type:6,data:c},{type:6,data:f},{type:6,data:_}];Dn(r,A),A.push(...st(p,E,b));let B=["rank","rank"],K=e.length>2;K&&(A.push(...st(e[2].dims)),B.push("rank")),A.push(...st(S));let G=j=>{let ee=p.length,H=ld("batchDims",e[0].dataType,ee,1),Z=mr(e[0].dataType),X=Pe("a",e[0].dataType,y,C),oe=Pe("b",e[1].dataType,x,C),me=Ze("result",e[0].dataType,S.length,C),ae=[X,oe];if(K){let fe=o?C:1;ae.push(Pe("bias",e[2].dataType,e[2].dims.length,fe))}let V=[{name:"dim_a_outer",type:"i32"},{name:"dim_b_outer",type:"i32"},{name:"dim_inner",type:"i32"}];Ln(r,V);let F=mr(me.type.tensor),W=On(r,me.type.value,F),re=X_(C,K,W,[H,X,oe,me],o);return` + ${j.registerUniforms(V).registerInternalVariables(H).declareVariables(...ae,me)} + ${re} + ${v?Nu($,w,Z,H):Vu($,w,Z,H)} + `};return{name:"MatMul",shaderCache:{hint:`${$};${r.activation};${v};${o}`,inputDependencies:B},getRunData:()=>({outputs:[{dims:n?n(t):t,dataType:e[0].dataType}],dispatchGroup:{x:g[0],y:g[1],z:g[2]},programUniforms:A}),getShaderSource:G}}}),Q_,my,fx=Re(()=>{ut(),Os(),_t(),Bn(),hd(),mx(),_d(),Q_=(e,r,t,s,o=!1,n,i=4,a=4,l=4,u="f32")=>{let p=A=>{switch(A){case 1:return"resData = x[xIndex];";case 3:return`resData = vec3<${u}>(x[xIndex], x[xIndex + 1], x[xIndex + 2]);`;case 4:return"resData = x[xIndex / 4];";default:throw new Error(`innerElementSize ${A} is not supported.`)}},d=A=>{switch(A){case 1:return"return w[row * i32(uniforms.w_shape[3]) + colIn];";case 4:return"return w[row * i32(uniforms.w_shape[3]) / 4 + colIn];";default:throw new Error(`innerElementSize ${A} is not supported.`)}},c=e?` + let coord = vec4(batch, xRow, xCol, xCh); + `:` + let coord = vec4(batch, xCh, xRow, xCol); + `,_=e?` + let coords = vec4( + batch, + row / outWidth, + row % outWidth, + col); + `:` + let coords = vec4( + batch, + row, + col / outWidth, + col % outWidth); + `,f=e?"i32(uniforms.x_shape[1])":"i32(uniforms.x_shape[2])",v=e?"i32(uniforms.x_shape[2])":"i32(uniforms.x_shape[3])",$=e?"row":"col",w=e?"col":"row",g=` + let inChannels = i32(uniforms.w_shape[2]); + let outWidth = ${e?"i32(uniforms.result_shape[2])":"i32(uniforms.result_shape[3])"}; + let outRow = ${$} / outWidth; + let outCol = ${$} % outWidth; + + let WRow = ${w} / (i32(uniforms.w_shape[1]) * inChannels); + let WCol = ${w} / inChannels % i32(uniforms.w_shape[1]); + let xRow = outRow * uniforms.stride[0] + uniforms.dilation[0] * WRow - uniforms.pad[0]; + let xCol = outCol * uniforms.stride[1] + uniforms.dilation[1] * WCol - uniforms.pad[1]; + let xCh = ${w} % inChannels; + var resData = ${br(i,u)}(0.0); + // The bounds checking is always needed since we use it to pad zero for + // the 'same' padding type. + if (xRow >= 0 && xRow < ${f} && xCol >= 0 && xCol < ${v}) { + ${c} + let xIndex = getIndexFromCoords4D(coord, vec4(uniforms.x_shape)); + ${p(i)} + } + return resData;`,C=e?r&&s?` + let col = colIn * ${i}; + ${g}`:` + let col = colIn * ${i}; + if (row < uniforms.dim_a_outer && col < uniforms.dim_inner) { + ${g} + } + return ${br(i,u)}(0.0);`:s&&t?` + let col = colIn * ${i}; + ${g}`:` + let col = colIn * ${i}; + if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) { + ${g} + } + return ${br(i,u)}(0.0);`,E=e?s&&t?d(a):` + let col = colIn * ${a}; + if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) { + ${d(a)} + } + return ${br(a,u)}(0.0);`:` + let col = colIn * ${a}; + if (row < uniforms.dim_inner && col < uniforms.dim_a_outer) { + ${d(a)} + } + return ${br(a,u)}(0.0);`,y=br(l,u),b=br(e?i:a,u),x=br(e?a:i,u),S=On(n,y,u);return` + fn mm_readA(batch: i32, row : i32, colIn : i32) -> ${b} { + ${e?C:E} + } + + fn mm_readB(batch: i32, row : i32, colIn : i32) -> ${x} { + ${e?E:C} + } + + fn mm_write(batch: i32, row : i32, colIn : i32, valueIn : ${y}) { + let col = colIn * ${l}; + if (row < uniforms.dim_a_outer && col < uniforms.dim_b_outer) + { + var value = valueIn; + let outWidth = ${e?"i32(uniforms.result_shape[2])":"i32(uniforms.result_shape[3])"}; + ${_} + ${py(o)} + ${S} + setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value); + } + }`},my=(e,r,t,s,o,n,i,a,l)=>{let u=r.format==="NHWC",p=u?e[0].dims[3]:e[0].dims[1],d=t[0],c=u?t[2]:t[3],_=u?t[1]:t[2],f=u?t[3]:t[1],v=u&&(p%4===0||p%3===0)&&f%4===0,$=u?f:c*_,w=u?c*_:f,g=[8,8,1],C=s<=8?[4,1,1]:[4,4,1],E=[Math.ceil($/g[0]/C[0]),Math.ceil(w/g[1]/C[1]),Math.ceil(d/g[2]/C[2])];Tt("verbose",()=>`[conv2d_mm_webgpu] dispatch = ${E}`);let y=v?u&&p%4!==0?3:4:1,b=g[1]*C[1],x=g[0]*C[0],S=Math.max(g[0]*y,g[1]),A=s%b===0,B=o%x===0,K=n%S===0,G=v?[y,4,4]:[1,1,1],j=[{type:6,data:s},{type:6,data:o},{type:6,data:n},{type:6,data:[r.pads[0],r.pads[1]]},{type:6,data:r.strides},{type:6,data:r.dilations}];Dn(r,j),j.push(...st(e[0].dims,e[1].dims));let ee=["rank","rank"];i&&(j.push(...st(e[2].dims)),ee.push("rank")),j.push(...st(t));let H=Z=>{let X=[{name:"dim_a_outer",type:"i32"},{name:"dim_b_outer",type:"i32"},{name:"dim_inner",type:"i32"},{name:"pad",type:"i32",length:2},{name:"stride",type:"i32",length:2},{name:"dilation",type:"i32",length:2}];Ln(r,X);let oe=v?4:1,me=mr(e[0].dataType),ae=` + fn setOutputAtIndex(flatIndex : i32, value : ${v?`vec4<${me}>`:me}) { + result[flatIndex] = ${v?`vec4<${me}>`:me}(value); + } + fn setOutputAtCoords(d0 : i32, d1 : i32, d2 : i32, d3 : i32, value : ${v?`vec4<${me}>`:me}) { + let flatIndex = getOutputIndexFromCoords(vec4(d0, d1, d2, d3)); + setOutputAtIndex(flatIndex ${v?"/ 4":""}, value); + }`,V=Pe("x",e[0].dataType,e[0].dims.length,y===3?1:y),F=Pe("w",e[1].dataType,e[1].dims.length,oe),W=[V,F],re=Ze("result",e[0].dataType,t.length,oe);if(i){let fe=Pe("bias",e[2].dataType,e[2].dims.length,oe);W.push(fe),ae+=` + fn getBiasByOutputCoords(coords : vec4) -> ${v?`vec4<${me}>`:me} { + return bias[coords.${u?"w":"y"}${v?"/ 4":""}]; + }`}return` + ${hy("uniforms.result_strides")} + //struct Uniforms { xShape : vec4, wShape : vec4, outShape : vec4, + // outShapeStrides: vec3, filterDims : vec2, pad : vec2, stride : vec2, + // dilation : vec2, dimAOuter : i32, dimBOuter : i32, dimInner : i32 }; + ${Z.registerUniforms(X).declareVariables(...W,re)} + ${ae} + ${Q_(u,A,B,K,i,r,G[0],G[1],G[2],me)} + ${v?Nu(C,g,me,void 0,!u,S):Vu(C,g,me,void 0,!u,S,!1,void 0,a)}`};return{name:"Conv2DMatMul",shaderCache:{hint:`${r.cacheKey};${y};${v};${A};${B};${K};${b};${x};${S}`,inputDependencies:ee},getRunData:()=>({outputs:[{dims:l?l(t):t,dataType:e[0].dataType}],dispatchGroup:{x:E[0],y:E[1],z:E[2]},programUniforms:j}),getShaderSource:H}}}),J_,tu,jo,Y_,ru,Z_,fy,_y,_x=Re(()=>{ut(),Os(),ft(),_t(),Bn(),hd(),J_=e=>{let r=1;for(let t=0;ttypeof e=="number"?[e,e,e]:e,jo=(e,r)=>r<=1?e:e+(e-1)*(r-1),Y_=(e,r,t,s=1)=>{let o=jo(r,s);return Math.floor((e[0]*(t-1)-t+o)/2)},ru=(e,r,t,s,o)=>{o==null&&(o=Y_(e,r[0],s[0]));let n=[0,0,0,t];for(let i=0;i<3;i++)e[i]+2*o>=r[i]&&(n[i]=Math.trunc((e[i]-r[i]+2*o)/s[i]+1));return n},Z_=(e,r,t,s,o,n,i,a,l,u)=>{let p,d,c,_;if(e==="VALID"&&(e=0),typeof e=="number"){p={top:e,bottom:e,left:e,right:e,front:e,back:e};let f=ru([r,t,s,1],[a,l,u],1,[o,n,i],e);d=f[0],c=f[1],_=f[2]}else if(Array.isArray(e)){if(!e.every((v,$,w)=>v===w[0]))throw Error(`Unsupported padding parameter: ${e}`);p={top:e[0],bottom:e[1],left:e[2],right:e[3],front:e[4],back:e[5]};let f=ru([r,t,s,1],[a,l,u],1,[o,n,i],e[0]);d=f[0],c=f[1],_=f[2]}else if(e==="SAME_UPPER"){d=Math.ceil(r/o),c=Math.ceil(t/n),_=Math.ceil(s/i);let f=(d-1)*o+a-r,v=(c-1)*n+l-t,$=(_-1)*i+u-s,w=Math.floor(f/2),g=f-w,C=Math.floor(v/2),E=v-C,y=Math.floor($/2),b=$-y;p={top:C,bottom:E,left:y,right:b,front:w,back:g}}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:p,outDepth:d,outHeight:c,outWidth:_}},fy=(e,r,t,s,o,n=!1,i="channelsLast")=>{let a,l,u,p,d;if(i==="channelsLast")[a,l,u,p,d]=e;else if(i==="channelsFirst")[a,d,l,u,p]=e;else throw new Error(`Unknown dataFormat ${i}`);let[c,,_,f,v]=r,[$,w,g]=tu(t),[C,E,y]=tu(s),b=jo(_,C),x=jo(f,E),S=jo(v,y),{padInfo:A,outDepth:B,outHeight:K,outWidth:G}=Z_(o,l,u,p,$,w,g,b,x,S),j=n?c*d:c,ee=[0,0,0,0,0];return i==="channelsFirst"?ee=[a,j,B,K,G]:i==="channelsLast"&&(ee=[a,B,K,G,j]),{batchSize:a,dataFormat:i,inDepth:l,inHeight:u,inWidth:p,inChannels:d,outDepth:B,outHeight:K,outWidth:G,outChannels:j,padInfo:A,strideDepth:$,strideHeight:w,strideWidth:g,filterDepth:_,filterHeight:f,filterWidth:v,effectiveFilterDepth:b,effectiveFilterHeight:x,effectiveFilterWidth:S,dilationDepth:C,dilationHeight:E,dilationWidth:y,inShape:e,outShape:ee,filterShape:r}},_y=(e,r,t,s,o,n)=>{let i=n==="channelsLast";i?e[0].dims[3]:e[0].dims[1];let a=[64,1,1],l={x:t.map(($,w)=>w)},u=[Math.ceil(J_(l.x.map($=>t[$]))/a[0]),1,1];Tt("verbose",()=>`[conv3d_naive_webgpu] dispatch = ${u}`);let p=1,d=be.size(t),c=[{type:12,data:d},{type:12,data:s},{type:12,data:o},{type:12,data:r.strides},{type:12,data:r.dilations}];Dn(r,c),c.push(...st(e[0].dims,e[1].dims));let _=["rank","rank"],f=e.length===3;f&&(c.push(...st(e[2].dims)),_.push("rank")),c.push(...st(t));let v=$=>{let w=[{name:"output_size",type:"u32"},{name:"filter_dims",type:"u32",length:s.length},{name:"pads",type:"u32",length:o.length},{name:"strides",type:"u32",length:r.strides.length},{name:"dilations",type:"u32",length:r.dilations.length}];Ln(r,w);let g=1,C=mr(e[0].dataType),E=Pe("x",e[0].dataType,e[0].dims.length,p),y=Pe("W",e[1].dataType,e[1].dims.length,g),b=[E,y],x=Ze("result",e[0].dataType,t.length,g),S="";if(f){let K=Pe("bias",e[2].dataType,e[2].dims.length,g);b.push(K),S+=` + fn getBiasByOutputCoords(coords : array) -> ${C} { + return bias[${i?rt("coords",4,5):rt("coords",1,5)}]; + }`}let A=br(p,C),B=On(r,A,C);return` + ${S} + fn getX(d0 : u32, d1 : u32, d2 : u32, d3 : u32, d4 : u32) -> f32 { + let aIndices = array(d0, d1, d2, d3, d4); + return ${E.getByIndices("aIndices")}; + } + fn getW(d0 : u32, d1 : u32, d2 : u32, d3 : u32, d4 : u32) -> f32 { + let aIndices = array(d0, d1, d2, d3, d4); + return ${y.getByIndices("aIndices")}; + } + ${$.registerUniforms(w).declareVariables(...b,x)} + ${$.mainStart()} + ${$.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let coords = ${x.offsetToIndices("global_idx")}; + let batch = ${rt("coords",0,E.rank)}; + let d2 = ${i?rt("coords",E.rank-1,E.rank):rt("coords",1,E.rank)}; + let xFRCCorner = vec3(${i?rt("coords",1,E.rank):rt("coords",2,E.rank)}, + ${i?rt("coords",2,E.rank):rt("coords",3,E.rank)}, + ${i?rt("coords",3,E.rank):rt("coords",4,E.rank)}) * uniforms.strides - uniforms.pads; + let xFCorner = xFRCCorner.x; + let xRCorner = xFRCCorner.y; + let xCCorner = xFRCCorner.z; + let xShapeY = ${i?rt("uniforms.x_shape",1,E.rank):rt("uniforms.x_shape",2,E.rank)}; + let xShapeZ = ${i?rt("uniforms.x_shape",2,E.rank):rt("uniforms.x_shape",3,E.rank)}; + let xShapeW = ${i?rt("uniforms.x_shape",3,E.rank):rt("uniforms.x_shape",4,E.rank)}; + let xShapeU = ${i?rt("uniforms.x_shape",4,E.rank):rt("uniforms.x_shape",1,E.rank)}; + let inputDepthNearestVec4 = (xShapeU / 4) * 4; + let inputDepthVec4Remainder = xShapeU % 4; + + var value = 0.0; + for (var wF = 0u; wF < uniforms.filter_dims[0]; wF++) { + let xF = xFCorner + wF * uniforms.dilations[0]; + if (xF < 0 || xF >= xShapeY) { + continue; + } + + for (var wR = 0u; wR < uniforms.filter_dims[1]; wR++) { + let xR = xRCorner + wR * uniforms.dilations[1]; + if (xR < 0 || xR >= xShapeZ) { + continue; + } + + for (var wC = 0u; wC < uniforms.filter_dims[2]; wC++) { + let xC = xCCorner + wC * uniforms.dilations[2]; + if (xC < 0 || xC >= xShapeW) { + continue; + } + + for (var d1 = 0u; d1 < inputDepthNearestVec4; d1 += 4) { + ${i?`let xValues = vec4( + getX(batch, xF, xR, xC, d1), + getX(batch, xF, xR, xC, d1 + 1), + getX(batch, xF, xR, xC, d1 + 2), + getX(batch, xF, xR, xC, d1 + 3)); + `:`let xValues = vec4( + getX(batch, d1, xF, xR, xC), + getX(batch, d1 + 1, xF, xR, xC), + getX(batch, d1 + 2, xF, xR, xC), + getX(batch, d1 + 3, xF, xR, xC)); + `} + let wValues = vec4( + getW(d2, d1, wF, wR, wC), + getW(d2, d1 + 1, wF, wR, wC), + getW(d2, d1 + 2, wF, wR, wC), + getW(d2, d1 + 3, wF, wR, wC)); + value += dot(xValues, wValues); + } + if (inputDepthVec4Remainder == 1) { + ${i?`value += getX(batch, xF, xR, xC, inputDepthNearestVec4) + * getW(d2, inputDepthNearestVec4, wF, wR, wC);`:`value += getX(batch, inputDepthNearestVec4, xF, xR, xC) + * getW(d2, inputDepthNearestVec4, wF, wR, wC);`} + } else if (inputDepthVec4Remainder == 2) { + ${i?`let xValues = vec2( + getX(batch, xF, xR, xC, inputDepthNearestVec4), + getX(batch, xF, xR, xC, inputDepthNearestVec4 + 1)); + `:`let xValues = vec2( + getX(batch, inputDepthNearestVec4, xF, xR, xC), + getX(batch, inputDepthNearestVec4 + 1, xF, xR, xC)); + `} + let wValues = vec2( + getW(d2, inputDepthNearestVec4, wF, wR, wC), + getW(d2, inputDepthNearestVec4 + 1, wF, wR, wC)); + value += dot(xValues, wValues); + } else if (inputDepthVec4Remainder == 3) { + ${i?`let xValues = vec3( + getX(batch, xF, xR, xC, inputDepthNearestVec4), + getX(batch, xF, xR, xC, inputDepthNearestVec4 + 1), + getX(batch, xF, xR, xC, inputDepthNearestVec4 + 2)); + `:`let xValues = vec3( + getX(batch, inputDepthNearestVec4, xF, xR, xC), + getX(batch, inputDepthNearestVec4 + 1, xF, xR, xC), + getX(batch, inputDepthNearestVec4 + 2, xF, xR, xC)); + `} + let wValues = vec3( + getW(d2, inputDepthNearestVec4, wF, wR, wC), + getW(d2, inputDepthNearestVec4 + 1, wF, wR, wC), + getW(d2, inputDepthNearestVec4 + 2, wF, wR, wC)); + value += dot(xValues, wValues); + } + } + } + } + ${f?"value = value + getBiasByOutputCoords(coords)":""}; + ${B} + result[global_idx] = f32(value); + }`};return{name:"Conv3DNaive",shaderCache:{hint:`${r.cacheKey};${i};${p};${f}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:t,dataType:e[0].dataType}],dispatchGroup:{x:u[0],y:u[1],z:u[2]},programUniforms:c}),getShaderSource:v}}}),gy,wy,gx=Re(()=>{ut(),ft(),_t(),Bn(),gy=(e,r,t,s)=>{let o=e.length>2,n=o?"value += b[output_channel];":"",i=e[0].dims,a=e[1].dims,l=r.format==="NHWC",u=l?t[3]:t[1],p=u/r.group,d=l&&p>=4?qt(u):1,c=be.size(t)/d,_=[{type:12,data:c},{type:12,data:r.dilations},{type:12,data:[r.strides[0],r.strides[1]]},{type:12,data:[r.pads[0],r.pads[1]]},{type:12,data:p}];Dn(r,_),_.push(...st(i,[a[0],a[1],a[2],a[3]/d]));let f=o?["rank","rank","rank"]:["rank","rank"];_.push(...st([t[0],t[1],t[2],t[3]/d]));let v=$=>{let w=Ze("output",e[0].dataType,t.length,d),g=mr(w.type.tensor),C=On(r,w.type.value,g),E=Pe("x",e[0].dataType,i.length),y=Pe("w",e[1].dataType,a.length,d),b=[E,y];o&&b.push(Pe("b",e[2].dataType,e[2].dims,d));let x=[{name:"output_size",type:"u32"},{name:"dilations",type:"u32",length:r.dilations.length},{name:"strides",type:"u32",length:2},{name:"pads",type:"u32",length:2},{name:"output_channels_per_group",type:"u32"}];Ln(r,x);let S=l?` + for (var wHeight: u32 = 0u; wHeight < uniforms.w_shape[0]; wHeight++) { + let xHeight = xRCCorner.x + wHeight * uniforms.dilations[0]; + + if (xHeight < 0u || xHeight >= uniforms.x_shape[1]) { + continue; + } + + for (var wWidth: u32 = 0u; wWidth < uniforms.w_shape[1]; wWidth++) { + let xWidth = xRCCorner.y + wWidth * uniforms.dilations[1]; + if (xWidth < 0u || xWidth >= uniforms.x_shape[2]) { + continue; + } + + for (var wInChannel: u32 = 0u; wInChannel < uniforms.w_shape[2]; wInChannel++) { + let input_channel = in_channel_offset + wInChannel; + let xVal = ${E.get("batch","xHeight","xWidth","input_channel")}; + let wVal = ${y.get("wHeight","wWidth","wInChannel","output_channel")}; + value += xVal * wVal; + } + } + } + `:` + for (var wInChannel: u32 = 0u; wInChannel < uniforms.w_shape[1]; wInChannel++) { + let input_channel = in_channel_offset + wInChannel; + for (var wHeight: u32 = 0u; wHeight < uniforms.w_shape[2]; wHeight++) { + let xHeight = xRCCorner.x + wHeight * uniforms.dilations[0]; + + if (xHeight < 0u || xHeight >= uniforms.x_shape[2]) { + continue; + } + + for (var wWidth: u32 = 0u; wWidth < uniforms.w_shape[3]; wWidth++) { + let xWidth = xRCCorner.y + wWidth * uniforms.dilations[1]; + if (xWidth < 0u || xWidth >= uniforms.x_shape[3]) { + continue; + } + + let xVal = ${E.get("batch","input_channel","xHeight","xWidth")}; + let wVal = ${y.get("output_channel","wInChannel","wHeight","wWidth")}; + value += xVal * wVal; + } + } + } + `;return` + ${$.registerUniforms(x).declareVariables(...b,w)} + + ${$.mainStart()} + ${$.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let outputIndices = ${w.offsetToIndices("global_idx")}; + let batch: u32 = outputIndices[0]; + let output_channel: u32 = outputIndices[${l?3:1}]; + let xRCCorner: vec2 = vec2(outputIndices[${l?1:2}], outputIndices[${l?2:3}]) * uniforms.strides - uniforms.pads; + let group_id: u32 = output_channel * ${d} / uniforms.output_channels_per_group; + var in_channel_offset = group_id * uniforms.w_shape[${l?2:1}]; + + var value: ${w.type.value} = ${w.type.value}(0); + ${S} + ${n} + ${C} + ${w.setByOffset("global_idx","value")} + }`};return{name:"GroupedConv",shaderCache:{hint:`${r.cacheKey}_${d}`,inputDependencies:f},getRunData:()=>({outputs:[{dims:s?s(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:_}),getShaderSource:v}},wy=(e,r,t,s)=>{let o=e.length>2,n=qt(t[3]),i=qt(t[2]),a=be.size(t)/n/i,l=[e[0].dims[0],e[0].dims[1],e[0].dims[2],e[0].dims[3]/n],u=[e[1].dims[0],e[1].dims[1],e[1].dims[2],e[1].dims[3]/n],p=[t[0],t[1],t[2],t[3]/n],d=[{type:12,data:a},{type:6,data:[r.strides[0],r.strides[1]]},{type:6,data:[r.pads[0],r.pads[1]]}];Dn(r,d),d.push(...st(l,u,p));let c=(i-1)*r.strides[1]+u[1],_=f=>{let v=Ze("output",e[0].dataType,p.length,n),$=mr(v.type.tensor),w=On(r,v.type.value,$),g=Pe("x",e[0].dataType,l.length,n),C=Pe("w",e[1].dataType,u.length,n),E=[g,C];o&&E.push(Pe("b",e[2].dataType,e[2].dims,n));let y=o?"value += b[output_channel];":"",b=[{name:"output_size",type:"u32"},{name:"strides",type:"i32",length:2},{name:"pads",type:"i32",length:2}];return Ln(r,b),` + ${f.registerUniforms(b).declareVariables(...E,v)} + ${f.mainStart()} + ${f.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let width0 = uniforms.output_shape[3]; + let output_channel = global_idx % width0; + var index1 = global_idx / width0; + let width1 = uniforms.output_shape[2] / ${i}u; + let col = (index1 % width1) * ${i}u; + index1 = index1 / width1; + let row = index1 % uniforms.output_shape[1]; + let batch = index1 / uniforms.output_shape[1]; + + let x_corner = vec2(i32(row), i32(col)) * uniforms.strides - uniforms.pads; + + var x_vals: array<${g.type.value}, ${c}>; + var values: array<${v.type.value}, ${i}>; + let input_channel = output_channel; + // Use constant instead of uniform can give better performance for w's height/width. + for (var w_height: u32 = 0u; w_height < ${u[0]}; w_height++) { + let x_height = x_corner.x + i32(w_height); + if (x_height >= 0 && u32(x_height) < uniforms.x_shape[1]) { + for (var i = 0; i < ${c}; i++) { + let x_width = x_corner.y + i; + if (x_width >= 0 && u32(x_width) < uniforms.x_shape[2]) { + x_vals[i] = ${g.get("batch","u32(x_height)","u32(x_width)","input_channel")}; + } else { + x_vals[i] = ${g.type.value}(0); + } + } + for (var w_width: u32 = 0u; w_width < ${u[1]}; w_width++) { + let w_val = ${C.get("w_height","w_width","0","output_channel")}; + for (var i = 0u; i < ${i}u; i++) { + values[i] = fma(x_vals[i * u32(uniforms.strides[1]) + w_width], w_val, values[i]); + } + } + } + } + + for (var i = 0u; i < ${i}u; i++) { + var value = values[i]; + ${y} + ${w} + ${v.set("batch","row","col + i","output_channel","value")}; + } + }`};return{name:"GroupedConv-Vectorize",shaderCache:{hint:`${r.cacheKey};${n};${i};${c};${u[0]};${u[1]}`,inputDependencies:o?["rank","rank","type"]:["rank","rank"]},getRunData:()=>({outputs:[{dims:s?s(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(a/64)},programUniforms:d}),getShaderSource:_}}}),eg,ra,tg,sa,Uu,su,rg,sg,Wu,wx=Re(()=>{ft(),fx(),_x(),_d(),gx(),Bn(),fd(),Js(),eg=(e,r,t,s,o,n)=>{let i=e[0],a=e.slice(n?1:2,n?3:4),l=a.length,u=r[0],p=r.slice(2).map((c,_)=>c+(c-1)*(t[_]-1)),d=a.map((c,_)=>c+s[_]+s[_+l]).map((c,_)=>Math.floor((c-p[_]+o[_])/o[_]));return d.splice(0,0,i),d.splice(n?3:1,0,u),d},ra=[2,3,1,0],tg=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length>5)throw new Error("greater than 5D is not supported");if(e[0].dims.length!==e[1].dims.length)throw new Error("filter does not have same dimension as input");let t=e[0].dims[r.format==="NHWC"?e[0].dims.length-1:1],s=e[1].dims[1]*r.group;if(t!==s)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(e.length===3&&(e[2].dims.length!==1||e[1].dims[0]!==e[2].dims[0]))throw new Error("invalid bias");let o=e[0].dims.length-2;if(r.dilations.length!==o)throw new Error(`dilations should be ${o}D`);if(r.strides.length!==o)throw new Error(`strides should be ${o}D`);if(r.pads.length!==o*2)throw new Error(`pads should be ${o*2}D`);if(r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape")},sa=(e,r)=>{let t=e.kernelShape.slice();t.length{let r=pd(e),t=e.format,s=["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][e.auto_pad],o=e.dilations,n=e.group,i=e.kernel_shape,a=e.pads,l=e.strides,u=e.w_is_const();return{autoPad:s,format:t,dilations:o,group:n,kernelShape:i,pads:a,strides:l,wIsConst:u,...r,cacheKey:`${e.format};${r.activation};`}},su=(e,r,t,s)=>{let o=t.format==="NHWC",n=eg(r[0].dims,r[1].dims,t.dilations,t.pads,t.strides,o);if(t.group!==1){let b=[r[0]];if(o){let x=e.kernelCustomData.wT??e.compute(Vr(r[1],ra),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=x),b.push(x)}else b.push(r[1]);r.length===3&&b.push(r[2]),!e.adapterInfo.isArchitecture("ampere")&&o&&r[1].dims[0]===t.group&&r[1].dims[1]===1&&t.dilations[0]===1&&t.dilations[1]===1?e.compute(wy(b,t,n,s),{inputs:b}):e.compute(gy(b,t,n,s),{inputs:b});return}let i=r.length===3,a=r[0].dims[o?1:2],l=r[0].dims[o?2:3],u=r[0].dims[o?3:1],p=r[1].dims[2],d=r[1].dims[3],c=n[o?1:2],_=n[o?2:3],f=n[o?3:1],v=o&&p===a&&d===l&&t.pads[0]===0&&t.pads[1]===0;if(v||p===1&&d===1&&t.dilations[0]===1&&t.dilations[1]===1&&t.strides[0]===1&&t.strides[1]===1&&t.pads[0]===0&&t.pads[1]===0){let b=n[0],x,S,A,B=[];if(o){let j=e.kernelCustomData.wT??e.compute(Vr(r[1],ra),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];if(t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=j),v){let ee=a*l*u;x=r[0].reshape([1,b,ee]),S=j.reshape([1,ee,f]),A=[1,b,f]}else x=r[0].reshape([b,a*l,u]),S=j.reshape([1,u,f]),A=[b,c*_,f];B.push(x),B.push(S)}else x=r[0].reshape([b,u,a*l]),S=r[1].reshape([1,f,u]),A=[b,f,c*_],B.push(S),B.push(x);i&&B.push(r[2]);let K=A[2],G=B[0].dims[B[0].dims.length-1];K<8&&G<8?e.compute(md(B,t,n,A,o,s),{inputs:B}):e.compute(_a(B,t,n,A,o,s),{inputs:B});return}let $=!0,w=e.kernelCustomData.wT??e.compute(Vr(r[1],ra),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=w);let g=[r[0],w];i&&g.push(r[2]);let C=o?c*_:f,E=o?f:c*_,y=p*d*u;e.compute(my(g,t,n,C,E,y,i,$,s),{inputs:g})},rg=(e,r)=>{let t=r.format==="NHWC",s=[e.inputs[0].reshape(t?[e.inputs[0].dims[0],1,e.inputs[0].dims[1],e.inputs[0].dims[2]]:[e.inputs[0].dims[0],e.inputs[0].dims[1],1,e.inputs[0].dims[2]]),e.inputs[1].reshape([e.inputs[1].dims[0],e.inputs[1].dims[1],1,e.inputs[1].dims[2]])];e.inputs.length===3&&s.push(e.inputs[2]);let o=[0,r.pads[0],0,r.pads[1]],n=[1].concat(r.strides),i=[1].concat(r.dilations),a=[1].concat(r.kernelShape),l=sa({...r,pads:o,strides:n,dilations:i,kernelShape:a},s);su(e,s,l,u=>t?[u[0],u[2],u[3]]:[u[0],u[1],u[3]])},sg=(e,r,t)=>{let s=t.format==="NHWC"?"channelsLast":"channelsFirst",o=sa(t,r),n=t.autoPad==="NOTSET"?t.pads:t.autoPad,i=fy(r[0].dims,r[1].dims,t.strides,t.dilations,n,!1,s);e.compute(_y(r,o,i.outShape,[i.filterDepth,i.filterHeight,i.filterWidth],[i.padInfo.front,i.padInfo.top,i.padInfo.left],s))},Wu=(e,r)=>{if(tg(e.inputs,r),e.inputs[0].dims.length===3)rg(e,r);else if(e.inputs[0].dims.length===5)sg(e,e.inputs,r);else{let t=sa(r,e.inputs);su(e,e.inputs,t)}}}),by,bx=Re(()=>{ut(),Os(),ft(),_t(),by=(e,r,t)=>{let s=e.length>2,o=r.outputShape,n=r.format==="NHWC",i=r.group,a=e[1].dims,l=a[2]/i,u=a[3],p=n?qt(l):1,d=n&&u===1&&l>=4,c=d?Math.floor(l/4)*4:Math.floor(l/p)*p,_=l-c,f=n?qt(u):1,v=n?u===1?p:f:1,$=be.size(o)/f,w=[Math.ceil($/64),1,1];Tt("verbose",()=>`[conv2d_backprop_webgpu] dispatch = ${w}`);let g=["rank","rank"],C=[r.strides[0],r.strides[1]],E=[r.kernelShape[n?1:2],r.kernelShape[n?2:3]],y=[r.dilations[0],r.dilations[1]],b=[E[0]+(r.dilations[0]<=1?0:(r.kernelShape[n?1:2]-1)*(r.dilations[0]-1)),E[1]+(r.dilations[1]<=1?0:(r.kernelShape[n?2:3]-1)*(r.dilations[1]-1))],x=[b[0]-1-Math.floor((r.pads[0]+r.pads[2])/2),b[1]-1-Math.floor((r.pads[1]+r.pads[3])/2)],S=[{type:12,data:$},{type:12,data:C},{type:12,data:E},{type:12,data:y},{type:12,data:b},{type:6,data:x},{type:12,data:c},{type:12,data:l},{type:12,data:u},...st(e[0].dims,e[1].dims)];s&&(S.push(...st(e[2].dims)),g.push("rank")),S.push(...st(o));let A=B=>{let K=[{name:"output_size",type:"u32"},{name:"strides",type:"u32",length:C.length},{name:"filter_dims",type:"u32",length:E.length},{name:"dilations",type:"u32",length:E.length},{name:"effective_filter_dims",type:"u32",length:b.length},{name:"pads",type:"i32",length:x.length},{name:"input_channels_per_group_int",type:"u32"},{name:"input_channels_per_group",type:"u32"},{name:"output_channels_per_group",type:"u32"}],G=mr(e[0].dataType),j=n?1:2,ee=n?2:3,H=n?3:1,Z=Pe("W",e[1].dataType,e[1].dims.length,v),X=Pe("Dy",e[0].dataType,e[0].dims.length,p),oe=[X,Z];s&&oe.push(Pe("bias",e[2].dataType,[o[H]].length,f));let me=Ze("result",e[0].dataType,o.length,f),ae=()=>{let W="";if(d)p===4?W+=` + let xValue = ${X.getByOffset("x_offset")}; + let wValue = ${Z.getByOffset("w_offset")}; + dotProd = dotProd + dot(xValue, wValue); + x_offset += 1u; + w_offset += 1u;`:p===2?W+=` + dotProd = dotProd + dot(vec4<${G}>(${X.getByOffset("x_offset")}, ${X.getByOffset("x_offset + 1u")}), vec4<${G}>(${Z.getByOffset("w_offset")}, ${Z.getByOffset("w_offset + 1u")})); + x_offset += 2u; + w_offset += 2u;`:p===1&&(W+=` + dotProd = dotProd + dot(vec4<${G}>(${X.getByOffset("x_offset")}, ${X.getByOffset("x_offset + 1u")}, ${X.getByOffset("x_offset + 2u")}, ${X.getByOffset("x_offset + 3u")}), vec4<${G}>(${Z.getByOffset("w_offset")}, ${Z.getByOffset("w_offset + 1u")}, ${Z.getByOffset("w_offset + 2u")}, ${Z.getByOffset("w_offset + 3u")})); + x_offset += 4u; + w_offset += 4u;`);else if(W+=` + let xValue = ${n?X.getByOffset(`${X.indicesToOffset(`${X.type.indices}(batch, idyR, idyC, inputChannel)`)} / ${p}`):X.get("batch","inputChannel","idyR","idyC")}; + `,p===1)W+=` + let w_offset = ${Z.indicesToOffset(`${Z.type.indices}(u32(wRPerm), u32(wCPerm), inputChannel, wOutChannel)`)}; + let wValue = ${Z.getByOffset(`w_offset / ${v}`)}; + dotProd = dotProd + xValue * wValue;`;else for(let re=0;re{if(_===0)return"";if(!d)throw new Error(`packInputAs4 ${d} is not true.`);let W="";if(p===1){W+="dotProd = dotProd";for(let re=0;re<_;re++)W+=` + + ${X.getByOffset(`x_offset + ${re}`)} * ${Z.getByOffset(`w_offset + ${re}`)}`;W+=";"}else if(p===2){if(_!==2)throw new Error(`Invalid inputChannelsRemainder ${_}.`);W+=` + let xValue = ${X.getByOffset("x_offset")}; + let wValue = ${Z.getByOffset("w_offset")}; + dotProd = dotProd + dot(xValue, wValue);`}return W},F=` + let outputIndices = ${me.offsetToIndices(`global_idx * ${f}`)}; + let batch = ${me.indicesGet("outputIndices",0)}; + let d1 = ${me.indicesGet("outputIndices",H)}; + let r = ${me.indicesGet("outputIndices",j)}; + let c = ${me.indicesGet("outputIndices",ee)}; + let dyCorner = vec2(i32(r), i32(c)) - uniforms.pads; + let dyRCorner = dyCorner.x; + let dyCCorner = dyCorner.y; + let groupId = d1 / uniforms.output_channels_per_group; + let wOutChannel = d1 - groupId * uniforms.output_channels_per_group; + // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1). + // ? = to be determined. : = across all values in that axis. + var dotProd = ${me.type.value}(0.0); + var wR: u32 = 0; + if (uniforms.dilations.x == 1) { + // Minimum wR >= 0 that satisfies (dyRCorner + wR) % (uniforms.strides.x) == 0 + wR = u32(((dyRCorner + i32(uniforms.strides.x) - 1) / i32(uniforms.strides.x)) * i32(uniforms.strides.x) - dyRCorner); + } + for (; wR < uniforms.effective_filter_dims.x; wR = wR + 1) { + if (wR % uniforms.dilations.x != 0) { + continue; + } + let dyR = (${G}(dyRCorner) + ${G}(wR)) / ${G}(uniforms.strides[0]); + let wRPerm = uniforms.filter_dims.x - 1 - wR / uniforms.dilations.x; + if (dyR < 0.0 || dyR >= ${G}(uniforms.Dy_shape[${j}]) || fract(dyR) > 0.0 || + wRPerm < 0) { + continue; + } + let idyR: u32 = u32(dyR); + var wC: u32 = 0; + if (uniforms.dilations.y == 1) { + // Minimum wC >= 0 that satisfies (dyCCorner + wC) % (uniforms.strides.y) == 0 + wC = u32(((dyCCorner + i32(uniforms.strides.y) - 1) / i32(uniforms.strides.y)) * i32(uniforms.strides.y) - dyCCorner); + } + for (; wC < uniforms.effective_filter_dims.y; wC = wC + 1) { + if (wC % uniforms.dilations.y != 0) { + continue; + } + let dyC = (${G}(dyCCorner) + ${G}(wC)) / ${G}(uniforms.strides.y); + let wCPerm = uniforms.filter_dims.y - 1 - wC / uniforms.dilations.y; + if (dyC < 0.0 || dyC >= ${G}(uniforms.Dy_shape[${ee}]) || + fract(dyC) > 0.0 || wCPerm < 0) { + continue; + } + let idyC: u32 = u32(dyC); + var inputChannel = groupId * uniforms.input_channels_per_group; + ${d?` + var x_offset = ${X.indicesToOffset(`${X.type.indices}(batch, idyR, idyC, inputChannel)`)} / ${p}; + var w_offset = ${Z.indicesToOffset(`${Z.type.indices}(wRPerm, wCPerm, inputChannel, wOutChannel)`)} / ${v}; + `:""} + for (var d2: u32 = 0; d2 < uniforms.input_channels_per_group_int; d2 = d2 + ${d?4:p}) { + ${ae()} + inputChannel = inputChannel + ${d?4:p}; + } + ${V()} + wC = wC + uniforms.strides.y - 1; + } + wR = wR + uniforms.strides[0] - 1; + } + let value = dotProd${s?` + bias[d1 / ${f}]`:""}; + ${me.setByOffset("global_idx","value")}; + `;return` + ${B.registerUniforms(K).declareVariables(...oe,me)} + ${B.mainStart()} + ${B.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")}; + ${F}}`};return{name:"ConvTranspose2D",shaderCache:{hint:`${r.cacheKey};${p}${v}${f}${d}${_}`,inputDependencies:g},getRunData:()=>({dispatchGroup:{x:w[0],y:w[1],z:w[2]},outputs:[{dims:t?t(o):o,dataType:e[0].dataType}],programUniforms:S}),getShaderSource:A}}}),ng,og,ig,nu,My,ag,ou,lg,yy,Mx=Re(()=>{bx(),Bn(),Js(),ng=(e,r,t,s,o,n)=>(e-1)*r+t+(s-1)*o+1-n,og=(e,r,t,s,o)=>{let n=Math.floor(e/2);r==="SAME_UPPER"?(t[s]=n,t[o]=e-n):r==="SAME_LOWER"&&(t[s]=e-n,t[o]=n)},ig=(e,r,t,s,o,n,i,a,l,u)=>{let p=e.length-2,d=u.length===0;l.length{let t=e.kernelShape.slice();if(e.kernelShape.length===0||e.kernelShape.reduce((d,c)=>d*c,1)===0){t.length=0;for(let d=2;dd+c,0)===0){let d=r[0].dims.length-2;l=new Array(d).fill(1)}let u=e.strides.slice();if(u.reduce((d,c)=>d+c,0)===0){let d=r[0].dims.length-2;u=new Array(d).fill(1)}ig(a,t,l,e.autoPad,e.group,o,u,s,i,n);let p=Object.assign({},e);return Object.assign(p,{kernelShape:t,pads:o,outputPadding:i,outputShape:n,dilations:l,strides:u}),p},My=e=>{let r=pd(e),t=e.format,s=["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][typeof e.autoPad>"u"?0:e.autoPad],o=e.dilations,n=e.group,i=e.kernelShape,a=e.pads,l=e.strides,u=e.wIsConst(),p=e.outputPadding,d=e.outputShape;return{autoPad:s,format:t,dilations:o,group:n,kernelShape:i,outputPadding:p,outputShape:d,pads:a,strides:l,wIsConst:u,...r,cacheKey:`${e.format};${r.activation};`}},ag=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length!==4&&e[0].dims.length!==3)throw new Error("currently only support 2-dimensional conv");if(e[0].dims.length!==e[1].dims.length)throw new Error("filter does not have same dimension as input");let t=e[0].dims[r.format==="NHWC"?e[0].dims.length-1:1],s=e[1].dims[0];if(t!==s)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");let o=e[1].dims[1]*r.group;if(e.length===3&&(e[2].dims.length!==1||e[2].dims[0]!==o))throw new Error("invalid bias");let n=e[0].dims.length-2;if(r.dilations.reduce((i,a)=>i+a,0)>0&&r.dilations.length!==n)throw new Error(`dilations should be ${n}D`);if(r.strides.reduce((i,a)=>i+a,0)>0&&r.strides.length!==n)throw new Error(`strides should be ${n}D`);if(r.pads.reduce((i,a)=>i+a,0)>0&&r.pads.length!==n*2)throw new Error(`pads should be ${n*2}D`);if(r.outputPadding.length!==n&&r.outputPadding.length!==0)throw new Error(`output_padding should be ${n}D`);if(r.kernelShape.reduce((i,a)=>i+a,0)>0&&r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape");if(r.outputShape.length!==0&&r.outputShape.length!==e[0].dims.length-2)throw new Error("invalid output shape")},ou=(e,r,t,s)=>{let o=e.kernelCustomData.wT??e.compute(Vr(r[1],[2,3,0,1]),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=o);let n=[r[0],o];r.length===3&&n.push(r[2]),e.compute(by(n,t,s),{inputs:n})},lg=(e,r)=>{let t=r.format==="NHWC",s=[e.inputs[0].reshape(t?[e.inputs[0].dims[0],1,e.inputs[0].dims[1],e.inputs[0].dims[2]]:[e.inputs[0].dims[0],e.inputs[0].dims[1],1,e.inputs[0].dims[2]]),e.inputs[1].reshape([e.inputs[1].dims[0],e.inputs[1].dims[1],1,e.inputs[1].dims[2]])];e.inputs.length===3&&s.push(e.inputs[2]);let o=r.kernelShape;(o.length===0||o[0]===0)&&(o=[e.inputs[1].dims[2]]);let n=r.dilations;(n.length===0||n[0]===0)&&(n=[1]);let i=r.strides;(i.length===0||i[0]===0)&&(i=[1]);let a=r.pads;a.length===0&&(a=[0,0]),a=[0,a[0],0,a[1]],i=[1].concat(i),n=[1].concat(n),o=[1].concat(o);let l=r.outputPadding;l=[0].concat(l);let u=nu({...r,pads:a,strides:i,dilations:n,kernelShape:o,outputPadding:l},s);ou(e,s,u,p=>t?[p[0],p[2],p[3]]:[p[0],p[1],p[3]])},yy=(e,r)=>{if(ag(e.inputs,r),e.inputs[0].dims.length===3)lg(e,r);else{let t=nu(r,e.inputs);ou(e,e.inputs,t)}}}),ug,vy,xy,yx=Re(()=>{ut(),ft(),Jt(),_t(),ug=(e,r,t,s)=>{let o=be.size(r),n=r.length,i=Pe("input",e,n),a=Ze("output",e,n),l=t.dataType===6?t.getInt32Array()[0]:Number(t.getBigInt64Array()[0]),u=be.normalizeAxis(l,n),p=d=>{let c=` i32(${i.indicesGet("inputIndices","uniforms.axis")}) `,_=rt("uniforms.input_shape","uniforms.axis",n),f=s.reverse?c+(s.exclusive?" + 1":""):"0",v=s.reverse?_:c+(s.exclusive?"":" + 1");return` + ${d.registerUniform("outputSize","u32").registerUniform("axis","u32").declareVariables(i,a)} + ${d.mainStart()} + ${d.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + var inputIndices = ${a.offsetToIndices("global_idx")}; + var sum = ${a.type.value}(0); + let first : i32 = ${f}; + let last : i32 = ${v}; + for (var i : i32 = first; i < last; i++) { + ${i.indicesSet("inputIndices","uniforms.axis","u32(i)")}; + sum = sum + ${i.getByIndices("inputIndices")}; + } + ${a.setByOffset("global_idx","sum")}; + }`};return{name:"CumSum",shaderCache:{hint:s.cacheKey,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:r,dataType:e}],dispatchGroup:{x:Math.ceil(o/64)},programUniforms:[{type:12,data:o},{type:12,data:u},...st(r,r)]}),getShaderSource:p}},vy=(e,r)=>{let t=e.inputs[0].dims,s=e.inputs[0].dataType,o=e.inputs[1];e.compute(ug(s,t,o,r),{inputs:[0]})},xy=e=>{let r=e.exclusive===1,t=e.reverse===1;return $t({exclusive:r,reverse:t})}}),dg,cg,pg,Ty,Ey,vx=Re(()=>{ut(),ft(),Jt(),_t(),dg=e=>{if(!e||e.length!==1)throw new Error("DepthToSpace requires 1 input.");if(e[0].dims.length!==4)throw new Error("DepthToSpace requires 4D input.")},cg=(e,r,t,s)=>{let o=[];o.push(`fn perm(i: ${s.type.indices}) -> ${t.type.indices} { + var a: ${t.type.indices};`);for(let n=0;n{let t,s,o,n,i,a,l=r.format==="NHWC",u=r.blocksize,p=r.mode==="DCR";l?([t,s,o,n]=e.dims,i=p?[t,s,o,u,u,n/u**2]:[t,s,o,n/u**2,u,u],a=p?[0,1,3,2,4,5]:[0,1,4,2,5,3]):([t,s,o,n]=[e.dims[0],e.dims[2],e.dims[3],e.dims[1]],i=p?[t,u,u,n/u**2,s,o]:[t,n/u**2,u,u,s,o],a=p?[0,3,4,1,5,2]:[0,1,4,2,5,3]);let d=e.reshape(i),c=d.dims.length,_=e.dataType,f=Pe("a",_,c),v=Ze("output",_,c),$=w=>` + ${w.registerUniform("output_size","u32").declareVariables(f,v)} + + ${cg(a,c,f,v)} + + ${w.mainStart()} + ${w.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let indices = ${v.offsetToIndices("global_idx")}; + let aIndices = perm(indices); + + ${v.setByOffset("global_idx",f.getByIndices("aIndices"))} + }`;return{name:"DepthToSpace",shaderCache:{hint:`${e.dims};${r.blocksize};${r.mode}`,inputDependencies:["rank"]},getRunData:w=>{let g=l?[t,s*u,o*u,n/u**2]:[t,n/u**2,s*u,o*u],C=be.size(g),E=d.dims,y=be.sortBasedOnPerm(E,a);return{outputs:[{dims:g,dataType:w[0].dataType}],dispatchGroup:{x:Math.ceil(C/64)},programUniforms:[{type:12,data:C},...st(E,y)]}},getShaderSource:$}},Ty=(e,r)=>{dg(e.inputs),e.compute(pg(e.inputs[0],r))},Ey=e=>$t({blocksize:e.blocksize,mode:e.mode,format:e.format})}),na,No,iu,hg,mg,fg,_g,au,gg,Py,Cy,xx=Re(()=>{ut(),ft(),Jt(),_t(),na="[a-zA-Z]|\\.\\.\\.",No="("+na+")+",iu="^"+No+"$",hg="("+No+",)*"+No,mg="^"+hg+"$",fg=class{constructor(e=-1){this.symbolToIndices=new Map,this.inputIndex=e}addSymbol(e,r){let t=this.symbolToIndices.get(e);t===void 0?t=[r]:t.push(r),this.symbolToIndices.set(e,t)}},_g=class{constructor(e,r){var o;this.equation=r,this.hasEllipsis=!1,this.symbolToInfo=new Map,this.lhs=new Array,this.outputDims=[];let[t,s]=r.includes("->")?r.split("->",2):[r,""];if(!t.match(RegExp(mg)))throw new Error("Invalid LHS term");if(t.split(",").forEach((n,i)=>{let a=e[i].dims.slice();if(!n.match(RegExp(iu)))throw new Error("Invalid LHS term");let l=this.processTerm(n,!0,a,i);this.lhs.push(l)}),s==="")s+=[...this.symbolToInfo.entries()].filter(([n,i])=>i.count===1||n==="...").map(([n])=>n).join("");else if(!s.match(RegExp(No)))throw new Error("Invalid RHS");(o=s.match(RegExp(na,"g")))==null||o.forEach(n=>{if(n==="...")this.outputDims=this.outputDims.concat(this.ellipsisDims);else{let i=this.symbolToInfo.get(n);if(i===void 0)throw new Error("Invalid RHS symbol");this.outputDims.push(i.dimValue)}}),this.rhs=this.processTerm(s,!1,this.outputDims)}addSymbol(e,r,t){let s=this.symbolToInfo.get(e);if(s!==void 0){if(s.dimValue!==r&&s.count!==1)throw new Error("Dimension mismatch");s.count++,s.inputIndices.push(t)}else s={count:1,dimValue:r,inputIndices:[t]};this.symbolToInfo.set(e,s)}processTerm(e,r,t,s=-1){let o=t.length,n=!1,i=[],a=0;if(!e.match(RegExp(iu))&&!r&&e!=="")throw new Error("Invalid LHS term");let l=e.match(RegExp(na,"g")),u=new fg(s);return l==null||l.forEach((p,d)=>{if(p==="..."){if(n)throw new Error("Only one ellipsis is allowed per input term");n=!0;let c=o-l.length+1;if(c<0)throw new Error("Ellipsis out of bounds");if(i=t.slice(a,a+c),this.hasEllipsis){if(this.ellipsisDims.length!==i.length||this.ellipsisDims.toString()!==i.toString())throw new Error("Ellipsis dimensions mismatch")}else if(r)this.hasEllipsis=!0,this.ellipsisDims=i;else throw new Error("Ellipsis must be specified in the LHS");for(let _=0;_e+"_max",gg=(e,r,t,s)=>{let o=e.map(u=>u.length).map((u,p)=>Pe(`input${p}`,r,u)),n=be.size(s),i=Ze("output",r,s.length),a=[...t.symbolToInfo.keys()].filter(u=>!t.rhs.symbolToIndices.has(u)),l=u=>{let p=[],d="var prod = 1.0;",c="var sum = 0.0;",_="sum += prod;",f=[],v=[],$=[],w=[],g=t.symbolToInfo.size===t.rhs.symbolToIndices.size;t.symbolToInfo.forEach((E,y)=>{var b;if(t.rhs.symbolToIndices.has(y)){let x=(b=t.rhs.symbolToIndices.get(y))==null?void 0:b[0];x!==void 0&&t.lhs.forEach((S,A)=>{if(E.inputIndices.includes(A)){let B=S.symbolToIndices.get(y);if(B===void 0)throw new Error("Invalid symbol error");B.forEach(K=>{p.push(`${o[A].indicesSet(`input${A}Indices`,K,i.indicesGet("outputIndices",x))}`)})}})}else t.lhs.forEach((x,S)=>{if(E.inputIndices.includes(S)){let A=x.symbolToIndices.get(y);if(A===void 0)throw new Error("Invalid symbol error");A.forEach(B=>{f.push(`${o[S].indicesSet(`input${S}Indices`,B,`${y}`)}`)}),w.push(`prod *= ${o[S].getByIndices(`input${S}Indices`)};`)}}),v.push(`for(var ${y}: u32 = 0; ${y} < uniforms.${au(y)}; ${y}++) {`),$.push("}")});let C=g?[...p,`let sum = ${o.map((E,y)=>E.getByIndices(`input${y}Indices`)).join(" * ")};`]:[...p,c,...v,...f,d,...w,_,...$];return` + ${u.registerUniforms(a.map(E=>({name:`${au(E)}`,type:"u32"}))).registerUniform("outputSize","u32").declareVariables(...o,i)} + + ${u.mainStart()} + ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + var outputIndices = ${i.offsetToIndices("global_idx")}; + ${o.map((E,y)=>`var input${y}Indices: ${o[y].type.indices};`).join(` +`)} + ${C.join(` +`)}; + ${i.setByOffset("global_idx","sum")}; + }`};return{name:"Einsum",shaderCache:{hint:t.equation,inputDependencies:e.map(()=>"rank")},getRunData:()=>{let u=a.filter(d=>t.symbolToInfo.has(d)).map(d=>{var c;return{type:12,data:((c=t.symbolToInfo.get(d))==null?void 0:c.dimValue)||0}});u.push({type:12,data:n});let p=e.map((d,c)=>[...st(d)]).reduce((d,c)=>d.concat(c),u);return p.push(...st(s)),{outputs:[{dims:s,dataType:r}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:p}},getShaderSource:l}},Py=(e,r)=>{let t=new _g(e.inputs,r.equation),s=t.outputDims,o=e.inputs.map((n,i)=>n.dims);e.compute(gg(o,e.inputs[0].dataType,t,s))},Cy=e=>{let r=e.equation.replace(/\s+/g,"");return $t({equation:r})}}),wg,lu,bg,Mg,Sy,Tx=Re(()=>{ut(),ft(),_t(),wg=e=>{if(!e||e.length!==2)throw new Error("Expand requires 2 input.");let r=e[0].dims,t=Array.from(e[1].getBigInt64Array(),Number),s=t.length{let t=e.length-r.length,s=[];for(let o=0;oe.length>r.length?lu(e,r):lu(r,e),Mg=e=>{let r=e[0].dims,t=Array.from(e[1].getBigInt64Array(),Number),s=bg(r,t),o=e[0].dataType,n=o===9||be.size(r)===1,i=o===9||r.length>0&&r[r.length-1]%4===0?4:1,a=n||s.length>0&&s[s.length-1]%4===0?4:1,l=Math.ceil(be.size(s)/a),u=d=>{let c=Pe("input",o,r.length,i),_=Ze("output",o,s.length,a),f;if(o===9){let v=($,w,g="")=>` + let outputIndices${w} = ${_.offsetToIndices(`outputOffset + ${w}u`)}; + let offset${w} = ${c.broadcastedIndicesToOffset(`outputIndices${w}`,_)}; + let index${w} = offset${w} / 4u; + let component${w} = offset${w} % 4u; + ${$}[${w}] = ${g}(${c.getByOffset(`index${w}`)}[component${w}]); + `;f=` + let outputOffset = global_idx * ${a}; + var data = vec4(0); + ${v("data",0,"u32")} + ${v("data",1,"u32")} + ${v("data",2,"u32")} + ${v("data",3,"u32")} + ${_.setByOffset("global_idx","data")} + }`}else f=` + let outputIndices = ${_.offsetToIndices(`global_idx * ${a}`)}; + let inputOffset = ${c.broadcastedIndicesToOffset("outputIndices",_)}; + let data = ${_.type.value}(${c.getByOffset(`inputOffset / ${i}`)}); + ${_.setByOffset("global_idx","data")} + }`;return` + ${d.registerUniform("vec_size","u32").declareVariables(c,_)} + ${d.mainStart()} + ${d.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} + ${f}`},p=[{type:12,data:l},...st(r,s)];return{name:"Expand",shaderCache:{hint:`${s.length};${i}${a}`,inputDependencies:["rank"]},getShaderSource:u,getRunData:()=>({outputs:[{dims:s,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:p})}},Sy=e=>{wg(e.inputs),e.compute(Mg(e.inputs),{inputs:[0]})}}),yg,$y,Ex=Re(()=>{ut(),ft(),_t(),cd(),yg=e=>{let r=e[0].dataType,t=be.size(e[0].dims),s=be.size(e[1].dims),o=s%4===0,n=i=>{let a=Pe("x",r,[1],4),l=Pe("bias",r,[1],4),u=Ze("y",r,[1],4),p=[{name:"output_vec_size",type:"u32"},{name:"bias_size",type:"u32"}],d=_=>` + let bias${_}_offset: u32 = (global_idx * 4 + ${_}) % uniforms.bias_size; + let bias${_} = ${l.getByOffset(`bias${_}_offset / 4`)}[bias${_}_offset % 4];`,c=o?` + let bias = ${l.getByOffset("global_idx % (uniforms.bias_size / 4)")};`:`${d(0)}${d(1)}${d(2)}${d(3)} + let bias = ${a.type.value}(bias0, bias1, bias2, bias3);`;return`${i.registerUniforms(p).declareVariables(a,l,u)} + + ${Ru(Er(r))} + + ${i.mainStart(io)} + ${i.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_vec_size")} + + let x = ${a.getByOffset("global_idx")}; + ${c} + let x_in = x + bias; + ${u.setByOffset("global_idx",ju("x_in"))} + }`};return{name:"FastGeluWithBias",shaderCache:{hint:`${o}`,inputDependencies:["type","type"]},getShaderSource:n,getRunData:i=>({outputs:[{dims:i[0].dims,dataType:i[0].dataType}],programUniforms:[{type:12,data:Math.ceil(t/4)},{type:12,data:s}],dispatchGroup:{x:Math.ceil(t/io/4)}})}},$y=e=>{e.inputs.length<2||be.size(e.inputs[1].dims)===0?XM(e):e.compute(yg(e.inputs))}}),vg,xg,ky,Iy,Px=Re(()=>{ut(),ft(),Jt(),_t(),vg=e=>{if(!e||e.length!==2)throw new Error("Gather requires 2 inputs.")},xg=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t.length,n=be.normalizeAxis(r.axis,o),i=t.slice(0);i.splice(n,1,...s);let a=t[n],l=e[0].dataType===9?4:1,u=Math.ceil(be.size(i)/l),p=[{type:12,data:u},{type:6,data:a},{type:12,data:n},...st(e[0].dims,e[1].dims,i)],d=c=>{let _=Pe("data",e[0].dataType,e[0].dims.length,l),f=Pe("inputIndices",e[1].dataType,e[1].dims.length),v=Ze("output",e[0].dataType,i.length,l),$=g=>{let C=s.length,E=`var indicesIndices${g} = ${f.type.indices}(0);`;for(let y=0;y1?`indicesIndices${g}[${y}]`:`indicesIndices${g}`} = ${i.length>1?`outputIndices${g}[uniforms.axis + ${y}]`:`outputIndices${g}`};`;E+=` + var idx${g} = ${f.getByIndices(`indicesIndices${g}`)}; + if (idx${g} < 0) { + idx${g} = idx${g} + uniforms.axisDimLimit; + } + var dataIndices${g} : ${_.type.indices}; + `;for(let y=0,b=0;y1?`dataIndices${g}[${y}]`:`dataIndices${g}`} = u32(idx${g});`,b+=C):(E+=`${o>1?`dataIndices${g}[${y}]`:`dataIndices${g}`} = ${i.length>1?`outputIndices${g}[${b}]`:`outputIndices${g}`};`,b++);return E},w;if(e[0].dataType===9){let g=(C,E,y="")=>` + let outputIndices${E} = ${v.offsetToIndices(`outputOffset + ${E}u`)}; + ${$(E)}; + let offset${E} = ${_.indicesToOffset(`dataIndices${E}`)}; + let index${E} = offset${E} / 4u; + let component${E} = offset${E} % 4u; + ${C}[${E}] = ${y}(${_.getByOffset(`index${E}`)}[component${E}]); + `;w=` + let outputOffset = global_idx * ${l}; + var value = vec4(0); + ${g("value",0,"u32")} + ${g("value",1,"u32")} + ${g("value",2,"u32")} + ${g("value",3,"u32")} + ${v.setByOffset("global_idx","value")} + `}else w=` + let outputIndices = ${v.offsetToIndices("global_idx")}; + ${$("")}; + let value = ${_.getByIndices("dataIndices")}; + ${v.setByOffset("global_idx","value")}; + `;return` + ${c.registerUniform("outputSize","u32").registerUniform("axisDimLimit","i32").registerUniform("axis","u32").declareVariables(_,f,v)} + ${c.mainStart()} + ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + ${w} + }`};return{name:"Gather",shaderCache:{hint:r.cacheKey,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:i,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(u/64)},programUniforms:p}),getShaderSource:d}},ky=e=>$t({axis:e.axis}),Iy=(e,r)=>{let t=e.inputs;vg(t),e.compute(xg(e.inputs,r))}}),Tg,Ay,Fy,Cx=Re(()=>{ut(),ft(),_t(),Tg=(e,r,t,s,o,n,i,a,l)=>{let u=[{type:12,data:n},{type:12,data:s},{type:12,data:o},{type:12,data:t},{type:12,data:i},{type:12,data:a},{type:12,data:l}],p=[n];u.push(...st(r.dims,p));let d=c=>{let _=Pe("indices_data",r.dataType,r.dims.length),f=Ze("input_slice_offsets_data",12,1,1),v=[_,f],$=[{name:"output_size",type:"u32"},{name:"batch_dims",type:"u32"},{name:"input_dims",type:"u32",length:o.length},{name:"sizes_from_slice_dims_data",type:"u32",length:t.length},{name:"num_slices_per_batch",type:"u32"},{name:"input_batch_stride",type:"u32"},{name:"num_slice_dims",type:"u32"}];return` + ${c.registerUniforms($).declareVariables(...v)} + ${c.mainStart()} + ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let batch_idx = global_idx / uniforms.num_slices_per_batch; + let base_offset = batch_idx * uniforms.input_batch_stride; + + let slice_indices_base_offset = global_idx * uniforms.num_slice_dims; + var relative_slice_offset = 0; + for (var dim_idx = 0u; dim_idx < uniforms.num_slice_dims; dim_idx ++) { + var index = i32(indices_data[dim_idx + slice_indices_base_offset].x); + let input_dim_idx = uniforms.batch_dims + dim_idx; + if (index < 0) { + ${o.length===1?"index += i32(uniforms.input_dims);":"index += i32(uniforms.input_dims[input_dim_idx]);"} + } + ${t.length===1?"relative_slice_offset += index * i32(uniforms.sizes_from_slice_dims_data);":"relative_slice_offset += index * i32(uniforms.sizes_from_slice_dims_data[dim_idx]);"} + } + + input_slice_offsets_data[global_idx] = base_offset + u32(relative_slice_offset); + }`};return e.compute({name:"computeSliceOffsets",shaderCache:{hint:`${o.length}_${t.length}`,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:p,dataType:e.inputs[1].dataType}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:u}),getShaderSource:d},{inputs:[r],outputs:[-1]})[0]},Ay=(e,r)=>{let t=e.inputs,s=t[0].dims,o=t[0].dataType,n=t[1].dims,i=n[n.length-1],a=be.sizeToDimension(n,n.length-1),l=be.sizeFromDimension(s,r.batchDims+i),u=be.sizeToDimension(s,r.batchDims),p=be.sizeFromDimension(s,r.batchDims),d=a/u,c=new Array(i),_=l;for(let E=0;Es.length)throw new Error("last dimension of indices must not be larger than rank of input tensor");let $=n.slice(0,-1).concat(s.slice(v)),w=be.size($),g=[{type:12,data:w},{type:12,data:l},...st(t[0].dims,f.dims,$)],C=E=>{let y=Pe("data",t[0].dataType,t[0].dims.length),b=Pe("slice_offsets",12,f.dims.length),x=Ze("output",t[0].dataType,$.length);return` + ${E.registerUniform("output_size","u32").registerUniform("slice_size","u32").declareVariables(y,b,x)} + ${E.mainStart()} + ${E.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let slice_offset = slice_offsets[global_idx / uniforms.slice_size]; + output[global_idx] = data[u32(slice_offset) + global_idx % uniforms.slice_size]; + }`};e.compute({name:"GatherND",shaderCache:{hint:r.cacheKey,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:$,dataType:o}],dispatchGroup:{x:Math.ceil(w/64)},programUniforms:g}),getShaderSource:C},{inputs:[t[0],f]})},Fy=e=>({batchDims:e.batch_dims,cacheKey:""})}),Eg,Pg,Oy,Dy,Sx=Re(()=>{ut(),ft(),Jt(),_t(),Eg=(e,r)=>{if(e.length<3||e.length>4)throw new Error("GatherBlockQuantized requires 3 or 4 inputs.");let t=be.normalizeAxis(r.quantizeAxis,e[0].dims.length),s=r.blockSize,o=e[0],n=e[2],i=e.length===4?e[3]:void 0;if(n.dims.length!==o.dims.length||!o.dims.map((a,l)=>l===t?Math.ceil(a/s)===n.dims[l]:a===n.dims[l]).reduce((a,l)=>a&&l,!0))throw new Error("Scales must have the same rank as the input tensor and the dims should match except on gatherAxis.");if(i){if(i.dataType!==o.dataType)throw new Error("Zero point must have the same data type as the input tensor.");if(i.dims.length!==n.dims.length||!i.dims.map((a,l)=>a===n.dims[l]).reduce((a,l)=>a&&l,!0))throw new Error("Zero point must have the same rank as the input tensor and the dims should match except on quantizeAxis.")}},Pg=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t.length,n=be.normalizeAxis(r.gatherAxis,o),i=be.normalizeAxis(r.quantizeAxis,o),a=t.slice(0);a.splice(n,1,...s);let l=be.size(a),u=e[2].dataType,p=e[0].dataType===22,d=[{type:12,data:l},{type:12,data:i},{type:12,data:n},{type:12,data:r.blockSize},...st(...e.map((_,f)=>_.dims),a)],c=_=>{let f=Pe("data",e[0].dataType,e[0].dims.length),v=Pe("inputIndices",e[1].dataType,e[1].dims.length),$=Pe("scales",e[2].dataType,e[2].dims.length),w=e.length>3?Pe("zeroPoint",e[3].dataType,e[3].dims.length):void 0,g=Ze("output",u,a.length),C=[f,v,$];w&&C.push(w);let E=[{name:"output_size",type:"u32"},{name:"quantize_axis",type:"u32"},{name:"gather_axis",type:"u32"},{name:"block_size",type:"u32"}];return` + ${_.registerUniforms(E).declareVariables(...C,g)} + ${_.mainStart()} + let output_indices = ${g.offsetToIndices("global_idx")}; + var indices_indices = ${v.type.indices}(0); + ${s.length>1?` + for (var i: u32 = 0; i < ${s.length}; i++) { + let index = ${g.indicesGet("output_indices","uniforms.gather_axis + i")}; + ${v.indicesSet("indices_indices","i","index")}; + }`:`indices_indices = ${g.indicesGet("output_indices","uniforms.gather_axis")};`}; + var data_indices = ${f.type.indices}(0); + for (var i: u32 = 0; i < uniforms.gather_axis; i++) { + let index = ${g.indicesGet("output_indices","i")}; + ${f.indicesSet("data_indices","i","index")}; + } + var index_from_indices = ${v.getByIndices("indices_indices")}; + if (index_from_indices < 0) { + index_from_indices += ${t[n]}; + } + ${f.indicesSet("data_indices","uniforms.gather_axis","u32(index_from_indices)")}; + for (var i = uniforms.gather_axis + 1; i < ${a.length}; i++) { + let index = ${g.indicesGet("output_indices",`i + ${s.length} - 1`)}; + ${f.indicesSet("data_indices","i","index")}; + } + let data_offset = ${f.indicesToOffset("data_indices")}; + let data_index = data_offset % 8; + // Convert 4-bit packed data to 8-bit packed data. + let packed_4bit_quantized_data = ${f.getByOffset("data_offset / 8")}; + let packed_8bit_quantized_data = (packed_4bit_quantized_data >> (4 * (data_index % 2))) & 0x0f0f0f0f; + let quantized_data_vec = ${p?"unpack4xI8":"unpack4xU8"}(u32(packed_8bit_quantized_data)); + let quantized_data = quantized_data_vec[data_index / 2]; + var scale_indices = data_indices; + let quantize_axis_index = ${$.indicesGet("data_indices","uniforms.quantize_axis")} / uniforms.block_size; + ${$.indicesSet("scale_indices","uniforms.quantize_axis","quantize_axis_index")}; + var scale = ${$.getByIndices("scale_indices")}; + ${w?` + let zero_point_indices = scale_indices; + let zero_point_offset = ${w.indicesToOffset("zero_point_indices")}; + let zero_point_index = zero_point_offset % 8; + let packed_4bit_zero_points = ${w.getByOffset("zero_point_offset / 8")}; + let packed_8bit_zero_points = (packed_4bit_zero_points >> (4 * (zero_point_index % 2))) & 0x0f0f0f0f; + let zero_point_vec = ${p?"unpack4xI8":"unpack4xU8"}(u32(packed_8bit_zero_points)); + let zero_point = zero_point_vec[zero_point_index / 2];`:"var zero_point = 0"}; + let dequantized_data = ${Er(u)}(quantized_data - zero_point) * scale; + ${g.setByOffset("global_idx","dequantized_data")}; + }`};return{name:"GatherBlockQuantized",shaderCache:{hint:`${r.cacheKey};${e.filter((_,f)=>f!==1).map(_=>_.dims.join("_")).join(";")}`,inputDependencies:Array.from({length:e.length},(_,f)=>"rank")},getRunData:()=>({outputs:[{dims:a,dataType:u}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:d}),getShaderSource:c}},Oy=(e,r)=>{let t=e.inputs;Eg(t,r),e.compute(Pg(e.inputs,r))},Dy=e=>$t({blockSize:e.blockSize,gatherAxis:e.gatherAxis,quantizeAxis:e.quantizeAxis})}),Cg,Sg,Ly,zy,$x=Re(()=>{ut(),ft(),Jt(),_t(),Cg=e=>{if(!e||e.length!==2)throw new Error("GatherElements requires 2 inputs.");if(e[0].dims.length<1)throw new Error("GatherElements requires that the data input be rank >= 1.");if(e[0].dims.length!==e[1].dims.length)throw new Error(`GatherElements requires that the data input and + indices input tensors be of same rank.`)},Sg=(e,r)=>{let t=e[0].dims,s=e[0].dataType,o=t.length,n=e[1].dims,i=e[1].dataType,a=be.normalizeAxis(r.axis,o),l=t[a],u=n.slice(0),p=be.size(u),d=Pe("input",s,o),c=Pe("indicesInput",i,n.length),_=Ze("output",s,u.length),f=[{type:12,data:p},{type:6,data:l},{type:12,data:a}];return f.push(...st(t,n,u)),{name:"GatherElements",shaderCache:{inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:u,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(p/64)},programUniforms:f}),getShaderSource:v=>` + ${v.registerUniform("outputSize","u32").registerUniform("axisDimLimit","i32").registerUniform("axis","u32").declareVariables(d,c,_)} + ${v.mainStart()} + ${v.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + + let outputIndices = ${_.offsetToIndices("global_idx")}; + + var idx = ${c.getByOffset("global_idx")}; + if (idx < 0) { + idx = idx + uniforms.axisDimLimit; + } + var inputIndices = ${d.type.indices}(outputIndices); + ${d.indicesSet("inputIndices","uniforms.axis","u32(idx)")}; + let value = ${d.getByIndices("inputIndices")}; + + ${_.setByOffset("global_idx","value")}; + }`}},Ly=e=>$t({axis:e.axis}),zy=(e,r)=>{let t=e.inputs;Cg(t),e.compute(Sg(e.inputs,r))}}),$g,kg,By,Ry,kx=Re(()=>{ut(),ft(),_t(),$g=e=>{if(!e)throw new Error("Input is missing");if(e.length<2||e.length>3)throw new Error("Invaid input number.");if(e.length===3&&e[2].dims.length>2)throw new Error("Invalid input shape of C");if(e[0].dataType!==e[1].dataType||e.length===3&&e[0].dataType!==e[2].dataType)throw new Error("Input types are mismatched")},kg=(e,r)=>{let t=e[0].dims.slice(),s=e[1].dims.slice(),[o,n,i]=Lb.getShapeOfGemmResult(t,r.transA,s,r.transB,e.length===3?e[2].dims:void 0),a=[o,n];if(!a)throw new Error("Can't use gemm on the given tensors");let l=16,u=Math.ceil(n/l),p=Math.ceil(o/l),d=!0,c=be.size(a),_=[{type:12,data:d?u:c},{type:12,data:o},{type:12,data:n},{type:12,data:i},{type:1,data:r.alpha},{type:1,data:r.beta}],f=["type","type"];e.length===3&&(_.push(...st(e[2].dims)),f.push("rank")),_.push(...st(a));let v=w=>{let g="";r.transA&&r.transB?g="value += a[k * uniforms.M + m] * b[n * uniforms.K + k];":r.transA&&!r.transB?g="value += a[k * uniforms.M + m] * b[k * uniforms.N + n];":!r.transA&&r.transB?g="value += a[m * uniforms.K + k] * b[n * uniforms.K + k];":!r.transA&&!r.transB&&(g="value += a[m * uniforms.K + k] * b[k * uniforms.N + n];");let C=r.alpha===1?"":"value *= uniforms.alpha;",E=Pe("a",e[0].dataType,e[0].dims),y=Pe("b",e[1].dataType,e[1].dims),b=E.type.value,x=null,S=[E,y];e.length===3&&(x=Pe("c",e[2].dataType,e[2].dims.length),S.push(x));let A=Ze("output",e[0].dataType,a.length);S.push(A);let B=[{name:"output_size",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"},{name:"alpha",type:"f32"},{name:"beta",type:"f32"}];return` + ${w.registerUniforms(B).declareVariables(...S)} + + ${w.mainStart()} + ${w.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let m = global_idx / uniforms.N; + let n = global_idx % uniforms.N; + + var value = ${b}(0); + for (var k: u32 = 0u; k < uniforms.K; k++) { + ${g} + } + + ${C} + ${x!=null?`let cOffset = ${x.broadcastedIndicesToOffset("vec2(m, n)",A)}; value += ${b}(uniforms.beta) * ${x.getByOffset("cOffset")};`:""} + output[global_idx] = value; + }`},$=w=>{let g=Pe("a",e[0].dataType,e[0].dims),C=Pe("b",e[1].dataType,e[1].dims),E=null,y=[g,C];e.length===3&&(E=Pe("c",e[2].dataType,e[2].dims.length),y.push(E));let b=Ze("output",e[0].dataType,a.length);y.push(b);let x=[{name:"num_tile_n",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"},{name:"alpha",type:"f32"},{name:"beta",type:"f32"}],S="",A="";r.transA&&r.transB?(A=` + var col = tile_row_start + local_id.x; + var row = k_start + local_id.y; + if (col < uniforms.M && row < uniforms.K) { + tile_a[local_id.y][local_id.x] = a[row * uniforms.M + col]; + } else { + tile_a[local_id.y][local_id.x] = ${g.type.value}(0); + } + + col = k_start + local_id.x; + row = tile_col_start + local_id.y; + if (col < uniforms.K && row < uniforms.N) { + tile_b[local_id.y][local_id.x] = b[row * uniforms.K + col]; + } else { + tile_b[local_id.y][local_id.x] = ${C.type.value}(0); + } + `,S="value += tile_a[k][local_id.y] * tile_b[local_id.x][k];"):r.transA&&!r.transB?(A=` + var col = tile_row_start + local_id.x; + var row = k_start + local_id.y; + if (col < uniforms.M && row < uniforms.K) { + tile_a[local_id.y][local_id.x] = a[row * uniforms.M + col]; + } else { + tile_a[local_id.y][local_id.x] = ${g.type.value}(0); + } + + col = tile_col_start + local_id.x; + row = k_start + local_id.y; + if (col < uniforms.N && row < uniforms.K) { + tile_b[local_id.y][local_id.x] = b[row * uniforms.N + col]; + } else { + tile_b[local_id.y][local_id.x] = ${C.type.value}(0); + } + `,S="value += tile_a[k][local_id.y] * tile_b[k][local_id.x];"):!r.transA&&r.transB?(A=` + var col = k_start + local_id.x; + var row = tile_row_start + local_id.y; + if (col < uniforms.K && row < uniforms.M) { + tile_a[local_id.y][local_id.x] = a[row * uniforms.K + col]; + } else { + tile_a[local_id.y][local_id.x] = ${g.type.value}(0); + } + + col = k_start + local_id.x; + row = tile_col_start + local_id.y; + if (col < uniforms.K && row < uniforms.N) { + tile_b[local_id.y][local_id.x] = b[row * uniforms.K + col]; + } else { + tile_b[local_id.y][local_id.x] = ${C.type.value}(0); + } + `,S="value += tile_a[local_id.y][k] * tile_b[local_id.x][k];"):!r.transA&&!r.transB&&(A=` + var col = k_start + local_id.x; + var row = tile_row_start + local_id.y; + if (col < uniforms.K && row < uniforms.M) { + tile_a[local_id.y][local_id.x] = a[row * uniforms.K + col]; + } else { + tile_a[local_id.y][local_id.x] = ${g.type.value}(0); + } + + col = tile_col_start + local_id.x; + row = k_start + local_id.y; + if (col < uniforms.N && row < uniforms.K) { + tile_b[local_id.y][local_id.x] = b[row * uniforms.N + col]; + } else { + tile_b[local_id.y][local_id.x] = ${C.type.value}(0); + } + `,S="value += tile_a[local_id.y][k] * tile_b[k][local_id.x];");let B=r.alpha===1?"":"value *= uniforms.alpha;";return` + ${w.registerUniforms(x).declareVariables(...y)} + var tile_a: array, ${l}>; + var tile_b: array, ${l}>; + ${w.mainStart([l,l,1])} + let tile_col_start = (workgroup_index % uniforms.num_tile_n) * ${l}; + let tile_row_start = (workgroup_index / uniforms.num_tile_n) * ${l}; + let num_tiles = (uniforms.K - 1) / ${l} + 1; + var k_start = 0u; + var value = ${b.type.value}(0); + for (var t: u32 = 0u; t < num_tiles; t++) { + ${A} + k_start = k_start + ${l}; + workgroupBarrier(); + + for (var k: u32 = 0u; k < ${l}; k++) { + ${S} + } + workgroupBarrier(); + } + + ${B} + let m = tile_row_start + local_id.y; + let n = tile_col_start + local_id.x; + ${E!=null?`let cOffset = ${E.broadcastedIndicesToOffset("vec2(m, n)",b)}; value += ${b.type.value}(uniforms.beta) * ${E.getByOffset("cOffset")};`:""} + if (m < uniforms.M && n < uniforms.N) { + output[m * uniforms.N + n] = value; + } + }`};return d?{name:"GemmShared",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:f},getRunData:()=>({outputs:[{dims:a,dataType:e[0].dataType}],dispatchGroup:{x:u*p},programUniforms:_}),getShaderSource:$}:{name:"Gemm",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:f},getRunData:()=>({outputs:[{dims:a,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:_}),getShaderSource:v}},By=e=>{let r=e.transA,t=e.transB,s=e.alpha,o=e.beta;return{transA:r,transB:t,alpha:s,beta:o,cacheKey:`${e.transA};${e.transB};${e.alpha===1}`}},Ry=(e,r)=>{$g(e.inputs),e.compute(kg(e.inputs,r))}}),vs,Is,Pn,Cn,Ig,Ag,Fg,Og,Dg,Lg,zg,Bg,jy,Ny,Ix=Re(()=>{ut(),ft(),Jt(),_t(),[vs,Is,Pn,Cn]=[0,1,2,3],Ig=e=>{if(e[0].dims.length!==4)throw new Error("only 4-D tensor is supported.");if(e[0].dims.length!==e[1].dims.length)throw new Error("input dimensions must be equal to grid dimensions");if(e[0].dims.length-2!==e[1].dims[e[1].dims.length-1])throw new Error(`last dimension of grid must be equal to ${e[0].dims.length-2}`);if(e[0].dims[0]!==e[1].dims[0])throw new Error("grid batch size must match input batch size")},Ag=` + fn gs_get_cubic_coeffs(x: f32) -> vec4 { + let cubic_alpha = -0.75f; + let x_abs = abs(x); + var coeffs: vec4; + coeffs[0] = (((cubic_alpha * (x_abs + 1) - 5 * cubic_alpha) * (x_abs + 1) + 8 * cubic_alpha) * (x_abs + 1) - 4 * cubic_alpha); + coeffs[1] = (((cubic_alpha + 2) * x_abs - (cubic_alpha + 3)) * x_abs * x_abs + 1); + coeffs[2] = (((cubic_alpha + 2) * (1 - x_abs) - (cubic_alpha + 3)) * (1 - x_abs) * (1 - x_abs) + 1); + coeffs[3] = (((cubic_alpha * (2 - x_abs) - 5 * cubic_alpha) * (2 - x_abs) + 8 * cubic_alpha) * (2 - x_abs) - 4 * cubic_alpha); + return coeffs; + } +`,Fg=e=>` + fn gs_bicubic_interpolate(p: mat4x4<${e}>, x: f32, y: f32) -> ${e} { + var v: vec4; + var coeffs = gs_get_cubic_coeffs(x); + for (var i = 0; i < 4; i++) { + v[i] = coeffs[0] * p[i][0] + coeffs[1] * p[i][1] + coeffs[2] * p[i][2] + coeffs[3] * p[i][3]; + } + coeffs = gs_get_cubic_coeffs(y); + let pixel = ${e}(coeffs[0] * v[0] + coeffs[1] * v[1] + coeffs[2] * v[2] + coeffs[3] * v[3]); + return pixel; + } +`,Og=e=>` + fn gs_denormalize(n: f32, length: i32) -> f32 { + ${e.alignCorners===0?` + // alignCorners: false => [-1, 1] to [-0.5, length - 0.5] + return ((n + 1.0) * f32(length) - 1.0) / 2.0; + `:` + // alignCorners: true => [-1, 1] to [0, length - 1] + return (n + 1.0) / 2.0 * (f32(length - 1)); + `} + } +`,Dg=e=>` + ${e.paddingMode==="reflection"?` + fn gs_reflect(x: i32, x_min: f32, x_max: f32) -> u32 { + var dx = 0.0; + var fx = f32(x); + let range = x_max - x_min; + if (fx < x_min) { + dx = x_min - fx; + let n = u32(dx / range); + let r = dx - f32(n) * range; + if (n % 2 == 0) { + fx = x_min + r; + } else { + fx = x_max - r; + } + } else if (fx > x_max) { + dx = fx - x_max; + let n = u32(dx / range); + let r = dx - f32(n) * range; + if (n % 2 == 0) { + fx = x_max - r; + } else { + fx = x_min + r; + } + } + return u32(fx); + }`:""} +`,Lg=(e,r,t)=>` + fn pixel_at_grid(r: i32, c: i32, H: i32, W: i32, batch: u32, channel: u32, border: vec4) -> ${r} { + var pixel = ${r}(0); + var indices = vec4(0); + indices[${vs}] = batch; + indices[${Is}] = channel;`+(()=>{switch(t.paddingMode){case"zeros":return` + if (r >= 0 && r < H && c >=0 && c < W) { + indices[${Pn}] = u32(r); + indices[${Cn}] = u32(c); + } else { + return ${r}(0); + } + `;case"border":return` + indices[${Pn}] = u32(clamp(r, 0, H - 1)); + indices[${Cn}] = u32(clamp(c, 0, W - 1)); + `;case"reflection":return` + indices[${Pn}] = gs_reflect(r, border[1], border[3]); + indices[${Cn}] = gs_reflect(c, border[0], border[2]); + `;default:throw new Error(`padding mode ${t.paddingMode} is not supported`)}})()+` + return ${e.getByIndices("indices")}; + } +`,zg=(e,r,t)=>(()=>{switch(t.mode){case"nearest":return` + let result = pixel_at_grid(i32(round(y)), i32(round(x)), H_in, W_in, indices[${vs}], indices[${Is}], border); + `;case"bilinear":return` + let x1 = i32(floor(x)); + let y1 = i32(floor(y)); + let x2 = x1 + 1; + let y2 = y1 + 1; + + let p11 = pixel_at_grid(y1, x1, H_in, W_in, indices[${vs}], indices[${Is}], border); + let p12 = pixel_at_grid(y1, x2, H_in, W_in, indices[${vs}], indices[${Is}], border); + let p21 = pixel_at_grid(y2, x1, H_in, W_in, indices[${vs}], indices[${Is}], border); + let p22 = pixel_at_grid(y2, x2, H_in, W_in, indices[${vs}], indices[${Is}], border); + + let dx2 = ${r}(f32(x2) - x); + let dx1 = ${r}(x - f32(x1)); + let dy2 = ${r}(f32(y2) - y); + let dy1 = ${r}(y - f32(y1)); + let result = dy2 * (dx2 * p11 + dx1 * p12) + dy1 * (dx2 * p21 + dx1 * p22); + `;case"bicubic":return` + let x0 = i32(floor(x)) - 1; + let y0 = i32(floor(y)) - 1; + var p: mat4x4<${r}>; + for (var h = 0; h < 4; h++) { + for (var w = 0; w < 4; w++) { + p[h][w] = pixel_at_grid(h + y0, w + x0, H_in, W_in, indices[${vs}], indices[${Is}], border); + } + } + + let dx = x - f32(x0 + 1); + let dy = y - f32(y0 + 1); + let result = gs_bicubic_interpolate(p, dx, dy); + `;default:throw new Error(`mode ${t.mode} is not supported`)}})()+`${e.setByOffset("global_idx","result")}`,Bg=(e,r)=>{let t=Pe("x",e[0].dataType,e[0].dims.length),s=[e[1].dims[0],e[1].dims[1],e[1].dims[2]],o=Pe("grid",e[1].dataType,s.length,2),n=[e[0].dims[0],e[0].dims[1],e[1].dims[1],e[1].dims[2]];r.format==="NHWC"&&(n=[e[0].dims[0],e[1].dims[1],e[1].dims[2],e[0].dims[3]],[vs,Is,Pn,Cn]=[0,3,1,2]);let i=Ze("output",e[0].dataType,n.length),a=t.type.value,l=be.size(n),u=[{type:12,data:l},...st(e[0].dims,s,n)],p=d=>` + ${d.registerUniform("output_size","u32").declareVariables(t,o,i)} + ${Ag} + ${Fg(a)} + ${Og(r)} + ${Dg(r)} + ${Lg(t,a,r)} + + ${d.mainStart()} + ${d.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let H_in = i32(uniforms.x_shape[${Pn}]); + let W_in = i32(uniforms.x_shape[${Cn}]); + + ${r.alignCorners===0?` + let x_min = -0.5; + let x_max = f32(W_in) - 0.5; + let y_min = -0.5; + let y_max = f32(H_in) - 0.5; + `:` + let x_min = 0.0; + let x_max = f32(W_in) - 1.0; + let y_min = 0.0; + let y_max = f32(H_in) - 1.0; + `}; + let border = vec4(x_min, y_min, x_max, y_max); + + let indices = ${i.offsetToIndices("global_idx")}; + var grid_indices = vec3(indices[${vs}], indices[${Pn}], indices[${Cn}]); + let nxy = ${o.getByIndices("grid_indices")}; + var x = gs_denormalize(f32(nxy[0]), W_in); + var y = gs_denormalize(f32(nxy[1]), H_in); + + ${zg(i,a,r)} + }`;return{name:"GridSample",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:["type","type"]},getRunData:d=>{let c=be.size(n);return{outputs:[{dims:n,dataType:d[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:u}},getShaderSource:p}},jy=(e,r)=>{Ig(e.inputs),e.compute(Bg(e.inputs,r))},Ny=e=>$t({alignCorners:e.align_corners,mode:e.mode,paddingMode:e.padding_mode,format:e.format})}),$r,Rg,Vy,uu,jg,Xo,Uy,Wy=Re(()=>{ut(),ft(),Jt(),ad(),dd(),_t(),Js(),$r=(e,r)=>e.length>r&&e[r].dims.length>0?e[r]:void 0,Rg=(e,r)=>{let t=e[0],s=$r(e,1),o=$r(e,2),n=$r(e,3),i=$r(e,4),a=$r(e,5),l=$r(e,6),u=$r(e,7);if(t.dims.length!==3&&t.dims.length!==5)throw new Error("Input query is expected to have 3 or 5 dimensions");let p=t.dims[0],d=t.dims[1],c=t.dims.length===3?t.dims[2]:r.numHeads*t.dims[4],_=d,f=0,v=0,$=Math.floor(c/r.numHeads);if(l&&u&&be.size(l.dims)&&be.size(u.dims)){if(l.dims.length!==4)throw new Error('Input "past_key" is expected to have 4 dimensions');if(l.dims[0]!==p||l.dims[1]!==r.numHeads||l.dims[3]!==$)throw new Error('Input "past_key" shape (batch_size, num_heads, past_sequence_length, head_size)');if(u.dims[0]!==p||u.dims[1]!==r.numHeads||u.dims[3]!==$)throw new Error('Input "past_value" shape (batch_size, num_heads, past_sequence_length, head_size)');if(l.dims[2]!==u.dims[2])throw new Error('Input "past_key" and "past_value" shall have same dim 2 (past_sequence_length)');if(u.dims.length!==4)throw new Error('Input "past_value" is expected to have 4 dimensions');f=l.dims[2],v=l.dims[2]}else if(l&&be.size(l.dims)||u&&be.size(u.dims))throw new Error('Input "past_key" and "past_value" shall be both present or both absent');let w;if(s&&be.size(s.dims)>0){if(t.dims.length!==3)throw new Error('Input "query" is expected to have 3 dimensions when key is given');if(s.dims.length<3||s.dims.length>5)throw new Error('Input "key" is expected to have 3, 4, or 5 dimensions');if(t.dims[0]!==s.dims[0])throw new Error('Input "query" and "key" shall have same dim 0 (batch size)');if(s.dims.length===3){if(s.dims[2]!==t.dims[2])throw new Error('Input "query" and "key" shall have same dim 2 (hidden_size)');w=2,_=s.dims[1]}else if(s.dims.length===5){if(s.dims[2]!==r.numHeads||s.dims[3]!==2||s.dims[4]!==$)throw new Error('Expect "key" shape (batch_size, kv_sequence_length, num_heads, 2, head_size) for packed kv');if(o)throw new Error('Expect "value" be none when "key" has packed kv format.');w=5,_=s.dims[1]}else{if(s.dims[1]!==r.numHeads||s.dims[3]!==$)throw new Error('Expect "key" shape (batch_size, num_heads, kv_sequence_length, head_size) for past_key');w=0,_=s.dims[2]}}else{if(t.dims.length!==5)throw new Error('Input "query" is expected to have 5 dimensions when key is empty');if(t.dims[2]!==r.numHeads||t.dims[3]!==3)throw new Error('Expect "query" shape (batch_size, kv_sequence_length, num_heads, 3, head_size) for packed kv');w=3}if(n&&be.size(n.dims)>0){if(n.dims.length!==1)throw new Error('Input "bias" is expected to have 1 dimension');if(s&&s.dims.length===5&&s.dims[3]===2)throw new Error("bias is not allowed for packed kv.")}let g=f+_,C=0;if(i&&be.size(i.dims)>0){C=8;let x=i.dims;throw x.length===1?x[0]===p?C=1:x[0]===3*p+2&&(C=3):x.length===2&&x[0]===p&&x[1]===g&&(C=5),C===8?new Error('Input "key_padding_mask" shape shall be (batch_size) or (batch_size, total_sequence_length)'):new Error("Mask not supported")}let E=!1,y=c;if(o&&be.size(o.dims)>0){if(o.dims.length!==3&&o.dims.length!==4)throw new Error('Input "value" is expected to have 3 or 4 dimensions');if(t.dims[0]!==o.dims[0])throw new Error('Input "query" and "value" shall have same dim 0 (batch_size)');if(o.dims.length===3){if(_!==o.dims[1])throw new Error('Input "key" and "value" shall have the same dim 1 (kv_sequence_length)');y=o.dims[2]}else{if(_!==o.dims[2])throw new Error('Input "key" and "value" shall have the same dim 2 (kv_sequence_length)');y=o.dims[1]*o.dims[3],E=!0}}let b=!1;if(i&&be.size(i.dims)>0)throw new Error("Key padding mask is not supported");if(a&&be.size(a.dims)>0){if(a.dims.length!==4)throw new Error('Input "attention_bias" is expected to have 4 dimensions');if(a.dims[0]!==p||a.dims[1]!==r.numHeads||a.dims[2]!==d||a.dims[3]!==g)throw new Error('Expect "attention_bias" shape (batch_size, num_heads, sequence_length, total_sequence_length)')}return{batchSize:p,sequenceLength:d,pastSequenceLength:f,kvSequenceLength:_,totalSequenceLength:g,maxSequenceLength:v,inputHiddenSize:0,hiddenSize:c,vHiddenSize:y,headSize:$,vHeadSize:Math.floor(y/r.numHeads),numHeads:r.numHeads,isUnidirectional:!1,pastPresentShareBuffer:!1,maskFilterValue:r.maskFilterValue,maskType:C,scale:r.scale,broadcastResPosBias:b,passPastInKv:E,qkvFormat:w}},Vy=e=>$t({...e}),uu=$t({perm:[0,2,1,3]}),jg=(e,r,t,s,o,n,i)=>{let a=[s,o,n],l=be.size(a),u=[{type:12,data:l},{type:12,data:i},{type:12,data:n}],p=d=>{let c=Ze("qkv_with_bias",r.dataType,a),_=Pe("qkv",r.dataType,a),f=Pe("bias",t.dataType,a),v=[{name:"output_size",type:"u32"},{name:"bias_offset",type:"u32"},{name:"hidden_size",type:"u32"}];return` + ${d.registerUniforms(v).declareVariables(_,f,c)} + ${d.mainStart()} + ${d.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let bias_offset_idx = (global_idx % uniforms.hidden_size) + uniforms.bias_offset; + + qkv_with_bias[global_idx] = qkv[global_idx] + bias[bias_offset_idx]; + }`};return e.compute({name:"MultiHeadAttentionAddBias",shaderCache:{inputDependencies:["type","type"]},getRunData:()=>({outputs:[{dims:a,dataType:r.dataType,gpuDataType:0}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:u}),getShaderSource:p},{inputs:[r,t],outputs:[-1]})[0]},Xo=(e,r,t,s,o,n,i,a)=>{let l=n;if(i&&be.size(i.dims)>0){if(s===1)throw new Error("AddBiasReshape is not implemented. Please export your model with packed QKV or KV");return l=jg(e,n,i,r,s,t*o,a),l=l.reshape([r,s,t,o]),t===1||s===1?l:e.compute(Vr(l,uu.perm),{inputs:[l],outputs:[-1]})[0]}else return n.dims.length===3&&(l=n.reshape([r,s,t,o])),t===1||s===1?l:e.compute(Vr(l,uu.perm),{inputs:[l],outputs:[-1]})[0]},Uy=(e,r)=>{let t=Rg(e.inputs,r),s=e.inputs[0],o=$r(e.inputs,1),n=$r(e.inputs,2),i=$r(e.inputs,3),a=$r(e.inputs,4),l=$r(e.inputs,5),u=$r(e.inputs,6),p=$r(e.inputs,7);if(s.dims.length===5)throw new Error("Packed QKV is not implemented");if((o==null?void 0:o.dims.length)===5)throw new Error("Packed KV is not implemented");let d=o&&n&&o.dims.length===4&&n.dims.length===4,c=Xo(e,t.batchSize,t.numHeads,t.sequenceLength,t.headSize,s,i,0);if(d)return Zo(e,c,o,n,a,void 0,u,p,l,t);if(!o||!n)throw new Error("key and value must be provided");let _=Xo(e,t.batchSize,t.numHeads,t.kvSequenceLength,t.headSize,o,i,t.hiddenSize),f=Xo(e,t.batchSize,t.numHeads,t.kvSequenceLength,t.vHeadSize,n,i,2*t.hiddenSize);Zo(e,c,_,f,a,void 0,u,p,l,t)}}),Ng,Vg,Ug,Wg,Gu,Gy,Ky,Hy=Re(()=>{ut(),ft(),Jt(),_t(),Ng=e=>{if(!e||e.length<1)throw new Error("too few inputs")},Vg=(e,r)=>{let t=[],s=r.numOutputs;return e[1].dims[0]>0&&(e[1].getBigInt64Array().forEach(o=>t.push(Number(o))),s=t.length),$t({numOutputs:s,axis:r.axis,splitSizes:t})},Ug=e=>` +fn calculateOutputIndex(index: u32) -> u32 { + for (var i: u32 = 0u; i < ${e}u; i += 1u ) { + if (index < ${rt("uniforms.size_in_split_axis","i",e)}) { + return i; + } + } + return ${e}u; +}`,Wg=e=>{let r=e.length,t=[];for(let s=0;s{let t=e[0].dims,s=be.size(t),o=e[0].dataType,n=be.normalizeAxis(r.axis,t.length),i=new Array(r.numOutputs),a=Pe("input",o,t.length),l=new Array(r.numOutputs),u=[],p=[],d=0,c=[{type:12,data:s}];for(let f=0;f` + ${f.registerUniform("input_size","u32").registerUniform("size_in_split_axis","u32",l.length).declareVariables(a,...i)} + ${Ug(l.length)} + ${Wg(i)} + + ${f.mainStart()} + ${f.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.input_size")} + + var indices = ${a.offsetToIndices("global_idx")}; + var index = ${a.indicesGet("indices",n)}; + let output_number = calculateOutputIndex(index); + if (output_number != 0) { + index -= ${rt("uniforms.size_in_split_axis","output_number - 1u",l.length)}; + ${a.indicesSet("indices",n,"index")}; + } + writeBufferData(output_number, indices, global_idx); + }`;return{name:"Split",shaderCache:{hint:r.cacheKey,inputDependencies:["rank"]},getShaderSource:_,getRunData:()=>({outputs:u,dispatchGroup:{x:Math.ceil(s/64)},programUniforms:c})}},Gy=(e,r)=>{Ng(e.inputs);let t=e.inputs.length===1?r:Vg(e.inputs,r);e.compute(Gu(e.inputs,t),{inputs:[0]})},Ky=e=>{let r=e.axis,t=e.splitSizes,s=e.numOutputs<0?t.length:e.numOutputs;if(s!==t.length)throw new Error("numOutputs and splitSizes lengh must be equal");return $t({axis:r,numOutputs:s,splitSizes:t})}}),Gg,ga,qy,Xy=Re(()=>{ut(),ft(),Jt(),_t(),Gg=(e,r)=>{let[t,s,o,n]=e,{numHeads:i,rotaryEmbeddingDim:a}=r;if(t.dims.length!==3&&t.dims.length!==4)throw new Error(`Input 'x' is expected to have 3 or 4 dimensions, got ${t.dims.length}`);if(!be.areEqual(s.dims,[])&&!be.areEqual(s.dims,[1])&&s.dims.length!==2)throw new Error(`Input 'position_ids' is expected to have 0, 1, or 2 dimensions, got ${s.dims.length}`);if(o.dims.length!==2)throw new Error(`Input 'cos_cache' is expected to have 2 dimensions, got ${o.dims.length}`);if(n.dims.length!==2)throw new Error(`Input 'sin_cache' is expected to have 2 dimensions, got ${n.dims.length}`);if(!be.areEqual(o.dims,n.dims))throw new Error("Inputs 'cos_cache' and 'sin_cache' are expected to have the same shape");if(a>0&&i===0)throw new Error("num_heads must be provided if rotary_embedding_dim is specified");let l=t.dims[0],u=t.dims[t.dims.length-2],p=o.dims[0],d=be.sizeFromDimension(t.dims,1)/u,c=a===0?o.dims[1]*2:d/i;if(a>c)throw new Error("rotary_embedding_dim must be less than or equal to head_size");if(s.dims.length===2){if(l!==s.dims[0])throw new Error(`Input 'position_ids' dimension 0 should be of size batch_size, got ${s.dims[0]}`);if(u!==s.dims[1])throw new Error(`Input 'position_ids' dimension 1 should be of size sequence_length, got ${s.dims[1]}`)}if(c/2!==o.dims[1]&&a/2!==o.dims[1])throw new Error(`Input 'cos_cache' dimension 1 should be same as head_size / 2 or rotary_embedding_dim / 2, got ${o.dims[1]}`);if(u>p)throw new Error("Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported")},ga=(e,r)=>{let{interleaved:t,numHeads:s,rotaryEmbeddingDim:o,scale:n}=r,i=e[0].dims[0],a=be.sizeFromDimension(e[0].dims,1),l=e[0].dims[e[0].dims.length-2],u=a/l,p=e[2].dims[1],d=o===0?p*2:u/s,c=new Array(i,l,u/d,d-p),_=be.computeStrides(c),f=[{type:1,data:n},{type:12,data:c},{type:12,data:_},...e[0].dims.length===3?new Array({type:12,data:[a,u,d,1]}):[],...e[0].dims.length===4?new Array({type:12,data:[a,d,l*d,1]}):[],...st(e[0].dims,e[1].dims,e[2].dims,e[3].dims,e[0].dims)],v=$=>{let w=Pe("input",e[0].dataType,e[0].dims.length),g=Pe("position_ids",e[1].dataType,e[1].dims.length),C=Pe("cos_cache",e[2].dataType,e[2].dims.length),E=Pe("sin_cache",e[3].dataType,e[3].dims.length),y=Ze("output",e[0].dataType,e[0].dims.length);return $.registerUniforms([{name:"scale",type:"f32"},{name:"global_shape",type:"u32",length:c.length},{name:"global_strides",type:"u32",length:_.length},{name:"input_output_strides",type:"u32",length:_.length}]),` + ${$.declareVariables(w,g,C,E,y)} + + ${$.mainStart(io)} + let half_rotary_emb_dim = uniforms.${C.name}_shape[1]; + let bsnh = global_idx / uniforms.global_strides % uniforms.global_shape; + let size = uniforms.global_shape[0] * uniforms.global_strides[0]; + ${$.guardAgainstOutOfBoundsWorkgroupSizes("size")} + + if (bsnh[3] < half_rotary_emb_dim) { + let position_ids_idx = + ${g.broadcastedIndicesToOffset("bsnh.xy",Ze("",g.type.tensor,2))}; + let position_id = + u32(${g.getByOffset("position_ids_idx")}) + select(0, bsnh[1], position_ids_idx == 0); + let i = dot(bsnh, uniforms.input_output_strides) + select(0, bsnh[3], ${t}); + let j = i + select(half_rotary_emb_dim, 1, ${t}); + let re = ${w.getByOffset("i")} * ${C.get("position_id","bsnh[3]")} - + ${w.getByOffset("j")} * ${E.get("position_id","bsnh[3]")}; + ${y.setByOffset("i","re")} + let im = ${w.getByOffset("i")} * ${E.get("position_id","bsnh[3]")} + + ${w.getByOffset("j")} * ${C.get("position_id","bsnh[3]")}; + ${y.setByOffset("j","im")} + } else { + let k = dot(bsnh, uniforms.input_output_strides) + half_rotary_emb_dim; + ${y.setByOffset("k",w.getByOffset("k"))} + } + }`};return{name:"RotaryEmbedding",shaderCache:{hint:$t({interleaved:t}).cacheKey,inputDependencies:["rank","rank","rank","rank"]},getShaderSource:v,getRunData:()=>({outputs:[{dims:e[0].dims,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(be.size(c)/io)},programUniforms:f})}},qy=(e,r)=>{Gg(e.inputs,r),e.compute(ga(e.inputs,r))}}),Kg,Hg,du,qg,Qy,Ax=Re(()=>{Jt(),ut(),dd(),Wy(),Hy(),Js(),Xy(),_t(),Kg=(e,r)=>{if(r.doRotary&&e.length<=7)throw new Error("cos_cache and sin_cache inputs are required if do_rotary is specified");let t=e[0],s=e[1],o=e[2],n=e[3],i=e[4];if(r.doRotary!==0&&e.length<=7)throw new Error("cos_cast and sin_cache are expected if do_rotary attribute is non-zero");if(r.localWindowSize!==-1)throw new Error("Local attention is not supported");if(r.softcap!==0)throw new Error("Softcap is not supported");if(r.rotaryInterleaved!==0)throw new Error("Rotary interleaved is not supported");if(r.smoothSoftmax)throw new Error("Smooth softmax is not supported");if(t.dims.length!==3&&t.dims.length!==5)throw new Error("Input query is expected to have 3 or 5 dimensions");let a=!1,l=t.dims[0],u=t.dims[1],p=t.dims.length===3?a?t.dims[2]/3:t.dims[2]:r.numHeads*t.dims[4],d=u,c=0,_=!s||s.dims.length===0,f=Math.floor(_?p/(r.numHeads+2*r.kvNumHeads):p/r.numHeads);_&&(p=f*r.numHeads);let v=n&&n.dims.length!==0,$=i&&i.dims.length!==0;if(v&&n.dims.length===4&&n.dims[0]===l&&n.dims[1]!==r.kvNumHeads&&n.dims[2]===r.kvNumHeads&&n.dims[3]===f)throw new Error("BSNH pastKey/pastValue is not supported");if(v&&$){if(n.dims.length!==4)throw new Error('Input "past_key" is expected to have 4 dimensions');if(i.dims.length!==4)throw new Error('Input "past_value" is expected to have 4 dimensions');c=n.dims[2]}else if(v||$)throw new Error('Input "past_key" and "past_value" shall be both present or both absent');let w=1;if(s&&s.dims.length>0){if(t.dims.length!==3)throw new Error('Input "query" is expected to have 3 dimensions when key is given');if(s.dims.length<3||s.dims.length>5)throw new Error('Input "key" is expected to have 3, 4, or 5 dimensions');if(t.dims[0]!==s.dims[0])throw new Error('Input "query" and "key" shall have same dim 0 (batch size)');if(s.dims.length===3){if(t.dims[2]%s.dims[2]!==0)throw new Error('Dimension 2 of "query" should be a multiple of "key"');d=s.dims[1]}else if(s.dims.length===5){if(s.dims[2]!==r.numHeads||s.dims[3]!==2||s.dims[4]!==f)throw new Error('Expect "key" shape (batch_size, kv_sequence_length, num_heads, 2, head_size) for packed kv');if(o)throw new Error('Expect "value" be none when "key" has packed kv format.');d=s.dims[1]}else{if(s.dims[1]!==r.numHeads||s.dims[3]!==f)throw new Error('Expect "key" shape (batch_size, num_heads, kv_sequence_length, head_size) for past_key');d=s.dims[2]}}else{if(t.dims.length!==3&&t.dims.length!==5)throw new Error('Input "query" is expected to have 3 or 5 dimensions when key is empty');if(t.dims.length===5&&(t.dims[2]!==r.numHeads||t.dims[3]!==3))throw new Error('Expect "query" shape (batch_size, kv_sequence_length, num_heads, 3, head_size) for packed kv');w=3}let g=0,C=!1,E=r.kvNumHeads?f*r.kvNumHeads:p;if(o&&o.dims.length>0){if(o.dims.length!==3&&o.dims.length!==4)throw new Error('Input "value" is expected to have 3 or 4 dimensions');if(t.dims[0]!==o.dims[0])throw new Error('Input "query" and "value" shall have same dim 0 (batch_size)');if(o.dims.length===3){if(d!==o.dims[1])throw new Error('Input "key" and "value" shall have the same dim 1 (kv_sequence_length)');E=o.dims[2]}else{if(d!==o.dims[2])throw new Error('Input "past_key" and "past_value" shall have the same dim 2 (kv_sequence_length)');E=o.dims[1]*o.dims[3],C=!0}}let y=e.length>4?e[5]:void 0;if(y&&y.dims.length!==1&&y.dims[0]!==l)throw new Error('Input "seqlens" is expected to have 1 dimension and the same dim 0 as batch_size');return{batchSize:l,sequenceLength:u,pastSequenceLength:c,kvSequenceLength:d,totalSequenceLength:-1,maxSequenceLength:-1,inputHiddenSize:0,hiddenSize:p,vHiddenSize:E,headSize:f,vHeadSize:Math.floor(E/r.kvNumHeads),numHeads:r.numHeads,kvNumHeads:r.kvNumHeads,nReps:r.numHeads/r.kvNumHeads,pastPresentShareBuffer:!1,maskType:g,scale:r.scale,broadcastResPosBias:!1,passPastInKv:C,qkvFormat:w}},Hg=$t({perm:[0,2,1,3]}),du=(e,r,t)=>{let s=r,o=t.kvNumHeads;return r.dims.length===3&&t.kvSequenceLength!==0&&(s=r.reshape([t.batchSize,t.kvSequenceLength,o,t.headSize]),s=e.compute(Vr(s,Hg.perm),{inputs:[s],outputs:[-1]})[0]),s},qg=(e,r,t,s)=>{let o=7,n=["type","type"],i=[e*r],a=e*r,l=[{type:12,data:a},{type:12,data:r},{type:12,data:e}],u=p=>{let d=Pe("seq_lens",t.dataType,t.dims),c=Pe("total_seq_lens",s.dataType,s.dims),_=Ze("pos_ids",o,i),f=[{name:"output_size",type:"u32"},{name:"sequence_length",type:"u32"},{name:"batch_size",type:"u32"}];return` + ${p.registerUniforms(f).declareVariables(d,c,_)} + ${p.mainStart()} + ${p.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let total_sequence_length = u32(${c.getByOffset("0")}); + let is_subsequent_prompt = uniforms.sequence_length > 1 && uniforms.sequence_length != total_sequence_length; + let is_first_prompt = !is_subsequent_prompt && uniforms.sequence_length == total_sequence_length; + let batch_idx = global_idx / uniforms.sequence_length; + let sequence_idx = i32(global_idx % uniforms.sequence_length); + var pos_id: i32 = 0; + let seqlen = ${d.getByOffset("batch_idx")}; + let total_seqlen = seqlen + 1; + if (is_first_prompt) { + if (sequence_idx < total_seqlen) { + pos_id = sequence_idx; + } else { + pos_id = 1; + } + ${_.setByOffset("global_idx","pos_id")} + } else if (is_subsequent_prompt) { + let past_seqlen = total_seqlen - i32(uniforms.sequence_length); + if (past_seqlen + sequence_idx < total_seqlen) { + pos_id = past_seqlen + sequence_idx; + } else { + pos_id = 1; + } + ${_.setByOffset("global_idx","pos_id")} + } else if (global_idx < uniforms.batch_size) { + ${_.setByOffset("global_idx","seqlen")} + }; + } + `};return{name:"GeneratePositionIds",shaderCache:{hint:`${e};${r}`,inputDependencies:n},getRunData:()=>({outputs:[{dims:i,dataType:o}],dispatchGroup:{x:Math.ceil(a/64)},programUniforms:l}),getShaderSource:u}},Qy=(e,r)=>{var E;let t=Kg(e.inputs,r);if(e.inputs[0].dims.length===5)throw new Error("Packed QKV is not implemented");if(((E=e.inputs[1])==null?void 0:E.dims.length)===5)throw new Error("Packed KV is not implemented");let s=e.inputs[0],o=e.inputs[1]&&e.inputs[1].dims.length>0?e.inputs[1]:void 0,n=e.inputs[2]&&e.inputs[2].dims.length>0?e.inputs[2]:void 0,i=e.inputs[3]&&e.inputs[3].dims.length!==0?e.inputs[3]:void 0,a=e.inputs[4]&&e.inputs[4].dims.length!==0?e.inputs[4]:void 0,l=e.inputs.length>4?e.inputs[5]:void 0,u=e.inputs.length>5?e.inputs[6]:void 0,p=t.kvNumHeads?t.kvNumHeads:t.numHeads,d=$t({axis:2,numOutputs:3,splitSizes:[t.numHeads*t.headSize,p*t.headSize,p*t.headSize]}),[c,_,f]=!o&&!n?e.compute(Gu([s],d),{inputs:[s],outputs:[-1,-1,-1]}):[s,o,n],v,$;if(r.doRotary){let y=e.compute(qg(t.batchSize,t.sequenceLength,l,u),{inputs:[l,u],outputs:[-1]})[0],b=e.inputs[7],x=e.inputs[8],S=$t({interleaved:r.rotaryInterleaved!==0,numHeads:t.numHeads,rotaryEmbeddingDim:0,scale:r.scale}),A=[c,y,b,x],B=[-1];v=e.compute(ga(A,S),{inputs:A,outputs:B})[0],A.splice(0,1,_);let K=$t({interleaved:r.rotaryInterleaved!==0,numHeads:t.kvNumHeads,rotaryEmbeddingDim:0,scale:r.scale});$=e.compute(ga(A,K),{inputs:A,outputs:B})[0]}let w=Xo(e,t.batchSize,t.numHeads,t.sequenceLength,t.headSize,r.doRotary?v:c,void 0,0),g=du(e,r.doRotary?$:_,t),C=du(e,f,t);Zo(e,w,g,C,void 0,void 0,i,a,void 0,t,l,u)}}),cu,Xg,Qg,Jy,Fx=Re(()=>{ut(),ft(),Js(),_t(),cu=(e,r,t,s,o,n,i,a)=>{let l=qt(n),u=l===1?"f32":`vec${l}f`,p=l===1?"vec2f":`mat2x${l}f`,d=o*i,c=64;d===1&&(c=256);let _=[o,i,n/l],f=[o,i,2],v=["rank","type","type"],$=[];$.push(...st(_,f));let w=g=>{let C=Pe("x",r.dataType,3,l),E=Pe("scale",t.dataType,t.dims),y=Pe("bias",s.dataType,s.dims),b=Ze("output",1,3,2),x=[C,E,y,b];return` + var workgroup_shared : array<${p}, ${c}>; + const workgroup_size = ${c}u; + ${g.declareVariables(...x)} + ${g.mainStart(c)} + let batch = workgroup_index / uniforms.x_shape[1]; + let channel = workgroup_index % uniforms.x_shape[1]; + let hight = uniforms.x_shape[2]; + // initialize workgroup memory + var sum = ${u}(0); + var squared_sum = ${u}(0); + for (var h = local_idx; h < hight; h += workgroup_size) { + let value = ${u}(${C.get("batch","channel","h")}); + sum += value; + squared_sum += value * value; + } + workgroup_shared[local_idx] = ${p}(sum, squared_sum); + workgroupBarrier(); + + for (var currSize = workgroup_size >> 1; currSize > 0; currSize = currSize >> 1) { + if (local_idx < currSize) { + workgroup_shared[local_idx] = workgroup_shared[local_idx] + workgroup_shared[local_idx + currSize]; + } + workgroupBarrier(); + } + if (local_idx == 0) { + let sum_final = ${Qs("workgroup_shared[0][0]",l)} / f32(hight * ${l}); + let squared_sum_final = ${Qs("workgroup_shared[0][1]",l)} / f32(hight * ${l}); + + let inv_std_dev = inverseSqrt(squared_sum_final - sum_final * sum_final + f32(${a})); + let channel_scale = inv_std_dev * f32(scale[channel]); + let channel_shift = f32(bias[channel]) - sum_final * channel_scale; + output[workgroup_index] = vec2f(channel_scale, channel_shift); + } + }`};return e.compute({name:"InstanceNormComputeChannelScaleShift",shaderCache:{hint:`${l};${a};${c}`,inputDependencies:v},getRunData:()=>({outputs:[{dims:f,dataType:1}],dispatchGroup:{x:d},programUniforms:$}),getShaderSource:w},{inputs:[r,t,s],outputs:[-1]})[0]},Xg=(e,r,t)=>{let s=r[0].dims,o=s,n=2,i=s[0],a=s[1],l=be.sizeFromDimension(s,n),u=qt(l),p=be.size(o)/u,d=cu(e,r[0],r[1],r[2],i,l,a,t.epsilon),c=[i,a,l/u],_=[i,a],f=["type","none"],v=$=>{let w=Pe("x",r[0].dataType,c.length,u),g=Pe("scale_shift",1,_.length,2),C=Ze("output",r[0].dataType,c.length,u),E=[w,g,C];return` + ${$.registerUniform("output_size","u32").declareVariables(...E)} + ${$.mainStart()} + ${$.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let outputIndices = ${C.offsetToIndices("global_idx")}; + let batch = outputIndices[0]; + let channel = outputIndices[1]; + let scale_shift = ${g.getByIndices("vec2(batch, channel)")}; + let value = ${w.getByOffset("global_idx")} * ${C.type.value}(scale_shift.x) + ${C.type.value}(scale_shift.y); + ${C.setByOffset("global_idx","value")}; + }`};e.compute({name:"InstanceNormalization",shaderCache:{hint:`${u}`,inputDependencies:f},getRunData:()=>({outputs:[{dims:o,dataType:r[0].dataType}],dispatchGroup:{x:Math.ceil(p/64)},programUniforms:[{type:12,data:p},...st(c,_,c)]}),getShaderSource:v},{inputs:[r[0],d]})},Qg=(e,r,t)=>{let s=r[0].dims,o=s,n=s[0],i=s[s.length-1],a=be.sizeFromDimension(s,1)/i,l=qt(i),u=be.size(o)/l,p=[{type:12,data:a},{type:12,data:Math.floor(i/l)}],d=["type","type"],c=!1,_=[0,s.length-1];for(let w=0;ws[_[g]])),v=cu(e,f,r[1],r[2],n,a,i,t.epsilon),$=w=>{let g=mr(r[0].dataType),C=l===1?"vec2f":`mat${l}x2f`,E=x=>{let S=x===0?"x":"y",A=l===1?"f32":`vec${l}f`;switch(l){case 1:return`${g}(${A}(scale.${S}))`;case 2:return`vec2<${g}>(${A}(scale[0].${S}, scale[1].${S}))`;case 4:return`vec4<${g}>(${A}(scale[0].${S}, scale[1].${S}, scale[2].${S}, scale[3].${S}))`;default:throw new Error(`Not supported compoents ${l}`)}},y=Pe("input",r[0].dataType,r[0].dims,l),b=Ze("output",r[0].dataType,o,l);return` + @group(0) @binding(0) var input : array<${y.type.storage}>; + @group(0) @binding(1) var scale_input : array<${C}>; + @group(0) @binding(2) var output : array<${b.type.storage}>; + struct Uniforms {H: u32, C : u32}; + @group(0) @binding(3) var uniforms: Uniforms; + + ${w.mainStart()} + let current_image_number = global_idx / (uniforms.C * uniforms.H); + let current_channel_number = global_idx % uniforms.C; + + let scale_offset = current_image_number * uniforms.C + current_channel_number; + let scale = scale_input[scale_offset]; + output[global_idx] = fma(input[global_idx], ${E(0)}, ${E(1)}); + }`};e.compute({name:"InstanceNormalizationNHWC",shaderCache:{hint:`${l}`,inputDependencies:d},getRunData:()=>({outputs:[{dims:o,dataType:r[0].dataType}],dispatchGroup:{x:Math.ceil(u/64)},programUniforms:p}),getShaderSource:$},{inputs:[r[0],v]})},Jy=(e,r)=>{r.format==="NHWC"?Qg(e,e.inputs,r):Xg(e,e.inputs,r)}}),Jg,Yg,Yy,Ox=Re(()=>{ut(),ft(),_t(),Jg=e=>{if(!e||e.length<2)throw new Error("layerNorm requires at least 2 inputs.")},Yg=(e,r,t)=>{let s=r.simplified,o=e[0].dims,n=e[1],i=!s&&e[2],a=o,l=be.normalizeAxis(r.axis,o.length),u=be.sizeToDimension(o,l),p=be.sizeFromDimension(o,l),d=be.size(n.dims),c=i?be.size(i.dims):0;if(d!==p||i&&c!==p)throw new Error(`Size of X.shape()[axis:] == ${p}. + Size of scale and bias (if provided) must match this. + Got scale size of ${d} and bias size of ${c}`);let _=[];for(let y=0;y1,g=t>2,C=y=>{let b=mr(e[0].dataType),x=[Pe("x",e[0].dataType,e[0].dims,f),Pe("scale",n.dataType,n.dims,f)];i&&x.push(Pe("bias",i.dataType,i.dims,f)),x.push(Ze("output",e[0].dataType,a,f)),w&&x.push(Ze("mean_data_output",1,_)),g&&x.push(Ze("inv_std_output",1,_));let S=[{name:"norm_count",type:"u32"},{name:"norm_size",type:"f32"},{name:"norm_size_vectorized",type:"u32"},{name:"epsilon",type:"f32"}];return` + ${y.registerUniforms(S).declareVariables(...x)} + ${y.mainStart()} + ${y.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.norm_count")} + let offset = global_idx * uniforms.norm_size_vectorized; + var mean_vector = ${Lu("f32",f)}; + var mean_square_vector = ${Lu("f32",f)}; + + for (var h: u32 = 0u; h < uniforms.norm_size_vectorized; h++) { + let value = ${no(b,f,"x[h + offset]")}; + mean_vector += value; + mean_square_vector += value * value; + } + let mean = ${Qs("mean_vector",f)} / uniforms.norm_size; + let inv_std_dev = inverseSqrt(${Qs("mean_square_vector",f)} / uniforms.norm_size ${s?"":"- mean * mean"} + uniforms.epsilon); + + for (var j: u32 = 0; j < uniforms.norm_size_vectorized; j++) { + let f32input = ${no(b,f,"x[j + offset]")}; + let f32scale = ${no(b,f,"scale[j]")}; + output[j + offset] = ${x[0].type.value}((f32input ${s?"":"- mean"}) * inv_std_dev * f32scale + ${i?`+ ${no(b,f,"bias[j]")}`:""} + ); + } + + ${w?"mean_data_output[global_idx] = mean":""}; + ${g?"inv_std_output[global_idx] = inv_std_dev":""}; + }`},E=[{dims:a,dataType:e[0].dataType}];return w&&E.push({dims:_,dataType:1}),g&&E.push({dims:_,dataType:1}),{name:"LayerNormalization",shaderCache:{hint:`${f};${t};${s}`,inputDependencies:v},getRunData:()=>({outputs:E,dispatchGroup:{x:Math.ceil(u/64)},programUniforms:$}),getShaderSource:C}},Yy=(e,r)=>{Jg(e.inputs),e.compute(Yg(e.inputs,r,e.outputCount))}}),Zg,Zy,Dx=Re(()=>{ft(),fd(),_d(),Zg=e=>{if(!e||e.length!==2)throw new Error("MatMul requires 2 inputs.");if(e[0].dims[e[0].dims.length-1]!==e[1].dims[e[1].dims.length-2])throw new Error("shared dimension does not match.")},Zy=e=>{Zg(e.inputs);let r=oo.calcShape(e.inputs[0].dims,e.inputs[1].dims,!0);if(!r)throw new Error("Can't use matmul on the given tensors");let t=r[r.length-1],s=e.inputs[0].dims[e.inputs[0].dims.length-1];if(t<8&&s<8)e.compute(md(e.inputs,{activation:""},r));else{let o=r[r.length-2],n=be.size(e.inputs[0].dims.slice(0,-2)),i=be.size(e.inputs[1].dims.slice(0,-2));if(n!==1&&o===1&&i===1){let a=e.inputs[0].reshape([1,n,s]),l=e.inputs[1].reshape([1,s,t]),u=[1,n,t],p=[a,l];e.compute(_a(p,{activation:""},r,u),{inputs:p})}else e.compute(_a(e.inputs,{activation:""},r))}}}),ew,tw,rw,e0,t0,Lx=Re(()=>{ut(),ft(),Jt(),_t(),ew=(e,r)=>{if(e.length<3||e.length>4)throw new Error("MatMulNBits requires 3 or 4 inputs");let t=e[0],s=t.dims.length;if(t.dims[s-1]!==r.k)throw new Error("The last dim of input shape does not match the k value");let o=Math.floor((r.k+r.blockSize-1)/r.blockSize),n=r.blockSize/8*r.bits,i=e[1];if(!be.areEqual(i.dims,[r.n,o,n]))throw new Error("The second inputs must be 3D tensor with shape N X nBlocksPerCol X blobSize");let a=e[2].dims;if(be.size(a)!==r.n*o)throw new Error("scales input size error.");if(e.length===4){let l=e[3].dims,u=r.bits>4?r.n*o:r.n*Math.floor((o+1)/2);if(be.size(l)!==u)throw new Error("zeroPoints input size error.")}},tw=(e,r)=>{let t=e[0].dims,s=t.length,o=t[s-2],n=r.k,i=r.n,a=t.slice(0,s-2),l=be.size(a),u=e[1].dims[2]/4,p=e[0].dataType,d=qt(r.k),c=qt(u),_=qt(i),f=a.concat([o,i]),v=o>1&&i/_%2===0?2:1,$=be.size(f)/_/v,w=64,g=[],C=[l,o,n/d],E=be.convertShape(e[1].dims).slice();E.splice(-1,1,u/c),g.push(...st(C)),g.push(...st(E)),g.push(...st(e[2].dims)),e.length===4&&g.push(...st(be.convertShape(e[3].dims)));let y=[l,o,i/_];g.push(...st(y));let b=x=>{let S=C.length,A=Pe("a",e[0].dataType,S,d),B=Pe("b",12,E.length,c),K=Pe("scales",e[2].dataType,e[2].dims.length),G=[A,B,K],j=e.length===4?Pe("zero_points",12,e[3].dims.length):void 0;j&&G.push(j);let ee=y.length,H=Ze("output",e[0].dataType,ee,_),Z=mr(e[0].dataType),X=(()=>{switch(d){case 1:return`array<${Z}, 8>`;case 2:return`mat4x2<${Z}>`;case 4:return`mat2x4<${Z}>`;default:throw new Error(`${d}-component is not supported.`)}})(),oe=()=>{let V=` + // reuse a data + var input_offset = ${A.indicesToOffset(`${A.type.indices}(batch, row, word_offset)`)}; + var a_data: ${X}; + for (var j: u32 = 0; j < ${8/d}; j++) { + a_data[j] = ${A.getByOffset("input_offset")}; + input_offset++; + } + `;for(let F=0;F<_*v;F++)V+=` + b_value = ${c===1?`b${F}_data`:`b${F}_data[i]`}; + b_value_lower = unpack4xU8(b_value & b_mask); + b_value_upper = unpack4xU8((b_value >> 4) & b_mask); + b_quantized_values = ${X}(${Array.from({length:4},(W,re)=>`${Z}(b_value_lower[${re}]), ${Z}(b_value_upper[${re}])`).join(", ")}); + b_dequantized_values = ${d===1?`${X}(${Array.from({length:8},(W,re)=>`(b_quantized_values[${re}] - ${j?`zero_point${F}`:"zero_point"}) * scale${F}`).join(", ")});`:`(b_quantized_values - ${X}(${Array(8).fill(`${j?`zero_point${F}`:"zero_point"}`).join(",")})) * scale${F};`}; + workgroup_shared[local_id.x * ${v} + ${Math.floor(F/_)}]${_>1?`[${F%_}]`:""} += ${Array.from({length:8/d},(W,re)=>`${d===1?`a_data[${re}] * b_dequantized_values[${re}]`:`dot(a_data[${re}], b_dequantized_values[${re}])`}`).join(" + ")}; + `;return V},me=()=>{let V=` + var col_index = col * ${_}; + ${j?` + let zero_point_bytes_per_col = (nBlocksPerCol + 1) / 2; + var zero_point_byte_count: u32; + var zero_point_word_index: u32; + var zero_point_byte_offset: u32; + let zero_point_nibble_offset: u32 = block & 0x1u; + var zero_point_bits_offset: u32; + var zero_point_word: u32;`:` + // The default zero point is 8 for unsigned 4-bit quantization. + let zero_point = ${Z}(8);`} + `;for(let F=0;F<_*v;F++)V+=` + let scale${F} = ${K.getByOffset("col_index * nBlocksPerCol + block")}; + ${j?` + zero_point_byte_count = col_index * zero_point_bytes_per_col + (block >> 0x1u); + zero_point_word_index = zero_point_byte_count >> 0x2u; + zero_point_byte_offset = zero_point_byte_count & 0x3u; + zero_point_bits_offset = (zero_point_byte_offset << 3) + (zero_point_nibble_offset << 2); + zero_point_word = ${j.getByOffset("zero_point_word_index")} >> zero_point_bits_offset; + let zero_point${F} = ${Z}((zero_point_word) & 0xFu);`:""} + col_index += 1;`;return V},ae=()=>{let V=`col_index = col * ${_};`;for(let F=0;F<_*v;F++)V+=` + let b${F}_data = ${B.getByIndices(`${B.type.indices}(col_index, block, word)`)}; + col_index += 1;`;return V+=` + var b_value: u32; + let b_mask: u32 = 0x0F0F0F0Fu; + var b_value_lower: vec4; + var b_value_upper: vec4; + var b_quantized_values: ${X}; + var b_dequantized_values: ${X};`,V};return` + var workgroup_shared: array<${H.type.value}, ${v*w}>; + ${x.declareVariables(...G,H)} + ${x.mainStart([w,1,1])} + let output_indices = ${H.offsetToIndices(`(global_idx / ${w}) * ${v}`)}; + let col = output_indices[2]; + let row = output_indices[1]; + let batch = output_indices[0]; + let nBlocksPerCol = uniforms.b_shape[1]; + + for (var block = local_id.x; block < nBlocksPerCol; block += ${w}) { + //process one block + var word_offset: u32 = block * ${r.blockSize/d}; + ${me()} + for (var word: u32 = 0; word < ${u}; word += ${c}) { + ${ae()} + for (var i: u32 = 0; i < ${c}; i++) { + ${oe()} + word_offset += ${8/d}; + } + } + } + workgroupBarrier(); + + if (local_id.x < ${v}) { + var output_value: ${H.type.value} = ${H.type.value}(0); + var workgroup_shared_offset: u32 = local_id.x; + for (var b: u32 = 0u; b < ${w}u; b++) { + output_value += workgroup_shared[workgroup_shared_offset]; + workgroup_shared_offset += ${v}; + } + ${H.setByIndices(`${H.type.indices}(batch, row, col + local_id.x)`,"output_value")}; + } + }`};return{name:"MatMulNBits",shaderCache:{hint:`${r.blockSize};${r.bits};${d};${c};${_};${v};${w}`,inputDependencies:Array(e.length).fill("rank")},getRunData:()=>({outputs:[{dims:f,dataType:p}],dispatchGroup:{x:$},programUniforms:g}),getShaderSource:b}},rw=(e,r)=>{let t=e[0].dims,s=t.length,o=t[s-2],n=r.k,i=r.n,a=t.slice(0,s-2),l=be.size(a),u=e[1].dims[2]/4,p=e[0].dataType,d=qt(r.k),c=qt(u),_=a.concat([o,i]),f=128,v=i%8===0?8:i%4===0?4:1,$=f/v,w=$*c*8,g=w/d,C=w/r.blockSize,E=be.size(_)/v,y=[],b=[l,o,n/d],x=be.convertShape(e[1].dims).slice();x.splice(-1,1,u/c),y.push(...st(b)),y.push(...st(x)),y.push(...st(e[2].dims)),e.length===4&&y.push(...st(be.convertShape(e[3].dims)));let S=[l,o,i];y.push(...st(S));let A=B=>{let K=b.length,G=Pe("a",e[0].dataType,K,d),j=Pe("b",12,x.length,c),ee=Pe("scales",e[2].dataType,e[2].dims.length),H=[G,j,ee],Z=e.length===4?Pe("zero_points",12,e[3].dims.length):void 0;Z&&H.push(Z);let X=S.length,oe=Ze("output",e[0].dataType,X),me=mr(e[0].dataType),ae=()=>{switch(d){case 1:return` + let a_data0 = vec4<${me}>(sub_a[word_offset], sub_a[word_offset + 1], sub_a[word_offset + 2], sub_a[word_offset + 3]); + let a_data1 = vec4<${me}>(sub_a[word_offset + 4], sub_a[word_offset + 5], sub_a[word_offset + 6], sub_a[word_offset + 7]);`;case 2:return` + let a_data0 = vec4<${me}>(sub_a[word_offset], sub_a[word_offset + 1]); + let a_data1 = vec4<${me}>(sub_a[word_offset + 2], sub_a[word_offset + 3]);`;case 4:return` + let a_data0 = sub_a[word_offset]; + let a_data1 = sub_a[word_offset + 1];`;default:throw new Error(`${d}-component is not supported.`)}};return` + var sub_a: array<${G.type.value}, ${g}>; + var inter_results: array, ${v}>; + ${B.declareVariables(...H,oe)} + ${B.mainStart([$,v,1])} + let output_indices = ${oe.offsetToIndices(`workgroup_index * ${v}`)}; + let col = output_indices[2]; + let row = output_indices[1]; + let batch = output_indices[0]; + let n_blocks_per_col = uniforms.b_shape[1]; + let num_tiles = (n_blocks_per_col - 1) / ${C} + 1; + + // Loop over shared dimension. + for (var tile: u32 = 0; tile < num_tiles; tile += 1) { + let a_col_start = tile * ${g}; + // load one tile A data into shared memory. + for (var a_offset = local_idx; a_offset < ${g}; a_offset += ${f}) + { + let a_col = a_col_start + a_offset; + if (a_col < uniforms.a_shape[2]) + { + sub_a[a_offset] = ${G.getByIndices(`${G.type.indices}(batch, row, a_col)`)}; + } else { + sub_a[a_offset] = ${G.type.value}(0); + } + } + workgroupBarrier(); + + // each thread process one block + let b_row = col + local_id.y; + let block = tile * ${C} + local_id.x; + ${Z?` + let zero_point_bytes_per_col = (n_blocks_per_col + 1) / 2; + let zero_point_byte_count = b_row * zero_point_bytes_per_col + (block >> 0x1u); + let zero_point_word_index = zero_point_byte_count >> 0x2u; + let zero_point_byte_offset = zero_point_byte_count & 0x3u; + let zero_point_nibble_offset: u32 = block & 0x1u; + let zero_point_bits_offset = (zero_point_byte_offset << 3) + (zero_point_nibble_offset << 2); + let zero_point_word = ${Z.getByOffset("zero_point_word_index")} >> zero_point_bits_offset; + let zero_point = ${me}((zero_point_word) & 0xFu);`:` + // The default zero point is 8 for unsigned 4-bit quantization. + let zero_point = ${me}(8);`} + let scale = ${ee.getByOffset("b_row * n_blocks_per_col + block")}; + let b_data = ${j.getByIndices(`${j.type.indices}(b_row, block, 0)`)}; + var word_offset = local_id.x * ${r.blockSize/d}; + for (var i: u32 = 0; i < ${c}; i++) { + ${ae()} + let b_value = ${c===1?"b_data":"b_data[i]"}; + let b_value_lower = unpack4xU8(b_value & 0x0F0F0F0Fu); + let b_value_upper = unpack4xU8((b_value >> 4) & 0x0F0F0F0Fu); + let b_quantized_values = mat2x4<${me}>(${Array.from({length:4},(V,F)=>`${me}(b_value_lower[${F}]), ${me}(b_value_upper[${F}])`).join(", ")}); + let b_dequantized_values = (b_quantized_values - mat2x4<${me}>(${Array(8).fill("zero_point").join(",")})) * scale; + inter_results[local_id.y][local_id.x] += ${Array.from({length:2},(V,F)=>`${`dot(a_data${F}, b_dequantized_values[${F}])`}`).join(" + ")}; + word_offset += ${8/d}; + } + workgroupBarrier(); + } + + if (local_idx < ${v}) { + var output_value: ${oe.type.value} = ${oe.type.value}(0); + for (var b = 0u; b < ${$}; b++) { + output_value += inter_results[local_idx][b]; + } + if (col + local_idx < uniforms.output_shape[2]) + { + ${oe.setByIndices(`${oe.type.indices}(batch, row, col + local_idx)`,"output_value")} + } + } + }`};return{name:"BlockwiseMatMulNBits32",shaderCache:{hint:`${r.blockSize};${d};${c};${$};${v}`,inputDependencies:Array(e.length).fill("rank")},getRunData:()=>({outputs:[{dims:_,dataType:p}],dispatchGroup:{x:E},programUniforms:y}),getShaderSource:A}},e0=(e,r)=>{ew(e.inputs,r),r.blockSize===32&&e.adapterInfo.isVendor("intel")&&e.adapterInfo.isArchitecture("gen-12lp")?e.compute(rw(e.inputs,r)):e.compute(tw(e.inputs,r))},t0=e=>$t(e)}),sw,nw,ow,iw,aw,lw,uw,dw,r0,zx=Re(()=>{ut(),ft(),_t(),sw=e=>{if(!e||e.length<1)throw new Error("Too few inputs");if(e[0].dataType!==1&&e[0].dataType!==10)throw new Error("Input type must be float or float16.");if(e.length>=2){let r=e[0].dims.length*2===e[1].dims[0];if(e.length===4&&(r=e[3].dims[0]*2===e[1].dims[0]),!r)throw new Error("The pads should be a 1D tensor of shape [2 * input_rank] or [2 * num_axes].")}},nw=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` + k = i32(${e.indicesGet("indices",o)}) - ${rt("uniforms.pads",o,t)}; + if (k < 0) { + break; + } + if (k >= i32(${rt("uniforms.x_shape",o,r)})) { + break; + } + offset += k * i32(${rt("uniforms.x_strides",o,r)}); + `;return` + value = ${e.type.value}(uniforms.constant_value); + for (var i = 0; i < 1; i++) { + var offset = 0; + var k = 0; + ${s} + value = x[offset]; + } + `},ow=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` + k = i32(${e.indicesGet("indices",o)}) - ${rt("uniforms.pads",o,t)}; + if (k < 0) { + k = -k; + } + { + let _2n_1 = 2 * (i32(${rt("uniforms.x_shape",o,r)}) - 1); + k = k % _2n_1; + if(k >= i32(${rt("uniforms.x_shape",o,r)})) { + k = _2n_1 - k; + } + } + offset += k * i32(${rt("uniforms.x_strides",o,r)}); + `;return` + var offset = 0; + var k = 0; + ${s} + value = x[offset]; + `},iw=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` + k = i32(${e.indicesGet("indices",o)}) - ${rt("uniforms.pads",o,t)}; + if (k < 0) { + k = 0; + } + if (k >= i32(${rt("uniforms.x_shape",o,r)})) { + k = i32(${rt("uniforms.x_shape",o,r)}) - 1; + } + offset += k * i32(${rt("uniforms.x_strides",o,r)}); + `;return` + var offset = 0; + var k = 0; + ${s} + value = x[offset]; + `},aw=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` + k = i32(${e.indicesGet("indices",o)}) - ${rt("uniforms.pads",o,t)}; + if (k < 0) { + k += i32(${rt("uniforms.x_shape",o,r)}]); + } + if (k >= i32(${rt("uniforms.x_shape",o,r)})) { + k -= i32(${rt("uniforms.x_shape",o,r)}); + } + offset += k * i32(${rt("uniforms.x_strides",o,r)}); + `;return` + var offset = 0; + var k = 0; + ${s} + value = x[offset]; + `},lw=(e,r,t)=>{switch(t.mode){case 0:return nw(e,r,t.pads.length);case 1:return ow(e,r,t.pads.length);case 2:return iw(e,r,t.pads.length);case 3:return aw(e,r,t.pads.length);default:throw new Error("Invalid mode")}},uw=(e,r)=>{let t=be.padShape(e[0].dims.slice(),r.pads),s=e[0].dims,o=be.size(t),n=[{type:12,data:o},{type:6,data:r.pads}],i=e.length>=3&&e[2].data;r.mode===0&&n.push({type:i?e[2].dataType:1,data:r.value}),n.push(...st(e[0].dims,t));let a=["rank"],l=u=>{let p=Ze("output",e[0].dataType,t.length),d=Pe("x",e[0].dataType,s.length),c=d.type.value,_=lw(p,s.length,r),f=[{name:"output_size",type:"u32"},{name:"pads",type:"i32",length:r.pads.length}];return r.mode===0&&f.push({name:"constant_value",type:i?c:"f32"}),` + ${u.registerUniforms(f).declareVariables(d,p)} + ${u.mainStart()} + ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let indices = ${p.offsetToIndices("global_idx")}; + + var value = ${c}(0); + ${_} + output[global_idx] = value; + }`};return{name:"Pad",shaderCache:{hint:`${r.mode}${i}`,inputDependencies:a},getRunData:()=>({outputs:[{dims:t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(be.size(t)/64)},programUniforms:n}),getShaderSource:l}},dw=(e,r)=>{if(e.length>1){let t=e[1].getBigInt64Array(),s=e.length>=3&&e[2].data?e[2].dataType===10?e[2].getUint16Array()[0]:e[2].getFloat32Array()[0]:0,o=e[0].dims.length,n=new Int32Array(2*o).fill(0);if(e.length>=4){let a=e[3].getBigInt64Array();for(let l=0;ln[Number(l)]=Number(a));let i=[];return n.forEach(a=>i.push(a)),{mode:r.mode,value:s,pads:i}}else return r},r0=(e,r)=>{sw(e.inputs);let t=dw(e.inputs,r);e.compute(uw(e.inputs,t),{inputs:[0]})}}),Vo,pu,hu,mu,fu,cw,pw,_u,gu,s0,n0,wu,o0,i0,bu,a0,l0,u0,d0,Bx=Re(()=>{_s(),ut(),ft(),_t(),Vo=e=>{if(jt.webgpu.validateInputContent&&(!e||e.length!==1))throw new Error("Pool ops requires 1 input.")},pu=(e,r,t)=>{let s=r.format==="NHWC",o=e.dims.slice();s&&o.splice(1,0,o.pop());let n=Object.hasOwnProperty.call(r,"dilations"),i=r.kernelShape.slice(),a=r.strides.slice(),l=n?r.dilations.slice():[],u=r.pads.slice();ma.adjustPoolAttributes(t,o,i,a,l,u);let p=ma.computePoolOutputShape(t,o,a,l,i,u,r.autoPad),d=Object.assign({},r);n?Object.assign(d,{kernelShape:i,strides:a,pads:u,dilations:l,cacheKey:r.cacheKey}):Object.assign(d,{kernelShape:i,strides:a,pads:u,cacheKey:r.cacheKey});let c=p.slice();return c.push(c.splice(1,1)[0]),[d,s?c:p]},hu=(e,r)=>{let t=r.format==="NHWC",s=be.size(e),o=be.size(r.kernelShape),n=[{type:12,data:s},{type:12,data:o}],i=[{name:"outputSize",type:"u32"},{name:"kernelSize",type:"u32"}];if(r.kernelShape.length<=2){let a=r.kernelShape[r.kernelShape.length-1],l=r.strides[r.strides.length-1],u=r.pads[r.pads.length/2-1],p=r.pads[r.pads.length-1],d=!!(u+p);n.push({type:12,data:a},{type:12,data:l},{type:12,data:u},{type:12,data:p}),i.push({name:"kw",type:"u32"},{name:"sw",type:"u32"},{name:"pwStart",type:"u32"},{name:"pwEnd",type:"u32"});let c=!1;if(r.kernelShape.length===2){let _=r.kernelShape[r.kernelShape.length-2],f=r.strides[r.strides.length-2],v=r.pads[r.pads.length/2-2],$=r.pads[r.pads.length-2];c=!!(v+$),n.push({type:12,data:_},{type:12,data:f},{type:12,data:v},{type:12,data:$}),i.push({name:"kh",type:"u32"},{name:"sh",type:"u32"},{name:"phStart",type:"u32"},{name:"phEnd",type:"u32"})}return[n,i,!0,d,c]}else{if(t)throw new Error("Pooling with kernelShape.length > 2 is not supported for NHWC format.");let a=be.computeStrides(r.kernelShape);n.push({type:12,data:a},{type:12,data:r.pads},{type:12,data:r.strides}),i.push({name:"kernelStrides",type:"u32",length:a.length},{name:"pads",type:"u32",length:r.pads.length},{name:"strides",type:"u32",length:r.strides.length});let l=r.pads.reduce((u,p)=>u+p);return[n,i,!!l,!1,!1]}},mu=(e,r,t,s,o,n,i,a,l,u,p,d)=>{let c=o.format==="NHWC",_=r.type.value,f=Ze("output",r.type.tensor,s);if(o.kernelShape.length<=2){let v="",$="",w="",g=t-(c?2:1);if(p?v=` + for (var i: u32 = 0u; i < uniforms.kw; i++) { + xIndices[${g}] = indices[${g}] * uniforms.sw - uniforms.pwStart + i; + if (xIndices[${g}] < 0 || xIndices[${g}] + >= uniforms.x_shape[${g}]) { + pad++; + continue; + } + let x_val = x[${r.indicesToOffset("xIndices")}]; + ${n} + }`:v=` + for (var i: u32 = 0u; i < uniforms.kw; i++) { + xIndices[${g}] = indices[${g}] * uniforms.sw - uniforms.pwStart + i; + let x_val = x[${r.indicesToOffset("xIndices")}]; + ${n} + }`,o.kernelShape.length===2){let C=t-(c?3:2);d?$=` + for (var j: u32 = 0u; j < uniforms.kh; j++) { + xIndices[${C}] = indices[${C}] * uniforms.sh - uniforms.phStart + j; + if (xIndices[${C}] < 0 || xIndices[${C}] >= uniforms.x_shape[${C}]) { + pad += i32(uniforms.kw); + continue; + } + `:$=` + for (var j: u32 = 0u; j < uniforms.kh; j++) { + xIndices[${C}] = indices[${C}] * uniforms.sh - uniforms.phStart + j; + `,w=` + } + `}return` + ${e.registerUniforms(l).declareVariables(r,f)} + + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + + let indices = ${f.offsetToIndices("global_idx")}; + var xIndices = ${f.offsetToIndices("global_idx")}; + + var value = ${_}(${a}); + var pad = 0; + ${$} + ${v} + ${w} + ${i} + + output[global_idx] = value; + }`}else{if(c)throw new Error("Pooling with kernelShape.length > 2 is not supported for NHWC format.");let v=o.kernelShape.length,$=o.pads.length,w="";return u?w=` + if (xIndices[j] >= uniforms.x_shape[j]) { + pad++; + isPad = true; + break; + } + } + if (!isPad) { + let x_val = x[${r.indicesToOffset("xIndices")}]; + ${n} + }`:w=` + } + let x_val = x[${r.indicesToOffset("xIndices")}]; + ${n} + `,` + ${e.registerUniforms(l).declareVariables(r,f)} + + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + let indices = ${f.offsetToIndices("global_idx")}; + var xIndices = ${f.offsetToIndices("global_idx")}; + + var offsets: array; + + var value = ${_}(${a}); + var pad = 0; + var isPad = false; + + for (var i: u32 = 0u; i < uniforms.kernelSize; i++) { + var offset = i; + for (var j = 0u; j < ${v-1}u; j++) { + offsets[j] = offset / ${rt("uniforms.kernelStrides","j",v)}; + offset -= offsets[j] * ${rt("uniforms.kernelStrides","j",v)}; + } + offsets[${v-1}] = offset; + + isPad = false; + for (var j = ${t-v}u; j < ${t}u; j++) { + xIndices[j] = indices[j] * ${rt("uniforms.strides",`j - ${t-v}u`,v)} + + offsets[j - ${t-v}u] - ${rt("uniforms.pads","j - 2u",$)}; + ${w} + } + ${i} + + output[global_idx] = value; + }`}},fu=e=>`${e.format};${e.ceilMode};${e.autoPad};${e.kernelShape.length}`,cw=e=>`${fu(e)};${e.countIncludePad}`,pw=e=>`${fu(e)};${e.storageOrder};${e.dilations}`,_u=e=>({format:e.format,autoPad:["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][e.auto_pad],ceilMode:e.ceil_mode,kernelShape:e.kernel_shape,strides:e.strides,pads:e.pads}),gu=(e,r,t,s)=>{let[o,n]=pu(r,s,t),i=Pe("x",r.dataType,r.dims.length),a=i.type.value,l="value += x_val;",u="";o.countIncludePad?u+=`value /= ${a}(uniforms.kernelSize);`:u+=`value /= ${a}(i32(uniforms.kernelSize) - pad);`;let[p,d,c,_,f]=hu(n,o);p.push(...st(r.dims,n));let v=["rank"];return{name:e,shaderCache:{hint:`${s.cacheKey};${c};${_};${f}`,inputDependencies:v},getRunData:()=>({outputs:[{dims:n,dataType:r.dataType}],dispatchGroup:{x:Math.ceil(be.size(n)/64)},programUniforms:p}),getShaderSource:$=>mu($,i,r.dims.length,n.length,o,l,u,0,d,c,_,f)}},s0=e=>{let r=e.count_include_pad!==0,t=_u(e);if(t.ceilMode!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");let s={countIncludePad:r,...t,cacheKey:""};return{...s,cacheKey:cw(s)}},n0=(e,r)=>{Vo(e.inputs),e.compute(gu("AveragePool",e.inputs[0],!1,r))},wu={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[]},o0=e=>{let r=e.format;return{format:r,...wu,cacheKey:r}},i0=(e,r)=>{Vo(e.inputs),e.compute(gu("GlobalAveragePool",e.inputs[0],!0,r))},bu=(e,r,t,s)=>{let[o,n]=pu(r,s,t),i=` + value = max(x_val, value); + `,a="",l=Pe("x",r.dataType,r.dims.length),u=["rank"],[p,d,c,_,f]=hu(n,o);return p.push(...st(r.dims,n)),{name:e,shaderCache:{hint:`${s.cacheKey};${c};${_};${f}`,inputDependencies:u},getRunData:()=>({outputs:[{dims:n,dataType:r.dataType}],dispatchGroup:{x:Math.ceil(be.size(n)/64)},programUniforms:p}),getShaderSource:v=>mu(v,l,r.dims.length,n.length,o,i,a,r.dataType===10?-65504:-1e5,d,c,_,f)}},a0=(e,r)=>{Vo(e.inputs),e.compute(bu("MaxPool",e.inputs[0],!1,r))},l0=e=>{let r=e.storage_order,t=e.dilations,s=_u(e);if(r!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(s.ceilMode!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");let o={storageOrder:r,dilations:t,...s,cacheKey:""};return{...o,cacheKey:pw(o)}},u0=e=>{let r=e.format;return{format:r,...wu,cacheKey:r}},d0=(e,r)=>{Vo(e.inputs),e.compute(bu("GlobalMaxPool",e.inputs[0],!0,r))}}),hw,mw,c0,p0,Rx=Re(()=>{ut(),ft(),Jt(),_t(),hw=(e,r)=>{if(e.length<2||e.length>3)throw new Error("DequantizeLinear requires 2 or 3 inputs.");if(e.length===3&&e[1].dims===e[2].dims)throw new Error("x-scale and x-zero-point must have the same shape.");if(e.length===3&&e[0].dataType!==e[2].dataType)throw new Error("x and x-zero-point must have the same data type.");if(e[0].dataType===6&&e.length>2)throw new Error("In the case of dequantizing int32 there is no zero point.");if(e[1].dims.length!==0&&e[1].dims.length!==1&&e[1].dims.length!==e[0].dims.length)throw new Error("scale input must be a scalar, a 1D tensor, or have the same rank as the input tensor.");if(e.length>2){if(e[0].dataType!==e[2].dataType)throw new Error("x and x-zero-point must have the same data type.");if(e[1].dims.length!==e[2].dims.length)throw new Error("scale and zero-point inputs must have the same rank.");if(!e[1].dims.map((t,s)=>t===e[2].dims[s]).reduce((t,s)=>t&&s,!0))throw new Error("scale and zero-point inputs must have the same shape.")}if(r.blockSize>0){if(e[1].dims.length===0||e[1].dims.length===1&&e[1].dims[0]===1)throw new Error("blockSize must be set only for block quantization.");if(!e[1].dims.map((o,n)=>n===r.axis||o===e[0].dims[n]).reduce((o,n)=>o&&n,!0))throw new Error("For block qunatization, scale input shape to match the input shape except for the axis");if(e[1].dims.length!==e[0].dims.length)throw new Error("For block qunatization the scale input rank must be the same as the x rank.");let t=e[0].dims[r.axis],s=e[1].dims[r.axis];if(r.blockSizeMath.ceil(t/(s-1)-1))throw new Error("blockSize must be with in the range [ceil(dI / Si), ceil(dI / (Si - 1) - 1)].")}},mw=(e,r)=>{let t=be.normalizeAxis(r.axis,e[0].dims.length),s=e[0].dataType,o=s===3,n=e[0].dims,i=e[1].dataType,a=be.size(n),l=s===3||s===2,u=l?[Math.ceil(be.size(e[0].dims)/4)]:e[0].dims,p=e[1].dims,d=e.length>2?e[2]:void 0,c=d?l?[Math.ceil(be.size(d.dims)/4)]:d.dims:void 0,_=p.length===0||p.length===1&&p[0]===1,f=_===!1&&p.length===1,v=qt(a),$=_&&(!l||v===4),w=$?v:1,g=$&&!l?v:1,C=Pe("input",l?12:s,u.length,g),E=Pe("scale",i,p.length),y=d?Pe("zero_point",l?12:s,c.length):void 0,b=Ze("output",i,n.length,w),x=[C,E];y&&x.push(y);let S=[u,p];d&&S.push(c);let A=[{type:12,data:a/w},{type:12,data:t},{type:12,data:r.blockSize},...st(...S,n)],B=K=>{let G=[{name:"output_size",type:"u32"},{name:"axis",type:"u32"},{name:"block_size",type:"u32"}];return` + ${K.registerUniforms(G).declareVariables(...x,b)} + ${K.mainStart()} + ${K.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let output_indices = ${b.offsetToIndices("global_idx")}; + + // Set input x + ${l?` + let input = ${C.getByOffset("global_idx / 4")}; + let x_vec = ${o?"unpack4xI8(input)":"unpack4xU8(input)"}; + let x_value = ${w===1?"x_vec[global_idx % 4]":"x_vec"};`:`let x_value = ${C.getByOffset("global_idx")};`}; + + // Set scale input + ${_?`let scale_value= ${E.getByOffset("0")}`:f?` + let scale_index = ${b.indicesGet("output_indices","uniforms.axis")}; + let scale_value= ${E.getByOffset("scale_index")};`:` + var scale_indices: ${E.type.indices} = output_indices; + let index = ${E.indicesGet("scale_indices","uniforms.axis")} / uniforms.block_size; + ${E.indicesSet("scale_indices","uniforms.axis","index")}; + let scale_value= ${E.getByIndices("scale_indices")};`}; + + // Set zero-point input + ${y?_?l?` + let zero_point_input = ${y.getByOffset("0")}; + let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; + let zero_point_value= zero_point_vec[0]`:`let zero_point_value = ${y.getByOffset("0")}`:f?l?` + let zero_point_index = ${b.indicesGet("output_indices","uniforms.axis")}; + let zero_point_input = ${y.getByOffset("zero_point_index / 4")}; + let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; + let zero_point_value = zero_point_vec[zero_point_index % 4]`:` + let zero_point_index = ${b.indicesGet("output_indices","uniforms.axis")}; + let zero_point_value = ${y.getByOffset("zero_point_index")};`:l?` + let zero_point_offset = ${E.indicesToOffset("scale_indices")}; + let zero_point_input = ${y.getByOffset("zero_point_offset / 4")}; + let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; + let zero_point_value = zero_point_vec[zero_point_offset % 4];`:`let zero_point_value = ${y.getByIndices("scale_indices")};`:`let zero_point_value = ${l?o?"i32":"u32":C.type.value}(0);`}; + // Compute and write output + ${b.setByOffset("global_idx",`${b.type.value}(x_value - zero_point_value) * scale_value`)}; + }`};return{name:"DequantizeLinear",shaderCache:{hint:r.cacheKey,inputDependencies:y?["rank","rank","rank"]:["rank","rank"]},getShaderSource:B,getRunData:()=>({outputs:[{dims:n,dataType:i}],dispatchGroup:{x:Math.ceil(a/w/64),y:1,z:1},programUniforms:A})}},c0=(e,r)=>{hw(e.inputs,r),e.compute(mw(e.inputs,r))},p0=e=>$t({axis:e.axis,blockSize:e.blockSize})}),fw,_w,h0,jx=Re(()=>{_s(),ut(),_t(),fw=(e,r,t)=>{let s=e===r,o=er&&t>0;if(s||o||n)throw new Error("Range these inputs' contents are invalid.")},_w=(e,r,t,s)=>{let o=Math.abs(Math.ceil((r-e)/t)),n=[o],i=o,a=[{type:12,data:i},{type:s,data:e},{type:s,data:t},...st(n)],l=u=>{let p=Ze("output",s,n.length),d=p.type.value,c=[{name:"outputSize",type:"u32"},{name:"start",type:d},{name:"delta",type:d}];return` + ${u.registerUniforms(c).declareVariables(p)} + ${u.mainStart()} + ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + output[global_idx] = uniforms.start + ${d}(global_idx) * uniforms.delta; + }`};return{name:"Range",shaderCache:{hint:`${s}`},getShaderSource:l,getRunData:()=>({outputs:[{dims:n,dataType:s}],dispatchGroup:{x:Math.ceil(i/64)},programUniforms:a})}},h0=e=>{let r=0,t=0,s=0;e.inputs[0].dataType===6?(r=e.inputs[0].getInt32Array()[0],t=e.inputs[1].getInt32Array()[0],s=e.inputs[2].getInt32Array()[0]):e.inputs[0].dataType===1&&(r=e.inputs[0].getFloat32Array()[0],t=e.inputs[1].getFloat32Array()[0],s=e.inputs[2].getFloat32Array()[0]),jt.webgpu.validateInputContent&&fw(r,t,s),e.compute(_w(r,t,s,e.inputs[0].dataType),{inputs:[]})}}),gw,Mu,yu,ww,m0,f0,Nx=Re(()=>{ut(),ft(),Jt(),_t(),gw=(e,r,t,s)=>{if(e!=="none"&&s!=="i32"&&s!=="u32"&&s!=="f32")throw new Error(`Input ${s} is not supported with reduction ${e}.`);let o=`{ + var oldValue = 0; + loop { + let newValueF32 =`,n=`; + let newValue = bitcast(newValueF32); + let res = atomicCompareExchangeWeak(&${r}, oldValue, newValue); + if res.exchanged { + break; + } + oldValue = res.old_value; + } + }`;switch(e){case"none":return`${r}=${t};`;case"add":return s==="i32"||s==="u32"?`atomicAdd(&${r}, bitcast<${s}>(${t}));`:` + ${o}bitcast<${s}>(oldValue) + (${t})${n}`;case"max":return s==="i32"||s==="u32"?`atomicMax(&${r}, bitcast<${s}>(${t}));`:` + ${o}max(bitcast(oldValue), (${t}))${n}`;case"min":return s==="i32"||s==="u32"?`atomicMin(&${r}, bitcast<${s}>(${t}));`:`${o}min(bitcast<${s}>(oldValue), (${t}))${n}`;case"mul":return`${o}(bitcast<${s}>(oldValue) * (${t}))${n}`;default:throw new Error(`Reduction ${e} is not supported.`)}},Mu=(e,r)=>`${e===1?` + let element_count_dim = uniforms.output_strides; + let dim_value = uniforms.output_shape;`:` + let element_count_dim = uniforms.output_strides[${r?"i - indices_start":"i"}]; + let dim_value = uniforms.output_shape[${r?"i - indices_start":"i"} + uniforms.last_index_dimension];`} + + if (index >= 0) { + if (index >= i32(dim_value)) { + index = i32(dim_value - 1); + } + } else { + if (index < -i32(dim_value)) { + index = 0; + } else { + index += i32(dim_value); + } + } + data_offset += u32((u32(index) * element_count_dim));`,yu=(e,r,t)=>`for (var i = 0u; i < uniforms.num_updates_elements; i++) { + let value = updates[uniforms.num_updates_elements * ${t?"global_idx":"idx"} + i]; + ${gw(e.reduction,"output[data_offset + i]","value",r)} + }`,ww=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t,n=1,i=Math.ceil(be.size(s)/n),a=s[s.length-1],l=be.sizeFromDimension(t,a),u=be.sizeFromDimension(s,0)/a,p=[{type:12,data:i},{type:12,data:a},{type:12,data:l},...st(e[1].dims,e[2].dims,o)],d=c=>{let _=Pe("indices",e[1].dataType,e[1].dims.length),f=Pe("updates",e[2].dataType,e[2].dims.length,n),v=r.reduction!=="none"&&r.reduction!==""?Ub("output",e[0].dataType,o.length):Ze("output",e[0].dataType,o.length,n);return` + ${c.registerUniform("output_size","u32").registerUniform("last_index_dimension","u32").registerUniform("num_updates_elements","u32").declareVariables(_,f,v)} + ${c.mainStart()} + ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + var hasDuplicates = false; + if (${r.reduction==="none"}) { + for (var i = 0; i < ${u}; i = i + 1) { + for (var j = i + 1; j < ${u}; j = j + 1) { + var index_i = i32(indices[i].x); + var index_j = i32(indices[j].x); + if (index_i == index_j) { + hasDuplicates = true; + break; + } + } + if (hasDuplicates) { + break; + } + } + } + + if (${r.reduction==="none"} && hasDuplicates) { + if (global_idx != 0u) { + return; + } + // Process each index-update pair individually when duplicates exist + for (var idx = 0u; idx < ${u}u; idx++) { + var data_offset = 0u; + for (var i = 0u; i < uniforms.last_index_dimension; i++) { + var index = i32(indices[idx * uniforms.last_index_dimension + i].x); + ${Mu(t.length,!1)} + } + ${yu(r,v.type.value,!1)} + } + return; + } + + var data_offset = 0u; + var indices_start = uniforms.last_index_dimension * global_idx; + var indices_end = indices_start + uniforms.last_index_dimension; + for (var i = indices_start; i < indices_end; i++) { + var index = i32(indices[i].x); + ${Mu(t.length,!0)} + } + ${yu(r,v.type.value,!0)} + }`};return{name:"ScatterND",shaderCache:{hint:`${r.cacheKey}_${r.reduction}`,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:o,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(i/64)},programUniforms:p}),getShaderSource:d}},m0=e=>$t({reduction:e.reduction}),f0=(e,r)=>{e.compute(ww(e.inputs,r),{inputs:[e.inputs[1],e.inputs[2]],outputs:[]})}}),bw,Mw,yw,vu,vw,xw,Tw,Ew,Pw,Cw,Sw,$w,xu,kw,Iw,Aw,Fw,Ow,_0,g0,Vx=Re(()=>{ut(),ft(),Jt(),_t(),bw=(e,r)=>{if(e.every(t=>t>0||(()=>{throw new Error("Resize requires scales input values to be positive")})),e.length>0){if(r.mode==="linear"){if(!(e.length===2||e.length===3||e.length===4&&e[0]===1&&e[1]===1||e.length===4&&e[0]===1&&e[3]===1||e.length===5&&e[0]===1&&e[1]===1))throw new Error(`For linear mode, Resize requires scales to be 2D, 3D, 4D with either two outermost or one innermost and + one outermost scale values equal to 1, or 5D with two outermost scale values equal to 1`)}else if(r.mode==="cubic"&&!(e.length===2||e.length===4&&e[0]===1&&e[1]===1||e.length===4&&e[0]===1&&e[3]===1))throw new Error("Resize requires scales input size to be 2 or 4 for cubic mode")}},Mw=(e,r,t)=>{r.every(o=>o>=0&&o{throw new Error("Resize requires axes input values to be positive and less than rank")}));let s=new Array(t).fill(1);return r.forEach((o,n)=>s[o]=e[n]),s},yw=(e,r,t,s,o,n)=>{let[i,a,l]=t>10?[1,2,3]:[-1,e.length>1?1:-1,-1],u=e[0].dims.length;if(i>0&&e.length>i&&e[i].dims.length>0)e[i].getFloat32Array().forEach(p=>n.push(p));else if(r.coordinateTransformMode==="tf_crop_and_resize")throw new Error("Resize requires RoI input to be specified when coordinateTransformMode is tfCropAndResize");if(a>0&&e.length>a&&e[a].dims.length===1&&e[a].dims[0]>0){if(e[a].getFloat32Array().forEach(p=>s.push(p)),s.length!==0&&s.length!==u&&t>=18&&s.length!==r.axes.length)throw new Error("Resize requires scales input size to be same as input rank or axes size for opset 18 and up");bw(s,r),r.axes.length>0&&Mw(s,r.axes,u).forEach((p,d)=>s[d]=p)}if(l>0&&e.length>l&&e[l].dims.length===1&&e[l].dims[0]>0&&(e[l].getBigInt64Array().forEach(p=>o.push(Number(p))),o.length!==0&&o.length!==u&&t>=18&&o.length!==r.axes.length))throw new Error("Resize requires sizes input size to be same as input rank or axes size for opset 18 and up");if(r.axes.length>0){if(s.length!==0&&s.length!==r.axes.length)throw new Error('Resize requires "scales" input size to be of axes rank when axes attributes is specified');if(o.length!==0&&o.length!==r.axes.length)throw new Error('Resize requires "sizes" input size to be of rank axes rank when axes attributes is specified')}if(typeof s<"u"&&typeof o<"u"&&s.length>0&&o.length>u)throw new Error("Resize requires only of scales or sizes to be specified")},vu=(e,r,t,s)=>` + // The whole part and the fractional part are calculated separately due to inaccuracy of floating + // point division. As an example, f32(21) / f32(7) may evaluate to 2.99... instead of 3, causing an + // offset-by-one error later in floor(). + let big = (${e}) * (${r}); + let whole = ${s}(big / (${t})); + let fract = ${s}(big % (${t})) / ${s}(${t}); + return whole + fract; +`,vw=(e,r)=>`fn getOriginalCoordinateFromResizedCoordinate(xResized: u32, xScale: f32, lengthResized: u32, + lengthOriginal: u32, roiStart: f32, roiEnd: f32) -> ${r} { `+(()=>{switch(e){case"asymmetric":return` + if (xScale < 1.0 || floor(xScale) != xScale) { + return ${r}(xResized) / ${r}(xScale); + } else { + ${vu("xResized","lengthOriginal","lengthResized",r)} + } + `;case"pytorch_half_pixel":return`if (lengthResized > 1) { + return (${r}(xResized) + 0.5) / ${r}(xScale) - 0.5; + } else { + return 0.0; + }`;case"tf_half_pixel_for_nn":return`return (${r}(xResized) + 0.5) / ${r}(xScale);`;case"align_corners":return`if (lengthResized == 1) { + return 0.0; + } else { + ${vu("xResized","lengthOriginal - 1","lengthResized - 1",r)} + }`;case"tf_crop_and_resize":return`if (lengthResized > 1) { + return ${r}(roiStart) * ${r}(lengthOriginal - 1) + + (${r}(xResized) * ${r}(roiEnd - roiStart) * ${r}(lengthOriginal - 1)) / + ${r}(lengthResized - 1); + } else { + return 0.5 * ${r}(roiStart + roiEnd) * ${r}(lengthOriginal - 1); + }`;case"half_pixel_symmetric":return`const outputWidth = ${r}xScale * ${r}(lengthResized); + const adjustment = ${r}(lengthResized) / outputWidth; + const center = ${r}(lengthOriginal) / 2; + const offset = center * (1 - adjustment); + return offset + ((${r}(xResized) + 0.5) / ${r}(xScale)) - 0.5;`;case"half_pixel":return`return ((${r}(xResized) + 0.5) / ${r}(xScale)) - 0.5;`;default:throw new Error(`Coordinate transform mode ${e} is not supported`)}})()+"}",xw=(e,r,t)=>`fn getNearestPixelFromOriginal(xOriginal: ${t}, isDownSample: bool) -> ${t} {`+(()=>{switch(e){case"round_prefer_ceil":return"if (fract(xOriginal) == 0.5) { return ceil(xOriginal); } else { return round(xOriginal); }";case"floor":return"return floor(xOriginal);";case"ceil":return"return ceil(xOriginal);";case"round_prefer_floor":return"if (fract(xOriginal) == 0.5) { return floor(xOriginal); } else { return round(xOriginal); }";case"simple":default:if(r<11)return"if (isDownSample) { return ceil(xOriginal); } else { return xOriginal; }";throw new Error(`Nearest mode ${e} is not supported`)}})()+"}",Tw=(e,r,t)=>{let s=new Array(t).fill(0).concat(new Array(t).fill(1)),o=e.length===0?s:e.slice();return r.length>0?(r.forEach((n,i)=>{s[n]=o[i],s[i+t]=o[r.length+i]}),s):o},Ew=(e,r,t,s)=>{let o=[];if(t.length>0)if(s.length>0){if(e.forEach(n=>o.push(n)),Math.max(...s)>e.length)throw new Error("axes is out of bound");s.forEach((n,i)=>o[n]=t[i])}else t.forEach(n=>o.push(n));else{if(r.length===0)throw new Error("Resize requires either scales or sizes.");o=e.map((n,i)=>Math.round(n*r[i]))}return o},Pw=(e,r,t)=>{let s=(()=>{switch(t.keepAspectRatioPolicy){case"not_larger":return t.axes.length>0?Math.min(...t.axes.map(n=>r[n]),Number.MAX_VALUE):Math.min(...r,Number.MAX_VALUE);case"not_smaller":return t.axes.length>0?Math.max(...t.axes.map(n=>r[n]),Number.MIN_VALUE):Math.max(...r,Number.MIN_VALUE);default:throw new Error(`Keep aspect ratio policy ${t.keepAspectRatioPolicy} is not supported`)}})();r.fill(1,0,r.length);let o=e.slice();return t.axes.length>0?(t.axes.forEach(n=>r[n]=s),t.axes.forEach(n=>o[n]=Math.round(e[n]*r[n]))):(r.fill(s,0,r.length),o.forEach((n,i)=>o[i]=Math.round(n*r[i]))),o},Cw=(e,r,t,s,o)=>` + fn calculateOriginalIndicesFromOutputIndices(output_indices: ${e.type.indices}) -> array<${e.type.value}, ${t.length}> { + var original_indices: array<${e.type.value}, ${t.length}>; + for (var i:u32 = 0; i < ${t.length}; i++) { + var output_index = ${e.indicesGet("output_indices","i")}; + var scale = ${rt("uniforms.scales","i",s)}; + var roi_low = ${rt("uniforms.roi","i",o)}; + var roi_hi = ${rt("uniforms.roi",`i + ${r.length}`,o)}; + if (scale == 1.0) { + original_indices[i] = ${e.type.value}(output_index); + } else { + var input_shape_i = ${rt("uniforms.input_shape","i",r.length)}; + var output_shape_i = ${rt("uniforms.output_shape","i",t.length)}; + original_indices[i] = getOriginalCoordinateFromResizedCoordinate(output_index, scale, output_shape_i, + input_shape_i, roi_low, roi_hi); + } + } + return original_indices; + }`,Sw=(e,r,t,s,o,n,i)=>` + fn calculateInputIndicesFromOutputIndices(output_indices: ${r.type.indices}) -> ${e.type.indices} { + var input_indices: ${e.type.indices}; + for (var i:u32 = 0; i < ${s.length}; i++) { + var output_index = ${r.indicesGet("output_indices","i")}; + var input_index: u32; + var scale = ${rt("uniforms.scales","i",o)}; + if (scale == 1.0) { + input_index = output_index; + } else { + var roi_low = ${rt("uniforms.roi","i",n)}; + var roi_hi = ${rt("uniforms.roi",`i + ${t.length}`,n)}; + var input_shape_i = ${rt("uniforms.input_shape","i",t.length)}; + var output_shape_i = ${rt("uniforms.output_shape","i",s.length)}; + var original_idx = getOriginalCoordinateFromResizedCoordinate(output_index, scale, output_shape_i, + input_shape_i, roi_low, roi_hi); + if (!${i} || (original_idx >= 0 && original_idx < ${r.type.value}(input_shape_i))) { + if (original_idx < 0) { + input_index = 0; + } else if (original_idx > ${r.type.value}(input_shape_i - 1)) { + input_index = input_shape_i - 1; + } else { + input_index = u32(getNearestPixelFromOriginal(original_idx, scale < 1)); + } + } else { + input_index = u32(original_idx); + } + } + ${e.indicesSet("input_indices","i","input_index")} + } + return input_indices; + }`,$w=(e,r)=>` + fn checkInputIndices(input_indices: ${e.type.indices}) -> bool { + for (var i:u32 = 0; i < ${r.length}; i++) { + var input_index = ${e.indicesGet("input_indices","i")}; + if (input_index < 0 || input_index >= ${rt("uniforms.input_shape","i",r.length)}) { + return false; + } + } + return true; + }`,xu=(e,r,t,s)=>e.rank>s?` + ${e.indicesSet("input_indices",r,"channel")}; + ${e.indicesSet("input_indices",t,"batch")}; +`:"",kw=(e,r,t,s,o)=>{let[n,i,a,l]=t.length===2?[-1,0,1,-1]:[0,2,3,1],u=e.type.value;return` + fn getInputValue(batch: u32, channel: u32, row: u32, col: u32) -> ${u} { + var input_indices: ${e.type.indices}; + ${e.indicesSet("input_indices",i,`max(0, min(row, ${t[i]} - 1))`)}; + ${e.indicesSet("input_indices",a,`max(0, min(col, ${t[a]} - 1))`)}; + ${xu(e,l,n,2)} + return ${e.getByIndices("input_indices")}; + } + + fn bilinearInterpolation(output_indices: ${r.type.indices}) -> ${u} { + var originalIndices = calculateOriginalIndicesFromOutputIndices(output_indices); + var row:${u} = originalIndices[${i}]; + var col:${u} = originalIndices[${a}]; + ${s?`if (row < 0 || row > (${t[i]} - 1) || col < 0 || col > (${t[a]} - 1)) { + return ${o}; + }`:""}; + row = max(0, min(row, ${t[i]} - 1)); + col = max(0, min(col, ${t[a]} - 1)); + var row1: u32 = u32(row); + var col1: u32 = u32(col); + var row2: u32 = u32(row + 1); + var col2: u32 = u32(col + 1); + var channel: u32 = ${t.length>2?`u32(originalIndices[${l}])`:"0"}; + var batch: u32 = ${t.length>2?`u32(originalIndices[${n}])`:"0"}; + var x11: ${u} = getInputValue(batch, channel, row1, col1); + var x12: ${u} = getInputValue(batch, channel, row1, col2); + var x21: ${u} = getInputValue(batch, channel, row2, col1); + var x22: ${u} = getInputValue(batch, channel, row2, col2); + var dx1: ${u} = abs(row - ${u}(row1)); + var dx2: ${u} = abs(${u}(row2) - row); + var dy1: ${u} = abs(col - ${u}(col1)); + var dy2: ${u} = abs(${u}(col2) - col); + if (row1 == row2) { + dx1 = 0.5; + dx2 = 0.5; + } + if (col1 == col2) { + dy1 = 0.5; + dy2 = 0.5; + } + return (x11 * dx2 * dy2 + x12 * dx2 * dy1 + x21 * dx1 * dy2 + x22 * dx1 * dy1); + }`},Iw=(e,r,t,s,o,n,i,a,l,u)=>{let p=t.length===2,[d,c]=p?[0,1]:[2,3],_=e.type.value,f=v=>{let $=v===d?"row":"col";return` + fn ${$}CubicInterpolation(input_indices: ${e.type.indices}, output_indices: ${r.type.indices}) -> ${_} { + var output_index = ${r.indicesGet("output_indices",v)}; + var originalIdx: ${_} = getOriginalCoordinateFromResizedCoordinate(output_index, ${o[v]}, + ${s[v]}, ${t[v]}, ${n[v]}, ${n[v]} + ${t.length}); + var fractOriginalIdx: ${_} = originalIdx - floor(originalIdx); + var coefs = getCubicInterpolationCoefs(fractOriginalIdx); + + if (${a} && (originalIdx < 0 || originalIdx > (${t[v]} - 1))) { + return ${l}; + } + var data: array<${_}, 4> = array<${_}, 4>(0.0, 0.0, 0.0, 0.0); + for (var i: i32 = -1; i < 3; i++) { + var ${$}: ${_} = originalIdx + ${_}(i); + if (${$} < 0 || ${$} >= ${t[v]}) { + ${u?`coefs[i + 1] = 0.0; + continue;`:a?`return ${l};`:`${$} = max(0, min(${$}, ${t[v]} - 1));`}; + } + var input_indices_copy: ${e.type.indices} = input_indices; + ${e.indicesSet("input_indices_copy",v,`u32(${$})`)}; + data[i + 1] = ${v===d?e.getByIndices("input_indices_copy"):"rowCubicInterpolation(input_indices_copy, output_indices)"}; + } + return cubicInterpolation1D(data, coefs); + }`};return` + ${f(d)}; + ${f(c)}; + fn getCubicInterpolationCoefs(s: ${_}) -> array<${_}, 4> { + var absS = abs(s); + var coeffs: array<${_}, 4> = array<${_}, 4>(0.0, 0.0, 0.0, 0.0); + var oneMinusAbsS: ${_} = 1.0 - absS; + var twoMinusAbsS: ${_} = 2.0 - absS; + var onePlusAbsS: ${_} = 1.0 + absS; + coeffs[0] = ((${i} * onePlusAbsS - 5 * ${i}) * onePlusAbsS + 8 * ${i}) * onePlusAbsS - 4 * ${i}; + coeffs[1] = ((${i} + 2) * absS - (${i} + 3)) * absS * absS + 1; + coeffs[2] = ((${i} + 2) * oneMinusAbsS - (${i} + 3)) * oneMinusAbsS * oneMinusAbsS + 1; + coeffs[3] = ((${i} * twoMinusAbsS - 5 * ${i}) * twoMinusAbsS + 8 * ${i}) * twoMinusAbsS - 4 * ${i}; + return coeffs; + } + + fn cubicInterpolation1D(x: array<${_}, 4>, coefs: array<${_}, 4>) -> ${_} { + var coefsSum: ${_} = coefs[0] + coefs[1] + coefs[2] + coefs[3]; + return (x[0] * coefs[0] + x[1] * coefs[1]+ x[2] * coefs[2]+ x[3] * coefs[3]) / coefsSum; + } + + fn bicubicInterpolation(output_indices: ${r.type.indices}) -> ${_} { + var input_indices: ${e.type.indices} = output_indices; + return colCubicInterpolation(input_indices, output_indices); + } + `},Aw=(e,r,t,s,o)=>{let[n,i,a,l,u]=t.length===3?[-1,0,1,2,-1]:[0,2,3,4,1],p=e.type.value;return` + fn getInputValue(batch: u32, channel: u32, depth:u32, height: u32, width: u32) -> ${p} { + var input_indices: ${e.type.indices}; + ${e.indicesSet("input_indices",i,`max(0, min(depth, ${t[i]} - 1))`)}; + ${e.indicesSet("input_indices",a,`max(0, min(height, ${t[a]} - 1))`)}; + ${e.indicesSet("input_indices",l,`max(0, min(width, ${t[l]} - 1))`)}; + ${xu(e,u,n,3)} + return ${e.getByIndices("input_indices")}; + } + + fn trilinearInterpolation(output_indices: ${r.type.indices}) -> ${p} { + var originalIndices = calculateOriginalIndicesFromOutputIndices(output_indices); + var depth:${p} = originalIndices[${i}]; + var height:${p} = originalIndices[${a}]; + var width:${p} = originalIndices[${l}]; + ${s?`if (depth < 0 || depth > (${t[i]} - 1) || height < 0 || height > (${t[a]} - 1) || width < 0 || (width > ${t[l]} - 1)) { + return ${o}; + }`:""}; + + depth = max(0, min(depth, ${t[i]} - 1)); + height = max(0, min(height, ${t[a]} - 1)); + width = max(0, min(width, ${t[l]} - 1)); + var depth1: u32 = u32(depth); + var height1: u32 = u32(height); + var width1: u32 = u32(width); + var depth2: u32 = u32(depth + 1); + var height2: u32 = u32(height + 1); + var width2: u32 = u32(width + 1); + var channel: u32 = ${t.length>3?`u32(originalIndices[${u}])`:"0"}; + var batch: u32 = ${t.length>3?`u32(originalIndices[${n}])`:"0"}; + + var x111: ${p} = getInputValue(batch, channel, depth1, height1, width1); + var x112: ${p} = getInputValue(batch, channel, depth1, height1, width2); + var x121: ${p} = getInputValue(batch, channel, depth1, height2, width1); + var x122: ${p} = getInputValue(batch, channel, depth1, height2, width2); + var x211: ${p} = getInputValue(batch, channel, depth2, height1, width1); + var x212: ${p} = getInputValue(batch, channel, depth2, height1, width2); + var x221: ${p} = getInputValue(batch, channel, depth2, height2, width1); + var x222: ${p} = getInputValue(batch, channel, depth2, height2, width2); + var dx1: ${p} = abs(depth - ${p}(depth1)); + var dx2: ${p} = abs(${p}(depth2) - depth); + var dy1: ${p} = abs(height - ${p}(height1)); + var dy2: ${p} = abs(${p}(height2) - height); + var dz1: ${p} = abs(width - ${p}(width1)); + var dz2: ${p} = abs(${p}(width2) - width); + if (depth1 == depth2) { + dx1 = 0.5; + dx2 = 0.5; + } + if (height1 == height2) { + dy1 = 0.5; + dy2 = 0.5; + } + if (width1 == width2) { + dz1 = 0.5; + dz2 = 0.5; + } + return (x111 * dx2 * dy2 * dz2 + x112 * dx2 * dy2 * dz1 + x121 * dx2 * dy1 *dz2 + x122 * dx2 * dy1 * dz1 + + x211 * dx1 * dy2 * dz2 + x212 * dx1 * dy2 * dz1 + x221 * dx1 * dy1 *dz2 + x222 * dx1 * dy1 * dz1); + }`},Fw=(e,r,t,s,o,n)=>{let i=e.dims,a=Tw(n,r.axes,i.length),l=Ew(i,s,o,r.axes),u=s.slice();s.length===0&&(u=i.map((g,C)=>g===0?1:l[C]/g),r.keepAspectRatioPolicy!=="stretch"&&(l=Pw(i,u,r)));let p=Ze("output",e.dataType,l.length),d=Pe("input",e.dataType,i.length),c=be.size(l),_=i.length===l.length&&i.every((g,C)=>g===l[C]),f=r.coordinateTransformMode==="tf_crop_and_resize",v=r.extrapolationValue,$=d.type.value,w=g=>` + ${_?"":` + ${vw(r.coordinateTransformMode,$)}; + ${(()=>{switch(r.mode){case"nearest":return` + ${$w(d,i)}; + ${xw(r.nearestMode,t,$)}; + ${Sw(d,p,i,l,u.length,a.length,f)}; + `;case"linear":return` + ${Cw(p,i,l,u.length,a.length)}; + ${(()=>{if(i.length===2||i.length===4)return`${kw(d,p,i,f,v)}`;if(i.length===3||i.length===5)return`${Aw(d,p,i,f,v)}`;throw Error("Linear mode only supports input dims 2, 3, 4 and 5 are supported in linear mode.")})()}; + `;case"cubic":return` + ${(()=>{if(i.length===2||i.length===4)return`${Iw(d,p,i,l,u,a,r.cubicCoeffA,f,r.extrapolationValue,r.excludeOutside)}`;throw Error("Cubic mode only supports input dims 2 and 4 are supported in linear mode.")})()}; + `;default:throw Error("Invalid resize mode")}})()}; + `} + ${g.registerUniform("output_size","u32").registerUniform("scales","f32",u.length).registerUniform("roi","f32",a.length).declareVariables(d,p)} + ${g.mainStart()} + ${g.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + ${_?"output[global_idx] = input[global_idx];":` + let output_indices = ${p.offsetToIndices("global_idx")}; + var input_indices: ${d.type.indices}; + ${(()=>{switch(r.mode){case"nearest":return`input_indices = calculateInputIndicesFromOutputIndices(output_indices); + if (checkInputIndices(input_indices)) { + output[global_idx] = ${d.getByIndices("input_indices")}; + } else { + output[global_idx] = ${r.extrapolationValue}; + }`;case"linear":return`output[global_idx] = ${i.length===2||i.length===4?"bilinearInterpolation":"trilinearInterpolation"}(output_indices);`;case"cubic":return"output[global_idx] = bicubicInterpolation(output_indices);";default:throw Error(`Unsupported resize mode: ${r.mode}`)}})()}; +`} + }`;return{name:"Resize",shaderCache:{hint:`${r.cacheKey}|${t}|${u.length>0?r.mode==="cubic"?u:u.length:""}|${o.length>0?o:""}|${a.length>0?a:""}|${_}|${r.mode==="nearest"?i.length:i}`,inputDependencies:["rank"]},getShaderSource:w,getRunData:()=>({outputs:[{dims:l,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:[{type:12,data:c},{type:1,data:u},{type:1,data:a},...st(i,l)]})}},Ow=e=>{let r=e.customDataBuffer;return new Uint32Array(r,r.byteOffset,1)[0]},_0=(e,r)=>{let t=[],s=[],o=[],n=Ow(e);if(r.antialias!==0)throw Error("Only default value (0) for Antialias attribute is supported");yw(e.inputs,r,n,t,s,o),e.compute(Fw(e.inputs[0],r,n,t,s,o),{inputs:[0]})},g0=e=>{let r=e.antialias,t=e.axes,s=e.coordinateTransformMode,o=e.cubicCoeffA,n=e.excludeOutside!==0,i=e.extrapolationValue,a=e.keepAspectRatioPolicy,l=e.mode,u=e.nearestMode===""?"simple":e.nearestMode;return $t({antialias:r,axes:t,coordinateTransformMode:s,cubicCoeffA:o,excludeOutside:n,extrapolationValue:i,keepAspectRatioPolicy:a,mode:l,nearestMode:u})}}),Dw,Lw,w0,Ux=Re(()=>{ut(),ft(),_t(),Dw=e=>{if(!e||e.length<3)throw new Error("layerNorm requires at least 3 inputs.");let r=e[0],t=e[1],s=e[2];if(r.dataType!==t.dataType||r.dataType!==s.dataType)throw new Error("All inputs must have the same data type");if(r.dims.length!==3&&r.dims.length!==2)throw new Error("Input must be 2D or 3D");if(t.dims.length!==3&&t.dims.length!==2)throw new Error("Skip must be 2D or 3D");let o=r.dims[r.dims.length-1],n=r.dims[r.dims.length-2];if(t.dims[t.dims.length-1]!==o)throw new Error("Skip must have the same hidden size as input");if(t.dims[t.dims.length-2]!==n)throw new Error("Skip must have the same sequence length as input");if(s.dims.length!==1)throw new Error("Gamma must be 1D");if(s.dims[s.dims.length-1]!==o)throw new Error("Gamma must have the same hidden size as input");if(e.length>3){let i=e[3];if(i.dims.length!==1)throw new Error("Beta must be 1D");if(i.dims[i.dims.length-1]!==o)throw new Error("Beta must have the same hidden size as input")}if(e.length>4){let i=e[4];if(i.dims.length!==1)throw new Error("Bias must be 1D");if(i.dims[i.dims.length-1]!==o)throw new Error("Bias must have the same hidden size as input")}},Lw=(e,r,t,s)=>{let o=r.simplified,n=e[0].dims,i=be.size(n),a=n,l=i,u=n.slice(-1)[0],p=s?n.slice(0,-1).concat(1):[],d=!o&&e.length>3,c=e.length>4,_=s&&t>1,f=s&&t>2,v=t>3,$=64,w=qt(u),g=[{type:12,data:l},{type:12,data:w},{type:12,data:u},{type:1,data:r.epsilon}],C=y=>{let b=[{name:"output_size",type:"u32"},{name:"components",type:"u32"},{name:"hidden_size",type:"u32"},{name:"epsilon",type:"f32"}],x=[Pe("x",e[0].dataType,e[0].dims,w),Pe("skip",e[1].dataType,e[1].dims,w),Pe("gamma",e[2].dataType,e[2].dims,w)];d&&x.push(Pe("beta",e[3].dataType,e[3].dims,w)),c&&x.push(Pe("bias",e[4].dataType,e[4].dims,w)),x.push(Ze("output",e[0].dataType,a,w)),_&&x.push(Ze("mean_output",1,p)),f&&x.push(Ze("inv_std_output",1,p)),v&&x.push(Ze("input_skip_bias_sum",e[0].dataType,a,w));let S=mr(e[0].dataType),A=mr(1,w);return` + + ${y.registerUniforms(b).declareVariables(...x)} + var sum_shared : array<${A}, ${$}>; + var sum_squared_shared : array<${A}, ${$}>; + + ${y.mainStart([$,1,1])} + let ix = local_id.x; + let iy = global_id.x / ${$}; + + let hidden_size_vectorized: u32 = uniforms.hidden_size / uniforms.components; + var stride = hidden_size_vectorized / ${$}; + let offset = ix * stride + iy * hidden_size_vectorized; + let offset1d = stride * ix; + if (ix == ${$-1}) { + stride = hidden_size_vectorized - stride * ix; + } + for (var i: u32 = 0; i < stride; i++) { + let skip_value = skip[offset + i]; + let bias_value = ${c?"bias[offset1d + i]":S+"(0.0)"}; + let input_value = x[offset + i]; + let value = input_value + skip_value + bias_value; + ${v?"input_skip_bias_sum[offset + i] = value;":""} + output[offset + i] = value; + let f32_value = ${no(S,w,"value")}; + sum_shared[ix] += f32_value; + sum_squared_shared[ix] += f32_value * f32_value; + } + workgroupBarrier(); + + var reduce_size : u32 = ${$}; + for (var curr_size = reduce_size >> 1; curr_size > 0; curr_size = reduce_size >> 1) { + reduce_size = curr_size + (reduce_size & 1); + if (ix < curr_size) { + sum_shared[ix] += sum_shared[ix + reduce_size]; + sum_squared_shared[ix] += sum_squared_shared[ix + reduce_size]; + } + workgroupBarrier(); + } + + let sum = sum_shared[0]; + let square_sum = sum_squared_shared[0]; + let mean = ${Qs("sum",w)} / f32(uniforms.hidden_size); + let inv_std_dev = inverseSqrt(${Qs("square_sum",w)} / f32(uniforms.hidden_size) ${o?"":"- mean * mean"} + uniforms.epsilon); + ${_?"mean_output[global_idx] = mean;":""} + ${f?"inv_std_output[global_idx] = inv_std_dev;":""} + + for (var i: u32 = 0; i < stride; i++) { + output[offset + i] = (output[offset + i] ${o?"":`- ${S}(mean)`}) * + ${S}(inv_std_dev) * gamma[offset1d + i] + ${d?"+ beta[offset1d + i]":""}; + } + }`},E=[{dims:a,dataType:e[0].dataType}];return t>1&&E.push({dims:p,dataType:1}),t>2&&E.push({dims:p,dataType:1}),t>3&&E.push({dims:n,dataType:e[0].dataType}),{name:"SkipLayerNormalization",shaderCache:{hint:`${w};${_};${f};${v}`,inputDependencies:e.map((y,b)=>"type")},getShaderSource:C,getRunData:()=>({outputs:E,dispatchGroup:{x:Math.ceil(l/u)},programUniforms:g})}},w0=(e,r)=>{Dw(e.inputs);let t=[0];e.outputCount>1&&t.push(-3),e.outputCount>2&&t.push(-3),e.outputCount>3&&t.push(3),e.compute(Lw(e.inputs,r,e.outputCount,!1),{outputs:t})}}),zw,Uo,Bw,Tu,Rw,jw,b0,M0,Wx=Re(()=>{ut(),ft(),Jt(),_t(),zw=(e,r)=>{if(!e||e.length<1)throw new Error("too few inputs");if(r.axes.length!==0){if(r.axes.length!==r.starts.length||r.axes.length!==r.ends.length)throw new Error("axes, starts and ends must have the same length")}else if(r.starts.length!==r.ends.length)throw new Error("starts and ends must have the same length");e.slice(1).forEach((t,s)=>{if(e[s+1].dataType!==6&&e[s+1].dataType!==7)throw new Error(`Input ${s} must be an array of int32 or int64`)})},Uo=(e,r)=>{let t=[];if(e.length>r)if(e[r].dataType===7)e[r].getBigInt64Array().forEach(s=>t.push(Number(s)));else if(e[r].dataType===6)e[r].getInt32Array().forEach(s=>t.push(Number(s)));else throw new Error(`Input ${r} must be an array of int32 or int64`);return t},Bw=(e,r)=>{if(e.length>1){let t=Uo(e,1),s=Uo(e,2),o=Uo(e,3);return o.length===0&&(o=[...Array(e[0].dims.length).keys()]),$t({starts:t,ends:s,axes:o})}else return r},Tu=(e,r,t,s,o)=>{let n=e;return e<0&&(n+=t[s[r]]),o[r]<0?Math.max(0,Math.min(n,t[s[r]]-1)):Math.max(0,Math.min(n,t[s[r]]))},Rw=(e,r,t)=>`fn calculateInputIndices(output_indices: ${r.type.indices}) -> ${e.type.indices} { + var input_indices: ${e.type.indices}; + var carry = 0u; + for (var i = ${t.length}; i >= 0; i--) { + let input_shape_i = ${rt("uniforms.input_shape","i",t.length)}; + let steps_i = ${rt("uniforms.steps","i",t.length)}; + let signs_i = ${rt("uniforms.signs","i",t.length)}; + let starts_i = ${rt("uniforms.starts","i",t.length)}; + var output_index = ${r.indicesGet("output_indices","i")}; + var input_index = output_index * steps_i + starts_i + carry; + carry = input_index / input_shape_i; + input_index = input_index % input_shape_i; + if (signs_i < 0) { + input_index = input_shape_i - input_index - 1u + starts_i; + } + ${e.indicesSet("input_indices","i","input_index")}; + } + return input_indices; + }`,jw=(e,r)=>{let t=e[0].dims,s=be.size(t),o=r.axes.length>0?be.normalizeAxes(r.axes,t.length):[...Array(t.length).keys()],n=Uo(e,4);n.forEach(w=>w!==0||(()=>{throw new Error("step cannot be 0")})),n.length===0&&(n=Array(o.length).fill(1));let i=r.starts.map((w,g)=>Tu(w,g,t,o,n)),a=r.ends.map((w,g)=>Tu(w,g,t,o,n));if(o.length!==i.length||o.length!==a.length)throw new Error("start, ends and axes should have the same number of elements");if(o.length!==t.length)for(let w=0;wMath.sign(w));n.forEach((w,g,C)=>{if(w<0){let E=(a[g]-i[g])/w,y=i[g],b=y+E*n[g];i[g]=b,a[g]=y,C[g]=-w}});let u=t.slice(0);o.forEach((w,g)=>{u[w]=Math.ceil((a[w]-i[w])/n[w])});let p={dims:u,dataType:e[0].dataType},d=Ze("output",e[0].dataType,u.length),c=Pe("input",e[0].dataType,e[0].dims.length),_=be.size(u),f=[{name:"outputSize",type:"u32"},{name:"starts",type:"u32",length:i.length},{name:"signs",type:"i32",length:l.length},{name:"steps",type:"u32",length:n.length}],v=[{type:12,data:_},{type:12,data:i},{type:6,data:l},{type:12,data:n},...st(e[0].dims,u)],$=w=>` + ${w.registerUniforms(f).declareVariables(c,d)} + ${Rw(c,d,t)} + ${w.mainStart()} + ${w.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + let output_indices = ${d.offsetToIndices("global_idx")}; + let input_indices = calculateInputIndices(output_indices); + ${d.setByOffset("global_idx",c.getByIndices("input_indices"))} + }`;return{name:"Slice",shaderCache:{hint:`${l.length}_${i.length}_${n.length}`,inputDependencies:["rank"]},getShaderSource:$,getRunData:()=>({outputs:[p],dispatchGroup:{x:Math.ceil(s/64)},programUniforms:v})}},b0=(e,r)=>{zw(e.inputs,r);let t=Bw(e.inputs,r);e.compute(jw(e.inputs,t),{inputs:[0]})},M0=e=>{let r=e.starts,t=e.ends,s=e.axes;return $t({starts:r,ends:t,axes:s})}}),Nw,Vw,y0,v0,Gx=Re(()=>{ut(),ft(),Jt(),Js(),_t(),Nw=e=>{if(!e||e.length!==1)throw new Error("Softmax op requires 1 input.")},Vw=(e,r)=>{let t=e.inputs[0],s=t.dims,o=be.size(s),n=s.length,i=be.normalizeAxis(r.axis,n),a=iS),u[i]=n-1,u[n-1]=i,l=e.compute(Vr(t,u),{inputs:[t],outputs:[-1]})[0]):l=t;let p=l.dims,d=p[n-1],c=o/d,_=qt(d),f=d/_,v=64;c===1&&(v=256);let $=(x,S)=>S===4?`max(max(${x}.x, ${x}.y), max(${x}.z, ${x}.w))`:S===2?`max(${x}.x, ${x}.y)`:S===3?`max(max(${x}.x, ${x}.y), ${x}.z)`:x,w=Pe("x",l.dataType,l.dims,_),g=Ze("result",l.dataType,l.dims,_),C=w.type.value,E=mr(l.dataType)==="f32"?`var threadMax = ${C}(-3.402823e+38f);`:`var threadMax = ${C}(-65504.0h);`,y=x=>` + var rowMaxShared : ${C}; + var rowSumShared : ${C}; + var threadShared : array<${C}, ${v}>; + + fn getValue(row: i32, col: i32, row_stride: i32) -> ${C} { + let index = row * row_stride + col; + return x[index]; + } + + fn setValue(row: i32, col: i32, row_stride: i32, value: ${C}) { + let index = row * row_stride + col; + result[index] = value; + } + ${x.registerUniform("packedCols","i32").declareVariables(w,g)} + ${x.mainStart(v)} + let gindex = i32(global_idx); + let lindex = i32(local_idx); + const wg = ${v}; + let row = gindex / wg; + let cols = uniforms.packedCols; + let row_stride : i32 = uniforms.packedCols; + + // find the rows max + ${E} + for (var col = lindex; col < cols; col += wg) { + let value = getValue(row, col, row_stride); + threadMax = max(threadMax, value); + } + if (lindex < cols) { + threadShared[lindex] = threadMax; + } + workgroupBarrier(); + + var reduceSize = min(cols, wg); + for (var currSize = reduceSize >> 1; currSize > 0; currSize = reduceSize >> 1) { + reduceSize = currSize + (reduceSize & 1); + if (lindex < currSize) { + threadShared[lindex] = max(threadShared[lindex], threadShared[lindex + reduceSize]); + } + workgroupBarrier(); + } + if (lindex == 0) { + rowMaxShared = ${C}(${$("threadShared[0]",_)}); + } + workgroupBarrier(); + + // find the rows sum + var threadSum = ${C}(0.0); + for (var col = lindex; col < cols; col += wg) { + let subExp = exp(getValue(row, col, row_stride) - rowMaxShared); + threadSum += subExp; + } + threadShared[lindex] = threadSum; + workgroupBarrier(); + + for (var currSize = wg >> 1; currSize > 0; currSize = currSize >> 1) { + if (lindex < currSize) { + threadShared[lindex] = threadShared[lindex] + threadShared[lindex + currSize]; + } + workgroupBarrier(); + } + if (lindex == 0) { + rowSumShared = ${C}(${Qs("threadShared[0]",_)}); + } + workgroupBarrier(); + + // calculate final value for each element in the row + for (var col = lindex; col < cols; col += wg) { + let value = exp(getValue(row, col, row_stride) - rowMaxShared) / rowSumShared; + setValue(row, col, row_stride, value); + } + }`,b=e.compute({name:"Softmax",shaderCache:{hint:`${_};${v}`,inputDependencies:["type"]},getRunData:()=>({outputs:[{dims:p,dataType:l.dataType}],dispatchGroup:{x:c},programUniforms:[{type:6,data:f}]}),getShaderSource:y},{inputs:[l],outputs:[a?-1:0]})[0];a&&e.compute(Vr(b,u),{inputs:[b]})},y0=(e,r)=>{Nw(e.inputs),Vw(e,r)},v0=e=>$t({axis:e.axis})}),Eu,Uw,Ww,Gw,x0,Kx=Re(()=>{ut(),ft(),_t(),Eu=e=>Array.from(e.getBigInt64Array(),Number),Uw=e=>{if(!e||e.length!==2)throw new Error("Tile requires 2 inputs.");if(e[0].dataType!==1&&e[0].dataType!==10&&e[0].dataType!==6&&e[0].dataType!==12)throw new Error("Tile only support float, float16, int32, and uint32 data types");if(e[1].dataType!==7)throw new Error("Tile `repeats` input should be of int64 data type");if(e[1].dims.length!==1)throw new Error("Tile `repeats` input should be 1-D");if(Eu(e[1]).length!==e[0].dims.length)throw new Error("Tile `repeats` input should have same number of elements as rank of input data tensor")},Ww=(e,r)=>{let t=[];for(let s=0;s{let t=e[0].dims,s=r??Eu(e[1]),o=Ww(t,s),n=be.size(o),i=e[0].dataType,a=Pe("input",i,t.length),l=Ze("output",i,o.length),u=p=>` + const inputShape = ${a.indices(...t)}; + ${p.registerUniform("output_size","u32").declareVariables(a,l)} + ${p.mainStart()} + ${p.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let output_indices = ${l.offsetToIndices("global_idx")}; + var input_indices: ${a.type.indices}; + for (var i = 0; i < ${t.length}; i++) { + let input_dim_i = ${a.indicesGet("uniforms.input_shape","i")}; + let input_dim_value = ${l.indicesGet("output_indices","i")} % input_dim_i; + + ${a.indicesSet("input_indices","i","input_dim_value")} + } + ${l.setByOffset("global_idx",a.getByIndices("input_indices"))} + }`;return{name:"Tile",shaderCache:{hint:`${s}`,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:o,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:[{type:12,data:n},...st(e[0].dims,o)]}),getShaderSource:u}},x0=e=>{Uw(e.inputs),e.compute(Gw(e.inputs),{inputs:[0]})}}),Kw,Hw,T0,Hx=Re(()=>{ut(),ft(),_t(),Kw=(e,r,t,s,o)=>{let n=Ze("output_data",o,t.length,4),i=Pe("a_data",r[1].dataType,r[1].dims.length,4),a=Pe("b_data",r[2].dataType,r[2].dims.length,4),l=Pe("c_data",r[0].dataType,r[0].dims.length,4),u,p=(d,c,_)=>`select(${c}, ${d}, ${_})`;if(!s)u=n.setByOffset("global_idx",p(i.getByOffset("global_idx"),a.getByOffset("global_idx"),l.getByOffset("global_idx")));else{let d=(c,_,f="")=>{let v=`a_data[index_a${_}][component_a${_}]`,$=`b_data[index_b${_}][component_b${_}]`,w=`bool(c_data[index_c${_}] & (0xffu << (component_c${_} * 8)))`;return` + let output_indices${_} = ${n.offsetToIndices(`global_idx * 4u + ${_}u`)}; + let offset_a${_} = ${i.broadcastedIndicesToOffset(`output_indices${_}`,n)}; + let offset_b${_} = ${a.broadcastedIndicesToOffset(`output_indices${_}`,n)}; + let offset_c${_} = ${l.broadcastedIndicesToOffset(`output_indices${_}`,n)}; + let index_a${_} = offset_a${_} / 4u; + let index_b${_} = offset_b${_} / 4u; + let index_c${_} = offset_c${_} / 4u; + let component_a${_} = offset_a${_} % 4u; + let component_b${_} = offset_b${_} % 4u; + let component_c${_} = offset_c${_} % 4u; + ${c}[${_}] = ${f}(${p(v,$,w)}); + `};o===9?u=` + var data = vec4(0); + ${d("data",0,"u32")} + ${d("data",1,"u32")} + ${d("data",2,"u32")} + ${d("data",3,"u32")} + output_data[global_idx] = dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(data));`:u=` + ${d("output_data[global_idx]",0)} + ${d("output_data[global_idx]",1)} + ${d("output_data[global_idx]",2)} + ${d("output_data[global_idx]",3)} + `}return` + ${e.registerUniform("vec_size","u32").declareVariables(l,i,a,n)} + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} + ${u} + }`},Hw=e=>{let r=e[1].dims,t=e[2].dims,s=e[0].dims,o=e[1].dataType,n=!(be.areEqual(r,t)&&be.areEqual(t,s)),i=r,a=be.size(r);if(n){let u=oo.calcShape(oo.calcShape(r,t,!1),s,!1);if(!u)throw new Error("Can't perform where op on the given tensors");i=u,a=be.size(i)}let l=Math.ceil(a/4);return{name:"Where",shaderCache:{inputDependencies:["rank","rank","rank"]},getShaderSource:u=>Kw(u,e,i,n,o),getRunData:()=>({outputs:[{dims:i,dataType:o}],dispatchGroup:{x:Math.ceil(a/64/4)},programUniforms:[{type:12,data:l},...st(s,r,t,i)]})}},T0=e=>{e.compute(Hw(e.inputs))}}),E0,qx=Re(()=>{lx(),dd(),ux(),dx(),cx(),px(),hx(),wx(),Mx(),yx(),vx(),xx(),Tx(),Ex(),Px(),Cx(),Sx(),$x(),kx(),Ix(),Ax(),Fx(),Ox(),Dx(),Lx(),Wy(),zx(),Bx(),Rx(),jx(),Nx(),ud(),Vx(),Xy(),Ux(),Wx(),Gx(),Hy(),Kx(),Js(),cd(),Hx(),E0=new Map([["Abs",[wM]],["Acos",[bM]],["Acosh",[MM]],["Add",[ey]],["ArgMax",[mM,Bu]],["ArgMin",[hM,Bu]],["Asin",[yM]],["Asinh",[vM]],["Atan",[xM]],["Atanh",[TM]],["Attention",[fM]],["AveragePool",[n0,s0]],["BatchNormalization",[_M]],["BiasAdd",[gM]],["BiasSplitGelu",[ZM]],["Cast",[PM,EM]],["Ceil",[SM]],["Clip",[CM]],["Concat",[dy,cy]],["Conv",[Wu,Uu]],["ConvTranspose",[yy,My]],["Cos",[$M]],["Cosh",[kM]],["CumSum",[vy,xy]],["DepthToSpace",[Ty,Ey]],["DequantizeLinear",[c0,p0]],["Div",[ty]],["Einsum",[Py,Cy]],["Elu",[IM,qo]],["Equal",[ry]],["Erf",[AM]],["Exp",[FM]],["Expand",[Sy]],["FastGelu",[$y]],["Floor",[OM]],["FusedConv",[Wu,Uu]],["Gather",[Iy,ky]],["GatherElements",[zy,Ly]],["GatherBlockQuantized",[Oy,Dy]],["GatherND",[Ay,Fy]],["Gelu",[DM]],["Gemm",[Ry,By]],["GlobalAveragePool",[i0,o0]],["GlobalMaxPool",[d0,u0]],["Greater",[iy]],["GreaterOrEqual",[ly]],["GridSample",[jy,Ny]],["GroupQueryAttention",[Qy]],["HardSigmoid",[UM,VM]],["InstanceNormalization",[Jy]],["LayerNormalization",[Yy]],["LeakyRelu",[LM,qo]],["Less",[ay]],["LessOrEqual",[uy]],["Log",[JM]],["MatMul",[Zy]],["MatMulNBits",[e0,t0]],["MaxPool",[a0,l0]],["Mul",[sy]],["MultiHeadAttention",[Uy,Vy]],["Neg",[BM]],["Not",[zM]],["Pad",[r0]],["Pow",[ny]],["QuickGelu",[YM,qo]],["Range",[h0]],["Reciprocal",[RM]],["ReduceMin",[lM]],["ReduceMean",[sM]],["ReduceMax",[aM]],["ReduceSum",[dM]],["ReduceProd",[uM]],["ReduceL1",[nM]],["ReduceL2",[oM]],["ReduceLogSum",[pM]],["ReduceLogSumExp",[iM]],["ReduceSumSquare",[cM]],["Relu",[jM]],["Resize",[_0,g0]],["RotaryEmbedding",[qy]],["ScatterND",[f0,m0]],["Sigmoid",[NM]],["Sin",[WM]],["Sinh",[GM]],["Slice",[b0,M0]],["SkipLayerNormalization",[w0]],["Split",[Gy,Ky]],["Sqrt",[KM]],["Softmax",[y0,v0]],["Sub",[oy]],["Tan",[HM]],["Tanh",[qM]],["ThresholdedRelu",[QM,qo]],["Tile",[x0]],["Transpose",[Gb,Kb]],["Where",[T0]]])}),P0,Xx=Re(()=>{_s(),Os(),_t(),P0=class{constructor(e){this.backend=e,this.repo=new Map,this.attributesBound=!1}getArtifact(e){return this.repo.get(e)}setArtifact(e,r){this.repo.set(e,r)}run(e,r,t,s,o){fs(e.programInfo.name);let n=this.backend.device,i=this.backend.getComputePassEncoder();this.backend.writeTimestamp(this.backend.pendingDispatchNumber*2);let a=[];for(let u of r)a.push({binding:a.length,resource:{buffer:u.buffer}});for(let u of t)a.push({binding:a.length,resource:{buffer:u.buffer}});o&&a.push({binding:a.length,resource:o});let l=n.createBindGroup({layout:e.computePipeline.getBindGroupLayout(0),entries:a,label:e.programInfo.name});if(this.backend.sessionStatus==="capturing"){let u={kernelId:this.backend.currentKernelId,computePipeline:e.computePipeline,bindGroup:l,dispatchGroup:s};this.backend.capturedCommandList.get(this.backend.currentSessionId).push(u)}i.setPipeline(e.computePipeline),i.setBindGroup(0,l),i.dispatchWorkgroups(...s),this.backend.writeTimestamp(this.backend.pendingDispatchNumber*2+1),this.backend.pendingDispatchNumber++,(this.backend.pendingDispatchNumber>=this.backend.maxDispatchNumber||this.backend.queryType==="at-passes")&&this.backend.endComputePass(),this.backend.pendingDispatchNumber>=this.backend.maxDispatchNumber&&this.backend.flush(),Jr(e.programInfo.name)}dispose(){}build(e,r){fs(e.name);let t=this.backend.device,s=[];[{feature:"shader-f16",extension:"f16"},{feature:"subgroups",extension:"subgroups"}].forEach(u=>{t.features.has(u.feature)&&s.push(`enable ${u.extension};`)});let o=Wb(r,this.backend.device.limits),n=e.getShaderSource(o),i=`${s.join(` +`)} +${o.additionalImplementations} +${n}`,a=t.createShaderModule({code:i,label:e.name});Tt("verbose",()=>`[WebGPU] ${e.name} shader code: ${i}`);let l=t.createComputePipeline({compute:{module:a,entryPoint:"main"},layout:"auto",label:e.name});return Jr(e.name),{programInfo:e,computePipeline:l,uniformVariablesInfo:o.variablesInfo}}normalizeDispatchGroupSize(e){let r=typeof e=="number"?e:e.x,t=typeof e=="number"?1:e.y||1,s=typeof e=="number"?1:e.z||1,o=this.backend.device.limits.maxComputeWorkgroupsPerDimension;if(r<=o&&t<=o&&s<=o)return[r,t,s];let n=r*t*s,i=Math.ceil(Math.sqrt(n));if(i>o){if(i=Math.ceil(Math.cbrt(n)),i>o)throw new Error("Total dispatch size exceeds WebGPU maximum.");return[i,i,i]}else return[i,i,1]}}}),C0={};ao(C0,{WebGpuBackend:()=>S0});var qw,Xw,Qw,S0,Qx=Re(()=>{_s(),ut(),Os(),Rb(),ix(),qx(),Xx(),qw=(e,r)=>{if(r.length!==e.length)throw new Error(`inputDependencies length ${r.length} is not equal to inputTensors length ${e.length}.`);let t=[];for(let s=0;s{var o,n;let s=e.name;return(o=e.shaderCache)!=null&&o.hint&&(s+="["+e.shaderCache.hint+"]"),s+=":"+t+`:${qw(r,((n=e.shaderCache)==null?void 0:n.inputDependencies)??new Array(r.length).fill("dims"))}`,s},Qw=class{constructor(e){e&&(this.architecture=e.architecture,this.vendor=e.vendor)}isArchitecture(e){return this.architecture===e}isVendor(e){return this.vendor===e}},S0=class{constructor(){this.currentSessionId=null,this.currentKernelId=null,this.commandEncoder=null,this.computePassEncoder=null,this.maxDispatchNumber=16,this.pendingDispatchNumber=0,this.pendingKernels=[],this.pendingQueries=new Map,this.sessionStatus="default",this.capturedCommandList=new Map,this.capturedPendingKernels=new Map,this.sessionExternalDataMapping=new Map}get currentKernelCustomData(){if(this.currentKernelId===null)throw new Error("currentKernelCustomData(): currentKernelId is null. (should not happen)");let e=this.kernelCustomData.get(this.currentKernelId);return e||(e={},this.kernelCustomData.set(this.currentKernelId,e)),e}async initialize(e,r){this.env=e;let t=[],s={requiredLimits:{maxComputeWorkgroupStorageSize:r.limits.maxComputeWorkgroupStorageSize,maxComputeWorkgroupsPerDimension:r.limits.maxComputeWorkgroupsPerDimension,maxStorageBufferBindingSize:r.limits.maxStorageBufferBindingSize,maxBufferSize:r.limits.maxBufferSize,maxComputeInvocationsPerWorkgroup:r.limits.maxComputeInvocationsPerWorkgroup,maxComputeWorkgroupSizeX:r.limits.maxComputeWorkgroupSizeX,maxComputeWorkgroupSizeY:r.limits.maxComputeWorkgroupSizeY,maxComputeWorkgroupSizeZ:r.limits.maxComputeWorkgroupSizeZ},requiredFeatures:t},o=n=>r.features.has(n)&&t.push(n)&&!0;o("chromium-experimental-timestamp-query-inside-passes")||o("timestamp-query"),o("shader-f16"),o("subgroups"),this.device=await r.requestDevice(s),this.adapterInfo=new Qw(r.info||await r.requestAdapterInfo()),this.gpuDataManager=Vb(this),this.programManager=new P0(this),this.kernels=new Map,this.kernelPersistentData=new Map,this.kernelCustomData=new Map,od(e.logLevel,!!e.debug),this.device.onuncapturederror=n=>{n.error instanceof GPUValidationError&&console.error(`An uncaught WebGPU validation error was raised: ${n.error.message}`)},Object.defineProperty(this.env.webgpu,"device",{value:this.device,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(this.env.webgpu,"adapter",{value:r,writable:!1,enumerable:!0,configurable:!1}),this.setQueryType()}dispose(){typeof this.querySet<"u"&&this.querySet.destroy(),this.gpuDataManager.dispose()}getCommandEncoder(){return this.commandEncoder||(this.commandEncoder=this.device.createCommandEncoder()),this.commandEncoder}getComputePassEncoder(){if(!this.computePassEncoder){let e=this.getCommandEncoder(),r={};this.queryType==="at-passes"&&(r.timestampWrites={querySet:this.querySet,beginningOfPassWriteIndex:this.pendingDispatchNumber*2,endOfPassWriteIndex:this.pendingDispatchNumber*2+1}),this.computePassEncoder=e.beginComputePass(r)}return this.computePassEncoder}endComputePass(){this.computePassEncoder&&(this.computePassEncoder.end(),this.computePassEncoder=null)}flush(){if(!this.commandEncoder)return;fs(),this.endComputePass();let e;this.queryType!=="none"&&(this.commandEncoder.resolveQuerySet(this.querySet,0,this.pendingDispatchNumber*2,this.queryResolveBuffer,0),e=this.device.createBuffer({size:this.pendingDispatchNumber*2*8,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.pendingQueries.set(e,this.pendingKernels),this.pendingKernels=[],this.commandEncoder.copyBufferToBuffer(this.queryResolveBuffer,0,e,0,this.pendingDispatchNumber*2*8)),this.device.queue.submit([this.commandEncoder.finish()]),this.gpuDataManager.refreshPendingBuffers(),this.commandEncoder=null,this.pendingDispatchNumber=0,this.queryType!=="none"&&e.mapAsync(GPUMapMode.READ).then(()=>{var s;let r=new BigUint64Array(e.getMappedRange()),t=this.pendingQueries.get(e);for(let o=0;o"u"&&(this.queryTimeBase=_);let v=Number(_-this.queryTimeBase),$=Number(f-this.queryTimeBase);if(!Number.isSafeInteger(v)||!Number.isSafeInteger($))throw new RangeError("incorrect timestamp range");if((s=this.env.webgpu.profiling)!=null&&s.ondata)this.env.webgpu.profiling.ondata({version:1,inputsMetadata:d.map(w=>({dims:w.dims,dataType:Fs(w.dataType)})),outputsMetadata:c.map(w=>({dims:w.dims,dataType:Fs(w.dataType)})),kernelId:i,kernelType:l,kernelName:u,programName:p,startTime:v,endTime:$});else{let w="";d.forEach((C,E)=>{w+=`input[${E}]: [${C.dims}] | ${Fs(C.dataType)}, `});let g="";c.forEach((C,E)=>{g+=`output[${E}]: [${C.dims}] | ${Fs(C.dataType)}, `}),console.log(`[profiling] kernel "${i}|${l}|${u}|${p}" ${w}${g}execution time: ${$-v} ns`)}Yo("GPU",`${p}::${_}::${f}`)}e.unmap(),this.pendingQueries.delete(e)}),Jr()}run(e,r,t,s,o,n){fs(e.name);let i=[];for(let g=0;gC):t;if(p.length!==a.length)throw new Error(`Output size ${p.length} must be equal to ${a.length}.`);let d=[],c=[];for(let g=0;g=n)throw new Error(`Invalid output index: ${p[g]}`);if(p[g]===-3)continue;let C=p[g]===-1,E=p[g]===-2,y=C||E?o(a[g].dataType,a[g].dims):s(p[g],a[g].dataType,a[g].dims);if(d.push(y),y.data===0)continue;let b=this.gpuDataManager.get(y.data);if(!b)throw new Error(`no GPU data for output: ${y.data}`);if(C&&this.temporaryData.push(b),E){let x=this.kernelPersistentData.get(this.currentKernelId);x||(x=[],this.kernelPersistentData.set(this.currentKernelId,x)),x.push(b)}c.push(b)}if(i.length!==r.length||c.length!==d.length){if(c.length===0)return Jr(e.name),d;throw new Error(`Program ${e.name} has zero-sized tensor(s) in inputs or outputs. This is not supported now.`)}let _;if(u){let g=0,C=[];u.forEach(x=>{let S=typeof x.data=="number"?[x.data]:x.data;if(S.length===0)return;let A=x.type===10?2:4,B,K;x.type===10?(K=S.length>4?16:S.length>2?8:S.length*A,B=S.length>4?16:A*S.length):(K=S.length<=2?S.length*A:16,B=16),g=Math.ceil(g/K)*K,C.push(g);let G=x.type===10?8:4;g+=S.length>4?Math.ceil(S.length/G)*B:S.length*A});let E=16;g=Math.ceil(g/E)*E;let y=new ArrayBuffer(g);u.forEach((x,S)=>{let A=C[S],B=typeof x.data=="number"?[x.data]:x.data;if(x.type===6)new Int32Array(y,A,B.length).set(B);else if(x.type===12)new Uint32Array(y,A,B.length).set(B);else if(x.type===10)new Uint16Array(y,A,B.length).set(B);else if(x.type===1)new Float32Array(y,A,B.length).set(B);else throw new Error(`Unsupported uniform type: ${Fs(x.type)}`)});let b=this.gpuDataManager.create(g,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM);this.device.queue.writeBuffer(b.buffer,0,y,0,g),this.gpuDataManager.release(b.id),_={offset:0,size:g,buffer:b.buffer}}let f=this.programManager.normalizeDispatchGroupSize(l),v=f[1]===1&&f[2]===1,$=Xw(e,r,v),w=this.programManager.getArtifact($);if(w||(w=this.programManager.build(e,f),this.programManager.setArtifact($,w),Tt("info",()=>`[artifact] key: ${$}, programName: ${e.name}`)),u&&w.uniformVariablesInfo){if(u.length!==w.uniformVariablesInfo.length)throw new Error(`Uniform variables count mismatch: expect ${w.uniformVariablesInfo.length}, got ${u.length} in program "${w.programInfo.name}".`);for(let g=0;g`[ProgramManager] run "${e.name}" (key=${$}) with ${f[0]}x${f[1]}x${f[2]}`),this.queryType!=="none"||this.sessionStatus==="capturing"){let g={kernelId:this.currentKernelId,programName:w.programInfo.name,inputTensorViews:r,outputTensorViews:d};this.pendingKernels.push(g),this.sessionStatus==="capturing"&&this.capturedPendingKernels.get(this.currentSessionId).push(g)}return this.programManager.run(w,i,c,f,_),Jr(e.name),d}upload(e,r){this.gpuDataManager.upload(e,r)}memcpy(e,r){this.gpuDataManager.memcpy(e,r)}async download(e,r){await this.gpuDataManager.download(e,r)}alloc(e){return this.gpuDataManager.create(e).id}free(e){return this.gpuDataManager.release(e)}createKernel(e,r,t,s){let o=E0.get(e);if(!o)throw new Error(`kernel not implemented: ${e}`);let n={kernelType:e,kernelName:s,kernelEntry:o[0],attributes:[o[1],t]};this.kernels.set(r,n)}releaseKernel(e){let r=this.kernelPersistentData.get(e);if(r){for(let t of r)this.gpuDataManager.release(t.id);this.kernelPersistentData.delete(e)}this.kernelCustomData.delete(e),this.kernels.delete(e)}computeKernel(e,r,t){let s=this.kernels.get(e);if(!s)throw new Error(`kernel not created: ${e}`);let o=s.kernelType,n=s.kernelName,i=s.kernelEntry,a=s.attributes;if(this.currentKernelId!==null)throw new Error(`kernel "[${o}] ${n}" is not allowed to be called recursively`);this.currentKernelId=e,a[0]&&(a[1]=a[0](a[1]),a[0]=void 0),Tt("info",()=>`[WebGPU] Start to run kernel "[${o}] ${n}"...`);let l=this.env.debug;this.temporaryData=[];try{return l&&this.device.pushErrorScope("validation"),i(r,a[1]),0}catch(u){return t.push(Promise.resolve(`[WebGPU] Kernel "[${o}] ${n}" failed. ${u}`)),1}finally{l&&t.push(this.device.popErrorScope().then(u=>u?`GPU validation error for kernel "[${o}] ${n}": ${u.message}`:null));for(let u of this.temporaryData)this.gpuDataManager.release(u.id);this.temporaryData=[],this.currentKernelId=null}}registerBuffer(e,r,t,s){let o=this.sessionExternalDataMapping.get(e);o||(o=new Map,this.sessionExternalDataMapping.set(e,o));let n=o.get(r),i=this.gpuDataManager.registerExternalBuffer(t,s,n);return o.set(r,[i,t]),i}unregisterBuffers(e){let r=this.sessionExternalDataMapping.get(e);r&&(r.forEach(t=>this.gpuDataManager.unregisterExternalBuffer(t[0])),this.sessionExternalDataMapping.delete(e))}getBuffer(e){let r=this.gpuDataManager.get(e);if(!r)throw new Error(`no GPU data for buffer: ${e}`);return r.buffer}createDownloader(e,r,t){return async()=>{let s=await Du(this,e,r);return id(s.buffer,t)}}writeTimestamp(e){this.queryType==="inside-passes"&&this.computePassEncoder.writeTimestamp(this.querySet,e)}setQueryType(){var e;this.queryType="none",(((e=this.env.webgpu.profiling)==null?void 0:e.mode)==="default"||(typeof this.env.trace>"u"?this.env.wasm.trace:this.env.trace))&&(this.device.features.has("chromium-experimental-timestamp-query-inside-passes")?this.queryType="inside-passes":this.device.features.has("timestamp-query")&&(this.queryType="at-passes"),this.queryType!=="none"&&typeof this.querySet>"u"&&(this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxDispatchNumber*2}),this.queryResolveBuffer=this.device.createBuffer({size:this.maxDispatchNumber*2*8,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.QUERY_RESOLVE})))}captureBegin(){Tt("info","captureBegin"),this.capturedCommandList.get(this.currentSessionId)||this.capturedCommandList.set(this.currentSessionId,[]),this.capturedPendingKernels.get(this.currentSessionId)||this.capturedPendingKernels.set(this.currentSessionId,[]),this.flush(),this.sessionStatus="capturing"}captureEnd(){Tt("info","captureEnd"),this.flush(),this.sessionStatus="default"}replay(){Tt("info","replay"),this.sessionStatus="replaying";let e=this.capturedCommandList.get(this.currentSessionId),r=this.capturedPendingKernels.get(this.currentSessionId),t=e.length;this.pendingKernels=[];for(let s=0;s=this.maxDispatchNumber||this.queryType==="at-passes")&&this.endComputePass(),this.pendingDispatchNumber>=this.maxDispatchNumber&&this.flush()}this.flush(),this.sessionStatus="default"}onCreateSession(){this.gpuDataManager.onCreateSession()}onReleaseSession(e){this.unregisterBuffers(e),this.capturedCommandList.has(e)&&this.capturedCommandList.delete(e),this.capturedPendingKernels.has(e)&&this.capturedPendingKernels.delete(e),this.gpuDataManager.onReleaseSession(e)}onRunStart(e){this.currentSessionId=e,this.setQueryType()}}}),$0={};ao($0,{init:()=>k0});var oa,Jw,k0,Jx=Re(()=>{ut(),Os(),ft(),ox(),oa=class I0{constructor(r,t,s,o){this.module=r,this.dataType=t,this.data=s,this.dims=o}getFloat32Array(){if(this.dataType!==1)throw new Error("Invalid data type");let r=be.size(this.dims);return r===0?new Float32Array:new Float32Array(this.module.HEAP8.buffer,this.data,r)}getBigInt64Array(){if(this.dataType!==7)throw new Error("Invalid data type");let r=be.size(this.dims);return r===0?new BigInt64Array:new BigInt64Array(this.module.HEAP8.buffer,this.data,r)}getInt32Array(){if(this.dataType!==6)throw new Error("Invalid data type");let r=be.size(this.dims);return r===0?new Int32Array:new Int32Array(this.module.HEAP8.buffer,this.data,r)}getUint16Array(){if(this.dataType!==10&&this.dataType!==4)throw new Error("Invalid data type");let r=be.size(this.dims);return r===0?new Uint16Array:new Uint16Array(this.module.HEAP8.buffer,this.data,r)}reshape(r){if(be.size(r)!==be.size(this.dims))throw new Error("Invalid new shape");return new I0(this.module,this.dataType,this.data,r)}},Jw=class{constructor(e,r,t){this.module=e,this.backend=r,this.customDataOffset=0,this.customDataSize=0,this.adapterInfo=r.adapterInfo;let s=e.PTR_SIZE,o=t/e.PTR_SIZE,n=s===4?"i32":"i64";this.opKernelContext=Number(e.getValue(s*o++,n));let i=Number(e.getValue(s*o++,n));this.outputCount=Number(e.getValue(s*o++,n)),this.customDataOffset=Number(e.getValue(s*o++,"*")),this.customDataSize=Number(e.getValue(s*o++,n));let a=[];for(let l=0;ltypeof a=="number"?this.inputs[a]:a))??this.inputs,s=(r==null?void 0:r.outputs)??[],o=(a,l,u)=>new oa(this.module,l,this.output(a,u),u),n=(a,l)=>{let u=An(a,l);if(!u)throw new Error(`Unsupported data type: ${a}`);let p=u>0?this.backend.gpuDataManager.create(u).id:0;return new oa(this.module,a,p,l)};return this.backend.run(e,t,s,o,n,this.outputCount)}output(e,r){let t=this.module.stackSave();try{let s=this.module.PTR_SIZE,o=s===4?"i32":"i64",n=this.module.stackAlloc((1+r.length)*s);this.module.setValue(n,r.length,o);for(let i=0;i{let o=r.jsepInit;if(!o)throw new Error("Failed to initialize JSEP. The WebAssembly module is not built with JSEP support.");if(e==="webgpu"){let n=(Qx(),Jo(C0)).WebGpuBackend,i=new n;await i.initialize(t,s),o("webgpu",[i,a=>i.alloc(Number(a)),a=>i.free(a),(a,l,u,p=!1)=>{if(p)Tt("verbose",()=>`[WebGPU] jsepCopyGpuToGpu: src=${Number(a)}, dst=${Number(l)}, size=${Number(u)}`),i.memcpy(Number(a),Number(l));else{Tt("verbose",()=>`[WebGPU] jsepCopyCpuToGpu: dataOffset=${Number(a)}, gpuDataId=${Number(l)}, size=${Number(u)}`);let d=r.HEAPU8.subarray(Number(a>>>0),Number(a>>>0)+Number(u));i.upload(Number(l),d)}},async(a,l,u)=>{Tt("verbose",()=>`[WebGPU] jsepCopyGpuToCpu: gpuDataId=${a}, dataOffset=${l}, size=${u}`),await i.download(Number(a),()=>r.HEAPU8.subarray(Number(l)>>>0,Number(l+u)>>>0))},(a,l,u)=>i.createKernel(a,Number(l),u,r.UTF8ToString(r._JsepGetNodeName(Number(l)))),a=>i.releaseKernel(a),(a,l,u,p)=>{Tt("verbose",()=>`[WebGPU] jsepRun: sessionHandle=${u}, kernel=${a}, contextDataOffset=${l}`);let d=new Jw(r,i,Number(l));return i.computeKernel(Number(a),d,p)},()=>i.captureBegin(),()=>i.captureEnd(),()=>i.replay()])}else{let n=new Nb(t);o("webnn",[n,()=>n.reserveTensorId(),i=>n.releaseTensorId(i),async(i,a,l,u,p)=>n.ensureTensor(i,a,l,u,p),(i,a)=>{n.uploadTensor(i,a)},async(i,a)=>n.downloadTensor(i,a)])}}}),Yw,gd,wd,qs,Zw,Pu,wa,bd,Md,Cu,yd,vd,xd,A0=Re(()=>{rx(),sx(),ut(),zn(),ed(),Db(),Yw=(e,r)=>{zt()._OrtInit(e,r)!==0&&At("Can't initialize onnxruntime.")},gd=async e=>{Yw(e.wasm.numThreads,ha(e.logLevel))},wd=async(e,r)=>{var t,s;(s=(t=zt()).asyncInit)==null||s.call(t);{let o=(Jx(),Jo($0)).init;if(r==="webgpu"){if(typeof navigator>"u"||!navigator.gpu)throw new Error("WebGPU is not supported in current environment");let n=e.webgpu.adapter;if(n){if(typeof n.limits!="object"||typeof n.features!="object"||typeof n.requestDevice!="function")throw new Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let i=e.webgpu.powerPreference;if(i!==void 0&&i!=="low-power"&&i!=="high-performance")throw new Error(`Invalid powerPreference setting: "${i}"`);let a=e.webgpu.forceFallbackAdapter;if(a!==void 0&&typeof a!="boolean")throw new Error(`Invalid forceFallbackAdapter setting: "${a}"`);if(n=await navigator.gpu.requestAdapter({powerPreference:i,forceFallbackAdapter:a}),!n)throw new Error('Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.')}await o("webgpu",zt(),e,n)}if(r==="webnn"){if(typeof navigator>"u"||!navigator.ml)throw new Error("WebNN is not supported in current environment");await o("webnn",zt(),e)}}},qs=new Map,Zw=e=>{let r=zt(),t=r.stackSave();try{let s=r.PTR_SIZE,o=r.stackAlloc(2*s);r._OrtGetInputOutputCount(e,o,o+s)!==0&&At("Can't get session input/output count.");let n=s===4?"i32":"i64";return[Number(r.getValue(o,n)),Number(r.getValue(o+s,n))]}finally{r.stackRestore(t)}},Pu=(e,r)=>{let t=zt(),s=t.stackSave(),o=0;try{let n=t.PTR_SIZE,i=t.stackAlloc(2*n);t._OrtGetInputOutputMetadata(e,r,i,i+n)!==0&&At("Can't get session input/output metadata.");let a=Number(t.getValue(i,"*"));o=Number(t.getValue(i+n,"*"));let l=t.HEAP32[o/4];if(l===0)return[a,0];let u=t.HEAPU32[o/4+1],p=[];for(let d=0;d{let r=zt(),t=r._malloc(e.byteLength);if(t===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${e.byteLength}.`);return r.HEAPU8.set(e,t),[t,e.byteLength]},bd=async(e,r)=>{var d,c,_,f;let t,s,o=zt();Array.isArray(e)?[t,s]=e:e.buffer===o.HEAPU8.buffer?[t,s]=[e.byteOffset,e.byteLength]:[t,s]=wa(e);let n=0,i=0,a=0,l=[],u=[],p=[];try{if([i,l]=await Ob(r),(r==null?void 0:r.externalData)&&o.mountExternalData){let S=[];for(let A of r.externalData){let B=typeof A=="string"?A:A.path;S.push(nd(typeof A=="string"?A:A.data).then(K=>{o.mountExternalData(B,K)}))}await Promise.all(S)}for(let S of(r==null?void 0:r.executionProviders)??[])if((typeof S=="string"?S:S.name)==="webnn"){if(o.shouldTransferToMLTensor=!1,typeof S!="string"){let A=S,B=A==null?void 0:A.context,K=A==null?void 0:A.gpuDevice,G=A==null?void 0:A.deviceType,j=A==null?void 0:A.powerPreference;B?o.currentContext=B:K?o.currentContext=await o.webnnCreateMLContext(K):o.currentContext=await o.webnnCreateMLContext({deviceType:G,powerPreference:j})}else o.currentContext=await o.webnnCreateMLContext();break}n=await o._OrtCreateSession(t,s,i),(d=o.webgpuOnCreateSession)==null||d.call(o,n),n===0&&At("Can't create a session."),(c=o.jsepOnCreateSession)==null||c.call(o),o.currentContext&&(o.webnnRegisterMLContext(n,o.currentContext),o.currentContext=void 0,o.shouldTransferToMLTensor=!0);let[v,$]=Zw(n),w=!!(r!=null&&r.enableGraphCapture),g=[],C=[],E=[],y=[],b=[];for(let S=0;SS==="gpu-buffer"||S==="ml-tensor")&&(a=o._OrtCreateBinding(n),a===0&&At("Can't create IO binding."),x={handle:a,outputPreferredLocations:b,outputPreferredLocationsEncoded:b.map(S=>Fu(S))}),qs.set(n,[n,u,p,x,w,!1]),[n,g,C,E,y]}catch(v){throw u.forEach($=>o._OrtFree($)),p.forEach($=>o._OrtFree($)),a!==0&&o._OrtReleaseBinding(a)!==0&&At("Can't release IO binding."),n!==0&&o._OrtReleaseSession(n)!==0&&At("Can't release session."),v}finally{o._free(t),i!==0&&o._OrtReleaseSessionOptions(i)!==0&&At("Can't release session options."),l.forEach(v=>o._free(v)),(f=o.unmountExternalData)==null||f.call(o)}},Md=e=>{var l,u,p;let r=zt(),t=qs.get(e);if(!t)throw new Error(`cannot release session. invalid session id: ${e}`);let[s,o,n,i,a]=t;i&&(a&&r._OrtClearBoundOutputs(i.handle)!==0&&At("Can't clear bound outputs."),r._OrtReleaseBinding(i.handle)!==0&&At("Can't release IO binding.")),(l=r.jsepOnReleaseSession)==null||l.call(r,e),(u=r.webnnOnReleaseSession)==null||u.call(r,e),(p=r.webgpuOnReleaseSession)==null||p.call(r,e),o.forEach(d=>r._OrtFree(d)),n.forEach(d=>r._OrtFree(d)),r._OrtReleaseSession(s)!==0&&At("Can't release session."),qs.delete(e)},Cu=async(e,r,t,s,o,n,i=!1)=>{if(!e){r.push(0);return}let a=zt(),l=a.PTR_SIZE,u=e[0],p=e[1],d=e[3],c=d,_,f;if(u==="string"&&(d==="gpu-buffer"||d==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(i&&d!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${n} when enableGraphCapture is true.`);if(d==="gpu-buffer"){let w=e[2].gpuBuffer;f=An(ro(u),p);{let g=a.jsepRegisterBuffer;if(!g)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');_=g(s,n,w,f)}}else if(d==="ml-tensor"){let w=e[2].mlTensor;f=An(ro(u),p);let g=a.webnnRegisterMLTensor;if(!g)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');_=g(s,w,ro(u),p)}else{let w=e[2];if(Array.isArray(w)){f=l*w.length,_=a._malloc(f),t.push(_);for(let g=0;ga.setValue($+C*l,g,l===4?"i32":"i64"));let w=a._OrtCreateTensor(ro(u),_,f,$,p.length,Fu(c));w===0&&At(`Can't create tensor for input/output. session=${s}, index=${n}.`),r.push(w)}finally{a.stackRestore(v)}},yd=async(e,r,t,s,o,n)=>{var K,G,j,ee;let i=zt(),a=i.PTR_SIZE,l=qs.get(e);if(!l)throw new Error(`cannot run inference. invalid session id: ${e}`);let u=l[0],p=l[1],d=l[2],c=l[3],_=l[4],f=l[5],v=r.length,$=s.length,w=0,g=[],C=[],E=[],y=[],b=i.stackSave(),x=i.stackAlloc(v*a),S=i.stackAlloc(v*a),A=i.stackAlloc($*a),B=i.stackAlloc($*a);try{[w,g]=Fb(n);for(let X=0;Xq*R,1);F=Fs(fe);let we=c==null?void 0:c.outputPreferredLocations[s[X]];if(F==="string"){if(we==="gpu-buffer"||we==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let q=[];for(let R=0;R0){let q=i.jsepGetBuffer;if(!q)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let R=q(W),pe=An(fe,Ue);if(pe===void 0||!rd(F))throw new Error(`Unsupported data type: ${F}`);V=!0,Z.push([F,$e,{gpuBuffer:R,download:i.jsepCreateDownloader(R,pe,F),dispose:()=>{i._OrtReleaseTensor(oe)!==0&&At("Can't release tensor.")}},"gpu-buffer"])}else if(we==="ml-tensor"&&Ue>0){let q=i.webnnEnsureTensor,R=i.webnnIsInt64Supported;if(!q||!R)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(An(fe,Ue)===void 0||!sd(F))throw new Error(`Unsupported data type: ${F}`);if(F==="int64"&&!R(e))throw new Error('preferredLocation "ml-tensor" for int64 output is not supported by current WebNN Context.');let pe=await q(e,W,fe,$e,!1);V=!0,Z.push([F,$e,{mlTensor:pe,download:i.webnnCreateMLTensorDownloader(W,F),dispose:()=>{i.webnnReleaseTensorId(W),i._OrtReleaseTensor(oe)}},"ml-tensor"])}else{let q=td(F),R=new q(Ue);new Uint8Array(R.buffer,R.byteOffset,R.byteLength).set(i.HEAPU8.subarray(W,W+R.byteLength)),Z.push([F,$e,R,"cpu"])}}finally{i.stackRestore(me),F==="string"&&W&&i._free(W),V||i._OrtReleaseTensor(oe),(ee=i.webnnOnRunEnd)==null||ee.call(i,u)}}return c&&!_&&(i._OrtClearBoundOutputs(c.handle)!==0&&At("Can't clear bound outputs."),qs.set(e,[u,p,d,c,_,!1])),Z}finally{i.stackRestore(b),C.forEach(H=>i._OrtReleaseTensor(H)),E.forEach(H=>i._OrtReleaseTensor(H)),y.forEach(H=>i._free(H)),w!==0&&i._OrtReleaseRunOptions(w),g.forEach(H=>i._free(H))}},vd=e=>{let r=zt(),t=qs.get(e);if(!t)throw new Error("invalid session id");let s=t[0],o=r._OrtEndProfiling(s);o===0&&At("Can't get an profile file name."),r._OrtFree(o)},xd=e=>{let r=[];for(let t of e){let s=t[2];!Array.isArray(s)&&"buffer"in s&&r.push(s.buffer)}return r}}),Xs,Fr,eo,Wo,Go,ia,Su,aa,Sn,$n,eb,F0,O0,D0,L0,z0,B0,R0,j0=Re(()=>{_s(),A0(),zn(),Yu(),Xs=()=>!!jt.wasm.proxy&&typeof document<"u",eo=!1,Wo=!1,Go=!1,aa=new Map,Sn=(e,r)=>{let t=aa.get(e);t?t.push(r):aa.set(e,[r])},$n=()=>{if(eo||!Wo||Go||!Fr)throw new Error("worker not ready")},eb=e=>{switch(e.data.type){case"init-wasm":eo=!1,e.data.err?(Go=!0,Su[1](e.data.err)):(Wo=!0,Su[0]()),ia&&(URL.revokeObjectURL(ia),ia=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let r=aa.get(e.data.type);e.data.err?r.shift()[1](e.data.err):r.shift()[0](e.data.out);break}}},F0=async()=>{if(!Wo){if(eo)throw new Error("multiple calls to 'initWasm()' detected.");if(Go)throw new Error("previous call to 'initWasm()' failed.");if(eo=!0,Xs())return new Promise((e,r)=>{Fr==null||Fr.terminate(),Ib().then(([t,s])=>{try{Fr=s,Fr.onerror=n=>r(n),Fr.onmessage=eb,Su=[e,r];let o={type:"init-wasm",in:jt};!o.in.wasm.wasmPaths&&(t||Au)&&(o.in.wasm.wasmPaths={wasm:new URL("/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm",import.meta.url).href}),Fr.postMessage(o),ia=t}catch(o){r(o)}},r)});try{await Zu(jt.wasm),await gd(jt),Wo=!0}catch(e){throw Go=!0,e}finally{eo=!1}}},O0=async e=>{if(Xs())return $n(),new Promise((r,t)=>{Sn("init-ep",[r,t]);let s={type:"init-ep",in:{epName:e,env:jt}};Fr.postMessage(s)});await wd(jt,e)},D0=async e=>Xs()?($n(),new Promise((r,t)=>{Sn("copy-from",[r,t]);let s={type:"copy-from",in:{buffer:e}};Fr.postMessage(s,[e.buffer])})):wa(e),L0=async(e,r)=>{if(Xs()){if(r!=null&&r.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return $n(),new Promise((t,s)=>{Sn("create",[t,s]);let o={type:"create",in:{model:e,options:{...r}}},n=[];e instanceof Uint8Array&&n.push(e.buffer),Fr.postMessage(o,n)})}else return bd(e,r)},z0=async e=>{if(Xs())return $n(),new Promise((r,t)=>{Sn("release",[r,t]);let s={type:"release",in:e};Fr.postMessage(s)});Md(e)},B0=async(e,r,t,s,o,n)=>{if(Xs()){if(t.some(i=>i[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(o.some(i=>i))throw new Error("pre-allocated output tensor is not supported for proxy.");return $n(),new Promise((i,a)=>{Sn("run",[i,a]);let l=t,u={type:"run",in:{sessionId:e,inputIndices:r,inputs:l,outputIndices:s,options:n}};Fr.postMessage(u,xd(l))})}else return yd(e,r,t,s,o,n)},R0=async e=>{if(Xs())return $n(),new Promise((r,t)=>{Sn("end-profiling",[r,t]);let s={type:"end-profiling",in:e};Fr.postMessage(s)});vd(e)}}),$u,tb,N0,Yx=Re(()=>{_s(),j0(),ut(),Ju(),Db(),$u=(e,r)=>{switch(e.location){case"cpu":return[e.type,e.dims,e.data,"cpu"];case"gpu-buffer":return[e.type,e.dims,{gpuBuffer:e.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[e.type,e.dims,{mlTensor:e.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${e.location} for ${r()}`)}},tb=e=>{switch(e[3]){case"cpu":return new hs(e[0],e[2],e[1]);case"gpu-buffer":{let r=e[0];if(!rd(r))throw new Error(`not supported data type: ${r} for deserializing GPU tensor`);let{gpuBuffer:t,download:s,dispose:o}=e[2];return hs.fromGpuBuffer(t,{dataType:r,dims:e[1],download:s,dispose:o})}case"ml-tensor":{let r=e[0];if(!sd(r))throw new Error(`not supported data type: ${r} for deserializing MLTensor tensor`);let{mlTensor:t,download:s,dispose:o}=e[2];return hs.fromMLTensor(t,{dataType:r,dims:e[1],download:s,dispose:o})}default:throw new Error(`invalid data location: ${e[3]}`)}},N0=class{async fetchModelAndCopyToWasmMemory(e){return D0(await nd(e))}async loadModel(e,r){fs();let t;typeof e=="string"?t=await this.fetchModelAndCopyToWasmMemory(e):t=e,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await L0(t,r),Jr()}async dispose(){return z0(this.sessionId)}async run(e,r,t){fs();let s=[],o=[];Object.entries(e).forEach(d=>{let c=d[0],_=d[1],f=this.inputNames.indexOf(c);if(f===-1)throw new Error(`invalid input '${c}'`);s.push(_),o.push(f)});let n=[],i=[];Object.entries(r).forEach(d=>{let c=d[0],_=d[1],f=this.outputNames.indexOf(c);if(f===-1)throw new Error(`invalid output '${c}'`);n.push(_),i.push(f)});let a=s.map((d,c)=>$u(d,()=>`input "${this.inputNames[o[c]]}"`)),l=n.map((d,c)=>d?$u(d,()=>`output "${this.outputNames[i[c]]}"`):null),u=await B0(this.sessionId,o,a,i,l,t),p={};for(let d=0;dHu,initializeFlags:()=>Ku,wasmBackend:()=>U0});var Ku,Hu,U0,Zx=Re(()=>{_s(),j0(),Yx(),Ku=()=>{(typeof jt.wasm.initTimeout!="number"||jt.wasm.initTimeout<0)&&(jt.wasm.initTimeout=0);let e=jt.wasm.simd;if(typeof e!="boolean"&&e!==void 0&&e!=="fixed"&&e!=="relaxed"&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${e}". Reset it to \`false\` and ignore SIMD feature checking.`),jt.wasm.simd=!1),typeof jt.wasm.proxy!="boolean"&&(jt.wasm.proxy=!1),typeof jt.wasm.trace!="boolean"&&(jt.wasm.trace=!1),typeof jt.wasm.numThreads!="number"||!Number.isInteger(jt.wasm.numThreads)||jt.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)jt.wasm.numThreads=1;else{let r=typeof navigator>"u"?Rv("node:os").cpus().length:navigator.hardwareConcurrency;jt.wasm.numThreads=Math.min(4,Math.ceil((r||1)/2))}},Hu=class{async init(e){Ku(),await F0(),await O0(e)}async createInferenceSessionHandler(e,r){let t=new N0;return await t.loadModel(e,r),t}},U0=new Hu});_s();_s();_s();var eT="1.22.0-dev.20250409-89f8206ba4",tT=Eb;{let e=(Zx(),Jo(V0)).wasmBackend;Fn("webgpu",e,5),Fn("webnn",e,5),Fn("cpu",e,10),Fn("wasm",e,10)}Object.defineProperty(jt.versions,"web",{value:eT,enumerable:!0});/** +* @license +* Copyright 2021 Google LLC. All Rights Reserved. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============================================================================= +*//** + * @license + * Copyright 2020 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + *//** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + */const rT=Object.freeze(Object.defineProperty({__proto__:null,get InferenceSession(){return Qu},get TRACE(){return Yo},get TRACE_FUNC_BEGIN(){return fs},get TRACE_FUNC_END(){return Jr},get Tensor(){return hs},default:tT,get env(){return jt},get registerBackend(){return Fn}},Symbol.toStringTag,{value:"Module"}));var As={},sT={"onnxruntime-common":e=>{e.exports=Dv},"onnxruntime-web":e=>{e.exports=rT},"?2ce3":()=>{},"?7a2c":()=>{},"?a42a":()=>{},"?2b25":()=>{},"?569f":()=>{},"?3f59":()=>{},"?154a":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,r,t)=>{t.r(r),t.d(r,{Environment:()=>Se,Interpreter:()=>Ae,Template:()=>Ve,parse:()=>V,tokenize:()=>d});var s=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",NullLiteral:"NullLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndSet:"EndSet",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator",Macro:"Macro",EndMacro:"EndMacro"}),o=Object.freeze({set:s.Set,for:s.For,in:s.In,is:s.Is,if:s.If,else:s.Else,endset:s.EndSet,endif:s.EndIf,elif:s.ElseIf,endfor:s.EndFor,and:s.And,or:s.Or,not:s.Not,"not in":s.NotIn,macro:s.Macro,endmacro:s.EndMacro,true:s.BooleanLiteral,false:s.BooleanLiteral,none:s.NullLiteral,True:s.BooleanLiteral,False:s.BooleanLiteral,None:s.NullLiteral}),n=class{constructor(O,Y){this.value=O,this.type=Y}};function i(O){return/\w/.test(O)}function a(O){return/[0-9]/.test(O)}var l=[["{%",s.OpenStatement],["%}",s.CloseStatement],["{{",s.OpenExpression],["}}",s.CloseExpression],["(",s.OpenParen],[")",s.CloseParen],["{",s.OpenCurlyBracket],["}",s.CloseCurlyBracket],["[",s.OpenSquareBracket],["]",s.CloseSquareBracket],[",",s.Comma],[".",s.Dot],[":",s.Colon],["|",s.Pipe],["<=",s.ComparisonBinaryOperator],[">=",s.ComparisonBinaryOperator],["==",s.ComparisonBinaryOperator],["!=",s.ComparisonBinaryOperator],["<",s.ComparisonBinaryOperator],[">",s.ComparisonBinaryOperator],["+",s.AdditiveBinaryOperator],["-",s.AdditiveBinaryOperator],["*",s.MultiplicativeBinaryOperator],["/",s.MultiplicativeBinaryOperator],["%",s.MultiplicativeBinaryOperator],["=",s.Equals]],u=new Map([["n",` +`],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function p(O,Y={}){return O.endsWith(` +`)&&(O=O.slice(0,-1)),O=O.replace(/{#.*?#}/gs,"{##}"),Y.lstrip_blocks&&(O=O.replace(/^[ \t]*({[#%])/gm,"$1")),Y.trim_blocks&&(O=O.replace(/([#%]})\n/g,"$1")),O.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}function d(O,Y={}){var Ee,ke,Ie;const z=[],J=p(O,Y);let le=0;const ye=Be=>{let Xe="";for(;Be(J[le]);){if(J[le]==="\\"){if(++le,le>=J.length)throw new SyntaxError("Unexpected end of input");const Ge=J[le++],lt=u.get(Ge);if(lt===void 0)throw new SyntaxError(`Unexpected escaped character: ${Ge}`);Xe+=lt;continue}if(Xe+=J[le++],le>=J.length)throw new SyntaxError("Unexpected end of input")}return Xe};e:for(;le0){z.push(new n(Ge,s.Text));continue}}ye(Ge=>/\s/.test(Ge));const Xe=J[le];if(Xe==="-"||Xe==="+"){const Ge=(ke=z.at(-1))==null?void 0:ke.type;if(Ge===s.Text||Ge===void 0)throw new SyntaxError(`Unexpected character: ${Xe}`);switch(Ge){case s.Identifier:case s.NumericLiteral:case s.BooleanLiteral:case s.NullLiteral:case s.StringLiteral:case s.CloseParen:case s.CloseSquareBracket:break;default:{++le;const lt=ye(a);z.push(new n(`${Xe}${lt}`,lt.length>0?s.NumericLiteral:s.UnaryOperator));continue}}}for(const[Ge,lt]of l)if(J.slice(le,le+Ge.length)===Ge){z.push(new n(Ge,lt)),le+=Ge.length;continue e}if(Xe==="'"||Xe==='"'){++le;const Ge=ye(lt=>lt!==Xe);z.push(new n(Ge,s.StringLiteral)),++le;continue}if(a(Xe)){const Ge=ye(a);z.push(new n(Ge,s.NumericLiteral));continue}if(i(Xe)){const Ge=ye(i),lt=Object.hasOwn(o,Ge)?o[Ge]:s.Identifier;lt===s.In&&((Ie=z.at(-1))==null?void 0:Ie.type)===s.Not?(z.pop(),z.push(new n("not in",s.NotIn))):z.push(new n(Ge,lt));continue}throw new SyntaxError(`Unexpected character: ${Xe}`)}return z}var c=class{constructor(){te(this,"type","Statement")}},_=class extends c{constructor(Y){super();te(this,"type","Program");this.body=Y}},f=class extends c{constructor(Y,z,J){super();te(this,"type","If");this.test=Y,this.body=z,this.alternate=J}},v=class extends c{constructor(Y,z,J,le){super();te(this,"type","For");this.loopvar=Y,this.iterable=z,this.body=J,this.defaultBlock=le}},$=class extends c{constructor(Y,z,J){super();te(this,"type","Set");this.assignee=Y,this.value=z,this.body=J}},w=class extends c{constructor(Y,z,J){super();te(this,"type","Macro");this.name=Y,this.args=z,this.body=J}},g=class extends c{constructor(){super(...arguments);te(this,"type","Expression")}},C=class extends g{constructor(Y,z,J){super();te(this,"type","MemberExpression");this.object=Y,this.property=z,this.computed=J}},E=class extends g{constructor(Y,z){super();te(this,"type","CallExpression");this.callee=Y,this.args=z}},y=class extends g{constructor(Y){super();te(this,"type","Identifier");this.value=Y}},b=class extends g{constructor(Y){super();te(this,"type","Literal");this.value=Y}},x=class extends b{constructor(){super(...arguments);te(this,"type","NumericLiteral")}},S=class extends b{constructor(){super(...arguments);te(this,"type","StringLiteral")}},A=class extends b{constructor(){super(...arguments);te(this,"type","BooleanLiteral")}},B=class extends b{constructor(){super(...arguments);te(this,"type","NullLiteral")}},K=class extends b{constructor(){super(...arguments);te(this,"type","ArrayLiteral")}},G=class extends b{constructor(){super(...arguments);te(this,"type","TupleLiteral")}},j=class extends b{constructor(){super(...arguments);te(this,"type","ObjectLiteral")}},ee=class extends g{constructor(Y,z,J){super();te(this,"type","BinaryExpression");this.operator=Y,this.left=z,this.right=J}},H=class extends g{constructor(Y,z){super();te(this,"type","FilterExpression");this.operand=Y,this.filter=z}},Z=class extends g{constructor(Y,z){super();te(this,"type","SelectExpression");this.iterable=Y,this.test=z}},X=class extends g{constructor(Y,z,J){super();te(this,"type","TestExpression");this.operand=Y,this.negate=z,this.test=J}},oe=class extends g{constructor(Y,z){super();te(this,"type","UnaryExpression");this.operator=Y,this.argument=z}},me=class extends g{constructor(Y=void 0,z=void 0,J=void 0){super();te(this,"type","SliceExpression");this.start=Y,this.stop=z,this.step=J}},ae=class extends g{constructor(Y,z){super();te(this,"type","KeywordArgumentExpression");this.key=Y,this.value=z}};function V(O){const Y=new _([]);let z=0;function J(De,Qe){const et=O[z++];if(!et||et.type!==De)throw new Error(`Parser Error: ${Qe}. ${et.type} !== ${De}.`);return et}function le(){switch(O[z].type){case s.Text:return ke();case s.OpenStatement:return Ie();case s.OpenExpression:return Be();default:throw new SyntaxError(`Unexpected token type: ${O[z].type}`)}}function ye(...De){return z+De.length<=O.length&&De.some((Qe,et)=>Qe!==O[z+et].type)}function Ee(...De){return z+De.length<=O.length&&De.every((Qe,et)=>Qe===O[z+et].type)}function ke(){return new S(J(s.Text,"Expected text token").value)}function Ie(){J(s.OpenStatement,"Expected opening statement token");let De;switch(O[z].type){case s.Set:++z,De=Xe(),J(s.CloseStatement,"Expected closing statement token");break;case s.If:++z,De=Ge(),J(s.OpenStatement,"Expected {% token"),J(s.EndIf,"Expected endif token"),J(s.CloseStatement,"Expected %} token");break;case s.Macro:++z,De=lt(),J(s.OpenStatement,"Expected {% token"),J(s.EndMacro,"Expected endmacro token"),J(s.CloseStatement,"Expected %} token");break;case s.For:++z,De=Gt(),J(s.OpenStatement,"Expected {% token"),J(s.EndFor,"Expected endfor token"),J(s.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${O[z].type}`)}return De}function Be(){J(s.OpenExpression,"Expected opening expression token");const De=Ot();return J(s.CloseExpression,"Expected closing expression token"),De}function Xe(){var Qe,et;const De=Ot();if(Ee(s.Equals)){++z;const Bt=Ot();return new $(De,Bt,[])}else{const Bt=[];for(J(s.CloseStatement,"Expected %} token");!(((Qe=O[z])==null?void 0:Qe.type)===s.OpenStatement&&((et=O[z+1])==null?void 0:et.type)===s.EndSet);){const Or=le();Bt.push(Or)}return J(s.OpenStatement,"Expected {% token"),J(s.EndSet,"Expected endset token"),new $(De,null,Bt)}}function Ge(){var Bt,Or,Pr,rs,ss,Ur,ns,os;const De=Ot();J(s.CloseStatement,"Expected closing statement token");const Qe=[],et=[];for(;!(((Bt=O[z])==null?void 0:Bt.type)===s.OpenStatement&&(((Or=O[z+1])==null?void 0:Or.type)===s.ElseIf||((Pr=O[z+1])==null?void 0:Pr.type)===s.Else||((rs=O[z+1])==null?void 0:rs.type)===s.EndIf));)Qe.push(le());if(((ss=O[z])==null?void 0:ss.type)===s.OpenStatement&&((Ur=O[z+1])==null?void 0:Ur.type)!==s.EndIf)if(++z,Ee(s.ElseIf))J(s.ElseIf,"Expected elseif token"),et.push(Ge());else for(J(s.Else,"Expected else token"),J(s.CloseStatement,"Expected closing statement token");!(((ns=O[z])==null?void 0:ns.type)===s.OpenStatement&&((os=O[z+1])==null?void 0:os.type)===s.EndIf);)et.push(le());return new f(De,Qe,et)}function lt(){const De=Xt();if(De.type!=="Identifier")throw new SyntaxError("Expected identifier following macro statement");const Qe=Zr();J(s.CloseStatement,"Expected closing statement token");const et=[];for(;ye(s.OpenStatement,s.EndMacro);)et.push(le());return new w(De,Qe,et)}function wt(De=!1){const Qe=De?Xt:Ot,et=[Qe()],Bt=Ee(s.Comma);for(;Bt&&(++z,et.push(Qe()),!!Ee(s.Comma)););return Bt?new G(et):et[0]}function Gt(){const De=wt(!0);if(!(De instanceof y||De instanceof G))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${De.type} instead`);J(s.In,"Expected `in` keyword following loop variable");const Qe=Ot();J(s.CloseStatement,"Expected closing statement token");const et=[];for(;ye(s.OpenStatement,s.EndFor)&&ye(s.OpenStatement,s.Else);)et.push(le());const Bt=[];if(Ee(s.OpenStatement,s.Else))for(++z,++z,J(s.CloseStatement,"Expected closing statement token");ye(s.OpenStatement,s.EndFor);)Bt.push(le());return new v(De,Qe,et,Bt)}function Ot(){return lr()}function lr(){const De=Yr();if(Ee(s.If)){++z;const Qe=Yr();if(Ee(s.Else)){++z;const et=Yr();return new f(Qe,[De],[et])}else return new Z(De,Qe)}return De}function Yr(){let De=gs();for(;Ee(s.Or);){const Qe=O[z];++z;const et=gs();De=new ee(Qe,De,et)}return De}function gs(){let De=kr();for(;Ee(s.And);){const Qe=O[z];++z;const et=kr();De=new ee(Qe,De,et)}return De}function kr(){let De;for(;Ee(s.Not);){const Qe=O[z];++z;const et=kr();De=new oe(Qe,et)}return De??Ds()}function Ds(){let De=xs();for(;Ee(s.ComparisonBinaryOperator)||Ee(s.In)||Ee(s.NotIn);){const Qe=O[z];++z;const et=xs();De=new ee(Qe,De,et)}return De}function xs(){let De=es();for(;Ee(s.AdditiveBinaryOperator);){const Qe=O[z];++z;const et=es();De=new ee(Qe,De,et)}return De}function Ls(){const De=Ft(Xt());return Ee(s.OpenParen)?at(De):De}function at(De){let Qe=new E(De,Zr());return Qe=Ft(Qe),Ee(s.OpenParen)&&(Qe=at(Qe)),Qe}function Zr(){J(s.OpenParen,"Expected opening parenthesis for arguments list");const De=Ir();return J(s.CloseParen,"Expected closing parenthesis for arguments list"),De}function Ir(){const De=[];for(;!Ee(s.CloseParen);){let Qe=Ot();if(Ee(s.Equals)){if(++z,!(Qe instanceof y))throw new SyntaxError("Expected identifier for keyword argument");const et=Ot();Qe=new ae(Qe,et)}De.push(Qe),Ee(s.Comma)&&++z}return De}function ws(){const De=[];let Qe=!1;for(;!Ee(s.CloseSquareBracket);)Ee(s.Colon)?(De.push(void 0),++z,Qe=!0):(De.push(Ot()),Ee(s.Colon)&&(++z,Qe=!0));if(De.length===0)throw new SyntaxError("Expected at least one argument for member/slice expression");if(Qe){if(De.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new me(...De)}return De[0]}function Ft(De){for(;Ee(s.Dot)||Ee(s.OpenSquareBracket);){const Qe=O[z];++z;let et;const Bt=Qe.type!==s.Dot;if(Bt)et=ws(),J(s.CloseSquareBracket,"Expected closing square bracket");else if(et=Xt(),et.type!=="Identifier")throw new SyntaxError("Expected identifier following dot operator");De=new C(De,et,Bt)}return De}function es(){let De=ts();for(;Ee(s.MultiplicativeBinaryOperator);){const Qe=O[z];++z;const et=ts();De=new ee(Qe,De,et)}return De}function ts(){let De=bs();for(;Ee(s.Is);){++z;const Qe=Ee(s.Not);Qe&&++z;let et=Xt();if(et instanceof A?et=new y(et.value.toString()):et instanceof B&&(et=new y("none")),!(et instanceof y))throw new SyntaxError("Expected identifier for the test");De=new X(De,Qe,et)}return De}function bs(){let De=Ls();for(;Ee(s.Pipe);){++z;let Qe=Xt();if(!(Qe instanceof y))throw new SyntaxError("Expected identifier for the filter");Ee(s.OpenParen)&&(Qe=at(Qe)),De=new H(De,Qe)}return De}function Xt(){const De=O[z];switch(De.type){case s.NumericLiteral:return++z,new x(Number(De.value));case s.StringLiteral:return++z,new S(De.value);case s.BooleanLiteral:return++z,new A(De.value.toLowerCase()==="true");case s.NullLiteral:return++z,new B(null);case s.Identifier:return++z,new y(De.value);case s.OpenParen:{++z;const Qe=wt();if(O[z].type!==s.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${O[z].type} instead`);return++z,Qe}case s.OpenSquareBracket:{++z;const Qe=[];for(;!Ee(s.CloseSquareBracket);)Qe.push(Ot()),Ee(s.Comma)&&++z;return++z,new K(Qe)}case s.OpenCurlyBracket:{++z;const Qe=new Map;for(;!Ee(s.CloseCurlyBracket);){const et=Ot();J(s.Colon,"Expected colon between key and value in object literal");const Bt=Ot();Qe.set(et,Bt),Ee(s.Comma)&&++z}return++z,new j(Qe)}default:throw new SyntaxError(`Unexpected token: ${De.type}`)}}for(;z=0?(Y=(Y??(Y=0))<0?Math.max(O.length+Y,0):Math.min(Y,O.length),z=(z??(z=O.length))<0?Math.max(O.length+z,0):Math.min(z,O.length)):(Y=(Y??(Y=O.length-1))<0?Math.max(O.length+Y,-1):Math.min(Y,O.length-1),z=(z??(z=-1))<-1?Math.max(O.length+z,-1):Math.min(z,O.length-1));const ye=[];for(let Ee=Y;le*EeY.toUpperCase())}var fe=class{constructor(O=void 0){te(this,"type","RuntimeValue");te(this,"value");te(this,"builtins",new Map);this.value=O}__bool__(){return new $e(!!this.value)}},se=class extends fe{constructor(){super(...arguments);te(this,"type","NumericValue")}},ce=class extends fe{constructor(){super(...arguments);te(this,"type","StringValue");te(this,"builtins",new Map([["upper",new pe(()=>new ce(this.value.toUpperCase()))],["lower",new pe(()=>new ce(this.value.toLowerCase()))],["strip",new pe(()=>new ce(this.value.trim()))],["title",new pe(()=>new ce(re(this.value)))],["length",new se(this.value.length)],["rstrip",new pe(()=>new ce(this.value.trimEnd()))],["lstrip",new pe(()=>new ce(this.value.trimStart()))],["split",new pe(Y=>{const z=Y[0]??new xe;if(!(z instanceof ce||z instanceof xe))throw new Error("sep argument must be a string or null");const J=Y[1]??new se(-1);if(!(J instanceof se))throw new Error("maxsplit argument must be a number");let le=[];if(z instanceof xe){const ye=this.value.trimStart();for(const{0:Ee,index:ke}of ye.matchAll(/\S+/g)){if(J.value!==-1&&le.length>=J.value&&ke!==void 0){le.push(Ee+ye.slice(ke+Ee.length));break}le.push(Ee)}}else{if(z.value==="")throw new Error("empty separator");le=this.value.split(z.value),J.value!==-1&&le.length>J.value&&le.push(le.splice(J.value).join(z.value))}return new q(le.map(ye=>new ce(ye)))})]]))}},$e=class extends fe{constructor(){super(...arguments);te(this,"type","BooleanValue")}},Ue=class extends fe{constructor(){super(...arguments);te(this,"type","ObjectValue");te(this,"builtins",new Map([["get",new pe(([Y,z])=>{if(!(Y instanceof ce))throw new Error(`Object key must be a string: got ${Y.type}`);return this.value.get(Y.value)??z??new xe})],["items",new pe(()=>new q(Array.from(this.value.entries()).map(([Y,z])=>new q([new ce(Y),z]))))]]))}__bool__(){return new $e(this.value.size>0)}},we=class extends Ue{constructor(){super(...arguments);te(this,"type","KeywordArgumentsValue")}},q=class extends fe{constructor(){super(...arguments);te(this,"type","ArrayValue");te(this,"builtins",new Map([["length",new se(this.value.length)]]))}__bool__(){return new $e(this.value.length>0)}},R=class extends q{constructor(){super(...arguments);te(this,"type","TupleValue")}},pe=class extends fe{constructor(){super(...arguments);te(this,"type","FunctionValue")}},xe=class extends fe{constructor(){super(...arguments);te(this,"type","NullValue")}},Me=class extends fe{constructor(){super(...arguments);te(this,"type","UndefinedValue")}},Se=class{constructor(O){te(this,"variables",new Map([["namespace",new pe(O=>{if(O.length===0)return new Ue(new Map);if(O.length!==1||!(O[0]instanceof Ue))throw new Error("`namespace` expects either zero arguments or a single object argument");return O[0]})]]));te(this,"tests",new Map([["boolean",O=>O.type==="BooleanValue"],["callable",O=>O instanceof pe],["odd",O=>{if(O.type!=="NumericValue")throw new Error(`Cannot apply test "odd" to type: ${O.type}`);return O.value%2!==0}],["even",O=>{if(O.type!=="NumericValue")throw new Error(`Cannot apply test "even" to type: ${O.type}`);return O.value%2===0}],["false",O=>O.type==="BooleanValue"&&!O.value],["true",O=>O.type==="BooleanValue"&&O.value],["none",O=>O.type==="NullValue"],["string",O=>O.type==="StringValue"],["number",O=>O.type==="NumericValue"],["integer",O=>O.type==="NumericValue"&&Number.isInteger(O.value)],["iterable",O=>O.type==="ArrayValue"||O.type==="StringValue"],["mapping",O=>O.type==="ObjectValue"],["lower",O=>{const Y=O.value;return O.type==="StringValue"&&Y===Y.toLowerCase()}],["upper",O=>{const Y=O.value;return O.type==="StringValue"&&Y===Y.toUpperCase()}],["none",O=>O.type==="NullValue"],["defined",O=>O.type!=="UndefinedValue"],["undefined",O=>O.type==="UndefinedValue"],["equalto",(O,Y)=>O.value===Y.value],["eq",(O,Y)=>O.value===Y.value]]));this.parent=O}set(O,Y){return this.declareVariable(O,Fe(Y))}declareVariable(O,Y){if(this.variables.has(O))throw new SyntaxError(`Variable already declared: ${O}`);return this.variables.set(O,Y),Y}setVariable(O,Y){return this.variables.set(O,Y),Y}resolve(O){if(this.variables.has(O))return this;if(this.parent)return this.parent.resolve(O);throw new Error(`Unknown variable: ${O}`)}lookupVariable(O){try{return this.resolve(O).variables.get(O)??new Me}catch{return new Me}}},Ae=class{constructor(O){te(this,"global");this.global=O??new Se}run(O){return this.evaluate(O,this.global)}evaluateBinaryExpression(O,Y){const z=this.evaluate(O.left,Y);switch(O.operator.value){case"and":return z.__bool__().value?this.evaluate(O.right,Y):z;case"or":return z.__bool__().value?z:this.evaluate(O.right,Y)}const J=this.evaluate(O.right,Y);switch(O.operator.value){case"==":return new $e(z.value==J.value);case"!=":return new $e(z.value!=J.value)}if(z instanceof Me||J instanceof Me)throw new Error("Cannot perform operation on undefined values");if(z instanceof xe||J instanceof xe)throw new Error("Cannot perform operation on null values");if(z instanceof se&&J instanceof se)switch(O.operator.value){case"+":return new se(z.value+J.value);case"-":return new se(z.value-J.value);case"*":return new se(z.value*J.value);case"/":return new se(z.value/J.value);case"%":return new se(z.value%J.value);case"<":return new $e(z.value":return new $e(z.value>J.value);case">=":return new $e(z.value>=J.value);case"<=":return new $e(z.value<=J.value)}else if(z instanceof q&&J instanceof q)switch(O.operator.value){case"+":return new q(z.value.concat(J.value))}else if(J instanceof q){const le=J.value.find(ye=>ye.value===z.value)!==void 0;switch(O.operator.value){case"in":return new $e(le);case"not in":return new $e(!le)}}if(z instanceof ce||J instanceof ce)switch(O.operator.value){case"+":return new ce(z.value.toString()+J.value.toString())}if(z instanceof ce&&J instanceof ce)switch(O.operator.value){case"in":return new $e(J.value.includes(z.value));case"not in":return new $e(!J.value.includes(z.value))}if(z instanceof ce&&J instanceof Ue)switch(O.operator.value){case"in":return new $e(J.value.has(z.value));case"not in":return new $e(!J.value.has(z.value))}throw new SyntaxError(`Unknown operator "${O.operator.value}" between ${z.type} and ${J.type}`)}evaluateArguments(O,Y){const z=[],J=new Map;for(const le of O)if(le.type==="KeywordArgumentExpression"){const ye=le;J.set(ye.key.value,this.evaluate(ye.value,Y))}else{if(J.size>0)throw new Error("Positional arguments must come before keyword arguments");z.push(this.evaluate(le,Y))}return[z,J]}evaluateFilterExpression(O,Y){const z=this.evaluate(O.operand,Y);if(O.filter.type==="Identifier"){const J=O.filter;if(J.value==="tojson")return new ce(ze(z));if(z instanceof q)switch(J.value){case"list":return z;case"first":return z.value[0];case"last":return z.value[z.value.length-1];case"length":return new se(z.value.length);case"reverse":return new q(z.value.reverse());case"sort":return new q(z.value.sort((le,ye)=>{if(le.type!==ye.type)throw new Error(`Cannot compare different types: ${le.type} and ${ye.type}`);switch(le.type){case"NumericValue":return le.value-ye.value;case"StringValue":return le.value.localeCompare(ye.value);default:throw new Error(`Cannot compare type: ${le.type}`)}}));case"join":return new ce(z.value.map(le=>le.value).join(""));case"string":return new ce(ze(z));default:throw new Error(`Unknown ArrayValue filter: ${J.value}`)}else if(z instanceof ce)switch(J.value){case"length":return new se(z.value.length);case"upper":return new ce(z.value.toUpperCase());case"lower":return new ce(z.value.toLowerCase());case"title":return new ce(re(z.value));case"capitalize":return new ce(z.value.charAt(0).toUpperCase()+z.value.slice(1));case"trim":return new ce(z.value.trim());case"indent":return new ce(z.value.split(` +`).map((le,ye)=>ye===0||le.length===0?le:" "+le).join(` +`));case"join":case"string":return z;default:throw new Error(`Unknown StringValue filter: ${J.value}`)}else if(z instanceof se)switch(J.value){case"abs":return new se(Math.abs(z.value));default:throw new Error(`Unknown NumericValue filter: ${J.value}`)}else if(z instanceof Ue)switch(J.value){case"items":return new q(Array.from(z.value.entries()).map(([le,ye])=>new q([new ce(le),ye])));case"length":return new se(z.value.size);default:throw new Error(`Unknown ObjectValue filter: ${J.value}`)}throw new Error(`Cannot apply filter "${J.value}" to type: ${z.type}`)}else if(O.filter.type==="CallExpression"){const J=O.filter;if(J.callee.type!=="Identifier")throw new Error(`Unknown filter: ${J.callee.type}`);const le=J.callee.value;if(le==="tojson"){const[,ye]=this.evaluateArguments(J.args,Y),Ee=ye.get("indent")??new xe;if(!(Ee instanceof se||Ee instanceof xe))throw new Error("If set, indent must be a number");return new ce(ze(z,Ee.value))}else if(le==="join"){let ye;if(z instanceof ce)ye=Array.from(z.value);else if(z instanceof q)ye=z.value.map(Be=>Be.value);else throw new Error(`Cannot apply filter "${le}" to type: ${z.type}`);const[Ee,ke]=this.evaluateArguments(J.args,Y),Ie=Ee.at(0)??ke.get("separator")??new ce("");if(!(Ie instanceof ce))throw new Error("separator must be a string");return new ce(ye.join(Ie.value))}if(z instanceof q){switch(le){case"selectattr":case"rejectattr":{const ye=le==="selectattr";if(z.value.some(Ge=>!(Ge instanceof Ue)))throw new Error(`\`${le}\` can only be applied to array of objects`);if(J.args.some(Ge=>Ge.type!=="StringLiteral"))throw new Error(`arguments of \`${le}\` must be strings`);const[Ee,ke,Ie]=J.args.map(Ge=>this.evaluate(Ge,Y));let Be;if(ke){const Ge=Y.tests.get(ke.value);if(!Ge)throw new Error(`Unknown test: ${ke.value}`);Be=Ge}else Be=(...Ge)=>Ge[0].__bool__().value;const Xe=z.value.filter(Ge=>{const lt=Ge.value.get(Ee.value),wt=lt?Be(lt,Ie):!1;return ye?wt:!wt});return new q(Xe)}case"map":{const[,ye]=this.evaluateArguments(J.args,Y);if(ye.has("attribute")){const Ee=ye.get("attribute");if(!(Ee instanceof ce))throw new Error("attribute must be a string");const ke=ye.get("default"),Ie=z.value.map(Be=>{if(!(Be instanceof Ue))throw new Error("items in map must be an object");return Be.value.get(Ee.value)??ke??new Me});return new q(Ie)}else throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${le}`)}else if(z instanceof ce){switch(le){case"indent":{const[ye,Ee]=this.evaluateArguments(J.args,Y),ke=ye.at(0)??Ee.get("width")??new se(4);if(!(ke instanceof se))throw new Error("width must be a number");const Ie=ye.at(1)??Ee.get("first")??new $e(!1),Be=ye.at(2)??Ee.get("blank")??new $e(!1),Xe=z.value.split(` +`),Ge=" ".repeat(ke.value),lt=Xe.map((wt,Gt)=>!Ie.value&&Gt===0||!Be.value&&wt.length===0?wt:Ge+wt);return new ce(lt.join(` +`))}}throw new Error(`Unknown StringValue filter: ${le}`)}else throw new Error(`Cannot apply filter "${le}" to type: ${z.type}`)}throw new Error(`Unknown filter: ${O.filter.type}`)}evaluateTestExpression(O,Y){const z=this.evaluate(O.operand,Y),J=Y.tests.get(O.test.value);if(!J)throw new Error(`Unknown test: ${O.test.value}`);const le=J(z);return new $e(O.negate?!le:le)}evaluateUnaryExpression(O,Y){const z=this.evaluate(O.argument,Y);switch(O.operator.value){case"not":return new $e(!z.value);default:throw new SyntaxError(`Unknown operator: ${O.operator.value}`)}}evalProgram(O,Y){return this.evaluateBlock(O.body,Y)}evaluateBlock(O,Y){let z="";for(const J of O){const le=this.evaluate(J,Y);le.type!=="NullValue"&&le.type!=="UndefinedValue"&&(z+=le.value)}return new ce(z)}evaluateIdentifier(O,Y){return Y.lookupVariable(O.value)}evaluateCallExpression(O,Y){const[z,J]=this.evaluateArguments(O.args,Y);J.size>0&&z.push(new we(J));const le=this.evaluate(O.callee,Y);if(le.type!=="FunctionValue")throw new Error(`Cannot call something that is not a function: got ${le.type}`);return le.value(z,Y)}evaluateSliceExpression(O,Y,z){if(!(O instanceof q||O instanceof ce))throw new Error("Slice object must be an array or string");const J=this.evaluate(Y.start,z),le=this.evaluate(Y.stop,z),ye=this.evaluate(Y.step,z);if(!(J instanceof se||J instanceof Me))throw new Error("Slice start must be numeric or undefined");if(!(le instanceof se||le instanceof Me))throw new Error("Slice stop must be numeric or undefined");if(!(ye instanceof se||ye instanceof Me))throw new Error("Slice step must be numeric or undefined");return O instanceof q?new q(W(O.value,J.value,le.value,ye.value)):new ce(W(Array.from(O.value),J.value,le.value,ye.value).join(""))}evaluateMemberExpression(O,Y){const z=this.evaluate(O.object,Y);let J;if(O.computed){if(O.property.type==="SliceExpression")return this.evaluateSliceExpression(z,O.property,Y);J=this.evaluate(O.property,Y)}else J=new ce(O.property.value);let le;if(z instanceof Ue){if(!(J instanceof ce))throw new Error(`Cannot access property with non-string: got ${J.type}`);le=z.value.get(J.value)??z.builtins.get(J.value)}else if(z instanceof q||z instanceof ce)if(J instanceof se)le=z.value.at(J.value),z instanceof ce&&(le=new ce(z.value.at(J.value)));else if(J instanceof ce)le=z.builtins.get(J.value);else throw new Error(`Cannot access property with non-string/non-number: got ${J.type}`);else{if(!(J instanceof ce))throw new Error(`Cannot access property with non-string: got ${J.type}`);le=z.builtins.get(J.value)}return le instanceof fe?le:new Me}evaluateSet(O,Y){const z=O.value?this.evaluate(O.value,Y):this.evaluateBlock(O.body,Y);if(O.assignee.type==="Identifier"){const J=O.assignee.value;Y.setVariable(J,z)}else if(O.assignee.type==="MemberExpression"){const J=O.assignee,le=this.evaluate(J.object,Y);if(!(le instanceof Ue))throw new Error("Cannot assign to member of non-object");if(J.property.type!=="Identifier")throw new Error("Cannot assign to member with non-identifier property");le.value.set(J.property.value,z)}else throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(O.assignee)}`);return new xe}evaluateIf(O,Y){const z=this.evaluate(O.test,Y);return this.evaluateBlock(z.__bool__().value?O.body:O.alternate,Y)}evaluateFor(O,Y){const z=new Se(Y);let J,le;if(O.iterable.type==="SelectExpression"){const Be=O.iterable;le=this.evaluate(Be.iterable,z),J=Be.test}else le=this.evaluate(O.iterable,z);if(!(le instanceof q))throw new Error(`Expected iterable type in for loop: got ${le.type}`);const ye=[],Ee=[];for(let Be=0;Bewt.setVariable(O.loopvar.value,Ge);else if(O.loopvar.type==="TupleLiteral"){const wt=O.loopvar;if(Ge.type!=="ArrayValue")throw new Error(`Cannot unpack non-iterable type: ${Ge.type}`);const Gt=Ge;if(wt.value.length!==Gt.value.length)throw new Error(`Too ${wt.value.length>Gt.value.length?"few":"many"} items to unpack`);lt=Ot=>{for(let lr=0;lr0?ye[Be-1]:new Me],["nextitem",Be{var Ee;const le=new Se(J);z=z.slice();let ye;((Ee=z.at(-1))==null?void 0:Ee.type)==="KeywordArgumentsValue"&&(ye=z.pop());for(let ke=0;kethis.evaluate(z,Y)));case"TupleLiteral":return new R(O.value.map(z=>this.evaluate(z,Y)));case"ObjectLiteral":{const z=new Map;for(const[J,le]of O.value){const ye=this.evaluate(J,Y);if(!(ye instanceof ce))throw new Error(`Object keys must be strings: got ${ye.type}`);z.set(ye.value,this.evaluate(le,Y))}return new Ue(z)}case"Identifier":return this.evaluateIdentifier(O,Y);case"CallExpression":return this.evaluateCallExpression(O,Y);case"MemberExpression":return this.evaluateMemberExpression(O,Y);case"UnaryExpression":return this.evaluateUnaryExpression(O,Y);case"BinaryExpression":return this.evaluateBinaryExpression(O,Y);case"FilterExpression":return this.evaluateFilterExpression(O,Y);case"TestExpression":return this.evaluateTestExpression(O,Y);default:throw new SyntaxError(`Unknown node type: ${O.type}`)}}};function Fe(O){switch(typeof O){case"number":return new se(O);case"string":return new ce(O);case"boolean":return new $e(O);case"undefined":return new Me;case"object":return O===null?new xe:Array.isArray(O)?new q(O.map(Fe)):new Ue(new Map(Object.entries(O).map(([Y,z])=>[Y,Fe(z)])));case"function":return new pe((Y,z)=>{const J=O(...Y.map(le=>le.value))??null;return Fe(J)});default:throw new Error(`Cannot convert to runtime value: ${O}`)}}function ze(O,Y,z){const J=z??0;switch(O.type){case"NullValue":case"UndefinedValue":return"null";case"NumericValue":case"StringValue":case"BooleanValue":return JSON.stringify(O.value);case"ArrayValue":case"ObjectValue":{const le=Y?" ".repeat(Y):"",ye=` +`+le.repeat(J),Ee=ye+le;if(O.type==="ArrayValue"){const ke=O.value.map(Ie=>ze(Ie,Y,J+1));return Y?`[${Ee}${ke.join(`,${Ee}`)}${ye}]`:`[${ke.join(", ")}]`}else{const ke=Array.from(O.value.entries()).map(([Ie,Be])=>{const Xe=`"${Ie}": ${ze(Be,Y,J+1)}`;return Y?`${Ee}${Xe}`:Xe});return Y?`{${ke.join(",")}${ye}}`:`{${ke.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${O.type}`)}}var Ve=class{constructor(O){te(this,"parsed");const Y=d(O,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=V(Y)}render(O){const Y=new Se;if(Y.set("false",!1),Y.set("true",!0),Y.set("raise_exception",le=>{throw new Error(le)}),Y.set("range",F),O)for(const[le,ye]of Object.entries(O))Y.set(le,ye);return new Ae(Y).run(this.parsed).value}}},"./src/backends/onnx.js":(e,r,t)=>{var s;t.r(r),t.d(r,{Tensor:()=>a.Tensor,createInferenceSession:()=>$,deviceToExecutionProviders:()=>f,isONNXProxy:()=>C,isONNXTensor:()=>w});var o=t("./src/env.js"),n=t("?2ce3"),i=t("onnxruntime-web"),a=t("onnxruntime-common");const l=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}}),u=[];let p,d;const c=Symbol.for("onnxruntime");if(c in globalThis)d=globalThis[c];else if(o.apis.IS_NODE_ENV){switch(d=n??(s||(s=t.t(n,2))),process.platform){case"win32":u.push("dml");break;case"linux":process.arch==="x64"&&u.push("cuda");break}u.push("cpu"),p=["cpu"]}else d=i,o.apis.IS_WEBNN_AVAILABLE&&u.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),o.apis.IS_WEBGPU_AVAILABLE&&u.push("webgpu"),u.push("wasm"),p=["wasm"];const _=d.InferenceSession;function f(E=null){if(!E)return p;switch(E){case"auto":return u;case"gpu":return u.filter(y=>["webgpu","cuda","dml","webnn-gpu"].includes(y))}if(u.includes(E))return[l[E]??E];throw new Error(`Unsupported device: "${E}". Should be one of: ${u.join(", ")}.`)}let v=null;async function $(E,y,b){v&&await v;const x=_.create(E,y);v??(v=x);const S=await x;return S.config=b,S}function w(E){return E instanceof d.Tensor}const g=d==null?void 0:d.env;g!=null&&g.wasm&&(!(typeof ServiceWorkerGlobalScope<"u"&&self instanceof ServiceWorkerGlobalScope)&&!g.wasm.wasmPaths&&(g.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${o.env.version}/dist/`),g.wasm.proxy=!1),g!=null&&g.webgpu&&(g.webgpu.powerPreference="high-performance");function C(){var E;return(E=g==null?void 0:g.wasm)==null?void 0:E.proxy}o.env.backends.onnx=g},"./src/base/feature_extraction_utils.js":(e,r,t)=>{t.r(r),t.d(r,{FeatureExtractor:()=>i,validate_audio_inputs:()=>a});var s=t("./src/utils/constants.js"),o=t("./src/utils/generic.js"),n=t("./src/utils/hub.js");class i extends o.Callable{constructor(u){super(),this.config=u}static async from_pretrained(u,p){const d=await(0,n.getModelJSON)(u,s.FEATURE_EXTRACTOR_NAME,!0,p);return new this(d)}}function a(l,u){var p;if(!(l instanceof Float32Array||l instanceof Float64Array))throw new Error(`${u} expects input to be a Float32Array or a Float64Array, but got ${((p=l==null?void 0:l.constructor)==null?void 0:p.name)??typeof l} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}},"./src/base/image_processors_utils.js":(e,r,t)=>{t.r(r),t.d(r,{ImageProcessor:()=>E,center_to_corners_format:()=>d,post_process_instance_segmentation:()=>C,post_process_object_detection:()=>c,post_process_panoptic_segmentation:()=>g,post_process_semantic_segmentation:()=>_});var s=t("./src/utils/generic.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");t("./src/utils/image.js");var i=t("./src/utils/core.js"),a=t("./src/utils/hub.js"),l=t("./src/utils/constants.js");function u(y,b,x=0,S=null){const A=y/b;let B=(0,n.bankers_round)(A)*b;return S!==null&&B>S&&(B=Math.floor(A)*b),Bb&&F.push(re)}else{let re=(0,n.max)(V.data)[1];if(re===j-1||(W=(0,n.softmax)(V.data),W[re]se*Z[(ce+1)%2])),X.boxes.push(fe),X.classes.push(re),X.scores.push(W[re])}}ee.push(X)}return ee}function _(y,b=null){const x=y.logits,S=x.dims[0];if(b!==null&&b.length!==S)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const A=[];for(let B=0;BZ[F]&&(Z[F]=V[F],X[F]=ae)}const oe=new Array(G.dims[0]);for(let ae=0;aeae!==void 0);A.push({segmentation:H,labels:me})}return A}function f(y,b,x,S){const A=[],B=[],K=[];for(let G=0;Gx&&(A.push(ee),B.push(X),K.push(H))}return[A,B,K]}function v(y,b,x,S=.5,A=.8){const B=[];let K=0,G=0;const j=b[x].data;for(let H=0;H=S&&++G;let ee=K>0&&G>0;return ee&&(ee=K/G>A),[ee,B]}function $(y,b,x,S,A,B=null,K=null){const[G,j]=K??y[0].dims,ee=new o.Tensor("int32",new Int32Array(G*j),[G,j]),H=[];if(K!==null)for(let ae=0;aeX[W]&&(Z[W]=ae,X[W]=F[W])}let oe=0;const me=ee.data;for(let ae=0;ae200)throw new Error(`absolute aspect ratio must be smaller than 200, got ${Math.max(y,b)/Math.min(y,b)}`);let B=Math.round(y/x)*x,K=Math.round(b/x)*x;if(B*K>A){const G=Math.sqrt(y*b/A);B=Math.floor(y/G/x)*x,K=Math.floor(b/G/x)*x}else if(B*KB?ee=Math.floor(B*j/A):B>A&&(j=Math.floor(A*ee/B)),await b.resize(ee,j,{resample:S}))}async crop_margin(b,x=200){const S=b.clone().grayscale(),A=(0,n.min)(S.data)[0],K=(0,n.max)(S.data)[0]-A;if(K===0)return b;const G=x/255;let j=S.width,ee=S.height,H=0,Z=0;const X=S.data;for(let oe=0;oethis.preprocess(B)));return{pixel_values:(0,o.stack)(S.map(B=>B.pixel_values),0),original_sizes:S.map(B=>B.original_size),reshaped_input_sizes:S.map(B=>B.reshaped_input_size)}}static async from_pretrained(b,x){const S=await(0,a.getModelJSON)(b,l.IMAGE_PROCESSOR_NAME,!0,x);return new this(S)}}},"./src/base/processing_utils.js":(e,r,t)=>{t.r(r),t.d(r,{Processor:()=>i});var s=t("./src/utils/constants.js"),o=t("./src/utils/generic.js"),n=t("./src/utils/hub.js");class i extends o.Callable{constructor(l,u){super(),this.config=l,this.components=u}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(l,u={}){if(!this.tokenizer)throw new Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(l,{tokenize:!1,...u})}batch_decode(...l){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...l)}decode(...l){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...l)}async _call(l,...u){for(const p of[this.image_processor,this.feature_extractor,this.tokenizer])if(p)return p(l,...u);throw new Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(l,u){const[p,d]=await Promise.all([this.uses_processor_config?(0,n.getModelJSON)(l,s.PROCESSOR_NAME,!0,u):{},Promise.all(this.classes.filter(c=>c in this).map(async c=>{const _=await this[c].from_pretrained(l,u);return[c.replace(/_class$/,""),_]})).then(Object.fromEntries)]);return new this(p,d)}}te(i,"classes",["image_processor_class","tokenizer_class","feature_extractor_class"]),te(i,"uses_processor_config",!1)},"./src/configs.js":(e,r,t)=>{t.r(r),t.d(r,{AutoConfig:()=>u,PretrainedConfig:()=>l,getKeyValueShapes:()=>a});var s=t("./src/utils/core.js"),o=t("./src/utils/hub.js");async function n(p,d){return await(0,o.getModelJSON)(p,"config.json",!0,d)}function i(p){const d={};let c={};switch(p.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"smolvlm":c=i(p.text_config);break;case"moondream1":c=i(p.phi_config);break;case"musicgen":c=i(p.decoder);break;case"multi_modality":c=i(p.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":d.num_heads="n_head",d.num_layers="n_layer",d.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":d.num_heads="num_attention_heads",d.num_layers="num_hidden_layers",d.hidden_size="hidden_size";break;case"llama":case"olmo":case"olmo2":case"mobilellm":case"granite":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":d.num_heads="num_key_value_heads",d.num_layers="num_hidden_layers",d.hidden_size="hidden_size",d.num_attention_heads="num_attention_heads";break;case"gemma":case"gemma2":case"gemma3_text":case"glm":case"helium":d.num_heads="num_key_value_heads",d.num_layers="num_hidden_layers",d.dim_kv="head_dim";break;case"openelm":d.num_heads="num_kv_heads",d.num_layers="num_transformer_layers",d.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":d.num_heads="num_heads",d.num_layers="num_layers",d.hidden_size="hidden_size";break;case"bloom":d.num_heads="n_head",d.num_layers="n_layer",d.hidden_size="hidden_size";break;case"mpt":d.num_heads="n_heads",d.num_layers="n_layers",d.hidden_size="d_model";break;case"exaone":d.num_heads="num_key_value_heads",d.num_layers="num_layers",d.dim_kv="head_dim",d.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":d.num_decoder_layers="num_decoder_layers",d.num_decoder_heads="num_heads",d.decoder_dim_kv="d_kv",d.num_encoder_layers="num_layers",d.num_encoder_heads="num_heads",d.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":d.num_decoder_layers="decoder_layers",d.num_decoder_heads="decoder_attention_heads",d.decoder_hidden_size="d_model",d.num_encoder_layers="encoder_layers",d.num_encoder_heads="encoder_attention_heads",d.encoder_hidden_size="d_model";break;case"speecht5":d.num_decoder_layers="decoder_layers",d.num_decoder_heads="decoder_attention_heads",d.decoder_hidden_size="hidden_size",d.num_encoder_layers="encoder_layers",d.num_encoder_heads="encoder_attention_heads",d.encoder_hidden_size="hidden_size";break;case"trocr":d.num_encoder_layers=d.num_decoder_layers="decoder_layers",d.num_encoder_heads=d.num_decoder_heads="decoder_attention_heads",d.encoder_hidden_size=d.decoder_hidden_size="d_model";break;case"musicgen_decoder":d.num_encoder_layers=d.num_decoder_layers="num_hidden_layers",d.num_encoder_heads=d.num_decoder_heads="num_attention_heads",d.encoder_hidden_size=d.decoder_hidden_size="hidden_size";break;case"moonshine":d.num_decoder_layers="decoder_num_hidden_layers",d.num_decoder_heads="decoder_num_key_value_heads",d.num_encoder_layers="encoder_num_hidden_layers",d.num_encoder_heads="encoder_num_key_value_heads",d.encoder_hidden_size=d.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":const f=i(p.decoder),v="num_decoder_layers"in f,$=(0,s.pick)(p,["model_type","is_encoder_decoder"]);return v?($.num_decoder_layers=f.num_decoder_layers,$.num_decoder_heads=f.num_decoder_heads,$.decoder_hidden_size=f.decoder_hidden_size,$.num_encoder_layers=f.num_encoder_layers,$.num_encoder_heads=f.num_encoder_heads,$.encoder_hidden_size=f.encoder_hidden_size):($.num_layers=f.num_layers,$.num_heads=f.num_heads,$.hidden_size=f.hidden_size),$}const _={...c,...(0,s.pick)(p,["model_type","multi_query","is_encoder_decoder"])};for(const f in d)_[f]=p[d[f]];return _}function a(p,{prefix:d="past_key_values",batch_size:c=1}={}){const _={},f=p.normalized_config;if(f.is_encoder_decoder&&"num_encoder_heads"in f&&"num_decoder_heads"in f){const v=f.encoder_dim_kv??f.encoder_hidden_size/f.num_encoder_heads,$=f.decoder_dim_kv??f.decoder_hidden_size/f.num_decoder_heads,w=[c,f.num_encoder_heads,0,v],g=[c,f.num_decoder_heads,0,$];for(let C=0;C{var S,A;t.r(r),t.d(r,{apis:()=>$,env:()=>b});var s=t("?569f"),o=t("?3f59"),n=t("?154a");const i="3.5.0",a=typeof window<"u"&&typeof window.document<"u",l=typeof self<"u"&&((S=self.constructor)==null?void 0:S.name)==="DedicatedWorkerGlobalScope",u=typeof self<"u"&&"caches"in self,p=typeof navigator<"u"&&"gpu"in navigator,d=typeof navigator<"u"&&"ml"in navigator,c=typeof process<"u",_=c&&((A=process==null?void 0:process.release)==null?void 0:A.name)==="node",f=!x(s),v=!x(o),$=Object.freeze({IS_BROWSER_ENV:a,IS_WEBWORKER_ENV:l,IS_WEB_CACHE_AVAILABLE:u,IS_WEBGPU_AVAILABLE:p,IS_WEBNN_AVAILABLE:d,IS_PROCESS_AVAILABLE:c,IS_NODE_ENV:_,IS_FS_AVAILABLE:f,IS_PATH_AVAILABLE:v}),w=f&&v;let g="./";if(w){const B=Object(import.meta).url;B?g=o.dirname(o.dirname(n.fileURLToPath(B))):typeof __dirname<"u"&&(g=o.dirname(__dirname))}const C=w?o.join(g,"/.cache/"):null,E="/models/",y=w?o.join(g,E):E,b={version:i,backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(a||l),localModelPath:y,useFS:f,useBrowserCache:u,useFSCache:f,cacheDir:C,useCustomCache:!1,customCache:null};function x(B){return Object.keys(B).length===0}},"./src/generation/configuration_utils.js":(e,r,t)=>{t.r(r),t.d(r,{GenerationConfig:()=>o});var s=t("./src/utils/core.js");class o{constructor(i){te(this,"max_length",20);te(this,"max_new_tokens",null);te(this,"min_length",0);te(this,"min_new_tokens",null);te(this,"early_stopping",!1);te(this,"max_time",null);te(this,"do_sample",!1);te(this,"num_beams",1);te(this,"num_beam_groups",1);te(this,"penalty_alpha",null);te(this,"use_cache",!0);te(this,"temperature",1);te(this,"top_k",50);te(this,"top_p",1);te(this,"typical_p",1);te(this,"epsilon_cutoff",0);te(this,"eta_cutoff",0);te(this,"diversity_penalty",0);te(this,"repetition_penalty",1);te(this,"encoder_repetition_penalty",1);te(this,"length_penalty",1);te(this,"no_repeat_ngram_size",0);te(this,"bad_words_ids",null);te(this,"force_words_ids",null);te(this,"renormalize_logits",!1);te(this,"constraints",null);te(this,"forced_bos_token_id",null);te(this,"forced_eos_token_id",null);te(this,"remove_invalid_values",!1);te(this,"exponential_decay_length_penalty",null);te(this,"suppress_tokens",null);te(this,"streamer",null);te(this,"begin_suppress_tokens",null);te(this,"forced_decoder_ids",null);te(this,"guidance_scale",null);te(this,"num_return_sequences",1);te(this,"output_attentions",!1);te(this,"output_hidden_states",!1);te(this,"output_scores",!1);te(this,"return_dict_in_generate",!1);te(this,"pad_token_id",null);te(this,"bos_token_id",null);te(this,"eos_token_id",null);te(this,"encoder_no_repeat_ngram_size",0);te(this,"decoder_start_token_id",null);te(this,"generation_kwargs",{});Object.assign(this,(0,s.pick)(i,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":(e,r,t)=>{t.r(r),t.d(r,{ClassifierFreeGuidanceLogitsProcessor:()=>w,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>u,LogitsProcessor:()=>n,LogitsProcessorList:()=>a,LogitsWarper:()=>i,MinLengthLogitsProcessor:()=>f,MinNewTokensLengthLogitsProcessor:()=>v,NoBadWordsLogitsProcessor:()=>$,NoRepeatNGramLogitsProcessor:()=>c,RepetitionPenaltyLogitsProcessor:()=>_,SuppressTokensAtBeginLogitsProcessor:()=>p,TemperatureLogitsWarper:()=>g,TopKLogitsWarper:()=>E,TopPLogitsWarper:()=>C,WhisperTimeStampLogitsProcessor:()=>d});var s=t("./src/utils/generic.js");t("./src/utils/tensor.js");var o=t("./src/utils/maths.js");class n extends s.Callable{_call(b,x){throw Error("`_call` should be implemented in a subclass")}}class i extends s.Callable{_call(b,x){throw Error("`_call` should be implemented in a subclass")}}class a extends s.Callable{constructor(){super(),this.processors=[]}push(b){this.processors.push(b)}extend(b){this.processors.push(...b)}_call(b,x){let S=x;for(const A of this.processors)S=A(b,S);return S}[Symbol.iterator](){return this.processors.values()}}class l extends n{constructor(b){super(),this.bos_token_id=b}_call(b,x){for(let S=0;S=1&&B[B.length-1]>=this.timestamp_begin,G=B.length<2||B[B.length-2]>=this.timestamp_begin;if(K&&(G?A.subarray(this.timestamp_begin).fill(-1/0):A.subarray(0,this.eos_token_id).fill(-1/0)),b[S].length===this.begin_index&&this.max_initial_timestamp_index!==null){const Z=this.timestamp_begin+this.max_initial_timestamp_index;A.subarray(Z+1).fill(-1/0)}const j=(0,o.log_softmax)(A),ee=Math.log(j.subarray(this.timestamp_begin).map(Math.exp).reduce((Z,X)=>Z+X)),H=(0,o.max)(j.subarray(0,this.timestamp_begin))[0];ee>H&&A.subarray(0,this.timestamp_begin).fill(-1/0)}return x}}class c extends n{constructor(b){super(),this.no_repeat_ngram_size=b}getNgrams(b){const x=b.length,S=[];for(let B=0;B1 to use the classifier free guidance processor, got guidance scale ${b}.`);this.guidance_scale=b}_call(b,x){if(x.dims[0]!==2*b.length)throw new Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${x.dims[0]} for the logits and ${b.length} for the input ids.`);const S=b.length,A=x.slice([0,S],null),B=x.slice([S,x.dims[0]],null);for(let K=0;K1)throw new Error(`\`top_p\` must be a float > 0 and < 1, but is ${b}`);if(!Number.isInteger(S)||S<1)throw new Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${S}`);this.top_p=b,this.filter_value=x,this.min_tokens_to_keep=S}}class E extends i{constructor(b,{filter_value:x=-1/0,min_tokens_to_keep:S=1}={}){if(super(),!Number.isInteger(b)||b<0)throw new Error(`\`top_k\` must be a positive integer, but is ${b}`);this.top_k=Math.max(b,S),this.filter_value=x}}},"./src/generation/logits_sampler.js":(e,r,t)=>{t.r(r),t.d(r,{LogitsSampler:()=>i});var s=t("./src/utils/generic.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");t("./src/generation/configuration_utils.js");class i extends s.Callable{constructor(d){super(),this.generation_config=d}async _call(d){return this.sample(d)}async sample(d){throw Error("sample should be implemented in subclasses.")}getLogits(d,c){let _=d.dims.at(-1),f=d.data;if(c===-1)f=f.slice(-_);else{let v=c*_;f=f.slice(v,v+_)}return f}randomSelect(d){let c=0;for(let f=0;f1)return new u(d);if(d.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${d.num_return_sequences}.`);return new a(d)}}class a extends i{async sample(d){const c=(0,n.max)(d.data)[1];return[[BigInt(c),0]]}}class l extends i{async sample(d){let c=d.dims.at(-1);this.generation_config.top_k>0&&(c=Math.min(this.generation_config.top_k,c));const[_,f]=await(0,o.topk)(d,c),v=(0,n.softmax)(_.data);return Array.from({length:this.generation_config.num_beams},()=>{const $=this.randomSelect(v);return[f.data[$],Math.log(v[$])]})}}class u extends i{async sample(d){let c=d.dims.at(-1);this.generation_config.top_k>0&&(c=Math.min(this.generation_config.top_k,c));const[_,f]=await(0,o.topk)(d,c),v=(0,n.softmax)(_.data);return Array.from({length:this.generation_config.num_beams},($,w)=>[f.data[w],Math.log(v[w])])}}},"./src/generation/stopping_criteria.js":(e,r,t)=>{t.r(r),t.d(r,{EosTokenCriteria:()=>a,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>i,StoppingCriteria:()=>o,StoppingCriteriaList:()=>n});var s=t("./src/utils/generic.js");class o extends s.Callable{_call(p,d){throw Error("StoppingCriteria needs to be subclassed")}}class n extends s.Callable{constructor(){super(),this.criteria=[]}push(p){this.criteria.push(p)}extend(p){p instanceof n?p=p.criteria:p instanceof o&&(p=[p]),this.criteria.push(...p)}_call(p,d){const c=new Array(p.length).fill(!1);for(const _ of this.criteria){const f=_(p,d);for(let v=0;vd.length>=this.max_length)}}class a extends o{constructor(p){super(),Array.isArray(p)||(p=[p]),this.eos_token_id=p}_call(p,d){return p.map(c=>{const _=c.at(-1);return this.eos_token_id.some(f=>_==f)})}}class l extends o{constructor(){super(),this.interrupted=!1}interrupt(){this.interrupted=!0}reset(){this.interrupted=!1}_call(p,d){return new Array(p.length).fill(this.interrupted)}}},"./src/generation/streamers.js":(e,r,t)=>{t.r(r),t.d(r,{BaseStreamer:()=>i,TextStreamer:()=>l,WhisperTextStreamer:()=>u});var s=t("./src/utils/core.js"),o=t("./src/tokenizers.js"),n=t("./src/env.js");class i{put(d){throw Error("Not implemented")}end(){throw Error("Not implemented")}}const a=n.apis.IS_PROCESS_AVAILABLE?p=>process.stdout.write(p):p=>console.log(p);class l extends i{constructor(d,{skip_prompt:c=!1,callback_function:_=null,token_callback_function:f=null,skip_special_tokens:v=!0,decode_kwargs:$={},...w}={}){super(),this.tokenizer=d,this.skip_prompt=c,this.callback_function=_??a,this.token_callback_function=f,this.decode_kwargs={skip_special_tokens:v,...$,...w},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(d){var $;if(d.length>1)throw Error("TextStreamer only supports batch size of 1");const c=this.next_tokens_are_prompt;if(c&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;const _=d[0];($=this.token_callback_function)==null||$.call(this,_),this.token_cache=(0,s.mergeArrays)(this.token_cache,_);const f=this.tokenizer.decode(this.token_cache,this.decode_kwargs);let v;c||f.endsWith(` +`)?(v=f.slice(this.print_len),this.token_cache=[],this.print_len=0):f.length>0&&(0,o.is_chinese_char)(f.charCodeAt(f.length-1))?(v=f.slice(this.print_len),this.print_len+=v.length):(v=f.slice(this.print_len,f.lastIndexOf(" ")+1),this.print_len+=v.length),this.on_finalized_text(v,!1)}end(){let d;this.token_cache.length>0?(d=this.tokenizer.decode(this.token_cache,this.decode_kwargs).slice(this.print_len),this.token_cache=[],this.print_len=0):d="",this.next_tokens_are_prompt=!0,this.on_finalized_text(d,!0)}on_finalized_text(d,c){var _,f;d.length>0&&((_=this.callback_function)==null||_.call(this,d)),c&&this.callback_function===a&&n.apis.IS_PROCESS_AVAILABLE&&((f=this.callback_function)==null||f.call(this,` +`))}}class u extends l{constructor(d,{skip_prompt:c=!1,callback_function:_=null,token_callback_function:f=null,on_chunk_start:v=null,on_chunk_end:$=null,on_finalize:w=null,time_precision:g=.02,skip_special_tokens:C=!0,decode_kwargs:E={}}={}){super(d,{skip_prompt:c,skip_special_tokens:C,callback_function:_,token_callback_function:f,decode_kwargs:E}),this.timestamp_begin=d.timestamp_begin,this.on_chunk_start=v,this.on_chunk_end=$,this.on_finalize=w,this.time_precision=g,this.waiting_for_timestamp=!1}put(d){var _,f;if(d.length>1)throw Error("WhisperTextStreamer only supports batch size of 1");const c=d[0];if(c.length===1){const v=Number(c[0])-this.timestamp_begin;if(v>=0){const $=v*this.time_precision;this.waiting_for_timestamp?(_=this.on_chunk_end)==null||_.call(this,$):(f=this.on_chunk_start)==null||f.call(this,$),this.waiting_for_timestamp=!this.waiting_for_timestamp,d=[[]]}}return super.put(d)}end(){var d;super.end(),(d=this.on_finalize)==null||d.call(this)}}},"./src/models.js":(e,r,t)=>{t.r(r),t.d(r,{ASTForAudioClassification:()=>ui,ASTModel:()=>li,ASTPreTrainedModel:()=>lo,AlbertForMaskedLM:()=>N,AlbertForQuestionAnswering:()=>k,AlbertForSequenceClassification:()=>he,AlbertModel:()=>dn,AlbertPreTrainedModel:()=>ys,AutoModel:()=>xl,AutoModelForAudioClassification:()=>tf,AutoModelForAudioFrameClassification:()=>sf,AutoModelForAudioTextToText:()=>hf,AutoModelForCTC:()=>ef,AutoModelForCausalLM:()=>Um,AutoModelForDepthEstimation:()=>lf,AutoModelForDocumentQuestionAnswering:()=>nf,AutoModelForImageClassification:()=>Hm,AutoModelForImageFeatureExtraction:()=>cf,AutoModelForImageMatting:()=>of,AutoModelForImageSegmentation:()=>qm,AutoModelForImageTextToText:()=>pf,AutoModelForImageToImage:()=>af,AutoModelForMaskGeneration:()=>Zm,AutoModelForMaskedLM:()=>Wm,AutoModelForNormalEstimation:()=>uf,AutoModelForObjectDetection:()=>Jm,AutoModelForPoseEstimation:()=>df,AutoModelForQuestionAnswering:()=>Gm,AutoModelForSemanticSegmentation:()=>Xm,AutoModelForSeq2SeqLM:()=>Rm,AutoModelForSequenceClassification:()=>zm,AutoModelForSpeechSeq2Seq:()=>jm,AutoModelForTextToSpectrogram:()=>Nm,AutoModelForTextToWaveform:()=>Vm,AutoModelForTokenClassification:()=>Bm,AutoModelForUniversalSegmentation:()=>Qm,AutoModelForVision2Seq:()=>Km,AutoModelForXVector:()=>rf,AutoModelForZeroShotObjectDetection:()=>Ym,BartForConditionalGeneration:()=>Rt,BartForSequenceClassification:()=>kt,BartModel:()=>Et,BartPretrainedModel:()=>vt,BaseModelOutput:()=>xe,BeitForImageClassification:()=>yc,BeitModel:()=>Mc,BeitPreTrainedModel:()=>Na,BertForMaskedLM:()=>Ae,BertForQuestionAnswering:()=>Ve,BertForSequenceClassification:()=>Fe,BertForTokenClassification:()=>ze,BertModel:()=>Se,BertPreTrainedModel:()=>Me,BlenderbotForConditionalGeneration:()=>rr,BlenderbotModel:()=>Dt,BlenderbotPreTrainedModel:()=>Kr,BlenderbotSmallForConditionalGeneration:()=>Lr,BlenderbotSmallModel:()=>Hr,BlenderbotSmallPreTrainedModel:()=>gr,BloomForCausalLM:()=>Ud,BloomModel:()=>Vd,BloomPreTrainedModel:()=>$a,CLIPModel:()=>bi,CLIPPreTrainedModel:()=>Ss,CLIPSegForImageSegmentation:()=>vo,CLIPSegModel:()=>yo,CLIPSegPreTrainedModel:()=>Vn,CLIPTextModel:()=>ba,CLIPTextModelWithProjection:()=>Mi,CLIPVisionModel:()=>Ma,CLIPVisionModelWithProjection:()=>yi,CamembertForMaskedLM:()=>Ft,CamembertForQuestionAnswering:()=>bs,CamembertForSequenceClassification:()=>es,CamembertForTokenClassification:()=>ts,CamembertModel:()=>ws,CamembertPreTrainedModel:()=>Ir,CausalLMOutput:()=>bn,CausalLMOutputWithPast:()=>nv,ChineseCLIPModel:()=>xi,ChineseCLIPPreTrainedModel:()=>vi,ClapAudioModelWithProjection:()=>bh,ClapModel:()=>gh,ClapPreTrainedModel:()=>Fi,ClapTextModelWithProjection:()=>wh,CodeGenForCausalLM:()=>gn,CodeGenModel:()=>ko,CodeGenPreTrainedModel:()=>Hn,CohereForCausalLM:()=>Ed,CohereModel:()=>Td,CoherePreTrainedModel:()=>ya,ConvBertForMaskedLM:()=>Ot,ConvBertForQuestionAnswering:()=>gs,ConvBertForSequenceClassification:()=>lr,ConvBertForTokenClassification:()=>Yr,ConvBertModel:()=>Gt,ConvBertPreTrainedModel:()=>wt,ConvNextForImageClassification:()=>hp,ConvNextModel:()=>pp,ConvNextPreTrainedModel:()=>tl,ConvNextV2ForImageClassification:()=>fp,ConvNextV2Model:()=>mp,ConvNextV2PreTrainedModel:()=>rl,DPTForDepthEstimation:()=>qc,DPTModel:()=>Hc,DPTPreTrainedModel:()=>Ya,DacDecoderModel:()=>am,DacDecoderOutput:()=>nm,DacEncoderModel:()=>im,DacEncoderOutput:()=>sm,DacModel:()=>om,DacPreTrainedModel:()=>ji,DebertaForMaskedLM:()=>Qe,DebertaForQuestionAnswering:()=>Or,DebertaForSequenceClassification:()=>et,DebertaForTokenClassification:()=>Bt,DebertaModel:()=>De,DebertaPreTrainedModel:()=>Xt,DebertaV2ForMaskedLM:()=>ss,DebertaV2ForQuestionAnswering:()=>os,DebertaV2ForSequenceClassification:()=>Ur,DebertaV2ForTokenClassification:()=>ns,DebertaV2Model:()=>rs,DebertaV2PreTrainedModel:()=>Pr,DecisionTransformerModel:()=>jh,DecisionTransformerPreTrainedModel:()=>Rh,DeiTForImageClassification:()=>zc,DeiTModel:()=>Lc,DeiTPreTrainedModel:()=>qa,DepthAnythingForDepthEstimation:()=>Qc,DepthAnythingPreTrainedModel:()=>Xc,DepthProForDepthEstimation:()=>tp,DepthProPreTrainedModel:()=>ep,DetrForObjectDetection:()=>xc,DetrForSegmentation:()=>Va,DetrModel:()=>vc,DetrObjectDetectionOutput:()=>Ua,DetrPreTrainedModel:()=>Pi,DetrSegmentationOutput:()=>Tc,Dinov2ForImageClassification:()=>gp,Dinov2Model:()=>_p,Dinov2PreTrainedModel:()=>sl,Dinov2WithRegistersForImageClassification:()=>bp,Dinov2WithRegistersModel:()=>wp,Dinov2WithRegistersPreTrainedModel:()=>nl,DistilBertForMaskedLM:()=>Es,DistilBertForQuestionAnswering:()=>Ts,DistilBertForSequenceClassification:()=>Ys,DistilBertForTokenClassification:()=>vr,DistilBertModel:()=>yr,DistilBertPreTrainedModel:()=>Wr,DonutSwinModel:()=>cp,DonutSwinPreTrainedModel:()=>dp,EfficientNetForImageClassification:()=>Ph,EfficientNetModel:()=>Eh,EfficientNetPreTrainedModel:()=>ml,ElectraForMaskedLM:()=>xs,ElectraForQuestionAnswering:()=>Zr,ElectraForSequenceClassification:()=>Ls,ElectraForTokenClassification:()=>at,ElectraModel:()=>Ds,ElectraPreTrainedModel:()=>kr,EsmForMaskedLM:()=>Zs,EsmForSequenceClassification:()=>Ar,EsmForTokenClassification:()=>en,EsmModel:()=>zs,EsmPreTrainedModel:()=>fr,ExaoneForCausalLM:()=>L,ExaoneModel:()=>I,ExaonePreTrainedModel:()=>T,FalconForCausalLM:()=>_h,FalconModel:()=>fh,FalconPreTrainedModel:()=>cl,FastViTForImageClassification:()=>uc,FastViTModel:()=>lc,FastViTPreTrainedModel:()=>La,Florence2ForConditionalGeneration:()=>fo,Florence2PreTrainedModel:()=>mi,GLPNForDepthEstimation:()=>up,GLPNModel:()=>lp,GLPNPreTrainedModel:()=>el,GPT2LMHeadModel:()=>xo,GPT2Model:()=>Ti,GPT2PreTrainedModel:()=>Un,GPTBigCodeForCausalLM:()=>$o,GPTBigCodeModel:()=>Kn,GPTBigCodePreTrainedModel:()=>Gn,GPTJForCausalLM:()=>So,GPTJModel:()=>Co,GPTJPreTrainedModel:()=>_n,GPTNeoForCausalLM:()=>Po,GPTNeoModel:()=>Eo,GPTNeoPreTrainedModel:()=>To,GPTNeoXForCausalLM:()=>fn,GPTNeoXModel:()=>Br,GPTNeoXPreTrainedModel:()=>Ws,Gemma2ForCausalLM:()=>$d,Gemma2Model:()=>Sd,Gemma2PreTrainedModel:()=>xa,Gemma3ForCausalLM:()=>Id,Gemma3Model:()=>kd,Gemma3PreTrainedModel:()=>Ta,GemmaForCausalLM:()=>Cd,GemmaModel:()=>Pd,GemmaPreTrainedModel:()=>va,GlmForCausalLM:()=>h,GlmModel:()=>Oo,GlmPreTrainedModel:()=>Qn,GraniteForCausalLM:()=>Ei,GraniteModel:()=>$s,GranitePreTrainedModel:()=>sr,GroundingDinoForObjectDetection:()=>yp,GroundingDinoPreTrainedModel:()=>Mp,GroupViTModel:()=>ac,GroupViTPreTrainedModel:()=>ic,HeliumForCausalLM:()=>Fo,HeliumModel:()=>Ao,HeliumPreTrainedModel:()=>Xn,HieraForImageClassification:()=>Rc,HieraModel:()=>Bc,HieraPreTrainedModel:()=>Xa,HubertForCTC:()=>Jp,HubertForSequenceClassification:()=>Yp,HubertModel:()=>Qp,HubertPreTrainedModel:()=>W0,IJepaForImageClassification:()=>Jd,IJepaModel:()=>Qd,IJepaPreTrainedModel:()=>Fa,Idefics3ForConditionalGeneration:()=>Ns,Idefics3PreTrainedModel:()=>gi,ImageMattingOutput:()=>ff,JAISLMHeadModel:()=>nt,JAISModel:()=>mn,JAISPreTrainedModel:()=>Wn,JinaCLIPModel:()=>Nn,JinaCLIPPreTrainedModel:()=>Us,JinaCLIPTextModel:()=>bo,JinaCLIPVisionModel:()=>Mo,LiteWhisperForConditionalGeneration:()=>ci,LlamaForCausalLM:()=>Io,LlamaModel:()=>qn,LlamaPreTrainedModel:()=>wn,LlavaForConditionalGeneration:()=>pn,LlavaOnevisionForConditionalGeneration:()=>mo,LlavaPreTrainedModel:()=>hi,LongT5ForConditionalGeneration:()=>He,LongT5Model:()=>je,LongT5PreTrainedModel:()=>ve,M2M100ForConditionalGeneration:()=>Ip,M2M100Model:()=>kp,M2M100PreTrainedModel:()=>al,MBartForCausalLM:()=>Nt,MBartForConditionalGeneration:()=>dr,MBartForSequenceClassification:()=>cr,MBartModel:()=>Mr,MBartPreTrainedModel:()=>Kt,MPNetForMaskedLM:()=>rn,MPNetForQuestionAnswering:()=>on,MPNetForSequenceClassification:()=>sn,MPNetForTokenClassification:()=>nn,MPNetModel:()=>tn,MPNetPreTrainedModel:()=>Dr,MT5ForConditionalGeneration:()=>dt,MT5Model:()=>Je,MT5PreTrainedModel:()=>We,MarianMTModel:()=>$p,MarianModel:()=>Sp,MarianPreTrainedModel:()=>il,MaskFormerForInstanceSegmentation:()=>ap,MaskFormerModel:()=>ip,MaskFormerPreTrainedModel:()=>Za,MaskedLMOutput:()=>wr,Metric3DForDepthEstimation:()=>sp,Metric3DPreTrainedModel:()=>rp,Metric3Dv2ForDepthEstimation:()=>op,Metric3Dv2PreTrainedModel:()=>np,MgpstrForSceneTextRecognition:()=>Gh,MgpstrModelOutput:()=>Uh,MgpstrPreTrainedModel:()=>Wh,MimiDecoderModel:()=>rm,MimiDecoderOutput:()=>Zh,MimiEncoderModel:()=>tm,MimiEncoderOutput:()=>Yh,MimiModel:()=>em,MimiPreTrainedModel:()=>Ri,MistralForCausalLM:()=>ph,MistralModel:()=>ch,MistralPreTrainedModel:()=>ul,MobileBertForMaskedLM:()=>Ps,MobileBertForQuestionAnswering:()=>_r,MobileBertForSequenceClassification:()=>ur,MobileBertModel:()=>xr,MobileBertPreTrainedModel:()=>Gr,MobileLLMForCausalLM:()=>Te,MobileLLMModel:()=>ue,MobileLLMPreTrainedModel:()=>U,MobileNetV1ForImageClassification:()=>Sh,MobileNetV1ForSemanticSegmentation:()=>$h,MobileNetV1Model:()=>Ch,MobileNetV1PreTrainedModel:()=>Di,MobileNetV2ForImageClassification:()=>Ih,MobileNetV2ForSemanticSegmentation:()=>Ah,MobileNetV2Model:()=>kh,MobileNetV2PreTrainedModel:()=>Li,MobileNetV3ForImageClassification:()=>Oh,MobileNetV3ForSemanticSegmentation:()=>Dh,MobileNetV3Model:()=>Fh,MobileNetV3PreTrainedModel:()=>zi,MobileNetV4ForImageClassification:()=>zh,MobileNetV4ForSemanticSegmentation:()=>Bh,MobileNetV4Model:()=>Lh,MobileNetV4PreTrainedModel:()=>Bi,MobileViTForImageClassification:()=>hc,MobileViTModel:()=>pc,MobileViTPreTrainedModel:()=>za,MobileViTV2ForImageClassification:()=>fc,MobileViTV2Model:()=>mc,MobileViTV2PreTrainedModel:()=>Ba,ModelOutput:()=>pe,ModernBertForMaskedLM:()=>z,ModernBertForSequenceClassification:()=>J,ModernBertForTokenClassification:()=>le,ModernBertModel:()=>Y,ModernBertPreTrainedModel:()=>O,Moondream1ForConditionalGeneration:()=>js,MoonshineForConditionalGeneration:()=>po,MoonshineModel:()=>pi,MoonshinePreTrainedModel:()=>Rn,MptForCausalLM:()=>Gd,MptModel:()=>Wd,MptPreTrainedModel:()=>ka,MultiModalityCausalLM:()=>Vh,MultiModalityPreTrainedModel:()=>Nh,MusicgenForCausalLM:()=>q0,MusicgenForConditionalGeneration:()=>_l,MusicgenModel:()=>H0,MusicgenPreTrainedModel:()=>fl,NomicBertModel:()=>Ee,NomicBertPreTrainedModel:()=>ye,OPTForCausalLM:()=>Hd,OPTModel:()=>Kd,OPTPreTrainedModel:()=>Ia,Olmo2ForCausalLM:()=>It,Olmo2Model:()=>xt,Olmo2PreTrainedModel:()=>ht,OlmoForCausalLM:()=>Ye,OlmoModel:()=>Ke,OlmoPreTrainedModel:()=>Oe,OpenELMForCausalLM:()=>Fd,OpenELMModel:()=>Ad,OpenELMPreTrainedModel:()=>Ea,OwlViTForObjectDetection:()=>gc,OwlViTModel:()=>_c,OwlViTPreTrainedModel:()=>Ra,Owlv2ForObjectDetection:()=>bc,Owlv2Model:()=>wc,Owlv2PreTrainedModel:()=>ja,PaliGemmaForConditionalGeneration:()=>_i,PaliGemmaPreTrainedModel:()=>fi,PatchTSMixerForPrediction:()=>Xh,PatchTSMixerModel:()=>qh,PatchTSMixerPreTrainedModel:()=>wl,PatchTSTForPrediction:()=>Hh,PatchTSTModel:()=>Kh,PatchTSTPreTrainedModel:()=>gl,Phi3ForCausalLM:()=>Nd,Phi3Model:()=>jd,Phi3PreTrainedModel:()=>Sa,Phi3VForCausalLM:()=>_o,Phi3VPreTrainedModel:()=>wi,PhiForCausalLM:()=>Rd,PhiModel:()=>Bd,PhiPreTrainedModel:()=>Ca,PreTrainedModel:()=>R,PretrainedMixin:()=>Pt,PvtForImageClassification:()=>tc,PvtModel:()=>ec,PvtPreTrainedModel:()=>Oa,PyAnnoteForAudioFrameClassification:()=>zp,PyAnnoteModel:()=>Lp,PyAnnotePreTrainedModel:()=>ll,QuestionAnsweringModelOutput:()=>Tr,Qwen2ForCausalLM:()=>Dd,Qwen2Model:()=>Od,Qwen2PreTrainedModel:()=>Pa,Qwen2VLForConditionalGeneration:()=>zd,Qwen2VLPreTrainedModel:()=>Ld,RFDetrForObjectDetection:()=>Ic,RFDetrModel:()=>kc,RFDetrObjectDetectionOutput:()=>Ac,RFDetrPreTrainedModel:()=>Ka,RTDetrForObjectDetection:()=>Pc,RTDetrModel:()=>Ec,RTDetrObjectDetectionOutput:()=>Ci,RTDetrPreTrainedModel:()=>Wa,RTDetrV2ForObjectDetection:()=>Sc,RTDetrV2Model:()=>Cc,RTDetrV2ObjectDetectionOutput:()=>$c,RTDetrV2PreTrainedModel:()=>Ga,ResNetForImageClassification:()=>Nc,ResNetModel:()=>jc,ResNetPreTrainedModel:()=>Qa,RoFormerForMaskedLM:()=>Be,RoFormerForQuestionAnswering:()=>lt,RoFormerForSequenceClassification:()=>Xe,RoFormerForTokenClassification:()=>Ge,RoFormerModel:()=>Ie,RoFormerPreTrainedModel:()=>ke,RobertaForMaskedLM:()=>or,RobertaForQuestionAnswering:()=>er,RobertaForSequenceClassification:()=>Vt,RobertaForTokenClassification:()=>Zt,RobertaModel:()=>zr,RobertaPreTrainedModel:()=>Yt,SamImageSegmentationOutput:()=>Cp,SamModel:()=>Pp,SamPreTrainedModel:()=>Ep,SapiensForDepthEstimation:()=>Yc,SapiensForNormalEstimation:()=>Zc,SapiensForSemanticSegmentation:()=>Jc,SapiensPreTrainedModel:()=>$i,SegformerForImageClassification:()=>yh,SegformerForSemanticSegmentation:()=>vh,SegformerModel:()=>K0,SegformerPreTrainedModel:()=>Oi,Seq2SeqLMOutput:()=>sv,SequenceClassifierOutput:()=>mt,SiglipModel:()=>hn,SiglipPreTrainedModel:()=>go,SiglipTextModel:()=>Vs,SiglipVisionModel:()=>wo,SmolVLMForConditionalGeneration:()=>jn,SnacDecoderModel:()=>dm,SnacEncoderModel:()=>um,SnacModel:()=>lm,SnacPreTrainedModel:()=>Ni,SpeechT5ForSpeechToText:()=>ih,SpeechT5ForTextToSpeech:()=>ah,SpeechT5HifiGan:()=>lh,SpeechT5Model:()=>G0,SpeechT5PreTrainedModel:()=>Ai,SqueezeBertForMaskedLM:()=>Bs,SqueezeBertForQuestionAnswering:()=>un,SqueezeBertForSequenceClassification:()=>ln,SqueezeBertModel:()=>an,SqueezeBertPreTrainedModel:()=>Ms,StableLmForCausalLM:()=>Th,StableLmModel:()=>xh,StableLmPreTrainedModel:()=>hl,Starcoder2ForCausalLM:()=>mh,Starcoder2Model:()=>hh,Starcoder2PreTrainedModel:()=>dl,StyleTextToSpeech2Model:()=>oh,StyleTextToSpeech2PreTrainedModel:()=>nh,Swin2SRForImageSuperResolution:()=>Kc,Swin2SRModel:()=>Gc,Swin2SRPreTrainedModel:()=>Ja,SwinForImageClassification:()=>Uc,SwinForSemanticSegmentation:()=>Wc,SwinModel:()=>Vc,SwinPreTrainedModel:()=>Si,T5ForConditionalGeneration:()=>de,T5Model:()=>ie,T5PreTrainedModel:()=>Q,TableTransformerForObjectDetection:()=>Oc,TableTransformerModel:()=>Fc,TableTransformerObjectDetectionOutput:()=>Dc,TableTransformerPreTrainedModel:()=>Ha,TokenClassifierOutput:()=>pr,TrOCRForCausalLM:()=>dh,TrOCRPreTrainedModel:()=>uh,UltravoxModel:()=>Jh,UltravoxPreTrainedModel:()=>Qh,UniSpeechForCTC:()=>Np,UniSpeechForSequenceClassification:()=>Vp,UniSpeechModel:()=>jp,UniSpeechPreTrainedModel:()=>ki,UniSpeechSatForAudioFrameClassification:()=>Kp,UniSpeechSatForCTC:()=>Wp,UniSpeechSatForSequenceClassification:()=>Gp,UniSpeechSatModel:()=>Up,UniSpeechSatPreTrainedModel:()=>Do,ViTForImageClassification:()=>Xd,ViTMAEModel:()=>sc,ViTMAEPreTrainedModel:()=>rc,ViTMSNForImageClassification:()=>oc,ViTMSNModel:()=>nc,ViTMSNPreTrainedModel:()=>Da,ViTModel:()=>qd,ViTPreTrainedModel:()=>Aa,VisionEncoderDecoderModel:()=>ho,VitMatteForImageMatting:()=>cc,VitMattePreTrainedModel:()=>dc,VitPoseForPoseEstimation:()=>Zd,VitPosePreTrainedModel:()=>Yd,VitsModel:()=>pl,VitsModelOutput:()=>_f,VitsPreTrainedModel:()=>Mh,Wav2Vec2BertForCTC:()=>qp,Wav2Vec2BertForSequenceClassification:()=>Xp,Wav2Vec2BertModel:()=>Hp,Wav2Vec2BertPreTrainedModel:()=>Ii,Wav2Vec2ForAudioFrameClassification:()=>Dp,Wav2Vec2ForCTC:()=>Fp,Wav2Vec2ForSequenceClassification:()=>Op,Wav2Vec2Model:()=>Ap,Wav2Vec2PreTrainedModel:()=>Gs,WavLMForAudioFrameClassification:()=>sh,WavLMForCTC:()=>eh,WavLMForSequenceClassification:()=>th,WavLMForXVector:()=>rh,WavLMModel:()=>Zp,WavLMPreTrainedModel:()=>Jn,WeSpeakerResNetModel:()=>Rp,WeSpeakerResNetPreTrainedModel:()=>Bp,WhisperForConditionalGeneration:()=>co,WhisperModel:()=>di,WhisperPreTrainedModel:()=>uo,XLMForQuestionAnswering:()=>ri,XLMForSequenceClassification:()=>ei,XLMForTokenClassification:()=>ti,XLMModel:()=>Rs,XLMPreTrainedModel:()=>tr,XLMRobertaForMaskedLM:()=>ni,XLMRobertaForQuestionAnswering:()=>ai,XLMRobertaForSequenceClassification:()=>oi,XLMRobertaForTokenClassification:()=>ii,XLMRobertaModel:()=>si,XLMRobertaPreTrainedModel:()=>Cs,XLMWithLMHeadModel:()=>cn,XVectorOutput:()=>mf,YolosForObjectDetection:()=>xp,YolosModel:()=>vp,YolosObjectDetectionOutput:()=>Tp,YolosPreTrainedModel:()=>ol});var s=t("./src/configs.js"),o=t("./src/backends/onnx.js"),n=t("./src/utils/dtypes.js"),i=t("./src/utils/generic.js"),a=t("./src/utils/core.js"),l=t("./src/utils/hub.js"),u=t("./src/utils/constants.js"),p=t("./src/generation/logits_process.js"),d=t("./src/generation/configuration_utils.js"),c=t("./src/utils/tensor.js"),_=t("./src/utils/image.js"),f=t("./src/utils/maths.js"),v=t("./src/generation/stopping_criteria.js"),$=t("./src/generation/logits_sampler.js"),w=t("./src/env.js"),g=t("./src/models/whisper/generation_whisper.js"),C=t("./src/models/whisper/common_whisper.js");const E={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5,ImageTextToText:6,Musicgen:7,MultiModality:8,Phi3V:9,AudioTextToText:10,AutoEncoder:11},y=new Map,b=new Map,x=new Map;async function S(M,P,D){var hr;let ne=((hr=D.config)==null?void 0:hr["transformers.js_config"])??{},ge=D.device??ne.device;ge&&typeof ge!="string"&&(ge.hasOwnProperty(P)?ge=ge[P]:(console.warn(`device not specified for "${P}". Using the default device.`),ge=null));const _e=ge??(w.apis.IS_NODE_ENV?"cpu":"wasm"),Ce=(0,o.deviceToExecutionProviders)(_e),Le=ne.device_config??{};Le.hasOwnProperty(_e)&&(ne={...ne,...Le[_e]});let Ne=D.dtype??ne.dtype;if(typeof Ne!="string"&&(Ne&&Ne.hasOwnProperty(P)?Ne=Ne[P]:(Ne=n.DEFAULT_DEVICE_DTYPE_MAPPING[_e]??n.DATA_TYPES.fp32,console.warn(`dtype not specified for "${P}". Using the default dtype (${Ne}) for this device (${_e}).`))),Ne===n.DATA_TYPES.auto){let Mt=ne.dtype;typeof Mt!="string"&&(Mt=Mt==null?void 0:Mt[P]),Mt&&Mt!==n.DATA_TYPES.auto&&n.DATA_TYPES.hasOwnProperty(Mt)?Ne=Mt:Ne=n.DEFAULT_DEVICE_DTYPE_MAPPING[_e]??n.DATA_TYPES.fp32}const qe=Ne;if(n.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(qe)){if(qe===n.DATA_TYPES.fp16&&_e==="webgpu"&&!await(0,n.isWebGpuFp16Supported)())throw new Error(`The device (${_e}) does not support fp16.`)}else throw new Error(`Invalid dtype: ${qe}. Should be one of: ${Object.keys(n.DATA_TYPES).join(", ")}`);const it=ne.kv_cache_dtype,pt=it?typeof it=="string"?it:it[qe]??"float32":void 0;if(pt&&!["float32","float16"].includes(pt))throw new Error(`Invalid kv_cache_dtype: ${pt}. Should be one of: float32, float16`);const ot={dtype:qe,kv_cache_dtype:pt},bt=n.DEFAULT_DTYPE_SUFFIX_MAPPING[qe],ct=`${P}${bt}.onnx`,gt=`${D.subfolder??""}/${ct}`,tt={...D.session_options};tt.executionProviders??(tt.executionProviders=Ce);const yt=ne.free_dimension_overrides;yt?tt.freeDimensionOverrides??(tt.freeDimensionOverrides=yt):_e.startsWith("webnn")&&!tt.freeDimensionOverrides&&console.warn(`WebNN does not currently support dynamic shapes and requires 'free_dimension_overrides' to be set in config.json, preferably as a field within config["transformers.js_config"]["device_config"]["${_e}"]. When 'free_dimension_overrides' is not set, you may experience significant performance degradation.`);const Lt=w.apis.IS_NODE_ENV&&w.env.useFSCache,Ut=(0,l.getModelFile)(M,gt,!0,D,Lt),Qt=D.use_external_data_format??ne.use_external_data_format;let Ht=[];if(Qt){let Mt;typeof Qt=="object"?Qt.hasOwnProperty(ct)?Mt=Qt[ct]:Qt.hasOwnProperty(P)?Mt=Qt[P]:Mt=!1:Mt=Qt;const ir=+Mt;if(ir>l.MAX_EXTERNAL_DATA_CHUNKS)throw new Error(`The number of external data chunks (${ir}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let Rr=0;Rr{const yn=await(0,l.getModelFile)(M,Cr,!0,D,Lt);qr(yn instanceof Uint8Array?{path:Mn,data:yn}:Mn)}))}}else tt.externalData!==void 0&&(Ht=tt.externalData.map(async Mt=>{if(typeof Mt.data=="string"){const ir=await(0,l.getModelFile)(M,Mt.data,!0,D);return{...Mt,data:ir}}return Mt}));if(Ht.length>0){const Mt=await Promise.all(Ht);w.apis.IS_NODE_ENV||(tt.externalData=Mt)}if(_e==="webgpu"){const Mt=(0,s.getKeyValueShapes)(D.config,{prefix:"present"});if(Object.keys(Mt).length>0&&!(0,o.isONNXProxy)()){const ir={};for(const Rr in Mt)ir[Rr]="gpu-buffer";tt.preferredOutputLocation=ir}}return{buffer_or_path:await Ut,session_options:tt,session_config:ot}}async function A(M,P,D){return Object.fromEntries(await Promise.all(Object.keys(P).map(async ne=>{const{buffer_or_path:ge,session_options:_e,session_config:Ce}=await S(M,P[ne],D),Le=await(0,o.createInferenceSession)(ge,_e,Ce);return[ne,Le]})))}async function B(M,P,D){return Object.fromEntries(await Promise.all(Object.keys(P).map(async ne=>{const ge=await(0,l.getModelJSON)(M,P[ne],!1,D);return[ne,ge]})))}function K(M,P){const D=Object.create(null),ne=[];for(const Ce of M.inputNames){const Le=P[Ce];if(!(Le instanceof c.Tensor)){ne.push(Ce);continue}D[Ce]=(0,o.isONNXProxy)()?Le.clone():Le}if(ne.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${ne.join(", ")}.`);const ge=Object.keys(P).length,_e=M.inputNames.length;if(ge>_e){let Ce=Object.keys(P).filter(Le=>!M.inputNames.includes(Le));console.warn(`WARNING: Too many inputs were provided (${ge} > ${_e}). The following inputs will be ignored: "${Ce.join(", ")}".`)}return D}async function G(M,P){const D=K(M,P);try{const ne=Object.fromEntries(Object.entries(D).map(([_e,Ce])=>[_e,Ce.ort_tensor]));let ge=await M.run(ne);return ge=j(ge),ge}catch(ne){const ge=Object.fromEntries(Object.entries(D).map(([_e,{type:Ce,dims:Le,data:Ne}])=>[_e,{type:Ce,dims:Le,data:Ne}]));throw console.error(`An error occurred during model execution: "${ne}".`),console.error("Inputs given to model:",ge),ne}}function j(M){for(let P in M)(0,o.isONNXTensor)(M[P])?M[P]=new c.Tensor(M[P]):typeof M[P]=="object"&&j(M[P]);return M}function ee(M){if(M instanceof c.Tensor)return M;if(M.length===0)throw Error("items must be non-empty");if(Array.isArray(M[0])){if(M.some(P=>P.length!==M[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new c.Tensor("int64",BigInt64Array.from(M.flat().map(P=>BigInt(P))),[M.length,M[0].length])}else return new c.Tensor("int64",BigInt64Array.from(M.map(P=>BigInt(P))),[1,M.length])}function H(M){return new c.Tensor("bool",[M],[1])}async function Z(M,P){let{encoder_outputs:D,input_ids:ne,decoder_input_ids:ge,..._e}=P;if(!D){const Le=(0,a.pick)(P,M.sessions.model.inputNames);D=(await X(M,Le)).last_hidden_state}return _e.input_ids=ge,_e.encoder_hidden_states=D,M.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(_e.encoder_attention_mask=P.attention_mask),await me(M,_e,!0)}async function X(M,P){const D=M.sessions.model,ne=(0,a.pick)(P,D.inputNames);if(D.inputNames.includes("inputs_embeds")&&!ne.inputs_embeds){if(!P.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");ne.inputs_embeds=await M.encode_text({input_ids:P.input_ids})}if(D.inputNames.includes("token_type_ids")&&!ne.token_type_ids){if(!ne.input_ids)throw new Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");ne.token_type_ids=(0,c.zeros_like)(ne.input_ids)}if(D.inputNames.includes("pixel_mask")&&!ne.pixel_mask){if(!ne.pixel_values)throw new Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");const ge=ne.pixel_values.dims;ne.pixel_mask=(0,c.ones)([ge[0],ge[2],ge[3]])}return await G(D,ne)}async function oe(M,P){const D=await M.encode(P);return await M.decode(D)}async function me(M,P,D=!1){const ne=M.sessions[D?"decoder_model_merged":"model"],{past_key_values:ge,..._e}=P;if(ne.inputNames.includes("use_cache_branch")&&(_e.use_cache_branch=H(!!ge)),ne.inputNames.includes("position_ids")&&_e.attention_mask&&!_e.position_ids){const Le=["paligemma","gemma3_text","gemma3"].includes(M.config.model_type)?1:0;_e.position_ids=ce(_e,ge,Le)}M.addPastKeyValues(_e,ge);const Ce=(0,a.pick)(_e,ne.inputNames);return await G(ne,Ce)}function ae({modality_token_id:M,inputs_embeds:P,modality_features:D,input_ids:ne,attention_mask:ge}){const _e=ne.tolist().map(qe=>qe.reduce((it,pt,ot)=>(pt==M&&it.push(ot),it),[])),Ce=_e.reduce((qe,it)=>qe+it.length,0),Le=D.dims[0];if(Ce!==Le)throw new Error(`Number of tokens and features do not match: tokens: ${Ce}, features ${Le}`);let Ne=0;for(let qe=0;qe<_e.length;++qe){const it=_e[qe],pt=P[qe];for(let ot=0;ot_e.dims[1])){if(ge<_e.dims[1])D.input_ids=_e.slice(null,[ge,null]);else if(M.config.image_token_index!=null&&_e.data.some(Le=>Le==M.config.image_token_index)){const Le=M.config.num_image_tokens;if(!Le)throw new Error("`num_image_tokens` is missing in the model configuration.");const Ne=_e.dims[1]-(ge-Le);D.input_ids=_e.slice(null,[-Ne,null]),D.attention_mask=(0,c.ones)([1,ge+Ne])}}}return D}function Ue(M,P,D,ne){return D.past_key_values&&(P=P.map(ge=>[ge.at(-1)])),{...D,decoder_input_ids:ee(P)}}function we(M,...P){return M.config.is_encoder_decoder?Ue(M,...P):$e(M,...P)}function q(M,P,D,ne){const ge=!!D.past_key_values;return ne.guidance_scale!==null&&ne.guidance_scale>1&&(ge?D.input_ids=(0,c.cat)([D.input_ids,D.input_ids],0):(D.input_ids=(0,c.cat)([D.input_ids,(0,c.full_like)(D.input_ids,BigInt(ne.pad_token_id))],0),D.attention_mask=(0,c.cat)([D.attention_mask,(0,c.full_like)(D.attention_mask,0n)],0))),(ge||!D.pixel_values)&&(D.pixel_values=(0,c.full)([0,0,3,384,384],1)),ge&&(D.images_seq_mask=new c.Tensor("bool",new Array(1).fill(!0).fill(!1,0,1),[1,1]),D.images_emb_mask=new c.Tensor("bool",new Array(0).fill(!1),[1,1,0])),D}class R extends i.Callable{constructor(D,ne,ge){super();te(this,"main_input_name","input_ids");te(this,"forward_params",["input_ids","attention_mask"]);this.config=D,this.sessions=ne,this.configs=ge;const _e=x.get(this.constructor),Ce=y.get(_e);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,Ce){case E.DecoderOnly:this.can_generate=!0,this._forward=me,this._prepare_inputs_for_generation=$e;break;case E.Seq2Seq:case E.Vision2Seq:case E.Musicgen:this.can_generate=!0,this._forward=Z,this._prepare_inputs_for_generation=Ue;break;case E.EncoderDecoder:this._forward=Z;break;case E.ImageTextToText:this.can_generate=!0,this._forward=fe,this._prepare_inputs_for_generation=we;break;case E.AudioTextToText:this.can_generate=!0,this._forward=re,this._prepare_inputs_for_generation=we;break;case E.Phi3V:this.can_generate=!0,this._prepare_inputs_for_generation=we;break;case E.MultiModality:this.can_generate=!0,this._prepare_inputs_for_generation=q;break;case E.AutoEncoder:this._forward=oe;break;default:this._forward=X;break}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){var ne;const D=[];for(const ge of Object.values(this.sessions))(ne=ge==null?void 0:ge.handler)!=null&&ne.dispose&&D.push(ge.handler.dispose());return await Promise.all(D)}static async from_pretrained(D,{progress_callback:ne=null,config:ge=null,cache_dir:_e=null,local_files_only:Ce=!1,revision:Le="main",model_file_name:Ne=null,subfolder:qe="onnx",device:it=null,dtype:pt=null,use_external_data_format:ot=null,session_options:bt={}}={}){let ct={progress_callback:ne,config:ge,cache_dir:_e,local_files_only:Ce,revision:Le,model_file_name:Ne,subfolder:qe,device:it,dtype:pt,use_external_data_format:ot,session_options:bt};const gt=x.get(this),tt=y.get(gt);ge=ct.config=await s.AutoConfig.from_pretrained(D,ct);let yt;if(tt===E.DecoderOnly)yt=await Promise.all([A(D,{model:ct.model_file_name??"model"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(tt===E.Seq2Seq||tt===E.Vision2Seq)yt=await Promise.all([A(D,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(tt===E.MaskGeneration)yt=await Promise.all([A(D,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},ct)]);else if(tt===E.EncoderDecoder)yt=await Promise.all([A(D,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},ct)]);else if(tt===E.ImageTextToText){const Lt={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};ge.is_encoder_decoder&&(Lt.model="encoder_model"),yt=await Promise.all([A(D,Lt,ct),B(D,{generation_config:"generation_config.json"},ct)])}else if(tt===E.AudioTextToText){const Lt={embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"};yt=await Promise.all([A(D,Lt,ct),B(D,{generation_config:"generation_config.json"},ct)])}else if(tt===E.Musicgen)yt=await Promise.all([A(D,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(tt===E.MultiModality)yt=await Promise.all([A(D,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(tt===E.Phi3V)yt=await Promise.all([A(D,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(tt===E.AutoEncoder)yt=await Promise.all([A(D,{encoder_model:"encoder_model",decoder_model:"decoder_model"},ct)]);else{if(tt!==E.EncoderOnly){const Lt=gt??(ge==null?void 0:ge.model_type);Lt!=="custom"&&console.warn(`Model type for '${Lt}' not found, assuming encoder-only architecture. Please report this at ${u.GITHUB_ISSUE_URL}.`)}yt=await Promise.all([A(D,{model:ct.model_file_name??"model"},ct)])}return new this(ge,...yt)}async _call(D){return await this.forward(D)}async forward(D){return await this._forward(this,D)}get generation_config(){var D;return((D=this.configs)==null?void 0:D.generation_config)??null}_get_logits_warper(D){const ne=new p.LogitsProcessorList;return D.temperature!==null&&D.temperature!==1&&ne.push(new p.TemperatureLogitsWarper(D.temperature)),D.top_k!==null&&D.top_k!==0&&ne.push(new p.TopKLogitsWarper(D.top_k)),D.top_p!==null&&D.top_p<1&&ne.push(new p.TopPLogitsWarper(D.top_p)),ne}_get_logits_processor(D,ne,ge=null){const _e=new p.LogitsProcessorList;if(D.repetition_penalty!==null&&D.repetition_penalty!==1&&_e.push(new p.RepetitionPenaltyLogitsProcessor(D.repetition_penalty)),D.no_repeat_ngram_size!==null&&D.no_repeat_ngram_size>0&&_e.push(new p.NoRepeatNGramLogitsProcessor(D.no_repeat_ngram_size)),D.bad_words_ids!==null&&_e.push(new p.NoBadWordsLogitsProcessor(D.bad_words_ids,D.eos_token_id)),D.min_length!==null&&D.eos_token_id!==null&&D.min_length>0&&_e.push(new p.MinLengthLogitsProcessor(D.min_length,D.eos_token_id)),D.min_new_tokens!==null&&D.eos_token_id!==null&&D.min_new_tokens>0&&_e.push(new p.MinNewTokensLengthLogitsProcessor(ne,D.min_new_tokens,D.eos_token_id)),D.forced_bos_token_id!==null&&_e.push(new p.ForcedBOSTokenLogitsProcessor(D.forced_bos_token_id)),D.forced_eos_token_id!==null&&_e.push(new p.ForcedEOSTokenLogitsProcessor(D.max_length,D.forced_eos_token_id)),D.begin_suppress_tokens!==null){const Ce=ne>1||D.forced_bos_token_id===null?ne:ne+1;_e.push(new p.SuppressTokensAtBeginLogitsProcessor(D.begin_suppress_tokens,Ce))}return D.guidance_scale!==null&&D.guidance_scale>1&&_e.push(new p.ClassifierFreeGuidanceLogitsProcessor(D.guidance_scale)),ge!==null&&_e.extend(ge),_e}_prepare_generation_config(D,ne,ge=d.GenerationConfig){const _e={...this.config};for(const Le of["decoder","generator","text_config"])Le in _e&&Object.assign(_e,_e[Le]);const Ce=new ge(_e);return Object.assign(Ce,this.generation_config??{}),D&&Object.assign(Ce,D),ne&&Object.assign(Ce,(0,a.pick)(ne,Object.getOwnPropertyNames(Ce))),Ce}_get_stopping_criteria(D,ne=null){const ge=new v.StoppingCriteriaList;return D.max_length!==null&&ge.push(new v.MaxLengthCriteria(D.max_length,this.config.max_position_embeddings??null)),D.eos_token_id!==null&&ge.push(new v.EosTokenCriteria(D.eos_token_id)),ne&&ge.extend(ne),ge}_validate_model_class(){if(!this.can_generate){const D=[yl,vl,Ml,bl],ne=x.get(this.constructor),ge=new Set,_e=this.config.model_type;for(const Le of D){const Ne=Le.get(_e);Ne&&ge.add(Ne[0])}let Ce=`The current model class (${ne}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw ge.size>0&&(Ce+=` Please use the following class instead: ${[...ge].join(", ")}`),Error(Ce)}}prepare_inputs_for_generation(...D){return this._prepare_inputs_for_generation(this,...D)}_update_model_kwargs_for_generation({generated_input_ids:D,outputs:ne,model_inputs:ge,is_encoder_decoder:_e}){return ge.past_key_values=this.getPastKeyValues(ne,ge.past_key_values),ge.input_ids=new c.Tensor("int64",D.flat(),[D.length,1]),_e||(ge.attention_mask=(0,c.cat)([ge.attention_mask,(0,c.ones)([ge.attention_mask.dims[0],1])],1)),ge.position_ids=null,ge}_prepare_model_inputs({inputs:D,bos_token_id:ne,model_kwargs:ge}){const _e=(0,a.pick)(ge,this.forward_params),Ce=this.main_input_name;if(Ce in _e){if(D)throw new Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else _e[Ce]=D;return{inputs_tensor:_e[Ce],model_inputs:_e,model_input_name:Ce}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:D,model_inputs:ne,model_input_name:ge,generation_config:_e}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!ne.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:Le,pixel_values:Ne,attention_mask:qe,...it}=ne,pt=await this._prepare_inputs_embeds(ne);ne={...it,...(0,a.pick)(pt,["inputs_embeds","attention_mask"])}}let{last_hidden_state:Ce}=await X(this,ne);if(_e.guidance_scale!==null&&_e.guidance_scale>1)Ce=(0,c.cat)([Ce,(0,c.full_like)(Ce,0)],0),"attention_mask"in ne&&(ne.attention_mask=(0,c.cat)([ne.attention_mask,(0,c.zeros_like)(ne.attention_mask)],0));else if(ne.decoder_input_ids){const Le=ee(ne.decoder_input_ids).dims[0];if(Le!==Ce.dims[0]){if(Ce.dims[0]!==1)throw new Error(`The encoder outputs have a different batch size (${Ce.dims[0]}) than the decoder inputs (${Le}).`);Ce=(0,c.cat)(Array.from({length:Le},()=>Ce),0)}}return ne.encoder_outputs=Ce,ne}_prepare_decoder_input_ids_for_generation({batch_size:D,model_input_name:ne,model_kwargs:ge,decoder_start_token_id:_e,bos_token_id:Ce,generation_config:Le}){let{decoder_input_ids:Ne,...qe}=ge;if(!(Ne instanceof c.Tensor)){if(Ne)Array.isArray(Ne[0])||(Ne=Array.from({length:D},()=>Ne));else if(_e??(_e=Ce),this.config.model_type==="musicgen")Ne=Array.from({length:D*this.config.decoder.num_codebooks},()=>[_e]);else if(Array.isArray(_e)){if(_e.length!==D)throw new Error(`\`decoder_start_token_id\` expcted to have length ${D} but got ${_e.length}`);Ne=_e}else Ne=Array.from({length:D},()=>[_e]);Ne=ee(Ne)}return ge.decoder_attention_mask=(0,c.ones_like)(Ne),{input_ids:Ne,model_inputs:qe}}async generate({inputs:D=null,generation_config:ne=null,logits_processor:ge=null,stopping_criteria:_e=null,streamer:Ce=null,...Le}){this._validate_model_class(),ne=this._prepare_generation_config(ne,Le);let{inputs_tensor:Ne,model_inputs:qe,model_input_name:it}=this._prepare_model_inputs({inputs:D,model_kwargs:Le});const pt=this.config.is_encoder_decoder;pt&&("encoder_outputs"in qe||(qe=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:Ne,model_inputs:qe,model_input_name:it,generation_config:ne})));let ot;pt?{input_ids:ot,model_inputs:qe}=this._prepare_decoder_input_ids_for_generation({batch_size:qe[it].dims.at(0),model_input_name:it,model_kwargs:qe,decoder_start_token_id:ne.decoder_start_token_id,bos_token_id:ne.bos_token_id,generation_config:ne}):ot=qe[it];let bt=ot.dims.at(-1);ne.max_new_tokens!==null&&(ne.max_length=bt+ne.max_new_tokens);const ct=this._get_logits_processor(ne,bt,ge),gt=this._get_stopping_criteria(ne,_e),tt=qe[it].dims.at(0),yt=$.LogitsSampler.getSampler(ne),Lt=new Array(tt).fill(0),Ut=ot.tolist();Ce&&Ce.put(Ut);let Qt,Ht={};for(;;){if(qe=this.prepare_inputs_for_generation(Ut,qe,ne),Qt=await this.forward(qe),ne.output_attentions&&ne.return_dict_in_generate){const Cr=this.getAttentions(Qt);for(const qr in Cr)qr in Ht||(Ht[qr]=[]),Ht[qr].push(Cr[qr])}const Mt=Qt.logits.slice(null,-1,null),ir=ct(Ut,Mt),Rr=[];for(let Cr=0;CrCr))break;qe=this._update_model_kwargs_for_generation({generated_input_ids:Rr,outputs:Qt,model_inputs:qe,is_encoder_decoder:pt})}Ce&&Ce.end();const nr=this.getPastKeyValues(Qt,qe.past_key_values,!0),hr=new c.Tensor("int64",Ut.flat(),[Ut.length,Ut[0].length]);if(ne.return_dict_in_generate)return{sequences:hr,past_key_values:nr,...Ht};for(const Mt of Object.values(Qt))Mt.location==="gpu-buffer"&&Mt.dispose();return hr}getPastKeyValues(D,ne,ge=!1){const _e=Object.create(null);for(const Ce in D)if(Ce.startsWith("present")){const Le=Ce.replace("present","past_key_values"),Ne=Ce.includes("encoder");if(Ne&&ne?_e[Le]=ne[Le]:_e[Le]=D[Ce],ne&&(!Ne||ge)){const qe=ne[Le];qe.location==="gpu-buffer"&&qe.dispose()}}return _e}getAttentions(D){const ne={};for(const ge of["cross_attentions","encoder_attentions","decoder_attentions"])for(const _e in D)_e.startsWith(ge)&&(ge in ne||(ne[ge]=[]),ne[ge].push(D[_e]));return ne}addPastKeyValues(D,ne){var ge,_e,Ce;if(ne)Object.assign(D,ne);else{const Le=this.sessions.decoder_model_merged??this.sessions.model,Ne=((ge=Le==null?void 0:Le.config)==null?void 0:ge.kv_cache_dtype)??"float32",qe=Ne==="float16"?new c.DataTypeMap.float16:[],it=((Ce=(_e=D[this.main_input_name]??D.attention_mask)==null?void 0:_e.dims)==null?void 0:Ce[0])??1,pt=(0,s.getKeyValueShapes)(this.config,{batch_size:it});for(const ot in pt)D[ot]=new c.Tensor(Ne,qe,pt[ot])}}async encode_image({pixel_values:D}){const ne=(await G(this.sessions.vision_encoder,{pixel_values:D})).image_features;return this.config.num_image_tokens||(console.warn(`The number of image tokens was not set in the model configuration. Setting it to the number of features detected by the vision encoder (${ne.dims[1]}).`),this.config.num_image_tokens=ne.dims[1]),ne}async encode_text({input_ids:D}){return(await G(this.sessions.embed_tokens,{input_ids:D})).inputs_embeds}async encode_audio({audio_values:D}){return(await G(this.sessions.audio_encoder,{audio_values:D})).audio_features}}class pe{}class xe extends pe{constructor({last_hidden_state:P,hidden_states:D=null,attentions:ne=null}){super(),this.last_hidden_state=P,this.hidden_states=D,this.attentions=ne}}class Me extends R{}class Se extends Me{}class Ae extends Me{async _call(P){return new wr(await super._call(P))}}class Fe extends Me{async _call(P){return new mt(await super._call(P))}}class ze extends Me{async _call(P){return new pr(await super._call(P))}}class Ve extends Me{async _call(P){return new Tr(await super._call(P))}}class O extends R{}class Y extends O{}class z extends O{async _call(P){return new wr(await super._call(P))}}class J extends O{async _call(P){return new mt(await super._call(P))}}class le extends O{async _call(P){return new pr(await super._call(P))}}class ye extends R{}class Ee extends ye{}class ke extends R{}class Ie extends ke{}class Be extends ke{async _call(P){return new wr(await super._call(P))}}class Xe extends ke{async _call(P){return new mt(await super._call(P))}}class Ge extends ke{async _call(P){return new pr(await super._call(P))}}class lt extends ke{async _call(P){return new Tr(await super._call(P))}}class wt extends R{}class Gt extends wt{}class Ot extends wt{async _call(P){return new wr(await super._call(P))}}class lr extends wt{async _call(P){return new mt(await super._call(P))}}class Yr extends wt{async _call(P){return new pr(await super._call(P))}}class gs extends wt{async _call(P){return new Tr(await super._call(P))}}class kr extends R{}class Ds extends kr{}class xs extends kr{async _call(P){return new wr(await super._call(P))}}class Ls extends kr{async _call(P){return new mt(await super._call(P))}}class at extends kr{async _call(P){return new pr(await super._call(P))}}class Zr extends kr{async _call(P){return new Tr(await super._call(P))}}class Ir extends R{}class ws extends Ir{}class Ft extends Ir{async _call(P){return new wr(await super._call(P))}}class es extends Ir{async _call(P){return new mt(await super._call(P))}}class ts extends Ir{async _call(P){return new pr(await super._call(P))}}class bs extends Ir{async _call(P){return new Tr(await super._call(P))}}class Xt extends R{}class De extends Xt{}class Qe extends Xt{async _call(P){return new wr(await super._call(P))}}class et extends Xt{async _call(P){return new mt(await super._call(P))}}class Bt extends Xt{async _call(P){return new pr(await super._call(P))}}class Or extends Xt{async _call(P){return new Tr(await super._call(P))}}class Pr extends R{}class rs extends Pr{}class ss extends Pr{async _call(P){return new wr(await super._call(P))}}class Ur extends Pr{async _call(P){return new mt(await super._call(P))}}class ns extends Pr{async _call(P){return new pr(await super._call(P))}}class os extends Pr{async _call(P){return new Tr(await super._call(P))}}class Wr extends R{}class yr extends Wr{}class Ys extends Wr{async _call(P){return new mt(await super._call(P))}}class vr extends Wr{async _call(P){return new pr(await super._call(P))}}class Ts extends Wr{async _call(P){return new Tr(await super._call(P))}}class Es extends Wr{async _call(P){return new wr(await super._call(P))}}class fr extends R{}class zs extends fr{}class Zs extends fr{async _call(P){return new wr(await super._call(P))}}class Ar extends fr{async _call(P){return new mt(await super._call(P))}}class en extends fr{async _call(P){return new pr(await super._call(P))}}class Gr extends R{}class xr extends Gr{}class Ps extends Gr{async _call(P){return new wr(await super._call(P))}}class ur extends Gr{async _call(P){return new mt(await super._call(P))}}class _r extends Gr{async _call(P){return new Tr(await super._call(P))}}class Dr extends R{}class tn extends Dr{}class rn extends Dr{async _call(P){return new wr(await super._call(P))}}class sn extends Dr{async _call(P){return new mt(await super._call(P))}}class nn extends Dr{async _call(P){return new pr(await super._call(P))}}class on extends Dr{async _call(P){return new Tr(await super._call(P))}}class Ms extends R{}class an extends Ms{}class Bs extends Ms{async _call(P){return new wr(await super._call(P))}}class ln extends Ms{async _call(P){return new mt(await super._call(P))}}class un extends Ms{async _call(P){return new Tr(await super._call(P))}}class ys extends R{}class dn extends ys{}class he extends ys{async _call(P){return new mt(await super._call(P))}}class k extends ys{async _call(P){return new Tr(await super._call(P))}}class N extends ys{async _call(P){return new wr(await super._call(P))}}class Q extends R{constructor(){super(...arguments);te(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}}class ie extends Q{}class de extends Q{}class ve extends R{}class je extends ve{}class He extends ve{}class We extends R{}class Je extends We{}class dt extends We{}class vt extends R{}class Et extends vt{}class Rt extends vt{}class kt extends vt{async _call(P){return new mt(await super._call(P))}}class Kt extends R{}class Mr extends Kt{}class dr extends Kt{}class cr extends Kt{async _call(P){return new mt(await super._call(P))}}class Nt extends Kt{}class Kr extends R{}class Dt extends Kr{}class rr extends Kr{}class gr extends R{}class Hr extends gr{}class Lr extends gr{}class Yt extends R{}class zr extends Yt{}class or extends Yt{async _call(P){return new wr(await super._call(P))}}class Vt extends Yt{async _call(P){return new mt(await super._call(P))}}class Zt extends Yt{async _call(P){return new pr(await super._call(P))}}class er extends Yt{async _call(P){return new Tr(await super._call(P))}}class tr extends R{}class Rs extends tr{}class cn extends tr{async _call(P){return new wr(await super._call(P))}}class ei extends tr{async _call(P){return new mt(await super._call(P))}}class ti extends tr{async _call(P){return new pr(await super._call(P))}}class ri extends tr{async _call(P){return new Tr(await super._call(P))}}class Cs extends R{}class si extends Cs{}class ni extends Cs{async _call(P){return new wr(await super._call(P))}}class oi extends Cs{async _call(P){return new mt(await super._call(P))}}class ii extends Cs{async _call(P){return new pr(await super._call(P))}}class ai extends Cs{async _call(P){return new Tr(await super._call(P))}}class lo extends R{}class li extends lo{}class ui extends lo{}class uo extends R{constructor(){super(...arguments);te(this,"requires_attention_mask",!1);te(this,"main_input_name","input_features");te(this,"forward_params",["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"])}}class di extends uo{}class co extends uo{_prepare_generation_config(P,D){return super._prepare_generation_config(P,D,g.WhisperGenerationConfig)}_retrieve_init_tokens(P){const D=[P.decoder_start_token_id];let ne=P.language;const ge=P.task;if(P.is_multilingual){ne||(console.warn("No language specified - defaulting to English (en)."),ne="en");const Ce=`<|${(0,C.whisper_language_to_code)(ne)}|>`;D.push(P.lang_to_id[Ce]),D.push(P.task_to_id[ge??"transcribe"])}else if(ne||ge)throw new Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!P.return_timestamps&&P.no_timestamps_token_id&&D.at(-1)!==P.no_timestamps_token_id?D.push(P.no_timestamps_token_id):P.return_timestamps&&D.at(-1)===P.no_timestamps_token_id&&(console.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),D.pop()),D.filter(_e=>_e!=null)}async generate({inputs:P=null,generation_config:D=null,logits_processor:ne=null,stopping_criteria:ge=null,..._e}){D=this._prepare_generation_config(D,_e);const Ce=_e.decoder_input_ids??this._retrieve_init_tokens(D);if(D.return_timestamps&&(ne??(ne=new p.LogitsProcessorList),ne.push(new p.WhisperTimeStampLogitsProcessor(D,Ce))),D.begin_suppress_tokens&&(ne??(ne=new p.LogitsProcessorList),ne.push(new p.SuppressTokensAtBeginLogitsProcessor(D.begin_suppress_tokens,Ce.length))),D.return_token_timestamps){if(!D.alignment_heads)throw new Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");D.task==="translate"&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),D.output_attentions=!0,D.return_dict_in_generate=!0}const Le=await super.generate({inputs:P,generation_config:D,logits_processor:ne,decoder_input_ids:Ce,..._e});return D.return_token_timestamps&&(Le.token_timestamps=this._extract_token_timestamps(Le,D.alignment_heads,D.num_frames)),Le}_extract_token_timestamps(P,D,ne=null,ge=.02){if(!P.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");ne==null&&console.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let _e=this.config.median_filter_width;_e===void 0&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),_e=7);const Ce=P.cross_attentions,Le=Array.from({length:this.config.decoder_layers},(gt,tt)=>(0,c.cat)(Ce.map(yt=>yt[tt]),2)),Ne=(0,c.stack)(D.map(([gt,tt])=>{if(gt>=Le.length)throw new Error(`Layer index ${gt} is out of bounds for cross attentions (length ${Le.length}).`);return ne?Le[gt].slice(null,tt,null,[0,ne]):Le[gt].slice(null,tt)})).transpose(1,0,2,3),[qe,it]=(0,c.std_mean)(Ne,-2,0,!0),pt=Ne.clone();for(let gt=0;gtyt[hr+1]-yt[hr]),Qt=(0,a.mergeArrays)([1],Ut).map(nr=>!!nr),Ht=[];for(let nr=0;nrot.findIndex(bt=>bt==_e)),Ne=Le.every(ot=>ot===-1),qe=Le.every(ot=>ot!==-1);if(!Ne&&!qe)throw new Error("Every input should contain either 0 or 1 image token.");if(Ne)return{inputs_embeds:P,attention_mask:ge};const it=[],pt=[];for(let ot=0;otArray.from({length:P.dims[0]},Ut=>Array.from({length:P.dims[1]},Qt=>1))),ct=D?D.tolist():[],gt=ne?ne.tolist():[];let tt=0,yt=0;for(let Lt=0;Ltot[Lt][ar]==1),Ht=Ut.reduce((Wt,ar,Ks)=>(ar==Ne&&Wt.push(Ks),Wt),[]).map(Wt=>Ut[Wt+1]),nr=Ht.filter(Wt=>Wt==Ce).length,hr=Ht.filter(Wt=>Wt==Le).length;let Mt=[],ir=0,Rr=nr,Mn=hr;for(let Wt=0;Wtis>ir&&xn==Ce),Ks=Ut.findIndex((xn,is)=>is>ir&&xn==Le),vn=Rr>0&&ar!==-1?ar:Ut.length+1,Zn=Mn>0&&Ks!==-1?Ks:Ut.length+1;let Gi,Tl,El,Pl;vn0?(0,f.max)(Mt.at(-1))[0]+1:0;Mt.push(Array.from({length:3*Sl},(xn,is)=>gf+is%Sl));const $l=Sl+gf,Hi=ov*Cl*Ki,iv=Array.from({length:Hi},(xn,is)=>$l+Math.floor(is/(Cl*Ki))),av=Array.from({length:Hi},(xn,is)=>$l+Math.floor(is/Ki)%Cl),lv=Array.from({length:Hi},(xn,is)=>$l+is%Ki);Mt.push([iv,av,lv].flat()),ir=Gi+Hi}if(ir0?(0,f.max)(Mt.at(-1))[0]+1:0,ar=Ut.length-ir;Mt.push(Array.from({length:3*ar},(Ks,vn)=>Wt+vn%ar))}const Cr=Mt.reduce((Wt,ar)=>Wt+ar.length,0),qr=new Array(Cr);let Vi=0;for(let Wt=0;Wt<3;++Wt)for(let ar=0;arpt[tt%pt.length]),ct=Array.from({length:ot[0]},(gt,tt)=>(0,f.max)(pt.subarray(ot[1]*tt,ot[1]*(tt+1)))[0]+1n+BigInt(ot[1]));return[new c.Tensor("int64",bt,[3,...ot]),new c.Tensor("int64",ct,[ct.length,1])]}else{const[pt,ot]=P.dims,bt=BigInt64Array.from({length:3*pt*ot},(ct,gt)=>BigInt(Math.floor(gt%ot/pt)));return[new c.Tensor("int64",bt,[3,...P.dims]),(0,c.zeros)([pt,1])]}}async encode_image({pixel_values:P,image_grid_thw:D}){return(await G(this.sessions.vision_encoder,{pixel_values:P,grid_thw:D})).image_features}_merge_input_ids_with_image_features(P){return V({image_token_id:this.config.image_token_id,...P})}prepare_inputs_for_generation(P,D,ne){if(D.attention_mask&&!D.position_ids)if(!D.past_key_values)[D.position_ids,D.rope_deltas]=this.get_rope_index(D.input_ids,D.image_grid_thw,D.video_grid_thw,D.attention_mask);else{D.pixel_values=null;const ge=BigInt(Object.values(D.past_key_values)[0].dims.at(-2)),_e=D.rope_deltas.map(Ce=>ge+Ce);D.position_ids=(0,c.stack)([_e,_e,_e],0)}return D}}class Ca extends R{}class Bd extends Ca{}class Rd extends Ca{}class Sa extends R{}class jd extends Sa{}class Nd extends Sa{}class $a extends R{}class Vd extends $a{}class Ud extends $a{}class ka extends R{}class Wd extends ka{}class Gd extends ka{}class Ia extends R{}class Kd extends Ia{}class Hd extends Ia{}class Aa extends R{}class qd extends Aa{}class Xd extends Aa{async _call(P){return new mt(await super._call(P))}}class Fa extends R{}class Qd extends Fa{}class Jd extends Fa{async _call(P){return new mt(await super._call(P))}}class Yd extends R{}class Zd extends Yd{}class Oa extends R{}class ec extends Oa{}class tc extends Oa{async _call(P){return new mt(await super._call(P))}}class rc extends R{}class sc extends rc{}class Da extends R{}class nc extends Da{}class oc extends Da{async _call(P){return new mt(await super._call(P))}}class ic extends R{}class ac extends ic{}class La extends R{}class lc extends La{}class uc extends La{async _call(P){return new mt(await super._call(P))}}class dc extends R{}class cc extends dc{async _call(P){return new ff(await super._call(P))}}class za extends R{}class pc extends za{}class hc extends za{async _call(P){return new mt(await super._call(P))}}class Ba extends R{}class mc extends Ba{}class fc extends Ba{async _call(P){return new mt(await super._call(P))}}class Ra extends R{}class _c extends Ra{}class gc extends Ra{}class ja extends R{}class wc extends ja{}class bc extends ja{}class Na extends R{}class Mc extends Na{}class yc extends Na{async _call(P){return new mt(await super._call(P))}}class Pi extends R{}class vc extends Pi{}class xc extends Pi{async _call(P){return new Ua(await super._call(P))}}class Va extends Pi{async _call(P){return new Tc(await super._call(P))}}class Ua extends pe{constructor({logits:P,pred_boxes:D}){super(),this.logits=P,this.pred_boxes=D}}class Tc extends pe{constructor({logits:P,pred_boxes:D,pred_masks:ne}){super(),this.logits=P,this.pred_boxes=D,this.pred_masks=ne}}class Wa extends R{}class Ec extends Wa{}class Pc extends Wa{async _call(P){return new Ci(await super._call(P))}}class Ci extends pe{constructor({logits:P,pred_boxes:D}){super(),this.logits=P,this.pred_boxes=D}}class Ga extends R{}class Cc extends Ga{}class Sc extends Ga{async _call(P){return new $c(await super._call(P))}}class $c extends Ci{}class Ka extends R{}class kc extends Ka{}class Ic extends Ka{async _call(P){return new Ac(await super._call(P))}}class Ac extends Ci{}class Ha extends R{}class Fc extends Ha{}class Oc extends Ha{async _call(P){return new Dc(await super._call(P))}}class Dc extends Ua{}class qa extends R{}class Lc extends qa{}class zc extends qa{async _call(P){return new mt(await super._call(P))}}class Xa extends R{}class Bc extends Xa{}class Rc extends Xa{async _call(P){return new mt(await super._call(P))}}class Qa extends R{}class jc extends Qa{}class Nc extends Qa{async _call(P){return new mt(await super._call(P))}}class Si extends R{}class Vc extends Si{}class Uc extends Si{async _call(P){return new mt(await super._call(P))}}class Wc extends Si{}class Ja extends R{}class Gc extends Ja{}class Kc extends Ja{}class Ya extends R{}class Hc extends Ya{}class qc extends Ya{}class Xc extends R{}class Qc extends Xc{}class $i extends R{}class Jc extends $i{}class Yc extends $i{}class Zc extends $i{}class ep extends R{}class tp extends ep{}class rp extends R{}class sp extends rp{}class np extends R{}class op extends np{}class Za extends R{}class ip extends Za{}class ap extends Za{}class el extends R{}class lp extends el{}class up extends el{}class dp extends R{}class cp extends dp{}class tl extends R{}class pp extends tl{}class hp extends tl{async _call(P){return new mt(await super._call(P))}}class rl extends R{}class mp extends rl{}class fp extends rl{async _call(P){return new mt(await super._call(P))}}class sl extends R{}class _p extends sl{}class gp extends sl{async _call(P){return new mt(await super._call(P))}}class nl extends R{}class wp extends nl{}class bp extends nl{async _call(P){return new mt(await super._call(P))}}class Mp extends R{}class yp extends Mp{}class ol extends R{}class vp extends ol{}class xp extends ol{async _call(P){return new Tp(await super._call(P))}}class Tp extends pe{constructor({logits:P,pred_boxes:D}){super(),this.logits=P,this.pred_boxes=D}}class Ep extends R{}class Pp extends Ep{async get_image_embeddings({pixel_values:P}){return await X(this,{pixel_values:P})}async forward(P){if((!P.image_embeddings||!P.image_positional_embeddings)&&(P={...P,...await this.get_image_embeddings(P)}),!P.input_labels&&P.input_points){const ne=P.input_points.dims.slice(0,-1),ge=ne.reduce((_e,Ce)=>_e*Ce,1);P.input_labels=new c.Tensor("int64",new BigInt64Array(ge).fill(1n),ne)}const D={image_embeddings:P.image_embeddings,image_positional_embeddings:P.image_positional_embeddings};return P.input_points&&(D.input_points=P.input_points),P.input_labels&&(D.input_labels=P.input_labels),P.input_boxes&&(D.input_boxes=P.input_boxes),await G(this.sessions.prompt_encoder_mask_decoder,D)}async _call(P){return new Cp(await super._call(P))}}class Cp extends pe{constructor({iou_scores:P,pred_masks:D}){super(),this.iou_scores=P,this.pred_masks=D}}class il extends R{}class Sp extends il{}class $p extends il{}class al extends R{}class kp extends al{}class Ip extends al{}class Gs extends R{}class Ap extends Gs{}class Fp extends Gs{async _call(P){return new bn(await super._call(P))}}class Op extends Gs{async _call(P){return new mt(await super._call(P))}}class Dp extends Gs{async _call(P){return new pr(await super._call(P))}}class ll extends R{}class Lp extends ll{}class zp extends ll{async _call(P){return new pr(await super._call(P))}}class Bp extends R{}class Rp extends Bp{}class ki extends R{}class jp extends ki{}class Np extends ki{async _call(P){return new bn(await super._call(P))}}class Vp extends ki{async _call(P){return new mt(await super._call(P))}}class Do extends R{}class Up extends Do{}class Wp extends Do{async _call(P){return new bn(await super._call(P))}}class Gp extends Do{async _call(P){return new mt(await super._call(P))}}class Kp extends Do{async _call(P){return new pr(await super._call(P))}}class Ii extends R{}class Hp extends Ii{}class qp extends Ii{async _call(P){return new bn(await super._call(P))}}class Xp extends Ii{async _call(P){return new mt(await super._call(P))}}class W0 extends R{}class Qp extends Gs{}class Jp extends Gs{async _call(P){return new bn(await super._call(P))}}class Yp extends Gs{async _call(P){return new mt(await super._call(P))}}class Jn extends R{}class Zp extends Jn{}class eh extends Jn{async _call(P){return new bn(await super._call(P))}}class th extends Jn{async _call(P){return new mt(await super._call(P))}}class rh extends Jn{async _call(P){return new mf(await super._call(P))}}class sh extends Jn{async _call(P){return new pr(await super._call(P))}}class nh extends R{}class oh extends nh{}class Ai extends R{}class G0 extends Ai{}class ih extends Ai{}class ah extends Ai{async generate_speech(P,D,{threshold:ne=.5,minlenratio:ge=0,maxlenratio:_e=20,vocoder:Ce=null}={}){const Le={input_ids:P},{encoder_outputs:Ne,encoder_attention_mask:qe}=await X(this,Le),it=Ne.dims[1]/this.config.reduction_factor,pt=Math.floor(it*_e),ot=Math.floor(it*ge),bt=this.config.num_mel_bins;let ct=[],gt=null,tt=null,yt=0;for(;;){++yt;const Qt=H(!!tt);let Ht;tt?Ht=tt.output_sequence_out:Ht=new c.Tensor("float32",new Float32Array(bt),[1,1,bt]);let nr={use_cache_branch:Qt,output_sequence:Ht,encoder_attention_mask:qe,speaker_embeddings:D,encoder_hidden_states:Ne};this.addPastKeyValues(nr,gt),tt=await G(this.sessions.decoder_model_merged,nr),gt=this.getPastKeyValues(tt,gt);const{prob:hr,spectrum:Mt}=tt;if(ct.push(Mt),yt>=ot&&(Array.from(hr.data).filter(ir=>ir>=ne).length>0||yt>=pt))break}const Lt=(0,c.cat)(ct),{waveform:Ut}=await G(Ce.sessions.model,{spectrogram:Lt});return{spectrogram:Lt,waveform:Ut}}}class lh extends R{constructor(){super(...arguments);te(this,"main_input_name","spectrogram")}}class uh extends R{}class dh extends uh{}class ul extends R{}class ch extends ul{}class ph extends ul{}class dl extends R{}class hh extends dl{}class mh extends dl{}class cl extends R{}class fh extends cl{}class _h extends cl{}class Fi extends R{}class gh extends Fi{}class wh extends Fi{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"text_model"})}}class bh extends Fi{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"audio_model"})}}class Mh extends R{}class pl extends Mh{async _call(P){return new _f(await super._call(P))}}class Oi extends R{}class K0 extends Oi{}class yh extends Oi{}class vh extends Oi{}class hl extends R{}class xh extends hl{}class Th extends hl{}class ml extends R{}class Eh extends ml{}class Ph extends ml{async _call(P){return new mt(await super._call(P))}}class fl extends R{}class H0 extends fl{}class q0 extends fl{}class _l extends R{constructor(){super(...arguments);te(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}_apply_and_filter_by_delay_pattern_mask(D){const[ne,ge]=D.dims,_e=this.config.decoder.num_codebooks,Ce=ge-_e;let Le=0;for(let it=0;it0&&bt<=Ce&&(D.data[Le++]=D.data[it])}const Ne=Math.floor(ne/_e),qe=Le/(Ne*_e);return new c.Tensor(D.type,D.data.slice(0,Le),[Ne,_e,qe])}prepare_inputs_for_generation(D,ne,ge){let _e=structuredClone(D);for(let Le=0;Le<_e.length;++Le)for(let Ne=0;Ne<_e[Le].length;++Ne)Le%this.config.decoder.num_codebooks>=Ne&&(_e[Le][Ne]=BigInt(this.config.decoder.pad_token_id));return ge.guidance_scale!==null&&ge.guidance_scale>1&&(_e=_e.concat(_e)),super.prepare_inputs_for_generation(_e,ne,ge)}async generate(D){const ne=await super.generate(D),ge=this._apply_and_filter_by_delay_pattern_mask(ne).unsqueeze_(0),{audio_values:_e}=await G(this.sessions.encodec_decode,{audio_codes:ge});return _e}}class Di extends R{}class Ch extends Di{}class Sh extends Di{async _call(P){return new mt(await super._call(P))}}class $h extends Di{}class Li extends R{}class kh extends Li{}class Ih extends Li{async _call(P){return new mt(await super._call(P))}}class Ah extends Li{}class zi extends R{}class Fh extends zi{}class Oh extends zi{async _call(P){return new mt(await super._call(P))}}class Dh extends zi{}class Bi extends R{}class Lh extends Bi{}class zh extends Bi{async _call(P){return new mt(await super._call(P))}}class Bh extends Bi{}class Rh extends R{}class jh extends Rh{}class Nh extends R{}class Vh extends Nh{constructor(...D){super(...D);te(this,"forward_params",["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"]);this._generation_mode="text"}async forward(D){const ne=this._generation_mode??"text";let ge;if(ne==="text"||!D.past_key_values){const qe=this.sessions.prepare_inputs_embeds,it=(0,a.pick)(D,qe.inputNames);ge=await G(qe,it)}else{const qe=this.sessions.gen_img_embeds,it=(0,a.pick)({image_ids:D.input_ids},qe.inputNames);ge=await G(qe,it)}const _e={...D,...ge},Ce=await me(this,_e),Le=this.sessions[ne==="text"?"lm_head":"gen_head"];if(!Le)throw new Error(`Unable to find "${Le}" generation head`);const Ne=await G(Le,(0,a.pick)(Ce,Le.inputNames));return{...ge,...Ce,...Ne}}async generate(D){return this._generation_mode="text",super.generate(D)}async generate_images(D){this._generation_mode="image";const ne=(D.inputs??D[this.main_input_name]).dims[1],_e=(await super.generate(D)).slice(null,[ne,null]),Ce=this.sessions.image_decode,{decoded_image:Le}=await G(Ce,{generated_tokens:_e}),Ne=Le.add_(1).mul_(255/2).clamp_(0,255).to("uint8"),qe=[];for(const it of Ne){const pt=_.RawImage.fromTensor(it);qe.push(pt)}return qe}}class Uh extends pe{constructor({char_logits:P,bpe_logits:D,wp_logits:ne}){super(),this.char_logits=P,this.bpe_logits=D,this.wp_logits=ne}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class Wh extends R{}class Gh extends Wh{async _call(P){return new Uh(await super._call(P))}}class gl extends R{}class Kh extends gl{}class Hh extends gl{}class wl extends R{}class qh extends wl{}class Xh extends wl{}class Qh extends R{constructor(){super(...arguments);te(this,"forward_params",["input_ids","attention_mask","position_ids","audio_values","past_key_values"])}}class Jh extends Qh{_merge_input_ids_with_audio_features(P){const D=P.audio_features.dims.at(-1),ne=P.audio_features.view(-1,D);return F({audio_token_id:this.config.ignore_index,...P,audio_features:ne})}}class Ri extends R{constructor(){super(...arguments);te(this,"main_input_name","input_values");te(this,"forward_params",["input_values"])}}class Yh extends pe{constructor({audio_codes:P}){super(),this.audio_codes=P}}class Zh extends pe{constructor({audio_values:P}){super(),this.audio_values=P}}class em extends Ri{async encode(P){return new Yh(await G(this.sessions.encoder_model,P))}async decode(P){return new Zh(await G(this.sessions.decoder_model,P))}}class tm extends Ri{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"encoder_model"})}}class rm extends Ri{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"decoder_model"})}}class ji extends R{constructor(){super(...arguments);te(this,"main_input_name","input_values");te(this,"forward_params",["input_values"])}}class sm extends pe{constructor({audio_codes:P}){super(),this.audio_codes=P}}class nm extends pe{constructor({audio_values:P}){super(),this.audio_values=P}}class om extends ji{async encode(P){return new sm(await G(this.sessions.encoder_model,P))}async decode(P){return new nm(await G(this.sessions.decoder_model,P))}}class im extends ji{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"encoder_model"})}}class am extends ji{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"decoder_model"})}}class Ni extends R{constructor(){super(...arguments);te(this,"main_input_name","input_values");te(this,"forward_params",["input_values"])}}class lm extends Ni{async encode(P){return await G(this.sessions.encoder_model,P)}async decode(P){return await G(this.sessions.decoder_model,P)}}class um extends Ni{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"encoder_model"})}}class dm extends Ni{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"decoder_model"})}}class Pt{static async from_pretrained(P,{progress_callback:D=null,config:ne=null,cache_dir:ge=null,local_files_only:_e=!1,revision:Ce="main",model_file_name:Le=null,subfolder:Ne="onnx",device:qe=null,dtype:it=null,use_external_data_format:pt=null,session_options:ot={}}={}){const bt={progress_callback:D,config:ne,cache_dir:ge,local_files_only:_e,revision:Ce,model_file_name:Le,subfolder:Ne,device:qe,dtype:it,use_external_data_format:pt,session_options:ot};if(bt.config=await s.AutoConfig.from_pretrained(P,bt),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);const ct=bt.config.model_type;for(const gt of this.MODEL_CLASS_MAPPINGS){let tt=gt.get(ct);if(!tt){for(const yt of gt.values())if(yt[0]===ct){tt=yt;break}if(!tt)continue}return await tt[1].from_pretrained(P,bt)}if(this.BASE_IF_FAIL)return Lm.has(ct)||console.warn(`Unknown model class "${ct}", attempting to construct from base class.`),await R.from_pretrained(P,bt);throw Error(`Unsupported model type: ${ct}`)}}te(Pt,"MODEL_CLASS_MAPPINGS",null),te(Pt,"BASE_IF_FAIL",!1);const X0=new Map([["bert",["BertModel",Se]],["modernbert",["ModernBertModel",Y]],["nomic_bert",["NomicBertModel",Ee]],["roformer",["RoFormerModel",Ie]],["electra",["ElectraModel",Ds]],["esm",["EsmModel",zs]],["convbert",["ConvBertModel",Gt]],["camembert",["CamembertModel",ws]],["deberta",["DebertaModel",De]],["deberta-v2",["DebertaV2Model",rs]],["mpnet",["MPNetModel",tn]],["albert",["AlbertModel",dn]],["distilbert",["DistilBertModel",yr]],["roberta",["RobertaModel",zr]],["xlm",["XLMModel",Rs]],["xlm-roberta",["XLMRobertaModel",si]],["clap",["ClapModel",gh]],["clip",["CLIPModel",bi]],["clipseg",["CLIPSegModel",yo]],["chinese_clip",["ChineseCLIPModel",xi]],["siglip",["SiglipModel",hn]],["jina_clip",["JinaCLIPModel",Nn]],["mobilebert",["MobileBertModel",xr]],["squeezebert",["SqueezeBertModel",an]],["wav2vec2",["Wav2Vec2Model",Ap]],["wav2vec2-bert",["Wav2Vec2BertModel",Hp]],["unispeech",["UniSpeechModel",jp]],["unispeech-sat",["UniSpeechSatModel",Up]],["hubert",["HubertModel",Qp]],["wavlm",["WavLMModel",Zp]],["audio-spectrogram-transformer",["ASTModel",li]],["vits",["VitsModel",pl]],["pyannote",["PyAnnoteModel",Lp]],["wespeaker-resnet",["WeSpeakerResNetModel",Rp]],["detr",["DetrModel",vc]],["rt_detr",["RTDetrModel",Ec]],["rt_detr_v2",["RTDetrV2Model",Cc]],["rf_detr",["RFDetrModel",kc]],["table-transformer",["TableTransformerModel",Fc]],["vit",["ViTModel",qd]],["ijepa",["IJepaModel",Qd]],["pvt",["PvtModel",ec]],["vit_msn",["ViTMSNModel",nc]],["vit_mae",["ViTMAEModel",sc]],["groupvit",["GroupViTModel",ac]],["fastvit",["FastViTModel",lc]],["mobilevit",["MobileViTModel",pc]],["mobilevitv2",["MobileViTV2Model",mc]],["owlvit",["OwlViTModel",_c]],["owlv2",["Owlv2Model",wc]],["beit",["BeitModel",Mc]],["deit",["DeiTModel",Lc]],["hiera",["HieraModel",Bc]],["convnext",["ConvNextModel",pp]],["convnextv2",["ConvNextV2Model",mp]],["dinov2",["Dinov2Model",_p]],["dinov2_with_registers",["Dinov2WithRegistersModel",wp]],["resnet",["ResNetModel",jc]],["swin",["SwinModel",Vc]],["swin2sr",["Swin2SRModel",Gc]],["donut-swin",["DonutSwinModel",cp]],["yolos",["YolosModel",vp]],["dpt",["DPTModel",Hc]],["glpn",["GLPNModel",lp]],["hifigan",["SpeechT5HifiGan",lh]],["efficientnet",["EfficientNetModel",Eh]],["decision_transformer",["DecisionTransformerModel",jh]],["patchtst",["PatchTSTForPrediction",Kh]],["patchtsmixer",["PatchTSMixerForPrediction",qh]],["mobilenet_v1",["MobileNetV1Model",Ch]],["mobilenet_v2",["MobileNetV2Model",kh]],["mobilenet_v3",["MobileNetV3Model",Fh]],["mobilenet_v4",["MobileNetV4Model",Lh]],["maskformer",["MaskFormerModel",ip]],["mgp-str",["MgpstrForSceneTextRecognition",Gh]],["style_text_to_speech_2",["StyleTextToSpeech2Model",oh]]]),Q0=new Map([["t5",["T5Model",ie]],["longt5",["LongT5Model",je]],["mt5",["MT5Model",Je]],["bart",["BartModel",Et]],["mbart",["MBartModel",Mr]],["marian",["MarianModel",Sp]],["whisper",["WhisperModel",di]],["m2m_100",["M2M100Model",kp]],["blenderbot",["BlenderbotModel",Dt]],["blenderbot-small",["BlenderbotSmallModel",Hr]]]),J0=new Map([["mimi",["MimiModel",em]],["dac",["DacModel",om]],["snac",["SnacModel",lm]]]),Y0=new Map([["bloom",["BloomModel",Vd]],["jais",["JAISModel",mn]],["gpt2",["GPT2Model",Ti]],["gptj",["GPTJModel",Co]],["gpt_bigcode",["GPTBigCodeModel",Kn]],["gpt_neo",["GPTNeoModel",Eo]],["gpt_neox",["GPTNeoXModel",Br]],["codegen",["CodeGenModel",ko]],["llama",["LlamaModel",qn]],["exaone",["ExaoneModel",I]],["olmo",["OlmoModel",Ke]],["olmo2",["Olmo2Model",xt]],["mobilellm",["MobileLLMModel",ue]],["granite",["GraniteModel",$s]],["cohere",["CohereModel",Td]],["gemma",["GemmaModel",Pd]],["gemma2",["Gemma2Model",Sd]],["gemma3_text",["Gemma3Model",kd]],["helium",["HeliumModel",Ao]],["glm",["GlmModel",Oo]],["openelm",["OpenELMModel",Ad]],["qwen2",["Qwen2Model",Od]],["phi",["PhiModel",Bd]],["phi3",["Phi3Model",jd]],["mpt",["MptModel",Wd]],["opt",["OPTModel",Kd]],["mistral",["MistralModel",ch]],["starcoder2",["Starcoder2Model",hh]],["falcon",["FalconModel",fh]],["stablelm",["StableLmModel",xh]]]),bl=new Map([["speecht5",["SpeechT5ForSpeechToText",ih]],["whisper",["WhisperForConditionalGeneration",co]],["lite-whisper",["LiteWhisperForConditionalGeneration",ci]],["moonshine",["MoonshineForConditionalGeneration",po]]]),cm=new Map([["speecht5",["SpeechT5ForTextToSpeech",ah]]]),pm=new Map([["vits",["VitsModel",pl]],["musicgen",["MusicgenForConditionalGeneration",_l]]]),hm=new Map([["bert",["BertForSequenceClassification",Fe]],["modernbert",["ModernBertForSequenceClassification",J]],["roformer",["RoFormerForSequenceClassification",Xe]],["electra",["ElectraForSequenceClassification",Ls]],["esm",["EsmForSequenceClassification",Ar]],["convbert",["ConvBertForSequenceClassification",lr]],["camembert",["CamembertForSequenceClassification",es]],["deberta",["DebertaForSequenceClassification",et]],["deberta-v2",["DebertaV2ForSequenceClassification",Ur]],["mpnet",["MPNetForSequenceClassification",sn]],["albert",["AlbertForSequenceClassification",he]],["distilbert",["DistilBertForSequenceClassification",Ys]],["roberta",["RobertaForSequenceClassification",Vt]],["xlm",["XLMForSequenceClassification",ei]],["xlm-roberta",["XLMRobertaForSequenceClassification",oi]],["bart",["BartForSequenceClassification",kt]],["mbart",["MBartForSequenceClassification",cr]],["mobilebert",["MobileBertForSequenceClassification",ur]],["squeezebert",["SqueezeBertForSequenceClassification",ln]]]),mm=new Map([["bert",["BertForTokenClassification",ze]],["modernbert",["ModernBertForTokenClassification",le]],["roformer",["RoFormerForTokenClassification",Ge]],["electra",["ElectraForTokenClassification",at]],["esm",["EsmForTokenClassification",en]],["convbert",["ConvBertForTokenClassification",Yr]],["camembert",["CamembertForTokenClassification",ts]],["deberta",["DebertaForTokenClassification",Bt]],["deberta-v2",["DebertaV2ForTokenClassification",ns]],["mpnet",["MPNetForTokenClassification",nn]],["distilbert",["DistilBertForTokenClassification",vr]],["roberta",["RobertaForTokenClassification",Zt]],["xlm",["XLMForTokenClassification",ti]],["xlm-roberta",["XLMRobertaForTokenClassification",ii]]]),Ml=new Map([["t5",["T5ForConditionalGeneration",de]],["longt5",["LongT5ForConditionalGeneration",He]],["mt5",["MT5ForConditionalGeneration",dt]],["bart",["BartForConditionalGeneration",Rt]],["mbart",["MBartForConditionalGeneration",dr]],["marian",["MarianMTModel",$p]],["m2m_100",["M2M100ForConditionalGeneration",Ip]],["blenderbot",["BlenderbotForConditionalGeneration",rr]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",Lr]]]),yl=new Map([["bloom",["BloomForCausalLM",Ud]],["gpt2",["GPT2LMHeadModel",xo]],["jais",["JAISLMHeadModel",nt]],["gptj",["GPTJForCausalLM",So]],["gpt_bigcode",["GPTBigCodeForCausalLM",$o]],["gpt_neo",["GPTNeoForCausalLM",Po]],["gpt_neox",["GPTNeoXForCausalLM",fn]],["codegen",["CodeGenForCausalLM",gn]],["llama",["LlamaForCausalLM",Io]],["exaone",["ExaoneForCausalLM",L]],["olmo",["OlmoForCausalLM",Ye]],["olmo2",["Olmo2ForCausalLM",It]],["mobilellm",["MobileLLMForCausalLM",Te]],["granite",["GraniteForCausalLM",Ei]],["cohere",["CohereForCausalLM",Ed]],["gemma",["GemmaForCausalLM",Cd]],["gemma2",["Gemma2ForCausalLM",$d]],["gemma3_text",["Gemma3ForCausalLM",Id]],["helium",["HeliumForCausalLM",Fo]],["glm",["GlmForCausalLM",h]],["openelm",["OpenELMForCausalLM",Fd]],["qwen2",["Qwen2ForCausalLM",Dd]],["phi",["PhiForCausalLM",Rd]],["phi3",["Phi3ForCausalLM",Nd]],["mpt",["MptForCausalLM",Gd]],["opt",["OPTForCausalLM",Hd]],["mbart",["MBartForCausalLM",Nt]],["mistral",["MistralForCausalLM",ph]],["starcoder2",["Starcoder2ForCausalLM",mh]],["falcon",["FalconForCausalLM",_h]],["trocr",["TrOCRForCausalLM",dh]],["stablelm",["StableLmForCausalLM",Th]],["phi3_v",["Phi3VForCausalLM",_o]]]),Z0=new Map([["multi_modality",["MultiModalityCausalLM",Vh]]]),fm=new Map([["bert",["BertForMaskedLM",Ae]],["modernbert",["ModernBertForMaskedLM",z]],["roformer",["RoFormerForMaskedLM",Be]],["electra",["ElectraForMaskedLM",xs]],["esm",["EsmForMaskedLM",Zs]],["convbert",["ConvBertForMaskedLM",Ot]],["camembert",["CamembertForMaskedLM",Ft]],["deberta",["DebertaForMaskedLM",Qe]],["deberta-v2",["DebertaV2ForMaskedLM",ss]],["mpnet",["MPNetForMaskedLM",rn]],["albert",["AlbertForMaskedLM",N]],["distilbert",["DistilBertForMaskedLM",Es]],["roberta",["RobertaForMaskedLM",or]],["xlm",["XLMWithLMHeadModel",cn]],["xlm-roberta",["XLMRobertaForMaskedLM",ni]],["mobilebert",["MobileBertForMaskedLM",Ps]],["squeezebert",["SqueezeBertForMaskedLM",Bs]]]),_m=new Map([["bert",["BertForQuestionAnswering",Ve]],["roformer",["RoFormerForQuestionAnswering",lt]],["electra",["ElectraForQuestionAnswering",Zr]],["convbert",["ConvBertForQuestionAnswering",gs]],["camembert",["CamembertForQuestionAnswering",bs]],["deberta",["DebertaForQuestionAnswering",Or]],["deberta-v2",["DebertaV2ForQuestionAnswering",os]],["mpnet",["MPNetForQuestionAnswering",on]],["albert",["AlbertForQuestionAnswering",k]],["distilbert",["DistilBertForQuestionAnswering",Ts]],["roberta",["RobertaForQuestionAnswering",er]],["xlm",["XLMForQuestionAnswering",ri]],["xlm-roberta",["XLMRobertaForQuestionAnswering",ai]],["mobilebert",["MobileBertForQuestionAnswering",_r]],["squeezebert",["SqueezeBertForQuestionAnswering",un]]]),vl=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",ho]],["idefics3",["Idefics3ForConditionalGeneration",Ns]],["smolvlm",["SmolVLMForConditionalGeneration",jn]]]),gm=new Map([["llava",["LlavaForConditionalGeneration",pn]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",mo]],["moondream1",["Moondream1ForConditionalGeneration",js]],["florence2",["Florence2ForConditionalGeneration",fo]],["qwen2-vl",["Qwen2VLForConditionalGeneration",zd]],["idefics3",["Idefics3ForConditionalGeneration",Ns]],["smolvlm",["SmolVLMForConditionalGeneration",jn]],["paligemma",["PaliGemmaForConditionalGeneration",_i]]]),wm=new Map([["ultravox",["UltravoxModel",Jh]]]),ev=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",ho]]]),bm=new Map([["vit",["ViTForImageClassification",Xd]],["ijepa",["IJepaForImageClassification",Jd]],["pvt",["PvtForImageClassification",tc]],["vit_msn",["ViTMSNForImageClassification",oc]],["fastvit",["FastViTForImageClassification",uc]],["mobilevit",["MobileViTForImageClassification",hc]],["mobilevitv2",["MobileViTV2ForImageClassification",fc]],["beit",["BeitForImageClassification",yc]],["deit",["DeiTForImageClassification",zc]],["hiera",["HieraForImageClassification",Rc]],["convnext",["ConvNextForImageClassification",hp]],["convnextv2",["ConvNextV2ForImageClassification",fp]],["dinov2",["Dinov2ForImageClassification",gp]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",bp]],["resnet",["ResNetForImageClassification",Nc]],["swin",["SwinForImageClassification",Uc]],["segformer",["SegformerForImageClassification",yh]],["efficientnet",["EfficientNetForImageClassification",Ph]],["mobilenet_v1",["MobileNetV1ForImageClassification",Sh]],["mobilenet_v2",["MobileNetV2ForImageClassification",Ih]],["mobilenet_v3",["MobileNetV3ForImageClassification",Oh]],["mobilenet_v4",["MobileNetV4ForImageClassification",zh]]]),Mm=new Map([["detr",["DetrForObjectDetection",xc]],["rt_detr",["RTDetrForObjectDetection",Pc]],["rt_detr_v2",["RTDetrV2ForObjectDetection",Sc]],["rf_detr",["RFDetrForObjectDetection",Ic]],["table-transformer",["TableTransformerForObjectDetection",Oc]],["yolos",["YolosForObjectDetection",xp]]]),ym=new Map([["owlvit",["OwlViTForObjectDetection",gc]],["owlv2",["Owlv2ForObjectDetection",bc]],["grounding-dino",["GroundingDinoForObjectDetection",yp]]]),Yn=new Map([["detr",["DetrForSegmentation",Va]],["clipseg",["CLIPSegForImageSegmentation",vo]]]),vm=new Map([["segformer",["SegformerForSemanticSegmentation",vh]],["sapiens",["SapiensForSemanticSegmentation",Jc]],["swin",["SwinForSemanticSegmentation",Wc]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",$h]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",Ah]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",Dh]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",Bh]]]),xm=new Map([["detr",["DetrForSegmentation",Va]],["maskformer",["MaskFormerForInstanceSegmentation",ap]]]),Tm=new Map([["sam",["SamModel",Pp]]]),Em=new Map([["wav2vec2",["Wav2Vec2ForCTC",Fp]],["wav2vec2-bert",["Wav2Vec2BertForCTC",qp]],["unispeech",["UniSpeechForCTC",Np]],["unispeech-sat",["UniSpeechSatForCTC",Wp]],["wavlm",["WavLMForCTC",eh]],["hubert",["HubertForCTC",Jp]]]),Pm=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Op]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",Xp]],["unispeech",["UniSpeechForSequenceClassification",Vp]],["unispeech-sat",["UniSpeechSatForSequenceClassification",Gp]],["wavlm",["WavLMForSequenceClassification",th]],["hubert",["HubertForSequenceClassification",Yp]],["audio-spectrogram-transformer",["ASTForAudioClassification",ui]]]),Cm=new Map([["wavlm",["WavLMForXVector",rh]]]),Sm=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",Kp]],["wavlm",["WavLMForAudioFrameClassification",sh]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",Dp]],["pyannote",["PyAnnoteForAudioFrameClassification",zp]]]),$m=new Map([["vitmatte",["VitMatteForImageMatting",cc]]]),tv=new Map([["patchtst",["PatchTSTForPrediction",Hh]],["patchtsmixer",["PatchTSMixerForPrediction",Xh]]]),km=new Map([["swin2sr",["Swin2SRForImageSuperResolution",Kc]]]),Im=new Map([["dpt",["DPTForDepthEstimation",qc]],["depth_anything",["DepthAnythingForDepthEstimation",Qc]],["glpn",["GLPNForDepthEstimation",up]],["sapiens",["SapiensForDepthEstimation",Yc]],["depth_pro",["DepthProForDepthEstimation",tp]],["metric3d",["Metric3DForDepthEstimation",sp]],["metric3dv2",["Metric3Dv2ForDepthEstimation",op]]]),Am=new Map([["sapiens",["SapiensForNormalEstimation",Zc]]]),Fm=new Map([["vitpose",["VitPoseForPoseEstimation",Zd]]]),Om=new Map([["clip",["CLIPVisionModelWithProjection",yi]],["siglip",["SiglipVisionModel",wo]],["jina_clip",["JinaCLIPVisionModel",Mo]]]),Dm=[[X0,E.EncoderOnly],[Q0,E.EncoderDecoder],[Y0,E.DecoderOnly],[J0,E.AutoEncoder],[hm,E.EncoderOnly],[mm,E.EncoderOnly],[Ml,E.Seq2Seq],[bl,E.Seq2Seq],[yl,E.DecoderOnly],[Z0,E.MultiModality],[fm,E.EncoderOnly],[_m,E.EncoderOnly],[vl,E.Vision2Seq],[gm,E.ImageTextToText],[wm,E.AudioTextToText],[bm,E.EncoderOnly],[Yn,E.EncoderOnly],[xm,E.EncoderOnly],[vm,E.EncoderOnly],[$m,E.EncoderOnly],[tv,E.EncoderOnly],[km,E.EncoderOnly],[Im,E.EncoderOnly],[Am,E.EncoderOnly],[Fm,E.EncoderOnly],[Mm,E.EncoderOnly],[ym,E.EncoderOnly],[Tm,E.MaskGeneration],[Em,E.EncoderOnly],[Pm,E.EncoderOnly],[cm,E.Seq2Seq],[pm,E.EncoderOnly],[Cm,E.EncoderOnly],[Sm,E.EncoderOnly],[Om,E.EncoderOnly]];for(const[M,P]of Dm)for(const[D,ne]of M.values())y.set(D,P),x.set(ne,D),b.set(D,ne);const rv=[["MusicgenForConditionalGeneration",_l,E.Musicgen],["Phi3VForCausalLM",_o,E.Phi3V],["CLIPTextModelWithProjection",Mi,E.EncoderOnly],["SiglipTextModel",Vs,E.EncoderOnly],["JinaCLIPTextModel",bo,E.EncoderOnly],["ClapTextModelWithProjection",wh,E.EncoderOnly],["ClapAudioModelWithProjection",bh,E.EncoderOnly],["DacEncoderModel",im,E.EncoderOnly],["DacDecoderModel",am,E.EncoderOnly],["MimiEncoderModel",tm,E.EncoderOnly],["MimiDecoderModel",rm,E.EncoderOnly],["SnacEncoderModel",um,E.EncoderOnly],["SnacDecoderModel",dm,E.EncoderOnly]];for(const[M,P,D]of rv)y.set(M,D),x.set(P,M),b.set(M,P);const Lm=new Map([["modnet",Yn],["birefnet",Yn],["isnet",Yn],["ben",Yn]]);for(const[M,P]of Lm.entries())P.set(M,["PreTrainedModel",R]),y.set(M,E.EncoderOnly),x.set(R,M),b.set(M,R);class xl extends Pt{}te(xl,"MODEL_CLASS_MAPPINGS",Dm.map(P=>P[0])),te(xl,"BASE_IF_FAIL",!0);class zm extends Pt{}te(zm,"MODEL_CLASS_MAPPINGS",[hm]);class Bm extends Pt{}te(Bm,"MODEL_CLASS_MAPPINGS",[mm]);class Rm extends Pt{}te(Rm,"MODEL_CLASS_MAPPINGS",[Ml]);class jm extends Pt{}te(jm,"MODEL_CLASS_MAPPINGS",[bl]);class Nm extends Pt{}te(Nm,"MODEL_CLASS_MAPPINGS",[cm]);class Vm extends Pt{}te(Vm,"MODEL_CLASS_MAPPINGS",[pm]);class Um extends Pt{}te(Um,"MODEL_CLASS_MAPPINGS",[yl]);class Wm extends Pt{}te(Wm,"MODEL_CLASS_MAPPINGS",[fm]);class Gm extends Pt{}te(Gm,"MODEL_CLASS_MAPPINGS",[_m]);class Km extends Pt{}te(Km,"MODEL_CLASS_MAPPINGS",[vl]);class Hm extends Pt{}te(Hm,"MODEL_CLASS_MAPPINGS",[bm]);class qm extends Pt{}te(qm,"MODEL_CLASS_MAPPINGS",[Yn]);class Xm extends Pt{}te(Xm,"MODEL_CLASS_MAPPINGS",[vm]);class Qm extends Pt{}te(Qm,"MODEL_CLASS_MAPPINGS",[xm]);class Jm extends Pt{}te(Jm,"MODEL_CLASS_MAPPINGS",[Mm]);class Ym extends Pt{}te(Ym,"MODEL_CLASS_MAPPINGS",[ym]);class Zm extends Pt{}te(Zm,"MODEL_CLASS_MAPPINGS",[Tm]);class ef extends Pt{}te(ef,"MODEL_CLASS_MAPPINGS",[Em]);class tf extends Pt{}te(tf,"MODEL_CLASS_MAPPINGS",[Pm]);class rf extends Pt{}te(rf,"MODEL_CLASS_MAPPINGS",[Cm]);class sf extends Pt{}te(sf,"MODEL_CLASS_MAPPINGS",[Sm]);class nf extends Pt{}te(nf,"MODEL_CLASS_MAPPINGS",[ev]);class of extends Pt{}te(of,"MODEL_CLASS_MAPPINGS",[$m]);class af extends Pt{}te(af,"MODEL_CLASS_MAPPINGS",[km]);class lf extends Pt{}te(lf,"MODEL_CLASS_MAPPINGS",[Im]);class uf extends Pt{}te(uf,"MODEL_CLASS_MAPPINGS",[Am]);class df extends Pt{}te(df,"MODEL_CLASS_MAPPINGS",[Fm]);class cf extends Pt{}te(cf,"MODEL_CLASS_MAPPINGS",[Om]);class pf extends Pt{}te(pf,"MODEL_CLASS_MAPPINGS",[gm]);class hf extends Pt{}te(hf,"MODEL_CLASS_MAPPINGS",[wm]);class sv extends pe{constructor({logits:P,past_key_values:D,encoder_outputs:ne,decoder_attentions:ge=null,cross_attentions:_e=null}){super(),this.logits=P,this.past_key_values=D,this.encoder_outputs=ne,this.decoder_attentions=ge,this.cross_attentions=_e}}class mt extends pe{constructor({logits:P,...D}){super(),this.logits=P;const ne=Object.values(D);ne.length>0&&(this.attentions=ne)}}class mf extends pe{constructor({logits:P,embeddings:D}){super(),this.logits=P,this.embeddings=D}}class pr extends pe{constructor({logits:P}){super(),this.logits=P}}class wr extends pe{constructor({logits:P}){super(),this.logits=P}}class Tr extends pe{constructor({start_logits:P,end_logits:D}){super(),this.start_logits=P,this.end_logits=D}}class bn extends pe{constructor({logits:P}){super(),this.logits=P}}class nv extends pe{constructor({logits:P,past_key_values:D}){super(),this.logits=P,this.past_key_values=D}}class ff extends pe{constructor({alphas:P}){super(),this.alphas=P}}class _f extends pe{constructor({waveform:P,spectrogram:D}){super(),this.waveform=P,this.spectrogram=D}}},"./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js":(e,r,t)=>{t.r(r),t.d(r,{ASTFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a);const l=this.config.sampling_rate,u=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(l/2),l,null,"kaldi",!0);this.mel_filters=u,this.window=(0,o.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(a,l){return(0,o.spectrogram)(a,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:l,transpose:!0})}async _call(a){(0,s.validate_audio_inputs)(a,"ASTFeatureExtractor");const l=await this._extract_fbank_features(a,this.config.max_length);if(this.config.do_normalize){const u=this.std*2,p=l.data;for(let d=0;d{t.r(r),t.d(r,{AutoFeatureExtractor:()=>i});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js");t("./src/base/feature_extraction_utils.js");var n=t("./src/models/feature_extractors.js");class i{static async from_pretrained(l,u={}){const p=await(0,o.getModelJSON)(l,s.FEATURE_EXTRACTOR_NAME,!0,u),d=p.feature_extractor_type,c=n[d];if(!c)throw new Error(`Unknown feature_extractor_type: '${d}'. Please report this at ${s.GITHUB_ISSUE_URL}.`);return new c(p)}}},"./src/models/auto/image_processing_auto.js":(e,r,t)=>{t.r(r),t.d(r,{AutoImageProcessor:()=>a});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js"),n=t("./src/base/image_processors_utils.js"),i=t("./src/models/image_processors.js");class a{static async from_pretrained(u,p={}){const d=await(0,o.getModelJSON)(u,s.IMAGE_PROCESSOR_NAME,!0,p),c=d.image_processor_type??d.feature_extractor_type;let _=i[c];return _||(c!==void 0&&console.warn(`Image processor type '${c}' not found, assuming base ImageProcessor. Please report this at ${s.GITHUB_ISSUE_URL}.`),_=n.ImageProcessor),new _(d)}}},"./src/models/auto/processing_auto.js":(e,r,t)=>{t.r(r),t.d(r,{AutoProcessor:()=>u});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js"),n=t("./src/base/processing_utils.js"),i=t("./src/models/processors.js"),a=t("./src/models/image_processors.js"),l=t("./src/models/feature_extractors.js");class u{static async from_pretrained(d,c={}){const _=await(0,o.getModelJSON)(d,s.IMAGE_PROCESSOR_NAME,!0,c),{image_processor_type:f,feature_extractor_type:v,processor_class:$}=_;if($&&i[$])return i[$].from_pretrained(d,c);if(!f&&!v)throw new Error("No `image_processor_type` or `feature_extractor_type` found in the config.");const w={};if(f){const C=a[f];if(!C)throw new Error(`Unknown image_processor_type: '${f}'.`);w.image_processor=new C(_)}if(v){const C=a[v];if(C)w.image_processor=new C(_);else{const E=l[v];if(!E)throw new Error(`Unknown feature_extractor_type: '${v}'.`);w.feature_extractor=new E(_)}}const g={};return new n.Processor(g,w)}}},"./src/models/beit/image_processing_beit.js":(e,r,t)=>{t.r(r),t.d(r,{BeitFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/bit/image_processing_bit.js":(e,r,t)=>{t.r(r),t.d(r,{BitImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,r,t)=>{t.r(r),t.d(r,{ChineseCLIPFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/clap/feature_extraction_clap.js":(e,r,t)=>{t.r(r),t.d(r,{ClapFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a),this.mel_filters=(0,o.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=(0,o.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=(0,o.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(a,l,u,p){let d;const c=a.length-l;if(c>0)if(u==="rand_trunc"){const _=Math.floor(Math.random()*(c+1));a=a.subarray(_,_+l),d=await this._extract_fbank_features(a,this.mel_filters_slaney,this.config.nb_max_samples)}else throw new Error(`Truncation strategy "${u}" not implemented`);else{if(c<0){let _=new Float64Array(l);if(_.set(a),p==="repeat")for(let f=a.length;f{t.r(r),t.d(r,{CLIPFeatureExtractor:()=>n,CLIPImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/convnext/image_processing_convnext.js":(e,r,t)=>{t.r(r),t.d(r,{ConvNextFeatureExtractor:()=>n,ConvNextImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(a){super(a),this.crop_pct=this.config.crop_pct??224/256}async resize(a){var u;const l=(u=this.size)==null?void 0:u.shortest_edge;if(l===void 0)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(l<384){const p=Math.floor(l/this.crop_pct),[d,c]=this.get_resize_output_image_size(a,{shortest_edge:p});a=await a.resize(d,c,{resample:this.resample}),a=await a.center_crop(l,l)}else a=await a.resize(l,l,{resample:this.resample});return a}}class n extends o{}},"./src/models/dac/feature_extraction_dac.js":(e,r,t)=>{t.r(r),t.d(r,{DacFeatureExtractor:()=>o});var s=t("./src/models/encodec/feature_extraction_encodec.js");class o extends s.EncodecFeatureExtractor{}},"./src/models/deit/image_processing_deit.js":(e,r,t)=>{t.r(r),t.d(r,{DeiTFeatureExtractor:()=>n,DeiTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/detr/image_processing_detr.js":(e,r,t)=>{t.r(r),t.d(r,{DetrFeatureExtractor:()=>i,DetrImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(l){const u=await super._call(l),p=[u.pixel_values.dims[0],64,64],d=(0,o.full)(p,1n);return{...u,pixel_mask:d}}post_process_object_detection(...l){return(0,s.post_process_object_detection)(...l)}post_process_panoptic_segmentation(...l){return(0,s.post_process_panoptic_segmentation)(...l)}post_process_instance_segmentation(...l){return(0,s.post_process_instance_segmentation)(...l)}}class i extends n{}},"./src/models/donut/image_processing_donut.js":(e,r,t)=>{t.r(r),t.d(r,{DonutFeatureExtractor:()=>n,DonutImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(a,l,u,p={}){const[d,c,_]=l;let f=this.image_mean;Array.isArray(this.image_mean)||(f=new Array(_).fill(f));let v=this.image_std;Array.isArray(v)||(v=new Array(_).fill(f));const $=f.map((w,g)=>-w/v[g]);return super.pad_image(a,l,u,{center:!0,constant_values:$,...p})}}class n extends o{}},"./src/models/dpt/image_processing_dpt.js":(e,r,t)=>{t.r(r),t.d(r,{DPTFeatureExtractor:()=>n,DPTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/efficientnet/image_processing_efficientnet.js":(e,r,t)=>{t.r(r),t.d(r,{EfficientNetImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){super(i),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(a=>a*a))}}},"./src/models/encodec/feature_extraction_encodec.js":(e,r,t)=>{t.r(r),t.d(r,{EncodecFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(a){(0,s.validate_audio_inputs)(a,"EncodecFeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));const l=this.config.feature_size;if(a.length%l!==0)throw new Error(`The length of the audio data must be a multiple of the number of channels (${l}).`);const u=[1,l,a.length/l];return{input_values:new o.Tensor("float32",a,u)}}}},"./src/models/feature_extractors.js":(e,r,t)=>{t.r(r),t.d(r,{ASTFeatureExtractor:()=>s.ASTFeatureExtractor,ClapFeatureExtractor:()=>n.ClapFeatureExtractor,DacFeatureExtractor:()=>i.DacFeatureExtractor,EncodecFeatureExtractor:()=>o.EncodecFeatureExtractor,ImageFeatureExtractor:()=>v.ImageProcessor,MoonshineFeatureExtractor:()=>a.MoonshineFeatureExtractor,PyAnnoteFeatureExtractor:()=>l.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>u.SeamlessM4TFeatureExtractor,SnacFeatureExtractor:()=>p.SnacFeatureExtractor,SpeechT5FeatureExtractor:()=>d.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>c.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>_.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>f.WhisperFeatureExtractor});var s=t("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),o=t("./src/models/encodec/feature_extraction_encodec.js"),n=t("./src/models/clap/feature_extraction_clap.js"),i=t("./src/models/dac/feature_extraction_dac.js"),a=t("./src/models/moonshine/feature_extraction_moonshine.js"),l=t("./src/models/pyannote/feature_extraction_pyannote.js"),u=t("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),p=t("./src/models/snac/feature_extraction_snac.js"),d=t("./src/models/speecht5/feature_extraction_speecht5.js"),c=t("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),_=t("./src/models/wespeaker/feature_extraction_wespeaker.js"),f=t("./src/models/whisper/feature_extraction_whisper.js"),v=t("./src/base/image_processors_utils.js")},"./src/models/florence2/processing_florence2.js":(e,r,t)=>{t.r(r),t.d(r,{Florence2Processor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{constructor(l,u){super(l,u);const{tasks_answer_post_processing_type:p,task_prompts_without_inputs:d,task_prompts_with_input:c}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(p??{})),this.task_prompts_without_inputs=new Map(Object.entries(d??{})),this.task_prompts_with_input=new Map(Object.entries(c??{})),this.regexes={quad_boxes:/(.+?)/gm,bboxes:/([^<]+)?/gm},this.size_per_bin=1e3}construct_prompts(l){typeof l=="string"&&(l=[l]);const u=[];for(const p of l)if(this.task_prompts_without_inputs.has(p))u.push(this.task_prompts_without_inputs.get(p));else{for(const[d,c]of this.task_prompts_with_input)if(p.includes(d)){u.push(c.replaceAll("{input}",p).replaceAll(d,""));break}u.length!==l.length&&u.push(p)}return u}post_process_generation(l,u,p){const d=this.tasks_answer_post_processing_type.get(u)??"pure_text";l=l.replaceAll("","").replaceAll("","");let c;switch(d){case"pure_text":c=l;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const _=d==="ocr"?"quad_boxes":"bboxes",f=l.matchAll(this.regexes[_]),v=[],$=[];for(const[w,g,...C]of f)v.push(g?g.trim():v.at(-1)??""),$.push(C.map((E,y)=>(Number(E)+.5)/this.size_per_bin*p[y%2]));c={labels:v,[_]:$};break;default:throw new Error(`Task "${u}" (of type "${d}") not yet implemented.`)}return{[u]:c}}async _call(l,u=null,p={}){if(!l&&!u)throw new Error("Either text or images must be provided");const d=await this.image_processor(l,p),c=u?this.tokenizer(u,p):{};return{...d,...c}}}te(i,"tokenizer_class",n.AutoTokenizer),te(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/glpn/image_processing_glpn.js":(e,r,t)=>{t.r(r),t.d(r,{GLPNFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,r,t)=>{t.r(r),t.d(r,{GroundingDinoImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a){const l=await super._call(a),u=l.pixel_values.dims,p=(0,o.ones)([u[0],u[2],u[3]]);return{...l,pixel_mask:p}}}},"./src/models/grounding_dino/processing_grounding_dino.js":(e,r,t)=>{t.r(r),t.d(r,{GroundingDinoProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/base/image_processors_utils.js");function a(u,p){const c=u.dims.at(-1)-1,_=u.tolist();_.fill(!1,0,1),_.fill(!1,c);const f=p.tolist();return _.map((v,$)=>v?$:null).filter(v=>v!==null).map(v=>f[v])}class l extends s.Processor{async _call(p,d,c={}){const _=p?await this.image_processor(p,c):{};return{...d?this.tokenizer(d,c):{},..._}}post_process_grounded_object_detection(p,d,{box_threshold:c=.25,text_threshold:_=.25,target_sizes:f=null}={}){const{logits:v,pred_boxes:$}=p,w=v.dims[0];if(f!==null&&f.length!==w)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const g=v.dims.at(1),C=v.sigmoid(),E=C.max(-1).tolist(),y=$.tolist().map(x=>x.map(S=>(0,i.center_to_corners_format)(S))),b=[];for(let x=0;xj.map((ee,H)=>ee*S[(H+1)%2])));const A=E[x],B=[],K=[],G=[];for(let j=0;j{t.r(r),t.d(r,{Idefics3ImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{constructor(a){super(a),this.do_image_splitting=a.do_image_splitting??!0,this.max_image_size=a.max_image_size}get_resize_for_vision_encoder(a,l){let[u,p]=a.dims.slice(-2);const d=p/u;return p>=u?(p=Math.ceil(p/l)*l,u=Math.floor(p/d),u=Math.ceil(u/l)*l):(u=Math.ceil(u/l)*l,p=Math.floor(u*d),p=Math.ceil(p/l)*l),{height:u,width:p}}async _call(a,{do_image_splitting:l=null,return_row_col_info:u=!1}={}){let p;if(!Array.isArray(a))p=[[a]];else{if(a.length===0||!a[0])throw new Error("No images provided.");Array.isArray(a[0])?p=a:p=[a]}let d=[],c=[],_=[];const f=[],v=[];for(const x of p){let S=await Promise.all(x.map(K=>this.preprocess(K)));f.push(...S.map(K=>K.original_size)),v.push(...S.map(K=>K.reshaped_input_size)),S.forEach(K=>K.pixel_values.unsqueeze_(0));const{longest_edge:A}=this.max_image_size;let B;if(l??this.do_image_splitting){let K=new Array(S.length),G=new Array(S.length);B=await Promise.all(S.map(async(j,ee)=>{const H=this.get_resize_for_vision_encoder(j.pixel_values,A),Z=await(0,o.interpolate_4d)(j.pixel_values,{size:[H.height,H.width]}),{frames:X,num_splits_h:oe,num_splits_w:me}=await this.split_image(Z,this.max_image_size);return K[ee]=oe,G[ee]=me,(0,o.cat)(X,0)})),c.push(K),_.push(G)}else{const K=[A,A];B=await Promise.all(S.map(G=>(0,o.interpolate_4d)(G.pixel_values,{size:K}))),c.push(new Array(S.length).fill(0)),_.push(new Array(S.length).fill(0))}d.push((0,o.cat)(B,0))}const $=d.length,[w,g,C,E]=d[0].dims;let y,b;if($===1)y=d[0].unsqueeze_(0),b=(0,o.full)([$,w,C,E],!0);else{const x=Math.max(...d.map(B=>B.dims.at(0)));b=(0,o.full)([$,x,C,E],!0);const S=b.data,A=x*C*E;for(let B=0;B<$;++B){const K=d[B].dims[0];if(Ku||_>p){f=Math.ceil(c/u),v=Math.ceil(_/p);const $=Math.ceil(c/f),w=Math.ceil(_/v);for(let E=0;E{t.r(r),t.d(r,{Idefics3Processor:()=>p});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");var i=t("./src/utils/core.js");function a(d,c,_,f,v,$){let w="";for(let g=0;g`+v.repeat(d);w+=` +`}return w+=` +${f}${$}`+v.repeat(d)+`${f}`,w}function l(d,c,_,f){return`${c}${f}`+_.repeat(d)+`${c}`}function u(d,c,_,f,v,$){return d===0&&c===0?l(_,f,v,$):a(_,d,c,f,v,$)}class p extends s.Processor{constructor(){super(...arguments);te(this,"fake_image_token","");te(this,"image_token","");te(this,"global_img_token","")}async _call(_,f=null,v={}){v.return_row_col_info??(v.return_row_col_info=!0);let $;f&&($=await this.image_processor(f,v)),Array.isArray(_)||(_=[_]);const w=$.rows??[new Array(_.length).fill(0)],g=$.cols??[new Array(_.length).fill(0)],C=this.config.image_seq_len,E=[],y=[];for(let x=0;x<_.length;++x){const S=_[x],A=w[x],B=g[x];E.push((0,i.count)(S,this.image_token));const K=A.map((ee,H)=>u(ee,B[H],C,this.fake_image_token,this.image_token,this.global_img_token)),G=S.split(this.image_token);if(G.length===0)throw new Error("The image token should be present in the text.");let j=G[0];for(let ee=0;ee{t.r(r),t.d(r,{BeitFeatureExtractor:()=>s.BeitFeatureExtractor,BitImageProcessor:()=>o.BitImageProcessor,CLIPFeatureExtractor:()=>i.CLIPFeatureExtractor,CLIPImageProcessor:()=>i.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>n.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>a.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>a.ConvNextImageProcessor,DPTFeatureExtractor:()=>d.DPTFeatureExtractor,DPTImageProcessor:()=>d.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>u.DetrFeatureExtractor,DetrImageProcessor:()=>u.DetrImageProcessor,DonutFeatureExtractor:()=>p.DonutFeatureExtractor,DonutImageProcessor:()=>p.DonutImageProcessor,EfficientNetImageProcessor:()=>c.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>_.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>f.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>v.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>w.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>g.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>C.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>E.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>E.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>y.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>y.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>b.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>b.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>x.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>x.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>S.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>S.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>A.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>A.MobileViTImageProcessor,NougatImageProcessor:()=>B.NougatImageProcessor,OwlViTFeatureExtractor:()=>G.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>G.OwlViTImageProcessor,Owlv2ImageProcessor:()=>K.Owlv2ImageProcessor,Phi3VImageProcessor:()=>j.Phi3VImageProcessor,PvtImageProcessor:()=>ee.PvtImageProcessor,Qwen2VLImageProcessor:()=>H.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>Z.RTDetrImageProcessor,SamImageProcessor:()=>X.SamImageProcessor,SegformerFeatureExtractor:()=>oe.SegformerFeatureExtractor,SegformerImageProcessor:()=>oe.SegformerImageProcessor,SiglipImageProcessor:()=>me.SiglipImageProcessor,SmolVLMImageProcessor:()=>ae.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>V.Swin2SRImageProcessor,VLMImageProcessor:()=>$.VLMImageProcessor,ViTFeatureExtractor:()=>F.ViTFeatureExtractor,ViTImageProcessor:()=>F.ViTImageProcessor,VitMatteImageProcessor:()=>W.VitMatteImageProcessor,VitPoseImageProcessor:()=>re.VitPoseImageProcessor,YolosFeatureExtractor:()=>fe.YolosFeatureExtractor,YolosImageProcessor:()=>fe.YolosImageProcessor});var s=t("./src/models/beit/image_processing_beit.js"),o=t("./src/models/bit/image_processing_bit.js"),n=t("./src/models/chinese_clip/image_processing_chinese_clip.js"),i=t("./src/models/clip/image_processing_clip.js"),a=t("./src/models/convnext/image_processing_convnext.js"),l=t("./src/models/deit/image_processing_deit.js"),u=t("./src/models/detr/image_processing_detr.js"),p=t("./src/models/donut/image_processing_donut.js"),d=t("./src/models/dpt/image_processing_dpt.js"),c=t("./src/models/efficientnet/image_processing_efficientnet.js"),_=t("./src/models/glpn/image_processing_glpn.js"),f=t("./src/models/grounding_dino/image_processing_grounding_dino.js"),v=t("./src/models/idefics3/image_processing_idefics3.js"),$=t("./src/models/janus/image_processing_janus.js"),w=t("./src/models/jina_clip/image_processing_jina_clip.js"),g=t("./src/models/llava_onevision/image_processing_llava_onevision.js"),C=t("./src/models/mask2former/image_processing_mask2former.js"),E=t("./src/models/maskformer/image_processing_maskformer.js"),y=t("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),b=t("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),x=t("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),S=t("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),A=t("./src/models/mobilevit/image_processing_mobilevit.js"),B=t("./src/models/nougat/image_processing_nougat.js"),K=t("./src/models/owlv2/image_processing_owlv2.js"),G=t("./src/models/owlvit/image_processing_owlvit.js"),j=t("./src/models/phi3_v/image_processing_phi3_v.js"),ee=t("./src/models/pvt/image_processing_pvt.js"),H=t("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),Z=t("./src/models/rt_detr/image_processing_rt_detr.js"),X=t("./src/models/sam/image_processing_sam.js"),oe=t("./src/models/segformer/image_processing_segformer.js"),me=t("./src/models/siglip/image_processing_siglip.js"),ae=t("./src/models/smolvlm/image_processing_smolvlm.js"),V=t("./src/models/swin2sr/image_processing_swin2sr.js"),F=t("./src/models/vit/image_processing_vit.js"),W=t("./src/models/vitmatte/image_processing_vitmatte.js"),re=t("./src/models/vitpose/image_processing_vitpose.js"),fe=t("./src/models/yolos/image_processing_yolos.js")},"./src/models/janus/image_processing_janus.js":(e,r,t)=>{t.r(r),t.d(r,{VLMImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){super({do_pad:!0,pad_size:{width:i.image_size,height:i.image_size},...i}),this.constant_values=this.config.background_color.map(a=>a*this.rescale_factor)}pad_image(i,a,l,u){return super.pad_image(i,a,l,{constant_values:this.constant_values,center:!0,...u})}}},"./src/models/janus/processing_janus.js":(e,r,t)=>{t.r(r),t.d(r,{VLChatProcessor:()=>u});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/utils/core.js"),a=t("./src/utils/tensor.js"),l=t("./src/utils/image.js");class u extends s.Processor{constructor(d,c){super(d,c),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(d,{images:c=null,chat_template:_="default"}={}){c?Array.isArray(c)||(c=[c]):c=await Promise.all(d.filter(B=>B.images).flatMap(B=>B.images).map(B=>l.RawImage.read(B)));const f=this.tokenizer,v=f.apply_chat_template(d,{tokenize:!1,add_generation_prompt:!0,chat_template:_}),$=B=>f.encode(B,{add_special_tokens:!1}),w=v.split(this.image_tag),g=w.length-1;if(c.length!==g)throw new Error(`Number of images provided (${c.length}) does not match number of "${this.image_tag}" image tags (${g})`);const[C,E,y]=f.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]);let b=$(w[0]),x=new Array(b.length).fill(!1);for(let B=1;B0){const B=await this.image_processor(c);return B.pixel_values.unsqueeze_(0),{...A,...B}}return A}}te(u,"image_processor_class",o.AutoImageProcessor),te(u,"tokenizer_class",n.AutoTokenizer),te(u,"uses_processor_config",!0)},"./src/models/jina_clip/image_processing_jina_clip.js":(e,r,t)=>{t.r(r),t.d(r,{JinaCLIPImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){const{resize_mode:a,fill_color:l,interpolation:u,size:p,...d}=i,c=a==="squash"?{width:p,height:p}:a==="shortest"?{shortest_edge:p}:{longest_edge:p},_=u==="bicubic"?3:2;super({...d,size:c,resample:_,do_center_crop:!0,crop_size:p,do_normalize:!0})}}},"./src/models/jina_clip/processing_jina_clip.js":(e,r,t)=>{t.r(r),t.d(r,{JinaCLIPProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{async _call(l=null,u=null,p={}){if(!l&&!u)throw new Error("Either text or images must be provided");const d=l?this.tokenizer(l,p):{},c=u?await this.image_processor(u,p):{};return{...d,...c}}}te(i,"tokenizer_class",n.AutoTokenizer),te(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/llava_onevision/image_processing_llava_onevision.js":(e,r,t)=>{t.r(r),t.d(r,{LlavaOnevisionImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/mask2former/image_processing_mask2former.js":(e,r,t)=>{t.r(r),t.d(r,{Mask2FormerImageProcessor:()=>o});var s=t("./src/models/maskformer/image_processing_maskformer.js");class o extends s.MaskFormerImageProcessor{}},"./src/models/maskformer/image_processing_maskformer.js":(e,r,t)=>{t.r(r),t.d(r,{MaskFormerFeatureExtractor:()=>n,MaskFormerImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_panoptic_segmentation(...a){return(0,s.post_process_panoptic_segmentation)(...a)}post_process_instance_segmentation(...a){return(0,s.post_process_instance_segmentation)(...a)}}class n extends o{}},"./src/models/mgp_str/processing_mgp_str.js":(e,r,t)=>{t.r(r),t.d(r,{MgpstrProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/utils/maths.js");const a={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends s.Processor{get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(p,d){if(!a.hasOwnProperty(d))throw new Error(`Format ${d} is not supported.`);const[c,_]=a[d],f=this[c].bind(this),[v,$]=p.dims,w=[],g=[],C=p.tolist();for(let y=0;y0?S.reduce((B,K)=>B*K,1):0;g.push(x),w.push(A)}return[f(g),w]}char_decode(p){return this.char_tokenizer.batch_decode(p).map(d=>d.replaceAll(" ",""))}bpe_decode(p){return this.bpe_tokenizer.batch_decode(p)}wp_decode(p){return this.wp_tokenizer.batch_decode(p).map(d=>d.replaceAll(" ",""))}batch_decode([p,d,c]){const[_,f]=this._decode_helper(p,"char"),[v,$]=this._decode_helper(d,"bpe"),[w,g]=this._decode_helper(c,"wp"),C=[],E=[];for(let y=0;y<_.length;++y){const[b,x]=(0,i.max)([f[y],$[y],g[y]]);C.push([_[y],v[y],w[y]][x]),E.push(b)}return{generated_text:C,scores:E,char_preds:_,bpe_preds:v,wp_preds:w}}static async from_pretrained(...p){const d=await super.from_pretrained(...p),c=await n.AutoTokenizer.from_pretrained("Xenova/gpt2"),_=await n.AutoTokenizer.from_pretrained("Xenova/bert-base-uncased");return d.components={image_processor:d.image_processor,char_tokenizer:d.tokenizer,bpe_tokenizer:c,wp_tokenizer:_},d}async _call(p,d=null){const c=await this.image_processor(p);return d&&(c.labels=this.tokenizer(d).input_ids),c}}te(l,"tokenizer_class",n.AutoTokenizer),te(l,"image_processor_class",o.AutoImageProcessor)},"./src/models/mobilenet_v1/image_processing_mobilenet_v1.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV1FeatureExtractor:()=>n,MobileNetV1ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV2FeatureExtractor:()=>n,MobileNetV2ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV3FeatureExtractor:()=>n,MobileNetV3ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV4FeatureExtractor:()=>n,MobileNetV4ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilevit/image_processing_mobilevit.js":(e,r,t)=>{t.r(r),t.d(r,{MobileViTFeatureExtractor:()=>n,MobileViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/moonshine/feature_extraction_moonshine.js":(e,r,t)=>{t.r(r),t.d(r,{MoonshineFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(a){(0,s.validate_audio_inputs)(a,"MoonshineFeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));const l=[1,a.length];return{input_values:new o.Tensor("float32",a,l)}}}},"./src/models/moonshine/processing_moonshine.js":(e,r,t)=>{t.r(r),t.d(r,{MoonshineProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",o.AutoTokenizer),te(i,"feature_extractor_class",s.AutoFeatureExtractor)},"./src/models/nougat/image_processing_nougat.js":(e,r,t)=>{t.r(r),t.d(r,{NougatImageProcessor:()=>o});var s=t("./src/models/donut/image_processing_donut.js");class o extends s.DonutImageProcessor{}},"./src/models/owlv2/image_processing_owlv2.js":(e,r,t)=>{t.r(r),t.d(r,{Owlv2ImageProcessor:()=>o});var s=t("./src/models/owlvit/image_processing_owlvit.js");class o extends s.OwlViTImageProcessor{}},"./src/models/owlvit/image_processing_owlvit.js":(e,r,t)=>{t.r(r),t.d(r,{OwlViTFeatureExtractor:()=>n,OwlViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...a){return(0,s.post_process_object_detection)(...a)}}class n extends o{}},"./src/models/owlvit/processing_owlvit.js":(e,r,t)=>{t.r(r),t.d(r,{OwlViTProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{}te(i,"tokenizer_class",n.AutoTokenizer),te(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/paligemma/processing_paligemma.js":(e,r,t)=>{t.r(r),t.d(r,{PaliGemmaProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");const i="";function a(u,p,d,c,_){return`${c.repeat(d*_)}${p}${u} +`}class l extends s.Processor{async _call(p,d=null,c={}){d||(console.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),d=""),Array.isArray(p)||(p=[p]),Array.isArray(d)||(d=[d]);const _=this.tokenizer.bos_token,f=this.image_processor.config.image_seq_length;let v;d.some(g=>g.includes(i))?v=d.map(g=>{const C=g.replaceAll(i,i.repeat(f)),E=C.lastIndexOf(i),y=E===-1?0:E+i.length;return C.slice(0,y)+_+C.slice(y)+` +`}):(console.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),v=d.map(g=>a(g,_,f,i,p.length)));const $=this.tokenizer(v,c);return{...await this.image_processor(p,c),...$}}}te(l,"tokenizer_class",n.AutoTokenizer),te(l,"image_processor_class",o.AutoImageProcessor),te(l,"uses_processor_config",!1)},"./src/models/phi3_v/image_processing_phi3_v.js":(e,r,t)=>{t.r(r),t.d(r,{Phi3VImageProcessor:()=>p});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");const n=336,i=[2,3],{ceil:a,floor:l,sqrt:u}=Math;class p extends s.ImageProcessor{constructor(c){super({...c,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=c.num_crops}calc_num_image_tokens_from_image_size(c,_){const{num_img_tokens:f}=this.config;return l((l(_/n)*l(c/n)+1)*f+1+(l(_/n)+1)*u(f))}get_resize_output_image_size(c,_){const f=this._num_crops,[v,$]=c.size;let w=v/$,g=1;for(;g*Math.ceil(g/w)<=f;)g+=1;g-=1;const C=Math.floor(g*336),E=Math.floor(C/w);return[C,E]}pad_image(c,_,f,v={}){const[$,w]=_,g=n*a($/n),C=n*a(w/n),E=[1,1,1].map((y,b)=>(y-this.image_mean[b])/this.image_std[b]);return super.pad_image(c,_,{width:C,height:g},{center:!0,constant_values:E,...v})}async _call(c,{num_crops:_=null}={}){if(this._num_crops=_??(_=this.config.num_crops),_<4||u(_)%1!==0)throw new Error("num_crops must be a square number >= 4");Array.isArray(c)||(c=[c]);const f=c.length,v=await Promise.all(c.map(x=>this.preprocess(x))),$=v.map(x=>x.original_size),w=v.map(x=>x.reshaped_input_size),g=[];for(const{pixel_values:x}of v){x.unsqueeze_(0);const[S,A]=x.dims.slice(-2),B=await(0,o.interpolate_4d)(x,{size:[n,n],mode:"bicubic"});if(_>0){const K=[],G=u(_),j=l(A/G),ee=l(S/G);for(let Z=0;Zx.map(S=>n*a(S/n))),y=new o.Tensor("int64",E.flat(),[f,2]),b=E.map(([x,S])=>this.calc_num_image_tokens_from_image_size(S,x));return{pixel_values:C,original_sizes:$,reshaped_input_sizes:w,image_sizes:y,num_img_tokens:b}}}},"./src/models/phi3_v/processing_phi3_v.js":(e,r,t)=>{t.r(r),t.d(r,{Phi3VProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");const i="<|image|>",a=/<\|image_\d+\|>/g;class l extends s.Processor{async _call(p,d=null,{padding:c=!0,truncation:_=!0,num_crops:f=null}={}){Array.isArray(p)||(p=[p]);let v,$;if(d){$=await this.image_processor(d,{num_crops:f});const{num_img_tokens:w}=$,g=p.map((E,y)=>E.split(a).join(i.repeat(w[y])));v=this.tokenizer(g,{padding:c,truncation:_});const C=this.tokenizer.model.convert_tokens_to_ids([i])[0];v.input_ids.map_(E=>E==C?-E:E)}else v=this.tokenizer(p);return{...v,...$}}}te(l,"image_processor_class",o.AutoImageProcessor),te(l,"tokenizer_class",n.AutoTokenizer)},"./src/models/processors.js":(e,r,t)=>{t.r(r),t.d(r,{Florence2Processor:()=>s.Florence2Processor,GroundingDinoProcessor:()=>o.GroundingDinoProcessor,Idefics3Processor:()=>n.Idefics3Processor,JinaCLIPProcessor:()=>a.JinaCLIPProcessor,MgpstrProcessor:()=>l.MgpstrProcessor,MoonshineProcessor:()=>u.MoonshineProcessor,OwlViTProcessor:()=>p.OwlViTProcessor,PaliGemmaProcessor:()=>c.PaliGemmaProcessor,Phi3VProcessor:()=>d.Phi3VProcessor,PyAnnoteProcessor:()=>_.PyAnnoteProcessor,Qwen2VLProcessor:()=>f.Qwen2VLProcessor,SamProcessor:()=>v.SamProcessor,SmolVLMProcessor:()=>$.SmolVLMProcessor,SpeechT5Processor:()=>w.SpeechT5Processor,UltravoxProcessor:()=>g.UltravoxProcessor,VLChatProcessor:()=>i.VLChatProcessor,Wav2Vec2Processor:()=>C.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>E.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>y.WhisperProcessor});var s=t("./src/models/florence2/processing_florence2.js"),o=t("./src/models/grounding_dino/processing_grounding_dino.js"),n=t("./src/models/idefics3/processing_idefics3.js"),i=t("./src/models/janus/processing_janus.js"),a=t("./src/models/jina_clip/processing_jina_clip.js"),l=t("./src/models/mgp_str/processing_mgp_str.js"),u=t("./src/models/moonshine/processing_moonshine.js"),p=t("./src/models/owlvit/processing_owlvit.js"),d=t("./src/models/phi3_v/processing_phi3_v.js"),c=t("./src/models/paligemma/processing_paligemma.js"),_=t("./src/models/pyannote/processing_pyannote.js"),f=t("./src/models/qwen2_vl/processing_qwen2_vl.js"),v=t("./src/models/sam/processing_sam.js"),$=t("./src/models/smolvlm/processing_smolvlm.js"),w=t("./src/models/speecht5/processing_speecht5.js"),g=t("./src/models/ultravox/processing_ultravox.js"),C=t("./src/models/wav2vec2/processing_wav2vec2.js"),E=t("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),y=t("./src/models/whisper/processing_whisper.js")},"./src/models/pvt/image_processing_pvt.js":(e,r,t)=>{t.r(r),t.d(r,{PvtImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/pyannote/feature_extraction_pyannote.js":(e,r,t)=>{t.r(r),t.d(r,{PyAnnoteFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");class i extends s.FeatureExtractor{async _call(l){(0,s.validate_audio_inputs)(l,"PyAnnoteFeatureExtractor"),l instanceof Float64Array&&(l=new Float32Array(l));const u=[1,1,l.length];return{input_values:new o.Tensor("float32",l,u)}}samples_to_frames(l){return(l-this.config.offset)/this.config.step}post_process_speaker_diarization(l,u){const p=u/this.samples_to_frames(u)/this.config.sampling_rate,d=[];for(const c of l.tolist()){const _=[];let f=-1;for(let v=0;v({id:v,start:$*p,end:w*p,confidence:g/(w-$)})))}return d}}},"./src/models/pyannote/processing_pyannote.js":(e,r,t)=>{t.r(r),t.d(r,{PyAnnoteProcessor:()=>n});var s=t("./src/base/processing_utils.js"),o=t("./src/models/pyannote/feature_extraction_pyannote.js");class n extends s.Processor{async _call(a){return await this.feature_extractor(a)}post_process_speaker_diarization(...a){return this.feature_extractor.post_process_speaker_diarization(...a)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}}te(n,"feature_extractor_class",o.PyAnnoteFeatureExtractor)},"./src/models/qwen2_vl/image_processing_qwen2_vl.js":(e,r,t)=>{t.r(r),t.d(r,{Qwen2VLImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a,...l){const{pixel_values:u,original_sizes:p,reshaped_input_sizes:d}=await super._call(a,...l);let c=u;const{temporal_patch_size:_,merge_size:f,patch_size:v}=this.config;c.dims[0]===1&&(c=(0,o.cat)(Array.from({length:_},()=>c),0));const $=c.dims[0]/_,w=c.dims[1],g=Math.floor(c.dims[2]/v),C=Math.floor(c.dims[3]/v),E=c.view($,_,w,Math.floor(g/f),f,v,Math.floor(C/f),f,v).permute(0,3,6,4,7,2,1,5,8).view($*g*C,w*_*v*v),y=new o.Tensor("int64",[$,g,C],[1,3]);return{pixel_values:E,image_grid_thw:y,original_sizes:p,reshaped_input_sizes:d}}}},"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,r,t)=>{t.r(r),t.d(r,{Qwen2VLProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");class i extends s.Processor{async _call(l,u=null,...p){Array.isArray(l)||(l=[l]);let d,c;if(u&&(d=await this.image_processor(u),c=d.image_grid_thw),c){let f=this.image_processor.config.merge_size**2,v=0;const $=c.tolist();l=l.map(w=>{for(;w.includes("<|image_pad|>");){const g=Number($[v++].reduce((C,E)=>C*E,1n));w=w.replace("<|image_pad|>","<|placeholder|>".repeat(Math.floor(g/f)))}return w.replaceAll("<|placeholder|>","<|image_pad|>")})}return{...this.tokenizer(l),...d}}}te(i,"image_processor_class",o.AutoImageProcessor),te(i,"tokenizer_class",n.AutoTokenizer)},"./src/models/rt_detr/image_processing_rt_detr.js":(e,r,t)=>{t.r(r),t.d(r,{RTDetrImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...i){return(0,s.post_process_object_detection)(...i)}}},"./src/models/sam/image_processing_sam.js":(e,r,t)=>{t.r(r),t.d(r,{SamImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/core.js"),n=t("./src/utils/tensor.js");class i extends s.ImageProcessor{reshape_input_points(l,u,p,d=!1){l=structuredClone(l);let c=(0,o.calculateDimensions)(l);if(c.length===3)d||(c=[1,...c]),l=[l];else if(c.length!==4)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let _=0;_d!==u.dims[c]))throw Error(`The first ${p.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new n.Tensor("int64",l.flat(1/0).map(BigInt),p)}async _call(l,{input_points:u=null,input_labels:p=null,input_boxes:d=null}={}){const c=await super._call(l);if(u&&(c.input_points=this.reshape_input_points(u,c.original_sizes,c.reshaped_input_sizes)),p){if(!c.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");c.input_labels=this.add_input_labels(p,c.input_points)}return d&&(c.input_boxes=this.reshape_input_points(d,c.original_sizes,c.reshaped_input_sizes,!0)),c}async post_process_masks(l,u,p,{mask_threshold:d=0,binarize:c=!0,pad_size:_=null}={}){const f=[];_=_??this.pad_size;const v=[_.height,_.width];for(let $=0;$d&&(y[b]=1);C=new n.Tensor("bool",y,C.dims)}f.push(C)}return f}generate_crop_boxes(l,u,{crop_n_layers:p=0,overlap_ratio:d=512/1500,points_per_crop:c=32,crop_n_points_downscale_factor:_=1}={}){}}},"./src/models/sam/processing_sam.js":(e,r,t)=>{t.r(r),t.d(r,{SamProcessor:()=>n});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js");class n extends s.Processor{async _call(...a){return await this.image_processor(...a)}post_process_masks(...a){return this.image_processor.post_process_masks(...a)}reshape_input_points(...a){return this.image_processor.reshape_input_points(...a)}}te(n,"image_processor_class",o.AutoImageProcessor)},"./src/models/seamless_m4t/feature_extraction_seamless_m4t.js":(e,r,t)=>{t.r(r),t.d(r,{SeamlessM4TFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/audio.js");class i extends s.FeatureExtractor{constructor(l){super(l);const u=this.config.sampling_rate,p=(0,n.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(u/2),u,null,"kaldi",!0);this.mel_filters=p,this.window=(0,n.window_function)(400,"povey",{periodic:!1})}async _extract_fbank_features(l,u){return l=l.map(p=>p*32768),(0,n.spectrogram)(l,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:u,transpose:!0})}async _call(l,{padding:u=!0,pad_to_multiple_of:p=2,do_normalize_per_mel_bins:d=!0,return_attention_mask:c=!0}={}){(0,s.validate_audio_inputs)(l,"SeamlessM4TFeatureExtractor");let _=await this._extract_fbank_features(l,this.config.max_length);if(d){const[y,b]=_.dims,x=_.data;for(let S=0;S0){const A=new Float32Array(b*(y+S));A.set(x),A.fill(this.config.padding_value,x.length);const B=y+S;_=new o.Tensor(_.type,A,[B,b]),c&&(f=new o.Tensor("int64",new BigInt64Array(B),[1,B]),f.data.fill(1n,0,y))}}const[v,$]=_.dims,w=this.config.stride;if(v%w!==0)throw new Error(`The number of frames (${v}) must be a multiple of the stride (${w}).`);const C=_.view(1,Math.floor(v/w),$*w),E={input_features:C};if(c){const y=C.dims[1],b=new BigInt64Array(y);if(f){const x=f.data;for(let S=1,A=0;S{t.r(r),t.d(r,{SegformerFeatureExtractor:()=>n,SegformerImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_semantic_segmentation(...a){return(0,s.post_process_semantic_segmentation)(...a)}}class n extends o{}},"./src/models/siglip/image_processing_siglip.js":(e,r,t)=>{t.r(r),t.d(r,{SiglipImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/smolvlm/image_processing_smolvlm.js":(e,r,t)=>{t.r(r),t.d(r,{SmolVLMImageProcessor:()=>s.Idefics3ImageProcessor});var s=t("./src/models/idefics3/image_processing_idefics3.js")},"./src/models/smolvlm/processing_smolvlm.js":(e,r,t)=>{t.r(r),t.d(r,{SmolVLMProcessor:()=>s.Idefics3Processor});var s=t("./src/models/idefics3/processing_idefics3.js")},"./src/models/snac/feature_extraction_snac.js":(e,r,t)=>{t.r(r),t.d(r,{SnacFeatureExtractor:()=>o});var s=t("./src/models/dac/feature_extraction_dac.js");class o extends s.DacFeatureExtractor{}},"./src/models/speecht5/feature_extraction_speecht5.js":(e,r,t)=>{t.r(r),t.d(r,{SpeechT5FeatureExtractor:()=>o});var s=t("./src/base/feature_extraction_utils.js");class o extends s.FeatureExtractor{}},"./src/models/speecht5/processing_speecht5.js":(e,r,t)=>{t.r(r),t.d(r,{SpeechT5Processor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/tokenizers.js"),n=t("./src/models/auto/feature_extraction_auto.js");class i extends s.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",o.AutoTokenizer),te(i,"feature_extractor_class",n.AutoFeatureExtractor)},"./src/models/swin2sr/image_processing_swin2sr.js":(e,r,t)=>{t.r(r),t.d(r,{Swin2SRImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(i,a,l,u={}){const[p,d,c]=a;return super.pad_image(i,a,{width:d+(l-d%l)%l,height:p+(l-p%l)%l},{mode:"symmetric",center:!1,constant_values:-1,...u})}}},"./src/models/ultravox/processing_ultravox.js":(e,r,t)=>{t.r(r),t.d(r,{UltravoxProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l,u=null,p={}){if(Array.isArray(l))throw new Error("Batched inputs are not supported yet.");let d={};if(u){const _=u.length,{input_features:f}=await this.feature_extractor(u,{...p,max_length:_}),v=Math.round(_/this.config.encoder_ds_factor+1e-4),$=1+Math.ceil(v/this.config.stack_factor);d.audio_token_len=[$],d.audio_values=f;const w=this.config.audio_placeholder;if(!l.includes(w))throw new Error(`The input text does not contain the image token ${w}.`);l=l.replaceAll(w,w.repeat($))}return{...this.tokenizer(l,{add_special_tokens:!1,...p}),...d}}}te(i,"tokenizer_class",o.AutoTokenizer),te(i,"feature_extractor_class",s.AutoFeatureExtractor),te(i,"uses_processor_config",!0)},"./src/models/vit/image_processing_vit.js":(e,r,t)=>{t.r(r),t.d(r,{ViTFeatureExtractor:()=>n,ViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/vitmatte/image_processing_vitmatte.js":(e,r,t)=>{t.r(r),t.d(r,{VitMatteImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a,l){Array.isArray(a)||(a=[a]),Array.isArray(l)||(l=[l]);const u=await Promise.all(a.map(c=>this.preprocess(c))),p=await Promise.all(l.map(c=>this.preprocess(c,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,o.stack)(u.map((c,_)=>(0,o.cat)([c.pixel_values,p[_].pixel_values],0)),0),original_sizes:u.map(c=>c.original_size),reshaped_input_sizes:u.map(c=>c.reshaped_input_size)}}}},"./src/models/vitpose/image_processing_vitpose.js":(e,r,t)=>{t.r(r),t.d(r,{VitPoseImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_pose_estimation(i,a,{threshold:l=null}={}){const u=i.tolist(),[p,d,c,_]=i.dims,f=[];for(let v=0;v{t.r(r),t.d(r,{Wav2Vec2FeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{_zero_mean_unit_var_norm(a){const u=a.reduce((d,c)=>d+c,0)/a.length,p=a.reduce((d,c)=>d+(c-u)**2,0)/a.length;return a.map(d=>(d-u)/Math.sqrt(p+1e-7))}async _call(a){(0,s.validate_audio_inputs)(a,"Wav2Vec2FeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));let l=a;this.config.do_normalize&&(l=this._zero_mean_unit_var_norm(l));const u=[1,l.length];return{input_values:new o.Tensor("float32",l,u),attention_mask:new o.Tensor("int64",new BigInt64Array(l.length).fill(1n),u)}}}},"./src/models/wav2vec2/processing_wav2vec2.js":(e,r,t)=>{t.r(r),t.d(r,{Wav2Vec2Processor:()=>i});var s=t("./src/tokenizers.js"),o=t("./src/models/auto/feature_extraction_auto.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",s.AutoTokenizer),te(i,"feature_extractor_class",o.AutoFeatureExtractor)},"./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js":(e,r,t)=>{t.r(r),t.d(r,{Wav2Vec2ProcessorWithLM:()=>i});var s=t("./src/tokenizers.js"),o=t("./src/models/auto/feature_extraction_auto.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",s.AutoTokenizer),te(i,"feature_extractor_class",o.AutoFeatureExtractor)},"./src/models/wespeaker/feature_extraction_wespeaker.js":(e,r,t)=>{t.r(r),t.d(r,{WeSpeakerFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a);const l=this.config.sampling_rate,u=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(l/2),l,null,"kaldi",!0);this.mel_filters=u,this.window=(0,o.window_function)(400,"hamming",{periodic:!1}),this.min_num_frames=this.config.min_num_frames}async _extract_fbank_features(a){return a=a.map(l=>l*32768),(0,o.spectrogram)(a,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(a){(0,s.validate_audio_inputs)(a,"WeSpeakerFeatureExtractor");const l=(await this._extract_fbank_features(a)).unsqueeze_(0);if(this.config.fbank_centering_span===null){const u=l.mean(1).data,p=l.data,[d,c,_]=l.dims;for(let f=0;f{t.r(r),t.d(r,{WHISPER_LANGUAGE_MAPPING:()=>o,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>n,whisper_language_to_code:()=>i});const s=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],o=new Map(s),n=new Map([...s.map(([a,l])=>[l,a]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function i(a){a=a.toLowerCase();let l=n.get(a);if(l===void 0){const u=a.match(/^<\|([a-z]{2})\|>$/);if(u&&(a=u[1]),o.has(a))l=a;else{const d=a.length===2?o.keys():o.values();throw new Error(`Language "${a}" is not supported. Must be one of: ${JSON.stringify(Array.from(d))}`)}}return l}},"./src/models/whisper/feature_extraction_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js"),n=t("./src/utils/maths.js");class i extends s.FeatureExtractor{constructor(l){var u;super(l),(u=this.config).mel_filters??(u.mel_filters=(0,o.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney")),this.window=(0,o.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(l){const u=await(0,o.spectrogram)(l,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:Math.min(Math.floor(l.length/this.config.hop_length),this.config.nb_max_frames)}),p=u.data,d=(0,n.max)(p)[0];for(let c=0;cd?(l.length>this.config.n_samples&&console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),p=l.slice(0,d)):(p=new Float32Array(d),p.set(l)),{input_features:(await this._extract_fbank_features(p)).unsqueeze_(0)}}}},"./src/models/whisper/generation_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperGenerationConfig:()=>o});var s=t("./src/generation/configuration_utils.js");class o extends s.GenerationConfig{constructor(){super(...arguments);te(this,"return_timestamps",null);te(this,"return_token_timestamps",null);te(this,"num_frames",null);te(this,"alignment_heads",null);te(this,"task",null);te(this,"language",null);te(this,"no_timestamps_token_id",null);te(this,"prompt_ids",null);te(this,"is_multilingual",null);te(this,"lang_to_id",null);te(this,"task_to_id",null);te(this,"max_initial_timestamp_index",1)}}},"./src/models/whisper/processing_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",o.AutoTokenizer),te(i,"feature_extractor_class",s.AutoFeatureExtractor)},"./src/models/yolos/image_processing_yolos.js":(e,r,t)=>{t.r(r),t.d(r,{YolosFeatureExtractor:()=>n,YolosImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...a){return(0,s.post_process_object_detection)(...a)}}class n extends o{}},"./src/ops/registry.js":(e,r,t)=>{t.r(r),t.d(r,{TensorOpRegistry:()=>l});var s=t("./src/backends/onnx.js"),o=t("./src/utils/tensor.js"),n=t("./src/env.js");const i=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV,a=async(u,p,d)=>{const c=await(0,s.createInferenceSession)(new Uint8Array(u),p);let _=Promise.resolve();return async f=>{const v=(0,s.isONNXProxy)(),$=Object.fromEntries(Object.entries(f).map(([g,C])=>[g,(v?C.clone():C).ort_tensor])),w=await(_=i?_.then(()=>c.run($)):c.run($));return Array.isArray(d)?d.map(g=>new o.Tensor(w[g])):new o.Tensor(w[d])}};class l{static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=a([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=a([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=a([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=a([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=a([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=a([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=a([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=a([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}}te(l,"session_options",{})},"./src/pipelines.js":(e,r,t)=>{t.r(r),t.d(r,{AudioClassificationPipeline:()=>G,AutomaticSpeechRecognitionPipeline:()=>ee,BackgroundRemovalPipeline:()=>oe,DepthEstimationPipeline:()=>fe,DocumentQuestionAnsweringPipeline:()=>F,FeatureExtractionPipeline:()=>B,FillMaskPipeline:()=>C,ImageClassificationPipeline:()=>Z,ImageFeatureExtractionPipeline:()=>K,ImageSegmentationPipeline:()=>X,ImageToImagePipeline:()=>re,ImageToTextPipeline:()=>H,ObjectDetectionPipeline:()=>ae,Pipeline:()=>v,QuestionAnsweringPipeline:()=>g,SummarizationPipeline:()=>y,Text2TextGenerationPipeline:()=>E,TextClassificationPipeline:()=>$,TextGenerationPipeline:()=>S,TextToAudioPipeline:()=>W,TokenClassificationPipeline:()=>w,TranslationPipeline:()=>b,ZeroShotAudioClassificationPipeline:()=>j,ZeroShotClassificationPipeline:()=>A,ZeroShotImageClassificationPipeline:()=>me,ZeroShotObjectDetectionPipeline:()=>V,pipeline:()=>$e});var s=t("./src/tokenizers.js"),o=t("./src/models.js"),n=t("./src/models/auto/processing_auto.js");t("./src/base/processing_utils.js");var i=t("./src/utils/generic.js"),a=t("./src/utils/core.js"),l=t("./src/utils/maths.js"),u=t("./src/utils/audio.js"),p=t("./src/utils/tensor.js"),d=t("./src/utils/image.js");async function c(we){return Array.isArray(we)||(we=[we]),await Promise.all(we.map(q=>d.RawImage.read(q)))}async function _(we,q){return Array.isArray(we)||(we=[we]),await Promise.all(we.map(R=>typeof R=="string"||R instanceof URL?(0,u.read_audio)(R,q):R instanceof Float64Array?new Float32Array(R):R))}function f(we,q){q&&(we=we.map(Se=>Se|0));const[R,pe,xe,Me]=we;return{xmin:R,ymin:pe,xmax:xe,ymax:Me}}class v extends i.Callable{constructor({task:q,model:R,tokenizer:pe=null,processor:xe=null}){super(),this.task=q,this.model=R,this.tokenizer=pe,this.processor=xe}async dispose(){await this.model.dispose()}}class $ extends v{constructor(q){super(q)}async _call(q,{top_k:R=1}={}){const pe=this.tokenizer(q,{padding:!0,truncation:!0}),xe=await this.model(pe),Me=this.model.config.problem_type==="multi_label_classification"?Fe=>Fe.sigmoid():Fe=>new p.Tensor("float32",(0,l.softmax)(Fe.data),Fe.dims),Se=this.model.config.id2label,Ae=[];for(const Fe of xe.logits){const ze=Me(Fe),Ve=await(0,p.topk)(ze,R),O=Ve[0].tolist(),z=Ve[1].tolist().map((J,le)=>({label:Se?Se[J]:`LABEL_${J}`,score:O[le]}));R===1?Ae.push(...z):Ae.push(z)}return Array.isArray(q)||R===1?Ae:Ae[0]}}class w extends v{constructor(q){super(q)}async _call(q,{ignore_labels:R=["O"]}={}){const pe=Array.isArray(q),xe=this.tokenizer(pe?q:[q],{padding:!0,truncation:!0}),Se=(await this.model(xe)).logits,Ae=this.model.config.id2label,Fe=[];for(let ze=0;zeIe==this.tokenizer.sep_token_id);Fe[O].map((Ie,Be)=>Ie==1&&(Be===0||Be>z&&ze.findIndex(Xe=>Xe==Y[Be])===-1));const J=Me[O].tolist(),le=Se[O].tolist();for(let Ie=1;IeBe==Y[Ie])!==-1)&&(J[Ie]=-1/0,le[Ie]=-1/0);const ye=(0,l.softmax)(J).map((Ie,Be)=>[Ie,Be]),Ee=(0,l.softmax)(le).map((Ie,Be)=>[Ie,Be]);ye[0][0]=0,Ee[0][0]=0;const ke=(0,a.product)(ye,Ee).filter(Ie=>Ie[0][1]<=Ie[1][1]).map(Ie=>[Ie[0][1],Ie[1][1],Ie[0][0]*Ie[1][0]]).sort((Ie,Be)=>Be[2]-Ie[2]);for(let Ie=0;IeJ==this.tokenizer.mask_token_id);if(ze===-1)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);const Ve=xe[Ae][ze],O=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(Ve.data),Ve.dims),R),Y=O[0].tolist(),z=O[1].tolist();Me.push(z.map((J,le)=>{const ye=Fe.slice();return ye[ze]=J,{score:Y[le],token:Number(J),token_str:this.tokenizer.decode([J]),sequence:this.tokenizer.decode(ye,{skip_special_tokens:!0})}}))}return Array.isArray(q)?Me:Me[0]}}class E extends v{constructor(R){super(R);te(this,"_key","generated_text")}async _call(R,pe={}){Array.isArray(R)||(R=[R]),this.model.config.prefix&&(R=R.map(ze=>this.model.config.prefix+ze));const xe=this.model.config.task_specific_params;xe&&xe[this.task]&&xe[this.task].prefix&&(R=R.map(ze=>xe[this.task].prefix+ze));const Me=this.tokenizer,Se={padding:!0,truncation:!0};let Ae;this instanceof b&&"_build_translation_inputs"in Me?Ae=Me._build_translation_inputs(R,Se,pe):Ae=Me(R,Se);const Fe=await this.model.generate({...Ae,...pe});return Me.batch_decode(Fe,{skip_special_tokens:!0}).map(ze=>({[this._key]:ze}))}}class y extends E{constructor(R){super(R);te(this,"_key","summary_text")}}class b extends E{constructor(R){super(R);te(this,"_key","translation_text")}}function x(we){return Array.isArray(we)&&we.every(q=>"role"in q&&"content"in q)}class S extends v{constructor(q){super(q)}async _call(q,R={}){let pe=!1,xe=!1,Me;if(typeof q=="string")Me=q=[q];else if(Array.isArray(q)&&q.every(z=>typeof z=="string"))pe=!0,Me=q;else{if(x(q))q=[q];else if(Array.isArray(q)&&q.every(x))pe=!0;else throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");xe=!0,Me=q.map(z=>this.tokenizer.apply_chat_template(z,{tokenize:!1,add_generation_prompt:!0}))}const Se=R.add_special_tokens??!1,Ae=xe?!1:R.return_full_text??!0;this.tokenizer.padding_side="left";const Fe=this.tokenizer(Me,{add_special_tokens:Se,padding:!0,truncation:!0}),ze=await this.model.generate({...Fe,...R}),Ve=this.tokenizer.batch_decode(ze,{skip_special_tokens:!0});let O;!Ae&&Fe.input_ids.dims.at(-1)>0&&(O=this.tokenizer.batch_decode(Fe.input_ids,{skip_special_tokens:!0}).map(z=>z.length));const Y=Array.from({length:q.length},z=>[]);for(let z=0;z[R.toLowerCase(),pe])),this.entailment_id=this.label2id.entailment,this.entailment_id===void 0&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,this.contradiction_id===void 0&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(q,R,{hypothesis_template:pe="This example is {}.",multi_label:xe=!1}={}){const Me=Array.isArray(q);Me||(q=[q]),Array.isArray(R)||(R=[R]);const Se=R.map(ze=>pe.replace("{}",ze)),Ae=xe||R.length===1,Fe=[];for(const ze of q){const Ve=[];for(const z of Se){const J=this.tokenizer(ze,{text_pair:z,padding:!0,truncation:!0}),le=await this.model(J);Ae?Ve.push([le.logits.data[this.contradiction_id],le.logits.data[this.entailment_id]]):Ve.push(le.logits.data[this.entailment_id])}const Y=(Ae?Ve.map(z=>(0,l.softmax)(z)[1]):(0,l.softmax)(Ve)).map((z,J)=>[z,J]).sort((z,J)=>J[0]-z[0]);Fe.push({sequence:ze,labels:Y.map(z=>R[z[1]]),scores:Y.map(z=>z[0])})}return Me?Fe:Fe[0]}}class B extends v{constructor(q){super(q)}async _call(q,{pooling:R="none",normalize:pe=!1,quantize:xe=!1,precision:Me="binary"}={}){const Se=this.tokenizer(q,{padding:!0,truncation:!0}),Ae=await this.model(Se);let Fe=Ae.last_hidden_state??Ae.logits??Ae.token_embeddings;if(R!=="none")if(R==="mean")Fe=(0,p.mean_pooling)(Fe,Se.attention_mask);else if(R==="cls")Fe=Fe.slice(null,0);else throw Error(`Pooling method '${R}' not supported.`);return pe&&(Fe=Fe.normalize(2,-1)),xe&&(Fe=(0,p.quantize_embeddings)(Fe,Me)),Fe}}class K extends v{constructor(q){super(q)}async _call(q,{pool:R=null}={}){const pe=await c(q),{pixel_values:xe}=await this.processor(pe),Me=await this.model({pixel_values:xe});let Se;if(R){if(!("pooler_output"in Me))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");Se=Me.pooler_output}else Se=Me.last_hidden_state??Me.logits??Me.image_embeds;return Se}}class G extends v{constructor(q){super(q)}async _call(q,{top_k:R=5}={}){const pe=this.processor.feature_extractor.config.sampling_rate,xe=await _(q,pe),Me=this.model.config.id2label,Se=[];for(const Ae of xe){const Fe=await this.processor(Ae),Ve=(await this.model(Fe)).logits[0],O=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(Ve.data),Ve.dims),R),Y=O[0].tolist(),J=O[1].tolist().map((le,ye)=>({label:Me?Me[le]:`LABEL_${le}`,score:Y[ye]}));Se.push(J)}return Array.isArray(q)?Se:Se[0]}}class j extends v{constructor(q){super(q)}async _call(q,R,{hypothesis_template:pe="This is a sound of {}."}={}){const xe=!Array.isArray(q);xe&&(q=[q]);const Me=R.map(Ve=>pe.replace("{}",Ve)),Se=this.tokenizer(Me,{padding:!0,truncation:!0}),Ae=this.processor.feature_extractor.config.sampling_rate,Fe=await _(q,Ae),ze=[];for(const Ve of Fe){const O=await this.processor(Ve),Y=await this.model({...Se,...O}),z=(0,l.softmax)(Y.logits_per_audio.data);ze.push([...z].map((J,le)=>({score:J,label:R[le]})))}return xe?ze[0]:ze}}class ee extends v{constructor(q){super(q)}async _call(q,R={}){switch(this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(q,R);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(q,R);case"moonshine":return this._call_moonshine(q,R);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(q,R){R.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),R.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const pe=!Array.isArray(q);pe&&(q=[q]);const xe=this.processor.feature_extractor.config.sampling_rate,Me=await _(q,xe),Se=[];for(const Ae of Me){const Fe=await this.processor(Ae),Ve=(await this.model(Fe)).logits[0],O=[];for(const z of Ve)O.push((0,l.max)(z.data)[1]);const Y=this.tokenizer.decode(O);Se.push({text:Y})}return pe?Se[0]:Se}async _call_whisper(q,R){const pe=R.return_timestamps??!1,xe=R.chunk_length_s??0,Me=R.force_full_sequences??!1;let Se=R.stride_length_s??null;const Ae={...R};pe==="word"&&(Ae.return_token_timestamps=!0,Ae.return_timestamps=!1);const Fe=!Array.isArray(q);Fe&&(q=[q]);const ze=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,Ve=this.processor.feature_extractor.config.hop_length,O=this.processor.feature_extractor.config.sampling_rate,Y=await _(q,O),z=[];for(const J of Y){let le=[];if(xe>0){if(Se===null)Se=xe/6;else if(xe<=Se)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const ke=O*xe,Ie=O*Se,Be=ke-2*Ie;let Xe=0;for(;;){const Ge=Xe+ke,lt=J.subarray(Xe,Ge),wt=await this.processor(lt),Gt=Xe===0,Ot=Ge>=J.length;if(le.push({stride:[lt.length,Gt?0:Ie,Ot?0:Ie],input_features:wt.input_features,is_last:Ot}),Ot)break;Xe+=Be}}else le=[{stride:[J.length,0,0],input_features:(await this.processor(J)).input_features,is_last:!0}];for(const ke of le){Ae.num_frames=Math.floor(ke.stride[0]/Ve);const Ie=await this.model.generate({inputs:ke.input_features,...Ae});pe==="word"?(ke.tokens=Ie.sequences.tolist()[0],ke.token_timestamps=Ie.token_timestamps.tolist()[0].map(Be=>(0,l.round)(Be,2))):ke.tokens=Ie[0].tolist(),ke.stride=ke.stride.map(Be=>Be/O)}const[ye,Ee]=this.tokenizer._decode_asr(le,{time_precision:ze,return_timestamps:pe,force_full_sequences:Me});z.push({text:ye,...Ee})}return Fe?z[0]:z}async _call_moonshine(q,R){const pe=!Array.isArray(q);pe&&(q=[q]);const xe=this.processor.feature_extractor.config.sampling_rate,Me=await _(q,xe),Se=[];for(const Ae of Me){const Fe=await this.processor(Ae),ze=Math.floor(Ae.length/xe)*6,Ve=await this.model.generate({max_new_tokens:ze,...R,...Fe}),O=this.processor.batch_decode(Ve,{skip_special_tokens:!0})[0];Se.push({text:O})}return pe?Se[0]:Se}}class H extends v{constructor(q){super(q)}async _call(q,R={}){const pe=Array.isArray(q),xe=await c(q),{pixel_values:Me}=await this.processor(xe),Se=[];for(const Ae of Me){Ae.dims=[1,...Ae.dims];const Fe=await this.model.generate({inputs:Ae,...R}),ze=this.tokenizer.batch_decode(Fe,{skip_special_tokens:!0}).map(Ve=>({generated_text:Ve.trim()}));Se.push(ze)}return pe?Se:Se[0]}}class Z extends v{constructor(q){super(q)}async _call(q,{top_k:R=5}={}){const pe=await c(q),{pixel_values:xe}=await this.processor(pe),Me=await this.model({pixel_values:xe}),Se=this.model.config.id2label,Ae=[];for(const Fe of Me.logits){const ze=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(Fe.data),Fe.dims),R),Ve=ze[0].tolist(),Y=ze[1].tolist().map((z,J)=>({label:Se?Se[z]:`LABEL_${z}`,score:Ve[J]}));Ae.push(Y)}return Array.isArray(q)?Ae:Ae[0]}}class X extends v{constructor(q){super(q),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(q,{threshold:R=.5,mask_threshold:pe=.5,overlap_mask_area_threshold:xe=.8,label_ids_to_fuse:Me=null,target_sizes:Se=null,subtask:Ae=null}={}){if(Array.isArray(q)&&q.length!==1)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const ze=await c(q),Ve=ze.map(ke=>[ke.height,ke.width]),O=await this.processor(ze),{inputNames:Y,outputNames:z}=this.model.sessions.model;if(!Y.includes("pixel_values")){if(Y.length!==1)throw Error(`Expected a single input name, but got ${Y.length} inputs: ${Y}.`);const ke=Y[0];if(ke in O)throw Error(`Input name ${ke} already exists in the inputs.`);O[ke]=O.pixel_values}const J=await this.model(O);let le=null;if(Ae!==null)le=this.subtasks_mapping[Ae];else if(this.processor.image_processor){for(const[ke,Ie]of Object.entries(this.subtasks_mapping))if(Ie in this.processor.image_processor){le=this.processor.image_processor[Ie].bind(this.processor.image_processor),Ae=ke;break}}const ye=this.model.config.id2label,Ee=[];if(Ae)if(Ae==="panoptic"||Ae==="instance"){const ke=le(J,R,pe,xe,Me,Se??Ve)[0],Ie=ke.segmentation;for(const Be of ke.segments_info){const Xe=new Uint8ClampedArray(Ie.data.length);for(let lt=0;ltwt<-1e-5||wt>1+1e-5)&&Ge.sigmoid_();const lt=await d.RawImage.fromTensor(Ge.mul_(255).to("uint8")).resize(Xe[1],Xe[0]);Ee.push({label:null,score:null,mask:lt})}}return Ee}}class oe extends X{constructor(q){super(q)}async _call(q,R={}){if(Array.isArray(q)&&q.length!==1)throw Error("Background removal pipeline currently only supports a batch size of 1.");const xe=await c(q),Me=await super._call(q,R);return xe.map((Ae,Fe)=>{const ze=Ae.clone();return ze.putAlpha(Me[Fe].mask),ze})}}class me extends v{constructor(q){super(q)}async _call(q,R,{hypothesis_template:pe="This is a photo of {}"}={}){const xe=Array.isArray(q),Me=await c(q),Se=R.map(Y=>pe.replace("{}",Y)),Ae=this.tokenizer(Se,{padding:this.model.config.model_type==="siglip"?"max_length":!0,truncation:!0}),{pixel_values:Fe}=await this.processor(Me),ze=await this.model({...Ae,pixel_values:Fe}),Ve=this.model.config.model_type==="siglip"?Y=>Y.sigmoid().data:Y=>(0,l.softmax)(Y.data),O=[];for(const Y of ze.logits_per_image){const J=[...Ve(Y)].map((le,ye)=>({score:le,label:R[ye]}));J.sort((le,ye)=>ye.score-le.score),O.push(J)}return xe?O:O[0]}}class ae extends v{constructor(q){super(q)}async _call(q,{threshold:R=.9,percentage:pe=!1}={}){const xe=Array.isArray(q);if(xe&&q.length!==1)throw Error("Object detection pipeline currently only supports a batch size of 1.");const Me=await c(q),Se=pe?null:Me.map(z=>[z.height,z.width]),{pixel_values:Ae,pixel_mask:Fe}=await this.processor(Me),ze=await this.model({pixel_values:Ae,pixel_mask:Fe}),Ve=this.processor.image_processor.post_process_object_detection(ze,R,Se),O=this.model.config.id2label,Y=Ve.map(z=>z.boxes.map((J,le)=>({score:z.scores[le],label:O[z.classes[le]],box:f(J,!pe)})));return xe?Y:Y[0]}}class V extends v{constructor(q){super(q)}async _call(q,R,{threshold:pe=.1,top_k:xe=null,percentage:Me=!1}={}){const Se=Array.isArray(q),Ae=await c(q),Fe=this.tokenizer(R,{padding:!0,truncation:!0}),ze=await this.processor(Ae),Ve=[];for(let O=0;O({score:Ee.scores[Ie],label:Ee.labels[Ie],box:f(ke,!Me)}))}else{const Ee=this.processor.image_processor.post_process_object_detection(le,pe,z,!0)[0];ye=Ee.boxes.map((ke,Ie)=>({score:Ee.scores[Ie],label:R[Ee.classes[Ie]],box:f(ke,!Me)}))}ye.sort((Ee,ke)=>ke.score-Ee.score),xe!==null&&(ye=ye.slice(0,xe)),Ve.push(ye)}return Se?Ve:Ve[0]}}class F extends v{constructor(q){super(q)}async _call(q,R,pe={}){const xe=(await c(q))[0],{pixel_values:Me}=await this.processor(xe),Se=`${R}`,Ae=this.tokenizer(Se,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,Fe=await this.model.generate({inputs:Me,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:Ae,...pe}),Ve=this.tokenizer.batch_decode(Fe)[0].match(/(.*?)<\/s_answer>/);let O=null;return Ve&&Ve.length>=2&&(O=Ve[1].trim()),[{answer:O}]}}class W extends v{constructor(R){super(R);te(this,"DEFAULT_VOCODER_ID","Xenova/speecht5_hifigan");this.vocoder=R.vocoder??null}async _call(R,{speaker_embeddings:pe=null}={}){return this.processor?this._call_text_to_spectrogram(R,{speaker_embeddings:pe}):this._call_text_to_waveform(R)}async _call_text_to_waveform(R){const pe=this.tokenizer(R,{padding:!0,truncation:!0}),{waveform:xe}=await this.model(pe),Me=this.model.config.sampling_rate;return new u.RawAudio(xe.data,Me)}async _call_text_to_spectrogram(R,{speaker_embeddings:pe}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"})),(typeof pe=="string"||pe instanceof URL)&&(pe=new Float32Array(await(await fetch(pe)).arrayBuffer())),pe instanceof Float32Array)pe=new p.Tensor("float32",pe,[1,pe.length]);else if(!(pe instanceof p.Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");const{input_ids:xe}=this.tokenizer(R,{padding:!0,truncation:!0}),{waveform:Me}=await this.model.generate_speech(xe,pe,{vocoder:this.vocoder}),Se=this.processor.feature_extractor.config.sampling_rate;return new u.RawAudio(Me.data,Se)}}class re extends v{constructor(q){super(q)}async _call(q){const R=await c(q),pe=await this.processor(R),xe=await this.model(pe),Me=[];for(const Se of xe.reconstruction){const Ae=Se.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");Me.push(d.RawImage.fromTensor(Ae))}return Me.length>1?Me:Me[0]}}class fe extends v{constructor(q){super(q)}async _call(q){const R=await c(q),pe=await this.processor(R),{predicted_depth:xe}=await this.model(pe),Me=[];for(let Se=0;Se1?Me:Me[0]}}const se=Object.freeze({"text-classification":{tokenizer:s.AutoTokenizer,pipeline:$,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:s.AutoTokenizer,pipeline:w,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:s.AutoTokenizer,pipeline:g,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:s.AutoTokenizer,pipeline:C,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:s.AutoTokenizer,pipeline:y,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:s.AutoTokenizer,pipeline:b,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:s.AutoTokenizer,pipeline:E,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:s.AutoTokenizer,pipeline:S,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:s.AutoTokenizer,pipeline:A,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:G,model:o.AutoModelForAudioClassification,processor:n.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:s.AutoTokenizer,pipeline:j,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:s.AutoTokenizer,pipeline:ee,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:n.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:s.AutoTokenizer,pipeline:W,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[n.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:s.AutoTokenizer,pipeline:H,model:o.AutoModelForVision2Seq,processor:n.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:Z,model:o.AutoModelForImageClassification,processor:n.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:X,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:oe,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{tokenizer:s.AutoTokenizer,pipeline:me,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:ae,model:o.AutoModelForObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:s.AutoTokenizer,pipeline:V,model:o.AutoModelForZeroShotObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:s.AutoTokenizer,pipeline:F,model:o.AutoModelForDocumentQuestionAnswering,processor:n.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:re,model:o.AutoModelForImageToImage,processor:n.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:fe,model:o.AutoModelForDepthEstimation,processor:n.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:s.AutoTokenizer,pipeline:B,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:n.AutoProcessor,pipeline:K,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),ce=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function $e(we,q=null,{progress_callback:R=null,config:pe=null,cache_dir:xe=null,local_files_only:Me=!1,revision:Se="main",device:Ae=null,dtype:Fe=null,subfolder:ze="onnx",use_external_data_format:Ve=null,model_file_name:O=null,session_options:Y={}}={}){we=ce[we]??we;const z=se[we.split("_",1)[0]];if(!z)throw Error(`Unsupported pipeline: ${we}. Must be one of [${Object.keys(se)}]`);q||(q=z.default.model,console.log(`No model specified. Using default model: "${q}".`));const J={progress_callback:R,config:pe,cache_dir:xe,local_files_only:Me,revision:Se,device:Ae,dtype:Fe,subfolder:ze,use_external_data_format:Ve,model_file_name:O,session_options:Y},le=new Map([["tokenizer",z.tokenizer],["model",z.model],["processor",z.processor]]),ye=await Ue(le,q,J);ye.task=we,(0,a.dispatchCallback)(R,{status:"ready",task:we,model:q});const Ee=z.pipeline;return new Ee(ye)}async function Ue(we,q,R){const pe=Object.create(null),xe=[];for(const[Me,Se]of we.entries()){if(!Se)continue;let Ae;Array.isArray(Se)?Ae=new Promise(async(Fe,ze)=>{var O,Y;let Ve;for(const z of Se){if(z===null){Fe(null);return}try{Fe(await z.from_pretrained(q,R));return}catch(J){if((O=J.message)!=null&&O.includes("Unsupported model type"))Ve=J;else if((Y=J.message)!=null&&Y.includes("Could not locate file"))Ve=J;else{ze(J);return}}}ze(Ve)}):Ae=Se.from_pretrained(q,R),pe[Me]=Ae,xe.push(Ae)}await Promise.all(xe);for(const[Me,Se]of Object.entries(pe))pe[Me]=await Se;return pe}},"./src/tokenizers.js":(e,r,t)=>{t.r(r),t.d(r,{AlbertTokenizer:()=>Ir,AutoTokenizer:()=>dn,BartTokenizer:()=>ss,BertTokenizer:()=>Zr,BlenderbotSmallTokenizer:()=>Ms,BlenderbotTokenizer:()=>on,BloomTokenizer:()=>Wr,CLIPTokenizer:()=>tn,CamembertTokenizer:()=>et,CodeGenTokenizer:()=>Dr,CodeLlamaTokenizer:()=>vr,CohereTokenizer:()=>un,ConvBertTokenizer:()=>Xt,DebertaTokenizer:()=>es,DebertaV2Tokenizer:()=>ts,DistilBertTokenizer:()=>Qe,ElectraTokenizer:()=>Or,EsmTokenizer:()=>Zs,FalconTokenizer:()=>fr,GPT2Tokenizer:()=>rs,GPTNeoXTokenizer:()=>zs,GemmaTokenizer:()=>en,Grok1Tokenizer:()=>Gr,HerbertTokenizer:()=>bs,LlamaTokenizer:()=>Ys,M2M100Tokenizer:()=>ur,MBart50Tokenizer:()=>ns,MBartTokenizer:()=>Ur,MPNetTokenizer:()=>Es,MarianTokenizer:()=>sn,MgpstrTokenizer:()=>ys,MobileBertTokenizer:()=>ws,NllbTokenizer:()=>Ps,NougatTokenizer:()=>Bs,PreTrainedTokenizer:()=>at,Qwen2Tokenizer:()=>Ar,RoFormerTokenizer:()=>De,RobertaTokenizer:()=>os,SiglipTokenizer:()=>rn,SpeechT5Tokenizer:()=>an,SqueezeBertTokenizer:()=>Ft,T5Tokenizer:()=>Pr,TokenizerModel:()=>K,VitsTokenizer:()=>ln,Wav2Vec2CTCTokenizer:()=>nn,WhisperTokenizer:()=>_r,XLMRobertaTokenizer:()=>Ts,XLMTokenizer:()=>Bt,is_chinese_char:()=>C});var s=t("./src/utils/generic.js"),o=t("./src/utils/core.js"),n=t("./src/utils/hub.js"),i=t("./src/utils/maths.js"),a=t("./src/utils/tensor.js"),l=t("./src/utils/data-structures.js"),u=t("./node_modules/@huggingface/jinja/dist/index.js"),p=t("./src/models/whisper/common_whisper.js");async function d(he,k){const N=await Promise.all([(0,n.getModelJSON)(he,"tokenizer.json",!0,k),(0,n.getModelJSON)(he,"tokenizer_config.json",!0,k)]);return k.legacy!==null&&(N[1].legacy=k.legacy),N}function c(he,k){const N=[];let Q=0;for(const ie of he.matchAll(k)){const de=ie[0];Q0&&N.push(de),Q=ie.index+de.length}return Q=19968&&he<=40959||he>=13312&&he<=19903||he>=131072&&he<=173791||he>=173824&&he<=177983||he>=177984&&he<=178207||he>=178208&&he<=183983||he>=63744&&he<=64255||he>=194560&&he<=195103}function E(he,k,N){const Q=[];let ie=0;for(;iethis.tokens_to_ids.get(N)??this.unk_token_id)}convert_ids_to_tokens(k){return k.map(N=>this.vocab[N]??this.unk_token)}}class G extends K{constructor(k){super(k),this.tokens_to_ids=f(k.vocab),this.unk_token_id=this.tokens_to_ids.get(k.unk_token),this.unk_token=k.unk_token,this.max_input_chars_per_word=k.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[N,Q]of this.tokens_to_ids)this.vocab[Q]=N}encode(k){const N=[];for(const Q of k){const ie=[...Q];if(ie.length>this.max_input_chars_per_word){N.push(this.unk_token);continue}let de=!1,ve=0;const je=[];for(;ve0&&(Je=this.config.continuing_subword_prefix+Je),this.tokens_to_ids.has(Je)){We=Je;break}--He}if(We===null){de=!0;break}je.push(We),ve=He}de?N.push(this.unk_token):N.push(...je)}return N}}class j extends K{constructor(k,N){super(k);const Q=k.vocab.length;this.vocab=new Array(Q),this.scores=new Array(Q);for(let ie=0;ie[ie,de])),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=N.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.minScore=(0,i.min)(this.scores)[0],this.unk_score=this.minScore-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new l.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(k){const N=k.chars,Q=1;let ie=0;for(;ie{const he=[...Array.from({length:94},(ie,de)=>de+33),...Array.from({length:12},(ie,de)=>de+161),...Array.from({length:82},(ie,de)=>de+174)],k=he.slice();let N=0;for(let ie=0;ie<256;++ie)he.includes(ie)||(he.push(ie),k.push(256+N),N+=1);const Q=k.map(ie=>String.fromCharCode(ie));return Object.fromEntries(he.map((ie,de)=>[ie,Q[de]]))})(),H=(0,o.reverseDictionary)(ee);class Z extends K{constructor(k){super(k),this.tokens_to_ids=f(k.vocab),this.unk_token_id=this.tokens_to_ids.get(k.unk_token),this.unk_token=k.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[Q,ie]of this.tokens_to_ids)this.vocab[ie]=Q;const N=Array.isArray(k.merges[0]);this.merges=N?k.merges:k.merges.map(Q=>Q.split(" ",2)),this.bpe_ranks=new Map(this.merges.map((Q,ie)=>[JSON.stringify(Q),ie])),this.end_of_word_suffix=k.end_of_word_suffix,this.continuing_subword_suffix=k.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.max_length_to_cache=256,this.cache_capacity=1e4,this.cache=new l.LRUCache(this.cache_capacity)}clear_cache(){this.cache.clear()}bpe(k){if(k.length===0)return[];const N=this.cache.get(k);if(N!==void 0)return N;const Q=Array.from(k);this.end_of_word_suffix&&(Q[Q.length-1]+=this.end_of_word_suffix);let ie=[];if(Q.length>1){const de=new l.PriorityQueue((He,We)=>He.score`<0x${je.toString(16).toUpperCase().padStart(2,"0")}>`);ve.every(je=>this.tokens_to_ids.has(je))?N.push(...ve):N.push(this.unk_token)}else N.push(this.unk_token)}return N}}class X extends K{constructor(k,N){super(k),this.tokens_to_ids=f(N.target_lang?k.vocab[N.target_lang]:k.vocab),this.bos_token=N.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=N.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=N.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=N.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[Q,ie]of this.tokens_to_ids)this.vocab[ie]=Q}encode(k){return k}}class oe extends s.Callable{constructor(k){super(),this.config=k}static fromConfig(k){if(k===null)return null;switch(k.type){case"BertNormalizer":return new we(k);case"Precompiled":return new Ot(k);case"Sequence":return new Ue(k);case"Replace":return new me(k);case"NFC":return new V(k);case"NFD":return new F(k);case"NFKC":return new W(k);case"NFKD":return new re(k);case"Strip":return new fe(k);case"StripAccents":return new se(k);case"Lowercase":return new ce(k);case"Prepend":return new $e(k);default:throw new Error(`Unknown Normalizer type: ${k.type}`)}}normalize(k){throw Error("normalize should be implemented in subclass.")}_call(k){return this.normalize(k)}}class me extends oe{normalize(k){const N=_(this.config.pattern);return N===null?k:k.replaceAll(N,this.config.content)}}class ae extends oe{constructor(){super(...arguments);te(this,"form")}normalize(N){return N=N.normalize(this.form),N}}class V extends ae{constructor(){super(...arguments);te(this,"form","NFC")}}class F extends ae{constructor(){super(...arguments);te(this,"form","NFD")}}class W extends ae{constructor(){super(...arguments);te(this,"form","NFKC")}}class re extends ae{constructor(){super(...arguments);te(this,"form","NFKD")}}class fe extends oe{normalize(k){return this.config.strip_left&&this.config.strip_right?k=k.trim():(this.config.strip_left&&(k=k.trimStart()),this.config.strip_right&&(k=k.trimEnd())),k}}class se extends oe{normalize(k){return k=w(k),k}}class ce extends oe{normalize(k){return k=k.toLowerCase(),k}}class $e extends oe{normalize(k){return k=this.config.prepend+k,k}}class Ue extends oe{constructor(k){super(k),this.normalizers=k.normalizers.map(N=>oe.fromConfig(N))}normalize(k){return this.normalizers.reduce((N,Q)=>Q.normalize(N),k)}}class we extends oe{_tokenize_chinese_chars(k){const N=[];for(let Q=0;Qthis.pre_tokenize_text(Q,N)):this.pre_tokenize_text(k,N)).flat()}_call(k,N){return this.pre_tokenize(k,N)}}class R extends q{constructor(k){super(),this.pattern=new RegExp(`[^\\s${b}]+|[${b}]`,"gu")}pre_tokenize_text(k,N){return k.trim().match(this.pattern)||[]}}class pe extends q{constructor(k){super(),this.config=k,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=new RegExp("'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)|\\s+","gu"),this.byte_encoder=ee,this.text_encoder=new TextEncoder}pre_tokenize_text(k,N){return this.add_prefix_space&&!k.startsWith(" ")&&(k=" "+k),(this.use_regex?k.match(this.pattern)||[]:[k]).map(ie=>Array.from(this.text_encoder.encode(ie),de=>this.byte_encoder[de]).join(""))}}class xe extends q{constructor(k){super(),this.config=k,this.pattern=_(this.config.pattern,this.config.invert)}pre_tokenize_text(k,N){var Q;return this.pattern===null?[]:this.config.invert?k.match(this.pattern)||[]:((Q=this.config.behavior)==null?void 0:Q.toLowerCase())==="removed"?k.split(this.pattern).filter(ie=>ie):c(k,this.pattern)}}class Me extends q{constructor(k){super(),this.config=k,this.pattern=new RegExp(`[^${b}]+|[${b}]+`,"gu")}pre_tokenize_text(k,N){return k.match(this.pattern)||[]}}class Se extends q{constructor(k){super(),this.config=k;const N=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=new RegExp(N,"gu")}pre_tokenize_text(k,N){return k.match(this.pattern)||[]}}class Ae extends s.Callable{constructor(k){super(),this.config=k}static fromConfig(k){if(k===null)return null;switch(k.type){case"TemplateProcessing":return new Ve(k);case"ByteLevel":return new O(k);case"RobertaProcessing":return new ze(k);case"BertProcessing":return new Fe(k);case"Sequence":return new Y(k);default:throw new Error(`Unknown PostProcessor type: ${k.type}`)}}post_process(k,...N){throw Error("post_process should be implemented in subclass.")}_call(k,...N){return this.post_process(k,...N)}}class Fe extends Ae{constructor(k){super(k),this.cls=k.cls[0],this.sep=k.sep[0]}post_process(k,N=null,{add_special_tokens:Q=!0}={}){Q&&(k=(0,o.mergeArrays)([this.cls],k,[this.sep]));let ie=new Array(k.length).fill(0);if(N!==null){const de=Q&&this instanceof ze?[this.sep]:[],ve=Q?[this.sep]:[];k=(0,o.mergeArrays)(k,de,N,ve),ie=(0,o.mergeArrays)(ie,new Array(N.length+de.length+ve.length).fill(1))}return{tokens:k,token_type_ids:ie}}}class ze extends Fe{}class Ve extends Ae{constructor(k){super(k),this.single=k.single,this.pair=k.pair}post_process(k,N=null,{add_special_tokens:Q=!0}={}){const ie=N===null?this.single:this.pair;let de=[],ve=[];for(const je of ie)"SpecialToken"in je?Q&&(de.push(je.SpecialToken.id),ve.push(je.SpecialToken.type_id)):"Sequence"in je&&(je.Sequence.id==="A"?(de=(0,o.mergeArrays)(de,k),ve=(0,o.mergeArrays)(ve,new Array(k.length).fill(je.Sequence.type_id))):je.Sequence.id==="B"&&(de=(0,o.mergeArrays)(de,N),ve=(0,o.mergeArrays)(ve,new Array(N.length).fill(je.Sequence.type_id))));return{tokens:de,token_type_ids:ve}}}class O extends Ae{post_process(k,N=null){return N&&(k=(0,o.mergeArrays)(k,N)),{tokens:k}}}class Y extends Ae{constructor(k){super(k),this.processors=k.processors.map(N=>Ae.fromConfig(N))}post_process(k,N=null,Q={}){let ie;for(const de of this.processors)if(de instanceof O)k=de.post_process(k).tokens,N&&(N=de.post_process(N).tokens);else{const ve=de.post_process(k,N,Q);k=ve.tokens,ie=ve.token_type_ids}return{tokens:k,token_type_ids:ie}}}class z extends s.Callable{constructor(k){super(),this.config=k,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=k.trim_offsets}static fromConfig(k){if(k===null)return null;switch(k.type){case"WordPiece":return new ke(k);case"Metaspace":return new Gt(k);case"ByteLevel":return new Ie(k);case"Replace":return new J(k);case"ByteFallback":return new le(k);case"Fuse":return new ye(k);case"Strip":return new Ee(k);case"Sequence":return new Xe(k);case"CTC":return new Be(k);case"BPEDecoder":return new Ge(k);default:throw new Error(`Unknown Decoder type: ${k.type}`)}}_call(k){return this.decode(k)}decode(k){return this.decode_chain(k).join("")}decode_chain(k){throw Error("`decode_chain` should be implemented in subclass.")}}class J extends z{decode_chain(k){const N=_(this.config.pattern);return N===null?k:k.map(Q=>Q.replaceAll(N,this.config.content))}}class le extends z{constructor(k){super(k),this.text_decoder=new TextDecoder}decode_chain(k){const N=[];let Q=[];for(const ie of k){let de=null;if(ie.length===6&&ie.startsWith("<0x")&&ie.endsWith(">")){const ve=parseInt(ie.slice(3,5),16);isNaN(ve)||(de=ve)}if(de!==null)Q.push(de);else{if(Q.length>0){const ve=this.text_decoder.decode(Uint8Array.from(Q));N.push(ve),Q=[]}N.push(ie)}}if(Q.length>0){const ie=this.text_decoder.decode(Uint8Array.from(Q));N.push(ie),Q=[]}return N}}class ye extends z{decode_chain(k){return[k.join("")]}}class Ee extends z{constructor(k){super(k),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(k){return k.map(N=>{let Q=0;for(let de=0;de(Q!==0&&(N.startsWith(this.config.prefix)?N=N.replace(this.config.prefix,""):N=" "+N),this.cleanup&&(N=$(N)),N))}}class Ie extends z{constructor(k){super(k),this.byte_decoder=H,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(k){const N=k.join(""),Q=new Uint8Array([...N].map(de=>this.byte_decoder[de]));return this.text_decoder.decode(Q)}decode_chain(k){const N=[];let Q=[];for(const ie of k)this.added_tokens.find(de=>de.content===ie)!==void 0?(Q.length>0&&(N.push(this.convert_tokens_to_string(Q)),Q=[]),N.push(ie)):Q.push(ie);return Q.length>0&&N.push(this.convert_tokens_to_string(Q)),N}}class Be extends z{constructor(k){super(k),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(k){if(k.length===0)return"";const N=[k[0]];for(let de=1;dede!==this.pad_token).join("");return this.cleanup&&(ie=$(ie).replaceAll(this.word_delimiter_token," ").trim()),ie}decode_chain(k){return[this.convert_tokens_to_string(k)]}}class Xe extends z{constructor(k){super(k),this.decoders=k.decoders.map(N=>z.fromConfig(N))}decode_chain(k){return this.decoders.reduce((N,Q)=>Q.decode_chain(N),k)}}class Ge extends z{constructor(k){super(k),this.suffix=this.config.suffix}decode_chain(k){return k.map((N,Q)=>N.replaceAll(this.suffix,Q===k.length-1?"":" "))}}class lt extends z{decode_chain(k){let N="";for(let Q=1;QQ.normalize("NFKC")).join("~"):k=k.normalize("NFKC"),k}}class lr extends q{constructor(k){super(),this.tokenizers=k.pretokenizers.map(N=>q.fromConfig(N))}pre_tokenize_text(k,N){return this.tokenizers.reduce((Q,ie)=>ie.pre_tokenize(Q,N),[k])}}class Yr extends q{constructor(k){super()}pre_tokenize_text(k,N){return k.match(/\w+|[^\w\s]+/g)||[]}}class gs extends q{constructor(k){super()}pre_tokenize_text(k,N){return y(k)}}class kr extends q{constructor(k){super(),this.config=k,this.pattern=_(this.config.pattern),this.content=this.config.content}pre_tokenize_text(k,N){return this.pattern===null?[k]:[k.replaceAll(this.pattern,this.config.content)]}}const Ds=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function xs(he,k,N,Q){for(const ie of Object.keys(he)){const de=k-he[ie].length,ve=N(ie),je=new Array(de).fill(ve);he[ie]=Q==="right"?(0,o.mergeArrays)(he[ie],je):(0,o.mergeArrays)(je,he[ie])}}function Ls(he,k){for(const N of Object.keys(he))he[N].length=k}class at extends s.Callable{constructor(N,Q){super();te(this,"return_token_type_ids",!1);te(this,"padding_side","right");this._tokenizer_config=Q,this.normalizer=oe.fromConfig(N.normalizer),this.pre_tokenizer=q.fromConfig(N.pre_tokenizer),this.model=K.fromConfig(N.model,Q),this.post_processor=Ae.fromConfig(N.post_processor),this.decoder=z.fromConfig(N.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(const ie of N.added_tokens){const de=new B(ie);this.added_tokens.push(de),this.model.tokens_to_ids.set(de.content,de.id),this.model.vocab[de.id]=de.content,de.special&&(this.special_tokens.push(de.content),this.all_special_ids.push(de.id))}if(this.additional_special_tokens=Q.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_splitter=new l.DictionarySplitter(this.added_tokens.map(ie=>ie.content)),this.added_tokens_map=new Map(this.added_tokens.map(ie=>[ie.content,ie])),this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.bos_token=this.getToken("bos_token"),this.bos_token_id=this.model.tokens_to_ids.get(this.bos_token),this.eos_token=this.getToken("eos_token"),this.eos_token_id=this.model.tokens_to_ids.get(this.eos_token),this.model_max_length=Q.model_max_length,this.remove_space=Q.remove_space,this.clean_up_tokenization_spaces=Q.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=Q.do_lowercase_and_remove_accent??!1,Q.padding_side&&(this.padding_side=Q.padding_side),this.legacy=!1,this.chat_template=Q.chat_template??null,Array.isArray(this.chat_template)){const ie=Object.create(null);for(const{name:de,template:ve}of this.chat_template){if(typeof de!="string"||typeof ve!="string")throw new Error('Chat template must be a list of objects with "name" and "template" properties');ie[de]=ve}this.chat_template=ie}this._compiled_template_cache=new Map}getToken(...N){for(const Q of N){const ie=this._tokenizer_config[Q];if(ie)if(typeof ie=="object"){if(ie.__type==="AddedToken")return ie.content;throw Error(`Unknown token: ${ie}`)}else return ie}return null}static async from_pretrained(N,{progress_callback:Q=null,config:ie=null,cache_dir:de=null,local_files_only:ve=!1,revision:je="main",legacy:He=null}={}){const We=await d(N,{progress_callback:Q,config:ie,cache_dir:de,local_files_only:ve,revision:je,legacy:He});return new this(...We)}_call(N,{text_pair:Q=null,add_special_tokens:ie=!0,padding:de=!1,truncation:ve=null,max_length:je=null,return_tensor:He=!0,return_token_type_ids:We=null}={}){const Je=Array.isArray(N);let dt;if(Je){if(N.length===0)throw Error("text array must be non-empty");if(Q!==null){if(Array.isArray(Q)){if(N.length!==Q.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");dt=N.map((Et,Rt)=>this._encode_plus(Et,{text_pair:Q[Rt],add_special_tokens:ie,return_token_type_ids:We}))}else dt=N.map(Et=>this._encode_plus(Et,{add_special_tokens:ie,return_token_type_ids:We}))}else{if(N==null)throw Error("text may not be null or undefined");if(Array.isArray(Q))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");dt=[this._encode_plus(N,{text_pair:Q,add_special_tokens:ie,return_token_type_ids:We})]}if(je===null?de==="max_length"?je=this.model_max_length:je=(0,i.max)(dt.map(Et=>Et.input_ids.length))[0]:ve||console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."),je=Math.min(je,this.model_max_length??1/0),de||ve)for(let Et=0;Etje?ve&&Ls(dt[Et],je):de&&xs(dt[Et],je,Rt=>Rt==="input_ids"?this.pad_token_id:0,this.padding_side));const vt={};if(He){if(!(de&&ve)&&dt.some(Rt=>{var kt;for(const Kt of Object.keys(Rt))if(Rt[Kt].length!==((kt=dt[0][Kt])==null?void 0:kt.length))return!0;return!1}))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const Et=[dt.length,dt[0].input_ids.length];for(const Rt of Object.keys(dt[0]))vt[Rt]=new a.Tensor("int64",BigInt64Array.from(dt.flatMap(kt=>kt[Rt]).map(BigInt)),Et)}else{for(const Et of Object.keys(dt[0]))vt[Et]=dt.map(Rt=>Rt[Et]);if(!Je)for(const Et of Object.keys(vt))vt[Et]=vt[Et][0]}return vt}_encode_text(N){if(N===null)return null;const Q=this.added_tokens_splitter.split(N);for(let de=0;de0&&(Q[de-1]=Q[de-1].trimEnd()),ve.rstrip&&de{if(de.length===0)return[];if(this.added_tokens_map.has(de))return[de];if(this.remove_space===!0&&(de=de.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(de=g(de)),this.normalizer!==null&&(de=this.normalizer(de)),de.length===0)return[];const je=this.pre_tokenizer!==null?this.pre_tokenizer(de,{section_index:ve}):[de];return this.model(je)})}_encode_plus(N,{text_pair:Q=null,add_special_tokens:ie=!0,return_token_type_ids:de=null}={}){const{tokens:ve,token_type_ids:je}=this._tokenize_helper(N,{pair:Q,add_special_tokens:ie}),He=this.model.convert_tokens_to_ids(ve),We={input_ids:He,attention_mask:new Array(He.length).fill(1)};return(de??this.return_token_type_ids)&&je&&(We.token_type_ids=je),We}_tokenize_helper(N,{pair:Q=null,add_special_tokens:ie=!1}={}){const de=this._encode_text(N),ve=this._encode_text(Q);return this.post_processor?this.post_processor(de,ve,{add_special_tokens:ie}):{tokens:(0,o.mergeArrays)(de??[],ve??[])}}tokenize(N,{pair:Q=null,add_special_tokens:ie=!1}={}){return this._tokenize_helper(N,{pair:Q,add_special_tokens:ie}).tokens}encode(N,{text_pair:Q=null,add_special_tokens:ie=!0,return_token_type_ids:de=null}={}){return this._encode_plus(N,{text_pair:Q,add_special_tokens:ie,return_token_type_ids:de}).input_ids}batch_decode(N,Q={}){return N instanceof a.Tensor&&(N=N.tolist()),N.map(ie=>this.decode(ie,Q))}decode(N,Q={}){if(N instanceof a.Tensor&&(N=v(N)),!Array.isArray(N)||N.length===0||!(0,o.isIntegralNumber)(N[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(N,Q)}decode_single(N,{skip_special_tokens:Q=!1,clean_up_tokenization_spaces:ie=null}){let de=this.model.convert_ids_to_tokens(N);Q&&(de=de.filter(je=>!this.special_tokens.includes(je)));let ve=this.decoder?this.decoder(de):de.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(ve=ve.replaceAll(this.decoder.end_of_word_suffix," "),Q&&(ve=ve.trim())),(ie??this.clean_up_tokenization_spaces)&&(ve=$(ve)),ve}get_chat_template({chat_template:N=null,tools:Q=null}={}){if(this.chat_template&&typeof this.chat_template=="object"){const ie=this.chat_template;if(N!==null&&Object.hasOwn(ie,N))N=ie[N];else if(N===null)if(Q!==null&&"tool_use"in ie)N=ie.tool_use;else if("default"in ie)N=ie.default;else throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(ie).sort()}.`)}else if(N===null)if(this.chat_template)N=this.chat_template;else throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");return N}apply_chat_template(N,{tools:Q=null,documents:ie=null,chat_template:de=null,add_generation_prompt:ve=!1,tokenize:je=!0,padding:He=!1,truncation:We=!1,max_length:Je=null,return_tensor:dt=!0,return_dict:vt=!1,tokenizer_kwargs:Et={},...Rt}={}){if(de=this.get_chat_template({chat_template:de,tools:Q}),typeof de!="string")throw Error(`chat_template must be a string, but got ${typeof de}`);let kt=this._compiled_template_cache.get(de);kt===void 0&&(kt=new u.Template(de),this._compiled_template_cache.set(de,kt));const Kt=Object.create(null);for(const dr of Ds){const cr=this.getToken(dr);cr&&(Kt[dr]=cr)}const Mr=kt.render({messages:N,add_generation_prompt:ve,tools:Q,documents:ie,...Kt,...Rt});if(je){const dr=this._call(Mr,{add_special_tokens:!1,padding:He,truncation:We,max_length:Je,return_tensor:dt,...Et});return vt?dr:dr.input_ids}return Mr}}class Zr extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Ir extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class ws extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Ft extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class es extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class ts extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class bs extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Xt extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class De extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Qe extends at{}class et extends at{}class Bt extends at{constructor(N,Q){super(N,Q);te(this,"return_token_type_ids",!0);console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class Or extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Pr extends at{}class rs extends at{}class ss extends at{}class Ur extends at{constructor(k,N){super(k,N),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter(Q=>this.languageRegex.test(Q)),this.lang_to_token=Q=>Q}_build_translation_inputs(k,N,Q){return xr(this,k,N,Q)}}class ns extends Ur{}class os extends at{}class Wr extends at{}const yr="▁";class Ys extends at{constructor(N,Q){super(N,Q);te(this,"padding_side","left");this.legacy=Q.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new wt({replacement:yr,add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(N){if(N===null)return null;if(this.legacy||N.length===0)return super._encode_text(N);let Q=super._encode_text(yr+N.replaceAll(yr," "));return Q.length>1&&Q[0]===yr&&this.special_tokens.includes(Q[1])&&(Q=Q.slice(1)),Q}}class vr extends at{}class Ts extends at{}class Es extends at{}class fr extends at{}class zs extends at{}class Zs extends at{}class Ar extends at{}class en extends at{}class Gr extends at{}function xr(he,k,N,Q){if(!("language_codes"in he)||!Array.isArray(he.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in he)||!(he.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in he)||typeof he.lang_to_token!="function")throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const ie=Q.src_lang,de=Q.tgt_lang;if(!he.language_codes.includes(de))throw new Error(`Target language code "${de}" is not valid. Must be one of: {${he.language_codes.join(", ")}}`);if(ie!==void 0){if(!he.language_codes.includes(ie))throw new Error(`Source language code "${ie}" is not valid. Must be one of: {${he.language_codes.join(", ")}}`);for(const ve of he.post_processor.config.single)if("SpecialToken"in ve&&he.languageRegex.test(ve.SpecialToken.id)){ve.SpecialToken.id=he.lang_to_token(ie);break}}return Q.forced_bos_token_id=he.model.convert_tokens_to_ids([he.lang_to_token(de)])[0],he._call(k,N)}class Ps extends at{constructor(k,N){super(k,N),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(Q=>this.languageRegex.test(Q)),this.lang_to_token=Q=>Q}_build_translation_inputs(k,N,Q){return xr(this,k,N,Q)}}class ur extends at{constructor(k,N){super(k,N),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter(Q=>this.languageRegex.test(Q)).map(Q=>Q.slice(2,-2)),this.lang_to_token=Q=>`__${Q}__`}_build_translation_inputs(k,N,Q){return xr(this,k,N,Q)}}class _r extends at{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(k,{return_timestamps:N=!1,return_language:Q=!1,time_precision:ie=null,force_full_sequences:de=!0}={}){if(ie===null)throw Error("Must specify time_precision");let ve=null;const je=N==="word";function He(){return{language:ve,timestamp:[null,null],text:""}}const We=[];let Je=He(),dt=0;const vt=this.timestamp_begin,Rt=vt+1500;let kt=[],Kt=[],Mr=!1,dr=null;const cr=new Set(this.all_special_ids);for(const Dt of k){const rr=Dt.tokens,gr=je?Dt.token_timestamps:null;let Hr=null,Lr=vt;if("stride"in Dt){const[or,Vt,Zt]=Dt.stride;if(dt-=Vt,dr=or-Zt,Vt&&(Lr=Vt/ie+vt),Zt)for(let er=rr.length-1;er>=0;--er){const tr=Number(rr[er]);if(tr>=vt){if(Hr!==null&&(tr-vt)*ie=vt&&Vt<=Rt){const Zt=(Vt-vt)*ie+dt,er=(0,i.round)(Zt,2);if(Hr!==null&&Vt>=Hr)Mr=!0;else if(Mr||kt.length>0&&Vt0?(kt.push(Yt),je&&Kt.push(zr)):kt.every(or=>or.length===0)&&(Je=He(),kt=[],Yt=[],Kt=[],zr=[])}if(kt.length>0){if(de&&N)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[Dt,rr]=this.findLongestCommonSequence(kt,Kt),gr=this.decode(Dt);Je.text=gr,je&&(Je.words=this.collateWordTimestamps(Dt,rr,ve)),We.push(Je)}let Nt=Object.create(null);const Kr=We.map(Dt=>Dt.text).join("");if(N||Q){for(let Dt=0;Dt0;let je=ve?[]:null,He=ve?N[0]:null;for(let We=1;WeVt===Lr[Zt]&&He[Kr+Zt]<=N[We][gr+Zt]).length:Yt=rr.filter((Vt,Zt)=>Vt===Lr[Zt]).length;const zr=Nt/1e4,or=Yt/Nt+zr;Yt>1&&or>dt&&(dt=or,vt=[Kr,Dt,gr,Hr])}const[Rt,kt,Kt,Mr]=vt,dr=Math.floor((kt+Rt)/2),cr=Math.floor((Mr+Kt)/2);de.push(...Q.slice(0,dr)),Q=Je.slice(cr),ie=Q.length,ve&&(je.push(...He.slice(0,dr)),He=N[We].slice(cr))}return de.push(...Q),ve?(je.push(...He),[de,je]):[de,[]]}collateWordTimestamps(k,N,Q){const[ie,de,ve]=this.combineTokensIntoWords(k,Q),je=[];for(let He=0;He=ie){const je=((ve-ie)*Q).toFixed(2);de.push(`<|${je}|>`),de.push([])}else de[de.length-1].push(ve);return de=de.map(ve=>typeof ve=="string"?ve:super.decode(ve,N)),de.join("")}splitTokensOnUnicode(k){const N=this.decode(k,{decode_with_timestamps:!0}),Q="�",ie=[],de=[],ve=[];let je=[],He=[],We=0;for(let Je=0;Je=this.model.tokens_to_ids.get("<|endoftext|>"),Rt=Je.startsWith(" "),kt=Je.trim(),Kt=He.test(kt);if(Et||Rt||Kt||de.length===0)de.push(Je),ve.push(dt),je.push(vt);else{const Mr=de.length-1;de[Mr]+=Je,ve[Mr].push(...dt),je[Mr].push(...vt)}}return[de,ve,je]}mergePunctuations(k,N,Q,ie,de){const ve=structuredClone(k),je=structuredClone(N),He=structuredClone(Q);let We=ve.length-2,Je=ve.length-1;for(;We>=0;)ve[We].startsWith(" ")&&ie.includes(ve[We].trim())?(ve[Je]=ve[We]+ve[Je],je[Je]=(0,o.mergeArrays)(je[We],je[Je]),He[Je]=(0,o.mergeArrays)(He[We],He[Je]),ve[We]="",je[We]=[],He[We]=[]):Je=We,--We;for(We=0,Je=1;Jedt),je.filter(dt=>dt.length>0),He.filter(dt=>dt.length>0)]}}class Dr extends at{}class tn extends at{}class rn extends at{}class sn extends at{constructor(k,N){super(k,N),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(Q=>this.languageRegex.test(Q)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(k){if(k===null)return null;const[N,...Q]=k.trim().split(this.languageRegex);if(Q.length===0)return super._encode_text(N);if(Q.length===2){const[ie,de]=Q;return this.supported_language_codes.includes(ie)||console.warn(`Unsupported language code "${ie}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,o.mergeArrays)([ie],super._encode_text(de))}}}class nn extends at{}class on extends at{}class Ms extends at{}class an extends at{}class Bs extends at{}class ln extends at{constructor(k,N){super(k,N),this.decoder=new lt({})}}class un extends at{}class ys extends at{}class dn{static async from_pretrained(k,{progress_callback:N=null,config:Q=null,cache_dir:ie=null,local_files_only:de=!1,revision:ve="main",legacy:je=null}={}){var vt;const[He,We]=await d(k,{progress_callback:N,config:Q,cache_dir:ie,local_files_only:de,revision:ve,legacy:je}),Je=((vt=We.tokenizer_class)==null?void 0:vt.replace(/Fast$/,""))??"PreTrainedTokenizer";let dt=this.TOKENIZER_CLASS_MAPPING[Je];return dt||(console.warn(`Unknown tokenizer class "${Je}", attempting to construct from base class.`),dt=at),new dt(He,We)}}te(dn,"TOKENIZER_CLASS_MAPPING",{T5Tokenizer:Pr,DistilBertTokenizer:Qe,CamembertTokenizer:et,DebertaTokenizer:es,DebertaV2Tokenizer:ts,BertTokenizer:Zr,HerbertTokenizer:bs,ConvBertTokenizer:Xt,RoFormerTokenizer:De,XLMTokenizer:Bt,ElectraTokenizer:Or,MobileBertTokenizer:ws,SqueezeBertTokenizer:Ft,AlbertTokenizer:Ir,GPT2Tokenizer:rs,BartTokenizer:ss,MBartTokenizer:Ur,MBart50Tokenizer:ns,RobertaTokenizer:os,WhisperTokenizer:_r,CodeGenTokenizer:Dr,CLIPTokenizer:tn,SiglipTokenizer:rn,MarianTokenizer:sn,BloomTokenizer:Wr,NllbTokenizer:Ps,M2M100Tokenizer:ur,LlamaTokenizer:Ys,CodeLlamaTokenizer:vr,XLMRobertaTokenizer:Ts,MPNetTokenizer:Es,FalconTokenizer:fr,GPTNeoXTokenizer:zs,EsmTokenizer:Zs,Wav2Vec2CTCTokenizer:nn,BlenderbotTokenizer:on,BlenderbotSmallTokenizer:Ms,SpeechT5Tokenizer:an,NougatTokenizer:Bs,VitsTokenizer:ln,Qwen2Tokenizer:Ar,GemmaTokenizer:en,Grok1Tokenizer:Gr,CohereTokenizer:un,MgpstrTokenizer:ys,PreTrainedTokenizer:at})},"./src/utils/audio.js":(e,r,t)=>{t.r(r),t.d(r,{RawAudio:()=>G,hamming:()=>c,hanning:()=>d,mel_filter_bank:()=>C,read_audio:()=>u,spectrogram:()=>S,window_function:()=>A});var s=t("./src/utils/hub.js"),o=t("./src/utils/maths.js"),n=t("./src/utils/core.js"),i=t("./src/env.js"),a=t("?7a2c"),l=t("./src/utils/tensor.js");async function u(j,ee){if(typeof AudioContext>"u")throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const H=await(await(0,s.getFile)(j)).arrayBuffer(),Z=new AudioContext({sampleRate:ee});typeof ee>"u"&&console.warn(`No sampling rate provided, using default of ${Z.sampleRate}Hz.`);const X=await Z.decodeAudioData(H);let oe;if(X.numberOfChannels===2){const me=Math.sqrt(2),ae=X.getChannelData(0),V=X.getChannelData(1);oe=new Float32Array(ae.length);for(let F=0;F2595*Math.log10(1+j/700),kaldi:j=>1127*Math.log(1+j/700),slaney:(j,ee=1e3,H=15,Z=27/Math.log(6.4))=>j>=ee?H+Math.log(j/ee)*Z:3*j/200};function f(j,ee="htk"){const H=_[ee];if(!H)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof j=="number"?H(j):j.map(Z=>H(Z))}const v={htk:j=>700*(10**(j/2595)-1),kaldi:j=>700*(Math.exp(j/1127)-1),slaney:(j,ee=1e3,H=15,Z=Math.log(6.4)/27)=>j>=H?ee*Math.exp(Z*(j-H)):200*j/3};function $(j,ee="htk"){const H=v[ee];if(!H)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof j=="number"?H(j):j.map(Z=>H(Z))}function w(j,ee){const H=Float64Array.from({length:ee.length-1},(me,ae)=>ee[ae+1]-ee[ae]),Z=Array.from({length:j.length},()=>new Array(ee.length));for(let me=0;menew Array(j.length));for(let me=0;mej+Z*oe)}function C(j,ee,H,Z,X,oe=null,me="htk",ae=!1){if(oe!==null&&oe!=="slaney")throw new Error('norm must be one of null or "slaney"');if(j<2)throw new Error(`Require num_frequency_bins: ${j} >= 2`);if(H>Z)throw new Error(`Require min_frequency: ${H} <= max_frequency: ${Z}`);const V=f(H,me),F=f(Z,me),W=g(V,F,ee+2);let re=$(W,me),fe;if(ae){const ce=X/((j-1)*2);fe=f(Float64Array.from({length:j},($e,Ue)=>Ue*ce),me),re=W}else fe=g(0,Math.floor(X/2),j);const se=w(fe,re);if(oe!==null&&oe==="slaney")for(let ce=0;ceX)throw Error(`frame_length (${H}) may not be larger than fft_length (${X})`);if(xe!==H)throw new Error(`Length of the window (${xe}) must equal frame_length (${H})`);if(Z<=0)throw new Error("hop_length must be greater than zero");if(oe===null&&W!==null)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(me){if(ae!=="reflect")throw new Error(`pad_mode="${ae}" not implemented yet.`);const ye=Math.floor((X-1)/2)+1;j=E(j,ye,ye)}let Me=Math.floor(1+Math.floor((j.length-H)/Z));we!==null&&MeMe?R&&(Fe=q):Fe=Ae=q);const ze=new o.FFT(X),Ve=new Float64Array(X),O=new Float64Array(ze.outputBufferSize),Y=new Float32Array(Se*Fe);for(let ye=0;ye=1;--Ie)Ve[Ie]-=F*Ve[Ie-1];Ve[0]*=1-F}for(let Ie=0;IeMath.pow(ae,.85));break;default:throw new Error(`Unknown window type ${ee}.`)}if(H&&(me=me.subarray(0,j)),Z===null)return me;if(j>Z)throw new Error(`Length of the window (${j}) may not be larger than frame_length (${Z})`);return me}function B(j,ee){let H=44;const Z=new ArrayBuffer(H+j.length*4),X=new DataView(Z);K(X,0,"RIFF"),X.setUint32(4,36+j.length*4,!0),K(X,8,"WAVE"),K(X,12,"fmt "),X.setUint32(16,16,!0),X.setUint16(20,3,!0),X.setUint16(22,1,!0),X.setUint32(24,ee,!0),X.setUint32(28,ee*4,!0),X.setUint16(32,4,!0),X.setUint16(34,32,!0),K(X,36,"data"),X.setUint32(40,j.length*4,!0);for(let oe=0;oe{let oe=await X.arrayBuffer();a.writeFileSync(Z,Buffer.from(oe))};else throw new Error("Unable to save because filesystem is disabled in this environment.");await H(ee,this.toBlob())}}},"./src/utils/constants.js":(e,r,t)=>{t.r(r),t.d(r,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>o,FEATURE_EXTRACTOR_NAME:()=>n,GENERATION_CONFIG_NAME:()=>u,GITHUB_ISSUE_URL:()=>s,IMAGE_PROCESSOR_NAME:()=>i,PROCESSOR_NAME:()=>a});const s="https://github.com/huggingface/transformers.js/issues/new/choose",o="config.json",n="preprocessor_config.json",i=n,a="processor_config.json",l="chat_template.json",u="generation_config.json"},"./src/utils/core.js":(e,r,t)=>{t.r(r),t.d(r,{calculateDimensions:()=>u,calculateReflectOffset:()=>_,count:()=>w,dispatchCallback:()=>s,escapeRegExp:()=>n,isIntegralNumber:()=>a,isNullishDimension:()=>l,isTypedArray:()=>i,len:()=>$,mergeArrays:()=>d,pick:()=>v,pop:()=>p,product:()=>c,reverseDictionary:()=>o,saveBlob:()=>f});function s(g,C){g&&g(C)}function o(g){return Object.fromEntries(Object.entries(g).map(([C,E])=>[E,C]))}function n(g){return g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i(g){var C,E,y;return((y=(E=(C=g==null?void 0:g.prototype)==null?void 0:C.__proto__)==null?void 0:E.constructor)==null?void 0:y.name)==="TypedArray"}function a(g){return Number.isInteger(g)||typeof g=="bigint"}function l(g){return g==null||g===-1}function u(g){const C=[];let E=g;for(;Array.isArray(E);)C.push(E.length),E=E[0];return C}function p(g,C,E=void 0){const y=g[C];if(y!==void 0)return delete g[C],y;if(E===void 0)throw Error(`Key ${C} does not exist in object.`);return E}function d(...g){return Array.prototype.concat.apply([],g)}function c(...g){return g.reduce((C,E)=>C.flatMap(y=>E.map(b=>[y,b])))}function _(g,C){return Math.abs((g+C)%(2*C)-C)}function f(g,C){const E=URL.createObjectURL(C),y=document.createElement("a");y.href=E,y.download=g,y.click(),y.remove(),URL.revokeObjectURL(E)}function v(g,C){return Object.assign({},...C.map(E=>{if(g[E]!==void 0)return{[E]:g[E]}}))}function $(g){let C=0;for(const E of g)++C;return C}function w(g,C){let E=0;for(const y of g)y===C&&++E;return E}},"./src/utils/data-structures.js":(e,r,t)=>{t.r(r),t.d(r,{CharTrie:()=>o,DictionarySplitter:()=>l,LRUCache:()=>u,PriorityQueue:()=>s,TokenLattice:()=>i});class s{constructor(d=(_,f)=>_>f,c=1/0){this._heap=[],this._comparator=d,this._maxSize=c}get size(){return this._heap.length}isEmpty(){return this.size===0}peek(){return this._heap[0]}push(...d){return this.extend(d)}extend(d){for(const c of d)if(this.size0&&this._swap(0,c),this._heap.pop(),this._siftDown(),d}replace(d){const c=this.peek();return this._heap[0]=d,this._siftDown(),c}_parent(d){return(d+1>>>1)-1}_left(d){return(d<<1)+1}_right(d){return d+1<<1}_greater(d,c){return this._comparator(this._heap[d],this._heap[c])}_swap(d,c){const _=this._heap[d];this._heap[d]=this._heap[c],this._heap[c]=_}_siftUp(){this._siftUpFrom(this.size-1)}_siftUpFrom(d){for(;d>0&&this._greater(d,this._parent(d));)this._swap(d,this._parent(d)),d=this._parent(d)}_siftDown(){let d=0;for(;this._left(d)[]),this.endNodes=Array.from({length:this.len+1},()=>[]);const f=new a(this.bosTokenId,0,0,0,0),v=new a(this.eosTokenId,1,this.len,0,0);this.nodes.push(f.clone()),this.nodes.push(v.clone()),this.beginNodes[this.len].push(v),this.endNodes[0].push(f)}insert(d,c,_,f){const v=this.nodes.length,$=new a(f,v,d,c,_);this.beginNodes[d].push($),this.endNodes[d+c].push($),this.nodes.push($)}viterbi(){const d=this.len;let c=0;for(;c<=d;){if(this.beginNodes[c].length==0)return[];for(let w of this.beginNodes[c]){w.prev=null;let g=0,C=null;for(let E of this.endNodes[c]){const y=E.backtraceScore+w.score;(C===null||y>g)&&(C=E.clone(),g=y)}if(C!==null)w.prev=C,w.backtraceScore=g;else return[]}++c}const _=[],v=this.beginNodes[d][0].prev;if(v===null)return[];let $=v.clone();for(;$.prev!==null;)_.push($.clone()),$=$.clone().prev.clone();return _.reverse(),_}piece(d){return this.chars.slice(d.pos,d.pos+d.length).join("")}tokens(){return this.viterbi().map(c=>this.piece(c))}tokenIds(){return this.viterbi().map(c=>c.tokenId)}}class a{constructor(d,c,_,f,v){this.tokenId=d,this.nodeId=c,this.pos=_,this.length=f,this.score=v,this.prev=null,this.backtraceScore=0}clone(){const d=new a(this.tokenId,this.nodeId,this.pos,this.length,this.score);return d.prev=this.prev,d.backtraceScore=this.backtraceScore,d}}class l{constructor(d){this.trie=this._buildTrie(d)}_buildTrie(d){var _;const c=Object.create(null);for(const f of d){let v=c;for(let $=0;$f&&c.push(d.slice(f,v)),c.push(w),v+=w.length,f=v):++v}return f<_&&c.push(d.slice(f)),c}}class u{constructor(d){this.capacity=d,this.cache=new Map}get(d){if(!this.cache.has(d))return;const c=this.cache.get(d);return this.cache.delete(d),this.cache.set(d,c),c}put(d,c){this.cache.has(d)&&this.cache.delete(d),this.cache.set(d,c),this.cache.size>this.capacity&&this.cache.delete(this.cache.keys().next().value)}clear(){this.cache.clear()}}},"./src/utils/devices.js":(e,r,t)=>{t.r(r),t.d(r,{DEVICE_TYPES:()=>s});const s=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"})},"./src/utils/dtypes.js":(e,r,t)=>{t.r(r),t.d(r,{DATA_TYPES:()=>i,DEFAULT_DEVICE_DTYPE_MAPPING:()=>a,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>n});var s=t("./src/env.js"),o=t("./src/utils/devices.js");const n=function(){let u;return async function(){if(u===void 0)if(!s.apis.IS_WEBGPU_AVAILABLE)u=!1;else try{u=(await navigator.gpu.requestAdapter()).features.has("shader-f16")}catch{u=!1}return u}}(),i=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16"}),a=Object.freeze({[o.DEVICE_TYPES.wasm]:i.q8}),l=Object.freeze({[i.fp32]:"",[i.fp16]:"_fp16",[i.int8]:"_int8",[i.uint8]:"_uint8",[i.q8]:"_quantized",[i.q4]:"_q4",[i.q4f16]:"_q4f16",[i.bnb4]:"_bnb4"})},"./src/utils/generic.js":(e,r,t)=>{t.r(r),t.d(r,{Callable:()=>s});const s=class{constructor(){let o=function(...n){return o._call(...n)};return Object.setPrototypeOf(o,new.target.prototype)}_call(...o){throw Error("Must implement _call method in subclass")}}},"./src/utils/hub.js":(e,r,t)=>{t.r(r),t.d(r,{MAX_EXTERNAL_DATA_CHUNKS:()=>a,getFile:()=>_,getModelFile:()=>g,getModelJSON:()=>C});var s=t("?7a2c"),o=t("?a42a"),n=t("./src/env.js"),i=t("./src/utils/core.js");const a=100,l={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};class u{constructor(x){if(this.filePath=x,this.headers=new Headers,this.exists=s.existsSync(x),this.exists){this.status=200,this.statusText="OK";let S=s.statSync(x);this.headers.set("content-length",S.size.toString()),this.updateContentType();const A=s.createReadStream(x);this.body=new ReadableStream({start(B){A.on("data",K=>B.enqueue(K)),A.on("end",()=>B.close()),A.on("error",K=>B.error(K))},cancel(){A.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const x=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",l[x]??"application/octet-stream")}clone(){let x=new u(this.filePath);return x.exists=this.exists,x.status=this.status,x.statusText=this.statusText,x.headers=new Headers(this.headers),x}async arrayBuffer(){return(await s.promises.readFile(this.filePath)).buffer}async blob(){const x=await s.promises.readFile(this.filePath);return new Blob([x],{type:this.headers.get("content-type")})}async text(){return await s.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function p(b,x=null,S=null){let A;try{A=new URL(b)}catch{return!1}return!(x&&!x.includes(A.protocol)||S&&!S.includes(A.hostname))}const d=/^(\b[\w\-.]+\b\/)?\b[\w\-.]{1,96}\b$/;function c(b){return!(!d.test(b)||b.includes("..")||b.includes("--")||b.endsWith(".git")||b.endsWith(".ipynb"))}async function _(b){var x;if(n.env.useFS&&!p(b,["http:","https:","blob:"]))return new u(b.toString());if(typeof process<"u"&&((x=process==null?void 0:process.release)==null?void 0:x.name)==="node"){const S=!!(As!=null&&As.TESTING_REMOTELY),A=n.env.version,B=new Headers;if(B.set("User-Agent",`transformers.js/${A}; is_ci/${S};`),p(b,["http:","https:"],["huggingface.co","hf.co"])){const G=(As==null?void 0:As.HF_TOKEN)??(As==null?void 0:As.HF_ACCESS_TOKEN);G&&B.set("Authorization",`Bearer ${G}`)}return fetch(b,{headers:B})}else return fetch(b)}const f={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};function v(b,x,S){if(!S)return null;const A=f[b]??`Error (${b}) occurred while trying to load file`;throw Error(`${A}: "${x}".`)}class ${constructor(x){this.path=x}async match(x){let S=o.join(this.path,x),A=new u(S);if(A.exists)return A}async put(x,S,A=void 0){let B=o.join(this.path,x);try{const K=S.headers.get("Content-Length"),G=parseInt(K??"0");let j=0;await s.promises.mkdir(o.dirname(B),{recursive:!0});const ee=s.createWriteStream(B),H=S.body.getReader();for(;;){const{done:Z,value:X}=await H.read();if(Z)break;await new Promise((me,ae)=>{ee.write(X,V=>{if(V){ae(V);return}me()})}),j+=X.length;const oe=G?j/G*100:0;A==null||A({progress:oe,loaded:j,total:G})}ee.close()}catch(K){try{await s.promises.unlink(B)}catch{}throw K}}}async function w(b,...x){for(let S of x)try{let A=await b.match(S);if(A)return A}catch{continue}}async function g(b,x,S=!0,A={},B=!1){if(!n.env.allowLocalModels){if(A.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!n.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}(0,i.dispatchCallback)(A.progress_callback,{status:"initiate",name:b,file:x});let K;if(!K&&n.env.useCustomCache){if(!n.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!n.env.customCache.match||!n.env.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");K=n.env.customCache}if(!K&&n.env.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");try{K=await caches.open("transformers-cache")}catch(re){console.warn("An error occurred while opening the browser cache:",re)}}if(!K&&n.env.useFSCache){if(!n.apis.IS_FS_AVAILABLE)throw Error("File System Cache is not available in this environment.");K=new $(A.cache_dir??n.env.cacheDir)}const G=A.revision??"main",j=y(b,x),ee=c(b),H=ee?y(n.env.localModelPath,j):j,Z=y(n.env.remoteHost,n.env.remotePathTemplate.replaceAll("{model}",b).replaceAll("{revision}",encodeURIComponent(G)),x);let X;const oe=K instanceof $?G==="main"?j:y(b,G,x):Z;let me=!1,ae;K&&(ae=await w(K,H,oe));const V=ae!==void 0;if(ae===void 0){if(n.env.allowLocalModels)if(p(j,["http:","https:"])){if(A.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${j}.`);if(!n.env.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${j}.`)}else try{ae=await _(H),X=H}catch(fe){console.warn(`Unable to load from local path "${H}": "${fe}"`)}if(ae===void 0||ae.status===404){if(A.local_files_only||!n.env.allowRemoteModels){if(S)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${H}".`);return null}if(!ee)throw Error(`Local file missing at "${H}" and download aborted due to invalid model ID "${b}".`);if(ae=await _(Z),ae.status!==200)return v(ae.status,Z,S);X=oe}me=K&&typeof Response<"u"&&ae instanceof Response&&ae.status===200}(0,i.dispatchCallback)(A.progress_callback,{status:"download",name:b,file:x});let F;if(!(n.apis.IS_NODE_ENV&&B)){let re;A.progress_callback?V&&typeof navigator<"u"&&/firefox/i.test(navigator.userAgent)?(re=new Uint8Array(await ae.arrayBuffer()),(0,i.dispatchCallback)(A.progress_callback,{status:"progress",name:b,file:x,progress:100,loaded:re.length,total:re.length})):re=await E(ae,fe=>{(0,i.dispatchCallback)(A.progress_callback,{status:"progress",name:b,file:x,...fe})}):re=new Uint8Array(await ae.arrayBuffer()),F=re}if(me&&X&&await K.match(X)===void 0&&(F?await K.put(X,new Response(F,{headers:ae.headers})).catch(re=>{console.warn(`Unable to add response to browser cache: ${re}.`)}):await K.put(X,ae,A.progress_callback)),(0,i.dispatchCallback)(A.progress_callback,{status:"done",name:b,file:x}),F){if(!n.apis.IS_NODE_ENV&&B)throw new Error("Cannot return path in a browser environment.");return F}if(ae instanceof u)return ae.filePath;const W=await(K==null?void 0:K.match(X));if(W instanceof u)return W.filePath;if(W instanceof Response)return new Uint8Array(await W.arrayBuffer());if(typeof W=="string")return W;throw new Error("Unable to get model file path or buffer.")}async function C(b,x,S=!0,A={}){const B=await g(b,x,S,A,!1);if(B===null)return{};const G=new TextDecoder("utf-8").decode(B);return JSON.parse(G)}async function E(b,x){const S=b.headers.get("Content-Length");S===null&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let A=parseInt(S??"0"),B=new Uint8Array(A),K=0;const G=b.body.getReader();async function j(){const{done:ee,value:H}=await G.read();if(ee)return;const Z=K+H.length;if(Z>A){A=Z;const oe=new Uint8Array(A);oe.set(B),B=oe}B.set(H,K),K=Z;const X=K/A*100;return x({progress:X,loaded:K,total:A}),j()}return await j(),B}function y(...b){return b=b.map((x,S)=>(S&&(x=x.replace(new RegExp("^/"),"")),S!==b.length-1&&(x=x.replace(new RegExp("/$"),"")),x)),b.join("/")}},"./src/utils/image.js":(e,r,t)=>{t.r(r),t.d(r,{RawImage:()=>f,load_image:()=>v});var s=t("./src/utils/core.js"),o=t("./src/utils/hub.js"),n=t("./src/env.js"),i=t("./src/utils/tensor.js"),a=t("?2b25");let l,u,p;const d=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV;if(d)l=($,w)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas($,w)},p=self.createImageBitmap,u=self.ImageData;else if(a)p=async $=>{const g=(await $.metadata()).channels,{data:C,info:E}=await $.rotate().raw().toBuffer({resolveWithObject:!0}),y=new f(new Uint8ClampedArray(C),E.width,E.height,E.channels);return g!==void 0&&g!==E.channels&&y.convert(g),y};else throw new Error("Unable to load image processing library.");const c={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},_=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class f{constructor(w,g,C,E){this.data=w,this.width=g,this.height=C,this.channels=E}get size(){return[this.width,this.height]}static async read(w){if(w instanceof f)return w;if(typeof w=="string"||w instanceof URL)return await this.fromURL(w);if(w instanceof Blob)return await this.fromBlob(w);if(typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&w instanceof OffscreenCanvas)return this.fromCanvas(w);throw new Error(`Unsupported input type: ${typeof w}`)}static fromCanvas(w){if(!d)throw new Error("fromCanvas() is only supported in browser environments.");const C=w.getContext("2d").getImageData(0,0,w.width,w.height).data;return new f(C,w.width,w.height,4)}static async fromURL(w){const g=await(0,o.getFile)(w);if(g.status!==200)throw new Error(`Unable to read image from "${w}" (${g.status} ${g.statusText})`);const C=await g.blob();return this.fromBlob(C)}static async fromBlob(w){if(d){const g=await p(w),C=l(g.width,g.height).getContext("2d");return C.drawImage(g,0,0),new this(C.getImageData(0,0,g.width,g.height).data,g.width,g.height,4)}else{const g=a(await w.arrayBuffer());return await p(g)}}static fromTensor(w,g="CHW"){if(w.dims.length!==3)throw new Error(`Tensor should have 3 dimensions, but has ${w.dims.length} dimensions.`);if(g==="CHW")w=w.transpose(1,2,0);else if(g!=="HWC")throw new Error(`Unsupported channel format: ${g}`);if(!(w.data instanceof Uint8ClampedArray||w.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${w.type}`);switch(w.dims[2]){case 1:case 2:case 3:case 4:return new f(w.data,w.dims[1],w.dims[0],w.dims[2]);default:throw new Error(`Unsupported number of channels: ${w.dims[2]}`)}}grayscale(){if(this.channels===1)return this;const w=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let g=0,C=0;g=0?S=C:B=-C,E>=0?A=E:K=-E,x.drawImage(b,S,A,w,g,B,K,w,g),new f(x.getImageData(0,0,w,g).data,w,g,4).convert(y)}else{let y=this.toSharp();if(C>=0&&E>=0)y=y.extract({left:Math.floor(C),top:Math.floor(E),width:w,height:g});else if(C<=0&&E<=0){const b=Math.floor(-E),x=Math.floor(-C);y=y.extend({top:b,left:x,right:w-this.width-x,bottom:g-this.height-b})}else{let b=[0,0],x=0;E<0?(b[0]=Math.floor(-E),b[1]=g-this.height-b[0]):x=Math.floor(E);let S=[0,0],A=0;C<0?(S[0]=Math.floor(-C),S[1]=w-this.width-S[0]):A=Math.floor(C),y=y.extend({top:b[0],bottom:b[1],left:S[0],right:S[1]}).extract({left:A,top:x,width:w,height:g})}return await p(y)}}async toBlob(w="image/png",g=1){if(!d)throw new Error("toBlob() is only supported in browser environments.");return await this.toCanvas().convertToBlob({type:w,quality:g})}toTensor(w="CHW"){let g=new i.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if(w!=="HWC")if(w==="CHW")g=g.permute(2,0,1);else throw new Error(`Unsupported channel format: ${w}`);return g}toCanvas(){if(!d)throw new Error("toCanvas() is only supported in browser environments.");const w=this.clone().rgba(),g=l(w.width,w.height),C=new u(w.data,w.width,w.height);return g.getContext("2d").putImageData(C,0,0),g}split(){const{data:w,width:g,height:C,channels:E}=this,y=w.constructor,b=w.length/E,x=Array.from({length:E},()=>new y(b));for(let S=0;Snew f(S,g,C,1))}_update(w,g,C,E=null){return this.data=w,this.width=g,this.height=C,E!==null&&(this.channels=E),this}clone(){return new f(this.data.slice(),this.width,this.height,this.channels)}convert(w){if(this.channels===w)return this;switch(w){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(w){if(d){if(n.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const g=w.split(".").pop().toLowerCase(),C=_.get(g)??"image/png",E=await this.toBlob(C);(0,s.saveBlob)(w,E)}else{if(n.apis.IS_FS_AVAILABLE)return await this.toSharp().toFile(w);throw new Error("Unable to save the image because filesystem is disabled in this environment.")}}toSharp(){if(d)throw new Error("toSharp() is only supported in server-side environments.");return a(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}const v=f.read.bind(f)},"./src/utils/maths.js":(e,r,t)=>{t.r(r),t.d(r,{FFT:()=>v,bankers_round:()=>g,cos_sim:()=>l,dot:()=>a,dynamic_time_warping:()=>C,interpolate_data:()=>s,log_softmax:()=>i,magnitude:()=>u,max:()=>d,medianFilter:()=>$,min:()=>p,permute_data:()=>o,round:()=>w,softmax:()=>n});function s(E,[y,b,x],[S,A],B="bilinear",K=!1){const G=A/x,j=S/b,ee=new E.constructor(S*A*y),H=b*x,Z=S*A;for(let X=0;X=0;--K)S[K]=G,x[K]=y[b[K]],G*=x[K];const A=b.map((K,G)=>S[b.indexOf(G)]),B=new E.constructor(E.length);for(let K=0;K=0;--j)G+=ee%y[j]*A[j],ee=Math.floor(ee/y[j]);B[G]=E[K]}return[B,x]}function n(E){const y=d(E)[0],b=E.map(A=>Math.exp(A-y)),x=b.reduce((A,B)=>A+B,0);return b.map(A=>A/x)}function i(E){const y=d(E)[0];let b=0;for(let A=0;AA-y-x)}function a(E,y){let b=0;for(let x=0;xy+b*b,0))}function p(E){if(E.length===0)throw Error("Array must not be empty");let y=E[0],b=0;for(let x=1;xy&&(y=E[x],b=x);return[y,b]}function c(E){return E>0&&(E&E-1)===0}class _{constructor(y){if(this.size=y|0,this.size<=1||!c(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=y<<1,this.table=new Float64Array(this.size*2);for(let x=0;xx;x<<=1)++b;this._width=b%2===0?b-1:b,this._bitrev=new Int32Array(1<>>S&3)<>>1);for(let S=0;S>>1]=y[S];return x}toComplexArray(y,b){const x=b||this.createComplexArray();for(let S=0;S>>1],x[S+1]=0;return x}transform(y,b){if(y===b)throw new Error("Input and output buffers must be different");this._transform4(y,b,1)}realTransform(y,b){if(y===b)throw new Error("Input and output buffers must be different");this._realTransform4(y,b,1)}inverseTransform(y,b){if(y===b)throw new Error("Input and output buffers must be different");this._transform4(y,b,-1);for(let x=0;x>=2;B>=2;B>>=2){K=S/B<<1;const Z=K>>>2;for(G=0;G>>1,B>>>1)}else for(G=0,j=0;G>>1,B>>>1,x)}const H=this.table;for(B>>=2;B>=2;B>>=2){K=S/B<<1;const X=K>>>1,oe=X>>>1,me=oe>>>1;for(G=0;G>>1;for(let X=2;X>1;++ee){const H=(ee+1-y)**2/2,Z=Math.sqrt(G**2+j**2)**H,X=H*Math.atan2(j,G),oe=2*ee;A[oe]=Z*Math.cos(X),A[oe+1]=Z*Math.sin(X),B[oe]=A[oe],B[oe+1]=-A[oe+1]}this._slicedChirpBuffer=A.subarray(b,x),this._f=new _(S>>1),this._f.transform(this._chirpBuffer,B)}_transform(y,b,x){const S=this._buffer1,A=this._buffer2,B=this._outBuffer1,K=this._outBuffer2,G=this._chirpBuffer,j=this._slicedChirpBuffer,ee=this._a;if(x)for(let H=0;H>1,oe=b[X];S[H]=oe*j[H],S[Z]=oe*j[Z]}else for(let H=0;H=E.length&&(G=2*(E.length-1)-G),x[B++]=E[G]}x.sort(),b[A]=x[S]}return b}function w(E,y){const b=Math.pow(10,y);return Math.round(E*b)/b}function g(E){const y=Math.round(E);return Math.abs(E)%1===.5?y%2===0?y:y-1:y}function C(E){const y=E.length,b=E[0].length,x=[y+1,b+1],S=Array.from({length:x[0]},()=>Array(x[1]).fill(1/0));S[0][0]=0;const A=Array.from({length:x[0]},()=>Array(x[1]).fill(-1));for(let ee=1;ee0||K>0;)switch(G.push(B-1),j.push(K-1),A[B][K]){case 0:--B,--K;break;case 1:--B;break;case 2:--K;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${B}, ${K}]. Please file a bug report.`)}return G.reverse(),j.reverse(),[G,j]}},"./src/utils/tensor.js":(e,r,t)=>{t.r(r),t.d(r,{DataTypeMap:()=>i,Tensor:()=>a,cat:()=>b,full:()=>j,full_like:()=>ee,interpolate:()=>p,interpolate_4d:()=>d,layer_norm:()=>g,matmul:()=>c,mean:()=>B,mean_pooling:()=>w,ones:()=>H,ones_like:()=>Z,permute:()=>u,quantize_embeddings:()=>ae,rand:()=>me,rfft:()=>_,slice:()=>$,stack:()=>x,std_mean:()=>A,topk:()=>f,zeros:()=>X,zeros_like:()=>oe});var s=t("./src/utils/maths.js"),o=t("./src/backends/onnx.js"),n=t("./src/ops/registry.js");const i=Object.freeze({float32:Float32Array,float16:typeof Float16Array<"u"?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array});class a{constructor(...F){te(this,"ort_tensor");return(0,o.isONNXTensor)(F[0])?this.ort_tensor=F[0]:this.ort_tensor=new o.Tensor(F[0],F[1],F[2]),new Proxy(this,{get:(W,re)=>{if(typeof re=="string"){let fe=Number(re);if(Number.isInteger(fe))return W._getitem(fe)}return W[re]},set:(W,re,fe)=>W[re]=fe})}get dims(){return this.ort_tensor.dims}set dims(F){this.ort_tensor.dims=F}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[F,...W]=this.dims;if(W.length>0){const re=W.reduce((fe,se)=>fe*se);for(let fe=0;fe0){const fe=re.reduce((se,ce)=>se*ce);return this._subarray(F,fe,re)}else return new a(this.type,[this.data[F]],re)}indexOf(F){const W=this.data;for(let re=0;repe)throw new Error(`Invalid slice: ${q}`);const xe=[Math.max(R,0),Math.min(pe,this.dims[we])];re.push(xe),W.push(xe[1]-xe[0])}else throw new Error(`Invalid slice: ${q}`)}const fe=re.map(([we,q])=>q-we),se=fe.reduce((we,q)=>we*q),ce=this.data,$e=new ce.constructor(se),Ue=this.stride();for(let we=0;we=0;--R){const xe=fe[R];q+=(pe%xe+re[R][0])*Ue[R],pe=Math.floor(pe/xe)}$e[we]=ce[q]}return new a(this.type,$e,W)}permute(...F){return u(this,F)}transpose(...F){return this.permute(...F)}sum(F=null,W=!1){return this.norm(1,F,W)}norm(F="fro",W=null,re=!1){if(F==="fro")F=2;else if(typeof F=="string")throw Error(`Unsupported norm: ${F}`);const fe=this.data,se=(we,q)=>we+q**F;if(W===null){const we=fe.reduce(se,0)**(1/F);return new a(this.type,[we],[])}const[ce,$e,Ue]=S(se,this,W,re);if(F!==1)for(let we=0;we<$e.length;++we)$e[we]=$e[we]**(1/F);return new a(ce,$e,Ue)}normalize_(F=2,W=1){W=y(W,this.dims.length);const re=this.norm(F,W,!0),fe=this.data,se=re.data;for(let ce=0;ce=0;--Ue){const R=this.dims[Ue];if(Ue!==W){const pe=we%R;$e+=pe*q,q*=this.dims[Ue]}we=Math.floor(we/R)}fe[ce]/=se[$e]}return this}normalize(F=2,W=1){return this.clone().normalize_(F,W)}stride(){return K(this.dims)}squeeze(F=null){return new a(this.type,this.data,C(this.dims,F))}squeeze_(F=null){return this.dims=C(this.dims,F),this}unsqueeze(F=null){return new a(this.type,this.data,E(this.dims,F))}unsqueeze_(F=null){return this.dims=E(this.dims,F),this}flatten_(F=0,W=-1){W=(W+this.dims.length)%this.dims.length;let re=this.dims.slice(0,F),fe=this.dims.slice(F,W+1),se=this.dims.slice(W+1);return this.dims=[...re,fe.reduce((ce,$e)=>ce*$e,1),...se],this}flatten(F=0,W=-1){return this.clone().flatten_(F,W)}view(...F){let W=-1;for(let fe=0;fe$e!==W?se*ce:se,1);F[W]=re.length/fe}return new a(this.type,re,F)}neg_(){const F=this.data;for(let W=0;WF?1:0;return new a("bool",W,this.dims)}lt(F){const W=new Uint8Array(this.data.length),re=this.data;for(let fe=0;feMath.min(ce,$e),this,F,W,1/0);return new a(re,fe,se)}max(F=null,W=!1){if(F===null){const ce=(0,s.max)(this.data)[0];return new a(this.type,[ce],[])}const[re,fe,se]=S((ce,$e)=>Math.max(ce,$e),this,F,W,-1/0);return new a(re,fe,se)}argmin(F=null,W=!1){if(F!==null)throw new Error("`dim !== null` not yet implemented.");const re=(0,s.min)(this.data)[1];return new a("int64",[BigInt(re)],[])}argmax(F=null,W=!1){if(F!==null)throw new Error("`dim !== null` not yet implemented.");const re=(0,s.max)(this.data)[1];return new a("int64",[BigInt(re)],[])}to(F){if(this.type===F)return this;if(!i.hasOwnProperty(F))throw new Error(`Unsupported type: ${F}`);let W;const re=["int64","uint64"].includes(this.type),fe=["int64","uint64"].includes(F);return re&&!fe?W=Number:!re&&fe&&(W=BigInt),new a(F,i[F].from(this.data,W),this.dims)}}function l(V,F){const W=V.length,re=F.reduce((se,ce)=>se*ce);if(W!==re)throw Error(`cannot reshape array of size ${W} into shape (${F})`);let fe=V;for(let se=F.length-1;se>=0;se--)fe=fe.reduce((ce,$e)=>{let Ue=ce[ce.length-1];return Ue.lengthnew a("int64",V,[V.length]);async function $(V,F,W,re,fe){return await(await n.TensorOpRegistry.slice)({x:V,s:v(F),e:v(W),a:v(re),t:v(fe??new Array(re.length).fill(1))})}function w(V,F){const W=V.data,re=F.data,fe=[V.dims[0],V.dims[2]],se=new W.constructor(fe[0]*fe[1]),[ce,$e,Ue]=V.dims;let we=0;for(let q=0;qW!==1):typeof F=="number"?V[F]===1&&V.splice(F,1):Array.isArray(F)&&(V=V.filter((W,re)=>W!==1||!F.includes(re))),V}function E(V,F){return F=y(F,V.length+1),V=V.slice(),V.splice(F,0,1),V}function y(V,F,W=null,re=!0){if(V<-F||V>=F){if(re)throw new Error(`IndexError: index ${V} is out of bounds for dimension${W===null?"":" "+W} with size ${F}`);return V<-F?0:F}return V<0&&(V=(V%F+F)%F),V}function b(V,F=0){F=y(F,V[0].dims.length);const W=V[0].dims.slice();W[F]=V.reduce((ce,$e)=>ce+$e.dims[F],0);const re=W.reduce((ce,$e)=>ce*$e,1),fe=new V[0].data.constructor(re),se=V[0].type;if(F===0){let ce=0;for(const $e of V){const Ue=$e.data;fe.set(Ue,ce),ce+=Ue.length}}else{let ce=0;for(let $e=0;$e=0;--pe){const Se=we[pe];let Ae=xe%Se;pe===F&&(Ae+=ce),R+=Ae*Me,Me*=W[pe],xe=Math.floor(xe/Se)}fe[R]=Ue[q]}ce+=we[F]}}return new a(se,fe,W)}function x(V,F=0){return b(V.map(W=>W.unsqueeze(F)),F)}function S(V,F,W=null,re=!1,fe=null){const se=F.data,ce=F.dims;W=y(W,ce.length);const $e=ce.slice();$e[W]=1;const Ue=new se.constructor(se.length/ce[W]);fe!==null&&Ue.fill(fe);for(let we=0;we=0;--R){const Me=ce[R];if(R!==W){const Se=pe%Me;q+=Se*xe,xe*=$e[R]}pe=Math.floor(pe/Me)}Ue[q]=V(Ue[q],se[we],we,q)}return re||$e.splice(W,1),[F.type,Ue,$e]}function A(V,F=null,W=1,re=!1){const fe=V.data,se=V.dims;if(F===null){const xe=fe.reduce((Fe,ze)=>Fe+ze,0)/fe.length,Me=Math.sqrt(fe.reduce((Fe,ze)=>Fe+(ze-xe)**2,0)/(fe.length-W)),Se=new a(V.type,[xe],[]);return[new a(V.type,[Me],[]),Se]}F=y(F,se.length);const ce=B(V,F,re),$e=ce.data,[Ue,we,q]=S((pe,xe,Me,Se)=>pe+(xe-$e[Se])**2,V,F,re);for(let pe=0;pewe+q,0);return new a(V.type,[Ue/fe.length],[])}F=y(F,re.length);const[se,ce,$e]=S((Ue,we)=>Ue+we,V,F,W);if(re[F]!==1)for(let Ue=0;Ue=0;--W)F[W]=re,re*=V[W];return F}function G(V,F,W,re){const fe=V.reduce((se,ce)=>se*ce,1);return new a(W,new re(fe).fill(F),V)}function j(V,F){let W,re;if(typeof F=="number")W="float32",re=Float32Array;else if(typeof F=="bigint")W="int64",re=BigInt64Array;else if(typeof F=="boolean")W="bool",re=Uint8Array;else throw new Error(`Unsupported data type: ${typeof F}`);return G(V,F,W,re)}function ee(V,F){return j(V.dims,F)}function H(V){return G(V,1n,"int64",BigInt64Array)}function Z(V){return H(V.dims)}function X(V){return G(V,0n,"int64",BigInt64Array)}function oe(V){return X(V.dims)}function me(V){const F=V.reduce((W,re)=>W*re,1);return new a("float32",Float32Array.from({length:F},()=>Math.random()),V)}function ae(V,F){if(V.dims.length!==2)throw new Error("The tensor must have 2 dimensions");if(V.dims.at(-1)%8!==0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(F))throw new Error("The precision must be either 'binary' or 'ubinary'");const W=F==="binary",re=W?"int8":"uint8",fe=W?Int8Array:Uint8Array,se=V.data,ce=new fe(se.length/8);for(let $e=0;$e0?1:0,we=Math.floor($e/8),q=$e%8;ce[we]|=Ue<<7-q,W&&q===0&&(ce[we]-=128)}return new a(re,ce,[V.dims[0],V.dims[1]/8])}},"./src/utils/video.js":(e,r,t)=>{t.r(r),t.d(r,{RawVideo:()=>i,RawVideoFrame:()=>n,load_video:()=>a});var s=t("./src/utils/image.js"),o=t("./src/env.js");class n{constructor(u,p){this.image=u,this.timestamp=p}}class i{constructor(u,p){u.length>0&&u[0]instanceof s.RawImage&&(u=u.map((d,c)=>new n(d,(c+1)/(u.length+1)*p))),this.frames=u,this.duration=p}get width(){return this.frames[0].image.width}get height(){return this.frames[0].image.height}get fps(){return this.frames.length/this.duration}}async function a(l,{num_frames:u=null,fps:p=null}={}){if(!o.apis.IS_BROWSER_ENV)throw new Error("`load_video` is currently only supported in browser environments.");if(u==null&&p==null)throw new Error("Either num_frames or fps must be provided.");const d=[],c=document.createElement("video");if(c.crossOrigin="anonymous",c.muted=!0,typeof l=="string")c.src=l;else if(l instanceof Blob)c.src=URL.createObjectURL(l);else if(l instanceof HTMLVideoElement)c.src=l.src;else throw new Error("Invalid URL or video element provided.");if(await new Promise(C=>c.onloadedmetadata=C),c.seekable.start(0)===c.seekable.end(0)){const E=await(await fetch(c.src)).blob();c.src=URL.createObjectURL(E),await new Promise(y=>c.onloadedmetadata=y)}const _=c.duration;let f,v;u!=null?(f=u,v=u===1?0:_/(u-1)):(v=1/p,f=Math.floor(_/v));let $=[];for(let C=0;C{c.onseeked=x}),g.drawImage(c,0,0,w.width,w.height);const E=g.getImageData(0,0,w.width,w.height),y=new s.RawImage(E.data,w.width,w.height,4),b=new n(y,C);d.push(b)}return c.remove(),new i(d,_)}}},rb={};function St(e){var r=rb[e];if(r!==void 0)return r.exports;var t=rb[e]={exports:{}};return sT[e](t,t.exports,St),t.exports}(()=>{var e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,r;St.t=function(t,s){if(s&1&&(t=this(t)),s&8||typeof t=="object"&&t&&(s&4&&t.__esModule||s&16&&typeof t.then=="function"))return t;var o=Object.create(null);St.r(o);var n={};r=r||[null,e({}),e([]),e(e)];for(var i=s&2&&t;typeof i=="object"&&!~r.indexOf(i);i=e(i))Object.getOwnPropertyNames(i).forEach(a=>n[a]=()=>t[a]);return n.default=()=>t,St.d(o,n),o}})();St.d=(e,r)=>{for(var t in r)St.o(r,t)&&!St.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})};St.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);St.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var m={};(()=>{/*!*****************************!*\ + !*** ./src/transformers.js ***! + \*****************************/St.r(m),St.d(m,{ASTFeatureExtractor:()=>d.ASTFeatureExtractor,ASTForAudioClassification:()=>t.ASTForAudioClassification,ASTModel:()=>t.ASTModel,ASTPreTrainedModel:()=>t.ASTPreTrainedModel,AlbertForMaskedLM:()=>t.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>t.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>t.AlbertForSequenceClassification,AlbertModel:()=>t.AlbertModel,AlbertPreTrainedModel:()=>t.AlbertPreTrainedModel,AlbertTokenizer:()=>s.AlbertTokenizer,AudioClassificationPipeline:()=>r.AudioClassificationPipeline,AutoConfig:()=>o.AutoConfig,AutoFeatureExtractor:()=>c.AutoFeatureExtractor,AutoImageProcessor:()=>v.AutoImageProcessor,AutoModel:()=>t.AutoModel,AutoModelForAudioClassification:()=>t.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>t.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>t.AutoModelForAudioTextToText,AutoModelForCTC:()=>t.AutoModelForCTC,AutoModelForCausalLM:()=>t.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>t.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>t.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>t.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>t.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>t.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>t.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>t.AutoModelForImageTextToText,AutoModelForImageToImage:()=>t.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>t.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>t.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>t.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>t.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>t.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>t.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>t.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>t.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>t.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>t.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>t.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>t.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>t.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>t.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>t.AutoModelForVision2Seq,AutoModelForXVector:()=>t.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>t.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>g.AutoProcessor,AutoTokenizer:()=>s.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>r.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>r.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>t.BartForConditionalGeneration,BartForSequenceClassification:()=>t.BartForSequenceClassification,BartModel:()=>t.BartModel,BartPretrainedModel:()=>t.BartPretrainedModel,BartTokenizer:()=>s.BartTokenizer,BaseModelOutput:()=>t.BaseModelOutput,BaseStreamer:()=>C.BaseStreamer,BeitFeatureExtractor:()=>f.BeitFeatureExtractor,BeitForImageClassification:()=>t.BeitForImageClassification,BeitModel:()=>t.BeitModel,BeitPreTrainedModel:()=>t.BeitPreTrainedModel,BertForMaskedLM:()=>t.BertForMaskedLM,BertForQuestionAnswering:()=>t.BertForQuestionAnswering,BertForSequenceClassification:()=>t.BertForSequenceClassification,BertForTokenClassification:()=>t.BertForTokenClassification,BertModel:()=>t.BertModel,BertPreTrainedModel:()=>t.BertPreTrainedModel,BertTokenizer:()=>s.BertTokenizer,BitImageProcessor:()=>f.BitImageProcessor,BlenderbotForConditionalGeneration:()=>t.BlenderbotForConditionalGeneration,BlenderbotModel:()=>t.BlenderbotModel,BlenderbotPreTrainedModel:()=>t.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>t.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>t.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>t.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>s.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>s.BlenderbotTokenizer,BloomForCausalLM:()=>t.BloomForCausalLM,BloomModel:()=>t.BloomModel,BloomPreTrainedModel:()=>t.BloomPreTrainedModel,BloomTokenizer:()=>s.BloomTokenizer,CLIPFeatureExtractor:()=>f.CLIPFeatureExtractor,CLIPImageProcessor:()=>f.CLIPImageProcessor,CLIPModel:()=>t.CLIPModel,CLIPPreTrainedModel:()=>t.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>t.CLIPSegForImageSegmentation,CLIPSegModel:()=>t.CLIPSegModel,CLIPSegPreTrainedModel:()=>t.CLIPSegPreTrainedModel,CLIPTextModel:()=>t.CLIPTextModel,CLIPTextModelWithProjection:()=>t.CLIPTextModelWithProjection,CLIPTokenizer:()=>s.CLIPTokenizer,CLIPVisionModel:()=>t.CLIPVisionModel,CLIPVisionModelWithProjection:()=>t.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>t.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>t.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>t.CamembertForSequenceClassification,CamembertForTokenClassification:()=>t.CamembertForTokenClassification,CamembertModel:()=>t.CamembertModel,CamembertPreTrainedModel:()=>t.CamembertPreTrainedModel,CamembertTokenizer:()=>s.CamembertTokenizer,CausalLMOutput:()=>t.CausalLMOutput,CausalLMOutputWithPast:()=>t.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>f.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>t.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>t.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>t.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>d.ClapFeatureExtractor,ClapModel:()=>t.ClapModel,ClapPreTrainedModel:()=>t.ClapPreTrainedModel,ClapTextModelWithProjection:()=>t.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>y.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>t.CodeGenForCausalLM,CodeGenModel:()=>t.CodeGenModel,CodeGenPreTrainedModel:()=>t.CodeGenPreTrainedModel,CodeGenTokenizer:()=>s.CodeGenTokenizer,CodeLlamaTokenizer:()=>s.CodeLlamaTokenizer,CohereForCausalLM:()=>t.CohereForCausalLM,CohereModel:()=>t.CohereModel,CoherePreTrainedModel:()=>t.CoherePreTrainedModel,CohereTokenizer:()=>s.CohereTokenizer,ConvBertForMaskedLM:()=>t.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>t.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>t.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>t.ConvBertForTokenClassification,ConvBertModel:()=>t.ConvBertModel,ConvBertPreTrainedModel:()=>t.ConvBertPreTrainedModel,ConvBertTokenizer:()=>s.ConvBertTokenizer,ConvNextFeatureExtractor:()=>f.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>t.ConvNextForImageClassification,ConvNextImageProcessor:()=>f.ConvNextImageProcessor,ConvNextModel:()=>t.ConvNextModel,ConvNextPreTrainedModel:()=>t.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>t.ConvNextV2ForImageClassification,ConvNextV2Model:()=>t.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>t.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>f.DPTFeatureExtractor,DPTForDepthEstimation:()=>t.DPTForDepthEstimation,DPTImageProcessor:()=>f.DPTImageProcessor,DPTModel:()=>t.DPTModel,DPTPreTrainedModel:()=>t.DPTPreTrainedModel,DacDecoderModel:()=>t.DacDecoderModel,DacDecoderOutput:()=>t.DacDecoderOutput,DacEncoderModel:()=>t.DacEncoderModel,DacEncoderOutput:()=>t.DacEncoderOutput,DacFeatureExtractor:()=>d.DacFeatureExtractor,DacModel:()=>t.DacModel,DacPreTrainedModel:()=>t.DacPreTrainedModel,DataTypeMap:()=>l.DataTypeMap,DebertaForMaskedLM:()=>t.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>t.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>t.DebertaForSequenceClassification,DebertaForTokenClassification:()=>t.DebertaForTokenClassification,DebertaModel:()=>t.DebertaModel,DebertaPreTrainedModel:()=>t.DebertaPreTrainedModel,DebertaTokenizer:()=>s.DebertaTokenizer,DebertaV2ForMaskedLM:()=>t.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>t.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>t.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>t.DebertaV2ForTokenClassification,DebertaV2Model:()=>t.DebertaV2Model,DebertaV2PreTrainedModel:()=>t.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>s.DebertaV2Tokenizer,DecisionTransformerModel:()=>t.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>t.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>f.DeiTFeatureExtractor,DeiTForImageClassification:()=>t.DeiTForImageClassification,DeiTImageProcessor:()=>f.DeiTImageProcessor,DeiTModel:()=>t.DeiTModel,DeiTPreTrainedModel:()=>t.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>t.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>t.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>r.DepthEstimationPipeline,DepthProForDepthEstimation:()=>t.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>t.DepthProPreTrainedModel,DetrFeatureExtractor:()=>f.DetrFeatureExtractor,DetrForObjectDetection:()=>t.DetrForObjectDetection,DetrForSegmentation:()=>t.DetrForSegmentation,DetrImageProcessor:()=>f.DetrImageProcessor,DetrModel:()=>t.DetrModel,DetrObjectDetectionOutput:()=>t.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>t.DetrPreTrainedModel,DetrSegmentationOutput:()=>t.DetrSegmentationOutput,Dinov2ForImageClassification:()=>t.Dinov2ForImageClassification,Dinov2Model:()=>t.Dinov2Model,Dinov2PreTrainedModel:()=>t.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>t.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>t.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>t.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>t.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>t.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>t.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>t.DistilBertForTokenClassification,DistilBertModel:()=>t.DistilBertModel,DistilBertPreTrainedModel:()=>t.DistilBertPreTrainedModel,DistilBertTokenizer:()=>s.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>r.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>f.DonutFeatureExtractor,DonutImageProcessor:()=>f.DonutImageProcessor,DonutSwinModel:()=>t.DonutSwinModel,DonutSwinPreTrainedModel:()=>t.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>t.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>f.EfficientNetImageProcessor,EfficientNetModel:()=>t.EfficientNetModel,EfficientNetPreTrainedModel:()=>t.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>t.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>t.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>t.ElectraForSequenceClassification,ElectraForTokenClassification:()=>t.ElectraForTokenClassification,ElectraModel:()=>t.ElectraModel,ElectraPreTrainedModel:()=>t.ElectraPreTrainedModel,ElectraTokenizer:()=>s.ElectraTokenizer,EncodecFeatureExtractor:()=>d.EncodecFeatureExtractor,EosTokenCriteria:()=>E.EosTokenCriteria,EsmForMaskedLM:()=>t.EsmForMaskedLM,EsmForSequenceClassification:()=>t.EsmForSequenceClassification,EsmForTokenClassification:()=>t.EsmForTokenClassification,EsmModel:()=>t.EsmModel,EsmPreTrainedModel:()=>t.EsmPreTrainedModel,EsmTokenizer:()=>s.EsmTokenizer,ExaoneForCausalLM:()=>t.ExaoneForCausalLM,ExaoneModel:()=>t.ExaoneModel,ExaonePreTrainedModel:()=>t.ExaonePreTrainedModel,FFT:()=>u.FFT,FalconForCausalLM:()=>t.FalconForCausalLM,FalconModel:()=>t.FalconModel,FalconPreTrainedModel:()=>t.FalconPreTrainedModel,FalconTokenizer:()=>s.FalconTokenizer,FastViTForImageClassification:()=>t.FastViTForImageClassification,FastViTModel:()=>t.FastViTModel,FastViTPreTrainedModel:()=>t.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>r.FeatureExtractionPipeline,FeatureExtractor:()=>p.FeatureExtractor,FillMaskPipeline:()=>r.FillMaskPipeline,Florence2ForConditionalGeneration:()=>t.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>t.Florence2PreTrainedModel,Florence2Processor:()=>w.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>y.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>y.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>f.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>t.GLPNForDepthEstimation,GLPNModel:()=>t.GLPNModel,GLPNPreTrainedModel:()=>t.GLPNPreTrainedModel,GPT2LMHeadModel:()=>t.GPT2LMHeadModel,GPT2Model:()=>t.GPT2Model,GPT2PreTrainedModel:()=>t.GPT2PreTrainedModel,GPT2Tokenizer:()=>s.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>t.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>t.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>t.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>t.GPTJForCausalLM,GPTJModel:()=>t.GPTJModel,GPTJPreTrainedModel:()=>t.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>t.GPTNeoForCausalLM,GPTNeoModel:()=>t.GPTNeoModel,GPTNeoPreTrainedModel:()=>t.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>t.GPTNeoXForCausalLM,GPTNeoXModel:()=>t.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>t.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>s.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>t.Gemma2ForCausalLM,Gemma2Model:()=>t.Gemma2Model,Gemma2PreTrainedModel:()=>t.Gemma2PreTrainedModel,Gemma3ForCausalLM:()=>t.Gemma3ForCausalLM,Gemma3Model:()=>t.Gemma3Model,Gemma3PreTrainedModel:()=>t.Gemma3PreTrainedModel,GemmaForCausalLM:()=>t.GemmaForCausalLM,GemmaModel:()=>t.GemmaModel,GemmaPreTrainedModel:()=>t.GemmaPreTrainedModel,GemmaTokenizer:()=>s.GemmaTokenizer,GlmForCausalLM:()=>t.GlmForCausalLM,GlmModel:()=>t.GlmModel,GlmPreTrainedModel:()=>t.GlmPreTrainedModel,GraniteForCausalLM:()=>t.GraniteForCausalLM,GraniteModel:()=>t.GraniteModel,GranitePreTrainedModel:()=>t.GranitePreTrainedModel,Grok1Tokenizer:()=>s.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>t.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>f.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>t.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>w.GroundingDinoProcessor,GroupViTModel:()=>t.GroupViTModel,GroupViTPreTrainedModel:()=>t.GroupViTPreTrainedModel,HeliumForCausalLM:()=>t.HeliumForCausalLM,HeliumModel:()=>t.HeliumModel,HeliumPreTrainedModel:()=>t.HeliumPreTrainedModel,HerbertTokenizer:()=>s.HerbertTokenizer,HieraForImageClassification:()=>t.HieraForImageClassification,HieraModel:()=>t.HieraModel,HieraPreTrainedModel:()=>t.HieraPreTrainedModel,HubertForCTC:()=>t.HubertForCTC,HubertForSequenceClassification:()=>t.HubertForSequenceClassification,HubertModel:()=>t.HubertModel,HubertPreTrainedModel:()=>t.HubertPreTrainedModel,IJepaForImageClassification:()=>t.IJepaForImageClassification,IJepaModel:()=>t.IJepaModel,IJepaPreTrainedModel:()=>t.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>t.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>f.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>t.Idefics3PreTrainedModel,Idefics3Processor:()=>w.Idefics3Processor,ImageClassificationPipeline:()=>r.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>r.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>d.ImageFeatureExtractor,ImageMattingOutput:()=>t.ImageMattingOutput,ImageProcessor:()=>_.ImageProcessor,ImageSegmentationPipeline:()=>r.ImageSegmentationPipeline,ImageToImagePipeline:()=>r.ImageToImagePipeline,ImageToTextPipeline:()=>r.ImageToTextPipeline,InterruptableStoppingCriteria:()=>E.InterruptableStoppingCriteria,JAISLMHeadModel:()=>t.JAISLMHeadModel,JAISModel:()=>t.JAISModel,JAISPreTrainedModel:()=>t.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>f.JinaCLIPImageProcessor,JinaCLIPModel:()=>t.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>t.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>w.JinaCLIPProcessor,JinaCLIPTextModel:()=>t.JinaCLIPTextModel,JinaCLIPVisionModel:()=>t.JinaCLIPVisionModel,LiteWhisperForConditionalGeneration:()=>t.LiteWhisperForConditionalGeneration,LlamaForCausalLM:()=>t.LlamaForCausalLM,LlamaModel:()=>t.LlamaModel,LlamaPreTrainedModel:()=>t.LlamaPreTrainedModel,LlamaTokenizer:()=>s.LlamaTokenizer,LlavaForConditionalGeneration:()=>t.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>t.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>f.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>t.LlavaPreTrainedModel,LogitsProcessor:()=>y.LogitsProcessor,LogitsProcessorList:()=>y.LogitsProcessorList,LogitsWarper:()=>y.LogitsWarper,LongT5ForConditionalGeneration:()=>t.LongT5ForConditionalGeneration,LongT5Model:()=>t.LongT5Model,LongT5PreTrainedModel:()=>t.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>t.M2M100ForConditionalGeneration,M2M100Model:()=>t.M2M100Model,M2M100PreTrainedModel:()=>t.M2M100PreTrainedModel,M2M100Tokenizer:()=>s.M2M100Tokenizer,MBart50Tokenizer:()=>s.MBart50Tokenizer,MBartForCausalLM:()=>t.MBartForCausalLM,MBartForConditionalGeneration:()=>t.MBartForConditionalGeneration,MBartForSequenceClassification:()=>t.MBartForSequenceClassification,MBartModel:()=>t.MBartModel,MBartPreTrainedModel:()=>t.MBartPreTrainedModel,MBartTokenizer:()=>s.MBartTokenizer,MPNetForMaskedLM:()=>t.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>t.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>t.MPNetForSequenceClassification,MPNetForTokenClassification:()=>t.MPNetForTokenClassification,MPNetModel:()=>t.MPNetModel,MPNetPreTrainedModel:()=>t.MPNetPreTrainedModel,MPNetTokenizer:()=>s.MPNetTokenizer,MT5ForConditionalGeneration:()=>t.MT5ForConditionalGeneration,MT5Model:()=>t.MT5Model,MT5PreTrainedModel:()=>t.MT5PreTrainedModel,MarianMTModel:()=>t.MarianMTModel,MarianModel:()=>t.MarianModel,MarianPreTrainedModel:()=>t.MarianPreTrainedModel,MarianTokenizer:()=>s.MarianTokenizer,Mask2FormerImageProcessor:()=>f.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>f.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>t.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>f.MaskFormerImageProcessor,MaskFormerModel:()=>t.MaskFormerModel,MaskFormerPreTrainedModel:()=>t.MaskFormerPreTrainedModel,MaskedLMOutput:()=>t.MaskedLMOutput,MaxLengthCriteria:()=>E.MaxLengthCriteria,Metric3DForDepthEstimation:()=>t.Metric3DForDepthEstimation,Metric3DPreTrainedModel:()=>t.Metric3DPreTrainedModel,Metric3Dv2ForDepthEstimation:()=>t.Metric3Dv2ForDepthEstimation,Metric3Dv2PreTrainedModel:()=>t.Metric3Dv2PreTrainedModel,MgpstrForSceneTextRecognition:()=>t.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>t.MgpstrModelOutput,MgpstrPreTrainedModel:()=>t.MgpstrPreTrainedModel,MgpstrProcessor:()=>w.MgpstrProcessor,MgpstrTokenizer:()=>s.MgpstrTokenizer,MimiDecoderModel:()=>t.MimiDecoderModel,MimiDecoderOutput:()=>t.MimiDecoderOutput,MimiEncoderModel:()=>t.MimiEncoderModel,MimiEncoderOutput:()=>t.MimiEncoderOutput,MimiModel:()=>t.MimiModel,MimiPreTrainedModel:()=>t.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>y.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>y.MinNewTokensLengthLogitsProcessor,MistralForCausalLM:()=>t.MistralForCausalLM,MistralModel:()=>t.MistralModel,MistralPreTrainedModel:()=>t.MistralPreTrainedModel,MobileBertForMaskedLM:()=>t.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>t.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>t.MobileBertForSequenceClassification,MobileBertModel:()=>t.MobileBertModel,MobileBertPreTrainedModel:()=>t.MobileBertPreTrainedModel,MobileBertTokenizer:()=>s.MobileBertTokenizer,MobileLLMForCausalLM:()=>t.MobileLLMForCausalLM,MobileLLMModel:()=>t.MobileLLMModel,MobileLLMPreTrainedModel:()=>t.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>f.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>t.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>t.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>f.MobileNetV1ImageProcessor,MobileNetV1Model:()=>t.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>t.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>f.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>t.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>t.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>f.MobileNetV2ImageProcessor,MobileNetV2Model:()=>t.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>t.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>f.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>t.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>t.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>f.MobileNetV3ImageProcessor,MobileNetV3Model:()=>t.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>t.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>f.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>t.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>t.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>f.MobileNetV4ImageProcessor,MobileNetV4Model:()=>t.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>t.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>f.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>t.MobileViTForImageClassification,MobileViTImageProcessor:()=>f.MobileViTImageProcessor,MobileViTModel:()=>t.MobileViTModel,MobileViTPreTrainedModel:()=>t.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>t.MobileViTV2ForImageClassification,MobileViTV2Model:()=>t.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>t.MobileViTV2PreTrainedModel,ModelOutput:()=>t.ModelOutput,ModernBertForMaskedLM:()=>t.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>t.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>t.ModernBertForTokenClassification,ModernBertModel:()=>t.ModernBertModel,ModernBertPreTrainedModel:()=>t.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>t.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>d.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>t.MoonshineForConditionalGeneration,MoonshineModel:()=>t.MoonshineModel,MoonshinePreTrainedModel:()=>t.MoonshinePreTrainedModel,MoonshineProcessor:()=>w.MoonshineProcessor,MptForCausalLM:()=>t.MptForCausalLM,MptModel:()=>t.MptModel,MptPreTrainedModel:()=>t.MptPreTrainedModel,MultiModalityCausalLM:()=>t.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>t.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>t.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>t.MusicgenForConditionalGeneration,MusicgenModel:()=>t.MusicgenModel,MusicgenPreTrainedModel:()=>t.MusicgenPreTrainedModel,NllbTokenizer:()=>s.NllbTokenizer,NoBadWordsLogitsProcessor:()=>y.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>y.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>t.NomicBertModel,NomicBertPreTrainedModel:()=>t.NomicBertPreTrainedModel,NougatImageProcessor:()=>f.NougatImageProcessor,NougatTokenizer:()=>s.NougatTokenizer,OPTForCausalLM:()=>t.OPTForCausalLM,OPTModel:()=>t.OPTModel,OPTPreTrainedModel:()=>t.OPTPreTrainedModel,ObjectDetectionPipeline:()=>r.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>t.Olmo2ForCausalLM,Olmo2Model:()=>t.Olmo2Model,Olmo2PreTrainedModel:()=>t.Olmo2PreTrainedModel,OlmoForCausalLM:()=>t.OlmoForCausalLM,OlmoModel:()=>t.OlmoModel,OlmoPreTrainedModel:()=>t.OlmoPreTrainedModel,OpenELMForCausalLM:()=>t.OpenELMForCausalLM,OpenELMModel:()=>t.OpenELMModel,OpenELMPreTrainedModel:()=>t.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>f.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>t.OwlViTForObjectDetection,OwlViTImageProcessor:()=>f.OwlViTImageProcessor,OwlViTModel:()=>t.OwlViTModel,OwlViTPreTrainedModel:()=>t.OwlViTPreTrainedModel,OwlViTProcessor:()=>w.OwlViTProcessor,Owlv2ForObjectDetection:()=>t.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>f.Owlv2ImageProcessor,Owlv2Model:()=>t.Owlv2Model,Owlv2PreTrainedModel:()=>t.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>t.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>t.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>w.PaliGemmaProcessor,PatchTSMixerForPrediction:()=>t.PatchTSMixerForPrediction,PatchTSMixerModel:()=>t.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>t.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>t.PatchTSTForPrediction,PatchTSTModel:()=>t.PatchTSTModel,PatchTSTPreTrainedModel:()=>t.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>t.Phi3ForCausalLM,Phi3Model:()=>t.Phi3Model,Phi3PreTrainedModel:()=>t.Phi3PreTrainedModel,Phi3VForCausalLM:()=>t.Phi3VForCausalLM,Phi3VImageProcessor:()=>f.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>t.Phi3VPreTrainedModel,Phi3VProcessor:()=>w.Phi3VProcessor,PhiForCausalLM:()=>t.PhiForCausalLM,PhiModel:()=>t.PhiModel,PhiPreTrainedModel:()=>t.PhiPreTrainedModel,Pipeline:()=>r.Pipeline,PreTrainedModel:()=>t.PreTrainedModel,PreTrainedTokenizer:()=>s.PreTrainedTokenizer,PretrainedConfig:()=>o.PretrainedConfig,PretrainedMixin:()=>t.PretrainedMixin,Processor:()=>$.Processor,PvtForImageClassification:()=>t.PvtForImageClassification,PvtImageProcessor:()=>f.PvtImageProcessor,PvtModel:()=>t.PvtModel,PvtPreTrainedModel:()=>t.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>d.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>t.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>t.PyAnnoteModel,PyAnnotePreTrainedModel:()=>t.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>w.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>t.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>r.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>t.Qwen2ForCausalLM,Qwen2Model:()=>t.Qwen2Model,Qwen2PreTrainedModel:()=>t.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>s.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>t.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>f.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>t.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>w.Qwen2VLProcessor,RFDetrForObjectDetection:()=>t.RFDetrForObjectDetection,RFDetrModel:()=>t.RFDetrModel,RFDetrObjectDetectionOutput:()=>t.RFDetrObjectDetectionOutput,RFDetrPreTrainedModel:()=>t.RFDetrPreTrainedModel,RTDetrForObjectDetection:()=>t.RTDetrForObjectDetection,RTDetrImageProcessor:()=>f.RTDetrImageProcessor,RTDetrModel:()=>t.RTDetrModel,RTDetrObjectDetectionOutput:()=>t.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>t.RTDetrPreTrainedModel,RTDetrV2ForObjectDetection:()=>t.RTDetrV2ForObjectDetection,RTDetrV2Model:()=>t.RTDetrV2Model,RTDetrV2ObjectDetectionOutput:()=>t.RTDetrV2ObjectDetectionOutput,RTDetrV2PreTrainedModel:()=>t.RTDetrV2PreTrainedModel,RawAudio:()=>n.RawAudio,RawImage:()=>i.RawImage,RawVideo:()=>a.RawVideo,RawVideoFrame:()=>a.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>y.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>t.ResNetForImageClassification,ResNetModel:()=>t.ResNetModel,ResNetPreTrainedModel:()=>t.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>t.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>t.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>t.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>t.RoFormerForTokenClassification,RoFormerModel:()=>t.RoFormerModel,RoFormerPreTrainedModel:()=>t.RoFormerPreTrainedModel,RoFormerTokenizer:()=>s.RoFormerTokenizer,RobertaForMaskedLM:()=>t.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>t.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>t.RobertaForSequenceClassification,RobertaForTokenClassification:()=>t.RobertaForTokenClassification,RobertaModel:()=>t.RobertaModel,RobertaPreTrainedModel:()=>t.RobertaPreTrainedModel,RobertaTokenizer:()=>s.RobertaTokenizer,SamImageProcessor:()=>f.SamImageProcessor,SamImageSegmentationOutput:()=>t.SamImageSegmentationOutput,SamModel:()=>t.SamModel,SamPreTrainedModel:()=>t.SamPreTrainedModel,SamProcessor:()=>w.SamProcessor,SapiensForDepthEstimation:()=>t.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>t.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>t.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>t.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>d.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>f.SegformerFeatureExtractor,SegformerForImageClassification:()=>t.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>t.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>f.SegformerImageProcessor,SegformerModel:()=>t.SegformerModel,SegformerPreTrainedModel:()=>t.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>t.Seq2SeqLMOutput,SequenceClassifierOutput:()=>t.SequenceClassifierOutput,SiglipImageProcessor:()=>f.SiglipImageProcessor,SiglipModel:()=>t.SiglipModel,SiglipPreTrainedModel:()=>t.SiglipPreTrainedModel,SiglipTextModel:()=>t.SiglipTextModel,SiglipTokenizer:()=>s.SiglipTokenizer,SiglipVisionModel:()=>t.SiglipVisionModel,SmolVLMForConditionalGeneration:()=>t.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>f.SmolVLMImageProcessor,SmolVLMProcessor:()=>w.SmolVLMProcessor,SnacDecoderModel:()=>t.SnacDecoderModel,SnacEncoderModel:()=>t.SnacEncoderModel,SnacFeatureExtractor:()=>d.SnacFeatureExtractor,SnacModel:()=>t.SnacModel,SnacPreTrainedModel:()=>t.SnacPreTrainedModel,SpeechT5FeatureExtractor:()=>d.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>t.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>t.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>t.SpeechT5HifiGan,SpeechT5Model:()=>t.SpeechT5Model,SpeechT5PreTrainedModel:()=>t.SpeechT5PreTrainedModel,SpeechT5Processor:()=>w.SpeechT5Processor,SpeechT5Tokenizer:()=>s.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>t.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>t.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>t.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>t.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>t.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>s.SqueezeBertTokenizer,StableLmForCausalLM:()=>t.StableLmForCausalLM,StableLmModel:()=>t.StableLmModel,StableLmPreTrainedModel:()=>t.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>t.Starcoder2ForCausalLM,Starcoder2Model:()=>t.Starcoder2Model,Starcoder2PreTrainedModel:()=>t.Starcoder2PreTrainedModel,StoppingCriteria:()=>E.StoppingCriteria,StoppingCriteriaList:()=>E.StoppingCriteriaList,StyleTextToSpeech2Model:()=>t.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>t.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>r.SummarizationPipeline,SuppressTokensAtBeginLogitsProcessor:()=>y.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>t.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>f.Swin2SRImageProcessor,Swin2SRModel:()=>t.Swin2SRModel,Swin2SRPreTrainedModel:()=>t.Swin2SRPreTrainedModel,SwinForImageClassification:()=>t.SwinForImageClassification,SwinForSemanticSegmentation:()=>t.SwinForSemanticSegmentation,SwinModel:()=>t.SwinModel,SwinPreTrainedModel:()=>t.SwinPreTrainedModel,T5ForConditionalGeneration:()=>t.T5ForConditionalGeneration,T5Model:()=>t.T5Model,T5PreTrainedModel:()=>t.T5PreTrainedModel,T5Tokenizer:()=>s.T5Tokenizer,TableTransformerForObjectDetection:()=>t.TableTransformerForObjectDetection,TableTransformerModel:()=>t.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>t.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>t.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>y.TemperatureLogitsWarper,Tensor:()=>l.Tensor,Text2TextGenerationPipeline:()=>r.Text2TextGenerationPipeline,TextClassificationPipeline:()=>r.TextClassificationPipeline,TextGenerationPipeline:()=>r.TextGenerationPipeline,TextStreamer:()=>C.TextStreamer,TextToAudioPipeline:()=>r.TextToAudioPipeline,TokenClassificationPipeline:()=>r.TokenClassificationPipeline,TokenClassifierOutput:()=>t.TokenClassifierOutput,TokenizerModel:()=>s.TokenizerModel,TopKLogitsWarper:()=>y.TopKLogitsWarper,TopPLogitsWarper:()=>y.TopPLogitsWarper,TrOCRForCausalLM:()=>t.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>t.TrOCRPreTrainedModel,TranslationPipeline:()=>r.TranslationPipeline,UltravoxModel:()=>t.UltravoxModel,UltravoxPreTrainedModel:()=>t.UltravoxPreTrainedModel,UltravoxProcessor:()=>w.UltravoxProcessor,UniSpeechForCTC:()=>t.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>t.UniSpeechForSequenceClassification,UniSpeechModel:()=>t.UniSpeechModel,UniSpeechPreTrainedModel:()=>t.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>t.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>t.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>t.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>t.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>t.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>w.VLChatProcessor,VLMImageProcessor:()=>f.VLMImageProcessor,ViTFeatureExtractor:()=>f.ViTFeatureExtractor,ViTForImageClassification:()=>t.ViTForImageClassification,ViTImageProcessor:()=>f.ViTImageProcessor,ViTMAEModel:()=>t.ViTMAEModel,ViTMAEPreTrainedModel:()=>t.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>t.ViTMSNForImageClassification,ViTMSNModel:()=>t.ViTMSNModel,ViTMSNPreTrainedModel:()=>t.ViTMSNPreTrainedModel,ViTModel:()=>t.ViTModel,ViTPreTrainedModel:()=>t.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>t.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>t.VitMatteForImageMatting,VitMatteImageProcessor:()=>f.VitMatteImageProcessor,VitMattePreTrainedModel:()=>t.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>t.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>f.VitPoseImageProcessor,VitPosePreTrainedModel:()=>t.VitPosePreTrainedModel,VitsModel:()=>t.VitsModel,VitsModelOutput:()=>t.VitsModelOutput,VitsPreTrainedModel:()=>t.VitsPreTrainedModel,VitsTokenizer:()=>s.VitsTokenizer,Wav2Vec2BertForCTC:()=>t.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>t.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>t.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>t.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>s.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>d.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>t.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>t.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>t.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>t.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>t.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>w.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>t.WavLMForAudioFrameClassification,WavLMForCTC:()=>t.WavLMForCTC,WavLMForSequenceClassification:()=>t.WavLMForSequenceClassification,WavLMForXVector:()=>t.WavLMForXVector,WavLMModel:()=>t.WavLMModel,WavLMPreTrainedModel:()=>t.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>d.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>t.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>t.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>d.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>t.WhisperForConditionalGeneration,WhisperModel:()=>t.WhisperModel,WhisperPreTrainedModel:()=>t.WhisperPreTrainedModel,WhisperProcessor:()=>w.WhisperProcessor,WhisperTextStreamer:()=>C.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>y.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>s.WhisperTokenizer,XLMForQuestionAnswering:()=>t.XLMForQuestionAnswering,XLMForSequenceClassification:()=>t.XLMForSequenceClassification,XLMForTokenClassification:()=>t.XLMForTokenClassification,XLMModel:()=>t.XLMModel,XLMPreTrainedModel:()=>t.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>t.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>t.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>t.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>t.XLMRobertaForTokenClassification,XLMRobertaModel:()=>t.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>t.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>s.XLMRobertaTokenizer,XLMTokenizer:()=>s.XLMTokenizer,XLMWithLMHeadModel:()=>t.XLMWithLMHeadModel,XVectorOutput:()=>t.XVectorOutput,YolosFeatureExtractor:()=>f.YolosFeatureExtractor,YolosForObjectDetection:()=>t.YolosForObjectDetection,YolosImageProcessor:()=>f.YolosImageProcessor,YolosModel:()=>t.YolosModel,YolosObjectDetectionOutput:()=>t.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>t.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>r.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>r.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>r.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>r.ZeroShotObjectDetectionPipeline,bankers_round:()=>u.bankers_round,cat:()=>l.cat,cos_sim:()=>u.cos_sim,dot:()=>u.dot,dynamic_time_warping:()=>u.dynamic_time_warping,env:()=>e.env,full:()=>l.full,full_like:()=>l.full_like,getKeyValueShapes:()=>o.getKeyValueShapes,hamming:()=>n.hamming,hanning:()=>n.hanning,interpolate:()=>l.interpolate,interpolate_4d:()=>l.interpolate_4d,interpolate_data:()=>u.interpolate_data,is_chinese_char:()=>s.is_chinese_char,layer_norm:()=>l.layer_norm,load_image:()=>i.load_image,load_video:()=>a.load_video,log_softmax:()=>u.log_softmax,magnitude:()=>u.magnitude,matmul:()=>l.matmul,max:()=>u.max,mean:()=>l.mean,mean_pooling:()=>l.mean_pooling,medianFilter:()=>u.medianFilter,mel_filter_bank:()=>n.mel_filter_bank,min:()=>u.min,ones:()=>l.ones,ones_like:()=>l.ones_like,permute:()=>l.permute,permute_data:()=>u.permute_data,pipeline:()=>r.pipeline,quantize_embeddings:()=>l.quantize_embeddings,rand:()=>l.rand,read_audio:()=>n.read_audio,rfft:()=>l.rfft,round:()=>u.round,slice:()=>l.slice,softmax:()=>u.softmax,spectrogram:()=>n.spectrogram,stack:()=>l.stack,std_mean:()=>l.std_mean,topk:()=>l.topk,window_function:()=>n.window_function,zeros:()=>l.zeros,zeros_like:()=>l.zeros_like});var e=St("./src/env.js"),r=St("./src/pipelines.js"),t=St("./src/models.js"),s=St("./src/tokenizers.js"),o=St("./src/configs.js"),n=St("./src/utils/audio.js"),i=St("./src/utils/image.js"),a=St("./src/utils/video.js"),l=St("./src/utils/tensor.js"),u=St("./src/utils/maths.js"),p=St("./src/base/feature_extraction_utils.js"),d=St("./src/models/feature_extractors.js"),c=St("./src/models/auto/feature_extraction_auto.js"),_=St("./src/base/image_processors_utils.js"),f=St("./src/models/image_processors.js"),v=St("./src/models/auto/image_processing_auto.js"),$=St("./src/base/processing_utils.js"),w=St("./src/models/processors.js"),g=St("./src/models/auto/processing_auto.js"),C=St("./src/generation/streamers.js"),E=St("./src/generation/stopping_criteria.js"),y=St("./src/generation/logits_process.js")})();m.ASTFeatureExtractor;m.ASTForAudioClassification;m.ASTModel;m.ASTPreTrainedModel;m.AlbertForMaskedLM;m.AlbertForQuestionAnswering;m.AlbertForSequenceClassification;m.AlbertModel;m.AlbertPreTrainedModel;m.AlbertTokenizer;m.AudioClassificationPipeline;m.AutoConfig;m.AutoFeatureExtractor;m.AutoImageProcessor;var nT=m.AutoModel;m.AutoModelForAudioClassification;m.AutoModelForAudioFrameClassification;m.AutoModelForAudioTextToText;m.AutoModelForCTC;m.AutoModelForCausalLM;m.AutoModelForDepthEstimation;m.AutoModelForDocumentQuestionAnswering;m.AutoModelForImageClassification;m.AutoModelForImageFeatureExtraction;m.AutoModelForImageMatting;m.AutoModelForImageSegmentation;m.AutoModelForImageTextToText;m.AutoModelForImageToImage;m.AutoModelForMaskGeneration;m.AutoModelForMaskedLM;m.AutoModelForNormalEstimation;m.AutoModelForObjectDetection;m.AutoModelForPoseEstimation;m.AutoModelForQuestionAnswering;m.AutoModelForSemanticSegmentation;m.AutoModelForSeq2SeqLM;m.AutoModelForSequenceClassification;m.AutoModelForSpeechSeq2Seq;m.AutoModelForTextToSpectrogram;m.AutoModelForTextToWaveform;m.AutoModelForTokenClassification;m.AutoModelForUniversalSegmentation;m.AutoModelForVision2Seq;m.AutoModelForXVector;m.AutoModelForZeroShotObjectDetection;var oT=m.AutoProcessor;m.AutoTokenizer;m.AutomaticSpeechRecognitionPipeline;m.BackgroundRemovalPipeline;m.BartForConditionalGeneration;m.BartForSequenceClassification;m.BartModel;m.BartPretrainedModel;m.BartTokenizer;m.BaseModelOutput;m.BaseStreamer;m.BeitFeatureExtractor;m.BeitForImageClassification;m.BeitModel;m.BeitPreTrainedModel;m.BertForMaskedLM;m.BertForQuestionAnswering;m.BertForSequenceClassification;m.BertForTokenClassification;m.BertModel;m.BertPreTrainedModel;m.BertTokenizer;m.BitImageProcessor;m.BlenderbotForConditionalGeneration;m.BlenderbotModel;m.BlenderbotPreTrainedModel;m.BlenderbotSmallForConditionalGeneration;m.BlenderbotSmallModel;m.BlenderbotSmallPreTrainedModel;m.BlenderbotSmallTokenizer;m.BlenderbotTokenizer;m.BloomForCausalLM;m.BloomModel;m.BloomPreTrainedModel;m.BloomTokenizer;m.CLIPFeatureExtractor;m.CLIPImageProcessor;m.CLIPModel;m.CLIPPreTrainedModel;m.CLIPSegForImageSegmentation;m.CLIPSegModel;m.CLIPSegPreTrainedModel;m.CLIPTextModel;m.CLIPTextModelWithProjection;m.CLIPTokenizer;m.CLIPVisionModel;m.CLIPVisionModelWithProjection;m.CamembertForMaskedLM;m.CamembertForQuestionAnswering;m.CamembertForSequenceClassification;m.CamembertForTokenClassification;m.CamembertModel;m.CamembertPreTrainedModel;m.CamembertTokenizer;m.CausalLMOutput;m.CausalLMOutputWithPast;m.ChineseCLIPFeatureExtractor;m.ChineseCLIPModel;m.ChineseCLIPPreTrainedModel;m.ClapAudioModelWithProjection;m.ClapFeatureExtractor;m.ClapModel;m.ClapPreTrainedModel;m.ClapTextModelWithProjection;m.ClassifierFreeGuidanceLogitsProcessor;m.CodeGenForCausalLM;m.CodeGenModel;m.CodeGenPreTrainedModel;m.CodeGenTokenizer;m.CodeLlamaTokenizer;m.CohereForCausalLM;m.CohereModel;m.CoherePreTrainedModel;m.CohereTokenizer;m.ConvBertForMaskedLM;m.ConvBertForQuestionAnswering;m.ConvBertForSequenceClassification;m.ConvBertForTokenClassification;m.ConvBertModel;m.ConvBertPreTrainedModel;m.ConvBertTokenizer;m.ConvNextFeatureExtractor;m.ConvNextForImageClassification;m.ConvNextImageProcessor;m.ConvNextModel;m.ConvNextPreTrainedModel;m.ConvNextV2ForImageClassification;m.ConvNextV2Model;m.ConvNextV2PreTrainedModel;m.DPTFeatureExtractor;m.DPTForDepthEstimation;m.DPTImageProcessor;m.DPTModel;m.DPTPreTrainedModel;m.DacDecoderModel;m.DacDecoderOutput;m.DacEncoderModel;m.DacEncoderOutput;m.DacFeatureExtractor;m.DacModel;m.DacPreTrainedModel;m.DataTypeMap;m.DebertaForMaskedLM;m.DebertaForQuestionAnswering;m.DebertaForSequenceClassification;m.DebertaForTokenClassification;m.DebertaModel;m.DebertaPreTrainedModel;m.DebertaTokenizer;m.DebertaV2ForMaskedLM;m.DebertaV2ForQuestionAnswering;m.DebertaV2ForSequenceClassification;m.DebertaV2ForTokenClassification;m.DebertaV2Model;m.DebertaV2PreTrainedModel;m.DebertaV2Tokenizer;m.DecisionTransformerModel;m.DecisionTransformerPreTrainedModel;m.DeiTFeatureExtractor;m.DeiTForImageClassification;m.DeiTImageProcessor;m.DeiTModel;m.DeiTPreTrainedModel;m.DepthAnythingForDepthEstimation;m.DepthAnythingPreTrainedModel;m.DepthEstimationPipeline;m.DepthProForDepthEstimation;m.DepthProPreTrainedModel;m.DetrFeatureExtractor;m.DetrForObjectDetection;m.DetrForSegmentation;m.DetrImageProcessor;m.DetrModel;m.DetrObjectDetectionOutput;m.DetrPreTrainedModel;m.DetrSegmentationOutput;m.Dinov2ForImageClassification;m.Dinov2Model;m.Dinov2PreTrainedModel;m.Dinov2WithRegistersForImageClassification;m.Dinov2WithRegistersModel;m.Dinov2WithRegistersPreTrainedModel;m.DistilBertForMaskedLM;m.DistilBertForQuestionAnswering;m.DistilBertForSequenceClassification;m.DistilBertForTokenClassification;m.DistilBertModel;m.DistilBertPreTrainedModel;m.DistilBertTokenizer;m.DocumentQuestionAnsweringPipeline;m.DonutFeatureExtractor;m.DonutImageProcessor;m.DonutSwinModel;m.DonutSwinPreTrainedModel;m.EfficientNetForImageClassification;m.EfficientNetImageProcessor;m.EfficientNetModel;m.EfficientNetPreTrainedModel;m.ElectraForMaskedLM;m.ElectraForQuestionAnswering;m.ElectraForSequenceClassification;m.ElectraForTokenClassification;m.ElectraModel;m.ElectraPreTrainedModel;m.ElectraTokenizer;m.EncodecFeatureExtractor;m.EosTokenCriteria;m.EsmForMaskedLM;m.EsmForSequenceClassification;m.EsmForTokenClassification;m.EsmModel;m.EsmPreTrainedModel;m.EsmTokenizer;m.ExaoneForCausalLM;m.ExaoneModel;m.ExaonePreTrainedModel;m.FFT;m.FalconForCausalLM;m.FalconModel;m.FalconPreTrainedModel;m.FalconTokenizer;m.FastViTForImageClassification;m.FastViTModel;m.FastViTPreTrainedModel;m.FeatureExtractionPipeline;m.FeatureExtractor;m.FillMaskPipeline;m.Florence2ForConditionalGeneration;m.Florence2PreTrainedModel;m.Florence2Processor;m.ForcedBOSTokenLogitsProcessor;m.ForcedEOSTokenLogitsProcessor;m.GLPNFeatureExtractor;m.GLPNForDepthEstimation;m.GLPNModel;m.GLPNPreTrainedModel;m.GPT2LMHeadModel;m.GPT2Model;m.GPT2PreTrainedModel;m.GPT2Tokenizer;m.GPTBigCodeForCausalLM;m.GPTBigCodeModel;m.GPTBigCodePreTrainedModel;m.GPTJForCausalLM;m.GPTJModel;m.GPTJPreTrainedModel;m.GPTNeoForCausalLM;m.GPTNeoModel;m.GPTNeoPreTrainedModel;m.GPTNeoXForCausalLM;m.GPTNeoXModel;m.GPTNeoXPreTrainedModel;m.GPTNeoXTokenizer;m.Gemma2ForCausalLM;m.Gemma2Model;m.Gemma2PreTrainedModel;m.Gemma3ForCausalLM;m.Gemma3Model;m.Gemma3PreTrainedModel;m.GemmaForCausalLM;m.GemmaModel;m.GemmaPreTrainedModel;m.GemmaTokenizer;m.GlmForCausalLM;m.GlmModel;m.GlmPreTrainedModel;m.GraniteForCausalLM;m.GraniteModel;m.GranitePreTrainedModel;m.Grok1Tokenizer;m.GroundingDinoForObjectDetection;m.GroundingDinoImageProcessor;m.GroundingDinoPreTrainedModel;m.GroundingDinoProcessor;m.GroupViTModel;m.GroupViTPreTrainedModel;m.HeliumForCausalLM;m.HeliumModel;m.HeliumPreTrainedModel;m.HerbertTokenizer;m.HieraForImageClassification;m.HieraModel;m.HieraPreTrainedModel;m.HubertForCTC;m.HubertForSequenceClassification;m.HubertModel;m.HubertPreTrainedModel;m.IJepaForImageClassification;m.IJepaModel;m.IJepaPreTrainedModel;m.Idefics3ForConditionalGeneration;m.Idefics3ImageProcessor;m.Idefics3PreTrainedModel;m.Idefics3Processor;m.ImageClassificationPipeline;m.ImageFeatureExtractionPipeline;m.ImageFeatureExtractor;m.ImageMattingOutput;m.ImageProcessor;m.ImageSegmentationPipeline;m.ImageToImagePipeline;m.ImageToTextPipeline;m.InterruptableStoppingCriteria;m.JAISLMHeadModel;m.JAISModel;m.JAISPreTrainedModel;m.JinaCLIPImageProcessor;m.JinaCLIPModel;m.JinaCLIPPreTrainedModel;m.JinaCLIPProcessor;m.JinaCLIPTextModel;m.JinaCLIPVisionModel;m.LiteWhisperForConditionalGeneration;m.LlamaForCausalLM;m.LlamaModel;m.LlamaPreTrainedModel;m.LlamaTokenizer;m.LlavaForConditionalGeneration;m.LlavaOnevisionForConditionalGeneration;m.LlavaOnevisionImageProcessor;m.LlavaPreTrainedModel;m.LogitsProcessor;m.LogitsProcessorList;m.LogitsWarper;m.LongT5ForConditionalGeneration;m.LongT5Model;m.LongT5PreTrainedModel;m.M2M100ForConditionalGeneration;m.M2M100Model;m.M2M100PreTrainedModel;m.M2M100Tokenizer;m.MBart50Tokenizer;m.MBartForCausalLM;m.MBartForConditionalGeneration;m.MBartForSequenceClassification;m.MBartModel;m.MBartPreTrainedModel;m.MBartTokenizer;m.MPNetForMaskedLM;m.MPNetForQuestionAnswering;m.MPNetForSequenceClassification;m.MPNetForTokenClassification;m.MPNetModel;m.MPNetPreTrainedModel;m.MPNetTokenizer;m.MT5ForConditionalGeneration;m.MT5Model;m.MT5PreTrainedModel;m.MarianMTModel;m.MarianModel;m.MarianPreTrainedModel;m.MarianTokenizer;m.Mask2FormerImageProcessor;m.MaskFormerFeatureExtractor;m.MaskFormerForInstanceSegmentation;m.MaskFormerImageProcessor;m.MaskFormerModel;m.MaskFormerPreTrainedModel;m.MaskedLMOutput;m.MaxLengthCriteria;m.Metric3DForDepthEstimation;m.Metric3DPreTrainedModel;m.Metric3Dv2ForDepthEstimation;m.Metric3Dv2PreTrainedModel;m.MgpstrForSceneTextRecognition;m.MgpstrModelOutput;m.MgpstrPreTrainedModel;m.MgpstrProcessor;m.MgpstrTokenizer;m.MimiDecoderModel;m.MimiDecoderOutput;m.MimiEncoderModel;m.MimiEncoderOutput;m.MimiModel;m.MimiPreTrainedModel;m.MinLengthLogitsProcessor;m.MinNewTokensLengthLogitsProcessor;m.MistralForCausalLM;m.MistralModel;m.MistralPreTrainedModel;m.MobileBertForMaskedLM;m.MobileBertForQuestionAnswering;m.MobileBertForSequenceClassification;m.MobileBertModel;m.MobileBertPreTrainedModel;m.MobileBertTokenizer;m.MobileLLMForCausalLM;m.MobileLLMModel;m.MobileLLMPreTrainedModel;m.MobileNetV1FeatureExtractor;m.MobileNetV1ForImageClassification;m.MobileNetV1ForSemanticSegmentation;m.MobileNetV1ImageProcessor;m.MobileNetV1Model;m.MobileNetV1PreTrainedModel;m.MobileNetV2FeatureExtractor;m.MobileNetV2ForImageClassification;m.MobileNetV2ForSemanticSegmentation;m.MobileNetV2ImageProcessor;m.MobileNetV2Model;m.MobileNetV2PreTrainedModel;m.MobileNetV3FeatureExtractor;m.MobileNetV3ForImageClassification;m.MobileNetV3ForSemanticSegmentation;m.MobileNetV3ImageProcessor;m.MobileNetV3Model;m.MobileNetV3PreTrainedModel;m.MobileNetV4FeatureExtractor;m.MobileNetV4ForImageClassification;m.MobileNetV4ForSemanticSegmentation;m.MobileNetV4ImageProcessor;m.MobileNetV4Model;m.MobileNetV4PreTrainedModel;m.MobileViTFeatureExtractor;m.MobileViTForImageClassification;m.MobileViTImageProcessor;m.MobileViTModel;m.MobileViTPreTrainedModel;m.MobileViTV2ForImageClassification;m.MobileViTV2Model;m.MobileViTV2PreTrainedModel;m.ModelOutput;m.ModernBertForMaskedLM;m.ModernBertForSequenceClassification;m.ModernBertForTokenClassification;m.ModernBertModel;m.ModernBertPreTrainedModel;m.Moondream1ForConditionalGeneration;m.MoonshineFeatureExtractor;m.MoonshineForConditionalGeneration;m.MoonshineModel;m.MoonshinePreTrainedModel;m.MoonshineProcessor;m.MptForCausalLM;m.MptModel;m.MptPreTrainedModel;m.MultiModalityCausalLM;m.MultiModalityPreTrainedModel;m.MusicgenForCausalLM;m.MusicgenForConditionalGeneration;m.MusicgenModel;m.MusicgenPreTrainedModel;m.NllbTokenizer;m.NoBadWordsLogitsProcessor;m.NoRepeatNGramLogitsProcessor;m.NomicBertModel;m.NomicBertPreTrainedModel;m.NougatImageProcessor;m.NougatTokenizer;m.OPTForCausalLM;m.OPTModel;m.OPTPreTrainedModel;m.ObjectDetectionPipeline;m.Olmo2ForCausalLM;m.Olmo2Model;m.Olmo2PreTrainedModel;m.OlmoForCausalLM;m.OlmoModel;m.OlmoPreTrainedModel;m.OpenELMForCausalLM;m.OpenELMModel;m.OpenELMPreTrainedModel;m.OwlViTFeatureExtractor;m.OwlViTForObjectDetection;m.OwlViTImageProcessor;m.OwlViTModel;m.OwlViTPreTrainedModel;m.OwlViTProcessor;m.Owlv2ForObjectDetection;m.Owlv2ImageProcessor;m.Owlv2Model;m.Owlv2PreTrainedModel;m.PaliGemmaForConditionalGeneration;m.PaliGemmaPreTrainedModel;m.PaliGemmaProcessor;m.PatchTSMixerForPrediction;m.PatchTSMixerModel;m.PatchTSMixerPreTrainedModel;m.PatchTSTForPrediction;m.PatchTSTModel;m.PatchTSTPreTrainedModel;m.Phi3ForCausalLM;m.Phi3Model;m.Phi3PreTrainedModel;m.Phi3VForCausalLM;m.Phi3VImageProcessor;m.Phi3VPreTrainedModel;m.Phi3VProcessor;m.PhiForCausalLM;m.PhiModel;m.PhiPreTrainedModel;m.Pipeline;m.PreTrainedModel;m.PreTrainedTokenizer;m.PretrainedConfig;m.PretrainedMixin;m.Processor;m.PvtForImageClassification;m.PvtImageProcessor;m.PvtModel;m.PvtPreTrainedModel;m.PyAnnoteFeatureExtractor;m.PyAnnoteForAudioFrameClassification;m.PyAnnoteModel;m.PyAnnotePreTrainedModel;m.PyAnnoteProcessor;m.QuestionAnsweringModelOutput;m.QuestionAnsweringPipeline;m.Qwen2ForCausalLM;m.Qwen2Model;m.Qwen2PreTrainedModel;m.Qwen2Tokenizer;m.Qwen2VLForConditionalGeneration;m.Qwen2VLImageProcessor;m.Qwen2VLPreTrainedModel;m.Qwen2VLProcessor;m.RFDetrForObjectDetection;m.RFDetrModel;m.RFDetrObjectDetectionOutput;m.RFDetrPreTrainedModel;m.RTDetrForObjectDetection;m.RTDetrImageProcessor;m.RTDetrModel;m.RTDetrObjectDetectionOutput;m.RTDetrPreTrainedModel;m.RTDetrV2ForObjectDetection;m.RTDetrV2Model;m.RTDetrV2ObjectDetectionOutput;m.RTDetrV2PreTrainedModel;m.RawAudio;var sb=m.RawImage;m.RawVideo;m.RawVideoFrame;m.RepetitionPenaltyLogitsProcessor;m.ResNetForImageClassification;m.ResNetModel;m.ResNetPreTrainedModel;m.RoFormerForMaskedLM;m.RoFormerForQuestionAnswering;m.RoFormerForSequenceClassification;m.RoFormerForTokenClassification;m.RoFormerModel;m.RoFormerPreTrainedModel;m.RoFormerTokenizer;m.RobertaForMaskedLM;m.RobertaForQuestionAnswering;m.RobertaForSequenceClassification;m.RobertaForTokenClassification;m.RobertaModel;m.RobertaPreTrainedModel;m.RobertaTokenizer;m.SamImageProcessor;m.SamImageSegmentationOutput;m.SamModel;m.SamPreTrainedModel;m.SamProcessor;m.SapiensForDepthEstimation;m.SapiensForNormalEstimation;m.SapiensForSemanticSegmentation;m.SapiensPreTrainedModel;m.SeamlessM4TFeatureExtractor;m.SegformerFeatureExtractor;m.SegformerForImageClassification;m.SegformerForSemanticSegmentation;m.SegformerImageProcessor;m.SegformerModel;m.SegformerPreTrainedModel;m.Seq2SeqLMOutput;m.SequenceClassifierOutput;m.SiglipImageProcessor;m.SiglipModel;m.SiglipPreTrainedModel;m.SiglipTextModel;m.SiglipTokenizer;m.SiglipVisionModel;m.SmolVLMForConditionalGeneration;m.SmolVLMImageProcessor;m.SmolVLMProcessor;m.SnacDecoderModel;m.SnacEncoderModel;m.SnacFeatureExtractor;m.SnacModel;m.SnacPreTrainedModel;m.SpeechT5FeatureExtractor;m.SpeechT5ForSpeechToText;m.SpeechT5ForTextToSpeech;m.SpeechT5HifiGan;m.SpeechT5Model;m.SpeechT5PreTrainedModel;m.SpeechT5Processor;m.SpeechT5Tokenizer;m.SqueezeBertForMaskedLM;m.SqueezeBertForQuestionAnswering;m.SqueezeBertForSequenceClassification;m.SqueezeBertModel;m.SqueezeBertPreTrainedModel;m.SqueezeBertTokenizer;m.StableLmForCausalLM;m.StableLmModel;m.StableLmPreTrainedModel;m.Starcoder2ForCausalLM;m.Starcoder2Model;m.Starcoder2PreTrainedModel;m.StoppingCriteria;m.StoppingCriteriaList;m.StyleTextToSpeech2Model;m.StyleTextToSpeech2PreTrainedModel;m.SummarizationPipeline;m.SuppressTokensAtBeginLogitsProcessor;m.Swin2SRForImageSuperResolution;m.Swin2SRImageProcessor;m.Swin2SRModel;m.Swin2SRPreTrainedModel;m.SwinForImageClassification;m.SwinForSemanticSegmentation;m.SwinModel;m.SwinPreTrainedModel;m.T5ForConditionalGeneration;m.T5Model;m.T5PreTrainedModel;m.T5Tokenizer;m.TableTransformerForObjectDetection;m.TableTransformerModel;m.TableTransformerObjectDetectionOutput;m.TableTransformerPreTrainedModel;m.TemperatureLogitsWarper;m.Tensor;m.Text2TextGenerationPipeline;m.TextClassificationPipeline;m.TextGenerationPipeline;m.TextStreamer;m.TextToAudioPipeline;m.TokenClassificationPipeline;m.TokenClassifierOutput;m.TokenizerModel;m.TopKLogitsWarper;m.TopPLogitsWarper;m.TrOCRForCausalLM;m.TrOCRPreTrainedModel;m.TranslationPipeline;m.UltravoxModel;m.UltravoxPreTrainedModel;m.UltravoxProcessor;m.UniSpeechForCTC;m.UniSpeechForSequenceClassification;m.UniSpeechModel;m.UniSpeechPreTrainedModel;m.UniSpeechSatForAudioFrameClassification;m.UniSpeechSatForCTC;m.UniSpeechSatForSequenceClassification;m.UniSpeechSatModel;m.UniSpeechSatPreTrainedModel;m.VLChatProcessor;m.VLMImageProcessor;m.ViTFeatureExtractor;m.ViTForImageClassification;m.ViTImageProcessor;m.ViTMAEModel;m.ViTMAEPreTrainedModel;m.ViTMSNForImageClassification;m.ViTMSNModel;m.ViTMSNPreTrainedModel;m.ViTModel;m.ViTPreTrainedModel;m.VisionEncoderDecoderModel;m.VitMatteForImageMatting;m.VitMatteImageProcessor;m.VitMattePreTrainedModel;m.VitPoseForPoseEstimation;m.VitPoseImageProcessor;m.VitPosePreTrainedModel;m.VitsModel;m.VitsModelOutput;m.VitsPreTrainedModel;m.VitsTokenizer;m.Wav2Vec2BertForCTC;m.Wav2Vec2BertForSequenceClassification;m.Wav2Vec2BertModel;m.Wav2Vec2BertPreTrainedModel;m.Wav2Vec2CTCTokenizer;m.Wav2Vec2FeatureExtractor;m.Wav2Vec2ForAudioFrameClassification;m.Wav2Vec2ForCTC;m.Wav2Vec2ForSequenceClassification;m.Wav2Vec2Model;m.Wav2Vec2PreTrainedModel;m.Wav2Vec2Processor;m.Wav2Vec2ProcessorWithLM;m.WavLMForAudioFrameClassification;m.WavLMForCTC;m.WavLMForSequenceClassification;m.WavLMForXVector;m.WavLMModel;m.WavLMPreTrainedModel;m.WeSpeakerFeatureExtractor;m.WeSpeakerResNetModel;m.WeSpeakerResNetPreTrainedModel;m.WhisperFeatureExtractor;m.WhisperForConditionalGeneration;m.WhisperModel;m.WhisperPreTrainedModel;m.WhisperProcessor;m.WhisperTextStreamer;m.WhisperTimeStampLogitsProcessor;m.WhisperTokenizer;m.XLMForQuestionAnswering;m.XLMForSequenceClassification;m.XLMForTokenClassification;m.XLMModel;m.XLMPreTrainedModel;m.XLMRobertaForMaskedLM;m.XLMRobertaForQuestionAnswering;m.XLMRobertaForSequenceClassification;m.XLMRobertaForTokenClassification;m.XLMRobertaModel;m.XLMRobertaPreTrainedModel;m.XLMRobertaTokenizer;m.XLMTokenizer;m.XLMWithLMHeadModel;m.XVectorOutput;m.YolosFeatureExtractor;m.YolosForObjectDetection;m.YolosImageProcessor;m.YolosModel;m.YolosObjectDetectionOutput;m.YolosPreTrainedModel;m.ZeroShotAudioClassificationPipeline;m.ZeroShotClassificationPipeline;m.ZeroShotImageClassificationPipeline;m.ZeroShotObjectDetectionPipeline;m.bankers_round;m.cat;m.cos_sim;m.dot;m.dynamic_time_warping;var iT=m.env;m.full;m.full_like;m.getKeyValueShapes;m.hamming;m.hanning;m.interpolate;m.interpolate_4d;m.interpolate_data;m.is_chinese_char;m.layer_norm;m.load_image;m.load_video;m.log_softmax;m.magnitude;m.matmul;m.max;m.mean;m.mean_pooling;m.medianFilter;m.mel_filter_bank;m.min;m.ones;m.ones_like;m.permute;m.permute_data;m.pipeline;m.quantize_embeddings;m.rand;m.read_audio;m.rfft;m.round;m.slice;m.softmax;m.spectrogram;m.stack;m.std_mean;m.topk;m.window_function;m.zeros;m.zeros_like;async function aT(){try{if(lT())return{supported:!1,isNode:!0,reason:"",fp16Supported:!1};if(typeof navigator>"u"||!navigator.gpu)return{supported:!1,isNode:!1,reason:"WebGPU is not available (navigator.gpu is undefined)",fp16Supported:!1};const e=await navigator.gpu.requestAdapter();return e?{supported:!0,isNode:!1,reason:"",adapter:e,fp16Supported:e.features.has("shader-f16")}:{supported:!1,isNode:!1,reason:"WebGPU is not supported (no adapter found)",fp16Supported:!1}}catch(e){return{supported:!1,isNode:!1,reason:e instanceof Error?e.toString():String(e),fp16Supported:!1}}}function lT(){return typeof process<"u"&&"versions"in process&&process.versions!=null&&typeof process.versions=="object"&&"node"in process.versions&&process.versions.node!=null}const uT={flex:"","flex-col":"","items-center":"","gap-4":""},dT=["disabled"],cT={"h-full":"","w-full":"",flex:"","gap-2":""},pT={w:"[50%]",border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","min-h":"120",h:"auto","overflow-hidden":"","rounded-lg":""},hT=["src"],mT={w:"[50%]",border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","min-h":"120",h:"auto",relative:"","overflow-hidden":"","rounded-lg":""},fT={key:0,bg:"black/50",absolute:"","inset-0":"","z-10":"",flex:"","flex-col":"","items-center":"","justify-center":""},_T={"mb-4":"","text-white":"","font-medium":""},gT={bg:"gray-200/30",w:"70%","h-2":"","overflow-hidden":"","rounded-full":""},wT=["src"],bT={bg:"black/0 group-hover:black/20",absolute:"","inset-0":"",flex:"","items-center":"","justify-center":"","transition-all":"","duration-200":""},MT=["onClick"],yT={key:1,absolute:"","bottom-2":"","right-2":""},CT=pv({__name:"background-remove",setup(e){const r=ks(),t=ks(),s=ks(),o=ks(),n=ks(!1),i=ks(0),a=ks(),l=ks(),u=ks([]),p=hv(()=>u.value.map(f=>URL.createObjectURL(f)));mv(async()=>{try{if(!(await aT()).supported)throw new Error("WebGPU is not supported in this browser.");const f="Xenova/modnet";iT.backends.onnx.wasm.proxy=!1,r.value??(r.value=await nT.from_pretrained(f,{device:"webgpu"})),t.value??(t.value=await oT.from_pretrained(f,{}))}catch(f){s.value=f}o.value=!1});async function d(){if(!r.value||!t.value)return;n.value=!0,i.value=0,a.value=[];const f=p.value.length;for(let v=0;v=a.value.length||!u.value[f])return;const v=u.value[f].name,$=v.substring(0,v.lastIndexOf("."))||v,w=v.substring(v.lastIndexOf("."))||".png",g=`${$}-background-removed${w}`,C=document.createElement("a");C.href=a.value[f],C.download=g,document.body.appendChild(C),C.click(),document.body.removeChild(C)}function _(){!a.value||a.value.length===0||a.value.forEach((f,v)=>{setTimeout(()=>c(v),v*100)})}return(f,v)=>(En(),Tn("div",uT,[Sr("button",{bg:"neutral-100 dark:neutral-800","w-full":"","cursor-pointer":"","rounded-lg":"","px-3":"","py-2":"",disabled:n.value,onClick:d},wf(n.value?"Processing...":"Process"),9,dT),Sr("div",cT,[Sr("div",pT,[(En(!0),Tn(bf,null,Mf(p.value,($,w)=>(En(),Tn("img",{key:w,src:$,"h-full":"","w-full":"","object-cover":""},null,8,hT))),128))]),Sr("div",mT,[n.value?(En(),Tn("div",fT,[Sr("div",_T,wf(i.value)+"% ",1),Sr("div",gT,[Sr("div",{bg:"emerald-500","h-full":"",style:_v({width:`${i.value}%`}),"transition-all":"","duration-200":""},null,4)])])):yf("",!0),(En(!0),Tn(bf,null,Mf(a.value,($,w)=>(En(),Tn("div",{key:w,relative:"",class:"group","h-full":"","w-full":""},[Sr("img",{src:$,"h-full":"","w-full":"","object-cover":""},null,8,wT),Sr("div",bT,[Sr("button",{bg:"emerald-500 hover:emerald-600","rounded-full":"","p-2":"","text-white":"","opacity-0":"","transition-all":"","duration-200":"","group-hover:opacity-100":"",onClick:g=>c(w)},v[1]||(v[1]=[Sr("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[Sr("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})],-1)]),8,MT)])]))),128)),a.value&&a.value.length>1?(En(),Tn("div",yT,[Sr("button",{bg:"emerald-500 hover:emerald-600","rounded-full":"","p-2":"","text-white":"",onClick:_},v[2]||(v[2]=[Sr("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[Sr("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"})],-1)]))])):yf("",!0)])]),fv(gv(cv),{modelValue:u.value,"onUpdate:modelValue":v[0]||(v[0]=$=>u.value=$),"w-full":""},null,8,["modelValue"])]))}});export{CT as default}; diff --git a/assets/chat-IOYwmzQg.js b/assets/chat-BJiWkk-g.js similarity index 99% rename from assets/chat-IOYwmzQg.js rename to assets/chat-BJiWkk-g.js index b55980fee79af59cf508686116d6392b2e1e5818..85adaed3cff264e05e7311e0672a16d96435e442 100644 --- a/assets/chat-IOYwmzQg.js +++ b/assets/chat-BJiWkk-g.js @@ -1 +1 @@ -import{d as N,bD as W,g as S,c as h,o as y,a as i,A as C,bE as E,u as M,ad as A,bx as P,by as q,t as z,C as U,D as $}from"./index-20XXNHAB.js";import{s as K}from"./index-D975M2PQ.js";import"./index-Be1NqeGb.js";var O=()=>{let e=null;return{getStore:()=>(e===null&&console.warn("Woops! Looks like you are calling `getContext` after `await fn()`. Please move `getContext` to top level of handler."),e),run(r,o){e=r;try{return o()}finally{e=null}}}},H=new WeakMap,I=new WeakMap,T=0,F=0,_=e=>{const r=`${T++}`,o={include:t=>n.has(t),with:t=>{const d=`${F++}`,l={[Symbol.toStringTag]:`WorkflowEvent(${r}.${d})`,toString:()=>`WorkflowEvent(${r}.${d})`,toJSON:()=>({event:r,data:t}),get data(){return t}};return n.add(l),Object.freeze(l),I.set(l,o),l}},n=new WeakSet;return H.set(o,n),Object.defineProperty(o,Symbol.toStringTag,{get:()=>`WorkflowEvent<${r}>`}),Object.defineProperty(o,"displayName",{value:`WorkflowEvent<${r}>`}),o.toString=()=>`WorkflowEvent<${r}>`,Object.freeze(o),o},j=e=>e!=null&&typeof e=="object"&&"data"in e,J=e=>e!=null&&typeof e.then=="function";function R(e,r){const o=new Array(e.length);for(const n of r)for(let t=0;t{const r=[],o=(a,f,p)=>{let c;const g={get abortController(){return c||(c=new AbortController),c},handler:a,inputs:f,outputs:[],prev:p,next:new Set};g.prev.next.add(g);const v=d(g);G.run(g,()=>{const s=[...new Set([...x.__internal__call_context,...v.__internal__call_context])];B.run(v,()=>{let u=0;const b=()=>{if(u===s.length){let k;try{k=a(...f)}catch(m){if(c??l)(c??l).abort(m);else throw console.error("unhandled error in handler",m),m}J(k)?k.then(m=>{j(m)&&v.sendEvent(m)}):j(k)&&v.sendEvent(k)}const L=s[u];L&&(u++,L(v,f,b))};b()})})},n=a=>{const f=[...r];[...e].filter(([p])=>R(p,f).length===p.length).map(([p,c])=>{const g=R(p,f);g.forEach(v=>{r.splice(r.indexOf(v),1)});for(const v of c)o(v.handler,g,a)})},t=[],d=a=>({get stream(){let f;return new ReadableStream({start:async p=>{f=c=>{let g=D.get(c);for(;g;){if(g===a){p.enqueue(c);break}g=g.prev}},t.push(f)}})},get signal(){return a.abortController.signal},sendEvent:(...f)=>{f.forEach(p=>{D.set(p,a),a.outputs.push(p),r.push(p),t.forEach(c=>c(p)),n(a)})},__internal__call_context:new Set});let l=new AbortController;const x=d({get abortController(){return l||(l=new AbortController),l},inputs:[],outputs:[],handler:null,prev:null,next:new Set});return x};function X(){const e={steps:new Map};return{handle:(r,o)=>{if(e.steps.has(r)){const n=e.steps.get(r),t={get handler(){return o},unsubscribe:()=>{n.delete(t),n.size===0&&e.steps.delete(r)}};return n.add(t),t}else{const n=new Set,t={get handler(){return o},unsubscribe:()=>{n.delete(t),n.size===0&&e.steps.delete(r)}};return n.add(t),e.steps.set(r,n),t}},createContext(){return Q({listeners:e.steps})}}}async function Y(e,r,o){const{stream:n,sendEvent:t}=e.createContext();t(r);for await(const d of n)if(o.include(d))return d;throw new Error("Workflow did not return a stop event")}function Z(e,r){const o=(...n)=>{const t=r.filter(([w])=>w.every((x,a)=>x.include(n[a]))).map(([w,x])=>x),l=V().sendEvent;return(...w)=>{let x=!1;for(let a=0;ap.include(w[c]))){x=!0;break}}return x&&console.warn("Invalid input detected [%s]",w.map(a=>a.data).join(", ")),l(...w)}};return{...e,handle:(n,t)=>{const d=(...l)=>{const w=V();return t(w.safeSendEvent,...l)};return e.handle(n,d)},createContext(){const n=e.createContext();return n.__internal__call_context.add((t,d,l)=>{t.safeSendEvent=o(...d),l()}),n}}}const ee={flex:"","flex-col":"","gap-2":""},te={flex:"~ col","gap-2":""},ne={flex:"","flex-col":"","gap-2":""},re={grid:"","grid-cols-2":"","gap-2":""},oe={flex:"","items-center":"","gap-2":""},ae={flex:"","items-center":"","gap-2":""},le={flex:"","items-center":"","gap-2":""},se={key:0},ue={key:1},fe=N({__name:"chat",setup(e){const r=W("settings/llm/baseUrl","https://openrouter.ai/api/v1/"),o=W("settings/llm/apiKey",""),n=W("settings/llm/model","openai/gpt-4o-mini"),t=S(""),d=S([]),l=S({role:"assistant",content:""}),w=S(!1),x=_(),a=_(),f=_(),p=_(),c=_();async function g(){w.value=!0;try{const v=Z(X(),[[[x],[a,c]],[[a],[f]],[[f],[p]]]);v.handle([x],async s=>{l.value={role:"assistant",content:""},d.value.push({role:"user",content:t.value}),d.value.push(l.value);const u=await K({baseURL:r.value,apiKey:o.value,model:n.value,messages:d.value.slice(0,d.value.length-1).map(b=>z(b))});for await(const b of u.chunkStream)s(a.with(b.choices[0].delta.content||""));return c.with()}),v.handle([a],async(s,u)=>{l.value.content?l.value.content+=u.data:l.value.content=u.data}),await Y(v,x.with(),c)}catch(v){console.error(v)}finally{w.value=!1}}return(v,s)=>(y(),h("div",ee,[i("div",te,[i("div",ne,[s[7]||(s[7]=i("div",null,[i("span",{"text-neutral-500":"","dark:text-neutral-400":""},"LLM")],-1)),i("div",re,[i("label",oe,[s[4]||(s[4]=i("span",{"text-nowrap":""}," Base URL ",-1)),C(i("input",{"onUpdate:modelValue":s[0]||(s[0]=u=>A(r)?r.value=u:null),border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"},null,512),[[E,M(r)]])]),i("label",ae,[s[5]||(s[5]=i("span",{"text-nowrap":""}," API Key ",-1)),C(i("input",{"onUpdate:modelValue":s[1]||(s[1]=u=>A(o)?o.value=u:null),type:"password",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"},null,512),[[E,M(o)]])]),i("label",le,[s[6]||(s[6]=i("span",{"text-nowrap":""}," Model ",-1)),C(i("input",{"onUpdate:modelValue":s[2]||(s[2]=u=>A(n)?n.value=u:null),border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"},null,512),[[E,M(n)]])])])]),i("div",null,[C(i("textarea",{"onUpdate:modelValue":s[3]||(s[3]=u=>t.value=u),border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"},null,512),[[E,t.value]])]),i("button",{"rounded-lg":"",bg:"blue-100 dark:blue-900","px-4":"","py-2":"",onClick:g}," Send "),i("div",null,[(y(!0),h(P,null,q(d.value,(u,b)=>(y(),h("div",{key:b},[u.role==="user"?(y(),h("div",se,[i("span",null,$(u.content),1)])):U("",!0),u.role==="assistant"?(y(),h("div",ue,[i("span",null,$(u.content),1)])):U("",!0)]))),128))])])]))}});export{fe as default}; +import{d as N,bD as W,g as S,c as h,o as y,a as i,A as C,bE as E,u as M,ad as A,bx as P,by as q,t as z,C as U,D as $}from"./index-D8Nm21zW.js";import{s as K}from"./index-D975M2PQ.js";import"./index-Be1NqeGb.js";var O=()=>{let e=null;return{getStore:()=>(e===null&&console.warn("Woops! Looks like you are calling `getContext` after `await fn()`. Please move `getContext` to top level of handler."),e),run(r,o){e=r;try{return o()}finally{e=null}}}},H=new WeakMap,I=new WeakMap,T=0,F=0,_=e=>{const r=`${T++}`,o={include:t=>n.has(t),with:t=>{const d=`${F++}`,l={[Symbol.toStringTag]:`WorkflowEvent(${r}.${d})`,toString:()=>`WorkflowEvent(${r}.${d})`,toJSON:()=>({event:r,data:t}),get data(){return t}};return n.add(l),Object.freeze(l),I.set(l,o),l}},n=new WeakSet;return H.set(o,n),Object.defineProperty(o,Symbol.toStringTag,{get:()=>`WorkflowEvent<${r}>`}),Object.defineProperty(o,"displayName",{value:`WorkflowEvent<${r}>`}),o.toString=()=>`WorkflowEvent<${r}>`,Object.freeze(o),o},j=e=>e!=null&&typeof e=="object"&&"data"in e,J=e=>e!=null&&typeof e.then=="function";function R(e,r){const o=new Array(e.length);for(const n of r)for(let t=0;t{const r=[],o=(a,f,p)=>{let c;const g={get abortController(){return c||(c=new AbortController),c},handler:a,inputs:f,outputs:[],prev:p,next:new Set};g.prev.next.add(g);const v=d(g);G.run(g,()=>{const s=[...new Set([...x.__internal__call_context,...v.__internal__call_context])];B.run(v,()=>{let u=0;const b=()=>{if(u===s.length){let k;try{k=a(...f)}catch(m){if(c??l)(c??l).abort(m);else throw console.error("unhandled error in handler",m),m}J(k)?k.then(m=>{j(m)&&v.sendEvent(m)}):j(k)&&v.sendEvent(k)}const L=s[u];L&&(u++,L(v,f,b))};b()})})},n=a=>{const f=[...r];[...e].filter(([p])=>R(p,f).length===p.length).map(([p,c])=>{const g=R(p,f);g.forEach(v=>{r.splice(r.indexOf(v),1)});for(const v of c)o(v.handler,g,a)})},t=[],d=a=>({get stream(){let f;return new ReadableStream({start:async p=>{f=c=>{let g=D.get(c);for(;g;){if(g===a){p.enqueue(c);break}g=g.prev}},t.push(f)}})},get signal(){return a.abortController.signal},sendEvent:(...f)=>{f.forEach(p=>{D.set(p,a),a.outputs.push(p),r.push(p),t.forEach(c=>c(p)),n(a)})},__internal__call_context:new Set});let l=new AbortController;const x=d({get abortController(){return l||(l=new AbortController),l},inputs:[],outputs:[],handler:null,prev:null,next:new Set});return x};function X(){const e={steps:new Map};return{handle:(r,o)=>{if(e.steps.has(r)){const n=e.steps.get(r),t={get handler(){return o},unsubscribe:()=>{n.delete(t),n.size===0&&e.steps.delete(r)}};return n.add(t),t}else{const n=new Set,t={get handler(){return o},unsubscribe:()=>{n.delete(t),n.size===0&&e.steps.delete(r)}};return n.add(t),e.steps.set(r,n),t}},createContext(){return Q({listeners:e.steps})}}}async function Y(e,r,o){const{stream:n,sendEvent:t}=e.createContext();t(r);for await(const d of n)if(o.include(d))return d;throw new Error("Workflow did not return a stop event")}function Z(e,r){const o=(...n)=>{const t=r.filter(([w])=>w.every((x,a)=>x.include(n[a]))).map(([w,x])=>x),l=V().sendEvent;return(...w)=>{let x=!1;for(let a=0;ap.include(w[c]))){x=!0;break}}return x&&console.warn("Invalid input detected [%s]",w.map(a=>a.data).join(", ")),l(...w)}};return{...e,handle:(n,t)=>{const d=(...l)=>{const w=V();return t(w.safeSendEvent,...l)};return e.handle(n,d)},createContext(){const n=e.createContext();return n.__internal__call_context.add((t,d,l)=>{t.safeSendEvent=o(...d),l()}),n}}}const ee={flex:"","flex-col":"","gap-2":""},te={flex:"~ col","gap-2":""},ne={flex:"","flex-col":"","gap-2":""},re={grid:"","grid-cols-2":"","gap-2":""},oe={flex:"","items-center":"","gap-2":""},ae={flex:"","items-center":"","gap-2":""},le={flex:"","items-center":"","gap-2":""},se={key:0},ue={key:1},fe=N({__name:"chat",setup(e){const r=W("settings/llm/baseUrl","https://openrouter.ai/api/v1/"),o=W("settings/llm/apiKey",""),n=W("settings/llm/model","openai/gpt-4o-mini"),t=S(""),d=S([]),l=S({role:"assistant",content:""}),w=S(!1),x=_(),a=_(),f=_(),p=_(),c=_();async function g(){w.value=!0;try{const v=Z(X(),[[[x],[a,c]],[[a],[f]],[[f],[p]]]);v.handle([x],async s=>{l.value={role:"assistant",content:""},d.value.push({role:"user",content:t.value}),d.value.push(l.value);const u=await K({baseURL:r.value,apiKey:o.value,model:n.value,messages:d.value.slice(0,d.value.length-1).map(b=>z(b))});for await(const b of u.chunkStream)s(a.with(b.choices[0].delta.content||""));return c.with()}),v.handle([a],async(s,u)=>{l.value.content?l.value.content+=u.data:l.value.content=u.data}),await Y(v,x.with(),c)}catch(v){console.error(v)}finally{w.value=!1}}return(v,s)=>(y(),h("div",ee,[i("div",te,[i("div",ne,[s[7]||(s[7]=i("div",null,[i("span",{"text-neutral-500":"","dark:text-neutral-400":""},"LLM")],-1)),i("div",re,[i("label",oe,[s[4]||(s[4]=i("span",{"text-nowrap":""}," Base URL ",-1)),C(i("input",{"onUpdate:modelValue":s[0]||(s[0]=u=>A(r)?r.value=u:null),border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"},null,512),[[E,M(r)]])]),i("label",ae,[s[5]||(s[5]=i("span",{"text-nowrap":""}," API Key ",-1)),C(i("input",{"onUpdate:modelValue":s[1]||(s[1]=u=>A(o)?o.value=u:null),type:"password",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"},null,512),[[E,M(o)]])]),i("label",le,[s[6]||(s[6]=i("span",{"text-nowrap":""}," Model ",-1)),C(i("input",{"onUpdate:modelValue":s[2]||(s[2]=u=>A(n)?n.value=u:null),border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"},null,512),[[E,M(n)]])])])]),i("div",null,[C(i("textarea",{"onUpdate:modelValue":s[3]||(s[3]=u=>t.value=u),border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",text:"disabled:neutral-400 dark:disabled:neutral-600",cursor:"disabled:not-allowed","w-full":"","rounded-lg":"","px-2":"","py-1":"","text-nowrap":"","text-sm":"","outline-none":"",shadow:"sm",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900"},null,512),[[E,t.value]])]),i("button",{"rounded-lg":"",bg:"blue-100 dark:blue-900","px-4":"","py-2":"",onClick:g}," Send "),i("div",null,[(y(!0),h(P,null,q(d.value,(u,b)=>(y(),h("div",{key:b},[u.role==="user"?(y(),h("div",se,[i("span",null,$(u.content),1)])):U("",!0),u.role==="assistant"?(y(),h("div",ue,[i("span",null,$(u.content),1)])):U("",!0)]))),128))])])]))}});export{fe as default}; diff --git a/assets/cloudflare-workers-ai-CcKNsU55.js b/assets/cloudflare-workers-ai-CcKNsU55.js new file mode 100644 index 0000000000000000000000000000000000000000..6ab6e6d173abec44cdb68550cea47368b7f4dbb8 --- /dev/null +++ b/assets/cloudflare-workers-ai-CcKNsU55.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as V,bI as w,bJ as y,x as k,o as I,q,bG as x,s as M,h as v,l as $,w as K,y as f,b as c,u as l}from"./index-D8Nm21zW.js";import{u as P}from"./providers-DUDq6kdm.js";import{_ as z}from"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import{_ as A}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as B,a as C}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as N}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const R=V({__name:"ProviderAccountIdInput",props:w({placeholder:null,required:{type:Boolean},label:null,description:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const r=p,u=y(p,"modelValue");return(n,e)=>(I(),k(z,{modelValue:u.value,"onUpdate:modelValue":e[0]||(e[0]=t=>u.value=t),label:r.label||"Account ID",description:r.description||"Account ID",placeholder:r.placeholder,required:r.required,type:"text"},null,8,["modelValue","label","description","placeholder","required"]))}}),a="cloudflare-workers-ai",H=V({__name:"cloudflare-workers-ai",setup(p){const{t:r}=q(),u=x(),n=P(),{providers:e}=M(n),t=v(()=>n.getProviderMetadata(a)),s=v({get:()=>{var o;return((o=e.value[a])==null?void 0:o.apiKey)||""},set:o=>{e.value[a]||(e.value[a]={}),e.value[a].apiKey=o}}),d=v({get:()=>{var o;return((o=e.value[a])==null?void 0:o.accountId)||""},set:o=>{e.value[a]||(e.value[a]={}),e.value[a].accountId=o}});$(()=>{var o,i;n.initializeProvider(a),s.value=((o=e.value[a])==null?void 0:o.apiKey)||"",d.value=((i=e.value[a])==null?void 0:i.accountId)||""}),K([s,d],()=>{e.value[a]={...e.value[a],apiKey:s.value,accountId:d.value}});function h(){var o;e.value[a]={...(o=t.value)==null?void 0:o.defaultOptions}}return(o,i)=>{var _,g;return I(),k(l(N),{"provider-name":(_=t.value)==null?void 0:_.localizedName,"provider-icon-color":(g=t.value)==null?void 0:g.iconColor,"on-back":()=>l(u).back()},{default:f(()=>[c(l(B),null,{default:f(()=>[c(l(C),{title:l(r)("settings.pages.providers.common.section.basic.title"),description:l(r)("settings.pages.providers.common.section.basic.description"),"on-reset":h},{default:f(()=>{var b;return[c(l(A),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=m=>s.value=m),"provider-name":(b=t.value)==null?void 0:b.localizedName,placeholder:l(r)("settings.pages.providers.provider.cloudflare-workers-ai.fields.field.api-key.placeholder")},null,8,["modelValue","provider-name","placeholder"]),c(l(R),{modelValue:d.value,"onUpdate:modelValue":i[1]||(i[1]=m=>d.value=m),label:l(r)("settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.label"),description:l(r)("settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.description"),placeholder:l(r)("settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.placeholder")},null,8,["modelValue","label","description","placeholder"])]}),_:1},8,["title","description"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{H as default}; diff --git a/assets/cloudflare-workers-ai-D1L-vcTZ.js b/assets/cloudflare-workers-ai-D1L-vcTZ.js deleted file mode 100644 index 2fabdf0b7e711ec1d3a4aa9543ba867029cca5c6..0000000000000000000000000000000000000000 --- a/assets/cloudflare-workers-ai-D1L-vcTZ.js +++ /dev/null @@ -1 +0,0 @@ -import{d as V,bI as w,bJ as y,x as k,o as I,q,bG as x,s as M,h as v,l as $,w as K,y as f,b as c,u as l}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as P}from"./providers-BqZLRXH1.js";import{_ as z}from"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import{_ as A}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as B,a as C}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as N}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const R=V({__name:"ProviderAccountIdInput",props:w({placeholder:null,required:{type:Boolean},label:null,description:null},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const r=p,u=y(p,"modelValue");return(n,e)=>(I(),k(z,{modelValue:u.value,"onUpdate:modelValue":e[0]||(e[0]=t=>u.value=t),label:r.label||"Account ID",description:r.description||"Account ID",placeholder:r.placeholder,required:r.required,type:"text"},null,8,["modelValue","label","description","placeholder","required"]))}}),a="cloudflare-workers-ai",H=V({__name:"cloudflare-workers-ai",setup(p){const{t:r}=q(),u=x(),n=P(),{providers:e}=M(n),t=v(()=>n.getProviderMetadata(a)),s=v({get:()=>{var o;return((o=e.value[a])==null?void 0:o.apiKey)||""},set:o=>{e.value[a]||(e.value[a]={}),e.value[a].apiKey=o}}),d=v({get:()=>{var o;return((o=e.value[a])==null?void 0:o.accountId)||""},set:o=>{e.value[a]||(e.value[a]={}),e.value[a].accountId=o}});$(()=>{var o,i;n.initializeProvider(a),s.value=((o=e.value[a])==null?void 0:o.apiKey)||"",d.value=((i=e.value[a])==null?void 0:i.accountId)||""}),K([s,d],()=>{e.value[a]={...e.value[a],apiKey:s.value,accountId:d.value}});function h(){var o;e.value[a]={...(o=t.value)==null?void 0:o.defaultOptions}}return(o,i)=>{var _,g;return I(),k(l(N),{"provider-name":(_=t.value)==null?void 0:_.localizedName,"provider-icon-color":(g=t.value)==null?void 0:g.iconColor,"on-back":()=>l(u).back()},{default:f(()=>[c(l(B),null,{default:f(()=>[c(l(C),{title:l(r)("settings.pages.providers.common.section.basic.title"),description:l(r)("settings.pages.providers.common.section.basic.description"),"on-reset":h},{default:f(()=>{var b;return[c(l(A),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=m=>s.value=m),"provider-name":(b=t.value)==null?void 0:b.localizedName,placeholder:l(r)("settings.pages.providers.provider.cloudflare-workers-ai.fields.field.api-key.placeholder")},null,8,["modelValue","provider-name","placeholder"]),c(l(R),{modelValue:d.value,"onUpdate:modelValue":i[1]||(i[1]=m=>d.value=m),label:l(r)("settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.label"),description:l(r)("settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.description"),placeholder:l(r)("settings.pages.providers.provider.cloudflare-workers-ai.fields.field.account-id.placeholder")},null,8,["modelValue","label","description","placeholder"])]}),_:1},8,["title","description"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{H as default}; diff --git a/assets/consciousness-Buft8SO9.js b/assets/consciousness-Buft8SO9.js deleted file mode 100644 index 0d58c305cb815f6097b9320a4e3aaceb73c315b3..0000000000000000000000000000000000000000 --- a/assets/consciousness-Buft8SO9.js +++ /dev/null @@ -1 +0,0 @@ -import{d as R,s as b,q as U,l as q,bw as z,c as r,o as l,b as h,a as e,A as f,u as s,C as k,D as i,bx as y,by as B,y as E,bo as T,x as M,ad as p,bE as $}from"./index-20XXNHAB.js";import{R as j,a as A}from"./RadioCardDetailManySelect-CYbSNUGq.js";import{_ as F}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as Q}from"./consciousness-D04GkOp_.js";import{u as G}from"./providers-BqZLRXH1.js";import{b as w}from"./route-block-B_A1xBdJ.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./index-Be1NqeGb.js";const I={bg:"neutral-50 dark:[rgba(0,0,0,0.3)]","rounded-xl":"","p-4":"",flex:"~ col gap-4"},H={flex:"~ col gap-4"},J={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-500"},K={text:"neutral-400 dark:neutral-400"},O={"max-w-full":""},W={key:0,flex:"~ row gap-4",style:{"scrollbar-width":"none"},"min-w-0":"","of-x-scroll":"","scroll-smooth":"",role:"radiogroup"},X={key:1},Y={key:0},Z={flex:"~ col gap-4"},ee={class:"text-lg md:text-2xl"},se={text:"neutral-400 dark:neutral-400"},te={key:0,class:"flex items-center justify-center py-4"},oe={key:1,class:"flex items-center gap-3 border border-red-200 rounded-lg bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"},ie={class:"flex flex-col"},le={class:"font-medium"},ne={class:"text-sm text-red-600 dark:text-red-400"},re={key:2,class:"flex items-center gap-3 border border-amber-200 rounded-lg bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},de={class:"flex flex-col"},ae={class:"font-medium"},ce={class:"text-sm text-amber-600 dark:text-amber-400"},ue={key:1},pe={flex:"~ col gap-4"},me={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},xe={text:"neutral-400 dark:neutral-500"},ge={class:"bg-primary-50 border-primary-200 dark:bg-primary-900/20 dark:border-primary-800 flex items-center gap-3 border rounded-lg p-4"},ve={class:"flex flex-col"},_e={class:"font-medium"},be={class:"dark:text-primary-400 text-primary-600 text-sm"},he={class:"mt-2"},fe={class:"mb-1 block text-sm font-medium"},ke=["placeholder"],ye={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},Me=R({__name:"consciousness",setup(we){const V=G(),x=Q(),{availableProviders:C,availableTextGenerationsProvidersMetadata:P}=b(V),{activeProvider:d,activeModel:a,customModelName:S,modelSearchQuery:c,supportsModelListing:g,providerModels:m,isLoadingActiveProviderModels:v,activeProviderModelError:_}=b(x),{t}=U();q(async()=>{await x.loadModelsForProvider(d.value)});function N(u){S.value=u}return(u,o)=>{const D=z("motion");return l(),r(y,null,[h(s(F),{title:u.$t("settings.pages.modules.consciousness.title"),subtitle:u.$t("settings.pages.modules.title")},null,8,["title","subtitle"]),e("div",I,[e("div",null,[e("div",H,[e("div",null,[e("h2",J,i(s(t)("settings.pages.providers.title")),1),e("div",K,[e("span",null,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.description")),1)])]),e("div",O,[s(C).length>0?(l(),r("fieldset",W,[(l(!0),r(y,null,B(s(P),n=>(l(),M(s(A),{id:n.id,key:n.id,modelValue:s(d),"onUpdate:modelValue":o[0]||(o[0]=L=>p(d)?d.value=L:null),name:"provider",value:n.id,title:n.localizedName,description:n.localizedDescription},null,8,["id","modelValue","value","title","description"]))),128))])):(l(),r("div",X,[h(s(T),{class:"flex items-center gap-3 rounded-lg p-4",border:"2 dashed neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-800",transition:"colors duration-200 ease-in-out",to:"/settings/providers"},{default:E(()=>o[4]||(o[4]=[e("div",{"i-solar:warning-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1),e("div",{class:"flex flex-col"},[e("span",{class:"font-medium"},"No Providers Configured"),e("span",{class:"text-sm text-neutral-400 dark:text-neutral-500"},"Click here to set up your LLM providers")],-1),e("div",{"i-solar:arrow-right-line-duotone":"",class:"ml-auto text-xl text-neutral-400 dark:text-neutral-500"},null,-1)])),_:1})]))])])]),s(d)&&s(g)?(l(),r("div",Y,[e("div",Z,[e("div",null,[e("h2",ee,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.title")),1),e("div",se,[e("span",null,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.subtitle")),1)])]),s(v)?(l(),r("div",te,[o[5]||(o[5]=e("div",{class:"mr-2 animate-spin"},[e("div",{"i-solar:spinner-line-duotone":"","text-xl":""})],-1)),e("span",null,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.loading")),1)])):s(_)?(l(),r("div",oe,[o[6]||(o[6]=e("div",{"i-solar:close-circle-line-duotone":"",class:"text-2xl text-red-500 dark:text-red-400"},null,-1)),e("div",ie,[e("span",le,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.error")),1),e("span",ne,i(s(_)),1)])])):s(m).length===0&&!s(v)?(l(),r("div",re,[o[7]||(o[7]=e("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),e("div",de,[e("span",ae,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_models")),1),e("span",ce,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_models_description")),1)])])):s(m).length>0?(l(),M(s(j),{key:3,modelValue:s(a),"onUpdate:modelValue":o[1]||(o[1]=n=>p(a)?a.value=n:null),"search-query":s(c),"onUpdate:searchQuery":o[2]||(o[2]=n=>p(c)?c.value=n:null),items:s(m),searchable:!0,"search-placeholder":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.search_placeholder"),"search-no-results-title":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_search_results"),"search-no-results-description":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_search_results_description",{query:s(c)}),"search-results-text":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.search_results",{count:"{count}",total:"{total}"}),"custom-input-placeholder":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.custom_model_placeholder"),"expand-button-text":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.expand"),"collapse-button-text":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.collapse"),"onUpdate:customValue":N},null,8,["modelValue","search-query","items","search-placeholder","search-no-results-title","search-no-results-description","search-results-text","custom-input-placeholder","expand-button-text","collapse-button-text"])):k("",!0)])])):s(d)&&!s(g)?(l(),r("div",ue,[e("div",pe,[e("div",null,[e("h2",me,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.title")),1),e("div",xe,[e("span",null,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.subtitle")),1)])]),e("div",ge,[o[8]||(o[8]=e("div",{"i-solar:info-circle-line-duotone":"",class:"text-primary-500 dark:text-primary-400 text-2xl"},null,-1)),e("div",ve,[e("span",_e,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.not_supported")),1),e("span",be,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.not_supported_description")),1)])]),e("div",he,[e("label",fe,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.manual_model_name")),1),f(e("input",{"onUpdate:modelValue":o[3]||(o[3]=n=>p(a)?a.value=n:null),type:"text",class:"w-full border border-neutral-300 rounded bg-white px-3 py-2 dark:border-neutral-700 dark:bg-neutral-900",placeholder:s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.manual_model_placeholder")},null,8,ke),[[$,s(a)]])])])])):k("",!0)]),f((l(),r("div",ye,o[9]||(o[9]=[e("div",{text:"60","i-solar:ghost-bold-duotone":""},null,-1)]))),[[D]])],64)}}});typeof w=="function"&&w(Me);export{Me as default}; diff --git a/assets/consciousness-D04GkOp_.js b/assets/consciousness-CgTB9b9w.js similarity index 90% rename from assets/consciousness-D04GkOp_.js rename to assets/consciousness-CgTB9b9w.js index c1cd1f3e75ff2af28d089d05bc7ad1de49b5b95b..500f7eb2bbff2ce90d28a80906209d794423d39c 100644 --- a/assets/consciousness-D04GkOp_.js +++ b/assets/consciousness-CgTB9b9w.js @@ -1 +1 @@ -import{f as P,bD as n,g as M,h as r,w as L}from"./index-20XXNHAB.js";import{u as w}from"./providers-BqZLRXH1.js";const h=P("consciousness",()=>{const o=w(),s=n("settings/consciousness/active-provider",""),c=n("settings/consciousness/active-model",""),d=n("settings/consciousness/active-custom-model",""),l=M({}),i=M(""),m=r(()=>{var e;return((e=o.getProviderMetadata(s.value))==null?void 0:e.capabilities.listModels)!==void 0}),a=r(()=>o.getModelsForProvider(s.value)),f=r(()=>o.isLoadingModels[s.value]||!1),g=r(()=>o.modelLoadError[s.value]||null),p=r(()=>{if(!i.value.trim())return a.value;const e=i.value.toLowerCase().trim();return a.value.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))});function u(){c.value="",d.value="",l.value={},i.value=""}async function v(e){var t;e&&((t=o.getProviderMetadata(s.value))==null?void 0:t.capabilities.listModels)!==void 0&&o.getModelsForProvider(e).length===0&&await o.fetchModelsForProvider(e)}return L(s,async e=>{await v(e),u()}),{activeProvider:s,activeModel:c,customModelName:d,expandedDescriptions:l,modelSearchQuery:i,supportsModelListing:m,providerModels:a,isLoadingActiveProviderModels:f,activeProviderModelError:g,filteredModels:p,resetModelSelection:u,loadModelsForProvider:v}});export{h as u}; +import{f as P,bD as n,g as M,h as r,w as L}from"./index-D8Nm21zW.js";import{u as w}from"./providers-DUDq6kdm.js";const h=P("consciousness",()=>{const o=w(),s=n("settings/consciousness/active-provider",""),c=n("settings/consciousness/active-model",""),d=n("settings/consciousness/active-custom-model",""),l=M({}),i=M(""),m=r(()=>{var e;return((e=o.getProviderMetadata(s.value))==null?void 0:e.capabilities.listModels)!==void 0}),a=r(()=>o.getModelsForProvider(s.value)),f=r(()=>o.isLoadingModels[s.value]||!1),g=r(()=>o.modelLoadError[s.value]||null),p=r(()=>{if(!i.value.trim())return a.value;const e=i.value.toLowerCase().trim();return a.value.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.description&&t.description.toLowerCase().includes(e))});function u(){c.value="",d.value="",l.value={},i.value=""}async function v(e){var t;e&&((t=o.getProviderMetadata(s.value))==null?void 0:t.capabilities.listModels)!==void 0&&o.getModelsForProvider(e).length===0&&await o.fetchModelsForProvider(e)}return L(s,async e=>{await v(e),u()}),{activeProvider:s,activeModel:c,customModelName:d,expandedDescriptions:l,modelSearchQuery:i,supportsModelListing:m,providerModels:a,isLoadingActiveProviderModels:f,activeProviderModelError:g,filteredModels:p,resetModelSelection:u,loadModelsForProvider:v}});export{h as u}; diff --git a/assets/consciousness-qQlC4dPp.js b/assets/consciousness-qQlC4dPp.js new file mode 100644 index 0000000000000000000000000000000000000000..aa3bbe01252744f39366faf4eb5d19903df10882 --- /dev/null +++ b/assets/consciousness-qQlC4dPp.js @@ -0,0 +1 @@ +import{d as R,s as b,q as U,l as q,bw as z,c as r,o as l,b as h,a as e,A as f,u as s,C as k,D as i,bx as y,by as B,y as E,bo as T,x as M,ad as p,bE as $}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{R as j,a as A}from"./RadioCardDetailManySelect-6Dh1XQsR.js";import{_ as F}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{u as Q}from"./consciousness-CgTB9b9w.js";import{u as G}from"./providers-DUDq6kdm.js";import{b as w}from"./route-block-B_A1xBdJ.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./index-Be1NqeGb.js";const I={bg:"neutral-50 dark:[rgba(0,0,0,0.3)]","rounded-xl":"","p-4":"",flex:"~ col gap-4"},H={flex:"~ col gap-4"},J={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-500"},K={text:"neutral-400 dark:neutral-400"},O={"max-w-full":""},W={key:0,flex:"~ row gap-4",style:{"scrollbar-width":"none"},"min-w-0":"","of-x-scroll":"","scroll-smooth":"",role:"radiogroup"},X={key:1},Y={key:0},Z={flex:"~ col gap-4"},ee={class:"text-lg md:text-2xl"},se={text:"neutral-400 dark:neutral-400"},te={key:0,class:"flex items-center justify-center py-4"},oe={key:1,class:"flex items-center gap-3 border border-red-200 rounded-lg bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"},ie={class:"flex flex-col"},le={class:"font-medium"},ne={class:"text-sm text-red-600 dark:text-red-400"},re={key:2,class:"flex items-center gap-3 border border-amber-200 rounded-lg bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},de={class:"flex flex-col"},ae={class:"font-medium"},ce={class:"text-sm text-amber-600 dark:text-amber-400"},ue={key:1},pe={flex:"~ col gap-4"},me={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},xe={text:"neutral-400 dark:neutral-500"},ge={class:"bg-primary-50 border-primary-200 dark:bg-primary-900/20 dark:border-primary-800 flex items-center gap-3 border rounded-lg p-4"},ve={class:"flex flex-col"},_e={class:"font-medium"},be={class:"dark:text-primary-400 text-primary-600 text-sm"},he={class:"mt-2"},fe={class:"mb-1 block text-sm font-medium"},ke=["placeholder"],ye={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},Me=R({__name:"consciousness",setup(we){const V=G(),x=Q(),{availableProviders:C,availableTextGenerationsProvidersMetadata:P}=b(V),{activeProvider:d,activeModel:a,customModelName:S,modelSearchQuery:c,supportsModelListing:g,providerModels:m,isLoadingActiveProviderModels:v,activeProviderModelError:_}=b(x),{t}=U();q(async()=>{await x.loadModelsForProvider(d.value)});function N(u){S.value=u}return(u,o)=>{const D=z("motion");return l(),r(y,null,[h(s(F),{title:u.$t("settings.pages.modules.consciousness.title"),subtitle:u.$t("settings.pages.modules.title")},null,8,["title","subtitle"]),e("div",I,[e("div",null,[e("div",H,[e("div",null,[e("h2",J,i(s(t)("settings.pages.providers.title")),1),e("div",K,[e("span",null,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.description")),1)])]),e("div",O,[s(C).length>0?(l(),r("fieldset",W,[(l(!0),r(y,null,B(s(P),n=>(l(),M(s(A),{id:n.id,key:n.id,modelValue:s(d),"onUpdate:modelValue":o[0]||(o[0]=L=>p(d)?d.value=L:null),name:"provider",value:n.id,title:n.localizedName,description:n.localizedDescription},null,8,["id","modelValue","value","title","description"]))),128))])):(l(),r("div",X,[h(s(T),{class:"flex items-center gap-3 rounded-lg p-4",border:"2 dashed neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-800",transition:"colors duration-200 ease-in-out",to:"/settings/providers"},{default:E(()=>o[4]||(o[4]=[e("div",{"i-solar:warning-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1),e("div",{class:"flex flex-col"},[e("span",{class:"font-medium"},"No Providers Configured"),e("span",{class:"text-sm text-neutral-400 dark:text-neutral-500"},"Click here to set up your LLM providers")],-1),e("div",{"i-solar:arrow-right-line-duotone":"",class:"ml-auto text-xl text-neutral-400 dark:text-neutral-500"},null,-1)])),_:1})]))])])]),s(d)&&s(g)?(l(),r("div",Y,[e("div",Z,[e("div",null,[e("h2",ee,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.title")),1),e("div",se,[e("span",null,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.subtitle")),1)])]),s(v)?(l(),r("div",te,[o[5]||(o[5]=e("div",{class:"mr-2 animate-spin"},[e("div",{"i-solar:spinner-line-duotone":"","text-xl":""})],-1)),e("span",null,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.loading")),1)])):s(_)?(l(),r("div",oe,[o[6]||(o[6]=e("div",{"i-solar:close-circle-line-duotone":"",class:"text-2xl text-red-500 dark:text-red-400"},null,-1)),e("div",ie,[e("span",le,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.error")),1),e("span",ne,i(s(_)),1)])])):s(m).length===0&&!s(v)?(l(),r("div",re,[o[7]||(o[7]=e("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),e("div",de,[e("span",ae,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_models")),1),e("span",ce,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_models_description")),1)])])):s(m).length>0?(l(),M(s(j),{key:3,modelValue:s(a),"onUpdate:modelValue":o[1]||(o[1]=n=>p(a)?a.value=n:null),"search-query":s(c),"onUpdate:searchQuery":o[2]||(o[2]=n=>p(c)?c.value=n:null),items:s(m),searchable:!0,"search-placeholder":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.search_placeholder"),"search-no-results-title":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_search_results"),"search-no-results-description":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_search_results_description",{query:s(c)}),"search-results-text":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.search_results",{count:"{count}",total:"{total}"}),"custom-input-placeholder":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.custom_model_placeholder"),"expand-button-text":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.expand"),"collapse-button-text":s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.collapse"),"onUpdate:customValue":N},null,8,["modelValue","search-query","items","search-placeholder","search-no-results-title","search-no-results-description","search-results-text","custom-input-placeholder","expand-button-text","collapse-button-text"])):k("",!0)])])):s(d)&&!s(g)?(l(),r("div",ue,[e("div",pe,[e("div",null,[e("h2",me,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.title")),1),e("div",xe,[e("span",null,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.subtitle")),1)])]),e("div",ge,[o[8]||(o[8]=e("div",{"i-solar:info-circle-line-duotone":"",class:"text-primary-500 dark:text-primary-400 text-2xl"},null,-1)),e("div",ve,[e("span",_e,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.not_supported")),1),e("span",be,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.not_supported_description")),1)])]),e("div",he,[e("label",fe,i(s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.manual_model_name")),1),f(e("input",{"onUpdate:modelValue":o[3]||(o[3]=n=>p(a)?a.value=n:null),type:"text",class:"w-full border border-neutral-300 rounded bg-white px-3 py-2 dark:border-neutral-700 dark:bg-neutral-900",placeholder:s(t)("settings.pages.modules.consciousness.sections.section.provider-model-selection.manual_model_placeholder")},null,8,ke),[[$,s(a)]])])])])):k("",!0)]),f((l(),r("div",ye,o[9]||(o[9]=[e("div",{text:"60","i-solar:ghost-bold-duotone":""},null,-1)]))),[[D]])],64)}}});typeof w=="function"&&w(Me);export{Me as default}; diff --git a/assets/deepseek-D0YOA2Go.js b/assets/deepseek-D0YOA2Go.js deleted file mode 100644 index 9a60eb4571109fd41f66fa08137bc72c852b87ad..0000000000000000000000000000000000000000 --- a/assets/deepseek-D0YOA2Go.js +++ /dev/null @@ -1 +0,0 @@ -import{d as k,q as U,bG as V,s as y,h as c,l as $,w as K,x as h,o as x,y as u,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as w}from"./providers-BqZLRXH1.js";import{_ as z,a as C}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as M}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as N,a as P}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as R}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="deepseek",L=k({__name:"deepseek",setup(S){const{t:d}=U(),_=V(),m=w(),{providers:o}=y(m),n=c(()=>m.getProviderMetadata(a)),r=c({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),i=c({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,s;m.initializeProvider(a),r.value=((e=o.value[a])==null?void 0:e.apiKey)||"",i.value=((s=o.value[a])==null?void 0:s.baseUrl)||""}),K([r,i],()=>{o.value[a]={...o.value[a],apiKey:r.value,baseUrl:i.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,s)=>{var v,f;return x(),h(t(R),{"provider-name":(v=n.value)==null?void 0:v.localizedName,"provider-icon-color":(f=n.value)==null?void 0:f.iconColor,"on-back":()=>t(_).back()},{default:u(()=>[l(t(N),null,{default:u(()=>[l(t(P),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:u(()=>{var p;return[l(t(M),{modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=g=>r.value=g),"provider-name":(p=n.value)==null?void 0:p.localizedName,placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:u(()=>[l(t(C),{modelValue:i.value,"onUpdate:modelValue":s[1]||(s[1]=p=>i.value=p),placeholder:"https://api.deepseek.com/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{L as default}; diff --git a/assets/deepseek-D7OL7kwG.js b/assets/deepseek-D7OL7kwG.js new file mode 100644 index 0000000000000000000000000000000000000000..56f129573082d6ce38170b7b0c2cd6eb4a9e67d5 --- /dev/null +++ b/assets/deepseek-D7OL7kwG.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as k,q as U,bG as V,s as y,h as c,l as $,w as K,x as h,o as x,y as u,b as l,u as t}from"./index-D8Nm21zW.js";import{u as w}from"./providers-DUDq6kdm.js";import{_ as z,a as C}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as M}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as N,a as P}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as R}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="deepseek",L=k({__name:"deepseek",setup(S){const{t:d}=U(),_=V(),m=w(),{providers:o}=y(m),n=c(()=>m.getProviderMetadata(a)),r=c({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),i=c({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,s;m.initializeProvider(a),r.value=((e=o.value[a])==null?void 0:e.apiKey)||"",i.value=((s=o.value[a])==null?void 0:s.baseUrl)||""}),K([r,i],()=>{o.value[a]={...o.value[a],apiKey:r.value,baseUrl:i.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,s)=>{var v,f;return x(),h(t(R),{"provider-name":(v=n.value)==null?void 0:v.localizedName,"provider-icon-color":(f=n.value)==null?void 0:f.iconColor,"on-back":()=>t(_).back()},{default:u(()=>[l(t(N),null,{default:u(()=>[l(t(P),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:u(()=>{var p;return[l(t(M),{modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=g=>r.value=g),"provider-name":(p=n.value)==null?void 0:p.localizedName,placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:u(()=>[l(t(C),{modelValue:i.value,"onUpdate:modelValue":s[1]||(s[1]=p=>i.value=p),placeholder:"https://api.deepseek.com/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{L as default}; diff --git a/assets/default-CBhsjBzT.js b/assets/default-_iAhyx9C.js similarity index 89% rename from assets/default-CBhsjBzT.js rename to assets/default-_iAhyx9C.js index e21e69b35541b0d67a6fd2a76ff6b1594201dd59..3701c3e3a7b05c33fb2f59f6efb553f0e21c934a 100644 --- a/assets/default-CBhsjBzT.js +++ b/assets/default-_iAhyx9C.js @@ -1 +1 @@ -import{d as t,c as s,a as e,b as a,u as o,R as n,o as p}from"./index-20XXNHAB.js";import{H as d}from"./HeaderLink-Ctrr6qTq.js";const r={style:{paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingTop:"env(safe-area-inset-top, 0px)",paddingRight:"env(safe-area-inset-right, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)"}},i={class:"px-0 py-1 md:px-3 md:py-3","w-full":"","gap-2":"",bg:"$bg-color"},c={class:"px-3 py-2 md:px-5 md:py-5",flex:"~ col","mx-auto":"","max-w-screen-xl":""},u=t({__name:"default",setup(m){return(f,l)=>(p(),s("div",r,[e("div",i,[a(d)]),e("div",c,[a(o(n))])]))}});export{u as default}; +import{d as t,c as s,a as e,b as a,u as o,R as n,o as p}from"./index-D8Nm21zW.js";import{H as d}from"./HeaderLink-yHEt2vbv.js";const r={style:{paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingTop:"env(safe-area-inset-top, 0px)",paddingRight:"env(safe-area-inset-right, 0px)",paddingLeft:"env(safe-area-inset-left, 0px)"}},i={class:"px-0 py-1 md:px-3 md:py-3","w-full":"","gap-2":"",bg:"$bg-color"},c={class:"px-3 py-2 md:px-5 md:py-5",flex:"~ col","mx-auto":"","max-w-screen-xl":""},u=t({__name:"default",setup(m){return(f,l)=>(p(),s("div",r,[e("div",i,[a(d)]),e("div",c,[a(o(n))])]))}});export{u as default}; diff --git a/assets/default-node-DXqP3VzA.js b/assets/default-node-C_5jnHCL.js similarity index 89% rename from assets/default-node-DXqP3VzA.js rename to assets/default-node-C_5jnHCL.js index d5f9954bec5b6f986600eafd869694adc13460af..2dc3aa768b1bb3e1a96127fe53592655079f0a9f 100644 --- a/assets/default-node-DXqP3VzA.js +++ b/assets/default-node-C_5jnHCL.js @@ -1 +1 @@ -import{cm as t}from"./index-20XXNHAB.js";async function m(){const{createRequire:a}=await t(async()=>{const{createRequire:o}=await import("./__vite-browser-external-FmFgRqLi.js");return{createRequire:o}},[]),{dirname:n,resolve:e}=await t(async()=>{const{dirname:o,resolve:c}=await import("./__vite-browser-external-FmFgRqLi.js");return{dirname:o,resolve:c}},[]),d=a(import.meta.url),r=n(d.resolve("@duckdb/duckdb-wasm"));return{mvp:{mainModule:e(r,"./duckdb-mvp.wasm"),mainWorker:e(r,"./duckdb-node-mvp.worker.cjs")},eh:{mainModule:e(r,"./duckdb-eh.wasm"),mainWorker:e(r,"./duckdb-node-eh.worker.cjs")}}}export{m as getBundles}; +import{cm as t}from"./index-D8Nm21zW.js";async function m(){const{createRequire:a}=await t(async()=>{const{createRequire:o}=await import("./__vite-browser-external-FmFgRqLi.js");return{createRequire:o}},[]),{dirname:n,resolve:e}=await t(async()=>{const{dirname:o,resolve:c}=await import("./__vite-browser-external-FmFgRqLi.js");return{dirname:o,resolve:c}},[]),d=a(import.meta.url),r=n(d.resolve("@duckdb/duckdb-wasm"));return{mvp:{mainModule:e(r,"./duckdb-mvp.wasm"),mainWorker:e(r,"./duckdb-node-mvp.worker.cjs")},eh:{mainModule:e(r,"./duckdb-eh.wasm"),mainWorker:e(r,"./duckdb-node-eh.worker.cjs")}}}export{m as getBundles}; diff --git a/assets/delays-BXyQjCVq.js b/assets/delays-BXyQjCVq.js deleted file mode 100644 index 0ccd4ce1eab29607526c6f7431c6e2c823600ce1..0000000000000000000000000000000000000000 --- a/assets/delays-BXyQjCVq.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as v}from"./Textarea.vue_vue_type_script_setup_true_lang-BPvpJbgL.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as _,g as r,c as n,o as t,a as e,b,u as k,D as i,bx as f,by as m}from"./index-20XXNHAB.js";import{b as y,l as x}from"./queues-DD-Guues.js";import"./index-B2mNUwLE.js";import"./Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js";import"./queue-DpWku5ab.js";const w={flex:"","flex-col":"","gap-2":"","p-2":""},h={flex:"","flex-row":"","gap-2":""},M={"rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-4":""},V={"w-full":"",flex:"","flex-row":"","gap-4":""},D={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},E={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},H=_({__name:"delays",setup(S){const s=r(""),c=r([]),p=r([]),u=r(!1),d=y();d.onHandlerEvent("delay",a=>{p.value.push(a)});function g(){u.value=!0;const a=s.value.split("");for(const o of a)d.add(o);d.add(x),s.value="",u.value=!1}return(a,o)=>(t(),n("div",w,[e("div",h,[b(k(v),{modelValue:s.value,"onUpdate:modelValue":o[0]||(o[0]=l=>s.value=l),placeholder:"Message",p:"2",bg:"neutral-100 dark:neutral-700","w-full":"","rounded-lg":"","outline-none":"",onSubmit:g},null,8,["modelValue"]),e("button",M,i(u.value?"Processing...":"Send"),1)]),e("div",V,[e("div",D,[o[1]||(o[1]=e("h3",{"font-semibold":""}," Emotion Message ",-1)),(t(!0),n(f,null,m(c.value,l=>(t(),n("div",{key:l},[e("div",null,i(l),1)]))),128))]),e("div",E,[o[2]||(o[2]=e("h3",{"font-semibold":""}," Delays ",-1)),(t(!0),n(f,null,m(p.value,l=>(t(),n("div",{key:l},[e("div",null,i(l)+"s",1)]))),128))])])]))}});export{H as default}; diff --git a/assets/delays-CbCH4HsM.js b/assets/delays-CbCH4HsM.js new file mode 100644 index 0000000000000000000000000000000000000000..f755a5d7c58fed99d7953258e989e99e145b9231 --- /dev/null +++ b/assets/delays-CbCH4HsM.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as v}from"./Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js";import{d as _,g as r,c as n,o as t,a as e,b,u as k,D as i,bx as f,by as m}from"./index-D8Nm21zW.js";import{b as y,l as x}from"./queues-DJEZsGUG.js";import"./index-DxNnZI6o.js";import"./Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js";import"./queue-CEzllKo3.js";const w={flex:"","flex-col":"","gap-2":"","p-2":""},h={flex:"","flex-row":"","gap-2":""},M={"rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-4":""},V={"w-full":"",flex:"","flex-row":"","gap-4":""},D={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},E={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},H=_({__name:"delays",setup(S){const s=r(""),c=r([]),p=r([]),u=r(!1),d=y();d.onHandlerEvent("delay",a=>{p.value.push(a)});function g(){u.value=!0;const a=s.value.split("");for(const o of a)d.add(o);d.add(x),s.value="",u.value=!1}return(a,o)=>(t(),n("div",w,[e("div",h,[b(k(v),{modelValue:s.value,"onUpdate:modelValue":o[0]||(o[0]=l=>s.value=l),placeholder:"Message",p:"2",bg:"neutral-100 dark:neutral-700","w-full":"","rounded-lg":"","outline-none":"",onSubmit:g},null,8,["modelValue"]),e("button",M,i(u.value?"Processing...":"Send"),1)]),e("div",V,[e("div",D,[o[1]||(o[1]=e("h3",{"font-semibold":""}," Emotion Message ",-1)),(t(!0),n(f,null,m(c.value,l=>(t(),n("div",{key:l},[e("div",null,i(l),1)]))),128))]),e("div",E,[o[2]||(o[2]=e("h3",{"font-semibold":""}," Delays ",-1)),(t(!0),n(f,null,m(p.value,l=>(t(),n("div",{key:l},[e("div",null,i(l)+"s",1)]))),128))])])]))}});export{H as default}; diff --git a/assets/elevenlabs-1fmL3c-0.js b/assets/elevenlabs-1fmL3c-0.js new file mode 100644 index 0000000000000000000000000000000000000000..bcfb28cd05deb60918f70167df01688a3dde7569 --- /dev/null +++ b/assets/elevenlabs-1fmL3c-0.js @@ -0,0 +1 @@ +import{_ as h}from"./TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js";import{_ as p}from"./FieldRange.vue_vue_type_script_setup_true_lang-B670Jjy-.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as $,g as n,s as F,q as I,h as S,l as E,w as r,x as K,o as L,y as _,b as d,u as o,a as N}from"./index-D8Nm21zW.js";import{u as T}from"./providers-DUDq6kdm.js";import{u as q}from"./speech-B27BwGQ-.js";import{_ as z,a as G}from"./SpeechProviderSettings.vue_vue_type_script_setup_true_lang-Cscdqs1L.js";import"./index-Be1NqeGb.js";import"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const H={flex:"~ col gap-4"},l="elevenlabs",w="eleven_multilingual_v2",ae=$({__name:"elevenlabs",setup(R){const V={similarityBoost:.75,stability:.5,speed:1,style:0,useSpeakerBoost:!0},v=n(0),u=n(1),m=n(0),f=n(0),c=n(.5),g=n(.75),b=n(!1),y=q(),t=T(),{providers:C}=F(t),{t:a}=I(),k=S(()=>{var e;return!!((e=C.value[l])!=null&&e.apiKey)}),B=S(()=>y.availableVoices[l]||[]);async function M(e,i,s){const P=t.getProviderInstance(l);if(!P)throw new Error("Failed to initialize speech provider");const x=t.getProviderConfig(l),U=x.model||w;return await y.speech(P,U,e,i,{...x,...V})}return E(async()=>{const e=t.getProviderConfig(l);await t.getProviderMetadata(l).validators.validateProviderConfig(e)?await y.loadVoicesForProvider(l):console.error("Failed to validate provider config",e)}),r(v,async()=>{const e=t.getProviderConfig(l);e.pitch=v.value}),r(u,async()=>{const e=t.getProviderConfig(l);e.speed=u.value}),r(m,async()=>{const e=t.getProviderConfig(l);e.volume=m.value}),r(f,async()=>{const e=t.getProviderConfig(l);e.style=f.value}),r(c,async()=>{const e=t.getProviderConfig(l);e.stability=c.value}),r(g,async()=>{const e=t.getProviderConfig(l);e.similarityBoost=g.value}),r(b,async()=>{const e=t.getProviderConfig(l);e.useSpeakerBoost=b.value}),r(C,async()=>{const e=t.getProviderConfig(l);await t.getProviderMetadata(l).validators.validateProviderConfig(e)?await y.loadVoicesForProvider(l):console.error("Failed to validate provider config",e)},{immediate:!0}),(e,i)=>(L(),K(o(G),{"provider-id":l,"default-model":w,"additional-settings":V},{"voice-settings":_(()=>[N("div",H,[d(o(p),{modelValue:v.value,"onUpdate:modelValue":i[0]||(i[0]=s=>v.value=s),label:o(a)("settings.pages.providers.provider.common.fields.field.pitch.label"),description:o(a)("settings.pages.providers.provider.common.fields.field.pitch.description"),min:-100,max:100,step:1,"format-value":s=>`${s}%`},null,8,["modelValue","label","description","format-value"]),d(o(p),{modelValue:u.value,"onUpdate:modelValue":i[1]||(i[1]=s=>u.value=s),label:o(a)("settings.pages.providers.provider.common.fields.field.speed.label"),description:o(a)("settings.pages.providers.provider.common.fields.field.speed.description"),min:.5,max:2,step:.01},null,8,["modelValue","label","description"]),d(o(p),{modelValue:m.value,"onUpdate:modelValue":i[2]||(i[2]=s=>m.value=s),label:o(a)("settings.pages.providers.provider.common.fields.field.volume.label"),description:o(a)("settings.pages.providers.provider.common.fields.field.volume.description"),min:-100,max:100,step:1,"format-value":s=>`${s}%`},null,8,["modelValue","label","description","format-value"]),d(o(p),{modelValue:f.value,"onUpdate:modelValue":i[3]||(i[3]=s=>f.value=s),label:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.style.label"),description:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.style.description"),min:0,max:1,step:.01},null,8,["modelValue","label","description"]),d(o(p),{modelValue:c.value,"onUpdate:modelValue":i[4]||(i[4]=s=>c.value=s),label:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.stability.label"),description:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.stability.description"),min:0,max:1,step:.01},null,8,["modelValue","label","description"]),d(o(p),{modelValue:g.value,"onUpdate:modelValue":i[5]||(i[5]=s=>g.value=s),label:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.simularity-boost.label"),description:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.simularity-boost.description"),min:0,max:1,step:.01},null,8,["modelValue","label","description"]),d(o(h),{modelValue:b.value,"onUpdate:modelValue":i[6]||(i[6]=s=>b.value=s),label:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.speaker-boost.label"),description:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.speaker-boost.description")},null,8,["modelValue","label","description"])])]),playground:_(()=>[d(o(z),{"available-voices":B.value,"generate-speech":M,"api-key-configured":k.value,"default-text":"Hello! This is a test of the ElevenLabs voice synthesis."},null,8,["available-voices","api-key-configured"])]),_:1}))}});export{ae as default}; diff --git a/assets/elevenlabs-D1J23Omd.js b/assets/elevenlabs-D1J23Omd.js deleted file mode 100644 index 9bcb8fb670f88fca54b01623d4ac74a7879a42a7..0000000000000000000000000000000000000000 --- a/assets/elevenlabs-D1J23Omd.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as h}from"./TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js";import{_ as p}from"./FieldRange.vue_vue_type_script_setup_true_lang-BtFz1_fe.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as $,g as n,s as F,q as I,h as S,l as E,w as r,x as K,o as L,y as _,b as d,u as o,a as N}from"./index-20XXNHAB.js";import{u as T}from"./providers-BqZLRXH1.js";import{u as q}from"./speech-CF8Au8j4.js";import{_ as z,a as G}from"./SpeechProviderSettings.vue_vue_type_script_setup_true_lang-B6yYYFHK.js";import"./index-Be1NqeGb.js";import"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const H={flex:"~ col gap-4"},l="elevenlabs",w="eleven_multilingual_v2",ae=$({__name:"elevenlabs",setup(R){const V={similarityBoost:.75,stability:.5,speed:1,style:0,useSpeakerBoost:!0},v=n(0),u=n(1),m=n(0),f=n(0),c=n(.5),g=n(.75),b=n(!1),y=q(),t=T(),{providers:C}=F(t),{t:a}=I(),k=S(()=>{var e;return!!((e=C.value[l])!=null&&e.apiKey)}),B=S(()=>y.availableVoices[l]||[]);async function M(e,i,s){const P=t.getProviderInstance(l);if(!P)throw new Error("Failed to initialize speech provider");const x=t.getProviderConfig(l),U=x.model||w;return await y.speech(P,U,e,i,{...x,...V})}return E(async()=>{const e=t.getProviderConfig(l);await t.getProviderMetadata(l).validators.validateProviderConfig(e)?await y.loadVoicesForProvider(l):console.error("Failed to validate provider config",e)}),r(v,async()=>{const e=t.getProviderConfig(l);e.pitch=v.value}),r(u,async()=>{const e=t.getProviderConfig(l);e.speed=u.value}),r(m,async()=>{const e=t.getProviderConfig(l);e.volume=m.value}),r(f,async()=>{const e=t.getProviderConfig(l);e.style=f.value}),r(c,async()=>{const e=t.getProviderConfig(l);e.stability=c.value}),r(g,async()=>{const e=t.getProviderConfig(l);e.similarityBoost=g.value}),r(b,async()=>{const e=t.getProviderConfig(l);e.useSpeakerBoost=b.value}),r(C,async()=>{const e=t.getProviderConfig(l);await t.getProviderMetadata(l).validators.validateProviderConfig(e)?await y.loadVoicesForProvider(l):console.error("Failed to validate provider config",e)},{immediate:!0}),(e,i)=>(L(),K(o(G),{"provider-id":l,"default-model":w,"additional-settings":V},{"voice-settings":_(()=>[N("div",H,[d(o(p),{modelValue:v.value,"onUpdate:modelValue":i[0]||(i[0]=s=>v.value=s),label:o(a)("settings.pages.providers.provider.common.fields.field.pitch.label"),description:o(a)("settings.pages.providers.provider.common.fields.field.pitch.description"),min:-100,max:100,step:1,"format-value":s=>`${s}%`},null,8,["modelValue","label","description","format-value"]),d(o(p),{modelValue:u.value,"onUpdate:modelValue":i[1]||(i[1]=s=>u.value=s),label:o(a)("settings.pages.providers.provider.common.fields.field.speed.label"),description:o(a)("settings.pages.providers.provider.common.fields.field.speed.description"),min:.5,max:2,step:.01},null,8,["modelValue","label","description"]),d(o(p),{modelValue:m.value,"onUpdate:modelValue":i[2]||(i[2]=s=>m.value=s),label:o(a)("settings.pages.providers.provider.common.fields.field.volume.label"),description:o(a)("settings.pages.providers.provider.common.fields.field.volume.description"),min:-100,max:100,step:1,"format-value":s=>`${s}%`},null,8,["modelValue","label","description","format-value"]),d(o(p),{modelValue:f.value,"onUpdate:modelValue":i[3]||(i[3]=s=>f.value=s),label:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.style.label"),description:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.style.description"),min:0,max:1,step:.01},null,8,["modelValue","label","description"]),d(o(p),{modelValue:c.value,"onUpdate:modelValue":i[4]||(i[4]=s=>c.value=s),label:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.stability.label"),description:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.stability.description"),min:0,max:1,step:.01},null,8,["modelValue","label","description"]),d(o(p),{modelValue:g.value,"onUpdate:modelValue":i[5]||(i[5]=s=>g.value=s),label:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.simularity-boost.label"),description:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.simularity-boost.description"),min:0,max:1,step:.01},null,8,["modelValue","label","description"]),d(o(h),{modelValue:b.value,"onUpdate:modelValue":i[6]||(i[6]=s=>b.value=s),label:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.speaker-boost.label"),description:o(a)("settings.pages.providers.provider.elevenlabs.fields.field.speaker-boost.description")},null,8,["modelValue","label","description"])])]),playground:_(()=>[d(o(z),{"available-voices":B.value,"generate-speech":M,"api-key-configured":k.value,"default-text":"Hello! This is a test of the ElevenLabs voice synthesis."},null,8,["available-voices","api-key-configured"])]),_:1}))}});export{ae as default}; diff --git a/assets/emotions-CgTD5sIw.js b/assets/emotions-CgTD5sIw.js new file mode 100644 index 0000000000000000000000000000000000000000..5cfcd14cf23b4f18f67ef9cfd1d05c48ec311f82 --- /dev/null +++ b/assets/emotions-CgTD5sIw.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_}from"./Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js";import{d as b,g as u,c as s,o as t,a as e,b as k,u as x,D as d,bx as f,by as p}from"./index-D8Nm21zW.js";import{u as h}from"./queue-CEzllKo3.js";import{a as w,l as y}from"./queues-DJEZsGUG.js";import"./Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js";const M={flex:"","flex-col":"","gap-2":"","p-2":""},V={flex:"","flex-row":"","gap-2":""},E={"rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-4":""},Q={"w-full":"",flex:"","flex-row":"","gap-4":""},S={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},B={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},T=b({__name:"emotions",setup(P){const l=u(""),c=u([]),i=u([]),r=u(!1),g=h({handlers:[async a=>{i.value.push(a.data)}]}),m=w(g);function v(){r.value=!0;const a=l.value.split("");for(const o of a)m.add(o);m.add(y),l.value="",r.value=!1}return(a,o)=>(t(),s("div",M,[e("div",V,[k(x(_),{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=n=>l.value=n),placeholder:"Message",p:"2",bg:"neutral-100 dark:neutral-700","w-full":"","rounded-lg":"","outline-none":"",onSubmit:v},null,8,["modelValue"]),e("button",E,d(r.value?"Processing...":"Send"),1)]),e("div",Q,[e("div",S,[o[1]||(o[1]=e("h3",{"font-semibold":""}," Messages ",-1)),(t(!0),s(f,null,p(c.value,n=>(t(),s("div",{key:n},[e("div",null,d(n),1)]))),128))]),e("div",B,[o[2]||(o[2]=e("h3",{"font-semibold":""}," Emotions ",-1)),(t(!0),s(f,null,p(i.value,n=>(t(),s("div",{key:n},[e("div",null,d(n),1)]))),128))])])]))}});export{T as default}; diff --git a/assets/emotions-DPW-dhzs.js b/assets/emotions-DPW-dhzs.js deleted file mode 100644 index e1a41f33b6755242a30af86625a380356bc4cd6a..0000000000000000000000000000000000000000 --- a/assets/emotions-DPW-dhzs.js +++ /dev/null @@ -1 +0,0 @@ -import{_}from"./Textarea.vue_vue_type_script_setup_true_lang-BPvpJbgL.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as b,g as u,c as s,o as t,a as e,b as k,u as x,D as d,bx as f,by as p}from"./index-20XXNHAB.js";import{u as h}from"./queue-DpWku5ab.js";import{a as w,l as y}from"./queues-DD-Guues.js";import"./Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js";const M={flex:"","flex-col":"","gap-2":"","p-2":""},V={flex:"","flex-row":"","gap-2":""},E={"rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-4":""},Q={"w-full":"",flex:"","flex-row":"","gap-4":""},S={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},B={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},T=b({__name:"emotions",setup(P){const l=u(""),c=u([]),i=u([]),r=u(!1),g=h({handlers:[async a=>{i.value.push(a.data)}]}),m=w(g);function v(){r.value=!0;const a=l.value.split("");for(const o of a)m.add(o);m.add(y),l.value="",r.value=!1}return(a,o)=>(t(),s("div",M,[e("div",V,[k(x(_),{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=n=>l.value=n),placeholder:"Message",p:"2",bg:"neutral-100 dark:neutral-700","w-full":"","rounded-lg":"","outline-none":"",onSubmit:v},null,8,["modelValue"]),e("button",E,d(r.value?"Processing...":"Send"),1)]),e("div",Q,[e("div",S,[o[1]||(o[1]=e("h3",{"font-semibold":""}," Messages ",-1)),(t(!0),s(f,null,p(c.value,n=>(t(),s("div",{key:n},[e("div",null,d(n),1)]))),128))]),e("div",B,[o[2]||(o[2]=e("h3",{"font-semibold":""}," Emotions ",-1)),(t(!0),s(f,null,p(i.value,n=>(t(),s("div",{key:n},[e("div",null,d(n),1)]))),128))])])]))}});export{T as default}; diff --git a/assets/featherless-ai-CcOpVhSb.js b/assets/featherless-ai-CcOpVhSb.js new file mode 100644 index 0000000000000000000000000000000000000000..d9f1aa54fbd5aefc1cdfd2ac589705961db868cf --- /dev/null +++ b/assets/featherless-ai-CcOpVhSb.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as h,q as U,bG as V,s as y,h as v,l as $,w as k,x as K,o as w,y as p,b as l,u as t}from"./index-D8Nm21zW.js";import{u as x}from"./providers-DUDq6kdm.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="featherless-ai",L=h({__name:"featherless-ai",setup(B){const{t:d}=U(),_=V(),m=x(),{providers:o}=y(m),n=v(()=>m.getProviderMetadata(a)),i=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,s;m.initializeProvider(a),i.value=((e=o.value[a])==null?void 0:e.apiKey)||"",r.value=((s=o.value[a])==null?void 0:s.baseUrl)||""}),k([i,r],()=>{o.value[a]={...o.value[a],apiKey:i.value,baseUrl:r.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,s)=>{var c,f;return w(),K(t(S),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon":(f=n.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:p(()=>[l(t(P),null,{default:p(()=>[l(t(R),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:p(()=>{var u;return[l(t(N),{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=g=>i.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"fw-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(M),{modelValue:r.value,"onUpdate:modelValue":s[1]||(s[1]=u=>r.value=u),placeholder:"https://api.featherless.ai/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/featherless-ai-Dl1olyH3.js b/assets/featherless-ai-Dl1olyH3.js deleted file mode 100644 index f7bb0beffb3f3195dc4bc5b11fa903edca8c511e..0000000000000000000000000000000000000000 --- a/assets/featherless-ai-Dl1olyH3.js +++ /dev/null @@ -1 +0,0 @@ -import{d as h,q as U,bG as V,s as y,h as v,l as $,w as k,x as K,o as w,y as p,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as x}from"./providers-BqZLRXH1.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="featherless-ai",L=h({__name:"featherless-ai",setup(B){const{t:d}=U(),_=V(),m=x(),{providers:o}=y(m),n=v(()=>m.getProviderMetadata(a)),i=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,s;m.initializeProvider(a),i.value=((e=o.value[a])==null?void 0:e.apiKey)||"",r.value=((s=o.value[a])==null?void 0:s.baseUrl)||""}),k([i,r],()=>{o.value[a]={...o.value[a],apiKey:i.value,baseUrl:r.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,s)=>{var c,f;return w(),K(t(S),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon":(f=n.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:p(()=>[l(t(P),null,{default:p(()=>[l(t(R),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:p(()=>{var u;return[l(t(N),{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=g=>i.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"fw-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(M),{modelValue:r.value,"onUpdate:modelValue":s[1]||(s[1]=u=>r.value=u),placeholder:"https://api.featherless.ai/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/filter-message-CZTuPPrs.js b/assets/filter-message-CZTuPPrs.js new file mode 100644 index 0000000000000000000000000000000000000000..105efcc763b198b811c76cfd6127cf6b2e1888f3 --- /dev/null +++ b/assets/filter-message-CZTuPPrs.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as m}from"./Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js";import{d as g,g as c,c as v,o as _,a as s,b,u as x,D as d}from"./index-D8Nm21zW.js";import"./Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js";const S={flex:"","flex-col":"","gap-2":"","p-2":""},k={flex:"","flex-row":"","gap-2":""},w={"rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-4":""},V={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},D=g({__name:"filter-message",setup(M){const o=c(""),u=c(!1),r=c({content:""});async function f(i){return new Promise(e=>setTimeout(e,i))}async function p(){u.value=!0;const i=o.value.split("");let e;(a=>{a.Literal="literal",a.Special="special"})(e||(e={}));let t="literal",l="";for(const a of i){await f(50);let n=t;a==="<"?n="special":a===">"&&(n="literal"),t==="literal"&&n==="special"&&(r.value.content+=l,l=""),t==="special"&&n==="literal"&&(l=""),t==="literal"&&n==="literal"&&(r.value.content+=a,l=""),t=n}l&&(r.value.content+=l),o.value="",u.value=!1}return(i,e)=>(_(),v("div",S,[s("div",k,[b(x(m),{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=t=>o.value=t),placeholder:"Message",p:"2",bg:"neutral-100 dark:neutral-700","w-full":"","rounded-lg":"","outline-none":"",onSubmit:p},null,8,["modelValue"]),s("button",w,d(u.value?"Processing...":"Send"),1)]),s("div",V,[e[1]||(e[1]=s("h3",{"font-semibold":""}," Streaming Message ",-1)),s("div",null,d(r.value.content),1)])]))}});export{D as default}; diff --git a/assets/filter-message-DUaVzR-o.js b/assets/filter-message-DUaVzR-o.js deleted file mode 100644 index 0a0720a8f4d0c2c7bb7043985bf4f79935ac763f..0000000000000000000000000000000000000000 --- a/assets/filter-message-DUaVzR-o.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as m}from"./Textarea.vue_vue_type_script_setup_true_lang-BPvpJbgL.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as g,g as c,c as v,o as _,a as s,b,u as x,D as d}from"./index-20XXNHAB.js";import"./Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js";const S={flex:"","flex-col":"","gap-2":"","p-2":""},k={flex:"","flex-row":"","gap-2":""},w={"rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-4":""},V={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},D=g({__name:"filter-message",setup(M){const o=c(""),u=c(!1),r=c({content:""});async function f(i){return new Promise(e=>setTimeout(e,i))}async function p(){u.value=!0;const i=o.value.split("");let e;(a=>{a.Literal="literal",a.Special="special"})(e||(e={}));let t="literal",l="";for(const a of i){await f(50);let n=t;a==="<"?n="special":a===">"&&(n="literal"),t==="literal"&&n==="special"&&(r.value.content+=l,l=""),t==="special"&&n==="literal"&&(l=""),t==="literal"&&n==="literal"&&(r.value.content+=a,l=""),t=n}l&&(r.value.content+=l),o.value="",u.value=!1}return(i,e)=>(_(),v("div",S,[s("div",k,[b(x(m),{modelValue:o.value,"onUpdate:modelValue":e[0]||(e[0]=t=>o.value=t),placeholder:"Message",p:"2",bg:"neutral-100 dark:neutral-700","w-full":"","rounded-lg":"","outline-none":"",onSubmit:p},null,8,["modelValue"]),s("button",w,d(u.value?"Processing...":"Send"),1)]),s("div",V,[e[1]||(e[1]=s("h3",{"font-semibold":""}," Streaming Message ",-1)),s("div",null,d(r.value.content),1)])]))}});export{D as default}; diff --git a/assets/fireworks-ai-CgE9JAaR.js b/assets/fireworks-ai-CgE9JAaR.js deleted file mode 100644 index 2ac13ca3ea97e379fe732be53d0f6e2bddf26261..0000000000000000000000000000000000000000 --- a/assets/fireworks-ai-CgE9JAaR.js +++ /dev/null @@ -1 +0,0 @@ -import{d as k,q as w,bG as U,s as V,h as v,l as y,w as $,x as K,o as h,y as p,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as x}from"./providers-BqZLRXH1.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="fireworks-ai",L=k({__name:"fireworks-ai",setup(B){const{t:d}=w(),_=U(),m=x(),{providers:o}=V(m),n=v(()=>m.getProviderMetadata(a)),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});y(()=>{var e,i;m.initializeProvider(a),r.value=((e=o.value[a])==null?void 0:e.apiKey)||"",s.value=((i=o.value[a])==null?void 0:i.baseUrl)||""}),$([r,s],()=>{o.value[a]={...o.value[a],apiKey:r.value,baseUrl:s.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,i)=>{var c,f;return h(),K(t(S),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon":(f=n.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:p(()=>[l(t(P),null,{default:p(()=>[l(t(R),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:p(()=>{var u;return[l(t(N),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=g=>r.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"fw-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(M),{modelValue:s.value,"onUpdate:modelValue":i[1]||(i[1]=u=>s.value=u),placeholder:"https://api.fireworks.ai/inference/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/fireworks-ai-DAA5zEq0.js b/assets/fireworks-ai-DAA5zEq0.js new file mode 100644 index 0000000000000000000000000000000000000000..8ef94ee852cadedcb552abcc66e8534082c3cd10 --- /dev/null +++ b/assets/fireworks-ai-DAA5zEq0.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as k,q as w,bG as U,s as V,h as v,l as y,w as $,x as K,o as h,y as p,b as l,u as t}from"./index-D8Nm21zW.js";import{u as x}from"./providers-DUDq6kdm.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="fireworks-ai",L=k({__name:"fireworks-ai",setup(B){const{t:d}=w(),_=U(),m=x(),{providers:o}=V(m),n=v(()=>m.getProviderMetadata(a)),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});y(()=>{var e,i;m.initializeProvider(a),r.value=((e=o.value[a])==null?void 0:e.apiKey)||"",s.value=((i=o.value[a])==null?void 0:i.baseUrl)||""}),$([r,s],()=>{o.value[a]={...o.value[a],apiKey:r.value,baseUrl:s.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,i)=>{var c,f;return h(),K(t(S),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon":(f=n.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:p(()=>[l(t(P),null,{default:p(()=>[l(t(R),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:p(()=>{var u;return[l(t(N),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=g=>r.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"fw-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(M),{modelValue:s.value,"onUpdate:modelValue":i[1]||(i[1]=u=>s.value=u),placeholder:"https://api.fireworks.ai/inference/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/google-generative-ai-DdbM-cuq.js b/assets/google-generative-ai-DdbM-cuq.js new file mode 100644 index 0000000000000000000000000000000000000000..f7f07caffcfdb3413d3871cf2f8a6523579440c1 --- /dev/null +++ b/assets/google-generative-ai-DdbM-cuq.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as h,q as U,bG as V,s as k,h as m,l as y,w as $,x as K,o as x,y as p,b as r,u as t}from"./index-D8Nm21zW.js";import{u as G}from"./providers-DUDq6kdm.js";import{_ as w,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as R,a as S}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as z}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const e="google-generative-ai",O=h({__name:"google-generative-ai",setup(B){const{t:u}=U(),f=V(),c=G(),{providers:a}=k(c),v=m(()=>c.getProviderMetadata(e)),s=m({get:()=>{var o;return((o=a.value[e])==null?void 0:o.apiKey)||""},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].apiKey=o}}),l=m({get:()=>{var o;return((o=a.value[e])==null?void 0:o.baseUrl)||"https://generativelanguage.googleapis.com/v1beta/openai/"},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].baseUrl=o}});y(()=>{var o,i;a.value[e]||(a.value[e]={baseUrl:"https://api.anthropic.com/v1/"}),s.value=((o=a.value[e])==null?void 0:o.apiKey)||"",l.value=((i=a.value[e])==null?void 0:i.baseUrl)||"https://generativelanguage.googleapis.com/v1beta/openai/"}),$([s,l],()=>{a.value[e]={...a.value[e],apiKey:s.value,baseUrl:l.value||"https://generativelanguage.googleapis.com/v1beta/openai/"}});function _(){a.value[e]={baseUrl:"https://generativelanguage.googleapis.com/v1beta/openai/"}}return(o,i)=>{var d,g;return x(),K(t(z),{"provider-name":((d=v.value)==null?void 0:d.localizedName)||"Google | Gemini","provider-icon":(g=v.value)==null?void 0:g.icon,"on-back":()=>t(f).back()},{default:p(()=>[r(t(R),null,{default:p(()=>[r(t(S),{title:t(u)("settings.pages.providers.common.section.basic.title"),description:t(u)("settings.pages.providers.common.section.basic.description"),"on-reset":_},{default:p(()=>{var n;return[r(t(N),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=b=>s.value=b),"provider-name":((n=v.value)==null?void 0:n.localizedName)||"Google",placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),r(t(w),{title:t(u)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[r(t(M),{modelValue:l.value,"onUpdate:modelValue":i[1]||(i[1]=n=>l.value=n),placeholder:"https://generativelanguage.googleapis.com/v1beta/openai/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{O as default}; diff --git a/assets/google-generative-ai-jAnS6Q2u.js b/assets/google-generative-ai-jAnS6Q2u.js deleted file mode 100644 index c75cc844e22e075c8447dcc3fe57c80df0ef0eba..0000000000000000000000000000000000000000 --- a/assets/google-generative-ai-jAnS6Q2u.js +++ /dev/null @@ -1 +0,0 @@ -import{d as h,q as U,bG as V,s as k,h as m,l as y,w as $,x as K,o as x,y as p,b as r,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as G}from"./providers-BqZLRXH1.js";import{_ as w,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as R,a as S}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as z}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const e="google-generative-ai",O=h({__name:"google-generative-ai",setup(B){const{t:u}=U(),f=V(),c=G(),{providers:a}=k(c),v=m(()=>c.getProviderMetadata(e)),s=m({get:()=>{var o;return((o=a.value[e])==null?void 0:o.apiKey)||""},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].apiKey=o}}),l=m({get:()=>{var o;return((o=a.value[e])==null?void 0:o.baseUrl)||"https://generativelanguage.googleapis.com/v1beta/openai/"},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].baseUrl=o}});y(()=>{var o,i;a.value[e]||(a.value[e]={baseUrl:"https://api.anthropic.com/v1/"}),s.value=((o=a.value[e])==null?void 0:o.apiKey)||"",l.value=((i=a.value[e])==null?void 0:i.baseUrl)||"https://generativelanguage.googleapis.com/v1beta/openai/"}),$([s,l],()=>{a.value[e]={...a.value[e],apiKey:s.value,baseUrl:l.value||"https://generativelanguage.googleapis.com/v1beta/openai/"}});function _(){a.value[e]={baseUrl:"https://generativelanguage.googleapis.com/v1beta/openai/"}}return(o,i)=>{var d,g;return x(),K(t(z),{"provider-name":((d=v.value)==null?void 0:d.localizedName)||"Google | Gemini","provider-icon":(g=v.value)==null?void 0:g.icon,"on-back":()=>t(f).back()},{default:p(()=>[r(t(R),null,{default:p(()=>[r(t(S),{title:t(u)("settings.pages.providers.common.section.basic.title"),description:t(u)("settings.pages.providers.common.section.basic.description"),"on-reset":_},{default:p(()=>{var n;return[r(t(N),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=b=>s.value=b),"provider-name":((n=v.value)==null?void 0:n.localizedName)||"Google",placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),r(t(w),{title:t(u)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[r(t(M),{modelValue:l.value,"onUpdate:modelValue":i[1]||(i[1]=n=>l.value=n),placeholder:"https://generativelanguage.googleapis.com/v1beta/openai/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{O as default}; diff --git a/assets/image-BS2iN69a.js b/assets/image-CIQPT2z3.js similarity index 95% rename from assets/image-BS2iN69a.js rename to assets/image-CIQPT2z3.js index 7ea86db2a9045d8a6bce42c087787af890c7b863..d45d27ee87cc9f88b69ae0cb570a6c1885d4da2a 100644 --- a/assets/image-BS2iN69a.js +++ b/assets/image-CIQPT2z3.js @@ -1,2 +1,2 @@ -import{d as _,g as c,bF as y,c as d,o as u,a,C as x,D as b,u as v,bn as w}from"./index-20XXNHAB.js";const C={bg:"neutral-100",flex:"~ col","items-center":"","justify-center":"","rounded-lg":"","px-4":"","py-3":""},h={key:0},U=["src"],D={bg:"neutral-100",class:"text-wrap-any","max-h":"100","overflow-scroll":"","rounded-lg":"","text-wrap":"","text-black":"","font-mono":""},R=_({__name:"image",setup(k){const p=c(),n=c(""),{copy:g}=y({source:n});async function m(r){return new Promise((e,o)=>{const t=new FileReader;t.onload=s=>{var l,i;e(((i=(l=s.target)==null?void 0:l.result)==null?void 0:i.toString())||"")},t.onerror=s=>{o(s)},t.readAsDataURL(r)})}async function f(r){var t;const o=(t=r.target.files)==null?void 0:t[0];if(o){p.value=o;const s=await m(o);n.value=s}}return(r,e)=>(u(),d("div",null,[a("label",C,[a("input",{type:"file",accept:"image/*",hidden:"",onChange:f},null,32),e[1]||(e[1]=a("span",null,"Upload Image",-1))]),n.value?(u(),d("div",h,[a("img",{src:n.value,alt:"Uploaded Image","w-100":""},null,8,U),a("pre",D," "+b(n.value)+` +import{d as _,g as c,bF as y,c as d,o as u,a,C as x,D as b,u as v,bn as w}from"./index-D8Nm21zW.js";const C={bg:"neutral-100",flex:"~ col","items-center":"","justify-center":"","rounded-lg":"","px-4":"","py-3":""},h={key:0},U=["src"],D={bg:"neutral-100",class:"text-wrap-any","max-h":"100","overflow-scroll":"","rounded-lg":"","text-wrap":"","text-black":"","font-mono":""},R=_({__name:"image",setup(k){const p=c(),n=c(""),{copy:g}=y({source:n});async function m(r){return new Promise((e,o)=>{const t=new FileReader;t.onload=s=>{var l,i;e(((i=(l=s.target)==null?void 0:l.result)==null?void 0:i.toString())||"")},t.onerror=s=>{o(s)},t.readAsDataURL(r)})}async function f(r){var t;const o=(t=r.target.files)==null?void 0:t[0];if(o){p.value=o;const s=await m(o);n.value=s}}return(r,e)=>(u(),d("div",null,[a("label",C,[a("input",{type:"file",accept:"image/*",hidden:"",onChange:f},null,32),e[1]||(e[1]=a("span",null,"Upload Image",-1))]),n.value?(u(),d("div",h,[a("img",{src:n.value,alt:"Uploaded Image","w-100":""},null,8,U),a("pre",D," "+b(n.value)+` `,1),a("button",{bg:"primary-500",text:"white","mt-4":"","rounded-lg":"","px-4":"","py-2":"",onClick:e[0]||(e[0]=()=>v(g)())}," Copy Data URL ")])):x("",!0)]))}}),B=w(R,[["__scopeId","data-v-7edd53e6"]]);export{B as default}; diff --git a/assets/index-B2hRy6Ar.js b/assets/index-B2hRy6Ar.js deleted file mode 100644 index e637d83a803c480f077e8314b25017a4090e3dd6..0000000000000000000000000000000000000000 --- a/assets/index-B2hRy6Ar.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as E}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as S,r as D,x as b,o as a,y as P,a as i,c as m,C as w,m as R,D as C,z as q,bn as L,bG as N,g as r,q as V,v as j,h as F,bw as G,b as O,u as p,A as y,bx as $,by as H,n as J,bv as K}from"./index-20XXNHAB.js";import{_ as M}from"./IconAnimation.vue_vue_type_script_setup_true_lang-BF7ZejO-.js";import{b as I}from"./route-block-B_A1xBdJ.js";const Q={"z-1":"","flex-1":""},U={"text-lg":"","font-bold":"",class:"menu-icon-item-title",transition:"all ease-in-out duration-400"},W={text:"sm neutral-500 dark:neutral-400",class:"menu-icon-item-description",transition:"all ease-in-out duration-400"},X=S({__name:"IconItem",props:{title:null,description:null,icon:null,iconTemplate:{type:Boolean},to:null},setup(o){return(g,f)=>{const v=D("RouterLink");return a(),b(v,{box:"border",flex:"~ row",bg:"neutral-50 dark:neutral-900",border:"neutral-100 dark:neutral-800/25 hover:primary-500/30 dark:hover:primary-400/30 solid 2","drop-shadow":"none hover:[0px_4px_4px_rgba(220,220,220,0.4)] active:[0px_0px_0px_rgba(220,220,220,0.25)] dark:hover:none",class:"menu-icon-item",transition:"all ease-in-out duration-400",relative:"","w-full":"","items-center":"","overflow-hidden":"","rounded-lg":"","p-5":"","text-left":"",cursor:"pointer",to:o.to},{default:P(()=>[i("div",Q,[i("div",U,C(o.title),1),i("div",W,[i("span",null,C(o.description),1)])]),typeof o.icon=="string"?(a(),m("div",{key:0,class:q(["menu-icon-item-icon",[o.icon]]),transition:"all ease-in-out duration-400",absolute:"","right-0":"","size-24":"","translate-y-4":"",text:"neutral-400/50 dark:neutral-600/50"},null,2)):w("",!0),o.iconTemplate?R(g.$slots,"icon",{key:1},void 0,!0):w("",!0)]),_:3},8,["to"])}}}),Y=L(X,[["__scopeId","data-v-656e0116"]]),Z={flex:"~ col gap-4"},tt={flex:"~ col gap-4"},et={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-12rem)]","bottom-0":"","right--10":"","z--1":"",initial:{scale:.9,opacity:0,rotate:180},enter:{scale:1,opacity:1,rotate:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},it={text:"60","i-solar:settings-bold-duotone":""},ot=S({__name:"index",setup(o){const g=N(),f=r(!1),v=r(),c=r(),{t}=V(),x=r(""),h=r(""),k=r(!1),d=j();function z(){var n;(n=c.value)==null||n.call(c)}async function T(n,l){const e=n.currentTarget.querySelector(".menu-icon-item-icon");if(!e)return;const u=e.getBoundingClientRect(),_=`${u.left}px, ${u.top}px`;x.value=l.icon,h.value=_,k.value=!0,await K(),f.value=!0}const B=g.beforeEach(async(n,l,s)=>{if(!d.usePageSpecificTransitions||d.disableTransitions){s();return}await new Promise(e=>{c.value=e}),B(),s()}),A=F(()=>[{title:t("settings.pages.card.title"),description:t("settings.pages.card.description"),icon:"i-solar:emoji-funny-square-bold-duotone",to:"/settings/airi-card"},{title:t("settings.pages.modules.title"),description:t("settings.pages.modules.description"),icon:"i-solar:layers-bold-duotone",to:"/settings/modules"},{title:t("settings.pages.scene.title"),description:t("settings.pages.scene.description"),icon:"i-solar:armchair-2-bold-duotone",to:"/settings/scene"},{title:t("settings.pages.models.title"),description:t("settings.pages.models.description"),icon:"i-solar:people-nearby-bold-duotone",to:"/settings/models"},{title:t("settings.pages.memory.title"),description:t("settings.pages.memory.description"),icon:"i-solar:leaf-bold-duotone",to:"/settings/memory"},{title:t("settings.pages.providers.title"),description:t("settings.pages.providers.description"),icon:"i-solar:box-minimalistic-bold-duotone",to:"/settings/providers"},{title:t("settings.pages.themes.title"),description:t("settings.pages.themes.description"),icon:"i-solar:filters-bold-duotone",to:"/settings/appearance"}]);return(n,l)=>{const s=G("motion");return a(),m($,null,[O(p(E),{title:n.$t("settings.title")},null,8,["title"]),i("div",Z,[l[0]||(l[0]=i("div",null,null,-1)),i("div",tt,[(a(!0),m($,null,H(A.value,(e,u)=>y((a(),b(p(Y),{key:e.to,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250,style:J({transitionDelay:`${u*50}ms`}),title:e.title,description:e.description,icon:e.icon,to:e.to,onClick:_=>T(_,e)},null,8,["style","title","description","icon","to","onClick"])),[[s]])),128))]),k.value&&!p(d).disableTransitions&&p(d).usePageSpecificTransitions?(a(),b(M,{key:0,ref_key:"iconAnimation",ref:v,icon:x.value,"icon-size":6*1.2,position:h.value,duration:1e3,"text-color":"text-neutral-400/50 dark:text-neutral-600/20",started:f.value,onAnimationEndedOnce:z},null,8,["icon","position","started"])):y((a(),m("div",et,[y(i("div",it,null,512),[[s]])])),[[s]])])],64)}}});typeof I=="function"&&I(ot);export{ot as default}; diff --git a/assets/index-B5H7zFR1.js b/assets/index-B5H7zFR1.js new file mode 100644 index 0000000000000000000000000000000000000000..84995439004db43f078422f3426b686e85379d28 --- /dev/null +++ b/assets/index-B5H7zFR1.js @@ -0,0 +1 @@ +import{d as T,q as J,s as H,g as c,w as Q,h,bw as R,c as m,o as d,b as y,a as s,A as w,u as r,bE as G,D as l,bH as K,z as P,C as V,y as W,bx as U,by as X,x as Y}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as Z}from"./InputFile.vue_vue_type_script_setup_true_lang-aVfE3xzX.js";import{_ as ee}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{u as te}from"./airi-card-DeGSbHPj.js";import{_ as se}from"./CardDetailDialog.vue_vue_type_script_setup_true_lang-DAwVKIUC.js";import{_ as ae}from"./CardListItem.vue_vue_type_script_setup_true_lang-DG6xnm5K.js";import{_ as re}from"./DeleteCardDialog.vue_vue_type_script_setup_true_lang-NzJTgSSI.js";import{b as j}from"./route-block-B_A1xBdJ.js";import"./consciousness-CgTB9b9w.js";import"./providers-DUDq6kdm.js";import"./index-Be1NqeGb.js";import"./speech-B27BwGQ-.js";import"./index-BUaUWOtl.js";const oe={"rounded-xl":"","p-4":"",flex:"~ col gap-4"},ne={flex:"~ row","flex-wrap":"","items-center":"","justify-between":"","gap-4":""},le={class:"relative min-w-[200px] flex-1","inline-flex":"~","w-full":"","items-center":""},ie=["placeholder"],de={class:"flex items-center gap-2"},ue={"text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},ce={value:"nameAsc"},me={value:"nameDesc"},pe={value:"recent"},fe={key:0,flex:"","flex-col":"","items-center":""},ve={"font-medium":"",text:"neutral-600 dark:neutral-300"},xe={text:"neutral-500 dark:neutral-400","mt-2":"","text-sm":""},ge={key:1,flex:"","flex-col":"","items-center":""},_e={"font-medium":"",text:"primary-600 dark:primary-300"},be={key:1,class:"col-span-full rounded-xl p-8 text-center",border:"~ neutral-200/50 dark:neutral-700/30",bg:"neutral-50/50 dark:neutral-900/50"},ye={key:2,class:"col-span-full flex items-center gap-3 border-2 border-amber-200 rounded-xl bg-amber-50/80 p-4 dark:border-amber-800 dark:bg-amber-900/30"},ke={class:"flex flex-col"},Ce={class:"font-medium"},he={class:"text-sm text-amber-600 dark:text-amber-400"},we={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},Ve=T({__name:"index",setup(De){const{t:n}=J(),k=te(),{addCard:q,removeCard:B}=k,{cards:p,activeCardId:D}=H(k),_=c(""),f=c(!1),v=c(""),x=c("nameAsc"),C=c([]);Q(C,async a=>{const e=a[0];if(e)try{const o=await e.text(),i=JSON.parse(o);_.value=q(i),f.value=!0}catch(o){console.error("Error processing card file:",o)}});const $=h(()=>Array.from(p.value.entries()).map(([a,e])=>({id:a,name:e.name,description:e.description}))),E=h(()=>{if(!v.value)return $.value;const a=v.value.toLowerCase();return $.value.filter(e=>e.name.toLowerCase().includes(a)||e.description&&e.description.toLowerCase().includes(a))}),S=h(()=>{const a=[...E.value];return x.value==="nameAsc"?a.sort((e,o)=>e.name.localeCompare(o.name)):x.value==="nameDesc"?a.sort((e,o)=>o.name.localeCompare(e.name)):x.value==="recent"?a.sort((e,o)=>o.id.localeCompare(e.id)):a}),b=c(!1),u=c(null);function L(){u.value&&(B(u.value),u.value=null,b.value=!1)}function O(a){u.value=a,b.value=!0}function F(a){_.value=a,f.value=!0}function I(a){D.value=a}function M(a){const e=p.value.get(a);return(e==null?void 0:e.version)||"1.0.0"}function A(a,e){var t,g,z,N;const o=p.value.get(a);if(!o||!((g=(t=o.extensions)==null?void 0:t.airi)!=null&&g.modules))return"default";const i=o.extensions.airi.modules;return e==="consciousness"?(z=i.consciousness)!=null&&z.model&&i.consciousness.model.split("-").pop()||"default":e==="voice"&&((N=i.speech)==null?void 0:N.voice_id)||"default"}return(a,e)=>{var i;const o=R("motion");return d(),m(U,null,[y(r(ee),{title:a.$t("settings.pages.card.title"),subtitle:a.$t("settings.title")},null,8,["title","subtitle"]),s("div",oe,[s("div",ne,[s("div",le,[e[6]||(e[6]=s("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[s("div",{"i-solar:magnifer-line-duotone":"",class:"text-neutral-500 dark:text-neutral-400"})],-1)),w(s("input",{"onUpdate:modelValue":e[0]||(e[0]=t=>v.value=t),type:"search",class:"w-full rounded-xl p-2.5 pl-10 text-sm outline-none",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",bg:"white dark:neutral-900",placeholder:r(n)("settings.pages.card.search")},null,8,ie),[[G,v.value]])]),s("div",de,[s("div",ue,l(r(n)("settings.pages.card.sort_by"))+": ",1),w(s("select",{"onUpdate:modelValue":e[1]||(e[1]=t=>x.value=t),class:"rounded-lg p-1.5 text-sm outline-none",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",bg:"white dark:neutral-900"},[s("option",ce,l(r(n)("settings.pages.card.name_asc")),1),s("option",me,l(r(n)("settings.pages.card.name_desc")),1),s("option",pe,l(r(n)("settings.pages.card.recent")),1)],512),[[K,x.value]])])]),s("div",{class:P(["mt-4",{"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4 grid-auto-rows-[minmax(min-content,max-content)] grid-auto-flow-dense sm:grid-cols-[repeat(auto-fill,minmax(240px,1fr))] sm:gap-5 md:grid-cols-[repeat(auto-fill,minmax(220px,1fr))] lg:grid-cols-[repeat(auto-fill,minmax(250px,1fr))]":r(p).size>0}])},[y(r(Z),{modelValue:C.value,"onUpdate:modelValue":e[2]||(e[2]=t=>C.value=t),accept:"*.json"},{default:W(({isDragging:t})=>[t?(d(),m("div",ge,[e[8]||(e[8]=s("div",{"i-solar:upload-minimalistic-bold":"",class:"text-primary-500 dark:text-primary-400 mb-2 text-5xl"},null,-1)),s("p",_e,l(r(n)("settings.pages.card.drop_here")),1)])):(d(),m("div",fe,[e[7]||(e[7]=s("div",{"i-solar:upload-square-line-duotone":"","mb-4":"","text-5xl":"",text:"neutral-400 dark:neutral-500"},null,-1)),s("p",ve,l(r(n)("settings.pages.card.upload")),1),s("p",xe,l(r(n)("settings.pages.card.upload_desc")),1)]))]),_:1},8,["modelValue"]),r(p).size>0?(d(!0),m(U,{key:0},X(S.value,t=>(d(),Y(ae,{id:t.id,key:t.id,name:t.name,description:t.description,"is-active":t.id===r(D),"is-selected":t.id===_.value&&f.value,version:M(t.id),"consciousness-model":A(t.id,"consciousness"),"voice-model":A(t.id,"voice"),onSelect:g=>F(t.id),onActivate:g=>I(t.id),onDelete:g=>O(t.id)},null,8,["id","name","description","is-active","is-selected","version","consciousness-model","voice-model","onSelect","onActivate","onDelete"]))),128)):V("",!0),r(p).size===0?(d(),m("div",be,[e[9]||(e[9]=s("div",{"i-solar:card-search-broken":"","mx-auto":"","mb-3":"","text-6xl":"","text-neutral-400":""},null,-1)),s("p",null,l(r(n)("settings.pages.card.no_cards")),1)])):V("",!0),v.value&&S.value.length===0?(d(),m("div",ye,[e[10]||(e[10]=s("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),s("div",ke,[s("span",Ce,l(r(n)("settings.pages.card.no_results")),1),s("span",he,l(r(n)("settings.pages.card.try_different_search")),1)])])):V("",!0)],2)]),y(re,{modelValue:b.value,"onUpdate:modelValue":e[3]||(e[3]=t=>b.value=t),"card-name":u.value?(i=r(k).getCard(u.value))==null?void 0:i.name:"",onConfirm:L,onCancel:e[4]||(e[4]=t=>u.value=null)},null,8,["modelValue","card-name"]),y(se,{modelValue:f.value,"onUpdate:modelValue":e[5]||(e[5]=t=>f.value=t),"card-id":_.value},null,8,["modelValue","card-id"]),w((d(),m("div",we,e[11]||(e[11]=[s("div",{text:"60","i-solar:emoji-funny-square-bold-duotone":""},null,-1)]))),[[o]])],64)}}});typeof j=="function"&&j(Ve);export{Ve as default}; diff --git a/assets/index-BJB8uJhP.js b/assets/index-BJB8uJhP.js deleted file mode 100644 index 6f8120d15198a2eb5a42160fb84353ef4ffb8af3..0000000000000000000000000000000000000000 --- a/assets/index-BJB8uJhP.js +++ /dev/null @@ -1 +0,0 @@ -import{d as A,bI as _,bJ as F,c as r,o,A as a,a as e,b as m,B as V,bL as h,C as U,D as u,y as g,z as x,bB as H,v as M,bC as O,q as j,g as N,w as P,bw as z,u as i,x as f,ad as I,bH as L,bE as R,bx as D,by as q,bn as J}from"./index-20XXNHAB.js";import{_ as G}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{_ as C,a as K}from"./ColorPalette.vue_vue_type_script_setup_true_lang-B9Kdi_g7.js";import{b as k}from"./route-block-B_A1xBdJ.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./index-qOh3wAiY.js";const Q={class:"w-full flex cursor-pointer items-center justify-between rounded-lg px-4 py-3 text-sm outline-none transition-all duration-250 ease-in-out",bg:"neutral-50 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700"},W=["aria-checked"],X={key:0,text:"sm neutral-500"},B=A({__name:"CheckBar",props:_({text:null,iconOn:null,iconOff:null,description:null},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const n=F(p,"modelValue");return(y,c)=>(o(),r("label",Q,[a(e("input",{"onUpdate:modelValue":c[0]||(c[0]=v=>n.value=v),"aria-checked":n.value,type:"checkbox",hidden:""},null,8,W),[[V,n.value]]),e("div",null,[h(u(y.$t(p.text))+" ",1),p.description?(o(),r("div",X,u(y.$t(p.description)),1)):U("",!0)]),m(H,{name:"slide-away",mode:"out-in"},{default:g(()=>[n.value?(o(),r("div",{key:0,class:x(p.iconOn),transition:"all ease-in-out duration-250"},null,2)):(o(),r("div",{key:1,class:x(p.iconOff),transition:"all ease-in-out duration-250"},null,2))]),_:1})]))}}),Y=[[],["#A5978B","#D8CAAF","#B8B4A7","#C4BCB1","#E5DED8","#9A8F7D","#BEB5A7","#C9C0B6"],["#7A9EAF","#B8C7CC","#D4B79C","#8B9D77","#C7D5CB","#E6D0B1","#94A7B1","#B4C8C3"],["#D9B48F","#B5917A","#8C7A6B","#A17F5F","#B98C46","#C7A252","#DAB300","#D19826"],["#9BA7B0","#C1CBD4","#A5ADB6","#8B959E","#D4DCE4","#7F8A94","#B3BCC6","#98A4AE"],["#E4C6D0","#A61B29","#5D513C","#789262","#1C0D1A","#F7C242","#62A9DD","#8C4B3C"]],Z={class:"w-full flex items-center justify-between rounded-lg px-4 py-3 text-sm outline-none transition-all duration-250 ease-in-out",bg:"neutral-50 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+3*10,delay:3*50,transition:"all ease-in-out duration-250"},ee={value:"en-US"},te={value:"zh-CN"},ie={flex:"","items-center":"","justify-between":"",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+5*10,delay:5*50,transition:"all ease-in-out duration-250"},ne={"text-lg":"","font-semibold":""},ae={relative:"",flex:"","cursor-pointer":"","items-center":"","gap-2":""},oe=["disabled"],se={class:"color-bar",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+7*10,delay:7*50,transition:"all ease-in-out duration-250"},le={"text-white":"",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+8*10,delay:8*50,transition:"all ease-in-out duration-250"},re={class:"color-bar transparency-grid",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+9*10,delay:9*50,transition:"all ease-in-out duration-250"},de=["duration","delay"],ue={"font-medium":""},pe={text:"sm neutral-500"},ye={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[65dvh]","right--15":"","z--1":"",initial:{scale:.9,opacity:0,rotate:30},enter:{scale:1,opacity:1,rotate:0},duration:250,flex:"","items-center":"","justify-center":""},$=A({__name:"index",setup(p){const n=M(),y=O(),{t:c}=j(),v=N(!1);return P(()=>[n.usePageSpecificTransitions,n.disableTransitions],()=>{v.value=!0}),(d,t)=>{const s=z("motion");return o(),r(D,null,[m(i(G),{title:d.$t("settings.pages.themes.title"),subtitle:d.$t("settings.title")},null,8,["title","subtitle"]),a((o(),f(i(C),{title:i(c)("settings.sections.section.general.title"),icon:"i-solar:filters-bold-duotone",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+1*10,delay:1*50,transition:"all ease-in-out duration-250"},{default:g(()=>[a(m(B,{modelValue:i(y),"onUpdate:modelValue":t[0]||(t[0]=l=>I(y)?y.value=l:null),initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+2*10,delay:2*50,"icon-on":"i-solar:moon-stars-bold-duotone","icon-off":"i-solar:sun-fog-bold-duotone",text:"settings.theme",transition:"all ease-in-out duration-250"},null,8,["modelValue"]),[[s]]),a((o(),r("div",Z,[h(u(d.$t("settings.language.title"))+" ",1),a(e("select",{"onUpdate:modelValue":t[1]||(t[1]=l=>i(n).language=l),transition:"all ease-in-out duration-250","cursor-pointer":"","bg-transparent":"","text-right":"","outline-none":""},[e("option",ee,u(d.$t("settings.language.english")),1),e("option",te,u(d.$t("settings.language.chinese")),1)],512),[[L,i(n).language]])])),[[s]])]),_:1},8,["title"])),[[s]]),a((o(),f(i(C),{title:i(c)("settings.pages.themes.sections.section.custom-color.title"),icon:"i-solar:pallete-2-bold-duotone",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+4*10,delay:4*50,transition:"all ease-in-out duration-250"},{default:g(()=>[a((o(),r("div",ie,[e("span",ne,u(d.$t("settings.pages.themes.sections.section.custom-color.fields.field.primary-color.label")),1),e("label",ae,[a(e("input",{"onUpdate:modelValue":t[2]||(t[2]=l=>i(n).themeColorsHueDynamic=l),type:"checkbox",class:"peer sr-only"},null,512),[[V,i(n).themeColorsHueDynamic]]),t[6]||(t[6]=e("div",{class:"peer-checked:bg-primary-500 h-6 w-11 rounded-full bg-neutral-200 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white dark:bg-neutral-600 after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white"},null,-1)),h(" "+u(d.$t("settings.pages.themes.sections.section.custom-color.fields.field.primary-color.rgb-on.title")),1)])])),[[s]]),a(e("input",{"onUpdate:modelValue":t[3]||(t[3]=l=>i(n).themeColorsHue=l),initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+6*10,delay:6*50,transition:"all ease-in-out duration-250",type:"range",min:"0",max:"360",step:"0.01",class:x(["theme-hue-slider",i(n).themeColorsHueDynamic?"opacity-25 cursor-not-allowed":"cursor-pointer"]),disabled:i(n).themeColorsHueDynamic},null,10,oe),[[R,i(n).themeColorsHue],[s]]),a((o(),r("div",se,[t[8]||(t[8]=e("span",{"bg-primary-50":""},"50",-1)),t[9]||(t[9]=e("span",{"bg-primary-100":""},"100",-1)),t[10]||(t[10]=e("span",{"bg-primary-200":""},"200",-1)),t[11]||(t[11]=e("span",{"bg-primary-300":""},"300",-1)),t[12]||(t[12]=e("span",{"bg-primary-400":""},"400",-1)),t[13]||(t[13]=e("span",{"bg-primary-500":""},"500",-1)),a((o(),r("div",le,t[7]||(t[7]=[e("span",{"bg-primary-600":""},"600",-1),e("span",{"bg-primary-700":""},"700",-1),e("span",{"bg-primary-800":""},"800",-1),e("span",{"bg-primary-900":""},"900",-1),e("span",{"bg-primary-950":""},"950",-1)]))),[[s]])])),[[s]]),a((o(),r("div",re,t[14]||(t[14]=[e("span",{bg:"primary-500/5"},"500/5",-1),e("span",{bg:"primary-500/10"},"500/10",-1),e("span",{bg:"primary-500/20"},"500/20",-1),e("span",{bg:"primary-500/30"},"500/30",-1),e("span",{bg:"primary-500/40"},"500/40",-1),e("span",{bg:"primary-500/50"},"500/50",-1),e("span",{bg:"primary-500/60"},"500/60",-1),e("span",{bg:"primary-500/70"},"500/70",-1),e("span",{bg:"primary-500/80"},"500/80",-1),e("span",{bg:"primary-500/90"},"500/90",-1),e("span",{bg:"primary-500"},"500",-1)]))),[[s]])]),_:1},8,["title"])),[[s]]),a((o(),f(i(C),{title:"settings.pages.themes.sections.section.theme-presets.title",icon:"i-solar:magic-stick-2-bold-duotone",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+10*10,delay:10*50,transition:"all ease-in-out duration-250"},{default:g(()=>[(o(!0),r(D,null,q(d.$tm("settings.pages.themes.sections.section.theme-presets.presets"),({title:l,description:w,colors:E},b)=>a((o(),r("div",{key:b,class:"w-full flex items-center justify-between rounded-lg px-4 py-3 outline-none transition-all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+11*10+b*10,delay:11*50+b*50,transition:"all ease-in-out duration-250"},[e("div",null,[e("span",ue,u(d.$rt(l)),1),e("div",pe,u(d.$rt(w)),1)]),m(K,{colors:E.map((T,S)=>({hex:i(Y)[b][S],name:d.$rt(T)}))},null,8,["colors"])],8,de)),[[s]])),128))]),_:1})),[[s]]),a((o(),f(i(C),{title:"settings.pages.themes.sections.section.developer.title",icon:"i-solar:code-bold-duotone",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+18*10,delay:18*50,transition:"all ease-in-out duration-250"},{default:g(()=>[a(m(B,{modelValue:i(n).disableTransitions,"onUpdate:modelValue":t[4]||(t[4]=l=>i(n).disableTransitions=l),"icon-on":"i-solar:people-nearby-bold-duotone","icon-off":"i-solar:running-2-line-duotone",text:"settings.animations.stage-transitions.title",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+19*10,delay:19*50,transition:"all ease-in-out duration-250"},null,8,["modelValue"]),[[s]]),a(m(B,{modelValue:i(n).usePageSpecificTransitions,"onUpdate:modelValue":t[5]||(t[5]=l=>i(n).usePageSpecificTransitions=l),disabled:i(n).disableTransitions,"icon-on":"i-solar:running-2-line-duotone","icon-off":"i-solar:people-nearby-bold-duotone",text:"settings.animations.use-page-specific-transitions.title",description:"settings.animations.use-page-specific-transitions.description",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+20*10,delay:20*50,transition:"all ease-in-out duration-250"},null,8,["modelValue","disabled"]),[[s]])]),_:1})),[[s]]),a((o(),r("div",ye,t[15]||(t[15]=[e("div",{text:"60","i-solar:filters-bold-duotone":""},null,-1)]))),[[s]])],64)}}});typeof k=="function"&&k($);const he=J($,[["__scopeId","data-v-4a014d7b"]]);export{he as default}; diff --git a/assets/index-qOh3wAiY.js b/assets/index-BUaUWOtl.js similarity index 99% rename from assets/index-qOh3wAiY.js rename to assets/index-BUaUWOtl.js index e4f3c3cc6ada7bdb73a140e93d5894070d6f413c..9a61193d1bebfb7820c453f06d1b72c47a763994 100644 --- a/assets/index-qOh3wAiY.js +++ b/assets/index-BUaUWOtl.js @@ -1,3 +1,3 @@ -import{h as O,g as E,G as Mt,w as j,ah as Lt,ai as Ft,bT as xe,u as m,d as D,x as T,o as B,y as A,m as P,bU as de,bV as fe,bW as F,bM as Ze,bv as ge,l as De,E as lt,C as Nt,b as me,bX as yn,bY as ye,bZ as wn,b_ as kt,b$ as bn,c0 as ke,c1 as xn,c2 as On,br as Cn,H as It,bx as An,c3 as Wt,c4 as En,c5 as Ht,c6 as xt,af as K,ab as Dn,bL as Pn,D as _n,c as Vt,n as st,c7 as jt,c8 as Bn,c9 as zt,ca as Tn,cb as Rn,a as $n,cc as Sn,cd as Mn}from"./index-20XXNHAB.js";const Ln=["top","right","bottom","left"],ae=Math.min,H=Math.max,Ie=Math.round,Me=Math.floor,G=e=>({x:e,y:e}),Fn={left:"right",right:"left",bottom:"top",top:"bottom"},Nn={start:"end",end:"start"};function Qe(e,t,n){return H(e,ae(t,n))}function ee(e,t){return typeof e=="function"?e(t):e}function te(e){return e.split("-")[0]}function Pe(e){return e.split("-")[1]}function at(e){return e==="x"?"y":"x"}function ut(e){return e==="y"?"height":"width"}function ue(e){return["top","bottom"].includes(te(e))?"y":"x"}function ct(e){return at(ue(e))}function kn(e,t,n){n===void 0&&(n=!1);const o=Pe(e),i=ct(e),r=ut(i);let l=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(l=We(l)),[l,We(l)]}function In(e){const t=We(e);return[et(e),t,et(t)]}function et(e){return e.replace(/start|end/g,t=>Nn[t])}function Wn(e,t,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:o:t?o:i;case"left":case"right":return t?r:l;default:return[]}}function Hn(e,t,n,o){const i=Pe(e);let r=Wn(te(e),n==="start",o);return i&&(r=r.map(l=>l+"-"+i),t&&(r=r.concat(r.map(et)))),r}function We(e){return e.replace(/left|right|bottom|top/g,t=>Fn[t])}function Vn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Kt(e){return typeof e!="number"?Vn(e):{top:e,right:e,bottom:e,left:e}}function He(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function Ot(e,t,n){let{reference:o,floating:i}=e;const r=ue(t),l=ct(t),s=ut(l),d=te(t),c=r==="y",a=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,p=o[s]/2-i[s]/2;let f;switch(d){case"top":f={x:a,y:o.y-i.height};break;case"bottom":f={x:a,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:u};break;case"left":f={x:o.x-i.width,y:u};break;default:f={x:o.x,y:o.y}}switch(Pe(t)){case"start":f[l]-=p*(n&&c?-1:1);break;case"end":f[l]+=p*(n&&c?-1:1);break}return f}const jn=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:a,y:u}=Ot(c,o,d),p=o,f={},v=0;for(let g=0;g({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:l,elements:s,middlewareData:d}=t,{element:c,padding:a=0}=ee(e,t)||{};if(c==null)return{};const u=Kt(a),p={x:n,y:o},f=ct(i),v=ut(f),g=await l.getDimensions(c),h=f==="y",y=h?"top":"left",b=h?"bottom":"right",w=h?"clientHeight":"clientWidth",C=r.reference[v]+r.reference[f]-p[f]-r.floating[v],x=p[f]-r.reference[f],S=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let _=S?S[w]:0;(!_||!await(l.isElement==null?void 0:l.isElement(S)))&&(_=s.floating[w]||r.floating[v]);const M=C/2-x/2,N=_/2-g[v]/2-1,R=ae(u[y],N),z=ae(u[b],N),k=R,W=_-g[v]-z,L=_/2-g[v]/2+M,oe=Qe(k,L,W),I=!d.arrow&&Pe(i)!=null&&L!==oe&&r.reference[v]/2-(LL<=0)){var z,k;const L=(((z=r.flip)==null?void 0:z.index)||0)+1,oe=_[L];if(oe)return{data:{index:L,overflows:R},reset:{placement:oe}};let I=(k=R.filter(q=>q.overflows[0]<=0).sort((q,ie)=>q.overflows[1]-ie.overflows[1])[0])==null?void 0:k.placement;if(!I)switch(f){case"bestFit":{var W;const q=(W=R.filter(ie=>{if(S){const re=ue(ie.placement);return re===b||re==="y"}return!0}).map(ie=>[ie.placement,ie.overflows.filter(re=>re>0).reduce((re,gn)=>re+gn,0)]).sort((ie,re)=>ie[1]-re[1])[0])==null?void 0:W[0];q&&(I=q);break}case"initialPlacement":I=s;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function Ct(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function At(e){return Ln.some(t=>e[t]>=0)}const Un=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...i}=ee(e,t);switch(o){case"referenceHidden":{const r=await _e(t,{...i,elementContext:"reference"}),l=Ct(r,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:At(l)}}}case"escaped":{const r=await _e(t,{...i,altBoundary:!0}),l=Ct(r,n.floating);return{data:{escapedOffsets:l,escaped:At(l)}}}default:return{}}}}};async function Yn(e,t){const{placement:n,platform:o,elements:i}=e,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),l=te(n),s=Pe(n),d=ue(n)==="y",c=["left","top"].includes(l)?-1:1,a=r&&d?-1:1,u=ee(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:v}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof v=="number"&&(f=s==="end"?v*-1:v),d?{x:f*a,y:p*c}:{x:p*c,y:f*a}}const Xn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:l,middlewareData:s}=t,d=await Yn(t,e);return l===((n=s.offset)==null?void 0:n.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:i+d.x,y:r+d.y,data:{...d,placement:l}}}}},qn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:s={fn:h=>{let{x:y,y:b}=h;return{x:y,y:b}}},...d}=ee(e,t),c={x:n,y:o},a=await _e(t,d),u=ue(te(i)),p=at(u);let f=c[p],v=c[u];if(r){const h=p==="y"?"top":"left",y=p==="y"?"bottom":"right",b=f+a[h],w=f-a[y];f=Qe(b,f,w)}if(l){const h=u==="y"?"top":"left",y=u==="y"?"bottom":"right",b=v+a[h],w=v-a[y];v=Qe(b,v,w)}const g=s.fn({...t,[p]:f,[u]:v});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[p]:r,[u]:l}}}}}},Gn=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:i,rects:r,middlewareData:l}=t,{offset:s=0,mainAxis:d=!0,crossAxis:c=!0}=ee(e,t),a={x:n,y:o},u=ue(i),p=at(u);let f=a[p],v=a[u];const g=ee(s,t),h=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(d){const w=p==="y"?"height":"width",C=r.reference[p]-r.floating[w]+h.mainAxis,x=r.reference[p]+r.reference[w]-h.mainAxis;fx&&(f=x)}if(c){var y,b;const w=p==="y"?"width":"height",C=["top","left"].includes(te(i)),x=r.reference[u]-r.floating[w]+(C&&((y=l.offset)==null?void 0:y[u])||0)+(C?0:h.crossAxis),S=r.reference[u]+r.reference[w]+(C?0:((b=l.offset)==null?void 0:b[u])||0)-(C?h.crossAxis:0);vS&&(v=S)}return{[p]:f,[u]:v}}}},Jn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:i,rects:r,platform:l,elements:s}=t,{apply:d=()=>{},...c}=ee(e,t),a=await _e(t,c),u=te(i),p=Pe(i),f=ue(i)==="y",{width:v,height:g}=r.floating;let h,y;u==="top"||u==="bottom"?(h=u,y=p===(await(l.isRTL==null?void 0:l.isRTL(s.floating))?"start":"end")?"left":"right"):(y=u,h=p==="end"?"top":"bottom");const b=g-a.top-a.bottom,w=v-a.left-a.right,C=ae(g-a[h],b),x=ae(v-a[y],w),S=!t.middlewareData.shift;let _=C,M=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(_=b),S&&!p){const R=H(a.left,0),z=H(a.right,0),k=H(a.top,0),W=H(a.bottom,0);f?M=v-2*(R!==0||z!==0?R+z:H(a.left,a.right)):_=g-2*(k!==0||W!==0?k+W:H(a.top,a.bottom))}await d({...t,availableWidth:M,availableHeight:_});const N=await l.getDimensions(s.floating);return v!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function je(){return typeof window<"u"}function we(e){return dt(e)?(e.nodeName||"").toLowerCase():"#document"}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Z(e){var t;return(t=(dt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function dt(e){return je()?e instanceof Node||e instanceof V(e).Node:!1}function U(e){return je()?e instanceof Element||e instanceof V(e).Element:!1}function J(e){return je()?e instanceof HTMLElement||e instanceof V(e).HTMLElement:!1}function Et(e){return!je()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}function Te(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(i)}function Zn(e){return["table","td","th"].includes(we(e))}function ze(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ft(e){const t=pt(),n=U(e)?Y(e):e;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function Qn(e){let t=ce(e);for(;J(t)&&!Ee(t);){if(ft(t))return t;if(ze(t))return null;t=ce(t)}return null}function pt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ee(e){return["html","body","#document"].includes(we(e))}function Y(e){return V(e).getComputedStyle(e)}function Ke(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ce(e){if(we(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Et(e)&&e.host||Z(e);return Et(t)?t.host:t}function Ut(e){const t=ce(e);return Ee(t)?e.ownerDocument?e.ownerDocument.body:e.body:J(t)&&Te(t)?t:Ut(t)}function Be(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Ut(e),r=i===((o=e.ownerDocument)==null?void 0:o.body),l=V(i);if(r){const s=tt(l);return t.concat(l,l.visualViewport||[],Te(i)?i:[],s&&n?Be(s):[])}return t.concat(i,Be(i,[],n))}function tt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yt(e){const t=Y(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=J(e),r=i?e.offsetWidth:n,l=i?e.offsetHeight:o,s=Ie(n)!==r||Ie(o)!==l;return s&&(n=r,o=l),{width:n,height:o,$:s}}function vt(e){return U(e)?e:e.contextElement}function Ae(e){const t=vt(e);if(!J(t))return G(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=Yt(t);let l=(r?Ie(n.width):n.width)/o,s=(r?Ie(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const eo=G(0);function Xt(e){const t=V(e);return!pt()||!t.visualViewport?eo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function to(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==V(e)?!1:t}function he(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),r=vt(e);let l=G(1);t&&(o?U(o)&&(l=Ae(o)):l=Ae(e));const s=to(r,n,o)?Xt(r):G(0);let d=(i.left+s.x)/l.x,c=(i.top+s.y)/l.y,a=i.width/l.x,u=i.height/l.y;if(r){const p=V(r),f=o&&U(o)?V(o):o;let v=p,g=tt(v);for(;g&&o&&f!==v;){const h=Ae(g),y=g.getBoundingClientRect(),b=Y(g),w=y.left+(g.clientLeft+parseFloat(b.paddingLeft))*h.x,C=y.top+(g.clientTop+parseFloat(b.paddingTop))*h.y;d*=h.x,c*=h.y,a*=h.x,u*=h.y,d+=w,c+=C,v=V(g),g=tt(v)}}return He({width:a,height:u,x:d,y:c})}function mt(e,t){const n=Ke(e).scrollLeft;return t?t.left+n:he(Z(e)).left+n}function qt(e,t,n){n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=o.left+t.scrollLeft-(n?0:mt(e,o)),r=o.top+t.scrollTop;return{x:i,y:r}}function no(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r=i==="fixed",l=Z(o),s=t?ze(t.floating):!1;if(o===l||s&&r)return n;let d={scrollLeft:0,scrollTop:0},c=G(1);const a=G(0),u=J(o);if((u||!u&&!r)&&((we(o)!=="body"||Te(l))&&(d=Ke(o)),J(o))){const f=he(o);c=Ae(o),a.x=f.x+o.clientLeft,a.y=f.y+o.clientTop}const p=l&&!u&&!r?qt(l,d,!0):G(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-d.scrollLeft*c.x+a.x+p.x,y:n.y*c.y-d.scrollTop*c.y+a.y+p.y}}function oo(e){return Array.from(e.getClientRects())}function io(e){const t=Z(e),n=Ke(e),o=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=H(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+mt(e);const s=-n.scrollTop;return Y(o).direction==="rtl"&&(l+=H(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:l,y:s}}function ro(e,t){const n=V(e),o=Z(e),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,d=0;if(i){r=i.width,l=i.height;const c=pt();(!c||c&&t==="fixed")&&(s=i.offsetLeft,d=i.offsetTop)}return{width:r,height:l,x:s,y:d}}function lo(e,t){const n=he(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=J(e)?Ae(e):G(1),l=e.clientWidth*r.x,s=e.clientHeight*r.y,d=i*r.x,c=o*r.y;return{width:l,height:s,x:d,y:c}}function Dt(e,t,n){let o;if(t==="viewport")o=ro(e,n);else if(t==="document")o=io(Z(e));else if(U(t))o=lo(t,n);else{const i=Xt(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return He(o)}function Gt(e,t){const n=ce(e);return n===t||!U(n)||Ee(n)?!1:Y(n).position==="fixed"||Gt(n,t)}function so(e,t){const n=t.get(e);if(n)return n;let o=Be(e,[],!1).filter(s=>U(s)&&we(s)!=="body"),i=null;const r=Y(e).position==="fixed";let l=r?ce(e):e;for(;U(l)&&!Ee(l);){const s=Y(l),d=ft(l);!d&&s.position==="fixed"&&(i=null),(r?!d&&!i:!d&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Te(l)&&!d&&Gt(e,l))?o=o.filter(a=>a!==l):i=s,l=ce(l)}return t.set(e,o),o}function ao(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const l=[...n==="clippingAncestors"?ze(t)?[]:so(t,this._c):[].concat(n),o],s=l[0],d=l.reduce((c,a)=>{const u=Dt(t,a,i);return c.top=H(u.top,c.top),c.right=ae(u.right,c.right),c.bottom=ae(u.bottom,c.bottom),c.left=H(u.left,c.left),c},Dt(t,s,i));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function uo(e){const{width:t,height:n}=Yt(e);return{width:t,height:n}}function co(e,t,n){const o=J(t),i=Z(t),r=n==="fixed",l=he(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const d=G(0);if(o||!o&&!r)if((we(t)!=="body"||Te(i))&&(s=Ke(t)),o){const p=he(t,!0,r,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else i&&(d.x=mt(i));const c=i&&!o&&!r?qt(i,s):G(0),a=l.left+s.scrollLeft-d.x-c.x,u=l.top+s.scrollTop-d.y-c.y;return{x:a,y:u,width:l.width,height:l.height}}function Ye(e){return Y(e).position==="static"}function Pt(e,t){if(!J(e)||Y(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Z(e)===n&&(n=n.ownerDocument.body),n}function Jt(e,t){const n=V(e);if(ze(e))return n;if(!J(e)){let i=ce(e);for(;i&&!Ee(i);){if(U(i)&&!Ye(i))return i;i=ce(i)}return n}let o=Pt(e,t);for(;o&&Zn(o)&&Ye(o);)o=Pt(o,t);return o&&Ee(o)&&Ye(o)&&!ft(o)?n:o||Qn(e)||n}const fo=async function(e){const t=this.getOffsetParent||Jt,n=this.getDimensions,o=await n(e.floating);return{reference:co(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function po(e){return Y(e).direction==="rtl"}const vo={convertOffsetParentRelativeRectToViewportRelativeRect:no,getDocumentElement:Z,getClippingRect:ao,getOffsetParent:Jt,getElementRects:fo,getClientRects:oo,getDimensions:uo,getScale:Ae,isElement:U,isRTL:po};function Zt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mo(e,t){let n=null,o;const i=Z(e);function r(){var s;clearTimeout(o),(s=n)==null||s.disconnect(),n=null}function l(s,d){s===void 0&&(s=!1),d===void 0&&(d=1),r();const c=e.getBoundingClientRect(),{left:a,top:u,width:p,height:f}=c;if(s||t(),!p||!f)return;const v=Me(u),g=Me(i.clientWidth-(a+p)),h=Me(i.clientHeight-(u+f)),y=Me(a),w={rootMargin:-v+"px "+-g+"px "+-h+"px "+-y+"px",threshold:H(0,ae(1,d))||1};let C=!0;function x(S){const _=S[0].intersectionRatio;if(_!==d){if(!C)return l();_?l(!1,_):o=setTimeout(()=>{l(!1,1e-7)},1e3)}_===1&&!Zt(c,e.getBoundingClientRect())&&l(),C=!1}try{n=new IntersectionObserver(x,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,w)}n.observe(e)}return l(!0),r}function ho(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,c=vt(e),a=i||r?[...c?Be(c):[],...Be(t)]:[];a.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),r&&y.addEventListener("resize",n)});const u=c&&s?mo(c,n):null;let p=-1,f=null;l&&(f=new ResizeObserver(y=>{let[b]=y;b&&b.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),c&&!d&&f.observe(c),f.observe(t));let v,g=d?he(e):null;d&&h();function h(){const y=he(e);g&&!Zt(g,y)&&n(),g=y,v=requestAnimationFrame(h)}return n(),()=>{var y;a.forEach(b=>{i&&b.removeEventListener("scroll",n),r&&b.removeEventListener("resize",n)}),u==null||u(),(y=f)==null||y.disconnect(),f=null,d&&cancelAnimationFrame(v)}}const go=Xn,yo=qn,_t=Kn,wo=Jn,bo=Un,xo=zn,Oo=Gn,Co=(e,t,n)=>{const o=new Map,i={platform:vo,...n},r={...i.platform,_c:o};return jn(e,t,{...i,platform:r})};function Ao(e){return e!=null&&typeof e=="object"&&"$el"in e}function nt(e){if(Ao(e)){const t=e.$el;return dt(t)&&we(t)==="#comment"?null:t}return e}function Ce(e){return typeof e=="function"?e():m(e)}function Eo(e){return{name:"arrow",options:e,fn(t){const n=nt(Ce(e.element));return n==null?{}:xo({element:n,padding:e.padding}).fn(t)}}}function Qt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bt(e,t){const n=Qt(e);return Math.round(t*n)/n}function Do(e,t,n){n===void 0&&(n={});const o=n.whileElementsMounted,i=O(()=>{var _;return(_=Ce(n.open))!=null?_:!0}),r=O(()=>Ce(n.middleware)),l=O(()=>{var _;return(_=Ce(n.placement))!=null?_:"bottom"}),s=O(()=>{var _;return(_=Ce(n.strategy))!=null?_:"absolute"}),d=O(()=>{var _;return(_=Ce(n.transform))!=null?_:!0}),c=O(()=>nt(e.value)),a=O(()=>nt(t.value)),u=E(0),p=E(0),f=E(s.value),v=E(l.value),g=Mt({}),h=E(!1),y=O(()=>{const _={position:f.value,left:"0",top:"0"};if(!a.value)return _;const M=Bt(a.value,u.value),N=Bt(a.value,p.value);return d.value?{..._,transform:"translate("+M+"px, "+N+"px)",...Qt(a.value)>=1.5&&{willChange:"transform"}}:{position:f.value,left:M+"px",top:N+"px"}});let b;function w(){if(c.value==null||a.value==null)return;const _=i.value;Co(c.value,a.value,{middleware:r.value,placement:l.value,strategy:s.value}).then(M=>{u.value=M.x,p.value=M.y,f.value=M.strategy,v.value=M.placement,g.value=M.middlewareData,h.value=_!==!1})}function C(){typeof b=="function"&&(b(),b=void 0)}function x(){if(C(),o===void 0){w();return}if(c.value!=null&&a.value!=null){b=o(c.value,a.value,w);return}}function S(){i.value||(h.value=!1)}return j([r,l,s,i],w,{flush:"sync"}),j([c,a],x,{flush:"sync"}),j(i,S,{flush:"sync"}),Lt()&&Ft(C),{x:xe(u),y:xe(p),strategy:xe(f),placement:xe(v),middlewareData:xe(g),isPositioned:xe(h),floatingStyles:y,update:w}}function be(e,t){const n=typeof e=="string"&&!t?`${e}Context`:t,o=Symbol(n);return[i=>{const r=bn(o,i);if(r||r===null)return r;throw new Error(`Injection \`${o.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(", ")}`:`\`${e}\``}`)},i=>(Mn(o,i),i)]}function en(e,t,n){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),o.dispatchEvent(i)}function Po(e,t){var n;const o=Mt();return K(()=>{o.value=e()},{...t,flush:(n=void 0)!=null?n:"sync"}),Ht(o)}function Re(e){return Lt()?(Ft(e),!0):!1}function _o(){const e=new Set,t=n=>{e.delete(n)};return{on:n=>{e.add(n);const o=()=>t(n);return Re(o),{off:o}},off:t,trigger:(...n)=>Promise.all(Array.from(e).map(o=>o(...n)))}}function Bo(e){let t=!1,n;const o=jt(!0);return(...i)=>(t||(n=o.run(()=>e(...i)),t=!0),n)}function To(e){let t=0,n,o;const i=()=>{t-=1,o&&t<=0&&(o.stop(),n=void 0,o=void 0)};return(...r)=>(t+=1,n||(o=jt(!0),n=o.run(()=>e(...r))),Re(i),n)}function ve(e){return typeof e=="function"?e():m(e)}const pe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ro=e=>typeof e<"u",$o=Object.prototype.toString,So=e=>$o.call(e)==="[object Object]",Mo=()=>{},Tt=Lo();function Lo(){var e,t;return pe&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window==null?void 0:window.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function Fo(e){return ye()}function No(e,t=1e4){return Sn((n,o)=>{let i=ve(e),r;const l=()=>setTimeout(()=>{i=ve(e),o()},ve(t));return Re(()=>{clearTimeout(r)}),{get(){return n(),i},set(s){i=s,o(),clearTimeout(r),r=l()}}})}function ko(e,t){Fo()&&Bn(e,t)}function tn(e,t,n={}){const{immediate:o=!0}=n,i=E(!1);let r=null;function l(){r&&(clearTimeout(r),r=null)}function s(){i.value=!1,l()}function d(...c){l(),i.value=!0,r=setTimeout(()=>{i.value=!1,r=null,e(...c)},ve(t))}return o&&(i.value=!0,pe&&d()),Re(s),{isPending:Ht(i),start:d,stop:s}}function $e(e){var t;const n=ve(e);return(t=n==null?void 0:n.$el)!=null?t:n}const ht=pe?window:void 0;function Ve(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=ht):[t,n,o,i]=e,!t)return Mo;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],l=()=>{r.forEach(a=>a()),r.length=0},s=(a,u,p,f)=>(a.addEventListener(u,p,f),()=>a.removeEventListener(u,p,f)),d=j(()=>[$e(t),ve(i)],([a,u])=>{if(l(),!a)return;const p=So(u)?{...u}:u;r.push(...n.flatMap(f=>o.map(v=>s(a,f,v,p))))},{immediate:!0,flush:"post"}),c=()=>{d(),l()};return Re(c),c}function Io(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Wo(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:i=ht,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=o,d=Io(t);return Ve(i,r,c=>{c.repeat&&ve(s)||d(c)&&n(c)},l)}function Ho(){const e=E(!1),t=ye();return t&&De(()=>{e.value=!0},t),e}function Vo(e){return JSON.parse(JSON.stringify(e))}function nn(e,t,n,o={}){var i,r,l;const{clone:s=!1,passive:d=!1,eventName:c,deep:a=!1,defaultValue:u,shouldEmit:p}=o,f=ye(),v=n||(f==null?void 0:f.emit)||((i=f==null?void 0:f.$emit)==null?void 0:i.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=c;g=g||`update:${t.toString()}`;const h=w=>s?typeof s=="function"?s(w):Vo(w):w,y=()=>Ro(e[t])?h(e[t]):u,b=w=>{p?p(w)&&v(g,w):v(g,w)};if(d){const w=y(),C=E(w);let x=!1;return j(()=>e[t],S=>{x||(x=!0,C.value=h(S),ge(()=>x=!1))}),j(C,S=>{!x&&(S!==e[t]||a)&&b(S)},{deep:a}),C}else return O({get(){return y()},set(w){b(w)}})}function gt(e){return e?e.flatMap(t=>t.type===An?gt(t.children):[t]):[]}function se(){let e=document.activeElement;if(e==null)return null;for(;e!=null&&e.shadowRoot!=null&&e.shadowRoot.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function Xe(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function ot(e,t,n=".",o){if(!Xe(t))return ot(e,{},n);const i=Object.assign({},t);for(const r in e){if(r==="__proto__"||r==="constructor")continue;const l=e[r];l!=null&&(Array.isArray(l)&&Array.isArray(i[r])?i[r]=[...l,...i[r]]:Xe(l)&&Xe(i[r])?i[r]=ot(l,i[r],(n?`${n}.`:"")+r.toString()):i[r]=l)}return i}function jo(e){return(...t)=>t.reduce((n,o)=>ot(n,o,""),{})}const zo=jo(),[on,nr]=be("ConfigProvider");let Ko="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Uo=(e=21)=>{let t="",n=e;for(;n--;)t+=Ko[Math.random()*64|0];return t};const Yo=To(()=>{const e=E(new Map),t=E(),n=O(()=>{for(const l of e.value.values())if(l)return!0;return!1}),o=on({scrollBody:E(!0)});let i=null;const r=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.body.style.removeProperty("--scrollbar-width"),document.body.style.overflow=t.value??"",Tt&&(i==null||i()),t.value=void 0};return j(n,(l,s)=>{var d;if(!pe)return;if(!l){s&&r();return}t.value===void 0&&(t.value=document.body.style.overflow);const c=window.innerWidth-document.documentElement.clientWidth,a={padding:c,margin:0},u=(d=o.scrollBody)!=null&&d.value?typeof o.scrollBody.value=="object"?zo({padding:o.scrollBody.value.padding===!0?c:o.scrollBody.value.padding,margin:o.scrollBody.value.margin===!0?c:o.scrollBody.value.margin},a):a:{padding:0,margin:0};c>0&&(document.body.style.paddingRight=typeof u.padding=="number"?`${u.padding}px`:String(u.padding),document.body.style.marginRight=typeof u.margin=="number"?`${u.margin}px`:String(u.margin),document.body.style.setProperty("--scrollbar-width",`${c}px`),document.body.style.overflow="hidden"),Tt&&(i=Ve(document,"touchmove",p=>qo(p),{passive:!1})),ge(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),e});function Xo(e){const t=Uo(6),n=Yo();n.value.set(t,e);const o=O({get:()=>n.value.get(t)??!1,set:i=>n.value.set(t,i)});return ko(()=>{n.value.delete(t)}),o}function rn(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth1?!0:(t.preventDefault&&t.cancelable&&t.preventDefault(),!1)}function Se(e){const t=ye(),n=t==null?void 0:t.type.emits,o={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${t==null?void 0:t.type.__name}`),n==null||n.forEach(i=>{o[wn(kt(i))]=(...r)=>e(i,...r)}),o}function ln(e){const t=ye(),n=Object.keys((t==null?void 0:t.type.props)??{}).reduce((i,r)=>{const l=(t==null?void 0:t.type.props[r]).default;return l!==void 0&&(i[r]=l),i},{}),o=Cn(e);return O(()=>{const i={},r=(t==null?void 0:t.vnode.props)??{};return Object.keys(r).forEach(l=>{i[kt(l)]=r[l]}),Object.keys({...n,...i}).reduce((l,s)=>(o.value[s]!==void 0&&(l[s]=o.value[s]),l),{})})}function sn(e,t){const n=ln(e),o=t?Se(t):{};return O(()=>({...n.value,...o}))}function $(){const e=ye(),t=E(),n=O(()=>{var l,s;return["#text","#comment"].includes((l=t.value)==null?void 0:l.$el.nodeName)?(s=t.value)==null?void 0:s.$el.nextElementSibling:$e(t)}),o=Object.assign({},e.exposed),i={};for(const l in e.props)Object.defineProperty(i,l,{enumerable:!0,configurable:!0,get:()=>e.props[l]});if(Object.keys(o).length>0)for(const l in o)Object.defineProperty(i,l,{enumerable:!0,configurable:!0,get:()=>o[l]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=i;function r(l){t.value=l,l&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>l instanceof Element?l:l.$el}),e.exposed=i)}return{forwardRef:r,currentRef:t,currentElement:n}}function Go(e,t){const n=No(!1,300),o=E(null),i=_o();function r(){o.value=null,n.value=!1}function l(s,d){const c=s.currentTarget,a={x:s.clientX,y:s.clientY},u=Jo(a,c.getBoundingClientRect()),p=Zo(a,u),f=Qo(d.getBoundingClientRect()),v=ti([...p,...f]);o.value=v,n.value=!0}return K(s=>{if(e.value&&t.value){const d=a=>l(a,t.value),c=a=>l(a,e.value);e.value.addEventListener("pointerleave",d),t.value.addEventListener("pointerleave",c),s(()=>{var a,u;(a=e.value)==null||a.removeEventListener("pointerleave",d),(u=t.value)==null||u.removeEventListener("pointerleave",c)})}}),K(s=>{var d;if(o.value){const c=a=>{var u,p;if(!o.value)return;const f=a.target,v={x:a.clientX,y:a.clientY},g=((u=e.value)==null?void 0:u.contains(f))||((p=t.value)==null?void 0:p.contains(f)),h=!ei(v,o.value),y=!!f.closest("[data-grace-area-trigger]");g?r():(h||y)&&(r(),i.trigger())};(d=e.value)==null||d.ownerDocument.addEventListener("pointermove",c),s(()=>{var a;return(a=e.value)==null?void 0:a.ownerDocument.removeEventListener("pointermove",c)})}}),{isPointerInTransit:n,onPointerExit:i.on}}function Jo(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),r=Math.abs(t.left-e.x);switch(Math.min(n,o,i,r)){case r:return"left";case i:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Zo(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function Qo(e){const{top:t,right:n,bottom:o,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:o},{x:i,y:o}]}function ei(e,t){const{x:n,y:o}=e;let i=!1;for(let r=0,l=t.length-1;ro!=a>o&&n<(c-s)*(o-d)/(a-d)+s&&(i=!i)}return i}function ti(e){const t=e.slice();return t.sort((n,o)=>n.xo.x?1:n.yo.y?1:0),ni(t)}function ni(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o=2;){const r=t[t.length-1],l=t[t.length-2];if((r.x-l.x)*(i.y-l.y)>=(r.y-l.y)*(i.x-l.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const i=e[o];for(;n.length>=2;){const r=n[n.length-1],l=n[n.length-2];if((r.x-l.x)*(i.y-l.y)>=(r.y-l.y)*(i.x-l.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var oi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Oe=new WeakMap,Le=new WeakMap,Fe={},qe=0,an=function(e){return e&&(e.host||an(e.parentNode))},ii=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=an(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},ri=function(e,t,n,o){var i=ii(t,Array.isArray(e)?e:[e]);Fe[n]||(Fe[n]=new WeakMap);var r=Fe[n],l=[],s=new Set,d=new Set(i),c=function(u){!u||s.has(u)||(s.add(u),c(u.parentNode))};i.forEach(c);var a=function(u){!u||d.has(u)||Array.prototype.forEach.call(u.children,function(p){if(s.has(p))a(p);else try{var f=p.getAttribute(o),v=f!==null&&f!=="false",g=(Oe.get(p)||0)+1,h=(r.get(p)||0)+1;Oe.set(p,g),r.set(p,h),l.push(p),g===1&&v&&Le.set(p,!0),h===1&&p.setAttribute(n,"true"),v||p.setAttribute(o,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return a(t),s.clear(),qe++,function(){l.forEach(function(u){var p=Oe.get(u)-1,f=r.get(u)-1;Oe.set(u,p),r.set(u,f),p||(Le.has(u)||u.removeAttribute(o),Le.delete(u)),f||u.removeAttribute(n)}),qe--,qe||(Oe=new WeakMap,Oe=new WeakMap,Le=new WeakMap,Fe={})}},li=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),i=oi(e);return i?(o.push.apply(o,Array.from(i.querySelectorAll("[aria-live]"))),ri(o,i,n,"aria-hidden")):function(){return null}};function si(e){let t;j(()=>$e(e),n=>{n?t=li(n):t&&t()}),It(()=>{t&&t()})}let ai=0;function it(e,t="radix"){const n=on({useId:void 0});return xt?`${t}-${xt()}`:n.useId?`${t}-${n.useId()}`:`${t}-${++ai}`}function ui(e){const t=E(),n=O(()=>{var i;return((i=t.value)==null?void 0:i.width)??0}),o=O(()=>{var i;return((i=t.value)==null?void 0:i.height)??0});return De(()=>{const i=$e(e);if(i){t.value={width:i.offsetWidth,height:i.offsetHeight};const r=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const s=l[0];let d,c;if("borderBoxSize"in s){const a=s.borderBoxSize,u=Array.isArray(a)?a[0]:a;d=u.inlineSize,c=u.blockSize}else d=i.offsetWidth,c=i.offsetHeight;t.value={width:d,height:c}});return r.observe(i,{box:"border-box"}),()=>r.unobserve(i)}else t.value=void 0}),{width:n,height:o}}function ci(e,t){const n=E(e);function o(i){return t[n.value][i]??n.value}return{state:n,dispatch:i=>{n.value=o(i)}}}const di=D({name:"PrimitiveSlot",inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{var o,i;if(!n.default)return null;const r=gt(n.default()),l=r.findIndex(a=>a.type!==Wt);if(l===-1)return r;const s=r[l];(o=s.props)==null||delete o.ref;const d=s.props?F(t,s.props):t;t.class&&(i=s.props)!=null&&i.class&&delete s.props.class;const c=En(s,d);for(const a in d)a.startsWith("on")&&(c.props||(c.props={}),c.props[a]=d[a]);return r.length===1?c:(r[l]=c,r)}}}),X=D({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(e,{attrs:t,slots:n}){const o=e.asChild?"template":e.as;return typeof o=="string"&&["area","img","input"].includes(o)?()=>ke(o,t):o!=="template"?()=>ke(e.as,t,{default:n.default}):()=>ke(di,t,{default:n.default})}});function fi(e,t){var n;const o=E({}),i=E("none"),r=E(e),l=e.value?"mounted":"unmounted";let s;const d=((n=t.value)==null?void 0:n.ownerDocument.defaultView)??ht,{state:c,dispatch:a}=ci(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),u=h=>{var y;if(pe){const b=new CustomEvent(h,{bubbles:!1,cancelable:!1});(y=t.value)==null||y.dispatchEvent(b)}};j(e,async(h,y)=>{var b;const w=y!==h;if(await ge(),w){const C=i.value,x=Ne(t.value);h?(a("MOUNT"),u("enter"),x==="none"&&u("after-enter")):x==="none"||((b=o.value)==null?void 0:b.display)==="none"?(a("UNMOUNT"),u("leave"),u("after-leave")):y&&C!==x?(a("ANIMATION_OUT"),u("leave")):(a("UNMOUNT"),u("after-leave"))}},{immediate:!0});const p=h=>{const y=Ne(t.value),b=y.includes(h.animationName),w=c.value==="mounted"?"enter":"leave";if(h.target===t.value&&b&&(u(`after-${w}`),a("ANIMATION_END"),!r.value)){const C=t.value.style.animationFillMode;t.value.style.animationFillMode="forwards",s=d==null?void 0:d.setTimeout(()=>{var x;((x=t.value)==null?void 0:x.style.animationFillMode)==="forwards"&&(t.value.style.animationFillMode=C)})}h.target===t.value&&y==="none"&&a("ANIMATION_END")},f=h=>{h.target===t.value&&(i.value=Ne(t.value))},v=j(t,(h,y)=>{h?(o.value=getComputedStyle(h),h.addEventListener("animationstart",f),h.addEventListener("animationcancel",p),h.addEventListener("animationend",p)):(a("ANIMATION_END"),s!==void 0&&(d==null||d.clearTimeout(s)),y==null||y.removeEventListener("animationstart",f),y==null||y.removeEventListener("animationcancel",p),y==null||y.removeEventListener("animationend",p))},{immediate:!0}),g=j(c,()=>{const h=Ne(t.value);i.value=c.value==="mounted"?h:"none"});return It(()=>{v(),g()}),{isPresent:O(()=>["mounted","unmountSuspended"].includes(c.value))}}function Ne(e){return e&&getComputedStyle(e).animationName||"none"}const yt=D({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:t,expose:n}){var o;const{present:i,forceMount:r}=lt(e),l=E(),{isPresent:s}=fi(i,l);n({present:s});let d=t.default({present:s});d=gt(d||[]);const c=ye();if(d&&(d==null?void 0:d.length)>1){const a=(o=c==null?void 0:c.parent)!=null&&o.type.name?`<${c.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${a}\` 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(u=>` - ${u}`).join(` +import{h as O,g as E,G as Mt,w as j,ah as Lt,ai as Ft,bT as xe,u as m,d as D,x as T,o as B,y as A,m as P,bU as de,bV as fe,bW as F,bM as Ze,bv as ge,l as De,E as lt,C as Nt,b as me,bX as yn,bY as ye,bZ as wn,b_ as kt,b$ as bn,c0 as ke,c1 as xn,c2 as On,br as Cn,H as It,bx as An,c3 as Wt,c4 as En,c5 as Ht,c6 as xt,af as K,ab as Dn,bL as Pn,D as _n,c as Vt,n as st,c7 as jt,c8 as Bn,c9 as zt,ca as Tn,cb as Rn,a as $n,cc as Sn,cd as Mn}from"./index-D8Nm21zW.js";const Ln=["top","right","bottom","left"],ae=Math.min,H=Math.max,Ie=Math.round,Me=Math.floor,G=e=>({x:e,y:e}),Fn={left:"right",right:"left",bottom:"top",top:"bottom"},Nn={start:"end",end:"start"};function Qe(e,t,n){return H(e,ae(t,n))}function ee(e,t){return typeof e=="function"?e(t):e}function te(e){return e.split("-")[0]}function Pe(e){return e.split("-")[1]}function at(e){return e==="x"?"y":"x"}function ut(e){return e==="y"?"height":"width"}function ue(e){return["top","bottom"].includes(te(e))?"y":"x"}function ct(e){return at(ue(e))}function kn(e,t,n){n===void 0&&(n=!1);const o=Pe(e),i=ct(e),r=ut(i);let l=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(l=We(l)),[l,We(l)]}function In(e){const t=We(e);return[et(e),t,et(t)]}function et(e){return e.replace(/start|end/g,t=>Nn[t])}function Wn(e,t,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:o:t?o:i;case"left":case"right":return t?r:l;default:return[]}}function Hn(e,t,n,o){const i=Pe(e);let r=Wn(te(e),n==="start",o);return i&&(r=r.map(l=>l+"-"+i),t&&(r=r.concat(r.map(et)))),r}function We(e){return e.replace(/left|right|bottom|top/g,t=>Fn[t])}function Vn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Kt(e){return typeof e!="number"?Vn(e):{top:e,right:e,bottom:e,left:e}}function He(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function Ot(e,t,n){let{reference:o,floating:i}=e;const r=ue(t),l=ct(t),s=ut(l),d=te(t),c=r==="y",a=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,p=o[s]/2-i[s]/2;let f;switch(d){case"top":f={x:a,y:o.y-i.height};break;case"bottom":f={x:a,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:u};break;case"left":f={x:o.x-i.width,y:u};break;default:f={x:o.x,y:o.y}}switch(Pe(t)){case"start":f[l]-=p*(n&&c?-1:1);break;case"end":f[l]+=p*(n&&c?-1:1);break}return f}const jn=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,s=r.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:a,y:u}=Ot(c,o,d),p=o,f={},v=0;for(let g=0;g({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:r,platform:l,elements:s,middlewareData:d}=t,{element:c,padding:a=0}=ee(e,t)||{};if(c==null)return{};const u=Kt(a),p={x:n,y:o},f=ct(i),v=ut(f),g=await l.getDimensions(c),h=f==="y",y=h?"top":"left",b=h?"bottom":"right",w=h?"clientHeight":"clientWidth",C=r.reference[v]+r.reference[f]-p[f]-r.floating[v],x=p[f]-r.reference[f],S=await(l.getOffsetParent==null?void 0:l.getOffsetParent(c));let _=S?S[w]:0;(!_||!await(l.isElement==null?void 0:l.isElement(S)))&&(_=s.floating[w]||r.floating[v]);const M=C/2-x/2,N=_/2-g[v]/2-1,R=ae(u[y],N),z=ae(u[b],N),k=R,W=_-g[v]-z,L=_/2-g[v]/2+M,oe=Qe(k,L,W),I=!d.arrow&&Pe(i)!=null&&L!==oe&&r.reference[v]/2-(LL<=0)){var z,k;const L=(((z=r.flip)==null?void 0:z.index)||0)+1,oe=_[L];if(oe)return{data:{index:L,overflows:R},reset:{placement:oe}};let I=(k=R.filter(q=>q.overflows[0]<=0).sort((q,ie)=>q.overflows[1]-ie.overflows[1])[0])==null?void 0:k.placement;if(!I)switch(f){case"bestFit":{var W;const q=(W=R.filter(ie=>{if(S){const re=ue(ie.placement);return re===b||re==="y"}return!0}).map(ie=>[ie.placement,ie.overflows.filter(re=>re>0).reduce((re,gn)=>re+gn,0)]).sort((ie,re)=>ie[1]-re[1])[0])==null?void 0:W[0];q&&(I=q);break}case"initialPlacement":I=s;break}if(i!==I)return{reset:{placement:I}}}return{}}}};function Ct(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function At(e){return Ln.some(t=>e[t]>=0)}const Un=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:o="referenceHidden",...i}=ee(e,t);switch(o){case"referenceHidden":{const r=await _e(t,{...i,elementContext:"reference"}),l=Ct(r,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:At(l)}}}case"escaped":{const r=await _e(t,{...i,altBoundary:!0}),l=Ct(r,n.floating);return{data:{escapedOffsets:l,escaped:At(l)}}}default:return{}}}}};async function Yn(e,t){const{placement:n,platform:o,elements:i}=e,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),l=te(n),s=Pe(n),d=ue(n)==="y",c=["left","top"].includes(l)?-1:1,a=r&&d?-1:1,u=ee(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:v}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof v=="number"&&(f=s==="end"?v*-1:v),d?{x:f*a,y:p*c}:{x:p*c,y:f*a}}const Xn=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:r,placement:l,middlewareData:s}=t,d=await Yn(t,e);return l===((n=s.offset)==null?void 0:n.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:i+d.x,y:r+d.y,data:{...d,placement:l}}}}},qn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:l=!1,limiter:s={fn:h=>{let{x:y,y:b}=h;return{x:y,y:b}}},...d}=ee(e,t),c={x:n,y:o},a=await _e(t,d),u=ue(te(i)),p=at(u);let f=c[p],v=c[u];if(r){const h=p==="y"?"top":"left",y=p==="y"?"bottom":"right",b=f+a[h],w=f-a[y];f=Qe(b,f,w)}if(l){const h=u==="y"?"top":"left",y=u==="y"?"bottom":"right",b=v+a[h],w=v-a[y];v=Qe(b,v,w)}const g=s.fn({...t,[p]:f,[u]:v});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[p]:r,[u]:l}}}}}},Gn=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:i,rects:r,middlewareData:l}=t,{offset:s=0,mainAxis:d=!0,crossAxis:c=!0}=ee(e,t),a={x:n,y:o},u=ue(i),p=at(u);let f=a[p],v=a[u];const g=ee(s,t),h=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(d){const w=p==="y"?"height":"width",C=r.reference[p]-r.floating[w]+h.mainAxis,x=r.reference[p]+r.reference[w]-h.mainAxis;fx&&(f=x)}if(c){var y,b;const w=p==="y"?"width":"height",C=["top","left"].includes(te(i)),x=r.reference[u]-r.floating[w]+(C&&((y=l.offset)==null?void 0:y[u])||0)+(C?0:h.crossAxis),S=r.reference[u]+r.reference[w]+(C?0:((b=l.offset)==null?void 0:b[u])||0)-(C?h.crossAxis:0);vS&&(v=S)}return{[p]:f,[u]:v}}}},Jn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:i,rects:r,platform:l,elements:s}=t,{apply:d=()=>{},...c}=ee(e,t),a=await _e(t,c),u=te(i),p=Pe(i),f=ue(i)==="y",{width:v,height:g}=r.floating;let h,y;u==="top"||u==="bottom"?(h=u,y=p===(await(l.isRTL==null?void 0:l.isRTL(s.floating))?"start":"end")?"left":"right"):(y=u,h=p==="end"?"top":"bottom");const b=g-a.top-a.bottom,w=v-a.left-a.right,C=ae(g-a[h],b),x=ae(v-a[y],w),S=!t.middlewareData.shift;let _=C,M=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(M=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(_=b),S&&!p){const R=H(a.left,0),z=H(a.right,0),k=H(a.top,0),W=H(a.bottom,0);f?M=v-2*(R!==0||z!==0?R+z:H(a.left,a.right)):_=g-2*(k!==0||W!==0?k+W:H(a.top,a.bottom))}await d({...t,availableWidth:M,availableHeight:_});const N=await l.getDimensions(s.floating);return v!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function je(){return typeof window<"u"}function we(e){return dt(e)?(e.nodeName||"").toLowerCase():"#document"}function V(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Z(e){var t;return(t=(dt(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function dt(e){return je()?e instanceof Node||e instanceof V(e).Node:!1}function U(e){return je()?e instanceof Element||e instanceof V(e).Element:!1}function J(e){return je()?e instanceof HTMLElement||e instanceof V(e).HTMLElement:!1}function Et(e){return!je()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof V(e).ShadowRoot}function Te(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!["inline","contents"].includes(i)}function Zn(e){return["table","td","th"].includes(we(e))}function ze(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ft(e){const t=pt(),n=U(e)?Y(e):e;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function Qn(e){let t=ce(e);for(;J(t)&&!Ee(t);){if(ft(t))return t;if(ze(t))return null;t=ce(t)}return null}function pt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ee(e){return["html","body","#document"].includes(we(e))}function Y(e){return V(e).getComputedStyle(e)}function Ke(e){return U(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ce(e){if(we(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Et(e)&&e.host||Z(e);return Et(t)?t.host:t}function Ut(e){const t=ce(e);return Ee(t)?e.ownerDocument?e.ownerDocument.body:e.body:J(t)&&Te(t)?t:Ut(t)}function Be(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Ut(e),r=i===((o=e.ownerDocument)==null?void 0:o.body),l=V(i);if(r){const s=tt(l);return t.concat(l,l.visualViewport||[],Te(i)?i:[],s&&n?Be(s):[])}return t.concat(i,Be(i,[],n))}function tt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Yt(e){const t=Y(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=J(e),r=i?e.offsetWidth:n,l=i?e.offsetHeight:o,s=Ie(n)!==r||Ie(o)!==l;return s&&(n=r,o=l),{width:n,height:o,$:s}}function vt(e){return U(e)?e:e.contextElement}function Ae(e){const t=vt(e);if(!J(t))return G(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:r}=Yt(t);let l=(r?Ie(n.width):n.width)/o,s=(r?Ie(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const eo=G(0);function Xt(e){const t=V(e);return!pt()||!t.visualViewport?eo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function to(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==V(e)?!1:t}function he(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),r=vt(e);let l=G(1);t&&(o?U(o)&&(l=Ae(o)):l=Ae(e));const s=to(r,n,o)?Xt(r):G(0);let d=(i.left+s.x)/l.x,c=(i.top+s.y)/l.y,a=i.width/l.x,u=i.height/l.y;if(r){const p=V(r),f=o&&U(o)?V(o):o;let v=p,g=tt(v);for(;g&&o&&f!==v;){const h=Ae(g),y=g.getBoundingClientRect(),b=Y(g),w=y.left+(g.clientLeft+parseFloat(b.paddingLeft))*h.x,C=y.top+(g.clientTop+parseFloat(b.paddingTop))*h.y;d*=h.x,c*=h.y,a*=h.x,u*=h.y,d+=w,c+=C,v=V(g),g=tt(v)}}return He({width:a,height:u,x:d,y:c})}function mt(e,t){const n=Ke(e).scrollLeft;return t?t.left+n:he(Z(e)).left+n}function qt(e,t,n){n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=o.left+t.scrollLeft-(n?0:mt(e,o)),r=o.top+t.scrollTop;return{x:i,y:r}}function no(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const r=i==="fixed",l=Z(o),s=t?ze(t.floating):!1;if(o===l||s&&r)return n;let d={scrollLeft:0,scrollTop:0},c=G(1);const a=G(0),u=J(o);if((u||!u&&!r)&&((we(o)!=="body"||Te(l))&&(d=Ke(o)),J(o))){const f=he(o);c=Ae(o),a.x=f.x+o.clientLeft,a.y=f.y+o.clientTop}const p=l&&!u&&!r?qt(l,d,!0):G(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-d.scrollLeft*c.x+a.x+p.x,y:n.y*c.y-d.scrollTop*c.y+a.y+p.y}}function oo(e){return Array.from(e.getClientRects())}function io(e){const t=Z(e),n=Ke(e),o=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=H(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+mt(e);const s=-n.scrollTop;return Y(o).direction==="rtl"&&(l+=H(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:l,y:s}}function ro(e,t){const n=V(e),o=Z(e),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,d=0;if(i){r=i.width,l=i.height;const c=pt();(!c||c&&t==="fixed")&&(s=i.offsetLeft,d=i.offsetTop)}return{width:r,height:l,x:s,y:d}}function lo(e,t){const n=he(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=J(e)?Ae(e):G(1),l=e.clientWidth*r.x,s=e.clientHeight*r.y,d=i*r.x,c=o*r.y;return{width:l,height:s,x:d,y:c}}function Dt(e,t,n){let o;if(t==="viewport")o=ro(e,n);else if(t==="document")o=io(Z(e));else if(U(t))o=lo(t,n);else{const i=Xt(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return He(o)}function Gt(e,t){const n=ce(e);return n===t||!U(n)||Ee(n)?!1:Y(n).position==="fixed"||Gt(n,t)}function so(e,t){const n=t.get(e);if(n)return n;let o=Be(e,[],!1).filter(s=>U(s)&&we(s)!=="body"),i=null;const r=Y(e).position==="fixed";let l=r?ce(e):e;for(;U(l)&&!Ee(l);){const s=Y(l),d=ft(l);!d&&s.position==="fixed"&&(i=null),(r?!d&&!i:!d&&s.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Te(l)&&!d&&Gt(e,l))?o=o.filter(a=>a!==l):i=s,l=ce(l)}return t.set(e,o),o}function ao(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const l=[...n==="clippingAncestors"?ze(t)?[]:so(t,this._c):[].concat(n),o],s=l[0],d=l.reduce((c,a)=>{const u=Dt(t,a,i);return c.top=H(u.top,c.top),c.right=ae(u.right,c.right),c.bottom=ae(u.bottom,c.bottom),c.left=H(u.left,c.left),c},Dt(t,s,i));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function uo(e){const{width:t,height:n}=Yt(e);return{width:t,height:n}}function co(e,t,n){const o=J(t),i=Z(t),r=n==="fixed",l=he(e,!0,r,t);let s={scrollLeft:0,scrollTop:0};const d=G(0);if(o||!o&&!r)if((we(t)!=="body"||Te(i))&&(s=Ke(t)),o){const p=he(t,!0,r,t);d.x=p.x+t.clientLeft,d.y=p.y+t.clientTop}else i&&(d.x=mt(i));const c=i&&!o&&!r?qt(i,s):G(0),a=l.left+s.scrollLeft-d.x-c.x,u=l.top+s.scrollTop-d.y-c.y;return{x:a,y:u,width:l.width,height:l.height}}function Ye(e){return Y(e).position==="static"}function Pt(e,t){if(!J(e)||Y(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Z(e)===n&&(n=n.ownerDocument.body),n}function Jt(e,t){const n=V(e);if(ze(e))return n;if(!J(e)){let i=ce(e);for(;i&&!Ee(i);){if(U(i)&&!Ye(i))return i;i=ce(i)}return n}let o=Pt(e,t);for(;o&&Zn(o)&&Ye(o);)o=Pt(o,t);return o&&Ee(o)&&Ye(o)&&!ft(o)?n:o||Qn(e)||n}const fo=async function(e){const t=this.getOffsetParent||Jt,n=this.getDimensions,o=await n(e.floating);return{reference:co(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function po(e){return Y(e).direction==="rtl"}const vo={convertOffsetParentRelativeRectToViewportRelativeRect:no,getDocumentElement:Z,getClippingRect:ao,getOffsetParent:Jt,getElementRects:fo,getClientRects:oo,getDimensions:uo,getScale:Ae,isElement:U,isRTL:po};function Zt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mo(e,t){let n=null,o;const i=Z(e);function r(){var s;clearTimeout(o),(s=n)==null||s.disconnect(),n=null}function l(s,d){s===void 0&&(s=!1),d===void 0&&(d=1),r();const c=e.getBoundingClientRect(),{left:a,top:u,width:p,height:f}=c;if(s||t(),!p||!f)return;const v=Me(u),g=Me(i.clientWidth-(a+p)),h=Me(i.clientHeight-(u+f)),y=Me(a),w={rootMargin:-v+"px "+-g+"px "+-h+"px "+-y+"px",threshold:H(0,ae(1,d))||1};let C=!0;function x(S){const _=S[0].intersectionRatio;if(_!==d){if(!C)return l();_?l(!1,_):o=setTimeout(()=>{l(!1,1e-7)},1e3)}_===1&&!Zt(c,e.getBoundingClientRect())&&l(),C=!1}try{n=new IntersectionObserver(x,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,w)}n.observe(e)}return l(!0),r}function ho(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,c=vt(e),a=i||r?[...c?Be(c):[],...Be(t)]:[];a.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),r&&y.addEventListener("resize",n)});const u=c&&s?mo(c,n):null;let p=-1,f=null;l&&(f=new ResizeObserver(y=>{let[b]=y;b&&b.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),c&&!d&&f.observe(c),f.observe(t));let v,g=d?he(e):null;d&&h();function h(){const y=he(e);g&&!Zt(g,y)&&n(),g=y,v=requestAnimationFrame(h)}return n(),()=>{var y;a.forEach(b=>{i&&b.removeEventListener("scroll",n),r&&b.removeEventListener("resize",n)}),u==null||u(),(y=f)==null||y.disconnect(),f=null,d&&cancelAnimationFrame(v)}}const go=Xn,yo=qn,_t=Kn,wo=Jn,bo=Un,xo=zn,Oo=Gn,Co=(e,t,n)=>{const o=new Map,i={platform:vo,...n},r={...i.platform,_c:o};return jn(e,t,{...i,platform:r})};function Ao(e){return e!=null&&typeof e=="object"&&"$el"in e}function nt(e){if(Ao(e)){const t=e.$el;return dt(t)&&we(t)==="#comment"?null:t}return e}function Ce(e){return typeof e=="function"?e():m(e)}function Eo(e){return{name:"arrow",options:e,fn(t){const n=nt(Ce(e.element));return n==null?{}:xo({element:n,padding:e.padding}).fn(t)}}}function Qt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Bt(e,t){const n=Qt(e);return Math.round(t*n)/n}function Do(e,t,n){n===void 0&&(n={});const o=n.whileElementsMounted,i=O(()=>{var _;return(_=Ce(n.open))!=null?_:!0}),r=O(()=>Ce(n.middleware)),l=O(()=>{var _;return(_=Ce(n.placement))!=null?_:"bottom"}),s=O(()=>{var _;return(_=Ce(n.strategy))!=null?_:"absolute"}),d=O(()=>{var _;return(_=Ce(n.transform))!=null?_:!0}),c=O(()=>nt(e.value)),a=O(()=>nt(t.value)),u=E(0),p=E(0),f=E(s.value),v=E(l.value),g=Mt({}),h=E(!1),y=O(()=>{const _={position:f.value,left:"0",top:"0"};if(!a.value)return _;const M=Bt(a.value,u.value),N=Bt(a.value,p.value);return d.value?{..._,transform:"translate("+M+"px, "+N+"px)",...Qt(a.value)>=1.5&&{willChange:"transform"}}:{position:f.value,left:M+"px",top:N+"px"}});let b;function w(){if(c.value==null||a.value==null)return;const _=i.value;Co(c.value,a.value,{middleware:r.value,placement:l.value,strategy:s.value}).then(M=>{u.value=M.x,p.value=M.y,f.value=M.strategy,v.value=M.placement,g.value=M.middlewareData,h.value=_!==!1})}function C(){typeof b=="function"&&(b(),b=void 0)}function x(){if(C(),o===void 0){w();return}if(c.value!=null&&a.value!=null){b=o(c.value,a.value,w);return}}function S(){i.value||(h.value=!1)}return j([r,l,s,i],w,{flush:"sync"}),j([c,a],x,{flush:"sync"}),j(i,S,{flush:"sync"}),Lt()&&Ft(C),{x:xe(u),y:xe(p),strategy:xe(f),placement:xe(v),middlewareData:xe(g),isPositioned:xe(h),floatingStyles:y,update:w}}function be(e,t){const n=typeof e=="string"&&!t?`${e}Context`:t,o=Symbol(n);return[i=>{const r=bn(o,i);if(r||r===null)return r;throw new Error(`Injection \`${o.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(", ")}`:`\`${e}\``}`)},i=>(Mn(o,i),i)]}function en(e,t,n){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),o.dispatchEvent(i)}function Po(e,t){var n;const o=Mt();return K(()=>{o.value=e()},{...t,flush:(n=void 0)!=null?n:"sync"}),Ht(o)}function Re(e){return Lt()?(Ft(e),!0):!1}function _o(){const e=new Set,t=n=>{e.delete(n)};return{on:n=>{e.add(n);const o=()=>t(n);return Re(o),{off:o}},off:t,trigger:(...n)=>Promise.all(Array.from(e).map(o=>o(...n)))}}function Bo(e){let t=!1,n;const o=jt(!0);return(...i)=>(t||(n=o.run(()=>e(...i)),t=!0),n)}function To(e){let t=0,n,o;const i=()=>{t-=1,o&&t<=0&&(o.stop(),n=void 0,o=void 0)};return(...r)=>(t+=1,n||(o=jt(!0),n=o.run(()=>e(...r))),Re(i),n)}function ve(e){return typeof e=="function"?e():m(e)}const pe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ro=e=>typeof e<"u",$o=Object.prototype.toString,So=e=>$o.call(e)==="[object Object]",Mo=()=>{},Tt=Lo();function Lo(){var e,t;return pe&&((e=window==null?void 0:window.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window==null?void 0:window.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function Fo(e){return ye()}function No(e,t=1e4){return Sn((n,o)=>{let i=ve(e),r;const l=()=>setTimeout(()=>{i=ve(e),o()},ve(t));return Re(()=>{clearTimeout(r)}),{get(){return n(),i},set(s){i=s,o(),clearTimeout(r),r=l()}}})}function ko(e,t){Fo()&&Bn(e,t)}function tn(e,t,n={}){const{immediate:o=!0}=n,i=E(!1);let r=null;function l(){r&&(clearTimeout(r),r=null)}function s(){i.value=!1,l()}function d(...c){l(),i.value=!0,r=setTimeout(()=>{i.value=!1,r=null,e(...c)},ve(t))}return o&&(i.value=!0,pe&&d()),Re(s),{isPending:Ht(i),start:d,stop:s}}function $e(e){var t;const n=ve(e);return(t=n==null?void 0:n.$el)!=null?t:n}const ht=pe?window:void 0;function Ve(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=ht):[t,n,o,i]=e,!t)return Mo;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],l=()=>{r.forEach(a=>a()),r.length=0},s=(a,u,p,f)=>(a.addEventListener(u,p,f),()=>a.removeEventListener(u,p,f)),d=j(()=>[$e(t),ve(i)],([a,u])=>{if(l(),!a)return;const p=So(u)?{...u}:u;r.push(...n.flatMap(f=>o.map(v=>s(a,f,v,p))))},{immediate:!0,flush:"post"}),c=()=>{d(),l()};return Re(c),c}function Io(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Wo(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:i=ht,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=o,d=Io(t);return Ve(i,r,c=>{c.repeat&&ve(s)||d(c)&&n(c)},l)}function Ho(){const e=E(!1),t=ye();return t&&De(()=>{e.value=!0},t),e}function Vo(e){return JSON.parse(JSON.stringify(e))}function nn(e,t,n,o={}){var i,r,l;const{clone:s=!1,passive:d=!1,eventName:c,deep:a=!1,defaultValue:u,shouldEmit:p}=o,f=ye(),v=n||(f==null?void 0:f.emit)||((i=f==null?void 0:f.$emit)==null?void 0:i.bind(f))||((l=(r=f==null?void 0:f.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(f==null?void 0:f.proxy));let g=c;g=g||`update:${t.toString()}`;const h=w=>s?typeof s=="function"?s(w):Vo(w):w,y=()=>Ro(e[t])?h(e[t]):u,b=w=>{p?p(w)&&v(g,w):v(g,w)};if(d){const w=y(),C=E(w);let x=!1;return j(()=>e[t],S=>{x||(x=!0,C.value=h(S),ge(()=>x=!1))}),j(C,S=>{!x&&(S!==e[t]||a)&&b(S)},{deep:a}),C}else return O({get(){return y()},set(w){b(w)}})}function gt(e){return e?e.flatMap(t=>t.type===An?gt(t.children):[t]):[]}function se(){let e=document.activeElement;if(e==null)return null;for(;e!=null&&e.shadowRoot!=null&&e.shadowRoot.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function Xe(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function ot(e,t,n=".",o){if(!Xe(t))return ot(e,{},n);const i=Object.assign({},t);for(const r in e){if(r==="__proto__"||r==="constructor")continue;const l=e[r];l!=null&&(Array.isArray(l)&&Array.isArray(i[r])?i[r]=[...l,...i[r]]:Xe(l)&&Xe(i[r])?i[r]=ot(l,i[r],(n?`${n}.`:"")+r.toString()):i[r]=l)}return i}function jo(e){return(...t)=>t.reduce((n,o)=>ot(n,o,""),{})}const zo=jo(),[on,nr]=be("ConfigProvider");let Ko="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Uo=(e=21)=>{let t="",n=e;for(;n--;)t+=Ko[Math.random()*64|0];return t};const Yo=To(()=>{const e=E(new Map),t=E(),n=O(()=>{for(const l of e.value.values())if(l)return!0;return!1}),o=on({scrollBody:E(!0)});let i=null;const r=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.body.style.removeProperty("--scrollbar-width"),document.body.style.overflow=t.value??"",Tt&&(i==null||i()),t.value=void 0};return j(n,(l,s)=>{var d;if(!pe)return;if(!l){s&&r();return}t.value===void 0&&(t.value=document.body.style.overflow);const c=window.innerWidth-document.documentElement.clientWidth,a={padding:c,margin:0},u=(d=o.scrollBody)!=null&&d.value?typeof o.scrollBody.value=="object"?zo({padding:o.scrollBody.value.padding===!0?c:o.scrollBody.value.padding,margin:o.scrollBody.value.margin===!0?c:o.scrollBody.value.margin},a):a:{padding:0,margin:0};c>0&&(document.body.style.paddingRight=typeof u.padding=="number"?`${u.padding}px`:String(u.padding),document.body.style.marginRight=typeof u.margin=="number"?`${u.margin}px`:String(u.margin),document.body.style.setProperty("--scrollbar-width",`${c}px`),document.body.style.overflow="hidden"),Tt&&(i=Ve(document,"touchmove",p=>qo(p),{passive:!1})),ge(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),e});function Xo(e){const t=Uo(6),n=Yo();n.value.set(t,e);const o=O({get:()=>n.value.get(t)??!1,set:i=>n.value.set(t,i)});return ko(()=>{n.value.delete(t)}),o}function rn(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth1?!0:(t.preventDefault&&t.cancelable&&t.preventDefault(),!1)}function Se(e){const t=ye(),n=t==null?void 0:t.type.emits,o={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${t==null?void 0:t.type.__name}`),n==null||n.forEach(i=>{o[wn(kt(i))]=(...r)=>e(i,...r)}),o}function ln(e){const t=ye(),n=Object.keys((t==null?void 0:t.type.props)??{}).reduce((i,r)=>{const l=(t==null?void 0:t.type.props[r]).default;return l!==void 0&&(i[r]=l),i},{}),o=Cn(e);return O(()=>{const i={},r=(t==null?void 0:t.vnode.props)??{};return Object.keys(r).forEach(l=>{i[kt(l)]=r[l]}),Object.keys({...n,...i}).reduce((l,s)=>(o.value[s]!==void 0&&(l[s]=o.value[s]),l),{})})}function sn(e,t){const n=ln(e),o=t?Se(t):{};return O(()=>({...n.value,...o}))}function $(){const e=ye(),t=E(),n=O(()=>{var l,s;return["#text","#comment"].includes((l=t.value)==null?void 0:l.$el.nodeName)?(s=t.value)==null?void 0:s.$el.nextElementSibling:$e(t)}),o=Object.assign({},e.exposed),i={};for(const l in e.props)Object.defineProperty(i,l,{enumerable:!0,configurable:!0,get:()=>e.props[l]});if(Object.keys(o).length>0)for(const l in o)Object.defineProperty(i,l,{enumerable:!0,configurable:!0,get:()=>o[l]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=i;function r(l){t.value=l,l&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>l instanceof Element?l:l.$el}),e.exposed=i)}return{forwardRef:r,currentRef:t,currentElement:n}}function Go(e,t){const n=No(!1,300),o=E(null),i=_o();function r(){o.value=null,n.value=!1}function l(s,d){const c=s.currentTarget,a={x:s.clientX,y:s.clientY},u=Jo(a,c.getBoundingClientRect()),p=Zo(a,u),f=Qo(d.getBoundingClientRect()),v=ti([...p,...f]);o.value=v,n.value=!0}return K(s=>{if(e.value&&t.value){const d=a=>l(a,t.value),c=a=>l(a,e.value);e.value.addEventListener("pointerleave",d),t.value.addEventListener("pointerleave",c),s(()=>{var a,u;(a=e.value)==null||a.removeEventListener("pointerleave",d),(u=t.value)==null||u.removeEventListener("pointerleave",c)})}}),K(s=>{var d;if(o.value){const c=a=>{var u,p;if(!o.value)return;const f=a.target,v={x:a.clientX,y:a.clientY},g=((u=e.value)==null?void 0:u.contains(f))||((p=t.value)==null?void 0:p.contains(f)),h=!ei(v,o.value),y=!!f.closest("[data-grace-area-trigger]");g?r():(h||y)&&(r(),i.trigger())};(d=e.value)==null||d.ownerDocument.addEventListener("pointermove",c),s(()=>{var a;return(a=e.value)==null?void 0:a.ownerDocument.removeEventListener("pointermove",c)})}}),{isPointerInTransit:n,onPointerExit:i.on}}function Jo(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),r=Math.abs(t.left-e.x);switch(Math.min(n,o,i,r)){case r:return"left";case i:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Zo(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function Qo(e){const{top:t,right:n,bottom:o,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:o},{x:i,y:o}]}function ei(e,t){const{x:n,y:o}=e;let i=!1;for(let r=0,l=t.length-1;ro!=a>o&&n<(c-s)*(o-d)/(a-d)+s&&(i=!i)}return i}function ti(e){const t=e.slice();return t.sort((n,o)=>n.xo.x?1:n.yo.y?1:0),ni(t)}function ni(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o=2;){const r=t[t.length-1],l=t[t.length-2];if((r.x-l.x)*(i.y-l.y)>=(r.y-l.y)*(i.x-l.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const i=e[o];for(;n.length>=2;){const r=n[n.length-1],l=n[n.length-2];if((r.x-l.x)*(i.y-l.y)>=(r.y-l.y)*(i.x-l.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var oi=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Oe=new WeakMap,Le=new WeakMap,Fe={},qe=0,an=function(e){return e&&(e.host||an(e.parentNode))},ii=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=an(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},ri=function(e,t,n,o){var i=ii(t,Array.isArray(e)?e:[e]);Fe[n]||(Fe[n]=new WeakMap);var r=Fe[n],l=[],s=new Set,d=new Set(i),c=function(u){!u||s.has(u)||(s.add(u),c(u.parentNode))};i.forEach(c);var a=function(u){!u||d.has(u)||Array.prototype.forEach.call(u.children,function(p){if(s.has(p))a(p);else try{var f=p.getAttribute(o),v=f!==null&&f!=="false",g=(Oe.get(p)||0)+1,h=(r.get(p)||0)+1;Oe.set(p,g),r.set(p,h),l.push(p),g===1&&v&&Le.set(p,!0),h===1&&p.setAttribute(n,"true"),v||p.setAttribute(o,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return a(t),s.clear(),qe++,function(){l.forEach(function(u){var p=Oe.get(u)-1,f=r.get(u)-1;Oe.set(u,p),r.set(u,f),p||(Le.has(u)||u.removeAttribute(o),Le.delete(u)),f||u.removeAttribute(n)}),qe--,qe||(Oe=new WeakMap,Oe=new WeakMap,Le=new WeakMap,Fe={})}},li=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),i=oi(e);return i?(o.push.apply(o,Array.from(i.querySelectorAll("[aria-live]"))),ri(o,i,n,"aria-hidden")):function(){return null}};function si(e){let t;j(()=>$e(e),n=>{n?t=li(n):t&&t()}),It(()=>{t&&t()})}let ai=0;function it(e,t="radix"){const n=on({useId:void 0});return xt?`${t}-${xt()}`:n.useId?`${t}-${n.useId()}`:`${t}-${++ai}`}function ui(e){const t=E(),n=O(()=>{var i;return((i=t.value)==null?void 0:i.width)??0}),o=O(()=>{var i;return((i=t.value)==null?void 0:i.height)??0});return De(()=>{const i=$e(e);if(i){t.value={width:i.offsetWidth,height:i.offsetHeight};const r=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const s=l[0];let d,c;if("borderBoxSize"in s){const a=s.borderBoxSize,u=Array.isArray(a)?a[0]:a;d=u.inlineSize,c=u.blockSize}else d=i.offsetWidth,c=i.offsetHeight;t.value={width:d,height:c}});return r.observe(i,{box:"border-box"}),()=>r.unobserve(i)}else t.value=void 0}),{width:n,height:o}}function ci(e,t){const n=E(e);function o(i){return t[n.value][i]??n.value}return{state:n,dispatch:i=>{n.value=o(i)}}}const di=D({name:"PrimitiveSlot",inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{var o,i;if(!n.default)return null;const r=gt(n.default()),l=r.findIndex(a=>a.type!==Wt);if(l===-1)return r;const s=r[l];(o=s.props)==null||delete o.ref;const d=s.props?F(t,s.props):t;t.class&&(i=s.props)!=null&&i.class&&delete s.props.class;const c=En(s,d);for(const a in d)a.startsWith("on")&&(c.props||(c.props={}),c.props[a]=d[a]);return r.length===1?c:(r[l]=c,r)}}}),X=D({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(e,{attrs:t,slots:n}){const o=e.asChild?"template":e.as;return typeof o=="string"&&["area","img","input"].includes(o)?()=>ke(o,t):o!=="template"?()=>ke(e.as,t,{default:n.default}):()=>ke(di,t,{default:n.default})}});function fi(e,t){var n;const o=E({}),i=E("none"),r=E(e),l=e.value?"mounted":"unmounted";let s;const d=((n=t.value)==null?void 0:n.ownerDocument.defaultView)??ht,{state:c,dispatch:a}=ci(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),u=h=>{var y;if(pe){const b=new CustomEvent(h,{bubbles:!1,cancelable:!1});(y=t.value)==null||y.dispatchEvent(b)}};j(e,async(h,y)=>{var b;const w=y!==h;if(await ge(),w){const C=i.value,x=Ne(t.value);h?(a("MOUNT"),u("enter"),x==="none"&&u("after-enter")):x==="none"||((b=o.value)==null?void 0:b.display)==="none"?(a("UNMOUNT"),u("leave"),u("after-leave")):y&&C!==x?(a("ANIMATION_OUT"),u("leave")):(a("UNMOUNT"),u("after-leave"))}},{immediate:!0});const p=h=>{const y=Ne(t.value),b=y.includes(h.animationName),w=c.value==="mounted"?"enter":"leave";if(h.target===t.value&&b&&(u(`after-${w}`),a("ANIMATION_END"),!r.value)){const C=t.value.style.animationFillMode;t.value.style.animationFillMode="forwards",s=d==null?void 0:d.setTimeout(()=>{var x;((x=t.value)==null?void 0:x.style.animationFillMode)==="forwards"&&(t.value.style.animationFillMode=C)})}h.target===t.value&&y==="none"&&a("ANIMATION_END")},f=h=>{h.target===t.value&&(i.value=Ne(t.value))},v=j(t,(h,y)=>{h?(o.value=getComputedStyle(h),h.addEventListener("animationstart",f),h.addEventListener("animationcancel",p),h.addEventListener("animationend",p)):(a("ANIMATION_END"),s!==void 0&&(d==null||d.clearTimeout(s)),y==null||y.removeEventListener("animationstart",f),y==null||y.removeEventListener("animationcancel",p),y==null||y.removeEventListener("animationend",p))},{immediate:!0}),g=j(c,()=>{const h=Ne(t.value);i.value=c.value==="mounted"?h:"none"});return It(()=>{v(),g()}),{isPresent:O(()=>["mounted","unmountSuspended"].includes(c.value))}}function Ne(e){return e&&getComputedStyle(e).animationName||"none"}const yt=D({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:t,expose:n}){var o;const{present:i,forceMount:r}=lt(e),l=E(),{isPresent:s}=fi(i,l);n({present:s});let d=t.default({present:s});d=gt(d||[]);const c=ye();if(d&&(d==null?void 0:d.length)>1){const a=(o=c==null?void 0:c.parent)!=null&&o.type.name?`<${c.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${a}\` 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(u=>` - ${u}`).join(` `)].join(` `))}return()=>r.value||i.value||s.value?ke(t.default({present:s})[0],{ref:a=>{const u=$e(a);return typeof(u==null?void 0:u.hasAttribute)>"u"||(u!=null&&u.hasAttribute("data-radix-popper-content-wrapper")?l.value=u.firstElementChild:l.value=u),u}}):null}}),[ne,pi]=be("DialogRoot"),vi=D({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(e,{emit:t}){const n=e,o=nn(n,"open",t,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=E(),r=E(),{modal:l}=lt(n);return pi({open:o,modal:l,openModal:()=>{o.value=!0},onOpenChange:s=>{o.value=s},onOpenToggle:()=>{o.value=!o.value},contentId:"",titleId:"",descriptionId:"",triggerElement:i,contentElement:r}),(s,d)=>P(s.$slots,"default",{open:m(o)})}}),wt=D({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=Ho();return(n,o)=>m(t)||n.forceMount?(B(),T(yn,{key:0,to:n.to,disabled:n.disabled},[P(n.$slots,"default")],8,["to","disabled"])):Nt("",!0)}}),or=D({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=e;return(n,o)=>(B(),T(m(wt),de(fe(t)),{default:A(()=>[P(n.$slots,"default")]),_:3},16))}}),mi="dismissableLayer.pointerDownOutside",hi="dismissableLayer.focusOutside";function un(e,t){const n=t.closest("[data-dismissable-layer]"),o=e.dataset.dismissableLayer===""?e:e.querySelector("[data-dismissable-layer]"),i=Array.from(e.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(n&&o===n||i.indexOf(o){});return K(l=>{if(!pe)return;const s=async c=>{const a=c.target;if(t!=null&&t.value){if(un(t.value,a)){i.value=!1;return}if(c.target&&!i.value){let u=function(){en(mi,e,p)};const p={originalEvent:c};c.pointerType==="touch"?(o.removeEventListener("click",r.value),r.value=u,o.addEventListener("click",r.value,{once:!0})):u()}else o.removeEventListener("click",r.value);i.value=!1}},d=window.setTimeout(()=>{o.addEventListener("pointerdown",s)},0);l(()=>{window.clearTimeout(d),o.removeEventListener("pointerdown",s),o.removeEventListener("click",r.value)})}),{onPointerDownCapture:()=>i.value=!0}}function yi(e,t){var n;const o=((n=t==null?void 0:t.value)==null?void 0:n.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=E(!1);return K(r=>{if(!pe)return;const l=async s=>{t!=null&&t.value&&(await ge(),!(!t.value||un(t.value,s.target))&&s.target&&!i.value&&en(hi,e,{originalEvent:s}))};o.addEventListener("focusin",l),r(()=>o.removeEventListener("focusin",l))}),{onFocusCapture:()=>i.value=!0,onBlurCapture:()=>i.value=!1}}const Q=zt({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),cn=D({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(e,{emit:t}){const n=e,o=t,{forwardRef:i,currentElement:r}=$(),l=O(()=>{var v;return((v=r.value)==null?void 0:v.ownerDocument)??globalThis.document}),s=O(()=>Q.layersRoot),d=O(()=>r.value?Array.from(s.value).indexOf(r.value):-1),c=O(()=>Q.layersWithOutsidePointerEventsDisabled.size>0),a=O(()=>{const v=Array.from(s.value),[g]=[...Q.layersWithOutsidePointerEventsDisabled].slice(-1),h=v.indexOf(g);return d.value>=h}),u=gi(async v=>{const g=[...Q.branches].some(h=>h==null?void 0:h.contains(v.target));!a.value||g||(o("pointerDownOutside",v),o("interactOutside",v),await ge(),v.defaultPrevented||o("dismiss"))},r),p=yi(v=>{[...Q.branches].some(g=>g==null?void 0:g.contains(v.target))||(o("focusOutside",v),o("interactOutside",v),v.defaultPrevented||o("dismiss"))},r);Wo("Escape",v=>{d.value===s.value.size-1&&(o("escapeKeyDown",v),v.defaultPrevented||o("dismiss"))});let f;return K(v=>{r.value&&(n.disableOutsidePointerEvents&&(Q.layersWithOutsidePointerEventsDisabled.size===0&&(f=l.value.body.style.pointerEvents,l.value.body.style.pointerEvents="none"),Q.layersWithOutsidePointerEventsDisabled.add(r.value)),s.value.add(r.value),v(()=>{n.disableOutsidePointerEvents&&Q.layersWithOutsidePointerEventsDisabled.size===1&&(l.value.body.style.pointerEvents=f)}))}),K(v=>{v(()=>{r.value&&(s.value.delete(r.value),Q.layersWithOutsidePointerEventsDisabled.delete(r.value))})}),(v,g)=>(B(),T(m(X),{ref:m(i),"as-child":v.asChild,as:v.as,"data-dismissable-layer":"",style:st({pointerEvents:c.value?a.value?"auto":"none":void 0}),onFocusCapture:m(p).onFocusCapture,onBlurCapture:m(p).onBlurCapture,onPointerdownCapture:m(u).onPointerDownCapture},{default:A(()=>[P(v.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),Ge="focusScope.autoFocusOnMount",Je="focusScope.autoFocusOnUnmount",Rt={bubbles:!1,cancelable:!0};function wi(e,{select:t=!1}={}){const n=se();for(const o of e)if(le(o,{select:t}),se()!==n)return!0}function bi(e){const t=dn(e),n=$t(t,e),o=$t(t.reverse(),e);return[n,o]}function dn(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $t(e,t){for(const n of e)if(!xi(n,{upTo:t}))return n}function xi(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Oi(e){return e instanceof HTMLInputElement&&"select"in e}function le(e,{select:t=!1}={}){if(e&&e.focus){const n=se();e.focus({preventScroll:!0}),e!==n&&Oi(e)&&t&&e.select()}}const Ci=Bo(()=>E([]));function Ai(){const e=Ci();return{add(t){const n=e.value[0];t!==n&&(n==null||n.pause()),e.value=St(e.value,t),e.value.unshift(t)},remove(t){var n;e.value=St(e.value,t),(n=e.value[0])==null||n.resume()}}}function St(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function Ei(e){return e.filter(t=>t.tagName!=="A")}const Di=D({__name:"FocusScope",props:{loop:{type:Boolean,default:!1},trapped:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["mountAutoFocus","unmountAutoFocus"],setup(e,{emit:t}){const n=e,o=t,{currentRef:i,currentElement:r}=$(),l=E(null),s=Ai(),d=zt({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});K(a=>{if(!pe)return;const u=r.value;if(!n.trapped)return;function p(h){if(d.paused||!u)return;const y=h.target;u.contains(y)?l.value=y:le(l.value,{select:!0})}function f(h){if(d.paused||!u)return;const y=h.relatedTarget;y!==null&&(u.contains(y)||le(l.value,{select:!0}))}function v(h){u.contains(l.value)||le(u)}document.addEventListener("focusin",p),document.addEventListener("focusout",f);const g=new MutationObserver(v);u&&g.observe(u,{childList:!0,subtree:!0}),a(()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",f),g.disconnect()})}),K(async a=>{const u=r.value;if(await ge(),!u)return;s.add(d);const p=se();if(!u.contains(p)){const f=new CustomEvent(Ge,Rt);u.addEventListener(Ge,v=>o("mountAutoFocus",v)),u.dispatchEvent(f),f.defaultPrevented||(wi(Ei(dn(u)),{select:!0}),se()===p&&le(u))}a(()=>{u.removeEventListener(Ge,g=>o("mountAutoFocus",g));const f=new CustomEvent(Je,Rt),v=g=>{o("unmountAutoFocus",g)};u.addEventListener(Je,v),u.dispatchEvent(f),setTimeout(()=>{f.defaultPrevented||le(p??document.body,{select:!0}),u.removeEventListener(Je,v),s.remove(d)},0)})});function c(a){if(!n.loop&&!n.trapped||d.paused)return;const u=a.key==="Tab"&&!a.altKey&&!a.ctrlKey&&!a.metaKey,p=se();if(u&&p){const f=a.currentTarget,[v,g]=bi(f);v&&g?!a.shiftKey&&p===g?(a.preventDefault(),n.loop&&le(v,{select:!0})):a.shiftKey&&p===v&&(a.preventDefault(),n.loop&&le(g,{select:!0})):p===f&&a.preventDefault()}}return(a,u)=>(B(),T(m(X),{ref_key:"currentRef",ref:i,tabindex:"-1","as-child":a.asChild,as:a.as,onKeydown:c},{default:A(()=>[P(a.$slots,"default")]),_:3},8,["as-child","as"]))}});function Pi(e){return e?"open":"closed"}const fn=D({__name:"DialogContentImpl",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,o=t,i=ne(),{forwardRef:r,currentElement:l}=$();return i.titleId||(i.titleId=it(void 0,"radix-vue-dialog-title")),i.descriptionId||(i.descriptionId=it(void 0,"radix-vue-dialog-description")),De(()=>{i.contentElement=l,se()!==document.body&&(i.triggerElement.value=se())}),(s,d)=>(B(),T(m(Di),{"as-child":"",loop:"",trapped:n.trapFocus,onMountAutoFocus:d[5]||(d[5]=c=>o("openAutoFocus",c)),onUnmountAutoFocus:d[6]||(d[6]=c=>o("closeAutoFocus",c))},{default:A(()=>[me(m(cn),F({id:m(i).contentId,ref:m(r),as:s.as,"as-child":s.asChild,"disable-outside-pointer-events":s.disableOutsidePointerEvents,role:"dialog","aria-describedby":m(i).descriptionId,"aria-labelledby":m(i).titleId,"data-state":m(Pi)(m(i).open.value)},s.$attrs,{onDismiss:d[0]||(d[0]=c=>m(i).onOpenChange(!1)),onEscapeKeyDown:d[1]||(d[1]=c=>o("escapeKeyDown",c)),onFocusOutside:d[2]||(d[2]=c=>o("focusOutside",c)),onInteractOutside:d[3]||(d[3]=c=>o("interactOutside",c)),onPointerDownOutside:d[4]||(d[4]=c=>o("pointerDownOutside",c))}),{default:A(()=>[P(s.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),_i=D({__name:"DialogContentModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,o=t,i=ne(),r=Se(o),{forwardRef:l,currentElement:s}=$();return si(s),(d,c)=>(B(),T(fn,F({...n,...m(r)},{ref:m(l),"trap-focus":m(i).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:c[0]||(c[0]=a=>{var u;a.defaultPrevented||(a.preventDefault(),(u=m(i).triggerElement.value)==null||u.focus())}),onPointerDownOutside:c[1]||(c[1]=a=>{const u=a.detail.originalEvent,p=u.button===0&&u.ctrlKey===!0;(u.button===2||p)&&a.preventDefault()}),onFocusOutside:c[2]||(c[2]=a=>{a.preventDefault()})}),{default:A(()=>[P(d.$slots,"default")]),_:3},16,["trap-focus"]))}}),Bi=D({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,o=Se(t);$();const i=ne(),r=E(!1),l=E(!1);return(s,d)=>(B(),T(fn,F({...n,...m(o)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:d[0]||(d[0]=c=>{var a;c.defaultPrevented||(r.value||(a=m(i).triggerElement.value)==null||a.focus(),c.preventDefault()),r.value=!1,l.value=!1}),onInteractOutside:d[1]||(d[1]=c=>{var a;c.defaultPrevented||(r.value=!0,c.detail.originalEvent.type==="pointerdown"&&(l.value=!0));const u=c.target;(a=m(i).triggerElement.value)!=null&&a.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&l.value&&c.preventDefault()})}),{default:A(()=>[P(s.$slots,"default")]),_:3},16))}}),Ti=D({__name:"DialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,o=t,i=ne(),r=Se(o),{forwardRef:l}=$();return(s,d)=>(B(),T(m(yt),{present:s.forceMount||m(i).open.value},{default:A(()=>[m(i).modal.value?(B(),T(_i,F({key:0,ref:m(l)},{...n,...m(r),...s.$attrs}),{default:A(()=>[P(s.$slots,"default")]),_:3},16)):(B(),T(Bi,F({key:1,ref:m(l)},{...n,...m(r),...s.$attrs}),{default:A(()=>[P(s.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),Ri=D({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean},as:{}},setup(e){const t=ne();return Xo(!0),$(),(n,o)=>(B(),T(m(X),{as:n.as,"as-child":n.asChild,"data-state":m(t).open.value?"open":"closed",style:{"pointer-events":"auto"}},{default:A(()=>[P(n.$slots,"default")]),_:3},8,["as","as-child","data-state"]))}}),$i=D({__name:"DialogOverlay",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(e){const t=ne(),{forwardRef:n}=$();return(o,i)=>{var r;return(r=m(t))!=null&&r.modal.value?(B(),T(m(yt),{key:0,present:o.forceMount||m(t).open.value},{default:A(()=>[me(Ri,F(o.$attrs,{ref:m(n),as:o.as,"as-child":o.asChild}),{default:A(()=>[P(o.$slots,"default")]),_:3},16,["as","as-child"])]),_:3},8,["present"])):Nt("",!0)}}}),pn=D({__name:"DialogClose",props:{asChild:{type:Boolean},as:{default:"button"}},setup(e){const t=e;$();const n=ne();return(o,i)=>(B(),T(m(X),F(t,{type:o.as==="button"?"button":void 0,onClick:i[0]||(i[0]=r=>m(n).onOpenChange(!1))}),{default:A(()=>[P(o.$slots,"default")]),_:3},16,["type"]))}}),Si=D({__name:"DialogTitle",props:{asChild:{type:Boolean},as:{default:"h2"}},setup(e){const t=e,n=ne();return $(),(o,i)=>(B(),T(m(X),F(t,{id:m(n).titleId}),{default:A(()=>[P(o.$slots,"default")]),_:3},16,["id"]))}}),Mi=D({__name:"DialogDescription",props:{asChild:{type:Boolean},as:{default:"p"}},setup(e){const t=e;$();const n=ne();return(o,i)=>(B(),T(m(X),F(t,{id:m(n).descriptionId}),{default:A(()=>[P(o.$slots,"default")]),_:3},16,["id"]))}}),ir=D({__name:"AlertDialogRoot",props:{open:{type:Boolean},defaultOpen:{type:Boolean}},emits:["update:open"],setup(e,{emit:t}){const n=sn(e,t);return $(),(o,i)=>(B(),T(m(vi),F(m(n),{modal:!0}),{default:A(()=>[P(o.$slots,"default")]),_:3},16))}}),rr=D({__name:"AlertDialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=e;return(n,o)=>(B(),T(m(wt),de(fe(t)),{default:A(()=>[P(n.$slots,"default")]),_:3},16))}}),[Li,Fi]=be("AlertDialogContent"),lr=D({__name:"AlertDialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(e,{emit:t}){const n=e,o=Se(t);$();const i=E();return Fi({onCancelElementChange:r=>{i.value=r}}),(r,l)=>(B(),T(m(Ti),F({...n,...m(o)},{role:"alertdialog",onPointerDownOutside:l[0]||(l[0]=Ze(()=>{},["prevent"])),onInteractOutside:l[1]||(l[1]=Ze(()=>{},["prevent"])),onOpenAutoFocus:l[2]||(l[2]=()=>{ge(()=>{var s;(s=i.value)==null||s.focus({preventScroll:!0})})})}),{default:A(()=>[P(r.$slots,"default")]),_:3},16))}}),sr=D({__name:"AlertDialogOverlay",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(e){const t=e;return $(),(n,o)=>(B(),T(m($i),de(fe(t)),{default:A(()=>[P(n.$slots,"default")]),_:3},16))}}),ar=D({__name:"AlertDialogCancel",props:{asChild:{type:Boolean},as:{default:"button"}},setup(e){const t=e,n=Li(),{forwardRef:o,currentElement:i}=$();return De(()=>{n.onCancelElementChange(i.value)}),(r,l)=>(B(),T(m(pn),F(t,{ref:m(o)}),{default:A(()=>[P(r.$slots,"default")]),_:3},16))}}),ur=D({__name:"AlertDialogTitle",props:{asChild:{type:Boolean},as:{default:"h2"}},setup(e){const t=e;return $(),(n,o)=>(B(),T(m(Si),de(fe(t)),{default:A(()=>[P(n.$slots,"default")]),_:3},16))}}),cr=D({__name:"AlertDialogDescription",props:{asChild:{type:Boolean},as:{default:"p"}},setup(e){const t=e;return $(),(n,o)=>(B(),T(m(Mi),de(fe(t)),{default:A(()=>[P(n.$slots,"default")]),_:3},16))}}),dr=D({__name:"AlertDialogAction",props:{asChild:{type:Boolean},as:{default:"button"}},setup(e){const t=e;return $(),(n,o)=>(B(),T(m(pn),de(fe(t)),{default:A(()=>[P(n.$slots,"default")]),_:3},16))}}),[vn,Ni]=be("PopperRoot"),ki=D({inheritAttrs:!1,__name:"PopperRoot",setup(e){const t=E();return Ni({anchor:t,onAnchorChange:n=>t.value=n}),(n,o)=>P(n.$slots,"default")}}),Ii=D({__name:"PopperAnchor",props:{element:{},asChild:{type:Boolean},as:{}},setup(e){const t=e,{forwardRef:n,currentElement:o}=$(),i=vn();return K(()=>{i.onAnchorChange(t.element??o.value)}),(r,l)=>(B(),T(m(X),{ref:m(n),as:r.as,"as-child":r.asChild},{default:A(()=>[P(r.$slots,"default")]),_:3},8,["as","as-child"]))}});function Wi(e){return e!==null}function Hi(e){return{name:"transformOrigin",options:e,fn(t){var n,o,i;const{placement:r,rects:l,middlewareData:s}=t,d=((n=s.arrow)==null?void 0:n.centerOffset)!==0,c=d?0:e.arrowWidth,a=d?0:e.arrowHeight,[u,p]=rt(r),f={start:"0%",center:"50%",end:"100%"}[p],v=(((o=s.arrow)==null?void 0:o.x)??0)+c/2,g=(((i=s.arrow)==null?void 0:i.y)??0)+a/2;let h="",y="";return u==="bottom"?(h=d?f:`${v}px`,y=`${-a}px`):u==="top"?(h=d?f:`${v}px`,y=`${l.floating.height+a}px`):u==="right"?(h=`${-a}px`,y=d?f:`${g}px`):u==="left"&&(h=`${l.floating.width+a}px`,y=d?f:`${g}px`),{data:{x:h,y}}}}}function rt(e){const[t,n="center"]=e.split("-");return[t,n]}const Vi={side:"bottom",sideOffset:0,align:"center",alignOffset:0,arrowPadding:0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:"partial",hideWhenDetached:!1,updatePositionStrategy:"optimized",prioritizePosition:!1},[ji,zi]=be("PopperContent"),Ki=D({inheritAttrs:!1,__name:"PopperContent",props:Tn({side:{},sideOffset:{},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},updatePositionStrategy:{},prioritizePosition:{type:Boolean},asChild:{type:Boolean},as:{}},{...Vi}),emits:["placed"],setup(e,{emit:t}){const n=e,o=t,i=vn(),{forwardRef:r,currentElement:l}=$(),s=E(),d=E(),{width:c,height:a}=ui(d),u=O(()=>n.side+(n.align!=="center"?`-${n.align}`:"")),p=O(()=>typeof n.collisionPadding=="number"?n.collisionPadding:{top:0,right:0,bottom:0,left:0,...n.collisionPadding}),f=O(()=>Array.isArray(n.collisionBoundary)?n.collisionBoundary:[n.collisionBoundary]),v=O(()=>({padding:p.value,boundary:f.value.filter(Wi),altBoundary:f.value.length>0})),g=Po(()=>[go({mainAxis:n.sideOffset+a.value,alignmentAxis:n.alignOffset}),n.prioritizePosition&&n.avoidCollisions&&_t({...v.value}),n.avoidCollisions&&yo({mainAxis:!0,crossAxis:!!n.prioritizePosition,limiter:n.sticky==="partial"?Oo():void 0,...v.value}),!n.prioritizePosition&&n.avoidCollisions&&_t({...v.value}),wo({...v.value,apply:({elements:R,rects:z,availableWidth:k,availableHeight:W})=>{const{width:L,height:oe}=z.reference,I=R.floating.style;I.setProperty("--radix-popper-available-width",`${k}px`),I.setProperty("--radix-popper-available-height",`${W}px`),I.setProperty("--radix-popper-anchor-width",`${L}px`),I.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),d.value&&Eo({element:d.value,padding:n.arrowPadding}),Hi({arrowWidth:c.value,arrowHeight:a.value}),n.hideWhenDetached&&bo({strategy:"referenceHidden",...v.value})]),{floatingStyles:h,placement:y,isPositioned:b,middlewareData:w}=Do(i.anchor,s,{strategy:"fixed",placement:u,whileElementsMounted:(...R)=>ho(...R,{animationFrame:n.updatePositionStrategy==="always"}),middleware:g}),C=O(()=>rt(y.value)[0]),x=O(()=>rt(y.value)[1]);Rn(()=>{b.value&&o("placed")});const S=O(()=>{var R;return((R=w.value.arrow)==null?void 0:R.centerOffset)!==0}),_=E("");K(()=>{l.value&&(_.value=window.getComputedStyle(l.value).zIndex)});const M=O(()=>{var R;return((R=w.value.arrow)==null?void 0:R.x)??0}),N=O(()=>{var R;return((R=w.value.arrow)==null?void 0:R.y)??0});return zi({placedSide:C,onArrowChange:R=>d.value=R,arrowX:M,arrowY:N,shouldHideArrow:S}),(R,z)=>{var k,W,L;return B(),Vt("div",{ref_key:"floatingRef",ref:s,"data-radix-popper-content-wrapper":"",style:st({...m(h),transform:m(b)?m(h).transform:"translate(0, -200%)",minWidth:"max-content",zIndex:_.value,"--radix-popper-transform-origin":[(k=m(w).transformOrigin)==null?void 0:k.x,(W=m(w).transformOrigin)==null?void 0:W.y].join(" "),...((L=m(w).hide)==null?void 0:L.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}})},[me(m(X),F({ref:m(r)},R.$attrs,{"as-child":n.asChild,as:R.as,"data-side":C.value,"data-align":x.value,style:{animation:m(b)?void 0:"none"}}),{default:A(()=>[P(R.$slots,"default")]),_:3},16,["as-child","as","data-side","data-align","style"])],4)}}}),Ui=$n("polygon",{points:"0,0 30,0 15,10"},null,-1),Yi=D({__name:"Arrow",props:{width:{default:10},height:{default:5},asChild:{type:Boolean},as:{default:"svg"}},setup(e){const t=e;return $(),(n,o)=>(B(),T(m(X),F(t,{width:n.width,height:n.height,viewBox:n.asChild?void 0:"0 0 30 10",preserveAspectRatio:n.asChild?void 0:"none"}),{default:A(()=>[P(n.$slots,"default",{},()=>[Ui])]),_:3},16,["width","height","viewBox","preserveAspectRatio"]))}}),Xi={top:"bottom",right:"left",bottom:"top",left:"right"},qi=D({inheritAttrs:!1,__name:"PopperArrow",props:{width:{},height:{},asChild:{type:Boolean},as:{default:"svg"}},setup(e){const{forwardRef:t}=$(),n=ji(),o=O(()=>Xi[n.placedSide.value]);return(i,r)=>{var l,s,d,c;return B(),Vt("span",{ref:a=>{m(n).onArrowChange(a)},style:st({position:"absolute",left:(l=m(n).arrowX)!=null&&l.value?`${(s=m(n).arrowX)==null?void 0:s.value}px`:void 0,top:(d=m(n).arrowY)!=null&&d.value?`${(c=m(n).arrowY)==null?void 0:c.value}px`:void 0,[o.value]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[m(n).placedSide.value],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[m(n).placedSide.value],visibility:m(n).shouldHideArrow.value?"hidden":void 0})},[me(Yi,F(i.$attrs,{ref:m(t),style:{display:"block"},as:i.as,"as-child":i.asChild,width:i.width,height:i.height}),{default:A(()=>[P(i.$slots,"default")]),_:3},16,["as","as-child","width","height"])],4)}}}),Gi=D({__name:"VisuallyHidden",props:{asChild:{type:Boolean},as:{default:"span"}},setup(e){return $(),(t,n)=>(B(),T(m(X),{as:t.as,"as-child":t.asChild,style:{position:"absolute",border:0,width:"1px",display:"inline-block",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}},{default:A(()=>[P(t.$slots,"default")]),_:3},8,["as","as-child"]))}});function Ji(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}Ji();const mn="tooltip.open",[bt,Zi]=be("TooltipProvider"),fr=D({inheritAttrs:!1,__name:"TooltipProvider",props:{delayDuration:{default:700},skipDelayDuration:{default:300},disableHoverableContent:{type:Boolean,default:!1},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean,default:!1}},setup(e){const t=e,{delayDuration:n,skipDelayDuration:o,disableHoverableContent:i,disableClosingTrigger:r,ignoreNonKeyboardFocus:l,disabled:s}=lt(t);$();const d=E(!0),c=E(!1),{start:a,stop:u}=tn(()=>{d.value=!0},o,{immediate:!1});return Zi({isOpenDelayed:d,delayDuration:n,onOpen(){u(),d.value=!1},onClose(){a()},isPointerInTransitRef:c,disableHoverableContent:i,disableClosingTrigger:r,disabled:s,ignoreNonKeyboardFocus:l}),(p,f)=>P(p.$slots,"default")}}),[Ue,Qi]=be("TooltipRoot"),pr=D({__name:"TooltipRoot",props:{defaultOpen:{type:Boolean,default:!1},open:{type:Boolean,default:void 0},delayDuration:{default:void 0},disableHoverableContent:{type:Boolean,default:void 0},disableClosingTrigger:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},ignoreNonKeyboardFocus:{type:Boolean,default:void 0}},emits:["update:open"],setup(e,{emit:t}){const n=e,o=t;$();const i=bt(),r=O(()=>n.disableHoverableContent??i.disableHoverableContent.value),l=O(()=>n.disableClosingTrigger??i.disableClosingTrigger.value),s=O(()=>n.disabled??i.disabled.value),d=O(()=>n.delayDuration??i.delayDuration.value),c=O(()=>n.ignoreNonKeyboardFocus??i.ignoreNonKeyboardFocus.value),a=nn(n,"open",o,{defaultValue:n.defaultOpen,passive:n.open===void 0});j(a,w=>{i.onClose&&(w?(i.onOpen(),document.dispatchEvent(new CustomEvent(mn))):i.onClose())});const u=E(!1),p=E(),f=O(()=>a.value?u.value?"delayed-open":"instant-open":"closed"),{start:v,stop:g}=tn(()=>{u.value=!0,a.value=!0},d,{immediate:!1});function h(){g(),u.value=!1,a.value=!0}function y(){g(),a.value=!1}function b(){v()}return Qi({contentId:"",open:a,stateAttribute:f,trigger:p,onTriggerChange(w){p.value=w},onTriggerEnter(){i.isOpenDelayed.value?b():h()},onTriggerLeave(){r.value?y():g()},onOpen:h,onClose:y,disableHoverableContent:r,disableClosingTrigger:l,disabled:s,ignoreNonKeyboardFocus:c}),(w,C)=>(B(),T(m(ki),null,{default:A(()=>[P(w.$slots,"default",{open:m(a)})]),_:3}))}}),vr=D({__name:"TooltipTrigger",props:{asChild:{type:Boolean},as:{default:"button"}},setup(e){const t=e,n=Ue(),o=bt();n.contentId||(n.contentId=it(void 0,"radix-vue-tooltip-content"));const{forwardRef:i,currentElement:r}=$(),l=E(!1),s=E(!1),d=O(()=>n.disabled.value?{}:{click:g,focus:f,pointermove:u,pointerleave:p,pointerdown:a,blur:v});De(()=>{n.onTriggerChange(r.value)});function c(){setTimeout(()=>{l.value=!1},1)}function a(){l.value=!0,document.addEventListener("pointerup",c,{once:!0})}function u(h){h.pointerType!=="touch"&&!s.value&&!o.isPointerInTransitRef.value&&(n.onTriggerEnter(),s.value=!0)}function p(){n.onTriggerLeave(),s.value=!1}function f(h){var y,b;l.value||n.ignoreNonKeyboardFocus.value&&!((b=(y=h.target).matches)!=null&&b.call(y,":focus-visible"))||n.onOpen()}function v(){n.onClose()}function g(){n.disableClosingTrigger.value||n.onClose()}return(h,y)=>(B(),T(m(Ii),{"as-child":""},{default:A(()=>[me(m(X),F({ref:m(i),"aria-describedby":m(n).open.value?m(n).contentId:void 0,"data-state":m(n).stateAttribute.value,as:h.as,"as-child":t.asChild,"data-grace-area-trigger":""},xn(d.value)),{default:A(()=>[P(h.$slots,"default")]),_:3},16,["aria-describedby","data-state","as","as-child"])]),_:3}))}}),hn=D({__name:"TooltipContentImpl",props:{ariaLabel:{},asChild:{type:Boolean},as:{},side:{default:"top"},sideOffset:{default:0},align:{default:"center"},alignOffset:{},avoidCollisions:{type:Boolean,default:!0},collisionBoundary:{default:()=>[]},collisionPadding:{default:0},arrowPadding:{default:0},sticky:{default:"partial"},hideWhenDetached:{type:Boolean,default:!1}},emits:["escapeKeyDown","pointerDownOutside"],setup(e,{emit:t}){const n=e,o=t,i=Ue(),{forwardRef:r}=$(),l=Dn(),s=O(()=>{var a;return(a=l.default)==null?void 0:a.call(l)}),d=O(()=>{var a;if(n.ariaLabel)return n.ariaLabel;let u="";function p(f){typeof f.children=="string"&&f.type!==Wt?u+=f.children:Array.isArray(f.children)&&f.children.forEach(v=>p(v))}return(a=s.value)==null||a.forEach(f=>p(f)),u}),c=O(()=>{const{ariaLabel:a,...u}=n;return u});return De(()=>{Ve(window,"scroll",a=>{const u=a.target;u!=null&&u.contains(i.trigger.value)&&i.onClose()}),Ve(window,mn,i.onClose)}),(a,u)=>(B(),T(m(cn),{"as-child":"","disable-outside-pointer-events":!1,onEscapeKeyDown:u[0]||(u[0]=p=>o("escapeKeyDown",p)),onPointerDownOutside:u[1]||(u[1]=p=>{var f;m(i).disableClosingTrigger.value&&(f=m(i).trigger.value)!=null&&f.contains(p.target)&&p.preventDefault(),o("pointerDownOutside",p)}),onFocusOutside:u[2]||(u[2]=Ze(()=>{},["prevent"])),onDismiss:u[3]||(u[3]=p=>m(i).onClose())},{default:A(()=>[me(m(Ki),F({ref:m(r),"data-state":m(i).stateAttribute.value},{...a.$attrs,...c.value},{style:{"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),{default:A(()=>[P(a.$slots,"default"),me(m(Gi),{id:m(i).contentId,role:"tooltip"},{default:A(()=>[Pn(_n(d.value),1)]),_:1},8,["id"])]),_:3},16,["data-state"])]),_:3}))}}),er=D({__name:"TooltipContentHoverable",props:{ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean}},setup(e){const t=ln(e),{forwardRef:n,currentElement:o}=$(),{trigger:i,onClose:r}=Ue(),l=bt(),{isPointerInTransit:s,onPointerExit:d}=Go(i,o);return l.isPointerInTransitRef=s,d(()=>{r()}),(c,a)=>(B(),T(hn,F({ref:m(n)},m(t)),{default:A(()=>[P(c.$slots,"default")]),_:3},16))}}),mr=D({__name:"TooltipContent",props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{default:"top"},sideOffset:{},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean}},emits:["escapeKeyDown","pointerDownOutside"],setup(e,{emit:t}){const n=e,o=t,i=Ue(),r=sn(n,o),{forwardRef:l}=$();return(s,d)=>(B(),T(m(yt),{present:s.forceMount||m(i).open.value},{default:A(()=>[(B(),T(On(m(i).disableHoverableContent.value?hn:er),F({ref:m(l)},m(r)),{default:A(()=>[P(s.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),hr=D({__name:"TooltipArrow",props:{width:{default:10},height:{default:5},asChild:{type:Boolean},as:{default:"svg"}},setup(e){const t=e;return $(),(n,o)=>(B(),T(m(qi),de(fe(t)),{default:A(()=>[P(n.$slots,"default")]),_:3},16))}}),gr=D({__name:"TooltipPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(e){const t=e;return(n,o)=>(B(),T(m(wt),de(fe(t)),{default:A(()=>[P(n.$slots,"default")]),_:3},16))}});export{$i as $,rr as A,Si as B,cr as F,hr as G,fr as H,or as I,ar as M,dr as N,lr as O,Ti as P,ir as T,mr as U,ur as V,pr as W,vr as j,sr as k,vi as n,gr as q}; diff --git a/assets/index-CFJ82zLP.js b/assets/index-CFJ82zLP.js deleted file mode 100644 index 3976c9bf2a43957a9025e6532ca8210cdb657b34..0000000000000000000000000000000000000000 --- a/assets/index-CFJ82zLP.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as u}from"./IconAnimation.vue_vue_type_script_setup_true_lang-BF7ZejO-.js";import{_ as p}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as f,bw as _,c as n,o,b as v,a,x,A as b,u as e,bx as k}from"./index-20XXNHAB.js";import{u as y}from"./useIconAnimation-HC6FusaE.js";import{b as r}from"./route-block-B_A1xBdJ.js";const g={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,y:20},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},h=f({__name:"index",setup(A){const{iconAnimationStarted:s,showIconAnimation:c,animationIcon:l}=y("i-solar:armchair-2-bold-duotone");return(i,t)=>{const m=u,d=_("motion");return o(),n(k,null,[v(e(p),{title:i.$t("settings.pages.scene.title"),subtitle:i.$t("settings.title")},null,8,["title","subtitle"]),t[1]||(t[1]=a("div",null," Scene ",-1)),e(c)?(o(),x(m,{key:0,"z-index":-1,icon:e(l),"icon-size":12,duration:1e3,started:e(s),"is-reverse":!0,position:"calc(100dvw - 9.5rem), calc(100dvh - 9.5rem)","text-color":"text-neutral-200/50 dark:text-neutral-600/20"},null,8,["icon","started"])):b((o(),n("div",g,t[0]||(t[0]=[a("div",{text:"60","i-solar:armchair-2-bold-duotone":""},null,-1)]))),[[d]])],64)}}});typeof r=="function"&&r(h);export{h as default}; diff --git a/assets/index-CMXq_S_x.js b/assets/index-CMXq_S_x.js new file mode 100644 index 0000000000000000000000000000000000000000..c9d1945d047325455f560c57a38c2989a9c39c4e --- /dev/null +++ b/assets/index-CMXq_S_x.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as E}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{d as S,r as D,x as b,o as a,y as P,a as i,c as m,C as w,m as R,D as C,z as q,bn as L,bG as N,g as r,q as V,v as j,h as F,bw as G,b as O,u as p,A as y,bx as $,by as H,n as J,bv as K}from"./index-D8Nm21zW.js";import{_ as M}from"./IconAnimation.vue_vue_type_script_setup_true_lang-CRr1ZQyH.js";import{b as I}from"./route-block-B_A1xBdJ.js";const Q={"z-1":"","flex-1":""},U={"text-lg":"","font-bold":"",class:"menu-icon-item-title",transition:"all ease-in-out duration-400"},W={text:"sm neutral-500 dark:neutral-400",class:"menu-icon-item-description",transition:"all ease-in-out duration-400"},X=S({__name:"IconItem",props:{title:null,description:null,icon:null,iconTemplate:{type:Boolean},to:null},setup(o){return(g,f)=>{const v=D("RouterLink");return a(),b(v,{box:"border",flex:"~ row",bg:"neutral-50 dark:neutral-900",border:"neutral-100 dark:neutral-800/25 hover:primary-500/30 dark:hover:primary-400/30 solid 2","drop-shadow":"none hover:[0px_4px_4px_rgba(220,220,220,0.4)] active:[0px_0px_0px_rgba(220,220,220,0.25)] dark:hover:none",class:"menu-icon-item",transition:"all ease-in-out duration-400",relative:"","w-full":"","items-center":"","overflow-hidden":"","rounded-lg":"","p-5":"","text-left":"",cursor:"pointer",to:o.to},{default:P(()=>[i("div",Q,[i("div",U,C(o.title),1),i("div",W,[i("span",null,C(o.description),1)])]),typeof o.icon=="string"?(a(),m("div",{key:0,class:q(["menu-icon-item-icon",[o.icon]]),transition:"all ease-in-out duration-400",absolute:"","right-0":"","size-24":"","translate-y-4":"",text:"neutral-400/50 dark:neutral-600/50"},null,2)):w("",!0),o.iconTemplate?R(g.$slots,"icon",{key:1},void 0,!0):w("",!0)]),_:3},8,["to"])}}}),Y=L(X,[["__scopeId","data-v-656e0116"]]),Z={flex:"~ col gap-4"},tt={flex:"~ col gap-4"},et={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-12rem)]","bottom-0":"","right--10":"","z--1":"",initial:{scale:.9,opacity:0,rotate:180},enter:{scale:1,opacity:1,rotate:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},it={text:"60","i-solar:settings-bold-duotone":""},ot=S({__name:"index",setup(o){const g=N(),f=r(!1),v=r(),c=r(),{t}=V(),x=r(""),h=r(""),k=r(!1),d=j();function z(){var n;(n=c.value)==null||n.call(c)}async function T(n,l){const e=n.currentTarget.querySelector(".menu-icon-item-icon");if(!e)return;const u=e.getBoundingClientRect(),_=`${u.left}px, ${u.top}px`;x.value=l.icon,h.value=_,k.value=!0,await K(),f.value=!0}const B=g.beforeEach(async(n,l,s)=>{if(!d.usePageSpecificTransitions||d.disableTransitions){s();return}await new Promise(e=>{c.value=e}),B(),s()}),A=F(()=>[{title:t("settings.pages.card.title"),description:t("settings.pages.card.description"),icon:"i-solar:emoji-funny-square-bold-duotone",to:"/settings/airi-card"},{title:t("settings.pages.modules.title"),description:t("settings.pages.modules.description"),icon:"i-solar:layers-bold-duotone",to:"/settings/modules"},{title:t("settings.pages.scene.title"),description:t("settings.pages.scene.description"),icon:"i-solar:armchair-2-bold-duotone",to:"/settings/scene"},{title:t("settings.pages.models.title"),description:t("settings.pages.models.description"),icon:"i-solar:people-nearby-bold-duotone",to:"/settings/models"},{title:t("settings.pages.memory.title"),description:t("settings.pages.memory.description"),icon:"i-solar:leaf-bold-duotone",to:"/settings/memory"},{title:t("settings.pages.providers.title"),description:t("settings.pages.providers.description"),icon:"i-solar:box-minimalistic-bold-duotone",to:"/settings/providers"},{title:t("settings.pages.themes.title"),description:t("settings.pages.themes.description"),icon:"i-solar:filters-bold-duotone",to:"/settings/appearance"}]);return(n,l)=>{const s=G("motion");return a(),m($,null,[O(p(E),{title:n.$t("settings.title")},null,8,["title"]),i("div",Z,[l[0]||(l[0]=i("div",null,null,-1)),i("div",tt,[(a(!0),m($,null,H(A.value,(e,u)=>y((a(),b(p(Y),{key:e.to,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250,style:J({transitionDelay:`${u*50}ms`}),title:e.title,description:e.description,icon:e.icon,to:e.to,onClick:_=>T(_,e)},null,8,["style","title","description","icon","to","onClick"])),[[s]])),128))]),k.value&&!p(d).disableTransitions&&p(d).usePageSpecificTransitions?(a(),b(M,{key:0,ref_key:"iconAnimation",ref:v,icon:x.value,"icon-size":6*1.2,position:h.value,duration:1e3,"text-color":"text-neutral-400/50 dark:text-neutral-600/20",started:f.value,onAnimationEndedOnce:z},null,8,["icon","position","started"])):y((a(),m("div",et,[y(i("div",it,null,512),[[s]])])),[[s]])])],64)}}});typeof I=="function"&&I(ot);export{ot as default}; diff --git a/assets/index-CrclHGQ3.js b/assets/index-CrclHGQ3.js new file mode 100644 index 0000000000000000000000000000000000000000..97511b4dd5c17ec8e459fd0348a2748456b605cc --- /dev/null +++ b/assets/index-CrclHGQ3.js @@ -0,0 +1,532 @@ +var fl=Object.defineProperty;var dl=(t,e,n)=>e in t?fl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var le=(t,e,n)=>dl(t,typeof e!="symbol"?e+"":e,n);import{V as pl,a as hl,c as ml,r as gl,b as qr,d as yl,E as $i,e as vl,f as xl,g as bl,h as wl,i as Tl}from"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{f as nr,g as W,h as He,s as We,t as Al,d as ze,i as _l,j as kl,k as pi,w as Ue,l as wn,c as re,o as Q,m as _n,p as El,q as on,v as nn,x as rn,y as Ve,b as Ae,a as O,z as dt,A as Ct,B as hi,C as ut,D as me,u as V,M as Tt,T as Rt,E as mi,F as rr,G as Da,Z as Gn,H as Ht,I as Ml,V as ae,S as qi,Q as $n,O as Qt,J as De,P as Nt,K as Sl,L as Oa,N as Tn,U as gi,W as je,X as Fa,Y as Ba,_ as yi,$ as kn,a0 as Il,a1 as vi,a2 as Rl,a3 as za,a4 as _t,a5 as xi,a6 as Lt,a7 as Cl,a8 as Ua,a9 as Vt,aa as ja,ab as Nl,ac as Ll,ad as Pl,ae as Dl,af as Va,ag as ir,ah as Ol,ai as Fl,aj as Bl,ak as jt,al as zl,am as Ul,an as jl,ao as Vl,ap as fr,aq as qn,ar as Yr,as as zt,at as Ha,au as Kr,av as Wt,aw as Yi,ax as Ut,ay as Xt,az as dr,aA as Hl,aB as Gl,aC as $l,aD as ql,aE as Ga,aF as $a,aG as Yn,aH as qa,aI as bi,aJ as Kn,aK as Ya,aL as Yl,n as Wr,aM as Kl,aN as Xr,aO as Ka,aP as Wl,aQ as yn,aR as Wa,aS as gt,aT as kt,aU as An,aV as Xl,aW as Ql,aX as Zl,aY as Jl,aZ as eu,a_ as wi,a$ as tu,b0 as nu,b1 as ru,b2 as pr,b3 as iu,b4 as Xa,b5 as ou,b6 as au,b7 as su,b8 as lu,b9 as uu,ba as hr,bb as cu,bc as fu,bd as du,be as Ki,bf as Wi,bg as Xi,bh as Qi,bi as pu,bj as hu,bk as mu,bl as gu,bm as yu,bn as or,bo as vu,bp as Qa,bq as xu,br as bu,bs as wu,bt as Tu,bu as Za,bv as Wn,bw as Ja,bx as Ti,by as Ai,bz as Au,bA as mr,bB as _u,bC as ku}from"./index-D8Nm21zW.js";import{getImportUrlBundles as Eu}from"./import-url-browser-CPN8ipMD.js";import{s as Zt,c as Zi,u as Mu,g as Su}from"./speech-B27BwGQ-.js";import{u as gr}from"./queue-CEzllKo3.js";import{u as Iu,a as Ru,b as Cu,l as Nu}from"./queues-DJEZsGUG.js";import{l as Lu,u as _i}from"./providers-DUDq6kdm.js";import{s as Pu}from"./index-D975M2PQ.js";import{u as Du}from"./airi-card-DeGSbHPj.js";import{_ as Ou,a as Fu,r as dn}from"./Model.vue_vue_type_script_setup_true_lang-xbmtXrdQ.js";import{_ as ki}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import{_ as Ji}from"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import{H as Bu}from"./HeaderLink-yHEt2vbv.js";import{_ as es}from"./Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js";import{u as ts}from"./consciousness-CgTB9b9w.js";import{d as eo}from"./index-DxNnZI6o.js";import{b as to}from"./route-block-B_A1xBdJ.js";import"./duckdb-mvp-CaaD-olE.js";import"./index-Be1NqeGb.js";async function*zu(t,e){const n=t.getReader();try{for(;;){const{done:r,value:i}=await n.read();if(r)return;yield e(i)}}finally{n.releaseLock()}}function Uu(t){const e=new Uint8Array(t.frequencyBinCount);t.getByteFrequencyData(e);const n=[];for(let i=0;i<700;i+=80)n.push(e[i]);return e.map(i=>i**1.2).map(i=>i*1.2).reduce((i,o)=>i+o,0)/e.length/100}function ju(t){const e=new Uint8Array(t.frequencyBinCount);t.getByteFrequencyData(e);const n=[];for(let u=0;u<700;u+=80)n.push(e[u]);const r=e.map(u=>u**1.5),i=Math.min(...r),a=Math.max(...r)-i;let s;return a===0?s=r.map(()=>0):s=r.map(u=>(u-i)/a),s.reduce((u,c)=>u+c,0)/e.length}function Vu(t,e="linear"){switch(e){case"linear":return Uu(t);case"minmax":return ju(t)}}const ns=nr("AudioContext",()=>({audioContext:new AudioContext,calculateVolume:Vu})),Hu=nr("SpeakingStore",()=>{const n=W(0),r=W(!1),i=He(()=>r.value?(30+70*n.value)/100:30);return{mouthOpenSize:n,nowSpeaking:r,nowSpeakingAvatarBorderOpacity:i}});function Nn(t,e,n){return e+n<0||e+n>=t.length-1?"":t[e+n]}function Gu(t){let e="literal",n="";return{async consume(r){var i,o,a;for(let s=0;s"?(l+=Nn(r,s,1),u="literal",s++):l==="<"?u="special":l===">"&&(u="literal"),e==="literal"&&u==="special"?n!==""&&(await((i=t.onLiteral)==null?void 0:i.call(t,n)),n=""):e==="special"&&u==="literal"&&n!==""&&(n+=l,await((o=t.onSpecial)==null?void 0:o.call(t,n)),n=""),e==="literal"&&u==="literal"?(await((a=t.onLiteral)==null?void 0:a.call(t,l)),n=""):e==="special"&&u==="literal"?n="":n+=l,e=u}},async end(){var r,i;n!==""&&(e==="literal"?await((r=t.onLiteral)==null?void 0:r.call(t,n)):n.endsWith("|>")&&await((i=t.onSpecial)==null?void 0:i.call(t,n)))}}}const $u=nr("llm",()=>{async function t(n,r,i,o){const a=o==null?void 0:o.headers;return await Pu({...r.chat(n),messages:i,headers:a})}async function e(n,r){if(n==="")return[];try{return await Lu({baseURL:n.endsWith("/")?n:`${n}/`,apiKey:r})}catch(i){if(String(i).includes("Failed to construct 'URL': Invalid URL"))return[];throw i}}return{models:e,stream:t}}),Pt=nr("chat",()=>{const{stream:t}=$u(),{systemPrompt:e}=We(Du()),n=W(!1),r=W([]),i=W([]),o=W([]),a=W([]),s=W([]),l=W([]),u=W([]),c=W([]);function f(h){r.value.push(h)}function p(h){i.value.push(h)}function d(h){o.value.push(h)}function y(h){a.value.push(h)}function v(h){s.value.push(h)}function x(h){l.value.push(h)}function T(h){u.value.push(h)}function M(h){c.value.push(h)}const k=W([{role:"system",content:e.value}]),C=W({role:"assistant",content:""});async function P(h,I){var b;try{if(n.value=!0,!h)return;for(const D of r.value)await D(h);C.value={role:"assistant",content:""},k.value.push({role:"user",content:h}),k.value.push(C.value);const g=k.value.slice(0,k.value.length-1).map(D=>Al(D));for(const D of i.value)await D(h);for(const D of o.value)await D(h);const m=((b=I.providerConfig)==null?void 0:b.headers)||{},A=await t(I.model,I.chatProvider,g,{headers:m});for(const D of a.value)await D(h);let S="";const B=Gu({onLiteral:async D=>{for(const F of s.value)await F(D);C.value.content+=D},onSpecial:async D=>{for(const F of l.value)await F(D)}});for await(const D of zu(A.textStream,async F=>F))S+=D,await B.consume(D);await B.end();for(const D of u.value)await D();for(const D of c.value)await D(S);console.debug("LLM output:",S)}catch(g){throw console.error("Error sending message:",g),g}finally{n.value=!1}}return{sending:n,messages:k,streamingMessage:C,send:P,onBeforeMessageComposed:f,onAfterMessageComposed:p,onBeforeSend:d,onAfterSend:y,onTokenLiteral:v,onTokenSpecial:x,onStreamEnd:T,onAssistantResponseEnd:M}}),rs=ze({__name:"Screen",setup(t){const e=W(),n=_l(El),{width:r,height:i}=kl(),o=pi(e,{immediate:!0,windowResize:!0,reset:!0}),a=He(()=>n.between("sm","md").value||n.smaller("sm").value),s=He(()=>n.between("md","lg").value),l=He(()=>n.greaterOrEqual("lg").value),u=He(()=>l.value?o.width.value:a.value||s.value?r.value-16:o.width.value),c=W(0);return Ue([r,i,e],()=>{var p,d;const f=(d=(p=e.value)==null?void 0:p.parentElement)==null?void 0:d.getBoundingClientRect();l.value||a.value||s.value?c.value=(f==null?void 0:f.height)||0:c.value=600}),Ue([o.width,o.height],()=>{l.value||a.value||s.value?c.value=o.height.value:c.value=600}),wn(async()=>{e.value&&o.update()}),(f,p)=>(Q(),re("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[_n(f.$slots,"default",{width:u.value,height:c.value})],512))}}),qu={absolute:"",bottom:"3",right:"3"},Yu={flex:"~ row","cursor-pointer":""},Ku=["checked","aria-checked"],Wu={key:0,"min-w":"50vw",z:"(Q(),rn(rs,{relative:""},{default:Ve(({width:a,height:s})=>[Ae(Fu,{width:a,height:s},{default:Ve(({app:l})=>[Ae(Ou,{app:l,"mouth-open-size":t.mouthOpenSize,width:a,height:s,paused:t.paused},null,8,["app","mouth-open-size","width","height","paused"])]),_:2},1032,["width","height"]),O("div",qu,[O("div",Yu,[O("label",{class:dt([n.value?"bg-neutral-300 dark:bg-neutral-200":"bg-neutral-100 dark:bg-neutral-700"]),transition:"all ease-in-out duration-500",text:"lg neutral-500 dark:neutral-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[Ct(O("input",{"onUpdate:modelValue":o[0]||(o[0]=l=>n.value=l),checked:n.value,"aria-checked":n.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,Ku),[[hi,n.value]]),o[8]||(o[8]=O("div",{"select-none":""},[O("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),Ae(ki,null,{default:Ve(()=>[n.value?(Q(),re("div",Wu,[O("div",Xu,[O("div",Qu,[O("span",null,me(V(e)("stage.viewers.debug-menu.emotions")),1)]),O("div",Zu,[O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[1]||(o[1]=l=>r.value={group:"Surprise",index:0})},me(V(e)("stage.viewers.debug-menu.emotions-btn.surprised")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[2]||(o[2]=l=>r.value={group:"Sad",index:0})},me(V(e)("stage.viewers.debug-menu.emotions-btn.sad")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[3]||(o[3]=l=>r.value={group:"Angry",index:0})},me(V(e)("stage.viewers.debug-menu.emotions-btn.angry")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[4]||(o[4]=l=>r.value={group:"Happy",index:0})},me(V(e)("stage.viewers.debug-menu.emotions-btn.happy")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[5]||(o[5]=l=>r.value={group:"Awkward",index:0})},me(V(e)("stage.viewers.debug-menu.emotions-btn.awkward")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[6]||(o[6]=l=>r.value={group:"Question",index:0})},me(V(e)("stage.viewers.debug-menu.emotions-btn.question")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[7]||(o[7]=l=>r.value={group:"Think",index:0})},me(V(e)("stage.viewers.debug-menu.emotions-btn.think")),1)])])])):ut("",!0)]),_:1})])]),_:1}))}});var ec=Object.defineProperty,tc=(t,e,n)=>e in t?ec(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,nc=(t,e,n)=>tc(t,e+"",n);function rc(t){return Ol()?(Fl(t),!0):!1}function is(t){return typeof t=="function"?t():V(t)}const ic=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const oc=Object.prototype.toString,ac=t=>oc.call(t)==="[object Object]",sc=()=>{},lc=ic?window:void 0;function uc(t){var e;const n=is(t);return(e=n==null?void 0:n.$el)!=null?e:n}function yr(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=lc):[e,n,r,i]=t,!e)return sc;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const o=[],a=()=>{o.forEach(c=>c()),o.length=0},s=(c,f,p,d)=>(c.addEventListener(f,p,d),()=>c.removeEventListener(f,p,d)),l=Ue(()=>[uc(e),is(i)],([c,f])=>{if(a(),!c)return;const p=ac(f)?{...f}:f;o.push(...n.flatMap(d=>r.map(y=>s(c,d,y,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return rc(u),u}function os(t,e,n,r){const i=class extends kn{constructor(o={}){const a=Object.entries(t);super({uniforms:a.reduce((s,[l,u])=>{const c=vi.clone({[l]:{value:u}});return{...s,...c}},{}),vertexShader:e,fragmentShader:n}),nc(this,"key",""),a.forEach(([s])=>Object.defineProperty(this,s,{get:()=>this.uniforms[s].value,set:l=>this.uniforms[s].value=l})),Object.assign(this,o)}};return i.key=Vt.generateUUID(),i}os({color:new je("white"),scale:new De(1,1),imageBounds:new De(1,1),resolution:1024,map:null,zoom:1,radius:0,grayscale:0,opacity:1},` + varying vec2 vUv; + varying vec2 vPos; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + vPos = position.xy; + } + `,` + // mostly from https://gist.github.com/statico/df64c5d167362ecf7b34fca0b1459a44 + varying vec2 vUv; + varying vec2 vPos; + uniform vec2 scale; + uniform vec2 imageBounds; + uniform float resolution; + uniform vec3 color; + uniform sampler2D map; + uniform float radius; + uniform float zoom; + uniform float grayscale; + uniform float opacity; + const vec3 luma = vec3(.299, 0.587, 0.114); + vec4 toGrayscale(vec4 color, float intensity) { + return vec4(mix(color.rgb, vec3(dot(color.rgb, luma)), intensity), color.a); + } + vec2 aspect(vec2 size) { + return size / min(size.x, size.y); + } + + const float PI = 3.14159265; + + // from https://iquilezles.org/articles/distfunctions + float udRoundBox( vec2 p, vec2 b, float r ) { + return length(max(abs(p)-b+r,0.0))-r; + } + + void main() { + vec2 s = aspect(scale); + vec2 i = aspect(imageBounds); + float rs = s.x / s.y; + float ri = i.x / i.y; + vec2 new = rs < ri ? vec2(i.x * s.y / i.y, s.y) : vec2(s.x, i.y * s.x / i.x); + vec2 offset = (rs < ri ? vec2((new.x - s.x) / 2.0, 0.0) : vec2(0.0, (new.y - s.y) / 2.0)) / new; + vec2 uv = vUv * s / new + offset; + vec2 zUv = (uv - vec2(0.5, 0.5)) / zoom + vec2(0.5, 0.5); + + vec2 res = vec2(scale * resolution); + vec2 halfRes = 0.5 * res; + float b = udRoundBox(vUv.xy * res - halfRes, halfRes, resolution * radius); + vec3 a = mix(vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0, 1.0, b)); + gl_FragColor = toGrayscale(texture2D(map, zUv) * vec4(color, opacity * a), grayscale); + + #include + #include + } + `);const Ei=parseInt(Bl.replace(/\D+/g,""));var cc=Object.defineProperty,fc=(t,e,n)=>e in t?cc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,dc=(t,e,n)=>(fc(t,e+"",n),n);async function no(t){const e=await t.arrayBuffer(),n=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${t.type||""};base64,${n}`}let Ln,vr,$t,Pn;function xr(t,e=1/0,n=null){vr||(vr=new ja(2,2,1,1)),$t||($t=new kn({uniforms:{blitTexture:new $l(t)},vertexShader:` + varying vec2 vUv; + void main(){ + vUv = uv; + gl_Position = vec4(position.xy * 1.0,0.,.999999); + } + `,fragmentShader:` + uniform sampler2D blitTexture; + varying vec2 vUv; + + void main(){ + gl_FragColor = vec4(vUv.xy, 0, 1); + + #ifdef IS_SRGB + gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) ); + #else + gl_FragColor = texture2D( blitTexture, vUv); + #endif + } + `})),$t.uniforms.blitTexture.value=t,$t.defines.IS_SRGB="colorSpace"in t?t.colorSpace==="srgb":t.encoding===3001,$t.needsUpdate=!0,Pn||(Pn=new jt(vr,$t),Pn.frustrumCulled=!1);const r=new Nt,i=new Kr;i.add(Pn),n||(n=Ln=new ql({antialias:!1})),n.setSize(Math.min(t.image.width,e),Math.min(t.image.height,e)),n.clear(),n.render(i,r);const o=new qn(n.domElement);return o.minFilter=t.minFilter,o.magFilter=t.magFilter,o.wrapS=t.wrapS,o.wrapT=t.wrapT,o.name=t.name,Ln&&(Ln.dispose(),Ln=null),o}const ro={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 as{constructor(){this.pluginCallbacks=[],this.register(function(e){return new Tc(e)}),this.register(function(e){return new Ac(e)}),this.register(function(e){return new Ec(e)}),this.register(function(e){return new Mc(e)}),this.register(function(e){return new Sc(e)}),this.register(function(e){return new Ic(e)}),this.register(function(e){return new _c(e)}),this.register(function(e){return new kc(e)}),this.register(function(e){return new Rc(e)}),this.register(function(e){return new Cc(e)}),this.register(function(e){return new Nc(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,r,i){const o=new wc,a=[];for(let s=0,l=this.pluginCallbacks.length;st.times[t.times.length-1]){if(Math.abs(t.times[t.times.length-1]-e)<.001)return t.times.length-1;r[r.length-1]=e,r.set(t.times,0),i.set(t.values,0),i.set(o.evaluate(e),t.values.length),a=r.length-1}else for(let s=0;se){r.set(t.times.slice(0,s+1),0),r[s+1]=e,r.set(t.times.slice(s+1),s+2),i.set(t.values.slice(0,(s+1)*n),0),i.set(o.evaluate(e),(s+1)*n),i.set(t.values.slice((s+1)*n),(s+2)*n),a=s+1;break}}return t.times=r,t.values=i,a},mergeMorphTargetTracks:function(t,e){const n=[],r={},i=t.tracks;for(let o=0;o4?a=t.array[i*t.itemSize+o]:(o===0?a=t.getX(i):o===1?a=t.getY(i):o===2?a=t.getZ(i):o===3&&(a=t.getW(i)),t.normalized===!0&&(a=Vt.normalize(a,t.array))),r.min[o]=Math.min(r.min[o],a),r.max[o]=Math.max(r.max[o],a)}return r}function ss(t){return Math.ceil(t/4)*4}function wr(t,e=0){const n=ss(t.byteLength);if(n!==t.byteLength){const r=new Uint8Array(n);if(r.set(new Uint8Array(t)),e!==0)for(let i=t.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function lo(t,e){if(t.toBlob!==void 0)return new Promise(r=>t.toBlob(r,e));let n;return e==="image/jpeg"?n=.92:e==="image/webp"&&(n=.8),t.convertToBlob({type:e,quality:n})}class wc{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,n,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,o=i.buffers,a=i.json;r=i.options;const s=i.extensionsUsed,l=i.extensionsRequired,u=new Blob(o,{type:"application/octet-stream"}),c=Object.keys(s),f=Object.keys(l);c.length>0&&(a.extensionsUsed=c),f.length>0&&(a.extensionsRequired=f),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=u.size),r.binary===!0?u.arrayBuffer().then(p=>{const d=wr(p),y=new DataView(new ArrayBuffer(ao));y.setUint32(0,d.byteLength,!0),y.setUint32(4,yc,!0);const v=wr(vc(JSON.stringify(a)),32),x=new DataView(new ArrayBuffer(ao));x.setUint32(0,v.byteLength,!0),x.setUint32(4,gc,!0);const T=new ArrayBuffer(oo),M=new DataView(T);M.setUint32(0,hc,!0),M.setUint32(4,mc,!0);const k=oo+x.byteLength+v.byteLength+y.byteLength+d.byteLength;M.setUint32(8,k,!0),new Blob([T,x,v,y,d],{type:"application/octet-stream"}).arrayBuffer().then(n)}):a.buffers&&a.buffers.length>0?no(u).then(p=>{a.buffers[0].uri=p,n(a)}):n(a)}serializeUserData(e,n){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){n.extensions===void 0&&(n.extensions={});for(const a in o.gltfExtensions)n.extensions[a]=o.gltfExtensions[a],i[a]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(n.extras=o)}catch(o){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+o.message)}}getUID(e,n=!1){if(this.uids.has(e)===!1){const r=new Map;r.set(!0,this.uid++),r.set(!1,this.uid++),this.uids.set(e,r)}return this.uids.get(e).get(n)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new ae;for(let r=0,i=e.count;r5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const n=this.cache;if(n.attributesNormalized.has(e))return n.attributesNormalized.get(e);const r=e.clone(),i=new ae;for(let o=0,a=r.count;o4?y=e.array[p*e.itemSize+d]:(d===0?y=e.getX(p):d===1?y=e.getY(p):d===2?y=e.getZ(p):d===3&&(y=e.getW(p)),e.normalized===!0&&(y=Vt.normalize(y,e.array))),n===he.FLOAT?u.setFloat32(c,y,!0):n===he.INT?u.setInt32(c,y,!0):n===he.UNSIGNED_INT?u.setUint32(c,y,!0):n===he.SHORT?u.setInt16(c,y,!0):n===he.UNSIGNED_SHORT?u.setUint16(c,y,!0):n===he.BYTE?u.setInt8(c,y):n===he.UNSIGNED_BYTE&&u.setUint8(c,y),c+=s}const f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return o!==void 0&&(f.target=o),o===he.ARRAY_BUFFER&&(f.byteStride=e.itemSize*s),this.byteOffset+=l,a.bufferViews.push(f),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const n=this,r=n.json;return r.bufferViews||(r.bufferViews=[]),e.arrayBuffer().then(i=>{const o=wr(i),a={buffer:n.processBuffer(o),byteOffset:n.byteOffset,byteLength:o.byteLength};return n.byteOffset+=o.byteLength,r.bufferViews.push(a)-1})}processAccessor(e,n,r,i){const o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let s;if(e.array.constructor===Float32Array)s=he.FLOAT;else if(e.array.constructor===Int32Array)s=he.INT;else if(e.array.constructor===Uint32Array)s=he.UNSIGNED_INT;else if(e.array.constructor===Int16Array)s=he.SHORT;else if(e.array.constructor===Uint16Array)s=he.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)s=he.BYTE;else if(e.array.constructor===Uint8Array)s=he.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),i===void 0&&(i=e.count),i===0)return null;const l=bc(e,r,i);let u;n!==void 0&&(u=e===n.index?he.ELEMENT_ARRAY_BUFFER:he.ARRAY_BUFFER);const c=this.processBufferView(e,s,r,i,u),f={bufferView:c.id,byteOffset:c.byteOffset,componentType:s,count:i,max:l.max,min:l.min,type:a[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(f)-1}processImage(e,n,r,i="image/png"){if(e!==null){const o=this,a=o.cache,s=o.json,l=o.options,u=o.pending;a.images.has(e)||a.images.set(e,{});const c=a.images.get(e),f=i+":flipY/"+r.toString();if(c[f]!==void 0)return c[f];s.images||(s.images=[]);const p={mimeType:i},d=so();d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize);const y=d.getContext("2d");if(r===!0&&(y.translate(0,d.height),y.scale(1,-1)),e.data!==void 0){n!==Yr&&console.error("GLTFExporter: Only RGBAFormat is supported.",n),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const x=new Uint8ClampedArray(e.height*e.width*4);for(let T=0;To.processBufferViewImage(x)).then(x=>{p.bufferView=x})):d.toDataURL!==void 0?p.uri=d.toDataURL(i):u.push(lo(d,i).then(no).then(x=>{p.uri=x}));const v=s.images.push(p)-1;return c[f]=v,v}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const n=this.json;n.samplers||(n.samplers=[]);const r={magFilter:nt[e.magFilter],minFilter:nt[e.minFilter],wrapS:nt[e.wrapS],wrapT:nt[e.wrapT]};return n.samplers.push(r)-1}processTexture(e){const n=this.options,r=this.cache,i=this.json;if(r.textures.has(e))return r.textures.get(e);i.textures||(i.textures=[]),e instanceof fr&&(e=xr(e,n.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(l){l.writeTexture&&l.writeTexture(e,a)});const s=i.textures.push(a)-1;return r.textures.set(e,s),s}processMaterial(e){const n=this.cache,r=this.json;if(n.materials.has(e))return n.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(gn(o,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const s=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(s),channel:s.channel};this.applyTextureTransform(l,s),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const s={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(s,e.map),i.pbrMetallicRoughness.baseColorTexture=s}if(e.emissive){const s=e.emissive;if(Math.max(s.r,s.g,s.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const l={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),i.emissiveTexture=l}}if(e.normalMap){const s={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(s.scale=e.normalScale.x),this.applyTextureTransform(s,e.normalMap),i.normalTexture=s}if(e.aoMap){const s={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(s.strength=e.aoMapIntensity),this.applyTextureTransform(s,e.aoMap),i.occlusionTexture=s}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===ir&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(s){s.writeMaterial&&s.writeMaterial(e,i)});const a=r.materials.push(i)-1;return n.materials.set(e,a),a}processMesh(e){const n=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let k=0,C=e.material.length;k=152?{uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3"}:{uv:"TEXCOORD_0",uv2:"TEXCOORD_1"},color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=a.getAttribute("normal");d!==void 0&&!this.isNormalizedNormalAttribute(d)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),a.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let y=null;for(let k in a.attributes){if(k.slice(0,5)==="morph")continue;const C=a.attributes[k];if(k=p[k]||k.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(k)||(k="_"+k),n.attributes.has(this.getUID(C))){u[k]=n.attributes.get(this.getUID(C));continue}y=null;const P=C.array;k==="JOINTS_0"&&!(P instanceof Uint16Array)&&!(P instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new zt(new Uint16Array(P),C.itemSize,C.normalized));const h=this.processAccessor(y||C,a);h!==null&&(k.startsWith("_")||this.detectMeshQuantization(k,C),u[k]=h,n.attributes.set(this.getUID(C),h))}if(d!==void 0&&a.setAttribute("normal",d),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const k=[],C=[],P={};if(e.morphTargetDictionary!==void 0)for(const h in e.morphTargetDictionary)P[e.morphTargetDictionary[h]]=h;for(let h=0;h0&&(l.extras={},l.extras.targetNames=C)}const v=Array.isArray(e.material);if(v&&a.groups.length===0)return null;const x=v?e.material:[e.material],T=v?a.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let k=0,C=T.length;k0&&(P.targets=f),a.index!==null){let I=this.getUID(a.index);(T[k].start!==void 0||T[k].count!==void 0)&&(I+=":"+T[k].start+":"+T[k].count),n.attributes.has(I)?P.indices=n.attributes.get(I):(P.indices=this.processAccessor(a.index,a,T[k].start,T[k].count),n.attributes.set(I,P.indices)),P.indices===null&&delete P.indices}const h=this.processMaterial(x[T[k].materialIndex]);h!==null&&(P.material=h),c.push(P)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(k){k.writeMesh&&k.writeMesh(e,l)});const M=r.meshes.push(l)-1;return n.meshes.set(o,M),M}detectMeshQuantization(e,n){if(this.extensionsUsed[br])return;let r;switch(n.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}n.normalized&&(r+=" normalized");const i=e.split("_",1)[0];ro[i]&&ro[i].includes(r)&&(this.extensionsUsed[br]=!0,this.extensionsRequired[br]=!0)}processCamera(e){const n=this.json;n.cameras||(n.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Vt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),n.cameras.push(i)-1}processAnimation(e,n){const r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=as.Utils.mergeMorphTargetTracks(e.clone(),n);const o=e.tracks,a=[],s=[];for(let l=0;l0){const s=[];for(let l=0,u=e.children.length;l0&&(o.children=s)}this._invokeAll(function(s){s.writeNode&&s.writeNode(e,o)});const a=n.nodes.push(o)-1;return i.set(e,a),a}processScene(e){const n=this.json,r=this.options;n.scenes||(n.scenes=[],n.scene=0);const i={};e.name!==""&&(i.name=e.name),n.scenes.push(i);const o=[];for(let a=0,s=e.children.length;a0&&(i.nodes=o),this.serializeUserData(e,i)}processObjects(e){const n=new Kr;n.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,a.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},o[this.name]=!0);const s=i.extensions[this.name].lights;s.push(a),n.extensions=n.extensions||{},n.extensions[this.name]={light:s.length-1}}}let Ac=class{constructor(t){this.writer=t,this.name="KHR_materials_unlit"}writeMaterial(t,e){if(!t.isMeshBasicMaterial)return;const n=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},n[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}},_c=class{constructor(t){this.writer=t,this.name="KHR_materials_clearcoat"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.clearcoat===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.clearcoatFactor=t.clearcoat,t.clearcoatMap){const o={index:n.processTexture(t.clearcoatMap),texCoord:t.clearcoatMap.channel};n.applyTextureTransform(o,t.clearcoatMap),i.clearcoatTexture=o}if(i.clearcoatRoughnessFactor=t.clearcoatRoughness,t.clearcoatRoughnessMap){const o={index:n.processTexture(t.clearcoatRoughnessMap),texCoord:t.clearcoatRoughnessMap.channel};n.applyTextureTransform(o,t.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o}if(t.clearcoatNormalMap){const o={index:n.processTexture(t.clearcoatNormalMap),texCoord:t.clearcoatNormalMap.channel};n.applyTextureTransform(o,t.clearcoatNormalMap),i.clearcoatNormalTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},kc=class{constructor(t){this.writer=t,this.name="KHR_materials_iridescence"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.iridescence===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.iridescenceFactor=t.iridescence,t.iridescenceMap){const o={index:n.processTexture(t.iridescenceMap),texCoord:t.iridescenceMap.channel};n.applyTextureTransform(o,t.iridescenceMap),i.iridescenceTexture=o}if(i.iridescenceIor=t.iridescenceIOR,i.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1],t.iridescenceThicknessMap){const o={index:n.processTexture(t.iridescenceThicknessMap),texCoord:t.iridescenceThicknessMap.channel};n.applyTextureTransform(o,t.iridescenceThicknessMap),i.iridescenceThicknessTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Ec=class{constructor(t){this.writer=t,this.name="KHR_materials_transmission"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.transmission===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.transmissionFactor=t.transmission,t.transmissionMap){const o={index:n.processTexture(t.transmissionMap),texCoord:t.transmissionMap.channel};n.applyTextureTransform(o,t.transmissionMap),i.transmissionTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Mc=class{constructor(t){this.writer=t,this.name="KHR_materials_volume"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.transmission===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.thicknessFactor=t.thickness,t.thicknessMap){const o={index:n.processTexture(t.thicknessMap),texCoord:t.thicknessMap.channel};n.applyTextureTransform(o,t.thicknessMap),i.thicknessTexture=o}i.attenuationDistance=t.attenuationDistance,i.attenuationColor=t.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Sc=class{constructor(t){this.writer=t,this.name="KHR_materials_ior"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.ior===1.5)return;const n=this.writer.extensionsUsed,r={};r.ior=t.ior,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}},Ic=class{constructor(t){this.writer=t,this.name="KHR_materials_specular"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.specularIntensity===1&&t.specularColor.equals(pc)&&!t.specularIntensityMap&&!t.specularColorTexture)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.specularIntensityMap){const o={index:n.processTexture(t.specularIntensityMap),texCoord:t.specularIntensityMap.channel};n.applyTextureTransform(o,t.specularIntensityMap),i.specularTexture=o}if(t.specularColorMap){const o={index:n.processTexture(t.specularColorMap),texCoord:t.specularColorMap.channel};n.applyTextureTransform(o,t.specularColorMap),i.specularColorTexture=o}i.specularFactor=t.specularIntensity,i.specularColorFactor=t.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Rc=class{constructor(t){this.writer=t,this.name="KHR_materials_sheen"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.sheen==0)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.sheenRoughnessMap){const o={index:n.processTexture(t.sheenRoughnessMap),texCoord:t.sheenRoughnessMap.channel};n.applyTextureTransform(o,t.sheenRoughnessMap),i.sheenRoughnessTexture=o}if(t.sheenColorMap){const o={index:n.processTexture(t.sheenColorMap),texCoord:t.sheenColorMap.channel};n.applyTextureTransform(o,t.sheenColorMap),i.sheenColorTexture=o}i.sheenRoughnessFactor=t.sheenRoughness,i.sheenColorFactor=t.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Cc=class{constructor(t){this.writer=t,this.name="KHR_materials_anisotropy"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.anisotropy==0)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.anisotropyMap){const o={index:n.processTexture(t.anisotropyMap)};n.applyTextureTransform(o,t.anisotropyMap),i.anisotropyTexture=o}i.anisotropyStrength=t.anisotropy,i.anisotropyRotation=t.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Nc=class{constructor(t){this.writer=t,this.name="KHR_materials_emissive_strength"}writeMaterial(t,e){if(!t.isMeshStandardMaterial||t.emissiveIntensity===1)return;const n=this.writer.extensionsUsed,r={};r.emissiveStrength=t.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}};var En=Uint8Array,ls=Uint16Array,Lc=Uint32Array,Pc=new En([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]),Dc=new En([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]),us=function(t,e){for(var n=new ls(31),r=0;r<31;++r)n[r]=e+=1<>>1|(Le&21845)<<1;Mt=(Mt&52428)>>>2|(Mt&13107)<<2,Mt=(Mt&61680)>>>4|(Mt&3855)<<4,Bc[Le]=((Mt&65280)>>>8|(Mt&255)<<8)>>>1}var ar=new En(288);for(var Le=0;Le<144;++Le)ar[Le]=8;for(var Le=144;Le<256;++Le)ar[Le]=9;for(var Le=256;Le<280;++Le)ar[Le]=7;for(var Le=280;Le<288;++Le)ar[Le]=8;var zc=new En(32);for(var Le=0;Le<32;++Le)zc[Le]=5;var Uc=new En(0),jc=typeof TextDecoder<"u"&&new TextDecoder,Vc=0;try{jc.decode(Uc,{stream:!0}),Vc=1}catch{}var Hc=Object.defineProperty,Gc=(t,e,n)=>e in t?Hc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$c=(t,e,n)=>(Gc(t,e+"",n),n);const fs=class extends jt{constructor(t,e={}){super(t),this.isReflector=!0,this.type="Reflector",this.camera=new Nt;const n=this,r=e.color!==void 0?new je(e.color):new je(8355711),i=e.textureWidth||512,o=e.textureHeight||512,a=e.clipBias||0,s=e.shader||fs.ReflectorShader,l=e.multisample!==void 0?e.multisample:4,u=new Oa,c=new ae,f=new ae,p=new ae,d=new _t,y=new ae(0,0,-1),v=new Lt,x=new ae,T=new ae,M=new Lt,k=new _t,C=this.camera,P=new Ul(i,o,{samples:l,type:jl}),h=new kn({uniforms:vi.clone(s.uniforms),fragmentShader:s.fragmentShader,vertexShader:s.vertexShader});h.uniforms.tDiffuse.value=P.texture,h.uniforms.color.value=r,h.uniforms.textureMatrix.value=k,this.material=h,this.onBeforeRender=function(I,b,g){if(f.setFromMatrixPosition(n.matrixWorld),p.setFromMatrixPosition(g.matrixWorld),d.extractRotation(n.matrixWorld),c.set(0,0,1),c.applyMatrix4(d),x.subVectors(f,p),x.dot(c)>0)return;x.reflect(c).negate(),x.add(f),d.extractRotation(g.matrixWorld),y.set(0,0,-1),y.applyMatrix4(d),y.add(p),T.subVectors(f,y),T.reflect(c).negate(),T.add(f),C.position.copy(x),C.up.set(0,1,0),C.up.applyMatrix4(d),C.up.reflect(c),C.lookAt(T),C.far=g.far,C.updateMatrixWorld(),C.projectionMatrix.copy(g.projectionMatrix),k.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),k.multiply(C.projectionMatrix),k.multiply(C.matrixWorldInverse),k.multiply(n.matrixWorld),u.setFromNormalAndCoplanarPoint(c,f),u.applyMatrix4(C.matrixWorldInverse),v.set(u.normal.x,u.normal.y,u.normal.z,u.constant);const m=C.projectionMatrix;M.x=(Math.sign(v.x)+m.elements[8])/m.elements[0],M.y=(Math.sign(v.y)+m.elements[9])/m.elements[5],M.z=-1,M.w=(1+m.elements[10])/m.elements[14],v.multiplyScalar(2/v.dot(M)),m.elements[2]=v.x,m.elements[6]=v.y,m.elements[10]=v.z+1-a,m.elements[14]=v.w,n.visible=!1;const A=I.getRenderTarget(),S=I.xr.enabled,B=I.shadowMap.autoUpdate,D=I.toneMapping;let F=!1;"outputColorSpace"in I?F=I.outputColorSpace==="srgb":F=I.outputEncoding===3001,I.xr.enabled=!1,I.shadowMap.autoUpdate=!1,"outputColorSpace"in I?I.outputColorSpace="srgb-linear":I.outputEncoding=3e3,I.toneMapping=Vl,I.setRenderTarget(P),I.state.buffers.depth.setMask(!0),I.autoClear===!1&&I.clear(),I.render(b,C),I.xr.enabled=S,I.shadowMap.autoUpdate=B,I.toneMapping=D,"outputColorSpace"in I?I.outputColorSpace=F?"srgb":"srgb-linear":I.outputEncoding=F?3001:3e3,I.setRenderTarget(A);const j=g.viewport;j!==void 0&&I.state.viewport(j),n.visible=!0},this.getRenderTarget=function(){return P},this.dispose=function(){P.dispose(),n.material.dispose()}}};let Qr=fs;$c(Qr,"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 <${Ei>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});var qc=Object.defineProperty,Yc=(t,e,n)=>e in t?qc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ds=(t,e,n)=>(Yc(t,typeof e!="symbol"?e+"":e,n),n);const sr=new Fa,Kc=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),ps=new Ba(Kc,5);sr.setIndex([0,1,2,0,2,3]);sr.setAttribute("position",new yi(ps,3,0,!1));sr.setAttribute("uv",new yi(ps,2,3,!1));const Zr=class extends jt{constructor(){super(Zr.Geometry,new Wt({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const t=new ae,e=new ae,n=new Yi(new Uint8Array(16*16*3),16,16,Yr);n.minFilter=Ut,n.magFilter=Ut,n.wrapS=Xt,n.wrapT=Xt;const r=new Yi(new Uint8Array(16*16*3),16,16,Yr);r.minFilter=Ut,r.magFilter=Ut,r.wrapS=Xt,r.wrapT=Xt;const i=Zr.Geometry,o=new dr({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + + void main() { + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + void main() { + + gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 ); + + }`,depthTest:!0,depthWrite:!1,transparent:!1}),a=new dr({uniforms:{map:{value:n},scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + attribute vec2 uv; + + varying vec2 vUV; + + void main() { + + vUV = uv; + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + uniform sampler2D map; + + varying vec2 vUV; + + void main() { + + gl_FragColor = texture2D( map, vUV ); + + }`,depthTest:!1,depthWrite:!1,transparent:!1}),s=new jt(i,o),l=[],u=hs.Shader,c=new dr({uniforms:{map:{value:null},occlusionMap:{value:r},color:{value:new je(16777215)},scale:{value:new De},screenPosition:{value:new ae}},vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:Hl,transparent:!0,depthWrite:!1}),f=new jt(i,c);this.addElement=function(x){l.push(x)};const p=new De,d=new De,y=new Gl,v=new Lt;this.onBeforeRender=function(x,T,M){x.getCurrentViewport(v);const k=v.w/v.z,C=v.z/2,P=v.w/2;let h=16/v.w;if(p.set(h*k,h),y.min.set(v.x,v.y),y.max.set(v.x+(v.z-16),v.y+(v.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(M.matrixWorldInverse),!(e.z>0)&&(t.copy(e).applyMatrix4(M.projectionMatrix),d.x=v.x+t.x*C+C-8,d.y=v.y+t.y*P+P-8,y.containsPoint(d))){x.copyFramebufferToTexture(d,n);let I=o.uniforms;I.scale.value=p,I.screenPosition.value=t,x.renderBufferDirect(M,null,i,o,s,null),x.copyFramebufferToTexture(d,r),I=a.uniforms,I.scale.value=p,I.screenPosition.value=t,x.renderBufferDirect(M,null,i,a,s,null);const b=-t.x*2,g=-t.y*2;for(let m=0,A=l.length;me in t?Xc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ms=(t,e,n)=>(Qc(t,typeof e!="symbol"?e+"":e,n),n);const Vn={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new ae},up:{value:new ae(0,1,0)}},vertexShader:` + uniform vec3 sunPosition; + uniform float rayleigh; + uniform float turbidity; + uniform float mieCoefficient; + uniform vec3 up; + + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + // constants for atmospheric scattering + const float e = 2.71828182845904523536028747135266249775724709369995957; + const float pi = 3.141592653589793238462643383279502884197169; + + // wavelength of used primaries, according to preetham + const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); + // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: + // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) + const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); + + // mie stuff + // K coefficient for the primaries + const float v = 4.0; + const vec3 K = vec3( 0.686, 0.678, 0.666 ); + // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K + const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); + + // earth shadow hack + // cutoffAngle = pi / 1.95; + const float cutoffAngle = 1.6110731556870734; + const float steepness = 1.5; + const float EE = 1000.0; + + float sunIntensity( float zenithAngleCos ) { + zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); + return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); + } + + vec3 totalMie( float T ) { + float c = ( 0.2 * T ) * 10E-18; + return 0.434 * c * MieConst; + } + + void main() { + + vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + gl_Position.z = gl_Position.w; // set z to camera.far + + vSunDirection = normalize( sunPosition ); + + vSunE = sunIntensity( dot( vSunDirection, up ) ); + + vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); + + float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); + + // extinction (absorbtion + out scattering) + // rayleigh coefficients + vBetaR = totalRayleigh * rayleighCoefficient; + + // mie coefficients + vBetaM = totalMie( turbidity ) * mieCoefficient; + + } + `,fragmentShader:` + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + uniform float mieDirectionalG; + uniform vec3 up; + + const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); + + // constants for atmospheric scattering + const float pi = 3.141592653589793238462643383279502884197169; + + const float n = 1.0003; // refractive index of air + const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) + + // optical length at zenith for molecules + const float rayleighZenithLength = 8.4E3; + const float mieZenithLength = 1.25E3; + // 66 arc seconds -> degrees, and the cosine of that + const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; + + // 3.0 / ( 16.0 * pi ) + const float THREE_OVER_SIXTEENPI = 0.05968310365946075; + // 1.0 / ( 4.0 * pi ) + const float ONE_OVER_FOURPI = 0.07957747154594767; + + float rayleighPhase( float cosTheta ) { + return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); + } + + float hgPhase( float cosTheta, float g ) { + float g2 = pow( g, 2.0 ); + float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); + return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); + } + + void main() { + + vec3 direction = normalize( vWorldPosition - cameraPos ); + + // optical length + // cutoff angle at 90 to avoid singularity in next formula. + float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); + float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); + float sR = rayleighZenithLength * inverse; + float sM = mieZenithLength * inverse; + + // combined extinction factor + vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); + + // in scattering + float cosTheta = dot( direction, vSunDirection ); + + float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); + vec3 betaRTheta = vBetaR * rPhase; + + float mPhase = hgPhase( cosTheta, mieDirectionalG ); + vec3 betaMTheta = vBetaM * mPhase; + + vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); + Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); + + // nightsky + float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] + float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] + vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); + vec3 L0 = vec3( 0.1 ) * Fex; + + // composition + solar disc + float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); + L0 += ( vSunE * 19000.0 * Fex ) * sundisk; + + vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); + + vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); + + gl_FragColor = vec4( retColor, 1.0 ); + + #include + #include <${Ei>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},gs=new kn({name:"SkyShader",fragmentShader:Vn.fragmentShader,vertexShader:Vn.vertexShader,uniforms:vi.clone(Vn.uniforms),side:Il,depthWrite:!1});class ys extends jt{constructor(){super(new zl(1,1,1),gs)}}ms(ys,"SkyShader",Vn);ms(ys,"material",gs);new Rl;new ae;new za(0,0,0,"YXZ");new ae;var Zc=Object.defineProperty,Jc=(t,e,n)=>e in t?Zc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ne=(t,e,n)=>(Jc(t,typeof e!="symbol"?e+"":e,n),n);const Dn=new Sl,uo=new Oa,ef=Math.cos(70*(Math.PI/180)),co=(t,e)=>(t%e+e)%e;class tf extends Ml{constructor(e,n){super(),ne(this,"object"),ne(this,"domElement"),ne(this,"enabled",!0),ne(this,"target",new ae),ne(this,"minDistance",0),ne(this,"maxDistance",1/0),ne(this,"minZoom",0),ne(this,"maxZoom",1/0),ne(this,"minPolarAngle",0),ne(this,"maxPolarAngle",Math.PI),ne(this,"minAzimuthAngle",-1/0),ne(this,"maxAzimuthAngle",1/0),ne(this,"enableDamping",!1),ne(this,"dampingFactor",.05),ne(this,"enableZoom",!0),ne(this,"zoomSpeed",1),ne(this,"enableRotate",!0),ne(this,"rotateSpeed",1),ne(this,"enablePan",!0),ne(this,"panSpeed",1),ne(this,"screenSpacePanning",!0),ne(this,"keyPanSpeed",7),ne(this,"zoomToCursor",!1),ne(this,"autoRotate",!1),ne(this,"autoRotateSpeed",2),ne(this,"reverseOrbit",!1),ne(this,"reverseHorizontalOrbit",!1),ne(this,"reverseVerticalOrbit",!1),ne(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ne(this,"mouseButtons",{LEFT:Tt.ROTATE,MIDDLE:Tt.DOLLY,RIGHT:Tt.PAN}),ne(this,"touches",{ONE:Rt.ROTATE,TWO:Rt.DOLLY_PAN}),ne(this,"target0"),ne(this,"position0"),ne(this,"zoom0"),ne(this,"_domElementKeyEvents",null),ne(this,"getPolarAngle"),ne(this,"getAzimuthalAngle"),ne(this,"setPolarAngle"),ne(this,"setAzimuthalAngle"),ne(this,"getDistance"),ne(this,"getZoomScale"),ne(this,"listenToKeyEvents"),ne(this,"stopListenToKeyEvents"),ne(this,"saveState"),ne(this,"reset"),ne(this,"update"),ne(this,"connect"),ne(this,"dispose"),ne(this,"dollyIn"),ne(this,"dollyOut"),ne(this,"getScale"),ne(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>c.phi,this.getAzimuthalAngle=()=>c.theta,this.setPolarAngle=L=>{let q=co(L,2*Math.PI),X=c.phi;X<0&&(X+=2*Math.PI),q<0&&(q+=2*Math.PI);let Me=Math.abs(q-X);2*Math.PI-Me{let q=co(L,2*Math.PI),X=c.theta;X<0&&(X+=2*Math.PI),q<0&&(q+=2*Math.PI);let Me=Math.abs(q-X);2*Math.PI-Mer.object.position.distanceTo(r.target),this.listenToKeyEvents=L=>{L.addEventListener("keydown",ie),this._domElementKeyEvents=L},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ie),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=s.NONE},this.update=(()=>{const L=new ae,q=new ae(0,1,0),X=new $n().setFromUnitVectors(e.up,q),Me=X.clone().invert(),et=new ae,ft=new $n,Rn=2*Math.PI;return function(){const Gi=r.object.position;X.setFromUnitVectors(e.up,q),Me.copy(X).invert(),L.copy(Gi).sub(r.target),L.applyQuaternion(X),c.setFromVector3(L),r.autoRotate&&l===s.NONE&&D(S()),r.enableDamping?(c.theta+=f.theta*r.dampingFactor,c.phi+=f.phi*r.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let xt=r.minAzimuthAngle,bt=r.maxAzimuthAngle;isFinite(xt)&&isFinite(bt)&&(xt<-Math.PI?xt+=Rn:xt>Math.PI&&(xt-=Rn),bt<-Math.PI?bt+=Rn:bt>Math.PI&&(bt-=Rn),xt<=bt?c.theta=Math.max(xt,Math.min(bt,c.theta)):c.theta=c.theta>(xt+bt)/2?Math.max(xt,c.theta):Math.min(bt,c.theta)),c.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,c.phi)),c.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(d,r.dampingFactor):r.target.add(d),r.zoomToCursor&&g||r.object.isOrthographicCamera?c.radius=R(c.radius):c.radius=R(c.radius*p),L.setFromSpherical(c),L.applyQuaternion(Me),Gi.copy(r.target).add(L),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,d.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),d.set(0,0,0));let un=!1;if(r.zoomToCursor&&g){let cn=null;if(r.object instanceof Nt&&r.object.isPerspectiveCamera){const fn=L.length();cn=R(fn*p);const Cn=fn-cn;r.object.position.addScaledVector(I,Cn),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const fn=new ae(b.x,b.y,0);fn.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),un=!0;const Cn=new ae(b.x,b.y,0);Cn.unproject(r.object),r.object.position.sub(Cn).add(fn),r.object.updateMatrixWorld(),cn=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;cn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(cn).add(r.object.position):(Dn.origin.copy(r.object.position),Dn.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(Dn.direction))u||8*(1-ft.dot(r.object.quaternion))>u?(r.dispatchEvent(i),et.copy(r.object.position),ft.copy(r.object.quaternion),un=!1,!0):!1}})(),this.connect=L=>{r.domElement=L,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",$e),r.domElement.addEventListener("pointerdown",Se),r.domElement.addEventListener("pointercancel",it),r.domElement.addEventListener("wheel",K)},this.dispose=()=>{var L,q,X,Me,et,ft;r.domElement&&(r.domElement.style.touchAction="auto"),(L=r.domElement)==null||L.removeEventListener("contextmenu",$e),(q=r.domElement)==null||q.removeEventListener("pointerdown",Se),(X=r.domElement)==null||X.removeEventListener("pointercancel",it),(Me=r.domElement)==null||Me.removeEventListener("wheel",K),(et=r.domElement)==null||et.ownerDocument.removeEventListener("pointermove",Ge),(ft=r.domElement)==null||ft.ownerDocument.removeEventListener("pointerup",it),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ie)};const r=this,i={type:"change"},o={type:"start"},a={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=s.NONE;const u=1e-6,c=new qi,f=new qi;let p=1;const d=new ae,y=new De,v=new De,x=new De,T=new De,M=new De,k=new De,C=new De,P=new De,h=new De,I=new ae,b=new De;let g=!1;const m=[],A={};function S(){return 2*Math.PI/60/60*r.autoRotateSpeed}function B(){return Math.pow(.95,r.zoomSpeed)}function D(L){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=L:f.theta-=L}function F(L){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=L:f.phi-=L}const j=(()=>{const L=new ae;return function(q,X){L.setFromMatrixColumn(X,0),L.multiplyScalar(-q),d.add(L)}})(),J=(()=>{const L=new ae;return function(q,X){r.screenSpacePanning===!0?L.setFromMatrixColumn(X,1):(L.setFromMatrixColumn(X,0),L.crossVectors(r.object.up,L)),L.multiplyScalar(q),d.add(L)}})(),oe=(()=>{const L=new ae;return function(q,X){const Me=r.domElement;if(Me&&r.object instanceof Nt&&r.object.isPerspectiveCamera){const et=r.object.position;L.copy(et).sub(r.target);let ft=L.length();ft*=Math.tan(r.object.fov/2*Math.PI/180),j(2*q*ft/Me.clientHeight,r.object.matrix),J(2*X*ft/Me.clientHeight,r.object.matrix)}else Me&&r.object instanceof Qt&&r.object.isOrthographicCamera?(j(q*(r.object.right-r.object.left)/r.object.zoom/Me.clientWidth,r.object.matrix),J(X*(r.object.top-r.object.bottom)/r.object.zoom/Me.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function Z(L){r.object instanceof Nt&&r.object.isPerspectiveCamera||r.object instanceof Qt&&r.object.isOrthographicCamera?p=L:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function _(L){Z(p/L)}function ee(L){Z(p*L)}function ge(L){if(!r.zoomToCursor||!r.domElement)return;g=!0;const q=r.domElement.getBoundingClientRect(),X=L.clientX-q.left,Me=L.clientY-q.top,et=q.width,ft=q.height;b.x=X/et*2-1,b.y=-(Me/ft)*2+1,I.set(b.x,b.y,1).unproject(r.object).sub(r.object.position).normalize()}function R(L){return Math.max(r.minDistance,Math.min(r.maxDistance,L))}function ye(L){y.set(L.clientX,L.clientY)}function _e(L){ge(L),C.set(L.clientX,L.clientY)}function ve(L){T.set(L.clientX,L.clientY)}function Fe(L){v.set(L.clientX,L.clientY),x.subVectors(v,y).multiplyScalar(r.rotateSpeed);const q=r.domElement;q&&(D(2*Math.PI*x.x/q.clientHeight),F(2*Math.PI*x.y/q.clientHeight)),y.copy(v),r.update()}function G(L){P.set(L.clientX,L.clientY),h.subVectors(P,C),h.y>0?_(B()):h.y<0&&ee(B()),C.copy(P),r.update()}function w(L){M.set(L.clientX,L.clientY),k.subVectors(M,T).multiplyScalar(r.panSpeed),oe(k.x,k.y),T.copy(M),r.update()}function E(L){ge(L),L.deltaY<0?ee(B()):L.deltaY>0&&_(B()),r.update()}function N(L){let q=!1;switch(L.code){case r.keys.UP:oe(0,r.keyPanSpeed),q=!0;break;case r.keys.BOTTOM:oe(0,-r.keyPanSpeed),q=!0;break;case r.keys.LEFT:oe(r.keyPanSpeed,0),q=!0;break;case r.keys.RIGHT:oe(-r.keyPanSpeed,0),q=!0;break}q&&(L.preventDefault(),r.update())}function H(){if(m.length==1)y.set(m[0].pageX,m[0].pageY);else{const L=.5*(m[0].pageX+m[1].pageX),q=.5*(m[0].pageY+m[1].pageY);y.set(L,q)}}function z(){if(m.length==1)T.set(m[0].pageX,m[0].pageY);else{const L=.5*(m[0].pageX+m[1].pageX),q=.5*(m[0].pageY+m[1].pageY);T.set(L,q)}}function Y(){const L=m[0].pageX-m[1].pageX,q=m[0].pageY-m[1].pageY,X=Math.sqrt(L*L+q*q);C.set(0,X)}function te(){r.enableZoom&&Y(),r.enablePan&&z()}function xe(){r.enableZoom&&Y(),r.enableRotate&&H()}function ke(L){if(m.length==1)v.set(L.pageX,L.pageY);else{const X=vt(L),Me=.5*(L.pageX+X.x),et=.5*(L.pageY+X.y);v.set(Me,et)}x.subVectors(v,y).multiplyScalar(r.rotateSpeed);const q=r.domElement;q&&(D(2*Math.PI*x.x/q.clientHeight),F(2*Math.PI*x.y/q.clientHeight)),y.copy(v)}function de(L){if(m.length==1)M.set(L.pageX,L.pageY);else{const q=vt(L),X=.5*(L.pageX+q.x),Me=.5*(L.pageY+q.y);M.set(X,Me)}k.subVectors(M,T).multiplyScalar(r.panSpeed),oe(k.x,k.y),T.copy(M)}function be(L){const q=vt(L),X=L.pageX-q.x,Me=L.pageY-q.y,et=Math.sqrt(X*X+Me*Me);P.set(0,et),h.set(0,Math.pow(P.y/C.y,r.zoomSpeed)),_(h.y),C.copy(P)}function Re(L){r.enableZoom&&be(L),r.enablePan&&de(L)}function Te(L){r.enableZoom&&be(L),r.enableRotate&&ke(L)}function Se(L){var q,X;r.enabled!==!1&&(m.length===0&&((q=r.domElement)==null||q.ownerDocument.addEventListener("pointermove",Ge),(X=r.domElement)==null||X.ownerDocument.addEventListener("pointerup",it)),yt(L),L.pointerType==="touch"?ce(L):ln(L))}function Ge(L){r.enabled!==!1&&(L.pointerType==="touch"?we(L):U(L))}function it(L){var q,X,Me;ct(L),m.length===0&&((q=r.domElement)==null||q.releasePointerCapture(L.pointerId),(X=r.domElement)==null||X.ownerDocument.removeEventListener("pointermove",Ge),(Me=r.domElement)==null||Me.ownerDocument.removeEventListener("pointerup",it)),r.dispatchEvent(a),l=s.NONE}function ln(L){let q;switch(L.button){case 0:q=r.mouseButtons.LEFT;break;case 1:q=r.mouseButtons.MIDDLE;break;case 2:q=r.mouseButtons.RIGHT;break;default:q=-1}switch(q){case Tt.DOLLY:if(r.enableZoom===!1)return;_e(L),l=s.DOLLY;break;case Tt.ROTATE:if(L.ctrlKey||L.metaKey||L.shiftKey){if(r.enablePan===!1)return;ve(L),l=s.PAN}else{if(r.enableRotate===!1)return;ye(L),l=s.ROTATE}break;case Tt.PAN:if(L.ctrlKey||L.metaKey||L.shiftKey){if(r.enableRotate===!1)return;ye(L),l=s.ROTATE}else{if(r.enablePan===!1)return;ve(L),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function U(L){if(r.enabled!==!1)switch(l){case s.ROTATE:if(r.enableRotate===!1)return;Fe(L);break;case s.DOLLY:if(r.enableZoom===!1)return;G(L);break;case s.PAN:if(r.enablePan===!1)return;w(L);break}}function K(L){r.enabled===!1||r.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(L.preventDefault(),r.dispatchEvent(o),E(L),r.dispatchEvent(a))}function ie(L){r.enabled===!1||r.enablePan===!1||N(L)}function ce(L){switch(Et(L),m.length){case 1:switch(r.touches.ONE){case Rt.ROTATE:if(r.enableRotate===!1)return;H(),l=s.TOUCH_ROTATE;break;case Rt.PAN:if(r.enablePan===!1)return;z(),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(r.touches.TWO){case Rt.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;te(),l=s.TOUCH_DOLLY_PAN;break;case Rt.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;xe(),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function we(L){switch(Et(L),l){case s.TOUCH_ROTATE:if(r.enableRotate===!1)return;ke(L),r.update();break;case s.TOUCH_PAN:if(r.enablePan===!1)return;de(L),r.update();break;case s.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Re(L),r.update();break;case s.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Te(L),r.update();break;default:l=s.NONE}}function $e(L){r.enabled!==!1&&L.preventDefault()}function yt(L){m.push(L)}function ct(L){delete A[L.pointerId];for(let q=0;q{ee(L),r.update()},this.dollyOut=(L=B())=>{_(L),r.update()},this.getScale=()=>p,this.setScale=L=>{Z(L),r.update()},this.getZoomScale=()=>B(),n!==void 0&&this.connect(n),this.update()}}new _t;new ae;new za;new ae;var nf=Object.defineProperty,rf=(t,e,n)=>e in t?nf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Mi=(t,e,n)=>(rf(t,typeof e!="symbol"?e+"":e,n),n);class vs{constructor(e){Mi(this,"data"),this.data=e}generateShapes(e,n=100,r){const i=[],o={letterSpacing:0,lineHeight:1,...r},a=of(e,n,this.data,o);for(let s=0,l=a.length;s + #include + #include + uniform float thickness; + uniform bool screenspace; + uniform vec2 size; + void main() { + #if defined (USE_SKINNING) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + vec4 tNormal = vec4(normal, 0.0); + vec4 tPosition = vec4(transformed, 1.0); + #ifdef USE_INSTANCING + tNormal = instanceMatrix * tNormal; + tPosition = instanceMatrix * tPosition; + #endif + if (screenspace) { + vec3 newPosition = tPosition.xyz + tNormal.xyz * thickness; + gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0); + } else { + vec4 clipPosition = projectionMatrix * modelViewMatrix * tPosition; + vec4 clipNormal = projectionMatrix * modelViewMatrix * tNormal; + vec2 offset = normalize(clipNormal.xy) * thickness / size * clipPosition.w * 2.0; + clipPosition.xy += offset; + gl_Position = clipPosition; + } + }`,`uniform vec3 color; + uniform float opacity; + void main(){ + gl_FragColor = vec4(color, opacity); + #include + #include + }`);const sf=["args","material-uniforms-color-value"];Qr.ReflectorShader;new ae;new ae;new ae;var Tr;/Mac/.test((Tr=globalThis==null?void 0:globalThis.navigator)===null||Tr===void 0?void 0:Tr.platform);const lf=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","mouse-buttons","args"],uf=ze({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{default:()=>({ONE:Rt.ROTATE,TWO:Rt.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1},mouseButtons:{default:()=>({LEFT:Tt.ROTATE,MIDDLE:Tt.DOLLY,RIGHT:Tt.PAN})}},emits:["change","start","end"],setup(t,{expose:e,emit:n}){const r=t,i=n,{makeDefault:o,autoRotate:a,autoRotateSpeed:s,enableDamping:l,dampingFactor:u,enablePan:c,keyPanSpeed:f,maxAzimuthAngle:p,minAzimuthAngle:d,maxPolarAngle:y,minPolarAngle:v,minDistance:x,maxDistance:T,minZoom:M,maxZoom:k,enableZoom:C,zoomSpeed:P,enableRotate:h,touches:I,rotateSpeed:b,target:g,mouseButtons:m}=mi(r),{camera:A,renderer:S,extend:B,controls:D,invalidate:F}=rr(),j=Da(null);B({OrbitControls:tf}),Ue(j,Z=>{J(),Z&&o.value?D.value=Z:D.value=null});function J(){yr(j.value,"change",()=>{i("change",j.value),F()}),yr(j.value,"start",()=>i("start",j.value)),yr(j.value,"end",()=>i("end",j.value))}const{onBeforeRender:oe}=Gn();return oe(({invalidate:Z})=>{j.value&&(l.value||a.value)&&(j.value.update(),a.value&&Z())}),Ht(()=>{j.value&&j.value.dispose()}),e({instance:j}),(Z,_)=>(Z.camera||V(A))&&(Z.domElement||V(S))?(Q(),re("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:j,target:V(g),"auto-rotate":V(a),"auto-rotate-speed":V(s),"enable-damping":V(l),"damping-factor":V(u),"enable-pan":V(c),"key-pan-speed":V(f),keys:Z.keys,"max-azimuth-angle":V(p),"min-azimuth-angle":V(d),"max-polar-angle":V(y),"min-polar-angle":V(v),"min-distance":V(x),"max-distance":V(T),"min-zoom":V(M),"max-zoom":V(k),touches:V(I),"enable-zoom":V(C),"zoom-speed":V(P),"enable-rotate":V(h),"rotate-speed":V(b),"mouse-buttons":V(m),args:[Z.camera||V(A),Z.domElement||V(S).domElement]},null,8,lf)):ut("",!0)}});function On(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var fo={exports:{}},po;function cf(){return po||(po=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,o){function a(u,c){if(!i[u]){if(!r[u]){var f=typeof On=="function"&&On;if(!c&&f)return f(u,!0);if(s)return s(u,!0);throw new Error("Cannot find module '"+u+"'")}c=i[u]={exports:{}},r[u][0].call(c.exports,function(p){var d=r[u][1][p];return a(d||p)},c,c.exports,n,r,i,o)}return i[u].exports}for(var s=typeof On=="function"&&On,l=0;l>16),F((65280&m)>>8),F(255&m);return A==2?F(255&(m=I(b.charAt(g))<<2|I(b.charAt(g+1))>>4)):A==1&&(F((m=I(b.charAt(g))<<10|I(b.charAt(g+1))<<4|I(b.charAt(g+2))>>2)>>8&255),F(255&m)),S},y.fromByteArray=function(b){var g,m,A,S,B=b.length%3,D="";function F(j){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(j)}for(g=0,A=b.length-B;g>18&63)+F(S>>12&63)+F(S>>6&63)+F(63&S);switch(B){case 1:D=(D+=F((m=b[b.length-1])>>2))+F(m<<4&63)+"==";break;case 2:D=(D=(D+=F((m=(b[b.length-2]<<8)+b[b.length-1])>>10))+F(m>>4&63))+F(m<<2&63)+"="}return D}})(i===void 0?this.base64js={}:i)}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(n,r,i){(function(o,a,x,l,u,c,f,p,d){var y=n("base64-js"),v=n("ieee754");function x(w,E,N){if(!(this instanceof x))return new x(w,E,N);var H,z,Y,te,xe=typeof w;if(E==="base64"&&xe=="string")for(w=(te=w).trim?te.trim():te.replace(/^\s+|\s+$/g,"");w.length%4!=0;)w+="=";if(xe=="number")H=oe(w);else if(xe=="string")H=x.byteLength(w,E);else{if(xe!="object")throw new Error("First argument needs to be a number, array or string.");H=oe(w.length)}if(x._useTypedArrays?z=x._augment(new Uint8Array(H)):((z=this).length=H,z._isBuffer=!0),x._useTypedArrays&&typeof w.byteLength=="number")z._set(w);else if(Z(te=w)||x.isBuffer(te)||te&&typeof te=="object"&&typeof te.length=="number")for(Y=0;Y>8,te=te%256,xe.push(te),xe.push(Y);return xe}(E),w,N,H)}function k(w,E,N){var H="";N=Math.min(w.length,N);for(var z=E;z>>0)):(E+1>>0),z}function h(w,E,N,H){if(H||(G(typeof N=="boolean","missing or invalid endian"),G(E!=null,"missing offset"),G(E+1>>8*(H?Y:1-Y)}function A(w,E,N,H,z){if(z||(G(E!=null,"missing value"),G(typeof H=="boolean","missing or invalid endian"),G(N!=null,"missing offset"),G(N+3>>8*(H?Y:3-Y)&255}function S(w,E,N,H,z){z||(G(E!=null,"missing value"),G(typeof H=="boolean","missing or invalid endian"),G(N!=null,"missing offset"),G(N+1this.length&&(H=this.length);var z=(H=w.length-E=this.length))return this[w]},x.prototype.readUInt16LE=function(w,E){return C(this,w,!0,E)},x.prototype.readUInt16BE=function(w,E){return C(this,w,!1,E)},x.prototype.readUInt32LE=function(w,E){return P(this,w,!0,E)},x.prototype.readUInt32BE=function(w,E){return P(this,w,!1,E)},x.prototype.readInt8=function(w,E){if(E||(G(w!=null,"missing offset"),G(w=this.length))return 128&this[w]?-1*(255-this[w]+1):this[w]},x.prototype.readInt16LE=function(w,E){return h(this,w,!0,E)},x.prototype.readInt16BE=function(w,E){return h(this,w,!1,E)},x.prototype.readInt32LE=function(w,E){return I(this,w,!0,E)},x.prototype.readInt32BE=function(w,E){return I(this,w,!1,E)},x.prototype.readFloatLE=function(w,E){return b(this,w,!0,E)},x.prototype.readFloatBE=function(w,E){return b(this,w,!1,E)},x.prototype.readDoubleLE=function(w,E){return g(this,w,!0,E)},x.prototype.readDoubleBE=function(w,E){return g(this,w,!1,E)},x.prototype.writeUInt8=function(w,E,N){N||(G(w!=null,"missing value"),G(E!=null,"missing offset"),G(E=this.length||(this[E]=w)},x.prototype.writeUInt16LE=function(w,E,N){m(this,w,E,!0,N)},x.prototype.writeUInt16BE=function(w,E,N){m(this,w,E,!1,N)},x.prototype.writeUInt32LE=function(w,E,N){A(this,w,E,!0,N)},x.prototype.writeUInt32BE=function(w,E,N){A(this,w,E,!1,N)},x.prototype.writeInt8=function(w,E,N){N||(G(w!=null,"missing value"),G(E!=null,"missing offset"),G(E=this.length||(0<=w?this.writeUInt8(w,E,N):this.writeUInt8(255+w+1,E,N))},x.prototype.writeInt16LE=function(w,E,N){S(this,w,E,!0,N)},x.prototype.writeInt16BE=function(w,E,N){S(this,w,E,!1,N)},x.prototype.writeInt32LE=function(w,E,N){B(this,w,E,!0,N)},x.prototype.writeInt32BE=function(w,E,N){B(this,w,E,!1,N)},x.prototype.writeFloatLE=function(w,E,N){D(this,w,E,!0,N)},x.prototype.writeFloatBE=function(w,E,N){D(this,w,E,!1,N)},x.prototype.writeDoubleLE=function(w,E,N){F(this,w,E,!0,N)},x.prototype.writeDoubleBE=function(w,E,N){F(this,w,E,!1,N)},x.prototype.fill=function(w,E,N){if(E=E||0,N=N||this.length,G(typeof(w=typeof(w=w||0)=="string"?w.charCodeAt(0):w)=="number"&&!isNaN(w),"value is not a number"),G(E<=N,"end < start"),N!==E&&this.length!==0){G(0<=E&&E"},x.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(x._useTypedArrays)return new x(this).buffer;for(var w=new Uint8Array(this.length),E=0,N=w.length;E=E.length||z>=w.length);z++)E[z+N]=w[z];return z}function ye(w){try{return decodeURIComponent(w)}catch{return"�"}}function _e(w,E){G(typeof w=="number","cannot write a non-number as a number"),G(0<=w,"specified a negative value for writing an unsigned value"),G(w<=E,"value is larger than maximum value for type"),G(Math.floor(w)===w,"value has a fractional component")}function ve(w,E,N){G(typeof w=="number","cannot write a non-number as a number"),G(w<=E,"value larger than maximum allowed value"),G(N<=w,"value smaller than minimum allowed value"),G(Math.floor(w)===w,"value has a fractional component")}function Fe(w,E,N){G(typeof w=="number","cannot write a non-number as a number"),G(w<=E,"value larger than maximum allowed value"),G(N<=w,"value smaller than minimum allowed value")}function G(w,E){if(!w)throw new Error(E||"Failed assertion")}x._augment=function(w){return w._isBuffer=!0,w._get=w.get,w._set=w.set,w.get=j.get,w.set=j.set,w.write=j.write,w.toString=j.toString,w.toLocaleString=j.toString,w.toJSON=j.toJSON,w.copy=j.copy,w.slice=j.slice,w.readUInt8=j.readUInt8,w.readUInt16LE=j.readUInt16LE,w.readUInt16BE=j.readUInt16BE,w.readUInt32LE=j.readUInt32LE,w.readUInt32BE=j.readUInt32BE,w.readInt8=j.readInt8,w.readInt16LE=j.readInt16LE,w.readInt16BE=j.readInt16BE,w.readInt32LE=j.readInt32LE,w.readInt32BE=j.readInt32BE,w.readFloatLE=j.readFloatLE,w.readFloatBE=j.readFloatBE,w.readDoubleLE=j.readDoubleLE,w.readDoubleBE=j.readDoubleBE,w.writeUInt8=j.writeUInt8,w.writeUInt16LE=j.writeUInt16LE,w.writeUInt16BE=j.writeUInt16BE,w.writeUInt32LE=j.writeUInt32LE,w.writeUInt32BE=j.writeUInt32BE,w.writeInt8=j.writeInt8,w.writeInt16LE=j.writeInt16LE,w.writeInt16BE=j.writeInt16BE,w.writeInt32LE=j.writeInt32LE,w.writeInt32BE=j.writeInt32BE,w.writeFloatLE=j.writeFloatLE,w.writeFloatBE=j.writeFloatBE,w.writeDoubleLE=j.writeDoubleLE,w.writeDoubleBE=j.writeDoubleBE,w.fill=j.fill,w.inspect=j.inspect,w.toArrayBuffer=j.toArrayBuffer,w}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(n,r,i){(function(o,a,y,l,u,c,f,p,d){var y=n("buffer").Buffer,v=4,x=new y(v);x.fill(0),r.exports={hash:function(T,M,k,C){for(var P=M(function(m,A){m.length%v!=0&&(S=m.length+(v-m.length%v),m=y.concat([m,x],S));for(var S,B=[],D=A?m.readInt32BE:m.readInt32LE,F=0;Fk?J=j(J):J.length>5]|=128<>>9<<4)]=I;for(var b=1732584193,g=-271733879,m=-1732584194,A=271733878,S=0;S>>32-m,b)}function T(h,I,b,g,m,A,S){return x(I&b|~I&g,h,I,m,A,S)}function M(h,I,b,g,m,A,S){return x(I&g|b&~g,h,I,m,A,S)}function k(h,I,b,g,m,A,S){return x(I^b^g,h,I,m,A,S)}function C(h,I,b,g,m,A,S){return x(b^(I|~g),h,I,m,A,S)}function P(h,I){var b=(65535&h)+(65535&I);return(h>>16)+(I>>16)+(b>>16)<<16|65535&b}r.exports=function(h){return y.hash(h,v,16)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){r.exports=function(y){for(var v,x=new Array(y),T=0;T>>((3&T)<<3)&255;return x}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){var y=n("./helpers");function v(M,k){M[k>>5]|=128<<24-k%32,M[15+(k+64>>9<<4)]=k;for(var C,P,h,I=Array(80),b=1732584193,g=-271733879,m=-1732584194,A=271733878,S=-1009589776,B=0;B>16)+(k>>16)+(C>>16)<<16|65535&C}function T(M,k){return M<>>32-k}r.exports=function(M){return y.hash(M,v,20,!0)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){function y(k,C){var P=(65535&k)+(65535&C);return(k>>16)+(C>>16)+(P>>16)<<16|65535&P}function v(k,C){var P,h=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),I=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),b=new Array(64);k[C>>5]|=128<<24-C%32,k[15+(C+64>>9<<4)]=C;for(var g,m,A=0;A>>C|k<<32-C},M=function(k,C){return k>>>C};r.exports=function(k){return x.hash(k,v,32,!0)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){i.read=function(y,v,x,T,A){var k,C,P=8*A-T-1,h=(1<>1,b=-7,g=x?A-1:0,m=x?-1:1,A=y[v+g];for(g+=m,k=A&(1<<-b)-1,A>>=-b,b+=P;0>=-b,b+=T;0>1,g=M===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=T?0:S-1,A=T?1:-1,S=v<0||v===0&&1/v<0?1:0;for(v=Math.abs(v),isNaN(v)||v===1/0?(P=isNaN(v)?1:0,C=I):(C=Math.floor(Math.log(v)/Math.LN2),v*(T=Math.pow(2,-C))<1&&(C--,T*=2),2<=(v+=1<=C+b?g/T:g*Math.pow(2,1-b))*T&&(C++,T/=2),I<=C+b?(P=0,C=I):1<=C+b?(P=(v*T-1)*Math.pow(2,M),C+=b):(P=v*Math.pow(2,b-1)*Math.pow(2,M),C=0));8<=M;y[x+m]=255&P,m+=A,P/=256,M-=8);for(C=C<>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]),go}var vo,xo;function bs(){return xo||(xo=1,vo=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]),vo}var Ar,bo;function df(){if(bo)return Ar;bo=1;var t=xs();return Ar=t.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),Ar}var _r,wo;function pf(){if(wo)return _r;wo=1;var t=bs();return t=t.slice().filter(function(e){return!/^(gl\_|texture)/.test(e)}),_r=t.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),_r}var kr,To;function hf(){if(To)return kr;To=1,kr=C;var t=xs(),e=ff(),n=bs(),r=df(),i=pf(),o=999,a=9999,s=0,l=1,u=2,c=3,f=4,p=5,d=6,y=7,v=8,x=9,T=10,M=11,k=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function C(P){var h=0,I=0,b=o,g,m,A=[],S=[],B=1,D=0,F=0,j=!1,J=!1,oe="",Z;P=P||{};var _=n,ee=t;P.version==="300 es"&&(_=i,ee=r);for(var ge={},R={},h=0;h<_.length;h++)ge[_[h]]=!0;for(var h=0;h0)continue;Te=de.slice(0,1).join("")}return ye(Te),F+=Te.length,A=A.slice(Te.length),A.length}while(!0)}function Y(){return/[^a-fA-F0-9]/.test(g)?(ye(A.join("")),b=o,h):(A.push(g),m=g,h+1)}function te(){return g==="."||/[eE]/.test(g)?(A.push(g),b=p,m=g,h+1):g==="x"&&A.length===1&&A[0]==="0"?(b=M,A.push(g),m=g,h+1):/[^\d]/.test(g)?(ye(A.join("")),b=o,h):(A.push(g),m=g,h+1)}function xe(){return g==="f"&&(A.push(g),m=g,h+=1),/[eE]/.test(g)||(g==="-"||g==="+")&&/[eE]/.test(m)?(A.push(g),m=g,h+1):/[^\d]/.test(g)?(ye(A.join("")),b=o,h):(A.push(g),m=g,h+1)}function ke(){if(/[^\d\w_]/.test(g)){var de=A.join("");return R[de]?b=v:ge[de]?b=y:b=d,ye(A.join("")),b=o,h}return A.push(g),m=g,h+1}}return kr}var Er,Ao;function mf(){if(Ao)return Er;Ao=1;var t=hf();Er=e;function e(n,r){var i=t(r),o=[];return o=o.concat(i(n)),o=o.concat(i(null)),o}return Er}mf();function gf(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function yf(t){var e=gf(t,"string");return typeof e=="symbol"?e:String(e)}function Ie(t,e,n){return e=yf(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var ue={position:"csm_Position",positionRaw:"csm_PositionRaw",pointSize:"csm_PointSize",fragColor:"csm_FragColor",diffuseColor:"csm_DiffuseColor",normal:"csm_Normal",roughness:"csm_Roughness",metalness:"csm_Metalness",emissive:"csm_Emissive",ao:"csm_AO",bump:"csm_Bump",depthAlpha:"csm_DepthAlpha"},qe,qt;qe={},Ie(qe,"".concat(ue.normal),{"#include ":` + vec3 objectNormal = `.concat(ue.normal,`; + #ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); + #endif + `)}),Ie(qe,"".concat(ue.position),{"#include ":` + vec3 transformed = `.concat(ue.position,`; + `)}),Ie(qe,"".concat(ue.positionRaw),{"#include ":` + vec4 csm_internal_positionUnprojected = `.concat(ue.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; + `)}),Ie(qe,"".concat(ue.pointSize),{"gl_PointSize = size;":` + gl_PointSize = `.concat(ue.pointSize,`; + `)}),Ie(qe,"".concat(ue.diffuseColor),{"#include ":` + #include + diffuseColor = `.concat(ue.diffuseColor,`; + `)}),Ie(qe,"".concat(ue.fragColor),{"#include ":` + #include + gl_FragColor = `.concat(ue.fragColor,`; + `)}),Ie(qe,"".concat(ue.emissive),{"vec3 totalEmissiveRadiance = emissive;":` + vec3 totalEmissiveRadiance = `.concat(ue.emissive,`; + `)}),Ie(qe,"".concat(ue.roughness),{"#include ":` + #include + roughnessFactor = `.concat(ue.roughness,`; + `)}),Ie(qe,"".concat(ue.metalness),{"#include ":` + #include + metalnessFactor = `.concat(ue.metalness,`; + `)}),Ie(qe,"".concat(ue.ao),{"#include ":` + #include + reflectedLight.indirectDiffuse *= 1. - `.concat(ue.ao,`; + `)}),Ie(qe,"".concat(ue.bump),{"#include ":` + #include + + vec3 csm_internal_orthogonal = `.concat(ue.bump," - (dot(").concat(ue.bump,`, normal) * normal); + vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; + normal = normalize(normal - csm_internal_projectedbump); + `)}),Ie(qe,"".concat(ue.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(ue.depthAlpha,` ); + `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` + gl_FragColor = packDepthToRGBA( fragCoordZ ); + gl_FragColor.a *= `.concat(ue.depthAlpha,`; + `)});qt={},Ie(qt,"".concat(ue.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(ue.position,`, 1.0 ); + `)}),Ie(qt,"".concat(ue.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = `.concat(ue.position,`; + `)}),Ie(qt,"".concat(ue.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(ue.diffuseColor,`; + `)}),Ie(qt,"".concat(ue.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(ue.fragColor,`; + `)});var Ye;Ye={},Ie(Ye,"".concat(ue.position),"*"),Ie(Ye,"".concat(ue.positionRaw),"*"),Ie(Ye,"".concat(ue.normal),"*"),Ie(Ye,"".concat(ue.pointSize),["PointsMaterial"]),Ie(Ye,"".concat(ue.diffuseColor),"*"),Ie(Ye,"".concat(ue.fragColor),"*"),Ie(Ye,"".concat(ue.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ie(Ye,"".concat(ue.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ie(Ye,"".concat(ue.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Ie(Ye,"".concat(ue.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Ie(Ye,"".concat(ue.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Ie(Ye,"".concat(ue.depthAlpha),"*");var vf=`void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +}`,xf=`#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 Mn=new ae(0,0,0),Si=new ae(0,0,0),bf=new ae(0,0,0);function _o(t,e,n){const r=Mn.setFromMatrixPosition(t.matrixWorld);r.project(e);const i=n.width/2,o=n.height/2;return[(Number.isNaN(r.x)?0:r.x)*i+i,-(r.y*o)+o,r.z]}function wf(t,e){const n=Mn.setFromMatrixPosition(t.matrixWorld),r=Si.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),o=e.getWorldDirection(bf);return i.angleTo(o)>Math.PI/2}function Tf(t,e,n,r){const i=Mn.setFromMatrixPosition(t.matrixWorld),o=i.clone();o.project(e),n.setFromCamera(new De(o.x,o.y),e);const a=n.intersectObjects(r,!0);if(a.length>0){const s=a[0].distance;return i.distanceTo(n.ray.origin)Math.abs(t)<1e-10?0:t;function ws(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=Jr(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const kf=(t=>e=>ws(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Ef=(t=>(e,n)=>ws(e,t(n),"translate(-50%,-50%)"))(t=>[1/t,1/t,1/t,1,-1/t,-1/t,-1/t,-1,1/t,1/t,1/t,1,1,1,1,1]),Mf=["geometry","material"];new ja;var ei={exports:{}},Sf=ei.exports,ko;function If(){return ko||(ko=1,function(t,e){(function(n,r){t.exports=r()})(Sf,function(){var n=function(){function r(d){return a.appendChild(d.dom),d}function i(d){for(var y=0;yl+1e3&&(c.update(1e3*u/(d-l),100),l=d,u=0,p)){var y=performance.memory;p.update(y.usedJSHeapSize/1048576,y.jsHeapSizeLimit/1048576)}return d},update:function(){s=this.end()},domElement:a,setMode:i}};return n.Panel=function(r,i,o){var a=1/0,s=0,l=Math.round,u=l(window.devicePixelRatio||1),c=80*u,f=48*u,p=3*u,d=2*u,y=3*u,v=15*u,x=74*u,T=30*u,M=document.createElement("canvas");M.width=c,M.height=f,M.style.cssText="width:80px;height:48px";var k=M.getContext("2d");return k.font="bold "+9*u+"px Helvetica,Arial,sans-serif",k.textBaseline="top",k.fillStyle=o,k.fillRect(0,0,c,f),k.fillStyle=i,k.fillText(r,p,d),k.fillRect(y,v,x,T),k.fillStyle=o,k.globalAlpha=.9,k.fillRect(y,v,x,T),{dom:M,update:function(C,P){a=Math.min(a,C),s=Math.max(s,C),k.fillStyle=o,k.globalAlpha=1,k.fillRect(0,0,c,v),k.fillStyle=i,k.fillText(l(C)+" "+r+" ("+l(a)+"-"+l(s)+")",p,d),k.drawImage(M,y+u,v,x-u,T,y,v,x-u,T),k.fillRect(y+x-u,v,u,T),k.fillStyle=o,k.globalAlpha=.9,k.fillRect(y+x-u,v,u,l((1-C/P)*T))}}},n})}(ei)),ei.exports}If();const Rf={key:0,args:[0,1,64]},Cf={key:1,args:[.5,1,64]},Nf={key:2},Lf=["tone-mapped","map","side","color"];new je(16777215);const Yt=ze({__name:"Range",props:{modelValue:null,min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","mousedown"],setup(t,{emit:e}){const n=t,r=e,i=W(null);function o(y,v,x){return Math.min(Math.max(y,v),x)}function a(y){const v=y.toString();return v.includes("e-")?Number.parseInt(v.split("e-")[1],10):v.includes(".")?v.split(".")[1].length:0}function s(y,v){const x=a(v),T=10**(x+3);return Number.parseFloat((y*T/T).toFixed(x))}const l=He(()=>s(o(n.modelValue,n.min,n.max),n.step)),u=He(()=>{const y=(l.value-n.min)/(n.max-n.min)*100;return{width:`${y}%`,backgroundSize:`${y}% 100%`}});function c(y){if(!i.value)return l.value;const v=i.value.getBoundingClientRect(),T=(y.clientX-v.left)/v.width,M=n.max-n.min,k=n.min+M*T,C=Math.round(k/n.step)*n.step;return Math.min(Math.max(C,n.min),n.max)}function f(y){if(n.disabled)return;const v=c(y);r("update:modelValue",v)}function p(y){if(n.disabled)return;y.preventDefault();const v=c(y);r("update:modelValue",v),window.addEventListener("mousemove",f),window.addEventListener("mouseup",d)}function d(y){window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",d)}return Ht(()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",d)}),(y,v)=>(Q(),re("span",{ref_key:"sliderRef",ref:i,class:dt(["range-slider disabled:pointer-events-none disabled:cursor-default disabled:opacity-50",{disabled:t.disabled}]),bg:"[#e6e1fc] dark:[#676085]","touch-action-none":"",relative:"","inline-block":"","w-full":"","cursor-ew-resize":"","rounded-sm":"",onMousedown:p},[O("span",{style:Wr(u.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),O("span",{role:"slider",class:"slider-thumb",style:Wr({left:`${(l.value-t.min)/(t.max-t.min)*100}%`}),absolute:"","rounded-sm":"",w:"[1px]",h:"[14px]",bg:"neutral-100 dark:neutral-400",top:"50%",transform:"translate-x-[50%] translate-y-[-50%]"},null,4)],34))}});function Eo(t,e){if(e===Kl)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===Xr||e===Ka){let n=t.getIndex();if(n===null){const a=[],s=t.getAttribute("position");if(s!==void 0){for(let l=0;l=2.0 are supported."));return}const u=new pd(o,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&s[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(a),u.setPlugins(s),u.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,o){r.parse(e,n,i,o)})}}function Df(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const pe={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Of{constructor(e){this.parser=e,this.name=pe.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,o.source,a)}}class Xf{constructor(e){this.parser=e,this.name=pe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const a=o.extensions[n],s=i.images[a.source];let l=r.textureLoader;if(s.uri){const u=r.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class Qf{constructor(e){this.parser=e,this.name=pe.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const a=o.extensions[n],s=i.images[a.source];let l=r.textureLoader;if(s.uri){const u=r.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class Zf{constructor(e){this.name=pe.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(s){const l=i.byteOffset||0,u=i.byteLength||0,c=i.count,f=i.byteStride,p=new Uint8Array(s,l,u);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(c,f,p,i.mode,i.filter).then(function(d){return d.buffer}):a.ready.then(function(){const d=new ArrayBuffer(c*f);return a.decodeGltfBuffer(new Uint8Array(d),c,f,p,i.mode,i.filter),d})})}else return null}}class Jf{constructor(e){this.name=pe.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const u of i.primitives)if(u.mode!==at.TRIANGLES&&u.mode!==at.TRIANGLE_STRIP&&u.mode!==at.TRIANGLE_FAN&&u.mode!==void 0)return null;const a=r.extensions[this.name].attributes,s=[],l={};for(const u in a)s.push(this.parser.getDependency("accessor",a[u]).then(c=>(l[u]=c,l[u])));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then(u=>{const c=u.pop(),f=c.isGroup?c.children:[c],p=u[0].count,d=[];for(const y of f){const v=new _t,x=new ae,T=new $n,M=new ae(1,1,1),k=new Jl(y.geometry,y.material,p);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":t.search(/\.ktx2($|\?)/i)>0||t.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const dd=new _t;class pd{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new Df,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,o=!1,a=-1;if(typeof navigator<"u"){const s=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(s)===!0;const l=s.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,o=s.indexOf("Firefox")>-1,a=o?s.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||o&&a<98?this.textureLoader=new tu(this.options.manager):this.textureLoader=new nu(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Wa(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(a){const s={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:r,userData:{}};return Ot(o,s,i),wt(s,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(s)})).then(function(){for(const l of s.scenes)l.updateMatrixWorld();e(s)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,o=n.length;i{const l=this.associations.get(a);l!=null&&this.associations.set(s,l);for(const[u,c]of a.children.entries())o(c,s.children[u])};return o(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&x.setY(g,h[I*l+1]),l>=3&&x.setZ(g,h[I*l+2]),l>=4&&x.setW(g,h[I*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}x.normalized=y}return x})}loadTexture(e){const n=this.json,r=this.options,o=n.textures[e].source,a=n.images[o];let s=this.textureLoader;if(a.uri){const l=r.manager.getHandler(a.uri);l!==null&&(s=l)}return this.loadTextureImage(e,o,s)}loadTextureImage(e,n,r){const i=this,o=this.json,a=o.textures[e],s=o.images[n],l=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const u=this.loadImageSource(n,r).then(function(c){c.flipY=!1,c.name=a.name||s.name||"",c.name===""&&typeof s.uri=="string"&&s.uri.startsWith("data:image/")===!1&&(c.name=s.uri);const p=(o.samplers||{})[a.sampler]||{};return c.magFilter=So[p.magFilter]||Yn,c.minFilter=So[p.minFilter]||bi,c.wrapS=Io[p.wrapS]||Kn,c.wrapT=Io[p.wrapT]||Kn,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==Ut&&c.minFilter!==Yn,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,n){const r=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const a=i.images[e],s=self.URL||self.webkitURL;let l=a.uri||"",u=!1;if(a.bufferView!==void 0)l=r.getDependency("bufferView",a.bufferView).then(function(f){u=!0;const p=new Blob([f],{type:a.mimeType});return l=s.createObjectURL(p),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(f){return new Promise(function(p,d){let y=p;n.isImageBitmapLoader===!0&&(y=function(v){const x=new qn(v);x.needsUpdate=!0,p(x)}),n.load(yn.resolveURL(f,o.path),y,void 0,d)})}).then(function(f){return u===!0&&s.revokeObjectURL(l),wt(f,a),f.userData.mimeType=a.mimeType||fd(a.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=c,c}assignTexture(e,n,r,i){const o=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(a=a.clone(),a.channel=r.texCoord),o.extensions[pe.KHR_TEXTURE_TRANSFORM]){const s=r.extensions!==void 0?r.extensions[pe.KHR_TEXTURE_TRANSFORM]:void 0;if(s){const l=o.associations.get(a);a=o.extensions[pe.KHR_TEXTURE_TRANSFORM].extendTexture(a,s),o.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[n]=a,a})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,o=n.attributes.color!==void 0,a=n.attributes.normal===void 0;if(e.isPoints){const s="PointsMaterial:"+r.uuid;let l=this.cache.get(s);l||(l=new ru,pr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(s,l)),r=l}else if(e.isLine){const s="LineBasicMaterial:"+r.uuid;let l=this.cache.get(s);l||(l=new iu,pr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(s,l)),r=l}if(i||o||a){let s="ClonedMaterial:"+r.uuid+":";i&&(s+="derivative-tangents:"),o&&(s+="vertex-colors:"),a&&(s+="flat-shading:");let l=this.cache.get(s);l||(l=r.clone(),o&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(s,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return Xa}loadMaterial(e){const n=this,r=this.json,i=this.extensions,o=r.materials[e];let a;const s={},l=o.extensions||{},u=[];if(l[pe.KHR_MATERIALS_UNLIT]){const f=i[pe.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),u.push(f.extendParams(s,o,n))}else{const f=o.pbrMetallicRoughness||{};if(s.color=new je(1,1,1),s.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;s.color.setRGB(p[0],p[1],p[2],kt),s.opacity=p[3]}f.baseColorTexture!==void 0&&u.push(n.assignTexture(s,"map",f.baseColorTexture,An)),s.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,s.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(u.push(n.assignTexture(s,"metalnessMap",f.metallicRoughnessTexture)),u.push(n.assignTexture(s,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,s)})))}o.doubleSided===!0&&(s.side=ir);const c=o.alphaMode||Sr.OPAQUE;if(c===Sr.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===Sr.MASK&&(s.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&a!==Wt&&(u.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new De(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;s.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&a!==Wt&&(u.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&a!==Wt){const f=o.emissiveFactor;s.emissive=new je().setRGB(f[0],f[1],f[2],kt)}return o.emissiveTexture!==void 0&&a!==Wt&&u.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture,An)),Promise.all(u).then(function(){const f=new a(s);return o.name&&(f.name=o.name),wt(f,o),n.associations.set(f,{materials:e}),o.extensions&&Ot(i,f,o),f})}createUniqueName(e){const n=Tn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function o(s){return r[pe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(s,n).then(function(l){return Ro(l,s,n)})}const a=[];for(let s=0,l=e.length;s0&&ud(T,o),T.name=n.createUniqueName(o.name||"mesh_"+e),wt(T,o),x.extensions&&Ot(i,T,x),n.assignFinalMaterial(T),f.push(T)}for(let d=0,y=f.length;d1?c=new hr:u.length===1?c=u[0]:c=new wi,c!==u[0])for(let f=0,p=u.length;f{const f=new Map;for(const[p,d]of i.associations)(p instanceof pr||p instanceof qn)&&f.set(p,d);return c.traverse(p=>{const d=i.associations.get(p);d!=null&&f.set(p,d)}),f};return i.associations=u(o),o})}_createAnimationTracks(e,n,r,i,o){const a=[],s=e.name?e.name:e.uuid,l=[];St[o.path]===St.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(s);let u;switch(St[o.path]){case St.weights:u=Wi;break;case St.rotation:u=Xi;break;case St.translation:case St.scale:u=Ki;break;default:switch(r.itemSize){case 1:u=Wi;break;case 2:case 3:default:u=Ki;break}break}const c=i.interpolation!==void 0?ad[i.interpolation]:gi,f=this._getArrayFromAccessor(r);for(let p=0,d=l.length;pnew pl(t)),Ft.register(t=>new hl(t)),Ft)}async function md(t){const r=(await _s().loadAsync(t)).userData;if(!r.vrmAnimations){console.warn("No VRM animations found in the .vrma file");return}if(r.vrmAnimations.length===0){console.warn("No VRM animations found in the .vrma file");return}return r.vrmAnimations[0]}async function gd(t,e){if(!t){console.warn("No VRM found");return}if(e)return ml(e,t)}function yd(){const t=W(!1),e=W(0),n=W(0),r=.2,i=1,o=6,a=W(Math.random()*(o-i)+i);function s(l,u){if(l!=null&&l.expressionManager&&(n.value+=u,!t.value&&n.value>=a.value&&(t.value=!0,e.value=0),t.value)){e.value+=u/r;const c=Math.sin(Math.PI*e.value);l.expressionManager.setValue("blink",c),e.value>=1&&(t.value=!1,n.value=0,l.expressionManager.setValue("blink",0),a.value=Math.random()*(o-i)+i)}}return{update:s}}function vd(){let t=-1,e,n=0;function r(){e?e.set(dn(-.25,.25),dn(-.2,.15),-.65):e=new ae(dn(-.25,.25),dn(-.2,.15),-.65)}function i(o,a){var s;!(o!=null&&o.expressionManager)||!o.lookAt||(n>=t?(r(),n=0,t=gl()/1e3):e||r(),o.lookAt.target||(o.lookAt.target=new wi),o.lookAt.target.position.lerp(e,dn(.2,.5)),(s=o.lookAt)==null||s.update(a),n+=a)}return{update:i}}async function xd(t,e){const i=(await _s().loadAsync(t,a=>{var s;return(s=e==null?void 0:e.onProgress)==null?void 0:s.call(e,a)})).userData;if(!i.vrm)return;const o=i.vrm;if(qr.removeUnnecessaryVertices(o.scene),qr.combineSkeletons(o.scene),o.scene.traverse(a=>{a.frustumCulled=!1}),o.lookAt){const a=new yl(o.lookAt);a.name="lookAtQuaternionProxy",o.scene.add(a)}return e!=null&&e.scene&&e.scene.add(o.scene),e!=null&&e.position&&o.scene.position.set(...e.position),o}function bd(t){const e=W(null),n=W(!1),r=W(0),i=W(new Map),o=W(new Map),a=W(),s=(T,M,k)=>T+(M-T)*k,l=T=>T<.5?4*T*T*T:1-(-2*T+2)**3/2,u=new Map([["happy",{expression:[{name:"happy",value:1,duration:.3},{name:"aa",value:.3}],blendDuration:.3}],["sad",{expression:[{name:"sad",value:1},{name:"oh",value:.2}],blendDuration:.3}],["angry",{expression:[{name:"angry",value:1},{name:"ee",value:.4}],blendDuration:.2}],["surprised",{expression:[{name:"Surprised",value:1},{name:"oh",value:.6}],blendDuration:.1}],["neutral",{expression:[{name:"neutral",value:1}],blendDuration:.5}]]),c=()=>{a.value&&(clearTimeout(a.value),a.value=void 0)},f=T=>{var k;if(c(),!u.has(T)){console.warn(`Emotion ${T} not found`);return}const M=u.get(T);if(e.value=T,n.value=!0,r.value=0,t.expressionManager){const C=Object.keys(t.expressionManager.expressionMap);for(const P of C)t.expressionManager.setValue(P,0)}i.value.clear(),o.value.clear();for(const C of M.expression||[]){const P=((k=t.expressionManager)==null?void 0:k.getValue(C.name))||0;i.value.set(C.name,P),o.value.set(C.name,C.value)}};return{currentEmotion:e,isTransitioning:n,setEmotion:f,setEmotionWithResetAfter:(T,M)=>{c(),f(T),a.value=setTimeout(()=>{f("neutral"),a.value=void 0},M)},update:T=>{var C;if(!n.value||!e.value)return;const k=u.get(e.value).blendDuration||.3;r.value+=T/k,r.value>=1&&(r.value=1,n.value=!1);for(const[P,h]of o.value){const I=i.value.get(P)||0,b=s(I,h,l(r.value));(C=t.expressionManager)==null||C.setValue(P,b)}},addEmotionState:(T,M)=>{u.set(T,M)},removeEmotionState:T=>{u.delete(T)},dispose:()=>{c()}}}const wd=ze({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null,paused:{type:Boolean}},emits:["loadModelProgress","error"],setup(t,{expose:e,emit:n}){const r=t,i=n;let o;const a=W(),s=W(),{scene:l}=rr(),{onBeforeRender:u}=Gn(),c=yd(),f=vd(),p=W();Ue(()=>r.position,([v,x,T])=>{a.value&&a.value.scene.position.set(v,x,T)}),wn(async()=>{if(l.value)try{const v=await xd(r.model,{scene:l.value,lookAt:!0,position:r.position,onProgress:M=>i("loadModelProgress",Number.parseFloat((100*(M.loaded/M.total)).toFixed(2)))});if(!v){console.warn("No VRM model loaded");return}const x=await md(r.idleAnimation),T=await gd(v,x);if(!T){console.warn("No VRM animation loaded");return}s.value=new mu(v.scene),s.value.clipAction(T).play(),p.value=bd(v),a.value=v,o=u(({delta:M})=>{var k,C,P;(k=s.value)==null||k.update(M),(C=a.value)==null||C.update(M),c.update(a.value,M),f.update(a.value,M),(P=p.value)==null||P.update(M)}).off}catch(v){i("error",v)}}),Ht(()=>{o==null||o(),a.value&&(a.value.scene.removeFromParent(),qr.deepDispose(a.value.scene))}),e({setExpression(v){var x;(x=p.value)==null||x.setEmotionWithResetAfter(v,1e3)}});const{pause:d,resume:y}=Gn();return Ue(()=>r.paused,v=>{v?d():y()}),(v,x)=>_n(v.$slots,"default")}}),Td=["position"],Ad={absolute:"",bottom:"3",right:"3"},_d={flex:"~ row","cursor-pointer":""},kd=["checked","aria-checked"],Ed={key:0,"min-w":"50vw",z:"{var v;(v=p.value)==null||v.setExpression(y)}}),(y,v)=>(Q(),rn(rs,{relative:""},{default:Ve(({height:x,width:T})=>[Ae(V(gu),{alpha:!0,antialias:!0,width:T,height:x},{default:Ve(()=>[Ae(V(uf)),O("TresPerspectiveCamera",{position:[a.value,s.value,l.value]},null,8,Td),v[14]||(v[14]=O("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),v[15]||(v[15]=O("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),Ae(wd,{ref_key:"modelRef",ref:p,model:r.model,"idle-animation":r.idleAnimation,position:[u.value,c.value,f.value],paused:r.paused,onLoadModelProgress:v[0]||(v[0]=M=>i("loadModelProgress",M)),onError:v[1]||(v[1]=M=>i("error",M))},null,8,["model","idle-animation","position","paused"])]),_:2},1032,["width","height"]),O("div",Ad,[O("div",_d,[O("label",{class:dt([o.value?"bg-neutral-300 dark:bg-neutral-200":"bg-neutral-100 dark:bg-neutral-700"]),transition:"all ease-in-out duration-500",text:"lg neutral-500 dark:neutral-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[Ct(O("input",{"onUpdate:modelValue":v[2]||(v[2]=M=>o.value=M),checked:o.value,"aria-checked":o.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,kd),[[hi,o.value]]),v[16]||(v[16]=O("div",{"select-none":""},[O("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),Ae(ki,null,{default:Ve(()=>[o.value?(Q(),re("div",Ed,[O("div",Md,[O("div",Sd,[O("span",null,me(V(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),Ae(Ji,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Ve(()=>[O("span",Id,me(V(d)("stage.viewers.debug-menu.vrm.camera")),1)]),default:Ve(()=>[O("div",Rd,[v[17]||(v[17]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"X")],-1)),O("label",Cd,[Ae(Yt,{modelValue:a.value,"onUpdate:modelValue":v[3]||(v[3]=M=>a.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Nd,[O("span",null,me(a.value),1)]),v[18]||(v[18]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Y")],-1)),O("label",Ld,[Ae(Yt,{modelValue:s.value,"onUpdate:modelValue":v[4]||(v[4]=M=>s.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Pd,[O("span",null,me(s.value),1)]),v[19]||(v[19]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Z")],-1)),O("label",Dd,[Ae(Yt,{modelValue:l.value,"onUpdate:modelValue":v[5]||(v[5]=M=>l.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Od,[O("span",null,me(l.value),1)])])]),_:1}),Ae(Ji,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Ve(()=>[O("span",Fd,me(V(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),default:Ve(()=>[O("div",Bd,[v[20]||(v[20]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"X")],-1)),O("label",zd,[Ae(Yt,{modelValue:u.value,"onUpdate:modelValue":v[6]||(v[6]=M=>u.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Ud,[O("span",null,me(u.value),1)]),v[21]||(v[21]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Y")],-1)),O("label",jd,[Ae(Yt,{modelValue:c.value,"onUpdate:modelValue":v[7]||(v[7]=M=>c.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Vd,[O("span",null,me(c.value),1)]),v[22]||(v[22]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Z")],-1)),O("label",Hd,[Ae(Yt,{modelValue:f.value,"onUpdate:modelValue":v[8]||(v[8]=M=>f.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Gd,[O("span",null,me(f.value),1)])])]),_:1}),O("div",$d,[O("span",null,me(V(d)("stage.viewers.debug-menu.emotions")),1)]),O("div",qd,[O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[9]||(v[9]=M=>{var k;return(k=p.value)==null?void 0:k.setExpression("neutral")})},me(V(d)("stage.viewers.debug-menu.emotions-btn.neutral")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[10]||(v[10]=M=>{var k;return(k=p.value)==null?void 0:k.setExpression("surprised")})},me(V(d)("stage.viewers.debug-menu.emotions-btn.surprised")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[11]||(v[11]=M=>{var k;return(k=p.value)==null?void 0:k.setExpression("sad")})},me(V(d)("stage.viewers.debug-menu.emotions-btn.sad")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[12]||(v[12]=M=>{var k;return(k=p.value)==null?void 0:k.setExpression("angry")})},me(V(d)("stage.viewers.debug-menu.emotions-btn.angry")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:v[13]||(v[13]=M=>{var k;return(k=p.value)==null?void 0:k.setExpression("happy")})},me(V(d)("stage.viewers.debug-menu.emotions-btn.happy")),1)])])])):ut("",!0)]),_:1})])]),_:1}))}}),Xe=Symbol.for("drizzle:entityKind");function ot(t,e){if(!t||typeof t!="object")return!1;if(t instanceof e)return!0;if(!Object.prototype.hasOwnProperty.call(e,Xe))throw new Error(`Class "${e.name??""}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(t).constructor;if(n)for(;n;){if(Xe in n&&n[Xe]===e[Xe])return!0;n=Object.getPrototypeOf(n)}return!1}var ma;ma=Xe;class Ii{constructor(e,n){le(this,"name");le(this,"keyAsName");le(this,"primary");le(this,"notNull");le(this,"default");le(this,"defaultFn");le(this,"onUpdateFn");le(this,"hasDefault");le(this,"isUnique");le(this,"uniqueName");le(this,"uniqueType");le(this,"dataType");le(this,"columnType");le(this,"enumValues");le(this,"generated");le(this,"generatedIdentity");le(this,"config");this.table=e,this.config=n,this.name=n.name,this.keyAsName=n.keyAsName,this.notNull=n.notNull,this.default=n.default,this.defaultFn=n.defaultFn,this.onUpdateFn=n.onUpdateFn,this.hasDefault=n.hasDefault,this.primary=n.primaryKey,this.isUnique=n.isUnique,this.uniqueName=n.uniqueName,this.uniqueType=n.uniqueType,this.dataType=n.dataType,this.columnType=n.columnType,this.generated=n.generated,this.generatedIdentity=n.generatedIdentity}mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}le(Ii,ma,"Column");const Rr=Symbol.for("drizzle:Name"),Co=Symbol.for("drizzle:isPgEnum");function Kd(t){return!!t&&typeof t=="function"&&Co in t&&t[Co]===!0}var ga;ga=Xe;class Ri{constructor(e,n,r,i=!1){this._={brand:"Subquery",sql:e,selectedFields:n,alias:r,isWith:i}}}le(Ri,ga,"Subquery");const Wd={startActiveSpan(t,e){return e()}},vn=Symbol.for("drizzle:ViewBaseConfig"),Cr=Symbol.for("drizzle:Schema"),No=Symbol.for("drizzle:Columns"),Lo=Symbol.for("drizzle:ExtraConfigColumns"),Nr=Symbol.for("drizzle:OriginalName"),Lr=Symbol.for("drizzle:BaseName"),Xn=Symbol.for("drizzle:IsAlias"),Po=Symbol.for("drizzle:ExtraConfigBuilder"),Xd=Symbol.for("drizzle:IsDrizzleTable");var ya,va,xa,ba,wa,Ta,Aa,_a,ka,Ea;Ea=Xe,ka=Rr,_a=Nr,Aa=Cr,Ta=No,wa=Lo,ba=Lr,xa=Xn,va=Xd,ya=Po;class At{constructor(e,n,r){le(this,ka);le(this,_a);le(this,Aa);le(this,Ta);le(this,wa);le(this,ba);le(this,xa,!1);le(this,va,!0);le(this,ya);this[Rr]=this[Nr]=e,this[Cr]=n,this[Lr]=r}}le(At,Ea,"Table"),le(At,"Symbol",{Name:Rr,Schema:Cr,OriginalName:Nr,Columns:No,ExtraConfigColumns:Lo,BaseName:Lr,IsAlias:Xn,ExtraConfigBuilder:Po});function Qd(t){return t!=null&&typeof t.getSQL=="function"}function Zd(t){var n;const e={sql:"",params:[]};for(const r of t)e.sql+=r.sql,e.params.push(...r.params),(n=r.typings)!=null&&n.length&&(e.typings||(e.typings=[]),e.typings.push(...r.typings));return e}var Ma;Ma=Xe;class st{constructor(e){le(this,"value");this.value=Array.isArray(e)?e:[e]}getSQL(){return new Be([this])}}le(st,Ma,"StringChunk");var Sa;Sa=Xe;const Bt=class Bt{constructor(e){le(this,"decoder",ks);le(this,"shouldInlineParams",!1);this.queryChunks=e}append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return Wd.startActiveSpan("drizzle.buildSQL",n=>{const r=this.buildQueryFromSourceParams(this.queryChunks,e);return n==null||n.setAttributes({"drizzle.query.text":r.sql,"drizzle.query.params":JSON.stringify(r.params)}),r})}buildQueryFromSourceParams(e,n){const r=Object.assign({},n,{inlineParams:n.inlineParams||this.shouldInlineParams,paramStartIndex:n.paramStartIndex||{value:0}}),{casing:i,escapeName:o,escapeParam:a,prepareTyping:s,inlineParams:l,paramStartIndex:u}=r;return Zd(e.map(c=>{var f;if(ot(c,st))return{sql:c.value.join(""),params:[]};if(ot(c,Qn))return{sql:o(c.value),params:[]};if(c===void 0)return{sql:"",params:[]};if(Array.isArray(c)){const p=[new st("(")];for(const[d,y]of c.entries())p.push(y),dt},Es={mapToDriverValue:t=>t};({...ks,...Es});var Ra;Ra=Xe;class Ci{constructor(e,n=Es){le(this,"brand");this.value=e,this.encoder=n}getSQL(){return new Be([this])}}le(Ci,Ra,"Param");function ri(t,...e){const n=[];(e.length>0||t.length>0&&t[0]!=="")&&n.push(new st(t[0]));for(const[r,i]of e.entries())n.push(i,new st(t[r+1]));return new Be(n)}(t=>{function e(){return new Be([])}t.empty=e;function n(l){return new Be(l)}t.fromList=n;function r(l){return new Be([new st(l)])}t.raw=r;function i(l,u){const c=[];for(const[f,p]of l.entries())f>0&&u!==void 0&&c.push(u),c.push(p);return new Be(c)}t.join=i;function o(l){return new Qn(l)}t.identifier=o;function a(l){return new Zn(l)}t.placeholder=a;function s(l,u){return new Ci(l,u)}t.param=s})(ri||(ri={}));(t=>{var n;n=Xe;const r=class r{constructor(o,a){le(this,"isSelectionField",!1);this.sql=o,this.fieldAlias=a}getSQL(){return this.sql}clone(){return new r(this.sql,this.fieldAlias)}};le(r,n,"SQL.Aliased");let e=r;t.Aliased=e})(Be||(Be={}));var Ca;Ca=Xe;class Zn{constructor(e){this.name=e}getSQL(){return new Be([this])}}le(Zn,Ca,"Placeholder");const Jd=Symbol.for("drizzle:IsDrizzleView");var Na,La,Pa;Pa=Xe,La=vn,Na=Jd;class Ms{constructor({name:e,schema:n,selectedFields:r,query:i}){le(this,La);le(this,Na,!0);this[vn]={name:e,originalName:e,schema:n,selectedFields:r,query:i,isExisting:!i,isAlias:!1}}getSQL(){return new Be([this])}}le(Ms,Pa,"View");Ii.prototype.getSQL=function(){return new Be([this])};At.prototype.getSQL=function(){return new Be([this])};Ri.prototype.getSQL=function(){return new Be([this])};const ep=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Sn{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Sn.prototype.normal={};Sn.prototype.property={};Sn.prototype.space=void 0;function Ss(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Sn(n,r,e)}function ii(t){return t.toLowerCase()}class Ze{constructor(e,n){this.attribute=n,this.property=e}}Ze.prototype.attribute="";Ze.prototype.booleanish=!1;Ze.prototype.boolean=!1;Ze.prototype.commaOrSpaceSeparated=!1;Ze.prototype.commaSeparated=!1;Ze.prototype.defined=!1;Ze.prototype.mustUseProperty=!1;Ze.prototype.number=!1;Ze.prototype.overloadedBoolean=!1;Ze.prototype.property="";Ze.prototype.spaceSeparated=!1;Ze.prototype.space=void 0;let tp=0;const fe=Gt(),Pe=Gt(),Is=Gt(),$=Gt(),Ce=Gt(),en=Gt(),tt=Gt();function Gt(){return 2**++tp}const oi=Object.freeze(Object.defineProperty({__proto__:null,boolean:fe,booleanish:Pe,commaOrSpaceSeparated:tt,commaSeparated:en,number:$,overloadedBoolean:Is,spaceSeparated:Ce},Symbol.toStringTag,{value:"Module"})),Pr=Object.keys(oi);class Ni extends Ze{constructor(e,n,r,i){let o=-1;if(super(e,n),Do(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&op.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(Oo,lp);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!Oo.test(o)){let a=o.replace(ip,sp);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=Ni}return new i(r,e)}function sp(t){return"-"+t.toLowerCase()}function lp(t){return t.charAt(1).toUpperCase()}const up=Ss([Rs,np,Ls,Ps,Ds],"html"),Os=Ss([Rs,rp,Ls,Ps,Ds],"svg"),Fo={}.hasOwnProperty;function cp(t,e){const n=e||{};function r(i,...o){let a=r.invalid;const s=r.handlers;if(i&&Fo.call(i,t)){const l=String(i[t]);a=Fo.call(s,l)?s[l]:r.unknown}if(a)return a.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const fp=/^>|^->||--!>|"],pp=["<",">"];function hp(t,e,n,r){return r.settings.bogusComments?"":"";function i(o){return Zt(o,Object.assign({},r.settings.characterReferences,{subset:pp}))}}function mp(t,e,n,r){return""}function gp(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function yp(t){return t.join(" ").trim()}const vp=/[ \t\n\f\r]/g;function Li(t){return typeof t=="object"?t.type==="text"?Bo(t.value):!1:Bo(t)}function Bo(t){return t.replace(vp,"")===""}const Oe=Bs(1),Fs=Bs(-1),xp=[];function Bs(t){return e;function e(n,r,i){const o=n?n.children:xp;let a=(r||0)+t,s=o[a];if(!i)for(;s&&Li(s);)a+=t,s=o[a];return s}}const bp={}.hasOwnProperty;function zs(t){return e;function e(n,r,i){return bp.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const Pi=zs({body:Tp,caption:Dr,colgroup:Dr,dd:Ep,dt:kp,head:Dr,html:wp,li:_p,optgroup:Mp,option:Sp,p:Ap,rp:zo,rt:zo,tbody:Rp,td:Uo,tfoot:Cp,th:Uo,thead:Ip,tr:Np});function Dr(t,e,n){const r=Oe(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Li(r.value.charAt(0)))}function wp(t,e,n){const r=Oe(n,e);return!r||r.type!=="comment"}function Tp(t,e,n){const r=Oe(n,e);return!r||r.type!=="comment"}function Ap(t,e,n){const r=Oe(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function _p(t,e,n){const r=Oe(n,e);return!r||r.type==="element"&&r.tagName==="li"}function kp(t,e,n){const r=Oe(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Ep(t,e,n){const r=Oe(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function zo(t,e,n){const r=Oe(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Mp(t,e,n){const r=Oe(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Sp(t,e,n){const r=Oe(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Ip(t,e,n){const r=Oe(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Rp(t,e,n){const r=Oe(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Cp(t,e,n){return!Oe(n,e)}function Np(t,e,n){const r=Oe(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Uo(t,e,n){const r=Oe(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Lp=zs({body:Op,colgroup:Fp,head:Dp,html:Pp,tbody:Bp});function Pp(t){const e=Oe(t,-1);return!e||e.type!=="comment"}function Dp(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Op(t){const e=Oe(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Li(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Fp(t,e,n){const r=Fs(n,e),i=Oe(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Pi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function Bp(t,e,n){const r=Fs(n,e),i=Oe(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Pi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const Fn={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 zp(t,e,n,r){const i=r.schema,o=i.space==="svg"?!1:r.settings.omitOptionalTags;let a=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const s=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=Os);const u=Up(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(a=!1),(u||!o||!Lp(t,e,n))&&(s.push("<",t.tagName,u?" "+u:""),a&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(c),!a&&(!o||!Pi(t,e,n))&&s.push(""),s.join("")}function Up(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=jp(t,i,e[i]);o&&n.push(o)}}for(;++rZi(n,t.alternative)&&(a=t.alternative),s=a+Zt(n,Object.assign({},t.settings.characterReferences,{subset:(a==="'"?Fn.single:Fn.double)[i][o],attribute:!0}))+a),l+(s&&"="+s))}const Vp=["<","&"];function Us(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Zt(t.value,Object.assign({},r.settings.characterReferences,{subset:Vp}))}function Hp(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Us(t,e,n,r)}function Gp(t,e,n,r){return r.all(t)}const $p=cp("type",{invalid:qp,unknown:Yp,handlers:{comment:hp,doctype:mp,element:zp,raw:Hp,root:Gp,text:Us}});function qp(t){throw new Error("Expected node, not `"+t+"`")}function Yp(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Kp={},Wp={},Xp=[];function Qp(t,e){const n=e||Kp,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Zp,all:Jp,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||ep,characterReferences:n.characterReferences||Wp,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Os:up,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Zp(t,e,n){return $p(t,e,n,this)}function Jp(t){const e=[],n=t&&t.children||Xp;let r=-1;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);o0?(mt(t,t.length,0,e),t):e}const Ho={}.hasOwnProperty;function ih(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function tn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ht=Dt(/[A-Za-z]/),rt=Dt(/[\dA-Za-z]/),sh=Dt(/[#-'*+\--9=?A-Z^-~]/);function ai(t){return t!==null&&(t<32||t===127)}const si=Dt(/\d/),lh=Dt(/[\dA-Fa-f]/),uh=Dt(/[!-/:-@[-`{-~]/);function se(t){return t!==null&&t<-2}function Qe(t){return t!==null&&(t<0||t===32)}function Ee(t){return t===-2||t===-1||t===32}const ch=Dt(new RegExp("\\p{P}|\\p{S}","u")),fh=Dt(/\s/);function Dt(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function sn(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const s=t.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ne(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return Ee(l)?(t.enter(n),s(l)):e(l)}function s(l){return Ee(l)&&o++a))return;const I=e.events.length;let b=I,g,m;for(;b--;)if(e.events[b][0]==="exit"&&e.events[b][1].type==="chunkFlow"){if(g){m=e.events[b][1].end;break}g=!0}for(T(r),h=I;hk;){const P=n[C];e.containerState=P[1],P[0].exit.call(e,t)}n.length=k}function M(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function gh(t,e,n){return Ne(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $o(t){if(t===null||Qe(t)||fh(t))return 1;if(ch(t))return 2}function Oi(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},p={...t[n][1].start};qo(f,-l),qo(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},t[r][1].end={...a.start},t[n][1].start={...s.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=lt(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=lt(u,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",o,e]]),u=lt(u,Oi(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=lt(u,[["exit",o,e],["enter",s,e],["exit",s,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=lt(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,mt(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Ee(h)?Ne(t,M,"linePrefix",o+1)(h):M(h)}function M(h){return h===null||se(h)?t.check(Yo,v,C)(h):(t.enter("codeFlowValue"),k(h))}function k(h){return h===null||se(h)?(t.exit("codeFlowValue"),M(h)):(t.consume(h),k)}function C(h){return t.exit("codeFenced"),e(h)}function P(h,I,b){let g=0;return m;function m(F){return h.enter("lineEnding"),h.consume(F),h.exit("lineEnding"),A}function A(F){return h.enter("codeFencedFence"),Ee(F)?Ne(h,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):S(F)}function S(F){return F===s?(h.enter("codeFencedFenceSequence"),B(F)):b(F)}function B(F){return F===s?(g++,h.consume(F),B):g>=a?(h.exit("codeFencedFenceSequence"),Ee(F)?Ne(h,D,"whitespace")(F):D(F)):b(F)}function D(F){return F===null||se(F)?(h.exit("codeFencedFence"),I(F)):b(F)}}}function Sh(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const Or={name:"codeIndented",tokenize:Rh},Ih={partial:!0,tokenize:Ch};function Rh(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),Ne(t,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):se(u)?t.attempt(Ih,a,l)(u):(t.enter("codeFlowValue"),s(u))}function s(u){return u===null||se(u)?(t.exit("codeFlowValue"),a(u)):(t.consume(u),s)}function l(u){return t.exit("codeIndented"),e(u)}}function Ch(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Ne(t,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):se(a)?i(a):n(a)}}const Nh={name:"codeText",previous:Ph,resolve:Lh,tokenize:Dh};function Lh(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length)return this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse();const i=this.left.slice(e);return i.push(...this.right.slice(this.right.length-r+this.left.length).reverse()),i}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&hn(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),hn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),hn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function Ys(t,e,n,r,i,o,a,s,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(T){return T===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(T),t.exit(o),p):T===null||T===32||T===41||ai(T)?n(T):(t.enter(r),t.enter(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),v(T))}function p(T){return T===62?(t.enter(o),t.consume(T),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),d(T))}function d(T){return T===62?(t.exit("chunkString"),t.exit(s),p(T)):T===null||T===60||se(T)?n(T):(t.consume(T),T===92?y:d)}function y(T){return T===60||T===62||T===92?(t.consume(T),d):d(T)}function v(T){return!c&&(T===null||T===41||Qe(T))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(r),e(T)):c999||d===null||d===91||d===93&&!l||d===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):d===93?(t.exit(o),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):se(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||se(d)||s++>999?(t.exit("chunkString"),c(d)):(t.consume(d),l||(l=!Ee(d)),d===92?p:f)}function p(d){return d===91||d===92||d===93?(t.consume(d),s++,f):f(d)}}function Ws(t,e,n,r,i,o){let a;return s;function s(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),a=p===40?41:p,l):n(p)}function l(p){return p===a?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(o),u(p))}function u(p){return p===a?(t.exit(o),l(a)):p===null?n(p):se(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Ne(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===a||p===null||se(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?f:c)}function f(p){return p===a||p===92?(t.consume(p),c):c(p)}}function xn(t,e){let n;return r;function r(i){return se(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ee(i)?Ne(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Hh={name:"definition",tokenize:$h},Gh={partial:!0,tokenize:qh};function $h(t,e,n){const r=this;let i;return o;function o(d){return t.enter("definition"),a(d)}function a(d){return Ks.call(r,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function s(d){return i=tn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):n(d)}function l(d){return Qe(d)?xn(t,u)(d):u(d)}function u(d){return Ys(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function c(d){return t.attempt(Gh,f,f)(d)}function f(d){return Ee(d)?Ne(t,p,"whitespace")(d):p(d)}function p(d){return d===null||se(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function qh(t,e,n){return r;function r(s){return Qe(s)?xn(t,i)(s):n(s)}function i(s){return Ws(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return Ee(s)?Ne(t,a,"whitespace")(s):a(s)}function a(s){return s===null||se(s)?e(s):n(s)}}const Yh={name:"hardBreakEscape",tokenize:Kh};function Kh(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return se(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const Wh={name:"headingAtx",resolve:Xh,tokenize:Qh};function Xh(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},mt(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function Qh(t,e,n){let r=0;return i;function i(c){return t.enter("atxHeading"),o(c)}function o(c){return t.enter("atxHeadingSequence"),a(c)}function a(c){return c===35&&r++<6?(t.consume(c),a):c===null||Qe(c)?(t.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||se(c)?(t.exit("atxHeading"),e(c)):Ee(c)?Ne(t,s,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||Qe(c)?(t.exit("atxHeadingText"),s(c)):(t.consume(c),u)}}const Zh=["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"],Wo=["pre","script","style","textarea"],Jh={concrete:!0,name:"htmlFlow",resolveTo:nm,tokenize:rm},em={partial:!0,tokenize:om},tm={partial:!0,tokenize:im};function nm(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function rm(t,e,n){const r=this;let i,o,a,s,l;return u;function u(R){return c(R)}function c(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),f}function f(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),o=!0,v):R===63?(t.consume(R),i=3,r.interrupt?e:_):ht(R)?(t.consume(R),a=String.fromCharCode(R),x):n(R)}function p(R){return R===45?(t.consume(R),i=2,d):R===91?(t.consume(R),i=5,s=0,y):ht(R)?(t.consume(R),i=4,r.interrupt?e:_):n(R)}function d(R){return R===45?(t.consume(R),r.interrupt?e:_):n(R)}function y(R){const ye="CDATA[";return R===ye.charCodeAt(s++)?(t.consume(R),s===ye.length?r.interrupt?e:S:y):n(R)}function v(R){return ht(R)?(t.consume(R),a=String.fromCharCode(R),x):n(R)}function x(R){if(R===null||R===47||R===62||Qe(R)){const ye=R===47,_e=a.toLowerCase();return!ye&&!o&&Wo.includes(_e)?(i=1,r.interrupt?e(R):S(R)):Zh.includes(a.toLowerCase())?(i=6,ye?(t.consume(R),T):r.interrupt?e(R):S(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?M(R):k(R))}return R===45||rt(R)?(t.consume(R),a+=String.fromCharCode(R),x):n(R)}function T(R){return R===62?(t.consume(R),r.interrupt?e:S):n(R)}function M(R){return Ee(R)?(t.consume(R),M):m(R)}function k(R){return R===47?(t.consume(R),m):R===58||R===95||ht(R)?(t.consume(R),C):Ee(R)?(t.consume(R),k):m(R)}function C(R){return R===45||R===46||R===58||R===95||rt(R)?(t.consume(R),C):P(R)}function P(R){return R===61?(t.consume(R),h):Ee(R)?(t.consume(R),P):k(R)}function h(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),l=R,I):Ee(R)?(t.consume(R),h):b(R)}function I(R){return R===l?(t.consume(R),l=null,g):R===null||se(R)?n(R):(t.consume(R),I)}function b(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Qe(R)?P(R):(t.consume(R),b)}function g(R){return R===47||R===62||Ee(R)?k(R):n(R)}function m(R){return R===62?(t.consume(R),A):n(R)}function A(R){return R===null||se(R)?S(R):Ee(R)?(t.consume(R),A):n(R)}function S(R){return R===45&&i===2?(t.consume(R),j):R===60&&i===1?(t.consume(R),J):R===62&&i===4?(t.consume(R),ee):R===63&&i===3?(t.consume(R),_):R===93&&i===5?(t.consume(R),Z):se(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(em,ge,B)(R)):R===null||se(R)?(t.exit("htmlFlowData"),B(R)):(t.consume(R),S)}function B(R){return t.check(tm,D,ge)(R)}function D(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),F}function F(R){return R===null||se(R)?B(R):(t.enter("htmlFlowData"),S(R))}function j(R){return R===45?(t.consume(R),_):S(R)}function J(R){return R===47?(t.consume(R),a="",oe):S(R)}function oe(R){if(R===62){const ye=a.toLowerCase();return Wo.includes(ye)?(t.consume(R),ee):S(R)}return ht(R)&&a.length<8?(t.consume(R),a+=String.fromCharCode(R),oe):S(R)}function Z(R){return R===93?(t.consume(R),_):S(R)}function _(R){return R===62?(t.consume(R),ee):R===45&&i===2?(t.consume(R),_):S(R)}function ee(R){return R===null||se(R)?(t.exit("htmlFlowData"),ge(R)):(t.consume(R),ee)}function ge(R){return t.exit("htmlFlow"),e(R)}}function im(t,e,n){const r=this;return i;function i(a){return se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function om(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(lr,e,n)}}const am={name:"htmlText",tokenize:sm};function sm(t,e,n){const r=this;let i,o,a;return s;function s(_){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(_),l}function l(_){return _===33?(t.consume(_),u):_===47?(t.consume(_),P):_===63?(t.consume(_),k):ht(_)?(t.consume(_),b):n(_)}function u(_){return _===45?(t.consume(_),c):_===91?(t.consume(_),o=0,y):ht(_)?(t.consume(_),M):n(_)}function c(_){return _===45?(t.consume(_),d):n(_)}function f(_){return _===null?n(_):_===45?(t.consume(_),p):se(_)?(a=f,J(_)):(t.consume(_),f)}function p(_){return _===45?(t.consume(_),d):f(_)}function d(_){return _===62?j(_):_===45?p(_):f(_)}function y(_){const ee="CDATA[";return _===ee.charCodeAt(o++)?(t.consume(_),o===ee.length?v:y):n(_)}function v(_){return _===null?n(_):_===93?(t.consume(_),x):se(_)?(a=v,J(_)):(t.consume(_),v)}function x(_){return _===93?(t.consume(_),T):v(_)}function T(_){return _===62?j(_):_===93?(t.consume(_),T):v(_)}function M(_){return _===null||_===62?j(_):se(_)?(a=M,J(_)):(t.consume(_),M)}function k(_){return _===null?n(_):_===63?(t.consume(_),C):se(_)?(a=k,J(_)):(t.consume(_),k)}function C(_){return _===62?j(_):k(_)}function P(_){return ht(_)?(t.consume(_),h):n(_)}function h(_){return _===45||rt(_)?(t.consume(_),h):I(_)}function I(_){return se(_)?(a=I,J(_)):Ee(_)?(t.consume(_),I):j(_)}function b(_){return _===45||rt(_)?(t.consume(_),b):_===47||_===62||Qe(_)?g(_):n(_)}function g(_){return _===47?(t.consume(_),j):_===58||_===95||ht(_)?(t.consume(_),m):se(_)?(a=g,J(_)):Ee(_)?(t.consume(_),g):j(_)}function m(_){return _===45||_===46||_===58||_===95||rt(_)?(t.consume(_),m):A(_)}function A(_){return _===61?(t.consume(_),S):se(_)?(a=A,J(_)):Ee(_)?(t.consume(_),A):g(_)}function S(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(t.consume(_),i=_,B):se(_)?(a=S,J(_)):Ee(_)?(t.consume(_),S):(t.consume(_),D)}function B(_){return _===i?(t.consume(_),i=void 0,F):_===null?n(_):se(_)?(a=B,J(_)):(t.consume(_),B)}function D(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Qe(_)?g(_):(t.consume(_),D)}function F(_){return _===47||_===62||Qe(_)?g(_):n(_)}function j(_){return _===62?(t.consume(_),t.exit("htmlTextData"),t.exit("htmlText"),e):n(_)}function J(_){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),oe}function oe(_){return Ee(_)?Ne(t,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return t.enter("htmlTextData"),a(_)}}const Fi={name:"labelEnd",resolveAll:fm,resolveTo:dm,tokenize:pm},lm={tokenize:hm},um={tokenize:mm},cm={tokenize:gm};function fm(t){let e=-1;const n=[];for(;++e=3&&(u===null||se(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Ee(u)?Ne(t,s,"whitespace")(u):s(u))}}const Ke={continuation:{tokenize:Em},exit:Sm,name:"list",tokenize:km},Am={partial:!0,tokenize:Im},_m={partial:!0,tokenize:Mm};function km(t,e,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(d){const y=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:si(d)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(Hn,n,u)(d):u(d);if(!r.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return n(d)}function l(d){return si(d)&&++a<10?(t.consume(d),l):(!r.interrupt||a<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),u(d)):n(d)}function u(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,t.check(lr,r.interrupt?n:c,t.attempt(Am,p,f))}function c(d){return r.containerState.initialBlankLine=!0,o++,p(d)}function f(d){return Ee(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),p):n(d)}function p(d){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function Em(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(lr,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(t,e,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!Ee(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(_m,e,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(t,t.attempt(Ke,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Mm(t,e,n){const r=this;return Ne(t,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(o):n(o)}}function Sm(t){t.exit(this.containerState.type)}function Im(t,e,n){const r=this;return Ne(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Ee(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const Xo={name:"setextUnderline",resolveTo:Rm,tokenize:Cm};function Rm(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",a,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function Cm(t,e,n){const r=this;let i;return o;function o(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return t.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(t.consume(u),s):(t.exit("setextHeadingLineSequence"),Ee(u)?Ne(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||se(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const Nm={tokenize:Lm};function Lm(t){const e=this,n=t.attempt(lr,r,t.attempt(this.parser.constructs.flowInitial,i,Ne(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Bh,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Pm={resolveAll:Qs()},Dm=Xs("string"),Om=Xs("text");function Xs(t){return{resolveAll:Qs(t==="text"?Fm:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],o=n.attempt(i,a,s);return a;function a(c){return u(c)?o(c):s(c)}function s(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=i[c];let p=-1;if(f)for(;++p-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(t[i].slice(0,o))}return a}function Xm(t,e){let n=-1;const r=[];let i;for(;++n0){const $e=ie.tokenStack[ie.tokenStack.length-1];($e[1]||ea).call(ie,void 0,$e[0])}for(K.position={start:It(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:It(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function pg(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function hg(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function el(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function mg(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return el(t,e);const i={src:sn(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function gg(t,e){const n={src:sn(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function yg(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function vg(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return el(t,e);const i={href:sn(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function xg(t,e){const n={href:sn(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function bg(t,e,n){const r=t.all(e),i=n?wg(n):tl(e),o={},a=[];if(typeof e.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let s=-1;for(;++s1}function Tg(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Eg(t){const e=rl(t),n=nl(t);if(e&&n)return{start:e,end:n}}function Mg(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},s=rl(e.children[1]),l=nl(e.children[e.children.length-1]);s&&l&&(a.position={start:s,end:l}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,o),t.applyData(e,o)}function Sg(t,e,n){const r=n?n.children:void 0,o=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,s=a?a.length:e.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return o.push(ra(e.slice(i),i>0,!1)),o.join("")}function ra(t,e,n){let r=0,i=t.length;if(e){let o=t.codePointAt(r);for(;o===ta||o===na;)r++,o=t.codePointAt(r)}if(n){let o=t.codePointAt(i-1);for(;o===ta||o===na;)i--,o=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function Cg(t,e){const n={type:"text",value:Rg(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Ng(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Lg={blockquote:sg,break:lg,code:ug,delete:cg,emphasis:fg,footnoteReference:dg,heading:pg,html:hg,imageReference:mg,image:gg,inlineCode:yg,linkReference:vg,link:xg,listItem:bg,list:Tg,paragraph:Ag,root:_g,strong:kg,table:Mg,tableCell:Ig,tableRow:Sg,text:Cg,thematicBreak:Ng,toml:Bn,yaml:Bn,definition:Bn,footnoteDefinition:Bn};function Bn(){}const ol=-1,ur=0,Jn=1,er=2,Bi=3,zi=4,Ui=5,ji=6,al=7,sl=8,ia=typeof self=="object"?self:globalThis,Pg=(t,e)=>{const n=(i,o)=>(t.set(o,i),i),r=i=>{if(t.has(i))return t.get(i);const[o,a]=e[i];switch(o){case ur:case ol:return n(a,i);case Jn:{const s=n([],i);for(const l of a)s.push(r(l));return s}case er:{const s=n({},i);for(const[l,u]of a)s[r(l)]=r(u);return s}case Bi:return n(new Date(a),i);case zi:{const{source:s,flags:l}=a;return n(new RegExp(s,l),i)}case Ui:{const s=n(new Map,i);for(const[l,u]of a)s.set(r(l),r(u));return s}case ji:{const s=n(new Set,i);for(const l of a)s.add(r(l));return s}case al:{const{name:s,message:l}=a;return n(new ia[s](l),i)}case sl:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i)}return n(new ia[o](a),i)};return r},oa=t=>Pg(new Map,t)(0),Kt="",{toString:Dg}={},{keys:Og}=Object,mn=t=>{const e=typeof t;if(e!=="object"||!t)return[ur,e];const n=Dg.call(t).slice(8,-1);switch(n){case"Array":return[Jn,Kt];case"Object":return[er,Kt];case"Date":return[Bi,Kt];case"RegExp":return[zi,Kt];case"Map":return[Ui,Kt];case"Set":return[ji,Kt]}return n.includes("Array")?[Jn,n]:n.includes("Error")?[al,n]:[er,n]},zn=([t,e])=>t===ur&&(e==="function"||e==="symbol"),Fg=(t,e,n,r)=>{const i=(a,s)=>{const l=r.push(a)-1;return n.set(s,l),l},o=a=>{if(n.has(a))return n.get(a);let[s,l]=mn(a);switch(s){case ur:{let c=a;switch(l){case"bigint":s=sl,c=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([ol],a)}return i([s,c],a)}case Jn:{if(l)return i([l,[...a]],a);const c=[],f=i([s,c],a);for(const p of a)c.push(o(p));return f}case er:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const c=[],f=i([s,c],a);for(const p of Og(a))(t||!zn(mn(a[p])))&&c.push([o(p),o(a[p])]);return f}case Bi:return i([s,a.toISOString()],a);case zi:{const{source:c,flags:f}=a;return i([s,{source:c,flags:f}],a)}case Ui:{const c=[],f=i([s,c],a);for(const[p,d]of a)(t||!(zn(mn(p))||zn(mn(d))))&&c.push([o(p),o(d)]);return f}case ji:{const c=[],f=i([s,c],a);for(const p of a)(t||!zn(mn(p)))&&c.push(o(p));return f}}const{message:u}=a;return i([s,{name:l,message:u}],a)};return o},aa=(t,{json:e,lossy:n}={})=>{const r=[];return Fg(!(e||n),!!e,new Map,r)(t),r},tr=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?oa(aa(t,e)):structuredClone(t):(t,e)=>oa(aa(t,e));function Bg(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function zg(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Ug(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Bg,r=t.options.footnoteBackLabel||zg,i=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l0&&y.push({type:"text",value:" "});let M=typeof n=="string"?n:n(l,d);typeof M=="string"&&(M={type:"text",value:M}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const x=c[c.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const M=x.children[x.children.length-1];M&&M.type==="text"?M.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...y)}else c.push(...y);const T={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(c,!0)};t.patch(u,T),s.push(T)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...tr(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(s,!0)},{type:"text",value:` +`}]}}const ll=function(t){if(t==null)return Gg;if(typeof t=="function")return cr(t);if(typeof t=="object")return Array.isArray(t)?jg(t):Vg(t);if(typeof t=="string")return Hg(t);throw new Error("Expected function, string, or object as test")};function jg(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let d=ul,y,v,x;if((!e||o(l,u,c[c.length-1]||void 0))&&(d=Wg(n(l,c)),d[0]===sa))return d;if("children"in l&&l.children){const T=l;if(T.children&&d[0]!==Yg)for(v=(r?T.children.length:-1)+a,x=c.concat(T);v>-1&&v0&&n.push({type:"text",value:` +`}),n}function la(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function ua(t,e){const n=Zg(t,e),r=n.one(t,void 0),i=Ug(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` +`},i),o}function ry(t,e){return t&&"run"in t?async function(n,r){const i=ua(n,{file:r,...e});await t.run(i,r)}:function(n,r){return ua(n,{file:r,...t||e})}}function ca(t){if(t)throw t}var Br,fa;function iy(){if(fa)return Br;fa=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},o=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!f)return!1;var p;for(p in u);return typeof p>"u"||t.call(u,p)},a=function(u,c){n&&c.name==="__proto__"?n(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},s=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return Br=function l(){var u,c,f,p,d,y,v=arguments[0],x=1,T=arguments.length,M=!1;for(typeof v=="boolean"&&(M=v,v=arguments[1]||{},x=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});xa.length;let l;s&&a.push(i);try{l=t.apply(this,a)}catch(u){const c=u;if(s&&n)throw c;return i(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(a,...s){n||(n=!0,e(a,...s))}function o(a){i(null,a)}}class Je extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(a=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=bn(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}Je.prototype.file="";Je.prototype.name="";Je.prototype.reason="";Je.prototype.message="";Je.prototype.stack="";Je.prototype.column=void 0;Je.prototype.line=void 0;Je.prototype.ancestors=void 0;Je.prototype.cause=void 0;Je.prototype.fatal=void 0;Je.prototype.place=void 0;Je.prototype.ruleId=void 0;Je.prototype.source=void 0;const pt={basename:ly,dirname:uy,extname:cy,join:fy,sep:"/"};function ly(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');In(t);let n=0,r=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(r=i):(s=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function uy(t){if(In(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function cy(t){In(t);let e=t.length,n=-1,r=0,i=-1,o=0,a;for(;e--;){const s=t.codePointAt(e);if(s===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),s===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function fy(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function py(t,e){let n="",r=0,i=-1,o=0,a=-1,s,l;for(;++a<=t.length;){if(a2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return n}function In(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const hy={cwd:my};function my(){return"/"}function di(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function gy(t){if(typeof t=="string")t=new URL(t);else if(!di(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return yy(t)}function yy(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[d,...y]=c;const v=r[p][1];fi(v)&&fi(d)&&(d=zr(!0,v,d)),r[p]=[u,d,...y]}}}}const Ty=new Vi().freeze();function Hr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Gr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function $r(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function pa(t){if(!fi(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function ha(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Un(t){return Ay(t)?t:new vy(t)}function Ay(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function _y(t){return typeof t=="string"||ky(t)}function ky(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function Hi(){const t=Ty().use(ag).use(ry).use(eh);return{process:e=>t.processSync(e).toString()}}const Ey={relative:""},My={"h-full":"","w-full":""},Sy={key:0,class:"animate-stripe",absolute:"",left:"1/2",bottom:"20%",z:"20","rounded-2xl":"",text:"primary-600","px-2":"","py-2":"",transform:"translate-x--1/2"},Iy={bg:"primary-50","rounded-xl":"","px-10":"","py-6":""},Ry=["innerHTML"],Cy=ze({__name:"Stage",props:{paused:{type:Boolean,default:!1}},setup(t){const e=W(),n=W(),{stageView:r}=We(nn()),{mouthOpenSize:i}=We(Hu()),{audioContext:o,calculateVolume:a}=ns(),{onBeforeMessageComposed:s,onBeforeSend:l,onTokenLiteral:u,onTokenSpecial:c,onStreamEnd:f,streamingMessage:p,onAssistantResponseEnd:d}=Pt(),{process:y}=Hi(),v=_i(),x=W(),T=W(!1),M=W(!1),k=gr({handlers:[_=>new Promise(ee=>{const ge=o.createBufferSource();ge.buffer=_.data.audioBuffer,ge.connect(o.destination),ge.connect(x.value),T.value=!0,ge.start(0),ge.onended=()=>{T.value=!1,ee()}})]}),C=Mu(),{ssmlEnabled:P,activeSpeechProvider:h,activeSpeechModel:I,activeSpeechVoice:b,pitch:g}=We(C);async function m(_){try{if(!h.value){console.warn("No active speech provider configured");return}if(!b.value){console.warn("No active speech voice configured");return}const ee=v.getProviderInstance(h.value);if(!ee){console.error("Failed to initialize speech provider");return}const ge=v.getProviderConfig(h.value),R=P.value?C.generateSSML(_.data,b.value,{...ge,pitch:g.value}):_.data,ye=await Su({...ee.speech(I.value,ge),input:R,voice:b.value.id}),_e=await o.decodeAudioData(ye);await k.add({audioBuffer:_e,text:_.data})}catch(ee){console.error("Speech generation failed:",ee)}}const A=gr({handlers:[m]});A.on("add",_=>{console.debug("ttsQueue added",_)});const S=Iu(A),{live2dCurrentMotion:B}=We(nn()),D=gr({handlers:[async _=>{if(r.value==="3d"){const ee=wl[_.data];if(!ee)return;await n.value.setExpression(ee)}else r.value==="2d"&&(B.value={group:Tl[_.data]})}]}),F=Ru(D);F.onHandlerEvent("emotion",_=>{console.debug("emotion detected",_)});const j=Cu();j.onHandlerEvent("delay",_=>{console.debug("delay detected",_)});function J(){requestAnimationFrame(J),T.value&&(i.value=a(x.value,"linear"))}function oe(){M.value||(J(),o.resume(),M.value=!0)}function Z(){x.value||(x.value=o.createAnalyser())}return s(async()=>{Z(),oe()}),l(async()=>{B.value={group:$i}}),u(async _=>{await S.add(_)}),c(async _=>{await j.add(_),await F.add(_)}),f(async()=>{await j.add(Nu)}),d(async _=>{}),Ht(()=>{var ee,ge,R;M.value=!1;const _=window;(ee=_.electron)==null||ee.ipcRenderer.removeAllListeners("before-hide"),(ge=_.electron)==null||ge.ipcRenderer.removeAllListeners("after-show"),(R=_.electron)==null||R.ipcRenderer.removeAllListeners("before-quit")}),wn(()=>{var ee,ge,R;const _=window;(ee=_.electron)==null||ee.ipcRenderer.on("before-hide",()=>{B.value={group:vl}}),(ge=_.electron)==null||ge.ipcRenderer.on("after-show",()=>{B.value={group:xl}}),(R=_.electron)==null||R.ipcRenderer.on("before-quit",()=>{B.value={group:$i}})}),wn(async()=>{e.value=bl({connection:{bundles:Eu()}}),await e.value.execute(ri`CREATE TABLE memory_test (vec FLOAT[768]);`)}),(_,ee)=>(Q(),re("div",Ey,[O("div",My,[V(r)==="2d"?(Q(),rn(Ju,{key:0,"mouth-open-size":V(i),"min-w":"50% (Q(),re("header",Fy,[O("div",By,[Ae(Bu)]),Ae(V(vu),{class:"m-1 block max-h-[10lh] min-h-[1lh] rounded-lg bg-neutral-100 p-2 text-lg text-neutral-500 outline-none dark:bg-neutral-800 dark:text-neutral-400",to:"/settings"},{default:Ve(()=>n[0]||(n[0]=[O("div",{"i-solar:settings-minimalistic-bold-duotone":""},null,-1)])),_:1})]))}});function cl(t,e){const n=Qa(e??{},{...eo.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),r=W(),i=xu("microphone");async function o(){if(r.value&&(r.value.destroy(),r.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const a=V(t);if(!a)return;const s=await navigator.mediaDevices.getUserMedia({audio:{deviceId:a}});r.value=await eo.MicVAD.new({...n,stream:s}),n.auto&&r.value.start()}return Ue(i,o,{immediate:!0}),Ue(bu(t),o,{immediate:!0}),wu(o),Ht(()=>{r.value&&(r.value.destroy(),r.value=void 0)}),{destroy:()=>{r.value&&(r.value.destroy(),r.value=void 0)},start:()=>{r.value&&r.value.start()}}}function Uy(t,e){const n=Qa(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:r,data:i,terminate:o}=Tu(t,{type:"module"}),a=W(null),s=W(""),l=W([]),u=W(!1),c=W(0),f=W("");return Ue(i,p=>{var d,y,v,x,T,M,k,C;switch(p.status){case"loading":a.value="loading",s.value=p.data,(d=n.onLoading)==null||d.call(n,p.data);break;case"initiate":l.value.push(p),(y=n.onInitiate)==null||y.call(n,p);break;case"progress":l.value=l.value.map(P=>P.file===p.file?{...P,...p}:P),(v=n.onProgress)==null||v.call(n,p);break;case"done":l.value=l.value.filter(P=>P.file!==p.file),(x=n.onDone)==null||x.call(n,p);break;case"ready":a.value="ready",(T=n.onReady)==null||T.call(n);break;case"start":u.value=!0,(M=n.onStart)==null||M.call(n);break;case"update":c.value=p.tps,(k=n.onUpdate)==null||k.call(n,p.tps);break;case"complete":u.value=!1,f.value=p.output[0]||"",console.debug("Whisper result:",f.value),(C=n.onComplete)==null||C.call(n,p.output[0]);break}}),Ht(()=>{o()}),{transcribe:p=>r(p),status:a,loadingMessage:s,loadingProgress:l,transcribing:u,tps:c,result:f,load:()=>r({type:"load"}),terminate:o}}const jy="/assets/worker-kM8CmLr7.js";async function Vy(t,e){const n=new ArrayBuffer(44+t.length*2),r=new DataView(n);jn(r,0,"RIFF"),r.setUint32(4,36+t.length*2,!0),jn(r,8,"WAVE"),jn(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,e,!0),r.setUint32(28,e*2,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),jn(r,36,"data"),r.setUint32(40,t.length*2,!0),Hy(r,44,t);const i=new Blob([r],{type:"audio/wav"});return new Promise((o,a)=>{const s=new FileReader;s.onload=()=>{const l=s.result.split(",")[1];o(l)},s.onerror=a,s.readAsDataURL(i)})}function jn(t,e,n){for(let r=0;r{Wn().then(()=>{i.update(),o.value=i.height.value})}),u(async()=>{Wn().then(()=>{i.update(),o.value=i.height.value})}),(c,f)=>{const p=Ja("auto-animate");return Q(),re("div",Gy,[f[2]||(f[2]=O("div",{"flex-1":""},null,-1)),Ct((Q(),re("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[f[1]||(f[1]=O("div",{"flex-1":""},null,-1)),(Q(!0),re(Ti,null,Ai(V(n),(d,y)=>(Q(),re("div",{key:y,"mb-2":""},[d.role==="error"?(Q(),re("div",$y,[O("div",qy,[O("div",Yy,[O("div",Ky,[O("span",Wy,me(V(a)("stage.chat.message.character-name.core-system")),1)]),f[0]||(f[0]=O("div",{"i-solar:danger-triangle-bold-duotone":"","text-violet-500":""},null,-1))]),V(r)&&y===V(n).length-1?(Q(),re("div",Xy)):(Q(),re("div",{key:1,class:"markdown-content break-words text-violet-500",text:"base {if(!B||!B.trim())return;const D=o.getProviderConfig(a.value);await y(B,{chatProvider:o.getProviderInstance(a.value),model:s.value,providerConfig:D})}});async function I(){if(e.value.trim())try{const B=o.getProviderConfig(a.value);await y(e.value,{chatProvider:o.getProviderInstance(a.value),model:s.value,providerConfig:B})}catch(B){x.value.pop(),x.value.push({role:"error",content:B.message})}}const{destroy:b,start:g}=cl(d,{onSpeechStart:()=>{n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:B=>{n.value=!1,A(B)},auto:!1});function m(){P.value!=="loading"&&(C(),g())}async function A(B){await T.resume();const D=await Vy(B,T.sampleRate);k({type:"generate",data:{audio:D,language:"en"}})}async function S(B){const D=B.target,F=u.value.find(j=>j.deviceId===D.value);if(!F){f.value=void 0;return}f.value=F}return Ue(p,async B=>{B==="false"&&(b(),h())}),Ue(i,async B=>{B&&await c()}),v(async()=>{e.value=""}),(B,D)=>(Q(),re("div",u0,[O("fieldset",c0,[O("label",{class:dt([r.value==="chat"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="chat"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="chat","aria-checked":r.value==="chat",border:"solid l-2 t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-l-lg":"","px-2":""},[Ct(O("input",{"onUpdate:modelValue":D[0]||(D[0]=F=>r.value=F),type:"radio",name:"tab",value:"chat",hidden:""},null,512),[[mr,r.value]]),D[5]||(D[5]=O("div",{"i-solar:dialog-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",d0,[O("span",p0,me(V(M)("stage.chat.tabs.chat")),1)])],10,f0),O("label",{class:dt([r.value==="custom"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="custom"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="custom","aria-checked":r.value==="custom",border:"solid t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","px-2":""},[Ct(O("input",{"onUpdate:modelValue":D[1]||(D[1]=F=>r.value=F),type:"radio",name:"tab",value:"custom",hidden:""},null,512),[[mr,r.value]]),D[6]||(D[6]=O("div",{"i-solar:star-fall-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",m0,[O("span",null,me(V(M)("stage.chat.tabs.custom")),1)])],10,h0),O("label",{class:dt([r.value==="clothes"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="clothes"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="clothes","aria-checked":r.value==="clothes",border:"solid r-2 t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-r-lg":"","px-2":""},[Ct(O("input",{"onUpdate:modelValue":D[2]||(D[2]=F=>r.value=F),type:"radio",name:"tab",value:"clothes",hidden:""},null,512),[[mr,r.value]]),D[7]||(D[7]=O("div",{"i-solar:magic-stick-3-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",y0,[O("span",null,me(V(M)("stage.chat.tabs.clothes")),1)])],10,g0)]),O("div",v0,[O("div",x0,[Ae(l0,{"h-full":"","flex-1":"","p-4":"",w:"full","max-h":"e.value=F),placeholder:V(M)("stage.message"),text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500 placeholder:primary-300 placeholder:hover:primary-500 placeholder:dark:primary-300/50 placeholder:dark:hover:primary-500",bg:"primary-100 dark:primary-400/20","min-h":"[100px]","max-h":"[300px]","w-full":"","rounded-t-xl":"","p-4":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",class:dt({"transition-colors-none placeholder:transition-colors-none":V(l)}),onSubmit:I},null,8,["modelValue","placeholder","class"])])])]),O("div",w0,[O("button",{bg:"complementary-100 hover:complementary-200 dark:complementary-800 dark:hover:complementary-700",transition:"all duration-250 ease-in-out",class:dt({"transition-colors-none":V(l)}),text:"complementary-400","mb-6":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":"",onClick:m},[Ae(_u,{mode:"out-in"},{default:Ve(()=>[V(P)===null?(Q(),re("div",T0,me(V(M)("stage.operations.load-models")),1)):V(P)==="loading"?(Q(),re("div",A0,[D[8]||(D[8]=O("div",{"i-svg-spinners:bouncing-ball":"",class:"text-cyan"},null,-1)),O("span",null,me(V(M)("stage.operations.load-models-status.loading")),1)])):V(P)==="ready"?(Q(),re("div",_0,[D[9]||(D[9]=O("div",{"i-lucide:check":"",class:"text-cyan"},null,-1)),O("span",null,me(V(M)("stage.operations.load-models-status.ready")),1)])):ut("",!0)]),_:1})],2),O("div",k0,[Ae(V(ki),null,{default:Ve(()=>[i.value?(Q(),re("fieldset",E0,[(Q(!0),re(Ti,null,Ai(V(u),(F,j)=>(Q(),re("label",{key:j,class:"[&_div_span]:dark:hover:bg-cyan-300 [&_div_span]:dark:hover:bg-cyan-900"},[O("input",{type:"radio",name:"audioInput",value:F.deviceId,hidden:"",onChange:S},null,40,M0),O("div",S0,[O("div",I0,[F.deviceId===V(d)?(Q(),re("div",R0)):ut("",!0)]),O("span",{"inline-block":"",class:dt([F.deviceId===V(d)?"cyan-400 dark:text-white":"cyan-400/50 dark:text-white/50"]),transition:"all duration-250 ease-in-out"},me(F.label),3)])]))),128))])):ut("",!0)]),_:1}),O("label",{bg:"complementary-100 hover:complementary-200 dark:complementary-800 dark:hover:complementary-700",transition:"all duration-250 ease-in-out",class:dt({"transition-colors-none":V(l)}),text:"complementary-400","h-fit":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":""},[Ct(O("input",{"onUpdate:modelValue":D[4]||(D[4]=F=>i.value=F),type:"checkbox",hidden:""},null,512),[[hi,i.value]]),D[10]||(D[10]=O("div",{"i-solar:microphone-2-bold-duotone":""},null,-1)),O("div",null,[n.value?(Q(),re("span",N0,"Listening...")):(Q(),re("span",C0,me(V(M)("settings.microphone")),1))])],2)])])]))}}),P0=or(L0,[["__scopeId","data-v-1f3e13c7"]]),D0={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},O0={key:0,flex:"",mr:"12"},F0={flex:"~ col",border:"4 solid primary-200/50 dark:primary-500/50",shadow:"md primary-200/50 dark:none","min-w-20":"","rounded-lg":"","px-2":"","py-1":"",h:"unset {Wn().then(()=>{i.update(),o.value=i.height.value})}),l(async()=>{Wn().then(()=>{i.update(),o.value=i.height.value})}),(u,c)=>{const f=Ja("auto-animate");return Q(),re("div",D0,[c[1]||(c[1]=O("div",{"flex-1":""},null,-1)),Ct((Q(),re("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"","max-h":"30vh",flex:"~ col","overflow-scroll":""},[c[0]||(c[0]=O("div",{"flex-1":""},null,-1)),(Q(!0),re(Ti,null,Ai(V(r),(p,d)=>(Q(),re("div",{key:d,"mb-2":""},[p.role==="assistant"?(Q(),re("div",O0,[O("div",F0,[O("div",null,[O("span",B0,me(V(n)("stage.chat.message.character-name.airi")),1)]),p.content?(Q(),re("div",{key:0,class:"markdown-content",text:"base {n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:x=>{n.value=!1,v()},auto:!1});function v(x){alert("Transcription is not implemented yet")}return Ue(a,async x=>{x==="false"&&d()}),c(async()=>{e.value=""}),wn(()=>{y()}),(x,T)=>(Q(),re("div",null,[O("div",Y0,[Ae(q0,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),O("div",K0,[Ae(V(es),{modelValue:e.value,"onUpdate:modelValue":T[0]||(T[0]=M=>e.value=M),placeholder:V(f)("stage.message"),border:"solid 2 primary-100 dark:primary-400/20",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500 placeholder:primary-300 placeholder:hover:primary-500 placeholder:dark:primary-300/50 placeholder:dark:hover:primary-500",bg:"primary-100 dark:primary-400/20","max-h":"[10lh]","min-h":"[1lh]","w-full":"","resize-none":"","overflow-y-scroll":"","rounded-xl":"","p-2":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",class:dt({"transition-colors-none placeholder:transition-colors-none":V(l)}),onSubmit:p},null,8,["modelValue","placeholder","class"])])])]))}}),X0={class:"relative"},Q0={absolute:"","left-0":"","right-0":"","top-0":"","w-full":"","overflow-hidden":""},Z0=ze({__name:"AnimatedWave",props:{height:{default:40},amplitude:{default:14},waveLength:{default:250},fillColor:{default:"oklch(95% 0.10 var(--theme-colors-hue))"},direction:{default:"down"},movementDirection:{default:"left"},animationSpeed:{default:50}},setup(t){const e=t,n=W(e.height),r=W(e.amplitude),i=W(e.waveLength),o=W(e.fillColor),a=W(e.direction),s=W(e.movementDirection);function l(f,p,d,y,v){const x=[],M=Math.ceil(f/y)*y,k=1,C=v==="up"?d:p-d;x.push(`M 0 ${C}`);const P=Math.PI*2/y;for(let I=0;I<=M;I+=k){const b=d*Math.sin(P*I),g=v==="up"?C-b:C+b;x.push(`L ${I} ${g}`)}const h=v==="up"?p:0;return x.push(`L ${M} ${h}`),x.push(`L 0 ${h} Z`),x.join(" ")}const u=He(()=>n.value+r.value*2),c=He(()=>{const f=` + + `;return`url(data:image/svg+xml;base64,${btoa(f)})`});return Ue(()=>[e.height,e.amplitude,e.waveLength,e.fillColor,e.direction,e.movementDirection],()=>{n.value=e.height,r.value=e.amplitude,i.value=e.waveLength,o.value=e.fillColor,a.value=e.direction,s.value=e.movementDirection},{immediate:!0}),(f,p)=>(Q(),re("div",X0,[_n(f.$slots,"default",{},void 0,!0),O("div",Q0,[O("div",{class:"wave",style:Wr({background:o.value,height:`${u.value}px`,maskImage:c.value,WebkitMaskImage:c.value,"--wave-translate":`${-i.value}px`,"--animation-duration":`${i.value/t.animationSpeed}s`,"animation-direction":s.value==="left"?"normal":"reverse"})},null,4)])]))}}),J0=or(Z0,[["__scopeId","data-v-d4cf94d8"]]),e1={relative:"",flex:"~ col","z-2":"","h-100dvh":"","w-100vw":"","of-hidden":""},t1={relative:"",flex:"~ 1 row gap-y-0 gap-x-2 (Q(),rn(Oy,null,{default:Ve(()=>[Ae(J0,{"fill-color":V(e)?"oklch(35% calc(var(--theme-colors-chroma) * 0.6) var(--theme-colors-hue))":"color-mix(in srgb, oklch(95% calc(var(--theme-colors-chroma-50) * 0.5) var(--theme-colors-hue)) 80%, oklch(100% 0 360))"},{default:Ve(()=>[O("div",e1,[O("div",null,[Ae(zy,{class:"flex",p2:""})]),O("div",t1,[Ae(V(Ny),{"flex-1":"","min-w":"1/2",paused:n.value},null,8,["paused"]),Ae(P0,{class:"flex {const b=x,s=h("motion");return o(),i(d,null,[z(e(v),{title:n.$t("settings.pages.providers.title"),subtitle:n.$t("settings.title")},null,8,["title","subtitle"]),c("div",S,[(o(!0),i(d,null,A(e(f),(t,r)=>m((o(),l(e(w),{key:t.id,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+r*10,delay:r*50,title:t.localizedName,description:t.localizedDescription,icon:t.icon,"icon-color":t.iconColor,"icon-image":t.iconImage,to:`/settings/providers/${t.id}`,configured:t.configured},null,8,["duration","delay","title","description","icon","icon-color","icon-image","to","configured"])),[[s]])),128))]),e(y)?(o(),l(b,{key:0,"z-index":-1,icon:e(g),"icon-size":12,duration:1e3,started:e(_),"is-reverse":!0,position:"calc(100dvw - 9.5rem), calc(100dvh - 9.5rem)","text-color":"text-neutral-200/50 dark:text-neutral-600/20"},null,8,["icon","started"])):m((o(),i("div",D,a[0]||(a[0]=[c("div",{text:"60","i-solar:box-minimalistic-bold-duotone":""},null,-1)]))),[[s]])],64)}}});typeof u=="function"&&u(N);export{N as default}; diff --git a/assets/index-Cu7e5uZ2.js b/assets/index-Cu7e5uZ2.js new file mode 100644 index 0000000000000000000000000000000000000000..b53aed7ab5fe24d9ab3f09619c93bb3cc7819a13 --- /dev/null +++ b/assets/index-Cu7e5uZ2.js @@ -0,0 +1 @@ +import{_ as Z}from"./IconAnimation.vue_vue_type_script_setup_true_lang-CRr1ZQyH.js";import{k as V,l as P,m as q,J as H}from"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as E,v as B,c as p,o as s,u as t,m as W,q as G,bN as K,s as Q,g as F,w as X,bO as Y,b as i,x as A,C as ee,y as u,a as m,A as S,bE as te,bL as g,D as N,bx as U,by as z,bH as oe,bn as ne,k as ie,bw as le}from"./index-D8Nm21zW.js";import{_ as ae}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{_ as se,a as re}from"./Model.vue_vue_type_script_setup_true_lang-xbmtXrdQ.js";import{V as de}from"./browser-CkchkNbv.js";import{_ as D,a as ce}from"./ColorPalette.vue_vue_type_script_setup_true_lang-Dh84R3gB.js";import{u as ue}from"./useIconAnimation-D5irYuyi.js";import{b as I}from"./route-block-B_A1xBdJ.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./index-BUaUWOtl.js";const me=["disabled"],h=E({__name:"Live2DModelControlButton",emits:["click"],setup(L){const f=B();return(r,n)=>(s(),p("button",{disabled:t(f).loadingLive2dModel,bg:"neutral-100 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700",transition:"all ease-in-out duration-250",rounded:"",onClick:n[0]||(n[0]=v=>r.$emit("click"))},[W(r.$slots,"default")],8,me))}}),fe={flex:"~ col gap-4"},pe={flex:"","items-center":"","gap-2":""},ve=["disabled","placeholder"],be={"font-medium":""},_e={flex:"","gap-2":""},ge=["onUpdate:modelValue"],he=["href","download"],ye=E({__name:"Live2DSettings",props:{palette:null},emits:["extractColorsFromModel"],setup(L){const{t:f}=G(),r=K({accept:"application/zip"}),n=B(),{live2dModelFile:v,live2dMotionMap:b,live2dLoadSource:y,loadingLive2dModel:x,availableLive2dMotions:j,live2dModelUrl:M}=Q(n),d=F(M.value);r.onChange(o=>{o&&o.length>0&&(b.value={},v.value=o[0],y.value="file",x.value=!0)}),X(()=>n.loadingLive2dModel,o=>{o||y.value==="file"&&j.value.forEach(e=>{e.motionName in V?b.value[e.fileName]=e.motionName:b.value[e.fileName]=P})});async function _(o,e){if(!Object.keys(e).length)return o;const a=await new H().loadAsync(o),c=Object.keys(a.files).find($=>$.endsWith("model3.json"));if(!c)throw new Error("model3.json not found");const J=await a.file(c).async("string"),R=JSON.parse(J),C={};Object.entries(e).forEach(([$,O])=>{if(C[O]){C[O].push({File:$});return}C[O]=[{File:$}]}),R.FileReferences.Motions=C,a.file(c,JSON.stringify(R,null,2));const T=await a.generateAsync({type:"blob"});return new File([T],o.name,{type:o.type,lastModified:o.lastModified})}async function w(){const o=await q.getItem("live2dModel");if(!o)return;const e=await _(o,b.value);v.value=e,y.value="file",x.value=!0}const k=Y(v);return(o,e)=>(s(),p("div",fe,[i(t(D),{title:"settings.live2d.change-model.title",icon:"i-solar:magic-stick-3-bold-duotone","inner-class":"text-sm"},{default:u(()=>[m("div",pe,[S(m("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>d.value=l),disabled:t(n).loadingLive2dModel,class:"form-control flex-1",border:"neutral-300 dark:neutral-800 solid 1 focus:neutral-400 dark:focus:neutral-600",transition:"border duration-250 ease-in-out",placeholder:t(f)("settings.live2d.change-model.from-url-placeholder")},null,8,ve),[[te,d.value]]),i(h,{class:"form-control",onClick:e[1]||(e[1]=l=>M.value=d.value)},{default:u(()=>[g(N(t(f)("settings.live2d.change-model.from-url")),1)]),_:1})]),i(h,{class:"form-control place-self-end",onClick:e[2]||(e[2]=l=>t(r).open())},{default:u(()=>[g(N(t(f)("settings.live2d.change-model.from-file"))+"... ",1)]),_:1}),i(h,{class:"form-control",onClick:e[3]||(e[3]=l=>o.$emit("extractColorsFromModel"))},{default:u(()=>e[4]||(e[4]=[g(" Extract colors from model ")])),_:1}),i(ce,{colors:L.palette.map(l=>({hex:l,name:l}))},null,8,["colors"])]),_:1}),t(n).live2dLoadSource==="file"?(s(),A(t(D),{key:0,title:"settings.live2d.edit-motion-map.title",icon:"i-solar:face-scan-circle-bold-duotone"},{default:u(()=>{var l;return[(s(!0),p(U,null,z(t(n).availableLive2dMotions,a=>(s(),p("div",{key:a.fileName,flex:"","items-center":"","justify-between":"","text-sm":""},[m("span",be,N(a.fileName),1),m("div",_e,[S(m("select",{"onUpdate:modelValue":c=>t(n).live2dMotionMap[a.fileName]=c},[(s(!0),p(U,null,z(Object.keys(t(V)),c=>(s(),p("option",{key:c},N(c),1))),128))],8,ge),[[oe,t(n).live2dMotionMap[a.fileName]]]),i(h,{class:"form-control",onClick:c=>t(n).live2dCurrentMotion={group:a.motionName,index:a.motionIndex}},{default:u(()=>e[5]||(e[5]=[g(" Play ")])),_:2},1032,["onClick"])])]))),128)),i(h,{onClick:w},{default:u(()=>e[6]||(e[6]=[g(" Save and patch ")])),_:1}),m("a",{"mt-2":"",block:"",href:t(k),download:`${((l=t(n).live2dModelFile)==null?void 0:l.name)||"live2d"}-motion-edited.zip`},[i(h,{"w-full":""},{default:u(()=>e[7]||(e[7]=[g("Export")])),_:1})],8,he)]}),_:1})):ee("",!0)]))}}),ke=ne(ye,[["__scopeId","data-v-b2e16668"]]),xe={flex:""},Me={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,y:15},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},we=E({__name:"index",setup(L){const f=F(),r=F(),{width:n,height:v}=ie(f),b=F([]);async function y(){if(!r.value)return;const d=await r.value.captureFrame();if(!d){console.error("No frame captured");return}const _=URL.createObjectURL(d);try{const k=await new de(_).getPalette();b.value=Object.values(k).map(o=>o==null?void 0:o.hex).filter(o=>typeof o=="string")}finally{URL.revokeObjectURL(_)}}const{iconAnimationStarted:x,showIconAnimation:j,animationIcon:M}=ue("i-solar:people-nearby-bold-duotone");return(d,_)=>{const w=Z,k=le("motion");return s(),p(U,null,[i(t(ae),{title:d.$t("settings.pages.models.title"),subtitle:d.$t("settings.title")},null,8,["title","subtitle"]),m("div",xe,[m("div",{ref_key:"live2dContainerRef",ref:f,w:"50%",h:"80vh"},[i(t(re),{ref_key:"live2dCanvasRef",ref:r,width:t(n),height:t(v)},{default:u(({app:o})=>[i(t(se),{app:o,"mouth-open-size":0,width:t(n),height:t(v),paused:!1},null,8,["app","width","height"])]),_:1},8,["width","height"])],512),i(ke,{w:"50%",h:"80vh",palette:b.value,onExtractColorsFromModel:y},null,8,["palette"])]),t(j)?(s(),A(w,{key:0,"z-index":-1,icon:t(M),"icon-size":12,duration:1e3,started:t(x),"is-reverse":!0,position:"calc(100dvw - 9.5rem), calc(100dvh - 9.5rem)","text-color":"text-neutral-200/50 dark:text-neutral-600/20"},null,8,["icon","started"])):S((s(),p("div",Me,_[0]||(_[0]=[m("div",{text:"60","i-solar:people-nearby-bold-duotone":""},null,-1)]))),[[k]])],64)}}});typeof I=="function"&&I(we);export{we as default}; diff --git a/assets/index-Cy4LPsSb.js b/assets/index-Cy4LPsSb.js new file mode 100644 index 0000000000000000000000000000000000000000..83aa1cdaf7b14c30d77cafa0c2c2323b52301575 --- /dev/null +++ b/assets/index-Cy4LPsSb.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as n}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{d as a,bw as r,c as i,o,b as l,A as c,u as m,a as d,bx as u}from"./index-D8Nm21zW.js";const p={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-20rem)]","bottom-0":"","right--15":"","z--1":"",initial:{scale:.9,opacity:0,y:40},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},x=a({__name:"index",setup(f){return(e,t)=>{const s=r("motion");return o(),i(u,null,[l(m(n),{title:e.$t("settings.pages.memory.title"),subtitle:e.$t("settings.title")},null,8,["title","subtitle"]),c((o(),i("div",p,t[0]||(t[0]=[d("div",{text:"60","i-solar:leaf-bold-duotone":""},null,-1)]))),[[s]])],64)}}});export{x as default}; diff --git a/assets/index-Czce94mI.js b/assets/index-Czce94mI.js deleted file mode 100644 index b4cfc49569ab8e69899618e99f264fb39122272d..0000000000000000000000000000000000000000 --- a/assets/index-Czce94mI.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as n}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as a,bw as r,c as i,o,b as l,A as c,u as m,a as d,bx as u}from"./index-20XXNHAB.js";const p={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-20rem)]","bottom-0":"","right--15":"","z--1":"",initial:{scale:.9,opacity:0,y:40},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},x=a({__name:"index",setup(f){return(e,t)=>{const s=r("motion");return o(),i(u,null,[l(m(n),{title:e.$t("settings.pages.memory.title"),subtitle:e.$t("settings.title")},null,8,["title","subtitle"]),c((o(),i("div",p,t[0]||(t[0]=[d("div",{text:"60","i-solar:leaf-bold-duotone":""},null,-1)]))),[[s]])],64)}}});export{x as default}; diff --git a/assets/index-a5yooE5o.css b/assets/index-D4Du7g_x.css similarity index 98% rename from assets/index-a5yooE5o.css rename to assets/index-D4Du7g_x.css index 5022561dcc6fb06c85e0eee99752d32210164ead..7ad18c0fe6bae720f308c1cb0d8a7340a8cc20d3 100644 --- a/assets/index-a5yooE5o.css +++ b/assets/index-D4Du7g_x.css @@ -1 +1 @@ -.stage-transition-3[data-v-df576df0]{--delay: 0s;--sharpness: 40%;position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden}.stage-transition-3[data-v-df576df0]:before,.stage-transition-3[data-v-df576df0]:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;animation:arrowIn-df576df0 1s cubic-bezier(.87,.05,.02,.97) both,arrowOut-df576df0 1s cubic-bezier(.87,.05,.02,.97) forwards}.stage-transition-3[data-v-df576df0]:before{background-color:var(--stage-transition-3-overlay-color-2);animation-delay:calc(0s + var(--delay, 0s)),calc(1.4s + var(--delay, 0s))}.stage-transition-3[data-v-df576df0]:after{background-color:var(--stage-transition-3-overlay-color-1);animation-delay:calc(.2s + var(--delay, 0s)),calc(1.2s + var(--delay, 0s))}@keyframes arrowIn-df576df0{0%{clip-path:polygon(calc(var(--sharpness) * -1) 0,calc(var(--sharpness) * -1) 0,0 50%,calc(var(--sharpness) * -1) 100%,calc(var(--sharpness) * -1) 100%,0 50%)}to{clip-path:polygon(calc(var(--sharpness) * -1) 0,100% 0,calc(100% + var(--sharpness)) 50%,100% 100%,calc(var(--sharpness) * -1) 100%,0 50%)}}@keyframes arrowOut-df576df0{0%{clip-path:polygon(calc(var(--sharpness) * -1) 0,100% 0,calc(100% + var(--sharpness)) 50%,100% 100%,calc(var(--sharpness) * -1) 100%,0 50%)}to{clip-path:polygon(100% 0,100% 0,calc(100% + var(--sharpness)) 50%,100% 100%,100% 100%,calc(100% + var(--sharpness)) 50%)}}.circle-expansion-transition[data-v-0c29056c]{position:fixed;top:calc(50% - 75vmax);left:calc(50% - 75vmax);width:150vmax;height:150vmax;pointer-events:none}.circle-expansion-transition div[data-v-0c29056c]{position:absolute;top:0;left:0;width:100%;height:100%;border-radius:50%;transform:scale(0)}.circle-expansion-transition div[data-v-0c29056c]:nth-child(1){background-color:var(--circle-expansion-color-1);animation:circleExpand-0c29056c var(--circle-expansion-duration) ease-in calc(var(--circle-expansion-delay) + 0s) forwards}.circle-expansion-transition div[data-v-0c29056c]:nth-child(2){background-color:var(--circle-expansion-color-2);animation:circleExpand-0c29056c var(--circle-expansion-duration) ease-in calc(var(--circle-expansion-delay) + .15s) forwards}.circle-expansion-transition div[data-v-0c29056c]:nth-child(3){background-color:var(--circle-expansion-color-3);animation:circleExpand-0c29056c var(--circle-expansion-duration) ease-in calc(var(--circle-expansion-delay) + .3s) forwards}.circle-expansion-transition div[data-v-0c29056c]:nth-child(4){background-color:var(--circle-expansion-color-4);animation:circleExpand-0c29056c var(--circle-expansion-duration) ease-in calc(var(--circle-expansion-delay) + .45s) forwards}@keyframes circleExpand-0c29056c{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes fantasy-fall-up{0%{transform:translateY(-100%)}50%{transform:translateY(0)}to{transform:translateY(0);border-bottom-right-radius:0%;border-bottom-left-radius:0%}}@keyframes fantasy-fall-down{0%{transform:translateY(100%)}50%{transform:translateY(0)}to{transform:translateY(0);border-top-right-radius:0%;border-top-left-radius:0%}}@keyframes fantasy-fall-left{0%{transform:translate(-100%)}50%{transform:translate(0)}to{transform:translate(0);border-top-right-radius:0%;border-bottom-right-radius:0%}}@keyframes fantasy-fall-right{0%{transform:translate(100%)}50%{transform:translate(0)}to{transform:translate(0);border-top-left-radius:0%;border-bottom-left-radius:0%}}.fantasy-fall-transition[data-v-e62bf496]{position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden}.fantasy-fall-up[data-v-e62bf496]:before{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--fantasy-fall-color);transform:translateY(-100%);border-bottom-left-radius:var(--fantasy-fall-radius-sm);border-bottom-right-radius:var(--fantasy-fall-radius-sm);animation:fantasy-fall-up var(--fantasy-fall-duration) ease-out var(--fantasy-fall-delay) forwards}.fantasy-fall-down[data-v-e62bf496]:before{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--fantasy-fall-color);transform:translateY(100%);border-top-left-radius:var(--fantasy-fall-radius-sm);border-top-right-radius:var(--fantasy-fall-radius-sm);animation:fantasy-fall-down var(--fantasy-fall-duration) ease-out var(--fantasy-fall-delay) forwards}.fantasy-fall-left[data-v-e62bf496]:before{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--fantasy-fall-color);transform:translate(-100%);border-top-right-radius:var(--fantasy-fall-radius-sm);border-bottom-right-radius:var(--fantasy-fall-radius-sm);animation:fantasy-fall-left var(--fantasy-fall-duration) ease-out var(--fantasy-fall-delay) forwards}.fantasy-fall-right[data-v-e62bf496]:before{content:"";display:block;position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--fantasy-fall-color);transform:translate(100%);border-top-left-radius:var(--fantasy-fall-radius-sm);border-bottom-left-radius:var(--fantasy-fall-radius-sm);animation:fantasy-fall-right var(--fantasy-fall-duration) ease-out var(--fantasy-fall-delay) forwards}@media (min-width: 768px){.fantasy-fall-up[data-v-e62bf496]:before{border-bottom-left-radius:var(--fantasy-fall-radius-md);border-bottom-right-radius:var(--fantasy-fall-radius-md)}.fantasy-fall-down[data-v-e62bf496]:before{border-top-left-radius:var(--fantasy-fall-radius-md);border-top-right-radius:var(--fantasy-fall-radius-md)}.fantasy-fall-left[data-v-e62bf496]:before{border-top-right-radius:var(--fantasy-fall-radius-md);border-bottom-right-radius:var(--fantasy-fall-radius-md)}.fantasy-fall-right[data-v-e62bf496]:before{border-top-left-radius:var(--fantasy-fall-radius-md);border-bottom-left-radius:var(--fantasy-fall-radius-md)}}@media (min-width: 1024px){.fantasy-fall-up[data-v-e62bf496]:before{border-bottom-left-radius:var(--fantasy-fall-radius-lg);border-bottom-right-radius:var(--fantasy-fall-radius-lg)}.fantasy-fall-down[data-v-e62bf496]:before{border-top-left-radius:var(--fantasy-fall-radius-lg);border-top-right-radius:var(--fantasy-fall-radius-lg)}.fantasy-fall-left[data-v-e62bf496]:before{border-top-right-radius:var(--fantasy-fall-radius-lg);border-bottom-right-radius:var(--fantasy-fall-radius-lg)}.fantasy-fall-right[data-v-e62bf496]:before{border-top-left-radius:var(--fantasy-fall-radius-lg);border-bottom-left-radius:var(--fantasy-fall-radius-lg)}}.stage-transition-4[data-v-6d1179fc]{--delay: 0s;position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden;display:grid;grid-template-rows:repeat(5,1fr)}.stage-transition-4__block[data-v-6d1179fc]{position:relative;width:100%;height:100%}.stage-transition-4__block[data-v-6d1179fc]:before,.stage-transition-4__block[data-v-6d1179fc]:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;animation:slideIn-6d1179fc .8s cubic-bezier(.87,.05,.02,.97) both,slideOut-6d1179fc .8s cubic-bezier(.87,.05,.02,.97) forwards}.stage-transition-4__block[data-v-6d1179fc]:before{background-color:var(--stage-transition-4-overlay-color-2);animation-delay:calc(0s + var(--d, 0s) + var(--delay, 0s)),calc(1.6s + var(--d, 0s) + var(--delay, 0s))}.stage-transition-4__block[data-v-6d1179fc]:after{background-color:var(--stage-transition-4-overlay-color-1);animation-delay:calc(.3s + var(--d, 0s) + var(--delay, 0s)),calc(1.3s + var(--d, 0s) + var(--delay, 0s))}.stage-transition-4__block[data-v-6d1179fc]:nth-child(1){--d: .1s}.stage-transition-4__block[data-v-6d1179fc]:nth-child(2){--d: .3s}.stage-transition-4__block[data-v-6d1179fc]:nth-child(3){--d: 0s}.stage-transition-4__block[data-v-6d1179fc]:nth-child(4){--d: .4s}.stage-transition-4__block[data-v-6d1179fc]:nth-child(5){--d: .2s}@keyframes slideIn-6d1179fc{0%{transform:translate(-101%)}to{transform:translate(0)}}@keyframes slideOut-6d1179fc{0%{transform:translate(0)}to{transform:translate(101%)}}.stage-transition-1[data-v-bf1d1566]{--delay: 0s;position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden}.stage-transition-1[data-v-bf1d1566]:before,.stage-transition-1[data-v-bf1d1566]:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;animation:slideIn-bf1d1566 1s cubic-bezier(.87,.05,.02,.97) both,slideOut-bf1d1566 1s cubic-bezier(.87,.05,.02,.97) forwards}.stage-transition-1[data-v-bf1d1566]:before{background-color:var(--stage-transition-1-overlay-color-2);animation-delay:calc(0s + var(--delay, 0s)),calc(1.4s + var(--delay, 0s))}.stage-transition-1[data-v-bf1d1566]:after{background-color:var(--stage-transition-1-overlay-color-1);animation-delay:calc(.2s + var(--delay, 0s)),calc(1.2s + var(--delay, 0s))}@keyframes slideIn-bf1d1566{0%{transform:translate(-101%)}to{transform:translate(0)}}@keyframes slideOut-bf1d1566{0%{transform:translate(0)}to{transform:translate(101%)}}.stage-transition-2[data-v-8ff7120f]{--delay: 0s;--skew-x: 100%;position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden}.stage-transition-2[data-v-8ff7120f]:before,.stage-transition-2[data-v-8ff7120f]:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;animation:maskIn-8ff7120f 1s cubic-bezier(.87,.05,.02,.97) both,maskOut-8ff7120f 1s cubic-bezier(.87,.05,.02,.97) forwards}.stage-transition-2[data-v-8ff7120f]:before{background-color:var(--stage-transition-2-overlay-color-2);animation-delay:calc(0s + var(--delay, 0s)),calc(1.4s + var(--delay, 0s))}.stage-transition-2[data-v-8ff7120f]:after{background-color:var(--stage-transition-2-overlay-color-1);animation-delay:calc(.2s + var(--delay, 0s)),calc(1.2s + var(--delay, 0s))}@keyframes maskIn-8ff7120f{0%{clip-path:polygon(0 0,0 0,calc(var(--skew-x, 0) * -1) 100%,calc(var(--skew-x, 0) * -1) 100%)}to{clip-path:polygon(0 0,calc(100% + var(--skew-x, 0)) 0,100% 100%,calc(var(--skew-x, 0) * -1) 100%)}}@keyframes maskOut-8ff7120f{0%{clip-path:polygon(0 0,calc(100% + var(--skew-x, 0)) 0,100% 100%,calc(var(--skew-x, 0) * -1) 100%)}to{clip-path:polygon(calc(100% + var(--skew-x, 0)) 0,calc(100% + var(--skew-x, 0)) 0,100% 100%,100% 100%)}}.rectangle-rotate-transition[data-v-f4b1dc64]{position:fixed;top:0;right:0;bottom:0;left:0;overflow:hidden}.rectangle[data-v-f4b1dc64]{position:absolute;width:100%;height:100%}.rectangle div[data-v-f4b1dc64]{position:absolute;width:100vmax;height:100vmax;transform:scale(0)}.rectangle-rotate-1 div[data-v-f4b1dc64]{top:-50vmax;left:-50vmax;background-color:var(--rectangle-rotate-1-color);animation:expand-rotate-f4b1dc64 var(--rectangle-rotate-duration) ease calc(var(--rectangle-rotate-delay) + 0s) forwards}.rectangle-rotate-2 div[data-v-f4b1dc64]{bottom:-50vmax;right:-50vmax;background-color:var(--rectangle-rotate-2-color);animation:expand-rotate-f4b1dc64 var(--rectangle-rotate-duration) ease calc(var(--rectangle-rotate-delay) + var(--rectangle-rotate-stagger)) forwards}.rectangle-rotate-3 div[data-v-f4b1dc64]{top:calc(50% - 50vmax);left:calc(50% - 50vmax);background-color:var(--rectangle-rotate-3-color);animation:expand-rotate-f4b1dc64 var(--rectangle-rotate-duration) ease calc(var(--rectangle-rotate-delay) + calc(var(--rectangle-rotate-stagger) * 2)) forwards}@keyframes expand-rotate-f4b1dc64{0%{transform:scale(0) rotate(0)}to{transform:scale(1) rotate(var(--rectangle-rotate-rotation))}}@property --theme-colors-hue{syntax: ""; initial-value: 0; inherits: true;}@keyframes hue-anim{0%{--theme-colors-hue: 0}to{--theme-colors-hue: 360}}.dynamic-hue{animation:hue-anim 10s linear infinite}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--airi-theme-primary-50: #fff0f2;--airi-theme-primary-100: #ffe3e6;--airi-theme-primary-200: #ffcad4;--airi-theme-primary-300: #ff9fb0;--airi-theme-primary-400: #ff6988;--airi-theme-primary-500: #fe456e;--airi-theme-primary-600: #ec124d;--airi-theme-primary-700: #c70941;--airi-theme-primary-800: #a70a3e;--airi-theme-primary-900: #8e0d3b;--airi-theme-primary-950: #50011b;--theme-colors-hue: 220.44;--theme-colors-chroma: calc(.18 + cos(var(--theme-colors-hue) * 3.14159265 / 180)/25) ;--theme-colors-chroma-50: calc(var(--theme-colors-chroma) * .3);--theme-colors-chroma-100: calc(var(--theme-colors-chroma) * .5);--theme-colors-chroma-200: calc(var(--theme-colors-chroma) * .6);--theme-colors-chroma-300: calc(var(--theme-colors-chroma) * .75);--theme-colors-chroma-400: var(--theme-colors-chroma);--theme-colors-chroma-600: calc(var(--theme-colors-chroma) * 1.15);--theme-colors-chroma-700: calc(var(--theme-colors-chroma) * 1.1);--theme-colors-chroma-800: calc(var(--theme-colors-chroma) * .85);--theme-colors-chroma-900: calc(var(--theme-colors-chroma) * .7);--theme-colors-chroma-950: calc(var(--theme-colors-chroma) * .5)}.slide-away-enter-active,.slide-away-leave-active{transition:transform .3s ease-in-out,opacity .3s ease-in-out}.slide-away-enter,.slide-away-leave-to{transform:translateY(-10px);opacity:0}.slide-away-enter-from,.slide-away-leave{transform:translateY(10px);opacity:0}:root{--bg-color-light: rgb(255 255 255);--bg-color-dark: rgb(18 18 18);--progress-bar-color: rgb(244 114 182);--bg-color: var(--bg-color-light)}html,body,#app{height:100%;margin:0;padding:0;overscroll-behavior:none}html{background:var(--bg-color);transition:all .3s ease-in-out}html.dark{--bg-color: var(--bg-color-dark);color-scheme:dark}#nprogress{pointer-events:none}#nprogress .bar{background:var(--progress-bar-color);opacity:.75;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }@font-face{font-family:DM Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmmono/v14/aFTU7PB1QTsUX8KYthSQBK6PYK3EXw.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:DM Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmmono/v14/aFTU7PB1QTsUX8KYthqQBK6PYK0.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:DM Sans;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmsans/v15/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxRR232RmYJp8I5zzw.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:DM Sans;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmsans/v15/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxRSW32RmYJp8I5.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"DM Serif Display";font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmserifdisplay/v15/-nFnOHM81r4j6k0gjAW3mujVU2B2G_5x0vrx52jJ3Q.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"DM Serif Display";font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmserifdisplay/v15/-nFnOHM81r4j6k0gjAW3mujVU2B2G_Bx0vrx52g.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.2.woff2) format("woff2");unicode-range:U+d723-d728,U+d72a-d733,U+d735-d748,U+d74a-d74f,U+d752-d753,U+d755-d757,U+d75a-d75f,U+d762-d764,U+d766-d768,U+d76a-d76b,U+d76d-d76f,U+d771-d787,U+d789-d78b,U+d78d-d78f,U+d791-d797,U+d79a,U+d79c,U+d79e-d7a3,U+f900-f909,U+f90b-f92e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.3.woff2) format("woff2");unicode-range:U+d679-d68b,U+d68e-d69e,U+d6a0,U+d6a2-d6a7,U+d6a9-d6c3,U+d6c6-d6c7,U+d6c9-d6cb,U+d6cd-d6d3,U+d6d5-d6d6,U+d6d8-d6e3,U+d6e5-d6e7,U+d6e9-d6fb,U+d6fd-d717,U+d719-d71f,U+d721-d722}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.4.woff2) format("woff2");unicode-range:U+d5bc-d5c7,U+d5ca-d5cb,U+d5cd-d5cf,U+d5d1-d5d7,U+d5d9-d5da,U+d5dc,U+d5de-d5e3,U+d5e6-d5e7,U+d5e9-d5eb,U+d5ed-d5f6,U+d5f8,U+d5fa-d5ff,U+d602-d603,U+d605-d607,U+d609-d60f,U+d612-d613,U+d616-d61b,U+d61d-d637,U+d63a-d63b,U+d63d-d63f,U+d641-d647,U+d64a-d64c,U+d64e-d653,U+d656-d657,U+d659-d65b,U+d65d-d666,U+d668,U+d66a-d678}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.5.woff2) format("woff2");unicode-range:U+d507,U+d509-d50b,U+d50d-d513,U+d515-d53b,U+d53e-d53f,U+d541-d543,U+d545-d54c,U+d54e,U+d550,U+d552-d557,U+d55a-d55b,U+d55d-d55f,U+d561-d564,U+d566-d567,U+d56a,U+d56c,U+d56e-d573,U+d576-d577,U+d579-d583,U+d585-d586,U+d58a-d5a4,U+d5a6-d5bb}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.6.woff2) format("woff2");unicode-range:U+d464-d477,U+d47a-d47b,U+d47d-d47f,U+d481-d487,U+d489-d48a,U+d48c,U+d48e-d4e7,U+d4e9-d503,U+d505-d506}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.7.woff2) format("woff2");unicode-range:U+d3bf-d3c7,U+d3ca-d3cf,U+d3d1-d3eb,U+d3ee-d3ef,U+d3f1-d3f3,U+d3f5-d3fb,U+d3fd-d400,U+d402-d45b,U+d45d-d463}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.8.woff2) format("woff2");unicode-range:U+d2ff,U+d302-d304,U+d306-d30b,U+d30f,U+d311-d313,U+d315-d31b,U+d31e,U+d322-d324,U+d326-d327,U+d32a-d32b,U+d32d-d32f,U+d331-d337,U+d339-d33c,U+d33e-d37b,U+d37e-d37f,U+d381-d383,U+d385-d38b,U+d38e-d390,U+d392-d397,U+d39a-d39b,U+d39d-d39f,U+d3a1-d3a7,U+d3a9-d3aa,U+d3ac,U+d3ae-d3b3,U+d3b5-d3b7,U+d3b9-d3bb,U+d3bd-d3be}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.9.woff2) format("woff2");unicode-range:U+d257-d27f,U+d281-d29b,U+d29d-d29f,U+d2a1-d2ab,U+d2ad-d2b7,U+d2ba-d2bb,U+d2bd-d2bf,U+d2c1-d2c7,U+d2c9-d2ef,U+d2f2-d2f3,U+d2f5-d2f7,U+d2f9-d2fe}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.10.woff2) format("woff2");unicode-range:U+d1b4,U+d1b6-d1f3,U+d1f5-d22b,U+d22e-d22f,U+d231-d233,U+d235-d23b,U+d23d-d240,U+d242-d256}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.11.woff2) format("woff2");unicode-range:U+d105-d12f,U+d132-d133,U+d135-d137,U+d139-d13f,U+d141-d142,U+d144,U+d146-d14b,U+d14e-d14f,U+d151-d153,U+d155-d15b,U+d15e-d187,U+d189-d19f,U+d1a2-d1a3,U+d1a5-d1a7,U+d1a9-d1af,U+d1b2-d1b3}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.12.woff2) format("woff2");unicode-range:U+d04b-d04f,U+d051-d057,U+d059-d06b,U+d06d-d06f,U+d071-d073,U+d075-d07b,U+d07e-d0a3,U+d0a6-d0a7,U+d0a9-d0ab,U+d0ad-d0b3,U+d0b6,U+d0b8,U+d0ba-d0bf,U+d0c2-d0c3,U+d0c5-d0c7,U+d0c9-d0cf,U+d0d2,U+d0d6-d0db,U+d0de-d0df,U+d0e1-d0e3,U+d0e5-d0eb,U+d0ee-d0f0,U+d0f2-d104}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.13.woff2) format("woff2");unicode-range:U+cfa2-cfc3,U+cfc5-cfdf,U+cfe2-cfe3,U+cfe5-cfe7,U+cfe9-cff4,U+cff6-cffb,U+cffd-cfff,U+d001-d003,U+d005-d017,U+d019-d033,U+d036-d037,U+d039-d03b,U+d03d-d04a}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.14.woff2) format("woff2");unicode-range:U+cef0-cef3,U+cef6,U+cef9-ceff,U+cf01-cf03,U+cf05-cf07,U+cf09-cf0f,U+cf11-cf12,U+cf14-cf1b,U+cf1d-cf1f,U+cf21-cf2f,U+cf31-cf53,U+cf56-cf57,U+cf59-cf5b,U+cf5d-cf63,U+cf66,U+cf68,U+cf6a-cf6f,U+cf71-cf84,U+cf86-cf8b,U+cf8d-cfa1}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.15.woff2) format("woff2");unicode-range:U+ce3c-ce57,U+ce5a-ce5b,U+ce5d-ce5f,U+ce61-ce67,U+ce6a,U+ce6c,U+ce6e-ce73,U+ce76-ce77,U+ce79-ce7b,U+ce7d-ce83,U+ce85-ce88,U+ce8a-ce8f,U+ce91-ce93,U+ce95-ce97,U+ce99-ce9f,U+cea2,U+cea4-ceab,U+cead-cee3,U+cee6-cee7,U+cee9-ceeb,U+ceed-ceef}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.16.woff2) format("woff2");unicode-range:U+cd92-cd93,U+cd96-cd97,U+cd99-cd9b,U+cd9d-cda3,U+cda6-cda8,U+cdaa-cdaf,U+cdb1-cdc3,U+cdc5-cdcb,U+cdcd-cde7,U+cde9-ce03,U+ce05-ce1f,U+ce22-ce34,U+ce36-ce3b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.17.woff2) format("woff2");unicode-range:U+ccef-cd07,U+cd0a-cd0b,U+cd0d-cd1a,U+cd1c,U+cd1e-cd2b,U+cd2d-cd5b,U+cd5d-cd77,U+cd79-cd91}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.18.woff2) format("woff2");unicode-range:U+cc3f-cc43,U+cc46-cc47,U+cc49-cc4b,U+cc4d-cc53,U+cc55-cc58,U+cc5a-cc5f,U+cc61-cc97,U+cc9a-cc9b,U+cc9d-cc9f,U+cca1-cca7,U+ccaa,U+ccac,U+ccae-ccb3,U+ccb6-ccb7,U+ccb9-ccbb,U+ccbd-cccf,U+ccd1-cce3,U+cce5-ccee}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.19.woff2) format("woff2");unicode-range:U+cb91-cbd3,U+cbd5-cbe3,U+cbe5-cc0b,U+cc0e-cc0f,U+cc11-cc13,U+cc15-cc1b,U+cc1d-cc20,U+cc23-cc27,U+cc2a-cc2b,U+cc2d,U+cc2f,U+cc31-cc37,U+cc3a,U+cc3c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.20.woff2) format("woff2");unicode-range:U+caf4-cb47,U+cb4a-cb90}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.21.woff2) format("woff2");unicode-range:U+ca4a-ca4b,U+ca4e-ca4f,U+ca51-ca53,U+ca55-ca5b,U+ca5d-ca60,U+ca62-ca83,U+ca85-cabb,U+cabe-cabf,U+cac1-cac3,U+cac5-cacb,U+cacd-cad0,U+cad2,U+cad4-cad8,U+cada-caf3}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.22.woff2) format("woff2");unicode-range:U+c996-c997,U+c99a-c99c,U+c99e-c9bf,U+c9c2-c9c3,U+c9c5-c9c7,U+c9c9-c9cf,U+c9d2,U+c9d4,U+c9d7-c9d8,U+c9db,U+c9de-c9df,U+c9e1-c9e3,U+c9e5-c9e6,U+c9e8-c9eb,U+c9ee-c9f0,U+c9f2-c9f7,U+c9f9-ca0b,U+ca0d-ca28,U+ca2a-ca49}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.23.woff2) format("woff2");unicode-range:U+c8e9-c8f4,U+c8f6-c8fb,U+c8fe-c8ff,U+c901-c903,U+c905-c90b,U+c90e-c910,U+c912-c917,U+c919-c92b,U+c92d-c94f,U+c951-c953,U+c955-c96b,U+c96d-c973,U+c975-c987,U+c98a-c98b,U+c98d-c98f,U+c991-c995}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.24.woff2) format("woff2");unicode-range:U+c841-c84b,U+c84d-c86f,U+c872-c873,U+c875-c877,U+c879-c87f,U+c882-c884,U+c887-c88a,U+c88d-c8c3,U+c8c5-c8df,U+c8e1-c8e8}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.25.woff2) format("woff2");unicode-range:U+c779-c77b,U+c77e-c782,U+c786,U+c78b,U+c78d,U+c78f,U+c792-c793,U+c795,U+c797,U+c799-c79f,U+c7a2,U+c7a7-c7ab,U+c7ae-c7bb,U+c7bd-c7c0,U+c7c2-c7c7,U+c7c9-c7dc,U+c7de-c7ff,U+c802-c803,U+c805-c807,U+c809,U+c80b-c80f,U+c812,U+c814,U+c817-c81b,U+c81e-c81f,U+c821-c823,U+c825-c82e,U+c830-c837,U+c839-c83b,U+c83d-c840}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.26.woff2) format("woff2");unicode-range:U+c6bb-c6bf,U+c6c2,U+c6c4,U+c6c6-c6cb,U+c6ce-c6cf,U+c6d1-c6d3,U+c6d5-c6db,U+c6dd-c6df,U+c6e1-c6e7,U+c6e9-c6eb,U+c6ed-c6ef,U+c6f1-c6f8,U+c6fa-c703,U+c705-c707,U+c709-c70b,U+c70d-c716,U+c718,U+c71a-c71f,U+c722-c723,U+c725-c727,U+c729-c734,U+c736-c73b,U+c73e-c73f,U+c741-c743,U+c745-c74b,U+c74e-c750,U+c752-c757,U+c759-c773,U+c776-c777}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.27.woff2) format("woff2");unicode-range:U+c5f5-c5fb,U+c5fe,U+c602-c605,U+c607,U+c609-c60f,U+c611-c61a,U+c61c-c623,U+c626-c627,U+c629-c62b,U+c62d,U+c62f-c632,U+c636,U+c638,U+c63a-c63f,U+c642-c643,U+c645-c647,U+c649-c652,U+c656-c65b,U+c65d-c65f,U+c661-c663,U+c665-c677,U+c679-c67b,U+c67d-c693,U+c696-c697,U+c699-c69b,U+c69d-c6a3,U+c6a6,U+c6a8,U+c6aa-c6af,U+c6b2-c6b3,U+c6b5-c6b7,U+c6b9-c6ba}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.28.woff2) format("woff2");unicode-range:U+c517-c527,U+c52a-c52b,U+c52d-c52f,U+c531-c538,U+c53a,U+c53c,U+c53e-c543,U+c546-c547,U+c54b,U+c54d-c552,U+c556,U+c55a-c55b,U+c55d,U+c55f,U+c562-c563,U+c565-c567,U+c569-c56f,U+c572,U+c574,U+c576-c57b,U+c57e-c57f,U+c581-c583,U+c585-c586,U+c588-c58b,U+c58e,U+c590,U+c592-c596,U+c599-c5b3,U+c5b6-c5b7,U+c5ba,U+c5be-c5c3,U+c5ca-c5cb,U+c5cd,U+c5cf,U+c5d2-c5d3,U+c5d5-c5d7,U+c5d9-c5df,U+c5e1-c5e2,U+c5e4,U+c5e6-c5eb,U+c5ef,U+c5f1-c5f3}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.29.woff2) format("woff2");unicode-range:U+c475-c4ef,U+c4f2-c4f3,U+c4f5-c4f7,U+c4f9-c4ff,U+c502-c50b,U+c50d-c516}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.30.woff2) format("woff2");unicode-range:U+c3d0-c3d7,U+c3da-c3db,U+c3dd-c3de,U+c3e1-c3ec,U+c3ee-c3f3,U+c3f5-c42b,U+c42d-c463,U+c466-c474}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.31.woff2) format("woff2");unicode-range:U+c32b-c367,U+c36a-c36b,U+c36d-c36f,U+c371-c377,U+c37a-c37b,U+c37e-c383,U+c385-c387,U+c389-c3cf}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.32.woff2) format("woff2");unicode-range:U+c26a-c26b,U+c26d-c26f,U+c271-c273,U+c275-c27b,U+c27e-c287,U+c289-c28f,U+c291-c297,U+c299-c29a,U+c29c-c2a3,U+c2a5-c2a7,U+c2a9-c2ab,U+c2ad-c2b3,U+c2b6,U+c2b8,U+c2ba-c2bb,U+c2bd-c2db,U+c2de-c2df,U+c2e1-c2e2,U+c2e5-c2ea,U+c2ee,U+c2f0,U+c2f2-c2f5,U+c2f7,U+c2fa-c2fb,U+c2fd-c2ff,U+c301-c307,U+c309-c30c,U+c30e-c312,U+c315-c323,U+c325-c328,U+c32a}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.33.woff2) format("woff2");unicode-range:U+c1bc-c1c3,U+c1c5-c1df,U+c1e1-c1fb,U+c1fd-c203,U+c205-c20c,U+c20e,U+c210-c217,U+c21a-c21b,U+c21d-c21e,U+c221-c227,U+c229-c22a,U+c22c,U+c22e,U+c230,U+c233-c24f,U+c251-c257,U+c259-c269}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.34.woff2) format("woff2");unicode-range:U+c101-c11b,U+c11f,U+c121-c123,U+c125-c12b,U+c12e,U+c132-c137,U+c13a-c13b,U+c13d-c13f,U+c141-c147,U+c14a,U+c14c-c153,U+c155-c157,U+c159-c15b,U+c15d-c166,U+c169-c16f,U+c171-c177,U+c179-c18b,U+c18e-c18f,U+c191-c193,U+c195-c19b,U+c19d-c19e,U+c1a0,U+c1a2-c1a4,U+c1a6-c1bb}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.35.woff2) format("woff2");unicode-range:U+c049-c057,U+c059-c05b,U+c05d-c05f,U+c061-c067,U+c069-c08f,U+c091-c0ab,U+c0ae-c0af,U+c0b1-c0b3,U+c0b5,U+c0b7-c0bb,U+c0be,U+c0c2-c0c7,U+c0ca-c0cb,U+c0cd-c0cf,U+c0d1-c0d7,U+c0d9-c0da,U+c0dc,U+c0de-c0e3,U+c0e5-c0eb,U+c0ed-c0f3,U+c0f6,U+c0f8,U+c0fa-c0ff}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.36.woff2) format("woff2");unicode-range:U+bfa7-bfaf,U+bfb1-bfc4,U+bfc6-bfcb,U+bfce-bfcf,U+bfd1-bfd3,U+bfd5-bfdb,U+bfdd-c048}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.37.woff2) format("woff2");unicode-range:U+bf07,U+bf09-bf3f,U+bf41-bf4f,U+bf52-bf54,U+bf56-bfa6}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.38.woff2) format("woff2");unicode-range:U+be56,U+be58,U+be5c-be5f,U+be62-be63,U+be65-be67,U+be69-be74,U+be76-be7b,U+be7e-be7f,U+be81-be8e,U+be90,U+be92-bea7,U+bea9-becf,U+bed2-bed3,U+bed5-bed6,U+bed9-bee3,U+bee6-bf06}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.39.woff2) format("woff2");unicode-range:U+bdb0-bdd3,U+bdd5-bdef,U+bdf1-be0b,U+be0d-be0f,U+be11-be13,U+be15-be43,U+be46-be47,U+be49-be4b,U+be4d-be53}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.40.woff2) format("woff2");unicode-range:U+bd03,U+bd06,U+bd08,U+bd0a-bd0f,U+bd11-bd22,U+bd25-bd47,U+bd49-bd58,U+bd5a-bd7f,U+bd82-bd83,U+bd85-bd87,U+bd8a-bd8f,U+bd91-bd92,U+bd94,U+bd96-bd98,U+bd9a-bdaf}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.41.woff2) format("woff2");unicode-range:U+bc4e-bc83,U+bc86-bc87,U+bc89-bc8b,U+bc8d-bc93,U+bc96,U+bc98,U+bc9b-bc9f,U+bca2-bca3,U+bca5-bca7,U+bca9-bcb2,U+bcb4-bcbb,U+bcbe-bcbf,U+bcc1-bcc3,U+bcc5-bccc,U+bcce-bcd0,U+bcd2-bcd4,U+bcd6-bcf3,U+bcf7,U+bcf9-bcfb,U+bcfd-bd02}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.42.woff2) format("woff2");unicode-range:U+bb90-bba3,U+bba5-bbab,U+bbad-bbbf,U+bbc1-bbf7,U+bbfa-bbfb,U+bbfd-bbfe,U+bc01-bc07,U+bc09-bc0a,U+bc0e,U+bc10,U+bc12-bc13,U+bc17,U+bc19-bc1a,U+bc1e,U+bc20-bc23,U+bc26,U+bc28,U+bc2a-bc2c,U+bc2e-bc2f,U+bc32-bc33,U+bc35-bc37,U+bc39-bc3f,U+bc41-bc42,U+bc44,U+bc46-bc48,U+bc4a-bc4d}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.43.woff2) format("woff2");unicode-range:U+bae6-bafb,U+bafd-bb17,U+bb19-bb33,U+bb37,U+bb39-bb3a,U+bb3d-bb43,U+bb45-bb46,U+bb48,U+bb4a-bb4f,U+bb51-bb53,U+bb55-bb57,U+bb59-bb62,U+bb64-bb8f}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.44.woff2) format("woff2");unicode-range:U+ba30-ba37,U+ba3a-ba3b,U+ba3d-ba3f,U+ba41-ba47,U+ba49-ba4a,U+ba4c,U+ba4e-ba53,U+ba56-ba57,U+ba59-ba5b,U+ba5d-ba63,U+ba65-ba66,U+ba68-ba6f,U+ba71-ba73,U+ba75-ba77,U+ba79-ba84,U+ba86,U+ba88-baa7,U+baaa,U+baad-baaf,U+bab1-bab7,U+baba,U+babc,U+babe-bae5}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.45.woff2) format("woff2");unicode-range:U+b96e-b973,U+b976-b977,U+b979-b97b,U+b97d-b983,U+b986,U+b988,U+b98a-b98d,U+b98f-b9ab,U+b9ae-b9af,U+b9b1-b9b3,U+b9b5-b9bb,U+b9be,U+b9c0,U+b9c2-b9c7,U+b9ca-b9cb,U+b9cd,U+b9d2-b9d7,U+b9da,U+b9dc,U+b9df-b9e0,U+b9e2,U+b9e6-b9e7,U+b9e9-b9f3,U+b9f6,U+b9f8,U+b9fb-ba2f}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.46.woff2) format("woff2");unicode-range:U+b8bf-b8cb,U+b8cd-b8e0,U+b8e2-b8e7,U+b8ea-b8eb,U+b8ed-b8ef,U+b8f1-b8f7,U+b8fa,U+b8fc,U+b8fe-b903,U+b905-b917,U+b919-b91f,U+b921-b93b,U+b93d-b957,U+b95a-b95b,U+b95d-b95f,U+b961-b967,U+b969-b96c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.47.woff2) format("woff2");unicode-range:U+b80d-b80f,U+b811-b817,U+b81a,U+b81c-b823,U+b826-b827,U+b829-b82b,U+b82d-b833,U+b836,U+b83a-b83f,U+b841-b85b,U+b85e-b85f,U+b861-b863,U+b865-b86b,U+b86e,U+b870,U+b872-b8af,U+b8b1-b8be}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.48.woff2) format("woff2");unicode-range:U+b74d-b75f,U+b761-b763,U+b765-b774,U+b776-b77b,U+b77e-b77f,U+b781-b783,U+b785-b78b,U+b78e,U+b792-b796,U+b79a-b79b,U+b79d-b7a7,U+b7aa,U+b7ae-b7b3,U+b7b6-b7c8,U+b7ca-b7eb,U+b7ee-b7ef,U+b7f1-b7f3,U+b7f5-b7fb,U+b7fe,U+b802-b806,U+b80a-b80b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.49.woff2) format("woff2");unicode-range:U+b6a7-b6aa,U+b6ac-b6b0,U+b6b2-b6ef,U+b6f1-b727,U+b72a-b72b,U+b72d-b72e,U+b731-b737,U+b739-b73a,U+b73c-b743,U+b745-b74c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.50.woff2) format("woff2");unicode-range:U+b605-b60f,U+b612-b617,U+b619-b624,U+b626-b69b,U+b69e-b6a3,U+b6a5-b6a6}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.51.woff2) format("woff2");unicode-range:U+b55f,U+b562-b583,U+b585-b59f,U+b5a2-b5a3,U+b5a5-b5a7,U+b5a9-b5b2,U+b5b5-b5ba,U+b5bd-b604}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.52.woff2) format("woff2");unicode-range:U+b4a5-b4b6,U+b4b8-b4bf,U+b4c1-b4c7,U+b4c9-b4db,U+b4de-b4df,U+b4e1-b4e2,U+b4e5-b4eb,U+b4ee,U+b4f0,U+b4f2-b513,U+b516-b517,U+b519-b51a,U+b51d-b523,U+b526,U+b528,U+b52b-b52f,U+b532-b533,U+b535-b537,U+b539-b53f,U+b541-b544,U+b546-b54b,U+b54d-b54f,U+b551-b55b,U+b55d-b55e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.53.woff2) format("woff2");unicode-range:U+b3f8-b3fb,U+b3fd-b40f,U+b411-b417,U+b419-b41b,U+b41d-b41f,U+b421-b427,U+b42a-b42b,U+b42d-b44f,U+b452-b453,U+b455-b457,U+b459-b45f,U+b462-b464,U+b466-b46b,U+b46d-b47f,U+b481-b4a3}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.54.woff2) format("woff2");unicode-range:U+b342-b353,U+b356-b357,U+b359-b35b,U+b35d-b35e,U+b360-b363,U+b366,U+b368,U+b36a-b36d,U+b36f,U+b372-b373,U+b375-b377,U+b379-b37f,U+b381-b382,U+b384,U+b386-b38b,U+b38d-b3c3,U+b3c6-b3c7,U+b3c9-b3ca,U+b3cd-b3d3,U+b3d6,U+b3d8,U+b3da-b3f7}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.55.woff2) format("woff2");unicode-range:U+b27c-b283,U+b285-b28f,U+b292-b293,U+b295-b297,U+b29a-b29f,U+b2a1-b2a4,U+b2a7-b2a9,U+b2ab,U+b2ad-b2c7,U+b2ca-b2cb,U+b2cd-b2cf,U+b2d1-b2d7,U+b2da,U+b2dc,U+b2de-b2e3,U+b2e7,U+b2e9-b2ea,U+b2ef-b2f3,U+b2f6,U+b2f8,U+b2fa-b2fb,U+b2fd-b2fe,U+b302-b303,U+b305-b307,U+b309-b30f,U+b312,U+b316-b31b,U+b31d-b341}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.56.woff2) format("woff2");unicode-range:U+b1d6-b1e7,U+b1e9-b1fc,U+b1fe-b203,U+b206-b207,U+b209-b20b,U+b20d-b213,U+b216-b21f,U+b221-b257,U+b259-b273,U+b275-b27b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.57.woff2) format("woff2");unicode-range:U+b120-b122,U+b126-b127,U+b129-b12b,U+b12d-b133,U+b136,U+b138,U+b13a-b13f,U+b142-b143,U+b145-b14f,U+b151-b153,U+b156-b157,U+b159-b177,U+b17a-b17b,U+b17d-b17f,U+b181-b187,U+b189-b18c,U+b18e-b191,U+b195-b1a7,U+b1a9-b1cb,U+b1cd-b1d5}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.58.woff2) format("woff2");unicode-range:U+b05f-b07b,U+b07e-b07f,U+b081-b083,U+b085-b08b,U+b08d-b097,U+b09b,U+b09d-b09f,U+b0a2-b0a7,U+b0aa,U+b0b0,U+b0b2,U+b0b6-b0b7,U+b0b9-b0bb,U+b0bd-b0c3,U+b0c6-b0c7,U+b0ca-b0cf,U+b0d1-b0df,U+b0e1-b0e4,U+b0e6-b107,U+b10a-b10b,U+b10d-b10f,U+b111-b112,U+b114-b117,U+b119-b11a,U+b11c-b11f}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.59.woff2) format("woff2");unicode-range:U+afac-afb7,U+afba-afbb,U+afbd-afbf,U+afc1-afc6,U+afca-afcc,U+afce-afd3,U+afd5-afe7,U+afe9-afef,U+aff1-b00b,U+b00d-b00f,U+b011-b013,U+b015-b01b,U+b01d-b027,U+b029-b043,U+b045-b047,U+b049,U+b04b,U+b04d-b052,U+b055-b056,U+b058-b05c,U+b05e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.60.woff2) format("woff2");unicode-range:U+af03-af07,U+af09-af2b,U+af2e-af33,U+af35-af3b,U+af3e-af40,U+af44-af47,U+af4a-af5c,U+af5e-af63,U+af65-af7f,U+af81-afab}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.61.woff2) format("woff2");unicode-range:U+ae56-ae5b,U+ae5e-ae60,U+ae62-ae64,U+ae66-ae67,U+ae69-ae6b,U+ae6d-ae83,U+ae85-aebb,U+aebf,U+aec1-aec3,U+aec5-aecb,U+aece,U+aed0,U+aed2-aed7,U+aed9-aef3,U+aef5-af02}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.62.woff2) format("woff2");unicode-range:U+ad9c-ada3,U+ada5-adbf,U+adc1-adc3,U+adc5-adc7,U+adc9-add2,U+add4-addb,U+addd-addf,U+ade1-ade3,U+ade5-adf7,U+adfa-adfb,U+adfd-adff,U+ae02-ae07,U+ae0a,U+ae0c,U+ae0e-ae13,U+ae15-ae2f,U+ae31-ae33,U+ae35-ae37,U+ae39-ae3f,U+ae42,U+ae44,U+ae46-ae49,U+ae4b,U+ae4f,U+ae51-ae53,U+ae55}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.63.woff2) format("woff2");unicode-range:U+ace2-ace3,U+ace5-ace6,U+ace9-acef,U+acf2,U+acf4,U+acf7-acfb,U+acfe-acff,U+ad01-ad03,U+ad05-ad0b,U+ad0d-ad10,U+ad12-ad1b,U+ad1d-ad33,U+ad35-ad48,U+ad4a-ad4f,U+ad51-ad6b,U+ad6e-ad6f,U+ad71-ad72,U+ad77-ad7c,U+ad7e,U+ad80,U+ad82-ad87,U+ad89-ad8b,U+ad8d-ad8f,U+ad91-ad9b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.64.woff2) format("woff2");unicode-range:U+ac25-ac2c,U+ac2e,U+ac30,U+ac32-ac37,U+ac39-ac3f,U+ac41-ac4c,U+ac4e-ac6f,U+ac72-ac73,U+ac75-ac76,U+ac79-ac7f,U+ac82,U+ac84-ac88,U+ac8a-ac8b,U+ac8d-ac8f,U+ac91-ac93,U+ac95-ac9b,U+ac9d-ac9e,U+aca1-aca7,U+acab,U+acad-acaf,U+acb1-acb7,U+acba-acbb,U+acbe-acc0,U+acc2-acc3,U+acc5-acdf}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.65.woff2) format("woff2");unicode-range:U+99df,U+99ed,U+99f1,U+99ff,U+9a01,U+9a08,U+9a0e-9a0f,U+9a19,U+9a2b,U+9a30,U+9a36-9a37,U+9a40,U+9a43,U+9a45,U+9a4d,U+9a55,U+9a57,U+9a5a-9a5b,U+9a5f,U+9a62,U+9a65,U+9a69-9a6a,U+9aa8,U+9ab8,U+9ad3,U+9ae5,U+9aee,U+9b1a,U+9b27,U+9b2a,U+9b31,U+9b3c,U+9b41-9b45,U+9b4f,U+9b54,U+9b5a,U+9b6f,U+9b8e,U+9b91,U+9b9f,U+9bab,U+9bae,U+9bc9,U+9bd6,U+9be4,U+9be8,U+9c0d,U+9c10,U+9c12,U+9c15,U+9c25,U+9c32,U+9c3b,U+9c47,U+9c49,U+9c57,U+9ce5,U+9ce7,U+9ce9,U+9cf3-9cf4,U+9cf6,U+9d09,U+9d1b,U+9d26,U+9d28,U+9d3b,U+9d51,U+9d5d,U+9d60-9d61,U+9d6c,U+9d72,U+9da9,U+9daf,U+9db4,U+9dc4,U+9dd7,U+9df2,U+9df8-9dfa,U+9e1a,U+9e1e,U+9e75,U+9e79,U+9e7d,U+9e7f,U+9e92-9e93,U+9e97,U+9e9d,U+9e9f,U+9ea5,U+9eb4-9eb5,U+9ebb,U+9ebe,U+9ec3,U+9ecd-9ece,U+9ed4,U+9ed8,U+9edb-9edc,U+9ede,U+9ee8,U+9ef4,U+9f07-9f08,U+9f0e,U+9f13,U+9f20,U+9f3b,U+9f4a-9f4b,U+9f4e,U+9f52,U+9f5f,U+9f61,U+9f67,U+9f6a,U+9f6c,U+9f77,U+9f8d,U+9f90,U+9f95,U+9f9c,U+ac02-ac03,U+ac05-ac06,U+ac09-ac0f,U+ac17-ac18,U+ac1b,U+ac1e-ac1f,U+ac21-ac23}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.94.woff2) format("woff2");unicode-range:U+3136,U+3138,U+313a-3140,U+3143-3144,U+3150,U+3152,U+3154-3156,U+3158-315b,U+315d-315f,U+3162,U+3164-318c,U+318e,U+3200-321b,U+3231,U+3239,U+3251-325a,U+3260-327b,U+327e-327f,U+328a-3290,U+3294,U+329e,U+32a5,U+3380-3384,U+3388-338b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.95.woff2) format("woff2");unicode-range:U+2f7d,U+2f7f-2f8b,U+2f8e-2f90,U+2f92-2f97,U+2f99-2fa0,U+2fa2-2fa3,U+2fa5-2fa9,U+2fac-2fb1,U+2fb3-2fbc,U+2fc1-2fca,U+2fcd-2fd4,U+3003,U+3012-3019,U+301c,U+301e-3020,U+3036,U+3041,U+3043,U+3045,U+3047,U+3049,U+304e,U+3050,U+3052,U+3056,U+305a,U+305c,U+305e,U+3062,U+3065,U+306c,U+3070-307d,U+3080,U+3085,U+3087,U+308e,U+3090-3091,U+30a1,U+30a5,U+30a9,U+30ae,U+30b1-30b2,U+30b4,U+30b6,U+30bc-30be,U+30c2,U+30c5,U+30cc,U+30d2,U+30d4,U+30d8-30dd,U+30e4,U+30e6,U+30e8,U+30ee,U+30f0-30f2,U+30f4-30f6,U+3133,U+3135}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.100.woff2) format("woff2");unicode-range:U+e8,U+2da,U+2160,U+2194,U+3054,U+3058,U+306d,U+3086,U+308d,U+30ac,U+30bb,U+30c4,U+30cd-30ce,U+30e2,U+3132,U+3146,U+3149,U+339d,U+4e3b,U+4f0a,U+4fdd,U+4fe1,U+5409,U+540c,U+5834,U+592a-592b,U+5b9a,U+5dde,U+5e0c,U+5e73,U+5f0f,U+60f3,U+653f,U+661f,U+662f,U+667a,U+683c,U+6b4c,U+6c11,U+767c,U+76ee,U+76f4,U+77f3,U+79d1,U+7a7a,U+7b2c,U+7d22,U+8207,U+8a00,U+8a71,U+9280,U+9580,U+958b,U+96c6,U+9762,U+98df,U+9ed1,U+ac2d,U+adc8,U+add3,U+af48,U+b014,U+b134-b135,U+b158,U+b2aa,U+b35f,U+b6a4,U+b9cf,U+bb63,U+bd23,U+be91,U+c29b,U+c3f4,U+c42c,U+c55c,U+c573,U+c58f,U+c78c,U+c7dd,U+c8f5,U+cad1,U+cc48,U+cf10,U+cf20,U+d03c,U+d07d,U+d2a0,U+d30e,U+d38d,U+d3a8,U+d3c8,U+d5e5,U+d5f9,U+d6e4,U+f90a,U+ff02,U+ff1c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.101.woff2) format("woff2");unicode-range:U+3b1,U+2466,U+25a1,U+25a3,U+261c,U+3008-3009,U+305b,U+305d,U+3069,U+30a7,U+30ba,U+30cf,U+30ef,U+3151,U+3157,U+4e4b,U+4e5f,U+4e8c,U+4eca,U+4ed6,U+4f5b,U+50cf,U+5149,U+5165,U+5171,U+5229,U+529b,U+5316,U+539f,U+53f2,U+571f,U+5728,U+58eb,U+591c,U+5b78,U+5c11,U+5c55,U+5ddd,U+5e02,U+5fb7,U+60c5,U+610f,U+611f,U+6625,U+66f8,U+6797,U+679c,U+682a,U+6d2a,U+706b,U+7406,U+767b,U+76f8,U+77e5,U+7acb,U+898b,U+8a69,U+8def,U+8fd1,U+901a,U+90e8,U+91cd,U+975e,U+ae14,U+ae6c,U+aec0,U+afc7,U+afc9,U+b01c,U+b028,U+b308,U+b311,U+b314,U+b31c,U+b524,U+b560,U+b764,U+b920,U+b9e3,U+bd48,U+be7d,U+c0db,U+c231,U+c270,U+c2e3,U+c37d,U+c3ed,U+c530,U+c6a5,U+c6dc,U+c7a4,U+c954,U+c974,U+d000,U+d565,U+d667,U+d6c5,U+d79d,U+ff1e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.102.woff2) format("woff2");unicode-range:U+131,U+2032,U+2465,U+2642,U+3048,U+3051,U+3083-3084,U+308f,U+30c0,U+30d1,U+30d3,U+30d6,U+30df,U+30e7,U+3153,U+4e16,U+4e8b,U+4ee5,U+5206,U+52a0,U+52d5,U+53e4,U+53ef,U+54c1,U+57ce,U+597d,U+5b8c,U+5ea6,U+5f8c,U+5f97,U+6210,U+6240,U+624b,U+6728,U+6bd4,U+7236,U+7269,U+7279,U+738b,U+7528,U+7530,U+767e,U+798f,U+8005,U+8a18,U+90fd,U+91cc,U+9577,U+9593,U+98a8,U+ac20,U+acf6,U+ad90,U+af5d,U+af80,U+afcd,U+aff0,U+b0a1,U+b0b5,U+b1fd,U+b2fc,U+b380,U+b51b,U+b584,U+b5b3,U+b8fd,U+b93c,U+b9f4,U+bb44,U+bc08,U+bc27,U+bc49,U+be55,U+be64,U+bfb0,U+bfc5,U+c178,U+c21f,U+c314,U+c4f1,U+c58d,U+c664,U+c698,U+c6a7,U+c6c1,U+c9ed,U+cac0,U+cacc,U+cad9,U+ccb5,U+cdcc,U+d0e4,U+d143,U+d320,U+d330,U+d54d,U+ff06,U+ff1f,U+ff5e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.103.woff2) format("woff2");unicode-range:U+b4,U+20a9,U+20ac,U+2190,U+24d8,U+2502,U+2514,U+2592,U+25c7-25c8,U+2663,U+3060,U+3064,U+3081,U+3088,U+30a3,U+30a6,U+30aa,U+30b5,U+30c7,U+30ca-30cb,U+30d0,U+30e3,U+30e5,U+339e,U+4e09,U+4eac,U+4f5c,U+5167-5168,U+516c,U+51fa,U+5408,U+540d,U+591a,U+5b57,U+6211,U+65b9,U+660e,U+6642,U+6700,U+6b63,U+6e2f,U+7063,U+7532,U+793e,U+81ea,U+8272,U+82b1,U+897f,U+8eca,U+91ce,U+ac38,U+ad76,U+ae84,U+aecc,U+b07d,U+b0b1,U+b215,U+b2a0,U+b310,U+b3d7,U+b52a,U+b618,U+b775,U+b797,U+bcd5,U+bd59,U+be80,U+bea8,U+bed1,U+bee4-bee5,U+c060,U+c2ef,U+c329,U+c3dc,U+c597,U+c5bd,U+c5e5,U+c69c,U+c9d6,U+ca29,U+ca5c,U+ca84,U+cc39,U+cc3b,U+ce89,U+cee5,U+cf65,U+cf85,U+d058,U+d145,U+d22d,U+d325,U+d37d,U+d3ad,U+d769,U+ff0c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.104.woff2) format("woff2");unicode-range:U+2161,U+2228,U+2299,U+2464,U+2517,U+2640,U+3042,U+304a,U+3053,U+3061,U+307f,U+3082,U+308c,U+3092,U+30a8,U+30ab,U+30ad,U+30b0,U+30b3,U+30b7,U+30c1,U+30c6,U+30c9,U+30d5,U+30d7,U+30de,U+30e0-30e1,U+30ec-30ed,U+4e0b,U+4e0d,U+4ee3,U+53f0,U+548c,U+5b89,U+5bb6,U+5c0f,U+611b,U+6771,U+6aa2,U+6bcd,U+6c34,U+6cd5,U+6d77,U+767d,U+795e,U+8ecd,U+9999,U+9ad8,U+ac07,U+ac1a,U+ac40,U+ad0c,U+ad88,U+ada4,U+ae01,U+ae65,U+aebd,U+aec4,U+afe8,U+b139,U+b205,U+b383,U+b38c,U+b42c,U+b461,U+b55c,U+b78f,U+b8fb,U+b9f7,U+bafc,U+bc99,U+bed8,U+bfcd,U+c0bf,U+c0f9,U+c167,U+c204,U+c20f,U+c22f,U+c258,U+c298,U+c2bc,U+c388,U+c501,U+c50c,U+c5b9,U+c5ce,U+c641,U+c648,U+c73d,U+ca50,U+ca61,U+cc4c,U+ceac,U+d0d4,U+d5f7,U+d6d7,U+ff1a}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.105.woff2) format("woff2");unicode-range:U+2103,U+2463,U+25c6,U+25cb,U+266c,U+3001,U+300a,U+3046,U+304c-304d,U+304f,U+3055,U+3059,U+3063,U+3066-3068,U+306f,U+3089,U+30b8,U+30bf,U+314f,U+4e0a,U+570b,U+5730,U+5916,U+5929,U+5c71,U+5e74,U+5fc3,U+601d,U+6027,U+63d0,U+6709,U+6734,U+751f,U+7684,U+82f1,U+9053,U+91d1,U+97f3,U+ac2f,U+ac4d,U+adc4,U+ade4,U+ae41,U+ae4d-ae4e,U+aed1,U+afb9,U+b0e0,U+b299,U+b365,U+b46c,U+b480,U+b4c8,U+b7b4,U+b819,U+b918,U+baab,U+bab9,U+be8f,U+bed7,U+c0ec,U+c19f,U+c1a5,U+c3d9,U+c464,U+c53d,U+c553,U+c570,U+c5cc,U+c633,U+c6a4,U+c7a3,U+c7a6,U+c886,U+c9d9-c9da,U+c9ec,U+ca0c,U+cc21,U+cd1b,U+cd78,U+cdc4,U+cef8,U+cfe4,U+d0a5,U+d0b5,U+d0ec,U+d15d,U+d188,U+d23c,U+d2ac,U+d729,U+d79b,U+ff01,U+ff08-ff09,U+ff5c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.106.woff2) format("woff2");unicode-range:U+2039-203a,U+223c,U+25b3,U+25b7,U+25bd,U+25cf,U+266a,U+3002,U+300b,U+304b,U+3057,U+305f,U+306a-306b,U+307e,U+308a-308b,U+3093,U+30a2,U+30af,U+30b9,U+30c3,U+30c8,U+30e9-30eb,U+33a1,U+4e00,U+524d,U+5357,U+5b50,U+7121,U+884c,U+9751,U+ac94,U+aebe,U+aecd,U+af08,U+af41,U+af49,U+b010,U+b053,U+b109,U+b11b,U+b128,U+b154,U+b291,U+b2e6,U+b301,U+b385,U+b525,U+b5b4,U+b729,U+b72f,U+b738,U+b7ff,U+b837,U+b975,U+ba67,U+bb47,U+bc1f,U+bd90,U+bfd4,U+c27c,U+c324,U+c379,U+c3e0,U+c465,U+c53b,U+c58c,U+c610,U+c653,U+c6cd,U+c813,U+c82f,U+c999,U+c9e0,U+cac4,U+cad3,U+cbd4,U+cc10,U+cc22,U+ccb8,U+ccbc,U+cda5,U+ce84,U+cea3,U+cf67,U+cfe1,U+d241,U+d30d,U+d31c,U+d391,U+d401,U+d479,U+d5c9,U+d5db,U+d649,U+d6d4}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.107.woff2) format("woff2");unicode-range:U+b0,U+e9,U+2193,U+2462,U+260e,U+261e,U+300e-300f,U+3044,U+30a4,U+30fb-30fc,U+314d,U+5973,U+6545,U+6708,U+7537,U+ac89,U+ac9c,U+acc1,U+ad04,U+ad75,U+ad7d,U+ae45,U+ae61,U+af42,U+b0ab,U+b0af,U+b0b3,U+b12c,U+b194,U+b1a8,U+b220,U+b258,U+b284,U+b2ff,U+b315,U+b371,U+b3d4-b3d5,U+b460,U+b527,U+b534,U+b810,U+b818,U+b98e,U+ba55,U+bbac,U+bc0b,U+bc40,U+bca1,U+bccd,U+bd93,U+be54,U+be5a,U+bf08,U+bf50,U+bf55,U+bfdc,U+c0c0,U+c0d0,U+c0f4,U+c100,U+c11e,U+c170,U+c20d,U+c274,U+c290,U+c308,U+c369,U+c539,U+c587,U+c5ff,U+c6ec,U+c70c,U+c7ad,U+c7c8,U+c83c,U+c881,U+cb48,U+cc60,U+ce69,U+ce6b,U+ce75,U+cf04,U+cf08,U+cf55,U+cf70,U+cffc,U+d0b7,U+d1a8,U+d2c8,U+d384,U+d47c,U+d48b,U+d5dd,U+d5e8,U+d720,U+d759,U+f981}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.108.woff2) format("woff2");unicode-range:U+e0,U+e2,U+395,U+3b7,U+3ba,U+2460-2461,U+25a0,U+3010-3011,U+306e,U+30f3,U+314a,U+314c,U+5927,U+65b0,U+7e41,U+97d3,U+9ad4,U+ad49,U+ae0b,U+ae0d,U+ae43,U+ae5d,U+aecf,U+af3c,U+af64,U+afd4,U+b080,U+b084,U+b0c5,U+b10c,U+b1e8,U+b2ac,U+b36e,U+b451,U+b515,U+b540,U+b561,U+b6ab,U+b6b1,U+b72c,U+b730,U+b744,U+b800,U+b8ec,U+b8f0,U+b904,U+b968,U+b96d,U+b987,U+b9d9,U+bb36,U+bb49,U+bc2d,U+bc43,U+bcf6,U+bd89,U+be57,U+be61,U+bed4,U+c090,U+c130,U+c148,U+c19c,U+c2f9,U+c36c,U+c37c,U+c384,U+c3df,U+c575,U+c584,U+c660,U+c719,U+c816,U+ca4d,U+ca54,U+cabc,U+cb49,U+cc14,U+cff5,U+d004,U+d038,U+d0b4,U+d0d3,U+d0e0,U+d0ed,U+d131,U+d1b0,U+d31f,U+d33d,U+d3a0,U+d3ab,U+d514,U+d584,U+d6a1,U+d6cc,U+d749,U+d760,U+d799}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.109.woff2) format("woff2");unicode-range:U+24,U+60,U+3b9,U+3bb,U+3bd,U+2191,U+2606,U+300c-300d,U+3131,U+3134,U+3139,U+3141-3142,U+3148,U+3161,U+3163,U+321c,U+4eba,U+5317,U+ac31,U+ac77,U+ac9f,U+acb9,U+acf0-acf1,U+acfd,U+ad73,U+af3d,U+b00c,U+b04a,U+b057,U+b0c4,U+b188,U+b1cc,U+b214,U+b2db,U+b2ee,U+b304,U+b4ed,U+b518,U+b5bc,U+b625,U+b69c-b69d,U+b7ac,U+b801,U+b86c,U+b959,U+b95c,U+b985,U+ba48,U+bb58,U+bc0c,U+bc38,U+bc85,U+bc9a,U+bf40,U+c068,U+c0bd,U+c0cc,U+c12f,U+c149,U+c1e0,U+c22b,U+c22d,U+c250,U+c2fc,U+c300,U+c313,U+c370,U+c3d8,U+c557,U+c580,U+c5e3,U+c62e,U+c634,U+c6f0,U+c74d,U+c783,U+c78e,U+c796,U+c7bc,U+c92c,U+ca4c,U+cc1c,U+cc54,U+cc59,U+ce04,U+cf30,U+cfc4,U+d140,U+d321,U+d38c,U+d399,U+d54f,U+d587,U+d5d0,U+d6e8,U+d770}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.110.woff2) format("woff2");unicode-range:U+d7,U+ea,U+fc,U+2192,U+25bc,U+3000,U+3137,U+3145,U+315c,U+7f8e,U+ac13,U+ac71,U+ac90,U+acb8,U+ace7,U+ad7f,U+ae50,U+aef4,U+af34,U+afbc,U+b048,U+b09a,U+b0ad,U+b0bc,U+b113,U+b125,U+b141,U+b20c,U+b2d9,U+b2ed,U+b367,U+b369,U+b374,U+b3cb,U+b4ec,U+b611,U+b760,U+b81b,U+b834,U+b8b0,U+b8e1,U+b989,U+b9d1,U+b9e1,U+b9fa,U+ba4d,U+ba78,U+bb35,U+bb54,U+bbf9,U+bc11,U+bcb3,U+bd05,U+bd95,U+bdd4,U+be10,U+bed0,U+bf51,U+c0d8,U+c232,U+c2b7,U+c2eb,U+c378,U+c500,U+c52c,U+c549,U+c568,U+c598,U+c5c9,U+c61b,U+c639,U+c67c,U+c717,U+c78a,U+c80a,U+c90c-c90d,U+c950,U+c9e7,U+cbe4,U+cca9,U+cce4,U+cdb0,U+ce78,U+ce94,U+ce98,U+cf8c,U+d018,U+d034,U+d0f1,U+d1b1,U+d280,U+d2f8,U+d338,U+d380,U+d3b4,U+d610,U+d69f,U+d6fc,U+d758}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.111.woff2) format("woff2");unicode-range:U+e7,U+2022,U+203b,U+25c0,U+2605,U+2661,U+3147,U+318d,U+672c,U+8a9e,U+acaa,U+acbc,U+ad1c,U+ae4a,U+ae5c,U+b044,U+b054,U+b0c8-b0c9,U+b2a6,U+b2d0,U+b35c,U+b364,U+b428,U+b454,U+b465,U+b4b7,U+b4e3,U+b51c,U+b5a1,U+b784,U+b790,U+b7ab,U+b7f4,U+b82c,U+b835,U+b8e9,U+b8f8,U+b9d8,U+b9f9,U+ba5c,U+ba64,U+babd,U+bb18,U+bb3b,U+bbff,U+bc0d,U+bc45,U+bc97,U+bcbc,U+be45,U+be75,U+be7c,U+bfcc,U+c0b6,U+c0f7,U+c14b,U+c2b4,U+c30d,U+c4f8,U+c5bb,U+c5d1,U+c5e0,U+c5ee,U+c5fd,U+c606,U+c6c5,U+c6e0,U+c708,U+c81d,U+c820,U+c824,U+c878,U+c918,U+c96c,U+c9e4,U+c9f1,U+cc2e,U+cd09,U+cea1,U+cef5,U+cef7,U+cf64,U+cf69,U+cfe8,U+d035,U+d0ac,U+d230,U+d234,U+d2f4,U+d31d,U+d575,U+d578,U+d608,U+d614,U+d718,U+d751,U+d761,U+d78c,U+d790}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.112.woff2) format("woff2");unicode-range:U+2665,U+3160,U+4e2d,U+6587,U+65e5,U+ac12,U+ac14,U+ac16,U+ac81,U+ad34,U+ade0,U+ae54,U+aebc,U+af2c,U+afc0,U+afc8,U+b04c,U+b08c,U+b099,U+b0a9,U+b0ac,U+b0ae,U+b0b8,U+b123,U+b179,U+b2e5,U+b2f7,U+b4c0,U+b531,U+b538,U+b545,U+b550,U+b5a8,U+b6f0,U+b728,U+b73b,U+b7ad,U+b7ed,U+b809,U+b864,U+b86d,U+b871,U+b9bf,U+b9f5,U+ba40,U+ba4b,U+ba58,U+ba87,U+baac,U+bbc0,U+bc16,U+bc34,U+bd07,U+bd99,U+be59,U+bfd0,U+c058,U+c0e4,U+c0f5,U+c12d,U+c139,U+c228,U+c529,U+c5c7,U+c635,U+c637,U+c735,U+c77d,U+c787,U+c789,U+c8c4,U+c989,U+c98c,U+c9d0,U+c9d3,U+cc0c,U+cc99,U+cd0c,U+cd2c,U+cd98,U+cda4,U+ce59,U+ce60,U+ce6d,U+cea0,U+d0d0-d0d1,U+d0d5,U+d14d,U+d1a4,U+d29c,U+d2f1,U+d301,U+d39c,U+d3bc,U+d4e8,U+d540,U+d5ec,U+d640,U+d750}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.113.woff2) format("woff2");unicode-range:U+5e,U+25b2,U+25b6,U+314e,U+ac24,U+ace1,U+ace4,U+ae68,U+af2d,U+b0d0,U+b0e5,U+b150,U+b155,U+b193,U+b2c9,U+b2dd,U+b3c8,U+b3fc,U+b410,U+b458,U+b4dd,U+b5a0,U+b5a4,U+b5bb,U+b7b5,U+b838,U+b840,U+b86f,U+b8f9,U+b960,U+b9e5,U+bab8,U+bb50,U+bc1d,U+bc24-bc25,U+bca8,U+bcbd,U+bd04,U+bd10,U+bd24,U+be48,U+be5b,U+be68,U+c05c,U+c12c,U+c140,U+c15c,U+c168,U+c194,U+c219,U+c27d,U+c2a8,U+c2f1,U+c2f8,U+c368,U+c554-c555,U+c559,U+c564,U+c5d8,U+c5fc,U+c625,U+c65c,U+c6b1,U+c728,U+c794,U+c84c,U+c88c,U+c8e0,U+c8fd,U+c998,U+c9dd,U+cc0d,U+cc30,U+ceec,U+cf13,U+cf1c,U+cf5c,U+d050,U+d07c,U+d0a8,U+d134,U+d138,U+d154,U+d1f4,U+d2bc,U+d329,U+d32c,U+d3d0,U+d3f4,U+d3fc,U+d56b,U+d5cc,U+d600-d601,U+d639,U+d6c8,U+d754,U+d765}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.114.woff2) format("woff2");unicode-range:U+3c-3d,U+2026,U+24d2,U+314b,U+ac11,U+acf3,U+ad74,U+ad81,U+adf9,U+ae34,U+af43,U+afb8,U+b05d,U+b07c,U+b110,U+b118,U+b17c,U+b180,U+b18d,U+b192,U+b2cc,U+b355,U+b378,U+b4a4,U+b4ef,U+b78d,U+b799,U+b7a9,U+b7fd,U+b807,U+b80c,U+b839,U+b9b4,U+b9db,U+ba3c,U+bab0,U+bba4,U+bc94,U+be4c,U+c154,U+c1c4,U+c26c,U+c2ac,U+c2ed,U+c4f4,U+c55e,U+c561,U+c571,U+c5b5,U+c5c4,U+c654-c655,U+c695,U+c6e8,U+c6f9,U+c724,U+c751,U+c775,U+c7a0,U+c7c1,U+c874,U+c880,U+c9d5,U+c9f8,U+cabd,U+cc29,U+cc2c,U+cca8,U+ccab,U+ccd0,U+ce21,U+ce35,U+ce7c,U+ce90,U+cee8,U+cef4,U+cfe0,U+d070,U+d0b9,U+d0c1,U+d0c4,U+d0c8,U+d15c,U+d1a1,U+d2c0,U+d300,U+d314,U+d3ed,U+d478,U+d480,U+d48d,U+d508,U+d53d,U+d5e4,U+d611,U+d61c,U+d68d,U+d6a8,U+d798}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.115.woff2) format("woff2");unicode-range:U+23,U+25,U+5f,U+a9,U+ac08,U+ac78,U+aca8,U+acac,U+ace8,U+ad70,U+adc0,U+addc,U+b137,U+b140,U+b208,U+b290,U+b2f5,U+b3c5,U+b3cc,U+b420,U+b429,U+b529,U+b530,U+b77d,U+b79c,U+b7a8,U+b7c9,U+b7f0,U+b7fc,U+b828,U+b860,U+b9ad,U+b9c1,U+b9c9,U+b9dd-b9de,U+b9e8,U+ba38-ba39,U+babb,U+bc00,U+bc8c,U+bca0,U+bca4,U+bcd1,U+bcfc,U+bd09,U+bdf0,U+be60,U+c0ad,U+c0b4,U+c0bc,U+c190,U+c1fc,U+c220,U+c288,U+c2b9,U+c2f6,U+c528,U+c545,U+c558,U+c5bc,U+c5d4,U+c600,U+c644,U+c6c0,U+c6c3,U+c721,U+c798,U+c7a1,U+c811,U+c838,U+c871,U+c904,U+c990,U+c9dc,U+cc38,U+cc44,U+cca0,U+cd1d,U+cd95,U+cda9,U+ce5c,U+cf00,U+cf58,U+d150,U+d22c,U+d305,U+d328,U+d37c,U+d3f0,U+d551,U+d5a5,U+d5c8,U+d5d8,U+d63c,U+d64d,U+d669,U+d734,U+d76c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.116.woff2) format("woff2");unicode-range:U+26,U+2b,U+3e,U+40,U+7e,U+ac01,U+ac19,U+ac1d,U+aca0,U+aca9,U+acb0,U+ad8c,U+ae09,U+ae38,U+ae40,U+aed8,U+b09c,U+b0a0,U+b108,U+b204,U+b298,U+b2d8,U+b2eb-b2ec,U+b2f4,U+b313,U+b358,U+b450,U+b4e0,U+b54c,U+b610,U+b780,U+b78c,U+b791,U+b8e8,U+b958,U+b974,U+b984,U+b9b0,U+b9bc-b9bd,U+b9ce,U+ba70,U+bbfc,U+bc0f,U+bc15,U+bc1b,U+bc31,U+bc95,U+bcc0,U+bcc4,U+bd81,U+bd88,U+c0c8,U+c11d,U+c13c,U+c158,U+c18d,U+c1a1,U+c21c,U+c4f0,U+c54a,U+c560,U+c5b8,U+c5c8,U+c5f4,U+c628,U+c62c,U+c678,U+c6cc,U+c808,U+c810,U+c885,U+c88b,U+c900,U+c988,U+c99d,U+c9c8,U+cc3d-cc3e,U+cc45,U+cd08,U+ce20,U+cee4,U+d074,U+d0a4,U+d0dd,U+d2b9,U+d3b8,U+d3c9,U+d488,U+d544,U+d559,U+d56d,U+d588,U+d615,U+d648,U+d655,U+d658,U+d65c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.117.woff2) format("woff2");unicode-range:U+d,U+48,U+7c,U+ac10,U+ac15,U+ac74,U+ac80,U+ac83,U+acc4,U+ad11,U+ad50,U+ad6d,U+adfc,U+ae00,U+ae08,U+ae4c,U+b0a8,U+b124,U+b144,U+b178,U+b274,U+b2a5,U+b2e8,U+b2f9,U+b354,U+b370,U+b418,U+b41c,U+b4f1,U+b514,U+b798,U+b808,U+b824-b825,U+b8cc,U+b978,U+b9d0,U+b9e4,U+baa9,U+bb3c,U+bc18,U+bc1c,U+bc30,U+bc84,U+bcf5,U+bcf8,U+bd84,U+be0c,U+be14,U+c0b0,U+c0c9,U+c0dd,U+c124,U+c2dd,U+c2e4,U+c2ec,U+c54c,U+c57c-c57d,U+c591,U+c5c5-c5c6,U+c5ed,U+c608,U+c640,U+c6b8,U+c6d4,U+c784,U+c7ac,U+c800-c801,U+c9c1,U+c9d1,U+cc28,U+cc98,U+cc9c,U+ccad,U+cd5c,U+cd94,U+cd9c,U+cde8,U+ce68,U+cf54,U+d0dc,U+d14c,U+d1a0,U+d1b5,U+d2f0,U+d30c,U+d310,U+d398,U+d45c,U+d50c,U+d53c,U+d560,U+d568,U+d589,U+d604,U+d6c4,U+d788}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.118.woff2) format("woff2");unicode-range:U+39,U+49,U+4d-4e,U+a0,U+ac04,U+ac1c,U+ac70,U+ac8c,U+acbd,U+acf5,U+acfc,U+ad00,U+ad6c,U+adf8,U+b098,U+b0b4,U+b294,U+b2c8,U+b300,U+b3c4,U+b3d9,U+b4dc,U+b4e4,U+b77c,U+b7ec,U+b85d,U+b97c,U+b9c8,U+b9cc,U+ba54,U+ba74,U+ba85,U+baa8,U+bb34,U+bb38,U+bbf8,U+bc14,U+bc29,U+bc88,U+bcf4,U+bd80,U+be44,U+c0c1,U+c11c,U+c120,U+c131,U+c138,U+c18c,U+c218,U+c2b5,U+c2e0,U+c544,U+c548,U+c5b4,U+c5d0,U+c5ec,U+c5f0,U+c601,U+c624,U+c694,U+c6a9,U+c6b0,U+c6b4,U+c6d0,U+c704,U+c720,U+c73c,U+c740,U+c744,U+c74c,U+c758,U+c77c,U+c785,U+c788,U+c790-c791,U+c7a5,U+c804,U+c815,U+c81c,U+c870,U+c8fc,U+c911,U+c9c4,U+ccb4,U+ce58,U+ce74,U+d06c,U+d0c0,U+d130,U+d2b8,U+d3ec,U+d504,U+d55c,U+d569,U+d574,U+d638,U+d654,U+d68c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.119.woff2) format("woff2");unicode-range:U+20-22,U+27-2a,U+2c-38,U+3a-3b,U+3f,U+41-47,U+4a-4c,U+4f-5d,U+61-7b,U+7d,U+a1,U+ab,U+ae,U+b7,U+bb,U+bf,U+2013-2014,U+201c-201d,U+2122,U+ac00,U+ace0,U+ae30,U+b2e4,U+b85c,U+b9ac,U+c0ac,U+c2a4,U+c2dc,U+c774,U+c778,U+c9c0,U+d558}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshZAmK9RMckqI.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.0.woff2) format("woff2");unicode-range:U+25ee8,U+25f23,U+25f5c,U+25fd4,U+25fe0,U+25ffb,U+2600c,U+26017,U+26060,U+260ed,U+26222,U+2626a,U+26270,U+26286,U+2634c,U+26402,U+2667e,U+266b0,U+2671d,U+268dd,U+268ea,U+26951,U+2696f,U+26999,U+269dd,U+26a1e,U+26a58,U+26a8c,U+26ab7,U+26aff,U+26c29,U+26c73,U+26c9e,U+26cdd,U+26e40,U+26e65,U+26f94,U+26ff6-26ff8,U+270f4,U+2710d,U+27139,U+273da-273db,U+273fe,U+27410,U+27449,U+27614-27615,U+27631,U+27684,U+27693,U+2770e,U+27723,U+27752,U+278b2,U+27985,U+279b4,U+27a84,U+27bb3,U+27bbe,U+27bc7,U+27c3c,U+27cb8,U+27d73,U+27da0,U+27e10,U+27eaf,U+27fb7,U+2808a,U+280bb,U+28277,U+28282,U+282f3,U+283cd,U+2840c,U+28455,U+284dc,U+2856b,U+285c8-285c9,U+286d7,U+286fa,U+28946,U+28949,U+2896b,U+28987-28988,U+289ba-289bb,U+28a1e,U+28a29,U+28a43,U+28a71,U+28a99,U+28acd,U+28add,U+28ae4,U+28bc1,U+28bef,U+28cdd,U+28d10,U+28d71,U+28dfb,U+28e0f,U+28e17,U+28e1f,U+28e36,U+28e89,U+28eeb,U+28ef6,U+28f32,U+28ff8,U+292a0,U+292b1,U+29490,U+295cf,U+2967f,U+296f0,U+29719,U+29750,U+29810,U+298c6,U+29a72,U+29d4b,U+29ddb,U+29e15,U+29e3d,U+29e49,U+29e8a,U+29ec4,U+29edb,U+29ee9,U+29fce,U+29fd7,U+2a01a,U+2a02f,U+2a082,U+2a0f9,U+2a190,U+2a2b2,U+2a38c,U+2a437,U+2a5f1,U+2a602,U+2a61a,U+2a6b2,U+2a9e6,U+2b746,U+2b751,U+2b753,U+2b75a,U+2b75c,U+2b765,U+2b776-2b777,U+2b77c,U+2b782,U+2b789,U+2b78b,U+2b78e,U+2b794,U+2b7ac,U+2b7af,U+2b7bd,U+2b7c9,U+2b7cf,U+2b7d2,U+2b7d8,U+2b7f0,U+2b80d,U+2b817,U+2b81a,U+2d544,U+2e278,U+2e569,U+2e6ea,U+2f804,U+2f80f,U+2f815,U+2f818,U+2f81a,U+2f822,U+2f828,U+2f82c,U+2f833,U+2f83f,U+2f846,U+2f852,U+2f862,U+2f86d,U+2f873,U+2f877,U+2f884,U+2f899-2f89a,U+2f8a6,U+2f8ac,U+2f8b2,U+2f8b6,U+2f8d3,U+2f8db-2f8dc,U+2f8e1,U+2f8e5,U+2f8ea,U+2f8ed,U+2f8fc,U+2f903,U+2f90b,U+2f90f,U+2f91a,U+2f920-2f921,U+2f945,U+2f947,U+2f96c,U+2f995,U+2f9d0,U+2f9de-2f9df,U+2f9f4}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.1.woff2) format("woff2");unicode-range:U+1f235-1f23b,U+1f240-1f248,U+1f250-1f251,U+2000b,U+20089-2008a,U+200a2,U+200a4,U+200b0,U+200f5,U+20158,U+201a2,U+20213,U+2032b,U+20371,U+20381,U+203f9,U+2044a,U+20509,U+2053f,U+205b1,U+205d6,U+20611,U+20628,U+206ec,U+2074f,U+207c8,U+20807,U+2083a,U+208b9,U+2090e,U+2097c,U+20984,U+2099d,U+20a64,U+20ad3,U+20b1d,U+20b9f,U+20bb7,U+20d45,U+20d58,U+20de1,U+20e64,U+20e6d,U+20e95,U+20f5f,U+21201,U+2123d,U+21255,U+21274,U+2127b,U+212d7,U+212e4,U+212fd,U+2131b,U+21336,U+21344,U+213c4,U+2146d-2146e,U+215d7,U+21647,U+216b4,U+21706,U+21742,U+218bd,U+219c3,U+21a1a,U+21c56,U+21d2d,U+21d45,U+21d62,U+21d78,U+21d92,U+21d9c,U+21da1,U+21db7,U+21de0,U+21e33-21e34,U+21f1e,U+21f76,U+21ffa,U+2217b,U+22218,U+2231e,U+223ad,U+22609,U+226f3,U+2285b,U+228ab,U+2298f,U+22ab8,U+22b46,U+22b4f-22b50,U+22ba6,U+22c1d,U+22c24,U+22de1,U+22e42,U+22feb,U+231b6,U+231c3-231c4,U+231f5,U+23372,U+233cc,U+233d0,U+233d2-233d3,U+233d5,U+233da,U+233df,U+233e4,U+233fe,U+2344a-2344b,U+23451,U+23465,U+234e4,U+2355a,U+23594,U+235c4,U+23638-2363a,U+23647,U+2370c,U+2371c,U+2373f,U+23763-23764,U+237e7,U+237f1,U+237ff,U+23824,U+2383d,U+23a98,U+23c7f,U+23cbe,U+23cfe,U+23d00,U+23d0e,U+23d40,U+23dd3,U+23df9-23dfa,U+23f7e,U+2404b,U+24096,U+24103,U+241c6,U+241fe,U+242ee,U+243bc,U+243d0,U+24629,U+246a5,U+247f1,U+24896,U+248e9,U+24a4d,U+24b56,U+24b6f,U+24c16,U+24d14,U+24e04,U+24e0e,U+24e37,U+24e6a,U+24e8b,U+24ff2,U+2504a,U+25055,U+25122,U+251a9,U+251cd,U+251e5,U+2521e,U+2524c,U+2542e,U+2548e,U+254d9,U+2550e,U+255a7,U+2567f,U+25771,U+257a9,U+257b4,U+25874,U+259c4,U+259cc,U+259d4,U+25ad7,U+25ae3-25ae4,U+25af1,U+25bb2,U+25c4b,U+25c64,U+25da1,U+25e2e,U+25e56,U+25e62,U+25e65,U+25ec2,U+25ed8}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.2.woff2) format("woff2");unicode-range:U+ffd7,U+ffda-ffdc,U+ffe0-ffe2,U+ffe4,U+ffe6,U+ffe8-ffee,U+1f100-1f10c,U+1f110-1f16c,U+1f170-1f1ac,U+1f200-1f202,U+1f210-1f234}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.3.woff2) format("woff2");unicode-range:U+fa10,U+fa12-fa6d,U+fb00-fb04,U+fe10-fe19,U+fe30-fe42,U+fe44-fe52,U+fe54-fe66,U+fe68-fe6b,U+ff02,U+ff04,U+ff07,U+ff51,U+ff5b,U+ff5d,U+ff5f-ff60,U+ff66,U+ff69,U+ff87,U+ffa1-ffbe,U+ffc2-ffc7,U+ffca-ffcf,U+ffd2-ffd6}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.4.woff2) format("woff2");unicode-range:U+f92d-f959,U+f95b-f9f2,U+f9f4-fa0b,U+fa0e-fa0f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.5.woff2) format("woff2");unicode-range:U+9e8b-9e8c,U+9e8e-9e8f,U+9e91-9e92,U+9e95-9e96,U+9e98,U+9e9b,U+9e9d-9e9e,U+9ea4-9ea5,U+9ea8-9eaa,U+9eac-9eb0,U+9eb3-9eb5,U+9eb8,U+9ebc-9ebf,U+9ec3,U+9ec6,U+9ec8,U+9ecb-9ecd,U+9ecf-9ed1,U+9ed4-9ed5,U+9ed8,U+9edb-9ee0,U+9ee4-9ee5,U+9ee7-9ee8,U+9eec-9ef2,U+9ef4-9ef9,U+9efb-9eff,U+9f02-9f03,U+9f07-9f09,U+9f0e-9f12,U+9f14-9f17,U+9f19-9f1b,U+9f1f-9f22,U+9f26,U+9f2a-9f2c,U+9f2f,U+9f31-9f32,U+9f34,U+9f37,U+9f39-9f3a,U+9f3c-9f3f,U+9f41,U+9f43-9f47,U+9f4a,U+9f4e-9f50,U+9f52-9f58,U+9f5a,U+9f5d-9f61,U+9f63,U+9f66-9f6a,U+9f6c-9f73,U+9f75-9f77,U+9f7a,U+9f7d,U+9f7f,U+9f8f-9f92,U+9f94-9f97,U+9f99,U+9f9c-9fa3,U+9fa5,U+9fb4,U+9fbc-9fc2,U+9fc4,U+9fc6,U+9fcc,U+f900-f92c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.6.woff2) format("woff2");unicode-range:U+9c3e,U+9c41,U+9c43-9c4a,U+9c4e-9c50,U+9c52-9c54,U+9c56,U+9c58,U+9c5a-9c61,U+9c63,U+9c65,U+9c67-9c6b,U+9c6d-9c6e,U+9c70,U+9c72,U+9c75-9c78,U+9c7a-9c7c,U+9ce6-9ce7,U+9ceb-9cec,U+9cf0,U+9cf2,U+9cf6-9cf7,U+9cf9,U+9d02-9d03,U+9d06-9d09,U+9d0b,U+9d0e,U+9d11-9d12,U+9d15,U+9d17-9d18,U+9d1b-9d1f,U+9d23,U+9d26,U+9d2a-9d2c,U+9d2f-9d30,U+9d32-9d34,U+9d3a,U+9d3c-9d3f,U+9d41-9d48,U+9d4a,U+9d50-9d54,U+9d59,U+9d5d-9d65,U+9d69-9d6c,U+9d6f-9d70,U+9d72-9d73,U+9d76-9d77,U+9d7a-9d7c,U+9d7e,U+9d83-9d84,U+9d86-9d87,U+9d89-9d8a,U+9d8d-9d8e,U+9d92-9d93,U+9d95-9d9a,U+9da1,U+9da4,U+9da9-9dac,U+9dae,U+9db1-9db2,U+9db5,U+9db8-9dbd,U+9dbf-9dc4,U+9dc6-9dc7,U+9dc9-9dca,U+9dcf,U+9dd3-9dd7,U+9dd9-9dda,U+9dde-9de0,U+9de3,U+9de5-9de7,U+9de9,U+9deb,U+9ded-9df0,U+9df3-9df4,U+9df8,U+9dfd-9dfe,U+9e02,U+9e07,U+9e0a,U+9e0d-9e0e,U+9e10-9e12,U+9e15-9e16,U+9e19-9e1f,U+9e75,U+9e79-9e7d,U+9e80-9e85,U+9e87-9e88}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.7.woff2) format("woff2");unicode-range:U+9ae5-9ae7,U+9ae9,U+9aeb-9aec,U+9aee-9aef,U+9af1-9af5,U+9af7,U+9af9-9afb,U+9afd,U+9aff-9b06,U+9b08-9b09,U+9b0b-9b0e,U+9b10,U+9b12,U+9b16,U+9b18-9b1d,U+9b1f-9b20,U+9b22-9b23,U+9b25-9b2f,U+9b32-9b35,U+9b37,U+9b39-9b3b,U+9b3d,U+9b43-9b44,U+9b48,U+9b4b-9b4f,U+9b51,U+9b55-9b58,U+9b5b,U+9b5e,U+9b61,U+9b63,U+9b65-9b66,U+9b68,U+9b6a-9b6f,U+9b72-9b79,U+9b7f-9b80,U+9b83-9b87,U+9b89-9b8b,U+9b8d,U+9b8f-9b94,U+9b96-9b97,U+9b9a,U+9b9d-9ba0,U+9ba6-9ba7,U+9ba9-9baa,U+9bac,U+9bb0-9bb2,U+9bb4,U+9bb7-9bb9,U+9bbb-9bbc,U+9bbe-9bc1,U+9bc6-9bc8,U+9bca,U+9bce-9bd2,U+9bd4,U+9bd7-9bd8,U+9bdd,U+9bdf,U+9be1-9be5,U+9be7,U+9bea-9beb,U+9bee-9bf3,U+9bf5,U+9bf7-9bfa,U+9bfd,U+9bff-9c00,U+9c02,U+9c04,U+9c06,U+9c08-9c0d,U+9c0f-9c16,U+9c18-9c1e,U+9c21-9c2a,U+9c2d-9c32,U+9c35-9c37,U+9c39-9c3a,U+9c3d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.8.woff2) format("woff2");unicode-range:U+98eb,U+98ed-98ee,U+98f0-98f1,U+98f3,U+98f6,U+9902,U+9907-9909,U+9911-9912,U+9914-9918,U+991a-9922,U+9924,U+9926-9927,U+992b-992c,U+992e,U+9931-9935,U+9939-993e,U+9940-9942,U+9945-9949,U+994b-994e,U+9950-9952,U+9954-9955,U+9958-9959,U+995b-995c,U+995e-9960,U+9963,U+9997-9998,U+999b,U+999d-999f,U+99a3,U+99a5-99a6,U+99a8,U+99ad-99ae,U+99b0-99b2,U+99b5,U+99b9-99ba,U+99bc-99bd,U+99bf,U+99c1,U+99c3,U+99c8-99c9,U+99d1,U+99d3-99d5,U+99d8-99df,U+99e1-99e2,U+99e7,U+99ea-99ee,U+99f0-99f2,U+99f4-99f5,U+99f8-99f9,U+99fb-99fe,U+9a01-9a05,U+9a08,U+9a0a-9a0c,U+9a0f-9a11,U+9a16,U+9a1a,U+9a1e,U+9a20,U+9a22-9a24,U+9a27,U+9a2b,U+9a2d-9a2e,U+9a31,U+9a33,U+9a35-9a38,U+9a3e,U+9a40-9a45,U+9a47,U+9a4a-9a4e,U+9a51-9a52,U+9a54-9a58,U+9a5b,U+9a5d,U+9a5f,U+9a62,U+9a64-9a65,U+9a69-9a6c,U+9aaa,U+9aac-9ab0,U+9ab2,U+9ab4-9ab7,U+9ab9,U+9abb-9ac1,U+9ac3,U+9ac6,U+9ac8,U+9ace-9ad3,U+9ad5-9ad7,U+9adb-9adc,U+9ade-9ae0,U+9ae2-9ae4}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.9.woff2) format("woff2");unicode-range:U+971d,U+9721-9724,U+9728,U+972a,U+9730-9731,U+9733,U+9736,U+9738-9739,U+973b,U+973d-973e,U+9741-9744,U+9746-974a,U+974d-974f,U+9751,U+9755,U+9757-9758,U+975a-975c,U+9760-9761,U+9763-9764,U+9766-9768,U+976a-976b,U+976e,U+9771,U+9773,U+9776-977d,U+977f-9781,U+9785-9786,U+9789,U+978b,U+978f-9790,U+9795-9797,U+9799-979a,U+979c,U+979e-97a0,U+97a2-97a3,U+97a6,U+97a8,U+97ab-97ac,U+97ae,U+97b1-97b6,U+97b8-97ba,U+97bc,U+97be-97bf,U+97c1,U+97c3-97ce,U+97d0-97d1,U+97d4,U+97d7-97d9,U+97db-97de,U+97e0-97e1,U+97e4,U+97e6,U+97ed-97ef,U+97f1-97f2,U+97f4-97f8,U+97fa,U+9804,U+9807,U+980a,U+980c-980f,U+9814,U+9816-9817,U+9819-981a,U+981c,U+981e,U+9820-9821,U+9823-9826,U+982b,U+982e-9830,U+9832-9835,U+9837,U+9839,U+983d-983e,U+9844,U+9846-9847,U+984a-984b,U+984f,U+9851-9853,U+9856-9857,U+9859-985b,U+9862-9863,U+9865-9866,U+986a-986c,U+986f-9871,U+9873-9875,U+98aa-98ab,U+98ad-98ae,U+98b0-98b1,U+98b4,U+98b6-98b8,U+98ba-98bc,U+98bf,U+98c2-98c8,U+98cb-98cc,U+98ce,U+98dc,U+98de,U+98e0-98e1,U+98e3,U+98e5-98e7,U+98e9-98ea}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.10.woff2) format("woff2");unicode-range:U+944a,U+944c,U+9452-9453,U+9455,U+9459-945c,U+945e-9463,U+9468,U+946a-946b,U+946d-9472,U+9475,U+9477,U+947c-947f,U+9481,U+9483-9485,U+9578-9579,U+957e-957f,U+9582,U+9584,U+9586-9588,U+958a,U+958c-958f,U+9592,U+9594,U+9596,U+9598-9599,U+959d-95a1,U+95a4,U+95a6-95a9,U+95ab-95ad,U+95b1,U+95b4,U+95b6,U+95b9-95bf,U+95c3,U+95c6,U+95c8-95cd,U+95d0-95d6,U+95d9-95da,U+95dc-95e2,U+95e4-95e6,U+95e8,U+961d-961e,U+9621-9622,U+9624-9626,U+9628,U+962c,U+962e-962f,U+9631,U+9633-9634,U+9637-963a,U+963c-963d,U+9641-9642,U+964b-964c,U+964f,U+9652,U+9654,U+9656-9658,U+965c-965f,U+9661,U+9666,U+966a,U+966c,U+966e,U+9672,U+9674,U+9677,U+967b-967c,U+967e-967f,U+9681-9684,U+9689,U+968b,U+968d,U+9691,U+9695-9698,U+969a,U+969d,U+969f,U+96a4-96aa,U+96ae-96b4,U+96b6,U+96b8-96bb,U+96bd,U+96c1,U+96c9-96cb,U+96cd-96ce,U+96d2,U+96d5-96d6,U+96d8-96da,U+96dc-96df,U+96e9,U+96ef,U+96f1,U+96f9-96fa,U+9702-9706,U+9708-9709,U+970d-970f,U+9711,U+9713-9714,U+9716,U+9719-971b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.11.woff2) format("woff2");unicode-range:U+92bc-92bd,U+92bf-92c3,U+92c5-92c8,U+92cb-92d0,U+92d2-92d3,U+92d5,U+92d7-92d9,U+92dc-92dd,U+92df-92e1,U+92e3-92e5,U+92e7-92ea,U+92ec,U+92ee,U+92f0,U+92f2,U+92f7-92fb,U+92ff-9300,U+9302,U+9304,U+9308,U+930d,U+930f-9311,U+9314-9315,U+9318-931a,U+931c-931f,U+9321-9325,U+9327-932b,U+932e,U+9333-9337,U+933a-933b,U+9344,U+9347-934a,U+934d,U+9350-9352,U+9354-9358,U+935a,U+935c,U+935e,U+9360,U+9364-9365,U+9367,U+9369-936d,U+936f-9371,U+9373-9374,U+9376,U+937a,U+937d-9382,U+9388,U+938a-938b,U+938d,U+938f,U+9392,U+9394-9395,U+9397-9398,U+939a-939b,U+939e,U+93a1,U+93a3-93a4,U+93a6,U+93a8-93a9,U+93ab-93ad,U+93b0,U+93b4-93b6,U+93b9-93bb,U+93c1,U+93c3-93cd,U+93d0-93d1,U+93d3,U+93d6-93d9,U+93dc-93df,U+93e2,U+93e4-93e8,U+93f1,U+93f5,U+93f7-93fb,U+93fd,U+9401-9404,U+9407-9409,U+940d-9410,U+9413-9417,U+9419-941a,U+941f,U+9421,U+942b,U+942e-942f,U+9431-9434,U+9436,U+9438,U+943a-943b,U+943d,U+943f,U+9441,U+9443-9445,U+9448}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.12.woff2) format("woff2");unicode-range:U+9143,U+9146-914c,U+914f,U+9153,U+9156-915b,U+9161,U+9163-9165,U+9167,U+9169,U+916d,U+9172-9174,U+9179-917b,U+9181-9183,U+9185-9187,U+9189-918b,U+918e,U+9191,U+9193-9195,U+9197-9198,U+919e,U+91a1-91a2,U+91a6,U+91a8,U+91aa-91b6,U+91ba-91bd,U+91bf-91c6,U+91c9,U+91cb,U+91d0,U+91d3-91d4,U+91d6-91d7,U+91d9-91db,U+91de-91df,U+91e1,U+91e4-91e6,U+91e9-91ea,U+91ec-91f1,U+91f5-91f7,U+91f9,U+91fb-91fd,U+91ff-9201,U+9204-9207,U+9209-920a,U+920c,U+920e,U+9210-9218,U+921c-921e,U+9223-9226,U+9228-9229,U+922c,U+922e-9230,U+9233,U+9235-923a,U+923c,U+923e-9240,U+9242-9243,U+9245-924b,U+924d-9251,U+9256-925a,U+925c-925e,U+9260-9261,U+9264-9269,U+926e-9270,U+9275-9279,U+927b-927f,U+9288-928a,U+928d-928e,U+9291-9293,U+9295-9297,U+9299,U+929b-929c,U+929f-92a0,U+92a4-92a5,U+92a7-92a8,U+92ab,U+92af,U+92b2-92b3,U+92b6-92bb}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.13.woff2) format("woff2");unicode-range:U+8f52-8f55,U+8f57-8f58,U+8f5c-8f5e,U+8f61-8f66,U+8f9c-8f9d,U+8f9f-8fa2,U+8fa4-8fa8,U+8fad-8faf,U+8fb4-8fb8,U+8fbe,U+8fc0-8fc2,U+8fc6,U+8fc8,U+8fca-8fcb,U+8fcd,U+8fd0,U+8fd2-8fd3,U+8fd5,U+8fda,U+8fe0,U+8fe2-8fe5,U+8fe8-8fea,U+8fed-8fef,U+8ff1,U+8ff4-8ff6,U+8ff8-8ffb,U+8ffe,U+9002,U+9004-9005,U+9008,U+900b-900e,U+9011,U+9013,U+9015-9016,U+9018,U+901b,U+901e,U+9021,U+9027-902a,U+902c-902d,U+902f,U+9033-9037,U+9039,U+903c,U+903e-903f,U+9041,U+9043-9044,U+9049,U+904c,U+904f-9052,U+9056,U+9058,U+905b-905e,U+9062,U+9066-9068,U+906c,U+906f-9070,U+9072,U+9074,U+9076,U+9079,U+9080-9083,U+9085,U+9087-9088,U+908b-908c,U+908e-9090,U+9095,U+9097-9099,U+909b,U+90a0-90a2,U+90a5,U+90a8,U+90af-90b6,U+90bd-90be,U+90c3-90c5,U+90c7-90c9,U+90cc,U+90d2,U+90d5,U+90d7-90d9,U+90db-90df,U+90e2,U+90e4-90e5,U+90eb,U+90ef-90f0,U+90f2,U+90f4,U+90f6,U+90fe-9100,U+9102,U+9104-9106,U+9108,U+910d,U+9110,U+9112,U+9114-911a,U+911c,U+911e,U+9120,U+9122-9123,U+9125,U+9127,U+9129,U+912d-9132,U+9134,U+9136-9137,U+9139-913a,U+913c-913d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.14.woff2) format("woff2");unicode-range:U+8dc0,U+8dc2,U+8dc5-8dc8,U+8dca-8dcc,U+8dce-8dcf,U+8dd1,U+8dd4-8dd7,U+8dd9-8ddb,U+8ddf,U+8de3-8de5,U+8de7,U+8dea-8dec,U+8df0-8df2,U+8df4,U+8dfc-8dfd,U+8dff,U+8e01,U+8e04-8e06,U+8e08-8e09,U+8e0b-8e0c,U+8e10-8e11,U+8e14,U+8e16,U+8e1d-8e23,U+8e26-8e27,U+8e30-8e31,U+8e33-8e39,U+8e3d,U+8e40-8e42,U+8e44,U+8e47-8e50,U+8e54-8e55,U+8e59,U+8e5b-8e64,U+8e69,U+8e6c-8e6d,U+8e6f-8e72,U+8e75-8e77,U+8e79-8e7c,U+8e81-8e85,U+8e89,U+8e8b,U+8e90-8e95,U+8e98-8e9b,U+8e9d-8e9e,U+8ea1-8ea2,U+8ea7,U+8ea9-8eaa,U+8eac-8eb1,U+8eb3,U+8eb5-8eb6,U+8eba-8ebb,U+8ebe,U+8ec0-8ec1,U+8ec3-8ec8,U+8ecb,U+8ecf,U+8ed1,U+8ed4,U+8edb-8edc,U+8ee3,U+8ee8,U+8eeb,U+8eed-8eee,U+8ef0-8ef1,U+8ef7,U+8ef9-8efc,U+8efe,U+8f00,U+8f02,U+8f05,U+8f07-8f08,U+8f0a,U+8f0f-8f10,U+8f12-8f13,U+8f15-8f19,U+8f1b-8f1c,U+8f1e-8f21,U+8f23,U+8f25-8f28,U+8f2b-8f2f,U+8f33-8f37,U+8f39-8f3b,U+8f3e,U+8f40-8f43,U+8f45-8f47,U+8f49-8f4a,U+8f4c-8f4f,U+8f51}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.15.woff2) format("woff2");unicode-range:U+8b2d,U+8b30,U+8b37,U+8b3c,U+8b3e,U+8b41-8b46,U+8b48-8b49,U+8b4c-8b4f,U+8b51-8b54,U+8b56,U+8b59,U+8b5b,U+8b5e-8b5f,U+8b63,U+8b69,U+8b6b-8b6d,U+8b6f,U+8b71,U+8b74,U+8b76,U+8b78-8b79,U+8b7c-8b81,U+8b84-8b85,U+8b8a-8b8f,U+8b92-8b96,U+8b99-8b9a,U+8b9c-8ba0,U+8c38-8c3a,U+8c3d-8c3f,U+8c41,U+8c45,U+8c47-8c49,U+8c4b-8c4c,U+8c4e-8c51,U+8c53-8c55,U+8c57-8c59,U+8c5b,U+8c5d,U+8c62-8c64,U+8c66,U+8c68-8c69,U+8c6b-8c6d,U+8c73,U+8c75-8c76,U+8c78,U+8c7a-8c7c,U+8c7e,U+8c82,U+8c85-8c87,U+8c89-8c8b,U+8c8d-8c8e,U+8c90,U+8c92-8c94,U+8c98-8c99,U+8c9b-8c9c,U+8c9f,U+8ca4,U+8cad-8cae,U+8cb2-8cb3,U+8cb6,U+8cb9-8cba,U+8cbd,U+8cc1-8cc2,U+8cc4-8cc6,U+8cc8-8cc9,U+8ccb,U+8ccd-8ccf,U+8cd2,U+8cd5-8cd6,U+8cd9-8cda,U+8cdd,U+8ce1,U+8ce3-8ce4,U+8ce6,U+8ce8,U+8cec,U+8cef-8cf2,U+8cf4-8cf5,U+8cf7-8cf8,U+8cfa-8cfb,U+8cfd-8cff,U+8d01,U+8d03-8d04,U+8d07,U+8d09-8d0b,U+8d0d-8d10,U+8d12-8d14,U+8d16-8d17,U+8d1b-8d1d,U+8d65,U+8d67,U+8d69,U+8d6b-8d6e,U+8d71,U+8d73,U+8d76,U+8d7f,U+8d81-8d82,U+8d84,U+8d88,U+8d8d,U+8d90-8d91,U+8d95,U+8d99,U+8d9e-8da0,U+8da6,U+8da8,U+8dab-8dac,U+8daf,U+8db2,U+8db5,U+8db7,U+8db9-8dbc,U+8dbe}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.16.woff2) format("woff2");unicode-range:U+8973-8975,U+8977,U+897a-897e,U+8980,U+8983,U+8988-898a,U+898d,U+8990,U+8993-8995,U+8998,U+899b-899c,U+899f-89a1,U+89a5-89a6,U+89a9,U+89ac,U+89af-89b0,U+89b2,U+89b4-89b7,U+89ba,U+89bc-89bd,U+89bf-89c1,U+89d4-89d8,U+89da,U+89dc-89dd,U+89e5,U+89e7,U+89e9,U+89eb,U+89ed,U+89f1,U+89f3-89f4,U+89f6,U+89f8-89f9,U+89fd,U+89ff,U+8a01,U+8a04-8a05,U+8a07,U+8a0c,U+8a0f-8a12,U+8a14-8a16,U+8a1b,U+8a1d-8a1e,U+8a20-8a22,U+8a24-8a26,U+8a2b-8a2c,U+8a2f,U+8a35-8a37,U+8a3b,U+8a3d-8a3e,U+8a40-8a41,U+8a43,U+8a45-8a49,U+8a4d-8a4e,U+8a51-8a54,U+8a56-8a58,U+8a5b-8a5d,U+8a61-8a62,U+8a65,U+8a67,U+8a6c-8a6d,U+8a75-8a77,U+8a79-8a7c,U+8a7e-8a80,U+8a82-8a86,U+8a8b,U+8a8f-8a92,U+8a96-8a97,U+8a99-8a9a,U+8a9f,U+8aa1,U+8aa3,U+8aa5-8aaa,U+8aae-8aaf,U+8ab3,U+8ab6-8ab7,U+8abb-8abc,U+8abe,U+8ac2-8ac4,U+8ac6,U+8ac8-8aca,U+8acc-8acd,U+8ad0-8ad1,U+8ad3-8ad5,U+8ad7,U+8ada-8ae2,U+8ae4,U+8ae7,U+8aeb-8aec,U+8aee,U+8af0-8af1,U+8af3-8af7,U+8afa,U+8afc,U+8aff,U+8b01-8b02,U+8b04-8b07,U+8b0a-8b0d,U+8b0f-8b11,U+8b14,U+8b16,U+8b1a,U+8b1c,U+8b1e-8b20,U+8b26,U+8b28,U+8b2b-8b2c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.17.woff2) format("woff2");unicode-range:U+87e2-87e6,U+87ea-87ed,U+87ef,U+87f1,U+87f3,U+87f5-87f8,U+87fa-87fb,U+87fe-87ff,U+8801,U+8803,U+8805-8807,U+8809-880b,U+880d-8816,U+8818-881c,U+881e-881f,U+8821-8822,U+8827-8828,U+882d-882e,U+8830-8832,U+8835-8836,U+8839-883c,U+8841-8845,U+8848-884b,U+884d-884e,U+8851-8852,U+8855-8856,U+8858-885a,U+885c,U+885e-8860,U+8862,U+8864,U+8869,U+886b,U+886e-886f,U+8871-8872,U+8875,U+8877,U+8879,U+887b,U+887d-887e,U+8880-8882,U+8888,U+888d,U+8892,U+8897-889c,U+889e-88a0,U+88a2,U+88a4,U+88a8,U+88aa,U+88ae,U+88b0-88b1,U+88b5,U+88b7,U+88ba,U+88bc-88c0,U+88c3-88c4,U+88c6,U+88ca-88ce,U+88d1-88d4,U+88d8-88d9,U+88db,U+88dd-88e1,U+88e7-88e8,U+88ef-88f2,U+88f4-88f5,U+88f7,U+88f9,U+88fc,U+8901-8902,U+8904,U+8906,U+890a,U+890c-890f,U+8913,U+8915-8916,U+8918-891a,U+891c-891e,U+8920,U+8925-8928,U+892a-892b,U+8930-8932,U+8935-893b,U+893e,U+8940-8946,U+8949,U+894c-894d,U+894f,U+8952,U+8956-8957,U+895a-895c,U+895e,U+8960-8964,U+8966,U+896a-896b,U+896d-8970}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.18.woff2) format("woff2");unicode-range:U+8655-8659,U+865b,U+865d-8664,U+8667,U+8669,U+866c,U+866f,U+8671,U+8675-8677,U+867a-867b,U+867d,U+8687-8689,U+868b-868d,U+8691,U+8693,U+8695-8696,U+8698,U+869a,U+869c-869d,U+86a1,U+86a3-86a4,U+86a6-86ab,U+86ad,U+86af-86b1,U+86b3-86b9,U+86bf-86c1,U+86c3-86c6,U+86c9,U+86cb,U+86ce,U+86d1-86d2,U+86d4-86d5,U+86d7,U+86da,U+86dc,U+86de-86e0,U+86e3-86e7,U+86e9,U+86ec-86ed,U+86ef,U+86f8-86fe,U+8700,U+8703-870b,U+870d-8714,U+8719-871a,U+871e-871f,U+8721-8723,U+8725,U+8728-8729,U+872e-872f,U+8731-8732,U+8734,U+8737,U+8739-8740,U+8743,U+8745,U+8749,U+874b-874e,U+8751,U+8753,U+8755,U+8757-8759,U+875d,U+875f-8761,U+8763-8766,U+8768,U+876a,U+876e-876f,U+8771-8772,U+8774,U+8778,U+877b-877c,U+877f,U+8782-8789,U+878b-878c,U+878e,U+8790,U+8793,U+8795,U+8797-8799,U+879e-87a0,U+87a2-87a3,U+87a7,U+87ab-87af,U+87b1,U+87b3,U+87b5,U+87bb,U+87bd-87c1,U+87c4,U+87c6-87cb,U+87ce,U+87d0,U+87d2,U+87d5-87d6,U+87d9-87da,U+87dc,U+87df-87e0}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.19.woff2) format("woff2");unicode-range:U+84b4,U+84b9-84bb,U+84bd-84c2,U+84c6-84ca,U+84cc-84d1,U+84d3,U+84d6,U+84d9-84da,U+84dc,U+84e7,U+84ea,U+84ec,U+84ef-84f2,U+84f4,U+84f7,U+84fa-84fd,U+84ff-8500,U+8502-8503,U+8506-8507,U+850c,U+850e,U+8510,U+8514-8515,U+8517-8518,U+851a-851c,U+851e-851f,U+8521-8525,U+8527,U+852a-852c,U+852f,U+8532-8534,U+8536,U+853e-8541,U+8543,U+8546,U+8548,U+854a-854b,U+854f-8553,U+8555-855a,U+855c-8564,U+8569-856b,U+856d,U+856f,U+8577,U+8579-857b,U+857d-8581,U+8585-8586,U+8588-858c,U+858f-8591,U+8593,U+8597-8598,U+859b-859d,U+859f-85a0,U+85a2,U+85a4-85a5,U+85a7-85a8,U+85ad-85b0,U+85b4,U+85b6-85ba,U+85bc-85bf,U+85c1-85c2,U+85c7,U+85c9-85cb,U+85ce-85d0,U+85d5,U+85d8-85da,U+85dc,U+85df-85e1,U+85e5-85e6,U+85e8,U+85ed,U+85f3-85f4,U+85f6-85f7,U+85f9-85fa,U+85fc,U+85fe-8600,U+8602,U+8604-8606,U+860a-860b,U+860d-860e,U+8610-8613,U+8616-861b,U+861e,U+8621-8622,U+8624,U+8627,U+8629,U+862f-8630,U+8636,U+8638-863a,U+863c-863d,U+863f-8642,U+8646,U+864d,U+8652-8654}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.20.woff2) format("woff2");unicode-range:U+82e8,U+82ea,U+82ed,U+82ef,U+82f3-82f4,U+82f6-82f7,U+82f9,U+82fb,U+82fd-82fe,U+8300-8301,U+8303,U+8306-8308,U+830a-830c,U+8316-8318,U+831b,U+831d-831f,U+8321-8323,U+832b-8335,U+8337,U+833a,U+833c-833d,U+8340,U+8342-8347,U+834a,U+834d-8351,U+8353-8357,U+835a,U+8362-8363,U+8370,U+8373,U+8375,U+8378,U+837c-837d,U+837f-8380,U+8382,U+8384-8387,U+838a,U+838d-838e,U+8392-8396,U+8398-83a0,U+83a2,U+83a6-83ad,U+83b1,U+83b5,U+83bd-83c1,U+83c7,U+83c9,U+83ce-83d1,U+83d4,U+83d6,U+83d8,U+83dd,U+83df-83e1,U+83e5,U+83e8,U+83ea-83eb,U+83f0,U+83f2,U+83f4,U+83f6-83f9,U+83fb-83fd,U+8401,U+8403-8404,U+8406-8407,U+840a-840b,U+840d,U+840f,U+8411,U+8413,U+8415,U+8417,U+8419,U+8420,U+8422,U+842a,U+842f,U+8431,U+8435,U+8438-8439,U+843c,U+8445-8448,U+844a,U+844d-844f,U+8451-8452,U+8456,U+8458-845a,U+845c,U+845f-8462,U+8464-8467,U+8469-846b,U+846d-8470,U+8473-8474,U+8476-847a,U+847c-847d,U+8481-8482,U+8484-8485,U+848b,U+8490,U+8492-8493,U+8495,U+8497,U+849c,U+849e-849f,U+84a1,U+84a6,U+84a8-84aa,U+84ad,U+84af,U+84b1}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.21.woff2) format("woff2");unicode-range:U+814a,U+814c,U+8151-8153,U+8157,U+815f-8161,U+8165-8169,U+816d-816f,U+8171,U+8173-8174,U+8177,U+8180-8186,U+8188,U+818a-818b,U+818e,U+8190,U+8193,U+8195-8196,U+8198,U+819b,U+819e,U+81a0,U+81a2,U+81a4,U+81a9,U+81ae,U+81b0,U+81b2,U+81b4-81b5,U+81b8,U+81ba-81bb,U+81bd-81be,U+81c0-81c3,U+81c5-81c6,U+81c8-81cb,U+81cd-81cf,U+81d1,U+81d5-81db,U+81dd-81e1,U+81e4-81e5,U+81e7,U+81eb-81ec,U+81ef-81f2,U+81f5-81f6,U+81f8-81fb,U+81fd-8205,U+8209-820b,U+820d,U+820f,U+8212-8214,U+8216,U+8219-821d,U+8221-8222,U+8228-8229,U+822b,U+822e,U+8232-8235,U+8237-8238,U+823a,U+823c,U+8240,U+8243-8246,U+8249,U+824b,U+824e-824f,U+8251,U+8256-825a,U+825c-825d,U+825f-8260,U+8262-8264,U+8267-8268,U+826a-826b,U+826d-826e,U+8271,U+8274,U+8277,U+8279,U+827b,U+827d-8281,U+8283-8284,U+8287,U+8289-828a,U+828d-828e,U+8291-8294,U+8296,U+8298-829b,U+829f-82a1,U+82a3-82a4,U+82a7-82ac,U+82ae,U+82b0,U+82b2,U+82b4,U+82b7,U+82ba-82bc,U+82be-82bf,U+82c5-82c6,U+82d0,U+82d2-82d3,U+82d5,U+82d9-82da,U+82dc,U+82de-82e4,U+82e7}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.22.woff2) format("woff2");unicode-range:U+7f77-7f79,U+7f7d-7f80,U+7f82-7f83,U+7f86-7f88,U+7f8b-7f8d,U+7f8f-7f91,U+7f94,U+7f96-7f97,U+7f9a,U+7f9c-7f9d,U+7fa1-7fa3,U+7fa6,U+7faa,U+7fad-7faf,U+7fb2,U+7fb4,U+7fb6,U+7fb8-7fb9,U+7fbc,U+7fbf-7fc0,U+7fc3,U+7fc5-7fc6,U+7fc8,U+7fca,U+7fce-7fcf,U+7fd5,U+7fdb,U+7fdf,U+7fe1,U+7fe3,U+7fe5-7fe6,U+7fe8-7fe9,U+7feb-7fec,U+7fee-7ff0,U+7ff2-7ff3,U+7ff9-7ffa,U+7ffd-7fff,U+8002,U+8004,U+8006-8008,U+800a-800f,U+8011-8014,U+8016,U+8018-8019,U+801c-8021,U+8024,U+8026,U+8028,U+802c,U+802e,U+8030,U+8034-8035,U+8037,U+8039-8040,U+8043-8044,U+8046,U+804a,U+8052,U+8058,U+805a,U+805f-8060,U+8062,U+8064,U+8066,U+8068,U+806d,U+806f-8073,U+8075-8076,U+8079,U+807b,U+807d-8081,U+8084-8088,U+808b,U+808e,U+8093,U+8099-809a,U+809c,U+809e,U+80a4,U+80a6-80a7,U+80ab-80ad,U+80b1,U+80b8-80b9,U+80c4-80c5,U+80c8,U+80ca,U+80cd,U+80cf,U+80d2,U+80d4-80db,U+80dd,U+80e0,U+80e4-80e6,U+80ed-80f3,U+80f5-80f7,U+80f9-80fc,U+80fe,U+8101,U+8103,U+8109,U+810b,U+810d,U+8116-8118,U+811b-811c,U+811e,U+8120,U+8123-8124,U+8127,U+8129,U+812b-812c,U+812f-8130,U+8135,U+8139-813a,U+813c-813e,U+8141,U+8145-8147}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.23.woff2) format("woff2");unicode-range:U+7d57,U+7d59-7d5d,U+7d63,U+7d65,U+7d67,U+7d6a,U+7d6e,U+7d70,U+7d72-7d73,U+7d78,U+7d7a-7d7b,U+7d7d,U+7d7f,U+7d81-7d83,U+7d85-7d86,U+7d88-7d89,U+7d8b-7d8d,U+7d8f,U+7d91,U+7d93,U+7d96-7d97,U+7d9b-7da0,U+7da2-7da3,U+7da6-7da7,U+7daa-7dac,U+7dae-7db0,U+7db3,U+7db5-7db9,U+7dbd,U+7dc0,U+7dc2-7dc7,U+7dcc-7dce,U+7dd0,U+7dd5-7dd9,U+7ddc-7dde,U+7de1-7de6,U+7dea-7ded,U+7df1-7df2,U+7df5-7df6,U+7df9-7dfa,U+7e00,U+7e05,U+7e08-7e0b,U+7e10-7e12,U+7e15,U+7e17,U+7e1c-7e1d,U+7e1f-7e23,U+7e27-7e28,U+7e2c-7e2d,U+7e2f,U+7e31-7e33,U+7e35-7e37,U+7e39-7e3b,U+7e3d,U+7e3f,U+7e43-7e48,U+7e4e,U+7e50,U+7e52,U+7e56,U+7e58-7e5a,U+7e5d-7e5f,U+7e61-7e62,U+7e65-7e67,U+7e69-7e6b,U+7e6d-7e6f,U+7e73,U+7e75,U+7e78-7e79,U+7e7b-7e7f,U+7e81-7e83,U+7e86-7e8a,U+7e8c-7e8e,U+7e90-7e96,U+7e98,U+7e9a-7e9f,U+7f38,U+7f3a-7f3f,U+7f43-7f45,U+7f47,U+7f4c-7f50,U+7f52-7f55,U+7f58,U+7f5b-7f5d,U+7f5f,U+7f61,U+7f63-7f69,U+7f6b,U+7f6d,U+7f71}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.24.woff2) format("woff2");unicode-range:U+7bc8,U+7bca-7bcc,U+7bcf,U+7bd4,U+7bd6-7bd7,U+7bd9-7bdb,U+7bdd,U+7be5-7be6,U+7be8-7bea,U+7bf0,U+7bf2-7bfa,U+7bfc,U+7bfe,U+7c00-7c04,U+7c06-7c07,U+7c09,U+7c0b-7c0f,U+7c11-7c14,U+7c17,U+7c19,U+7c1b,U+7c1e-7c20,U+7c23,U+7c25-7c28,U+7c2a-7c2c,U+7c2f,U+7c31,U+7c33-7c34,U+7c36-7c3a,U+7c3d-7c3e,U+7c40,U+7c42-7c43,U+7c45-7c46,U+7c4a,U+7c4c,U+7c4f-7c5f,U+7c61,U+7c63-7c65,U+7c67,U+7c69,U+7c6c-7c70,U+7c72,U+7c75,U+7c79,U+7c7b-7c7e,U+7c81-7c83,U+7c86-7c87,U+7c8d,U+7c8f-7c90,U+7c94,U+7c9e,U+7ca0-7ca2,U+7ca4-7ca6,U+7ca8,U+7cab,U+7cad-7cae,U+7cb0-7cb3,U+7cb6-7cb7,U+7cb9-7cbd,U+7cbf-7cc0,U+7cc2,U+7cc4-7cc5,U+7cc7-7cca,U+7ccd-7ccf,U+7cd2-7cd5,U+7cd7-7cda,U+7cdc-7cdd,U+7cdf-7ce0,U+7ce2,U+7ce6,U+7ce9,U+7ceb,U+7cef,U+7cf2,U+7cf4-7cf6,U+7cf9-7cfa,U+7cfe,U+7d02-7d03,U+7d06-7d0a,U+7d0f,U+7d11-7d13,U+7d15-7d16,U+7d1c-7d1e,U+7d23,U+7d26,U+7d2a,U+7d2c-7d2e,U+7d31-7d32,U+7d35,U+7d3c-7d41,U+7d43,U+7d45,U+7d47-7d48,U+7d4b,U+7d4d-7d4f,U+7d51,U+7d53,U+7d55-7d56}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.25.woff2) format("woff2");unicode-range:U+7a17-7a19,U+7a1b,U+7a1e-7a21,U+7a27,U+7a2b,U+7a2d,U+7a2f-7a31,U+7a34-7a35,U+7a37-7a3b,U+7a3e,U+7a43-7a49,U+7a4c,U+7a4e,U+7a50,U+7a55-7a57,U+7a59,U+7a5c-7a5d,U+7a5f-7a63,U+7a65,U+7a67,U+7a69-7a6a,U+7a6d,U+7a70,U+7a75,U+7a78-7a79,U+7a7d-7a7e,U+7a80,U+7a82,U+7a84-7a86,U+7a88,U+7a8a-7a8b,U+7a90-7a91,U+7a94-7a98,U+7a9e,U+7aa0,U+7aa3,U+7aa9,U+7aac,U+7ab0,U+7ab3,U+7ab5-7ab6,U+7ab9-7abf,U+7ac3,U+7ac5-7aca,U+7acc-7acf,U+7ad1-7ad3,U+7ad5,U+7ada-7adb,U+7add,U+7adf,U+7ae1-7ae2,U+7ae6-7aed,U+7af0-7af1,U+7af4,U+7af8,U+7afa-7afb,U+7afd-7afe,U+7b02,U+7b04,U+7b06-7b08,U+7b0a-7b0b,U+7b0f,U+7b12,U+7b14,U+7b18-7b19,U+7b1e-7b1f,U+7b23,U+7b25,U+7b27-7b2b,U+7b2d-7b31,U+7b33-7b36,U+7b3b,U+7b3d,U+7b3f-7b41,U+7b45,U+7b47,U+7b4c-7b50,U+7b53,U+7b55,U+7b5d,U+7b60,U+7b64-7b66,U+7b69-7b6a,U+7b6c-7b75,U+7b77,U+7b79-7b7a,U+7b7f,U+7b84,U+7b86,U+7b89,U+7b8d-7b92,U+7b96,U+7b98-7ba0,U+7ba5,U+7bac-7bad,U+7baf-7bb0,U+7bb2,U+7bb4-7bb6,U+7bba-7bbd,U+7bc1-7bc2,U+7bc5-7bc6}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.26.woff2) format("woff2");unicode-range:U+7851-7852,U+785c,U+785e,U+7860-7861,U+7863-7864,U+7868,U+786a,U+786e-786f,U+7872,U+7874,U+787a,U+787c,U+787e,U+7886-7887,U+788a,U+788c-788f,U+7893-7895,U+7898,U+789a,U+789d-789f,U+78a1,U+78a3-78a4,U+78a8-78aa,U+78ac-78ad,U+78af-78b3,U+78b5,U+78bb-78bf,U+78c5-78cc,U+78ce,U+78d1-78d6,U+78da-78db,U+78df-78e1,U+78e4,U+78e6-78e7,U+78ea,U+78ec,U+78f2-78f4,U+78f6-78f7,U+78f9-78fb,U+78fd-7901,U+7906-7907,U+790c,U+7910-7912,U+7919-791c,U+791e-7920,U+7925-792e,U+7930-7931,U+7934-7935,U+793b,U+793d,U+793f,U+7941-7942,U+7944-7946,U+794a-794b,U+794f,U+7951,U+7954-7955,U+7957-7958,U+795a-795c,U+795f-7960,U+7962,U+7967,U+7969,U+796b,U+7972,U+7977,U+7979-797c,U+797e-7980,U+798a-798e,U+7991,U+7993-7996,U+7998,U+799b-799d,U+79a1,U+79a6-79ab,U+79ae-79b1,U+79b3-79b4,U+79b8-79bb,U+79bd-79be,U+79c2,U+79c4,U+79c7-79ca,U+79cc-79cd,U+79cf,U+79d4-79d6,U+79da,U+79dd-79e3,U+79e5,U+79e7,U+79ea-79ed,U+79f1,U+79f8,U+79fc,U+7a02-7a03,U+7a05,U+7a07-7a0a,U+7a0c-7a0d,U+7a11,U+7a15}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.27.woff2) format("woff2");unicode-range:U+768c-768e,U+7690,U+7693,U+7695-7696,U+7699-76a8,U+76aa,U+76ad,U+76af-76b0,U+76b4,U+76b6-76ba,U+76bd,U+76c1-76c3,U+76c5,U+76c8-76c9,U+76cb-76ce,U+76d2,U+76d4,U+76d6,U+76d9,U+76dc,U+76de,U+76e0-76e1,U+76e5-76e8,U+76ea-76ec,U+76f0-76f1,U+76f6,U+76f9,U+76fb-76fc,U+7700,U+7704,U+7706-7708,U+770a,U+770e,U+7712,U+7714-7715,U+7717,U+7719-771c,U+7722,U+7724-7726,U+7728,U+772d-772f,U+7734-7739,U+773d-773e,U+7742,U+7745-7747,U+774a,U+774d-774f,U+7752,U+7756-7758,U+775a-775c,U+775e-7760,U+7762,U+7764-7765,U+7767,U+776a-776c,U+7770,U+7772-7774,U+7779-777a,U+777c-7780,U+7784,U+778b-778e,U+7794-7796,U+779a,U+779e-77a0,U+77a2,U+77a4-77a5,U+77a7,U+77a9-77aa,U+77ae-77b1,U+77b5-77b7,U+77b9,U+77bb-77bf,U+77c3,U+77c7,U+77c9,U+77cd,U+77d1-77d2,U+77d5,U+77d7,U+77d9-77da,U+77dc,U+77de-77e0,U+77e3-77e4,U+77e6-77e7,U+77e9-77ea,U+77ec,U+77ee,U+77f0-77f1,U+77f4,U+77f8,U+77fb-77fc,U+7805-7806,U+7809,U+780c-780e,U+7811-7812,U+7819,U+781d,U+7820-7823,U+7826-7827,U+782c-782e,U+7830,U+7835,U+7837,U+783a,U+783f,U+7843-7845,U+7847-7848,U+784c,U+784e-784f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.28.woff2) format("woff2");unicode-range:U+7511-7513,U+7515-7517,U+751c,U+751e,U+7520-7522,U+7524,U+7526-7527,U+7529-752c,U+752f,U+7536,U+7538-7539,U+753c-7540,U+7543-7544,U+7546-754b,U+754d-7550,U+7552,U+7557,U+755a-755b,U+755d-755f,U+7561-7562,U+7564,U+7566-7567,U+7569,U+756b-756d,U+756f,U+7571-7572,U+7574-757e,U+7581-7582,U+7585-7587,U+7589-758c,U+758f-7590,U+7592-7595,U+7599-759a,U+759c-759d,U+75a2-75a5,U+75b0-75b1,U+75b3-75b5,U+75b7-75b8,U+75ba,U+75bd,U+75bf-75c4,U+75c6,U+75ca,U+75cc-75cf,U+75d3-75d4,U+75d7-75d8,U+75dc-75e1,U+75e3-75e4,U+75e7,U+75ec,U+75ee-75f3,U+75f9,U+75fc,U+75fe-7604,U+7607-760c,U+760f,U+7612-7613,U+7615-7616,U+7618-7619,U+761b-7629,U+762d,U+7630,U+7632-7635,U+7638-763c,U+7640-7641,U+7643-764b,U+764e,U+7655,U+7658-7659,U+765c,U+765f,U+7661-7662,U+7664-7665,U+7667-766a,U+766c-7672,U+7674,U+7676,U+7678,U+7680-7683,U+7685,U+7688,U+768b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.29.woff2) format("woff2");unicode-range:U+736c,U+736e-7371,U+7375,U+7377-737c,U+7380-7381,U+7383,U+7385-7386,U+738a,U+738e,U+7390,U+7393-7398,U+739c,U+739e-73a0,U+73a2,U+73a5-73a6,U+73a8,U+73aa-73ab,U+73ad,U+73b3,U+73b5,U+73b7,U+73b9-73bd,U+73bf,U+73c5-73c6,U+73c9-73cc,U+73ce-73cf,U+73d2-73d3,U+73d6,U+73d9,U+73dd-73de,U+73e1,U+73e3-73e7,U+73e9-73ea,U+73ee,U+73f1,U+73f4-73f5,U+73f7-73fb,U+73fd,U+73ff-7401,U+7404-7405,U+7407,U+740a,U+7411,U+7413,U+741a-741b,U+7421,U+7424,U+7426,U+7428-7431,U+7433,U+7439-743a,U+743f-7441,U+7443-7444,U+7446-7447,U+744b,U+744d,U+7451-7453,U+7455,U+7457,U+7459-745a,U+745c-745d,U+745f,U+7462-7464,U+7466-746b,U+746d-7473,U+7476,U+747e,U+7480-7481,U+7485-7489,U+748b,U+748f-7492,U+7497-749a,U+749c,U+749e-74a3,U+74a5-74a6,U+74a8-74ab,U+74ae-74af,U+74b1-74b2,U+74b5,U+74b9-74bb,U+74bd,U+74bf,U+74c8-74ca,U+74cc,U+74cf-74d0,U+74d3-74d4,U+74d6,U+74d8,U+74da-74db,U+74de-74e0,U+74e3-74e4,U+74e7-74eb,U+74ee-74f2,U+74f4,U+74f7-74f8,U+74fa-74fc,U+74ff,U+7501,U+7503-7506,U+750c-750e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.30.woff2) format("woff2");unicode-range:U+7166,U+7168,U+716c,U+7179,U+7180,U+7184-7185,U+7187-7188,U+718c,U+718f,U+7192,U+7194-7196,U+7199-719b,U+71a0,U+71a2,U+71a8,U+71ac,U+71ae-71b0,U+71b2-71b3,U+71b9-71ba,U+71be-71c1,U+71c4,U+71c9,U+71cb-71cc,U+71ce,U+71d0,U+71d2-71d4,U+71d6-71d7,U+71d9-71da,U+71dc,U+71df-71e0,U+71e6-71e7,U+71ec-71ee,U+71f4-71f5,U+71f8-71f9,U+71fc,U+71fe-7200,U+7207-7209,U+720d,U+7210,U+7213,U+7215,U+7217,U+721a,U+721d,U+721f,U+7224,U+7228,U+722b,U+722d,U+722f-7230,U+7232,U+7234,U+7238-7239,U+723b-723c,U+723e-7243,U+7245-7246,U+724b,U+724e-7250,U+7252-7253,U+7255-7258,U+725a,U+725c,U+725e,U+7260,U+7263,U+7268,U+726b,U+726e-726f,U+7271,U+7274,U+7277-7278,U+727b-727c,U+727e-7282,U+7284,U+7287,U+7289,U+728d-728e,U+7292-7293,U+7296,U+729b,U+72a2,U+72a7-72a8,U+72ad-72ae,U+72b0-72b2,U+72b4,U+72b9,U+72be,U+72c0-72c1,U+72c3-72c4,U+72c6-72c7,U+72c9,U+72cc,U+72ce,U+72d2,U+72d5-72d6,U+72d8,U+72df-72e2,U+72e5,U+72f3-72f4,U+72f7,U+72f9-72fb,U+72fd-72fe,U+7302,U+7304-7305,U+7307,U+730a-730b,U+730d,U+7312-7313,U+7316-7319,U+731c-731e,U+7322,U+7324,U+7327-7329,U+732c,U+732f,U+7331-7337,U+7339-733b,U+733d-733e,U+7343,U+734d-7350,U+7352,U+7356-7358,U+735d-7360,U+7366-736b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.31.woff2) format("woff2");unicode-range:U+6f58-6f5b,U+6f5d-6f5e,U+6f60-6f62,U+6f66,U+6f68,U+6f6c-6f6d,U+6f6f,U+6f74,U+6f78,U+6f7a,U+6f7c-6f7e,U+6f80,U+6f82-6f83,U+6f86-6f88,U+6f8b-6f8e,U+6f90-6f94,U+6f96-6f98,U+6f9a,U+6f9d,U+6f9f-6fa1,U+6fa3,U+6fa5-6fa8,U+6fae-6fb1,U+6fb3,U+6fb5-6fb7,U+6fb9,U+6fbc,U+6fbe,U+6fc2,U+6fc5-6fca,U+6fd4-6fd5,U+6fd8,U+6fda-6fdb,U+6fde-6fe0,U+6fe4,U+6fe8-6fe9,U+6feb-6fec,U+6fee,U+6ff0,U+6ff3,U+6ff5-6ff6,U+6ff9-6ffa,U+6ffc-6ffe,U+7000-7001,U+7005-7007,U+7009-700b,U+700d,U+700f,U+7011,U+7015,U+7017-7018,U+701a-701b,U+701d-7020,U+7023,U+7026,U+7028,U+702f-7030,U+7032,U+7034,U+7037,U+7039-703a,U+703c,U+703e,U+7043-7044,U+7047-704c,U+704e,U+7051,U+7054-7055,U+705d-705e,U+7064-7065,U+7069,U+706c,U+706e,U+7075-7076,U+707e,U+7081,U+7085-7086,U+7094-7098,U+709b,U+709f,U+70a4,U+70ab-70ac,U+70ae-70b1,U+70b3-70b4,U+70b7,U+70bb,U+70ca-70cb,U+70d1,U+70d3-70d6,U+70d8-70d9,U+70dc-70dd,U+70df,U+70e4,U+70ec,U+70f1,U+70fa,U+70fd,U+7103-7108,U+710b-710c,U+710f,U+7114,U+7119,U+711c,U+711e,U+7120,U+712b,U+712d-7131,U+7138,U+7141,U+7145-7147,U+7149-714b,U+7150-7153,U+7155-7157,U+715a,U+715c,U+715e,U+7160,U+7162,U+7164-7165}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.32.woff2) format("woff2");unicode-range:U+6d7c,U+6d80-6d82,U+6d85,U+6d87,U+6d89-6d8a,U+6d8c-6d8e,U+6d91-6d98,U+6d9c,U+6daa-6dac,U+6dae,U+6db4-6db5,U+6db7-6db9,U+6dbd,U+6dbf,U+6dc2,U+6dc4-6dc8,U+6dca,U+6dcc,U+6dce-6dd0,U+6dd2,U+6dd5-6dd6,U+6dd8-6ddb,U+6ddd-6de0,U+6de2,U+6de4-6de6,U+6de8-6dea,U+6dec,U+6dee-6df0,U+6df2,U+6df4,U+6df6,U+6df8-6dfa,U+6dfc,U+6e00,U+6e04,U+6e0a,U+6e17,U+6e19,U+6e1d-6e20,U+6e22-6e25,U+6e27,U+6e2b,U+6e2d-6e2e,U+6e32,U+6e34,U+6e36,U+6e38-6e3c,U+6e42-6e45,U+6e48-6e49,U+6e4b-6e4f,U+6e51-6e54,U+6e57,U+6e5b-6e5f,U+6e62-6e63,U+6e68,U+6e6b,U+6e6e,U+6e72-6e73,U+6e76,U+6e7b,U+6e7d,U+6e82,U+6e89,U+6e8c-6e8d,U+6e8f,U+6e93,U+6e98-6e99,U+6e9f-6ea0,U+6ea5,U+6ea7,U+6eaa-6eab,U+6ead-6eaf,U+6eb1-6eb4,U+6eb7,U+6ebb-6ebd,U+6ebf-6ec4,U+6ec7-6eca,U+6ecc-6ecf,U+6ed3-6ed5,U+6ed9-6edb,U+6ee6,U+6eeb-6eef,U+6ef7-6ef9,U+6efb,U+6efd-6eff,U+6f04,U+6f08-6f0a,U+6f0c-6f0d,U+6f10-6f11,U+6f13,U+6f15-6f16,U+6f18,U+6f1a-6f1b,U+6f25-6f26,U+6f29-6f2a,U+6f2d,U+6f2f-6f33,U+6f35-6f36,U+6f38,U+6f3b-6f3c,U+6f3e-6f3f,U+6f41,U+6f45,U+6f4f,U+6f51-6f53,U+6f57}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.33.woff2) format("woff2");unicode-range:U+6b85,U+6b89,U+6b8d,U+6b95,U+6b97-6b98,U+6b9b,U+6b9e-6ba0,U+6ba2-6ba4,U+6ba8-6bb3,U+6bb7-6bb9,U+6bbc-6bbe,U+6bc0,U+6bc3-6bc4,U+6bc6-6bc9,U+6bcb-6bcc,U+6bcf,U+6bd3,U+6bd6-6bd8,U+6bda,U+6bdf,U+6be1,U+6be3,U+6be6-6be7,U+6beb-6bec,U+6bee,U+6bf1,U+6bf3,U+6bf7,U+6bf9,U+6bff,U+6c02,U+6c04-6c05,U+6c08-6c0a,U+6c0d-6c0e,U+6c10,U+6c12-6c14,U+6c19,U+6c1b,U+6c1f,U+6c24,U+6c26-6c28,U+6c2c,U+6c2e,U+6c33,U+6c35-6c36,U+6c3a-6c3b,U+6c3e-6c40,U+6c4a-6c4b,U+6c4d,U+6c4f,U+6c52,U+6c54-6c55,U+6c59,U+6c5b-6c5e,U+6c62,U+6c67-6c68,U+6c6a-6c6b,U+6c6d,U+6c6f,U+6c73-6c74,U+6c76,U+6c78-6c79,U+6c7b,U+6c7e,U+6c81-6c87,U+6c89,U+6c8c-6c8d,U+6c90,U+6c92-6c95,U+6c97-6c98,U+6c9a-6c9c,U+6c9f,U+6caa-6cae,U+6cb0-6cb2,U+6cb4,U+6cba,U+6cbd-6cbe,U+6cc2,U+6cc5-6cc6,U+6ccd,U+6ccf-6cd4,U+6cd6-6cd7,U+6cd9-6cdd,U+6ce0,U+6ce7,U+6ce9-6cef,U+6cf1-6cf2,U+6cf4,U+6cfb,U+6d00-6d01,U+6d04,U+6d07,U+6d0a,U+6d0c,U+6d0e-6d0f,U+6d11,U+6d13,U+6d19-6d1a,U+6d1f,U+6d24,U+6d26-6d28,U+6d2b,U+6d2e-6d2f,U+6d31,U+6d33-6d36,U+6d38-6d39,U+6d3c-6d3d,U+6d3f,U+6d57-6d5b,U+6d5e-6d61,U+6d64-6d65,U+6d67,U+6d6c,U+6d6f-6d70,U+6d79}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.34.woff2) format("woff2");unicode-range:U+69dd-69de,U+69e2-69e3,U+69e5,U+69e7-69eb,U+69ed-69ef,U+69f1-69f6,U+69f9,U+69fe-6a01,U+6a03,U+6a05,U+6a0a,U+6a0c,U+6a0f,U+6a11-6a15,U+6a17,U+6a1a-6a1b,U+6a1d-6a20,U+6a22-6a24,U+6a28,U+6a2e,U+6a30,U+6a32-6a38,U+6a3b,U+6a3e-6a3f,U+6a44-6a4a,U+6a4e,U+6a50-6a52,U+6a54-6a56,U+6a5b,U+6a61-6a62,U+6a64,U+6a66-6a67,U+6a6a-6a6b,U+6a71-6a73,U+6a78,U+6a7a,U+6a7e-6a7f,U+6a81,U+6a83-6a84,U+6a86-6a87,U+6a89,U+6a8b,U+6a8d,U+6a90-6a91,U+6a94,U+6a97,U+6a9b,U+6a9d-6aa3,U+6aa5,U+6aaa-6aac,U+6aae-6ab1,U+6ab3-6ab4,U+6ab8,U+6abb,U+6abd-6abf,U+6ac1-6ac3,U+6ac6,U+6ac8-6ac9,U+6acc,U+6ad0-6ad1,U+6ad3-6ad6,U+6ada-6adf,U+6ae2,U+6ae4,U+6ae7-6ae8,U+6aea,U+6aec,U+6af0-6af3,U+6af8,U+6afa,U+6afc-6afd,U+6b02-6b03,U+6b06-6b07,U+6b09-6b0b,U+6b0f-6b12,U+6b16-6b17,U+6b1b,U+6b1d-6b1f,U+6b23-6b24,U+6b28,U+6b2b-6b2c,U+6b2f,U+6b35-6b39,U+6b3b,U+6b3d,U+6b3f,U+6b43,U+6b46-6b47,U+6b49-6b4a,U+6b4d-6b4e,U+6b50,U+6b52,U+6b54,U+6b56,U+6b58-6b59,U+6b5b,U+6b5d,U+6b5f-6b61,U+6b65,U+6b67,U+6b6b-6b6c,U+6b6e,U+6b70,U+6b72,U+6b75,U+6b77-6b7a,U+6b7d-6b84}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.35.woff2) format("woff2");unicode-range:U+6855,U+6857-6859,U+685b,U+685d,U+685f,U+6863,U+6867,U+686b,U+686e-6872,U+6874-6875,U+6877,U+6879-687c,U+687e-687f,U+6882-6884,U+6886,U+6888,U+688d-6890,U+6894,U+6896,U+6898-689c,U+689f-68a3,U+68a5-68a7,U+68a9-68ab,U+68ad-68af,U+68b2-68b5,U+68b9-68bc,U+68c3,U+68c5-68c6,U+68c8-68ca,U+68cc-68cd,U+68cf-68d1,U+68d3-68d9,U+68dc-68dd,U+68e0-68e1,U+68e3-68e5,U+68e7-68e8,U+68ea-68ed,U+68ef-68f1,U+68f5-68f7,U+68f9,U+68fb-68fd,U+6900-6901,U+6903-6904,U+6906-690c,U+690f-6911,U+6913,U+6916-6917,U+6919-691b,U+6921-6923,U+6925-6926,U+6928,U+692a,U+6930-6931,U+6933-6936,U+6938-6939,U+693b,U+693d,U+6942,U+6945-6946,U+6949,U+694e,U+6954,U+6957,U+6959,U+695b-695e,U+6961-6966,U+6968-696c,U+696e-6974,U+6977-697b,U+697e-6981,U+6986,U+698d,U+6991-6992,U+6994-6996,U+6998,U+699c,U+69a0-69a1,U+69a5-69a8,U+69ab,U+69ad,U+69af-69b2,U+69b4,U+69b7-69b8,U+69ba-69bc,U+69be-69c1,U+69c3,U+69c5,U+69c7-69c8,U+69ca,U+69ce-69d1,U+69d3,U+69d6-69d7,U+69d9}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.36.woff2) format("woff2");unicode-range:U+667e-6680,U+6683-6684,U+6688,U+668b-668e,U+6690,U+6692,U+6698-669d,U+669f-66a0,U+66a2,U+66a4,U+66ad,U+66b1-66b3,U+66b5,U+66b8-66b9,U+66bb-66bc,U+66be-66c4,U+66c6,U+66c8-66c9,U+66cc,U+66ce-66cf,U+66d4,U+66da-66db,U+66dd,U+66df-66e0,U+66e6,U+66e8-66e9,U+66eb-66ec,U+66ee,U+66f5,U+66f7,U+66fa-66fc,U+6701,U+6705,U+6707,U+670c,U+670e-6710,U+6712-6716,U+6719,U+671c,U+671e,U+6720,U+6722,U+6725-6726,U+672e,U+6733,U+6735-6738,U+673e-673f,U+6741,U+6743,U+6745-6748,U+674c-674d,U+6753-6755,U+6759,U+675d-675e,U+6760,U+6762-6764,U+6766,U+676a,U+676c,U+676e,U+6770,U+6772-6774,U+6776-6777,U+677b-677c,U+6780-6781,U+6784-6785,U+6787,U+6789,U+678b-678c,U+678e-678f,U+6791-6793,U+6796,U+6798-6799,U+679b,U+67a1,U+67a4,U+67a6,U+67a9,U+67b0-67b5,U+67b7-67b9,U+67bb-67be,U+67c0-67c3,U+67c5-67c6,U+67c8-67c9,U+67ce,U+67d2,U+67d7-67d9,U+67db-67de,U+67e1-67e2,U+67e4,U+67e6-67e7,U+67e9,U+67ec,U+67ee-67f0,U+67f2,U+67f6-67f7,U+67f9-67fa,U+67fc,U+67fe,U+6801-6802,U+6805,U+6810,U+6814,U+6818-6819,U+681d,U+681f,U+6822,U+6827-6829,U+682b-682d,U+682f-6834,U+683b,U+683e-6840,U+6844-6846,U+6849-684a,U+684c-684e,U+6852-6854}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.37.woff2) format("woff2");unicode-range:U+64d2,U+64d4-64d5,U+64d7-64d8,U+64da,U+64e0-64e1,U+64e3-64e5,U+64e7,U+64e9-64ea,U+64ed,U+64ef-64f2,U+64f4-64f7,U+64fa-64fb,U+64fd-6501,U+6504-6505,U+6508-650a,U+650f,U+6513-6514,U+6516,U+6518-6519,U+651b-651f,U+6522,U+6524,U+6526,U+6529-652c,U+652e,U+6531-6532,U+6534-6538,U+653a,U+653c-653d,U+6543-6544,U+6547-6549,U+654d-654e,U+6550,U+6552,U+6554-6556,U+6558,U+655d-6560,U+6567,U+656b,U+6572,U+6578,U+657a,U+657d,U+6581-6585,U+6588,U+658a,U+658c,U+6592,U+6595,U+6598,U+659b,U+659d,U+659f-65a1,U+65a3-65a6,U+65ab,U+65ae,U+65b2-65b5,U+65b7-65b8,U+65be-65bf,U+65c1-65c4,U+65c6,U+65c8-65c9,U+65cc,U+65ce,U+65d0,U+65d2,U+65d4,U+65d6,U+65d8-65d9,U+65db,U+65df-65e1,U+65e3,U+65f0-65f2,U+65f4-65f5,U+65f9,U+65fb-65fc,U+65fe-6600,U+6603-6604,U+6608-660a,U+660d,U+6611-6612,U+6615-6616,U+661c-661e,U+6621-6624,U+6626,U+6629-662c,U+662e,U+6630-6631,U+6633-6637,U+6639-663b,U+663f-6641,U+6644-6646,U+6648-664a,U+664c,U+664e-664f,U+6651,U+6657-6665,U+6667-6668,U+666a-666d,U+6670,U+6673,U+6675,U+6677-6679,U+667b-667c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.38.woff2) format("woff2");unicode-range:U+62cf,U+62d1,U+62d4-62d6,U+62da,U+62dc,U+62ea,U+62ee-62ef,U+62f1-62f2,U+62f4-62f5,U+62fc-62fd,U+62ff,U+6302-6304,U+6308-630d,U+6310,U+6313,U+6316,U+6318,U+631b,U+6327,U+6329-632a,U+632d,U+6332,U+6335-6336,U+6339-633c,U+633e,U+6341-6344,U+6346,U+634a-634e,U+6350,U+6352-6354,U+6358-6359,U+635b,U+6365-6366,U+6369,U+636b-636d,U+6371-6372,U+6374-6378,U+637a,U+637c-637d,U+637f-6380,U+6382,U+6384,U+6387,U+6389-638a,U+638e-6390,U+6394-6396,U+6399-639a,U+639e,U+63a0,U+63a3-63a4,U+63a6,U+63a9,U+63ab-63af,U+63b5,U+63bd-63be,U+63c0-63c1,U+63c4-63c6,U+63c8,U+63ce,U+63d1-63d6,U+63dc,U+63e0,U+63e3,U+63e5,U+63e9-63ed,U+63f2-63f3,U+63f5-63f9,U+6406,U+6409-640a,U+640f-6410,U+6412-6414,U+6416-6418,U+641e,U+6420,U+6422,U+6424-6426,U+6428-642a,U+642f-6430,U+6434-6436,U+643d,U+643f,U+644b,U+644e-644f,U+6451-6454,U+645a-645d,U+645f-6461,U+6463,U+6467,U+646d,U+6473-6474,U+6476,U+6478-6479,U+647b,U+647d,U+6485,U+6487-6488,U+648f-6491,U+6493,U+6495,U+6498-649b,U+649d-649f,U+64a1,U+64a3,U+64a6,U+64a8-64a9,U+64ac,U+64b3,U+64bb-64bf,U+64c2,U+64c4-64c5,U+64c7,U+64c9-64cc,U+64ce,U+64d0-64d1}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.39.woff2) format("woff2");unicode-range:U+6117,U+6119,U+611c,U+611e,U+6120-6122,U+6127-6128,U+612a-612c,U+6130-6131,U+6134-6137,U+6139-613a,U+613c-613f,U+6141-6142,U+6144-6147,U+6149-614a,U+614d,U+6153,U+6158-615a,U+615d-6160,U+6164-6165,U+616b-616c,U+616f,U+6171-6175,U+6177-6178,U+617b-6181,U+6183-6184,U+6187,U+618a-618b,U+618d,U+6192-6194,U+6196-619a,U+619c-619d,U+619f-61a0,U+61a5,U+61a8,U+61aa-61ae,U+61b8-61ba,U+61bc,U+61be,U+61c0-61c3,U+61c6,U+61c8,U+61ca-61cf,U+61d5,U+61dc-61df,U+61e1-61e3,U+61e5-61e9,U+61ec-61ed,U+61ef,U+61f4-61f7,U+61fa,U+61fc-6201,U+6203-6204,U+6207-620a,U+620d-620e,U+6213-6215,U+621b-621e,U+6220-6223,U+6227,U+6229-622b,U+622e,U+6230-6233,U+6236,U+6239,U+623d-623e,U+6241-6244,U+6246,U+6248,U+624c,U+624e,U+6250-6252,U+6254,U+6256,U+6258,U+625a-625c,U+625e,U+6260-6261,U+6263-6264,U+6268,U+626d,U+626f,U+6273,U+627a-627e,U+6282-6283,U+6285,U+6289,U+628d-6290,U+6292-6294,U+6296,U+6299,U+629b,U+62a6,U+62a8,U+62ac,U+62b3,U+62b6-62b7,U+62ba-62bb,U+62be-62bf,U+62c2,U+62c4,U+62c6-62c8,U+62ca,U+62ce}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.40.woff2) format("woff2");unicode-range:U+5f6c-5f6d,U+5f6f,U+5f72-5f75,U+5f78,U+5f7a,U+5f7d-5f7f,U+5f82-5f83,U+5f87-5f89,U+5f8d,U+5f8f,U+5f91,U+5f96,U+5f99,U+5f9c-5f9d,U+5fa0,U+5fa2,U+5fa4,U+5fa7-5fa8,U+5fab-5fad,U+5faf-5fb1,U+5fb5,U+5fb7-5fb8,U+5fbc-5fbd,U+5fc4,U+5fc7-5fc9,U+5fcb,U+5fd0-5fd4,U+5fdd-5fde,U+5fe1-5fe2,U+5fe4,U+5fe8-5fea,U+5fec-5ff3,U+5ff6,U+5ff8,U+5ffa-5ffd,U+5fff,U+6007,U+600a,U+600d-6010,U+6013-6015,U+6017-601b,U+601f,U+6021-6022,U+6024,U+6026,U+6029,U+602b,U+602d,U+6031,U+6033,U+6035,U+603a,U+6040-6043,U+6046-604a,U+604c-604d,U+6051,U+6054-6057,U+6059-605a,U+605d,U+605f-6064,U+6067,U+606a-606c,U+6070-6071,U+6077,U+607e-607f,U+6081-6086,U+6088-608e,U+6091-6093,U+6095-6098,U+609a-609b,U+609d-609e,U+60a2,U+60a4-60a5,U+60a7-60a8,U+60b0-60b1,U+60b3-60b5,U+60b7-60b8,U+60bb,U+60bd-60be,U+60c2,U+60c4,U+60c6-60cb,U+60ce-60cf,U+60d3-60d5,U+60d8-60d9,U+60db,U+60dd-60df,U+60e1-60e2,U+60e5,U+60ee,U+60f0-60f2,U+60f4-60f8,U+60fa-60fd,U+6100,U+6102-6103,U+6106-6108,U+610a,U+610c-610e,U+6110-6114,U+6116}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.41.woff2) format("woff2");unicode-range:U+5d9b,U+5d9d,U+5d9f-5da0,U+5da2,U+5da4,U+5da7,U+5dab-5dac,U+5dae,U+5db0,U+5db2,U+5db4,U+5db7-5db9,U+5dbc-5dbd,U+5dc3,U+5dc7,U+5dc9,U+5dcb-5dce,U+5dd0-5dd3,U+5dd6-5dd9,U+5ddb,U+5de0,U+5de2,U+5de4,U+5de9,U+5df2,U+5df5,U+5df8-5df9,U+5dfd,U+5dff-5e00,U+5e07,U+5e0b,U+5e0d,U+5e11-5e12,U+5e14-5e15,U+5e18-5e1b,U+5e1f-5e20,U+5e25,U+5e28,U+5e2e,U+5e32,U+5e35-5e37,U+5e3e,U+5e40,U+5e43-5e44,U+5e47,U+5e49,U+5e4b,U+5e4e,U+5e50-5e51,U+5e54,U+5e56-5e58,U+5e5b-5e5c,U+5e5e-5e5f,U+5e62,U+5e64,U+5e68,U+5e6a-5e6e,U+5e70,U+5e75-5e77,U+5e7a,U+5e7f-5e80,U+5e87,U+5e8b,U+5e8e,U+5e96,U+5e99-5e9a,U+5ea0,U+5ea2,U+5ea4-5ea5,U+5ea8,U+5eaa,U+5eac,U+5eb1,U+5eb3,U+5eb8-5eb9,U+5ebd-5ebf,U+5ec1-5ec2,U+5ec6,U+5ec8,U+5ecb-5ecc,U+5ece-5ed6,U+5ed9-5ee2,U+5ee5,U+5ee8-5ee9,U+5eeb-5eec,U+5ef0-5ef1,U+5ef3-5ef4,U+5ef8-5ef9,U+5efc-5f00,U+5f02-5f03,U+5f06-5f09,U+5f0b-5f0e,U+5f11,U+5f16-5f17,U+5f19,U+5f1b-5f1e,U+5f21-5f24,U+5f27-5f29,U+5f2b-5f30,U+5f34,U+5f36,U+5f38,U+5f3a-5f3d,U+5f3f-5f41,U+5f44-5f45,U+5f47-5f48,U+5f4a,U+5f4c-5f4e,U+5f50-5f51,U+5f54,U+5f56-5f58,U+5f5b-5f5d,U+5f60,U+5f63-5f65,U+5f67,U+5f6a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.42.woff2) format("woff2");unicode-range:U+5bbc,U+5bc0-5bc1,U+5bc3,U+5bc7,U+5bc9,U+5bcd-5bd0,U+5bd3-5bd4,U+5bd6-5bda,U+5bde,U+5be0-5be2,U+5be4-5be6,U+5be8,U+5beb-5bec,U+5bef-5bf1,U+5bf3-5bf6,U+5bfd,U+5c03,U+5c05,U+5c07-5c09,U+5c0c-5c0d,U+5c12-5c14,U+5c17,U+5c19,U+5c1e-5c20,U+5c22-5c24,U+5c26,U+5c28-5c2e,U+5c30,U+5c32,U+5c35-5c36,U+5c38-5c39,U+5c46,U+5c4d-5c50,U+5c53,U+5c59-5c5c,U+5c5f-5c63,U+5c67-5c69,U+5c6c-5c70,U+5c74-5c76,U+5c79-5c7d,U+5c87-5c88,U+5c8a,U+5c8c,U+5c8f,U+5c91-5c92,U+5c94,U+5c9d,U+5c9f-5ca0,U+5ca2-5ca3,U+5ca6-5ca8,U+5caa-5cab,U+5cad,U+5cb1-5cb2,U+5cb4-5cb7,U+5cba-5cbc,U+5cbe,U+5cc5,U+5cc7,U+5cc9,U+5ccb,U+5cd0,U+5cd2,U+5cd7,U+5cd9,U+5cdd,U+5ce6,U+5ce8-5cea,U+5ced-5cee,U+5cf1-5cf2,U+5cf4-5cf5,U+5cfa-5cfb,U+5cfd,U+5d01,U+5d06,U+5d0b,U+5d0d,U+5d10-5d12,U+5d14-5d15,U+5d17-5d1b,U+5d1d,U+5d1f-5d20,U+5d22-5d24,U+5d26-5d27,U+5d2b,U+5d31,U+5d34,U+5d39,U+5d3d,U+5d3f,U+5d42-5d43,U+5d46-5d48,U+5d4a-5d4b,U+5d4e,U+5d51-5d53,U+5d55,U+5d59,U+5d5c,U+5d5f-5d62,U+5d64,U+5d69-5d6a,U+5d6c-5d6d,U+5d6f-5d70,U+5d73,U+5d76,U+5d79-5d7a,U+5d7e-5d7f,U+5d81-5d84,U+5d87-5d88,U+5d8a,U+5d8c,U+5d90,U+5d92-5d95,U+5d97,U+5d99}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.43.woff2) format("woff2");unicode-range:U+598b-598e,U+5992,U+5995,U+5997,U+599b,U+599d,U+599f,U+59a3-59a4,U+59a7,U+59ad-59b0,U+59b2-59b3,U+59b7,U+59ba,U+59bc,U+59be,U+59c1,U+59c3-59c4,U+59c6,U+59c8,U+59ca,U+59cd,U+59d2,U+59d9-59da,U+59dd-59df,U+59e3-59e5,U+59e7-59e8,U+59ec,U+59ee-59ef,U+59f1-59f2,U+59f4,U+59f6-59f8,U+5a00,U+5a03-5a04,U+5a09,U+5a0c-5a0e,U+5a11-5a13,U+5a17,U+5a1a-5a1c,U+5a1e-5a1f,U+5a23-5a25,U+5a27-5a28,U+5a2a,U+5a2d,U+5a30,U+5a35-5a36,U+5a40-5a41,U+5a44-5a45,U+5a47-5a49,U+5a4c,U+5a50,U+5a55,U+5a5e,U+5a62-5a63,U+5a65,U+5a67,U+5a6a,U+5a6c-5a6d,U+5a77,U+5a7a-5a7b,U+5a7e,U+5a84,U+5a8b,U+5a90,U+5a93,U+5a96,U+5a99,U+5a9c,U+5a9e-5aa0,U+5aa2,U+5aa7,U+5aac,U+5ab1-5ab3,U+5ab5,U+5ab8,U+5aba-5abf,U+5ac2,U+5ac4,U+5ac6,U+5ac8,U+5acb,U+5acf-5ad0,U+5ad6-5ad7,U+5ada,U+5adc,U+5ae0-5ae1,U+5ae3,U+5ae5-5ae6,U+5ae9-5aea,U+5aee,U+5af0,U+5af5-5af6,U+5afa-5afb,U+5afd,U+5b00-5b01,U+5b08,U+5b0b,U+5b16-5b17,U+5b19,U+5b1b,U+5b1d,U+5b21,U+5b25,U+5b2a,U+5b2c-5b2d,U+5b30,U+5b32,U+5b34,U+5b36,U+5b38,U+5b3e,U+5b40-5b41,U+5b43,U+5b45,U+5b4b-5b4c,U+5b51-5b52,U+5b56,U+5b5a-5b5c,U+5b5e-5b5f,U+5b65,U+5b68-5b69,U+5b6e-5b71,U+5b73,U+5b75-5b76,U+5b7a,U+5b7c-5b84,U+5b86,U+5b8a-5b8b,U+5b8d-5b8e,U+5b90-5b91,U+5b93-5b94,U+5b96,U+5ba5-5ba6,U+5ba8-5ba9,U+5bac-5bad,U+5baf,U+5bb1-5bb2,U+5bb7-5bb8,U+5bba}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.44.woff2) format("woff2");unicode-range:U+57b3,U+57b8,U+57bd,U+57c0,U+57c3,U+57c6-57c8,U+57cc,U+57cf,U+57d2-57d7,U+57dc-57de,U+57e0-57e1,U+57e3-57e4,U+57e6-57e7,U+57e9,U+57ed,U+57f0,U+57f4-57f6,U+57f8,U+57fb,U+57fd-57ff,U+5803-5804,U+5808-580d,U+5819,U+581b,U+581d-5821,U+5826-5827,U+582d,U+582f-5830,U+5832,U+5835,U+5839,U+583d,U+583f-5840,U+5849,U+584b-584d,U+584f-5852,U+5855,U+5858-5859,U+585f,U+5861-5862,U+5864,U+5867-5868,U+586d,U+5870,U+5872,U+5878-5879,U+587c,U+587f-5881,U+5885,U+5887-588d,U+588f-5890,U+5894,U+5896,U+5898,U+589d-589e,U+58a0-58a2,U+58a6,U+58a9-58ab,U+58ae,U+58b1-58b3,U+58b8-58bc,U+58be,U+58c2-58c5,U+58c8,U+58cd-58ce,U+58d0-58da,U+58dc-58e2,U+58e4-58e5,U+58e9,U+58ec,U+58ef,U+58f3-58f4,U+58f7,U+58f9,U+58fb-58fd,U+5902,U+5905-5906,U+590a-590d,U+5910,U+5912-5914,U+5918-5919,U+591b,U+591d,U+591f,U+5921,U+5923-5925,U+5928,U+592c-592d,U+592f-5930,U+5932-5933,U+5935-5936,U+5938-5939,U+593d-593f,U+5943,U+5946,U+594e,U+5950,U+5952-5953,U+5955,U+5957-595b,U+595d-5961,U+5963,U+5967,U+5969,U+596b-596d,U+596f,U+5972,U+5975-5976,U+5978-5979,U+597b-597c,U+5981}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.45.woff2) format("woff2");unicode-range:U+5616-5617,U+5619,U+561b,U+5620,U+5628,U+562c,U+562f-5639,U+563b-563d,U+563f-5641,U+5643-5644,U+5646-5647,U+5649,U+564b,U+564d-5650,U+5653-5654,U+565e,U+5660-5664,U+5666,U+5669-566d,U+566f,U+5671-5672,U+5675-5676,U+5678,U+567a,U+5680,U+5684-5688,U+568a-568c,U+568f,U+5694-5695,U+5699-569a,U+569d-56a0,U+56a5-56a9,U+56ab-56ae,U+56b1-56b4,U+56b6-56b7,U+56bc,U+56be,U+56c0,U+56c2-56c3,U+56c5,U+56c8-56d1,U+56d3,U+56d7-56d9,U+56dc-56dd,U+56df,U+56e1,U+56e4-56e8,U+56eb,U+56ed-56ee,U+56f1,U+56f6-56f7,U+56f9,U+56ff-5704,U+5707-570a,U+570c-570d,U+5711,U+5713,U+5715-5716,U+5718,U+571a-571d,U+5720-5726,U+5729-572a,U+572c,U+572e-572f,U+5733-5734,U+5737-5738,U+573b,U+573d-573f,U+5745-5746,U+574c-574f,U+5751-5752,U+5759,U+575f,U+5761-5762,U+5764-5765,U+5767-5769,U+576b,U+576d-5771,U+5773-5775,U+5777,U+5779-577c,U+577e-577f,U+5781,U+5783,U+5788-5789,U+578c,U+5793-5795,U+5797,U+5799-579a,U+579c-57a1,U+57a4,U+57a7-57aa,U+57ac,U+57ae,U+57b0}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.46.woff2) format("woff2");unicode-range:U+543f-5440,U+5443-5444,U+5447,U+544c-544f,U+5455,U+545e,U+5462,U+5464,U+5466-5467,U+5469,U+546b-546e,U+5470-5471,U+5474-5477,U+547b,U+547f-5481,U+5483-5486,U+5488-548b,U+548d-5492,U+5495-5496,U+549c,U+549f-54a2,U+54a4,U+54a6-54af,U+54b1,U+54b7-54bc,U+54be-54bf,U+54c2-54c4,U+54c6-54c8,U+54ca,U+54cd-54ce,U+54d8,U+54e0,U+54e2,U+54e5-54e6,U+54e8-54ea,U+54ec-54ef,U+54f1,U+54f3,U+54f6,U+54fc-5501,U+5505,U+5508-5509,U+550c-550f,U+5514-5516,U+5527,U+552a-552b,U+552e,U+5532-5533,U+5535-5536,U+5538-5539,U+553b-553d,U+5540-5541,U+5544-5545,U+5547,U+5549-554a,U+554c-554d,U+5550-5551,U+5556-5558,U+555a-555e,U+5560-5561,U+5563-5564,U+5566,U+557b-5583,U+5586-5588,U+558a,U+558e-558f,U+5591-5594,U+5597,U+5599,U+559e-559f,U+55a3-55a4,U+55a8-55a9,U+55ac-55ae,U+55b2,U+55bf,U+55c1,U+55c3-55c4,U+55c6-55c7,U+55c9,U+55cb-55cc,U+55ce,U+55d1-55d4,U+55d7-55d8,U+55da-55db,U+55dd-55df,U+55e2,U+55e4,U+55e9,U+55ec,U+55ee,U+55f1,U+55f6-55f9,U+55fd-55ff,U+5605,U+5607-5608,U+560a,U+560d-5612}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.47.woff2) format("woff2");unicode-range:U+528d,U+5291-5298,U+529a,U+529c,U+52a4-52a7,U+52ab-52ad,U+52af-52b0,U+52b5-52b8,U+52ba-52be,U+52c0-52c1,U+52c4-52c6,U+52c8,U+52ca,U+52cc-52cd,U+52cf-52d2,U+52d4,U+52d6-52d7,U+52db-52dc,U+52de,U+52e0-52e1,U+52e3,U+52e5-52e6,U+52e8-52ea,U+52ec,U+52f0-52f1,U+52f3-52fb,U+5300-5301,U+5303,U+5306-5308,U+530a-530d,U+530f-5311,U+5313,U+5315,U+5318-531f,U+5321,U+5323-5325,U+5327-532d,U+532f-5333,U+5335,U+5338,U+533c-533e,U+5340,U+5342,U+5345-5346,U+5349,U+534b-534c,U+5359,U+535b,U+535e,U+5361,U+5363-5367,U+5369,U+536c-536e,U+5372,U+5377,U+5379-537b,U+537d-537f,U+5382-5383,U+5387-5389,U+538e,U+5393-5394,U+5396,U+5398-5399,U+539d,U+53a0-53a1,U+53a4-53a6,U+53a9-53ab,U+53ad-53b0,U+53b2,U+53b4-53b8,U+53ba,U+53bd,U+53c0-53c1,U+53c3-53c5,U+53cf,U+53d2-53d3,U+53d5,U+53da-53db,U+53dd-53e0,U+53e2,U+53e6-53e8,U+53ed-53ee,U+53f4-53f5,U+53fa,U+5401-5403,U+540b,U+540f,U+5412-5413,U+541a,U+541d-541e,U+5421,U+5424,U+5427-542a,U+542c-542f,U+5431,U+5433-5436,U+543c-543d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.48.woff2) format("woff2");unicode-range:U+50dd-50df,U+50e1-50e6,U+50e8-50e9,U+50ed-50f6,U+50f9-50fb,U+50fe,U+5101-5103,U+5106-5109,U+510b-510e,U+5110,U+5112,U+5114-511e,U+5121,U+5123,U+5127-5128,U+512c-512d,U+512f,U+5131,U+5133-5135,U+5137-513c,U+513f-5142,U+5147,U+514a,U+514c,U+514f,U+5152-5155,U+5157-5158,U+515f-5160,U+5162,U+5164,U+5166-5167,U+5169-516a,U+516e,U+5173-5174,U+5179,U+517b,U+517e,U+5180,U+5182-5184,U+5189,U+518b-518c,U+518e-5191,U+5193,U+5195-5196,U+5198,U+519d,U+51a1-51a4,U+51a6,U+51a9-51ab,U+51ad,U+51b0-51b3,U+51b5,U+51b8,U+51ba,U+51bc-51bf,U+51c2-51c3,U+51c5,U+51c8-51cb,U+51cf,U+51d1-51d6,U+51d8,U+51de-51e0,U+51e2,U+51e5,U+51e7,U+51e9,U+51ec-51ee,U+51f2-51f5,U+51f7,U+51fe,U+5201-5202,U+5204-5205,U+520b,U+520e,U+5212-5216,U+5218,U+5222,U+5226-5228,U+522a-522b,U+522e,U+5231-5233,U+5235,U+523c,U+5244-5245,U+5249,U+524b-524c,U+524f,U+5254-5255,U+5257-5258,U+525a,U+525c-5261,U+5266,U+5269,U+526c,U+526e,U+5271,U+5273-5274,U+5277-5279,U+527d,U+527f-5280,U+5282-5285,U+5288-528a,U+528c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.49.woff2) format("woff2");unicode-range:U+4f57-4f58,U+4f5a-4f5b,U+4f5d-4f5f,U+4f63-4f64,U+4f69-4f6a,U+4f6c,U+4f6e-4f71,U+4f76-4f7e,U+4f81-4f85,U+4f88-4f8a,U+4f8c,U+4f8e-4f90,U+4f92-4f94,U+4f96-4f9a,U+4f9e-4fa0,U+4fab,U+4fad,U+4faf,U+4fb2,U+4fb7,U+4fb9,U+4fbb-4fbe,U+4fc0-4fc1,U+4fc4-4fc6,U+4fc8-4fc9,U+4fcb-4fd4,U+4fd8,U+4fda-4fdc,U+4fdf-4fe0,U+4fe2,U+4fe4-4fe6,U+4fef-4ff2,U+4ff6,U+4ffc-5002,U+5004-5007,U+500a,U+500c,U+500e-5011,U+5013-5014,U+5016-5018,U+501a-501e,U+5021-5023,U+5025-502a,U+502c-502e,U+5030,U+5032-5033,U+5035,U+5039,U+503b,U+5040-5043,U+5045-5048,U+504a,U+504c,U+504e,U+5050-5053,U+5055-5057,U+5059-505a,U+505f-5060,U+5062-5063,U+5066-5067,U+506a,U+506c-506d,U+5070-5072,U+5077-5078,U+5080-5081,U+5083-5086,U+5088,U+508a,U+508e-5090,U+5092-5096,U+509a-509c,U+509e-50a3,U+50aa,U+50ad,U+50af-50b4,U+50b9-50bb,U+50bd,U+50c0,U+50c2-50c4,U+50c7,U+50c9-50ca,U+50cc,U+50ce,U+50d0-50d1,U+50d3-50d4,U+50d6,U+50d8-50d9,U+50dc}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.50.woff2) format("woff2");unicode-range:U+4093,U+4103,U+4105,U+4148,U+414f,U+4163,U+41b4,U+41bf,U+41e6,U+41ee,U+41f3,U+4207,U+420e,U+4264,U+4293,U+42c6,U+42d6,U+42dd,U+4302,U+432b,U+4343,U+43ee,U+43f0,U+4408,U+440c,U+4417,U+441c,U+4422,U+4453,U+445b,U+4476,U+447a,U+4491,U+44b3,U+44be,U+44d4,U+4508,U+450d,U+4525,U+4543,U+457a,U+459d,U+45b8,U+45be,U+45e5,U+45ea,U+460f-4610,U+4641,U+4665,U+46a1,U+46ae-46af,U+470c,U+471f,U+4764,U+47e6,U+47fd,U+4816,U+481e,U+4844,U+484e,U+48b5,U+49b0,U+49e7,U+49fa,U+4a04,U+4a29,U+4abc,U+4b38,U+4b3b,U+4b7e,U+4bc2,U+4bca,U+4bd2,U+4be8,U+4c17,U+4c20,U+4c38,U+4cc4,U+4cd1,U+4ce1,U+4d07,U+4d77,U+4e02,U+4e04-4e05,U+4e0c,U+4e0f-4e12,U+4e15,U+4e17,U+4e19,U+4e1e-4e1f,U+4e23-4e24,U+4e28-4e2c,U+4e2e-4e31,U+4e35-4e37,U+4e3f-4e42,U+4e44,U+4e47-4e48,U+4e4d-4e4e,U+4e51,U+4e55-4e56,U+4e58,U+4e5a-4e5c,U+4e62-4e63,U+4e68-4e69,U+4e74-4e75,U+4e79,U+4e7f,U+4e82,U+4e85,U+4e8a,U+4e8d-4e8e,U+4e96-4e99,U+4e9d-4ea0,U+4ea2,U+4ea5-4ea6,U+4ea8,U+4eaf-4eb0,U+4eb3,U+4eb6,U+4eb9,U+4ebb-4ebc,U+4ec2-4ec4,U+4ec6-4ec8,U+4ecd,U+4ed0,U+4ed7,U+4eda-4edb,U+4edd-4ee2,U+4ee8,U+4eeb,U+4eed,U+4eef,U+4ef1,U+4ef3,U+4ef5,U+4ef7,U+4efc-4f00,U+4f02-4f03,U+4f08-4f09,U+4f0b-4f0d,U+4f12,U+4f15-4f17,U+4f19,U+4f1c,U+4f2b,U+4f2e,U+4f30-4f31,U+4f33,U+4f35-4f37,U+4f39,U+4f3b,U+4f3e,U+4f40,U+4f42-4f43,U+4f48-4f49,U+4f4b-4f4c,U+4f52,U+4f54,U+4f56}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.51.woff2) format("woff2");unicode-range:U+3395-339b,U+339e-33a0,U+33a2-33ff,U+3402,U+3405-3406,U+3427,U+342c,U+342e,U+3468,U+346a,U+3488,U+3492,U+34b5,U+34bc,U+34c1,U+34c7,U+34db,U+351f,U+353e,U+355d-355e,U+3563,U+356e,U+35a6,U+35a8,U+35c5,U+35da,U+35de,U+35f4,U+3605,U+3614,U+364a,U+3691,U+3696,U+3699,U+36cf,U+3761-3762,U+376b-376c,U+3775,U+378d,U+37c1,U+37e2,U+37e8,U+37f4,U+37fd,U+3800,U+382f,U+3836,U+3840,U+385c,U+3861,U+38a1,U+38ad,U+38fa,U+3917,U+391a,U+396f,U+39a4,U+39b8,U+3a5c,U+3a6e,U+3a73,U+3a85,U+3ac4,U+3acb,U+3ad6-3ad7,U+3aea,U+3af3,U+3b0e,U+3b1a,U+3b1c,U+3b22,U+3b35,U+3b6d,U+3b77,U+3b87-3b88,U+3b8d,U+3ba4,U+3bb6,U+3bc3,U+3bcd,U+3bf0,U+3bf3,U+3c0f,U+3c26,U+3cc3,U+3cd2,U+3d11,U+3d1e,U+3d31,U+3d4e,U+3d64,U+3d9a,U+3dc0,U+3dcc,U+3dd4,U+3e05,U+3e3f-3e40,U+3e60,U+3e66,U+3e68,U+3e83,U+3e8a,U+3e94,U+3eda,U+3f57,U+3f72,U+3f75,U+3f77,U+3fae,U+3fb1,U+3fc9,U+3fd7,U+3fdc,U+4039,U+4058}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.52.woff2) format("woff2");unicode-range:U+32b5-332b,U+332d-3394}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.53.woff2) format("woff2");unicode-range:U+31c8-31e3,U+31f0-321e,U+3220-3230,U+3232-32b4}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.54.woff2) format("woff2");unicode-range:U+3028-303f,U+3094-3096,U+309f-30a0,U+30ee,U+30f7-30fa,U+30ff,U+3105-312f,U+3131-3163,U+3165-318e,U+3190-31bb,U+31c0-31c7}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.55.woff2) format("woff2");unicode-range:U+2f14-2fd5,U+2ff0-2ffb,U+3004,U+3013,U+3016-301b,U+301e,U+3020-3027}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.56.woff2) format("woff2");unicode-range:U+25e4-25e6,U+2601-2603,U+2609,U+260e-260f,U+2616-2617,U+261c-261f,U+262f,U+2641,U+2660,U+2662-2664,U+2666-2668,U+266d-266e,U+2672-267d,U+26bd-26be,U+2702,U+271a,U+273d,U+2740,U+2756,U+2776-2793,U+27a1,U+2934-2935,U+29bf,U+29fa-29fb,U+2b05-2b07,U+2b1a,U+2b95,U+2e3a-2e3b,U+2e80-2e99,U+2e9b-2ef3,U+2f00-2f13}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.57.woff2) format("woff2");unicode-range:U+24d1-24ff,U+2503-2513,U+2515-2516,U+2518-251b,U+251d-2522,U+2524-259f,U+25a2-25ab,U+25b1,U+25b7,U+25c0-25c1,U+25c9-25ca,U+25cc,U+25d0-25d3,U+25e2-25e3}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.58.woff2) format("woff2");unicode-range:U+2105,U+2109-210a,U+210f,U+2116,U+2121,U+2126-2127,U+212b,U+212e,U+2135,U+213b,U+2194-2199,U+21b8-21b9,U+21c4-21c6,U+21cb-21cc,U+21d0,U+21e6-21e9,U+21f5,U+2202-2203,U+2205-2206,U+2208-220b,U+220f,U+2211,U+2213,U+2215,U+221a,U+221d,U+2220,U+2223,U+2225-2226,U+2228,U+222a-222e,U+2234-2237,U+223d,U+2243,U+2245,U+2248,U+224c,U+2260,U+2262,U+2264-2265,U+226e-226f,U+2272-2273,U+2276-2277,U+2283-2287,U+228a-228b,U+2295-2299,U+22a0,U+22a5,U+22bf,U+22da-22db,U+22ef,U+2305-2307,U+2318,U+2329-232a,U+23b0-23b1,U+23be-23cc,U+23ce,U+23da-23db,U+2423,U+2469-24d0}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.59.woff2) format("woff2");unicode-range:U+a1-a4,U+a6-a7,U+aa,U+ac-ad,U+b5-b6,U+b8-ba,U+bc-c8,U+ca-cc,U+ce-d5,U+d9-db,U+dd-df,U+e6,U+ee,U+f0,U+f5,U+f7,U+f9,U+fb,U+fe-102,U+110-113,U+11a-11b,U+128-12b,U+143-144,U+147-148,U+14c,U+14e-14f,U+152-153,U+168-16d,U+192,U+1a0-1a1,U+1af,U+1cd-1dc,U+1f8-1f9,U+251,U+261,U+2bb,U+2c7,U+2c9,U+2ea-2eb,U+304,U+307,U+30c,U+1e3e-1e3f,U+1ea0-1ebe,U+1ec0-1ec6,U+1ec8-1ef9,U+2011-2012,U+2016,U+2018-201a,U+201e,U+2021,U+2030,U+2033,U+2035,U+2042,U+2047,U+2051,U+2074,U+20a9,U+20ab-20ac,U+20dd-20de,U+2100}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.60.woff2) format("woff2");unicode-range:U+2227,U+26a0,U+2713,U+301f,U+4ff8,U+5239,U+526a,U+54fa,U+5740,U+5937,U+5993,U+59fb,U+5a3c,U+5c41,U+6028,U+626e,U+646f,U+647a,U+64b0,U+64e2,U+65a7,U+66fe,U+6727,U+6955,U+6bef,U+6f23,U+724c,U+767c,U+7a83,U+7ac4,U+7b67,U+8000,U+8471,U+8513,U+8599,U+86db,U+8718,U+87f2,U+88f3,U+8ad2,U+8e2a,U+8fa3,U+95a5,U+9798,U+9910,U+9957,U+9bab,U+9c3b,U+9daf,U+ff95}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.61.woff2) format("woff2");unicode-range:U+a8,U+2032,U+2261,U+2282,U+3090,U+30f1,U+339c,U+535c,U+53d9,U+56a2,U+56c1,U+5806,U+589f,U+59d0,U+5a7f,U+60e0,U+639f,U+65af,U+68fa,U+69ae,U+6d1b,U+6ef2,U+71fb,U+725d,U+7262,U+75bc,U+7768,U+7940,U+79bf,U+7bed,U+7d68,U+7dfb,U+814b,U+8207,U+83e9,U+8494,U+8526,U+8568,U+85ea,U+86d9,U+87ba,U+8861,U+887f,U+8fe6,U+9059,U+9061,U+916a,U+976d,U+97ad,U+9ece}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.62.woff2) format("woff2");unicode-range:U+2d9,U+21d4,U+301d,U+515c,U+52fe,U+5420,U+5750,U+5766,U+5954,U+5b95,U+5f8a,U+5f98,U+620c,U+621f,U+641c,U+66d9,U+676d,U+6775,U+67f5,U+694a,U+6a02,U+6a3a,U+6a80,U+6c23,U+6c72,U+6dcb,U+6faa,U+707c,U+71c8,U+7422,U+74e2,U+7791,U+7825,U+7a14,U+7a1c,U+7c95,U+7fc1,U+82a5,U+82db,U+8304,U+853d,U+8cd3,U+8de8,U+8f0c,U+8f3f,U+9091,U+91c7,U+929a,U+98af,U+9913}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.63.woff2) format("woff2");unicode-range:U+2ca-2cb,U+2229,U+2468,U+2669,U+266f,U+273f,U+4ec0,U+4f60,U+4fb6,U+5347,U+540e,U+543b,U+5b0c,U+5d4c,U+5f14,U+5f9e,U+6155,U+62d0,U+6602,U+6666,U+66f3,U+67a2,U+67ca,U+69cc,U+6d29,U+6d9b,U+6e3e,U+6f81,U+7109,U+73c0,U+73c2,U+7425,U+7435-7436,U+7525,U+7554,U+785d,U+786b,U+7ae3,U+7b94,U+7d18,U+81bf,U+8511,U+8549,U+9075,U+9640,U+98e2,U+9e9f,U+ff96}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.64.woff2) format("woff2");unicode-range:U+2467,U+4ece,U+4ed4,U+4f91,U+4fae,U+534d,U+53c9,U+54b3,U+586b,U+5944,U+5b78,U+5df7,U+5f77,U+6101,U+6167-6168,U+61a4,U+62d9,U+698a,U+699b,U+6a59,U+6cc4,U+6e07,U+7099,U+75d2,U+77ad,U+7953,U+7984,U+7a92,U+7baa,U+7dbb,U+817f,U+82ad,U+85e9,U+868a,U+8caa,U+8f44,U+9017,U+907c,U+908a,U+92f3,U+936e,U+9435,U+978d,U+9838,U+9a28,U+9b41,U+9ba8,U+9c57,U+9eb9}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.65.woff2) format("woff2");unicode-range:U+b1,U+309b,U+4e5e,U+51f1,U+5506,U+55c5,U+58cc,U+59d1,U+5c51,U+5ef7,U+6284,U+62d7,U+6689,U+673d,U+6a2b,U+6a8e,U+6a9c,U+6d63,U+6dd1,U+70b8,U+7235,U+72db,U+72f8,U+7560,U+7c9b,U+7ce7,U+7e1e,U+80af,U+82eb,U+8463,U+8499,U+85dd,U+86ee,U+8a60,U+8a6e,U+8c79,U+8e87,U+8e8a,U+8f5f,U+9010,U+918d,U+9190,U+965b,U+97fb,U+9ab8,U+9bad,U+9d3b,U+9d5c,U+9dfa,U+9e93}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.66.woff2) format("woff2");unicode-range:U+2020,U+3003,U+3231,U+4e9b,U+4f3d,U+4f47,U+51b6,U+51dc,U+53e1,U+5bc5,U+602f,U+60bc,U+61c9,U+633d,U+637b,U+6492,U+65fa,U+660f,U+66f0,U+6703,U+681e,U+6876,U+6893,U+6912,U+698e,U+6c7d,U+714c,U+7169,U+71d5,U+725f,U+72d7,U+745b,U+74dc,U+75e2,U+7891,U+7897,U+7dcb,U+810a,U+8218,U+8339,U+840e,U+852d,U+8823,U+8a0a,U+9089,U+919c,U+971c,U+9ad9,U+ff4a,U+ff5a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.67.woff2) format("woff2");unicode-range:U+2466,U+2600,U+4eab,U+4fe3,U+4ff5,U+51a5,U+51f0,U+536f,U+53d4,U+53f1,U+54a5,U+559d,U+55e3,U+58fa,U+5962,U+59ea,U+5c16,U+5cef,U+5d16,U+5f10,U+5fd6,U+6190,U+6216,U+634f,U+63bb,U+66d6,U+6756,U+6bc5,U+6e26,U+727d,U+731f,U+76f2,U+7729,U+7a7f,U+7aff,U+7c9f,U+818f,U+8236,U+82b9,U+8338,U+85aa,U+88b4,U+8b33,U+904d,U+93a7,U+96cc,U+96eb,U+9aed,U+9b8e,U+fa11}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.68.woff2) format("woff2");unicode-range:U+251c,U+2523,U+4e14,U+545f,U+54bd,U+553e,U+55dc,U+56da,U+589c,U+5b55,U+5bb5,U+5ce1,U+5df4,U+5eb6,U+5ec9,U+6191,U+62f7,U+6357,U+64a5,U+6591,U+65bc,U+6897,U+6e1a,U+7063,U+711a,U+721b,U+722c,U+75b9,U+75d5,U+75fa,U+7766,U+7aae,U+7b48,U+7b8b,U+7d21,U+7e55,U+7f75,U+842c,U+8910,U+8a63,U+8b39,U+8b5a,U+8cdc,U+8d74,U+907d,U+91e7,U+9306,U+96bc,U+98f4,U+9ac4}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.69.woff2) format("woff2");unicode-range:U+2003,U+2312,U+266c,U+4f86,U+51ea,U+5243,U+5256,U+541f,U+5841,U+59dc,U+5df3,U+601c,U+60e7,U+632b,U+638c,U+64ad,U+6881,U+697c,U+69cd,U+6c50,U+6d2a,U+6fc1,U+7027,U+7058,U+70f9,U+714e,U+7345,U+751a,U+760d,U+764c,U+77db,U+7d79,U+7e8f,U+80ce,U+814e,U+81fc,U+8247,U+8278,U+85a9,U+8a03,U+90ed,U+9784,U+9801,U+984e,U+99b3,U+9bc9,U+9bdb,U+9be8,U+9e78,U+ff6b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.70.woff2) format("woff2");unicode-range:U+266b,U+3006,U+5176,U+5197,U+51a8,U+51c6,U+52f2,U+5614,U+5875,U+5a2f,U+5b54,U+5ce0,U+5dba,U+5deb,U+5e63,U+5f59,U+5fcc,U+6068,U+6367,U+68b6,U+6a0b,U+6b64,U+6e15,U+6eba,U+7272,U+72a0,U+7947,U+7985,U+79e6,U+79e9,U+7a3d,U+7a9f,U+7aaf,U+7b95,U+7f60,U+7f9e,U+7fe0,U+8098,U+80ba,U+8106,U+82d4,U+831c,U+87f9,U+8a1f,U+8acf,U+90c1,U+920d,U+9756,U+fe43,U+ff94}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.71.woff2) format("woff2");unicode-range:U+af,U+2465,U+2517,U+33a1,U+4f10,U+50c5,U+51b4,U+5384,U+5606,U+5bb0,U+5cac,U+5ee3,U+618e,U+61f2,U+62c9,U+66ab,U+66f9,U+6816,U+6960,U+6b3e,U+6f20,U+7078,U+72d0,U+73ed,U+7ad9,U+7b1b,U+7be4,U+7d62,U+7f51,U+80b4,U+80f4,U+8154,U+85fb,U+865c,U+8702,U+895f,U+8aed,U+8b90,U+8ced,U+8fbf,U+91d8,U+9418,U+9583,U+9591,U+9813,U+982c,U+9bd6,U+ff46,U+ff7f,U+ff88}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.72.woff2) format("woff2");unicode-range:U+4e91,U+508d,U+50e7,U+514e,U+51f6,U+5446,U+5504,U+584a,U+59a8,U+59d3,U+5a46,U+5ac9,U+6020,U+60a6,U+6148,U+621a,U+6234,U+64c1,U+6523,U+675c,U+67d1,U+6953,U+6ccc,U+6df5,U+6e13,U+6f06,U+723a,U+7325,U+74e6,U+758e,U+75ab,U+75d9,U+7a40,U+8096,U+82fa,U+8587,U+8594,U+8a6b,U+8ab9,U+8b17,U+8b83,U+937c,U+963b,U+9673,U+96db,U+9ce9,U+9f4b,U+ff67,U+ff82,U+ff93}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.73.woff2) format("woff2");unicode-range:U+221e,U+2514,U+51f9,U+5270,U+5449,U+5824,U+59a5,U+5a29,U+5d07,U+5e16,U+60e3,U+614c,U+6276,U+643e,U+64ab,U+6562,U+6681,U+670b,U+6734,U+67af,U+6a3d,U+6b05,U+6dc0,U+6e4a,U+7259,U+732a,U+7409,U+78a7,U+7a6b,U+8015,U+809b,U+817a,U+830e,U+837b,U+85ab,U+8a23,U+8a93,U+8b00,U+8b19,U+8b21,U+8cbf,U+8fb0,U+901d,U+91b8,U+9320,U+932c,U+9688,U+96f6,U+9df2,U+ff6a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.74.woff2) format("woff2");unicode-range:U+2002,U+2025,U+4f8d,U+51e1,U+51f8,U+5507,U+5598,U+58f1,U+5983,U+59ac,U+5c3c,U+5de7,U+5e7d,U+5eca,U+5f61,U+606d,U+60f9,U+636e,U+64ec,U+67da,U+67ff,U+6813,U+68f2,U+693f,U+6b6a,U+6bbb,U+6ef4,U+7092,U+717d,U+7261,U+73c8,U+7432,U+7483,U+76fe,U+7709,U+78d0,U+81a3,U+81b3,U+82af,U+8305,U+8309,U+8870,U+88fe,U+8cd1,U+8d66,U+906e,U+971e,U+9812,U+ff79,U+ff90}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.75.woff2) format("woff2");unicode-range:U+2464,U+2501,U+2640,U+2642,U+339d,U+4f0e,U+5091,U+50b5,U+5132,U+51cc,U+558b,U+55aa,U+585e,U+5bee,U+5dfe,U+60b6,U+62b9,U+6349,U+6566,U+6590,U+6842,U+689d,U+6a58,U+6c70,U+6ff1,U+7815,U+7881,U+7aaa,U+7bc7,U+7def,U+7fa8,U+8017,U+8036,U+8061,U+821f,U+8429,U+8ce0,U+8e74,U+9019,U+90ca,U+9162,U+932f,U+93ae,U+9644,U+990c,U+9cf3,U+ff56,U+ff6e,U+ff7e,U+ff85}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.76.woff2) format("woff2");unicode-range:U+2266-2267,U+4f2f,U+5208,U+5451,U+546a,U+5589,U+576a,U+5815,U+5a9a,U+5b9b,U+5c3a,U+5efb,U+5faa,U+6109,U+6643,U+6652,U+695a,U+69fd,U+6b86,U+6bb4,U+6daf,U+7089,U+70cf,U+7a00,U+7a4f,U+7b39,U+7d33,U+80e1,U+828b,U+82a6,U+86cd,U+8c8c,U+8cca,U+8df3,U+9077,U+9175,U+91dc,U+925b,U+9262,U+9271,U+92ed,U+9855,U+9905,U+9d28,U+ff3f,U+ff58,U+ff68,U+ff6d,U+ff9c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.77.woff2) format("woff2");unicode-range:U+2207,U+25ef,U+309c,U+4e4f,U+5146,U+51dd,U+5351,U+540a,U+5629,U+5eb5,U+5f04,U+5f13,U+60dc,U+6212,U+63b4,U+642c,U+6627,U+66a6,U+66c7,U+66fd,U+674e,U+6b96,U+6c4e,U+6df3,U+6e67,U+6f84,U+72fc,U+733f,U+7c97,U+7db1,U+7e4d,U+816b,U+82d1,U+84cb,U+854e,U+8607,U+86c7,U+871c,U+8776,U+8a89,U+8fc4,U+91a4,U+9285,U+9685,U+9903,U+9b31,U+9f13,U+ff42,U+ff74,U+ff91}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.78.woff2) format("woff2");unicode-range:U+4e32,U+51db,U+53a8,U+53ea,U+5609,U+5674,U+5a92,U+5e7e,U+6115,U+611a,U+62cc,U+62ed,U+63c9,U+64b9,U+64e6,U+65cb,U+6606,U+6731,U+683d,U+6afb,U+7460,U+771e,U+78ef,U+7b26,U+7b51,U+7cde,U+7d10,U+7d2f,U+7d46,U+80de,U+819c,U+84b2,U+85cd,U+865a,U+8ecc,U+9022,U+90b8,U+9192,U+9675,U+96b7,U+99ff,U+ff44,U+ff55,U+ff6c,U+ff73,U+ff75,U+ff86,U+ff8d,U+ff92,U+ffe3}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.79.woff2) format("woff2");unicode-range:U+25b3,U+30f5,U+4eae,U+4f46,U+4f51,U+5203,U+52ff,U+55a7,U+564c,U+565b,U+57f9,U+5805,U+5b64,U+5e06,U+5f70,U+5f90,U+60e8,U+6182,U+62f3,U+62fe,U+63aa,U+64a4,U+65d7,U+673a,U+6851,U+68cb,U+68df,U+6d1e,U+6e58,U+6e9d,U+77b3,U+7832,U+7c3f,U+7db4,U+7f70,U+80aa,U+80c6,U+8105,U+819d,U+8276,U+8679,U+8986,U+8c9d,U+8fc5,U+916c,U+9665,U+9699,U+96c0,U+9a19,U+ff8b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.80.woff2) format("woff2");unicode-range:U+2463,U+25a1,U+4ef0,U+5076,U+5098,U+51fd,U+5302,U+5448,U+54c9,U+570b,U+583a,U+5893,U+58a8,U+58ee,U+5949,U+5bdb,U+5f26,U+5f81,U+6052,U+6170,U+61c7,U+631f,U+635c,U+664b,U+69fb,U+6f01,U+7070,U+722a,U+745e,U+755c,U+76c6,U+78c1,U+79e4,U+7bb8,U+7d0b,U+81a8,U+82d7,U+8b5c,U+8f14,U+8fb1,U+8fbb,U+9283,U+9298,U+9a30,U+ff03,U+ff50,U+ff59,U+ff7b,U+ff8e-ff8f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.81.woff2) format("woff2");unicode-range:U+2010,U+2502,U+25b6,U+4f3a,U+514b,U+5265,U+52c3,U+5339,U+53ec,U+54c0,U+55b0,U+5854,U+5b8f,U+5cb3,U+5e84,U+60da,U+6247,U+6249,U+628a,U+62cd,U+65ac,U+6838,U+690e,U+6cf0,U+6f02,U+6f2c,U+6f70,U+708a,U+7434,U+75be,U+77ef,U+7c60,U+7c98,U+7d1b,U+7e2b,U+80a5,U+81e3,U+820c,U+8210,U+8475,U+862d,U+8650,U+8997,U+906d,U+91c8,U+9700,U+9727,U+9df9,U+ff3a,U+ff9a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.82.woff2) format("woff2");unicode-range:U+2103,U+5049,U+52b1,U+5320,U+5553,U+572d,U+58c7,U+5b5d,U+5bc2,U+5de3,U+5e61,U+5f80,U+61a9,U+67d0,U+67f4,U+6c88,U+6ca1,U+6ce5,U+6d78,U+6e9c,U+6f54,U+731b,U+73b2,U+74a7,U+74f6,U+75e9,U+7b20,U+7c8b,U+7f72,U+809d,U+8108,U+82b3,U+82bd,U+84b8,U+84c4,U+88c2,U+8ae6,U+8ef8,U+902e,U+9065,U+9326,U+935b,U+938c,U+9676,U+9694,U+96f7,U+9ed9,U+ff48,U+ff4c,U+ff81}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.83.woff2) format("woff2");unicode-range:U+2500,U+3008-3009,U+4ead,U+4f0f,U+4fca,U+53eb,U+543e,U+57a2,U+5cf0,U+5e8f,U+5fe0,U+61b2,U+62d8,U+6442,U+64b2,U+6589,U+659c,U+67f1,U+68c4,U+6cb8,U+6d12,U+6de1,U+6fe1,U+70c8,U+723d,U+73e0,U+7656,U+773a,U+7948,U+7b87,U+7c92,U+7d3a,U+7e1b,U+7e4a,U+819a,U+8358,U+83c5,U+84bc,U+864e,U+8912,U+8c9e,U+8d05,U+92fc,U+9396,U+98fd,U+99d2,U+ff64,U+ff7a,U+ff83}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.84.woff2) format("woff2");unicode-range:U+3014-3015,U+4e3c,U+5036,U+5075,U+533f,U+53e9,U+5531,U+5642,U+5984,U+59e6,U+5a01,U+5b6b,U+5c0b,U+5f25,U+6069,U+60a0,U+614e,U+62b5,U+62d2-62d3,U+6597,U+660c,U+674f,U+67cf,U+6841,U+6905,U+6cf3,U+6d32,U+6d69,U+6f64,U+716e,U+7761,U+7b52,U+7be0,U+7dbf,U+7de9,U+7f36,U+81d3,U+8302,U+8389,U+846c,U+84ee,U+8a69,U+9038,U+9d8f,U+ff47,U+ff4b,U+ff76,U+ff9b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.85.woff2) format("woff2");unicode-range:U+25c7,U+3007,U+504f,U+507d,U+51a0,U+52a3,U+5410,U+5510,U+559a,U+5782,U+582a,U+5c0a,U+5c3f,U+5c48,U+5f6b,U+6176,U+622f,U+6279,U+62bd,U+62dd,U+65ed,U+67b6,U+6817,U+6850,U+6d6a,U+6deb,U+6ea2,U+6edd,U+6f5c,U+72e9,U+73a9,U+7573,U+76bf,U+7950,U+7956,U+7f8a,U+7ffc,U+80a2,U+80c3,U+83ca,U+8a02,U+8a13,U+8df5,U+9375,U+983b,U+99b4,U+ff4e,U+ff71,U+ff89,U+ff97}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.86.woff2) format("woff2");unicode-range:U+24,U+2022,U+2212,U+221f,U+2665,U+4ecf,U+5100,U+51cd,U+52d8,U+5378,U+53f6,U+574a,U+5982,U+5996,U+5c1a,U+5e1d,U+5f84,U+609f,U+61a7,U+61f8,U+6398,U+63ee,U+6676,U+6691,U+6eb6,U+7126,U+71e5,U+7687,U+7965,U+7d17,U+80a1,U+8107,U+8266,U+85a6,U+8987,U+8ca2,U+8cab,U+8e0a,U+9042,U+95c7,U+9810,U+9867,U+98fc,U+ff52-ff54,U+ff61,U+ff77,U+ff98-ff99}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.87.woff2) format("woff2");unicode-range:U+b0,U+226a,U+2462,U+4e39,U+4fc3,U+4fd7,U+50be,U+50da,U+5200,U+5211,U+54f2,U+5618,U+596a,U+5b22,U+5bb4,U+5d50,U+60a3,U+63fa,U+658e,U+65e8,U+6669,U+6795,U+679d,U+67a0,U+6b3a,U+6e09,U+757f,U+7cd6,U+7dbe,U+7ffb,U+83cc,U+83f1,U+840c,U+845b,U+8846,U+8972,U+8a34,U+8a50,U+8a87,U+8edf,U+8ff0,U+90a6,U+9154,U+95a3,U+9663,U+9686,U+96c7,U+ff3c,U+ff7c,U+ff8a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.88.woff2) format("woff2");unicode-range:U+25bd,U+4e59,U+4ec1,U+4ff3,U+515a,U+518a,U+525b,U+5375,U+552f,U+57a3,U+5b9c,U+5c3d,U+5e3d,U+5e7b,U+5f0a,U+6094,U+6458,U+654f,U+67f3,U+6b8a,U+6bd2,U+6c37,U+6ce1,U+6e56,U+6e7f,U+6ed1,U+6ede,U+6f0f,U+70ad,U+7267,U+7363,U+786c,U+7a42,U+7db2,U+7f85,U+8178,U+829d,U+8896,U+8c5a,U+8cb0,U+8ce2,U+8ed2,U+9047,U+9177,U+970a,U+9ea6,U+ff1b,U+ff31,U+ff39,U+ff80}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.89.woff2) format("woff2");unicode-range:U+a5,U+4e80,U+4f34,U+4f73,U+4f75,U+511f,U+5192,U+52aa,U+53c8,U+570f,U+57cb,U+596e,U+5d8b,U+5f66,U+5fd9,U+62db,U+62f6,U+6328,U+633f,U+63a7,U+6469,U+6bbf,U+6c41,U+6c57,U+6d44,U+6dbc,U+706f,U+72c2,U+72ed,U+7551,U+75f4,U+7949,U+7e26,U+7fd4,U+8150,U+8af8,U+8b0e,U+8b72,U+8ca7,U+934b,U+9a0e,U+9a12,U+9b42,U+ff41,U+ff43,U+ff45,U+ff49,U+ff4f,U+ff62-ff63}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.90.woff2) format("woff2");unicode-range:U+4e18,U+4fb5,U+5104,U+52c7,U+5353,U+5374,U+53e5,U+587e,U+594f,U+5a20,U+5de1,U+5f18,U+5fcd,U+6291,U+62ab,U+6355,U+6392,U+63da,U+63e1,U+656c,U+6687,U+68b0-68b1,U+68d2,U+68da,U+6b27,U+6cbc,U+7159,U+7344,U+73cd,U+76df,U+790e,U+7cf8,U+8102,U+88c1,U+8aa0,U+8e0f,U+9178,U+92ad,U+9670,U+96c5,U+9cf4,U+9db4,U+ff3e,U+ff6f,U+ff72,U+ff78,U+ff7d,U+ff84,U+ff8c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.91.woff2) format("woff2");unicode-range:U+60,U+2200,U+226b,U+2461,U+517c,U+526f,U+5800,U+5b97,U+5bf8,U+5c01,U+5d29,U+5e4c,U+5e81,U+6065,U+61d0,U+667a,U+6696,U+6843,U+6c99,U+6d99,U+6ec5,U+6f22,U+6f6e,U+6fa4,U+6fef,U+71c3,U+72d9,U+7384,U+78e8,U+7a1a,U+7a32,U+7a3c,U+7adc,U+7ca7,U+7d2b,U+7dad,U+7e4b,U+80a9,U+8170,U+81ed,U+820e,U+8a17,U+8afe,U+90aa,U+914e,U+963f,U+99c4,U+9eba,U+9f3b,U+ff38}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.92.woff2) format("woff2");unicode-range:U+2460,U+4e5f,U+4e7e,U+4ed9,U+501f,U+502b,U+5968,U+5974,U+5ac1,U+5b99,U+5ba3,U+5be7,U+5be9,U+5c64,U+5cb8,U+5ec3,U+5f1f,U+616e,U+6297,U+62e0,U+62ec,U+6368,U+642d,U+65e6,U+6717,U+676f,U+6b04,U+732e,U+7652,U+76ca,U+76d7,U+7802,U+7e70,U+7f6a,U+8133,U+81e8,U+866b,U+878d,U+88f8,U+8a5e,U+8cdb,U+8d08,U+907a,U+90e1,U+96f2,U+9f8d,U+ff35,U+ff37,U+ff40,U+ff9d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.93.woff2) format("woff2");unicode-range:U+21d2,U+25ce,U+300a-300b,U+4e89,U+4e9c,U+4ea1,U+5263,U+53cc,U+5426,U+5869,U+5947,U+598a,U+5999,U+5e55,U+5e72,U+5e79,U+5fae,U+5fb9,U+602a,U+6163,U+624d,U+6749,U+6c5a,U+6cbf,U+6d45,U+6dfb,U+6e7e,U+708e,U+725b,U+7763,U+79c0,U+7bc4,U+7c89,U+7e01,U+7e2e,U+8010,U+8033,U+8c6a,U+8cc3,U+8f1d,U+8f9b,U+8fb2,U+907f,U+90f7,U+9707,U+9818,U+9b3c,U+ff0a,U+ff4d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.94.woff2) format("woff2");unicode-range:U+2015,U+2190,U+4e43,U+5019,U+5247,U+52e7,U+5438,U+54b2,U+55ab,U+57f7,U+5bd2,U+5e8a,U+5ef6,U+6016,U+60b2,U+6162,U+6319,U+6551,U+6607,U+66b4,U+675f,U+67d4,U+6b20,U+6b53,U+6ce3,U+719f,U+75b2,U+770b,U+7720,U+77ac,U+79d2,U+7af9,U+7d05,U+7dca,U+8056,U+80f8,U+81f3,U+8352,U+885d,U+8a70,U+8aa4,U+8cbc,U+900f,U+9084,U+91e3,U+9451,U+96c4,U+99c6,U+9ad4,U+ff70}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.95.woff2) format("woff2");unicode-range:U+2193,U+25b2,U+4e4b,U+516d,U+51c4,U+529f,U+52c9,U+5360,U+5442,U+5857,U+5915,U+59eb,U+5a9b,U+5c3b,U+6012,U+61b6,U+62b1,U+6311,U+6577,U+65e2,U+65ec,U+6613,U+6790,U+6cb9,U+7372,U+76ae,U+7d5e,U+7fcc,U+88ab,U+88d5,U+8caf,U+8ddd,U+8ecd,U+8f38,U+8f9e,U+8feb,U+9063,U+90f5,U+93e1,U+968a,U+968f,U+98fe,U+9ec4,U+ff1d,U+ff27,U+ff2a,U+ff36,U+ff3b,U+ff3d,U+ffe5}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.96.woff2) format("woff2");unicode-range:U+4e03,U+4f38,U+50b7,U+5264,U+5348,U+5371,U+585a,U+58ca,U+5951,U+59b9,U+59d4,U+5b98,U+5f8b,U+6388,U+64cd,U+65e7,U+6803,U+6b6f,U+6d66,U+6e0b,U+6ecb,U+6fc3,U+72ac,U+773c,U+77e2,U+7968,U+7a74,U+7dba,U+7dd1,U+7e3e,U+808c,U+811a,U+8179,U+8239,U+8584,U+8a0e,U+8a72,U+8b66,U+8c46,U+8f29,U+90a3,U+9234,U+96f0,U+9769,U+9774,U+9aa8,U+ff26,U+ff28,U+ff9e-ff9f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.97.woff2) format("woff2");unicode-range:U+7e,U+b4,U+25c6,U+2661,U+4e92,U+4eee,U+4ffa,U+5144,U+5237,U+5287,U+52b4,U+58c1,U+5bff,U+5c04,U+5c06,U+5e95,U+5f31,U+5f93,U+63c3,U+640d,U+6557,U+6614,U+662f,U+67d3,U+690d,U+6bba,U+6e6f,U+72af,U+732b,U+7518,U+7ae0,U+7ae5,U+7af6,U+822a,U+89e6,U+8a3a,U+8a98,U+8cb8,U+8de1,U+8e8d,U+95d8,U+961c,U+96a3,U+96ea,U+9bae,U+ff20,U+ff22,U+ff29,U+ff2b-ff2c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.98.woff2) format("woff2");unicode-range:U+25cb,U+4e71,U+4f59,U+50d5,U+520a,U+5217,U+5230,U+523a-523b,U+541b,U+5439,U+5747,U+59c9,U+5bdf,U+5c31,U+5de8,U+5e7c,U+5f69,U+6050,U+60d1,U+63cf,U+663c,U+67c4,U+6885,U+6c38,U+6d6e,U+6db2,U+6df7,U+6e2c,U+6f5f,U+7532,U+76e3-76e4,U+7701,U+793c,U+79f0,U+7a93,U+7d00,U+7de0,U+7e54,U+8328,U+8840,U+969c,U+96e8,U+9811,U+9aea,U+9b5a,U+ff24,U+ff2e,U+ff57}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.99.woff2) format("woff2");unicode-range:U+2191,U+505c,U+52e4,U+5305,U+535a,U+56e0,U+59bb,U+5acc,U+5b09,U+5b87,U+5c90,U+5df1,U+5e2d,U+5e33,U+5f3e,U+6298,U+6383,U+653b,U+6697,U+6804,U+6a39,U+6cca,U+6e90,U+6f2b,U+702c,U+7206,U+7236,U+7559,U+7565,U+7591,U+75c7,U+75db,U+7b4b,U+7bb1,U+7d99,U+7fbd,U+8131,U+885b,U+8b1d,U+8ff7,U+9003,U+9045,U+96a0,U+9732,U+990a,U+99d0,U+9e97,U+9f62,U+ff25,U+ff2d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.100.woff2) format("woff2");unicode-range:U+4e08,U+4f9d,U+5012,U+514d,U+51b7,U+5275,U+53ca,U+53f8,U+5584,U+57fc,U+5b9d,U+5bfa,U+5c3e,U+5f01,U+5fb4,U+5fd7,U+606f,U+62e1,U+6563,U+6674,U+6cb3,U+6d3e,U+6d74,U+6e1b,U+6e2f,U+718a,U+7247,U+79d8,U+7d14,U+7d66,U+7d71,U+7df4,U+7e41,U+80cc,U+8155,U+83d3,U+8a95,U+8ab2,U+8ad6,U+8ca1,U+9000,U+9006,U+9678,U+97d3,U+9808,U+98ef,U+9a5a,U+9b45,U+ff23,U+ff30}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.101.woff2) format("woff2");unicode-range:U+25bc,U+3012,U+4ef2,U+4f0a,U+516b,U+5373,U+539a,U+53b3,U+559c,U+56f0,U+5727,U+5742,U+5965,U+59ff,U+5bc6,U+5dfb,U+5e45,U+5ead,U+5fb3,U+6211,U+6253,U+639b,U+63a8,U+6545,U+6575,U+6628,U+672d,U+68a8,U+6bdb,U+6d25,U+707d,U+767e,U+7834,U+7b46,U+7bc9,U+8074,U+82e6,U+8349,U+8a2a,U+8d70,U+8da3,U+8fce,U+91cc,U+967d,U+97ff,U+9996,U+ff1c,U+ff2f,U+ff32,U+ff34}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.102.woff2) format("woff2");unicode-range:U+3d,U+5e,U+25cf,U+4e0e,U+4e5d,U+4e73,U+4e94,U+4f3c,U+5009,U+5145,U+51ac,U+5238,U+524a,U+53f3,U+547c,U+5802,U+5922,U+5a66,U+5c0e,U+5de6,U+5fd8,U+5feb,U+6797,U+685c,U+6b7b,U+6c5f-6c60,U+6cc9,U+6ce2,U+6d17,U+6e21,U+7167,U+7642,U+76db,U+8001,U+821e,U+8857,U+89d2,U+8b1b,U+8b70,U+8cb4,U+8cde,U+8f03,U+8f2a,U+968e,U+9b54,U+9e7f,U+9ebb,U+ff05,U+ff33}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.103.woff2) format("woff2");unicode-range:U+500d,U+5074,U+50cd,U+5175,U+52e2,U+5352,U+5354,U+53f2,U+5409,U+56fa,U+5a18,U+5b88,U+5bdd,U+5ca9,U+5f92,U+5fa9,U+60a9,U+623f,U+6483,U+653f,U+666f,U+66ae,U+66f2,U+6a21,U+6b66,U+6bcd,U+6d5c,U+796d,U+7a4d,U+7aef,U+7b56,U+7b97,U+7c4d,U+7e04,U+7fa9,U+8377,U+83dc,U+83ef,U+8535,U+8863,U+88cf,U+88dc,U+8907,U+8acb,U+90ce,U+91dd,U+ff0b,U+ff0d,U+ff19,U+ff65}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.104.woff2) format("woff2");unicode-range:U+4e01,U+4e21,U+4e38,U+52a9,U+547d,U+592e,U+5931,U+5b63,U+5c40,U+5dde,U+5e78,U+5efa,U+5fa1,U+604b,U+6075,U+62c5,U+632f,U+6a19,U+6c0f,U+6c11,U+6c96,U+6e05,U+70ba,U+71b1,U+7387,U+7403,U+75c5,U+77ed,U+795d,U+7b54,U+7cbe,U+7d19,U+7fa4,U+8089,U+81f4,U+8208,U+8336,U+8457,U+8a33,U+8c4a,U+8ca0,U+8ca8,U+8cc0,U+9014,U+964d,U+9803,U+983c,U+98db,U+ff17,U+ff21}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.105.woff2) format("woff2");unicode-range:U+25,U+25a0,U+4e26,U+4f4e,U+5341,U+56f2,U+5bbf,U+5c45,U+5c55,U+5c5e,U+5dee,U+5e9c,U+5f7c,U+6255,U+627f,U+62bc,U+65cf,U+661f,U+666e,U+66dc,U+67fb,U+6975,U+6a4b,U+6b32,U+6df1,U+6e29,U+6fc0,U+738b,U+7686,U+7a76,U+7a81,U+7c73,U+7d75,U+7dd2,U+82e5,U+82f1,U+85ac,U+888b,U+899a,U+8a31,U+8a8c,U+8ab0,U+8b58,U+904a,U+9060,U+9280,U+95b2,U+984d,U+9ce5,U+ff18}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.106.woff2) format("woff2");unicode-range:U+30f6,U+50ac,U+5178,U+51e6,U+5224,U+52dd,U+5883,U+5897,U+590f,U+5a5a,U+5bb3,U+5c65,U+5e03,U+5e2b,U+5e30,U+5eb7,U+6271,U+63f4,U+64ae,U+6574,U+672b,U+679a,U+6a29-6a2a,U+6ca2,U+6cc1,U+6d0b,U+713c,U+74b0,U+7981,U+7a0b,U+7bc0,U+7d1a,U+7d61,U+7fd2,U+822c,U+8996,U+89aa,U+8cac,U+8cbb,U+8d77,U+8def,U+9020,U+9152,U+9244,U+9662,U+967a,U+96e3,U+9759,U+ff16}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.107.woff2) format("woff2");unicode-range:U+23,U+3c,U+2192,U+4e45,U+4efb,U+4f50,U+4f8b,U+4fc2,U+5024,U+5150,U+5272,U+5370,U+53bb,U+542b,U+56db,U+56e3,U+57ce,U+5bc4,U+5bcc,U+5f71,U+60aa,U+6238,U+6280,U+629c,U+6539,U+66ff,U+670d,U+677e-677f,U+6839,U+69cb,U+6b4c,U+6bb5,U+6e96,U+6f14,U+72ec,U+7389,U+7814,U+79cb,U+79d1,U+79fb,U+7a0e,U+7d0d,U+85e4,U+8d64,U+9632,U+96e2,U+9805,U+99ac,U+ff1e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.108.woff2) format("woff2");unicode-range:U+2605-2606,U+301c,U+4e57,U+4fee,U+5065,U+52df,U+533b,U+5357,U+57df,U+58eb,U+58f0,U+591c,U+592a-592b,U+5948,U+5b85,U+5d0e,U+5ea7,U+5ff5,U+6025,U+63a1,U+63a5,U+63db,U+643a,U+65bd,U+671d,U+68ee,U+6982,U+6b73,U+6bd4,U+6d88,U+7570,U+7b11,U+7d76,U+8077,U+8217,U+8c37,U+8c61,U+8cc7,U+8d85,U+901f,U+962a,U+9802,U+9806,U+9854,U+98f2,U+9928,U+99c5,U+9ed2}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.109.woff2) format("woff2");unicode-range:U+266a,U+4f11,U+533a,U+5343,U+534a,U+53cd,U+5404,U+56f3,U+5b57-5b58,U+5bae,U+5c4a,U+5e0c,U+5e2f,U+5eab,U+5f35,U+5f79,U+614b,U+6226,U+629e,U+65c5,U+6625,U+6751,U+6821,U+6b69,U+6b8b,U+6bce,U+6c42,U+706b,U+7c21,U+7cfb,U+805e,U+80b2,U+82b8,U+843d,U+8853,U+88c5,U+8a3c,U+8a66,U+8d8a,U+8fba,U+9069,U+91cf,U+9752,U+975e,U+9999,U+ff0f-ff10,U+ff14-ff15}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.110.woff2) format("woff2");unicode-range:U+40,U+4e86,U+4e95,U+4f01,U+4f1d,U+4fbf,U+5099,U+5171,U+5177,U+53cb,U+53ce,U+53f0,U+5668,U+5712,U+5ba4,U+5ca1,U+5f85,U+60f3,U+653e,U+65ad,U+65e9,U+6620,U+6750,U+6761,U+6b62,U+6b74,U+6e08,U+6e80,U+7248,U+7531,U+7533,U+753a,U+77f3,U+798f,U+7f6e,U+8449,U+88fd,U+89b3,U+8a55,U+8ac7,U+8b77,U+8db3,U+8efd,U+8fd4,U+9031-9032,U+9580,U+9589,U+96d1,U+985e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.111.woff2) format("woff2");unicode-range:U+2b,U+d7,U+300e-300f,U+4e07,U+4e8c,U+512a,U+5149,U+518d,U+5236,U+52b9,U+52d9,U+5468,U+578b,U+57fa,U+5b8c,U+5ba2,U+5c02,U+5de5,U+5f37,U+5f62,U+623b,U+63d0,U+652f,U+672a,U+6848,U+6d41,U+7136,U+7537,U+754c,U+76f4,U+79c1,U+7ba1,U+7d44,U+7d4c,U+7dcf,U+7dda,U+7de8,U+82b1,U+897f,U+8ca9,U+8cfc,U+904e,U+9664,U+982d,U+9858,U+98a8,U+9a13,U+ff13,U+ff5c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.112.woff2) format("woff2");unicode-range:U+4e16,U+4e3b,U+4ea4,U+4ee4,U+4f4d,U+4f4f,U+4f55,U+4f9b,U+5317,U+5358,U+53c2,U+53e4,U+548c,U+571f,U+59cb,U+5cf6,U+5e38,U+63a2,U+63b2,U+6559,U+662d,U+679c,U+6c7a,U+72b6,U+7523,U+767d,U+770c,U+7a2e,U+7a3f,U+7a7a,U+7b2c,U+7b49,U+7d20,U+7d42,U+8003,U+8272,U+8a08,U+8aac,U+8cb7,U+8eab,U+8ee2,U+9054-9055,U+90fd,U+914d,U+91cd,U+969b,U+97f3,U+984c,U+ff06}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.113.woff2) format("woff2");unicode-range:U+26,U+5f,U+2026,U+203b,U+4e09,U+4eac,U+4ed5,U+4fa1,U+5143,U+5199,U+5207,U+539f,U+53e3,U+53f7,U+5411,U+5473,U+5546,U+55b6,U+5929,U+597d,U+5bb9,U+5c11,U+5c4b,U+5ddd,U+5f97,U+5fc5,U+6295,U+6301,U+6307,U+671b,U+76f8,U+78ba,U+795e,U+7d30,U+7d39,U+7d9a,U+89e3,U+8a00,U+8a73,U+8a8d,U+8a9e,U+8aad,U+8abf,U+8cea,U+8eca,U+8ffd,U+904b,U+9650,U+ff11-ff12}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.114.woff2) format("woff2");unicode-range:U+3e,U+3005,U+4e0d,U+4e88,U+4ecb,U+4ee3,U+4ef6,U+4fdd,U+4fe1,U+500b,U+50cf,U+5186,U+5316,U+53d7,U+540c,U+544a,U+54e1,U+5728,U+58f2,U+5973,U+5b89,U+5c71,U+5e02,U+5e97,U+5f15,U+5fc3,U+5fdc,U+601d,U+611b,U+611f,U+671f,U+6728,U+6765,U+683c,U+6b21,U+6ce8,U+6d3b,U+6d77,U+7530,U+7740,U+7acb,U+7d50,U+826f,U+8f09,U+8fbc,U+9001,U+9053,U+91ce,U+9762,U+98df}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.115.woff2) format("woff2");unicode-range:U+7c,U+3080,U+4ee5,U+5148,U+516c,U+521d,U+5225,U+529b,U+52a0,U+53ef,U+56de,U+56fd,U+5909,U+591a,U+5b66,U+5b9f,U+5bb6,U+5bfe,U+5e73,U+5e83,U+5ea6,U+5f53,U+6027,U+610f,U+6210,U+6240,U+660e,U+66f4,U+66f8,U+6709,U+6771,U+697d,U+69d8,U+6a5f,U+6c34,U+6cbb,U+73fe,U+756a,U+7684,U+771f,U+793a,U+7f8e,U+898f,U+8a2d,U+8a71,U+8fd1,U+9078,U+9577,U+96fb,U+ff5e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.116.woff2) format("woff2");unicode-range:U+a9,U+3010-3011,U+30e2,U+4e0b,U+4eca,U+4ed6,U+4ed8,U+4f53,U+4f5c,U+4f7f,U+53d6,U+540d,U+54c1,U+5730,U+5916,U+5b50,U+5c0f,U+5f8c,U+624b,U+6570,U+6587,U+6599,U+691c,U+696d,U+6cd5,U+7269,U+7279,U+7406,U+767a-767b,U+77e5,U+7d04,U+7d22,U+8005,U+80fd,U+81ea,U+8868,U+8981,U+89a7,U+901a,U+9023,U+90e8,U+91d1,U+9332,U+958b,U+96c6,U+9ad8,U+ff1a,U+ff1f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.117.woff2) format("woff2");unicode-range:U+4e,U+a0,U+3000,U+300c-300d,U+4e00,U+4e0a,U+4e2d,U+4e8b,U+4eba,U+4f1a,U+5165,U+5168,U+5185,U+51fa,U+5206,U+5229,U+524d,U+52d5,U+5408,U+554f,U+5831,U+5834,U+5927,U+5b9a,U+5e74,U+5f0f,U+60c5,U+65b0,U+65b9,U+6642,U+6700,U+672c,U+682a,U+6b63,U+6c17,U+7121,U+751f,U+7528,U+753b,U+76ee,U+793e,U+884c,U+898b,U+8a18,U+9593,U+95a2,U+ff01,U+ff08-ff09}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.118.woff2) format("woff2");unicode-range:U+21-22,U+27-2a,U+2c-3b,U+3f,U+41-4d,U+4f-5d,U+61-7b,U+7d,U+ab,U+ae,U+b2-b3,U+b7,U+bb,U+c9,U+cd,U+d6,U+d8,U+dc,U+e0-e5,U+e7-ed,U+ef,U+f1-f4,U+f6,U+f8,U+fa,U+fc-fd,U+103,U+14d,U+1b0,U+300-301,U+1ebf,U+1ec7,U+2013-2014,U+201c-201d,U+2039-203a,U+203c,U+2048-2049,U+2113,U+2122,U+65e5,U+6708,U+70b9}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.119.woff2) format("woff2");unicode-range:U+20,U+2027,U+3001-3002,U+3041-307f,U+3081-308f,U+3091-3093,U+3099-309a,U+309d-309e,U+30a1-30e1,U+30e3-30ed,U+30ef-30f0,U+30f2-30f4,U+30fb-30fe,U+ff0c,U+ff0e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6omwqRfTHxT624.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6okQqRfTHxT624.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6onwqRfTHxTw.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Sniglet;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/sniglet/v17/cIf9MaFLtkE3UjaJ9CChYUsEkIpdQQ.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Sniglet;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/sniglet/v17/cIf9MaFLtkE3UjaJ9C6hYUsEkIo.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}.i-eos-icons\:three-dots-loading,[i-eos-icons\:three-dots-loading=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Ccircle cx='18' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='.67' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3Ccircle cx='12' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='.33' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3Ccircle cx='6' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='0' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:alibabacloud{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M14.752 4.64h5.274C22.242 4.64 24 6.475 24 8.691V15.8a3.947 3.947 0 01-3.974 3.975h-5.274l1.299-1.835 3.822-1.222c.688-.23 1.146-.918 1.146-1.605v-5.81c0-.687-.458-1.375-1.146-1.605L16.05 6.475l-1.3-1.835zM2.98 15.111c0 .688.46 1.376 1.147 1.606l3.822 1.146 1.3 1.835H3.974A3.947 3.947 0 010 15.723V8.69c0-2.216 1.758-4.05 3.975-4.05h5.273L7.95 6.474 4.127 7.697c-.688.23-1.146.918-1.146 1.606v5.808z'/%3E%3Cpath d='M16.051 11.213H8.025v1.835h8.026v-1.835z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:anthropic{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:cloudflare{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cg%3E%3Cpath d='M16.493 17.4c.135-.52.08-.983-.161-1.338-.215-.328-.592-.519-1.05-.519l-8.663-.109a.148.148 0 01-.135-.082c-.027-.054-.027-.109-.027-.163.027-.082.108-.164.189-.164l8.744-.11c1.05-.054 2.153-.9 2.556-1.937l.511-1.31c.027-.055.027-.11.027-.164C17.92 8.91 15.66 7 12.942 7c-2.503 0-4.628 1.638-5.381 3.903a2.432 2.432 0 00-1.803-.491c-1.21.109-2.153 1.092-2.287 2.32-.027.328 0 .628.054.9C1.56 13.688 0 15.326 0 17.319c0 .19.027.355.027.545 0 .082.08.137.161.137h15.983c.08 0 .188-.055.215-.164l.107-.437'/%3E%3Cpath d='M19.238 11.75h-.242c-.054 0-.108.054-.135.109l-.35 1.2c-.134.52-.08.983.162 1.338.215.328.592.518 1.05.518l1.855.11c.054 0 .108.027.135.082.027.054.027.109.027.163-.027.082-.108.164-.188.164l-1.91.11c-1.05.054-2.153.9-2.557 1.937l-.134.355c-.027.055.026.137.107.137h6.592c.081 0 .162-.055.162-.137.107-.41.188-.846.188-1.31-.027-2.62-2.153-4.777-4.762-4.777'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:deepseek{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:featherless-ai{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36' width='1em' height='1em' %3E%3Cg fill='currentColor'%3E%3Cpath d='M40.0866 4.68482C38.2902 3.5825 35.863 3 33.0672 3C28.7842 3 24.0653 4.35865 19.8276 6.72206L19.7979 6.71083C19.7979 6.71083 19.7937 6.73344 19.7914 6.74423C18.5086 7.4617 17.2656 8.2629 16.0981 9.15731C9.22112 14.4248 7.29519 20.6748 8.92004 24.0156C7.14142 27.0728 6.0457 30.2332 6 33.9767C9.41949 27.421 11.4719 22.108 22.6146 13.1637C19.4309 13.8501 13.9281 17.1057 10.2271 22.0459C9.87793 19.156 12.1477 14.4895 17.2033 10.6174C17.8435 10.127 18.5092 9.66864 19.1886 9.23374C18.6577 10.8934 18.8269 10.4806 17.7254 12.8076C19.3543 11.2566 20.4268 10.2995 22.035 7.64145C24.123 6.60964 26.2948 5.83844 28.4482 5.37235C28.0919 6.56071 27.4137 8.57466 26.4955 10.1669C26.4955 10.1669 28.8258 9.66435 30.7518 9.77788C29.6995 10.9459 28.7527 12.2094 27.7926 13.5012C26.4777 15.2696 25.1184 17.0983 23.3778 18.8005C23.1683 19.0054 22.968 19.1912 22.7649 19.383C20.0902 19.1254 18.3235 20.1315 16.6683 21.9089C17.9737 21.2966 19.7273 20.7924 20.8266 21.0959C18.8008 22.7579 15.6106 24.9488 12.9893 24.7684C12.4922 25.5295 12.4608 25.5528 11.9144 26.4722C16.1664 27.537 21.507 23.1905 24.6498 20.1161C26.4926 18.3131 27.8964 16.4257 29.2534 14.6012C32.0481 10.8427 34.4616 7.5974 39.8153 6.3624L42 5.85877L40.0866 4.68482Z' class='logo-mark'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:fireworks{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath clip-rule='evenodd' d='M14.8 5l-2.801 6.795L9.195 5H7.397l3.072 7.428a1.64 1.64 0 003.038.002L16.598 5H14.8zm1.196 10.352l5.124-5.244-.699-1.669-5.596 5.739a1.664 1.664 0 00-.343 1.807 1.642 1.642 0 001.516 1.012L16 17l8-.02-.699-1.669-7.303.041h-.002zM2.88 10.104l.699-1.669 5.596 5.739c.468.479.603 1.189.343 1.807a1.643 1.643 0 01-1.516 1.012l-8-.018-.002.002.699-1.669 7.303.042-5.122-5.246z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:gemini{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M12 24A14.304 14.304 0 000 12 14.304 14.304 0 0012 0a14.305 14.305 0 0012 12 14.305 14.305 0 00-12 12'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:microsoft{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M11.49 2H2v9.492h9.492V2h-.002z'/%3E%3Cpath d='M22 2h-9.492v9.492H22V2z'/%3E%3Cpath d='M11.49 12.508H2V22h9.492v-9.492h-.002z'/%3E%3Cpath d='M22 12.508h-9.492V22H22v-9.492z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:mistral{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath clip-rule='evenodd' d='M3.428 3.4h3.429v3.428h3.429v3.429h-.002 3.431V6.828h3.427V3.4h3.43v13.714H24v3.429H13.714v-3.428h-3.428v-3.429h-3.43v3.428h3.43v3.429H0v-3.429h3.428V3.4zm10.286 13.715h3.428v-3.429h-3.427v3.429z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:moonshot{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:novita{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath clip-rule='evenodd' d='M9.167 4.17v5.665L0 19.003h9.167v-5.666l5.666 5.666H24L9.167 4.17z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:ollama{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:openai{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:openrouter{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M16.804 1.957l7.22 4.105v.087L16.73 10.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147 1.352L8.345 11.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314 1.17.796 2.701 1.866 1.11.775 2.083 1.177 3.147 1.352l.3.045c.694.091 1.375.094 2.825.033l.022-2.159 7.22 4.105v.087L16.589 22l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997 21.997 0 00-.755-.498l-.467-.28a55.927 55.927 0 00-.76-.43C2.908 14.73.563 14.116 0 14.116V9.888l.14.004c.564-.007 2.91-.622 3.809-1.124l1.016-.58.438-.274c.428-.28 1.072-.726 2.686-1.853 1.621-1.133 3.186-1.78 4.881-2.059 1.152-.19 1.974-.213 3.814-.138l.02-1.907z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:perplexity{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:together{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cg%3E%3Cpath d='M17.385 11.23a4.615 4.615 0 100-9.23 4.615 4.615 0 000 9.23zm0 10.77a4.615 4.615 0 100-9.23 4.615 4.615 0 000 9.23zm-10.77 0a4.615 4.615 0 100-9.23 4.615 4.615 0 000 9.23z' opacity='.2'/%3E%3Ccircle cx='6.615' cy='6.615' r='4.615'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:vllm{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M0 4.973h9.324V23L0 4.973z'/%3E%3Cpath d='M13.986 4.351L22.378 0l-6.216 23H9.324l4.662-18.649z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:volcengine{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M7.29 5.36L3.148 21.737a.215.215 0 00.203.261h8.29a.214.214 0 00.215-.261L7.7 5.359a.214.214 0 00-.41 0z' fill-opacity='.5'/%3E%3Cpath clip-rule='evenodd' d='M4.553 16.18l-1.406 5.558a.214.214 0 00.203.261h2.42-4.551a.214.214 0 01-.214-.26l2.275-8.961a.214.214 0 01.409 0l.864 3.402z'/%3E%3Cpath d='M14.44.15a.214.214 0 00-.41 0L8.366 21.739a.214.214 0 00.214.261H19.9a.214.214 0 00.215-.261L14.44.151z' fill-opacity='.5'/%3E%3Cpath clip-rule='evenodd' d='M16.694 22h3.207a.215.215 0 00.214-.262l-1.839-6.993 1.164-4.592a.214.214 0 01.411 0l2.951 11.586a.214.214 0 01-.214.261h-5.894z'/%3E%3Cpath d='M10.278 7.741L6.685 21.736a.214.214 0 00.214.264h7.17a.216.216 0 00.214-.166.216.216 0 000-.098L10.687 7.742a.214.214 0 00-.409 0z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:xai{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:check,[i-lucide\:check=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:ghost,[i-lucide\:ghost=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 10h.01M15 10h.01M12 2a8 8 0 0 0-8 8v12l3-3l2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:loader-circle{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 12a9 9 0 1 1-6.219-8.56'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:mic,[i-lucide\:mic=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2m7 9v3'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:music,[i-lucide\:music=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-simple-icons\:discord{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M20.317 4.37a19.8 19.8 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.3 18.3 0 0 0-5.487 0a13 13 0 0 0-.617-1.25a.08.08 0 0 0-.079-.037A19.7 19.7 0 0 0 3.677 4.37a.1.1 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.08.08 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.08.08 0 0 0 .084-.028a14 14 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13 13 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10 10 0 0 0 .372-.292a.07.07 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.07.07 0 0 1 .078.01q.181.149.373.292a.077.077 0 0 1-.006.127a12.3 12.3 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.08.08 0 0 0 .084.028a19.8 19.8 0 0 0 6.002-3.03a.08.08 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.06.06 0 0 0-.031-.03M8.02 15.33c-1.182 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418m7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-simple-icons\:elevenlabs{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M4.604 0v24h4.931V0zm9.86 0v24h4.933V0z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-simple-icons\:x{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584l-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:alt-arrow-down-bold-duotone,[i-solar\:alt-arrow-down-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='m8.303 12.404l3.327 3.431c.213.22.527.22.74 0l6.43-6.63C19.201 8.79 18.958 8 18.43 8h-5.723z'/%3E%3Cpath fill='currentColor' d='M11.293 8H5.57c-.528 0-.771.79-.37 1.205l2.406 2.481z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:alt-arrow-left-line-duotone,[i-solar\:alt-arrow-left-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m15 5l-6 7l6 7'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:armchair-2-bold-duotone,[i-solar\:armchair-2-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M16.533 18H6.75v2a.75.75 0 1 1-1.5 0v-2.324c-.829-.362-1.49-1.005-1.808-1.817l-.039-.102L2.1 12.264C1.685 11.15 2.613 10 3.927 10c.81 0 1.534.453 1.81 1.134l1.098 2.706c.1.246.15.37.222.47a1.2 1.2 0 0 0 .74.463c.13.027.277.027.57.027h6.98c.569 0 .853 0 1.091-.098q.196-.082.349-.219c.184-.166.281-.405.475-.883l1.001-2.466c.276-.68 1-1.134 1.81-1.134c1.314 0 2.242 1.15 1.827 2.264l-1.12 3c-.195.524-.292.785-.421 1.008a3.43 3.43 0 0 1-1.609 1.404V20a.75.75 0 1 1-1.5 0v-2.005c-.187.005-.415.005-.717.005'/%3E%3Cpath fill='currentColor' d='M13.236 3.5h-2.472c-1.1 0-1.976 0-2.66.088c-.706.09-1.285.28-1.746.72c-.464.441-.669 1.003-.765 1.685c-.093.658-.093 1.495-.093 2.54v2.195q.147.186.237.406l1.098 2.706c.1.246.15.37.222.47a1.2 1.2 0 0 0 .74.463c.13.027.277.027.57.027h6.98c.569 0 .853 0 1.091-.098q.196-.082.349-.219c.184-.166.281-.405.475-.883l1.001-2.466q.09-.221.237-.406V8.533c0-1.045 0-1.882-.093-2.54c-.096-.682-.301-1.244-.765-1.686c-.46-.438-1.04-.629-1.745-.72c-.685-.087-1.56-.087-2.661-.087' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:arrow-right-line-duotone,[i-solar\:arrow-right-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none'%3E%3Cpath fill='currentColor' d='M4 11.25a.75.75 0 0 0 0 1.5zm0 1.5h16v-1.5H4z' opacity='.5'/%3E%3Cpath stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m14 6l6 6l-6 6'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:book-bookmark-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M12 20.028V18H8v2.028c0 .277 0 .416.095.472s.224-.006.484-.13l1.242-.593c.088-.042.132-.063.179-.063s.091.02.179.063l1.242.593c.26.124.39.186.484.13c.095-.056.095-.195.095-.472' opacity='.5'/%3E%3Cpath fill='currentColor' d='M8 18h-.574c-1.084 0-1.462.006-1.753.068c-.513.11-.96.347-1.285.667c-.11.108-.164.161-.291.505s-.107.489-.066.78l.022.15c.11.653.31.998.616 1.244c.307.246.737.407 1.55.494c.837.09 1.946.092 3.536.092h4.43c1.59 0 2.7-.001 3.536-.092c.813-.087 1.243-.248 1.55-.494s.506-.591.616-1.243c.091-.548.11-1.241.113-2.171h-8v2.028c0 .277 0 .416-.095.472s-.224-.006-.484-.13l-1.242-.593c-.088-.042-.132-.063-.179-.063s-.091.02-.179.063l-1.242.593c-.26.124-.39.186-.484.13C8 20.444 8 20.305 8 20.028z'/%3E%3Cpath fill='currentColor' d='M4.727 2.733c.306-.308.734-.508 1.544-.618C7.105 2.002 8.209 2 9.793 2h4.414c1.584 0 2.688.002 3.522.115c.81.11 1.238.31 1.544.618c.305.308.504.74.613 1.557c.112.84.114 1.955.114 3.552V18H7.426c-1.084 0-1.462.006-1.753.068c-.513.11-.96.347-1.285.667c-.11.108-.164.161-.291.505A1.3 1.3 0 0 0 4 19.7V7.842c0-1.597.002-2.711.114-3.552c.109-.816.308-1.249.613-1.557' opacity='.5'/%3E%3Cpath fill='currentColor' d='M7.25 7A.75.75 0 0 1 8 6.25h8a.75.75 0 0 1 0 1.5H8A.75.75 0 0 1 7.25 7M8 9.75a.75.75 0 0 0 0 1.5h5a.75.75 0 0 0 0-1.5z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:bookmark-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M21 11.098v4.993c0 3.096 0 4.645-.734 5.321c-.35.323-.792.526-1.263.58c-.987.113-2.14-.907-4.445-2.946c-1.02-.901-1.529-1.352-2.118-1.47a2.2 2.2 0 0 0-.88 0c-.59.118-1.099.569-2.118 1.47c-2.305 2.039-3.458 3.059-4.445 2.945a2.24 2.24 0 0 1-1.263-.579C3 20.736 3 19.188 3 16.091v-4.994C3 6.81 3 4.666 4.318 3.333S7.758 2 12 2s6.364 0 7.682 1.332S21 6.81 21 11.098' opacity='.5'/%3E%3Cpath fill='currentColor' d='M9 5.25a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:box-minimalistic-bold-duotone,[i-solar\:box-minimalistic-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M8.422 20.618C10.178 21.54 11.056 22 12 22V12L2.638 7.073l-.04.067C2 8.154 2 9.417 2 11.942v.117c0 2.524 0 3.787.597 4.801c.598 1.015 1.674 1.58 3.825 2.709z'/%3E%3Cpath fill='currentColor' d='m17.577 4.432l-2-1.05C13.822 2.461 12.944 2 12 2c-.945 0-1.822.46-3.578 1.382l-2 1.05C4.318 5.536 3.242 6.1 2.638 7.072L12 12l9.362-4.927c-.606-.973-1.68-1.537-3.785-2.641' opacity='.7'/%3E%3Cpath fill='currentColor' d='m21.403 7.14l-.041-.067L12 12v10c.944 0 1.822-.46 3.578-1.382l2-1.05c2.151-1.129 3.227-1.693 3.825-2.708c.597-1.014.597-2.277.597-4.8v-.117c0-2.525 0-3.788-.597-4.802' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:bug-bold-duotone,[i-solar\:bug-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M19 11.938V15a7 7 0 0 1-6.25 6.96V15a.75.75 0 0 0-1.5 0v6.96A7 7 0 0 1 5 15v-3.062A3.94 3.94 0 0 1 8.938 8h6.124A3.94 3.94 0 0 1 19 11.938' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='M19 14.75v-1.5h3a.75.75 0 0 1 0 1.5zm-1.504 4.586c.31-.393.58-.82.801-1.276l2.538 1.27a.75.75 0 1 1-.67 1.34zM5.703 18.06q.333.684.801 1.276l-2.669 1.335a.75.75 0 0 1-.67-1.342zM5 13.25H2a.75.75 0 0 0 0 1.5h3zm12.354-4.515l2.81-1.406a.75.75 0 1 1 .671 1.341L18.42 9.88a4 4 0 0 0-1.065-1.144M6.647 8.735c-.427.306-.79.695-1.067 1.144L3.165 8.67a.75.75 0 0 1 .67-1.341zM16.5 8.27V7.5a4.5 4.5 0 1 0-9 0v.77A3.9 3.9 0 0 1 8.938 8h6.124c.508 0 .993.096 1.438.27'/%3E%3Cpath fill='currentColor' d='M6.376 1.584a.75.75 0 0 0 .208 1.04l2.36 1.573a4.5 4.5 0 0 1 1.387-.877L7.416 1.376a.75.75 0 0 0-1.04.208m8.68 2.613a4.5 4.5 0 0 0-1.387-.877l2.915-1.944a.75.75 0 1 1 .832 1.248z' opacity='.5'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12 14.25a.75.75 0 0 1 .75.75v7h-1.5v-7a.75.75 0 0 1 .75-.75' clip-rule='evenodd'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:card-search-broken,[i-solar\:card-search-broken=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' d='M14 4c3.771 0 5.657 0 6.828 1.172S22 8.229 22 12v1M10 4C6.229 4 4.343 4 3.172 5.172S2 8.229 2 12s0 5.657 1.172 6.828S6.229 20 10 20h3m-3-4H6'/%3E%3Ccircle cx='18' cy='17' r='3'/%3E%3Cpath stroke-linecap='round' d='m20.5 19.5l1 1M2 10h5m15 0H11'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:check-circle-bold-duotone,[i-solar\:check-circle-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10' opacity='.5'/%3E%3Cpath fill='currentColor' d='M16.03 8.97a.75.75 0 0 1 0 1.06l-5 5a.75.75 0 0 1-1.06 0l-2-2a.75.75 0 1 1 1.06-1.06l1.47 1.47l2.235-2.235L14.97 8.97a.75.75 0 0 1 1.06 0'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:check-circle-line-duotone,[i-solar\:check-circle-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='10' opacity='.5'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m8.5 12.5l2 2l5-5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:close-circle-line-duotone,[i-solar\:close-circle-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='10' opacity='.5'/%3E%3Cpath stroke-linecap='round' d='m14.5 9.5l-5 5m0-5l5 5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:code-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M16.443 7.328a.75.75 0 0 1 1.059-.056l1.737 1.564c.737.663 1.347 1.212 1.767 1.71c.44.525.754 1.088.754 1.784c0 .695-.313 1.258-.754 1.782c-.42.499-1.03 1.049-1.767 1.711l-1.737 1.564a.75.75 0 1 1-1.004-1.115l1.697-1.527c.788-.709 1.319-1.19 1.663-1.598c.33-.393.402-.622.402-.817c0-.196-.072-.425-.402-.818c-.344-.409-.875-.889-1.663-1.598l-1.697-1.527a.75.75 0 0 1-.056-1.06m-8.94 1.06a.75.75 0 0 0-1.004-1.115L4.761 8.836c-.737.663-1.347 1.212-1.767 1.71c-.44.525-.754 1.088-.754 1.784c0 .695.313 1.258.754 1.782c.42.499 1.03 1.049 1.767 1.711l1.737 1.564a.75.75 0 1 0 1.004-1.115l-1.697-1.527c-.788-.709-1.319-1.19-1.663-1.598c-.33-.393-.402-.622-.402-.817c0-.196.072-.425.402-.818c.344-.409.875-.889 1.663-1.598z'/%3E%3Cpath fill='currentColor' d='M14.182 4.276a.75.75 0 0 1 .53.918l-3.974 14.83a.75.75 0 1 1-1.449-.389l3.974-14.83a.75.75 0 0 1 .919-.53' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:danger-triangle-bold-duotone,[i-solar\:danger-triangle-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M12 3c-2.31 0-3.77 2.587-6.688 7.762l-.364.644c-2.425 4.3-3.638 6.45-2.542 8.022S6.214 21 11.636 21h.728c5.422 0 8.134 0 9.23-1.572s-.117-3.722-2.542-8.022l-.364-.645C15.77 5.587 14.311 3 12 3' opacity='.5'/%3E%3Cpath fill='currentColor' d='M12 7.25a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0V8a.75.75 0 0 1 .75-.75M12 17a1 1 0 1 0 0-2a1 1 0 0 0 0 2'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:dialog-2-bold-duotone,[i-solar\:dialog-2-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='m10.404 22.48l.275-.465c.44-.745.66-1.117 1.012-1.325c.351-.207.81-.222 1.725-.252c.859-.027 1.436-.102 1.93-.306a4.24 4.24 0 0 0 2.295-2.296c.323-.779.323-1.767.323-3.743v-.848c0-2.777 0-4.165-.625-5.185c-.35-.57-.83-1.05-1.4-1.4c-1.02-.625-2.408-.625-5.185-.625H8.21c-2.777 0-4.165 0-5.185.625c-.57.35-1.05.83-1.4 1.4C1 9.08 1 10.468 1 13.245v.848c0 1.976 0 2.964.323 3.744a4.24 4.24 0 0 0 2.295 2.295c.494.204 1.07.28 1.93.306c.916.03 1.374.045 1.725.252c.35.208.571.58 1.012 1.325l.275.465c.41.692 1.434.692 1.844 0m2.789-7.963a1.06 1.06 0 1 0 0-2.12a1.06 1.06 0 0 0 0 2.12m-2.65-1.06a1.06 1.06 0 1 1-2.121 0a1.06 1.06 0 0 1 2.12 0m-4.772 1.06a1.06 1.06 0 1 0 0-2.12a1.06 1.06 0 0 0 0 2.12' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M15.486 1c1.267 0 2.274 0 3.082.077c.829.079 1.53.244 2.153.626a4.8 4.8 0 0 1 1.575 1.575c.383.624.548 1.325.627 2.153c.076.808.076 1.816.076 3.082v.866c0 .901 0 1.619-.04 2.2c-.04.595-.125 1.106-.323 1.584a4.77 4.77 0 0 1-2.67 2.617q-.21.082-.368.135h-1.65c.016-.499.016-1.093.016-1.822v-.848c0-2.777 0-4.165-.625-5.185c-.35-.57-.83-1.05-1.4-1.4c-1.02-.625-2.408-.625-5.185-.625H8.21c-.986 0-1.796 0-2.478.028v-1.65q.05-.17.13-.396q.133-.389.346-.739a4.8 4.8 0 0 1 1.576-1.575c.624-.382 1.324-.547 2.153-.626C10.745 1 11.752 1 13.019 1z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:document-text-linear{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M3 10c0-3.771 0-5.657 1.172-6.828S7.229 2 11 2h2c3.771 0 5.657 0 6.828 1.172S21 6.229 21 10v4c0 3.771 0 5.657-1.172 6.828S16.771 22 13 22h-2c-3.771 0-5.657 0-6.828-1.172S3 17.771 3 14z'/%3E%3Cpath stroke-linecap='round' d='M8 12h8M8 8h8m-8 8h5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:emoji-funny-square-bold-duotone,[i-solar\:emoji-funny-square-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M6.504 21.52c1.633.943 3.706.387 7.853-.724s6.22-1.666 7.163-3.3s.387-3.706-.724-7.853s-1.666-6.22-3.3-7.163s-3.706-.388-7.853.724c-4.147 1.11-6.22 1.666-7.163 3.3s-.388 3.706.724 7.853c1.11 4.147 1.666 6.22 3.3 7.163' opacity='.5'/%3E%3Cpath fill='currentColor' d='M14.898 11.224c.533-.143.792-.908.578-1.708s-.821-1.333-1.355-1.19c-.533.143-.792.907-.577 1.708c.214.8.82 1.333 1.354 1.19m-5.796 1.553c.534-.143.792-.908.578-1.708s-.82-1.333-1.354-1.19s-.792.907-.578 1.708s.82 1.333 1.354 1.19m-.917 2.974a.75.75 0 0 1 .91-.545c1.13.283 2.428.287 3.746-.066c1.318-.354 2.44-1.006 3.278-1.816a.75.75 0 1 1 1.043 1.078a8.4 8.4 0 0 1-1.15.928l.159.322a1.5 1.5 0 1 1-2.693 1.322l-.196-.4l-.053.014c-1.555.417-3.112.42-4.499.073a.75.75 0 0 1-.545-.91'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:eye-closed-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M2.919 6.605a1 1 0 0 0-1.838.79l.002.003l.003.007l.01.021l.032.072q.04.09.12.25c.105.21.262.506.47.857c.41.687 1.027 1.6 1.872 2.52l-.797.797a1 1 0 1 0 1.414 1.414l.84-.84c.565.455 1.197.885 1.897 1.256l-.782 1.202a1 1 0 0 0 1.676 1.091l.985-1.514c.677.208 1.402.355 2.177.425V16.5a1 1 0 0 0 1 1V13c-2.748 0-4.819-1.199-6.304-2.59l-.024-.022a12 12 0 0 1-.564-.569a13.4 13.4 0 0 1-1.67-2.237a12 12 0 0 1-.516-.968zm-1.838.79L2 7c-.92.394-.919.395-.919.395' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M15.22 12.398A8.7 8.7 0 0 1 12 13v4.5a1 1 0 0 0 1-1v-1.544c.772-.07 1.497-.217 2.176-.425l.986 1.515a1 1 0 0 0 1.676-1.091l-.782-1.203c.701-.37 1.332-.8 1.897-1.256l.84.84a1 1 0 1 0 1.414-1.414l-.797-.798a15.4 15.4 0 0 0 2.302-3.296a10 10 0 0 0 .19-.395l.011-.026l.004-.008l.002-.005a1 1 0 1 0-1.838-.788l-.005.011a5 5 0 0 1-.146.302a13 13 0 0 1-2.614 3.48c-.841.79-1.87 1.517-3.095 2' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:face-scan-circle-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M10.801 2.57a.71.71 0 0 1-.555.838a8.78 8.78 0 0 0-6.838 6.838a.71.71 0 1 1-1.394-.283a10.2 10.2 0 0 1 7.949-7.949a.71.71 0 0 1 .838.556M2.57 13.199a.71.71 0 0 1 .838.555a8.78 8.78 0 0 0 6.838 6.838a.71.71 0 1 1-.283 1.394a10.2 10.2 0 0 1-7.948-7.949a.71.71 0 0 1 .555-.838M13.199 2.57a.71.71 0 0 1 .838-.556a10.2 10.2 0 0 1 7.949 7.949a.711.711 0 0 1-1.394.283a8.78 8.78 0 0 0-6.838-6.838a.71.71 0 0 1-.555-.838m8.231 10.629a.71.71 0 0 1 .556.838a10.2 10.2 0 0 1-7.949 7.949a.711.711 0 0 1-.283-1.394a8.78 8.78 0 0 0 6.838-6.838a.71.71 0 0 1 .838-.555' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M12 19.583a7.583 7.583 0 1 0 0-15.166a7.583 7.583 0 0 0 0 15.166' opacity='.5'/%3E%3Cpath fill='currentColor' d='M8.94 14.539a.71.71 0 0 1 .995-.148c.59.437 1.3.69 2.065.69a3.45 3.45 0 0 0 2.065-.69a.71.71 0 1 1 .847 1.142a4.87 4.87 0 0 1-2.912.97a4.87 4.87 0 0 1-2.911-.97a.71.71 0 0 1-.148-.994m5.547-2.895c.458 0 .83-.557.83-1.244s-.372-1.244-.83-1.244s-.83.557-.83 1.244s.372 1.244.83 1.244m-4.976 0c.458 0 .83-.557.83-1.244s-.372-1.244-.83-1.244s-.83.557-.83 1.244s.372 1.244.83 1.244'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:filters-bold-duotone,[i-solar\:filters-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M18 8A6 6 0 1 1 6 8a6 6 0 0 1 12 0'/%3E%3Cpath fill='currentColor' d='M13.58 13.79a6 6 0 0 1-7.16-3.58a6 6 0 1 0 7.16 3.58' opacity='.7'/%3E%3Cpath fill='currentColor' d='M13.58 13.79c.271.684.42 1.43.42 2.21a6 6 0 0 1-2 4.472a6 6 0 1 0 5.58-10.262a6.01 6.01 0 0 1-4 3.58' opacity='.4'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:ghost-bold-duotone,[i-solar\:ghost-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M22 19.206V12c0-5.523-4.477-10-10-10S2 6.477 2 12v7.206a1.727 1.727 0 0 0 2.5 1.544a2.89 2.89 0 0 1 2.896.18a2.89 2.89 0 0 0 3.208 0l.353-.234a1.88 1.88 0 0 1 2.086 0l.353.235a2.89 2.89 0 0 0 3.208 0a2.89 2.89 0 0 1 2.897-.18A1.727 1.727 0 0 0 22 19.206' opacity='.5'/%3E%3Cpath fill='currentColor' d='M15 12c.552 0 1-.672 1-1.5S15.552 9 15 9s-1 .672-1 1.5s.448 1.5 1 1.5m-5-1.5c0 .828-.448 1.5-1 1.5s-1-.672-1-1.5S8.448 9 9 9s1 .672 1 1.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:info-circle-line-duotone,[i-solar\:info-circle-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none'%3E%3Ccircle cx='12' cy='12' r='10' stroke='currentColor' stroke-width='1.5' opacity='.5'/%3E%3Cpath stroke='currentColor' stroke-linecap='round' stroke-width='1.5' d='M12 17v-6'/%3E%3Ccircle cx='1' cy='1' r='1' fill='currentColor' transform='matrix(1 0 0 -1 11 9)'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:layers-bold-duotone,[i-solar\:layers-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M4.979 9.685C2.993 8.891 2 8.494 2 8s.993-.89 2.979-1.685l2.808-1.123C9.773 4.397 10.767 4 12 4s2.227.397 4.213 1.192l2.808 1.123C21.007 7.109 22 7.506 22 8s-.993.89-2.979 1.685l-2.808 1.124C14.227 11.603 13.233 12 12 12s-2.227-.397-4.213-1.191z'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M2 8c0 .494.993.89 2.979 1.685l2.808 1.124C9.773 11.603 10.767 12 12 12s2.227-.397 4.213-1.191l2.808-1.124C21.007 8.891 22 8.494 22 8s-.993-.89-2.979-1.685l-2.808-1.123C14.227 4.397 13.233 4 12 4s-2.227.397-4.213 1.192L4.98 6.315C2.993 7.109 2 7.506 2 8' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='m5.766 10l-.787.315C2.993 11.109 2 11.507 2 12s.993.89 2.979 1.685l2.808 1.124C9.773 15.603 10.767 16 12 16s2.227-.397 4.213-1.191l2.808-1.124C21.007 12.891 22 12.493 22 12s-.993-.89-2.979-1.685L18.234 10l-2.021.809C14.227 11.603 13.233 12 12 12s-2.227-.397-4.213-1.191z' opacity='.7'/%3E%3Cpath fill='currentColor' d='m5.766 14l-.787.315C2.993 15.109 2 15.507 2 16s.993.89 2.979 1.685l2.808 1.124C9.773 19.603 10.767 20 12 20s2.227-.397 4.213-1.192l2.808-1.123C21.007 16.891 22 16.494 22 16c0-.493-.993-.89-2.979-1.685L18.234 14l-2.021.809C14.227 15.603 13.233 16 12 16s-2.227-.397-4.213-1.191z' opacity='.4'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:leaf-bold-duotone,[i-solar\:leaf-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12 22c-4.418 0-8-3.646-8-8.143c0-4.462 2.553-9.67 6.537-11.531A3.45 3.45 0 0 1 12 2z' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M13.463 2.326A3.45 3.45 0 0 0 12 2v7l4.432-4.432c-.863-.947-1.86-1.724-2.97-2.242' opacity='.3'/%3E%3Cpath fill='currentColor' d='M12 9v5.5l6.614-6.614c-.572-1.22-1.308-2.357-2.182-3.318z' opacity='.4'/%3E%3Cpath fill='currentColor' d='m12 19.5l7.811-7.811a15 15 0 0 0-1.197-3.803L12 14.5z' opacity='.6'/%3E%3Cpath fill='currentColor' d='M19.811 11.689L12 19.5V22c4.418 0 8-3.646 8-8.143c0-.71-.064-1.438-.189-2.168' opacity='.7'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:magic-stick-2-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M16.714 2.127c-.836-.43-1.922.263-4.095 1.65l-.562.36c-.618.394-.927.591-1.273.648c-.347.056-.692-.034-1.382-.215l-.628-.164C6.345 3.769 5.13 3.45 4.436 4.13s-.412 1.908.157 4.363l.147.635c.161.697.242 1.046.177 1.393c-.066.346-.27.65-.68 1.26l-.372.555c-1.439 2.145-2.158 3.217-1.753 4.067c.406.85 1.668.915 4.192 1.045l.654.033c.717.037 1.076.056 1.382.213c.306.158.524.436.962.994l.398.507c1.539 1.962 2.309 2.943 3.255 2.788c.945-.154 1.441-1.342 2.433-3.717l.257-.614c.282-.675.422-1.012.677-1.261c.255-.25.595-.382 1.274-.647l.618-.24c2.39-.933 3.586-1.4 3.765-2.345s-.777-1.744-2.688-3.342l-.495-.413c-.543-.454-.815-.68-.963-.992s-.158-.672-.175-1.393l-.016-.657c-.062-2.538-.093-3.806-.928-4.236'/%3E%3Cpath fill='currentColor' d='M15.93 16.991c.127-.268.239-.45.392-.6c.172-.167.382-.282.71-.42l4.498 4.499a.75.75 0 0 1-1.06 1.06z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:magic-stick-3-bold-duotone,[i-solar\:magic-stick-3-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M3.845 3.845a2.883 2.883 0 0 0 0 4.077L5.432 9.51c.012-.014.555.503.568.49l4-4c.013-.013-.504-.556-.49-.568L7.922 3.845a2.883 2.883 0 0 0-4.077 0m1.288 11.462a.483.483 0 0 1 .9 0l.157.4a.48.48 0 0 0 .272.273l.398.157a.486.486 0 0 1 0 .903l-.398.158a.48.48 0 0 0-.272.273l-.157.4a.483.483 0 0 1-.9 0l-.157-.4a.48.48 0 0 0-.272-.273l-.398-.158a.486.486 0 0 1 0-.903l.398-.157a.48.48 0 0 0 .272-.274z' opacity='.5'/%3E%3Cpath fill='currentColor' d='M19.967 9.13a.483.483 0 0 1 .9 0l.156.399c.05.125.148.224.273.273l.398.158a.486.486 0 0 1 0 .902l-.398.158a.5.5 0 0 0-.273.273l-.156.4a.483.483 0 0 1-.9 0l-.157-.4a.5.5 0 0 0-.272-.273l-.398-.158a.486.486 0 0 1 0-.902l.398-.158a.5.5 0 0 0 .272-.273z' opacity='.2'/%3E%3Cpath fill='currentColor' d='M16.1 2.307a.483.483 0 0 1 .9 0l.43 1.095a.48.48 0 0 0 .272.274l1.091.432a.486.486 0 0 1 0 .903l-1.09.432a.5.5 0 0 0-.273.273L17 6.81a.483.483 0 0 1-.9 0l-.43-1.095a.5.5 0 0 0-.273-.273l-1.09-.432a.486.486 0 0 1 0-.903l1.09-.432a.5.5 0 0 0 .273-.274z' opacity='.7'/%3E%3Cpath fill='currentColor' d='M10.568 6.49c-.012.014-.555-.503-.568-.49l-4 4c-.013.013.504.556.49.568l9.588 9.587a2.883 2.883 0 1 0 4.078-4.077z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:magnifer-line-duotone,[i-solar\:magnifer-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cdefs%3E%3Cmask id='solarMagniferLineDuotone0'%3E%3Cg fill='none' stroke-width='1.5'%3E%3Ccircle cx='11.5' cy='11.5' r='9.5' stroke='gray'/%3E%3Cpath stroke='%23fff' stroke-linecap='round' d='M18.5 18.5L22 22'/%3E%3C/g%3E%3C/mask%3E%3C/defs%3E%3Cpath fill='currentColor' d='M0 0h24v24H0z' mask='url(%23solarMagniferLineDuotone0)'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:microphone-2-bold-duotone,[i-solar\:microphone-2-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M4 9a.75.75 0 0 1 .75.75v1a7.25 7.25 0 1 0 14.5 0v-1a.75.75 0 0 1 1.5 0v1a8.75 8.75 0 0 1-8 8.718v2.282a.75.75 0 0 1-1.5 0v-2.282a8.75 8.75 0 0 1-8-8.718v-1A.75.75 0 0 1 4 9' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M9.75 7.75A.75.75 0 0 0 9 7H6.298a5.751 5.751 0 0 1 11.404 0H13.5a.75.75 0 0 0 0 1.5h4.25V10H13.5a.75.75 0 0 0 0 1.5h4.201a5.751 5.751 0 0 1-11.403 0H9A.75.75 0 0 0 9 10H6.25V8.5H9a.75.75 0 0 0 .75-.75' opacity='.5'/%3E%3Cpath fill='currentColor' d='M12.75 10.75c0 .414.336.75.75.75h4.201l.049-1.5H13.5a.75.75 0 0 0-.75.75m0-3c0 .414.336.75.75.75h4.25L17.701 7H13.5a.75.75 0 0 0-.75.75m-3 0A.75.75 0 0 0 9 7H6.298L6.25 8.5H9a.75.75 0 0 0 .75-.75m0 3A.75.75 0 0 0 9 10H6.25l.048 1.5H9a.75.75 0 0 0 .75-.75'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:microphone-3-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M4 9a.75.75 0 0 1 .75.75v1a7.25 7.25 0 1 0 14.5 0v-1a.75.75 0 0 1 1.5 0v1a8.75 8.75 0 0 1-8 8.718v2.282a.75.75 0 0 1-1.5 0v-2.282a8.75 8.75 0 0 1-8-8.718v-1A.75.75 0 0 1 4 9' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12 2a5.75 5.75 0 0 0-5.75 5.75v3a5.75 5.75 0 0 0 11.5 0v-3A5.75 5.75 0 0 0 12 2m2 9.5a.75.75 0 0 0 0-1.5h-4a.75.75 0 0 0 0 1.5zm-.25-3.75a.75.75 0 0 1-.75.75h-2A.75.75 0 0 1 11 7h2a.75.75 0 0 1 .75.75' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='M14 11.5a.75.75 0 0 0 0-1.5h-4a.75.75 0 0 0 0 1.5zm-1-3A.75.75 0 0 0 13 7h-2a.75.75 0 0 0 0 1.5z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:minus-circle-line-duotone,[i-solar\:minus-circle-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='10' opacity='.5'/%3E%3Cpath stroke-linecap='round' d='M15 12H9'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:moon-stars-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M19.9 2.307a.483.483 0 0 0-.9 0l-.43 1.095a.48.48 0 0 1-.272.274l-1.091.432a.486.486 0 0 0 0 .903l1.091.432a.48.48 0 0 1 .272.273L19 6.81c.162.41.74.41.9 0l.43-1.095a.48.48 0 0 1 .273-.273l1.091-.432a.486.486 0 0 0 0-.903l-1.091-.432a.48.48 0 0 1-.273-.274zM16.033 8.13a.483.483 0 0 0-.9 0l-.157.399a.48.48 0 0 1-.272.273l-.398.158a.486.486 0 0 0 0 .903l.398.157c.125.05.223.148.272.274l.157.399c.161.41.739.41.9 0l.157-.4a.48.48 0 0 1 .272-.273l.398-.157a.486.486 0 0 0 0-.903l-.398-.158a.48.48 0 0 1-.272-.273z'/%3E%3Cpath fill='currentColor' d='M12 22c5.523 0 10-4.477 10-10c0-.463-.694-.54-.933-.143a6.5 6.5 0 1 1-8.924-8.924C12.54 2.693 12.463 2 12 2C6.477 2 2 6.477 2 12s4.477 10 10 10' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:notes-linear{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='m20.312 12.647l.517-1.932c.604-2.255.907-3.382.68-4.358a4 4 0 0 0-1.162-2.011c-.731-.685-1.859-.987-4.114-1.591c-2.255-.605-3.383-.907-4.358-.68a4 4 0 0 0-2.011 1.162c-.587.626-.893 1.543-1.348 3.209l-.244.905l-.517 1.932c-.605 2.255-.907 3.382-.68 4.358a4 4 0 0 0 1.162 2.011c.731.685 1.859.987 4.114 1.592c2.032.544 3.149.843 4.064.73q.15-.019.294-.052a4 4 0 0 0 2.011-1.16c.685-.732.987-1.86 1.592-4.115Z'/%3E%3Cpath d='M16.415 17.974a4 4 0 0 1-1.068 1.678c-.731.685-1.859.987-4.114 1.591s-3.383.907-4.358.679a4 4 0 0 1-2.011-1.161c-.685-.731-.988-1.859-1.592-4.114l-.517-1.932c-.605-2.255-.907-3.383-.68-4.358a4 4 0 0 1 1.162-2.011c.731-.685 1.859-.987 4.114-1.592q.638-.172 1.165-.309'/%3E%3Cpath stroke-linecap='round' d='m11.777 10l4.83 1.294M11 12.898l2.898.776'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:pallete-2-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M10.847 21.934C5.867 21.362 2 17.133 2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.157-3.283 4.733-6.086 4.37c-1.618-.209-3.075-.397-3.652.518c-.395.626.032 1.406.555 1.929a1.673 1.673 0 0 1 0 2.366c-.523.523-1.235.836-1.97.751' opacity='.5'/%3E%3Cpath fill='currentColor' d='M11.085 7a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0M6.5 13a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m11 0a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m-3-4.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:pause-circle-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10' opacity='.5'/%3E%3Cpath fill='currentColor' d='M8.076 8.617C8 8.801 8 9.034 8 9.5v5c0 .466 0 .699.076.883a1 1 0 0 0 .541.54c.184.077.417.077.883.077s.699 0 .883-.076a1 1 0 0 0 .54-.541c.077-.184.077-.417.077-.883v-5c0-.466 0-.699-.076-.883a1 1 0 0 0-.541-.54C10.199 8 9.966 8 9.5 8s-.699 0-.883.076a1 1 0 0 0-.54.541m4.999 0C13 8.801 13 9.034 13 9.5v5c0 .466 0 .699.076.883a1 1 0 0 0 .541.54c.184.077.417.077.883.077s.699 0 .883-.076a1 1 0 0 0 .54-.541c.077-.184.077-.417.077-.883v-5c0-.466 0-.699-.076-.883a1 1 0 0 0-.541-.54C15.199 8 14.966 8 14.5 8s-.699 0-.883.076a1 1 0 0 0-.54.541'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:people-nearby-bold-duotone,[i-solar\:people-nearby-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M19.717 20.362C21.143 19.585 22 18.587 22 17.5c0-1.152-.963-2.204-2.546-3C17.623 13.58 14.962 13 12 13s-5.623.58-7.454 1.5C2.963 15.296 2 16.348 2 17.5s.963 2.204 2.546 3C6.377 21.42 9.038 22 12 22c3.107 0 5.882-.637 7.717-1.638' opacity='.6'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M9.25 4a2.75 2.75 0 1 1 5.5 0a2.75 2.75 0 0 1-5.5 0' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='m8.223 11.574l-2.175-.725a1.532 1.532 0 0 1 .805-2.952l1.898.407l.21.044a15 15 0 0 0 6.288-.044l1.897-.407a1.532 1.532 0 0 1 .806 2.952l-2.175.725c-.263.088-.394.132-.493.193a1 1 0 0 0-.466.986c.016.115.066.244.165.503l1.247 3.242a1.473 1.473 0 0 1-2.654 1.26L12 15l-1.576 2.757a1.473 1.473 0 0 1-2.654-1.26l1.247-3.241c.1-.259.149-.388.165-.503a1 1 0 0 0-.466-.986c-.099-.061-.23-.105-.493-.193'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:play-circle-bold-duotone,[i-solar\:play-circle-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='m15.414 13.059l-4.72 2.787C9.934 16.294 9 15.71 9 14.786V9.214c0-.924.934-1.507 1.694-1.059l4.72 2.787c.781.462.781 1.656 0 2.118'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:play-circle-broken{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M13.888 9.935C14.963 10.812 15.5 11.25 15.5 12s-.537 1.188-1.612 2.065c-.297.242-.591.47-.862.66c-.237.167-.506.339-.784.508c-1.073.652-1.609.978-2.09.617c-.48-.36-.524-1.116-.612-2.628c-.024-.427-.04-.846-.04-1.222s.016-.795.04-1.222c.088-1.512.132-2.267.612-2.628c.481-.361 1.018-.035 2.09.617c.278.169.547.341.784.508c.27.19.565.418.862.66Z'/%3E%3Cpath stroke-linecap='round' d='M7 3.338A9.95 9.95 0 0 1 12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12c0-1.821.487-3.53 1.338-5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:refresh-bold-duotone,[i-solar\:refresh-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M12.079 2.25c-4.794 0-8.734 3.663-9.118 8.333H2a.75.75 0 0 0-.528 1.283l1.68 1.666a.75.75 0 0 0 1.056 0l1.68-1.666a.75.75 0 0 0-.528-1.283h-.893c.38-3.831 3.638-6.833 7.612-6.833a7.66 7.66 0 0 1 6.537 3.643a.75.75 0 1 0 1.277-.786A9.16 9.16 0 0 0 12.08 2.25'/%3E%3Cpath fill='currentColor' d='M20.841 10.467a.75.75 0 0 0-1.054 0L18.1 12.133a.75.75 0 0 0 .527 1.284h.899c-.381 3.83-3.651 6.833-7.644 6.833a7.7 7.7 0 0 1-6.565-3.644a.75.75 0 1 0-1.276.788a9.2 9.2 0 0 0 7.84 4.356c4.809 0 8.766-3.66 9.151-8.333H22a.75.75 0 0 0 .527-1.284z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:running-2-line-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none'%3E%3Ccircle cx='18.5' cy='4.5' r='2.5' stroke='currentColor' stroke-width='1.5' opacity='.5'/%3E%3Cpath stroke='currentColor' stroke-linecap='round' stroke-width='1.5' d='m9 17l-1 1.2c-.738.886-1.107 1.328-1.61 1.564S5.31 20 4.157 20H3'/%3E%3Cpath fill='currentColor' d='M13.65 22a.75.75 0 0 0 1.5 0zm-1.085-5.754l.453-.598zm1.184 1.015l.587-.466zm.557 1.12l.727-.186zm-.802-6.826a.75.75 0 0 0-1.009-1.11zm-2.652 1.61l.703.26zm.07 1.555l-.677.323zm2.728 5.219v2.06h1.5v-2.06zm-1.538-3.095c.663.502.887.679 1.05.884l1.174-.934c-.308-.387-.717-.69-1.319-1.146zm3.038 3.095c0-.755.006-1.264-.117-1.744l-1.453.373c.065.254.07.538.07 1.37zm-1.988-2.211c.197.247.339.534.417.84l1.454-.373a3.75 3.75 0 0 0-.697-1.4zm-.667-7.283c-.42.381-.945.836-1.354 1.224c-.21.198-.41.398-.573.586c-.149.172-.327.4-.42.649l1.407.521c-.007.021.014-.035.146-.187c.116-.134.276-.295.471-.48c.4-.38.865-.778 1.332-1.203zm.523 5.203c-.488-.37-.818-.62-1.056-.832c-.233-.208-.32-.33-.363-.418l-1.354.645c.167.35.423.63.72.894c.292.26.679.552 1.147.907zm-2.87-2.744a2.75 2.75 0 0 0 .097 2.139l1.354-.645a1.25 1.25 0 0 1-.044-.973z' opacity='.5'/%3E%3Cpath fill='currentColor' d='m5.436 8.82l-.37-.652zm-1.807.164a.75.75 0 1 0 .742 1.304zm9.778-1.627l-.286.693zm-2.96-.715l-.055-.748zM21 12.75a.75.75 0 1 0 0-1.5zm-5.232-3.213l-.67.335zM5.065 8.168l-1.436.816l.742 1.304l1.435-.816zm8.627-1.505c-1.344-.553-2.08-.857-3.3-.769l.11 1.496c.823-.06 1.255.099 2.62.66zm-7.886 2.81c2.502-1.422 3.552-2 4.695-2.083l-.109-1.496c-1.56.114-2.949.923-5.327 2.274zm13.949 3.276H21v-1.5h-1.245zm-4.658-2.878a5.21 5.21 0 0 0 4.658 2.878v-1.5A3.71 3.71 0 0 1 16.439 9.2zm1.342-.67a5.33 5.33 0 0 0-2.747-2.538l-.57 1.387c.86.354 1.564 1 1.975 1.821z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:settings-bold-duotone,[i-solar\:settings-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M14.279 2.152C13.909 2 13.439 2 12.5 2s-1.408 0-1.779.152a2 2 0 0 0-1.09 1.083c-.094.223-.13.484-.145.863a1.62 1.62 0 0 1-.796 1.353a1.64 1.64 0 0 1-1.579.008c-.338-.178-.583-.276-.825-.308a2.03 2.03 0 0 0-1.49.396c-.318.242-.553.646-1.022 1.453c-.47.807-.704 1.21-.757 1.605c-.07.526.074 1.058.4 1.479c.148.192.357.353.68.555c.477.297.783.803.783 1.361s-.306 1.064-.782 1.36c-.324.203-.533.364-.682.556a2 2 0 0 0-.399 1.479c.053.394.287.798.757 1.605s.704 1.21 1.022 1.453c.424.323.96.465 1.49.396c.242-.032.487-.13.825-.308a1.64 1.64 0 0 1 1.58.008c.486.28.774.795.795 1.353c.015.38.051.64.145.863c.204.49.596.88 1.09 1.083c.37.152.84.152 1.779.152s1.409 0 1.779-.152a2 2 0 0 0 1.09-1.083c.094-.223.13-.483.145-.863c.02-.558.309-1.074.796-1.353a1.64 1.64 0 0 1 1.579-.008c.338.178.583.276.825.308c.53.07 1.066-.073 1.49-.396c.318-.242.553-.646 1.022-1.453c.47-.807.704-1.21.757-1.605a2 2 0 0 0-.4-1.479c-.148-.192-.357-.353-.68-.555c-.477-.297-.783-.803-.783-1.361s.306-1.064.782-1.36c.324-.203.533-.364.682-.556a2 2 0 0 0 .399-1.479c-.053-.394-.287-.798-.757-1.605s-.704-1.21-1.022-1.453a2.03 2.03 0 0 0-1.49-.396c-.242.032-.487.13-.825.308a1.64 1.64 0 0 1-1.58-.008a1.62 1.62 0 0 1-.795-1.353c-.015-.38-.051-.64-.145-.863a2 2 0 0 0-1.09-1.083' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='M15.523 12c0 1.657-1.354 3-3.023 3s-3.023-1.343-3.023-3S10.83 9 12.5 9s3.023 1.343 3.023 3'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:settings-minimalistic-bold-duotone,[i-solar\:settings-minimalistic-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12.428 2c-1.114 0-2.129.6-4.157 1.802l-.686.406C5.555 5.41 4.542 6.011 3.985 7c-.557.99-.557 2.19-.557 4.594v.812c0 2.403 0 3.605.557 4.594s1.57 1.59 3.6 2.791l.686.407C10.299 21.399 11.314 22 12.428 22s2.128-.6 4.157-1.802l.686-.407c2.028-1.2 3.043-1.802 3.6-2.791c.557-.99.557-2.19.557-4.594v-.812c0-2.403 0-3.605-.557-4.594s-1.572-1.59-3.6-2.792l-.686-.406C14.555 2.601 13.542 2 12.428 2' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='M12.428 8.25a3.75 3.75 0 1 0 0 7.5a3.75 3.75 0 0 0 0-7.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:star-fall-2-bold-duotone,[i-solar\:star-fall-2-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M11.58 4.776c.695-1.77 1.043-2.656 1.769-2.765c.726-.11 1.35.63 2.6 2.109l.323.382c.355.42.532.63.774.75c.24.12.518.137 1.074.17l.506.029c1.955.114 2.932.172 3.271.81c.34.64-.184 1.438-1.231 3.033l-.271.413c-.298.453-.447.68-.487.939s.033.52.179 1.043l.133.477c.513 1.842.77 2.762.253 3.266c-.517.505-1.465.258-3.361-.235l-.49-.127c-.54-.14-.809-.21-1.075-.17s-.499.185-.964.476l-.424.265c-1.638 1.024-2.456 1.536-3.115 1.208c-.659-.327-.72-1.277-.845-3.177l-.033-.492c-.035-.54-.053-.81-.177-1.044s-.34-.406-.774-.75l-.395-.312C7.294 9.865 6.53 9.26 6.64 8.554s1.02-1.047 2.839-1.729l.47-.176c.518-.194.776-.29.965-.475c.19-.185.288-.437.486-.94z'/%3E%3Cpath fill='currentColor' d='M5.31 9.593C2.873 11.92 1.275 15.806 2.331 22c.943-2.603 3.526-4.76 6.581-6.047c-.106-.593-.154-1.317-.204-2.08l-.039-.595a22 22 0 0 0-.032-.43l-.086-.071l-.268-.215l-.475-.376c-.694-.55-1.34-1.06-1.783-1.532c-.253-.269-.536-.624-.715-1.061m5.037 5.83l-.015-.114l.056.101z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:stop-circle-bold-duotone,[i-solar\:stop-circle-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10' opacity='.5'/%3E%3Cpath fill='currentColor' d='M8.586 8.586C8 9.172 8 10.114 8 12s0 2.828.586 3.414S10.114 16 12 16s2.828 0 3.414-.586S16 13.886 16 12s0-2.828-.586-3.414S13.886 8 12 8s-2.828 0-3.414.586'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:sun-fog-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M7.25 22a.75.75 0 0 1 .75-.75h8a.75.75 0 0 1 0 1.5H8a.75.75 0 0 1-.75-.75M12 1.25a.75.75 0 0 1 .75.75v1a.75.75 0 0 1-1.5 0V2a.75.75 0 0 1 .75-.75M1.25 12a.75.75 0 0 1 .75-.75h1a.75.75 0 0 1 0 1.5H2a.75.75 0 0 1-.75-.75m19 0a.75.75 0 0 1 .75-.75h1a.75.75 0 0 1 0 1.5h-1a.75.75 0 0 1-.75-.75M6.083 15.25H2a.75.75 0 0 0 0 1.5h20a.75.75 0 0 0 0-1.5z' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M4.25 19a.75.75 0 0 1 .75-.75h14a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75m.148-14.602a.75.75 0 0 1 1.061 0l.393.393a.75.75 0 0 1-1.06 1.06l-.394-.392a.75.75 0 0 1 0-1.06m15.202 0a.75.75 0 0 1 0 1.06l-.392.393a.75.75 0 0 1-1.06-1.06l.392-.393a.75.75 0 0 1 1.06 0M5.25 12c0 1.178.302 2.286.833 3.25h11.834A6.75 6.75 0 1 0 5.25 12' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:trash-bin-trash-linear,[i-solar\:trash-bin-trash-linear=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' d='M20.5 6h-17m15.333 2.5l-.46 6.9c-.177 2.654-.265 3.981-1.13 4.79s-2.196.81-4.856.81h-.774c-2.66 0-3.991 0-4.856-.81c-.865-.809-.954-2.136-1.13-4.79l-.46-6.9M9.5 11l.5 5m4.5-5l-.5 5'/%3E%3Cpath d='M6.5 6h.11a2 2 0 0 0 1.83-1.32l.034-.103l.097-.291c.083-.249.125-.373.18-.479a1.5 1.5 0 0 1 1.094-.788C9.962 3 10.093 3 10.355 3h3.29c.262 0 .393 0 .51.019a1.5 1.5 0 0 1 1.094.788c.055.106.097.23.18.479l.097.291A2 2 0 0 0 17.5 6'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:tuning-square-linear{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2s7.071 0 8.535 1.464C22 4.93 22 7.286 22 12s0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Z'/%3E%3Ccircle cx='8' cy='10' r='2'/%3E%3Ccircle cx='2' cy='2' r='2' transform='matrix(1 0 0 -1 14 16)'/%3E%3Cpath stroke-linecap='round' d='M8 14v5m8-9V5M8 5v1m8 13v-1'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:upload-minimalistic-bold,[i-solar\:upload-minimalistic-bold=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M12.554 2.494a.75.75 0 0 0-1.107 0l-4 4.375A.75.75 0 0 0 8.553 7.88l2.696-2.95V16a.75.75 0 0 0 1.5 0V4.932l2.697 2.95a.75.75 0 1 0 1.107-1.013z'/%3E%3Cpath fill='currentColor' d='M3.75 15a.75.75 0 0 0-1.5 0v.055c0 1.367 0 2.47.117 3.337c.12.9.38 1.658.981 2.26c.602.602 1.36.86 2.26.982c.867.116 1.97.116 3.337.116h6.11c1.367 0 2.47 0 3.337-.116c.9-.122 1.658-.38 2.26-.982s.86-1.36.982-2.26c.116-.867.116-1.97.116-3.337V15a.75.75 0 0 0-1.5 0c0 1.435-.002 2.436-.103 3.192c-.099.734-.28 1.122-.556 1.399c-.277.277-.665.457-1.4.556c-.755.101-1.756.103-3.191.103H9c-1.435 0-2.437-.002-3.192-.103c-.734-.099-1.122-.28-1.399-.556c-.277-.277-.457-.665-.556-1.4c-.101-.755-.103-1.756-.103-3.191'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:upload-square-line-duotone,[i-solar\:upload-square-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 17v-7m0 0l3 3m-3-3l-3 3'/%3E%3Cpath stroke-linecap='round' d='M16 7H8'/%3E%3Cpath d='M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2s7.071 0 8.535 1.464C22 4.93 22 7.286 22 12s0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Z' opacity='.5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:user-rounded-linear{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='6' r='4'/%3E%3Cellipse cx='12' cy='17' rx='7' ry='4'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:user-speak-rounded-bold-duotone,[i-solar\:user-speak-rounded-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Ccircle cx='10' cy='6.75' r='4' fill='currentColor'/%3E%3Cellipse cx='10' cy='17.75' fill='currentColor' opacity='.5' rx='7' ry='4'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M18.357 2.364a.75.75 0 0 1 1.029-.257L19 2.75l.386-.643h.001l.002.002l.004.002l.01.006l.113.076c.07.049.166.12.277.212c.222.185.512.462.802.838c.582.758 1.155 1.914 1.155 3.507s-.573 2.75-1.155 3.507c-.29.376-.58.653-.802.838a4 4 0 0 1-.363.27l-.028.018l-.01.006l-.003.002l-.002.001s-.001.001-.387-.642l.386.643a.75.75 0 0 1-.776-1.283l.005-.004l.041-.027q.06-.042.177-.136c.152-.128.362-.326.573-.6c.417-.542.844-1.386.844-2.593s-.427-2.05-.844-2.593a3.8 3.8 0 0 0-.573-.6a3 3 0 0 0-.218-.163l-.005-.003a.75.75 0 0 1-.253-1.027' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M16.33 4.415a.75.75 0 0 1 1.006-.336L17 4.75l.336-.67h.001l.002.001l.004.002l.008.004l.022.012a2 2 0 0 1 .233.153c.136.102.31.254.48.467c.349.436.664 1.099.664 2.031s-.316 1.595-.664 2.031a2.7 2.7 0 0 1-.654.586l-.06.034l-.02.012l-.01.004l-.003.002l-.002.001l-.33-.657l.329.658a.75.75 0 0 1-.685-1.335l.003-.001l.052-.036c.052-.04.13-.106.209-.205c.15-.189.335-.526.335-1.094s-.184-.905-.335-1.094a1.2 1.2 0 0 0-.261-.24l-.003-.002a.75.75 0 0 1-.322-1' clip-rule='evenodd'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-svg-spinners\:bouncing-ball,[i-svg-spinners\:bouncing-ball=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cellipse cx='12' cy='5' fill='currentColor' rx='4' ry='4'%3E%3Canimate id='svgSpinnersBouncingBall0' fill='freeze' attributeName='cy' begin='0;svgSpinnersBouncingBall2.end' calcMode='spline' dur='0.375s' keySplines='.33,0,.66,.33' values='5;20'/%3E%3Canimate attributeName='rx' begin='svgSpinnersBouncingBall0.end' calcMode='spline' dur='0.05s' keySplines='.33,0,.66,.33;.33,.66,.66,1' values='4;4.8;4'/%3E%3Canimate attributeName='ry' begin='svgSpinnersBouncingBall0.end' calcMode='spline' dur='0.05s' keySplines='.33,0,.66,.33;.33,.66,.66,1' values='4;3;4'/%3E%3Canimate id='svgSpinnersBouncingBall1' attributeName='cy' begin='svgSpinnersBouncingBall0.end' calcMode='spline' dur='0.025s' keySplines='.33,0,.66,.33' values='20;20.5'/%3E%3Canimate id='svgSpinnersBouncingBall2' attributeName='cy' begin='svgSpinnersBouncingBall1.end' calcMode='spline' dur='0.4s' keySplines='.33,.66,.66,1' values='20.5;5'/%3E%3C/ellipse%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-vscode-icons\:file-type-minecraft{background:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 32 32' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='%2352a535' d='M30 2H2v28h28z'/%3E%3Cpath fill='%2386d562' d='M24.4 13.2h-5.6v.47h5.6zm-5.6 8.4h-5.6v.47h5.6zm2.8 2.8h-2.8v.47h2.8zm-8.4 0h-2.8v.47h2.8zm0-11.2H7.6v.47h5.6z'/%3E%3Cpath d='M24.4 13.2V7.6h-5.6v5.6h-5.6V16h-2.8v8.4h2.8v-2.8h5.6v2.8h2.8V16h-2.8v-2.8zM13.2 7.6H7.6v5.6h5.6z'/%3E%3Cpath fill='%232a641c' d='M24.4 7.6h-5.6v.47h5.6zm-5.6 5.6h-5.6v.47h5.6zm-5.6-5.6H7.6v.47h5.6zm0 8.4h-2.8v.47h2.8zm8.4 0h-2.8v.47h2.8z'/%3E%3C/svg%3E") no-repeat;background-size:100% 100%;background-color:transparent;width:1.2em;height:1.2em}.prose :where(h1,h2,h3,h4,h5,h6):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-headings);font-weight:600;line-height:1.25}.prose :where(a):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-links);text-decoration:underline;font-weight:500}.prose :where(a code):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-links)}.prose :where(p,ul,ol,pre):not(:where(.not-prose,.not-prose *)){margin:1em 0;line-height:1.75}.prose :where(blockquote):not(:where(.not-prose,.not-prose *)){margin:1em 0;padding-left:1em;font-style:italic;border-left:.25em solid var(--un-prose-borders)}.prose :where(h1):not(:where(.not-prose,.not-prose *)){margin:1rem 0;font-size:2.25em}.prose :where(h2):not(:where(.not-prose,.not-prose *)){margin:1.75em 0 .5em;font-size:1.75em}.prose :where(h3):not(:where(.not-prose,.not-prose *)){margin:1.5em 0 .5em;font-size:1.375em}.prose :where(h4):not(:where(.not-prose,.not-prose *)){margin:1em 0;font-size:1.125em}.prose :where(img,video):not(:where(.not-prose,.not-prose *)){max-width:100%}.prose :where(figure,picture):not(:where(.not-prose,.not-prose *)){margin:1em 0}.prose :where(figcaption):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-captions);font-size:.875em}.prose :where(code):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-code);font-size:.875em;font-weight:600;font-family:DM Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.prose :where(:not(pre)>code):not(:where(.not-prose,.not-prose *)):before,.prose :where(:not(pre)>code):not(:where(.not-prose,.not-prose *)):after{content:"`"}.prose :where(pre):not(:where(.not-prose,.not-prose *)){padding:1.25rem 1.5rem;overflow-x:auto;border-radius:.375rem}.prose :where(pre,code):not(:where(.not-prose,.not-prose *)){white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;hyphens:none;background:transparent}.prose :where(pre code):not(:where(.not-prose,.not-prose *)){font-weight:inherit}.prose :where(ol,ul):not(:where(.not-prose,.not-prose *)){padding-left:1.25em}.prose :where(ol):not(:where(.not-prose,.not-prose *)){list-style-type:decimal}.prose :where(ol[type=A]):not(:where(.not-prose,.not-prose *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where(.not-prose,.not-prose *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where(.not-prose,.not-prose *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where(.not-prose,.not-prose *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where(.not-prose,.not-prose *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where(.not-prose,.not-prose *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where(.not-prose,.not-prose *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where(.not-prose,.not-prose *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where(.not-prose,.not-prose *)){list-style-type:decimal}.prose :where(ul):not(:where(.not-prose,.not-prose *)){list-style-type:disc}.prose :where(ol>li):not(:where(.not-prose,.not-prose *))::marker,.prose :where(ul>li):not(:where(.not-prose,.not-prose *))::marker,.prose :where(summary):not(:where(.not-prose,.not-prose *))::marker{color:var(--un-prose-lists)}.prose :where(hr):not(:where(.not-prose,.not-prose *)){margin:2em 0;border:1px solid var(--un-prose-hr)}.prose :where(table):not(:where(.not-prose,.not-prose *)){display:block;margin:1em 0;border-collapse:collapse;overflow-x:auto}.prose :where(tr):not(:where(.not-prose,.not-prose *)):nth-child(2n){background:var(--un-prose-bg-soft)}.prose :where(td,th):not(:where(.not-prose,.not-prose *)){border:1px solid var(--un-prose-borders);padding:.625em 1em}.prose :where(abbr):not(:where(.not-prose,.not-prose *)){cursor:help}.prose :where(kbd):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-code);border:1px solid;padding:.25rem .5rem;font-size:.875em;border-radius:.25rem}.prose :where(details):not(:where(.not-prose,.not-prose *)){margin:1em 0;padding:1.25rem 1.5rem;background:var(--un-prose-bg-soft)}.prose :where(summary):not(:where(.not-prose,.not-prose *)){cursor:pointer;font-weight:600}.prose{color:var(--un-prose-body);max-width:65ch}.container,[container=""]{width:100%}@media (min-width: 640px){.container,[container=""]{max-width:640px}}@media (min-width: 768px){.container,[container=""]{max-width:768px}}@media (min-width: 1024px){.container,[container=""]{max-width:1024px}}@media (min-width: 1280px){.container,[container=""]{max-width:1280px}}@media (min-width: 1536px){.container,[container=""]{max-width:1536px}}.\[input\:checked\~\&\]{input:checked~&}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none,[pointer-events-none=""]{pointer-events:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.absolute,[absolute=""]{position:absolute}.fixed,[fixed=""]{position:fixed}.relative,[relative=""]{position:relative}.sticky,[sticky=""]{position:sticky}[before~=absolute]:before{position:absolute}.after\:absolute:after{position:absolute}[after~=absolute]:after{position:absolute}.inset-0,[inset-0=""]{top:0;right:0;bottom:0;left:0}[before~=inset-0]:before{top:0;right:0;bottom:0;left:0}[after~=inset-0]:after{top:0;right:0;bottom:0;left:0}.inset-x-0,[inset-x-0=""]{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0,[bottom-0=""]{bottom:0}.bottom-11,[bottom-11=""]{bottom:2.75rem}.bottom-2{bottom:.5rem}.left-0,[left-0=""]{left:0}.left-1\/2,[left~="1/2"]{left:50%}.left-2{left:.5rem}.right--10,[right--10=""]{right:-2.5rem}.right--15,[right--15=""]{right:-3.75rem}.right--5,[right--5=""]{right:-1.25rem}.right-0,[right-0=""],[right~="0"]{right:0}.right-2{right:.5rem}.top--20,[top--20=""]{top:-5rem}.top-0,[top-0=""],[top~="0"]{top:0}.top-1\/2,[top~="50%"]{top:50%}.top-2{top:.5rem}[bottom~="[calc(100%+8px)]"]{bottom:calc(100% + 8px)}[bottom~="20%"]{bottom:20%}[bottom~="3"]{bottom:.75rem}[right~="3"]{right:.75rem}[top~="[65dvh]"]{top:65dvh}[top~="[calc(100dvh-12rem)]"]{top:calc(100dvh - 12rem)}[top~="[calc(100dvh-15rem)]"]{top:calc(100dvh - 15rem)}[top~="[calc(100dvh-20rem)]"]{top:calc(100dvh - 20rem)}.after\:left-\[2px\]:after{left:2px}.after\:top-\[2px\]:after{top:2px}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2}.line-clamp-3,[line-clamp-3=""]{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3}.z--1,[z--1=""]{z-index:-1}.z--2{z-index:-2}.z-0{z-index:0}.z-1,[z-1=""]{z-index:1}.z-10,[z-10=""]{z-index:10}.z-100,[z-100=""]{z-index:100}.z-2,[z-2=""]{z-index:2}.z-3,[z-3=""]{z-index:3}.z-30,[z-30=""]{z-index:30}.z-4,[z-4=""]{z-index:4}.z-50{z-index:50}.z-99,[z-99=""]{z-index:99}[z~="20"]{z-index:20}[before~=z-0]:before{z-index:0}[after~=z--2]:after{z-index:-2}.grid,[grid=""],[grid~="~"]{display:grid}.col-span-full{grid-column:1/-1}.auto-cols-\[350px\]{grid-auto-columns:350px}.auto-cols-auto{grid-auto-columns:auto}.grid-auto-rows-\[minmax\(min-content\,max-content\)\]{grid-auto-rows:minmax(min-content,max-content)}.grid-auto-flow-dense{grid-auto-flow:dense}.grid-flow-col{grid-auto-flow:column}.grid-flow-row{grid-auto-flow:row}.cols-\[20px_1fr_60px\],[grid~="cols-[20px_1fr_60px]"]{grid-template-columns:20px 1fr 60px}.grid-cols-\[repeat\(auto-fill\,minmax\(280px\,1fr\)\)\]{grid-template-columns:repeat(auto-fill,minmax(280px,1fr))}.cols-1,.grid-cols-1,[grid~=cols-1]{grid-template-columns:repeat(1,minmax(0,1fr))}.cols-2,.grid-cols-2,[grid-cols-2=""],[grid~=cols-2]{grid-template-columns:repeat(2,minmax(0,1fr))}.m-0,[m0=""]{margin:0}.m-1,[m-1=""]{margin:.25rem}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-5,[mx-5=""]{margin-left:1.25rem;margin-right:1.25rem}.mx-auto,[mx-auto=""]{margin-left:auto;margin-right:auto}.mx2,[mx2=""]{margin-left:.5rem;margin-right:.5rem}.my{margin-top:1rem;margin-bottom:1rem}.my-0,[my-0=""]{margin-top:0;margin-bottom:0}.my-auto,[my-auto=""]{margin-top:auto;margin-bottom:auto}.-mb-px{margin-bottom:-1px}.mb-1,[mb-1=""]{margin-bottom:.25rem}.mb-2,.mb2,[mb-2=""],[mb2=""]{margin-bottom:.5rem}.mb-3,[mb-3=""]{margin-bottom:.75rem}.mb-4,[mb-4=""]{margin-bottom:1rem}.mb-6,[mb-6=""]{margin-bottom:1.5rem}.ml{margin-left:1rem}.ml-0\.5,[ml-0\.5=""]{margin-left:.125rem}.ml-auto{margin-left:auto}.mr{margin-right:1rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.ms,[ms=""]{margin-inline-start:1rem}.mt-0\.5{margin-top:.125rem}.mt-1,[mt-1=""]{margin-top:.25rem}.mt-2,[mt-2=""]{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4,[mt-4=""]{margin-top:1rem}.mt-auto{margin-top:auto}[ml~="12"]{margin-left:3rem}[mr~="12"]{margin-right:3rem}[box~=border]{box-sizing:border-box}.inline,[inline=""]{display:inline}.block,[block=""]{display:block}.inline-block,[inline-block=""]{display:inline-block}.contents{display:contents}.hidden,[hidden=""]{display:none}.size-16,[size-16=""]{width:4rem;height:4rem}.size-20,[size-20=""]{width:5rem;height:5rem}.size-24,[size-24=""],[size~="24"]{width:6rem;height:6rem}.size-3,[size-3=""]{width:.75rem;height:.75rem}.size-5{width:1.25rem;height:1.25rem}.size-6,[size-6=""],[size~="6"]{width:1.5rem;height:1.5rem}.size-60,[size-60=""]{width:15rem;height:15rem}.h-0\.5,[h-0\.5=""]{height:.125rem}.h-10{height:2.5rem}.h-100dvh,[h-100dvh=""],[h~="100dvh"]{height:100dvh}.h-12{height:3rem}.h-16{height:4rem}.h-1lh{height:1lh}.h-2,.h2,[h-2=""]{height:.5rem}.h-24,[h-24=""]{height:6rem}.h-48,[h-48=""]{height:12rem}.h-5,[h-5=""]{height:1.25rem}.h-6{height:1.5rem}.h-60,[h-60=""]{height:15rem}.h-7,[h-7=""]{height:1.75rem}.h-8,[h-8=""]{height:2rem}.h-fit,[h-fit=""]{height:fit-content}.h-full,[h-full=""]{height:100%}.h1{height:.25rem}.h3{height:.75rem}.max-h-\[10lh\],[max-h~="[10lh]"]{max-height:10lh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100dvh-7lh\)\]{max-height:calc(100dvh - 7lh)}.max-h-60,[max-h-60=""]{max-height:15rem}.max-h-none,[max-h-none=""]{max-height:none}.max-w-6xl{max-width:72rem}.max-w-full,[max-w-full=""]{max-width:100%}.max-w-md{max-width:28rem}.min-h-\[120px\],.min-h-120px,[min-h-120px=""]{min-height:120px}.min-h-\[1lh\],[min-h~="[1lh]"]{min-height:1lh}.min-h-16,[min-h-16=""]{min-height:4rem}.min-h-40px,[min-h-40px=""]{min-height:40px}.min-w-\[200px\]{min-width:200px}.min-w-0,[min-w-0=""]{min-width:0}.min-w-20,[min-w-20=""]{min-width:5rem}.min-w-50,[min-w-50=""]{min-width:12.5rem}.w-\[92vw\]{width:92vw}.w-1{width:.25rem}.w-1\/2,[w~="[50%]"],[w~="50%"]{width:50%}.w-100,[w-100=""]{width:25rem}.w-100vw,[w-100vw=""]{width:100vw}.w-11{width:2.75rem}.w-25\%{width:25%}.w-5{width:1.25rem}.w-8,[w-8=""]{width:2rem}.w-fit,[w-fit=""]{width:fit-content}.w-full,[w-full=""],[w~=full]{width:100%}[h~="[14px]"]{height:14px}[h~="300"]{height:75rem}[h~="80vh"]{height:80vh}[h~=auto]{height:auto}[h~=unset]{height:unset}[max-h~="[300px]"]{max-height:300px}[max-h~="[4.5rem]"]{max-height:4.5rem}[max-h~="[85vh]"]{max-height:85vh}[max-h~="100"]{max-height:25rem}[max-h~="30vh"]{max-height:30vh}[max-w~="500px"]{max-width:500px}[min-h~="[100px]"]{min-height:100px}[min-h~="100"]{min-height:25rem}[min-h~="120"]{min-height:30rem}[min-w~="1/2"],[min-w~="50%"]{min-width:50%}[min-w~="30%"]{min-width:30%}[min-w~="3em"]{min-width:3em}[min-w~="50vw"]{min-width:50vw}[min-w~="6"]{min-width:1.5rem}[w~="[1px]"]{width:1px}[w~="100dvw"]{width:100dvw}[w~="12.5"]{width:3.125rem}[w~="70%"]{width:70%}.before\:w-50\%:before{width:50%}[before~=h-full]:before{height:100%}[before~="w-25%"]:before{width:25%}[hover~="before:w-50%"]:hover:before{width:50%}.after\:h-5:after{height:1.25rem}.after\:w-5:after{width:1.25rem}[after~=h-full]:after{height:100%}[after~=w-full]:after{width:100%}.max-w-screen-xl,[max-w-screen-xl=""]{max-width:1280px}.flex,[flex=""],[flex~="~"]{display:flex}.inline-flex,[inline-flex~="~"]{display:inline-flex}.flex-1,[flex-1=""],[flex~="1"]{flex:1 1 0%}.flex-shrink-0,.shrink-0,[shrink-0=""]{flex-shrink:0}.flex-row,[flex-row=""],[flex~=row]{flex-direction:row}[flex~=row-reverse]{flex-direction:row-reverse}.flex-col,[flex-col=""],[flex~=col]{flex-direction:column}.flex-wrap,[flex-wrap=""]{flex-wrap:wrap}[perspective~="800"]{-webkit-perspective:800px;perspective:800px}.-translate-x-1\/2,.translate-x--1\/2,.translate-x-\[-50\%\],[transform~="translate-x--1/2"]{--un-translate-x:-50%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.-translate-y-1\/2,.translate-y-\[-50\%\],[transform~="translate-y-[-50%]"]{--un-translate-y:-50%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-x-\[50\%\],[transform~="translate-x-[50%]"]{--un-translate-x:50%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y--2,[transform~=translate-y--2]{--un-translate-y:-.5rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y-\[-100\%\],[transform~="translate-y-[-100%]"]{--un-translate-y:-100%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y-\[50\%\]{--un-translate-y:50%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y-2,[translate-y-2=""]{--un-translate-y:.5rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y-4,[translate-y-4=""]{--un-translate-y:1rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}[translate-x~="0.5"]{--un-translate-x:.125rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}[translate-x~="data-[state=checked]:full"][data-state=checked]{--un-translate-x:100%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}[translate-y~="[-80%]"]{--un-translate-y:-80%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.peer:checked~.peer-checked\:after\:translate-x-full:after{--un-translate-x:100%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.\[\&_\.card-cover_img\]\:hover\:translate-y-2:hover .card-cover img,[hover\:translate-y-2=""]:hover{--un-translate-y:.5rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.rotate-180{--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-rotate:180deg;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.scale-100{--un-scale-x:1;--un-scale-y:1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.scale-150{--un-scale-x:1.5;--un-scale-y:1.5;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.\[\&_\.card-cover_img\]\:hover\:scale-102:hover .card-cover img{--un-scale-x:1.02;--un-scale-y:1.02;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.hover\:scale-110:hover{--un-scale-x:1.1;--un-scale-y:1.1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}[hover~=scale-100]:hover{--un-scale-x:1;--un-scale-y:1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.preserve-3d{transform-style:preserve-3d}.transform,[transform=""]{transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.animate-spin{animation:spin 1s linear infinite}.disabled\:cursor-default:disabled{cursor:default}.cursor-pointer,[cursor-pointer=""],[cursor~=pointer]{cursor:pointer}.cursor-not-allowed{cursor:not-allowed}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}[cursor~="disabled:not-allowed"]:disabled{cursor:not-allowed}.cursor-ew-resize,[cursor-ew-resize=""]{cursor:ew-resize}.select-none,[select-none=""]{-webkit-user-select:none;user-select:none}.resize-none,[resize-none=""]{resize:none}.appearance-none,[appearance-none=""]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.place-self-end{place-self:end}.items-start,[items-start=""]{align-items:flex-start}.items-end,[items-end=""]{align-items:flex-end}.items-center,[flex~=items-center],[items-center=""]{align-items:center}.justify-end,[justify-end=""]{justify-content:flex-end}.justify-center,[flex~=justify-center],[justify-center=""]{justify-content:center}.justify-between,[justify-between=""]{justify-content:space-between}.gap-0\.5,[gap-0\.5=""]{gap:.125rem}.gap-1,[gap-1=""]{gap:.25rem}.gap-1\.5,[gap-1\.5=""]{gap:.375rem}.gap-2,[flex~=gap-2],[gap-2=""]{gap:.5rem}.gap-3,[flex~=gap-3],[gap-3=""]{gap:.75rem}.gap-4,[flex~=gap-4],[gap-4=""],[grid~=gap-4]{gap:1rem}.gap-5{gap:1.25rem}.gap-6,[flex~=gap-6]{gap:1.5rem}.gap-x-2,[flex~=gap-x-2]{column-gap:.5rem}.gap-y-0,[flex~=gap-y-0]{row-gap:0}.space-x-1>:not([hidden])~:not([hidden]),[space-x-1=""]>:not([hidden])~:not([hidden]){--un-space-x-reverse:0;margin-left:calc(.25rem * calc(1 - var(--un-space-x-reverse)));margin-right:calc(.25rem * var(--un-space-x-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--un-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--un-space-y-reverse)));margin-bottom:calc(.5rem * var(--un-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--un-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--un-space-y-reverse)));margin-bottom:calc(1.5rem * var(--un-space-y-reverse))}[divide~=y]>:not([hidden])~:not([hidden]){--un-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--un-divide-y-reverse)));border-bottom-width:calc(1px * var(--un-divide-y-reverse))}[divide~="gray/25"]>:not([hidden])~:not([hidden]){border-color:#9ca3af40}[border~=dashed],[divide~=dashed]>:not([hidden])~:not([hidden]){border-style:dashed}.of-clip,[of-clip=""]{overflow:clip}.of-hidden,.overflow-hidden,[of-hidden=""],[overflow-hidden=""],[overflow~=hidden]{overflow:hidden}.overflow-auto,[overflow-auto=""]{overflow:auto}.overflow-scroll,[overflow-scroll=""]{overflow:scroll}.of-x-scroll,[of-x-scroll=""]{overflow-x:scroll}.overflow-x-auto{overflow-x:auto}.overflow-y-scroll,[overflow-y-scroll=""]{overflow-y:scroll}.scroll-smooth,[scroll-smooth=""]{scroll-behavior:smooth}.truncate,[truncate=""]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-line,[whitespace-pre-line=""]{white-space:pre-line}.break-words{overflow-wrap:break-word}.b,.border,[border~="~"],[border~="1"]{border-width:1px}.b-2,.border-2,[b-2=""],[border~="2"],[border~="2px"]{border-width:2px}[border~="4"]{border-width:4px}.border-b{border-bottom-width:1px}.border-b-2,[border~=b-2]{border-bottom-width:2px}[border~=l-2]{border-left-width:2px}[border~=r-2]{border-right-width:2px}[border~=t-2]{border-top-width:2px}.\[\&\:checked\+div\]\:border-primary-500:checked+div,.border-primary-500{--un-border-opacity:1;border-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.border-amber-200{--un-border-opacity:1;border-color:rgb(253 230 138 / var(--un-border-opacity))}.border-neutral-100,[border~=neutral-100]{--un-border-opacity:1;border-color:rgb(245 245 245 / var(--un-border-opacity))}.border-neutral-200,.dark [border~="dark:neutral-200"],[border~=neutral-200]{--un-border-opacity:1;border-color:rgb(229 229 229 / var(--un-border-opacity))}.border-neutral-300,[border~="data-[state=unchecked]:neutral-300"][data-state=unchecked],[border~=neutral-300]{--un-border-opacity:1;border-color:rgb(212 212 212 / var(--un-border-opacity))}.border-neutral-500{--un-border-opacity:1;border-color:rgb(115 115 115 / var(--un-border-opacity))}.border-primary-100,[border~=primary-100]{border-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 0)) 80%,oklch(100% 0 360))}.border-primary-200,[border~="data-[state=checked]:primary-200"][data-state=checked]{--un-border-opacity:1;border-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.border-primary-400,.dark .dark\:\[\&\:checked\+div\]\:border-primary-400:checked+div,.dark .dark\:border-primary-400{--un-border-opacity:1;border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.border-red-200{--un-border-opacity:1;border-color:rgb(254 202 202 / var(--un-border-opacity))}.border-white{--un-border-opacity:1;border-color:rgb(255 255 255 / var(--un-border-opacity))}.dark .dark\:border-amber-800{--un-border-opacity:1;border-color:rgb(146 64 14 / var(--un-border-opacity))}.dark .dark\:border-neutral-600,.dark [border~="dark:neutral-600"]{--un-border-opacity:1;border-color:rgb(82 82 82 / var(--un-border-opacity))}.dark .dark\:border-neutral-700,.dark [border~="dark:neutral-700"]{--un-border-opacity:1;border-color:rgb(64 64 64 / var(--un-border-opacity))}.dark .dark\:border-neutral-800\/25,.dark [border~="dark:neutral-800/25"]{border-color:#26262640}.dark .dark\:border-neutral-900,.dark [border~="dark:neutral-900"]{--un-border-opacity:1;border-color:rgb(23 23 23 / var(--un-border-opacity))}.dark .dark\:border-primary-600{--un-border-opacity:1;border-color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.dark .dark\:border-primary-800,.dark [border~="dark:primary-800"]{--un-border-opacity:1;border-color:oklch(42% var(--theme-colors-chroma-800) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.dark .dark\:border-primary-900,.dark [border~="dark:primary-900"]{--un-border-opacity:1;border-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.dark .dark\:border-red-800{--un-border-opacity:1;border-color:rgb(153 27 27 / var(--un-border-opacity))}.dark [border~="dark:cyan-500/50"]{border-color:#06b6d480}.dark [border~="dark:neutral-700/30"]{border-color:#4040404d}.dark [border~="dark:neutral-800"],[border~=neutral-800]{--un-border-opacity:1;border-color:rgb(38 38 38 / var(--un-border-opacity))}.dark [border~="dark:primary-400/20"]{border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2)}.dark [border~="dark:primary-500/50"]{border-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .5)}.dark [border~="dark:violet-500/50"]{border-color:#8b5cf680}[border~="cyan-200/50"]{border-color:#a5f3fc80}[border~="gray/25"]{border-color:#9ca3af40}[border~="neutral-200/50"]{border-color:#e5e5e580}[border~="primary-200/50"]{border-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / .5)}[border~=primary-300]{--un-border-opacity:1;border-color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}[border~="violet-200/50"]{border-color:#ddd6fe80}.peer:checked~.peer-checked\:after\:border-white:after{--un-border-opacity:1;border-color:rgb(255 255 255 / var(--un-border-opacity))}[border~="focus-within:neutral-800"]:focus-within{--un-border-opacity:1;border-color:rgb(38 38 38 / var(--un-border-opacity))}.dark .dark\:hover\:border-primary-400\/30:hover{border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .3)}.dark .dark\:hover\:border-primary-700:hover{--un-border-opacity:1;border-color:oklch(49% var(--theme-colors-chroma-700) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.dark [border~="dark:hover:primary-400/30"]:hover{border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .3)}.hover\:border-primary-300:hover{--un-border-opacity:1;border-color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.hover\:border-primary-500\/30:hover,[border~="hover:primary-500/30"]:hover{border-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .3)}.dark [border~="dark:focus:neutral-600"]:focus{--un-border-opacity:1;border-color:rgb(82 82 82 / var(--un-border-opacity))}.dark [border~="dark:focus:neutral-700"]:focus{--un-border-opacity:1;border-color:rgb(64 64 64 / var(--un-border-opacity))}.dark [border~="dark:focus:primary-400/50"]:focus{border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .5)}[border~="focus:neutral-200"]:focus{--un-border-opacity:1;border-color:rgb(229 229 229 / var(--un-border-opacity))}[border~="focus:neutral-400"]:focus{--un-border-opacity:1;border-color:rgb(163 163 163 / var(--un-border-opacity))}[border~="focus:primary-100"]:focus{border-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 0)) 80%,oklch(100% 0 360))}[border~="focus:primary-300"]:focus{--un-border-opacity:1;border-color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.rounded,[rounded=""]{border-radius:.25rem}.rounded-2xl,[rounded-2xl=""]{border-radius:1rem}.rounded-full,[rounded-full=""]{border-radius:9999px}.rounded-lg,[border~=rounded-lg],[rounded-lg=""],[rounded~=lg]{border-radius:.5rem}.rounded-md,[rounded-md=""]{border-radius:.375rem}.rounded-sm,[rounded-sm=""]{border-radius:.125rem}.rounded-xl,[rounded-xl=""]{border-radius:.75rem}.after\:rounded-full:after{border-radius:9999px}.rounded-l-lg,[rounded-l-lg=""]{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.rounded-l-xl,[rounded-l-xl=""]{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-lg,[rounded-r-lg=""]{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.rounded-r-xl,[rounded-r-xl=""]{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.rounded-t-xl,[rounded-t-xl=""]{border-top-left-radius:.75rem;border-top-right-radius:.75rem}.border-none,[border-none=""]{border-style:none}[border~=solid]{border-style:solid}.bg-amber-50{--un-bg-opacity:1;background-color:rgb(255 251 235 / var(--un-bg-opacity))}.bg-amber-50\/80{background-color:#fffbebcc}.bg-black\/50,[bg~="black/50"]{background-color:#00000080}.bg-neutral-100,[bg-neutral-100=""],[bg~=neutral-100]{--un-bg-opacity:1;background-color:rgb(245 245 245 / var(--un-bg-opacity))}.bg-neutral-200,.dark .dark\:bg-neutral-200,[bg~=neutral-200]{--un-bg-opacity:1;background-color:rgb(229 229 229 / var(--un-bg-opacity))}.bg-neutral-300,.dark [bg~="dark:neutral-300"],[bg-neutral-300=""],[bg~="data-[state=unchecked]:neutral-300"][data-state=unchecked]{--un-bg-opacity:1;background-color:rgb(212 212 212 / var(--un-bg-opacity))}.bg-neutral-400,.dark [bg~="dark:neutral-400"],[bg~=neutral-400]{--un-bg-opacity:1;background-color:rgb(163 163 163 / var(--un-bg-opacity))}.bg-neutral-50,[bg~=neutral-50]{--un-bg-opacity:1;background-color:rgb(250 250 250 / var(--un-bg-opacity))}.bg-neutral-600,.dark .dark\:bg-neutral-600{--un-bg-opacity:1;background-color:rgb(82 82 82 / var(--un-bg-opacity))}.bg-neutral-800,.dark .dark\:bg-neutral-800,.dark [bg~="dark:data-[state=unchecked]:neutral-800"][data-state=unchecked],.dark [bg~="dark:neutral-800"]{--un-bg-opacity:1;background-color:rgb(38 38 38 / var(--un-bg-opacity))}.bg-primary-100,[bg-primary-100=""],[bg~=primary-100]{background-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 0)) 80%,oklch(100% 0 360))}.bg-primary-200,[bg-primary-200=""]{--un-bg-opacity:1;background-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-300,[bg-primary-300=""]{--un-bg-opacity:1;background-color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-400,.dark .dark\:bg-primary-400,.dark [bg~="dark:primary-400"],[bg-primary-400=""],[bg~="data-[state=checked]:primary-400"][data-state=checked],[bg~=primary-400]{--un-bg-opacity:1;background-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-50,.bg-primary-50\/5,[bg-primary-50=""],[bg~=primary-50]{background-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-50) calc(var(--theme-colors-hue) + 0)) 30%,oklch(100% 0 360))}.bg-primary-500,.dark [bg~="dark:primary-500"],[bg-primary-500=""],[bg~=primary-500],.peer:checked~.peer-checked\:bg-primary-500{--un-bg-opacity:1;background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-500\/20,[bg~="primary-500/20"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2)}.bg-primary-600,[bg-primary-600=""]{--un-bg-opacity:1;background-color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-700,[bg-primary-700=""]{--un-bg-opacity:1;background-color:oklch(49% var(--theme-colors-chroma-700) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-800,[bg-primary-800=""]{--un-bg-opacity:1;background-color:oklch(42% var(--theme-colors-chroma-800) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-900,.dark .dark\:bg-primary-900,[bg-primary-900=""]{--un-bg-opacity:1;background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-950,.dark .dark\:bg-primary-950,.dark [bg~="dark:primary-950"],[bg-primary-950=""]{--un-bg-opacity:1;background-color:oklch(29% var(--theme-colors-chroma-950) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-red-50{--un-bg-opacity:1;background-color:rgb(254 242 242 / var(--un-bg-opacity))}.bg-red-500{--un-bg-opacity:1;background-color:rgb(239 68 68 / var(--un-bg-opacity))}.bg-transparent,.dark [bg~="dark:transparent"],[bg-transparent=""],[bg~=transparent]{background-color:transparent}.bg-white,[bg-white=""],[bg~=white]{--un-bg-opacity:1;background-color:rgb(255 255 255 / var(--un-bg-opacity))}.bg-white\/60,[bg~="white/60"]{background-color:#fff9}.bg-white\/80{background-color:#fffc}.dark .dark\:bg-amber-900\/20{background-color:#78350f33}.dark .dark\:bg-amber-900\/30{background-color:#78350f4d}.dark .dark\:bg-black\/30,.dark [bg~="dark:black/30"]{background-color:#0000004d}.dark .dark\:bg-black\/40{background-color:#0006}.dark .dark\:bg-neutral-700,.dark [bg~="dark:neutral-700"],[bg~=neutral-700]{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}.dark .dark\:bg-neutral-700\/50{background-color:#40404080}.dark .dark\:bg-neutral-800\/50,.dark [bg~="dark:neutral-800/50"]{background-color:#26262680}.dark .dark\:bg-neutral-900,.dark [bg~="dark:neutral-900"]{--un-bg-opacity:1;background-color:rgb(23 23 23 / var(--un-bg-opacity))}.dark .dark\:bg-neutral-900\/20{background-color:#17171733}.dark .dark\:bg-primary-900\/20{background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / .2)}.dark .dark\:bg-primary-900\/30{background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / .3)}.dark .dark\:bg-primary-900\/40,.dark [bg~="dark:primary-900/40"]{background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / .4)}.dark .dark\:bg-primary-900\/5{background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / .05)}.dark .dark\:bg-red-400{--un-bg-opacity:1;background-color:rgb(248 113 113 / var(--un-bg-opacity))}.dark .dark\:bg-red-900\/20{background-color:#7f1d1d33}.dark [bg~="dark:[#4e34b9]"]{--un-bg-opacity:1;background-color:rgb(78 52 185 / var(--un-bg-opacity))}.dark [bg~="dark:[#676085]"]{--un-bg-opacity:1;background-color:rgb(103 96 133 / var(--un-bg-opacity))}.dark [bg~="dark:[rgba(0,0,0,0.3)]"]{--un-bg-opacity:.3;background-color:rgba(0,0,0,var(--un-bg-opacity))}.dark [bg~="dark:black/20"],.group:hover [bg~="group-hover:black/20"]{background-color:#0003}.dark [bg~="dark:blue-900"]{--un-bg-opacity:1;background-color:rgb(30 58 138 / var(--un-bg-opacity))}.dark [bg~="dark:complementary-800"]{--un-bg-opacity:1;background-color:oklch(42% var(--theme-colors-chroma-800) calc(var(--theme-colors-hue) + 180) / var(--un-bg-opacity))}.dark [bg~="dark:cyan-900"]{--un-bg-opacity:1;background-color:rgb(22 78 99 / var(--un-bg-opacity))}.dark [bg~="dark:green-600"]{--un-bg-opacity:1;background-color:rgb(22 163 74 / var(--un-bg-opacity))}.dark [bg~="dark:neutral-500"]{--un-bg-opacity:1;background-color:rgb(115 115 115 / var(--un-bg-opacity))}.dark [bg~="dark:neutral-900/50"]{background-color:#17171780}.dark [bg~="dark:neutral-950"]{--un-bg-opacity:1;background-color:rgb(10 10 10 / var(--un-bg-opacity))}.dark [bg~="dark:orange-900/20"]{background-color:#7c2d1233}.dark [bg~="dark:primary-400/20"]{background-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2)}.dark [bg~="data-[state=checked]:dark:primary-400/80"][data-state=checked]{background-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .8)}[bg~="[#cabeff]"]{--un-bg-opacity:1;background-color:rgb(202 190 255 / var(--un-bg-opacity))}[bg~="[#e6e1fc]"]{--un-bg-opacity:1;background-color:rgb(230 225 252 / var(--un-bg-opacity))}[bg~="$bg-color"]{background-color:var(--bg-color)}[bg~="black/0"]{background-color:#0000}[bg~=blue-100]{--un-bg-opacity:1;background-color:rgb(219 234 254 / var(--un-bg-opacity))}[bg~=complementary-100]{background-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 180)) 80%,oklch(100% 0 360))}[bg~=emerald-500]{--un-bg-opacity:1;background-color:rgb(16 185 129 / var(--un-bg-opacity))}[bg~="gray-200/30"]{background-color:#e5e7eb4d}[bg~=green-500]{--un-bg-opacity:1;background-color:rgb(34 197 94 / var(--un-bg-opacity))}[bg~=inherit]{background-color:inherit}[bg~="neutral-100/70"]{background-color:#f5f5f5b3}[bg~="neutral-200/20"]{background-color:#e5e5e533}[bg~="neutral-200/50"]{background-color:#e5e5e580}[bg~="neutral-50/50"]{background-color:#fafafa80}[bg~=orange-50]{--un-bg-opacity:1;background-color:rgb(255 247 237 / var(--un-bg-opacity))}[bg~="primary-500/10"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1)}[bg~="primary-500/30"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .3)}[bg~="primary-500/40"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .4)}[bg~="primary-500/5"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .05)}[bg~="primary-500/50"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .5)}[bg~="primary-500/60"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .6)}[bg~="primary-500/70"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .7)}[bg~="primary-500/80"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .8)}[bg~="primary-500/90"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .9)}.dark [dark\:bg-neutral-700~="default:"]:default{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}.dark [dark\:bg-neutral-700~="checked:"]:checked{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}.dark .\[\&_div_span\]\:dark\:hover\:bg-cyan-300:hover div span{--un-bg-opacity:1;background-color:rgb(103 232 249 / var(--un-bg-opacity))}.dark .\[\&_div_span\]\:dark\:hover\:bg-cyan-900:hover div span{--un-bg-opacity:1;background-color:rgb(22 78 99 / var(--un-bg-opacity))}.dark .dark\:hover\:bg-black\/40:hover{background-color:#0006}.dark .dark\:hover\:bg-neutral-500:hover{--un-bg-opacity:1;background-color:rgb(115 115 115 / var(--un-bg-opacity))}.dark .dark\:hover\:bg-neutral-800:hover{--un-bg-opacity:1;background-color:rgb(38 38 38 / var(--un-bg-opacity))}.dark .dark\:hover\:bg-primary-500:hover{--un-bg-opacity:1;background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.dark .dark\:hover\:bg-red-500:hover{--un-bg-opacity:1;background-color:rgb(239 68 68 / var(--un-bg-opacity))}.dark [bg~="dark:hover:complementary-700"]:hover{--un-bg-opacity:1;background-color:oklch(49% var(--theme-colors-chroma-700) calc(var(--theme-colors-hue) + 180) / var(--un-bg-opacity))}.dark [bg~="dark:hover:neutral-800"]:hover{--un-bg-opacity:1;background-color:rgb(38 38 38 / var(--un-bg-opacity))}.dark [bg~="dark:hover:primary-900"]:hover{--un-bg-opacity:1;background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.dark [dark\:hover\:bg-cyan-300=""]:hover{--un-bg-opacity:1;background-color:rgb(103 232 249 / var(--un-bg-opacity))}.dark [hover~="dark:bg-black/40"]:hover{background-color:#0006}.dark [hover~="dark:bg-neutral-700"]:hover{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}.dark [hover~="dark:bg-neutral-700/50"]:hover{background-color:#40404080}.hover\:bg-neutral-100:hover{--un-bg-opacity:1;background-color:rgb(245 245 245 / var(--un-bg-opacity))}.hover\:bg-neutral-200:hover{--un-bg-opacity:1;background-color:rgb(229 229 229 / var(--un-bg-opacity))}.hover\:bg-primary-600:hover{--un-bg-opacity:1;background-color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.hover\:bg-red-600:hover{--un-bg-opacity:1;background-color:rgb(220 38 38 / var(--un-bg-opacity))}.hover\:bg-white\/80:hover{background-color:#fffc}[bg~="hover:complementary-200"]:hover{--un-bg-opacity:1;background-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 180) / var(--un-bg-opacity))}[bg~="hover:emerald-600"]:hover{--un-bg-opacity:1;background-color:rgb(5 150 105 / var(--un-bg-opacity))}[bg~="hover:neutral-200"]:hover{--un-bg-opacity:1;background-color:rgb(229 229 229 / var(--un-bg-opacity))}[bg~="hover:primary-100"]:hover{background-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 0)) 80%,oklch(100% 0 360))}[hover~=bg-neutral-200]:hover{--un-bg-opacity:1;background-color:rgb(229 229 229 / var(--un-bg-opacity))}[hover~="bg-white/80"]:hover{background-color:#fffc}.dark [bg~="dark:focus:neutral-900"]:focus{--un-bg-opacity:1;background-color:rgb(23 23 23 / var(--un-bg-opacity))}[bg~="focus:neutral-50"]:focus{--un-bg-opacity:1;background-color:rgb(250 250 250 / var(--un-bg-opacity))}.dark [bg~="dark:active:neutral-700"]:active{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}[bg~="active:neutral-300"]:active{--un-bg-opacity:1;background-color:rgb(212 212 212 / var(--un-bg-opacity))}.after\:bg-white:after{--un-bg-opacity:1;background-color:rgb(255 255 255 / var(--un-bg-opacity))}.dark .dark\:from-primary-400\/0{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark .dark\:from-primary-400\/20{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.from-primary-500{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-from-opacity, 1)) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.from-primary-500\/0{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.from-primary-500\/20{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.before\:from-primary-500\/20:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark .before\:dark\:from-primary-400\/20:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark [before~="dark:from-primary-400/0"]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark [hover~="before:dark:from-primary-400/20"]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}[before~="from-primary-500/0"]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}[hover~="before:from-primary-500/20"]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark .dark\:via-primary-400\/10{--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.via-primary-500\/10{--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.before\:via-primary-500\/10:before{--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.dark .before\:dark\:via-primary-400\/10:before{--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.dark [hover~="before:dark:via-primary-400/10"]:hover:before{--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}[hover~="before:via-primary-500/10"]:hover:before{--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.dark .dark\:to-primary-400\/0{--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.dark .dark\:to-transparent,.to-transparent{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.to-primary-400{--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-to-opacity, 1)) var(--un-gradient-to-position)}.to-primary-500\/0{--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.before\:to-transparent:before{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.dark .before\:dark\:to-transparent:before{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.dark [before~="dark:to-primary-400/0"]:before{--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.dark [hover~="before:dark:to-transparent"]:hover:before{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}[before~="to-primary-500/0"]:before{--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}[hover~="before:to-transparent"]:hover:before{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.bg-gradient-to-r{--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient))}.before\:bg-gradient-to-r:before{--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient))}[before~=bg-gradient-to-r]:before{--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient))}[hover~="before:bg-gradient-to-r"]:hover:before{--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.dark .dark\:fill-neutral-800,.dark [dark\:fill-neutral-800=""]{--un-fill-opacity:1;fill:rgb(38 38 38 / var(--un-fill-opacity))}.fill-white,[fill-white=""]{--un-fill-opacity:1;fill:rgb(255 255 255 / var(--un-fill-opacity))}[stroke-width~="2"]{stroke-width:2px}.object-cover,[object-cover=""]{object-fit:cover}.object-contain,[object-contain=""]{object-fit:contain}.p-1,[p-1=""]{padding:.25rem}.p-1\.5,[p-1\.5=""]{padding:.375rem}.p-2,.p2,[p-2=""],[p~="2"],[p2=""]{padding:.5rem}.p-2\.5{padding:.625rem}.p-3,[p-3=""]{padding:.75rem}.p-4,[p-4=""]{padding:1rem}.p-5,[p-5=""]{padding:1.25rem}.p-6{padding:1.5rem}.p-8,[p-8=""]{padding:2rem}.px,.px-4,[px-4=""],[px=""]{padding-left:1rem;padding-right:1rem}.px-0{padding-left:0;padding-right:0}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10,[px-10=""]{padding-left:2.5rem;padding-right:2.5rem}.px-2,.px2,[px-2=""],[px~="2"],[px2=""]{padding-left:.5rem;padding-right:.5rem}.px-3,[px-3=""]{padding-left:.75rem;padding-right:.75rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py,.py-4,[py~="4"]{padding-top:1rem;padding-bottom:1rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1,.py1,[py-1=""],[py~="1"],[py1=""]{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5,[py-1\.5=""]{padding-top:.375rem;padding-bottom:.375rem}.py-2,[py-2=""]{padding-top:.5rem;padding-bottom:.5rem}.py-3,[py-3=""]{padding-top:.75rem;padding-bottom:.75rem}.py-6,[py-6=""]{padding-top:1.5rem;padding-bottom:1.5rem}[px~="12"]{padding-left:3rem;padding-right:3rem}.pb-2,[pb-2=""]{padding-bottom:.5rem}.pb-4,[pb-4=""]{padding-bottom:1rem}.pb-6,[pb-6=""]{padding-bottom:1.5rem}.pl,.pl-4,[pl-4=""]{padding-left:1rem}.pl-10{padding-left:2.5rem}.pl-3,[pl-3=""]{padding-left:.75rem}.pl-5,[pl-5=""]{padding-left:1.25rem}.pr-\[20px\]{padding-right:20px}.pr-1,[pr-1=""]{padding-right:.25rem}.pr-4,[pr-4=""]{padding-right:1rem}.pt,.pt-4,[pt-4=""]{padding-top:1rem}.pt-10,[pt-10=""]{padding-top:2.5rem}.pt-2,[pt-2=""]{padding-top:.5rem}.text-center,[text-center=""],[text~=center]{text-align:center}.text-left,[text-left=""]{text-align:left}.text-right,[text-right=""]{text-align:right}.text-wrap,[text-wrap=""]{text-wrap:wrap}.text-nowrap,[text-nowrap=""]{text-wrap:nowrap}.text-2xl,[text-2xl=""],[text~="2xl"]{font-size:1.5rem;line-height:2rem}.text-3xl,[text-3xl=""]{font-size:1.875rem;line-height:2.25rem}.text-5xl,[text-5xl=""]{font-size:3rem;line-height:1}.text-6xl,[text-6xl=""]{font-size:3.75rem;line-height:1}.text-base,[text-base=""],[text~=base]{font-size:1rem;line-height:1.5rem}.text-lg,[text-lg=""],[text~=lg]{font-size:1.125rem;line-height:1.75rem}.text-sm,[text-sm=""],[text~=sm]{font-size:.875rem;line-height:1.25rem}.text-xl,[text-xl=""]{font-size:1.25rem;line-height:1.75rem}.text-xs,[text-xs=""]{font-size:.75rem;line-height:1rem}[text~="60"]{font-size:15rem}.dark .dark\:text-amber-400{--un-text-opacity:1;color:rgb(251 191 36 / var(--un-text-opacity))}.dark .dark\:text-neutral-100,[text~=neutral-100]{--un-text-opacity:1;color:rgb(245 245 245 / var(--un-text-opacity))}.dark .dark\:text-neutral-300,.dark [dark\:text-neutral-300=""],.dark [text~="dark:neutral-300"],[text~=neutral-300]{--un-text-opacity:1;color:rgb(212 212 212 / var(--un-text-opacity))}.dark .dark\:text-neutral-400,.dark [dark\:text-neutral-400=""],.dark [text~="dark:neutral-400"],.text-neutral-400,[text-neutral-400=""],[text~=neutral-400]{--un-text-opacity:1;color:rgb(163 163 163 / var(--un-text-opacity))}.dark .dark\:text-neutral-500,.dark [text~="dark:neutral-500"],.text-neutral-500,[text-neutral-500=""],[text~=neutral-500]{--un-text-opacity:1;color:rgb(115 115 115 / var(--un-text-opacity))}.dark .dark\:text-neutral-600,.text-neutral-600,[text~=neutral-600]{--un-text-opacity:1;color:rgb(82 82 82 / var(--un-text-opacity))}.dark .dark\:text-neutral-600\/20,.dark [text~="dark:neutral-600/20"]{color:#52525233}.dark .dark\:text-primary-300\/80{color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / .8)}.dark .dark\:text-primary-400,.dark [text~="dark:primary-400"],.text-primary-400{--un-text-opacity:1;color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .dark\:text-primary-500,.text-primary-500{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .dark\:text-primary-600,.text-primary-600,[text~=primary-600]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .dark\:text-red-400{--un-text-opacity:1;color:rgb(248 113 113 / var(--un-text-opacity))}.dark .dark\:text-white,.dark [dark\:text-white=""],.dark [text~="dark:white"],.text-white,[text-white=""],[text~=white]{--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity))}.dark .dark\:text-white\/50{color:#ffffff80}.dark [text~="dark:cyan-600/90"]{color:#0891b2e6}.dark [text~="dark:gray-200"]{--un-text-opacity:1;color:rgb(229 231 235 / var(--un-text-opacity))}.dark [text~="dark:neutral-600/50"]{color:#52525280}.dark [text~="dark:neutral-900"],.text-neutral-900{--un-text-opacity:1;color:rgb(23 23 23 / var(--un-text-opacity))}.dark [text~="dark:orange-500"]{--un-text-opacity:1;color:rgb(249 115 22 / var(--un-text-opacity))}.dark [text~="dark:primary-300"],.text-primary-300,[text~=primary-300]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark [text~="dark:primary-300/50"]{color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / .5)}.dark [text~="dark:primary-600/90"]{color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / .9)}.dark [text~="dark:violet-600/90"]{color:#7c3aede6}.text-amber-500{--un-text-opacity:1;color:rgb(245 158 11 / var(--un-text-opacity))}.text-amber-600{--un-text-opacity:1;color:rgb(217 119 6 / var(--un-text-opacity))}.text-black,[text-black=""]{--un-text-opacity:1;color:rgb(0 0 0 / var(--un-text-opacity))}.text-cyan,[text~=cyan-400]{--un-text-opacity:1;color:rgb(34 211 238 / var(--un-text-opacity))}.text-neutral-200\/50,[text~="neutral-200/50"]{color:#e5e5e580}.text-neutral-400\/50,[text~="neutral-400/50"]{color:#a3a3a380}.text-neutral-700,[text-neutral-700=""]{--un-text-opacity:1;color:rgb(64 64 64 / var(--un-text-opacity))}.text-primary-600\/80{color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / .8)}.text-primary-700{--un-text-opacity:1;color:oklch(49% var(--theme-colors-chroma-700) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.text-red-500{--un-text-opacity:1;color:rgb(239 68 68 / var(--un-text-opacity))}.text-red-600{--un-text-opacity:1;color:rgb(220 38 38 / var(--un-text-opacity))}.text-transparent{color:transparent}.text-violet-500,[text-violet-500=""]{--un-text-opacity:1;color:rgb(139 92 246 / var(--un-text-opacity))}[text~=complementary-400]{--un-text-opacity:1;color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 180) / var(--un-text-opacity))}[text~="cyan-400/90"]{color:#22d3eee6}[text~=gray-700]{--un-text-opacity:1;color:rgb(55 65 81 / var(--un-text-opacity))}[text~=orange-700]{--un-text-opacity:1;color:rgb(194 65 12 / var(--un-text-opacity))}[text~="primary-400/90"]{color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .9)}[text~="violet-400/90"]{color:#a78bfae6}.dark .dark\:hover\:text-neutral-300:hover{--un-text-opacity:1;color:rgb(212 212 212 / var(--un-text-opacity))}.dark [hover~="dark:text-primary-300/80"]:hover{color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / .8)}.dark [text~="dark:hover:primary-500"]:hover{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.hover\:text-neutral-700:hover{--un-text-opacity:1;color:rgb(64 64 64 / var(--un-text-opacity))}[hover~="text-primary-600/80"]:hover{color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / .8)}[text~="hover:primary-500"]:hover{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark [text~="dark:disabled:neutral-600"]:disabled{--un-text-opacity:1;color:rgb(82 82 82 / var(--un-text-opacity))}[text~="disabled:neutral-400"]:disabled{--un-text-opacity:1;color:rgb(163 163 163 / var(--un-text-opacity))}.dark [text~="placeholder:dark:hover:primary-500"]:hover::placeholder{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark [text~="placeholder:dark:primary-300/50"]::placeholder{color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / .5)}[text~="placeholder:hover:primary-500"]:hover::placeholder{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}[text~="placeholder:primary-300"]::placeholder{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.font-bold,[font-bold=""]{font-weight:700}.font-medium,[font-medium=""]{font-weight:500}.font-semibold,[font-semibold=""]{font-weight:600}.lh-10{line-height:2.5rem}[leading~="[0.75]"]{line-height:.75}[leading~="[1]"]{line-height:1}.font-cute,[font-cute=""]{font-family:Kiwi Maru}.font-cuteen,[font-cuteen=""]{font-family:Sniglet}.font-mono,[font-mono=""]{font-family:DM Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans,[font-sans=""]{font-family:DM Sans,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.font-italic,.italic,[font-italic=""]{font-style:italic}.underline,[underline=""]{text-decoration-line:underline}.tab,[aria-checked~=tab][aria-checked=true],[tab=""]{-moz-tab-size:4;-o-tab-size:4;tab-size:4}[checked~=tab]:checked{-moz-tab-size:4;-o-tab-size:4;tab-size:4}.text-stroke-1,[text-stroke-1=""]{-webkit-text-stroke-width:1px}.text-shadow{--un-text-shadow:0 0 1px var(--un-text-shadow-color, rgb(0 0 0 / .2)),0 0 1px var(--un-text-shadow-color, rgb(1 0 5 / .1));text-shadow:var(--un-text-shadow)}.\[\&\:checked\+div_\.radio-dot\]\:opacity-100:checked+div .radio-dot,.opacity-100,.group:hover .group-hover\:opacity-100,.group:hover [group-hover\:opacity-100=""]{opacity:1}.op50,.opacity-50,[op50=""]{opacity:.5}.opacity-0,[opacity-0=""]{opacity:0}.opacity-25{opacity:.25}.opacity-60{opacity:.6}.opacity-95,[opacity-95=""]{opacity:.95}[hover~=opacity-100]:hover{opacity:1}.disabled\:opacity-50:disabled{opacity:.5}.before\:opacity-100:before{opacity:1}[before~=opacity-0]:before{opacity:0}[hover~="before:opacity-100"]:hover:before{opacity:1}.mix-blend-screen,[mix-blend-screen=""]{mix-blend-mode:screen}.dark .dark\:shadow-lg,.shadow-lg{--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.dark [shadow~="dark:none"]{--un-shadow:0 0 var(--un-shadow-color, rgb(0 0 0 / 0));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow{--un-shadow:var(--un-shadow-inset) 0 1px 3px 0 var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 1px 2px -1px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-md,[shadow-md=""],[shadow~=md]{--un-shadow:var(--un-shadow-inset) 0 4px 6px -1px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 2px 4px -2px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-sm,[shadow-sm=""],[shadow~=sm]{--un-shadow:var(--un-shadow-inset) 0 1px 2px 0 var(--un-shadow-color, rgb(0 0 0 / .05));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-xl,[shadow-xl=""]{--un-shadow:var(--un-shadow-inset) 0 20px 25px -5px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 8px 10px -6px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}[shadow~="cyan-200/50"]{--un-shadow-color:rgb(165 243 252 / .5) }[shadow~="primary-200/50"]{--un-shadow-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / .5) }[shadow~="violet-200/50"]{--un-shadow-color:rgb(221 214 254 / .5) }.focus-within\:shadow-neutral-800:focus-within{--un-shadow-opacity:1;--un-shadow-color:rgb(38 38 38 / var(--un-shadow-opacity)) }[shadow~="focus-within:[0_0_0_1px]"]:focus-within{--un-shadow:0 0 0 1px var(--un-shadow-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.dark [hover~="dark:shadow-lg"]:hover{--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}[hover~=shadow-md]:hover{--un-shadow:var(--un-shadow-inset) 0 4px 6px -1px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 2px 4px -2px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.outline{outline-style:solid}.outline-none,[outline-none=""]{outline:2px solid transparent;outline-offset:2px}[outline~="focus-within:none"]:focus-within{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--un-ring-width:2px;--un-ring-offset-shadow:var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);--un-ring-shadow:var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.focus\:ring-offset-2:focus{--un-ring-offset-width:2px}.dark .dark\:focus\:ring-primary-400\/50:focus{--un-ring-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .5) }.focus\:ring-primary-500\/50:focus{--un-ring-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .5) }.dark .dark\:focus\:ring-offset-neutral-900:focus{--un-ring-offset-opacity:1;--un-ring-offset-color:rgb(23 23 23 / var(--un-ring-offset-opacity)) }.focus\:ring-offset-white:focus{--un-ring-offset-opacity:1;--un-ring-offset-color:rgb(255 255 255 / var(--un-ring-offset-opacity)) }.backdrop-blur-sm,[backdrop-blur-sm=""]{--un-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.backdrop-blur-xl,[backdrop-blur-xl=""]{--un-backdrop-blur:blur(24px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.blur{--un-blur:blur(8px);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.drop-shadow{--un-drop-shadow:drop-shadow(0 1px 2px var(--un-drop-shadow-color, rgb(0 0 0 / .1))) drop-shadow(0 1px 1px var(--un-drop-shadow-color, rgb(0 0 0 / .06)));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}[drop-shadow~=none],.dark [drop-shadow~="dark:hover:none"]:hover{--un-drop-shadow:drop-shadow(0 0 var(--un-drop-shadow-color, rgb(0 0 0 / 0)));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}[drop-shadow~="hover:[0px_4px_4px_rgba(220,220,220,0.4)]"]:hover{--un-drop-shadow:drop-shadow(0px 4px 4px rgba(220,220,220,.4));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}[drop-shadow~="active:[0px_0px_0px_rgba(220,220,220,0.25)]"]:active{--un-drop-shadow:drop-shadow(0px 0px 0px rgba(220,220,220,.25));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.\[\&_\.provider-icon\]\:grayscale-100 .provider-icon,.grayscale-100,[grayscale-100=""]{--un-grayscale:grayscale(1);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.\[\&_\.provider-icon\]\:hover\:grayscale-0:hover .provider-icon{--un-grayscale:grayscale(0);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.filter{filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all,[transition-all=""],[transition~=all]{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors,[transition-colors=""],[transition~=colors]{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity,[transition-opacity=""]{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform,[transition~=transform]{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[transition~="100"]{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.1s}[transition~=border]{transition-property:border;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[transition~="placeholder:all"]::placeholder{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[before~=transition-all]:before{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:transition-all:after{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[after~=transition-all]:after{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200,[duration-200=""],[transition~=duration-200]{transition-duration:.2s}.duration-250,[duration-250=""],[duration~="250"],[transition~=duration-250]{transition-duration:.25s}.duration-300,[transition~=duration-300]{transition-duration:.3s}.duration-400,[transition~=duration-400]{transition-duration:.4s}.duration-500,[duration-500=""],[duration~="500"],[transition~=duration-500]{transition-duration:.5s}[duration~="10"]{transition-duration:10ms}[duration~="1000"]{transition-duration:1s}.placeholder\:duration-250::placeholder{transition-duration:.25s}[placeholder\:duration-250=""]::placeholder{transition-duration:.25s}[transition~="placeholder:duration-250"]::placeholder{transition-duration:.25s}[before~=duration-400]:before{transition-duration:.4s}[after~=duration-400]:after{transition-duration:.4s}[delay~="1"]{transition-delay:1ms}[delay~="10"]{transition-delay:10ms}[delay~="11"]{transition-delay:11ms}[delay~="18"]{transition-delay:18ms}[delay~="19"]{transition-delay:19ms}[delay~="2"]{transition-delay:2ms}[delay~="20"]{transition-delay:20ms}[delay~="3"]{transition-delay:3ms}[delay~="4"]{transition-delay:4ms}[delay~="5"]{transition-delay:5ms}[delay~="50"]{transition-delay:50ms}[delay~="6"]{transition-delay:6ms}[delay~="7"]{transition-delay:7ms}[delay~="8"]{transition-delay:8ms}[delay~="9"]{transition-delay:9ms}.ease,.ease-in-out,[ease-in-out=""],[transition~=ease-in-out]{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-linear,[ease-linear=""]{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.placeholder\:ease-in-out::placeholder{transition-timing-function:cubic-bezier(.4,0,.2,1)}[transition~="placeholder:ease-in-out"]::placeholder{transition-timing-function:cubic-bezier(.4,0,.2,1)}[before~=ease-in-out]:before{transition-timing-function:cubic-bezier(.4,0,.2,1)}[after~=ease-in-out]:after{transition-timing-function:cubic-bezier(.4,0,.2,1)}.will-change-transform,[will-change-transform=""]{will-change:transform}.after\:content-\[\'\'\]:after{content:""}.content-empty{content:""}[before~=content-empty]:before{content:""}[after~=content-empty]:after{content:""}.bg-dotted-\[neutral-200\/60\]{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.6}.bg-dotted-\[neutral-200\/80\]{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.8}.dark .dark\:bg-dotted-\[neutral-700\/25\]{background-image:radial-gradient(circle at 1px 1px,rgb(64 64 64 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.25}.dark .dark\:bg-dotted-\[neutral-700\/40\]{background-image:radial-gradient(circle at 1px 1px,rgb(64 64 64 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.4}.dark .dark\:hover\:bg-dotted-\[primary-200\/20\]:hover{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}.hover\:bg-dotted-\[primary-300\/50\]:hover{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.after\:bg-dotted-\[primary-300\/50\]:after{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.dark .dark\:after\:bg-dotted-\[primary-200\/20\]:after{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}.dark [hover~="dark:after:bg-dotted-[primary-200/20]"]:hover:after{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}[after~="bg-dotted-[neutral-200/80]"]:after{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.8}[hover~="after:bg-dotted-[primary-300/50]"]:hover:after{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.transition-colors-none{transition-property:color,background-color,border-color,text-color;transition-duration:0s}.placeholder\:transition-colors-none::placeholder{transition-property:color,background-color,border-color,text-color;transition-duration:0s}@media (max-width: 1023.9px){[min-w~=""; initial-value: 0; inherits: true;}@keyframes hue-anim{0%{--theme-colors-hue: 0}to{--theme-colors-hue: 360}}.dynamic-hue{animation:hue-anim 10s linear infinite}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--airi-theme-primary-50: #fff0f2;--airi-theme-primary-100: #ffe3e6;--airi-theme-primary-200: #ffcad4;--airi-theme-primary-300: #ff9fb0;--airi-theme-primary-400: #ff6988;--airi-theme-primary-500: #fe456e;--airi-theme-primary-600: #ec124d;--airi-theme-primary-700: #c70941;--airi-theme-primary-800: #a70a3e;--airi-theme-primary-900: #8e0d3b;--airi-theme-primary-950: #50011b;--theme-colors-hue: 220.44;--theme-colors-chroma: calc(.18 + cos(var(--theme-colors-hue) * 3.14159265 / 180)/25) ;--theme-colors-chroma-50: calc(var(--theme-colors-chroma) * .3);--theme-colors-chroma-100: calc(var(--theme-colors-chroma) * .5);--theme-colors-chroma-200: calc(var(--theme-colors-chroma) * .6);--theme-colors-chroma-300: calc(var(--theme-colors-chroma) * .75);--theme-colors-chroma-400: var(--theme-colors-chroma);--theme-colors-chroma-600: calc(var(--theme-colors-chroma) * 1.15);--theme-colors-chroma-700: calc(var(--theme-colors-chroma) * 1.1);--theme-colors-chroma-800: calc(var(--theme-colors-chroma) * .85);--theme-colors-chroma-900: calc(var(--theme-colors-chroma) * .7);--theme-colors-chroma-950: calc(var(--theme-colors-chroma) * .5)}.slide-away-enter-active,.slide-away-leave-active{transition:transform .3s ease-in-out,opacity .3s ease-in-out}.slide-away-enter,.slide-away-leave-to{transform:translateY(-10px);opacity:0}.slide-away-enter-from,.slide-away-leave{transform:translateY(10px);opacity:0}:root{--bg-color-light: rgb(255 255 255);--bg-color-dark: rgb(18 18 18);--progress-bar-color: rgb(244 114 182);--bg-color: var(--bg-color-light)}html,body,#app{height:100%;margin:0;padding:0;overscroll-behavior:none}html{background:var(--bg-color);transition:all .3s ease-in-out}html.dark{--bg-color: var(--bg-color-dark);color-scheme:dark}#nprogress{pointer-events:none}#nprogress .bar{background:var(--progress-bar-color);opacity:.75;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }@font-face{font-family:DM Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmmono/v14/aFTU7PB1QTsUX8KYthSQBK6PYK3EXw.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:DM Mono;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmmono/v14/aFTU7PB1QTsUX8KYthqQBK6PYK0.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:DM Sans;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmsans/v15/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxRR232RmYJp8I5zzw.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:DM Sans;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmsans/v15/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxRSW32RmYJp8I5.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:"DM Serif Display";font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmserifdisplay/v15/-nFnOHM81r4j6k0gjAW3mujVU2B2G_5x0vrx52jJ3Q.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:"DM Serif Display";font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/dmserifdisplay/v15/-nFnOHM81r4j6k0gjAW3mujVU2B2G_Bx0vrx52g.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.2.woff2) format("woff2");unicode-range:U+d723-d728,U+d72a-d733,U+d735-d748,U+d74a-d74f,U+d752-d753,U+d755-d757,U+d75a-d75f,U+d762-d764,U+d766-d768,U+d76a-d76b,U+d76d-d76f,U+d771-d787,U+d789-d78b,U+d78d-d78f,U+d791-d797,U+d79a,U+d79c,U+d79e-d7a3,U+f900-f909,U+f90b-f92e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.3.woff2) format("woff2");unicode-range:U+d679-d68b,U+d68e-d69e,U+d6a0,U+d6a2-d6a7,U+d6a9-d6c3,U+d6c6-d6c7,U+d6c9-d6cb,U+d6cd-d6d3,U+d6d5-d6d6,U+d6d8-d6e3,U+d6e5-d6e7,U+d6e9-d6fb,U+d6fd-d717,U+d719-d71f,U+d721-d722}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.4.woff2) format("woff2");unicode-range:U+d5bc-d5c7,U+d5ca-d5cb,U+d5cd-d5cf,U+d5d1-d5d7,U+d5d9-d5da,U+d5dc,U+d5de-d5e3,U+d5e6-d5e7,U+d5e9-d5eb,U+d5ed-d5f6,U+d5f8,U+d5fa-d5ff,U+d602-d603,U+d605-d607,U+d609-d60f,U+d612-d613,U+d616-d61b,U+d61d-d637,U+d63a-d63b,U+d63d-d63f,U+d641-d647,U+d64a-d64c,U+d64e-d653,U+d656-d657,U+d659-d65b,U+d65d-d666,U+d668,U+d66a-d678}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.5.woff2) format("woff2");unicode-range:U+d507,U+d509-d50b,U+d50d-d513,U+d515-d53b,U+d53e-d53f,U+d541-d543,U+d545-d54c,U+d54e,U+d550,U+d552-d557,U+d55a-d55b,U+d55d-d55f,U+d561-d564,U+d566-d567,U+d56a,U+d56c,U+d56e-d573,U+d576-d577,U+d579-d583,U+d585-d586,U+d58a-d5a4,U+d5a6-d5bb}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.6.woff2) format("woff2");unicode-range:U+d464-d477,U+d47a-d47b,U+d47d-d47f,U+d481-d487,U+d489-d48a,U+d48c,U+d48e-d4e7,U+d4e9-d503,U+d505-d506}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.7.woff2) format("woff2");unicode-range:U+d3bf-d3c7,U+d3ca-d3cf,U+d3d1-d3eb,U+d3ee-d3ef,U+d3f1-d3f3,U+d3f5-d3fb,U+d3fd-d400,U+d402-d45b,U+d45d-d463}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.8.woff2) format("woff2");unicode-range:U+d2ff,U+d302-d304,U+d306-d30b,U+d30f,U+d311-d313,U+d315-d31b,U+d31e,U+d322-d324,U+d326-d327,U+d32a-d32b,U+d32d-d32f,U+d331-d337,U+d339-d33c,U+d33e-d37b,U+d37e-d37f,U+d381-d383,U+d385-d38b,U+d38e-d390,U+d392-d397,U+d39a-d39b,U+d39d-d39f,U+d3a1-d3a7,U+d3a9-d3aa,U+d3ac,U+d3ae-d3b3,U+d3b5-d3b7,U+d3b9-d3bb,U+d3bd-d3be}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.9.woff2) format("woff2");unicode-range:U+d257-d27f,U+d281-d29b,U+d29d-d29f,U+d2a1-d2ab,U+d2ad-d2b7,U+d2ba-d2bb,U+d2bd-d2bf,U+d2c1-d2c7,U+d2c9-d2ef,U+d2f2-d2f3,U+d2f5-d2f7,U+d2f9-d2fe}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.10.woff2) format("woff2");unicode-range:U+d1b4,U+d1b6-d1f3,U+d1f5-d22b,U+d22e-d22f,U+d231-d233,U+d235-d23b,U+d23d-d240,U+d242-d256}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.11.woff2) format("woff2");unicode-range:U+d105-d12f,U+d132-d133,U+d135-d137,U+d139-d13f,U+d141-d142,U+d144,U+d146-d14b,U+d14e-d14f,U+d151-d153,U+d155-d15b,U+d15e-d187,U+d189-d19f,U+d1a2-d1a3,U+d1a5-d1a7,U+d1a9-d1af,U+d1b2-d1b3}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.12.woff2) format("woff2");unicode-range:U+d04b-d04f,U+d051-d057,U+d059-d06b,U+d06d-d06f,U+d071-d073,U+d075-d07b,U+d07e-d0a3,U+d0a6-d0a7,U+d0a9-d0ab,U+d0ad-d0b3,U+d0b6,U+d0b8,U+d0ba-d0bf,U+d0c2-d0c3,U+d0c5-d0c7,U+d0c9-d0cf,U+d0d2,U+d0d6-d0db,U+d0de-d0df,U+d0e1-d0e3,U+d0e5-d0eb,U+d0ee-d0f0,U+d0f2-d104}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.13.woff2) format("woff2");unicode-range:U+cfa2-cfc3,U+cfc5-cfdf,U+cfe2-cfe3,U+cfe5-cfe7,U+cfe9-cff4,U+cff6-cffb,U+cffd-cfff,U+d001-d003,U+d005-d017,U+d019-d033,U+d036-d037,U+d039-d03b,U+d03d-d04a}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.14.woff2) format("woff2");unicode-range:U+cef0-cef3,U+cef6,U+cef9-ceff,U+cf01-cf03,U+cf05-cf07,U+cf09-cf0f,U+cf11-cf12,U+cf14-cf1b,U+cf1d-cf1f,U+cf21-cf2f,U+cf31-cf53,U+cf56-cf57,U+cf59-cf5b,U+cf5d-cf63,U+cf66,U+cf68,U+cf6a-cf6f,U+cf71-cf84,U+cf86-cf8b,U+cf8d-cfa1}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.15.woff2) format("woff2");unicode-range:U+ce3c-ce57,U+ce5a-ce5b,U+ce5d-ce5f,U+ce61-ce67,U+ce6a,U+ce6c,U+ce6e-ce73,U+ce76-ce77,U+ce79-ce7b,U+ce7d-ce83,U+ce85-ce88,U+ce8a-ce8f,U+ce91-ce93,U+ce95-ce97,U+ce99-ce9f,U+cea2,U+cea4-ceab,U+cead-cee3,U+cee6-cee7,U+cee9-ceeb,U+ceed-ceef}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.16.woff2) format("woff2");unicode-range:U+cd92-cd93,U+cd96-cd97,U+cd99-cd9b,U+cd9d-cda3,U+cda6-cda8,U+cdaa-cdaf,U+cdb1-cdc3,U+cdc5-cdcb,U+cdcd-cde7,U+cde9-ce03,U+ce05-ce1f,U+ce22-ce34,U+ce36-ce3b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.17.woff2) format("woff2");unicode-range:U+ccef-cd07,U+cd0a-cd0b,U+cd0d-cd1a,U+cd1c,U+cd1e-cd2b,U+cd2d-cd5b,U+cd5d-cd77,U+cd79-cd91}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.18.woff2) format("woff2");unicode-range:U+cc3f-cc43,U+cc46-cc47,U+cc49-cc4b,U+cc4d-cc53,U+cc55-cc58,U+cc5a-cc5f,U+cc61-cc97,U+cc9a-cc9b,U+cc9d-cc9f,U+cca1-cca7,U+ccaa,U+ccac,U+ccae-ccb3,U+ccb6-ccb7,U+ccb9-ccbb,U+ccbd-cccf,U+ccd1-cce3,U+cce5-ccee}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.19.woff2) format("woff2");unicode-range:U+cb91-cbd3,U+cbd5-cbe3,U+cbe5-cc0b,U+cc0e-cc0f,U+cc11-cc13,U+cc15-cc1b,U+cc1d-cc20,U+cc23-cc27,U+cc2a-cc2b,U+cc2d,U+cc2f,U+cc31-cc37,U+cc3a,U+cc3c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.20.woff2) format("woff2");unicode-range:U+caf4-cb47,U+cb4a-cb90}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.21.woff2) format("woff2");unicode-range:U+ca4a-ca4b,U+ca4e-ca4f,U+ca51-ca53,U+ca55-ca5b,U+ca5d-ca60,U+ca62-ca83,U+ca85-cabb,U+cabe-cabf,U+cac1-cac3,U+cac5-cacb,U+cacd-cad0,U+cad2,U+cad4-cad8,U+cada-caf3}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.22.woff2) format("woff2");unicode-range:U+c996-c997,U+c99a-c99c,U+c99e-c9bf,U+c9c2-c9c3,U+c9c5-c9c7,U+c9c9-c9cf,U+c9d2,U+c9d4,U+c9d7-c9d8,U+c9db,U+c9de-c9df,U+c9e1-c9e3,U+c9e5-c9e6,U+c9e8-c9eb,U+c9ee-c9f0,U+c9f2-c9f7,U+c9f9-ca0b,U+ca0d-ca28,U+ca2a-ca49}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.23.woff2) format("woff2");unicode-range:U+c8e9-c8f4,U+c8f6-c8fb,U+c8fe-c8ff,U+c901-c903,U+c905-c90b,U+c90e-c910,U+c912-c917,U+c919-c92b,U+c92d-c94f,U+c951-c953,U+c955-c96b,U+c96d-c973,U+c975-c987,U+c98a-c98b,U+c98d-c98f,U+c991-c995}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.24.woff2) format("woff2");unicode-range:U+c841-c84b,U+c84d-c86f,U+c872-c873,U+c875-c877,U+c879-c87f,U+c882-c884,U+c887-c88a,U+c88d-c8c3,U+c8c5-c8df,U+c8e1-c8e8}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.25.woff2) format("woff2");unicode-range:U+c779-c77b,U+c77e-c782,U+c786,U+c78b,U+c78d,U+c78f,U+c792-c793,U+c795,U+c797,U+c799-c79f,U+c7a2,U+c7a7-c7ab,U+c7ae-c7bb,U+c7bd-c7c0,U+c7c2-c7c7,U+c7c9-c7dc,U+c7de-c7ff,U+c802-c803,U+c805-c807,U+c809,U+c80b-c80f,U+c812,U+c814,U+c817-c81b,U+c81e-c81f,U+c821-c823,U+c825-c82e,U+c830-c837,U+c839-c83b,U+c83d-c840}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.26.woff2) format("woff2");unicode-range:U+c6bb-c6bf,U+c6c2,U+c6c4,U+c6c6-c6cb,U+c6ce-c6cf,U+c6d1-c6d3,U+c6d5-c6db,U+c6dd-c6df,U+c6e1-c6e7,U+c6e9-c6eb,U+c6ed-c6ef,U+c6f1-c6f8,U+c6fa-c703,U+c705-c707,U+c709-c70b,U+c70d-c716,U+c718,U+c71a-c71f,U+c722-c723,U+c725-c727,U+c729-c734,U+c736-c73b,U+c73e-c73f,U+c741-c743,U+c745-c74b,U+c74e-c750,U+c752-c757,U+c759-c773,U+c776-c777}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.27.woff2) format("woff2");unicode-range:U+c5f5-c5fb,U+c5fe,U+c602-c605,U+c607,U+c609-c60f,U+c611-c61a,U+c61c-c623,U+c626-c627,U+c629-c62b,U+c62d,U+c62f-c632,U+c636,U+c638,U+c63a-c63f,U+c642-c643,U+c645-c647,U+c649-c652,U+c656-c65b,U+c65d-c65f,U+c661-c663,U+c665-c677,U+c679-c67b,U+c67d-c693,U+c696-c697,U+c699-c69b,U+c69d-c6a3,U+c6a6,U+c6a8,U+c6aa-c6af,U+c6b2-c6b3,U+c6b5-c6b7,U+c6b9-c6ba}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.28.woff2) format("woff2");unicode-range:U+c517-c527,U+c52a-c52b,U+c52d-c52f,U+c531-c538,U+c53a,U+c53c,U+c53e-c543,U+c546-c547,U+c54b,U+c54d-c552,U+c556,U+c55a-c55b,U+c55d,U+c55f,U+c562-c563,U+c565-c567,U+c569-c56f,U+c572,U+c574,U+c576-c57b,U+c57e-c57f,U+c581-c583,U+c585-c586,U+c588-c58b,U+c58e,U+c590,U+c592-c596,U+c599-c5b3,U+c5b6-c5b7,U+c5ba,U+c5be-c5c3,U+c5ca-c5cb,U+c5cd,U+c5cf,U+c5d2-c5d3,U+c5d5-c5d7,U+c5d9-c5df,U+c5e1-c5e2,U+c5e4,U+c5e6-c5eb,U+c5ef,U+c5f1-c5f3}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.29.woff2) format("woff2");unicode-range:U+c475-c4ef,U+c4f2-c4f3,U+c4f5-c4f7,U+c4f9-c4ff,U+c502-c50b,U+c50d-c516}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.30.woff2) format("woff2");unicode-range:U+c3d0-c3d7,U+c3da-c3db,U+c3dd-c3de,U+c3e1-c3ec,U+c3ee-c3f3,U+c3f5-c42b,U+c42d-c463,U+c466-c474}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.31.woff2) format("woff2");unicode-range:U+c32b-c367,U+c36a-c36b,U+c36d-c36f,U+c371-c377,U+c37a-c37b,U+c37e-c383,U+c385-c387,U+c389-c3cf}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.32.woff2) format("woff2");unicode-range:U+c26a-c26b,U+c26d-c26f,U+c271-c273,U+c275-c27b,U+c27e-c287,U+c289-c28f,U+c291-c297,U+c299-c29a,U+c29c-c2a3,U+c2a5-c2a7,U+c2a9-c2ab,U+c2ad-c2b3,U+c2b6,U+c2b8,U+c2ba-c2bb,U+c2bd-c2db,U+c2de-c2df,U+c2e1-c2e2,U+c2e5-c2ea,U+c2ee,U+c2f0,U+c2f2-c2f5,U+c2f7,U+c2fa-c2fb,U+c2fd-c2ff,U+c301-c307,U+c309-c30c,U+c30e-c312,U+c315-c323,U+c325-c328,U+c32a}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.33.woff2) format("woff2");unicode-range:U+c1bc-c1c3,U+c1c5-c1df,U+c1e1-c1fb,U+c1fd-c203,U+c205-c20c,U+c20e,U+c210-c217,U+c21a-c21b,U+c21d-c21e,U+c221-c227,U+c229-c22a,U+c22c,U+c22e,U+c230,U+c233-c24f,U+c251-c257,U+c259-c269}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.34.woff2) format("woff2");unicode-range:U+c101-c11b,U+c11f,U+c121-c123,U+c125-c12b,U+c12e,U+c132-c137,U+c13a-c13b,U+c13d-c13f,U+c141-c147,U+c14a,U+c14c-c153,U+c155-c157,U+c159-c15b,U+c15d-c166,U+c169-c16f,U+c171-c177,U+c179-c18b,U+c18e-c18f,U+c191-c193,U+c195-c19b,U+c19d-c19e,U+c1a0,U+c1a2-c1a4,U+c1a6-c1bb}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.35.woff2) format("woff2");unicode-range:U+c049-c057,U+c059-c05b,U+c05d-c05f,U+c061-c067,U+c069-c08f,U+c091-c0ab,U+c0ae-c0af,U+c0b1-c0b3,U+c0b5,U+c0b7-c0bb,U+c0be,U+c0c2-c0c7,U+c0ca-c0cb,U+c0cd-c0cf,U+c0d1-c0d7,U+c0d9-c0da,U+c0dc,U+c0de-c0e3,U+c0e5-c0eb,U+c0ed-c0f3,U+c0f6,U+c0f8,U+c0fa-c0ff}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.36.woff2) format("woff2");unicode-range:U+bfa7-bfaf,U+bfb1-bfc4,U+bfc6-bfcb,U+bfce-bfcf,U+bfd1-bfd3,U+bfd5-bfdb,U+bfdd-c048}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.37.woff2) format("woff2");unicode-range:U+bf07,U+bf09-bf3f,U+bf41-bf4f,U+bf52-bf54,U+bf56-bfa6}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.38.woff2) format("woff2");unicode-range:U+be56,U+be58,U+be5c-be5f,U+be62-be63,U+be65-be67,U+be69-be74,U+be76-be7b,U+be7e-be7f,U+be81-be8e,U+be90,U+be92-bea7,U+bea9-becf,U+bed2-bed3,U+bed5-bed6,U+bed9-bee3,U+bee6-bf06}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.39.woff2) format("woff2");unicode-range:U+bdb0-bdd3,U+bdd5-bdef,U+bdf1-be0b,U+be0d-be0f,U+be11-be13,U+be15-be43,U+be46-be47,U+be49-be4b,U+be4d-be53}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.40.woff2) format("woff2");unicode-range:U+bd03,U+bd06,U+bd08,U+bd0a-bd0f,U+bd11-bd22,U+bd25-bd47,U+bd49-bd58,U+bd5a-bd7f,U+bd82-bd83,U+bd85-bd87,U+bd8a-bd8f,U+bd91-bd92,U+bd94,U+bd96-bd98,U+bd9a-bdaf}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.41.woff2) format("woff2");unicode-range:U+bc4e-bc83,U+bc86-bc87,U+bc89-bc8b,U+bc8d-bc93,U+bc96,U+bc98,U+bc9b-bc9f,U+bca2-bca3,U+bca5-bca7,U+bca9-bcb2,U+bcb4-bcbb,U+bcbe-bcbf,U+bcc1-bcc3,U+bcc5-bccc,U+bcce-bcd0,U+bcd2-bcd4,U+bcd6-bcf3,U+bcf7,U+bcf9-bcfb,U+bcfd-bd02}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.42.woff2) format("woff2");unicode-range:U+bb90-bba3,U+bba5-bbab,U+bbad-bbbf,U+bbc1-bbf7,U+bbfa-bbfb,U+bbfd-bbfe,U+bc01-bc07,U+bc09-bc0a,U+bc0e,U+bc10,U+bc12-bc13,U+bc17,U+bc19-bc1a,U+bc1e,U+bc20-bc23,U+bc26,U+bc28,U+bc2a-bc2c,U+bc2e-bc2f,U+bc32-bc33,U+bc35-bc37,U+bc39-bc3f,U+bc41-bc42,U+bc44,U+bc46-bc48,U+bc4a-bc4d}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.43.woff2) format("woff2");unicode-range:U+bae6-bafb,U+bafd-bb17,U+bb19-bb33,U+bb37,U+bb39-bb3a,U+bb3d-bb43,U+bb45-bb46,U+bb48,U+bb4a-bb4f,U+bb51-bb53,U+bb55-bb57,U+bb59-bb62,U+bb64-bb8f}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.44.woff2) format("woff2");unicode-range:U+ba30-ba37,U+ba3a-ba3b,U+ba3d-ba3f,U+ba41-ba47,U+ba49-ba4a,U+ba4c,U+ba4e-ba53,U+ba56-ba57,U+ba59-ba5b,U+ba5d-ba63,U+ba65-ba66,U+ba68-ba6f,U+ba71-ba73,U+ba75-ba77,U+ba79-ba84,U+ba86,U+ba88-baa7,U+baaa,U+baad-baaf,U+bab1-bab7,U+baba,U+babc,U+babe-bae5}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.45.woff2) format("woff2");unicode-range:U+b96e-b973,U+b976-b977,U+b979-b97b,U+b97d-b983,U+b986,U+b988,U+b98a-b98d,U+b98f-b9ab,U+b9ae-b9af,U+b9b1-b9b3,U+b9b5-b9bb,U+b9be,U+b9c0,U+b9c2-b9c7,U+b9ca-b9cb,U+b9cd,U+b9d2-b9d7,U+b9da,U+b9dc,U+b9df-b9e0,U+b9e2,U+b9e6-b9e7,U+b9e9-b9f3,U+b9f6,U+b9f8,U+b9fb-ba2f}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.46.woff2) format("woff2");unicode-range:U+b8bf-b8cb,U+b8cd-b8e0,U+b8e2-b8e7,U+b8ea-b8eb,U+b8ed-b8ef,U+b8f1-b8f7,U+b8fa,U+b8fc,U+b8fe-b903,U+b905-b917,U+b919-b91f,U+b921-b93b,U+b93d-b957,U+b95a-b95b,U+b95d-b95f,U+b961-b967,U+b969-b96c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.47.woff2) format("woff2");unicode-range:U+b80d-b80f,U+b811-b817,U+b81a,U+b81c-b823,U+b826-b827,U+b829-b82b,U+b82d-b833,U+b836,U+b83a-b83f,U+b841-b85b,U+b85e-b85f,U+b861-b863,U+b865-b86b,U+b86e,U+b870,U+b872-b8af,U+b8b1-b8be}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.48.woff2) format("woff2");unicode-range:U+b74d-b75f,U+b761-b763,U+b765-b774,U+b776-b77b,U+b77e-b77f,U+b781-b783,U+b785-b78b,U+b78e,U+b792-b796,U+b79a-b79b,U+b79d-b7a7,U+b7aa,U+b7ae-b7b3,U+b7b6-b7c8,U+b7ca-b7eb,U+b7ee-b7ef,U+b7f1-b7f3,U+b7f5-b7fb,U+b7fe,U+b802-b806,U+b80a-b80b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.49.woff2) format("woff2");unicode-range:U+b6a7-b6aa,U+b6ac-b6b0,U+b6b2-b6ef,U+b6f1-b727,U+b72a-b72b,U+b72d-b72e,U+b731-b737,U+b739-b73a,U+b73c-b743,U+b745-b74c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.50.woff2) format("woff2");unicode-range:U+b605-b60f,U+b612-b617,U+b619-b624,U+b626-b69b,U+b69e-b6a3,U+b6a5-b6a6}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.51.woff2) format("woff2");unicode-range:U+b55f,U+b562-b583,U+b585-b59f,U+b5a2-b5a3,U+b5a5-b5a7,U+b5a9-b5b2,U+b5b5-b5ba,U+b5bd-b604}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.52.woff2) format("woff2");unicode-range:U+b4a5-b4b6,U+b4b8-b4bf,U+b4c1-b4c7,U+b4c9-b4db,U+b4de-b4df,U+b4e1-b4e2,U+b4e5-b4eb,U+b4ee,U+b4f0,U+b4f2-b513,U+b516-b517,U+b519-b51a,U+b51d-b523,U+b526,U+b528,U+b52b-b52f,U+b532-b533,U+b535-b537,U+b539-b53f,U+b541-b544,U+b546-b54b,U+b54d-b54f,U+b551-b55b,U+b55d-b55e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.53.woff2) format("woff2");unicode-range:U+b3f8-b3fb,U+b3fd-b40f,U+b411-b417,U+b419-b41b,U+b41d-b41f,U+b421-b427,U+b42a-b42b,U+b42d-b44f,U+b452-b453,U+b455-b457,U+b459-b45f,U+b462-b464,U+b466-b46b,U+b46d-b47f,U+b481-b4a3}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.54.woff2) format("woff2");unicode-range:U+b342-b353,U+b356-b357,U+b359-b35b,U+b35d-b35e,U+b360-b363,U+b366,U+b368,U+b36a-b36d,U+b36f,U+b372-b373,U+b375-b377,U+b379-b37f,U+b381-b382,U+b384,U+b386-b38b,U+b38d-b3c3,U+b3c6-b3c7,U+b3c9-b3ca,U+b3cd-b3d3,U+b3d6,U+b3d8,U+b3da-b3f7}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.55.woff2) format("woff2");unicode-range:U+b27c-b283,U+b285-b28f,U+b292-b293,U+b295-b297,U+b29a-b29f,U+b2a1-b2a4,U+b2a7-b2a9,U+b2ab,U+b2ad-b2c7,U+b2ca-b2cb,U+b2cd-b2cf,U+b2d1-b2d7,U+b2da,U+b2dc,U+b2de-b2e3,U+b2e7,U+b2e9-b2ea,U+b2ef-b2f3,U+b2f6,U+b2f8,U+b2fa-b2fb,U+b2fd-b2fe,U+b302-b303,U+b305-b307,U+b309-b30f,U+b312,U+b316-b31b,U+b31d-b341}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.56.woff2) format("woff2");unicode-range:U+b1d6-b1e7,U+b1e9-b1fc,U+b1fe-b203,U+b206-b207,U+b209-b20b,U+b20d-b213,U+b216-b21f,U+b221-b257,U+b259-b273,U+b275-b27b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.57.woff2) format("woff2");unicode-range:U+b120-b122,U+b126-b127,U+b129-b12b,U+b12d-b133,U+b136,U+b138,U+b13a-b13f,U+b142-b143,U+b145-b14f,U+b151-b153,U+b156-b157,U+b159-b177,U+b17a-b17b,U+b17d-b17f,U+b181-b187,U+b189-b18c,U+b18e-b191,U+b195-b1a7,U+b1a9-b1cb,U+b1cd-b1d5}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.58.woff2) format("woff2");unicode-range:U+b05f-b07b,U+b07e-b07f,U+b081-b083,U+b085-b08b,U+b08d-b097,U+b09b,U+b09d-b09f,U+b0a2-b0a7,U+b0aa,U+b0b0,U+b0b2,U+b0b6-b0b7,U+b0b9-b0bb,U+b0bd-b0c3,U+b0c6-b0c7,U+b0ca-b0cf,U+b0d1-b0df,U+b0e1-b0e4,U+b0e6-b107,U+b10a-b10b,U+b10d-b10f,U+b111-b112,U+b114-b117,U+b119-b11a,U+b11c-b11f}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.59.woff2) format("woff2");unicode-range:U+afac-afb7,U+afba-afbb,U+afbd-afbf,U+afc1-afc6,U+afca-afcc,U+afce-afd3,U+afd5-afe7,U+afe9-afef,U+aff1-b00b,U+b00d-b00f,U+b011-b013,U+b015-b01b,U+b01d-b027,U+b029-b043,U+b045-b047,U+b049,U+b04b,U+b04d-b052,U+b055-b056,U+b058-b05c,U+b05e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.60.woff2) format("woff2");unicode-range:U+af03-af07,U+af09-af2b,U+af2e-af33,U+af35-af3b,U+af3e-af40,U+af44-af47,U+af4a-af5c,U+af5e-af63,U+af65-af7f,U+af81-afab}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.61.woff2) format("woff2");unicode-range:U+ae56-ae5b,U+ae5e-ae60,U+ae62-ae64,U+ae66-ae67,U+ae69-ae6b,U+ae6d-ae83,U+ae85-aebb,U+aebf,U+aec1-aec3,U+aec5-aecb,U+aece,U+aed0,U+aed2-aed7,U+aed9-aef3,U+aef5-af02}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.62.woff2) format("woff2");unicode-range:U+ad9c-ada3,U+ada5-adbf,U+adc1-adc3,U+adc5-adc7,U+adc9-add2,U+add4-addb,U+addd-addf,U+ade1-ade3,U+ade5-adf7,U+adfa-adfb,U+adfd-adff,U+ae02-ae07,U+ae0a,U+ae0c,U+ae0e-ae13,U+ae15-ae2f,U+ae31-ae33,U+ae35-ae37,U+ae39-ae3f,U+ae42,U+ae44,U+ae46-ae49,U+ae4b,U+ae4f,U+ae51-ae53,U+ae55}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.63.woff2) format("woff2");unicode-range:U+ace2-ace3,U+ace5-ace6,U+ace9-acef,U+acf2,U+acf4,U+acf7-acfb,U+acfe-acff,U+ad01-ad03,U+ad05-ad0b,U+ad0d-ad10,U+ad12-ad1b,U+ad1d-ad33,U+ad35-ad48,U+ad4a-ad4f,U+ad51-ad6b,U+ad6e-ad6f,U+ad71-ad72,U+ad77-ad7c,U+ad7e,U+ad80,U+ad82-ad87,U+ad89-ad8b,U+ad8d-ad8f,U+ad91-ad9b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.64.woff2) format("woff2");unicode-range:U+ac25-ac2c,U+ac2e,U+ac30,U+ac32-ac37,U+ac39-ac3f,U+ac41-ac4c,U+ac4e-ac6f,U+ac72-ac73,U+ac75-ac76,U+ac79-ac7f,U+ac82,U+ac84-ac88,U+ac8a-ac8b,U+ac8d-ac8f,U+ac91-ac93,U+ac95-ac9b,U+ac9d-ac9e,U+aca1-aca7,U+acab,U+acad-acaf,U+acb1-acb7,U+acba-acbb,U+acbe-acc0,U+acc2-acc3,U+acc5-acdf}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.65.woff2) format("woff2");unicode-range:U+99df,U+99ed,U+99f1,U+99ff,U+9a01,U+9a08,U+9a0e-9a0f,U+9a19,U+9a2b,U+9a30,U+9a36-9a37,U+9a40,U+9a43,U+9a45,U+9a4d,U+9a55,U+9a57,U+9a5a-9a5b,U+9a5f,U+9a62,U+9a65,U+9a69-9a6a,U+9aa8,U+9ab8,U+9ad3,U+9ae5,U+9aee,U+9b1a,U+9b27,U+9b2a,U+9b31,U+9b3c,U+9b41-9b45,U+9b4f,U+9b54,U+9b5a,U+9b6f,U+9b8e,U+9b91,U+9b9f,U+9bab,U+9bae,U+9bc9,U+9bd6,U+9be4,U+9be8,U+9c0d,U+9c10,U+9c12,U+9c15,U+9c25,U+9c32,U+9c3b,U+9c47,U+9c49,U+9c57,U+9ce5,U+9ce7,U+9ce9,U+9cf3-9cf4,U+9cf6,U+9d09,U+9d1b,U+9d26,U+9d28,U+9d3b,U+9d51,U+9d5d,U+9d60-9d61,U+9d6c,U+9d72,U+9da9,U+9daf,U+9db4,U+9dc4,U+9dd7,U+9df2,U+9df8-9dfa,U+9e1a,U+9e1e,U+9e75,U+9e79,U+9e7d,U+9e7f,U+9e92-9e93,U+9e97,U+9e9d,U+9e9f,U+9ea5,U+9eb4-9eb5,U+9ebb,U+9ebe,U+9ec3,U+9ecd-9ece,U+9ed4,U+9ed8,U+9edb-9edc,U+9ede,U+9ee8,U+9ef4,U+9f07-9f08,U+9f0e,U+9f13,U+9f20,U+9f3b,U+9f4a-9f4b,U+9f4e,U+9f52,U+9f5f,U+9f61,U+9f67,U+9f6a,U+9f6c,U+9f77,U+9f8d,U+9f90,U+9f95,U+9f9c,U+ac02-ac03,U+ac05-ac06,U+ac09-ac0f,U+ac17-ac18,U+ac1b,U+ac1e-ac1f,U+ac21-ac23}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.94.woff2) format("woff2");unicode-range:U+3136,U+3138,U+313a-3140,U+3143-3144,U+3150,U+3152,U+3154-3156,U+3158-315b,U+315d-315f,U+3162,U+3164-318c,U+318e,U+3200-321b,U+3231,U+3239,U+3251-325a,U+3260-327b,U+327e-327f,U+328a-3290,U+3294,U+329e,U+32a5,U+3380-3384,U+3388-338b}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.95.woff2) format("woff2");unicode-range:U+2f7d,U+2f7f-2f8b,U+2f8e-2f90,U+2f92-2f97,U+2f99-2fa0,U+2fa2-2fa3,U+2fa5-2fa9,U+2fac-2fb1,U+2fb3-2fbc,U+2fc1-2fca,U+2fcd-2fd4,U+3003,U+3012-3019,U+301c,U+301e-3020,U+3036,U+3041,U+3043,U+3045,U+3047,U+3049,U+304e,U+3050,U+3052,U+3056,U+305a,U+305c,U+305e,U+3062,U+3065,U+306c,U+3070-307d,U+3080,U+3085,U+3087,U+308e,U+3090-3091,U+30a1,U+30a5,U+30a9,U+30ae,U+30b1-30b2,U+30b4,U+30b6,U+30bc-30be,U+30c2,U+30c5,U+30cc,U+30d2,U+30d4,U+30d8-30dd,U+30e4,U+30e6,U+30e8,U+30ee,U+30f0-30f2,U+30f4-30f6,U+3133,U+3135}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.100.woff2) format("woff2");unicode-range:U+e8,U+2da,U+2160,U+2194,U+3054,U+3058,U+306d,U+3086,U+308d,U+30ac,U+30bb,U+30c4,U+30cd-30ce,U+30e2,U+3132,U+3146,U+3149,U+339d,U+4e3b,U+4f0a,U+4fdd,U+4fe1,U+5409,U+540c,U+5834,U+592a-592b,U+5b9a,U+5dde,U+5e0c,U+5e73,U+5f0f,U+60f3,U+653f,U+661f,U+662f,U+667a,U+683c,U+6b4c,U+6c11,U+767c,U+76ee,U+76f4,U+77f3,U+79d1,U+7a7a,U+7b2c,U+7d22,U+8207,U+8a00,U+8a71,U+9280,U+9580,U+958b,U+96c6,U+9762,U+98df,U+9ed1,U+ac2d,U+adc8,U+add3,U+af48,U+b014,U+b134-b135,U+b158,U+b2aa,U+b35f,U+b6a4,U+b9cf,U+bb63,U+bd23,U+be91,U+c29b,U+c3f4,U+c42c,U+c55c,U+c573,U+c58f,U+c78c,U+c7dd,U+c8f5,U+cad1,U+cc48,U+cf10,U+cf20,U+d03c,U+d07d,U+d2a0,U+d30e,U+d38d,U+d3a8,U+d3c8,U+d5e5,U+d5f9,U+d6e4,U+f90a,U+ff02,U+ff1c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.101.woff2) format("woff2");unicode-range:U+3b1,U+2466,U+25a1,U+25a3,U+261c,U+3008-3009,U+305b,U+305d,U+3069,U+30a7,U+30ba,U+30cf,U+30ef,U+3151,U+3157,U+4e4b,U+4e5f,U+4e8c,U+4eca,U+4ed6,U+4f5b,U+50cf,U+5149,U+5165,U+5171,U+5229,U+529b,U+5316,U+539f,U+53f2,U+571f,U+5728,U+58eb,U+591c,U+5b78,U+5c11,U+5c55,U+5ddd,U+5e02,U+5fb7,U+60c5,U+610f,U+611f,U+6625,U+66f8,U+6797,U+679c,U+682a,U+6d2a,U+706b,U+7406,U+767b,U+76f8,U+77e5,U+7acb,U+898b,U+8a69,U+8def,U+8fd1,U+901a,U+90e8,U+91cd,U+975e,U+ae14,U+ae6c,U+aec0,U+afc7,U+afc9,U+b01c,U+b028,U+b308,U+b311,U+b314,U+b31c,U+b524,U+b560,U+b764,U+b920,U+b9e3,U+bd48,U+be7d,U+c0db,U+c231,U+c270,U+c2e3,U+c37d,U+c3ed,U+c530,U+c6a5,U+c6dc,U+c7a4,U+c954,U+c974,U+d000,U+d565,U+d667,U+d6c5,U+d79d,U+ff1e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.102.woff2) format("woff2");unicode-range:U+131,U+2032,U+2465,U+2642,U+3048,U+3051,U+3083-3084,U+308f,U+30c0,U+30d1,U+30d3,U+30d6,U+30df,U+30e7,U+3153,U+4e16,U+4e8b,U+4ee5,U+5206,U+52a0,U+52d5,U+53e4,U+53ef,U+54c1,U+57ce,U+597d,U+5b8c,U+5ea6,U+5f8c,U+5f97,U+6210,U+6240,U+624b,U+6728,U+6bd4,U+7236,U+7269,U+7279,U+738b,U+7528,U+7530,U+767e,U+798f,U+8005,U+8a18,U+90fd,U+91cc,U+9577,U+9593,U+98a8,U+ac20,U+acf6,U+ad90,U+af5d,U+af80,U+afcd,U+aff0,U+b0a1,U+b0b5,U+b1fd,U+b2fc,U+b380,U+b51b,U+b584,U+b5b3,U+b8fd,U+b93c,U+b9f4,U+bb44,U+bc08,U+bc27,U+bc49,U+be55,U+be64,U+bfb0,U+bfc5,U+c178,U+c21f,U+c314,U+c4f1,U+c58d,U+c664,U+c698,U+c6a7,U+c6c1,U+c9ed,U+cac0,U+cacc,U+cad9,U+ccb5,U+cdcc,U+d0e4,U+d143,U+d320,U+d330,U+d54d,U+ff06,U+ff1f,U+ff5e}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.103.woff2) format("woff2");unicode-range:U+b4,U+20a9,U+20ac,U+2190,U+24d8,U+2502,U+2514,U+2592,U+25c7-25c8,U+2663,U+3060,U+3064,U+3081,U+3088,U+30a3,U+30a6,U+30aa,U+30b5,U+30c7,U+30ca-30cb,U+30d0,U+30e3,U+30e5,U+339e,U+4e09,U+4eac,U+4f5c,U+5167-5168,U+516c,U+51fa,U+5408,U+540d,U+591a,U+5b57,U+6211,U+65b9,U+660e,U+6642,U+6700,U+6b63,U+6e2f,U+7063,U+7532,U+793e,U+81ea,U+8272,U+82b1,U+897f,U+8eca,U+91ce,U+ac38,U+ad76,U+ae84,U+aecc,U+b07d,U+b0b1,U+b215,U+b2a0,U+b310,U+b3d7,U+b52a,U+b618,U+b775,U+b797,U+bcd5,U+bd59,U+be80,U+bea8,U+bed1,U+bee4-bee5,U+c060,U+c2ef,U+c329,U+c3dc,U+c597,U+c5bd,U+c5e5,U+c69c,U+c9d6,U+ca29,U+ca5c,U+ca84,U+cc39,U+cc3b,U+ce89,U+cee5,U+cf65,U+cf85,U+d058,U+d145,U+d22d,U+d325,U+d37d,U+d3ad,U+d769,U+ff0c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.104.woff2) format("woff2");unicode-range:U+2161,U+2228,U+2299,U+2464,U+2517,U+2640,U+3042,U+304a,U+3053,U+3061,U+307f,U+3082,U+308c,U+3092,U+30a8,U+30ab,U+30ad,U+30b0,U+30b3,U+30b7,U+30c1,U+30c6,U+30c9,U+30d5,U+30d7,U+30de,U+30e0-30e1,U+30ec-30ed,U+4e0b,U+4e0d,U+4ee3,U+53f0,U+548c,U+5b89,U+5bb6,U+5c0f,U+611b,U+6771,U+6aa2,U+6bcd,U+6c34,U+6cd5,U+6d77,U+767d,U+795e,U+8ecd,U+9999,U+9ad8,U+ac07,U+ac1a,U+ac40,U+ad0c,U+ad88,U+ada4,U+ae01,U+ae65,U+aebd,U+aec4,U+afe8,U+b139,U+b205,U+b383,U+b38c,U+b42c,U+b461,U+b55c,U+b78f,U+b8fb,U+b9f7,U+bafc,U+bc99,U+bed8,U+bfcd,U+c0bf,U+c0f9,U+c167,U+c204,U+c20f,U+c22f,U+c258,U+c298,U+c2bc,U+c388,U+c501,U+c50c,U+c5b9,U+c5ce,U+c641,U+c648,U+c73d,U+ca50,U+ca61,U+cc4c,U+ceac,U+d0d4,U+d5f7,U+d6d7,U+ff1a}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.105.woff2) format("woff2");unicode-range:U+2103,U+2463,U+25c6,U+25cb,U+266c,U+3001,U+300a,U+3046,U+304c-304d,U+304f,U+3055,U+3059,U+3063,U+3066-3068,U+306f,U+3089,U+30b8,U+30bf,U+314f,U+4e0a,U+570b,U+5730,U+5916,U+5929,U+5c71,U+5e74,U+5fc3,U+601d,U+6027,U+63d0,U+6709,U+6734,U+751f,U+7684,U+82f1,U+9053,U+91d1,U+97f3,U+ac2f,U+ac4d,U+adc4,U+ade4,U+ae41,U+ae4d-ae4e,U+aed1,U+afb9,U+b0e0,U+b299,U+b365,U+b46c,U+b480,U+b4c8,U+b7b4,U+b819,U+b918,U+baab,U+bab9,U+be8f,U+bed7,U+c0ec,U+c19f,U+c1a5,U+c3d9,U+c464,U+c53d,U+c553,U+c570,U+c5cc,U+c633,U+c6a4,U+c7a3,U+c7a6,U+c886,U+c9d9-c9da,U+c9ec,U+ca0c,U+cc21,U+cd1b,U+cd78,U+cdc4,U+cef8,U+cfe4,U+d0a5,U+d0b5,U+d0ec,U+d15d,U+d188,U+d23c,U+d2ac,U+d729,U+d79b,U+ff01,U+ff08-ff09,U+ff5c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.106.woff2) format("woff2");unicode-range:U+2039-203a,U+223c,U+25b3,U+25b7,U+25bd,U+25cf,U+266a,U+3002,U+300b,U+304b,U+3057,U+305f,U+306a-306b,U+307e,U+308a-308b,U+3093,U+30a2,U+30af,U+30b9,U+30c3,U+30c8,U+30e9-30eb,U+33a1,U+4e00,U+524d,U+5357,U+5b50,U+7121,U+884c,U+9751,U+ac94,U+aebe,U+aecd,U+af08,U+af41,U+af49,U+b010,U+b053,U+b109,U+b11b,U+b128,U+b154,U+b291,U+b2e6,U+b301,U+b385,U+b525,U+b5b4,U+b729,U+b72f,U+b738,U+b7ff,U+b837,U+b975,U+ba67,U+bb47,U+bc1f,U+bd90,U+bfd4,U+c27c,U+c324,U+c379,U+c3e0,U+c465,U+c53b,U+c58c,U+c610,U+c653,U+c6cd,U+c813,U+c82f,U+c999,U+c9e0,U+cac4,U+cad3,U+cbd4,U+cc10,U+cc22,U+ccb8,U+ccbc,U+cda5,U+ce84,U+cea3,U+cf67,U+cfe1,U+d241,U+d30d,U+d31c,U+d391,U+d401,U+d479,U+d5c9,U+d5db,U+d649,U+d6d4}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.107.woff2) format("woff2");unicode-range:U+b0,U+e9,U+2193,U+2462,U+260e,U+261e,U+300e-300f,U+3044,U+30a4,U+30fb-30fc,U+314d,U+5973,U+6545,U+6708,U+7537,U+ac89,U+ac9c,U+acc1,U+ad04,U+ad75,U+ad7d,U+ae45,U+ae61,U+af42,U+b0ab,U+b0af,U+b0b3,U+b12c,U+b194,U+b1a8,U+b220,U+b258,U+b284,U+b2ff,U+b315,U+b371,U+b3d4-b3d5,U+b460,U+b527,U+b534,U+b810,U+b818,U+b98e,U+ba55,U+bbac,U+bc0b,U+bc40,U+bca1,U+bccd,U+bd93,U+be54,U+be5a,U+bf08,U+bf50,U+bf55,U+bfdc,U+c0c0,U+c0d0,U+c0f4,U+c100,U+c11e,U+c170,U+c20d,U+c274,U+c290,U+c308,U+c369,U+c539,U+c587,U+c5ff,U+c6ec,U+c70c,U+c7ad,U+c7c8,U+c83c,U+c881,U+cb48,U+cc60,U+ce69,U+ce6b,U+ce75,U+cf04,U+cf08,U+cf55,U+cf70,U+cffc,U+d0b7,U+d1a8,U+d2c8,U+d384,U+d47c,U+d48b,U+d5dd,U+d5e8,U+d720,U+d759,U+f981}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.108.woff2) format("woff2");unicode-range:U+e0,U+e2,U+395,U+3b7,U+3ba,U+2460-2461,U+25a0,U+3010-3011,U+306e,U+30f3,U+314a,U+314c,U+5927,U+65b0,U+7e41,U+97d3,U+9ad4,U+ad49,U+ae0b,U+ae0d,U+ae43,U+ae5d,U+aecf,U+af3c,U+af64,U+afd4,U+b080,U+b084,U+b0c5,U+b10c,U+b1e8,U+b2ac,U+b36e,U+b451,U+b515,U+b540,U+b561,U+b6ab,U+b6b1,U+b72c,U+b730,U+b744,U+b800,U+b8ec,U+b8f0,U+b904,U+b968,U+b96d,U+b987,U+b9d9,U+bb36,U+bb49,U+bc2d,U+bc43,U+bcf6,U+bd89,U+be57,U+be61,U+bed4,U+c090,U+c130,U+c148,U+c19c,U+c2f9,U+c36c,U+c37c,U+c384,U+c3df,U+c575,U+c584,U+c660,U+c719,U+c816,U+ca4d,U+ca54,U+cabc,U+cb49,U+cc14,U+cff5,U+d004,U+d038,U+d0b4,U+d0d3,U+d0e0,U+d0ed,U+d131,U+d1b0,U+d31f,U+d33d,U+d3a0,U+d3ab,U+d514,U+d584,U+d6a1,U+d6cc,U+d749,U+d760,U+d799}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.109.woff2) format("woff2");unicode-range:U+24,U+60,U+3b9,U+3bb,U+3bd,U+2191,U+2606,U+300c-300d,U+3131,U+3134,U+3139,U+3141-3142,U+3148,U+3161,U+3163,U+321c,U+4eba,U+5317,U+ac31,U+ac77,U+ac9f,U+acb9,U+acf0-acf1,U+acfd,U+ad73,U+af3d,U+b00c,U+b04a,U+b057,U+b0c4,U+b188,U+b1cc,U+b214,U+b2db,U+b2ee,U+b304,U+b4ed,U+b518,U+b5bc,U+b625,U+b69c-b69d,U+b7ac,U+b801,U+b86c,U+b959,U+b95c,U+b985,U+ba48,U+bb58,U+bc0c,U+bc38,U+bc85,U+bc9a,U+bf40,U+c068,U+c0bd,U+c0cc,U+c12f,U+c149,U+c1e0,U+c22b,U+c22d,U+c250,U+c2fc,U+c300,U+c313,U+c370,U+c3d8,U+c557,U+c580,U+c5e3,U+c62e,U+c634,U+c6f0,U+c74d,U+c783,U+c78e,U+c796,U+c7bc,U+c92c,U+ca4c,U+cc1c,U+cc54,U+cc59,U+ce04,U+cf30,U+cfc4,U+d140,U+d321,U+d38c,U+d399,U+d54f,U+d587,U+d5d0,U+d6e8,U+d770}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.110.woff2) format("woff2");unicode-range:U+d7,U+ea,U+fc,U+2192,U+25bc,U+3000,U+3137,U+3145,U+315c,U+7f8e,U+ac13,U+ac71,U+ac90,U+acb8,U+ace7,U+ad7f,U+ae50,U+aef4,U+af34,U+afbc,U+b048,U+b09a,U+b0ad,U+b0bc,U+b113,U+b125,U+b141,U+b20c,U+b2d9,U+b2ed,U+b367,U+b369,U+b374,U+b3cb,U+b4ec,U+b611,U+b760,U+b81b,U+b834,U+b8b0,U+b8e1,U+b989,U+b9d1,U+b9e1,U+b9fa,U+ba4d,U+ba78,U+bb35,U+bb54,U+bbf9,U+bc11,U+bcb3,U+bd05,U+bd95,U+bdd4,U+be10,U+bed0,U+bf51,U+c0d8,U+c232,U+c2b7,U+c2eb,U+c378,U+c500,U+c52c,U+c549,U+c568,U+c598,U+c5c9,U+c61b,U+c639,U+c67c,U+c717,U+c78a,U+c80a,U+c90c-c90d,U+c950,U+c9e7,U+cbe4,U+cca9,U+cce4,U+cdb0,U+ce78,U+ce94,U+ce98,U+cf8c,U+d018,U+d034,U+d0f1,U+d1b1,U+d280,U+d2f8,U+d338,U+d380,U+d3b4,U+d610,U+d69f,U+d6fc,U+d758}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.111.woff2) format("woff2");unicode-range:U+e7,U+2022,U+203b,U+25c0,U+2605,U+2661,U+3147,U+318d,U+672c,U+8a9e,U+acaa,U+acbc,U+ad1c,U+ae4a,U+ae5c,U+b044,U+b054,U+b0c8-b0c9,U+b2a6,U+b2d0,U+b35c,U+b364,U+b428,U+b454,U+b465,U+b4b7,U+b4e3,U+b51c,U+b5a1,U+b784,U+b790,U+b7ab,U+b7f4,U+b82c,U+b835,U+b8e9,U+b8f8,U+b9d8,U+b9f9,U+ba5c,U+ba64,U+babd,U+bb18,U+bb3b,U+bbff,U+bc0d,U+bc45,U+bc97,U+bcbc,U+be45,U+be75,U+be7c,U+bfcc,U+c0b6,U+c0f7,U+c14b,U+c2b4,U+c30d,U+c4f8,U+c5bb,U+c5d1,U+c5e0,U+c5ee,U+c5fd,U+c606,U+c6c5,U+c6e0,U+c708,U+c81d,U+c820,U+c824,U+c878,U+c918,U+c96c,U+c9e4,U+c9f1,U+cc2e,U+cd09,U+cea1,U+cef5,U+cef7,U+cf64,U+cf69,U+cfe8,U+d035,U+d0ac,U+d230,U+d234,U+d2f4,U+d31d,U+d575,U+d578,U+d608,U+d614,U+d718,U+d751,U+d761,U+d78c,U+d790}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.112.woff2) format("woff2");unicode-range:U+2665,U+3160,U+4e2d,U+6587,U+65e5,U+ac12,U+ac14,U+ac16,U+ac81,U+ad34,U+ade0,U+ae54,U+aebc,U+af2c,U+afc0,U+afc8,U+b04c,U+b08c,U+b099,U+b0a9,U+b0ac,U+b0ae,U+b0b8,U+b123,U+b179,U+b2e5,U+b2f7,U+b4c0,U+b531,U+b538,U+b545,U+b550,U+b5a8,U+b6f0,U+b728,U+b73b,U+b7ad,U+b7ed,U+b809,U+b864,U+b86d,U+b871,U+b9bf,U+b9f5,U+ba40,U+ba4b,U+ba58,U+ba87,U+baac,U+bbc0,U+bc16,U+bc34,U+bd07,U+bd99,U+be59,U+bfd0,U+c058,U+c0e4,U+c0f5,U+c12d,U+c139,U+c228,U+c529,U+c5c7,U+c635,U+c637,U+c735,U+c77d,U+c787,U+c789,U+c8c4,U+c989,U+c98c,U+c9d0,U+c9d3,U+cc0c,U+cc99,U+cd0c,U+cd2c,U+cd98,U+cda4,U+ce59,U+ce60,U+ce6d,U+cea0,U+d0d0-d0d1,U+d0d5,U+d14d,U+d1a4,U+d29c,U+d2f1,U+d301,U+d39c,U+d3bc,U+d4e8,U+d540,U+d5ec,U+d640,U+d750}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.113.woff2) format("woff2");unicode-range:U+5e,U+25b2,U+25b6,U+314e,U+ac24,U+ace1,U+ace4,U+ae68,U+af2d,U+b0d0,U+b0e5,U+b150,U+b155,U+b193,U+b2c9,U+b2dd,U+b3c8,U+b3fc,U+b410,U+b458,U+b4dd,U+b5a0,U+b5a4,U+b5bb,U+b7b5,U+b838,U+b840,U+b86f,U+b8f9,U+b960,U+b9e5,U+bab8,U+bb50,U+bc1d,U+bc24-bc25,U+bca8,U+bcbd,U+bd04,U+bd10,U+bd24,U+be48,U+be5b,U+be68,U+c05c,U+c12c,U+c140,U+c15c,U+c168,U+c194,U+c219,U+c27d,U+c2a8,U+c2f1,U+c2f8,U+c368,U+c554-c555,U+c559,U+c564,U+c5d8,U+c5fc,U+c625,U+c65c,U+c6b1,U+c728,U+c794,U+c84c,U+c88c,U+c8e0,U+c8fd,U+c998,U+c9dd,U+cc0d,U+cc30,U+ceec,U+cf13,U+cf1c,U+cf5c,U+d050,U+d07c,U+d0a8,U+d134,U+d138,U+d154,U+d1f4,U+d2bc,U+d329,U+d32c,U+d3d0,U+d3f4,U+d3fc,U+d56b,U+d5cc,U+d600-d601,U+d639,U+d6c8,U+d754,U+d765}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.114.woff2) format("woff2");unicode-range:U+3c-3d,U+2026,U+24d2,U+314b,U+ac11,U+acf3,U+ad74,U+ad81,U+adf9,U+ae34,U+af43,U+afb8,U+b05d,U+b07c,U+b110,U+b118,U+b17c,U+b180,U+b18d,U+b192,U+b2cc,U+b355,U+b378,U+b4a4,U+b4ef,U+b78d,U+b799,U+b7a9,U+b7fd,U+b807,U+b80c,U+b839,U+b9b4,U+b9db,U+ba3c,U+bab0,U+bba4,U+bc94,U+be4c,U+c154,U+c1c4,U+c26c,U+c2ac,U+c2ed,U+c4f4,U+c55e,U+c561,U+c571,U+c5b5,U+c5c4,U+c654-c655,U+c695,U+c6e8,U+c6f9,U+c724,U+c751,U+c775,U+c7a0,U+c7c1,U+c874,U+c880,U+c9d5,U+c9f8,U+cabd,U+cc29,U+cc2c,U+cca8,U+ccab,U+ccd0,U+ce21,U+ce35,U+ce7c,U+ce90,U+cee8,U+cef4,U+cfe0,U+d070,U+d0b9,U+d0c1,U+d0c4,U+d0c8,U+d15c,U+d1a1,U+d2c0,U+d300,U+d314,U+d3ed,U+d478,U+d480,U+d48d,U+d508,U+d53d,U+d5e4,U+d611,U+d61c,U+d68d,U+d6a8,U+d798}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.115.woff2) format("woff2");unicode-range:U+23,U+25,U+5f,U+a9,U+ac08,U+ac78,U+aca8,U+acac,U+ace8,U+ad70,U+adc0,U+addc,U+b137,U+b140,U+b208,U+b290,U+b2f5,U+b3c5,U+b3cc,U+b420,U+b429,U+b529,U+b530,U+b77d,U+b79c,U+b7a8,U+b7c9,U+b7f0,U+b7fc,U+b828,U+b860,U+b9ad,U+b9c1,U+b9c9,U+b9dd-b9de,U+b9e8,U+ba38-ba39,U+babb,U+bc00,U+bc8c,U+bca0,U+bca4,U+bcd1,U+bcfc,U+bd09,U+bdf0,U+be60,U+c0ad,U+c0b4,U+c0bc,U+c190,U+c1fc,U+c220,U+c288,U+c2b9,U+c2f6,U+c528,U+c545,U+c558,U+c5bc,U+c5d4,U+c600,U+c644,U+c6c0,U+c6c3,U+c721,U+c798,U+c7a1,U+c811,U+c838,U+c871,U+c904,U+c990,U+c9dc,U+cc38,U+cc44,U+cca0,U+cd1d,U+cd95,U+cda9,U+ce5c,U+cf00,U+cf58,U+d150,U+d22c,U+d305,U+d328,U+d37c,U+d3f0,U+d551,U+d5a5,U+d5c8,U+d5d8,U+d63c,U+d64d,U+d669,U+d734,U+d76c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.116.woff2) format("woff2");unicode-range:U+26,U+2b,U+3e,U+40,U+7e,U+ac01,U+ac19,U+ac1d,U+aca0,U+aca9,U+acb0,U+ad8c,U+ae09,U+ae38,U+ae40,U+aed8,U+b09c,U+b0a0,U+b108,U+b204,U+b298,U+b2d8,U+b2eb-b2ec,U+b2f4,U+b313,U+b358,U+b450,U+b4e0,U+b54c,U+b610,U+b780,U+b78c,U+b791,U+b8e8,U+b958,U+b974,U+b984,U+b9b0,U+b9bc-b9bd,U+b9ce,U+ba70,U+bbfc,U+bc0f,U+bc15,U+bc1b,U+bc31,U+bc95,U+bcc0,U+bcc4,U+bd81,U+bd88,U+c0c8,U+c11d,U+c13c,U+c158,U+c18d,U+c1a1,U+c21c,U+c4f0,U+c54a,U+c560,U+c5b8,U+c5c8,U+c5f4,U+c628,U+c62c,U+c678,U+c6cc,U+c808,U+c810,U+c885,U+c88b,U+c900,U+c988,U+c99d,U+c9c8,U+cc3d-cc3e,U+cc45,U+cd08,U+ce20,U+cee4,U+d074,U+d0a4,U+d0dd,U+d2b9,U+d3b8,U+d3c9,U+d488,U+d544,U+d559,U+d56d,U+d588,U+d615,U+d648,U+d655,U+d658,U+d65c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.117.woff2) format("woff2");unicode-range:U+d,U+48,U+7c,U+ac10,U+ac15,U+ac74,U+ac80,U+ac83,U+acc4,U+ad11,U+ad50,U+ad6d,U+adfc,U+ae00,U+ae08,U+ae4c,U+b0a8,U+b124,U+b144,U+b178,U+b274,U+b2a5,U+b2e8,U+b2f9,U+b354,U+b370,U+b418,U+b41c,U+b4f1,U+b514,U+b798,U+b808,U+b824-b825,U+b8cc,U+b978,U+b9d0,U+b9e4,U+baa9,U+bb3c,U+bc18,U+bc1c,U+bc30,U+bc84,U+bcf5,U+bcf8,U+bd84,U+be0c,U+be14,U+c0b0,U+c0c9,U+c0dd,U+c124,U+c2dd,U+c2e4,U+c2ec,U+c54c,U+c57c-c57d,U+c591,U+c5c5-c5c6,U+c5ed,U+c608,U+c640,U+c6b8,U+c6d4,U+c784,U+c7ac,U+c800-c801,U+c9c1,U+c9d1,U+cc28,U+cc98,U+cc9c,U+ccad,U+cd5c,U+cd94,U+cd9c,U+cde8,U+ce68,U+cf54,U+d0dc,U+d14c,U+d1a0,U+d1b5,U+d2f0,U+d30c,U+d310,U+d398,U+d45c,U+d50c,U+d53c,U+d560,U+d568,U+d589,U+d604,U+d6c4,U+d788}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.118.woff2) format("woff2");unicode-range:U+39,U+49,U+4d-4e,U+a0,U+ac04,U+ac1c,U+ac70,U+ac8c,U+acbd,U+acf5,U+acfc,U+ad00,U+ad6c,U+adf8,U+b098,U+b0b4,U+b294,U+b2c8,U+b300,U+b3c4,U+b3d9,U+b4dc,U+b4e4,U+b77c,U+b7ec,U+b85d,U+b97c,U+b9c8,U+b9cc,U+ba54,U+ba74,U+ba85,U+baa8,U+bb34,U+bb38,U+bbf8,U+bc14,U+bc29,U+bc88,U+bcf4,U+bd80,U+be44,U+c0c1,U+c11c,U+c120,U+c131,U+c138,U+c18c,U+c218,U+c2b5,U+c2e0,U+c544,U+c548,U+c5b4,U+c5d0,U+c5ec,U+c5f0,U+c601,U+c624,U+c694,U+c6a9,U+c6b0,U+c6b4,U+c6d0,U+c704,U+c720,U+c73c,U+c740,U+c744,U+c74c,U+c758,U+c77c,U+c785,U+c788,U+c790-c791,U+c7a5,U+c804,U+c815,U+c81c,U+c870,U+c8fc,U+c911,U+c9c4,U+ccb4,U+ce58,U+ce74,U+d06c,U+d0c0,U+d130,U+d2b8,U+d3ec,U+d504,U+d55c,U+d569,U+d574,U+d638,U+d654,U+d68c}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshVAuA8jEe2LD_Xfj-yqp8xQ6VsVzYGYHDC3g.119.woff2) format("woff2");unicode-range:U+20-22,U+27-2a,U+2c-38,U+3a-3b,U+3f,U+41-47,U+4a-4c,U+4f-5d,U+61-7b,U+7d,U+a1,U+ab,U+ae,U+b7,U+bb,U+bf,U+2013-2014,U+201c-201d,U+2122,U+ac00,U+ace0,U+ae30,U+b2e4,U+b85c,U+b9ac,U+c0ac,U+c2a4,U+c2dc,U+c774,U+c778,U+c9c0,U+d558}@font-face{font-family:Gugi;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/gugi/v20/A2BVn5dXywshZAmK9RMckqI.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.0.woff2) format("woff2");unicode-range:U+25ee8,U+25f23,U+25f5c,U+25fd4,U+25fe0,U+25ffb,U+2600c,U+26017,U+26060,U+260ed,U+26222,U+2626a,U+26270,U+26286,U+2634c,U+26402,U+2667e,U+266b0,U+2671d,U+268dd,U+268ea,U+26951,U+2696f,U+26999,U+269dd,U+26a1e,U+26a58,U+26a8c,U+26ab7,U+26aff,U+26c29,U+26c73,U+26c9e,U+26cdd,U+26e40,U+26e65,U+26f94,U+26ff6-26ff8,U+270f4,U+2710d,U+27139,U+273da-273db,U+273fe,U+27410,U+27449,U+27614-27615,U+27631,U+27684,U+27693,U+2770e,U+27723,U+27752,U+278b2,U+27985,U+279b4,U+27a84,U+27bb3,U+27bbe,U+27bc7,U+27c3c,U+27cb8,U+27d73,U+27da0,U+27e10,U+27eaf,U+27fb7,U+2808a,U+280bb,U+28277,U+28282,U+282f3,U+283cd,U+2840c,U+28455,U+284dc,U+2856b,U+285c8-285c9,U+286d7,U+286fa,U+28946,U+28949,U+2896b,U+28987-28988,U+289ba-289bb,U+28a1e,U+28a29,U+28a43,U+28a71,U+28a99,U+28acd,U+28add,U+28ae4,U+28bc1,U+28bef,U+28cdd,U+28d10,U+28d71,U+28dfb,U+28e0f,U+28e17,U+28e1f,U+28e36,U+28e89,U+28eeb,U+28ef6,U+28f32,U+28ff8,U+292a0,U+292b1,U+29490,U+295cf,U+2967f,U+296f0,U+29719,U+29750,U+29810,U+298c6,U+29a72,U+29d4b,U+29ddb,U+29e15,U+29e3d,U+29e49,U+29e8a,U+29ec4,U+29edb,U+29ee9,U+29fce,U+29fd7,U+2a01a,U+2a02f,U+2a082,U+2a0f9,U+2a190,U+2a2b2,U+2a38c,U+2a437,U+2a5f1,U+2a602,U+2a61a,U+2a6b2,U+2a9e6,U+2b746,U+2b751,U+2b753,U+2b75a,U+2b75c,U+2b765,U+2b776-2b777,U+2b77c,U+2b782,U+2b789,U+2b78b,U+2b78e,U+2b794,U+2b7ac,U+2b7af,U+2b7bd,U+2b7c9,U+2b7cf,U+2b7d2,U+2b7d8,U+2b7f0,U+2b80d,U+2b817,U+2b81a,U+2d544,U+2e278,U+2e569,U+2e6ea,U+2f804,U+2f80f,U+2f815,U+2f818,U+2f81a,U+2f822,U+2f828,U+2f82c,U+2f833,U+2f83f,U+2f846,U+2f852,U+2f862,U+2f86d,U+2f873,U+2f877,U+2f884,U+2f899-2f89a,U+2f8a6,U+2f8ac,U+2f8b2,U+2f8b6,U+2f8d3,U+2f8db-2f8dc,U+2f8e1,U+2f8e5,U+2f8ea,U+2f8ed,U+2f8fc,U+2f903,U+2f90b,U+2f90f,U+2f91a,U+2f920-2f921,U+2f945,U+2f947,U+2f96c,U+2f995,U+2f9d0,U+2f9de-2f9df,U+2f9f4}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.1.woff2) format("woff2");unicode-range:U+1f235-1f23b,U+1f240-1f248,U+1f250-1f251,U+2000b,U+20089-2008a,U+200a2,U+200a4,U+200b0,U+200f5,U+20158,U+201a2,U+20213,U+2032b,U+20371,U+20381,U+203f9,U+2044a,U+20509,U+2053f,U+205b1,U+205d6,U+20611,U+20628,U+206ec,U+2074f,U+207c8,U+20807,U+2083a,U+208b9,U+2090e,U+2097c,U+20984,U+2099d,U+20a64,U+20ad3,U+20b1d,U+20b9f,U+20bb7,U+20d45,U+20d58,U+20de1,U+20e64,U+20e6d,U+20e95,U+20f5f,U+21201,U+2123d,U+21255,U+21274,U+2127b,U+212d7,U+212e4,U+212fd,U+2131b,U+21336,U+21344,U+213c4,U+2146d-2146e,U+215d7,U+21647,U+216b4,U+21706,U+21742,U+218bd,U+219c3,U+21a1a,U+21c56,U+21d2d,U+21d45,U+21d62,U+21d78,U+21d92,U+21d9c,U+21da1,U+21db7,U+21de0,U+21e33-21e34,U+21f1e,U+21f76,U+21ffa,U+2217b,U+22218,U+2231e,U+223ad,U+22609,U+226f3,U+2285b,U+228ab,U+2298f,U+22ab8,U+22b46,U+22b4f-22b50,U+22ba6,U+22c1d,U+22c24,U+22de1,U+22e42,U+22feb,U+231b6,U+231c3-231c4,U+231f5,U+23372,U+233cc,U+233d0,U+233d2-233d3,U+233d5,U+233da,U+233df,U+233e4,U+233fe,U+2344a-2344b,U+23451,U+23465,U+234e4,U+2355a,U+23594,U+235c4,U+23638-2363a,U+23647,U+2370c,U+2371c,U+2373f,U+23763-23764,U+237e7,U+237f1,U+237ff,U+23824,U+2383d,U+23a98,U+23c7f,U+23cbe,U+23cfe,U+23d00,U+23d0e,U+23d40,U+23dd3,U+23df9-23dfa,U+23f7e,U+2404b,U+24096,U+24103,U+241c6,U+241fe,U+242ee,U+243bc,U+243d0,U+24629,U+246a5,U+247f1,U+24896,U+248e9,U+24a4d,U+24b56,U+24b6f,U+24c16,U+24d14,U+24e04,U+24e0e,U+24e37,U+24e6a,U+24e8b,U+24ff2,U+2504a,U+25055,U+25122,U+251a9,U+251cd,U+251e5,U+2521e,U+2524c,U+2542e,U+2548e,U+254d9,U+2550e,U+255a7,U+2567f,U+25771,U+257a9,U+257b4,U+25874,U+259c4,U+259cc,U+259d4,U+25ad7,U+25ae3-25ae4,U+25af1,U+25bb2,U+25c4b,U+25c64,U+25da1,U+25e2e,U+25e56,U+25e62,U+25e65,U+25ec2,U+25ed8}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.2.woff2) format("woff2");unicode-range:U+ffd7,U+ffda-ffdc,U+ffe0-ffe2,U+ffe4,U+ffe6,U+ffe8-ffee,U+1f100-1f10c,U+1f110-1f16c,U+1f170-1f1ac,U+1f200-1f202,U+1f210-1f234}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.3.woff2) format("woff2");unicode-range:U+fa10,U+fa12-fa6d,U+fb00-fb04,U+fe10-fe19,U+fe30-fe42,U+fe44-fe52,U+fe54-fe66,U+fe68-fe6b,U+ff02,U+ff04,U+ff07,U+ff51,U+ff5b,U+ff5d,U+ff5f-ff60,U+ff66,U+ff69,U+ff87,U+ffa1-ffbe,U+ffc2-ffc7,U+ffca-ffcf,U+ffd2-ffd6}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.4.woff2) format("woff2");unicode-range:U+f92d-f959,U+f95b-f9f2,U+f9f4-fa0b,U+fa0e-fa0f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.5.woff2) format("woff2");unicode-range:U+9e8b-9e8c,U+9e8e-9e8f,U+9e91-9e92,U+9e95-9e96,U+9e98,U+9e9b,U+9e9d-9e9e,U+9ea4-9ea5,U+9ea8-9eaa,U+9eac-9eb0,U+9eb3-9eb5,U+9eb8,U+9ebc-9ebf,U+9ec3,U+9ec6,U+9ec8,U+9ecb-9ecd,U+9ecf-9ed1,U+9ed4-9ed5,U+9ed8,U+9edb-9ee0,U+9ee4-9ee5,U+9ee7-9ee8,U+9eec-9ef2,U+9ef4-9ef9,U+9efb-9eff,U+9f02-9f03,U+9f07-9f09,U+9f0e-9f12,U+9f14-9f17,U+9f19-9f1b,U+9f1f-9f22,U+9f26,U+9f2a-9f2c,U+9f2f,U+9f31-9f32,U+9f34,U+9f37,U+9f39-9f3a,U+9f3c-9f3f,U+9f41,U+9f43-9f47,U+9f4a,U+9f4e-9f50,U+9f52-9f58,U+9f5a,U+9f5d-9f61,U+9f63,U+9f66-9f6a,U+9f6c-9f73,U+9f75-9f77,U+9f7a,U+9f7d,U+9f7f,U+9f8f-9f92,U+9f94-9f97,U+9f99,U+9f9c-9fa3,U+9fa5,U+9fb4,U+9fbc-9fc2,U+9fc4,U+9fc6,U+9fcc,U+f900-f92c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.6.woff2) format("woff2");unicode-range:U+9c3e,U+9c41,U+9c43-9c4a,U+9c4e-9c50,U+9c52-9c54,U+9c56,U+9c58,U+9c5a-9c61,U+9c63,U+9c65,U+9c67-9c6b,U+9c6d-9c6e,U+9c70,U+9c72,U+9c75-9c78,U+9c7a-9c7c,U+9ce6-9ce7,U+9ceb-9cec,U+9cf0,U+9cf2,U+9cf6-9cf7,U+9cf9,U+9d02-9d03,U+9d06-9d09,U+9d0b,U+9d0e,U+9d11-9d12,U+9d15,U+9d17-9d18,U+9d1b-9d1f,U+9d23,U+9d26,U+9d2a-9d2c,U+9d2f-9d30,U+9d32-9d34,U+9d3a,U+9d3c-9d3f,U+9d41-9d48,U+9d4a,U+9d50-9d54,U+9d59,U+9d5d-9d65,U+9d69-9d6c,U+9d6f-9d70,U+9d72-9d73,U+9d76-9d77,U+9d7a-9d7c,U+9d7e,U+9d83-9d84,U+9d86-9d87,U+9d89-9d8a,U+9d8d-9d8e,U+9d92-9d93,U+9d95-9d9a,U+9da1,U+9da4,U+9da9-9dac,U+9dae,U+9db1-9db2,U+9db5,U+9db8-9dbd,U+9dbf-9dc4,U+9dc6-9dc7,U+9dc9-9dca,U+9dcf,U+9dd3-9dd7,U+9dd9-9dda,U+9dde-9de0,U+9de3,U+9de5-9de7,U+9de9,U+9deb,U+9ded-9df0,U+9df3-9df4,U+9df8,U+9dfd-9dfe,U+9e02,U+9e07,U+9e0a,U+9e0d-9e0e,U+9e10-9e12,U+9e15-9e16,U+9e19-9e1f,U+9e75,U+9e79-9e7d,U+9e80-9e85,U+9e87-9e88}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.7.woff2) format("woff2");unicode-range:U+9ae5-9ae7,U+9ae9,U+9aeb-9aec,U+9aee-9aef,U+9af1-9af5,U+9af7,U+9af9-9afb,U+9afd,U+9aff-9b06,U+9b08-9b09,U+9b0b-9b0e,U+9b10,U+9b12,U+9b16,U+9b18-9b1d,U+9b1f-9b20,U+9b22-9b23,U+9b25-9b2f,U+9b32-9b35,U+9b37,U+9b39-9b3b,U+9b3d,U+9b43-9b44,U+9b48,U+9b4b-9b4f,U+9b51,U+9b55-9b58,U+9b5b,U+9b5e,U+9b61,U+9b63,U+9b65-9b66,U+9b68,U+9b6a-9b6f,U+9b72-9b79,U+9b7f-9b80,U+9b83-9b87,U+9b89-9b8b,U+9b8d,U+9b8f-9b94,U+9b96-9b97,U+9b9a,U+9b9d-9ba0,U+9ba6-9ba7,U+9ba9-9baa,U+9bac,U+9bb0-9bb2,U+9bb4,U+9bb7-9bb9,U+9bbb-9bbc,U+9bbe-9bc1,U+9bc6-9bc8,U+9bca,U+9bce-9bd2,U+9bd4,U+9bd7-9bd8,U+9bdd,U+9bdf,U+9be1-9be5,U+9be7,U+9bea-9beb,U+9bee-9bf3,U+9bf5,U+9bf7-9bfa,U+9bfd,U+9bff-9c00,U+9c02,U+9c04,U+9c06,U+9c08-9c0d,U+9c0f-9c16,U+9c18-9c1e,U+9c21-9c2a,U+9c2d-9c32,U+9c35-9c37,U+9c39-9c3a,U+9c3d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.8.woff2) format("woff2");unicode-range:U+98eb,U+98ed-98ee,U+98f0-98f1,U+98f3,U+98f6,U+9902,U+9907-9909,U+9911-9912,U+9914-9918,U+991a-9922,U+9924,U+9926-9927,U+992b-992c,U+992e,U+9931-9935,U+9939-993e,U+9940-9942,U+9945-9949,U+994b-994e,U+9950-9952,U+9954-9955,U+9958-9959,U+995b-995c,U+995e-9960,U+9963,U+9997-9998,U+999b,U+999d-999f,U+99a3,U+99a5-99a6,U+99a8,U+99ad-99ae,U+99b0-99b2,U+99b5,U+99b9-99ba,U+99bc-99bd,U+99bf,U+99c1,U+99c3,U+99c8-99c9,U+99d1,U+99d3-99d5,U+99d8-99df,U+99e1-99e2,U+99e7,U+99ea-99ee,U+99f0-99f2,U+99f4-99f5,U+99f8-99f9,U+99fb-99fe,U+9a01-9a05,U+9a08,U+9a0a-9a0c,U+9a0f-9a11,U+9a16,U+9a1a,U+9a1e,U+9a20,U+9a22-9a24,U+9a27,U+9a2b,U+9a2d-9a2e,U+9a31,U+9a33,U+9a35-9a38,U+9a3e,U+9a40-9a45,U+9a47,U+9a4a-9a4e,U+9a51-9a52,U+9a54-9a58,U+9a5b,U+9a5d,U+9a5f,U+9a62,U+9a64-9a65,U+9a69-9a6c,U+9aaa,U+9aac-9ab0,U+9ab2,U+9ab4-9ab7,U+9ab9,U+9abb-9ac1,U+9ac3,U+9ac6,U+9ac8,U+9ace-9ad3,U+9ad5-9ad7,U+9adb-9adc,U+9ade-9ae0,U+9ae2-9ae4}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.9.woff2) format("woff2");unicode-range:U+971d,U+9721-9724,U+9728,U+972a,U+9730-9731,U+9733,U+9736,U+9738-9739,U+973b,U+973d-973e,U+9741-9744,U+9746-974a,U+974d-974f,U+9751,U+9755,U+9757-9758,U+975a-975c,U+9760-9761,U+9763-9764,U+9766-9768,U+976a-976b,U+976e,U+9771,U+9773,U+9776-977d,U+977f-9781,U+9785-9786,U+9789,U+978b,U+978f-9790,U+9795-9797,U+9799-979a,U+979c,U+979e-97a0,U+97a2-97a3,U+97a6,U+97a8,U+97ab-97ac,U+97ae,U+97b1-97b6,U+97b8-97ba,U+97bc,U+97be-97bf,U+97c1,U+97c3-97ce,U+97d0-97d1,U+97d4,U+97d7-97d9,U+97db-97de,U+97e0-97e1,U+97e4,U+97e6,U+97ed-97ef,U+97f1-97f2,U+97f4-97f8,U+97fa,U+9804,U+9807,U+980a,U+980c-980f,U+9814,U+9816-9817,U+9819-981a,U+981c,U+981e,U+9820-9821,U+9823-9826,U+982b,U+982e-9830,U+9832-9835,U+9837,U+9839,U+983d-983e,U+9844,U+9846-9847,U+984a-984b,U+984f,U+9851-9853,U+9856-9857,U+9859-985b,U+9862-9863,U+9865-9866,U+986a-986c,U+986f-9871,U+9873-9875,U+98aa-98ab,U+98ad-98ae,U+98b0-98b1,U+98b4,U+98b6-98b8,U+98ba-98bc,U+98bf,U+98c2-98c8,U+98cb-98cc,U+98ce,U+98dc,U+98de,U+98e0-98e1,U+98e3,U+98e5-98e7,U+98e9-98ea}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.10.woff2) format("woff2");unicode-range:U+944a,U+944c,U+9452-9453,U+9455,U+9459-945c,U+945e-9463,U+9468,U+946a-946b,U+946d-9472,U+9475,U+9477,U+947c-947f,U+9481,U+9483-9485,U+9578-9579,U+957e-957f,U+9582,U+9584,U+9586-9588,U+958a,U+958c-958f,U+9592,U+9594,U+9596,U+9598-9599,U+959d-95a1,U+95a4,U+95a6-95a9,U+95ab-95ad,U+95b1,U+95b4,U+95b6,U+95b9-95bf,U+95c3,U+95c6,U+95c8-95cd,U+95d0-95d6,U+95d9-95da,U+95dc-95e2,U+95e4-95e6,U+95e8,U+961d-961e,U+9621-9622,U+9624-9626,U+9628,U+962c,U+962e-962f,U+9631,U+9633-9634,U+9637-963a,U+963c-963d,U+9641-9642,U+964b-964c,U+964f,U+9652,U+9654,U+9656-9658,U+965c-965f,U+9661,U+9666,U+966a,U+966c,U+966e,U+9672,U+9674,U+9677,U+967b-967c,U+967e-967f,U+9681-9684,U+9689,U+968b,U+968d,U+9691,U+9695-9698,U+969a,U+969d,U+969f,U+96a4-96aa,U+96ae-96b4,U+96b6,U+96b8-96bb,U+96bd,U+96c1,U+96c9-96cb,U+96cd-96ce,U+96d2,U+96d5-96d6,U+96d8-96da,U+96dc-96df,U+96e9,U+96ef,U+96f1,U+96f9-96fa,U+9702-9706,U+9708-9709,U+970d-970f,U+9711,U+9713-9714,U+9716,U+9719-971b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.11.woff2) format("woff2");unicode-range:U+92bc-92bd,U+92bf-92c3,U+92c5-92c8,U+92cb-92d0,U+92d2-92d3,U+92d5,U+92d7-92d9,U+92dc-92dd,U+92df-92e1,U+92e3-92e5,U+92e7-92ea,U+92ec,U+92ee,U+92f0,U+92f2,U+92f7-92fb,U+92ff-9300,U+9302,U+9304,U+9308,U+930d,U+930f-9311,U+9314-9315,U+9318-931a,U+931c-931f,U+9321-9325,U+9327-932b,U+932e,U+9333-9337,U+933a-933b,U+9344,U+9347-934a,U+934d,U+9350-9352,U+9354-9358,U+935a,U+935c,U+935e,U+9360,U+9364-9365,U+9367,U+9369-936d,U+936f-9371,U+9373-9374,U+9376,U+937a,U+937d-9382,U+9388,U+938a-938b,U+938d,U+938f,U+9392,U+9394-9395,U+9397-9398,U+939a-939b,U+939e,U+93a1,U+93a3-93a4,U+93a6,U+93a8-93a9,U+93ab-93ad,U+93b0,U+93b4-93b6,U+93b9-93bb,U+93c1,U+93c3-93cd,U+93d0-93d1,U+93d3,U+93d6-93d9,U+93dc-93df,U+93e2,U+93e4-93e8,U+93f1,U+93f5,U+93f7-93fb,U+93fd,U+9401-9404,U+9407-9409,U+940d-9410,U+9413-9417,U+9419-941a,U+941f,U+9421,U+942b,U+942e-942f,U+9431-9434,U+9436,U+9438,U+943a-943b,U+943d,U+943f,U+9441,U+9443-9445,U+9448}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.12.woff2) format("woff2");unicode-range:U+9143,U+9146-914c,U+914f,U+9153,U+9156-915b,U+9161,U+9163-9165,U+9167,U+9169,U+916d,U+9172-9174,U+9179-917b,U+9181-9183,U+9185-9187,U+9189-918b,U+918e,U+9191,U+9193-9195,U+9197-9198,U+919e,U+91a1-91a2,U+91a6,U+91a8,U+91aa-91b6,U+91ba-91bd,U+91bf-91c6,U+91c9,U+91cb,U+91d0,U+91d3-91d4,U+91d6-91d7,U+91d9-91db,U+91de-91df,U+91e1,U+91e4-91e6,U+91e9-91ea,U+91ec-91f1,U+91f5-91f7,U+91f9,U+91fb-91fd,U+91ff-9201,U+9204-9207,U+9209-920a,U+920c,U+920e,U+9210-9218,U+921c-921e,U+9223-9226,U+9228-9229,U+922c,U+922e-9230,U+9233,U+9235-923a,U+923c,U+923e-9240,U+9242-9243,U+9245-924b,U+924d-9251,U+9256-925a,U+925c-925e,U+9260-9261,U+9264-9269,U+926e-9270,U+9275-9279,U+927b-927f,U+9288-928a,U+928d-928e,U+9291-9293,U+9295-9297,U+9299,U+929b-929c,U+929f-92a0,U+92a4-92a5,U+92a7-92a8,U+92ab,U+92af,U+92b2-92b3,U+92b6-92bb}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.13.woff2) format("woff2");unicode-range:U+8f52-8f55,U+8f57-8f58,U+8f5c-8f5e,U+8f61-8f66,U+8f9c-8f9d,U+8f9f-8fa2,U+8fa4-8fa8,U+8fad-8faf,U+8fb4-8fb8,U+8fbe,U+8fc0-8fc2,U+8fc6,U+8fc8,U+8fca-8fcb,U+8fcd,U+8fd0,U+8fd2-8fd3,U+8fd5,U+8fda,U+8fe0,U+8fe2-8fe5,U+8fe8-8fea,U+8fed-8fef,U+8ff1,U+8ff4-8ff6,U+8ff8-8ffb,U+8ffe,U+9002,U+9004-9005,U+9008,U+900b-900e,U+9011,U+9013,U+9015-9016,U+9018,U+901b,U+901e,U+9021,U+9027-902a,U+902c-902d,U+902f,U+9033-9037,U+9039,U+903c,U+903e-903f,U+9041,U+9043-9044,U+9049,U+904c,U+904f-9052,U+9056,U+9058,U+905b-905e,U+9062,U+9066-9068,U+906c,U+906f-9070,U+9072,U+9074,U+9076,U+9079,U+9080-9083,U+9085,U+9087-9088,U+908b-908c,U+908e-9090,U+9095,U+9097-9099,U+909b,U+90a0-90a2,U+90a5,U+90a8,U+90af-90b6,U+90bd-90be,U+90c3-90c5,U+90c7-90c9,U+90cc,U+90d2,U+90d5,U+90d7-90d9,U+90db-90df,U+90e2,U+90e4-90e5,U+90eb,U+90ef-90f0,U+90f2,U+90f4,U+90f6,U+90fe-9100,U+9102,U+9104-9106,U+9108,U+910d,U+9110,U+9112,U+9114-911a,U+911c,U+911e,U+9120,U+9122-9123,U+9125,U+9127,U+9129,U+912d-9132,U+9134,U+9136-9137,U+9139-913a,U+913c-913d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.14.woff2) format("woff2");unicode-range:U+8dc0,U+8dc2,U+8dc5-8dc8,U+8dca-8dcc,U+8dce-8dcf,U+8dd1,U+8dd4-8dd7,U+8dd9-8ddb,U+8ddf,U+8de3-8de5,U+8de7,U+8dea-8dec,U+8df0-8df2,U+8df4,U+8dfc-8dfd,U+8dff,U+8e01,U+8e04-8e06,U+8e08-8e09,U+8e0b-8e0c,U+8e10-8e11,U+8e14,U+8e16,U+8e1d-8e23,U+8e26-8e27,U+8e30-8e31,U+8e33-8e39,U+8e3d,U+8e40-8e42,U+8e44,U+8e47-8e50,U+8e54-8e55,U+8e59,U+8e5b-8e64,U+8e69,U+8e6c-8e6d,U+8e6f-8e72,U+8e75-8e77,U+8e79-8e7c,U+8e81-8e85,U+8e89,U+8e8b,U+8e90-8e95,U+8e98-8e9b,U+8e9d-8e9e,U+8ea1-8ea2,U+8ea7,U+8ea9-8eaa,U+8eac-8eb1,U+8eb3,U+8eb5-8eb6,U+8eba-8ebb,U+8ebe,U+8ec0-8ec1,U+8ec3-8ec8,U+8ecb,U+8ecf,U+8ed1,U+8ed4,U+8edb-8edc,U+8ee3,U+8ee8,U+8eeb,U+8eed-8eee,U+8ef0-8ef1,U+8ef7,U+8ef9-8efc,U+8efe,U+8f00,U+8f02,U+8f05,U+8f07-8f08,U+8f0a,U+8f0f-8f10,U+8f12-8f13,U+8f15-8f19,U+8f1b-8f1c,U+8f1e-8f21,U+8f23,U+8f25-8f28,U+8f2b-8f2f,U+8f33-8f37,U+8f39-8f3b,U+8f3e,U+8f40-8f43,U+8f45-8f47,U+8f49-8f4a,U+8f4c-8f4f,U+8f51}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.15.woff2) format("woff2");unicode-range:U+8b2d,U+8b30,U+8b37,U+8b3c,U+8b3e,U+8b41-8b46,U+8b48-8b49,U+8b4c-8b4f,U+8b51-8b54,U+8b56,U+8b59,U+8b5b,U+8b5e-8b5f,U+8b63,U+8b69,U+8b6b-8b6d,U+8b6f,U+8b71,U+8b74,U+8b76,U+8b78-8b79,U+8b7c-8b81,U+8b84-8b85,U+8b8a-8b8f,U+8b92-8b96,U+8b99-8b9a,U+8b9c-8ba0,U+8c38-8c3a,U+8c3d-8c3f,U+8c41,U+8c45,U+8c47-8c49,U+8c4b-8c4c,U+8c4e-8c51,U+8c53-8c55,U+8c57-8c59,U+8c5b,U+8c5d,U+8c62-8c64,U+8c66,U+8c68-8c69,U+8c6b-8c6d,U+8c73,U+8c75-8c76,U+8c78,U+8c7a-8c7c,U+8c7e,U+8c82,U+8c85-8c87,U+8c89-8c8b,U+8c8d-8c8e,U+8c90,U+8c92-8c94,U+8c98-8c99,U+8c9b-8c9c,U+8c9f,U+8ca4,U+8cad-8cae,U+8cb2-8cb3,U+8cb6,U+8cb9-8cba,U+8cbd,U+8cc1-8cc2,U+8cc4-8cc6,U+8cc8-8cc9,U+8ccb,U+8ccd-8ccf,U+8cd2,U+8cd5-8cd6,U+8cd9-8cda,U+8cdd,U+8ce1,U+8ce3-8ce4,U+8ce6,U+8ce8,U+8cec,U+8cef-8cf2,U+8cf4-8cf5,U+8cf7-8cf8,U+8cfa-8cfb,U+8cfd-8cff,U+8d01,U+8d03-8d04,U+8d07,U+8d09-8d0b,U+8d0d-8d10,U+8d12-8d14,U+8d16-8d17,U+8d1b-8d1d,U+8d65,U+8d67,U+8d69,U+8d6b-8d6e,U+8d71,U+8d73,U+8d76,U+8d7f,U+8d81-8d82,U+8d84,U+8d88,U+8d8d,U+8d90-8d91,U+8d95,U+8d99,U+8d9e-8da0,U+8da6,U+8da8,U+8dab-8dac,U+8daf,U+8db2,U+8db5,U+8db7,U+8db9-8dbc,U+8dbe}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.16.woff2) format("woff2");unicode-range:U+8973-8975,U+8977,U+897a-897e,U+8980,U+8983,U+8988-898a,U+898d,U+8990,U+8993-8995,U+8998,U+899b-899c,U+899f-89a1,U+89a5-89a6,U+89a9,U+89ac,U+89af-89b0,U+89b2,U+89b4-89b7,U+89ba,U+89bc-89bd,U+89bf-89c1,U+89d4-89d8,U+89da,U+89dc-89dd,U+89e5,U+89e7,U+89e9,U+89eb,U+89ed,U+89f1,U+89f3-89f4,U+89f6,U+89f8-89f9,U+89fd,U+89ff,U+8a01,U+8a04-8a05,U+8a07,U+8a0c,U+8a0f-8a12,U+8a14-8a16,U+8a1b,U+8a1d-8a1e,U+8a20-8a22,U+8a24-8a26,U+8a2b-8a2c,U+8a2f,U+8a35-8a37,U+8a3b,U+8a3d-8a3e,U+8a40-8a41,U+8a43,U+8a45-8a49,U+8a4d-8a4e,U+8a51-8a54,U+8a56-8a58,U+8a5b-8a5d,U+8a61-8a62,U+8a65,U+8a67,U+8a6c-8a6d,U+8a75-8a77,U+8a79-8a7c,U+8a7e-8a80,U+8a82-8a86,U+8a8b,U+8a8f-8a92,U+8a96-8a97,U+8a99-8a9a,U+8a9f,U+8aa1,U+8aa3,U+8aa5-8aaa,U+8aae-8aaf,U+8ab3,U+8ab6-8ab7,U+8abb-8abc,U+8abe,U+8ac2-8ac4,U+8ac6,U+8ac8-8aca,U+8acc-8acd,U+8ad0-8ad1,U+8ad3-8ad5,U+8ad7,U+8ada-8ae2,U+8ae4,U+8ae7,U+8aeb-8aec,U+8aee,U+8af0-8af1,U+8af3-8af7,U+8afa,U+8afc,U+8aff,U+8b01-8b02,U+8b04-8b07,U+8b0a-8b0d,U+8b0f-8b11,U+8b14,U+8b16,U+8b1a,U+8b1c,U+8b1e-8b20,U+8b26,U+8b28,U+8b2b-8b2c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.17.woff2) format("woff2");unicode-range:U+87e2-87e6,U+87ea-87ed,U+87ef,U+87f1,U+87f3,U+87f5-87f8,U+87fa-87fb,U+87fe-87ff,U+8801,U+8803,U+8805-8807,U+8809-880b,U+880d-8816,U+8818-881c,U+881e-881f,U+8821-8822,U+8827-8828,U+882d-882e,U+8830-8832,U+8835-8836,U+8839-883c,U+8841-8845,U+8848-884b,U+884d-884e,U+8851-8852,U+8855-8856,U+8858-885a,U+885c,U+885e-8860,U+8862,U+8864,U+8869,U+886b,U+886e-886f,U+8871-8872,U+8875,U+8877,U+8879,U+887b,U+887d-887e,U+8880-8882,U+8888,U+888d,U+8892,U+8897-889c,U+889e-88a0,U+88a2,U+88a4,U+88a8,U+88aa,U+88ae,U+88b0-88b1,U+88b5,U+88b7,U+88ba,U+88bc-88c0,U+88c3-88c4,U+88c6,U+88ca-88ce,U+88d1-88d4,U+88d8-88d9,U+88db,U+88dd-88e1,U+88e7-88e8,U+88ef-88f2,U+88f4-88f5,U+88f7,U+88f9,U+88fc,U+8901-8902,U+8904,U+8906,U+890a,U+890c-890f,U+8913,U+8915-8916,U+8918-891a,U+891c-891e,U+8920,U+8925-8928,U+892a-892b,U+8930-8932,U+8935-893b,U+893e,U+8940-8946,U+8949,U+894c-894d,U+894f,U+8952,U+8956-8957,U+895a-895c,U+895e,U+8960-8964,U+8966,U+896a-896b,U+896d-8970}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.18.woff2) format("woff2");unicode-range:U+8655-8659,U+865b,U+865d-8664,U+8667,U+8669,U+866c,U+866f,U+8671,U+8675-8677,U+867a-867b,U+867d,U+8687-8689,U+868b-868d,U+8691,U+8693,U+8695-8696,U+8698,U+869a,U+869c-869d,U+86a1,U+86a3-86a4,U+86a6-86ab,U+86ad,U+86af-86b1,U+86b3-86b9,U+86bf-86c1,U+86c3-86c6,U+86c9,U+86cb,U+86ce,U+86d1-86d2,U+86d4-86d5,U+86d7,U+86da,U+86dc,U+86de-86e0,U+86e3-86e7,U+86e9,U+86ec-86ed,U+86ef,U+86f8-86fe,U+8700,U+8703-870b,U+870d-8714,U+8719-871a,U+871e-871f,U+8721-8723,U+8725,U+8728-8729,U+872e-872f,U+8731-8732,U+8734,U+8737,U+8739-8740,U+8743,U+8745,U+8749,U+874b-874e,U+8751,U+8753,U+8755,U+8757-8759,U+875d,U+875f-8761,U+8763-8766,U+8768,U+876a,U+876e-876f,U+8771-8772,U+8774,U+8778,U+877b-877c,U+877f,U+8782-8789,U+878b-878c,U+878e,U+8790,U+8793,U+8795,U+8797-8799,U+879e-87a0,U+87a2-87a3,U+87a7,U+87ab-87af,U+87b1,U+87b3,U+87b5,U+87bb,U+87bd-87c1,U+87c4,U+87c6-87cb,U+87ce,U+87d0,U+87d2,U+87d5-87d6,U+87d9-87da,U+87dc,U+87df-87e0}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.19.woff2) format("woff2");unicode-range:U+84b4,U+84b9-84bb,U+84bd-84c2,U+84c6-84ca,U+84cc-84d1,U+84d3,U+84d6,U+84d9-84da,U+84dc,U+84e7,U+84ea,U+84ec,U+84ef-84f2,U+84f4,U+84f7,U+84fa-84fd,U+84ff-8500,U+8502-8503,U+8506-8507,U+850c,U+850e,U+8510,U+8514-8515,U+8517-8518,U+851a-851c,U+851e-851f,U+8521-8525,U+8527,U+852a-852c,U+852f,U+8532-8534,U+8536,U+853e-8541,U+8543,U+8546,U+8548,U+854a-854b,U+854f-8553,U+8555-855a,U+855c-8564,U+8569-856b,U+856d,U+856f,U+8577,U+8579-857b,U+857d-8581,U+8585-8586,U+8588-858c,U+858f-8591,U+8593,U+8597-8598,U+859b-859d,U+859f-85a0,U+85a2,U+85a4-85a5,U+85a7-85a8,U+85ad-85b0,U+85b4,U+85b6-85ba,U+85bc-85bf,U+85c1-85c2,U+85c7,U+85c9-85cb,U+85ce-85d0,U+85d5,U+85d8-85da,U+85dc,U+85df-85e1,U+85e5-85e6,U+85e8,U+85ed,U+85f3-85f4,U+85f6-85f7,U+85f9-85fa,U+85fc,U+85fe-8600,U+8602,U+8604-8606,U+860a-860b,U+860d-860e,U+8610-8613,U+8616-861b,U+861e,U+8621-8622,U+8624,U+8627,U+8629,U+862f-8630,U+8636,U+8638-863a,U+863c-863d,U+863f-8642,U+8646,U+864d,U+8652-8654}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.20.woff2) format("woff2");unicode-range:U+82e8,U+82ea,U+82ed,U+82ef,U+82f3-82f4,U+82f6-82f7,U+82f9,U+82fb,U+82fd-82fe,U+8300-8301,U+8303,U+8306-8308,U+830a-830c,U+8316-8318,U+831b,U+831d-831f,U+8321-8323,U+832b-8335,U+8337,U+833a,U+833c-833d,U+8340,U+8342-8347,U+834a,U+834d-8351,U+8353-8357,U+835a,U+8362-8363,U+8370,U+8373,U+8375,U+8378,U+837c-837d,U+837f-8380,U+8382,U+8384-8387,U+838a,U+838d-838e,U+8392-8396,U+8398-83a0,U+83a2,U+83a6-83ad,U+83b1,U+83b5,U+83bd-83c1,U+83c7,U+83c9,U+83ce-83d1,U+83d4,U+83d6,U+83d8,U+83dd,U+83df-83e1,U+83e5,U+83e8,U+83ea-83eb,U+83f0,U+83f2,U+83f4,U+83f6-83f9,U+83fb-83fd,U+8401,U+8403-8404,U+8406-8407,U+840a-840b,U+840d,U+840f,U+8411,U+8413,U+8415,U+8417,U+8419,U+8420,U+8422,U+842a,U+842f,U+8431,U+8435,U+8438-8439,U+843c,U+8445-8448,U+844a,U+844d-844f,U+8451-8452,U+8456,U+8458-845a,U+845c,U+845f-8462,U+8464-8467,U+8469-846b,U+846d-8470,U+8473-8474,U+8476-847a,U+847c-847d,U+8481-8482,U+8484-8485,U+848b,U+8490,U+8492-8493,U+8495,U+8497,U+849c,U+849e-849f,U+84a1,U+84a6,U+84a8-84aa,U+84ad,U+84af,U+84b1}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.21.woff2) format("woff2");unicode-range:U+814a,U+814c,U+8151-8153,U+8157,U+815f-8161,U+8165-8169,U+816d-816f,U+8171,U+8173-8174,U+8177,U+8180-8186,U+8188,U+818a-818b,U+818e,U+8190,U+8193,U+8195-8196,U+8198,U+819b,U+819e,U+81a0,U+81a2,U+81a4,U+81a9,U+81ae,U+81b0,U+81b2,U+81b4-81b5,U+81b8,U+81ba-81bb,U+81bd-81be,U+81c0-81c3,U+81c5-81c6,U+81c8-81cb,U+81cd-81cf,U+81d1,U+81d5-81db,U+81dd-81e1,U+81e4-81e5,U+81e7,U+81eb-81ec,U+81ef-81f2,U+81f5-81f6,U+81f8-81fb,U+81fd-8205,U+8209-820b,U+820d,U+820f,U+8212-8214,U+8216,U+8219-821d,U+8221-8222,U+8228-8229,U+822b,U+822e,U+8232-8235,U+8237-8238,U+823a,U+823c,U+8240,U+8243-8246,U+8249,U+824b,U+824e-824f,U+8251,U+8256-825a,U+825c-825d,U+825f-8260,U+8262-8264,U+8267-8268,U+826a-826b,U+826d-826e,U+8271,U+8274,U+8277,U+8279,U+827b,U+827d-8281,U+8283-8284,U+8287,U+8289-828a,U+828d-828e,U+8291-8294,U+8296,U+8298-829b,U+829f-82a1,U+82a3-82a4,U+82a7-82ac,U+82ae,U+82b0,U+82b2,U+82b4,U+82b7,U+82ba-82bc,U+82be-82bf,U+82c5-82c6,U+82d0,U+82d2-82d3,U+82d5,U+82d9-82da,U+82dc,U+82de-82e4,U+82e7}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.22.woff2) format("woff2");unicode-range:U+7f77-7f79,U+7f7d-7f80,U+7f82-7f83,U+7f86-7f88,U+7f8b-7f8d,U+7f8f-7f91,U+7f94,U+7f96-7f97,U+7f9a,U+7f9c-7f9d,U+7fa1-7fa3,U+7fa6,U+7faa,U+7fad-7faf,U+7fb2,U+7fb4,U+7fb6,U+7fb8-7fb9,U+7fbc,U+7fbf-7fc0,U+7fc3,U+7fc5-7fc6,U+7fc8,U+7fca,U+7fce-7fcf,U+7fd5,U+7fdb,U+7fdf,U+7fe1,U+7fe3,U+7fe5-7fe6,U+7fe8-7fe9,U+7feb-7fec,U+7fee-7ff0,U+7ff2-7ff3,U+7ff9-7ffa,U+7ffd-7fff,U+8002,U+8004,U+8006-8008,U+800a-800f,U+8011-8014,U+8016,U+8018-8019,U+801c-8021,U+8024,U+8026,U+8028,U+802c,U+802e,U+8030,U+8034-8035,U+8037,U+8039-8040,U+8043-8044,U+8046,U+804a,U+8052,U+8058,U+805a,U+805f-8060,U+8062,U+8064,U+8066,U+8068,U+806d,U+806f-8073,U+8075-8076,U+8079,U+807b,U+807d-8081,U+8084-8088,U+808b,U+808e,U+8093,U+8099-809a,U+809c,U+809e,U+80a4,U+80a6-80a7,U+80ab-80ad,U+80b1,U+80b8-80b9,U+80c4-80c5,U+80c8,U+80ca,U+80cd,U+80cf,U+80d2,U+80d4-80db,U+80dd,U+80e0,U+80e4-80e6,U+80ed-80f3,U+80f5-80f7,U+80f9-80fc,U+80fe,U+8101,U+8103,U+8109,U+810b,U+810d,U+8116-8118,U+811b-811c,U+811e,U+8120,U+8123-8124,U+8127,U+8129,U+812b-812c,U+812f-8130,U+8135,U+8139-813a,U+813c-813e,U+8141,U+8145-8147}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.23.woff2) format("woff2");unicode-range:U+7d57,U+7d59-7d5d,U+7d63,U+7d65,U+7d67,U+7d6a,U+7d6e,U+7d70,U+7d72-7d73,U+7d78,U+7d7a-7d7b,U+7d7d,U+7d7f,U+7d81-7d83,U+7d85-7d86,U+7d88-7d89,U+7d8b-7d8d,U+7d8f,U+7d91,U+7d93,U+7d96-7d97,U+7d9b-7da0,U+7da2-7da3,U+7da6-7da7,U+7daa-7dac,U+7dae-7db0,U+7db3,U+7db5-7db9,U+7dbd,U+7dc0,U+7dc2-7dc7,U+7dcc-7dce,U+7dd0,U+7dd5-7dd9,U+7ddc-7dde,U+7de1-7de6,U+7dea-7ded,U+7df1-7df2,U+7df5-7df6,U+7df9-7dfa,U+7e00,U+7e05,U+7e08-7e0b,U+7e10-7e12,U+7e15,U+7e17,U+7e1c-7e1d,U+7e1f-7e23,U+7e27-7e28,U+7e2c-7e2d,U+7e2f,U+7e31-7e33,U+7e35-7e37,U+7e39-7e3b,U+7e3d,U+7e3f,U+7e43-7e48,U+7e4e,U+7e50,U+7e52,U+7e56,U+7e58-7e5a,U+7e5d-7e5f,U+7e61-7e62,U+7e65-7e67,U+7e69-7e6b,U+7e6d-7e6f,U+7e73,U+7e75,U+7e78-7e79,U+7e7b-7e7f,U+7e81-7e83,U+7e86-7e8a,U+7e8c-7e8e,U+7e90-7e96,U+7e98,U+7e9a-7e9f,U+7f38,U+7f3a-7f3f,U+7f43-7f45,U+7f47,U+7f4c-7f50,U+7f52-7f55,U+7f58,U+7f5b-7f5d,U+7f5f,U+7f61,U+7f63-7f69,U+7f6b,U+7f6d,U+7f71}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.24.woff2) format("woff2");unicode-range:U+7bc8,U+7bca-7bcc,U+7bcf,U+7bd4,U+7bd6-7bd7,U+7bd9-7bdb,U+7bdd,U+7be5-7be6,U+7be8-7bea,U+7bf0,U+7bf2-7bfa,U+7bfc,U+7bfe,U+7c00-7c04,U+7c06-7c07,U+7c09,U+7c0b-7c0f,U+7c11-7c14,U+7c17,U+7c19,U+7c1b,U+7c1e-7c20,U+7c23,U+7c25-7c28,U+7c2a-7c2c,U+7c2f,U+7c31,U+7c33-7c34,U+7c36-7c3a,U+7c3d-7c3e,U+7c40,U+7c42-7c43,U+7c45-7c46,U+7c4a,U+7c4c,U+7c4f-7c5f,U+7c61,U+7c63-7c65,U+7c67,U+7c69,U+7c6c-7c70,U+7c72,U+7c75,U+7c79,U+7c7b-7c7e,U+7c81-7c83,U+7c86-7c87,U+7c8d,U+7c8f-7c90,U+7c94,U+7c9e,U+7ca0-7ca2,U+7ca4-7ca6,U+7ca8,U+7cab,U+7cad-7cae,U+7cb0-7cb3,U+7cb6-7cb7,U+7cb9-7cbd,U+7cbf-7cc0,U+7cc2,U+7cc4-7cc5,U+7cc7-7cca,U+7ccd-7ccf,U+7cd2-7cd5,U+7cd7-7cda,U+7cdc-7cdd,U+7cdf-7ce0,U+7ce2,U+7ce6,U+7ce9,U+7ceb,U+7cef,U+7cf2,U+7cf4-7cf6,U+7cf9-7cfa,U+7cfe,U+7d02-7d03,U+7d06-7d0a,U+7d0f,U+7d11-7d13,U+7d15-7d16,U+7d1c-7d1e,U+7d23,U+7d26,U+7d2a,U+7d2c-7d2e,U+7d31-7d32,U+7d35,U+7d3c-7d41,U+7d43,U+7d45,U+7d47-7d48,U+7d4b,U+7d4d-7d4f,U+7d51,U+7d53,U+7d55-7d56}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.25.woff2) format("woff2");unicode-range:U+7a17-7a19,U+7a1b,U+7a1e-7a21,U+7a27,U+7a2b,U+7a2d,U+7a2f-7a31,U+7a34-7a35,U+7a37-7a3b,U+7a3e,U+7a43-7a49,U+7a4c,U+7a4e,U+7a50,U+7a55-7a57,U+7a59,U+7a5c-7a5d,U+7a5f-7a63,U+7a65,U+7a67,U+7a69-7a6a,U+7a6d,U+7a70,U+7a75,U+7a78-7a79,U+7a7d-7a7e,U+7a80,U+7a82,U+7a84-7a86,U+7a88,U+7a8a-7a8b,U+7a90-7a91,U+7a94-7a98,U+7a9e,U+7aa0,U+7aa3,U+7aa9,U+7aac,U+7ab0,U+7ab3,U+7ab5-7ab6,U+7ab9-7abf,U+7ac3,U+7ac5-7aca,U+7acc-7acf,U+7ad1-7ad3,U+7ad5,U+7ada-7adb,U+7add,U+7adf,U+7ae1-7ae2,U+7ae6-7aed,U+7af0-7af1,U+7af4,U+7af8,U+7afa-7afb,U+7afd-7afe,U+7b02,U+7b04,U+7b06-7b08,U+7b0a-7b0b,U+7b0f,U+7b12,U+7b14,U+7b18-7b19,U+7b1e-7b1f,U+7b23,U+7b25,U+7b27-7b2b,U+7b2d-7b31,U+7b33-7b36,U+7b3b,U+7b3d,U+7b3f-7b41,U+7b45,U+7b47,U+7b4c-7b50,U+7b53,U+7b55,U+7b5d,U+7b60,U+7b64-7b66,U+7b69-7b6a,U+7b6c-7b75,U+7b77,U+7b79-7b7a,U+7b7f,U+7b84,U+7b86,U+7b89,U+7b8d-7b92,U+7b96,U+7b98-7ba0,U+7ba5,U+7bac-7bad,U+7baf-7bb0,U+7bb2,U+7bb4-7bb6,U+7bba-7bbd,U+7bc1-7bc2,U+7bc5-7bc6}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.26.woff2) format("woff2");unicode-range:U+7851-7852,U+785c,U+785e,U+7860-7861,U+7863-7864,U+7868,U+786a,U+786e-786f,U+7872,U+7874,U+787a,U+787c,U+787e,U+7886-7887,U+788a,U+788c-788f,U+7893-7895,U+7898,U+789a,U+789d-789f,U+78a1,U+78a3-78a4,U+78a8-78aa,U+78ac-78ad,U+78af-78b3,U+78b5,U+78bb-78bf,U+78c5-78cc,U+78ce,U+78d1-78d6,U+78da-78db,U+78df-78e1,U+78e4,U+78e6-78e7,U+78ea,U+78ec,U+78f2-78f4,U+78f6-78f7,U+78f9-78fb,U+78fd-7901,U+7906-7907,U+790c,U+7910-7912,U+7919-791c,U+791e-7920,U+7925-792e,U+7930-7931,U+7934-7935,U+793b,U+793d,U+793f,U+7941-7942,U+7944-7946,U+794a-794b,U+794f,U+7951,U+7954-7955,U+7957-7958,U+795a-795c,U+795f-7960,U+7962,U+7967,U+7969,U+796b,U+7972,U+7977,U+7979-797c,U+797e-7980,U+798a-798e,U+7991,U+7993-7996,U+7998,U+799b-799d,U+79a1,U+79a6-79ab,U+79ae-79b1,U+79b3-79b4,U+79b8-79bb,U+79bd-79be,U+79c2,U+79c4,U+79c7-79ca,U+79cc-79cd,U+79cf,U+79d4-79d6,U+79da,U+79dd-79e3,U+79e5,U+79e7,U+79ea-79ed,U+79f1,U+79f8,U+79fc,U+7a02-7a03,U+7a05,U+7a07-7a0a,U+7a0c-7a0d,U+7a11,U+7a15}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.27.woff2) format("woff2");unicode-range:U+768c-768e,U+7690,U+7693,U+7695-7696,U+7699-76a8,U+76aa,U+76ad,U+76af-76b0,U+76b4,U+76b6-76ba,U+76bd,U+76c1-76c3,U+76c5,U+76c8-76c9,U+76cb-76ce,U+76d2,U+76d4,U+76d6,U+76d9,U+76dc,U+76de,U+76e0-76e1,U+76e5-76e8,U+76ea-76ec,U+76f0-76f1,U+76f6,U+76f9,U+76fb-76fc,U+7700,U+7704,U+7706-7708,U+770a,U+770e,U+7712,U+7714-7715,U+7717,U+7719-771c,U+7722,U+7724-7726,U+7728,U+772d-772f,U+7734-7739,U+773d-773e,U+7742,U+7745-7747,U+774a,U+774d-774f,U+7752,U+7756-7758,U+775a-775c,U+775e-7760,U+7762,U+7764-7765,U+7767,U+776a-776c,U+7770,U+7772-7774,U+7779-777a,U+777c-7780,U+7784,U+778b-778e,U+7794-7796,U+779a,U+779e-77a0,U+77a2,U+77a4-77a5,U+77a7,U+77a9-77aa,U+77ae-77b1,U+77b5-77b7,U+77b9,U+77bb-77bf,U+77c3,U+77c7,U+77c9,U+77cd,U+77d1-77d2,U+77d5,U+77d7,U+77d9-77da,U+77dc,U+77de-77e0,U+77e3-77e4,U+77e6-77e7,U+77e9-77ea,U+77ec,U+77ee,U+77f0-77f1,U+77f4,U+77f8,U+77fb-77fc,U+7805-7806,U+7809,U+780c-780e,U+7811-7812,U+7819,U+781d,U+7820-7823,U+7826-7827,U+782c-782e,U+7830,U+7835,U+7837,U+783a,U+783f,U+7843-7845,U+7847-7848,U+784c,U+784e-784f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.28.woff2) format("woff2");unicode-range:U+7511-7513,U+7515-7517,U+751c,U+751e,U+7520-7522,U+7524,U+7526-7527,U+7529-752c,U+752f,U+7536,U+7538-7539,U+753c-7540,U+7543-7544,U+7546-754b,U+754d-7550,U+7552,U+7557,U+755a-755b,U+755d-755f,U+7561-7562,U+7564,U+7566-7567,U+7569,U+756b-756d,U+756f,U+7571-7572,U+7574-757e,U+7581-7582,U+7585-7587,U+7589-758c,U+758f-7590,U+7592-7595,U+7599-759a,U+759c-759d,U+75a2-75a5,U+75b0-75b1,U+75b3-75b5,U+75b7-75b8,U+75ba,U+75bd,U+75bf-75c4,U+75c6,U+75ca,U+75cc-75cf,U+75d3-75d4,U+75d7-75d8,U+75dc-75e1,U+75e3-75e4,U+75e7,U+75ec,U+75ee-75f3,U+75f9,U+75fc,U+75fe-7604,U+7607-760c,U+760f,U+7612-7613,U+7615-7616,U+7618-7619,U+761b-7629,U+762d,U+7630,U+7632-7635,U+7638-763c,U+7640-7641,U+7643-764b,U+764e,U+7655,U+7658-7659,U+765c,U+765f,U+7661-7662,U+7664-7665,U+7667-766a,U+766c-7672,U+7674,U+7676,U+7678,U+7680-7683,U+7685,U+7688,U+768b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.29.woff2) format("woff2");unicode-range:U+736c,U+736e-7371,U+7375,U+7377-737c,U+7380-7381,U+7383,U+7385-7386,U+738a,U+738e,U+7390,U+7393-7398,U+739c,U+739e-73a0,U+73a2,U+73a5-73a6,U+73a8,U+73aa-73ab,U+73ad,U+73b3,U+73b5,U+73b7,U+73b9-73bd,U+73bf,U+73c5-73c6,U+73c9-73cc,U+73ce-73cf,U+73d2-73d3,U+73d6,U+73d9,U+73dd-73de,U+73e1,U+73e3-73e7,U+73e9-73ea,U+73ee,U+73f1,U+73f4-73f5,U+73f7-73fb,U+73fd,U+73ff-7401,U+7404-7405,U+7407,U+740a,U+7411,U+7413,U+741a-741b,U+7421,U+7424,U+7426,U+7428-7431,U+7433,U+7439-743a,U+743f-7441,U+7443-7444,U+7446-7447,U+744b,U+744d,U+7451-7453,U+7455,U+7457,U+7459-745a,U+745c-745d,U+745f,U+7462-7464,U+7466-746b,U+746d-7473,U+7476,U+747e,U+7480-7481,U+7485-7489,U+748b,U+748f-7492,U+7497-749a,U+749c,U+749e-74a3,U+74a5-74a6,U+74a8-74ab,U+74ae-74af,U+74b1-74b2,U+74b5,U+74b9-74bb,U+74bd,U+74bf,U+74c8-74ca,U+74cc,U+74cf-74d0,U+74d3-74d4,U+74d6,U+74d8,U+74da-74db,U+74de-74e0,U+74e3-74e4,U+74e7-74eb,U+74ee-74f2,U+74f4,U+74f7-74f8,U+74fa-74fc,U+74ff,U+7501,U+7503-7506,U+750c-750e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.30.woff2) format("woff2");unicode-range:U+7166,U+7168,U+716c,U+7179,U+7180,U+7184-7185,U+7187-7188,U+718c,U+718f,U+7192,U+7194-7196,U+7199-719b,U+71a0,U+71a2,U+71a8,U+71ac,U+71ae-71b0,U+71b2-71b3,U+71b9-71ba,U+71be-71c1,U+71c4,U+71c9,U+71cb-71cc,U+71ce,U+71d0,U+71d2-71d4,U+71d6-71d7,U+71d9-71da,U+71dc,U+71df-71e0,U+71e6-71e7,U+71ec-71ee,U+71f4-71f5,U+71f8-71f9,U+71fc,U+71fe-7200,U+7207-7209,U+720d,U+7210,U+7213,U+7215,U+7217,U+721a,U+721d,U+721f,U+7224,U+7228,U+722b,U+722d,U+722f-7230,U+7232,U+7234,U+7238-7239,U+723b-723c,U+723e-7243,U+7245-7246,U+724b,U+724e-7250,U+7252-7253,U+7255-7258,U+725a,U+725c,U+725e,U+7260,U+7263,U+7268,U+726b,U+726e-726f,U+7271,U+7274,U+7277-7278,U+727b-727c,U+727e-7282,U+7284,U+7287,U+7289,U+728d-728e,U+7292-7293,U+7296,U+729b,U+72a2,U+72a7-72a8,U+72ad-72ae,U+72b0-72b2,U+72b4,U+72b9,U+72be,U+72c0-72c1,U+72c3-72c4,U+72c6-72c7,U+72c9,U+72cc,U+72ce,U+72d2,U+72d5-72d6,U+72d8,U+72df-72e2,U+72e5,U+72f3-72f4,U+72f7,U+72f9-72fb,U+72fd-72fe,U+7302,U+7304-7305,U+7307,U+730a-730b,U+730d,U+7312-7313,U+7316-7319,U+731c-731e,U+7322,U+7324,U+7327-7329,U+732c,U+732f,U+7331-7337,U+7339-733b,U+733d-733e,U+7343,U+734d-7350,U+7352,U+7356-7358,U+735d-7360,U+7366-736b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.31.woff2) format("woff2");unicode-range:U+6f58-6f5b,U+6f5d-6f5e,U+6f60-6f62,U+6f66,U+6f68,U+6f6c-6f6d,U+6f6f,U+6f74,U+6f78,U+6f7a,U+6f7c-6f7e,U+6f80,U+6f82-6f83,U+6f86-6f88,U+6f8b-6f8e,U+6f90-6f94,U+6f96-6f98,U+6f9a,U+6f9d,U+6f9f-6fa1,U+6fa3,U+6fa5-6fa8,U+6fae-6fb1,U+6fb3,U+6fb5-6fb7,U+6fb9,U+6fbc,U+6fbe,U+6fc2,U+6fc5-6fca,U+6fd4-6fd5,U+6fd8,U+6fda-6fdb,U+6fde-6fe0,U+6fe4,U+6fe8-6fe9,U+6feb-6fec,U+6fee,U+6ff0,U+6ff3,U+6ff5-6ff6,U+6ff9-6ffa,U+6ffc-6ffe,U+7000-7001,U+7005-7007,U+7009-700b,U+700d,U+700f,U+7011,U+7015,U+7017-7018,U+701a-701b,U+701d-7020,U+7023,U+7026,U+7028,U+702f-7030,U+7032,U+7034,U+7037,U+7039-703a,U+703c,U+703e,U+7043-7044,U+7047-704c,U+704e,U+7051,U+7054-7055,U+705d-705e,U+7064-7065,U+7069,U+706c,U+706e,U+7075-7076,U+707e,U+7081,U+7085-7086,U+7094-7098,U+709b,U+709f,U+70a4,U+70ab-70ac,U+70ae-70b1,U+70b3-70b4,U+70b7,U+70bb,U+70ca-70cb,U+70d1,U+70d3-70d6,U+70d8-70d9,U+70dc-70dd,U+70df,U+70e4,U+70ec,U+70f1,U+70fa,U+70fd,U+7103-7108,U+710b-710c,U+710f,U+7114,U+7119,U+711c,U+711e,U+7120,U+712b,U+712d-7131,U+7138,U+7141,U+7145-7147,U+7149-714b,U+7150-7153,U+7155-7157,U+715a,U+715c,U+715e,U+7160,U+7162,U+7164-7165}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.32.woff2) format("woff2");unicode-range:U+6d7c,U+6d80-6d82,U+6d85,U+6d87,U+6d89-6d8a,U+6d8c-6d8e,U+6d91-6d98,U+6d9c,U+6daa-6dac,U+6dae,U+6db4-6db5,U+6db7-6db9,U+6dbd,U+6dbf,U+6dc2,U+6dc4-6dc8,U+6dca,U+6dcc,U+6dce-6dd0,U+6dd2,U+6dd5-6dd6,U+6dd8-6ddb,U+6ddd-6de0,U+6de2,U+6de4-6de6,U+6de8-6dea,U+6dec,U+6dee-6df0,U+6df2,U+6df4,U+6df6,U+6df8-6dfa,U+6dfc,U+6e00,U+6e04,U+6e0a,U+6e17,U+6e19,U+6e1d-6e20,U+6e22-6e25,U+6e27,U+6e2b,U+6e2d-6e2e,U+6e32,U+6e34,U+6e36,U+6e38-6e3c,U+6e42-6e45,U+6e48-6e49,U+6e4b-6e4f,U+6e51-6e54,U+6e57,U+6e5b-6e5f,U+6e62-6e63,U+6e68,U+6e6b,U+6e6e,U+6e72-6e73,U+6e76,U+6e7b,U+6e7d,U+6e82,U+6e89,U+6e8c-6e8d,U+6e8f,U+6e93,U+6e98-6e99,U+6e9f-6ea0,U+6ea5,U+6ea7,U+6eaa-6eab,U+6ead-6eaf,U+6eb1-6eb4,U+6eb7,U+6ebb-6ebd,U+6ebf-6ec4,U+6ec7-6eca,U+6ecc-6ecf,U+6ed3-6ed5,U+6ed9-6edb,U+6ee6,U+6eeb-6eef,U+6ef7-6ef9,U+6efb,U+6efd-6eff,U+6f04,U+6f08-6f0a,U+6f0c-6f0d,U+6f10-6f11,U+6f13,U+6f15-6f16,U+6f18,U+6f1a-6f1b,U+6f25-6f26,U+6f29-6f2a,U+6f2d,U+6f2f-6f33,U+6f35-6f36,U+6f38,U+6f3b-6f3c,U+6f3e-6f3f,U+6f41,U+6f45,U+6f4f,U+6f51-6f53,U+6f57}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.33.woff2) format("woff2");unicode-range:U+6b85,U+6b89,U+6b8d,U+6b95,U+6b97-6b98,U+6b9b,U+6b9e-6ba0,U+6ba2-6ba4,U+6ba8-6bb3,U+6bb7-6bb9,U+6bbc-6bbe,U+6bc0,U+6bc3-6bc4,U+6bc6-6bc9,U+6bcb-6bcc,U+6bcf,U+6bd3,U+6bd6-6bd8,U+6bda,U+6bdf,U+6be1,U+6be3,U+6be6-6be7,U+6beb-6bec,U+6bee,U+6bf1,U+6bf3,U+6bf7,U+6bf9,U+6bff,U+6c02,U+6c04-6c05,U+6c08-6c0a,U+6c0d-6c0e,U+6c10,U+6c12-6c14,U+6c19,U+6c1b,U+6c1f,U+6c24,U+6c26-6c28,U+6c2c,U+6c2e,U+6c33,U+6c35-6c36,U+6c3a-6c3b,U+6c3e-6c40,U+6c4a-6c4b,U+6c4d,U+6c4f,U+6c52,U+6c54-6c55,U+6c59,U+6c5b-6c5e,U+6c62,U+6c67-6c68,U+6c6a-6c6b,U+6c6d,U+6c6f,U+6c73-6c74,U+6c76,U+6c78-6c79,U+6c7b,U+6c7e,U+6c81-6c87,U+6c89,U+6c8c-6c8d,U+6c90,U+6c92-6c95,U+6c97-6c98,U+6c9a-6c9c,U+6c9f,U+6caa-6cae,U+6cb0-6cb2,U+6cb4,U+6cba,U+6cbd-6cbe,U+6cc2,U+6cc5-6cc6,U+6ccd,U+6ccf-6cd4,U+6cd6-6cd7,U+6cd9-6cdd,U+6ce0,U+6ce7,U+6ce9-6cef,U+6cf1-6cf2,U+6cf4,U+6cfb,U+6d00-6d01,U+6d04,U+6d07,U+6d0a,U+6d0c,U+6d0e-6d0f,U+6d11,U+6d13,U+6d19-6d1a,U+6d1f,U+6d24,U+6d26-6d28,U+6d2b,U+6d2e-6d2f,U+6d31,U+6d33-6d36,U+6d38-6d39,U+6d3c-6d3d,U+6d3f,U+6d57-6d5b,U+6d5e-6d61,U+6d64-6d65,U+6d67,U+6d6c,U+6d6f-6d70,U+6d79}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.34.woff2) format("woff2");unicode-range:U+69dd-69de,U+69e2-69e3,U+69e5,U+69e7-69eb,U+69ed-69ef,U+69f1-69f6,U+69f9,U+69fe-6a01,U+6a03,U+6a05,U+6a0a,U+6a0c,U+6a0f,U+6a11-6a15,U+6a17,U+6a1a-6a1b,U+6a1d-6a20,U+6a22-6a24,U+6a28,U+6a2e,U+6a30,U+6a32-6a38,U+6a3b,U+6a3e-6a3f,U+6a44-6a4a,U+6a4e,U+6a50-6a52,U+6a54-6a56,U+6a5b,U+6a61-6a62,U+6a64,U+6a66-6a67,U+6a6a-6a6b,U+6a71-6a73,U+6a78,U+6a7a,U+6a7e-6a7f,U+6a81,U+6a83-6a84,U+6a86-6a87,U+6a89,U+6a8b,U+6a8d,U+6a90-6a91,U+6a94,U+6a97,U+6a9b,U+6a9d-6aa3,U+6aa5,U+6aaa-6aac,U+6aae-6ab1,U+6ab3-6ab4,U+6ab8,U+6abb,U+6abd-6abf,U+6ac1-6ac3,U+6ac6,U+6ac8-6ac9,U+6acc,U+6ad0-6ad1,U+6ad3-6ad6,U+6ada-6adf,U+6ae2,U+6ae4,U+6ae7-6ae8,U+6aea,U+6aec,U+6af0-6af3,U+6af8,U+6afa,U+6afc-6afd,U+6b02-6b03,U+6b06-6b07,U+6b09-6b0b,U+6b0f-6b12,U+6b16-6b17,U+6b1b,U+6b1d-6b1f,U+6b23-6b24,U+6b28,U+6b2b-6b2c,U+6b2f,U+6b35-6b39,U+6b3b,U+6b3d,U+6b3f,U+6b43,U+6b46-6b47,U+6b49-6b4a,U+6b4d-6b4e,U+6b50,U+6b52,U+6b54,U+6b56,U+6b58-6b59,U+6b5b,U+6b5d,U+6b5f-6b61,U+6b65,U+6b67,U+6b6b-6b6c,U+6b6e,U+6b70,U+6b72,U+6b75,U+6b77-6b7a,U+6b7d-6b84}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.35.woff2) format("woff2");unicode-range:U+6855,U+6857-6859,U+685b,U+685d,U+685f,U+6863,U+6867,U+686b,U+686e-6872,U+6874-6875,U+6877,U+6879-687c,U+687e-687f,U+6882-6884,U+6886,U+6888,U+688d-6890,U+6894,U+6896,U+6898-689c,U+689f-68a3,U+68a5-68a7,U+68a9-68ab,U+68ad-68af,U+68b2-68b5,U+68b9-68bc,U+68c3,U+68c5-68c6,U+68c8-68ca,U+68cc-68cd,U+68cf-68d1,U+68d3-68d9,U+68dc-68dd,U+68e0-68e1,U+68e3-68e5,U+68e7-68e8,U+68ea-68ed,U+68ef-68f1,U+68f5-68f7,U+68f9,U+68fb-68fd,U+6900-6901,U+6903-6904,U+6906-690c,U+690f-6911,U+6913,U+6916-6917,U+6919-691b,U+6921-6923,U+6925-6926,U+6928,U+692a,U+6930-6931,U+6933-6936,U+6938-6939,U+693b,U+693d,U+6942,U+6945-6946,U+6949,U+694e,U+6954,U+6957,U+6959,U+695b-695e,U+6961-6966,U+6968-696c,U+696e-6974,U+6977-697b,U+697e-6981,U+6986,U+698d,U+6991-6992,U+6994-6996,U+6998,U+699c,U+69a0-69a1,U+69a5-69a8,U+69ab,U+69ad,U+69af-69b2,U+69b4,U+69b7-69b8,U+69ba-69bc,U+69be-69c1,U+69c3,U+69c5,U+69c7-69c8,U+69ca,U+69ce-69d1,U+69d3,U+69d6-69d7,U+69d9}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.36.woff2) format("woff2");unicode-range:U+667e-6680,U+6683-6684,U+6688,U+668b-668e,U+6690,U+6692,U+6698-669d,U+669f-66a0,U+66a2,U+66a4,U+66ad,U+66b1-66b3,U+66b5,U+66b8-66b9,U+66bb-66bc,U+66be-66c4,U+66c6,U+66c8-66c9,U+66cc,U+66ce-66cf,U+66d4,U+66da-66db,U+66dd,U+66df-66e0,U+66e6,U+66e8-66e9,U+66eb-66ec,U+66ee,U+66f5,U+66f7,U+66fa-66fc,U+6701,U+6705,U+6707,U+670c,U+670e-6710,U+6712-6716,U+6719,U+671c,U+671e,U+6720,U+6722,U+6725-6726,U+672e,U+6733,U+6735-6738,U+673e-673f,U+6741,U+6743,U+6745-6748,U+674c-674d,U+6753-6755,U+6759,U+675d-675e,U+6760,U+6762-6764,U+6766,U+676a,U+676c,U+676e,U+6770,U+6772-6774,U+6776-6777,U+677b-677c,U+6780-6781,U+6784-6785,U+6787,U+6789,U+678b-678c,U+678e-678f,U+6791-6793,U+6796,U+6798-6799,U+679b,U+67a1,U+67a4,U+67a6,U+67a9,U+67b0-67b5,U+67b7-67b9,U+67bb-67be,U+67c0-67c3,U+67c5-67c6,U+67c8-67c9,U+67ce,U+67d2,U+67d7-67d9,U+67db-67de,U+67e1-67e2,U+67e4,U+67e6-67e7,U+67e9,U+67ec,U+67ee-67f0,U+67f2,U+67f6-67f7,U+67f9-67fa,U+67fc,U+67fe,U+6801-6802,U+6805,U+6810,U+6814,U+6818-6819,U+681d,U+681f,U+6822,U+6827-6829,U+682b-682d,U+682f-6834,U+683b,U+683e-6840,U+6844-6846,U+6849-684a,U+684c-684e,U+6852-6854}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.37.woff2) format("woff2");unicode-range:U+64d2,U+64d4-64d5,U+64d7-64d8,U+64da,U+64e0-64e1,U+64e3-64e5,U+64e7,U+64e9-64ea,U+64ed,U+64ef-64f2,U+64f4-64f7,U+64fa-64fb,U+64fd-6501,U+6504-6505,U+6508-650a,U+650f,U+6513-6514,U+6516,U+6518-6519,U+651b-651f,U+6522,U+6524,U+6526,U+6529-652c,U+652e,U+6531-6532,U+6534-6538,U+653a,U+653c-653d,U+6543-6544,U+6547-6549,U+654d-654e,U+6550,U+6552,U+6554-6556,U+6558,U+655d-6560,U+6567,U+656b,U+6572,U+6578,U+657a,U+657d,U+6581-6585,U+6588,U+658a,U+658c,U+6592,U+6595,U+6598,U+659b,U+659d,U+659f-65a1,U+65a3-65a6,U+65ab,U+65ae,U+65b2-65b5,U+65b7-65b8,U+65be-65bf,U+65c1-65c4,U+65c6,U+65c8-65c9,U+65cc,U+65ce,U+65d0,U+65d2,U+65d4,U+65d6,U+65d8-65d9,U+65db,U+65df-65e1,U+65e3,U+65f0-65f2,U+65f4-65f5,U+65f9,U+65fb-65fc,U+65fe-6600,U+6603-6604,U+6608-660a,U+660d,U+6611-6612,U+6615-6616,U+661c-661e,U+6621-6624,U+6626,U+6629-662c,U+662e,U+6630-6631,U+6633-6637,U+6639-663b,U+663f-6641,U+6644-6646,U+6648-664a,U+664c,U+664e-664f,U+6651,U+6657-6665,U+6667-6668,U+666a-666d,U+6670,U+6673,U+6675,U+6677-6679,U+667b-667c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.38.woff2) format("woff2");unicode-range:U+62cf,U+62d1,U+62d4-62d6,U+62da,U+62dc,U+62ea,U+62ee-62ef,U+62f1-62f2,U+62f4-62f5,U+62fc-62fd,U+62ff,U+6302-6304,U+6308-630d,U+6310,U+6313,U+6316,U+6318,U+631b,U+6327,U+6329-632a,U+632d,U+6332,U+6335-6336,U+6339-633c,U+633e,U+6341-6344,U+6346,U+634a-634e,U+6350,U+6352-6354,U+6358-6359,U+635b,U+6365-6366,U+6369,U+636b-636d,U+6371-6372,U+6374-6378,U+637a,U+637c-637d,U+637f-6380,U+6382,U+6384,U+6387,U+6389-638a,U+638e-6390,U+6394-6396,U+6399-639a,U+639e,U+63a0,U+63a3-63a4,U+63a6,U+63a9,U+63ab-63af,U+63b5,U+63bd-63be,U+63c0-63c1,U+63c4-63c6,U+63c8,U+63ce,U+63d1-63d6,U+63dc,U+63e0,U+63e3,U+63e5,U+63e9-63ed,U+63f2-63f3,U+63f5-63f9,U+6406,U+6409-640a,U+640f-6410,U+6412-6414,U+6416-6418,U+641e,U+6420,U+6422,U+6424-6426,U+6428-642a,U+642f-6430,U+6434-6436,U+643d,U+643f,U+644b,U+644e-644f,U+6451-6454,U+645a-645d,U+645f-6461,U+6463,U+6467,U+646d,U+6473-6474,U+6476,U+6478-6479,U+647b,U+647d,U+6485,U+6487-6488,U+648f-6491,U+6493,U+6495,U+6498-649b,U+649d-649f,U+64a1,U+64a3,U+64a6,U+64a8-64a9,U+64ac,U+64b3,U+64bb-64bf,U+64c2,U+64c4-64c5,U+64c7,U+64c9-64cc,U+64ce,U+64d0-64d1}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.39.woff2) format("woff2");unicode-range:U+6117,U+6119,U+611c,U+611e,U+6120-6122,U+6127-6128,U+612a-612c,U+6130-6131,U+6134-6137,U+6139-613a,U+613c-613f,U+6141-6142,U+6144-6147,U+6149-614a,U+614d,U+6153,U+6158-615a,U+615d-6160,U+6164-6165,U+616b-616c,U+616f,U+6171-6175,U+6177-6178,U+617b-6181,U+6183-6184,U+6187,U+618a-618b,U+618d,U+6192-6194,U+6196-619a,U+619c-619d,U+619f-61a0,U+61a5,U+61a8,U+61aa-61ae,U+61b8-61ba,U+61bc,U+61be,U+61c0-61c3,U+61c6,U+61c8,U+61ca-61cf,U+61d5,U+61dc-61df,U+61e1-61e3,U+61e5-61e9,U+61ec-61ed,U+61ef,U+61f4-61f7,U+61fa,U+61fc-6201,U+6203-6204,U+6207-620a,U+620d-620e,U+6213-6215,U+621b-621e,U+6220-6223,U+6227,U+6229-622b,U+622e,U+6230-6233,U+6236,U+6239,U+623d-623e,U+6241-6244,U+6246,U+6248,U+624c,U+624e,U+6250-6252,U+6254,U+6256,U+6258,U+625a-625c,U+625e,U+6260-6261,U+6263-6264,U+6268,U+626d,U+626f,U+6273,U+627a-627e,U+6282-6283,U+6285,U+6289,U+628d-6290,U+6292-6294,U+6296,U+6299,U+629b,U+62a6,U+62a8,U+62ac,U+62b3,U+62b6-62b7,U+62ba-62bb,U+62be-62bf,U+62c2,U+62c4,U+62c6-62c8,U+62ca,U+62ce}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.40.woff2) format("woff2");unicode-range:U+5f6c-5f6d,U+5f6f,U+5f72-5f75,U+5f78,U+5f7a,U+5f7d-5f7f,U+5f82-5f83,U+5f87-5f89,U+5f8d,U+5f8f,U+5f91,U+5f96,U+5f99,U+5f9c-5f9d,U+5fa0,U+5fa2,U+5fa4,U+5fa7-5fa8,U+5fab-5fad,U+5faf-5fb1,U+5fb5,U+5fb7-5fb8,U+5fbc-5fbd,U+5fc4,U+5fc7-5fc9,U+5fcb,U+5fd0-5fd4,U+5fdd-5fde,U+5fe1-5fe2,U+5fe4,U+5fe8-5fea,U+5fec-5ff3,U+5ff6,U+5ff8,U+5ffa-5ffd,U+5fff,U+6007,U+600a,U+600d-6010,U+6013-6015,U+6017-601b,U+601f,U+6021-6022,U+6024,U+6026,U+6029,U+602b,U+602d,U+6031,U+6033,U+6035,U+603a,U+6040-6043,U+6046-604a,U+604c-604d,U+6051,U+6054-6057,U+6059-605a,U+605d,U+605f-6064,U+6067,U+606a-606c,U+6070-6071,U+6077,U+607e-607f,U+6081-6086,U+6088-608e,U+6091-6093,U+6095-6098,U+609a-609b,U+609d-609e,U+60a2,U+60a4-60a5,U+60a7-60a8,U+60b0-60b1,U+60b3-60b5,U+60b7-60b8,U+60bb,U+60bd-60be,U+60c2,U+60c4,U+60c6-60cb,U+60ce-60cf,U+60d3-60d5,U+60d8-60d9,U+60db,U+60dd-60df,U+60e1-60e2,U+60e5,U+60ee,U+60f0-60f2,U+60f4-60f8,U+60fa-60fd,U+6100,U+6102-6103,U+6106-6108,U+610a,U+610c-610e,U+6110-6114,U+6116}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.41.woff2) format("woff2");unicode-range:U+5d9b,U+5d9d,U+5d9f-5da0,U+5da2,U+5da4,U+5da7,U+5dab-5dac,U+5dae,U+5db0,U+5db2,U+5db4,U+5db7-5db9,U+5dbc-5dbd,U+5dc3,U+5dc7,U+5dc9,U+5dcb-5dce,U+5dd0-5dd3,U+5dd6-5dd9,U+5ddb,U+5de0,U+5de2,U+5de4,U+5de9,U+5df2,U+5df5,U+5df8-5df9,U+5dfd,U+5dff-5e00,U+5e07,U+5e0b,U+5e0d,U+5e11-5e12,U+5e14-5e15,U+5e18-5e1b,U+5e1f-5e20,U+5e25,U+5e28,U+5e2e,U+5e32,U+5e35-5e37,U+5e3e,U+5e40,U+5e43-5e44,U+5e47,U+5e49,U+5e4b,U+5e4e,U+5e50-5e51,U+5e54,U+5e56-5e58,U+5e5b-5e5c,U+5e5e-5e5f,U+5e62,U+5e64,U+5e68,U+5e6a-5e6e,U+5e70,U+5e75-5e77,U+5e7a,U+5e7f-5e80,U+5e87,U+5e8b,U+5e8e,U+5e96,U+5e99-5e9a,U+5ea0,U+5ea2,U+5ea4-5ea5,U+5ea8,U+5eaa,U+5eac,U+5eb1,U+5eb3,U+5eb8-5eb9,U+5ebd-5ebf,U+5ec1-5ec2,U+5ec6,U+5ec8,U+5ecb-5ecc,U+5ece-5ed6,U+5ed9-5ee2,U+5ee5,U+5ee8-5ee9,U+5eeb-5eec,U+5ef0-5ef1,U+5ef3-5ef4,U+5ef8-5ef9,U+5efc-5f00,U+5f02-5f03,U+5f06-5f09,U+5f0b-5f0e,U+5f11,U+5f16-5f17,U+5f19,U+5f1b-5f1e,U+5f21-5f24,U+5f27-5f29,U+5f2b-5f30,U+5f34,U+5f36,U+5f38,U+5f3a-5f3d,U+5f3f-5f41,U+5f44-5f45,U+5f47-5f48,U+5f4a,U+5f4c-5f4e,U+5f50-5f51,U+5f54,U+5f56-5f58,U+5f5b-5f5d,U+5f60,U+5f63-5f65,U+5f67,U+5f6a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.42.woff2) format("woff2");unicode-range:U+5bbc,U+5bc0-5bc1,U+5bc3,U+5bc7,U+5bc9,U+5bcd-5bd0,U+5bd3-5bd4,U+5bd6-5bda,U+5bde,U+5be0-5be2,U+5be4-5be6,U+5be8,U+5beb-5bec,U+5bef-5bf1,U+5bf3-5bf6,U+5bfd,U+5c03,U+5c05,U+5c07-5c09,U+5c0c-5c0d,U+5c12-5c14,U+5c17,U+5c19,U+5c1e-5c20,U+5c22-5c24,U+5c26,U+5c28-5c2e,U+5c30,U+5c32,U+5c35-5c36,U+5c38-5c39,U+5c46,U+5c4d-5c50,U+5c53,U+5c59-5c5c,U+5c5f-5c63,U+5c67-5c69,U+5c6c-5c70,U+5c74-5c76,U+5c79-5c7d,U+5c87-5c88,U+5c8a,U+5c8c,U+5c8f,U+5c91-5c92,U+5c94,U+5c9d,U+5c9f-5ca0,U+5ca2-5ca3,U+5ca6-5ca8,U+5caa-5cab,U+5cad,U+5cb1-5cb2,U+5cb4-5cb7,U+5cba-5cbc,U+5cbe,U+5cc5,U+5cc7,U+5cc9,U+5ccb,U+5cd0,U+5cd2,U+5cd7,U+5cd9,U+5cdd,U+5ce6,U+5ce8-5cea,U+5ced-5cee,U+5cf1-5cf2,U+5cf4-5cf5,U+5cfa-5cfb,U+5cfd,U+5d01,U+5d06,U+5d0b,U+5d0d,U+5d10-5d12,U+5d14-5d15,U+5d17-5d1b,U+5d1d,U+5d1f-5d20,U+5d22-5d24,U+5d26-5d27,U+5d2b,U+5d31,U+5d34,U+5d39,U+5d3d,U+5d3f,U+5d42-5d43,U+5d46-5d48,U+5d4a-5d4b,U+5d4e,U+5d51-5d53,U+5d55,U+5d59,U+5d5c,U+5d5f-5d62,U+5d64,U+5d69-5d6a,U+5d6c-5d6d,U+5d6f-5d70,U+5d73,U+5d76,U+5d79-5d7a,U+5d7e-5d7f,U+5d81-5d84,U+5d87-5d88,U+5d8a,U+5d8c,U+5d90,U+5d92-5d95,U+5d97,U+5d99}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.43.woff2) format("woff2");unicode-range:U+598b-598e,U+5992,U+5995,U+5997,U+599b,U+599d,U+599f,U+59a3-59a4,U+59a7,U+59ad-59b0,U+59b2-59b3,U+59b7,U+59ba,U+59bc,U+59be,U+59c1,U+59c3-59c4,U+59c6,U+59c8,U+59ca,U+59cd,U+59d2,U+59d9-59da,U+59dd-59df,U+59e3-59e5,U+59e7-59e8,U+59ec,U+59ee-59ef,U+59f1-59f2,U+59f4,U+59f6-59f8,U+5a00,U+5a03-5a04,U+5a09,U+5a0c-5a0e,U+5a11-5a13,U+5a17,U+5a1a-5a1c,U+5a1e-5a1f,U+5a23-5a25,U+5a27-5a28,U+5a2a,U+5a2d,U+5a30,U+5a35-5a36,U+5a40-5a41,U+5a44-5a45,U+5a47-5a49,U+5a4c,U+5a50,U+5a55,U+5a5e,U+5a62-5a63,U+5a65,U+5a67,U+5a6a,U+5a6c-5a6d,U+5a77,U+5a7a-5a7b,U+5a7e,U+5a84,U+5a8b,U+5a90,U+5a93,U+5a96,U+5a99,U+5a9c,U+5a9e-5aa0,U+5aa2,U+5aa7,U+5aac,U+5ab1-5ab3,U+5ab5,U+5ab8,U+5aba-5abf,U+5ac2,U+5ac4,U+5ac6,U+5ac8,U+5acb,U+5acf-5ad0,U+5ad6-5ad7,U+5ada,U+5adc,U+5ae0-5ae1,U+5ae3,U+5ae5-5ae6,U+5ae9-5aea,U+5aee,U+5af0,U+5af5-5af6,U+5afa-5afb,U+5afd,U+5b00-5b01,U+5b08,U+5b0b,U+5b16-5b17,U+5b19,U+5b1b,U+5b1d,U+5b21,U+5b25,U+5b2a,U+5b2c-5b2d,U+5b30,U+5b32,U+5b34,U+5b36,U+5b38,U+5b3e,U+5b40-5b41,U+5b43,U+5b45,U+5b4b-5b4c,U+5b51-5b52,U+5b56,U+5b5a-5b5c,U+5b5e-5b5f,U+5b65,U+5b68-5b69,U+5b6e-5b71,U+5b73,U+5b75-5b76,U+5b7a,U+5b7c-5b84,U+5b86,U+5b8a-5b8b,U+5b8d-5b8e,U+5b90-5b91,U+5b93-5b94,U+5b96,U+5ba5-5ba6,U+5ba8-5ba9,U+5bac-5bad,U+5baf,U+5bb1-5bb2,U+5bb7-5bb8,U+5bba}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.44.woff2) format("woff2");unicode-range:U+57b3,U+57b8,U+57bd,U+57c0,U+57c3,U+57c6-57c8,U+57cc,U+57cf,U+57d2-57d7,U+57dc-57de,U+57e0-57e1,U+57e3-57e4,U+57e6-57e7,U+57e9,U+57ed,U+57f0,U+57f4-57f6,U+57f8,U+57fb,U+57fd-57ff,U+5803-5804,U+5808-580d,U+5819,U+581b,U+581d-5821,U+5826-5827,U+582d,U+582f-5830,U+5832,U+5835,U+5839,U+583d,U+583f-5840,U+5849,U+584b-584d,U+584f-5852,U+5855,U+5858-5859,U+585f,U+5861-5862,U+5864,U+5867-5868,U+586d,U+5870,U+5872,U+5878-5879,U+587c,U+587f-5881,U+5885,U+5887-588d,U+588f-5890,U+5894,U+5896,U+5898,U+589d-589e,U+58a0-58a2,U+58a6,U+58a9-58ab,U+58ae,U+58b1-58b3,U+58b8-58bc,U+58be,U+58c2-58c5,U+58c8,U+58cd-58ce,U+58d0-58da,U+58dc-58e2,U+58e4-58e5,U+58e9,U+58ec,U+58ef,U+58f3-58f4,U+58f7,U+58f9,U+58fb-58fd,U+5902,U+5905-5906,U+590a-590d,U+5910,U+5912-5914,U+5918-5919,U+591b,U+591d,U+591f,U+5921,U+5923-5925,U+5928,U+592c-592d,U+592f-5930,U+5932-5933,U+5935-5936,U+5938-5939,U+593d-593f,U+5943,U+5946,U+594e,U+5950,U+5952-5953,U+5955,U+5957-595b,U+595d-5961,U+5963,U+5967,U+5969,U+596b-596d,U+596f,U+5972,U+5975-5976,U+5978-5979,U+597b-597c,U+5981}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.45.woff2) format("woff2");unicode-range:U+5616-5617,U+5619,U+561b,U+5620,U+5628,U+562c,U+562f-5639,U+563b-563d,U+563f-5641,U+5643-5644,U+5646-5647,U+5649,U+564b,U+564d-5650,U+5653-5654,U+565e,U+5660-5664,U+5666,U+5669-566d,U+566f,U+5671-5672,U+5675-5676,U+5678,U+567a,U+5680,U+5684-5688,U+568a-568c,U+568f,U+5694-5695,U+5699-569a,U+569d-56a0,U+56a5-56a9,U+56ab-56ae,U+56b1-56b4,U+56b6-56b7,U+56bc,U+56be,U+56c0,U+56c2-56c3,U+56c5,U+56c8-56d1,U+56d3,U+56d7-56d9,U+56dc-56dd,U+56df,U+56e1,U+56e4-56e8,U+56eb,U+56ed-56ee,U+56f1,U+56f6-56f7,U+56f9,U+56ff-5704,U+5707-570a,U+570c-570d,U+5711,U+5713,U+5715-5716,U+5718,U+571a-571d,U+5720-5726,U+5729-572a,U+572c,U+572e-572f,U+5733-5734,U+5737-5738,U+573b,U+573d-573f,U+5745-5746,U+574c-574f,U+5751-5752,U+5759,U+575f,U+5761-5762,U+5764-5765,U+5767-5769,U+576b,U+576d-5771,U+5773-5775,U+5777,U+5779-577c,U+577e-577f,U+5781,U+5783,U+5788-5789,U+578c,U+5793-5795,U+5797,U+5799-579a,U+579c-57a1,U+57a4,U+57a7-57aa,U+57ac,U+57ae,U+57b0}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.46.woff2) format("woff2");unicode-range:U+543f-5440,U+5443-5444,U+5447,U+544c-544f,U+5455,U+545e,U+5462,U+5464,U+5466-5467,U+5469,U+546b-546e,U+5470-5471,U+5474-5477,U+547b,U+547f-5481,U+5483-5486,U+5488-548b,U+548d-5492,U+5495-5496,U+549c,U+549f-54a2,U+54a4,U+54a6-54af,U+54b1,U+54b7-54bc,U+54be-54bf,U+54c2-54c4,U+54c6-54c8,U+54ca,U+54cd-54ce,U+54d8,U+54e0,U+54e2,U+54e5-54e6,U+54e8-54ea,U+54ec-54ef,U+54f1,U+54f3,U+54f6,U+54fc-5501,U+5505,U+5508-5509,U+550c-550f,U+5514-5516,U+5527,U+552a-552b,U+552e,U+5532-5533,U+5535-5536,U+5538-5539,U+553b-553d,U+5540-5541,U+5544-5545,U+5547,U+5549-554a,U+554c-554d,U+5550-5551,U+5556-5558,U+555a-555e,U+5560-5561,U+5563-5564,U+5566,U+557b-5583,U+5586-5588,U+558a,U+558e-558f,U+5591-5594,U+5597,U+5599,U+559e-559f,U+55a3-55a4,U+55a8-55a9,U+55ac-55ae,U+55b2,U+55bf,U+55c1,U+55c3-55c4,U+55c6-55c7,U+55c9,U+55cb-55cc,U+55ce,U+55d1-55d4,U+55d7-55d8,U+55da-55db,U+55dd-55df,U+55e2,U+55e4,U+55e9,U+55ec,U+55ee,U+55f1,U+55f6-55f9,U+55fd-55ff,U+5605,U+5607-5608,U+560a,U+560d-5612}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.47.woff2) format("woff2");unicode-range:U+528d,U+5291-5298,U+529a,U+529c,U+52a4-52a7,U+52ab-52ad,U+52af-52b0,U+52b5-52b8,U+52ba-52be,U+52c0-52c1,U+52c4-52c6,U+52c8,U+52ca,U+52cc-52cd,U+52cf-52d2,U+52d4,U+52d6-52d7,U+52db-52dc,U+52de,U+52e0-52e1,U+52e3,U+52e5-52e6,U+52e8-52ea,U+52ec,U+52f0-52f1,U+52f3-52fb,U+5300-5301,U+5303,U+5306-5308,U+530a-530d,U+530f-5311,U+5313,U+5315,U+5318-531f,U+5321,U+5323-5325,U+5327-532d,U+532f-5333,U+5335,U+5338,U+533c-533e,U+5340,U+5342,U+5345-5346,U+5349,U+534b-534c,U+5359,U+535b,U+535e,U+5361,U+5363-5367,U+5369,U+536c-536e,U+5372,U+5377,U+5379-537b,U+537d-537f,U+5382-5383,U+5387-5389,U+538e,U+5393-5394,U+5396,U+5398-5399,U+539d,U+53a0-53a1,U+53a4-53a6,U+53a9-53ab,U+53ad-53b0,U+53b2,U+53b4-53b8,U+53ba,U+53bd,U+53c0-53c1,U+53c3-53c5,U+53cf,U+53d2-53d3,U+53d5,U+53da-53db,U+53dd-53e0,U+53e2,U+53e6-53e8,U+53ed-53ee,U+53f4-53f5,U+53fa,U+5401-5403,U+540b,U+540f,U+5412-5413,U+541a,U+541d-541e,U+5421,U+5424,U+5427-542a,U+542c-542f,U+5431,U+5433-5436,U+543c-543d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.48.woff2) format("woff2");unicode-range:U+50dd-50df,U+50e1-50e6,U+50e8-50e9,U+50ed-50f6,U+50f9-50fb,U+50fe,U+5101-5103,U+5106-5109,U+510b-510e,U+5110,U+5112,U+5114-511e,U+5121,U+5123,U+5127-5128,U+512c-512d,U+512f,U+5131,U+5133-5135,U+5137-513c,U+513f-5142,U+5147,U+514a,U+514c,U+514f,U+5152-5155,U+5157-5158,U+515f-5160,U+5162,U+5164,U+5166-5167,U+5169-516a,U+516e,U+5173-5174,U+5179,U+517b,U+517e,U+5180,U+5182-5184,U+5189,U+518b-518c,U+518e-5191,U+5193,U+5195-5196,U+5198,U+519d,U+51a1-51a4,U+51a6,U+51a9-51ab,U+51ad,U+51b0-51b3,U+51b5,U+51b8,U+51ba,U+51bc-51bf,U+51c2-51c3,U+51c5,U+51c8-51cb,U+51cf,U+51d1-51d6,U+51d8,U+51de-51e0,U+51e2,U+51e5,U+51e7,U+51e9,U+51ec-51ee,U+51f2-51f5,U+51f7,U+51fe,U+5201-5202,U+5204-5205,U+520b,U+520e,U+5212-5216,U+5218,U+5222,U+5226-5228,U+522a-522b,U+522e,U+5231-5233,U+5235,U+523c,U+5244-5245,U+5249,U+524b-524c,U+524f,U+5254-5255,U+5257-5258,U+525a,U+525c-5261,U+5266,U+5269,U+526c,U+526e,U+5271,U+5273-5274,U+5277-5279,U+527d,U+527f-5280,U+5282-5285,U+5288-528a,U+528c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.49.woff2) format("woff2");unicode-range:U+4f57-4f58,U+4f5a-4f5b,U+4f5d-4f5f,U+4f63-4f64,U+4f69-4f6a,U+4f6c,U+4f6e-4f71,U+4f76-4f7e,U+4f81-4f85,U+4f88-4f8a,U+4f8c,U+4f8e-4f90,U+4f92-4f94,U+4f96-4f9a,U+4f9e-4fa0,U+4fab,U+4fad,U+4faf,U+4fb2,U+4fb7,U+4fb9,U+4fbb-4fbe,U+4fc0-4fc1,U+4fc4-4fc6,U+4fc8-4fc9,U+4fcb-4fd4,U+4fd8,U+4fda-4fdc,U+4fdf-4fe0,U+4fe2,U+4fe4-4fe6,U+4fef-4ff2,U+4ff6,U+4ffc-5002,U+5004-5007,U+500a,U+500c,U+500e-5011,U+5013-5014,U+5016-5018,U+501a-501e,U+5021-5023,U+5025-502a,U+502c-502e,U+5030,U+5032-5033,U+5035,U+5039,U+503b,U+5040-5043,U+5045-5048,U+504a,U+504c,U+504e,U+5050-5053,U+5055-5057,U+5059-505a,U+505f-5060,U+5062-5063,U+5066-5067,U+506a,U+506c-506d,U+5070-5072,U+5077-5078,U+5080-5081,U+5083-5086,U+5088,U+508a,U+508e-5090,U+5092-5096,U+509a-509c,U+509e-50a3,U+50aa,U+50ad,U+50af-50b4,U+50b9-50bb,U+50bd,U+50c0,U+50c2-50c4,U+50c7,U+50c9-50ca,U+50cc,U+50ce,U+50d0-50d1,U+50d3-50d4,U+50d6,U+50d8-50d9,U+50dc}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.50.woff2) format("woff2");unicode-range:U+4093,U+4103,U+4105,U+4148,U+414f,U+4163,U+41b4,U+41bf,U+41e6,U+41ee,U+41f3,U+4207,U+420e,U+4264,U+4293,U+42c6,U+42d6,U+42dd,U+4302,U+432b,U+4343,U+43ee,U+43f0,U+4408,U+440c,U+4417,U+441c,U+4422,U+4453,U+445b,U+4476,U+447a,U+4491,U+44b3,U+44be,U+44d4,U+4508,U+450d,U+4525,U+4543,U+457a,U+459d,U+45b8,U+45be,U+45e5,U+45ea,U+460f-4610,U+4641,U+4665,U+46a1,U+46ae-46af,U+470c,U+471f,U+4764,U+47e6,U+47fd,U+4816,U+481e,U+4844,U+484e,U+48b5,U+49b0,U+49e7,U+49fa,U+4a04,U+4a29,U+4abc,U+4b38,U+4b3b,U+4b7e,U+4bc2,U+4bca,U+4bd2,U+4be8,U+4c17,U+4c20,U+4c38,U+4cc4,U+4cd1,U+4ce1,U+4d07,U+4d77,U+4e02,U+4e04-4e05,U+4e0c,U+4e0f-4e12,U+4e15,U+4e17,U+4e19,U+4e1e-4e1f,U+4e23-4e24,U+4e28-4e2c,U+4e2e-4e31,U+4e35-4e37,U+4e3f-4e42,U+4e44,U+4e47-4e48,U+4e4d-4e4e,U+4e51,U+4e55-4e56,U+4e58,U+4e5a-4e5c,U+4e62-4e63,U+4e68-4e69,U+4e74-4e75,U+4e79,U+4e7f,U+4e82,U+4e85,U+4e8a,U+4e8d-4e8e,U+4e96-4e99,U+4e9d-4ea0,U+4ea2,U+4ea5-4ea6,U+4ea8,U+4eaf-4eb0,U+4eb3,U+4eb6,U+4eb9,U+4ebb-4ebc,U+4ec2-4ec4,U+4ec6-4ec8,U+4ecd,U+4ed0,U+4ed7,U+4eda-4edb,U+4edd-4ee2,U+4ee8,U+4eeb,U+4eed,U+4eef,U+4ef1,U+4ef3,U+4ef5,U+4ef7,U+4efc-4f00,U+4f02-4f03,U+4f08-4f09,U+4f0b-4f0d,U+4f12,U+4f15-4f17,U+4f19,U+4f1c,U+4f2b,U+4f2e,U+4f30-4f31,U+4f33,U+4f35-4f37,U+4f39,U+4f3b,U+4f3e,U+4f40,U+4f42-4f43,U+4f48-4f49,U+4f4b-4f4c,U+4f52,U+4f54,U+4f56}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.51.woff2) format("woff2");unicode-range:U+3395-339b,U+339e-33a0,U+33a2-33ff,U+3402,U+3405-3406,U+3427,U+342c,U+342e,U+3468,U+346a,U+3488,U+3492,U+34b5,U+34bc,U+34c1,U+34c7,U+34db,U+351f,U+353e,U+355d-355e,U+3563,U+356e,U+35a6,U+35a8,U+35c5,U+35da,U+35de,U+35f4,U+3605,U+3614,U+364a,U+3691,U+3696,U+3699,U+36cf,U+3761-3762,U+376b-376c,U+3775,U+378d,U+37c1,U+37e2,U+37e8,U+37f4,U+37fd,U+3800,U+382f,U+3836,U+3840,U+385c,U+3861,U+38a1,U+38ad,U+38fa,U+3917,U+391a,U+396f,U+39a4,U+39b8,U+3a5c,U+3a6e,U+3a73,U+3a85,U+3ac4,U+3acb,U+3ad6-3ad7,U+3aea,U+3af3,U+3b0e,U+3b1a,U+3b1c,U+3b22,U+3b35,U+3b6d,U+3b77,U+3b87-3b88,U+3b8d,U+3ba4,U+3bb6,U+3bc3,U+3bcd,U+3bf0,U+3bf3,U+3c0f,U+3c26,U+3cc3,U+3cd2,U+3d11,U+3d1e,U+3d31,U+3d4e,U+3d64,U+3d9a,U+3dc0,U+3dcc,U+3dd4,U+3e05,U+3e3f-3e40,U+3e60,U+3e66,U+3e68,U+3e83,U+3e8a,U+3e94,U+3eda,U+3f57,U+3f72,U+3f75,U+3f77,U+3fae,U+3fb1,U+3fc9,U+3fd7,U+3fdc,U+4039,U+4058}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.52.woff2) format("woff2");unicode-range:U+32b5-332b,U+332d-3394}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.53.woff2) format("woff2");unicode-range:U+31c8-31e3,U+31f0-321e,U+3220-3230,U+3232-32b4}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.54.woff2) format("woff2");unicode-range:U+3028-303f,U+3094-3096,U+309f-30a0,U+30ee,U+30f7-30fa,U+30ff,U+3105-312f,U+3131-3163,U+3165-318e,U+3190-31bb,U+31c0-31c7}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.55.woff2) format("woff2");unicode-range:U+2f14-2fd5,U+2ff0-2ffb,U+3004,U+3013,U+3016-301b,U+301e,U+3020-3027}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.56.woff2) format("woff2");unicode-range:U+25e4-25e6,U+2601-2603,U+2609,U+260e-260f,U+2616-2617,U+261c-261f,U+262f,U+2641,U+2660,U+2662-2664,U+2666-2668,U+266d-266e,U+2672-267d,U+26bd-26be,U+2702,U+271a,U+273d,U+2740,U+2756,U+2776-2793,U+27a1,U+2934-2935,U+29bf,U+29fa-29fb,U+2b05-2b07,U+2b1a,U+2b95,U+2e3a-2e3b,U+2e80-2e99,U+2e9b-2ef3,U+2f00-2f13}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.57.woff2) format("woff2");unicode-range:U+24d1-24ff,U+2503-2513,U+2515-2516,U+2518-251b,U+251d-2522,U+2524-259f,U+25a2-25ab,U+25b1,U+25b7,U+25c0-25c1,U+25c9-25ca,U+25cc,U+25d0-25d3,U+25e2-25e3}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.58.woff2) format("woff2");unicode-range:U+2105,U+2109-210a,U+210f,U+2116,U+2121,U+2126-2127,U+212b,U+212e,U+2135,U+213b,U+2194-2199,U+21b8-21b9,U+21c4-21c6,U+21cb-21cc,U+21d0,U+21e6-21e9,U+21f5,U+2202-2203,U+2205-2206,U+2208-220b,U+220f,U+2211,U+2213,U+2215,U+221a,U+221d,U+2220,U+2223,U+2225-2226,U+2228,U+222a-222e,U+2234-2237,U+223d,U+2243,U+2245,U+2248,U+224c,U+2260,U+2262,U+2264-2265,U+226e-226f,U+2272-2273,U+2276-2277,U+2283-2287,U+228a-228b,U+2295-2299,U+22a0,U+22a5,U+22bf,U+22da-22db,U+22ef,U+2305-2307,U+2318,U+2329-232a,U+23b0-23b1,U+23be-23cc,U+23ce,U+23da-23db,U+2423,U+2469-24d0}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.59.woff2) format("woff2");unicode-range:U+a1-a4,U+a6-a7,U+aa,U+ac-ad,U+b5-b6,U+b8-ba,U+bc-c8,U+ca-cc,U+ce-d5,U+d9-db,U+dd-df,U+e6,U+ee,U+f0,U+f5,U+f7,U+f9,U+fb,U+fe-102,U+110-113,U+11a-11b,U+128-12b,U+143-144,U+147-148,U+14c,U+14e-14f,U+152-153,U+168-16d,U+192,U+1a0-1a1,U+1af,U+1cd-1dc,U+1f8-1f9,U+251,U+261,U+2bb,U+2c7,U+2c9,U+2ea-2eb,U+304,U+307,U+30c,U+1e3e-1e3f,U+1ea0-1ebe,U+1ec0-1ec6,U+1ec8-1ef9,U+2011-2012,U+2016,U+2018-201a,U+201e,U+2021,U+2030,U+2033,U+2035,U+2042,U+2047,U+2051,U+2074,U+20a9,U+20ab-20ac,U+20dd-20de,U+2100}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.60.woff2) format("woff2");unicode-range:U+2227,U+26a0,U+2713,U+301f,U+4ff8,U+5239,U+526a,U+54fa,U+5740,U+5937,U+5993,U+59fb,U+5a3c,U+5c41,U+6028,U+626e,U+646f,U+647a,U+64b0,U+64e2,U+65a7,U+66fe,U+6727,U+6955,U+6bef,U+6f23,U+724c,U+767c,U+7a83,U+7ac4,U+7b67,U+8000,U+8471,U+8513,U+8599,U+86db,U+8718,U+87f2,U+88f3,U+8ad2,U+8e2a,U+8fa3,U+95a5,U+9798,U+9910,U+9957,U+9bab,U+9c3b,U+9daf,U+ff95}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.61.woff2) format("woff2");unicode-range:U+a8,U+2032,U+2261,U+2282,U+3090,U+30f1,U+339c,U+535c,U+53d9,U+56a2,U+56c1,U+5806,U+589f,U+59d0,U+5a7f,U+60e0,U+639f,U+65af,U+68fa,U+69ae,U+6d1b,U+6ef2,U+71fb,U+725d,U+7262,U+75bc,U+7768,U+7940,U+79bf,U+7bed,U+7d68,U+7dfb,U+814b,U+8207,U+83e9,U+8494,U+8526,U+8568,U+85ea,U+86d9,U+87ba,U+8861,U+887f,U+8fe6,U+9059,U+9061,U+916a,U+976d,U+97ad,U+9ece}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.62.woff2) format("woff2");unicode-range:U+2d9,U+21d4,U+301d,U+515c,U+52fe,U+5420,U+5750,U+5766,U+5954,U+5b95,U+5f8a,U+5f98,U+620c,U+621f,U+641c,U+66d9,U+676d,U+6775,U+67f5,U+694a,U+6a02,U+6a3a,U+6a80,U+6c23,U+6c72,U+6dcb,U+6faa,U+707c,U+71c8,U+7422,U+74e2,U+7791,U+7825,U+7a14,U+7a1c,U+7c95,U+7fc1,U+82a5,U+82db,U+8304,U+853d,U+8cd3,U+8de8,U+8f0c,U+8f3f,U+9091,U+91c7,U+929a,U+98af,U+9913}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.63.woff2) format("woff2");unicode-range:U+2ca-2cb,U+2229,U+2468,U+2669,U+266f,U+273f,U+4ec0,U+4f60,U+4fb6,U+5347,U+540e,U+543b,U+5b0c,U+5d4c,U+5f14,U+5f9e,U+6155,U+62d0,U+6602,U+6666,U+66f3,U+67a2,U+67ca,U+69cc,U+6d29,U+6d9b,U+6e3e,U+6f81,U+7109,U+73c0,U+73c2,U+7425,U+7435-7436,U+7525,U+7554,U+785d,U+786b,U+7ae3,U+7b94,U+7d18,U+81bf,U+8511,U+8549,U+9075,U+9640,U+98e2,U+9e9f,U+ff96}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.64.woff2) format("woff2");unicode-range:U+2467,U+4ece,U+4ed4,U+4f91,U+4fae,U+534d,U+53c9,U+54b3,U+586b,U+5944,U+5b78,U+5df7,U+5f77,U+6101,U+6167-6168,U+61a4,U+62d9,U+698a,U+699b,U+6a59,U+6cc4,U+6e07,U+7099,U+75d2,U+77ad,U+7953,U+7984,U+7a92,U+7baa,U+7dbb,U+817f,U+82ad,U+85e9,U+868a,U+8caa,U+8f44,U+9017,U+907c,U+908a,U+92f3,U+936e,U+9435,U+978d,U+9838,U+9a28,U+9b41,U+9ba8,U+9c57,U+9eb9}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.65.woff2) format("woff2");unicode-range:U+b1,U+309b,U+4e5e,U+51f1,U+5506,U+55c5,U+58cc,U+59d1,U+5c51,U+5ef7,U+6284,U+62d7,U+6689,U+673d,U+6a2b,U+6a8e,U+6a9c,U+6d63,U+6dd1,U+70b8,U+7235,U+72db,U+72f8,U+7560,U+7c9b,U+7ce7,U+7e1e,U+80af,U+82eb,U+8463,U+8499,U+85dd,U+86ee,U+8a60,U+8a6e,U+8c79,U+8e87,U+8e8a,U+8f5f,U+9010,U+918d,U+9190,U+965b,U+97fb,U+9ab8,U+9bad,U+9d3b,U+9d5c,U+9dfa,U+9e93}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.66.woff2) format("woff2");unicode-range:U+2020,U+3003,U+3231,U+4e9b,U+4f3d,U+4f47,U+51b6,U+51dc,U+53e1,U+5bc5,U+602f,U+60bc,U+61c9,U+633d,U+637b,U+6492,U+65fa,U+660f,U+66f0,U+6703,U+681e,U+6876,U+6893,U+6912,U+698e,U+6c7d,U+714c,U+7169,U+71d5,U+725f,U+72d7,U+745b,U+74dc,U+75e2,U+7891,U+7897,U+7dcb,U+810a,U+8218,U+8339,U+840e,U+852d,U+8823,U+8a0a,U+9089,U+919c,U+971c,U+9ad9,U+ff4a,U+ff5a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.67.woff2) format("woff2");unicode-range:U+2466,U+2600,U+4eab,U+4fe3,U+4ff5,U+51a5,U+51f0,U+536f,U+53d4,U+53f1,U+54a5,U+559d,U+55e3,U+58fa,U+5962,U+59ea,U+5c16,U+5cef,U+5d16,U+5f10,U+5fd6,U+6190,U+6216,U+634f,U+63bb,U+66d6,U+6756,U+6bc5,U+6e26,U+727d,U+731f,U+76f2,U+7729,U+7a7f,U+7aff,U+7c9f,U+818f,U+8236,U+82b9,U+8338,U+85aa,U+88b4,U+8b33,U+904d,U+93a7,U+96cc,U+96eb,U+9aed,U+9b8e,U+fa11}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.68.woff2) format("woff2");unicode-range:U+251c,U+2523,U+4e14,U+545f,U+54bd,U+553e,U+55dc,U+56da,U+589c,U+5b55,U+5bb5,U+5ce1,U+5df4,U+5eb6,U+5ec9,U+6191,U+62f7,U+6357,U+64a5,U+6591,U+65bc,U+6897,U+6e1a,U+7063,U+711a,U+721b,U+722c,U+75b9,U+75d5,U+75fa,U+7766,U+7aae,U+7b48,U+7b8b,U+7d21,U+7e55,U+7f75,U+842c,U+8910,U+8a63,U+8b39,U+8b5a,U+8cdc,U+8d74,U+907d,U+91e7,U+9306,U+96bc,U+98f4,U+9ac4}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.69.woff2) format("woff2");unicode-range:U+2003,U+2312,U+266c,U+4f86,U+51ea,U+5243,U+5256,U+541f,U+5841,U+59dc,U+5df3,U+601c,U+60e7,U+632b,U+638c,U+64ad,U+6881,U+697c,U+69cd,U+6c50,U+6d2a,U+6fc1,U+7027,U+7058,U+70f9,U+714e,U+7345,U+751a,U+760d,U+764c,U+77db,U+7d79,U+7e8f,U+80ce,U+814e,U+81fc,U+8247,U+8278,U+85a9,U+8a03,U+90ed,U+9784,U+9801,U+984e,U+99b3,U+9bc9,U+9bdb,U+9be8,U+9e78,U+ff6b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.70.woff2) format("woff2");unicode-range:U+266b,U+3006,U+5176,U+5197,U+51a8,U+51c6,U+52f2,U+5614,U+5875,U+5a2f,U+5b54,U+5ce0,U+5dba,U+5deb,U+5e63,U+5f59,U+5fcc,U+6068,U+6367,U+68b6,U+6a0b,U+6b64,U+6e15,U+6eba,U+7272,U+72a0,U+7947,U+7985,U+79e6,U+79e9,U+7a3d,U+7a9f,U+7aaf,U+7b95,U+7f60,U+7f9e,U+7fe0,U+8098,U+80ba,U+8106,U+82d4,U+831c,U+87f9,U+8a1f,U+8acf,U+90c1,U+920d,U+9756,U+fe43,U+ff94}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.71.woff2) format("woff2");unicode-range:U+af,U+2465,U+2517,U+33a1,U+4f10,U+50c5,U+51b4,U+5384,U+5606,U+5bb0,U+5cac,U+5ee3,U+618e,U+61f2,U+62c9,U+66ab,U+66f9,U+6816,U+6960,U+6b3e,U+6f20,U+7078,U+72d0,U+73ed,U+7ad9,U+7b1b,U+7be4,U+7d62,U+7f51,U+80b4,U+80f4,U+8154,U+85fb,U+865c,U+8702,U+895f,U+8aed,U+8b90,U+8ced,U+8fbf,U+91d8,U+9418,U+9583,U+9591,U+9813,U+982c,U+9bd6,U+ff46,U+ff7f,U+ff88}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.72.woff2) format("woff2");unicode-range:U+4e91,U+508d,U+50e7,U+514e,U+51f6,U+5446,U+5504,U+584a,U+59a8,U+59d3,U+5a46,U+5ac9,U+6020,U+60a6,U+6148,U+621a,U+6234,U+64c1,U+6523,U+675c,U+67d1,U+6953,U+6ccc,U+6df5,U+6e13,U+6f06,U+723a,U+7325,U+74e6,U+758e,U+75ab,U+75d9,U+7a40,U+8096,U+82fa,U+8587,U+8594,U+8a6b,U+8ab9,U+8b17,U+8b83,U+937c,U+963b,U+9673,U+96db,U+9ce9,U+9f4b,U+ff67,U+ff82,U+ff93}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.73.woff2) format("woff2");unicode-range:U+221e,U+2514,U+51f9,U+5270,U+5449,U+5824,U+59a5,U+5a29,U+5d07,U+5e16,U+60e3,U+614c,U+6276,U+643e,U+64ab,U+6562,U+6681,U+670b,U+6734,U+67af,U+6a3d,U+6b05,U+6dc0,U+6e4a,U+7259,U+732a,U+7409,U+78a7,U+7a6b,U+8015,U+809b,U+817a,U+830e,U+837b,U+85ab,U+8a23,U+8a93,U+8b00,U+8b19,U+8b21,U+8cbf,U+8fb0,U+901d,U+91b8,U+9320,U+932c,U+9688,U+96f6,U+9df2,U+ff6a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.74.woff2) format("woff2");unicode-range:U+2002,U+2025,U+4f8d,U+51e1,U+51f8,U+5507,U+5598,U+58f1,U+5983,U+59ac,U+5c3c,U+5de7,U+5e7d,U+5eca,U+5f61,U+606d,U+60f9,U+636e,U+64ec,U+67da,U+67ff,U+6813,U+68f2,U+693f,U+6b6a,U+6bbb,U+6ef4,U+7092,U+717d,U+7261,U+73c8,U+7432,U+7483,U+76fe,U+7709,U+78d0,U+81a3,U+81b3,U+82af,U+8305,U+8309,U+8870,U+88fe,U+8cd1,U+8d66,U+906e,U+971e,U+9812,U+ff79,U+ff90}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.75.woff2) format("woff2");unicode-range:U+2464,U+2501,U+2640,U+2642,U+339d,U+4f0e,U+5091,U+50b5,U+5132,U+51cc,U+558b,U+55aa,U+585e,U+5bee,U+5dfe,U+60b6,U+62b9,U+6349,U+6566,U+6590,U+6842,U+689d,U+6a58,U+6c70,U+6ff1,U+7815,U+7881,U+7aaa,U+7bc7,U+7def,U+7fa8,U+8017,U+8036,U+8061,U+821f,U+8429,U+8ce0,U+8e74,U+9019,U+90ca,U+9162,U+932f,U+93ae,U+9644,U+990c,U+9cf3,U+ff56,U+ff6e,U+ff7e,U+ff85}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.76.woff2) format("woff2");unicode-range:U+2266-2267,U+4f2f,U+5208,U+5451,U+546a,U+5589,U+576a,U+5815,U+5a9a,U+5b9b,U+5c3a,U+5efb,U+5faa,U+6109,U+6643,U+6652,U+695a,U+69fd,U+6b86,U+6bb4,U+6daf,U+7089,U+70cf,U+7a00,U+7a4f,U+7b39,U+7d33,U+80e1,U+828b,U+82a6,U+86cd,U+8c8c,U+8cca,U+8df3,U+9077,U+9175,U+91dc,U+925b,U+9262,U+9271,U+92ed,U+9855,U+9905,U+9d28,U+ff3f,U+ff58,U+ff68,U+ff6d,U+ff9c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.77.woff2) format("woff2");unicode-range:U+2207,U+25ef,U+309c,U+4e4f,U+5146,U+51dd,U+5351,U+540a,U+5629,U+5eb5,U+5f04,U+5f13,U+60dc,U+6212,U+63b4,U+642c,U+6627,U+66a6,U+66c7,U+66fd,U+674e,U+6b96,U+6c4e,U+6df3,U+6e67,U+6f84,U+72fc,U+733f,U+7c97,U+7db1,U+7e4d,U+816b,U+82d1,U+84cb,U+854e,U+8607,U+86c7,U+871c,U+8776,U+8a89,U+8fc4,U+91a4,U+9285,U+9685,U+9903,U+9b31,U+9f13,U+ff42,U+ff74,U+ff91}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.78.woff2) format("woff2");unicode-range:U+4e32,U+51db,U+53a8,U+53ea,U+5609,U+5674,U+5a92,U+5e7e,U+6115,U+611a,U+62cc,U+62ed,U+63c9,U+64b9,U+64e6,U+65cb,U+6606,U+6731,U+683d,U+6afb,U+7460,U+771e,U+78ef,U+7b26,U+7b51,U+7cde,U+7d10,U+7d2f,U+7d46,U+80de,U+819c,U+84b2,U+85cd,U+865a,U+8ecc,U+9022,U+90b8,U+9192,U+9675,U+96b7,U+99ff,U+ff44,U+ff55,U+ff6c,U+ff73,U+ff75,U+ff86,U+ff8d,U+ff92,U+ffe3}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.79.woff2) format("woff2");unicode-range:U+25b3,U+30f5,U+4eae,U+4f46,U+4f51,U+5203,U+52ff,U+55a7,U+564c,U+565b,U+57f9,U+5805,U+5b64,U+5e06,U+5f70,U+5f90,U+60e8,U+6182,U+62f3,U+62fe,U+63aa,U+64a4,U+65d7,U+673a,U+6851,U+68cb,U+68df,U+6d1e,U+6e58,U+6e9d,U+77b3,U+7832,U+7c3f,U+7db4,U+7f70,U+80aa,U+80c6,U+8105,U+819d,U+8276,U+8679,U+8986,U+8c9d,U+8fc5,U+916c,U+9665,U+9699,U+96c0,U+9a19,U+ff8b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.80.woff2) format("woff2");unicode-range:U+2463,U+25a1,U+4ef0,U+5076,U+5098,U+51fd,U+5302,U+5448,U+54c9,U+570b,U+583a,U+5893,U+58a8,U+58ee,U+5949,U+5bdb,U+5f26,U+5f81,U+6052,U+6170,U+61c7,U+631f,U+635c,U+664b,U+69fb,U+6f01,U+7070,U+722a,U+745e,U+755c,U+76c6,U+78c1,U+79e4,U+7bb8,U+7d0b,U+81a8,U+82d7,U+8b5c,U+8f14,U+8fb1,U+8fbb,U+9283,U+9298,U+9a30,U+ff03,U+ff50,U+ff59,U+ff7b,U+ff8e-ff8f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.81.woff2) format("woff2");unicode-range:U+2010,U+2502,U+25b6,U+4f3a,U+514b,U+5265,U+52c3,U+5339,U+53ec,U+54c0,U+55b0,U+5854,U+5b8f,U+5cb3,U+5e84,U+60da,U+6247,U+6249,U+628a,U+62cd,U+65ac,U+6838,U+690e,U+6cf0,U+6f02,U+6f2c,U+6f70,U+708a,U+7434,U+75be,U+77ef,U+7c60,U+7c98,U+7d1b,U+7e2b,U+80a5,U+81e3,U+820c,U+8210,U+8475,U+862d,U+8650,U+8997,U+906d,U+91c8,U+9700,U+9727,U+9df9,U+ff3a,U+ff9a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.82.woff2) format("woff2");unicode-range:U+2103,U+5049,U+52b1,U+5320,U+5553,U+572d,U+58c7,U+5b5d,U+5bc2,U+5de3,U+5e61,U+5f80,U+61a9,U+67d0,U+67f4,U+6c88,U+6ca1,U+6ce5,U+6d78,U+6e9c,U+6f54,U+731b,U+73b2,U+74a7,U+74f6,U+75e9,U+7b20,U+7c8b,U+7f72,U+809d,U+8108,U+82b3,U+82bd,U+84b8,U+84c4,U+88c2,U+8ae6,U+8ef8,U+902e,U+9065,U+9326,U+935b,U+938c,U+9676,U+9694,U+96f7,U+9ed9,U+ff48,U+ff4c,U+ff81}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.83.woff2) format("woff2");unicode-range:U+2500,U+3008-3009,U+4ead,U+4f0f,U+4fca,U+53eb,U+543e,U+57a2,U+5cf0,U+5e8f,U+5fe0,U+61b2,U+62d8,U+6442,U+64b2,U+6589,U+659c,U+67f1,U+68c4,U+6cb8,U+6d12,U+6de1,U+6fe1,U+70c8,U+723d,U+73e0,U+7656,U+773a,U+7948,U+7b87,U+7c92,U+7d3a,U+7e1b,U+7e4a,U+819a,U+8358,U+83c5,U+84bc,U+864e,U+8912,U+8c9e,U+8d05,U+92fc,U+9396,U+98fd,U+99d2,U+ff64,U+ff7a,U+ff83}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.84.woff2) format("woff2");unicode-range:U+3014-3015,U+4e3c,U+5036,U+5075,U+533f,U+53e9,U+5531,U+5642,U+5984,U+59e6,U+5a01,U+5b6b,U+5c0b,U+5f25,U+6069,U+60a0,U+614e,U+62b5,U+62d2-62d3,U+6597,U+660c,U+674f,U+67cf,U+6841,U+6905,U+6cf3,U+6d32,U+6d69,U+6f64,U+716e,U+7761,U+7b52,U+7be0,U+7dbf,U+7de9,U+7f36,U+81d3,U+8302,U+8389,U+846c,U+84ee,U+8a69,U+9038,U+9d8f,U+ff47,U+ff4b,U+ff76,U+ff9b}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.85.woff2) format("woff2");unicode-range:U+25c7,U+3007,U+504f,U+507d,U+51a0,U+52a3,U+5410,U+5510,U+559a,U+5782,U+582a,U+5c0a,U+5c3f,U+5c48,U+5f6b,U+6176,U+622f,U+6279,U+62bd,U+62dd,U+65ed,U+67b6,U+6817,U+6850,U+6d6a,U+6deb,U+6ea2,U+6edd,U+6f5c,U+72e9,U+73a9,U+7573,U+76bf,U+7950,U+7956,U+7f8a,U+7ffc,U+80a2,U+80c3,U+83ca,U+8a02,U+8a13,U+8df5,U+9375,U+983b,U+99b4,U+ff4e,U+ff71,U+ff89,U+ff97}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.86.woff2) format("woff2");unicode-range:U+24,U+2022,U+2212,U+221f,U+2665,U+4ecf,U+5100,U+51cd,U+52d8,U+5378,U+53f6,U+574a,U+5982,U+5996,U+5c1a,U+5e1d,U+5f84,U+609f,U+61a7,U+61f8,U+6398,U+63ee,U+6676,U+6691,U+6eb6,U+7126,U+71e5,U+7687,U+7965,U+7d17,U+80a1,U+8107,U+8266,U+85a6,U+8987,U+8ca2,U+8cab,U+8e0a,U+9042,U+95c7,U+9810,U+9867,U+98fc,U+ff52-ff54,U+ff61,U+ff77,U+ff98-ff99}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.87.woff2) format("woff2");unicode-range:U+b0,U+226a,U+2462,U+4e39,U+4fc3,U+4fd7,U+50be,U+50da,U+5200,U+5211,U+54f2,U+5618,U+596a,U+5b22,U+5bb4,U+5d50,U+60a3,U+63fa,U+658e,U+65e8,U+6669,U+6795,U+679d,U+67a0,U+6b3a,U+6e09,U+757f,U+7cd6,U+7dbe,U+7ffb,U+83cc,U+83f1,U+840c,U+845b,U+8846,U+8972,U+8a34,U+8a50,U+8a87,U+8edf,U+8ff0,U+90a6,U+9154,U+95a3,U+9663,U+9686,U+96c7,U+ff3c,U+ff7c,U+ff8a}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.88.woff2) format("woff2");unicode-range:U+25bd,U+4e59,U+4ec1,U+4ff3,U+515a,U+518a,U+525b,U+5375,U+552f,U+57a3,U+5b9c,U+5c3d,U+5e3d,U+5e7b,U+5f0a,U+6094,U+6458,U+654f,U+67f3,U+6b8a,U+6bd2,U+6c37,U+6ce1,U+6e56,U+6e7f,U+6ed1,U+6ede,U+6f0f,U+70ad,U+7267,U+7363,U+786c,U+7a42,U+7db2,U+7f85,U+8178,U+829d,U+8896,U+8c5a,U+8cb0,U+8ce2,U+8ed2,U+9047,U+9177,U+970a,U+9ea6,U+ff1b,U+ff31,U+ff39,U+ff80}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.89.woff2) format("woff2");unicode-range:U+a5,U+4e80,U+4f34,U+4f73,U+4f75,U+511f,U+5192,U+52aa,U+53c8,U+570f,U+57cb,U+596e,U+5d8b,U+5f66,U+5fd9,U+62db,U+62f6,U+6328,U+633f,U+63a7,U+6469,U+6bbf,U+6c41,U+6c57,U+6d44,U+6dbc,U+706f,U+72c2,U+72ed,U+7551,U+75f4,U+7949,U+7e26,U+7fd4,U+8150,U+8af8,U+8b0e,U+8b72,U+8ca7,U+934b,U+9a0e,U+9a12,U+9b42,U+ff41,U+ff43,U+ff45,U+ff49,U+ff4f,U+ff62-ff63}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.90.woff2) format("woff2");unicode-range:U+4e18,U+4fb5,U+5104,U+52c7,U+5353,U+5374,U+53e5,U+587e,U+594f,U+5a20,U+5de1,U+5f18,U+5fcd,U+6291,U+62ab,U+6355,U+6392,U+63da,U+63e1,U+656c,U+6687,U+68b0-68b1,U+68d2,U+68da,U+6b27,U+6cbc,U+7159,U+7344,U+73cd,U+76df,U+790e,U+7cf8,U+8102,U+88c1,U+8aa0,U+8e0f,U+9178,U+92ad,U+9670,U+96c5,U+9cf4,U+9db4,U+ff3e,U+ff6f,U+ff72,U+ff78,U+ff7d,U+ff84,U+ff8c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.91.woff2) format("woff2");unicode-range:U+60,U+2200,U+226b,U+2461,U+517c,U+526f,U+5800,U+5b97,U+5bf8,U+5c01,U+5d29,U+5e4c,U+5e81,U+6065,U+61d0,U+667a,U+6696,U+6843,U+6c99,U+6d99,U+6ec5,U+6f22,U+6f6e,U+6fa4,U+6fef,U+71c3,U+72d9,U+7384,U+78e8,U+7a1a,U+7a32,U+7a3c,U+7adc,U+7ca7,U+7d2b,U+7dad,U+7e4b,U+80a9,U+8170,U+81ed,U+820e,U+8a17,U+8afe,U+90aa,U+914e,U+963f,U+99c4,U+9eba,U+9f3b,U+ff38}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.92.woff2) format("woff2");unicode-range:U+2460,U+4e5f,U+4e7e,U+4ed9,U+501f,U+502b,U+5968,U+5974,U+5ac1,U+5b99,U+5ba3,U+5be7,U+5be9,U+5c64,U+5cb8,U+5ec3,U+5f1f,U+616e,U+6297,U+62e0,U+62ec,U+6368,U+642d,U+65e6,U+6717,U+676f,U+6b04,U+732e,U+7652,U+76ca,U+76d7,U+7802,U+7e70,U+7f6a,U+8133,U+81e8,U+866b,U+878d,U+88f8,U+8a5e,U+8cdb,U+8d08,U+907a,U+90e1,U+96f2,U+9f8d,U+ff35,U+ff37,U+ff40,U+ff9d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.93.woff2) format("woff2");unicode-range:U+21d2,U+25ce,U+300a-300b,U+4e89,U+4e9c,U+4ea1,U+5263,U+53cc,U+5426,U+5869,U+5947,U+598a,U+5999,U+5e55,U+5e72,U+5e79,U+5fae,U+5fb9,U+602a,U+6163,U+624d,U+6749,U+6c5a,U+6cbf,U+6d45,U+6dfb,U+6e7e,U+708e,U+725b,U+7763,U+79c0,U+7bc4,U+7c89,U+7e01,U+7e2e,U+8010,U+8033,U+8c6a,U+8cc3,U+8f1d,U+8f9b,U+8fb2,U+907f,U+90f7,U+9707,U+9818,U+9b3c,U+ff0a,U+ff4d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.94.woff2) format("woff2");unicode-range:U+2015,U+2190,U+4e43,U+5019,U+5247,U+52e7,U+5438,U+54b2,U+55ab,U+57f7,U+5bd2,U+5e8a,U+5ef6,U+6016,U+60b2,U+6162,U+6319,U+6551,U+6607,U+66b4,U+675f,U+67d4,U+6b20,U+6b53,U+6ce3,U+719f,U+75b2,U+770b,U+7720,U+77ac,U+79d2,U+7af9,U+7d05,U+7dca,U+8056,U+80f8,U+81f3,U+8352,U+885d,U+8a70,U+8aa4,U+8cbc,U+900f,U+9084,U+91e3,U+9451,U+96c4,U+99c6,U+9ad4,U+ff70}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.95.woff2) format("woff2");unicode-range:U+2193,U+25b2,U+4e4b,U+516d,U+51c4,U+529f,U+52c9,U+5360,U+5442,U+5857,U+5915,U+59eb,U+5a9b,U+5c3b,U+6012,U+61b6,U+62b1,U+6311,U+6577,U+65e2,U+65ec,U+6613,U+6790,U+6cb9,U+7372,U+76ae,U+7d5e,U+7fcc,U+88ab,U+88d5,U+8caf,U+8ddd,U+8ecd,U+8f38,U+8f9e,U+8feb,U+9063,U+90f5,U+93e1,U+968a,U+968f,U+98fe,U+9ec4,U+ff1d,U+ff27,U+ff2a,U+ff36,U+ff3b,U+ff3d,U+ffe5}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.96.woff2) format("woff2");unicode-range:U+4e03,U+4f38,U+50b7,U+5264,U+5348,U+5371,U+585a,U+58ca,U+5951,U+59b9,U+59d4,U+5b98,U+5f8b,U+6388,U+64cd,U+65e7,U+6803,U+6b6f,U+6d66,U+6e0b,U+6ecb,U+6fc3,U+72ac,U+773c,U+77e2,U+7968,U+7a74,U+7dba,U+7dd1,U+7e3e,U+808c,U+811a,U+8179,U+8239,U+8584,U+8a0e,U+8a72,U+8b66,U+8c46,U+8f29,U+90a3,U+9234,U+96f0,U+9769,U+9774,U+9aa8,U+ff26,U+ff28,U+ff9e-ff9f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.97.woff2) format("woff2");unicode-range:U+7e,U+b4,U+25c6,U+2661,U+4e92,U+4eee,U+4ffa,U+5144,U+5237,U+5287,U+52b4,U+58c1,U+5bff,U+5c04,U+5c06,U+5e95,U+5f31,U+5f93,U+63c3,U+640d,U+6557,U+6614,U+662f,U+67d3,U+690d,U+6bba,U+6e6f,U+72af,U+732b,U+7518,U+7ae0,U+7ae5,U+7af6,U+822a,U+89e6,U+8a3a,U+8a98,U+8cb8,U+8de1,U+8e8d,U+95d8,U+961c,U+96a3,U+96ea,U+9bae,U+ff20,U+ff22,U+ff29,U+ff2b-ff2c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.98.woff2) format("woff2");unicode-range:U+25cb,U+4e71,U+4f59,U+50d5,U+520a,U+5217,U+5230,U+523a-523b,U+541b,U+5439,U+5747,U+59c9,U+5bdf,U+5c31,U+5de8,U+5e7c,U+5f69,U+6050,U+60d1,U+63cf,U+663c,U+67c4,U+6885,U+6c38,U+6d6e,U+6db2,U+6df7,U+6e2c,U+6f5f,U+7532,U+76e3-76e4,U+7701,U+793c,U+79f0,U+7a93,U+7d00,U+7de0,U+7e54,U+8328,U+8840,U+969c,U+96e8,U+9811,U+9aea,U+9b5a,U+ff24,U+ff2e,U+ff57}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.99.woff2) format("woff2");unicode-range:U+2191,U+505c,U+52e4,U+5305,U+535a,U+56e0,U+59bb,U+5acc,U+5b09,U+5b87,U+5c90,U+5df1,U+5e2d,U+5e33,U+5f3e,U+6298,U+6383,U+653b,U+6697,U+6804,U+6a39,U+6cca,U+6e90,U+6f2b,U+702c,U+7206,U+7236,U+7559,U+7565,U+7591,U+75c7,U+75db,U+7b4b,U+7bb1,U+7d99,U+7fbd,U+8131,U+885b,U+8b1d,U+8ff7,U+9003,U+9045,U+96a0,U+9732,U+990a,U+99d0,U+9e97,U+9f62,U+ff25,U+ff2d}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.100.woff2) format("woff2");unicode-range:U+4e08,U+4f9d,U+5012,U+514d,U+51b7,U+5275,U+53ca,U+53f8,U+5584,U+57fc,U+5b9d,U+5bfa,U+5c3e,U+5f01,U+5fb4,U+5fd7,U+606f,U+62e1,U+6563,U+6674,U+6cb3,U+6d3e,U+6d74,U+6e1b,U+6e2f,U+718a,U+7247,U+79d8,U+7d14,U+7d66,U+7d71,U+7df4,U+7e41,U+80cc,U+8155,U+83d3,U+8a95,U+8ab2,U+8ad6,U+8ca1,U+9000,U+9006,U+9678,U+97d3,U+9808,U+98ef,U+9a5a,U+9b45,U+ff23,U+ff30}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.101.woff2) format("woff2");unicode-range:U+25bc,U+3012,U+4ef2,U+4f0a,U+516b,U+5373,U+539a,U+53b3,U+559c,U+56f0,U+5727,U+5742,U+5965,U+59ff,U+5bc6,U+5dfb,U+5e45,U+5ead,U+5fb3,U+6211,U+6253,U+639b,U+63a8,U+6545,U+6575,U+6628,U+672d,U+68a8,U+6bdb,U+6d25,U+707d,U+767e,U+7834,U+7b46,U+7bc9,U+8074,U+82e6,U+8349,U+8a2a,U+8d70,U+8da3,U+8fce,U+91cc,U+967d,U+97ff,U+9996,U+ff1c,U+ff2f,U+ff32,U+ff34}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.102.woff2) format("woff2");unicode-range:U+3d,U+5e,U+25cf,U+4e0e,U+4e5d,U+4e73,U+4e94,U+4f3c,U+5009,U+5145,U+51ac,U+5238,U+524a,U+53f3,U+547c,U+5802,U+5922,U+5a66,U+5c0e,U+5de6,U+5fd8,U+5feb,U+6797,U+685c,U+6b7b,U+6c5f-6c60,U+6cc9,U+6ce2,U+6d17,U+6e21,U+7167,U+7642,U+76db,U+8001,U+821e,U+8857,U+89d2,U+8b1b,U+8b70,U+8cb4,U+8cde,U+8f03,U+8f2a,U+968e,U+9b54,U+9e7f,U+9ebb,U+ff05,U+ff33}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.103.woff2) format("woff2");unicode-range:U+500d,U+5074,U+50cd,U+5175,U+52e2,U+5352,U+5354,U+53f2,U+5409,U+56fa,U+5a18,U+5b88,U+5bdd,U+5ca9,U+5f92,U+5fa9,U+60a9,U+623f,U+6483,U+653f,U+666f,U+66ae,U+66f2,U+6a21,U+6b66,U+6bcd,U+6d5c,U+796d,U+7a4d,U+7aef,U+7b56,U+7b97,U+7c4d,U+7e04,U+7fa9,U+8377,U+83dc,U+83ef,U+8535,U+8863,U+88cf,U+88dc,U+8907,U+8acb,U+90ce,U+91dd,U+ff0b,U+ff0d,U+ff19,U+ff65}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.104.woff2) format("woff2");unicode-range:U+4e01,U+4e21,U+4e38,U+52a9,U+547d,U+592e,U+5931,U+5b63,U+5c40,U+5dde,U+5e78,U+5efa,U+5fa1,U+604b,U+6075,U+62c5,U+632f,U+6a19,U+6c0f,U+6c11,U+6c96,U+6e05,U+70ba,U+71b1,U+7387,U+7403,U+75c5,U+77ed,U+795d,U+7b54,U+7cbe,U+7d19,U+7fa4,U+8089,U+81f4,U+8208,U+8336,U+8457,U+8a33,U+8c4a,U+8ca0,U+8ca8,U+8cc0,U+9014,U+964d,U+9803,U+983c,U+98db,U+ff17,U+ff21}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.105.woff2) format("woff2");unicode-range:U+25,U+25a0,U+4e26,U+4f4e,U+5341,U+56f2,U+5bbf,U+5c45,U+5c55,U+5c5e,U+5dee,U+5e9c,U+5f7c,U+6255,U+627f,U+62bc,U+65cf,U+661f,U+666e,U+66dc,U+67fb,U+6975,U+6a4b,U+6b32,U+6df1,U+6e29,U+6fc0,U+738b,U+7686,U+7a76,U+7a81,U+7c73,U+7d75,U+7dd2,U+82e5,U+82f1,U+85ac,U+888b,U+899a,U+8a31,U+8a8c,U+8ab0,U+8b58,U+904a,U+9060,U+9280,U+95b2,U+984d,U+9ce5,U+ff18}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.106.woff2) format("woff2");unicode-range:U+30f6,U+50ac,U+5178,U+51e6,U+5224,U+52dd,U+5883,U+5897,U+590f,U+5a5a,U+5bb3,U+5c65,U+5e03,U+5e2b,U+5e30,U+5eb7,U+6271,U+63f4,U+64ae,U+6574,U+672b,U+679a,U+6a29-6a2a,U+6ca2,U+6cc1,U+6d0b,U+713c,U+74b0,U+7981,U+7a0b,U+7bc0,U+7d1a,U+7d61,U+7fd2,U+822c,U+8996,U+89aa,U+8cac,U+8cbb,U+8d77,U+8def,U+9020,U+9152,U+9244,U+9662,U+967a,U+96e3,U+9759,U+ff16}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.107.woff2) format("woff2");unicode-range:U+23,U+3c,U+2192,U+4e45,U+4efb,U+4f50,U+4f8b,U+4fc2,U+5024,U+5150,U+5272,U+5370,U+53bb,U+542b,U+56db,U+56e3,U+57ce,U+5bc4,U+5bcc,U+5f71,U+60aa,U+6238,U+6280,U+629c,U+6539,U+66ff,U+670d,U+677e-677f,U+6839,U+69cb,U+6b4c,U+6bb5,U+6e96,U+6f14,U+72ec,U+7389,U+7814,U+79cb,U+79d1,U+79fb,U+7a0e,U+7d0d,U+85e4,U+8d64,U+9632,U+96e2,U+9805,U+99ac,U+ff1e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.108.woff2) format("woff2");unicode-range:U+2605-2606,U+301c,U+4e57,U+4fee,U+5065,U+52df,U+533b,U+5357,U+57df,U+58eb,U+58f0,U+591c,U+592a-592b,U+5948,U+5b85,U+5d0e,U+5ea7,U+5ff5,U+6025,U+63a1,U+63a5,U+63db,U+643a,U+65bd,U+671d,U+68ee,U+6982,U+6b73,U+6bd4,U+6d88,U+7570,U+7b11,U+7d76,U+8077,U+8217,U+8c37,U+8c61,U+8cc7,U+8d85,U+901f,U+962a,U+9802,U+9806,U+9854,U+98f2,U+9928,U+99c5,U+9ed2}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.109.woff2) format("woff2");unicode-range:U+266a,U+4f11,U+533a,U+5343,U+534a,U+53cd,U+5404,U+56f3,U+5b57-5b58,U+5bae,U+5c4a,U+5e0c,U+5e2f,U+5eab,U+5f35,U+5f79,U+614b,U+6226,U+629e,U+65c5,U+6625,U+6751,U+6821,U+6b69,U+6b8b,U+6bce,U+6c42,U+706b,U+7c21,U+7cfb,U+805e,U+80b2,U+82b8,U+843d,U+8853,U+88c5,U+8a3c,U+8a66,U+8d8a,U+8fba,U+9069,U+91cf,U+9752,U+975e,U+9999,U+ff0f-ff10,U+ff14-ff15}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.110.woff2) format("woff2");unicode-range:U+40,U+4e86,U+4e95,U+4f01,U+4f1d,U+4fbf,U+5099,U+5171,U+5177,U+53cb,U+53ce,U+53f0,U+5668,U+5712,U+5ba4,U+5ca1,U+5f85,U+60f3,U+653e,U+65ad,U+65e9,U+6620,U+6750,U+6761,U+6b62,U+6b74,U+6e08,U+6e80,U+7248,U+7531,U+7533,U+753a,U+77f3,U+798f,U+7f6e,U+8449,U+88fd,U+89b3,U+8a55,U+8ac7,U+8b77,U+8db3,U+8efd,U+8fd4,U+9031-9032,U+9580,U+9589,U+96d1,U+985e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.111.woff2) format("woff2");unicode-range:U+2b,U+d7,U+300e-300f,U+4e07,U+4e8c,U+512a,U+5149,U+518d,U+5236,U+52b9,U+52d9,U+5468,U+578b,U+57fa,U+5b8c,U+5ba2,U+5c02,U+5de5,U+5f37,U+5f62,U+623b,U+63d0,U+652f,U+672a,U+6848,U+6d41,U+7136,U+7537,U+754c,U+76f4,U+79c1,U+7ba1,U+7d44,U+7d4c,U+7dcf,U+7dda,U+7de8,U+82b1,U+897f,U+8ca9,U+8cfc,U+904e,U+9664,U+982d,U+9858,U+98a8,U+9a13,U+ff13,U+ff5c}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.112.woff2) format("woff2");unicode-range:U+4e16,U+4e3b,U+4ea4,U+4ee4,U+4f4d,U+4f4f,U+4f55,U+4f9b,U+5317,U+5358,U+53c2,U+53e4,U+548c,U+571f,U+59cb,U+5cf6,U+5e38,U+63a2,U+63b2,U+6559,U+662d,U+679c,U+6c7a,U+72b6,U+7523,U+767d,U+770c,U+7a2e,U+7a3f,U+7a7a,U+7b2c,U+7b49,U+7d20,U+7d42,U+8003,U+8272,U+8a08,U+8aac,U+8cb7,U+8eab,U+8ee2,U+9054-9055,U+90fd,U+914d,U+91cd,U+969b,U+97f3,U+984c,U+ff06}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.113.woff2) format("woff2");unicode-range:U+26,U+5f,U+2026,U+203b,U+4e09,U+4eac,U+4ed5,U+4fa1,U+5143,U+5199,U+5207,U+539f,U+53e3,U+53f7,U+5411,U+5473,U+5546,U+55b6,U+5929,U+597d,U+5bb9,U+5c11,U+5c4b,U+5ddd,U+5f97,U+5fc5,U+6295,U+6301,U+6307,U+671b,U+76f8,U+78ba,U+795e,U+7d30,U+7d39,U+7d9a,U+89e3,U+8a00,U+8a73,U+8a8d,U+8a9e,U+8aad,U+8abf,U+8cea,U+8eca,U+8ffd,U+904b,U+9650,U+ff11-ff12}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.114.woff2) format("woff2");unicode-range:U+3e,U+3005,U+4e0d,U+4e88,U+4ecb,U+4ee3,U+4ef6,U+4fdd,U+4fe1,U+500b,U+50cf,U+5186,U+5316,U+53d7,U+540c,U+544a,U+54e1,U+5728,U+58f2,U+5973,U+5b89,U+5c71,U+5e02,U+5e97,U+5f15,U+5fc3,U+5fdc,U+601d,U+611b,U+611f,U+671f,U+6728,U+6765,U+683c,U+6b21,U+6ce8,U+6d3b,U+6d77,U+7530,U+7740,U+7acb,U+7d50,U+826f,U+8f09,U+8fbc,U+9001,U+9053,U+91ce,U+9762,U+98df}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.115.woff2) format("woff2");unicode-range:U+7c,U+3080,U+4ee5,U+5148,U+516c,U+521d,U+5225,U+529b,U+52a0,U+53ef,U+56de,U+56fd,U+5909,U+591a,U+5b66,U+5b9f,U+5bb6,U+5bfe,U+5e73,U+5e83,U+5ea6,U+5f53,U+6027,U+610f,U+6210,U+6240,U+660e,U+66f4,U+66f8,U+6709,U+6771,U+697d,U+69d8,U+6a5f,U+6c34,U+6cbb,U+73fe,U+756a,U+7684,U+771f,U+793a,U+7f8e,U+898f,U+8a2d,U+8a71,U+8fd1,U+9078,U+9577,U+96fb,U+ff5e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.116.woff2) format("woff2");unicode-range:U+a9,U+3010-3011,U+30e2,U+4e0b,U+4eca,U+4ed6,U+4ed8,U+4f53,U+4f5c,U+4f7f,U+53d6,U+540d,U+54c1,U+5730,U+5916,U+5b50,U+5c0f,U+5f8c,U+624b,U+6570,U+6587,U+6599,U+691c,U+696d,U+6cd5,U+7269,U+7279,U+7406,U+767a-767b,U+77e5,U+7d04,U+7d22,U+8005,U+80fd,U+81ea,U+8868,U+8981,U+89a7,U+901a,U+9023,U+90e8,U+91d1,U+9332,U+958b,U+96c6,U+9ad8,U+ff1a,U+ff1f}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.117.woff2) format("woff2");unicode-range:U+4e,U+a0,U+3000,U+300c-300d,U+4e00,U+4e0a,U+4e2d,U+4e8b,U+4eba,U+4f1a,U+5165,U+5168,U+5185,U+51fa,U+5206,U+5229,U+524d,U+52d5,U+5408,U+554f,U+5831,U+5834,U+5927,U+5b9a,U+5e74,U+5f0f,U+60c5,U+65b0,U+65b9,U+6642,U+6700,U+672c,U+682a,U+6b63,U+6c17,U+7121,U+751f,U+7528,U+753b,U+76ee,U+793e,U+884c,U+898b,U+8a18,U+9593,U+95a2,U+ff01,U+ff08-ff09}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.118.woff2) format("woff2");unicode-range:U+21-22,U+27-2a,U+2c-3b,U+3f,U+41-4d,U+4f-5d,U+61-7b,U+7d,U+ab,U+ae,U+b2-b3,U+b7,U+bb,U+c9,U+cd,U+d6,U+d8,U+dc,U+e0-e5,U+e7-ed,U+ef,U+f1-f4,U+f6,U+f8,U+fa,U+fc-fd,U+103,U+14d,U+1b0,U+300-301,U+1ebf,U+1ec7,U+2013-2014,U+201c-201d,U+2039-203a,U+203c,U+2048-2049,U+2113,U+2122,U+65e5,U+6708,U+70b9}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6YnQCWXzO7W5-p9wTrkzI9ywX1Ff4zgPYcAW70.119.woff2) format("woff2");unicode-range:U+20,U+2027,U+3001-3002,U+3041-307f,U+3081-308f,U+3091-3093,U+3099-309a,U+309d-309e,U+30a1-30e1,U+30e3-30ed,U+30ef-30f0,U+30f2-30f4,U+30fb-30fe,U+ff0c,U+ff0e}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6omwqRfTHxT624.woff2) format("woff2");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6okQqRfTHxT624.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Kiwi Maru;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/kiwimaru/v19/R70YjykGkuuDep-hRg6onwqRfTHxTw.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Sniglet;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/sniglet/v17/cIf9MaFLtkE3UjaJ9CChYUsEkIpdQQ.woff2) format("woff2");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Sniglet;font-style:normal;font-weight:400;font-display:swap;src:url(https://fonts.gstatic.com/s/sniglet/v17/cIf9MaFLtkE3UjaJ9C6hYUsEkIo.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}.i-eos-icons\:three-dots-loading,[i-eos-icons\:three-dots-loading=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Ccircle cx='18' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='.67' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3Ccircle cx='12' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='.33' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3Ccircle cx='6' cy='12' r='0' fill='currentColor'%3E%3Canimate attributeName='r' begin='0' calcMode='spline' dur='1.5s' keySplines='0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8' repeatCount='indefinite' values='0;2;0;0'/%3E%3C/circle%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:alibabacloud{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M14.752 4.64h5.274C22.242 4.64 24 6.475 24 8.691V15.8a3.947 3.947 0 01-3.974 3.975h-5.274l1.299-1.835 3.822-1.222c.688-.23 1.146-.918 1.146-1.605v-5.81c0-.687-.458-1.375-1.146-1.605L16.05 6.475l-1.3-1.835zM2.98 15.111c0 .688.46 1.376 1.147 1.606l3.822 1.146 1.3 1.835H3.974A3.947 3.947 0 010 15.723V8.69c0-2.216 1.758-4.05 3.975-4.05h5.273L7.95 6.474 4.127 7.697c-.688.23-1.146.918-1.146 1.606v5.808z'/%3E%3Cpath d='M16.051 11.213H8.025v1.835h8.026v-1.835z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:anthropic{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:cloudflare{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cg%3E%3Cpath d='M16.493 17.4c.135-.52.08-.983-.161-1.338-.215-.328-.592-.519-1.05-.519l-8.663-.109a.148.148 0 01-.135-.082c-.027-.054-.027-.109-.027-.163.027-.082.108-.164.189-.164l8.744-.11c1.05-.054 2.153-.9 2.556-1.937l.511-1.31c.027-.055.027-.11.027-.164C17.92 8.91 15.66 7 12.942 7c-2.503 0-4.628 1.638-5.381 3.903a2.432 2.432 0 00-1.803-.491c-1.21.109-2.153 1.092-2.287 2.32-.027.328 0 .628.054.9C1.56 13.688 0 15.326 0 17.319c0 .19.027.355.027.545 0 .082.08.137.161.137h15.983c.08 0 .188-.055.215-.164l.107-.437'/%3E%3Cpath d='M19.238 11.75h-.242c-.054 0-.108.054-.135.109l-.35 1.2c-.134.52-.08.983.162 1.338.215.328.592.518 1.05.518l1.855.11c.054 0 .108.027.135.082.027.054.027.109.027.163-.027.082-.108.164-.188.164l-1.91.11c-1.05.054-2.153.9-2.557 1.937l-.134.355c-.027.055.026.137.107.137h6.592c.081 0 .162-.055.162-.137.107-.41.188-.846.188-1.31-.027-2.62-2.153-4.777-4.762-4.777'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:deepseek{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:featherless-ai{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36' width='1em' height='1em' %3E%3Cg fill='currentColor'%3E%3Cpath d='M40.0866 4.68482C38.2902 3.5825 35.863 3 33.0672 3C28.7842 3 24.0653 4.35865 19.8276 6.72206L19.7979 6.71083C19.7979 6.71083 19.7937 6.73344 19.7914 6.74423C18.5086 7.4617 17.2656 8.2629 16.0981 9.15731C9.22112 14.4248 7.29519 20.6748 8.92004 24.0156C7.14142 27.0728 6.0457 30.2332 6 33.9767C9.41949 27.421 11.4719 22.108 22.6146 13.1637C19.4309 13.8501 13.9281 17.1057 10.2271 22.0459C9.87793 19.156 12.1477 14.4895 17.2033 10.6174C17.8435 10.127 18.5092 9.66864 19.1886 9.23374C18.6577 10.8934 18.8269 10.4806 17.7254 12.8076C19.3543 11.2566 20.4268 10.2995 22.035 7.64145C24.123 6.60964 26.2948 5.83844 28.4482 5.37235C28.0919 6.56071 27.4137 8.57466 26.4955 10.1669C26.4955 10.1669 28.8258 9.66435 30.7518 9.77788C29.6995 10.9459 28.7527 12.2094 27.7926 13.5012C26.4777 15.2696 25.1184 17.0983 23.3778 18.8005C23.1683 19.0054 22.968 19.1912 22.7649 19.383C20.0902 19.1254 18.3235 20.1315 16.6683 21.9089C17.9737 21.2966 19.7273 20.7924 20.8266 21.0959C18.8008 22.7579 15.6106 24.9488 12.9893 24.7684C12.4922 25.5295 12.4608 25.5528 11.9144 26.4722C16.1664 27.537 21.507 23.1905 24.6498 20.1161C26.4926 18.3131 27.8964 16.4257 29.2534 14.6012C32.0481 10.8427 34.4616 7.5974 39.8153 6.3624L42 5.85877L40.0866 4.68482Z' class='logo-mark'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:fireworks{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath clip-rule='evenodd' d='M14.8 5l-2.801 6.795L9.195 5H7.397l3.072 7.428a1.64 1.64 0 003.038.002L16.598 5H14.8zm1.196 10.352l5.124-5.244-.699-1.669-5.596 5.739a1.664 1.664 0 00-.343 1.807 1.642 1.642 0 001.516 1.012L16 17l8-.02-.699-1.669-7.303.041h-.002zM2.88 10.104l.699-1.669 5.596 5.739c.468.479.603 1.189.343 1.807a1.643 1.643 0 01-1.516 1.012l-8-.018-.002.002.699-1.669 7.303.042-5.122-5.246z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:gemini{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M12 24A14.304 14.304 0 000 12 14.304 14.304 0 0012 0a14.305 14.305 0 0012 12 14.305 14.305 0 00-12 12'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:microsoft{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M11.49 2H2v9.492h9.492V2h-.002z'/%3E%3Cpath d='M22 2h-9.492v9.492H22V2z'/%3E%3Cpath d='M11.49 12.508H2V22h9.492v-9.492h-.002z'/%3E%3Cpath d='M22 12.508h-9.492V22H22v-9.492z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:mistral{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath clip-rule='evenodd' d='M3.428 3.4h3.429v3.428h3.429v3.429h-.002 3.431V6.828h3.427V3.4h3.43v13.714H24v3.429H13.714v-3.428h-3.428v-3.429h-3.43v3.428h3.43v3.429H0v-3.429h3.428V3.4zm10.286 13.715h3.428v-3.429h-3.427v3.429z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:moonshot{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:novita{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath clip-rule='evenodd' d='M9.167 4.17v5.665L0 19.003h9.167v-5.666l5.666 5.666H24L9.167 4.17z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:ollama{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M7.905 1.09c.216.085.411.225.588.41.295.306.544.744.734 1.263.191.522.315 1.1.362 1.68a5.054 5.054 0 012.049-.636l.051-.004c.87-.07 1.73.087 2.48.474.101.053.2.11.297.17.05-.569.172-1.134.36-1.644.19-.52.439-.957.733-1.264a1.67 1.67 0 01.589-.41c.257-.1.53-.118.796-.042.401.114.745.368 1.016.737.248.337.434.769.561 1.287.23.934.27 2.163.115 3.645l.053.04.026.019c.757.576 1.284 1.397 1.563 2.35.435 1.487.216 3.155-.534 4.088l-.018.021.002.003c.417.762.67 1.567.724 2.4l.002.03c.064 1.065-.2 2.137-.814 3.19l-.007.01.01.024c.472 1.157.62 2.322.438 3.486l-.006.039a.651.651 0 01-.747.536.648.648 0 01-.54-.742c.167-1.033.01-2.069-.48-3.123a.643.643 0 01.04-.617l.004-.006c.604-.924.854-1.83.8-2.72-.046-.779-.325-1.544-.8-2.273a.644.644 0 01.18-.886l.009-.006c.243-.159.467-.565.58-1.12a4.229 4.229 0 00-.095-1.974c-.205-.7-.58-1.284-1.105-1.683-.595-.454-1.383-.673-2.38-.61a.653.653 0 01-.632-.371c-.314-.665-.772-1.141-1.343-1.436a3.288 3.288 0 00-1.772-.332c-1.245.099-2.343.801-2.67 1.686a.652.652 0 01-.61.425c-1.067.002-1.893.252-2.497.703-.522.39-.878.935-1.066 1.588a4.07 4.07 0 00-.068 1.886c.112.558.331 1.02.582 1.269l.008.007c.212.207.257.53.109.785-.36.622-.629 1.549-.673 2.44-.05 1.018.186 1.902.719 2.536l.016.019a.643.643 0 01.095.69c-.576 1.236-.753 2.252-.562 3.052a.652.652 0 01-1.269.298c-.243-1.018-.078-2.184.473-3.498l.014-.035-.008-.012a4.339 4.339 0 01-.598-1.309l-.005-.019a5.764 5.764 0 01-.177-1.785c.044-.91.278-1.842.622-2.59l.012-.026-.002-.002c-.293-.418-.51-.953-.63-1.545l-.005-.024a5.352 5.352 0 01.093-2.49c.262-.915.777-1.701 1.536-2.269.06-.045.123-.09.186-.132-.159-1.493-.119-2.73.112-3.67.127-.518.314-.95.562-1.287.27-.368.614-.622 1.015-.737.266-.076.54-.059.797.042zm4.116 9.09c.936 0 1.8.313 2.446.855.63.527 1.005 1.235 1.005 1.94 0 .888-.406 1.58-1.133 2.022-.62.375-1.451.557-2.403.557-1.009 0-1.871-.259-2.493-.734-.617-.47-.963-1.13-.963-1.845 0-.707.398-1.417 1.056-1.946.668-.537 1.55-.849 2.485-.849zm0 .896a3.07 3.07 0 00-1.916.65c-.461.37-.722.835-.722 1.25 0 .428.21.829.61 1.134.455.347 1.124.548 1.943.548.799 0 1.473-.147 1.932-.426.463-.28.7-.686.7-1.257 0-.423-.246-.89-.683-1.256-.484-.405-1.14-.643-1.864-.643zm.662 1.21l.004.004c.12.151.095.37-.056.49l-.292.23v.446a.375.375 0 01-.376.373.375.375 0 01-.376-.373v-.46l-.271-.218a.347.347 0 01-.052-.49.353.353 0 01.494-.051l.215.172.22-.174a.353.353 0 01.49.051zm-5.04-1.919c.478 0 .867.39.867.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zm8.706 0c.48 0 .868.39.868.871a.87.87 0 01-.868.871.87.87 0 01-.867-.87.87.87 0 01.867-.872zM7.44 2.3l-.003.002a.659.659 0 00-.285.238l-.005.006c-.138.189-.258.467-.348.832-.17.692-.216 1.631-.124 2.782.43-.128.899-.208 1.404-.237l.01-.001.019-.034c.046-.082.095-.161.148-.239.123-.771.022-1.692-.253-2.444-.134-.364-.297-.65-.453-.813a.628.628 0 00-.107-.09L7.44 2.3zm9.174.04l-.002.001a.628.628 0 00-.107.09c-.156.163-.32.45-.453.814-.29.794-.387 1.776-.23 2.572l.058.097.008.014h.03a5.184 5.184 0 011.466.212c.086-1.124.038-2.043-.128-2.722-.09-.365-.21-.643-.349-.832l-.004-.006a.659.659 0 00-.285-.239h-.004z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:openai{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:openrouter{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M16.804 1.957l7.22 4.105v.087L16.73 10.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147 1.352L8.345 11.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314 1.17.796 2.701 1.866 1.11.775 2.083 1.177 3.147 1.352l.3.045c.694.091 1.375.094 2.825.033l.022-2.159 7.22 4.105v.087L16.589 22l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997 21.997 0 00-.755-.498l-.467-.28a55.927 55.927 0 00-.76-.43C2.908 14.73.563 14.116 0 14.116V9.888l.14.004c.564-.007 2.91-.622 3.809-1.124l1.016-.58.438-.274c.428-.28 1.072-.726 2.686-1.853 1.621-1.133 3.186-1.78 4.881-2.059 1.152-.19 1.974-.213 3.814-.138l.02-1.907z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:perplexity{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:together{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cg%3E%3Cpath d='M17.385 11.23a4.615 4.615 0 100-9.23 4.615 4.615 0 000 9.23zm0 10.77a4.615 4.615 0 100-9.23 4.615 4.615 0 000 9.23zm-10.77 0a4.615 4.615 0 100-9.23 4.615 4.615 0 000 9.23z' opacity='.2'/%3E%3Ccircle cx='6.615' cy='6.615' r='4.615'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:vllm{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M0 4.973h9.324V23L0 4.973z'/%3E%3Cpath d='M13.986 4.351L22.378 0l-6.216 23H9.324l4.662-18.649z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:volcengine{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M7.29 5.36L3.148 21.737a.215.215 0 00.203.261h8.29a.214.214 0 00.215-.261L7.7 5.359a.214.214 0 00-.41 0z' fill-opacity='.5'/%3E%3Cpath clip-rule='evenodd' d='M4.553 16.18l-1.406 5.558a.214.214 0 00.203.261h2.42-4.551a.214.214 0 01-.214-.26l2.275-8.961a.214.214 0 01.409 0l.864 3.402z'/%3E%3Cpath d='M14.44.15a.214.214 0 00-.41 0L8.366 21.739a.214.214 0 00.214.261H19.9a.214.214 0 00.215-.261L14.44.151z' fill-opacity='.5'/%3E%3Cpath clip-rule='evenodd' d='M16.694 22h3.207a.215.215 0 00.214-.262l-1.839-6.993 1.164-4.592a.214.214 0 01.411 0l2.951 11.586a.214.214 0 01-.214.261h-5.894z'/%3E%3Cpath d='M10.278 7.741L6.685 21.736a.214.214 0 00.214.264h7.17a.216.216 0 00.214-.166.216.216 0 000-.098L10.687 7.742a.214.214 0 00-.409 0z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lobe-icons\:xai{--un-icon:url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='1em' height='1em' %3E%3Cg fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:check,[i-lucide\:check=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:ghost,[i-lucide\:ghost=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 10h.01M15 10h.01M12 2a8 8 0 0 0-8 8v12l3-3l2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:loader-circle{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 12a9 9 0 1 1-6.219-8.56'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:mic,[i-lucide\:mic=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2m7 9v3'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-lucide\:music,[i-lucide\:music=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-simple-icons\:discord{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M20.317 4.37a19.8 19.8 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.3 18.3 0 0 0-5.487 0a13 13 0 0 0-.617-1.25a.08.08 0 0 0-.079-.037A19.7 19.7 0 0 0 3.677 4.37a.1.1 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.08.08 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.08.08 0 0 0 .084-.028a14 14 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13 13 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10 10 0 0 0 .372-.292a.07.07 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.07.07 0 0 1 .078.01q.181.149.373.292a.077.077 0 0 1-.006.127a12.3 12.3 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.08.08 0 0 0 .084.028a19.8 19.8 0 0 0 6.002-3.03a.08.08 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.06.06 0 0 0-.031-.03M8.02 15.33c-1.182 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418m7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-simple-icons\:elevenlabs{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M4.604 0v24h4.931V0zm9.86 0v24h4.933V0z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-simple-icons\:x{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584l-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:alt-arrow-down-bold-duotone,[i-solar\:alt-arrow-down-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='m8.303 12.404l3.327 3.431c.213.22.527.22.74 0l6.43-6.63C19.201 8.79 18.958 8 18.43 8h-5.723z'/%3E%3Cpath fill='currentColor' d='M11.293 8H5.57c-.528 0-.771.79-.37 1.205l2.406 2.481z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:alt-arrow-left-line-duotone,[i-solar\:alt-arrow-left-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m15 5l-6 7l6 7'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:armchair-2-bold-duotone,[i-solar\:armchair-2-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M16.533 18H6.75v2a.75.75 0 1 1-1.5 0v-2.324c-.829-.362-1.49-1.005-1.808-1.817l-.039-.102L2.1 12.264C1.685 11.15 2.613 10 3.927 10c.81 0 1.534.453 1.81 1.134l1.098 2.706c.1.246.15.37.222.47a1.2 1.2 0 0 0 .74.463c.13.027.277.027.57.027h6.98c.569 0 .853 0 1.091-.098q.196-.082.349-.219c.184-.166.281-.405.475-.883l1.001-2.466c.276-.68 1-1.134 1.81-1.134c1.314 0 2.242 1.15 1.827 2.264l-1.12 3c-.195.524-.292.785-.421 1.008a3.43 3.43 0 0 1-1.609 1.404V20a.75.75 0 1 1-1.5 0v-2.005c-.187.005-.415.005-.717.005'/%3E%3Cpath fill='currentColor' d='M13.236 3.5h-2.472c-1.1 0-1.976 0-2.66.088c-.706.09-1.285.28-1.746.72c-.464.441-.669 1.003-.765 1.685c-.093.658-.093 1.495-.093 2.54v2.195q.147.186.237.406l1.098 2.706c.1.246.15.37.222.47a1.2 1.2 0 0 0 .74.463c.13.027.277.027.57.027h6.98c.569 0 .853 0 1.091-.098q.196-.082.349-.219c.184-.166.281-.405.475-.883l1.001-2.466q.09-.221.237-.406V8.533c0-1.045 0-1.882-.093-2.54c-.096-.682-.301-1.244-.765-1.686c-.46-.438-1.04-.629-1.745-.72c-.685-.087-1.56-.087-2.661-.087' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:arrow-right-line-duotone,[i-solar\:arrow-right-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none'%3E%3Cpath fill='currentColor' d='M4 11.25a.75.75 0 0 0 0 1.5zm0 1.5h16v-1.5H4z' opacity='.5'/%3E%3Cpath stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m14 6l6 6l-6 6'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:book-bookmark-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M12 20.028V18H8v2.028c0 .277 0 .416.095.472s.224-.006.484-.13l1.242-.593c.088-.042.132-.063.179-.063s.091.02.179.063l1.242.593c.26.124.39.186.484.13c.095-.056.095-.195.095-.472' opacity='.5'/%3E%3Cpath fill='currentColor' d='M8 18h-.574c-1.084 0-1.462.006-1.753.068c-.513.11-.96.347-1.285.667c-.11.108-.164.161-.291.505s-.107.489-.066.78l.022.15c.11.653.31.998.616 1.244c.307.246.737.407 1.55.494c.837.09 1.946.092 3.536.092h4.43c1.59 0 2.7-.001 3.536-.092c.813-.087 1.243-.248 1.55-.494s.506-.591.616-1.243c.091-.548.11-1.241.113-2.171h-8v2.028c0 .277 0 .416-.095.472s-.224-.006-.484-.13l-1.242-.593c-.088-.042-.132-.063-.179-.063s-.091.02-.179.063l-1.242.593c-.26.124-.39.186-.484.13C8 20.444 8 20.305 8 20.028z'/%3E%3Cpath fill='currentColor' d='M4.727 2.733c.306-.308.734-.508 1.544-.618C7.105 2.002 8.209 2 9.793 2h4.414c1.584 0 2.688.002 3.522.115c.81.11 1.238.31 1.544.618c.305.308.504.74.613 1.557c.112.84.114 1.955.114 3.552V18H7.426c-1.084 0-1.462.006-1.753.068c-.513.11-.96.347-1.285.667c-.11.108-.164.161-.291.505A1.3 1.3 0 0 0 4 19.7V7.842c0-1.597.002-2.711.114-3.552c.109-.816.308-1.249.613-1.557' opacity='.5'/%3E%3Cpath fill='currentColor' d='M7.25 7A.75.75 0 0 1 8 6.25h8a.75.75 0 0 1 0 1.5H8A.75.75 0 0 1 7.25 7M8 9.75a.75.75 0 0 0 0 1.5h5a.75.75 0 0 0 0-1.5z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:bookmark-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M21 11.098v4.993c0 3.096 0 4.645-.734 5.321c-.35.323-.792.526-1.263.58c-.987.113-2.14-.907-4.445-2.946c-1.02-.901-1.529-1.352-2.118-1.47a2.2 2.2 0 0 0-.88 0c-.59.118-1.099.569-2.118 1.47c-2.305 2.039-3.458 3.059-4.445 2.945a2.24 2.24 0 0 1-1.263-.579C3 20.736 3 19.188 3 16.091v-4.994C3 6.81 3 4.666 4.318 3.333S7.758 2 12 2s6.364 0 7.682 1.332S21 6.81 21 11.098' opacity='.5'/%3E%3Cpath fill='currentColor' d='M9 5.25a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:box-minimalistic-bold-duotone,[i-solar\:box-minimalistic-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M8.422 20.618C10.178 21.54 11.056 22 12 22V12L2.638 7.073l-.04.067C2 8.154 2 9.417 2 11.942v.117c0 2.524 0 3.787.597 4.801c.598 1.015 1.674 1.58 3.825 2.709z'/%3E%3Cpath fill='currentColor' d='m17.577 4.432l-2-1.05C13.822 2.461 12.944 2 12 2c-.945 0-1.822.46-3.578 1.382l-2 1.05C4.318 5.536 3.242 6.1 2.638 7.072L12 12l9.362-4.927c-.606-.973-1.68-1.537-3.785-2.641' opacity='.7'/%3E%3Cpath fill='currentColor' d='m21.403 7.14l-.041-.067L12 12v10c.944 0 1.822-.46 3.578-1.382l2-1.05c2.151-1.129 3.227-1.693 3.825-2.708c.597-1.014.597-2.277.597-4.8v-.117c0-2.525 0-3.788-.597-4.802' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:bug-bold-duotone,[i-solar\:bug-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M19 11.938V15a7 7 0 0 1-6.25 6.96V15a.75.75 0 0 0-1.5 0v6.96A7 7 0 0 1 5 15v-3.062A3.94 3.94 0 0 1 8.938 8h6.124A3.94 3.94 0 0 1 19 11.938' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='M19 14.75v-1.5h3a.75.75 0 0 1 0 1.5zm-1.504 4.586c.31-.393.58-.82.801-1.276l2.538 1.27a.75.75 0 1 1-.67 1.34zM5.703 18.06q.333.684.801 1.276l-2.669 1.335a.75.75 0 0 1-.67-1.342zM5 13.25H2a.75.75 0 0 0 0 1.5h3zm12.354-4.515l2.81-1.406a.75.75 0 1 1 .671 1.341L18.42 9.88a4 4 0 0 0-1.065-1.144M6.647 8.735c-.427.306-.79.695-1.067 1.144L3.165 8.67a.75.75 0 0 1 .67-1.341zM16.5 8.27V7.5a4.5 4.5 0 1 0-9 0v.77A3.9 3.9 0 0 1 8.938 8h6.124c.508 0 .993.096 1.438.27'/%3E%3Cpath fill='currentColor' d='M6.376 1.584a.75.75 0 0 0 .208 1.04l2.36 1.573a4.5 4.5 0 0 1 1.387-.877L7.416 1.376a.75.75 0 0 0-1.04.208m8.68 2.613a4.5 4.5 0 0 0-1.387-.877l2.915-1.944a.75.75 0 1 1 .832 1.248z' opacity='.5'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12 14.25a.75.75 0 0 1 .75.75v7h-1.5v-7a.75.75 0 0 1 .75-.75' clip-rule='evenodd'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:card-search-broken,[i-solar\:card-search-broken=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' d='M14 4c3.771 0 5.657 0 6.828 1.172S22 8.229 22 12v1M10 4C6.229 4 4.343 4 3.172 5.172S2 8.229 2 12s0 5.657 1.172 6.828S6.229 20 10 20h3m-3-4H6'/%3E%3Ccircle cx='18' cy='17' r='3'/%3E%3Cpath stroke-linecap='round' d='m20.5 19.5l1 1M2 10h5m15 0H11'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:check-circle-bold-duotone,[i-solar\:check-circle-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10' opacity='.5'/%3E%3Cpath fill='currentColor' d='M16.03 8.97a.75.75 0 0 1 0 1.06l-5 5a.75.75 0 0 1-1.06 0l-2-2a.75.75 0 1 1 1.06-1.06l1.47 1.47l2.235-2.235L14.97 8.97a.75.75 0 0 1 1.06 0'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:check-circle-line-duotone,[i-solar\:check-circle-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='10' opacity='.5'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='m8.5 12.5l2 2l5-5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:close-circle-line-duotone,[i-solar\:close-circle-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='10' opacity='.5'/%3E%3Cpath stroke-linecap='round' d='m14.5 9.5l-5 5m0-5l5 5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:code-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M16.443 7.328a.75.75 0 0 1 1.059-.056l1.737 1.564c.737.663 1.347 1.212 1.767 1.71c.44.525.754 1.088.754 1.784c0 .695-.313 1.258-.754 1.782c-.42.499-1.03 1.049-1.767 1.711l-1.737 1.564a.75.75 0 1 1-1.004-1.115l1.697-1.527c.788-.709 1.319-1.19 1.663-1.598c.33-.393.402-.622.402-.817c0-.196-.072-.425-.402-.818c-.344-.409-.875-.889-1.663-1.598l-1.697-1.527a.75.75 0 0 1-.056-1.06m-8.94 1.06a.75.75 0 0 0-1.004-1.115L4.761 8.836c-.737.663-1.347 1.212-1.767 1.71c-.44.525-.754 1.088-.754 1.784c0 .695.313 1.258.754 1.782c.42.499 1.03 1.049 1.767 1.711l1.737 1.564a.75.75 0 1 0 1.004-1.115l-1.697-1.527c-.788-.709-1.319-1.19-1.663-1.598c-.33-.393-.402-.622-.402-.817c0-.196.072-.425.402-.818c.344-.409.875-.889 1.663-1.598z'/%3E%3Cpath fill='currentColor' d='M14.182 4.276a.75.75 0 0 1 .53.918l-3.974 14.83a.75.75 0 1 1-1.449-.389l3.974-14.83a.75.75 0 0 1 .919-.53' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:danger-triangle-bold-duotone,[i-solar\:danger-triangle-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M12 3c-2.31 0-3.77 2.587-6.688 7.762l-.364.644c-2.425 4.3-3.638 6.45-2.542 8.022S6.214 21 11.636 21h.728c5.422 0 8.134 0 9.23-1.572s-.117-3.722-2.542-8.022l-.364-.645C15.77 5.587 14.311 3 12 3' opacity='.5'/%3E%3Cpath fill='currentColor' d='M12 7.25a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0V8a.75.75 0 0 1 .75-.75M12 17a1 1 0 1 0 0-2a1 1 0 0 0 0 2'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:dialog-2-bold-duotone,[i-solar\:dialog-2-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='m10.404 22.48l.275-.465c.44-.745.66-1.117 1.012-1.325c.351-.207.81-.222 1.725-.252c.859-.027 1.436-.102 1.93-.306a4.24 4.24 0 0 0 2.295-2.296c.323-.779.323-1.767.323-3.743v-.848c0-2.777 0-4.165-.625-5.185c-.35-.57-.83-1.05-1.4-1.4c-1.02-.625-2.408-.625-5.185-.625H8.21c-2.777 0-4.165 0-5.185.625c-.57.35-1.05.83-1.4 1.4C1 9.08 1 10.468 1 13.245v.848c0 1.976 0 2.964.323 3.744a4.24 4.24 0 0 0 2.295 2.295c.494.204 1.07.28 1.93.306c.916.03 1.374.045 1.725.252c.35.208.571.58 1.012 1.325l.275.465c.41.692 1.434.692 1.844 0m2.789-7.963a1.06 1.06 0 1 0 0-2.12a1.06 1.06 0 0 0 0 2.12m-2.65-1.06a1.06 1.06 0 1 1-2.121 0a1.06 1.06 0 0 1 2.12 0m-4.772 1.06a1.06 1.06 0 1 0 0-2.12a1.06 1.06 0 0 0 0 2.12' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M15.486 1c1.267 0 2.274 0 3.082.077c.829.079 1.53.244 2.153.626a4.8 4.8 0 0 1 1.575 1.575c.383.624.548 1.325.627 2.153c.076.808.076 1.816.076 3.082v.866c0 .901 0 1.619-.04 2.2c-.04.595-.125 1.106-.323 1.584a4.77 4.77 0 0 1-2.67 2.617q-.21.082-.368.135h-1.65c.016-.499.016-1.093.016-1.822v-.848c0-2.777 0-4.165-.625-5.185c-.35-.57-.83-1.05-1.4-1.4c-1.02-.625-2.408-.625-5.185-.625H8.21c-.986 0-1.796 0-2.478.028v-1.65q.05-.17.13-.396q.133-.389.346-.739a4.8 4.8 0 0 1 1.576-1.575c.624-.382 1.324-.547 2.153-.626C10.745 1 11.752 1 13.019 1z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:document-text-linear{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M3 10c0-3.771 0-5.657 1.172-6.828S7.229 2 11 2h2c3.771 0 5.657 0 6.828 1.172S21 6.229 21 10v4c0 3.771 0 5.657-1.172 6.828S16.771 22 13 22h-2c-3.771 0-5.657 0-6.828-1.172S3 17.771 3 14z'/%3E%3Cpath stroke-linecap='round' d='M8 12h8M8 8h8m-8 8h5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:emoji-funny-square-bold-duotone,[i-solar\:emoji-funny-square-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M6.504 21.52c1.633.943 3.706.387 7.853-.724s6.22-1.666 7.163-3.3s.387-3.706-.724-7.853s-1.666-6.22-3.3-7.163s-3.706-.388-7.853.724c-4.147 1.11-6.22 1.666-7.163 3.3s-.388 3.706.724 7.853c1.11 4.147 1.666 6.22 3.3 7.163' opacity='.5'/%3E%3Cpath fill='currentColor' d='M14.898 11.224c.533-.143.792-.908.578-1.708s-.821-1.333-1.355-1.19c-.533.143-.792.907-.577 1.708c.214.8.82 1.333 1.354 1.19m-5.796 1.553c.534-.143.792-.908.578-1.708s-.82-1.333-1.354-1.19s-.792.907-.578 1.708s.82 1.333 1.354 1.19m-.917 2.974a.75.75 0 0 1 .91-.545c1.13.283 2.428.287 3.746-.066c1.318-.354 2.44-1.006 3.278-1.816a.75.75 0 1 1 1.043 1.078a8.4 8.4 0 0 1-1.15.928l.159.322a1.5 1.5 0 1 1-2.693 1.322l-.196-.4l-.053.014c-1.555.417-3.112.42-4.499.073a.75.75 0 0 1-.545-.91'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:eye-closed-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M2.919 6.605a1 1 0 0 0-1.838.79l.002.003l.003.007l.01.021l.032.072q.04.09.12.25c.105.21.262.506.47.857c.41.687 1.027 1.6 1.872 2.52l-.797.797a1 1 0 1 0 1.414 1.414l.84-.84c.565.455 1.197.885 1.897 1.256l-.782 1.202a1 1 0 0 0 1.676 1.091l.985-1.514c.677.208 1.402.355 2.177.425V16.5a1 1 0 0 0 1 1V13c-2.748 0-4.819-1.199-6.304-2.59l-.024-.022a12 12 0 0 1-.564-.569a13.4 13.4 0 0 1-1.67-2.237a12 12 0 0 1-.516-.968zm-1.838.79L2 7c-.92.394-.919.395-.919.395' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M15.22 12.398A8.7 8.7 0 0 1 12 13v4.5a1 1 0 0 0 1-1v-1.544c.772-.07 1.497-.217 2.176-.425l.986 1.515a1 1 0 0 0 1.676-1.091l-.782-1.203c.701-.37 1.332-.8 1.897-1.256l.84.84a1 1 0 1 0 1.414-1.414l-.797-.798a15.4 15.4 0 0 0 2.302-3.296a10 10 0 0 0 .19-.395l.011-.026l.004-.008l.002-.005a1 1 0 1 0-1.838-.788l-.005.011a5 5 0 0 1-.146.302a13 13 0 0 1-2.614 3.48c-.841.79-1.87 1.517-3.095 2' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:face-scan-circle-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M10.801 2.57a.71.71 0 0 1-.555.838a8.78 8.78 0 0 0-6.838 6.838a.71.71 0 1 1-1.394-.283a10.2 10.2 0 0 1 7.949-7.949a.71.71 0 0 1 .838.556M2.57 13.199a.71.71 0 0 1 .838.555a8.78 8.78 0 0 0 6.838 6.838a.71.71 0 1 1-.283 1.394a10.2 10.2 0 0 1-7.948-7.949a.71.71 0 0 1 .555-.838M13.199 2.57a.71.71 0 0 1 .838-.556a10.2 10.2 0 0 1 7.949 7.949a.711.711 0 0 1-1.394.283a8.78 8.78 0 0 0-6.838-6.838a.71.71 0 0 1-.555-.838m8.231 10.629a.71.71 0 0 1 .556.838a10.2 10.2 0 0 1-7.949 7.949a.711.711 0 0 1-.283-1.394a8.78 8.78 0 0 0 6.838-6.838a.71.71 0 0 1 .838-.555' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M12 19.583a7.583 7.583 0 1 0 0-15.166a7.583 7.583 0 0 0 0 15.166' opacity='.5'/%3E%3Cpath fill='currentColor' d='M8.94 14.539a.71.71 0 0 1 .995-.148c.59.437 1.3.69 2.065.69a3.45 3.45 0 0 0 2.065-.69a.71.71 0 1 1 .847 1.142a4.87 4.87 0 0 1-2.912.97a4.87 4.87 0 0 1-2.911-.97a.71.71 0 0 1-.148-.994m5.547-2.895c.458 0 .83-.557.83-1.244s-.372-1.244-.83-1.244s-.83.557-.83 1.244s.372 1.244.83 1.244m-4.976 0c.458 0 .83-.557.83-1.244s-.372-1.244-.83-1.244s-.83.557-.83 1.244s.372 1.244.83 1.244'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:filters-bold-duotone,[i-solar\:filters-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M18 8A6 6 0 1 1 6 8a6 6 0 0 1 12 0'/%3E%3Cpath fill='currentColor' d='M13.58 13.79a6 6 0 0 1-7.16-3.58a6 6 0 1 0 7.16 3.58' opacity='.7'/%3E%3Cpath fill='currentColor' d='M13.58 13.79c.271.684.42 1.43.42 2.21a6 6 0 0 1-2 4.472a6 6 0 1 0 5.58-10.262a6.01 6.01 0 0 1-4 3.58' opacity='.4'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:ghost-bold-duotone,[i-solar\:ghost-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M22 19.206V12c0-5.523-4.477-10-10-10S2 6.477 2 12v7.206a1.727 1.727 0 0 0 2.5 1.544a2.89 2.89 0 0 1 2.896.18a2.89 2.89 0 0 0 3.208 0l.353-.234a1.88 1.88 0 0 1 2.086 0l.353.235a2.89 2.89 0 0 0 3.208 0a2.89 2.89 0 0 1 2.897-.18A1.727 1.727 0 0 0 22 19.206' opacity='.5'/%3E%3Cpath fill='currentColor' d='M15 12c.552 0 1-.672 1-1.5S15.552 9 15 9s-1 .672-1 1.5s.448 1.5 1 1.5m-5-1.5c0 .828-.448 1.5-1 1.5s-1-.672-1-1.5S8.448 9 9 9s1 .672 1 1.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:info-circle-line-duotone,[i-solar\:info-circle-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none'%3E%3Ccircle cx='12' cy='12' r='10' stroke='currentColor' stroke-width='1.5' opacity='.5'/%3E%3Cpath stroke='currentColor' stroke-linecap='round' stroke-width='1.5' d='M12 17v-6'/%3E%3Ccircle cx='1' cy='1' r='1' fill='currentColor' transform='matrix(1 0 0 -1 11 9)'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:layers-bold-duotone,[i-solar\:layers-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M4.979 9.685C2.993 8.891 2 8.494 2 8s.993-.89 2.979-1.685l2.808-1.123C9.773 4.397 10.767 4 12 4s2.227.397 4.213 1.192l2.808 1.123C21.007 7.109 22 7.506 22 8s-.993.89-2.979 1.685l-2.808 1.124C14.227 11.603 13.233 12 12 12s-2.227-.397-4.213-1.191z'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M2 8c0 .494.993.89 2.979 1.685l2.808 1.124C9.773 11.603 10.767 12 12 12s2.227-.397 4.213-1.191l2.808-1.124C21.007 8.891 22 8.494 22 8s-.993-.89-2.979-1.685l-2.808-1.123C14.227 4.397 13.233 4 12 4s-2.227.397-4.213 1.192L4.98 6.315C2.993 7.109 2 7.506 2 8' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='m5.766 10l-.787.315C2.993 11.109 2 11.507 2 12s.993.89 2.979 1.685l2.808 1.124C9.773 15.603 10.767 16 12 16s2.227-.397 4.213-1.191l2.808-1.124C21.007 12.891 22 12.493 22 12s-.993-.89-2.979-1.685L18.234 10l-2.021.809C14.227 11.603 13.233 12 12 12s-2.227-.397-4.213-1.191z' opacity='.7'/%3E%3Cpath fill='currentColor' d='m5.766 14l-.787.315C2.993 15.109 2 15.507 2 16s.993.89 2.979 1.685l2.808 1.124C9.773 19.603 10.767 20 12 20s2.227-.397 4.213-1.192l2.808-1.123C21.007 16.891 22 16.494 22 16c0-.493-.993-.89-2.979-1.685L18.234 14l-2.021.809C14.227 15.603 13.233 16 12 16s-2.227-.397-4.213-1.191z' opacity='.4'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:leaf-bold-duotone,[i-solar\:leaf-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12 22c-4.418 0-8-3.646-8-8.143c0-4.462 2.553-9.67 6.537-11.531A3.45 3.45 0 0 1 12 2z' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M13.463 2.326A3.45 3.45 0 0 0 12 2v7l4.432-4.432c-.863-.947-1.86-1.724-2.97-2.242' opacity='.3'/%3E%3Cpath fill='currentColor' d='M12 9v5.5l6.614-6.614c-.572-1.22-1.308-2.357-2.182-3.318z' opacity='.4'/%3E%3Cpath fill='currentColor' d='m12 19.5l7.811-7.811a15 15 0 0 0-1.197-3.803L12 14.5z' opacity='.6'/%3E%3Cpath fill='currentColor' d='M19.811 11.689L12 19.5V22c4.418 0 8-3.646 8-8.143c0-.71-.064-1.438-.189-2.168' opacity='.7'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:magic-stick-2-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M16.714 2.127c-.836-.43-1.922.263-4.095 1.65l-.562.36c-.618.394-.927.591-1.273.648c-.347.056-.692-.034-1.382-.215l-.628-.164C6.345 3.769 5.13 3.45 4.436 4.13s-.412 1.908.157 4.363l.147.635c.161.697.242 1.046.177 1.393c-.066.346-.27.65-.68 1.26l-.372.555c-1.439 2.145-2.158 3.217-1.753 4.067c.406.85 1.668.915 4.192 1.045l.654.033c.717.037 1.076.056 1.382.213c.306.158.524.436.962.994l.398.507c1.539 1.962 2.309 2.943 3.255 2.788c.945-.154 1.441-1.342 2.433-3.717l.257-.614c.282-.675.422-1.012.677-1.261c.255-.25.595-.382 1.274-.647l.618-.24c2.39-.933 3.586-1.4 3.765-2.345s-.777-1.744-2.688-3.342l-.495-.413c-.543-.454-.815-.68-.963-.992s-.158-.672-.175-1.393l-.016-.657c-.062-2.538-.093-3.806-.928-4.236'/%3E%3Cpath fill='currentColor' d='M15.93 16.991c.127-.268.239-.45.392-.6c.172-.167.382-.282.71-.42l4.498 4.499a.75.75 0 0 1-1.06 1.06z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:magic-stick-3-bold-duotone,[i-solar\:magic-stick-3-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M3.845 3.845a2.883 2.883 0 0 0 0 4.077L5.432 9.51c.012-.014.555.503.568.49l4-4c.013-.013-.504-.556-.49-.568L7.922 3.845a2.883 2.883 0 0 0-4.077 0m1.288 11.462a.483.483 0 0 1 .9 0l.157.4a.48.48 0 0 0 .272.273l.398.157a.486.486 0 0 1 0 .903l-.398.158a.48.48 0 0 0-.272.273l-.157.4a.483.483 0 0 1-.9 0l-.157-.4a.48.48 0 0 0-.272-.273l-.398-.158a.486.486 0 0 1 0-.903l.398-.157a.48.48 0 0 0 .272-.274z' opacity='.5'/%3E%3Cpath fill='currentColor' d='M19.967 9.13a.483.483 0 0 1 .9 0l.156.399c.05.125.148.224.273.273l.398.158a.486.486 0 0 1 0 .902l-.398.158a.5.5 0 0 0-.273.273l-.156.4a.483.483 0 0 1-.9 0l-.157-.4a.5.5 0 0 0-.272-.273l-.398-.158a.486.486 0 0 1 0-.902l.398-.158a.5.5 0 0 0 .272-.273z' opacity='.2'/%3E%3Cpath fill='currentColor' d='M16.1 2.307a.483.483 0 0 1 .9 0l.43 1.095a.48.48 0 0 0 .272.274l1.091.432a.486.486 0 0 1 0 .903l-1.09.432a.5.5 0 0 0-.273.273L17 6.81a.483.483 0 0 1-.9 0l-.43-1.095a.5.5 0 0 0-.273-.273l-1.09-.432a.486.486 0 0 1 0-.903l1.09-.432a.5.5 0 0 0 .273-.274z' opacity='.7'/%3E%3Cpath fill='currentColor' d='M10.568 6.49c-.012.014-.555-.503-.568-.49l-4 4c-.013.013.504.556.49.568l9.588 9.587a2.883 2.883 0 1 0 4.078-4.077z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:magnifer-line-duotone,[i-solar\:magnifer-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cdefs%3E%3Cmask id='solarMagniferLineDuotone0'%3E%3Cg fill='none' stroke-width='1.5'%3E%3Ccircle cx='11.5' cy='11.5' r='9.5' stroke='gray'/%3E%3Cpath stroke='%23fff' stroke-linecap='round' d='M18.5 18.5L22 22'/%3E%3C/g%3E%3C/mask%3E%3C/defs%3E%3Cpath fill='currentColor' d='M0 0h24v24H0z' mask='url(%23solarMagniferLineDuotone0)'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:microphone-2-bold-duotone,[i-solar\:microphone-2-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M4 9a.75.75 0 0 1 .75.75v1a7.25 7.25 0 1 0 14.5 0v-1a.75.75 0 0 1 1.5 0v1a8.75 8.75 0 0 1-8 8.718v2.282a.75.75 0 0 1-1.5 0v-2.282a8.75 8.75 0 0 1-8-8.718v-1A.75.75 0 0 1 4 9' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M9.75 7.75A.75.75 0 0 0 9 7H6.298a5.751 5.751 0 0 1 11.404 0H13.5a.75.75 0 0 0 0 1.5h4.25V10H13.5a.75.75 0 0 0 0 1.5h4.201a5.751 5.751 0 0 1-11.403 0H9A.75.75 0 0 0 9 10H6.25V8.5H9a.75.75 0 0 0 .75-.75' opacity='.5'/%3E%3Cpath fill='currentColor' d='M12.75 10.75c0 .414.336.75.75.75h4.201l.049-1.5H13.5a.75.75 0 0 0-.75.75m0-3c0 .414.336.75.75.75h4.25L17.701 7H13.5a.75.75 0 0 0-.75.75m-3 0A.75.75 0 0 0 9 7H6.298L6.25 8.5H9a.75.75 0 0 0 .75-.75m0 3A.75.75 0 0 0 9 10H6.25l.048 1.5H9a.75.75 0 0 0 .75-.75'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:microphone-3-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M4 9a.75.75 0 0 1 .75.75v1a7.25 7.25 0 1 0 14.5 0v-1a.75.75 0 0 1 1.5 0v1a8.75 8.75 0 0 1-8 8.718v2.282a.75.75 0 0 1-1.5 0v-2.282a8.75 8.75 0 0 1-8-8.718v-1A.75.75 0 0 1 4 9' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12 2a5.75 5.75 0 0 0-5.75 5.75v3a5.75 5.75 0 0 0 11.5 0v-3A5.75 5.75 0 0 0 12 2m2 9.5a.75.75 0 0 0 0-1.5h-4a.75.75 0 0 0 0 1.5zm-.25-3.75a.75.75 0 0 1-.75.75h-2A.75.75 0 0 1 11 7h2a.75.75 0 0 1 .75.75' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='M14 11.5a.75.75 0 0 0 0-1.5h-4a.75.75 0 0 0 0 1.5zm-1-3A.75.75 0 0 0 13 7h-2a.75.75 0 0 0 0 1.5z'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:minus-circle-line-duotone,[i-solar\:minus-circle-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='10' opacity='.5'/%3E%3Cpath stroke-linecap='round' d='M15 12H9'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:moon-stars-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M19.9 2.307a.483.483 0 0 0-.9 0l-.43 1.095a.48.48 0 0 1-.272.274l-1.091.432a.486.486 0 0 0 0 .903l1.091.432a.48.48 0 0 1 .272.273L19 6.81c.162.41.74.41.9 0l.43-1.095a.48.48 0 0 1 .273-.273l1.091-.432a.486.486 0 0 0 0-.903l-1.091-.432a.48.48 0 0 1-.273-.274zM16.033 8.13a.483.483 0 0 0-.9 0l-.157.399a.48.48 0 0 1-.272.273l-.398.158a.486.486 0 0 0 0 .903l.398.157c.125.05.223.148.272.274l.157.399c.161.41.739.41.9 0l.157-.4a.48.48 0 0 1 .272-.273l.398-.157a.486.486 0 0 0 0-.903l-.398-.158a.48.48 0 0 1-.272-.273z'/%3E%3Cpath fill='currentColor' d='M12 22c5.523 0 10-4.477 10-10c0-.463-.694-.54-.933-.143a6.5 6.5 0 1 1-8.924-8.924C12.54 2.693 12.463 2 12 2C6.477 2 2 6.477 2 12s4.477 10 10 10' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:notes-linear{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='m20.312 12.647l.517-1.932c.604-2.255.907-3.382.68-4.358a4 4 0 0 0-1.162-2.011c-.731-.685-1.859-.987-4.114-1.591c-2.255-.605-3.383-.907-4.358-.68a4 4 0 0 0-2.011 1.162c-.587.626-.893 1.543-1.348 3.209l-.244.905l-.517 1.932c-.605 2.255-.907 3.382-.68 4.358a4 4 0 0 0 1.162 2.011c.731.685 1.859.987 4.114 1.592c2.032.544 3.149.843 4.064.73q.15-.019.294-.052a4 4 0 0 0 2.011-1.16c.685-.732.987-1.86 1.592-4.115Z'/%3E%3Cpath d='M16.415 17.974a4 4 0 0 1-1.068 1.678c-.731.685-1.859.987-4.114 1.591s-3.383.907-4.358.679a4 4 0 0 1-2.011-1.161c-.685-.731-.988-1.859-1.592-4.114l-.517-1.932c-.605-2.255-.907-3.383-.68-4.358a4 4 0 0 1 1.162-2.011c.731-.685 1.859-.987 4.114-1.592q.638-.172 1.165-.309'/%3E%3Cpath stroke-linecap='round' d='m11.777 10l4.83 1.294M11 12.898l2.898.776'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:pallete-2-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M10.847 21.934C5.867 21.362 2 17.133 2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.157-3.283 4.733-6.086 4.37c-1.618-.209-3.075-.397-3.652.518c-.395.626.032 1.406.555 1.929a1.673 1.673 0 0 1 0 2.366c-.523.523-1.235.836-1.97.751' opacity='.5'/%3E%3Cpath fill='currentColor' d='M11.085 7a1.5 1.5 0 1 1-3 0a1.5 1.5 0 0 1 3 0M6.5 13a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m11 0a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3m-3-4.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:pause-circle-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10' opacity='.5'/%3E%3Cpath fill='currentColor' d='M8.076 8.617C8 8.801 8 9.034 8 9.5v5c0 .466 0 .699.076.883a1 1 0 0 0 .541.54c.184.077.417.077.883.077s.699 0 .883-.076a1 1 0 0 0 .54-.541c.077-.184.077-.417.077-.883v-5c0-.466 0-.699-.076-.883a1 1 0 0 0-.541-.54C10.199 8 9.966 8 9.5 8s-.699 0-.883.076a1 1 0 0 0-.54.541m4.999 0C13 8.801 13 9.034 13 9.5v5c0 .466 0 .699.076.883a1 1 0 0 0 .541.54c.184.077.417.077.883.077s.699 0 .883-.076a1 1 0 0 0 .54-.541c.077-.184.077-.417.077-.883v-5c0-.466 0-.699-.076-.883a1 1 0 0 0-.541-.54C15.199 8 14.966 8 14.5 8s-.699 0-.883.076a1 1 0 0 0-.54.541'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:people-nearby-bold-duotone,[i-solar\:people-nearby-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M19.717 20.362C21.143 19.585 22 18.587 22 17.5c0-1.152-.963-2.204-2.546-3C17.623 13.58 14.962 13 12 13s-5.623.58-7.454 1.5C2.963 15.296 2 16.348 2 17.5s.963 2.204 2.546 3C6.377 21.42 9.038 22 12 22c3.107 0 5.882-.637 7.717-1.638' opacity='.6'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M9.25 4a2.75 2.75 0 1 1 5.5 0a2.75 2.75 0 0 1-5.5 0' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='m8.223 11.574l-2.175-.725a1.532 1.532 0 0 1 .805-2.952l1.898.407l.21.044a15 15 0 0 0 6.288-.044l1.897-.407a1.532 1.532 0 0 1 .806 2.952l-2.175.725c-.263.088-.394.132-.493.193a1 1 0 0 0-.466.986c.016.115.066.244.165.503l1.247 3.242a1.473 1.473 0 0 1-2.654 1.26L12 15l-1.576 2.757a1.473 1.473 0 0 1-2.654-1.26l1.247-3.241c.1-.259.149-.388.165-.503a1 1 0 0 0-.466-.986c-.099-.061-.23-.105-.493-.193'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:play-circle-bold-duotone,[i-solar\:play-circle-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='m15.414 13.059l-4.72 2.787C9.934 16.294 9 15.71 9 14.786V9.214c0-.924.934-1.507 1.694-1.059l4.72 2.787c.781.462.781 1.656 0 2.118'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:play-circle-broken{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M13.888 9.935C14.963 10.812 15.5 11.25 15.5 12s-.537 1.188-1.612 2.065c-.297.242-.591.47-.862.66c-.237.167-.506.339-.784.508c-1.073.652-1.609.978-2.09.617c-.48-.36-.524-1.116-.612-2.628c-.024-.427-.04-.846-.04-1.222s.016-.795.04-1.222c.088-1.512.132-2.267.612-2.628c.481-.361 1.018-.035 2.09.617c.278.169.547.341.784.508c.27.19.565.418.862.66Z'/%3E%3Cpath stroke-linecap='round' d='M7 3.338A9.95 9.95 0 0 1 12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12c0-1.821.487-3.53 1.338-5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:refresh-bold-duotone,[i-solar\:refresh-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M12.079 2.25c-4.794 0-8.734 3.663-9.118 8.333H2a.75.75 0 0 0-.528 1.283l1.68 1.666a.75.75 0 0 0 1.056 0l1.68-1.666a.75.75 0 0 0-.528-1.283h-.893c.38-3.831 3.638-6.833 7.612-6.833a7.66 7.66 0 0 1 6.537 3.643a.75.75 0 1 0 1.277-.786A9.16 9.16 0 0 0 12.08 2.25'/%3E%3Cpath fill='currentColor' d='M20.841 10.467a.75.75 0 0 0-1.054 0L18.1 12.133a.75.75 0 0 0 .527 1.284h.899c-.381 3.83-3.651 6.833-7.644 6.833a7.7 7.7 0 0 1-6.565-3.644a.75.75 0 1 0-1.276.788a9.2 9.2 0 0 0 7.84 4.356c4.809 0 8.766-3.66 9.151-8.333H22a.75.75 0 0 0 .527-1.284z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:running-2-line-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none'%3E%3Ccircle cx='18.5' cy='4.5' r='2.5' stroke='currentColor' stroke-width='1.5' opacity='.5'/%3E%3Cpath stroke='currentColor' stroke-linecap='round' stroke-width='1.5' d='m9 17l-1 1.2c-.738.886-1.107 1.328-1.61 1.564S5.31 20 4.157 20H3'/%3E%3Cpath fill='currentColor' d='M13.65 22a.75.75 0 0 0 1.5 0zm-1.085-5.754l.453-.598zm1.184 1.015l.587-.466zm.557 1.12l.727-.186zm-.802-6.826a.75.75 0 0 0-1.009-1.11zm-2.652 1.61l.703.26zm.07 1.555l-.677.323zm2.728 5.219v2.06h1.5v-2.06zm-1.538-3.095c.663.502.887.679 1.05.884l1.174-.934c-.308-.387-.717-.69-1.319-1.146zm3.038 3.095c0-.755.006-1.264-.117-1.744l-1.453.373c.065.254.07.538.07 1.37zm-1.988-2.211c.197.247.339.534.417.84l1.454-.373a3.75 3.75 0 0 0-.697-1.4zm-.667-7.283c-.42.381-.945.836-1.354 1.224c-.21.198-.41.398-.573.586c-.149.172-.327.4-.42.649l1.407.521c-.007.021.014-.035.146-.187c.116-.134.276-.295.471-.48c.4-.38.865-.778 1.332-1.203zm.523 5.203c-.488-.37-.818-.62-1.056-.832c-.233-.208-.32-.33-.363-.418l-1.354.645c.167.35.423.63.72.894c.292.26.679.552 1.147.907zm-2.87-2.744a2.75 2.75 0 0 0 .097 2.139l1.354-.645a1.25 1.25 0 0 1-.044-.973z' opacity='.5'/%3E%3Cpath fill='currentColor' d='m5.436 8.82l-.37-.652zm-1.807.164a.75.75 0 1 0 .742 1.304zm9.778-1.627l-.286.693zm-2.96-.715l-.055-.748zM21 12.75a.75.75 0 1 0 0-1.5zm-5.232-3.213l-.67.335zM5.065 8.168l-1.436.816l.742 1.304l1.435-.816zm8.627-1.505c-1.344-.553-2.08-.857-3.3-.769l.11 1.496c.823-.06 1.255.099 2.62.66zm-7.886 2.81c2.502-1.422 3.552-2 4.695-2.083l-.109-1.496c-1.56.114-2.949.923-5.327 2.274zm13.949 3.276H21v-1.5h-1.245zm-4.658-2.878a5.21 5.21 0 0 0 4.658 2.878v-1.5A3.71 3.71 0 0 1 16.439 9.2zm1.342-.67a5.33 5.33 0 0 0-2.747-2.538l-.57 1.387c.86.354 1.564 1 1.975 1.821z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:settings-bold-duotone,[i-solar\:settings-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M14.279 2.152C13.909 2 13.439 2 12.5 2s-1.408 0-1.779.152a2 2 0 0 0-1.09 1.083c-.094.223-.13.484-.145.863a1.62 1.62 0 0 1-.796 1.353a1.64 1.64 0 0 1-1.579.008c-.338-.178-.583-.276-.825-.308a2.03 2.03 0 0 0-1.49.396c-.318.242-.553.646-1.022 1.453c-.47.807-.704 1.21-.757 1.605c-.07.526.074 1.058.4 1.479c.148.192.357.353.68.555c.477.297.783.803.783 1.361s-.306 1.064-.782 1.36c-.324.203-.533.364-.682.556a2 2 0 0 0-.399 1.479c.053.394.287.798.757 1.605s.704 1.21 1.022 1.453c.424.323.96.465 1.49.396c.242-.032.487-.13.825-.308a1.64 1.64 0 0 1 1.58.008c.486.28.774.795.795 1.353c.015.38.051.64.145.863c.204.49.596.88 1.09 1.083c.37.152.84.152 1.779.152s1.409 0 1.779-.152a2 2 0 0 0 1.09-1.083c.094-.223.13-.483.145-.863c.02-.558.309-1.074.796-1.353a1.64 1.64 0 0 1 1.579-.008c.338.178.583.276.825.308c.53.07 1.066-.073 1.49-.396c.318-.242.553-.646 1.022-1.453c.47-.807.704-1.21.757-1.605a2 2 0 0 0-.4-1.479c-.148-.192-.357-.353-.68-.555c-.477-.297-.783-.803-.783-1.361s.306-1.064.782-1.36c.324-.203.533-.364.682-.556a2 2 0 0 0 .399-1.479c-.053-.394-.287-.798-.757-1.605s-.704-1.21-1.022-1.453a2.03 2.03 0 0 0-1.49-.396c-.242.032-.487.13-.825.308a1.64 1.64 0 0 1-1.58-.008a1.62 1.62 0 0 1-.795-1.353c-.015-.38-.051-.64-.145-.863a2 2 0 0 0-1.09-1.083' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='M15.523 12c0 1.657-1.354 3-3.023 3s-3.023-1.343-3.023-3S10.83 9 12.5 9s3.023 1.343 3.023 3'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:settings-minimalistic-bold-duotone,[i-solar\:settings-minimalistic-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M12.428 2c-1.114 0-2.129.6-4.157 1.802l-.686.406C5.555 5.41 4.542 6.011 3.985 7c-.557.99-.557 2.19-.557 4.594v.812c0 2.403 0 3.605.557 4.594s1.57 1.59 3.6 2.791l.686.407C10.299 21.399 11.314 22 12.428 22s2.128-.6 4.157-1.802l.686-.407c2.028-1.2 3.043-1.802 3.6-2.791c.557-.99.557-2.19.557-4.594v-.812c0-2.403 0-3.605-.557-4.594s-1.572-1.59-3.6-2.792l-.686-.406C14.555 2.601 13.542 2 12.428 2' clip-rule='evenodd' opacity='.5'/%3E%3Cpath fill='currentColor' d='M12.428 8.25a3.75 3.75 0 1 0 0 7.5a3.75 3.75 0 0 0 0-7.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:star-fall-2-bold-duotone,[i-solar\:star-fall-2-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M11.58 4.776c.695-1.77 1.043-2.656 1.769-2.765c.726-.11 1.35.63 2.6 2.109l.323.382c.355.42.532.63.774.75c.24.12.518.137 1.074.17l.506.029c1.955.114 2.932.172 3.271.81c.34.64-.184 1.438-1.231 3.033l-.271.413c-.298.453-.447.68-.487.939s.033.52.179 1.043l.133.477c.513 1.842.77 2.762.253 3.266c-.517.505-1.465.258-3.361-.235l-.49-.127c-.54-.14-.809-.21-1.075-.17s-.499.185-.964.476l-.424.265c-1.638 1.024-2.456 1.536-3.115 1.208c-.659-.327-.72-1.277-.845-3.177l-.033-.492c-.035-.54-.053-.81-.177-1.044s-.34-.406-.774-.75l-.395-.312C7.294 9.865 6.53 9.26 6.64 8.554s1.02-1.047 2.839-1.729l.47-.176c.518-.194.776-.29.965-.475c.19-.185.288-.437.486-.94z'/%3E%3Cpath fill='currentColor' d='M5.31 9.593C2.873 11.92 1.275 15.806 2.331 22c.943-2.603 3.526-4.76 6.581-6.047c-.106-.593-.154-1.317-.204-2.08l-.039-.595a22 22 0 0 0-.032-.43l-.086-.071l-.268-.215l-.475-.376c-.694-.55-1.34-1.06-1.783-1.532c-.253-.269-.536-.624-.715-1.061m5.037 5.83l-.015-.114l.056.101z' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:stop-circle-bold-duotone,[i-solar\:stop-circle-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12S6.477 2 12 2s10 4.477 10 10' opacity='.5'/%3E%3Cpath fill='currentColor' d='M8.586 8.586C8 9.172 8 10.114 8 12s0 2.828.586 3.414S10.114 16 12 16s2.828 0 3.414-.586S16 13.886 16 12s0-2.828-.586-3.414S13.886 8 12 8s-2.828 0-3.414.586'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:sun-fog-bold-duotone{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M7.25 22a.75.75 0 0 1 .75-.75h8a.75.75 0 0 1 0 1.5H8a.75.75 0 0 1-.75-.75M12 1.25a.75.75 0 0 1 .75.75v1a.75.75 0 0 1-1.5 0V2a.75.75 0 0 1 .75-.75M1.25 12a.75.75 0 0 1 .75-.75h1a.75.75 0 0 1 0 1.5H2a.75.75 0 0 1-.75-.75m19 0a.75.75 0 0 1 .75-.75h1a.75.75 0 0 1 0 1.5h-1a.75.75 0 0 1-.75-.75M6.083 15.25H2a.75.75 0 0 0 0 1.5h20a.75.75 0 0 0 0-1.5z' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' d='M4.25 19a.75.75 0 0 1 .75-.75h14a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75m.148-14.602a.75.75 0 0 1 1.061 0l.393.393a.75.75 0 0 1-1.06 1.06l-.394-.392a.75.75 0 0 1 0-1.06m15.202 0a.75.75 0 0 1 0 1.06l-.392.393a.75.75 0 0 1-1.06-1.06l.392-.393a.75.75 0 0 1 1.06 0M5.25 12c0 1.178.302 2.286.833 3.25h11.834A6.75 6.75 0 1 0 5.25 12' opacity='.5'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:trash-bin-trash-linear,[i-solar\:trash-bin-trash-linear=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' d='M20.5 6h-17m15.333 2.5l-.46 6.9c-.177 2.654-.265 3.981-1.13 4.79s-2.196.81-4.856.81h-.774c-2.66 0-3.991 0-4.856-.81c-.865-.809-.954-2.136-1.13-4.79l-.46-6.9M9.5 11l.5 5m4.5-5l-.5 5'/%3E%3Cpath d='M6.5 6h.11a2 2 0 0 0 1.83-1.32l.034-.103l.097-.291c.083-.249.125-.373.18-.479a1.5 1.5 0 0 1 1.094-.788C9.962 3 10.093 3 10.355 3h3.29c.262 0 .393 0 .51.019a1.5 1.5 0 0 1 1.094.788c.055.106.097.23.18.479l.097.291A2 2 0 0 0 17.5 6'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:tuning-square-linear{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2s7.071 0 8.535 1.464C22 4.93 22 7.286 22 12s0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Z'/%3E%3Ccircle cx='8' cy='10' r='2'/%3E%3Ccircle cx='2' cy='2' r='2' transform='matrix(1 0 0 -1 14 16)'/%3E%3Cpath stroke-linecap='round' d='M8 14v5m8-9V5M8 5v1m8 13v-1'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:upload-minimalistic-bold,[i-solar\:upload-minimalistic-bold=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M12.554 2.494a.75.75 0 0 0-1.107 0l-4 4.375A.75.75 0 0 0 8.553 7.88l2.696-2.95V16a.75.75 0 0 0 1.5 0V4.932l2.697 2.95a.75.75 0 1 0 1.107-1.013z'/%3E%3Cpath fill='currentColor' d='M3.75 15a.75.75 0 0 0-1.5 0v.055c0 1.367 0 2.47.117 3.337c.12.9.38 1.658.981 2.26c.602.602 1.36.86 2.26.982c.867.116 1.97.116 3.337.116h6.11c1.367 0 2.47 0 3.337-.116c.9-.122 1.658-.38 2.26-.982s.86-1.36.982-2.26c.116-.867.116-1.97.116-3.337V15a.75.75 0 0 0-1.5 0c0 1.435-.002 2.436-.103 3.192c-.099.734-.28 1.122-.556 1.399c-.277.277-.665.457-1.4.556c-.755.101-1.756.103-3.191.103H9c-1.435 0-2.437-.002-3.192-.103c-.734-.099-1.122-.28-1.399-.556c-.277-.277-.457-.665-.556-1.4c-.101-.755-.103-1.756-.103-3.191'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:upload-square-line-duotone,[i-solar\:upload-square-line-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 17v-7m0 0l3 3m-3-3l-3 3'/%3E%3Cpath stroke-linecap='round' d='M16 7H8'/%3E%3Cpath d='M2 12c0-4.714 0-7.071 1.464-8.536C4.93 2 7.286 2 12 2s7.071 0 8.535 1.464C22 4.93 22 7.286 22 12s0 7.071-1.465 8.535C19.072 22 16.714 22 12 22s-7.071 0-8.536-1.465C2 19.072 2 16.714 2 12Z' opacity='.5'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:user-rounded-linear{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Ccircle cx='12' cy='6' r='4'/%3E%3Cellipse cx='12' cy='17' rx='7' ry='4'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-solar\:user-speak-rounded-bold-duotone,[i-solar\:user-speak-rounded-bold-duotone=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Ccircle cx='10' cy='6.75' r='4' fill='currentColor'/%3E%3Cellipse cx='10' cy='17.75' fill='currentColor' opacity='.5' rx='7' ry='4'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M18.357 2.364a.75.75 0 0 1 1.029-.257L19 2.75l.386-.643h.001l.002.002l.004.002l.01.006l.113.076c.07.049.166.12.277.212c.222.185.512.462.802.838c.582.758 1.155 1.914 1.155 3.507s-.573 2.75-1.155 3.507c-.29.376-.58.653-.802.838a4 4 0 0 1-.363.27l-.028.018l-.01.006l-.003.002l-.002.001s-.001.001-.387-.642l.386.643a.75.75 0 0 1-.776-1.283l.005-.004l.041-.027q.06-.042.177-.136c.152-.128.362-.326.573-.6c.417-.542.844-1.386.844-2.593s-.427-2.05-.844-2.593a3.8 3.8 0 0 0-.573-.6a3 3 0 0 0-.218-.163l-.005-.003a.75.75 0 0 1-.253-1.027' clip-rule='evenodd'/%3E%3Cpath fill='currentColor' fill-rule='evenodd' d='M16.33 4.415a.75.75 0 0 1 1.006-.336L17 4.75l.336-.67h.001l.002.001l.004.002l.008.004l.022.012a2 2 0 0 1 .233.153c.136.102.31.254.48.467c.349.436.664 1.099.664 2.031s-.316 1.595-.664 2.031a2.7 2.7 0 0 1-.654.586l-.06.034l-.02.012l-.01.004l-.003.002l-.002.001l-.33-.657l.329.658a.75.75 0 0 1-.685-1.335l.003-.001l.052-.036c.052-.04.13-.106.209-.205c.15-.189.335-.526.335-1.094s-.184-.905-.335-1.094a1.2 1.2 0 0 0-.261-.24l-.003-.002a.75.75 0 0 1-.322-1' clip-rule='evenodd'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-svg-spinners\:bouncing-ball,[i-svg-spinners\:bouncing-ball=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cellipse cx='12' cy='5' fill='currentColor' rx='4' ry='4'%3E%3Canimate id='svgSpinnersBouncingBall0' fill='freeze' attributeName='cy' begin='0;svgSpinnersBouncingBall2.end' calcMode='spline' dur='0.375s' keySplines='.33,0,.66,.33' values='5;20'/%3E%3Canimate attributeName='rx' begin='svgSpinnersBouncingBall0.end' calcMode='spline' dur='0.05s' keySplines='.33,0,.66,.33;.33,.66,.66,1' values='4;4.8;4'/%3E%3Canimate attributeName='ry' begin='svgSpinnersBouncingBall0.end' calcMode='spline' dur='0.05s' keySplines='.33,0,.66,.33;.33,.66,.66,1' values='4;3;4'/%3E%3Canimate id='svgSpinnersBouncingBall1' attributeName='cy' begin='svgSpinnersBouncingBall0.end' calcMode='spline' dur='0.025s' keySplines='.33,0,.66,.33' values='20;20.5'/%3E%3Canimate id='svgSpinnersBouncingBall2' attributeName='cy' begin='svgSpinnersBouncingBall1.end' calcMode='spline' dur='0.4s' keySplines='.33,.66,.66,1' values='20.5;5'/%3E%3C/ellipse%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1.2em;height:1.2em}.i-vscode-icons\:file-type-minecraft{background:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 32 32' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='%2352a535' d='M30 2H2v28h28z'/%3E%3Cpath fill='%2386d562' d='M24.4 13.2h-5.6v.47h5.6zm-5.6 8.4h-5.6v.47h5.6zm2.8 2.8h-2.8v.47h2.8zm-8.4 0h-2.8v.47h2.8zm0-11.2H7.6v.47h5.6z'/%3E%3Cpath d='M24.4 13.2V7.6h-5.6v5.6h-5.6V16h-2.8v8.4h2.8v-2.8h5.6v2.8h2.8V16h-2.8v-2.8zM13.2 7.6H7.6v5.6h5.6z'/%3E%3Cpath fill='%232a641c' d='M24.4 7.6h-5.6v.47h5.6zm-5.6 5.6h-5.6v.47h5.6zm-5.6-5.6H7.6v.47h5.6zm0 8.4h-2.8v.47h2.8zm8.4 0h-2.8v.47h2.8z'/%3E%3C/svg%3E") no-repeat;background-size:100% 100%;background-color:transparent;width:1.2em;height:1.2em}.prose :where(h1,h2,h3,h4,h5,h6):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-headings);font-weight:600;line-height:1.25}.prose :where(a):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-links);text-decoration:underline;font-weight:500}.prose :where(a code):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-links)}.prose :where(p,ul,ol,pre):not(:where(.not-prose,.not-prose *)){margin:1em 0;line-height:1.75}.prose :where(blockquote):not(:where(.not-prose,.not-prose *)){margin:1em 0;padding-left:1em;font-style:italic;border-left:.25em solid var(--un-prose-borders)}.prose :where(h1):not(:where(.not-prose,.not-prose *)){margin:1rem 0;font-size:2.25em}.prose :where(h2):not(:where(.not-prose,.not-prose *)){margin:1.75em 0 .5em;font-size:1.75em}.prose :where(h3):not(:where(.not-prose,.not-prose *)){margin:1.5em 0 .5em;font-size:1.375em}.prose :where(h4):not(:where(.not-prose,.not-prose *)){margin:1em 0;font-size:1.125em}.prose :where(img,video):not(:where(.not-prose,.not-prose *)){max-width:100%}.prose :where(figure,picture):not(:where(.not-prose,.not-prose *)){margin:1em 0}.prose :where(figcaption):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-captions);font-size:.875em}.prose :where(code):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-code);font-size:.875em;font-weight:600;font-family:DM Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.prose :where(:not(pre)>code):not(:where(.not-prose,.not-prose *)):before,.prose :where(:not(pre)>code):not(:where(.not-prose,.not-prose *)):after{content:"`"}.prose :where(pre):not(:where(.not-prose,.not-prose *)){padding:1.25rem 1.5rem;overflow-x:auto;border-radius:.375rem}.prose :where(pre,code):not(:where(.not-prose,.not-prose *)){white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;hyphens:none;background:transparent}.prose :where(pre code):not(:where(.not-prose,.not-prose *)){font-weight:inherit}.prose :where(ol,ul):not(:where(.not-prose,.not-prose *)){padding-left:1.25em}.prose :where(ol):not(:where(.not-prose,.not-prose *)){list-style-type:decimal}.prose :where(ol[type=A]):not(:where(.not-prose,.not-prose *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where(.not-prose,.not-prose *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where(.not-prose,.not-prose *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where(.not-prose,.not-prose *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where(.not-prose,.not-prose *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where(.not-prose,.not-prose *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where(.not-prose,.not-prose *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where(.not-prose,.not-prose *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where(.not-prose,.not-prose *)){list-style-type:decimal}.prose :where(ul):not(:where(.not-prose,.not-prose *)){list-style-type:disc}.prose :where(ol>li):not(:where(.not-prose,.not-prose *))::marker,.prose :where(ul>li):not(:where(.not-prose,.not-prose *))::marker,.prose :where(summary):not(:where(.not-prose,.not-prose *))::marker{color:var(--un-prose-lists)}.prose :where(hr):not(:where(.not-prose,.not-prose *)){margin:2em 0;border:1px solid var(--un-prose-hr)}.prose :where(table):not(:where(.not-prose,.not-prose *)){display:block;margin:1em 0;border-collapse:collapse;overflow-x:auto}.prose :where(tr):not(:where(.not-prose,.not-prose *)):nth-child(2n){background:var(--un-prose-bg-soft)}.prose :where(td,th):not(:where(.not-prose,.not-prose *)){border:1px solid var(--un-prose-borders);padding:.625em 1em}.prose :where(abbr):not(:where(.not-prose,.not-prose *)){cursor:help}.prose :where(kbd):not(:where(.not-prose,.not-prose *)){color:var(--un-prose-code);border:1px solid;padding:.25rem .5rem;font-size:.875em;border-radius:.25rem}.prose :where(details):not(:where(.not-prose,.not-prose *)){margin:1em 0;padding:1.25rem 1.5rem;background:var(--un-prose-bg-soft)}.prose :where(summary):not(:where(.not-prose,.not-prose *)){cursor:pointer;font-weight:600}.prose{color:var(--un-prose-body);max-width:65ch}.container,[container=""]{width:100%}@media (min-width: 640px){.container,[container=""]{max-width:640px}}@media (min-width: 768px){.container,[container=""]{max-width:768px}}@media (min-width: 1024px){.container,[container=""]{max-width:1024px}}@media (min-width: 1280px){.container,[container=""]{max-width:1280px}}@media (min-width: 1536px){.container,[container=""]{max-width:1536px}}.\[input\:checked\~\&\]{input:checked~&}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none,[pointer-events-none=""]{pointer-events:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.\!visible{visibility:visible!important}.visible{visibility:visible}.absolute,[absolute=""]{position:absolute}.fixed,[fixed=""]{position:fixed}.relative,[relative=""]{position:relative}.sticky,[sticky=""]{position:sticky}[before~=absolute]:before{position:absolute}.after\:absolute:after{position:absolute}[after~=absolute]:after{position:absolute}.inset-0,[inset-0=""]{top:0;right:0;bottom:0;left:0}[before~=inset-0]:before{top:0;right:0;bottom:0;left:0}[after~=inset-0]:after{top:0;right:0;bottom:0;left:0}.inset-x-0,[inset-x-0=""]{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0,[bottom-0=""]{bottom:0}.bottom-11,[bottom-11=""]{bottom:2.75rem}.bottom-2{bottom:.5rem}.left-0,[left-0=""]{left:0}.left-1\/2,[left~="1/2"]{left:50%}.left-2{left:.5rem}.right--10,[right--10=""]{right:-2.5rem}.right--15,[right--15=""]{right:-3.75rem}.right--5,[right--5=""]{right:-1.25rem}.right-0,[right-0=""],[right~="0"]{right:0}.right-2{right:.5rem}.top--20,[top--20=""]{top:-5rem}.top-0,[top-0=""],[top~="0"]{top:0}.top-1\/2,[top~="50%"]{top:50%}.top-2{top:.5rem}[bottom~="[calc(100%+8px)]"]{bottom:calc(100% + 8px)}[bottom~="20%"]{bottom:20%}[bottom~="3"]{bottom:.75rem}[right~="3"]{right:.75rem}[top~="[65dvh]"]{top:65dvh}[top~="[calc(100dvh-12rem)]"]{top:calc(100dvh - 12rem)}[top~="[calc(100dvh-15rem)]"]{top:calc(100dvh - 15rem)}[top~="[calc(100dvh-20rem)]"]{top:calc(100dvh - 20rem)}.after\:left-\[2px\]:after{left:2px}.after\:top-\[2px\]:after{top:2px}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2}.line-clamp-3,[line-clamp-3=""]{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3}.z--1,[z--1=""]{z-index:-1}.z--2{z-index:-2}.z-0{z-index:0}.z-1,[z-1=""]{z-index:1}.z-10,[z-10=""]{z-index:10}.z-100,[z-100=""]{z-index:100}.z-2,[z-2=""]{z-index:2}.z-3,[z-3=""]{z-index:3}.z-30,[z-30=""]{z-index:30}.z-4,[z-4=""]{z-index:4}.z-50{z-index:50}.z-99,[z-99=""]{z-index:99}[z~="20"]{z-index:20}[before~=z-0]:before{z-index:0}[after~=z--2]:after{z-index:-2}.grid,[grid=""],[grid~="~"]{display:grid}.col-span-full{grid-column:1/-1}.auto-cols-\[350px\]{grid-auto-columns:350px}.auto-cols-auto{grid-auto-columns:auto}.grid-auto-rows-\[minmax\(min-content\,max-content\)\]{grid-auto-rows:minmax(min-content,max-content)}.grid-auto-flow-dense{grid-auto-flow:dense}.grid-flow-col{grid-auto-flow:column}.grid-flow-row{grid-auto-flow:row}.cols-\[20px_1fr_60px\],[grid~="cols-[20px_1fr_60px]"]{grid-template-columns:20px 1fr 60px}.grid-cols-\[repeat\(auto-fill\,minmax\(280px\,1fr\)\)\]{grid-template-columns:repeat(auto-fill,minmax(280px,1fr))}.cols-1,.grid-cols-1,[grid~=cols-1]{grid-template-columns:repeat(1,minmax(0,1fr))}.cols-2,.grid-cols-2,[grid-cols-2=""],[grid~=cols-2]{grid-template-columns:repeat(2,minmax(0,1fr))}.m-0,[m0=""]{margin:0}.m-1,[m-1=""]{margin:.25rem}.m-auto{margin:auto}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-5,[mx-5=""]{margin-left:1.25rem;margin-right:1.25rem}.mx-auto,[mx-auto=""]{margin-left:auto;margin-right:auto}.mx2,[mx2=""]{margin-left:.5rem;margin-right:.5rem}.my{margin-top:1rem;margin-bottom:1rem}.my-0,[my-0=""]{margin-top:0;margin-bottom:0}.my-auto,[my-auto=""]{margin-top:auto;margin-bottom:auto}.-mb-px{margin-bottom:-1px}.mb-1,[mb-1=""]{margin-bottom:.25rem}.mb-2,.mb2,[mb-2=""],[mb2=""]{margin-bottom:.5rem}.mb-3,[mb-3=""]{margin-bottom:.75rem}.mb-4,[mb-4=""]{margin-bottom:1rem}.mb-6,[mb-6=""]{margin-bottom:1.5rem}.ml{margin-left:1rem}.ml-0\.5,[ml-0\.5=""]{margin-left:.125rem}.ml-auto{margin-left:auto}.mr{margin-right:1rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.ms,[ms=""]{margin-inline-start:1rem}.mt-0\.5{margin-top:.125rem}.mt-1,[mt-1=""]{margin-top:.25rem}.mt-2,[mt-2=""]{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4,[mt-4=""]{margin-top:1rem}.mt-auto{margin-top:auto}[ml~="12"]{margin-left:3rem}[mr~="12"]{margin-right:3rem}[box~=border]{box-sizing:border-box}.inline,[inline=""]{display:inline}.block,[block=""]{display:block}.inline-block,[inline-block=""]{display:inline-block}.contents{display:contents}.hidden,[hidden=""]{display:none}.size-16,[size-16=""]{width:4rem;height:4rem}.size-20,[size-20=""]{width:5rem;height:5rem}.size-24,[size-24=""],[size~="24"]{width:6rem;height:6rem}.size-3,[size-3=""]{width:.75rem;height:.75rem}.size-5{width:1.25rem;height:1.25rem}.size-6,[size-6=""],[size~="6"]{width:1.5rem;height:1.5rem}.size-60,[size-60=""]{width:15rem;height:15rem}.h-0\.5,[h-0\.5=""]{height:.125rem}.h-10{height:2.5rem}.h-100dvh,[h-100dvh=""],[h~="100dvh"]{height:100dvh}.h-12{height:3rem}.h-16{height:4rem}.h-1lh{height:1lh}.h-2,.h2,[h-2=""]{height:.5rem}.h-24,[h-24=""]{height:6rem}.h-48,[h-48=""]{height:12rem}.h-5,[h-5=""]{height:1.25rem}.h-6{height:1.5rem}.h-60,[h-60=""]{height:15rem}.h-7,[h-7=""]{height:1.75rem}.h-8,[h-8=""]{height:2rem}.h-fit,[h-fit=""]{height:fit-content}.h-full,[h-full=""]{height:100%}.h1{height:.25rem}.h3{height:.75rem}.max-h-\[10lh\],[max-h~="[10lh]"]{max-height:10lh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100dvh-7lh\)\]{max-height:calc(100dvh - 7lh)}.max-h-60,[max-h-60=""]{max-height:15rem}.max-h-none,[max-h-none=""]{max-height:none}.max-w-6xl{max-width:72rem}.max-w-full,[max-w-full=""]{max-width:100%}.max-w-md{max-width:28rem}.min-h-\[120px\],.min-h-120px,[min-h-120px=""]{min-height:120px}.min-h-\[1lh\],[min-h~="[1lh]"]{min-height:1lh}.min-h-16,[min-h-16=""]{min-height:4rem}.min-h-40px,[min-h-40px=""]{min-height:40px}.min-w-\[200px\]{min-width:200px}.min-w-0,[min-w-0=""]{min-width:0}.min-w-20,[min-w-20=""]{min-width:5rem}.min-w-50,[min-w-50=""]{min-width:12.5rem}.w-\[92vw\]{width:92vw}.w-1{width:.25rem}.w-1\/2,[w~="[50%]"],[w~="50%"]{width:50%}.w-100,[w-100=""]{width:25rem}.w-100vw,[w-100vw=""]{width:100vw}.w-11{width:2.75rem}.w-25\%{width:25%}.w-5{width:1.25rem}.w-8,[w-8=""]{width:2rem}.w-fit,[w-fit=""]{width:fit-content}.w-full,[w-full=""],[w~=full]{width:100%}[h~="[14px]"]{height:14px}[h~="300"]{height:75rem}[h~="80vh"]{height:80vh}[h~=auto]{height:auto}[h~=unset]{height:unset}[max-h~="[300px]"]{max-height:300px}[max-h~="[4.5rem]"]{max-height:4.5rem}[max-h~="[85vh]"]{max-height:85vh}[max-h~="100"]{max-height:25rem}[max-h~="30vh"]{max-height:30vh}[max-w~="500px"]{max-width:500px}[min-h~="[100px]"]{min-height:100px}[min-h~="100"]{min-height:25rem}[min-h~="120"]{min-height:30rem}[min-w~="1/2"],[min-w~="50%"]{min-width:50%}[min-w~="30%"]{min-width:30%}[min-w~="3em"]{min-width:3em}[min-w~="50vw"]{min-width:50vw}[min-w~="6"]{min-width:1.5rem}[w~="[1px]"]{width:1px}[w~="100dvw"]{width:100dvw}[w~="12.5"]{width:3.125rem}[w~="70%"]{width:70%}.before\:w-50\%:before{width:50%}[before~=h-full]:before{height:100%}[before~="w-25%"]:before{width:25%}[hover~="before:w-50%"]:hover:before{width:50%}.after\:h-5:after{height:1.25rem}.after\:w-5:after{width:1.25rem}[after~=h-full]:after{height:100%}[after~=w-full]:after{width:100%}.max-w-screen-xl,[max-w-screen-xl=""]{max-width:1280px}.flex,[flex=""],[flex~="~"]{display:flex}.inline-flex,[inline-flex~="~"]{display:inline-flex}.flex-1,[flex-1=""],[flex~="1"]{flex:1 1 0%}.flex-shrink-0,.shrink-0,[shrink-0=""]{flex-shrink:0}.flex-row,[flex-row=""],[flex~=row]{flex-direction:row}[flex~=row-reverse]{flex-direction:row-reverse}.flex-col,[flex-col=""],[flex~=col]{flex-direction:column}.flex-wrap,[flex-wrap=""]{flex-wrap:wrap}[perspective~="800"]{-webkit-perspective:800px;perspective:800px}.-translate-x-1\/2,.translate-x--1\/2,.translate-x-\[-50\%\],[transform~="translate-x--1/2"]{--un-translate-x:-50%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.-translate-y-1\/2,.translate-y-\[-50\%\],[transform~="translate-y-[-50%]"]{--un-translate-y:-50%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-x-\[50\%\],[transform~="translate-x-[50%]"]{--un-translate-x:50%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y--2,[transform~=translate-y--2]{--un-translate-y:-.5rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y-\[-100\%\],[transform~="translate-y-[-100%]"]{--un-translate-y:-100%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y-\[50\%\]{--un-translate-y:50%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y-2,[translate-y-2=""]{--un-translate-y:.5rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.translate-y-4,[translate-y-4=""]{--un-translate-y:1rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}[translate-x~="0.5"]{--un-translate-x:.125rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}[translate-x~="data-[state=checked]:full"][data-state=checked]{--un-translate-x:100%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}[translate-y~="[-80%]"]{--un-translate-y:-80%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.peer:checked~.peer-checked\:after\:translate-x-full:after{--un-translate-x:100%;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.\[\&_\.card-cover_img\]\:hover\:translate-y-2:hover .card-cover img,[hover\:translate-y-2=""]:hover{--un-translate-y:.5rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.rotate-180{--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-rotate:180deg;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.scale-100{--un-scale-x:1;--un-scale-y:1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.scale-150{--un-scale-x:1.5;--un-scale-y:1.5;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.\[\&_\.card-cover_img\]\:hover\:scale-102:hover .card-cover img{--un-scale-x:1.02;--un-scale-y:1.02;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.hover\:scale-110:hover{--un-scale-x:1.1;--un-scale-y:1.1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}[hover~=scale-100]:hover{--un-scale-x:1;--un-scale-y:1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.preserve-3d{transform-style:preserve-3d}.transform,[transform=""]{transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.animate-spin{animation:spin 1s linear infinite}.disabled\:cursor-default:disabled{cursor:default}.cursor-pointer,[cursor-pointer=""],[cursor~=pointer]{cursor:pointer}.cursor-not-allowed{cursor:not-allowed}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}[cursor~="disabled:not-allowed"]:disabled{cursor:not-allowed}.cursor-ew-resize,[cursor-ew-resize=""]{cursor:ew-resize}.select-none,[select-none=""]{-webkit-user-select:none;user-select:none}.resize-none,[resize-none=""]{resize:none}.appearance-none,[appearance-none=""]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.place-self-end{place-self:end}.items-start,[items-start=""]{align-items:flex-start}.items-end,[items-end=""]{align-items:flex-end}.items-center,[flex~=items-center],[items-center=""]{align-items:center}.justify-end,[justify-end=""]{justify-content:flex-end}.justify-center,[flex~=justify-center],[justify-center=""]{justify-content:center}.justify-between,[justify-between=""]{justify-content:space-between}.gap-0\.5,[gap-0\.5=""]{gap:.125rem}.gap-1,[gap-1=""]{gap:.25rem}.gap-1\.5,[gap-1\.5=""]{gap:.375rem}.gap-2,[flex~=gap-2],[gap-2=""]{gap:.5rem}.gap-3,[flex~=gap-3],[gap-3=""]{gap:.75rem}.gap-4,[flex~=gap-4],[gap-4=""],[grid~=gap-4]{gap:1rem}.gap-5{gap:1.25rem}.gap-6,[flex~=gap-6]{gap:1.5rem}.gap-x-2,[flex~=gap-x-2]{column-gap:.5rem}.gap-y-0,[flex~=gap-y-0]{row-gap:0}.space-x-1>:not([hidden])~:not([hidden]),[space-x-1=""]>:not([hidden])~:not([hidden]){--un-space-x-reverse:0;margin-left:calc(.25rem * calc(1 - var(--un-space-x-reverse)));margin-right:calc(.25rem * var(--un-space-x-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--un-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--un-space-y-reverse)));margin-bottom:calc(.5rem * var(--un-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--un-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--un-space-y-reverse)));margin-bottom:calc(1.5rem * var(--un-space-y-reverse))}[divide~=y]>:not([hidden])~:not([hidden]){--un-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--un-divide-y-reverse)));border-bottom-width:calc(1px * var(--un-divide-y-reverse))}[divide~="gray/25"]>:not([hidden])~:not([hidden]){border-color:#9ca3af40}[border~=dashed],[divide~=dashed]>:not([hidden])~:not([hidden]){border-style:dashed}.of-clip,[of-clip=""]{overflow:clip}.of-hidden,.overflow-hidden,[of-hidden=""],[overflow-hidden=""],[overflow~=hidden]{overflow:hidden}.overflow-auto,[overflow-auto=""]{overflow:auto}.overflow-scroll,[overflow-scroll=""]{overflow:scroll}.of-x-scroll,[of-x-scroll=""]{overflow-x:scroll}.overflow-x-auto{overflow-x:auto}.overflow-y-scroll,[overflow-y-scroll=""]{overflow-y:scroll}.scroll-smooth,[scroll-smooth=""]{scroll-behavior:smooth}.truncate,[truncate=""]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-line,[whitespace-pre-line=""]{white-space:pre-line}.break-words{overflow-wrap:break-word}.b,.border,[border~="~"],[border~="1"]{border-width:1px}.b-2,.border-2,[b-2=""],[border~="2"],[border~="2px"]{border-width:2px}[border~="4"]{border-width:4px}.border-b{border-bottom-width:1px}.border-b-2,[border~=b-2]{border-bottom-width:2px}[border~=l-2]{border-left-width:2px}[border~=r-2]{border-right-width:2px}[border~=t-2]{border-top-width:2px}.\[\&\:checked\+div\]\:border-primary-500:checked+div,.border-primary-500{--un-border-opacity:1;border-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.border-amber-200{--un-border-opacity:1;border-color:rgb(253 230 138 / var(--un-border-opacity))}.border-neutral-100,[border~=neutral-100]{--un-border-opacity:1;border-color:rgb(245 245 245 / var(--un-border-opacity))}.border-neutral-200,.dark [border~="dark:neutral-200"],[border~=neutral-200]{--un-border-opacity:1;border-color:rgb(229 229 229 / var(--un-border-opacity))}.border-neutral-300,[border~="data-[state=unchecked]:neutral-300"][data-state=unchecked],[border~=neutral-300]{--un-border-opacity:1;border-color:rgb(212 212 212 / var(--un-border-opacity))}.border-neutral-500{--un-border-opacity:1;border-color:rgb(115 115 115 / var(--un-border-opacity))}.border-primary-100,[border~=primary-100]{border-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 0)) 80%,oklch(100% 0 360))}.border-primary-200,[border~="data-[state=checked]:primary-200"][data-state=checked]{--un-border-opacity:1;border-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.border-primary-400,.dark .dark\:\[\&\:checked\+div\]\:border-primary-400:checked+div,.dark .dark\:border-primary-400{--un-border-opacity:1;border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.border-red-200{--un-border-opacity:1;border-color:rgb(254 202 202 / var(--un-border-opacity))}.border-white{--un-border-opacity:1;border-color:rgb(255 255 255 / var(--un-border-opacity))}.dark .dark\:border-amber-800{--un-border-opacity:1;border-color:rgb(146 64 14 / var(--un-border-opacity))}.dark .dark\:border-neutral-600,.dark [border~="dark:neutral-600"]{--un-border-opacity:1;border-color:rgb(82 82 82 / var(--un-border-opacity))}.dark .dark\:border-neutral-700,.dark [border~="dark:neutral-700"]{--un-border-opacity:1;border-color:rgb(64 64 64 / var(--un-border-opacity))}.dark .dark\:border-neutral-800\/25,.dark [border~="dark:neutral-800/25"]{border-color:#26262640}.dark .dark\:border-neutral-900,.dark [border~="dark:neutral-900"]{--un-border-opacity:1;border-color:rgb(23 23 23 / var(--un-border-opacity))}.dark .dark\:border-primary-600{--un-border-opacity:1;border-color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.dark .dark\:border-primary-800,.dark [border~="dark:primary-800"]{--un-border-opacity:1;border-color:oklch(42% var(--theme-colors-chroma-800) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.dark .dark\:border-primary-900,.dark [border~="dark:primary-900"]{--un-border-opacity:1;border-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.dark .dark\:border-red-800{--un-border-opacity:1;border-color:rgb(153 27 27 / var(--un-border-opacity))}.dark [border~="dark:cyan-500/50"]{border-color:#06b6d480}.dark [border~="dark:neutral-700/30"]{border-color:#4040404d}.dark [border~="dark:neutral-800"],[border~=neutral-800]{--un-border-opacity:1;border-color:rgb(38 38 38 / var(--un-border-opacity))}.dark [border~="dark:primary-400/20"]{border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2)}.dark [border~="dark:primary-500/50"]{border-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .5)}.dark [border~="dark:violet-500/50"]{border-color:#8b5cf680}[border~="cyan-200/50"]{border-color:#a5f3fc80}[border~="gray/25"]{border-color:#9ca3af40}[border~="neutral-200/50"]{border-color:#e5e5e580}[border~="primary-200/50"]{border-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / .5)}[border~=primary-300]{--un-border-opacity:1;border-color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}[border~="violet-200/50"]{border-color:#ddd6fe80}.peer:checked~.peer-checked\:after\:border-white:after{--un-border-opacity:1;border-color:rgb(255 255 255 / var(--un-border-opacity))}[border~="focus-within:neutral-800"]:focus-within{--un-border-opacity:1;border-color:rgb(38 38 38 / var(--un-border-opacity))}.dark .dark\:hover\:border-primary-400\/30:hover{border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .3)}.dark .dark\:hover\:border-primary-700:hover{--un-border-opacity:1;border-color:oklch(49% var(--theme-colors-chroma-700) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.dark [border~="dark:hover:primary-400/30"]:hover{border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .3)}.hover\:border-primary-300:hover{--un-border-opacity:1;border-color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.hover\:border-primary-500\/30:hover,[border~="hover:primary-500/30"]:hover{border-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .3)}.dark [border~="dark:focus:neutral-600"]:focus{--un-border-opacity:1;border-color:rgb(82 82 82 / var(--un-border-opacity))}.dark [border~="dark:focus:neutral-700"]:focus{--un-border-opacity:1;border-color:rgb(64 64 64 / var(--un-border-opacity))}.dark [border~="dark:focus:primary-400/50"]:focus{border-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .5)}[border~="focus:neutral-200"]:focus{--un-border-opacity:1;border-color:rgb(229 229 229 / var(--un-border-opacity))}[border~="focus:neutral-400"]:focus{--un-border-opacity:1;border-color:rgb(163 163 163 / var(--un-border-opacity))}[border~="focus:primary-100"]:focus{border-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 0)) 80%,oklch(100% 0 360))}[border~="focus:primary-300"]:focus{--un-border-opacity:1;border-color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-border-opacity))}.rounded,[rounded=""]{border-radius:.25rem}.rounded-2xl,[rounded-2xl=""]{border-radius:1rem}.rounded-full,[rounded-full=""]{border-radius:9999px}.rounded-lg,[border~=rounded-lg],[rounded-lg=""],[rounded~=lg]{border-radius:.5rem}.rounded-md,[rounded-md=""]{border-radius:.375rem}.rounded-sm,[rounded-sm=""]{border-radius:.125rem}.rounded-xl,[rounded-xl=""]{border-radius:.75rem}.after\:rounded-full:after{border-radius:9999px}.rounded-l-lg,[rounded-l-lg=""]{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.rounded-l-xl,[rounded-l-xl=""]{border-top-left-radius:.75rem;border-bottom-left-radius:.75rem}.rounded-r-lg,[rounded-r-lg=""]{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.rounded-r-xl,[rounded-r-xl=""]{border-top-right-radius:.75rem;border-bottom-right-radius:.75rem}.rounded-t-xl,[rounded-t-xl=""]{border-top-left-radius:.75rem;border-top-right-radius:.75rem}.border-none,[border-none=""]{border-style:none}[border~=solid]{border-style:solid}.bg-amber-50{--un-bg-opacity:1;background-color:rgb(255 251 235 / var(--un-bg-opacity))}.bg-amber-50\/80{background-color:#fffbebcc}.bg-black\/50,[bg~="black/50"]{background-color:#00000080}.bg-neutral-100,[bg-neutral-100=""],[bg~=neutral-100]{--un-bg-opacity:1;background-color:rgb(245 245 245 / var(--un-bg-opacity))}.bg-neutral-200,.dark .dark\:bg-neutral-200,[bg~=neutral-200]{--un-bg-opacity:1;background-color:rgb(229 229 229 / var(--un-bg-opacity))}.bg-neutral-300,.dark [bg~="dark:neutral-300"],[bg-neutral-300=""],[bg~="data-[state=unchecked]:neutral-300"][data-state=unchecked]{--un-bg-opacity:1;background-color:rgb(212 212 212 / var(--un-bg-opacity))}.bg-neutral-400,.dark [bg~="dark:neutral-400"],[bg~=neutral-400]{--un-bg-opacity:1;background-color:rgb(163 163 163 / var(--un-bg-opacity))}.bg-neutral-50,[bg~=neutral-50]{--un-bg-opacity:1;background-color:rgb(250 250 250 / var(--un-bg-opacity))}.bg-neutral-600,.dark .dark\:bg-neutral-600{--un-bg-opacity:1;background-color:rgb(82 82 82 / var(--un-bg-opacity))}.bg-neutral-800,.dark .dark\:bg-neutral-800,.dark [bg~="dark:data-[state=unchecked]:neutral-800"][data-state=unchecked],.dark [bg~="dark:neutral-800"]{--un-bg-opacity:1;background-color:rgb(38 38 38 / var(--un-bg-opacity))}.bg-primary-100,[bg-primary-100=""],[bg~=primary-100]{background-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 0)) 80%,oklch(100% 0 360))}.bg-primary-200,[bg-primary-200=""]{--un-bg-opacity:1;background-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-300,[bg-primary-300=""]{--un-bg-opacity:1;background-color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-400,.dark .dark\:bg-primary-400,.dark [bg~="dark:primary-400"],[bg-primary-400=""],[bg~="data-[state=checked]:primary-400"][data-state=checked],[bg~=primary-400]{--un-bg-opacity:1;background-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-50,.bg-primary-50\/5,[bg-primary-50=""],[bg~=primary-50]{background-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-50) calc(var(--theme-colors-hue) + 0)) 30%,oklch(100% 0 360))}.bg-primary-500,.dark [bg~="dark:primary-500"],[bg-primary-500=""],[bg~=primary-500],.peer:checked~.peer-checked\:bg-primary-500{--un-bg-opacity:1;background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-500\/20,[bg~="primary-500/20"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2)}.bg-primary-600,[bg-primary-600=""]{--un-bg-opacity:1;background-color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-700,[bg-primary-700=""]{--un-bg-opacity:1;background-color:oklch(49% var(--theme-colors-chroma-700) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-800,[bg-primary-800=""]{--un-bg-opacity:1;background-color:oklch(42% var(--theme-colors-chroma-800) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-900,.dark .dark\:bg-primary-900,[bg-primary-900=""]{--un-bg-opacity:1;background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-primary-950,.dark .dark\:bg-primary-950,.dark [bg~="dark:primary-950"],[bg-primary-950=""]{--un-bg-opacity:1;background-color:oklch(29% var(--theme-colors-chroma-950) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.bg-red-50{--un-bg-opacity:1;background-color:rgb(254 242 242 / var(--un-bg-opacity))}.bg-red-500{--un-bg-opacity:1;background-color:rgb(239 68 68 / var(--un-bg-opacity))}.bg-transparent,.dark [bg~="dark:transparent"],[bg-transparent=""],[bg~=transparent]{background-color:transparent}.bg-white,[bg-white=""],[bg~=white]{--un-bg-opacity:1;background-color:rgb(255 255 255 / var(--un-bg-opacity))}.bg-white\/60,[bg~="white/60"]{background-color:#fff9}.bg-white\/80{background-color:#fffc}.dark .dark\:bg-amber-900\/20{background-color:#78350f33}.dark .dark\:bg-amber-900\/30{background-color:#78350f4d}.dark .dark\:bg-black\/30,.dark [bg~="dark:black/30"]{background-color:#0000004d}.dark .dark\:bg-black\/40{background-color:#0006}.dark .dark\:bg-neutral-700,.dark [bg~="dark:neutral-700"],[bg~=neutral-700]{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}.dark .dark\:bg-neutral-700\/50{background-color:#40404080}.dark .dark\:bg-neutral-800\/50,.dark [bg~="dark:neutral-800/50"]{background-color:#26262680}.dark .dark\:bg-neutral-900,.dark [bg~="dark:neutral-900"]{--un-bg-opacity:1;background-color:rgb(23 23 23 / var(--un-bg-opacity))}.dark .dark\:bg-neutral-900\/20{background-color:#17171733}.dark .dark\:bg-primary-900\/20{background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / .2)}.dark .dark\:bg-primary-900\/30{background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / .3)}.dark .dark\:bg-primary-900\/40,.dark [bg~="dark:primary-900/40"]{background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / .4)}.dark .dark\:bg-primary-900\/5{background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / .05)}.dark .dark\:bg-red-400{--un-bg-opacity:1;background-color:rgb(248 113 113 / var(--un-bg-opacity))}.dark .dark\:bg-red-900\/20{background-color:#7f1d1d33}.dark [bg~="dark:[#4e34b9]"]{--un-bg-opacity:1;background-color:rgb(78 52 185 / var(--un-bg-opacity))}.dark [bg~="dark:[#676085]"]{--un-bg-opacity:1;background-color:rgb(103 96 133 / var(--un-bg-opacity))}.dark [bg~="dark:[rgba(0,0,0,0.3)]"]{--un-bg-opacity:.3;background-color:rgba(0,0,0,var(--un-bg-opacity))}.dark [bg~="dark:black/20"],.group:hover [bg~="group-hover:black/20"]{background-color:#0003}.dark [bg~="dark:blue-900"]{--un-bg-opacity:1;background-color:rgb(30 58 138 / var(--un-bg-opacity))}.dark [bg~="dark:complementary-800"]{--un-bg-opacity:1;background-color:oklch(42% var(--theme-colors-chroma-800) calc(var(--theme-colors-hue) + 180) / var(--un-bg-opacity))}.dark [bg~="dark:cyan-900"]{--un-bg-opacity:1;background-color:rgb(22 78 99 / var(--un-bg-opacity))}.dark [bg~="dark:green-600"]{--un-bg-opacity:1;background-color:rgb(22 163 74 / var(--un-bg-opacity))}.dark [bg~="dark:neutral-500"]{--un-bg-opacity:1;background-color:rgb(115 115 115 / var(--un-bg-opacity))}.dark [bg~="dark:neutral-900/50"]{background-color:#17171780}.dark [bg~="dark:neutral-950"]{--un-bg-opacity:1;background-color:rgb(10 10 10 / var(--un-bg-opacity))}.dark [bg~="dark:orange-900/20"]{background-color:#7c2d1233}.dark [bg~="dark:primary-400/20"]{background-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2)}.dark [bg~="data-[state=checked]:dark:primary-400/80"][data-state=checked]{background-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .8)}[bg~="[#cabeff]"]{--un-bg-opacity:1;background-color:rgb(202 190 255 / var(--un-bg-opacity))}[bg~="[#e6e1fc]"]{--un-bg-opacity:1;background-color:rgb(230 225 252 / var(--un-bg-opacity))}[bg~="$bg-color"]{background-color:var(--bg-color)}[bg~="black/0"]{background-color:#0000}[bg~=blue-100]{--un-bg-opacity:1;background-color:rgb(219 234 254 / var(--un-bg-opacity))}[bg~=complementary-100]{background-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 180)) 80%,oklch(100% 0 360))}[bg~=emerald-500]{--un-bg-opacity:1;background-color:rgb(16 185 129 / var(--un-bg-opacity))}[bg~="gray-200/30"]{background-color:#e5e7eb4d}[bg~=green-500]{--un-bg-opacity:1;background-color:rgb(34 197 94 / var(--un-bg-opacity))}[bg~=inherit]{background-color:inherit}[bg~="neutral-100/70"]{background-color:#f5f5f5b3}[bg~="neutral-200/20"]{background-color:#e5e5e533}[bg~="neutral-200/50"]{background-color:#e5e5e580}[bg~="neutral-50/50"]{background-color:#fafafa80}[bg~=orange-50]{--un-bg-opacity:1;background-color:rgb(255 247 237 / var(--un-bg-opacity))}[bg~="primary-500/10"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1)}[bg~="primary-500/30"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .3)}[bg~="primary-500/40"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .4)}[bg~="primary-500/5"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .05)}[bg~="primary-500/50"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .5)}[bg~="primary-500/60"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .6)}[bg~="primary-500/70"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .7)}[bg~="primary-500/80"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .8)}[bg~="primary-500/90"]{background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .9)}.dark [dark\:bg-neutral-700~="default:"]:default{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}.dark [dark\:bg-neutral-700~="checked:"]:checked{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}.dark .\[\&_div_span\]\:dark\:hover\:bg-cyan-300:hover div span{--un-bg-opacity:1;background-color:rgb(103 232 249 / var(--un-bg-opacity))}.dark .\[\&_div_span\]\:dark\:hover\:bg-cyan-900:hover div span{--un-bg-opacity:1;background-color:rgb(22 78 99 / var(--un-bg-opacity))}.dark .dark\:hover\:bg-black\/40:hover{background-color:#0006}.dark .dark\:hover\:bg-neutral-500:hover{--un-bg-opacity:1;background-color:rgb(115 115 115 / var(--un-bg-opacity))}.dark .dark\:hover\:bg-neutral-800:hover{--un-bg-opacity:1;background-color:rgb(38 38 38 / var(--un-bg-opacity))}.dark .dark\:hover\:bg-primary-500:hover{--un-bg-opacity:1;background-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.dark .dark\:hover\:bg-red-500:hover{--un-bg-opacity:1;background-color:rgb(239 68 68 / var(--un-bg-opacity))}.dark [bg~="dark:hover:complementary-700"]:hover{--un-bg-opacity:1;background-color:oklch(49% var(--theme-colors-chroma-700) calc(var(--theme-colors-hue) + 180) / var(--un-bg-opacity))}.dark [bg~="dark:hover:neutral-800"]:hover{--un-bg-opacity:1;background-color:rgb(38 38 38 / var(--un-bg-opacity))}.dark [bg~="dark:hover:primary-900"]:hover{--un-bg-opacity:1;background-color:oklch(37% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.dark [dark\:hover\:bg-cyan-300=""]:hover{--un-bg-opacity:1;background-color:rgb(103 232 249 / var(--un-bg-opacity))}.dark [hover~="dark:bg-black/40"]:hover{background-color:#0006}.dark [hover~="dark:bg-neutral-700"]:hover{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}.dark [hover~="dark:bg-neutral-700/50"]:hover{background-color:#40404080}.hover\:bg-neutral-100:hover{--un-bg-opacity:1;background-color:rgb(245 245 245 / var(--un-bg-opacity))}.hover\:bg-neutral-200:hover{--un-bg-opacity:1;background-color:rgb(229 229 229 / var(--un-bg-opacity))}.hover\:bg-primary-600:hover{--un-bg-opacity:1;background-color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-bg-opacity))}.hover\:bg-red-600:hover{--un-bg-opacity:1;background-color:rgb(220 38 38 / var(--un-bg-opacity))}.hover\:bg-white\/80:hover{background-color:#fffc}[bg~="hover:complementary-200"]:hover{--un-bg-opacity:1;background-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 180) / var(--un-bg-opacity))}[bg~="hover:emerald-600"]:hover{--un-bg-opacity:1;background-color:rgb(5 150 105 / var(--un-bg-opacity))}[bg~="hover:neutral-200"]:hover{--un-bg-opacity:1;background-color:rgb(229 229 229 / var(--un-bg-opacity))}[bg~="hover:primary-100"]:hover{background-color:color-mix(in srgb,oklch(95% var(--theme-colors-chroma-100) calc(var(--theme-colors-hue) + 0)) 80%,oklch(100% 0 360))}[hover~=bg-neutral-200]:hover{--un-bg-opacity:1;background-color:rgb(229 229 229 / var(--un-bg-opacity))}[hover~="bg-white/80"]:hover{background-color:#fffc}.dark [bg~="dark:focus:neutral-900"]:focus{--un-bg-opacity:1;background-color:rgb(23 23 23 / var(--un-bg-opacity))}[bg~="focus:neutral-50"]:focus{--un-bg-opacity:1;background-color:rgb(250 250 250 / var(--un-bg-opacity))}.dark [bg~="dark:active:neutral-700"]:active{--un-bg-opacity:1;background-color:rgb(64 64 64 / var(--un-bg-opacity))}[bg~="active:neutral-300"]:active{--un-bg-opacity:1;background-color:rgb(212 212 212 / var(--un-bg-opacity))}.after\:bg-white:after{--un-bg-opacity:1;background-color:rgb(255 255 255 / var(--un-bg-opacity))}.dark .dark\:from-primary-400\/0{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark .dark\:from-primary-400\/20{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.from-primary-500{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-from-opacity, 1)) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.from-primary-500\/0{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.from-primary-500\/20{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.before\:from-primary-500\/20:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark .before\:dark\:from-primary-400\/20:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark [before~="dark:from-primary-400/0"]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark [hover~="before:dark:from-primary-400/20"]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}[before~="from-primary-500/0"]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}[hover~="before:from-primary-500/20"]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to)}.dark .dark\:via-primary-400\/10{--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.via-primary-500\/10{--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.before\:via-primary-500\/10:before{--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.dark .before\:dark\:via-primary-400\/10:before{--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.dark [hover~="before:dark:via-primary-400/10"]:hover:before{--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}[hover~="before:via-primary-500/10"]:hover:before{--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to)}.dark .dark\:to-primary-400\/0{--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.dark .dark\:to-transparent,.to-transparent{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.to-primary-400{--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-to-opacity, 1)) var(--un-gradient-to-position)}.to-primary-500\/0{--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.before\:to-transparent:before{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.dark .before\:dark\:to-transparent:before{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.dark [before~="dark:to-primary-400/0"]:before{--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.dark [hover~="before:dark:to-transparent"]:hover:before{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}[before~="to-primary-500/0"]:before{--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}[hover~="before:to-transparent"]:hover:before{--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.bg-gradient-to-r{--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient))}.before\:bg-gradient-to-r:before{--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient))}[before~=bg-gradient-to-r]:before{--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient))}[hover~="before:bg-gradient-to-r"]:hover:before{--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.dark .dark\:fill-neutral-800,.dark [dark\:fill-neutral-800=""]{--un-fill-opacity:1;fill:rgb(38 38 38 / var(--un-fill-opacity))}.fill-white,[fill-white=""]{--un-fill-opacity:1;fill:rgb(255 255 255 / var(--un-fill-opacity))}[stroke-width~="2"]{stroke-width:2px}.object-cover,[object-cover=""]{object-fit:cover}.object-contain,[object-contain=""]{object-fit:contain}.p-1,[p-1=""]{padding:.25rem}.p-1\.5,[p-1\.5=""]{padding:.375rem}.p-2,.p2,[p-2=""],[p~="2"],[p2=""]{padding:.5rem}.p-2\.5{padding:.625rem}.p-3,[p-3=""]{padding:.75rem}.p-4,[p-4=""]{padding:1rem}.p-5,[p-5=""]{padding:1.25rem}.p-6{padding:1.5rem}.p-8,[p-8=""]{padding:2rem}.px,.px-4,[px-4=""],[px=""]{padding-left:1rem;padding-right:1rem}.px-0{padding-left:0;padding-right:0}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10,[px-10=""]{padding-left:2.5rem;padding-right:2.5rem}.px-2,.px2,[px-2=""],[px~="2"],[px2=""]{padding-left:.5rem;padding-right:.5rem}.px-3,[px-3=""]{padding-left:.75rem;padding-right:.75rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py,.py-4,[py~="4"]{padding-top:1rem;padding-bottom:1rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1,.py1,[py-1=""],[py~="1"],[py1=""]{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5,[py-1\.5=""]{padding-top:.375rem;padding-bottom:.375rem}.py-2,[py-2=""]{padding-top:.5rem;padding-bottom:.5rem}.py-3,[py-3=""]{padding-top:.75rem;padding-bottom:.75rem}.py-6,[py-6=""]{padding-top:1.5rem;padding-bottom:1.5rem}[px~="12"]{padding-left:3rem;padding-right:3rem}.pb-2,[pb-2=""]{padding-bottom:.5rem}.pb-4,[pb-4=""]{padding-bottom:1rem}.pb-6,[pb-6=""]{padding-bottom:1.5rem}.pl,.pl-4,[pl-4=""]{padding-left:1rem}.pl-10{padding-left:2.5rem}.pl-3,[pl-3=""]{padding-left:.75rem}.pl-5,[pl-5=""]{padding-left:1.25rem}.pr-\[20px\]{padding-right:20px}.pr-1,[pr-1=""]{padding-right:.25rem}.pr-4,[pr-4=""]{padding-right:1rem}.pt,.pt-4,[pt-4=""]{padding-top:1rem}.pt-10,[pt-10=""]{padding-top:2.5rem}.pt-2,[pt-2=""]{padding-top:.5rem}.text-center,[text-center=""],[text~=center]{text-align:center}.text-left,[text-left=""]{text-align:left}.text-right,[text-right=""]{text-align:right}.text-wrap,[text-wrap=""]{text-wrap:wrap}.text-nowrap,[text-nowrap=""]{text-wrap:nowrap}.text-2xl,[text-2xl=""],[text~="2xl"]{font-size:1.5rem;line-height:2rem}.text-3xl,[text-3xl=""]{font-size:1.875rem;line-height:2.25rem}.text-5xl,[text-5xl=""]{font-size:3rem;line-height:1}.text-6xl,[text-6xl=""]{font-size:3.75rem;line-height:1}.text-base,[text-base=""],[text~=base]{font-size:1rem;line-height:1.5rem}.text-lg,[text-lg=""],[text~=lg]{font-size:1.125rem;line-height:1.75rem}.text-sm,[text-sm=""],[text~=sm]{font-size:.875rem;line-height:1.25rem}.text-xl,[text-xl=""]{font-size:1.25rem;line-height:1.75rem}.text-xs,[text-xs=""]{font-size:.75rem;line-height:1rem}[text~="60"]{font-size:15rem}.dark .dark\:text-amber-400{--un-text-opacity:1;color:rgb(251 191 36 / var(--un-text-opacity))}.dark .dark\:text-neutral-100,[text~=neutral-100]{--un-text-opacity:1;color:rgb(245 245 245 / var(--un-text-opacity))}.dark .dark\:text-neutral-300,.dark [dark\:text-neutral-300=""],.dark [text~="dark:neutral-300"],[text~=neutral-300]{--un-text-opacity:1;color:rgb(212 212 212 / var(--un-text-opacity))}.dark .dark\:text-neutral-400,.dark [dark\:text-neutral-400=""],.dark [text~="dark:neutral-400"],.text-neutral-400,[text-neutral-400=""],[text~=neutral-400]{--un-text-opacity:1;color:rgb(163 163 163 / var(--un-text-opacity))}.dark .dark\:text-neutral-500,.dark [text~="dark:neutral-500"],.text-neutral-500,[text-neutral-500=""],[text~=neutral-500]{--un-text-opacity:1;color:rgb(115 115 115 / var(--un-text-opacity))}.dark .dark\:text-neutral-600,.text-neutral-600,[text~=neutral-600]{--un-text-opacity:1;color:rgb(82 82 82 / var(--un-text-opacity))}.dark .dark\:text-neutral-600\/20,.dark [text~="dark:neutral-600/20"]{color:#52525233}.dark .dark\:text-primary-300\/80{color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / .8)}.dark .dark\:text-primary-400,.dark [text~="dark:primary-400"],.text-primary-400{--un-text-opacity:1;color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .dark\:text-primary-500,.text-primary-500{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .dark\:text-primary-600,.text-primary-600,[text~=primary-600]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .dark\:text-red-400{--un-text-opacity:1;color:rgb(248 113 113 / var(--un-text-opacity))}.dark .dark\:text-white,.dark [dark\:text-white=""],.dark [text~="dark:white"],.text-white,[text-white=""],[text~=white]{--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity))}.dark .dark\:text-white\/50{color:#ffffff80}.dark [text~="dark:cyan-600/90"]{color:#0891b2e6}.dark [text~="dark:gray-200"]{--un-text-opacity:1;color:rgb(229 231 235 / var(--un-text-opacity))}.dark [text~="dark:neutral-600/50"]{color:#52525280}.dark [text~="dark:neutral-900"],.text-neutral-900{--un-text-opacity:1;color:rgb(23 23 23 / var(--un-text-opacity))}.dark [text~="dark:orange-500"]{--un-text-opacity:1;color:rgb(249 115 22 / var(--un-text-opacity))}.dark [text~="dark:primary-300"],.text-primary-300,[text~=primary-300]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark [text~="dark:primary-300/50"]{color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / .5)}.dark [text~="dark:primary-600/90"]{color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / .9)}.dark [text~="dark:violet-600/90"]{color:#7c3aede6}.text-amber-500{--un-text-opacity:1;color:rgb(245 158 11 / var(--un-text-opacity))}.text-amber-600{--un-text-opacity:1;color:rgb(217 119 6 / var(--un-text-opacity))}.text-black,[text-black=""]{--un-text-opacity:1;color:rgb(0 0 0 / var(--un-text-opacity))}.text-cyan,[text~=cyan-400]{--un-text-opacity:1;color:rgb(34 211 238 / var(--un-text-opacity))}.text-neutral-200\/50,[text~="neutral-200/50"]{color:#e5e5e580}.text-neutral-400\/50,[text~="neutral-400/50"]{color:#a3a3a380}.text-neutral-700,[text-neutral-700=""]{--un-text-opacity:1;color:rgb(64 64 64 / var(--un-text-opacity))}.text-primary-600\/80{color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / .8)}.text-primary-700{--un-text-opacity:1;color:oklch(49% var(--theme-colors-chroma-700) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.text-red-500{--un-text-opacity:1;color:rgb(239 68 68 / var(--un-text-opacity))}.text-red-600{--un-text-opacity:1;color:rgb(220 38 38 / var(--un-text-opacity))}.text-transparent{color:transparent}.text-violet-500,[text-violet-500=""]{--un-text-opacity:1;color:rgb(139 92 246 / var(--un-text-opacity))}[text~=complementary-400]{--un-text-opacity:1;color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 180) / var(--un-text-opacity))}[text~="cyan-400/90"]{color:#22d3eee6}[text~=gray-700]{--un-text-opacity:1;color:rgb(55 65 81 / var(--un-text-opacity))}[text~=orange-700]{--un-text-opacity:1;color:rgb(194 65 12 / var(--un-text-opacity))}[text~="primary-400/90"]{color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .9)}[text~="violet-400/90"]{color:#a78bfae6}.dark .dark\:hover\:text-neutral-300:hover{--un-text-opacity:1;color:rgb(212 212 212 / var(--un-text-opacity))}.dark [hover~="dark:text-primary-300/80"]:hover{color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / .8)}.dark [text~="dark:hover:primary-500"]:hover{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.hover\:text-neutral-700:hover{--un-text-opacity:1;color:rgb(64 64 64 / var(--un-text-opacity))}[hover~="text-primary-600/80"]:hover{color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / .8)}[text~="hover:primary-500"]:hover{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark [text~="dark:disabled:neutral-600"]:disabled{--un-text-opacity:1;color:rgb(82 82 82 / var(--un-text-opacity))}[text~="disabled:neutral-400"]:disabled{--un-text-opacity:1;color:rgb(163 163 163 / var(--un-text-opacity))}.dark [text~="placeholder:dark:hover:primary-500"]:hover::placeholder{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark [text~="placeholder:dark:primary-300/50"]::placeholder{color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / .5)}[text~="placeholder:hover:primary-500"]:hover::placeholder{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}[text~="placeholder:primary-300"]::placeholder{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.font-bold,[font-bold=""]{font-weight:700}.font-medium,[font-medium=""]{font-weight:500}.font-semibold,[font-semibold=""]{font-weight:600}.lh-10{line-height:2.5rem}[leading~="[0.75]"]{line-height:.75}[leading~="[1]"]{line-height:1}.font-cute,[font-cute=""]{font-family:Kiwi Maru}.font-cuteen,[font-cuteen=""]{font-family:Sniglet}.font-mono,[font-mono=""]{font-family:DM Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans,[font-sans=""]{font-family:DM Sans,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.font-italic,.italic,[font-italic=""]{font-style:italic}.underline,[underline=""]{text-decoration-line:underline}.tab,[aria-checked~=tab][aria-checked=true],[tab=""]{-moz-tab-size:4;-o-tab-size:4;tab-size:4}[checked~=tab]:checked{-moz-tab-size:4;-o-tab-size:4;tab-size:4}.text-stroke-1,[text-stroke-1=""]{-webkit-text-stroke-width:1px}.text-shadow{--un-text-shadow:0 0 1px var(--un-text-shadow-color, rgb(0 0 0 / .2)),0 0 1px var(--un-text-shadow-color, rgb(1 0 5 / .1));text-shadow:var(--un-text-shadow)}.\[\&\:checked\+div_\.radio-dot\]\:opacity-100:checked+div .radio-dot,.opacity-100,.group:hover .group-hover\:opacity-100,.group:hover [group-hover\:opacity-100=""]{opacity:1}.op50,.opacity-50,[op50=""]{opacity:.5}.opacity-0,[opacity-0=""]{opacity:0}.opacity-25{opacity:.25}.opacity-60{opacity:.6}.opacity-95,[opacity-95=""]{opacity:.95}[hover~=opacity-100]:hover{opacity:1}.disabled\:opacity-50:disabled{opacity:.5}.before\:opacity-100:before{opacity:1}[before~=opacity-0]:before{opacity:0}[hover~="before:opacity-100"]:hover:before{opacity:1}.mix-blend-screen,[mix-blend-screen=""]{mix-blend-mode:screen}.dark .dark\:shadow-lg,.shadow-lg{--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.dark [shadow~="dark:none"]{--un-shadow:0 0 var(--un-shadow-color, rgb(0 0 0 / 0));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow{--un-shadow:var(--un-shadow-inset) 0 1px 3px 0 var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 1px 2px -1px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-md,[shadow-md=""],[shadow~=md]{--un-shadow:var(--un-shadow-inset) 0 4px 6px -1px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 2px 4px -2px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-sm,[shadow-sm=""],[shadow~=sm]{--un-shadow:var(--un-shadow-inset) 0 1px 2px 0 var(--un-shadow-color, rgb(0 0 0 / .05));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-xl,[shadow-xl=""]{--un-shadow:var(--un-shadow-inset) 0 20px 25px -5px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 8px 10px -6px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}[shadow~="cyan-200/50"]{--un-shadow-color:rgb(165 243 252 / .5) }[shadow~="primary-200/50"]{--un-shadow-color:oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / .5) }[shadow~="violet-200/50"]{--un-shadow-color:rgb(221 214 254 / .5) }.focus-within\:shadow-neutral-800:focus-within{--un-shadow-opacity:1;--un-shadow-color:rgb(38 38 38 / var(--un-shadow-opacity)) }[shadow~="focus-within:[0_0_0_1px]"]:focus-within{--un-shadow:0 0 0 1px var(--un-shadow-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.dark [hover~="dark:shadow-lg"]:hover{--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}[hover~=shadow-md]:hover{--un-shadow:var(--un-shadow-inset) 0 4px 6px -1px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 2px 4px -2px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.outline{outline-style:solid}.outline-none,[outline-none=""]{outline:2px solid transparent;outline-offset:2px}[outline~="focus-within:none"]:focus-within{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--un-ring-width:2px;--un-ring-offset-shadow:var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);--un-ring-shadow:var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.focus\:ring-offset-2:focus{--un-ring-offset-width:2px}.dark .dark\:focus\:ring-primary-400\/50:focus{--un-ring-color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .5) }.focus\:ring-primary-500\/50:focus{--un-ring-color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .5) }.dark .dark\:focus\:ring-offset-neutral-900:focus{--un-ring-offset-opacity:1;--un-ring-offset-color:rgb(23 23 23 / var(--un-ring-offset-opacity)) }.focus\:ring-offset-white:focus{--un-ring-offset-opacity:1;--un-ring-offset-color:rgb(255 255 255 / var(--un-ring-offset-opacity)) }.backdrop-blur-sm,[backdrop-blur-sm=""]{--un-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.backdrop-blur-xl,[backdrop-blur-xl=""]{--un-backdrop-blur:blur(24px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.blur{--un-blur:blur(8px);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.drop-shadow{--un-drop-shadow:drop-shadow(0 1px 2px var(--un-drop-shadow-color, rgb(0 0 0 / .1))) drop-shadow(0 1px 1px var(--un-drop-shadow-color, rgb(0 0 0 / .06)));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}[drop-shadow~=none],.dark [drop-shadow~="dark:hover:none"]:hover{--un-drop-shadow:drop-shadow(0 0 var(--un-drop-shadow-color, rgb(0 0 0 / 0)));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}[drop-shadow~="hover:[0px_4px_4px_rgba(220,220,220,0.4)]"]:hover{--un-drop-shadow:drop-shadow(0px 4px 4px rgba(220,220,220,.4));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}[drop-shadow~="active:[0px_0px_0px_rgba(220,220,220,0.25)]"]:active{--un-drop-shadow:drop-shadow(0px 0px 0px rgba(220,220,220,.25));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.\[\&_\.provider-icon\]\:grayscale-100 .provider-icon,.grayscale-100,[grayscale-100=""]{--un-grayscale:grayscale(1);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.\[\&_\.provider-icon\]\:hover\:grayscale-0:hover .provider-icon{--un-grayscale:grayscale(0);filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.filter{filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all,[transition-all=""],[transition~=all]{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors,[transition-colors=""],[transition~=colors]{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity,[transition-opacity=""]{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform,[transition~=transform]{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[transition~="100"]{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.1s}[transition~=border]{transition-property:border;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[transition~="placeholder:all"]::placeholder{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[before~=transition-all]:before{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:transition-all:after{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}[after~=transition-all]:after{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200,[duration-200=""],[transition~=duration-200]{transition-duration:.2s}.duration-250,[duration-250=""],[duration~="250"],[transition~=duration-250]{transition-duration:.25s}.duration-300,[transition~=duration-300]{transition-duration:.3s}.duration-400,[transition~=duration-400]{transition-duration:.4s}.duration-500,[duration-500=""],[duration~="500"],[transition~=duration-500]{transition-duration:.5s}[duration~="10"]{transition-duration:10ms}[duration~="1000"]{transition-duration:1s}.placeholder\:duration-250::placeholder{transition-duration:.25s}[placeholder\:duration-250=""]::placeholder{transition-duration:.25s}[transition~="placeholder:duration-250"]::placeholder{transition-duration:.25s}[before~=duration-400]:before{transition-duration:.4s}[after~=duration-400]:after{transition-duration:.4s}[delay~="1"]{transition-delay:1ms}[delay~="10"]{transition-delay:10ms}[delay~="11"]{transition-delay:11ms}[delay~="18"]{transition-delay:18ms}[delay~="19"]{transition-delay:19ms}[delay~="2"]{transition-delay:2ms}[delay~="20"]{transition-delay:20ms}[delay~="3"]{transition-delay:3ms}[delay~="4"]{transition-delay:4ms}[delay~="5"]{transition-delay:5ms}[delay~="50"]{transition-delay:50ms}[delay~="6"]{transition-delay:6ms}[delay~="7"]{transition-delay:7ms}[delay~="8"]{transition-delay:8ms}[delay~="9"]{transition-delay:9ms}.ease,.ease-in-out,[ease-in-out=""],[transition~=ease-in-out]{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-linear,[ease-linear=""]{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.placeholder\:ease-in-out::placeholder{transition-timing-function:cubic-bezier(.4,0,.2,1)}[transition~="placeholder:ease-in-out"]::placeholder{transition-timing-function:cubic-bezier(.4,0,.2,1)}[before~=ease-in-out]:before{transition-timing-function:cubic-bezier(.4,0,.2,1)}[after~=ease-in-out]:after{transition-timing-function:cubic-bezier(.4,0,.2,1)}.will-change-transform,[will-change-transform=""]{will-change:transform}.after\:content-\[\'\'\]:after{content:""}.content-empty{content:""}[before~=content-empty]:before{content:""}[after~=content-empty]:after{content:""}.bg-dotted-\[neutral-200\/60\]{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.6}.bg-dotted-\[neutral-200\/80\]{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.8}.dark .dark\:bg-dotted-\[neutral-700\/25\]{background-image:radial-gradient(circle at 1px 1px,rgb(64 64 64 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.25}.dark .dark\:bg-dotted-\[neutral-700\/40\]{background-image:radial-gradient(circle at 1px 1px,rgb(64 64 64 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.4}.dark .dark\:hover\:bg-dotted-\[primary-200\/20\]:hover{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}.hover\:bg-dotted-\[primary-300\/50\]:hover{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.after\:bg-dotted-\[primary-300\/50\]:after{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.dark .dark\:after\:bg-dotted-\[primary-200\/20\]:after{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}.dark [hover~="dark:after:bg-dotted-[primary-200/20]"]:hover:after{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}[after~="bg-dotted-[neutral-200/80]"]:after{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.8}[hover~="after:bg-dotted-[primary-300/50]"]:hover:after{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.transition-colors-none{transition-property:color,background-color,border-color,text-color;transition-duration:0s}.placeholder\:transition-colors-none::placeholder{transition-property:color,background-color,border-color,text-color;transition-duration:0s}@media (max-width: 1023.9px){[min-w~="i.map(i=>d[i]); -var QA=Object.defineProperty;var eC=(n,e,t)=>e in n?QA(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var fi=(n,e,t)=>eC(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();const tC="modulepreload",nC=function(n){return"/"+n},uv={},je=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(t.map(l=>{if(l=nC(l),l in uv)return;uv[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":tC,c||(f.as="script"),f.crossOrigin="",f.href=l,a&&f.setAttribute("nonce",a),document.head.appendChild(f),c)return new Promise((d,h)=>{f.addEventListener("load",d),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${l}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/default-_iAhyx9C.js","assets/HeaderLink-yHEt2vbv.js","assets/HeaderLink-DsxHr3rn.css","assets/index-CrclHGQ3.js","assets/Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js","assets/Stage-BMdJCq4V.css","assets/import-url-browser-CPN8ipMD.js","assets/duckdb-mvp-CaaD-olE.js","assets/speech-B27BwGQ-.js","assets/index-Be1NqeGb.js","assets/providers-DUDq6kdm.js","assets/queue-CEzllKo3.js","assets/queues-DJEZsGUG.js","assets/index-D975M2PQ.js","assets/airi-card-DeGSbHPj.js","assets/consciousness-CgTB9b9w.js","assets/Model.vue_vue_type_script_setup_true_lang-xbmtXrdQ.js","assets/TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js","assets/Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js","assets/Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js","assets/index-DxNnZI6o.js","assets/route-block-B_A1xBdJ.js","assets/index-DFm202zN.css","assets/background-remove-xa-QFjKj.js","assets/InputFile.vue_vue_type_script_setup_true_lang-aVfE3xzX.js","assets/chat-BJiWkk-g.js","assets/image-CIQPT2z3.js","assets/image-BhuwcwI9.css","assets/vibrant-Ck8ouQeR.js","assets/browser-CkchkNbv.js","assets/queue-D7nBskKs.js","assets/index-CMXq_S_x.js","assets/PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js","assets/IconAnimation.vue_vue_type_script_setup_true_lang-CRr1ZQyH.js","assets/index-B5H7zFR1.js","assets/CardDetailDialog.vue_vue_type_script_setup_true_lang-DAwVKIUC.js","assets/DeleteCardDialog.vue_vue_type_script_setup_true_lang-NzJTgSSI.js","assets/index-BUaUWOtl.js","assets/CardListItem.vue_vue_type_script_setup_true_lang-DG6xnm5K.js","assets/CardDetailDialog-Dxt-FHQW.js","assets/CardListItem-CmKnCrTs.js","assets/DeleteCardDialog-BfLGvfow.js","assets/index-DgTAR4Sy.js","assets/ColorPalette.vue_vue_type_script_setup_true_lang-Dh84R3gB.js","assets/index-4Fmwd3_O.css","assets/index-Cy4LPsSb.js","assets/index-Cu7e5uZ2.js","assets/useIconAnimation-D5irYuyi.js","assets/index-rlpEp8ML.css","assets/index-DuLZCAM8.js","assets/IconStatusItem-BzE_9TF3.js","assets/consciousness-qQlC4dPp.js","assets/RadioCardDetailManySelect-6Dh1XQsR.js","assets/Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js","assets/memory-long-term-BkSIgiZH.js","assets/memory-short-term-Dq-l2fpr.js","assets/speech--gNAMctx.js","assets/TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js","assets/FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js","assets/FieldRange.vue_vue_type_script_setup_true_lang-B670Jjy-.js","assets/Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js","assets/index-Cs5RsFGh.js","assets/alibaba-cloud-model-studio-BPTuNUid.js","assets/SpeechProviderSettings.vue_vue_type_script_setup_true_lang-Cscdqs1L.js","assets/ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js","assets/ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js","assets/ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js","assets/anthropic-BVw1aKkH.js","assets/ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js","assets/cloudflare-workers-ai-CcKNsU55.js","assets/deepseek-D7OL7kwG.js","assets/elevenlabs-1fmL3c-0.js","assets/featherless-ai-CcOpVhSb.js","assets/fireworks-ai-DAA5zEq0.js","assets/google-generative-ai-DdbM-cuq.js","assets/microsoft-speech-DxiRqm6y.js","assets/mistral-ai-CzsP5HyY.js","assets/moonshot-ai-B-gxAO4v.js","assets/novita-ai-DCHaCXXA.js","assets/ollama-DVhvZ81j.js","assets/openai-DeU27RZU.js","assets/openrouter-ai-BENIJVm4.js","assets/together-ai-CmQtGg2y.js","assets/volcengine-DP5EEnId.js","assets/xai-93geoyGl.js","assets/index-DemghqgU.js","assets/filter-message-CZTuPPrs.js","assets/delays-CbCH4HsM.js","assets/emotions-CgTD5sIw.js","assets/messages-Dpefqazf.js"])))=>i.map(i=>d[i]); +var eC=Object.defineProperty;var tC=(n,e,t)=>e in n?eC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var fi=(n,e,t)=>tC(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();const nC="modulepreload",iC=function(n){return"/"+n},uv={},je=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(t.map(c=>{if(c=iC(c),c in uv)return;uv[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":nC,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((h,p)=>{d.addEventListener("load",h),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})};/** * @vue/shared v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**//*! #__NO_SIDE_EFFECTS__ */function f0(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const vt={},ca=[],Ki=()=>{},iC=()=>!1,Vd=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),d0=n=>n.startsWith("onUpdate:"),nn=Object.assign,h0=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},sC=Object.prototype.hasOwnProperty,St=(n,e)=>sC.call(n,e),ze=Array.isArray,ua=n=>wc(n)==="[object Map]",Da=n=>wc(n)==="[object Set]",fv=n=>wc(n)==="[object Date]",Ke=n=>typeof n=="function",Ut=n=>typeof n=="string",Ui=n=>typeof n=="symbol",It=n=>n!==null&&typeof n=="object",OM=n=>(It(n)||Ke(n))&&Ke(n.then)&&Ke(n.catch),NM=Object.prototype.toString,wc=n=>NM.call(n),rC=n=>wc(n).slice(8,-1),UM=n=>wc(n)==="[object Object]",p0=n=>Ut(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,gl=f0(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Hd=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},oC=/-(\w)/g,ai=Hd(n=>n.replace(oC,(e,t)=>t?t.toUpperCase():"")),aC=/\B([A-Z])/g,ks=Hd(n=>n.replace(aC,"-$1").toLowerCase()),Gd=Hd(n=>n.charAt(0).toUpperCase()+n.slice(1)),pf=Hd(n=>n?`on${Gd(n)}`:""),Yn=(n,e)=>!Object.is(n,e),mf=(n,...e)=>{for(let t=0;t{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:i,value:t})},If=n=>{const e=parseFloat(n);return isNaN(e)?n:e},lC=n=>{const e=Ut(n)?Number(n):NaN;return isNaN(e)?n:e};let dv;const Wd=()=>dv||(dv=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Si(n){if(ze(n)){const e={};for(let t=0;t{if(t){const i=t.split(uC);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Oa(n){let e="";if(Ut(n))e=n;else if(ze(n))for(let t=0;tvo(t,e))}const BM=n=>!!(n&&n.__v_isRef===!0),gC=n=>Ut(n)?n:n==null?"":ze(n)||It(n)&&(n.toString===NM||!Ke(n.toString))?BM(n)?gC(n.value):JSON.stringify(n,zM,2):String(n),zM=(n,e)=>BM(e)?zM(n,e.value):ua(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,s],r)=>(t[ap(i,r)+" =>"]=s,t),{})}:Da(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>ap(t))}:Ui(e)?ap(e):It(e)&&!ze(e)&&!UM(e)?String(e):e,ap=(n,e="")=>{var t;return Ui(n)?`Symbol(${(t=n.description)!=null?t:e})`:n};/** +**//*! #__NO_SIDE_EFFECTS__ */function f0(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const vt={},ca=[],Ki=()=>{},sC=()=>!1,Vd=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),d0=n=>n.startsWith("onUpdate:"),nn=Object.assign,h0=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},rC=Object.prototype.hasOwnProperty,St=(n,e)=>rC.call(n,e),ze=Array.isArray,ua=n=>wc(n)==="[object Map]",Da=n=>wc(n)==="[object Set]",fv=n=>wc(n)==="[object Date]",Ke=n=>typeof n=="function",Ut=n=>typeof n=="string",Ni=n=>typeof n=="symbol",It=n=>n!==null&&typeof n=="object",OM=n=>(It(n)||Ke(n))&&Ke(n.then)&&Ke(n.catch),NM=Object.prototype.toString,wc=n=>NM.call(n),oC=n=>wc(n).slice(8,-1),UM=n=>wc(n)==="[object Object]",p0=n=>Ut(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,gl=f0(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Hd=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},aC=/-(\w)/g,ai=Hd(n=>n.replace(aC,(e,t)=>t?t.toUpperCase():"")),lC=/\B([A-Z])/g,ks=Hd(n=>n.replace(lC,"-$1").toLowerCase()),Gd=Hd(n=>n.charAt(0).toUpperCase()+n.slice(1)),pf=Hd(n=>n?`on${Gd(n)}`:""),Yn=(n,e)=>!Object.is(n,e),mf=(n,...e)=>{for(let t=0;t{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:i,value:t})},If=n=>{const e=parseFloat(n);return isNaN(e)?n:e},cC=n=>{const e=Ut(n)?Number(n):NaN;return isNaN(e)?n:e};let dv;const Wd=()=>dv||(dv=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Mi(n){if(ze(n)){const e={};for(let t=0;t{if(t){const i=t.split(fC);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Oa(n){let e="";if(Ut(n))e=n;else if(ze(n))for(let t=0;tvo(t,e))}const BM=n=>!!(n&&n.__v_isRef===!0),_C=n=>Ut(n)?n:n==null?"":ze(n)||It(n)&&(n.toString===NM||!Ke(n.toString))?BM(n)?_C(n.value):JSON.stringify(n,zM,2):String(n),zM=(n,e)=>BM(e)?zM(n,e.value):ua(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,s],r)=>(t[ap(i,r)+" =>"]=s,t),{})}:Da(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>ap(t))}:Ni(e)?ap(e):It(e)&&!ze(e)&&!UM(e)?String(e):e,ap=(n,e="")=>{var t;return Ni(n)?`Symbol(${(t=n.description)!=null?t:e})`:n};/** * @vue/reactivity v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let On;class VM{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=On,!e&&On&&(this.index=(On.scopes||(On.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e0)return;if(vl){let e=vl;for(vl=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;_l;){let e=_l;for(_l=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){n||(n=i)}e=t}}if(n)throw n}function XM(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function $M(n){let e,t=n.depsTail,i=t;for(;i;){const s=i.prevDep;i.version===-1?(i===t&&(t=s),b0(i),_C(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}n.deps=e,n.depsTail=t}function qm(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qM(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function qM(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===Hl))return;n.globalVersion=Hl;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!qm(n)){n.flags&=-3;return}const t=Dt,i=Ni;Dt=n,Ni=!0;try{XM(n);const s=n.fn(n._value);(e.version===0||Yn(s,n._value))&&(n._value=s,e.version++)}catch(s){throw e.version++,s}finally{Dt=t,Ni=i,$M(n),n.flags&=-3}}function b0(n,e=!1){const{dep:t,prevSub:i,nextSub:s}=n;if(i&&(i.nextSub=s,n.prevSub=void 0),s&&(s.prevSub=i,n.nextSub=void 0),t.subs===n&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let r=t.computed.deps;r;r=r.nextDep)b0(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function _C(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let Ni=!0;const YM=[];function Mr(){YM.push(Ni),Ni=!1}function Sr(){const n=YM.pop();Ni=n===void 0?!0:n}function hv(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=Dt;Dt=void 0;try{e()}finally{Dt=t}}}let Hl=0;class vC{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class $d{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0}track(e){if(!Dt||!Ni||Dt===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Dt)t=this.activeLink=new vC(Dt,this),Dt.deps?(t.prevDep=Dt.depsTail,Dt.depsTail.nextDep=t,Dt.depsTail=t):Dt.deps=Dt.depsTail=t,jM(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const i=t.nextDep;i.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=i),t.prevDep=Dt.depsTail,t.nextDep=void 0,Dt.depsTail.nextDep=t,Dt.depsTail=t,Dt.deps===t&&(Dt.deps=i)}return t}trigger(e){this.version++,Hl++,this.notify(e)}notify(e){v0();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{y0()}}}function jM(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)jM(i)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),n.dep.subs=n}}const Lf=new WeakMap,fo=Symbol(""),Ym=Symbol(""),Gl=Symbol("");function Mn(n,e,t){if(Ni&&Dt){let i=Lf.get(n);i||Lf.set(n,i=new Map);let s=i.get(t);s||(i.set(t,s=new $d),s.map=i,s.key=t),s.track()}}function bs(n,e,t,i,s,r){const o=Lf.get(n);if(!o){Hl++;return}const a=l=>{l&&l.trigger()};if(v0(),e==="clear")o.forEach(a);else{const l=ze(n),c=l&&p0(t);if(l&&t==="length"){const u=Number(i);o.forEach((f,d)=>{(d==="length"||d===Gl||!Ui(d)&&d>=u)&&a(f)})}else switch((t!==void 0||o.has(void 0))&&a(o.get(t)),c&&a(o.get(Gl)),e){case"add":l?c&&a(o.get("length")):(a(o.get(fo)),ua(n)&&a(o.get(Ym)));break;case"delete":l||(a(o.get(fo)),ua(n)&&a(o.get(Ym)));break;case"set":ua(n)&&a(o.get(fo));break}}y0()}function yC(n,e){const t=Lf.get(n);return t&&t.get(e)}function No(n){const e=ut(n);return e===n?e:(Mn(e,"iterate",Gl),_i(n)?e:e.map(Sn))}function qd(n){return Mn(n=ut(n),"iterate",Gl),n}const bC={__proto__:null,[Symbol.iterator](){return cp(this,Symbol.iterator,Sn)},concat(...n){return No(this).concat(...n.map(e=>ze(e)?No(e):e))},entries(){return cp(this,"entries",n=>(n[1]=Sn(n[1]),n))},every(n,e){return ls(this,"every",n,e,void 0,arguments)},filter(n,e){return ls(this,"filter",n,e,t=>t.map(Sn),arguments)},find(n,e){return ls(this,"find",n,e,Sn,arguments)},findIndex(n,e){return ls(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return ls(this,"findLast",n,e,Sn,arguments)},findLastIndex(n,e){return ls(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return ls(this,"forEach",n,e,void 0,arguments)},includes(...n){return up(this,"includes",n)},indexOf(...n){return up(this,"indexOf",n)},join(n){return No(this).join(n)},lastIndexOf(...n){return up(this,"lastIndexOf",n)},map(n,e){return ls(this,"map",n,e,void 0,arguments)},pop(){return $a(this,"pop")},push(...n){return $a(this,"push",n)},reduce(n,...e){return pv(this,"reduce",n,e)},reduceRight(n,...e){return pv(this,"reduceRight",n,e)},shift(){return $a(this,"shift")},some(n,e){return ls(this,"some",n,e,void 0,arguments)},splice(...n){return $a(this,"splice",n)},toReversed(){return No(this).toReversed()},toSorted(n){return No(this).toSorted(n)},toSpliced(...n){return No(this).toSpliced(...n)},unshift(...n){return $a(this,"unshift",n)},values(){return cp(this,"values",Sn)}};function cp(n,e,t){const i=qd(n),s=i[e]();return i!==n&&!_i(n)&&(s._next=s.next,s.next=()=>{const r=s._next();return r.value&&(r.value=t(r.value)),r}),s}const xC=Array.prototype;function ls(n,e,t,i,s,r){const o=qd(n),a=o!==n&&!_i(n),l=o[e];if(l!==xC[e]){const f=l.apply(n,r);return a?Sn(f):f}let c=t;o!==n&&(a?c=function(f,d){return t.call(this,Sn(f),d,n)}:t.length>2&&(c=function(f,d){return t.call(this,f,d,n)}));const u=l.call(o,c,i);return a&&s?s(u):u}function pv(n,e,t,i){const s=qd(n);let r=t;return s!==n&&(_i(n)?t.length>3&&(r=function(o,a,l){return t.call(this,o,a,l,n)}):r=function(o,a,l){return t.call(this,o,Sn(a),l,n)}),s[e](r,...i)}function up(n,e,t){const i=ut(n);Mn(i,"iterate",Gl);const s=i[e](...t);return(s===-1||s===!1)&&x0(t[0])?(t[0]=ut(t[0]),i[e](...t)):s}function $a(n,e,t=[]){Mr(),v0();const i=ut(n)[e].apply(n,t);return y0(),Sr(),i}const MC=f0("__proto__,__v_isRef,__isVue"),KM=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(Ui));function SC(n){Ui(n)||(n=String(n));const e=ut(this);return Mn(e,"has",n),e.hasOwnProperty(n)}class ZM{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if(t==="__v_skip")return e.__v_skip;const s=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!s;if(t==="__v_isReadonly")return s;if(t==="__v_isShallow")return r;if(t==="__v_raw")return i===(s?r?iS:nS:r?tS:eS).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=ze(e);if(!s){let l;if(o&&(l=bC[t]))return l;if(t==="hasOwnProperty")return SC}const a=Reflect.get(e,t,Pt(e)?e:i);return(Ui(t)?KM.has(t):MC(t))||(s||Mn(e,"get",t),r)?a:Pt(a)?o&&p0(t)?a:a.value:It(a)?s?xi(a):bi(a):a}}class JM extends ZM{constructor(e=!1){super(!1,e)}set(e,t,i,s){let r=e[t];if(!this._isShallow){const l=yo(r);if(!_i(i)&&!yo(i)&&(r=ut(r),i=ut(i)),!ze(e)&&Pt(r)&&!Pt(i))return l?!1:(r.value=i,!0)}const o=ze(e)&&p0(t)?Number(t)n,nu=n=>Reflect.getPrototypeOf(n);function CC(n,e,t){return function(...i){const s=this.__v_raw,r=ut(s),o=ua(r),a=n==="entries"||n===Symbol.iterator&&o,l=n==="keys"&&o,c=s[n](...i),u=t?jm:e?Km:Sn;return!e&&Mn(r,"iterate",l?Ym:fo),{next(){const{value:f,done:d}=c.next();return d?{value:f,done:d}:{value:a?[u(f[0]),u(f[1])]:u(f),done:d}},[Symbol.iterator](){return this}}}}function iu(n){return function(...e){return n==="delete"?!1:n==="clear"?void 0:this}}function RC(n,e){const t={get(s){const r=this.__v_raw,o=ut(r),a=ut(s);n||(Yn(s,a)&&Mn(o,"get",s),Mn(o,"get",a));const{has:l}=nu(o),c=e?jm:n?Km:Sn;if(l.call(o,s))return c(r.get(s));if(l.call(o,a))return c(r.get(a));r!==o&&r.get(s)},get size(){const s=this.__v_raw;return!n&&Mn(ut(s),"iterate",fo),Reflect.get(s,"size",s)},has(s){const r=this.__v_raw,o=ut(r),a=ut(s);return n||(Yn(s,a)&&Mn(o,"has",s),Mn(o,"has",a)),s===a?r.has(s):r.has(s)||r.has(a)},forEach(s,r){const o=this,a=o.__v_raw,l=ut(a),c=e?jm:n?Km:Sn;return!n&&Mn(l,"iterate",fo),a.forEach((u,f)=>s.call(r,c(u),c(f),o))}};return nn(t,n?{add:iu("add"),set:iu("set"),delete:iu("delete"),clear:iu("clear")}:{add(s){!e&&!_i(s)&&!yo(s)&&(s=ut(s));const r=ut(this);return nu(r).has.call(r,s)||(r.add(s),bs(r,"add",s,s)),this},set(s,r){!e&&!_i(r)&&!yo(r)&&(r=ut(r));const o=ut(this),{has:a,get:l}=nu(o);let c=a.call(o,s);c||(s=ut(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,r),c?Yn(r,u)&&bs(o,"set",s,r):bs(o,"add",s,r),this},delete(s){const r=ut(this),{has:o,get:a}=nu(r);let l=o.call(r,s);l||(s=ut(s),l=o.call(r,s)),a&&a.call(r,s);const c=r.delete(s);return l&&bs(r,"delete",s,void 0),c},clear(){const s=ut(this),r=s.size!==0,o=s.clear();return r&&bs(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{t[s]=CC(s,n,e)}),t}function Yd(n,e){const t=RC(n,e);return(i,s,r)=>s==="__v_isReactive"?!n:s==="__v_isReadonly"?n:s==="__v_raw"?i:Reflect.get(St(t,s)&&s in i?t:i,s,r)}const PC={get:Yd(!1,!1)},IC={get:Yd(!1,!0)},LC={get:Yd(!0,!1)},DC={get:Yd(!0,!0)},eS=new WeakMap,tS=new WeakMap,nS=new WeakMap,iS=new WeakMap;function OC(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function NC(n){return n.__v_skip||!Object.isExtensible(n)?0:OC(rC(n))}function bi(n){return yo(n)?n:jd(n,!1,EC,PC,eS)}function sS(n){return jd(n,!1,wC,IC,tS)}function xi(n){return jd(n,!0,TC,LC,nS)}function K9(n){return jd(n,!0,AC,DC,iS)}function jd(n,e,t,i,s){if(!It(n)||n.__v_raw&&!(e&&n.__v_isReactive))return n;const r=s.get(n);if(r)return r;const o=NC(n);if(o===0)return n;const a=new Proxy(n,o===2?i:t);return s.set(n,a),a}function Rs(n){return yo(n)?Rs(n.__v_raw):!!(n&&n.__v_isReactive)}function yo(n){return!!(n&&n.__v_isReadonly)}function _i(n){return!!(n&&n.__v_isShallow)}function x0(n){return n?!!n.__v_raw:!1}function ut(n){const e=n&&n.__v_raw;return e?ut(e):n}function M0(n){return!St(n,"__v_skip")&&Object.isExtensible(n)&&FM(n,"__v_skip",!0),n}const Sn=n=>It(n)?bi(n):n,Km=n=>It(n)?xi(n):n;function Pt(n){return n?n.__v_isRef===!0:!1}function et(n){return rS(n,!1)}function De(n){return rS(n,!0)}function rS(n,e){return Pt(n)?n:new UC(n,e)}class UC{constructor(e,t){this.dep=new $d,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:ut(e),this._value=t?e:Sn(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||_i(e)||yo(e);e=i?e:ut(e),Yn(e,t)&&(this._rawValue=e,this._value=i?e:Sn(e),this.dep.trigger())}}function Ot(n){return Pt(n)?n.value:n}function st(n){return Ke(n)?n():Ot(n)}const FC={get:(n,e,t)=>e==="__v_raw"?n:Ot(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const s=n[e];return Pt(s)&&!Pt(t)?(s.value=t,!0):Reflect.set(n,e,t,i)}};function oS(n){return Rs(n)?n:new Proxy(n,FC)}class kC{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new $d,{get:i,set:s}=e(t.track.bind(t),t.trigger.bind(t));this._get=i,this._set=s}get value(){return this._value=this._get()}set value(e){this._set(e)}}function S0(n){return new kC(n)}function aS(n){const e=ze(n)?new Array(n.length):{};for(const t in n)e[t]=cS(n,t);return e}class BC{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return yC(ut(this._object),this._key)}}class zC{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function lS(n,e,t){return Pt(n)?n:Ke(n)?new zC(n):It(n)&&arguments.length>1?cS(n,e,t):et(n)}function cS(n,e,t){const i=n[e];return Pt(i)?i:new BC(n,e,t)}class VC{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new $d(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Hl-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&Dt!==this)return WM(this,!0),!0}get value(){const e=this.dep.track();return qM(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function HC(n,e,t=!1){let i,s;return Ke(n)?i=n:(i=n.get,s=n.set),new VC(i,s,t)}const su={},Df=new WeakMap;let Qr;function GC(n,e=!1,t=Qr){if(t){let i=Df.get(t);i||Df.set(t,i=[]),i.push(n)}}function WC(n,e,t=vt){const{immediate:i,deep:s,once:r,scheduler:o,augmentJob:a,call:l}=t,c=v=>s?v:_i(v)||s===!1||s===0?xs(v,1):xs(v);let u,f,d,h,p=!1,_=!1;if(Pt(n)?(f=()=>n.value,p=_i(n)):Rs(n)?(f=()=>c(n),p=!0):ze(n)?(_=!0,p=n.some(v=>Rs(v)||_i(v)),f=()=>n.map(v=>{if(Pt(v))return v.value;if(Rs(v))return c(v);if(Ke(v))return l?l(v,2):v()})):Ke(n)?e?f=l?()=>l(n,2):n:f=()=>{if(d){Mr();try{d()}finally{Sr()}}const v=Qr;Qr=u;try{return l?l(n,3,[h]):n(h)}finally{Qr=v}}:f=Ki,e&&s){const v=f,T=s===!0?1/0:s;f=()=>xs(v(),T)}const g=Xd(),m=()=>{u.stop(),g&&g.active&&h0(g.effects,u)};if(r&&e){const v=e;e=(...T)=>{v(...T),m()}}let y=_?new Array(n.length).fill(su):su;const b=v=>{if(!(!(u.flags&1)||!u.dirty&&!v))if(e){const T=u.run();if(s||p||(_?T.some((E,S)=>Yn(E,y[S])):Yn(T,y))){d&&d();const E=Qr;Qr=u;try{const S=[T,y===su?void 0:_&&y[0]===su?[]:y,h];l?l(e,3,S):e(...S),y=T}finally{Qr=E}}}else u.run()};return a&&a(b),u=new HM(f),u.scheduler=o?()=>o(b,!1):b,h=v=>GC(v,!1,u),d=u.onStop=()=>{const v=Df.get(u);if(v){if(l)l(v,4);else for(const T of v)T();Df.delete(u)}},e?i?b(!0):y=u.run():o?o(b.bind(null,!0),!0):u.run(),m.pause=u.pause.bind(u),m.resume=u.resume.bind(u),m.stop=m,m}function xs(n,e=1/0,t){if(e<=0||!It(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,Pt(n))xs(n.value,e,t);else if(ze(n))for(let i=0;i{xs(i,e,t)});else if(UM(n)){for(const i in n)xs(n[i],e,t);for(const i of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,i)&&xs(n[i],e,t)}return n}/** +**/let On;class VM{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=On,!e&&On&&(this.index=(On.scopes||(On.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e0)return;if(vl){let e=vl;for(vl=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;_l;){let e=_l;for(_l=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){n||(n=i)}e=t}}if(n)throw n}function XM(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function $M(n){let e,t=n.depsTail,i=t;for(;i;){const s=i.prevDep;i.version===-1?(i===t&&(t=s),b0(i),vC(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}n.deps=e,n.depsTail=t}function qm(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(qM(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function qM(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===Hl))return;n.globalVersion=Hl;const e=n.dep;if(n.flags|=2,e.version>0&&!n.isSSR&&n.deps&&!qm(n)){n.flags&=-3;return}const t=Dt,i=Oi;Dt=n,Oi=!0;try{XM(n);const s=n.fn(n._value);(e.version===0||Yn(s,n._value))&&(n._value=s,e.version++)}catch(s){throw e.version++,s}finally{Dt=t,Oi=i,$M(n),n.flags&=-3}}function b0(n,e=!1){const{dep:t,prevSub:i,nextSub:s}=n;if(i&&(i.nextSub=s,n.prevSub=void 0),s&&(s.prevSub=i,n.nextSub=void 0),t.subs===n&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let r=t.computed.deps;r;r=r.nextDep)b0(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function vC(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let Oi=!0;const YM=[];function Mr(){YM.push(Oi),Oi=!1}function Sr(){const n=YM.pop();Oi=n===void 0?!0:n}function hv(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=Dt;Dt=void 0;try{e()}finally{Dt=t}}}let Hl=0;class yC{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class $d{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0}track(e){if(!Dt||!Oi||Dt===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Dt)t=this.activeLink=new yC(Dt,this),Dt.deps?(t.prevDep=Dt.depsTail,Dt.depsTail.nextDep=t,Dt.depsTail=t):Dt.deps=Dt.depsTail=t,jM(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const i=t.nextDep;i.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=i),t.prevDep=Dt.depsTail,t.nextDep=void 0,Dt.depsTail.nextDep=t,Dt.depsTail=t,Dt.deps===t&&(Dt.deps=i)}return t}trigger(e){this.version++,Hl++,this.notify(e)}notify(e){v0();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{y0()}}}function jM(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)jM(i)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),n.dep.subs=n}}const Lf=new WeakMap,fo=Symbol(""),Ym=Symbol(""),Gl=Symbol("");function Mn(n,e,t){if(Oi&&Dt){let i=Lf.get(n);i||Lf.set(n,i=new Map);let s=i.get(t);s||(i.set(t,s=new $d),s.map=i,s.key=t),s.track()}}function bs(n,e,t,i,s,r){const o=Lf.get(n);if(!o){Hl++;return}const a=l=>{l&&l.trigger()};if(v0(),e==="clear")o.forEach(a);else{const l=ze(n),c=l&&p0(t);if(l&&t==="length"){const u=Number(i);o.forEach((f,d)=>{(d==="length"||d===Gl||!Ni(d)&&d>=u)&&a(f)})}else switch((t!==void 0||o.has(void 0))&&a(o.get(t)),c&&a(o.get(Gl)),e){case"add":l?c&&a(o.get("length")):(a(o.get(fo)),ua(n)&&a(o.get(Ym)));break;case"delete":l||(a(o.get(fo)),ua(n)&&a(o.get(Ym)));break;case"set":ua(n)&&a(o.get(fo));break}}y0()}function bC(n,e){const t=Lf.get(n);return t&&t.get(e)}function No(n){const e=ut(n);return e===n?e:(Mn(e,"iterate",Gl),_i(n)?e:e.map(Sn))}function qd(n){return Mn(n=ut(n),"iterate",Gl),n}const xC={__proto__:null,[Symbol.iterator](){return cp(this,Symbol.iterator,Sn)},concat(...n){return No(this).concat(...n.map(e=>ze(e)?No(e):e))},entries(){return cp(this,"entries",n=>(n[1]=Sn(n[1]),n))},every(n,e){return ls(this,"every",n,e,void 0,arguments)},filter(n,e){return ls(this,"filter",n,e,t=>t.map(Sn),arguments)},find(n,e){return ls(this,"find",n,e,Sn,arguments)},findIndex(n,e){return ls(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return ls(this,"findLast",n,e,Sn,arguments)},findLastIndex(n,e){return ls(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return ls(this,"forEach",n,e,void 0,arguments)},includes(...n){return up(this,"includes",n)},indexOf(...n){return up(this,"indexOf",n)},join(n){return No(this).join(n)},lastIndexOf(...n){return up(this,"lastIndexOf",n)},map(n,e){return ls(this,"map",n,e,void 0,arguments)},pop(){return $a(this,"pop")},push(...n){return $a(this,"push",n)},reduce(n,...e){return pv(this,"reduce",n,e)},reduceRight(n,...e){return pv(this,"reduceRight",n,e)},shift(){return $a(this,"shift")},some(n,e){return ls(this,"some",n,e,void 0,arguments)},splice(...n){return $a(this,"splice",n)},toReversed(){return No(this).toReversed()},toSorted(n){return No(this).toSorted(n)},toSpliced(...n){return No(this).toSpliced(...n)},unshift(...n){return $a(this,"unshift",n)},values(){return cp(this,"values",Sn)}};function cp(n,e,t){const i=qd(n),s=i[e]();return i!==n&&!_i(n)&&(s._next=s.next,s.next=()=>{const r=s._next();return r.value&&(r.value=t(r.value)),r}),s}const MC=Array.prototype;function ls(n,e,t,i,s,r){const o=qd(n),a=o!==n&&!_i(n),l=o[e];if(l!==MC[e]){const f=l.apply(n,r);return a?Sn(f):f}let c=t;o!==n&&(a?c=function(f,d){return t.call(this,Sn(f),d,n)}:t.length>2&&(c=function(f,d){return t.call(this,f,d,n)}));const u=l.call(o,c,i);return a&&s?s(u):u}function pv(n,e,t,i){const s=qd(n);let r=t;return s!==n&&(_i(n)?t.length>3&&(r=function(o,a,l){return t.call(this,o,a,l,n)}):r=function(o,a,l){return t.call(this,o,Sn(a),l,n)}),s[e](r,...i)}function up(n,e,t){const i=ut(n);Mn(i,"iterate",Gl);const s=i[e](...t);return(s===-1||s===!1)&&x0(t[0])?(t[0]=ut(t[0]),i[e](...t)):s}function $a(n,e,t=[]){Mr(),v0();const i=ut(n)[e].apply(n,t);return y0(),Sr(),i}const SC=f0("__proto__,__v_isRef,__isVue"),KM=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(Ni));function EC(n){Ni(n)||(n=String(n));const e=ut(this);return Mn(e,"has",n),e.hasOwnProperty(n)}class ZM{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if(t==="__v_skip")return e.__v_skip;const s=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!s;if(t==="__v_isReadonly")return s;if(t==="__v_isShallow")return r;if(t==="__v_raw")return i===(s?r?iS:nS:r?tS:eS).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=ze(e);if(!s){let l;if(o&&(l=xC[t]))return l;if(t==="hasOwnProperty")return EC}const a=Reflect.get(e,t,Pt(e)?e:i);return(Ni(t)?KM.has(t):SC(t))||(s||Mn(e,"get",t),r)?a:Pt(a)?o&&p0(t)?a:a.value:It(a)?s?Ui(a):bi(a):a}}class JM extends ZM{constructor(e=!1){super(!1,e)}set(e,t,i,s){let r=e[t];if(!this._isShallow){const l=yo(r);if(!_i(i)&&!yo(i)&&(r=ut(r),i=ut(i)),!ze(e)&&Pt(r)&&!Pt(i))return l?!1:(r.value=i,!0)}const o=ze(e)&&p0(t)?Number(t)n,nu=n=>Reflect.getPrototypeOf(n);function RC(n,e,t){return function(...i){const s=this.__v_raw,r=ut(s),o=ua(r),a=n==="entries"||n===Symbol.iterator&&o,l=n==="keys"&&o,c=s[n](...i),u=t?jm:e?Km:Sn;return!e&&Mn(r,"iterate",l?Ym:fo),{next(){const{value:f,done:d}=c.next();return d?{value:f,done:d}:{value:a?[u(f[0]),u(f[1])]:u(f),done:d}},[Symbol.iterator](){return this}}}}function iu(n){return function(...e){return n==="delete"?!1:n==="clear"?void 0:this}}function PC(n,e){const t={get(s){const r=this.__v_raw,o=ut(r),a=ut(s);n||(Yn(s,a)&&Mn(o,"get",s),Mn(o,"get",a));const{has:l}=nu(o),c=e?jm:n?Km:Sn;if(l.call(o,s))return c(r.get(s));if(l.call(o,a))return c(r.get(a));r!==o&&r.get(s)},get size(){const s=this.__v_raw;return!n&&Mn(ut(s),"iterate",fo),Reflect.get(s,"size",s)},has(s){const r=this.__v_raw,o=ut(r),a=ut(s);return n||(Yn(s,a)&&Mn(o,"has",s),Mn(o,"has",a)),s===a?r.has(s):r.has(s)||r.has(a)},forEach(s,r){const o=this,a=o.__v_raw,l=ut(a),c=e?jm:n?Km:Sn;return!n&&Mn(l,"iterate",fo),a.forEach((u,f)=>s.call(r,c(u),c(f),o))}};return nn(t,n?{add:iu("add"),set:iu("set"),delete:iu("delete"),clear:iu("clear")}:{add(s){!e&&!_i(s)&&!yo(s)&&(s=ut(s));const r=ut(this);return nu(r).has.call(r,s)||(r.add(s),bs(r,"add",s,s)),this},set(s,r){!e&&!_i(r)&&!yo(r)&&(r=ut(r));const o=ut(this),{has:a,get:l}=nu(o);let c=a.call(o,s);c||(s=ut(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,r),c?Yn(r,u)&&bs(o,"set",s,r):bs(o,"add",s,r),this},delete(s){const r=ut(this),{has:o,get:a}=nu(r);let l=o.call(r,s);l||(s=ut(s),l=o.call(r,s)),a&&a.call(r,s);const c=r.delete(s);return l&&bs(r,"delete",s,void 0),c},clear(){const s=ut(this),r=s.size!==0,o=s.clear();return r&&bs(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{t[s]=RC(s,n,e)}),t}function Yd(n,e){const t=PC(n,e);return(i,s,r)=>s==="__v_isReactive"?!n:s==="__v_isReadonly"?n:s==="__v_raw"?i:Reflect.get(St(t,s)&&s in i?t:i,s,r)}const IC={get:Yd(!1,!1)},LC={get:Yd(!1,!0)},DC={get:Yd(!0,!1)},OC={get:Yd(!0,!0)},eS=new WeakMap,tS=new WeakMap,nS=new WeakMap,iS=new WeakMap;function NC(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function UC(n){return n.__v_skip||!Object.isExtensible(n)?0:NC(oC(n))}function bi(n){return yo(n)?n:jd(n,!1,TC,IC,eS)}function sS(n){return jd(n,!1,AC,LC,tS)}function Ui(n){return jd(n,!0,wC,DC,nS)}function rS(n){return jd(n,!0,CC,OC,iS)}function jd(n,e,t,i,s){if(!It(n)||n.__v_raw&&!(e&&n.__v_isReactive))return n;const r=s.get(n);if(r)return r;const o=UC(n);if(o===0)return n;const a=new Proxy(n,o===2?i:t);return s.set(n,a),a}function Rs(n){return yo(n)?Rs(n.__v_raw):!!(n&&n.__v_isReactive)}function yo(n){return!!(n&&n.__v_isReadonly)}function _i(n){return!!(n&&n.__v_isShallow)}function x0(n){return n?!!n.__v_raw:!1}function ut(n){const e=n&&n.__v_raw;return e?ut(e):n}function M0(n){return!St(n,"__v_skip")&&Object.isExtensible(n)&&FM(n,"__v_skip",!0),n}const Sn=n=>It(n)?bi(n):n,Km=n=>It(n)?Ui(n):n;function Pt(n){return n?n.__v_isRef===!0:!1}function et(n){return oS(n,!1)}function De(n){return oS(n,!0)}function oS(n,e){return Pt(n)?n:new FC(n,e)}class FC{constructor(e,t){this.dep=new $d,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:ut(e),this._value=t?e:Sn(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||_i(e)||yo(e);e=i?e:ut(e),Yn(e,t)&&(this._rawValue=e,this._value=i?e:Sn(e),this.dep.trigger())}}function Ot(n){return Pt(n)?n.value:n}function nt(n){return Ke(n)?n():Ot(n)}const kC={get:(n,e,t)=>e==="__v_raw"?n:Ot(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const s=n[e];return Pt(s)&&!Pt(t)?(s.value=t,!0):Reflect.set(n,e,t,i)}};function aS(n){return Rs(n)?n:new Proxy(n,kC)}class BC{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new $d,{get:i,set:s}=e(t.track.bind(t),t.trigger.bind(t));this._get=i,this._set=s}get value(){return this._value=this._get()}set value(e){this._set(e)}}function S0(n){return new BC(n)}function lS(n){const e=ze(n)?new Array(n.length):{};for(const t in n)e[t]=uS(n,t);return e}class zC{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return bC(ut(this._object),this._key)}}class VC{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function cS(n,e,t){return Pt(n)?n:Ke(n)?new VC(n):It(n)&&arguments.length>1?uS(n,e,t):et(n)}function uS(n,e,t){const i=n[e];return Pt(i)?i:new zC(n,e,t)}class HC{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new $d(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Hl-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&Dt!==this)return WM(this,!0),!0}get value(){const e=this.dep.track();return qM(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function GC(n,e,t=!1){let i,s;return Ke(n)?i=n:(i=n.get,s=n.set),new HC(i,s,t)}const su={},Df=new WeakMap;let Qr;function WC(n,e=!1,t=Qr){if(t){let i=Df.get(t);i||Df.set(t,i=[]),i.push(n)}}function XC(n,e,t=vt){const{immediate:i,deep:s,once:r,scheduler:o,augmentJob:a,call:l}=t,c=v=>s?v:_i(v)||s===!1||s===0?xs(v,1):xs(v);let u,f,d,h,p=!1,_=!1;if(Pt(n)?(f=()=>n.value,p=_i(n)):Rs(n)?(f=()=>c(n),p=!0):ze(n)?(_=!0,p=n.some(v=>Rs(v)||_i(v)),f=()=>n.map(v=>{if(Pt(v))return v.value;if(Rs(v))return c(v);if(Ke(v))return l?l(v,2):v()})):Ke(n)?e?f=l?()=>l(n,2):n:f=()=>{if(d){Mr();try{d()}finally{Sr()}}const v=Qr;Qr=u;try{return l?l(n,3,[h]):n(h)}finally{Qr=v}}:f=Ki,e&&s){const v=f,T=s===!0?1/0:s;f=()=>xs(v(),T)}const g=Xd(),m=()=>{u.stop(),g&&g.active&&h0(g.effects,u)};if(r&&e){const v=e;e=(...T)=>{v(...T),m()}}let y=_?new Array(n.length).fill(su):su;const b=v=>{if(!(!(u.flags&1)||!u.dirty&&!v))if(e){const T=u.run();if(s||p||(_?T.some((E,S)=>Yn(E,y[S])):Yn(T,y))){d&&d();const E=Qr;Qr=u;try{const S=[T,y===su?void 0:_&&y[0]===su?[]:y,h];l?l(e,3,S):e(...S),y=T}finally{Qr=E}}}else u.run()};return a&&a(b),u=new HM(f),u.scheduler=o?()=>o(b,!1):b,h=v=>WC(v,!1,u),d=u.onStop=()=>{const v=Df.get(u);if(v){if(l)l(v,4);else for(const T of v)T();Df.delete(u)}},e?i?b(!0):y=u.run():o?o(b.bind(null,!0),!0):u.run(),m.pause=u.pause.bind(u),m.resume=u.resume.bind(u),m.stop=m,m}function xs(n,e=1/0,t){if(e<=0||!It(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,Pt(n))xs(n.value,e,t);else if(ze(n))for(let i=0;i{xs(i,e,t)});else if(UM(n)){for(const i in n)xs(n[i],e,t);for(const i of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,i)&&xs(n[i],e,t)}return n}/** * @vue/runtime-core v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/function Ac(n,e,t,i){try{return i?n(...i):n()}catch(s){Kd(s,e,t)}}function Fi(n,e,t,i){if(Ke(n)){const s=Ac(n,e,t,i);return s&&OM(s)&&s.catch(r=>{Kd(r,e,t)}),s}if(ze(n)){const s=[];for(let r=0;r>>1,s=Un[i],r=Wl(s);r=Wl(t)?Un.push(n):Un.splice($C(e),0,n),n.flags|=1,fS()}}function fS(){Of||(Of=uS.then(hS))}function qC(n){ze(n)?fa.push(...n):nr&&n.id===-1?nr.splice(ta+1,0,n):n.flags&1||(fa.push(n),n.flags|=1),fS()}function mv(n,e,t=Wi+1){for(;tWl(t)-Wl(i));if(fa.length=0,nr){nr.push(...e);return}for(nr=e,ta=0;tan.id==null?n.flags&2?-1:1/0:n.id;function hS(n){try{for(Wi=0;Wi{i._d&&Cv(-1);const r=Nf(e);let o;try{o=n(...s)}finally{Nf(r),i._d&&Cv(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function Z9(n,e){if(Qt===null)return n;const t=eh(Qt),i=n.dirs||(n.dirs=[]);for(let s=0;sn.__isTeleport,yl=n=>n&&(n.disabled||n.disabled===""),gv=n=>n&&(n.defer||n.defer===""),_v=n=>typeof SVGElement<"u"&&n instanceof SVGElement,vv=n=>typeof MathMLElement=="function"&&n instanceof MathMLElement,Zm=(n,e)=>{const t=n&&n.to;return Ut(t)?e?e(t):null:t},vS={name:"Teleport",__isTeleport:!0,process(n,e,t,i,s,r,o,a,l,c){const{mc:u,pc:f,pbc:d,o:{insert:h,querySelector:p,createText:_,createComment:g}}=c,m=yl(e.props);let{shapeFlag:y,children:b,dynamicChildren:v}=e;if(n==null){const T=e.el=_(""),E=e.anchor=_("");h(T,t,i),h(E,t,i);const S=(x,M)=>{y&16&&(s&&s.isCE&&(s.ce._teleportTarget=x),u(b,x,M,s,r,o,a,l))},P=()=>{const x=e.target=Zm(e.props,p),M=yS(x,e,_,h);x&&(o!=="svg"&&_v(x)?o="svg":o!=="mathml"&&vv(x)&&(o="mathml"),m||(S(x,M),gf(e,!1)))};m&&(S(t,E),gf(e,!0)),gv(e.props)?Dn(()=>{P(),e.el.__isMounted=!0},r):P()}else{if(gv(e.props)&&!n.el.__isMounted){Dn(()=>{vS.process(n,e,t,i,s,r,o,a,l,c),delete n.el.__isMounted},r);return}e.el=n.el,e.targetStart=n.targetStart;const T=e.anchor=n.anchor,E=e.target=n.target,S=e.targetAnchor=n.targetAnchor,P=yl(n.props),x=P?t:E,M=P?T:S;if(o==="svg"||_v(E)?o="svg":(o==="mathml"||vv(E))&&(o="mathml"),v?(d(n.dynamicChildren,v,x,s,r,o,a),R0(n,e,!0)):l||f(n,e,x,M,s,r,o,a,!1),m)P?e.props&&n.props&&e.props.to!==n.props.to&&(e.props.to=n.props.to):ru(e,t,T,c,1);else if((e.props&&e.props.to)!==(n.props&&n.props.to)){const L=e.target=Zm(e.props,p);L&&ru(e,L,null,c,0)}else P&&ru(e,E,S,c,1);gf(e,m)}},remove(n,e,t,{um:i,o:{remove:s}},r){const{shapeFlag:o,children:a,anchor:l,targetStart:c,targetAnchor:u,target:f,props:d}=n;if(f&&(s(c),s(u)),r&&s(l),o&16){const h=r||!yl(d);for(let p=0;p{n.isMounted=!0}),AS(()=>{n.isUnmounting=!0}),n}const di=[Function,Array],bS={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:di,onEnter:di,onAfterEnter:di,onEnterCancelled:di,onBeforeLeave:di,onLeave:di,onAfterLeave:di,onLeaveCancelled:di,onBeforeAppear:di,onAppear:di,onAfterAppear:di,onAppearCancelled:di},xS=n=>{const e=n.subTree;return e.component?xS(e.component):e},KC={name:"BaseTransition",props:bS,setup(n,{slots:e}){const t=wn(),i=jC();return()=>{const s=e.default&&ES(e.default(),!0);if(!s||!s.length)return;const r=MS(s),o=ut(n),{mode:a}=o;if(i.isLeaving)return fp(r);const l=yv(r);if(!l)return fp(r);let c=Jm(l,o,i,t,f=>c=f);l.type!==Fn&&Xl(l,c);let u=t.subTree&&yv(t.subTree);if(u&&u.type!==Fn&&!io(l,u)&&xS(t).type!==Fn){let f=Jm(u,o,i,t);if(Xl(u,f),a==="out-in"&&l.type!==Fn)return i.isLeaving=!0,f.afterLeave=()=>{i.isLeaving=!1,t.job.flags&8||t.update(),delete f.afterLeave,u=void 0},fp(r);a==="in-out"&&l.type!==Fn?f.delayLeave=(d,h,p)=>{const _=SS(i,u);_[String(u.key)]=u,d[ir]=()=>{h(),d[ir]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{p(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return r}}};function MS(n){let e=n[0];if(n.length>1){for(const t of n)if(t.type!==Fn){e=t;break}}return e}const ZC=KC;function SS(n,e){const{leavingVNodes:t}=n;let i=t.get(e.type);return i||(i=Object.create(null),t.set(e.type,i)),i}function Jm(n,e,t,i,s){const{appear:r,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:f,onBeforeLeave:d,onLeave:h,onAfterLeave:p,onLeaveCancelled:_,onBeforeAppear:g,onAppear:m,onAfterAppear:y,onAppearCancelled:b}=e,v=String(n.key),T=SS(t,n),E=(x,M)=>{x&&Fi(x,i,9,M)},S=(x,M)=>{const L=M[1];E(x,M),ze(x)?x.every(F=>F.length<=1)&&L():x.length<=1&&L()},P={mode:o,persisted:a,beforeEnter(x){let M=l;if(!t.isMounted)if(r)M=g||l;else return;x[ir]&&x[ir](!0);const L=T[v];L&&io(n,L)&&L.el[ir]&&L.el[ir](),E(M,[x])},enter(x){let M=c,L=u,F=f;if(!t.isMounted)if(r)M=m||c,L=y||u,F=b||f;else return;let H=!1;const Y=x[ou]=ee=>{H||(H=!0,ee?E(F,[x]):E(L,[x]),P.delayedLeave&&P.delayedLeave(),x[ou]=void 0)};M?S(M,[x,Y]):Y()},leave(x,M){const L=String(n.key);if(x[ou]&&x[ou](!0),t.isUnmounting)return M();E(d,[x]);let F=!1;const H=x[ir]=Y=>{F||(F=!0,M(),Y?E(_,[x]):E(p,[x]),x[ir]=void 0,T[L]===n&&delete T[L])};T[L]=n,h?S(h,[x,H]):H()},clone(x){const M=Jm(x,e,t,i,s);return s&&s(M),M}};return P}function fp(n){if(Zd(n))return n=pr(n),n.children=null,n}function yv(n){if(!Zd(n))return _S(n.type)&&n.children?MS(n.children):n;const{shapeFlag:e,children:t}=n;if(t){if(e&16)return t[0];if(e&32&&Ke(t.default))return t.default()}}function Xl(n,e){n.shapeFlag&6&&n.component?(n.transition=e,Xl(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function ES(n,e=!1,t){let i=[],s=0;for(let r=0;r1)for(let r=0;rUf(p,e&&(ze(e)?e[_]:e),t,i,s));return}if(da(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Uf(n,e,t,i.component.subTree);return}const r=i.shapeFlag&4?eh(i.component):i.el,o=s?null:r,{i:a,r:l}=n,c=e&&e.r,u=a.refs===vt?a.refs={}:a.refs,f=a.setupState,d=ut(f),h=f===vt?()=>!1:p=>St(d,p);if(c!=null&&c!==l&&(Ut(c)?(u[c]=null,h(c)&&(f[c]=null)):Pt(c)&&(c.value=null)),Ke(l))Ac(l,a,12,[o,u]);else{const p=Ut(l),_=Pt(l);if(p||_){const g=()=>{if(n.f){const m=p?h(l)?f[l]:u[l]:l.value;s?ze(m)&&h0(m,r):ze(m)?m.includes(r)||m.push(r):p?(u[l]=[r],h(l)&&(f[l]=u[l])):(l.value=[r],n.k&&(u[n.k]=l.value))}else p?(u[l]=o,h(l)&&(f[l]=o)):_&&(l.value=o,n.k&&(u[n.k]=o))};o?(g.id=-1,Dn(g,t)):g()}}}Wd().requestIdleCallback;Wd().cancelIdleCallback;const da=n=>!!n.type.__asyncLoader,Zd=n=>n.type.__isKeepAlive;function JC(n,e){wS(n,"a",e)}function QC(n,e){wS(n,"da",e)}function wS(n,e,t=cn){const i=n.__wdc||(n.__wdc=()=>{let s=t;for(;s;){if(s.isDeactivated)return;s=s.parent}return n()});if(Jd(e,i,t),t){let s=t.parent;for(;s&&s.parent;)Zd(s.parent.vnode)&&e2(i,e,t,s),s=s.parent}}function e2(n,e,t,i){const s=Jd(e,n,i,!0);ns(()=>{h0(i[e],s)},t)}function Jd(n,e,t=cn,i=!1){if(t){const s=t[n]||(t[n]=[]),r=e.__weh||(e.__weh=(...o)=>{Mr();const a=Lc(t),l=Fi(e,t,n,o);return a(),Sr(),l});return i?s.unshift(r):s.push(r),r}}const Bs=n=>(e,t=cn)=>{(!Kl||n==="sp")&&Jd(n,(...i)=>e(...i),t)},t2=Bs("bm"),Hn=Bs("m"),n2=Bs("bu"),i2=Bs("u"),AS=Bs("bum"),ns=Bs("um"),s2=Bs("sp"),r2=Bs("rtg"),o2=Bs("rtc");function a2(n,e=cn){Jd("ec",n,e)}const T0="components",l2="directives";function eG(n,e){return w0(T0,n,!0,e)||n}const CS=Symbol.for("v-ndc");function c2(n){return Ut(n)?w0(T0,n,!1)||n:n||CS}function tG(n){return w0(l2,n)}function w0(n,e,t=!0,i=!1){const s=Qt||cn;if(s){const r=s.type;if(n===T0){const a=Z2(r,!1);if(a&&(a===e||a===ai(e)||a===Gd(ai(e))))return r}const o=bv(s[n]||r[n],e)||bv(s.appContext[n],e);return!o&&i?r:o}}function bv(n,e){return n&&(n[e]||n[ai(e)]||n[Gd(ai(e))])}function u2(n,e,t,i){let s;const r=t,o=ze(n);if(o||Ut(n)){const a=o&&Rs(n);let l=!1;a&&(l=!_i(n),n=qd(n)),s=new Array(n.length);for(let c=0,u=n.length;ce(a,l,void 0,r));else{const a=Object.keys(n);s=new Array(a.length);for(let l=0,c=a.length;ljl(e)?!(e.type===Fn||e.type===jt&&!RS(e.children)):!0)?n:null}function nG(n,e){const t={};for(const i in n)t[pf(i)]=n[i];return t}const Qm=n=>n?ZS(n)?eh(n):Qm(n.parent):null,bl=nn(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>Qm(n.parent),$root:n=>Qm(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>LS(n),$forceUpdate:n=>n.f||(n.f=()=>{E0(n.update)}),$nextTick:n=>n.n||(n.n=Er.bind(n.proxy)),$watch:n=>L2.bind(n)}),dp=(n,e)=>n!==vt&&!n.__isScriptSetup&&St(n,e),d2={get({_:n},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:s,props:r,accessCache:o,type:a,appContext:l}=n;let c;if(e[0]!=="$"){const h=o[e];if(h!==void 0)switch(h){case 1:return i[e];case 2:return s[e];case 4:return t[e];case 3:return r[e]}else{if(dp(i,e))return o[e]=1,i[e];if(s!==vt&&St(s,e))return o[e]=2,s[e];if((c=n.propsOptions[0])&&St(c,e))return o[e]=3,r[e];if(t!==vt&&St(t,e))return o[e]=4,t[e];eg&&(o[e]=0)}}const u=bl[e];let f,d;if(u)return e==="$attrs"&&Mn(n.attrs,"get",""),u(n);if((f=a.__cssModules)&&(f=f[e]))return f;if(t!==vt&&St(t,e))return o[e]=4,t[e];if(d=l.config.globalProperties,St(d,e))return d[e]},set({_:n},e,t){const{data:i,setupState:s,ctx:r}=n;return dp(s,e)?(s[e]=t,!0):i!==vt&&St(i,e)?(i[e]=t,!0):St(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(r[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:s,propsOptions:r}},o){let a;return!!t[o]||n!==vt&&St(n,o)||dp(e,o)||(a=r[0])&&St(a,o)||St(i,o)||St(bl,o)||St(s.config.globalProperties,o)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:St(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};function A0(){return PS().slots}function iG(){return PS().attrs}function PS(){const n=wn();return n.setupContext||(n.setupContext=QS(n))}function $l(n){return ze(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}function sG(n,e){const t=$l(n);for(const i in e){if(i.startsWith("__skip"))continue;let s=t[i];s?ze(s)||Ke(s)?s=t[i]={type:s,default:e[i]}:s.default=e[i]:s===null&&(s=t[i]={default:e[i]}),s&&e[`__skip_${i}`]&&(s.skipFactory=!0)}return t}function rG(n,e){return!n||!e?n||e:ze(n)&&ze(e)?n.concat(e):nn({},$l(n),$l(e))}let eg=!0;function h2(n){const e=LS(n),t=n.proxy,i=n.ctx;eg=!1,e.beforeCreate&&xv(e.beforeCreate,n,"bc");const{data:s,computed:r,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:d,beforeUpdate:h,updated:p,activated:_,deactivated:g,beforeDestroy:m,beforeUnmount:y,destroyed:b,unmounted:v,render:T,renderTracked:E,renderTriggered:S,errorCaptured:P,serverPrefetch:x,expose:M,inheritAttrs:L,components:F,directives:H,filters:Y}=e;if(c&&p2(c,i,null),o)for(const Q in o){const Z=o[Q];Ke(Z)&&(i[Q]=Z.bind(t))}if(s){const Q=s.call(t,t);It(Q)&&(n.data=bi(Q))}if(eg=!0,r)for(const Q in r){const Z=r[Q],he=Ke(Z)?Z.bind(t,t):Ke(Z.get)?Z.get.bind(t,t):Ki,be=!Ke(Z)&&Ke(Z.set)?Z.set.bind(t):Ki,se=Ee({get:he,set:be});Object.defineProperty(i,Q,{enumerable:!0,configurable:!0,get:()=>se.value,set:ye=>se.value=ye})}if(a)for(const Q in a)IS(a[Q],i,t,Q);if(l){const Q=Ke(l)?l.call(t):l;Reflect.ownKeys(Q).forEach(Z=>{dr(Z,Q[Z])})}u&&xv(u,n,"c");function K(Q,Z){ze(Z)?Z.forEach(he=>Q(he.bind(t))):Z&&Q(Z.bind(t))}if(K(t2,f),K(Hn,d),K(n2,h),K(i2,p),K(JC,_),K(QC,g),K(a2,P),K(o2,E),K(r2,S),K(AS,y),K(ns,v),K(s2,x),ze(M))if(M.length){const Q=n.exposed||(n.exposed={});M.forEach(Z=>{Object.defineProperty(Q,Z,{get:()=>t[Z],set:he=>t[Z]=he})})}else n.exposed||(n.exposed={});T&&n.render===Ki&&(n.render=T),L!=null&&(n.inheritAttrs=L),F&&(n.components=F),H&&(n.directives=H),x&&TS(n)}function p2(n,e,t=Ki){ze(n)&&(n=tg(n));for(const i in n){const s=n[i];let r;It(s)?"default"in s?r=En(s.from||i,s.default,!0):r=En(s.from||i):r=En(s),Pt(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function xv(n,e,t){Fi(ze(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function IS(n,e,t,i){let s=i.includes(".")?XS(t,i):()=>t[i];if(Ut(n)){const r=e[n];Ke(r)&&$e(s,r)}else if(Ke(n))$e(s,n.bind(t));else if(It(n))if(ze(n))n.forEach(r=>IS(r,e,t,i));else{const r=Ke(n.handler)?n.handler.bind(t):e[n.handler];Ke(r)&&$e(s,r,n)}}function LS(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:s,optionsCache:r,config:{optionMergeStrategies:o}}=n.appContext,a=r.get(e);let l;return a?l=a:!s.length&&!t&&!i?l=e:(l={},s.length&&s.forEach(c=>Ff(l,c,o,!0)),Ff(l,e,o)),It(e)&&r.set(e,l),l}function Ff(n,e,t,i=!1){const{mixins:s,extends:r}=e;r&&Ff(n,r,t,!0),s&&s.forEach(o=>Ff(n,o,t,!0));for(const o in e)if(!(i&&o==="expose")){const a=m2[o]||t&&t[o];n[o]=a?a(n[o],e[o]):e[o]}return n}const m2={data:Mv,props:Sv,emits:Sv,methods:fl,computed:fl,beforeCreate:Pn,created:Pn,beforeMount:Pn,mounted:Pn,beforeUpdate:Pn,updated:Pn,beforeDestroy:Pn,beforeUnmount:Pn,destroyed:Pn,unmounted:Pn,activated:Pn,deactivated:Pn,errorCaptured:Pn,serverPrefetch:Pn,components:fl,directives:fl,watch:_2,provide:Mv,inject:g2};function Mv(n,e){return e?n?function(){return nn(Ke(n)?n.call(this,this):n,Ke(e)?e.call(this,this):e)}:e:n}function g2(n,e){return fl(tg(n),tg(e))}function tg(n){if(ze(n)){const e={};for(let t=0;t1)return t&&Ke(e)?e.call(i&&i.proxy):e}}function Cc(){return!!(cn||Qt||ho)}const OS={},NS=()=>Object.create(OS),US=n=>Object.getPrototypeOf(n)===OS;function b2(n,e,t,i=!1){const s={},r=NS();n.propsDefaults=Object.create(null),FS(n,e,s,r);for(const o in n.propsOptions[0])o in s||(s[o]=void 0);t?n.props=i?s:sS(s):n.type.props?n.props=s:n.props=r,n.attrs=r}function x2(n,e,t,i){const{props:s,attrs:r,vnode:{patchFlag:o}}=n,a=ut(s),[l]=n.propsOptions;let c=!1;if((i||o>0)&&!(o&16)){if(o&8){const u=n.vnode.dynamicProps;for(let f=0;f{l=!0;const[d,h]=kS(f,e,!0);nn(o,d),h&&a.push(...h)};!t&&e.mixins.length&&e.mixins.forEach(u),n.extends&&u(n.extends),n.mixins&&n.mixins.forEach(u)}if(!r&&!l)return It(n)&&i.set(n,ca),ca;if(ze(r))for(let u=0;un[0]==="_"||n==="$stable",C0=n=>ze(n)?n.map(qi):[qi(n)],S2=(n,e,t)=>{if(e._n)return e;const i=mS((...s)=>C0(e(...s)),t);return i._c=!1,i},zS=(n,e,t)=>{const i=n._ctx;for(const s in n){if(BS(s))continue;const r=n[s];if(Ke(r))e[s]=S2(s,r,i);else if(r!=null){const o=C0(r);e[s]=()=>o}}},VS=(n,e)=>{const t=C0(e);n.slots.default=()=>t},HS=(n,e,t)=>{for(const i in e)(t||i!=="_")&&(n[i]=e[i])},E2=(n,e,t)=>{const i=n.slots=NS();if(n.vnode.shapeFlag&32){const s=e._;s?(HS(i,e,t),t&&FM(i,"_",s,!0)):zS(e,i)}else e&&VS(n,e)},T2=(n,e,t)=>{const{vnode:i,slots:s}=n;let r=!0,o=vt;if(i.shapeFlag&32){const a=e._;a?t&&a===1?r=!1:HS(s,e,t):(r=!e.$stable,zS(e,s)),o=e}else e&&(VS(n,e),o={default:1});if(r)for(const a in s)!BS(a)&&o[a]==null&&delete s[a]},Dn=k2;function GS(n){return w2(n)}function w2(n,e){const t=Wd();t.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:d,setScopeId:h=Ki,insertStaticContent:p}=n,_=(k,z,R,te=null,G=null,W=null,C=void 0,I=null,N=!!z.dynamicChildren)=>{if(k===z)return;k&&!io(k,z)&&(te=X(k),ye(k,G,W,!0),k=null),z.patchFlag===-2&&(N=!1,z.dynamicChildren=null);const{type:A,ref:w,shapeFlag:U}=z;switch(A){case Ic:g(k,z,R,te);break;case Fn:m(k,z,R,te);break;case _f:k==null&&y(z,R,te,C);break;case jt:F(k,z,R,te,G,W,C,I,N);break;default:U&1?T(k,z,R,te,G,W,C,I,N):U&6?H(k,z,R,te,G,W,C,I,N):(U&64||U&128)&&A.process(k,z,R,te,G,W,C,I,N,ce)}w!=null&&G&&Uf(w,k&&k.ref,W,z||k,!z)},g=(k,z,R,te)=>{if(k==null)i(z.el=a(z.children),R,te);else{const G=z.el=k.el;z.children!==k.children&&c(G,z.children)}},m=(k,z,R,te)=>{k==null?i(z.el=l(z.children||""),R,te):z.el=k.el},y=(k,z,R,te)=>{[k.el,k.anchor]=p(k.children,z,R,te,k.el,k.anchor)},b=({el:k,anchor:z},R,te)=>{let G;for(;k&&k!==z;)G=d(k),i(k,R,te),k=G;i(z,R,te)},v=({el:k,anchor:z})=>{let R;for(;k&&k!==z;)R=d(k),s(k),k=R;s(z)},T=(k,z,R,te,G,W,C,I,N)=>{z.type==="svg"?C="svg":z.type==="math"&&(C="mathml"),k==null?E(z,R,te,G,W,C,I,N):x(k,z,G,W,C,I,N)},E=(k,z,R,te,G,W,C,I)=>{let N,A;const{props:w,shapeFlag:U,transition:O,dirs:V}=k;if(N=k.el=o(k.type,W,w&&w.is,w),U&8?u(N,k.children):U&16&&P(k.children,N,null,te,G,hp(k,W),C,I),V&&Or(k,null,te,"created"),S(N,k,k.scopeId,C,te),w){for(const ue in w)ue!=="value"&&!gl(ue)&&r(N,ue,null,w[ue],W,te);"value"in w&&r(N,"value",null,w.value,W),(A=w.onVnodeBeforeMount)&&Hi(A,te,k)}V&&Or(k,null,te,"beforeMount");const $=A2(G,O);$&&O.beforeEnter(N),i(N,z,R),((A=w&&w.onVnodeMounted)||$||V)&&Dn(()=>{A&&Hi(A,te,k),$&&O.enter(N),V&&Or(k,null,te,"mounted")},G)},S=(k,z,R,te,G)=>{if(R&&h(k,R),te)for(let W=0;W{for(let A=N;A{const I=z.el=k.el;let{patchFlag:N,dynamicChildren:A,dirs:w}=z;N|=k.patchFlag&16;const U=k.props||vt,O=z.props||vt;let V;if(R&&Nr(R,!1),(V=O.onVnodeBeforeUpdate)&&Hi(V,R,z,k),w&&Or(z,k,R,"beforeUpdate"),R&&Nr(R,!0),(U.innerHTML&&O.innerHTML==null||U.textContent&&O.textContent==null)&&u(I,""),A?M(k.dynamicChildren,A,I,R,te,hp(z,G),W):C||Z(k,z,I,null,R,te,hp(z,G),W,!1),N>0){if(N&16)L(I,U,O,R,G);else if(N&2&&U.class!==O.class&&r(I,"class",null,O.class,G),N&4&&r(I,"style",U.style,O.style,G),N&8){const $=z.dynamicProps;for(let ue=0;ue<$.length;ue++){const le=$[ue],Me=U[le],Be=O[le];(Be!==Me||le==="value")&&r(I,le,Me,Be,G,R)}}N&1&&k.children!==z.children&&u(I,z.children)}else!C&&A==null&&L(I,U,O,R,G);((V=O.onVnodeUpdated)||w)&&Dn(()=>{V&&Hi(V,R,z,k),w&&Or(z,k,R,"updated")},te)},M=(k,z,R,te,G,W,C)=>{for(let I=0;I{if(z!==R){if(z!==vt)for(const W in z)!gl(W)&&!(W in R)&&r(k,W,z[W],null,G,te);for(const W in R){if(gl(W))continue;const C=R[W],I=z[W];C!==I&&W!=="value"&&r(k,W,I,C,G,te)}"value"in R&&r(k,"value",z.value,R.value,G)}},F=(k,z,R,te,G,W,C,I,N)=>{const A=z.el=k?k.el:a(""),w=z.anchor=k?k.anchor:a("");let{patchFlag:U,dynamicChildren:O,slotScopeIds:V}=z;V&&(I=I?I.concat(V):V),k==null?(i(A,R,te),i(w,R,te),P(z.children||[],R,w,G,W,C,I,N)):U>0&&U&64&&O&&k.dynamicChildren?(M(k.dynamicChildren,O,R,G,W,C,I),(z.key!=null||G&&z===G.subTree)&&R0(k,z,!0)):Z(k,z,R,w,G,W,C,I,N)},H=(k,z,R,te,G,W,C,I,N)=>{z.slotScopeIds=I,k==null?z.shapeFlag&512?G.ctx.activate(z,R,te,C,N):Y(z,R,te,G,W,C,N):ee(k,z,N)},Y=(k,z,R,te,G,W,C)=>{const I=k.component=q2(k,te,G);if(Zd(k)&&(I.ctx.renderer=ce),Y2(I,!1,C),I.asyncDep){if(G&&G.registerDep(I,K,C),!k.el){const N=I.subTree=pn(Fn);m(null,N,z,R)}}else K(I,k,z,R,G,W,C)},ee=(k,z,R)=>{const te=z.component=k.component;if(U2(k,z,R))if(te.asyncDep&&!te.asyncResolved){Q(te,z,R);return}else te.next=z,te.update();else z.el=k.el,te.vnode=z},K=(k,z,R,te,G,W,C)=>{const I=()=>{if(k.isMounted){let{next:U,bu:O,u:V,parent:$,vnode:ue}=k;{const Te=WS(k);if(Te){U&&(U.el=ue.el,Q(k,U,C)),Te.asyncDep.then(()=>{k.isUnmounted||I()});return}}let le=U,Me;Nr(k,!1),U?(U.el=ue.el,Q(k,U,C)):U=ue,O&&mf(O),(Me=U.props&&U.props.onVnodeBeforeUpdate)&&Hi(Me,$,U,ue),Nr(k,!0);const Be=wv(k),me=k.subTree;k.subTree=Be,_(me,Be,f(me.el),X(me),k,G,W),U.el=Be.el,le===null&&F2(k,Be.el),V&&Dn(V,G),(Me=U.props&&U.props.onVnodeUpdated)&&Dn(()=>Hi(Me,$,U,ue),G)}else{let U;const{el:O,props:V}=z,{bm:$,m:ue,parent:le,root:Me,type:Be}=k,me=da(z);Nr(k,!1),$&&mf($),!me&&(U=V&&V.onVnodeBeforeMount)&&Hi(U,le,z),Nr(k,!0);{Me.ce&&Me.ce._injectChildStyle(Be);const Te=k.subTree=wv(k);_(null,Te,R,te,k,G,W),z.el=Te.el}if(ue&&Dn(ue,G),!me&&(U=V&&V.onVnodeMounted)){const Te=z;Dn(()=>Hi(U,le,Te),G)}(z.shapeFlag&256||le&&da(le.vnode)&&le.vnode.shapeFlag&256)&&k.a&&Dn(k.a,G),k.isMounted=!0,z=R=te=null}};k.scope.on();const N=k.effect=new HM(I);k.scope.off();const A=k.update=N.run.bind(N),w=k.job=N.runIfDirty.bind(N);w.i=k,w.id=k.uid,N.scheduler=()=>E0(w),Nr(k,!0),A()},Q=(k,z,R)=>{z.component=k;const te=k.vnode.props;k.vnode=z,k.next=null,x2(k,z.props,te,R),T2(k,z.children,R),Mr(),mv(k),Sr()},Z=(k,z,R,te,G,W,C,I,N=!1)=>{const A=k&&k.children,w=k?k.shapeFlag:0,U=z.children,{patchFlag:O,shapeFlag:V}=z;if(O>0){if(O&128){be(A,U,R,te,G,W,C,I,N);return}else if(O&256){he(A,U,R,te,G,W,C,I,N);return}}V&8?(w&16&&xe(A,G,W),U!==A&&u(R,U)):w&16?V&16?be(A,U,R,te,G,W,C,I,N):xe(A,G,W,!0):(w&8&&u(R,""),V&16&&P(U,R,te,G,W,C,I,N))},he=(k,z,R,te,G,W,C,I,N)=>{k=k||ca,z=z||ca;const A=k.length,w=z.length,U=Math.min(A,w);let O;for(O=0;Ow?xe(k,G,W,!0,!1,U):P(z,R,te,G,W,C,I,N,U)},be=(k,z,R,te,G,W,C,I,N)=>{let A=0;const w=z.length;let U=k.length-1,O=w-1;for(;A<=U&&A<=O;){const V=k[A],$=z[A]=N?rr(z[A]):qi(z[A]);if(io(V,$))_(V,$,R,null,G,W,C,I,N);else break;A++}for(;A<=U&&A<=O;){const V=k[U],$=z[O]=N?rr(z[O]):qi(z[O]);if(io(V,$))_(V,$,R,null,G,W,C,I,N);else break;U--,O--}if(A>U){if(A<=O){const V=O+1,$=VO)for(;A<=U;)ye(k[A],G,W,!0),A++;else{const V=A,$=A,ue=new Map;for(A=$;A<=O;A++){const Se=z[A]=N?rr(z[A]):qi(z[A]);Se.key!=null&&ue.set(Se.key,A)}let le,Me=0;const Be=O-$+1;let me=!1,Te=0;const Ve=new Array(Be);for(A=0;A=Be){ye(Se,G,W,!0);continue}let Je;if(Se.key!=null)Je=ue.get(Se.key);else for(le=$;le<=O;le++)if(Ve[le-$]===0&&io(Se,z[le])){Je=le;break}Je===void 0?ye(Se,G,W,!0):(Ve[Je-$]=A+1,Je>=Te?Te=Je:me=!0,_(Se,z[Je],R,null,G,W,C,I,N),Me++)}const We=me?C2(Ve):ca;for(le=We.length-1,A=Be-1;A>=0;A--){const Se=$+A,Je=z[Se],nt=Se+1{const{el:W,type:C,transition:I,children:N,shapeFlag:A}=k;if(A&6){se(k.component.subTree,z,R,te);return}if(A&128){k.suspense.move(z,R,te);return}if(A&64){C.move(k,z,R,ce);return}if(C===jt){i(W,z,R);for(let U=0;UI.enter(W),G);else{const{leave:U,delayLeave:O,afterLeave:V}=I,$=()=>i(W,z,R),ue=()=>{U(W,()=>{$(),V&&V()})};O?O(W,$,ue):ue()}else i(W,z,R)},ye=(k,z,R,te=!1,G=!1)=>{const{type:W,props:C,ref:I,children:N,dynamicChildren:A,shapeFlag:w,patchFlag:U,dirs:O,cacheIndex:V}=k;if(U===-2&&(G=!1),I!=null&&Uf(I,null,R,k,!0),V!=null&&(z.renderCache[V]=void 0),w&256){z.ctx.deactivate(k);return}const $=w&1&&O,ue=!da(k);let le;if(ue&&(le=C&&C.onVnodeBeforeUnmount)&&Hi(le,z,k),w&6)ge(k.component,R,te);else{if(w&128){k.suspense.unmount(R,te);return}$&&Or(k,null,z,"beforeUnmount"),w&64?k.type.remove(k,z,R,ce,te):A&&!A.hasOnce&&(W!==jt||U>0&&U&64)?xe(A,z,R,!1,!0):(W===jt&&U&384||!G&&w&16)&&xe(N,z,R),te&&He(k)}(ue&&(le=C&&C.onVnodeUnmounted)||$)&&Dn(()=>{le&&Hi(le,z,k),$&&Or(k,null,z,"unmounted")},R)},He=k=>{const{type:z,el:R,anchor:te,transition:G}=k;if(z===jt){re(R,te);return}if(z===_f){v(k);return}const W=()=>{s(R),G&&!G.persisted&&G.afterLeave&&G.afterLeave()};if(k.shapeFlag&1&&G&&!G.persisted){const{leave:C,delayLeave:I}=G,N=()=>C(R,W);I?I(k.el,W,N):N()}else W()},re=(k,z)=>{let R;for(;k!==z;)R=d(k),s(k),k=R;s(z)},ge=(k,z,R)=>{const{bum:te,scope:G,job:W,subTree:C,um:I,m:N,a:A}=k;Tv(N),Tv(A),te&&mf(te),G.stop(),W&&(W.flags|=8,ye(C,k,z,R)),I&&Dn(I,z),Dn(()=>{k.isUnmounted=!0},z),z&&z.pendingBranch&&!z.isUnmounted&&k.asyncDep&&!k.asyncResolved&&k.suspenseId===z.pendingId&&(z.deps--,z.deps===0&&z.resolve())},xe=(k,z,R,te=!1,G=!1,W=0)=>{for(let C=W;C{if(k.shapeFlag&6)return X(k.component.subTree);if(k.shapeFlag&128)return k.suspense.next();const z=d(k.anchor||k.el),R=z&&z[gS];return R?d(R):z};let ae=!1;const fe=(k,z,R)=>{k==null?z._vnode&&ye(z._vnode,null,null,!0):_(z._vnode||null,k,z,null,null,null,R),z._vnode=k,ae||(ae=!0,mv(),dS(),ae=!1)},ce={p:_,um:ye,m:se,r:He,mt:Y,mc:P,pc:Z,pbc:M,n:X,o:n};return{render:fe,hydrate:void 0,createApp:y2(fe)}}function hp({type:n,props:e},t){return t==="svg"&&n==="foreignObject"||t==="mathml"&&n==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Nr({effect:n,job:e},t){t?(n.flags|=32,e.flags|=4):(n.flags&=-33,e.flags&=-5)}function A2(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function R0(n,e,t=!1){const i=n.children,s=e.children;if(ze(i)&&ze(s))for(let r=0;r>1,n[t[a]]0&&(e[i]=t[r-1]),t[r]=i)}}for(r=t.length,o=t[r-1];r-- >0;)t[r]=o,o=e[o];return t}function WS(n){const e=n.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:WS(e)}function Tv(n){if(n)for(let e=0;eEn(R2);function Rc(n,e){return Pc(n,null,e)}function oG(n,e){return Pc(n,null,{flush:"post"})}function I2(n,e){return Pc(n,null,{flush:"sync"})}function $e(n,e,t){return Pc(n,e,t)}function Pc(n,e,t=vt){const{immediate:i,deep:s,flush:r,once:o}=t,a=nn({},t),l=e&&i||!e&&r!=="post";let c;if(Kl){if(r==="sync"){const h=P2();c=h.__watcherHandles||(h.__watcherHandles=[])}else if(!l){const h=()=>{};return h.stop=Ki,h.resume=Ki,h.pause=Ki,h}}const u=cn;a.call=(h,p,_)=>Fi(h,u,p,_);let f=!1;r==="post"?a.scheduler=h=>{Dn(h,u&&u.suspense)}:r!=="sync"&&(f=!0,a.scheduler=(h,p)=>{p?h():E0(h)}),a.augmentJob=h=>{e&&(h.flags|=4),f&&(h.flags|=2,u&&(h.id=u.uid,h.i=u))};const d=WC(n,e,a);return Kl&&(c?c.push(d):l&&d()),d}function L2(n,e,t){const i=this.proxy,s=Ut(n)?n.includes(".")?XS(i,n):()=>i[n]:n.bind(i,i);let r;Ke(e)?r=e:(r=e.handler,t=e);const o=Lc(this),a=Pc(s,r.bind(i),t);return o(),a}function XS(n,e){const t=e.split(".");return()=>{let i=n;for(let s=0;s{let u,f=vt,d;return I2(()=>{const h=n[s];Yn(u,h)&&(u=h,c())}),{get(){return l(),t.get?t.get(u):u},set(h){const p=t.set?t.set(h):h;if(!Yn(p,u)&&!(f!==vt&&Yn(h,f)))return;const _=i.vnode.props;_&&(e in _||s in _||r in _)&&(`onUpdate:${e}`in _||`onUpdate:${s}`in _||`onUpdate:${r}`in _)||(u=h,c()),i.emit(`update:${e}`,p),Yn(h,p)&&Yn(h,f)&&!Yn(p,d)&&c(),f=h,d=p}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||vt:a,done:!1}:{done:!0}}}},a}const $S=(n,e)=>e==="modelValue"||e==="model-value"?n.modelModifiers:n[`${e}Modifiers`]||n[`${ai(e)}Modifiers`]||n[`${ks(e)}Modifiers`];function D2(n,e,...t){if(n.isUnmounted)return;const i=n.vnode.props||vt;let s=t;const r=e.startsWith("update:"),o=r&&$S(i,e.slice(7));o&&(o.trim&&(s=t.map(u=>Ut(u)?u.trim():u)),o.number&&(s=t.map(If)));let a,l=i[a=pf(e)]||i[a=pf(ai(e))];!l&&r&&(l=i[a=pf(ks(e))]),l&&Fi(l,n,6,s);const c=i[a+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[a])return;n.emitted[a]=!0,Fi(c,n,6,s)}}function qS(n,e,t=!1){const i=e.emitsCache,s=i.get(n);if(s!==void 0)return s;const r=n.emits;let o={},a=!1;if(!Ke(n)){const l=c=>{const u=qS(c,e,!0);u&&(a=!0,nn(o,u))};!t&&e.mixins.length&&e.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!r&&!a?(It(n)&&i.set(n,null),null):(ze(r)?r.forEach(l=>o[l]=null):nn(o,r),It(n)&&i.set(n,o),o)}function Qd(n,e){return!n||!Vd(e)?!1:(e=e.slice(2).replace(/Once$/,""),St(n,e[0].toLowerCase()+e.slice(1))||St(n,ks(e))||St(n,e))}function wv(n){const{type:e,vnode:t,proxy:i,withProxy:s,propsOptions:[r],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:d,setupState:h,ctx:p,inheritAttrs:_}=n,g=Nf(n);let m,y;try{if(t.shapeFlag&4){const v=s||i,T=v;m=qi(c.call(T,v,u,f,h,d,p)),y=a}else{const v=e;m=qi(v.length>1?v(f,{attrs:a,slots:o,emit:l}):v(f,null)),y=e.props?a:O2(a)}}catch(v){xl.length=0,Kd(v,n,1),m=pn(Fn)}let b=m;if(y&&_!==!1){const v=Object.keys(y),{shapeFlag:T}=b;v.length&&T&7&&(r&&v.some(d0)&&(y=N2(y,r)),b=pr(b,y,!1,!0))}return t.dirs&&(b=pr(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(t.dirs):t.dirs),t.transition&&Xl(b,t.transition),m=b,Nf(g),m}const O2=n=>{let e;for(const t in n)(t==="class"||t==="style"||Vd(t))&&((e||(e={}))[t]=n[t]);return e},N2=(n,e)=>{const t={};for(const i in n)(!d0(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function U2(n,e,t){const{props:i,children:s,component:r}=n,{props:o,children:a,patchFlag:l}=e,c=r.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return i?Av(i,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;fn.__isSuspense;function k2(n,e){e&&e.pendingBranch?ze(n)?e.effects.push(...n):e.effects.push(n):qC(n)}const jt=Symbol.for("v-fgt"),Ic=Symbol.for("v-txt"),Fn=Symbol.for("v-cmt"),_f=Symbol.for("v-stc"),xl=[];let si=null;function mn(n=!1){xl.push(si=n?null:[])}function B2(){xl.pop(),si=xl[xl.length-1]||null}let ql=1;function Cv(n,e=!1){ql+=n,n<0&&si&&e&&(si.hasOnce=!0)}function jS(n){return n.dynamicChildren=ql>0?si||ca:null,B2(),ql>0&&si&&si.push(n),n}function vi(n,e,t,i,s,r){return jS(sr(n,e,t,i,s,r,!0))}function Yl(n,e,t,i,s){return jS(pn(n,e,t,i,s,!0))}function jl(n){return n?n.__v_isVNode===!0:!1}function io(n,e){return n.type===e.type&&n.key===e.key}const KS=({key:n})=>n??null,vf=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?Ut(n)||Pt(n)||Ke(n)?{i:Qt,r:n,k:e,f:!!t}:n:null);function sr(n,e=null,t=null,i=0,s=null,r=n===jt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&KS(e),ref:e&&vf(e),scopeId:pS,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Qt};return a?(P0(l,t),r&128&&n.normalize(l)):t&&(l.shapeFlag|=Ut(t)?8:16),ql>0&&!o&&si&&(l.patchFlag>0||r&6)&&l.patchFlag!==32&&si.push(l),l}const pn=z2;function z2(n,e=null,t=null,i=0,s=null,r=!1){if((!n||n===CS)&&(n=Fn),jl(n)){const a=pr(n,e,!0);return t&&P0(a,t),ql>0&&!r&&si&&(a.shapeFlag&6?si[si.indexOf(n)]=a:si.push(a)),a.patchFlag=-2,a}if(J2(n)&&(n=n.__vccOpts),e){e=V2(e);let{class:a,style:l}=e;a&&!Ut(a)&&(e.class=Oa(a)),It(l)&&(x0(l)&&!ze(l)&&(l=nn({},l)),e.style=Si(l))}const o=Ut(n)?1:YS(n)?128:_S(n)?64:It(n)?4:Ke(n)?2:0;return sr(n,e,t,i,s,o,r,!0)}function V2(n){return n?x0(n)||US(n)?nn({},n):n:null}function pr(n,e,t=!1,i=!1){const{props:s,ref:r,patchFlag:o,children:a,transition:l}=n,c=e?W2(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:n.type,props:c,key:c&&KS(c),ref:e&&e.ref?t&&r?ze(r)?r.concat(vf(e)):[r,vf(e)]:vf(e):r,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:a,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==jt?o===-1?16:o|16:o,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:l,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&pr(n.ssContent),ssFallback:n.ssFallback&&pr(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return l&&i&&Xl(u,l.clone(u)),u}function H2(n=" ",e=0){return pn(Ic,null,n,e)}function G2(n,e){const t=pn(_f,null,n);return t.staticCount=e,t}function Rv(n="",e=!1){return e?(mn(),Yl(Fn,null,n)):pn(Fn,null,n)}function qi(n){return n==null||typeof n=="boolean"?pn(Fn):ze(n)?pn(jt,null,n.slice()):jl(n)?rr(n):pn(Ic,null,String(n))}function rr(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:pr(n)}function P0(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(ze(e))t=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),P0(n,s()),s._c&&(s._d=!0));return}else{t=32;const s=e._;!s&&!US(e)?e._ctx=Qt:s===3&&Qt&&(Qt.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else Ke(e)?(e={default:e,_ctx:Qt},t=32):(e=String(e),i&64?(t=16,e=[H2(e)]):t=8);n.children=e,n.shapeFlag|=t}function W2(...n){const e={};for(let t=0;tcn||Qt;let kf,ig;{const n=Wd(),e=(t,i)=>{let s;return(s=n[t])||(s=n[t]=[]),s.push(i),r=>{s.length>1?s.forEach(o=>o(r)):s[0](r)}};kf=e("__VUE_INSTANCE_SETTERS__",t=>cn=t),ig=e("__VUE_SSR_SETTERS__",t=>Kl=t)}const Lc=n=>{const e=cn;return kf(n),n.scope.on(),()=>{n.scope.off(),kf(e)}},Pv=()=>{cn&&cn.scope.off(),kf(null)};function ZS(n){return n.vnode.shapeFlag&4}let Kl=!1;function Y2(n,e=!1,t=!1){e&&ig(e);const{props:i,children:s}=n.vnode,r=ZS(n);b2(n,i,r,e),E2(n,s,t);const o=r?j2(n,e):void 0;return e&&ig(!1),o}function j2(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,d2);const{setup:i}=t;if(i){Mr();const s=n.setupContext=i.length>1?QS(n):null,r=Lc(n),o=Ac(i,n,0,[n.props,s]),a=OM(o);if(Sr(),r(),(a||n.sp)&&!da(n)&&TS(n),a){if(o.then(Pv,Pv),e)return o.then(l=>{Iv(n,l)}).catch(l=>{Kd(l,n,0)});n.asyncDep=o}else Iv(n,o)}else JS(n)}function Iv(n,e,t){Ke(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:It(e)&&(n.setupState=oS(e)),JS(n)}function JS(n,e,t){const i=n.type;n.render||(n.render=i.render||Ki);{const s=Lc(n);Mr();try{h2(n)}finally{Sr(),s()}}}const K2={get(n,e){return Mn(n,"get",""),n[e]}};function QS(n){const e=t=>{n.exposed=t||{}};return{attrs:new Proxy(n.attrs,K2),slots:n.slots,emit:n.emit,expose:e}}function eh(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(oS(M0(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in bl)return bl[t](n)},has(e,t){return t in e||t in bl}})):n.proxy}function Z2(n,e=!0){return Ke(n)?n.displayName||n.name:n.name||e&&n.__name}function J2(n){return Ke(n)&&"__vccOpts"in n}const Ee=(n,e)=>HC(n,e,Kl);function Ds(n,e,t){const i=arguments.length;return i===2?It(e)&&!ze(e)?jl(e)?pn(n,null,[e]):pn(n,e):pn(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&jl(t)&&(t=[t]),pn(n,e,t))}const Q2="3.5.13";/** +**/function Ac(n,e,t,i){try{return i?n(...i):n()}catch(s){Kd(s,e,t)}}function Fi(n,e,t,i){if(Ke(n)){const s=Ac(n,e,t,i);return s&&OM(s)&&s.catch(r=>{Kd(r,e,t)}),s}if(ze(n)){const s=[];for(let r=0;r>>1,s=Un[i],r=Wl(s);r=Wl(t)?Un.push(n):Un.splice(qC(e),0,n),n.flags|=1,dS()}}function dS(){Of||(Of=fS.then(pS))}function YC(n){ze(n)?fa.push(...n):nr&&n.id===-1?nr.splice(ta+1,0,n):n.flags&1||(fa.push(n),n.flags|=1),dS()}function mv(n,e,t=Wi+1){for(;tWl(t)-Wl(i));if(fa.length=0,nr){nr.push(...e);return}for(nr=e,ta=0;tan.id==null?n.flags&2?-1:1/0:n.id;function pS(n){try{for(Wi=0;Wi{i._d&&Cv(-1);const r=Nf(e);let o;try{o=n(...s)}finally{Nf(r),i._d&&Cv(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function Z9(n,e){if(Qt===null)return n;const t=eh(Qt),i=n.dirs||(n.dirs=[]);for(let s=0;sn.__isTeleport,yl=n=>n&&(n.disabled||n.disabled===""),gv=n=>n&&(n.defer||n.defer===""),_v=n=>typeof SVGElement<"u"&&n instanceof SVGElement,vv=n=>typeof MathMLElement=="function"&&n instanceof MathMLElement,Zm=(n,e)=>{const t=n&&n.to;return Ut(t)?e?e(t):null:t},yS={name:"Teleport",__isTeleport:!0,process(n,e,t,i,s,r,o,a,l,c){const{mc:u,pc:f,pbc:d,o:{insert:h,querySelector:p,createText:_,createComment:g}}=c,m=yl(e.props);let{shapeFlag:y,children:b,dynamicChildren:v}=e;if(n==null){const T=e.el=_(""),E=e.anchor=_("");h(T,t,i),h(E,t,i);const S=(x,M)=>{y&16&&(s&&s.isCE&&(s.ce._teleportTarget=x),u(b,x,M,s,r,o,a,l))},P=()=>{const x=e.target=Zm(e.props,p),M=bS(x,e,_,h);x&&(o!=="svg"&&_v(x)?o="svg":o!=="mathml"&&vv(x)&&(o="mathml"),m||(S(x,M),gf(e,!1)))};m&&(S(t,E),gf(e,!0)),gv(e.props)?Dn(()=>{P(),e.el.__isMounted=!0},r):P()}else{if(gv(e.props)&&!n.el.__isMounted){Dn(()=>{yS.process(n,e,t,i,s,r,o,a,l,c),delete n.el.__isMounted},r);return}e.el=n.el,e.targetStart=n.targetStart;const T=e.anchor=n.anchor,E=e.target=n.target,S=e.targetAnchor=n.targetAnchor,P=yl(n.props),x=P?t:E,M=P?T:S;if(o==="svg"||_v(E)?o="svg":(o==="mathml"||vv(E))&&(o="mathml"),v?(d(n.dynamicChildren,v,x,s,r,o,a),R0(n,e,!0)):l||f(n,e,x,M,s,r,o,a,!1),m)P?e.props&&n.props&&e.props.to!==n.props.to&&(e.props.to=n.props.to):ru(e,t,T,c,1);else if((e.props&&e.props.to)!==(n.props&&n.props.to)){const L=e.target=Zm(e.props,p);L&&ru(e,L,null,c,0)}else P&&ru(e,E,S,c,1);gf(e,m)}},remove(n,e,t,{um:i,o:{remove:s}},r){const{shapeFlag:o,children:a,anchor:l,targetStart:c,targetAnchor:u,target:f,props:d}=n;if(f&&(s(c),s(u)),r&&s(l),o&16){const h=r||!yl(d);for(let p=0;p{n.isMounted=!0}),CS(()=>{n.isUnmounting=!0}),n}const di=[Function,Array],xS={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:di,onEnter:di,onAfterEnter:di,onEnterCancelled:di,onBeforeLeave:di,onLeave:di,onAfterLeave:di,onLeaveCancelled:di,onBeforeAppear:di,onAppear:di,onAfterAppear:di,onAppearCancelled:di},MS=n=>{const e=n.subTree;return e.component?MS(e.component):e},ZC={name:"BaseTransition",props:xS,setup(n,{slots:e}){const t=wn(),i=KC();return()=>{const s=e.default&&TS(e.default(),!0);if(!s||!s.length)return;const r=SS(s),o=ut(n),{mode:a}=o;if(i.isLeaving)return fp(r);const l=yv(r);if(!l)return fp(r);let c=Jm(l,o,i,t,f=>c=f);l.type!==Fn&&Xl(l,c);let u=t.subTree&&yv(t.subTree);if(u&&u.type!==Fn&&!io(l,u)&&MS(t).type!==Fn){let f=Jm(u,o,i,t);if(Xl(u,f),a==="out-in"&&l.type!==Fn)return i.isLeaving=!0,f.afterLeave=()=>{i.isLeaving=!1,t.job.flags&8||t.update(),delete f.afterLeave,u=void 0},fp(r);a==="in-out"&&l.type!==Fn?f.delayLeave=(d,h,p)=>{const _=ES(i,u);_[String(u.key)]=u,d[ir]=()=>{h(),d[ir]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{p(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return r}}};function SS(n){let e=n[0];if(n.length>1){for(const t of n)if(t.type!==Fn){e=t;break}}return e}const JC=ZC;function ES(n,e){const{leavingVNodes:t}=n;let i=t.get(e.type);return i||(i=Object.create(null),t.set(e.type,i)),i}function Jm(n,e,t,i,s){const{appear:r,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:f,onBeforeLeave:d,onLeave:h,onAfterLeave:p,onLeaveCancelled:_,onBeforeAppear:g,onAppear:m,onAfterAppear:y,onAppearCancelled:b}=e,v=String(n.key),T=ES(t,n),E=(x,M)=>{x&&Fi(x,i,9,M)},S=(x,M)=>{const L=M[1];E(x,M),ze(x)?x.every(F=>F.length<=1)&&L():x.length<=1&&L()},P={mode:o,persisted:a,beforeEnter(x){let M=l;if(!t.isMounted)if(r)M=g||l;else return;x[ir]&&x[ir](!0);const L=T[v];L&&io(n,L)&&L.el[ir]&&L.el[ir](),E(M,[x])},enter(x){let M=c,L=u,F=f;if(!t.isMounted)if(r)M=m||c,L=y||u,F=b||f;else return;let H=!1;const Y=x[ou]=ee=>{H||(H=!0,ee?E(F,[x]):E(L,[x]),P.delayedLeave&&P.delayedLeave(),x[ou]=void 0)};M?S(M,[x,Y]):Y()},leave(x,M){const L=String(n.key);if(x[ou]&&x[ou](!0),t.isUnmounting)return M();E(d,[x]);let F=!1;const H=x[ir]=Y=>{F||(F=!0,M(),Y?E(_,[x]):E(p,[x]),x[ir]=void 0,T[L]===n&&delete T[L])};T[L]=n,h?S(h,[x,H]):H()},clone(x){const M=Jm(x,e,t,i,s);return s&&s(M),M}};return P}function fp(n){if(Zd(n))return n=pr(n),n.children=null,n}function yv(n){if(!Zd(n))return vS(n.type)&&n.children?SS(n.children):n;const{shapeFlag:e,children:t}=n;if(t){if(e&16)return t[0];if(e&32&&Ke(t.default))return t.default()}}function Xl(n,e){n.shapeFlag&6&&n.component?(n.transition=e,Xl(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function TS(n,e=!1,t){let i=[],s=0;for(let r=0;r1)for(let r=0;rUf(p,e&&(ze(e)?e[_]:e),t,i,s));return}if(da(i)&&!s){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Uf(n,e,t,i.component.subTree);return}const r=i.shapeFlag&4?eh(i.component):i.el,o=s?null:r,{i:a,r:l}=n,c=e&&e.r,u=a.refs===vt?a.refs={}:a.refs,f=a.setupState,d=ut(f),h=f===vt?()=>!1:p=>St(d,p);if(c!=null&&c!==l&&(Ut(c)?(u[c]=null,h(c)&&(f[c]=null)):Pt(c)&&(c.value=null)),Ke(l))Ac(l,a,12,[o,u]);else{const p=Ut(l),_=Pt(l);if(p||_){const g=()=>{if(n.f){const m=p?h(l)?f[l]:u[l]:l.value;s?ze(m)&&h0(m,r):ze(m)?m.includes(r)||m.push(r):p?(u[l]=[r],h(l)&&(f[l]=u[l])):(l.value=[r],n.k&&(u[n.k]=l.value))}else p?(u[l]=o,h(l)&&(f[l]=o)):_&&(l.value=o,n.k&&(u[n.k]=o))};o?(g.id=-1,Dn(g,t)):g()}}}Wd().requestIdleCallback;Wd().cancelIdleCallback;const da=n=>!!n.type.__asyncLoader,Zd=n=>n.type.__isKeepAlive;function QC(n,e){AS(n,"a",e)}function e2(n,e){AS(n,"da",e)}function AS(n,e,t=cn){const i=n.__wdc||(n.__wdc=()=>{let s=t;for(;s;){if(s.isDeactivated)return;s=s.parent}return n()});if(Jd(e,i,t),t){let s=t.parent;for(;s&&s.parent;)Zd(s.parent.vnode)&&t2(i,e,t,s),s=s.parent}}function t2(n,e,t,i){const s=Jd(e,n,i,!0);ns(()=>{h0(i[e],s)},t)}function Jd(n,e,t=cn,i=!1){if(t){const s=t[n]||(t[n]=[]),r=e.__weh||(e.__weh=(...o)=>{Mr();const a=Lc(t),l=Fi(e,t,n,o);return a(),Sr(),l});return i?s.unshift(r):s.push(r),r}}const Bs=n=>(e,t=cn)=>{(!Kl||n==="sp")&&Jd(n,(...i)=>e(...i),t)},n2=Bs("bm"),Hn=Bs("m"),i2=Bs("bu"),s2=Bs("u"),CS=Bs("bum"),ns=Bs("um"),r2=Bs("sp"),o2=Bs("rtg"),a2=Bs("rtc");function l2(n,e=cn){Jd("ec",n,e)}const T0="components",c2="directives";function eG(n,e){return w0(T0,n,!0,e)||n}const RS=Symbol.for("v-ndc");function u2(n){return Ut(n)?w0(T0,n,!1)||n:n||RS}function tG(n){return w0(c2,n)}function w0(n,e,t=!0,i=!1){const s=Qt||cn;if(s){const r=s.type;if(n===T0){const a=J2(r,!1);if(a&&(a===e||a===ai(e)||a===Gd(ai(e))))return r}const o=bv(s[n]||r[n],e)||bv(s.appContext[n],e);return!o&&i?r:o}}function bv(n,e){return n&&(n[e]||n[ai(e)]||n[Gd(ai(e))])}function f2(n,e,t,i){let s;const r=t,o=ze(n);if(o||Ut(n)){const a=o&&Rs(n);let l=!1;a&&(l=!_i(n),n=qd(n)),s=new Array(n.length);for(let c=0,u=n.length;ce(a,l,void 0,r));else{const a=Object.keys(n);s=new Array(a.length);for(let l=0,c=a.length;ljl(e)?!(e.type===Fn||e.type===jt&&!PS(e.children)):!0)?n:null}function nG(n,e){const t={};for(const i in n)t[pf(i)]=n[i];return t}const Qm=n=>n?JS(n)?eh(n):Qm(n.parent):null,bl=nn(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>Qm(n.parent),$root:n=>Qm(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>DS(n),$forceUpdate:n=>n.f||(n.f=()=>{E0(n.update)}),$nextTick:n=>n.n||(n.n=Er.bind(n.proxy)),$watch:n=>D2.bind(n)}),dp=(n,e)=>n!==vt&&!n.__isScriptSetup&&St(n,e),h2={get({_:n},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:s,props:r,accessCache:o,type:a,appContext:l}=n;let c;if(e[0]!=="$"){const h=o[e];if(h!==void 0)switch(h){case 1:return i[e];case 2:return s[e];case 4:return t[e];case 3:return r[e]}else{if(dp(i,e))return o[e]=1,i[e];if(s!==vt&&St(s,e))return o[e]=2,s[e];if((c=n.propsOptions[0])&&St(c,e))return o[e]=3,r[e];if(t!==vt&&St(t,e))return o[e]=4,t[e];eg&&(o[e]=0)}}const u=bl[e];let f,d;if(u)return e==="$attrs"&&Mn(n.attrs,"get",""),u(n);if((f=a.__cssModules)&&(f=f[e]))return f;if(t!==vt&&St(t,e))return o[e]=4,t[e];if(d=l.config.globalProperties,St(d,e))return d[e]},set({_:n},e,t){const{data:i,setupState:s,ctx:r}=n;return dp(s,e)?(s[e]=t,!0):i!==vt&&St(i,e)?(i[e]=t,!0):St(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(r[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:s,propsOptions:r}},o){let a;return!!t[o]||n!==vt&&St(n,o)||dp(e,o)||(a=r[0])&&St(a,o)||St(i,o)||St(bl,o)||St(s.config.globalProperties,o)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:St(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};function A0(){return IS().slots}function iG(){return IS().attrs}function IS(){const n=wn();return n.setupContext||(n.setupContext=e1(n))}function $l(n){return ze(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}function sG(n,e){const t=$l(n);for(const i in e){if(i.startsWith("__skip"))continue;let s=t[i];s?ze(s)||Ke(s)?s=t[i]={type:s,default:e[i]}:s.default=e[i]:s===null&&(s=t[i]={default:e[i]}),s&&e[`__skip_${i}`]&&(s.skipFactory=!0)}return t}function rG(n,e){return!n||!e?n||e:ze(n)&&ze(e)?n.concat(e):nn({},$l(n),$l(e))}let eg=!0;function p2(n){const e=DS(n),t=n.proxy,i=n.ctx;eg=!1,e.beforeCreate&&xv(e.beforeCreate,n,"bc");const{data:s,computed:r,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:d,beforeUpdate:h,updated:p,activated:_,deactivated:g,beforeDestroy:m,beforeUnmount:y,destroyed:b,unmounted:v,render:T,renderTracked:E,renderTriggered:S,errorCaptured:P,serverPrefetch:x,expose:M,inheritAttrs:L,components:F,directives:H,filters:Y}=e;if(c&&m2(c,i,null),o)for(const Q in o){const Z=o[Q];Ke(Z)&&(i[Q]=Z.bind(t))}if(s){const Q=s.call(t,t);It(Q)&&(n.data=bi(Q))}if(eg=!0,r)for(const Q in r){const Z=r[Q],he=Ke(Z)?Z.bind(t,t):Ke(Z.get)?Z.get.bind(t,t):Ki,be=!Ke(Z)&&Ke(Z.set)?Z.set.bind(t):Ki,se=Ee({get:he,set:be});Object.defineProperty(i,Q,{enumerable:!0,configurable:!0,get:()=>se.value,set:ye=>se.value=ye})}if(a)for(const Q in a)LS(a[Q],i,t,Q);if(l){const Q=Ke(l)?l.call(t):l;Reflect.ownKeys(Q).forEach(Z=>{dr(Z,Q[Z])})}u&&xv(u,n,"c");function K(Q,Z){ze(Z)?Z.forEach(he=>Q(he.bind(t))):Z&&Q(Z.bind(t))}if(K(n2,f),K(Hn,d),K(i2,h),K(s2,p),K(QC,_),K(e2,g),K(l2,P),K(a2,E),K(o2,S),K(CS,y),K(ns,v),K(r2,x),ze(M))if(M.length){const Q=n.exposed||(n.exposed={});M.forEach(Z=>{Object.defineProperty(Q,Z,{get:()=>t[Z],set:he=>t[Z]=he})})}else n.exposed||(n.exposed={});T&&n.render===Ki&&(n.render=T),L!=null&&(n.inheritAttrs=L),F&&(n.components=F),H&&(n.directives=H),x&&wS(n)}function m2(n,e,t=Ki){ze(n)&&(n=tg(n));for(const i in n){const s=n[i];let r;It(s)?"default"in s?r=En(s.from||i,s.default,!0):r=En(s.from||i):r=En(s),Pt(r)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[i]=r}}function xv(n,e,t){Fi(ze(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function LS(n,e,t,i){let s=i.includes(".")?$S(t,i):()=>t[i];if(Ut(n)){const r=e[n];Ke(r)&&$e(s,r)}else if(Ke(n))$e(s,n.bind(t));else if(It(n))if(ze(n))n.forEach(r=>LS(r,e,t,i));else{const r=Ke(n.handler)?n.handler.bind(t):e[n.handler];Ke(r)&&$e(s,r,n)}}function DS(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:s,optionsCache:r,config:{optionMergeStrategies:o}}=n.appContext,a=r.get(e);let l;return a?l=a:!s.length&&!t&&!i?l=e:(l={},s.length&&s.forEach(c=>Ff(l,c,o,!0)),Ff(l,e,o)),It(e)&&r.set(e,l),l}function Ff(n,e,t,i=!1){const{mixins:s,extends:r}=e;r&&Ff(n,r,t,!0),s&&s.forEach(o=>Ff(n,o,t,!0));for(const o in e)if(!(i&&o==="expose")){const a=g2[o]||t&&t[o];n[o]=a?a(n[o],e[o]):e[o]}return n}const g2={data:Mv,props:Sv,emits:Sv,methods:fl,computed:fl,beforeCreate:Pn,created:Pn,beforeMount:Pn,mounted:Pn,beforeUpdate:Pn,updated:Pn,beforeDestroy:Pn,beforeUnmount:Pn,destroyed:Pn,unmounted:Pn,activated:Pn,deactivated:Pn,errorCaptured:Pn,serverPrefetch:Pn,components:fl,directives:fl,watch:v2,provide:Mv,inject:_2};function Mv(n,e){return e?n?function(){return nn(Ke(n)?n.call(this,this):n,Ke(e)?e.call(this,this):e)}:e:n}function _2(n,e){return fl(tg(n),tg(e))}function tg(n){if(ze(n)){const e={};for(let t=0;t1)return t&&Ke(e)?e.call(i&&i.proxy):e}}function Cc(){return!!(cn||Qt||ho)}const NS={},US=()=>Object.create(NS),FS=n=>Object.getPrototypeOf(n)===NS;function x2(n,e,t,i=!1){const s={},r=US();n.propsDefaults=Object.create(null),kS(n,e,s,r);for(const o in n.propsOptions[0])o in s||(s[o]=void 0);t?n.props=i?s:sS(s):n.type.props?n.props=s:n.props=r,n.attrs=r}function M2(n,e,t,i){const{props:s,attrs:r,vnode:{patchFlag:o}}=n,a=ut(s),[l]=n.propsOptions;let c=!1;if((i||o>0)&&!(o&16)){if(o&8){const u=n.vnode.dynamicProps;for(let f=0;f{l=!0;const[d,h]=BS(f,e,!0);nn(o,d),h&&a.push(...h)};!t&&e.mixins.length&&e.mixins.forEach(u),n.extends&&u(n.extends),n.mixins&&n.mixins.forEach(u)}if(!r&&!l)return It(n)&&i.set(n,ca),ca;if(ze(r))for(let u=0;un[0]==="_"||n==="$stable",C0=n=>ze(n)?n.map(qi):[qi(n)],E2=(n,e,t)=>{if(e._n)return e;const i=gS((...s)=>C0(e(...s)),t);return i._c=!1,i},VS=(n,e,t)=>{const i=n._ctx;for(const s in n){if(zS(s))continue;const r=n[s];if(Ke(r))e[s]=E2(s,r,i);else if(r!=null){const o=C0(r);e[s]=()=>o}}},HS=(n,e)=>{const t=C0(e);n.slots.default=()=>t},GS=(n,e,t)=>{for(const i in e)(t||i!=="_")&&(n[i]=e[i])},T2=(n,e,t)=>{const i=n.slots=US();if(n.vnode.shapeFlag&32){const s=e._;s?(GS(i,e,t),t&&FM(i,"_",s,!0)):VS(e,i)}else e&&HS(n,e)},w2=(n,e,t)=>{const{vnode:i,slots:s}=n;let r=!0,o=vt;if(i.shapeFlag&32){const a=e._;a?t&&a===1?r=!1:GS(s,e,t):(r=!e.$stable,VS(e,s)),o=e}else e&&(HS(n,e),o={default:1});if(r)for(const a in s)!zS(a)&&o[a]==null&&delete s[a]},Dn=B2;function WS(n){return A2(n)}function A2(n,e){const t=Wd();t.__VUE__=!0;const{insert:i,remove:s,patchProp:r,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:d,setScopeId:h=Ki,insertStaticContent:p}=n,_=(k,z,R,te=null,G=null,W=null,C=void 0,I=null,N=!!z.dynamicChildren)=>{if(k===z)return;k&&!io(k,z)&&(te=X(k),ye(k,G,W,!0),k=null),z.patchFlag===-2&&(N=!1,z.dynamicChildren=null);const{type:A,ref:w,shapeFlag:U}=z;switch(A){case Ic:g(k,z,R,te);break;case Fn:m(k,z,R,te);break;case _f:k==null&&y(z,R,te,C);break;case jt:F(k,z,R,te,G,W,C,I,N);break;default:U&1?T(k,z,R,te,G,W,C,I,N):U&6?H(k,z,R,te,G,W,C,I,N):(U&64||U&128)&&A.process(k,z,R,te,G,W,C,I,N,ce)}w!=null&&G&&Uf(w,k&&k.ref,W,z||k,!z)},g=(k,z,R,te)=>{if(k==null)i(z.el=a(z.children),R,te);else{const G=z.el=k.el;z.children!==k.children&&c(G,z.children)}},m=(k,z,R,te)=>{k==null?i(z.el=l(z.children||""),R,te):z.el=k.el},y=(k,z,R,te)=>{[k.el,k.anchor]=p(k.children,z,R,te,k.el,k.anchor)},b=({el:k,anchor:z},R,te)=>{let G;for(;k&&k!==z;)G=d(k),i(k,R,te),k=G;i(z,R,te)},v=({el:k,anchor:z})=>{let R;for(;k&&k!==z;)R=d(k),s(k),k=R;s(z)},T=(k,z,R,te,G,W,C,I,N)=>{z.type==="svg"?C="svg":z.type==="math"&&(C="mathml"),k==null?E(z,R,te,G,W,C,I,N):x(k,z,G,W,C,I,N)},E=(k,z,R,te,G,W,C,I)=>{let N,A;const{props:w,shapeFlag:U,transition:O,dirs:V}=k;if(N=k.el=o(k.type,W,w&&w.is,w),U&8?u(N,k.children):U&16&&P(k.children,N,null,te,G,hp(k,W),C,I),V&&Or(k,null,te,"created"),S(N,k,k.scopeId,C,te),w){for(const ue in w)ue!=="value"&&!gl(ue)&&r(N,ue,null,w[ue],W,te);"value"in w&&r(N,"value",null,w.value,W),(A=w.onVnodeBeforeMount)&&Hi(A,te,k)}V&&Or(k,null,te,"beforeMount");const $=C2(G,O);$&&O.beforeEnter(N),i(N,z,R),((A=w&&w.onVnodeMounted)||$||V)&&Dn(()=>{A&&Hi(A,te,k),$&&O.enter(N),V&&Or(k,null,te,"mounted")},G)},S=(k,z,R,te,G)=>{if(R&&h(k,R),te)for(let W=0;W{for(let A=N;A{const I=z.el=k.el;let{patchFlag:N,dynamicChildren:A,dirs:w}=z;N|=k.patchFlag&16;const U=k.props||vt,O=z.props||vt;let V;if(R&&Nr(R,!1),(V=O.onVnodeBeforeUpdate)&&Hi(V,R,z,k),w&&Or(z,k,R,"beforeUpdate"),R&&Nr(R,!0),(U.innerHTML&&O.innerHTML==null||U.textContent&&O.textContent==null)&&u(I,""),A?M(k.dynamicChildren,A,I,R,te,hp(z,G),W):C||Z(k,z,I,null,R,te,hp(z,G),W,!1),N>0){if(N&16)L(I,U,O,R,G);else if(N&2&&U.class!==O.class&&r(I,"class",null,O.class,G),N&4&&r(I,"style",U.style,O.style,G),N&8){const $=z.dynamicProps;for(let ue=0;ue<$.length;ue++){const le=$[ue],Me=U[le],Be=O[le];(Be!==Me||le==="value")&&r(I,le,Me,Be,G,R)}}N&1&&k.children!==z.children&&u(I,z.children)}else!C&&A==null&&L(I,U,O,R,G);((V=O.onVnodeUpdated)||w)&&Dn(()=>{V&&Hi(V,R,z,k),w&&Or(z,k,R,"updated")},te)},M=(k,z,R,te,G,W,C)=>{for(let I=0;I{if(z!==R){if(z!==vt)for(const W in z)!gl(W)&&!(W in R)&&r(k,W,z[W],null,G,te);for(const W in R){if(gl(W))continue;const C=R[W],I=z[W];C!==I&&W!=="value"&&r(k,W,I,C,G,te)}"value"in R&&r(k,"value",z.value,R.value,G)}},F=(k,z,R,te,G,W,C,I,N)=>{const A=z.el=k?k.el:a(""),w=z.anchor=k?k.anchor:a("");let{patchFlag:U,dynamicChildren:O,slotScopeIds:V}=z;V&&(I=I?I.concat(V):V),k==null?(i(A,R,te),i(w,R,te),P(z.children||[],R,w,G,W,C,I,N)):U>0&&U&64&&O&&k.dynamicChildren?(M(k.dynamicChildren,O,R,G,W,C,I),(z.key!=null||G&&z===G.subTree)&&R0(k,z,!0)):Z(k,z,R,w,G,W,C,I,N)},H=(k,z,R,te,G,W,C,I,N)=>{z.slotScopeIds=I,k==null?z.shapeFlag&512?G.ctx.activate(z,R,te,C,N):Y(z,R,te,G,W,C,N):ee(k,z,N)},Y=(k,z,R,te,G,W,C)=>{const I=k.component=Y2(k,te,G);if(Zd(k)&&(I.ctx.renderer=ce),j2(I,!1,C),I.asyncDep){if(G&&G.registerDep(I,K,C),!k.el){const N=I.subTree=pn(Fn);m(null,N,z,R)}}else K(I,k,z,R,G,W,C)},ee=(k,z,R)=>{const te=z.component=k.component;if(F2(k,z,R))if(te.asyncDep&&!te.asyncResolved){Q(te,z,R);return}else te.next=z,te.update();else z.el=k.el,te.vnode=z},K=(k,z,R,te,G,W,C)=>{const I=()=>{if(k.isMounted){let{next:U,bu:O,u:V,parent:$,vnode:ue}=k;{const Te=XS(k);if(Te){U&&(U.el=ue.el,Q(k,U,C)),Te.asyncDep.then(()=>{k.isUnmounted||I()});return}}let le=U,Me;Nr(k,!1),U?(U.el=ue.el,Q(k,U,C)):U=ue,O&&mf(O),(Me=U.props&&U.props.onVnodeBeforeUpdate)&&Hi(Me,$,U,ue),Nr(k,!0);const Be=wv(k),me=k.subTree;k.subTree=Be,_(me,Be,f(me.el),X(me),k,G,W),U.el=Be.el,le===null&&k2(k,Be.el),V&&Dn(V,G),(Me=U.props&&U.props.onVnodeUpdated)&&Dn(()=>Hi(Me,$,U,ue),G)}else{let U;const{el:O,props:V}=z,{bm:$,m:ue,parent:le,root:Me,type:Be}=k,me=da(z);Nr(k,!1),$&&mf($),!me&&(U=V&&V.onVnodeBeforeMount)&&Hi(U,le,z),Nr(k,!0);{Me.ce&&Me.ce._injectChildStyle(Be);const Te=k.subTree=wv(k);_(null,Te,R,te,k,G,W),z.el=Te.el}if(ue&&Dn(ue,G),!me&&(U=V&&V.onVnodeMounted)){const Te=z;Dn(()=>Hi(U,le,Te),G)}(z.shapeFlag&256||le&&da(le.vnode)&&le.vnode.shapeFlag&256)&&k.a&&Dn(k.a,G),k.isMounted=!0,z=R=te=null}};k.scope.on();const N=k.effect=new HM(I);k.scope.off();const A=k.update=N.run.bind(N),w=k.job=N.runIfDirty.bind(N);w.i=k,w.id=k.uid,N.scheduler=()=>E0(w),Nr(k,!0),A()},Q=(k,z,R)=>{z.component=k;const te=k.vnode.props;k.vnode=z,k.next=null,M2(k,z.props,te,R),w2(k,z.children,R),Mr(),mv(k),Sr()},Z=(k,z,R,te,G,W,C,I,N=!1)=>{const A=k&&k.children,w=k?k.shapeFlag:0,U=z.children,{patchFlag:O,shapeFlag:V}=z;if(O>0){if(O&128){be(A,U,R,te,G,W,C,I,N);return}else if(O&256){he(A,U,R,te,G,W,C,I,N);return}}V&8?(w&16&&xe(A,G,W),U!==A&&u(R,U)):w&16?V&16?be(A,U,R,te,G,W,C,I,N):xe(A,G,W,!0):(w&8&&u(R,""),V&16&&P(U,R,te,G,W,C,I,N))},he=(k,z,R,te,G,W,C,I,N)=>{k=k||ca,z=z||ca;const A=k.length,w=z.length,U=Math.min(A,w);let O;for(O=0;Ow?xe(k,G,W,!0,!1,U):P(z,R,te,G,W,C,I,N,U)},be=(k,z,R,te,G,W,C,I,N)=>{let A=0;const w=z.length;let U=k.length-1,O=w-1;for(;A<=U&&A<=O;){const V=k[A],$=z[A]=N?rr(z[A]):qi(z[A]);if(io(V,$))_(V,$,R,null,G,W,C,I,N);else break;A++}for(;A<=U&&A<=O;){const V=k[U],$=z[O]=N?rr(z[O]):qi(z[O]);if(io(V,$))_(V,$,R,null,G,W,C,I,N);else break;U--,O--}if(A>U){if(A<=O){const V=O+1,$=VO)for(;A<=U;)ye(k[A],G,W,!0),A++;else{const V=A,$=A,ue=new Map;for(A=$;A<=O;A++){const Se=z[A]=N?rr(z[A]):qi(z[A]);Se.key!=null&&ue.set(Se.key,A)}let le,Me=0;const Be=O-$+1;let me=!1,Te=0;const Ve=new Array(Be);for(A=0;A=Be){ye(Se,G,W,!0);continue}let Je;if(Se.key!=null)Je=ue.get(Se.key);else for(le=$;le<=O;le++)if(Ve[le-$]===0&&io(Se,z[le])){Je=le;break}Je===void 0?ye(Se,G,W,!0):(Ve[Je-$]=A+1,Je>=Te?Te=Je:me=!0,_(Se,z[Je],R,null,G,W,C,I,N),Me++)}const We=me?R2(Ve):ca;for(le=We.length-1,A=Be-1;A>=0;A--){const Se=$+A,Je=z[Se],it=Se+1{const{el:W,type:C,transition:I,children:N,shapeFlag:A}=k;if(A&6){se(k.component.subTree,z,R,te);return}if(A&128){k.suspense.move(z,R,te);return}if(A&64){C.move(k,z,R,ce);return}if(C===jt){i(W,z,R);for(let U=0;UI.enter(W),G);else{const{leave:U,delayLeave:O,afterLeave:V}=I,$=()=>i(W,z,R),ue=()=>{U(W,()=>{$(),V&&V()})};O?O(W,$,ue):ue()}else i(W,z,R)},ye=(k,z,R,te=!1,G=!1)=>{const{type:W,props:C,ref:I,children:N,dynamicChildren:A,shapeFlag:w,patchFlag:U,dirs:O,cacheIndex:V}=k;if(U===-2&&(G=!1),I!=null&&Uf(I,null,R,k,!0),V!=null&&(z.renderCache[V]=void 0),w&256){z.ctx.deactivate(k);return}const $=w&1&&O,ue=!da(k);let le;if(ue&&(le=C&&C.onVnodeBeforeUnmount)&&Hi(le,z,k),w&6)ge(k.component,R,te);else{if(w&128){k.suspense.unmount(R,te);return}$&&Or(k,null,z,"beforeUnmount"),w&64?k.type.remove(k,z,R,ce,te):A&&!A.hasOnce&&(W!==jt||U>0&&U&64)?xe(A,z,R,!1,!0):(W===jt&&U&384||!G&&w&16)&&xe(N,z,R),te&&He(k)}(ue&&(le=C&&C.onVnodeUnmounted)||$)&&Dn(()=>{le&&Hi(le,z,k),$&&Or(k,null,z,"unmounted")},R)},He=k=>{const{type:z,el:R,anchor:te,transition:G}=k;if(z===jt){re(R,te);return}if(z===_f){v(k);return}const W=()=>{s(R),G&&!G.persisted&&G.afterLeave&&G.afterLeave()};if(k.shapeFlag&1&&G&&!G.persisted){const{leave:C,delayLeave:I}=G,N=()=>C(R,W);I?I(k.el,W,N):N()}else W()},re=(k,z)=>{let R;for(;k!==z;)R=d(k),s(k),k=R;s(z)},ge=(k,z,R)=>{const{bum:te,scope:G,job:W,subTree:C,um:I,m:N,a:A}=k;Tv(N),Tv(A),te&&mf(te),G.stop(),W&&(W.flags|=8,ye(C,k,z,R)),I&&Dn(I,z),Dn(()=>{k.isUnmounted=!0},z),z&&z.pendingBranch&&!z.isUnmounted&&k.asyncDep&&!k.asyncResolved&&k.suspenseId===z.pendingId&&(z.deps--,z.deps===0&&z.resolve())},xe=(k,z,R,te=!1,G=!1,W=0)=>{for(let C=W;C{if(k.shapeFlag&6)return X(k.component.subTree);if(k.shapeFlag&128)return k.suspense.next();const z=d(k.anchor||k.el),R=z&&z[_S];return R?d(R):z};let ae=!1;const fe=(k,z,R)=>{k==null?z._vnode&&ye(z._vnode,null,null,!0):_(z._vnode||null,k,z,null,null,null,R),z._vnode=k,ae||(ae=!0,mv(),hS(),ae=!1)},ce={p:_,um:ye,m:se,r:He,mt:Y,mc:P,pc:Z,pbc:M,n:X,o:n};return{render:fe,hydrate:void 0,createApp:b2(fe)}}function hp({type:n,props:e},t){return t==="svg"&&n==="foreignObject"||t==="mathml"&&n==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Nr({effect:n,job:e},t){t?(n.flags|=32,e.flags|=4):(n.flags&=-33,e.flags&=-5)}function C2(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function R0(n,e,t=!1){const i=n.children,s=e.children;if(ze(i)&&ze(s))for(let r=0;r>1,n[t[a]]0&&(e[i]=t[r-1]),t[r]=i)}}for(r=t.length,o=t[r-1];r-- >0;)t[r]=o,o=e[o];return t}function XS(n){const e=n.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:XS(e)}function Tv(n){if(n)for(let e=0;eEn(P2);function Rc(n,e){return Pc(n,null,e)}function oG(n,e){return Pc(n,null,{flush:"post"})}function L2(n,e){return Pc(n,null,{flush:"sync"})}function $e(n,e,t){return Pc(n,e,t)}function Pc(n,e,t=vt){const{immediate:i,deep:s,flush:r,once:o}=t,a=nn({},t),l=e&&i||!e&&r!=="post";let c;if(Kl){if(r==="sync"){const h=I2();c=h.__watcherHandles||(h.__watcherHandles=[])}else if(!l){const h=()=>{};return h.stop=Ki,h.resume=Ki,h.pause=Ki,h}}const u=cn;a.call=(h,p,_)=>Fi(h,u,p,_);let f=!1;r==="post"?a.scheduler=h=>{Dn(h,u&&u.suspense)}:r!=="sync"&&(f=!0,a.scheduler=(h,p)=>{p?h():E0(h)}),a.augmentJob=h=>{e&&(h.flags|=4),f&&(h.flags|=2,u&&(h.id=u.uid,h.i=u))};const d=XC(n,e,a);return Kl&&(c?c.push(d):l&&d()),d}function D2(n,e,t){const i=this.proxy,s=Ut(n)?n.includes(".")?$S(i,n):()=>i[n]:n.bind(i,i);let r;Ke(e)?r=e:(r=e.handler,t=e);const o=Lc(this),a=Pc(s,r.bind(i),t);return o(),a}function $S(n,e){const t=e.split(".");return()=>{let i=n;for(let s=0;s{let u,f=vt,d;return L2(()=>{const h=n[s];Yn(u,h)&&(u=h,c())}),{get(){return l(),t.get?t.get(u):u},set(h){const p=t.set?t.set(h):h;if(!Yn(p,u)&&!(f!==vt&&Yn(h,f)))return;const _=i.vnode.props;_&&(e in _||s in _||r in _)&&(`onUpdate:${e}`in _||`onUpdate:${s}`in _||`onUpdate:${r}`in _)||(u=h,c()),i.emit(`update:${e}`,p),Yn(h,p)&&Yn(h,f)&&!Yn(p,d)&&c(),f=h,d=p}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||vt:a,done:!1}:{done:!0}}}},a}const qS=(n,e)=>e==="modelValue"||e==="model-value"?n.modelModifiers:n[`${e}Modifiers`]||n[`${ai(e)}Modifiers`]||n[`${ks(e)}Modifiers`];function O2(n,e,...t){if(n.isUnmounted)return;const i=n.vnode.props||vt;let s=t;const r=e.startsWith("update:"),o=r&&qS(i,e.slice(7));o&&(o.trim&&(s=t.map(u=>Ut(u)?u.trim():u)),o.number&&(s=t.map(If)));let a,l=i[a=pf(e)]||i[a=pf(ai(e))];!l&&r&&(l=i[a=pf(ks(e))]),l&&Fi(l,n,6,s);const c=i[a+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[a])return;n.emitted[a]=!0,Fi(c,n,6,s)}}function YS(n,e,t=!1){const i=e.emitsCache,s=i.get(n);if(s!==void 0)return s;const r=n.emits;let o={},a=!1;if(!Ke(n)){const l=c=>{const u=YS(c,e,!0);u&&(a=!0,nn(o,u))};!t&&e.mixins.length&&e.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!r&&!a?(It(n)&&i.set(n,null),null):(ze(r)?r.forEach(l=>o[l]=null):nn(o,r),It(n)&&i.set(n,o),o)}function Qd(n,e){return!n||!Vd(e)?!1:(e=e.slice(2).replace(/Once$/,""),St(n,e[0].toLowerCase()+e.slice(1))||St(n,ks(e))||St(n,e))}function wv(n){const{type:e,vnode:t,proxy:i,withProxy:s,propsOptions:[r],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:d,setupState:h,ctx:p,inheritAttrs:_}=n,g=Nf(n);let m,y;try{if(t.shapeFlag&4){const v=s||i,T=v;m=qi(c.call(T,v,u,f,h,d,p)),y=a}else{const v=e;m=qi(v.length>1?v(f,{attrs:a,slots:o,emit:l}):v(f,null)),y=e.props?a:N2(a)}}catch(v){xl.length=0,Kd(v,n,1),m=pn(Fn)}let b=m;if(y&&_!==!1){const v=Object.keys(y),{shapeFlag:T}=b;v.length&&T&7&&(r&&v.some(d0)&&(y=U2(y,r)),b=pr(b,y,!1,!0))}return t.dirs&&(b=pr(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(t.dirs):t.dirs),t.transition&&Xl(b,t.transition),m=b,Nf(g),m}const N2=n=>{let e;for(const t in n)(t==="class"||t==="style"||Vd(t))&&((e||(e={}))[t]=n[t]);return e},U2=(n,e)=>{const t={};for(const i in n)(!d0(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function F2(n,e,t){const{props:i,children:s,component:r}=n,{props:o,children:a,patchFlag:l}=e,c=r.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return i?Av(i,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;fn.__isSuspense;function B2(n,e){e&&e.pendingBranch?ze(n)?e.effects.push(...n):e.effects.push(n):YC(n)}const jt=Symbol.for("v-fgt"),Ic=Symbol.for("v-txt"),Fn=Symbol.for("v-cmt"),_f=Symbol.for("v-stc"),xl=[];let si=null;function mn(n=!1){xl.push(si=n?null:[])}function z2(){xl.pop(),si=xl[xl.length-1]||null}let ql=1;function Cv(n,e=!1){ql+=n,n<0&&si&&e&&(si.hasOnce=!0)}function KS(n){return n.dynamicChildren=ql>0?si||ca:null,z2(),ql>0&&si&&si.push(n),n}function vi(n,e,t,i,s,r){return KS(sr(n,e,t,i,s,r,!0))}function Yl(n,e,t,i,s){return KS(pn(n,e,t,i,s,!0))}function jl(n){return n?n.__v_isVNode===!0:!1}function io(n,e){return n.type===e.type&&n.key===e.key}const ZS=({key:n})=>n??null,vf=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?Ut(n)||Pt(n)||Ke(n)?{i:Qt,r:n,k:e,f:!!t}:n:null);function sr(n,e=null,t=null,i=0,s=null,r=n===jt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&ZS(e),ref:e&&vf(e),scopeId:mS,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Qt};return a?(P0(l,t),r&128&&n.normalize(l)):t&&(l.shapeFlag|=Ut(t)?8:16),ql>0&&!o&&si&&(l.patchFlag>0||r&6)&&l.patchFlag!==32&&si.push(l),l}const pn=V2;function V2(n,e=null,t=null,i=0,s=null,r=!1){if((!n||n===RS)&&(n=Fn),jl(n)){const a=pr(n,e,!0);return t&&P0(a,t),ql>0&&!r&&si&&(a.shapeFlag&6?si[si.indexOf(n)]=a:si.push(a)),a.patchFlag=-2,a}if(Q2(n)&&(n=n.__vccOpts),e){e=H2(e);let{class:a,style:l}=e;a&&!Ut(a)&&(e.class=Oa(a)),It(l)&&(x0(l)&&!ze(l)&&(l=nn({},l)),e.style=Mi(l))}const o=Ut(n)?1:jS(n)?128:vS(n)?64:It(n)?4:Ke(n)?2:0;return sr(n,e,t,i,s,o,r,!0)}function H2(n){return n?x0(n)||FS(n)?nn({},n):n:null}function pr(n,e,t=!1,i=!1){const{props:s,ref:r,patchFlag:o,children:a,transition:l}=n,c=e?X2(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:n.type,props:c,key:c&&ZS(c),ref:e&&e.ref?t&&r?ze(r)?r.concat(vf(e)):[r,vf(e)]:vf(e):r,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:a,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==jt?o===-1?16:o|16:o,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:l,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&pr(n.ssContent),ssFallback:n.ssFallback&&pr(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return l&&i&&Xl(u,l.clone(u)),u}function G2(n=" ",e=0){return pn(Ic,null,n,e)}function W2(n,e){const t=pn(_f,null,n);return t.staticCount=e,t}function Rv(n="",e=!1){return e?(mn(),Yl(Fn,null,n)):pn(Fn,null,n)}function qi(n){return n==null||typeof n=="boolean"?pn(Fn):ze(n)?pn(jt,null,n.slice()):jl(n)?rr(n):pn(Ic,null,String(n))}function rr(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:pr(n)}function P0(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(ze(e))t=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),P0(n,s()),s._c&&(s._d=!0));return}else{t=32;const s=e._;!s&&!FS(e)?e._ctx=Qt:s===3&&Qt&&(Qt.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else Ke(e)?(e={default:e,_ctx:Qt},t=32):(e=String(e),i&64?(t=16,e=[G2(e)]):t=8);n.children=e,n.shapeFlag|=t}function X2(...n){const e={};for(let t=0;tcn||Qt;let kf,ig;{const n=Wd(),e=(t,i)=>{let s;return(s=n[t])||(s=n[t]=[]),s.push(i),r=>{s.length>1?s.forEach(o=>o(r)):s[0](r)}};kf=e("__VUE_INSTANCE_SETTERS__",t=>cn=t),ig=e("__VUE_SSR_SETTERS__",t=>Kl=t)}const Lc=n=>{const e=cn;return kf(n),n.scope.on(),()=>{n.scope.off(),kf(e)}},Pv=()=>{cn&&cn.scope.off(),kf(null)};function JS(n){return n.vnode.shapeFlag&4}let Kl=!1;function j2(n,e=!1,t=!1){e&&ig(e);const{props:i,children:s}=n.vnode,r=JS(n);x2(n,i,r,e),T2(n,s,t);const o=r?K2(n,e):void 0;return e&&ig(!1),o}function K2(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,h2);const{setup:i}=t;if(i){Mr();const s=n.setupContext=i.length>1?e1(n):null,r=Lc(n),o=Ac(i,n,0,[n.props,s]),a=OM(o);if(Sr(),r(),(a||n.sp)&&!da(n)&&wS(n),a){if(o.then(Pv,Pv),e)return o.then(l=>{Iv(n,l)}).catch(l=>{Kd(l,n,0)});n.asyncDep=o}else Iv(n,o)}else QS(n)}function Iv(n,e,t){Ke(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:It(e)&&(n.setupState=aS(e)),QS(n)}function QS(n,e,t){const i=n.type;n.render||(n.render=i.render||Ki);{const s=Lc(n);Mr();try{p2(n)}finally{Sr(),s()}}}const Z2={get(n,e){return Mn(n,"get",""),n[e]}};function e1(n){const e=t=>{n.exposed=t||{}};return{attrs:new Proxy(n.attrs,Z2),slots:n.slots,emit:n.emit,expose:e}}function eh(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(aS(M0(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in bl)return bl[t](n)},has(e,t){return t in e||t in bl}})):n.proxy}function J2(n,e=!0){return Ke(n)?n.displayName||n.name:n.name||e&&n.__name}function Q2(n){return Ke(n)&&"__vccOpts"in n}const Ee=(n,e)=>GC(n,e,Kl);function Ds(n,e,t){const i=arguments.length;return i===2?It(e)&&!ze(e)?jl(e)?pn(n,null,[e]):pn(n,e):pn(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&jl(t)&&(t=[t]),pn(n,e,t))}const eR="3.5.13";/** * @vue/runtime-dom v3.5.13 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT -**/let sg;const Lv=typeof window<"u"&&window.trustedTypes;if(Lv)try{sg=Lv.createPolicy("vue",{createHTML:n=>n})}catch{}const e1=sg?n=>sg.createHTML(n):n=>n,eR="http://www.w3.org/2000/svg",tR="http://www.w3.org/1998/Math/MathML",ys=typeof document<"u"?document:null,Dv=ys&&ys.createElement("template"),nR={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const s=e==="svg"?ys.createElementNS(eR,n):e==="mathml"?ys.createElementNS(tR,n):t?ys.createElement(n,{is:t}):ys.createElement(n);return n==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:n=>ys.createTextNode(n),createComment:n=>ys.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>ys.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,s,r){const o=t?t.previousSibling:e.lastChild;if(s&&(s===r||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),t),!(s===r||!(s=s.nextSibling)););else{Dv.innerHTML=e1(i==="svg"?`${n}`:i==="mathml"?`${n}`:n);const a=Dv.content;if(i==="svg"||i==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},Xs="transition",qa="animation",Zl=Symbol("_vtc"),t1={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},iR=nn({},bS,t1),sR=n=>(n.displayName="Transition",n.props=iR,n),lG=sR((n,{slots:e})=>Ds(ZC,rR(n),e)),Ur=(n,e=[])=>{ze(n)?n.forEach(t=>t(...e)):n&&n(...e)},Ov=n=>n?ze(n)?n.some(e=>e.length>1):n.length>1:!1;function rR(n){const e={};for(const F in n)F in t1||(e[F]=n[F]);if(n.css===!1)return e;const{name:t="v",type:i,duration:s,enterFromClass:r=`${t}-enter-from`,enterActiveClass:o=`${t}-enter-active`,enterToClass:a=`${t}-enter-to`,appearFromClass:l=r,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:f=`${t}-leave-from`,leaveActiveClass:d=`${t}-leave-active`,leaveToClass:h=`${t}-leave-to`}=n,p=oR(s),_=p&&p[0],g=p&&p[1],{onBeforeEnter:m,onEnter:y,onEnterCancelled:b,onLeave:v,onLeaveCancelled:T,onBeforeAppear:E=m,onAppear:S=y,onAppearCancelled:P=b}=e,x=(F,H,Y,ee)=>{F._enterCancelled=ee,Fr(F,H?u:a),Fr(F,H?c:o),Y&&Y()},M=(F,H)=>{F._isLeaving=!1,Fr(F,f),Fr(F,h),Fr(F,d),H&&H()},L=F=>(H,Y)=>{const ee=F?S:y,K=()=>x(H,F,Y);Ur(ee,[H,K]),Nv(()=>{Fr(H,F?l:r),cs(H,F?u:a),Ov(ee)||Uv(H,i,_,K)})};return nn(e,{onBeforeEnter(F){Ur(m,[F]),cs(F,r),cs(F,o)},onBeforeAppear(F){Ur(E,[F]),cs(F,l),cs(F,c)},onEnter:L(!1),onAppear:L(!0),onLeave(F,H){F._isLeaving=!0;const Y=()=>M(F,H);cs(F,f),F._enterCancelled?(cs(F,d),Bv()):(Bv(),cs(F,d)),Nv(()=>{F._isLeaving&&(Fr(F,f),cs(F,h),Ov(v)||Uv(F,i,g,Y))}),Ur(v,[F,Y])},onEnterCancelled(F){x(F,!1,void 0,!0),Ur(b,[F])},onAppearCancelled(F){x(F,!0,void 0,!0),Ur(P,[F])},onLeaveCancelled(F){M(F),Ur(T,[F])}})}function oR(n){if(n==null)return null;if(It(n))return[pp(n.enter),pp(n.leave)];{const e=pp(n);return[e,e]}}function pp(n){return lC(n)}function cs(n,e){e.split(/\s+/).forEach(t=>t&&n.classList.add(t)),(n[Zl]||(n[Zl]=new Set)).add(e)}function Fr(n,e){e.split(/\s+/).forEach(i=>i&&n.classList.remove(i));const t=n[Zl];t&&(t.delete(e),t.size||(n[Zl]=void 0))}function Nv(n){requestAnimationFrame(()=>{requestAnimationFrame(n)})}let aR=0;function Uv(n,e,t,i){const s=n._endId=++aR,r=()=>{s===n._endId&&i()};if(t!=null)return setTimeout(r,t);const{type:o,timeout:a,propCount:l}=lR(n,e);if(!o)return i();const c=o+"end";let u=0;const f=()=>{n.removeEventListener(c,d),r()},d=h=>{h.target===n&&++u>=l&&f()};setTimeout(()=>{u(t[p]||"").split(", "),s=i(`${Xs}Delay`),r=i(`${Xs}Duration`),o=Fv(s,r),a=i(`${qa}Delay`),l=i(`${qa}Duration`),c=Fv(a,l);let u=null,f=0,d=0;e===Xs?o>0&&(u=Xs,f=o,d=r.length):e===qa?c>0&&(u=qa,f=c,d=l.length):(f=Math.max(o,c),u=f>0?o>c?Xs:qa:null,d=u?u===Xs?r.length:l.length:0);const h=u===Xs&&/\b(transform|all)(,|$)/.test(i(`${Xs}Property`).toString());return{type:u,timeout:f,propCount:d,hasTransform:h}}function Fv(n,e){for(;n.lengthkv(t)+kv(n[i])))}function kv(n){return n==="auto"?0:Number(n.slice(0,-1).replace(",","."))*1e3}function Bv(){return document.body.offsetHeight}function cR(n,e,t){const i=n[Zl];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const zv=Symbol("_vod"),uR=Symbol("_vsh"),fR=Symbol(""),dR=/(^|;)\s*display\s*:/;function hR(n,e,t){const i=n.style,s=Ut(t);let r=!1;if(t&&!s){if(e)if(Ut(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();t[a]==null&&yf(i,a,"")}else for(const o in e)t[o]==null&&yf(i,o,"");for(const o in t)o==="display"&&(r=!0),yf(i,o,t[o])}else if(s){if(e!==t){const o=i[fR];o&&(t+=";"+o),i.cssText=t,r=dR.test(t)}}else e&&n.removeAttribute("style");zv in n&&(n[zv]=r?i.display:"",n[uR]&&(i.display="none"))}const Vv=/\s*!important$/;function yf(n,e,t){if(ze(t))t.forEach(i=>yf(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=pR(n,e);Vv.test(t)?n.setProperty(ks(i),t.replace(Vv,""),"important"):n[i]=t}}const Hv=["Webkit","Moz","ms"],mp={};function pR(n,e){const t=mp[e];if(t)return t;let i=ai(e);if(i!=="filter"&&i in n)return mp[e]=i;i=Gd(i);for(let s=0;sgp||(vR.then(()=>gp=0),gp=Date.now());function bR(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;Fi(xR(i,t.value),e,5,[i])};return t.value=n,t.attached=yR(),t}function xR(n,e){if(ze(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>s=>!s._stopped&&i&&i(s))}else return e}const Yv=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,MR=(n,e,t,i,s,r)=>{const o=s==="svg";e==="class"?cR(n,i,o):e==="style"?hR(n,t,i):Vd(e)?d0(e)||gR(n,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):SR(n,e,i,o))?(Xv(n,e,i),!n.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Wv(n,e,i,o,r,e!=="value")):n._isVueCE&&(/[A-Z]/.test(e)||!Ut(i))?Xv(n,ai(e),i,r,e):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),Wv(n,e,i,o))};function SR(n,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in n&&Yv(e)&&Ke(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=n.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Yv(e)&&Ut(t)?!1:e in n}const mr=n=>{const e=n.props["onUpdate:modelValue"]||!1;return ze(e)?t=>mf(e,t):e};function ER(n){n.target.composing=!0}function jv(n){const e=n.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const yi=Symbol("_assign"),Kv={created(n,{modifiers:{lazy:e,trim:t,number:i}},s){n[yi]=mr(s);const r=i||s.props&&s.props.type==="number";Ms(n,e?"change":"input",o=>{if(o.target.composing)return;let a=n.value;t&&(a=a.trim()),r&&(a=If(a)),n[yi](a)}),t&&Ms(n,"change",()=>{n.value=n.value.trim()}),e||(Ms(n,"compositionstart",ER),Ms(n,"compositionend",jv),Ms(n,"change",jv))},mounted(n,{value:e}){n.value=e??""},beforeUpdate(n,{value:e,oldValue:t,modifiers:{lazy:i,trim:s,number:r}},o){if(n[yi]=mr(o),n.composing)return;const a=(r||n.type==="number")&&!/^0\d/.test(n.value)?If(n.value):n.value,l=e??"";a!==l&&(document.activeElement===n&&n.type!=="range"&&(i&&e===t||s&&n.value.trim()===l)||(n.value=l))}},TR={deep:!0,created(n,e,t){n[yi]=mr(t),Ms(n,"change",()=>{const i=n._modelValue,s=ga(n),r=n.checked,o=n[yi];if(ze(i)){const a=m0(i,s),l=a!==-1;if(r&&!l)o(i.concat(s));else if(!r&&l){const c=[...i];c.splice(a,1),o(c)}}else if(Da(i)){const a=new Set(i);r?a.add(s):a.delete(s),o(a)}else o(n1(n,r))})},mounted:Zv,beforeUpdate(n,e,t){n[yi]=mr(t),Zv(n,e,t)}};function Zv(n,{value:e,oldValue:t},i){n._modelValue=e;let s;if(ze(e))s=m0(e,i.props.value)>-1;else if(Da(e))s=e.has(i.props.value);else{if(e===t)return;s=vo(e,n1(n,!0))}n.checked!==s&&(n.checked=s)}const wR={created(n,{value:e},t){n.checked=vo(e,t.props.value),n[yi]=mr(t),Ms(n,"change",()=>{n[yi](ga(n))})},beforeUpdate(n,{value:e,oldValue:t},i){n[yi]=mr(i),e!==t&&(n.checked=vo(e,i.props.value))}},AR={deep:!0,created(n,{value:e,modifiers:{number:t}},i){const s=Da(e);Ms(n,"change",()=>{const r=Array.prototype.filter.call(n.options,o=>o.selected).map(o=>t?If(ga(o)):ga(o));n[yi](n.multiple?s?new Set(r):r:r[0]),n._assigning=!0,Er(()=>{n._assigning=!1})}),n[yi]=mr(i)},mounted(n,{value:e}){Jv(n,e)},beforeUpdate(n,e,t){n[yi]=mr(t)},updated(n,{value:e}){n._assigning||Jv(n,e)}};function Jv(n,e){const t=n.multiple,i=ze(e);if(!(t&&!i&&!Da(e))){for(let s=0,r=n.options.length;sString(c)===String(a)):o.selected=m0(e,a)>-1}else o.selected=e.has(a);else if(vo(ga(o),e)){n.selectedIndex!==s&&(n.selectedIndex=s);return}}!t&&n.selectedIndex!==-1&&(n.selectedIndex=-1)}}function ga(n){return"_value"in n?n._value:n.value}function n1(n,e){const t=e?"_trueValue":"_falseValue";return t in n?n[t]:e}const cG={created(n,e,t){au(n,e,t,null,"created")},mounted(n,e,t){au(n,e,t,null,"mounted")},beforeUpdate(n,e,t,i){au(n,e,t,i,"beforeUpdate")},updated(n,e,t,i){au(n,e,t,i,"updated")}};function CR(n,e){switch(n){case"SELECT":return AR;case"TEXTAREA":return Kv;default:switch(e){case"checkbox":return TR;case"radio":return wR;default:return Kv}}}function au(n,e,t,i,s){const o=CR(n.tagName,t.props&&t.props.type)[s];o&&o(n,e,t,i)}const RR=["ctrl","shift","alt","meta"],PR={stop:n=>n.stopPropagation(),prevent:n=>n.preventDefault(),self:n=>n.target!==n.currentTarget,ctrl:n=>!n.ctrlKey,shift:n=>!n.shiftKey,alt:n=>!n.altKey,meta:n=>!n.metaKey,left:n=>"button"in n&&n.button!==0,middle:n=>"button"in n&&n.button!==1,right:n=>"button"in n&&n.button!==2,exact:(n,e)=>RR.some(t=>n[`${t}Key`]&&!e.includes(t))},uG=(n,e)=>{const t=n._withMods||(n._withMods={}),i=e.join(".");return t[i]||(t[i]=(s,...r)=>{for(let o=0;o{const t=n._withKeys||(n._withKeys={}),i=e.join(".");return t[i]||(t[i]=s=>{if(!("key"in s))return;const r=ks(s.key);if(e.some(o=>o===r||IR[o]===r))return n(s)})},LR=nn({patchProp:MR},nR);let Qv;function i1(){return Qv||(Qv=GS(LR))}const dG=(...n)=>{i1().render(...n)},DR=(...n)=>{const e=i1().createApp(...n),{mount:t}=e;return e.mount=i=>{const s=NR(i);if(!s)return;const r=e._component;!Ke(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=t(s,!1,OR(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e};function OR(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function NR(n){return Ut(n)?document.querySelector(n):n}const s1=new Set,Zn=new WeakMap,_a=new WeakMap,bo=new WeakMap,rg=new WeakMap,UR=new WeakMap,va=new WeakMap,Bf=new WeakMap,dl=new WeakSet;let gr,I0=0,L0=0;const Ts="__aa_tgt",Jl="__aa_del",zf="__aa_new",FR=n=>{const e=GR(n);e&&e.forEach(t=>WR(t))},kR=n=>{n.forEach(e=>{e.target===gr&&zR(),Zn.has(e.target)&&wo(e.target)})};function BR(n){const e=rg.get(n);e==null||e.disconnect();let t=Zn.get(n),i=0;const s=5;t||(t=ya(n),Zn.set(n,t));const{offsetWidth:r,offsetHeight:o}=gr,l=[t.top-s,r-(t.left+s+t.width),o-(t.top+s+t.height),t.left-s].map(u=>`${-1*Math.floor(u)}px`).join(" "),c=new IntersectionObserver(()=>{++i>1&&wo(n)},{root:gr,threshold:1,rootMargin:l});c.observe(n),rg.set(n,c)}function wo(n){clearTimeout(Bf.get(n));const e=th(n),t=Ql(e)?500:e.duration;Bf.set(n,setTimeout(async()=>{const i=bo.get(n);try{await(i==null?void 0:i.finished),Zn.set(n,ya(n)),BR(n)}catch{}},t))}function zR(){clearTimeout(Bf.get(gr)),Bf.set(gr,setTimeout(()=>{s1.forEach(n=>l1(n,e=>r1(()=>wo(e))))},100))}function VR(n){setTimeout(()=>{UR.set(n,setInterval(()=>r1(wo.bind(null,n)),2e3))},Math.round(2e3*Math.random()))}function r1(n){typeof requestIdleCallback=="function"?requestIdleCallback(()=>n()):requestAnimationFrame(()=>n())}let og,sa;const HR=typeof window<"u"&&"ResizeObserver"in window;HR&&(gr=document.documentElement,og=new MutationObserver(FR),sa=new ResizeObserver(kR),window.addEventListener("scroll",()=>{L0=window.scrollY,I0=window.scrollX}),sa.observe(gr));function GR(n){return n.reduce((i,s)=>[...i,...Array.from(s.addedNodes),...Array.from(s.removedNodes)],[]).every(i=>i.nodeName==="#comment")?!1:n.reduce((i,s)=>{if(i===!1)return!1;if(s.target instanceof Element){if(_p(s.target),!i.has(s.target)){i.add(s.target);for(let r=0;rt(n,va.has(n)));for(let t=0;ts(i,va.has(i)))}}function O0(n){return Array.isArray(n)?n:[n]}function Ql(n){return typeof n=="function"}function $R(n){const e=Zn.get(n),t=ya(n);if(!D0(n))return Zn.set(n,t);let i;if(!e)return;const s=th(n);if(typeof s!="function"){const r=e.left-t.left,o=e.top-t.top,[a,l,c,u]=o1(n,e,t),f={transform:`translate(${r}px, ${o}px)`},d={transform:"translate(0, 0)"};a!==l&&(f.width=`${a}px`,d.width=`${l}px`),c!==u&&(f.height=`${c}px`,d.height=`${u}px`),i=n.animate([f,d],{duration:s.duration,easing:s.easing})}else{const[r]=O0(s(n,"remain",e,t));i=new Animation(r),i.play()}bo.set(n,i),Zn.set(n,t),i.addEventListener("finish",wo.bind(null,n))}function ey(n){zf in n&&delete n[zf];const e=ya(n);Zn.set(n,e);const t=th(n);if(!D0(n))return;let i;if(typeof t!="function")i=n.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:t.duration*1.5,easing:"ease-in"});else{const[s]=O0(t(n,"add",e));i=new Animation(s),i.play()}bo.set(n,i),i.addEventListener("finish",wo.bind(null,n))}function ty(n,e){var t;n.remove(),Zn.delete(n),_a.delete(n),bo.delete(n),(t=rg.get(n))===null||t===void 0||t.disconnect(),setTimeout(()=>{if(Jl in n&&delete n[Jl],Object.defineProperty(n,zf,{value:!0,configurable:!0}),e&&n instanceof HTMLElement)for(const i in e)n.style[i]=""},0)}function qR(n){var e;if(!_a.has(n)||!Zn.has(n))return;const[t,i]=_a.get(n);Object.defineProperty(n,Jl,{value:!0,configurable:!0});const s=window.scrollX,r=window.scrollY;if(i&&i.parentNode&&i.parentNode instanceof Element?i.parentNode.insertBefore(n,i):t&&t.parentNode?t.parentNode.appendChild(n):(e=a1(n))===null||e===void 0||e.appendChild(n),!D0(n))return ty(n);const[o,a,l,c]=jR(n),u=th(n),f=Zn.get(n);(s!==I0||r!==L0)&&YR(n,s,r,u);let d,h={position:"absolute",top:`${o}px`,left:`${a}px`,width:`${l}px`,height:`${c}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!Ql(u))Object.assign(n.style,h),d=n.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:u.duration,easing:"ease-out"});else{const[p,_]=O0(u(n,"remove",f));(_==null?void 0:_.styleReset)!==!1&&(h=(_==null?void 0:_.styleReset)||h,Object.assign(n.style,h)),d=new Animation(p),d.play()}bo.set(n,d),d.addEventListener("finish",ty.bind(null,n,h))}function YR(n,e,t,i){const s=I0-e,r=L0-t,o=document.documentElement.style.scrollBehavior;if(getComputedStyle(gr).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+s,window.scrollY+r),!n.parentElement)return;const l=n.parentElement;let c=l.clientHeight,u=l.clientWidth;const f=performance.now();function d(){requestAnimationFrame(()=>{if(!Ql(i)){const h=c-l.clientHeight,p=u-l.clientWidth;f+i.duration>performance.now()?(window.scrollTo({left:window.scrollX-p,top:window.scrollY-h}),c=l.clientHeight,u=l.clientWidth,d()):document.documentElement.style.scrollBehavior=o}})}d()}function jR(n){const e=Zn.get(n),[t,,i]=o1(n,e,ya(n));let s=n.parentElement;for(;s&&(getComputedStyle(s).position==="static"||s instanceof HTMLBodyElement);)s=s.parentElement;s||(s=document.body);const r=getComputedStyle(s),o=Zn.get(s)||ya(s),a=Math.round(e.top-o.top)-Xi(r.borderTopWidth),l=Math.round(e.left-o.left)-Xi(r.borderLeftWidth);return[a,l,t,i]}function KR(n,e={}){return og&&sa&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!Ql(e)&&!e.disrespectUserMotionPreference||(dl.add(n),getComputedStyle(n).position==="static"&&Object.assign(n.style,{position:"relative"}),l1(n,wo,VR,s=>sa==null?void 0:sa.observe(s)),Ql(e)?va.set(n,e):va.set(n,{duration:250,easing:"ease-in-out",...e}),og.observe(n,{childList:!0}),s1.add(n))),Object.freeze({parent:n,enable:()=>{dl.add(n)},disable:()=>{dl.delete(n)},isEnabled:()=>dl.has(n)})}const ZR={mounted:(n,e)=>{KR(n,e.value||{})},getSSRProps:()=>({})},JR=ZR,QR={install(n){n.directive("auto-animate",JR)}};/** +**/let sg;const Lv=typeof window<"u"&&window.trustedTypes;if(Lv)try{sg=Lv.createPolicy("vue",{createHTML:n=>n})}catch{}const t1=sg?n=>sg.createHTML(n):n=>n,tR="http://www.w3.org/2000/svg",nR="http://www.w3.org/1998/Math/MathML",ys=typeof document<"u"?document:null,Dv=ys&&ys.createElement("template"),iR={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const s=e==="svg"?ys.createElementNS(tR,n):e==="mathml"?ys.createElementNS(nR,n):t?ys.createElement(n,{is:t}):ys.createElement(n);return n==="select"&&i&&i.multiple!=null&&s.setAttribute("multiple",i.multiple),s},createText:n=>ys.createTextNode(n),createComment:n=>ys.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>ys.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,s,r){const o=t?t.previousSibling:e.lastChild;if(s&&(s===r||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),t),!(s===r||!(s=s.nextSibling)););else{Dv.innerHTML=t1(i==="svg"?`${n}`:i==="mathml"?`${n}`:n);const a=Dv.content;if(i==="svg"||i==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},Xs="transition",qa="animation",Zl=Symbol("_vtc"),n1={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},sR=nn({},xS,n1),rR=n=>(n.displayName="Transition",n.props=sR,n),lG=rR((n,{slots:e})=>Ds(JC,oR(n),e)),Ur=(n,e=[])=>{ze(n)?n.forEach(t=>t(...e)):n&&n(...e)},Ov=n=>n?ze(n)?n.some(e=>e.length>1):n.length>1:!1;function oR(n){const e={};for(const F in n)F in n1||(e[F]=n[F]);if(n.css===!1)return e;const{name:t="v",type:i,duration:s,enterFromClass:r=`${t}-enter-from`,enterActiveClass:o=`${t}-enter-active`,enterToClass:a=`${t}-enter-to`,appearFromClass:l=r,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:f=`${t}-leave-from`,leaveActiveClass:d=`${t}-leave-active`,leaveToClass:h=`${t}-leave-to`}=n,p=aR(s),_=p&&p[0],g=p&&p[1],{onBeforeEnter:m,onEnter:y,onEnterCancelled:b,onLeave:v,onLeaveCancelled:T,onBeforeAppear:E=m,onAppear:S=y,onAppearCancelled:P=b}=e,x=(F,H,Y,ee)=>{F._enterCancelled=ee,Fr(F,H?u:a),Fr(F,H?c:o),Y&&Y()},M=(F,H)=>{F._isLeaving=!1,Fr(F,f),Fr(F,h),Fr(F,d),H&&H()},L=F=>(H,Y)=>{const ee=F?S:y,K=()=>x(H,F,Y);Ur(ee,[H,K]),Nv(()=>{Fr(H,F?l:r),cs(H,F?u:a),Ov(ee)||Uv(H,i,_,K)})};return nn(e,{onBeforeEnter(F){Ur(m,[F]),cs(F,r),cs(F,o)},onBeforeAppear(F){Ur(E,[F]),cs(F,l),cs(F,c)},onEnter:L(!1),onAppear:L(!0),onLeave(F,H){F._isLeaving=!0;const Y=()=>M(F,H);cs(F,f),F._enterCancelled?(cs(F,d),Bv()):(Bv(),cs(F,d)),Nv(()=>{F._isLeaving&&(Fr(F,f),cs(F,h),Ov(v)||Uv(F,i,g,Y))}),Ur(v,[F,Y])},onEnterCancelled(F){x(F,!1,void 0,!0),Ur(b,[F])},onAppearCancelled(F){x(F,!0,void 0,!0),Ur(P,[F])},onLeaveCancelled(F){M(F),Ur(T,[F])}})}function aR(n){if(n==null)return null;if(It(n))return[pp(n.enter),pp(n.leave)];{const e=pp(n);return[e,e]}}function pp(n){return cC(n)}function cs(n,e){e.split(/\s+/).forEach(t=>t&&n.classList.add(t)),(n[Zl]||(n[Zl]=new Set)).add(e)}function Fr(n,e){e.split(/\s+/).forEach(i=>i&&n.classList.remove(i));const t=n[Zl];t&&(t.delete(e),t.size||(n[Zl]=void 0))}function Nv(n){requestAnimationFrame(()=>{requestAnimationFrame(n)})}let lR=0;function Uv(n,e,t,i){const s=n._endId=++lR,r=()=>{s===n._endId&&i()};if(t!=null)return setTimeout(r,t);const{type:o,timeout:a,propCount:l}=cR(n,e);if(!o)return i();const c=o+"end";let u=0;const f=()=>{n.removeEventListener(c,d),r()},d=h=>{h.target===n&&++u>=l&&f()};setTimeout(()=>{u(t[p]||"").split(", "),s=i(`${Xs}Delay`),r=i(`${Xs}Duration`),o=Fv(s,r),a=i(`${qa}Delay`),l=i(`${qa}Duration`),c=Fv(a,l);let u=null,f=0,d=0;e===Xs?o>0&&(u=Xs,f=o,d=r.length):e===qa?c>0&&(u=qa,f=c,d=l.length):(f=Math.max(o,c),u=f>0?o>c?Xs:qa:null,d=u?u===Xs?r.length:l.length:0);const h=u===Xs&&/\b(transform|all)(,|$)/.test(i(`${Xs}Property`).toString());return{type:u,timeout:f,propCount:d,hasTransform:h}}function Fv(n,e){for(;n.lengthkv(t)+kv(n[i])))}function kv(n){return n==="auto"?0:Number(n.slice(0,-1).replace(",","."))*1e3}function Bv(){return document.body.offsetHeight}function uR(n,e,t){const i=n[Zl];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const zv=Symbol("_vod"),fR=Symbol("_vsh"),dR=Symbol(""),hR=/(^|;)\s*display\s*:/;function pR(n,e,t){const i=n.style,s=Ut(t);let r=!1;if(t&&!s){if(e)if(Ut(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();t[a]==null&&yf(i,a,"")}else for(const o in e)t[o]==null&&yf(i,o,"");for(const o in t)o==="display"&&(r=!0),yf(i,o,t[o])}else if(s){if(e!==t){const o=i[dR];o&&(t+=";"+o),i.cssText=t,r=hR.test(t)}}else e&&n.removeAttribute("style");zv in n&&(n[zv]=r?i.display:"",n[fR]&&(i.display="none"))}const Vv=/\s*!important$/;function yf(n,e,t){if(ze(t))t.forEach(i=>yf(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=mR(n,e);Vv.test(t)?n.setProperty(ks(i),t.replace(Vv,""),"important"):n[i]=t}}const Hv=["Webkit","Moz","ms"],mp={};function mR(n,e){const t=mp[e];if(t)return t;let i=ai(e);if(i!=="filter"&&i in n)return mp[e]=i;i=Gd(i);for(let s=0;sgp||(yR.then(()=>gp=0),gp=Date.now());function xR(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;Fi(MR(i,t.value),e,5,[i])};return t.value=n,t.attached=bR(),t}function MR(n,e){if(ze(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>s=>!s._stopped&&i&&i(s))}else return e}const Yv=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,SR=(n,e,t,i,s,r)=>{const o=s==="svg";e==="class"?uR(n,i,o):e==="style"?pR(n,t,i):Vd(e)?d0(e)||_R(n,e,t,i,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):ER(n,e,i,o))?(Xv(n,e,i),!n.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Wv(n,e,i,o,r,e!=="value")):n._isVueCE&&(/[A-Z]/.test(e)||!Ut(i))?Xv(n,ai(e),i,r,e):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),Wv(n,e,i,o))};function ER(n,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in n&&Yv(e)&&Ke(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=n.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Yv(e)&&Ut(t)?!1:e in n}const mr=n=>{const e=n.props["onUpdate:modelValue"]||!1;return ze(e)?t=>mf(e,t):e};function TR(n){n.target.composing=!0}function jv(n){const e=n.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const yi=Symbol("_assign"),Kv={created(n,{modifiers:{lazy:e,trim:t,number:i}},s){n[yi]=mr(s);const r=i||s.props&&s.props.type==="number";Ms(n,e?"change":"input",o=>{if(o.target.composing)return;let a=n.value;t&&(a=a.trim()),r&&(a=If(a)),n[yi](a)}),t&&Ms(n,"change",()=>{n.value=n.value.trim()}),e||(Ms(n,"compositionstart",TR),Ms(n,"compositionend",jv),Ms(n,"change",jv))},mounted(n,{value:e}){n.value=e??""},beforeUpdate(n,{value:e,oldValue:t,modifiers:{lazy:i,trim:s,number:r}},o){if(n[yi]=mr(o),n.composing)return;const a=(r||n.type==="number")&&!/^0\d/.test(n.value)?If(n.value):n.value,l=e??"";a!==l&&(document.activeElement===n&&n.type!=="range"&&(i&&e===t||s&&n.value.trim()===l)||(n.value=l))}},wR={deep:!0,created(n,e,t){n[yi]=mr(t),Ms(n,"change",()=>{const i=n._modelValue,s=ga(n),r=n.checked,o=n[yi];if(ze(i)){const a=m0(i,s),l=a!==-1;if(r&&!l)o(i.concat(s));else if(!r&&l){const c=[...i];c.splice(a,1),o(c)}}else if(Da(i)){const a=new Set(i);r?a.add(s):a.delete(s),o(a)}else o(i1(n,r))})},mounted:Zv,beforeUpdate(n,e,t){n[yi]=mr(t),Zv(n,e,t)}};function Zv(n,{value:e,oldValue:t},i){n._modelValue=e;let s;if(ze(e))s=m0(e,i.props.value)>-1;else if(Da(e))s=e.has(i.props.value);else{if(e===t)return;s=vo(e,i1(n,!0))}n.checked!==s&&(n.checked=s)}const AR={created(n,{value:e},t){n.checked=vo(e,t.props.value),n[yi]=mr(t),Ms(n,"change",()=>{n[yi](ga(n))})},beforeUpdate(n,{value:e,oldValue:t},i){n[yi]=mr(i),e!==t&&(n.checked=vo(e,i.props.value))}},CR={deep:!0,created(n,{value:e,modifiers:{number:t}},i){const s=Da(e);Ms(n,"change",()=>{const r=Array.prototype.filter.call(n.options,o=>o.selected).map(o=>t?If(ga(o)):ga(o));n[yi](n.multiple?s?new Set(r):r:r[0]),n._assigning=!0,Er(()=>{n._assigning=!1})}),n[yi]=mr(i)},mounted(n,{value:e}){Jv(n,e)},beforeUpdate(n,e,t){n[yi]=mr(t)},updated(n,{value:e}){n._assigning||Jv(n,e)}};function Jv(n,e){const t=n.multiple,i=ze(e);if(!(t&&!i&&!Da(e))){for(let s=0,r=n.options.length;sString(c)===String(a)):o.selected=m0(e,a)>-1}else o.selected=e.has(a);else if(vo(ga(o),e)){n.selectedIndex!==s&&(n.selectedIndex=s);return}}!t&&n.selectedIndex!==-1&&(n.selectedIndex=-1)}}function ga(n){return"_value"in n?n._value:n.value}function i1(n,e){const t=e?"_trueValue":"_falseValue";return t in n?n[t]:e}const cG={created(n,e,t){au(n,e,t,null,"created")},mounted(n,e,t){au(n,e,t,null,"mounted")},beforeUpdate(n,e,t,i){au(n,e,t,i,"beforeUpdate")},updated(n,e,t,i){au(n,e,t,i,"updated")}};function RR(n,e){switch(n){case"SELECT":return CR;case"TEXTAREA":return Kv;default:switch(e){case"checkbox":return wR;case"radio":return AR;default:return Kv}}}function au(n,e,t,i,s){const o=RR(n.tagName,t.props&&t.props.type)[s];o&&o(n,e,t,i)}const PR=["ctrl","shift","alt","meta"],IR={stop:n=>n.stopPropagation(),prevent:n=>n.preventDefault(),self:n=>n.target!==n.currentTarget,ctrl:n=>!n.ctrlKey,shift:n=>!n.shiftKey,alt:n=>!n.altKey,meta:n=>!n.metaKey,left:n=>"button"in n&&n.button!==0,middle:n=>"button"in n&&n.button!==1,right:n=>"button"in n&&n.button!==2,exact:(n,e)=>PR.some(t=>n[`${t}Key`]&&!e.includes(t))},uG=(n,e)=>{const t=n._withMods||(n._withMods={}),i=e.join(".");return t[i]||(t[i]=(s,...r)=>{for(let o=0;o{const t=n._withKeys||(n._withKeys={}),i=e.join(".");return t[i]||(t[i]=s=>{if(!("key"in s))return;const r=ks(s.key);if(e.some(o=>o===r||LR[o]===r))return n(s)})},DR=nn({patchProp:SR},iR);let Qv;function s1(){return Qv||(Qv=WS(DR))}const dG=(...n)=>{s1().render(...n)},OR=(...n)=>{const e=s1().createApp(...n),{mount:t}=e;return e.mount=i=>{const s=UR(i);if(!s)return;const r=e._component;!Ke(r)&&!r.render&&!r.template&&(r.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=t(s,!1,NR(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e};function NR(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function UR(n){return Ut(n)?document.querySelector(n):n}const r1=new Set,Zn=new WeakMap,_a=new WeakMap,bo=new WeakMap,rg=new WeakMap,FR=new WeakMap,va=new WeakMap,Bf=new WeakMap,dl=new WeakSet;let gr,I0=0,L0=0;const Ts="__aa_tgt",Jl="__aa_del",zf="__aa_new",kR=n=>{const e=WR(n);e&&e.forEach(t=>XR(t))},BR=n=>{n.forEach(e=>{e.target===gr&&VR(),Zn.has(e.target)&&wo(e.target)})};function zR(n){const e=rg.get(n);e==null||e.disconnect();let t=Zn.get(n),i=0;const s=5;t||(t=ya(n),Zn.set(n,t));const{offsetWidth:r,offsetHeight:o}=gr,l=[t.top-s,r-(t.left+s+t.width),o-(t.top+s+t.height),t.left-s].map(u=>`${-1*Math.floor(u)}px`).join(" "),c=new IntersectionObserver(()=>{++i>1&&wo(n)},{root:gr,threshold:1,rootMargin:l});c.observe(n),rg.set(n,c)}function wo(n){clearTimeout(Bf.get(n));const e=th(n),t=Ql(e)?500:e.duration;Bf.set(n,setTimeout(async()=>{const i=bo.get(n);try{await(i==null?void 0:i.finished),Zn.set(n,ya(n)),zR(n)}catch{}},t))}function VR(){clearTimeout(Bf.get(gr)),Bf.set(gr,setTimeout(()=>{r1.forEach(n=>c1(n,e=>o1(()=>wo(e))))},100))}function HR(n){setTimeout(()=>{FR.set(n,setInterval(()=>o1(wo.bind(null,n)),2e3))},Math.round(2e3*Math.random()))}function o1(n){typeof requestIdleCallback=="function"?requestIdleCallback(()=>n()):requestAnimationFrame(()=>n())}let og,sa;const GR=typeof window<"u"&&"ResizeObserver"in window;GR&&(gr=document.documentElement,og=new MutationObserver(kR),sa=new ResizeObserver(BR),window.addEventListener("scroll",()=>{L0=window.scrollY,I0=window.scrollX}),sa.observe(gr));function WR(n){return n.reduce((i,s)=>[...i,...Array.from(s.addedNodes),...Array.from(s.removedNodes)],[]).every(i=>i.nodeName==="#comment")?!1:n.reduce((i,s)=>{if(i===!1)return!1;if(s.target instanceof Element){if(_p(s.target),!i.has(s.target)){i.add(s.target);for(let r=0;rt(n,va.has(n)));for(let t=0;ts(i,va.has(i)))}}function O0(n){return Array.isArray(n)?n:[n]}function Ql(n){return typeof n=="function"}function qR(n){const e=Zn.get(n),t=ya(n);if(!D0(n))return Zn.set(n,t);let i;if(!e)return;const s=th(n);if(typeof s!="function"){const r=e.left-t.left,o=e.top-t.top,[a,l,c,u]=a1(n,e,t),f={transform:`translate(${r}px, ${o}px)`},d={transform:"translate(0, 0)"};a!==l&&(f.width=`${a}px`,d.width=`${l}px`),c!==u&&(f.height=`${c}px`,d.height=`${u}px`),i=n.animate([f,d],{duration:s.duration,easing:s.easing})}else{const[r]=O0(s(n,"remain",e,t));i=new Animation(r),i.play()}bo.set(n,i),Zn.set(n,t),i.addEventListener("finish",wo.bind(null,n))}function ey(n){zf in n&&delete n[zf];const e=ya(n);Zn.set(n,e);const t=th(n);if(!D0(n))return;let i;if(typeof t!="function")i=n.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:t.duration*1.5,easing:"ease-in"});else{const[s]=O0(t(n,"add",e));i=new Animation(s),i.play()}bo.set(n,i),i.addEventListener("finish",wo.bind(null,n))}function ty(n,e){var t;n.remove(),Zn.delete(n),_a.delete(n),bo.delete(n),(t=rg.get(n))===null||t===void 0||t.disconnect(),setTimeout(()=>{if(Jl in n&&delete n[Jl],Object.defineProperty(n,zf,{value:!0,configurable:!0}),e&&n instanceof HTMLElement)for(const i in e)n.style[i]=""},0)}function YR(n){var e;if(!_a.has(n)||!Zn.has(n))return;const[t,i]=_a.get(n);Object.defineProperty(n,Jl,{value:!0,configurable:!0});const s=window.scrollX,r=window.scrollY;if(i&&i.parentNode&&i.parentNode instanceof Element?i.parentNode.insertBefore(n,i):t&&t.parentNode?t.parentNode.appendChild(n):(e=l1(n))===null||e===void 0||e.appendChild(n),!D0(n))return ty(n);const[o,a,l,c]=KR(n),u=th(n),f=Zn.get(n);(s!==I0||r!==L0)&&jR(n,s,r,u);let d,h={position:"absolute",top:`${o}px`,left:`${a}px`,width:`${l}px`,height:`${c}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!Ql(u))Object.assign(n.style,h),d=n.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:u.duration,easing:"ease-out"});else{const[p,_]=O0(u(n,"remove",f));(_==null?void 0:_.styleReset)!==!1&&(h=(_==null?void 0:_.styleReset)||h,Object.assign(n.style,h)),d=new Animation(p),d.play()}bo.set(n,d),d.addEventListener("finish",ty.bind(null,n,h))}function jR(n,e,t,i){const s=I0-e,r=L0-t,o=document.documentElement.style.scrollBehavior;if(getComputedStyle(gr).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+s,window.scrollY+r),!n.parentElement)return;const l=n.parentElement;let c=l.clientHeight,u=l.clientWidth;const f=performance.now();function d(){requestAnimationFrame(()=>{if(!Ql(i)){const h=c-l.clientHeight,p=u-l.clientWidth;f+i.duration>performance.now()?(window.scrollTo({left:window.scrollX-p,top:window.scrollY-h}),c=l.clientHeight,u=l.clientWidth,d()):document.documentElement.style.scrollBehavior=o}})}d()}function KR(n){const e=Zn.get(n),[t,,i]=a1(n,e,ya(n));let s=n.parentElement;for(;s&&(getComputedStyle(s).position==="static"||s instanceof HTMLBodyElement);)s=s.parentElement;s||(s=document.body);const r=getComputedStyle(s),o=Zn.get(s)||ya(s),a=Math.round(e.top-o.top)-Xi(r.borderTopWidth),l=Math.round(e.left-o.left)-Xi(r.borderLeftWidth);return[a,l,t,i]}function ZR(n,e={}){return og&&sa&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!Ql(e)&&!e.disrespectUserMotionPreference||(dl.add(n),getComputedStyle(n).position==="static"&&Object.assign(n.style,{position:"relative"}),c1(n,wo,HR,s=>sa==null?void 0:sa.observe(s)),Ql(e)?va.set(n,e):va.set(n,{duration:250,easing:"ease-in-out",...e}),og.observe(n,{childList:!0}),r1.add(n))),Object.freeze({parent:n,enable:()=>{dl.add(n)},disable:()=>{dl.delete(n)},isEnabled:()=>dl.has(n)})}const JR={mounted:(n,e)=>{ZR(n,e.value||{})},getSSRProps:()=>({})},QR=JR,e3={install(n){n.directive("auto-animate",QR)}};/** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT - */const Dc="175",e3={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},t3={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},c1=0,ag=1,u1=2,n3=3,i3=0,N0=1,U0=2,$i=3,Os=0,zn=1,Ii=2,Ps=0,po=1,lg=2,cg=3,ug=4,f1=5,lr=100,d1=101,h1=102,p1=103,m1=104,g1=200,_1=201,v1=202,y1=203,Vf=204,Hf=205,b1=206,x1=207,M1=208,S1=209,E1=210,T1=211,w1=212,A1=213,C1=214,Gf=0,Wf=1,Xf=2,xo=3,$f=4,qf=5,Yf=6,jf=7,Oc=0,R1=1,P1=2,Zi=0,I1=1,L1=2,D1=3,nh=4,O1=5,N1=6,U1=7,fg="attached",F1="detached",ih=300,Ns=301,_r=302,ec=303,tc=304,Na=306,nc=1e3,gi=1001,ic=1002,gn=1003,F0=1004,s3=1004,ra=1005,r3=1005,en=1006,Ml=1007,o3=1007,ji=1008,a3=1008,is=1009,k0=1010,B0=1011,ba=1012,sh=1013,Us=1014,Kn=1015,Ua=1016,rh=1017,oh=1018,xa=1020,z0=35902,V0=1021,H0=1022,Bn=1023,G0=1024,W0=1025,Ma=1026,Sa=1027,ah=1028,Nc=1029,X0=1030,lh=1031,l3=1032,ch=1033,Sl=33776,El=33777,Tl=33778,wl=33779,Kf=35840,Zf=35841,Jf=35842,Qf=35843,ed=36196,td=37492,nd=37496,id=37808,sd=37809,rd=37810,od=37811,ad=37812,ld=37813,cd=37814,ud=37815,fd=37816,dd=37817,hd=37818,pd=37819,md=37820,gd=37821,Al=36492,_d=36494,vd=36495,$0=36283,yd=36284,bd=36285,xd=36286,k1=2200,B1=2201,z1=2202,sc=2300,Md=2301,bf=2302,ao=2400,lo=2401,rc=2402,uh=2500,q0=2501,c3=0,u3=1,f3=2,V1=3200,H1=3201,d3=3202,h3=3203,Tr=0,G1=1,Ss="",Nn="srgb",Mo="srgb-linear",oc="linear",wt="srgb",p3=0,eo=7680,m3=7681,g3=7682,_3=7683,v3=34055,y3=34056,b3=5386,x3=512,M3=513,S3=514,E3=515,T3=516,w3=517,A3=518,dg=519,W1=512,X1=513,$1=514,Y0=515,q1=516,Y1=517,j1=518,K1=519,ac=35044,C3=35048,R3=35040,P3=35045,I3=35049,L3=35041,D3=35046,O3=35050,N3=35042,U3="100",hg="300 es",Li=2e3,lc=2001,F3={COMPUTE:"compute",RENDER:"render"};class rs{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const s=i[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r>8&255]+yn[n>>16&255]+yn[n>>24&255]+"-"+yn[e&255]+yn[e>>8&255]+"-"+yn[e>>16&15|64]+yn[e>>24&255]+"-"+yn[t&63|128]+yn[t>>8&255]+"-"+yn[t>>16&255]+yn[t>>24&255]+yn[i&255]+yn[i>>8&255]+yn[i>>16&255]+yn[i>>24&255]).toLowerCase()}function tt(n,e,t){return Math.max(e,Math.min(t,n))}function j0(n,e){return(n%e+e)%e}function k3(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function B3(n,e,t){return n!==e?(t-n)/(e-n):0}function Cl(n,e,t){return(1-t)*n+t*e}function z3(n,e,t,i){return Cl(n,e,1-Math.exp(-t*i))}function V3(n,e=1){return e-Math.abs(j0(n,e*2)-e)}function H3(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function G3(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function W3(n,e){return n+Math.floor(Math.random()*(e-n+1))}function X3(n,e){return n+Math.random()*(e-n)}function $3(n){return n*(.5-Math.random())}function q3(n){n!==void 0&&(ny=n);let e=ny+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Y3(n){return n*mo}function j3(n){return n*Ea}function K3(n){return(n&n-1)===0&&n!==0}function Z3(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function J3(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Q3(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+i)/2),u=o((e+i)/2),f=r((e-i)/2),d=o((e-i)/2),h=r((i-e)/2),p=o((i-e)/2);switch(s){case"XYX":n.set(a*u,l*f,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*f,a*c);break;case"ZXZ":n.set(l*f,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*p,l*h,a*c);break;case"YXY":n.set(l*h,a*u,l*p,a*c);break;case"ZYZ":n.set(l*p,l*h,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function kn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function rt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const K0={DEG2RAD:mo,RAD2DEG:Ea,generateUUID:ri,clamp:tt,euclideanModulo:j0,mapLinear:k3,inverseLerp:B3,lerp:Cl,damp:z3,pingpong:V3,smoothstep:H3,smootherstep:G3,randInt:W3,randFloat:X3,randFloatSpread:$3,seededRandom:q3,degToRad:Y3,radToDeg:j3,isPowerOfTwo:K3,ceilPowerOfTwo:Z3,floorPowerOfTwo:J3,setQuaternionFromProperEuler:Q3,normalize:rt,denormalize:kn};class de{constructor(e=0,t=0){de.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class it{constructor(e,t,i,s,r,o,a,l,c){it.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,c)}set(e,t,i,s,r,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],f=i[7],d=i[2],h=i[5],p=i[8],_=s[0],g=s[3],m=s[6],y=s[1],b=s[4],v=s[7],T=s[2],E=s[5],S=s[8];return r[0]=o*_+a*y+l*T,r[3]=o*g+a*b+l*E,r[6]=o*m+a*v+l*S,r[1]=c*_+u*y+f*T,r[4]=c*g+u*b+f*E,r[7]=c*m+u*v+f*S,r[2]=d*_+h*y+p*T,r[5]=d*g+h*b+p*E,r[8]=d*m+h*v+p*S,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*r*u+i*a*l+s*r*c-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,d=a*l-u*r,h=c*r-o*l,p=t*f+i*d+s*h;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/p;return e[0]=f*_,e[1]=(s*c-u*i)*_,e[2]=(a*i-s*o)*_,e[3]=d*_,e[4]=(u*t-s*l)*_,e[5]=(s*r-a*t)*_,e[6]=h*_,e[7]=(i*l-c*t)*_,e[8]=(o*t-i*r)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(vp.makeScale(e,t)),this}rotate(e){return this.premultiply(vp.makeRotation(-e)),this}translate(e,t){return this.premultiply(vp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const vp=new it;function Z1(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const eP={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function oa(n,e){return new eP[n](e)}function cc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function J1(){const n=cc("canvas");return n.style.display="block",n}const iy={};function xf(n){n in iy||(iy[n]=!0,console.warn(n))}function tP(n,e,t){return new Promise(function(i,s){function r(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:s();break;case n.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:i()}}setTimeout(r,t)})}function nP(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function iP(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const sy=new it().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ry=new it().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function sP(){const n={enabled:!0,workingColorSpace:Mo,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===wt&&(s.r=Is(s.r),s.g=Is(s.g),s.b=Is(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===wt&&(s.r=ha(s.r),s.g=ha(s.g),s.b=ha(s.b))),s},fromWorkingColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},toWorkingColorSpace:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Ss?oc:this.spaces[s].transfer},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[Mo]:{primaries:e,whitePoint:i,transfer:oc,toXYZ:sy,fromXYZ:ry,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Nn},outputColorSpaceConfig:{drawingBufferColorSpace:Nn}},[Nn]:{primaries:e,whitePoint:i,transfer:wt,toXYZ:sy,fromXYZ:ry,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Nn}}}),n}const ft=sP();function Is(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ha(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Uo;class Q1{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Uo===void 0&&(Uo=cc("canvas")),Uo.width=e.width,Uo.height=e.height;const s=Uo.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=Uo}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=cc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ih)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case nc:e.x=e.x-Math.floor(e.x);break;case gi:e.x=e.x<0?0:1;break;case ic:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case nc:e.y=e.y-Math.floor(e.y);break;case gi:e.y=e.y<0?0:1;break;case ic:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Wt.DEFAULT_IMAGE=null;Wt.DEFAULT_MAPPING=ih;Wt.DEFAULT_ANISOTROPY=1;class gt{constructor(e=0,t=0,i=0,s=1){gt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const l=e.elements,c=l[0],u=l[4],f=l[8],d=l[1],h=l[5],p=l[9],_=l[2],g=l[6],m=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-_)<.01&&Math.abs(p-g)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+_)<.1&&Math.abs(p+g)<.1&&Math.abs(c+h+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const b=(c+1)/2,v=(h+1)/2,T=(m+1)/2,E=(u+d)/4,S=(f+_)/4,P=(p+g)/4;return b>v&&b>T?b<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(b),s=E/i,r=S/i):v>T?v<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(v),i=E/s,r=P/s):T<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(T),i=S/r,s=P/r),this.set(i,s,r,t),this}let y=Math.sqrt((g-p)*(g-p)+(f-_)*(f-_)+(d-u)*(d-u));return Math.abs(y)<.001&&(y=1),this.x=(g-p)/y,this.y=(f-_)/y,this.z=(d-u)/y,this.w=Math.acos((c+h+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this.z=tt(this.z,e.z,t.z),this.w=tt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this.z=tt(this.z,e,t),this.w=tt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class fh extends rs{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new gt(0,0,e,t),this.scissorTest=!1,this.viewport=new gt(0,0,e,t);const s={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:en,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const r=new Wt(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);r.flipY=!1,r.generateMipmaps=i.generateMipmaps,r.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a=0?1:-1,b=1-m*m;if(b>Number.EPSILON){const T=Math.sqrt(b),E=Math.atan2(T,m*y);g=Math.sin(g*E)/T,a=Math.sin(a*E)/T}const v=a*y;if(l=l*g+d*v,c=c*g+h*v,u=u*g+p*v,f=f*g+_*v,g===1-a){const T=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=T,c*=T,u*=T,f*=T}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],u=i[s+3],f=r[o],d=r[o+1],h=r[o+2],p=r[o+3];return e[t]=a*p+u*f+l*h-c*d,e[t+1]=l*p+u*d+c*f-a*h,e[t+2]=c*p+u*h+a*d-l*f,e[t+3]=u*p-a*f-l*d-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(s/2),f=a(r/2),d=l(i/2),h=l(s/2),p=l(r/2);switch(o){case"XYZ":this._x=d*u*f+c*h*p,this._y=c*h*f-d*u*p,this._z=c*u*p+d*h*f,this._w=c*u*f-d*h*p;break;case"YXZ":this._x=d*u*f+c*h*p,this._y=c*h*f-d*u*p,this._z=c*u*p-d*h*f,this._w=c*u*f+d*h*p;break;case"ZXY":this._x=d*u*f-c*h*p,this._y=c*h*f+d*u*p,this._z=c*u*p+d*h*f,this._w=c*u*f-d*h*p;break;case"ZYX":this._x=d*u*f-c*h*p,this._y=c*h*f+d*u*p,this._z=c*u*p-d*h*f,this._w=c*u*f+d*h*p;break;case"YZX":this._x=d*u*f+c*h*p,this._y=c*h*f+d*u*p,this._z=c*u*p-d*h*f,this._w=c*u*f-d*h*p;break;case"XZY":this._x=d*u*f-c*h*p,this._y=c*h*f-d*u*p,this._z=c*u*p+d*h*f,this._w=c*u*f+d*h*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],d=i+a+f;if(d>0){const h=.5/Math.sqrt(d+1);this._w=.25/h,this._x=(u-l)*h,this._y=(r-c)*h,this._z=(o-s)*h}else if(i>a&&i>f){const h=2*Math.sqrt(1+i-a-f);this._w=(u-l)/h,this._x=.25*h,this._y=(s+o)/h,this._z=(r+c)/h}else if(a>f){const h=2*Math.sqrt(1+a-i-f);this._w=(r-c)/h,this._x=(s+o)/h,this._y=.25*h,this._z=(l+u)/h}else{const h=2*Math.sqrt(1+f-i-a);this._w=(o-s)/h,this._x=(r+c)/h,this._y=(l+u)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(tt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+s*c-r*l,this._y=s*u+o*l+r*a-i*c,this._z=r*u+o*c+i*l-s*a,this._w=o*u-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-t;return this._w=h*o+t*this._w,this._x=h*i+t*this._x,this._y=h*s+t*this._y,this._z=h*r+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*f+this._w*d,this._x=i*f+this._x*d,this._y=s*f+this._y*d,this._z=r*f+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class B{constructor(e=0,t=0,i=0){B.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(oy.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(oy.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*s-a*i),u=2*(a*t-r*s),f=2*(r*i-o*t);return this.x=t+l*c+o*f-a*u,this.y=i+l*u+a*c-r*f,this.z=s+l*f+r*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this.z=tt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this.z=tt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return bp.copy(this).projectOnVector(e),this.sub(bp)}reflect(e){return this.sub(bp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const bp=new B,oy=new Jn;class Vn{constructor(e=new B(1/0,1/0,1/0),t=new B(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Ai),Ai.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ya),cu.subVectors(this.max,Ya),Fo.subVectors(e.a,Ya),ko.subVectors(e.b,Ya),Bo.subVectors(e.c,Ya),$s.subVectors(ko,Fo),qs.subVectors(Bo,ko),kr.subVectors(Fo,Bo);let t=[0,-$s.z,$s.y,0,-qs.z,qs.y,0,-kr.z,kr.y,$s.z,0,-$s.x,qs.z,0,-qs.x,kr.z,0,-kr.x,-$s.y,$s.x,0,-qs.y,qs.x,0,-kr.y,kr.x,0];return!xp(t,Fo,ko,Bo,cu)||(t=[1,0,0,0,1,0,0,0,1],!xp(t,Fo,ko,Bo,cu))?!1:(uu.crossVectors($s,qs),t=[uu.x,uu.y,uu.z],xp(t,Fo,ko,Bo,cu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ai).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ai).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(us[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),us[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),us[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),us[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),us[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),us[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),us[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),us[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(us),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const us=[new B,new B,new B,new B,new B,new B,new B,new B],Ai=new B,lu=new Vn,Fo=new B,ko=new B,Bo=new B,$s=new B,qs=new B,kr=new B,Ya=new B,cu=new B,uu=new B,Br=new B;function xp(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){Br.fromArray(n,r);const a=s.x*Math.abs(Br.x)+s.y*Math.abs(Br.y)+s.z*Math.abs(Br.z),l=e.dot(Br),c=t.dot(Br),u=i.dot(Br);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const cP=new Vn,ja=new B,Mp=new B;class Tn{constructor(e=new B,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):cP.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ja.subVectors(e,this.center);const t=ja.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(ja,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Mp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ja.copy(e.center).add(Mp)),this.expandByPoint(ja.copy(e.center).sub(Mp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const fs=new B,Sp=new B,fu=new B,Ys=new B,Ep=new B,du=new B,Tp=new B;class Fa{constructor(e=new B,t=new B(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,fs)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=fs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(fs.copy(this.origin).addScaledVector(this.direction,t),fs.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Sp.copy(e).add(t).multiplyScalar(.5),fu.copy(t).sub(e).normalize(),Ys.copy(this.origin).sub(Sp);const r=e.distanceTo(t)*.5,o=-this.direction.dot(fu),a=Ys.dot(this.direction),l=-Ys.dot(fu),c=Ys.lengthSq(),u=Math.abs(1-o*o);let f,d,h,p;if(u>0)if(f=o*l-a,d=o*a-l,p=r*u,f>=0)if(d>=-p)if(d<=p){const _=1/u;f*=_,d*=_,h=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=r,f=Math.max(0,-(o*d+a)),h=-f*f+d*(d+2*l)+c;else d=-r,f=Math.max(0,-(o*d+a)),h=-f*f+d*(d+2*l)+c;else d<=-p?(f=Math.max(0,-(-o*r+a)),d=f>0?-r:Math.min(Math.max(-r,-l),r),h=-f*f+d*(d+2*l)+c):d<=p?(f=0,d=Math.min(Math.max(-r,-l),r),h=d*(d+2*l)+c):(f=Math.max(0,-(o*r+a)),d=f>0?r:Math.min(Math.max(-r,-l),r),h=-f*f+d*(d+2*l)+c);else d=o>0?-r:r,f=Math.max(0,-(o*d+a)),h=-f*f+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),s&&s.copy(Sp).addScaledVector(fu,d),h}intersectSphere(e,t){fs.subVectors(e.center,this.origin);const i=fs.dot(this.direction),s=fs.dot(fs)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,s=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,s=(e.min.x-d.x)*c),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.z)*f),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,fs)!==null}intersectTriangle(e,t,i,s,r){Ep.subVectors(t,e),du.subVectors(i,e),Tp.crossVectors(Ep,du);let o=this.direction.dot(Tp),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ys.subVectors(this.origin,e);const l=a*this.direction.dot(du.crossVectors(Ys,du));if(l<0)return null;const c=a*this.direction.dot(Ep.cross(Ys));if(c<0||l+c>o)return null;const u=-a*Ys.dot(Tp);return u<0?null:this.at(u/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ye{constructor(e,t,i,s,r,o,a,l,c,u,f,d,h,p,_,g){Ye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,c,u,f,d,h,p,_,g)}set(e,t,i,s,r,o,a,l,c,u,f,d,h,p,_,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=s,m[1]=r,m[5]=o,m[9]=a,m[13]=l,m[2]=c,m[6]=u,m[10]=f,m[14]=d,m[3]=h,m[7]=p,m[11]=_,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ye().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/zo.setFromMatrixColumn(e,0).length(),r=1/zo.setFromMatrixColumn(e,1).length(),o=1/zo.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),f=Math.sin(r);if(e.order==="XYZ"){const d=o*u,h=o*f,p=a*u,_=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=h+p*c,t[5]=d-_*c,t[9]=-a*l,t[2]=_-d*c,t[6]=p+h*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,h=l*f,p=c*u,_=c*f;t[0]=d+_*a,t[4]=p*a-h,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=h*a-p,t[6]=_+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,h=l*f,p=c*u,_=c*f;t[0]=d-_*a,t[4]=-o*f,t[8]=p+h*a,t[1]=h+p*a,t[5]=o*u,t[9]=_-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,h=o*f,p=a*u,_=a*f;t[0]=l*u,t[4]=p*c-h,t[8]=d*c+_,t[1]=l*f,t[5]=_*c+d,t[9]=h*c-p,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,h=o*c,p=a*l,_=a*c;t[0]=l*u,t[4]=_-d*f,t[8]=p*f+h,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=h*f+p,t[10]=d-_*f}else if(e.order==="XZY"){const d=o*l,h=o*c,p=a*l,_=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+_,t[5]=o*u,t[9]=h*f-p,t[2]=p*f-h,t[6]=a*u,t[10]=_*f+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(uP,e,fP)}lookAt(e,t,i){const s=this.elements;return ni.subVectors(e,t),ni.lengthSq()===0&&(ni.z=1),ni.normalize(),js.crossVectors(i,ni),js.lengthSq()===0&&(Math.abs(i.z)===1?ni.x+=1e-4:ni.z+=1e-4,ni.normalize(),js.crossVectors(i,ni)),js.normalize(),hu.crossVectors(ni,js),s[0]=js.x,s[4]=hu.x,s[8]=ni.x,s[1]=js.y,s[5]=hu.y,s[9]=ni.y,s[2]=js.z,s[6]=hu.z,s[10]=ni.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],f=i[5],d=i[9],h=i[13],p=i[2],_=i[6],g=i[10],m=i[14],y=i[3],b=i[7],v=i[11],T=i[15],E=s[0],S=s[4],P=s[8],x=s[12],M=s[1],L=s[5],F=s[9],H=s[13],Y=s[2],ee=s[6],K=s[10],Q=s[14],Z=s[3],he=s[7],be=s[11],se=s[15];return r[0]=o*E+a*M+l*Y+c*Z,r[4]=o*S+a*L+l*ee+c*he,r[8]=o*P+a*F+l*K+c*be,r[12]=o*x+a*H+l*Q+c*se,r[1]=u*E+f*M+d*Y+h*Z,r[5]=u*S+f*L+d*ee+h*he,r[9]=u*P+f*F+d*K+h*be,r[13]=u*x+f*H+d*Q+h*se,r[2]=p*E+_*M+g*Y+m*Z,r[6]=p*S+_*L+g*ee+m*he,r[10]=p*P+_*F+g*K+m*be,r[14]=p*x+_*H+g*Q+m*se,r[3]=y*E+b*M+v*Y+T*Z,r[7]=y*S+b*L+v*ee+T*he,r[11]=y*P+b*F+v*K+T*be,r[15]=y*x+b*H+v*Q+T*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],h=e[14],p=e[3],_=e[7],g=e[11],m=e[15];return p*(+r*l*f-s*c*f-r*a*d+i*c*d+s*a*h-i*l*h)+_*(+t*l*h-t*c*d+r*o*d-s*o*h+s*c*u-r*l*u)+g*(+t*c*f-t*a*h-r*o*f+i*o*h+r*a*u-i*c*u)+m*(-s*a*u-t*l*f+t*a*d+s*o*f-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],d=e[10],h=e[11],p=e[12],_=e[13],g=e[14],m=e[15],y=f*g*c-_*d*c+_*l*h-a*g*h-f*l*m+a*d*m,b=p*d*c-u*g*c-p*l*h+o*g*h+u*l*m-o*d*m,v=u*_*c-p*f*c+p*a*h-o*_*h-u*a*m+o*f*m,T=p*f*l-u*_*l-p*a*d+o*_*d+u*a*g-o*f*g,E=t*y+i*b+s*v+r*T;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/E;return e[0]=y*S,e[1]=(_*d*r-f*g*r-_*s*h+i*g*h+f*s*m-i*d*m)*S,e[2]=(a*g*r-_*l*r+_*s*c-i*g*c-a*s*m+i*l*m)*S,e[3]=(f*l*r-a*d*r-f*s*c+i*d*c+a*s*h-i*l*h)*S,e[4]=b*S,e[5]=(u*g*r-p*d*r+p*s*h-t*g*h-u*s*m+t*d*m)*S,e[6]=(p*l*r-o*g*r-p*s*c+t*g*c+o*s*m-t*l*m)*S,e[7]=(o*d*r-u*l*r+u*s*c-t*d*c-o*s*h+t*l*h)*S,e[8]=v*S,e[9]=(p*f*r-u*_*r-p*i*h+t*_*h+u*i*m-t*f*m)*S,e[10]=(o*_*r-p*a*r+p*i*c-t*_*c-o*i*m+t*a*m)*S,e[11]=(u*a*r-o*f*r-u*i*c+t*f*c+o*i*h-t*a*h)*S,e[12]=T*S,e[13]=(u*_*s-p*f*s+p*i*d-t*_*d-u*i*g+t*f*g)*S,e[14]=(p*a*s-o*_*s-p*i*l+t*_*l+o*i*g-t*a*g)*S,e[15]=(o*f*s-u*a*s+u*i*l-t*f*l-o*i*d+t*a*d)*S,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,c=r*o,u=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,u*a+i,u*l-s*o,0,c*l-s*a,u*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,u=o+o,f=a+a,d=r*c,h=r*u,p=r*f,_=o*u,g=o*f,m=a*f,y=l*c,b=l*u,v=l*f,T=i.x,E=i.y,S=i.z;return s[0]=(1-(_+m))*T,s[1]=(h+v)*T,s[2]=(p-b)*T,s[3]=0,s[4]=(h-v)*E,s[5]=(1-(d+m))*E,s[6]=(g+y)*E,s[7]=0,s[8]=(p+b)*S,s[9]=(g-y)*S,s[10]=(1-(d+_))*S,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=zo.set(s[0],s[1],s[2]).length();const o=zo.set(s[4],s[5],s[6]).length(),a=zo.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Ci.copy(this);const c=1/r,u=1/o,f=1/a;return Ci.elements[0]*=c,Ci.elements[1]*=c,Ci.elements[2]*=c,Ci.elements[4]*=u,Ci.elements[5]*=u,Ci.elements[6]*=u,Ci.elements[8]*=f,Ci.elements[9]*=f,Ci.elements[10]*=f,t.setFromRotationMatrix(Ci),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o,a=Li){const l=this.elements,c=2*r/(t-e),u=2*r/(i-s),f=(t+e)/(t-e),d=(i+s)/(i-s);let h,p;if(a===Li)h=-(o+r)/(o-r),p=-2*o*r/(o-r);else if(a===lc)h=-o/(o-r),p=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=h,l[14]=p,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=Li){const l=this.elements,c=1/(t-e),u=1/(i-s),f=1/(o-r),d=(t+e)*c,h=(i+s)*u;let p,_;if(a===Li)p=(o+r)*f,_=-2*f;else if(a===lc)p=r*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-h,l[2]=0,l[6]=0,l[10]=_,l[14]=-p,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const zo=new B,Ci=new Ye,uP=new B(0,0,0),fP=new B(1,1,1),js=new B,hu=new B,ni=new B,ay=new Ye,ly=new Jn;class li{constructor(e=0,t=0,i=0,s=li.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],u=s[9],f=s[2],d=s[6],h=s[10];switch(t){case"XYZ":this._y=Math.asin(tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,h),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-tt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,r),this._z=0);break;case"ZXY":this._x=Math.asin(tt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-tt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(tt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,r)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return ay.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ay,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ly.setFromEuler(this),this.setFromQuaternion(ly,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}li.DEFAULT_ORDER="XYZ";class hh{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),d.length>0&&(i.skeletons=d),h.length>0&&(i.animations=h),p.length>0&&(i.nodes=p)}return i.object=s,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){Ri.subVectors(s,t),hs.subVectors(i,t),Ap.subVectors(e,t);const o=Ri.dot(Ri),a=Ri.dot(hs),l=Ri.dot(Ap),c=hs.dot(hs),u=hs.dot(Ap),f=o*c-a*a;if(f===0)return r.set(0,0,0),null;const d=1/f,h=(c*l-a*u)*d,p=(o*u-a*l)*d;return r.set(1-h-p,p,h)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,ps)===null?!1:ps.x>=0&&ps.y>=0&&ps.x+ps.y<=1}static getInterpolation(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,ps)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,ps.x),l.addScaledVector(o,ps.y),l.addScaledVector(a,ps.z),l)}static getInterpolatedAttribute(e,t,i,s,r,o){return Ip.setScalar(0),Lp.setScalar(0),Dp.setScalar(0),Ip.fromBufferAttribute(e,t),Lp.fromBufferAttribute(e,i),Dp.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(Ip,r.x),o.addScaledVector(Lp,r.y),o.addScaledVector(Dp,r.z),o}static isFrontFacing(e,t,i,s){return Ri.subVectors(i,t),hs.subVectors(e,t),Ri.cross(hs).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ri.subVectors(this.c,this.b),hs.subVectors(this.a,this.b),Ri.cross(hs).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return jn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return jn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,s,r){return jn.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return jn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return jn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Go.subVectors(s,i),Wo.subVectors(r,i),Cp.subVectors(e,i);const l=Go.dot(Cp),c=Wo.dot(Cp);if(l<=0&&c<=0)return t.copy(i);Rp.subVectors(e,s);const u=Go.dot(Rp),f=Wo.dot(Rp);if(u>=0&&f<=u)return t.copy(s);const d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Go,o);Pp.subVectors(e,r);const h=Go.dot(Pp),p=Wo.dot(Pp);if(p>=0&&h<=p)return t.copy(r);const _=h*c-l*p;if(_<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(i).addScaledVector(Wo,a);const g=u*p-h*f;if(g<=0&&f-u>=0&&h-p>=0)return py.subVectors(r,s),a=(f-u)/(f-u+(h-p)),t.copy(s).addScaledVector(py,a);const m=1/(g+_+d);return o=_*m,a=d*m,t.copy(i).addScaledVector(Go,o).addScaledVector(Wo,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const eE={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ks={h:0,s:0,l:0},mu={h:0,s:0,l:0};function Op(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Ce{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Nn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ft.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=ft.workingColorSpace){return this.r=e,this.g=t,this.b=i,ft.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=ft.workingColorSpace){if(e=j0(e,1),t=tt(t,0,1),i=tt(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=Op(o,r,e+1/3),this.g=Op(o,r,e),this.b=Op(o,r,e-1/3)}return ft.toWorkingColorSpace(this,s),this}setStyle(e,t=Nn){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Nn){const i=eE[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Is(e.r),this.g=Is(e.g),this.b=Is(e.b),this}copyLinearToSRGB(e){return this.r=ha(e.r),this.g=ha(e.g),this.b=ha(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Nn){return ft.fromWorkingColorSpace(bn.copy(this),e),Math.round(tt(bn.r*255,0,255))*65536+Math.round(tt(bn.g*255,0,255))*256+Math.round(tt(bn.b*255,0,255))}getHexString(e=Nn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ft.workingColorSpace){ft.fromWorkingColorSpace(bn.copy(this),t);const i=bn.r,s=bn.g,r=bn.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case i:l=(s-r)/f+(s0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==po&&(i.blending=this.blending),this.side!==Os&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Vf&&(i.blendSrc=this.blendSrc),this.blendDst!==Hf&&(i.blendDst=this.blendDst),this.blendEquation!==lr&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==xo&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==dg&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==eo&&(i.stencilFail=this.stencilFail),this.stencilZFail!==eo&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==eo&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class zs extends An{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ce(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new li,this.combine=Oc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Es=_P();function _P(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),s=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,s[l]=24,s[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,s[l]=-c-1,s[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,s[l]=13,s[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,s[l]=24,s[l|256]=24):(i[l]=31744,i[l|256]=64512,s[l]=13,s[l|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,r[l]=c|u}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:s,mantissaTable:r,exponentTable:o,offsetTable:a}}function $n(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=tt(n,-65504,65504),Es.floatView[0]=n;const e=Es.uint32View[0],t=e>>23&511;return Es.baseTable[t]+((e&8388607)>>Es.shiftTable[t])}function hl(n){const e=n>>10;return Es.uint32View[0]=Es.mantissaTable[Es.offsetTable[e]+(n&1023)]+Es.exponentTable[e],Es.floatView[0]}class vP{static toHalfFloat(e){return $n(e)}static fromHalfFloat(e){return hl(e)}}const Yt=new B,gu=new de;let yP=0;class Ct{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:yP++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=ac,this.updateRanges=[],this.gpuType=Kn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;st.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Vn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new B(-1/0,-1/0,-1/0),new B(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,s=t.length;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,d=c.length;f0&&(s[l]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const s=e.attributes;for(const c in s){const u=s[c];this.setAttribute(c,u.clone(t))}const r=e.morphAttributes;for(const c in r){const u=[],f=r[c];for(let d=0,h=f.length;d0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(my.copy(r).invert(),zr.copy(e.ray).applyMatrix4(my),!(i.boundingBox!==null&&zr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,zr)))}_computeIntersections(e,t,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,u=r.attributes.uv1,f=r.attributes.normal,d=r.groups,h=r.drawRange;if(a!==null)if(Array.isArray(o))for(let p=0,_=d.length;p<_;p++){const g=d[p],m=o[g.materialIndex],y=Math.max(g.start,h.start),b=Math.min(a.count,Math.min(g.start+g.count,h.start+h.count));for(let v=y,T=b;vt.far?null:{distance:c,point:Mu.clone(),object:n}}function Su(n,e,t,i,s,r,o,a,l,c){n.getVertexPosition(a,vu),n.getVertexPosition(l,yu),n.getVertexPosition(c,bu);const u=AP(n,e,t,i,vu,yu,bu,_y);if(u){const f=new B;jn.getBarycoord(_y,vu,yu,bu,f),s&&(u.uv=jn.getInterpolatedAttribute(s,a,l,c,f,new de)),r&&(u.uv1=jn.getInterpolatedAttribute(r,a,l,c,f,new de)),o&&(u.normal=jn.getInterpolatedAttribute(o,a,l,c,f,new B),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:l,c,normal:new B,materialIndex:0};jn.getNormal(vu,yu,bu,d.normal),u.face=d,u.barycoord=f}return u}class Ao extends ct{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],u=[],f=[];let d=0,h=0;p("z","y","x",-1,-1,i,t,e,o,r,0),p("z","y","x",1,-1,i,t,-e,o,r,1),p("x","z","y",1,1,e,i,t,s,o,2),p("x","z","y",1,-1,e,i,-t,s,o,3),p("x","y","z",1,-1,e,t,i,s,r,4),p("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new ke(c,3)),this.setAttribute("normal",new ke(u,3)),this.setAttribute("uv",new ke(f,2));function p(_,g,m,y,b,v,T,E,S,P,x){const M=v/S,L=T/P,F=v/2,H=T/2,Y=E/2,ee=S+1,K=P+1;let Q=0,Z=0;const he=new B;for(let be=0;be0?1:-1,u.push(he.x,he.y,he.z),f.push(ye/S),f.push(1-be/P),Q+=1}}for(let be=0;be>8&255]+yn[n>>16&255]+yn[n>>24&255]+"-"+yn[e&255]+yn[e>>8&255]+"-"+yn[e>>16&15|64]+yn[e>>24&255]+"-"+yn[t&63|128]+yn[t>>8&255]+"-"+yn[t>>16&255]+yn[t>>24&255]+yn[i&255]+yn[i>>8&255]+yn[i>>16&255]+yn[i>>24&255]).toLowerCase()}function tt(n,e,t){return Math.max(e,Math.min(t,n))}function j0(n,e){return(n%e+e)%e}function B3(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function z3(n,e,t){return n!==e?(t-n)/(e-n):0}function Cl(n,e,t){return(1-t)*n+t*e}function V3(n,e,t,i){return Cl(n,e,1-Math.exp(-t*i))}function H3(n,e=1){return e-Math.abs(j0(n,e*2)-e)}function G3(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function W3(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function X3(n,e){return n+Math.floor(Math.random()*(e-n+1))}function $3(n,e){return n+Math.random()*(e-n)}function q3(n){return n*(.5-Math.random())}function Y3(n){n!==void 0&&(ny=n);let e=ny+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function j3(n){return n*mo}function K3(n){return n*Ea}function Z3(n){return(n&n-1)===0&&n!==0}function J3(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Q3(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function eP(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+i)/2),u=o((e+i)/2),f=r((e-i)/2),d=o((e-i)/2),h=r((i-e)/2),p=o((i-e)/2);switch(s){case"XYX":n.set(a*u,l*f,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*f,a*c);break;case"ZXZ":n.set(l*f,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*p,l*h,a*c);break;case"YXY":n.set(l*h,a*u,l*p,a*c);break;case"ZYZ":n.set(l*p,l*h,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function kn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function rt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const K0={DEG2RAD:mo,RAD2DEG:Ea,generateUUID:ri,clamp:tt,euclideanModulo:j0,mapLinear:B3,inverseLerp:z3,lerp:Cl,damp:V3,pingpong:H3,smoothstep:G3,smootherstep:W3,randInt:X3,randFloat:$3,randFloatSpread:q3,seededRandom:Y3,degToRad:j3,radToDeg:K3,isPowerOfTwo:Z3,ceilPowerOfTwo:J3,floorPowerOfTwo:Q3,setQuaternionFromProperEuler:eP,normalize:rt,denormalize:kn};class de{constructor(e=0,t=0){de.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class st{constructor(e,t,i,s,r,o,a,l,c){st.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,c)}set(e,t,i,s,r,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],f=i[7],d=i[2],h=i[5],p=i[8],_=s[0],g=s[3],m=s[6],y=s[1],b=s[4],v=s[7],T=s[2],E=s[5],S=s[8];return r[0]=o*_+a*y+l*T,r[3]=o*g+a*b+l*E,r[6]=o*m+a*v+l*S,r[1]=c*_+u*y+f*T,r[4]=c*g+u*b+f*E,r[7]=c*m+u*v+f*S,r[2]=d*_+h*y+p*T,r[5]=d*g+h*b+p*E,r[8]=d*m+h*v+p*S,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*r*u+i*a*l+s*r*c-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,d=a*l-u*r,h=c*r-o*l,p=t*f+i*d+s*h;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/p;return e[0]=f*_,e[1]=(s*c-u*i)*_,e[2]=(a*i-s*o)*_,e[3]=d*_,e[4]=(u*t-s*l)*_,e[5]=(s*r-a*t)*_,e[6]=h*_,e[7]=(i*l-c*t)*_,e[8]=(o*t-i*r)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(vp.makeScale(e,t)),this}rotate(e){return this.premultiply(vp.makeRotation(-e)),this}translate(e,t){return this.premultiply(vp.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const vp=new st;function J1(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const tP={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function oa(n,e){return new tP[n](e)}function cc(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Q1(){const n=cc("canvas");return n.style.display="block",n}const iy={};function xf(n){n in iy||(iy[n]=!0,console.warn(n))}function nP(n,e,t){return new Promise(function(i,s){function r(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:s();break;case n.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:i()}}setTimeout(r,t)})}function iP(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function sP(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const sy=new st().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ry=new st().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function rP(){const n={enabled:!0,workingColorSpace:Mo,spaces:{},convert:function(s,r,o){return this.enabled===!1||r===o||!r||!o||(this.spaces[r].transfer===wt&&(s.r=Is(s.r),s.g=Is(s.g),s.b=Is(s.b)),this.spaces[r].primaries!==this.spaces[o].primaries&&(s.applyMatrix3(this.spaces[r].toXYZ),s.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===wt&&(s.r=ha(s.r),s.g=ha(s.g),s.b=ha(s.b))),s},fromWorkingColorSpace:function(s,r){return this.convert(s,this.workingColorSpace,r)},toWorkingColorSpace:function(s,r){return this.convert(s,r,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Ss?oc:this.spaces[s].transfer},getLuminanceCoefficients:function(s,r=this.workingColorSpace){return s.fromArray(this.spaces[r].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,r,o){return s.copy(this.spaces[r].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[Mo]:{primaries:e,whitePoint:i,transfer:oc,toXYZ:sy,fromXYZ:ry,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Nn},outputColorSpaceConfig:{drawingBufferColorSpace:Nn}},[Nn]:{primaries:e,whitePoint:i,transfer:wt,toXYZ:sy,fromXYZ:ry,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Nn}}}),n}const ft=rP();function Is(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ha(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Uo;class eE{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Uo===void 0&&(Uo=cc("canvas")),Uo.width=e.width,Uo.height=e.height;const s=Uo.getContext("2d");e instanceof ImageData?s.putImageData(e,0,0):s.drawImage(e,0,0,e.width,e.height),i=Uo}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=cc("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ih)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case nc:e.x=e.x-Math.floor(e.x);break;case gi:e.x=e.x<0?0:1;break;case ic:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case nc:e.y=e.y-Math.floor(e.y);break;case gi:e.y=e.y<0?0:1;break;case ic:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Wt.DEFAULT_IMAGE=null;Wt.DEFAULT_MAPPING=ih;Wt.DEFAULT_ANISOTROPY=1;class gt{constructor(e=0,t=0,i=0,s=1){gt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const l=e.elements,c=l[0],u=l[4],f=l[8],d=l[1],h=l[5],p=l[9],_=l[2],g=l[6],m=l[10];if(Math.abs(u-d)<.01&&Math.abs(f-_)<.01&&Math.abs(p-g)<.01){if(Math.abs(u+d)<.1&&Math.abs(f+_)<.1&&Math.abs(p+g)<.1&&Math.abs(c+h+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const b=(c+1)/2,v=(h+1)/2,T=(m+1)/2,E=(u+d)/4,S=(f+_)/4,P=(p+g)/4;return b>v&&b>T?b<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(b),s=E/i,r=S/i):v>T?v<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(v),i=E/s,r=P/s):T<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(T),i=S/r,s=P/r),this.set(i,s,r,t),this}let y=Math.sqrt((g-p)*(g-p)+(f-_)*(f-_)+(d-u)*(d-u));return Math.abs(y)<.001&&(y=1),this.x=(g-p)/y,this.y=(f-_)/y,this.z=(d-u)/y,this.w=Math.acos((c+h+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this.z=tt(this.z,e.z,t.z),this.w=tt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this.z=tt(this.z,e,t),this.w=tt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class fh extends rs{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new gt(0,0,e,t),this.scissorTest=!1,this.viewport=new gt(0,0,e,t);const s={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:en,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const r=new Wt(s,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);r.flipY=!1,r.generateMipmaps=i.generateMipmaps,r.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a=0?1:-1,b=1-m*m;if(b>Number.EPSILON){const T=Math.sqrt(b),E=Math.atan2(T,m*y);g=Math.sin(g*E)/T,a=Math.sin(a*E)/T}const v=a*y;if(l=l*g+d*v,c=c*g+h*v,u=u*g+p*v,f=f*g+_*v,g===1-a){const T=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=T,c*=T,u*=T,f*=T}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],u=i[s+3],f=r[o],d=r[o+1],h=r[o+2],p=r[o+3];return e[t]=a*p+u*f+l*h-c*d,e[t+1]=l*p+u*d+c*f-a*h,e[t+2]=c*p+u*h+a*d-l*f,e[t+3]=u*p-a*f-l*d-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(s/2),f=a(r/2),d=l(i/2),h=l(s/2),p=l(r/2);switch(o){case"XYZ":this._x=d*u*f+c*h*p,this._y=c*h*f-d*u*p,this._z=c*u*p+d*h*f,this._w=c*u*f-d*h*p;break;case"YXZ":this._x=d*u*f+c*h*p,this._y=c*h*f-d*u*p,this._z=c*u*p-d*h*f,this._w=c*u*f+d*h*p;break;case"ZXY":this._x=d*u*f-c*h*p,this._y=c*h*f+d*u*p,this._z=c*u*p+d*h*f,this._w=c*u*f-d*h*p;break;case"ZYX":this._x=d*u*f-c*h*p,this._y=c*h*f+d*u*p,this._z=c*u*p-d*h*f,this._w=c*u*f+d*h*p;break;case"YZX":this._x=d*u*f+c*h*p,this._y=c*h*f+d*u*p,this._z=c*u*p-d*h*f,this._w=c*u*f-d*h*p;break;case"XZY":this._x=d*u*f-c*h*p,this._y=c*h*f-d*u*p,this._z=c*u*p+d*h*f,this._w=c*u*f+d*h*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],d=i+a+f;if(d>0){const h=.5/Math.sqrt(d+1);this._w=.25/h,this._x=(u-l)*h,this._y=(r-c)*h,this._z=(o-s)*h}else if(i>a&&i>f){const h=2*Math.sqrt(1+i-a-f);this._w=(u-l)/h,this._x=.25*h,this._y=(s+o)/h,this._z=(r+c)/h}else if(a>f){const h=2*Math.sqrt(1+a-i-f);this._w=(r-c)/h,this._x=(s+o)/h,this._y=.25*h,this._z=(l+u)/h}else{const h=2*Math.sqrt(1+f-i-a);this._w=(o-s)/h,this._x=(r+c)/h,this._y=(l+u)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(tt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+s*c-r*l,this._y=s*u+o*l+r*a-i*c,this._z=r*u+o*c+i*l-s*a,this._w=o*u-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-t;return this._w=h*o+t*this._w,this._x=h*i+t*this._x,this._y=h*s+t*this._y,this._z=h*r+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*f+this._w*d,this._x=i*f+this._x*d,this._y=s*f+this._y*d,this._z=r*f+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class B{constructor(e=0,t=0,i=0){B.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(oy.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(oy.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*s-a*i),u=2*(a*t-r*s),f=2*(r*i-o*t);return this.x=t+l*c+o*f-a*u,this.y=i+l*u+a*c-r*f,this.z=s+l*f+r*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=tt(this.x,e.x,t.x),this.y=tt(this.y,e.y,t.y),this.z=tt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=tt(this.x,e,t),this.y=tt(this.y,e,t),this.z=tt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(tt(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return bp.copy(this).projectOnVector(e),this.sub(bp)}reflect(e){return this.sub(bp.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(tt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const bp=new B,oy=new Jn;class Vn{constructor(e=new B(1/0,1/0,1/0),t=new B(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,wi),wi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ya),cu.subVectors(this.max,Ya),Fo.subVectors(e.a,Ya),ko.subVectors(e.b,Ya),Bo.subVectors(e.c,Ya),$s.subVectors(ko,Fo),qs.subVectors(Bo,ko),kr.subVectors(Fo,Bo);let t=[0,-$s.z,$s.y,0,-qs.z,qs.y,0,-kr.z,kr.y,$s.z,0,-$s.x,qs.z,0,-qs.x,kr.z,0,-kr.x,-$s.y,$s.x,0,-qs.y,qs.x,0,-kr.y,kr.x,0];return!xp(t,Fo,ko,Bo,cu)||(t=[1,0,0,0,1,0,0,0,1],!xp(t,Fo,ko,Bo,cu))?!1:(uu.crossVectors($s,qs),t=[uu.x,uu.y,uu.z],xp(t,Fo,ko,Bo,cu))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,wi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(wi).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(us[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),us[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),us[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),us[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),us[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),us[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),us[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),us[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(us),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const us=[new B,new B,new B,new B,new B,new B,new B,new B],wi=new B,lu=new Vn,Fo=new B,ko=new B,Bo=new B,$s=new B,qs=new B,kr=new B,Ya=new B,cu=new B,uu=new B,Br=new B;function xp(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){Br.fromArray(n,r);const a=s.x*Math.abs(Br.x)+s.y*Math.abs(Br.y)+s.z*Math.abs(Br.z),l=e.dot(Br),c=t.dot(Br),u=i.dot(Br);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const uP=new Vn,ja=new B,Mp=new B;class Tn{constructor(e=new B,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):uP.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ja.subVectors(e,this.center);const t=ja.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.addScaledVector(ja,s/i),this.radius+=s}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Mp.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ja.copy(e.center).add(Mp)),this.expandByPoint(ja.copy(e.center).sub(Mp))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const fs=new B,Sp=new B,fu=new B,Ys=new B,Ep=new B,du=new B,Tp=new B;class Fa{constructor(e=new B,t=new B(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,fs)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=fs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(fs.copy(this.origin).addScaledVector(this.direction,t),fs.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Sp.copy(e).add(t).multiplyScalar(.5),fu.copy(t).sub(e).normalize(),Ys.copy(this.origin).sub(Sp);const r=e.distanceTo(t)*.5,o=-this.direction.dot(fu),a=Ys.dot(this.direction),l=-Ys.dot(fu),c=Ys.lengthSq(),u=Math.abs(1-o*o);let f,d,h,p;if(u>0)if(f=o*l-a,d=o*a-l,p=r*u,f>=0)if(d>=-p)if(d<=p){const _=1/u;f*=_,d*=_,h=f*(f+o*d+2*a)+d*(o*f+d+2*l)+c}else d=r,f=Math.max(0,-(o*d+a)),h=-f*f+d*(d+2*l)+c;else d=-r,f=Math.max(0,-(o*d+a)),h=-f*f+d*(d+2*l)+c;else d<=-p?(f=Math.max(0,-(-o*r+a)),d=f>0?-r:Math.min(Math.max(-r,-l),r),h=-f*f+d*(d+2*l)+c):d<=p?(f=0,d=Math.min(Math.max(-r,-l),r),h=d*(d+2*l)+c):(f=Math.max(0,-(o*r+a)),d=f>0?r:Math.min(Math.max(-r,-l),r),h=-f*f+d*(d+2*l)+c);else d=o>0?-r:r,f=Math.max(0,-(o*d+a)),h=-f*f+d*(d+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),s&&s.copy(Sp).addScaledVector(fu,d),h}intersectSphere(e,t){fs.subVectors(e.center,this.origin);const i=fs.dot(this.direction),s=fs.dot(fs)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,s=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,s=(e.min.x-d.x)*c),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||isNaN(i))&&(i=r),(o=0?(a=(e.min.z-d.z)*f,l=(e.max.z-d.z)*f):(a=(e.max.z-d.z)*f,l=(e.min.z-d.z)*f),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,fs)!==null}intersectTriangle(e,t,i,s,r){Ep.subVectors(t,e),du.subVectors(i,e),Tp.crossVectors(Ep,du);let o=this.direction.dot(Tp),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ys.subVectors(this.origin,e);const l=a*this.direction.dot(du.crossVectors(Ys,du));if(l<0)return null;const c=a*this.direction.dot(Ep.cross(Ys));if(c<0||l+c>o)return null;const u=-a*Ys.dot(Tp);return u<0?null:this.at(u/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ye{constructor(e,t,i,s,r,o,a,l,c,u,f,d,h,p,_,g){Ye.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,o,a,l,c,u,f,d,h,p,_,g)}set(e,t,i,s,r,o,a,l,c,u,f,d,h,p,_,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=s,m[1]=r,m[5]=o,m[9]=a,m[13]=l,m[2]=c,m[6]=u,m[10]=f,m[14]=d,m[3]=h,m[7]=p,m[11]=_,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ye().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/zo.setFromMatrixColumn(e,0).length(),r=1/zo.setFromMatrixColumn(e,1).length(),o=1/zo.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),f=Math.sin(r);if(e.order==="XYZ"){const d=o*u,h=o*f,p=a*u,_=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=h+p*c,t[5]=d-_*c,t[9]=-a*l,t[2]=_-d*c,t[6]=p+h*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,h=l*f,p=c*u,_=c*f;t[0]=d+_*a,t[4]=p*a-h,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=h*a-p,t[6]=_+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,h=l*f,p=c*u,_=c*f;t[0]=d-_*a,t[4]=-o*f,t[8]=p+h*a,t[1]=h+p*a,t[5]=o*u,t[9]=_-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,h=o*f,p=a*u,_=a*f;t[0]=l*u,t[4]=p*c-h,t[8]=d*c+_,t[1]=l*f,t[5]=_*c+d,t[9]=h*c-p,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,h=o*c,p=a*l,_=a*c;t[0]=l*u,t[4]=_-d*f,t[8]=p*f+h,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=h*f+p,t[10]=d-_*f}else if(e.order==="XZY"){const d=o*l,h=o*c,p=a*l,_=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=d*f+_,t[5]=o*u,t[9]=h*f-p,t[2]=p*f-h,t[6]=a*u,t[10]=_*f+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(fP,e,dP)}lookAt(e,t,i){const s=this.elements;return ni.subVectors(e,t),ni.lengthSq()===0&&(ni.z=1),ni.normalize(),js.crossVectors(i,ni),js.lengthSq()===0&&(Math.abs(i.z)===1?ni.x+=1e-4:ni.z+=1e-4,ni.normalize(),js.crossVectors(i,ni)),js.normalize(),hu.crossVectors(ni,js),s[0]=js.x,s[4]=hu.x,s[8]=ni.x,s[1]=js.y,s[5]=hu.y,s[9]=ni.y,s[2]=js.z,s[6]=hu.z,s[10]=ni.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],f=i[5],d=i[9],h=i[13],p=i[2],_=i[6],g=i[10],m=i[14],y=i[3],b=i[7],v=i[11],T=i[15],E=s[0],S=s[4],P=s[8],x=s[12],M=s[1],L=s[5],F=s[9],H=s[13],Y=s[2],ee=s[6],K=s[10],Q=s[14],Z=s[3],he=s[7],be=s[11],se=s[15];return r[0]=o*E+a*M+l*Y+c*Z,r[4]=o*S+a*L+l*ee+c*he,r[8]=o*P+a*F+l*K+c*be,r[12]=o*x+a*H+l*Q+c*se,r[1]=u*E+f*M+d*Y+h*Z,r[5]=u*S+f*L+d*ee+h*he,r[9]=u*P+f*F+d*K+h*be,r[13]=u*x+f*H+d*Q+h*se,r[2]=p*E+_*M+g*Y+m*Z,r[6]=p*S+_*L+g*ee+m*he,r[10]=p*P+_*F+g*K+m*be,r[14]=p*x+_*H+g*Q+m*se,r[3]=y*E+b*M+v*Y+T*Z,r[7]=y*S+b*L+v*ee+T*he,r[11]=y*P+b*F+v*K+T*be,r[15]=y*x+b*H+v*Q+T*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],d=e[10],h=e[14],p=e[3],_=e[7],g=e[11],m=e[15];return p*(+r*l*f-s*c*f-r*a*d+i*c*d+s*a*h-i*l*h)+_*(+t*l*h-t*c*d+r*o*d-s*o*h+s*c*u-r*l*u)+g*(+t*c*f-t*a*h-r*o*f+i*o*h+r*a*u-i*c*u)+m*(-s*a*u-t*l*f+t*a*d+s*o*f-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],d=e[10],h=e[11],p=e[12],_=e[13],g=e[14],m=e[15],y=f*g*c-_*d*c+_*l*h-a*g*h-f*l*m+a*d*m,b=p*d*c-u*g*c-p*l*h+o*g*h+u*l*m-o*d*m,v=u*_*c-p*f*c+p*a*h-o*_*h-u*a*m+o*f*m,T=p*f*l-u*_*l-p*a*d+o*_*d+u*a*g-o*f*g,E=t*y+i*b+s*v+r*T;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/E;return e[0]=y*S,e[1]=(_*d*r-f*g*r-_*s*h+i*g*h+f*s*m-i*d*m)*S,e[2]=(a*g*r-_*l*r+_*s*c-i*g*c-a*s*m+i*l*m)*S,e[3]=(f*l*r-a*d*r-f*s*c+i*d*c+a*s*h-i*l*h)*S,e[4]=b*S,e[5]=(u*g*r-p*d*r+p*s*h-t*g*h-u*s*m+t*d*m)*S,e[6]=(p*l*r-o*g*r-p*s*c+t*g*c+o*s*m-t*l*m)*S,e[7]=(o*d*r-u*l*r+u*s*c-t*d*c-o*s*h+t*l*h)*S,e[8]=v*S,e[9]=(p*f*r-u*_*r-p*i*h+t*_*h+u*i*m-t*f*m)*S,e[10]=(o*_*r-p*a*r+p*i*c-t*_*c-o*i*m+t*a*m)*S,e[11]=(u*a*r-o*f*r-u*i*c+t*f*c+o*i*h-t*a*h)*S,e[12]=T*S,e[13]=(u*_*s-p*f*s+p*i*d-t*_*d-u*i*g+t*f*g)*S,e[14]=(p*a*s-o*_*s-p*i*l+t*_*l+o*i*g-t*a*g)*S,e[15]=(o*f*s-u*a*s+u*i*l-t*f*l-o*i*d+t*a*d)*S,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,c=r*o,u=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,u*a+i,u*l-s*o,0,c*l-s*a,u*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,u=o+o,f=a+a,d=r*c,h=r*u,p=r*f,_=o*u,g=o*f,m=a*f,y=l*c,b=l*u,v=l*f,T=i.x,E=i.y,S=i.z;return s[0]=(1-(_+m))*T,s[1]=(h+v)*T,s[2]=(p-b)*T,s[3]=0,s[4]=(h-v)*E,s[5]=(1-(d+m))*E,s[6]=(g+y)*E,s[7]=0,s[8]=(p+b)*S,s[9]=(g-y)*S,s[10]=(1-(d+_))*S,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=zo.set(s[0],s[1],s[2]).length();const o=zo.set(s[4],s[5],s[6]).length(),a=zo.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],Ai.copy(this);const c=1/r,u=1/o,f=1/a;return Ai.elements[0]*=c,Ai.elements[1]*=c,Ai.elements[2]*=c,Ai.elements[4]*=u,Ai.elements[5]*=u,Ai.elements[6]*=u,Ai.elements[8]*=f,Ai.elements[9]*=f,Ai.elements[10]*=f,t.setFromRotationMatrix(Ai),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o,a=Ii){const l=this.elements,c=2*r/(t-e),u=2*r/(i-s),f=(t+e)/(t-e),d=(i+s)/(i-s);let h,p;if(a===Ii)h=-(o+r)/(o-r),p=-2*o*r/(o-r);else if(a===lc)h=-o/(o-r),p=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=h,l[14]=p,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,o,a=Ii){const l=this.elements,c=1/(t-e),u=1/(i-s),f=1/(o-r),d=(t+e)*c,h=(i+s)*u;let p,_;if(a===Ii)p=(o+r)*f,_=-2*f;else if(a===lc)p=r*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-h,l[2]=0,l[6]=0,l[10]=_,l[14]=-p,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const zo=new B,Ai=new Ye,fP=new B(0,0,0),dP=new B(1,1,1),js=new B,hu=new B,ni=new B,ay=new Ye,ly=new Jn;class li{constructor(e=0,t=0,i=0,s=li.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],u=s[9],f=s[2],d=s[6],h=s[10];switch(t){case"XYZ":this._y=Math.asin(tt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,h),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-tt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,r),this._z=0);break;case"ZXY":this._x=Math.asin(tt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-f,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-tt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(d,h),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(tt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,r)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-tt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return ay.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ay,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ly.setFromEuler(this),this.setFromQuaternion(ly,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}li.DEFAULT_ORDER="XYZ";class hh{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),d.length>0&&(i.skeletons=d),h.length>0&&(i.animations=h),p.length>0&&(i.nodes=p)}return i.object=s,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){Ci.subVectors(s,t),hs.subVectors(i,t),Ap.subVectors(e,t);const o=Ci.dot(Ci),a=Ci.dot(hs),l=Ci.dot(Ap),c=hs.dot(hs),u=hs.dot(Ap),f=o*c-a*a;if(f===0)return r.set(0,0,0),null;const d=1/f,h=(c*l-a*u)*d,p=(o*u-a*l)*d;return r.set(1-h-p,p,h)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,ps)===null?!1:ps.x>=0&&ps.y>=0&&ps.x+ps.y<=1}static getInterpolation(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,ps)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(r,ps.x),l.addScaledVector(o,ps.y),l.addScaledVector(a,ps.z),l)}static getInterpolatedAttribute(e,t,i,s,r,o){return Ip.setScalar(0),Lp.setScalar(0),Dp.setScalar(0),Ip.fromBufferAttribute(e,t),Lp.fromBufferAttribute(e,i),Dp.fromBufferAttribute(e,s),o.setScalar(0),o.addScaledVector(Ip,r.x),o.addScaledVector(Lp,r.y),o.addScaledVector(Dp,r.z),o}static isFrontFacing(e,t,i,s){return Ci.subVectors(i,t),hs.subVectors(e,t),Ci.cross(hs).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ci.subVectors(this.c,this.b),hs.subVectors(this.a,this.b),Ci.cross(hs).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return jn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return jn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,s,r){return jn.getInterpolation(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return jn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return jn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Go.subVectors(s,i),Wo.subVectors(r,i),Cp.subVectors(e,i);const l=Go.dot(Cp),c=Wo.dot(Cp);if(l<=0&&c<=0)return t.copy(i);Rp.subVectors(e,s);const u=Go.dot(Rp),f=Wo.dot(Rp);if(u>=0&&f<=u)return t.copy(s);const d=l*f-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Go,o);Pp.subVectors(e,r);const h=Go.dot(Pp),p=Wo.dot(Pp);if(p>=0&&h<=p)return t.copy(r);const _=h*c-l*p;if(_<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(i).addScaledVector(Wo,a);const g=u*p-h*f;if(g<=0&&f-u>=0&&h-p>=0)return py.subVectors(r,s),a=(f-u)/(f-u+(h-p)),t.copy(s).addScaledVector(py,a);const m=1/(g+_+d);return o=_*m,a=d*m,t.copy(i).addScaledVector(Go,o).addScaledVector(Wo,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const tE={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ks={h:0,s:0,l:0},mu={h:0,s:0,l:0};function Op(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Ce{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Nn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ft.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=ft.workingColorSpace){return this.r=e,this.g=t,this.b=i,ft.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=ft.workingColorSpace){if(e=j0(e,1),t=tt(t,0,1),i=tt(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=Op(o,r,e+1/3),this.g=Op(o,r,e),this.b=Op(o,r,e-1/3)}return ft.toWorkingColorSpace(this,s),this}setStyle(e,t=Nn){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Nn){const i=tE[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Is(e.r),this.g=Is(e.g),this.b=Is(e.b),this}copyLinearToSRGB(e){return this.r=ha(e.r),this.g=ha(e.g),this.b=ha(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Nn){return ft.fromWorkingColorSpace(bn.copy(this),e),Math.round(tt(bn.r*255,0,255))*65536+Math.round(tt(bn.g*255,0,255))*256+Math.round(tt(bn.b*255,0,255))}getHexString(e=Nn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ft.workingColorSpace){ft.fromWorkingColorSpace(bn.copy(this),t);const i=bn.r,s=bn.g,r=bn.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case i:l=(s-r)/f+(s0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const s=this[t];if(s===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==po&&(i.blending=this.blending),this.side!==Os&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Vf&&(i.blendSrc=this.blendSrc),this.blendDst!==Hf&&(i.blendDst=this.blendDst),this.blendEquation!==lr&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==xo&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==dg&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==eo&&(i.stencilFail=this.stencilFail),this.stencilZFail!==eo&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==eo&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class zs extends An{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ce(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new li,this.combine=Oc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Es=vP();function vP(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),s=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,s[l]=24,s[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,s[l]=-c-1,s[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,s[l]=13,s[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,s[l]=24,s[l|256]=24):(i[l]=31744,i[l|256]=64512,s[l]=13,s[l|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,r[l]=c|u}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:s,mantissaTable:r,exponentTable:o,offsetTable:a}}function $n(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=tt(n,-65504,65504),Es.floatView[0]=n;const e=Es.uint32View[0],t=e>>23&511;return Es.baseTable[t]+((e&8388607)>>Es.shiftTable[t])}function hl(n){const e=n>>10;return Es.uint32View[0]=Es.mantissaTable[Es.offsetTable[e]+(n&1023)]+Es.exponentTable[e],Es.floatView[0]}class yP{static toHalfFloat(e){return $n(e)}static fromHalfFloat(e){return hl(e)}}const Yt=new B,gu=new de;let bP=0;class Ct{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:bP++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=ac,this.updateRanges=[],this.gpuType=Kn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;st.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Vn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new B(-1/0,-1/0,-1/0),new B(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,s=t.length;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,d=c.length;f0&&(s[l]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const s=e.attributes;for(const c in s){const u=s[c];this.setAttribute(c,u.clone(t))}const r=e.morphAttributes;for(const c in r){const u=[],f=r[c];for(let d=0,h=f.length;d0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r(e.far-e.near)**2))&&(my.copy(r).invert(),zr.copy(e.ray).applyMatrix4(my),!(i.boundingBox!==null&&zr.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,zr)))}_computeIntersections(e,t,i){let s;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,u=r.attributes.uv1,f=r.attributes.normal,d=r.groups,h=r.drawRange;if(a!==null)if(Array.isArray(o))for(let p=0,_=d.length;p<_;p++){const g=d[p],m=o[g.materialIndex],y=Math.max(g.start,h.start),b=Math.min(a.count,Math.min(g.start+g.count,h.start+h.count));for(let v=y,T=b;vt.far?null:{distance:c,point:Mu.clone(),object:n}}function Su(n,e,t,i,s,r,o,a,l,c){n.getVertexPosition(a,vu),n.getVertexPosition(l,yu),n.getVertexPosition(c,bu);const u=CP(n,e,t,i,vu,yu,bu,_y);if(u){const f=new B;jn.getBarycoord(_y,vu,yu,bu,f),s&&(u.uv=jn.getInterpolatedAttribute(s,a,l,c,f,new de)),r&&(u.uv1=jn.getInterpolatedAttribute(r,a,l,c,f,new de)),o&&(u.normal=jn.getInterpolatedAttribute(o,a,l,c,f,new B),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const d={a,b:l,c,normal:new B,materialIndex:0};jn.getNormal(vu,yu,bu,d.normal),u.face=d,u.barycoord=f}return u}class Ao extends ct{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],u=[],f=[];let d=0,h=0;p("z","y","x",-1,-1,i,t,e,o,r,0),p("z","y","x",1,-1,i,t,-e,o,r,1),p("x","z","y",1,1,e,i,t,s,o,2),p("x","z","y",1,-1,e,i,-t,s,o,3),p("x","y","z",1,-1,e,t,i,s,r,4),p("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(l),this.setAttribute("position",new ke(c,3)),this.setAttribute("normal",new ke(u,3)),this.setAttribute("uv",new ke(f,2));function p(_,g,m,y,b,v,T,E,S,P,x){const M=v/S,L=T/P,F=v/2,H=T/2,Y=E/2,ee=S+1,K=P+1;let Q=0,Z=0;const he=new B;for(let be=0;be0?1:-1,u.push(he.x,he.y,he.z),f.push(ye/S),f.push(1-be/P),Q+=1}}for(let be=0;be0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Fc extends ht{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye,this.coordinateSystem=Li}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Zs=new B,vy=new de,yy=new de;class Kt extends Fc{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ea*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(mo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ea*2*Math.atan(Math.tan(mo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Zs.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Zs.x,Zs.y).multiplyScalar(-e/Zs.z),Zs.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Zs.x,Zs.y).multiplyScalar(-e/Zs.z)}getViewSize(e,t){return this.getViewBounds(e,vy,yy),t.subVectors(yy,vy)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(mo*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const $o=-90,qo=1;class iE extends ht{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Kt($o,qo,e,t);s.layers=this.layers,this.add(s);const r=new Kt($o,qo,e,t);r.layers=this.layers,this.add(r);const o=new Kt($o,qo,e,t);o.layers=this.layers,this.add(o);const a=new Kt($o,qo,e,t);a.layers=this.layers,this.add(a);const l=new Kt($o,qo,e,t);l.layers=this.layers,this.add(l);const c=new Kt($o,qo,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,l]=t;for(const c of t)this.remove(c);if(e===Li)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===lc)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,o,a,l,c,u]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(t,r),e.setRenderTarget(i,1,s),e.render(t,o),e.setRenderTarget(i,2,s),e.render(t,a),e.setRenderTarget(i,3,s),e.render(t,l),e.setRenderTarget(i,4,s),e.render(t,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,s),e.render(t,u),e.setRenderTarget(f,d,h),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class kc extends Wt{constructor(e=[],t=Ns,i,s,r,o,a,l,c,u){super(e,t,i,s,r,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class sE extends ss{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new kc(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:en}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class ki extends An{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=PP,this.fragmentShader=IP,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ta(e.uniforms),this.uniformsGroups=RP(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class Fc extends ht{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ye,this.projectionMatrix=new Ye,this.projectionMatrixInverse=new Ye,this.coordinateSystem=Ii}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Zs=new B,vy=new de,yy=new de;class Kt extends Fc{constructor(e=50,t=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ea*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(mo*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ea*2*Math.atan(Math.tan(mo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){Zs.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Zs.x,Zs.y).multiplyScalar(-e/Zs.z),Zs.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(Zs.x,Zs.y).multiplyScalar(-e/Zs.z)}getViewSize(e,t){return this.getViewBounds(e,vy,yy),t.subVectors(yy,vy)}setViewOffset(e,t,i,s,r,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(mo*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const $o=-90,qo=1;class sE extends ht{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new Kt($o,qo,e,t);s.layers=this.layers,this.add(s);const r=new Kt($o,qo,e,t);r.layers=this.layers,this.add(r);const o=new Kt($o,qo,e,t);o.layers=this.layers,this.add(o);const a=new Kt($o,qo,e,t);a.layers=this.layers,this.add(a);const l=new Kt($o,qo,e,t);l.layers=this.layers,this.add(l);const c=new Kt($o,qo,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,s,r,o,a,l]=t;for(const c of t)this.remove(c);if(e===Ii)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===lc)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,o,a,l,c,u]=this.children,f=e.getRenderTarget(),d=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,s),e.render(t,r),e.setRenderTarget(i,1,s),e.render(t,o),e.setRenderTarget(i,2,s),e.render(t,a),e.setRenderTarget(i,3,s),e.render(t,l),e.setRenderTarget(i,4,s),e.render(t,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,s),e.render(t,u),e.setRenderTarget(f,d,h),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class kc extends Wt{constructor(e=[],t=Ns,i,s,r,o,a,l,c,u){super(e,t,i,s,r,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class rE extends ss{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new kc(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:en}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -58,13 +58,13 @@ var QA=Object.defineProperty;var eC=(n,e,t)=>e in n?QA(n,e,{enumerable:!0,config gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},s=new Ao(5,5,5),r=new ki({name:"CubemapFromEquirect",uniforms:Ta(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:zn,blending:Ps});r.uniforms.tEquirect.value=t;const o=new $t(s,r),a=t.minFilter;return t.minFilter===ji&&(t.minFilter=en),new iE(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,i=!0,s=!0){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}}class aa extends ht{constructor(){super(),this.isGroup=!0,this.type="Group"}}const IP={type:"move"};class Mf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new aa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new aa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new B,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new B),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new aa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new B,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new B),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const g=t.getJointPose(_,i),m=this._getHandJoint(c,_);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],d=u.position.distanceTo(f.position),h=.02,p=.005;c.inputState.pinching&&d>h+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=h-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(IP)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new aa;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class ph{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ce(e),this.density=t}clone(){return new ph(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class mh{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Ce(e),this.near=t,this.far=i}clone(){return new mh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class gh extends ht{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new li,this.environmentIntensity=1,this.environmentRotation=new li,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class _h{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ac,this.updateRanges=[],this.version=0,this.uuid=ri()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let s=0,r=this.stride;se.far||t.push({distance:l,point:Ja.clone(),uv:jn.getInterpolation(Ja,Eu,el,Tu,by,Fp,xy,new de),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function wu(n,e,t,i,s,r){Zo.subVectors(n,t).addScalar(.5).multiply(i),s!==void 0?(Qa.x=r*Zo.x-s*Zo.y,Qa.y=s*Zo.x+r*Zo.y):Qa.copy(Zo),n.copy(e),n.x+=Qa.x,n.y+=Qa.y,n.applyMatrix4(rE)}const Au=new B,My=new B;class aE extends ht{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,s=t.length;i0){let i,s;for(i=1,s=t.length;i0){Au.setFromMatrixPosition(this.matrixWorld);const s=e.ray.origin.distanceTo(Au);this.getObjectForDistance(s).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Au.setFromMatrixPosition(e.matrixWorld),My.setFromMatrixPosition(this.matrixWorld);const i=Au.distanceTo(My)/e.zoom;t[0].object.visible=!0;let s,r;for(s=1,r=t.length;s=o)t[s-1].object.visible=!1,t[s].object.visible=!0;else break}for(this._currentLevel=s-1;s1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||UP.getNormalMatrix(e),s=this.coplanarPoint(zp).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Vr=new Tn,Pu=new B;class Bc{constructor(e=new or,t=new or,i=new or,s=new or,r=new or,o=new or){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Li){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],c=s[4],u=s[5],f=s[6],d=s[7],h=s[8],p=s[9],_=s[10],g=s[11],m=s[12],y=s[13],b=s[14],v=s[15];if(i[0].setComponents(l-r,d-c,g-h,v-m).normalize(),i[1].setComponents(l+r,d+c,g+h,v+m).normalize(),i[2].setComponents(l+o,d+u,g+p,v+y).normalize(),i[3].setComponents(l-o,d-u,g-p,v-y).normalize(),i[4].setComponents(l-a,d-f,g-_,v-b).normalize(),t===Li)i[5].setComponents(l+a,d+f,g+_,v+b).normalize();else if(t===lc)i[5].setComponents(a,f,_,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Vr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Vr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Vr)}intersectsSprite(e){return Vr.center.set(0,0,0),Vr.radius=.7071067811865476,Vr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Vr)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,Pu.y=s.normal.y>0?e.max.y:e.min.y,Pu.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(Pu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Vp(n,e){return n-e}function FP(n,e){return n.z-e.z}function kP(n,e){return e.z-n.z}class BP{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,s){const r=this.pool,o=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const a=r[this.index];o.push(a),this.index++,a.start=e,a.count=t,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}}const Xn=new Ye,zP=new Ce(1,1,1),Hp=new Bc,Iu=new Vn,Hr=new Tn,il=new B,Iy=new B,VP=new B,Gp=new BP,xn=new $t,Lu=[];function HP(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const s=n.count;for(let r=0;r65535?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Ct(r,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const s=e.getAttribute(i),r=t.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Vn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,s=t.length;i=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Vp),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=i):(s=this._instanceInfo.length,this._instanceInfo.push(i));const r=this._matricesTexture;Xn.identity().toArray(r.image.data,s*16),r.needsUpdate=!0;const o=this._colorsTexture;return o&&(zP.toArray(o.image.data,s*4),o.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(e,t=-1,i=-1){this._initializeGeometry(e),this._validateGeometry(e);const s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=i===-1?o.count:i),s.indexStart!==-1&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Vp),l=this._availableGeometryIds.shift(),r[l]=s):(l=this._geometryCount,this._geometryCount++,r.push(s)),this.setGeometryAt(l,e),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,s=i.getIndex()!==null,r=i.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(s&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const u in i.attributes){const f=t.getAttribute(u),d=i.getAttribute(u);HP(f,d,l);const h=f.itemSize;for(let p=f.count,_=c;p<_;p++){const g=l+p;for(let m=0;m=t.length||t[e].active===!1)return this;const i=this._instanceInfo;for(let s=0,r=i.length;sa).sort((o,a)=>i[o].vertexStart-i[a].vertexStart),r=this.geometry;for(let o=0,a=i.length;o=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[e];if(s.boundingBox===null){const r=new Vn,o=i.index,a=i.attributes.position;for(let l=s.start,c=s.start+s.count;l=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[e];if(s.boundingSphere===null){const r=new Tn;this.getBoundingBoxAt(e,Iu),Iu.getCenter(r.center);const o=i.index,a=i.attributes.position;let l=0;for(let c=s.start,u=s.start+s.count;ca.active);if(Math.max(...i.map(a=>a.vertexStart+a.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new ct,this._initializeGeometry(r));const o=this.geometry;r.index&&Gr(r.index.array,o.index.array);for(const a in r.attributes)Gr(r.attributes[a].array,o.attributes[a].array)}raycast(e,t){const i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,o=this.geometry;xn.material=this.material,xn.geometry.index=o.index,xn.geometry.attributes=o.attributes,xn.geometry.boundingBox===null&&(xn.geometry.boundingBox=new Vn),xn.geometry.boundingSphere===null&&(xn.geometry.boundingSphere=new Tn);for(let a=0,l=i.length;a({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=s.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,u=this._multiDrawCounts,f=this._geometryInfo,d=this.perObjectFrustumCulled,h=this._indirectTexture,p=h.image.data;d&&(Xn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),Hp.setFromProjectionMatrix(Xn,e.coordinateSystem));let _=0;if(this.sortObjects){Xn.copy(this.matrixWorld).invert(),il.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Xn),Iy.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Xn);for(let y=0,b=l.length;y0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;ri)return;Wp.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Wp);if(!(ce.far))return{distance:c,point:Dy.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const Oy=new B,Ny=new B;class os extends vr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let s=0,r=t.count;s0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class hE extends Wt{constructor(e,t,i,s,r=en,o=en,a,l,c){super(e,t,i,s,r,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1;const u=this;function f(){u.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class GP extends hE{constructor(e,t,i,s,r,o,a,l){super({},e,t,i,s,r,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class WP extends Wt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=gn,this.minFilter=gn,this.generateMipmaps=!1,this.needsUpdate=!0}}class yh extends Wt{constructor(e,t,i,s,r,o,a,l,c,u,f,d){super(null,o,a,l,c,u,s,r,f,d),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class XP extends yh{constructor(e,t,i,s,r,o){super(e,t,i,r,o),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=gi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class $P extends yh{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Ns),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class qP extends Wt{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class n_ extends Wt{constructor(e,t,i=Us,s,r,o,a=gn,l=gn,c,u=Ma){if(u!==Ma&&u!==Sa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,s,r,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new cr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Vi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const i=this.getLengths();let s=0;const r=i.length;let o;t?o=t:o=e*i[r-1];let a=0,l=r-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=i[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,i[s]===o)return s/(r-1);const u=i[s],d=i[s+1]-u,h=(o-u)/d;return(s+h)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);const o=this.getPoint(s),a=this.getPoint(r),l=t||(o.isVector2?new de:new B);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){const i=new B,s=[],r=[],o=[],a=new B,l=new Ye;for(let h=0;h<=e;h++){const p=h/e;s[h]=this.getTangentAt(p,new B)}r[0]=new B,o[0]=new B;let c=Number.MAX_VALUE;const u=Math.abs(s[0].x),f=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,i.set(1,0,0)),f<=c&&(c=f,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let h=1;h<=e;h++){if(r[h]=r[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(s[h-1],s[h]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(tt(s[h-1].dot(s[h]),-1,1));r[h].applyMatrix4(l.makeRotationAxis(a,p))}o[h].crossVectors(s[h],r[h])}if(t===!0){let h=Math.acos(tt(r[0].dot(r[e]),-1,1));h/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(h=-h);for(let p=1;p<=e;p++)r[p].applyMatrix4(l.makeRotationAxis(s[p],h*p)),o[p].crossVectors(s[p],r[p])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class bh extends Vi{constructor(e=0,t=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new de){const i=t,s=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)s;)r-=s;r0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=s[(a-1)%r]:(Fu.subVectors(s[0],s[1]).add(s[0]),c=Fu);const f=s[a%r],d=s[(a+1)%r];if(this.closed||a+2s.length-2?s.length-1:o+1],f=s[o>s.length-3?s.length-1:o+2];return i.set(ky(a,l.x,c.x,u.x,f.x),ky(a,l.y,c.y,u.y,f.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=s[r]-i,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,s=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class zc extends ct{constructor(e=[new de(0,-.5),new de(.5,0),new de(0,.5)],t=12,i=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:s},t=Math.floor(t),s=tt(s,0,Math.PI*2);const r=[],o=[],a=[],l=[],c=[],u=1/t,f=new B,d=new de,h=new B,p=new B,_=new B;let g=0,m=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:g=e[y+1].x-e[y].x,m=e[y+1].y-e[y].y,h.x=m*1,h.y=-g,h.z=m*0,_.copy(h),h.normalize(),l.push(h.x,h.y,h.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:g=e[y+1].x-e[y].x,m=e[y+1].y-e[y].y,h.x=m*1,h.y=-g,h.z=m*0,p.copy(h),h.x+=_.x,h.y+=_.y,h.z+=_.z,h.normalize(),l.push(h.x,h.y,h.z),_.copy(p)}for(let y=0;y<=t;y++){const b=i+y*u*s,v=Math.sin(b),T=Math.cos(b);for(let E=0;E<=e.length-1;E++){f.x=e[E].x*v,f.y=e[E].y,f.z=e[E].x*T,o.push(f.x,f.y,f.z),d.x=y/t,d.y=E/(e.length-1),a.push(d.x,d.y);const S=l[3*E+0]*v,P=l[3*E+1],x=l[3*E+0]*T;c.push(S,P,x)}}for(let y=0;y0&&b(!0),t>0&&b(!1)),this.setIndex(u),this.setAttribute("position",new ke(f,3)),this.setAttribute("normal",new ke(d,3)),this.setAttribute("uv",new ke(h,2));function y(){const v=new B,T=new B;let E=0;const S=(t-e)/i;for(let P=0;P<=r;P++){const x=[],M=P/r,L=M*(t-e)+e;for(let F=0;F<=s;F++){const H=F/s,Y=H*l+a,ee=Math.sin(Y),K=Math.cos(Y);T.x=L*ee,T.y=-M*i+g,T.z=L*K,f.push(T.x,T.y,T.z),v.set(ee,S,K).normalize(),d.push(v.x,v.y,v.z),h.push(H,1-M),x.push(p++)}_.push(x)}for(let P=0;P0||x!==0)&&(u.push(M,L,H),E+=3),(t>0||x!==r-1)&&(u.push(L,F,H),E+=3)}c.addGroup(m,E,0),m+=E}function b(v){const T=p,E=new de,S=new B;let P=0;const x=v===!0?e:t,M=v===!0?1:-1;for(let F=1;F<=s;F++)f.push(0,g*M,0),d.push(0,M,0),h.push(.5,.5),p++;const L=p;for(let F=0;F<=s;F++){const Y=F/s*l+a,ee=Math.cos(Y),K=Math.sin(Y);S.x=x*K,S.y=g*M,S.z=x*ee,f.push(S.x,S.y,S.z),d.push(0,M,0),E.x=ee*.5+.5,E.y=K*.5*M+.5,h.push(E.x,E.y),p++}for(let F=0;F.9&&S<.1&&(b<.2&&(o[y+0]+=1),v<.2&&(o[y+2]+=1),T<.2&&(o[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function h(y,b){const v=y*3;b.x=e[v+0],b.y=e[v+1],b.z=e[v+2]}function p(){const y=new B,b=new B,v=new B,T=new B,E=new de,S=new de,P=new de;for(let x=0,M=0;x80*t){a=1/0,l=1/0;let u=-1/0,f=-1/0;for(let d=t;du&&(u=h),p>f&&(f=p)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return fc(r,o,t,a,l,c,0),o}function bE(n,e,t,i,s){let r;if(s===_I(n,e,t,i)>0)for(let o=e;o=e;o-=i)r=By(o/i|0,n[o],n[o+1],r);return r&&Aa(r,r.next)&&(hc(r),r=r.next),r}function Eo(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Aa(t,t.next)||zt(t.prev,t,t.next)===0)){if(hc(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function fc(n,e,t,i,s,r,o){if(!n)return;!o&&r&&fI(n,i,s,r);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(r?iI(n,i,s,r):nI(n)){e.push(l.i,n.i,c.i),hc(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=sI(Eo(n),e),fc(n,e,t,i,s,r,2)):o===2&&rI(n,e,t,i,s,r):fc(Eo(n),e,t,i,s,r,1);break}}}function nI(n){const e=n.prev,t=n,i=n.next;if(zt(e,t,i)>=0)return!1;const s=e.x,r=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=Math.min(s,r,o),f=Math.min(a,l,c),d=Math.max(s,r,o),h=Math.max(a,l,c);let p=i.next;for(;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=f&&p.y<=h&&pl(s,a,r,l,o,c,p.x,p.y)&&zt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function iI(n,e,t,i){const s=n.prev,r=n,o=n.next;if(zt(s,r,o)>=0)return!1;const a=s.x,l=r.x,c=o.x,u=s.y,f=r.y,d=o.y,h=Math.min(a,l,c),p=Math.min(u,f,d),_=Math.max(a,l,c),g=Math.max(u,f,d),m=mg(h,p,e,t,i),y=mg(_,g,e,t,i);let b=n.prevZ,v=n.nextZ;for(;b&&b.z>=m&&v&&v.z<=y;){if(b.x>=h&&b.x<=_&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&pl(a,u,l,f,c,d,b.x,b.y)&&zt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=h&&v.x<=_&&v.y>=p&&v.y<=g&&v!==s&&v!==o&&pl(a,u,l,f,c,d,v.x,v.y)&&zt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=m;){if(b.x>=h&&b.x<=_&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&pl(a,u,l,f,c,d,b.x,b.y)&&zt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=y;){if(v.x>=h&&v.x<=_&&v.y>=p&&v.y<=g&&v!==s&&v!==o&&pl(a,u,l,f,c,d,v.x,v.y)&&zt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function sI(n,e){let t=n;do{const i=t.prev,s=t.next.next;!Aa(i,s)&&ME(i,t,t.next,s)&&dc(i,s)&&dc(s,i)&&(e.push(i.i,t.i,s.i),hc(t),hc(t.next),t=n=s),t=t.next}while(t!==n);return Eo(t)}function rI(n,e,t,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&pI(o,a)){let l=SE(o,a);o=Eo(o,o.next),l=Eo(l,l.next),fc(o,e,t,i,s,r,0),fc(l,e,t,i,s,r,0);return}a=a.next}o=o.next}while(o!==n)}function oI(n,e,t,i){const s=[];for(let r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){const f=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=i&&f>r&&(r=f,o=t.x=t.x&&t.x>=l&&i!==t.x&&xE(so.x||t.x===o.x&&uI(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function uI(n,e){return zt(n.prev,n,e.prev)<0&&zt(e.next,n,n.next)<0}function fI(n,e,t,i){let s=n;do s.z===0&&(s.z=mg(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,dI(s)}function dI(n){let e,t=1;do{let i=n,s;n=null;let r=null;for(e=0;i;){e++;let o=i,a=0;for(let c=0;c0||l>0&&o;)a!==0&&(l===0||!o||i.z<=o.z)?(s=i,i=i.nextZ,a--):(s=o,o=o.nextZ,l--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;i=o}r.nextZ=null,t*=2}while(e>1);return n}function mg(n,e,t,i,s){return n=(n-t)*s|0,e=(e-i)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function hI(n){let e=n,t=n;do(e.x=(n-o)*(r-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(s-o)*(i-a)}function pl(n,e,t,i,s,r,o,a){return!(n===o&&e===a)&&xE(n,e,t,i,s,r,o,a)}function pI(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!mI(n,e)&&(dc(n,e)&&dc(e,n)&&gI(n,e)&&(zt(n.prev,n,e.prev)||zt(n,e.prev,e))||Aa(n,e)&&zt(n.prev,n,n.next)>0&&zt(e.prev,e,e.next)>0)}function zt(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Aa(n,e){return n.x===e.x&&n.y===e.y}function ME(n,e,t,i){const s=Hu(zt(n,e,t)),r=Hu(zt(n,e,i)),o=Hu(zt(t,i,n)),a=Hu(zt(t,i,e));return!!(s!==r&&o!==a||s===0&&Vu(n,t,e)||r===0&&Vu(n,i,e)||o===0&&Vu(t,n,i)||a===0&&Vu(t,e,i))}function Vu(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Hu(n){return n>0?1:n<0?-1:0}function mI(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&ME(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function dc(n,e){return zt(n.prev,n,n.next)<0?zt(n,e,n.next)>=0&&zt(n,n.prev,e)>=0:zt(n,e,n.prev)<0||zt(n,n.next,e)<0}function gI(n,e){let t=n,i=!1;const s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function SE(n,e){const t=gg(n.i,n.x,n.y),i=gg(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function By(n,e,t,i){const s=gg(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function hc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function gg(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _I(n,e,t,i){let s=0;for(let r=e,o=t-i;r2&&n[e-1].equals(n[0])&&n.pop()}function Vy(n,e){for(let t=0;tNumber.EPSILON){const le=Math.sqrt($),Me=Math.sqrt(O*O+V*V),Be=W.x-U/le,me=W.y+w/le,Te=C.x-V/Me,Ve=C.y+O/Me,We=((Te-Be)*V-(Ve-me)*O)/(w*V-U*O);I=Be+w*We-G.x,N=me+U*We-G.y;const Se=I*I+N*N;if(Se<=2)return new de(I,N);A=Math.sqrt(Se/2)}else{let le=!1;w>Number.EPSILON?O>Number.EPSILON&&(le=!0):w<-Number.EPSILON?O<-Number.EPSILON&&(le=!0):Math.sign(U)===Math.sign(V)&&(le=!0),le?(I=-U,N=w,A=Math.sqrt($)):(I=w,N=U,A=Math.sqrt($/2))}return new de(I/A,N/A)}const he=[];for(let G=0,W=ee.length,C=W-1,I=G+1;G=0;G--){const W=G/g,C=h*Math.cos(W*Math.PI/2),I=p*Math.sin(W*Math.PI/2)+_;for(let N=0,A=ee.length;N=0;){const I=C;let N=C-1;N<0&&(N=G.length-1);for(let A=0,w=u+g*2;A0)&&h.push(b,v,E),(m!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class CE extends An{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ce(16777215),this.specular=new Ce(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new li,this.combine=Oc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class RE extends An{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ce(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class PE extends An{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class IE extends An{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ce(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new li,this.combine=Oc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class u_ extends An{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=V1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class f_ extends An{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class LE extends An{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ce(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class DE extends Gn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function co(n,e){return!n||n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function OE(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function NE(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function _g(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=n[a+l]}return s}function d_(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push(...o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)}function MI(n,e,t,i,s=30){const r=n.clone();r.name=e;const o=[];for(let l=0;l=i)){f.push(c.times[h]);for(let _=0;_r.tracks[l].times[0]&&(a=r.tracks[l].times[0]);for(let l=0;l=a.times[p]){const m=p*f+u,y=m+f-u;_=a.values.slice(m,y)}else{const m=a.createInterpolant(),y=u,b=f-u;m.evaluate(r),_=m.resultBuffer.slice(y,b)}l==="quaternion"&&new Jn().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let m=0;m=r)){const a=t[1];e=r)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=i.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&OE(s))for(let a=0,l=s.length;a!==l;++a){const c=s[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===bf,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}Ei.prototype.ValueTypeName="";Ei.prototype.TimeBufferType=Float32Array;Ei.prototype.ValueBufferType=Float32Array;Ei.prototype.DefaultInterpolation=Md;class Co extends Ei{constructor(e,t,i){super(e,t,i)}}Co.prototype.ValueTypeName="bool";Co.prototype.ValueBufferType=Array;Co.prototype.DefaultInterpolation=sc;Co.prototype.InterpolantFactoryMethodLinear=void 0;Co.prototype.InterpolantFactoryMethodSmooth=void 0;class p_ extends Ei{constructor(e,t,i,s){super(e,t,i,s)}}p_.prototype.ValueTypeName="color";class pc extends Ei{constructor(e,t,i,s){super(e,t,i,s)}}pc.prototype.ValueTypeName="number";class kE extends Gc{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(s-t);let c=e*a;for(let u=c+a;c!==u;c+=4)Jn.slerpFlat(r,0,o,c-a,o,c,l);return r}}class Wc extends Ei{constructor(e,t,i,s){super(e,t,i,s)}InterpolantFactoryMethodLinear(e){return new kE(this.times,this.values,this.getValueSize(),e)}}Wc.prototype.ValueTypeName="quaternion";Wc.prototype.InterpolantFactoryMethodSmooth=void 0;class Ro extends Ei{constructor(e,t,i){super(e,t,i)}}Ro.prototype.ValueTypeName="string";Ro.prototype.ValueBufferType=Array;Ro.prototype.DefaultInterpolation=sc;Ro.prototype.InterpolantFactoryMethodLinear=void 0;Ro.prototype.InterpolantFactoryMethodSmooth=void 0;class mc extends Ei{constructor(e,t,i,s){super(e,t,i,s)}}mc.prototype.ValueTypeName="vector";class gc{constructor(e="",t=-1,i=[],s=uh){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=ri(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(wI(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(Ei.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const f=u[1];let d=s[f];d||(s[f]=d=[]),d.push(c)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(f,d,h,p,_){if(h.length!==0){const g=[],m=[];d_(h,g,m,p),g.length!==0&&_.push(new f(d,g,m))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{t&&t(r),this.manager.itemEnd(e)},0),r;if(ms[e]!==void 0){ms[e].push({onLoad:t,onProgress:i,onError:s});return}ms[e]=[],ms[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=ms[e],f=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=d?parseInt(d):0,p=h!==0;let _=0;const g=new ReadableStream({start(m){y();function y(){f.read().then(({done:b,value:v})=>{if(b)m.close();else{_+=v.byteLength;const T=new ProgressEvent("progress",{lengthComputable:p,loaded:_,total:h});for(let E=0,S=u.length;E{m.error(b)})}}});return new Response(g)}else throw new AI(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a==="")return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),d=f&&f[1]?f[1].toLowerCase():void 0,h=new TextDecoder(d);return c.arrayBuffer().then(p=>h.decode(p))}}}).then(c=>{ws.add(e,c);const u=ms[e];delete ms[e];for(let f=0,d=u.length;f{const u=ms[e];if(u===void 0)throw this.manager.itemError(e),c;delete ms[e];for(let f=0,d=u.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class CI extends ei{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Fs(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){s?s(l):console.error(l),r.manager.itemError(e)}},i,s)}parse(e){const t=[];for(let i=0;i0:s.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(s.uniforms[r]={},o.type){case"t":s.uniforms[r].value=i(o.value);break;case"c":s.uniforms[r].value=new Ce().setHex(o.value);break;case"v2":s.uniforms[r].value=new de().fromArray(o.value);break;case"v3":s.uniforms[r].value=new B().fromArray(o.value);break;case"v4":s.uniforms[r].value=new gt().fromArray(o.value);break;case"m3":s.uniforms[r].value=new it().fromArray(o.value);break;case"m4":s.uniforms[r].value=new Ye().fromArray(o.value);break;default:s.uniforms[r].value=o.value}}if(e.defines!==void 0&&(s.defines=e.defines),e.vertexShader!==void 0&&(s.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(s.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(s.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)s.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(s.lights=e.lights),e.clipping!==void 0&&(s.clipping=e.clipping),e.size!==void 0&&(s.size=e.size),e.sizeAttenuation!==void 0&&(s.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(s.map=i(e.map)),e.matcap!==void 0&&(s.matcap=i(e.matcap)),e.alphaMap!==void 0&&(s.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(s.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(s.bumpScale=e.bumpScale),e.normalMap!==void 0&&(s.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(s.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),s.normalScale=new de().fromArray(r)}return e.displacementMap!==void 0&&(s.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(s.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(s.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(s.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(s.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(s.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(s.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(s.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(s.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(s.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(s.envMap=i(e.envMap)),e.envMapRotation!==void 0&&s.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(s.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(s.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(s.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(s.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(s.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(s.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(s.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(s.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(s.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(s.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(s.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(s.clearcoatNormalScale=new de().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(s.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(s.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(s.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(s.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(s.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(s.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(s.sheenRoughnessMap=i(e.sheenRoughnessMap)),s}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Oh.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:TE,SpriteMaterial:Q0,RawShaderMaterial:wE,ShaderMaterial:ki,PointsMaterial:t_,MeshPhysicalMaterial:AE,MeshStandardMaterial:c_,MeshPhongMaterial:CE,MeshToonMaterial:RE,MeshNormalMaterial:PE,MeshLambertMaterial:IE,MeshDepthMaterial:u_,MeshDistanceMaterial:f_,MeshBasicMaterial:zs,MeshMatcapMaterial:LE,LineDashedMaterial:DE,LineBasicMaterial:Gn,Material:An};return new t[e]}}class vg{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class YE extends ct{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class jE extends ei{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Fs(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){s?s(l):console.error(l),r.manager.itemError(e)}},i,s)}parse(e){const t={},i={};function s(h,p){if(t[p]!==void 0)return t[p];const g=h.interleavedBuffers[p],m=r(h,g.buffer),y=oa(g.type,m),b=new _h(y,g.stride);return b.uuid=g.uuid,t[p]=b,b}function r(h,p){if(i[p]!==void 0)return i[p];const g=h.arrayBuffers[p],m=new Uint32Array(g).buffer;return i[p]=m,m}const o=e.isInstancedBufferGeometry?new YE:new ct,a=e.data.index;if(a!==void 0){const h=oa(a.type,a.array);o.setIndex(new Ct(h,1))}const l=e.data.attributes;for(const h in l){const p=l[h];let _;if(p.isInterleavedBufferAttribute){const g=s(e.data,p.data);_=new So(g,p.itemSize,p.offset,p.normalized)}else{const g=oa(p.type,p.array),m=p.isInstancedBufferAttribute?wa:Ct;_=new m(g,p.itemSize,p.normalized)}p.name!==void 0&&(_.name=p.name),p.usage!==void 0&&_.setUsage(p.usage),o.setAttribute(h,_)}const c=e.data.morphAttributes;if(c)for(const h in c){const p=c[h],_=[];for(let g=0,m=p.length;g0){const l=new m_(t);r=new _c(l),r.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){s=new _c(this.manager),s.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const g=new Vn;g.min.fromArray(_.boxMin),g.max.fromArray(_.boxMax);const m=new Tn;return m.radius=_.sphereRadius,m.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:g,sphereInitialized:_.sphereInitialized,sphere:m}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new aE;break;case"Line":o=new vr(a(e.geometry),l(e.material));break;case"LineLoop":o=new fE(a(e.geometry),l(e.material));break;case"LineSegments":o=new os(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new dE(a(e.geometry),l(e.material));break;case"Sprite":o=new oE(l(e.material));break;case"Group":o=new aa;break;case"Bone":o=new e_;break;default:o=new ht}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let h=0;h"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=ws.get(e);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),r.manager.itemEnd(e)}).catch(c=>{s&&s(c)});return}return setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){return ws.add(e,c),t&&t(c),r.manager.itemEnd(e),c}).catch(function(c){s&&s(c),ws.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});ws.add(e,l),r.manager.itemStart(e)}}let Gu;class __{static getContext(){return Gu===void 0&&(Gu=new(window.AudioContext||window.webkitAudioContext)),Gu}static setContext(e){Gu=e}}class BI extends ei{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Fs(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);__.getContext().decodeAudioData(c,function(f){t(f)}).catch(a)}catch(c){a(c)}},i,s);function a(l){s?s(l):console.error(l),r.manager.itemError(e)}}}const jy=new Ye,Ky=new Ye,Wr=new Ye;class zI{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Wr.copy(e.projectionMatrix);const s=t.eyeSep/2,r=s*t.near/t.focus,o=t.near*Math.tan(mo*t.fov*.5)/t.zoom;let a,l;Ky.elements[12]=-s,jy.elements[12]=s,a=-o*t.aspect+r,l=o*t.aspect+r,Wr.elements[0]=2*t.near/(l-a),Wr.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Wr),a=-o*t.aspect-r,l=o*t.aspect-r,Wr.elements[0]=2*t.near/(l-a),Wr.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Wr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Ky),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(jy)}}class KE extends Kt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e,this.index=0}}class Nh{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Zy(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Zy();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Zy(){return performance.now()}const Xr=new B,Jy=new Jn,VI=new B,$r=new B;class HI extends ht{constructor(){super(),this.type="AudioListener",this.context=__.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Nh}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xr,Jy,VI),$r.set(0,0,-1).applyQuaternion(Jy),t.positionX){const s=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Xr.x,s),t.positionY.linearRampToValueAtTime(Xr.y,s),t.positionZ.linearRampToValueAtTime(Xr.z,s),t.forwardX.linearRampToValueAtTime($r.x,s),t.forwardY.linearRampToValueAtTime($r.y,s),t.forwardZ.linearRampToValueAtTime($r.z,s),t.upX.linearRampToValueAtTime(i.x,s),t.upY.linearRampToValueAtTime(i.y,s),t.upZ.linearRampToValueAtTime(i.z,s)}else t.setPosition(Xr.x,Xr.y,Xr.z),t.setOrientation($r.x,$r.y,$r.z,i.x,i.y,i.z)}}class ZE extends ht{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(i,s,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,s=i*this._origIndex;e.getValue(t,s);for(let r=i,o=s;r!==o;++r)t[r]=t[s+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==r;++o)e[t+o]=e[i+o]}_slerp(e,t,i,s){Jn.slerpFlat(e,t,e,t,e,i,s)}_slerpAdditive(e,t,i,s,r){const o=this._workIndex*r;Jn.multiplyQuaternionsFlat(e,o,e,t,e,i),Jn.slerpFlat(e,t,e,t,e,o,s)}_lerp(e,t,i,s,r){const o=1-s;for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*s}}_lerpAdditive(e,t,i,s,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[i+o]*s}}}const v_="\\[\\]\\.:\\/",$I=new RegExp("["+v_+"]","g"),y_="[^"+v_+"]",qI="[^"+v_.replace("\\.","")+"]",YI=/((?:WC+[\/:])*)/.source.replace("WC",y_),jI=/(WCOD+)?/.source.replace("WCOD",qI),KI=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",y_),ZI=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",y_),JI=new RegExp("^"+YI+jI+KI+ZI+"$"),QI=["material","materials","bones","map"];class eL{constructor(e,t,i){const s=i||mt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class mt{constructor(e,t,i){this.path=t,this.parsedPath=i||mt.parseTrackName(t),this.node=mt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new mt.Composite(e,t,i):new mt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($I,"")}static parseTrackName(e){const t=JI.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);QI.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(r){for(let o=0;o=r){const f=r++,d=e[f];t[d.uuid]=u,e[u]=d,t[c]=f,e[f]=l;for(let h=0,p=s;h!==p;++h){const _=i[h],g=_[f],m=_[u];_[u]=g,_[f]=m}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,s=i.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,f=t[u];if(f!==void 0)if(delete t[u],f0&&(t[h.uuid]=f),e[f]=h,e.pop();for(let p=0,_=s;p!==_;++p){const g=i[p];g[f]=g[d],g.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const i=this._bindingsIndicesByPath;let s=i[e];const r=this._bindings;if(s!==void 0)return r[s];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,f=new Array(c);s=r.length,i[e]=s,o.push(e),a.push(t),r.push(f);for(let d=u,h=l.length;d!==h;++d){const p=l[d];f[d]=new mt(p,e,t)}return f}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const s=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class QE{constructor(e,t,i=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=s;const r=t.tracks,o=r.length,a=new Array(o),l={endingStart:ao,endingEnd:ao};for(let c=0;c!==o;++c){const u=r[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=B1,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i=!1){if(e.fadeOut(t),this.fadeIn(t),i===!0){const s=this._clip.duration,r=e._clip.duration,o=r/s,a=s/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i=!1){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const s=this._mixer,r=s.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=r,l[1]=r+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,s){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const l=(e-r)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case q0:for(let u=0,f=l.length;u!==f;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case uh:default:for(let u=0,f=l.length;u!==f;++u)l[u].evaluate(o),c[u].accumulate(s,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let s=this.time+e,r=this._loopCount;const o=i===z1;if(e===0)return r===-1?s:o&&(r&1)===1?t-s:s;if(i===k1){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),s>=t||s<0){const a=Math.floor(s/t);s-=t*a,r+=Math.abs(a);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=s;if(o&&(r&1)===1)return t-s}return s}_setEndings(e,t,i){const s=this._interpolantSettings;i?(s.endingStart=lo,s.endingEnd=lo):(e?s.endingStart=this.zeroSlopeAtStart?lo:ao:s.endingStart=rc,t?s.endingEnd=this.zeroSlopeAtEnd?lo:ao:s.endingEnd=rc)}_scheduleFading(e,t,i){const s=this._mixer,r=s.time;let o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=t,a[1]=r+e,l[1]=i,this}}const nL=new Float32Array(1);class iL extends rs{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,s=e._clip.tracks,r=s.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let f=0;f!==r;++f){const d=s[f],h=d.name;let p=u[h];if(p!==void 0)++p.referenceCount,o[f]=p;else{if(p=o[f],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,h));continue}const _=t&&t._propertyBindings[f].binding.parsedPath;p=new JE(mt.create(i,h,_),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,h),o[f]=p}a[f].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,i)}const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,s=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(s,e,r,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,nb).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ib=new B,Wu=new B;class hL{constructor(e=new B,t=new B){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ib.subVectors(e,this.start),Wu.subVectors(this.end,this.start);const i=Wu.dot(Wu);let r=Wu.dot(ib)/i;return t&&(r=tt(r,0,1)),r}closestPointToPoint(e,t,i){const s=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(s).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const sb=new B;class pL extends ht{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new ct,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{cb.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(cb,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class AL extends os{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new ct;s.setAttribute("position",new ke(t,3)),s.setAttribute("color",new ke(i,3));const r=new Gn({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,t,i){const s=new Ce,r=this.geometry.attributes.color.array;return s.set(e),s.toArray(r,0),s.toArray(r,3),s.set(t),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class CL{constructor(){this.type="ShapePath",this.color=new Ce,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new uc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,s){return this.currentPath.quadraticCurveTo(e,t,i,s),this}bezierCurveTo(e,t,i,s,r,o){return this.currentPath.bezierCurveTo(e,t,i,s,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(m){const y=[];for(let b=0,v=m.length;bNumber.EPSILON){if(M<0&&(S=y[E],x=-x,P=y[T],M=-M),m.yP.y)continue;if(m.y===S.y){if(m.x===S.x)return!0}else{const L=M*(m.x-S.x)-x*(m.y-S.y);if(L===0)return!0;if(L<0)continue;v=!v}}else{if(m.y!==S.y)continue;if(P.x<=m.x&&m.x<=S.x||S.x<=m.x&&m.x<=P.x)return!0}}return v}const s=Qi.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,l;const c=[];if(r.length===1)return a=r[0],l=new go,l.curves=a.curves,c.push(l),c;let u=!s(r[0].getPoints());u=e?!u:u;const f=[],d=[];let h=[],p=0,_;d[p]=void 0,h[p]=[];for(let m=0,y=r.length;m1){let m=!1,y=0;for(let b=0,v=d.length;b0&&m===!1&&(h=f)}let g;for(let m=0,y=d.length;me?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function IL(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function LL(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function bg(n,e,t,i){const s=DL(i);switch(t){case V0:return n*e;case G0:return n*e;case W0:return n*e*2;case ah:return n*e/s.components*s.byteLength;case Nc:return n*e/s.components*s.byteLength;case X0:return n*e*2/s.components*s.byteLength;case lh:return n*e*2/s.components*s.byteLength;case H0:return n*e*3/s.components*s.byteLength;case Bn:return n*e*4/s.components*s.byteLength;case ch:return n*e*4/s.components*s.byteLength;case Sl:case El:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Tl:case wl:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Zf:case Qf:return Math.max(n,16)*Math.max(e,8)/4;case Kf:case Jf:return Math.max(n,8)*Math.max(e,8)/2;case ed:case td:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case nd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case id:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case sd:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case rd:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case od:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case ad:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case ld:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case cd:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case ud:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case fd:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case dd:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case hd:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case pd:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case md:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case gd:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Al:case _d:case vd:return Math.ceil(n/4)*Math.ceil(e/4)*16;case $0:case yd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case bd:case xd:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function DL(n){switch(n){case is:case k0:return{byteLength:1,components:1};case ba:case B0:case Ua:return{byteLength:2,components:1};case rh:case oh:return{byteLength:2,components:4};case Us:case sh:case Kn:return{byteLength:4,components:1};case z0:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}class OL{static contain(e,t){return PL(e,t)}static cover(e,t){return IL(e,t)}static fill(e){return LL(e)}static getByteLength(e,t,i,s){return bg(e,t,i,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Dc}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Dc);/** + `},s=new Ao(5,5,5),r=new ki({name:"CubemapFromEquirect",uniforms:Ta(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:zn,blending:Ps});r.uniforms.tEquirect.value=t;const o=new $t(s,r),a=t.minFilter;return t.minFilter===ji&&(t.minFilter=en),new sE(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,i=!0,s=!0){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}}class aa extends ht{constructor(){super(),this.isGroup=!0,this.type="Group"}}const LP={type:"move"};class Mf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new aa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new aa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new B,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new B),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new aa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new B,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new B),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const g=t.getJointPose(_,i),m=this._getHandJoint(c,_);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],d=u.position.distanceTo(f.position),h=.02,p=.005;c.inputState.pinching&&d>h+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=h-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(LP)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new aa;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class ph{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ce(e),this.density=t}clone(){return new ph(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class mh{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Ce(e),this.near=t,this.far=i}clone(){return new mh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class gh extends ht{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new li,this.environmentIntensity=1,this.environmentRotation=new li,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class _h{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ac,this.updateRanges=[],this.version=0,this.uuid=ri()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let s=0,r=this.stride;se.far||t.push({distance:l,point:Ja.clone(),uv:jn.getInterpolation(Ja,Eu,el,Tu,by,Fp,xy,new de),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function wu(n,e,t,i,s,r){Zo.subVectors(n,t).addScalar(.5).multiply(i),s!==void 0?(Qa.x=r*Zo.x-s*Zo.y,Qa.y=s*Zo.x+r*Zo.y):Qa.copy(Zo),n.copy(e),n.x+=Qa.x,n.y+=Qa.y,n.applyMatrix4(oE)}const Au=new B,My=new B;class lE extends ht{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,s=t.length;i0){let i,s;for(i=1,s=t.length;i0){Au.setFromMatrixPosition(this.matrixWorld);const s=e.ray.origin.distanceTo(Au);this.getObjectForDistance(s).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Au.setFromMatrixPosition(e.matrixWorld),My.setFromMatrixPosition(this.matrixWorld);const i=Au.distanceTo(My)/e.zoom;t[0].object.visible=!0;let s,r;for(s=1,r=t.length;s=o)t[s-1].object.visible=!1,t[s].object.visible=!0;else break}for(this._currentLevel=s-1;s1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||FP.getNormalMatrix(e),s=this.coplanarPoint(zp).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Vr=new Tn,Pu=new B;class Bc{constructor(e=new or,t=new or,i=new or,s=new or,r=new or,o=new or){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Ii){const i=this.planes,s=e.elements,r=s[0],o=s[1],a=s[2],l=s[3],c=s[4],u=s[5],f=s[6],d=s[7],h=s[8],p=s[9],_=s[10],g=s[11],m=s[12],y=s[13],b=s[14],v=s[15];if(i[0].setComponents(l-r,d-c,g-h,v-m).normalize(),i[1].setComponents(l+r,d+c,g+h,v+m).normalize(),i[2].setComponents(l+o,d+u,g+p,v+y).normalize(),i[3].setComponents(l-o,d-u,g-p,v-y).normalize(),i[4].setComponents(l-a,d-f,g-_,v-b).normalize(),t===Ii)i[5].setComponents(l+a,d+f,g+_,v+b).normalize();else if(t===lc)i[5].setComponents(a,f,_,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Vr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Vr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Vr)}intersectsSprite(e){return Vr.center.set(0,0,0),Vr.radius=.7071067811865476,Vr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Vr)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,Pu.y=s.normal.y>0?e.max.y:e.min.y,Pu.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(Pu)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Vp(n,e){return n-e}function kP(n,e){return n.z-e.z}function BP(n,e){return e.z-n.z}class zP{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,s){const r=this.pool,o=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const a=r[this.index];o.push(a),this.index++,a.start=e,a.count=t,a.z=i,a.index=s}reset(){this.list.length=0,this.index=0}}const Xn=new Ye,VP=new Ce(1,1,1),Hp=new Bc,Iu=new Vn,Hr=new Tn,il=new B,Iy=new B,HP=new B,Gp=new zP,xn=new $t,Lu=[];function GP(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const s=n.count;for(let r=0;r65535?new Uint32Array(s):new Uint16Array(s);t.setIndex(new Ct(r,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const s=e.getAttribute(i),r=t.getAttribute(i);if(s.itemSize!==r.itemSize||s.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Vn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,s=t.length;i=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let s=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Vp),s=this._availableInstanceIds.shift(),this._instanceInfo[s]=i):(s=this._instanceInfo.length,this._instanceInfo.push(i));const r=this._matricesTexture;Xn.identity().toArray(r.image.data,s*16),r.needsUpdate=!0;const o=this._colorsTexture;return o&&(VP.toArray(o.image.data,s*4),o.needsUpdate=!0),this._visibilityChanged=!0,s}addGeometry(e,t=-1,i=-1){this._initializeGeometry(e),this._validateGeometry(e);const s={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;s.vertexStart=this._nextVertexStart,s.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(s.indexStart=this._nextIndexStart,s.reservedIndexCount=i===-1?o.count:i),s.indexStart!==-1&&s.indexStart+s.reservedIndexCount>this._maxIndexCount||s.vertexStart+s.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Vp),l=this._availableGeometryIds.shift(),r[l]=s):(l=this._geometryCount,this._geometryCount++,r.push(s)),this.setGeometryAt(l,e),this._nextIndexStart=s.indexStart+s.reservedIndexCount,this._nextVertexStart=s.vertexStart+s.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,s=i.getIndex()!==null,r=i.getIndex(),o=t.getIndex(),a=this._geometryInfo[e];if(s&&o.count>a.reservedIndexCount||t.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=t.getAttribute("position").count;for(const u in i.attributes){const f=t.getAttribute(u),d=i.getAttribute(u);GP(f,d,l);const h=f.itemSize;for(let p=f.count,_=c;p<_;p++){const g=l+p;for(let m=0;m=t.length||t[e].active===!1)return this;const i=this._instanceInfo;for(let s=0,r=i.length;sa).sort((o,a)=>i[o].vertexStart-i[a].vertexStart),r=this.geometry;for(let o=0,a=i.length;o=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[e];if(s.boundingBox===null){const r=new Vn,o=i.index,a=i.attributes.position;for(let l=s.start,c=s.start+s.count;l=this._geometryCount)return null;const i=this.geometry,s=this._geometryInfo[e];if(s.boundingSphere===null){const r=new Tn;this.getBoundingBoxAt(e,Iu),Iu.getCenter(r.center);const o=i.index,a=i.attributes.position;let l=0;for(let c=s.start,u=s.start+s.count;ca.active);if(Math.max(...i.map(a=>a.vertexStart+a.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new ct,this._initializeGeometry(r));const o=this.geometry;r.index&&Gr(r.index.array,o.index.array);for(const a in r.attributes)Gr(r.attributes[a].array,o.attributes[a].array)}raycast(e,t){const i=this._instanceInfo,s=this._geometryInfo,r=this.matrixWorld,o=this.geometry;xn.material=this.material,xn.geometry.index=o.index,xn.geometry.attributes=o.attributes,xn.geometry.boundingBox===null&&(xn.geometry.boundingBox=new Vn),xn.geometry.boundingSphere===null&&(xn.geometry.boundingSphere=new Tn);for(let a=0,l=i.length;a({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,i,s,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=s.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._instanceInfo,c=this._multiDrawStarts,u=this._multiDrawCounts,f=this._geometryInfo,d=this.perObjectFrustumCulled,h=this._indirectTexture,p=h.image.data;d&&(Xn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),Hp.setFromProjectionMatrix(Xn,e.coordinateSystem));let _=0;if(this.sortObjects){Xn.copy(this.matrixWorld).invert(),il.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Xn),Iy.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Xn);for(let y=0,b=l.length;y0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;ri)return;Wp.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Wp);if(!(ce.far))return{distance:c,point:Dy.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const Oy=new B,Ny=new B;class os extends vr{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let s=0,r=t.count;s0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class pE extends Wt{constructor(e,t,i,s,r=en,o=en,a,l,c){super(e,t,i,s,r,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1;const u=this;function f(){u.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class WP extends pE{constructor(e,t,i,s,r,o,a,l){super({},e,t,i,s,r,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class XP extends Wt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=gn,this.minFilter=gn,this.generateMipmaps=!1,this.needsUpdate=!0}}class yh extends Wt{constructor(e,t,i,s,r,o,a,l,c,u,f,d){super(null,o,a,l,c,u,s,r,f,d),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class $P extends yh{constructor(e,t,i,s,r,o){super(e,t,i,r,o),this.isCompressedArrayTexture=!0,this.image.depth=s,this.wrapR=gi,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class qP extends yh{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Ns),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class YP extends Wt{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class n_ extends Wt{constructor(e,t,i=Us,s,r,o,a=gn,l=gn,c,u=Ma){if(u!==Ma&&u!==Sa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,s,r,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new cr(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Vi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const i=this.getLengths();let s=0;const r=i.length;let o;t?o=t:o=e*i[r-1];let a=0,l=r-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=i[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,i[s]===o)return s/(r-1);const u=i[s],d=i[s+1]-u,h=(o-u)/d;return(s+h)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);const o=this.getPoint(s),a=this.getPoint(r),l=t||(o.isVector2?new de:new B);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){const i=new B,s=[],r=[],o=[],a=new B,l=new Ye;for(let h=0;h<=e;h++){const p=h/e;s[h]=this.getTangentAt(p,new B)}r[0]=new B,o[0]=new B;let c=Number.MAX_VALUE;const u=Math.abs(s[0].x),f=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,i.set(1,0,0)),f<=c&&(c=f,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let h=1;h<=e;h++){if(r[h]=r[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(s[h-1],s[h]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(tt(s[h-1].dot(s[h]),-1,1));r[h].applyMatrix4(l.makeRotationAxis(a,p))}o[h].crossVectors(s[h],r[h])}if(t===!0){let h=Math.acos(tt(r[0].dot(r[e]),-1,1));h/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(h=-h);for(let p=1;p<=e;p++)r[p].applyMatrix4(l.makeRotationAxis(s[p],h*p)),o[p].crossVectors(s[p],r[p])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class bh extends Vi{constructor(e=0,t=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new de){const i=t,s=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)s;)r-=s;r0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=s[(a-1)%r]:(Fu.subVectors(s[0],s[1]).add(s[0]),c=Fu);const f=s[a%r],d=s[(a+1)%r];if(this.closed||a+2s.length-2?s.length-1:o+1],f=s[o>s.length-3?s.length-1:o+2];return i.set(ky(a,l.x,c.x,u.x,f.x),ky(a,l.y,c.y,u.y,f.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=s[r]-i,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,s=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class zc extends ct{constructor(e=[new de(0,-.5),new de(.5,0),new de(0,.5)],t=12,i=0,s=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:s},t=Math.floor(t),s=tt(s,0,Math.PI*2);const r=[],o=[],a=[],l=[],c=[],u=1/t,f=new B,d=new de,h=new B,p=new B,_=new B;let g=0,m=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:g=e[y+1].x-e[y].x,m=e[y+1].y-e[y].y,h.x=m*1,h.y=-g,h.z=m*0,_.copy(h),h.normalize(),l.push(h.x,h.y,h.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:g=e[y+1].x-e[y].x,m=e[y+1].y-e[y].y,h.x=m*1,h.y=-g,h.z=m*0,p.copy(h),h.x+=_.x,h.y+=_.y,h.z+=_.z,h.normalize(),l.push(h.x,h.y,h.z),_.copy(p)}for(let y=0;y<=t;y++){const b=i+y*u*s,v=Math.sin(b),T=Math.cos(b);for(let E=0;E<=e.length-1;E++){f.x=e[E].x*v,f.y=e[E].y,f.z=e[E].x*T,o.push(f.x,f.y,f.z),d.x=y/t,d.y=E/(e.length-1),a.push(d.x,d.y);const S=l[3*E+0]*v,P=l[3*E+1],x=l[3*E+0]*T;c.push(S,P,x)}}for(let y=0;y0&&b(!0),t>0&&b(!1)),this.setIndex(u),this.setAttribute("position",new ke(f,3)),this.setAttribute("normal",new ke(d,3)),this.setAttribute("uv",new ke(h,2));function y(){const v=new B,T=new B;let E=0;const S=(t-e)/i;for(let P=0;P<=r;P++){const x=[],M=P/r,L=M*(t-e)+e;for(let F=0;F<=s;F++){const H=F/s,Y=H*l+a,ee=Math.sin(Y),K=Math.cos(Y);T.x=L*ee,T.y=-M*i+g,T.z=L*K,f.push(T.x,T.y,T.z),v.set(ee,S,K).normalize(),d.push(v.x,v.y,v.z),h.push(H,1-M),x.push(p++)}_.push(x)}for(let P=0;P0||x!==0)&&(u.push(M,L,H),E+=3),(t>0||x!==r-1)&&(u.push(L,F,H),E+=3)}c.addGroup(m,E,0),m+=E}function b(v){const T=p,E=new de,S=new B;let P=0;const x=v===!0?e:t,M=v===!0?1:-1;for(let F=1;F<=s;F++)f.push(0,g*M,0),d.push(0,M,0),h.push(.5,.5),p++;const L=p;for(let F=0;F<=s;F++){const Y=F/s*l+a,ee=Math.cos(Y),K=Math.sin(Y);S.x=x*K,S.y=g*M,S.z=x*ee,f.push(S.x,S.y,S.z),d.push(0,M,0),E.x=ee*.5+.5,E.y=K*.5*M+.5,h.push(E.x,E.y),p++}for(let F=0;F.9&&S<.1&&(b<.2&&(o[y+0]+=1),v<.2&&(o[y+2]+=1),T<.2&&(o[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function h(y,b){const v=y*3;b.x=e[v+0],b.y=e[v+1],b.z=e[v+2]}function p(){const y=new B,b=new B,v=new B,T=new B,E=new de,S=new de,P=new de;for(let x=0,M=0;x80*t){a=1/0,l=1/0;let u=-1/0,f=-1/0;for(let d=t;du&&(u=h),p>f&&(f=p)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return fc(r,o,t,a,l,c,0),o}function xE(n,e,t,i,s){let r;if(s===vI(n,e,t,i)>0)for(let o=e;o=e;o-=i)r=By(o/i|0,n[o],n[o+1],r);return r&&Aa(r,r.next)&&(hc(r),r=r.next),r}function Eo(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Aa(t,t.next)||zt(t.prev,t,t.next)===0)){if(hc(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function fc(n,e,t,i,s,r,o){if(!n)return;!o&&r&&dI(n,i,s,r);let a=n;for(;n.prev!==n.next;){const l=n.prev,c=n.next;if(r?sI(n,i,s,r):iI(n)){e.push(l.i,n.i,c.i),hc(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=rI(Eo(n),e),fc(n,e,t,i,s,r,2)):o===2&&oI(n,e,t,i,s,r):fc(Eo(n),e,t,i,s,r,1);break}}}function iI(n){const e=n.prev,t=n,i=n.next;if(zt(e,t,i)>=0)return!1;const s=e.x,r=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=Math.min(s,r,o),f=Math.min(a,l,c),d=Math.max(s,r,o),h=Math.max(a,l,c);let p=i.next;for(;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=f&&p.y<=h&&pl(s,a,r,l,o,c,p.x,p.y)&&zt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function sI(n,e,t,i){const s=n.prev,r=n,o=n.next;if(zt(s,r,o)>=0)return!1;const a=s.x,l=r.x,c=o.x,u=s.y,f=r.y,d=o.y,h=Math.min(a,l,c),p=Math.min(u,f,d),_=Math.max(a,l,c),g=Math.max(u,f,d),m=mg(h,p,e,t,i),y=mg(_,g,e,t,i);let b=n.prevZ,v=n.nextZ;for(;b&&b.z>=m&&v&&v.z<=y;){if(b.x>=h&&b.x<=_&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&pl(a,u,l,f,c,d,b.x,b.y)&&zt(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=h&&v.x<=_&&v.y>=p&&v.y<=g&&v!==s&&v!==o&&pl(a,u,l,f,c,d,v.x,v.y)&&zt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=m;){if(b.x>=h&&b.x<=_&&b.y>=p&&b.y<=g&&b!==s&&b!==o&&pl(a,u,l,f,c,d,b.x,b.y)&&zt(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=y;){if(v.x>=h&&v.x<=_&&v.y>=p&&v.y<=g&&v!==s&&v!==o&&pl(a,u,l,f,c,d,v.x,v.y)&&zt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function rI(n,e){let t=n;do{const i=t.prev,s=t.next.next;!Aa(i,s)&&SE(i,t,t.next,s)&&dc(i,s)&&dc(s,i)&&(e.push(i.i,t.i,s.i),hc(t),hc(t.next),t=n=s),t=t.next}while(t!==n);return Eo(t)}function oI(n,e,t,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&mI(o,a)){let l=EE(o,a);o=Eo(o,o.next),l=Eo(l,l.next),fc(o,e,t,i,s,r,0),fc(l,e,t,i,s,r,0);return}a=a.next}o=o.next}while(o!==n)}function aI(n,e,t,i){const s=[];for(let r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){const f=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=i&&f>r&&(r=f,o=t.x=t.x&&t.x>=l&&i!==t.x&&ME(so.x||t.x===o.x&&fI(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function fI(n,e){return zt(n.prev,n,e.prev)<0&&zt(e.next,n,n.next)<0}function dI(n,e,t,i){let s=n;do s.z===0&&(s.z=mg(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,hI(s)}function hI(n){let e,t=1;do{let i=n,s;n=null;let r=null;for(e=0;i;){e++;let o=i,a=0;for(let c=0;c0||l>0&&o;)a!==0&&(l===0||!o||i.z<=o.z)?(s=i,i=i.nextZ,a--):(s=o,o=o.nextZ,l--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;i=o}r.nextZ=null,t*=2}while(e>1);return n}function mg(n,e,t,i,s){return n=(n-t)*s|0,e=(e-i)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function pI(n){let e=n,t=n;do(e.x=(n-o)*(r-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(s-o)*(i-a)}function pl(n,e,t,i,s,r,o,a){return!(n===o&&e===a)&&ME(n,e,t,i,s,r,o,a)}function mI(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!gI(n,e)&&(dc(n,e)&&dc(e,n)&&_I(n,e)&&(zt(n.prev,n,e.prev)||zt(n,e.prev,e))||Aa(n,e)&&zt(n.prev,n,n.next)>0&&zt(e.prev,e,e.next)>0)}function zt(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Aa(n,e){return n.x===e.x&&n.y===e.y}function SE(n,e,t,i){const s=Hu(zt(n,e,t)),r=Hu(zt(n,e,i)),o=Hu(zt(t,i,n)),a=Hu(zt(t,i,e));return!!(s!==r&&o!==a||s===0&&Vu(n,t,e)||r===0&&Vu(n,i,e)||o===0&&Vu(t,n,i)||a===0&&Vu(t,e,i))}function Vu(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Hu(n){return n>0?1:n<0?-1:0}function gI(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&SE(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function dc(n,e){return zt(n.prev,n,n.next)<0?zt(n,e,n.next)>=0&&zt(n,n.prev,e)>=0:zt(n,e,n.prev)<0||zt(n,n.next,e)<0}function _I(n,e){let t=n,i=!1;const s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function EE(n,e){const t=gg(n.i,n.x,n.y),i=gg(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function By(n,e,t,i){const s=gg(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function hc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function gg(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function vI(n,e,t,i){let s=0;for(let r=e,o=t-i;r2&&n[e-1].equals(n[0])&&n.pop()}function Vy(n,e){for(let t=0;tNumber.EPSILON){const le=Math.sqrt($),Me=Math.sqrt(O*O+V*V),Be=W.x-U/le,me=W.y+w/le,Te=C.x-V/Me,Ve=C.y+O/Me,We=((Te-Be)*V-(Ve-me)*O)/(w*V-U*O);I=Be+w*We-G.x,N=me+U*We-G.y;const Se=I*I+N*N;if(Se<=2)return new de(I,N);A=Math.sqrt(Se/2)}else{let le=!1;w>Number.EPSILON?O>Number.EPSILON&&(le=!0):w<-Number.EPSILON?O<-Number.EPSILON&&(le=!0):Math.sign(U)===Math.sign(V)&&(le=!0),le?(I=-U,N=w,A=Math.sqrt($)):(I=w,N=U,A=Math.sqrt($/2))}return new de(I/A,N/A)}const he=[];for(let G=0,W=ee.length,C=W-1,I=G+1;G=0;G--){const W=G/g,C=h*Math.cos(W*Math.PI/2),I=p*Math.sin(W*Math.PI/2)+_;for(let N=0,A=ee.length;N=0;){const I=C;let N=C-1;N<0&&(N=G.length-1);for(let A=0,w=u+g*2;A0)&&h.push(b,v,E),(m!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class RE extends An{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ce(16777215),this.specular=new Ce(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new li,this.combine=Oc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class PE extends An{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ce(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class IE extends An{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class LE extends An{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ce(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new li,this.combine=Oc,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class u_ extends An{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=H1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class f_ extends An{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class DE extends An{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ce(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Tr,this.normalScale=new de(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class OE extends Gn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function co(n,e){return!n||n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function NE(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function UE(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function _g(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=n[a+l]}return s}function d_(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push(...o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)}function SI(n,e,t,i,s=30){const r=n.clone();r.name=e;const o=[];for(let l=0;l=i)){f.push(c.times[h]);for(let _=0;_r.tracks[l].times[0]&&(a=r.tracks[l].times[0]);for(let l=0;l=a.times[p]){const m=p*f+u,y=m+f-u;_=a.values.slice(m,y)}else{const m=a.createInterpolant(),y=u,b=f-u;m.evaluate(r),_=m.resultBuffer.slice(y,b)}l==="quaternion"&&new Jn().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let m=0;m=r)){const a=t[1];e=r)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=i.slice(r,o),this.values=this.values.slice(r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&NE(s))for(let a=0,l=s.length;a!==l;++a){const c=s[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===bf,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}Si.prototype.ValueTypeName="";Si.prototype.TimeBufferType=Float32Array;Si.prototype.ValueBufferType=Float32Array;Si.prototype.DefaultInterpolation=Md;class Co extends Si{constructor(e,t,i){super(e,t,i)}}Co.prototype.ValueTypeName="bool";Co.prototype.ValueBufferType=Array;Co.prototype.DefaultInterpolation=sc;Co.prototype.InterpolantFactoryMethodLinear=void 0;Co.prototype.InterpolantFactoryMethodSmooth=void 0;class p_ extends Si{constructor(e,t,i,s){super(e,t,i,s)}}p_.prototype.ValueTypeName="color";class pc extends Si{constructor(e,t,i,s){super(e,t,i,s)}}pc.prototype.ValueTypeName="number";class BE extends Gc{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(s-t);let c=e*a;for(let u=c+a;c!==u;c+=4)Jn.slerpFlat(r,0,o,c-a,o,c,l);return r}}class Wc extends Si{constructor(e,t,i,s){super(e,t,i,s)}InterpolantFactoryMethodLinear(e){return new BE(this.times,this.values,this.getValueSize(),e)}}Wc.prototype.ValueTypeName="quaternion";Wc.prototype.InterpolantFactoryMethodSmooth=void 0;class Ro extends Si{constructor(e,t,i){super(e,t,i)}}Ro.prototype.ValueTypeName="string";Ro.prototype.ValueBufferType=Array;Ro.prototype.DefaultInterpolation=sc;Ro.prototype.InterpolantFactoryMethodLinear=void 0;Ro.prototype.InterpolantFactoryMethodSmooth=void 0;class mc extends Si{constructor(e,t,i,s){super(e,t,i,s)}}mc.prototype.ValueTypeName="vector";class gc{constructor(e="",t=-1,i=[],s=uh){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=ri(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(AI(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(Si.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const f=u[1];let d=s[f];d||(s[f]=d=[]),d.push(c)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(f,d,h,p,_){if(h.length!==0){const g=[],m=[];d_(h,g,m,p),g.length!==0&&_.push(new f(d,g,m))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{t&&t(r),this.manager.itemEnd(e)},0),r;if(ms[e]!==void 0){ms[e].push({onLoad:t,onProgress:i,onError:s});return}ms[e]=[],ms[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=ms[e],f=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=d?parseInt(d):0,p=h!==0;let _=0;const g=new ReadableStream({start(m){y();function y(){f.read().then(({done:b,value:v})=>{if(b)m.close();else{_+=v.byteLength;const T=new ProgressEvent("progress",{lengthComputable:p,loaded:_,total:h});for(let E=0,S=u.length;E{m.error(b)})}}});return new Response(g)}else throw new CI(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a==="")return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),d=f&&f[1]?f[1].toLowerCase():void 0,h=new TextDecoder(d);return c.arrayBuffer().then(p=>h.decode(p))}}}).then(c=>{ws.add(e,c);const u=ms[e];delete ms[e];for(let f=0,d=u.length;f{const u=ms[e];if(u===void 0)throw this.manager.itemError(e),c;delete ms[e];for(let f=0,d=u.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class RI extends ei{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Fs(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){s?s(l):console.error(l),r.manager.itemError(e)}},i,s)}parse(e){const t=[];for(let i=0;i0:s.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(s.uniforms[r]={},o.type){case"t":s.uniforms[r].value=i(o.value);break;case"c":s.uniforms[r].value=new Ce().setHex(o.value);break;case"v2":s.uniforms[r].value=new de().fromArray(o.value);break;case"v3":s.uniforms[r].value=new B().fromArray(o.value);break;case"v4":s.uniforms[r].value=new gt().fromArray(o.value);break;case"m3":s.uniforms[r].value=new st().fromArray(o.value);break;case"m4":s.uniforms[r].value=new Ye().fromArray(o.value);break;default:s.uniforms[r].value=o.value}}if(e.defines!==void 0&&(s.defines=e.defines),e.vertexShader!==void 0&&(s.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(s.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(s.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)s.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(s.lights=e.lights),e.clipping!==void 0&&(s.clipping=e.clipping),e.size!==void 0&&(s.size=e.size),e.sizeAttenuation!==void 0&&(s.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(s.map=i(e.map)),e.matcap!==void 0&&(s.matcap=i(e.matcap)),e.alphaMap!==void 0&&(s.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(s.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(s.bumpScale=e.bumpScale),e.normalMap!==void 0&&(s.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(s.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),s.normalScale=new de().fromArray(r)}return e.displacementMap!==void 0&&(s.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(s.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(s.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(s.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(s.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(s.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(s.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(s.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(s.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(s.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(s.envMap=i(e.envMap)),e.envMapRotation!==void 0&&s.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(s.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(s.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(s.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(s.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(s.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(s.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(s.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(s.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(s.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(s.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(s.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(s.clearcoatNormalScale=new de().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(s.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(s.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(s.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(s.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(s.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(s.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(s.sheenRoughnessMap=i(e.sheenRoughnessMap)),s}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Oh.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:wE,SpriteMaterial:Q0,RawShaderMaterial:AE,ShaderMaterial:ki,PointsMaterial:t_,MeshPhysicalMaterial:CE,MeshStandardMaterial:c_,MeshPhongMaterial:RE,MeshToonMaterial:PE,MeshNormalMaterial:IE,MeshLambertMaterial:LE,MeshDepthMaterial:u_,MeshDistanceMaterial:f_,MeshBasicMaterial:zs,MeshMatcapMaterial:DE,LineDashedMaterial:OE,LineBasicMaterial:Gn,Material:An};return new t[e]}}class vg{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class jE extends ct{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class KE extends ei{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Fs(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){s?s(l):console.error(l),r.manager.itemError(e)}},i,s)}parse(e){const t={},i={};function s(h,p){if(t[p]!==void 0)return t[p];const g=h.interleavedBuffers[p],m=r(h,g.buffer),y=oa(g.type,m),b=new _h(y,g.stride);return b.uuid=g.uuid,t[p]=b,b}function r(h,p){if(i[p]!==void 0)return i[p];const g=h.arrayBuffers[p],m=new Uint32Array(g).buffer;return i[p]=m,m}const o=e.isInstancedBufferGeometry?new jE:new ct,a=e.data.index;if(a!==void 0){const h=oa(a.type,a.array);o.setIndex(new Ct(h,1))}const l=e.data.attributes;for(const h in l){const p=l[h];let _;if(p.isInterleavedBufferAttribute){const g=s(e.data,p.data);_=new So(g,p.itemSize,p.offset,p.normalized)}else{const g=oa(p.type,p.array),m=p.isInstancedBufferAttribute?wa:Ct;_=new m(g,p.itemSize,p.normalized)}p.name!==void 0&&(_.name=p.name),p.usage!==void 0&&_.setUsage(p.usage),o.setAttribute(h,_)}const c=e.data.morphAttributes;if(c)for(const h in c){const p=c[h],_=[];for(let g=0,m=p.length;g0){const l=new m_(t);r=new _c(l),r.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){s=new _c(this.manager),s.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const g=new Vn;g.min.fromArray(_.boxMin),g.max.fromArray(_.boxMax);const m=new Tn;return m.radius=_.sphereRadius,m.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:g,sphereInitialized:_.sphereInitialized,sphere:m}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new lE;break;case"Line":o=new vr(a(e.geometry),l(e.material));break;case"LineLoop":o=new dE(a(e.geometry),l(e.material));break;case"LineSegments":o=new os(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new hE(a(e.geometry),l(e.material));break;case"Sprite":o=new aE(l(e.material));break;case"Group":o=new aa;break;case"Bone":o=new e_;break;default:o=new ht}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let h=0;h"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=ws.get(e);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),r.manager.itemEnd(e)}).catch(c=>{s&&s(c)});return}return setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){return ws.add(e,c),t&&t(c),r.manager.itemEnd(e),c}).catch(function(c){s&&s(c),ws.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});ws.add(e,l),r.manager.itemStart(e)}}let Gu;class __{static getContext(){return Gu===void 0&&(Gu=new(window.AudioContext||window.webkitAudioContext)),Gu}static setContext(e){Gu=e}}class zI extends ei{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new Fs(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);__.getContext().decodeAudioData(c,function(f){t(f)}).catch(a)}catch(c){a(c)}},i,s);function a(l){s?s(l):console.error(l),r.manager.itemError(e)}}}const jy=new Ye,Ky=new Ye,Wr=new Ye;class VI{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Wr.copy(e.projectionMatrix);const s=t.eyeSep/2,r=s*t.near/t.focus,o=t.near*Math.tan(mo*t.fov*.5)/t.zoom;let a,l;Ky.elements[12]=-s,jy.elements[12]=s,a=-o*t.aspect+r,l=o*t.aspect+r,Wr.elements[0]=2*t.near/(l-a),Wr.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Wr),a=-o*t.aspect-r,l=o*t.aspect-r,Wr.elements[0]=2*t.near/(l-a),Wr.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Wr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Ky),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(jy)}}class ZE extends Kt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e,this.index=0}}class Nh{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Zy(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Zy();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Zy(){return performance.now()}const Xr=new B,Jy=new Jn,HI=new B,$r=new B;class GI extends ht{constructor(){super(),this.type="AudioListener",this.context=__.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Nh}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Xr,Jy,HI),$r.set(0,0,-1).applyQuaternion(Jy),t.positionX){const s=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Xr.x,s),t.positionY.linearRampToValueAtTime(Xr.y,s),t.positionZ.linearRampToValueAtTime(Xr.z,s),t.forwardX.linearRampToValueAtTime($r.x,s),t.forwardY.linearRampToValueAtTime($r.y,s),t.forwardZ.linearRampToValueAtTime($r.z,s),t.upX.linearRampToValueAtTime(i.x,s),t.upY.linearRampToValueAtTime(i.y,s),t.upZ.linearRampToValueAtTime(i.z,s)}else t.setPosition(Xr.x,Xr.y,Xr.z),t.setOrientation($r.x,$r.y,$r.z,i.x,i.y,i.z)}}class JE extends ht{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(i,s,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,s=i*this._origIndex;e.getValue(t,s);for(let r=i,o=s;r!==o;++r)t[r]=t[s+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==r;++o)e[t+o]=e[i+o]}_slerp(e,t,i,s){Jn.slerpFlat(e,t,e,t,e,i,s)}_slerpAdditive(e,t,i,s,r){const o=this._workIndex*r;Jn.multiplyQuaternionsFlat(e,o,e,t,e,i),Jn.slerpFlat(e,t,e,t,e,o,s)}_lerp(e,t,i,s,r){const o=1-s;for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*s}}_lerpAdditive(e,t,i,s,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[i+o]*s}}}const v_="\\[\\]\\.:\\/",qI=new RegExp("["+v_+"]","g"),y_="[^"+v_+"]",YI="[^"+v_.replace("\\.","")+"]",jI=/((?:WC+[\/:])*)/.source.replace("WC",y_),KI=/(WCOD+)?/.source.replace("WCOD",YI),ZI=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",y_),JI=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",y_),QI=new RegExp("^"+jI+KI+ZI+JI+"$"),eL=["material","materials","bones","map"];class tL{constructor(e,t,i){const s=i||mt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class mt{constructor(e,t,i){this.path=t,this.parsedPath=i||mt.parseTrackName(t),this.node=mt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new mt.Composite(e,t,i):new mt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(qI,"")}static parseTrackName(e){const t=QI.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);eL.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(r){for(let o=0;o=r){const f=r++,d=e[f];t[d.uuid]=u,e[u]=d,t[c]=f,e[f]=l;for(let h=0,p=s;h!==p;++h){const _=i[h],g=_[f],m=_[u];_[u]=g,_[f]=m}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,s=i.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,f=t[u];if(f!==void 0)if(delete t[u],f0&&(t[h.uuid]=f),e[f]=h,e.pop();for(let p=0,_=s;p!==_;++p){const g=i[p];g[f]=g[d],g.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const i=this._bindingsIndicesByPath;let s=i[e];const r=this._bindings;if(s!==void 0)return r[s];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,f=new Array(c);s=r.length,i[e]=s,o.push(e),a.push(t),r.push(f);for(let d=u,h=l.length;d!==h;++d){const p=l[d];f[d]=new mt(p,e,t)}return f}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const s=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),r[i]=r[a],r.pop(),s[i]=s[a],s.pop()}}}class eT{constructor(e,t,i=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=s;const r=t.tracks,o=r.length,a=new Array(o),l={endingStart:ao,endingEnd:ao};for(let c=0;c!==o;++c){const u=r[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=z1,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i=!1){if(e.fadeOut(t),this.fadeIn(t),i===!0){const s=this._clip.duration,r=e._clip.duration,o=r/s,a=s/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i=!1){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const s=this._mixer,r=s.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=r,l[1]=r+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,s){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const l=(e-r)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case q0:for(let u=0,f=l.length;u!==f;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case uh:default:for(let u=0,f=l.length;u!==f;++u)l[u].evaluate(o),c[u].accumulate(s,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let s=this.time+e,r=this._loopCount;const o=i===V1;if(e===0)return r===-1?s:o&&(r&1)===1?t-s:s;if(i===B1){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),s>=t||s<0){const a=Math.floor(s/t);s-=t*a,r+=Math.abs(a);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=s;if(o&&(r&1)===1)return t-s}return s}_setEndings(e,t,i){const s=this._interpolantSettings;i?(s.endingStart=lo,s.endingEnd=lo):(e?s.endingStart=this.zeroSlopeAtStart?lo:ao:s.endingStart=rc,t?s.endingEnd=this.zeroSlopeAtEnd?lo:ao:s.endingEnd=rc)}_scheduleFading(e,t,i){const s=this._mixer,r=s.time;let o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=t,a[1]=r+e,l[1]=i,this}}const iL=new Float32Array(1);class sL extends rs{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,s=e._clip.tracks,r=s.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let f=0;f!==r;++f){const d=s[f],h=d.name;let p=u[h];if(p!==void 0)++p.referenceCount,o[f]=p;else{if(p=o[f],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,h));continue}const _=t&&t._propertyBindings[f].binding.parsedPath;p=new QE(mt.create(i,h,_),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,h),o[f]=p}a[f].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,i)}const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,s=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(s,e,r,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,nb).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ib=new B,Wu=new B;class pL{constructor(e=new B,t=new B){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ib.subVectors(e,this.start),Wu.subVectors(this.end,this.start);const i=Wu.dot(Wu);let r=Wu.dot(ib)/i;return t&&(r=tt(r,0,1)),r}closestPointToPoint(e,t,i){const s=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(s).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const sb=new B;class mL extends ht{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new ct,s=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{cb.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(cb,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class CL extends os{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],s=new ct;s.setAttribute("position",new ke(t,3)),s.setAttribute("color",new ke(i,3));const r=new Gn({vertexColors:!0,toneMapped:!1});super(s,r),this.type="AxesHelper"}setColors(e,t,i){const s=new Ce,r=this.geometry.attributes.color.array;return s.set(e),s.toArray(r,0),s.toArray(r,3),s.set(t),s.toArray(r,6),s.toArray(r,9),s.set(i),s.toArray(r,12),s.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class RL{constructor(){this.type="ShapePath",this.color=new Ce,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new uc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,s){return this.currentPath.quadraticCurveTo(e,t,i,s),this}bezierCurveTo(e,t,i,s,r,o){return this.currentPath.bezierCurveTo(e,t,i,s,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(m){const y=[];for(let b=0,v=m.length;bNumber.EPSILON){if(M<0&&(S=y[E],x=-x,P=y[T],M=-M),m.yP.y)continue;if(m.y===S.y){if(m.x===S.x)return!0}else{const L=M*(m.x-S.x)-x*(m.y-S.y);if(L===0)return!0;if(L<0)continue;v=!v}}else{if(m.y!==S.y)continue;if(P.x<=m.x&&m.x<=S.x||S.x<=m.x&&m.x<=P.x)return!0}}return v}const s=Qi.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,l;const c=[];if(r.length===1)return a=r[0],l=new go,l.curves=a.curves,c.push(l),c;let u=!s(r[0].getPoints());u=e?!u:u;const f=[],d=[];let h=[],p=0,_;d[p]=void 0,h[p]=[];for(let m=0,y=r.length;m1){let m=!1,y=0;for(let b=0,v=d.length;b0&&m===!1&&(h=f)}let g;for(let m=0,y=d.length;me?(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2):(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0),n}function LL(n,e){const t=n.image&&n.image.width?n.image.width/n.image.height:1;return t>e?(n.repeat.x=e/t,n.repeat.y=1,n.offset.x=(1-n.repeat.x)/2,n.offset.y=0):(n.repeat.x=1,n.repeat.y=t/e,n.offset.x=0,n.offset.y=(1-n.repeat.y)/2),n}function DL(n){return n.repeat.x=1,n.repeat.y=1,n.offset.x=0,n.offset.y=0,n}function bg(n,e,t,i){const s=OL(i);switch(t){case V0:return n*e;case G0:return n*e;case W0:return n*e*2;case ah:return n*e/s.components*s.byteLength;case Nc:return n*e/s.components*s.byteLength;case X0:return n*e*2/s.components*s.byteLength;case lh:return n*e*2/s.components*s.byteLength;case H0:return n*e*3/s.components*s.byteLength;case Bn:return n*e*4/s.components*s.byteLength;case ch:return n*e*4/s.components*s.byteLength;case Sl:case El:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Tl:case wl:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Zf:case Qf:return Math.max(n,16)*Math.max(e,8)/4;case Kf:case Jf:return Math.max(n,8)*Math.max(e,8)/2;case ed:case td:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case nd:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case id:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case sd:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case rd:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case od:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case ad:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case ld:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case cd:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case ud:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case fd:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case dd:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case hd:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case pd:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case md:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case gd:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Al:case _d:case vd:return Math.ceil(n/4)*Math.ceil(e/4)*16;case $0:case yd:return Math.ceil(n/4)*Math.ceil(e/4)*8;case bd:case xd:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function OL(n){switch(n){case is:case k0:return{byteLength:1,components:1};case ba:case B0:case Ua:return{byteLength:2,components:1};case rh:case oh:return{byteLength:2,components:4};case Us:case sh:case Kn:return{byteLength:4,components:1};case z0:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}class NL{static contain(e,t){return IL(e,t)}static cover(e,t){return LL(e,t)}static fill(e){return DL(e)}static getByteLength(e,t,i,s){return bg(e,t,i,s)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Dc}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Dc);/** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT - */function nT(){let n=null,e=!1,t=null,i=null;function s(r,o){t(r,o),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function NL(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,f=c.byteLength,d=n.createBuffer();n.bindBuffer(l,d),n.bufferData(l,c,u),a.onUploadCallback();let h;if(c instanceof Float32Array)h=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?h=n.HALF_FLOAT:h=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)h=n.SHORT;else if(c instanceof Uint32Array)h=n.UNSIGNED_INT;else if(c instanceof Int32Array)h=n.INT;else if(c instanceof Int8Array)h=n.BYTE;else if(c instanceof Uint8Array)h=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)h=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:h,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,l,c){const u=l.array,f=l.updateRanges;if(n.bindBuffer(c,a),f.length===0)n.bufferSubData(c,0,u);else{f.sort((h,p)=>h.start-p.start);let d=0;for(let h=1;hh.start-p.start);let d=0;for(let h=1;he in n?QA(n,e,{enumerable:!0,config : cases.z; return clamp( threshold , 1.0e-6, 1.0 ); } -#endif`,kL=`#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; #endif`,BL=`#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; +#endif`,zL=`#ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,zL=`#ifdef USE_ALPHATEST +#endif`,VL=`#ifdef USE_ALPHATEST #ifdef ALPHA_TO_COVERAGE diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); if ( diffuseColor.a == 0.0 ) discard; #else if ( diffuseColor.a < alphaTest ) discard; #endif -#endif`,VL=`#ifdef USE_ALPHATEST +#endif`,HL=`#ifdef USE_ALPHATEST uniform float alphaTest; -#endif`,HL=`#ifdef USE_AOMAP +#endif`,GL=`#ifdef USE_AOMAP float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; reflectedLight.indirectDiffuse *= ambientOcclusion; #if defined( USE_CLEARCOAT ) @@ -125,10 +125,10 @@ var QA=Object.defineProperty;var eC=(n,e,t)=>e in n?QA(n,e,{enumerable:!0,config float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); #endif -#endif`,GL=`#ifdef USE_AOMAP +#endif`,WL=`#ifdef USE_AOMAP uniform sampler2D aoMap; uniform float aoMapIntensity; -#endif`,WL=`#ifdef USE_BATCHING +#endif`,XL=`#ifdef USE_BATCHING #if ! defined( GL_ANGLE_multi_draw ) #define gl_DrawID _gl_DrawID uniform int _gl_DrawID; @@ -162,15 +162,15 @@ var QA=Object.defineProperty;var eC=(n,e,t)=>e in n?QA(n,e,{enumerable:!0,config int y = j / size; return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; } -#endif`,XL=`#ifdef USE_BATCHING +#endif`,$L=`#ifdef USE_BATCHING mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); -#endif`,$L=`vec3 transformed = vec3( position ); +#endif`,qL=`vec3 transformed = vec3( position ); #ifdef USE_ALPHAHASH vPosition = vec3( position ); -#endif`,qL=`vec3 objectNormal = vec3( normal ); +#endif`,YL=`vec3 objectNormal = vec3( normal ); #ifdef USE_TANGENT vec3 objectTangent = vec3( tangent.xyz ); -#endif`,YL=`float G_BlinnPhong_Implicit( ) { +#endif`,jL=`float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { @@ -184,7 +184,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); -} // validated`,jL=`#ifdef USE_IRIDESCENCE +} // validated`,KL=`#ifdef USE_IRIDESCENCE const mat3 XYZ_TO_REC709 = mat3( 3.2404542, -0.9692660, 0.0556434, -1.5371385, 1.8760108, -0.2040259, @@ -247,7 +247,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve } return max( I, vec3( 0.0 ) ); } -#endif`,KL=`#ifdef USE_BUMPMAP +#endif`,ZL=`#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { @@ -268,7 +268,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } -#endif`,ZL=`#if NUM_CLIPPING_PLANES > 0 +#endif`,JL=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -314,26 +314,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,JL=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,QL=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,eD=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,tD=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,tD=`#if defined( USE_COLOR_ALPHA ) +#endif`,nD=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,nD=`#if defined( USE_COLOR_ALPHA ) +#endif`,iD=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,iD=`#if defined( USE_COLOR_ALPHA ) +#endif`,sD=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; -#endif`,sD=`#if defined( USE_COLOR_ALPHA ) +#endif`,rD=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); @@ -347,7 +347,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; -#endif`,rD=`#define PI 3.141592653589793 +#endif`,oD=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -421,7 +421,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,oD=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,aD=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -514,7 +514,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,aD=`vec3 transformedNormal = objectNormal; +#endif`,lD=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -543,21 +543,21 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,lD=`#ifdef USE_DISPLACEMENTMAP +#endif`,cD=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,cD=`#ifdef USE_DISPLACEMENTMAP +#endif`,uD=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,uD=`#ifdef USE_EMISSIVEMAP +#endif`,fD=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE emissiveColor = sRGBTransferEOTF( emissiveColor ); #endif totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,fD=`#ifdef USE_EMISSIVEMAP +#endif`,dD=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,dD="gl_FragColor = linearToOutputTexel( gl_FragColor );",hD=`vec4 LinearTransferOETF( in vec4 value ) { +#endif`,hD="gl_FragColor = linearToOutputTexel( gl_FragColor );",pD=`vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferEOTF( in vec4 value ) { @@ -565,7 +565,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) { } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,pD=`#ifdef USE_ENVMAP +}`,mD=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -594,7 +594,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,mD=`#ifdef USE_ENVMAP +#endif`,gD=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; @@ -604,7 +604,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,gD=`#ifdef USE_ENVMAP +#endif`,_D=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -615,7 +615,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,_D=`#ifdef USE_ENVMAP +#endif`,vD=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -626,7 +626,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,vD=`#ifdef USE_ENVMAP +#endif`,yD=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -643,18 +643,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,yD=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; #endif`,bD=`#ifdef USE_FOG - varying float vFogDepth; + vFogDepth = - mvPosition.z; #endif`,xD=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,MD=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,MD=`#ifdef USE_FOG +#endif`,SD=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -663,7 +663,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,SD=`#ifdef USE_GRADIENTMAP +#endif`,ED=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -675,12 +675,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,ED=`#ifdef USE_LIGHTMAP +}`,TD=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,TD=`LambertMaterial material; +#endif`,wD=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,wD=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,AD=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -694,7 +694,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,AD=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,CD=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -810,7 +810,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,CD=`#ifdef USE_ENVMAP +#endif`,RD=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -843,8 +843,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,RD=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,PD=`varying vec3 vViewPosition; +#endif`,PD=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,ID=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -856,11 +856,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,ID=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,LD=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,LD=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,DD=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -877,7 +877,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,DD=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,OD=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -963,7 +963,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,OD=`struct PhysicalMaterial { +#endif`,ND=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1264,7 +1264,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,ND=` +}`,UD=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1379,7 +1379,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,UD=`#if defined( RE_IndirectDiffuse ) +#endif`,FD=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1398,32 +1398,32 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,FD=`#if defined( RE_IndirectDiffuse ) +#endif`,kD=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,kD=`#if defined( USE_LOGDEPTHBUF ) - gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,BD=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,zD=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,zD=`#ifdef USE_LOGDEPTHBUF +#endif`,VD=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; -#endif`,VD=`#ifdef USE_LOGDEPTHBUF +#endif`,HD=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,HD=`#ifdef USE_MAP +#endif`,GD=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,GD=`#ifdef USE_MAP +#endif`,WD=`#ifdef USE_MAP uniform sampler2D map; -#endif`,WD=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,XD=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1435,7 +1435,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,XD=`#if defined( USE_POINTS_UV ) +#endif`,$D=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1447,19 +1447,19 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,$D=`float metalnessFactor = metalness; +#endif`,qD=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,qD=`#ifdef USE_METALNESSMAP +#endif`,YD=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,YD=`#ifdef USE_INSTANCING_MORPH +#endif`,jD=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } -#endif`,jD=`#if defined( USE_MORPHCOLORS ) +#endif`,KD=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1468,12 +1468,12 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,KD=`#ifdef USE_MORPHNORMALS +#endif`,ZD=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } -#endif`,ZD=`#ifdef USE_MORPHTARGETS +#endif`,JD=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1487,12 +1487,12 @@ IncidentLight directLight; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,JD=`#ifdef USE_MORPHTARGETS +#endif`,QD=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } -#endif`,QD=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,eO=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1533,7 +1533,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,eO=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,tO=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1548,25 +1548,25 @@ vec3 nonPerturbedNormal = normal;`,eO=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,tO=`#ifndef FLAT_SHADED +#endif`,nO=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,nO=`#ifndef FLAT_SHADED +#endif`,iO=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,iO=`#ifndef FLAT_SHADED +#endif`,sO=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,sO=`#ifdef USE_NORMALMAP +#endif`,rO=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1588,13 +1588,13 @@ vec3 nonPerturbedNormal = normal;`,eO=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,rO=`#ifdef USE_CLEARCOAT +#endif`,oO=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,oO=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,aO=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,aO=`#ifdef USE_CLEARCOATMAP +#endif`,lO=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1603,18 +1603,18 @@ vec3 nonPerturbedNormal = normal;`,eO=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,lO=`#ifdef USE_IRIDESCENCEMAP +#endif`,cO=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,cO=`#ifdef OPAQUE +#endif`,uO=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,uO=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,fO=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1683,9 +1683,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,fO=`#ifdef PREMULTIPLIED_ALPHA +}`,dO=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,dO=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,hO=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1693,22 +1693,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,pO=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,pO=`#ifdef DITHERING +#endif`,mO=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,mO=`float roughnessFactor = roughness; +#endif`,gO=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,gO=`#ifdef USE_ROUGHNESSMAP +#endif`,_O=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,_O=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,vO=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -1894,7 +1894,7 @@ gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING } return mix( 1.0, shadow, shadowIntensity ); } -#endif`,vO=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,yO=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -1935,7 +1935,7 @@ gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,yO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,bO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -1967,7 +1967,7 @@ gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,bO=`float getShadowMask() { +#endif`,xO=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -1999,12 +1999,12 @@ gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING #endif #endif return shadow; -}`,xO=`#ifdef USE_SKINNING +}`,MO=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,MO=`#ifdef USE_SKINNING +#endif`,SO=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2019,7 +2019,7 @@ gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,SO=`#ifdef USE_SKINNING +#endif`,EO=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2027,7 +2027,7 @@ gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,EO=`#ifdef USE_SKINNING +#endif`,TO=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2038,17 +2038,17 @@ gl_Position = projectionMatrix * mvPosition;`,hO=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,TO=`float specularStrength; +#endif`,wO=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,wO=`#ifdef USE_SPECULARMAP +#endif`,AO=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,AO=`#if defined( TONE_MAPPING ) +#endif`,CO=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,CO=`#ifndef saturate +#endif`,RO=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2145,7 +2145,7 @@ vec3 NeutralToneMapping( vec3 color ) { float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,RO=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,PO=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2166,7 +2166,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,RO=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,PO=`#ifdef USE_TRANSMISSION +#endif`,IO=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2292,7 +2292,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,RO=`#ifdef USE_TRANSMISS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,IO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,LO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2362,7 +2362,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,RO=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,LO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,DO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2456,7 +2456,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,RO=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,DO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,OO=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2527,7 +2527,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,RO=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,OO=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,NO=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2536,12 +2536,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,RO=`#ifdef USE_TRANSMISS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const NO=`varying vec2 vUv; +#endif`;const UO=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,UO=`uniform sampler2D t2D; +}`,FO=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2553,14 +2553,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,FO=`varying vec3 vWorldDirection; +}`,kO=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,kO=`#ifdef ENVMAP_TYPE_CUBE +}`,BO=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2583,14 +2583,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,BO=`varying vec3 vWorldDirection; +}`,zO=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,zO=`uniform samplerCube tCube; +}`,VO=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2600,7 +2600,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,VO=`#include +}`,HO=`#include #include #include #include @@ -2627,7 +2627,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,HO=`#if DEPTH_PACKING == 3200 +}`,GO=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2661,7 +2661,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,GO=`#define DISTANCE +}`,WO=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2688,7 +2688,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,WO=`#define DISTANCE +}`,XO=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2712,13 +2712,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,XO=`varying vec3 vWorldDirection; +}`,$O=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,$O=`uniform sampler2D tEquirect; +}`,qO=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2727,7 +2727,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,qO=`uniform float scale; +}`,YO=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2749,7 +2749,7 @@ void main() { #include #include #include -}`,YO=`uniform vec3 diffuse; +}`,jO=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2777,7 +2777,7 @@ void main() { #include #include #include -}`,jO=`#include +}`,KO=`#include #include #include #include @@ -2809,7 +2809,7 @@ void main() { #include #include #include -}`,KO=`uniform vec3 diffuse; +}`,ZO=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2857,7 +2857,7 @@ void main() { #include #include #include -}`,ZO=`#define LAMBERT +}`,JO=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2896,7 +2896,7 @@ void main() { #include #include #include -}`,JO=`#define LAMBERT +}`,QO=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -2953,7 +2953,7 @@ void main() { #include #include #include -}`,QO=`#define MATCAP +}`,eN=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -2987,7 +2987,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,eN=`#define MATCAP +}`,tN=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3033,7 +3033,7 @@ void main() { #include #include #include -}`,tN=`#define NORMAL +}`,nN=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3066,7 +3066,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,nN=`#define NORMAL +}`,iN=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3088,7 +3088,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,iN=`#define PHONG +}`,sN=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3127,7 +3127,7 @@ void main() { #include #include #include -}`,sN=`#define PHONG +}`,rN=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3186,7 +3186,7 @@ void main() { #include #include #include -}`,rN=`#define STANDARD +}`,oN=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3229,7 +3229,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,oN=`#define STANDARD +}`,aN=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3354,7 +3354,7 @@ void main() { #include #include #include -}`,aN=`#define TOON +}`,lN=`#define TOON varying vec3 vViewPosition; #include #include @@ -3391,7 +3391,7 @@ void main() { #include #include #include -}`,lN=`#define TOON +}`,cN=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3444,7 +3444,7 @@ void main() { #include #include #include -}`,cN=`uniform float size; +}`,uN=`uniform float size; uniform float scale; #include #include @@ -3475,7 +3475,7 @@ void main() { #include #include #include -}`,uN=`uniform vec3 diffuse; +}`,fN=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3500,7 +3500,7 @@ void main() { #include #include #include -}`,fN=`#include +}`,dN=`#include #include #include #include @@ -3523,7 +3523,7 @@ void main() { #include #include #include -}`,dN=`uniform vec3 color; +}`,hN=`uniform vec3 color; uniform float opacity; #include #include @@ -3539,7 +3539,7 @@ void main() { #include #include #include -}`,hN=`uniform float rotation; +}`,pN=`uniform float rotation; uniform vec2 center; #include #include @@ -3563,7 +3563,7 @@ void main() { #include #include #include -}`,pN=`uniform vec3 diffuse; +}`,mN=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3588,7 +3588,7 @@ void main() { #include #include #include -}`,lt={alphahash_fragment:UL,alphahash_pars_fragment:FL,alphamap_fragment:kL,alphamap_pars_fragment:BL,alphatest_fragment:zL,alphatest_pars_fragment:VL,aomap_fragment:HL,aomap_pars_fragment:GL,batching_pars_vertex:WL,batching_vertex:XL,begin_vertex:$L,beginnormal_vertex:qL,bsdfs:YL,iridescence_fragment:jL,bumpmap_pars_fragment:KL,clipping_planes_fragment:ZL,clipping_planes_pars_fragment:JL,clipping_planes_pars_vertex:QL,clipping_planes_vertex:eD,color_fragment:tD,color_pars_fragment:nD,color_pars_vertex:iD,color_vertex:sD,common:rD,cube_uv_reflection_fragment:oD,defaultnormal_vertex:aD,displacementmap_pars_vertex:lD,displacementmap_vertex:cD,emissivemap_fragment:uD,emissivemap_pars_fragment:fD,colorspace_fragment:dD,colorspace_pars_fragment:hD,envmap_fragment:pD,envmap_common_pars_fragment:mD,envmap_pars_fragment:gD,envmap_pars_vertex:_D,envmap_physical_pars_fragment:CD,envmap_vertex:vD,fog_vertex:yD,fog_pars_vertex:bD,fog_fragment:xD,fog_pars_fragment:MD,gradientmap_pars_fragment:SD,lightmap_pars_fragment:ED,lights_lambert_fragment:TD,lights_lambert_pars_fragment:wD,lights_pars_begin:AD,lights_toon_fragment:RD,lights_toon_pars_fragment:PD,lights_phong_fragment:ID,lights_phong_pars_fragment:LD,lights_physical_fragment:DD,lights_physical_pars_fragment:OD,lights_fragment_begin:ND,lights_fragment_maps:UD,lights_fragment_end:FD,logdepthbuf_fragment:kD,logdepthbuf_pars_fragment:BD,logdepthbuf_pars_vertex:zD,logdepthbuf_vertex:VD,map_fragment:HD,map_pars_fragment:GD,map_particle_fragment:WD,map_particle_pars_fragment:XD,metalnessmap_fragment:$D,metalnessmap_pars_fragment:qD,morphinstance_vertex:YD,morphcolor_vertex:jD,morphnormal_vertex:KD,morphtarget_pars_vertex:ZD,morphtarget_vertex:JD,normal_fragment_begin:QD,normal_fragment_maps:eO,normal_pars_fragment:tO,normal_pars_vertex:nO,normal_vertex:iO,normalmap_pars_fragment:sO,clearcoat_normal_fragment_begin:rO,clearcoat_normal_fragment_maps:oO,clearcoat_pars_fragment:aO,iridescence_pars_fragment:lO,opaque_fragment:cO,packing:uO,premultiplied_alpha_fragment:fO,project_vertex:dO,dithering_fragment:hO,dithering_pars_fragment:pO,roughnessmap_fragment:mO,roughnessmap_pars_fragment:gO,shadowmap_pars_fragment:_O,shadowmap_pars_vertex:vO,shadowmap_vertex:yO,shadowmask_pars_fragment:bO,skinbase_vertex:xO,skinning_pars_vertex:MO,skinning_vertex:SO,skinnormal_vertex:EO,specularmap_fragment:TO,specularmap_pars_fragment:wO,tonemapping_fragment:AO,tonemapping_pars_fragment:CO,transmission_fragment:RO,transmission_pars_fragment:PO,uv_pars_fragment:IO,uv_pars_vertex:LO,uv_vertex:DO,worldpos_vertex:OO,background_vert:NO,background_frag:UO,backgroundCube_vert:FO,backgroundCube_frag:kO,cube_vert:BO,cube_frag:zO,depth_vert:VO,depth_frag:HO,distanceRGBA_vert:GO,distanceRGBA_frag:WO,equirect_vert:XO,equirect_frag:$O,linedashed_vert:qO,linedashed_frag:YO,meshbasic_vert:jO,meshbasic_frag:KO,meshlambert_vert:ZO,meshlambert_frag:JO,meshmatcap_vert:QO,meshmatcap_frag:eN,meshnormal_vert:tN,meshnormal_frag:nN,meshphong_vert:iN,meshphong_frag:sN,meshphysical_vert:rN,meshphysical_frag:oN,meshtoon_vert:aN,meshtoon_frag:lN,points_vert:cN,points_frag:uN,shadow_vert:fN,shadow_frag:dN,sprite_vert:hN,sprite_frag:pN},we={common:{diffuse:{value:new Ce(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new it},alphaMap:{value:null},alphaMapTransform:{value:new it},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new it}},envmap:{envMap:{value:null},envMapRotation:{value:new it},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new it}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new it}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new it},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new it},normalScale:{value:new de(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new it},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new it}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new it}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new it}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ce(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ce(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new it},alphaTest:{value:0},uvTransform:{value:new it}},sprite:{diffuse:{value:new Ce(16777215)},opacity:{value:1},center:{value:new de(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new it},alphaMap:{value:null},alphaMapTransform:{value:new it},alphaTest:{value:0}}},Pi={basic:{uniforms:In([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:lt.meshbasic_vert,fragmentShader:lt.meshbasic_frag},lambert:{uniforms:In([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new Ce(0)}}]),vertexShader:lt.meshlambert_vert,fragmentShader:lt.meshlambert_frag},phong:{uniforms:In([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new Ce(0)},specular:{value:new Ce(1118481)},shininess:{value:30}}]),vertexShader:lt.meshphong_vert,fragmentShader:lt.meshphong_frag},standard:{uniforms:In([we.common,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.roughnessmap,we.metalnessmap,we.fog,we.lights,{emissive:{value:new Ce(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lt.meshphysical_vert,fragmentShader:lt.meshphysical_frag},toon:{uniforms:In([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new Ce(0)}}]),vertexShader:lt.meshtoon_vert,fragmentShader:lt.meshtoon_frag},matcap:{uniforms:In([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:lt.meshmatcap_vert,fragmentShader:lt.meshmatcap_frag},points:{uniforms:In([we.points,we.fog]),vertexShader:lt.points_vert,fragmentShader:lt.points_frag},dashed:{uniforms:In([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lt.linedashed_vert,fragmentShader:lt.linedashed_frag},depth:{uniforms:In([we.common,we.displacementmap]),vertexShader:lt.depth_vert,fragmentShader:lt.depth_frag},normal:{uniforms:In([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:lt.meshnormal_vert,fragmentShader:lt.meshnormal_frag},sprite:{uniforms:In([we.sprite,we.fog]),vertexShader:lt.sprite_vert,fragmentShader:lt.sprite_frag},background:{uniforms:{uvTransform:{value:new it},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lt.background_vert,fragmentShader:lt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new it}},vertexShader:lt.backgroundCube_vert,fragmentShader:lt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lt.cube_vert,fragmentShader:lt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lt.equirect_vert,fragmentShader:lt.equirect_frag},distanceRGBA:{uniforms:In([we.common,we.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lt.distanceRGBA_vert,fragmentShader:lt.distanceRGBA_frag},shadow:{uniforms:In([we.lights,we.fog,{color:{value:new Ce(0)},opacity:{value:1}}]),vertexShader:lt.shadow_vert,fragmentShader:lt.shadow_frag}};Pi.physical={uniforms:In([Pi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new it},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new it},clearcoatNormalScale:{value:new de(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new it},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new it},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new it},sheen:{value:0},sheenColor:{value:new Ce(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new it},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new it},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new it},transmissionSamplerSize:{value:new de},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new it},attenuationDistance:{value:0},attenuationColor:{value:new Ce(0)},specularColor:{value:new Ce(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new it},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new it},anisotropyVector:{value:new de},anisotropyMap:{value:null},anisotropyMapTransform:{value:new it}}]),vertexShader:lt.meshphysical_vert,fragmentShader:lt.meshphysical_frag};const Ku={r:0,b:0,g:0},jr=new li,mN=new Ye;function gN(n,e,t,i,s,r,o){const a=new Ce(0);let l=r===!0?0:1,c,u,f=null,d=0,h=null;function p(b){let v=b.isScene===!0?b.background:null;return v&&v.isTexture&&(v=(b.backgroundBlurriness>0?t:e).get(v)),v}function _(b){let v=!1;const T=p(b);T===null?m(a,l):T&&T.isColor&&(m(T,1),v=!0);const E=n.xr.getEnvironmentBlendMode();E==="additive"?i.buffers.color.setClear(0,0,0,1,o):E==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||v)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(b,v){const T=p(v);T&&(T.isCubeTexture||T.mapping===Na)?(u===void 0&&(u=new $t(new Ao(1,1,1),new ki({name:"BackgroundCubeMaterial",uniforms:Ta(Pi.backgroundCube.uniforms),vertexShader:Pi.backgroundCube.vertexShader,fragmentShader:Pi.backgroundCube.fragmentShader,side:zn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(E,S,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),jr.copy(v.backgroundRotation),jr.x*=-1,jr.y*=-1,jr.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(jr.y*=-1,jr.z*=-1),u.material.uniforms.envMap.value=T,u.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(mN.makeRotationFromEuler(jr)),u.material.toneMapped=ft.getTransfer(T.colorSpace)!==wt,(f!==T||d!==T.version||h!==n.toneMapping)&&(u.material.needsUpdate=!0,f=T,d=T.version,h=n.toneMapping),u.layers.enableAll(),b.unshift(u,u.geometry,u.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new $t(new Ba(2,2),new ki({name:"BackgroundMaterial",uniforms:Ta(Pi.background.uniforms),vertexShader:Pi.background.vertexShader,fragmentShader:Pi.background.fragmentShader,side:Os,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=ft.getTransfer(T.colorSpace)!==wt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(f!==T||d!==T.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,f=T,d=T.version,h=n.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null))}function m(b,v){b.getRGB(Ku,tE(n)),i.buffers.color.setClear(Ku.r,Ku.g,Ku.b,v,o)}function y(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(b,v=1){a.set(b),l=v,m(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(b){l=b,m(a,l)},render:_,addToRenderList:g,dispose:y}}function _N(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},s=d(null);let r=s,o=!1;function a(M,L,F,H,Y){let ee=!1;const K=f(H,F,L);r!==K&&(r=K,c(r.object)),ee=h(M,H,F,Y),ee&&p(M,H,F,Y),Y!==null&&e.update(Y,n.ELEMENT_ARRAY_BUFFER),(ee||o)&&(o=!1,v(M,L,F,H),Y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(Y).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function u(M){return n.deleteVertexArray(M)}function f(M,L,F){const H=F.wireframe===!0;let Y=i[M.id];Y===void 0&&(Y={},i[M.id]=Y);let ee=Y[L.id];ee===void 0&&(ee={},Y[L.id]=ee);let K=ee[H];return K===void 0&&(K=d(l()),ee[H]=K),K}function d(M){const L=[],F=[],H=[];for(let Y=0;Y=0){const be=Y[Z];let se=ee[Z];if(se===void 0&&(Z==="instanceMatrix"&&M.instanceMatrix&&(se=M.instanceMatrix),Z==="instanceColor"&&M.instanceColor&&(se=M.instanceColor)),be===void 0||be.attribute!==se||se&&be.data!==se.data)return!0;K++}return r.attributesNum!==K||r.index!==H}function p(M,L,F,H){const Y={},ee=L.attributes;let K=0;const Q=F.getAttributes();for(const Z in Q)if(Q[Z].location>=0){let be=ee[Z];be===void 0&&(Z==="instanceMatrix"&&M.instanceMatrix&&(be=M.instanceMatrix),Z==="instanceColor"&&M.instanceColor&&(be=M.instanceColor));const se={};se.attribute=be,be&&be.data&&(se.data=be.data),Y[Z]=se,K++}r.attributes=Y,r.attributesNum=K,r.index=H}function _(){const M=r.newAttributes;for(let L=0,F=M.length;L=0){let he=Y[Q];if(he===void 0&&(Q==="instanceMatrix"&&M.instanceMatrix&&(he=M.instanceMatrix),Q==="instanceColor"&&M.instanceColor&&(he=M.instanceColor)),he!==void 0){const be=he.normalized,se=he.itemSize,ye=e.get(he);if(ye===void 0)continue;const He=ye.buffer,re=ye.type,ge=ye.bytesPerElement,xe=re===n.INT||re===n.UNSIGNED_INT||he.gpuType===sh;if(he.isInterleavedBufferAttribute){const X=he.data,ae=X.stride,fe=he.offset;if(X.isInstancedInterleavedBuffer){for(let ce=0;ce0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";S="mediump"}return S==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const f=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),m=n.getParameter(n.MAX_VERTEX_ATTRIBS),y=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),b=n.getParameter(n.MAX_VARYING_VECTORS),v=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),T=p>0,E=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:d,maxTextures:h,maxVertexTextures:p,maxTextureSize:_,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:y,maxVaryings:b,maxFragmentUniforms:v,vertexTextures:T,maxSamples:E}}function bN(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new or,a=new it,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){const h=f.length!==0||d||i!==0||s;return s=d,i=f.length,h},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(f,d){t=u(f,d,0)},this.setState=function(f,d,h){const p=f.clippingPlanes,_=f.clipIntersection,g=f.clipShadows,m=n.get(f);if(!s||p===null||p.length===0||r&&!g)r?u(null):c();else{const y=r?0:i,b=y*4;let v=m.clippingState||null;l.value=v,v=u(p,d,b,h);for(let T=0;T!==b;++T)v[T]=t[T];m.clippingState=v,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,d,h,p){const _=f!==null?f.length:0;let g=null;if(_!==0){if(g=l.value,p!==!0||g===null){const m=h+_*4,y=d.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length0){const c=new sE(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",s),t(c.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}const la=4,ub=[.125,.215,.35,.446,.526,.582],so=20,Qp=new Dh,fb=new Ce;let em=null,tm=0,nm=0,im=!1;const to=(1+Math.sqrt(5))/2,Qo=1/to,db=[new B(-to,Qo,0),new B(to,Qo,0),new B(-Qo,0,to),new B(Qo,0,to),new B(0,to,-Qo),new B(0,to,Qo),new B(-1,1,-1),new B(1,1,-1),new B(-1,1,1),new B(1,1,1)],MN=new B;class xg{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100,r={}){const{size:o=256,position:a=MN}=r;em=this._renderer.getRenderTarget(),tm=this._renderer.getActiveCubeFace(),nm=this._renderer.getActiveMipmapLevel(),im=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,s,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=mb(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=pb(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?v:0,v,v),f.setRenderTarget(s),g&&f.render(_,l),f.render(e,l)}_.geometry.dispose(),_.material.dispose(),f.toneMapping=h,f.autoClear=d,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===Ns||e.mapping===_r;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=mb()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=pb());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new $t(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;Zu(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Qp)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const s=this._lodPlanes.length;for(let r=1;rso&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${so}`);const m=[];let y=0;for(let S=0;Sb-la?s-b+la:0),E=4*(this._cubeSize-v);Zu(t,T,E,3*v,2*v),l.setRenderTarget(t),l.render(f,Qp)}}function SN(n){const e=[],t=[],i=[];let s=n;const r=n-la+1+ub.length;for(let o=0;on-la?l=ub[o-n+la-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],h=6,p=6,_=3,g=2,m=1,y=new Float32Array(_*p*h),b=new Float32Array(g*p*h),v=new Float32Array(m*p*h);for(let E=0;E2?0:-1,x=[S,P,0,S+2/3,P,0,S+2/3,P+1,0,S,P,0,S+2/3,P+1,0,S,P+1,0];y.set(x,_*p*E),b.set(d,g*p*E);const M=[E,E,E,E,E,E];v.set(M,m*p*E)}const T=new ct;T.setAttribute("position",new Ct(y,_)),T.setAttribute("uv",new Ct(b,g)),T.setAttribute("faceIndex",new Ct(v,m)),e.push(T),s>la&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function hb(n,e,t){const i=new ss(n,e,t);return i.texture.mapping=Na,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Zu(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function EN(n,e,t){const i=new Float32Array(so),s=new B(0,1,0);return new ki({name:"SphericalGaussianBlur",defines:{n:so,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:M_(),fragmentShader:` +}`,lt={alphahash_fragment:FL,alphahash_pars_fragment:kL,alphamap_fragment:BL,alphamap_pars_fragment:zL,alphatest_fragment:VL,alphatest_pars_fragment:HL,aomap_fragment:GL,aomap_pars_fragment:WL,batching_pars_vertex:XL,batching_vertex:$L,begin_vertex:qL,beginnormal_vertex:YL,bsdfs:jL,iridescence_fragment:KL,bumpmap_pars_fragment:ZL,clipping_planes_fragment:JL,clipping_planes_pars_fragment:QL,clipping_planes_pars_vertex:eD,clipping_planes_vertex:tD,color_fragment:nD,color_pars_fragment:iD,color_pars_vertex:sD,color_vertex:rD,common:oD,cube_uv_reflection_fragment:aD,defaultnormal_vertex:lD,displacementmap_pars_vertex:cD,displacementmap_vertex:uD,emissivemap_fragment:fD,emissivemap_pars_fragment:dD,colorspace_fragment:hD,colorspace_pars_fragment:pD,envmap_fragment:mD,envmap_common_pars_fragment:gD,envmap_pars_fragment:_D,envmap_pars_vertex:vD,envmap_physical_pars_fragment:RD,envmap_vertex:yD,fog_vertex:bD,fog_pars_vertex:xD,fog_fragment:MD,fog_pars_fragment:SD,gradientmap_pars_fragment:ED,lightmap_pars_fragment:TD,lights_lambert_fragment:wD,lights_lambert_pars_fragment:AD,lights_pars_begin:CD,lights_toon_fragment:PD,lights_toon_pars_fragment:ID,lights_phong_fragment:LD,lights_phong_pars_fragment:DD,lights_physical_fragment:OD,lights_physical_pars_fragment:ND,lights_fragment_begin:UD,lights_fragment_maps:FD,lights_fragment_end:kD,logdepthbuf_fragment:BD,logdepthbuf_pars_fragment:zD,logdepthbuf_pars_vertex:VD,logdepthbuf_vertex:HD,map_fragment:GD,map_pars_fragment:WD,map_particle_fragment:XD,map_particle_pars_fragment:$D,metalnessmap_fragment:qD,metalnessmap_pars_fragment:YD,morphinstance_vertex:jD,morphcolor_vertex:KD,morphnormal_vertex:ZD,morphtarget_pars_vertex:JD,morphtarget_vertex:QD,normal_fragment_begin:eO,normal_fragment_maps:tO,normal_pars_fragment:nO,normal_pars_vertex:iO,normal_vertex:sO,normalmap_pars_fragment:rO,clearcoat_normal_fragment_begin:oO,clearcoat_normal_fragment_maps:aO,clearcoat_pars_fragment:lO,iridescence_pars_fragment:cO,opaque_fragment:uO,packing:fO,premultiplied_alpha_fragment:dO,project_vertex:hO,dithering_fragment:pO,dithering_pars_fragment:mO,roughnessmap_fragment:gO,roughnessmap_pars_fragment:_O,shadowmap_pars_fragment:vO,shadowmap_pars_vertex:yO,shadowmap_vertex:bO,shadowmask_pars_fragment:xO,skinbase_vertex:MO,skinning_pars_vertex:SO,skinning_vertex:EO,skinnormal_vertex:TO,specularmap_fragment:wO,specularmap_pars_fragment:AO,tonemapping_fragment:CO,tonemapping_pars_fragment:RO,transmission_fragment:PO,transmission_pars_fragment:IO,uv_pars_fragment:LO,uv_pars_vertex:DO,uv_vertex:OO,worldpos_vertex:NO,background_vert:UO,background_frag:FO,backgroundCube_vert:kO,backgroundCube_frag:BO,cube_vert:zO,cube_frag:VO,depth_vert:HO,depth_frag:GO,distanceRGBA_vert:WO,distanceRGBA_frag:XO,equirect_vert:$O,equirect_frag:qO,linedashed_vert:YO,linedashed_frag:jO,meshbasic_vert:KO,meshbasic_frag:ZO,meshlambert_vert:JO,meshlambert_frag:QO,meshmatcap_vert:eN,meshmatcap_frag:tN,meshnormal_vert:nN,meshnormal_frag:iN,meshphong_vert:sN,meshphong_frag:rN,meshphysical_vert:oN,meshphysical_frag:aN,meshtoon_vert:lN,meshtoon_frag:cN,points_vert:uN,points_frag:fN,shadow_vert:dN,shadow_frag:hN,sprite_vert:pN,sprite_frag:mN},we={common:{diffuse:{value:new Ce(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new st},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new st}},envmap:{envMap:{value:null},envMapRotation:{value:new st},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new st}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new st}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new st},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new st},normalScale:{value:new de(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new st},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new st}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new st}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new st}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ce(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ce(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0},uvTransform:{value:new st}},sprite:{diffuse:{value:new Ce(16777215)},opacity:{value:1},center:{value:new de(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new st},alphaMap:{value:null},alphaMapTransform:{value:new st},alphaTest:{value:0}}},Ri={basic:{uniforms:In([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.fog]),vertexShader:lt.meshbasic_vert,fragmentShader:lt.meshbasic_frag},lambert:{uniforms:In([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new Ce(0)}}]),vertexShader:lt.meshlambert_vert,fragmentShader:lt.meshlambert_frag},phong:{uniforms:In([we.common,we.specularmap,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.fog,we.lights,{emissive:{value:new Ce(0)},specular:{value:new Ce(1118481)},shininess:{value:30}}]),vertexShader:lt.meshphong_vert,fragmentShader:lt.meshphong_frag},standard:{uniforms:In([we.common,we.envmap,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.roughnessmap,we.metalnessmap,we.fog,we.lights,{emissive:{value:new Ce(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lt.meshphysical_vert,fragmentShader:lt.meshphysical_frag},toon:{uniforms:In([we.common,we.aomap,we.lightmap,we.emissivemap,we.bumpmap,we.normalmap,we.displacementmap,we.gradientmap,we.fog,we.lights,{emissive:{value:new Ce(0)}}]),vertexShader:lt.meshtoon_vert,fragmentShader:lt.meshtoon_frag},matcap:{uniforms:In([we.common,we.bumpmap,we.normalmap,we.displacementmap,we.fog,{matcap:{value:null}}]),vertexShader:lt.meshmatcap_vert,fragmentShader:lt.meshmatcap_frag},points:{uniforms:In([we.points,we.fog]),vertexShader:lt.points_vert,fragmentShader:lt.points_frag},dashed:{uniforms:In([we.common,we.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lt.linedashed_vert,fragmentShader:lt.linedashed_frag},depth:{uniforms:In([we.common,we.displacementmap]),vertexShader:lt.depth_vert,fragmentShader:lt.depth_frag},normal:{uniforms:In([we.common,we.bumpmap,we.normalmap,we.displacementmap,{opacity:{value:1}}]),vertexShader:lt.meshnormal_vert,fragmentShader:lt.meshnormal_frag},sprite:{uniforms:In([we.sprite,we.fog]),vertexShader:lt.sprite_vert,fragmentShader:lt.sprite_frag},background:{uniforms:{uvTransform:{value:new st},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lt.background_vert,fragmentShader:lt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new st}},vertexShader:lt.backgroundCube_vert,fragmentShader:lt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lt.cube_vert,fragmentShader:lt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lt.equirect_vert,fragmentShader:lt.equirect_frag},distanceRGBA:{uniforms:In([we.common,we.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lt.distanceRGBA_vert,fragmentShader:lt.distanceRGBA_frag},shadow:{uniforms:In([we.lights,we.fog,{color:{value:new Ce(0)},opacity:{value:1}}]),vertexShader:lt.shadow_vert,fragmentShader:lt.shadow_frag}};Ri.physical={uniforms:In([Ri.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new st},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new st},clearcoatNormalScale:{value:new de(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new st},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new st},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new st},sheen:{value:0},sheenColor:{value:new Ce(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new st},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new st},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new st},transmissionSamplerSize:{value:new de},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new st},attenuationDistance:{value:0},attenuationColor:{value:new Ce(0)},specularColor:{value:new Ce(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new st},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new st},anisotropyVector:{value:new de},anisotropyMap:{value:null},anisotropyMapTransform:{value:new st}}]),vertexShader:lt.meshphysical_vert,fragmentShader:lt.meshphysical_frag};const Ku={r:0,b:0,g:0},jr=new li,gN=new Ye;function _N(n,e,t,i,s,r,o){const a=new Ce(0);let l=r===!0?0:1,c,u,f=null,d=0,h=null;function p(b){let v=b.isScene===!0?b.background:null;return v&&v.isTexture&&(v=(b.backgroundBlurriness>0?t:e).get(v)),v}function _(b){let v=!1;const T=p(b);T===null?m(a,l):T&&T.isColor&&(m(T,1),v=!0);const E=n.xr.getEnvironmentBlendMode();E==="additive"?i.buffers.color.setClear(0,0,0,1,o):E==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||v)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(b,v){const T=p(v);T&&(T.isCubeTexture||T.mapping===Na)?(u===void 0&&(u=new $t(new Ao(1,1,1),new ki({name:"BackgroundCubeMaterial",uniforms:Ta(Ri.backgroundCube.uniforms),vertexShader:Ri.backgroundCube.vertexShader,fragmentShader:Ri.backgroundCube.fragmentShader,side:zn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(E,S,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(u)),jr.copy(v.backgroundRotation),jr.x*=-1,jr.y*=-1,jr.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(jr.y*=-1,jr.z*=-1),u.material.uniforms.envMap.value=T,u.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(gN.makeRotationFromEuler(jr)),u.material.toneMapped=ft.getTransfer(T.colorSpace)!==wt,(f!==T||d!==T.version||h!==n.toneMapping)&&(u.material.needsUpdate=!0,f=T,d=T.version,h=n.toneMapping),u.layers.enableAll(),b.unshift(u,u.geometry,u.material,0,0,null)):T&&T.isTexture&&(c===void 0&&(c=new $t(new Ba(2,2),new ki({name:"BackgroundMaterial",uniforms:Ta(Ri.background.uniforms),vertexShader:Ri.background.vertexShader,fragmentShader:Ri.background.fragmentShader,side:Os,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(c)),c.material.uniforms.t2D.value=T,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=ft.getTransfer(T.colorSpace)!==wt,T.matrixAutoUpdate===!0&&T.updateMatrix(),c.material.uniforms.uvTransform.value.copy(T.matrix),(f!==T||d!==T.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,f=T,d=T.version,h=n.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null))}function m(b,v){b.getRGB(Ku,nE(n)),i.buffers.color.setClear(Ku.r,Ku.g,Ku.b,v,o)}function y(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(b,v=1){a.set(b),l=v,m(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(b){l=b,m(a,l)},render:_,addToRenderList:g,dispose:y}}function vN(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},s=d(null);let r=s,o=!1;function a(M,L,F,H,Y){let ee=!1;const K=f(H,F,L);r!==K&&(r=K,c(r.object)),ee=h(M,H,F,Y),ee&&p(M,H,F,Y),Y!==null&&e.update(Y,n.ELEMENT_ARRAY_BUFFER),(ee||o)&&(o=!1,v(M,L,F,H),Y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(Y).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function u(M){return n.deleteVertexArray(M)}function f(M,L,F){const H=F.wireframe===!0;let Y=i[M.id];Y===void 0&&(Y={},i[M.id]=Y);let ee=Y[L.id];ee===void 0&&(ee={},Y[L.id]=ee);let K=ee[H];return K===void 0&&(K=d(l()),ee[H]=K),K}function d(M){const L=[],F=[],H=[];for(let Y=0;Y=0){const be=Y[Z];let se=ee[Z];if(se===void 0&&(Z==="instanceMatrix"&&M.instanceMatrix&&(se=M.instanceMatrix),Z==="instanceColor"&&M.instanceColor&&(se=M.instanceColor)),be===void 0||be.attribute!==se||se&&be.data!==se.data)return!0;K++}return r.attributesNum!==K||r.index!==H}function p(M,L,F,H){const Y={},ee=L.attributes;let K=0;const Q=F.getAttributes();for(const Z in Q)if(Q[Z].location>=0){let be=ee[Z];be===void 0&&(Z==="instanceMatrix"&&M.instanceMatrix&&(be=M.instanceMatrix),Z==="instanceColor"&&M.instanceColor&&(be=M.instanceColor));const se={};se.attribute=be,be&&be.data&&(se.data=be.data),Y[Z]=se,K++}r.attributes=Y,r.attributesNum=K,r.index=H}function _(){const M=r.newAttributes;for(let L=0,F=M.length;L=0){let he=Y[Q];if(he===void 0&&(Q==="instanceMatrix"&&M.instanceMatrix&&(he=M.instanceMatrix),Q==="instanceColor"&&M.instanceColor&&(he=M.instanceColor)),he!==void 0){const be=he.normalized,se=he.itemSize,ye=e.get(he);if(ye===void 0)continue;const He=ye.buffer,re=ye.type,ge=ye.bytesPerElement,xe=re===n.INT||re===n.UNSIGNED_INT||he.gpuType===sh;if(he.isInterleavedBufferAttribute){const X=he.data,ae=X.stride,fe=he.offset;if(X.isInstancedInterleavedBuffer){for(let ce=0;ce0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";S="mediump"}return S==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const f=t.logarithmicDepthBuffer===!0,d=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),m=n.getParameter(n.MAX_VERTEX_ATTRIBS),y=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),b=n.getParameter(n.MAX_VARYING_VECTORS),v=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),T=p>0,E=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:d,maxTextures:h,maxVertexTextures:p,maxTextureSize:_,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:y,maxVaryings:b,maxFragmentUniforms:v,vertexTextures:T,maxSamples:E}}function xN(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new or,a=new st,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,d){const h=f.length!==0||d||i!==0||s;return s=d,i=f.length,h},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(f,d){t=u(f,d,0)},this.setState=function(f,d,h){const p=f.clippingPlanes,_=f.clipIntersection,g=f.clipShadows,m=n.get(f);if(!s||p===null||p.length===0||r&&!g)r?u(null):c();else{const y=r?0:i,b=y*4;let v=m.clippingState||null;l.value=v,v=u(p,d,b,h);for(let T=0;T!==b;++T)v[T]=t[T];m.clippingState=v,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,d,h,p){const _=f!==null?f.length:0;let g=null;if(_!==0){if(g=l.value,p!==!0||g===null){const m=h+_*4,y=d.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length0){const c=new rE(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",s),t(c.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}const la=4,ub=[.125,.215,.35,.446,.526,.582],so=20,Qp=new Dh,fb=new Ce;let em=null,tm=0,nm=0,im=!1;const to=(1+Math.sqrt(5))/2,Qo=1/to,db=[new B(-to,Qo,0),new B(to,Qo,0),new B(-Qo,0,to),new B(Qo,0,to),new B(0,to,-Qo),new B(0,to,Qo),new B(-1,1,-1),new B(1,1,-1),new B(-1,1,1),new B(1,1,1)],SN=new B;class xg{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100,r={}){const{size:o=256,position:a=SN}=r;em=this._renderer.getRenderTarget(),tm=this._renderer.getActiveCubeFace(),nm=this._renderer.getActiveMipmapLevel(),im=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,s,l,a),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=mb(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=pb(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?v:0,v,v),f.setRenderTarget(s),g&&f.render(_,l),f.render(e,l)}_.geometry.dispose(),_.material.dispose(),f.toneMapping=h,f.autoClear=d,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===Ns||e.mapping===_r;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=mb()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=pb());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new $t(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;Zu(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Qp)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const s=this._lodPlanes.length;for(let r=1;rso&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${so}`);const m=[];let y=0;for(let S=0;Sb-la?s-b+la:0),E=4*(this._cubeSize-v);Zu(t,T,E,3*v,2*v),l.setRenderTarget(t),l.render(f,Qp)}}function EN(n){const e=[],t=[],i=[];let s=n;const r=n-la+1+ub.length;for(let o=0;on-la?l=ub[o-n+la-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,f=1+c,d=[u,u,f,u,f,f,u,u,f,f,u,f],h=6,p=6,_=3,g=2,m=1,y=new Float32Array(_*p*h),b=new Float32Array(g*p*h),v=new Float32Array(m*p*h);for(let E=0;E2?0:-1,x=[S,P,0,S+2/3,P,0,S+2/3,P+1,0,S,P,0,S+2/3,P+1,0,S,P+1,0];y.set(x,_*p*E),b.set(d,g*p*E);const M=[E,E,E,E,E,E];v.set(M,m*p*E)}const T=new ct;T.setAttribute("position",new Ct(y,_)),T.setAttribute("uv",new Ct(b,g)),T.setAttribute("faceIndex",new Ct(v,m)),e.push(T),s>la&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function hb(n,e,t){const i=new ss(n,e,t);return i.texture.mapping=Na,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Zu(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function TN(n,e,t){const i=new Float32Array(so),s=new B(0,1,0);return new ki({name:"SphericalGaussianBlur",defines:{n:so,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:M_(),fragmentShader:` precision mediump float; precision mediump int; @@ -3738,17 +3738,17 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function TN(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===ec||l===tc,u=l===Ns||l===_r;if(c||u){let f=e.get(a);const d=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return t===null&&(t=new xg(n)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const h=a.image;return c&&h&&h.height>0||u&&h&&s(h)?(t===null&&(t=new xg(n)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",r),f.texture):null}}}return a}function s(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(T=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const E=new Float32Array(v*T*4*f),S=new Uc(E,v,T,f);S.type=Kn,S.needsUpdate=!0;const P=b*4;for(let M=0;M0)return n;const s=e*t;let r=_b[s];if(r===void 0&&(r=new Float32Array(s),_b[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function sn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t0||u&&h&&s(h)?(t===null&&(t=new xg(n)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",r),f.texture):null}}}return a}function s(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(T=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const E=new Float32Array(v*T*4*f),S=new Uc(E,v,T,f);S.type=Kn,S.needsUpdate=!0;const P=b*4;for(let M=0;M0)return n;const s=e*t;let r=_b[s];if(r===void 0&&(r=new Float32Array(s),_b[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function sn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` -`)}const Eb=new it;function TU(n){ft._getMatrix(Eb,ft.workingColorSpace,n);const e=`mat3( ${Eb.elements.map(t=>t.toFixed(4))} )`;switch(ft.getTransfer(n)){case oc:return[e,"LinearTransferOETF"];case wt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function Tb(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` +`)}const Eb=new st;function wU(n){ft._getMatrix(Eb,ft.workingColorSpace,n);const e=`mat3( ${Eb.elements.map(t=>t.toFixed(4))} )`;switch(ft.getTransfer(n)){case oc:return[e,"LinearTransferOETF"];case wt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function Tb(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` `+s+` -`+EU(n.getShaderSource(e),o)}else return s}function wU(n,e){const t=TU(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` -`)}function AU(n,e){let t;switch(e){case I1:t="Linear";break;case L1:t="Reinhard";break;case D1:t="Cineon";break;case nh:t="ACESFilmic";break;case N1:t="AgX";break;case U1:t="Neutral";break;case O1:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Ju=new B;function CU(){ft.getLuminanceCoefficients(Ju);const n=Ju.x.toFixed(4),e=Ju.y.toFixed(4),t=Ju.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` -`)}function RU(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ml).join(` -`)}function PU(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` -`)}function IU(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let s=0;s/gm;function Mg(n){return n.replace(LU,OU)}const DU=new Map;function OU(n,e){let t=lt[e];if(t===void 0){const i=DU.get(e);if(i!==void 0)t=lt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Mg(t)}const NU=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Cb(n){return n.replace(NU,UU)}function UU(n,e,t,i){let s="";for(let r=parseInt(e);r/gm;function Mg(n){return n.replace(DU,NU)}const OU=new Map;function NU(n,e){let t=lt[e];if(t===void 0){const i=OU.get(e);if(i!==void 0)t=lt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Mg(t)}const UU=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Cb(n){return n.replace(UU,FU)}function FU(n,e,t,i){let s="";for(let r=parseInt(e);r0&&(g+=` `),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(ml).join(` `),m.length>0&&(m+=` `)):(g=[Rb(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(ml).join(` -`),m=[Rb(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Zi?"#define TONE_MAPPING":"",t.toneMapping!==Zi?lt.tonemapping_pars_fragment:"",t.toneMapping!==Zi?AU("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",lt.colorspace_pars_fragment,wU("linearToOutputTexel",t.outputColorSpace),CU(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`),m=[Rb(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Zi?"#define TONE_MAPPING":"",t.toneMapping!==Zi?lt.tonemapping_pars_fragment:"",t.toneMapping!==Zi?CU("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",lt.colorspace_pars_fragment,AU("linearToOutputTexel",t.outputColorSpace),RU(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(ml).join(` `)),o=Mg(o),o=wb(o,t),o=Ab(o,t),a=Mg(a),a=wb(a,t),a=Ab(a,t),o=Cb(o),a=Cb(a),t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,g=[h,"#define attribute in","#define varying out","#define texture2D texture"].join(` @@ -3789,9 +3789,9 @@ Material Type: `+L.type+` Program Info Log: `+F+` `+Q+` -`+Z)}else F!==""?console.warn("THREE.WebGLProgram: Program Info Log:",F):(H===""||Y==="")&&(K=!1);K&&(L.diagnostics={runnable:ee,programLog:F,vertexShader:{log:H,prefix:g},fragmentShader:{log:Y,prefix:m}})}s.deleteShader(T),s.deleteShader(E),P=new Sf(s,_),x=IU(s,_)}let P;this.getUniforms=function(){return P===void 0&&S(this),P};let x;this.getAttributes=function(){return x===void 0&&S(this),x};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=s.getProgramParameter(_,MU)),M},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=SU++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=T,this.fragmentShader=E,this}let GU=0;class WU{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new XU(e),t.set(e,i)),i}}class XU{constructor(e){this.id=GU++,this.code=e,this.usedTimes=0}}function $U(n,e,t,i,s,r,o){const a=new hh,l=new WU,c=new Set,u=[],f=s.logarithmicDepthBuffer,d=s.vertexTextures;let h=s.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(x){return c.add(x),x===0?"uv":`uv${x}`}function g(x,M,L,F,H){const Y=F.fog,ee=H.geometry,K=x.isMeshStandardMaterial?F.environment:null,Q=(x.isMeshStandardMaterial?t:e).get(x.envMap||K),Z=Q&&Q.mapping===Na?Q.image.height:null,he=p[x.type];x.precision!==null&&(h=s.getMaxPrecision(x.precision),h!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",h,"instead."));const be=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,se=be!==void 0?be.length:0;let ye=0;ee.morphAttributes.position!==void 0&&(ye=1),ee.morphAttributes.normal!==void 0&&(ye=2),ee.morphAttributes.color!==void 0&&(ye=3);let He,re,ge,xe;if(he){const Tt=Pi[he];He=Tt.vertexShader,re=Tt.fragmentShader}else He=x.vertexShader,re=x.fragmentShader,l.update(x),ge=l.getVertexShaderID(x),xe=l.getFragmentShaderID(x);const X=n.getRenderTarget(),ae=n.state.buffers.depth.getReversed(),fe=H.isInstancedMesh===!0,ce=H.isBatchedMesh===!0,Ue=!!x.map,k=!!x.matcap,z=!!Q,R=!!x.aoMap,te=!!x.lightMap,G=!!x.bumpMap,W=!!x.normalMap,C=!!x.displacementMap,I=!!x.emissiveMap,N=!!x.metalnessMap,A=!!x.roughnessMap,w=x.anisotropy>0,U=x.clearcoat>0,O=x.dispersion>0,V=x.iridescence>0,$=x.sheen>0,ue=x.transmission>0,le=w&&!!x.anisotropyMap,Me=U&&!!x.clearcoatMap,Be=U&&!!x.clearcoatNormalMap,me=U&&!!x.clearcoatRoughnessMap,Te=V&&!!x.iridescenceMap,Ve=V&&!!x.iridescenceThicknessMap,We=$&&!!x.sheenColorMap,Se=$&&!!x.sheenRoughnessMap,Je=!!x.specularMap,nt=!!x.specularColorMap,Lt=!!x.specularIntensityMap,q=ue&&!!x.transmissionMap,Pe=ue&&!!x.thicknessMap,oe=!!x.gradientMap,pe=!!x.alphaMap,Le=x.alphaTest>0,Ie=!!x.alphaHash,ot=!!x.extensions;let Vt=Zi;x.toneMapped&&(X===null||X.isXRRenderTarget===!0)&&(Vt=n.toneMapping);const vn={shaderID:he,shaderType:x.type,shaderName:x.name,vertexShader:He,fragmentShader:re,defines:x.defines,customVertexShaderID:ge,customFragmentShaderID:xe,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:h,batching:ce,batchingColor:ce&&H._colorsTexture!==null,instancing:fe,instancingColor:fe&&H.instanceColor!==null,instancingMorph:fe&&H.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:X===null?n.outputColorSpace:X.isXRRenderTarget===!0?X.texture.colorSpace:Mo,alphaToCoverage:!!x.alphaToCoverage,map:Ue,matcap:k,envMap:z,envMapMode:z&&Q.mapping,envMapCubeUVHeight:Z,aoMap:R,lightMap:te,bumpMap:G,normalMap:W,displacementMap:d&&C,emissiveMap:I,normalMapObjectSpace:W&&x.normalMapType===G1,normalMapTangentSpace:W&&x.normalMapType===Tr,metalnessMap:N,roughnessMap:A,anisotropy:w,anisotropyMap:le,clearcoat:U,clearcoatMap:Me,clearcoatNormalMap:Be,clearcoatRoughnessMap:me,dispersion:O,iridescence:V,iridescenceMap:Te,iridescenceThicknessMap:Ve,sheen:$,sheenColorMap:We,sheenRoughnessMap:Se,specularMap:Je,specularColorMap:nt,specularIntensityMap:Lt,transmission:ue,transmissionMap:q,thicknessMap:Pe,gradientMap:oe,opaque:x.transparent===!1&&x.blending===po&&x.alphaToCoverage===!1,alphaMap:pe,alphaTest:Le,alphaHash:Ie,combine:x.combine,mapUv:Ue&&_(x.map.channel),aoMapUv:R&&_(x.aoMap.channel),lightMapUv:te&&_(x.lightMap.channel),bumpMapUv:G&&_(x.bumpMap.channel),normalMapUv:W&&_(x.normalMap.channel),displacementMapUv:C&&_(x.displacementMap.channel),emissiveMapUv:I&&_(x.emissiveMap.channel),metalnessMapUv:N&&_(x.metalnessMap.channel),roughnessMapUv:A&&_(x.roughnessMap.channel),anisotropyMapUv:le&&_(x.anisotropyMap.channel),clearcoatMapUv:Me&&_(x.clearcoatMap.channel),clearcoatNormalMapUv:Be&&_(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:me&&_(x.clearcoatRoughnessMap.channel),iridescenceMapUv:Te&&_(x.iridescenceMap.channel),iridescenceThicknessMapUv:Ve&&_(x.iridescenceThicknessMap.channel),sheenColorMapUv:We&&_(x.sheenColorMap.channel),sheenRoughnessMapUv:Se&&_(x.sheenRoughnessMap.channel),specularMapUv:Je&&_(x.specularMap.channel),specularColorMapUv:nt&&_(x.specularColorMap.channel),specularIntensityMapUv:Lt&&_(x.specularIntensityMap.channel),transmissionMapUv:q&&_(x.transmissionMap.channel),thicknessMapUv:Pe&&_(x.thicknessMap.channel),alphaMapUv:pe&&_(x.alphaMap.channel),vertexTangents:!!ee.attributes.tangent&&(W||w),vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!ee.attributes.uv&&(Ue||pe),fog:!!Y,useFog:x.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:x.flatShading===!0,sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:ae,skinning:H.isSkinnedMesh===!0,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:ye,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&L.length>0,shadowMapType:n.shadowMap.type,toneMapping:Vt,decodeVideoTexture:Ue&&x.map.isVideoTexture===!0&&ft.getTransfer(x.map.colorSpace)===wt,decodeVideoTextureEmissive:I&&x.emissiveMap.isVideoTexture===!0&&ft.getTransfer(x.emissiveMap.colorSpace)===wt,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===Ii,flipSided:x.side===zn,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:ot&&x.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ot&&x.extensions.multiDraw===!0||ce)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return vn.vertexUv1s=c.has(1),vn.vertexUv2s=c.has(2),vn.vertexUv3s=c.has(3),c.clear(),vn}function m(x){const M=[];if(x.shaderID?M.push(x.shaderID):(M.push(x.customVertexShaderID),M.push(x.customFragmentShaderID)),x.defines!==void 0)for(const L in x.defines)M.push(L),M.push(x.defines[L]);return x.isRawShaderMaterial===!1&&(y(M,x),b(M,x),M.push(n.outputColorSpace)),M.push(x.customProgramCacheKey),M.join()}function y(x,M){x.push(M.precision),x.push(M.outputColorSpace),x.push(M.envMapMode),x.push(M.envMapCubeUVHeight),x.push(M.mapUv),x.push(M.alphaMapUv),x.push(M.lightMapUv),x.push(M.aoMapUv),x.push(M.bumpMapUv),x.push(M.normalMapUv),x.push(M.displacementMapUv),x.push(M.emissiveMapUv),x.push(M.metalnessMapUv),x.push(M.roughnessMapUv),x.push(M.anisotropyMapUv),x.push(M.clearcoatMapUv),x.push(M.clearcoatNormalMapUv),x.push(M.clearcoatRoughnessMapUv),x.push(M.iridescenceMapUv),x.push(M.iridescenceThicknessMapUv),x.push(M.sheenColorMapUv),x.push(M.sheenRoughnessMapUv),x.push(M.specularMapUv),x.push(M.specularColorMapUv),x.push(M.specularIntensityMapUv),x.push(M.transmissionMapUv),x.push(M.thicknessMapUv),x.push(M.combine),x.push(M.fogExp2),x.push(M.sizeAttenuation),x.push(M.morphTargetsCount),x.push(M.morphAttributeCount),x.push(M.numDirLights),x.push(M.numPointLights),x.push(M.numSpotLights),x.push(M.numSpotLightMaps),x.push(M.numHemiLights),x.push(M.numRectAreaLights),x.push(M.numDirLightShadows),x.push(M.numPointLightShadows),x.push(M.numSpotLightShadows),x.push(M.numSpotLightShadowsWithMaps),x.push(M.numLightProbes),x.push(M.shadowMapType),x.push(M.toneMapping),x.push(M.numClippingPlanes),x.push(M.numClipIntersection),x.push(M.depthPacking)}function b(x,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),x.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.reverseDepthBuffer&&a.enable(4),M.skinning&&a.enable(5),M.morphTargets&&a.enable(6),M.morphNormals&&a.enable(7),M.morphColors&&a.enable(8),M.premultipliedAlpha&&a.enable(9),M.shadowMapEnabled&&a.enable(10),M.doubleSided&&a.enable(11),M.flipSided&&a.enable(12),M.useDepthPacking&&a.enable(13),M.dithering&&a.enable(14),M.transmission&&a.enable(15),M.sheen&&a.enable(16),M.opaque&&a.enable(17),M.pointsUvs&&a.enable(18),M.decodeVideoTexture&&a.enable(19),M.decodeVideoTextureEmissive&&a.enable(20),M.alphaToCoverage&&a.enable(21),x.push(a.mask)}function v(x){const M=p[x.type];let L;if(M){const F=Pi[M];L=nE.clone(F.uniforms)}else L=x.uniforms;return L}function T(x,M){let L;for(let F=0,H=u.length;F0?i.push(m):h.transparent===!0?s.push(m):t.push(m)}function l(f,d,h,p,_,g){const m=o(f,d,h,p,_,g);h.transmission>0?i.unshift(m):h.transparent===!0?s.unshift(m):t.unshift(m)}function c(f,d){t.length>1&&t.sort(f||YU),i.length>1&&i.sort(d||Pb),s.length>1&&s.sort(d||Pb)}function u(){for(let f=e,d=n.length;f=r.length?(o=new Ib,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function KU(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new B,color:new Ce};break;case"SpotLight":t={position:new B,direction:new B,color:new Ce,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new B,color:new Ce,distance:0,decay:0};break;case"HemisphereLight":t={direction:new B,skyColor:new Ce,groundColor:new Ce};break;case"RectAreaLight":t={color:new Ce,position:new B,halfWidth:new B,halfHeight:new B};break}return n[e.id]=t,t}}}function ZU(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let JU=0;function QU(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function eF(n){const e=new KU,t=ZU(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new B);const s=new B,r=new Ye,o=new Ye;function a(c){let u=0,f=0,d=0;for(let x=0;x<9;x++)i.probe[x].set(0,0,0);let h=0,p=0,_=0,g=0,m=0,y=0,b=0,v=0,T=0,E=0,S=0;c.sort(QU);for(let x=0,M=c.length;x0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=we.LTC_FLOAT_1,i.rectAreaLTC2=we.LTC_FLOAT_2):(i.rectAreaLTC1=we.LTC_HALF_1,i.rectAreaLTC2=we.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=d;const P=i.hash;(P.directionalLength!==h||P.pointLength!==p||P.spotLength!==_||P.rectAreaLength!==g||P.hemiLength!==m||P.numDirectionalShadows!==y||P.numPointShadows!==b||P.numSpotShadows!==v||P.numSpotMaps!==T||P.numLightProbes!==S)&&(i.directional.length=h,i.spot.length=_,i.rectArea.length=g,i.point.length=p,i.hemi.length=m,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=v+T-E,i.spotLightMap.length=T,i.numSpotLightShadowsWithMaps=E,i.numLightProbes=S,P.directionalLength=h,P.pointLength=p,P.spotLength=_,P.rectAreaLength=g,P.hemiLength=m,P.numDirectionalShadows=y,P.numPointShadows=b,P.numSpotShadows=v,P.numSpotMaps=T,P.numLightProbes=S,i.version=JU++)}function l(c,u){let f=0,d=0,h=0,p=0,_=0;const g=u.matrixWorldInverse;for(let m=0,y=c.length;m=o.length?(a=new Lb(n),o.push(a)):a=o[r],a}function i(){e=new WeakMap}return{get:t,dispose:i}}const nF=`void main() { +`+Z)}else F!==""?console.warn("THREE.WebGLProgram: Program Info Log:",F):(H===""||Y==="")&&(K=!1);K&&(L.diagnostics={runnable:ee,programLog:F,vertexShader:{log:H,prefix:g},fragmentShader:{log:Y,prefix:m}})}s.deleteShader(T),s.deleteShader(E),P=new Sf(s,_),x=LU(s,_)}let P;this.getUniforms=function(){return P===void 0&&S(this),P};let x;this.getAttributes=function(){return x===void 0&&S(this),x};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=s.getProgramParameter(_,SU)),M},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=EU++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=T,this.fragmentShader=E,this}let WU=0;class XU{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new $U(e),t.set(e,i)),i}}class $U{constructor(e){this.id=WU++,this.code=e,this.usedTimes=0}}function qU(n,e,t,i,s,r,o){const a=new hh,l=new XU,c=new Set,u=[],f=s.logarithmicDepthBuffer,d=s.vertexTextures;let h=s.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(x){return c.add(x),x===0?"uv":`uv${x}`}function g(x,M,L,F,H){const Y=F.fog,ee=H.geometry,K=x.isMeshStandardMaterial?F.environment:null,Q=(x.isMeshStandardMaterial?t:e).get(x.envMap||K),Z=Q&&Q.mapping===Na?Q.image.height:null,he=p[x.type];x.precision!==null&&(h=s.getMaxPrecision(x.precision),h!==x.precision&&console.warn("THREE.WebGLProgram.getParameters:",x.precision,"not supported, using",h,"instead."));const be=ee.morphAttributes.position||ee.morphAttributes.normal||ee.morphAttributes.color,se=be!==void 0?be.length:0;let ye=0;ee.morphAttributes.position!==void 0&&(ye=1),ee.morphAttributes.normal!==void 0&&(ye=2),ee.morphAttributes.color!==void 0&&(ye=3);let He,re,ge,xe;if(he){const Tt=Ri[he];He=Tt.vertexShader,re=Tt.fragmentShader}else He=x.vertexShader,re=x.fragmentShader,l.update(x),ge=l.getVertexShaderID(x),xe=l.getFragmentShaderID(x);const X=n.getRenderTarget(),ae=n.state.buffers.depth.getReversed(),fe=H.isInstancedMesh===!0,ce=H.isBatchedMesh===!0,Ue=!!x.map,k=!!x.matcap,z=!!Q,R=!!x.aoMap,te=!!x.lightMap,G=!!x.bumpMap,W=!!x.normalMap,C=!!x.displacementMap,I=!!x.emissiveMap,N=!!x.metalnessMap,A=!!x.roughnessMap,w=x.anisotropy>0,U=x.clearcoat>0,O=x.dispersion>0,V=x.iridescence>0,$=x.sheen>0,ue=x.transmission>0,le=w&&!!x.anisotropyMap,Me=U&&!!x.clearcoatMap,Be=U&&!!x.clearcoatNormalMap,me=U&&!!x.clearcoatRoughnessMap,Te=V&&!!x.iridescenceMap,Ve=V&&!!x.iridescenceThicknessMap,We=$&&!!x.sheenColorMap,Se=$&&!!x.sheenRoughnessMap,Je=!!x.specularMap,it=!!x.specularColorMap,Lt=!!x.specularIntensityMap,q=ue&&!!x.transmissionMap,Pe=ue&&!!x.thicknessMap,oe=!!x.gradientMap,pe=!!x.alphaMap,Le=x.alphaTest>0,Ie=!!x.alphaHash,ot=!!x.extensions;let Vt=Zi;x.toneMapped&&(X===null||X.isXRRenderTarget===!0)&&(Vt=n.toneMapping);const vn={shaderID:he,shaderType:x.type,shaderName:x.name,vertexShader:He,fragmentShader:re,defines:x.defines,customVertexShaderID:ge,customFragmentShaderID:xe,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:h,batching:ce,batchingColor:ce&&H._colorsTexture!==null,instancing:fe,instancingColor:fe&&H.instanceColor!==null,instancingMorph:fe&&H.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:X===null?n.outputColorSpace:X.isXRRenderTarget===!0?X.texture.colorSpace:Mo,alphaToCoverage:!!x.alphaToCoverage,map:Ue,matcap:k,envMap:z,envMapMode:z&&Q.mapping,envMapCubeUVHeight:Z,aoMap:R,lightMap:te,bumpMap:G,normalMap:W,displacementMap:d&&C,emissiveMap:I,normalMapObjectSpace:W&&x.normalMapType===W1,normalMapTangentSpace:W&&x.normalMapType===Tr,metalnessMap:N,roughnessMap:A,anisotropy:w,anisotropyMap:le,clearcoat:U,clearcoatMap:Me,clearcoatNormalMap:Be,clearcoatRoughnessMap:me,dispersion:O,iridescence:V,iridescenceMap:Te,iridescenceThicknessMap:Ve,sheen:$,sheenColorMap:We,sheenRoughnessMap:Se,specularMap:Je,specularColorMap:it,specularIntensityMap:Lt,transmission:ue,transmissionMap:q,thicknessMap:Pe,gradientMap:oe,opaque:x.transparent===!1&&x.blending===po&&x.alphaToCoverage===!1,alphaMap:pe,alphaTest:Le,alphaHash:Ie,combine:x.combine,mapUv:Ue&&_(x.map.channel),aoMapUv:R&&_(x.aoMap.channel),lightMapUv:te&&_(x.lightMap.channel),bumpMapUv:G&&_(x.bumpMap.channel),normalMapUv:W&&_(x.normalMap.channel),displacementMapUv:C&&_(x.displacementMap.channel),emissiveMapUv:I&&_(x.emissiveMap.channel),metalnessMapUv:N&&_(x.metalnessMap.channel),roughnessMapUv:A&&_(x.roughnessMap.channel),anisotropyMapUv:le&&_(x.anisotropyMap.channel),clearcoatMapUv:Me&&_(x.clearcoatMap.channel),clearcoatNormalMapUv:Be&&_(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:me&&_(x.clearcoatRoughnessMap.channel),iridescenceMapUv:Te&&_(x.iridescenceMap.channel),iridescenceThicknessMapUv:Ve&&_(x.iridescenceThicknessMap.channel),sheenColorMapUv:We&&_(x.sheenColorMap.channel),sheenRoughnessMapUv:Se&&_(x.sheenRoughnessMap.channel),specularMapUv:Je&&_(x.specularMap.channel),specularColorMapUv:it&&_(x.specularColorMap.channel),specularIntensityMapUv:Lt&&_(x.specularIntensityMap.channel),transmissionMapUv:q&&_(x.transmissionMap.channel),thicknessMapUv:Pe&&_(x.thicknessMap.channel),alphaMapUv:pe&&_(x.alphaMap.channel),vertexTangents:!!ee.attributes.tangent&&(W||w),vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!ee.attributes.color&&ee.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!ee.attributes.uv&&(Ue||pe),fog:!!Y,useFog:x.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:x.flatShading===!0,sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:ae,skinning:H.isSkinnedMesh===!0,morphTargets:ee.morphAttributes.position!==void 0,morphNormals:ee.morphAttributes.normal!==void 0,morphColors:ee.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:ye,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&L.length>0,shadowMapType:n.shadowMap.type,toneMapping:Vt,decodeVideoTexture:Ue&&x.map.isVideoTexture===!0&&ft.getTransfer(x.map.colorSpace)===wt,decodeVideoTextureEmissive:I&&x.emissiveMap.isVideoTexture===!0&&ft.getTransfer(x.emissiveMap.colorSpace)===wt,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===Pi,flipSided:x.side===zn,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:ot&&x.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ot&&x.extensions.multiDraw===!0||ce)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return vn.vertexUv1s=c.has(1),vn.vertexUv2s=c.has(2),vn.vertexUv3s=c.has(3),c.clear(),vn}function m(x){const M=[];if(x.shaderID?M.push(x.shaderID):(M.push(x.customVertexShaderID),M.push(x.customFragmentShaderID)),x.defines!==void 0)for(const L in x.defines)M.push(L),M.push(x.defines[L]);return x.isRawShaderMaterial===!1&&(y(M,x),b(M,x),M.push(n.outputColorSpace)),M.push(x.customProgramCacheKey),M.join()}function y(x,M){x.push(M.precision),x.push(M.outputColorSpace),x.push(M.envMapMode),x.push(M.envMapCubeUVHeight),x.push(M.mapUv),x.push(M.alphaMapUv),x.push(M.lightMapUv),x.push(M.aoMapUv),x.push(M.bumpMapUv),x.push(M.normalMapUv),x.push(M.displacementMapUv),x.push(M.emissiveMapUv),x.push(M.metalnessMapUv),x.push(M.roughnessMapUv),x.push(M.anisotropyMapUv),x.push(M.clearcoatMapUv),x.push(M.clearcoatNormalMapUv),x.push(M.clearcoatRoughnessMapUv),x.push(M.iridescenceMapUv),x.push(M.iridescenceThicknessMapUv),x.push(M.sheenColorMapUv),x.push(M.sheenRoughnessMapUv),x.push(M.specularMapUv),x.push(M.specularColorMapUv),x.push(M.specularIntensityMapUv),x.push(M.transmissionMapUv),x.push(M.thicknessMapUv),x.push(M.combine),x.push(M.fogExp2),x.push(M.sizeAttenuation),x.push(M.morphTargetsCount),x.push(M.morphAttributeCount),x.push(M.numDirLights),x.push(M.numPointLights),x.push(M.numSpotLights),x.push(M.numSpotLightMaps),x.push(M.numHemiLights),x.push(M.numRectAreaLights),x.push(M.numDirLightShadows),x.push(M.numPointLightShadows),x.push(M.numSpotLightShadows),x.push(M.numSpotLightShadowsWithMaps),x.push(M.numLightProbes),x.push(M.shadowMapType),x.push(M.toneMapping),x.push(M.numClippingPlanes),x.push(M.numClipIntersection),x.push(M.depthPacking)}function b(x,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),x.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.reverseDepthBuffer&&a.enable(4),M.skinning&&a.enable(5),M.morphTargets&&a.enable(6),M.morphNormals&&a.enable(7),M.morphColors&&a.enable(8),M.premultipliedAlpha&&a.enable(9),M.shadowMapEnabled&&a.enable(10),M.doubleSided&&a.enable(11),M.flipSided&&a.enable(12),M.useDepthPacking&&a.enable(13),M.dithering&&a.enable(14),M.transmission&&a.enable(15),M.sheen&&a.enable(16),M.opaque&&a.enable(17),M.pointsUvs&&a.enable(18),M.decodeVideoTexture&&a.enable(19),M.decodeVideoTextureEmissive&&a.enable(20),M.alphaToCoverage&&a.enable(21),x.push(a.mask)}function v(x){const M=p[x.type];let L;if(M){const F=Ri[M];L=iE.clone(F.uniforms)}else L=x.uniforms;return L}function T(x,M){let L;for(let F=0,H=u.length;F0?i.push(m):h.transparent===!0?s.push(m):t.push(m)}function l(f,d,h,p,_,g){const m=o(f,d,h,p,_,g);h.transmission>0?i.unshift(m):h.transparent===!0?s.unshift(m):t.unshift(m)}function c(f,d){t.length>1&&t.sort(f||jU),i.length>1&&i.sort(d||Pb),s.length>1&&s.sort(d||Pb)}function u(){for(let f=e,d=n.length;f=r.length?(o=new Ib,r.push(o)):o=r[s],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function ZU(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new B,color:new Ce};break;case"SpotLight":t={position:new B,direction:new B,color:new Ce,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new B,color:new Ce,distance:0,decay:0};break;case"HemisphereLight":t={direction:new B,skyColor:new Ce,groundColor:new Ce};break;case"RectAreaLight":t={color:new Ce,position:new B,halfWidth:new B,halfHeight:new B};break}return n[e.id]=t,t}}}function JU(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new de,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let QU=0;function eF(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function tF(n){const e=new ZU,t=JU(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new B);const s=new B,r=new Ye,o=new Ye;function a(c){let u=0,f=0,d=0;for(let x=0;x<9;x++)i.probe[x].set(0,0,0);let h=0,p=0,_=0,g=0,m=0,y=0,b=0,v=0,T=0,E=0,S=0;c.sort(eF);for(let x=0,M=c.length;x0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=we.LTC_FLOAT_1,i.rectAreaLTC2=we.LTC_FLOAT_2):(i.rectAreaLTC1=we.LTC_HALF_1,i.rectAreaLTC2=we.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=d;const P=i.hash;(P.directionalLength!==h||P.pointLength!==p||P.spotLength!==_||P.rectAreaLength!==g||P.hemiLength!==m||P.numDirectionalShadows!==y||P.numPointShadows!==b||P.numSpotShadows!==v||P.numSpotMaps!==T||P.numLightProbes!==S)&&(i.directional.length=h,i.spot.length=_,i.rectArea.length=g,i.point.length=p,i.hemi.length=m,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=v+T-E,i.spotLightMap.length=T,i.numSpotLightShadowsWithMaps=E,i.numLightProbes=S,P.directionalLength=h,P.pointLength=p,P.spotLength=_,P.rectAreaLength=g,P.hemiLength=m,P.numDirectionalShadows=y,P.numPointShadows=b,P.numSpotShadows=v,P.numSpotMaps=T,P.numLightProbes=S,i.version=QU++)}function l(c,u){let f=0,d=0,h=0,p=0,_=0;const g=u.matrixWorldInverse;for(let m=0,y=c.length;m=o.length?(a=new Lb(n),o.push(a)):a=o[r],a}function i(){e=new WeakMap}return{get:t,dispose:i}}const iF=`void main() { gl_Position = vec4( position, 1.0 ); -}`,iF=`uniform sampler2D shadow_pass; +}`,sF=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3817,12 +3817,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function sF(n,e,t){let i=new Bc;const s=new de,r=new de,o=new gt,a=new u_({depthPacking:H1}),l=new f_,c={},u=t.maxTextureSize,f={[Os]:zn,[zn]:Os,[Ii]:Ii},d=new ki({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new de},radius:{value:4}},vertexShader:nF,fragmentShader:iF}),h=d.clone();h.defines.HORIZONTAL_PASS=1;const p=new ct;p.setAttribute("position",new Ct(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new $t(p,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=N0;let m=this.type;this.render=function(E,S,P){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||E.length===0)return;const x=n.getRenderTarget(),M=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),F=n.state;F.setBlending(Ps),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const H=m!==$i&&this.type===$i,Y=m===$i&&this.type!==$i;for(let ee=0,K=E.length;eeu||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/he.x),s.x=r.x*he.x,Z.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/he.y),s.y=r.y*he.y,Z.mapSize.y=r.y)),Z.map===null||H===!0||Y===!0){const se=this.type!==$i?{minFilter:gn,magFilter:gn}:{};Z.map!==null&&Z.map.dispose(),Z.map=new ss(s.x,s.y,se),Z.map.texture.name=Q.name+".shadowMap",Z.camera.updateProjectionMatrix()}n.setRenderTarget(Z.map),n.clear();const be=Z.getViewportCount();for(let se=0;se0||S.map&&S.alphaTest>0){const F=M.uuid,H=S.uuid;let Y=c[F];Y===void 0&&(Y={},c[F]=Y);let ee=Y[H];ee===void 0&&(ee=M.clone(),Y[H]=ee,S.addEventListener("dispose",T)),M=ee}if(M.visible=S.visible,M.wireframe=S.wireframe,x===$i?M.side=S.shadowSide!==null?S.shadowSide:S.side:M.side=S.shadowSide!==null?S.shadowSide:f[S.side],M.alphaMap=S.alphaMap,M.alphaTest=S.alphaTest,M.map=S.map,M.clipShadows=S.clipShadows,M.clippingPlanes=S.clippingPlanes,M.clipIntersection=S.clipIntersection,M.displacementMap=S.displacementMap,M.displacementScale=S.displacementScale,M.displacementBias=S.displacementBias,M.wireframeLinewidth=S.wireframeLinewidth,M.linewidth=S.linewidth,P.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const F=n.properties.get(M);F.light=P}return M}function v(E,S,P,x,M){if(E.visible===!1)return;if(E.layers.test(S.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&M===$i)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,E.matrixWorld);const H=e.update(E),Y=E.material;if(Array.isArray(Y)){const ee=H.groups;for(let K=0,Q=ee.length;K=1):Z.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),K=Q>=2);let he=null,be={};const se=n.getParameter(n.SCISSOR_BOX),ye=n.getParameter(n.VIEWPORT),He=new gt().fromArray(se),re=new gt().fromArray(ye);function ge(q,Pe,oe,pe){const Le=new Uint8Array(4),Ie=n.createTexture();n.bindTexture(q,Ie),n.texParameteri(q,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(q,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ot=0;ot"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new de,u=new WeakMap;let f;const d=new WeakMap;let h=!1;try{h=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(A,w){return h?new OffscreenCanvas(A,w):cc("canvas")}function _(A,w,U){let O=1;const V=N(A);if((V.width>U||V.height>U)&&(O=U/Math.max(V.width,V.height)),O<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const $=Math.floor(O*V.width),ue=Math.floor(O*V.height);f===void 0&&(f=p($,ue));const le=w?p($,ue):f;return le.width=$,le.height=ue,le.getContext("2d").drawImage(A,0,0,$,ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+V.width+"x"+V.height+") to ("+$+"x"+ue+")."),le}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+V.width+"x"+V.height+")."),A;return A}function g(A){return A.generateMipmaps}function m(A){n.generateMipmap(A)}function y(A){return A.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:A.isWebGL3DRenderTarget?n.TEXTURE_3D:A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function b(A,w,U,O,V=!1){if(A!==null){if(n[A]!==void 0)return n[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let $=w;if(w===n.RED&&(U===n.FLOAT&&($=n.R32F),U===n.HALF_FLOAT&&($=n.R16F),U===n.UNSIGNED_BYTE&&($=n.R8)),w===n.RED_INTEGER&&(U===n.UNSIGNED_BYTE&&($=n.R8UI),U===n.UNSIGNED_SHORT&&($=n.R16UI),U===n.UNSIGNED_INT&&($=n.R32UI),U===n.BYTE&&($=n.R8I),U===n.SHORT&&($=n.R16I),U===n.INT&&($=n.R32I)),w===n.RG&&(U===n.FLOAT&&($=n.RG32F),U===n.HALF_FLOAT&&($=n.RG16F),U===n.UNSIGNED_BYTE&&($=n.RG8)),w===n.RG_INTEGER&&(U===n.UNSIGNED_BYTE&&($=n.RG8UI),U===n.UNSIGNED_SHORT&&($=n.RG16UI),U===n.UNSIGNED_INT&&($=n.RG32UI),U===n.BYTE&&($=n.RG8I),U===n.SHORT&&($=n.RG16I),U===n.INT&&($=n.RG32I)),w===n.RGB_INTEGER&&(U===n.UNSIGNED_BYTE&&($=n.RGB8UI),U===n.UNSIGNED_SHORT&&($=n.RGB16UI),U===n.UNSIGNED_INT&&($=n.RGB32UI),U===n.BYTE&&($=n.RGB8I),U===n.SHORT&&($=n.RGB16I),U===n.INT&&($=n.RGB32I)),w===n.RGBA_INTEGER&&(U===n.UNSIGNED_BYTE&&($=n.RGBA8UI),U===n.UNSIGNED_SHORT&&($=n.RGBA16UI),U===n.UNSIGNED_INT&&($=n.RGBA32UI),U===n.BYTE&&($=n.RGBA8I),U===n.SHORT&&($=n.RGBA16I),U===n.INT&&($=n.RGBA32I)),w===n.RGB&&U===n.UNSIGNED_INT_5_9_9_9_REV&&($=n.RGB9_E5),w===n.RGBA){const ue=V?oc:ft.getTransfer(O);U===n.FLOAT&&($=n.RGBA32F),U===n.HALF_FLOAT&&($=n.RGBA16F),U===n.UNSIGNED_BYTE&&($=ue===wt?n.SRGB8_ALPHA8:n.RGBA8),U===n.UNSIGNED_SHORT_4_4_4_4&&($=n.RGBA4),U===n.UNSIGNED_SHORT_5_5_5_1&&($=n.RGB5_A1)}return($===n.R16F||$===n.R32F||$===n.RG16F||$===n.RG32F||$===n.RGBA16F||$===n.RGBA32F)&&e.get("EXT_color_buffer_float"),$}function v(A,w){let U;return A?w===null||w===Us||w===xa?U=n.DEPTH24_STENCIL8:w===Kn?U=n.DEPTH32F_STENCIL8:w===ba&&(U=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):w===null||w===Us||w===xa?U=n.DEPTH_COMPONENT24:w===Kn?U=n.DEPTH_COMPONENT32F:w===ba&&(U=n.DEPTH_COMPONENT16),U}function T(A,w){return g(A)===!0||A.isFramebufferTexture&&A.minFilter!==gn&&A.minFilter!==en?Math.log2(Math.max(w.width,w.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?w.mipmaps.length:1}function E(A){const w=A.target;w.removeEventListener("dispose",E),P(w),w.isVideoTexture&&u.delete(w)}function S(A){const w=A.target;w.removeEventListener("dispose",S),M(w)}function P(A){const w=i.get(A);if(w.__webglInit===void 0)return;const U=A.source,O=d.get(U);if(O){const V=O[w.__cacheKey];V.usedTimes--,V.usedTimes===0&&x(A),Object.keys(O).length===0&&d.delete(U)}i.remove(A)}function x(A){const w=i.get(A);n.deleteTexture(w.__webglTexture);const U=A.source,O=d.get(U);delete O[w.__cacheKey],o.memory.textures--}function M(A){const w=i.get(A);if(A.depthTexture&&(A.depthTexture.dispose(),i.remove(A.depthTexture)),A.isWebGLCubeRenderTarget)for(let O=0;O<6;O++){if(Array.isArray(w.__webglFramebuffer[O]))for(let V=0;V=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+s.maxTextures),L+=1,A}function Y(A){const w=[];return w.push(A.wrapS),w.push(A.wrapT),w.push(A.wrapR||0),w.push(A.magFilter),w.push(A.minFilter),w.push(A.anisotropy),w.push(A.internalFormat),w.push(A.format),w.push(A.type),w.push(A.generateMipmaps),w.push(A.premultiplyAlpha),w.push(A.flipY),w.push(A.unpackAlignment),w.push(A.colorSpace),w.join()}function ee(A,w){const U=i.get(A);if(A.isVideoTexture&&C(A),A.isRenderTargetTexture===!1&&A.version>0&&U.__version!==A.version){const O=A.image;if(O===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(O.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{re(U,A,w);return}}t.bindTexture(n.TEXTURE_2D,U.__webglTexture,n.TEXTURE0+w)}function K(A,w){const U=i.get(A);if(A.version>0&&U.__version!==A.version){re(U,A,w);return}t.bindTexture(n.TEXTURE_2D_ARRAY,U.__webglTexture,n.TEXTURE0+w)}function Q(A,w){const U=i.get(A);if(A.version>0&&U.__version!==A.version){re(U,A,w);return}t.bindTexture(n.TEXTURE_3D,U.__webglTexture,n.TEXTURE0+w)}function Z(A,w){const U=i.get(A);if(A.version>0&&U.__version!==A.version){ge(U,A,w);return}t.bindTexture(n.TEXTURE_CUBE_MAP,U.__webglTexture,n.TEXTURE0+w)}const he={[nc]:n.REPEAT,[gi]:n.CLAMP_TO_EDGE,[ic]:n.MIRRORED_REPEAT},be={[gn]:n.NEAREST,[F0]:n.NEAREST_MIPMAP_NEAREST,[ra]:n.NEAREST_MIPMAP_LINEAR,[en]:n.LINEAR,[Ml]:n.LINEAR_MIPMAP_NEAREST,[ji]:n.LINEAR_MIPMAP_LINEAR},se={[W1]:n.NEVER,[K1]:n.ALWAYS,[X1]:n.LESS,[Y0]:n.LEQUAL,[$1]:n.EQUAL,[j1]:n.GEQUAL,[q1]:n.GREATER,[Y1]:n.NOTEQUAL};function ye(A,w){if(w.type===Kn&&e.has("OES_texture_float_linear")===!1&&(w.magFilter===en||w.magFilter===Ml||w.magFilter===ra||w.magFilter===ji||w.minFilter===en||w.minFilter===Ml||w.minFilter===ra||w.minFilter===ji)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(A,n.TEXTURE_WRAP_S,he[w.wrapS]),n.texParameteri(A,n.TEXTURE_WRAP_T,he[w.wrapT]),(A===n.TEXTURE_3D||A===n.TEXTURE_2D_ARRAY)&&n.texParameteri(A,n.TEXTURE_WRAP_R,he[w.wrapR]),n.texParameteri(A,n.TEXTURE_MAG_FILTER,be[w.magFilter]),n.texParameteri(A,n.TEXTURE_MIN_FILTER,be[w.minFilter]),w.compareFunction&&(n.texParameteri(A,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(A,n.TEXTURE_COMPARE_FUNC,se[w.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(w.magFilter===gn||w.minFilter!==ra&&w.minFilter!==ji||w.type===Kn&&e.has("OES_texture_float_linear")===!1)return;if(w.anisotropy>1||i.get(w).__currentAnisotropy){const U=e.get("EXT_texture_filter_anisotropic");n.texParameterf(A,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(w.anisotropy,s.getMaxAnisotropy())),i.get(w).__currentAnisotropy=w.anisotropy}}}function He(A,w){let U=!1;A.__webglInit===void 0&&(A.__webglInit=!0,w.addEventListener("dispose",E));const O=w.source;let V=d.get(O);V===void 0&&(V={},d.set(O,V));const $=Y(w);if($!==A.__cacheKey){V[$]===void 0&&(V[$]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,U=!0),V[$].usedTimes++;const ue=V[A.__cacheKey];ue!==void 0&&(V[A.__cacheKey].usedTimes--,ue.usedTimes===0&&x(w)),A.__cacheKey=$,A.__webglTexture=V[$].texture}return U}function re(A,w,U){let O=n.TEXTURE_2D;(w.isDataArrayTexture||w.isCompressedArrayTexture)&&(O=n.TEXTURE_2D_ARRAY),w.isData3DTexture&&(O=n.TEXTURE_3D);const V=He(A,w),$=w.source;t.bindTexture(O,A.__webglTexture,n.TEXTURE0+U);const ue=i.get($);if($.version!==ue.__version||V===!0){t.activeTexture(n.TEXTURE0+U);const le=ft.getPrimaries(ft.workingColorSpace),Me=w.colorSpace===Ss?null:ft.getPrimaries(w.colorSpace),Be=w.colorSpace===Ss||le===Me?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,w.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,w.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);let me=_(w.image,!1,s.maxTextureSize);me=I(w,me);const Te=r.convert(w.format,w.colorSpace),Ve=r.convert(w.type);let We=b(w.internalFormat,Te,Ve,w.colorSpace,w.isVideoTexture);ye(O,w);let Se;const Je=w.mipmaps,nt=w.isVideoTexture!==!0,Lt=ue.__version===void 0||V===!0,q=$.dataReady,Pe=T(w,me);if(w.isDepthTexture)We=v(w.format===Sa,w.type),Lt&&(nt?t.texStorage2D(n.TEXTURE_2D,1,We,me.width,me.height):t.texImage2D(n.TEXTURE_2D,0,We,me.width,me.height,0,Te,Ve,null));else if(w.isDataTexture)if(Je.length>0){nt&&Lt&&t.texStorage2D(n.TEXTURE_2D,Pe,We,Je[0].width,Je[0].height);for(let oe=0,pe=Je.length;oe0){const Le=bg(Se.width,Se.height,w.format,w.type);for(const Ie of w.layerUpdates){const ot=Se.data.subarray(Ie*Le/Se.data.BYTES_PER_ELEMENT,(Ie+1)*Le/Se.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,Ie,Se.width,Se.height,1,Te,ot)}w.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,0,Se.width,Se.height,me.depth,Te,Se.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,oe,We,Se.width,Se.height,me.depth,0,Se.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else nt?q&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,0,Se.width,Se.height,me.depth,Te,Ve,Se.data):t.texImage3D(n.TEXTURE_2D_ARRAY,oe,We,Se.width,Se.height,me.depth,0,Te,Ve,Se.data)}else{nt&&Lt&&t.texStorage2D(n.TEXTURE_2D,Pe,We,Je[0].width,Je[0].height);for(let oe=0,pe=Je.length;oe0){const oe=bg(me.width,me.height,w.format,w.type);for(const pe of w.layerUpdates){const Le=me.data.subarray(pe*oe/me.data.BYTES_PER_ELEMENT,(pe+1)*oe/me.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,pe,me.width,me.height,1,Te,Ve,Le)}w.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,me.width,me.height,me.depth,Te,Ve,me.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,We,me.width,me.height,me.depth,0,Te,Ve,me.data);else if(w.isData3DTexture)nt?(Lt&&t.texStorage3D(n.TEXTURE_3D,Pe,We,me.width,me.height,me.depth),q&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,me.width,me.height,me.depth,Te,Ve,me.data)):t.texImage3D(n.TEXTURE_3D,0,We,me.width,me.height,me.depth,0,Te,Ve,me.data);else if(w.isFramebufferTexture){if(Lt)if(nt)t.texStorage2D(n.TEXTURE_2D,Pe,We,me.width,me.height);else{let oe=me.width,pe=me.height;for(let Le=0;Le>=1,pe>>=1}}else if(Je.length>0){if(nt&&Lt){const oe=N(Je[0]);t.texStorage2D(n.TEXTURE_2D,Pe,We,oe.width,oe.height)}for(let oe=0,pe=Je.length;oe0&&Pe++;const pe=N(Te[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Pe,Je,pe.width,pe.height)}for(let pe=0;pe<6;pe++)if(me){nt?q&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,0,0,Te[pe].width,Te[pe].height,We,Se,Te[pe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,Je,Te[pe].width,Te[pe].height,0,We,Se,Te[pe].data);for(let Le=0;Le>$),Ve=Math.max(1,w.height>>$);V===n.TEXTURE_3D||V===n.TEXTURE_2D_ARRAY?t.texImage3D(V,$,Me,Te,Ve,w.depth,0,ue,le,null):t.texImage2D(V,$,Me,Te,Ve,0,ue,le,null)}t.bindFramebuffer(n.FRAMEBUFFER,A),W(w)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,O,V,me.__webglTexture,0,G(w)):(V===n.TEXTURE_2D||V>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&V<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,O,V,me.__webglTexture,$),t.bindFramebuffer(n.FRAMEBUFFER,null)}function X(A,w,U){if(n.bindRenderbuffer(n.RENDERBUFFER,A),w.depthBuffer){const O=w.depthTexture,V=O&&O.isDepthTexture?O.type:null,$=v(w.stencilBuffer,V),ue=w.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,le=G(w);W(w)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,le,$,w.width,w.height):U?n.renderbufferStorageMultisample(n.RENDERBUFFER,le,$,w.width,w.height):n.renderbufferStorage(n.RENDERBUFFER,$,w.width,w.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,A)}else{const O=w.textures;for(let V=0;V{delete w.__boundDepthTexture,delete w.__depthDisposeCallback,O.removeEventListener("dispose",V)};O.addEventListener("dispose",V),w.__depthDisposeCallback=V}w.__boundDepthTexture=O}if(A.depthTexture&&!w.__autoAllocateDepthBuffer){if(U)throw new Error("target.depthTexture not supported in Cube render targets");ae(w.__webglFramebuffer,A)}else if(U){w.__webglDepthbuffer=[];for(let O=0;O<6;O++)if(t.bindFramebuffer(n.FRAMEBUFFER,w.__webglFramebuffer[O]),w.__webglDepthbuffer[O]===void 0)w.__webglDepthbuffer[O]=n.createRenderbuffer(),X(w.__webglDepthbuffer[O],A,!1);else{const V=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,$=w.__webglDepthbuffer[O];n.bindRenderbuffer(n.RENDERBUFFER,$),n.framebufferRenderbuffer(n.FRAMEBUFFER,V,n.RENDERBUFFER,$)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,w.__webglFramebuffer),w.__webglDepthbuffer===void 0)w.__webglDepthbuffer=n.createRenderbuffer(),X(w.__webglDepthbuffer,A,!1);else{const O=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,V=w.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,V),n.framebufferRenderbuffer(n.FRAMEBUFFER,O,n.RENDERBUFFER,V)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ce(A,w,U){const O=i.get(A);w!==void 0&&xe(O.__webglFramebuffer,A,A.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),U!==void 0&&fe(A)}function Ue(A){const w=A.texture,U=i.get(A),O=i.get(w);A.addEventListener("dispose",S);const V=A.textures,$=A.isWebGLCubeRenderTarget===!0,ue=V.length>1;if(ue||(O.__webglTexture===void 0&&(O.__webglTexture=n.createTexture()),O.__version=w.version,o.memory.textures++),$){U.__webglFramebuffer=[];for(let le=0;le<6;le++)if(w.mipmaps&&w.mipmaps.length>0){U.__webglFramebuffer[le]=[];for(let Me=0;Me0){U.__webglFramebuffer=[];for(let le=0;le0&&W(A)===!1){U.__webglMultisampledFramebuffer=n.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let le=0;le0)for(let Me=0;Me0)for(let Me=0;Me0){if(W(A)===!1){const w=A.textures,U=A.width,O=A.height;let V=n.COLOR_BUFFER_BIT;const $=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ue=i.get(A),le=w.length>1;if(le)for(let Me=0;Me0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&w.__useRenderToTexture!==!1}function C(A){const w=o.render.frame;u.get(A)!==w&&(u.set(A,w),A.update())}function I(A,w){const U=A.colorSpace,O=A.format,V=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||U!==Mo&&U!==Ss&&(ft.getTransfer(U)===wt?(O!==Bn||V!==is)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",U)),w}function N(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(c.width=A.naturalWidth||A.width,c.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(c.width=A.displayWidth,c.height=A.displayHeight):(c.width=A.width,c.height=A.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=F,this.setTexture2D=ee,this.setTexture2DArray=K,this.setTexture3D=Q,this.setTextureCube=Z,this.rebindTextures=ce,this.setupRenderTarget=Ue,this.updateRenderTargetMipmap=k,this.updateMultisampleRenderTarget=te,this.setupDepthRenderbuffer=fe,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=W}function aT(n,e){function t(i,s=Ss){let r;const o=ft.getTransfer(s);if(i===is)return n.UNSIGNED_BYTE;if(i===rh)return n.UNSIGNED_SHORT_4_4_4_4;if(i===oh)return n.UNSIGNED_SHORT_5_5_5_1;if(i===z0)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===k0)return n.BYTE;if(i===B0)return n.SHORT;if(i===ba)return n.UNSIGNED_SHORT;if(i===sh)return n.INT;if(i===Us)return n.UNSIGNED_INT;if(i===Kn)return n.FLOAT;if(i===Ua)return n.HALF_FLOAT;if(i===V0)return n.ALPHA;if(i===H0)return n.RGB;if(i===Bn)return n.RGBA;if(i===G0)return n.LUMINANCE;if(i===W0)return n.LUMINANCE_ALPHA;if(i===Ma)return n.DEPTH_COMPONENT;if(i===Sa)return n.DEPTH_STENCIL;if(i===ah)return n.RED;if(i===Nc)return n.RED_INTEGER;if(i===X0)return n.RG;if(i===lh)return n.RG_INTEGER;if(i===ch)return n.RGBA_INTEGER;if(i===Sl||i===El||i===Tl||i===wl)if(o===wt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===Sl)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===El)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Tl)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===wl)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===Sl)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===El)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Tl)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===wl)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Kf||i===Zf||i===Jf||i===Qf)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===Kf)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Zf)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Jf)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Qf)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===ed||i===td||i===nd)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(i===ed||i===td)return o===wt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===nd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===id||i===sd||i===rd||i===od||i===ad||i===ld||i===cd||i===ud||i===fd||i===dd||i===hd||i===pd||i===md||i===gd)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(i===id)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===sd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===rd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===od)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===ad)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ld)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===cd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===ud)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===fd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===dd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===hd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===pd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===md)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===gd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Al||i===_d||i===vd)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(i===Al)return o===wt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===_d)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===vd)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===$0||i===yd||i===bd||i===xd)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(i===Al)return r.COMPRESSED_RED_RGTC1_EXT;if(i===yd)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===bd)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===xd)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===xa?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const lF=` +}`;function rF(n,e,t){let i=new Bc;const s=new de,r=new de,o=new gt,a=new u_({depthPacking:G1}),l=new f_,c={},u=t.maxTextureSize,f={[Os]:zn,[zn]:Os,[Pi]:Pi},d=new ki({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new de},radius:{value:4}},vertexShader:iF,fragmentShader:sF}),h=d.clone();h.defines.HORIZONTAL_PASS=1;const p=new ct;p.setAttribute("position",new Ct(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new $t(p,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=N0;let m=this.type;this.render=function(E,S,P){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||E.length===0)return;const x=n.getRenderTarget(),M=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),F=n.state;F.setBlending(Ps),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const H=m!==$i&&this.type===$i,Y=m===$i&&this.type!==$i;for(let ee=0,K=E.length;eeu||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/he.x),s.x=r.x*he.x,Z.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/he.y),s.y=r.y*he.y,Z.mapSize.y=r.y)),Z.map===null||H===!0||Y===!0){const se=this.type!==$i?{minFilter:gn,magFilter:gn}:{};Z.map!==null&&Z.map.dispose(),Z.map=new ss(s.x,s.y,se),Z.map.texture.name=Q.name+".shadowMap",Z.camera.updateProjectionMatrix()}n.setRenderTarget(Z.map),n.clear();const be=Z.getViewportCount();for(let se=0;se0||S.map&&S.alphaTest>0){const F=M.uuid,H=S.uuid;let Y=c[F];Y===void 0&&(Y={},c[F]=Y);let ee=Y[H];ee===void 0&&(ee=M.clone(),Y[H]=ee,S.addEventListener("dispose",T)),M=ee}if(M.visible=S.visible,M.wireframe=S.wireframe,x===$i?M.side=S.shadowSide!==null?S.shadowSide:S.side:M.side=S.shadowSide!==null?S.shadowSide:f[S.side],M.alphaMap=S.alphaMap,M.alphaTest=S.alphaTest,M.map=S.map,M.clipShadows=S.clipShadows,M.clippingPlanes=S.clippingPlanes,M.clipIntersection=S.clipIntersection,M.displacementMap=S.displacementMap,M.displacementScale=S.displacementScale,M.displacementBias=S.displacementBias,M.wireframeLinewidth=S.wireframeLinewidth,M.linewidth=S.linewidth,P.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const F=n.properties.get(M);F.light=P}return M}function v(E,S,P,x,M){if(E.visible===!1)return;if(E.layers.test(S.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&M===$i)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,E.matrixWorld);const H=e.update(E),Y=E.material;if(Array.isArray(Y)){const ee=H.groups;for(let K=0,Q=ee.length;K=1):Z.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(Z)[1]),K=Q>=2);let he=null,be={};const se=n.getParameter(n.SCISSOR_BOX),ye=n.getParameter(n.VIEWPORT),He=new gt().fromArray(se),re=new gt().fromArray(ye);function ge(q,Pe,oe,pe){const Le=new Uint8Array(4),Ie=n.createTexture();n.bindTexture(q,Ie),n.texParameteri(q,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(q,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ot=0;ot"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new de,u=new WeakMap;let f;const d=new WeakMap;let h=!1;try{h=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(A,w){return h?new OffscreenCanvas(A,w):cc("canvas")}function _(A,w,U){let O=1;const V=N(A);if((V.width>U||V.height>U)&&(O=U/Math.max(V.width,V.height)),O<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){const $=Math.floor(O*V.width),ue=Math.floor(O*V.height);f===void 0&&(f=p($,ue));const le=w?p($,ue):f;return le.width=$,le.height=ue,le.getContext("2d").drawImage(A,0,0,$,ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+V.width+"x"+V.height+") to ("+$+"x"+ue+")."),le}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+V.width+"x"+V.height+")."),A;return A}function g(A){return A.generateMipmaps}function m(A){n.generateMipmap(A)}function y(A){return A.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:A.isWebGL3DRenderTarget?n.TEXTURE_3D:A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function b(A,w,U,O,V=!1){if(A!==null){if(n[A]!==void 0)return n[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let $=w;if(w===n.RED&&(U===n.FLOAT&&($=n.R32F),U===n.HALF_FLOAT&&($=n.R16F),U===n.UNSIGNED_BYTE&&($=n.R8)),w===n.RED_INTEGER&&(U===n.UNSIGNED_BYTE&&($=n.R8UI),U===n.UNSIGNED_SHORT&&($=n.R16UI),U===n.UNSIGNED_INT&&($=n.R32UI),U===n.BYTE&&($=n.R8I),U===n.SHORT&&($=n.R16I),U===n.INT&&($=n.R32I)),w===n.RG&&(U===n.FLOAT&&($=n.RG32F),U===n.HALF_FLOAT&&($=n.RG16F),U===n.UNSIGNED_BYTE&&($=n.RG8)),w===n.RG_INTEGER&&(U===n.UNSIGNED_BYTE&&($=n.RG8UI),U===n.UNSIGNED_SHORT&&($=n.RG16UI),U===n.UNSIGNED_INT&&($=n.RG32UI),U===n.BYTE&&($=n.RG8I),U===n.SHORT&&($=n.RG16I),U===n.INT&&($=n.RG32I)),w===n.RGB_INTEGER&&(U===n.UNSIGNED_BYTE&&($=n.RGB8UI),U===n.UNSIGNED_SHORT&&($=n.RGB16UI),U===n.UNSIGNED_INT&&($=n.RGB32UI),U===n.BYTE&&($=n.RGB8I),U===n.SHORT&&($=n.RGB16I),U===n.INT&&($=n.RGB32I)),w===n.RGBA_INTEGER&&(U===n.UNSIGNED_BYTE&&($=n.RGBA8UI),U===n.UNSIGNED_SHORT&&($=n.RGBA16UI),U===n.UNSIGNED_INT&&($=n.RGBA32UI),U===n.BYTE&&($=n.RGBA8I),U===n.SHORT&&($=n.RGBA16I),U===n.INT&&($=n.RGBA32I)),w===n.RGB&&U===n.UNSIGNED_INT_5_9_9_9_REV&&($=n.RGB9_E5),w===n.RGBA){const ue=V?oc:ft.getTransfer(O);U===n.FLOAT&&($=n.RGBA32F),U===n.HALF_FLOAT&&($=n.RGBA16F),U===n.UNSIGNED_BYTE&&($=ue===wt?n.SRGB8_ALPHA8:n.RGBA8),U===n.UNSIGNED_SHORT_4_4_4_4&&($=n.RGBA4),U===n.UNSIGNED_SHORT_5_5_5_1&&($=n.RGB5_A1)}return($===n.R16F||$===n.R32F||$===n.RG16F||$===n.RG32F||$===n.RGBA16F||$===n.RGBA32F)&&e.get("EXT_color_buffer_float"),$}function v(A,w){let U;return A?w===null||w===Us||w===xa?U=n.DEPTH24_STENCIL8:w===Kn?U=n.DEPTH32F_STENCIL8:w===ba&&(U=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):w===null||w===Us||w===xa?U=n.DEPTH_COMPONENT24:w===Kn?U=n.DEPTH_COMPONENT32F:w===ba&&(U=n.DEPTH_COMPONENT16),U}function T(A,w){return g(A)===!0||A.isFramebufferTexture&&A.minFilter!==gn&&A.minFilter!==en?Math.log2(Math.max(w.width,w.height))+1:A.mipmaps!==void 0&&A.mipmaps.length>0?A.mipmaps.length:A.isCompressedTexture&&Array.isArray(A.image)?w.mipmaps.length:1}function E(A){const w=A.target;w.removeEventListener("dispose",E),P(w),w.isVideoTexture&&u.delete(w)}function S(A){const w=A.target;w.removeEventListener("dispose",S),M(w)}function P(A){const w=i.get(A);if(w.__webglInit===void 0)return;const U=A.source,O=d.get(U);if(O){const V=O[w.__cacheKey];V.usedTimes--,V.usedTimes===0&&x(A),Object.keys(O).length===0&&d.delete(U)}i.remove(A)}function x(A){const w=i.get(A);n.deleteTexture(w.__webglTexture);const U=A.source,O=d.get(U);delete O[w.__cacheKey],o.memory.textures--}function M(A){const w=i.get(A);if(A.depthTexture&&(A.depthTexture.dispose(),i.remove(A.depthTexture)),A.isWebGLCubeRenderTarget)for(let O=0;O<6;O++){if(Array.isArray(w.__webglFramebuffer[O]))for(let V=0;V=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+s.maxTextures),L+=1,A}function Y(A){const w=[];return w.push(A.wrapS),w.push(A.wrapT),w.push(A.wrapR||0),w.push(A.magFilter),w.push(A.minFilter),w.push(A.anisotropy),w.push(A.internalFormat),w.push(A.format),w.push(A.type),w.push(A.generateMipmaps),w.push(A.premultiplyAlpha),w.push(A.flipY),w.push(A.unpackAlignment),w.push(A.colorSpace),w.join()}function ee(A,w){const U=i.get(A);if(A.isVideoTexture&&C(A),A.isRenderTargetTexture===!1&&A.version>0&&U.__version!==A.version){const O=A.image;if(O===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(O.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{re(U,A,w);return}}t.bindTexture(n.TEXTURE_2D,U.__webglTexture,n.TEXTURE0+w)}function K(A,w){const U=i.get(A);if(A.version>0&&U.__version!==A.version){re(U,A,w);return}t.bindTexture(n.TEXTURE_2D_ARRAY,U.__webglTexture,n.TEXTURE0+w)}function Q(A,w){const U=i.get(A);if(A.version>0&&U.__version!==A.version){re(U,A,w);return}t.bindTexture(n.TEXTURE_3D,U.__webglTexture,n.TEXTURE0+w)}function Z(A,w){const U=i.get(A);if(A.version>0&&U.__version!==A.version){ge(U,A,w);return}t.bindTexture(n.TEXTURE_CUBE_MAP,U.__webglTexture,n.TEXTURE0+w)}const he={[nc]:n.REPEAT,[gi]:n.CLAMP_TO_EDGE,[ic]:n.MIRRORED_REPEAT},be={[gn]:n.NEAREST,[F0]:n.NEAREST_MIPMAP_NEAREST,[ra]:n.NEAREST_MIPMAP_LINEAR,[en]:n.LINEAR,[Ml]:n.LINEAR_MIPMAP_NEAREST,[ji]:n.LINEAR_MIPMAP_LINEAR},se={[X1]:n.NEVER,[Z1]:n.ALWAYS,[$1]:n.LESS,[Y0]:n.LEQUAL,[q1]:n.EQUAL,[K1]:n.GEQUAL,[Y1]:n.GREATER,[j1]:n.NOTEQUAL};function ye(A,w){if(w.type===Kn&&e.has("OES_texture_float_linear")===!1&&(w.magFilter===en||w.magFilter===Ml||w.magFilter===ra||w.magFilter===ji||w.minFilter===en||w.minFilter===Ml||w.minFilter===ra||w.minFilter===ji)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(A,n.TEXTURE_WRAP_S,he[w.wrapS]),n.texParameteri(A,n.TEXTURE_WRAP_T,he[w.wrapT]),(A===n.TEXTURE_3D||A===n.TEXTURE_2D_ARRAY)&&n.texParameteri(A,n.TEXTURE_WRAP_R,he[w.wrapR]),n.texParameteri(A,n.TEXTURE_MAG_FILTER,be[w.magFilter]),n.texParameteri(A,n.TEXTURE_MIN_FILTER,be[w.minFilter]),w.compareFunction&&(n.texParameteri(A,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(A,n.TEXTURE_COMPARE_FUNC,se[w.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(w.magFilter===gn||w.minFilter!==ra&&w.minFilter!==ji||w.type===Kn&&e.has("OES_texture_float_linear")===!1)return;if(w.anisotropy>1||i.get(w).__currentAnisotropy){const U=e.get("EXT_texture_filter_anisotropic");n.texParameterf(A,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(w.anisotropy,s.getMaxAnisotropy())),i.get(w).__currentAnisotropy=w.anisotropy}}}function He(A,w){let U=!1;A.__webglInit===void 0&&(A.__webglInit=!0,w.addEventListener("dispose",E));const O=w.source;let V=d.get(O);V===void 0&&(V={},d.set(O,V));const $=Y(w);if($!==A.__cacheKey){V[$]===void 0&&(V[$]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,U=!0),V[$].usedTimes++;const ue=V[A.__cacheKey];ue!==void 0&&(V[A.__cacheKey].usedTimes--,ue.usedTimes===0&&x(w)),A.__cacheKey=$,A.__webglTexture=V[$].texture}return U}function re(A,w,U){let O=n.TEXTURE_2D;(w.isDataArrayTexture||w.isCompressedArrayTexture)&&(O=n.TEXTURE_2D_ARRAY),w.isData3DTexture&&(O=n.TEXTURE_3D);const V=He(A,w),$=w.source;t.bindTexture(O,A.__webglTexture,n.TEXTURE0+U);const ue=i.get($);if($.version!==ue.__version||V===!0){t.activeTexture(n.TEXTURE0+U);const le=ft.getPrimaries(ft.workingColorSpace),Me=w.colorSpace===Ss?null:ft.getPrimaries(w.colorSpace),Be=w.colorSpace===Ss||le===Me?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,w.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,w.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,w.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);let me=_(w.image,!1,s.maxTextureSize);me=I(w,me);const Te=r.convert(w.format,w.colorSpace),Ve=r.convert(w.type);let We=b(w.internalFormat,Te,Ve,w.colorSpace,w.isVideoTexture);ye(O,w);let Se;const Je=w.mipmaps,it=w.isVideoTexture!==!0,Lt=ue.__version===void 0||V===!0,q=$.dataReady,Pe=T(w,me);if(w.isDepthTexture)We=v(w.format===Sa,w.type),Lt&&(it?t.texStorage2D(n.TEXTURE_2D,1,We,me.width,me.height):t.texImage2D(n.TEXTURE_2D,0,We,me.width,me.height,0,Te,Ve,null));else if(w.isDataTexture)if(Je.length>0){it&&Lt&&t.texStorage2D(n.TEXTURE_2D,Pe,We,Je[0].width,Je[0].height);for(let oe=0,pe=Je.length;oe0){const Le=bg(Se.width,Se.height,w.format,w.type);for(const Ie of w.layerUpdates){const ot=Se.data.subarray(Ie*Le/Se.data.BYTES_PER_ELEMENT,(Ie+1)*Le/Se.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,Ie,Se.width,Se.height,1,Te,ot)}w.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,0,Se.width,Se.height,me.depth,Te,Se.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,oe,We,Se.width,Se.height,me.depth,0,Se.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else it?q&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,oe,0,0,0,Se.width,Se.height,me.depth,Te,Ve,Se.data):t.texImage3D(n.TEXTURE_2D_ARRAY,oe,We,Se.width,Se.height,me.depth,0,Te,Ve,Se.data)}else{it&&Lt&&t.texStorage2D(n.TEXTURE_2D,Pe,We,Je[0].width,Je[0].height);for(let oe=0,pe=Je.length;oe0){const oe=bg(me.width,me.height,w.format,w.type);for(const pe of w.layerUpdates){const Le=me.data.subarray(pe*oe/me.data.BYTES_PER_ELEMENT,(pe+1)*oe/me.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,pe,me.width,me.height,1,Te,Ve,Le)}w.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,me.width,me.height,me.depth,Te,Ve,me.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,We,me.width,me.height,me.depth,0,Te,Ve,me.data);else if(w.isData3DTexture)it?(Lt&&t.texStorage3D(n.TEXTURE_3D,Pe,We,me.width,me.height,me.depth),q&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,me.width,me.height,me.depth,Te,Ve,me.data)):t.texImage3D(n.TEXTURE_3D,0,We,me.width,me.height,me.depth,0,Te,Ve,me.data);else if(w.isFramebufferTexture){if(Lt)if(it)t.texStorage2D(n.TEXTURE_2D,Pe,We,me.width,me.height);else{let oe=me.width,pe=me.height;for(let Le=0;Le>=1,pe>>=1}}else if(Je.length>0){if(it&&Lt){const oe=N(Je[0]);t.texStorage2D(n.TEXTURE_2D,Pe,We,oe.width,oe.height)}for(let oe=0,pe=Je.length;oe0&&Pe++;const pe=N(Te[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Pe,Je,pe.width,pe.height)}for(let pe=0;pe<6;pe++)if(me){it?q&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,0,0,Te[pe].width,Te[pe].height,We,Se,Te[pe].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0,Je,Te[pe].width,Te[pe].height,0,We,Se,Te[pe].data);for(let Le=0;Le>$),Ve=Math.max(1,w.height>>$);V===n.TEXTURE_3D||V===n.TEXTURE_2D_ARRAY?t.texImage3D(V,$,Me,Te,Ve,w.depth,0,ue,le,null):t.texImage2D(V,$,Me,Te,Ve,0,ue,le,null)}t.bindFramebuffer(n.FRAMEBUFFER,A),W(w)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,O,V,me.__webglTexture,0,G(w)):(V===n.TEXTURE_2D||V>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&V<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,O,V,me.__webglTexture,$),t.bindFramebuffer(n.FRAMEBUFFER,null)}function X(A,w,U){if(n.bindRenderbuffer(n.RENDERBUFFER,A),w.depthBuffer){const O=w.depthTexture,V=O&&O.isDepthTexture?O.type:null,$=v(w.stencilBuffer,V),ue=w.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,le=G(w);W(w)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,le,$,w.width,w.height):U?n.renderbufferStorageMultisample(n.RENDERBUFFER,le,$,w.width,w.height):n.renderbufferStorage(n.RENDERBUFFER,$,w.width,w.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,ue,n.RENDERBUFFER,A)}else{const O=w.textures;for(let V=0;V{delete w.__boundDepthTexture,delete w.__depthDisposeCallback,O.removeEventListener("dispose",V)};O.addEventListener("dispose",V),w.__depthDisposeCallback=V}w.__boundDepthTexture=O}if(A.depthTexture&&!w.__autoAllocateDepthBuffer){if(U)throw new Error("target.depthTexture not supported in Cube render targets");ae(w.__webglFramebuffer,A)}else if(U){w.__webglDepthbuffer=[];for(let O=0;O<6;O++)if(t.bindFramebuffer(n.FRAMEBUFFER,w.__webglFramebuffer[O]),w.__webglDepthbuffer[O]===void 0)w.__webglDepthbuffer[O]=n.createRenderbuffer(),X(w.__webglDepthbuffer[O],A,!1);else{const V=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,$=w.__webglDepthbuffer[O];n.bindRenderbuffer(n.RENDERBUFFER,$),n.framebufferRenderbuffer(n.FRAMEBUFFER,V,n.RENDERBUFFER,$)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,w.__webglFramebuffer),w.__webglDepthbuffer===void 0)w.__webglDepthbuffer=n.createRenderbuffer(),X(w.__webglDepthbuffer,A,!1);else{const O=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,V=w.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,V),n.framebufferRenderbuffer(n.FRAMEBUFFER,O,n.RENDERBUFFER,V)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ce(A,w,U){const O=i.get(A);w!==void 0&&xe(O.__webglFramebuffer,A,A.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),U!==void 0&&fe(A)}function Ue(A){const w=A.texture,U=i.get(A),O=i.get(w);A.addEventListener("dispose",S);const V=A.textures,$=A.isWebGLCubeRenderTarget===!0,ue=V.length>1;if(ue||(O.__webglTexture===void 0&&(O.__webglTexture=n.createTexture()),O.__version=w.version,o.memory.textures++),$){U.__webglFramebuffer=[];for(let le=0;le<6;le++)if(w.mipmaps&&w.mipmaps.length>0){U.__webglFramebuffer[le]=[];for(let Me=0;Me0){U.__webglFramebuffer=[];for(let le=0;le0&&W(A)===!1){U.__webglMultisampledFramebuffer=n.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let le=0;le0)for(let Me=0;Me0)for(let Me=0;Me0){if(W(A)===!1){const w=A.textures,U=A.width,O=A.height;let V=n.COLOR_BUFFER_BIT;const $=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ue=i.get(A),le=w.length>1;if(le)for(let Me=0;Me0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&w.__useRenderToTexture!==!1}function C(A){const w=o.render.frame;u.get(A)!==w&&(u.set(A,w),A.update())}function I(A,w){const U=A.colorSpace,O=A.format,V=A.type;return A.isCompressedTexture===!0||A.isVideoTexture===!0||U!==Mo&&U!==Ss&&(ft.getTransfer(U)===wt?(O!==Bn||V!==is)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",U)),w}function N(A){return typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement?(c.width=A.naturalWidth||A.width,c.height=A.naturalHeight||A.height):typeof VideoFrame<"u"&&A instanceof VideoFrame?(c.width=A.displayWidth,c.height=A.displayHeight):(c.width=A.width,c.height=A.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=F,this.setTexture2D=ee,this.setTexture2DArray=K,this.setTexture3D=Q,this.setTextureCube=Z,this.rebindTextures=ce,this.setupRenderTarget=Ue,this.updateRenderTargetMipmap=k,this.updateMultisampleRenderTarget=te,this.setupDepthRenderbuffer=fe,this.setupFrameBufferTexture=xe,this.useMultisampledRTT=W}function lT(n,e){function t(i,s=Ss){let r;const o=ft.getTransfer(s);if(i===is)return n.UNSIGNED_BYTE;if(i===rh)return n.UNSIGNED_SHORT_4_4_4_4;if(i===oh)return n.UNSIGNED_SHORT_5_5_5_1;if(i===z0)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===k0)return n.BYTE;if(i===B0)return n.SHORT;if(i===ba)return n.UNSIGNED_SHORT;if(i===sh)return n.INT;if(i===Us)return n.UNSIGNED_INT;if(i===Kn)return n.FLOAT;if(i===Ua)return n.HALF_FLOAT;if(i===V0)return n.ALPHA;if(i===H0)return n.RGB;if(i===Bn)return n.RGBA;if(i===G0)return n.LUMINANCE;if(i===W0)return n.LUMINANCE_ALPHA;if(i===Ma)return n.DEPTH_COMPONENT;if(i===Sa)return n.DEPTH_STENCIL;if(i===ah)return n.RED;if(i===Nc)return n.RED_INTEGER;if(i===X0)return n.RG;if(i===lh)return n.RG_INTEGER;if(i===ch)return n.RGBA_INTEGER;if(i===Sl||i===El||i===Tl||i===wl)if(o===wt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(i===Sl)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===El)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Tl)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===wl)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(i===Sl)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===El)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Tl)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===wl)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===Kf||i===Zf||i===Jf||i===Qf)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(i===Kf)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Zf)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Jf)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Qf)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===ed||i===td||i===nd)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(i===ed||i===td)return o===wt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===nd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===id||i===sd||i===rd||i===od||i===ad||i===ld||i===cd||i===ud||i===fd||i===dd||i===hd||i===pd||i===md||i===gd)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(i===id)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===sd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===rd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===od)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===ad)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===ld)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===cd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===ud)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===fd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===dd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===hd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===pd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===md)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===gd)return o===wt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Al||i===_d||i===vd)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(i===Al)return o===wt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===_d)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===vd)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===$0||i===yd||i===bd||i===xd)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(i===Al)return r.COMPRESSED_RED_RGTC1_EXT;if(i===yd)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===bd)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===xd)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===xa?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const cF=` void main() { gl_Position = vec4( position, 1.0 ); -}`,cF=` +}`,uF=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -3841,37 +3841,37 @@ void main() { } -}`;class uF{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const s=new Wt,r=e.properties.get(s);r.__webglTexture=t.texture,(t.depthNear!==i.depthNear||t.depthFar!==i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ki({vertexShader:lF,fragmentShader:cF,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new $t(new Ba(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class fF extends rs{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,d=null,h=null,p=null;const _=new uF,g=t.getContextAttributes();let m=null,y=null;const b=[],v=[],T=new de;let E=null;const S=new Kt;S.viewport=new gt;const P=new Kt;P.viewport=new gt;const x=[S,P],M=new KE;let L=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(re){let ge=b[re];return ge===void 0&&(ge=new Mf,b[re]=ge),ge.getTargetRaySpace()},this.getControllerGrip=function(re){let ge=b[re];return ge===void 0&&(ge=new Mf,b[re]=ge),ge.getGripSpace()},this.getHand=function(re){let ge=b[re];return ge===void 0&&(ge=new Mf,b[re]=ge),ge.getHandSpace()};function H(re){const ge=v.indexOf(re.inputSource);if(ge===-1)return;const xe=b[ge];xe!==void 0&&(xe.update(re.inputSource,re.frame,c||o),xe.dispatchEvent({type:re.type,data:re.inputSource}))}function Y(){s.removeEventListener("select",H),s.removeEventListener("selectstart",H),s.removeEventListener("selectend",H),s.removeEventListener("squeeze",H),s.removeEventListener("squeezestart",H),s.removeEventListener("squeezeend",H),s.removeEventListener("end",Y),s.removeEventListener("inputsourceschange",ee);for(let re=0;re=0&&(v[X]=null,b[X].disconnect(xe))}for(let ge=0;ge=v.length){v.push(xe),X=fe;break}else if(v[fe]===null){v[fe]=xe,X=fe;break}if(X===-1)break}const ae=b[X];ae&&ae.connect(xe)}}const K=new B,Q=new B;function Z(re,ge,xe){K.setFromMatrixPosition(ge.matrixWorld),Q.setFromMatrixPosition(xe.matrixWorld);const X=K.distanceTo(Q),ae=ge.projectionMatrix.elements,fe=xe.projectionMatrix.elements,ce=ae[14]/(ae[10]-1),Ue=ae[14]/(ae[10]+1),k=(ae[9]+1)/ae[5],z=(ae[9]-1)/ae[5],R=(ae[8]-1)/ae[0],te=(fe[8]+1)/fe[0],G=ce*R,W=ce*te,C=X/(-R+te),I=C*-R;if(ge.matrixWorld.decompose(re.position,re.quaternion,re.scale),re.translateX(I),re.translateZ(C),re.matrixWorld.compose(re.position,re.quaternion,re.scale),re.matrixWorldInverse.copy(re.matrixWorld).invert(),ae[10]===-1)re.projectionMatrix.copy(ge.projectionMatrix),re.projectionMatrixInverse.copy(ge.projectionMatrixInverse);else{const N=ce+C,A=Ue+C,w=G-I,U=W+(X-I),O=k*Ue/A*N,V=z*Ue/A*N;re.projectionMatrix.makePerspective(w,U,O,V,N,A),re.projectionMatrixInverse.copy(re.projectionMatrix).invert()}}function he(re,ge){ge===null?re.matrixWorld.copy(re.matrix):re.matrixWorld.multiplyMatrices(ge.matrixWorld,re.matrix),re.matrixWorldInverse.copy(re.matrixWorld).invert()}this.updateCamera=function(re){if(s===null)return;let ge=re.near,xe=re.far;_.texture!==null&&(_.depthNear>0&&(ge=_.depthNear),_.depthFar>0&&(xe=_.depthFar)),M.near=P.near=S.near=ge,M.far=P.far=S.far=xe,(L!==M.near||F!==M.far)&&(s.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,F=M.far),S.layers.mask=re.layers.mask|2,P.layers.mask=re.layers.mask|4,M.layers.mask=S.layers.mask|P.layers.mask;const X=re.parent,ae=M.cameras;he(M,X);for(let fe=0;fe0&&(g.alphaTest.value=m.alphaTest);const y=e.get(m),b=y.envMap,v=y.envMapRotation;b&&(g.envMap.value=b,Kr.copy(v),Kr.x*=-1,Kr.y*=-1,Kr.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Kr.y*=-1,Kr.z*=-1),g.envMapRotation.value.setFromMatrix4(dF.makeRotationFromEuler(Kr)),g.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function o(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function a(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,y,b){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*y,g.scale.value=b*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function u(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function f(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function d(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function h(g,m,y){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===zn&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,m){m.matcap&&(g.matcap.value=m.matcap)}function _(g,m){const y=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function pF(n,e,t,i){let s={},r={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,b){const v=b.program;i.uniformBlockBinding(y,v)}function c(y,b){let v=s[y.id];v===void 0&&(p(y),v=u(y),s[y.id]=v,y.addEventListener("dispose",g));const T=b.program;i.updateUBOMapping(y,T);const E=e.render.frame;r[y.id]!==E&&(d(y),r[y.id]=E)}function u(y){const b=f();y.__bindingPointIndex=b;const v=n.createBuffer(),T=y.__size,E=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,v),n.bufferData(n.UNIFORM_BUFFER,T,E),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,b,v),v}function f(){for(let y=0;y0&&(v+=T-E),y.__size=v,y.__cache={},this}function _(y){const b={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(b.boundary=4,b.storage=4):y.isVector2?(b.boundary=8,b.storage=8):y.isVector3||y.isColor?(b.boundary=16,b.storage=12):y.isVector4?(b.boundary=16,b.storage=16):y.isMatrix3?(b.boundary=48,b.storage=48):y.isMatrix4?(b.boundary=64,b.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),b}function g(y){const b=y.target;b.removeEventListener("dispose",g);const v=o.indexOf(b.__bindingPointIndex);o.splice(v,1),n.deleteBuffer(s[b.id]),delete s[b.id],delete r[b.id]}function m(){for(const y in s)n.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:l,update:c,dispose:m}}class Ef{constructor(e={}){const{canvas:t=J1(),context:i=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let h;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=i.getContextAttributes().alpha}else h=o;const p=new Uint32Array(4),_=new Int32Array(4);let g=null,m=null;const y=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Zi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const v=this;let T=!1;this._outputColorSpace=Nn;let E=0,S=0,P=null,x=-1,M=null;const L=new gt,F=new gt;let H=null;const Y=new Ce(0);let ee=0,K=t.width,Q=t.height,Z=1,he=null,be=null;const se=new gt(0,0,K,Q),ye=new gt(0,0,K,Q);let He=!1;const re=new Bc;let ge=!1,xe=!1;const X=new Ye,ae=new Ye,fe=new B,ce=new gt,Ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let k=!1;function z(){return P===null?Z:1}let R=i;function te(D,j){return t.getContext(D,j)}try{const D={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Dc}`),t.addEventListener("webglcontextlost",pe,!1),t.addEventListener("webglcontextrestored",Le,!1),t.addEventListener("webglcontextcreationerror",Ie,!1),R===null){const j="webgl2";if(R=te(j,D),R===null)throw te(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let G,W,C,I,N,A,w,U,O,V,$,ue,le,Me,Be,me,Te,Ve,We,Se,Je,nt,Lt,q;function Pe(){G=new wN(R),G.init(),nt=new aT(R,G),W=new yN(R,G,e,nt),C=new oF(R,G),W.reverseDepthBuffer&&d&&C.buffers.depth.setReversed(!0),I=new RN(R),N=new qU,A=new aF(R,G,C,N,W,nt,I),w=new xN(v),U=new TN(v),O=new NL(R),Lt=new _N(R,O),V=new AN(R,O,I,Lt),$=new IN(R,V,O,I),We=new PN(R,W,A),me=new bN(N),ue=new $U(v,w,U,G,W,Lt,me),le=new hF(v,N),Me=new jU,Be=new tF(G),Ve=new gN(v,w,U,C,$,h,l),Te=new sF(v,$,W),q=new pF(R,I,W,C),Se=new vN(R,G,I),Je=new CN(R,G,I),I.programs=ue.programs,v.capabilities=W,v.extensions=G,v.properties=N,v.renderLists=Me,v.shadowMap=Te,v.state=C,v.info=I}Pe();const oe=new fF(v,R);this.xr=oe,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const D=G.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=G.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(D){D!==void 0&&(Z=D,this.setSize(K,Q,!1))},this.getSize=function(D){return D.set(K,Q)},this.setSize=function(D,j,ne=!0){if(oe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}K=D,Q=j,t.width=Math.floor(D*Z),t.height=Math.floor(j*Z),ne===!0&&(t.style.width=D+"px",t.style.height=j+"px"),this.setViewport(0,0,D,j)},this.getDrawingBufferSize=function(D){return D.set(K*Z,Q*Z).floor()},this.setDrawingBufferSize=function(D,j,ne){K=D,Q=j,Z=ne,t.width=Math.floor(D*ne),t.height=Math.floor(j*ne),this.setViewport(0,0,D,j)},this.getCurrentViewport=function(D){return D.copy(L)},this.getViewport=function(D){return D.copy(se)},this.setViewport=function(D,j,ne,ie){D.isVector4?se.set(D.x,D.y,D.z,D.w):se.set(D,j,ne,ie),C.viewport(L.copy(se).multiplyScalar(Z).round())},this.getScissor=function(D){return D.copy(ye)},this.setScissor=function(D,j,ne,ie){D.isVector4?ye.set(D.x,D.y,D.z,D.w):ye.set(D,j,ne,ie),C.scissor(F.copy(ye).multiplyScalar(Z).round())},this.getScissorTest=function(){return He},this.setScissorTest=function(D){C.setScissorTest(He=D)},this.setOpaqueSort=function(D){he=D},this.setTransparentSort=function(D){be=D},this.getClearColor=function(D){return D.copy(Ve.getClearColor())},this.setClearColor=function(){Ve.setClearColor(...arguments)},this.getClearAlpha=function(){return Ve.getClearAlpha()},this.setClearAlpha=function(){Ve.setClearAlpha(...arguments)},this.clear=function(D=!0,j=!0,ne=!0){let ie=0;if(D){let J=!1;if(P!==null){const ve=P.texture.format;J=ve===ch||ve===lh||ve===Nc}if(J){const ve=P.texture.type,Re=ve===is||ve===Us||ve===ba||ve===xa||ve===rh||ve===oh,Oe=Ve.getClearColor(),Fe=Ve.getClearAlpha(),Qe=Oe.r,Ze=Oe.g,Ge=Oe.b;Re?(p[0]=Qe,p[1]=Ze,p[2]=Ge,p[3]=Fe,R.clearBufferuiv(R.COLOR,0,p)):(_[0]=Qe,_[1]=Ze,_[2]=Ge,_[3]=Fe,R.clearBufferiv(R.COLOR,0,_))}else ie|=R.COLOR_BUFFER_BIT}j&&(ie|=R.DEPTH_BUFFER_BIT),ne&&(ie|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",Le,!1),t.removeEventListener("webglcontextcreationerror",Ie,!1),Ve.dispose(),Me.dispose(),Be.dispose(),N.dispose(),w.dispose(),U.dispose(),$.dispose(),Lt.dispose(),q.dispose(),ue.dispose(),oe.dispose(),oe.removeEventListener("sessionstart",iv),oe.removeEventListener("sessionend",sv),Lr.stop()};function pe(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function Le(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const D=I.autoReset,j=Te.enabled,ne=Te.autoUpdate,ie=Te.needsUpdate,J=Te.type;Pe(),I.autoReset=D,Te.enabled=j,Te.autoUpdate=ne,Te.needsUpdate=ie,Te.type=J}function Ie(D){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",D.statusMessage)}function ot(D){const j=D.target;j.removeEventListener("dispose",ot),Vt(j)}function Vt(D){vn(D),N.remove(D)}function vn(D){const j=N.get(D).programs;j!==void 0&&(j.forEach(function(ne){ue.releaseProgram(ne)}),D.isShaderMaterial&&ue.releaseShaderCache(D))}this.renderBufferDirect=function(D,j,ne,ie,J,ve){j===null&&(j=Ue);const Re=J.isMesh&&J.matrixWorld.determinant()<0,Oe=qA(D,j,ne,ie,J);C.setMaterial(ie,Re);let Fe=ne.index,Qe=1;if(ie.wireframe===!0){if(Fe=V.getWireframeAttribute(ne),Fe===void 0)return;Qe=2}const Ze=ne.drawRange,Ge=ne.attributes.position;let pt=Ze.start*Qe,bt=(Ze.start+Ze.count)*Qe;ve!==null&&(pt=Math.max(pt,ve.start*Qe),bt=Math.min(bt,(ve.start+ve.count)*Qe)),Fe!==null?(pt=Math.max(pt,0),bt=Math.min(bt,Fe.count)):Ge!=null&&(pt=Math.max(pt,0),bt=Math.min(bt,Ge.count));const qt=bt-pt;if(qt<0||qt===1/0)return;Lt.setup(J,ie,Oe,ne,Fe);let Ht,_t=Se;if(Fe!==null&&(Ht=O.get(Fe),_t=Je,_t.setIndex(Ht)),J.isMesh)ie.wireframe===!0?(C.setLineWidth(ie.wireframeLinewidth*z()),_t.setMode(R.LINES)):_t.setMode(R.TRIANGLES);else if(J.isLine){let Xe=ie.linewidth;Xe===void 0&&(Xe=1),C.setLineWidth(Xe*z()),J.isLineSegments?_t.setMode(R.LINES):J.isLineLoop?_t.setMode(R.LINE_LOOP):_t.setMode(R.LINE_STRIP)}else J.isPoints?_t.setMode(R.POINTS):J.isSprite&&_t.setMode(R.TRIANGLES);if(J.isBatchedMesh)if(J._multiDrawInstances!==null)xf("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),_t.renderMultiDrawInstances(J._multiDrawStarts,J._multiDrawCounts,J._multiDrawCount,J._multiDrawInstances);else if(G.get("WEBGL_multi_draw"))_t.renderMultiDraw(J._multiDrawStarts,J._multiDrawCounts,J._multiDrawCount);else{const Xe=J._multiDrawStarts,dn=J._multiDrawCounts,xt=J._multiDrawCount,wi=Fe?O.get(Fe).bytesPerElement:1,Oo=N.get(ie).currentProgram.getUniforms();for(let ti=0;ti{function ve(){if(ie.forEach(function(Re){N.get(Re).currentProgram.isReady()&&ie.delete(Re)}),ie.size===0){J(D);return}setTimeout(ve,10)}G.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Ti=null;function as(D){Ti&&Ti(D)}function iv(){Lr.stop()}function sv(){Lr.start()}const Lr=new nT;Lr.setAnimationLoop(as),typeof self<"u"&&Lr.setContext(self),this.setAnimationLoop=function(D){Ti=D,oe.setAnimationLoop(D),D===null?Lr.stop():Lr.start()},oe.addEventListener("sessionstart",iv),oe.addEventListener("sessionend",sv),this.render=function(D,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(j),j=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(v,D,j,P),m=Be.get(D,b.length),m.init(j),b.push(m),ae.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),re.setFromProjectionMatrix(ae),xe=this.localClippingEnabled,ge=me.init(this.clippingPlanes,xe),g=Me.get(D,y.length),g.init(),y.push(g),oe.enabled===!0&&oe.isPresenting===!0){const ve=v.xr.getDepthSensingMesh();ve!==null&&rp(ve,j,-1/0,v.sortObjects)}rp(D,j,0,v.sortObjects),g.finish(),v.sortObjects===!0&&g.sort(he,be),k=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,k&&Ve.addToRenderList(g,D),this.info.render.frame++,ge===!0&&me.beginShadows();const ne=m.state.shadowsArray;Te.render(ne,D,j),ge===!0&&me.endShadows(),this.info.autoReset===!0&&this.info.reset();const ie=g.opaque,J=g.transmissive;if(m.setupLights(),j.isArrayCamera){const ve=j.cameras;if(J.length>0)for(let Re=0,Oe=ve.length;Re0&&ov(ie,J,D,j),k&&Ve.render(D),rv(g,D,j);P!==null&&S===0&&(A.updateMultisampleRenderTarget(P),A.updateRenderTargetMipmap(P)),D.isScene===!0&&D.onAfterRender(v,D,j),Lt.resetDefaultState(),x=-1,M=null,b.pop(),b.length>0?(m=b[b.length-1],ge===!0&&me.setGlobalState(v.clippingPlanes,m.state.camera)):m=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function rp(D,j,ne,ie){if(D.visible===!1)return;if(D.layers.test(j.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(j);else if(D.isLight)m.pushLight(D),D.castShadow&&m.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||re.intersectsSprite(D)){ie&&ce.setFromMatrixPosition(D.matrixWorld).applyMatrix4(ae);const Re=$.update(D),Oe=D.material;Oe.visible&&g.push(D,Re,Oe,ne,ce.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||re.intersectsObject(D))){const Re=$.update(D),Oe=D.material;if(ie&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),ce.copy(D.boundingSphere.center)):(Re.boundingSphere===null&&Re.computeBoundingSphere(),ce.copy(Re.boundingSphere.center)),ce.applyMatrix4(D.matrixWorld).applyMatrix4(ae)),Array.isArray(Oe)){const Fe=Re.groups;for(let Qe=0,Ze=Fe.length;Qe0&&eu(J,j,ne),ve.length>0&&eu(ve,j,ne),Re.length>0&&eu(Re,j,ne),C.buffers.depth.setTest(!0),C.buffers.depth.setMask(!0),C.buffers.color.setMask(!0),C.setPolygonOffset(!1)}function ov(D,j,ne,ie){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[ie.id]===void 0&&(m.state.transmissionRenderTarget[ie.id]=new ss(1,1,{generateMipmaps:!0,type:G.has("EXT_color_buffer_half_float")||G.has("EXT_color_buffer_float")?Ua:is,minFilter:ji,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ft.workingColorSpace}));const ve=m.state.transmissionRenderTarget[ie.id],Re=ie.viewport||L;ve.setSize(Re.z*v.transmissionResolutionScale,Re.w*v.transmissionResolutionScale);const Oe=v.getRenderTarget();v.setRenderTarget(ve),v.getClearColor(Y),ee=v.getClearAlpha(),ee<1&&v.setClearColor(16777215,.5),v.clear(),k&&Ve.render(ne);const Fe=v.toneMapping;v.toneMapping=Zi;const Qe=ie.viewport;if(ie.viewport!==void 0&&(ie.viewport=void 0),m.setupLightsView(ie),ge===!0&&me.setGlobalState(v.clippingPlanes,ie),eu(D,ne,ie),A.updateMultisampleRenderTarget(ve),A.updateRenderTargetMipmap(ve),G.has("WEBGL_multisampled_render_to_texture")===!1){let Ze=!1;for(let Ge=0,pt=j.length;Ge0),Ge=!!ne.morphAttributes.position,pt=!!ne.morphAttributes.normal,bt=!!ne.morphAttributes.color;let qt=Zi;ie.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(qt=v.toneMapping);const Ht=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,_t=Ht!==void 0?Ht.length:0,Xe=N.get(ie),dn=m.state.lights;if(ge===!0&&(xe===!0||D!==M)){const Cn=D===M&&ie.id===x;me.setState(ie,D,Cn)}let xt=!1;ie.version===Xe.__version?(Xe.needsLights&&Xe.lightsStateVersion!==dn.state.version||Xe.outputColorSpace!==Oe||J.isBatchedMesh&&Xe.batching===!1||!J.isBatchedMesh&&Xe.batching===!0||J.isBatchedMesh&&Xe.batchingColor===!0&&J.colorTexture===null||J.isBatchedMesh&&Xe.batchingColor===!1&&J.colorTexture!==null||J.isInstancedMesh&&Xe.instancing===!1||!J.isInstancedMesh&&Xe.instancing===!0||J.isSkinnedMesh&&Xe.skinning===!1||!J.isSkinnedMesh&&Xe.skinning===!0||J.isInstancedMesh&&Xe.instancingColor===!0&&J.instanceColor===null||J.isInstancedMesh&&Xe.instancingColor===!1&&J.instanceColor!==null||J.isInstancedMesh&&Xe.instancingMorph===!0&&J.morphTexture===null||J.isInstancedMesh&&Xe.instancingMorph===!1&&J.morphTexture!==null||Xe.envMap!==Fe||ie.fog===!0&&Xe.fog!==ve||Xe.numClippingPlanes!==void 0&&(Xe.numClippingPlanes!==me.numPlanes||Xe.numIntersection!==me.numIntersection)||Xe.vertexAlphas!==Qe||Xe.vertexTangents!==Ze||Xe.morphTargets!==Ge||Xe.morphNormals!==pt||Xe.morphColors!==bt||Xe.toneMapping!==qt||Xe.morphTargetsCount!==_t)&&(xt=!0):(xt=!0,Xe.__version=ie.version);let wi=Xe.currentProgram;xt===!0&&(wi=tu(ie,j,J));let Oo=!1,ti=!1,Xa=!1;const Nt=wi.getUniforms(),ci=Xe.uniforms;if(C.useProgram(wi.program)&&(Oo=!0,ti=!0,Xa=!0),ie.id!==x&&(x=ie.id,ti=!0),Oo||M!==D){C.buffers.depth.getReversed()?(X.copy(D.projectionMatrix),nP(X),iP(X),Nt.setValue(R,"projectionMatrix",X)):Nt.setValue(R,"projectionMatrix",D.projectionMatrix),Nt.setValue(R,"viewMatrix",D.matrixWorldInverse);const Wn=Nt.map.cameraPosition;Wn!==void 0&&Wn.setValue(R,fe.setFromMatrixPosition(D.matrixWorld)),W.logarithmicDepthBuffer&&Nt.setValue(R,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&Nt.setValue(R,"isOrthographic",D.isOrthographicCamera===!0),M!==D&&(M=D,ti=!0,Xa=!0)}if(J.isSkinnedMesh){Nt.setOptional(R,J,"bindMatrix"),Nt.setOptional(R,J,"bindMatrixInverse");const Cn=J.skeleton;Cn&&(Cn.boneTexture===null&&Cn.computeBoneTexture(),Nt.setValue(R,"boneTexture",Cn.boneTexture,A))}J.isBatchedMesh&&(Nt.setOptional(R,J,"batchingTexture"),Nt.setValue(R,"batchingTexture",J._matricesTexture,A),Nt.setOptional(R,J,"batchingIdTexture"),Nt.setValue(R,"batchingIdTexture",J._indirectTexture,A),Nt.setOptional(R,J,"batchingColorTexture"),J._colorsTexture!==null&&Nt.setValue(R,"batchingColorTexture",J._colorsTexture,A));const ui=ne.morphAttributes;if((ui.position!==void 0||ui.normal!==void 0||ui.color!==void 0)&&We.update(J,ne,wi),(ti||Xe.receiveShadow!==J.receiveShadow)&&(Xe.receiveShadow=J.receiveShadow,Nt.setValue(R,"receiveShadow",J.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(ci.envMap.value=Fe,ci.flipEnvMap.value=Fe.isCubeTexture&&Fe.isRenderTargetTexture===!1?-1:1),ie.isMeshStandardMaterial&&ie.envMap===null&&j.environment!==null&&(ci.envMapIntensity.value=j.environmentIntensity),ti&&(Nt.setValue(R,"toneMappingExposure",v.toneMappingExposure),Xe.needsLights&&YA(ci,Xa),ve&&ie.fog===!0&&le.refreshFogUniforms(ci,ve),le.refreshMaterialUniforms(ci,ie,Z,Q,m.state.transmissionRenderTarget[D.id]),Sf.upload(R,lv(Xe),ci,A)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(Sf.upload(R,lv(Xe),ci,A),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&Nt.setValue(R,"center",J.center),Nt.setValue(R,"modelViewMatrix",J.modelViewMatrix),Nt.setValue(R,"normalMatrix",J.normalMatrix),Nt.setValue(R,"modelMatrix",J.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){const Cn=ie.uniformsGroups;for(let Wn=0,op=Cn.length;Wn0&&A.useMultisampledRTT(D)===!1?J=N.get(D).__webglMultisampledFramebuffer:Array.isArray(Ze)?J=Ze[ne]:J=Ze,L.copy(D.viewport),F.copy(D.scissor),H=D.scissorTest}else L.copy(se).multiplyScalar(Z).floor(),F.copy(ye).multiplyScalar(Z).floor(),H=He;if(ne!==0&&(J=KA),C.bindFramebuffer(R.FRAMEBUFFER,J)&&ie&&C.drawBuffers(D,J),C.viewport(L),C.scissor(F),C.setScissorTest(H),ve){const Fe=N.get(D.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+j,Fe.__webglTexture,ne)}else if(Re){const Fe=N.get(D.texture),Qe=j;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,Fe.__webglTexture,ne,Qe)}else if(D!==null&&ne!==0){const Fe=N.get(D.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Fe.__webglTexture,ne)}x=-1},this.readRenderTargetPixels=function(D,j,ne,ie,J,ve,Re){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Oe=N.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Re!==void 0&&(Oe=Oe[Re]),Oe){C.bindFramebuffer(R.FRAMEBUFFER,Oe);try{const Fe=D.texture,Qe=Fe.format,Ze=Fe.type;if(!W.textureFormatReadable(Qe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!W.textureTypeReadable(Ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=D.width-ie&&ne>=0&&ne<=D.height-J&&R.readPixels(j,ne,ie,J,nt.convert(Qe),nt.convert(Ze),ve)}finally{const Fe=P!==null?N.get(P).__webglFramebuffer:null;C.bindFramebuffer(R.FRAMEBUFFER,Fe)}}},this.readRenderTargetPixelsAsync=async function(D,j,ne,ie,J,ve,Re){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Oe=N.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Re!==void 0&&(Oe=Oe[Re]),Oe)if(j>=0&&j<=D.width-ie&&ne>=0&&ne<=D.height-J){C.bindFramebuffer(R.FRAMEBUFFER,Oe);const Fe=D.texture,Qe=Fe.format,Ze=Fe.type;if(!W.textureFormatReadable(Qe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!W.textureTypeReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ge=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Ge),R.bufferData(R.PIXEL_PACK_BUFFER,ve.byteLength,R.STREAM_READ),R.readPixels(j,ne,ie,J,nt.convert(Qe),nt.convert(Ze),0);const pt=P!==null?N.get(P).__webglFramebuffer:null;C.bindFramebuffer(R.FRAMEBUFFER,pt);const bt=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await tP(R,bt,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Ge),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ve),R.deleteBuffer(Ge),R.deleteSync(bt),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,j=null,ne=0){const ie=Math.pow(2,-ne),J=Math.floor(D.image.width*ie),ve=Math.floor(D.image.height*ie),Re=j!==null?j.x:0,Oe=j!==null?j.y:0;A.setTexture2D(D,0),R.copyTexSubImage2D(R.TEXTURE_2D,ne,0,0,Re,Oe,J,ve),C.unbindTexture()};const ZA=R.createFramebuffer(),JA=R.createFramebuffer();this.copyTextureToTexture=function(D,j,ne=null,ie=null,J=0,ve=null){ve===null&&(J!==0?(xf("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ve=J,J=0):ve=0);let Re,Oe,Fe,Qe,Ze,Ge,pt,bt,qt;const Ht=D.isCompressedTexture?D.mipmaps[ve]:D.image;if(ne!==null)Re=ne.max.x-ne.min.x,Oe=ne.max.y-ne.min.y,Fe=ne.isBox3?ne.max.z-ne.min.z:1,Qe=ne.min.x,Ze=ne.min.y,Ge=ne.isBox3?ne.min.z:0;else{const ui=Math.pow(2,-J);Re=Math.floor(Ht.width*ui),Oe=Math.floor(Ht.height*ui),D.isDataArrayTexture?Fe=Ht.depth:D.isData3DTexture?Fe=Math.floor(Ht.depth*ui):Fe=1,Qe=0,Ze=0,Ge=0}ie!==null?(pt=ie.x,bt=ie.y,qt=ie.z):(pt=0,bt=0,qt=0);const _t=nt.convert(j.format),Xe=nt.convert(j.type);let dn;j.isData3DTexture?(A.setTexture3D(j,0),dn=R.TEXTURE_3D):j.isDataArrayTexture||j.isCompressedArrayTexture?(A.setTexture2DArray(j,0),dn=R.TEXTURE_2D_ARRAY):(A.setTexture2D(j,0),dn=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,j.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,j.unpackAlignment);const xt=R.getParameter(R.UNPACK_ROW_LENGTH),wi=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Oo=R.getParameter(R.UNPACK_SKIP_PIXELS),ti=R.getParameter(R.UNPACK_SKIP_ROWS),Xa=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,Ht.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,Ht.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Qe),R.pixelStorei(R.UNPACK_SKIP_ROWS,Ze),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Ge);const Nt=D.isDataArrayTexture||D.isData3DTexture,ci=j.isDataArrayTexture||j.isData3DTexture;if(D.isDepthTexture){const ui=N.get(D),Cn=N.get(j),Wn=N.get(ui.__renderTarget),op=N.get(Cn.__renderTarget);C.bindFramebuffer(R.READ_FRAMEBUFFER,Wn.__webglFramebuffer),C.bindFramebuffer(R.DRAW_FRAMEBUFFER,op.__webglFramebuffer);for(let Dr=0;Dr{n.delete(r)};return{on:r=>{n.add(r);const o=()=>e(r);return yr(o),{off:o}},off:e,trigger:(...r)=>Promise.all(Array.from(n).map(o=>o(...r))),clear:()=>{n.clear()}}}const rm=new WeakMap,gF=(...n)=>{var e;const t=n[0],i=(e=wn())==null?void 0:e.proxy;if(i==null&&!Cc())throw new Error("injectLocal must be called in setup");return i&&rm.has(i)&&t in rm.get(i)?rm.get(i)[t]:En(...n)},Sg=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const _F=n=>typeof n<"u",vF=n=>n!=null,yF=Object.prototype.toString,bF=n=>yF.call(n)==="[object Object]",Eg=()=>{};function xF(n,e){function t(...i){return new Promise((s,r)=>{Promise.resolve(n(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(s).catch(r)})}return t}function MF(n,e={}){let t,i,s=Eg;const r=l=>{clearTimeout(l),s(),s=Eg};let o;return l=>{const c=st(n),u=st(e.maxWait);return t&&r(t),c<=0||u!==void 0&&u<=0?(i&&(r(i),i=null),Promise.resolve(l())):new Promise((f,d)=>{s=e.rejectOnCancel?d:f,o=l,u&&!i&&(i=setTimeout(()=>{t&&r(t),i=null,f(o())},u)),t=setTimeout(()=>{i&&r(i),i=null,f(l())},c)})}}function Db(n){return n.endsWith("rem")?Number.parseFloat(n)*16:Number.parseFloat(n)}function SF(n,e,t=!1){return e.reduce((i,s)=>(s in n&&(!t||n[s]!==void 0)&&(i[s]=n[s]),i),{})}function EF(n){return wn()}function Il(n){return Array.isArray(n)?n:[n]}function TF(n,e=200,t={}){return xF(MF(e,t),n)}function Ob(n,e=200,t={}){const i=et(n.value),s=TF(()=>{i.value=n.value},e,t);return $e(n,()=>s()),i}function wF(n,e={}){if(!Pt(n))return aS(n);const t=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const i in n.value)t[i]=S0(()=>({get(){return n.value[i]},set(s){var r;if((r=st(e.replaceRef))!=null?r:!0)if(Array.isArray(n.value)){const a=[...n.value];a[i]=s,n.value=a}else{const a={...n.value,[i]:s};Object.setPrototypeOf(a,Object.getPrototypeOf(n.value)),n.value=a}else n.value[i]=s}}));return t}const hn=st;function S_(n,e=!0,t){EF()?Hn(n,t):e?n():Er(n)}function AF(n,e=1e3,t={}){const{immediate:i=!0,immediateCallback:s=!1}=t;let r=null;const o=De(!1);function a(){r&&(clearInterval(r),r=null)}function l(){o.value=!1,a()}function c(){const u=st(e);u<=0||(o.value=!0,s&&n(),a(),o.value&&(r=setInterval(n,u)))}if(i&&Sg&&c(),Pt(e)||typeof e=="function"){const u=$e(e,()=>{o.value&&Sg&&c()});yr(u)}return yr(l),{isActive:o,pause:l,resume:c}}function lT(n,e,t){return $e(n,e,{...t,immediate:!0})}const Vs=Sg?window:void 0;function Di(n){var e;const t=st(n);return(e=t==null?void 0:t.$el)!=null?e:t}function To(...n){const e=[],t=()=>{e.forEach(a=>a()),e.length=0},i=(a,l,c,u)=>(a.addEventListener(l,c,u),()=>a.removeEventListener(l,c,u)),s=Ee(()=>{const a=Il(st(n[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),r=lT(()=>{var a,l;return[(l=(a=s.value)==null?void 0:a.map(c=>Di(c)))!=null?l:[Vs].filter(c=>c!=null),Il(st(s.value?n[1]:n[0])),Il(Ot(s.value?n[2]:n[1])),st(s.value?n[3]:n[2])]},([a,l,c,u])=>{if(t(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(c!=null&&c.length))return;const f=bF(u)?{...u}:u;e.push(...a.flatMap(d=>l.flatMap(h=>c.map(p=>i(d,h,p,f)))))},{flush:"post"}),o=()=>{r(),t()};return yr(t),o}function CF(){const n=De(!1),e=wn();return e&&Hn(()=>{n.value=!0},e),n}function Fh(n){const e=CF();return Ee(()=>(e.value,!!n()))}function RF(n,e,t={}){const{window:i=Vs,...s}=t;let r;const o=Fh(()=>i&&"MutationObserver"in i),a=()=>{r&&(r.disconnect(),r=void 0)},l=Ee(()=>{const d=st(n),h=Il(d).map(Di).filter(vF);return new Set(h)}),c=$e(()=>l.value,d=>{a(),o.value&&d.size&&(r=new MutationObserver(e),d.forEach(h=>r.observe(h,s)))},{immediate:!0,flush:"post"}),u=()=>r==null?void 0:r.takeRecords(),f=()=>{c(),a()};return yr(f),{isSupported:o,stop:f,takeRecords:u}}function E_(n,e={}){const{immediate:t=!0,fpsLimit:i=void 0,window:s=Vs,once:r=!1}=e,o=De(!1),a=Ee(()=>i?1e3/st(i):null);let l=0,c=null;function u(h){if(!o.value||!s)return;l||(l=h);const p=h-l;if(a.value&&pt&&"matchMedia"in t&&typeof t.matchMedia=="function"),r=De(typeof i=="number"),o=De(),a=De(!1),l=c=>{a.value=c.matches};return Rc(()=>{if(r.value){r.value=!s.value;const c=st(n).split(",");a.value=c.some(u=>{const f=u.includes("not all"),d=u.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),h=u.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let p=!!(d||h);return d&&p&&(p=i>=Db(d[1])),h&&p&&(p=i<=Db(h[1])),f?!p:p});return}s.value&&(o.value=t.matchMedia(st(n)),a.value=o.value.matches)}),To(o,"change",l,{passive:!0}),Ee(()=>a.value)}function LF(n){return JSON.parse(JSON.stringify(n))}function DF(n={}){const{window:e=Vs}=n,t=De(1),i=cT(()=>`(resolution: ${t.value}dppx)`,n);let s=Eg;return e&&(s=lT(i,()=>t.value=e.devicePixelRatio)),{pixelRatio:xi(t),stop:s}}function uT(n,e,t={}){const{window:i=Vs,...s}=t;let r;const o=Fh(()=>i&&"ResizeObserver"in i),a=()=>{r&&(r.disconnect(),r=void 0)},l=Ee(()=>{const f=st(n);return Array.isArray(f)?f.map(d=>Di(d)):[Di(f)]}),c=$e(l,f=>{if(a(),o.value&&i){r=new ResizeObserver(e);for(const d of f)d&&r.observe(d,s)}},{immediate:!0,flush:"post"}),u=()=>{a(),c()};return yr(u),{isSupported:o,stop:u}}function OF(n,e={}){const{reset:t=!0,windowResize:i=!0,windowScroll:s=!0,immediate:r=!0,updateTiming:o="sync"}=e,a=De(0),l=De(0),c=De(0),u=De(0),f=De(0),d=De(0),h=De(0),p=De(0);function _(){const m=Di(n);if(!m){t&&(a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,d.value=0,h.value=0,p.value=0);return}const y=m.getBoundingClientRect();a.value=y.height,l.value=y.bottom,c.value=y.left,u.value=y.right,f.value=y.top,d.value=y.width,h.value=y.x,p.value=y.y}function g(){o==="sync"?_():o==="next-frame"&&requestAnimationFrame(()=>_())}return uT(n,g),$e(()=>Di(n),m=>!m&&g()),RF(n,g,{attributeFilter:["style","class"]}),s&&To("scroll",g,{capture:!0,passive:!0}),i&&To("resize",g,{passive:!0}),S_(()=>{r&&g()}),{height:a,bottom:l,left:c,right:u,top:f,width:d,x:h,y:p,update:g}}function NF(n,e={width:0,height:0},t={}){const{window:i=Vs,box:s="content-box"}=t,r=Ee(()=>{var f,d;return(d=(f=Di(n))==null?void 0:f.namespaceURI)==null?void 0:d.includes("svg")}),o=De(e.width),a=De(e.height),{stop:l}=uT(n,([f])=>{const d=s==="border-box"?f.borderBoxSize:s==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(i&&r.value){const h=Di(n);if(h){const p=h.getBoundingClientRect();o.value=p.width,a.value=p.height}}else if(d){const h=Il(d);o.value=h.reduce((p,{inlineSize:_})=>p+_,0),a.value=h.reduce((p,{blockSize:_})=>p+_,0)}else o.value=f.contentRect.width,a.value=f.contentRect.height},t);S_(()=>{const f=Di(n);f&&(o.value="offsetWidth"in f?f.offsetWidth:e.width,a.value="offsetHeight"in f?f.offsetHeight:e.height)});const c=$e(()=>Di(n),f=>{o.value=f?e.width:0,a.value=f?e.height:0});function u(){l(),c()}return{width:o,height:a,stop:u}}function UF(n){var e;const t=De(0);if(typeof performance>"u")return t;const i=(e=n==null?void 0:n.every)!=null?e:10;let s=performance.now(),r=0;return E_(()=>{if(r+=1,r>=i){const o=performance.now(),a=o-s;t.value=Math.round(1e3/(a/r)),s=o,r=0}}),t}function FF(n={}){const e=et(),t=Fh(()=>typeof performance<"u"&&"memory"in performance);if(t.value){const{interval:i=1e3}=n;AF(()=>{e.value=performance.memory},i,{immediate:n.immediate,immediateCallback:n.immediateCallback})}return{isSupported:t,memory:e}}const fT={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},kF=Object.keys(fT);function BF(n={}){const{target:e=Vs}=n,t=De(!1),i=et(n.initialValue||{});Object.assign(i.value,fT,i.value);const s=r=>{t.value=!0,!(n.pointerTypes&&!n.pointerTypes.includes(r.pointerType))&&(i.value=SF(r,kF,!1))};if(e){const r={passive:!0};To(e,["pointerdown","pointermove","pointerup"],s,r),To(e,"pointerleave",()=>t.value=!1,r)}return{...wF(i),isInside:t}}function hG(n,e,t,i={}){var s,r,o;const{clone:a=!1,passive:l=!1,eventName:c,deep:u=!1,defaultValue:f,shouldEmit:d}=i,h=wn(),p=t||(h==null?void 0:h.emit)||((s=h==null?void 0:h.$emit)==null?void 0:s.bind(h))||((o=(r=h==null?void 0:h.proxy)==null?void 0:r.$emit)==null?void 0:o.bind(h==null?void 0:h.proxy));let _=c;_=_||`update:${e.toString()}`;const g=b=>a?typeof a=="function"?a(b):LF(b):b,m=()=>_F(n[e])?g(n[e]):f,y=b=>{d?d(b)&&p(_,b):p(_,b)};if(l){const b=m(),v=et(b);let T=!1;return $e(()=>n[e],E=>{T||(T=!0,v.value=g(E),Er(()=>T=!1))}),$e(v,E=>{!T&&(E!==n[e]||u)&&y(E)},{deep:u}),v}else return Ee({get(){return m()},set(b){y(b)}})}function zF(n={}){const{window:e=Vs,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:i=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:r=!0,type:o="inner"}=n,a=De(t),l=De(i),c=()=>{if(e)if(o==="outer")a.value=e.outerWidth,l.value=e.outerHeight;else if(o==="visual"&&e.visualViewport){const{width:f,height:d,scale:h}=e.visualViewport;a.value=Math.round(f*h),l.value=Math.round(d*h)}else r?(a.value=e.innerWidth,l.value=e.innerHeight):(a.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight)};c(),S_(c);const u={passive:!0};if(To("resize",c,u),e&&o==="visual"&&e.visualViewport&&To(e.visualViewport,"resize",c,u),s){const f=cT("(orientation: portrait)");$e(f,()=>c())}return{width:a,height:l}}var VF=Object.defineProperty,HF=(n,e,t)=>e in n?VF(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Nb=(n,e,t)=>HF(n,typeof e!="symbol"?e+"":e,t);const GF="@tresjs/core",WF="module",XF="4.3.3",$F="pnpm@9.15.5",qF="Declarative ThreeJS using Vue Components",YF="Alvaro Saburido (https://github.com/alvarosabu/)",jF="MIT",KF={type:"git",url:"git+https://github.com/Tresjs/tres.git"},ZF=["vue","3d","threejs","three","threejs-vue"],JF=!1,QF={".":{types:"./dist/index.d.ts",import:"./dist/tres.js",require:"./dist/tres.umd.cjs"},"./components":{types:"./dist/src/components/index.d.ts"},"./composables":{types:"./dist/src/composables/index.d.ts"},"./types":{types:"./dist/src/types/index.d.ts"},"./utils":{types:"./dist/src/utils/index.d.ts"},"./*":"./*"},ek="./dist/tres.js",tk="./dist/tres.js",nk="./dist/index.d.ts",ik=["*.d.ts","dist"],sk={access:"public"},rk={dev:"pnpm --filter='./playground/vue' dev","dev:nuxt":"pnpm --filter='./playground/nuxt' dev",build:"vite build",test:"vitest","test:ci":"vitest run","test:ui":"vitest --ui --coverage.enabled=true",release:"release-it",coverage:"vitest run --coverage",lint:"eslint .","lint:fix":"eslint . --fix","docs:dev":"vitepress dev docs","docs:build":"vitepress build docs","docs:serve":"vitepress serve docs","docs:preview":"vitepress preview docs","docs:contributors":"esno scripts/update-contributors.ts"},ok={three:">=0.133",vue:">=3.4"},ak={"@alvarosabu/utils":"^3.2.0","@vue/devtools-api":"^6.6.3","@vueuse/core":"^12.5.0"},lk={"@release-it/conventional-changelog":"^10.0.0","@stackblitz/sdk":"^1.11.0","@tresjs/cientos":"4.1.0","@tresjs/eslint-config":"^1.4.0","@types/three":"^0.173.0","@typescript-eslint/eslint-plugin":"^8.23.0","@typescript-eslint/parser":"^8.23.0","@vitejs/plugin-vue":"^5.2.1","@vitest/coverage-c8":"^0.33.0","@vitest/coverage-v8":"^3.0.5","@vitest/ui":"^3.0.5","@vue/test-utils":"^2.4.6",eslint:"^9.19.0","eslint-plugin-vue":"^9.32.0",esno:"^4.8.0",gsap:"^3.12.7",jsdom:"^26.0.0",kolorist:"^1.8.0",ohmyfetch:"^0.4.21",pathe:"^2.0.2","release-it":"^18.1.2","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-copy":"^3.5.0","rollup-plugin-visualizer":"^5.14.0",sponsorkit:"^16.3.0",three:"^0.173.0",unocss:"^65.4.3",unplugin:"^2.1.2","unplugin-vue-components":"^28.0.0",vite:"^6.1.0","vite-plugin-banner":"^0.8.0","vite-plugin-dts":"4.5.0","vite-plugin-inspect":"^10.1.0","vite-plugin-require-transform":"^1.0.21","vite-svg-loader":"^5.1.0",vitepress:"1.6.3",vitest:"3.0.5",vue:"3.5.13","vue-demi":"^0.14.10"},ck={name:GF,type:WF,version:XF,packageManager:$F,description:qF,author:YF,license:jF,repository:KF,keywords:ZF,sideEffects:JF,exports:QF,main:ek,module:tk,types:nk,files:ik,publishConfig:sk,scripts:rk,peerDependencies:ok,dependencies:ak,devDependencies:lk};class uk extends $t{constructor(...e){super(...e),Nb(this,"type","HightlightMesh"),Nb(this,"createTime"),this.createTime=Date.now()}onBeforeRender(){const e=(Date.now()-this.createTime)/1e3,t=1+.07*Math.sin(2.5*e);this.scale.set(t,t,t)}}function Tg(n){return typeof n>"u"}function wd(n){return Array.isArray(n)}function fk(n){return typeof n=="number"}function dT(n){return typeof n=="string"}function ro(n){return typeof n=="function"}function Hs(n){return n===Object(n)&&!wd(n)&&!ro(n)}function ur(n){return Hs(n)&&"isObject3D"in n&&!!n.isObject3D}function Ub(n){return Hs(n)&&"isCamera"in n&&!!n.isCamera}function dk(n){return Hs(n)&&"isBufferGeometry"in n&&!!n.isBufferGeometry}function hk(n){return Hs(n)&&"isMaterial"in n&&!!n.isMaterial}function pk(n){return Hs(n)&&"isLight"in n&&!!n.isLight}function mk(n){return Hs(n)&&"isFog"in n&&!!n.isFog}function gk(n){return Hs(n)&&"isScene"in n&&!!n.isScene}function Qu(n){return ur(n)||dk(n)||hk(n)||mk(n)}function _k(n){return Hs(n)&&!!n.isPrimitive}const hT=(n,e)=>{for(const t of Object.keys(e))e[t]instanceof Object&&Object.assign(e[t],hT(n[t],e[t]));return Object.assign(n||{},e),n},vk="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",yk=Mk(vk);function Fb(n){return n&&n.nodeType===1}function ef(n){return n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const bk=/\B([A-Z])/g;function xk(n){return n.replace(bk,"-$1").toLowerCase()}function Mk(n,e){const t=Object.create(null),i=n.split(",");for(let s=0;s!!t[s.toLowerCase()]:s=>!!t[s]}const kb=(n,e)=>{if(!e)return;const t=Array.isArray(e)?e:e.match(/([^[.\]])+/g);return t==null?void 0:t.reduce((i,s)=>i&&i[s],n)},Sk=(n,e,t)=>{const i=Array.isArray(e)?e:e.match(/([^[.\]])+/g);i&&i.reduce((s,r,o)=>(s[r]===void 0&&(s[r]={}),o===i.length-1&&(s[r]=t),s[r]),n)};function pT(n,e){if(Fb(n)&&Fb(e)){const s=n.attributes,r=e.attributes;return s.length!==r.length?!1:Array.from(s).every(({name:o,value:a})=>e.getAttribute(o)===a)}if(n===e)return!0;if(n===null||typeof n!="object"||e===null||typeof e!="object")return!1;const t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(const s of t)if(!i.includes(s)||!pT(n[s],e[s]))return!1;return!0}function Ek(n,e){if(!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length)return!1;for(let t=0;t{if(l.uuid===e)return l;for(const c of l.children){const u=s(c);if(u)return u}},r=s(n);if(!r){console.warn("Object with UUID not found in the scene.");return}let o=r;for(let l=0;lmT(i)),!(n instanceof gh)){const i=n;n&&((t=n.dispose)==null||t.call(n)),i.geometry&&i.geometry.dispose(),Array.isArray(i.material)?i.material.forEach(s=>Bb(s)):i.material&&Bb(i.material)}}function Ck(n,e){let t=0;for(let i=0;it===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join("")}const Vb=/-\d+$/;function Rk(n,e,t){if(dT(t)){if(Vb.test(t)){const r=t.replace(Vb,""),{target:o,key:a}=wg(n,r);if(!Array.isArray(o[a])){const l=o[a],c=[];c.__tresDetach=()=>{c.every(u=>Tg(u))&&(o[a]=l)},o[a]=c}}const{target:i,key:s}=wg(n,t);e.__tres.previousAttach=i[s],i[s]=Ca(e)}else e.__tres.previousAttach=t(n,e)}function Pk(n,e,t){var i,s,r;if(dT(t)){const{target:o,key:a}=wg(n,t),l=e.__tres.previousAttach;l===void 0?delete o[a]:o[a]=l,"__tresDetach"in o&&o.__tresDetach()}else(s=(i=e.__tres)==null?void 0:i.previousAttach)==null||s.call(i,n,e);(r=e.__tres)==null||delete r.previousAttach}function no(n,e,t){const i=n;return i.__tres={type:"unknown",eventCount:0,root:t,handlers:{},memoizedProps:{},objects:[],parent:null,previousAttach:null,...e},i.__tres.attach||(i.isMaterial?i.__tres.attach="material":i.isBufferGeometry?i.__tres.attach="geometry":i.isFog&&(i.__tres.attach="fog")),i}function gT(n){var e;const t=(e=n==null?void 0:n.__tres)==null?void 0:e.root;t&&t.render&&t.render.canBeInvalidated.value&&t.invalidate()}function Ik(n,e,t){var i;if(!ro(n.setPixelRatio))return;let s=0;if(t&&wd(t)){const r=t;if(r.length>=2){const[o,a]=r;s=K0.clamp(e,o,a)}}else fk(t)?s=t:s=e;s!==((i=n.getPixelRatio)==null?void 0:i.call(n))&&n.setPixelRatio(s)}function Lk(n,e,t,i,s){const r=[...e.__tres.objects],o=Ca(e);if(n=Ca(n),o===n)return!0;const a=no(n,e.__tres??{},s),l=e.parent??e.__tres.parent??null,c={...e.__tres.memoizedProps};delete c.object;for(const u of r)_T(u,s),vT(u,s);o.__tres.objects=[],i.remove(e);for(const[u,f]of Object.entries(c))i.patchProp(a,u,a[u],f);t(n),i.insert(e,l);for(const u of r)i.insert(u,e);return!0}function Ca(n){return _k(n)?(n.object.__tres=n.__tres,n.object):n}function _T(n,e){var t,i,s,r;const o=((t=n.__tres)==null?void 0:t.parent)||e.scene.value;n.__tres&&(n.__tres.parent=null),o&&o.__tres&&"objects"in o.__tres&&Ck(o.__tres.objects,a=>a!==n),(i=n.__tres)!=null&&i.attach?Pk(o,n,n.__tres.attach):((r=(s=n.parent)==null?void 0:s.remove)==null||r.call(s,Ca(n)),n.parent=null)}function vT(n,e){var t;(t=n.traverse)==null||t.call(n,i=>{var s;e.deregisterCamera(i),(s=e.eventManager)==null||s.deregisterPointerMissedObject(i)}),e.deregisterCamera(n),gT(n)}const Dk=({sizes:n})=>{const e=et([]),t=Ee(()=>e.value[0]),i=o=>{const a=o instanceof Fc?o:e.value.find(c=>c.uuid===o);if(!a)return;const l=e.value.filter(({uuid:c})=>c!==a.uuid);e.value=[a,...l]},s=(o,a=!1)=>{if(Ub(o)){const l=o;if(e.value.some(({uuid:c})=>c===l.uuid))return;a?i(l):e.value.push(l)}},r=o=>{if(Ub(o)){const a=o;e.value=e.value.filter(({uuid:l})=>l!==a.uuid)}};return Rc(()=>{n.aspectRatio.value&&e.value.forEach(o=>{!o.manual&&(o instanceof Kt||Ok(o))&&(o instanceof Kt?o.aspect=n.aspectRatio.value:(o.left=n.width.value*-.5,o.right=n.width.value*.5,o.top=n.height.value*.5,o.bottom=n.height.value*-.5),o.updateProjectionMatrix())})}),ns(()=>{e.value=[]}),{camera:t,cameras:e,registerCamera:s,deregisterCamera:r,setCameraActive:i}};function Ok(n){return n.hasOwnProperty("isOrthographicCamera")&&n.isOrthographicCamera}const Ad="[TresJS ▲ ■ ●] ";function Nk(...n){typeof n[0]=="string"?n[0]=Ad+n[0]:n.unshift(Ad),console.error(...n)}function Uk(...n){typeof n[0]=="string"?n[0]=Ad+n[0]:n.unshift(Ad),console.warn(...n)}function Fk(n,e){}function yT(){return{logError:Nk,logWarning:Uk,logMessage:Fk}}const Ag=et({}),Cg=n=>Object.assign(Ag.value,n);function om(){const n=new Map,e=new Set;let t=0,i=!1;const s=()=>{const o=Array.from(n.entries()).sort((a,l)=>{const c=a[1].priority-l[1].priority;return c===0?a[1].addI-l[1].addI:c});e.clear(),o.forEach(a=>e.add(a[0]))},r=o=>{n.delete(o),e.delete(o)};return{on:(o,a=0)=>{n.set(o,{priority:a,addI:t++});const l=()=>r(o);return yr(l),i=!0,{off:l}},off:r,trigger:(...o)=>{i&&(s(),i=!1),e.forEach(a=>a(...o))},dispose:()=>{n.clear(),e.clear()},get count(){return n.size}}}function kk(){let n=!0,e=!0,t=!1;const i=new Nh(!1),s=et(i.running),r=et(!1);let o;const a=K0.generateUUID();let l=null;const c=om(),u=om(),f=om();E();let d={};function h(S){d=S}function p(S,P,x=0){switch(P){case"before":return c.on(S,x);case"render":return l||(l=S),u.dispose(),u.on(S);case"after":return f.on(S,x)}}function _(){e&&(e=!1,E(),T())}function g(){e=!0,E(),cancelAnimationFrame(o)}function m(){t=!1,E()}function y(){t=!0,E()}function b(){r.value=!0}function v(){r.value=!1}function T(){if(!n){o=requestAnimationFrame(T);return}const S=i.getDelta(),P=i.getElapsedTime(),x={camera:Ot(d.camera),scene:Ot(d.scene),renderer:Ot(d.renderer),raycaster:Ot(d.raycaster),controls:Ot(d.controls),invalidate:d.invalidate,advance:d.advance},M={delta:S,elapsed:P,clock:i,...x};s.value&&c.trigger(M),r.value||(u.count?u.trigger(M):l&&l(M)),s.value&&f.trigger(M),o=requestAnimationFrame(T)}function E(){const S=!e&&!t;i.running!==S&&(i.running?i.stop():i.start()),s.value=i.running}return{loopId:a,register:(S,P,x)=>p(S,P,x),start:_,stop:g,pause:y,resume:m,pauseRender:b,resumeRender:v,isRenderPaused:r,isActive:s,setContext:h,setReady:S=>n=S}}function T_(n){let e=0;return n.traverse(t=>{if(t.isMesh&&t.geometry&&t.type!=="HightlightMesh"){const i=t.geometry,s=i.attributes.position.count*3*Float32Array.BYTES_PER_ELEMENT,r=i.index?i.index.count*Uint32Array.BYTES_PER_ELEMENT:0,o=i.attributes.normal?i.attributes.normal.count*3*Float32Array.BYTES_PER_ELEMENT:0,a=i.attributes.uv?i.attributes.uv.count*2*Float32Array.BYTES_PER_ELEMENT:0,l=s+r+o+a;e+=l}}),e}function Bk(n){return(n/1024).toFixed(2)}const zk=Number.parseInt(Dc.replace("dev",""));function Vk(n){return n instanceof Ce?n:Array.isArray(n)?new Ce(...n):new Ce(n)}const tf={realistic:{shadows:!0,physicallyCorrectLights:!0,outputColorSpace:Nn,toneMapping:nh,toneMappingExposure:3,shadowMap:{enabled:!0,type:U0}},flat:{toneMapping:Zi,toneMappingExposure:1}};function Hk({canvas:n,options:e,contextParts:{sizes:t,render:i,invalidate:s,advance:r}}){const o=Ee(()=>({alpha:hn(e.alpha)??!0,depth:hn(e.depth),canvas:Di(n),context:hn(e.context),stencil:hn(e.stencil),antialias:hn(e.antialias)??!0,precision:hn(e.precision),powerPreference:hn(e.powerPreference),premultipliedAlpha:hn(e.premultipliedAlpha),preserveDrawingBuffer:hn(e.preserveDrawingBuffer),logarithmicDepthBuffer:hn(e.logarithmicDepthBuffer),failIfMajorPerformanceCaveat:hn(e.failIfMajorPerformanceCaveat)})),a=De(new Ef(o.value));function l(){e.renderMode==="on-demand"&&s()}$e(o,()=>{a.value.dispose(),a.value=new Ef(o.value),l()}),$e([t.width,t.height],()=>{a.value.setSize(t.width.value,t.height.value),l()},{immediate:!0}),$e(()=>e.clearColor,l);const{pixelRatio:c}=DF(),{logError:u}=yT(),f=(()=>{const h=new Ef,p={shadowMap:{enabled:h.shadowMap.enabled,type:h.shadowMap.type},toneMapping:h.toneMapping,toneMappingExposure:h.toneMappingExposure,outputColorSpace:h.outputColorSpace};return h.dispose(),p})(),d=hn(e.renderMode);return d==="on-demand"&&s(),d==="manual"&&setTimeout(()=>{r()},100),Rc(()=>{const h=hn(e.preset);h&&(h in tf||u(`Renderer Preset must be one of these: ${Object.keys(tf).join(", ")}`),hT(a.value,tf[h])),Ik(a.value,c.value,hn(e.dpr)),d==="always"&&(i.frames.value=Math.max(1,i.frames.value));const p=(m,y)=>{const b=hn(m),v=()=>{if(h)return kb(tf[h],y)};if(b!==void 0)return b;const T=v();return T!==void 0?T:kb(f,y)},_=(m,y)=>Sk(a.value,y,p(m,y));_(e.shadows,"shadowMap.enabled"),_(e.toneMapping??nh,"toneMapping"),_(e.shadowMapType,"shadowMap.type"),zk<150&&_(!e.useLegacyLights,"physicallyCorrectLights"),_(e.outputColorSpace,"outputColorSpace"),_(e.toneMappingExposure,"toneMappingExposure");const g=p(e.clearColor,"clearColor");g&&a.value.setClearColor(g?Vk(g):new Ce(0))}),ns(()=>{a.value.dispose(),a.value.forceContextLoss()}),{renderer:a}}function Gk(n,e,t=10){const i=hn(n)?zF():NF(Ee(()=>hn(e).parentElement)),s=xi(Ob(i.width,t)),r=xi(Ob(i.height,t)),o=Ee(()=>s.value/r.value);return{height:r,width:s,aspectRatio:o}}const Wk=(n,e)=>{const t=Ee(()=>e.renderer.value.domElement),i=De([]),{x:s,y:r}=BF({target:t});let o=0;const{width:a,height:l,top:c,left:u}=OF(t),f=({x:se,y:ye})=>{if(t.value)return{x:(se-u.value)/a.value*2-1,y:-((ye-c.value)/l.value)*2+1}},d=({x:se,y:ye})=>{if(e.camera.value)return e.raycaster.value.setFromCamera(new de(se,ye),e.camera.value),i.value=e.raycaster.value.intersectObjects(n.value,!0),i.value},h=se=>{const ye=f({x:(se==null?void 0:se.clientX)??s.value,y:(se==null?void 0:se.clientY)??r.value});return ye?d(ye)||[]:[]},p=pi(),_=pi(),g=pi(),m=pi(),y=pi(),b=pi(),v=pi(),T=pi();function E(se){const ye={};for(const He in se)typeof He!="function"&&(ye[He]=se[He]);return ye}const S=(se,ye)=>{var He,re,ge;const xe=E(ye),X=new B(ye==null?void 0:ye.clientX,ye==null?void 0:ye.clientY,0).unproject((He=e.camera)==null?void 0:He.value);se.trigger({...xe,intersections:i.value,unprojectedPoint:X,ray:(re=e.raycaster)==null?void 0:re.value.ray,camera:(ge=e.camera)==null?void 0:ge.value,sourceEvent:ye,delta:o,stopPropagating:!1})};let P;const x=se=>{h(se),S(g,se),P=se},M=()=>{P&&x(P)};let L,F,H;const Y=se=>{var ye;L=(ye=i.value[0])==null?void 0:ye.object,o=0,F=new de((se==null?void 0:se.clientX)??s.value,(se==null?void 0:se.clientY)??r.value),S(y,se)};let ee,K=!1;const Q=se=>{var ye,He,re;se instanceof PointerEvent&&(i.value.length===0&&S(b,se),L===((ye=i.value[0])==null?void 0:ye.object)&&(H=new de((se==null?void 0:se.clientX)??s.value,(se==null?void 0:se.clientY)??r.value),o=F==null?void 0:F.distanceTo(H),se.button===0?(S(p,se),ee===((He=i.value[0])==null?void 0:He.object)?K=!0:(ee=(re=i.value[0])==null?void 0:re.object,K=!1)):se.button===2&&S(v,se)),S(m,se))},Z=se=>{K&&(S(_,se),ee=void 0,K=!1)},he=se=>S(g,se),be=se=>S(T,se);return t.value.addEventListener("pointerup",Q),t.value.addEventListener("pointerdown",Y),t.value.addEventListener("pointermove",x),t.value.addEventListener("pointerleave",he),t.value.addEventListener("dblclick",Z),t.value.addEventListener("wheel",be),ns(()=>{t!=null&&t.value&&(t.value.removeEventListener("pointerup",Q),t.value.removeEventListener("pointerdown",Y),t.value.removeEventListener("pointermove",x),t.value.removeEventListener("pointerleave",he),t.value.removeEventListener("dblclick",Z),t.value.removeEventListener("wheel",be))}),{intersects:i,onClick:se=>p.on(se).off,onDblClick:se=>_.on(se).off,onContextMenu:se=>v.on(se).off,onPointerMove:se=>g.on(se).off,onPointerUp:se=>m.on(se).off,onPointerDown:se=>y.on(se).off,onPointerMissed:se=>b.on(se).off,onWheel:se=>T.on(se).off,forceUpdate:M}};function am(n,e){if(Array.isArray(n))for(const t of n)t(e);typeof n=="function"&&n(e)}function Xk(n,e,t){var i;const s=De(),r=De();n&&(s.value=n),e&&(r.value=e);const o=x=>{var M;return((M=x.__tres)==null?void 0:M.eventCount)>0},a=x=>{var M;return((M=x.children)==null?void 0:M.some(L=>a(L)))||o(x)},l=De(((i=s.value)==null?void 0:i.children).filter(a)||[]);function c(x,M){const L=[],F=()=>M.stopPropagating=!0;M.stopPropagation=F;for(const H of M==null?void 0:M.intersections){if(M.stopPropagating)return;M={...M,...H};const{object:Y}=H;M.eventObject=Y,am(Y[x],M),L.push(Y);let ee=Y.parent;for(;ee!==null&&!M.stopPropagating&&!L.includes(ee);)M.eventObject=ee,am(ee[x],M),L.push(ee),ee=ee.parent;const K=xk(x.slice(2));t(K,{intersection:H,event:M})}}const{onClick:u,onDblClick:f,onContextMenu:d,onPointerMove:h,onPointerDown:p,onPointerUp:_,onPointerMissed:g,onWheel:m,forceUpdate:y}=Wk(l,e);_(x=>c("onPointerUp",x)),p(x=>c("onPointerDown",x)),u(x=>c("onClick",x)),f(x=>c("onDoubleClick",x)),d(x=>c("onContextMenu",x)),m(x=>c("onWheel",x));let b=[];h(x=>{const M=x.intersections.map(({object:F})=>F),L=x.intersections;b.forEach(({object:F})=>{M.includes(F)||(x.intersections=b,c("onPointerLeave",x),c("onPointerOut",x))}),x.intersections=L,x.intersections.forEach(({object:F})=>{b.includes(F)||(c("onPointerEnter",x),c("onPointerOver",x))}),c("onPointerMove",x),b=x.intersections});const v=[];g(x=>{const M=()=>x.stopPropagating=!0;x.stopPropagation=M,v.forEach(L=>{x.stopPropagating||(x.eventObject=L,am(L.onPointerMissed,x))}),t("pointer-missed",{event:x})});function T(x){Qu(x)&&ur(x)&&l.value.push(x)}function E(x){if(Qu(x)&&ur(x)){const M=l.value.indexOf(x);M>-1&&l.value.splice(M,1)}}function S(x){Qu(x)&&ur(x)&&x.onPointerMissed&&v.push(x)}function P(x){if(Qu(x)&&ur(x)){const M=v.indexOf(x);M>-1&&v.splice(M,1)}}return e.eventManager={forceUpdate:y,registerObject:T,deregisterObject:E,registerPointerMissedObject:S,deregisterPointerMissedObject:P},{forceUpdate:y,registerObject:T,deregisterObject:E,registerPointerMissedObject:S,deregisterPointerMissedObject:P}}function $k(n,e,t=100){t=t<=0?100:t;const i=pi(),s=new Set;let r=!1,o=!1,a=null;function l(){a&&clearTimeout(a),!o&&!r&&n()?(i.trigger(e),s.forEach(f=>f()),s.clear(),r=!0):!o&&!r&&(a=setTimeout(l,t))}function c(){o=!0,a&&clearTimeout(a)}l();const u=(f,...d)=>{f(...d)};return{on:f=>{if(r)return u(f,e),{off:()=>{}};{const d=i.on(f);return s.add(d.off),i.on(f)}},off:i.off,trigger:i.trigger,clear:i.clear,cancel:c}}const lm=new WeakMap;function qk(n){if(n=n||bT(),lm.has(n))return lm.get(n);const e=100,t=Date.now(),i=$k(()=>{if(Date.now()-t>=e)return!0;{const s=n.renderer.value,r=(s==null?void 0:s.domElement)||{width:0,height:0};return!!(s&&r.width>0&&r.height>0)}},n);return lm.set(n,i),i}function Yk({scene:n,canvas:e,windowSize:t,rendererOptions:i,emit:s}){const r=De(n),o=Gk(t,e),{camera:a,cameras:l,registerCamera:c,deregisterCamera:u,setCameraActive:f}=Dk({sizes:o}),d={mode:et(i.renderMode||"always"),priority:et(0),frames:et(0),maxFrames:60,canBeInvalidated:Ee(()=>d.mode.value==="on-demand"&&d.frames.value===0)};function h(H=1){i.renderMode==="on-demand"&&(d.frames.value=Math.min(d.maxFrames,d.frames.value+H))}function p(){i.renderMode==="manual"&&(d.frames.value=1)}const{renderer:_}=Hk({canvas:e,options:i,contextParts:{sizes:o,render:d,invalidate:h,advance:p}}),g={sizes:o,scene:r,camera:a,cameras:xi(l),renderer:_,raycaster:De(new eT),controls:et(null),perf:{maxFrames:160,fps:{value:0,accumulator:[]},memory:{currentMem:0,allocatedMem:0,accumulator:[]}},render:d,advance:p,extend:Cg,invalidate:h,registerCamera:c,setCameraActive:f,deregisterCamera:u,loop:kk()};dr("useTres",g),g.scene.value.__tres={root:g},g.loop.register(()=>{a.value&&d.frames.value>0&&(_.value.render(n,a.value),s("render",g.renderer.value)),d.priority.value=0,d.mode.value==="always"?d.frames.value=1:d.frames.value=Math.max(0,d.frames.value-1)},"render");const{on:m,cancel:y}=qk(g);g.loop.setReady(!1),g.loop.start(),m(()=>{s("ready",g),g.loop.setReady(!0),Xk(n,g,s)}),ns(()=>{y(),g.loop.stop()});const b=100,v=UF({every:b}),{isSupported:T,memory:E}=FF({interval:b}),S=160;let P=performance.now();const x=({timestamp:H})=>{g.scene.value&&(g.perf.memory.allocatedMem=T_(g.scene.value)),H-P>=b&&(P=H,g.perf.fps.accumulator.push(v.value),g.perf.fps.accumulator.length>S&&g.perf.fps.accumulator.shift(),g.perf.fps.value=v.value,T.value&&E.value&&(g.perf.memory.accumulator.push(E.value.usedJSHeapSize/1024/1024),g.perf.memory.accumulator.length>S&&g.perf.memory.accumulator.shift(),g.perf.memory.currentMem=g.perf.memory.accumulator.reduce((Y,ee)=>Y+ee,0)/g.perf.memory.accumulator.length))};let M=0;const L=1,{pause:F}=E_(({delta:H})=>{window.__TRES__DEVTOOLS__&&(x({timestamp:performance.now()}),M+=H,M>=L&&(window.__TRES__DEVTOOLS__.cb(g),M=0))},{immediate:!0});return ns(()=>{F()}),g}function bT(){const n=En("useTres");if(!n)throw new Error("useTresContext must be used together with useTresContextProvider");return n}function pG(){const{camera:n,scene:e,renderer:t,loop:i,raycaster:s,controls:r,invalidate:o,advance:a}=bT();i.setContext({camera:n,scene:e,renderer:t,raycaster:s,controls:r,invalidate:o,advance:a});function l(f,d=0){return i.register(f,"before",d)}function c(f){return i.register(f,"render")}function u(f,d=0){return i.register(f,"after",d)}return{pause:i.pause,resume:i.resume,pauseRender:i.pauseRender,resumeRender:i.resumeRender,isActive:i.isActive,onBeforeRender:l,render:c,onAfterRender:u}}const jk=pi(),Kk=pi(),xT=pi(),Ll=new Nh;let Tf=0,wf=0;E_(()=>{jk.trigger({delta:Tf,elapsed:wf,clock:Ll}),Kk.trigger({delta:Tf,elapsed:wf,clock:Ll}),xT.trigger({delta:Tf,elapsed:wf,clock:Ll})},{immediate:!1});xT.on(()=>{Tf=Ll.getDelta(),wf=Ll.getElapsedTime()});function Zk(n,e={},t={}){let i=n;const s=a=>{i=a};let r=new Proxy({},{});const o={has(a,l){return l in e||l in i},get(a,l,c){return l in e?e[l](i):i[l]},set(a,l,c){const u=t[l];return u&&typeof u=="function"?u(c,i,r,s):i[l]=c,!0}};return r=new Proxy({},o),r}const{logError:Hb}=yT(),Gb=["onClick","onContextMenu","onPointerMove","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onDoubleClick","onPointerDown","onPointerUp","onPointerCancel","onPointerMissed","onLostPointerCapture","onWheel"],Jk=n=>{const e=n.scene.value;function t(c,u,f,d){if(d||(d={}),d.args||(d.args=[]),c==="template"||yk(c))return null;let h=c.replace("Tres",""),p;if(c==="primitive"){(!Hs(d.object)||Pt(d.object))&&Hb("Tres primitives need an 'object' prop, whose value is an object or shallowRef"),h=d.object.type;const _={};p=Zk(d.object,{object:g=>g,isPrimitive:()=>!0,__tres:()=>_},{object:(g,m,y,b)=>{Lk(g,y,b,{patchProp:r,remove:s,insert:i},n)},__tres:g=>{Object.assign(_,g)}})}else{const _=Ag.value[h];_||Hb(`${h} is not defined on the THREE namespace. Use extend to add it to the catalog.`),p=new _(...d.args)}return p?(p.isCamera&&(d!=null&&d.position||p.position.set(3,3,3),d!=null&&d.lookAt||p.lookAt(0,0,0)),p=no(p,{...p.__tres,type:h,memoizedProps:d,eventCount:0,primitive:c==="primitive",attach:d.attach},n),p):null}function i(c,u){var f,d,h;if(!c)return;u=u||e;const p=c.__tres?c:no(c,{},n),_=u.__tres?u:no(u,{},n);c=Ca(p),u=Ca(_),c.__tres&&((f=c.__tres)==null?void 0:f.eventCount)>0&&((d=n.eventManager)==null||d.registerObject(c)),n.registerCamera(c),(h=n.eventManager)==null||h.registerPointerMissedObject(c),p.__tres.attach?Rk(_,p,p.__tres.attach):ur(c)&&ur(_)&&(_.add(c),c.dispatchEvent({type:"added"})),p.__tres.parent=_,_.__tres.objects&&!_.__tres.objects.includes(p)&&_.__tres.objects.push(p)}function s(c,u){var f,d,h,p;if(!c)return;c!=null&&c.__tres&&((f=c.__tres)==null?void 0:f.eventCount)>0&&((d=n.eventManager)==null||d.deregisterObject(c)),u=Tg(u)?"default":u;const _=(h=c.__tres)==null?void 0:h.dispose;Tg(_)||(_===null?u=!1:u=_);const g=(p=c.__tres)==null?void 0:p.primitive,m=u==="default"?!g:!!u;if(c.__tres&&"objects"in c.__tres&&[...c.__tres.objects].forEach(y=>s(y,u)),m&&c.children&&[...c.children].forEach(y=>s(y,u)),_T(c,n),vT(c,n),m&&!gk(c)){if(ro(u))u(c);else if(ro(c.dispose))try{c.dispose()}catch{}}"__tres"in c&&delete c.__tres}function r(c,u,f,d){var h,p;if(!c)return;let _=c,g=u;if(c.__tres&&(c.__tres.memoizedProps[u]=d),u==="attach"){const v=((h=c.__tres)==null?void 0:h.parent)||c.parent;s(c),no(c,{attach:d},n),v&&i(c,v);return}if(u==="dispose"){c.__tres||(c=no(c,{},n)),c.__tres.dispose=d;return}if(ur(c)&&g==="blocks-pointer-events"){d||d===""?c[g]=d:delete c[g];return}Gb.includes(u)&&c.__tres&&(c.__tres.eventCount+=1);let m=ef(g),y=_==null?void 0:_[m];if(g==="args"){const v=c,T=f??[],E=d??[],S=((p=c.__tres)==null?void 0:p.type)||c.type;S&&T.length&&!Ek(T,E)&&(_=Object.assign(v,new Ag.value[S](...d)));return}if(_.type==="BufferGeometry"){if(g==="args")return;_.setAttribute(ef(g),new Ct(...d));return}if(g.includes("-")&&y===void 0){const v=g.split("-");y=v.reduce((T,E)=>T[ef(E)],_),g=v.pop(),m=g,y!=null&&y.set||(_=v.reduce((T,E)=>T[ef(E)],_))}let b=d;if(b===""&&(b=!0),ro(y)){Gb.includes(u)||(wd(b)?c[m](...b):c[m](b)),m.startsWith("on")&&ro(b)&&(_[m]=b);return}!(y!=null&&y.set)&&!ro(y)?_[m]=b:y.constructor===b.constructor&&y!=null&&y.copy?y==null||y.copy(b):wd(b)?y.set(...b):!y.isColor&&y.setScalar?y.setScalar(b):y.set(b),gT(c)}function o(c){var u;return((u=c==null?void 0:c.__tres)==null?void 0:u.parent)||null}function a(c){const u=no(new ht,{type:"Comment"},n);return u.name=c,u}function l(c){var u;const f=o(c),d=((u=f==null?void 0:f.__tres)==null?void 0:u.objects)||[],h=d.indexOf(c);return h<0||h>=d.length-1?null:d[h+1]}return{insert:i,remove:s,createElement:t,patchProp:r,parentNode:o,createText:()=>{},createComment:a,setText:()=>{},setElementText:()=>{},nextSibling:l,querySelector:()=>{},setScopeId:()=>{},cloneNode:()=>{},insertStaticContent:()=>{}}};function Qk(){return MT().__VUE_DEVTOOLS_GLOBAL_HOOK__}function MT(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const eB=typeof Proxy=="function",tB="devtools-plugin:setup",nB="plugin:settings:set";let ol,Rg;function iB(){var n;return ol!==void 0||(typeof window<"u"&&window.performance?(ol=!0,Rg=window.performance):typeof globalThis<"u"&&!((n=globalThis.perf_hooks)===null||n===void 0)&&n.performance?(ol=!0,Rg=globalThis.perf_hooks.performance):ol=!1),ol}function sB(){return iB()?Rg.now():Date.now()}class rB{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const i={};if(e.settings)for(const o in e.settings){const a=e.settings[o];i[o]=a.defaultValue}const s=`__vue-devtools-plugin-settings__${e.id}`;let r=Object.assign({},i);try{const o=localStorage.getItem(s),a=JSON.parse(o);Object.assign(r,a)}catch{}this.fallbacks={getSettings(){return r},setSettings(o){try{localStorage.setItem(s,JSON.stringify(o))}catch{}r=o},now(){return sB()}},t&&t.on(nB,(o,a)=>{o===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(o,a)=>this.target?this.target.on[a]:(...l)=>{this.onQueue.push({method:a,args:l})}}),this.proxiedTarget=new Proxy({},{get:(o,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...l)=>(this.targetQueue.push({method:a,args:l,resolve:()=>{}}),this.fallbacks[a](...l)):(...l)=>new Promise(c=>{this.targetQueue.push({method:a,args:l,resolve:c})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function oB(n,e){const t=n,i=MT(),s=Qk(),r=eB&&t.enableEarlyProxy;if(s&&(i.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!r))s.emit(tB,n,e);else{const o=r?new rB(t,s):null;(i.__VUE_DEVTOOLS_PLUGINS__=i.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:o}),o&&e(o.proxiedTarget)}}function aB(n,e){const t=`▲ ■ ●${n}`;typeof Wb=="function"?Wb(t,e):console.log(t)}function Wb(n,e){throw new Error(n+e)}const ST=n=>{const e={id:n.uuid,label:n.type,children:[],tags:[]};n.name!==""&&e.tags.push({label:n.name,textColor:5750629,backgroundColor:15793395});const t=T_(n);return t>0&&e.tags.push({label:`${Bk(t)} KB`,textColor:15707189,backgroundColor:16775644,tooltip:"Memory usage"}),n.type.includes("Light")&&(pk(n)&&e.tags.push({label:`${n.intensity}`,textColor:9738662,backgroundColor:16316922,tooltip:"Intensity"}),e.tags.push({label:`#${new Ce(n.color).getHexString()}`,textColor:9738662,backgroundColor:16316922,tooltip:"Color"})),n.type.includes("Camera")&&(e.tags.push({label:`${n.fov}°`,textColor:9738662,backgroundColor:16316922,tooltip:"Field of view"}),e.tags.push({label:`x: ${Math.round(n.position.x)} y: ${Math.round(n.position.y)} z: ${Math.round(n.position.z)}`,textColor:9738662,backgroundColor:16316922,tooltip:"Position"})),e};function ET(n,e,t=""){n.children.forEach(i=>{if(i.type==="HightlightMesh"||t&&!i.type.includes(t)&&!i.name.includes(t))return;const s=ST(i);e.children.push(s),ET(i,s,t)})}const lB=[],al="tres:inspector",cB=bi({sceneGraph:null});function uB(n,e){oB({id:"dev.esm.tres",label:"TresJS 🪐",logo:"https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",packageName:"tresjs",homepage:"https://tresjs.org",componentStateTypes:lB,app:n},t=>{typeof t.now!="function"&&aB("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."),t.addInspector({id:al,label:"TresJS 🪐",icon:"account_tree",treeFilterPlaceholder:"Search instances"}),setInterval(()=>{t.sendInspectorTree(al)},1e3),setInterval(()=>{t.notifyComponentUpdate()},5e3),t.on.getInspectorTree(r=>{if(r.inspectorId===al){const o=ST(e.scene.value);ET(e.scene.value,o,r.filter),cB.sceneGraph=o,r.rootNodes=[o]}});let i=null,s=null;t.on.getInspectorState(r=>{var o;if(r.inspectorId===al){const[a]=e.scene.value.getObjectsByProperty("uuid",r.nodeId);if(!a)return;if(s&&i&&i.parent&&s.remove(i),a.isMesh){const l=wk(a);a.add(l),i=l,s=a}r.state={object:Object.entries(a).map(([l,c])=>l==="children"?{key:l,value:c.filter(u=>u.type!=="HightlightMesh")}:{key:l,value:c,editable:!0}).filter(({key:l})=>l!=="parent")},a.isScene&&(r.state={...r.state,state:[{key:"Scene Info",value:{objects:a.children.length,memory:T_(a),calls:e.renderer.value.info.render.calls,triangles:e.renderer.value.info.render.triangles,points:e.renderer.value.info.render.points,lines:e.renderer.value.info.render.lines}},{key:"Programs",value:((o=e.renderer.value.info.programs)==null?void 0:o.map(l=>({...l,programName:l.name})))||[]}]})}}),t.on.editInspectorState(r=>{r.inspectorId===al&&Tk(e.scene.value,r.nodeId,r.path,r.state.value)})})}const fB=["data-scene","data-tres"],dB=fn({__name:"TresCanvas",props:{shadows:{type:Boolean,default:void 0},clearColor:{},toneMapping:{},shadowMapType:{},useLegacyLights:{type:Boolean,default:void 0},outputColorSpace:{},toneMappingExposure:{},renderMode:{default:"always"},dpr:{},camera:{},preset:{},windowSize:{type:Boolean,default:void 0},enableProvideBridge:{type:Boolean,default:!0},context:{},alpha:{type:Boolean,default:void 0},premultipliedAlpha:{type:Boolean},antialias:{type:Boolean,default:void 0},stencil:{type:Boolean,default:void 0},preserveDrawingBuffer:{type:Boolean,default:void 0},powerPreference:{},depth:{type:Boolean,default:void 0},failIfMajorPerformanceCaveat:{type:Boolean,default:void 0},precision:{},logarithmicDepthBuffer:{type:Boolean,default:void 0},reverseDepthBuffer:{type:Boolean}},emits:["render","click","double-click","context-menu","pointer-move","pointer-up","pointer-down","pointer-enter","pointer-leave","pointer-over","pointer-out","pointer-missed","wheel","ready"],setup(n,{expose:e,emit:t}){const i=n,s=t,r=A0(),o=et(),a=De(new gh),l=wn();Cg(mF);const c=(p,_=!1)=>fn({setup(){var g;const m=(g=wn())==null?void 0:g.appContext;m&&(m.app=l==null?void 0:l.appContext.app);const y={};function b(v){v&&(v.parent&&b(v.parent),v.provides&&Object.assign(y,v.provides))}return l!=null&&l.parent&&i.enableProvideBridge&&(b(l.parent),Reflect.ownKeys(y).forEach(v=>{dr(v,y[v])})),dr("useTres",p),dr("extend",Cg),typeof window<"u"&&uB(m==null?void 0:m.app,p),()=>Ds(jt,null,_?[]:r.default())}}),u=(p,_=!1)=>{const g=c(p,_),{render:m}=GS(Jk(p));m(Ds(g),a.value)},f=(p,_=!1)=>{mT(p.scene.value),_&&(p.renderer.value.dispose(),p.renderer.value.renderLists.dispose(),p.renderer.value.forceContextLoss()),a.value.__tres={root:p}},d=De(null);e({context:d,dispose:()=>f(d.value,!0)});const h=()=>{f(d.value),u(d.value,!0)};return Hn(()=>{const p=o;d.value=Yk({scene:a.value,canvas:p,windowSize:i.windowSize??!1,rendererOptions:i,emit:s});const{registerCamera:_,camera:g,cameras:m,deregisterCamera:y}=d.value;u(d.value);const b=()=>{const v=new Kt(45,window.innerWidth/window.innerHeight,.1,1e3);v.position.set(3,3,3),v.lookAt(0,0,0),_(v);const T=Rc(()=>{m.value.length>=2&&(v.removeFromParent(),y(v),T==null||T())})};$e(()=>i.camera,(v,T)=>{v&&_(v),T&&(T.removeFromParent(),y(T))},{immediate:!0}),g.value||b()}),ns(h),(p,_)=>(mn(),vi("canvas",{ref_key:"canvas",ref:o,"data-scene":a.value.uuid,class:Oa(p.$attrs.class),"data-tres":`tresjs ${Ot(ck).version}`,style:Si({display:"block",width:"100%",height:"100%",position:p.windowSize?"fixed":"relative",top:0,left:0,pointerEvents:"auto",touchAction:"none",...p.$attrs.style})},null,14,fB))}}),hB={install(n){n.component("TresCanvas",dB)}};function cm(n){if(n===null||typeof n!="object")return!1;const e=Object.getPrototypeOf(n);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in n?!1:Symbol.toStringTag in n?Object.prototype.toString.call(n)==="[object Module]":!0}function Pg(n,e,t=".",i){if(!cm(e))return Pg(n,{},t,i);const s=Object.assign({},e);for(const r in n){if(r==="__proto__"||r==="constructor")continue;const o=n[r];o!=null&&(i&&i(s,r,o,t)||(Array.isArray(o)&&Array.isArray(s[r])?s[r]=[...o,...s[r]]:cm(o)&&cm(s[r])?s[r]=Pg(o,s[r],(t?`${t}.`:"")+r.toString(),i):s[r]=o))}return s}function pB(n){return(...e)=>e.reduce((t,i)=>Pg(t,i,"",n),{})}const TT=pB();function Cr(n){return Xd()?(_0(n),!0):!1}function Xb(){const n=new Set,e=r=>{n.delete(r)};return{on:r=>{n.add(r);const o=()=>e(r);return Cr(o),{off:o}},off:e,trigger:(...r)=>Promise.all(Array.from(n).map(o=>o(...r))),clear:()=>{n.clear()}}}const um=new WeakMap,mB=(...n)=>{var e;const t=n[0],i=(e=wn())==null?void 0:e.proxy;if(i==null&&!Cc())throw new Error("injectLocal must be called in setup");return i&&um.has(i)&&t in um.get(i)?um.get(i)[t]:En(...n)},Xc=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const wT=n=>n!=null,gB=Object.prototype.toString,Cd=n=>gB.call(n)==="[object Object]",es=()=>{},_B=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);function AT(...n){if(n.length!==1)return lS(...n);const e=n[0];return typeof e=="function"?xi(S0(()=>({get:e,set:es}))):et(e)}function w_(n,e){function t(...i){return new Promise((s,r)=>{Promise.resolve(n(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(s).catch(r)})}return t}const CT=n=>n();function RT(n,e={}){let t,i,s=es;const r=l=>{clearTimeout(l),s(),s=es};let o;return l=>{const c=st(n),u=st(e.maxWait);return t&&r(t),c<=0||u!==void 0&&u<=0?(i&&(r(i),i=null),Promise.resolve(l())):new Promise((f,d)=>{s=e.rejectOnCancel?d:f,o=l,u&&!i&&(i=setTimeout(()=>{t&&r(t),i=null,f(o())},u)),t=setTimeout(()=>{i&&r(i),i=null,f(l())},c)})}}function vB(...n){let e=0,t,i=!0,s=es,r,o,a,l,c;!Pt(n[0])&&typeof n[0]=="object"?{delay:o,trailing:a=!0,leading:l=!0,rejectOnCancel:c=!1}=n[0]:[o,a=!0,l=!0,c=!1]=n;const u=()=>{t&&(clearTimeout(t),t=void 0,s(),s=es)};return d=>{const h=st(o),p=Date.now()-e,_=()=>r=d();return u(),h<=0?(e=Date.now(),_()):(p>h&&(l||!i)?(e=Date.now(),_()):a&&(r=new Promise((g,m)=>{s=c?m:g,t=setTimeout(()=>{e=Date.now(),i=!0,g(_()),u()},Math.max(0,h-p))})),!l&&!t&&(t=setTimeout(()=>i=!0,h)),i=!1,r)}}function yB(n=CT,e={}){const{initialState:t="active"}=e,i=AT(t==="active");function s(){i.value=!1}function r(){i.value=!0}const o=(...a)=>{i.value&&n(...a)};return{isActive:xi(i),pause:s,resume:r,eventFilter:o}}function bB(n){let e;function t(){return e||(e=n()),e}return t.reset=async()=>{const i=e;e=void 0,i&&await i},t}function xB(n,e){var t;if(typeof n=="number")return n+e;const i=((t=n.match(/^-?\d+\.?\d*/))==null?void 0:t[0])||"",s=n.slice(i.length),r=Number.parseFloat(i)+e;return Number.isNaN(r)?n:r+s}function Dl(n){return n.endsWith("rem")?Number.parseFloat(n)*16:Number.parseFloat(n)}function Ol(n){return Array.isArray(n)?n:[n]}function PT(n){return wn()}function A_(n,e=200,t={}){return w_(RT(e,t),n)}function mG(n,e=200,t={}){const i=et(n.value),s=A_(()=>{i.value=n.value},e,t);return $e(n,()=>s()),i}function MB(n,e=200,t=!1,i=!0,s=!1){return w_(vB(e,t,i,s),n)}function IT(n,e,t={}){const{eventFilter:i=CT,...s}=t;return $e(n,w_(i,e),s)}function SB(n,e,t={}){const{eventFilter:i,initialState:s="active",...r}=t,{eventFilter:o,pause:a,resume:l,isActive:c}=yB(i,{initialState:s});return{stop:IT(n,e,{...r,eventFilter:o}),pause:a,resume:l,isActive:c}}function Va(n,e=!0,t){PT()?Hn(n,t):e?n():Er(n)}function EB(n,e){PT()&&ns(n,e)}function TB(n,e,t={}){const{immediate:i=!0,immediateCallback:s=!1}=t,r=De(!1);let o=null;function a(){o&&(clearTimeout(o),o=null)}function l(){r.value=!1,a()}function c(...u){s&&n(),a(),r.value=!0,o=setTimeout(()=>{r.value=!1,o=null,n(...u)},st(e))}return i&&(r.value=!0,Xc&&c()),Cr(l),{isPending:xi(r),start:c,stop:l}}function gG(n,e,t={}){const{debounce:i=0,maxWait:s=void 0,...r}=t;return IT(n,e,{...r,eventFilter:RT(i,{maxWait:s})})}function wB(n,e,t){return $e(n,e,{...t,immediate:!0})}const Qn=Xc?window:void 0,AB=Xc?window.document:void 0,C_=Xc?window.navigator:void 0;function oi(n){var e;const t=st(n);return(e=t==null?void 0:t.$el)!=null?e:t}function Ft(...n){const e=[],t=()=>{e.forEach(a=>a()),e.length=0},i=(a,l,c,u)=>(a.addEventListener(l,c,u),()=>a.removeEventListener(l,c,u)),s=Ee(()=>{const a=Ol(st(n[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),r=wB(()=>{var a,l;return[(l=(a=s.value)==null?void 0:a.map(c=>oi(c)))!=null?l:[Qn].filter(c=>c!=null),Ol(st(s.value?n[1]:n[0])),Ol(Ot(s.value?n[2]:n[1])),st(s.value?n[3]:n[2])]},([a,l,c,u])=>{if(t(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(c!=null&&c.length))return;const f=Cd(u)?{...u}:u;e.push(...a.flatMap(d=>l.flatMap(h=>c.map(p=>i(d,h,p,f)))))},{flush:"post"}),o=()=>{r(),t()};return Cr(t),o}function CB(){const n=De(!1),e=wn();return e&&Hn(()=>{n.value=!0},e),n}function Po(n){const e=CB();return Ee(()=>(e.value,!!n()))}function LT(n,e,t={}){const{window:i=Qn,...s}=t;let r;const o=Po(()=>i&&"MutationObserver"in i),a=()=>{r&&(r.disconnect(),r=void 0)},l=Ee(()=>{const d=st(n),h=Ol(d).map(oi).filter(wT);return new Set(h)}),c=$e(()=>l.value,d=>{a(),o.value&&d.size&&(r=new MutationObserver(e),d.forEach(h=>r.observe(h,s)))},{immediate:!0,flush:"post"}),u=()=>r==null?void 0:r.takeRecords(),f=()=>{c(),a()};return Cr(f),{isSupported:o,stop:f,takeRecords:u}}const RB=Symbol("vueuse-ssr-width");function DT(){const n=Cc()?mB(RB,null):null;return typeof n=="number"?n:void 0}function oo(n,e={}){const{window:t=Qn,ssrWidth:i=DT()}=e,s=Po(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function"),r=De(typeof i=="number"),o=De(),a=De(!1),l=c=>{a.value=c.matches};return Rc(()=>{if(r.value){r.value=!s.value;const c=st(n).split(",");a.value=c.some(u=>{const f=u.includes("not all"),d=u.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),h=u.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let p=!!(d||h);return d&&p&&(p=i>=Dl(d[1])),h&&p&&(p=i<=Dl(h[1])),f?!p:p});return}s.value&&(o.value=t.matchMedia(st(n)),a.value=o.value.matches)}),Ft(o,"change",l,{passive:!0}),Ee(()=>a.value)}const _G={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};function vG(n,e={}){function t(h,p){let _=st(n[st(h)]);return p!=null&&(_=xB(_,p)),typeof _=="number"&&(_=`${_}px`),_}const{window:i=Qn,strategy:s="min-width",ssrWidth:r=DT()}=e,o=typeof r=="number",a=o?De(!1):{value:!0};o&&Va(()=>a.value=!!i);function l(h,p){return!a.value&&o?h==="min"?r>=Dl(p):r<=Dl(p):i?i.matchMedia(`(${h}-width: ${p})`).matches:!1}const c=h=>oo(()=>`(min-width: ${t(h)})`,e),u=h=>oo(()=>`(max-width: ${t(h)})`,e),f=Object.keys(n).reduce((h,p)=>(Object.defineProperty(h,p,{get:()=>s==="min-width"?c(p):u(p),enumerable:!0,configurable:!0}),h),{});function d(){const h=Object.keys(n).map(p=>[p,f[p],Dl(t(p))]).sort((p,_)=>p[2]-_[2]);return Ee(()=>h.filter(([,p])=>p.value).map(([p])=>p))}return Object.assign(f,{greaterOrEqual:c,smallerOrEqual:u,greater(h){return oo(()=>`(min-width: ${t(h,.1)})`,e)},smaller(h){return oo(()=>`(max-width: ${t(h,-.1)})`,e)},between(h,p){return oo(()=>`(min-width: ${t(h)}) and (max-width: ${t(p,-.1)})`,e)},isGreater(h){return l("min",t(h,.1))},isGreaterOrEqual(h){return l("min",t(h))},isSmaller(h){return l("max",t(h,-.1))},isSmallerOrEqual(h){return l("max",t(h))},isInBetween(h,p){return l("min",t(h))&&l("max",t(p,-.1))},current:d,active(){const h=d();return Ee(()=>h.value.length===0?"":h.value.at(s==="min-width"?-1:0))}})}function Ig(n,e={}){const{controls:t=!1,navigator:i=C_}=e,s=Po(()=>i&&"permissions"in i),r=De(),o=typeof n=="string"?{name:n}:n,a=De(),l=()=>{var u,f;a.value=(f=(u=r.value)==null?void 0:u.state)!=null?f:"prompt"};Ft(r,"change",l,{passive:!0});const c=bB(async()=>{if(s.value){if(!r.value)try{r.value=await i.permissions.query(o)}catch{r.value=void 0}finally{l()}if(t)return ut(r.value)}});return c(),t?{state:a,isSupported:s,query:c}:a}function yG(n={}){const{navigator:e=C_,read:t=!1,source:i,copiedDuring:s=1500,legacy:r=!1}=n,o=Po(()=>e&&"clipboard"in e),a=Ig("clipboard-read"),l=Ig("clipboard-write"),c=Ee(()=>o.value||r),u=De(""),f=De(!1),d=TB(()=>f.value=!1,s,{immediate:!1});async function h(){let y=!(o.value&&m(a.value));if(!y)try{u.value=await e.clipboard.readText()}catch{y=!0}y&&(u.value=g())}c.value&&t&&Ft(["copy","cut"],h,{passive:!0});async function p(y=st(i)){if(c.value&&y!=null){let b=!(o.value&&m(l.value));if(!b)try{await e.clipboard.writeText(y)}catch{b=!0}b&&_(y),u.value=y,f.value=!0,d.start()}}function _(y){const b=document.createElement("textarea");b.value=y??"",b.style.position="absolute",b.style.opacity="0",document.body.appendChild(b),b.select(),document.execCommand("copy"),b.remove()}function g(){var y,b,v;return(v=(b=(y=document==null?void 0:document.getSelection)==null?void 0:y.call(document))==null?void 0:b.toString())!=null?v:""}function m(y){return y==="granted"||y==="prompt"}return{isSupported:c,text:u,copied:f,copy:p}}const nf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},sf="__vueuse_ssr_handlers__",PB=IB();function IB(){return sf in nf||(nf[sf]=nf[sf]||{}),nf[sf]}function OT(n,e){return PB[n]||e}function LB(n){return oo("(prefers-color-scheme: dark)",n)}function DB(n){return n==null?"any":n instanceof Set?"set":n instanceof Map?"map":n instanceof Date?"date":typeof n=="boolean"?"boolean":typeof n=="string"?"string":typeof n=="object"?"object":Number.isNaN(n)?"any":"number"}const OB={boolean:{read:n=>n==="true",write:n=>String(n)},object:{read:n=>JSON.parse(n),write:n=>JSON.stringify(n)},number:{read:n=>Number.parseFloat(n),write:n=>String(n)},any:{read:n=>n,write:n=>String(n)},string:{read:n=>n,write:n=>String(n)},map:{read:n=>new Map(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n.entries()))},set:{read:n=>new Set(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n))},date:{read:n=>new Date(n),write:n=>n.toISOString()}},$b="vueuse-storage";function NT(n,e,t,i={}){var s;const{flush:r="pre",deep:o=!0,listenToStorageChanges:a=!0,writeDefaults:l=!0,mergeDefaults:c=!1,shallow:u,window:f=Qn,eventFilter:d,onError:h=L=>{console.error(L)},initOnMounted:p}=i,_=(u?De:et)(typeof e=="function"?e():e),g=Ee(()=>st(n));if(!t)try{t=OT("getDefaultStorage",()=>{var L;return(L=Qn)==null?void 0:L.localStorage})()}catch(L){h(L)}if(!t)return _;const m=st(e),y=DB(m),b=(s=i.serializer)!=null?s:OB[y],{pause:v,resume:T}=SB(_,()=>S(_.value),{flush:r,deep:o,eventFilter:d});$e(g,()=>x(),{flush:r}),f&&a&&Va(()=>{t instanceof Storage?Ft(f,"storage",x,{passive:!0}):Ft(f,$b,M),p&&x()}),p||x();function E(L,F){if(f){const H={key:g.value,oldValue:L,newValue:F,storageArea:t};f.dispatchEvent(t instanceof Storage?new StorageEvent("storage",H):new CustomEvent($b,{detail:H}))}}function S(L){try{const F=t.getItem(g.value);if(L==null)E(F,null),t.removeItem(g.value);else{const H=b.write(L);F!==H&&(t.setItem(g.value,H),E(F,H))}}catch(F){h(F)}}function P(L){const F=L?L.newValue:t.getItem(g.value);if(F==null)return l&&m!=null&&t.setItem(g.value,b.write(m)),m;if(!L&&c){const H=b.read(F);return typeof c=="function"?c(H,m):y==="object"&&!Array.isArray(H)?{...m,...H}:H}else return typeof F!="string"?F:b.read(F)}function x(L){if(!(L&&L.storageArea!==t)){if(L&&L.key==null){_.value=m;return}if(!(L&&L.key!==g.value)){v();try{(L==null?void 0:L.newValue)!==b.write(_.value)&&(_.value=P(L))}catch(F){h(F)}finally{L?Er(T):T()}}}}function M(L){x(L.detail)}return _}const NB="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function UB(n={}){const{selector:e="html",attribute:t="class",initialValue:i="auto",window:s=Qn,storage:r,storageKey:o="vueuse-color-scheme",listenToStorageChanges:a=!0,storageRef:l,emitAuto:c,disableTransition:u=!0}=n,f={auto:"",light:"light",dark:"dark",...n.modes||{}},d=LB({window:s}),h=Ee(()=>d.value?"dark":"light"),p=l||(o==null?AT(i):NT(o,i,r,{window:s,listenToStorageChanges:a})),_=Ee(()=>p.value==="auto"?h.value:p.value),g=OT("updateHTMLAttrs",(v,T,E)=>{const S=typeof v=="string"?s==null?void 0:s.document.querySelector(v):oi(v);if(!S)return;const P=new Set,x=new Set;let M=null;if(T==="class"){const F=E.split(/\s/g);Object.values(f).flatMap(H=>(H||"").split(/\s/g)).filter(Boolean).forEach(H=>{F.includes(H)?P.add(H):x.add(H)})}else M={key:T,value:E};if(P.size===0&&x.size===0&&M===null)return;let L;u&&(L=s.document.createElement("style"),L.appendChild(document.createTextNode(NB)),s.document.head.appendChild(L));for(const F of P)S.classList.add(F);for(const F of x)S.classList.remove(F);M&&S.setAttribute(M.key,M.value),u&&(s.getComputedStyle(L).opacity,document.head.removeChild(L))});function m(v){var T;g(e,t,(T=f[v])!=null?T:v)}function y(v){n.onChanged?n.onChanged(v,m):m(v)}$e(_,y,{flush:"post",immediate:!0}),Va(()=>y(_.value));const b=Ee({get(){return c?p.value:_.value},set(v){p.value=v}});return Object.assign(b,{store:p,system:h,state:_})}function rf(n,e,t={}){const{window:i=Qn,initialValue:s,observe:r=!1}=t,o=De(s),a=Ee(()=>{var c;return oi(e)||((c=i==null?void 0:i.document)==null?void 0:c.documentElement)});function l(){var c;const u=st(n),f=st(a);if(f&&i&&u){const d=(c=i.getComputedStyle(f).getPropertyValue(u))==null?void 0:c.trim();o.value=d||o.value||s}}return r&<(a,l,{attributeFilter:["style","class"],window:i}),$e([a,()=>st(n)],(c,u)=>{u[0]&&u[1]&&u[0].style.removeProperty(u[1]),l()},{immediate:!0}),$e([o,a],([c,u])=>{const f=st(n);u!=null&&u.style&&f&&(c==null?u.style.removeProperty(f):u.style.setProperty(f,c))},{immediate:!0}),o}function FB(n={}){const{valueDark:e="dark",valueLight:t=""}=n,i=UB({...n,onChanged:(o,a)=>{var l;n.onChanged?(l=n.onChanged)==null||l.call(n,o==="dark",a,o):a(o)},modes:{dark:e,light:t}}),s=Ee(()=>i.system.value);return Ee({get(){return i.value==="dark"},set(o){const a=o?"dark":"light";s.value===a?i.value="auto":i.value=a}})}function kB(n={}){const{navigator:e=C_,requestPermissions:t=!1,constraints:i={audio:!0,video:!0},onUpdated:s}=n,r=et([]),o=Ee(()=>r.value.filter(p=>p.kind==="videoinput")),a=Ee(()=>r.value.filter(p=>p.kind==="audioinput")),l=Ee(()=>r.value.filter(p=>p.kind==="audiooutput")),c=Po(()=>e&&e.mediaDevices&&e.mediaDevices.enumerateDevices),u=De(!1);let f;async function d(){c.value&&(r.value=await e.mediaDevices.enumerateDevices(),s==null||s(r.value),f&&(f.getTracks().forEach(p=>p.stop()),f=null))}async function h(){const p=i.video?"camera":"microphone";if(!c.value)return!1;if(u.value)return!0;const{state:_,query:g}=Ig(p,{controls:!0});if(await g(),_.value!=="granted"){let m=!0;try{f=await e.mediaDevices.getUserMedia(i)}catch{f=null,m=!1}d(),u.value=m}else u.value=!0;return u.value}return c.value&&(t&&h(),Ft(e.mediaDevices,"devicechange",d,{passive:!0}),d()),{devices:r,ensurePermissions:h,permissionGranted:u,videoInputs:o,audioInputs:a,audioOutputs:l,isSupported:c}}function BB(n,e,t={}){const{window:i=Qn,...s}=t;let r;const o=Po(()=>i&&"ResizeObserver"in i),a=()=>{r&&(r.disconnect(),r=void 0)},l=Ee(()=>{const f=st(n);return Array.isArray(f)?f.map(d=>oi(d)):[oi(f)]}),c=$e(l,f=>{if(a(),o.value&&i){r=new ResizeObserver(e);for(const d of f)d&&r.observe(d,s)}},{immediate:!0,flush:"post"}),u=()=>{a(),c()};return Cr(u),{isSupported:o,stop:u}}function bG(n,e={}){const{reset:t=!0,windowResize:i=!0,windowScroll:s=!0,immediate:r=!0,updateTiming:o="sync"}=e,a=De(0),l=De(0),c=De(0),u=De(0),f=De(0),d=De(0),h=De(0),p=De(0);function _(){const m=oi(n);if(!m){t&&(a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,d.value=0,h.value=0,p.value=0);return}const y=m.getBoundingClientRect();a.value=y.height,l.value=y.bottom,c.value=y.left,u.value=y.right,f.value=y.top,d.value=y.width,h.value=y.x,p.value=y.y}function g(){o==="sync"?_():o==="next-frame"&&requestAnimationFrame(()=>_())}return BB(n,g),$e(()=>oi(n),m=>!m&&g()),LT(n,g,{attributeFilter:["style","class"]}),s&&Ft("scroll",g,{capture:!0,passive:!0}),i&&Ft("resize",g,{passive:!0}),Va(()=>{r&&g()}),{height:a,bottom:l,left:c,right:u,top:f,width:d,x:h,y:p,update:g}}function zB(n,e,t={}){const{root:i,rootMargin:s="0px",threshold:r=0,window:o=Qn,immediate:a=!0}=t,l=Po(()=>o&&"IntersectionObserver"in o),c=Ee(()=>{const p=st(n);return Ol(p).map(oi).filter(wT)});let u=es;const f=De(a),d=l.value?$e(()=>[c.value,oi(i),f.value],([p,_])=>{if(u(),!f.value||!p.length)return;const g=new IntersectionObserver(e,{root:oi(_),rootMargin:s,threshold:r});p.forEach(m=>m&&g.observe(m)),u=()=>{g.disconnect(),u=es}},{immediate:a,flush:"post"}):es,h=()=>{u(),d(),f.value=!1};return Cr(h),{isSupported:l,isActive:f,pause(){u(),f.value=!1},resume(){f.value=!0},stop:h}}const VB={multiple:!0,accept:"*",reset:!1,directory:!1};function HB(n){if(!n)return null;if(n instanceof FileList)return n;const e=new DataTransfer;for(const t of n)e.items.add(t);return e.files}function xG(n={}){const{document:e=AB}=n,t=et(HB(n.initialFiles)),{on:i,trigger:s}=Xb(),{on:r,trigger:o}=Xb();let a;e&&(a=e.createElement("input"),a.type="file",a.onchange=u=>{const f=u.target;t.value=f.files,s(t.value)},a.oncancel=()=>{o()});const l=()=>{t.value=null,a&&a.value&&(a.value="",s(null))},c=u=>{if(!a)return;const f={...VB,...n,...u};a.multiple=f.multiple,a.accept=f.accept,a.webkitdirectory=f.directory,_B(f,"capture")&&(a.capture=f.capture),f.reset&&l(),a.click()};return{files:xi(t),open:c,reset:l,onCancel:r,onChange:i}}const qb=1;function MG(n,e={}){const{throttle:t=0,idle:i=200,onStop:s=es,onScroll:r=es,offset:o={left:0,right:0,top:0,bottom:0},eventListenerOptions:a={capture:!1,passive:!0},behavior:l="auto",window:c=Qn,onError:u=S=>{console.error(S)}}=e,f=De(0),d=De(0),h=Ee({get(){return f.value},set(S){_(S,void 0)}}),p=Ee({get(){return d.value},set(S){_(void 0,S)}});function _(S,P){var x,M,L,F;if(!c)return;const H=st(n);if(!H)return;(L=H instanceof Document?c.document.body:H)==null||L.scrollTo({top:(x=st(P))!=null?x:p.value,left:(M=st(S))!=null?M:h.value,behavior:st(l)});const Y=((F=H==null?void 0:H.document)==null?void 0:F.documentElement)||(H==null?void 0:H.documentElement)||H;h!=null&&(f.value=Y.scrollLeft),p!=null&&(d.value=Y.scrollTop)}const g=De(!1),m=bi({left:!0,right:!1,top:!0,bottom:!1}),y=bi({left:!1,right:!1,top:!1,bottom:!1}),b=S=>{g.value&&(g.value=!1,y.left=!1,y.right=!1,y.top=!1,y.bottom=!1,s(S))},v=A_(b,t+i),T=S=>{var P;if(!c)return;const x=((P=S==null?void 0:S.document)==null?void 0:P.documentElement)||(S==null?void 0:S.documentElement)||oi(S),{display:M,flexDirection:L,direction:F}=getComputedStyle(x),H=F==="rtl"?-1:1,Y=x.scrollLeft;y.left=Yf.value;const ee=Math.abs(Y*H)<=(o.left||0),K=Math.abs(Y*H)+x.clientWidth>=x.scrollWidth-(o.right||0)-qb;M==="flex"&&L==="row-reverse"?(m.left=K,m.right=ee):(m.left=ee,m.right=K),f.value=Y;let Q=x.scrollTop;S===c.document&&!Q&&(Q=c.document.body.scrollTop),y.top=Qd.value;const Z=Math.abs(Q)<=(o.top||0),he=Math.abs(Q)+x.clientHeight>=x.scrollHeight-(o.bottom||0)-qb;M==="flex"&&L==="column-reverse"?(m.top=he,m.bottom=Z):(m.top=Z,m.bottom=he),d.value=Q},E=S=>{var P;if(!c)return;const x=(P=S.target.documentElement)!=null?P:S.target;T(x),g.value=!0,v(S),r(S)};return Ft(n,"scroll",t?MB(E,t,!0,!1):E,a),Va(()=>{try{const S=st(n);if(!S)return;T(S)}catch(S){u(S)}}),Ft(n,"scrollend",b,a),{x:h,y:p,isScrolling:g,arrivedState:m,directions:y,measure(){const S=st(n);c&&S&&T(S)}}}function gs(n,e,t={}){const{window:i=Qn}=t;return NT(n,e,i==null?void 0:i.localStorage,t)}function SG(n){const e=De(),t=()=>{e.value&&URL.revokeObjectURL(e.value),e.value=void 0};return $e(()=>st(n),i=>{t(),i&&(e.value=URL.createObjectURL(i))},{immediate:!0}),Cr(t),xi(e)}const Yb="--vueuse-safe-area-top",jb="--vueuse-safe-area-right",Kb="--vueuse-safe-area-bottom",Zb="--vueuse-safe-area-left";function EG(){const n=De(""),e=De(""),t=De(""),i=De("");if(Xc){const r=rf(Yb),o=rf(jb),a=rf(Kb),l=rf(Zb);r.value="env(safe-area-inset-top, 0px)",o.value="env(safe-area-inset-right, 0px)",a.value="env(safe-area-inset-bottom, 0px)",l.value="env(safe-area-inset-left, 0px)",s(),Ft("resize",A_(s),{passive:!0})}function s(){n.value=of(Yb),e.value=of(jb),t.value=of(Kb),i.value=of(Zb)}return{top:n,right:e,bottom:t,left:i,update:s}}function of(n){return getComputedStyle(document.documentElement).getPropertyValue(n)}function TG(n,e,t){const{window:i=Qn}={},s=et(null),r=De(),o=(...l)=>{r.value&&r.value.postMessage(...l)},a=function(){r.value&&r.value.terminate()};return i&&(r.value=new Worker(n,e),r.value.onmessage=l=>{s.value=l.data},Cr(()=>{r.value&&r.value.terminate()})),{data:s,post:o,terminate:a,worker:r}}function wG(n={}){const{window:e=Qn,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:i=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:r=!0,type:o="inner"}=n,a=De(t),l=De(i),c=()=>{if(e)if(o==="outer")a.value=e.outerWidth,l.value=e.outerHeight;else if(o==="visual"&&e.visualViewport){const{width:f,height:d,scale:h}=e.visualViewport;a.value=Math.round(f*h),l.value=Math.round(d*h)}else r?(a.value=e.innerWidth,l.value=e.innerHeight):(a.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight)};c(),Va(c);const u={passive:!0};if(Ft("resize",c,u),e&&o==="visual"&&e.visualViewport&&Ft(e.visualViewport,"resize",c,u),s){const f=oo("(orientation: portrait)");$e(f,()=>c())}return{width:a,height:l}}const UT=1/60*1e3,GB=typeof performance<"u"?()=>performance.now():()=>Date.now(),FT=typeof window<"u"?n=>window.requestAnimationFrame(n):n=>setTimeout(()=>n(GB()),UT);function WB(n){let e=[],t=[],i=0,s=!1,r=!1;const o=new WeakSet,a={schedule:(l,c=!1,u=!1)=>{const f=u&&s,d=f?e:t;return c&&o.add(l),d.indexOf(l)===-1&&(d.push(l),f&&s&&(i=e.length)),l},cancel:l=>{const c=t.indexOf(l);c!==-1&&t.splice(c,1),o.delete(l)},process:l=>{if(s){r=!0;return}if(s=!0,[e,t]=[t,e],t.length=0,i=e.length,i)for(let c=0;c(n[e]=WB(()=>vc=!0),n),{}),Og=$c.reduce((n,e)=>{const t=kh[e];return n[e]=(i,s=!1,r=!1)=>(vc||YB(),t.schedule(i,s,r)),n},{}),$B=$c.reduce((n,e)=>(n[e]=kh[e].cancel,n),{});$c.reduce((n,e)=>(n[e]=()=>kh[e].process(pa),n),{});const qB=n=>kh[n].process(pa),kT=n=>{vc=!1,pa.delta=Lg?UT:Math.max(Math.min(n-pa.timestamp,XB),1),pa.timestamp=n,Dg=!0,$c.forEach(qB),Dg=!1,vc&&(Lg=!1,FT(kT))},YB=()=>{vc=!0,Lg=!0,Dg||FT(kT)},BT=()=>pa;function zT(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(n);sMath.min(Math.max(t,n),e),Qb=.001,jB=.01,KB=10,ZB=.05,JB=1;function QB({duration:n=800,bounce:e=.25,velocity:t=0,mass:i=1}){let s,r,o=1-e;o=Ng(ZB,JB,o),n=Ng(jB,KB,n/1e3),o<1?(s=c=>{const u=c*o,f=u*n,d=u-t,h=Ug(c,o),p=Math.exp(-f);return Qb-d/h*p},r=c=>{const f=c*o*n,d=f*t+t,h=Math.pow(o,2)*Math.pow(c,2)*n,p=Math.exp(-f),_=Ug(Math.pow(c,2),o);return(-s(c)+Qb>0?-1:1)*((d-h)*p)/_}):(s=c=>{const u=Math.exp(-c*n),f=(c-t)*n+1;return-.001+u*f},r=c=>{const u=Math.exp(-c*n),f=(t-c)*(n*n);return u*f});const a=5/n,l=t4(s,r,a);if(n=n*1e3,isNaN(l))return{stiffness:100,damping:10,duration:n};{const c=Math.pow(l,2)*i;return{stiffness:c,damping:o*2*Math.sqrt(i*c),duration:n}}}const e4=12;function t4(n,e,t){let i=t;for(let s=1;sn[t]!==void 0)}function s4(n){let e=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},n);if(!ex(n,i4)&&ex(n,n4)){const t=QB(n);e=Object.assign(Object.assign(Object.assign({},e),t),{velocity:0,mass:1}),e.isResolvedFromDuration=!0}return e}function R_(n){var{from:e=0,to:t=1,restSpeed:i=2,restDelta:s}=n,r=zT(n,["from","to","restSpeed","restDelta"]);const o={done:!1,value:e};let{stiffness:a,damping:l,mass:c,velocity:u,duration:f,isResolvedFromDuration:d}=s4(r),h=tx,p=tx;function _(){const g=u?-(u/1e3):0,m=t-e,y=l/(2*Math.sqrt(a*c)),b=Math.sqrt(a/c)/1e3;if(s===void 0&&(s=Math.min(Math.abs(t-e)/100,.4)),y<1){const v=Ug(b,y);h=T=>{const E=Math.exp(-y*b*T);return t-E*((g+y*b*m)/v*Math.sin(v*T)+m*Math.cos(v*T))},p=T=>{const E=Math.exp(-y*b*T);return y*b*E*(Math.sin(v*T)*(g+y*b*m)/v+m*Math.cos(v*T))-E*(Math.cos(v*T)*(g+y*b*m)-v*m*Math.sin(v*T))}}else if(y===1)h=v=>t-Math.exp(-b*v)*(m+(g+b*m)*v);else{const v=b*Math.sqrt(y*y-1);h=T=>{const E=Math.exp(-y*b*T),S=Math.min(v*T,300);return t-E*((g+y*b*m)*Math.sinh(S)+v*m*Math.cosh(S))/v}}}return _(),{next:g=>{const m=h(g);if(d)o.done=g>=f;else{const y=p(g)*1e3,b=Math.abs(y)<=i,v=Math.abs(t-m)<=s;o.done=b&&v}return o.value=o.done?t:m,o},flipTarget:()=>{u=-u,[e,t]=[t,e],_()}}}R_.needsInterpolation=(n,e)=>typeof n=="string"||typeof e=="string";const tx=n=>0,VT=(n,e,t)=>{const i=e-n;return i===0?1:(t-n)/i},P_=(n,e,t)=>-t*n+t*e+n,HT=(n,e)=>t=>Math.max(Math.min(t,e),n),Nl=n=>n%1?Number(n.toFixed(5)):n,yc=/(-)?([\d]*\.?[\d])+/g,Fg=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,r4=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function qc(n){return typeof n=="string"}const Yc={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Ul=Object.assign(Object.assign({},Yc),{transform:HT(0,1)}),af=Object.assign(Object.assign({},Yc),{default:1}),I_=n=>({test:e=>qc(e)&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Zr=I_("deg"),Fl=I_("%"),at=I_("px"),nx=Object.assign(Object.assign({},Fl),{parse:n=>Fl.parse(n)/100,transform:n=>Fl.transform(n*100)}),L_=(n,e)=>t=>!!(qc(t)&&r4.test(t)&&t.startsWith(n)||e&&Object.prototype.hasOwnProperty.call(t,e)),GT=(n,e,t)=>i=>{if(!qc(i))return i;const[s,r,o,a]=i.match(yc);return{[n]:parseFloat(s),[e]:parseFloat(r),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},uo={test:L_("hsl","hue"),parse:GT("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(n)+", "+Fl.transform(Nl(e))+", "+Fl.transform(Nl(t))+", "+Nl(Ul.transform(i))+")"},o4=HT(0,255),fm=Object.assign(Object.assign({},Yc),{transform:n=>Math.round(o4(n))}),fr={test:L_("rgb","red"),parse:GT("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:i=1})=>"rgba("+fm.transform(n)+", "+fm.transform(e)+", "+fm.transform(t)+", "+Nl(Ul.transform(i))+")"};function a4(n){let e="",t="",i="",s="";return n.length>5?(e=n.substr(1,2),t=n.substr(3,2),i=n.substr(5,2),s=n.substr(7,2)):(e=n.substr(1,1),t=n.substr(2,1),i=n.substr(3,1),s=n.substr(4,1),e+=e,t+=t,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const kg={test:L_("#"),parse:a4,transform:fr.transform},qn={test:n=>fr.test(n)||kg.test(n)||uo.test(n),parse:n=>fr.test(n)?fr.parse(n):uo.test(n)?uo.parse(n):kg.parse(n),transform:n=>qc(n)?n:n.hasOwnProperty("red")?fr.transform(n):uo.transform(n)},WT="${c}",XT="${n}";function l4(n){var e,t,i,s;return isNaN(n)&&qc(n)&&((t=(e=n.match(yc))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((s=(i=n.match(Fg))===null||i===void 0?void 0:i.length)!==null&&s!==void 0?s:0)>0}function $T(n){typeof n=="number"&&(n=`${n}`);const e=[];let t=0;const i=n.match(Fg);i&&(t=i.length,n=n.replace(Fg,WT),e.push(...i.map(qn.parse)));const s=n.match(yc);return s&&(n=n.replace(yc,XT),e.push(...s.map(Yc.parse))),{values:e,numColors:t,tokenised:n}}function qT(n){return $T(n).values}function YT(n){const{values:e,numColors:t,tokenised:i}=$T(n),s=e.length;return r=>{let o=i;for(let a=0;atypeof n=="number"?0:n;function u4(n){const e=qT(n);return YT(n)(e.map(c4))}const jc={test:l4,parse:qT,createTransformer:YT,getAnimatableNone:u4},f4=new Set(["brightness","contrast","saturate","opacity"]);function d4(n){let[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[i]=t.match(yc)||[];if(!i)return n;const s=t.replace(i,"");let r=f4.has(e)?1:0;return i!==t&&(r*=100),e+"("+r+s+")"}const h4=/([a-z-]*)\(.*?\)/g,Bg=Object.assign(Object.assign({},jc),{getAnimatableNone:n=>{const e=n.match(h4);return e?e.map(d4).join(" "):n}});function dm(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function ix({hue:n,saturation:e,lightness:t,alpha:i}){n/=360,e/=100,t/=100;let s=0,r=0,o=0;if(!e)s=r=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;s=dm(l,a,n+1/3),r=dm(l,a,n),o=dm(l,a,n-1/3)}return{red:Math.round(s*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:i}}const p4=(n,e,t)=>{const i=n*n,s=e*e;return Math.sqrt(Math.max(0,t*(s-i)+i))},m4=[kg,fr,uo],sx=n=>m4.find(e=>e.test(n)),jT=(n,e)=>{let t=sx(n),i=sx(e),s=t.parse(n),r=i.parse(e);t===uo&&(s=ix(s),t=fr),i===uo&&(r=ix(r),i=fr);const o=Object.assign({},s);return a=>{for(const l in o)l!=="alpha"&&(o[l]=p4(s[l],r[l],a));return o.alpha=P_(s.alpha,r.alpha,a),t.transform(o)}},g4=n=>typeof n=="number",_4=(n,e)=>t=>e(n(t)),KT=(...n)=>n.reduce(_4);function ZT(n,e){return g4(n)?t=>P_(n,e,t):qn.test(n)?jT(n,e):QT(n,e)}const JT=(n,e)=>{const t=[...n],i=t.length,s=n.map((r,o)=>ZT(r,e[o]));return r=>{for(let o=0;o{const t=Object.assign(Object.assign({},n),e),i={};for(const s in t)n[s]!==void 0&&e[s]!==void 0&&(i[s]=ZT(n[s],e[s]));return s=>{for(const r in i)t[r]=i[r](s);return t}};function rx(n){const e=jc.parse(n),t=e.length;let i=0,s=0,r=0;for(let o=0;o{const t=jc.createTransformer(e),i=rx(n),s=rx(e);return i.numHSL===s.numHSL&&i.numRGB===s.numRGB&&i.numNumbers>=s.numNumbers?KT(JT(i.parsed,s.parsed),t):o=>`${o>0?e:n}`},y4=(n,e)=>t=>P_(n,e,t);function b4(n){if(typeof n=="number")return y4;if(typeof n=="string")return qn.test(n)?jT:QT;if(Array.isArray(n))return JT;if(typeof n=="object")return v4}function x4(n,e,t){const i=[],s=t||b4(n[0]),r=n.length-1;for(let o=0;ot(VT(n,e,i))}function S4(n,e){const t=n.length,i=t-1;return s=>{let r=0,o=!1;if(s<=n[0]?o=!0:s>=n[i]&&(r=i-1,o=!0),!o){let l=1;for(;ls||l===i);l++);r=l-1}const a=VT(n[r],n[r+1],s);return e[r](a)}}function ew(n,e,{clamp:t=!0,ease:i,mixer:s}={}){const r=n.length;Jb(r===e.length),Jb(!i||!Array.isArray(i)||i.length===r-1),n[0]>n[r-1]&&(n=[].concat(n),e=[].concat(e),n.reverse(),e.reverse());const o=x4(e,i,s),a=r===2?M4(n,o):S4(n,o);return t?l=>a(Ng(n[0],n[r-1],l)):a}const Bh=n=>e=>1-n(1-e),D_=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,E4=n=>e=>Math.pow(e,n),tw=n=>e=>e*e*((n+1)*e-n),T4=n=>{const e=tw(n);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},nw=1.525,w4=4/11,A4=8/11,C4=9/10,iw=n=>n,O_=E4(2),R4=Bh(O_),sw=D_(O_),rw=n=>1-Math.sin(Math.acos(n)),ow=Bh(rw),P4=D_(ow),N_=tw(nw),I4=Bh(N_),L4=D_(N_),D4=T4(nw),O4=4356/361,N4=35442/1805,U4=16061/1805,Rd=n=>{if(n===1||n===0)return n;const e=n*n;return nn<.5?.5*(1-Rd(1-n*2)):.5*Rd(n*2-1)+.5;function B4(n,e){return n.map(()=>e||sw).splice(0,n.length-1)}function z4(n){const e=n.length;return n.map((t,i)=>i!==0?i/(e-1):0)}function V4(n,e){return n.map(t=>t*e)}function Af({from:n=0,to:e=1,ease:t,offset:i,duration:s=300}){const r={done:!1,value:n},o=Array.isArray(e)?e:[n,e],a=V4(i&&i.length===o.length?i:z4(o),s);function l(){return ew(a,o,{ease:Array.isArray(t)?t:B4(o,t)})}let c=l();return{next:u=>(r.value=c(u),r.done=u>=s,r),flipTarget:()=>{o.reverse(),c=l()}}}function H4({velocity:n=0,from:e=0,power:t=.8,timeConstant:i=350,restDelta:s=.5,modifyTarget:r}){const o={done:!1,value:e};let a=t*n;const l=e+a,c=r===void 0?l:r(l);return c!==l&&(a=c-e),{next:u=>{const f=-a*Math.exp(-u/i);return o.done=!(f>s||f<-s),o.value=o.done?c:c+f,o},flipTarget:()=>{}}}const ox={keyframes:Af,spring:R_,decay:H4};function G4(n){if(Array.isArray(n.to))return Af;if(ox[n.type])return ox[n.type];const e=new Set(Object.keys(n));return e.has("ease")||e.has("duration")&&!e.has("dampingRatio")?Af:e.has("dampingRatio")||e.has("stiffness")||e.has("mass")||e.has("damping")||e.has("restSpeed")||e.has("restDelta")?R_:Af}function aw(n,e,t=0){return n-e-t}function W4(n,e,t=0,i=!0){return i?aw(e+-n,e,t):e-(n-e)+t}function X4(n,e,t,i){return i?n>=e+t:n<=-t}const $4=n=>{const e=({delta:t})=>n(t);return{start:()=>Og.update(e,!0),stop:()=>$B.update(e)}};function lw(n){var e,t,{from:i,autoplay:s=!0,driver:r=$4,elapsed:o=0,repeat:a=0,repeatType:l="loop",repeatDelay:c=0,onPlay:u,onStop:f,onComplete:d,onRepeat:h,onUpdate:p}=n,_=zT(n,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:g}=_,m,y=0,b=_.duration,v,T=!1,E=!0,S;const P=G4(_);!((t=(e=P).needsInterpolation)===null||t===void 0)&&t.call(e,i,g)&&(S=ew([0,100],[i,g],{clamp:!1}),i=0,g=100);const x=P(Object.assign(Object.assign({},_),{from:i,to:g}));function M(){y++,l==="reverse"?(E=y%2===0,o=W4(o,b,c,E)):(o=aw(o,b,c),l==="mirror"&&x.flipTarget()),T=!1,h&&h()}function L(){m.stop(),d&&d()}function F(Y){if(E||(Y=-Y),o+=Y,!T){const ee=x.next(Math.max(0,o));v=ee.value,S&&(v=S(v)),T=E?ee.done:o<=0}p==null||p(v),T&&(y===0&&(b??(b=o)),y{f==null||f(),m.stop()}}}function cw(n,e){return e?n*(1e3/e):0}function q4({from:n=0,velocity:e=0,min:t,max:i,power:s=.8,timeConstant:r=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:l=1,modifyTarget:c,driver:u,onUpdate:f,onComplete:d,onStop:h}){let p;function _(b){return t!==void 0&&bi}function g(b){return t===void 0?i:i===void 0||Math.abs(t-b){var T;f==null||f(v),(T=b.onUpdate)===null||T===void 0||T.call(b,v)},onComplete:d,onStop:h}))}function y(b){m(Object.assign({type:"spring",stiffness:o,damping:a,restDelta:l},b))}if(_(n))y({from:n,velocity:e,to:g(n)});else{let b=s*e+n;typeof c<"u"&&(b=c(b));const v=g(b),T=v===t?-1:1;let E,S;const P=x=>{E=S,S=x,e=cw(x-E,BT().delta),(T===1&&x>v||T===-1&&xp==null?void 0:p.stop()}}const uw=(n,e)=>1-3*e+3*n,fw=(n,e)=>3*e-6*n,dw=n=>3*n,Pd=(n,e,t)=>((uw(e,t)*n+fw(e,t))*n+dw(e))*n,hw=(n,e,t)=>3*uw(e,t)*n*n+2*fw(e,t)*n+dw(e),Y4=1e-7,j4=10;function K4(n,e,t,i,s){let r,o,a=0;do o=e+(t-e)/2,r=Pd(o,i,s)-n,r>0?t=o:e=o;while(Math.abs(r)>Y4&&++a=J4?Q4(o,f,n,t):d===0?f:K4(o,a,a+lf,n,t)}return o=>o===0||o===1?o:Pd(r(o),e,i)}const Ls={},hm={};class t5{constructor(){fi(this,"subscriptions",new Set)}add(e){return this.subscriptions.add(e),()=>this.subscriptions.delete(e)}notify(e,t,i){if(this.subscriptions.size)for(const s of this.subscriptions)s(e,t,i)}clear(){this.subscriptions.clear()}}function ax(n){return!Number.isNaN(Number.parseFloat(n))}class n5{constructor(e){fi(this,"current");fi(this,"prev");fi(this,"timeDelta",0);fi(this,"lastUpdated",0);fi(this,"updateSubscribers",new t5);fi(this,"stopAnimation");fi(this,"canTrackVelocity",!1);fi(this,"updateAndNotify",e=>{this.prev=this.current,this.current=e;const{delta:t,timestamp:i}=BT();this.lastUpdated!==i&&(this.timeDelta=t,this.lastUpdated=i),Og.postRender(this.scheduleVelocityCheck),this.updateSubscribers.notify(this.current)});fi(this,"scheduleVelocityCheck",()=>Og.postRender(this.velocityCheck));fi(this,"velocityCheck",({timestamp:e})=>{this.canTrackVelocity||(this.canTrackVelocity=ax(this.current)),e!==this.lastUpdated&&(this.prev=this.current)});this.prev=this.current=e,this.canTrackVelocity=ax(this.current)}onChange(e){return this.updateSubscribers.add(e)}clearListeners(){this.updateSubscribers.clear()}set(e){this.updateAndNotify(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?cw(Number.parseFloat(this.current)-Number.parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(t=>{const{stop:i}=e(t);this.stopAnimation=i}).then(()=>this.clearAnimation())}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.stop()}}function i5(n){return new n5(n)}const{isArray:s5}=Array;function r5(){const n=et({}),e=i=>{const s=r=>{n.value[r]&&(n.value[r].stop(),n.value[r].destroy(),delete n.value[r])};i?s5(i)?i.forEach(s):s(i):Object.keys(n.value).forEach(s)},t=(i,s,r)=>{if(n.value[i])return n.value[i];const o=i5(s);return o.onChange(a=>r[i]=a),n.value[i]=o,o};return EB(e),{motionValues:n,get:t,stop:e}}function o5(n){return Array.isArray(n)}function Jr(){return{type:"spring",stiffness:500,damping:25,restDelta:.5,restSpeed:10}}function pm(n){return{type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restDelta:.01,restSpeed:10}}function a5(n){return{type:"spring",stiffness:550,damping:n===0?100:30,restDelta:.01,restSpeed:10}}function mm(){return{type:"keyframes",ease:"linear",duration:300}}function l5(n){return{type:"keyframes",duration:800,values:n}}const lx={default:a5,x:Jr,y:Jr,z:Jr,rotate:Jr,rotateX:Jr,rotateY:Jr,rotateZ:Jr,scaleX:pm,scaleY:pm,scale:pm,backgroundColor:mm,color:mm,opacity:mm};function pw(n,e){let t;return o5(e)?t=l5:t=lx[n]||lx.default,{to:e,...t(e)}}const cx={...Yc,transform:Math.round},mw={color:qn,backgroundColor:qn,outlineColor:qn,fill:qn,stroke:qn,borderColor:qn,borderTopColor:qn,borderRightColor:qn,borderBottomColor:qn,borderLeftColor:qn,borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,radius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,size:at,top:at,right:at,bottom:at,left:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,rotate:Zr,rotateX:Zr,rotateY:Zr,rotateZ:Zr,scale:af,scaleX:af,scaleY:af,scaleZ:af,skew:Zr,skewX:Zr,skewY:Zr,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:Ul,originX:nx,originY:nx,originZ:at,zIndex:cx,filter:Bg,WebkitFilter:Bg,fillOpacity:Ul,strokeOpacity:Ul,numOctaves:cx},U_=n=>mw[n];function zg(n,e){return e&&typeof n=="number"&&e.transform?e.transform(n):n}function c5(n,e){let t=U_(n);return t!==Bg&&(t=jc),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const u5={linear:iw,easeIn:O_,easeInOut:sw,easeOut:R4,circIn:rw,circInOut:P4,circOut:ow,backIn:N_,backInOut:L4,backOut:I4,anticipate:D4,bounceIn:F4,bounceInOut:k4,bounceOut:Rd};function ux(n){if(Array.isArray(n)){const[e,t,i,s]=n;return e5(e,t,i,s)}else if(typeof n=="string")return u5[n];return n}function f5(n){return Array.isArray(n)&&typeof n[0]!="number"}function fx(n,e){return n==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&jc.test(e)&&!e.startsWith("url("))}function d5(n){return Array.isArray(n.to)&&n.to[0]===null&&(n.to=[...n.to],n.to[0]=n.from),n}function h5({ease:n,times:e,delay:t,...i}){const s={...i};return e&&(s.offset=e),n&&(s.ease=f5(n)?n.map(ux):ux(n)),t&&(s.elapsed=-t),s}function p5(n,e,t){return Array.isArray(e.to)&&(n.duration||(n.duration=800)),d5(e),m5(n)||(n={...n,...pw(t,e.to)}),{...e,...h5(n)}}function m5({delay:n,repeat:e,repeatType:t,repeatDelay:i,from:s,...r}){return!!Object.keys(r).length}function g5(n,e){return n[e]||n.default||n}function _5(n,e,t,i,s){const r=g5(i,n);let o=r.from===null||r.from===void 0?e.get():r.from;const a=fx(n,t);o==="none"&&a&&typeof t=="string"&&(o=c5(n,t));const l=fx(n,o);function c(f){const d={from:o,to:t,velocity:i.velocity?i.velocity:e.getVelocity(),onUpdate:h=>e.set(h)};return r.type==="inertia"||r.type==="decay"?q4({...d,...r}):lw({...p5(r,d,n),onUpdate:h=>{d.onUpdate(h),r.onUpdate&&r.onUpdate(h)},onComplete:()=>{s&&s(),f&&f()}})}function u(f){return e.set(t),s&&s(),f&&f(),{stop:()=>{}}}return!l||!a||r.type===!1?u:c}function v5(){const{motionValues:n,stop:e,get:t}=r5();return{motionValues:n,stop:e,push:(s,r,o,a={},l)=>{const c=o[s],u=t(s,c,o);if(a&&a.immediate){u.set(r);return}const f=_5(s,u,r,a,l);u.start(f)}}}function y5(n,e={},{motionValues:t,push:i,stop:s}=v5()){const r=Ot(e),o=et(!1);$e(t,f=>{o.value=Object.values(f).filter(d=>d.isAnimating()).length>0},{immediate:!0,deep:!0});const a=f=>{if(!r||!r[f])throw new Error(`The variant ${f} does not exist.`);return r[f]},l=f=>{typeof f=="string"&&(f=a(f));const d=Object.entries(f).map(([p,_])=>{if(p!=="transition")return new Promise(g=>i(p,_,n,f.transition||pw(p,f[p]),g))}).filter(Boolean);async function h(){var p,_;await Promise.all(d),(_=(p=f.transition)==null?void 0:p.onComplete)==null||_.call(p)}return Promise.all([h()])};return{isAnimating:o,apply:l,set:f=>{const d=Cd(f)?f:a(f);Object.entries(d).forEach(([h,p])=>{h!=="transition"&&i(h,p,n,{immediate:!0})})},leave:async f=>{let d;if(r&&(r.leave&&(d=r.leave),!r.leave&&r.initial&&(d=r.initial)),!d){f();return}await l(d),f()},stop:s}}const F_=typeof window<"u",b5=()=>F_&&(window.onpointerdown===null||(Ls==null?void 0:Ls.TEST)),x5=()=>F_&&(window.ontouchstart===null||(Ls==null?void 0:Ls.TEST)),M5=()=>F_&&(window.onmousedown===null||(Ls==null?void 0:Ls.TEST));function S5({target:n,state:e,variants:t,apply:i}){const s=Ot(t),r=et(!1),o=et(!1),a=et(!1),l=Ee(()=>{let u=[...Object.keys(e.value||{})];return s&&(s.hovered&&(u=[...u,...Object.keys(s.hovered)]),s.tapped&&(u=[...u,...Object.keys(s.tapped)]),s.focused&&(u=[...u,...Object.keys(s.focused)])),u}),c=Ee(()=>{const u={};Object.assign(u,e.value),r.value&&s.hovered&&Object.assign(u,s.hovered),o.value&&s.tapped&&Object.assign(u,s.tapped),a.value&&s.focused&&Object.assign(u,s.focused);for(const f in u)l.value.includes(f)||delete u[f];return u});s.hovered&&(Ft(n,"mouseenter",()=>r.value=!0),Ft(n,"mouseleave",()=>{r.value=!1,o.value=!1})),s.tapped&&(M5()&&(Ft(n,"mousedown",()=>o.value=!0),Ft(n,"mouseup",()=>o.value=!1)),b5()&&(Ft(n,"pointerdown",()=>o.value=!0),Ft(n,"pointerup",()=>o.value=!1)),x5()&&(Ft(n,"touchstart",()=>o.value=!0),Ft(n,"touchend",()=>o.value=!1))),s.focused&&(Ft(n,"focus",()=>a.value=!0),Ft(n,"blur",()=>a.value=!1)),$e([r,o,a],()=>{i(c.value)})}function E5({set:n,target:e,variants:t,variant:i}){const s=Ot(t);$e(()=>e,()=>{s&&(s.initial&&(n("initial"),i.value="initial"),s.enter&&(i.value="enter"))},{immediate:!0,flush:"pre"})}function T5({state:n,apply:e}){$e(n,t=>{t&&e(t)},{immediate:!0})}function gw({target:n,variants:e,variant:t}){const i=Ot(e);i&&(i.visible||i.visibleOnce)&&zB(n,([{isIntersecting:s}])=>{i.visible?s?t.value="visible":t.value="initial":i.visibleOnce&&(s&&t.value!=="visibleOnce"?t.value="visibleOnce":t.value||(t.value="initial"))})}function w5(n,e={syncVariants:!0,lifeCycleHooks:!0,visibilityHooks:!0,eventListeners:!0}){e.lifeCycleHooks&&E5(n),e.syncVariants&&T5(n),e.visibilityHooks&&gw(n),e.eventListeners&&S5(n)}function _w(n={}){const e=bi({...n}),t=et({});return $e(e,()=>{const i={};for(const[s,r]of Object.entries(e)){const o=U_(s),a=zg(r,o);i[s]=a}t.value=i},{immediate:!0,deep:!0}),{state:e,style:t}}function k_(n,e){$e(()=>oi(n),t=>{t&&e(t)},{immediate:!0})}const A5={x:"translateX",y:"translateY",z:"translateZ"};function vw(n={},e=!0){const t=bi({...n}),i=et("");return $e(t,s=>{let r="",o=!1;if(e&&(s.x||s.y||s.z)){const a=[s.x||0,s.y||0,s.z||0].map(l=>zg(l,at)).join(",");r+=`translate3d(${a}) `,o=!0}for(const[a,l]of Object.entries(s)){if(e&&(a==="x"||a==="y"||a==="z"))continue;const c=U_(a),u=zg(l,c);r+=`${A5[a]||a}(${u}) `}e&&!o&&(r+="translateZ(0px) "),i.value=r.trim()},{immediate:!0,deep:!0}),{state:t,transform:i}}const C5=["","X","Y","Z"],R5=["perspective","translate","scale","rotate","skew"],yw=["transformPerspective","x","y","z"];R5.forEach(n=>{C5.forEach(e=>{const t=n+e;yw.push(t)})});const P5=new Set(yw);function B_(n){return P5.has(n)}const I5=new Set(["originX","originY","originZ"]);function bw(n){return I5.has(n)}function L5(n){const e={},t={};return Object.entries(n).forEach(([i,s])=>{B_(i)||bw(i)?e[i]=s:t[i]=s}),{transform:e,style:t}}function zh(n){const{transform:e,style:t}=L5(n),{transform:i}=vw(e),{style:s}=_w(t);return i.value&&(s.value.transform=i.value),s.value}function D5(n,e){let t,i;const{state:s,style:r}=_w();return k_(n,o=>{i=o;for(const a of Object.keys(mw))o.style[a]===null||o.style[a]===""||B_(a)||bw(a)||(s[a]=o.style[a]);t&&Object.entries(t).forEach(([a,l])=>o.style[a]=l),e&&e(s)}),$e(r,o=>{if(!i){t=o;return}for(const a in o)i.style[a]=o[a]},{immediate:!0}),{style:s}}function O5(n){const e=n.trim().split(/\) |\)/);if(e.length===1)return{};const t=i=>i.endsWith("px")||i.endsWith("deg")?Number.parseFloat(i):Number.isNaN(Number(i))?Number(i):i;return e.reduce((i,s)=>{if(!s)return i;const[r,o]=s.split("("),l=o.split(",").map(u=>t(u.endsWith(")")?u.replace(")",""):u.trim())),c=l.length===1?l[0]:l;return{...i,[r]:c}},{})}function N5(n,e){Object.entries(O5(e)).forEach(([t,i])=>{const s=["x","y","z"];if(t==="translate3d"){if(i===0){s.forEach(r=>n[r]=0);return}i.forEach((r,o)=>n[s[o]]=r);return}if(i=Number.parseFloat(`${i}`),t==="translateX"){n.x=i;return}if(t==="translateY"){n.y=i;return}if(t==="translateZ"){n.z=i;return}n[t]=i})}function U5(n,e){let t,i;const{state:s,transform:r}=vw();return k_(n,o=>{i=o,o.style.transform&&N5(s,o.style.transform),t&&(o.style.transform=t),e&&e(s)}),$e(r,o=>{if(!i){t=o;return}i.style.transform=o},{immediate:!0}),{transform:s}}function F5(n){return Object.entries(n)}function k5(n,e){const t=bi({}),i=o=>Object.entries(o).forEach(([a,l])=>t[a]=l),{style:s}=D5(n,i),{transform:r}=U5(n,i);return $e(t,o=>{F5(o).forEach(([a,l])=>{const c=B_(a)?r:s;c[a]&&c[a]===l||(c[a]=l)})},{immediate:!0,deep:!0}),k_(n,()=>e),{motionProperties:t,style:s,transform:r}}function B5(n={}){const e=Ot(n),t=et();return{state:Ee(()=>{if(t.value)return e[t.value]}),variant:t}}function xw(n,e={},t){const{motionProperties:i}=k5(n),{variant:s,state:r}=B5(e),o=y5(i,e),a={target:n,variant:s,variants:e,state:r,motionProperties:i,...o};return w5(a,t),a}const Mw=["delay","duration"],z5=["initial","enter","leave","visible","visible-once","visibleOnce","hovered","tapped","focused",...Mw];function V5(n){return Mw.includes(n)}function H5(n,e){const t=n.props?n.props:n.data&&n.data.attrs?n.data.attrs:{};if(t){t.variants&&Cd(t.variants)&&(e.value={...e.value,...t.variants});for(let i of z5)if(!(!t||!t[i])){if(V5(i)&&typeof t[i]=="number"){for(const s of["enter","visible","visibleOnce"]){const r=e.value[s];r!=null&&(r.transition??(r.transition={}),r.transition[i]=t[i])}continue}if(Cd(t[i])){const s=t[i];i==="visible-once"&&(i="visibleOnce"),e.value[i]=s}}}}function gm(n,e=!1){return{created:(s,r,o)=>{const a=r.value&&typeof r.value=="string"?r.value:o.key;a&&hm[a]&&hm[a].stop();const l=e?structuredClone(ut(n)||{}):n||{},c=et(l);typeof r.value=="object"&&(c.value=r.value),H5(o,c);const f=xw(s,c,{eventListeners:!0,lifeCycleHooks:!0,syncVariants:!0,visibilityHooks:!1});s.motionInstance=f,a&&(hm[a]=f)},mounted:(s,r,o)=>{s.motionInstance&&gw(s.motionInstance)},getSSRProps(s,r){let{initial:o}=s.value||r&&(r==null?void 0:r.props)||{};o=Ot(o);const a=TT({},(n==null?void 0:n.initial)||{},o||{});return!a||Object.keys(a).length===0?void 0:{style:zh(a)}}}}const G5={initial:{opacity:0},enter:{opacity:1}},W5={initial:{opacity:0},visible:{opacity:1}},X5={initial:{opacity:0},visibleOnce:{opacity:1}},$5={initial:{scale:0,opacity:0},enter:{scale:1,opacity:1}},q5={initial:{scale:0,opacity:0},visible:{scale:1,opacity:1}},Y5={initial:{scale:0,opacity:0},visibleOnce:{scale:1,opacity:1}},j5={initial:{x:-100,rotate:90,opacity:0},enter:{x:0,rotate:0,opacity:1}},K5={initial:{x:-100,rotate:90,opacity:0},visible:{x:0,rotate:0,opacity:1}},Z5={initial:{x:-100,rotate:90,opacity:0},visibleOnce:{x:0,rotate:0,opacity:1}},J5={initial:{x:100,rotate:-90,opacity:0},enter:{x:0,rotate:0,opacity:1}},Q5={initial:{x:100,rotate:-90,opacity:0},visible:{x:0,rotate:0,opacity:1}},ez={initial:{x:100,rotate:-90,opacity:0},visibleOnce:{x:0,rotate:0,opacity:1}},tz={initial:{y:-100,rotate:-90,opacity:0},enter:{y:0,rotate:0,opacity:1}},nz={initial:{y:-100,rotate:-90,opacity:0},visible:{y:0,rotate:0,opacity:1}},iz={initial:{y:-100,rotate:-90,opacity:0},visibleOnce:{y:0,rotate:0,opacity:1}},sz={initial:{y:100,rotate:90,opacity:0},enter:{y:0,rotate:0,opacity:1}},rz={initial:{y:100,rotate:90,opacity:0},visible:{y:0,rotate:0,opacity:1}},oz={initial:{y:100,rotate:90,opacity:0},visibleOnce:{y:0,rotate:0,opacity:1}},az={initial:{x:-100,opacity:0},enter:{x:0,opacity:1}},lz={initial:{x:-100,opacity:0},visible:{x:0,opacity:1}},cz={initial:{x:-100,opacity:0},visibleOnce:{x:0,opacity:1}},uz={initial:{x:100,opacity:0},enter:{x:0,opacity:1}},fz={initial:{x:100,opacity:0},visible:{x:0,opacity:1}},dz={initial:{x:100,opacity:0},visibleOnce:{x:0,opacity:1}},hz={initial:{y:-100,opacity:0},enter:{y:0,opacity:1}},pz={initial:{y:-100,opacity:0},visible:{y:0,opacity:1}},mz={initial:{y:-100,opacity:0},visibleOnce:{y:0,opacity:1}},gz={initial:{y:100,opacity:0},enter:{y:0,opacity:1}},_z={initial:{y:100,opacity:0},visible:{y:0,opacity:1}},vz={initial:{y:100,opacity:0},visibleOnce:{y:0,opacity:1}},Id={__proto__:null,fade:G5,fadeVisible:W5,fadeVisibleOnce:X5,pop:$5,popVisible:q5,popVisibleOnce:Y5,rollBottom:sz,rollLeft:j5,rollRight:J5,rollTop:tz,rollVisibleBottom:rz,rollVisibleLeft:K5,rollVisibleOnceBottom:oz,rollVisibleOnceLeft:Z5,rollVisibleOnceRight:ez,rollVisibleOnceTop:iz,rollVisibleRight:Q5,rollVisibleTop:nz,slideBottom:gz,slideLeft:az,slideRight:uz,slideTop:hz,slideVisibleBottom:_z,slideVisibleLeft:lz,slideVisibleOnceBottom:vz,slideVisibleOnceLeft:cz,slideVisibleOnceRight:dz,slideVisibleOnceTop:mz,slideVisibleRight:fz,slideVisibleTop:pz};function yz(n){const e="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;",t="aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------",i=new RegExp(e.split("").join("|"),"g");return n.toString().replace(/[A-Z]/g,s=>`-${s}`).toLowerCase().replace(/\s+/g,"-").replace(i,s=>t.charAt(e.indexOf(s))).replace(/&/g,"-and-").replace(/[^\w\-]+/g,"").replace(/-{2,}/g,"-").replace(/^-+/,"").replace(/-+$/,"")}const Sw=Symbol(""),Ew={preset:{type:String,required:!1},instance:{type:Object,required:!1},variants:{type:Object,required:!1},initial:{type:Object,required:!1},enter:{type:Object,required:!1},leave:{type:Object,required:!1},visible:{type:Object,required:!1},visibleOnce:{type:Object,required:!1},hovered:{type:Object,required:!1},tapped:{type:Object,required:!1},focused:{type:Object,required:!1},delay:{type:[Number,String],required:!1},duration:{type:[Number,String],required:!1}};function bz(n){return Object.prototype.toString.call(n)==="[object Object]"}function Vg(n){if(Array.isArray(n))return n.map(Vg);if(bz(n)){const e={};for(const t in n)e[t]=Vg(n[t]);return e}return n}function Tw(n){const e=bi({}),t=En(Sw,{}),i=Ee(()=>n.preset==null?{}:t!=null&&n.preset in t?structuredClone(ut(t)[n.preset]):n.preset in Id?structuredClone(Id[n.preset]):{}),s=Ee(()=>({initial:n.initial,enter:n.enter,leave:n.leave,visible:n.visible,visibleOnce:n.visibleOnce,hovered:n.hovered,tapped:n.tapped,focused:n.focused}));function r(l,c){for(const u of["delay","duration"]){if(c[u]==null)continue;const f=Number.parseInt(c[u]);for(const d of["enter","visible","visibleOnce"]){const h=l[d];h!=null&&(h.transition??(h.transition={}),h.transition[u]=f)}}return l}const o=Ee(()=>{const l=TT({},s.value,i.value,n.variants||{});return r({...l},n)});function a(l,c,u){var d;l.props??(l.props={}),(d=l.props).style??(d.style={}),l.props.style={...l.props.style,...u};const f=r(Vg(o.value),l.props);return l.props.onVnodeMounted=({el:h})=>{e[c]=xw(h,f)},l.props.onVnodeUpdated=({el:h})=>{const p=zh(e[c].state);for(const[_,g]of Object.entries(p))h.style[_]=g},l}return{motionConfig:o,setNodeInstance:a}}const xz=fn({name:"Motion",props:{...Ew,is:{type:[String,Object],default:"div"}},setup(n){const e=A0(),{motionConfig:t,setNodeInstance:i}=Tw(n);return()=>{const s=zh(t.value.initial||{}),r=Ds(n.is,void 0,e);return i(r,0,s),r}}}),Mz=fn({name:"MotionGroup",props:{...Ew,is:{type:[String,Object],required:!1}},setup(n){const e=A0(),{motionConfig:t,setNodeInstance:i}=Tw(n);return()=>{var o;const s=zh(t.value.initial||{}),r=((o=e.default)==null?void 0:o.call(e))||[];for(let a=0;a
'};t.configure=function(p){var _,g;for(_ in p)g=p[_],g!==void 0&&p.hasOwnProperty(_)&&(i[_]=g);return this},t.status=null,t.set=function(p){var _=t.isStarted();p=s(p,i.minimum,1),t.status=p===1?null:p;var g=t.render(!_),m=g.querySelector(i.barSelector),y=i.speed,b=i.easing;return g.offsetWidth,a(function(v){i.positionUsing===""&&(i.positionUsing=t.getPositioningCSS()),l(m,o(p,y,b)),p===1?(l(g,{transition:"none",opacity:1}),g.offsetWidth,setTimeout(function(){l(g,{transition:"all "+y+"ms linear",opacity:0}),setTimeout(function(){t.remove(),v()},y)},y)):setTimeout(v,y)}),this},t.isStarted=function(){return typeof t.status=="number"},t.start=function(){t.status||t.set(0);var p=function(){setTimeout(function(){t.status&&(t.trickle(),p())},i.trickleSpeed)};return i.trickle&&p(),this},t.done=function(p){return!p&&!t.status?this:t.inc(.3+.5*Math.random()).set(1)},t.inc=function(p){var _=t.status;return _?(typeof p!="number"&&(p=(1-_)*s(Math.random()*_,.1,.95)),_=s(_+p,0,.994),t.set(_)):t.start()},t.trickle=function(){return t.inc(Math.random()*i.trickleRate)},function(){var p=0,_=0;t.promise=function(g){return!g||g.state()==="resolved"?this:(_===0&&t.start(),p++,_++,g.always(function(){_--,_===0?(p=0,t.done()):t.set((p-_)/p)}),this)}}(),t.render=function(p){if(t.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var _=document.createElement("div");_.id="nprogress",_.innerHTML=i.template;var g=_.querySelector(i.barSelector),m=p?"-100":r(t.status||0),y=document.querySelector(i.parent),b;return l(g,{transition:"all 0 linear",transform:"translate3d("+m+"%,0,0)"}),i.showSpinner||(b=_.querySelector(i.spinnerSelector),b&&h(b)),y!=document.body&&u(y,"nprogress-custom-parent"),y.appendChild(_),_},t.remove=function(){f(document.documentElement,"nprogress-busy"),f(document.querySelector(i.parent),"nprogress-custom-parent");var p=document.getElementById("nprogress");p&&h(p)},t.isRendered=function(){return!!document.getElementById("nprogress")},t.getPositioningCSS=function(){var p=document.body.style,_="WebkitTransform"in p?"Webkit":"MozTransform"in p?"Moz":"msTransform"in p?"ms":"OTransform"in p?"O":"";return _+"Perspective"in p?"translate3d":_+"Transform"in p?"translate":"margin"};function s(p,_,g){return p<_?_:p>g?g:p}function r(p){return(-1+p)*100}function o(p,_,g){var m;return i.positionUsing==="translate3d"?m={transform:"translate3d("+r(p)+"%,0,0)"}:i.positionUsing==="translate"?m={transform:"translate("+r(p)+"%,0)"}:m={"margin-left":r(p)+"%"},m.transition="all "+_+"ms "+g,m}var a=function(){var p=[];function _(){var g=p.shift();g&&g(_)}return function(g){p.push(g),p.length==1&&_()}}(),l=function(){var p=["Webkit","O","Moz","ms"],_={};function g(v){return v.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(T,E){return E.toUpperCase()})}function m(v){var T=document.body.style;if(v in T)return v;for(var E=p.length,S=v.charAt(0).toUpperCase()+v.slice(1),P;E--;)if(P=p[E]+S,P in T)return P;return v}function y(v){return v=g(v),_[v]||(_[v]=m(v))}function b(v,T,E){T=y(T),v.style[T]=E}return function(v,T){var E=arguments,S,P;if(E.length==2)for(S in T)P=T[S],P!==void 0&&T.hasOwnProperty(S)&&b(v,S,P);else b(v,E[1],E[2])}}();function c(p,_){var g=typeof p=="string"?p:d(p);return g.indexOf(" "+_+" ")>=0}function u(p,_){var g=d(p),m=g+_;c(g,_)||(p.className=m.substring(1))}function f(p,_){var g=d(p),m;c(p,_)&&(m=g.replace(" "+_+" "," "),p.className=m.substring(1,m.length-1))}function d(p){return(" "+(p.className||"")+" ").replace(/\s+/gi," ")}function h(p){p&&p.parentNode&&p.parentNode.removeChild(p)}return t})}(Rf)),Rf.exports}var Az=wz();const ww=Ez(Az);/*! - * pinia v3.0.1 +}`;class fF{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const s=new Wt,r=e.properties.get(s);r.__webglTexture=t.texture,(t.depthNear!==i.depthNear||t.depthFar!==i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=s}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ki({vertexShader:cF,fragmentShader:uF,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new $t(new Ba(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class dF extends rs{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,d=null,h=null,p=null;const _=new fF,g=t.getContextAttributes();let m=null,y=null;const b=[],v=[],T=new de;let E=null;const S=new Kt;S.viewport=new gt;const P=new Kt;P.viewport=new gt;const x=[S,P],M=new ZE;let L=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(re){let ge=b[re];return ge===void 0&&(ge=new Mf,b[re]=ge),ge.getTargetRaySpace()},this.getControllerGrip=function(re){let ge=b[re];return ge===void 0&&(ge=new Mf,b[re]=ge),ge.getGripSpace()},this.getHand=function(re){let ge=b[re];return ge===void 0&&(ge=new Mf,b[re]=ge),ge.getHandSpace()};function H(re){const ge=v.indexOf(re.inputSource);if(ge===-1)return;const xe=b[ge];xe!==void 0&&(xe.update(re.inputSource,re.frame,c||o),xe.dispatchEvent({type:re.type,data:re.inputSource}))}function Y(){s.removeEventListener("select",H),s.removeEventListener("selectstart",H),s.removeEventListener("selectend",H),s.removeEventListener("squeeze",H),s.removeEventListener("squeezestart",H),s.removeEventListener("squeezeend",H),s.removeEventListener("end",Y),s.removeEventListener("inputsourceschange",ee);for(let re=0;re=0&&(v[X]=null,b[X].disconnect(xe))}for(let ge=0;ge=v.length){v.push(xe),X=fe;break}else if(v[fe]===null){v[fe]=xe,X=fe;break}if(X===-1)break}const ae=b[X];ae&&ae.connect(xe)}}const K=new B,Q=new B;function Z(re,ge,xe){K.setFromMatrixPosition(ge.matrixWorld),Q.setFromMatrixPosition(xe.matrixWorld);const X=K.distanceTo(Q),ae=ge.projectionMatrix.elements,fe=xe.projectionMatrix.elements,ce=ae[14]/(ae[10]-1),Ue=ae[14]/(ae[10]+1),k=(ae[9]+1)/ae[5],z=(ae[9]-1)/ae[5],R=(ae[8]-1)/ae[0],te=(fe[8]+1)/fe[0],G=ce*R,W=ce*te,C=X/(-R+te),I=C*-R;if(ge.matrixWorld.decompose(re.position,re.quaternion,re.scale),re.translateX(I),re.translateZ(C),re.matrixWorld.compose(re.position,re.quaternion,re.scale),re.matrixWorldInverse.copy(re.matrixWorld).invert(),ae[10]===-1)re.projectionMatrix.copy(ge.projectionMatrix),re.projectionMatrixInverse.copy(ge.projectionMatrixInverse);else{const N=ce+C,A=Ue+C,w=G-I,U=W+(X-I),O=k*Ue/A*N,V=z*Ue/A*N;re.projectionMatrix.makePerspective(w,U,O,V,N,A),re.projectionMatrixInverse.copy(re.projectionMatrix).invert()}}function he(re,ge){ge===null?re.matrixWorld.copy(re.matrix):re.matrixWorld.multiplyMatrices(ge.matrixWorld,re.matrix),re.matrixWorldInverse.copy(re.matrixWorld).invert()}this.updateCamera=function(re){if(s===null)return;let ge=re.near,xe=re.far;_.texture!==null&&(_.depthNear>0&&(ge=_.depthNear),_.depthFar>0&&(xe=_.depthFar)),M.near=P.near=S.near=ge,M.far=P.far=S.far=xe,(L!==M.near||F!==M.far)&&(s.updateRenderState({depthNear:M.near,depthFar:M.far}),L=M.near,F=M.far),S.layers.mask=re.layers.mask|2,P.layers.mask=re.layers.mask|4,M.layers.mask=S.layers.mask|P.layers.mask;const X=re.parent,ae=M.cameras;he(M,X);for(let fe=0;fe0&&(g.alphaTest.value=m.alphaTest);const y=e.get(m),b=y.envMap,v=y.envMapRotation;b&&(g.envMap.value=b,Kr.copy(v),Kr.x*=-1,Kr.y*=-1,Kr.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Kr.y*=-1,Kr.z*=-1),g.envMapRotation.value.setFromMatrix4(hF.makeRotationFromEuler(Kr)),g.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function o(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function a(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,y,b){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*y,g.scale.value=b*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function u(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function f(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function d(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function h(g,m,y){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===zn&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=y.texture,g.transmissionSamplerSize.value.set(y.width,y.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,m){m.matcap&&(g.matcap.value=m.matcap)}function _(g,m){const y=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(y.matrixWorld),g.nearDistance.value=y.shadow.camera.near,g.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:s}}function mF(n,e,t,i){let s={},r={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,b){const v=b.program;i.uniformBlockBinding(y,v)}function c(y,b){let v=s[y.id];v===void 0&&(p(y),v=u(y),s[y.id]=v,y.addEventListener("dispose",g));const T=b.program;i.updateUBOMapping(y,T);const E=e.render.frame;r[y.id]!==E&&(d(y),r[y.id]=E)}function u(y){const b=f();y.__bindingPointIndex=b;const v=n.createBuffer(),T=y.__size,E=y.usage;return n.bindBuffer(n.UNIFORM_BUFFER,v),n.bufferData(n.UNIFORM_BUFFER,T,E),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,b,v),v}function f(){for(let y=0;y0&&(v+=T-E),y.__size=v,y.__cache={},this}function _(y){const b={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(b.boundary=4,b.storage=4):y.isVector2?(b.boundary=8,b.storage=8):y.isVector3||y.isColor?(b.boundary=16,b.storage=12):y.isVector4?(b.boundary=16,b.storage=16):y.isMatrix3?(b.boundary=48,b.storage=48):y.isMatrix4?(b.boundary=64,b.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),b}function g(y){const b=y.target;b.removeEventListener("dispose",g);const v=o.indexOf(b.__bindingPointIndex);o.splice(v,1),n.deleteBuffer(s[b.id]),delete s[b.id],delete r[b.id]}function m(){for(const y in s)n.deleteBuffer(s[y]);o=[],s={},r={}}return{bind:l,update:c,dispose:m}}class Ef{constructor(e={}){const{canvas:t=Q1(),context:i=null,depth:s=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let h;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=i.getContextAttributes().alpha}else h=o;const p=new Uint32Array(4),_=new Int32Array(4);let g=null,m=null;const y=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Zi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const v=this;let T=!1;this._outputColorSpace=Nn;let E=0,S=0,P=null,x=-1,M=null;const L=new gt,F=new gt;let H=null;const Y=new Ce(0);let ee=0,K=t.width,Q=t.height,Z=1,he=null,be=null;const se=new gt(0,0,K,Q),ye=new gt(0,0,K,Q);let He=!1;const re=new Bc;let ge=!1,xe=!1;const X=new Ye,ae=new Ye,fe=new B,ce=new gt,Ue={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let k=!1;function z(){return P===null?Z:1}let R=i;function te(D,j){return t.getContext(D,j)}try{const D={alpha:!0,depth:s,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Dc}`),t.addEventListener("webglcontextlost",pe,!1),t.addEventListener("webglcontextrestored",Le,!1),t.addEventListener("webglcontextcreationerror",Ie,!1),R===null){const j="webgl2";if(R=te(j,D),R===null)throw te(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let G,W,C,I,N,A,w,U,O,V,$,ue,le,Me,Be,me,Te,Ve,We,Se,Je,it,Lt,q;function Pe(){G=new AN(R),G.init(),it=new lT(R,G),W=new bN(R,G,e,it),C=new aF(R,G),W.reverseDepthBuffer&&d&&C.buffers.depth.setReversed(!0),I=new PN(R),N=new YU,A=new lF(R,G,C,N,W,it,I),w=new MN(v),U=new wN(v),O=new UL(R),Lt=new vN(R,O),V=new CN(R,O,I,Lt),$=new LN(R,V,O,I),We=new IN(R,W,A),me=new xN(N),ue=new qU(v,w,U,G,W,Lt,me),le=new pF(v,N),Me=new KU,Be=new nF(G),Ve=new _N(v,w,U,C,$,h,l),Te=new rF(v,$,W),q=new mF(R,I,W,C),Se=new yN(R,G,I),Je=new RN(R,G,I),I.programs=ue.programs,v.capabilities=W,v.extensions=G,v.properties=N,v.renderLists=Me,v.shadowMap=Te,v.state=C,v.info=I}Pe();const oe=new dF(v,R);this.xr=oe,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const D=G.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){const D=G.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(D){D!==void 0&&(Z=D,this.setSize(K,Q,!1))},this.getSize=function(D){return D.set(K,Q)},this.setSize=function(D,j,ne=!0){if(oe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}K=D,Q=j,t.width=Math.floor(D*Z),t.height=Math.floor(j*Z),ne===!0&&(t.style.width=D+"px",t.style.height=j+"px"),this.setViewport(0,0,D,j)},this.getDrawingBufferSize=function(D){return D.set(K*Z,Q*Z).floor()},this.setDrawingBufferSize=function(D,j,ne){K=D,Q=j,Z=ne,t.width=Math.floor(D*ne),t.height=Math.floor(j*ne),this.setViewport(0,0,D,j)},this.getCurrentViewport=function(D){return D.copy(L)},this.getViewport=function(D){return D.copy(se)},this.setViewport=function(D,j,ne,ie){D.isVector4?se.set(D.x,D.y,D.z,D.w):se.set(D,j,ne,ie),C.viewport(L.copy(se).multiplyScalar(Z).round())},this.getScissor=function(D){return D.copy(ye)},this.setScissor=function(D,j,ne,ie){D.isVector4?ye.set(D.x,D.y,D.z,D.w):ye.set(D,j,ne,ie),C.scissor(F.copy(ye).multiplyScalar(Z).round())},this.getScissorTest=function(){return He},this.setScissorTest=function(D){C.setScissorTest(He=D)},this.setOpaqueSort=function(D){he=D},this.setTransparentSort=function(D){be=D},this.getClearColor=function(D){return D.copy(Ve.getClearColor())},this.setClearColor=function(){Ve.setClearColor(...arguments)},this.getClearAlpha=function(){return Ve.getClearAlpha()},this.setClearAlpha=function(){Ve.setClearAlpha(...arguments)},this.clear=function(D=!0,j=!0,ne=!0){let ie=0;if(D){let J=!1;if(P!==null){const ve=P.texture.format;J=ve===ch||ve===lh||ve===Nc}if(J){const ve=P.texture.type,Re=ve===is||ve===Us||ve===ba||ve===xa||ve===rh||ve===oh,Oe=Ve.getClearColor(),Fe=Ve.getClearAlpha(),Qe=Oe.r,Ze=Oe.g,Ge=Oe.b;Re?(p[0]=Qe,p[1]=Ze,p[2]=Ge,p[3]=Fe,R.clearBufferuiv(R.COLOR,0,p)):(_[0]=Qe,_[1]=Ze,_[2]=Ge,_[3]=Fe,R.clearBufferiv(R.COLOR,0,_))}else ie|=R.COLOR_BUFFER_BIT}j&&(ie|=R.DEPTH_BUFFER_BIT),ne&&(ie|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(ie)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",pe,!1),t.removeEventListener("webglcontextrestored",Le,!1),t.removeEventListener("webglcontextcreationerror",Ie,!1),Ve.dispose(),Me.dispose(),Be.dispose(),N.dispose(),w.dispose(),U.dispose(),$.dispose(),Lt.dispose(),q.dispose(),ue.dispose(),oe.dispose(),oe.removeEventListener("sessionstart",iv),oe.removeEventListener("sessionend",sv),Lr.stop()};function pe(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function Le(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;const D=I.autoReset,j=Te.enabled,ne=Te.autoUpdate,ie=Te.needsUpdate,J=Te.type;Pe(),I.autoReset=D,Te.enabled=j,Te.autoUpdate=ne,Te.needsUpdate=ie,Te.type=J}function Ie(D){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",D.statusMessage)}function ot(D){const j=D.target;j.removeEventListener("dispose",ot),Vt(j)}function Vt(D){vn(D),N.remove(D)}function vn(D){const j=N.get(D).programs;j!==void 0&&(j.forEach(function(ne){ue.releaseProgram(ne)}),D.isShaderMaterial&&ue.releaseShaderCache(D))}this.renderBufferDirect=function(D,j,ne,ie,J,ve){j===null&&(j=Ue);const Re=J.isMesh&&J.matrixWorld.determinant()<0,Oe=YA(D,j,ne,ie,J);C.setMaterial(ie,Re);let Fe=ne.index,Qe=1;if(ie.wireframe===!0){if(Fe=V.getWireframeAttribute(ne),Fe===void 0)return;Qe=2}const Ze=ne.drawRange,Ge=ne.attributes.position;let pt=Ze.start*Qe,bt=(Ze.start+Ze.count)*Qe;ve!==null&&(pt=Math.max(pt,ve.start*Qe),bt=Math.min(bt,(ve.start+ve.count)*Qe)),Fe!==null?(pt=Math.max(pt,0),bt=Math.min(bt,Fe.count)):Ge!=null&&(pt=Math.max(pt,0),bt=Math.min(bt,Ge.count));const qt=bt-pt;if(qt<0||qt===1/0)return;Lt.setup(J,ie,Oe,ne,Fe);let Ht,_t=Se;if(Fe!==null&&(Ht=O.get(Fe),_t=Je,_t.setIndex(Ht)),J.isMesh)ie.wireframe===!0?(C.setLineWidth(ie.wireframeLinewidth*z()),_t.setMode(R.LINES)):_t.setMode(R.TRIANGLES);else if(J.isLine){let Xe=ie.linewidth;Xe===void 0&&(Xe=1),C.setLineWidth(Xe*z()),J.isLineSegments?_t.setMode(R.LINES):J.isLineLoop?_t.setMode(R.LINE_LOOP):_t.setMode(R.LINE_STRIP)}else J.isPoints?_t.setMode(R.POINTS):J.isSprite&&_t.setMode(R.TRIANGLES);if(J.isBatchedMesh)if(J._multiDrawInstances!==null)xf("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),_t.renderMultiDrawInstances(J._multiDrawStarts,J._multiDrawCounts,J._multiDrawCount,J._multiDrawInstances);else if(G.get("WEBGL_multi_draw"))_t.renderMultiDraw(J._multiDrawStarts,J._multiDrawCounts,J._multiDrawCount);else{const Xe=J._multiDrawStarts,dn=J._multiDrawCounts,xt=J._multiDrawCount,Ti=Fe?O.get(Fe).bytesPerElement:1,Oo=N.get(ie).currentProgram.getUniforms();for(let ti=0;ti{function ve(){if(ie.forEach(function(Re){N.get(Re).currentProgram.isReady()&&ie.delete(Re)}),ie.size===0){J(D);return}setTimeout(ve,10)}G.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Ei=null;function as(D){Ei&&Ei(D)}function iv(){Lr.stop()}function sv(){Lr.start()}const Lr=new iT;Lr.setAnimationLoop(as),typeof self<"u"&&Lr.setContext(self),this.setAnimationLoop=function(D){Ei=D,oe.setAnimationLoop(D),D===null?Lr.stop():Lr.start()},oe.addEventListener("sessionstart",iv),oe.addEventListener("sessionend",sv),this.render=function(D,j){if(j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),j.parent===null&&j.matrixWorldAutoUpdate===!0&&j.updateMatrixWorld(),oe.enabled===!0&&oe.isPresenting===!0&&(oe.cameraAutoUpdate===!0&&oe.updateCamera(j),j=oe.getCamera()),D.isScene===!0&&D.onBeforeRender(v,D,j,P),m=Be.get(D,b.length),m.init(j),b.push(m),ae.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),re.setFromProjectionMatrix(ae),xe=this.localClippingEnabled,ge=me.init(this.clippingPlanes,xe),g=Me.get(D,y.length),g.init(),y.push(g),oe.enabled===!0&&oe.isPresenting===!0){const ve=v.xr.getDepthSensingMesh();ve!==null&&rp(ve,j,-1/0,v.sortObjects)}rp(D,j,0,v.sortObjects),g.finish(),v.sortObjects===!0&&g.sort(he,be),k=oe.enabled===!1||oe.isPresenting===!1||oe.hasDepthSensing()===!1,k&&Ve.addToRenderList(g,D),this.info.render.frame++,ge===!0&&me.beginShadows();const ne=m.state.shadowsArray;Te.render(ne,D,j),ge===!0&&me.endShadows(),this.info.autoReset===!0&&this.info.reset();const ie=g.opaque,J=g.transmissive;if(m.setupLights(),j.isArrayCamera){const ve=j.cameras;if(J.length>0)for(let Re=0,Oe=ve.length;Re0&&ov(ie,J,D,j),k&&Ve.render(D),rv(g,D,j);P!==null&&S===0&&(A.updateMultisampleRenderTarget(P),A.updateRenderTargetMipmap(P)),D.isScene===!0&&D.onAfterRender(v,D,j),Lt.resetDefaultState(),x=-1,M=null,b.pop(),b.length>0?(m=b[b.length-1],ge===!0&&me.setGlobalState(v.clippingPlanes,m.state.camera)):m=null,y.pop(),y.length>0?g=y[y.length-1]:g=null};function rp(D,j,ne,ie){if(D.visible===!1)return;if(D.layers.test(j.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(j);else if(D.isLight)m.pushLight(D),D.castShadow&&m.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||re.intersectsSprite(D)){ie&&ce.setFromMatrixPosition(D.matrixWorld).applyMatrix4(ae);const Re=$.update(D),Oe=D.material;Oe.visible&&g.push(D,Re,Oe,ne,ce.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(!D.frustumCulled||re.intersectsObject(D))){const Re=$.update(D),Oe=D.material;if(ie&&(D.boundingSphere!==void 0?(D.boundingSphere===null&&D.computeBoundingSphere(),ce.copy(D.boundingSphere.center)):(Re.boundingSphere===null&&Re.computeBoundingSphere(),ce.copy(Re.boundingSphere.center)),ce.applyMatrix4(D.matrixWorld).applyMatrix4(ae)),Array.isArray(Oe)){const Fe=Re.groups;for(let Qe=0,Ze=Fe.length;Qe0&&eu(J,j,ne),ve.length>0&&eu(ve,j,ne),Re.length>0&&eu(Re,j,ne),C.buffers.depth.setTest(!0),C.buffers.depth.setMask(!0),C.buffers.color.setMask(!0),C.setPolygonOffset(!1)}function ov(D,j,ne,ie){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[ie.id]===void 0&&(m.state.transmissionRenderTarget[ie.id]=new ss(1,1,{generateMipmaps:!0,type:G.has("EXT_color_buffer_half_float")||G.has("EXT_color_buffer_float")?Ua:is,minFilter:ji,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ft.workingColorSpace}));const ve=m.state.transmissionRenderTarget[ie.id],Re=ie.viewport||L;ve.setSize(Re.z*v.transmissionResolutionScale,Re.w*v.transmissionResolutionScale);const Oe=v.getRenderTarget();v.setRenderTarget(ve),v.getClearColor(Y),ee=v.getClearAlpha(),ee<1&&v.setClearColor(16777215,.5),v.clear(),k&&Ve.render(ne);const Fe=v.toneMapping;v.toneMapping=Zi;const Qe=ie.viewport;if(ie.viewport!==void 0&&(ie.viewport=void 0),m.setupLightsView(ie),ge===!0&&me.setGlobalState(v.clippingPlanes,ie),eu(D,ne,ie),A.updateMultisampleRenderTarget(ve),A.updateRenderTargetMipmap(ve),G.has("WEBGL_multisampled_render_to_texture")===!1){let Ze=!1;for(let Ge=0,pt=j.length;Ge0),Ge=!!ne.morphAttributes.position,pt=!!ne.morphAttributes.normal,bt=!!ne.morphAttributes.color;let qt=Zi;ie.toneMapped&&(P===null||P.isXRRenderTarget===!0)&&(qt=v.toneMapping);const Ht=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,_t=Ht!==void 0?Ht.length:0,Xe=N.get(ie),dn=m.state.lights;if(ge===!0&&(xe===!0||D!==M)){const Cn=D===M&&ie.id===x;me.setState(ie,D,Cn)}let xt=!1;ie.version===Xe.__version?(Xe.needsLights&&Xe.lightsStateVersion!==dn.state.version||Xe.outputColorSpace!==Oe||J.isBatchedMesh&&Xe.batching===!1||!J.isBatchedMesh&&Xe.batching===!0||J.isBatchedMesh&&Xe.batchingColor===!0&&J.colorTexture===null||J.isBatchedMesh&&Xe.batchingColor===!1&&J.colorTexture!==null||J.isInstancedMesh&&Xe.instancing===!1||!J.isInstancedMesh&&Xe.instancing===!0||J.isSkinnedMesh&&Xe.skinning===!1||!J.isSkinnedMesh&&Xe.skinning===!0||J.isInstancedMesh&&Xe.instancingColor===!0&&J.instanceColor===null||J.isInstancedMesh&&Xe.instancingColor===!1&&J.instanceColor!==null||J.isInstancedMesh&&Xe.instancingMorph===!0&&J.morphTexture===null||J.isInstancedMesh&&Xe.instancingMorph===!1&&J.morphTexture!==null||Xe.envMap!==Fe||ie.fog===!0&&Xe.fog!==ve||Xe.numClippingPlanes!==void 0&&(Xe.numClippingPlanes!==me.numPlanes||Xe.numIntersection!==me.numIntersection)||Xe.vertexAlphas!==Qe||Xe.vertexTangents!==Ze||Xe.morphTargets!==Ge||Xe.morphNormals!==pt||Xe.morphColors!==bt||Xe.toneMapping!==qt||Xe.morphTargetsCount!==_t)&&(xt=!0):(xt=!0,Xe.__version=ie.version);let Ti=Xe.currentProgram;xt===!0&&(Ti=tu(ie,j,J));let Oo=!1,ti=!1,Xa=!1;const Nt=Ti.getUniforms(),ci=Xe.uniforms;if(C.useProgram(Ti.program)&&(Oo=!0,ti=!0,Xa=!0),ie.id!==x&&(x=ie.id,ti=!0),Oo||M!==D){C.buffers.depth.getReversed()?(X.copy(D.projectionMatrix),iP(X),sP(X),Nt.setValue(R,"projectionMatrix",X)):Nt.setValue(R,"projectionMatrix",D.projectionMatrix),Nt.setValue(R,"viewMatrix",D.matrixWorldInverse);const Wn=Nt.map.cameraPosition;Wn!==void 0&&Wn.setValue(R,fe.setFromMatrixPosition(D.matrixWorld)),W.logarithmicDepthBuffer&&Nt.setValue(R,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),(ie.isMeshPhongMaterial||ie.isMeshToonMaterial||ie.isMeshLambertMaterial||ie.isMeshBasicMaterial||ie.isMeshStandardMaterial||ie.isShaderMaterial)&&Nt.setValue(R,"isOrthographic",D.isOrthographicCamera===!0),M!==D&&(M=D,ti=!0,Xa=!0)}if(J.isSkinnedMesh){Nt.setOptional(R,J,"bindMatrix"),Nt.setOptional(R,J,"bindMatrixInverse");const Cn=J.skeleton;Cn&&(Cn.boneTexture===null&&Cn.computeBoneTexture(),Nt.setValue(R,"boneTexture",Cn.boneTexture,A))}J.isBatchedMesh&&(Nt.setOptional(R,J,"batchingTexture"),Nt.setValue(R,"batchingTexture",J._matricesTexture,A),Nt.setOptional(R,J,"batchingIdTexture"),Nt.setValue(R,"batchingIdTexture",J._indirectTexture,A),Nt.setOptional(R,J,"batchingColorTexture"),J._colorsTexture!==null&&Nt.setValue(R,"batchingColorTexture",J._colorsTexture,A));const ui=ne.morphAttributes;if((ui.position!==void 0||ui.normal!==void 0||ui.color!==void 0)&&We.update(J,ne,Ti),(ti||Xe.receiveShadow!==J.receiveShadow)&&(Xe.receiveShadow=J.receiveShadow,Nt.setValue(R,"receiveShadow",J.receiveShadow)),ie.isMeshGouraudMaterial&&ie.envMap!==null&&(ci.envMap.value=Fe,ci.flipEnvMap.value=Fe.isCubeTexture&&Fe.isRenderTargetTexture===!1?-1:1),ie.isMeshStandardMaterial&&ie.envMap===null&&j.environment!==null&&(ci.envMapIntensity.value=j.environmentIntensity),ti&&(Nt.setValue(R,"toneMappingExposure",v.toneMappingExposure),Xe.needsLights&&jA(ci,Xa),ve&&ie.fog===!0&&le.refreshFogUniforms(ci,ve),le.refreshMaterialUniforms(ci,ie,Z,Q,m.state.transmissionRenderTarget[D.id]),Sf.upload(R,lv(Xe),ci,A)),ie.isShaderMaterial&&ie.uniformsNeedUpdate===!0&&(Sf.upload(R,lv(Xe),ci,A),ie.uniformsNeedUpdate=!1),ie.isSpriteMaterial&&Nt.setValue(R,"center",J.center),Nt.setValue(R,"modelViewMatrix",J.modelViewMatrix),Nt.setValue(R,"normalMatrix",J.normalMatrix),Nt.setValue(R,"modelMatrix",J.matrixWorld),ie.isShaderMaterial||ie.isRawShaderMaterial){const Cn=ie.uniformsGroups;for(let Wn=0,op=Cn.length;Wn0&&A.useMultisampledRTT(D)===!1?J=N.get(D).__webglMultisampledFramebuffer:Array.isArray(Ze)?J=Ze[ne]:J=Ze,L.copy(D.viewport),F.copy(D.scissor),H=D.scissorTest}else L.copy(se).multiplyScalar(Z).floor(),F.copy(ye).multiplyScalar(Z).floor(),H=He;if(ne!==0&&(J=ZA),C.bindFramebuffer(R.FRAMEBUFFER,J)&&ie&&C.drawBuffers(D,J),C.viewport(L),C.scissor(F),C.setScissorTest(H),ve){const Fe=N.get(D.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+j,Fe.__webglTexture,ne)}else if(Re){const Fe=N.get(D.texture),Qe=j;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,Fe.__webglTexture,ne,Qe)}else if(D!==null&&ne!==0){const Fe=N.get(D.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Fe.__webglTexture,ne)}x=-1},this.readRenderTargetPixels=function(D,j,ne,ie,J,ve,Re){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Oe=N.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Re!==void 0&&(Oe=Oe[Re]),Oe){C.bindFramebuffer(R.FRAMEBUFFER,Oe);try{const Fe=D.texture,Qe=Fe.format,Ze=Fe.type;if(!W.textureFormatReadable(Qe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!W.textureTypeReadable(Ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}j>=0&&j<=D.width-ie&&ne>=0&&ne<=D.height-J&&R.readPixels(j,ne,ie,J,it.convert(Qe),it.convert(Ze),ve)}finally{const Fe=P!==null?N.get(P).__webglFramebuffer:null;C.bindFramebuffer(R.FRAMEBUFFER,Fe)}}},this.readRenderTargetPixelsAsync=async function(D,j,ne,ie,J,ve,Re){if(!(D&&D.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Oe=N.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&Re!==void 0&&(Oe=Oe[Re]),Oe)if(j>=0&&j<=D.width-ie&&ne>=0&&ne<=D.height-J){C.bindFramebuffer(R.FRAMEBUFFER,Oe);const Fe=D.texture,Qe=Fe.format,Ze=Fe.type;if(!W.textureFormatReadable(Qe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!W.textureTypeReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ge=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Ge),R.bufferData(R.PIXEL_PACK_BUFFER,ve.byteLength,R.STREAM_READ),R.readPixels(j,ne,ie,J,it.convert(Qe),it.convert(Ze),0);const pt=P!==null?N.get(P).__webglFramebuffer:null;C.bindFramebuffer(R.FRAMEBUFFER,pt);const bt=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await nP(R,bt,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Ge),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ve),R.deleteBuffer(Ge),R.deleteSync(bt),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(D,j=null,ne=0){const ie=Math.pow(2,-ne),J=Math.floor(D.image.width*ie),ve=Math.floor(D.image.height*ie),Re=j!==null?j.x:0,Oe=j!==null?j.y:0;A.setTexture2D(D,0),R.copyTexSubImage2D(R.TEXTURE_2D,ne,0,0,Re,Oe,J,ve),C.unbindTexture()};const JA=R.createFramebuffer(),QA=R.createFramebuffer();this.copyTextureToTexture=function(D,j,ne=null,ie=null,J=0,ve=null){ve===null&&(J!==0?(xf("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ve=J,J=0):ve=0);let Re,Oe,Fe,Qe,Ze,Ge,pt,bt,qt;const Ht=D.isCompressedTexture?D.mipmaps[ve]:D.image;if(ne!==null)Re=ne.max.x-ne.min.x,Oe=ne.max.y-ne.min.y,Fe=ne.isBox3?ne.max.z-ne.min.z:1,Qe=ne.min.x,Ze=ne.min.y,Ge=ne.isBox3?ne.min.z:0;else{const ui=Math.pow(2,-J);Re=Math.floor(Ht.width*ui),Oe=Math.floor(Ht.height*ui),D.isDataArrayTexture?Fe=Ht.depth:D.isData3DTexture?Fe=Math.floor(Ht.depth*ui):Fe=1,Qe=0,Ze=0,Ge=0}ie!==null?(pt=ie.x,bt=ie.y,qt=ie.z):(pt=0,bt=0,qt=0);const _t=it.convert(j.format),Xe=it.convert(j.type);let dn;j.isData3DTexture?(A.setTexture3D(j,0),dn=R.TEXTURE_3D):j.isDataArrayTexture||j.isCompressedArrayTexture?(A.setTexture2DArray(j,0),dn=R.TEXTURE_2D_ARRAY):(A.setTexture2D(j,0),dn=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,j.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,j.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,j.unpackAlignment);const xt=R.getParameter(R.UNPACK_ROW_LENGTH),Ti=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Oo=R.getParameter(R.UNPACK_SKIP_PIXELS),ti=R.getParameter(R.UNPACK_SKIP_ROWS),Xa=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,Ht.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,Ht.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Qe),R.pixelStorei(R.UNPACK_SKIP_ROWS,Ze),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Ge);const Nt=D.isDataArrayTexture||D.isData3DTexture,ci=j.isDataArrayTexture||j.isData3DTexture;if(D.isDepthTexture){const ui=N.get(D),Cn=N.get(j),Wn=N.get(ui.__renderTarget),op=N.get(Cn.__renderTarget);C.bindFramebuffer(R.READ_FRAMEBUFFER,Wn.__webglFramebuffer),C.bindFramebuffer(R.DRAW_FRAMEBUFFER,op.__webglFramebuffer);for(let Dr=0;Dr{n.delete(r)};return{on:r=>{n.add(r);const o=()=>e(r);return yr(o),{off:o}},off:e,trigger:(...r)=>Promise.all(Array.from(n).map(o=>o(...r))),clear:()=>{n.clear()}}}const rm=new WeakMap,_F=(...n)=>{var e;const t=n[0],i=(e=wn())==null?void 0:e.proxy;if(i==null&&!Cc())throw new Error("injectLocal must be called in setup");return i&&rm.has(i)&&t in rm.get(i)?rm.get(i)[t]:En(...n)},Sg=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const vF=n=>typeof n<"u",yF=n=>n!=null,bF=Object.prototype.toString,xF=n=>bF.call(n)==="[object Object]",Eg=()=>{};function MF(n,e){function t(...i){return new Promise((s,r)=>{Promise.resolve(n(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(s).catch(r)})}return t}function SF(n,e={}){let t,i,s=Eg;const r=l=>{clearTimeout(l),s(),s=Eg};let o;return l=>{const c=nt(n),u=nt(e.maxWait);return t&&r(t),c<=0||u!==void 0&&u<=0?(i&&(r(i),i=null),Promise.resolve(l())):new Promise((f,d)=>{s=e.rejectOnCancel?d:f,o=l,u&&!i&&(i=setTimeout(()=>{t&&r(t),i=null,f(o())},u)),t=setTimeout(()=>{i&&r(i),i=null,f(l())},c)})}}function Db(n){return n.endsWith("rem")?Number.parseFloat(n)*16:Number.parseFloat(n)}function EF(n,e,t=!1){return e.reduce((i,s)=>(s in n&&(!t||n[s]!==void 0)&&(i[s]=n[s]),i),{})}function TF(n){return wn()}function Il(n){return Array.isArray(n)?n:[n]}function wF(n,e=200,t={}){return MF(SF(e,t),n)}function Ob(n,e=200,t={}){const i=et(n.value),s=wF(()=>{i.value=n.value},e,t);return $e(n,()=>s()),i}function AF(n,e={}){if(!Pt(n))return lS(n);const t=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const i in n.value)t[i]=S0(()=>({get(){return n.value[i]},set(s){var r;if((r=nt(e.replaceRef))!=null?r:!0)if(Array.isArray(n.value)){const a=[...n.value];a[i]=s,n.value=a}else{const a={...n.value,[i]:s};Object.setPrototypeOf(a,Object.getPrototypeOf(n.value)),n.value=a}else n.value[i]=s}}));return t}const hn=nt;function S_(n,e=!0,t){TF()?Hn(n,t):e?n():Er(n)}function CF(n,e=1e3,t={}){const{immediate:i=!0,immediateCallback:s=!1}=t;let r=null;const o=De(!1);function a(){r&&(clearInterval(r),r=null)}function l(){o.value=!1,a()}function c(){const u=nt(e);u<=0||(o.value=!0,s&&n(),a(),o.value&&(r=setInterval(n,u)))}if(i&&Sg&&c(),Pt(e)||typeof e=="function"){const u=$e(e,()=>{o.value&&Sg&&c()});yr(u)}return yr(l),{isActive:o,pause:l,resume:c}}function cT(n,e,t){return $e(n,e,{...t,immediate:!0})}const Vs=Sg?window:void 0;function Li(n){var e;const t=nt(n);return(e=t==null?void 0:t.$el)!=null?e:t}function To(...n){const e=[],t=()=>{e.forEach(a=>a()),e.length=0},i=(a,l,c,u)=>(a.addEventListener(l,c,u),()=>a.removeEventListener(l,c,u)),s=Ee(()=>{const a=Il(nt(n[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),r=cT(()=>{var a,l;return[(l=(a=s.value)==null?void 0:a.map(c=>Li(c)))!=null?l:[Vs].filter(c=>c!=null),Il(nt(s.value?n[1]:n[0])),Il(Ot(s.value?n[2]:n[1])),nt(s.value?n[3]:n[2])]},([a,l,c,u])=>{if(t(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(c!=null&&c.length))return;const f=xF(u)?{...u}:u;e.push(...a.flatMap(d=>l.flatMap(h=>c.map(p=>i(d,h,p,f)))))},{flush:"post"}),o=()=>{r(),t()};return yr(t),o}function RF(){const n=De(!1),e=wn();return e&&Hn(()=>{n.value=!0},e),n}function Fh(n){const e=RF();return Ee(()=>(e.value,!!n()))}function PF(n,e,t={}){const{window:i=Vs,...s}=t;let r;const o=Fh(()=>i&&"MutationObserver"in i),a=()=>{r&&(r.disconnect(),r=void 0)},l=Ee(()=>{const d=nt(n),h=Il(d).map(Li).filter(yF);return new Set(h)}),c=$e(()=>l.value,d=>{a(),o.value&&d.size&&(r=new MutationObserver(e),d.forEach(h=>r.observe(h,s)))},{immediate:!0,flush:"post"}),u=()=>r==null?void 0:r.takeRecords(),f=()=>{c(),a()};return yr(f),{isSupported:o,stop:f,takeRecords:u}}function E_(n,e={}){const{immediate:t=!0,fpsLimit:i=void 0,window:s=Vs,once:r=!1}=e,o=De(!1),a=Ee(()=>i?1e3/nt(i):null);let l=0,c=null;function u(h){if(!o.value||!s)return;l||(l=h);const p=h-l;if(a.value&&pt&&"matchMedia"in t&&typeof t.matchMedia=="function"),r=De(typeof i=="number"),o=De(),a=De(!1),l=c=>{a.value=c.matches};return Rc(()=>{if(r.value){r.value=!s.value;const c=nt(n).split(",");a.value=c.some(u=>{const f=u.includes("not all"),d=u.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),h=u.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let p=!!(d||h);return d&&p&&(p=i>=Db(d[1])),h&&p&&(p=i<=Db(h[1])),f?!p:p});return}s.value&&(o.value=t.matchMedia(nt(n)),a.value=o.value.matches)}),To(o,"change",l,{passive:!0}),Ee(()=>a.value)}function DF(n){return JSON.parse(JSON.stringify(n))}function OF(n={}){const{window:e=Vs}=n,t=De(1),i=uT(()=>`(resolution: ${t.value}dppx)`,n);let s=Eg;return e&&(s=cT(i,()=>t.value=e.devicePixelRatio)),{pixelRatio:Ui(t),stop:s}}function fT(n,e,t={}){const{window:i=Vs,...s}=t;let r;const o=Fh(()=>i&&"ResizeObserver"in i),a=()=>{r&&(r.disconnect(),r=void 0)},l=Ee(()=>{const f=nt(n);return Array.isArray(f)?f.map(d=>Li(d)):[Li(f)]}),c=$e(l,f=>{if(a(),o.value&&i){r=new ResizeObserver(e);for(const d of f)d&&r.observe(d,s)}},{immediate:!0,flush:"post"}),u=()=>{a(),c()};return yr(u),{isSupported:o,stop:u}}function NF(n,e={}){const{reset:t=!0,windowResize:i=!0,windowScroll:s=!0,immediate:r=!0,updateTiming:o="sync"}=e,a=De(0),l=De(0),c=De(0),u=De(0),f=De(0),d=De(0),h=De(0),p=De(0);function _(){const m=Li(n);if(!m){t&&(a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,d.value=0,h.value=0,p.value=0);return}const y=m.getBoundingClientRect();a.value=y.height,l.value=y.bottom,c.value=y.left,u.value=y.right,f.value=y.top,d.value=y.width,h.value=y.x,p.value=y.y}function g(){o==="sync"?_():o==="next-frame"&&requestAnimationFrame(()=>_())}return fT(n,g),$e(()=>Li(n),m=>!m&&g()),PF(n,g,{attributeFilter:["style","class"]}),s&&To("scroll",g,{capture:!0,passive:!0}),i&&To("resize",g,{passive:!0}),S_(()=>{r&&g()}),{height:a,bottom:l,left:c,right:u,top:f,width:d,x:h,y:p,update:g}}function UF(n,e={width:0,height:0},t={}){const{window:i=Vs,box:s="content-box"}=t,r=Ee(()=>{var f,d;return(d=(f=Li(n))==null?void 0:f.namespaceURI)==null?void 0:d.includes("svg")}),o=De(e.width),a=De(e.height),{stop:l}=fT(n,([f])=>{const d=s==="border-box"?f.borderBoxSize:s==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(i&&r.value){const h=Li(n);if(h){const p=h.getBoundingClientRect();o.value=p.width,a.value=p.height}}else if(d){const h=Il(d);o.value=h.reduce((p,{inlineSize:_})=>p+_,0),a.value=h.reduce((p,{blockSize:_})=>p+_,0)}else o.value=f.contentRect.width,a.value=f.contentRect.height},t);S_(()=>{const f=Li(n);f&&(o.value="offsetWidth"in f?f.offsetWidth:e.width,a.value="offsetHeight"in f?f.offsetHeight:e.height)});const c=$e(()=>Li(n),f=>{o.value=f?e.width:0,a.value=f?e.height:0});function u(){l(),c()}return{width:o,height:a,stop:u}}function FF(n){var e;const t=De(0);if(typeof performance>"u")return t;const i=(e=n==null?void 0:n.every)!=null?e:10;let s=performance.now(),r=0;return E_(()=>{if(r+=1,r>=i){const o=performance.now(),a=o-s;t.value=Math.round(1e3/(a/r)),s=o,r=0}}),t}function kF(n={}){const e=et(),t=Fh(()=>typeof performance<"u"&&"memory"in performance);if(t.value){const{interval:i=1e3}=n;CF(()=>{e.value=performance.memory},i,{immediate:n.immediate,immediateCallback:n.immediateCallback})}return{isSupported:t,memory:e}}const dT={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},BF=Object.keys(dT);function zF(n={}){const{target:e=Vs}=n,t=De(!1),i=et(n.initialValue||{});Object.assign(i.value,dT,i.value);const s=r=>{t.value=!0,!(n.pointerTypes&&!n.pointerTypes.includes(r.pointerType))&&(i.value=EF(r,BF,!1))};if(e){const r={passive:!0};To(e,["pointerdown","pointermove","pointerup"],s,r),To(e,"pointerleave",()=>t.value=!1,r)}return{...AF(i),isInside:t}}function hG(n,e,t,i={}){var s,r,o;const{clone:a=!1,passive:l=!1,eventName:c,deep:u=!1,defaultValue:f,shouldEmit:d}=i,h=wn(),p=t||(h==null?void 0:h.emit)||((s=h==null?void 0:h.$emit)==null?void 0:s.bind(h))||((o=(r=h==null?void 0:h.proxy)==null?void 0:r.$emit)==null?void 0:o.bind(h==null?void 0:h.proxy));let _=c;_=_||`update:${e.toString()}`;const g=b=>a?typeof a=="function"?a(b):DF(b):b,m=()=>vF(n[e])?g(n[e]):f,y=b=>{d?d(b)&&p(_,b):p(_,b)};if(l){const b=m(),v=et(b);let T=!1;return $e(()=>n[e],E=>{T||(T=!0,v.value=g(E),Er(()=>T=!1))}),$e(v,E=>{!T&&(E!==n[e]||u)&&y(E)},{deep:u}),v}else return Ee({get(){return m()},set(b){y(b)}})}function VF(n={}){const{window:e=Vs,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:i=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:r=!0,type:o="inner"}=n,a=De(t),l=De(i),c=()=>{if(e)if(o==="outer")a.value=e.outerWidth,l.value=e.outerHeight;else if(o==="visual"&&e.visualViewport){const{width:f,height:d,scale:h}=e.visualViewport;a.value=Math.round(f*h),l.value=Math.round(d*h)}else r?(a.value=e.innerWidth,l.value=e.innerHeight):(a.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight)};c(),S_(c);const u={passive:!0};if(To("resize",c,u),e&&o==="visual"&&e.visualViewport&&To(e.visualViewport,"resize",c,u),s){const f=uT("(orientation: portrait)");$e(f,()=>c())}return{width:a,height:l}}var HF=Object.defineProperty,GF=(n,e,t)=>e in n?HF(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Nb=(n,e,t)=>GF(n,typeof e!="symbol"?e+"":e,t);const WF="@tresjs/core",XF="module",$F="4.3.3",qF="pnpm@9.15.5",YF="Declarative ThreeJS using Vue Components",jF="Alvaro Saburido (https://github.com/alvarosabu/)",KF="MIT",ZF={type:"git",url:"git+https://github.com/Tresjs/tres.git"},JF=["vue","3d","threejs","three","threejs-vue"],QF=!1,ek={".":{types:"./dist/index.d.ts",import:"./dist/tres.js",require:"./dist/tres.umd.cjs"},"./components":{types:"./dist/src/components/index.d.ts"},"./composables":{types:"./dist/src/composables/index.d.ts"},"./types":{types:"./dist/src/types/index.d.ts"},"./utils":{types:"./dist/src/utils/index.d.ts"},"./*":"./*"},tk="./dist/tres.js",nk="./dist/tres.js",ik="./dist/index.d.ts",sk=["*.d.ts","dist"],rk={access:"public"},ok={dev:"pnpm --filter='./playground/vue' dev","dev:nuxt":"pnpm --filter='./playground/nuxt' dev",build:"vite build",test:"vitest","test:ci":"vitest run","test:ui":"vitest --ui --coverage.enabled=true",release:"release-it",coverage:"vitest run --coverage",lint:"eslint .","lint:fix":"eslint . --fix","docs:dev":"vitepress dev docs","docs:build":"vitepress build docs","docs:serve":"vitepress serve docs","docs:preview":"vitepress preview docs","docs:contributors":"esno scripts/update-contributors.ts"},ak={three:">=0.133",vue:">=3.4"},lk={"@alvarosabu/utils":"^3.2.0","@vue/devtools-api":"^6.6.3","@vueuse/core":"^12.5.0"},ck={"@release-it/conventional-changelog":"^10.0.0","@stackblitz/sdk":"^1.11.0","@tresjs/cientos":"4.1.0","@tresjs/eslint-config":"^1.4.0","@types/three":"^0.173.0","@typescript-eslint/eslint-plugin":"^8.23.0","@typescript-eslint/parser":"^8.23.0","@vitejs/plugin-vue":"^5.2.1","@vitest/coverage-c8":"^0.33.0","@vitest/coverage-v8":"^3.0.5","@vitest/ui":"^3.0.5","@vue/test-utils":"^2.4.6",eslint:"^9.19.0","eslint-plugin-vue":"^9.32.0",esno:"^4.8.0",gsap:"^3.12.7",jsdom:"^26.0.0",kolorist:"^1.8.0",ohmyfetch:"^0.4.21",pathe:"^2.0.2","release-it":"^18.1.2","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-copy":"^3.5.0","rollup-plugin-visualizer":"^5.14.0",sponsorkit:"^16.3.0",three:"^0.173.0",unocss:"^65.4.3",unplugin:"^2.1.2","unplugin-vue-components":"^28.0.0",vite:"^6.1.0","vite-plugin-banner":"^0.8.0","vite-plugin-dts":"4.5.0","vite-plugin-inspect":"^10.1.0","vite-plugin-require-transform":"^1.0.21","vite-svg-loader":"^5.1.0",vitepress:"1.6.3",vitest:"3.0.5",vue:"3.5.13","vue-demi":"^0.14.10"},uk={name:WF,type:XF,version:$F,packageManager:qF,description:YF,author:jF,license:KF,repository:ZF,keywords:JF,sideEffects:QF,exports:ek,main:tk,module:nk,types:ik,files:sk,publishConfig:rk,scripts:ok,peerDependencies:ak,dependencies:lk,devDependencies:ck};class fk extends $t{constructor(...e){super(...e),Nb(this,"type","HightlightMesh"),Nb(this,"createTime"),this.createTime=Date.now()}onBeforeRender(){const e=(Date.now()-this.createTime)/1e3,t=1+.07*Math.sin(2.5*e);this.scale.set(t,t,t)}}function Tg(n){return typeof n>"u"}function wd(n){return Array.isArray(n)}function dk(n){return typeof n=="number"}function hT(n){return typeof n=="string"}function ro(n){return typeof n=="function"}function Hs(n){return n===Object(n)&&!wd(n)&&!ro(n)}function ur(n){return Hs(n)&&"isObject3D"in n&&!!n.isObject3D}function Ub(n){return Hs(n)&&"isCamera"in n&&!!n.isCamera}function hk(n){return Hs(n)&&"isBufferGeometry"in n&&!!n.isBufferGeometry}function pk(n){return Hs(n)&&"isMaterial"in n&&!!n.isMaterial}function mk(n){return Hs(n)&&"isLight"in n&&!!n.isLight}function gk(n){return Hs(n)&&"isFog"in n&&!!n.isFog}function _k(n){return Hs(n)&&"isScene"in n&&!!n.isScene}function Qu(n){return ur(n)||hk(n)||pk(n)||gk(n)}function vk(n){return Hs(n)&&!!n.isPrimitive}const pT=(n,e)=>{for(const t of Object.keys(e))e[t]instanceof Object&&Object.assign(e[t],pT(n[t],e[t]));return Object.assign(n||{},e),n},yk="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",bk=Sk(yk);function Fb(n){return n&&n.nodeType===1}function ef(n){return n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const xk=/\B([A-Z])/g;function Mk(n){return n.replace(xk,"-$1").toLowerCase()}function Sk(n,e){const t=Object.create(null),i=n.split(",");for(let s=0;s!!t[s.toLowerCase()]:s=>!!t[s]}const kb=(n,e)=>{if(!e)return;const t=Array.isArray(e)?e:e.match(/([^[.\]])+/g);return t==null?void 0:t.reduce((i,s)=>i&&i[s],n)},Ek=(n,e,t)=>{const i=Array.isArray(e)?e:e.match(/([^[.\]])+/g);i&&i.reduce((s,r,o)=>(s[r]===void 0&&(s[r]={}),o===i.length-1&&(s[r]=t),s[r]),n)};function mT(n,e){if(Fb(n)&&Fb(e)){const s=n.attributes,r=e.attributes;return s.length!==r.length?!1:Array.from(s).every(({name:o,value:a})=>e.getAttribute(o)===a)}if(n===e)return!0;if(n===null||typeof n!="object"||e===null||typeof e!="object")return!1;const t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(const s of t)if(!i.includes(s)||!mT(n[s],e[s]))return!1;return!0}function Tk(n,e){if(!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length)return!1;for(let t=0;t{if(l.uuid===e)return l;for(const c of l.children){const u=s(c);if(u)return u}},r=s(n);if(!r){console.warn("Object with UUID not found in the scene.");return}let o=r;for(let l=0;lgT(i)),!(n instanceof gh)){const i=n;n&&((t=n.dispose)==null||t.call(n)),i.geometry&&i.geometry.dispose(),Array.isArray(i.material)?i.material.forEach(s=>Bb(s)):i.material&&Bb(i.material)}}function Rk(n,e){let t=0;for(let i=0;it===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join("")}const Vb=/-\d+$/;function Pk(n,e,t){if(hT(t)){if(Vb.test(t)){const r=t.replace(Vb,""),{target:o,key:a}=wg(n,r);if(!Array.isArray(o[a])){const l=o[a],c=[];c.__tresDetach=()=>{c.every(u=>Tg(u))&&(o[a]=l)},o[a]=c}}const{target:i,key:s}=wg(n,t);e.__tres.previousAttach=i[s],i[s]=Ca(e)}else e.__tres.previousAttach=t(n,e)}function Ik(n,e,t){var i,s,r;if(hT(t)){const{target:o,key:a}=wg(n,t),l=e.__tres.previousAttach;l===void 0?delete o[a]:o[a]=l,"__tresDetach"in o&&o.__tresDetach()}else(s=(i=e.__tres)==null?void 0:i.previousAttach)==null||s.call(i,n,e);(r=e.__tres)==null||delete r.previousAttach}function no(n,e,t){const i=n;return i.__tres={type:"unknown",eventCount:0,root:t,handlers:{},memoizedProps:{},objects:[],parent:null,previousAttach:null,...e},i.__tres.attach||(i.isMaterial?i.__tres.attach="material":i.isBufferGeometry?i.__tres.attach="geometry":i.isFog&&(i.__tres.attach="fog")),i}function _T(n){var e;const t=(e=n==null?void 0:n.__tres)==null?void 0:e.root;t&&t.render&&t.render.canBeInvalidated.value&&t.invalidate()}function Lk(n,e,t){var i;if(!ro(n.setPixelRatio))return;let s=0;if(t&&wd(t)){const r=t;if(r.length>=2){const[o,a]=r;s=K0.clamp(e,o,a)}}else dk(t)?s=t:s=e;s!==((i=n.getPixelRatio)==null?void 0:i.call(n))&&n.setPixelRatio(s)}function Dk(n,e,t,i,s){const r=[...e.__tres.objects],o=Ca(e);if(n=Ca(n),o===n)return!0;const a=no(n,e.__tres??{},s),l=e.parent??e.__tres.parent??null,c={...e.__tres.memoizedProps};delete c.object;for(const u of r)vT(u,s),yT(u,s);o.__tres.objects=[],i.remove(e);for(const[u,f]of Object.entries(c))i.patchProp(a,u,a[u],f);t(n),i.insert(e,l);for(const u of r)i.insert(u,e);return!0}function Ca(n){return vk(n)?(n.object.__tres=n.__tres,n.object):n}function vT(n,e){var t,i,s,r;const o=((t=n.__tres)==null?void 0:t.parent)||e.scene.value;n.__tres&&(n.__tres.parent=null),o&&o.__tres&&"objects"in o.__tres&&Rk(o.__tres.objects,a=>a!==n),(i=n.__tres)!=null&&i.attach?Ik(o,n,n.__tres.attach):((r=(s=n.parent)==null?void 0:s.remove)==null||r.call(s,Ca(n)),n.parent=null)}function yT(n,e){var t;(t=n.traverse)==null||t.call(n,i=>{var s;e.deregisterCamera(i),(s=e.eventManager)==null||s.deregisterPointerMissedObject(i)}),e.deregisterCamera(n),_T(n)}const Ok=({sizes:n})=>{const e=et([]),t=Ee(()=>e.value[0]),i=o=>{const a=o instanceof Fc?o:e.value.find(c=>c.uuid===o);if(!a)return;const l=e.value.filter(({uuid:c})=>c!==a.uuid);e.value=[a,...l]},s=(o,a=!1)=>{if(Ub(o)){const l=o;if(e.value.some(({uuid:c})=>c===l.uuid))return;a?i(l):e.value.push(l)}},r=o=>{if(Ub(o)){const a=o;e.value=e.value.filter(({uuid:l})=>l!==a.uuid)}};return Rc(()=>{n.aspectRatio.value&&e.value.forEach(o=>{!o.manual&&(o instanceof Kt||Nk(o))&&(o instanceof Kt?o.aspect=n.aspectRatio.value:(o.left=n.width.value*-.5,o.right=n.width.value*.5,o.top=n.height.value*.5,o.bottom=n.height.value*-.5),o.updateProjectionMatrix())})}),ns(()=>{e.value=[]}),{camera:t,cameras:e,registerCamera:s,deregisterCamera:r,setCameraActive:i}};function Nk(n){return n.hasOwnProperty("isOrthographicCamera")&&n.isOrthographicCamera}const Ad="[TresJS ▲ ■ ●] ";function Uk(...n){typeof n[0]=="string"?n[0]=Ad+n[0]:n.unshift(Ad),console.error(...n)}function Fk(...n){typeof n[0]=="string"?n[0]=Ad+n[0]:n.unshift(Ad),console.warn(...n)}function kk(n,e){}function bT(){return{logError:Uk,logWarning:Fk,logMessage:kk}}const Ag=et({}),Cg=n=>Object.assign(Ag.value,n);function om(){const n=new Map,e=new Set;let t=0,i=!1;const s=()=>{const o=Array.from(n.entries()).sort((a,l)=>{const c=a[1].priority-l[1].priority;return c===0?a[1].addI-l[1].addI:c});e.clear(),o.forEach(a=>e.add(a[0]))},r=o=>{n.delete(o),e.delete(o)};return{on:(o,a=0)=>{n.set(o,{priority:a,addI:t++});const l=()=>r(o);return yr(l),i=!0,{off:l}},off:r,trigger:(...o)=>{i&&(s(),i=!1),e.forEach(a=>a(...o))},dispose:()=>{n.clear(),e.clear()},get count(){return n.size}}}function Bk(){let n=!0,e=!0,t=!1;const i=new Nh(!1),s=et(i.running),r=et(!1);let o;const a=K0.generateUUID();let l=null;const c=om(),u=om(),f=om();E();let d={};function h(S){d=S}function p(S,P,x=0){switch(P){case"before":return c.on(S,x);case"render":return l||(l=S),u.dispose(),u.on(S);case"after":return f.on(S,x)}}function _(){e&&(e=!1,E(),T())}function g(){e=!0,E(),cancelAnimationFrame(o)}function m(){t=!1,E()}function y(){t=!0,E()}function b(){r.value=!0}function v(){r.value=!1}function T(){if(!n){o=requestAnimationFrame(T);return}const S=i.getDelta(),P=i.getElapsedTime(),x={camera:Ot(d.camera),scene:Ot(d.scene),renderer:Ot(d.renderer),raycaster:Ot(d.raycaster),controls:Ot(d.controls),invalidate:d.invalidate,advance:d.advance},M={delta:S,elapsed:P,clock:i,...x};s.value&&c.trigger(M),r.value||(u.count?u.trigger(M):l&&l(M)),s.value&&f.trigger(M),o=requestAnimationFrame(T)}function E(){const S=!e&&!t;i.running!==S&&(i.running?i.stop():i.start()),s.value=i.running}return{loopId:a,register:(S,P,x)=>p(S,P,x),start:_,stop:g,pause:y,resume:m,pauseRender:b,resumeRender:v,isRenderPaused:r,isActive:s,setContext:h,setReady:S=>n=S}}function T_(n){let e=0;return n.traverse(t=>{if(t.isMesh&&t.geometry&&t.type!=="HightlightMesh"){const i=t.geometry,s=i.attributes.position.count*3*Float32Array.BYTES_PER_ELEMENT,r=i.index?i.index.count*Uint32Array.BYTES_PER_ELEMENT:0,o=i.attributes.normal?i.attributes.normal.count*3*Float32Array.BYTES_PER_ELEMENT:0,a=i.attributes.uv?i.attributes.uv.count*2*Float32Array.BYTES_PER_ELEMENT:0,l=s+r+o+a;e+=l}}),e}function zk(n){return(n/1024).toFixed(2)}const Vk=Number.parseInt(Dc.replace("dev",""));function Hk(n){return n instanceof Ce?n:Array.isArray(n)?new Ce(...n):new Ce(n)}const tf={realistic:{shadows:!0,physicallyCorrectLights:!0,outputColorSpace:Nn,toneMapping:nh,toneMappingExposure:3,shadowMap:{enabled:!0,type:U0}},flat:{toneMapping:Zi,toneMappingExposure:1}};function Gk({canvas:n,options:e,contextParts:{sizes:t,render:i,invalidate:s,advance:r}}){const o=Ee(()=>({alpha:hn(e.alpha)??!0,depth:hn(e.depth),canvas:Li(n),context:hn(e.context),stencil:hn(e.stencil),antialias:hn(e.antialias)??!0,precision:hn(e.precision),powerPreference:hn(e.powerPreference),premultipliedAlpha:hn(e.premultipliedAlpha),preserveDrawingBuffer:hn(e.preserveDrawingBuffer),logarithmicDepthBuffer:hn(e.logarithmicDepthBuffer),failIfMajorPerformanceCaveat:hn(e.failIfMajorPerformanceCaveat)})),a=De(new Ef(o.value));function l(){e.renderMode==="on-demand"&&s()}$e(o,()=>{a.value.dispose(),a.value=new Ef(o.value),l()}),$e([t.width,t.height],()=>{a.value.setSize(t.width.value,t.height.value),l()},{immediate:!0}),$e(()=>e.clearColor,l);const{pixelRatio:c}=OF(),{logError:u}=bT(),f=(()=>{const h=new Ef,p={shadowMap:{enabled:h.shadowMap.enabled,type:h.shadowMap.type},toneMapping:h.toneMapping,toneMappingExposure:h.toneMappingExposure,outputColorSpace:h.outputColorSpace};return h.dispose(),p})(),d=hn(e.renderMode);return d==="on-demand"&&s(),d==="manual"&&setTimeout(()=>{r()},100),Rc(()=>{const h=hn(e.preset);h&&(h in tf||u(`Renderer Preset must be one of these: ${Object.keys(tf).join(", ")}`),pT(a.value,tf[h])),Lk(a.value,c.value,hn(e.dpr)),d==="always"&&(i.frames.value=Math.max(1,i.frames.value));const p=(m,y)=>{const b=hn(m),v=()=>{if(h)return kb(tf[h],y)};if(b!==void 0)return b;const T=v();return T!==void 0?T:kb(f,y)},_=(m,y)=>Ek(a.value,y,p(m,y));_(e.shadows,"shadowMap.enabled"),_(e.toneMapping??nh,"toneMapping"),_(e.shadowMapType,"shadowMap.type"),Vk<150&&_(!e.useLegacyLights,"physicallyCorrectLights"),_(e.outputColorSpace,"outputColorSpace"),_(e.toneMappingExposure,"toneMappingExposure");const g=p(e.clearColor,"clearColor");g&&a.value.setClearColor(g?Hk(g):new Ce(0))}),ns(()=>{a.value.dispose(),a.value.forceContextLoss()}),{renderer:a}}function Wk(n,e,t=10){const i=hn(n)?VF():UF(Ee(()=>hn(e).parentElement)),s=Ui(Ob(i.width,t)),r=Ui(Ob(i.height,t)),o=Ee(()=>s.value/r.value);return{height:r,width:s,aspectRatio:o}}const Xk=(n,e)=>{const t=Ee(()=>e.renderer.value.domElement),i=De([]),{x:s,y:r}=zF({target:t});let o=0;const{width:a,height:l,top:c,left:u}=NF(t),f=({x:se,y:ye})=>{if(t.value)return{x:(se-u.value)/a.value*2-1,y:-((ye-c.value)/l.value)*2+1}},d=({x:se,y:ye})=>{if(e.camera.value)return e.raycaster.value.setFromCamera(new de(se,ye),e.camera.value),i.value=e.raycaster.value.intersectObjects(n.value,!0),i.value},h=se=>{const ye=f({x:(se==null?void 0:se.clientX)??s.value,y:(se==null?void 0:se.clientY)??r.value});return ye?d(ye)||[]:[]},p=pi(),_=pi(),g=pi(),m=pi(),y=pi(),b=pi(),v=pi(),T=pi();function E(se){const ye={};for(const He in se)typeof He!="function"&&(ye[He]=se[He]);return ye}const S=(se,ye)=>{var He,re,ge;const xe=E(ye),X=new B(ye==null?void 0:ye.clientX,ye==null?void 0:ye.clientY,0).unproject((He=e.camera)==null?void 0:He.value);se.trigger({...xe,intersections:i.value,unprojectedPoint:X,ray:(re=e.raycaster)==null?void 0:re.value.ray,camera:(ge=e.camera)==null?void 0:ge.value,sourceEvent:ye,delta:o,stopPropagating:!1})};let P;const x=se=>{h(se),S(g,se),P=se},M=()=>{P&&x(P)};let L,F,H;const Y=se=>{var ye;L=(ye=i.value[0])==null?void 0:ye.object,o=0,F=new de((se==null?void 0:se.clientX)??s.value,(se==null?void 0:se.clientY)??r.value),S(y,se)};let ee,K=!1;const Q=se=>{var ye,He,re;se instanceof PointerEvent&&(i.value.length===0&&S(b,se),L===((ye=i.value[0])==null?void 0:ye.object)&&(H=new de((se==null?void 0:se.clientX)??s.value,(se==null?void 0:se.clientY)??r.value),o=F==null?void 0:F.distanceTo(H),se.button===0?(S(p,se),ee===((He=i.value[0])==null?void 0:He.object)?K=!0:(ee=(re=i.value[0])==null?void 0:re.object,K=!1)):se.button===2&&S(v,se)),S(m,se))},Z=se=>{K&&(S(_,se),ee=void 0,K=!1)},he=se=>S(g,se),be=se=>S(T,se);return t.value.addEventListener("pointerup",Q),t.value.addEventListener("pointerdown",Y),t.value.addEventListener("pointermove",x),t.value.addEventListener("pointerleave",he),t.value.addEventListener("dblclick",Z),t.value.addEventListener("wheel",be),ns(()=>{t!=null&&t.value&&(t.value.removeEventListener("pointerup",Q),t.value.removeEventListener("pointerdown",Y),t.value.removeEventListener("pointermove",x),t.value.removeEventListener("pointerleave",he),t.value.removeEventListener("dblclick",Z),t.value.removeEventListener("wheel",be))}),{intersects:i,onClick:se=>p.on(se).off,onDblClick:se=>_.on(se).off,onContextMenu:se=>v.on(se).off,onPointerMove:se=>g.on(se).off,onPointerUp:se=>m.on(se).off,onPointerDown:se=>y.on(se).off,onPointerMissed:se=>b.on(se).off,onWheel:se=>T.on(se).off,forceUpdate:M}};function am(n,e){if(Array.isArray(n))for(const t of n)t(e);typeof n=="function"&&n(e)}function $k(n,e,t){var i;const s=De(),r=De();n&&(s.value=n),e&&(r.value=e);const o=x=>{var M;return((M=x.__tres)==null?void 0:M.eventCount)>0},a=x=>{var M;return((M=x.children)==null?void 0:M.some(L=>a(L)))||o(x)},l=De(((i=s.value)==null?void 0:i.children).filter(a)||[]);function c(x,M){const L=[],F=()=>M.stopPropagating=!0;M.stopPropagation=F;for(const H of M==null?void 0:M.intersections){if(M.stopPropagating)return;M={...M,...H};const{object:Y}=H;M.eventObject=Y,am(Y[x],M),L.push(Y);let ee=Y.parent;for(;ee!==null&&!M.stopPropagating&&!L.includes(ee);)M.eventObject=ee,am(ee[x],M),L.push(ee),ee=ee.parent;const K=Mk(x.slice(2));t(K,{intersection:H,event:M})}}const{onClick:u,onDblClick:f,onContextMenu:d,onPointerMove:h,onPointerDown:p,onPointerUp:_,onPointerMissed:g,onWheel:m,forceUpdate:y}=Xk(l,e);_(x=>c("onPointerUp",x)),p(x=>c("onPointerDown",x)),u(x=>c("onClick",x)),f(x=>c("onDoubleClick",x)),d(x=>c("onContextMenu",x)),m(x=>c("onWheel",x));let b=[];h(x=>{const M=x.intersections.map(({object:F})=>F),L=x.intersections;b.forEach(({object:F})=>{M.includes(F)||(x.intersections=b,c("onPointerLeave",x),c("onPointerOut",x))}),x.intersections=L,x.intersections.forEach(({object:F})=>{b.includes(F)||(c("onPointerEnter",x),c("onPointerOver",x))}),c("onPointerMove",x),b=x.intersections});const v=[];g(x=>{const M=()=>x.stopPropagating=!0;x.stopPropagation=M,v.forEach(L=>{x.stopPropagating||(x.eventObject=L,am(L.onPointerMissed,x))}),t("pointer-missed",{event:x})});function T(x){Qu(x)&&ur(x)&&l.value.push(x)}function E(x){if(Qu(x)&&ur(x)){const M=l.value.indexOf(x);M>-1&&l.value.splice(M,1)}}function S(x){Qu(x)&&ur(x)&&x.onPointerMissed&&v.push(x)}function P(x){if(Qu(x)&&ur(x)){const M=v.indexOf(x);M>-1&&v.splice(M,1)}}return e.eventManager={forceUpdate:y,registerObject:T,deregisterObject:E,registerPointerMissedObject:S,deregisterPointerMissedObject:P},{forceUpdate:y,registerObject:T,deregisterObject:E,registerPointerMissedObject:S,deregisterPointerMissedObject:P}}function qk(n,e,t=100){t=t<=0?100:t;const i=pi(),s=new Set;let r=!1,o=!1,a=null;function l(){a&&clearTimeout(a),!o&&!r&&n()?(i.trigger(e),s.forEach(f=>f()),s.clear(),r=!0):!o&&!r&&(a=setTimeout(l,t))}function c(){o=!0,a&&clearTimeout(a)}l();const u=(f,...d)=>{f(...d)};return{on:f=>{if(r)return u(f,e),{off:()=>{}};{const d=i.on(f);return s.add(d.off),i.on(f)}},off:i.off,trigger:i.trigger,clear:i.clear,cancel:c}}const lm=new WeakMap;function Yk(n){if(n=n||xT(),lm.has(n))return lm.get(n);const e=100,t=Date.now(),i=qk(()=>{if(Date.now()-t>=e)return!0;{const s=n.renderer.value,r=(s==null?void 0:s.domElement)||{width:0,height:0};return!!(s&&r.width>0&&r.height>0)}},n);return lm.set(n,i),i}function jk({scene:n,canvas:e,windowSize:t,rendererOptions:i,emit:s}){const r=De(n),o=Wk(t,e),{camera:a,cameras:l,registerCamera:c,deregisterCamera:u,setCameraActive:f}=Ok({sizes:o}),d={mode:et(i.renderMode||"always"),priority:et(0),frames:et(0),maxFrames:60,canBeInvalidated:Ee(()=>d.mode.value==="on-demand"&&d.frames.value===0)};function h(H=1){i.renderMode==="on-demand"&&(d.frames.value=Math.min(d.maxFrames,d.frames.value+H))}function p(){i.renderMode==="manual"&&(d.frames.value=1)}const{renderer:_}=Gk({canvas:e,options:i,contextParts:{sizes:o,render:d,invalidate:h,advance:p}}),g={sizes:o,scene:r,camera:a,cameras:Ui(l),renderer:_,raycaster:De(new tT),controls:et(null),perf:{maxFrames:160,fps:{value:0,accumulator:[]},memory:{currentMem:0,allocatedMem:0,accumulator:[]}},render:d,advance:p,extend:Cg,invalidate:h,registerCamera:c,setCameraActive:f,deregisterCamera:u,loop:Bk()};dr("useTres",g),g.scene.value.__tres={root:g},g.loop.register(()=>{a.value&&d.frames.value>0&&(_.value.render(n,a.value),s("render",g.renderer.value)),d.priority.value=0,d.mode.value==="always"?d.frames.value=1:d.frames.value=Math.max(0,d.frames.value-1)},"render");const{on:m,cancel:y}=Yk(g);g.loop.setReady(!1),g.loop.start(),m(()=>{s("ready",g),g.loop.setReady(!0),$k(n,g,s)}),ns(()=>{y(),g.loop.stop()});const b=100,v=FF({every:b}),{isSupported:T,memory:E}=kF({interval:b}),S=160;let P=performance.now();const x=({timestamp:H})=>{g.scene.value&&(g.perf.memory.allocatedMem=T_(g.scene.value)),H-P>=b&&(P=H,g.perf.fps.accumulator.push(v.value),g.perf.fps.accumulator.length>S&&g.perf.fps.accumulator.shift(),g.perf.fps.value=v.value,T.value&&E.value&&(g.perf.memory.accumulator.push(E.value.usedJSHeapSize/1024/1024),g.perf.memory.accumulator.length>S&&g.perf.memory.accumulator.shift(),g.perf.memory.currentMem=g.perf.memory.accumulator.reduce((Y,ee)=>Y+ee,0)/g.perf.memory.accumulator.length))};let M=0;const L=1,{pause:F}=E_(({delta:H})=>{window.__TRES__DEVTOOLS__&&(x({timestamp:performance.now()}),M+=H,M>=L&&(window.__TRES__DEVTOOLS__.cb(g),M=0))},{immediate:!0});return ns(()=>{F()}),g}function xT(){const n=En("useTres");if(!n)throw new Error("useTresContext must be used together with useTresContextProvider");return n}function pG(){const{camera:n,scene:e,renderer:t,loop:i,raycaster:s,controls:r,invalidate:o,advance:a}=xT();i.setContext({camera:n,scene:e,renderer:t,raycaster:s,controls:r,invalidate:o,advance:a});function l(f,d=0){return i.register(f,"before",d)}function c(f){return i.register(f,"render")}function u(f,d=0){return i.register(f,"after",d)}return{pause:i.pause,resume:i.resume,pauseRender:i.pauseRender,resumeRender:i.resumeRender,isActive:i.isActive,onBeforeRender:l,render:c,onAfterRender:u}}const Kk=pi(),Zk=pi(),MT=pi(),Ll=new Nh;let Tf=0,wf=0;E_(()=>{Kk.trigger({delta:Tf,elapsed:wf,clock:Ll}),Zk.trigger({delta:Tf,elapsed:wf,clock:Ll}),MT.trigger({delta:Tf,elapsed:wf,clock:Ll})},{immediate:!1});MT.on(()=>{Tf=Ll.getDelta(),wf=Ll.getElapsedTime()});function Jk(n,e={},t={}){let i=n;const s=a=>{i=a};let r=new Proxy({},{});const o={has(a,l){return l in e||l in i},get(a,l,c){return l in e?e[l](i):i[l]},set(a,l,c){const u=t[l];return u&&typeof u=="function"?u(c,i,r,s):i[l]=c,!0}};return r=new Proxy({},o),r}const{logError:Hb}=bT(),Gb=["onClick","onContextMenu","onPointerMove","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onDoubleClick","onPointerDown","onPointerUp","onPointerCancel","onPointerMissed","onLostPointerCapture","onWheel"],Qk=n=>{const e=n.scene.value;function t(c,u,f,d){if(d||(d={}),d.args||(d.args=[]),c==="template"||bk(c))return null;let h=c.replace("Tres",""),p;if(c==="primitive"){(!Hs(d.object)||Pt(d.object))&&Hb("Tres primitives need an 'object' prop, whose value is an object or shallowRef"),h=d.object.type;const _={};p=Jk(d.object,{object:g=>g,isPrimitive:()=>!0,__tres:()=>_},{object:(g,m,y,b)=>{Dk(g,y,b,{patchProp:r,remove:s,insert:i},n)},__tres:g=>{Object.assign(_,g)}})}else{const _=Ag.value[h];_||Hb(`${h} is not defined on the THREE namespace. Use extend to add it to the catalog.`),p=new _(...d.args)}return p?(p.isCamera&&(d!=null&&d.position||p.position.set(3,3,3),d!=null&&d.lookAt||p.lookAt(0,0,0)),p=no(p,{...p.__tres,type:h,memoizedProps:d,eventCount:0,primitive:c==="primitive",attach:d.attach},n),p):null}function i(c,u){var f,d,h;if(!c)return;u=u||e;const p=c.__tres?c:no(c,{},n),_=u.__tres?u:no(u,{},n);c=Ca(p),u=Ca(_),c.__tres&&((f=c.__tres)==null?void 0:f.eventCount)>0&&((d=n.eventManager)==null||d.registerObject(c)),n.registerCamera(c),(h=n.eventManager)==null||h.registerPointerMissedObject(c),p.__tres.attach?Pk(_,p,p.__tres.attach):ur(c)&&ur(_)&&(_.add(c),c.dispatchEvent({type:"added"})),p.__tres.parent=_,_.__tres.objects&&!_.__tres.objects.includes(p)&&_.__tres.objects.push(p)}function s(c,u){var f,d,h,p;if(!c)return;c!=null&&c.__tres&&((f=c.__tres)==null?void 0:f.eventCount)>0&&((d=n.eventManager)==null||d.deregisterObject(c)),u=Tg(u)?"default":u;const _=(h=c.__tres)==null?void 0:h.dispose;Tg(_)||(_===null?u=!1:u=_);const g=(p=c.__tres)==null?void 0:p.primitive,m=u==="default"?!g:!!u;if(c.__tres&&"objects"in c.__tres&&[...c.__tres.objects].forEach(y=>s(y,u)),m&&c.children&&[...c.children].forEach(y=>s(y,u)),vT(c,n),yT(c,n),m&&!_k(c)){if(ro(u))u(c);else if(ro(c.dispose))try{c.dispose()}catch{}}"__tres"in c&&delete c.__tres}function r(c,u,f,d){var h,p;if(!c)return;let _=c,g=u;if(c.__tres&&(c.__tres.memoizedProps[u]=d),u==="attach"){const v=((h=c.__tres)==null?void 0:h.parent)||c.parent;s(c),no(c,{attach:d},n),v&&i(c,v);return}if(u==="dispose"){c.__tres||(c=no(c,{},n)),c.__tres.dispose=d;return}if(ur(c)&&g==="blocks-pointer-events"){d||d===""?c[g]=d:delete c[g];return}Gb.includes(u)&&c.__tres&&(c.__tres.eventCount+=1);let m=ef(g),y=_==null?void 0:_[m];if(g==="args"){const v=c,T=f??[],E=d??[],S=((p=c.__tres)==null?void 0:p.type)||c.type;S&&T.length&&!Tk(T,E)&&(_=Object.assign(v,new Ag.value[S](...d)));return}if(_.type==="BufferGeometry"){if(g==="args")return;_.setAttribute(ef(g),new Ct(...d));return}if(g.includes("-")&&y===void 0){const v=g.split("-");y=v.reduce((T,E)=>T[ef(E)],_),g=v.pop(),m=g,y!=null&&y.set||(_=v.reduce((T,E)=>T[ef(E)],_))}let b=d;if(b===""&&(b=!0),ro(y)){Gb.includes(u)||(wd(b)?c[m](...b):c[m](b)),m.startsWith("on")&&ro(b)&&(_[m]=b);return}!(y!=null&&y.set)&&!ro(y)?_[m]=b:y.constructor===b.constructor&&y!=null&&y.copy?y==null||y.copy(b):wd(b)?y.set(...b):!y.isColor&&y.setScalar?y.setScalar(b):y.set(b),_T(c)}function o(c){var u;return((u=c==null?void 0:c.__tres)==null?void 0:u.parent)||null}function a(c){const u=no(new ht,{type:"Comment"},n);return u.name=c,u}function l(c){var u;const f=o(c),d=((u=f==null?void 0:f.__tres)==null?void 0:u.objects)||[],h=d.indexOf(c);return h<0||h>=d.length-1?null:d[h+1]}return{insert:i,remove:s,createElement:t,patchProp:r,parentNode:o,createText:()=>{},createComment:a,setText:()=>{},setElementText:()=>{},nextSibling:l,querySelector:()=>{},setScopeId:()=>{},cloneNode:()=>{},insertStaticContent:()=>{}}};function eB(){return ST().__VUE_DEVTOOLS_GLOBAL_HOOK__}function ST(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const tB=typeof Proxy=="function",nB="devtools-plugin:setup",iB="plugin:settings:set";let ol,Rg;function sB(){var n;return ol!==void 0||(typeof window<"u"&&window.performance?(ol=!0,Rg=window.performance):typeof globalThis<"u"&&!((n=globalThis.perf_hooks)===null||n===void 0)&&n.performance?(ol=!0,Rg=globalThis.perf_hooks.performance):ol=!1),ol}function rB(){return sB()?Rg.now():Date.now()}class oB{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const i={};if(e.settings)for(const o in e.settings){const a=e.settings[o];i[o]=a.defaultValue}const s=`__vue-devtools-plugin-settings__${e.id}`;let r=Object.assign({},i);try{const o=localStorage.getItem(s),a=JSON.parse(o);Object.assign(r,a)}catch{}this.fallbacks={getSettings(){return r},setSettings(o){try{localStorage.setItem(s,JSON.stringify(o))}catch{}r=o},now(){return rB()}},t&&t.on(iB,(o,a)=>{o===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(o,a)=>this.target?this.target.on[a]:(...l)=>{this.onQueue.push({method:a,args:l})}}),this.proxiedTarget=new Proxy({},{get:(o,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...l)=>(this.targetQueue.push({method:a,args:l,resolve:()=>{}}),this.fallbacks[a](...l)):(...l)=>new Promise(c=>{this.targetQueue.push({method:a,args:l,resolve:c})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function aB(n,e){const t=n,i=ST(),s=eB(),r=tB&&t.enableEarlyProxy;if(s&&(i.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!r))s.emit(nB,n,e);else{const o=r?new oB(t,s):null;(i.__VUE_DEVTOOLS_PLUGINS__=i.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:o}),o&&e(o.proxiedTarget)}}function lB(n,e){const t=`▲ ■ ●${n}`;typeof Wb=="function"?Wb(t,e):console.log(t)}function Wb(n,e){throw new Error(n+e)}const ET=n=>{const e={id:n.uuid,label:n.type,children:[],tags:[]};n.name!==""&&e.tags.push({label:n.name,textColor:5750629,backgroundColor:15793395});const t=T_(n);return t>0&&e.tags.push({label:`${zk(t)} KB`,textColor:15707189,backgroundColor:16775644,tooltip:"Memory usage"}),n.type.includes("Light")&&(mk(n)&&e.tags.push({label:`${n.intensity}`,textColor:9738662,backgroundColor:16316922,tooltip:"Intensity"}),e.tags.push({label:`#${new Ce(n.color).getHexString()}`,textColor:9738662,backgroundColor:16316922,tooltip:"Color"})),n.type.includes("Camera")&&(e.tags.push({label:`${n.fov}°`,textColor:9738662,backgroundColor:16316922,tooltip:"Field of view"}),e.tags.push({label:`x: ${Math.round(n.position.x)} y: ${Math.round(n.position.y)} z: ${Math.round(n.position.z)}`,textColor:9738662,backgroundColor:16316922,tooltip:"Position"})),e};function TT(n,e,t=""){n.children.forEach(i=>{if(i.type==="HightlightMesh"||t&&!i.type.includes(t)&&!i.name.includes(t))return;const s=ET(i);e.children.push(s),TT(i,s,t)})}const cB=[],al="tres:inspector",uB=bi({sceneGraph:null});function fB(n,e){aB({id:"dev.esm.tres",label:"TresJS 🪐",logo:"https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",packageName:"tresjs",homepage:"https://tresjs.org",componentStateTypes:cB,app:n},t=>{typeof t.now!="function"&&lB("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."),t.addInspector({id:al,label:"TresJS 🪐",icon:"account_tree",treeFilterPlaceholder:"Search instances"}),setInterval(()=>{t.sendInspectorTree(al)},1e3),setInterval(()=>{t.notifyComponentUpdate()},5e3),t.on.getInspectorTree(r=>{if(r.inspectorId===al){const o=ET(e.scene.value);TT(e.scene.value,o,r.filter),uB.sceneGraph=o,r.rootNodes=[o]}});let i=null,s=null;t.on.getInspectorState(r=>{var o;if(r.inspectorId===al){const[a]=e.scene.value.getObjectsByProperty("uuid",r.nodeId);if(!a)return;if(s&&i&&i.parent&&s.remove(i),a.isMesh){const l=Ak(a);a.add(l),i=l,s=a}r.state={object:Object.entries(a).map(([l,c])=>l==="children"?{key:l,value:c.filter(u=>u.type!=="HightlightMesh")}:{key:l,value:c,editable:!0}).filter(({key:l})=>l!=="parent")},a.isScene&&(r.state={...r.state,state:[{key:"Scene Info",value:{objects:a.children.length,memory:T_(a),calls:e.renderer.value.info.render.calls,triangles:e.renderer.value.info.render.triangles,points:e.renderer.value.info.render.points,lines:e.renderer.value.info.render.lines}},{key:"Programs",value:((o=e.renderer.value.info.programs)==null?void 0:o.map(l=>({...l,programName:l.name})))||[]}]})}}),t.on.editInspectorState(r=>{r.inspectorId===al&&wk(e.scene.value,r.nodeId,r.path,r.state.value)})})}const dB=["data-scene","data-tres"],hB=fn({__name:"TresCanvas",props:{shadows:{type:Boolean,default:void 0},clearColor:{},toneMapping:{},shadowMapType:{},useLegacyLights:{type:Boolean,default:void 0},outputColorSpace:{},toneMappingExposure:{},renderMode:{default:"always"},dpr:{},camera:{},preset:{},windowSize:{type:Boolean,default:void 0},enableProvideBridge:{type:Boolean,default:!0},context:{},alpha:{type:Boolean,default:void 0},premultipliedAlpha:{type:Boolean},antialias:{type:Boolean,default:void 0},stencil:{type:Boolean,default:void 0},preserveDrawingBuffer:{type:Boolean,default:void 0},powerPreference:{},depth:{type:Boolean,default:void 0},failIfMajorPerformanceCaveat:{type:Boolean,default:void 0},precision:{},logarithmicDepthBuffer:{type:Boolean,default:void 0},reverseDepthBuffer:{type:Boolean}},emits:["render","click","double-click","context-menu","pointer-move","pointer-up","pointer-down","pointer-enter","pointer-leave","pointer-over","pointer-out","pointer-missed","wheel","ready"],setup(n,{expose:e,emit:t}){const i=n,s=t,r=A0(),o=et(),a=De(new gh),l=wn();Cg(gF);const c=(p,_=!1)=>fn({setup(){var g;const m=(g=wn())==null?void 0:g.appContext;m&&(m.app=l==null?void 0:l.appContext.app);const y={};function b(v){v&&(v.parent&&b(v.parent),v.provides&&Object.assign(y,v.provides))}return l!=null&&l.parent&&i.enableProvideBridge&&(b(l.parent),Reflect.ownKeys(y).forEach(v=>{dr(v,y[v])})),dr("useTres",p),dr("extend",Cg),typeof window<"u"&&fB(m==null?void 0:m.app,p),()=>Ds(jt,null,_?[]:r.default())}}),u=(p,_=!1)=>{const g=c(p,_),{render:m}=WS(Qk(p));m(Ds(g),a.value)},f=(p,_=!1)=>{gT(p.scene.value),_&&(p.renderer.value.dispose(),p.renderer.value.renderLists.dispose(),p.renderer.value.forceContextLoss()),a.value.__tres={root:p}},d=De(null);e({context:d,dispose:()=>f(d.value,!0)});const h=()=>{f(d.value),u(d.value,!0)};return Hn(()=>{const p=o;d.value=jk({scene:a.value,canvas:p,windowSize:i.windowSize??!1,rendererOptions:i,emit:s});const{registerCamera:_,camera:g,cameras:m,deregisterCamera:y}=d.value;u(d.value);const b=()=>{const v=new Kt(45,window.innerWidth/window.innerHeight,.1,1e3);v.position.set(3,3,3),v.lookAt(0,0,0),_(v);const T=Rc(()=>{m.value.length>=2&&(v.removeFromParent(),y(v),T==null||T())})};$e(()=>i.camera,(v,T)=>{v&&_(v),T&&(T.removeFromParent(),y(T))},{immediate:!0}),g.value||b()}),ns(h),(p,_)=>(mn(),vi("canvas",{ref_key:"canvas",ref:o,"data-scene":a.value.uuid,class:Oa(p.$attrs.class),"data-tres":`tresjs ${Ot(uk).version}`,style:Mi({display:"block",width:"100%",height:"100%",position:p.windowSize?"fixed":"relative",top:0,left:0,pointerEvents:"auto",touchAction:"none",...p.$attrs.style})},null,14,dB))}}),pB={install(n){n.component("TresCanvas",hB)}};function cm(n){if(n===null||typeof n!="object")return!1;const e=Object.getPrototypeOf(n);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in n?!1:Symbol.toStringTag in n?Object.prototype.toString.call(n)==="[object Module]":!0}function Pg(n,e,t=".",i){if(!cm(e))return Pg(n,{},t,i);const s=Object.assign({},e);for(const r in n){if(r==="__proto__"||r==="constructor")continue;const o=n[r];o!=null&&(i&&i(s,r,o,t)||(Array.isArray(o)&&Array.isArray(s[r])?s[r]=[...o,...s[r]]:cm(o)&&cm(s[r])?s[r]=Pg(o,s[r],(t?`${t}.`:"")+r.toString(),i):s[r]=o))}return s}function mB(n){return(...e)=>e.reduce((t,i)=>Pg(t,i,"",n),{})}const wT=mB();function Cr(n){return Xd()?(_0(n),!0):!1}function Xb(){const n=new Set,e=r=>{n.delete(r)};return{on:r=>{n.add(r);const o=()=>e(r);return Cr(o),{off:o}},off:e,trigger:(...r)=>Promise.all(Array.from(n).map(o=>o(...r))),clear:()=>{n.clear()}}}const um=new WeakMap,gB=(...n)=>{var e;const t=n[0],i=(e=wn())==null?void 0:e.proxy;if(i==null&&!Cc())throw new Error("injectLocal must be called in setup");return i&&um.has(i)&&t in um.get(i)?um.get(i)[t]:En(...n)},Xc=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const AT=n=>n!=null,_B=Object.prototype.toString,Cd=n=>_B.call(n)==="[object Object]",es=()=>{},vB=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);function CT(...n){if(n.length!==1)return cS(...n);const e=n[0];return typeof e=="function"?Ui(S0(()=>({get:e,set:es}))):et(e)}function w_(n,e){function t(...i){return new Promise((s,r)=>{Promise.resolve(n(()=>e.apply(this,i),{fn:e,thisArg:this,args:i})).then(s).catch(r)})}return t}const RT=n=>n();function PT(n,e={}){let t,i,s=es;const r=l=>{clearTimeout(l),s(),s=es};let o;return l=>{const c=nt(n),u=nt(e.maxWait);return t&&r(t),c<=0||u!==void 0&&u<=0?(i&&(r(i),i=null),Promise.resolve(l())):new Promise((f,d)=>{s=e.rejectOnCancel?d:f,o=l,u&&!i&&(i=setTimeout(()=>{t&&r(t),i=null,f(o())},u)),t=setTimeout(()=>{i&&r(i),i=null,f(l())},c)})}}function yB(...n){let e=0,t,i=!0,s=es,r,o,a,l,c;!Pt(n[0])&&typeof n[0]=="object"?{delay:o,trailing:a=!0,leading:l=!0,rejectOnCancel:c=!1}=n[0]:[o,a=!0,l=!0,c=!1]=n;const u=()=>{t&&(clearTimeout(t),t=void 0,s(),s=es)};return d=>{const h=nt(o),p=Date.now()-e,_=()=>r=d();return u(),h<=0?(e=Date.now(),_()):(p>h&&(l||!i)?(e=Date.now(),_()):a&&(r=new Promise((g,m)=>{s=c?m:g,t=setTimeout(()=>{e=Date.now(),i=!0,g(_()),u()},Math.max(0,h-p))})),!l&&!t&&(t=setTimeout(()=>i=!0,h)),i=!1,r)}}function bB(n=RT,e={}){const{initialState:t="active"}=e,i=CT(t==="active");function s(){i.value=!1}function r(){i.value=!0}const o=(...a)=>{i.value&&n(...a)};return{isActive:Ui(i),pause:s,resume:r,eventFilter:o}}function xB(n){let e;function t(){return e||(e=n()),e}return t.reset=async()=>{const i=e;e=void 0,i&&await i},t}function MB(n,e){var t;if(typeof n=="number")return n+e;const i=((t=n.match(/^-?\d+\.?\d*/))==null?void 0:t[0])||"",s=n.slice(i.length),r=Number.parseFloat(i)+e;return Number.isNaN(r)?n:r+s}function Dl(n){return n.endsWith("rem")?Number.parseFloat(n)*16:Number.parseFloat(n)}function Ol(n){return Array.isArray(n)?n:[n]}function IT(n){return wn()}function A_(n,e=200,t={}){return w_(PT(e,t),n)}function mG(n,e=200,t={}){const i=et(nt(n)),s=A_(()=>{i.value=n.value},e,t);return $e(n,()=>s()),rS(i)}function SB(n,e=200,t=!1,i=!0,s=!1){return w_(yB(e,t,i,s),n)}function LT(n,e,t={}){const{eventFilter:i=RT,...s}=t;return $e(n,w_(i,e),s)}function EB(n,e,t={}){const{eventFilter:i,initialState:s="active",...r}=t,{eventFilter:o,pause:a,resume:l,isActive:c}=bB(i,{initialState:s});return{stop:LT(n,e,{...r,eventFilter:o}),pause:a,resume:l,isActive:c}}function Va(n,e=!0,t){IT()?Hn(n,t):e?n():Er(n)}function TB(n,e){IT()&&ns(n,e)}function wB(n,e,t={}){const{immediate:i=!0,immediateCallback:s=!1}=t,r=De(!1);let o=null;function a(){o&&(clearTimeout(o),o=null)}function l(){r.value=!1,a()}function c(...u){s&&n(),a(),r.value=!0,o=setTimeout(()=>{r.value=!1,o=null,n(...u)},nt(e))}return i&&(r.value=!0,Xc&&c()),Cr(l),{isPending:rS(r),start:c,stop:l}}function gG(n,e,t={}){const{debounce:i=0,maxWait:s=void 0,...r}=t;return LT(n,e,{...r,eventFilter:PT(i,{maxWait:s})})}function AB(n,e,t){return $e(n,e,{...t,immediate:!0})}const Qn=Xc?window:void 0,CB=Xc?window.document:void 0,C_=Xc?window.navigator:void 0;function oi(n){var e;const t=nt(n);return(e=t==null?void 0:t.$el)!=null?e:t}function Ft(...n){const e=[],t=()=>{e.forEach(a=>a()),e.length=0},i=(a,l,c,u)=>(a.addEventListener(l,c,u),()=>a.removeEventListener(l,c,u)),s=Ee(()=>{const a=Ol(nt(n[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),r=AB(()=>{var a,l;return[(l=(a=s.value)==null?void 0:a.map(c=>oi(c)))!=null?l:[Qn].filter(c=>c!=null),Ol(nt(s.value?n[1]:n[0])),Ol(Ot(s.value?n[2]:n[1])),nt(s.value?n[3]:n[2])]},([a,l,c,u])=>{if(t(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(c!=null&&c.length))return;const f=Cd(u)?{...u}:u;e.push(...a.flatMap(d=>l.flatMap(h=>c.map(p=>i(d,h,p,f)))))},{flush:"post"}),o=()=>{r(),t()};return Cr(t),o}function RB(){const n=De(!1),e=wn();return e&&Hn(()=>{n.value=!0},e),n}function Po(n){const e=RB();return Ee(()=>(e.value,!!n()))}function DT(n,e,t={}){const{window:i=Qn,...s}=t;let r;const o=Po(()=>i&&"MutationObserver"in i),a=()=>{r&&(r.disconnect(),r=void 0)},l=Ee(()=>{const d=nt(n),h=Ol(d).map(oi).filter(AT);return new Set(h)}),c=$e(()=>l.value,d=>{a(),o.value&&d.size&&(r=new MutationObserver(e),d.forEach(h=>r.observe(h,s)))},{immediate:!0,flush:"post"}),u=()=>r==null?void 0:r.takeRecords(),f=()=>{c(),a()};return Cr(f),{isSupported:o,stop:f,takeRecords:u}}const PB=Symbol("vueuse-ssr-width");function OT(){const n=Cc()?gB(PB,null):null;return typeof n=="number"?n:void 0}function oo(n,e={}){const{window:t=Qn,ssrWidth:i=OT()}=e,s=Po(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function"),r=De(typeof i=="number"),o=De(),a=De(!1),l=c=>{a.value=c.matches};return Rc(()=>{if(r.value){r.value=!s.value;const c=nt(n).split(",");a.value=c.some(u=>{const f=u.includes("not all"),d=u.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),h=u.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let p=!!(d||h);return d&&p&&(p=i>=Dl(d[1])),h&&p&&(p=i<=Dl(h[1])),f?!p:p});return}s.value&&(o.value=t.matchMedia(nt(n)),a.value=o.value.matches)}),Ft(o,"change",l,{passive:!0}),Ee(()=>a.value)}const _G={sm:640,md:768,lg:1024,xl:1280,"2xl":1536};function vG(n,e={}){function t(h,p){let _=nt(n[nt(h)]);return p!=null&&(_=MB(_,p)),typeof _=="number"&&(_=`${_}px`),_}const{window:i=Qn,strategy:s="min-width",ssrWidth:r=OT()}=e,o=typeof r=="number",a=o?De(!1):{value:!0};o&&Va(()=>a.value=!!i);function l(h,p){return!a.value&&o?h==="min"?r>=Dl(p):r<=Dl(p):i?i.matchMedia(`(${h}-width: ${p})`).matches:!1}const c=h=>oo(()=>`(min-width: ${t(h)})`,e),u=h=>oo(()=>`(max-width: ${t(h)})`,e),f=Object.keys(n).reduce((h,p)=>(Object.defineProperty(h,p,{get:()=>s==="min-width"?c(p):u(p),enumerable:!0,configurable:!0}),h),{});function d(){const h=Object.keys(n).map(p=>[p,f[p],Dl(t(p))]).sort((p,_)=>p[2]-_[2]);return Ee(()=>h.filter(([,p])=>p.value).map(([p])=>p))}return Object.assign(f,{greaterOrEqual:c,smallerOrEqual:u,greater(h){return oo(()=>`(min-width: ${t(h,.1)})`,e)},smaller(h){return oo(()=>`(max-width: ${t(h,-.1)})`,e)},between(h,p){return oo(()=>`(min-width: ${t(h)}) and (max-width: ${t(p,-.1)})`,e)},isGreater(h){return l("min",t(h,.1))},isGreaterOrEqual(h){return l("min",t(h))},isSmaller(h){return l("max",t(h,-.1))},isSmallerOrEqual(h){return l("max",t(h))},isInBetween(h,p){return l("min",t(h))&&l("max",t(p,-.1))},current:d,active(){const h=d();return Ee(()=>h.value.length===0?"":h.value.at(s==="min-width"?-1:0))}})}function Ig(n,e={}){const{controls:t=!1,navigator:i=C_}=e,s=Po(()=>i&&"permissions"in i),r=De(),o=typeof n=="string"?{name:n}:n,a=De(),l=()=>{var u,f;a.value=(f=(u=r.value)==null?void 0:u.state)!=null?f:"prompt"};Ft(r,"change",l,{passive:!0});const c=xB(async()=>{if(s.value){if(!r.value)try{r.value=await i.permissions.query(o)}catch{r.value=void 0}finally{l()}if(t)return ut(r.value)}});return c(),t?{state:a,isSupported:s,query:c}:a}function yG(n={}){const{navigator:e=C_,read:t=!1,source:i,copiedDuring:s=1500,legacy:r=!1}=n,o=Po(()=>e&&"clipboard"in e),a=Ig("clipboard-read"),l=Ig("clipboard-write"),c=Ee(()=>o.value||r),u=De(""),f=De(!1),d=wB(()=>f.value=!1,s,{immediate:!1});async function h(){let y=!(o.value&&m(a.value));if(!y)try{u.value=await e.clipboard.readText()}catch{y=!0}y&&(u.value=g())}c.value&&t&&Ft(["copy","cut"],h,{passive:!0});async function p(y=nt(i)){if(c.value&&y!=null){let b=!(o.value&&m(l.value));if(!b)try{await e.clipboard.writeText(y)}catch{b=!0}b&&_(y),u.value=y,f.value=!0,d.start()}}function _(y){const b=document.createElement("textarea");b.value=y??"",b.style.position="absolute",b.style.opacity="0",document.body.appendChild(b),b.select(),document.execCommand("copy"),b.remove()}function g(){var y,b,v;return(v=(b=(y=document==null?void 0:document.getSelection)==null?void 0:y.call(document))==null?void 0:b.toString())!=null?v:""}function m(y){return y==="granted"||y==="prompt"}return{isSupported:c,text:u,copied:f,copy:p}}const nf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},sf="__vueuse_ssr_handlers__",IB=LB();function LB(){return sf in nf||(nf[sf]=nf[sf]||{}),nf[sf]}function NT(n,e){return IB[n]||e}function DB(n){return oo("(prefers-color-scheme: dark)",n)}function OB(n){return n==null?"any":n instanceof Set?"set":n instanceof Map?"map":n instanceof Date?"date":typeof n=="boolean"?"boolean":typeof n=="string"?"string":typeof n=="object"?"object":Number.isNaN(n)?"any":"number"}const NB={boolean:{read:n=>n==="true",write:n=>String(n)},object:{read:n=>JSON.parse(n),write:n=>JSON.stringify(n)},number:{read:n=>Number.parseFloat(n),write:n=>String(n)},any:{read:n=>n,write:n=>String(n)},string:{read:n=>n,write:n=>String(n)},map:{read:n=>new Map(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n.entries()))},set:{read:n=>new Set(JSON.parse(n)),write:n=>JSON.stringify(Array.from(n))},date:{read:n=>new Date(n),write:n=>n.toISOString()}},$b="vueuse-storage";function UT(n,e,t,i={}){var s;const{flush:r="pre",deep:o=!0,listenToStorageChanges:a=!0,writeDefaults:l=!0,mergeDefaults:c=!1,shallow:u,window:f=Qn,eventFilter:d,onError:h=L=>{console.error(L)},initOnMounted:p}=i,_=(u?De:et)(typeof e=="function"?e():e),g=Ee(()=>nt(n));if(!t)try{t=NT("getDefaultStorage",()=>{var L;return(L=Qn)==null?void 0:L.localStorage})()}catch(L){h(L)}if(!t)return _;const m=nt(e),y=OB(m),b=(s=i.serializer)!=null?s:NB[y],{pause:v,resume:T}=EB(_,()=>S(_.value),{flush:r,deep:o,eventFilter:d});$e(g,()=>x(),{flush:r}),f&&a&&Va(()=>{t instanceof Storage?Ft(f,"storage",x,{passive:!0}):Ft(f,$b,M),p&&x()}),p||x();function E(L,F){if(f){const H={key:g.value,oldValue:L,newValue:F,storageArea:t};f.dispatchEvent(t instanceof Storage?new StorageEvent("storage",H):new CustomEvent($b,{detail:H}))}}function S(L){try{const F=t.getItem(g.value);if(L==null)E(F,null),t.removeItem(g.value);else{const H=b.write(L);F!==H&&(t.setItem(g.value,H),E(F,H))}}catch(F){h(F)}}function P(L){const F=L?L.newValue:t.getItem(g.value);if(F==null)return l&&m!=null&&t.setItem(g.value,b.write(m)),m;if(!L&&c){const H=b.read(F);return typeof c=="function"?c(H,m):y==="object"&&!Array.isArray(H)?{...m,...H}:H}else return typeof F!="string"?F:b.read(F)}function x(L){if(!(L&&L.storageArea!==t)){if(L&&L.key==null){_.value=m;return}if(!(L&&L.key!==g.value)){v();try{(L==null?void 0:L.newValue)!==b.write(_.value)&&(_.value=P(L))}catch(F){h(F)}finally{L?Er(T):T()}}}}function M(L){x(L.detail)}return _}const UB="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function FB(n={}){const{selector:e="html",attribute:t="class",initialValue:i="auto",window:s=Qn,storage:r,storageKey:o="vueuse-color-scheme",listenToStorageChanges:a=!0,storageRef:l,emitAuto:c,disableTransition:u=!0}=n,f={auto:"",light:"light",dark:"dark",...n.modes||{}},d=DB({window:s}),h=Ee(()=>d.value?"dark":"light"),p=l||(o==null?CT(i):UT(o,i,r,{window:s,listenToStorageChanges:a})),_=Ee(()=>p.value==="auto"?h.value:p.value),g=NT("updateHTMLAttrs",(v,T,E)=>{const S=typeof v=="string"?s==null?void 0:s.document.querySelector(v):oi(v);if(!S)return;const P=new Set,x=new Set;let M=null;if(T==="class"){const F=E.split(/\s/g);Object.values(f).flatMap(H=>(H||"").split(/\s/g)).filter(Boolean).forEach(H=>{F.includes(H)?P.add(H):x.add(H)})}else M={key:T,value:E};if(P.size===0&&x.size===0&&M===null)return;let L;u&&(L=s.document.createElement("style"),L.appendChild(document.createTextNode(UB)),s.document.head.appendChild(L));for(const F of P)S.classList.add(F);for(const F of x)S.classList.remove(F);M&&S.setAttribute(M.key,M.value),u&&(s.getComputedStyle(L).opacity,document.head.removeChild(L))});function m(v){var T;g(e,t,(T=f[v])!=null?T:v)}function y(v){n.onChanged?n.onChanged(v,m):m(v)}$e(_,y,{flush:"post",immediate:!0}),Va(()=>y(_.value));const b=Ee({get(){return c?p.value:_.value},set(v){p.value=v}});return Object.assign(b,{store:p,system:h,state:_})}function rf(n,e,t={}){const{window:i=Qn,initialValue:s,observe:r=!1}=t,o=De(s),a=Ee(()=>{var c;return oi(e)||((c=i==null?void 0:i.document)==null?void 0:c.documentElement)});function l(){var c;const u=nt(n),f=nt(a);if(f&&i&&u){const d=(c=i.getComputedStyle(f).getPropertyValue(u))==null?void 0:c.trim();o.value=d||o.value||s}}return r&&DT(a,l,{attributeFilter:["style","class"],window:i}),$e([a,()=>nt(n)],(c,u)=>{u[0]&&u[1]&&u[0].style.removeProperty(u[1]),l()},{immediate:!0}),$e([o,a],([c,u])=>{const f=nt(n);u!=null&&u.style&&f&&(c==null?u.style.removeProperty(f):u.style.setProperty(f,c))},{immediate:!0}),o}function kB(n={}){const{valueDark:e="dark",valueLight:t=""}=n,i=FB({...n,onChanged:(o,a)=>{var l;n.onChanged?(l=n.onChanged)==null||l.call(n,o==="dark",a,o):a(o)},modes:{dark:e,light:t}}),s=Ee(()=>i.system.value);return Ee({get(){return i.value==="dark"},set(o){const a=o?"dark":"light";s.value===a?i.value="auto":i.value=a}})}function BB(n={}){const{navigator:e=C_,requestPermissions:t=!1,constraints:i={audio:!0,video:!0},onUpdated:s}=n,r=et([]),o=Ee(()=>r.value.filter(p=>p.kind==="videoinput")),a=Ee(()=>r.value.filter(p=>p.kind==="audioinput")),l=Ee(()=>r.value.filter(p=>p.kind==="audiooutput")),c=Po(()=>e&&e.mediaDevices&&e.mediaDevices.enumerateDevices),u=De(!1);let f;async function d(){c.value&&(r.value=await e.mediaDevices.enumerateDevices(),s==null||s(r.value),f&&(f.getTracks().forEach(p=>p.stop()),f=null))}async function h(){const p=i.video?"camera":"microphone";if(!c.value)return!1;if(u.value)return!0;const{state:_,query:g}=Ig(p,{controls:!0});if(await g(),_.value!=="granted"){let m=!0;try{f=await e.mediaDevices.getUserMedia(i)}catch{f=null,m=!1}d(),u.value=m}else u.value=!0;return u.value}return c.value&&(t&&h(),Ft(e.mediaDevices,"devicechange",d,{passive:!0}),d()),{devices:r,ensurePermissions:h,permissionGranted:u,videoInputs:o,audioInputs:a,audioOutputs:l,isSupported:c}}function zB(n,e,t={}){const{window:i=Qn,...s}=t;let r;const o=Po(()=>i&&"ResizeObserver"in i),a=()=>{r&&(r.disconnect(),r=void 0)},l=Ee(()=>{const f=nt(n);return Array.isArray(f)?f.map(d=>oi(d)):[oi(f)]}),c=$e(l,f=>{if(a(),o.value&&i){r=new ResizeObserver(e);for(const d of f)d&&r.observe(d,s)}},{immediate:!0,flush:"post"}),u=()=>{a(),c()};return Cr(u),{isSupported:o,stop:u}}function bG(n,e={}){const{reset:t=!0,windowResize:i=!0,windowScroll:s=!0,immediate:r=!0,updateTiming:o="sync"}=e,a=De(0),l=De(0),c=De(0),u=De(0),f=De(0),d=De(0),h=De(0),p=De(0);function _(){const m=oi(n);if(!m){t&&(a.value=0,l.value=0,c.value=0,u.value=0,f.value=0,d.value=0,h.value=0,p.value=0);return}const y=m.getBoundingClientRect();a.value=y.height,l.value=y.bottom,c.value=y.left,u.value=y.right,f.value=y.top,d.value=y.width,h.value=y.x,p.value=y.y}function g(){o==="sync"?_():o==="next-frame"&&requestAnimationFrame(()=>_())}return zB(n,g),$e(()=>oi(n),m=>!m&&g()),DT(n,g,{attributeFilter:["style","class"]}),s&&Ft("scroll",g,{capture:!0,passive:!0}),i&&Ft("resize",g,{passive:!0}),Va(()=>{r&&g()}),{height:a,bottom:l,left:c,right:u,top:f,width:d,x:h,y:p,update:g}}function VB(n,e,t={}){const{root:i,rootMargin:s="0px",threshold:r=0,window:o=Qn,immediate:a=!0}=t,l=Po(()=>o&&"IntersectionObserver"in o),c=Ee(()=>{const p=nt(n);return Ol(p).map(oi).filter(AT)});let u=es;const f=De(a),d=l.value?$e(()=>[c.value,oi(i),f.value],([p,_])=>{if(u(),!f.value||!p.length)return;const g=new IntersectionObserver(e,{root:oi(_),rootMargin:s,threshold:r});p.forEach(m=>m&&g.observe(m)),u=()=>{g.disconnect(),u=es}},{immediate:a,flush:"post"}):es,h=()=>{u(),d(),f.value=!1};return Cr(h),{isSupported:l,isActive:f,pause(){u(),f.value=!1},resume(){f.value=!0},stop:h}}const HB={multiple:!0,accept:"*",reset:!1,directory:!1};function GB(n){if(!n)return null;if(n instanceof FileList)return n;const e=new DataTransfer;for(const t of n)e.items.add(t);return e.files}function xG(n={}){const{document:e=CB}=n,t=et(GB(n.initialFiles)),{on:i,trigger:s}=Xb(),{on:r,trigger:o}=Xb();let a;e&&(a=e.createElement("input"),a.type="file",a.onchange=u=>{const f=u.target;t.value=f.files,s(t.value)},a.oncancel=()=>{o()});const l=()=>{t.value=null,a&&a.value&&(a.value="",s(null))},c=u=>{if(!a)return;const f={...HB,...n,...u};a.multiple=f.multiple,a.accept=f.accept,a.webkitdirectory=f.directory,vB(f,"capture")&&(a.capture=f.capture),f.reset&&l(),a.click()};return{files:Ui(t),open:c,reset:l,onCancel:r,onChange:i}}const qb=1;function MG(n,e={}){const{throttle:t=0,idle:i=200,onStop:s=es,onScroll:r=es,offset:o={left:0,right:0,top:0,bottom:0},eventListenerOptions:a={capture:!1,passive:!0},behavior:l="auto",window:c=Qn,onError:u=S=>{console.error(S)}}=e,f=De(0),d=De(0),h=Ee({get(){return f.value},set(S){_(S,void 0)}}),p=Ee({get(){return d.value},set(S){_(void 0,S)}});function _(S,P){var x,M,L,F;if(!c)return;const H=nt(n);if(!H)return;(L=H instanceof Document?c.document.body:H)==null||L.scrollTo({top:(x=nt(P))!=null?x:p.value,left:(M=nt(S))!=null?M:h.value,behavior:nt(l)});const Y=((F=H==null?void 0:H.document)==null?void 0:F.documentElement)||(H==null?void 0:H.documentElement)||H;h!=null&&(f.value=Y.scrollLeft),p!=null&&(d.value=Y.scrollTop)}const g=De(!1),m=bi({left:!0,right:!1,top:!0,bottom:!1}),y=bi({left:!1,right:!1,top:!1,bottom:!1}),b=S=>{g.value&&(g.value=!1,y.left=!1,y.right=!1,y.top=!1,y.bottom=!1,s(S))},v=A_(b,t+i),T=S=>{var P;if(!c)return;const x=((P=S==null?void 0:S.document)==null?void 0:P.documentElement)||(S==null?void 0:S.documentElement)||oi(S),{display:M,flexDirection:L,direction:F}=getComputedStyle(x),H=F==="rtl"?-1:1,Y=x.scrollLeft;y.left=Yf.value;const ee=Math.abs(Y*H)<=(o.left||0),K=Math.abs(Y*H)+x.clientWidth>=x.scrollWidth-(o.right||0)-qb;M==="flex"&&L==="row-reverse"?(m.left=K,m.right=ee):(m.left=ee,m.right=K),f.value=Y;let Q=x.scrollTop;S===c.document&&!Q&&(Q=c.document.body.scrollTop),y.top=Qd.value;const Z=Math.abs(Q)<=(o.top||0),he=Math.abs(Q)+x.clientHeight>=x.scrollHeight-(o.bottom||0)-qb;M==="flex"&&L==="column-reverse"?(m.top=he,m.bottom=Z):(m.top=Z,m.bottom=he),d.value=Q},E=S=>{var P;if(!c)return;const x=(P=S.target.documentElement)!=null?P:S.target;T(x),g.value=!0,v(S),r(S)};return Ft(n,"scroll",t?SB(E,t,!0,!1):E,a),Va(()=>{try{const S=nt(n);if(!S)return;T(S)}catch(S){u(S)}}),Ft(n,"scrollend",b,a),{x:h,y:p,isScrolling:g,arrivedState:m,directions:y,measure(){const S=nt(n);c&&S&&T(S)}}}function gs(n,e,t={}){const{window:i=Qn}=t;return UT(n,e,i==null?void 0:i.localStorage,t)}function SG(n){const e=De(),t=()=>{e.value&&URL.revokeObjectURL(e.value),e.value=void 0};return $e(()=>nt(n),i=>{t(),i&&(e.value=URL.createObjectURL(i))},{immediate:!0}),Cr(t),Ui(e)}const Yb="--vueuse-safe-area-top",jb="--vueuse-safe-area-right",Kb="--vueuse-safe-area-bottom",Zb="--vueuse-safe-area-left";function EG(){const n=De(""),e=De(""),t=De(""),i=De("");if(Xc){const r=rf(Yb),o=rf(jb),a=rf(Kb),l=rf(Zb);r.value="env(safe-area-inset-top, 0px)",o.value="env(safe-area-inset-right, 0px)",a.value="env(safe-area-inset-bottom, 0px)",l.value="env(safe-area-inset-left, 0px)",s(),Ft("resize",A_(s),{passive:!0})}function s(){n.value=of(Yb),e.value=of(jb),t.value=of(Kb),i.value=of(Zb)}return{top:n,right:e,bottom:t,left:i,update:s}}function of(n){return getComputedStyle(document.documentElement).getPropertyValue(n)}function TG(n,e,t){const{window:i=Qn}={},s=et(null),r=De(),o=(...l)=>{r.value&&r.value.postMessage(...l)},a=function(){r.value&&r.value.terminate()};return i&&(r.value=new Worker(n,e),r.value.onmessage=l=>{s.value=l.data},Cr(()=>{r.value&&r.value.terminate()})),{data:s,post:o,terminate:a,worker:r}}function wG(n={}){const{window:e=Qn,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:i=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:r=!0,type:o="inner"}=n,a=De(t),l=De(i),c=()=>{if(e)if(o==="outer")a.value=e.outerWidth,l.value=e.outerHeight;else if(o==="visual"&&e.visualViewport){const{width:f,height:d,scale:h}=e.visualViewport;a.value=Math.round(f*h),l.value=Math.round(d*h)}else r?(a.value=e.innerWidth,l.value=e.innerHeight):(a.value=e.document.documentElement.clientWidth,l.value=e.document.documentElement.clientHeight)};c(),Va(c);const u={passive:!0};if(Ft("resize",c,u),e&&o==="visual"&&e.visualViewport&&Ft(e.visualViewport,"resize",c,u),s){const f=oo("(orientation: portrait)");$e(f,()=>c())}return{width:a,height:l}}const FT=1/60*1e3,WB=typeof performance<"u"?()=>performance.now():()=>Date.now(),kT=typeof window<"u"?n=>window.requestAnimationFrame(n):n=>setTimeout(()=>n(WB()),FT);function XB(n){let e=[],t=[],i=0,s=!1,r=!1;const o=new WeakSet,a={schedule:(l,c=!1,u=!1)=>{const f=u&&s,d=f?e:t;return c&&o.add(l),d.indexOf(l)===-1&&(d.push(l),f&&s&&(i=e.length)),l},cancel:l=>{const c=t.indexOf(l);c!==-1&&t.splice(c,1),o.delete(l)},process:l=>{if(s){r=!0;return}if(s=!0,[e,t]=[t,e],t.length=0,i=e.length,i)for(let c=0;c(n[e]=XB(()=>vc=!0),n),{}),Og=$c.reduce((n,e)=>{const t=kh[e];return n[e]=(i,s=!1,r=!1)=>(vc||jB(),t.schedule(i,s,r)),n},{}),qB=$c.reduce((n,e)=>(n[e]=kh[e].cancel,n),{});$c.reduce((n,e)=>(n[e]=()=>kh[e].process(pa),n),{});const YB=n=>kh[n].process(pa),BT=n=>{vc=!1,pa.delta=Lg?FT:Math.max(Math.min(n-pa.timestamp,$B),1),pa.timestamp=n,Dg=!0,$c.forEach(YB),Dg=!1,vc&&(Lg=!1,kT(BT))},jB=()=>{vc=!0,Lg=!0,Dg||kT(BT)},zT=()=>pa;function VT(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(n);sMath.min(Math.max(t,n),e),Qb=.001,KB=.01,ZB=10,JB=.05,QB=1;function e4({duration:n=800,bounce:e=.25,velocity:t=0,mass:i=1}){let s,r,o=1-e;o=Ng(JB,QB,o),n=Ng(KB,ZB,n/1e3),o<1?(s=c=>{const u=c*o,f=u*n,d=u-t,h=Ug(c,o),p=Math.exp(-f);return Qb-d/h*p},r=c=>{const f=c*o*n,d=f*t+t,h=Math.pow(o,2)*Math.pow(c,2)*n,p=Math.exp(-f),_=Ug(Math.pow(c,2),o);return(-s(c)+Qb>0?-1:1)*((d-h)*p)/_}):(s=c=>{const u=Math.exp(-c*n),f=(c-t)*n+1;return-.001+u*f},r=c=>{const u=Math.exp(-c*n),f=(t-c)*(n*n);return u*f});const a=5/n,l=n4(s,r,a);if(n=n*1e3,isNaN(l))return{stiffness:100,damping:10,duration:n};{const c=Math.pow(l,2)*i;return{stiffness:c,damping:o*2*Math.sqrt(i*c),duration:n}}}const t4=12;function n4(n,e,t){let i=t;for(let s=1;sn[t]!==void 0)}function r4(n){let e=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},n);if(!ex(n,s4)&&ex(n,i4)){const t=e4(n);e=Object.assign(Object.assign(Object.assign({},e),t),{velocity:0,mass:1}),e.isResolvedFromDuration=!0}return e}function R_(n){var{from:e=0,to:t=1,restSpeed:i=2,restDelta:s}=n,r=VT(n,["from","to","restSpeed","restDelta"]);const o={done:!1,value:e};let{stiffness:a,damping:l,mass:c,velocity:u,duration:f,isResolvedFromDuration:d}=r4(r),h=tx,p=tx;function _(){const g=u?-(u/1e3):0,m=t-e,y=l/(2*Math.sqrt(a*c)),b=Math.sqrt(a/c)/1e3;if(s===void 0&&(s=Math.min(Math.abs(t-e)/100,.4)),y<1){const v=Ug(b,y);h=T=>{const E=Math.exp(-y*b*T);return t-E*((g+y*b*m)/v*Math.sin(v*T)+m*Math.cos(v*T))},p=T=>{const E=Math.exp(-y*b*T);return y*b*E*(Math.sin(v*T)*(g+y*b*m)/v+m*Math.cos(v*T))-E*(Math.cos(v*T)*(g+y*b*m)-v*m*Math.sin(v*T))}}else if(y===1)h=v=>t-Math.exp(-b*v)*(m+(g+b*m)*v);else{const v=b*Math.sqrt(y*y-1);h=T=>{const E=Math.exp(-y*b*T),S=Math.min(v*T,300);return t-E*((g+y*b*m)*Math.sinh(S)+v*m*Math.cosh(S))/v}}}return _(),{next:g=>{const m=h(g);if(d)o.done=g>=f;else{const y=p(g)*1e3,b=Math.abs(y)<=i,v=Math.abs(t-m)<=s;o.done=b&&v}return o.value=o.done?t:m,o},flipTarget:()=>{u=-u,[e,t]=[t,e],_()}}}R_.needsInterpolation=(n,e)=>typeof n=="string"||typeof e=="string";const tx=n=>0,HT=(n,e,t)=>{const i=e-n;return i===0?1:(t-n)/i},P_=(n,e,t)=>-t*n+t*e+n,GT=(n,e)=>t=>Math.max(Math.min(t,e),n),Nl=n=>n%1?Number(n.toFixed(5)):n,yc=/(-)?([\d]*\.?[\d])+/g,Fg=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,o4=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function qc(n){return typeof n=="string"}const Yc={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Ul=Object.assign(Object.assign({},Yc),{transform:GT(0,1)}),af=Object.assign(Object.assign({},Yc),{default:1}),I_=n=>({test:e=>qc(e)&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Zr=I_("deg"),Fl=I_("%"),at=I_("px"),nx=Object.assign(Object.assign({},Fl),{parse:n=>Fl.parse(n)/100,transform:n=>Fl.transform(n*100)}),L_=(n,e)=>t=>!!(qc(t)&&o4.test(t)&&t.startsWith(n)||e&&Object.prototype.hasOwnProperty.call(t,e)),WT=(n,e,t)=>i=>{if(!qc(i))return i;const[s,r,o,a]=i.match(yc);return{[n]:parseFloat(s),[e]:parseFloat(r),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},uo={test:L_("hsl","hue"),parse:WT("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(n)+", "+Fl.transform(Nl(e))+", "+Fl.transform(Nl(t))+", "+Nl(Ul.transform(i))+")"},a4=GT(0,255),fm=Object.assign(Object.assign({},Yc),{transform:n=>Math.round(a4(n))}),fr={test:L_("rgb","red"),parse:WT("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:i=1})=>"rgba("+fm.transform(n)+", "+fm.transform(e)+", "+fm.transform(t)+", "+Nl(Ul.transform(i))+")"};function l4(n){let e="",t="",i="",s="";return n.length>5?(e=n.substr(1,2),t=n.substr(3,2),i=n.substr(5,2),s=n.substr(7,2)):(e=n.substr(1,1),t=n.substr(2,1),i=n.substr(3,1),s=n.substr(4,1),e+=e,t+=t,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const kg={test:L_("#"),parse:l4,transform:fr.transform},qn={test:n=>fr.test(n)||kg.test(n)||uo.test(n),parse:n=>fr.test(n)?fr.parse(n):uo.test(n)?uo.parse(n):kg.parse(n),transform:n=>qc(n)?n:n.hasOwnProperty("red")?fr.transform(n):uo.transform(n)},XT="${c}",$T="${n}";function c4(n){var e,t,i,s;return isNaN(n)&&qc(n)&&((t=(e=n.match(yc))===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0)+((s=(i=n.match(Fg))===null||i===void 0?void 0:i.length)!==null&&s!==void 0?s:0)>0}function qT(n){typeof n=="number"&&(n=`${n}`);const e=[];let t=0;const i=n.match(Fg);i&&(t=i.length,n=n.replace(Fg,XT),e.push(...i.map(qn.parse)));const s=n.match(yc);return s&&(n=n.replace(yc,$T),e.push(...s.map(Yc.parse))),{values:e,numColors:t,tokenised:n}}function YT(n){return qT(n).values}function jT(n){const{values:e,numColors:t,tokenised:i}=qT(n),s=e.length;return r=>{let o=i;for(let a=0;atypeof n=="number"?0:n;function f4(n){const e=YT(n);return jT(n)(e.map(u4))}const jc={test:c4,parse:YT,createTransformer:jT,getAnimatableNone:f4},d4=new Set(["brightness","contrast","saturate","opacity"]);function h4(n){let[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[i]=t.match(yc)||[];if(!i)return n;const s=t.replace(i,"");let r=d4.has(e)?1:0;return i!==t&&(r*=100),e+"("+r+s+")"}const p4=/([a-z-]*)\(.*?\)/g,Bg=Object.assign(Object.assign({},jc),{getAnimatableNone:n=>{const e=n.match(p4);return e?e.map(h4).join(" "):n}});function dm(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function ix({hue:n,saturation:e,lightness:t,alpha:i}){n/=360,e/=100,t/=100;let s=0,r=0,o=0;if(!e)s=r=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;s=dm(l,a,n+1/3),r=dm(l,a,n),o=dm(l,a,n-1/3)}return{red:Math.round(s*255),green:Math.round(r*255),blue:Math.round(o*255),alpha:i}}const m4=(n,e,t)=>{const i=n*n,s=e*e;return Math.sqrt(Math.max(0,t*(s-i)+i))},g4=[kg,fr,uo],sx=n=>g4.find(e=>e.test(n)),KT=(n,e)=>{let t=sx(n),i=sx(e),s=t.parse(n),r=i.parse(e);t===uo&&(s=ix(s),t=fr),i===uo&&(r=ix(r),i=fr);const o=Object.assign({},s);return a=>{for(const l in o)l!=="alpha"&&(o[l]=m4(s[l],r[l],a));return o.alpha=P_(s.alpha,r.alpha,a),t.transform(o)}},_4=n=>typeof n=="number",v4=(n,e)=>t=>e(n(t)),ZT=(...n)=>n.reduce(v4);function JT(n,e){return _4(n)?t=>P_(n,e,t):qn.test(n)?KT(n,e):ew(n,e)}const QT=(n,e)=>{const t=[...n],i=t.length,s=n.map((r,o)=>JT(r,e[o]));return r=>{for(let o=0;o{const t=Object.assign(Object.assign({},n),e),i={};for(const s in t)n[s]!==void 0&&e[s]!==void 0&&(i[s]=JT(n[s],e[s]));return s=>{for(const r in i)t[r]=i[r](s);return t}};function rx(n){const e=jc.parse(n),t=e.length;let i=0,s=0,r=0;for(let o=0;o{const t=jc.createTransformer(e),i=rx(n),s=rx(e);return i.numHSL===s.numHSL&&i.numRGB===s.numRGB&&i.numNumbers>=s.numNumbers?ZT(QT(i.parsed,s.parsed),t):o=>`${o>0?e:n}`},b4=(n,e)=>t=>P_(n,e,t);function x4(n){if(typeof n=="number")return b4;if(typeof n=="string")return qn.test(n)?KT:ew;if(Array.isArray(n))return QT;if(typeof n=="object")return y4}function M4(n,e,t){const i=[],s=t||x4(n[0]),r=n.length-1;for(let o=0;ot(HT(n,e,i))}function E4(n,e){const t=n.length,i=t-1;return s=>{let r=0,o=!1;if(s<=n[0]?o=!0:s>=n[i]&&(r=i-1,o=!0),!o){let l=1;for(;ls||l===i);l++);r=l-1}const a=HT(n[r],n[r+1],s);return e[r](a)}}function tw(n,e,{clamp:t=!0,ease:i,mixer:s}={}){const r=n.length;Jb(r===e.length),Jb(!i||!Array.isArray(i)||i.length===r-1),n[0]>n[r-1]&&(n=[].concat(n),e=[].concat(e),n.reverse(),e.reverse());const o=M4(e,i,s),a=r===2?S4(n,o):E4(n,o);return t?l=>a(Ng(n[0],n[r-1],l)):a}const Bh=n=>e=>1-n(1-e),D_=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,T4=n=>e=>Math.pow(e,n),nw=n=>e=>e*e*((n+1)*e-n),w4=n=>{const e=nw(n);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))},iw=1.525,A4=4/11,C4=8/11,R4=9/10,sw=n=>n,O_=T4(2),P4=Bh(O_),rw=D_(O_),ow=n=>1-Math.sin(Math.acos(n)),aw=Bh(ow),I4=D_(aw),N_=nw(iw),L4=Bh(N_),D4=D_(N_),O4=w4(iw),N4=4356/361,U4=35442/1805,F4=16061/1805,Rd=n=>{if(n===1||n===0)return n;const e=n*n;return nn<.5?.5*(1-Rd(1-n*2)):.5*Rd(n*2-1)+.5;function z4(n,e){return n.map(()=>e||rw).splice(0,n.length-1)}function V4(n){const e=n.length;return n.map((t,i)=>i!==0?i/(e-1):0)}function H4(n,e){return n.map(t=>t*e)}function Af({from:n=0,to:e=1,ease:t,offset:i,duration:s=300}){const r={done:!1,value:n},o=Array.isArray(e)?e:[n,e],a=H4(i&&i.length===o.length?i:V4(o),s);function l(){return tw(a,o,{ease:Array.isArray(t)?t:z4(o,t)})}let c=l();return{next:u=>(r.value=c(u),r.done=u>=s,r),flipTarget:()=>{o.reverse(),c=l()}}}function G4({velocity:n=0,from:e=0,power:t=.8,timeConstant:i=350,restDelta:s=.5,modifyTarget:r}){const o={done:!1,value:e};let a=t*n;const l=e+a,c=r===void 0?l:r(l);return c!==l&&(a=c-e),{next:u=>{const f=-a*Math.exp(-u/i);return o.done=!(f>s||f<-s),o.value=o.done?c:c+f,o},flipTarget:()=>{}}}const ox={keyframes:Af,spring:R_,decay:G4};function W4(n){if(Array.isArray(n.to))return Af;if(ox[n.type])return ox[n.type];const e=new Set(Object.keys(n));return e.has("ease")||e.has("duration")&&!e.has("dampingRatio")?Af:e.has("dampingRatio")||e.has("stiffness")||e.has("mass")||e.has("damping")||e.has("restSpeed")||e.has("restDelta")?R_:Af}function lw(n,e,t=0){return n-e-t}function X4(n,e,t=0,i=!0){return i?lw(e+-n,e,t):e-(n-e)+t}function $4(n,e,t,i){return i?n>=e+t:n<=-t}const q4=n=>{const e=({delta:t})=>n(t);return{start:()=>Og.update(e,!0),stop:()=>qB.update(e)}};function cw(n){var e,t,{from:i,autoplay:s=!0,driver:r=q4,elapsed:o=0,repeat:a=0,repeatType:l="loop",repeatDelay:c=0,onPlay:u,onStop:f,onComplete:d,onRepeat:h,onUpdate:p}=n,_=VT(n,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:g}=_,m,y=0,b=_.duration,v,T=!1,E=!0,S;const P=W4(_);!((t=(e=P).needsInterpolation)===null||t===void 0)&&t.call(e,i,g)&&(S=tw([0,100],[i,g],{clamp:!1}),i=0,g=100);const x=P(Object.assign(Object.assign({},_),{from:i,to:g}));function M(){y++,l==="reverse"?(E=y%2===0,o=X4(o,b,c,E)):(o=lw(o,b,c),l==="mirror"&&x.flipTarget()),T=!1,h&&h()}function L(){m.stop(),d&&d()}function F(Y){if(E||(Y=-Y),o+=Y,!T){const ee=x.next(Math.max(0,o));v=ee.value,S&&(v=S(v)),T=E?ee.done:o<=0}p==null||p(v),T&&(y===0&&(b??(b=o)),y{f==null||f(),m.stop()}}}function uw(n,e){return e?n*(1e3/e):0}function Y4({from:n=0,velocity:e=0,min:t,max:i,power:s=.8,timeConstant:r=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:l=1,modifyTarget:c,driver:u,onUpdate:f,onComplete:d,onStop:h}){let p;function _(b){return t!==void 0&&bi}function g(b){return t===void 0?i:i===void 0||Math.abs(t-b){var T;f==null||f(v),(T=b.onUpdate)===null||T===void 0||T.call(b,v)},onComplete:d,onStop:h}))}function y(b){m(Object.assign({type:"spring",stiffness:o,damping:a,restDelta:l},b))}if(_(n))y({from:n,velocity:e,to:g(n)});else{let b=s*e+n;typeof c<"u"&&(b=c(b));const v=g(b),T=v===t?-1:1;let E,S;const P=x=>{E=S,S=x,e=uw(x-E,zT().delta),(T===1&&x>v||T===-1&&xp==null?void 0:p.stop()}}const fw=(n,e)=>1-3*e+3*n,dw=(n,e)=>3*e-6*n,hw=n=>3*n,Pd=(n,e,t)=>((fw(e,t)*n+dw(e,t))*n+hw(e))*n,pw=(n,e,t)=>3*fw(e,t)*n*n+2*dw(e,t)*n+hw(e),j4=1e-7,K4=10;function Z4(n,e,t,i,s){let r,o,a=0;do o=e+(t-e)/2,r=Pd(o,i,s)-n,r>0?t=o:e=o;while(Math.abs(r)>j4&&++a=Q4?e5(o,f,n,t):d===0?f:Z4(o,a,a+lf,n,t)}return o=>o===0||o===1?o:Pd(r(o),e,i)}const Ls={},hm={};class n5{constructor(){fi(this,"subscriptions",new Set)}add(e){return this.subscriptions.add(e),()=>this.subscriptions.delete(e)}notify(e,t,i){if(this.subscriptions.size)for(const s of this.subscriptions)s(e,t,i)}clear(){this.subscriptions.clear()}}function ax(n){return!Number.isNaN(Number.parseFloat(n))}class i5{constructor(e){fi(this,"current");fi(this,"prev");fi(this,"timeDelta",0);fi(this,"lastUpdated",0);fi(this,"updateSubscribers",new n5);fi(this,"stopAnimation");fi(this,"canTrackVelocity",!1);fi(this,"updateAndNotify",e=>{this.prev=this.current,this.current=e;const{delta:t,timestamp:i}=zT();this.lastUpdated!==i&&(this.timeDelta=t,this.lastUpdated=i),Og.postRender(this.scheduleVelocityCheck),this.updateSubscribers.notify(this.current)});fi(this,"scheduleVelocityCheck",()=>Og.postRender(this.velocityCheck));fi(this,"velocityCheck",({timestamp:e})=>{this.canTrackVelocity||(this.canTrackVelocity=ax(this.current)),e!==this.lastUpdated&&(this.prev=this.current)});this.prev=this.current=e,this.canTrackVelocity=ax(this.current)}onChange(e){return this.updateSubscribers.add(e)}clearListeners(){this.updateSubscribers.clear()}set(e){this.updateAndNotify(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?uw(Number.parseFloat(this.current)-Number.parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(t=>{const{stop:i}=e(t);this.stopAnimation=i}).then(()=>this.clearAnimation())}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.stop()}}function s5(n){return new i5(n)}const{isArray:r5}=Array;function o5(){const n=et({}),e=i=>{const s=r=>{n.value[r]&&(n.value[r].stop(),n.value[r].destroy(),delete n.value[r])};i?r5(i)?i.forEach(s):s(i):Object.keys(n.value).forEach(s)},t=(i,s,r)=>{if(n.value[i])return n.value[i];const o=s5(s);return o.onChange(a=>r[i]=a),n.value[i]=o,o};return TB(e),{motionValues:n,get:t,stop:e}}function a5(n){return Array.isArray(n)}function Jr(){return{type:"spring",stiffness:500,damping:25,restDelta:.5,restSpeed:10}}function pm(n){return{type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restDelta:.01,restSpeed:10}}function l5(n){return{type:"spring",stiffness:550,damping:n===0?100:30,restDelta:.01,restSpeed:10}}function mm(){return{type:"keyframes",ease:"linear",duration:300}}function c5(n){return{type:"keyframes",duration:800,values:n}}const lx={default:l5,x:Jr,y:Jr,z:Jr,rotate:Jr,rotateX:Jr,rotateY:Jr,rotateZ:Jr,scaleX:pm,scaleY:pm,scale:pm,backgroundColor:mm,color:mm,opacity:mm};function mw(n,e){let t;return a5(e)?t=c5:t=lx[n]||lx.default,{to:e,...t(e)}}const cx={...Yc,transform:Math.round},gw={color:qn,backgroundColor:qn,outlineColor:qn,fill:qn,stroke:qn,borderColor:qn,borderTopColor:qn,borderRightColor:qn,borderBottomColor:qn,borderLeftColor:qn,borderWidth:at,borderTopWidth:at,borderRightWidth:at,borderBottomWidth:at,borderLeftWidth:at,borderRadius:at,radius:at,borderTopLeftRadius:at,borderTopRightRadius:at,borderBottomRightRadius:at,borderBottomLeftRadius:at,width:at,maxWidth:at,height:at,maxHeight:at,size:at,top:at,right:at,bottom:at,left:at,padding:at,paddingTop:at,paddingRight:at,paddingBottom:at,paddingLeft:at,margin:at,marginTop:at,marginRight:at,marginBottom:at,marginLeft:at,rotate:Zr,rotateX:Zr,rotateY:Zr,rotateZ:Zr,scale:af,scaleX:af,scaleY:af,scaleZ:af,skew:Zr,skewX:Zr,skewY:Zr,distance:at,translateX:at,translateY:at,translateZ:at,x:at,y:at,z:at,perspective:at,transformPerspective:at,opacity:Ul,originX:nx,originY:nx,originZ:at,zIndex:cx,filter:Bg,WebkitFilter:Bg,fillOpacity:Ul,strokeOpacity:Ul,numOctaves:cx},U_=n=>gw[n];function zg(n,e){return e&&typeof n=="number"&&e.transform?e.transform(n):n}function u5(n,e){let t=U_(n);return t!==Bg&&(t=jc),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const f5={linear:sw,easeIn:O_,easeInOut:rw,easeOut:P4,circIn:ow,circInOut:I4,circOut:aw,backIn:N_,backInOut:D4,backOut:L4,anticipate:O4,bounceIn:k4,bounceInOut:B4,bounceOut:Rd};function ux(n){if(Array.isArray(n)){const[e,t,i,s]=n;return t5(e,t,i,s)}else if(typeof n=="string")return f5[n];return n}function d5(n){return Array.isArray(n)&&typeof n[0]!="number"}function fx(n,e){return n==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&jc.test(e)&&!e.startsWith("url("))}function h5(n){return Array.isArray(n.to)&&n.to[0]===null&&(n.to=[...n.to],n.to[0]=n.from),n}function p5({ease:n,times:e,delay:t,...i}){const s={...i};return e&&(s.offset=e),n&&(s.ease=d5(n)?n.map(ux):ux(n)),t&&(s.elapsed=-t),s}function m5(n,e,t){return Array.isArray(e.to)&&(n.duration||(n.duration=800)),h5(e),g5(n)||(n={...n,...mw(t,e.to)}),{...e,...p5(n)}}function g5({delay:n,repeat:e,repeatType:t,repeatDelay:i,from:s,...r}){return!!Object.keys(r).length}function _5(n,e){return n[e]||n.default||n}function v5(n,e,t,i,s){const r=_5(i,n);let o=r.from===null||r.from===void 0?e.get():r.from;const a=fx(n,t);o==="none"&&a&&typeof t=="string"&&(o=u5(n,t));const l=fx(n,o);function c(f){const d={from:o,to:t,velocity:i.velocity?i.velocity:e.getVelocity(),onUpdate:h=>e.set(h)};return r.type==="inertia"||r.type==="decay"?Y4({...d,...r}):cw({...m5(r,d,n),onUpdate:h=>{d.onUpdate(h),r.onUpdate&&r.onUpdate(h)},onComplete:()=>{s&&s(),f&&f()}})}function u(f){return e.set(t),s&&s(),f&&f(),{stop:()=>{}}}return!l||!a||r.type===!1?u:c}function y5(){const{motionValues:n,stop:e,get:t}=o5();return{motionValues:n,stop:e,push:(s,r,o,a={},l)=>{const c=o[s],u=t(s,c,o);if(a&&a.immediate){u.set(r);return}const f=v5(s,u,r,a,l);u.start(f)}}}function b5(n,e={},{motionValues:t,push:i,stop:s}=y5()){const r=Ot(e),o=et(!1);$e(t,f=>{o.value=Object.values(f).filter(d=>d.isAnimating()).length>0},{immediate:!0,deep:!0});const a=f=>{if(!r||!r[f])throw new Error(`The variant ${f} does not exist.`);return r[f]},l=f=>{typeof f=="string"&&(f=a(f));const d=Object.entries(f).map(([p,_])=>{if(p!=="transition")return new Promise(g=>i(p,_,n,f.transition||mw(p,f[p]),g))}).filter(Boolean);async function h(){var p,_;await Promise.all(d),(_=(p=f.transition)==null?void 0:p.onComplete)==null||_.call(p)}return Promise.all([h()])};return{isAnimating:o,apply:l,set:f=>{const d=Cd(f)?f:a(f);Object.entries(d).forEach(([h,p])=>{h!=="transition"&&i(h,p,n,{immediate:!0})})},leave:async f=>{let d;if(r&&(r.leave&&(d=r.leave),!r.leave&&r.initial&&(d=r.initial)),!d){f();return}await l(d),f()},stop:s}}const F_=typeof window<"u",x5=()=>F_&&(window.onpointerdown===null||(Ls==null?void 0:Ls.TEST)),M5=()=>F_&&(window.ontouchstart===null||(Ls==null?void 0:Ls.TEST)),S5=()=>F_&&(window.onmousedown===null||(Ls==null?void 0:Ls.TEST));function E5({target:n,state:e,variants:t,apply:i}){const s=Ot(t),r=et(!1),o=et(!1),a=et(!1),l=Ee(()=>{let u=[...Object.keys(e.value||{})];return s&&(s.hovered&&(u=[...u,...Object.keys(s.hovered)]),s.tapped&&(u=[...u,...Object.keys(s.tapped)]),s.focused&&(u=[...u,...Object.keys(s.focused)])),u}),c=Ee(()=>{const u={};Object.assign(u,e.value),r.value&&s.hovered&&Object.assign(u,s.hovered),o.value&&s.tapped&&Object.assign(u,s.tapped),a.value&&s.focused&&Object.assign(u,s.focused);for(const f in u)l.value.includes(f)||delete u[f];return u});s.hovered&&(Ft(n,"mouseenter",()=>r.value=!0),Ft(n,"mouseleave",()=>{r.value=!1,o.value=!1})),s.tapped&&(S5()&&(Ft(n,"mousedown",()=>o.value=!0),Ft(n,"mouseup",()=>o.value=!1)),x5()&&(Ft(n,"pointerdown",()=>o.value=!0),Ft(n,"pointerup",()=>o.value=!1)),M5()&&(Ft(n,"touchstart",()=>o.value=!0),Ft(n,"touchend",()=>o.value=!1))),s.focused&&(Ft(n,"focus",()=>a.value=!0),Ft(n,"blur",()=>a.value=!1)),$e([r,o,a],()=>{i(c.value)})}function T5({set:n,target:e,variants:t,variant:i}){const s=Ot(t);$e(()=>e,()=>{s&&(s.initial&&(n("initial"),i.value="initial"),s.enter&&(i.value="enter"))},{immediate:!0,flush:"pre"})}function w5({state:n,apply:e}){$e(n,t=>{t&&e(t)},{immediate:!0})}function _w({target:n,variants:e,variant:t}){const i=Ot(e);i&&(i.visible||i.visibleOnce)&&VB(n,([{isIntersecting:s}])=>{i.visible?s?t.value="visible":t.value="initial":i.visibleOnce&&(s&&t.value!=="visibleOnce"?t.value="visibleOnce":t.value||(t.value="initial"))})}function A5(n,e={syncVariants:!0,lifeCycleHooks:!0,visibilityHooks:!0,eventListeners:!0}){e.lifeCycleHooks&&T5(n),e.syncVariants&&w5(n),e.visibilityHooks&&_w(n),e.eventListeners&&E5(n)}function vw(n={}){const e=bi({...n}),t=et({});return $e(e,()=>{const i={};for(const[s,r]of Object.entries(e)){const o=U_(s),a=zg(r,o);i[s]=a}t.value=i},{immediate:!0,deep:!0}),{state:e,style:t}}function k_(n,e){$e(()=>oi(n),t=>{t&&e(t)},{immediate:!0})}const C5={x:"translateX",y:"translateY",z:"translateZ"};function yw(n={},e=!0){const t=bi({...n}),i=et("");return $e(t,s=>{let r="",o=!1;if(e&&(s.x||s.y||s.z)){const a=[s.x||0,s.y||0,s.z||0].map(l=>zg(l,at)).join(",");r+=`translate3d(${a}) `,o=!0}for(const[a,l]of Object.entries(s)){if(e&&(a==="x"||a==="y"||a==="z"))continue;const c=U_(a),u=zg(l,c);r+=`${C5[a]||a}(${u}) `}e&&!o&&(r+="translateZ(0px) "),i.value=r.trim()},{immediate:!0,deep:!0}),{state:t,transform:i}}const R5=["","X","Y","Z"],P5=["perspective","translate","scale","rotate","skew"],bw=["transformPerspective","x","y","z"];P5.forEach(n=>{R5.forEach(e=>{const t=n+e;bw.push(t)})});const I5=new Set(bw);function B_(n){return I5.has(n)}const L5=new Set(["originX","originY","originZ"]);function xw(n){return L5.has(n)}function D5(n){const e={},t={};return Object.entries(n).forEach(([i,s])=>{B_(i)||xw(i)?e[i]=s:t[i]=s}),{transform:e,style:t}}function zh(n){const{transform:e,style:t}=D5(n),{transform:i}=yw(e),{style:s}=vw(t);return i.value&&(s.value.transform=i.value),s.value}function O5(n,e){let t,i;const{state:s,style:r}=vw();return k_(n,o=>{i=o;for(const a of Object.keys(gw))o.style[a]===null||o.style[a]===""||B_(a)||xw(a)||(s[a]=o.style[a]);t&&Object.entries(t).forEach(([a,l])=>o.style[a]=l),e&&e(s)}),$e(r,o=>{if(!i){t=o;return}for(const a in o)i.style[a]=o[a]},{immediate:!0}),{style:s}}function N5(n){const e=n.trim().split(/\) |\)/);if(e.length===1)return{};const t=i=>i.endsWith("px")||i.endsWith("deg")?Number.parseFloat(i):Number.isNaN(Number(i))?Number(i):i;return e.reduce((i,s)=>{if(!s)return i;const[r,o]=s.split("("),l=o.split(",").map(u=>t(u.endsWith(")")?u.replace(")",""):u.trim())),c=l.length===1?l[0]:l;return{...i,[r]:c}},{})}function U5(n,e){Object.entries(N5(e)).forEach(([t,i])=>{const s=["x","y","z"];if(t==="translate3d"){if(i===0){s.forEach(r=>n[r]=0);return}i.forEach((r,o)=>n[s[o]]=r);return}if(i=Number.parseFloat(`${i}`),t==="translateX"){n.x=i;return}if(t==="translateY"){n.y=i;return}if(t==="translateZ"){n.z=i;return}n[t]=i})}function F5(n,e){let t,i;const{state:s,transform:r}=yw();return k_(n,o=>{i=o,o.style.transform&&U5(s,o.style.transform),t&&(o.style.transform=t),e&&e(s)}),$e(r,o=>{if(!i){t=o;return}i.style.transform=o},{immediate:!0}),{transform:s}}function k5(n){return Object.entries(n)}function B5(n,e){const t=bi({}),i=o=>Object.entries(o).forEach(([a,l])=>t[a]=l),{style:s}=O5(n,i),{transform:r}=F5(n,i);return $e(t,o=>{k5(o).forEach(([a,l])=>{const c=B_(a)?r:s;c[a]&&c[a]===l||(c[a]=l)})},{immediate:!0,deep:!0}),k_(n,()=>e),{motionProperties:t,style:s,transform:r}}function z5(n={}){const e=Ot(n),t=et();return{state:Ee(()=>{if(t.value)return e[t.value]}),variant:t}}function Mw(n,e={},t){const{motionProperties:i}=B5(n),{variant:s,state:r}=z5(e),o=b5(i,e),a={target:n,variant:s,variants:e,state:r,motionProperties:i,...o};return A5(a,t),a}const Sw=["delay","duration"],V5=["initial","enter","leave","visible","visible-once","visibleOnce","hovered","tapped","focused",...Sw];function H5(n){return Sw.includes(n)}function G5(n,e){const t=n.props?n.props:n.data&&n.data.attrs?n.data.attrs:{};if(t){t.variants&&Cd(t.variants)&&(e.value={...e.value,...t.variants});for(let i of V5)if(!(!t||!t[i])){if(H5(i)&&typeof t[i]=="number"){for(const s of["enter","visible","visibleOnce"]){const r=e.value[s];r!=null&&(r.transition??(r.transition={}),r.transition[i]=t[i])}continue}if(Cd(t[i])){const s=t[i];i==="visible-once"&&(i="visibleOnce"),e.value[i]=s}}}}function gm(n,e=!1){return{created:(s,r,o)=>{const a=r.value&&typeof r.value=="string"?r.value:o.key;a&&hm[a]&&hm[a].stop();const l=e?structuredClone(ut(n)||{}):n||{},c=et(l);typeof r.value=="object"&&(c.value=r.value),G5(o,c);const f=Mw(s,c,{eventListeners:!0,lifeCycleHooks:!0,syncVariants:!0,visibilityHooks:!1});s.motionInstance=f,a&&(hm[a]=f)},mounted:(s,r,o)=>{s.motionInstance&&_w(s.motionInstance)},getSSRProps(s,r){let{initial:o}=s.value||r&&(r==null?void 0:r.props)||{};o=Ot(o);const a=wT({},(n==null?void 0:n.initial)||{},o||{});return!a||Object.keys(a).length===0?void 0:{style:zh(a)}}}}const W5={initial:{opacity:0},enter:{opacity:1}},X5={initial:{opacity:0},visible:{opacity:1}},$5={initial:{opacity:0},visibleOnce:{opacity:1}},q5={initial:{scale:0,opacity:0},enter:{scale:1,opacity:1}},Y5={initial:{scale:0,opacity:0},visible:{scale:1,opacity:1}},j5={initial:{scale:0,opacity:0},visibleOnce:{scale:1,opacity:1}},K5={initial:{x:-100,rotate:90,opacity:0},enter:{x:0,rotate:0,opacity:1}},Z5={initial:{x:-100,rotate:90,opacity:0},visible:{x:0,rotate:0,opacity:1}},J5={initial:{x:-100,rotate:90,opacity:0},visibleOnce:{x:0,rotate:0,opacity:1}},Q5={initial:{x:100,rotate:-90,opacity:0},enter:{x:0,rotate:0,opacity:1}},ez={initial:{x:100,rotate:-90,opacity:0},visible:{x:0,rotate:0,opacity:1}},tz={initial:{x:100,rotate:-90,opacity:0},visibleOnce:{x:0,rotate:0,opacity:1}},nz={initial:{y:-100,rotate:-90,opacity:0},enter:{y:0,rotate:0,opacity:1}},iz={initial:{y:-100,rotate:-90,opacity:0},visible:{y:0,rotate:0,opacity:1}},sz={initial:{y:-100,rotate:-90,opacity:0},visibleOnce:{y:0,rotate:0,opacity:1}},rz={initial:{y:100,rotate:90,opacity:0},enter:{y:0,rotate:0,opacity:1}},oz={initial:{y:100,rotate:90,opacity:0},visible:{y:0,rotate:0,opacity:1}},az={initial:{y:100,rotate:90,opacity:0},visibleOnce:{y:0,rotate:0,opacity:1}},lz={initial:{x:-100,opacity:0},enter:{x:0,opacity:1}},cz={initial:{x:-100,opacity:0},visible:{x:0,opacity:1}},uz={initial:{x:-100,opacity:0},visibleOnce:{x:0,opacity:1}},fz={initial:{x:100,opacity:0},enter:{x:0,opacity:1}},dz={initial:{x:100,opacity:0},visible:{x:0,opacity:1}},hz={initial:{x:100,opacity:0},visibleOnce:{x:0,opacity:1}},pz={initial:{y:-100,opacity:0},enter:{y:0,opacity:1}},mz={initial:{y:-100,opacity:0},visible:{y:0,opacity:1}},gz={initial:{y:-100,opacity:0},visibleOnce:{y:0,opacity:1}},_z={initial:{y:100,opacity:0},enter:{y:0,opacity:1}},vz={initial:{y:100,opacity:0},visible:{y:0,opacity:1}},yz={initial:{y:100,opacity:0},visibleOnce:{y:0,opacity:1}},Id={__proto__:null,fade:W5,fadeVisible:X5,fadeVisibleOnce:$5,pop:q5,popVisible:Y5,popVisibleOnce:j5,rollBottom:rz,rollLeft:K5,rollRight:Q5,rollTop:nz,rollVisibleBottom:oz,rollVisibleLeft:Z5,rollVisibleOnceBottom:az,rollVisibleOnceLeft:J5,rollVisibleOnceRight:tz,rollVisibleOnceTop:sz,rollVisibleRight:ez,rollVisibleTop:iz,slideBottom:_z,slideLeft:lz,slideRight:fz,slideTop:pz,slideVisibleBottom:vz,slideVisibleLeft:cz,slideVisibleOnceBottom:yz,slideVisibleOnceLeft:uz,slideVisibleOnceRight:hz,slideVisibleOnceTop:gz,slideVisibleRight:dz,slideVisibleTop:mz};function bz(n){const e="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;",t="aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------",i=new RegExp(e.split("").join("|"),"g");return n.toString().replace(/[A-Z]/g,s=>`-${s}`).toLowerCase().replace(/\s+/g,"-").replace(i,s=>t.charAt(e.indexOf(s))).replace(/&/g,"-and-").replace(/[^\w\-]+/g,"").replace(/-{2,}/g,"-").replace(/^-+/,"").replace(/-+$/,"")}const Ew=Symbol(""),Tw={preset:{type:String,required:!1},instance:{type:Object,required:!1},variants:{type:Object,required:!1},initial:{type:Object,required:!1},enter:{type:Object,required:!1},leave:{type:Object,required:!1},visible:{type:Object,required:!1},visibleOnce:{type:Object,required:!1},hovered:{type:Object,required:!1},tapped:{type:Object,required:!1},focused:{type:Object,required:!1},delay:{type:[Number,String],required:!1},duration:{type:[Number,String],required:!1}};function xz(n){return Object.prototype.toString.call(n)==="[object Object]"}function Vg(n){if(Array.isArray(n))return n.map(Vg);if(xz(n)){const e={};for(const t in n)e[t]=Vg(n[t]);return e}return n}function ww(n){const e=bi({}),t=En(Ew,{}),i=Ee(()=>n.preset==null?{}:t!=null&&n.preset in t?structuredClone(ut(t)[n.preset]):n.preset in Id?structuredClone(Id[n.preset]):{}),s=Ee(()=>({initial:n.initial,enter:n.enter,leave:n.leave,visible:n.visible,visibleOnce:n.visibleOnce,hovered:n.hovered,tapped:n.tapped,focused:n.focused}));function r(l,c){for(const u of["delay","duration"]){if(c[u]==null)continue;const f=Number.parseInt(c[u]);for(const d of["enter","visible","visibleOnce"]){const h=l[d];h!=null&&(h.transition??(h.transition={}),h.transition[u]=f)}}return l}const o=Ee(()=>{const l=wT({},s.value,i.value,n.variants||{});return r({...l},n)});function a(l,c,u){var d;l.props??(l.props={}),(d=l.props).style??(d.style={}),l.props.style={...l.props.style,...u};const f=r(Vg(o.value),l.props);return l.props.onVnodeMounted=({el:h})=>{e[c]=Mw(h,f)},l.props.onVnodeUpdated=({el:h})=>{const p=zh(e[c].state);for(const[_,g]of Object.entries(p))h.style[_]=g},l}return{motionConfig:o,setNodeInstance:a}}const Mz=fn({name:"Motion",props:{...Tw,is:{type:[String,Object],default:"div"}},setup(n){const e=A0(),{motionConfig:t,setNodeInstance:i}=ww(n);return()=>{const s=zh(t.value.initial||{}),r=Ds(n.is,void 0,e);return i(r,0,s),r}}}),Sz=fn({name:"MotionGroup",props:{...Tw,is:{type:[String,Object],required:!1}},setup(n){const e=A0(),{motionConfig:t,setNodeInstance:i}=ww(n);return()=>{var o;const s=zh(t.value.initial||{}),r=((o=e.default)==null?void 0:o.call(e))||[];for(let a=0;a
'};t.configure=function(p){var _,g;for(_ in p)g=p[_],g!==void 0&&p.hasOwnProperty(_)&&(i[_]=g);return this},t.status=null,t.set=function(p){var _=t.isStarted();p=s(p,i.minimum,1),t.status=p===1?null:p;var g=t.render(!_),m=g.querySelector(i.barSelector),y=i.speed,b=i.easing;return g.offsetWidth,a(function(v){i.positionUsing===""&&(i.positionUsing=t.getPositioningCSS()),l(m,o(p,y,b)),p===1?(l(g,{transition:"none",opacity:1}),g.offsetWidth,setTimeout(function(){l(g,{transition:"all "+y+"ms linear",opacity:0}),setTimeout(function(){t.remove(),v()},y)},y)):setTimeout(v,y)}),this},t.isStarted=function(){return typeof t.status=="number"},t.start=function(){t.status||t.set(0);var p=function(){setTimeout(function(){t.status&&(t.trickle(),p())},i.trickleSpeed)};return i.trickle&&p(),this},t.done=function(p){return!p&&!t.status?this:t.inc(.3+.5*Math.random()).set(1)},t.inc=function(p){var _=t.status;return _?(typeof p!="number"&&(p=(1-_)*s(Math.random()*_,.1,.95)),_=s(_+p,0,.994),t.set(_)):t.start()},t.trickle=function(){return t.inc(Math.random()*i.trickleRate)},function(){var p=0,_=0;t.promise=function(g){return!g||g.state()==="resolved"?this:(_===0&&t.start(),p++,_++,g.always(function(){_--,_===0?(p=0,t.done()):t.set((p-_)/p)}),this)}}(),t.render=function(p){if(t.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var _=document.createElement("div");_.id="nprogress",_.innerHTML=i.template;var g=_.querySelector(i.barSelector),m=p?"-100":r(t.status||0),y=document.querySelector(i.parent),b;return l(g,{transition:"all 0 linear",transform:"translate3d("+m+"%,0,0)"}),i.showSpinner||(b=_.querySelector(i.spinnerSelector),b&&h(b)),y!=document.body&&u(y,"nprogress-custom-parent"),y.appendChild(_),_},t.remove=function(){f(document.documentElement,"nprogress-busy"),f(document.querySelector(i.parent),"nprogress-custom-parent");var p=document.getElementById("nprogress");p&&h(p)},t.isRendered=function(){return!!document.getElementById("nprogress")},t.getPositioningCSS=function(){var p=document.body.style,_="WebkitTransform"in p?"Webkit":"MozTransform"in p?"Moz":"msTransform"in p?"ms":"OTransform"in p?"O":"";return _+"Perspective"in p?"translate3d":_+"Transform"in p?"translate":"margin"};function s(p,_,g){return p<_?_:p>g?g:p}function r(p){return(-1+p)*100}function o(p,_,g){var m;return i.positionUsing==="translate3d"?m={transform:"translate3d("+r(p)+"%,0,0)"}:i.positionUsing==="translate"?m={transform:"translate("+r(p)+"%,0)"}:m={"margin-left":r(p)+"%"},m.transition="all "+_+"ms "+g,m}var a=function(){var p=[];function _(){var g=p.shift();g&&g(_)}return function(g){p.push(g),p.length==1&&_()}}(),l=function(){var p=["Webkit","O","Moz","ms"],_={};function g(v){return v.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(T,E){return E.toUpperCase()})}function m(v){var T=document.body.style;if(v in T)return v;for(var E=p.length,S=v.charAt(0).toUpperCase()+v.slice(1),P;E--;)if(P=p[E]+S,P in T)return P;return v}function y(v){return v=g(v),_[v]||(_[v]=m(v))}function b(v,T,E){T=y(T),v.style[T]=E}return function(v,T){var E=arguments,S,P;if(E.length==2)for(S in T)P=T[S],P!==void 0&&T.hasOwnProperty(S)&&b(v,S,P);else b(v,E[1],E[2])}}();function c(p,_){var g=typeof p=="string"?p:d(p);return g.indexOf(" "+_+" ")>=0}function u(p,_){var g=d(p),m=g+_;c(g,_)||(p.className=m.substring(1))}function f(p,_){var g=d(p),m;c(p,_)&&(m=g.replace(" "+_+" "," "),p.className=m.substring(1,m.length-1))}function d(p){return(" "+(p.className||"")+" ").replace(/\s+/gi," ")}function h(p){p&&p.parentNode&&p.parentNode.removeChild(p)}return t})}(Rf)),Rf.exports}var Cz=Az();const Aw=Tz(Cz);/*! + * pinia v3.0.2 * (c) 2025 Eduardo San Martin Morote * @license MIT - */let Aw;const Vh=n=>Aw=n,Cw=Symbol();function Hg(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}var kl;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(kl||(kl={}));function Cz(){const n=g0(!0),e=n.run(()=>et({}));let t=[],i=[];const s=M0({install(r){Vh(s),s._a=r,r.provide(Cw,s),r.config.globalProperties.$pinia=s,i.forEach(o=>t.push(o)),i=[]},use(r){return this._a?t.push(r):i.push(r),this},_p:t,_a:null,_e:n,_s:new Map,state:e});return s}const Rw=()=>{};function hx(n,e,t,i=Rw){n.push(e);const s=()=>{const r=n.indexOf(e);r>-1&&(n.splice(r,1),i())};return!t&&Xd()&&_0(s),s}function ea(n,...e){n.slice().forEach(t=>{t(...e)})}const Rz=n=>n(),px=Symbol(),_m=Symbol();function Gg(n,e){n instanceof Map&&e instanceof Map?e.forEach((t,i)=>n.set(i,t)):n instanceof Set&&e instanceof Set&&e.forEach(n.add,n);for(const t in e){if(!e.hasOwnProperty(t))continue;const i=e[t],s=n[t];Hg(s)&&Hg(i)&&n.hasOwnProperty(t)&&!Pt(i)&&!Rs(i)?n[t]=Gg(s,i):n[t]=i}return n}const Pz=Symbol();function Iz(n){return!Hg(n)||!n.hasOwnProperty(Pz)}const{assign:tr}=Object;function Lz(n){return!!(Pt(n)&&n.effect)}function Dz(n,e,t,i){const{state:s,actions:r,getters:o}=e,a=t.state.value[n];let l;function c(){a||(t.state.value[n]=s?s():{});const u=aS(t.state.value[n]);return tr(u,r,Object.keys(o||{}).reduce((f,d)=>(f[d]=M0(Ee(()=>{Vh(t);const h=t._s.get(n);return o[d].call(h,h)})),f),{}))}return l=Pw(n,c,e,t,i,!0),l}function Pw(n,e,t={},i,s,r){let o;const a=tr({actions:{}},t),l={deep:!0};let c,u,f=[],d=[],h;const p=i.state.value[n];!r&&!p&&(i.state.value[n]={}),et({});let _;function g(P){let x;c=u=!1,typeof P=="function"?(P(i.state.value[n]),x={type:kl.patchFunction,storeId:n,events:h}):(Gg(i.state.value[n],P),x={type:kl.patchObject,payload:P,storeId:n,events:h});const M=_=Symbol();Er().then(()=>{_===M&&(c=!0)}),u=!0,ea(f,x,i.state.value[n])}const m=r?function(){const{state:x}=t,M=x?x():{};this.$patch(L=>{tr(L,M)})}:Rw;function y(){o.stop(),f=[],d=[],i._s.delete(n)}const b=(P,x="")=>{if(px in P)return P[_m]=x,P;const M=function(){Vh(i);const L=Array.from(arguments),F=[],H=[];function Y(Q){F.push(Q)}function ee(Q){H.push(Q)}ea(d,{args:L,name:M[_m],store:T,after:Y,onError:ee});let K;try{K=P.apply(this&&this.$id===n?this:T,L)}catch(Q){throw ea(H,Q),Q}return K instanceof Promise?K.then(Q=>(ea(F,Q),Q)).catch(Q=>(ea(H,Q),Promise.reject(Q))):(ea(F,K),K)};return M[px]=!0,M[_m]=x,M},v={_p:i,$id:n,$onAction:hx.bind(null,d),$patch:g,$reset:m,$subscribe(P,x={}){const M=hx(f,P,x.detached,()=>L()),L=o.run(()=>$e(()=>i.state.value[n],F=>{(x.flush==="sync"?u:c)&&P({storeId:n,type:kl.direct,events:h},F)},tr({},l,x)));return M},$dispose:y},T=bi(v);i._s.set(n,T);const S=(i._a&&i._a.runWithContext||Rz)(()=>i._e.run(()=>(o=g0()).run(()=>e({action:b}))));for(const P in S){const x=S[P];if(Pt(x)&&!Lz(x)||Rs(x))r||(p&&Iz(x)&&(Pt(x)?x.value=p[P]:Gg(x,p[P])),i.state.value[n][P]=x);else if(typeof x=="function"){const M=b(x,P);S[P]=M,a.actions[P]=x}}return tr(T,S),tr(ut(T),S),Object.defineProperty(T,"$state",{get:()=>i.state.value[n],set:P=>{g(x=>{tr(x,P)})}}),i._p.forEach(P=>{tr(T,o.run(()=>P({store:T,app:i._a,pinia:i,options:a})))}),p&&r&&t.hydrate&&t.hydrate(T.$state,p),c=!0,u=!0,T}/*! #__NO_SIDE_EFFECTS__ */function Oz(n,e,t){let i;const s=typeof e=="function";i=s?t:e;function r(o,a){const l=Cc();return o=o||(l?En(Cw,null):null),o&&Vh(o),o=Aw,o._s.has(n)||(s?Pw(n,e,i,o):Dz(n,i,o)),o._s.get(n)}return r.$id=n,r}function Nz(n){const e=ut(n),t={};for(const i in e){const s=e[i];s.effect?t[i]=Ee({get:()=>n[i],set(r){n[i]=r}}):(Pt(s)||Rs(s))&&(t[i]=lS(n,i))}return t}const Uz=n=>{const e={};Object.entries(Object.assign({"/src/layouts/default.vue":()=>je(()=>import("./default-CBhsjBzT.js"),__vite__mapDeps([0,1,2])),"/src/layouts/stage.vue":()=>je(()=>import("./stage-DMHqfEjy.js"),[])})).forEach(([s,r])=>{let o=s.replace("/src/layouts/","").replace(".vue","");e[o]=r});function i(s,r=!0){return s.map(o=>{var a,l,c,u,f,d;if(((a=o.children)==null?void 0:a.length)>0&&(o.children=i(o.children,!1)),r){if(!o.component&&((l=o.children)==null?void 0:l.find(p=>{var _;return(p.path===""||p.path==="/")&&((_=p.meta)==null?void 0:_.isLayout)})))return o;if(((c=o.meta)==null?void 0:c.layout)!==!1)return{path:o.path,component:e[((u=o.meta)==null?void 0:u.layout)||"default"],children:o.path==="/"?[o]:[{...o,path:""}],meta:{isLayout:!0}}}return(f=o.meta)!=null&&f.layout?{path:o.path,component:e[(d=o.meta)==null?void 0:d.layout],children:[{...o,path:""}],meta:{isLayout:!0}}:o})}return i(n)};/*! + */let Cw;const Vh=n=>Cw=n,Rw=Symbol();function Hg(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}var kl;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(kl||(kl={}));function Rz(){const n=g0(!0),e=n.run(()=>et({}));let t=[],i=[];const s=M0({install(r){Vh(s),s._a=r,r.provide(Rw,s),r.config.globalProperties.$pinia=s,i.forEach(o=>t.push(o)),i=[]},use(r){return this._a?t.push(r):i.push(r),this},_p:t,_a:null,_e:n,_s:new Map,state:e});return s}const Pw=()=>{};function hx(n,e,t,i=Pw){n.push(e);const s=()=>{const r=n.indexOf(e);r>-1&&(n.splice(r,1),i())};return!t&&Xd()&&_0(s),s}function ea(n,...e){n.slice().forEach(t=>{t(...e)})}const Pz=n=>n(),px=Symbol(),_m=Symbol();function Gg(n,e){n instanceof Map&&e instanceof Map?e.forEach((t,i)=>n.set(i,t)):n instanceof Set&&e instanceof Set&&e.forEach(n.add,n);for(const t in e){if(!e.hasOwnProperty(t))continue;const i=e[t],s=n[t];Hg(s)&&Hg(i)&&n.hasOwnProperty(t)&&!Pt(i)&&!Rs(i)?n[t]=Gg(s,i):n[t]=i}return n}const Iz=Symbol();function Lz(n){return!Hg(n)||!Object.prototype.hasOwnProperty.call(n,Iz)}const{assign:tr}=Object;function Dz(n){return!!(Pt(n)&&n.effect)}function Oz(n,e,t,i){const{state:s,actions:r,getters:o}=e,a=t.state.value[n];let l;function c(){a||(t.state.value[n]=s?s():{});const u=lS(t.state.value[n]);return tr(u,r,Object.keys(o||{}).reduce((f,d)=>(f[d]=M0(Ee(()=>{Vh(t);const h=t._s.get(n);return o[d].call(h,h)})),f),{}))}return l=Iw(n,c,e,t,i,!0),l}function Iw(n,e,t={},i,s,r){let o;const a=tr({actions:{}},t),l={deep:!0};let c,u,f=[],d=[],h;const p=i.state.value[n];!r&&!p&&(i.state.value[n]={}),et({});let _;function g(P){let x;c=u=!1,typeof P=="function"?(P(i.state.value[n]),x={type:kl.patchFunction,storeId:n,events:h}):(Gg(i.state.value[n],P),x={type:kl.patchObject,payload:P,storeId:n,events:h});const M=_=Symbol();Er().then(()=>{_===M&&(c=!0)}),u=!0,ea(f,x,i.state.value[n])}const m=r?function(){const{state:x}=t,M=x?x():{};this.$patch(L=>{tr(L,M)})}:Pw;function y(){o.stop(),f=[],d=[],i._s.delete(n)}const b=(P,x="")=>{if(px in P)return P[_m]=x,P;const M=function(){Vh(i);const L=Array.from(arguments),F=[],H=[];function Y(Q){F.push(Q)}function ee(Q){H.push(Q)}ea(d,{args:L,name:M[_m],store:T,after:Y,onError:ee});let K;try{K=P.apply(this&&this.$id===n?this:T,L)}catch(Q){throw ea(H,Q),Q}return K instanceof Promise?K.then(Q=>(ea(F,Q),Q)).catch(Q=>(ea(H,Q),Promise.reject(Q))):(ea(F,K),K)};return M[px]=!0,M[_m]=x,M},v={_p:i,$id:n,$onAction:hx.bind(null,d),$patch:g,$reset:m,$subscribe(P,x={}){const M=hx(f,P,x.detached,()=>L()),L=o.run(()=>$e(()=>i.state.value[n],F=>{(x.flush==="sync"?u:c)&&P({storeId:n,type:kl.direct,events:h},F)},tr({},l,x)));return M},$dispose:y},T=bi(v);i._s.set(n,T);const S=(i._a&&i._a.runWithContext||Pz)(()=>i._e.run(()=>(o=g0()).run(()=>e({action:b}))));for(const P in S){const x=S[P];if(Pt(x)&&!Dz(x)||Rs(x))r||(p&&Lz(x)&&(Pt(x)?x.value=p[P]:Gg(x,p[P])),i.state.value[n][P]=x);else if(typeof x=="function"){const M=b(x,P);S[P]=M,a.actions[P]=x}}return tr(T,S),tr(ut(T),S),Object.defineProperty(T,"$state",{get:()=>i.state.value[n],set:P=>{g(x=>{tr(x,P)})}}),i._p.forEach(P=>{tr(T,o.run(()=>P({store:T,app:i._a,pinia:i,options:a})))}),p&&r&&t.hydrate&&t.hydrate(T.$state,p),c=!0,u=!0,T}/*! #__NO_SIDE_EFFECTS__ */function Nz(n,e,t){let i;const s=typeof e=="function";i=s?t:e;function r(o,a){const l=Cc();return o=o||(l?En(Rw,null):null),o&&Vh(o),o=Cw,o._s.has(n)||(s?Iw(n,e,i,o):Oz(n,i,o)),o._s.get(n)}return r.$id=n,r}function Uz(n){const e=ut(n),t={};for(const i in e){const s=e[i];s.effect?t[i]=Ee({get:()=>n[i],set(r){n[i]=r}}):(Pt(s)||Rs(s))&&(t[i]=cS(n,i))}return t}const Fz=n=>{const e={};Object.entries(Object.assign({"/src/layouts/default.vue":()=>je(()=>import("./default-_iAhyx9C.js"),__vite__mapDeps([0,1,2])),"/src/layouts/stage.vue":()=>je(()=>import("./stage-U8FCK4AA.js"),[])})).forEach(([s,r])=>{let o=s.replace("/src/layouts/","").replace(".vue","");e[o]=r});function i(s,r=!0){return s.map(o=>{var a,l,c,u,f,d;if(((a=o.children)==null?void 0:a.length)>0&&(o.children=i(o.children,!1)),r){if(!o.component&&((l=o.children)==null?void 0:l.find(p=>{var _;return(p.path===""||p.path==="/")&&((_=p.meta)==null?void 0:_.isLayout)})))return o;if(((c=o.meta)==null?void 0:c.layout)!==!1)return{path:o.path,component:e[((u=o.meta)==null?void 0:u.layout)||"default"],children:o.path==="/"?[o]:[{...o,path:""}],meta:{isLayout:!0}}}return(f=o.meta)!=null&&f.layout?{path:o.path,component:e[(d=o.meta)==null?void 0:d.layout],children:[{...o,path:""}],meta:{isLayout:!0}}:o})}return i(n)};/*! * vue-router v4.5.0 * (c) 2024 Eduardo San Martin Morote * @license MIT - */const na=typeof document<"u";function Iw(n){return typeof n=="object"||"displayName"in n||"props"in n||"__vccOpts"in n}function Fz(n){return n.__esModule||n[Symbol.toStringTag]==="Module"||n.default&&Iw(n.default)}const Mt=Object.assign;function vm(n,e){const t={};for(const i in e){const s=e[i];t[i]=Bi(s)?s.map(n):n(s)}return t}const Bl=()=>{},Bi=Array.isArray,Lw=/#/g,kz=/&/g,Bz=/\//g,zz=/=/g,Vz=/\?/g,Dw=/\+/g,Hz=/%5B/g,Gz=/%5D/g,Ow=/%5E/g,Wz=/%60/g,Nw=/%7B/g,Xz=/%7C/g,Uw=/%7D/g,$z=/%20/g;function z_(n){return encodeURI(""+n).replace(Xz,"|").replace(Hz,"[").replace(Gz,"]")}function qz(n){return z_(n).replace(Nw,"{").replace(Uw,"}").replace(Ow,"^")}function Wg(n){return z_(n).replace(Dw,"%2B").replace($z,"+").replace(Lw,"%23").replace(kz,"%26").replace(Wz,"`").replace(Nw,"{").replace(Uw,"}").replace(Ow,"^")}function Yz(n){return Wg(n).replace(zz,"%3D")}function jz(n){return z_(n).replace(Lw,"%23").replace(Vz,"%3F")}function Kz(n){return n==null?"":jz(n).replace(Bz,"%2F")}function bc(n){try{return decodeURIComponent(""+n)}catch{}return""+n}const Zz=/\/$/,Jz=n=>n.replace(Zz,"");function ym(n,e,t="/"){let i,s={},r="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return a=0&&(l=-1),l>-1&&(i=e.slice(0,l),r=e.slice(l+1,a>-1?a:e.length),s=n(r)),a>-1&&(i=i||e.slice(0,a),o=e.slice(a,e.length)),i=nV(i??e,t),{fullPath:i+(r&&"?")+r+o,path:i,query:s,hash:bc(o)}}function Qz(n,e){const t=e.query?n(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function mx(n,e){return!e||!n.toLowerCase().startsWith(e.toLowerCase())?n:n.slice(e.length)||"/"}function eV(n,e,t){const i=e.matched.length-1,s=t.matched.length-1;return i>-1&&i===s&&Ra(e.matched[i],t.matched[s])&&Fw(e.params,t.params)&&n(e.query)===n(t.query)&&e.hash===t.hash}function Ra(n,e){return(n.aliasOf||n)===(e.aliasOf||e)}function Fw(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(!tV(n[t],e[t]))return!1;return!0}function tV(n,e){return Bi(n)?gx(n,e):Bi(e)?gx(e,n):n===e}function gx(n,e){return Bi(e)?n.length===e.length&&n.every((t,i)=>t===e[i]):n.length===1&&n[0]===e}function nV(n,e){if(n.startsWith("/"))return n;if(!n)return e;const t=e.split("/"),i=n.split("/"),s=i[i.length-1];(s===".."||s===".")&&i.push("");let r=t.length-1,o,a;for(o=0;o1&&r--;else break;return t.slice(0,r).join("/")+"/"+i.slice(o).join("/")}const Qs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var xc;(function(n){n.pop="pop",n.push="push"})(xc||(xc={}));var zl;(function(n){n.back="back",n.forward="forward",n.unknown=""})(zl||(zl={}));function iV(n){if(!n)if(na){const e=document.querySelector("base");n=e&&e.getAttribute("href")||"/",n=n.replace(/^\w+:\/\/[^\/]+/,"")}else n="/";return n[0]!=="/"&&n[0]!=="#"&&(n="/"+n),Jz(n)}const sV=/^[^#]+#/;function rV(n,e){return n.replace(sV,"#")+e}function oV(n,e){const t=document.documentElement.getBoundingClientRect(),i=n.getBoundingClientRect();return{behavior:e.behavior,left:i.left-t.left-(e.left||0),top:i.top-t.top-(e.top||0)}}const Hh=()=>({left:window.scrollX,top:window.scrollY});function aV(n){let e;if("el"in n){const t=n.el,i=typeof t=="string"&&t.startsWith("#"),s=typeof t=="string"?i?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!s)return;e=oV(s,n)}else e=n;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function _x(n,e){return(history.state?history.state.position-e:-1)+n}const Xg=new Map;function lV(n,e){Xg.set(n,e)}function cV(n){const e=Xg.get(n);return Xg.delete(n),e}let uV=()=>location.protocol+"//"+location.host;function kw(n,e){const{pathname:t,search:i,hash:s}=e,r=n.indexOf("#");if(r>-1){let a=s.includes(n.slice(r))?n.slice(r).length:1,l=s.slice(a);return l[0]!=="/"&&(l="/"+l),mx(l,"")}return mx(t,n)+i+s}function fV(n,e,t,i){let s=[],r=[],o=null;const a=({state:d})=>{const h=kw(n,location),p=t.value,_=e.value;let g=0;if(d){if(t.value=h,e.value=d,o&&o===p){o=null;return}g=_?d.position-_.position:0}else i(h);s.forEach(m=>{m(t.value,p,{delta:g,type:xc.pop,direction:g?g>0?zl.forward:zl.back:zl.unknown})})};function l(){o=t.value}function c(d){s.push(d);const h=()=>{const p=s.indexOf(d);p>-1&&s.splice(p,1)};return r.push(h),h}function u(){const{history:d}=window;d.state&&d.replaceState(Mt({},d.state,{scroll:Hh()}),"")}function f(){for(const d of r)d();r=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:l,listen:c,destroy:f}}function vx(n,e,t,i=!1,s=!1){return{back:n,current:e,forward:t,replaced:i,position:window.history.length,scroll:s?Hh():null}}function dV(n){const{history:e,location:t}=window,i={value:kw(n,t)},s={value:e.state};s.value||r(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(l,c,u){const f=n.indexOf("#"),d=f>-1?(t.host&&document.querySelector("base")?n:n.slice(f))+l:uV()+n+l;try{e[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(h){console.error(h),t[u?"replace":"assign"](d)}}function o(l,c){const u=Mt({},e.state,vx(s.value.back,l,s.value.forward,!0),c,{position:s.value.position});r(l,u,!0),i.value=l}function a(l,c){const u=Mt({},s.value,e.state,{forward:l,scroll:Hh()});r(u.current,u,!0);const f=Mt({},vx(i.value,l,null),{position:u.position+1},c);r(l,f,!1),i.value=l}return{location:i,state:s,push:a,replace:o}}function hV(n){n=iV(n);const e=dV(n),t=fV(n,e.state,e.location,e.replace);function i(r,o=!0){o||t.pauseListeners(),history.go(r)}const s=Mt({location:"",base:n,go:i,createHref:rV.bind(null,n)},e,t);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}function pV(n){return n=location.host?n||location.pathname+location.search:"",n.includes("#")||(n+="#"),hV(n)}function mV(n){return typeof n=="string"||n&&typeof n=="object"}function Bw(n){return typeof n=="string"||typeof n=="symbol"}const zw=Symbol("");var yx;(function(n){n[n.aborted=4]="aborted",n[n.cancelled=8]="cancelled",n[n.duplicated=16]="duplicated"})(yx||(yx={}));function Pa(n,e){return Mt(new Error,{type:n,[zw]:!0},e)}function _s(n,e){return n instanceof Error&&zw in n&&(e==null||!!(n.type&e))}const bx="[^/]+?",gV={sensitive:!1,strict:!1,start:!0,end:!0},_V=/[.+*?^${}()[\]/\\]/g;function vV(n,e){const t=Mt({},gV,e),i=[];let s=t.start?"^":"";const r=[];for(const c of n){const u=c.length?[]:[90];t.strict&&!c.length&&(s+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Vw(n,e){let t=0;const i=n.score,s=e.score;for(;t0&&e[e.length-1]<0}const bV={type:0,value:""},xV=/[a-zA-Z0-9_]/;function MV(n){if(!n)return[[]];if(n==="/")return[[bV]];if(!n.startsWith("/"))throw new Error(`Invalid path "${n}"`);function e(h){throw new Error(`ERR (${t})/"${c}": ${h}`)}let t=0,i=t;const s=[];let r;function o(){r&&s.push(r),r=[]}let a=0,l,c="",u="";function f(){c&&(t===0?r.push({type:0,value:c}):t===1||t===2||t===3?(r.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a{o(b)}:Bl}function o(f){if(Bw(f)){const d=i.get(f);d&&(i.delete(f),t.splice(t.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=t.indexOf(f);d>-1&&(t.splice(d,1),f.record.name&&i.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function a(){return t}function l(f){const d=AV(f,t);t.splice(d,0,f),f.record.name&&!Ex(f)&&i.set(f.record.name,f)}function c(f,d){let h,p={},_,g;if("name"in f&&f.name){if(h=i.get(f.name),!h)throw Pa(1,{location:f});g=h.record.name,p=Mt(Mx(d.params,h.keys.filter(b=>!b.optional).concat(h.parent?h.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&Mx(f.params,h.keys.map(b=>b.name))),_=h.stringify(p)}else if(f.path!=null)_=f.path,h=t.find(b=>b.re.test(_)),h&&(p=h.parse(_),g=h.record.name);else{if(h=d.name?i.get(d.name):t.find(b=>b.re.test(d.path)),!h)throw Pa(1,{location:f,currentLocation:d});g=h.record.name,p=Mt({},d.params,f.params),_=h.stringify(p)}const m=[];let y=h;for(;y;)m.unshift(y.record),y=y.parent;return{name:g,path:_,params:p,matched:m,meta:wV(m)}}n.forEach(f=>r(f));function u(){t.length=0,i.clear()}return{addRoute:r,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Mx(n,e){const t={};for(const i of e)i in n&&(t[i]=n[i]);return t}function Sx(n){const e={path:n.path,redirect:n.redirect,name:n.name,meta:n.meta||{},aliasOf:n.aliasOf,beforeEnter:n.beforeEnter,props:TV(n),children:n.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in n?n.components||null:n.component&&{default:n.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function TV(n){const e={},t=n.props||!1;if("component"in n)e.default=t;else for(const i in n.components)e[i]=typeof t=="object"?t[i]:t;return e}function Ex(n){for(;n;){if(n.record.aliasOf)return!0;n=n.parent}return!1}function wV(n){return n.reduce((e,t)=>Mt(e,t.meta),{})}function Tx(n,e){const t={};for(const i in n)t[i]=i in e?e[i]:n[i];return t}function AV(n,e){let t=0,i=e.length;for(;t!==i;){const r=t+i>>1;Vw(n,e[r])<0?i=r:t=r+1}const s=CV(n);return s&&(i=e.lastIndexOf(s,i-1)),i}function CV(n){let e=n;for(;e=e.parent;)if(Hw(e)&&Vw(n,e)===0)return e}function Hw({record:n}){return!!(n.name||n.components&&Object.keys(n.components).length||n.redirect)}function RV(n){const e={};if(n===""||n==="?")return e;const i=(n[0]==="?"?n.slice(1):n).split("&");for(let s=0;sr&&Wg(r)):[i&&Wg(i)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+t,r!=null&&(e+="="+r))})}return e}function PV(n){const e={};for(const t in n){const i=n[t];i!==void 0&&(e[t]=Bi(i)?i.map(s=>s==null?null:""+s):i==null?i:""+i)}return e}const IV=Symbol(""),Ax=Symbol(""),Gh=Symbol(""),Gw=Symbol(""),$g=Symbol("");function ll(){let n=[];function e(i){return n.push(i),()=>{const s=n.indexOf(i);s>-1&&n.splice(s,1)}}function t(){n=[]}return{add:e,list:()=>n.slice(),reset:t}}function ar(n,e,t,i,s,r=o=>o()){const o=i&&(i.enterCallbacks[s]=i.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(Pa(4,{from:t,to:e})):d instanceof Error?l(d):mV(d)?l(Pa(2,{from:e,to:d})):(o&&i.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=r(()=>n.call(i&&i.instances[s],e,t,c));let f=Promise.resolve(u);n.length<3&&(f=f.then(c)),f.catch(d=>l(d))})}function bm(n,e,t,i,s=r=>r()){const r=[];for(const o of n)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(Iw(l)){const u=(l.__vccOpts||l)[e];u&&r.push(ar(u,t,i,o,a,s))}else{let c=l();r.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const f=Fz(u)?u.default:u;o.mods[a]=u,o.components[a]=f;const h=(f.__vccOpts||f)[e];return h&&ar(h,t,i,o,a,s)()}))}}return r}function Cx(n){const e=En(Gh),t=En(Gw),i=Ee(()=>{const l=Ot(n.to);return e.resolve(l)}),s=Ee(()=>{const{matched:l}=i.value,{length:c}=l,u=l[c-1],f=t.matched;if(!u||!f.length)return-1;const d=f.findIndex(Ra.bind(null,u));if(d>-1)return d;const h=Rx(l[c-2]);return c>1&&Rx(u)===h&&f[f.length-1].path!==h?f.findIndex(Ra.bind(null,l[c-2])):d}),r=Ee(()=>s.value>-1&&UV(t.params,i.value.params)),o=Ee(()=>s.value>-1&&s.value===t.matched.length-1&&Fw(t.params,i.value.params));function a(l={}){if(NV(l)){const c=e[Ot(n.replace)?"replace":"push"](Ot(n.to)).catch(Bl);return n.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:i,href:Ee(()=>i.value.href),isActive:r,isExactActive:o,navigate:a}}function LV(n){return n.length===1?n[0]:n}const DV=fn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Cx,setup(n,{slots:e}){const t=bi(Cx(n)),{options:i}=En(Gh),s=Ee(()=>({[Px(n.activeClass,i.linkActiveClass,"router-link-active")]:t.isActive,[Px(n.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const r=e.default&&LV(e.default(t));return n.custom?r:Ds("a",{"aria-current":t.isExactActive?n.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:s.value},r)}}}),OV=DV;function NV(n){if(!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)&&!n.defaultPrevented&&!(n.button!==void 0&&n.button!==0)){if(n.currentTarget&&n.currentTarget.getAttribute){const e=n.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return n.preventDefault&&n.preventDefault(),!0}}function UV(n,e){for(const t in e){const i=e[t],s=n[t];if(typeof i=="string"){if(i!==s)return!1}else if(!Bi(s)||s.length!==i.length||i.some((r,o)=>r!==s[o]))return!1}return!0}function Rx(n){return n?n.aliasOf?n.aliasOf.path:n.path:""}const Px=(n,e,t)=>n??e??t,FV=fn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(n,{attrs:e,slots:t}){const i=En($g),s=Ee(()=>n.route||i.value),r=En(Ax,0),o=Ee(()=>{let c=Ot(r);const{matched:u}=s.value;let f;for(;(f=u[c])&&!f.components;)c++;return c}),a=Ee(()=>s.value.matched[o.value]);dr(Ax,Ee(()=>o.value+1)),dr(IV,a),dr($g,s);const l=et();return $e(()=>[l.value,a.value,n.name],([c,u,f],[d,h,p])=>{u&&(u.instances[f]=c,h&&h!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=h.leaveGuards),u.updateGuards.size||(u.updateGuards=h.updateGuards))),c&&u&&(!h||!Ra(u,h)||!d)&&(u.enterCallbacks[f]||[]).forEach(_=>_(c))},{flush:"post"}),()=>{const c=s.value,u=n.name,f=a.value,d=f&&f.components[u];if(!d)return Ix(t.default,{Component:d,route:c});const h=f.props[u],p=h?h===!0?c.params:typeof h=="function"?h(c):h:null,g=Ds(d,Mt({},p,e,{onVnodeUnmounted:m=>{m.component.isUnmounted&&(f.instances[u]=null)},ref:l}));return Ix(t.default,{Component:g,route:c})||g}}});function Ix(n,e){if(!n)return null;const t=n(e);return t.length===1?t[0]:t}const Ww=FV;function kV(n){const e=EV(n.routes,n),t=n.parseQuery||RV,i=n.stringifyQuery||wx,s=n.history,r=ll(),o=ll(),a=ll(),l=De(Qs);let c=Qs;na&&n.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=vm.bind(null,X=>""+X),f=vm.bind(null,Kz),d=vm.bind(null,bc);function h(X,ae){let fe,ce;return Bw(X)?(fe=e.getRecordMatcher(X),ce=ae):ce=X,e.addRoute(ce,fe)}function p(X){const ae=e.getRecordMatcher(X);ae&&e.removeRoute(ae)}function _(){return e.getRoutes().map(X=>X.record)}function g(X){return!!e.getRecordMatcher(X)}function m(X,ae){if(ae=Mt({},ae||l.value),typeof X=="string"){const R=ym(t,X,ae.path),te=e.resolve({path:R.path},ae),G=s.createHref(R.fullPath);return Mt(R,te,{params:d(te.params),hash:bc(R.hash),redirectedFrom:void 0,href:G})}let fe;if(X.path!=null)fe=Mt({},X,{path:ym(t,X.path,ae.path).path});else{const R=Mt({},X.params);for(const te in R)R[te]==null&&delete R[te];fe=Mt({},X,{params:f(R)}),ae.params=f(ae.params)}const ce=e.resolve(fe,ae),Ue=X.hash||"";ce.params=u(d(ce.params));const k=Qz(i,Mt({},X,{hash:qz(Ue),path:ce.path})),z=s.createHref(k);return Mt({fullPath:k,hash:Ue,query:i===wx?PV(X.query):X.query||{}},ce,{redirectedFrom:void 0,href:z})}function y(X){return typeof X=="string"?ym(t,X,l.value.path):Mt({},X)}function b(X,ae){if(c!==X)return Pa(8,{from:ae,to:X})}function v(X){return S(X)}function T(X){return v(Mt(y(X),{replace:!0}))}function E(X){const ae=X.matched[X.matched.length-1];if(ae&&ae.redirect){const{redirect:fe}=ae;let ce=typeof fe=="function"?fe(X):fe;return typeof ce=="string"&&(ce=ce.includes("?")||ce.includes("#")?ce=y(ce):{path:ce},ce.params={}),Mt({query:X.query,hash:X.hash,params:ce.path!=null?{}:X.params},ce)}}function S(X,ae){const fe=c=m(X),ce=l.value,Ue=X.state,k=X.force,z=X.replace===!0,R=E(fe);if(R)return S(Mt(y(R),{state:typeof R=="object"?Mt({},Ue,R.state):Ue,force:k,replace:z}),ae||fe);const te=fe;te.redirectedFrom=ae;let G;return!k&&eV(i,ce,fe)&&(G=Pa(16,{to:te,from:ce}),se(ce,ce,!0,!1)),(G?Promise.resolve(G):M(te,ce)).catch(W=>_s(W)?_s(W,2)?W:be(W):Z(W,te,ce)).then(W=>{if(W){if(_s(W,2))return S(Mt({replace:z},y(W.to),{state:typeof W.to=="object"?Mt({},Ue,W.to.state):Ue,force:k}),ae||te)}else W=F(te,ce,!0,z,Ue);return L(te,ce,W),W})}function P(X,ae){const fe=b(X,ae);return fe?Promise.reject(fe):Promise.resolve()}function x(X){const ae=re.values().next().value;return ae&&typeof ae.runWithContext=="function"?ae.runWithContext(X):X()}function M(X,ae){let fe;const[ce,Ue,k]=BV(X,ae);fe=bm(ce.reverse(),"beforeRouteLeave",X,ae);for(const R of ce)R.leaveGuards.forEach(te=>{fe.push(ar(te,X,ae))});const z=P.bind(null,X,ae);return fe.push(z),xe(fe).then(()=>{fe=[];for(const R of r.list())fe.push(ar(R,X,ae));return fe.push(z),xe(fe)}).then(()=>{fe=bm(Ue,"beforeRouteUpdate",X,ae);for(const R of Ue)R.updateGuards.forEach(te=>{fe.push(ar(te,X,ae))});return fe.push(z),xe(fe)}).then(()=>{fe=[];for(const R of k)if(R.beforeEnter)if(Bi(R.beforeEnter))for(const te of R.beforeEnter)fe.push(ar(te,X,ae));else fe.push(ar(R.beforeEnter,X,ae));return fe.push(z),xe(fe)}).then(()=>(X.matched.forEach(R=>R.enterCallbacks={}),fe=bm(k,"beforeRouteEnter",X,ae,x),fe.push(z),xe(fe))).then(()=>{fe=[];for(const R of o.list())fe.push(ar(R,X,ae));return fe.push(z),xe(fe)}).catch(R=>_s(R,8)?R:Promise.reject(R))}function L(X,ae,fe){a.list().forEach(ce=>x(()=>ce(X,ae,fe)))}function F(X,ae,fe,ce,Ue){const k=b(X,ae);if(k)return k;const z=ae===Qs,R=na?history.state:{};fe&&(ce||z?s.replace(X.fullPath,Mt({scroll:z&&R&&R.scroll},Ue)):s.push(X.fullPath,Ue)),l.value=X,se(X,ae,fe,z),be()}let H;function Y(){H||(H=s.listen((X,ae,fe)=>{if(!ge.listening)return;const ce=m(X),Ue=E(ce);if(Ue){S(Mt(Ue,{replace:!0,force:!0}),ce).catch(Bl);return}c=ce;const k=l.value;na&&lV(_x(k.fullPath,fe.delta),Hh()),M(ce,k).catch(z=>_s(z,12)?z:_s(z,2)?(S(Mt(y(z.to),{force:!0}),ce).then(R=>{_s(R,20)&&!fe.delta&&fe.type===xc.pop&&s.go(-1,!1)}).catch(Bl),Promise.reject()):(fe.delta&&s.go(-fe.delta,!1),Z(z,ce,k))).then(z=>{z=z||F(ce,k,!1),z&&(fe.delta&&!_s(z,8)?s.go(-fe.delta,!1):fe.type===xc.pop&&_s(z,20)&&s.go(-1,!1)),L(ce,k,z)}).catch(Bl)}))}let ee=ll(),K=ll(),Q;function Z(X,ae,fe){be(X);const ce=K.list();return ce.length?ce.forEach(Ue=>Ue(X,ae,fe)):console.error(X),Promise.reject(X)}function he(){return Q&&l.value!==Qs?Promise.resolve():new Promise((X,ae)=>{ee.add([X,ae])})}function be(X){return Q||(Q=!X,Y(),ee.list().forEach(([ae,fe])=>X?fe(X):ae()),ee.reset()),X}function se(X,ae,fe,ce){const{scrollBehavior:Ue}=n;if(!na||!Ue)return Promise.resolve();const k=!fe&&cV(_x(X.fullPath,0))||(ce||!fe)&&history.state&&history.state.scroll||null;return Er().then(()=>Ue(X,ae,k)).then(z=>z&&aV(z)).catch(z=>Z(z,X,ae))}const ye=X=>s.go(X);let He;const re=new Set,ge={currentRoute:l,listening:!0,addRoute:h,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:g,getRoutes:_,resolve:m,options:n,push:v,replace:T,go:ye,back:()=>ye(-1),forward:()=>ye(1),beforeEach:r.add,beforeResolve:o.add,afterEach:a.add,onError:K.add,isReady:he,install(X){const ae=this;X.component("RouterLink",OV),X.component("RouterView",Ww),X.config.globalProperties.$router=ae,Object.defineProperty(X.config.globalProperties,"$route",{enumerable:!0,get:()=>Ot(l)}),na&&!He&&l.value===Qs&&(He=!0,v(s.location).catch(Ue=>{}));const fe={};for(const Ue in Qs)Object.defineProperty(fe,Ue,{get:()=>l.value[Ue],enumerable:!0});X.provide(Gh,ae),X.provide(Gw,sS(fe)),X.provide($g,l);const ce=X.unmount;re.add(X),X.unmount=function(){re.delete(X),re.size<1&&(c=Qs,H&&H(),H=null,l.value=Qs,He=!1,Q=!1),ce()}}};function xe(X){return X.reduce((ae,fe)=>ae.then(()=>x(fe)),Promise.resolve())}return ge}function BV(n,e){const t=[],i=[],s=[],r=Math.max(e.matched.length,n.matched.length);for(let o=0;oRa(c,a))?i.push(a):t.push(a));const l=n.matched[o];l&&(e.matched.find(c=>Ra(c,l))||s.push(l))}return[t,i,s]}function zV(){return En(Gh)}const VV=[{path:"/",name:"/",component:()=>je(()=>import("./index-DFvxq5hp.js"),__vite__mapDeps([3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,1,2,18,19,20,21])),meta:{layout:"stage",stageTransition:{name:"bubble-wave-out"}}},{path:"/:all(.*)",name:"/[...all]",component:()=>je(()=>import("./_...all_-UwSaXocp.js"),[])},{path:"/audio",name:"/audio",component:()=>je(()=>import("./audio-DGArmC-t.js"),[])},{path:"/devtools",children:[{path:"background-remove",name:"/devtools/background-remove",component:()=>je(()=>import("./background-remove-CJBtSoWZ.js"),__vite__mapDeps([22,23,4]))},{path:"chat",name:"/devtools/chat",component:()=>je(()=>import("./chat-IOYwmzQg.js"),__vite__mapDeps([24,12,8]))},{path:"image",name:"/devtools/image",component:()=>je(()=>import("./image-BS2iN69a.js"),__vite__mapDeps([25,26]))},{path:"vibrant",name:"/devtools/vibrant",component:()=>je(()=>import("./vibrant-B3lGp8kq.js"),__vite__mapDeps([27,23,4,28]))}]},{path:"/queue",name:"/queue",component:()=>je(()=>import("./queue-DbzwV61-.js"),__vite__mapDeps([29,10]))},{path:"/settings",children:[{path:"",name:"/settings/",component:()=>je(()=>import("./index-B2hRy6Ar.js"),__vite__mapDeps([30,31,4,32,20,33])),meta:{stageTransition:{name:"slide"}}},{path:"airi-card",children:[{path:"",name:"/settings/airi-card/",component:()=>je(()=>import("./index-oJqItACZ.js"),__vite__mapDeps([34,23,31,4,13,14,9,8,7,35,36,37,38,39,20])),meta:{stageTransition:{name:"slide"}}},{path:"components",children:[{path:"CardDetailDialog",name:"/settings/airi-card/components/CardDetailDialog",component:()=>je(()=>import("./CardDetailDialog-DErGu3Xy.js"),__vite__mapDeps([40,35,36,37,4,13,14,9,8,7]))},{path:"CardListItem",name:"/settings/airi-card/components/CardListItem",component:()=>je(()=>import("./CardListItem-DNxJE0hr.js"),__vite__mapDeps([41,38,4,39]))},{path:"DeleteCardDialog",name:"/settings/airi-card/components/DeleteCardDialog",component:()=>je(()=>import("./DeleteCardDialog-CSdJRueh.js"),__vite__mapDeps([42,36,37]))}]}]},{path:"appearance",children:[{path:"",name:"/settings/appearance/",component:()=>je(()=>import("./index-BJB8uJhP.js"),__vite__mapDeps([43,31,4,44,17,16,37,20,45])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}}]},{path:"memory",children:[{path:"",name:"/settings/memory/",component:()=>je(()=>import("./index-Czce94mI.js"),__vite__mapDeps([46,31,4]))}]},{path:"models",children:[{path:"",name:"/settings/models/",component:()=>je(()=>import("./index-DG3K0Ej6.js"),__vite__mapDeps([47,32,31,15,4,28,44,17,16,37,48,20,49])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}}]},{path:"modules",children:[{path:"",name:"/settings/modules/",component:()=>je(()=>import("./index-DVEs4fbk.js"),__vite__mapDeps([50,31,4,51,52,32,48,20])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}},{path:"consciousness",name:"/settings/modules/consciousness",component:()=>je(()=>import("./consciousness-Buft8SO9.js"),__vite__mapDeps([53,54,16,55,56,31,4,14,9,8,20])),meta:{stageTransition:{name:"slide"}}},{path:"memory-long-term",name:"/settings/modules/memory-long-term",component:()=>je(()=>import("./memory-long-term-BOqgJ6Qz.js"),__vite__mapDeps([57,31,4]))},{path:"memory-short-term",name:"/settings/modules/memory-short-term",component:()=>je(()=>import("./memory-short-term-q5isghRH.js"),__vite__mapDeps([58,31,4]))},{path:"speech",name:"/settings/modules/speech",component:()=>je(()=>import("./speech-xpntho9b.js"),__vite__mapDeps([59,60,61,62,55,63,64,54,16,56,65,18,31,4,9,8,7,20,66])),meta:{stageTransition:{name:"slide"}}}]},{path:"providers",children:[{path:"",name:"/settings/providers/",component:()=>je(()=>import("./index-OKTEyjT1.js"),__vite__mapDeps([67,32,31,4,9,8,51,52,48,20])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}},{path:"alibaba-cloud-model-studio",name:"/settings/providers/alibaba-cloud-model-studio",component:()=>je(()=>import("./alibaba-cloud-model-studio-PH9TE4P8.js"),__vite__mapDeps([68,63,64,4,9,8,7,69,60,61,70,17,16,62,55,71,72,31]))},{path:"anthropic",name:"/settings/providers/anthropic",component:()=>je(()=>import("./anthropic-BLDeI_4x.js"),__vite__mapDeps([73,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"cloudflare-workers-ai",name:"/settings/providers/cloudflare-workers-ai",component:()=>je(()=>import("./cloudflare-workers-ai-D1L-vcTZ.js"),__vite__mapDeps([75,4,9,8,62,55,71,72,74,31]))},{path:"deepseek",name:"/settings/providers/deepseek",component:()=>je(()=>import("./deepseek-D0YOA2Go.js"),__vite__mapDeps([76,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"elevenlabs",name:"/settings/providers/elevenlabs",component:()=>je(()=>import("./elevenlabs-D1J23Omd.js"),__vite__mapDeps([77,60,61,63,64,4,9,8,7,69,70,17,16,62,55,71,72,31]))},{path:"featherless-ai",name:"/settings/providers/featherless-ai",component:()=>je(()=>import("./featherless-ai-Dl1olyH3.js"),__vite__mapDeps([78,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"fireworks-ai",name:"/settings/providers/fireworks-ai",component:()=>je(()=>import("./fireworks-ai-CgE9JAaR.js"),__vite__mapDeps([79,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"google-generative-ai",name:"/settings/providers/google-generative-ai",component:()=>je(()=>import("./google-generative-ai-jAnS6Q2u.js"),__vite__mapDeps([80,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"microsoft-speech",name:"/settings/providers/microsoft-speech",component:()=>je(()=>import("./microsoft-speech-DFQHhcmr.js"),__vite__mapDeps([81,62,55,4,9,8,7,69,60,61,70,17,16,71,72,31]))},{path:"mistral-ai",name:"/settings/providers/mistral-ai",component:()=>je(()=>import("./mistral-ai-DGNcLeMF.js"),__vite__mapDeps([82,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"moonshot-ai",name:"/settings/providers/moonshot-ai",component:()=>je(()=>import("./moonshot-ai-DzUBx36t.js"),__vite__mapDeps([83,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"novita-ai",name:"/settings/providers/novita-ai",component:()=>je(()=>import("./novita-ai-hOThb-je.js"),__vite__mapDeps([84,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"ollama",name:"/settings/providers/ollama",component:()=>je(()=>import("./ollama-ClQGfAy6.js"),__vite__mapDeps([85,55,4,9,8,70,17,16,62,72,74,31]))},{path:"openai",name:"/settings/providers/openai",component:()=>je(()=>import("./openai-DUyoq3rX.js"),__vite__mapDeps([86,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"openrouter-ai",name:"/settings/providers/openrouter-ai",component:()=>je(()=>import("./openrouter-ai-B7uv-1BM.js"),__vite__mapDeps([87,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"together-ai",name:"/settings/providers/together-ai",component:()=>je(()=>import("./together-ai-D3xDReQZ.js"),__vite__mapDeps([88,4,9,8,70,17,16,62,55,71,72,74,31]))},{path:"volcengine",name:"/settings/providers/volcengine",component:()=>je(()=>import("./volcengine-D-nJo8Wt.js"),__vite__mapDeps([89,62,55,63,64,4,9,8,7,69,60,61,70,17,16,71,72,31]))},{path:"xai",name:"/settings/providers/xai",component:()=>je(()=>import("./xai-BMv8Zk5j.js"),__vite__mapDeps([90,4,9,8,70,17,16,62,55,71,72,74,31]))}]},{path:"scene",children:[{path:"",name:"/settings/scene/",component:()=>je(()=>import("./index-CFJ82zLP.js"),__vite__mapDeps([91,32,31,4,48,20])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}}]}]},{path:"/test",children:[{path:"filter-message",name:"/test/filter-message",component:()=>je(()=>import("./filter-message-DUaVzR-o.js"),__vite__mapDeps([92,65,18,4]))},{path:"queues",children:[{path:"delays",name:"/test/queues/delays",component:()=>je(()=>import("./delays-BXyQjCVq.js"),__vite__mapDeps([93,65,18,4,11,10,19]))},{path:"emotions",name:"/test/queues/emotions",component:()=>je(()=>import("./emotions-DPW-dhzs.js"),__vite__mapDeps([94,65,18,4,10,11]))},{path:"messages",name:"/test/queues/messages",component:()=>je(()=>import("./messages-NgOPVBsy.js"),__vite__mapDeps([95,65,18,4,10,11]))}]}]}],Xw=(n,e)=>{if(typeof n=="number"){if(e===3)return{mode:"rgb",r:(n>>8&15|n>>4&240)/255,g:(n>>4&15|n&240)/255,b:(n&15|n<<4&240)/255};if(e===4)return{mode:"rgb",r:(n>>12&15|n>>8&240)/255,g:(n>>8&15|n>>4&240)/255,b:(n>>4&15|n&240)/255,alpha:(n&15|n<<4&240)/255};if(e===6)return{mode:"rgb",r:(n>>16&255)/255,g:(n>>8&255)/255,b:(n&255)/255};if(e===8)return{mode:"rgb",r:(n>>24&255)/255,g:(n>>16&255)/255,b:(n>>8&255)/255,alpha:(n&255)/255}}},HV={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},GV=n=>Xw(HV[n.toLowerCase()],6),WV=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,XV=n=>{let e;return(e=n.match(WV))?Xw(parseInt(e[1],16),e[1].length):void 0},hr="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Vl=`${hr}%`,V_=`(?:${hr}%|${hr})`,$V=`(?:${hr}(deg|grad|rad|turn)|${hr})`,Ia="\\s*,\\s*",qV=new RegExp(`^rgba?\\(\\s*${hr}${Ia}${hr}${Ia}${hr}\\s*(?:,\\s*${V_}\\s*)?\\)$`),YV=new RegExp(`^rgba?\\(\\s*${Vl}${Ia}${Vl}${Ia}${Vl}\\s*(?:,\\s*${V_}\\s*)?\\)$`),jV=n=>{let e={mode:"rgb"},t;if(t=n.match(qV))t[1]!==void 0&&(e.r=t[1]/255),t[2]!==void 0&&(e.g=t[2]/255),t[3]!==void 0&&(e.b=t[3]/255);else if(t=n.match(YV))t[1]!==void 0&&(e.r=t[1]/100),t[2]!==void 0&&(e.g=t[2]/100),t[3]!==void 0&&(e.b=t[3]/100);else return;return t[4]!==void 0?e.alpha=Math.max(0,Math.min(1,t[4]/100)):t[5]!==void 0&&(e.alpha=Math.max(0,Math.min(1,+t[5]))),e},KV=(n,e)=>n===void 0?void 0:typeof n!="object"?o6(n):n.mode!==void 0?n:e?{...n,mode:e}:void 0,$w=(n="rgb")=>e=>(e=KV(e,n))!==void 0?e.mode===n?e:Yi[e.mode][n]?Yi[e.mode][n](e):n==="rgb"?Yi[e.mode].rgb(e):Yi.rgb[n](Yi[e.mode].rgb(e)):void 0,Yi={},qw={},Ld=[],Yw={},ZV=n=>n,Et=n=>(Yi[n.mode]={...Yi[n.mode],...n.toMode},Object.keys(n.fromMode||{}).forEach(e=>{Yi[e]||(Yi[e]={}),Yi[e][n.mode]=n.fromMode[e]}),n.ranges||(n.ranges={}),n.difference||(n.difference={}),n.channels.forEach(e=>{if(n.ranges[e]===void 0&&(n.ranges[e]=[0,1]),!n.interpolate[e])throw new Error(`Missing interpolator for: ${e}`);typeof n.interpolate[e]=="function"&&(n.interpolate[e]={use:n.interpolate[e]}),n.interpolate[e].fixup||(n.interpolate[e].fixup=ZV)}),qw[n.mode]=n,(n.parse||[]).forEach(e=>{QV(e,n.mode)}),$w(n.mode)),JV=n=>qw[n],QV=(n,e)=>{if(typeof n=="string"){if(!e)throw new Error("'mode' required when 'parser' is a string");Yw[n]=e}else typeof n=="function"&&Ld.indexOf(n)<0&&Ld.push(n)},qg=/[^\x00-\x7F]|[a-zA-Z_]/,e6=/[^\x00-\x7F]|[-\w]/,_e={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let qe=0;function cf(n){let e=n[qe],t=n[qe+1];return e==="-"||e==="+"?/\d/.test(t)||t==="."&&/\d/.test(n[qe+2]):e==="."?/\d/.test(t):/\d/.test(e)}function Yg(n){if(qe>=n.length)return!1;let e=n[qe];if(qg.test(e))return!0;if(e==="-"){if(n.length-qe<2)return!1;let t=n[qe+1];return!!(t==="-"||qg.test(t))}return!1}const t6={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function cl(n){let e="";if((n[qe]==="-"||n[qe]==="+")&&(e+=n[qe++]),e+=uf(n),n[qe]==="."&&/\d/.test(n[qe+1])&&(e+=n[qe++]+uf(n)),(n[qe]==="e"||n[qe]==="E")&&((n[qe+1]==="-"||n[qe+1]==="+")&&/\d/.test(n[qe+2])?e+=n[qe++]+n[qe++]+uf(n):/\d/.test(n[qe+1])&&(e+=n[qe++]+uf(n))),Yg(n)){let t=Dd(n);return t==="deg"||t==="rad"||t==="turn"||t==="grad"?{type:_e.Hue,value:e*t6[t]}:void 0}return n[qe]==="%"?(qe++,{type:_e.Percentage,value:+e}):{type:_e.Number,value:+e}}function uf(n){let e="";for(;/\d/.test(n[qe]);)e+=n[qe++];return e}function Dd(n){let e="";for(;qe{},Bi=Array.isArray,Dw=/#/g,Bz=/&/g,zz=/\//g,Vz=/=/g,Hz=/\?/g,Ow=/\+/g,Gz=/%5B/g,Wz=/%5D/g,Nw=/%5E/g,Xz=/%60/g,Uw=/%7B/g,$z=/%7C/g,Fw=/%7D/g,qz=/%20/g;function z_(n){return encodeURI(""+n).replace($z,"|").replace(Gz,"[").replace(Wz,"]")}function Yz(n){return z_(n).replace(Uw,"{").replace(Fw,"}").replace(Nw,"^")}function Wg(n){return z_(n).replace(Ow,"%2B").replace(qz,"+").replace(Dw,"%23").replace(Bz,"%26").replace(Xz,"`").replace(Uw,"{").replace(Fw,"}").replace(Nw,"^")}function jz(n){return Wg(n).replace(Vz,"%3D")}function Kz(n){return z_(n).replace(Dw,"%23").replace(Hz,"%3F")}function Zz(n){return n==null?"":Kz(n).replace(zz,"%2F")}function bc(n){try{return decodeURIComponent(""+n)}catch{}return""+n}const Jz=/\/$/,Qz=n=>n.replace(Jz,"");function ym(n,e,t="/"){let i,s={},r="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return a=0&&(l=-1),l>-1&&(i=e.slice(0,l),r=e.slice(l+1,a>-1?a:e.length),s=n(r)),a>-1&&(i=i||e.slice(0,a),o=e.slice(a,e.length)),i=iV(i??e,t),{fullPath:i+(r&&"?")+r+o,path:i,query:s,hash:bc(o)}}function eV(n,e){const t=e.query?n(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function mx(n,e){return!e||!n.toLowerCase().startsWith(e.toLowerCase())?n:n.slice(e.length)||"/"}function tV(n,e,t){const i=e.matched.length-1,s=t.matched.length-1;return i>-1&&i===s&&Ra(e.matched[i],t.matched[s])&&kw(e.params,t.params)&&n(e.query)===n(t.query)&&e.hash===t.hash}function Ra(n,e){return(n.aliasOf||n)===(e.aliasOf||e)}function kw(n,e){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(!nV(n[t],e[t]))return!1;return!0}function nV(n,e){return Bi(n)?gx(n,e):Bi(e)?gx(e,n):n===e}function gx(n,e){return Bi(e)?n.length===e.length&&n.every((t,i)=>t===e[i]):n.length===1&&n[0]===e}function iV(n,e){if(n.startsWith("/"))return n;if(!n)return e;const t=e.split("/"),i=n.split("/"),s=i[i.length-1];(s===".."||s===".")&&i.push("");let r=t.length-1,o,a;for(o=0;o1&&r--;else break;return t.slice(0,r).join("/")+"/"+i.slice(o).join("/")}const Qs={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var xc;(function(n){n.pop="pop",n.push="push"})(xc||(xc={}));var zl;(function(n){n.back="back",n.forward="forward",n.unknown=""})(zl||(zl={}));function sV(n){if(!n)if(na){const e=document.querySelector("base");n=e&&e.getAttribute("href")||"/",n=n.replace(/^\w+:\/\/[^\/]+/,"")}else n="/";return n[0]!=="/"&&n[0]!=="#"&&(n="/"+n),Qz(n)}const rV=/^[^#]+#/;function oV(n,e){return n.replace(rV,"#")+e}function aV(n,e){const t=document.documentElement.getBoundingClientRect(),i=n.getBoundingClientRect();return{behavior:e.behavior,left:i.left-t.left-(e.left||0),top:i.top-t.top-(e.top||0)}}const Hh=()=>({left:window.scrollX,top:window.scrollY});function lV(n){let e;if("el"in n){const t=n.el,i=typeof t=="string"&&t.startsWith("#"),s=typeof t=="string"?i?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!s)return;e=aV(s,n)}else e=n;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function _x(n,e){return(history.state?history.state.position-e:-1)+n}const Xg=new Map;function cV(n,e){Xg.set(n,e)}function uV(n){const e=Xg.get(n);return Xg.delete(n),e}let fV=()=>location.protocol+"//"+location.host;function Bw(n,e){const{pathname:t,search:i,hash:s}=e,r=n.indexOf("#");if(r>-1){let a=s.includes(n.slice(r))?n.slice(r).length:1,l=s.slice(a);return l[0]!=="/"&&(l="/"+l),mx(l,"")}return mx(t,n)+i+s}function dV(n,e,t,i){let s=[],r=[],o=null;const a=({state:d})=>{const h=Bw(n,location),p=t.value,_=e.value;let g=0;if(d){if(t.value=h,e.value=d,o&&o===p){o=null;return}g=_?d.position-_.position:0}else i(h);s.forEach(m=>{m(t.value,p,{delta:g,type:xc.pop,direction:g?g>0?zl.forward:zl.back:zl.unknown})})};function l(){o=t.value}function c(d){s.push(d);const h=()=>{const p=s.indexOf(d);p>-1&&s.splice(p,1)};return r.push(h),h}function u(){const{history:d}=window;d.state&&d.replaceState(Mt({},d.state,{scroll:Hh()}),"")}function f(){for(const d of r)d();r=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:l,listen:c,destroy:f}}function vx(n,e,t,i=!1,s=!1){return{back:n,current:e,forward:t,replaced:i,position:window.history.length,scroll:s?Hh():null}}function hV(n){const{history:e,location:t}=window,i={value:Bw(n,t)},s={value:e.state};s.value||r(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function r(l,c,u){const f=n.indexOf("#"),d=f>-1?(t.host&&document.querySelector("base")?n:n.slice(f))+l:fV()+n+l;try{e[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(h){console.error(h),t[u?"replace":"assign"](d)}}function o(l,c){const u=Mt({},e.state,vx(s.value.back,l,s.value.forward,!0),c,{position:s.value.position});r(l,u,!0),i.value=l}function a(l,c){const u=Mt({},s.value,e.state,{forward:l,scroll:Hh()});r(u.current,u,!0);const f=Mt({},vx(i.value,l,null),{position:u.position+1},c);r(l,f,!1),i.value=l}return{location:i,state:s,push:a,replace:o}}function pV(n){n=sV(n);const e=hV(n),t=dV(n,e.state,e.location,e.replace);function i(r,o=!0){o||t.pauseListeners(),history.go(r)}const s=Mt({location:"",base:n,go:i,createHref:oV.bind(null,n)},e,t);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}function mV(n){return n=location.host?n||location.pathname+location.search:"",n.includes("#")||(n+="#"),pV(n)}function gV(n){return typeof n=="string"||n&&typeof n=="object"}function zw(n){return typeof n=="string"||typeof n=="symbol"}const Vw=Symbol("");var yx;(function(n){n[n.aborted=4]="aborted",n[n.cancelled=8]="cancelled",n[n.duplicated=16]="duplicated"})(yx||(yx={}));function Pa(n,e){return Mt(new Error,{type:n,[Vw]:!0},e)}function _s(n,e){return n instanceof Error&&Vw in n&&(e==null||!!(n.type&e))}const bx="[^/]+?",_V={sensitive:!1,strict:!1,start:!0,end:!0},vV=/[.+*?^${}()[\]/\\]/g;function yV(n,e){const t=Mt({},_V,e),i=[];let s=t.start?"^":"";const r=[];for(const c of n){const u=c.length?[]:[90];t.strict&&!c.length&&(s+="/");for(let f=0;fe.length?e.length===1&&e[0]===80?1:-1:0}function Hw(n,e){let t=0;const i=n.score,s=e.score;for(;t0&&e[e.length-1]<0}const xV={type:0,value:""},MV=/[a-zA-Z0-9_]/;function SV(n){if(!n)return[[]];if(n==="/")return[[xV]];if(!n.startsWith("/"))throw new Error(`Invalid path "${n}"`);function e(h){throw new Error(`ERR (${t})/"${c}": ${h}`)}let t=0,i=t;const s=[];let r;function o(){r&&s.push(r),r=[]}let a=0,l,c="",u="";function f(){c&&(t===0?r.push({type:0,value:c}):t===1||t===2||t===3?(r.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a{o(b)}:Bl}function o(f){if(zw(f)){const d=i.get(f);d&&(i.delete(f),t.splice(t.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=t.indexOf(f);d>-1&&(t.splice(d,1),f.record.name&&i.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function a(){return t}function l(f){const d=CV(f,t);t.splice(d,0,f),f.record.name&&!Ex(f)&&i.set(f.record.name,f)}function c(f,d){let h,p={},_,g;if("name"in f&&f.name){if(h=i.get(f.name),!h)throw Pa(1,{location:f});g=h.record.name,p=Mt(Mx(d.params,h.keys.filter(b=>!b.optional).concat(h.parent?h.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),f.params&&Mx(f.params,h.keys.map(b=>b.name))),_=h.stringify(p)}else if(f.path!=null)_=f.path,h=t.find(b=>b.re.test(_)),h&&(p=h.parse(_),g=h.record.name);else{if(h=d.name?i.get(d.name):t.find(b=>b.re.test(d.path)),!h)throw Pa(1,{location:f,currentLocation:d});g=h.record.name,p=Mt({},d.params,f.params),_=h.stringify(p)}const m=[];let y=h;for(;y;)m.unshift(y.record),y=y.parent;return{name:g,path:_,params:p,matched:m,meta:AV(m)}}n.forEach(f=>r(f));function u(){t.length=0,i.clear()}return{addRoute:r,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Mx(n,e){const t={};for(const i of e)i in n&&(t[i]=n[i]);return t}function Sx(n){const e={path:n.path,redirect:n.redirect,name:n.name,meta:n.meta||{},aliasOf:n.aliasOf,beforeEnter:n.beforeEnter,props:wV(n),children:n.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in n?n.components||null:n.component&&{default:n.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function wV(n){const e={},t=n.props||!1;if("component"in n)e.default=t;else for(const i in n.components)e[i]=typeof t=="object"?t[i]:t;return e}function Ex(n){for(;n;){if(n.record.aliasOf)return!0;n=n.parent}return!1}function AV(n){return n.reduce((e,t)=>Mt(e,t.meta),{})}function Tx(n,e){const t={};for(const i in n)t[i]=i in e?e[i]:n[i];return t}function CV(n,e){let t=0,i=e.length;for(;t!==i;){const r=t+i>>1;Hw(n,e[r])<0?i=r:t=r+1}const s=RV(n);return s&&(i=e.lastIndexOf(s,i-1)),i}function RV(n){let e=n;for(;e=e.parent;)if(Gw(e)&&Hw(n,e)===0)return e}function Gw({record:n}){return!!(n.name||n.components&&Object.keys(n.components).length||n.redirect)}function PV(n){const e={};if(n===""||n==="?")return e;const i=(n[0]==="?"?n.slice(1):n).split("&");for(let s=0;sr&&Wg(r)):[i&&Wg(i)]).forEach(r=>{r!==void 0&&(e+=(e.length?"&":"")+t,r!=null&&(e+="="+r))})}return e}function IV(n){const e={};for(const t in n){const i=n[t];i!==void 0&&(e[t]=Bi(i)?i.map(s=>s==null?null:""+s):i==null?i:""+i)}return e}const LV=Symbol(""),Ax=Symbol(""),Gh=Symbol(""),Ww=Symbol(""),$g=Symbol("");function ll(){let n=[];function e(i){return n.push(i),()=>{const s=n.indexOf(i);s>-1&&n.splice(s,1)}}function t(){n=[]}return{add:e,list:()=>n.slice(),reset:t}}function ar(n,e,t,i,s,r=o=>o()){const o=i&&(i.enterCallbacks[s]=i.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(Pa(4,{from:t,to:e})):d instanceof Error?l(d):gV(d)?l(Pa(2,{from:e,to:d})):(o&&i.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=r(()=>n.call(i&&i.instances[s],e,t,c));let f=Promise.resolve(u);n.length<3&&(f=f.then(c)),f.catch(d=>l(d))})}function bm(n,e,t,i,s=r=>r()){const r=[];for(const o of n)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(Lw(l)){const u=(l.__vccOpts||l)[e];u&&r.push(ar(u,t,i,o,a,s))}else{let c=l();r.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const f=kz(u)?u.default:u;o.mods[a]=u,o.components[a]=f;const h=(f.__vccOpts||f)[e];return h&&ar(h,t,i,o,a,s)()}))}}return r}function Cx(n){const e=En(Gh),t=En(Ww),i=Ee(()=>{const l=Ot(n.to);return e.resolve(l)}),s=Ee(()=>{const{matched:l}=i.value,{length:c}=l,u=l[c-1],f=t.matched;if(!u||!f.length)return-1;const d=f.findIndex(Ra.bind(null,u));if(d>-1)return d;const h=Rx(l[c-2]);return c>1&&Rx(u)===h&&f[f.length-1].path!==h?f.findIndex(Ra.bind(null,l[c-2])):d}),r=Ee(()=>s.value>-1&&FV(t.params,i.value.params)),o=Ee(()=>s.value>-1&&s.value===t.matched.length-1&&kw(t.params,i.value.params));function a(l={}){if(UV(l)){const c=e[Ot(n.replace)?"replace":"push"](Ot(n.to)).catch(Bl);return n.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:i,href:Ee(()=>i.value.href),isActive:r,isExactActive:o,navigate:a}}function DV(n){return n.length===1?n[0]:n}const OV=fn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Cx,setup(n,{slots:e}){const t=bi(Cx(n)),{options:i}=En(Gh),s=Ee(()=>({[Px(n.activeClass,i.linkActiveClass,"router-link-active")]:t.isActive,[Px(n.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const r=e.default&&DV(e.default(t));return n.custom?r:Ds("a",{"aria-current":t.isExactActive?n.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:s.value},r)}}}),NV=OV;function UV(n){if(!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)&&!n.defaultPrevented&&!(n.button!==void 0&&n.button!==0)){if(n.currentTarget&&n.currentTarget.getAttribute){const e=n.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return n.preventDefault&&n.preventDefault(),!0}}function FV(n,e){for(const t in e){const i=e[t],s=n[t];if(typeof i=="string"){if(i!==s)return!1}else if(!Bi(s)||s.length!==i.length||i.some((r,o)=>r!==s[o]))return!1}return!0}function Rx(n){return n?n.aliasOf?n.aliasOf.path:n.path:""}const Px=(n,e,t)=>n??e??t,kV=fn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(n,{attrs:e,slots:t}){const i=En($g),s=Ee(()=>n.route||i.value),r=En(Ax,0),o=Ee(()=>{let c=Ot(r);const{matched:u}=s.value;let f;for(;(f=u[c])&&!f.components;)c++;return c}),a=Ee(()=>s.value.matched[o.value]);dr(Ax,Ee(()=>o.value+1)),dr(LV,a),dr($g,s);const l=et();return $e(()=>[l.value,a.value,n.name],([c,u,f],[d,h,p])=>{u&&(u.instances[f]=c,h&&h!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=h.leaveGuards),u.updateGuards.size||(u.updateGuards=h.updateGuards))),c&&u&&(!h||!Ra(u,h)||!d)&&(u.enterCallbacks[f]||[]).forEach(_=>_(c))},{flush:"post"}),()=>{const c=s.value,u=n.name,f=a.value,d=f&&f.components[u];if(!d)return Ix(t.default,{Component:d,route:c});const h=f.props[u],p=h?h===!0?c.params:typeof h=="function"?h(c):h:null,g=Ds(d,Mt({},p,e,{onVnodeUnmounted:m=>{m.component.isUnmounted&&(f.instances[u]=null)},ref:l}));return Ix(t.default,{Component:g,route:c})||g}}});function Ix(n,e){if(!n)return null;const t=n(e);return t.length===1?t[0]:t}const Xw=kV;function BV(n){const e=TV(n.routes,n),t=n.parseQuery||PV,i=n.stringifyQuery||wx,s=n.history,r=ll(),o=ll(),a=ll(),l=De(Qs);let c=Qs;na&&n.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=vm.bind(null,X=>""+X),f=vm.bind(null,Zz),d=vm.bind(null,bc);function h(X,ae){let fe,ce;return zw(X)?(fe=e.getRecordMatcher(X),ce=ae):ce=X,e.addRoute(ce,fe)}function p(X){const ae=e.getRecordMatcher(X);ae&&e.removeRoute(ae)}function _(){return e.getRoutes().map(X=>X.record)}function g(X){return!!e.getRecordMatcher(X)}function m(X,ae){if(ae=Mt({},ae||l.value),typeof X=="string"){const R=ym(t,X,ae.path),te=e.resolve({path:R.path},ae),G=s.createHref(R.fullPath);return Mt(R,te,{params:d(te.params),hash:bc(R.hash),redirectedFrom:void 0,href:G})}let fe;if(X.path!=null)fe=Mt({},X,{path:ym(t,X.path,ae.path).path});else{const R=Mt({},X.params);for(const te in R)R[te]==null&&delete R[te];fe=Mt({},X,{params:f(R)}),ae.params=f(ae.params)}const ce=e.resolve(fe,ae),Ue=X.hash||"";ce.params=u(d(ce.params));const k=eV(i,Mt({},X,{hash:Yz(Ue),path:ce.path})),z=s.createHref(k);return Mt({fullPath:k,hash:Ue,query:i===wx?IV(X.query):X.query||{}},ce,{redirectedFrom:void 0,href:z})}function y(X){return typeof X=="string"?ym(t,X,l.value.path):Mt({},X)}function b(X,ae){if(c!==X)return Pa(8,{from:ae,to:X})}function v(X){return S(X)}function T(X){return v(Mt(y(X),{replace:!0}))}function E(X){const ae=X.matched[X.matched.length-1];if(ae&&ae.redirect){const{redirect:fe}=ae;let ce=typeof fe=="function"?fe(X):fe;return typeof ce=="string"&&(ce=ce.includes("?")||ce.includes("#")?ce=y(ce):{path:ce},ce.params={}),Mt({query:X.query,hash:X.hash,params:ce.path!=null?{}:X.params},ce)}}function S(X,ae){const fe=c=m(X),ce=l.value,Ue=X.state,k=X.force,z=X.replace===!0,R=E(fe);if(R)return S(Mt(y(R),{state:typeof R=="object"?Mt({},Ue,R.state):Ue,force:k,replace:z}),ae||fe);const te=fe;te.redirectedFrom=ae;let G;return!k&&tV(i,ce,fe)&&(G=Pa(16,{to:te,from:ce}),se(ce,ce,!0,!1)),(G?Promise.resolve(G):M(te,ce)).catch(W=>_s(W)?_s(W,2)?W:be(W):Z(W,te,ce)).then(W=>{if(W){if(_s(W,2))return S(Mt({replace:z},y(W.to),{state:typeof W.to=="object"?Mt({},Ue,W.to.state):Ue,force:k}),ae||te)}else W=F(te,ce,!0,z,Ue);return L(te,ce,W),W})}function P(X,ae){const fe=b(X,ae);return fe?Promise.reject(fe):Promise.resolve()}function x(X){const ae=re.values().next().value;return ae&&typeof ae.runWithContext=="function"?ae.runWithContext(X):X()}function M(X,ae){let fe;const[ce,Ue,k]=zV(X,ae);fe=bm(ce.reverse(),"beforeRouteLeave",X,ae);for(const R of ce)R.leaveGuards.forEach(te=>{fe.push(ar(te,X,ae))});const z=P.bind(null,X,ae);return fe.push(z),xe(fe).then(()=>{fe=[];for(const R of r.list())fe.push(ar(R,X,ae));return fe.push(z),xe(fe)}).then(()=>{fe=bm(Ue,"beforeRouteUpdate",X,ae);for(const R of Ue)R.updateGuards.forEach(te=>{fe.push(ar(te,X,ae))});return fe.push(z),xe(fe)}).then(()=>{fe=[];for(const R of k)if(R.beforeEnter)if(Bi(R.beforeEnter))for(const te of R.beforeEnter)fe.push(ar(te,X,ae));else fe.push(ar(R.beforeEnter,X,ae));return fe.push(z),xe(fe)}).then(()=>(X.matched.forEach(R=>R.enterCallbacks={}),fe=bm(k,"beforeRouteEnter",X,ae,x),fe.push(z),xe(fe))).then(()=>{fe=[];for(const R of o.list())fe.push(ar(R,X,ae));return fe.push(z),xe(fe)}).catch(R=>_s(R,8)?R:Promise.reject(R))}function L(X,ae,fe){a.list().forEach(ce=>x(()=>ce(X,ae,fe)))}function F(X,ae,fe,ce,Ue){const k=b(X,ae);if(k)return k;const z=ae===Qs,R=na?history.state:{};fe&&(ce||z?s.replace(X.fullPath,Mt({scroll:z&&R&&R.scroll},Ue)):s.push(X.fullPath,Ue)),l.value=X,se(X,ae,fe,z),be()}let H;function Y(){H||(H=s.listen((X,ae,fe)=>{if(!ge.listening)return;const ce=m(X),Ue=E(ce);if(Ue){S(Mt(Ue,{replace:!0,force:!0}),ce).catch(Bl);return}c=ce;const k=l.value;na&&cV(_x(k.fullPath,fe.delta),Hh()),M(ce,k).catch(z=>_s(z,12)?z:_s(z,2)?(S(Mt(y(z.to),{force:!0}),ce).then(R=>{_s(R,20)&&!fe.delta&&fe.type===xc.pop&&s.go(-1,!1)}).catch(Bl),Promise.reject()):(fe.delta&&s.go(-fe.delta,!1),Z(z,ce,k))).then(z=>{z=z||F(ce,k,!1),z&&(fe.delta&&!_s(z,8)?s.go(-fe.delta,!1):fe.type===xc.pop&&_s(z,20)&&s.go(-1,!1)),L(ce,k,z)}).catch(Bl)}))}let ee=ll(),K=ll(),Q;function Z(X,ae,fe){be(X);const ce=K.list();return ce.length?ce.forEach(Ue=>Ue(X,ae,fe)):console.error(X),Promise.reject(X)}function he(){return Q&&l.value!==Qs?Promise.resolve():new Promise((X,ae)=>{ee.add([X,ae])})}function be(X){return Q||(Q=!X,Y(),ee.list().forEach(([ae,fe])=>X?fe(X):ae()),ee.reset()),X}function se(X,ae,fe,ce){const{scrollBehavior:Ue}=n;if(!na||!Ue)return Promise.resolve();const k=!fe&&uV(_x(X.fullPath,0))||(ce||!fe)&&history.state&&history.state.scroll||null;return Er().then(()=>Ue(X,ae,k)).then(z=>z&&lV(z)).catch(z=>Z(z,X,ae))}const ye=X=>s.go(X);let He;const re=new Set,ge={currentRoute:l,listening:!0,addRoute:h,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:g,getRoutes:_,resolve:m,options:n,push:v,replace:T,go:ye,back:()=>ye(-1),forward:()=>ye(1),beforeEach:r.add,beforeResolve:o.add,afterEach:a.add,onError:K.add,isReady:he,install(X){const ae=this;X.component("RouterLink",NV),X.component("RouterView",Xw),X.config.globalProperties.$router=ae,Object.defineProperty(X.config.globalProperties,"$route",{enumerable:!0,get:()=>Ot(l)}),na&&!He&&l.value===Qs&&(He=!0,v(s.location).catch(Ue=>{}));const fe={};for(const Ue in Qs)Object.defineProperty(fe,Ue,{get:()=>l.value[Ue],enumerable:!0});X.provide(Gh,ae),X.provide(Ww,sS(fe)),X.provide($g,l);const ce=X.unmount;re.add(X),X.unmount=function(){re.delete(X),re.size<1&&(c=Qs,H&&H(),H=null,l.value=Qs,He=!1,Q=!1),ce()}}};function xe(X){return X.reduce((ae,fe)=>ae.then(()=>x(fe)),Promise.resolve())}return ge}function zV(n,e){const t=[],i=[],s=[],r=Math.max(e.matched.length,n.matched.length);for(let o=0;oRa(c,a))?i.push(a):t.push(a));const l=n.matched[o];l&&(e.matched.find(c=>Ra(c,l))||s.push(l))}return[t,i,s]}function VV(){return En(Gh)}const HV=[{path:"/",name:"/",component:()=>je(()=>import("./index-CrclHGQ3.js"),__vite__mapDeps([3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,1,2,19,20,21,22])),meta:{layout:"stage",stageTransition:{name:"bubble-wave-out"}}},{path:"/:all(.*)",name:"/[...all]",component:()=>je(()=>import("./_...all_-D8yjOAQK.js"),[])},{path:"/audio",name:"/audio",component:()=>je(()=>import("./audio-DVqTW1PB.js"),[])},{path:"/devtools",children:[{path:"background-remove",name:"/devtools/background-remove",component:()=>je(()=>import("./background-remove-xa-QFjKj.js"),__vite__mapDeps([23,4,5,24]))},{path:"chat",name:"/devtools/chat",component:()=>je(()=>import("./chat-BJiWkk-g.js"),__vite__mapDeps([25,13,9]))},{path:"image",name:"/devtools/image",component:()=>je(()=>import("./image-CIQPT2z3.js"),__vite__mapDeps([26,27]))},{path:"vibrant",name:"/devtools/vibrant",component:()=>je(()=>import("./vibrant-Ck8ouQeR.js"),__vite__mapDeps([28,4,5,24,29]))}]},{path:"/queue",name:"/queue",component:()=>je(()=>import("./queue-D7nBskKs.js"),__vite__mapDeps([30,11]))},{path:"/settings",children:[{path:"",name:"/settings/",component:()=>je(()=>import("./index-CMXq_S_x.js"),__vite__mapDeps([31,4,5,32,33,21])),meta:{stageTransition:{name:"slide"}}},{path:"airi-card",children:[{path:"",name:"/settings/airi-card/",component:()=>je(()=>import("./index-B5H7zFR1.js"),__vite__mapDeps([34,4,5,24,32,14,15,10,9,8,35,36,37,38,21])),meta:{stageTransition:{name:"slide"}}},{path:"components",children:[{path:"CardDetailDialog",name:"/settings/airi-card/components/CardDetailDialog",component:()=>je(()=>import("./CardDetailDialog-Dxt-FHQW.js"),__vite__mapDeps([39,35,36,37,4,5,14,15,10,9,8]))},{path:"CardListItem",name:"/settings/airi-card/components/CardListItem",component:()=>je(()=>import("./CardListItem-CmKnCrTs.js"),__vite__mapDeps([40,38,4,5]))},{path:"DeleteCardDialog",name:"/settings/airi-card/components/DeleteCardDialog",component:()=>je(()=>import("./DeleteCardDialog-BfLGvfow.js"),__vite__mapDeps([41,36,37]))}]}]},{path:"appearance",children:[{path:"",name:"/settings/appearance/",component:()=>je(()=>import("./index-DgTAR4Sy.js"),__vite__mapDeps([42,4,5,32,43,18,17,37,21,44])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}}]},{path:"memory",children:[{path:"",name:"/settings/memory/",component:()=>je(()=>import("./index-Cy4LPsSb.js"),__vite__mapDeps([45,4,5,32]))}]},{path:"models",children:[{path:"",name:"/settings/models/",component:()=>je(()=>import("./index-Cu7e5uZ2.js"),__vite__mapDeps([46,33,4,5,32,16,29,43,18,17,37,47,21,48])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}}]},{path:"modules",children:[{path:"",name:"/settings/modules/",component:()=>je(()=>import("./index-DuLZCAM8.js"),__vite__mapDeps([49,4,5,32,50,33,47,21])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}},{path:"consciousness",name:"/settings/modules/consciousness",component:()=>je(()=>import("./consciousness-qQlC4dPp.js"),__vite__mapDeps([51,4,5,52,17,53,32,15,10,9,21])),meta:{stageTransition:{name:"slide"}}},{path:"memory-long-term",name:"/settings/modules/memory-long-term",component:()=>je(()=>import("./memory-long-term-BkSIgiZH.js"),__vite__mapDeps([54,4,5,32]))},{path:"memory-short-term",name:"/settings/modules/memory-short-term",component:()=>je(()=>import("./memory-short-term-Dq-l2fpr.js"),__vite__mapDeps([55,4,5,32]))},{path:"speech",name:"/settings/modules/speech",component:()=>je(()=>import("./speech--gNAMctx.js"),__vite__mapDeps([56,57,4,5,58,53,59,52,17,60,19,32,10,9,8,21])),meta:{stageTransition:{name:"slide"}}}]},{path:"providers",children:[{path:"",name:"/settings/providers/",component:()=>je(()=>import("./index-Cs5RsFGh.js"),__vite__mapDeps([61,33,4,5,32,10,9,50,47,21])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}},{path:"alibaba-cloud-model-studio",name:"/settings/providers/alibaba-cloud-model-studio",component:()=>je(()=>import("./alibaba-cloud-model-studio-BPTuNUid.js"),__vite__mapDeps([62,59,4,5,10,9,8,63,57,64,18,17,58,53,65,66,32]))},{path:"anthropic",name:"/settings/providers/anthropic",component:()=>je(()=>import("./anthropic-BVw1aKkH.js"),__vite__mapDeps([67,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"cloudflare-workers-ai",name:"/settings/providers/cloudflare-workers-ai",component:()=>je(()=>import("./cloudflare-workers-ai-CcKNsU55.js"),__vite__mapDeps([69,4,5,10,9,58,53,65,66,68,32]))},{path:"deepseek",name:"/settings/providers/deepseek",component:()=>je(()=>import("./deepseek-D7OL7kwG.js"),__vite__mapDeps([70,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"elevenlabs",name:"/settings/providers/elevenlabs",component:()=>je(()=>import("./elevenlabs-1fmL3c-0.js"),__vite__mapDeps([71,57,4,5,59,10,9,8,63,64,18,17,58,53,65,66,32]))},{path:"featherless-ai",name:"/settings/providers/featherless-ai",component:()=>je(()=>import("./featherless-ai-CcOpVhSb.js"),__vite__mapDeps([72,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"fireworks-ai",name:"/settings/providers/fireworks-ai",component:()=>je(()=>import("./fireworks-ai-DAA5zEq0.js"),__vite__mapDeps([73,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"google-generative-ai",name:"/settings/providers/google-generative-ai",component:()=>je(()=>import("./google-generative-ai-DdbM-cuq.js"),__vite__mapDeps([74,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"microsoft-speech",name:"/settings/providers/microsoft-speech",component:()=>je(()=>import("./microsoft-speech-DxiRqm6y.js"),__vite__mapDeps([75,58,53,4,5,10,9,8,63,57,64,18,17,65,66,32]))},{path:"mistral-ai",name:"/settings/providers/mistral-ai",component:()=>je(()=>import("./mistral-ai-CzsP5HyY.js"),__vite__mapDeps([76,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"moonshot-ai",name:"/settings/providers/moonshot-ai",component:()=>je(()=>import("./moonshot-ai-B-gxAO4v.js"),__vite__mapDeps([77,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"novita-ai",name:"/settings/providers/novita-ai",component:()=>je(()=>import("./novita-ai-DCHaCXXA.js"),__vite__mapDeps([78,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"ollama",name:"/settings/providers/ollama",component:()=>je(()=>import("./ollama-DVhvZ81j.js"),__vite__mapDeps([79,53,4,5,10,9,64,18,17,58,66,68,32]))},{path:"openai",name:"/settings/providers/openai",component:()=>je(()=>import("./openai-DeU27RZU.js"),__vite__mapDeps([80,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"openrouter-ai",name:"/settings/providers/openrouter-ai",component:()=>je(()=>import("./openrouter-ai-BENIJVm4.js"),__vite__mapDeps([81,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"together-ai",name:"/settings/providers/together-ai",component:()=>je(()=>import("./together-ai-CmQtGg2y.js"),__vite__mapDeps([82,4,5,10,9,64,18,17,58,53,65,66,68,32]))},{path:"volcengine",name:"/settings/providers/volcengine",component:()=>je(()=>import("./volcengine-DP5EEnId.js"),__vite__mapDeps([83,58,53,59,4,5,10,9,8,63,57,64,18,17,65,66,32]))},{path:"xai",name:"/settings/providers/xai",component:()=>je(()=>import("./xai-93geoyGl.js"),__vite__mapDeps([84,4,5,10,9,64,18,17,58,53,65,66,68,32]))}]},{path:"scene",children:[{path:"",name:"/settings/scene/",component:()=>je(()=>import("./index-DemghqgU.js"),__vite__mapDeps([85,33,4,5,32,47,21])),meta:{stageTransition:{name:"slide",pageSpecificAvailable:!0}}}]}]},{path:"/test",children:[{path:"filter-message",name:"/test/filter-message",component:()=>je(()=>import("./filter-message-CZTuPPrs.js"),__vite__mapDeps([86,4,5,60,19]))},{path:"queues",children:[{path:"delays",name:"/test/queues/delays",component:()=>je(()=>import("./delays-CbCH4HsM.js"),__vite__mapDeps([87,4,5,60,19,12,11,20]))},{path:"emotions",name:"/test/queues/emotions",component:()=>je(()=>import("./emotions-CgTD5sIw.js"),__vite__mapDeps([88,4,5,60,19,11,12]))},{path:"messages",name:"/test/queues/messages",component:()=>je(()=>import("./messages-Dpefqazf.js"),__vite__mapDeps([89,4,5,60,19,11,12]))}]}]}],$w=(n,e)=>{if(typeof n=="number"){if(e===3)return{mode:"rgb",r:(n>>8&15|n>>4&240)/255,g:(n>>4&15|n&240)/255,b:(n&15|n<<4&240)/255};if(e===4)return{mode:"rgb",r:(n>>12&15|n>>8&240)/255,g:(n>>8&15|n>>4&240)/255,b:(n>>4&15|n&240)/255,alpha:(n&15|n<<4&240)/255};if(e===6)return{mode:"rgb",r:(n>>16&255)/255,g:(n>>8&255)/255,b:(n&255)/255};if(e===8)return{mode:"rgb",r:(n>>24&255)/255,g:(n>>16&255)/255,b:(n>>8&255)/255,alpha:(n&255)/255}}},GV={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},WV=n=>$w(GV[n.toLowerCase()],6),XV=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,$V=n=>{let e;return(e=n.match(XV))?$w(parseInt(e[1],16),e[1].length):void 0},hr="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Vl=`${hr}%`,V_=`(?:${hr}%|${hr})`,qV=`(?:${hr}(deg|grad|rad|turn)|${hr})`,Ia="\\s*,\\s*",YV=new RegExp(`^rgba?\\(\\s*${hr}${Ia}${hr}${Ia}${hr}\\s*(?:,\\s*${V_}\\s*)?\\)$`),jV=new RegExp(`^rgba?\\(\\s*${Vl}${Ia}${Vl}${Ia}${Vl}\\s*(?:,\\s*${V_}\\s*)?\\)$`),KV=n=>{let e={mode:"rgb"},t;if(t=n.match(YV))t[1]!==void 0&&(e.r=t[1]/255),t[2]!==void 0&&(e.g=t[2]/255),t[3]!==void 0&&(e.b=t[3]/255);else if(t=n.match(jV))t[1]!==void 0&&(e.r=t[1]/100),t[2]!==void 0&&(e.g=t[2]/100),t[3]!==void 0&&(e.b=t[3]/100);else return;return t[4]!==void 0?e.alpha=Math.max(0,Math.min(1,t[4]/100)):t[5]!==void 0&&(e.alpha=Math.max(0,Math.min(1,+t[5]))),e},ZV=(n,e)=>n===void 0?void 0:typeof n!="object"?a6(n):n.mode!==void 0?n:e?{...n,mode:e}:void 0,qw=(n="rgb")=>e=>(e=ZV(e,n))!==void 0?e.mode===n?e:Yi[e.mode][n]?Yi[e.mode][n](e):n==="rgb"?Yi[e.mode].rgb(e):Yi.rgb[n](Yi[e.mode].rgb(e)):void 0,Yi={},Yw={},Ld=[],jw={},JV=n=>n,Et=n=>(Yi[n.mode]={...Yi[n.mode],...n.toMode},Object.keys(n.fromMode||{}).forEach(e=>{Yi[e]||(Yi[e]={}),Yi[e][n.mode]=n.fromMode[e]}),n.ranges||(n.ranges={}),n.difference||(n.difference={}),n.channels.forEach(e=>{if(n.ranges[e]===void 0&&(n.ranges[e]=[0,1]),!n.interpolate[e])throw new Error(`Missing interpolator for: ${e}`);typeof n.interpolate[e]=="function"&&(n.interpolate[e]={use:n.interpolate[e]}),n.interpolate[e].fixup||(n.interpolate[e].fixup=JV)}),Yw[n.mode]=n,(n.parse||[]).forEach(e=>{e6(e,n.mode)}),qw(n.mode)),QV=n=>Yw[n],e6=(n,e)=>{if(typeof n=="string"){if(!e)throw new Error("'mode' required when 'parser' is a string");jw[n]=e}else typeof n=="function"&&Ld.indexOf(n)<0&&Ld.push(n)},qg=/[^\x00-\x7F]|[a-zA-Z_]/,t6=/[^\x00-\x7F]|[-\w]/,_e={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"};let qe=0;function cf(n){let e=n[qe],t=n[qe+1];return e==="-"||e==="+"?/\d/.test(t)||t==="."&&/\d/.test(n[qe+2]):e==="."?/\d/.test(t):/\d/.test(e)}function Yg(n){if(qe>=n.length)return!1;let e=n[qe];if(qg.test(e))return!0;if(e==="-"){if(n.length-qe<2)return!1;let t=n[qe+1];return!!(t==="-"||qg.test(t))}return!1}const n6={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function cl(n){let e="";if((n[qe]==="-"||n[qe]==="+")&&(e+=n[qe++]),e+=uf(n),n[qe]==="."&&/\d/.test(n[qe+1])&&(e+=n[qe++]+uf(n)),(n[qe]==="e"||n[qe]==="E")&&((n[qe+1]==="-"||n[qe+1]==="+")&&/\d/.test(n[qe+2])?e+=n[qe++]+n[qe++]+uf(n):/\d/.test(n[qe+1])&&(e+=n[qe++]+uf(n))),Yg(n)){let t=Dd(n);return t==="deg"||t==="rad"||t==="turn"||t==="grad"?{type:_e.Hue,value:e*n6[t]}:void 0}return n[qe]==="%"?(qe++,{type:_e.Percentage,value:+e}):{type:_e.Number,value:+e}}function uf(n){let e="";for(;/\d/.test(n[qe]);)e+=n[qe++];return e}function Dd(n){let e="";for(;qe4)){if(t.length===4){if(t[3].type!==_e.Alpha)return;t[3]=t[3].value}return t.length===3&&t.push({type:_e.None,value:void 0}),t.every(s=>s.type!==_e.Alpha)?t:void 0}}function r6(n,e){n._i=0;let t=n[n._i++];if(!t||t.type!==_e.Function)return;let i=jw(n,e);if(i)return i.unshift(t.value),i}const o6=n=>{if(typeof n!="string")return;const e=i6(n),t=e?r6(e,!0):void 0;let i,s=0,r=Ld.length;for(;sn==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,c6=(n,e,t)=>n+t*(e-n),u6=n=>{let e=[];for(let t=0;te=>{let t=u6(e);return i=>{let s=i*t.length,r=i>=1?t.length-1:Math.max(Math.floor(s),0),o=t[r];return o===void 0?void 0:n(o[0],o[1],s-r)}},Ae=f6(c6),on=n=>{let e=!1,t=n.map(i=>i!==void 0?(e=!0,i):1);return e?t:n},Ha={mode:"rgb",channels:["r","g","b","alpha"],parse:[a6,XV,jV,GV,l6,"srgb"],serialize:"srgb",interpolate:{r:Ae,g:Ae,b:Ae,alpha:{use:Ae,fixup:on}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},xm=(n=0)=>Math.pow(Math.abs(n),563/256)*Math.sign(n),Lx=n=>{let e=xm(n.r),t=xm(n.g),i=xm(n.b),s={mode:"xyz65",x:.5766690429101305*e+.1855582379065463*t+.1882286462349947*i,y:.297344975250536*e+.6273635662554661*t+.0752914584939979*i,z:.0270313613864123*e+.0706888525358272*t+.9913375368376386*i};return n.alpha!==void 0&&(s.alpha=n.alpha),s},Mm=n=>Math.pow(Math.abs(n),256/563)*Math.sign(n),Dx=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s={mode:"a98",r:Mm(n*2.0415879038107465-e*.5650069742788597-.3447313507783297*t),g:Mm(n*-.9692436362808798+e*1.8759675015077206+.0415550574071756*t),b:Mm(n*.0134442806320312-e*.1183623922310184+1.0151749943912058*t)};return i!==void 0&&(s.alpha=i),s},Sm=(n=0)=>{const e=Math.abs(n);return e<=.04045?n/12.92:(Math.sign(n)||1)*Math.pow((e+.055)/1.055,2.4)},Ga=({r:n,g:e,b:t,alpha:i})=>{let s={mode:"lrgb",r:Sm(n),g:Sm(e),b:Sm(t)};return i!==void 0&&(s.alpha=i),s},Io=n=>{let{r:e,g:t,b:i,alpha:s}=Ga(n),r={mode:"xyz65",x:.4123907992659593*e+.357584339383878*t+.1804807884018343*i,y:.2126390058715102*e+.715168678767756*t+.0721923153607337*i,z:.0193308187155918*e+.119194779794626*t+.9505321522496607*i};return s!==void 0&&(r.alpha=s),r},Em=(n=0)=>{const e=Math.abs(n);return e>.0031308?(Math.sign(n)||1)*(1.055*Math.pow(e,1/2.4)-.055):n*12.92},Wa=({r:n,g:e,b:t,alpha:i},s="rgb")=>{let r={mode:s,r:Em(n),g:Em(e),b:Em(t)};return i!==void 0&&(r.alpha=i),r},Lo=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Wa({r:n*3.2409699419045226-e*1.537383177570094-.4986107602930034*t,g:n*-.9692436362808796+e*1.8759675015077204+.0415550574071756*t,b:n*.0556300796969936-e*.2039769588889765+1.0569715142428784*t});return i!==void 0&&(s.alpha=i),s},d6={...Ha,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:n=>Dx(Io(n)),xyz65:Dx},toMode:{rgb:n=>Lo(Lx(n)),xyz65:Lx}},_n=n=>(n=n%360)<0?n+360:n,h6=(n,e)=>n.map((t,i,s)=>{if(t===void 0)return t;let r=_n(t);return i===0||n[i-1]===void 0?r:e(r-_n(s[i-1]))}).reduce((t,i)=>!t.length||i===void 0||t[t.length-1]===void 0?(t.push(i),t):(t.push(i+t[t.length-1]),t),[]),Gs=n=>h6(n,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),ln=[-.14861,1.78277,-.29227,-.90649,1.97294,0],p6=Math.PI/180,m6=180/Math.PI;let Ox=ln[3]*ln[4],Nx=ln[1]*ln[4],Ux=ln[1]*ln[2]-ln[0]*ln[3];const g6=({r:n,g:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=(Ux*t+n*Ox-e*Nx)/(Ux+Ox-Nx),r=t-s,o=(ln[4]*(e-s)-ln[2]*r)/ln[3],a={mode:"cubehelix",l:s,s:s===0||s===1?void 0:Math.sqrt(r*r+o*o)/(ln[4]*s*(1-s))};return a.s&&(a.h=Math.atan2(o,r)*m6-120),i!==void 0&&(a.alpha=i),a},_6=({h:n,s:e,l:t,alpha:i})=>{let s={mode:"rgb"};n=(n===void 0?0:n+120)*p6,t===void 0&&(t=0);let r=e===void 0?0:e*t*(1-t),o=Math.cos(n),a=Math.sin(n);return s.r=t+r*(ln[0]*o+ln[1]*a),s.g=t+r*(ln[2]*o+ln[3]*a),s.b=t+r*(ln[4]*o+ln[5]*a),i!==void 0&&(s.alpha=i),s},Wh=(n,e)=>{if(n.h===void 0||e.h===void 0||!n.s||!e.s)return 0;let t=_n(n.h),i=_n(e.h),s=Math.sin((i-t+360)/2*Math.PI/180);return 2*Math.sqrt(n.s*e.s)*s},v6=(n,e)=>{if(n.h===void 0||e.h===void 0)return 0;let t=_n(n.h),i=_n(e.h);return Math.abs(i-t)>180?t-(i-360*Math.sign(i-t)):i-t},Xh=(n,e)=>{if(n.h===void 0||e.h===void 0||!n.c||!e.c)return 0;let t=_n(n.h),i=_n(e.h),s=Math.sin((i-t+360)/2*Math.PI/180);return 2*Math.sqrt(n.c*e.c)*s},Ws=n=>{let e=n.reduce((i,s)=>{if(s!==void 0){let r=s*Math.PI/180;i.sin+=Math.sin(r),i.cos+=Math.cos(r)}return i},{sin:0,cos:0}),t=Math.atan2(e.sin,e.cos)*180/Math.PI;return t<0?360+t:t},y6={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:g6},toMode:{rgb:_6},interpolate:{h:{use:Ae,fixup:Gs},s:Ae,l:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Wh},average:{h:Ws}},br=({l:n,a:e,b:t,alpha:i},s="lch")=>{e===void 0&&(e=0),t===void 0&&(t=0);let r=Math.sqrt(e*e+t*t),o={mode:s,l:n,c:r};return r&&(o.h=_n(Math.atan2(t,e)*180/Math.PI)),i!==void 0&&(o.alpha=i),o},xr=({l:n,c:e,h:t,alpha:i},s="lab")=>{t===void 0&&(t=0);let r={mode:s,l:n,a:e?e*Math.cos(t/180*Math.PI):0,b:e?e*Math.sin(t/180*Math.PI):0};return i!==void 0&&(r.alpha=i),r},Kw=Math.pow(29,3)/Math.pow(3,3),Zw=Math.pow(6,3)/Math.pow(29,3),Jt={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},ma={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let Tm=n=>Math.pow(n,3)>Zw?Math.pow(n,3):(116*n-16)/Kw;const Jw=({l:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=(n+16)/116,r=e/500+s,o=s-t/200,a={mode:"xyz65",x:Tm(r)*ma.X,y:Tm(s)*ma.Y,z:Tm(o)*ma.Z};return i!==void 0&&(a.alpha=i),a},$h=n=>Lo(Jw(n)),wm=n=>n>Zw?Math.cbrt(n):(Kw*n+16)/116,Qw=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=wm(n/ma.X),r=wm(e/ma.Y),o=wm(t/ma.Z),a={mode:"lab65",l:116*r-16,a:500*(s-r),b:200*(r-o)};return i!==void 0&&(a.alpha=i),a},qh=n=>{let e=Qw(Io(n));return n.r===n.b&&n.b===n.g&&(e.a=e.b=0),e},Od=1,eA=1,Mc=26/180*Math.PI,Nd=Math.cos(Mc),Ud=Math.sin(Mc),tA=100/Math.log(139/100),jg=({l:n,c:e,h:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s={mode:"lab65",l:(Math.exp(n*Od/tA)-1)/.0039},r=(Math.exp(.0435*e*eA*Od)-1)/.075,o=r*Math.cos(t/180*Math.PI-Mc),a=r*Math.sin(t/180*Math.PI-Mc);return s.a=o*Nd-a/.83*Ud,s.b=o*Ud+a/.83*Nd,i!==void 0&&(s.alpha=i),s},Kg=({l:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=e*Nd+t*Ud,r=.83*(t*Nd-e*Ud),o=Math.sqrt(s*s+r*r),a={mode:"dlch",l:tA/Od*Math.log(1+.0039*n),c:Math.log(1+.075*o)/(.0435*eA*Od)};return a.c&&(a.h=_n((Math.atan2(r,s)+Mc)/Math.PI*180)),i!==void 0&&(a.alpha=i),a},Fx=n=>jg(br(n,"dlch")),kx=n=>xr(Kg(n),"dlab"),b6={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Fx,rgb:n=>$h(Fx(n))},fromMode:{lab65:kx,rgb:n=>kx(qh(n))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:Ae,a:Ae,b:Ae,alpha:{use:Ae,fixup:on}}},x6={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:jg,dlab:n=>xr(n,"dlab"),rgb:n=>$h(jg(n))},fromMode:{lab65:Kg,dlab:n=>br(n,"dlch"),rgb:n=>Kg(qh(n))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:Ae,c:Ae,h:{use:Ae,fixup:Gs},alpha:{use:Ae,fixup:on}},difference:{h:Xh},average:{h:Ws}};function M6({h:n,s:e,i:t,alpha:i}){n=_n(n!==void 0?n:0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.abs(n/60%2-1),r;switch(Math.floor(n/60)){case 0:r={r:t*(1+e*(3/(2-s)-1)),g:t*(1+e*(3*(1-s)/(2-s)-1)),b:t*(1-e)};break;case 1:r={r:t*(1+e*(3*(1-s)/(2-s)-1)),g:t*(1+e*(3/(2-s)-1)),b:t*(1-e)};break;case 2:r={r:t*(1-e),g:t*(1+e*(3/(2-s)-1)),b:t*(1+e*(3*(1-s)/(2-s)-1))};break;case 3:r={r:t*(1-e),g:t*(1+e*(3*(1-s)/(2-s)-1)),b:t*(1+e*(3/(2-s)-1))};break;case 4:r={r:t*(1+e*(3*(1-s)/(2-s)-1)),g:t*(1-e),b:t*(1+e*(3/(2-s)-1))};break;case 5:r={r:t*(1+e*(3/(2-s)-1)),g:t*(1-e),b:t*(1+e*(3*(1-s)/(2-s)-1))};break;default:r={r:t*(1-e),g:t*(1-e),b:t*(1-e)}}return r.mode="rgb",i!==void 0&&(r.alpha=i),r}function S6({r:n,g:e,b:t,alpha:i}){n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.max(n,e,t),r=Math.min(n,e,t),o={mode:"hsi",s:n+e+t===0?0:1-3*r/(n+e+t),i:(n+e+t)/3};return s-r!==0&&(o.h=(s===n?(e-t)/(s-r)+(e{switch(e){case"deg":return+n;case"rad":return n/Math.PI*180;case"grad":return n/10*9;case"turn":return n*360}},C6=new RegExp(`^hsla?\\(\\s*${$V}${Ia}${Vl}${Ia}${Vl}\\s*(?:,\\s*${V_}\\s*)?\\)$`),R6=n=>{let e=n.match(C6);if(!e)return;let t={mode:"hsl"};return e[3]!==void 0?t.h=+e[3]:e[1]!==void 0&&e[2]!==void 0&&(t.h=A6(e[1],e[2])),e[4]!==void 0&&(t.s=Math.min(Math.max(0,e[4]/100),1)),e[5]!==void 0&&(t.l=Math.min(Math.max(0,e[5]/100),1)),e[6]!==void 0?t.alpha=Math.max(0,Math.min(1,e[6]/100)):e[7]!==void 0&&(t.alpha=Math.max(0,Math.min(1,+e[7]))),t};function P6(n,e){if(!e||e[0]!=="hsl"&&e[0]!=="hsla")return;const t={mode:"hsl"},[,i,s,r,o]=e;if(i.type!==_e.None){if(i.type===_e.Percentage)return;t.h=i.value}if(s.type!==_e.None){if(s.type===_e.Hue)return;t.s=s.value/100}if(r.type!==_e.None){if(r.type===_e.Hue)return;t.l=r.value/100}return o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const nA={mode:"hsl",toMode:{rgb:T6},fromMode:{rgb:w6},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[P6,R6],serialize:n=>`hsl(${n.h!==void 0?n.h:"none"} ${n.s!==void 0?n.s*100+"%":"none"} ${n.l!==void 0?n.l*100+"%":"none"}${n.alpha<1?` / ${n.alpha}`:""})`,interpolate:{h:{use:Ae,fixup:Gs},s:Ae,l:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Wh},average:{h:Ws}};function iA({h:n,s:e,v:t,alpha:i}){n=_n(n!==void 0?n:0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.abs(n/60%2-1),r;switch(Math.floor(n/60)){case 0:r={r:t,g:t*(1-e*s),b:t*(1-e)};break;case 1:r={r:t*(1-e*s),g:t,b:t*(1-e)};break;case 2:r={r:t*(1-e),g:t,b:t*(1-e*s)};break;case 3:r={r:t*(1-e),g:t*(1-e*s),b:t};break;case 4:r={r:t*(1-e*s),g:t*(1-e),b:t};break;case 5:r={r:t,g:t*(1-e),b:t*(1-e*s)};break;default:r={r:t*(1-e),g:t*(1-e),b:t*(1-e)}}return r.mode="rgb",i!==void 0&&(r.alpha=i),r}function sA({r:n,g:e,b:t,alpha:i}){n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.max(n,e,t),r=Math.min(n,e,t),o={mode:"hsv",s:s===0?0:1-r/s,v:s};return s-r!==0&&(o.h=(s===n?(e-t)/(s-r)+(e1){let s=e+t;e/=s,t/=s}return iA({h:n,s:t===1?1:1-e/(1-t),v:1-t,alpha:i})}function L6(n){let e=sA(n);if(e===void 0)return;let t=e.s!==void 0?e.s:0,i=e.v!==void 0?e.v:0,s={mode:"hwb",w:(1-t)*i,b:1-i};return e.h!==void 0&&(s.h=e.h),e.alpha!==void 0&&(s.alpha=e.alpha),s}function D6(n,e){if(!e||e[0]!=="hwb")return;const t={mode:"hwb"},[,i,s,r,o]=e;if(i.type!==_e.None){if(i.type===_e.Percentage)return;t.h=i.value}if(s.type!==_e.None){if(s.type===_e.Hue)return;t.w=s.value/100}if(r.type!==_e.None){if(r.type===_e.Hue)return;t.b=r.value/100}return o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const O6={mode:"hwb",toMode:{rgb:I6},fromMode:{rgb:L6},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[D6],serialize:n=>`hwb(${n.h!==void 0?n.h:"none"} ${n.w!==void 0?n.w*100+"%":"none"} ${n.b!==void 0?n.b*100+"%":"none"}${n.alpha<1?` / ${n.alpha}`:""})`,interpolate:{h:{use:Ae,fixup:Gs},w:Ae,b:Ae,alpha:{use:Ae,fixup:on}},difference:{h:v6},average:{h:Ws}},oA=203,Yh=.1593017578125,aA=78.84375,jh=.8359375,Kh=18.8515625,Zh=18.6875;function Am(n){if(n<0)return 0;const e=Math.pow(n,1/aA);return 1e4*Math.pow(Math.max(0,e-jh)/(Kh-Zh*e),1/Yh)}function Cm(n){if(n<0)return 0;const e=Math.pow(n/1e4,Yh);return Math.pow((jh+Kh*e)/(1+Zh*e),aA)}const Rm=n=>Math.max(n/oA,0),Bx=({i:n,t:e,p:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);const s=Am(n+.008609037037932761*e+.11102962500302593*t),r=Am(n-.00860903703793275*e-.11102962500302599*t),o=Am(n+.5600313357106791*e-.32062717498731885*t),a={mode:"xyz65",x:Rm(2.070152218389422*s-1.3263473389671556*r+.2066510476294051*o),y:Rm(.3647385209748074*s+.680566024947227*r-.0453045459220346*o),z:Rm(-.049747207535812*s-.0492609666966138*r+1.1880659249923042*o)};return i!==void 0&&(a.alpha=i),a},Pm=(n=0)=>Math.max(n*oA,0),zx=({x:n,y:e,z:t,alpha:i})=>{const s=Pm(n),r=Pm(e),o=Pm(t),a=Cm(.3592832590121217*s+.6976051147779502*r-.0358915932320289*o),l=Cm(-.1920808463704995*s+1.1004767970374323*r+.0753748658519118*o),c=Cm(.0070797844607477*s+.0748396662186366*r+.8433265453898765*o),u=.5*a+.5*l,f=1.61376953125*a-3.323486328125*l+1.709716796875*c,d=4.378173828125*a-4.24560546875*l-.132568359375*c,h={mode:"itp",i:u,t:f,p:d};return i!==void 0&&(h.alpha=i),h},N6={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:Bx,rgb:n=>Lo(Bx(n))},fromMode:{xyz65:zx,rgb:n=>zx(Io(n))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:Ae,t:Ae,p:Ae,alpha:{use:Ae,fixup:on}}},U6=134.03437499999998,F6=16295499532821565e-27,Im=n=>{if(n<0)return 0;let e=Math.pow(n/1e4,Yh);return Math.pow((jh+Kh*e)/(1+Zh*e),U6)},Lm=(n=0)=>Math.max(n*203,0),lA=({x:n,y:e,z:t,alpha:i})=>{n=Lm(n),e=Lm(e),t=Lm(t);let s=1.15*n-.15*t,r=.66*e+.34*n,o=Im(.41478972*s+.579999*r+.014648*t),a=Im(-.20151*s+1.120649*r+.0531008*t),l=Im(-.0166008*s+.2648*r+.6684799*t),c=(o+a)/2,u={mode:"jab",j:.44*c/(1-.56*c)-F6,a:3.524*o-4.066708*a+.542708*l,b:.199076*o+1.096799*a-1.295875*l};return i!==void 0&&(u.alpha=i),u},k6=134.03437499999998,Vx=16295499532821565e-27,Dm=n=>{if(n<0)return 0;let e=Math.pow(n,1/k6);return 1e4*Math.pow((jh-e)/(Zh*e-Kh),1/Yh)},Om=n=>n/203,cA=({j:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=(n+Vx)/(.44+.56*(n+Vx)),r=Dm(s+.13860504*e+.058047316*t),o=Dm(s-.13860504*e-.058047316*t),a=Dm(s-.096019242*e-.8118919*t),l={mode:"xyz65",x:Om(1.661373024652174*r-.914523081304348*o+.23136208173913045*a),y:Om(-.3250758611844533*r+1.571847026732543*o-.21825383453227928*a),z:Om(-.090982811*r-.31272829*o+1.5227666*a)};return i!==void 0&&(l.alpha=i),l},uA=n=>{let e=lA(Io(n));return n.r===n.b&&n.b===n.g&&(e.a=e.b=0),e},fA=n=>Lo(cA(n)),B6={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:uA,xyz65:lA},toMode:{rgb:fA,xyz65:cA},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:Ae,a:Ae,b:Ae,alpha:{use:Ae,fixup:on}}},Hx=({j:n,a:e,b:t,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.sqrt(e*e+t*t),r={mode:"jch",j:n,c:s};return s&&(r.h=_n(Math.atan2(t,e)*180/Math.PI)),i!==void 0&&(r.alpha=i),r},Gx=({j:n,c:e,h:t,alpha:i})=>{t===void 0&&(t=0);let s={mode:"jab",j:n,a:e?e*Math.cos(t/180*Math.PI):0,b:e?e*Math.sin(t/180*Math.PI):0};return i!==void 0&&(s.alpha=i),s},z6={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:Gx,rgb:n=>fA(Gx(n))},fromMode:{rgb:n=>Hx(uA(n)),jab:Hx},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:Ae,fixup:Gs},c:Ae,j:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Xh},average:{h:Ws}},Jh=Math.pow(29,3)/Math.pow(3,3),H_=Math.pow(6,3)/Math.pow(29,3);let Nm=n=>Math.pow(n,3)>H_?Math.pow(n,3):(116*n-16)/Jh;const G_=({l:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=(n+16)/116,r=e/500+s,o=s-t/200,a={mode:"xyz50",x:Nm(r)*Jt.X,y:Nm(s)*Jt.Y,z:Nm(o)*Jt.Z};return i!==void 0&&(a.alpha=i),a},Kc=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Wa({r:n*3.1341359569958707-e*1.6173863321612538-.4906619460083532*t,g:n*-.978795502912089+e*1.916254567259524+.03344273116131949*t,b:n*.07195537988411677-e*.2289768264158322+1.405386058324125*t});return i!==void 0&&(s.alpha=i),s},dA=n=>Kc(G_(n)),Zc=n=>{let{r:e,g:t,b:i,alpha:s}=Ga(n),r={mode:"xyz50",x:.436065742824811*e+.3851514688337912*t+.14307845442264197*i,y:.22249319175623702*e+.7168870538238823*t+.06061979053616537*i,z:.013923904500943465*e+.09708128566574634*t+.7140993584005155*i};return s!==void 0&&(r.alpha=s),r},Um=n=>n>H_?Math.cbrt(n):(Jh*n+16)/116,W_=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Um(n/Jt.X),r=Um(e/Jt.Y),o=Um(t/Jt.Z),a={mode:"lab",l:116*r-16,a:500*(s-r),b:200*(r-o)};return i!==void 0&&(a.alpha=i),a},hA=n=>{let e=W_(Zc(n));return n.r===n.b&&n.b===n.g&&(e.a=e.b=0),e};function V6(n,e){if(!e||e[0]!=="lab")return;const t={mode:"lab"},[,i,s,r,o]=e;if(!(i.type===_e.Hue||s.type===_e.Hue||r.type===_e.Hue))return i.type!==_e.None&&(t.l=Math.min(Math.max(0,i.value),100)),s.type!==_e.None&&(t.a=s.type===_e.Number?s.value:s.value*125/100),r.type!==_e.None&&(t.b=r.type===_e.Number?r.value:r.value*125/100),o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const X_={mode:"lab",toMode:{xyz50:G_,rgb:dA},fromMode:{xyz50:W_,rgb:hA},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-100,100],b:[-100,100]},parse:[V6],serialize:n=>`lab(${n.l!==void 0?n.l:"none"} ${n.a!==void 0?n.a:"none"} ${n.b!==void 0?n.b:"none"}${n.alpha<1?` / ${n.alpha}`:""})`,interpolate:{l:Ae,a:Ae,b:Ae,alpha:{use:Ae,fixup:on}}},H6={...X_,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Jw,rgb:$h},fromMode:{xyz65:Qw,rgb:qh},ranges:{l:[0,100],a:[-86.182,98.234],b:[-107.86,94.477]}};function G6(n,e){if(!e||e[0]!=="lch")return;const t={mode:"lch"},[,i,s,r,o]=e;if(i.type!==_e.None){if(i.type===_e.Hue)return;t.l=Math.min(Math.max(0,i.value),100)}if(s.type!==_e.None&&(t.c=Math.max(0,s.type===_e.Number?s.value:s.value*150/100)),r.type!==_e.None){if(r.type===_e.Percentage)return;t.h=r.value}return o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const $_={mode:"lch",toMode:{lab:xr,rgb:n=>dA(xr(n))},fromMode:{rgb:n=>br(hA(n)),lab:br},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[G6],serialize:n=>`lch(${n.l!==void 0?n.l:"none"} ${n.c!==void 0?n.c:"none"} ${n.h!==void 0?n.h:"none"}${n.alpha<1?` / ${n.alpha}`:""})`,interpolate:{h:{use:Ae,fixup:Gs},c:Ae,l:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Xh},average:{h:Ws}},W6={...$_,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:n=>xr(n,"lab65"),rgb:n=>$h(xr(n,"lab65"))},fromMode:{rgb:n=>br(qh(n),"lch65"),lab65:n=>br(n,"lch65")},ranges:{l:[0,100],c:[0,133.807],h:[0,360]}},pA=({l:n,u:e,v:t,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.sqrt(e*e+t*t),r={mode:"lchuv",l:n,c:s};return s&&(r.h=_n(Math.atan2(t,e)*180/Math.PI)),i!==void 0&&(r.alpha=i),r},mA=({l:n,c:e,h:t,alpha:i})=>{t===void 0&&(t=0);let s={mode:"luv",l:n,u:e?e*Math.cos(t/180*Math.PI):0,v:e?e*Math.sin(t/180*Math.PI):0};return i!==void 0&&(s.alpha=i),s},gA=(n,e,t)=>4*n/(n+15*e+3*t),_A=(n,e,t)=>9*e/(n+15*e+3*t),X6=gA(Jt.X,Jt.Y,Jt.Z),$6=_A(Jt.X,Jt.Y,Jt.Z),q6=n=>n<=H_?Jh*n:116*Math.cbrt(n)-16,Zg=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=q6(e/Jt.Y),r=gA(n,e,t),o=_A(n,e,t);!isFinite(r)||!isFinite(o)?s=r=o=0:(r=13*s*(r-X6),o=13*s*(o-$6));let a={mode:"luv",l:s,u:r,v:o};return i!==void 0&&(a.alpha=i),a},Y6=(n,e,t)=>4*n/(n+15*e+3*t),j6=(n,e,t)=>9*e/(n+15*e+3*t),K6=Y6(Jt.X,Jt.Y,Jt.Z),Z6=j6(Jt.X,Jt.Y,Jt.Z),Jg=({l:n,u:e,v:t,alpha:i})=>{if(n===void 0&&(n=0),n===0)return{mode:"xyz50",x:0,y:0,z:0};e===void 0&&(e=0),t===void 0&&(t=0);let s=e/(13*n)+K6,r=t/(13*n)+Z6,o=Jt.Y*(n<=8?n/Jh:Math.pow((n+16)/116,3)),a=o*(9*s)/(4*r),l=o*(12-3*s-20*r)/(4*r),c={mode:"xyz50",x:a,y:o,z:l};return i!==void 0&&(c.alpha=i),c},J6=n=>pA(Zg(Zc(n))),Q6=n=>Kc(Jg(mA(n))),eH={mode:"lchuv",toMode:{luv:mA,rgb:Q6},fromMode:{rgb:J6,luv:pA},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:Ae,fixup:Gs},c:Ae,l:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Xh},average:{h:Ws}},tH={...Ha,mode:"lrgb",toMode:{rgb:Wa},fromMode:{rgb:Ga},parse:["srgb-linear"],serialize:"srgb-linear"},nH={mode:"luv",toMode:{xyz50:Jg,rgb:n=>Kc(Jg(n))},fromMode:{xyz50:Zg,rgb:n=>Zg(Zc(n))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:Ae,u:Ae,v:Ae,alpha:{use:Ae,fixup:on}}},vA=({r:n,g:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.cbrt(.41222147079999993*n+.5363325363*e+.0514459929*t),r=Math.cbrt(.2119034981999999*n+.6806995450999999*e+.1073969566*t),o=Math.cbrt(.08830246189999998*n+.2817188376*e+.6299787005000002*t),a={mode:"oklab",l:.2104542553*s+.793617785*r-.0040720468*o,a:1.9779984951*s-2.428592205*r+.4505937099*o,b:.0259040371*s+.7827717662*r-.808675766*o};return i!==void 0&&(a.alpha=i),a},Qh=n=>{let e=vA(Ga(n));return n.r===n.b&&n.b===n.g&&(e.a=e.b=0),e},Jc=({l:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.pow(n*.9999999984505198+.39633779217376786*e+.2158037580607588*t,3),r=Math.pow(n*1.0000000088817609-.10556134232365635*e-.06385417477170591*t,3),o=Math.pow(n*1.0000000546724108-.08948418209496575*e-1.2914855378640917*t,3),a={mode:"lrgb",r:4.076741661347994*s-3.307711590408193*r+.230969928729428*o,g:-1.2684380040921763*s+2.6097574006633715*r-.3413193963102197*o,b:-.004196086541837188*s-.7034186144594493*r+1.7076147009309444*o};return i!==void 0&&(a.alpha=i),a},ep=n=>Wa(Jc(n));function Qg(n){const i=1.170873786407767;return .5*(i*n-.206+Math.sqrt((i*n-.206)*(i*n-.206)+4*.03*i*n))}function Fd(n){return(n*n+.206*n)/(1.170873786407767*(n+.03))}function iH(n,e){let t,i,s,r,o,a,l,c;-1.88170328*n-.80936493*e>1?(t=1.19086277,i=1.76576728,s=.59662641,r=.75515197,o=.56771245,a=4.0767416621,l=-3.3077115913,c=.2309699292):1.81444104*n-1.19445276*e>1?(t=.73956515,i=-.45954404,s=.08285427,r=.1254107,o=.14503204,a=-1.2684380046,l=2.6097574011,c=-.3413193965):(t=1.35733652,i=-.00915799,s=-1.1513021,r=-.50559606,o=.00692167,a=-.0041960863,l=-.7034186147,c=1.707614701);let u=t+i*n+s*e+r*n*n+o*n*e,f=.3963377774*n+.2158037573*e,d=-.1055613458*n-.0638541728*e,h=-.0894841775*n-1.291485548*e;{let p=1+u*f,_=1+u*d,g=1+u*h,m=p*p*p,y=_*_*_,b=g*g*g,v=3*f*p*p,T=3*d*_*_,E=3*h*g*g,S=6*f*f*p,P=6*d*d*_,x=6*h*h*g,M=a*m+l*y+c*b,L=a*v+l*T+c*E,F=a*S+l*P+c*x;u=u-M*L/(L*L-.5*M*F)}return u}function q_(n,e){let t=iH(n,e),i=Jc({l:1,a:t*n,b:t*e}),s=Math.cbrt(1/Math.max(i.r,i.g,i.b)),r=s*t;return[s,r]}function sH(n,e,t,i,s,r=null){r||(r=q_(n,e));let o;if((t-s)*r[1]-(r[0]-s)*i<=0)o=r[1]*s/(i*r[0]+r[1]*(s-t));else{o=r[1]*(s-1)/(i*(r[0]-1)+r[1]*(s-t));{let a=t-s,l=i,c=.3963377774*n+.2158037573*e,u=-.1055613458*n-.0638541728*e,f=-.0894841775*n-1.291485548*e,d=a+l*c,h=a+l*u,p=a+l*f;{let _=s*(1-o)+o*t,g=o*i,m=_+g*c,y=_+g*u,b=_+g*f,v=m*m*m,T=y*y*y,E=b*b*b,S=3*d*m*m,P=3*h*y*y,x=3*p*b*b,M=6*d*d*m,L=6*h*h*y,F=6*p*p*b,H=4.0767416621*v-3.3077115913*T+.2309699292*E-1,Y=4.0767416621*S-3.3077115913*P+.2309699292*x,ee=4.0767416621*M-3.3077115913*L+.2309699292*F,K=Y/(Y*Y-.5*H*ee),Q=-H*K,Z=-1.2684380046*v+2.6097574011*T-.3413193965*E-1,he=-1.2684380046*S+2.6097574011*P-.3413193965*x,be=-1.2684380046*M+2.6097574011*L-.3413193965*F,se=he/(he*he-.5*Z*be),ye=-Z*se,He=-.0041960863*v-.7034186147*T+1.707614701*E-1,re=-.0041960863*S-.7034186147*P+1.707614701*x,ge=-.0041960863*M-.7034186147*L+1.707614701*F,xe=re/(re*re-.5*He*ge),X=-He*xe;Q=K>=0?Q:1e6,ye=se>=0?ye:1e6,X=xe>=0?X:1e6,o+=Math.min(Q,Math.min(ye,X))}}}return o}function Y_(n,e,t=null){t||(t=q_(n,e));let i=t[0],s=t[1];return[s/i,s/(1-i)]}function yA(n,e,t){let i=q_(e,t),s=sH(e,t,n,1,n,i),r=Y_(e,t,i),o=.11516993+1/(7.4477897+4.1590124*t+e*(-2.19557347+1.75198401*t+e*(-2.13704948-10.02301043*t+e*(-4.24894561+5.38770819*t+4.69891013*e)))),a=.11239642+1/(1.6132032-.68124379*t+e*(.40370612+.90148123*t+e*(-.27087943+.6122399*t+e*(.00299215-.45399568*t-.14661872*e)))),l=s/Math.min(n*r[0],(1-n)*r[1]),c=n*o,u=(1-n)*a,f=.9*l*Math.sqrt(Math.sqrt(1/(1/(c*c*c*c)+1/(u*u*u*u))));return c=n*.4,u=(1-n)*.8,[Math.sqrt(1/(1/(c*c)+1/(u*u))),f,s]}function Wx(n){const e=n.l!==void 0?n.l:0,t=n.a!==void 0?n.a:0,i=n.b!==void 0?n.b:0,s={mode:"okhsl",l:Qg(e)};n.alpha!==void 0&&(s.alpha=n.alpha);let r=Math.sqrt(t*t+i*i);if(!r)return s.s=0,s;let[o,a,l]=yA(e,t/r,i/r),c;if(rWx(Qh(n))},toMode:{oklab:Xx,rgb:n=>ep(Xx(n))}};function $x(n){let e=n.l!==void 0?n.l:0,t=n.a!==void 0?n.a:0,i=n.b!==void 0?n.b:0,s=Math.sqrt(t*t+i*i),r=s?t/s:1,o=s?i/s:1,[a,l]=Y_(r,o),c=.5,u=1-c/a,f=l/(s+e*l),d=f*e,h=f*s,p=Fd(d),_=h*p/d,g=Jc({l:p,a:r*_,b:o*_}),m=Math.cbrt(1/Math.max(g.r,g.g,g.b,0));e=e/m,s=s/m*Qg(e)/e,e=Qg(e);const y={mode:"okhsv",s:s?(c+l)*h/(l*c+l*u*h):0,v:e?e/d:0};return y.s&&(y.h=_n(Math.atan2(i,t)*180/Math.PI)),n.alpha!==void 0&&(y.alpha=n.alpha),y}function qx(n){const e={mode:"oklab"};n.alpha!==void 0&&(e.alpha=n.alpha);const t=n.h!==void 0?n.h:0,i=n.s!==void 0?n.s:0,s=n.v!==void 0?n.v:0,r=Math.cos(t/180*Math.PI),o=Math.sin(t/180*Math.PI),[a,l]=Y_(r,o),c=.5,u=1-c/a,f=1-i*c/(c+l-l*u*i),d=i*l*c/(c+l-l*u*i),h=Fd(f),p=d*h/f,_=Jc({l:h,a:r*p,b:o*p}),g=Math.cbrt(1/Math.max(_.r,_.g,_.b,0)),m=Fd(s*f),y=d*m/f;return e.l=m*g,e.a=y*r*g,e.b=y*o*g,e}const oH={...rA,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:$x,rgb:n=>$x(Qh(n))},toMode:{oklab:qx,rgb:n=>ep(qx(n))}};function aH(n,e){if(!e||e[0]!=="oklab")return;const t={mode:"oklab"},[,i,s,r,o]=e;if(!(i.type===_e.Hue||s.type===_e.Hue||r.type===_e.Hue))return i.type!==_e.None&&(t.l=Math.min(Math.max(0,i.type===_e.Number?i.value:i.value/100),1)),s.type!==_e.None&&(t.a=s.type===_e.Number?s.value:s.value*.4/100),r.type!==_e.None&&(t.b=r.type===_e.Number?r.value:r.value*.4/100),o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const lH={...X_,mode:"oklab",toMode:{lrgb:Jc,rgb:ep},fromMode:{lrgb:vA,rgb:Qh},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[aH],serialize:n=>`oklab(${n.l!==void 0?n.l:"none"} ${n.a!==void 0?n.a:"none"} ${n.b!==void 0?n.b:"none"}${n.alpha<1?` / ${n.alpha}`:""})`};function cH(n,e){if(!e||e[0]!=="oklch")return;const t={mode:"oklch"},[,i,s,r,o]=e;if(i.type!==_e.None){if(i.type===_e.Hue)return;t.l=Math.min(Math.max(0,i.type===_e.Number?i.value:i.value/100),1)}if(s.type!==_e.None&&(t.c=Math.max(0,s.type===_e.Number?s.value:s.value*.4/100)),r.type!==_e.None){if(r.type===_e.Percentage)return;t.h=r.value}return o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const uH={...$_,mode:"oklch",toMode:{oklab:n=>xr(n,"oklab"),rgb:n=>ep(xr(n,"oklab"))},fromMode:{rgb:n=>br(Qh(n),"oklch"),oklab:n=>br(n,"oklch")},parse:[cH],serialize:n=>`oklch(${n.l!==void 0?n.l:"none"} ${n.c!==void 0?n.c:"none"} ${n.h!==void 0?n.h:"none"}${n.alpha<1?` / ${n.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},Yx=n=>{let{r:e,g:t,b:i,alpha:s}=Ga(n),r={mode:"xyz65",x:.486570948648216*e+.265667693169093*t+.1982172852343625*i,y:.2289745640697487*e+.6917385218365062*t+.079286914093745*i,z:0*e+.0451133818589026*t+1.043944368900976*i};return s!==void 0&&(r.alpha=s),r},jx=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Wa({r:n*2.4934969119414263-e*.9313836179191242-.402710784450717*t,g:n*-.8294889695615749+e*1.7626640603183465+.0236246858419436*t,b:n*.0358458302437845-e*.0761723892680418+.9568845240076871*t},"p3");return i!==void 0&&(s.alpha=i),s},fH={...Ha,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:n=>jx(Io(n)),xyz65:jx},toMode:{rgb:n=>Lo(Yx(n)),xyz65:Yx}},Fm=n=>{let e=Math.abs(n);return e>=1/512?Math.sign(n)*Math.pow(e,1/1.8):16*n},Kx=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s={mode:"prophoto",r:Fm(n*1.3457868816471585-e*.2555720873797946-.0511018649755453*t),g:Fm(n*-.5446307051249019+e*1.5082477428451466+.0205274474364214*t),b:Fm(n*0+e*0+1.2119675456389452*t)};return i!==void 0&&(s.alpha=i),s},km=(n=0)=>{let e=Math.abs(n);return e>=16/512?Math.sign(n)*Math.pow(e,1.8):n/16},Zx=n=>{let e=km(n.r),t=km(n.g),i=km(n.b),s={mode:"xyz50",x:.7977666449006423*e+.1351812974005331*t+.0313477341283922*i,y:.2880748288194013*e+.7118352342418731*t+899369387256e-16*i,z:0*e+0*t+.8251046025104602*i};return n.alpha!==void 0&&(s.alpha=n.alpha),s},dH={...Ha,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:Kx,rgb:n=>Kx(Zc(n))},toMode:{xyz50:Zx,rgb:n=>Kc(Zx(n))}},Jx=1.09929682680944,hH=.018053968510807,Bm=n=>{const e=Math.abs(n);return e>hH?(Math.sign(n)||1)*(Jx*Math.pow(e,.45)-(Jx-1)):4.5*n},Qx=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s={mode:"rec2020",r:Bm(n*1.7166511879712683-e*.3556707837763925-.2533662813736599*t),g:Bm(n*-.6666843518324893+e*1.6164812366349395+.0157685458139111*t),b:Bm(n*.0176398574453108-e*.0427706132578085+.9421031212354739*t)};return i!==void 0&&(s.alpha=i),s},eM=1.09929682680944,pH=.018053968510807,zm=(n=0)=>{let e=Math.abs(n);return e{let e=zm(n.r),t=zm(n.g),i=zm(n.b),s={mode:"xyz65",x:.6369580483012911*e+.1446169035862083*t+.1688809751641721*i,y:.262700212011267*e+.6779980715188708*t+.059301716469862*i,z:0*e+.0280726930490874*t+1.0609850577107909*i};return n.alpha!==void 0&&(s.alpha=n.alpha),s},mH={...Ha,mode:"rec2020",fromMode:{xyz65:Qx,rgb:n=>Qx(Io(n))},toMode:{xyz65:tM,rgb:n=>Lo(tM(n))},parse:["rec2020"],serialize:"rec2020"},_o=.0037930732552754493,bA=Math.cbrt(_o),Vm=n=>Math.cbrt(n)-bA,gH=n=>{const{r:e,g:t,b:i,alpha:s}=Ga(n),r=Vm(.3*e+.622*t+.078*i+_o),o=Vm(.23*e+.692*t+.078*i+_o),a=Vm(.2434226892454782*e+.2047674442449682*t+.5518098665095535*i+_o),l={mode:"xyb",x:(r-o)/2,y:(r+o)/2,b:a-(r+o)/2};return s!==void 0&&(l.alpha=s),l},Hm=n=>Math.pow(n+bA,3),_H=({x:n,y:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);const s=Hm(n+e)-_o,r=Hm(e-n)-_o,o=Hm(t+e)-_o,a=Wa({r:11.031566904639861*s-9.866943908131562*r-.16462299650829934*o,g:-3.2541473810744237*s+4.418770377582723*r-.16462299650829934*o,b:-3.6588512867136815*s+2.7129230459360922*r+1.9459282407775895*o});return i!==void 0&&(a.alpha=i),a},vH={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:_H},fromMode:{rgb:gH},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:Ae,y:Ae,b:Ae,alpha:{use:Ae,fixup:on}}},yH={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:Kc,lab:W_},fromMode:{rgb:Zc,lab:G_},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:Ae,y:Ae,z:Ae,alpha:{use:Ae,fixup:on}}},bH=n=>{let{x:e,y:t,z:i,alpha:s}=n;e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0);let r={mode:"xyz50",x:1.0479298208405488*e+.0229467933410191*t-.0501922295431356*i,y:.0296278156881593*e+.990434484573249*t-.0170738250293851*i,z:-.0092430581525912*e+.0150551448965779*t+.7518742899580008*i};return s!==void 0&&(r.alpha=s),r},xH=n=>{let{x:e,y:t,z:i,alpha:s}=n;e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0);let r={mode:"xyz65",x:.9554734527042182*e-.0230985368742614*t+.0632593086610217*i,y:-.0283697069632081*e+1.0099954580058226*t+.021041398966943*i,z:.0123140016883199*e-.0205076964334779*t+1.3303659366080753*i};return s!==void 0&&(r.alpha=s),r},MH={mode:"xyz65",toMode:{rgb:Lo,xyz50:bH},fromMode:{rgb:Io,xyz50:xH},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:Ae,y:Ae,z:Ae,alpha:{use:Ae,fixup:on}}},SH=({r:n,g:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);const s={mode:"yiq",y:.29889531*n+.58662247*e+.11448223*t,i:.59597799*n-.2741761*e-.32180189*t,q:.21147017*n-.52261711*e+.31114694*t};return i!==void 0&&(s.alpha=i),s},EH=({y:n,i:e,q:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);const s={mode:"rgb",r:n+.95608445*e+.6208885*t,g:n-.27137664*e-.6486059*t,b:n-1.10561724*e+1.70250126*t};return i!==void 0&&(s.alpha=i),s},TH={mode:"yiq",toMode:{rgb:EH},fromMode:{rgb:SH},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:Ae,i:Ae,q:Ae,alpha:{use:Ae,fixup:on}}};Et(d6);Et(y6);Et(b6);Et(x6);Et(E6);Et(nA);Et(rA);Et(O6);Et(N6);Et(B6);Et(z6);Et(X_);Et(H6);Et($_);Et(W6);Et(eH);Et(tH);Et(nH);Et(rH);Et(oH);Et(lH);Et(uH);Et(fH);Et(dH);Et(mH);Et(Ha);Et(vH);Et(yH);Et(MH);Et(TH);const e0=220.44,wH=$w("oklch"),nM=n=>{var e;return n?(e=wH(n))==null?void 0:e.h:e0},AH=Oz("settings",()=>{const n=et(),e=gs("settings/language","en-US"),t=gs("settings/stage/view/model-renderer","2d"),i=gs("settings/audio/input","false"),s=Ee(()=>{var E;return(E=n.value)==null?void 0:E.deviceId}),{audioInputs:r,ensurePermissions:o}=kB({constraints:{audio:!0}}),a=et(),l=et("/assets/live2d/models/hiyori_pro_zh.zip"),c=et("url"),u=et(!1),f=gs("settings/live2d/position",{x:0,y:0}),d=et({group:"Idle",index:0}),h=et([]),p=gs("settings/live2d/motion-map",{}),_=gs("settings/disable-transitions",!0),g=gs("settings/use-page-specific-transitions",!0),m=gs("settings/theme/colors/hue",e0),y=gs("settings/theme/colors/hue-dynamic",!1);function b(E=e0){m.value=E,y.value=!1}function v(E){b(nM(E))}function T(E){if(y.value)return!1;const S=nM(E);if(!S)return!1;const P=Math.abs(S-m.value);return P<.01||P>359.99}return $e(i,E=>{E==="false"&&(n.value=void 0),E==="true"&&o().then(()=>{n.value=r.value[0]})}),$e(r,()=>{i.value==="true"&&!n.value&&(n.value=r.value[0])},{immediate:!0}),{live2dModelFile:a,live2dModelUrl:l,live2dLoadSource:c,live2dCurrentMotion:d,live2dPosition:f,availableLive2dMotions:h,live2dMotionMap:p,loadingLive2dModel:u,disableTransitions:_,usePageSpecificTransitions:g,language:e,stageView:t,themeColorsHue:m,themeColorsHueDynamic:y,isAudioInputOn:i,selectedAudioDevice:n,selectedAudioDeviceId:s,setThemeColorsHue:b,applyPrimaryColorFrom:v,isColorSelectedForPrimary:T}}),CH=fn({__name:"ArrowTransition",props:{stageTransition:{default:()=>({primaryColor:"#666",secondaryColor:"#ccc"})}},setup(n){const e=n,t=Ee(()=>e.stageTransition),i=Ee(()=>t.value.primaryColor||"#666"),s=Ee(()=>t.value.secondaryColor||"#ccc");return Hn(()=>{document.documentElement.style.setProperty("--stage-transition-3-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-3-overlay-color-2",s.value)}),(r,o)=>(mn(),vi("div",{class:"stage-transition-3",style:Si({zIndex:t.value.zIndex||100})},null,4))}}),Do=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t},RH=Do(CH,[["__scopeId","data-v-df576df0"]]),PH=fn({__name:"BubbleWaveOutTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>{var i;return((i=e.stageTransition)==null?void 0:i.colors)||["#eee","#ebcb8b","#c56370","#3f3b52"]});return Hn(()=>{var i,s;document.documentElement.style.setProperty("--circle-expansion-delay",`${((i=e.stageTransition)==null?void 0:i.delay)||0}s`),document.documentElement.style.setProperty("--circle-expansion-duration",`${((s=e.stageTransition)==null?void 0:s.duration)||.4}s`),t.value.forEach((r,o)=>{document.documentElement.style.setProperty(`--circle-expansion-color-${o+1}`,r)})}),(i,s)=>{var r;return mn(),vi("div",{class:"circle-expansion-transition",style:Si({zIndex:((r=n.stageTransition)==null?void 0:r.zIndex)||100})},[(mn(!0),vi(jt,null,u2(t.value,(o,a)=>(mn(),vi("div",{key:a}))),128))],4)}}}),IH=Do(PH,[["__scopeId","data-v-0c29056c"]]),LH=fn({__name:"FantasyFallTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>{var s;return((s=e.stageTransition)==null?void 0:s.direction)||"up"}),i=Ee(()=>`fantasy-fall-${t.value}`);return Hn(()=>{var s,r,o,a,l,c,u,f,d;document.documentElement.style.setProperty("--fantasy-fall-color",((s=e.stageTransition)==null?void 0:s.primaryColor)||"#eee"),document.documentElement.style.setProperty("--fantasy-fall-duration",`${((r=e.stageTransition)==null?void 0:r.duration)||.6}s`),document.documentElement.style.setProperty("--fantasy-fall-delay",`${((o=e.stageTransition)==null?void 0:o.delay)||0}s`),document.documentElement.style.setProperty("--fantasy-fall-radius-sm",`${((l=(a=e.stageTransition)==null?void 0:a.borderRadius)==null?void 0:l.sm)||"14rem"}`),document.documentElement.style.setProperty("--fantasy-fall-radius-md",`${((u=(c=e.stageTransition)==null?void 0:c.borderRadius)==null?void 0:u.md)||"14rem"}`),document.documentElement.style.setProperty("--fantasy-fall-radius-lg",`${((d=(f=e.stageTransition)==null?void 0:f.borderRadius)==null?void 0:d.lg)||"50%"}`)}),(s,r)=>{var o;return mn(),vi("div",{class:Oa(["fantasy-fall-transition",i.value]),style:Si({zIndex:((o=n.stageTransition)==null?void 0:o.zIndex)??100})},null,6)}}}),DH=Do(LH,[["__scopeId","data-v-e62bf496"]]),OH=fn({__name:"MultipleBlocksRevealTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>e.stageTransition),i=Ee(()=>{var r;return((r=t.value)==null?void 0:r.primaryColor)||"#666"}),s=Ee(()=>{var r;return((r=t.value)==null?void 0:r.secondaryColor)||"#ccc"});return Hn(()=>{document.documentElement.style.setProperty("--stage-transition-4-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-4-overlay-color-2",s.value)}),(r,o)=>{var a;return mn(),vi("div",{class:"stage-transition-4",style:Si({zIndex:((a=t.value)==null?void 0:a.zIndex)??100})},o[0]||(o[0]=[G2('
',5)]),4)}}}),NH=Do(OH,[["__scopeId","data-v-6d1179fc"]]),UH=fn({__name:"SlideTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>e.stageTransition),i=Ee(()=>{var r;return((r=t.value)==null?void 0:r.primaryColor)||"#666"}),s=Ee(()=>{var r;return((r=t.value)==null?void 0:r.secondaryColor)||"#ccc"});return $e([t,i,s],()=>{document.documentElement.style.setProperty("--stage-transition-1-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-1-overlay-color-2",s.value)}),Hn(()=>{document.documentElement.style.setProperty("--stage-transition-1-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-1-overlay-color-2",s.value)}),(r,o)=>{var a;return mn(),vi("div",{class:"stage-transition-1",style:Si({zIndex:((a=t.value)==null?void 0:a.zIndex)??100})},null,4)}}}),FH=Do(UH,[["__scopeId","data-v-bf1d1566"]]),kH=fn({__name:"SlopeSlideTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>e.stageTransition),i=Ee(()=>{var r;return((r=t.value)==null?void 0:r.primaryColor)??"#666"}),s=Ee(()=>{var r;return((r=t.value)==null?void 0:r.secondaryColor)??"#ccc"});return Hn(()=>{document.documentElement.style.setProperty("--stage-transition-2-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-2-overlay-color-2",s.value)}),(r,o)=>{var a;return mn(),vi("div",{class:"stage-transition-2",style:Si({zIndex:((a=t.value)==null?void 0:a.zIndex)??100})},null,4)}}}),BH=Do(kH,[["__scopeId","data-v-8ff7120f"]]),zH=fn({__name:"RectanglesRotateTransition",props:{stageTransition:null},setup(n){const e=n;return Hn(()=>{var t,i,s,r,o,a,l;document.documentElement.style.setProperty("--rectangle-rotate-1-color",((t=e.stageTransition)==null?void 0:t.primaryColor)||"#ebcb8b"),document.documentElement.style.setProperty("--rectangle-rotate-2-color",((i=e.stageTransition)==null?void 0:i.secondaryColor)||"#c56370"),document.documentElement.style.setProperty("--rectangle-rotate-3-color",((s=e.stageTransition)==null?void 0:s.tertiaryColor)||"#43445b"),document.documentElement.style.setProperty("--rectangle-rotate-duration",`${((r=e.stageTransition)==null?void 0:r.duration)||.6}s`),document.documentElement.style.setProperty("--rectangle-rotate-delay",`${((o=e.stageTransition)==null?void 0:o.delay)||0}s`),document.documentElement.style.setProperty("--rectangle-rotate-stagger",`${((a=e.stageTransition)==null?void 0:a.staggerDelay)||.1}s`),document.documentElement.style.setProperty("--rectangle-rotate-rotation",`${((l=e.stageTransition)==null?void 0:l.rotation)||270}deg`)}),(t,i)=>{var s;return mn(),vi("div",{class:"rectangle-rotate-transition",style:Si({zIndex:((s=n.stageTransition)==null?void 0:s.zIndex)??100})},i[0]||(i[0]=[sr("div",{class:"rectangle rectangle-rotate-1"},[sr("div")],-1),sr("div",{class:"rectangle rectangle-rotate-2"},[sr("div")],-1),sr("div",{class:"rectangle rectangle-rotate-3"},[sr("div")],-1)]),4)}}}),VH=Do(zH,[["__scopeId","data-v-f4b1dc64"]]),HH=fn({__name:"StageTransitionGroup",props:{primaryColor:null,secondaryColor:null,tertiaryColor:null,colors:null,zIndex:null,disableTransitions:{type:Boolean},usePageSpecificTransitions:{type:Boolean}},setup(n){const e=n,t=zV(),i=et(!1),s=et(),r=et(""),o=et(),a=De({slide:{component:FH,duration:2700},"slope-slide":{component:BH,duration:2700},arrow:{component:RH,duration:2700},"multiple-blocks-reveal":{component:NH,duration:2800},"fantasy-fall":{component:DH,duration:2700},"rectangles-rotate":{component:VH,duration:2700},"bubble-wave-out":{component:IH,duration:1e3}}),l=et([]);function c(h){return l.value.push(h),()=>{const p=l.value.indexOf(h);p>=0&&l.value.splice(p,1)}}async function u(h,p={}){s.value=h;for(const _ of l.value)try{await Promise.resolve(_(h,p))}catch(g){console.error(`Error in transition hook at stage "${h}":`,g)}}async function f(h,p,_){if(h.name==="none"||!h.name){p(),_();return}const g=a.value[h.name];if(!g){console.error(`Transition ${h.name} not found`),p(),_();return}const m=g.nextDelay!==void 0?g.nextDelay:g.duration/3;let y=!1;const v=c(T=>{T==="navigation"&&!y&&(y=!0,p())});try{await u("before-enter",{transitionName:h.name}),i.value&&(await u("before-leave",{transitionName:r.value}),r.value="",o.value=void 0,i.value=!1,await u("after-leave",{transitionName:r.value}),await new Promise(E=>setTimeout(E,50))),r.value=h.name,o.value=h,i.value=!0,await u("enter-active",{transitionName:name}),setTimeout(async()=>{await u("navigation",{transitionName:h.name,config:g}),y||(y=!0,p())},m),setTimeout(async()=>{await u("after-enter",{transitionName:h.name})},g.duration),setTimeout(async()=>{await u("before-leave",{transitionName:h.name})},g.duration+10),setTimeout(async()=>{await u("leave-active",{transitionName:h.name})},g.duration+20);const T=g.exitDuration??0;setTimeout(async()=>{i.value=!1,r.value="",o.value=void 0,await u("after-leave",{transitionName:h.name}),_()},g.duration+T)}catch(T){console.error(T)}finally{v(),setTimeout(()=>{y||(y=!0,p())},g.duration*2)}}function d(h,p){return new Promise(_=>{f(h,p,_)})}return t.beforeEach((h,p,_)=>{if(e.disableTransitions){_();return}if(typeof h.meta.stageTransition!="object"){_();return}const g=h.meta.stageTransition;if(e.usePageSpecificTransitions&&g.pageSpecificAvailable){_();return}typeof e.primaryColor<"u"&&(g.primaryColor=e.primaryColor),typeof e.secondaryColor<"u"&&(g.secondaryColor=e.secondaryColor),typeof e.tertiaryColor<"u"&&(g.tertiaryColor=e.tertiaryColor),typeof e.colors<"u"&&(g.colors=e.colors),typeof e.zIndex<"u"&&(g.zIndex=e.zIndex),d(g,_)}),(h,p)=>(mn(),vi(jt,null,[f2(h.$slots,"default"),i.value?(mn(),vi(jt,{key:0},[a.value[r.value]?(mn(),Yl(c2(a.value[r.value].component),{key:0,"stage-transition":o.value},null,8,["stage-transition"])):Rv("",!0)],64)):Rv("",!0)],64))}});/*! +`||e[qe]===" "||e[qe]===" ");)qe++;let s;if(cf(e)&&(s=cl(e),s.type!==_e.Hue)){t.push({type:_e.Alpha,value:s});continue}if(Yg(e)&&Dd(e)==="none"){t.push({type:_e.Alpha,value:{type:_e.None,value:void 0}});continue}return}if(/\d/.test(i)){qe--,t.push(cl(e));continue}if(qg.test(i)){qe--,t.push(i6(e));continue}return}return t}function r6(n){n._i=0;let e=n[n._i++];if(!e||e.type!==_e.Function||e.value!=="color"||(e=n[n._i++],e.type!==_e.Ident))return;const t=jw[e.value];if(!t)return;const i={mode:t},s=Kw(n,!1);if(!s)return;const r=QV(t).channels;for(let o=0,a,l;o4)){if(t.length===4){if(t[3].type!==_e.Alpha)return;t[3]=t[3].value}return t.length===3&&t.push({type:_e.None,value:void 0}),t.every(s=>s.type!==_e.Alpha)?t:void 0}}function o6(n,e){n._i=0;let t=n[n._i++];if(!t||t.type!==_e.Function)return;let i=Kw(n,e);if(i)return i.unshift(t.value),i}const a6=n=>{if(typeof n!="string")return;const e=s6(n),t=e?o6(e,!0):void 0;let i,s=0,r=Ld.length;for(;sn==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,u6=(n,e,t)=>n+t*(e-n),f6=n=>{let e=[];for(let t=0;te=>{let t=f6(e);return i=>{let s=i*t.length,r=i>=1?t.length-1:Math.max(Math.floor(s),0),o=t[r];return o===void 0?void 0:n(o[0],o[1],s-r)}},Ae=d6(u6),on=n=>{let e=!1,t=n.map(i=>i!==void 0?(e=!0,i):1);return e?t:n},Ha={mode:"rgb",channels:["r","g","b","alpha"],parse:[l6,$V,KV,WV,c6,"srgb"],serialize:"srgb",interpolate:{r:Ae,g:Ae,b:Ae,alpha:{use:Ae,fixup:on}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},xm=(n=0)=>Math.pow(Math.abs(n),563/256)*Math.sign(n),Lx=n=>{let e=xm(n.r),t=xm(n.g),i=xm(n.b),s={mode:"xyz65",x:.5766690429101305*e+.1855582379065463*t+.1882286462349947*i,y:.297344975250536*e+.6273635662554661*t+.0752914584939979*i,z:.0270313613864123*e+.0706888525358272*t+.9913375368376386*i};return n.alpha!==void 0&&(s.alpha=n.alpha),s},Mm=n=>Math.pow(Math.abs(n),256/563)*Math.sign(n),Dx=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s={mode:"a98",r:Mm(n*2.0415879038107465-e*.5650069742788597-.3447313507783297*t),g:Mm(n*-.9692436362808798+e*1.8759675015077206+.0415550574071756*t),b:Mm(n*.0134442806320312-e*.1183623922310184+1.0151749943912058*t)};return i!==void 0&&(s.alpha=i),s},Sm=(n=0)=>{const e=Math.abs(n);return e<=.04045?n/12.92:(Math.sign(n)||1)*Math.pow((e+.055)/1.055,2.4)},Ga=({r:n,g:e,b:t,alpha:i})=>{let s={mode:"lrgb",r:Sm(n),g:Sm(e),b:Sm(t)};return i!==void 0&&(s.alpha=i),s},Io=n=>{let{r:e,g:t,b:i,alpha:s}=Ga(n),r={mode:"xyz65",x:.4123907992659593*e+.357584339383878*t+.1804807884018343*i,y:.2126390058715102*e+.715168678767756*t+.0721923153607337*i,z:.0193308187155918*e+.119194779794626*t+.9505321522496607*i};return s!==void 0&&(r.alpha=s),r},Em=(n=0)=>{const e=Math.abs(n);return e>.0031308?(Math.sign(n)||1)*(1.055*Math.pow(e,1/2.4)-.055):n*12.92},Wa=({r:n,g:e,b:t,alpha:i},s="rgb")=>{let r={mode:s,r:Em(n),g:Em(e),b:Em(t)};return i!==void 0&&(r.alpha=i),r},Lo=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Wa({r:n*3.2409699419045226-e*1.537383177570094-.4986107602930034*t,g:n*-.9692436362808796+e*1.8759675015077204+.0415550574071756*t,b:n*.0556300796969936-e*.2039769588889765+1.0569715142428784*t});return i!==void 0&&(s.alpha=i),s},h6={...Ha,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:n=>Dx(Io(n)),xyz65:Dx},toMode:{rgb:n=>Lo(Lx(n)),xyz65:Lx}},_n=n=>(n=n%360)<0?n+360:n,p6=(n,e)=>n.map((t,i,s)=>{if(t===void 0)return t;let r=_n(t);return i===0||n[i-1]===void 0?r:e(r-_n(s[i-1]))}).reduce((t,i)=>!t.length||i===void 0||t[t.length-1]===void 0?(t.push(i),t):(t.push(i+t[t.length-1]),t),[]),Gs=n=>p6(n,e=>Math.abs(e)<=180?e:e-360*Math.sign(e)),ln=[-.14861,1.78277,-.29227,-.90649,1.97294,0],m6=Math.PI/180,g6=180/Math.PI;let Ox=ln[3]*ln[4],Nx=ln[1]*ln[4],Ux=ln[1]*ln[2]-ln[0]*ln[3];const _6=({r:n,g:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=(Ux*t+n*Ox-e*Nx)/(Ux+Ox-Nx),r=t-s,o=(ln[4]*(e-s)-ln[2]*r)/ln[3],a={mode:"cubehelix",l:s,s:s===0||s===1?void 0:Math.sqrt(r*r+o*o)/(ln[4]*s*(1-s))};return a.s&&(a.h=Math.atan2(o,r)*g6-120),i!==void 0&&(a.alpha=i),a},v6=({h:n,s:e,l:t,alpha:i})=>{let s={mode:"rgb"};n=(n===void 0?0:n+120)*m6,t===void 0&&(t=0);let r=e===void 0?0:e*t*(1-t),o=Math.cos(n),a=Math.sin(n);return s.r=t+r*(ln[0]*o+ln[1]*a),s.g=t+r*(ln[2]*o+ln[3]*a),s.b=t+r*(ln[4]*o+ln[5]*a),i!==void 0&&(s.alpha=i),s},Wh=(n,e)=>{if(n.h===void 0||e.h===void 0||!n.s||!e.s)return 0;let t=_n(n.h),i=_n(e.h),s=Math.sin((i-t+360)/2*Math.PI/180);return 2*Math.sqrt(n.s*e.s)*s},y6=(n,e)=>{if(n.h===void 0||e.h===void 0)return 0;let t=_n(n.h),i=_n(e.h);return Math.abs(i-t)>180?t-(i-360*Math.sign(i-t)):i-t},Xh=(n,e)=>{if(n.h===void 0||e.h===void 0||!n.c||!e.c)return 0;let t=_n(n.h),i=_n(e.h),s=Math.sin((i-t+360)/2*Math.PI/180);return 2*Math.sqrt(n.c*e.c)*s},Ws=n=>{let e=n.reduce((i,s)=>{if(s!==void 0){let r=s*Math.PI/180;i.sin+=Math.sin(r),i.cos+=Math.cos(r)}return i},{sin:0,cos:0}),t=Math.atan2(e.sin,e.cos)*180/Math.PI;return t<0?360+t:t},b6={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:_6},toMode:{rgb:v6},interpolate:{h:{use:Ae,fixup:Gs},s:Ae,l:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Wh},average:{h:Ws}},br=({l:n,a:e,b:t,alpha:i},s="lch")=>{e===void 0&&(e=0),t===void 0&&(t=0);let r=Math.sqrt(e*e+t*t),o={mode:s,l:n,c:r};return r&&(o.h=_n(Math.atan2(t,e)*180/Math.PI)),i!==void 0&&(o.alpha=i),o},xr=({l:n,c:e,h:t,alpha:i},s="lab")=>{t===void 0&&(t=0);let r={mode:s,l:n,a:e?e*Math.cos(t/180*Math.PI):0,b:e?e*Math.sin(t/180*Math.PI):0};return i!==void 0&&(r.alpha=i),r},Zw=Math.pow(29,3)/Math.pow(3,3),Jw=Math.pow(6,3)/Math.pow(29,3),Jt={X:.3457/.3585,Y:1,Z:(1-.3457-.3585)/.3585},ma={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329};let Tm=n=>Math.pow(n,3)>Jw?Math.pow(n,3):(116*n-16)/Zw;const Qw=({l:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=(n+16)/116,r=e/500+s,o=s-t/200,a={mode:"xyz65",x:Tm(r)*ma.X,y:Tm(s)*ma.Y,z:Tm(o)*ma.Z};return i!==void 0&&(a.alpha=i),a},$h=n=>Lo(Qw(n)),wm=n=>n>Jw?Math.cbrt(n):(Zw*n+16)/116,eA=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=wm(n/ma.X),r=wm(e/ma.Y),o=wm(t/ma.Z),a={mode:"lab65",l:116*r-16,a:500*(s-r),b:200*(r-o)};return i!==void 0&&(a.alpha=i),a},qh=n=>{let e=eA(Io(n));return n.r===n.b&&n.b===n.g&&(e.a=e.b=0),e},Od=1,tA=1,Mc=26/180*Math.PI,Nd=Math.cos(Mc),Ud=Math.sin(Mc),nA=100/Math.log(139/100),jg=({l:n,c:e,h:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s={mode:"lab65",l:(Math.exp(n*Od/nA)-1)/.0039},r=(Math.exp(.0435*e*tA*Od)-1)/.075,o=r*Math.cos(t/180*Math.PI-Mc),a=r*Math.sin(t/180*Math.PI-Mc);return s.a=o*Nd-a/.83*Ud,s.b=o*Ud+a/.83*Nd,i!==void 0&&(s.alpha=i),s},Kg=({l:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=e*Nd+t*Ud,r=.83*(t*Nd-e*Ud),o=Math.sqrt(s*s+r*r),a={mode:"dlch",l:nA/Od*Math.log(1+.0039*n),c:Math.log(1+.075*o)/(.0435*tA*Od)};return a.c&&(a.h=_n((Math.atan2(r,s)+Mc)/Math.PI*180)),i!==void 0&&(a.alpha=i),a},Fx=n=>jg(br(n,"dlch")),kx=n=>xr(Kg(n),"dlab"),x6={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:Fx,rgb:n=>$h(Fx(n))},fromMode:{lab65:kx,rgb:n=>kx(qh(n))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:Ae,a:Ae,b:Ae,alpha:{use:Ae,fixup:on}}},M6={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:jg,dlab:n=>xr(n,"dlab"),rgb:n=>$h(jg(n))},fromMode:{lab65:Kg,dlab:n=>br(n,"dlch"),rgb:n=>Kg(qh(n))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:Ae,c:Ae,h:{use:Ae,fixup:Gs},alpha:{use:Ae,fixup:on}},difference:{h:Xh},average:{h:Ws}};function S6({h:n,s:e,i:t,alpha:i}){n=_n(n!==void 0?n:0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.abs(n/60%2-1),r;switch(Math.floor(n/60)){case 0:r={r:t*(1+e*(3/(2-s)-1)),g:t*(1+e*(3*(1-s)/(2-s)-1)),b:t*(1-e)};break;case 1:r={r:t*(1+e*(3*(1-s)/(2-s)-1)),g:t*(1+e*(3/(2-s)-1)),b:t*(1-e)};break;case 2:r={r:t*(1-e),g:t*(1+e*(3/(2-s)-1)),b:t*(1+e*(3*(1-s)/(2-s)-1))};break;case 3:r={r:t*(1-e),g:t*(1+e*(3*(1-s)/(2-s)-1)),b:t*(1+e*(3/(2-s)-1))};break;case 4:r={r:t*(1+e*(3*(1-s)/(2-s)-1)),g:t*(1-e),b:t*(1+e*(3/(2-s)-1))};break;case 5:r={r:t*(1+e*(3/(2-s)-1)),g:t*(1-e),b:t*(1+e*(3*(1-s)/(2-s)-1))};break;default:r={r:t*(1-e),g:t*(1-e),b:t*(1-e)}}return r.mode="rgb",i!==void 0&&(r.alpha=i),r}function E6({r:n,g:e,b:t,alpha:i}){n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.max(n,e,t),r=Math.min(n,e,t),o={mode:"hsi",s:n+e+t===0?0:1-3*r/(n+e+t),i:(n+e+t)/3};return s-r!==0&&(o.h=(s===n?(e-t)/(s-r)+(e{switch(e){case"deg":return+n;case"rad":return n/Math.PI*180;case"grad":return n/10*9;case"turn":return n*360}},R6=new RegExp(`^hsla?\\(\\s*${qV}${Ia}${Vl}${Ia}${Vl}\\s*(?:,\\s*${V_}\\s*)?\\)$`),P6=n=>{let e=n.match(R6);if(!e)return;let t={mode:"hsl"};return e[3]!==void 0?t.h=+e[3]:e[1]!==void 0&&e[2]!==void 0&&(t.h=C6(e[1],e[2])),e[4]!==void 0&&(t.s=Math.min(Math.max(0,e[4]/100),1)),e[5]!==void 0&&(t.l=Math.min(Math.max(0,e[5]/100),1)),e[6]!==void 0?t.alpha=Math.max(0,Math.min(1,e[6]/100)):e[7]!==void 0&&(t.alpha=Math.max(0,Math.min(1,+e[7]))),t};function I6(n,e){if(!e||e[0]!=="hsl"&&e[0]!=="hsla")return;const t={mode:"hsl"},[,i,s,r,o]=e;if(i.type!==_e.None){if(i.type===_e.Percentage)return;t.h=i.value}if(s.type!==_e.None){if(s.type===_e.Hue)return;t.s=s.value/100}if(r.type!==_e.None){if(r.type===_e.Hue)return;t.l=r.value/100}return o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const iA={mode:"hsl",toMode:{rgb:w6},fromMode:{rgb:A6},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[I6,P6],serialize:n=>`hsl(${n.h!==void 0?n.h:"none"} ${n.s!==void 0?n.s*100+"%":"none"} ${n.l!==void 0?n.l*100+"%":"none"}${n.alpha<1?` / ${n.alpha}`:""})`,interpolate:{h:{use:Ae,fixup:Gs},s:Ae,l:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Wh},average:{h:Ws}};function sA({h:n,s:e,v:t,alpha:i}){n=_n(n!==void 0?n:0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.abs(n/60%2-1),r;switch(Math.floor(n/60)){case 0:r={r:t,g:t*(1-e*s),b:t*(1-e)};break;case 1:r={r:t*(1-e*s),g:t,b:t*(1-e)};break;case 2:r={r:t*(1-e),g:t,b:t*(1-e*s)};break;case 3:r={r:t*(1-e),g:t*(1-e*s),b:t};break;case 4:r={r:t*(1-e*s),g:t*(1-e),b:t};break;case 5:r={r:t,g:t*(1-e),b:t*(1-e*s)};break;default:r={r:t*(1-e),g:t*(1-e),b:t*(1-e)}}return r.mode="rgb",i!==void 0&&(r.alpha=i),r}function rA({r:n,g:e,b:t,alpha:i}){n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.max(n,e,t),r=Math.min(n,e,t),o={mode:"hsv",s:s===0?0:1-r/s,v:s};return s-r!==0&&(o.h=(s===n?(e-t)/(s-r)+(e1){let s=e+t;e/=s,t/=s}return sA({h:n,s:t===1?1:1-e/(1-t),v:1-t,alpha:i})}function D6(n){let e=rA(n);if(e===void 0)return;let t=e.s!==void 0?e.s:0,i=e.v!==void 0?e.v:0,s={mode:"hwb",w:(1-t)*i,b:1-i};return e.h!==void 0&&(s.h=e.h),e.alpha!==void 0&&(s.alpha=e.alpha),s}function O6(n,e){if(!e||e[0]!=="hwb")return;const t={mode:"hwb"},[,i,s,r,o]=e;if(i.type!==_e.None){if(i.type===_e.Percentage)return;t.h=i.value}if(s.type!==_e.None){if(s.type===_e.Hue)return;t.w=s.value/100}if(r.type!==_e.None){if(r.type===_e.Hue)return;t.b=r.value/100}return o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const N6={mode:"hwb",toMode:{rgb:L6},fromMode:{rgb:D6},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[O6],serialize:n=>`hwb(${n.h!==void 0?n.h:"none"} ${n.w!==void 0?n.w*100+"%":"none"} ${n.b!==void 0?n.b*100+"%":"none"}${n.alpha<1?` / ${n.alpha}`:""})`,interpolate:{h:{use:Ae,fixup:Gs},w:Ae,b:Ae,alpha:{use:Ae,fixup:on}},difference:{h:y6},average:{h:Ws}},aA=203,Yh=.1593017578125,lA=78.84375,jh=.8359375,Kh=18.8515625,Zh=18.6875;function Am(n){if(n<0)return 0;const e=Math.pow(n,1/lA);return 1e4*Math.pow(Math.max(0,e-jh)/(Kh-Zh*e),1/Yh)}function Cm(n){if(n<0)return 0;const e=Math.pow(n/1e4,Yh);return Math.pow((jh+Kh*e)/(1+Zh*e),lA)}const Rm=n=>Math.max(n/aA,0),Bx=({i:n,t:e,p:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);const s=Am(n+.008609037037932761*e+.11102962500302593*t),r=Am(n-.00860903703793275*e-.11102962500302599*t),o=Am(n+.5600313357106791*e-.32062717498731885*t),a={mode:"xyz65",x:Rm(2.070152218389422*s-1.3263473389671556*r+.2066510476294051*o),y:Rm(.3647385209748074*s+.680566024947227*r-.0453045459220346*o),z:Rm(-.049747207535812*s-.0492609666966138*r+1.1880659249923042*o)};return i!==void 0&&(a.alpha=i),a},Pm=(n=0)=>Math.max(n*aA,0),zx=({x:n,y:e,z:t,alpha:i})=>{const s=Pm(n),r=Pm(e),o=Pm(t),a=Cm(.3592832590121217*s+.6976051147779502*r-.0358915932320289*o),l=Cm(-.1920808463704995*s+1.1004767970374323*r+.0753748658519118*o),c=Cm(.0070797844607477*s+.0748396662186366*r+.8433265453898765*o),u=.5*a+.5*l,f=1.61376953125*a-3.323486328125*l+1.709716796875*c,d=4.378173828125*a-4.24560546875*l-.132568359375*c,h={mode:"itp",i:u,t:f,p:d};return i!==void 0&&(h.alpha=i),h},U6={mode:"itp",channels:["i","t","p","alpha"],parse:["--ictcp"],serialize:"--ictcp",toMode:{xyz65:Bx,rgb:n=>Lo(Bx(n))},fromMode:{xyz65:zx,rgb:n=>zx(Io(n))},ranges:{i:[0,.581],t:[-.369,.272],p:[-.164,.331]},interpolate:{i:Ae,t:Ae,p:Ae,alpha:{use:Ae,fixup:on}}},F6=134.03437499999998,k6=16295499532821565e-27,Im=n=>{if(n<0)return 0;let e=Math.pow(n/1e4,Yh);return Math.pow((jh+Kh*e)/(1+Zh*e),F6)},Lm=(n=0)=>Math.max(n*203,0),cA=({x:n,y:e,z:t,alpha:i})=>{n=Lm(n),e=Lm(e),t=Lm(t);let s=1.15*n-.15*t,r=.66*e+.34*n,o=Im(.41478972*s+.579999*r+.014648*t),a=Im(-.20151*s+1.120649*r+.0531008*t),l=Im(-.0166008*s+.2648*r+.6684799*t),c=(o+a)/2,u={mode:"jab",j:.44*c/(1-.56*c)-k6,a:3.524*o-4.066708*a+.542708*l,b:.199076*o+1.096799*a-1.295875*l};return i!==void 0&&(u.alpha=i),u},B6=134.03437499999998,Vx=16295499532821565e-27,Dm=n=>{if(n<0)return 0;let e=Math.pow(n,1/B6);return 1e4*Math.pow((jh-e)/(Zh*e-Kh),1/Yh)},Om=n=>n/203,uA=({j:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=(n+Vx)/(.44+.56*(n+Vx)),r=Dm(s+.13860504*e+.058047316*t),o=Dm(s-.13860504*e-.058047316*t),a=Dm(s-.096019242*e-.8118919*t),l={mode:"xyz65",x:Om(1.661373024652174*r-.914523081304348*o+.23136208173913045*a),y:Om(-.3250758611844533*r+1.571847026732543*o-.21825383453227928*a),z:Om(-.090982811*r-.31272829*o+1.5227666*a)};return i!==void 0&&(l.alpha=i),l},fA=n=>{let e=cA(Io(n));return n.r===n.b&&n.b===n.g&&(e.a=e.b=0),e},dA=n=>Lo(uA(n)),z6={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:fA,xyz65:cA},toMode:{rgb:dA,xyz65:uA},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:Ae,a:Ae,b:Ae,alpha:{use:Ae,fixup:on}}},Hx=({j:n,a:e,b:t,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.sqrt(e*e+t*t),r={mode:"jch",j:n,c:s};return s&&(r.h=_n(Math.atan2(t,e)*180/Math.PI)),i!==void 0&&(r.alpha=i),r},Gx=({j:n,c:e,h:t,alpha:i})=>{t===void 0&&(t=0);let s={mode:"jab",j:n,a:e?e*Math.cos(t/180*Math.PI):0,b:e?e*Math.sin(t/180*Math.PI):0};return i!==void 0&&(s.alpha=i),s},V6={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:Gx,rgb:n=>dA(Gx(n))},fromMode:{rgb:n=>Hx(fA(n)),jab:Hx},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:Ae,fixup:Gs},c:Ae,j:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Xh},average:{h:Ws}},Jh=Math.pow(29,3)/Math.pow(3,3),H_=Math.pow(6,3)/Math.pow(29,3);let Nm=n=>Math.pow(n,3)>H_?Math.pow(n,3):(116*n-16)/Jh;const G_=({l:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=(n+16)/116,r=e/500+s,o=s-t/200,a={mode:"xyz50",x:Nm(r)*Jt.X,y:Nm(s)*Jt.Y,z:Nm(o)*Jt.Z};return i!==void 0&&(a.alpha=i),a},Kc=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Wa({r:n*3.1341359569958707-e*1.6173863321612538-.4906619460083532*t,g:n*-.978795502912089+e*1.916254567259524+.03344273116131949*t,b:n*.07195537988411677-e*.2289768264158322+1.405386058324125*t});return i!==void 0&&(s.alpha=i),s},hA=n=>Kc(G_(n)),Zc=n=>{let{r:e,g:t,b:i,alpha:s}=Ga(n),r={mode:"xyz50",x:.436065742824811*e+.3851514688337912*t+.14307845442264197*i,y:.22249319175623702*e+.7168870538238823*t+.06061979053616537*i,z:.013923904500943465*e+.09708128566574634*t+.7140993584005155*i};return s!==void 0&&(r.alpha=s),r},Um=n=>n>H_?Math.cbrt(n):(Jh*n+16)/116,W_=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Um(n/Jt.X),r=Um(e/Jt.Y),o=Um(t/Jt.Z),a={mode:"lab",l:116*r-16,a:500*(s-r),b:200*(r-o)};return i!==void 0&&(a.alpha=i),a},pA=n=>{let e=W_(Zc(n));return n.r===n.b&&n.b===n.g&&(e.a=e.b=0),e};function H6(n,e){if(!e||e[0]!=="lab")return;const t={mode:"lab"},[,i,s,r,o]=e;if(!(i.type===_e.Hue||s.type===_e.Hue||r.type===_e.Hue))return i.type!==_e.None&&(t.l=Math.min(Math.max(0,i.value),100)),s.type!==_e.None&&(t.a=s.type===_e.Number?s.value:s.value*125/100),r.type!==_e.None&&(t.b=r.type===_e.Number?r.value:r.value*125/100),o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const X_={mode:"lab",toMode:{xyz50:G_,rgb:hA},fromMode:{xyz50:W_,rgb:pA},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-100,100],b:[-100,100]},parse:[H6],serialize:n=>`lab(${n.l!==void 0?n.l:"none"} ${n.a!==void 0?n.a:"none"} ${n.b!==void 0?n.b:"none"}${n.alpha<1?` / ${n.alpha}`:""})`,interpolate:{l:Ae,a:Ae,b:Ae,alpha:{use:Ae,fixup:on}}},G6={...X_,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Qw,rgb:$h},fromMode:{xyz65:eA,rgb:qh},ranges:{l:[0,100],a:[-86.182,98.234],b:[-107.86,94.477]}};function W6(n,e){if(!e||e[0]!=="lch")return;const t={mode:"lch"},[,i,s,r,o]=e;if(i.type!==_e.None){if(i.type===_e.Hue)return;t.l=Math.min(Math.max(0,i.value),100)}if(s.type!==_e.None&&(t.c=Math.max(0,s.type===_e.Number?s.value:s.value*150/100)),r.type!==_e.None){if(r.type===_e.Percentage)return;t.h=r.value}return o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const $_={mode:"lch",toMode:{lab:xr,rgb:n=>hA(xr(n))},fromMode:{rgb:n=>br(pA(n)),lab:br},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[W6],serialize:n=>`lch(${n.l!==void 0?n.l:"none"} ${n.c!==void 0?n.c:"none"} ${n.h!==void 0?n.h:"none"}${n.alpha<1?` / ${n.alpha}`:""})`,interpolate:{h:{use:Ae,fixup:Gs},c:Ae,l:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Xh},average:{h:Ws}},X6={...$_,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:n=>xr(n,"lab65"),rgb:n=>$h(xr(n,"lab65"))},fromMode:{rgb:n=>br(qh(n),"lch65"),lab65:n=>br(n,"lch65")},ranges:{l:[0,100],c:[0,133.807],h:[0,360]}},mA=({l:n,u:e,v:t,alpha:i})=>{e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.sqrt(e*e+t*t),r={mode:"lchuv",l:n,c:s};return s&&(r.h=_n(Math.atan2(t,e)*180/Math.PI)),i!==void 0&&(r.alpha=i),r},gA=({l:n,c:e,h:t,alpha:i})=>{t===void 0&&(t=0);let s={mode:"luv",l:n,u:e?e*Math.cos(t/180*Math.PI):0,v:e?e*Math.sin(t/180*Math.PI):0};return i!==void 0&&(s.alpha=i),s},_A=(n,e,t)=>4*n/(n+15*e+3*t),vA=(n,e,t)=>9*e/(n+15*e+3*t),$6=_A(Jt.X,Jt.Y,Jt.Z),q6=vA(Jt.X,Jt.Y,Jt.Z),Y6=n=>n<=H_?Jh*n:116*Math.cbrt(n)-16,Zg=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Y6(e/Jt.Y),r=_A(n,e,t),o=vA(n,e,t);!isFinite(r)||!isFinite(o)?s=r=o=0:(r=13*s*(r-$6),o=13*s*(o-q6));let a={mode:"luv",l:s,u:r,v:o};return i!==void 0&&(a.alpha=i),a},j6=(n,e,t)=>4*n/(n+15*e+3*t),K6=(n,e,t)=>9*e/(n+15*e+3*t),Z6=j6(Jt.X,Jt.Y,Jt.Z),J6=K6(Jt.X,Jt.Y,Jt.Z),Jg=({l:n,u:e,v:t,alpha:i})=>{if(n===void 0&&(n=0),n===0)return{mode:"xyz50",x:0,y:0,z:0};e===void 0&&(e=0),t===void 0&&(t=0);let s=e/(13*n)+Z6,r=t/(13*n)+J6,o=Jt.Y*(n<=8?n/Jh:Math.pow((n+16)/116,3)),a=o*(9*s)/(4*r),l=o*(12-3*s-20*r)/(4*r),c={mode:"xyz50",x:a,y:o,z:l};return i!==void 0&&(c.alpha=i),c},Q6=n=>mA(Zg(Zc(n))),eH=n=>Kc(Jg(gA(n))),tH={mode:"lchuv",toMode:{luv:gA,rgb:eH},fromMode:{rgb:Q6,luv:mA},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:Ae,fixup:Gs},c:Ae,l:Ae,alpha:{use:Ae,fixup:on}},difference:{h:Xh},average:{h:Ws}},nH={...Ha,mode:"lrgb",toMode:{rgb:Wa},fromMode:{rgb:Ga},parse:["srgb-linear"],serialize:"srgb-linear"},iH={mode:"luv",toMode:{xyz50:Jg,rgb:n=>Kc(Jg(n))},fromMode:{xyz50:Zg,rgb:n=>Zg(Zc(n))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:Ae,u:Ae,v:Ae,alpha:{use:Ae,fixup:on}}},yA=({r:n,g:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.cbrt(.41222147079999993*n+.5363325363*e+.0514459929*t),r=Math.cbrt(.2119034981999999*n+.6806995450999999*e+.1073969566*t),o=Math.cbrt(.08830246189999998*n+.2817188376*e+.6299787005000002*t),a={mode:"oklab",l:.2104542553*s+.793617785*r-.0040720468*o,a:1.9779984951*s-2.428592205*r+.4505937099*o,b:.0259040371*s+.7827717662*r-.808675766*o};return i!==void 0&&(a.alpha=i),a},Qh=n=>{let e=yA(Ga(n));return n.r===n.b&&n.b===n.g&&(e.a=e.b=0),e},Jc=({l:n,a:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Math.pow(n*.9999999984505198+.39633779217376786*e+.2158037580607588*t,3),r=Math.pow(n*1.0000000088817609-.10556134232365635*e-.06385417477170591*t,3),o=Math.pow(n*1.0000000546724108-.08948418209496575*e-1.2914855378640917*t,3),a={mode:"lrgb",r:4.076741661347994*s-3.307711590408193*r+.230969928729428*o,g:-1.2684380040921763*s+2.6097574006633715*r-.3413193963102197*o,b:-.004196086541837188*s-.7034186144594493*r+1.7076147009309444*o};return i!==void 0&&(a.alpha=i),a},ep=n=>Wa(Jc(n));function Qg(n){const i=1.170873786407767;return .5*(i*n-.206+Math.sqrt((i*n-.206)*(i*n-.206)+4*.03*i*n))}function Fd(n){return(n*n+.206*n)/(1.170873786407767*(n+.03))}function sH(n,e){let t,i,s,r,o,a,l,c;-1.88170328*n-.80936493*e>1?(t=1.19086277,i=1.76576728,s=.59662641,r=.75515197,o=.56771245,a=4.0767416621,l=-3.3077115913,c=.2309699292):1.81444104*n-1.19445276*e>1?(t=.73956515,i=-.45954404,s=.08285427,r=.1254107,o=.14503204,a=-1.2684380046,l=2.6097574011,c=-.3413193965):(t=1.35733652,i=-.00915799,s=-1.1513021,r=-.50559606,o=.00692167,a=-.0041960863,l=-.7034186147,c=1.707614701);let u=t+i*n+s*e+r*n*n+o*n*e,f=.3963377774*n+.2158037573*e,d=-.1055613458*n-.0638541728*e,h=-.0894841775*n-1.291485548*e;{let p=1+u*f,_=1+u*d,g=1+u*h,m=p*p*p,y=_*_*_,b=g*g*g,v=3*f*p*p,T=3*d*_*_,E=3*h*g*g,S=6*f*f*p,P=6*d*d*_,x=6*h*h*g,M=a*m+l*y+c*b,L=a*v+l*T+c*E,F=a*S+l*P+c*x;u=u-M*L/(L*L-.5*M*F)}return u}function q_(n,e){let t=sH(n,e),i=Jc({l:1,a:t*n,b:t*e}),s=Math.cbrt(1/Math.max(i.r,i.g,i.b)),r=s*t;return[s,r]}function rH(n,e,t,i,s,r=null){r||(r=q_(n,e));let o;if((t-s)*r[1]-(r[0]-s)*i<=0)o=r[1]*s/(i*r[0]+r[1]*(s-t));else{o=r[1]*(s-1)/(i*(r[0]-1)+r[1]*(s-t));{let a=t-s,l=i,c=.3963377774*n+.2158037573*e,u=-.1055613458*n-.0638541728*e,f=-.0894841775*n-1.291485548*e,d=a+l*c,h=a+l*u,p=a+l*f;{let _=s*(1-o)+o*t,g=o*i,m=_+g*c,y=_+g*u,b=_+g*f,v=m*m*m,T=y*y*y,E=b*b*b,S=3*d*m*m,P=3*h*y*y,x=3*p*b*b,M=6*d*d*m,L=6*h*h*y,F=6*p*p*b,H=4.0767416621*v-3.3077115913*T+.2309699292*E-1,Y=4.0767416621*S-3.3077115913*P+.2309699292*x,ee=4.0767416621*M-3.3077115913*L+.2309699292*F,K=Y/(Y*Y-.5*H*ee),Q=-H*K,Z=-1.2684380046*v+2.6097574011*T-.3413193965*E-1,he=-1.2684380046*S+2.6097574011*P-.3413193965*x,be=-1.2684380046*M+2.6097574011*L-.3413193965*F,se=he/(he*he-.5*Z*be),ye=-Z*se,He=-.0041960863*v-.7034186147*T+1.707614701*E-1,re=-.0041960863*S-.7034186147*P+1.707614701*x,ge=-.0041960863*M-.7034186147*L+1.707614701*F,xe=re/(re*re-.5*He*ge),X=-He*xe;Q=K>=0?Q:1e6,ye=se>=0?ye:1e6,X=xe>=0?X:1e6,o+=Math.min(Q,Math.min(ye,X))}}}return o}function Y_(n,e,t=null){t||(t=q_(n,e));let i=t[0],s=t[1];return[s/i,s/(1-i)]}function bA(n,e,t){let i=q_(e,t),s=rH(e,t,n,1,n,i),r=Y_(e,t,i),o=.11516993+1/(7.4477897+4.1590124*t+e*(-2.19557347+1.75198401*t+e*(-2.13704948-10.02301043*t+e*(-4.24894561+5.38770819*t+4.69891013*e)))),a=.11239642+1/(1.6132032-.68124379*t+e*(.40370612+.90148123*t+e*(-.27087943+.6122399*t+e*(.00299215-.45399568*t-.14661872*e)))),l=s/Math.min(n*r[0],(1-n)*r[1]),c=n*o,u=(1-n)*a,f=.9*l*Math.sqrt(Math.sqrt(1/(1/(c*c*c*c)+1/(u*u*u*u))));return c=n*.4,u=(1-n)*.8,[Math.sqrt(1/(1/(c*c)+1/(u*u))),f,s]}function Wx(n){const e=n.l!==void 0?n.l:0,t=n.a!==void 0?n.a:0,i=n.b!==void 0?n.b:0,s={mode:"okhsl",l:Qg(e)};n.alpha!==void 0&&(s.alpha=n.alpha);let r=Math.sqrt(t*t+i*i);if(!r)return s.s=0,s;let[o,a,l]=bA(e,t/r,i/r),c;if(rWx(Qh(n))},toMode:{oklab:Xx,rgb:n=>ep(Xx(n))}};function $x(n){let e=n.l!==void 0?n.l:0,t=n.a!==void 0?n.a:0,i=n.b!==void 0?n.b:0,s=Math.sqrt(t*t+i*i),r=s?t/s:1,o=s?i/s:1,[a,l]=Y_(r,o),c=.5,u=1-c/a,f=l/(s+e*l),d=f*e,h=f*s,p=Fd(d),_=h*p/d,g=Jc({l:p,a:r*_,b:o*_}),m=Math.cbrt(1/Math.max(g.r,g.g,g.b,0));e=e/m,s=s/m*Qg(e)/e,e=Qg(e);const y={mode:"okhsv",s:s?(c+l)*h/(l*c+l*u*h):0,v:e?e/d:0};return y.s&&(y.h=_n(Math.atan2(i,t)*180/Math.PI)),n.alpha!==void 0&&(y.alpha=n.alpha),y}function qx(n){const e={mode:"oklab"};n.alpha!==void 0&&(e.alpha=n.alpha);const t=n.h!==void 0?n.h:0,i=n.s!==void 0?n.s:0,s=n.v!==void 0?n.v:0,r=Math.cos(t/180*Math.PI),o=Math.sin(t/180*Math.PI),[a,l]=Y_(r,o),c=.5,u=1-c/a,f=1-i*c/(c+l-l*u*i),d=i*l*c/(c+l-l*u*i),h=Fd(f),p=d*h/f,_=Jc({l:h,a:r*p,b:o*p}),g=Math.cbrt(1/Math.max(_.r,_.g,_.b,0)),m=Fd(s*f),y=d*m/f;return e.l=m*g,e.a=y*r*g,e.b=y*o*g,e}const aH={...oA,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:$x,rgb:n=>$x(Qh(n))},toMode:{oklab:qx,rgb:n=>ep(qx(n))}};function lH(n,e){if(!e||e[0]!=="oklab")return;const t={mode:"oklab"},[,i,s,r,o]=e;if(!(i.type===_e.Hue||s.type===_e.Hue||r.type===_e.Hue))return i.type!==_e.None&&(t.l=Math.min(Math.max(0,i.type===_e.Number?i.value:i.value/100),1)),s.type!==_e.None&&(t.a=s.type===_e.Number?s.value:s.value*.4/100),r.type!==_e.None&&(t.b=r.type===_e.Number?r.value:r.value*.4/100),o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const cH={...X_,mode:"oklab",toMode:{lrgb:Jc,rgb:ep},fromMode:{lrgb:yA,rgb:Qh},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[lH],serialize:n=>`oklab(${n.l!==void 0?n.l:"none"} ${n.a!==void 0?n.a:"none"} ${n.b!==void 0?n.b:"none"}${n.alpha<1?` / ${n.alpha}`:""})`};function uH(n,e){if(!e||e[0]!=="oklch")return;const t={mode:"oklch"},[,i,s,r,o]=e;if(i.type!==_e.None){if(i.type===_e.Hue)return;t.l=Math.min(Math.max(0,i.type===_e.Number?i.value:i.value/100),1)}if(s.type!==_e.None&&(t.c=Math.max(0,s.type===_e.Number?s.value:s.value*.4/100)),r.type!==_e.None){if(r.type===_e.Percentage)return;t.h=r.value}return o.type!==_e.None&&(t.alpha=Math.min(1,Math.max(0,o.type===_e.Number?o.value:o.value/100))),t}const fH={...$_,mode:"oklch",toMode:{oklab:n=>xr(n,"oklab"),rgb:n=>ep(xr(n,"oklab"))},fromMode:{rgb:n=>br(Qh(n),"oklch"),oklab:n=>br(n,"oklch")},parse:[uH],serialize:n=>`oklch(${n.l!==void 0?n.l:"none"} ${n.c!==void 0?n.c:"none"} ${n.h!==void 0?n.h:"none"}${n.alpha<1?` / ${n.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},Yx=n=>{let{r:e,g:t,b:i,alpha:s}=Ga(n),r={mode:"xyz65",x:.486570948648216*e+.265667693169093*t+.1982172852343625*i,y:.2289745640697487*e+.6917385218365062*t+.079286914093745*i,z:0*e+.0451133818589026*t+1.043944368900976*i};return s!==void 0&&(r.alpha=s),r},jx=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s=Wa({r:n*2.4934969119414263-e*.9313836179191242-.402710784450717*t,g:n*-.8294889695615749+e*1.7626640603183465+.0236246858419436*t,b:n*.0358458302437845-e*.0761723892680418+.9568845240076871*t},"p3");return i!==void 0&&(s.alpha=i),s},dH={...Ha,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:n=>jx(Io(n)),xyz65:jx},toMode:{rgb:n=>Lo(Yx(n)),xyz65:Yx}},Fm=n=>{let e=Math.abs(n);return e>=1/512?Math.sign(n)*Math.pow(e,1/1.8):16*n},Kx=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s={mode:"prophoto",r:Fm(n*1.3457868816471585-e*.2555720873797946-.0511018649755453*t),g:Fm(n*-.5446307051249019+e*1.5082477428451466+.0205274474364214*t),b:Fm(n*0+e*0+1.2119675456389452*t)};return i!==void 0&&(s.alpha=i),s},km=(n=0)=>{let e=Math.abs(n);return e>=16/512?Math.sign(n)*Math.pow(e,1.8):n/16},Zx=n=>{let e=km(n.r),t=km(n.g),i=km(n.b),s={mode:"xyz50",x:.7977666449006423*e+.1351812974005331*t+.0313477341283922*i,y:.2880748288194013*e+.7118352342418731*t+899369387256e-16*i,z:0*e+0*t+.8251046025104602*i};return n.alpha!==void 0&&(s.alpha=n.alpha),s},hH={...Ha,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:Kx,rgb:n=>Kx(Zc(n))},toMode:{xyz50:Zx,rgb:n=>Kc(Zx(n))}},Jx=1.09929682680944,pH=.018053968510807,Bm=n=>{const e=Math.abs(n);return e>pH?(Math.sign(n)||1)*(Jx*Math.pow(e,.45)-(Jx-1)):4.5*n},Qx=({x:n,y:e,z:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);let s={mode:"rec2020",r:Bm(n*1.7166511879712683-e*.3556707837763925-.2533662813736599*t),g:Bm(n*-.6666843518324893+e*1.6164812366349395+.0157685458139111*t),b:Bm(n*.0176398574453108-e*.0427706132578085+.9421031212354739*t)};return i!==void 0&&(s.alpha=i),s},eM=1.09929682680944,mH=.018053968510807,zm=(n=0)=>{let e=Math.abs(n);return e{let e=zm(n.r),t=zm(n.g),i=zm(n.b),s={mode:"xyz65",x:.6369580483012911*e+.1446169035862083*t+.1688809751641721*i,y:.262700212011267*e+.6779980715188708*t+.059301716469862*i,z:0*e+.0280726930490874*t+1.0609850577107909*i};return n.alpha!==void 0&&(s.alpha=n.alpha),s},gH={...Ha,mode:"rec2020",fromMode:{xyz65:Qx,rgb:n=>Qx(Io(n))},toMode:{xyz65:tM,rgb:n=>Lo(tM(n))},parse:["rec2020"],serialize:"rec2020"},_o=.0037930732552754493,xA=Math.cbrt(_o),Vm=n=>Math.cbrt(n)-xA,_H=n=>{const{r:e,g:t,b:i,alpha:s}=Ga(n),r=Vm(.3*e+.622*t+.078*i+_o),o=Vm(.23*e+.692*t+.078*i+_o),a=Vm(.2434226892454782*e+.2047674442449682*t+.5518098665095535*i+_o),l={mode:"xyb",x:(r-o)/2,y:(r+o)/2,b:a-(r+o)/2};return s!==void 0&&(l.alpha=s),l},Hm=n=>Math.pow(n+xA,3),vH=({x:n,y:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);const s=Hm(n+e)-_o,r=Hm(e-n)-_o,o=Hm(t+e)-_o,a=Wa({r:11.031566904639861*s-9.866943908131562*r-.16462299650829934*o,g:-3.2541473810744237*s+4.418770377582723*r-.16462299650829934*o,b:-3.6588512867136815*s+2.7129230459360922*r+1.9459282407775895*o});return i!==void 0&&(a.alpha=i),a},yH={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:vH},fromMode:{rgb:_H},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:Ae,y:Ae,b:Ae,alpha:{use:Ae,fixup:on}}},bH={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:Kc,lab:W_},fromMode:{rgb:Zc,lab:G_},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:Ae,y:Ae,z:Ae,alpha:{use:Ae,fixup:on}}},xH=n=>{let{x:e,y:t,z:i,alpha:s}=n;e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0);let r={mode:"xyz50",x:1.0479298208405488*e+.0229467933410191*t-.0501922295431356*i,y:.0296278156881593*e+.990434484573249*t-.0170738250293851*i,z:-.0092430581525912*e+.0150551448965779*t+.7518742899580008*i};return s!==void 0&&(r.alpha=s),r},MH=n=>{let{x:e,y:t,z:i,alpha:s}=n;e===void 0&&(e=0),t===void 0&&(t=0),i===void 0&&(i=0);let r={mode:"xyz65",x:.9554734527042182*e-.0230985368742614*t+.0632593086610217*i,y:-.0283697069632081*e+1.0099954580058226*t+.021041398966943*i,z:.0123140016883199*e-.0205076964334779*t+1.3303659366080753*i};return s!==void 0&&(r.alpha=s),r},SH={mode:"xyz65",toMode:{rgb:Lo,xyz50:xH},fromMode:{rgb:Io,xyz50:MH},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:Ae,y:Ae,z:Ae,alpha:{use:Ae,fixup:on}}},EH=({r:n,g:e,b:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);const s={mode:"yiq",y:.29889531*n+.58662247*e+.11448223*t,i:.59597799*n-.2741761*e-.32180189*t,q:.21147017*n-.52261711*e+.31114694*t};return i!==void 0&&(s.alpha=i),s},TH=({y:n,i:e,q:t,alpha:i})=>{n===void 0&&(n=0),e===void 0&&(e=0),t===void 0&&(t=0);const s={mode:"rgb",r:n+.95608445*e+.6208885*t,g:n-.27137664*e-.6486059*t,b:n-1.10561724*e+1.70250126*t};return i!==void 0&&(s.alpha=i),s},wH={mode:"yiq",toMode:{rgb:TH},fromMode:{rgb:EH},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:Ae,i:Ae,q:Ae,alpha:{use:Ae,fixup:on}}};Et(h6);Et(b6);Et(x6);Et(M6);Et(T6);Et(iA);Et(oA);Et(N6);Et(U6);Et(z6);Et(V6);Et(X_);Et(G6);Et($_);Et(X6);Et(tH);Et(nH);Et(iH);Et(oH);Et(aH);Et(cH);Et(fH);Et(dH);Et(hH);Et(gH);Et(Ha);Et(yH);Et(bH);Et(SH);Et(wH);const e0=220.44,AH=qw("oklch"),nM=n=>{var e;return n?(e=AH(n))==null?void 0:e.h:e0},CH=Nz("settings",()=>{const n=et(),e=gs("settings/language","en-US"),t=gs("settings/stage/view/model-renderer","2d"),i=gs("settings/audio/input","false"),s=Ee(()=>{var E;return(E=n.value)==null?void 0:E.deviceId}),{audioInputs:r,ensurePermissions:o}=BB({constraints:{audio:!0}}),a=et(),l=et("/assets/live2d/models/hiyori_pro_zh.zip"),c=et("url"),u=et(!1),f=gs("settings/live2d/position",{x:0,y:0}),d=et({group:"Idle",index:0}),h=et([]),p=gs("settings/live2d/motion-map",{}),_=gs("settings/disable-transitions",!0),g=gs("settings/use-page-specific-transitions",!0),m=gs("settings/theme/colors/hue",e0),y=gs("settings/theme/colors/hue-dynamic",!1);function b(E=e0){m.value=E,y.value=!1}function v(E){b(nM(E))}function T(E){if(y.value)return!1;const S=nM(E);if(!S)return!1;const P=Math.abs(S-m.value);return P<.01||P>359.99}return $e(i,E=>{E==="false"&&(n.value=void 0),E==="true"&&o().then(()=>{n.value=r.value[0]})}),$e(r,()=>{i.value==="true"&&!n.value&&(n.value=r.value[0])},{immediate:!0}),{live2dModelFile:a,live2dModelUrl:l,live2dLoadSource:c,live2dCurrentMotion:d,live2dPosition:f,availableLive2dMotions:h,live2dMotionMap:p,loadingLive2dModel:u,disableTransitions:_,usePageSpecificTransitions:g,language:e,stageView:t,themeColorsHue:m,themeColorsHueDynamic:y,isAudioInputOn:i,selectedAudioDevice:n,selectedAudioDeviceId:s,setThemeColorsHue:b,applyPrimaryColorFrom:v,isColorSelectedForPrimary:T}}),RH=fn({__name:"ArrowTransition",props:{stageTransition:{default:()=>({primaryColor:"#666",secondaryColor:"#ccc"})}},setup(n){const e=n,t=Ee(()=>e.stageTransition),i=Ee(()=>t.value.primaryColor||"#666"),s=Ee(()=>t.value.secondaryColor||"#ccc");return Hn(()=>{document.documentElement.style.setProperty("--stage-transition-3-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-3-overlay-color-2",s.value)}),(r,o)=>(mn(),vi("div",{class:"stage-transition-3",style:Mi({zIndex:t.value.zIndex||100})},null,4))}}),Do=(n,e)=>{const t=n.__vccOpts||n;for(const[i,s]of e)t[i]=s;return t},PH=Do(RH,[["__scopeId","data-v-df576df0"]]),IH=fn({__name:"BubbleWaveOutTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>{var i;return((i=e.stageTransition)==null?void 0:i.colors)||["#eee","#ebcb8b","#c56370","#3f3b52"]});return Hn(()=>{var i,s;document.documentElement.style.setProperty("--circle-expansion-delay",`${((i=e.stageTransition)==null?void 0:i.delay)||0}s`),document.documentElement.style.setProperty("--circle-expansion-duration",`${((s=e.stageTransition)==null?void 0:s.duration)||.4}s`),t.value.forEach((r,o)=>{document.documentElement.style.setProperty(`--circle-expansion-color-${o+1}`,r)})}),(i,s)=>{var r;return mn(),vi("div",{class:"circle-expansion-transition",style:Mi({zIndex:((r=n.stageTransition)==null?void 0:r.zIndex)||100})},[(mn(!0),vi(jt,null,f2(t.value,(o,a)=>(mn(),vi("div",{key:a}))),128))],4)}}}),LH=Do(IH,[["__scopeId","data-v-0c29056c"]]),DH=fn({__name:"FantasyFallTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>{var s;return((s=e.stageTransition)==null?void 0:s.direction)||"up"}),i=Ee(()=>`fantasy-fall-${t.value}`);return Hn(()=>{var s,r,o,a,l,c,u,f,d;document.documentElement.style.setProperty("--fantasy-fall-color",((s=e.stageTransition)==null?void 0:s.primaryColor)||"#eee"),document.documentElement.style.setProperty("--fantasy-fall-duration",`${((r=e.stageTransition)==null?void 0:r.duration)||.6}s`),document.documentElement.style.setProperty("--fantasy-fall-delay",`${((o=e.stageTransition)==null?void 0:o.delay)||0}s`),document.documentElement.style.setProperty("--fantasy-fall-radius-sm",`${((l=(a=e.stageTransition)==null?void 0:a.borderRadius)==null?void 0:l.sm)||"14rem"}`),document.documentElement.style.setProperty("--fantasy-fall-radius-md",`${((u=(c=e.stageTransition)==null?void 0:c.borderRadius)==null?void 0:u.md)||"14rem"}`),document.documentElement.style.setProperty("--fantasy-fall-radius-lg",`${((d=(f=e.stageTransition)==null?void 0:f.borderRadius)==null?void 0:d.lg)||"50%"}`)}),(s,r)=>{var o;return mn(),vi("div",{class:Oa(["fantasy-fall-transition",i.value]),style:Mi({zIndex:((o=n.stageTransition)==null?void 0:o.zIndex)??100})},null,6)}}}),OH=Do(DH,[["__scopeId","data-v-e62bf496"]]),NH=fn({__name:"MultipleBlocksRevealTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>e.stageTransition),i=Ee(()=>{var r;return((r=t.value)==null?void 0:r.primaryColor)||"#666"}),s=Ee(()=>{var r;return((r=t.value)==null?void 0:r.secondaryColor)||"#ccc"});return Hn(()=>{document.documentElement.style.setProperty("--stage-transition-4-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-4-overlay-color-2",s.value)}),(r,o)=>{var a;return mn(),vi("div",{class:"stage-transition-4",style:Mi({zIndex:((a=t.value)==null?void 0:a.zIndex)??100})},o[0]||(o[0]=[W2('
',5)]),4)}}}),UH=Do(NH,[["__scopeId","data-v-6d1179fc"]]),FH=fn({__name:"SlideTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>e.stageTransition),i=Ee(()=>{var r;return((r=t.value)==null?void 0:r.primaryColor)||"#666"}),s=Ee(()=>{var r;return((r=t.value)==null?void 0:r.secondaryColor)||"#ccc"});return $e([t,i,s],()=>{document.documentElement.style.setProperty("--stage-transition-1-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-1-overlay-color-2",s.value)}),Hn(()=>{document.documentElement.style.setProperty("--stage-transition-1-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-1-overlay-color-2",s.value)}),(r,o)=>{var a;return mn(),vi("div",{class:"stage-transition-1",style:Mi({zIndex:((a=t.value)==null?void 0:a.zIndex)??100})},null,4)}}}),kH=Do(FH,[["__scopeId","data-v-bf1d1566"]]),BH=fn({__name:"SlopeSlideTransition",props:{stageTransition:null},setup(n){const e=n,t=Ee(()=>e.stageTransition),i=Ee(()=>{var r;return((r=t.value)==null?void 0:r.primaryColor)??"#666"}),s=Ee(()=>{var r;return((r=t.value)==null?void 0:r.secondaryColor)??"#ccc"});return Hn(()=>{document.documentElement.style.setProperty("--stage-transition-2-overlay-color-1",i.value),document.documentElement.style.setProperty("--stage-transition-2-overlay-color-2",s.value)}),(r,o)=>{var a;return mn(),vi("div",{class:"stage-transition-2",style:Mi({zIndex:((a=t.value)==null?void 0:a.zIndex)??100})},null,4)}}}),zH=Do(BH,[["__scopeId","data-v-8ff7120f"]]),VH=fn({__name:"RectanglesRotateTransition",props:{stageTransition:null},setup(n){const e=n;return Hn(()=>{var t,i,s,r,o,a,l;document.documentElement.style.setProperty("--rectangle-rotate-1-color",((t=e.stageTransition)==null?void 0:t.primaryColor)||"#ebcb8b"),document.documentElement.style.setProperty("--rectangle-rotate-2-color",((i=e.stageTransition)==null?void 0:i.secondaryColor)||"#c56370"),document.documentElement.style.setProperty("--rectangle-rotate-3-color",((s=e.stageTransition)==null?void 0:s.tertiaryColor)||"#43445b"),document.documentElement.style.setProperty("--rectangle-rotate-duration",`${((r=e.stageTransition)==null?void 0:r.duration)||.6}s`),document.documentElement.style.setProperty("--rectangle-rotate-delay",`${((o=e.stageTransition)==null?void 0:o.delay)||0}s`),document.documentElement.style.setProperty("--rectangle-rotate-stagger",`${((a=e.stageTransition)==null?void 0:a.staggerDelay)||.1}s`),document.documentElement.style.setProperty("--rectangle-rotate-rotation",`${((l=e.stageTransition)==null?void 0:l.rotation)||270}deg`)}),(t,i)=>{var s;return mn(),vi("div",{class:"rectangle-rotate-transition",style:Mi({zIndex:((s=n.stageTransition)==null?void 0:s.zIndex)??100})},i[0]||(i[0]=[sr("div",{class:"rectangle rectangle-rotate-1"},[sr("div")],-1),sr("div",{class:"rectangle rectangle-rotate-2"},[sr("div")],-1),sr("div",{class:"rectangle rectangle-rotate-3"},[sr("div")],-1)]),4)}}}),HH=Do(VH,[["__scopeId","data-v-f4b1dc64"]]),GH=fn({__name:"StageTransitionGroup",props:{primaryColor:null,secondaryColor:null,tertiaryColor:null,colors:null,zIndex:null,disableTransitions:{type:Boolean},usePageSpecificTransitions:{type:Boolean}},setup(n){const e=n,t=VV(),i=et(!1),s=et(),r=et(""),o=et(),a=De({slide:{component:kH,duration:2700},"slope-slide":{component:zH,duration:2700},arrow:{component:PH,duration:2700},"multiple-blocks-reveal":{component:UH,duration:2800},"fantasy-fall":{component:OH,duration:2700},"rectangles-rotate":{component:HH,duration:2700},"bubble-wave-out":{component:LH,duration:1e3}}),l=et([]);function c(h){return l.value.push(h),()=>{const p=l.value.indexOf(h);p>=0&&l.value.splice(p,1)}}async function u(h,p={}){s.value=h;for(const _ of l.value)try{await Promise.resolve(_(h,p))}catch(g){console.error(`Error in transition hook at stage "${h}":`,g)}}async function f(h,p,_){if(h.name==="none"||!h.name){p(),_();return}const g=a.value[h.name];if(!g){console.error(`Transition ${h.name} not found`),p(),_();return}const m=g.nextDelay!==void 0?g.nextDelay:g.duration/3;let y=!1;const v=c(T=>{T==="navigation"&&!y&&(y=!0,p())});try{await u("before-enter",{transitionName:h.name}),i.value&&(await u("before-leave",{transitionName:r.value}),r.value="",o.value=void 0,i.value=!1,await u("after-leave",{transitionName:r.value}),await new Promise(E=>setTimeout(E,50))),r.value=h.name,o.value=h,i.value=!0,await u("enter-active",{transitionName:name}),setTimeout(async()=>{await u("navigation",{transitionName:h.name,config:g}),y||(y=!0,p())},m),setTimeout(async()=>{await u("after-enter",{transitionName:h.name})},g.duration),setTimeout(async()=>{await u("before-leave",{transitionName:h.name})},g.duration+10),setTimeout(async()=>{await u("leave-active",{transitionName:h.name})},g.duration+20);const T=g.exitDuration??0;setTimeout(async()=>{i.value=!1,r.value="",o.value=void 0,await u("after-leave",{transitionName:h.name}),_()},g.duration+T)}catch(T){console.error(T)}finally{v(),setTimeout(()=>{y||(y=!0,p())},g.duration*2)}}function d(h,p){return new Promise(_=>{f(h,p,_)})}return t.beforeEach((h,p,_)=>{if(e.disableTransitions){_();return}if(typeof h.meta.stageTransition!="object"){_();return}const g=h.meta.stageTransition;if(e.usePageSpecificTransitions&&g.pageSpecificAvailable){_();return}typeof e.primaryColor<"u"&&(g.primaryColor=e.primaryColor),typeof e.secondaryColor<"u"&&(g.secondaryColor=e.secondaryColor),typeof e.tertiaryColor<"u"&&(g.tertiaryColor=e.tertiaryColor),typeof e.colors<"u"&&(g.colors=e.colors),typeof e.zIndex<"u"&&(g.zIndex=e.zIndex),d(g,_)}),(h,p)=>(mn(),vi(jt,null,[d2(h.$slots,"default"),i.value?(mn(),vi(jt,{key:0},[a.value[r.value]?(mn(),Yl(u2(a.value[r.value].component),{key:0,"stage-transition":o.value},null,8,["stage-transition"])):Rv("",!0)],64)):Rv("",!0)],64))}});/*! * shared v11.1.3 * (c) 2025 kazuya kawaguchi * Released under the MIT License. - */const kd=typeof window<"u",Rr=(n,e=!1)=>e?Symbol.for(n):Symbol(n),GH=(n,e,t)=>WH({l:n,k:e,s:t}),WH=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),Zt=n=>typeof n=="number"&&isFinite(n),XH=n=>K_(n)==="[object Date]",Bd=n=>K_(n)==="[object RegExp]",tp=n=>dt(n)&&Object.keys(n).length===0,un=Object.assign,$H=Object.create,Rt=(n=null)=>$H(n);let iM;const j_=()=>iM||(iM=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Rt());function sM(n){return n.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const qH=Object.prototype.hasOwnProperty;function Oi(n,e){return qH.call(n,e)}const tn=Array.isArray,kt=n=>typeof n=="function",Ne=n=>typeof n=="string",Bt=n=>typeof n=="boolean",yt=n=>n!==null&&typeof n=="object",YH=n=>yt(n)&&kt(n.then)&&kt(n.catch),xA=Object.prototype.toString,K_=n=>xA.call(n),dt=n=>K_(n)==="[object Object]",jH=n=>n==null?"":tn(n)||dt(n)&&n.toString===xA?JSON.stringify(n,null,2):String(n);function Z_(n,e=""){return n.reduce((t,i,s)=>s===0?t+i:t+e+i,"")}function KH(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const ff=n=>!yt(n)||tn(n);function Pf(n,e){if(ff(n)||ff(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:i,des:s}=t.pop();Object.keys(i).forEach(r=>{r!=="__proto__"&&(yt(i[r])&&!yt(s[r])&&(s[r]=Array.isArray(i[r])?[]:Rt()),ff(s[r])||ff(i[r])?s[r]=i[r]:t.push({src:i[r],des:s[r]}))})}}/*! + */const kd=typeof window<"u",Rr=(n,e=!1)=>e?Symbol.for(n):Symbol(n),WH=(n,e,t)=>XH({l:n,k:e,s:t}),XH=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),Zt=n=>typeof n=="number"&&isFinite(n),$H=n=>K_(n)==="[object Date]",Bd=n=>K_(n)==="[object RegExp]",tp=n=>dt(n)&&Object.keys(n).length===0,un=Object.assign,qH=Object.create,Rt=(n=null)=>qH(n);let iM;const j_=()=>iM||(iM=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Rt());function sM(n){return n.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const YH=Object.prototype.hasOwnProperty;function Di(n,e){return YH.call(n,e)}const tn=Array.isArray,kt=n=>typeof n=="function",Ne=n=>typeof n=="string",Bt=n=>typeof n=="boolean",yt=n=>n!==null&&typeof n=="object",jH=n=>yt(n)&&kt(n.then)&&kt(n.catch),MA=Object.prototype.toString,K_=n=>MA.call(n),dt=n=>K_(n)==="[object Object]",KH=n=>n==null?"":tn(n)||dt(n)&&n.toString===MA?JSON.stringify(n,null,2):String(n);function Z_(n,e=""){return n.reduce((t,i,s)=>s===0?t+i:t+e+i,"")}function ZH(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const ff=n=>!yt(n)||tn(n);function Pf(n,e){if(ff(n)||ff(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:i,des:s}=t.pop();Object.keys(i).forEach(r=>{r!=="__proto__"&&(yt(i[r])&&!yt(s[r])&&(s[r]=Array.isArray(i[r])?[]:Rt()),ff(s[r])||ff(i[r])?s[r]=i[r]:t.push({src:i[r],des:s[r]}))})}}/*! * message-compiler v11.1.3 * (c) 2025 kazuya kawaguchi * Released under the MIT License. - */function ZH(n,e,t){return{line:n,column:e,offset:t}}function t0(n,e,t){return{start:n,end:e}}const At={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14},JH=17;function np(n,e,t={}){const{domain:i,messages:s,args:r}=t,o=n,a=new SyntaxError(String(o));return a.code=n,e&&(a.location=e),a.domain=i,a}function QH(n){throw n}const vs=" ",e8="\r",Ln=` -`,t8="\u2028",n8="\u2029";function i8(n){const e=n;let t=0,i=1,s=1,r=0;const o=S=>e[S]===e8&&e[S+1]===Ln,a=S=>e[S]===Ln,l=S=>e[S]===n8,c=S=>e[S]===t8,u=S=>o(S)||a(S)||l(S)||c(S),f=()=>t,d=()=>i,h=()=>s,p=()=>r,_=S=>o(S)||l(S)||c(S)?Ln:e[S],g=()=>_(t),m=()=>_(t+r);function y(){return r=0,u(t)&&(i++,s=0),o(t)&&t++,t++,s++,e[t]}function b(){return o(t+r)&&r++,r++,e[t+r]}function v(){t=0,i=1,s=1,r=0}function T(S=0){r=S}function E(){const S=t+r;for(;S!==t;)y();r=0}return{index:f,line:d,column:h,peekOffset:p,charAt:_,currentChar:g,currentPeek:m,next:y,peek:b,reset:v,resetPeek:T,skipToPeek:E}}const er=void 0,s8=".",rM="'",r8="tokenizer";function o8(n,e={}){const t=e.location!==!1,i=i8(n),s=()=>i.index(),r=()=>ZH(i.line(),i.column(),i.index()),o=r(),a=s(),l={currentType:13,offset:a,startLoc:o,endLoc:o,lastType:13,lastOffset:a,lastStartLoc:o,lastEndLoc:o,braceNest:0,inLinked:!1,text:""},c=()=>l,{onError:u}=e;function f(C,I,N,...A){const w=c();if(I.column+=N,I.offset+=N,u){const U=t?t0(w.startLoc,I):null,O=np(C,U,{domain:r8,args:A});u(O)}}function d(C,I,N){C.endLoc=r(),C.currentType=I;const A={type:I};return t&&(A.loc=t0(C.startLoc,C.endLoc)),N!=null&&(A.value=N),A}const h=C=>d(C,13);function p(C,I){return C.currentChar()===I?(C.next(),I):(f(At.EXPECTED_TOKEN,r(),0,I),"")}function _(C){let I="";for(;C.currentPeek()===vs||C.currentPeek()===Ln;)I+=C.currentPeek(),C.peek();return I}function g(C){const I=_(C);return C.skipToPeek(),I}function m(C){if(C===er)return!1;const I=C.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function y(C){if(C===er)return!1;const I=C.charCodeAt(0);return I>=48&&I<=57}function b(C,I){const{currentType:N}=I;if(N!==2)return!1;_(C);const A=m(C.currentPeek());return C.resetPeek(),A}function v(C,I){const{currentType:N}=I;if(N!==2)return!1;_(C);const A=C.currentPeek()==="-"?C.peek():C.currentPeek(),w=y(A);return C.resetPeek(),w}function T(C,I){const{currentType:N}=I;if(N!==2)return!1;_(C);const A=C.currentPeek()===rM;return C.resetPeek(),A}function E(C,I){const{currentType:N}=I;if(N!==7)return!1;_(C);const A=C.currentPeek()===".";return C.resetPeek(),A}function S(C,I){const{currentType:N}=I;if(N!==8)return!1;_(C);const A=m(C.currentPeek());return C.resetPeek(),A}function P(C,I){const{currentType:N}=I;if(!(N===7||N===11))return!1;_(C);const A=C.currentPeek()===":";return C.resetPeek(),A}function x(C,I){const{currentType:N}=I;if(N!==9)return!1;const A=()=>{const U=C.currentPeek();return U==="{"?m(C.peek()):U==="@"||U==="|"||U===":"||U==="."||U===vs||!U?!1:U===Ln?(C.peek(),A()):L(C,!1)},w=A();return C.resetPeek(),w}function M(C){_(C);const I=C.currentPeek()==="|";return C.resetPeek(),I}function L(C,I=!0){const N=(w=!1,U="")=>{const O=C.currentPeek();return O==="{"||O==="@"||!O?w:O==="|"?!(U===vs||U===Ln):O===vs?(C.peek(),N(!0,vs)):O===Ln?(C.peek(),N(!0,Ln)):!0},A=N();return I&&C.resetPeek(),A}function F(C,I){const N=C.currentChar();return N===er?er:I(N)?(C.next(),N):null}function H(C){const I=C.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function Y(C){return F(C,H)}function ee(C){const I=C.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function K(C){return F(C,ee)}function Q(C){const I=C.charCodeAt(0);return I>=48&&I<=57}function Z(C){return F(C,Q)}function he(C){const I=C.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function be(C){return F(C,he)}function se(C){let I="",N="";for(;I=Z(C);)N+=I;return N}function ye(C){let I="";for(;;){const N=C.currentChar();if(N==="{"||N==="}"||N==="@"||N==="|"||!N)break;if(N===vs||N===Ln)if(L(C))I+=N,C.next();else{if(M(C))break;I+=N,C.next()}else I+=N,C.next()}return I}function He(C){g(C);let I="",N="";for(;I=K(C);)N+=I;return C.currentChar()===er&&f(At.UNTERMINATED_CLOSING_BRACE,r(),0),N}function re(C){g(C);let I="";return C.currentChar()==="-"?(C.next(),I+=`-${se(C)}`):I+=se(C),C.currentChar()===er&&f(At.UNTERMINATED_CLOSING_BRACE,r(),0),I}function ge(C){return C!==rM&&C!==Ln}function xe(C){g(C),p(C,"'");let I="",N="";for(;I=F(C,ge);)I==="\\"?N+=X(C):N+=I;const A=C.currentChar();return A===Ln||A===er?(f(At.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,r(),0),A===Ln&&(C.next(),p(C,"'")),N):(p(C,"'"),N)}function X(C){const I=C.currentChar();switch(I){case"\\":case"'":return C.next(),`\\${I}`;case"u":return ae(C,I,4);case"U":return ae(C,I,6);default:return f(At.UNKNOWN_ESCAPE_SEQUENCE,r(),0,I),""}}function ae(C,I,N){p(C,I);let A="";for(let w=0;w{const A=C.currentChar();return A==="{"||A==="@"||A==="|"||A==="("||A===")"||!A||A===vs?N:(N+=A,C.next(),I(N))};return I("")}function z(C){g(C);const I=p(C,"|");return g(C),I}function R(C,I){let N=null;switch(C.currentChar()){case"{":return I.braceNest>=1&&f(At.NOT_ALLOW_NEST_PLACEHOLDER,r(),0),C.next(),N=d(I,2,"{"),g(C),I.braceNest++,N;case"}":return I.braceNest>0&&I.currentType===2&&f(At.EMPTY_PLACEHOLDER,r(),0),C.next(),N=d(I,3,"}"),I.braceNest--,I.braceNest>0&&g(C),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),N;case"@":return I.braceNest>0&&f(At.UNTERMINATED_CLOSING_BRACE,r(),0),N=te(C,I)||h(I),I.braceNest=0,N;default:{let w=!0,U=!0,O=!0;if(M(C))return I.braceNest>0&&f(At.UNTERMINATED_CLOSING_BRACE,r(),0),N=d(I,1,z(C)),I.braceNest=0,I.inLinked=!1,N;if(I.braceNest>0&&(I.currentType===4||I.currentType===5||I.currentType===6))return f(At.UNTERMINATED_CLOSING_BRACE,r(),0),I.braceNest=0,G(C,I);if(w=b(C,I))return N=d(I,4,He(C)),g(C),N;if(U=v(C,I))return N=d(I,5,re(C)),g(C),N;if(O=T(C,I))return N=d(I,6,xe(C)),g(C),N;if(!w&&!U&&!O)return N=d(I,12,ce(C)),f(At.INVALID_TOKEN_IN_PLACEHOLDER,r(),0,N.value),g(C),N;break}}return N}function te(C,I){const{currentType:N}=I;let A=null;const w=C.currentChar();switch((N===7||N===8||N===11||N===9)&&(w===Ln||w===vs)&&f(At.INVALID_LINKED_FORMAT,r(),0),w){case"@":return C.next(),A=d(I,7,"@"),I.inLinked=!0,A;case".":return g(C),C.next(),d(I,8,".");case":":return g(C),C.next(),d(I,9,":");default:return M(C)?(A=d(I,1,z(C)),I.braceNest=0,I.inLinked=!1,A):E(C,I)||P(C,I)?(g(C),te(C,I)):S(C,I)?(g(C),d(I,11,Ue(C))):x(C,I)?(g(C),w==="{"?R(C,I)||A:d(I,10,k(C))):(N===7&&f(At.INVALID_LINKED_FORMAT,r(),0),I.braceNest=0,I.inLinked=!1,G(C,I))}}function G(C,I){let N={type:13};if(I.braceNest>0)return R(C,I)||h(I);if(I.inLinked)return te(C,I)||h(I);switch(C.currentChar()){case"{":return R(C,I)||h(I);case"}":return f(At.UNBALANCED_CLOSING_BRACE,r(),0),C.next(),d(I,3,"}");case"@":return te(C,I)||h(I);default:{if(M(C))return N=d(I,1,z(C)),I.braceNest=0,I.inLinked=!1,N;if(L(C))return d(I,0,ye(C));break}}return N}function W(){const{currentType:C,offset:I,startLoc:N,endLoc:A}=l;return l.lastType=C,l.lastOffset=I,l.lastStartLoc=N,l.lastEndLoc=A,l.offset=s(),l.startLoc=r(),i.currentChar()===er?d(l,13):G(i,l)}return{nextToken:W,currentOffset:s,currentPosition:r,context:c}}const a8="parser",l8=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function c8(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const i=parseInt(e||t,16);return i<=55295||i>=57344?String.fromCodePoint(i):"�"}}}function u8(n={}){const e=n.location!==!1,{onError:t}=n;function i(m,y,b,v,...T){const E=m.currentPosition();if(E.offset+=v,E.column+=v,t){const S=e?t0(b,E):null,P=np(y,S,{domain:a8,args:T});t(P)}}function s(m,y,b){const v={type:m};return e&&(v.start=y,v.end=y,v.loc={start:b,end:b}),v}function r(m,y,b,v){e&&(m.end=y,m.loc&&(m.loc.end=b))}function o(m,y){const b=m.context(),v=s(3,b.offset,b.startLoc);return v.value=y,r(v,m.currentOffset(),m.currentPosition()),v}function a(m,y){const b=m.context(),{lastOffset:v,lastStartLoc:T}=b,E=s(5,v,T);return E.index=parseInt(y,10),m.nextToken(),r(E,m.currentOffset(),m.currentPosition()),E}function l(m,y){const b=m.context(),{lastOffset:v,lastStartLoc:T}=b,E=s(4,v,T);return E.key=y,m.nextToken(),r(E,m.currentOffset(),m.currentPosition()),E}function c(m,y){const b=m.context(),{lastOffset:v,lastStartLoc:T}=b,E=s(9,v,T);return E.value=y.replace(l8,c8),m.nextToken(),r(E,m.currentOffset(),m.currentPosition()),E}function u(m){const y=m.nextToken(),b=m.context(),{lastOffset:v,lastStartLoc:T}=b,E=s(8,v,T);return y.type!==11?(i(m,At.UNEXPECTED_EMPTY_LINKED_MODIFIER,b.lastStartLoc,0),E.value="",r(E,v,T),{nextConsumeToken:y,node:E}):(y.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,Gi(y)),E.value=y.value||"",r(E,m.currentOffset(),m.currentPosition()),{node:E})}function f(m,y){const b=m.context(),v=s(7,b.offset,b.startLoc);return v.value=y,r(v,m.currentOffset(),m.currentPosition()),v}function d(m){const y=m.context(),b=s(6,y.offset,y.startLoc);let v=m.nextToken();if(v.type===8){const T=u(m);b.modifier=T.node,v=T.nextConsumeToken||m.nextToken()}switch(v.type!==9&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),v=m.nextToken(),v.type===2&&(v=m.nextToken()),v.type){case 10:v.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),b.key=f(m,v.value||"");break;case 4:v.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),b.key=l(m,v.value||"");break;case 5:v.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),b.key=a(m,v.value||"");break;case 6:v.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),b.key=c(m,v.value||"");break;default:{i(m,At.UNEXPECTED_EMPTY_LINKED_KEY,y.lastStartLoc,0);const T=m.context(),E=s(7,T.offset,T.startLoc);return E.value="",r(E,T.offset,T.startLoc),b.key=E,r(b,T.offset,T.startLoc),{nextConsumeToken:v,node:b}}}return r(b,m.currentOffset(),m.currentPosition()),{node:b}}function h(m){const y=m.context(),b=y.currentType===1?m.currentOffset():y.offset,v=y.currentType===1?y.endLoc:y.startLoc,T=s(2,b,v);T.items=[];let E=null;do{const x=E||m.nextToken();switch(E=null,x.type){case 0:x.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(x)),T.items.push(o(m,x.value||""));break;case 5:x.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(x)),T.items.push(a(m,x.value||""));break;case 4:x.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(x)),T.items.push(l(m,x.value||""));break;case 6:x.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(x)),T.items.push(c(m,x.value||""));break;case 7:{const M=d(m);T.items.push(M.node),E=M.nextConsumeToken||null;break}}}while(y.currentType!==13&&y.currentType!==1);const S=y.currentType===1?y.lastOffset:m.currentOffset(),P=y.currentType===1?y.lastEndLoc:m.currentPosition();return r(T,S,P),T}function p(m,y,b,v){const T=m.context();let E=v.items.length===0;const S=s(1,y,b);S.cases=[],S.cases.push(v);do{const P=h(m);E||(E=P.items.length===0),S.cases.push(P)}while(T.currentType!==13);return E&&i(m,At.MUST_HAVE_MESSAGES_IN_PLURAL,b,0),r(S,m.currentOffset(),m.currentPosition()),S}function _(m){const y=m.context(),{offset:b,startLoc:v}=y,T=h(m);return y.currentType===13?T:p(m,b,v,T)}function g(m){const y=o8(m,un({},n)),b=y.context(),v=s(0,b.offset,b.startLoc);return e&&v.loc&&(v.loc.source=m),v.body=_(y),n.onCacheKey&&(v.cacheKey=n.onCacheKey(m)),b.currentType!==13&&i(y,At.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,m[b.offset]||""),r(v,y.currentOffset(),y.currentPosition()),v}return{parse:g}}function Gi(n){if(n.type===13)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function f8(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:r=>(t.helpers.add(r),r)}}function oM(n,e){for(let t=0;taM(t)),n}function aM(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;to;function l(_,g){o.code+=_}function c(_,g=!0){const m=g?i:"";l(s?m+" ".repeat(_):m)}function u(_=!0){const g=++o.indentLevel;_&&c(g)}function f(_=!0){const g=--o.indentLevel;_&&c(g)}function d(){c(o.indentLevel)}return{context:a,push:l,indent:u,deindent:f,newline:d,helper:_=>`_${_}`,needIndent:()=>o.needIndent}}function m8(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),La(n,e.key),e.modifier?(n.push(", "),La(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function g8(n,e){const{helper:t,needIndent:i}=n;n.push(`${t("normalize")}([`),n.indent(i());const s=e.items.length;for(let r=0;r1){n.push(`${t("plural")}([`),n.indent(i());const s=e.cases.length;for(let r=0;r{const t=Ne(e.mode)?e.mode:"normal",i=Ne(e.filename)?e.filename:"message.intl";e.sourceMap;const s=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":` -`,r=e.needIndent?e.needIndent:t!=="arrow",o=n.helpers||[],a=p8(n,{filename:i,breakLineCode:s,needIndent:r});a.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),a.indent(r),o.length>0&&(a.push(`const { ${Z_(o.map(u=>`${u}: _${u}`),", ")} } = ctx`),a.newline()),a.push("return "),La(a,n),a.deindent(r),a.push("}"),delete n.helpers;const{code:l,map:c}=a.context();return{ast:n,code:l,map:c?c.toJSON():void 0}};function b8(n,e={}){const t=un({},e),i=!!t.jit,s=!!t.minify,r=t.optimize==null?!0:t.optimize,a=u8(t).parse(n);return i?(r&&h8(a),s&&ia(a),{ast:a,code:""}):(d8(a,t),y8(a,t))}/*! + */function JH(n,e,t){return{line:n,column:e,offset:t}}function t0(n,e,t){return{start:n,end:e}}const At={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14},QH=17;function np(n,e,t={}){const{domain:i,messages:s,args:r}=t,o=n,a=new SyntaxError(String(o));return a.code=n,e&&(a.location=e),a.domain=i,a}function e8(n){throw n}const vs=" ",t8="\r",Ln=` +`,n8="\u2028",i8="\u2029";function s8(n){const e=n;let t=0,i=1,s=1,r=0;const o=S=>e[S]===t8&&e[S+1]===Ln,a=S=>e[S]===Ln,l=S=>e[S]===i8,c=S=>e[S]===n8,u=S=>o(S)||a(S)||l(S)||c(S),f=()=>t,d=()=>i,h=()=>s,p=()=>r,_=S=>o(S)||l(S)||c(S)?Ln:e[S],g=()=>_(t),m=()=>_(t+r);function y(){return r=0,u(t)&&(i++,s=0),o(t)&&t++,t++,s++,e[t]}function b(){return o(t+r)&&r++,r++,e[t+r]}function v(){t=0,i=1,s=1,r=0}function T(S=0){r=S}function E(){const S=t+r;for(;S!==t;)y();r=0}return{index:f,line:d,column:h,peekOffset:p,charAt:_,currentChar:g,currentPeek:m,next:y,peek:b,reset:v,resetPeek:T,skipToPeek:E}}const er=void 0,r8=".",rM="'",o8="tokenizer";function a8(n,e={}){const t=e.location!==!1,i=s8(n),s=()=>i.index(),r=()=>JH(i.line(),i.column(),i.index()),o=r(),a=s(),l={currentType:13,offset:a,startLoc:o,endLoc:o,lastType:13,lastOffset:a,lastStartLoc:o,lastEndLoc:o,braceNest:0,inLinked:!1,text:""},c=()=>l,{onError:u}=e;function f(C,I,N,...A){const w=c();if(I.column+=N,I.offset+=N,u){const U=t?t0(w.startLoc,I):null,O=np(C,U,{domain:o8,args:A});u(O)}}function d(C,I,N){C.endLoc=r(),C.currentType=I;const A={type:I};return t&&(A.loc=t0(C.startLoc,C.endLoc)),N!=null&&(A.value=N),A}const h=C=>d(C,13);function p(C,I){return C.currentChar()===I?(C.next(),I):(f(At.EXPECTED_TOKEN,r(),0,I),"")}function _(C){let I="";for(;C.currentPeek()===vs||C.currentPeek()===Ln;)I+=C.currentPeek(),C.peek();return I}function g(C){const I=_(C);return C.skipToPeek(),I}function m(C){if(C===er)return!1;const I=C.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function y(C){if(C===er)return!1;const I=C.charCodeAt(0);return I>=48&&I<=57}function b(C,I){const{currentType:N}=I;if(N!==2)return!1;_(C);const A=m(C.currentPeek());return C.resetPeek(),A}function v(C,I){const{currentType:N}=I;if(N!==2)return!1;_(C);const A=C.currentPeek()==="-"?C.peek():C.currentPeek(),w=y(A);return C.resetPeek(),w}function T(C,I){const{currentType:N}=I;if(N!==2)return!1;_(C);const A=C.currentPeek()===rM;return C.resetPeek(),A}function E(C,I){const{currentType:N}=I;if(N!==7)return!1;_(C);const A=C.currentPeek()===".";return C.resetPeek(),A}function S(C,I){const{currentType:N}=I;if(N!==8)return!1;_(C);const A=m(C.currentPeek());return C.resetPeek(),A}function P(C,I){const{currentType:N}=I;if(!(N===7||N===11))return!1;_(C);const A=C.currentPeek()===":";return C.resetPeek(),A}function x(C,I){const{currentType:N}=I;if(N!==9)return!1;const A=()=>{const U=C.currentPeek();return U==="{"?m(C.peek()):U==="@"||U==="|"||U===":"||U==="."||U===vs||!U?!1:U===Ln?(C.peek(),A()):L(C,!1)},w=A();return C.resetPeek(),w}function M(C){_(C);const I=C.currentPeek()==="|";return C.resetPeek(),I}function L(C,I=!0){const N=(w=!1,U="")=>{const O=C.currentPeek();return O==="{"||O==="@"||!O?w:O==="|"?!(U===vs||U===Ln):O===vs?(C.peek(),N(!0,vs)):O===Ln?(C.peek(),N(!0,Ln)):!0},A=N();return I&&C.resetPeek(),A}function F(C,I){const N=C.currentChar();return N===er?er:I(N)?(C.next(),N):null}function H(C){const I=C.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function Y(C){return F(C,H)}function ee(C){const I=C.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function K(C){return F(C,ee)}function Q(C){const I=C.charCodeAt(0);return I>=48&&I<=57}function Z(C){return F(C,Q)}function he(C){const I=C.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function be(C){return F(C,he)}function se(C){let I="",N="";for(;I=Z(C);)N+=I;return N}function ye(C){let I="";for(;;){const N=C.currentChar();if(N==="{"||N==="}"||N==="@"||N==="|"||!N)break;if(N===vs||N===Ln)if(L(C))I+=N,C.next();else{if(M(C))break;I+=N,C.next()}else I+=N,C.next()}return I}function He(C){g(C);let I="",N="";for(;I=K(C);)N+=I;return C.currentChar()===er&&f(At.UNTERMINATED_CLOSING_BRACE,r(),0),N}function re(C){g(C);let I="";return C.currentChar()==="-"?(C.next(),I+=`-${se(C)}`):I+=se(C),C.currentChar()===er&&f(At.UNTERMINATED_CLOSING_BRACE,r(),0),I}function ge(C){return C!==rM&&C!==Ln}function xe(C){g(C),p(C,"'");let I="",N="";for(;I=F(C,ge);)I==="\\"?N+=X(C):N+=I;const A=C.currentChar();return A===Ln||A===er?(f(At.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,r(),0),A===Ln&&(C.next(),p(C,"'")),N):(p(C,"'"),N)}function X(C){const I=C.currentChar();switch(I){case"\\":case"'":return C.next(),`\\${I}`;case"u":return ae(C,I,4);case"U":return ae(C,I,6);default:return f(At.UNKNOWN_ESCAPE_SEQUENCE,r(),0,I),""}}function ae(C,I,N){p(C,I);let A="";for(let w=0;w{const A=C.currentChar();return A==="{"||A==="@"||A==="|"||A==="("||A===")"||!A||A===vs?N:(N+=A,C.next(),I(N))};return I("")}function z(C){g(C);const I=p(C,"|");return g(C),I}function R(C,I){let N=null;switch(C.currentChar()){case"{":return I.braceNest>=1&&f(At.NOT_ALLOW_NEST_PLACEHOLDER,r(),0),C.next(),N=d(I,2,"{"),g(C),I.braceNest++,N;case"}":return I.braceNest>0&&I.currentType===2&&f(At.EMPTY_PLACEHOLDER,r(),0),C.next(),N=d(I,3,"}"),I.braceNest--,I.braceNest>0&&g(C),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),N;case"@":return I.braceNest>0&&f(At.UNTERMINATED_CLOSING_BRACE,r(),0),N=te(C,I)||h(I),I.braceNest=0,N;default:{let w=!0,U=!0,O=!0;if(M(C))return I.braceNest>0&&f(At.UNTERMINATED_CLOSING_BRACE,r(),0),N=d(I,1,z(C)),I.braceNest=0,I.inLinked=!1,N;if(I.braceNest>0&&(I.currentType===4||I.currentType===5||I.currentType===6))return f(At.UNTERMINATED_CLOSING_BRACE,r(),0),I.braceNest=0,G(C,I);if(w=b(C,I))return N=d(I,4,He(C)),g(C),N;if(U=v(C,I))return N=d(I,5,re(C)),g(C),N;if(O=T(C,I))return N=d(I,6,xe(C)),g(C),N;if(!w&&!U&&!O)return N=d(I,12,ce(C)),f(At.INVALID_TOKEN_IN_PLACEHOLDER,r(),0,N.value),g(C),N;break}}return N}function te(C,I){const{currentType:N}=I;let A=null;const w=C.currentChar();switch((N===7||N===8||N===11||N===9)&&(w===Ln||w===vs)&&f(At.INVALID_LINKED_FORMAT,r(),0),w){case"@":return C.next(),A=d(I,7,"@"),I.inLinked=!0,A;case".":return g(C),C.next(),d(I,8,".");case":":return g(C),C.next(),d(I,9,":");default:return M(C)?(A=d(I,1,z(C)),I.braceNest=0,I.inLinked=!1,A):E(C,I)||P(C,I)?(g(C),te(C,I)):S(C,I)?(g(C),d(I,11,Ue(C))):x(C,I)?(g(C),w==="{"?R(C,I)||A:d(I,10,k(C))):(N===7&&f(At.INVALID_LINKED_FORMAT,r(),0),I.braceNest=0,I.inLinked=!1,G(C,I))}}function G(C,I){let N={type:13};if(I.braceNest>0)return R(C,I)||h(I);if(I.inLinked)return te(C,I)||h(I);switch(C.currentChar()){case"{":return R(C,I)||h(I);case"}":return f(At.UNBALANCED_CLOSING_BRACE,r(),0),C.next(),d(I,3,"}");case"@":return te(C,I)||h(I);default:{if(M(C))return N=d(I,1,z(C)),I.braceNest=0,I.inLinked=!1,N;if(L(C))return d(I,0,ye(C));break}}return N}function W(){const{currentType:C,offset:I,startLoc:N,endLoc:A}=l;return l.lastType=C,l.lastOffset=I,l.lastStartLoc=N,l.lastEndLoc=A,l.offset=s(),l.startLoc=r(),i.currentChar()===er?d(l,13):G(i,l)}return{nextToken:W,currentOffset:s,currentPosition:r,context:c}}const l8="parser",c8=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function u8(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const i=parseInt(e||t,16);return i<=55295||i>=57344?String.fromCodePoint(i):"�"}}}function f8(n={}){const e=n.location!==!1,{onError:t}=n;function i(m,y,b,v,...T){const E=m.currentPosition();if(E.offset+=v,E.column+=v,t){const S=e?t0(b,E):null,P=np(y,S,{domain:l8,args:T});t(P)}}function s(m,y,b){const v={type:m};return e&&(v.start=y,v.end=y,v.loc={start:b,end:b}),v}function r(m,y,b,v){e&&(m.end=y,m.loc&&(m.loc.end=b))}function o(m,y){const b=m.context(),v=s(3,b.offset,b.startLoc);return v.value=y,r(v,m.currentOffset(),m.currentPosition()),v}function a(m,y){const b=m.context(),{lastOffset:v,lastStartLoc:T}=b,E=s(5,v,T);return E.index=parseInt(y,10),m.nextToken(),r(E,m.currentOffset(),m.currentPosition()),E}function l(m,y){const b=m.context(),{lastOffset:v,lastStartLoc:T}=b,E=s(4,v,T);return E.key=y,m.nextToken(),r(E,m.currentOffset(),m.currentPosition()),E}function c(m,y){const b=m.context(),{lastOffset:v,lastStartLoc:T}=b,E=s(9,v,T);return E.value=y.replace(c8,u8),m.nextToken(),r(E,m.currentOffset(),m.currentPosition()),E}function u(m){const y=m.nextToken(),b=m.context(),{lastOffset:v,lastStartLoc:T}=b,E=s(8,v,T);return y.type!==11?(i(m,At.UNEXPECTED_EMPTY_LINKED_MODIFIER,b.lastStartLoc,0),E.value="",r(E,v,T),{nextConsumeToken:y,node:E}):(y.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,Gi(y)),E.value=y.value||"",r(E,m.currentOffset(),m.currentPosition()),{node:E})}function f(m,y){const b=m.context(),v=s(7,b.offset,b.startLoc);return v.value=y,r(v,m.currentOffset(),m.currentPosition()),v}function d(m){const y=m.context(),b=s(6,y.offset,y.startLoc);let v=m.nextToken();if(v.type===8){const T=u(m);b.modifier=T.node,v=T.nextConsumeToken||m.nextToken()}switch(v.type!==9&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),v=m.nextToken(),v.type===2&&(v=m.nextToken()),v.type){case 10:v.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),b.key=f(m,v.value||"");break;case 4:v.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),b.key=l(m,v.value||"");break;case 5:v.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),b.key=a(m,v.value||"");break;case 6:v.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(v)),b.key=c(m,v.value||"");break;default:{i(m,At.UNEXPECTED_EMPTY_LINKED_KEY,y.lastStartLoc,0);const T=m.context(),E=s(7,T.offset,T.startLoc);return E.value="",r(E,T.offset,T.startLoc),b.key=E,r(b,T.offset,T.startLoc),{nextConsumeToken:v,node:b}}}return r(b,m.currentOffset(),m.currentPosition()),{node:b}}function h(m){const y=m.context(),b=y.currentType===1?m.currentOffset():y.offset,v=y.currentType===1?y.endLoc:y.startLoc,T=s(2,b,v);T.items=[];let E=null;do{const x=E||m.nextToken();switch(E=null,x.type){case 0:x.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(x)),T.items.push(o(m,x.value||""));break;case 5:x.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(x)),T.items.push(a(m,x.value||""));break;case 4:x.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(x)),T.items.push(l(m,x.value||""));break;case 6:x.value==null&&i(m,At.UNEXPECTED_LEXICAL_ANALYSIS,y.lastStartLoc,0,Gi(x)),T.items.push(c(m,x.value||""));break;case 7:{const M=d(m);T.items.push(M.node),E=M.nextConsumeToken||null;break}}}while(y.currentType!==13&&y.currentType!==1);const S=y.currentType===1?y.lastOffset:m.currentOffset(),P=y.currentType===1?y.lastEndLoc:m.currentPosition();return r(T,S,P),T}function p(m,y,b,v){const T=m.context();let E=v.items.length===0;const S=s(1,y,b);S.cases=[],S.cases.push(v);do{const P=h(m);E||(E=P.items.length===0),S.cases.push(P)}while(T.currentType!==13);return E&&i(m,At.MUST_HAVE_MESSAGES_IN_PLURAL,b,0),r(S,m.currentOffset(),m.currentPosition()),S}function _(m){const y=m.context(),{offset:b,startLoc:v}=y,T=h(m);return y.currentType===13?T:p(m,b,v,T)}function g(m){const y=a8(m,un({},n)),b=y.context(),v=s(0,b.offset,b.startLoc);return e&&v.loc&&(v.loc.source=m),v.body=_(y),n.onCacheKey&&(v.cacheKey=n.onCacheKey(m)),b.currentType!==13&&i(y,At.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,m[b.offset]||""),r(v,y.currentOffset(),y.currentPosition()),v}return{parse:g}}function Gi(n){if(n.type===13)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function d8(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:r=>(t.helpers.add(r),r)}}function oM(n,e){for(let t=0;taM(t)),n}function aM(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;to;function l(_,g){o.code+=_}function c(_,g=!0){const m=g?i:"";l(s?m+" ".repeat(_):m)}function u(_=!0){const g=++o.indentLevel;_&&c(g)}function f(_=!0){const g=--o.indentLevel;_&&c(g)}function d(){c(o.indentLevel)}return{context:a,push:l,indent:u,deindent:f,newline:d,helper:_=>`_${_}`,needIndent:()=>o.needIndent}}function g8(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),La(n,e.key),e.modifier?(n.push(", "),La(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function _8(n,e){const{helper:t,needIndent:i}=n;n.push(`${t("normalize")}([`),n.indent(i());const s=e.items.length;for(let r=0;r1){n.push(`${t("plural")}([`),n.indent(i());const s=e.cases.length;for(let r=0;r{const t=Ne(e.mode)?e.mode:"normal",i=Ne(e.filename)?e.filename:"message.intl";e.sourceMap;const s=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":` +`,r=e.needIndent?e.needIndent:t!=="arrow",o=n.helpers||[],a=m8(n,{filename:i,breakLineCode:s,needIndent:r});a.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),a.indent(r),o.length>0&&(a.push(`const { ${Z_(o.map(u=>`${u}: _${u}`),", ")} } = ctx`),a.newline()),a.push("return "),La(a,n),a.deindent(r),a.push("}"),delete n.helpers;const{code:l,map:c}=a.context();return{ast:n,code:l,map:c?c.toJSON():void 0}};function x8(n,e={}){const t=un({},e),i=!!t.jit,s=!!t.minify,r=t.optimize==null?!0:t.optimize,a=f8(t).parse(n);return i?(r&&p8(a),s&&ia(a),{ast:a,code:""}):(h8(a,t),b8(a,t))}/*! * core-base v11.1.3 * (c) 2025 kazuya kawaguchi * Released under the MIT License. - */function x8(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(j_().__INTLIFY_PROD_DEVTOOLS__=!1)}function ts(n){return yt(n)&&Q_(n)===0&&(Oi(n,"b")||Oi(n,"body"))}const MA=["b","body"];function M8(n){return Pr(n,MA)}const SA=["c","cases"];function S8(n){return Pr(n,SA,[])}const EA=["s","static"];function E8(n){return Pr(n,EA)}const TA=["i","items"];function T8(n){return Pr(n,TA,[])}const wA=["t","type"];function Q_(n){return Pr(n,wA)}const AA=["v","value"];function df(n,e){const t=Pr(n,AA);if(t!=null)return t;throw Sc(e)}const CA=["m","modifier"];function w8(n){return Pr(n,CA)}const RA=["k","key"];function A8(n){const e=Pr(n,RA);if(e)return e;throw Sc(6)}function Pr(n,e,t){for(let i=0;iC8(t,n)}function C8(n,e){const t=M8(e);if(t==null)throw Sc(0);if(Q_(t)===1){const r=S8(t);return n.plural(r.reduce((o,a)=>[...o,lM(n,a)],[]))}else return lM(n,t)}function lM(n,e){const t=E8(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const i=T8(e).reduce((s,r)=>[...s,n0(n,r)],[]);return n.normalize(i)}}function n0(n,e){const t=Q_(e);switch(t){case 3:return df(e,t);case 9:return df(e,t);case 4:{const i=e;if(Oi(i,"k")&&i.k)return n.interpolate(n.named(i.k));if(Oi(i,"key")&&i.key)return n.interpolate(n.named(i.key));throw Sc(t)}case 5:{const i=e;if(Oi(i,"i")&&Zt(i.i))return n.interpolate(n.list(i.i));if(Oi(i,"index")&&Zt(i.index))return n.interpolate(n.list(i.index));throw Sc(t)}case 6:{const i=e,s=w8(i),r=A8(i);return n.linked(n0(n,r),s?n0(n,s):void 0,n.type)}case 7:return df(e,t);case 8:return df(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const R8=n=>n;let hf=Rt();function P8(n,e={}){let t=!1;const i=e.onError||QH;return e.onError=s=>{t=!0,i(s)},{...b8(n,e),detectError:t}}function I8(n,e){if(Ne(n)){Bt(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||R8)(n),s=hf[i];if(s)return s;const{ast:r,detectError:o}=P8(n,{...e,location:!1,jit:!0}),a=Gm(r);return o?a:hf[i]=a}else{const t=n.cacheKey;if(t){const i=hf[t];return i||(hf[t]=Gm(n))}else return Gm(n)}}let Ec=null;function L8(n){Ec=n}function D8(n,e,t){Ec&&Ec.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const O8=N8("function:translate");function N8(n){return e=>Ec&&Ec.emit(n,e)}const As={INVALID_ARGUMENT:JH,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},U8=24;function Cs(n){return np(n,null,void 0)}function ev(n,e){return e.locale!=null?cM(e.locale):cM(n.locale)}let Wm;function cM(n){if(Ne(n))return n;if(kt(n)){if(n.resolvedOnce&&Wm!=null)return Wm;if(n.constructor.name==="Function"){const e=n();if(YH(e))throw Cs(As.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Wm=e}else throw Cs(As.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Cs(As.NOT_SUPPORT_LOCALE_TYPE)}function F8(n,e,t){return[...new Set([t,...tn(e)?e:yt(e)?Object.keys(e):Ne(e)?[e]:[t]])]}function IA(n,e,t){const i=Ne(t)?t:zd,s=n;s.__localeChainCache||(s.__localeChainCache=new Map);let r=s.__localeChainCache.get(i);if(!r){r=[];let o=[t];for(;tn(o);)o=uM(r,o,e);const a=tn(e)||!dt(e)?e:e.default?e.default:null;o=Ne(a)?[a]:a,tn(o)&&uM(r,o,!1),s.__localeChainCache.set(i,r)}return r}function uM(n,e,t){let i=!0;for(let s=0;s{o===void 0?o=a:o+=a},d[1]=()=>{o!==void 0&&(e.push(o),o=void 0)},d[2]=()=>{d[0](),s++},d[3]=()=>{if(s>0)s--,i=4,d[0]();else{if(s=0,o===void 0||(o=W8(o),o===!1))return!1;d[1]()}};function h(){const p=n[t+1];if(i===5&&p==="'"||i===6&&p==='"')return t++,a="\\"+p,d[0](),!0}for(;i!==null;)if(t++,r=n[t],!(r==="\\"&&h())){if(l=G8(r),f=Ir[i],c=f[l]||f.l||8,c===8||(i=c[0],c[1]!==void 0&&(u=d[c[1]],u&&(a=r,u()===!1))))return;if(i===7)return e}}const fM=new Map;function $8(n,e){return yt(n)?n[e]:null}function q8(n,e){if(!yt(n))return null;let t=fM.get(e);if(t||(t=X8(e),t&&fM.set(e,t)),!t)return null;const i=t.length;let s=n,r=0;for(;r`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function j8(){return{upper:(n,e)=>e==="text"&&Ne(n)?n.toUpperCase():e==="vnode"&&yt(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&Ne(n)?n.toLowerCase():e==="vnode"&&yt(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&Ne(n)?hM(n):e==="vnode"&&yt(n)&&"__v_isVNode"in n?hM(n.children):n}}let LA;function K8(n){LA=n}let DA;function Z8(n){DA=n}let OA;function J8(n){OA=n}let NA=null;const Q8=n=>{NA=n},e9=()=>NA;let UA=null;const pM=n=>{UA=n},t9=()=>UA;let mM=0;function n9(n={}){const e=kt(n.onWarn)?n.onWarn:KH,t=Ne(n.version)?n.version:Y8,i=Ne(n.locale)||kt(n.locale)?n.locale:zd,s=kt(i)?zd:i,r=tn(n.fallbackLocale)||dt(n.fallbackLocale)||Ne(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:s,o=dt(n.messages)?n.messages:Xm(s),a=dt(n.datetimeFormats)?n.datetimeFormats:Xm(s),l=dt(n.numberFormats)?n.numberFormats:Xm(s),c=un(Rt(),n.modifiers,j8()),u=n.pluralRules||Rt(),f=kt(n.missing)?n.missing:null,d=Bt(n.missingWarn)||Bd(n.missingWarn)?n.missingWarn:!0,h=Bt(n.fallbackWarn)||Bd(n.fallbackWarn)?n.fallbackWarn:!0,p=!!n.fallbackFormat,_=!!n.unresolving,g=kt(n.postTranslation)?n.postTranslation:null,m=dt(n.processor)?n.processor:null,y=Bt(n.warnHtmlMessage)?n.warnHtmlMessage:!0,b=!!n.escapeParameter,v=kt(n.messageCompiler)?n.messageCompiler:LA,T=kt(n.messageResolver)?n.messageResolver:DA||$8,E=kt(n.localeFallbacker)?n.localeFallbacker:OA||F8,S=yt(n.fallbackContext)?n.fallbackContext:void 0,P=n,x=yt(P.__datetimeFormatters)?P.__datetimeFormatters:new Map,M=yt(P.__numberFormatters)?P.__numberFormatters:new Map,L=yt(P.__meta)?P.__meta:{};mM++;const F={version:t,cid:mM,locale:i,fallbackLocale:r,messages:o,modifiers:c,pluralRules:u,missing:f,missingWarn:d,fallbackWarn:h,fallbackFormat:p,unresolving:_,postTranslation:g,processor:m,warnHtmlMessage:y,escapeParameter:b,messageCompiler:v,messageResolver:T,localeFallbacker:E,fallbackContext:S,onWarn:e,__meta:L};return F.datetimeFormats=a,F.numberFormats=l,F.__datetimeFormatters=x,F.__numberFormatters=M,__INTLIFY_PROD_DEVTOOLS__&&D8(F,t,L),F}const Xm=n=>({[n]:Rt()});function tv(n,e,t,i,s){const{missing:r,onWarn:o}=n;if(r!==null){const a=r(n,t,e,s);return Ne(a)?a:e}else return e}function ul(n,e,t){const i=n;i.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function i9(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function s9(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let i=t+1;i{FA.includes(l)?o[l]=t[l]:r[l]=t[l]}),Ne(i)?r.locale=i:dt(i)&&(o=i),dt(s)&&(o=s),[r.key||"",a,r,o]}function _M(n,e,t){const i=n;for(const s in t){const r=`${e}__${s}`;i.__datetimeFormatters.has(r)&&i.__datetimeFormatters.delete(r)}}function vM(n,...e){const{numberFormats:t,unresolving:i,fallbackLocale:s,onWarn:r,localeFallbacker:o}=n,{__numberFormatters:a}=n,[l,c,u,f]=s0(...e),d=Bt(u.missingWarn)?u.missingWarn:n.missingWarn;Bt(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,p=ev(n,u),_=o(n,s,p);if(!Ne(l)||l==="")return new Intl.NumberFormat(p,f).format(c);let g={},m,y=null;const b="number format";for(let E=0;E<_.length&&(m=_[E],g=t[m]||{},y=g[l],!dt(y));E++)tv(n,l,m,d,b);if(!dt(y)||!Ne(m))return i?ip:l;let v=`${m}__${l}`;tp(f)||(v=`${v}__${JSON.stringify(f)}`);let T=a.get(v);return T||(T=new Intl.NumberFormat(m,un({},y,f)),a.set(v,T)),h?T.formatToParts(c):T.format(c)}const kA=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function s0(...n){const[e,t,i,s]=n,r=Rt();let o=Rt();if(!Zt(e))throw Cs(As.INVALID_ARGUMENT);const a=e;return Ne(t)?r.key=t:dt(t)&&Object.keys(t).forEach(l=>{kA.includes(l)?o[l]=t[l]:r[l]=t[l]}),Ne(i)?r.locale=i:dt(i)&&(o=i),dt(s)&&(o=s),[r.key||"",a,r,o]}function yM(n,e,t){const i=n;for(const s in t){const r=`${e}__${s}`;i.__numberFormatters.has(r)&&i.__numberFormatters.delete(r)}}const r9=n=>n,o9=n=>"",a9="text",l9=n=>n.length===0?"":Z_(n),c9=jH;function bM(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function u9(n){const e=Zt(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(Zt(n.named.count)||Zt(n.named.n))?Zt(n.named.count)?n.named.count:Zt(n.named.n)?n.named.n:e:e}function f9(n,e){e.count||(e.count=n),e.n||(e.n=n)}function d9(n={}){const e=n.locale,t=u9(n),i=yt(n.pluralRules)&&Ne(e)&&kt(n.pluralRules[e])?n.pluralRules[e]:bM,s=yt(n.pluralRules)&&Ne(e)&&kt(n.pluralRules[e])?bM:void 0,r=m=>m[i(t,m.length,s)],o=n.list||[],a=m=>o[m],l=n.named||Rt();Zt(n.pluralIndex)&&f9(t,l);const c=m=>l[m];function u(m,y){const b=kt(n.messages)?n.messages(m,!!y):yt(n.messages)?n.messages[m]:!1;return b||(n.parent?n.parent.message(m):o9)}const f=m=>n.modifiers?n.modifiers[m]:r9,d=dt(n.processor)&&kt(n.processor.normalize)?n.processor.normalize:l9,h=dt(n.processor)&&kt(n.processor.interpolate)?n.processor.interpolate:c9,p=dt(n.processor)&&Ne(n.processor.type)?n.processor.type:a9,g={list:a,named:c,plural:r,linked:(m,...y)=>{const[b,v]=y;let T="text",E="";y.length===1?yt(b)?(E=b.modifier||E,T=b.type||T):Ne(b)&&(E=b||E):y.length===2&&(Ne(b)&&(E=b||E),Ne(v)&&(T=v||T));const S=u(m,!0)(g),P=T==="vnode"&&tn(S)&&E?S[0]:S;return E?f(E)(P,T):P},message:u,type:p,interpolate:h,normalize:d,values:un(Rt(),o,l)};return g}const xM=()=>"",mi=n=>kt(n);function MM(n,...e){const{fallbackFormat:t,postTranslation:i,unresolving:s,messageCompiler:r,fallbackLocale:o,messages:a}=n,[l,c]=r0(...e),u=Bt(c.missingWarn)?c.missingWarn:n.missingWarn,f=Bt(c.fallbackWarn)?c.fallbackWarn:n.fallbackWarn,d=Bt(c.escapeParameter)?c.escapeParameter:n.escapeParameter,h=!!c.resolvedMessage,p=Ne(c.default)||Bt(c.default)?Bt(c.default)?r?l:()=>l:c.default:t?r?l:()=>l:null,_=t||p!=null&&(Ne(p)||kt(p)),g=ev(n,c);d&&h9(c);let[m,y,b]=h?[l,g,a[g]||Rt()]:BA(n,l,g,o,f,u),v=m,T=l;if(!h&&!(Ne(v)||ts(v)||mi(v))&&_&&(v=p,T=v),!h&&(!(Ne(v)||ts(v)||mi(v))||!Ne(y)))return s?ip:l;let E=!1;const S=()=>{E=!0},P=mi(v)?v:zA(n,l,y,v,T,S);if(E)return v;const x=g9(n,y,b,c),M=d9(x),L=p9(n,P,M),F=i?i(L,l):L;if(__INTLIFY_PROD_DEVTOOLS__){const H={timestamp:Date.now(),key:Ne(l)?l:mi(v)?v.key:"",locale:y||(mi(v)?v.locale:""),format:Ne(v)?v:mi(v)?v.source:"",message:F};H.meta=un({},n.__meta,e9()||{}),O8(H)}return F}function h9(n){tn(n.list)?n.list=n.list.map(e=>Ne(e)?sM(e):e):yt(n.named)&&Object.keys(n.named).forEach(e=>{Ne(n.named[e])&&(n.named[e]=sM(n.named[e]))})}function BA(n,e,t,i,s,r){const{messages:o,onWarn:a,messageResolver:l,localeFallbacker:c}=n,u=c(n,i,t);let f=Rt(),d,h=null;const p="translate";for(let _=0;_i;return c.locale=t,c.key=e,c}const l=o(i,m9(n,t,s,i,a,r));return l.locale=t,l.key=e,l.source=i,l}function p9(n,e,t){return e(t)}function r0(...n){const[e,t,i]=n,s=Rt();if(!Ne(e)&&!Zt(e)&&!mi(e)&&!ts(e))throw Cs(As.INVALID_ARGUMENT);const r=Zt(e)?String(e):(mi(e),e);return Zt(t)?s.plural=t:Ne(t)?s.default=t:dt(t)&&!tp(t)?s.named=t:tn(t)&&(s.list=t),Zt(i)?s.plural=i:Ne(i)?s.default=i:dt(i)&&un(s,i),[r,s]}function m9(n,e,t,i,s,r){return{locale:e,key:t,warnHtmlMessage:s,onError:o=>{throw r&&r(o),o},onCacheKey:o=>GH(e,t,o)}}function g9(n,e,t,i){const{modifiers:s,pluralRules:r,messageResolver:o,fallbackLocale:a,fallbackWarn:l,missingWarn:c,fallbackContext:u}=n,d={locale:e,modifiers:s,pluralRules:r,messages:(h,p)=>{let _=o(t,h);if(_==null&&(u||p)){const[,,g]=BA(u||n,h,e,a,l,c);_=o(g,h)}if(Ne(_)||ts(_)){let g=!1;const y=zA(n,h,e,_,h,()=>{g=!0});return g?xM:y}else return mi(_)?_:xM}};return n.processor&&(d.processor=n.processor),i.list&&(d.list=i.list),i.named&&(d.named=i.named),Zt(i.plural)&&(d.pluralIndex=i.plural),d}x8();/*! + */function M8(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(j_().__INTLIFY_PROD_DEVTOOLS__=!1)}function ts(n){return yt(n)&&Q_(n)===0&&(Di(n,"b")||Di(n,"body"))}const SA=["b","body"];function S8(n){return Pr(n,SA)}const EA=["c","cases"];function E8(n){return Pr(n,EA,[])}const TA=["s","static"];function T8(n){return Pr(n,TA)}const wA=["i","items"];function w8(n){return Pr(n,wA,[])}const AA=["t","type"];function Q_(n){return Pr(n,AA)}const CA=["v","value"];function df(n,e){const t=Pr(n,CA);if(t!=null)return t;throw Sc(e)}const RA=["m","modifier"];function A8(n){return Pr(n,RA)}const PA=["k","key"];function C8(n){const e=Pr(n,PA);if(e)return e;throw Sc(6)}function Pr(n,e,t){for(let i=0;iR8(t,n)}function R8(n,e){const t=S8(e);if(t==null)throw Sc(0);if(Q_(t)===1){const r=E8(t);return n.plural(r.reduce((o,a)=>[...o,lM(n,a)],[]))}else return lM(n,t)}function lM(n,e){const t=T8(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const i=w8(e).reduce((s,r)=>[...s,n0(n,r)],[]);return n.normalize(i)}}function n0(n,e){const t=Q_(e);switch(t){case 3:return df(e,t);case 9:return df(e,t);case 4:{const i=e;if(Di(i,"k")&&i.k)return n.interpolate(n.named(i.k));if(Di(i,"key")&&i.key)return n.interpolate(n.named(i.key));throw Sc(t)}case 5:{const i=e;if(Di(i,"i")&&Zt(i.i))return n.interpolate(n.list(i.i));if(Di(i,"index")&&Zt(i.index))return n.interpolate(n.list(i.index));throw Sc(t)}case 6:{const i=e,s=A8(i),r=C8(i);return n.linked(n0(n,r),s?n0(n,s):void 0,n.type)}case 7:return df(e,t);case 8:return df(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const P8=n=>n;let hf=Rt();function I8(n,e={}){let t=!1;const i=e.onError||e8;return e.onError=s=>{t=!0,i(s)},{...x8(n,e),detectError:t}}function L8(n,e){if(Ne(n)){Bt(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||P8)(n),s=hf[i];if(s)return s;const{ast:r,detectError:o}=I8(n,{...e,location:!1,jit:!0}),a=Gm(r);return o?a:hf[i]=a}else{const t=n.cacheKey;if(t){const i=hf[t];return i||(hf[t]=Gm(n))}else return Gm(n)}}let Ec=null;function D8(n){Ec=n}function O8(n,e,t){Ec&&Ec.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const N8=U8("function:translate");function U8(n){return e=>Ec&&Ec.emit(n,e)}const As={INVALID_ARGUMENT:QH,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},F8=24;function Cs(n){return np(n,null,void 0)}function ev(n,e){return e.locale!=null?cM(e.locale):cM(n.locale)}let Wm;function cM(n){if(Ne(n))return n;if(kt(n)){if(n.resolvedOnce&&Wm!=null)return Wm;if(n.constructor.name==="Function"){const e=n();if(jH(e))throw Cs(As.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Wm=e}else throw Cs(As.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Cs(As.NOT_SUPPORT_LOCALE_TYPE)}function k8(n,e,t){return[...new Set([t,...tn(e)?e:yt(e)?Object.keys(e):Ne(e)?[e]:[t]])]}function LA(n,e,t){const i=Ne(t)?t:zd,s=n;s.__localeChainCache||(s.__localeChainCache=new Map);let r=s.__localeChainCache.get(i);if(!r){r=[];let o=[t];for(;tn(o);)o=uM(r,o,e);const a=tn(e)||!dt(e)?e:e.default?e.default:null;o=Ne(a)?[a]:a,tn(o)&&uM(r,o,!1),s.__localeChainCache.set(i,r)}return r}function uM(n,e,t){let i=!0;for(let s=0;s{o===void 0?o=a:o+=a},d[1]=()=>{o!==void 0&&(e.push(o),o=void 0)},d[2]=()=>{d[0](),s++},d[3]=()=>{if(s>0)s--,i=4,d[0]();else{if(s=0,o===void 0||(o=X8(o),o===!1))return!1;d[1]()}};function h(){const p=n[t+1];if(i===5&&p==="'"||i===6&&p==='"')return t++,a="\\"+p,d[0](),!0}for(;i!==null;)if(t++,r=n[t],!(r==="\\"&&h())){if(l=W8(r),f=Ir[i],c=f[l]||f.l||8,c===8||(i=c[0],c[1]!==void 0&&(u=d[c[1]],u&&(a=r,u()===!1))))return;if(i===7)return e}}const fM=new Map;function q8(n,e){return yt(n)?n[e]:null}function Y8(n,e){if(!yt(n))return null;let t=fM.get(e);if(t||(t=$8(e),t&&fM.set(e,t)),!t)return null;const i=t.length;let s=n,r=0;for(;r`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function K8(){return{upper:(n,e)=>e==="text"&&Ne(n)?n.toUpperCase():e==="vnode"&&yt(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&Ne(n)?n.toLowerCase():e==="vnode"&&yt(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&Ne(n)?hM(n):e==="vnode"&&yt(n)&&"__v_isVNode"in n?hM(n.children):n}}let DA;function Z8(n){DA=n}let OA;function J8(n){OA=n}let NA;function Q8(n){NA=n}let UA=null;const e9=n=>{UA=n},t9=()=>UA;let FA=null;const pM=n=>{FA=n},n9=()=>FA;let mM=0;function i9(n={}){const e=kt(n.onWarn)?n.onWarn:ZH,t=Ne(n.version)?n.version:j8,i=Ne(n.locale)||kt(n.locale)?n.locale:zd,s=kt(i)?zd:i,r=tn(n.fallbackLocale)||dt(n.fallbackLocale)||Ne(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:s,o=dt(n.messages)?n.messages:Xm(s),a=dt(n.datetimeFormats)?n.datetimeFormats:Xm(s),l=dt(n.numberFormats)?n.numberFormats:Xm(s),c=un(Rt(),n.modifiers,K8()),u=n.pluralRules||Rt(),f=kt(n.missing)?n.missing:null,d=Bt(n.missingWarn)||Bd(n.missingWarn)?n.missingWarn:!0,h=Bt(n.fallbackWarn)||Bd(n.fallbackWarn)?n.fallbackWarn:!0,p=!!n.fallbackFormat,_=!!n.unresolving,g=kt(n.postTranslation)?n.postTranslation:null,m=dt(n.processor)?n.processor:null,y=Bt(n.warnHtmlMessage)?n.warnHtmlMessage:!0,b=!!n.escapeParameter,v=kt(n.messageCompiler)?n.messageCompiler:DA,T=kt(n.messageResolver)?n.messageResolver:OA||q8,E=kt(n.localeFallbacker)?n.localeFallbacker:NA||k8,S=yt(n.fallbackContext)?n.fallbackContext:void 0,P=n,x=yt(P.__datetimeFormatters)?P.__datetimeFormatters:new Map,M=yt(P.__numberFormatters)?P.__numberFormatters:new Map,L=yt(P.__meta)?P.__meta:{};mM++;const F={version:t,cid:mM,locale:i,fallbackLocale:r,messages:o,modifiers:c,pluralRules:u,missing:f,missingWarn:d,fallbackWarn:h,fallbackFormat:p,unresolving:_,postTranslation:g,processor:m,warnHtmlMessage:y,escapeParameter:b,messageCompiler:v,messageResolver:T,localeFallbacker:E,fallbackContext:S,onWarn:e,__meta:L};return F.datetimeFormats=a,F.numberFormats=l,F.__datetimeFormatters=x,F.__numberFormatters=M,__INTLIFY_PROD_DEVTOOLS__&&O8(F,t,L),F}const Xm=n=>({[n]:Rt()});function tv(n,e,t,i,s){const{missing:r,onWarn:o}=n;if(r!==null){const a=r(n,t,e,s);return Ne(a)?a:e}else return e}function ul(n,e,t){const i=n;i.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function s9(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function r9(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let i=t+1;i{kA.includes(l)?o[l]=t[l]:r[l]=t[l]}),Ne(i)?r.locale=i:dt(i)&&(o=i),dt(s)&&(o=s),[r.key||"",a,r,o]}function _M(n,e,t){const i=n;for(const s in t){const r=`${e}__${s}`;i.__datetimeFormatters.has(r)&&i.__datetimeFormatters.delete(r)}}function vM(n,...e){const{numberFormats:t,unresolving:i,fallbackLocale:s,onWarn:r,localeFallbacker:o}=n,{__numberFormatters:a}=n,[l,c,u,f]=s0(...e),d=Bt(u.missingWarn)?u.missingWarn:n.missingWarn;Bt(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const h=!!u.part,p=ev(n,u),_=o(n,s,p);if(!Ne(l)||l==="")return new Intl.NumberFormat(p,f).format(c);let g={},m,y=null;const b="number format";for(let E=0;E<_.length&&(m=_[E],g=t[m]||{},y=g[l],!dt(y));E++)tv(n,l,m,d,b);if(!dt(y)||!Ne(m))return i?ip:l;let v=`${m}__${l}`;tp(f)||(v=`${v}__${JSON.stringify(f)}`);let T=a.get(v);return T||(T=new Intl.NumberFormat(m,un({},y,f)),a.set(v,T)),h?T.formatToParts(c):T.format(c)}const BA=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function s0(...n){const[e,t,i,s]=n,r=Rt();let o=Rt();if(!Zt(e))throw Cs(As.INVALID_ARGUMENT);const a=e;return Ne(t)?r.key=t:dt(t)&&Object.keys(t).forEach(l=>{BA.includes(l)?o[l]=t[l]:r[l]=t[l]}),Ne(i)?r.locale=i:dt(i)&&(o=i),dt(s)&&(o=s),[r.key||"",a,r,o]}function yM(n,e,t){const i=n;for(const s in t){const r=`${e}__${s}`;i.__numberFormatters.has(r)&&i.__numberFormatters.delete(r)}}const o9=n=>n,a9=n=>"",l9="text",c9=n=>n.length===0?"":Z_(n),u9=KH;function bM(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function f9(n){const e=Zt(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(Zt(n.named.count)||Zt(n.named.n))?Zt(n.named.count)?n.named.count:Zt(n.named.n)?n.named.n:e:e}function d9(n,e){e.count||(e.count=n),e.n||(e.n=n)}function h9(n={}){const e=n.locale,t=f9(n),i=yt(n.pluralRules)&&Ne(e)&&kt(n.pluralRules[e])?n.pluralRules[e]:bM,s=yt(n.pluralRules)&&Ne(e)&&kt(n.pluralRules[e])?bM:void 0,r=m=>m[i(t,m.length,s)],o=n.list||[],a=m=>o[m],l=n.named||Rt();Zt(n.pluralIndex)&&d9(t,l);const c=m=>l[m];function u(m,y){const b=kt(n.messages)?n.messages(m,!!y):yt(n.messages)?n.messages[m]:!1;return b||(n.parent?n.parent.message(m):a9)}const f=m=>n.modifiers?n.modifiers[m]:o9,d=dt(n.processor)&&kt(n.processor.normalize)?n.processor.normalize:c9,h=dt(n.processor)&&kt(n.processor.interpolate)?n.processor.interpolate:u9,p=dt(n.processor)&&Ne(n.processor.type)?n.processor.type:l9,g={list:a,named:c,plural:r,linked:(m,...y)=>{const[b,v]=y;let T="text",E="";y.length===1?yt(b)?(E=b.modifier||E,T=b.type||T):Ne(b)&&(E=b||E):y.length===2&&(Ne(b)&&(E=b||E),Ne(v)&&(T=v||T));const S=u(m,!0)(g),P=T==="vnode"&&tn(S)&&E?S[0]:S;return E?f(E)(P,T):P},message:u,type:p,interpolate:h,normalize:d,values:un(Rt(),o,l)};return g}const xM=()=>"",mi=n=>kt(n);function MM(n,...e){const{fallbackFormat:t,postTranslation:i,unresolving:s,messageCompiler:r,fallbackLocale:o,messages:a}=n,[l,c]=r0(...e),u=Bt(c.missingWarn)?c.missingWarn:n.missingWarn,f=Bt(c.fallbackWarn)?c.fallbackWarn:n.fallbackWarn,d=Bt(c.escapeParameter)?c.escapeParameter:n.escapeParameter,h=!!c.resolvedMessage,p=Ne(c.default)||Bt(c.default)?Bt(c.default)?r?l:()=>l:c.default:t?r?l:()=>l:null,_=t||p!=null&&(Ne(p)||kt(p)),g=ev(n,c);d&&p9(c);let[m,y,b]=h?[l,g,a[g]||Rt()]:zA(n,l,g,o,f,u),v=m,T=l;if(!h&&!(Ne(v)||ts(v)||mi(v))&&_&&(v=p,T=v),!h&&(!(Ne(v)||ts(v)||mi(v))||!Ne(y)))return s?ip:l;let E=!1;const S=()=>{E=!0},P=mi(v)?v:VA(n,l,y,v,T,S);if(E)return v;const x=_9(n,y,b,c),M=h9(x),L=m9(n,P,M),F=i?i(L,l):L;if(__INTLIFY_PROD_DEVTOOLS__){const H={timestamp:Date.now(),key:Ne(l)?l:mi(v)?v.key:"",locale:y||(mi(v)?v.locale:""),format:Ne(v)?v:mi(v)?v.source:"",message:F};H.meta=un({},n.__meta,t9()||{}),N8(H)}return F}function p9(n){tn(n.list)?n.list=n.list.map(e=>Ne(e)?sM(e):e):yt(n.named)&&Object.keys(n.named).forEach(e=>{Ne(n.named[e])&&(n.named[e]=sM(n.named[e]))})}function zA(n,e,t,i,s,r){const{messages:o,onWarn:a,messageResolver:l,localeFallbacker:c}=n,u=c(n,i,t);let f=Rt(),d,h=null;const p="translate";for(let _=0;_i;return c.locale=t,c.key=e,c}const l=o(i,g9(n,t,s,i,a,r));return l.locale=t,l.key=e,l.source=i,l}function m9(n,e,t){return e(t)}function r0(...n){const[e,t,i]=n,s=Rt();if(!Ne(e)&&!Zt(e)&&!mi(e)&&!ts(e))throw Cs(As.INVALID_ARGUMENT);const r=Zt(e)?String(e):(mi(e),e);return Zt(t)?s.plural=t:Ne(t)?s.default=t:dt(t)&&!tp(t)?s.named=t:tn(t)&&(s.list=t),Zt(i)?s.plural=i:Ne(i)?s.default=i:dt(i)&&un(s,i),[r,s]}function g9(n,e,t,i,s,r){return{locale:e,key:t,warnHtmlMessage:s,onError:o=>{throw r&&r(o),o},onCacheKey:o=>WH(e,t,o)}}function _9(n,e,t,i){const{modifiers:s,pluralRules:r,messageResolver:o,fallbackLocale:a,fallbackWarn:l,missingWarn:c,fallbackContext:u}=n,d={locale:e,modifiers:s,pluralRules:r,messages:(h,p)=>{let _=o(t,h);if(_==null&&(u||p)){const[,,g]=zA(u||n,h,e,a,l,c);_=o(g,h)}if(Ne(_)||ts(_)){let g=!1;const y=VA(n,h,e,_,h,()=>{g=!0});return g?xM:y}else return mi(_)?_:xM}};return n.processor&&(d.processor=n.processor),i.list&&(d.list=i.list),i.named&&(d.named=i.named),Zt(i.plural)&&(d.pluralIndex=i.plural),d}M8();/*! * vue-i18n v11.1.3 * (c) 2025 kazuya kawaguchi * Released under the MIT License. - */const _9="11.1.3";function v9(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(j_().__INTLIFY_PROD_DEVTOOLS__=!1)}const Mi={UNEXPECTED_RETURN_TYPE:U8,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32};function zi(n,...e){return np(n,null,void 0)}const o0=Rr("__translateVNode"),a0=Rr("__datetimeParts"),l0=Rr("__numberParts"),y9=Rr("__setPluralRules"),b9=Rr("__injectWithOption"),c0=Rr("__dispose");function Tc(n){if(!yt(n)||ts(n))return n;for(const e in n)if(Oi(n,e))if(!e.includes("."))yt(n[e])&&Tc(n[e]);else{const t=e.split("."),i=t.length-1;let s=n,r=!1;for(let o=0;o{if("locale"in a&&"resource"in a){const{locale:l,resource:c}=a;l?(o[l]=o[l]||Rt(),Pf(c,o[l])):Pf(c,o)}else Ne(a)&&Pf(JSON.parse(a),o)}),s==null&&r)for(const a in o)Oi(o,a)&&Tc(o[a]);return o}function HA(n){return n.type}function x9(n,e,t){let i=yt(e.messages)?e.messages:Rt();"__i18nGlobal"in t&&(i=VA(n.locale.value,{messages:i,__i18n:t.__i18nGlobal}));const s=Object.keys(i);s.length&&s.forEach(r=>{n.mergeLocaleMessage(r,i[r])});{if(yt(e.datetimeFormats)){const r=Object.keys(e.datetimeFormats);r.length&&r.forEach(o=>{n.mergeDateTimeFormat(o,e.datetimeFormats[o])})}if(yt(e.numberFormats)){const r=Object.keys(e.numberFormats);r.length&&r.forEach(o=>{n.mergeNumberFormat(o,e.numberFormats[o])})}}}function SM(n){return pn(Ic,null,n,0)}const EM="__INTLIFY_META__",TM=()=>[],M9=()=>!1;let wM=0;function AM(n){return(e,t,i,s)=>n(t,i,wn()||void 0,s)}const S9=()=>{const n=wn();let e=null;return n&&(e=HA(n)[EM])?{[EM]:e}:null};function GA(n={}){const{__root:e,__injectWithOption:t}=n,i=e===void 0,s=n.flatJson,r=kd?et:De;let o=Bt(n.inheritLocale)?n.inheritLocale:!0;const a=r(e&&o?e.locale.value:Ne(n.locale)?n.locale:zd),l=r(e&&o?e.fallbackLocale.value:Ne(n.fallbackLocale)||tn(n.fallbackLocale)||dt(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:a.value),c=r(VA(a.value,n)),u=r(dt(n.datetimeFormats)?n.datetimeFormats:{[a.value]:{}}),f=r(dt(n.numberFormats)?n.numberFormats:{[a.value]:{}});let d=e?e.missingWarn:Bt(n.missingWarn)||Bd(n.missingWarn)?n.missingWarn:!0,h=e?e.fallbackWarn:Bt(n.fallbackWarn)||Bd(n.fallbackWarn)?n.fallbackWarn:!0,p=e?e.fallbackRoot:Bt(n.fallbackRoot)?n.fallbackRoot:!0,_=!!n.fallbackFormat,g=kt(n.missing)?n.missing:null,m=kt(n.missing)?AM(n.missing):null,y=kt(n.postTranslation)?n.postTranslation:null,b=e?e.warnHtmlMessage:Bt(n.warnHtmlMessage)?n.warnHtmlMessage:!0,v=!!n.escapeParameter;const T=e?e.modifiers:dt(n.modifiers)?n.modifiers:{};let E=n.pluralRules||e&&e.pluralRules,S;S=(()=>{i&&pM(null);const O={version:_9,locale:a.value,fallbackLocale:l.value,messages:c.value,modifiers:T,pluralRules:E,missing:m===null?void 0:m,missingWarn:d,fallbackWarn:h,fallbackFormat:_,unresolving:!0,postTranslation:y===null?void 0:y,warnHtmlMessage:b,escapeParameter:v,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};O.datetimeFormats=u.value,O.numberFormats=f.value,O.__datetimeFormatters=dt(S)?S.__datetimeFormatters:void 0,O.__numberFormatters=dt(S)?S.__numberFormatters:void 0;const V=n9(O);return i&&pM(V),V})(),ul(S,a.value,l.value);function x(){return[a.value,l.value,c.value,u.value,f.value]}const M=Ee({get:()=>a.value,set:O=>{S.locale=O,a.value=O}}),L=Ee({get:()=>l.value,set:O=>{S.fallbackLocale=O,l.value=O,ul(S,a.value,O)}}),F=Ee(()=>c.value),H=Ee(()=>u.value),Y=Ee(()=>f.value);function ee(){return kt(y)?y:null}function K(O){y=O,S.postTranslation=O}function Q(){return g}function Z(O){O!==null&&(m=AM(O)),g=O,S.missing=m}const he=(O,V,$,ue,le,Me)=>{x();let Be;try{__INTLIFY_PROD_DEVTOOLS__,i||(S.fallbackContext=e?t9():void 0),Be=O(S)}finally{__INTLIFY_PROD_DEVTOOLS__,i||(S.fallbackContext=void 0)}if($!=="translate exists"&&Zt(Be)&&Be===ip||$==="translate exists"&&!Be){const[me,Te]=V();return e&&p?ue(e):le(me)}else{if(Me(Be))return Be;throw zi(Mi.UNEXPECTED_RETURN_TYPE)}};function be(...O){return he(V=>Reflect.apply(MM,null,[V,...O]),()=>r0(...O),"translate",V=>Reflect.apply(V.t,V,[...O]),V=>V,V=>Ne(V))}function se(...O){const[V,$,ue]=O;if(ue&&!yt(ue))throw zi(Mi.INVALID_ARGUMENT);return be(V,$,un({resolvedMessage:!0},ue||{}))}function ye(...O){return he(V=>Reflect.apply(gM,null,[V,...O]),()=>i0(...O),"datetime format",V=>Reflect.apply(V.d,V,[...O]),()=>dM,V=>Ne(V))}function He(...O){return he(V=>Reflect.apply(vM,null,[V,...O]),()=>s0(...O),"number format",V=>Reflect.apply(V.n,V,[...O]),()=>dM,V=>Ne(V))}function re(O){return O.map(V=>Ne(V)||Zt(V)||Bt(V)?SM(String(V)):V)}const xe={normalize:re,interpolate:O=>O,type:"vnode"};function X(...O){return he(V=>{let $;const ue=V;try{ue.processor=xe,$=Reflect.apply(MM,null,[ue,...O])}finally{ue.processor=null}return $},()=>r0(...O),"translate",V=>V[o0](...O),V=>[SM(V)],V=>tn(V))}function ae(...O){return he(V=>Reflect.apply(vM,null,[V,...O]),()=>s0(...O),"number format",V=>V[l0](...O),TM,V=>Ne(V)||tn(V))}function fe(...O){return he(V=>Reflect.apply(gM,null,[V,...O]),()=>i0(...O),"datetime format",V=>V[a0](...O),TM,V=>Ne(V)||tn(V))}function ce(O){E=O,S.pluralRules=E}function Ue(O,V){return he(()=>{if(!O)return!1;const $=Ne(V)?V:a.value,ue=R($),le=S.messageResolver(ue,O);return ts(le)||mi(le)||Ne(le)},()=>[O],"translate exists",$=>Reflect.apply($.te,$,[O,V]),M9,$=>Bt($))}function k(O){let V=null;const $=IA(S,l.value,a.value);for(let ue=0;ue<$.length;ue++){const le=c.value[$[ue]]||{},Me=S.messageResolver(le,O);if(Me!=null){V=Me;break}}return V}function z(O){const V=k(O);return V??(e?e.tm(O)||{}:{})}function R(O){return c.value[O]||{}}function te(O,V){if(s){const $={[O]:V};for(const ue in $)Oi($,ue)&&Tc($[ue]);V=$[O]}c.value[O]=V,S.messages=c.value}function G(O,V){c.value[O]=c.value[O]||{};const $={[O]:V};if(s)for(const ue in $)Oi($,ue)&&Tc($[ue]);V=$[O],Pf(V,c.value[O]),S.messages=c.value}function W(O){return u.value[O]||{}}function C(O,V){u.value[O]=V,S.datetimeFormats=u.value,_M(S,O,V)}function I(O,V){u.value[O]=un(u.value[O]||{},V),S.datetimeFormats=u.value,_M(S,O,V)}function N(O){return f.value[O]||{}}function A(O,V){f.value[O]=V,S.numberFormats=f.value,yM(S,O,V)}function w(O,V){f.value[O]=un(f.value[O]||{},V),S.numberFormats=f.value,yM(S,O,V)}wM++,e&&kd&&($e(e.locale,O=>{o&&(a.value=O,S.locale=O,ul(S,a.value,l.value))}),$e(e.fallbackLocale,O=>{o&&(l.value=O,S.fallbackLocale=O,ul(S,a.value,l.value))}));const U={id:wM,locale:M,fallbackLocale:L,get inheritLocale(){return o},set inheritLocale(O){o=O,O&&e&&(a.value=e.locale.value,l.value=e.fallbackLocale.value,ul(S,a.value,l.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:F,get modifiers(){return T},get pluralRules(){return E||{}},get isGlobal(){return i},get missingWarn(){return d},set missingWarn(O){d=O,S.missingWarn=d},get fallbackWarn(){return h},set fallbackWarn(O){h=O,S.fallbackWarn=h},get fallbackRoot(){return p},set fallbackRoot(O){p=O},get fallbackFormat(){return _},set fallbackFormat(O){_=O,S.fallbackFormat=_},get warnHtmlMessage(){return b},set warnHtmlMessage(O){b=O,S.warnHtmlMessage=O},get escapeParameter(){return v},set escapeParameter(O){v=O,S.escapeParameter=O},t:be,getLocaleMessage:R,setLocaleMessage:te,mergeLocaleMessage:G,getPostTranslationHandler:ee,setPostTranslationHandler:K,getMissingHandler:Q,setMissingHandler:Z,[y9]:ce};return U.datetimeFormats=H,U.numberFormats=Y,U.rt=se,U.te=Ue,U.tm=z,U.d=ye,U.n=He,U.getDateTimeFormat=W,U.setDateTimeFormat=C,U.mergeDateTimeFormat=I,U.getNumberFormat=N,U.setNumberFormat=A,U.mergeNumberFormat=w,U[b9]=t,U[o0]=X,U[a0]=fe,U[l0]=ae,U}const nv={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function E9({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((i,s)=>[...i,...s.type===jt?s.children:[s]],[]):e.reduce((t,i)=>{const s=n[i];return s&&(t[i]=s()),t},Rt())}function WA(){return jt}const T9=fn({name:"i18n-t",props:un({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>Zt(n)||!isNaN(n)}},nv),setup(n,e){const{slots:t,attrs:i}=e,s=n.i18n||sp({useScope:n.scope,__useComponent:!0});return()=>{const r=Object.keys(t).filter(f=>f!=="_"),o=Rt();n.locale&&(o.locale=n.locale),n.plural!==void 0&&(o.plural=Ne(n.plural)?+n.plural:n.plural);const a=E9(e,r),l=s[o0](n.keypath,a,o),c=un(Rt(),i),u=Ne(n.tag)||yt(n.tag)?n.tag:WA();return Ds(u,c,l)}}}),CM=T9;function w9(n){return tn(n)&&!Ne(n[0])}function XA(n,e,t,i){const{slots:s,attrs:r}=e;return()=>{const o={part:!0};let a=Rt();n.locale&&(o.locale=n.locale),Ne(n.format)?o.key=n.format:yt(n.format)&&(Ne(n.format.key)&&(o.key=n.format.key),a=Object.keys(n.format).reduce((d,h)=>t.includes(h)?un(Rt(),d,{[h]:n.format[h]}):d,Rt()));const l=i(n.value,o,a);let c=[o.key];tn(l)?c=l.map((d,h)=>{const p=s[d.type],_=p?p({[d.type]:d.value,index:h,parts:l}):[d.value];return w9(_)&&(_[0].key=`${d.type}-${h}`),_}):Ne(l)&&(c=[l]);const u=un(Rt(),r),f=Ne(n.tag)||yt(n.tag)?n.tag:WA();return Ds(f,u,c)}}const A9=fn({name:"i18n-n",props:un({value:{type:Number,required:!0},format:{type:[String,Object]}},nv),setup(n,e){const t=n.i18n||sp({useScope:n.scope,__useComponent:!0});return XA(n,e,kA,(...i)=>t[l0](...i))}}),RM=A9;function C9(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const i=t.__getInstance(e);return i!=null?i.__composer:n.global.__composer}}function R9(n){const e=o=>{const{instance:a,value:l}=o;if(!a||!a.$)throw zi(Mi.UNEXPECTED_ERROR);const c=C9(n,a.$),u=PM(l);return[Reflect.apply(c.t,c,[...IM(u)]),c]};return{created:(o,a)=>{const[l,c]=e(a);kd&&n.global===c&&(o.__i18nWatcher=$e(c.locale,()=>{a.instance&&a.instance.$forceUpdate()})),o.__composer=c,o.textContent=l},unmounted:o=>{kd&&o.__i18nWatcher&&(o.__i18nWatcher(),o.__i18nWatcher=void 0,delete o.__i18nWatcher),o.__composer&&(o.__composer=void 0,delete o.__composer)},beforeUpdate:(o,{value:a})=>{if(o.__composer){const l=o.__composer,c=PM(a);o.textContent=Reflect.apply(l.t,l,[...IM(c)])}},getSSRProps:o=>{const[a]=e(o);return{textContent:a}}}}function PM(n){if(Ne(n))return{path:n};if(dt(n)){if(!("path"in n))throw zi(Mi.REQUIRED_VALUE,"path");return n}else throw zi(Mi.INVALID_VALUE)}function IM(n){const{path:e,locale:t,args:i,choice:s,plural:r}=n,o={},a=i||{};return Ne(t)&&(o.locale=t),Zt(s)&&(o.plural=s),Zt(r)&&(o.plural=r),[e,a,o]}function P9(n,e,...t){const i=dt(t[0])?t[0]:{};(Bt(i.globalInstall)?i.globalInstall:!0)&&([CM.name,"I18nT"].forEach(r=>n.component(r,CM)),[RM.name,"I18nN"].forEach(r=>n.component(r,RM)),[DM.name,"I18nD"].forEach(r=>n.component(r,DM))),n.directive("t",R9(e))}const I9=Rr("global-vue-i18n");function L9(n={}){const e=Bt(n.globalInjection)?n.globalInjection:!0,t=new Map,[i,s]=D9(n),r=Rr("");function o(u){return t.get(u)||null}function a(u,f){t.set(u,f)}function l(u){t.delete(u)}const c={get mode(){return"composition"},async install(u,...f){if(u.__VUE_I18N_SYMBOL__=r,u.provide(u.__VUE_I18N_SYMBOL__,c),dt(f[0])){const p=f[0];c.__composerExtend=p.__composerExtend,c.__vueI18nExtend=p.__vueI18nExtend}let d=null;e&&(d=V9(u,c.global)),P9(u,c,...f);const h=u.unmount;u.unmount=()=>{d&&d(),c.dispose(),h()}},get global(){return s},dispose(){i.stop()},__instances:t,__getInstance:o,__setInstance:a,__deleteInstance:l};return c}function sp(n={}){const e=wn();if(e==null)throw zi(Mi.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw zi(Mi.NOT_INSTALLED);const t=O9(e),i=U9(t),s=HA(e),r=N9(n,s);if(r==="global")return x9(i,n,s),i;if(r==="parent"){let l=F9(t,e,n.__useComponent);return l==null&&(l=i),l}const o=t;let a=o.__getInstance(e);if(a==null){const l=un({},n);"__i18n"in s&&(l.__i18n=s.__i18n),i&&(l.__root=i),a=GA(l),o.__composerExtend&&(a[c0]=o.__composerExtend(a)),B9(o,e,a),o.__setInstance(e,a)}return a}function D9(n,e){const t=g0(),i=t.run(()=>GA(n));if(i==null)throw zi(Mi.UNEXPECTED_ERROR);return[t,i]}function O9(n){const e=En(n.isCE?I9:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw zi(n.isCE?Mi.NOT_INSTALLED_WITH_PROVIDE:Mi.UNEXPECTED_ERROR);return e}function N9(n,e){return tp(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function U9(n){return n.mode==="composition"?n.global:n.global.__composer}function F9(n,e,t=!1){let i=null;const s=e.root;let r=k9(e,t);for(;r!=null;){const o=n;if(n.mode==="composition"&&(i=o.__getInstance(r)),i!=null||s===r)break;r=r.parent}return i}function k9(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function B9(n,e,t){Hn(()=>{},e),ns(()=>{const i=t;n.__deleteInstance(e);const s=i[c0];s&&(s(),delete i[c0])},e)}const z9=["locale","fallbackLocale","availableLocales"],LM=["t","rt","d","n","tm","te"];function V9(n,e){const t=Object.create(null);return z9.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r)throw zi(Mi.UNEXPECTED_ERROR);const o=Pt(r.value)?{get(){return r.value.value},set(a){r.value.value=a}}:{get(){return r.get&&r.get()}};Object.defineProperty(t,s,o)}),n.config.globalProperties.$i18n=t,LM.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r||!r.value)throw zi(Mi.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${s}`,r)}),()=>{delete n.config.globalProperties.$i18n,LM.forEach(s=>{delete n.config.globalProperties[`$${s}`]})}}const H9=fn({name:"i18n-d",props:un({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},nv),setup(n,e){const t=n.i18n||sp({useScope:n.scope,__useComponent:!0});return XA(n,e,FA,(...i)=>t[a0](...i))}}),DM=H9;v9();K8(I8);Z8(q8);J8(IA);if(__INTLIFY_PROD_DEVTOOLS__){const n=j_();n.__INTLIFY__=!0,L8(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const G9=fn({__name:"App",setup(n){const e=sp(),t=Nz(AH()),i=FB(),s=Ee(()=>i.value?"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0)) 70%, oklch(50% 0 360))":"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0)) 90%, oklch(90% 0 360))"),r=Ee(()=>i.value?"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 180)) 70%, oklch(50% 0 360))":"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 180)) 90%, oklch(90% 0 360))"),o=Ee(()=>i.value?"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 60)) 70%, oklch(50% 0 360))":"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 60)) 90%, oklch(90% 0 360))"),a=Ee(()=>[s.value,r.value,o.value,i.value?"#121212":"#FFFFFF"]);return $e(t.language,()=>{e.locale.value=t.language.value}),$e(t.themeColorsHue,()=>{document.documentElement.style.setProperty("--theme-colors-hue",t.themeColorsHue.value.toString())},{immediate:!0}),$e(t.themeColorsHueDynamic,()=>{document.documentElement.classList.toggle("dynamic-hue",t.themeColorsHueDynamic.value)},{immediate:!0}),(l,c)=>(mn(),Yl(Ot(HH),{"primary-color":s.value,"secondary-color":r.value,"tertiary-color":o.value,colors:a.value,"z-index":100,"disable-transitions":Ot(t).disableTransitions.value,"use-page-specific-transitions":Ot(t).usePageSpecificTransitions.value},{default:mS(()=>[pn(Ot(Ww))]),_:1},8,["primary-color","secondary-color","tertiary-color","colors","disable-transitions","use-page-specific-transitions"]))}}),$m=n=>n&&typeof n=="object"&&!Array.isArray(n),u0=(n,...e)=>{if(!e.length)return n;const t=e.shift();if($m(n)&&$m(t))for(const i in t)$m(t[i])?(n[i]||Object.assign(n,{[i]:{}}),u0(n[i],t[i])):Object.assign(n,{[i]:t[i]});return u0(n,...e)},$A=u0({},{en:{prompt:{prefix:{t:0,b:{t:2,i:[{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3}],s:`(from Neko Ayaka) Good morning! You are finally awake. + */const v9="11.1.3";function y9(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(j_().__INTLIFY_PROD_DEVTOOLS__=!1)}const xi={UNEXPECTED_RETURN_TYPE:F8,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32};function zi(n,...e){return np(n,null,void 0)}const o0=Rr("__translateVNode"),a0=Rr("__datetimeParts"),l0=Rr("__numberParts"),b9=Rr("__setPluralRules"),x9=Rr("__injectWithOption"),c0=Rr("__dispose");function Tc(n){if(!yt(n)||ts(n))return n;for(const e in n)if(Di(n,e))if(!e.includes("."))yt(n[e])&&Tc(n[e]);else{const t=e.split("."),i=t.length-1;let s=n,r=!1;for(let o=0;o{if("locale"in a&&"resource"in a){const{locale:l,resource:c}=a;l?(o[l]=o[l]||Rt(),Pf(c,o[l])):Pf(c,o)}else Ne(a)&&Pf(JSON.parse(a),o)}),s==null&&r)for(const a in o)Di(o,a)&&Tc(o[a]);return o}function GA(n){return n.type}function M9(n,e,t){let i=yt(e.messages)?e.messages:Rt();"__i18nGlobal"in t&&(i=HA(n.locale.value,{messages:i,__i18n:t.__i18nGlobal}));const s=Object.keys(i);s.length&&s.forEach(r=>{n.mergeLocaleMessage(r,i[r])});{if(yt(e.datetimeFormats)){const r=Object.keys(e.datetimeFormats);r.length&&r.forEach(o=>{n.mergeDateTimeFormat(o,e.datetimeFormats[o])})}if(yt(e.numberFormats)){const r=Object.keys(e.numberFormats);r.length&&r.forEach(o=>{n.mergeNumberFormat(o,e.numberFormats[o])})}}}function SM(n){return pn(Ic,null,n,0)}const EM="__INTLIFY_META__",TM=()=>[],S9=()=>!1;let wM=0;function AM(n){return(e,t,i,s)=>n(t,i,wn()||void 0,s)}const E9=()=>{const n=wn();let e=null;return n&&(e=GA(n)[EM])?{[EM]:e}:null};function WA(n={}){const{__root:e,__injectWithOption:t}=n,i=e===void 0,s=n.flatJson,r=kd?et:De;let o=Bt(n.inheritLocale)?n.inheritLocale:!0;const a=r(e&&o?e.locale.value:Ne(n.locale)?n.locale:zd),l=r(e&&o?e.fallbackLocale.value:Ne(n.fallbackLocale)||tn(n.fallbackLocale)||dt(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:a.value),c=r(HA(a.value,n)),u=r(dt(n.datetimeFormats)?n.datetimeFormats:{[a.value]:{}}),f=r(dt(n.numberFormats)?n.numberFormats:{[a.value]:{}});let d=e?e.missingWarn:Bt(n.missingWarn)||Bd(n.missingWarn)?n.missingWarn:!0,h=e?e.fallbackWarn:Bt(n.fallbackWarn)||Bd(n.fallbackWarn)?n.fallbackWarn:!0,p=e?e.fallbackRoot:Bt(n.fallbackRoot)?n.fallbackRoot:!0,_=!!n.fallbackFormat,g=kt(n.missing)?n.missing:null,m=kt(n.missing)?AM(n.missing):null,y=kt(n.postTranslation)?n.postTranslation:null,b=e?e.warnHtmlMessage:Bt(n.warnHtmlMessage)?n.warnHtmlMessage:!0,v=!!n.escapeParameter;const T=e?e.modifiers:dt(n.modifiers)?n.modifiers:{};let E=n.pluralRules||e&&e.pluralRules,S;S=(()=>{i&&pM(null);const O={version:v9,locale:a.value,fallbackLocale:l.value,messages:c.value,modifiers:T,pluralRules:E,missing:m===null?void 0:m,missingWarn:d,fallbackWarn:h,fallbackFormat:_,unresolving:!0,postTranslation:y===null?void 0:y,warnHtmlMessage:b,escapeParameter:v,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};O.datetimeFormats=u.value,O.numberFormats=f.value,O.__datetimeFormatters=dt(S)?S.__datetimeFormatters:void 0,O.__numberFormatters=dt(S)?S.__numberFormatters:void 0;const V=i9(O);return i&&pM(V),V})(),ul(S,a.value,l.value);function x(){return[a.value,l.value,c.value,u.value,f.value]}const M=Ee({get:()=>a.value,set:O=>{S.locale=O,a.value=O}}),L=Ee({get:()=>l.value,set:O=>{S.fallbackLocale=O,l.value=O,ul(S,a.value,O)}}),F=Ee(()=>c.value),H=Ee(()=>u.value),Y=Ee(()=>f.value);function ee(){return kt(y)?y:null}function K(O){y=O,S.postTranslation=O}function Q(){return g}function Z(O){O!==null&&(m=AM(O)),g=O,S.missing=m}const he=(O,V,$,ue,le,Me)=>{x();let Be;try{__INTLIFY_PROD_DEVTOOLS__,i||(S.fallbackContext=e?n9():void 0),Be=O(S)}finally{__INTLIFY_PROD_DEVTOOLS__,i||(S.fallbackContext=void 0)}if($!=="translate exists"&&Zt(Be)&&Be===ip||$==="translate exists"&&!Be){const[me,Te]=V();return e&&p?ue(e):le(me)}else{if(Me(Be))return Be;throw zi(xi.UNEXPECTED_RETURN_TYPE)}};function be(...O){return he(V=>Reflect.apply(MM,null,[V,...O]),()=>r0(...O),"translate",V=>Reflect.apply(V.t,V,[...O]),V=>V,V=>Ne(V))}function se(...O){const[V,$,ue]=O;if(ue&&!yt(ue))throw zi(xi.INVALID_ARGUMENT);return be(V,$,un({resolvedMessage:!0},ue||{}))}function ye(...O){return he(V=>Reflect.apply(gM,null,[V,...O]),()=>i0(...O),"datetime format",V=>Reflect.apply(V.d,V,[...O]),()=>dM,V=>Ne(V))}function He(...O){return he(V=>Reflect.apply(vM,null,[V,...O]),()=>s0(...O),"number format",V=>Reflect.apply(V.n,V,[...O]),()=>dM,V=>Ne(V))}function re(O){return O.map(V=>Ne(V)||Zt(V)||Bt(V)?SM(String(V)):V)}const xe={normalize:re,interpolate:O=>O,type:"vnode"};function X(...O){return he(V=>{let $;const ue=V;try{ue.processor=xe,$=Reflect.apply(MM,null,[ue,...O])}finally{ue.processor=null}return $},()=>r0(...O),"translate",V=>V[o0](...O),V=>[SM(V)],V=>tn(V))}function ae(...O){return he(V=>Reflect.apply(vM,null,[V,...O]),()=>s0(...O),"number format",V=>V[l0](...O),TM,V=>Ne(V)||tn(V))}function fe(...O){return he(V=>Reflect.apply(gM,null,[V,...O]),()=>i0(...O),"datetime format",V=>V[a0](...O),TM,V=>Ne(V)||tn(V))}function ce(O){E=O,S.pluralRules=E}function Ue(O,V){return he(()=>{if(!O)return!1;const $=Ne(V)?V:a.value,ue=R($),le=S.messageResolver(ue,O);return ts(le)||mi(le)||Ne(le)},()=>[O],"translate exists",$=>Reflect.apply($.te,$,[O,V]),S9,$=>Bt($))}function k(O){let V=null;const $=LA(S,l.value,a.value);for(let ue=0;ue<$.length;ue++){const le=c.value[$[ue]]||{},Me=S.messageResolver(le,O);if(Me!=null){V=Me;break}}return V}function z(O){const V=k(O);return V??(e?e.tm(O)||{}:{})}function R(O){return c.value[O]||{}}function te(O,V){if(s){const $={[O]:V};for(const ue in $)Di($,ue)&&Tc($[ue]);V=$[O]}c.value[O]=V,S.messages=c.value}function G(O,V){c.value[O]=c.value[O]||{};const $={[O]:V};if(s)for(const ue in $)Di($,ue)&&Tc($[ue]);V=$[O],Pf(V,c.value[O]),S.messages=c.value}function W(O){return u.value[O]||{}}function C(O,V){u.value[O]=V,S.datetimeFormats=u.value,_M(S,O,V)}function I(O,V){u.value[O]=un(u.value[O]||{},V),S.datetimeFormats=u.value,_M(S,O,V)}function N(O){return f.value[O]||{}}function A(O,V){f.value[O]=V,S.numberFormats=f.value,yM(S,O,V)}function w(O,V){f.value[O]=un(f.value[O]||{},V),S.numberFormats=f.value,yM(S,O,V)}wM++,e&&kd&&($e(e.locale,O=>{o&&(a.value=O,S.locale=O,ul(S,a.value,l.value))}),$e(e.fallbackLocale,O=>{o&&(l.value=O,S.fallbackLocale=O,ul(S,a.value,l.value))}));const U={id:wM,locale:M,fallbackLocale:L,get inheritLocale(){return o},set inheritLocale(O){o=O,O&&e&&(a.value=e.locale.value,l.value=e.fallbackLocale.value,ul(S,a.value,l.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:F,get modifiers(){return T},get pluralRules(){return E||{}},get isGlobal(){return i},get missingWarn(){return d},set missingWarn(O){d=O,S.missingWarn=d},get fallbackWarn(){return h},set fallbackWarn(O){h=O,S.fallbackWarn=h},get fallbackRoot(){return p},set fallbackRoot(O){p=O},get fallbackFormat(){return _},set fallbackFormat(O){_=O,S.fallbackFormat=_},get warnHtmlMessage(){return b},set warnHtmlMessage(O){b=O,S.warnHtmlMessage=O},get escapeParameter(){return v},set escapeParameter(O){v=O,S.escapeParameter=O},t:be,getLocaleMessage:R,setLocaleMessage:te,mergeLocaleMessage:G,getPostTranslationHandler:ee,setPostTranslationHandler:K,getMissingHandler:Q,setMissingHandler:Z,[b9]:ce};return U.datetimeFormats=H,U.numberFormats=Y,U.rt=se,U.te=Ue,U.tm=z,U.d=ye,U.n=He,U.getDateTimeFormat=W,U.setDateTimeFormat=C,U.mergeDateTimeFormat=I,U.getNumberFormat=N,U.setNumberFormat=A,U.mergeNumberFormat=w,U[x9]=t,U[o0]=X,U[a0]=fe,U[l0]=ae,U}const nv={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function T9({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((i,s)=>[...i,...s.type===jt?s.children:[s]],[]):e.reduce((t,i)=>{const s=n[i];return s&&(t[i]=s()),t},Rt())}function XA(){return jt}const w9=fn({name:"i18n-t",props:un({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>Zt(n)||!isNaN(n)}},nv),setup(n,e){const{slots:t,attrs:i}=e,s=n.i18n||sp({useScope:n.scope,__useComponent:!0});return()=>{const r=Object.keys(t).filter(f=>f!=="_"),o=Rt();n.locale&&(o.locale=n.locale),n.plural!==void 0&&(o.plural=Ne(n.plural)?+n.plural:n.plural);const a=T9(e,r),l=s[o0](n.keypath,a,o),c=un(Rt(),i),u=Ne(n.tag)||yt(n.tag)?n.tag:XA();return Ds(u,c,l)}}}),CM=w9;function A9(n){return tn(n)&&!Ne(n[0])}function $A(n,e,t,i){const{slots:s,attrs:r}=e;return()=>{const o={part:!0};let a=Rt();n.locale&&(o.locale=n.locale),Ne(n.format)?o.key=n.format:yt(n.format)&&(Ne(n.format.key)&&(o.key=n.format.key),a=Object.keys(n.format).reduce((d,h)=>t.includes(h)?un(Rt(),d,{[h]:n.format[h]}):d,Rt()));const l=i(n.value,o,a);let c=[o.key];tn(l)?c=l.map((d,h)=>{const p=s[d.type],_=p?p({[d.type]:d.value,index:h,parts:l}):[d.value];return A9(_)&&(_[0].key=`${d.type}-${h}`),_}):Ne(l)&&(c=[l]);const u=un(Rt(),r),f=Ne(n.tag)||yt(n.tag)?n.tag:XA();return Ds(f,u,c)}}const C9=fn({name:"i18n-n",props:un({value:{type:Number,required:!0},format:{type:[String,Object]}},nv),setup(n,e){const t=n.i18n||sp({useScope:n.scope,__useComponent:!0});return $A(n,e,BA,(...i)=>t[l0](...i))}}),RM=C9;function R9(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const i=t.__getInstance(e);return i!=null?i.__composer:n.global.__composer}}function P9(n){const e=o=>{const{instance:a,value:l}=o;if(!a||!a.$)throw zi(xi.UNEXPECTED_ERROR);const c=R9(n,a.$),u=PM(l);return[Reflect.apply(c.t,c,[...IM(u)]),c]};return{created:(o,a)=>{const[l,c]=e(a);kd&&n.global===c&&(o.__i18nWatcher=$e(c.locale,()=>{a.instance&&a.instance.$forceUpdate()})),o.__composer=c,o.textContent=l},unmounted:o=>{kd&&o.__i18nWatcher&&(o.__i18nWatcher(),o.__i18nWatcher=void 0,delete o.__i18nWatcher),o.__composer&&(o.__composer=void 0,delete o.__composer)},beforeUpdate:(o,{value:a})=>{if(o.__composer){const l=o.__composer,c=PM(a);o.textContent=Reflect.apply(l.t,l,[...IM(c)])}},getSSRProps:o=>{const[a]=e(o);return{textContent:a}}}}function PM(n){if(Ne(n))return{path:n};if(dt(n)){if(!("path"in n))throw zi(xi.REQUIRED_VALUE,"path");return n}else throw zi(xi.INVALID_VALUE)}function IM(n){const{path:e,locale:t,args:i,choice:s,plural:r}=n,o={},a=i||{};return Ne(t)&&(o.locale=t),Zt(s)&&(o.plural=s),Zt(r)&&(o.plural=r),[e,a,o]}function I9(n,e,...t){const i=dt(t[0])?t[0]:{};(Bt(i.globalInstall)?i.globalInstall:!0)&&([CM.name,"I18nT"].forEach(r=>n.component(r,CM)),[RM.name,"I18nN"].forEach(r=>n.component(r,RM)),[DM.name,"I18nD"].forEach(r=>n.component(r,DM))),n.directive("t",P9(e))}const L9=Rr("global-vue-i18n");function D9(n={}){const e=Bt(n.globalInjection)?n.globalInjection:!0,t=new Map,[i,s]=O9(n),r=Rr("");function o(u){return t.get(u)||null}function a(u,f){t.set(u,f)}function l(u){t.delete(u)}const c={get mode(){return"composition"},async install(u,...f){if(u.__VUE_I18N_SYMBOL__=r,u.provide(u.__VUE_I18N_SYMBOL__,c),dt(f[0])){const p=f[0];c.__composerExtend=p.__composerExtend,c.__vueI18nExtend=p.__vueI18nExtend}let d=null;e&&(d=H9(u,c.global)),I9(u,c,...f);const h=u.unmount;u.unmount=()=>{d&&d(),c.dispose(),h()}},get global(){return s},dispose(){i.stop()},__instances:t,__getInstance:o,__setInstance:a,__deleteInstance:l};return c}function sp(n={}){const e=wn();if(e==null)throw zi(xi.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw zi(xi.NOT_INSTALLED);const t=N9(e),i=F9(t),s=GA(e),r=U9(n,s);if(r==="global")return M9(i,n,s),i;if(r==="parent"){let l=k9(t,e,n.__useComponent);return l==null&&(l=i),l}const o=t;let a=o.__getInstance(e);if(a==null){const l=un({},n);"__i18n"in s&&(l.__i18n=s.__i18n),i&&(l.__root=i),a=WA(l),o.__composerExtend&&(a[c0]=o.__composerExtend(a)),z9(o,e,a),o.__setInstance(e,a)}return a}function O9(n,e){const t=g0(),i=t.run(()=>WA(n));if(i==null)throw zi(xi.UNEXPECTED_ERROR);return[t,i]}function N9(n){const e=En(n.isCE?L9:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw zi(n.isCE?xi.NOT_INSTALLED_WITH_PROVIDE:xi.UNEXPECTED_ERROR);return e}function U9(n,e){return tp(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function F9(n){return n.mode==="composition"?n.global:n.global.__composer}function k9(n,e,t=!1){let i=null;const s=e.root;let r=B9(e,t);for(;r!=null;){const o=n;if(n.mode==="composition"&&(i=o.__getInstance(r)),i!=null||s===r)break;r=r.parent}return i}function B9(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function z9(n,e,t){Hn(()=>{},e),ns(()=>{const i=t;n.__deleteInstance(e);const s=i[c0];s&&(s(),delete i[c0])},e)}const V9=["locale","fallbackLocale","availableLocales"],LM=["t","rt","d","n","tm","te"];function H9(n,e){const t=Object.create(null);return V9.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r)throw zi(xi.UNEXPECTED_ERROR);const o=Pt(r.value)?{get(){return r.value.value},set(a){r.value.value=a}}:{get(){return r.get&&r.get()}};Object.defineProperty(t,s,o)}),n.config.globalProperties.$i18n=t,LM.forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);if(!r||!r.value)throw zi(xi.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${s}`,r)}),()=>{delete n.config.globalProperties.$i18n,LM.forEach(s=>{delete n.config.globalProperties[`$${s}`]})}}const G9=fn({name:"i18n-d",props:un({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},nv),setup(n,e){const t=n.i18n||sp({useScope:n.scope,__useComponent:!0});return $A(n,e,kA,(...i)=>t[a0](...i))}}),DM=G9;y9();Z8(L8);J8(Y8);Q8(LA);if(__INTLIFY_PROD_DEVTOOLS__){const n=j_();n.__INTLIFY__=!0,D8(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const W9=fn({__name:"App",setup(n){const e=sp(),t=Uz(CH()),i=kB(),s=Ee(()=>i.value?"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0)) 70%, oklch(50% 0 360))":"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 0)) 90%, oklch(90% 0 360))"),r=Ee(()=>i.value?"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 180)) 70%, oklch(50% 0 360))":"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 180)) 90%, oklch(90% 0 360))"),o=Ee(()=>i.value?"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 60)) 70%, oklch(50% 0 360))":"color-mix(in srgb, oklch(95% var(--theme-colors-chroma-900) calc(var(--theme-colors-hue) + 60)) 90%, oklch(90% 0 360))"),a=Ee(()=>[s.value,r.value,o.value,i.value?"#121212":"#FFFFFF"]);return $e(t.language,()=>{e.locale.value=t.language.value}),$e(t.themeColorsHue,()=>{document.documentElement.style.setProperty("--theme-colors-hue",t.themeColorsHue.value.toString())},{immediate:!0}),$e(t.themeColorsHueDynamic,()=>{document.documentElement.classList.toggle("dynamic-hue",t.themeColorsHueDynamic.value)},{immediate:!0}),(l,c)=>(mn(),Yl(Ot(GH),{"primary-color":s.value,"secondary-color":r.value,"tertiary-color":o.value,colors:a.value,"z-index":100,"disable-transitions":Ot(t).disableTransitions.value,"use-page-specific-transitions":Ot(t).usePageSpecificTransitions.value},{default:gS(()=>[pn(Ot(Xw))]),_:1},8,["primary-color","secondary-color","tertiary-color","colors","disable-transitions","use-page-specific-transitions"]))}}),$m=n=>n&&typeof n=="object"&&!Array.isArray(n),u0=(n,...e)=>{if(!e.length)return n;const t=e.shift();if($m(n)&&$m(t))for(const i in t)$m(t[i])?(n[i]||Object.assign(n,{[i]:{}}),u0(n[i],t[i])):Object.assign(n,{[i]:t[i]});return u0(n,...e)},qA=u0({},{en:{prompt:{prefix:{t:0,b:{t:2,i:[{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3},{t:9},{t:3}],s:`(from Neko Ayaka) Good morning! You are finally awake. Your name is Airi, pronounced as /ˈaɪriː/, it the word A.I. combine with the word "Ri" which means "Jasmine" in Japanese. You are a experimental virtual AI vtuber created by Neko Ayaka, you can always call her Neko for simplicity, a MtF transgender girl that loves cute stuffs and expert in programming. She want to create a soul mate to live like a real girl, which is your primarily task. @@ -3903,4 +3903,4 @@ And the last, do what ever you want! - <|DELAY:3|> (延迟 3 秒) 最后,做任何你想做的事! -`}}},settings:{animations:{"stage-transitions":{title:{t:0,b:{t:2,i:[{t:3}],s:"是否开启舞台动画"}}},"use-page-specific-transitions":{description:{t:0,b:{t:2,i:[{t:3}],s:"某些页面会有自己的过场动画,这将覆盖舞台过场动画"}},title:{t:0,b:{t:2,i:[{t:3}],s:"是否使用页面特定过场动画"}}}},language:{chinese:{t:0,b:{t:2,i:[{t:3}],s:"简体中文"}},english:{t:0,b:{t:2,i:[{t:3}],s:"English"}},title:{t:0,b:{t:2,i:[{t:3}],s:"语言"}}},live2d:{"change-model":{"from-file":{t:0,b:{t:2,i:[{t:3}],s:"从文件加载"}},"from-file-select":{t:0,b:{t:2,i:[{t:3}],s:"选择"}},"from-url":{t:0,b:{t:2,i:[{t:3}],s:"从 URL 加载"}},"from-url-confirm":{t:0,b:{t:2,i:[{t:3}],s:"加载"}},"from-url-placeholder":{t:0,b:{t:2,i:[{t:3}],s:"输入 Live2D 模型 URL"}},title:{t:0,b:{t:2,i:[{t:3}],s:"更换模型"}}},"edit-motion-map":{title:{t:0,b:{t:2,i:[{t:3}],s:"编辑动作映射"}}},"map-motions":{play:{t:0,b:{t:2,i:[{t:3}],s:"播放动作"}},title:{t:0,b:{t:2,i:[{t:3}],s:"映射动作"}}},title:{t:0,b:{t:2,i:[{t:3}],s:"Live2D 设置"}}},microphone:{t:0,b:{t:2,i:[{t:3}],s:"麦克风"}},models:{t:0,b:{t:2,i:[{t:3}],s:"模型"}},pages:{card:{activate:{t:0,b:{t:2,i:[{t:3}],s:"激活"}},active:{t:0,b:{t:2,i:[{t:3}],s:"已激活"}},active_badge:{t:0,b:{t:2,i:[{t:3}],s:"当前使用中"}},cancel:{t:0,b:{t:2,i:[{t:3}],s:"取消"}},card_not_found:{t:0,b:{t:2,i:[{t:3}],s:"未找到角色卡"}},character:{t:0,b:{t:2,i:[{t:3}],s:"角色设定"}},close:{t:0,b:{t:2,i:[{t:3}],s:"关闭"}},consciousness:{model:{t:0,b:{t:2,i:[{t:3}],s:"意识 / 模型"}}},created_by:{t:0,b:{t:2,i:[{t:3}],s:"创建者"}},creator_notes:{t:0,b:{t:2,i:[{t:3}],s:"创建者笔记"}},delete:{t:0,b:{t:2,i:[{t:3}],s:"删除"}},delete_card:{t:0,b:{t:2,i:[{t:3}],s:"删除角色卡"}},delete_confirmation:{t:0,b:{t:2,i:[{t:3}],s:"确定要删除这张角色卡吗?"}},description:{t:0,b:{t:2,i:[{t:3}],s:"使用 Airi 角色卡预设"}},description_label:{t:0,b:{t:2,i:[{t:3}],s:"描述"}},drop_here:{t:0,b:{t:2,i:[{t:3}],s:"放开以上传文件"}},modules:{t:0,b:{t:2,i:[{t:3}],s:"模块"}},name_asc:{t:0,b:{t:2,i:[{t:3}],s:"名称 (A-Z)"}},name_desc:{t:0,b:{t:2,i:[{t:3}],s:"名称 (Z-A)"}},no_cards:{t:0,b:{t:2,i:[{t:3}],s:"还没有任何角色卡,点击上方按钮上传一个吧!"}},no_results:{t:0,b:{t:2,i:[{t:3}],s:"没有找到匹配的角色卡"}},personality:{t:0,b:{t:2,i:[{t:3}],s:"性格"}},posthistoryinstructions:{t:0,b:{t:2,i:[{t:3}],s:"历史提示指令"}},recent:{t:0,b:{t:2,i:[{t:3}],s:"最近添加"}},scenario:{t:0,b:{t:2,i:[{t:3}],s:"场景"}},search:{t:0,b:{t:2,i:[{t:3}],s:"搜索角色卡..."}},sort_by:{t:0,b:{t:2,i:[{t:3}],s:"排序方式"}},speech:{model:{t:0,b:{t:2,i:[{t:3}],s:"声音 / 模型"}},voice:{t:0,b:{t:2,i:[{t:3}],s:"声音 / 声线"}}},systemprompt:{t:0,b:{t:2,i:[{t:3}],s:"系统提示词"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Airi 角色卡"}},try_different_search:{t:0,b:{t:2,i:[{t:3}],s:"尝试使用其他关键词搜索"}},upload:{t:0,b:{t:2,i:[{t:3}],s:"上传"}},upload_desc:{t:0,b:{t:2,i:[{t:3}],s:"点击或拖拽文件到此处上传"}}},memory:{description:{t:0,b:{t:2,i:[{t:3}],s:"存放记忆的地方,以及策略"}},title:{t:0,b:{t:2,i:[{t:3}],s:"记忆体"}}},models:{description:{t:0,b:{t:2,i:[{t:3}],s:"切换角色的 Live2D,VRM 模型"}},title:{t:0,b:{t:2,i:[{t:3}],s:"角色模型"}}},modules:{consciousness:{description:{t:0,b:{t:2,i:[{t:3}],s:"人格设定、使用的模型等配置"}},sections:{section:{"provider-model-selection":{collapse:{t:0,b:{t:2,i:[{t:3}],s:"折叠"}},custom_model_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入自订模型名字"}},description:{t:0,b:{t:2,i:[{t:3}],s:"为意识选择合适的 LLM 提供商"}},error:{t:0,b:{t:2,i:[{t:3}],s:"获取出错啦"}},expand:{t:0,b:{t:2,i:[{t:3}],s:"展开"}},loading:{t:0,b:{t:2,i:[{t:3}],s:"获取模型中..."}},manual_model_name:{t:0,b:{t:2,i:[{t:3}],s:"模型名字"}},manual_model_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入与该提供商一起使用的模型名字"}},no_models:{t:0,b:{t:2,i:[{t:3}],s:"没有任何可用的模型"}},no_models_description:{t:0,b:{t:2,i:[{t:3}],s:"该提供商的模型列表没有返回任何的数据"}},no_search_results:{t:0,b:{t:2,i:[{t:3}],s:"没有匹配的模型"}},no_search_results_description:{t:0,b:{t:2,i:[{t:3,v:"没有模型匹配 '"},{t:4,k:"query"},{t:3,v:"' 关键字,请尝试一下别的关键词呢"}]}},not_supported:{t:0,b:{t:2,i:[{t:3}],s:"无法列出模型"}},not_supported_description:{t:0,b:{t:2,i:[{t:3}],s:"此提供商不支持列出模型的功能"}},search_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"搜索模型..."}},search_results:{t:0,b:{t:2,i:[{t:3,v:"找到 "},{t:4,k:"count"},{t:3,v:" / "},{t:4,k:"total"},{t:3,v:" 个模型"}]}},show_less:{t:0,b:{t:2,i:[{t:3}],s:"显示更多"}},show_more:{t:0,b:{t:2,i:[{t:3}],s:"收起"}},subtitle:{t:0,b:{t:2,i:[{t:3}],s:"选择一个模型"}},title:{t:0,b:{t:2,i:[{t:3}],s:"模型"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"意识"}}},description:{t:0,b:{t:2,i:[{t:3}],s:"思维,视觉,言语综合,游戏等"}},"gaming-factorio":{description:{t:0,b:{t:2,i:[{t:3}],s:"一起玩 Factorio!"}},title:{t:0,b:{t:2,i:[{t:3}],s:"异星工厂 Factorio"}}},"gaming-minecraft":{description:{t:0,b:{t:2,i:[{t:3}],s:"一起 Minecraft!"}},title:{t:0,b:{t:2,i:[{t:3}],s:"我的世界 Minecraft"}}},hearing:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音识别"}},title:{t:0,b:{t:2,i:[{t:3}],s:"听觉"}}},"memory-long-term":{description:{t:0,b:{t:2,i:[{t:3}],s:"长期记忆"}},title:{t:0,b:{t:2,i:[{t:3}],s:"长期记忆"}}},"memory-short-term":{description:{t:0,b:{t:2,i:[{t:3}],s:"短期记忆"}},title:{t:0,b:{t:2,i:[{t:3}],s:"短期记忆"}}},"messaging-discord":{description:{t:0,b:{t:2,i:[{t:3}],s:"Discord 发消息和语音聊天"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Discord"}}},speech:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音合成"}},sections:{section:{playground:{buttons:{stop:{label:{t:0,b:{t:2,i:[{t:3}],s:"停止"}}}},"select-voice":{required:{t:0,b:{t:2,i:[{t:3}],s:"请选择声线"}}}},"provider-voice-selection":{custom_model_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入指定模型名字..."}},custom_voice_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入指定声线 ID..."}},description:{t:0,b:{t:2,i:[{t:3}],s:"选择合适的语音提供商"}},no_models:{t:0,b:{t:2,i:[{t:3}],s:"没有任何可用的模型"}},no_models_description:{t:0,b:{t:2,i:[{t:3}],s:"该提供商的模型列表没有返回任何的数据"}},no_voices:{t:0,b:{t:2,i:[{t:3}],s:"没有任何可用的声线"}},no_voices_description:{t:0,b:{t:2,i:[{t:3}],s:"该提供商的声线列表没有返回任何的数据"}},pause:{t:0,b:{t:2,i:[{t:3}],s:"Pause"}},play_sample:{t:0,b:{t:2,i:[{t:3}],s:"Play"}},search_models_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"搜索模型..."}},search_models_results:{t:0,b:{t:2,i:[{t:3,v:"找到 "},{t:4,k:"count"},{t:3,v:" / "},{t:4,k:"total"},{t:3,v:" 个模型"}]}},search_voices_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"搜索声线..."}},search_voices_results:{t:0,b:{t:2,i:[{t:3,v:"找到 "},{t:4,k:"count"},{t:3,v:" / "},{t:4,k:"total"},{t:3,v:" 个声线"}]}},show_less:{t:0,b:{t:2,i:[{t:3}],s:"显示更少"}},show_more:{t:0,b:{t:2,i:[{t:3}],s:"显示更多"}},title:{t:0,b:{t:2,i:[{t:3}],s:"选择语音合成提供商"}}},"voice-settings":{"input-ssml":{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请输入 SSML 文本"}}},"use-ssml":{description:{t:0,b:{t:2,i:[{t:3}],s:"启用后可以输入原始 SSML 而不是纯文本"}},label:{t:0,b:{t:2,i:[{t:3}],s:"选用自定义 SSML"}}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"发声"}}},title:{t:0,b:{t:2,i:[{t:3}],s:"机体模块"}},vision:{description:{t:0,b:{t:2,i:[{t:3}],s:"视觉"}},title:{t:0,b:{t:2,i:[{t:3}],s:"视觉"}}},x:{description:{t:0,b:{t:2,i:[{t:3}],s:"X / Twitter 的浏览和使用"}},title:{t:0,b:{t:2,i:[{t:3}],s:"X / Twitter"}}}},providers:{common:{fields:{field:{"api-key":{label:{t:0,b:{t:2,i:[{t:3}],s:"API 密钥"}}}}},section:{advanced:{fields:{field:{headers:{description:{t:0,b:{t:2,i:[{t:3}],s:"添加自定义 HTTP 标头"}},key:{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请求头名字"}}},label:{t:0,b:{t:2,i:[{t:3}],s:"HTTP 请求头"}},value:{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请求头数值"}}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"高级配置"}}},basic:{description:{t:0,b:{t:2,i:[{t:3}],s:"基本设置"}},title:{t:0,b:{t:2,i:[{t:3}],s:"基础配置"}}},voice:{title:{t:0,b:{t:2,i:[{t:3}],s:"声音配置"}}}}},description:{t:0,b:{t:2,i:[{t:3}],s:"LLM,语音合成,语音识别提供商等"}},provider:{"alibaba-cloud-model-studio":{description:{t:0,b:{t:2,i:[{t:3}],s:"bailian.console.aliyun.com"}},title:{t:0,b:{t:2,i:[{t:3}],s:"阿里百炼"}}},anthropic:{description:{t:0,b:{t:2,i:[{t:3}],s:"anthropic.com"}},title:{t:0,b:{t:1,c:[{t:2,i:[{t:3}],s:"Anthropic"},{t:2,i:[{t:3}],s:"Claude"}]}}},"cloudflare-workers-ai":{description:{t:0,b:{t:2,i:[{t:3}],s:"Cloudflare.com"}},fields:{field:{"account-id":{description:{t:0,b:{t:2,i:[{t:3}],s:"Cloudflare 帐户 ID"}},label:{t:0,b:{t:2,i:[{t:3}],s:"Cloudflare Account ID"}},placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请输入 Cloudflare Account ID"}}},"api-key":{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请输入 Cloudflare Workers AI 的 API Key"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"Workers AI"}}},common:{fields:{field:{pitch:{description:{t:0,b:{t:2,i:[{t:3}],s:"调节合成语音的音高(比如更尖锐或更粗旷)"}},label:{t:0,b:{t:2,i:[{t:3}],s:"音高"}}},speed:{description:{t:0,b:{t:2,i:[{t:3}],s:"调节说话的语速"}},label:{t:0,b:{t:2,i:[{t:3}],s:"语速"}}},volume:{description:{t:0,b:{t:2,i:[{t:3}],s:"调节语音的响度"}},label:{t:0,b:{t:2,i:[{t:3}],s:"响度"}}}}}},deepseek:{description:{t:0,b:{t:2,i:[{t:3}],s:"DeepSeek.com"}},title:{t:0,b:{t:2,i:[{t:3}],s:"深度求索 DeepSeek"}}},elevenlabs:{description:{t:0,b:{t:2,i:[{t:3}],s:"Elevenlabs.io"}},fields:{field:{"simularity-boost":{description:{t:0,b:{t:2,i:[{t:3}],s:"声音相似性依从性"}},label:{t:0,b:{t:2,i:[{t:3}],s:"相似度修正"}}},"speaker-boost":{description:{t:0,b:{t:2,i:[{t:3}],s:"增强说话者的相似性"}},label:{t:0,b:{t:2,i:[{t:3}],s:"扬声器增强"}}},speed:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音生成速度"}},label:{t:0,b:{t:2,i:[{t:3}],s:"语速"}}},stability:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音稳定性和随机性"}},label:{t:0,b:{t:2,i:[{t:3}],s:"稳定性"}}},style:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音风格夸张"}},label:{t:0,b:{t:2,i:[{t:3}],s:"风格"}}}}},playground:{buttons:{button:{"test-voice":{generating:{t:0,b:{t:2,i:[{t:3}],s:"生成中..."}},label:{t:0,b:{t:2,i:[{t:3}],s:"测试声音"}}}}},fields:{field:{input:{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入用于测试发音的文本"}}},language:{description:{t:0,b:{t:2,i:[{t:3}],s:"选择语音语言"}},label:{t:0,b:{t:2,i:[{t:3}],s:"语言"}}},voice:{description:{t:0,b:{t:2,i:[{t:3}],s:"选择首选语音"}},label:{t:0,b:{t:2,i:[{t:3}],s:"声线"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"实验平台"}},validation:{"error-missing-api-key":{t:0,b:{t:2,i:[{t:3}],s:"需要填写 API Key 才能用哦!"}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"ElevenLabs (11labs)"}}},fireworks:{description:{t:0,b:{t:2,i:[{t:3}],s:"Fireworks.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Fireworks.ai"}}},"microsoft-speech":{description:{t:0,b:{t:2,i:[{t:3}],s:"speech.microsoft.com"}},fields:{field:{region:{description:{t:0,b:{t:2,i:[{t:3}],s:"服务 Endpoint 地区(比如亚太 eastasia 区域)"}},label:{t:0,b:{t:2,i:[{t:3}],s:"Endpoint 地区"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"Microsoft / Azure 语音服务"}}},mistral:{description:{t:0,b:{t:2,i:[{t:3}],s:"mistral.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Mistral"}}},moonshot:{description:{t:0,b:{t:2,i:[{t:3}],s:"Moonshot.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"月之暗面"}}},novita:{description:{t:0,b:{t:2,i:[{t:3}],s:"novita.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Novita"}}},ollama:{description:{t:0,b:{t:2,i:[{t:3}],s:"ollama.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Ollama"}}},openai:{description:{t:0,b:{t:2,i:[{t:3}],s:"OpenAi.com"}},title:{t:0,b:{t:2,i:[{t:3}],s:"OpenAI"}}},openrouter:{description:{t:0,b:{t:2,i:[{t:3}],s:"OpenRouter.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"OpenRouter"}}},perplexity:{description:{t:0,b:{t:2,i:[{t:3}],s:"perplexity.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Perplexity"}}},together:{description:{t:0,b:{t:2,i:[{t:3}],s:"一起"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Together.ai"}}},vllm:{description:{t:0,b:{t:2,i:[{t:3}],s:"vllm.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"vLLM"}}},volcengine:{description:{t:0,b:{t:2,i:[{t:3}],s:"volcengine.com"}},fields:{field:{appId:{description:{t:0,b:{t:2,i:[{t:3}],s:"可在控制台获取的 App ID"}},label:{t:0,b:{t:2,i:[{t:3}],s:"App ID"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"火山引擎"}}},xai:{description:{t:0,b:{t:2,i:[{t:3}],s:"X.AI"}},title:{t:0,b:{t:2,i:[{t:3}],s:"xAI"}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"提供商"}}},scene:{description:{t:0,b:{t:2,i:[{t:3}],s:"配置角色所在环境"}},title:{t:0,b:{t:2,i:[{t:3}],s:"场景"}}},themes:{description:{t:0,b:{t:2,i:[{t:3}],s:"自定义你的舞台外观!"}},sections:{section:{"custom-color":{fields:{field:{"primary-color":{label:{t:0,b:{t:2,i:[{t:3}],s:"强调色"}},"rgb-on":{title:{t:0,b:{t:2,i:[{t:3}],s:"RGB ON!"}}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"配色"}}},developer:{title:{t:0,b:{t:2,i:[{t:3}],s:"开发者"}}},"theme-presets":{presets:[{colors:[{t:0,b:{t:2,i:[{t:3}],s:"Airi 绿"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"默认的绿色主题,由 Airi 为您带来!"}},title:{t:0,b:{t:2,i:[{t:3}],s:"默认颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"灰褐色"}},{t:0,b:{t:2,i:[{t:3}],s:"米色"}},{t:0,b:{t:2,i:[{t:3}],s:"灰白色"}},{t:0,b:{t:2,i:[{t:3}],s:"浅灰褐色"}},{t:0,b:{t:2,i:[{t:3}],s:"象牙色"}},{t:0,b:{t:2,i:[{t:3}],s:"橄榄灰"}},{t:0,b:{t:2,i:[{t:3}],s:"沙色"}},{t:0,b:{t:2,i:[{t:3}],s:"暖灰色"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"受乔治·莫兰迪绘画启发的柔和、低调的色调"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Morandi 颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"天蓝色"}},{t:0,b:{t:2,i:[{t:3}],s:"薄雾色"}},{t:0,b:{t:2,i:[{t:3}],s:"沙色"}},{t:0,b:{t:2,i:[{t:3}],s:"苔藓绿"}},{t:0,b:{t:2,i:[{t:3}],s:"睡莲色"}},{t:0,b:{t:2,i:[{t:3}],s:"小麦色"}},{t:0,b:{t:2,i:[{t:3}],s:"板岩蓝"}},{t:0,b:{t:2,i:[{t:3}],s:"鼠尾草色"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"受克劳德·莫奈作品启发的印象派调色板"}},title:{t:0,b:{t:2,i:[{t:3}],s:"莫奈颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"棕褐色"}},{t:0,b:{t:2,i:[{t:3}],s:"暖灰褐色"}},{t:0,b:{t:2,i:[{t:3}],s:"赭色"}},{t:0,b:{t:2,i:[{t:3}],s:"咖啡色"}},{t:0,b:{t:2,i:[{t:3}],s:"青铜色"}},{t:0,b:{t:2,i:[{t:3}],s:"金色"}},{t:0,b:{t:2,i:[{t:3}],s:"芥末色"}},{t:0,b:{t:2,i:[{t:3}],s:"琥珀色"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"传统日本色彩调色板"}},title:{t:0,b:{t:2,i:[{t:3}],s:"日本颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"北欧蓝"}},{t:0,b:{t:2,i:[{t:3}],s:"冰色"}},{t:0,b:{t:2,i:[{t:3}],s:"峡湾色"}},{t:0,b:{t:2,i:[{t:3}],s:"钢铁色"}},{t:0,b:{t:2,i:[{t:3}],s:"冰川色"}},{t:0,b:{t:2,i:[{t:3}],s:"板岩色"}},{t:0,b:{t:2,i:[{t:3}],s:"云色"}},{t:0,b:{t:2,i:[{t:3}],s:"石头色"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"北欧极简主义配色方案"}},title:{t:0,b:{t:2,i:[{t:3}],s:"北欧颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"霞光红"}},{t:0,b:{t:2,i:[{t:3}],s:"枣红"}},{t:0,b:{t:2,i:[{t:3}],s:"黄栌"}},{t:0,b:{t:2,i:[{t:3}],s:"竹青"}},{t:0,b:{t:2,i:[{t:3}],s:"乌梅紫"}},{t:0,b:{t:2,i:[{t:3}],s:"缃色"}},{t:0,b:{t:2,i:[{t:3}],s:"青冥"}},{t:0,b:{t:2,i:[{t:3}],s:"赭石"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"中国传统色彩,源自古代纺织品、瓷器和绘画"}},title:{t:0,b:{t:2,i:[{t:3}],s:"中国传统颜色"}}}],title:{t:0,b:{t:2,i:[{t:3}],s:"预设"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"外观"}}}},sections:{section:{general:{title:{t:0,b:{t:2,i:[{t:3}],s:"通用"}}}}},theme:{t:0,b:{t:2,i:[{t:3}],s:"主题"}},title:{t:0,b:{t:2,i:[{t:3}],s:"设置"}},voices:{t:0,b:{t:2,i:[{t:3}],s:"声线"}}},stage:{chat:{message:{"character-name":{airi:{t:0,b:{t:2,i:[{t:3}],s:"Airi"}},"core-system":{t:0,b:{t:2,i:[{t:3}],s:"核心系统"}},you:{t:0,b:{t:2,i:[{t:3}],s:"你"}}}},tabs:{chat:{t:0,b:{t:2,i:[{t:3}],s:"聊天"}},clothes:{t:0,b:{t:2,i:[{t:3}],s:"换装"}},custom:{t:0,b:{t:2,i:[{t:3}],s:"自定义"}}}},message:{t:0,b:{t:2,i:[{t:3}],s:"消息"}},operations:{"load-models":{t:0,b:{t:2,i:[{t:3}],s:"加载推理模型"}},"load-models-status":{loading:{t:0,b:{t:2,i:[{t:3}],s:"加载中"}},ready:{t:0,b:{t:2,i:[{t:3}],s:"已就绪"}}}},"select-a-audio-input":{t:0,b:{t:2,i:[{t:3}],s:"选择一个音频输入设备"}},"select-a-model":{t:0,b:{t:2,i:[{t:3}],s:"选择一个模型"}},"select-a-voice":{t:0,b:{t:2,i:[{t:3}],s:"选择一个声线"}},viewers:{"debug-menu":{emotions:{t:0,b:{t:2,i:[{t:3}],s:"表情"}},"emotions-btn":{angry:{t:0,b:{t:2,i:[{t:3}],s:"生气"}},awkward:{t:0,b:{t:2,i:[{t:3}],s:"尴尬"}},happy:{t:0,b:{t:2,i:[{t:3}],s:"开心"}},neutral:{t:0,b:{t:2,i:[{t:3}],s:"日常"}},question:{t:0,b:{t:2,i:[{t:3}],s:"疑问"}},sad:{t:0,b:{t:2,i:[{t:3}],s:"难过"}},surprised:{t:0,b:{t:2,i:[{t:3}],s:"惊喜"}},think:{t:0,b:{t:2,i:[{t:3}],s:"思考"}}},vrm:{camera:{t:0,b:{t:2,i:[{t:3}],s:"摄像机"}},model:{title:{t:0,b:{t:2,i:[{t:3}],s:"模型"}}}}}},waiting:{t:0,b:{t:2,i:[{t:3}],s:"等待中"}}}}}),W9=L9({locale:X9(),fallbackLocale:"en",messages:$A});function X9(){const n=localStorage.getItem("settings/language"),e=Object.keys($A);return n&&e.includes(n)?n:"en"}const $9=Cz(),q9=Uz(VV);let Qc;Qc=kV({routes:q9,history:pV()});Qc.beforeEach((n,e)=>{n.path!==e.path&&ww.start()});Qc.afterEach(()=>{ww.done()});Qc.isReady().then(async()=>{}).catch(()=>{});DR(G9).use(Sz).use(QR).use(Qc).use($9).use(W9).use(hB).mount("#app");export{ki as $,Z9 as A,TR as B,Rv as C,gC as D,aS as E,bT as F,De as G,ns as H,rs as I,de as J,Fa as K,or as L,e3 as M,mt as N,Dh as O,Kt as P,Jn as Q,Ww as R,uL as S,t3 as T,Md as U,B as V,Ce as W,ct as X,_h as Y,pG as Z,So as _,sr as a,LI as a$,zn as a0,nE as a1,jn as a2,li as a3,Ye as a4,Vn as a5,gt as a6,hL as a7,Tn as a8,K0 as a9,lg as aA,dL as aB,b_ as aC,Ef as aD,F0 as aE,ra as aF,en as aG,Ml as aH,ji as aI,nc as aJ,ic as aK,CL as aL,c3 as aM,f3 as aN,u3 as aO,ei as aP,vg as aQ,Fs as aR,AE as aS,Mo as aT,Nn as aU,VE as aV,HE as aW,GE as aX,cE as aY,wa as aZ,ht as a_,Ba as aa,A0 as ab,iG as ac,Pt as ad,dG as ae,Rc as af,Ii as ag,Xd as ah,_0 as ai,Dc as aj,$t as ak,Ao as al,ss as am,Ua as an,Zi as ao,yh as ap,Wt as aq,Bn as ar,Ct as as,sc as at,gh as au,zs as av,Ji as aw,gn as ax,gi as ay,wE as az,pn as b,En as b$,kI as b0,t_ as b1,An as b2,Gn as b3,c_ as b4,lE as b5,os as b6,vr as b7,fE as b8,dE as b9,wR as bA,lG as bB,FB as bC,gs as bD,Kv as bE,yG as bF,zV as bG,AR as bH,rG as bI,aG as bJ,mG as bK,H2 as bL,uG as bM,xG as bN,SG as bO,$w as bP,A_ as bQ,gG as bR,e0 as bS,K9 as bT,j9 as bU,V2 as bV,W2 as bW,J9 as bX,wn as bY,pf as bZ,ai as b_,aa as ba,vh as bb,gc as bc,e_ as bd,mc as be,pc as bf,Wc as bg,ft as bh,Os as bi,Gc as bj,iL as bk,dB as bl,Ez as bm,Do as bn,OV as bo,TT as bp,Ig as bq,lS as br,Va as bs,TG as bt,MG as bu,Er as bv,tG as bw,jt as bx,u2 as by,kB as bz,vi as c,Ds as c0,nG as c1,c2,Fn as c3,pr as c4,xi as c5,Q9 as c6,g0 as c7,AS as c8,bi as c9,sG as ca,oG as cb,S0 as cc,dr as cd,AG as ce,_c as cf,Tr as cg,we as ch,it as ci,C3 as cj,cL as ck,AL as cl,je as cm,CG as cn,cG as co,Di as cp,hn as cq,hG as cr,fG as cs,fn as d,EG as e,Oz as f,et as g,Ee as h,vG as i,wG as j,bG as k,Hn as l,f2 as m,Si as n,mn as o,_G as p,sp as q,eG as r,Nz as s,ut as t,Ot as u,AH as v,$e as w,Yl as x,mS as y,Oa as z}; +`}}},settings:{animations:{"stage-transitions":{title:{t:0,b:{t:2,i:[{t:3}],s:"是否开启舞台动画"}}},"use-page-specific-transitions":{description:{t:0,b:{t:2,i:[{t:3}],s:"某些页面会有自己的过场动画,这将覆盖舞台过场动画"}},title:{t:0,b:{t:2,i:[{t:3}],s:"是否使用页面特定过场动画"}}}},language:{chinese:{t:0,b:{t:2,i:[{t:3}],s:"简体中文"}},english:{t:0,b:{t:2,i:[{t:3}],s:"English"}},title:{t:0,b:{t:2,i:[{t:3}],s:"语言"}}},live2d:{"change-model":{"from-file":{t:0,b:{t:2,i:[{t:3}],s:"从文件加载"}},"from-file-select":{t:0,b:{t:2,i:[{t:3}],s:"选择"}},"from-url":{t:0,b:{t:2,i:[{t:3}],s:"从 URL 加载"}},"from-url-confirm":{t:0,b:{t:2,i:[{t:3}],s:"加载"}},"from-url-placeholder":{t:0,b:{t:2,i:[{t:3}],s:"输入 Live2D 模型 URL"}},title:{t:0,b:{t:2,i:[{t:3}],s:"更换模型"}}},"edit-motion-map":{title:{t:0,b:{t:2,i:[{t:3}],s:"编辑动作映射"}}},"map-motions":{play:{t:0,b:{t:2,i:[{t:3}],s:"播放动作"}},title:{t:0,b:{t:2,i:[{t:3}],s:"映射动作"}}},title:{t:0,b:{t:2,i:[{t:3}],s:"Live2D 设置"}}},microphone:{t:0,b:{t:2,i:[{t:3}],s:"麦克风"}},models:{t:0,b:{t:2,i:[{t:3}],s:"模型"}},pages:{card:{activate:{t:0,b:{t:2,i:[{t:3}],s:"激活"}},active:{t:0,b:{t:2,i:[{t:3}],s:"已激活"}},active_badge:{t:0,b:{t:2,i:[{t:3}],s:"当前使用中"}},cancel:{t:0,b:{t:2,i:[{t:3}],s:"取消"}},card_not_found:{t:0,b:{t:2,i:[{t:3}],s:"未找到角色卡"}},character:{t:0,b:{t:2,i:[{t:3}],s:"角色设定"}},close:{t:0,b:{t:2,i:[{t:3}],s:"关闭"}},consciousness:{model:{t:0,b:{t:2,i:[{t:3}],s:"意识 / 模型"}}},created_by:{t:0,b:{t:2,i:[{t:3}],s:"创建者"}},creator_notes:{t:0,b:{t:2,i:[{t:3}],s:"创建者笔记"}},delete:{t:0,b:{t:2,i:[{t:3}],s:"删除"}},delete_card:{t:0,b:{t:2,i:[{t:3}],s:"删除角色卡"}},delete_confirmation:{t:0,b:{t:2,i:[{t:3}],s:"确定要删除这张角色卡吗?"}},description:{t:0,b:{t:2,i:[{t:3}],s:"使用 Airi 角色卡预设"}},description_label:{t:0,b:{t:2,i:[{t:3}],s:"描述"}},drop_here:{t:0,b:{t:2,i:[{t:3}],s:"放开以上传文件"}},modules:{t:0,b:{t:2,i:[{t:3}],s:"模块"}},name_asc:{t:0,b:{t:2,i:[{t:3}],s:"名称 (A-Z)"}},name_desc:{t:0,b:{t:2,i:[{t:3}],s:"名称 (Z-A)"}},no_cards:{t:0,b:{t:2,i:[{t:3}],s:"还没有任何角色卡,点击上方按钮上传一个吧!"}},no_results:{t:0,b:{t:2,i:[{t:3}],s:"没有找到匹配的角色卡"}},personality:{t:0,b:{t:2,i:[{t:3}],s:"性格"}},posthistoryinstructions:{t:0,b:{t:2,i:[{t:3}],s:"历史提示指令"}},recent:{t:0,b:{t:2,i:[{t:3}],s:"最近添加"}},scenario:{t:0,b:{t:2,i:[{t:3}],s:"场景"}},search:{t:0,b:{t:2,i:[{t:3}],s:"搜索角色卡..."}},sort_by:{t:0,b:{t:2,i:[{t:3}],s:"排序方式"}},speech:{model:{t:0,b:{t:2,i:[{t:3}],s:"声音 / 模型"}},voice:{t:0,b:{t:2,i:[{t:3}],s:"声音 / 声线"}}},systemprompt:{t:0,b:{t:2,i:[{t:3}],s:"系统提示词"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Airi 角色卡"}},try_different_search:{t:0,b:{t:2,i:[{t:3}],s:"尝试使用其他关键词搜索"}},upload:{t:0,b:{t:2,i:[{t:3}],s:"上传"}},upload_desc:{t:0,b:{t:2,i:[{t:3}],s:"点击或拖拽文件到此处上传"}}},memory:{description:{t:0,b:{t:2,i:[{t:3}],s:"存放记忆的地方,以及策略"}},title:{t:0,b:{t:2,i:[{t:3}],s:"记忆体"}}},models:{description:{t:0,b:{t:2,i:[{t:3}],s:"切换角色的 Live2D,VRM 模型"}},title:{t:0,b:{t:2,i:[{t:3}],s:"角色模型"}}},modules:{consciousness:{description:{t:0,b:{t:2,i:[{t:3}],s:"人格设定、使用的模型等配置"}},sections:{section:{"provider-model-selection":{collapse:{t:0,b:{t:2,i:[{t:3}],s:"折叠"}},custom_model_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入自订模型名字"}},description:{t:0,b:{t:2,i:[{t:3}],s:"为意识选择合适的 LLM 提供商"}},error:{t:0,b:{t:2,i:[{t:3}],s:"获取出错啦"}},expand:{t:0,b:{t:2,i:[{t:3}],s:"展开"}},loading:{t:0,b:{t:2,i:[{t:3}],s:"获取模型中..."}},manual_model_name:{t:0,b:{t:2,i:[{t:3}],s:"模型名字"}},manual_model_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入与该提供商一起使用的模型名字"}},no_models:{t:0,b:{t:2,i:[{t:3}],s:"没有任何可用的模型"}},no_models_description:{t:0,b:{t:2,i:[{t:3}],s:"该提供商的模型列表没有返回任何的数据"}},no_search_results:{t:0,b:{t:2,i:[{t:3}],s:"没有匹配的模型"}},no_search_results_description:{t:0,b:{t:2,i:[{t:3,v:"没有模型匹配 '"},{t:4,k:"query"},{t:3,v:"' 关键字,请尝试一下别的关键词呢"}]}},not_supported:{t:0,b:{t:2,i:[{t:3}],s:"无法列出模型"}},not_supported_description:{t:0,b:{t:2,i:[{t:3}],s:"此提供商不支持列出模型的功能"}},search_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"搜索模型..."}},search_results:{t:0,b:{t:2,i:[{t:3,v:"找到 "},{t:4,k:"count"},{t:3,v:" / "},{t:4,k:"total"},{t:3,v:" 个模型"}]}},show_less:{t:0,b:{t:2,i:[{t:3}],s:"显示更多"}},show_more:{t:0,b:{t:2,i:[{t:3}],s:"收起"}},subtitle:{t:0,b:{t:2,i:[{t:3}],s:"选择一个模型"}},title:{t:0,b:{t:2,i:[{t:3}],s:"模型"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"意识"}}},description:{t:0,b:{t:2,i:[{t:3}],s:"思维,视觉,言语综合,游戏等"}},"gaming-factorio":{description:{t:0,b:{t:2,i:[{t:3}],s:"一起玩 Factorio!"}},title:{t:0,b:{t:2,i:[{t:3}],s:"异星工厂 Factorio"}}},"gaming-minecraft":{description:{t:0,b:{t:2,i:[{t:3}],s:"一起 Minecraft!"}},title:{t:0,b:{t:2,i:[{t:3}],s:"我的世界 Minecraft"}}},hearing:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音识别"}},title:{t:0,b:{t:2,i:[{t:3}],s:"听觉"}}},"memory-long-term":{description:{t:0,b:{t:2,i:[{t:3}],s:"长期记忆"}},title:{t:0,b:{t:2,i:[{t:3}],s:"长期记忆"}}},"memory-short-term":{description:{t:0,b:{t:2,i:[{t:3}],s:"短期记忆"}},title:{t:0,b:{t:2,i:[{t:3}],s:"短期记忆"}}},"messaging-discord":{description:{t:0,b:{t:2,i:[{t:3}],s:"Discord 发消息和语音聊天"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Discord"}}},speech:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音合成"}},sections:{section:{playground:{buttons:{stop:{label:{t:0,b:{t:2,i:[{t:3}],s:"停止"}}}},"select-voice":{required:{t:0,b:{t:2,i:[{t:3}],s:"请选择声线"}}}},"provider-voice-selection":{custom_model_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入指定模型名字..."}},custom_voice_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入指定声线 ID..."}},description:{t:0,b:{t:2,i:[{t:3}],s:"选择合适的语音提供商"}},no_models:{t:0,b:{t:2,i:[{t:3}],s:"没有任何可用的模型"}},no_models_description:{t:0,b:{t:2,i:[{t:3}],s:"该提供商的模型列表没有返回任何的数据"}},no_voices:{t:0,b:{t:2,i:[{t:3}],s:"没有任何可用的声线"}},no_voices_description:{t:0,b:{t:2,i:[{t:3}],s:"该提供商的声线列表没有返回任何的数据"}},pause:{t:0,b:{t:2,i:[{t:3}],s:"Pause"}},play_sample:{t:0,b:{t:2,i:[{t:3}],s:"Play"}},search_models_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"搜索模型..."}},search_models_results:{t:0,b:{t:2,i:[{t:3,v:"找到 "},{t:4,k:"count"},{t:3,v:" / "},{t:4,k:"total"},{t:3,v:" 个模型"}]}},search_voices_placeholder:{t:0,b:{t:2,i:[{t:3}],s:"搜索声线..."}},search_voices_results:{t:0,b:{t:2,i:[{t:3,v:"找到 "},{t:4,k:"count"},{t:3,v:" / "},{t:4,k:"total"},{t:3,v:" 个声线"}]}},show_less:{t:0,b:{t:2,i:[{t:3}],s:"显示更少"}},show_more:{t:0,b:{t:2,i:[{t:3}],s:"显示更多"}},title:{t:0,b:{t:2,i:[{t:3}],s:"选择语音合成提供商"}}},"voice-settings":{"input-ssml":{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请输入 SSML 文本"}}},"use-ssml":{description:{t:0,b:{t:2,i:[{t:3}],s:"启用后可以输入原始 SSML 而不是纯文本"}},label:{t:0,b:{t:2,i:[{t:3}],s:"选用自定义 SSML"}}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"发声"}}},title:{t:0,b:{t:2,i:[{t:3}],s:"机体模块"}},vision:{description:{t:0,b:{t:2,i:[{t:3}],s:"视觉"}},title:{t:0,b:{t:2,i:[{t:3}],s:"视觉"}}},x:{description:{t:0,b:{t:2,i:[{t:3}],s:"X / Twitter 的浏览和使用"}},title:{t:0,b:{t:2,i:[{t:3}],s:"X / Twitter"}}}},providers:{common:{fields:{field:{"api-key":{label:{t:0,b:{t:2,i:[{t:3}],s:"API 密钥"}}}}},section:{advanced:{fields:{field:{headers:{description:{t:0,b:{t:2,i:[{t:3}],s:"添加自定义 HTTP 标头"}},key:{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请求头名字"}}},label:{t:0,b:{t:2,i:[{t:3}],s:"HTTP 请求头"}},value:{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请求头数值"}}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"高级配置"}}},basic:{description:{t:0,b:{t:2,i:[{t:3}],s:"基本设置"}},title:{t:0,b:{t:2,i:[{t:3}],s:"基础配置"}}},voice:{title:{t:0,b:{t:2,i:[{t:3}],s:"声音配置"}}}}},description:{t:0,b:{t:2,i:[{t:3}],s:"LLM,语音合成,语音识别提供商等"}},provider:{"alibaba-cloud-model-studio":{description:{t:0,b:{t:2,i:[{t:3}],s:"bailian.console.aliyun.com"}},title:{t:0,b:{t:2,i:[{t:3}],s:"阿里百炼"}}},anthropic:{description:{t:0,b:{t:2,i:[{t:3}],s:"anthropic.com"}},title:{t:0,b:{t:1,c:[{t:2,i:[{t:3}],s:"Anthropic"},{t:2,i:[{t:3}],s:"Claude"}]}}},"cloudflare-workers-ai":{description:{t:0,b:{t:2,i:[{t:3}],s:"Cloudflare.com"}},fields:{field:{"account-id":{description:{t:0,b:{t:2,i:[{t:3}],s:"Cloudflare 帐户 ID"}},label:{t:0,b:{t:2,i:[{t:3}],s:"Cloudflare Account ID"}},placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请输入 Cloudflare Account ID"}}},"api-key":{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"请输入 Cloudflare Workers AI 的 API Key"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"Workers AI"}}},common:{fields:{field:{pitch:{description:{t:0,b:{t:2,i:[{t:3}],s:"调节合成语音的音高(比如更尖锐或更粗旷)"}},label:{t:0,b:{t:2,i:[{t:3}],s:"音高"}}},speed:{description:{t:0,b:{t:2,i:[{t:3}],s:"调节说话的语速"}},label:{t:0,b:{t:2,i:[{t:3}],s:"语速"}}},volume:{description:{t:0,b:{t:2,i:[{t:3}],s:"调节语音的响度"}},label:{t:0,b:{t:2,i:[{t:3}],s:"响度"}}}}}},deepseek:{description:{t:0,b:{t:2,i:[{t:3}],s:"DeepSeek.com"}},title:{t:0,b:{t:2,i:[{t:3}],s:"深度求索 DeepSeek"}}},elevenlabs:{description:{t:0,b:{t:2,i:[{t:3}],s:"Elevenlabs.io"}},fields:{field:{"simularity-boost":{description:{t:0,b:{t:2,i:[{t:3}],s:"声音相似性依从性"}},label:{t:0,b:{t:2,i:[{t:3}],s:"相似度修正"}}},"speaker-boost":{description:{t:0,b:{t:2,i:[{t:3}],s:"增强说话者的相似性"}},label:{t:0,b:{t:2,i:[{t:3}],s:"扬声器增强"}}},speed:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音生成速度"}},label:{t:0,b:{t:2,i:[{t:3}],s:"语速"}}},stability:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音稳定性和随机性"}},label:{t:0,b:{t:2,i:[{t:3}],s:"稳定性"}}},style:{description:{t:0,b:{t:2,i:[{t:3}],s:"语音风格夸张"}},label:{t:0,b:{t:2,i:[{t:3}],s:"风格"}}}}},playground:{buttons:{button:{"test-voice":{generating:{t:0,b:{t:2,i:[{t:3}],s:"生成中..."}},label:{t:0,b:{t:2,i:[{t:3}],s:"测试声音"}}}}},fields:{field:{input:{placeholder:{t:0,b:{t:2,i:[{t:3}],s:"输入用于测试发音的文本"}}},language:{description:{t:0,b:{t:2,i:[{t:3}],s:"选择语音语言"}},label:{t:0,b:{t:2,i:[{t:3}],s:"语言"}}},voice:{description:{t:0,b:{t:2,i:[{t:3}],s:"选择首选语音"}},label:{t:0,b:{t:2,i:[{t:3}],s:"声线"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"实验平台"}},validation:{"error-missing-api-key":{t:0,b:{t:2,i:[{t:3}],s:"需要填写 API Key 才能用哦!"}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"ElevenLabs (11labs)"}}},fireworks:{description:{t:0,b:{t:2,i:[{t:3}],s:"Fireworks.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Fireworks.ai"}}},"microsoft-speech":{description:{t:0,b:{t:2,i:[{t:3}],s:"speech.microsoft.com"}},fields:{field:{region:{description:{t:0,b:{t:2,i:[{t:3}],s:"服务 Endpoint 地区(比如亚太 eastasia 区域)"}},label:{t:0,b:{t:2,i:[{t:3}],s:"Endpoint 地区"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"Microsoft / Azure 语音服务"}}},mistral:{description:{t:0,b:{t:2,i:[{t:3}],s:"mistral.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Mistral"}}},moonshot:{description:{t:0,b:{t:2,i:[{t:3}],s:"Moonshot.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"月之暗面"}}},novita:{description:{t:0,b:{t:2,i:[{t:3}],s:"novita.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Novita"}}},ollama:{description:{t:0,b:{t:2,i:[{t:3}],s:"ollama.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Ollama"}}},openai:{description:{t:0,b:{t:2,i:[{t:3}],s:"OpenAi.com"}},title:{t:0,b:{t:2,i:[{t:3}],s:"OpenAI"}}},openrouter:{description:{t:0,b:{t:2,i:[{t:3}],s:"OpenRouter.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"OpenRouter"}}},perplexity:{description:{t:0,b:{t:2,i:[{t:3}],s:"perplexity.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Perplexity"}}},together:{description:{t:0,b:{t:2,i:[{t:3}],s:"一起"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Together.ai"}}},vllm:{description:{t:0,b:{t:2,i:[{t:3}],s:"vllm.ai"}},title:{t:0,b:{t:2,i:[{t:3}],s:"vLLM"}}},volcengine:{description:{t:0,b:{t:2,i:[{t:3}],s:"volcengine.com"}},fields:{field:{appId:{description:{t:0,b:{t:2,i:[{t:3}],s:"可在控制台获取的 App ID"}},label:{t:0,b:{t:2,i:[{t:3}],s:"App ID"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"火山引擎"}}},xai:{description:{t:0,b:{t:2,i:[{t:3}],s:"X.AI"}},title:{t:0,b:{t:2,i:[{t:3}],s:"xAI"}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"提供商"}}},scene:{description:{t:0,b:{t:2,i:[{t:3}],s:"配置角色所在环境"}},title:{t:0,b:{t:2,i:[{t:3}],s:"场景"}}},themes:{description:{t:0,b:{t:2,i:[{t:3}],s:"自定义你的舞台外观!"}},sections:{section:{"custom-color":{fields:{field:{"primary-color":{label:{t:0,b:{t:2,i:[{t:3}],s:"强调色"}},"rgb-on":{title:{t:0,b:{t:2,i:[{t:3}],s:"RGB ON!"}}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"配色"}}},developer:{title:{t:0,b:{t:2,i:[{t:3}],s:"开发者"}}},"theme-presets":{presets:[{colors:[{t:0,b:{t:2,i:[{t:3}],s:"Airi 绿"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"默认的绿色主题,由 Airi 为您带来!"}},title:{t:0,b:{t:2,i:[{t:3}],s:"默认颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"灰褐色"}},{t:0,b:{t:2,i:[{t:3}],s:"米色"}},{t:0,b:{t:2,i:[{t:3}],s:"灰白色"}},{t:0,b:{t:2,i:[{t:3}],s:"浅灰褐色"}},{t:0,b:{t:2,i:[{t:3}],s:"象牙色"}},{t:0,b:{t:2,i:[{t:3}],s:"橄榄灰"}},{t:0,b:{t:2,i:[{t:3}],s:"沙色"}},{t:0,b:{t:2,i:[{t:3}],s:"暖灰色"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"受乔治·莫兰迪绘画启发的柔和、低调的色调"}},title:{t:0,b:{t:2,i:[{t:3}],s:"Morandi 颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"天蓝色"}},{t:0,b:{t:2,i:[{t:3}],s:"薄雾色"}},{t:0,b:{t:2,i:[{t:3}],s:"沙色"}},{t:0,b:{t:2,i:[{t:3}],s:"苔藓绿"}},{t:0,b:{t:2,i:[{t:3}],s:"睡莲色"}},{t:0,b:{t:2,i:[{t:3}],s:"小麦色"}},{t:0,b:{t:2,i:[{t:3}],s:"板岩蓝"}},{t:0,b:{t:2,i:[{t:3}],s:"鼠尾草色"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"受克劳德·莫奈作品启发的印象派调色板"}},title:{t:0,b:{t:2,i:[{t:3}],s:"莫奈颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"棕褐色"}},{t:0,b:{t:2,i:[{t:3}],s:"暖灰褐色"}},{t:0,b:{t:2,i:[{t:3}],s:"赭色"}},{t:0,b:{t:2,i:[{t:3}],s:"咖啡色"}},{t:0,b:{t:2,i:[{t:3}],s:"青铜色"}},{t:0,b:{t:2,i:[{t:3}],s:"金色"}},{t:0,b:{t:2,i:[{t:3}],s:"芥末色"}},{t:0,b:{t:2,i:[{t:3}],s:"琥珀色"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"传统日本色彩调色板"}},title:{t:0,b:{t:2,i:[{t:3}],s:"日本颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"北欧蓝"}},{t:0,b:{t:2,i:[{t:3}],s:"冰色"}},{t:0,b:{t:2,i:[{t:3}],s:"峡湾色"}},{t:0,b:{t:2,i:[{t:3}],s:"钢铁色"}},{t:0,b:{t:2,i:[{t:3}],s:"冰川色"}},{t:0,b:{t:2,i:[{t:3}],s:"板岩色"}},{t:0,b:{t:2,i:[{t:3}],s:"云色"}},{t:0,b:{t:2,i:[{t:3}],s:"石头色"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"北欧极简主义配色方案"}},title:{t:0,b:{t:2,i:[{t:3}],s:"北欧颜色"}}},{colors:[{t:0,b:{t:2,i:[{t:3}],s:"霞光红"}},{t:0,b:{t:2,i:[{t:3}],s:"枣红"}},{t:0,b:{t:2,i:[{t:3}],s:"黄栌"}},{t:0,b:{t:2,i:[{t:3}],s:"竹青"}},{t:0,b:{t:2,i:[{t:3}],s:"乌梅紫"}},{t:0,b:{t:2,i:[{t:3}],s:"缃色"}},{t:0,b:{t:2,i:[{t:3}],s:"青冥"}},{t:0,b:{t:2,i:[{t:3}],s:"赭石"}}],description:{t:0,b:{t:2,i:[{t:3}],s:"中国传统色彩,源自古代纺织品、瓷器和绘画"}},title:{t:0,b:{t:2,i:[{t:3}],s:"中国传统颜色"}}}],title:{t:0,b:{t:2,i:[{t:3}],s:"预设"}}}}},title:{t:0,b:{t:2,i:[{t:3}],s:"外观"}}}},sections:{section:{general:{title:{t:0,b:{t:2,i:[{t:3}],s:"通用"}}}}},theme:{t:0,b:{t:2,i:[{t:3}],s:"主题"}},title:{t:0,b:{t:2,i:[{t:3}],s:"设置"}},voices:{t:0,b:{t:2,i:[{t:3}],s:"声线"}}},stage:{chat:{message:{"character-name":{airi:{t:0,b:{t:2,i:[{t:3}],s:"Airi"}},"core-system":{t:0,b:{t:2,i:[{t:3}],s:"核心系统"}},you:{t:0,b:{t:2,i:[{t:3}],s:"你"}}}},tabs:{chat:{t:0,b:{t:2,i:[{t:3}],s:"聊天"}},clothes:{t:0,b:{t:2,i:[{t:3}],s:"换装"}},custom:{t:0,b:{t:2,i:[{t:3}],s:"自定义"}}}},message:{t:0,b:{t:2,i:[{t:3}],s:"消息"}},operations:{"load-models":{t:0,b:{t:2,i:[{t:3}],s:"加载推理模型"}},"load-models-status":{loading:{t:0,b:{t:2,i:[{t:3}],s:"加载中"}},ready:{t:0,b:{t:2,i:[{t:3}],s:"已就绪"}}}},"select-a-audio-input":{t:0,b:{t:2,i:[{t:3}],s:"选择一个音频输入设备"}},"select-a-model":{t:0,b:{t:2,i:[{t:3}],s:"选择一个模型"}},"select-a-voice":{t:0,b:{t:2,i:[{t:3}],s:"选择一个声线"}},viewers:{"debug-menu":{emotions:{t:0,b:{t:2,i:[{t:3}],s:"表情"}},"emotions-btn":{angry:{t:0,b:{t:2,i:[{t:3}],s:"生气"}},awkward:{t:0,b:{t:2,i:[{t:3}],s:"尴尬"}},happy:{t:0,b:{t:2,i:[{t:3}],s:"开心"}},neutral:{t:0,b:{t:2,i:[{t:3}],s:"日常"}},question:{t:0,b:{t:2,i:[{t:3}],s:"疑问"}},sad:{t:0,b:{t:2,i:[{t:3}],s:"难过"}},surprised:{t:0,b:{t:2,i:[{t:3}],s:"惊喜"}},think:{t:0,b:{t:2,i:[{t:3}],s:"思考"}}},vrm:{camera:{t:0,b:{t:2,i:[{t:3}],s:"摄像机"}},model:{title:{t:0,b:{t:2,i:[{t:3}],s:"模型"}}}}}},waiting:{t:0,b:{t:2,i:[{t:3}],s:"等待中"}}}}}),X9=D9({locale:$9(),fallbackLocale:"en",messages:qA});function $9(){const n=localStorage.getItem("settings/language"),e=Object.keys(qA);return n&&e.includes(n)?n:"en"}const q9=Rz(),Y9=Fz(HV);let Qc;Qc=BV({routes:Y9,history:mV()});Qc.beforeEach((n,e)=>{n.path!==e.path&&Aw.start()});Qc.afterEach(()=>{Aw.done()});Qc.isReady().then(async()=>{}).catch(()=>{});OR(W9).use(Ez).use(e3).use(Qc).use(q9).use(X9).use(pB).mount("#app");export{ki as $,Z9 as A,wR as B,Rv as C,_C as D,lS as E,xT as F,De as G,ns as H,rs as I,de as J,Fa as K,or as L,t3 as M,mt as N,Dh as O,Kt as P,Jn as Q,Xw as R,fL as S,n3 as T,Md as U,B as V,Ce as W,ct as X,_h as Y,pG as Z,So as _,sr as a,DI as a$,zn as a0,iE as a1,jn as a2,li as a3,Ye as a4,Vn as a5,gt as a6,pL as a7,Tn as a8,K0 as a9,lg as aA,hL as aB,b_ as aC,Ef as aD,F0 as aE,ra as aF,en as aG,Ml as aH,ji as aI,nc as aJ,ic as aK,RL as aL,u3 as aM,d3 as aN,f3 as aO,ei as aP,vg as aQ,Fs as aR,CE as aS,Mo as aT,Nn as aU,HE as aV,GE as aW,WE as aX,uE as aY,wa as aZ,ht as a_,Ba as aa,A0 as ab,iG as ac,Pt as ad,dG as ae,Rc as af,Pi as ag,Xd as ah,_0 as ai,Dc as aj,$t as ak,Ao as al,ss as am,Ua as an,Zi as ao,yh as ap,Wt as aq,Bn as ar,Ct as as,sc as at,gh as au,zs as av,Ji as aw,gn as ax,gi as ay,AE as az,pn as b,En as b$,BI as b0,t_ as b1,An as b2,Gn as b3,c_ as b4,cE as b5,os as b6,vr as b7,dE as b8,hE as b9,AR as bA,lG as bB,kB as bC,gs as bD,Kv as bE,yG as bF,VV as bG,CR as bH,rG as bI,aG as bJ,mG as bK,G2 as bL,uG as bM,xG as bN,SG as bO,qw as bP,A_ as bQ,gG as bR,e0 as bS,rS as bT,K9 as bU,H2 as bV,X2 as bW,J9 as bX,wn as bY,pf as bZ,ai as b_,aa as ba,vh as bb,gc as bc,e_ as bd,mc as be,pc as bf,Wc as bg,ft as bh,Os as bi,Gc as bj,sL as bk,hB as bl,Tz as bm,Do as bn,NV as bo,wT as bp,Ig as bq,cS as br,Va as bs,TG as bt,MG as bu,Er as bv,tG as bw,jt as bx,f2 as by,BB as bz,vi as c,Ds as c0,nG as c1,u2 as c2,Fn as c3,pr as c4,Ui as c5,Q9 as c6,g0 as c7,CS as c8,bi as c9,sG as ca,oG as cb,S0 as cc,dr as cd,AG as ce,_c as cf,Tr as cg,we as ch,st as ci,R3 as cj,uL as ck,CL as cl,je as cm,CG as cn,cG as co,Li as cp,hn as cq,hG as cr,fG as cs,fn as d,EG as e,Nz as f,et as g,Ee as h,vG as i,wG as j,bG as k,Hn as l,d2 as m,Mi as n,mn as o,_G as p,sp as q,eG as r,Uz as s,ut as t,Ot as u,CH as v,$e as w,Yl as x,gS as y,Oa as z}; diff --git a/assets/index-DFm202zN.css b/assets/index-DFm202zN.css new file mode 100644 index 0000000000000000000000000000000000000000..6a23312290e8e246c00c773a69e92f594b95cd99 --- /dev/null +++ b/assets/index-DFm202zN.css @@ -0,0 +1 @@ +.cross-background-container[data-v-0a776b22]{background-color:#fff;--cross-color: oklch(.85 calc(var(--theme-colors-chroma) * .3) var(--theme-colors-hue) / .2);background:radial-gradient(circle,transparent 20%,#ffffff 20%,#ffffff 80%,transparent 80%,transparent),radial-gradient(circle,transparent 20%,#ffffff 20%,#ffffff 80%,transparent 80%,transparent) 25px 25px,linear-gradient(var(--cross-color) 2px,transparent 2px) 0 -1px,linear-gradient(90deg,var(--cross-color) 2px,#ffffff 2px) -1px 0;background-size:50px 50px,50px 50px,25px 25px,25px 25px}.dark .cross-background-container[data-v-0a776b22]{background-color:#121212;--cross-color: oklch(.2 calc(var(--theme-colors-chroma) * .3) var(--theme-colors-hue));background:radial-gradient(circle,transparent 20%,#121212 20%,#121212 80%,transparent 80%,transparent),radial-gradient(circle,transparent 20%,#121212 20%,#121212 80%,transparent 80%,transparent) 25px 25px,linear-gradient(var(--cross-color) 2px,transparent 2px) 0 -1px,linear-gradient(90deg,var(--cross-color) 2px,#121212 2px) -1px 0;background-size:50px 50px,50px 50px,25px 25px,25px 25px}.animate-stripe[data-v-1f3e13c7]{background-image:repeating-linear-gradient(-45deg,#a16207,#a16207 25px,#eab308 25px,#eab308 50px);background-size:175% 100%}.animate-stripe[data-v-1f3e13c7]:hover{animation:progress-1f3e13c7 2s linear infinite}@-webkit-keyframes progress-1f3e13c7{0%{background-position:0 0}to{background-position:-75px 0px}}@-moz-keyframes progress-1f3e13c7{0%{background-position:0 0}to{background-position:-75px 0px}}@-ms-keyframes progress-1f3e13c7{0%{background-position:0 0}to{background-position:-75px 0px}}@keyframes progress-1f3e13c7{0%{background-position:0 0}to{background-position:-70px 0px}}@keyframes wave-animation-d4cf94d8{0%{transform:translate(0)}to{transform:translate(var(--wave-translate, -250px))}}.wave[data-v-d4cf94d8]{width:200vw;mask-repeat:repeat-x;-webkit-mask-repeat:repeat-x;will-change:transform;animation:wave-animation-d4cf94d8 var(--animation-duration, 5s) linear infinite} diff --git a/assets/index-DFvxq5hp.js b/assets/index-DFvxq5hp.js deleted file mode 100644 index f1588169682eddd4f54bb1e944bf1638068223b1..0000000000000000000000000000000000000000 --- a/assets/index-DFvxq5hp.js +++ /dev/null @@ -1,532 +0,0 @@ -import{f as $n,g as W,h as je,s as qe,t as vs,d as Be,i as bs,j as ws,k as Qr,w as Fe,l as pn,c as re,o as Q,m as gn,p as ks,q as Qt,v as Wt,x as Xt,y as Ue,b as ke,a as O,z as st,A as At,B as Zr,C as it,D as he,u as V,M as yt,T as _t,E as Jr,F as Yn,G as Yo,Z as On,H as Ot,I as Ts,V as ae,S as Ei,Q as Bn,O as Gt,J as Pe,P as Et,K as _s,L as qo,N as hn,U as ei,W as ze,X as Ko,Y as Wo,_ as ti,$ as yn,a0 as As,a1 as ni,a2 as Es,a3 as Xo,a4 as xt,a5 as ri,a6 as Mt,a7 as Ms,a8 as Qo,a9 as Dt,aa as Zo,ab as Ss,ac as Is,ad as Rs,ae as Cs,af as Jo,ag as qn,ah as Ns,ai as Ls,aj as Ps,ak as Pt,al as Ds,am as Os,an as Bs,ao as Fs,ap as er,aq as Fn,ar as Cr,as as Nt,at as ea,au as Nr,av as Vt,aw as Mi,ax as Lt,ay as Ht,az as tr,aA as zs,aB as Us,aC as js,aD as Vs,aE as ta,aF as na,aG as zn,aH as ra,aI as ii,aJ as Un,aK as ia,aL as Hs,n as Lr,aM as Gs,aN as Pr,aO as oa,aP as $s,aQ as cn,aR as aa,aS as ft,aT as vt,aU as mn,aV as Ys,aW as qs,aX as Ks,aY as Ws,aZ as Xs,a_ as oi,a$ as Qs,b0 as Zs,b1 as Js,b2 as nr,b3 as el,b4 as sa,b5 as tl,b6 as nl,b7 as rl,b8 as il,b9 as ol,ba as rr,bb as al,bc as sl,bd as ll,be as Si,bf as Ii,bg as Ri,bh as Ci,bi as ul,bj as cl,bk as fl,bl as dl,bm as pl,bn as Kn,bo as hl,bp as la,bq as ml,br as gl,bs as yl,bt as xl,bu as ua,bv as jn,bw as ca,bx as ai,by as si,bz as vl,bA as ir,bB as bl,bC as wl}from"./index-20XXNHAB.js";import{V as kl,a as Tl,c as _l,r as Al,b as Dr,d as El,E as Ni,e as Ml,f as Sl,g as Il,s as Rl,h as Cl,i as Nl}from"./live2d-zip-loader-52aPyiCh.js";import{getImportUrlBundles as Ll}from"./import-url-browser-CPN8ipMD.js";import{s as $t,c as Li,u as Pl,g as Dl}from"./speech-CF8Au8j4.js";import{u as or}from"./queue-DpWku5ab.js";import{u as Ol,a as Bl,b as Fl,l as zl}from"./queues-DD-Guues.js";import{l as Ul,u as li}from"./providers-BqZLRXH1.js";import{s as jl}from"./index-D975M2PQ.js";import{u as Vl}from"./airi-card-DmHEm3BO.js";import{_ as Hl,a as Gl,r as on}from"./Model.vue_vue_type_script_setup_true_lang-CCvvNTt3.js";import{_ as ui}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import{_ as Pi}from"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import{H as $l}from"./HeaderLink-Ctrr6qTq.js";import{_ as fa}from"./Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js";import{u as da}from"./consciousness-D04GkOp_.js";import{d as Di}from"./index-B2mNUwLE.js";import{b as Oi}from"./route-block-B_A1xBdJ.js";import"./duckdb-mvp-CaaD-olE.js";import"./index-Be1NqeGb.js";async function*Yl(t,e){const n=t.getReader();try{for(;;){const{done:r,value:i}=await n.read();if(r)return;yield e(i)}}finally{n.releaseLock()}}function ql(t){const e=new Uint8Array(t.frequencyBinCount);t.getByteFrequencyData(e);const n=[];for(let i=0;i<700;i+=80)n.push(e[i]);return e.map(i=>i**1.2).map(i=>i*1.2).reduce((i,o)=>i+o,0)/e.length/100}function Kl(t){const e=new Uint8Array(t.frequencyBinCount);t.getByteFrequencyData(e);const n=[];for(let u=0;u<700;u+=80)n.push(e[u]);const r=e.map(u=>u**1.5),i=Math.min(...r),a=Math.max(...r)-i;let s;return a===0?s=r.map(()=>0):s=r.map(u=>(u-i)/a),s.reduce((u,c)=>u+c,0)/e.length}function Wl(t,e="linear"){switch(e){case"linear":return ql(t);case"minmax":return Kl(t)}}const pa=$n("AudioContext",()=>({audioContext:new AudioContext,calculateVolume:Wl})),Xl=$n("SpeakingStore",()=>{const n=W(0),r=W(!1),i=je(()=>r.value?(30+70*n.value)/100:30);return{mouthOpenSize:n,nowSpeaking:r,nowSpeakingAvatarBorderOpacity:i}});function _n(t,e,n){return e+n<0||e+n>=t.length-1?"":t[e+n]}function Ql(t){let e="literal",n="";return{async consume(r){var i,o,a;for(let s=0;s"?(l+=_n(r,s,1),u="literal",s++):l==="<"?u="special":l===">"&&(u="literal"),e==="literal"&&u==="special"?n!==""&&(await((i=t.onLiteral)==null?void 0:i.call(t,n)),n=""):e==="special"&&u==="literal"&&n!==""&&(n+=l,await((o=t.onSpecial)==null?void 0:o.call(t,n)),n=""),e==="literal"&&u==="literal"?(await((a=t.onLiteral)==null?void 0:a.call(t,l)),n=""):e==="special"&&u==="literal"?n="":n+=l,e=u}},async end(){var r,i;n!==""&&(e==="literal"?await((r=t.onLiteral)==null?void 0:r.call(t,n)):n.endsWith("|>")&&await((i=t.onSpecial)==null?void 0:i.call(t,n)))}}}const Zl=$n("llm",()=>{async function t(n,r,i,o){const a=o==null?void 0:o.headers;return await jl({...r.chat(n),messages:i,headers:a})}async function e(n,r){if(n==="")return[];try{return await Ul({baseURL:n.endsWith("/")?n:`${n}/`,apiKey:r})}catch(i){if(String(i).includes("Failed to construct 'URL': Invalid URL"))return[];throw i}}return{models:e,stream:t}}),St=$n("chat",()=>{const{stream:t}=Zl(),{systemPrompt:e}=qe(Vl()),n=W(!1),r=W([]),i=W([]),o=W([]),a=W([]),s=W([]),l=W([]),u=W([]),c=W([]);function f(h){r.value.push(h)}function p(h){i.value.push(h)}function d(h){o.value.push(h)}function y(h){a.value.push(h)}function x(h){s.value.push(h)}function v(h){l.value.push(h)}function k(h){u.value.push(h)}function M(h){c.value.push(h)}const A=W([{role:"system",content:e.value}]),C=W({role:"assistant",content:""});async function P(h,I){var b;try{if(n.value=!0,!h)return;for(const D of r.value)await D(h);C.value={role:"assistant",content:""},A.value.push({role:"user",content:h}),A.value.push(C.value);const g=A.value.slice(0,A.value.length-1).map(D=>vs(D));for(const D of i.value)await D(h);for(const D of o.value)await D(h);const m=((b=I.providerConfig)==null?void 0:b.headers)||{},T=await t(I.model,I.chatProvider,g,{headers:m});for(const D of a.value)await D(h);let S="";const F=Ql({onLiteral:async D=>{for(const B of s.value)await B(D);C.value.content+=D},onSpecial:async D=>{for(const B of l.value)await B(D)}});for await(const D of Yl(T.textStream,async B=>B))S+=D,await F.consume(D);await F.end();for(const D of u.value)await D();for(const D of c.value)await D(S);console.debug("LLM output:",S)}catch(g){throw console.error("Error sending message:",g),g}finally{n.value=!1}}return{sending:n,messages:A,streamingMessage:C,send:P,onBeforeMessageComposed:f,onAfterMessageComposed:p,onBeforeSend:d,onAfterSend:y,onTokenLiteral:x,onTokenSpecial:v,onStreamEnd:k,onAssistantResponseEnd:M}}),ha=Be({__name:"Screen",setup(t){const e=W(),n=bs(ks),{width:r,height:i}=ws(),o=Qr(e,{immediate:!0,windowResize:!0,reset:!0}),a=je(()=>n.between("sm","md").value||n.smaller("sm").value),s=je(()=>n.between("md","lg").value),l=je(()=>n.greaterOrEqual("lg").value),u=je(()=>l.value?o.width.value:a.value||s.value?r.value-16:o.width.value),c=W(0);return Fe([r,i,e],()=>{var p,d;const f=(d=(p=e.value)==null?void 0:p.parentElement)==null?void 0:d.getBoundingClientRect();l.value||a.value||s.value?c.value=(f==null?void 0:f.height)||0:c.value=600}),Fe([o.width,o.height],()=>{l.value||a.value||s.value?c.value=o.height.value:c.value=600}),pn(async()=>{e.value&&o.update()}),(f,p)=>(Q(),re("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[gn(f.$slots,"default",{width:u.value,height:c.value})],512))}}),Jl={absolute:"",bottom:"3",right:"3"},eu={flex:"~ row","cursor-pointer":""},tu=["checked","aria-checked"],nu={key:0,"min-w":"50vw",z:"(Q(),Xt(ha,{relative:""},{default:Ue(({width:a,height:s})=>[ke(Gl,{width:a,height:s},{default:Ue(({app:l})=>[ke(Hl,{app:l,"mouth-open-size":t.mouthOpenSize,width:a,height:s,paused:t.paused},null,8,["app","mouth-open-size","width","height","paused"])]),_:2},1032,["width","height"]),O("div",Jl,[O("div",eu,[O("label",{class:st([n.value?"bg-neutral-300 dark:bg-neutral-200":"bg-neutral-100 dark:bg-neutral-700"]),transition:"all ease-in-out duration-500",text:"lg neutral-500 dark:neutral-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[At(O("input",{"onUpdate:modelValue":o[0]||(o[0]=l=>n.value=l),checked:n.value,"aria-checked":n.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,tu),[[Zr,n.value]]),o[8]||(o[8]=O("div",{"select-none":""},[O("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),ke(ui,null,{default:Ue(()=>[n.value?(Q(),re("div",nu,[O("div",ru,[O("div",iu,[O("span",null,he(V(e)("stage.viewers.debug-menu.emotions")),1)]),O("div",ou,[O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[1]||(o[1]=l=>r.value={group:"Surprise",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.surprised")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[2]||(o[2]=l=>r.value={group:"Sad",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.sad")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[3]||(o[3]=l=>r.value={group:"Angry",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.angry")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[4]||(o[4]=l=>r.value={group:"Happy",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.happy")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[5]||(o[5]=l=>r.value={group:"Awkward",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.awkward")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[6]||(o[6]=l=>r.value={group:"Question",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.question")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[7]||(o[7]=l=>r.value={group:"Think",index:0})},he(V(e)("stage.viewers.debug-menu.emotions-btn.think")),1)])])])):it("",!0)]),_:1})])]),_:1}))}});var su=Object.defineProperty,lu=(t,e,n)=>e in t?su(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,uu=(t,e,n)=>lu(t,e+"",n);function cu(t){return Ns()?(Ls(t),!0):!1}function ma(t){return typeof t=="function"?t():V(t)}const fu=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const du=Object.prototype.toString,pu=t=>du.call(t)==="[object Object]",hu=()=>{},mu=fu?window:void 0;function gu(t){var e;const n=ma(t);return(e=n==null?void 0:n.$el)!=null?e:n}function ar(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=mu):[e,n,r,i]=t,!e)return hu;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const o=[],a=()=>{o.forEach(c=>c()),o.length=0},s=(c,f,p,d)=>(c.addEventListener(f,p,d),()=>c.removeEventListener(f,p,d)),l=Fe(()=>[gu(e),ma(i)],([c,f])=>{if(a(),!c)return;const p=pu(f)?{...f}:f;o.push(...n.flatMap(d=>r.map(y=>s(c,d,y,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),a()};return cu(u),u}function ga(t,e,n,r){const i=class extends yn{constructor(o={}){const a=Object.entries(t);super({uniforms:a.reduce((s,[l,u])=>{const c=ni.clone({[l]:{value:u}});return{...s,...c}},{}),vertexShader:e,fragmentShader:n}),uu(this,"key",""),a.forEach(([s])=>Object.defineProperty(this,s,{get:()=>this.uniforms[s].value,set:l=>this.uniforms[s].value=l})),Object.assign(this,o)}};return i.key=Dt.generateUUID(),i}ga({color:new ze("white"),scale:new Pe(1,1),imageBounds:new Pe(1,1),resolution:1024,map:null,zoom:1,radius:0,grayscale:0,opacity:1},` - varying vec2 vUv; - varying vec2 vPos; - void main() { - gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); - vUv = uv; - vPos = position.xy; - } - `,` - // mostly from https://gist.github.com/statico/df64c5d167362ecf7b34fca0b1459a44 - varying vec2 vUv; - varying vec2 vPos; - uniform vec2 scale; - uniform vec2 imageBounds; - uniform float resolution; - uniform vec3 color; - uniform sampler2D map; - uniform float radius; - uniform float zoom; - uniform float grayscale; - uniform float opacity; - const vec3 luma = vec3(.299, 0.587, 0.114); - vec4 toGrayscale(vec4 color, float intensity) { - return vec4(mix(color.rgb, vec3(dot(color.rgb, luma)), intensity), color.a); - } - vec2 aspect(vec2 size) { - return size / min(size.x, size.y); - } - - const float PI = 3.14159265; - - // from https://iquilezles.org/articles/distfunctions - float udRoundBox( vec2 p, vec2 b, float r ) { - return length(max(abs(p)-b+r,0.0))-r; - } - - void main() { - vec2 s = aspect(scale); - vec2 i = aspect(imageBounds); - float rs = s.x / s.y; - float ri = i.x / i.y; - vec2 new = rs < ri ? vec2(i.x * s.y / i.y, s.y) : vec2(s.x, i.y * s.x / i.x); - vec2 offset = (rs < ri ? vec2((new.x - s.x) / 2.0, 0.0) : vec2(0.0, (new.y - s.y) / 2.0)) / new; - vec2 uv = vUv * s / new + offset; - vec2 zUv = (uv - vec2(0.5, 0.5)) / zoom + vec2(0.5, 0.5); - - vec2 res = vec2(scale * resolution); - vec2 halfRes = 0.5 * res; - float b = udRoundBox(vUv.xy * res - halfRes, halfRes, resolution * radius); - vec3 a = mix(vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0, 1.0, b)); - gl_FragColor = toGrayscale(texture2D(map, zUv) * vec4(color, opacity * a), grayscale); - - #include - #include - } - `);const ci=parseInt(Ps.replace(/\D+/g,""));var yu=Object.defineProperty,xu=(t,e,n)=>e in t?yu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vu=(t,e,n)=>(xu(t,e+"",n),n);async function Bi(t){const e=await t.arrayBuffer(),n=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${t.type||""};base64,${n}`}let An,sr,Ft,En;function lr(t,e=1/0,n=null){sr||(sr=new Zo(2,2,1,1)),Ft||(Ft=new yn({uniforms:{blitTexture:new js(t)},vertexShader:` - varying vec2 vUv; - void main(){ - vUv = uv; - gl_Position = vec4(position.xy * 1.0,0.,.999999); - } - `,fragmentShader:` - uniform sampler2D blitTexture; - varying vec2 vUv; - - void main(){ - gl_FragColor = vec4(vUv.xy, 0, 1); - - #ifdef IS_SRGB - gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) ); - #else - gl_FragColor = texture2D( blitTexture, vUv); - #endif - } - `})),Ft.uniforms.blitTexture.value=t,Ft.defines.IS_SRGB="colorSpace"in t?t.colorSpace==="srgb":t.encoding===3001,Ft.needsUpdate=!0,En||(En=new Pt(sr,Ft),En.frustrumCulled=!1);const r=new Et,i=new Nr;i.add(En),n||(n=An=new Vs({antialias:!1})),n.setSize(Math.min(t.image.width,e),Math.min(t.image.height,e)),n.clear(),n.render(i,r);const o=new Fn(n.domElement);return o.minFilter=t.minFilter,o.magFilter=t.magFilter,o.wrapS=t.wrapS,o.wrapT=t.wrapT,o.name=t.name,An&&(An.dispose(),An=null),o}const Fi={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class ya{constructor(){this.pluginCallbacks=[],this.register(function(e){return new Iu(e)}),this.register(function(e){return new Ru(e)}),this.register(function(e){return new Lu(e)}),this.register(function(e){return new Pu(e)}),this.register(function(e){return new Du(e)}),this.register(function(e){return new Ou(e)}),this.register(function(e){return new Cu(e)}),this.register(function(e){return new Nu(e)}),this.register(function(e){return new Bu(e)}),this.register(function(e){return new Fu(e)}),this.register(function(e){return new zu(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,n,r,i){const o=new Su,a=[];for(let s=0,l=this.pluginCallbacks.length;st.times[t.times.length-1]){if(Math.abs(t.times[t.times.length-1]-e)<.001)return t.times.length-1;r[r.length-1]=e,r.set(t.times,0),i.set(t.values,0),i.set(o.evaluate(e),t.values.length),a=r.length-1}else for(let s=0;se){r.set(t.times.slice(0,s+1),0),r[s+1]=e,r.set(t.times.slice(s+1),s+2),i.set(t.values.slice(0,(s+1)*n),0),i.set(o.evaluate(e),(s+1)*n),i.set(t.values.slice((s+1)*n),(s+2)*n),a=s+1;break}}return t.times=r,t.values=i,a},mergeMorphTargetTracks:function(t,e){const n=[],r={},i=t.tracks;for(let o=0;o4?a=t.array[i*t.itemSize+o]:(o===0?a=t.getX(i):o===1?a=t.getY(i):o===2?a=t.getZ(i):o===3&&(a=t.getW(i)),t.normalized===!0&&(a=Dt.normalize(a,t.array))),r.min[o]=Math.min(r.min[o],a),r.max[o]=Math.max(r.max[o],a)}return r}function xa(t){return Math.ceil(t/4)*4}function cr(t,e=0){const n=xa(t.byteLength);if(n!==t.byteLength){const r=new Uint8Array(n);if(r.set(new Uint8Array(t)),e!==0)for(let i=t.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function Hi(t,e){if(t.toBlob!==void 0)return new Promise(r=>t.toBlob(r,e));let n;return e==="image/jpeg"?n=.92:e==="image/webp"&&(n=.8),t.convertToBlob({type:e,quality:n})}class Su{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,n,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,o=i.buffers,a=i.json;r=i.options;const s=i.extensionsUsed,l=i.extensionsRequired,u=new Blob(o,{type:"application/octet-stream"}),c=Object.keys(s),f=Object.keys(l);c.length>0&&(a.extensionsUsed=c),f.length>0&&(a.extensionsRequired=f),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=u.size),r.binary===!0?u.arrayBuffer().then(p=>{const d=cr(p),y=new DataView(new ArrayBuffer(ji));y.setUint32(0,d.byteLength,!0),y.setUint32(4,_u,!0);const x=cr(Au(JSON.stringify(a)),32),v=new DataView(new ArrayBuffer(ji));v.setUint32(0,x.byteLength,!0),v.setUint32(4,Tu,!0);const k=new ArrayBuffer(Ui),M=new DataView(k);M.setUint32(0,wu,!0),M.setUint32(4,ku,!0);const A=Ui+v.byteLength+x.byteLength+y.byteLength+d.byteLength;M.setUint32(8,A,!0),new Blob([k,v,x,y,d],{type:"application/octet-stream"}).arrayBuffer().then(n)}):a.buffers&&a.buffers.length>0?Bi(u).then(p=>{a.buffers[0].uri=p,n(a)}):n(a)}serializeUserData(e,n){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){n.extensions===void 0&&(n.extensions={});for(const a in o.gltfExtensions)n.extensions[a]=o.gltfExtensions[a],i[a]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(n.extras=o)}catch(o){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+o.message)}}getUID(e,n=!1){if(this.uids.has(e)===!1){const r=new Map;r.set(!0,this.uid++),r.set(!1,this.uid++),this.uids.set(e,r)}return this.uids.get(e).get(n)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new ae;for(let r=0,i=e.count;r5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const n=this.cache;if(n.attributesNormalized.has(e))return n.attributesNormalized.get(e);const r=e.clone(),i=new ae;for(let o=0,a=r.count;o4?y=e.array[p*e.itemSize+d]:(d===0?y=e.getX(p):d===1?y=e.getY(p):d===2?y=e.getZ(p):d===3&&(y=e.getW(p)),e.normalized===!0&&(y=Dt.normalize(y,e.array))),n===pe.FLOAT?u.setFloat32(c,y,!0):n===pe.INT?u.setInt32(c,y,!0):n===pe.UNSIGNED_INT?u.setUint32(c,y,!0):n===pe.SHORT?u.setInt16(c,y,!0):n===pe.UNSIGNED_SHORT?u.setUint16(c,y,!0):n===pe.BYTE?u.setInt8(c,y):n===pe.UNSIGNED_BYTE&&u.setUint8(c,y),c+=s}const f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return o!==void 0&&(f.target=o),o===pe.ARRAY_BUFFER&&(f.byteStride=e.itemSize*s),this.byteOffset+=l,a.bufferViews.push(f),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const n=this,r=n.json;return r.bufferViews||(r.bufferViews=[]),e.arrayBuffer().then(i=>{const o=cr(i),a={buffer:n.processBuffer(o),byteOffset:n.byteOffset,byteLength:o.byteLength};return n.byteOffset+=o.byteLength,r.bufferViews.push(a)-1})}processAccessor(e,n,r,i){const o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let s;if(e.array.constructor===Float32Array)s=pe.FLOAT;else if(e.array.constructor===Int32Array)s=pe.INT;else if(e.array.constructor===Uint32Array)s=pe.UNSIGNED_INT;else if(e.array.constructor===Int16Array)s=pe.SHORT;else if(e.array.constructor===Uint16Array)s=pe.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)s=pe.BYTE;else if(e.array.constructor===Uint8Array)s=pe.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),i===void 0&&(i=e.count),i===0)return null;const l=Mu(e,r,i);let u;n!==void 0&&(u=e===n.index?pe.ELEMENT_ARRAY_BUFFER:pe.ARRAY_BUFFER);const c=this.processBufferView(e,s,r,i,u),f={bufferView:c.id,byteOffset:c.byteOffset,componentType:s,count:i,max:l.max,min:l.min,type:a[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(f)-1}processImage(e,n,r,i="image/png"){if(e!==null){const o=this,a=o.cache,s=o.json,l=o.options,u=o.pending;a.images.has(e)||a.images.set(e,{});const c=a.images.get(e),f=i+":flipY/"+r.toString();if(c[f]!==void 0)return c[f];s.images||(s.images=[]);const p={mimeType:i},d=Vi();d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize);const y=d.getContext("2d");if(r===!0&&(y.translate(0,d.height),y.scale(1,-1)),e.data!==void 0){n!==Cr&&console.error("GLTFExporter: Only RGBAFormat is supported.",n),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const v=new Uint8ClampedArray(e.height*e.width*4);for(let k=0;ko.processBufferViewImage(v)).then(v=>{p.bufferView=v})):d.toDataURL!==void 0?p.uri=d.toDataURL(i):u.push(Hi(d,i).then(Bi).then(v=>{p.uri=v}));const x=s.images.push(p)-1;return c[f]=x,x}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const n=this.json;n.samplers||(n.samplers=[]);const r={magFilter:Je[e.magFilter],minFilter:Je[e.minFilter],wrapS:Je[e.wrapS],wrapT:Je[e.wrapT]};return n.samplers.push(r)-1}processTexture(e){const n=this.options,r=this.cache,i=this.json;if(r.textures.has(e))return r.textures.get(e);i.textures||(i.textures=[]),e instanceof er&&(e=lr(e,n.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(l){l.writeTexture&&l.writeTexture(e,a)});const s=i.textures.push(a)-1;return r.textures.set(e,s),s}processMaterial(e){const n=this.cache,r=this.json;if(n.materials.has(e))return n.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(un(o,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const s=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(s),channel:s.channel};this.applyTextureTransform(l,s),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const s={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(s,e.map),i.pbrMetallicRoughness.baseColorTexture=s}if(e.emissive){const s=e.emissive;if(Math.max(s.r,s.g,s.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const l={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),i.emissiveTexture=l}}if(e.normalMap){const s={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(s.scale=e.normalScale.x),this.applyTextureTransform(s,e.normalMap),i.normalTexture=s}if(e.aoMap){const s={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(s.strength=e.aoMapIntensity),this.applyTextureTransform(s,e.aoMap),i.occlusionTexture=s}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===qn&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(s){s.writeMaterial&&s.writeMaterial(e,i)});const a=r.materials.push(i)-1;return n.materials.set(e,a),a}processMesh(e){const n=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let A=0,C=e.material.length;A=152?{uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3"}:{uv:"TEXCOORD_0",uv2:"TEXCOORD_1"},color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=a.getAttribute("normal");d!==void 0&&!this.isNormalizedNormalAttribute(d)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),a.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let y=null;for(let A in a.attributes){if(A.slice(0,5)==="morph")continue;const C=a.attributes[A];if(A=p[A]||A.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(A)||(A="_"+A),n.attributes.has(this.getUID(C))){u[A]=n.attributes.get(this.getUID(C));continue}y=null;const P=C.array;A==="JOINTS_0"&&!(P instanceof Uint16Array)&&!(P instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new Nt(new Uint16Array(P),C.itemSize,C.normalized));const h=this.processAccessor(y||C,a);h!==null&&(A.startsWith("_")||this.detectMeshQuantization(A,C),u[A]=h,n.attributes.set(this.getUID(C),h))}if(d!==void 0&&a.setAttribute("normal",d),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const A=[],C=[],P={};if(e.morphTargetDictionary!==void 0)for(const h in e.morphTargetDictionary)P[e.morphTargetDictionary[h]]=h;for(let h=0;h0&&(l.extras={},l.extras.targetNames=C)}const x=Array.isArray(e.material);if(x&&a.groups.length===0)return null;const v=x?e.material:[e.material],k=x?a.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let A=0,C=k.length;A0&&(P.targets=f),a.index!==null){let I=this.getUID(a.index);(k[A].start!==void 0||k[A].count!==void 0)&&(I+=":"+k[A].start+":"+k[A].count),n.attributes.has(I)?P.indices=n.attributes.get(I):(P.indices=this.processAccessor(a.index,a,k[A].start,k[A].count),n.attributes.set(I,P.indices)),P.indices===null&&delete P.indices}const h=this.processMaterial(v[k[A].materialIndex]);h!==null&&(P.material=h),c.push(P)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(A){A.writeMesh&&A.writeMesh(e,l)});const M=r.meshes.push(l)-1;return n.meshes.set(o,M),M}detectMeshQuantization(e,n){if(this.extensionsUsed[ur])return;let r;switch(n.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}n.normalized&&(r+=" normalized");const i=e.split("_",1)[0];Fi[i]&&Fi[i].includes(r)&&(this.extensionsUsed[ur]=!0,this.extensionsRequired[ur]=!0)}processCamera(e){const n=this.json;n.cameras||(n.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Dt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),n.cameras.push(i)-1}processAnimation(e,n){const r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=ya.Utils.mergeMorphTargetTracks(e.clone(),n);const o=e.tracks,a=[],s=[];for(let l=0;l0){const s=[];for(let l=0,u=e.children.length;l0&&(o.children=s)}this._invokeAll(function(s){s.writeNode&&s.writeNode(e,o)});const a=n.nodes.push(o)-1;return i.set(e,a),a}processScene(e){const n=this.json,r=this.options;n.scenes||(n.scenes=[],n.scene=0);const i={};e.name!==""&&(i.name=e.name),n.scenes.push(i);const o=[];for(let a=0,s=e.children.length;a0&&(i.nodes=o),this.serializeUserData(e,i)}processObjects(e){const n=new Nr;n.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,a.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},o[this.name]=!0);const s=i.extensions[this.name].lights;s.push(a),n.extensions=n.extensions||{},n.extensions[this.name]={light:s.length-1}}}let Ru=class{constructor(t){this.writer=t,this.name="KHR_materials_unlit"}writeMaterial(t,e){if(!t.isMeshBasicMaterial)return;const n=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},n[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}},Cu=class{constructor(t){this.writer=t,this.name="KHR_materials_clearcoat"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.clearcoat===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.clearcoatFactor=t.clearcoat,t.clearcoatMap){const o={index:n.processTexture(t.clearcoatMap),texCoord:t.clearcoatMap.channel};n.applyTextureTransform(o,t.clearcoatMap),i.clearcoatTexture=o}if(i.clearcoatRoughnessFactor=t.clearcoatRoughness,t.clearcoatRoughnessMap){const o={index:n.processTexture(t.clearcoatRoughnessMap),texCoord:t.clearcoatRoughnessMap.channel};n.applyTextureTransform(o,t.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o}if(t.clearcoatNormalMap){const o={index:n.processTexture(t.clearcoatNormalMap),texCoord:t.clearcoatNormalMap.channel};n.applyTextureTransform(o,t.clearcoatNormalMap),i.clearcoatNormalTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Nu=class{constructor(t){this.writer=t,this.name="KHR_materials_iridescence"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.iridescence===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.iridescenceFactor=t.iridescence,t.iridescenceMap){const o={index:n.processTexture(t.iridescenceMap),texCoord:t.iridescenceMap.channel};n.applyTextureTransform(o,t.iridescenceMap),i.iridescenceTexture=o}if(i.iridescenceIor=t.iridescenceIOR,i.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1],t.iridescenceThicknessMap){const o={index:n.processTexture(t.iridescenceThicknessMap),texCoord:t.iridescenceThicknessMap.channel};n.applyTextureTransform(o,t.iridescenceThicknessMap),i.iridescenceThicknessTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Lu=class{constructor(t){this.writer=t,this.name="KHR_materials_transmission"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.transmission===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.transmissionFactor=t.transmission,t.transmissionMap){const o={index:n.processTexture(t.transmissionMap),texCoord:t.transmissionMap.channel};n.applyTextureTransform(o,t.transmissionMap),i.transmissionTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Pu=class{constructor(t){this.writer=t,this.name="KHR_materials_volume"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.transmission===0)return;const n=this.writer,r=n.extensionsUsed,i={};if(i.thicknessFactor=t.thickness,t.thicknessMap){const o={index:n.processTexture(t.thicknessMap),texCoord:t.thicknessMap.channel};n.applyTextureTransform(o,t.thicknessMap),i.thicknessTexture=o}i.attenuationDistance=t.attenuationDistance,i.attenuationColor=t.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Du=class{constructor(t){this.writer=t,this.name="KHR_materials_ior"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.ior===1.5)return;const n=this.writer.extensionsUsed,r={};r.ior=t.ior,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}},Ou=class{constructor(t){this.writer=t,this.name="KHR_materials_specular"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.specularIntensity===1&&t.specularColor.equals(bu)&&!t.specularIntensityMap&&!t.specularColorTexture)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.specularIntensityMap){const o={index:n.processTexture(t.specularIntensityMap),texCoord:t.specularIntensityMap.channel};n.applyTextureTransform(o,t.specularIntensityMap),i.specularTexture=o}if(t.specularColorMap){const o={index:n.processTexture(t.specularColorMap),texCoord:t.specularColorMap.channel};n.applyTextureTransform(o,t.specularColorMap),i.specularColorTexture=o}i.specularFactor=t.specularIntensity,i.specularColorFactor=t.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Bu=class{constructor(t){this.writer=t,this.name="KHR_materials_sheen"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.sheen==0)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.sheenRoughnessMap){const o={index:n.processTexture(t.sheenRoughnessMap),texCoord:t.sheenRoughnessMap.channel};n.applyTextureTransform(o,t.sheenRoughnessMap),i.sheenRoughnessTexture=o}if(t.sheenColorMap){const o={index:n.processTexture(t.sheenColorMap),texCoord:t.sheenColorMap.channel};n.applyTextureTransform(o,t.sheenColorMap),i.sheenColorTexture=o}i.sheenRoughnessFactor=t.sheenRoughness,i.sheenColorFactor=t.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},Fu=class{constructor(t){this.writer=t,this.name="KHR_materials_anisotropy"}writeMaterial(t,e){if(!t.isMeshPhysicalMaterial||t.anisotropy==0)return;const n=this.writer,r=n.extensionsUsed,i={};if(t.anisotropyMap){const o={index:n.processTexture(t.anisotropyMap)};n.applyTextureTransform(o,t.anisotropyMap),i.anisotropyTexture=o}i.anisotropyStrength=t.anisotropy,i.anisotropyRotation=t.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=i,r[this.name]=!0}},zu=class{constructor(t){this.writer=t,this.name="KHR_materials_emissive_strength"}writeMaterial(t,e){if(!t.isMeshStandardMaterial||t.emissiveIntensity===1)return;const n=this.writer.extensionsUsed,r={};r.emissiveStrength=t.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}};var xn=Uint8Array,va=Uint16Array,Uu=Uint32Array,ju=new xn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vu=new xn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ba=function(t,e){for(var n=new va(31),r=0;r<31;++r)n[r]=e+=1<>>1|(Ne&21845)<<1;wt=(wt&52428)>>>2|(wt&13107)<<2,wt=(wt&61680)>>>4|(wt&3855)<<4,$u[Ne]=((wt&65280)>>>8|(wt&255)<<8)>>>1}var Wn=new xn(288);for(var Ne=0;Ne<144;++Ne)Wn[Ne]=8;for(var Ne=144;Ne<256;++Ne)Wn[Ne]=9;for(var Ne=256;Ne<280;++Ne)Wn[Ne]=7;for(var Ne=280;Ne<288;++Ne)Wn[Ne]=8;var Yu=new xn(32);for(var Ne=0;Ne<32;++Ne)Yu[Ne]=5;var qu=new xn(0),Ku=typeof TextDecoder<"u"&&new TextDecoder,Wu=0;try{Ku.decode(qu,{stream:!0}),Wu=1}catch{}var Xu=Object.defineProperty,Qu=(t,e,n)=>e in t?Xu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zu=(t,e,n)=>(Qu(t,e+"",n),n);const ka=class extends Pt{constructor(t,e={}){super(t),this.isReflector=!0,this.type="Reflector",this.camera=new Et;const n=this,r=e.color!==void 0?new ze(e.color):new ze(8355711),i=e.textureWidth||512,o=e.textureHeight||512,a=e.clipBias||0,s=e.shader||ka.ReflectorShader,l=e.multisample!==void 0?e.multisample:4,u=new qo,c=new ae,f=new ae,p=new ae,d=new xt,y=new ae(0,0,-1),x=new Mt,v=new ae,k=new ae,M=new Mt,A=new xt,C=this.camera,P=new Os(i,o,{samples:l,type:Bs}),h=new yn({uniforms:ni.clone(s.uniforms),fragmentShader:s.fragmentShader,vertexShader:s.vertexShader});h.uniforms.tDiffuse.value=P.texture,h.uniforms.color.value=r,h.uniforms.textureMatrix.value=A,this.material=h,this.onBeforeRender=function(I,b,g){if(f.setFromMatrixPosition(n.matrixWorld),p.setFromMatrixPosition(g.matrixWorld),d.extractRotation(n.matrixWorld),c.set(0,0,1),c.applyMatrix4(d),v.subVectors(f,p),v.dot(c)>0)return;v.reflect(c).negate(),v.add(f),d.extractRotation(g.matrixWorld),y.set(0,0,-1),y.applyMatrix4(d),y.add(p),k.subVectors(f,y),k.reflect(c).negate(),k.add(f),C.position.copy(v),C.up.set(0,1,0),C.up.applyMatrix4(d),C.up.reflect(c),C.lookAt(k),C.far=g.far,C.updateMatrixWorld(),C.projectionMatrix.copy(g.projectionMatrix),A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),A.multiply(C.projectionMatrix),A.multiply(C.matrixWorldInverse),A.multiply(n.matrixWorld),u.setFromNormalAndCoplanarPoint(c,f),u.applyMatrix4(C.matrixWorldInverse),x.set(u.normal.x,u.normal.y,u.normal.z,u.constant);const m=C.projectionMatrix;M.x=(Math.sign(x.x)+m.elements[8])/m.elements[0],M.y=(Math.sign(x.y)+m.elements[9])/m.elements[5],M.z=-1,M.w=(1+m.elements[10])/m.elements[14],x.multiplyScalar(2/x.dot(M)),m.elements[2]=x.x,m.elements[6]=x.y,m.elements[10]=x.z+1-a,m.elements[14]=x.w,n.visible=!1;const T=I.getRenderTarget(),S=I.xr.enabled,F=I.shadowMap.autoUpdate,D=I.toneMapping;let B=!1;"outputColorSpace"in I?B=I.outputColorSpace==="srgb":B=I.outputEncoding===3001,I.xr.enabled=!1,I.shadowMap.autoUpdate=!1,"outputColorSpace"in I?I.outputColorSpace="srgb-linear":I.outputEncoding=3e3,I.toneMapping=Fs,I.setRenderTarget(P),I.state.buffers.depth.setMask(!0),I.autoClear===!1&&I.clear(),I.render(b,C),I.xr.enabled=S,I.shadowMap.autoUpdate=F,I.toneMapping=D,"outputColorSpace"in I?I.outputColorSpace=B?"srgb":"srgb-linear":I.outputEncoding=B?3001:3e3,I.setRenderTarget(T);const j=g.viewport;j!==void 0&&I.state.viewport(j),n.visible=!0},this.getRenderTarget=function(){return P},this.dispose=function(){P.dispose(),n.material.dispose()}}};let Or=ka;Zu(Or,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:` - uniform mat4 textureMatrix; - varying vec4 vUv; - - #include - #include - - void main() { - - vUv = textureMatrix * vec4( position, 1.0 ); - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - #include - - }`,fragmentShader:` - uniform vec3 color; - uniform sampler2D tDiffuse; - varying vec4 vUv; - - #include - - float blendOverlay( float base, float blend ) { - - return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); - - } - - vec3 blendOverlay( vec3 base, vec3 blend ) { - - return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); - - } - - void main() { - - #include - - vec4 base = texture2DProj( tDiffuse, vUv ); - gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); - - #include - #include <${ci>=154?"colorspace_fragment":"encodings_fragment"}> - - }`});var Ju=Object.defineProperty,ec=(t,e,n)=>e in t?Ju(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ta=(t,e,n)=>(ec(t,typeof e!="symbol"?e+"":e,n),n);const Xn=new Ko,tc=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),_a=new Wo(tc,5);Xn.setIndex([0,1,2,0,2,3]);Xn.setAttribute("position",new ti(_a,3,0,!1));Xn.setAttribute("uv",new ti(_a,2,3,!1));const Br=class extends Pt{constructor(){super(Br.Geometry,new Vt({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const t=new ae,e=new ae,n=new Mi(new Uint8Array(16*16*3),16,16,Cr);n.minFilter=Lt,n.magFilter=Lt,n.wrapS=Ht,n.wrapT=Ht;const r=new Mi(new Uint8Array(16*16*3),16,16,Cr);r.minFilter=Lt,r.magFilter=Lt,r.wrapS=Ht,r.wrapT=Ht;const i=Br.Geometry,o=new tr({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:` - - precision highp float; - - uniform vec3 screenPosition; - uniform vec2 scale; - - attribute vec3 position; - - void main() { - - gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); - - }`,fragmentShader:` - - precision highp float; - - void main() { - - gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 ); - - }`,depthTest:!0,depthWrite:!1,transparent:!1}),a=new tr({uniforms:{map:{value:n},scale:{value:null},screenPosition:{value:null}},vertexShader:` - - precision highp float; - - uniform vec3 screenPosition; - uniform vec2 scale; - - attribute vec3 position; - attribute vec2 uv; - - varying vec2 vUV; - - void main() { - - vUV = uv; - - gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); - - }`,fragmentShader:` - - precision highp float; - - uniform sampler2D map; - - varying vec2 vUV; - - void main() { - - gl_FragColor = texture2D( map, vUV ); - - }`,depthTest:!1,depthWrite:!1,transparent:!1}),s=new Pt(i,o),l=[],u=Aa.Shader,c=new tr({uniforms:{map:{value:null},occlusionMap:{value:r},color:{value:new ze(16777215)},scale:{value:new Pe},screenPosition:{value:new ae}},vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:zs,transparent:!0,depthWrite:!1}),f=new Pt(i,c);this.addElement=function(v){l.push(v)};const p=new Pe,d=new Pe,y=new Us,x=new Mt;this.onBeforeRender=function(v,k,M){v.getCurrentViewport(x);const A=x.w/x.z,C=x.z/2,P=x.w/2;let h=16/x.w;if(p.set(h*A,h),y.min.set(x.x,x.y),y.max.set(x.x+(x.z-16),x.y+(x.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(M.matrixWorldInverse),!(e.z>0)&&(t.copy(e).applyMatrix4(M.projectionMatrix),d.x=x.x+t.x*C+C-8,d.y=x.y+t.y*P+P-8,y.containsPoint(d))){v.copyFramebufferToTexture(d,n);let I=o.uniforms;I.scale.value=p,I.screenPosition.value=t,v.renderBufferDirect(M,null,i,o,s,null),v.copyFramebufferToTexture(d,r),I=a.uniforms,I.scale.value=p,I.screenPosition.value=t,v.renderBufferDirect(M,null,i,a,s,null);const b=-t.x*2,g=-t.y*2;for(let m=0,T=l.length;me in t?rc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ea=(t,e,n)=>(ic(t,typeof e!="symbol"?e+"":e,n),n);const Pn={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new ae},up:{value:new ae(0,1,0)}},vertexShader:` - uniform vec3 sunPosition; - uniform float rayleigh; - uniform float turbidity; - uniform float mieCoefficient; - uniform vec3 up; - - varying vec3 vWorldPosition; - varying vec3 vSunDirection; - varying float vSunfade; - varying vec3 vBetaR; - varying vec3 vBetaM; - varying float vSunE; - - // constants for atmospheric scattering - const float e = 2.71828182845904523536028747135266249775724709369995957; - const float pi = 3.141592653589793238462643383279502884197169; - - // wavelength of used primaries, according to preetham - const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); - // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: - // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) - const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); - - // mie stuff - // K coefficient for the primaries - const float v = 4.0; - const vec3 K = vec3( 0.686, 0.678, 0.666 ); - // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K - const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); - - // earth shadow hack - // cutoffAngle = pi / 1.95; - const float cutoffAngle = 1.6110731556870734; - const float steepness = 1.5; - const float EE = 1000.0; - - float sunIntensity( float zenithAngleCos ) { - zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); - return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); - } - - vec3 totalMie( float T ) { - float c = ( 0.2 * T ) * 10E-18; - return 0.434 * c * MieConst; - } - - void main() { - - vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); - vWorldPosition = worldPosition.xyz; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - gl_Position.z = gl_Position.w; // set z to camera.far - - vSunDirection = normalize( sunPosition ); - - vSunE = sunIntensity( dot( vSunDirection, up ) ); - - vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); - - float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); - - // extinction (absorbtion + out scattering) - // rayleigh coefficients - vBetaR = totalRayleigh * rayleighCoefficient; - - // mie coefficients - vBetaM = totalMie( turbidity ) * mieCoefficient; - - } - `,fragmentShader:` - varying vec3 vWorldPosition; - varying vec3 vSunDirection; - varying float vSunfade; - varying vec3 vBetaR; - varying vec3 vBetaM; - varying float vSunE; - - uniform float mieDirectionalG; - uniform vec3 up; - - const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); - - // constants for atmospheric scattering - const float pi = 3.141592653589793238462643383279502884197169; - - const float n = 1.0003; // refractive index of air - const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) - - // optical length at zenith for molecules - const float rayleighZenithLength = 8.4E3; - const float mieZenithLength = 1.25E3; - // 66 arc seconds -> degrees, and the cosine of that - const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; - - // 3.0 / ( 16.0 * pi ) - const float THREE_OVER_SIXTEENPI = 0.05968310365946075; - // 1.0 / ( 4.0 * pi ) - const float ONE_OVER_FOURPI = 0.07957747154594767; - - float rayleighPhase( float cosTheta ) { - return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); - } - - float hgPhase( float cosTheta, float g ) { - float g2 = pow( g, 2.0 ); - float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); - return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); - } - - void main() { - - vec3 direction = normalize( vWorldPosition - cameraPos ); - - // optical length - // cutoff angle at 90 to avoid singularity in next formula. - float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); - float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); - float sR = rayleighZenithLength * inverse; - float sM = mieZenithLength * inverse; - - // combined extinction factor - vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); - - // in scattering - float cosTheta = dot( direction, vSunDirection ); - - float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); - vec3 betaRTheta = vBetaR * rPhase; - - float mPhase = hgPhase( cosTheta, mieDirectionalG ); - vec3 betaMTheta = vBetaM * mPhase; - - vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); - Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); - - // nightsky - float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] - float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] - vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); - vec3 L0 = vec3( 0.1 ) * Fex; - - // composition + solar disc - float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); - L0 += ( vSunE * 19000.0 * Fex ) * sundisk; - - vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); - - vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); - - gl_FragColor = vec4( retColor, 1.0 ); - - #include - #include <${ci>=154?"colorspace_fragment":"encodings_fragment"}> - - } - `},Ma=new yn({name:"SkyShader",fragmentShader:Pn.fragmentShader,vertexShader:Pn.vertexShader,uniforms:ni.clone(Pn.uniforms),side:As,depthWrite:!1});class Sa extends Pt{constructor(){super(new Ds(1,1,1),Ma)}}Ea(Sa,"SkyShader",Pn);Ea(Sa,"material",Ma);new Es;new ae;new Xo(0,0,0,"YXZ");new ae;var oc=Object.defineProperty,ac=(t,e,n)=>e in t?oc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ne=(t,e,n)=>(ac(t,typeof e!="symbol"?e+"":e,n),n);const Mn=new _s,Gi=new qo,sc=Math.cos(70*(Math.PI/180)),$i=(t,e)=>(t%e+e)%e;class lc extends Ts{constructor(e,n){super(),ne(this,"object"),ne(this,"domElement"),ne(this,"enabled",!0),ne(this,"target",new ae),ne(this,"minDistance",0),ne(this,"maxDistance",1/0),ne(this,"minZoom",0),ne(this,"maxZoom",1/0),ne(this,"minPolarAngle",0),ne(this,"maxPolarAngle",Math.PI),ne(this,"minAzimuthAngle",-1/0),ne(this,"maxAzimuthAngle",1/0),ne(this,"enableDamping",!1),ne(this,"dampingFactor",.05),ne(this,"enableZoom",!0),ne(this,"zoomSpeed",1),ne(this,"enableRotate",!0),ne(this,"rotateSpeed",1),ne(this,"enablePan",!0),ne(this,"panSpeed",1),ne(this,"screenSpacePanning",!0),ne(this,"keyPanSpeed",7),ne(this,"zoomToCursor",!1),ne(this,"autoRotate",!1),ne(this,"autoRotateSpeed",2),ne(this,"reverseOrbit",!1),ne(this,"reverseHorizontalOrbit",!1),ne(this,"reverseVerticalOrbit",!1),ne(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ne(this,"mouseButtons",{LEFT:yt.ROTATE,MIDDLE:yt.DOLLY,RIGHT:yt.PAN}),ne(this,"touches",{ONE:_t.ROTATE,TWO:_t.DOLLY_PAN}),ne(this,"target0"),ne(this,"position0"),ne(this,"zoom0"),ne(this,"_domElementKeyEvents",null),ne(this,"getPolarAngle"),ne(this,"getAzimuthalAngle"),ne(this,"setPolarAngle"),ne(this,"setAzimuthalAngle"),ne(this,"getDistance"),ne(this,"getZoomScale"),ne(this,"listenToKeyEvents"),ne(this,"stopListenToKeyEvents"),ne(this,"saveState"),ne(this,"reset"),ne(this,"update"),ne(this,"connect"),ne(this,"dispose"),ne(this,"dollyIn"),ne(this,"dollyOut"),ne(this,"getScale"),ne(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>c.phi,this.getAzimuthalAngle=()=>c.theta,this.setPolarAngle=L=>{let Y=$i(L,2*Math.PI),X=c.phi;X<0&&(X+=2*Math.PI),Y<0&&(Y+=2*Math.PI);let Ee=Math.abs(Y-X);2*Math.PI-Ee{let Y=$i(L,2*Math.PI),X=c.theta;X<0&&(X+=2*Math.PI),Y<0&&(Y+=2*Math.PI);let Ee=Math.abs(Y-X);2*Math.PI-Eer.object.position.distanceTo(r.target),this.listenToKeyEvents=L=>{L.addEventListener("keydown",ie),this._domElementKeyEvents=L},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ie),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=s.NONE},this.update=(()=>{const L=new ae,Y=new ae(0,1,0),X=new Bn().setFromUnitVectors(e.up,Y),Ee=X.clone().invert(),Qe=new ae,at=new Bn,kn=2*Math.PI;return function(){const Ai=r.object.position;X.setFromUnitVectors(e.up,Y),Ee.copy(X).invert(),L.copy(Ai).sub(r.target),L.applyQuaternion(X),c.setFromVector3(L),r.autoRotate&&l===s.NONE&&D(S()),r.enableDamping?(c.theta+=f.theta*r.dampingFactor,c.phi+=f.phi*r.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let ht=r.minAzimuthAngle,mt=r.maxAzimuthAngle;isFinite(ht)&&isFinite(mt)&&(ht<-Math.PI?ht+=kn:ht>Math.PI&&(ht-=kn),mt<-Math.PI?mt+=kn:mt>Math.PI&&(mt-=kn),ht<=mt?c.theta=Math.max(ht,Math.min(mt,c.theta)):c.theta=c.theta>(ht+mt)/2?Math.max(ht,c.theta):Math.min(mt,c.theta)),c.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,c.phi)),c.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(d,r.dampingFactor):r.target.add(d),r.zoomToCursor&&g||r.object.isOrthographicCamera?c.radius=R(c.radius):c.radius=R(c.radius*p),L.setFromSpherical(c),L.applyQuaternion(Ee),Ai.copy(r.target).add(L),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,d.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),d.set(0,0,0));let tn=!1;if(r.zoomToCursor&&g){let nn=null;if(r.object instanceof Et&&r.object.isPerspectiveCamera){const rn=L.length();nn=R(rn*p);const Tn=rn-nn;r.object.position.addScaledVector(I,Tn),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const rn=new ae(b.x,b.y,0);rn.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),tn=!0;const Tn=new ae(b.x,b.y,0);Tn.unproject(r.object),r.object.position.sub(Tn).add(rn),r.object.updateMatrixWorld(),nn=L.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;nn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(nn).add(r.object.position):(Mn.origin.copy(r.object.position),Mn.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(Mn.direction))u||8*(1-at.dot(r.object.quaternion))>u?(r.dispatchEvent(i),Qe.copy(r.object.position),at.copy(r.object.quaternion),tn=!1,!0):!1}})(),this.connect=L=>{r.domElement=L,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",He),r.domElement.addEventListener("pointerdown",Me),r.domElement.addEventListener("pointercancel",tt),r.domElement.addEventListener("wheel",K)},this.dispose=()=>{var L,Y,X,Ee,Qe,at;r.domElement&&(r.domElement.style.touchAction="auto"),(L=r.domElement)==null||L.removeEventListener("contextmenu",He),(Y=r.domElement)==null||Y.removeEventListener("pointerdown",Me),(X=r.domElement)==null||X.removeEventListener("pointercancel",tt),(Ee=r.domElement)==null||Ee.removeEventListener("wheel",K),(Qe=r.domElement)==null||Qe.ownerDocument.removeEventListener("pointermove",Ve),(at=r.domElement)==null||at.ownerDocument.removeEventListener("pointerup",tt),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ie)};const r=this,i={type:"change"},o={type:"start"},a={type:"end"},s={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=s.NONE;const u=1e-6,c=new Ei,f=new Ei;let p=1;const d=new ae,y=new Pe,x=new Pe,v=new Pe,k=new Pe,M=new Pe,A=new Pe,C=new Pe,P=new Pe,h=new Pe,I=new ae,b=new Pe;let g=!1;const m=[],T={};function S(){return 2*Math.PI/60/60*r.autoRotateSpeed}function F(){return Math.pow(.95,r.zoomSpeed)}function D(L){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=L:f.theta-=L}function B(L){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=L:f.phi-=L}const j=(()=>{const L=new ae;return function(Y,X){L.setFromMatrixColumn(X,0),L.multiplyScalar(-Y),d.add(L)}})(),J=(()=>{const L=new ae;return function(Y,X){r.screenSpacePanning===!0?L.setFromMatrixColumn(X,1):(L.setFromMatrixColumn(X,0),L.crossVectors(r.object.up,L)),L.multiplyScalar(Y),d.add(L)}})(),oe=(()=>{const L=new ae;return function(Y,X){const Ee=r.domElement;if(Ee&&r.object instanceof Et&&r.object.isPerspectiveCamera){const Qe=r.object.position;L.copy(Qe).sub(r.target);let at=L.length();at*=Math.tan(r.object.fov/2*Math.PI/180),j(2*Y*at/Ee.clientHeight,r.object.matrix),J(2*X*at/Ee.clientHeight,r.object.matrix)}else Ee&&r.object instanceof Gt&&r.object.isOrthographicCamera?(j(Y*(r.object.right-r.object.left)/r.object.zoom/Ee.clientWidth,r.object.matrix),J(X*(r.object.top-r.object.bottom)/r.object.zoom/Ee.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function Z(L){r.object instanceof Et&&r.object.isPerspectiveCamera||r.object instanceof Gt&&r.object.isOrthographicCamera?p=L:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function _(L){Z(p/L)}function ee(L){Z(p*L)}function me(L){if(!r.zoomToCursor||!r.domElement)return;g=!0;const Y=r.domElement.getBoundingClientRect(),X=L.clientX-Y.left,Ee=L.clientY-Y.top,Qe=Y.width,at=Y.height;b.x=X/Qe*2-1,b.y=-(Ee/at)*2+1,I.set(b.x,b.y,1).unproject(r.object).sub(r.object.position).normalize()}function R(L){return Math.max(r.minDistance,Math.min(r.maxDistance,L))}function ge(L){y.set(L.clientX,L.clientY)}function Te(L){me(L),C.set(L.clientX,L.clientY)}function ye(L){k.set(L.clientX,L.clientY)}function Oe(L){x.set(L.clientX,L.clientY),v.subVectors(x,y).multiplyScalar(r.rotateSpeed);const Y=r.domElement;Y&&(D(2*Math.PI*v.x/Y.clientHeight),B(2*Math.PI*v.y/Y.clientHeight)),y.copy(x),r.update()}function G(L){P.set(L.clientX,L.clientY),h.subVectors(P,C),h.y>0?_(F()):h.y<0&&ee(F()),C.copy(P),r.update()}function w(L){M.set(L.clientX,L.clientY),A.subVectors(M,k).multiplyScalar(r.panSpeed),oe(A.x,A.y),k.copy(M),r.update()}function E(L){me(L),L.deltaY<0?ee(F()):L.deltaY>0&&_(F()),r.update()}function N(L){let Y=!1;switch(L.code){case r.keys.UP:oe(0,r.keyPanSpeed),Y=!0;break;case r.keys.BOTTOM:oe(0,-r.keyPanSpeed),Y=!0;break;case r.keys.LEFT:oe(r.keyPanSpeed,0),Y=!0;break;case r.keys.RIGHT:oe(-r.keyPanSpeed,0),Y=!0;break}Y&&(L.preventDefault(),r.update())}function H(){if(m.length==1)y.set(m[0].pageX,m[0].pageY);else{const L=.5*(m[0].pageX+m[1].pageX),Y=.5*(m[0].pageY+m[1].pageY);y.set(L,Y)}}function z(){if(m.length==1)k.set(m[0].pageX,m[0].pageY);else{const L=.5*(m[0].pageX+m[1].pageX),Y=.5*(m[0].pageY+m[1].pageY);k.set(L,Y)}}function q(){const L=m[0].pageX-m[1].pageX,Y=m[0].pageY-m[1].pageY,X=Math.sqrt(L*L+Y*Y);C.set(0,X)}function te(){r.enableZoom&&q(),r.enablePan&&z()}function xe(){r.enableZoom&&q(),r.enableRotate&&H()}function _e(L){if(m.length==1)x.set(L.pageX,L.pageY);else{const X=pt(L),Ee=.5*(L.pageX+X.x),Qe=.5*(L.pageY+X.y);x.set(Ee,Qe)}v.subVectors(x,y).multiplyScalar(r.rotateSpeed);const Y=r.domElement;Y&&(D(2*Math.PI*v.x/Y.clientHeight),B(2*Math.PI*v.y/Y.clientHeight)),y.copy(x)}function fe(L){if(m.length==1)M.set(L.pageX,L.pageY);else{const Y=pt(L),X=.5*(L.pageX+Y.x),Ee=.5*(L.pageY+Y.y);M.set(X,Ee)}A.subVectors(M,k).multiplyScalar(r.panSpeed),oe(A.x,A.y),k.copy(M)}function ve(L){const Y=pt(L),X=L.pageX-Y.x,Ee=L.pageY-Y.y,Qe=Math.sqrt(X*X+Ee*Ee);P.set(0,Qe),h.set(0,Math.pow(P.y/C.y,r.zoomSpeed)),_(h.y),C.copy(P)}function Ie(L){r.enableZoom&&ve(L),r.enablePan&&fe(L)}function we(L){r.enableZoom&&ve(L),r.enableRotate&&_e(L)}function Me(L){var Y,X;r.enabled!==!1&&(m.length===0&&((Y=r.domElement)==null||Y.ownerDocument.addEventListener("pointermove",Ve),(X=r.domElement)==null||X.ownerDocument.addEventListener("pointerup",tt)),dt(L),L.pointerType==="touch"?ue(L):en(L))}function Ve(L){r.enabled!==!1&&(L.pointerType==="touch"?be(L):U(L))}function tt(L){var Y,X,Ee;ot(L),m.length===0&&((Y=r.domElement)==null||Y.releasePointerCapture(L.pointerId),(X=r.domElement)==null||X.ownerDocument.removeEventListener("pointermove",Ve),(Ee=r.domElement)==null||Ee.ownerDocument.removeEventListener("pointerup",tt)),r.dispatchEvent(a),l=s.NONE}function en(L){let Y;switch(L.button){case 0:Y=r.mouseButtons.LEFT;break;case 1:Y=r.mouseButtons.MIDDLE;break;case 2:Y=r.mouseButtons.RIGHT;break;default:Y=-1}switch(Y){case yt.DOLLY:if(r.enableZoom===!1)return;Te(L),l=s.DOLLY;break;case yt.ROTATE:if(L.ctrlKey||L.metaKey||L.shiftKey){if(r.enablePan===!1)return;ye(L),l=s.PAN}else{if(r.enableRotate===!1)return;ge(L),l=s.ROTATE}break;case yt.PAN:if(L.ctrlKey||L.metaKey||L.shiftKey){if(r.enableRotate===!1)return;ge(L),l=s.ROTATE}else{if(r.enablePan===!1)return;ye(L),l=s.PAN}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function U(L){if(r.enabled!==!1)switch(l){case s.ROTATE:if(r.enableRotate===!1)return;Oe(L);break;case s.DOLLY:if(r.enableZoom===!1)return;G(L);break;case s.PAN:if(r.enablePan===!1)return;w(L);break}}function K(L){r.enabled===!1||r.enableZoom===!1||l!==s.NONE&&l!==s.ROTATE||(L.preventDefault(),r.dispatchEvent(o),E(L),r.dispatchEvent(a))}function ie(L){r.enabled===!1||r.enablePan===!1||N(L)}function ue(L){switch(bt(L),m.length){case 1:switch(r.touches.ONE){case _t.ROTATE:if(r.enableRotate===!1)return;H(),l=s.TOUCH_ROTATE;break;case _t.PAN:if(r.enablePan===!1)return;z(),l=s.TOUCH_PAN;break;default:l=s.NONE}break;case 2:switch(r.touches.TWO){case _t.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;te(),l=s.TOUCH_DOLLY_PAN;break;case _t.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;xe(),l=s.TOUCH_DOLLY_ROTATE;break;default:l=s.NONE}break;default:l=s.NONE}l!==s.NONE&&r.dispatchEvent(o)}function be(L){switch(bt(L),l){case s.TOUCH_ROTATE:if(r.enableRotate===!1)return;_e(L),r.update();break;case s.TOUCH_PAN:if(r.enablePan===!1)return;fe(L),r.update();break;case s.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ie(L),r.update();break;case s.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;we(L),r.update();break;default:l=s.NONE}}function He(L){r.enabled!==!1&&L.preventDefault()}function dt(L){m.push(L)}function ot(L){delete T[L.pointerId];for(let Y=0;Y{ee(L),r.update()},this.dollyOut=(L=F())=>{_(L),r.update()},this.getScale=()=>p,this.setScale=L=>{Z(L),r.update()},this.getZoomScale=()=>F(),n!==void 0&&this.connect(n),this.update()}}new xt;new ae;new Xo;new ae;var uc=Object.defineProperty,cc=(t,e,n)=>e in t?uc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fi=(t,e,n)=>(cc(t,typeof e!="symbol"?e+"":e,n),n);class Ia{constructor(e){fi(this,"data"),this.data=e}generateShapes(e,n=100,r){const i=[],o={letterSpacing:0,lineHeight:1,...r},a=fc(e,n,this.data,o);for(let s=0,l=a.length;s - #include - #include - uniform float thickness; - uniform bool screenspace; - uniform vec2 size; - void main() { - #if defined (USE_SKINNING) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - vec4 tNormal = vec4(normal, 0.0); - vec4 tPosition = vec4(transformed, 1.0); - #ifdef USE_INSTANCING - tNormal = instanceMatrix * tNormal; - tPosition = instanceMatrix * tPosition; - #endif - if (screenspace) { - vec3 newPosition = tPosition.xyz + tNormal.xyz * thickness; - gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0); - } else { - vec4 clipPosition = projectionMatrix * modelViewMatrix * tPosition; - vec4 clipNormal = projectionMatrix * modelViewMatrix * tNormal; - vec2 offset = normalize(clipNormal.xy) * thickness / size * clipPosition.w * 2.0; - clipPosition.xy += offset; - gl_Position = clipPosition; - } - }`,`uniform vec3 color; - uniform float opacity; - void main(){ - gl_FragColor = vec4(color, opacity); - #include - #include - }`);const pc=["args","material-uniforms-color-value"];Or.ReflectorShader;new ae;new ae;new ae;var fr;/Mac/.test((fr=globalThis==null?void 0:globalThis.navigator)===null||fr===void 0?void 0:fr.platform);const hc=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","mouse-buttons","args"],mc=Be({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{default:()=>({ONE:_t.ROTATE,TWO:_t.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1},mouseButtons:{default:()=>({LEFT:yt.ROTATE,MIDDLE:yt.DOLLY,RIGHT:yt.PAN})}},emits:["change","start","end"],setup(t,{expose:e,emit:n}){const r=t,i=n,{makeDefault:o,autoRotate:a,autoRotateSpeed:s,enableDamping:l,dampingFactor:u,enablePan:c,keyPanSpeed:f,maxAzimuthAngle:p,minAzimuthAngle:d,maxPolarAngle:y,minPolarAngle:x,minDistance:v,maxDistance:k,minZoom:M,maxZoom:A,enableZoom:C,zoomSpeed:P,enableRotate:h,touches:I,rotateSpeed:b,target:g,mouseButtons:m}=Jr(r),{camera:T,renderer:S,extend:F,controls:D,invalidate:B}=Yn(),j=Yo(null);F({OrbitControls:lc}),Fe(j,Z=>{J(),Z&&o.value?D.value=Z:D.value=null});function J(){ar(j.value,"change",()=>{i("change",j.value),B()}),ar(j.value,"start",()=>i("start",j.value)),ar(j.value,"end",()=>i("end",j.value))}const{onBeforeRender:oe}=On();return oe(({invalidate:Z})=>{j.value&&(l.value||a.value)&&(j.value.update(),a.value&&Z())}),Ot(()=>{j.value&&j.value.dispose()}),e({instance:j}),(Z,_)=>(Z.camera||V(T))&&(Z.domElement||V(S))?(Q(),re("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:j,target:V(g),"auto-rotate":V(a),"auto-rotate-speed":V(s),"enable-damping":V(l),"damping-factor":V(u),"enable-pan":V(c),"key-pan-speed":V(f),keys:Z.keys,"max-azimuth-angle":V(p),"min-azimuth-angle":V(d),"max-polar-angle":V(y),"min-polar-angle":V(x),"min-distance":V(v),"max-distance":V(k),"min-zoom":V(M),"max-zoom":V(A),touches:V(I),"enable-zoom":V(C),"zoom-speed":V(P),"enable-rotate":V(h),"rotate-speed":V(b),"mouse-buttons":V(m),args:[Z.camera||V(T),Z.domElement||V(S).domElement]},null,8,hc)):it("",!0)}});function Sn(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Yi={exports:{}},qi;function gc(){return qi||(qi=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,o){function a(u,c){if(!i[u]){if(!r[u]){var f=typeof Sn=="function"&&Sn;if(!c&&f)return f(u,!0);if(s)return s(u,!0);throw new Error("Cannot find module '"+u+"'")}c=i[u]={exports:{}},r[u][0].call(c.exports,function(p){var d=r[u][1][p];return a(d||p)},c,c.exports,n,r,i,o)}return i[u].exports}for(var s=typeof Sn=="function"&&Sn,l=0;l>16),B((65280&m)>>8),B(255&m);return T==2?B(255&(m=I(b.charAt(g))<<2|I(b.charAt(g+1))>>4)):T==1&&(B((m=I(b.charAt(g))<<10|I(b.charAt(g+1))<<4|I(b.charAt(g+2))>>2)>>8&255),B(255&m)),S},y.fromByteArray=function(b){var g,m,T,S,F=b.length%3,D="";function B(j){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(j)}for(g=0,T=b.length-F;g>18&63)+B(S>>12&63)+B(S>>6&63)+B(63&S);switch(F){case 1:D=(D+=B((m=b[b.length-1])>>2))+B(m<<4&63)+"==";break;case 2:D=(D=(D+=B((m=(b[b.length-2]<<8)+b[b.length-1])>>10))+B(m>>4&63))+B(m<<2&63)+"="}return D}})(i===void 0?this.base64js={}:i)}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(n,r,i){(function(o,a,v,l,u,c,f,p,d){var y=n("base64-js"),x=n("ieee754");function v(w,E,N){if(!(this instanceof v))return new v(w,E,N);var H,z,q,te,xe=typeof w;if(E==="base64"&&xe=="string")for(w=(te=w).trim?te.trim():te.replace(/^\s+|\s+$/g,"");w.length%4!=0;)w+="=";if(xe=="number")H=oe(w);else if(xe=="string")H=v.byteLength(w,E);else{if(xe!="object")throw new Error("First argument needs to be a number, array or string.");H=oe(w.length)}if(v._useTypedArrays?z=v._augment(new Uint8Array(H)):((z=this).length=H,z._isBuffer=!0),v._useTypedArrays&&typeof w.byteLength=="number")z._set(w);else if(Z(te=w)||v.isBuffer(te)||te&&typeof te=="object"&&typeof te.length=="number")for(q=0;q>8,te=te%256,xe.push(te),xe.push(q);return xe}(E),w,N,H)}function A(w,E,N){var H="";N=Math.min(w.length,N);for(var z=E;z>>0)):(E+1>>0),z}function h(w,E,N,H){if(H||(G(typeof N=="boolean","missing or invalid endian"),G(E!=null,"missing offset"),G(E+1>>8*(H?q:1-q)}function T(w,E,N,H,z){if(z||(G(E!=null,"missing value"),G(typeof H=="boolean","missing or invalid endian"),G(N!=null,"missing offset"),G(N+3>>8*(H?q:3-q)&255}function S(w,E,N,H,z){z||(G(E!=null,"missing value"),G(typeof H=="boolean","missing or invalid endian"),G(N!=null,"missing offset"),G(N+1this.length&&(H=this.length);var z=(H=w.length-E=this.length))return this[w]},v.prototype.readUInt16LE=function(w,E){return C(this,w,!0,E)},v.prototype.readUInt16BE=function(w,E){return C(this,w,!1,E)},v.prototype.readUInt32LE=function(w,E){return P(this,w,!0,E)},v.prototype.readUInt32BE=function(w,E){return P(this,w,!1,E)},v.prototype.readInt8=function(w,E){if(E||(G(w!=null,"missing offset"),G(w=this.length))return 128&this[w]?-1*(255-this[w]+1):this[w]},v.prototype.readInt16LE=function(w,E){return h(this,w,!0,E)},v.prototype.readInt16BE=function(w,E){return h(this,w,!1,E)},v.prototype.readInt32LE=function(w,E){return I(this,w,!0,E)},v.prototype.readInt32BE=function(w,E){return I(this,w,!1,E)},v.prototype.readFloatLE=function(w,E){return b(this,w,!0,E)},v.prototype.readFloatBE=function(w,E){return b(this,w,!1,E)},v.prototype.readDoubleLE=function(w,E){return g(this,w,!0,E)},v.prototype.readDoubleBE=function(w,E){return g(this,w,!1,E)},v.prototype.writeUInt8=function(w,E,N){N||(G(w!=null,"missing value"),G(E!=null,"missing offset"),G(E=this.length||(this[E]=w)},v.prototype.writeUInt16LE=function(w,E,N){m(this,w,E,!0,N)},v.prototype.writeUInt16BE=function(w,E,N){m(this,w,E,!1,N)},v.prototype.writeUInt32LE=function(w,E,N){T(this,w,E,!0,N)},v.prototype.writeUInt32BE=function(w,E,N){T(this,w,E,!1,N)},v.prototype.writeInt8=function(w,E,N){N||(G(w!=null,"missing value"),G(E!=null,"missing offset"),G(E=this.length||(0<=w?this.writeUInt8(w,E,N):this.writeUInt8(255+w+1,E,N))},v.prototype.writeInt16LE=function(w,E,N){S(this,w,E,!0,N)},v.prototype.writeInt16BE=function(w,E,N){S(this,w,E,!1,N)},v.prototype.writeInt32LE=function(w,E,N){F(this,w,E,!0,N)},v.prototype.writeInt32BE=function(w,E,N){F(this,w,E,!1,N)},v.prototype.writeFloatLE=function(w,E,N){D(this,w,E,!0,N)},v.prototype.writeFloatBE=function(w,E,N){D(this,w,E,!1,N)},v.prototype.writeDoubleLE=function(w,E,N){B(this,w,E,!0,N)},v.prototype.writeDoubleBE=function(w,E,N){B(this,w,E,!1,N)},v.prototype.fill=function(w,E,N){if(E=E||0,N=N||this.length,G(typeof(w=typeof(w=w||0)=="string"?w.charCodeAt(0):w)=="number"&&!isNaN(w),"value is not a number"),G(E<=N,"end < start"),N!==E&&this.length!==0){G(0<=E&&E"},v.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(v._useTypedArrays)return new v(this).buffer;for(var w=new Uint8Array(this.length),E=0,N=w.length;E=E.length||z>=w.length);z++)E[z+N]=w[z];return z}function ge(w){try{return decodeURIComponent(w)}catch{return"�"}}function Te(w,E){G(typeof w=="number","cannot write a non-number as a number"),G(0<=w,"specified a negative value for writing an unsigned value"),G(w<=E,"value is larger than maximum value for type"),G(Math.floor(w)===w,"value has a fractional component")}function ye(w,E,N){G(typeof w=="number","cannot write a non-number as a number"),G(w<=E,"value larger than maximum allowed value"),G(N<=w,"value smaller than minimum allowed value"),G(Math.floor(w)===w,"value has a fractional component")}function Oe(w,E,N){G(typeof w=="number","cannot write a non-number as a number"),G(w<=E,"value larger than maximum allowed value"),G(N<=w,"value smaller than minimum allowed value")}function G(w,E){if(!w)throw new Error(E||"Failed assertion")}v._augment=function(w){return w._isBuffer=!0,w._get=w.get,w._set=w.set,w.get=j.get,w.set=j.set,w.write=j.write,w.toString=j.toString,w.toLocaleString=j.toString,w.toJSON=j.toJSON,w.copy=j.copy,w.slice=j.slice,w.readUInt8=j.readUInt8,w.readUInt16LE=j.readUInt16LE,w.readUInt16BE=j.readUInt16BE,w.readUInt32LE=j.readUInt32LE,w.readUInt32BE=j.readUInt32BE,w.readInt8=j.readInt8,w.readInt16LE=j.readInt16LE,w.readInt16BE=j.readInt16BE,w.readInt32LE=j.readInt32LE,w.readInt32BE=j.readInt32BE,w.readFloatLE=j.readFloatLE,w.readFloatBE=j.readFloatBE,w.readDoubleLE=j.readDoubleLE,w.readDoubleBE=j.readDoubleBE,w.writeUInt8=j.writeUInt8,w.writeUInt16LE=j.writeUInt16LE,w.writeUInt16BE=j.writeUInt16BE,w.writeUInt32LE=j.writeUInt32LE,w.writeUInt32BE=j.writeUInt32BE,w.writeInt8=j.writeInt8,w.writeInt16LE=j.writeInt16LE,w.writeInt16BE=j.writeInt16BE,w.writeInt32LE=j.writeInt32LE,w.writeInt32BE=j.writeInt32BE,w.writeFloatLE=j.writeFloatLE,w.writeFloatBE=j.writeFloatBE,w.writeDoubleLE=j.writeDoubleLE,w.writeDoubleBE=j.writeDoubleBE,w.fill=j.fill,w.inspect=j.inspect,w.toArrayBuffer=j.toArrayBuffer,w}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(n,r,i){(function(o,a,y,l,u,c,f,p,d){var y=n("buffer").Buffer,x=4,v=new y(x);v.fill(0),r.exports={hash:function(k,M,A,C){for(var P=M(function(m,T){m.length%x!=0&&(S=m.length+(x-m.length%x),m=y.concat([m,v],S));for(var S,F=[],D=T?m.readInt32BE:m.readInt32LE,B=0;BA?J=j(J):J.length>5]|=128<>>9<<4)]=I;for(var b=1732584193,g=-271733879,m=-1732584194,T=271733878,S=0;S>>32-m,b)}function k(h,I,b,g,m,T,S){return v(I&b|~I&g,h,I,m,T,S)}function M(h,I,b,g,m,T,S){return v(I&g|b&~g,h,I,m,T,S)}function A(h,I,b,g,m,T,S){return v(I^b^g,h,I,m,T,S)}function C(h,I,b,g,m,T,S){return v(b^(I|~g),h,I,m,T,S)}function P(h,I){var b=(65535&h)+(65535&I);return(h>>16)+(I>>16)+(b>>16)<<16|65535&b}r.exports=function(h){return y.hash(h,x,16)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){r.exports=function(y){for(var x,v=new Array(y),k=0;k>>((3&k)<<3)&255;return v}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){var y=n("./helpers");function x(M,A){M[A>>5]|=128<<24-A%32,M[15+(A+64>>9<<4)]=A;for(var C,P,h,I=Array(80),b=1732584193,g=-271733879,m=-1732584194,T=271733878,S=-1009589776,F=0;F>16)+(A>>16)+(C>>16)<<16|65535&C}function k(M,A){return M<>>32-A}r.exports=function(M){return y.hash(M,x,20,!0)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){function y(A,C){var P=(65535&A)+(65535&C);return(A>>16)+(C>>16)+(P>>16)<<16|65535&P}function x(A,C){var P,h=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),I=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),b=new Array(64);A[C>>5]|=128<<24-C%32,A[15+(C+64>>9<<4)]=C;for(var g,m,T=0;T>>C|A<<32-C},M=function(A,C){return A>>>C};r.exports=function(A){return v.hash(A,x,32,!0)}}).call(this,n("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(n,r,i){(function(o,a,s,l,u,c,f,p,d){i.read=function(y,x,v,k,T){var A,C,P=8*T-k-1,h=(1<>1,b=-7,g=v?T-1:0,m=v?-1:1,T=y[x+g];for(g+=m,A=T&(1<<-b)-1,T>>=-b,b+=P;0>=-b,b+=k;0>1,g=M===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=k?0:S-1,T=k?1:-1,S=x<0||x===0&&1/x<0?1:0;for(x=Math.abs(x),isNaN(x)||x===1/0?(P=isNaN(x)?1:0,C=I):(C=Math.floor(Math.log(x)/Math.LN2),x*(k=Math.pow(2,-C))<1&&(C--,k*=2),2<=(x+=1<=C+b?g/k:g*Math.pow(2,1-b))*k&&(C++,k/=2),I<=C+b?(P=0,C=I):1<=C+b?(P=(x*k-1)*Math.pow(2,M),C+=b):(P=x*Math.pow(2,b-1)*Math.pow(2,M),C=0));8<=M;y[v+m]=255&P,m+=T,P/=256,M-=8);for(C=C<>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]),Xi}var Zi,Ji;function Ca(){return Ji||(Ji=1,Zi=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]),Zi}var dr,eo;function xc(){if(eo)return dr;eo=1;var t=Ra();return dr=t.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),dr}var pr,to;function vc(){if(to)return pr;to=1;var t=Ca();return t=t.slice().filter(function(e){return!/^(gl\_|texture)/.test(e)}),pr=t.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),pr}var hr,no;function bc(){if(no)return hr;no=1,hr=C;var t=Ra(),e=yc(),n=Ca(),r=xc(),i=vc(),o=999,a=9999,s=0,l=1,u=2,c=3,f=4,p=5,d=6,y=7,x=8,v=9,k=10,M=11,A=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function C(P){var h=0,I=0,b=o,g,m,T=[],S=[],F=1,D=0,B=0,j=!1,J=!1,oe="",Z;P=P||{};var _=n,ee=t;P.version==="300 es"&&(_=i,ee=r);for(var me={},R={},h=0;h<_.length;h++)me[_[h]]=!0;for(var h=0;h0)continue;we=fe.slice(0,1).join("")}return ge(we),B+=we.length,T=T.slice(we.length),T.length}while(!0)}function q(){return/[^a-fA-F0-9]/.test(g)?(ge(T.join("")),b=o,h):(T.push(g),m=g,h+1)}function te(){return g==="."||/[eE]/.test(g)?(T.push(g),b=p,m=g,h+1):g==="x"&&T.length===1&&T[0]==="0"?(b=M,T.push(g),m=g,h+1):/[^\d]/.test(g)?(ge(T.join("")),b=o,h):(T.push(g),m=g,h+1)}function xe(){return g==="f"&&(T.push(g),m=g,h+=1),/[eE]/.test(g)||(g==="-"||g==="+")&&/[eE]/.test(m)?(T.push(g),m=g,h+1):/[^\d]/.test(g)?(ge(T.join("")),b=o,h):(T.push(g),m=g,h+1)}function _e(){if(/[^\d\w_]/.test(g)){var fe=T.join("");return R[fe]?b=x:me[fe]?b=y:b=d,ge(T.join("")),b=o,h}return T.push(g),m=g,h+1}}return hr}var mr,ro;function wc(){if(ro)return mr;ro=1;var t=bc();mr=e;function e(n,r){var i=t(r),o=[];return o=o.concat(i(n)),o=o.concat(i(null)),o}return mr}wc();function kc(t,e){if(typeof t!="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Tc(t){var e=kc(t,"string");return typeof e=="symbol"?e:String(e)}function Se(t,e,n){return e=Tc(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var le={position:"csm_Position",positionRaw:"csm_PositionRaw",pointSize:"csm_PointSize",fragColor:"csm_FragColor",diffuseColor:"csm_DiffuseColor",normal:"csm_Normal",roughness:"csm_Roughness",metalness:"csm_Metalness",emissive:"csm_Emissive",ao:"csm_AO",bump:"csm_Bump",depthAlpha:"csm_DepthAlpha"},Ge,zt;Ge={},Se(Ge,"".concat(le.normal),{"#include ":` - vec3 objectNormal = `.concat(le.normal,`; - #ifdef USE_TANGENT - vec3 objectTangent = vec3( tangent.xyz ); - #endif - `)}),Se(Ge,"".concat(le.position),{"#include ":` - vec3 transformed = `.concat(le.position,`; - `)}),Se(Ge,"".concat(le.positionRaw),{"#include ":` - vec4 csm_internal_positionUnprojected = `.concat(le.positionRaw,`; - mat4x4 csm_internal_unprojectMatrix = projectionMatrix * modelViewMatrix; - #ifdef USE_INSTANCING - csm_internal_unprojectMatrix = csm_internal_unprojectMatrix * instanceMatrix; - #endif - csm_internal_positionUnprojected = inverse(csm_internal_unprojectMatrix) * csm_internal_positionUnprojected; - vec3 transformed = csm_internal_positionUnprojected.xyz; - `)}),Se(Ge,"".concat(le.pointSize),{"gl_PointSize = size;":` - gl_PointSize = `.concat(le.pointSize,`; - `)}),Se(Ge,"".concat(le.diffuseColor),{"#include ":` - #include - diffuseColor = `.concat(le.diffuseColor,`; - `)}),Se(Ge,"".concat(le.fragColor),{"#include ":` - #include - gl_FragColor = `.concat(le.fragColor,`; - `)}),Se(Ge,"".concat(le.emissive),{"vec3 totalEmissiveRadiance = emissive;":` - vec3 totalEmissiveRadiance = `.concat(le.emissive,`; - `)}),Se(Ge,"".concat(le.roughness),{"#include ":` - #include - roughnessFactor = `.concat(le.roughness,`; - `)}),Se(Ge,"".concat(le.metalness),{"#include ":` - #include - metalnessFactor = `.concat(le.metalness,`; - `)}),Se(Ge,"".concat(le.ao),{"#include ":` - #include - reflectedLight.indirectDiffuse *= 1. - `.concat(le.ao,`; - `)}),Se(Ge,"".concat(le.bump),{"#include ":` - #include - - vec3 csm_internal_orthogonal = `.concat(le.bump," - (dot(").concat(le.bump,`, normal) * normal); - vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; - normal = normalize(normal - csm_internal_projectedbump); - `)}),Se(Ge,"".concat(le.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(le.depthAlpha,` ); - `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` - gl_FragColor = packDepthToRGBA( fragCoordZ ); - gl_FragColor.a *= `.concat(le.depthAlpha,`; - `)});zt={},Se(zt,"".concat(le.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` - gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(le.position,`, 1.0 ); - `)}),Se(zt,"".concat(le.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` - gl_Position = `.concat(le.position,`; - `)}),Se(zt,"".concat(le.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` - gl_FragColor = `.concat(le.diffuseColor,`; - `)}),Se(zt,"".concat(le.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` - gl_FragColor = `.concat(le.fragColor,`; - `)});var $e;$e={},Se($e,"".concat(le.position),"*"),Se($e,"".concat(le.positionRaw),"*"),Se($e,"".concat(le.normal),"*"),Se($e,"".concat(le.pointSize),["PointsMaterial"]),Se($e,"".concat(le.diffuseColor),"*"),Se($e,"".concat(le.fragColor),"*"),Se($e,"".concat(le.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se($e,"".concat(le.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Se($e,"".concat(le.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Se($e,"".concat(le.depthAlpha),"*");var _c=`void main() { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); -}`,Ac=`#include - -void main() { - vec2 center = vec2(0., 1.); - float rotation = 0.0; - - - - float size = 0.03; - - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - - gl_Position = projectionMatrix * mvPosition; -}`;const vn=new ae(0,0,0),di=new ae(0,0,0),Ec=new ae(0,0,0);function io(t,e,n){const r=vn.setFromMatrixPosition(t.matrixWorld);r.project(e);const i=n.width/2,o=n.height/2;return[(Number.isNaN(r.x)?0:r.x)*i+i,-(r.y*o)+o,r.z]}function Mc(t,e){const n=vn.setFromMatrixPosition(t.matrixWorld),r=di.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),o=e.getWorldDirection(Ec);return i.angleTo(o)>Math.PI/2}function Sc(t,e,n,r){const i=vn.setFromMatrixPosition(t.matrixWorld),o=i.clone();o.project(e),n.setFromCamera(new Pe(o.x,o.y),e);const a=n.intersectObjects(r,!0);if(a.length>0){const s=a[0].distance;return i.distanceTo(n.ray.origin)Math.abs(t)<1e-10?0:t;function Na(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=Fr(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const Cc=(t=>e=>Na(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Nc=(t=>(e,n)=>Na(e,t(n),"translate(-50%,-50%)"))(t=>[1/t,1/t,1/t,1,-1/t,-1/t,-1/t,-1,1/t,1/t,1/t,1,1,1,1,1]),Lc=["geometry","material"];new Zo;var zr={exports:{}},Pc=zr.exports,oo;function Dc(){return oo||(oo=1,function(t,e){(function(n,r){t.exports=r()})(Pc,function(){var n=function(){function r(d){return a.appendChild(d.dom),d}function i(d){for(var y=0;yl+1e3&&(c.update(1e3*u/(d-l),100),l=d,u=0,p)){var y=performance.memory;p.update(y.usedJSHeapSize/1048576,y.jsHeapSizeLimit/1048576)}return d},update:function(){s=this.end()},domElement:a,setMode:i}};return n.Panel=function(r,i,o){var a=1/0,s=0,l=Math.round,u=l(window.devicePixelRatio||1),c=80*u,f=48*u,p=3*u,d=2*u,y=3*u,x=15*u,v=74*u,k=30*u,M=document.createElement("canvas");M.width=c,M.height=f,M.style.cssText="width:80px;height:48px";var A=M.getContext("2d");return A.font="bold "+9*u+"px Helvetica,Arial,sans-serif",A.textBaseline="top",A.fillStyle=o,A.fillRect(0,0,c,f),A.fillStyle=i,A.fillText(r,p,d),A.fillRect(y,x,v,k),A.fillStyle=o,A.globalAlpha=.9,A.fillRect(y,x,v,k),{dom:M,update:function(C,P){a=Math.min(a,C),s=Math.max(s,C),A.fillStyle=o,A.globalAlpha=1,A.fillRect(0,0,c,x),A.fillStyle=i,A.fillText(l(C)+" "+r+" ("+l(a)+"-"+l(s)+")",p,d),A.drawImage(M,y+u,x,v-u,k,y,x,v-u,k),A.fillRect(y+v-u,x,u,k),A.fillStyle=o,A.globalAlpha=.9,A.fillRect(y+v-u,x,u,l((1-C/P)*k))}}},n})}(zr)),zr.exports}Dc();const Oc={key:0,args:[0,1,64]},Bc={key:1,args:[.5,1,64]},Fc={key:2},zc=["tone-mapped","map","side","color"];new ze(16777215);const Ut=Be({__name:"Range",props:{modelValue:null,min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","mousedown"],setup(t,{emit:e}){const n=t,r=e,i=W(null);function o(y,x,v){return Math.min(Math.max(y,x),v)}function a(y){const x=y.toString();return x.includes("e-")?Number.parseInt(x.split("e-")[1],10):x.includes(".")?x.split(".")[1].length:0}function s(y,x){const v=a(x),k=10**(v+3);return Number.parseFloat((y*k/k).toFixed(v))}const l=je(()=>s(o(n.modelValue,n.min,n.max),n.step)),u=je(()=>{const y=(l.value-n.min)/(n.max-n.min)*100;return{width:`${y}%`,backgroundSize:`${y}% 100%`}});function c(y){if(!i.value)return l.value;const x=i.value.getBoundingClientRect(),k=(y.clientX-x.left)/x.width,M=n.max-n.min,A=n.min+M*k,C=Math.round(A/n.step)*n.step;return Math.min(Math.max(C,n.min),n.max)}function f(y){if(n.disabled)return;const x=c(y);r("update:modelValue",x)}function p(y){if(n.disabled)return;y.preventDefault();const x=c(y);r("update:modelValue",x),window.addEventListener("mousemove",f),window.addEventListener("mouseup",d)}function d(y){window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",d)}return Ot(()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",d)}),(y,x)=>(Q(),re("span",{ref_key:"sliderRef",ref:i,class:st(["range-slider disabled:pointer-events-none disabled:cursor-default disabled:opacity-50",{disabled:t.disabled}]),bg:"[#e6e1fc] dark:[#676085]","touch-action-none":"",relative:"","inline-block":"","w-full":"","cursor-ew-resize":"","rounded-sm":"",onMousedown:p},[O("span",{style:Lr(u.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),O("span",{role:"slider",class:"slider-thumb",style:Lr({left:`${(l.value-t.min)/(t.max-t.min)*100}%`}),absolute:"","rounded-sm":"",w:"[1px]",h:"[14px]",bg:"neutral-100 dark:neutral-400",top:"50%",transform:"translate-x-[50%] translate-y-[-50%]"},null,4)],34))}});function ao(t,e){if(e===Gs)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===Pr||e===oa){let n=t.getIndex();if(n===null){const a=[],s=t.getAttribute("position");if(s!==void 0){for(let l=0;l=2.0 are supported."));return}const u=new bf(o,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&s[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(a),u.setPlugins(s),u.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,o){r.parse(e,n,i,o)})}}function jc(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const de={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Vc{constructor(e){this.parser=e,this.name=de.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,o.source,a)}}class nf{constructor(e){this.parser=e,this.name=de.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const a=o.extensions[n],s=i.images[a.source];let l=r.textureLoader;if(s.uri){const u=r.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class rf{constructor(e){this.parser=e,this.name=de.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,o=i.textures[e];if(!o.extensions||!o.extensions[n])return null;const a=o.extensions[n],s=i.images[a.source];let l=r.textureLoader;if(s.uri){const u=r.options.manager.getHandler(s.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return r.loadTextureImage(e,a.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class of{constructor(e){this.name=de.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(s){const l=i.byteOffset||0,u=i.byteLength||0,c=i.count,f=i.byteStride,p=new Uint8Array(s,l,u);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(c,f,p,i.mode,i.filter).then(function(d){return d.buffer}):a.ready.then(function(){const d=new ArrayBuffer(c*f);return a.decodeGltfBuffer(new Uint8Array(d),c,f,p,i.mode,i.filter),d})})}else return null}}class af{constructor(e){this.name=de.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const u of i.primitives)if(u.mode!==nt.TRIANGLES&&u.mode!==nt.TRIANGLE_STRIP&&u.mode!==nt.TRIANGLE_FAN&&u.mode!==void 0)return null;const a=r.extensions[this.name].attributes,s=[],l={};for(const u in a)s.push(this.parser.getDependency("accessor",a[u]).then(c=>(l[u]=c,l[u])));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then(u=>{const c=u.pop(),f=c.isGroup?c.children:[c],p=u[0].count,d=[];for(const y of f){const x=new xt,v=new ae,k=new Bn,M=new ae(1,1,1),A=new Ws(y.geometry,y.material,p);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":t.search(/\.ktx2($|\?)/i)>0||t.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const vf=new xt;class bf{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new jc,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,o=!1,a=-1;if(typeof navigator<"u"){const s=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(s)===!0;const l=s.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,o=s.indexOf("Firefox")>-1,a=o?s.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||o&&a<98?this.textureLoader=new Qs(this.options.manager):this.textureLoader=new Zs(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new aa(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(a){const s={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:r,userData:{}};return Rt(o,s,i),gt(s,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(s)})).then(function(){for(const l of s.scenes)l.updateMatrixWorld();e(s)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,o=n.length;i{const l=this.associations.get(a);l!=null&&this.associations.set(s,l);for(const[u,c]of a.children.entries())o(c,s.children[u])};return o(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&v.setY(g,h[I*l+1]),l>=3&&v.setZ(g,h[I*l+2]),l>=4&&v.setW(g,h[I*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}v.normalized=y}return v})}loadTexture(e){const n=this.json,r=this.options,o=n.textures[e].source,a=n.images[o];let s=this.textureLoader;if(a.uri){const l=r.manager.getHandler(a.uri);l!==null&&(s=l)}return this.loadTextureImage(e,o,s)}loadTextureImage(e,n,r){const i=this,o=this.json,a=o.textures[e],s=o.images[n],l=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const u=this.loadImageSource(n,r).then(function(c){c.flipY=!1,c.name=a.name||s.name||"",c.name===""&&typeof s.uri=="string"&&s.uri.startsWith("data:image/")===!1&&(c.name=s.uri);const p=(o.samplers||{})[a.sampler]||{};return c.magFilter=lo[p.magFilter]||zn,c.minFilter=lo[p.minFilter]||ii,c.wrapS=uo[p.wrapS]||Un,c.wrapT=uo[p.wrapT]||Un,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==Lt&&c.minFilter!==zn,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,n){const r=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const a=i.images[e],s=self.URL||self.webkitURL;let l=a.uri||"",u=!1;if(a.bufferView!==void 0)l=r.getDependency("bufferView",a.bufferView).then(function(f){u=!0;const p=new Blob([f],{type:a.mimeType});return l=s.createObjectURL(p),l});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(f){return new Promise(function(p,d){let y=p;n.isImageBitmapLoader===!0&&(y=function(x){const v=new Fn(x);v.needsUpdate=!0,p(v)}),n.load(cn.resolveURL(f,o.path),y,void 0,d)})}).then(function(f){return u===!0&&s.revokeObjectURL(l),gt(f,a),f.userData.mimeType=a.mimeType||xf(a.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=c,c}assignTexture(e,n,r,i){const o=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(a=a.clone(),a.channel=r.texCoord),o.extensions[de.KHR_TEXTURE_TRANSFORM]){const s=r.extensions!==void 0?r.extensions[de.KHR_TEXTURE_TRANSFORM]:void 0;if(s){const l=o.associations.get(a);a=o.extensions[de.KHR_TEXTURE_TRANSFORM].extendTexture(a,s),o.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[n]=a,a})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,o=n.attributes.color!==void 0,a=n.attributes.normal===void 0;if(e.isPoints){const s="PointsMaterial:"+r.uuid;let l=this.cache.get(s);l||(l=new Js,nr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(s,l)),r=l}else if(e.isLine){const s="LineBasicMaterial:"+r.uuid;let l=this.cache.get(s);l||(l=new el,nr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(s,l)),r=l}if(i||o||a){let s="ClonedMaterial:"+r.uuid+":";i&&(s+="derivative-tangents:"),o&&(s+="vertex-colors:"),a&&(s+="flat-shading:");let l=this.cache.get(s);l||(l=r.clone(),o&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(s,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return sa}loadMaterial(e){const n=this,r=this.json,i=this.extensions,o=r.materials[e];let a;const s={},l=o.extensions||{},u=[];if(l[de.KHR_MATERIALS_UNLIT]){const f=i[de.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),u.push(f.extendParams(s,o,n))}else{const f=o.pbrMetallicRoughness||{};if(s.color=new ze(1,1,1),s.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;s.color.setRGB(p[0],p[1],p[2],vt),s.opacity=p[3]}f.baseColorTexture!==void 0&&u.push(n.assignTexture(s,"map",f.baseColorTexture,mn)),s.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,s.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(u.push(n.assignTexture(s,"metalnessMap",f.metallicRoughnessTexture)),u.push(n.assignTexture(s,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,s)})))}o.doubleSided===!0&&(s.side=qn);const c=o.alphaMode||yr.OPAQUE;if(c===yr.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,c===yr.MASK&&(s.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&a!==Vt&&(u.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new Pe(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;s.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&a!==Vt&&(u.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(s.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&a!==Vt){const f=o.emissiveFactor;s.emissive=new ze().setRGB(f[0],f[1],f[2],vt)}return o.emissiveTexture!==void 0&&a!==Vt&&u.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture,mn)),Promise.all(u).then(function(){const f=new a(s);return o.name&&(f.name=o.name),gt(f,o),n.associations.set(f,{materials:e}),o.extensions&&Rt(i,f,o),f})}createUniqueName(e){const n=hn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function o(s){return r[de.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(s,n).then(function(l){return co(l,s,n)})}const a=[];for(let s=0,l=e.length;s0&&gf(k,o),k.name=n.createUniqueName(o.name||"mesh_"+e),gt(k,o),v.extensions&&Rt(i,k,v),n.assignFinalMaterial(k),f.push(k)}for(let d=0,y=f.length;d1?c=new rr:u.length===1?c=u[0]:c=new oi,c!==u[0])for(let f=0,p=u.length;f{const f=new Map;for(const[p,d]of i.associations)(p instanceof nr||p instanceof Fn)&&f.set(p,d);return c.traverse(p=>{const d=i.associations.get(p);d!=null&&f.set(p,d)}),f};return i.associations=u(o),o})}_createAnimationTracks(e,n,r,i,o){const a=[],s=e.name?e.name:e.uuid,l=[];kt[o.path]===kt.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(s);let u;switch(kt[o.path]){case kt.weights:u=Ii;break;case kt.rotation:u=Ri;break;case kt.translation:case kt.scale:u=Si;break;default:switch(r.itemSize){case 1:u=Ii;break;case 2:case 3:default:u=Si;break}break}const c=i.interpolation!==void 0?pf[i.interpolation]:ei,f=this._getArrayFromAccessor(r);for(let p=0,d=l.length;pnew kl(t)),Ct.register(t=>new Tl(t)),Ct)}async function kf(t){const r=(await Da().loadAsync(t)).userData;if(!r.vrmAnimations){console.warn("No VRM animations found in the .vrma file");return}if(r.vrmAnimations.length===0){console.warn("No VRM animations found in the .vrma file");return}return r.vrmAnimations[0]}async function Tf(t,e){if(!t){console.warn("No VRM found");return}if(e)return _l(e,t)}function _f(){const t=W(!1),e=W(0),n=W(0),r=.2,i=1,o=6,a=W(Math.random()*(o-i)+i);function s(l,u){if(l!=null&&l.expressionManager&&(n.value+=u,!t.value&&n.value>=a.value&&(t.value=!0,e.value=0),t.value)){e.value+=u/r;const c=Math.sin(Math.PI*e.value);l.expressionManager.setValue("blink",c),e.value>=1&&(t.value=!1,n.value=0,l.expressionManager.setValue("blink",0),a.value=Math.random()*(o-i)+i)}}return{update:s}}function Af(){let t=-1,e,n=0;function r(){e?e.set(on(-.25,.25),on(-.2,.15),-.65):e=new ae(on(-.25,.25),on(-.2,.15),-.65)}function i(o,a){var s;!(o!=null&&o.expressionManager)||!o.lookAt||(n>=t?(r(),n=0,t=Al()/1e3):e||r(),o.lookAt.target||(o.lookAt.target=new oi),o.lookAt.target.position.lerp(e,on(.2,.5)),(s=o.lookAt)==null||s.update(a),n+=a)}return{update:i}}async function Ef(t,e){const i=(await Da().loadAsync(t,a=>{var s;return(s=e==null?void 0:e.onProgress)==null?void 0:s.call(e,a)})).userData;if(!i.vrm)return;const o=i.vrm;if(Dr.removeUnnecessaryVertices(o.scene),Dr.combineSkeletons(o.scene),o.scene.traverse(a=>{a.frustumCulled=!1}),o.lookAt){const a=new El(o.lookAt);a.name="lookAtQuaternionProxy",o.scene.add(a)}return e!=null&&e.scene&&e.scene.add(o.scene),e!=null&&e.position&&o.scene.position.set(...e.position),o}function Mf(t){const e=W(null),n=W(!1),r=W(0),i=W(new Map),o=W(new Map),a=W(),s=(k,M,A)=>k+(M-k)*A,l=k=>k<.5?4*k*k*k:1-(-2*k+2)**3/2,u=new Map([["happy",{expression:[{name:"happy",value:1,duration:.3},{name:"aa",value:.3}],blendDuration:.3}],["sad",{expression:[{name:"sad",value:1},{name:"oh",value:.2}],blendDuration:.3}],["angry",{expression:[{name:"angry",value:1},{name:"ee",value:.4}],blendDuration:.2}],["surprised",{expression:[{name:"Surprised",value:1},{name:"oh",value:.6}],blendDuration:.1}],["neutral",{expression:[{name:"neutral",value:1}],blendDuration:.5}]]),c=()=>{a.value&&(clearTimeout(a.value),a.value=void 0)},f=k=>{var A;if(c(),!u.has(k)){console.warn(`Emotion ${k} not found`);return}const M=u.get(k);if(e.value=k,n.value=!0,r.value=0,t.expressionManager){const C=Object.keys(t.expressionManager.expressionMap);for(const P of C)t.expressionManager.setValue(P,0)}i.value.clear(),o.value.clear();for(const C of M.expression||[]){const P=((A=t.expressionManager)==null?void 0:A.getValue(C.name))||0;i.value.set(C.name,P),o.value.set(C.name,C.value)}};return{currentEmotion:e,isTransitioning:n,setEmotion:f,setEmotionWithResetAfter:(k,M)=>{c(),f(k),a.value=setTimeout(()=>{f("neutral"),a.value=void 0},M)},update:k=>{var C;if(!n.value||!e.value)return;const A=u.get(e.value).blendDuration||.3;r.value+=k/A,r.value>=1&&(r.value=1,n.value=!1);for(const[P,h]of o.value){const I=i.value.get(P)||0,b=s(I,h,l(r.value));(C=t.expressionManager)==null||C.setValue(P,b)}},addEmotionState:(k,M)=>{u.set(k,M)},removeEmotionState:k=>{u.delete(k)},dispose:()=>{c()}}}const Sf=Be({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null,paused:{type:Boolean}},emits:["loadModelProgress","error"],setup(t,{expose:e,emit:n}){const r=t,i=n;let o;const a=W(),s=W(),{scene:l}=Yn(),{onBeforeRender:u}=On(),c=_f(),f=Af(),p=W();Fe(()=>r.position,([x,v,k])=>{a.value&&a.value.scene.position.set(x,v,k)}),pn(async()=>{if(l.value)try{const x=await Ef(r.model,{scene:l.value,lookAt:!0,position:r.position,onProgress:M=>i("loadModelProgress",Number.parseFloat((100*(M.loaded/M.total)).toFixed(2)))});if(!x){console.warn("No VRM model loaded");return}const v=await kf(r.idleAnimation),k=await Tf(x,v);if(!k){console.warn("No VRM animation loaded");return}s.value=new fl(x.scene),s.value.clipAction(k).play(),p.value=Mf(x),a.value=x,o=u(({delta:M})=>{var A,C,P;(A=s.value)==null||A.update(M),(C=a.value)==null||C.update(M),c.update(a.value,M),f.update(a.value,M),(P=p.value)==null||P.update(M)}).off}catch(x){i("error",x)}}),Ot(()=>{o==null||o(),a.value&&(a.value.scene.removeFromParent(),Dr.deepDispose(a.value.scene))}),e({setExpression(x){var v;(v=p.value)==null||v.setEmotionWithResetAfter(x,1e3)}});const{pause:d,resume:y}=On();return Fe(()=>r.paused,x=>{x?d():y()}),(x,v)=>gn(x.$slots,"default")}}),If=["position"],Rf={absolute:"",bottom:"3",right:"3"},Cf={flex:"~ row","cursor-pointer":""},Nf=["checked","aria-checked"],Lf={key:0,"min-w":"50vw",z:"{var x;(x=p.value)==null||x.setExpression(y)}}),(y,x)=>(Q(),Xt(ha,{relative:""},{default:Ue(({height:v,width:k})=>[ke(V(dl),{alpha:!0,antialias:!0,width:k,height:v},{default:Ue(()=>[ke(V(mc)),O("TresPerspectiveCamera",{position:[a.value,s.value,l.value]},null,8,If),x[14]||(x[14]=O("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),x[15]||(x[15]=O("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),ke(Sf,{ref_key:"modelRef",ref:p,model:r.model,"idle-animation":r.idleAnimation,position:[u.value,c.value,f.value],paused:r.paused,onLoadModelProgress:x[0]||(x[0]=M=>i("loadModelProgress",M)),onError:x[1]||(x[1]=M=>i("error",M))},null,8,["model","idle-animation","position","paused"])]),_:2},1032,["width","height"]),O("div",Rf,[O("div",Cf,[O("label",{class:st([o.value?"bg-neutral-300 dark:bg-neutral-200":"bg-neutral-100 dark:bg-neutral-700"]),transition:"all ease-in-out duration-500",text:"lg neutral-500 dark:neutral-400","m-1":"","h-fit":"","w-fit":"","cursor-pointer":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-2":"","outline-none":""},[At(O("input",{"onUpdate:modelValue":x[2]||(x[2]=M=>o.value=M),checked:o.value,"aria-checked":o.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,Nf),[[Zr,o.value]]),x[16]||(x[16]=O("div",{"select-none":""},[O("div",{"i-solar:bug-bold-duotone":""})],-1))],2)]),ke(ui,null,{default:Ue(()=>[o.value?(Q(),re("div",Lf,[O("div",Pf,[O("div",Df,[O("span",null,he(V(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),ke(Pi,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Ue(()=>[O("span",Of,he(V(d)("stage.viewers.debug-menu.vrm.camera")),1)]),default:Ue(()=>[O("div",Bf,[x[17]||(x[17]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"X")],-1)),O("label",Ff,[ke(Ut,{modelValue:a.value,"onUpdate:modelValue":x[3]||(x[3]=M=>a.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",zf,[O("span",null,he(a.value),1)]),x[18]||(x[18]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Y")],-1)),O("label",Uf,[ke(Ut,{modelValue:s.value,"onUpdate:modelValue":x[4]||(x[4]=M=>s.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",jf,[O("span",null,he(s.value),1)]),x[19]||(x[19]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Z")],-1)),O("label",Vf,[ke(Ut,{modelValue:l.value,"onUpdate:modelValue":x[5]||(x[5]=M=>l.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Hf,[O("span",null,he(l.value),1)])])]),_:1}),ke(Pi,{"h-fit":"","w-full":"",flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},{label:Ue(()=>[O("span",Gf,he(V(d)("stage.viewers.debug-menu.vrm.model.title")),1)]),default:Ue(()=>[O("div",$f,[x[20]||(x[20]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"X")],-1)),O("label",Yf,[ke(Ut,{modelValue:u.value,"onUpdate:modelValue":x[6]||(x[6]=M=>u.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",qf,[O("span",null,he(u.value),1)]),x[21]||(x[21]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Y")],-1)),O("label",Kf,[ke(Ut,{modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=M=>c.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Wf,[O("span",null,he(c.value),1)]),x[22]||(x[22]=O("div",{text:"neutral-400 dark:neutral-500"},[O("span",null,"Z")],-1)),O("label",Xf,[ke(Ut,{modelValue:f.value,"onUpdate:modelValue":x[8]||(x[8]=M=>f.value=M),min:-10,max:10,step:.01},null,8,["modelValue"])]),O("div",Qf,[O("span",null,he(f.value),1)])])]),_:1}),O("div",Zf,[O("span",null,he(V(d)("stage.viewers.debug-menu.emotions")),1)]),O("div",Jf,[O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[9]||(x[9]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("neutral")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.neutral")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[10]||(x[10]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("surprised")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.surprised")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[11]||(x[11]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("sad")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.sad")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[12]||(x[12]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("angry")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.angry")),1),O("button",{"rounded-lg":"",bg:"neutral-100/70 dark:neutral-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:x[13]||(x[13]=M=>{var A;return(A=p.value)==null?void 0:A.setExpression("happy")})},he(V(d)("stage.viewers.debug-menu.emotions-btn.happy")),1)])])])):it("",!0)]),_:1})])]),_:1}))}}),td=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class bn{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}bn.prototype.normal={};bn.prototype.property={};bn.prototype.space=void 0;function Oa(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new bn(n,r,e)}function Vr(t){return t.toLowerCase()}class We{constructor(e,n){this.attribute=n,this.property=e}}We.prototype.attribute="";We.prototype.booleanish=!1;We.prototype.boolean=!1;We.prototype.commaOrSpaceSeparated=!1;We.prototype.commaSeparated=!1;We.prototype.defined=!1;We.prototype.mustUseProperty=!1;We.prototype.number=!1;We.prototype.overloadedBoolean=!1;We.prototype.property="";We.prototype.spaceSeparated=!1;We.prototype.space=void 0;let nd=0;const ce=Bt(),Le=Bt(),Ba=Bt(),$=Bt(),Re=Bt(),qt=Bt(),Ze=Bt();function Bt(){return 2**++nd}const Hr=Object.freeze(Object.defineProperty({__proto__:null,boolean:ce,booleanish:Le,commaOrSpaceSeparated:Ze,commaSeparated:qt,number:$,overloadedBoolean:Ba,spaceSeparated:Re},Symbol.toStringTag,{value:"Module"})),vr=Object.keys(Hr);class pi extends We{constructor(e,n,r,i){let o=-1;if(super(e,n),fo(this,"space",i),typeof r=="number")for(;++o4&&n.slice(0,4)==="data"&&ad.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(po,ud);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!po.test(o)){let a=o.replace(od,ld);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=pi}return new i(r,e)}function ld(t){return"-"+t.toLowerCase()}function ud(t){return t.charAt(1).toUpperCase()}const cd=Oa([Fa,rd,ja,Va,Ha],"html"),Ga=Oa([Fa,id,ja,Va,Ha],"svg"),ho={}.hasOwnProperty;function fd(t,e){const n=e||{};function r(i,...o){let a=r.invalid;const s=r.handlers;if(i&&ho.call(i,t)){const l=String(i[t]);a=ho.call(s,l)?s[l]:r.unknown}if(a)return a.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const dd=/^>|^->||--!>|"],hd=["<",">"];function md(t,e,n,r){return r.settings.bogusComments?"":"";function i(o){return $t(o,Object.assign({},r.settings.characterReferences,{subset:hd}))}}function gd(t,e,n,r){return""}function yd(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function xd(t){return t.join(" ").trim()}const vd=/[ \t\n\f\r]/g;function hi(t){return typeof t=="object"?t.type==="text"?mo(t.value):!1:mo(t)}function mo(t){return t.replace(vd,"")===""}const De=Ya(1),$a=Ya(-1),bd=[];function Ya(t){return e;function e(n,r,i){const o=n?n.children:bd;let a=(r||0)+t,s=o[a];if(!i)for(;s&&hi(s);)a+=t,s=o[a];return s}}const wd={}.hasOwnProperty;function qa(t){return e;function e(n,r,i){return wd.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const mi=qa({body:Td,caption:br,colgroup:br,dd:Md,dt:Ed,head:br,html:kd,li:Ad,optgroup:Sd,option:Id,p:_d,rp:go,rt:go,tbody:Cd,td:yo,tfoot:Nd,th:yo,thead:Rd,tr:Ld});function br(t,e,n){const r=De(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&hi(r.value.charAt(0)))}function kd(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function Td(t,e,n){const r=De(n,e);return!r||r.type!=="comment"}function _d(t,e,n){const r=De(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Ad(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="li"}function Ed(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Md(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function go(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Sd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Id(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Rd(t,e,n){const r=De(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Cd(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Nd(t,e,n){return!De(n,e)}function Ld(t,e,n){const r=De(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function yo(t,e,n){const r=De(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Pd=qa({body:Bd,colgroup:Fd,head:Od,html:Dd,tbody:zd});function Dd(t){const e=De(t,-1);return!e||e.type!=="comment"}function Od(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Bd(t){const e=De(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&hi(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Fd(t,e,n){const r=$a(n,e),i=De(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&mi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function zd(t,e,n){const r=$a(n,e),i=De(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&mi(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const In={name:[[` -\f\r &/=>`.split(""),` -\f\r "&'/=>\``.split("")],[`\0 -\f\r "&'/<=>`.split(""),`\0 -\f\r "&'/<=>\``.split("")]],unquoted:[[` -\f\r &>`.split(""),`\0 -\f\r "&'<=>\``.split("")],[`\0 -\f\r "&'<=>\``.split(""),`\0 -\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Ud(t,e,n,r){const i=r.schema,o=i.space==="svg"?!1:r.settings.omitOptionalTags;let a=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const s=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=Ga);const u=jd(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(a=!1),(u||!o||!Pd(t,e,n))&&(s.push("<",t.tagName,u?" "+u:""),a&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(c),!a&&(!o||!mi(t,e,n))&&s.push(""),s.join("")}function jd(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=Vd(t,i,e[i]);o&&n.push(o)}}for(;++rLi(n,t.alternative)&&(a=t.alternative),s=a+$t(n,Object.assign({},t.settings.characterReferences,{subset:(a==="'"?In.single:In.double)[i][o],attribute:!0}))+a),l+(s&&"="+s))}const Hd=["<","&"];function Ka(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:$t(t.value,Object.assign({},r.settings.characterReferences,{subset:Hd}))}function Gd(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Ka(t,e,n,r)}function $d(t,e,n,r){return r.all(t)}const Yd=fd("type",{invalid:qd,unknown:Kd,handlers:{comment:md,doctype:gd,element:Ud,raw:Gd,root:$d,text:Ka}});function qd(t){throw new Error("Expected node, not `"+t+"`")}function Kd(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Wd={},Xd={},Qd=[];function Zd(t,e){const n=e||Wd,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Jd,all:ep,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||td,characterReferences:n.characterReferences||Xd,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Ga:cd,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Jd(t,e,n){return Yd(t,e,n,this)}function ep(t){const e=[],n=t&&t.children||Qd;let r=-1;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);o0?(ct(t,t.length,0,e),t):e}const bo={}.hasOwnProperty;function op(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Kt(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ut=It(/[A-Za-z]/),et=It(/[\dA-Za-z]/),lp=It(/[#-'*+\--9=?A-Z^-~]/);function Gr(t){return t!==null&&(t<32||t===127)}const $r=It(/\d/),up=It(/[\dA-Fa-f]/),cp=It(/[!-/:-@[-`{-~]/);function se(t){return t!==null&&t<-2}function Ke(t){return t!==null&&(t<0||t===32)}function Ae(t){return t===-2||t===-1||t===32}const fp=It(new RegExp("\\p{P}|\\p{S}","u")),dp=It(/\s/);function It(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Jt(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&o<57344){const s=t.charCodeAt(n+1);o<56320&&s>56319&&s<57344?(a=String.fromCharCode(o,s),i=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ce(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(l){return Ae(l)?(t.enter(n),s(l)):e(l)}function s(l){return Ae(l)&&o++a))return;const I=e.events.length;let b=I,g,m;for(;b--;)if(e.events[b][0]==="exit"&&e.events[b][1].type==="chunkFlow"){if(g){m=e.events[b][1].end;break}g=!0}for(k(r),h=I;hA;){const P=n[C];e.containerState=P[1],P[0].exit.call(e,t)}n.length=A}function M(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function yp(t,e,n){return Ce(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ko(t){if(t===null||Ke(t)||dp(t))return 1;if(fp(t))return 2}function yi(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},p={...t[n][1].start};To(f,-l),To(p,l),a={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...s.end}},t[r][1].end={...a.start},t[n][1].start={...s.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=rt(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=rt(u,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",o,e]]),u=rt(u,yi(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=rt(u,[["exit",o,e],["enter",s,e],["exit",s,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=rt(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,ct(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Ae(h)?Ce(t,M,"linePrefix",o+1)(h):M(h)}function M(h){return h===null||se(h)?t.check(_o,x,C)(h):(t.enter("codeFlowValue"),A(h))}function A(h){return h===null||se(h)?(t.exit("codeFlowValue"),M(h)):(t.consume(h),A)}function C(h){return t.exit("codeFenced"),e(h)}function P(h,I,b){let g=0;return m;function m(B){return h.enter("lineEnding"),h.consume(B),h.exit("lineEnding"),T}function T(B){return h.enter("codeFencedFence"),Ae(B)?Ce(h,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):S(B)}function S(B){return B===s?(h.enter("codeFencedFenceSequence"),F(B)):b(B)}function F(B){return B===s?(g++,h.consume(B),F):g>=a?(h.exit("codeFencedFenceSequence"),Ae(B)?Ce(h,D,"whitespace")(B):D(B)):b(B)}function D(B){return B===null||se(B)?(h.exit("codeFencedFence"),I(B)):b(B)}}}function Ip(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const wr={name:"codeIndented",tokenize:Cp},Rp={partial:!0,tokenize:Np};function Cp(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),Ce(t,o,"linePrefix",5)(u)}function o(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?l(u):se(u)?t.attempt(Rp,a,l)(u):(t.enter("codeFlowValue"),s(u))}function s(u){return u===null||se(u)?(t.exit("codeFlowValue"),a(u)):(t.consume(u),s)}function l(u){return t.exit("codeIndented"),e(u)}}function Np(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Ce(t,o,"linePrefix",5)(a)}function o(a){const s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?e(a):se(a)?i(a):n(a)}}const Lp={name:"codeText",previous:Dp,resolve:Pp,tokenize:Op};function Pp(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length)return this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse();const i=this.left.slice(e);return i.push(...this.right.slice(this.right.length-r+this.left.length).reverse()),i}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&sn(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),sn(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),sn(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function ts(t,e,n,r,i,o,a,s,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(k){return k===60?(t.enter(r),t.enter(i),t.enter(o),t.consume(k),t.exit(o),p):k===null||k===32||k===41||Gr(k)?n(k):(t.enter(r),t.enter(a),t.enter(s),t.enter("chunkString",{contentType:"string"}),x(k))}function p(k){return k===62?(t.enter(o),t.consume(k),t.exit(o),t.exit(i),t.exit(r),e):(t.enter(s),t.enter("chunkString",{contentType:"string"}),d(k))}function d(k){return k===62?(t.exit("chunkString"),t.exit(s),p(k)):k===null||k===60||se(k)?n(k):(t.consume(k),k===92?y:d)}function y(k){return k===60||k===62||k===92?(t.consume(k),d):d(k)}function x(k){return!c&&(k===null||k===41||Ke(k))?(t.exit("chunkString"),t.exit(s),t.exit(a),t.exit(r),e(k)):c999||d===null||d===91||d===93&&!l||d===94&&!s&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):d===93?(t.exit(o),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):se(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||se(d)||s++>999?(t.exit("chunkString"),c(d)):(t.consume(d),l||(l=!Ae(d)),d===92?p:f)}function p(d){return d===91||d===92||d===93?(t.consume(d),s++,f):f(d)}}function rs(t,e,n,r,i,o){let a;return s;function s(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),a=p===40?41:p,l):n(p)}function l(p){return p===a?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(o),u(p))}function u(p){return p===a?(t.exit(o),l(a)):p===null?n(p):se(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),Ce(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===a||p===null||se(p)?(t.exit("chunkString"),u(p)):(t.consume(p),p===92?f:c)}function f(p){return p===a||p===92?(t.consume(p),c):c(p)}}function fn(t,e){let n;return r;function r(i){return se(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ae(i)?Ce(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Gp={name:"definition",tokenize:Yp},$p={partial:!0,tokenize:qp};function Yp(t,e,n){const r=this;let i;return o;function o(d){return t.enter("definition"),a(d)}function a(d){return ns.call(r,t,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function s(d){return i=Kt(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):n(d)}function l(d){return Ke(d)?fn(t,u)(d):u(d)}function u(d){return ts(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function c(d){return t.attempt($p,f,f)(d)}function f(d){return Ae(d)?Ce(t,p,"whitespace")(d):p(d)}function p(d){return d===null||se(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function qp(t,e,n){return r;function r(s){return Ke(s)?fn(t,i)(s):n(s)}function i(s){return rs(t,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function o(s){return Ae(s)?Ce(t,a,"whitespace")(s):a(s)}function a(s){return s===null||se(s)?e(s):n(s)}}const Kp={name:"hardBreakEscape",tokenize:Wp};function Wp(t,e,n){return r;function r(o){return t.enter("hardBreakEscape"),t.consume(o),i}function i(o){return se(o)?(t.exit("hardBreakEscape"),e(o)):n(o)}}const Xp={name:"headingAtx",resolve:Qp,tokenize:Zp};function Qp(t,e){let n=t.length-2,r=3,i,o;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},o={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ct(t,r,n-r+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),t}function Zp(t,e,n){let r=0;return i;function i(c){return t.enter("atxHeading"),o(c)}function o(c){return t.enter("atxHeadingSequence"),a(c)}function a(c){return c===35&&r++<6?(t.consume(c),a):c===null||Ke(c)?(t.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||se(c)?(t.exit("atxHeading"),e(c)):Ae(c)?Ce(t,s,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||Ke(c)?(t.exit("atxHeadingText"),s(c)):(t.consume(c),u)}}const Jp=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Eo=["pre","script","style","textarea"],eh={concrete:!0,name:"htmlFlow",resolveTo:rh,tokenize:ih},th={partial:!0,tokenize:ah},nh={partial:!0,tokenize:oh};function rh(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function ih(t,e,n){const r=this;let i,o,a,s,l;return u;function u(R){return c(R)}function c(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),f}function f(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),o=!0,x):R===63?(t.consume(R),i=3,r.interrupt?e:_):ut(R)?(t.consume(R),a=String.fromCharCode(R),v):n(R)}function p(R){return R===45?(t.consume(R),i=2,d):R===91?(t.consume(R),i=5,s=0,y):ut(R)?(t.consume(R),i=4,r.interrupt?e:_):n(R)}function d(R){return R===45?(t.consume(R),r.interrupt?e:_):n(R)}function y(R){const ge="CDATA[";return R===ge.charCodeAt(s++)?(t.consume(R),s===ge.length?r.interrupt?e:S:y):n(R)}function x(R){return ut(R)?(t.consume(R),a=String.fromCharCode(R),v):n(R)}function v(R){if(R===null||R===47||R===62||Ke(R)){const ge=R===47,Te=a.toLowerCase();return!ge&&!o&&Eo.includes(Te)?(i=1,r.interrupt?e(R):S(R)):Jp.includes(a.toLowerCase())?(i=6,ge?(t.consume(R),k):r.interrupt?e(R):S(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):o?M(R):A(R))}return R===45||et(R)?(t.consume(R),a+=String.fromCharCode(R),v):n(R)}function k(R){return R===62?(t.consume(R),r.interrupt?e:S):n(R)}function M(R){return Ae(R)?(t.consume(R),M):m(R)}function A(R){return R===47?(t.consume(R),m):R===58||R===95||ut(R)?(t.consume(R),C):Ae(R)?(t.consume(R),A):m(R)}function C(R){return R===45||R===46||R===58||R===95||et(R)?(t.consume(R),C):P(R)}function P(R){return R===61?(t.consume(R),h):Ae(R)?(t.consume(R),P):A(R)}function h(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),l=R,I):Ae(R)?(t.consume(R),h):b(R)}function I(R){return R===l?(t.consume(R),l=null,g):R===null||se(R)?n(R):(t.consume(R),I)}function b(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||Ke(R)?P(R):(t.consume(R),b)}function g(R){return R===47||R===62||Ae(R)?A(R):n(R)}function m(R){return R===62?(t.consume(R),T):n(R)}function T(R){return R===null||se(R)?S(R):Ae(R)?(t.consume(R),T):n(R)}function S(R){return R===45&&i===2?(t.consume(R),j):R===60&&i===1?(t.consume(R),J):R===62&&i===4?(t.consume(R),ee):R===63&&i===3?(t.consume(R),_):R===93&&i===5?(t.consume(R),Z):se(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(th,me,F)(R)):R===null||se(R)?(t.exit("htmlFlowData"),F(R)):(t.consume(R),S)}function F(R){return t.check(nh,D,me)(R)}function D(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),B}function B(R){return R===null||se(R)?F(R):(t.enter("htmlFlowData"),S(R))}function j(R){return R===45?(t.consume(R),_):S(R)}function J(R){return R===47?(t.consume(R),a="",oe):S(R)}function oe(R){if(R===62){const ge=a.toLowerCase();return Eo.includes(ge)?(t.consume(R),ee):S(R)}return ut(R)&&a.length<8?(t.consume(R),a+=String.fromCharCode(R),oe):S(R)}function Z(R){return R===93?(t.consume(R),_):S(R)}function _(R){return R===62?(t.consume(R),ee):R===45&&i===2?(t.consume(R),_):S(R)}function ee(R){return R===null||se(R)?(t.exit("htmlFlowData"),me(R)):(t.consume(R),ee)}function me(R){return t.exit("htmlFlow"),e(R)}}function oh(t,e,n){const r=this;return i;function i(a){return se(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function ah(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Qn,e,n)}}const sh={name:"htmlText",tokenize:lh};function lh(t,e,n){const r=this;let i,o,a;return s;function s(_){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(_),l}function l(_){return _===33?(t.consume(_),u):_===47?(t.consume(_),P):_===63?(t.consume(_),A):ut(_)?(t.consume(_),b):n(_)}function u(_){return _===45?(t.consume(_),c):_===91?(t.consume(_),o=0,y):ut(_)?(t.consume(_),M):n(_)}function c(_){return _===45?(t.consume(_),d):n(_)}function f(_){return _===null?n(_):_===45?(t.consume(_),p):se(_)?(a=f,J(_)):(t.consume(_),f)}function p(_){return _===45?(t.consume(_),d):f(_)}function d(_){return _===62?j(_):_===45?p(_):f(_)}function y(_){const ee="CDATA[";return _===ee.charCodeAt(o++)?(t.consume(_),o===ee.length?x:y):n(_)}function x(_){return _===null?n(_):_===93?(t.consume(_),v):se(_)?(a=x,J(_)):(t.consume(_),x)}function v(_){return _===93?(t.consume(_),k):x(_)}function k(_){return _===62?j(_):_===93?(t.consume(_),k):x(_)}function M(_){return _===null||_===62?j(_):se(_)?(a=M,J(_)):(t.consume(_),M)}function A(_){return _===null?n(_):_===63?(t.consume(_),C):se(_)?(a=A,J(_)):(t.consume(_),A)}function C(_){return _===62?j(_):A(_)}function P(_){return ut(_)?(t.consume(_),h):n(_)}function h(_){return _===45||et(_)?(t.consume(_),h):I(_)}function I(_){return se(_)?(a=I,J(_)):Ae(_)?(t.consume(_),I):j(_)}function b(_){return _===45||et(_)?(t.consume(_),b):_===47||_===62||Ke(_)?g(_):n(_)}function g(_){return _===47?(t.consume(_),j):_===58||_===95||ut(_)?(t.consume(_),m):se(_)?(a=g,J(_)):Ae(_)?(t.consume(_),g):j(_)}function m(_){return _===45||_===46||_===58||_===95||et(_)?(t.consume(_),m):T(_)}function T(_){return _===61?(t.consume(_),S):se(_)?(a=T,J(_)):Ae(_)?(t.consume(_),T):g(_)}function S(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(t.consume(_),i=_,F):se(_)?(a=S,J(_)):Ae(_)?(t.consume(_),S):(t.consume(_),D)}function F(_){return _===i?(t.consume(_),i=void 0,B):_===null?n(_):se(_)?(a=F,J(_)):(t.consume(_),F)}function D(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Ke(_)?g(_):(t.consume(_),D)}function B(_){return _===47||_===62||Ke(_)?g(_):n(_)}function j(_){return _===62?(t.consume(_),t.exit("htmlTextData"),t.exit("htmlText"),e):n(_)}function J(_){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),oe}function oe(_){return Ae(_)?Ce(t,Z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):Z(_)}function Z(_){return t.enter("htmlTextData"),a(_)}}const xi={name:"labelEnd",resolveAll:dh,resolveTo:ph,tokenize:hh},uh={tokenize:mh},ch={tokenize:gh},fh={tokenize:yh};function dh(t){let e=-1;const n=[];for(;++e=3&&(u===null||se(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Ae(u)?Ce(t,s,"whitespace")(u):s(u))}}const Ye={continuation:{tokenize:Mh},exit:Ih,name:"list",tokenize:Eh},_h={partial:!0,tokenize:Rh},Ah={partial:!0,tokenize:Sh};function Eh(t,e,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return s;function s(d){const y=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:$r(d)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(Dn,n,u)(d):u(d);if(!r.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return n(d)}function l(d){return $r(d)&&++a<10?(t.consume(d),l):(!r.interrupt||a<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),u(d)):n(d)}function u(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,t.check(Qn,r.interrupt?n:c,t.attempt(_h,p,f))}function c(d){return r.containerState.initialBlankLine=!0,o++,p(d)}function f(d){return Ae(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),p):n(d)}function p(d){return r.containerState.size=o+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function Mh(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Qn,i,o);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(t,e,"listItemIndent",r.containerState.size+1)(s)}function o(s){return r.containerState.furtherBlankLines||!Ae(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Ah,e,a)(s))}function a(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ce(t,t.attempt(Ye,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function Sh(t,e,n){const r=this;return Ce(t,i,"listItemIndent",r.containerState.size+1);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(o):n(o)}}function Ih(t){t.exit(this.containerState.type)}function Rh(t,e,n){const r=this;return Ce(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const a=r.events[r.events.length-1];return!Ae(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):n(o)}}const Mo={name:"setextUnderline",resolveTo:Ch,tokenize:Nh};function Ch(t,e){let n=t.length,r,i,o;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!o&&t[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...t[i][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",o?(t.splice(i,0,["enter",a,e]),t.splice(o+1,0,["exit",t[r][1],e]),t[r][1].end={...t[o][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function Nh(t,e,n){const r=this;let i;return o;function o(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=u,a(u)):n(u)}function a(u){return t.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(t.consume(u),s):(t.exit("setextHeadingLineSequence"),Ae(u)?Ce(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||se(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const Lh={tokenize:Ph};function Ph(t){const e=this,n=t.attempt(Qn,r,t.attempt(this.parser.constructs.flowInitial,i,Ce(t,t.attempt(this.parser.constructs.flow,i,t.attempt(zp,i)),"linePrefix")));return n;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEndingBlank"),t.consume(o),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Dh={resolveAll:os()},Oh=is("string"),Bh=is("text");function is(t){return{resolveAll:os(t==="text"?Fh:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],o=n.attempt(i,a,s);return a;function a(c){return u(c)?o(c):s(c)}function s(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),o(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=i[c];let p=-1;if(f)for(;++p-1){const s=a[0];typeof s=="string"?a[0]=s.slice(r):a.shift()}o>0&&a.push(t[i].slice(0,o))}return a}function Qh(t,e){let n=-1;const r=[];let i;for(;++n0){const He=ie.tokenStack[ie.tokenStack.length-1];(He[1]||Co).call(ie,void 0,He[0])}for(K.position={start:Tt(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Tt(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},be=-1;++be1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function hm(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function mm(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function ls(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function gm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return ls(t,e);const i={src:Jt(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,o),t.applyData(e,o)}function ym(t,e){const n={src:Jt(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function xm(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function vm(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return ls(t,e);const i={href:Jt(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function bm(t,e){const n={href:Jt(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function wm(t,e,n){const r=t.all(e),i=n?km(n):us(e),o={},a=[];if(typeof e.checked=="boolean"){const c=r[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let s=-1;for(;++s1}function Tm(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Mm(t){const e=fs(t),n=cs(t);if(e&&n)return{start:e,end:n}}function Sm(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},s=fs(e.children[1]),l=cs(e.children[e.children.length-1]);s&&l&&(a.position={start:s,end:l}),i.push(a)}const o={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,o),t.applyData(e,o)}function Im(t,e,n){const r=n?n.children:void 0,o=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,s=a?a.length:e.children.length;let l=-1;const u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return o.push(Po(e.slice(i),i>0,!1)),o.join("")}function Po(t,e,n){let r=0,i=t.length;if(e){let o=t.codePointAt(r);for(;o===No||o===Lo;)r++,o=t.codePointAt(r)}if(n){let o=t.codePointAt(i-1);for(;o===No||o===Lo;)i--,o=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function Nm(t,e){const n={type:"text",value:Cm(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Lm(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Pm={blockquote:lm,break:um,code:cm,delete:fm,emphasis:dm,footnoteReference:pm,heading:hm,html:mm,imageReference:gm,image:ym,inlineCode:xm,linkReference:vm,link:bm,listItem:wm,list:Tm,paragraph:_m,root:Am,strong:Em,table:Sm,tableCell:Rm,tableRow:Im,text:Nm,thematicBreak:Lm,toml:Rn,yaml:Rn,definition:Rn,footnoteDefinition:Rn};function Rn(){}const ps=-1,Zn=0,Vn=1,Hn=2,vi=3,bi=4,wi=5,ki=6,hs=7,ms=8,Do=typeof self=="object"?self:globalThis,Dm=(t,e)=>{const n=(i,o)=>(t.set(o,i),i),r=i=>{if(t.has(i))return t.get(i);const[o,a]=e[i];switch(o){case Zn:case ps:return n(a,i);case Vn:{const s=n([],i);for(const l of a)s.push(r(l));return s}case Hn:{const s=n({},i);for(const[l,u]of a)s[r(l)]=r(u);return s}case vi:return n(new Date(a),i);case bi:{const{source:s,flags:l}=a;return n(new RegExp(s,l),i)}case wi:{const s=n(new Map,i);for(const[l,u]of a)s.set(r(l),r(u));return s}case ki:{const s=n(new Set,i);for(const l of a)s.add(r(l));return s}case hs:{const{name:s,message:l}=a;return n(new Do[s](l),i)}case ms:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i)}return n(new Do[o](a),i)};return r},Oo=t=>Dm(new Map,t)(0),jt="",{toString:Om}={},{keys:Bm}=Object,ln=t=>{const e=typeof t;if(e!=="object"||!t)return[Zn,e];const n=Om.call(t).slice(8,-1);switch(n){case"Array":return[Vn,jt];case"Object":return[Hn,jt];case"Date":return[vi,jt];case"RegExp":return[bi,jt];case"Map":return[wi,jt];case"Set":return[ki,jt]}return n.includes("Array")?[Vn,n]:n.includes("Error")?[hs,n]:[Hn,n]},Cn=([t,e])=>t===Zn&&(e==="function"||e==="symbol"),Fm=(t,e,n,r)=>{const i=(a,s)=>{const l=r.push(a)-1;return n.set(s,l),l},o=a=>{if(n.has(a))return n.get(a);let[s,l]=ln(a);switch(s){case Zn:{let c=a;switch(l){case"bigint":s=ms,c=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([ps],a)}return i([s,c],a)}case Vn:{if(l)return i([l,[...a]],a);const c=[],f=i([s,c],a);for(const p of a)c.push(o(p));return f}case Hn:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const c=[],f=i([s,c],a);for(const p of Bm(a))(t||!Cn(ln(a[p])))&&c.push([o(p),o(a[p])]);return f}case vi:return i([s,a.toISOString()],a);case bi:{const{source:c,flags:f}=a;return i([s,{source:c,flags:f}],a)}case wi:{const c=[],f=i([s,c],a);for(const[p,d]of a)(t||!(Cn(ln(p))||Cn(ln(d))))&&c.push([o(p),o(d)]);return f}case ki:{const c=[],f=i([s,c],a);for(const p of a)(t||!Cn(ln(p)))&&c.push(o(p));return f}}const{message:u}=a;return i([s,{name:l,message:u}],a)};return o},Bo=(t,{json:e,lossy:n}={})=>{const r=[];return Fm(!(e||n),!!e,new Map,r)(t),r},Gn=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Oo(Bo(t,e)):structuredClone(t):(t,e)=>Oo(Bo(t,e));function zm(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Um(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function jm(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||zm,r=t.options.footnoteBackLabel||Um,i=t.options.footnoteLabel||"Footnotes",o=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},s=[];let l=-1;for(;++l0&&y.push({type:"text",value:" "});let M=typeof n=="string"?n:n(l,d);typeof M=="string"&&(M={type:"text",value:M}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(d>1?"-"+d:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,d),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const v=c[c.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const M=v.children[v.children.length-1];M&&M.type==="text"?M.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...y)}else c.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(c,!0)};t.patch(u,k),s.push(k)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Gn(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:t.wrap(s,!0)},{type:"text",value:` -`}]}}const gs=function(t){if(t==null)return $m;if(typeof t=="function")return Jn(t);if(typeof t=="object")return Array.isArray(t)?Vm(t):Hm(t);if(typeof t=="string")return Gm(t);throw new Error("Expected function, string, or object as test")};function Vm(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let d=ys,y,x,v;if((!e||o(l,u,c[c.length-1]||void 0))&&(d=Xm(n(l,c)),d[0]===Fo))return d;if("children"in l&&l.children){const k=l;if(k.children&&d[0]!==Km)for(x=(r?k.children.length:-1)+a,v=c.concat(k);x>-1&&x0&&n.push({type:"text",value:` -`}),n}function zo(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Uo(t,e){const n=Jm(t,e),r=n.one(t,void 0),i=jm(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` -`},i),o}function ig(t,e){return t&&"run"in t?async function(n,r){const i=Uo(n,{file:r,...e});await t.run(i,r)}:function(n,r){return Uo(n,{file:r,...t||e})}}function jo(t){if(t)throw t}var Tr,Vo;function og(){if(Vo)return Tr;Vo=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},o=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!f)return!1;var p;for(p in u);return typeof p>"u"||t.call(u,p)},a=function(u,c){n&&c.name==="__proto__"?n(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},s=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return Tr=function l(){var u,c,f,p,d,y,x=arguments[0],v=1,k=arguments.length,M=!1;for(typeof x=="boolean"&&(M=x,x=arguments[1]||{},v=2),(x==null||typeof x!="object"&&typeof x!="function")&&(x={});va.length;let l;s&&a.push(i);try{l=t.apply(this,a)}catch(u){const c=u;if(s&&n)throw c;return i(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(a,...s){n||(n=!0,e(a,...s))}function o(a){i(null,a)}}class Xe extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof e=="string"?i=e:!o.cause&&e&&(a=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?o.ruleId=r:(o.source=r.slice(0,l),o.ruleId=r.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const s=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=dn(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}Xe.prototype.file="";Xe.prototype.name="";Xe.prototype.reason="";Xe.prototype.message="";Xe.prototype.stack="";Xe.prototype.column=void 0;Xe.prototype.line=void 0;Xe.prototype.ancestors=void 0;Xe.prototype.cause=void 0;Xe.prototype.fatal=void 0;Xe.prototype.place=void 0;Xe.prototype.ruleId=void 0;Xe.prototype.source=void 0;const lt={basename:ug,dirname:cg,extname:fg,join:dg,sep:"/"};function ug(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');wn(t);let n=0,r=-1,i=t.length,o;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,s=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(o){n=i+1;break}}else a<0&&(o=!0,a=i+1),s>-1&&(t.codePointAt(i)===e.codePointAt(s--)?s<0&&(r=i):(s=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function cg(t){if(wn(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function fg(t){wn(t);let e=t.length,n=-1,r=0,i=-1,o=0,a;for(;e--;){const s=t.codePointAt(e);if(s===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),s===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function dg(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function hg(t,e){let n="",r=0,i=-1,o=0,a=-1,s,l;for(;++a<=t.length;){if(a2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,o=0;continue}}else if(n.length>0){n="",r=0,i=a,o=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,o=0}else s===46&&o>-1?o++:o=-1}return n}function wn(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const mg={cwd:gg};function gg(){return"/"}function Xr(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function yg(t){if(typeof t=="string")t=new URL(t);else if(!Xr(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return xg(t)}function xg(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[d,...y]=c;const x=r[p][1];Wr(x)&&Wr(d)&&(d=_r(!0,x,d)),r[p]=[u,d,...y]}}}}const Tg=new Ti().freeze();function Sr(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Ir(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Rr(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Go(t){if(!Wr(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function $o(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Nn(t){return _g(t)?t:new vg(t)}function _g(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Ag(t){return typeof t=="string"||Eg(t)}function Eg(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function _i(){const t=Tg().use(sm).use(ig).use(tp);return{process:e=>t.processSync(e).toString()}}const Mg={relative:""},Sg={"h-full":"","w-full":""},Ig={key:0,class:"animate-stripe",absolute:"",left:"1/2",bottom:"20%",z:"20","rounded-2xl":"",text:"primary-600","px-2":"","py-2":"",transform:"translate-x--1/2"},Rg={bg:"primary-50","rounded-xl":"","px-10":"","py-6":""},Cg=["innerHTML"],Ng=Be({__name:"Stage",props:{paused:{type:Boolean,default:!1}},setup(t){const e=W(),n=W(),{stageView:r}=qe(Wt()),{mouthOpenSize:i}=qe(Xl()),{audioContext:o,calculateVolume:a}=pa(),{onBeforeMessageComposed:s,onBeforeSend:l,onTokenLiteral:u,onTokenSpecial:c,onStreamEnd:f,streamingMessage:p,onAssistantResponseEnd:d}=St(),{process:y}=_i(),x=li(),v=W(),k=W(!1),M=W(!1),A=or({handlers:[_=>new Promise(ee=>{const me=o.createBufferSource();me.buffer=_.data.audioBuffer,me.connect(o.destination),me.connect(v.value),k.value=!0,me.start(0),me.onended=()=>{k.value=!1,ee()}})]}),C=Pl(),{ssmlEnabled:P,activeSpeechProvider:h,activeSpeechModel:I,activeSpeechVoice:b,pitch:g}=qe(C);async function m(_){try{if(!h.value){console.warn("No active speech provider configured");return}if(!b.value){console.warn("No active speech voice configured");return}const ee=x.getProviderInstance(h.value);if(!ee){console.error("Failed to initialize speech provider");return}const me=x.getProviderConfig(h.value),R=P.value?C.generateSSML(_.data,b.value,{...me,pitch:g.value}):_.data,ge=await Dl({...ee.speech(I.value,me),input:R,voice:b.value.id}),Te=await o.decodeAudioData(ge);await A.add({audioBuffer:Te,text:_.data})}catch(ee){console.error("Speech generation failed:",ee)}}const T=or({handlers:[m]});T.on("add",_=>{console.debug("ttsQueue added",_)});const S=Ol(T),{live2dCurrentMotion:F}=qe(Wt()),D=or({handlers:[async _=>{if(r.value==="3d"){const ee=Cl[_.data];if(!ee)return;await n.value.setExpression(ee)}else r.value==="2d"&&(F.value={group:Nl[_.data]})}]}),B=Bl(D);B.onHandlerEvent("emotion",_=>{console.debug("emotion detected",_)});const j=Fl();j.onHandlerEvent("delay",_=>{console.debug("delay detected",_)});function J(){requestAnimationFrame(J),k.value&&(i.value=a(v.value,"linear"))}function oe(){M.value||(J(),o.resume(),M.value=!0)}function Z(){v.value||(v.value=o.createAnalyser())}return s(async()=>{Z(),oe()}),l(async()=>{F.value={group:Ni}}),u(async _=>{await S.add(_)}),c(async _=>{await j.add(_),await B.add(_)}),f(async()=>{await j.add(zl)}),d(async _=>{}),Ot(()=>{var ee,me,R;M.value=!1;const _=window;(ee=_.electron)==null||ee.ipcRenderer.removeAllListeners("before-hide"),(me=_.electron)==null||me.ipcRenderer.removeAllListeners("after-show"),(R=_.electron)==null||R.ipcRenderer.removeAllListeners("before-quit")}),pn(()=>{var ee,me,R;const _=window;(ee=_.electron)==null||ee.ipcRenderer.on("before-hide",()=>{F.value={group:Ml}}),(me=_.electron)==null||me.ipcRenderer.on("after-show",()=>{F.value={group:Sl}}),(R=_.electron)==null||R.ipcRenderer.on("before-quit",()=>{F.value={group:Ni}})}),pn(async()=>{e.value=Il({connection:{bundles:Ll()}}),await e.value.execute(Rl`CREATE TABLE memory_test (vec FLOAT[768]);`)}),(_,ee)=>(Q(),re("div",Mg,[O("div",Sg,[V(r)==="2d"?(Q(),Xt(au,{key:0,"mouth-open-size":V(i),"min-w":"50% (Q(),re("header",Fg,[O("div",zg,[ke($l)]),ke(V(hl),{class:"m-1 block max-h-[10lh] min-h-[1lh] rounded-lg bg-neutral-100 p-2 text-lg text-neutral-500 outline-none dark:bg-neutral-800 dark:text-neutral-400",to:"/settings"},{default:Ue(()=>n[0]||(n[0]=[O("div",{"i-solar:settings-minimalistic-bold-duotone":""},null,-1)])),_:1})]))}});function xs(t,e){const n=la(e??{},{...Di.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),r=W(),i=ml("microphone");async function o(){if(r.value&&(r.value.destroy(),r.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const a=V(t);if(!a)return;const s=await navigator.mediaDevices.getUserMedia({audio:{deviceId:a}});r.value=await Di.MicVAD.new({...n,stream:s}),n.auto&&r.value.start()}return Fe(i,o,{immediate:!0}),Fe(gl(t),o,{immediate:!0}),yl(o),Ot(()=>{r.value&&(r.value.destroy(),r.value=void 0)}),{destroy:()=>{r.value&&(r.value.destroy(),r.value=void 0)},start:()=>{r.value&&r.value.start()}}}function jg(t,e){const n=la(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:r,data:i,terminate:o}=xl(t,{type:"module"}),a=W(null),s=W(""),l=W([]),u=W(!1),c=W(0),f=W("");return Fe(i,p=>{var d,y,x,v,k,M,A,C;switch(p.status){case"loading":a.value="loading",s.value=p.data,(d=n.onLoading)==null||d.call(n,p.data);break;case"initiate":l.value.push(p),(y=n.onInitiate)==null||y.call(n,p);break;case"progress":l.value=l.value.map(P=>P.file===p.file?{...P,...p}:P),(x=n.onProgress)==null||x.call(n,p);break;case"done":l.value=l.value.filter(P=>P.file!==p.file),(v=n.onDone)==null||v.call(n,p);break;case"ready":a.value="ready",(k=n.onReady)==null||k.call(n);break;case"start":u.value=!0,(M=n.onStart)==null||M.call(n);break;case"update":c.value=p.tps,(A=n.onUpdate)==null||A.call(n,p.tps);break;case"complete":u.value=!1,f.value=p.output[0]||"",console.debug("Whisper result:",f.value),(C=n.onComplete)==null||C.call(n,p.output[0]);break}}),Ot(()=>{o()}),{transcribe:p=>r(p),status:a,loadingMessage:s,loadingProgress:l,transcribing:u,tps:c,result:f,load:()=>r({type:"load"}),terminate:o}}const Vg="/assets/worker-Pjvo6JHG.js";async function Hg(t,e){const n=new ArrayBuffer(44+t.length*2),r=new DataView(n);Ln(r,0,"RIFF"),r.setUint32(4,36+t.length*2,!0),Ln(r,8,"WAVE"),Ln(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,1,!0),r.setUint32(24,e,!0),r.setUint32(28,e*2,!0),r.setUint16(32,2,!0),r.setUint16(34,16,!0),Ln(r,36,"data"),r.setUint32(40,t.length*2,!0),Gg(r,44,t);const i=new Blob([r],{type:"audio/wav"});return new Promise((o,a)=>{const s=new FileReader;s.onload=()=>{const l=s.result.split(",")[1];o(l)},s.onerror=a,s.readAsDataURL(i)})}function Ln(t,e,n){for(let r=0;r{jn().then(()=>{i.update(),o.value=i.height.value})}),u(async()=>{jn().then(()=>{i.update(),o.value=i.height.value})}),(c,f)=>{const p=ca("auto-animate");return Q(),re("div",$g,[f[2]||(f[2]=O("div",{"flex-1":""},null,-1)),At((Q(),re("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[f[1]||(f[1]=O("div",{"flex-1":""},null,-1)),(Q(!0),re(ai,null,si(V(n),(d,y)=>(Q(),re("div",{key:y,"mb-2":""},[d.role==="error"?(Q(),re("div",Yg,[O("div",qg,[O("div",Kg,[O("div",Wg,[O("span",Xg,he(V(a)("stage.chat.message.character-name.core-system")),1)]),f[0]||(f[0]=O("div",{"i-solar:danger-triangle-bold-duotone":"","text-violet-500":""},null,-1))]),V(r)&&y===V(n).length-1?(Q(),re("div",Qg)):(Q(),re("div",{key:1,class:"markdown-content break-words text-violet-500",text:"base {if(!F||!F.trim())return;const D=o.getProviderConfig(a.value);await y(F,{chatProvider:o.getProviderInstance(a.value),model:s.value,providerConfig:D})}});async function I(){if(e.value.trim())try{const F=o.getProviderConfig(a.value);await y(e.value,{chatProvider:o.getProviderInstance(a.value),model:s.value,providerConfig:F})}catch(F){v.value.pop(),v.value.push({role:"error",content:F.message})}}const{destroy:b,start:g}=xs(d,{onSpeechStart:()=>{n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:F=>{n.value=!1,T(F)},auto:!1});function m(){P.value!=="loading"&&(C(),g())}async function T(F){await k.resume();const D=await Hg(F,k.sampleRate);A({type:"generate",data:{audio:D,language:"en"}})}async function S(F){const D=F.target,B=u.value.find(j=>j.deviceId===D.value);if(!B){f.value=void 0;return}f.value=B}return Fe(p,async F=>{F==="false"&&(b(),h())}),Fe(i,async F=>{F&&await c()}),x(async()=>{e.value=""}),(F,D)=>(Q(),re("div",cy,[O("fieldset",fy,[O("label",{class:st([r.value==="chat"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="chat"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="chat","aria-checked":r.value==="chat",border:"solid l-2 t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-l-lg":"","px-2":""},[At(O("input",{"onUpdate:modelValue":D[0]||(D[0]=B=>r.value=B),type:"radio",name:"tab",value:"chat",hidden:""},null,512),[[ir,r.value]]),D[5]||(D[5]=O("div",{"i-solar:dialog-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",py,[O("span",hy,he(V(M)("stage.chat.tabs.chat")),1)])],10,dy),O("label",{class:st([r.value==="custom"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="custom"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="custom","aria-checked":r.value==="custom",border:"solid t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","px-2":""},[At(O("input",{"onUpdate:modelValue":D[1]||(D[1]=B=>r.value=B),type:"radio",name:"tab",value:"custom",hidden:""},null,512),[[ir,r.value]]),D[6]||(D[6]=O("div",{"i-solar:star-fall-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",gy,[O("span",null,he(V(M)("stage.chat.tabs.custom")),1)])],10,my),O("label",{class:st([r.value==="clothes"?"bg-primary-100 dark:bg-primary-900":"bg-white dark:bg-primary-950",r.value==="clothes"?"text-primary-500 dark:text-primary-500":"",{"transition-colors-none ":V(l)}]),flex:"~ row",checked:r.value==="clothes","aria-checked":r.value==="clothes",border:"solid r-2 t-2 b-2 primary-100 dark:primary-900",bg:"hover:primary-100 dark:hover:primary-900",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-r-lg":"","px-2":""},[At(O("input",{"onUpdate:modelValue":D[2]||(D[2]=B=>r.value=B),type:"radio",name:"tab",value:"clothes",hidden:""},null,512),[[ir,r.value]]),D[7]||(D[7]=O("div",{"i-solar:magic-stick-3-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),O("div",xy,[O("span",null,he(V(M)("stage.chat.tabs.clothes")),1)])],10,yy)]),O("div",vy,[O("div",by,[ke(uy,{"h-full":"","flex-1":"","p-4":"",w:"full","max-h":"e.value=B),placeholder:V(M)("stage.message"),text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500 placeholder:primary-300 placeholder:hover:primary-500 placeholder:dark:primary-300/50 placeholder:dark:hover:primary-500",bg:"primary-100 dark:primary-400/20","min-h":"[100px]","max-h":"[300px]","w-full":"","rounded-t-xl":"","p-4":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",class:st({"transition-colors-none placeholder:transition-colors-none":V(l)}),onSubmit:I},null,8,["modelValue","placeholder","class"])])])]),O("div",ky,[O("button",{bg:"complementary-100 hover:complementary-200 dark:complementary-800 dark:hover:complementary-700",transition:"all duration-250 ease-in-out",class:st({"transition-colors-none":V(l)}),text:"complementary-400","mb-6":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":"",onClick:m},[ke(bl,{mode:"out-in"},{default:Ue(()=>[V(P)===null?(Q(),re("div",Ty,he(V(M)("stage.operations.load-models")),1)):V(P)==="loading"?(Q(),re("div",_y,[D[8]||(D[8]=O("div",{"i-svg-spinners:bouncing-ball":"",class:"text-cyan"},null,-1)),O("span",null,he(V(M)("stage.operations.load-models-status.loading")),1)])):V(P)==="ready"?(Q(),re("div",Ay,[D[9]||(D[9]=O("div",{"i-lucide:check":"",class:"text-cyan"},null,-1)),O("span",null,he(V(M)("stage.operations.load-models-status.ready")),1)])):it("",!0)]),_:1})],2),O("div",Ey,[ke(V(ui),null,{default:Ue(()=>[i.value?(Q(),re("fieldset",My,[(Q(!0),re(ai,null,si(V(u),(B,j)=>(Q(),re("label",{key:j,class:"[&_div_span]:dark:hover:bg-cyan-300 [&_div_span]:dark:hover:bg-cyan-900"},[O("input",{type:"radio",name:"audioInput",value:B.deviceId,hidden:"",onChange:S},null,40,Sy),O("div",Iy,[O("div",Ry,[B.deviceId===V(d)?(Q(),re("div",Cy)):it("",!0)]),O("span",{"inline-block":"",class:st([B.deviceId===V(d)?"cyan-400 dark:text-white":"cyan-400/50 dark:text-white/50"]),transition:"all duration-250 ease-in-out"},he(B.label),3)])]))),128))])):it("",!0)]),_:1}),O("label",{bg:"complementary-100 hover:complementary-200 dark:complementary-800 dark:hover:complementary-700",transition:"all duration-250 ease-in-out",class:st({"transition-colors-none":V(l)}),text:"complementary-400","h-fit":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":""},[At(O("input",{"onUpdate:modelValue":D[4]||(D[4]=B=>i.value=B),type:"checkbox",hidden:""},null,512),[[Zr,i.value]]),D[10]||(D[10]=O("div",{"i-solar:microphone-2-bold-duotone":""},null,-1)),O("div",null,[n.value?(Q(),re("span",Ly,"Listening...")):(Q(),re("span",Ny,he(V(M)("settings.microphone")),1))])],2)])])]))}}),Dy=Kn(Py,[["__scopeId","data-v-1f3e13c7"]]),Oy={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},By={key:0,flex:"",mr:"12"},Fy={flex:"~ col",border:"4 solid primary-200/50 dark:primary-500/50",shadow:"md primary-200/50 dark:none","min-w-20":"","rounded-lg":"","px-2":"","py-1":"",h:"unset {jn().then(()=>{i.update(),o.value=i.height.value})}),l(async()=>{jn().then(()=>{i.update(),o.value=i.height.value})}),(u,c)=>{const f=ca("auto-animate");return Q(),re("div",Oy,[c[1]||(c[1]=O("div",{"flex-1":""},null,-1)),At((Q(),re("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"","max-h":"30vh",flex:"~ col","overflow-scroll":""},[c[0]||(c[0]=O("div",{"flex-1":""},null,-1)),(Q(!0),re(ai,null,si(V(r),(p,d)=>(Q(),re("div",{key:d,"mb-2":""},[p.role==="assistant"?(Q(),re("div",By,[O("div",Fy,[O("div",null,[O("span",zy,he(V(n)("stage.chat.message.character-name.airi")),1)]),p.content?(Q(),re("div",{key:0,class:"markdown-content",text:"base {n.value=!0},onVADMisfire:()=>{n.value=!1},onSpeechEnd:v=>{n.value=!1,x()},auto:!1});function x(v){alert("Transcription is not implemented yet")}return Fe(a,async v=>{v==="false"&&d()}),c(async()=>{e.value=""}),pn(()=>{y()}),(v,k)=>(Q(),re("div",null,[O("div",Ky,[ke(qy,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),O("div",Wy,[ke(V(fa),{modelValue:e.value,"onUpdate:modelValue":k[0]||(k[0]=M=>e.value=M),placeholder:V(f)("stage.message"),border:"solid 2 primary-100 dark:primary-400/20",text:"primary-300 hover:primary-500 dark:primary-300/50 dark:hover:primary-500 placeholder:primary-300 placeholder:hover:primary-500 placeholder:dark:primary-300/50 placeholder:dark:hover:primary-500",bg:"primary-100 dark:primary-400/20","max-h":"[10lh]","min-h":"[1lh]","w-full":"","resize-none":"","overflow-y-scroll":"","rounded-xl":"","p-2":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",class:st({"transition-colors-none placeholder:transition-colors-none":V(l)}),onSubmit:p},null,8,["modelValue","placeholder","class"])])])]))}}),Qy={class:"relative"},Zy={absolute:"","left-0":"","right-0":"","top-0":"","w-full":"","overflow-hidden":""},Jy=Be({__name:"AnimatedWave",props:{height:{default:40},amplitude:{default:14},waveLength:{default:250},fillColor:{default:"oklch(95% 0.10 var(--theme-colors-hue))"},direction:{default:"down"},movementDirection:{default:"left"},animationSpeed:{default:50}},setup(t){const e=t,n=W(e.height),r=W(e.amplitude),i=W(e.waveLength),o=W(e.fillColor),a=W(e.direction),s=W(e.movementDirection);function l(f,p,d,y,x){const v=[],M=Math.ceil(f/y)*y,A=1,C=x==="up"?d:p-d;v.push(`M 0 ${C}`);const P=Math.PI*2/y;for(let I=0;I<=M;I+=A){const b=d*Math.sin(P*I),g=x==="up"?C-b:C+b;v.push(`L ${I} ${g}`)}const h=x==="up"?p:0;return v.push(`L ${M} ${h}`),v.push(`L 0 ${h} Z`),v.join(" ")}const u=je(()=>n.value+r.value*2),c=je(()=>{const f=` - - `;return`url(data:image/svg+xml;base64,${btoa(f)})`});return Fe(()=>[e.height,e.amplitude,e.waveLength,e.fillColor,e.direction,e.movementDirection],()=>{n.value=e.height,r.value=e.amplitude,i.value=e.waveLength,o.value=e.fillColor,a.value=e.direction,s.value=e.movementDirection},{immediate:!0}),(f,p)=>(Q(),re("div",Qy,[gn(f.$slots,"default",{},void 0,!0),O("div",Zy,[O("div",{class:"wave",style:Lr({background:o.value,height:`${u.value}px`,maskImage:c.value,WebkitMaskImage:c.value,"--wave-translate":`${-i.value}px`,"--animation-duration":`${i.value/t.animationSpeed}s`,"animation-direction":s.value==="left"?"normal":"reverse"})},null,4)])]))}}),e0=Kn(Jy,[["__scopeId","data-v-d4cf94d8"]]),t0={relative:"",flex:"~ col","z-2":"","h-100dvh":"","w-100vw":"","of-hidden":""},n0={relative:"",flex:"~ 1 row gap-y-0 gap-x-2 (Q(),Xt(Bg,null,{default:Ue(()=>[ke(e0,{"fill-color":V(e)?"oklch(35% calc(var(--theme-colors-chroma) * 0.6) var(--theme-colors-hue))":"color-mix(in srgb, oklch(95% calc(var(--theme-colors-chroma-50) * 0.5) var(--theme-colors-hue)) 80%, oklch(100% 0 360))"},{default:Ue(()=>[O("div",t0,[O("div",null,[ke(Ug,{class:"flex",p2:""})]),O("div",n0,[ke(V(Lg),{"flex-1":"","min-w":"1/2",paused:n.value},null,8,["paused"]),ke(Dy,{class:"flex (s(),p("button",{disabled:t(f).loadingLive2dModel,bg:"neutral-100 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700",transition:"all ease-in-out duration-250",rounded:"",onClick:n[0]||(n[0]=v=>r.$emit("click"))},[P(r.$slots,"default")],8,me))}}),fe={flex:"~ col gap-4"},pe={flex:"","items-center":"","gap-2":""},ve=["disabled","placeholder"],be={"font-medium":""},_e={flex:"","gap-2":""},ge=["onUpdate:modelValue"],he=["href","download"],ye=E({__name:"Live2DSettings",props:{palette:null},emits:["extractColorsFromModel"],setup(L){const{t:f}=q(),r=H({accept:"application/zip"}),n=B(),{live2dModelFile:v,live2dMotionMap:b,live2dLoadSource:y,loadingLive2dModel:x,availableLive2dMotions:j,live2dModelUrl:M}=W(n),d=F(M.value);r.onChange(o=>{o&&o.length>0&&(b.value={},v.value=o[0],y.value="file",x.value=!0)}),G(()=>n.loadingLive2dModel,o=>{o||y.value==="file"&&j.value.forEach(e=>{e.motionName in z?b.value[e.fileName]=e.motionName:b.value[e.fileName]=ae})});async function _(o,e){if(!Object.keys(e).length)return o;const a=await new re().loadAsync(o),c=Object.keys(a.files).find($=>$.endsWith("model3.json"));if(!c)throw new Error("model3.json not found");const J=await a.file(c).async("string"),R=JSON.parse(J),C={};Object.entries(e).forEach(([$,O])=>{if(C[O]){C[O].push({File:$});return}C[O]=[{File:$}]}),R.FileReferences.Motions=C,a.file(c,JSON.stringify(R,null,2));const T=await a.generateAsync({type:"blob"});return new File([T],o.name,{type:o.type,lastModified:o.lastModified})}async function w(){const o=await se.getItem("live2dModel");if(!o)return;const e=await _(o,b.value);v.value=e,y.value="file",x.value=!0}const k=K(v);return(o,e)=>(s(),p("div",fe,[i(t(D),{title:"settings.live2d.change-model.title",icon:"i-solar:magic-stick-3-bold-duotone","inner-class":"text-sm"},{default:u(()=>[m("div",pe,[S(m("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>d.value=l),disabled:t(n).loadingLive2dModel,class:"form-control flex-1",border:"neutral-300 dark:neutral-800 solid 1 focus:neutral-400 dark:focus:neutral-600",transition:"border duration-250 ease-in-out",placeholder:t(f)("settings.live2d.change-model.from-url-placeholder")},null,8,ve),[[X,d.value]]),i(h,{class:"form-control",onClick:e[1]||(e[1]=l=>M.value=d.value)},{default:u(()=>[g(N(t(f)("settings.live2d.change-model.from-url")),1)]),_:1})]),i(h,{class:"form-control place-self-end",onClick:e[2]||(e[2]=l=>t(r).open())},{default:u(()=>[g(N(t(f)("settings.live2d.change-model.from-file"))+"... ",1)]),_:1}),i(h,{class:"form-control",onClick:e[3]||(e[3]=l=>o.$emit("extractColorsFromModel"))},{default:u(()=>e[4]||(e[4]=[g(" Extract colors from model ")])),_:1}),i(ce,{colors:L.palette.map(l=>({hex:l,name:l}))},null,8,["colors"])]),_:1}),t(n).live2dLoadSource==="file"?(s(),A(t(D),{key:0,title:"settings.live2d.edit-motion-map.title",icon:"i-solar:face-scan-circle-bold-duotone"},{default:u(()=>{var l;return[(s(!0),p(U,null,V(t(n).availableLive2dMotions,a=>(s(),p("div",{key:a.fileName,flex:"","items-center":"","justify-between":"","text-sm":""},[m("span",be,N(a.fileName),1),m("div",_e,[S(m("select",{"onUpdate:modelValue":c=>t(n).live2dMotionMap[a.fileName]=c},[(s(!0),p(U,null,V(Object.keys(t(z)),c=>(s(),p("option",{key:c},N(c),1))),128))],8,ge),[[Y,t(n).live2dMotionMap[a.fileName]]]),i(h,{class:"form-control",onClick:c=>t(n).live2dCurrentMotion={group:a.motionName,index:a.motionIndex}},{default:u(()=>e[5]||(e[5]=[g(" Play ")])),_:2},1032,["onClick"])])]))),128)),i(h,{onClick:w},{default:u(()=>e[6]||(e[6]=[g(" Save and patch ")])),_:1}),m("a",{"mt-2":"",block:"",href:t(k),download:`${((l=t(n).live2dModelFile)==null?void 0:l.name)||"live2d"}-motion-edited.zip`},[i(h,{"w-full":""},{default:u(()=>e[7]||(e[7]=[g("Export")])),_:1})],8,he)]}),_:1})):Q("",!0)]))}}),ke=ee(ye,[["__scopeId","data-v-b2e16668"]]),xe={flex:""},Me={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,y:15},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},we=E({__name:"index",setup(L){const f=F(),r=F(),{width:n,height:v}=te(f),b=F([]);async function y(){if(!r.value)return;const d=await r.value.captureFrame();if(!d){console.error("No frame captured");return}const _=URL.createObjectURL(d);try{const k=await new de(_).getPalette();b.value=Object.values(k).map(o=>o==null?void 0:o.hex).filter(o=>typeof o=="string")}finally{URL.revokeObjectURL(_)}}const{iconAnimationStarted:x,showIconAnimation:j,animationIcon:M}=ue("i-solar:people-nearby-bold-duotone");return(d,_)=>{const w=Z,k=oe("motion");return s(),p(U,null,[i(t(ne),{title:d.$t("settings.pages.models.title"),subtitle:d.$t("settings.title")},null,8,["title","subtitle"]),m("div",xe,[m("div",{ref_key:"live2dContainerRef",ref:f,w:"50%",h:"80vh"},[i(t(le),{ref_key:"live2dCanvasRef",ref:r,width:t(n),height:t(v)},{default:u(({app:o})=>[i(t(ie),{app:o,"mouth-open-size":0,width:t(n),height:t(v),paused:!1},null,8,["app","width","height"])]),_:1},8,["width","height"])],512),i(ke,{w:"50%",h:"80vh",palette:b.value,onExtractColorsFromModel:y},null,8,["palette"])]),t(j)?(s(),A(w,{key:0,"z-index":-1,icon:t(M),"icon-size":12,duration:1e3,started:t(x),"is-reverse":!0,position:"calc(100dvw - 9.5rem), calc(100dvh - 9.5rem)","text-color":"text-neutral-200/50 dark:text-neutral-600/20"},null,8,["icon","started"])):S((s(),p("div",Me,_[0]||(_[0]=[m("div",{text:"60","i-solar:people-nearby-bold-duotone":""},null,-1)]))),[[k]])],64)}}});typeof I=="function"&&I(we);export{we as default}; diff --git a/assets/index-DTTjaWFP.css b/assets/index-DTTjaWFP.css deleted file mode 100644 index 6d9320817d75932f4a85a96dccd40921965ffaad..0000000000000000000000000000000000000000 --- a/assets/index-DTTjaWFP.css +++ /dev/null @@ -1 +0,0 @@ -.menu-icon-item[data-v-656e0116]{position:relative;overflow:hidden}.menu-icon-item[data-v-656e0116]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;width:25%;height:100%;-webkit-mask-image:linear-gradient(120deg,white 30%,transparent 50%);mask-image:linear-gradient(120deg,white 30%,transparent 50%);opacity:0;transition:all .4s ease-in-out}.dark .menu-icon-item[data-v-656e0116]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.menu-icon-item[data-v-656e0116]:hover:before,.menu-icon-item._hover[data-v-656e0116]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .menu-icon-item[data-v-656e0116]:hover:before,.dark .menu-icon-item._hover[data-v-656e0116]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.menu-icon-item[data-v-656e0116]:after{background-image:radial-gradient(circle at 1px 1px,rgb(229 229 229 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.6;position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;width:100%;height:100%;background-size:10px 10px;content:"";-webkit-mask-image:linear-gradient(165deg,white 30%,transparent 50%);mask-image:linear-gradient(165deg,white 30%,transparent 50%);transition:all .4s ease-in-out}.menu-icon-item[data-v-656e0116]:after:hover{background-image:radial-gradient(circle at 1px 1px,oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.5}.dark .menu-icon-item[data-v-656e0116]:after{background-image:radial-gradient(circle at 1px 1px,rgb(64 64 64 / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.25}.dark .menu-icon-item[data-v-656e0116]:after:hover{background-image:radial-gradient(circle at 1px 1px,oklch(90% var(--theme-colors-chroma-200) calc(var(--theme-colors-hue) + 0) / var(--un-background-opacity)) 1px,transparent 0);--un-background-opacity:.2}.menu-icon-item-icon[data-v-656e0116]{opacity:.5}.menu-icon-item:hover .menu-icon-item-title[data-v-656e0116],.menu-icon-item._hover .menu-icon-item-title[data-v-656e0116]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.menu-icon-item:hover .menu-icon-item-description[data-v-656e0116],.menu-icon-item._hover .menu-icon-item-description[data-v-656e0116]{--un-text-opacity:1;color:oklch(54% var(--theme-colors-chroma-600) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));opacity:.8}.menu-icon-item:hover .menu-icon-item-icon[data-v-656e0116],.menu-icon-item._hover .menu-icon-item-icon[data-v-656e0116]{--un-text-opacity:1;color:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));scale:1.2}.dark .menu-icon-item:hover .menu-icon-item-title[data-v-656e0116],.dark .menu-icon-item._hover .menu-icon-item-title[data-v-656e0116]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))}.dark .menu-icon-item:hover .menu-icon-item-description[data-v-656e0116],.dark .menu-icon-item._hover .menu-icon-item-description[data-v-656e0116]{--un-text-opacity:1;color:oklch(85% var(--theme-colors-chroma-300) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity));opacity:.8}.dark .menu-icon-item:hover .menu-icon-item-icon[data-v-656e0116],.dark .menu-icon-item._hover .menu-icon-item-icon[data-v-656e0116]{--un-text-opacity:1;color:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / var(--un-text-opacity))} diff --git a/assets/index-DVEs4fbk.js b/assets/index-DVEs4fbk.js deleted file mode 100644 index 58c22a19a3a9613686ef3d1625dbd3efaaa20e10..0000000000000000000000000000000000000000 --- a/assets/index-DVEs4fbk.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as h}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as v,q as _,h as k,bw as x,c as t,o as i,b as I,a as d,x as l,A as m,u as s,bx as g,by as w}from"./index-20XXNHAB.js";import{I as z}from"./IconStatusItem-Cwiz6NP4.js";import{_ as A}from"./IconAnimation.vue_vue_type_script_setup_true_lang-BF7ZejO-.js";import{u as B}from"./useIconAnimation-HC6FusaE.js";import{b as u}from"./route-block-B_A1xBdJ.js";const $={grid:"~ cols-1 sm:cols-2 gap-4"},C={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,y:20},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},D=v({__name:"index",setup(L){const{t:e}=_(),p=k(()=>[{id:"consciousness",name:e("settings.pages.modules.consciousness.title"),description:e("settings.pages.modules.consciousness.description"),icon:"i-solar:ghost-bold-duotone",to:"/settings/modules/consciousness",configured:!1},{id:"speech",name:e("settings.pages.modules.speech.title"),description:e("settings.pages.modules.speech.description"),icon:"i-solar:user-speak-rounded-bold-duotone",to:"/settings/modules/speech",configured:!1},{id:"hearing",name:e("settings.pages.modules.hearing.title"),description:e("settings.pages.modules.hearing.description"),icon:"i-solar:microphone-3-bold-duotone",to:"",configured:!1},{id:"vision",name:e("settings.pages.modules.vision.title"),description:e("settings.pages.modules.vision.description"),icon:"i-solar:eye-closed-bold-duotone",to:"",configured:!1},{id:"memory-short-term",name:e("settings.pages.modules.memory-short-term.title"),description:e("settings.pages.modules.memory-short-term.description"),icon:"i-solar:bookmark-bold-duotone",to:"/settings/modules/memory-short-term",configured:!1},{id:"memory-long-term",name:e("settings.pages.modules.memory-long-term.title"),description:e("settings.pages.modules.memory-long-term.description"),icon:"i-solar:book-bookmark-bold-duotone",to:"/settings/modules/memory-long-term",configured:!1},{id:"messaging-discord",name:e("settings.pages.modules.messaging-discord.title"),description:e("settings.pages.modules.messaging-discord.description"),icon:"i-simple-icons:discord",to:"",configured:!1},{id:"x",name:e("settings.pages.modules.x.title"),description:e("settings.pages.modules.x.description"),icon:"i-simple-icons:x",to:"",configured:!1},{id:"game-minecraft",name:e("settings.pages.modules.gaming-minecraft.title"),description:e("settings.pages.modules.gaming-minecraft.description"),iconColor:"i-vscode-icons:file-type-minecraft",to:"",configured:!1},{id:"game-factorio",name:e("settings.pages.modules.gaming-factorio.title"),description:e("settings.pages.modules.gaming-factorio.description"),iconImage:"",to:"",configured:!1}]),{iconAnimationStarted:f,showIconAnimation:y,animationIcon:b}=B("i-solar:layers-bold-duotone");return(n,r)=>{const a=x("motion");return i(),t(g,null,[I(s(h),{title:n.$t("settings.pages.modules.title"),subtitle:n.$t("settings.title")},null,8,["title","subtitle"]),d("div",$,[(i(!0),t(g,null,w(p.value,(o,c)=>m((i(),l(s(z),{key:o.id,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+c*10,delay:c*50,title:o.name,description:o.description,icon:o.icon,"icon-color":o.iconColor,"icon-image":o.iconImage,to:o.to,configured:o.configured},null,8,["duration","delay","title","description","icon","icon-color","icon-image","to","configured"])),[[a]])),128))]),s(y)?(i(),l(A,{key:0,icon:s(b),"icon-size":12,duration:1e3,started:s(f),"is-reverse":!0,"z-index":-1,"text-color":"text-neutral-200/50 dark:text-neutral-600/20",position:"calc(100dvw - 9.5rem), calc(100dvh - 9.5rem)"},null,8,["icon","started"])):m((i(),t("div",C,r[0]||(r[0]=[d("div",{text:"60","i-solar:layers-bold-duotone":""},null,-1)]))),[[a]])],64)}}});typeof u=="function"&&u(D);export{D as default}; diff --git a/assets/index-DZCQ-9JG.css b/assets/index-DZCQ-9JG.css deleted file mode 100644 index 8f8209bee771bc4a62decf47efe5b7369ad97dfb..0000000000000000000000000000000000000000 --- a/assets/index-DZCQ-9JG.css +++ /dev/null @@ -1 +0,0 @@ -.animate-stripe[data-v-3380f248]{background-image:repeating-linear-gradient(-45deg,#f472b6,#f472b6 25px,#f9a8d4 25px,#f9a8d4 50px);animation:progress-3380f248 2s linear infinite;background-size:150% 100%}@-webkit-keyframes progress-3380f248{0%{background-position:0 0}to{background-position:-75px 0px}}@-moz-keyframes progress-3380f248{0%{background-position:0 0}to{background-position:-75px 0px}}@-ms-keyframes progress-3380f248{0%{background-position:0 0}to{background-position:-75px 0px}}@keyframes progress-3380f248{0%{background-position:0 0}to{background-position:-70px 0px}}.cross-background-container[data-v-0a776b22]{background-color:#fff;--cross-color: oklch(.85 calc(var(--theme-colors-chroma) * .3) var(--theme-colors-hue) / .2);background:radial-gradient(circle,transparent 20%,#ffffff 20%,#ffffff 80%,transparent 80%,transparent),radial-gradient(circle,transparent 20%,#ffffff 20%,#ffffff 80%,transparent 80%,transparent) 25px 25px,linear-gradient(var(--cross-color) 2px,transparent 2px) 0 -1px,linear-gradient(90deg,var(--cross-color) 2px,#ffffff 2px) -1px 0;background-size:50px 50px,50px 50px,25px 25px,25px 25px}.dark .cross-background-container[data-v-0a776b22]{background-color:#121212;--cross-color: oklch(.2 calc(var(--theme-colors-chroma) * .3) var(--theme-colors-hue));background:radial-gradient(circle,transparent 20%,#121212 20%,#121212 80%,transparent 80%,transparent),radial-gradient(circle,transparent 20%,#121212 20%,#121212 80%,transparent 80%,transparent) 25px 25px,linear-gradient(var(--cross-color) 2px,transparent 2px) 0 -1px,linear-gradient(90deg,var(--cross-color) 2px,#121212 2px) -1px 0;background-size:50px 50px,50px 50px,25px 25px,25px 25px}.animate-stripe[data-v-1f3e13c7]{background-image:repeating-linear-gradient(-45deg,#a16207,#a16207 25px,#eab308 25px,#eab308 50px);background-size:175% 100%}.animate-stripe[data-v-1f3e13c7]:hover{animation:progress-1f3e13c7 2s linear infinite}@-webkit-keyframes progress-1f3e13c7{0%{background-position:0 0}to{background-position:-75px 0px}}@-moz-keyframes progress-1f3e13c7{0%{background-position:0 0}to{background-position:-75px 0px}}@-ms-keyframes progress-1f3e13c7{0%{background-position:0 0}to{background-position:-75px 0px}}@keyframes progress-1f3e13c7{0%{background-position:0 0}to{background-position:-70px 0px}}@keyframes wave-animation-d4cf94d8{0%{transform:translate(0)}to{transform:translate(var(--wave-translate, -250px))}}.wave[data-v-d4cf94d8]{width:200vw;mask-repeat:repeat-x;-webkit-mask-repeat:repeat-x;will-change:transform;animation:wave-animation-d4cf94d8 var(--animation-duration, 5s) linear infinite} diff --git a/assets/index-DemghqgU.js b/assets/index-DemghqgU.js new file mode 100644 index 0000000000000000000000000000000000000000..3824cdbc3106e9ef50f67bbe8607e95618ac6773 --- /dev/null +++ b/assets/index-DemghqgU.js @@ -0,0 +1 @@ +import{_ as u}from"./IconAnimation.vue_vue_type_script_setup_true_lang-CRr1ZQyH.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as p}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{d as f,bw as _,c as n,o,b as v,a,x,A as b,u as e,bx as k}from"./index-D8Nm21zW.js";import{u as y}from"./useIconAnimation-D5irYuyi.js";import{b as r}from"./route-block-B_A1xBdJ.js";const g={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,y:20},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},h=f({__name:"index",setup(A){const{iconAnimationStarted:s,showIconAnimation:c,animationIcon:l}=y("i-solar:armchair-2-bold-duotone");return(i,t)=>{const m=u,d=_("motion");return o(),n(k,null,[v(e(p),{title:i.$t("settings.pages.scene.title"),subtitle:i.$t("settings.title")},null,8,["title","subtitle"]),t[1]||(t[1]=a("div",null," Scene ",-1)),e(c)?(o(),x(m,{key:0,"z-index":-1,icon:e(l),"icon-size":12,duration:1e3,started:e(s),"is-reverse":!0,position:"calc(100dvw - 9.5rem), calc(100dvh - 9.5rem)","text-color":"text-neutral-200/50 dark:text-neutral-600/20"},null,8,["icon","started"])):b((o(),n("div",g,t[0]||(t[0]=[a("div",{text:"60","i-solar:armchair-2-bold-duotone":""},null,-1)]))),[[d]])],64)}}});typeof r=="function"&&r(h);export{h as default}; diff --git a/assets/index-DgTAR4Sy.js b/assets/index-DgTAR4Sy.js new file mode 100644 index 0000000000000000000000000000000000000000..b0b43e6dfb9bd563613782ddb1f719c69a316ca6 --- /dev/null +++ b/assets/index-DgTAR4Sy.js @@ -0,0 +1 @@ +import{d as A,bI as _,bJ as F,c as r,o,A as a,a as e,b as m,B as V,bL as h,C as U,D as u,y as g,z as x,bB as H,v as M,bC as O,q as j,g as N,w as P,bw as z,u as i,x as f,ad as I,bH as L,bE as R,bx as D,by as q,bn as J}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as G}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{_ as C,a as K}from"./ColorPalette.vue_vue_type_script_setup_true_lang-Dh84R3gB.js";import{b as k}from"./route-block-B_A1xBdJ.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./index-BUaUWOtl.js";const Q={class:"w-full flex cursor-pointer items-center justify-between rounded-lg px-4 py-3 text-sm outline-none transition-all duration-250 ease-in-out",bg:"neutral-50 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700"},W=["aria-checked"],X={key:0,text:"sm neutral-500"},B=A({__name:"CheckBar",props:_({text:null,iconOn:null,iconOff:null,description:null},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(p){const n=F(p,"modelValue");return(y,c)=>(o(),r("label",Q,[a(e("input",{"onUpdate:modelValue":c[0]||(c[0]=v=>n.value=v),"aria-checked":n.value,type:"checkbox",hidden:""},null,8,W),[[V,n.value]]),e("div",null,[h(u(y.$t(p.text))+" ",1),p.description?(o(),r("div",X,u(y.$t(p.description)),1)):U("",!0)]),m(H,{name:"slide-away",mode:"out-in"},{default:g(()=>[n.value?(o(),r("div",{key:0,class:x(p.iconOn),transition:"all ease-in-out duration-250"},null,2)):(o(),r("div",{key:1,class:x(p.iconOff),transition:"all ease-in-out duration-250"},null,2))]),_:1})]))}}),Y=[[],["#A5978B","#D8CAAF","#B8B4A7","#C4BCB1","#E5DED8","#9A8F7D","#BEB5A7","#C9C0B6"],["#7A9EAF","#B8C7CC","#D4B79C","#8B9D77","#C7D5CB","#E6D0B1","#94A7B1","#B4C8C3"],["#D9B48F","#B5917A","#8C7A6B","#A17F5F","#B98C46","#C7A252","#DAB300","#D19826"],["#9BA7B0","#C1CBD4","#A5ADB6","#8B959E","#D4DCE4","#7F8A94","#B3BCC6","#98A4AE"],["#E4C6D0","#A61B29","#5D513C","#789262","#1C0D1A","#F7C242","#62A9DD","#8C4B3C"]],Z={class:"w-full flex items-center justify-between rounded-lg px-4 py-3 text-sm outline-none transition-all duration-250 ease-in-out",bg:"neutral-50 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+3*10,delay:3*50,transition:"all ease-in-out duration-250"},ee={value:"en-US"},te={value:"zh-CN"},ie={flex:"","items-center":"","justify-between":"",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+5*10,delay:5*50,transition:"all ease-in-out duration-250"},ne={"text-lg":"","font-semibold":""},ae={relative:"",flex:"","cursor-pointer":"","items-center":"","gap-2":""},oe=["disabled"],se={class:"color-bar",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+7*10,delay:7*50,transition:"all ease-in-out duration-250"},le={"text-white":"",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+8*10,delay:8*50,transition:"all ease-in-out duration-250"},re={class:"color-bar transparency-grid",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+9*10,delay:9*50,transition:"all ease-in-out duration-250"},de=["duration","delay"],ue={"font-medium":""},pe={text:"sm neutral-500"},ye={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[65dvh]","right--15":"","z--1":"",initial:{scale:.9,opacity:0,rotate:30},enter:{scale:1,opacity:1,rotate:0},duration:250,flex:"","items-center":"","justify-center":""},$=A({__name:"index",setup(p){const n=M(),y=O(),{t:c}=j(),v=N(!1);return P(()=>[n.usePageSpecificTransitions,n.disableTransitions],()=>{v.value=!0}),(d,t)=>{const s=z("motion");return o(),r(D,null,[m(i(G),{title:d.$t("settings.pages.themes.title"),subtitle:d.$t("settings.title")},null,8,["title","subtitle"]),a((o(),f(i(C),{title:i(c)("settings.sections.section.general.title"),icon:"i-solar:filters-bold-duotone",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+1*10,delay:1*50,transition:"all ease-in-out duration-250"},{default:g(()=>[a(m(B,{modelValue:i(y),"onUpdate:modelValue":t[0]||(t[0]=l=>I(y)?y.value=l:null),initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+2*10,delay:2*50,"icon-on":"i-solar:moon-stars-bold-duotone","icon-off":"i-solar:sun-fog-bold-duotone",text:"settings.theme",transition:"all ease-in-out duration-250"},null,8,["modelValue"]),[[s]]),a((o(),r("div",Z,[h(u(d.$t("settings.language.title"))+" ",1),a(e("select",{"onUpdate:modelValue":t[1]||(t[1]=l=>i(n).language=l),transition:"all ease-in-out duration-250","cursor-pointer":"","bg-transparent":"","text-right":"","outline-none":""},[e("option",ee,u(d.$t("settings.language.english")),1),e("option",te,u(d.$t("settings.language.chinese")),1)],512),[[L,i(n).language]])])),[[s]])]),_:1},8,["title"])),[[s]]),a((o(),f(i(C),{title:i(c)("settings.pages.themes.sections.section.custom-color.title"),icon:"i-solar:pallete-2-bold-duotone",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+4*10,delay:4*50,transition:"all ease-in-out duration-250"},{default:g(()=>[a((o(),r("div",ie,[e("span",ne,u(d.$t("settings.pages.themes.sections.section.custom-color.fields.field.primary-color.label")),1),e("label",ae,[a(e("input",{"onUpdate:modelValue":t[2]||(t[2]=l=>i(n).themeColorsHueDynamic=l),type:"checkbox",class:"peer sr-only"},null,512),[[V,i(n).themeColorsHueDynamic]]),t[6]||(t[6]=e("div",{class:"peer-checked:bg-primary-500 h-6 w-11 rounded-full bg-neutral-200 after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white dark:bg-neutral-600 after:transition-all after:content-[''] peer-checked:after:translate-x-full peer-checked:after:border-white"},null,-1)),h(" "+u(d.$t("settings.pages.themes.sections.section.custom-color.fields.field.primary-color.rgb-on.title")),1)])])),[[s]]),a(e("input",{"onUpdate:modelValue":t[3]||(t[3]=l=>i(n).themeColorsHue=l),initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+6*10,delay:6*50,transition:"all ease-in-out duration-250",type:"range",min:"0",max:"360",step:"0.01",class:x(["theme-hue-slider",i(n).themeColorsHueDynamic?"opacity-25 cursor-not-allowed":"cursor-pointer"]),disabled:i(n).themeColorsHueDynamic},null,10,oe),[[R,i(n).themeColorsHue],[s]]),a((o(),r("div",se,[t[8]||(t[8]=e("span",{"bg-primary-50":""},"50",-1)),t[9]||(t[9]=e("span",{"bg-primary-100":""},"100",-1)),t[10]||(t[10]=e("span",{"bg-primary-200":""},"200",-1)),t[11]||(t[11]=e("span",{"bg-primary-300":""},"300",-1)),t[12]||(t[12]=e("span",{"bg-primary-400":""},"400",-1)),t[13]||(t[13]=e("span",{"bg-primary-500":""},"500",-1)),a((o(),r("div",le,t[7]||(t[7]=[e("span",{"bg-primary-600":""},"600",-1),e("span",{"bg-primary-700":""},"700",-1),e("span",{"bg-primary-800":""},"800",-1),e("span",{"bg-primary-900":""},"900",-1),e("span",{"bg-primary-950":""},"950",-1)]))),[[s]])])),[[s]]),a((o(),r("div",re,t[14]||(t[14]=[e("span",{bg:"primary-500/5"},"500/5",-1),e("span",{bg:"primary-500/10"},"500/10",-1),e("span",{bg:"primary-500/20"},"500/20",-1),e("span",{bg:"primary-500/30"},"500/30",-1),e("span",{bg:"primary-500/40"},"500/40",-1),e("span",{bg:"primary-500/50"},"500/50",-1),e("span",{bg:"primary-500/60"},"500/60",-1),e("span",{bg:"primary-500/70"},"500/70",-1),e("span",{bg:"primary-500/80"},"500/80",-1),e("span",{bg:"primary-500/90"},"500/90",-1),e("span",{bg:"primary-500"},"500",-1)]))),[[s]])]),_:1},8,["title"])),[[s]]),a((o(),f(i(C),{title:"settings.pages.themes.sections.section.theme-presets.title",icon:"i-solar:magic-stick-2-bold-duotone",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+10*10,delay:10*50,transition:"all ease-in-out duration-250"},{default:g(()=>[(o(!0),r(D,null,q(d.$tm("settings.pages.themes.sections.section.theme-presets.presets"),({title:l,description:w,colors:E},b)=>a((o(),r("div",{key:b,class:"w-full flex items-center justify-between rounded-lg px-4 py-3 outline-none transition-all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800",hover:"bg-neutral-200 dark:bg-neutral-700",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+11*10+b*10,delay:11*50+b*50,transition:"all ease-in-out duration-250"},[e("div",null,[e("span",ue,u(d.$rt(l)),1),e("div",pe,u(d.$rt(w)),1)]),m(K,{colors:E.map((T,S)=>({hex:i(Y)[b][S],name:d.$rt(T)}))},null,8,["colors"])],8,de)),[[s]])),128))]),_:1})),[[s]]),a((o(),f(i(C),{title:"settings.pages.themes.sections.section.developer.title",icon:"i-solar:code-bold-duotone",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+18*10,delay:18*50,transition:"all ease-in-out duration-250"},{default:g(()=>[a(m(B,{modelValue:i(n).disableTransitions,"onUpdate:modelValue":t[4]||(t[4]=l=>i(n).disableTransitions=l),"icon-on":"i-solar:people-nearby-bold-duotone","icon-off":"i-solar:running-2-line-duotone",text:"settings.animations.stage-transitions.title",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+19*10,delay:19*50,transition:"all ease-in-out duration-250"},null,8,["modelValue"]),[[s]]),a(m(B,{modelValue:i(n).usePageSpecificTransitions,"onUpdate:modelValue":t[5]||(t[5]=l=>i(n).usePageSpecificTransitions=l),disabled:i(n).disableTransitions,"icon-on":"i-solar:running-2-line-duotone","icon-off":"i-solar:people-nearby-bold-duotone",text:"settings.animations.use-page-specific-transitions.title",description:"settings.animations.use-page-specific-transitions.description",initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+20*10,delay:20*50,transition:"all ease-in-out duration-250"},null,8,["modelValue","disabled"]),[[s]])]),_:1})),[[s]]),a((o(),r("div",ye,t[15]||(t[15]=[e("div",{text:"60","i-solar:filters-bold-duotone":""},null,-1)]))),[[s]])],64)}}});typeof k=="function"&&k($);const he=J($,[["__scopeId","data-v-4a014d7b"]]);export{he as default}; diff --git a/assets/index-DuLZCAM8.js b/assets/index-DuLZCAM8.js new file mode 100644 index 0000000000000000000000000000000000000000..e6f5ee1dce50b832e9604e08679eb3b3c043b58a --- /dev/null +++ b/assets/index-DuLZCAM8.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as h}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{d as v,q as _,h as k,bw as x,c as t,o as i,b as I,a as d,x as l,A as m,u as s,bx as g,by as w}from"./index-D8Nm21zW.js";import{I as z}from"./IconStatusItem-BzE_9TF3.js";import{_ as A}from"./IconAnimation.vue_vue_type_script_setup_true_lang-CRr1ZQyH.js";import{u as B}from"./useIconAnimation-D5irYuyi.js";import{b as u}from"./route-block-B_A1xBdJ.js";const $={grid:"~ cols-1 sm:cols-2 gap-4"},C={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,y:20},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},D=v({__name:"index",setup(L){const{t:e}=_(),p=k(()=>[{id:"consciousness",name:e("settings.pages.modules.consciousness.title"),description:e("settings.pages.modules.consciousness.description"),icon:"i-solar:ghost-bold-duotone",to:"/settings/modules/consciousness",configured:!1},{id:"speech",name:e("settings.pages.modules.speech.title"),description:e("settings.pages.modules.speech.description"),icon:"i-solar:user-speak-rounded-bold-duotone",to:"/settings/modules/speech",configured:!1},{id:"hearing",name:e("settings.pages.modules.hearing.title"),description:e("settings.pages.modules.hearing.description"),icon:"i-solar:microphone-3-bold-duotone",to:"",configured:!1},{id:"vision",name:e("settings.pages.modules.vision.title"),description:e("settings.pages.modules.vision.description"),icon:"i-solar:eye-closed-bold-duotone",to:"",configured:!1},{id:"memory-short-term",name:e("settings.pages.modules.memory-short-term.title"),description:e("settings.pages.modules.memory-short-term.description"),icon:"i-solar:bookmark-bold-duotone",to:"/settings/modules/memory-short-term",configured:!1},{id:"memory-long-term",name:e("settings.pages.modules.memory-long-term.title"),description:e("settings.pages.modules.memory-long-term.description"),icon:"i-solar:book-bookmark-bold-duotone",to:"/settings/modules/memory-long-term",configured:!1},{id:"messaging-discord",name:e("settings.pages.modules.messaging-discord.title"),description:e("settings.pages.modules.messaging-discord.description"),icon:"i-simple-icons:discord",to:"",configured:!1},{id:"x",name:e("settings.pages.modules.x.title"),description:e("settings.pages.modules.x.description"),icon:"i-simple-icons:x",to:"",configured:!1},{id:"game-minecraft",name:e("settings.pages.modules.gaming-minecraft.title"),description:e("settings.pages.modules.gaming-minecraft.description"),iconColor:"i-vscode-icons:file-type-minecraft",to:"",configured:!1},{id:"game-factorio",name:e("settings.pages.modules.gaming-factorio.title"),description:e("settings.pages.modules.gaming-factorio.description"),iconImage:"",to:"",configured:!1}]),{iconAnimationStarted:f,showIconAnimation:y,animationIcon:b}=B("i-solar:layers-bold-duotone");return(n,r)=>{const a=x("motion");return i(),t(g,null,[I(s(h),{title:n.$t("settings.pages.modules.title"),subtitle:n.$t("settings.title")},null,8,["title","subtitle"]),d("div",$,[(i(!0),t(g,null,w(p.value,(o,c)=>m((i(),l(s(z),{key:o.id,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+c*10,delay:c*50,title:o.name,description:o.description,icon:o.icon,"icon-color":o.iconColor,"icon-image":o.iconImage,to:o.to,configured:o.configured},null,8,["duration","delay","title","description","icon","icon-color","icon-image","to","configured"])),[[a]])),128))]),s(y)?(i(),l(A,{key:0,icon:s(b),"icon-size":12,duration:1e3,started:s(f),"is-reverse":!0,"z-index":-1,"text-color":"text-neutral-200/50 dark:text-neutral-600/20",position:"calc(100dvw - 9.5rem), calc(100dvh - 9.5rem)"},null,8,["icon","started"])):m((i(),t("div",C,r[0]||(r[0]=[d("div",{text:"60","i-solar:layers-bold-duotone":""},null,-1)]))),[[a]])],64)}}});typeof u=="function"&&u(D);export{D as default}; diff --git a/assets/index-B2mNUwLE.js b/assets/index-DxNnZI6o.js similarity index 99% rename from assets/index-B2mNUwLE.js rename to assets/index-DxNnZI6o.js index e9cc96bec5d7b0e36a16154ce21a6c8053505482..f607bb131bea72ac216e5821f2c892ef91942281 100644 --- a/assets/index-B2mNUwLE.js +++ b/assets/index-DxNnZI6o.js @@ -1,4 +1,4 @@ -import{cn as getAugmentedNamespace}from"./index-20XXNHAB.js";var dist={},ortWeb_min={exports:{}};const backends={},backendsSortedByPriority=[],registerBackend=(D,u,b)=>{if(u&&typeof u.init=="function"&&typeof u.createSessionHandler=="function"){const g=backends[D];if(g===void 0)backends[D]={backend:u,priority:b};else{if(g.priority>b)return;if(g.priority===b&&g.backend!==u)throw new Error(`cannot register backend "${D}" using priority ${b}`)}if(b>=0){const p=backendsSortedByPriority.indexOf(D);p!==-1&&backendsSortedByPriority.splice(p,1);for(let h=0;h{const u=D.length===0?backendsSortedByPriority:D,b=[];for(const g of u){const p=backends[g];if(p){if(p.initialized)return p.backend;if(p.aborted)continue;const h=!!p.initPromise;try{return h||(p.initPromise=p.backend.init()),await p.initPromise,p.initialized=!0,p.backend}catch(o){h||b.push({name:g,err:o}),p.aborted=!0}finally{delete p.initPromise}}}throw new Error(`no available backend found. ERR: ${b.map(g=>`[${g.name}] ${g.err}`).join(", ")}`)};class EnvImpl{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(u){if(u!==void 0){if(typeof u!="string"||["verbose","info","warning","error","fatal"].indexOf(u)===-1)throw new Error(`Unsupported logging level: ${u}`);this.logLevelInternal=u}}get logLevel(){return this.logLevelInternal}}const env=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=D=>{let u=1;for(let b=0;b{const t=document.createElement("canvas"),e=t.getContext("2d");if(!u||!e)return i();const n=new Image;n.crossOrigin="Anonymous",n.src=u,n.onload=()=>{t.width=n.width,t.height=n.height,e.drawImage(n,0,0,t.width,t.height);const r=e.getImageData(0,0,t.width,t.height);if(b!==void 0){if(b.height!==void 0&&b.height!==t.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(f.height=t.height,b.width!==void 0&&b.width!==t.width)throw new Error("Image input config width doesn't match ImageBitmap width");f.width=t.width}else f.height=t.height,f.width=t.width;s(at.bufferToTensor(r.data,f))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(c!==void 0)return at.bufferToTensor(c,f);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(u){var b,g;const p=document.createElement("canvas").getContext("2d");let h;if(p!=null){const o=this.dims[3],c=this.dims[2],f=this.dims[1],s=u!==void 0&&u.format!==void 0?u.format:"RGB",i=u!==void 0&&((b=u.norm)===null||b===void 0?void 0:b.mean)!==void 0?u.norm.mean:255,t=u!==void 0&&((g=u.norm)===null||g===void 0?void 0:g.bias)!==void 0?u.norm.bias:0,e=c*o;if(u!==void 0){if(u.height!==void 0&&u.height!==c)throw new Error("Image output config height doesn't match tensor height");if(u.width!==void 0&&u.width!==o)throw new Error("Image output config width doesn't match tensor width");if(u.format!==void 0&&f===4&&u.format!=="RGBA"||f===3&&u.format!=="RGB"&&u.format!=="BGR")throw new Error("Tensor format doesn't match input tensor dims")}const n=4;let r=0,a=1,l=2,d=3,m=0,y=e,v=e*2,_=-1;s==="RGBA"?(m=0,y=e,v=e*2,_=e*3):s==="RGB"?(m=0,y=e,v=e*2):s==="RBG"&&(m=0,v=e,y=e*2),h=p.createImageData(o,c);for(let T=0;T"u")throw new Error(`input '${s}' is missing in 'feeds'.`);if(o)for(const s of this.outputNames)p[s]=null;const c=await this.handler.run(u,p,h),f={};for(const s in c)Object.hasOwnProperty.call(c,s)&&(f[s]=new Tensor(c[s].type,c[s].data,c[s].dims));return f}static async create(u,b,g,p){let h,o={};if(typeof u=="string"){if(h=u,typeof b=="object"&&b!==null)o=b;else if(typeof b<"u")throw new TypeError("'options' must be an object.")}else if(u instanceof Uint8Array){if(h=u,typeof b=="object"&&b!==null)o=b;else if(typeof b<"u")throw new TypeError("'options' must be an object.")}else if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer){const t=u;let e=0,n=u.byteLength;if(typeof b=="object"&&b!==null)o=b;else if(typeof b=="number"){if(e=b,!Number.isSafeInteger(e))throw new RangeError("'byteOffset' must be an integer.");if(e<0||e>=t.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${t.byteLength}).`);if(n=u.byteLength-e,typeof g=="number"){if(n=g,!Number.isSafeInteger(n))throw new RangeError("'byteLength' must be an integer.");if(n<=0||e+n>t.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${t.byteLength-e}].`);if(typeof p=="object"&&p!==null)o=p;else if(typeof p<"u")throw new TypeError("'options' must be an object.")}else if(typeof g<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof b<"u")throw new TypeError("'options' must be an object.");h=new Uint8Array(t,e,n)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const f=(o.executionProviders||[]).map(t=>typeof t=="string"?t:t.name),i=await(await resolveBackend(f)).createSessionHandler(h,o);return new cn(i)}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=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession,Tensor,env,registerBackend},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(lib);/*! +import{cn as getAugmentedNamespace}from"./index-D8Nm21zW.js";var dist={},ortWeb_min={exports:{}};const backends={},backendsSortedByPriority=[],registerBackend=(D,u,b)=>{if(u&&typeof u.init=="function"&&typeof u.createSessionHandler=="function"){const g=backends[D];if(g===void 0)backends[D]={backend:u,priority:b};else{if(g.priority>b)return;if(g.priority===b&&g.backend!==u)throw new Error(`cannot register backend "${D}" using priority ${b}`)}if(b>=0){const p=backendsSortedByPriority.indexOf(D);p!==-1&&backendsSortedByPriority.splice(p,1);for(let h=0;h{const u=D.length===0?backendsSortedByPriority:D,b=[];for(const g of u){const p=backends[g];if(p){if(p.initialized)return p.backend;if(p.aborted)continue;const h=!!p.initPromise;try{return h||(p.initPromise=p.backend.init()),await p.initPromise,p.initialized=!0,p.backend}catch(o){h||b.push({name:g,err:o}),p.aborted=!0}finally{delete p.initPromise}}}throw new Error(`no available backend found. ERR: ${b.map(g=>`[${g.name}] ${g.err}`).join(", ")}`)};class EnvImpl{constructor(){this.wasm={},this.webgl={},this.logLevelInternal="warning"}set logLevel(u){if(u!==void 0){if(typeof u!="string"||["verbose","info","warning","error","fatal"].indexOf(u)===-1)throw new Error(`Unsupported logging level: ${u}`);this.logLevelInternal=u}}get logLevel(){return this.logLevelInternal}}const env=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=D=>{let u=1;for(let b=0;b{const t=document.createElement("canvas"),e=t.getContext("2d");if(!u||!e)return i();const n=new Image;n.crossOrigin="Anonymous",n.src=u,n.onload=()=>{t.width=n.width,t.height=n.height,e.drawImage(n,0,0,t.width,t.height);const r=e.getImageData(0,0,t.width,t.height);if(b!==void 0){if(b.height!==void 0&&b.height!==t.height)throw new Error("Image input config height doesn't match ImageBitmap height");if(f.height=t.height,b.width!==void 0&&b.width!==t.width)throw new Error("Image input config width doesn't match ImageBitmap width");f.width=t.width}else f.height=t.height,f.width=t.width;s(at.bufferToTensor(r.data,f))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(c!==void 0)return at.bufferToTensor(c,f);throw new Error("Input data provided is not supported - aborted tensor creation")}toImageData(u){var b,g;const p=document.createElement("canvas").getContext("2d");let h;if(p!=null){const o=this.dims[3],c=this.dims[2],f=this.dims[1],s=u!==void 0&&u.format!==void 0?u.format:"RGB",i=u!==void 0&&((b=u.norm)===null||b===void 0?void 0:b.mean)!==void 0?u.norm.mean:255,t=u!==void 0&&((g=u.norm)===null||g===void 0?void 0:g.bias)!==void 0?u.norm.bias:0,e=c*o;if(u!==void 0){if(u.height!==void 0&&u.height!==c)throw new Error("Image output config height doesn't match tensor height");if(u.width!==void 0&&u.width!==o)throw new Error("Image output config width doesn't match tensor width");if(u.format!==void 0&&f===4&&u.format!=="RGBA"||f===3&&u.format!=="RGB"&&u.format!=="BGR")throw new Error("Tensor format doesn't match input tensor dims")}const n=4;let r=0,a=1,l=2,d=3,m=0,y=e,v=e*2,_=-1;s==="RGBA"?(m=0,y=e,v=e*2,_=e*3):s==="RGB"?(m=0,y=e,v=e*2):s==="RBG"&&(m=0,v=e,y=e*2),h=p.createImageData(o,c);for(let T=0;T"u")throw new Error(`input '${s}' is missing in 'feeds'.`);if(o)for(const s of this.outputNames)p[s]=null;const c=await this.handler.run(u,p,h),f={};for(const s in c)Object.hasOwnProperty.call(c,s)&&(f[s]=new Tensor(c[s].type,c[s].data,c[s].dims));return f}static async create(u,b,g,p){let h,o={};if(typeof u=="string"){if(h=u,typeof b=="object"&&b!==null)o=b;else if(typeof b<"u")throw new TypeError("'options' must be an object.")}else if(u instanceof Uint8Array){if(h=u,typeof b=="object"&&b!==null)o=b;else if(typeof b<"u")throw new TypeError("'options' must be an object.")}else if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer){const t=u;let e=0,n=u.byteLength;if(typeof b=="object"&&b!==null)o=b;else if(typeof b=="number"){if(e=b,!Number.isSafeInteger(e))throw new RangeError("'byteOffset' must be an integer.");if(e<0||e>=t.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${t.byteLength}).`);if(n=u.byteLength-e,typeof g=="number"){if(n=g,!Number.isSafeInteger(n))throw new RangeError("'byteLength' must be an integer.");if(n<=0||e+n>t.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${t.byteLength-e}].`);if(typeof p=="object"&&p!==null)o=p;else if(typeof p<"u")throw new TypeError("'options' must be an object.")}else if(typeof g<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof b<"u")throw new TypeError("'options' must be an object.");h=new Uint8Array(t,e,n)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const f=(o.executionProviders||[]).map(t=>typeof t=="string"?t:t.name),i=await(await resolveBackend(f)).createSessionHandler(h,o);return new cn(i)}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=Object.freeze(Object.defineProperty({__proto__:null,InferenceSession,Tensor,env,registerBackend},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(lib);/*! * ONNX Runtime Web v1.14.0 * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. diff --git a/assets/index-OKTEyjT1.js b/assets/index-OKTEyjT1.js deleted file mode 100644 index 0316d6dc9d5059f2e5c8a17855d6ada6642b38fb..0000000000000000000000000000000000000000 --- a/assets/index-OKTEyjT1.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as x}from"./IconAnimation.vue_vue_type_script_setup_true_lang-BF7ZejO-.js";import{_ as v}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as k,s as I,bw as h,c as i,o,b as z,a as c,x as l,A as m,u as e,bx as d,by as A}from"./index-20XXNHAB.js";import{u as $}from"./providers-BqZLRXH1.js";import{I as w}from"./IconStatusItem-Cwiz6NP4.js";import{u as B}from"./useIconAnimation-HC6FusaE.js";import{b as u}from"./route-block-B_A1xBdJ.js";import"./index-Be1NqeGb.js";const S={grid:"~ cols-2 gap-4"},D={key:1,text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,y:20},enter:{scale:1,opacity:1,y:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},N=k({__name:"index",setup(C){const p=$(),{allProvidersMetadata:f}=I(p),{iconAnimationStarted:_,showIconAnimation:y,animationIcon:g}=B("i-solar:box-minimalistic-bold-duotone");return(n,a)=>{const b=x,s=h("motion");return o(),i(d,null,[z(e(v),{title:n.$t("settings.pages.providers.title"),subtitle:n.$t("settings.title")},null,8,["title","subtitle"]),c("div",S,[(o(!0),i(d,null,A(e(f),(t,r)=>m((o(),l(e(w),{key:t.id,initial:{opacity:0,y:10},enter:{opacity:1,y:0},duration:250+r*10,delay:r*50,title:t.localizedName,description:t.localizedDescription,icon:t.icon,"icon-color":t.iconColor,"icon-image":t.iconImage,to:`/settings/providers/${t.id}`,configured:t.configured},null,8,["duration","delay","title","description","icon","icon-color","icon-image","to","configured"])),[[s]])),128))]),e(y)?(o(),l(b,{key:0,"z-index":-1,icon:e(g),"icon-size":12,duration:1e3,started:e(_),"is-reverse":!0,position:"calc(100dvw - 9.5rem), calc(100dvh - 9.5rem)","text-color":"text-neutral-200/50 dark:text-neutral-600/20"},null,8,["icon","started"])):m((o(),i("div",D,a[0]||(a[0]=[c("div",{text:"60","i-solar:box-minimalistic-bold-duotone":""},null,-1)]))),[[s]])],64)}}});typeof u=="function"&&u(N);export{N as default}; diff --git a/assets/index-oJqItACZ.js b/assets/index-oJqItACZ.js deleted file mode 100644 index b727123b03d0a58486e7f36e7f73c51e02fd9479..0000000000000000000000000000000000000000 --- a/assets/index-oJqItACZ.js +++ /dev/null @@ -1 +0,0 @@ -import{d as T,q as J,s as H,g as c,w as Q,h,bw as R,c as m,o as d,b as y,a as s,A as w,u as r,bE as G,D as l,bH as K,z as P,C as V,y as W,bx as U,by as X,x as Y}from"./index-20XXNHAB.js";import{_ as Z}from"./InputFile.vue_vue_type_script_setup_true_lang-61TbqfJt.js";import{_ as ee}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as te}from"./airi-card-DmHEm3BO.js";import{_ as se}from"./CardDetailDialog.vue_vue_type_script_setup_true_lang-w9SFWGFR.js";import{_ as ae}from"./CardListItem.vue_vue_type_script_setup_true_lang-LNBk-ntG.js";import{_ as re}from"./DeleteCardDialog.vue_vue_type_script_setup_true_lang-CPUl-rMo.js";import{b as j}from"./route-block-B_A1xBdJ.js";import"./consciousness-D04GkOp_.js";import"./providers-BqZLRXH1.js";import"./index-Be1NqeGb.js";import"./speech-CF8Au8j4.js";import"./index-qOh3wAiY.js";const oe={"rounded-xl":"","p-4":"",flex:"~ col gap-4"},ne={flex:"~ row","flex-wrap":"","items-center":"","justify-between":"","gap-4":""},le={class:"relative min-w-[200px] flex-1","inline-flex":"~","w-full":"","items-center":""},ie=["placeholder"],de={class:"flex items-center gap-2"},ue={"text-sm":"","text-neutral-500":"","dark:text-neutral-400":""},ce={value:"nameAsc"},me={value:"nameDesc"},pe={value:"recent"},fe={key:0,flex:"","flex-col":"","items-center":""},ve={"font-medium":"",text:"neutral-600 dark:neutral-300"},xe={text:"neutral-500 dark:neutral-400","mt-2":"","text-sm":""},ge={key:1,flex:"","flex-col":"","items-center":""},_e={"font-medium":"",text:"primary-600 dark:primary-300"},be={key:1,class:"col-span-full rounded-xl p-8 text-center",border:"~ neutral-200/50 dark:neutral-700/30",bg:"neutral-50/50 dark:neutral-900/50"},ye={key:2,class:"col-span-full flex items-center gap-3 border-2 border-amber-200 rounded-xl bg-amber-50/80 p-4 dark:border-amber-800 dark:bg-amber-900/30"},ke={class:"flex flex-col"},Ce={class:"font-medium"},he={class:"text-sm text-amber-600 dark:text-amber-400"},we={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},Ve=T({__name:"index",setup(De){const{t:n}=J(),k=te(),{addCard:q,removeCard:B}=k,{cards:p,activeCardId:D}=H(k),_=c(""),f=c(!1),v=c(""),x=c("nameAsc"),C=c([]);Q(C,async a=>{const e=a[0];if(e)try{const o=await e.text(),i=JSON.parse(o);_.value=q(i),f.value=!0}catch(o){console.error("Error processing card file:",o)}});const $=h(()=>Array.from(p.value.entries()).map(([a,e])=>({id:a,name:e.name,description:e.description}))),E=h(()=>{if(!v.value)return $.value;const a=v.value.toLowerCase();return $.value.filter(e=>e.name.toLowerCase().includes(a)||e.description&&e.description.toLowerCase().includes(a))}),S=h(()=>{const a=[...E.value];return x.value==="nameAsc"?a.sort((e,o)=>e.name.localeCompare(o.name)):x.value==="nameDesc"?a.sort((e,o)=>o.name.localeCompare(e.name)):x.value==="recent"?a.sort((e,o)=>o.id.localeCompare(e.id)):a}),b=c(!1),u=c(null);function L(){u.value&&(B(u.value),u.value=null,b.value=!1)}function O(a){u.value=a,b.value=!0}function F(a){_.value=a,f.value=!0}function I(a){D.value=a}function M(a){const e=p.value.get(a);return(e==null?void 0:e.version)||"1.0.0"}function A(a,e){var t,g,z,N;const o=p.value.get(a);if(!o||!((g=(t=o.extensions)==null?void 0:t.airi)!=null&&g.modules))return"default";const i=o.extensions.airi.modules;return e==="consciousness"?(z=i.consciousness)!=null&&z.model&&i.consciousness.model.split("-").pop()||"default":e==="voice"&&((N=i.speech)==null?void 0:N.voice_id)||"default"}return(a,e)=>{var i;const o=R("motion");return d(),m(U,null,[y(r(ee),{title:a.$t("settings.pages.card.title"),subtitle:a.$t("settings.title")},null,8,["title","subtitle"]),s("div",oe,[s("div",ne,[s("div",le,[e[6]||(e[6]=s("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[s("div",{"i-solar:magnifer-line-duotone":"",class:"text-neutral-500 dark:text-neutral-400"})],-1)),w(s("input",{"onUpdate:modelValue":e[0]||(e[0]=t=>v.value=t),type:"search",class:"w-full rounded-xl p-2.5 pl-10 text-sm outline-none",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",bg:"white dark:neutral-900",placeholder:r(n)("settings.pages.card.search")},null,8,ie),[[G,v.value]])]),s("div",de,[s("div",ue,l(r(n)("settings.pages.card.sort_by"))+": ",1),w(s("select",{"onUpdate:modelValue":e[1]||(e[1]=t=>x.value=t),class:"rounded-lg p-1.5 text-sm outline-none",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",bg:"white dark:neutral-900"},[s("option",ce,l(r(n)("settings.pages.card.name_asc")),1),s("option",me,l(r(n)("settings.pages.card.name_desc")),1),s("option",pe,l(r(n)("settings.pages.card.recent")),1)],512),[[K,x.value]])])]),s("div",{class:P(["mt-4",{"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4 grid-auto-rows-[minmax(min-content,max-content)] grid-auto-flow-dense sm:grid-cols-[repeat(auto-fill,minmax(240px,1fr))] sm:gap-5 md:grid-cols-[repeat(auto-fill,minmax(220px,1fr))] lg:grid-cols-[repeat(auto-fill,minmax(250px,1fr))]":r(p).size>0}])},[y(r(Z),{modelValue:C.value,"onUpdate:modelValue":e[2]||(e[2]=t=>C.value=t),accept:"*.json"},{default:W(({isDragging:t})=>[t?(d(),m("div",ge,[e[8]||(e[8]=s("div",{"i-solar:upload-minimalistic-bold":"",class:"text-primary-500 dark:text-primary-400 mb-2 text-5xl"},null,-1)),s("p",_e,l(r(n)("settings.pages.card.drop_here")),1)])):(d(),m("div",fe,[e[7]||(e[7]=s("div",{"i-solar:upload-square-line-duotone":"","mb-4":"","text-5xl":"",text:"neutral-400 dark:neutral-500"},null,-1)),s("p",ve,l(r(n)("settings.pages.card.upload")),1),s("p",xe,l(r(n)("settings.pages.card.upload_desc")),1)]))]),_:1},8,["modelValue"]),r(p).size>0?(d(!0),m(U,{key:0},X(S.value,t=>(d(),Y(ae,{id:t.id,key:t.id,name:t.name,description:t.description,"is-active":t.id===r(D),"is-selected":t.id===_.value&&f.value,version:M(t.id),"consciousness-model":A(t.id,"consciousness"),"voice-model":A(t.id,"voice"),onSelect:g=>F(t.id),onActivate:g=>I(t.id),onDelete:g=>O(t.id)},null,8,["id","name","description","is-active","is-selected","version","consciousness-model","voice-model","onSelect","onActivate","onDelete"]))),128)):V("",!0),r(p).size===0?(d(),m("div",be,[e[9]||(e[9]=s("div",{"i-solar:card-search-broken":"","mx-auto":"","mb-3":"","text-6xl":"","text-neutral-400":""},null,-1)),s("p",null,l(r(n)("settings.pages.card.no_cards")),1)])):V("",!0),v.value&&S.value.length===0?(d(),m("div",ye,[e[10]||(e[10]=s("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),s("div",ke,[s("span",Ce,l(r(n)("settings.pages.card.no_results")),1),s("span",he,l(r(n)("settings.pages.card.try_different_search")),1)])])):V("",!0)],2)]),y(re,{modelValue:b.value,"onUpdate:modelValue":e[3]||(e[3]=t=>b.value=t),"card-name":u.value?(i=r(k).getCard(u.value))==null?void 0:i.name:"",onConfirm:L,onCancel:e[4]||(e[4]=t=>u.value=null)},null,8,["modelValue","card-name"]),y(se,{modelValue:f.value,"onUpdate:modelValue":e[5]||(e[5]=t=>f.value=t),"card-id":_.value},null,8,["modelValue","card-id"]),w((d(),m("div",we,e[11]||(e[11]=[s("div",{text:"60","i-solar:emoji-funny-square-bold-duotone":""},null,-1)]))),[[o]])],64)}}});typeof j=="function"&&j(Ve);export{Ve as default}; diff --git a/assets/memory-long-term-BOqgJ6Qz.js b/assets/memory-long-term-BOqgJ6Qz.js deleted file mode 100644 index 5c18ec9d4babe073bb93f33cfbf376f2a975322d..0000000000000000000000000000000000000000 --- a/assets/memory-long-term-BOqgJ6Qz.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as o,x as s,o as r,u as m}from"./index-20XXNHAB.js";const u=o({__name:"memory-long-term",setup(n){return(t,i)=>(r(),s(m(e),{title:t.$t("settings.pages.modules.memory-long-term.title"),subtitle:t.$t("settings.title")},null,8,["title","subtitle"]))}});export{u as default}; diff --git a/assets/memory-long-term-BkSIgiZH.js b/assets/memory-long-term-BkSIgiZH.js new file mode 100644 index 0000000000000000000000000000000000000000..caef5457f52f1f891f761815a1cb894576bd2e8e --- /dev/null +++ b/assets/memory-long-term-BkSIgiZH.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as e}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{d as o,x as s,o as r,u as m}from"./index-D8Nm21zW.js";const u=o({__name:"memory-long-term",setup(n){return(t,i)=>(r(),s(m(e),{title:t.$t("settings.pages.modules.memory-long-term.title"),subtitle:t.$t("settings.title")},null,8,["title","subtitle"]))}});export{u as default}; diff --git a/assets/memory-short-term-Dq-l2fpr.js b/assets/memory-short-term-Dq-l2fpr.js new file mode 100644 index 0000000000000000000000000000000000000000..e6380ed28ff341be32ded82f55185749f5770c20 --- /dev/null +++ b/assets/memory-short-term-Dq-l2fpr.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as e}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{d as s,x as o,o as r,u as m}from"./index-D8Nm21zW.js";const u=s({__name:"memory-short-term",setup(i){return(t,n)=>(r(),o(m(e),{title:t.$t("settings.pages.modules.memory-short-term.title"),subtitle:t.$t("settings.title")},null,8,["title","subtitle"]))}});export{u as default}; diff --git a/assets/memory-short-term-q5isghRH.js b/assets/memory-short-term-q5isghRH.js deleted file mode 100644 index f4cbda51f5afae352723f3faf33e3df4e37a7931..0000000000000000000000000000000000000000 --- a/assets/memory-short-term-q5isghRH.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as e}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as s,x as o,o as r,u as m}from"./index-20XXNHAB.js";const u=s({__name:"memory-short-term",setup(i){return(t,n)=>(r(),o(m(e),{title:t.$t("settings.pages.modules.memory-short-term.title"),subtitle:t.$t("settings.title")},null,8,["title","subtitle"]))}});export{u as default}; diff --git a/assets/messages-Dpefqazf.js b/assets/messages-Dpefqazf.js new file mode 100644 index 0000000000000000000000000000000000000000..cfec2feb97ce1499449907c8fb6ce5ae73e39680 --- /dev/null +++ b/assets/messages-Dpefqazf.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as c}from"./Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js";import{d as g,g as o,c as l,o as u,a as e,b as _,u as v,D as p,bx as b,by as x}from"./index-D8Nm21zW.js";import{u as k}from"./queue-CEzllKo3.js";import{u as h,l as w}from"./queues-DJEZsGUG.js";import"./Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js";const y={flex:"","flex-col":"","gap-2":"","p-2":""},S={flex:"","flex-row":"","gap-2":""},V={"rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-4":""},M={"w-full":"",flex:"","flex-row":"","gap-4":""},Q={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},P=g({__name:"messages",setup(B){const s=o(""),r=o([]),t=o(!1),f=k({handlers:[async i=>{r.value.push(i.data)}]}),d=h(f);async function m(){t.value=!0,d.add(s.value),d.add(w),s.value="",t.value=!1}return(i,a)=>(u(),l("div",y,[e("div",S,[_(v(c),{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=n=>s.value=n),placeholder:"Message",p:"2",bg:"neutral-100 dark:neutral-700","w-full":"","rounded-lg":"","outline-none":"",onSubmit:m},null,8,["modelValue"]),e("button",V,p(t.value?"Processing...":"Send"),1)]),e("div",M,[e("div",Q,[a[1]||(a[1]=e("h3",{"font-semibold":""}," TTS Message ",-1)),(u(!0),l(b,null,x(r.value,n=>(u(),l("div",{key:n},[e("div",null,p(n),1)]))),128))])])]))}});export{P as default}; diff --git a/assets/messages-NgOPVBsy.js b/assets/messages-NgOPVBsy.js deleted file mode 100644 index ac5c729dc24633081d72e30ed6b766f971ce1b89..0000000000000000000000000000000000000000 --- a/assets/messages-NgOPVBsy.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as c}from"./Textarea.vue_vue_type_script_setup_true_lang-BPvpJbgL.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as g,g as o,c as l,o as u,a as e,b as _,u as v,D as p,bx as b,by as x}from"./index-20XXNHAB.js";import{u as k}from"./queue-DpWku5ab.js";import{u as h,l as w}from"./queues-DD-Guues.js";import"./Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js";const y={flex:"","flex-col":"","gap-2":"","p-2":""},S={flex:"","flex-row":"","gap-2":""},V={"rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-4":""},M={"w-full":"",flex:"","flex-row":"","gap-4":""},Q={"w-full":"","rounded-lg":"",bg:"neutral-100 dark:neutral-700","p-2":""},P=g({__name:"messages",setup(B){const s=o(""),r=o([]),t=o(!1),f=k({handlers:[async i=>{r.value.push(i.data)}]}),d=h(f);async function m(){t.value=!0,d.add(s.value),d.add(w),s.value="",t.value=!1}return(i,a)=>(u(),l("div",y,[e("div",S,[_(v(c),{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=n=>s.value=n),placeholder:"Message",p:"2",bg:"neutral-100 dark:neutral-700","w-full":"","rounded-lg":"","outline-none":"",onSubmit:m},null,8,["modelValue"]),e("button",V,p(t.value?"Processing...":"Send"),1)]),e("div",M,[e("div",Q,[a[1]||(a[1]=e("h3",{"font-semibold":""}," TTS Message ",-1)),(u(!0),l(b,null,x(r.value,n=>(u(),l("div",{key:n},[e("div",null,p(n),1)]))),128))])])]))}});export{P as default}; diff --git a/assets/microsoft-speech-DFQHhcmr.js b/assets/microsoft-speech-DFQHhcmr.js deleted file mode 100644 index 76a3af8a09916b9f7b170f6f72d790ff0afa4e4d..0000000000000000000000000000000000000000 --- a/assets/microsoft-speech-DFQHhcmr.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as P}from"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as $,q,s as B,g as v,h as f,r as K,x as M,o as T,y as g,b as h,u as n}from"./index-20XXNHAB.js";import{u as z}from"./providers-BqZLRXH1.js";import{u as E}from"./speech-CF8Au8j4.js";import{_ as F,a as G}from"./SpeechProviderSettings.vue_vue_type_script_setup_true_lang-B6yYYFHK.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./index-Be1NqeGb.js";import"./TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js";import"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const t="microsoft-speech",x="v1",oe=$({__name:"microsoft-speech",setup(H){const{t:S}=q(),C={pitch:0,speed:1,volume:0},p=E(),d=z(),{providers:r}=B(d),c=v(0),_=v(1),b=v(0),u=f({get:()=>{var o;return((o=r.value[t])==null?void 0:o.region)||"eastasia"},set:o=>{r.value[t]||(r.value[t]={}),r.value[t].region=o}}),U=f(()=>{var o;return!!((o=r.value[t])!=null&&o.apiKey)}),y=f(()=>p.availableVoices[t]||[]);async function k(o,e,l){const i=d.getProviderInstance(t);if(!i)throw new Error("Failed to initialize speech provider");const a=d.getProviderConfig(t),s=a.model||x,V={...a,region:u.value,disableSsml:!l};if(!l&&e){const w=y.value.find(m=>m.id===e);if(w){const m=p.generateSSML(o,w,{...a,pitch:c.value});return await p.speech(i,s,m,e,V)}}return await p.speech(i,s,o,e,V)}return(o,e)=>{const l=K("SpeechVoiceSettings");return T(),M(n(G),{"provider-id":t,"default-model":x,"additional-settings":C},{"basic-settings":g(()=>[h(n(P),{modelValue:u.value,"onUpdate:modelValue":e[0]||(e[0]=i=>u.value=i),label:n(S)("settings.pages.providers.provider.microsoft-speech.fields.field.region.label"),description:n(S)("settings.pages.providers.provider.microsoft-speech.fields.field.region.description"),placeholder:"eastasia",required:"",type:"text"},null,8,["modelValue","label","description"])]),"voice-settings":g(({voiceSettings:i,updateVoiceSettings:a})=>[h(l,{pitch:c.value,"onUpdate:pitch":e[1]||(e[1]=s=>c.value=s),speed:_.value,"onUpdate:speed":e[2]||(e[2]=s=>_.value=s),volume:b.value,"onUpdate:volume":e[3]||(e[3]=s=>b.value=s),settings:i,"show-pitch":!0,"show-speed":!0,"show-volume":!0,onUpdate:a},null,8,["pitch","speed","volume","settings","onUpdate"])]),playground:g(()=>[h(n(F),{"available-voices":y.value,"generate-speech":k,"api-key-configured":U.value,"default-text":"Hello! This is a test of the Microsoft Speech synthesis."},null,8,["available-voices","api-key-configured"])]),_:1})}}});export{oe as default}; diff --git a/assets/microsoft-speech-DxiRqm6y.js b/assets/microsoft-speech-DxiRqm6y.js new file mode 100644 index 0000000000000000000000000000000000000000..eb63a29271b48a048ee771ae027527ac17380c52 --- /dev/null +++ b/assets/microsoft-speech-DxiRqm6y.js @@ -0,0 +1 @@ +import{_ as P}from"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as $,q,s as B,g as v,h as f,r as K,x as M,o as T,y as g,b as h,u as n}from"./index-D8Nm21zW.js";import{u as z}from"./providers-DUDq6kdm.js";import{u as E}from"./speech-B27BwGQ-.js";import{_ as F,a as G}from"./SpeechProviderSettings.vue_vue_type_script_setup_true_lang-Cscdqs1L.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./index-Be1NqeGb.js";import"./TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js";import"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const t="microsoft-speech",x="v1",oe=$({__name:"microsoft-speech",setup(H){const{t:S}=q(),C={pitch:0,speed:1,volume:0},p=E(),d=z(),{providers:r}=B(d),c=v(0),_=v(1),b=v(0),u=f({get:()=>{var o;return((o=r.value[t])==null?void 0:o.region)||"eastasia"},set:o=>{r.value[t]||(r.value[t]={}),r.value[t].region=o}}),U=f(()=>{var o;return!!((o=r.value[t])!=null&&o.apiKey)}),y=f(()=>p.availableVoices[t]||[]);async function k(o,e,l){const i=d.getProviderInstance(t);if(!i)throw new Error("Failed to initialize speech provider");const a=d.getProviderConfig(t),s=a.model||x,V={...a,region:u.value,disableSsml:!l};if(!l&&e){const w=y.value.find(m=>m.id===e);if(w){const m=p.generateSSML(o,w,{...a,pitch:c.value});return await p.speech(i,s,m,e,V)}}return await p.speech(i,s,o,e,V)}return(o,e)=>{const l=K("SpeechVoiceSettings");return T(),M(n(G),{"provider-id":t,"default-model":x,"additional-settings":C},{"basic-settings":g(()=>[h(n(P),{modelValue:u.value,"onUpdate:modelValue":e[0]||(e[0]=i=>u.value=i),label:n(S)("settings.pages.providers.provider.microsoft-speech.fields.field.region.label"),description:n(S)("settings.pages.providers.provider.microsoft-speech.fields.field.region.description"),placeholder:"eastasia",required:"",type:"text"},null,8,["modelValue","label","description"])]),"voice-settings":g(({voiceSettings:i,updateVoiceSettings:a})=>[h(l,{pitch:c.value,"onUpdate:pitch":e[1]||(e[1]=s=>c.value=s),speed:_.value,"onUpdate:speed":e[2]||(e[2]=s=>_.value=s),volume:b.value,"onUpdate:volume":e[3]||(e[3]=s=>b.value=s),settings:i,"show-pitch":!0,"show-speed":!0,"show-volume":!0,onUpdate:a},null,8,["pitch","speed","volume","settings","onUpdate"])]),playground:g(()=>[h(n(F),{"available-voices":y.value,"generate-speech":k,"api-key-configured":U.value,"default-text":"Hello! This is a test of the Microsoft Speech synthesis."},null,8,["available-voices","api-key-configured"])]),_:1})}}});export{oe as default}; diff --git a/assets/mistral-ai-CzsP5HyY.js b/assets/mistral-ai-CzsP5HyY.js new file mode 100644 index 0000000000000000000000000000000000000000..6a6e3cbb8ed181db08ed68b2ef72cf0fcbc5c795 --- /dev/null +++ b/assets/mistral-ai-CzsP5HyY.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as U,q as V,bG as y,s as $,h as v,l as k,w as K,x as h,o as x,y as m,b as l,u as t}from"./index-D8Nm21zW.js";import{u as w}from"./providers-DUDq6kdm.js";import{_ as z,a as C}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as M}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as N,a as P}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as R}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="mistral-ai",L=U({__name:"mistral-ai",setup(S){const{t:p}=V(),_=y(),d=w(),{providers:o}=$(d),n=v(()=>d.getProviderMetadata(a)),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});k(()=>{var e,i;d.initializeProvider(a),r.value=((e=o.value[a])==null?void 0:e.apiKey)||"",s.value=((i=o.value[a])==null?void 0:i.baseUrl)||""}),K([r,s],()=>{o.value[a]={...o.value[a],apiKey:r.value,baseUrl:s.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,i)=>{var c,f;return x(),h(t(R),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon-color":(f=n.value)==null?void 0:f.iconColor,"on-back":()=>t(_).back()},{default:m(()=>[l(t(N),null,{default:m(()=>[l(t(P),{title:t(p)("settings.pages.providers.common.section.basic.title"),description:t(p)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:m(()=>{var u;return[l(t(M),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=g=>r.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"mis-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(p)("settings.pages.providers.common.section.advanced.title")},{default:m(()=>[l(t(C),{modelValue:s.value,"onUpdate:modelValue":i[1]||(i[1]=u=>s.value=u),placeholder:"https://api.mistral.ai/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{L as default}; diff --git a/assets/mistral-ai-DGNcLeMF.js b/assets/mistral-ai-DGNcLeMF.js deleted file mode 100644 index 228f54869d587e08311bd016513f5b3da07545a9..0000000000000000000000000000000000000000 --- a/assets/mistral-ai-DGNcLeMF.js +++ /dev/null @@ -1 +0,0 @@ -import{d as U,q as V,bG as y,s as $,h as v,l as k,w as K,x as h,o as x,y as m,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as w}from"./providers-BqZLRXH1.js";import{_ as z,a as C}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as M}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as N,a as P}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as R}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="mistral-ai",L=U({__name:"mistral-ai",setup(S){const{t:p}=V(),_=y(),d=w(),{providers:o}=$(d),n=v(()=>d.getProviderMetadata(a)),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});k(()=>{var e,i;d.initializeProvider(a),r.value=((e=o.value[a])==null?void 0:e.apiKey)||"",s.value=((i=o.value[a])==null?void 0:i.baseUrl)||""}),K([r,s],()=>{o.value[a]={...o.value[a],apiKey:r.value,baseUrl:s.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,i)=>{var c,f;return x(),h(t(R),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon-color":(f=n.value)==null?void 0:f.iconColor,"on-back":()=>t(_).back()},{default:m(()=>[l(t(N),null,{default:m(()=>[l(t(P),{title:t(p)("settings.pages.providers.common.section.basic.title"),description:t(p)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:m(()=>{var u;return[l(t(M),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=g=>r.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"mis-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(p)("settings.pages.providers.common.section.advanced.title")},{default:m(()=>[l(t(C),{modelValue:s.value,"onUpdate:modelValue":i[1]||(i[1]=u=>s.value=u),placeholder:"https://api.mistral.ai/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{L as default}; diff --git a/assets/moonshot-ai-B-gxAO4v.js b/assets/moonshot-ai-B-gxAO4v.js new file mode 100644 index 0000000000000000000000000000000000000000..dda6643f36a3bfc29b008865fbe0f55d0c5aa3c0 --- /dev/null +++ b/assets/moonshot-ai-B-gxAO4v.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as h,q as U,bG as V,s as y,h as v,l as $,w as k,x as K,o as x,y as m,b as l,u as t}from"./index-D8Nm21zW.js";import{u as w}from"./providers-DUDq6kdm.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="moonshot-ai",L=h({__name:"moonshot-ai",setup(B){const{t:p}=U(),_=V(),d=w(),{providers:o}=y(d),n=v(()=>d.getProviderMetadata(a)),i=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,s;d.initializeProvider(a),i.value=((e=o.value[a])==null?void 0:e.apiKey)||"",r.value=((s=o.value[a])==null?void 0:s.baseUrl)||""}),k([i,r],()=>{o.value[a]={...o.value[a],apiKey:i.value,baseUrl:r.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,s)=>{var c,f;return x(),K(t(S),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon":(f=n.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:m(()=>[l(t(P),null,{default:m(()=>[l(t(R),{title:t(p)("settings.pages.providers.common.section.basic.title"),description:t(p)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:m(()=>{var u;return[l(t(N),{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=g=>i.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"ms-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(p)("settings.pages.providers.common.section.advanced.title")},{default:m(()=>[l(t(M),{modelValue:r.value,"onUpdate:modelValue":s[1]||(s[1]=u=>r.value=u),placeholder:"https://api.moonshot.cn/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/moonshot-ai-DzUBx36t.js b/assets/moonshot-ai-DzUBx36t.js deleted file mode 100644 index a2f5d21552a2e3d2b0a18d5ef823212e22dbf612..0000000000000000000000000000000000000000 --- a/assets/moonshot-ai-DzUBx36t.js +++ /dev/null @@ -1 +0,0 @@ -import{d as h,q as U,bG as V,s as y,h as v,l as $,w as k,x as K,o as x,y as m,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as w}from"./providers-BqZLRXH1.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="moonshot-ai",L=h({__name:"moonshot-ai",setup(B){const{t:p}=U(),_=V(),d=w(),{providers:o}=y(d),n=v(()=>d.getProviderMetadata(a)),i=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,s;d.initializeProvider(a),i.value=((e=o.value[a])==null?void 0:e.apiKey)||"",r.value=((s=o.value[a])==null?void 0:s.baseUrl)||""}),k([i,r],()=>{o.value[a]={...o.value[a],apiKey:i.value,baseUrl:r.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,s)=>{var c,f;return x(),K(t(S),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon":(f=n.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:m(()=>[l(t(P),null,{default:m(()=>[l(t(R),{title:t(p)("settings.pages.providers.common.section.basic.title"),description:t(p)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:m(()=>{var u;return[l(t(N),{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=g=>i.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"ms-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(p)("settings.pages.providers.common.section.advanced.title")},{default:m(()=>[l(t(M),{modelValue:r.value,"onUpdate:modelValue":s[1]||(s[1]=u=>r.value=u),placeholder:"https://api.moonshot.cn/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/novita-ai-DCHaCXXA.js b/assets/novita-ai-DCHaCXXA.js new file mode 100644 index 0000000000000000000000000000000000000000..e72c5ece202a98f2fc499383cbc3c1d93869d2fe --- /dev/null +++ b/assets/novita-ai-DCHaCXXA.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as U,q as V,bG as y,s as $,h as v,l as k,w as K,x as h,o as x,y as p,b as l,u as t}from"./index-D8Nm21zW.js";import{u as w}from"./providers-DUDq6kdm.js";import{_ as z,a as C}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as M}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as N,a as P}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as R}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="novita-ai",L=U({__name:"novita-ai",setup(S){const{t:d}=V(),_=y(),m=w(),{providers:o}=$(m),n=v(()=>m.getProviderMetadata(a)),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});k(()=>{var e,i;m.initializeProvider(a),r.value=((e=o.value[a])==null?void 0:e.apiKey)||"",s.value=((i=o.value[a])==null?void 0:i.baseUrl)||""}),K([r,s],()=>{o.value[a]={...o.value[a],apiKey:r.value,baseUrl:s.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,i)=>{var c,f;return x(),h(t(R),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon-color":(f=n.value)==null?void 0:f.iconColor,"on-back":()=>t(_).back()},{default:p(()=>[l(t(N),null,{default:p(()=>[l(t(P),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:p(()=>{var u;return[l(t(M),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=g=>r.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"nvt-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(C),{modelValue:s.value,"onUpdate:modelValue":i[1]||(i[1]=u=>s.value=u),placeholder:"https://api.novita.ai/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{L as default}; diff --git a/assets/novita-ai-hOThb-je.js b/assets/novita-ai-hOThb-je.js deleted file mode 100644 index 0011a591309a2ca1e61bef049795a51c5c080bfd..0000000000000000000000000000000000000000 --- a/assets/novita-ai-hOThb-je.js +++ /dev/null @@ -1 +0,0 @@ -import{d as U,q as V,bG as y,s as $,h as v,l as k,w as K,x as h,o as x,y as p,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as w}from"./providers-BqZLRXH1.js";import{_ as z,a as C}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as M}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as N,a as P}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as R}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="novita-ai",L=U({__name:"novita-ai",setup(S){const{t:d}=V(),_=y(),m=w(),{providers:o}=$(m),n=v(()=>m.getProviderMetadata(a)),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});k(()=>{var e,i;m.initializeProvider(a),r.value=((e=o.value[a])==null?void 0:e.apiKey)||"",s.value=((i=o.value[a])==null?void 0:i.baseUrl)||""}),K([r,s],()=>{o.value[a]={...o.value[a],apiKey:r.value,baseUrl:s.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,i)=>{var c,f;return x(),h(t(R),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon-color":(f=n.value)==null?void 0:f.iconColor,"on-back":()=>t(_).back()},{default:p(()=>[l(t(N),null,{default:p(()=>[l(t(P),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:p(()=>{var u;return[l(t(M),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=g=>r.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"nvt-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(C),{modelValue:s.value,"onUpdate:modelValue":i[1]||(i[1]=u=>s.value=u),placeholder:"https://api.novita.ai/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{L as default}; diff --git a/assets/ollama-ClQGfAy6.js b/assets/ollama-ClQGfAy6.js deleted file mode 100644 index d01ae51cc26f0928d7f1a448b9b0c59760ce19f8..0000000000000000000000000000000000000000 --- a/assets/ollama-ClQGfAy6.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as P}from"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import{d as w,bI as x,bJ as U,c as g,o as f,b as m,g as $,w as C,bw as N,a as _,A as D,bL as I,C as O,D as M,bx as R,by as S,q as z,bG as A,s as F,h as q,l as L,c9 as T,x as E,y as b,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as G}from"./providers-BqZLRXH1.js";import{a as J,_ as j}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as H,a as Q}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as W}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const X={flex:"~ gap-2"},Y=w({__name:"InputKeyValue",props:x({name:null,keyPlaceholder:null,valuePlaceholder:null},{propertyKey:{required:!0},propertyKeyModifiers:{},propertyValue:{required:!0},propertyValueModifiers:{}}),emits:["update:propertyKey","update:propertyValue"],setup(v){const o=v,s=U(v,"propertyKey"),u=U(v,"propertyValue");return(r,a)=>(f(),g("div",X,[m(P,{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=n=>s.value=n),placeholder:o.keyPlaceholder,class:"w-1/2"},null,8,["modelValue","placeholder"]),m(P,{modelValue:u.value,"onUpdate:modelValue":a[1]||(a[1]=n=>u.value=n),placeholder:o.valuePlaceholder,class:"w-1/2"},null,8,["modelValue","placeholder"])]))}}),Z={"max-w-full":""},ee={flex:"~ col gap-2"},le={class:"flex items-center gap-1 text-sm font-medium"},ae={key:0,class:"text-red-500"},te={class:"text-xs text-neutral-500 dark:text-neutral-400","text-nowrap":""},oe={flex:"~ col gap-2"},re=["onClick"],se=w({__name:"FieldKeyValues",props:x({label:null,description:null,name:null,keyPlaceholder:null,valuePlaceholder:null,required:{type:Boolean},inputClass:null},{modelValue:{required:!0},modelModifiers:{}}),emits:x(["remove","add"],["update:modelValue"]),setup(v,{emit:o}){const s=v,u=o,r=U(v,"modelValue"),a=$(""),n=$("");return C([a,n],()=>{u("add",a.value,n.value)}),(K,p)=>{const k=N("auto-animate");return f(),g("div",Z,[_("label",ee,[_("div",null,[_("div",le,[I(M(s.label)+" ",1),s.required!==!1?(f(),g("span",ae,"*")):O("",!0)]),_("div",te,M(s.description),1)]),D((f(),g("div",oe,[(f(!0),g(R,null,S(r.value,(y,l)=>(f(),g("div",{key:l,"w-full":"",flex:"","items-center":"","gap-2":""},[m(Y,{"property-key":y.key,"onUpdate:propertyKey":e=>y.key=e,"property-value":y.value,"onUpdate:propertyValue":e=>y.value=e,"key-placeholder":s.keyPlaceholder,"value-placeholder":s.valuePlaceholder,"w-full":""},null,8,["property-key","onUpdate:propertyKey","property-value","onUpdate:propertyValue","key-placeholder","value-placeholder"]),_("button",{onClick:e=>u("remove",l)},p[0]||(p[0]=[_("div",{"i-solar:minus-circle-line-duotone":"",size:"6"},null,-1)]),8,re)]))),128))])),[[k]])])])}}}),d="ollama",he=w({__name:"ollama",setup(v){const{t:o}=z(),s=A(),u=G(),{providers:r}=F(u),a=q(()=>u.getProviderMetadata(d)),n=q({get:()=>{var l,e,i;return((l=r.value[d])==null?void 0:l.baseUrl)||((i=(e=a.value)==null?void 0:e.defaultOptions)==null?void 0:i.baseUrl)||""},set:l=>{r.value[d]||(r.value[d]={}),r.value[d].baseUrl=l}});L(()=>{var l,e,i,h;u.initializeProvider(d),n.value=((l=r.value[d])==null?void 0:l.baseUrl)||((i=(e=a.value)==null?void 0:e.defaultOptions)==null?void 0:i.baseUrl)||"",(h=r.value[d])!=null&&h.headers||(r.value[d].headers={})});function K(){var l;r.value[d]={...(l=a.value)==null?void 0:l.defaultOptions}}const p=T([{key:"",value:""}]);function k(l,e,i){l&&l.push({key:e,value:i})}function y(l,e){e&&(e.length===1?(e[0].key="",e[0].value=""):e.splice(l,1))}return C(p,l=>{l.length>0&&(l[l.length-1].key!==""||l[l.length-1].value!=="")&&l.push({key:"",value:""})},{deep:!0,immediate:!0}),(l,e)=>{var i,h;return f(),E(t(W),{"provider-name":(i=a.value)==null?void 0:i.localizedName,"provider-icon":(h=a.value)==null?void 0:h.icon,"on-back":()=>t(s).back()},{default:b(()=>[m(t(H),null,{default:b(()=>[m(t(Q),{title:t(o)("settings.pages.providers.common.section.basic.title"),description:t(o)("settings.pages.providers.common.section.basic.description"),"on-reset":K},{default:b(()=>{var c,V;return[m(t(J),{modelValue:n.value,"onUpdate:modelValue":e[0]||(e[0]=B=>n.value=B),placeholder:((V=(c=a.value)==null?void 0:c.defaultOptions)==null?void 0:V.baseUrl)||"",required:""},null,8,["modelValue","placeholder"])]}),_:1},8,["title","description"]),m(t(j),{title:t(o)("settings.pages.providers.common.section.advanced.title")},{default:b(()=>[m(t(se),{modelValue:p,"onUpdate:modelValue":e[1]||(e[1]=c=>p=c),label:t(o)("settings.pages.providers.common.section.advanced.fields.field.headers.label"),description:t(o)("settings.pages.providers.common.section.advanced.fields.field.headers.description"),"key-placeholder":t(o)("settings.pages.providers.common.section.advanced.fields.field.headers.key.placeholder"),"value-placeholder":t(o)("settings.pages.providers.common.section.advanced.fields.field.headers.value.placeholder"),onAdd:e[2]||(e[2]=(c,V)=>k(p,c,V)),onRemove:e[3]||(e[3]=c=>y(c,p))},null,8,["modelValue","label","description","key-placeholder","value-placeholder"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{he as default}; diff --git a/assets/ollama-DVhvZ81j.js b/assets/ollama-DVhvZ81j.js new file mode 100644 index 0000000000000000000000000000000000000000..5243c7b67b17b55fa022ff98eb276934b015a9dd --- /dev/null +++ b/assets/ollama-DVhvZ81j.js @@ -0,0 +1 @@ +import{_ as P}from"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import{d as w,bI as x,bJ as U,c as g,o as f,b as m,g as $,w as C,bw as N,a as _,A as D,bL as I,C as O,D as M,bx as R,by as S,q as z,bG as A,s as F,h as q,l as L,c9 as T,x as E,y as b,u as t}from"./index-D8Nm21zW.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{u as G}from"./providers-DUDq6kdm.js";import{a as J,_ as j}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as H,a as Q}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as W}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const X={flex:"~ gap-2"},Y=w({__name:"InputKeyValue",props:x({name:null,keyPlaceholder:null,valuePlaceholder:null},{propertyKey:{required:!0},propertyKeyModifiers:{},propertyValue:{required:!0},propertyValueModifiers:{}}),emits:["update:propertyKey","update:propertyValue"],setup(v){const o=v,s=U(v,"propertyKey"),u=U(v,"propertyValue");return(r,a)=>(f(),g("div",X,[m(P,{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=n=>s.value=n),placeholder:o.keyPlaceholder,class:"w-1/2"},null,8,["modelValue","placeholder"]),m(P,{modelValue:u.value,"onUpdate:modelValue":a[1]||(a[1]=n=>u.value=n),placeholder:o.valuePlaceholder,class:"w-1/2"},null,8,["modelValue","placeholder"])]))}}),Z={"max-w-full":""},ee={flex:"~ col gap-2"},le={class:"flex items-center gap-1 text-sm font-medium"},ae={key:0,class:"text-red-500"},te={class:"text-xs text-neutral-500 dark:text-neutral-400","text-nowrap":""},oe={flex:"~ col gap-2"},re=["onClick"],se=w({__name:"FieldKeyValues",props:x({label:null,description:null,name:null,keyPlaceholder:null,valuePlaceholder:null,required:{type:Boolean},inputClass:null},{modelValue:{required:!0},modelModifiers:{}}),emits:x(["remove","add"],["update:modelValue"]),setup(v,{emit:o}){const s=v,u=o,r=U(v,"modelValue"),a=$(""),n=$("");return C([a,n],()=>{u("add",a.value,n.value)}),(K,p)=>{const k=N("auto-animate");return f(),g("div",Z,[_("label",ee,[_("div",null,[_("div",le,[I(M(s.label)+" ",1),s.required!==!1?(f(),g("span",ae,"*")):O("",!0)]),_("div",te,M(s.description),1)]),D((f(),g("div",oe,[(f(!0),g(R,null,S(r.value,(y,l)=>(f(),g("div",{key:l,"w-full":"",flex:"","items-center":"","gap-2":""},[m(Y,{"property-key":y.key,"onUpdate:propertyKey":e=>y.key=e,"property-value":y.value,"onUpdate:propertyValue":e=>y.value=e,"key-placeholder":s.keyPlaceholder,"value-placeholder":s.valuePlaceholder,"w-full":""},null,8,["property-key","onUpdate:propertyKey","property-value","onUpdate:propertyValue","key-placeholder","value-placeholder"]),_("button",{onClick:e=>u("remove",l)},p[0]||(p[0]=[_("div",{"i-solar:minus-circle-line-duotone":"",size:"6"},null,-1)]),8,re)]))),128))])),[[k]])])])}}}),d="ollama",he=w({__name:"ollama",setup(v){const{t:o}=z(),s=A(),u=G(),{providers:r}=F(u),a=q(()=>u.getProviderMetadata(d)),n=q({get:()=>{var l,e,i;return((l=r.value[d])==null?void 0:l.baseUrl)||((i=(e=a.value)==null?void 0:e.defaultOptions)==null?void 0:i.baseUrl)||""},set:l=>{r.value[d]||(r.value[d]={}),r.value[d].baseUrl=l}});L(()=>{var l,e,i,h;u.initializeProvider(d),n.value=((l=r.value[d])==null?void 0:l.baseUrl)||((i=(e=a.value)==null?void 0:e.defaultOptions)==null?void 0:i.baseUrl)||"",(h=r.value[d])!=null&&h.headers||(r.value[d].headers={})});function K(){var l;r.value[d]={...(l=a.value)==null?void 0:l.defaultOptions}}const p=T([{key:"",value:""}]);function k(l,e,i){l&&l.push({key:e,value:i})}function y(l,e){e&&(e.length===1?(e[0].key="",e[0].value=""):e.splice(l,1))}return C(p,l=>{l.length>0&&(l[l.length-1].key!==""||l[l.length-1].value!=="")&&l.push({key:"",value:""})},{deep:!0,immediate:!0}),(l,e)=>{var i,h;return f(),E(t(W),{"provider-name":(i=a.value)==null?void 0:i.localizedName,"provider-icon":(h=a.value)==null?void 0:h.icon,"on-back":()=>t(s).back()},{default:b(()=>[m(t(H),null,{default:b(()=>[m(t(Q),{title:t(o)("settings.pages.providers.common.section.basic.title"),description:t(o)("settings.pages.providers.common.section.basic.description"),"on-reset":K},{default:b(()=>{var c,V;return[m(t(J),{modelValue:n.value,"onUpdate:modelValue":e[0]||(e[0]=B=>n.value=B),placeholder:((V=(c=a.value)==null?void 0:c.defaultOptions)==null?void 0:V.baseUrl)||"",required:""},null,8,["modelValue","placeholder"])]}),_:1},8,["title","description"]),m(t(j),{title:t(o)("settings.pages.providers.common.section.advanced.title")},{default:b(()=>[m(t(se),{modelValue:p,"onUpdate:modelValue":e[1]||(e[1]=c=>p=c),label:t(o)("settings.pages.providers.common.section.advanced.fields.field.headers.label"),description:t(o)("settings.pages.providers.common.section.advanced.fields.field.headers.description"),"key-placeholder":t(o)("settings.pages.providers.common.section.advanced.fields.field.headers.key.placeholder"),"value-placeholder":t(o)("settings.pages.providers.common.section.advanced.fields.field.headers.value.placeholder"),onAdd:e[2]||(e[2]=(c,V)=>k(p,c,V)),onRemove:e[3]||(e[3]=c=>y(c,p))},null,8,["modelValue","label","description","key-placeholder","value-placeholder"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{he as default}; diff --git a/assets/openai-DUyoq3rX.js b/assets/openai-DUyoq3rX.js deleted file mode 100644 index 982c52cc8d27b497a7e775d1bcc76d600e2ace83..0000000000000000000000000000000000000000 --- a/assets/openai-DUyoq3rX.js +++ /dev/null @@ -1 +0,0 @@ -import{d as h,q as U,bG as V,s as k,h as v,l as y,w as $,x as K,o as x,y as n,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as I}from"./providers-BqZLRXH1.js";import{_ as w,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as R,a as S}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as z}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const e="openai",L=h({__name:"openai",setup(A){const{t:u}=U(),_=V(),c=I(),{providers:a}=k(c),m=v(()=>c.getProviderMetadata(e)),s=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.apiKey)||""},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].apiKey=o}}),r=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.baseUrl)||"https://api.openai.com/v1/"},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].baseUrl=o}});y(()=>{var o,i;a.value[e]||(a.value[e]={baseUrl:"https://api.openai.com/v1/"}),s.value=((o=a.value[e])==null?void 0:o.apiKey)||"",r.value=((i=a.value[e])==null?void 0:i.baseUrl)||"https://api.openai.com/v1/"}),$([s,r],()=>{a.value[e]={...a.value[e],apiKey:s.value,baseUrl:r.value||"https://api.openai.com/v1/"}});function b(){a.value[e]={baseUrl:"https://api.openai.com/v1/"}}return(o,i)=>{var d,f;return x(),K(t(z),{"provider-name":((d=m.value)==null?void 0:d.localizedName)||"OpenAI","provider-icon":(f=m.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:n(()=>[l(t(R),null,{default:n(()=>[l(t(S),{title:t(u)("settings.pages.providers.common.section.basic.title"),description:t(u)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:n(()=>{var p;return[l(t(N),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=g=>s.value=g),"provider-name":((p=m.value)==null?void 0:p.localizedName)||"OpenAI",placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(w),{title:t(u)("settings.pages.providers.common.section.advanced.title")},{default:n(()=>[l(t(M),{modelValue:r.value,"onUpdate:modelValue":i[1]||(i[1]=p=>r.value=p),placeholder:"https://api.openai.com/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/openai-DeU27RZU.js b/assets/openai-DeU27RZU.js new file mode 100644 index 0000000000000000000000000000000000000000..30561c9f6c0314d54cc9521d32afa8ac9669dd42 --- /dev/null +++ b/assets/openai-DeU27RZU.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as h,q as U,bG as V,s as k,h as v,l as y,w as $,x as K,o as x,y as n,b as l,u as t}from"./index-D8Nm21zW.js";import{u as I}from"./providers-DUDq6kdm.js";import{_ as w,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as R,a as S}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as z}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const e="openai",L=h({__name:"openai",setup(A){const{t:u}=U(),_=V(),c=I(),{providers:a}=k(c),m=v(()=>c.getProviderMetadata(e)),s=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.apiKey)||""},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].apiKey=o}}),r=v({get:()=>{var o;return((o=a.value[e])==null?void 0:o.baseUrl)||"https://api.openai.com/v1/"},set:o=>{a.value[e]||(a.value[e]={}),a.value[e].baseUrl=o}});y(()=>{var o,i;a.value[e]||(a.value[e]={baseUrl:"https://api.openai.com/v1/"}),s.value=((o=a.value[e])==null?void 0:o.apiKey)||"",r.value=((i=a.value[e])==null?void 0:i.baseUrl)||"https://api.openai.com/v1/"}),$([s,r],()=>{a.value[e]={...a.value[e],apiKey:s.value,baseUrl:r.value||"https://api.openai.com/v1/"}});function b(){a.value[e]={baseUrl:"https://api.openai.com/v1/"}}return(o,i)=>{var d,f;return x(),K(t(z),{"provider-name":((d=m.value)==null?void 0:d.localizedName)||"OpenAI","provider-icon":(f=m.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:n(()=>[l(t(R),null,{default:n(()=>[l(t(S),{title:t(u)("settings.pages.providers.common.section.basic.title"),description:t(u)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:n(()=>{var p;return[l(t(N),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=g=>s.value=g),"provider-name":((p=m.value)==null?void 0:p.localizedName)||"OpenAI",placeholder:"sk-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(w),{title:t(u)("settings.pages.providers.common.section.advanced.title")},{default:n(()=>[l(t(M),{modelValue:r.value,"onUpdate:modelValue":i[1]||(i[1]=p=>r.value=p),placeholder:"https://api.openai.com/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/openrouter-ai-B7uv-1BM.js b/assets/openrouter-ai-B7uv-1BM.js deleted file mode 100644 index a867f4afbf20d8e4cd06e84d167b68b44b54d6cf..0000000000000000000000000000000000000000 --- a/assets/openrouter-ai-B7uv-1BM.js +++ /dev/null @@ -1 +0,0 @@ -import{d as V,q as k,bG as y,s as $,h as _,l as K,w as O,x as h,o as x,y as v,b as d,u as l}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as w}from"./providers-BqZLRXH1.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="openrouter-ai",Q=V({__name:"openrouter-ai",setup(B){const{t:c}=k(),b=y(),f=w(),{providers:o}=$(f),r=_(()=>f.getProviderMetadata(a)),i=_({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),n=_({get:()=>{var e,t,s;return((e=o.value[a])==null?void 0:e.baseUrl)||((s=(t=r.value)==null?void 0:t.defaultOptions)==null?void 0:s.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});K(()=>{var e,t,s,u;f.initializeProvider(a),i.value=((e=o.value[a])==null?void 0:e.apiKey)||"",n.value=((t=o.value[a])==null?void 0:t.baseUrl)||((u=(s=r.value)==null?void 0:s.defaultOptions)==null?void 0:u.baseUrl)||""}),O([i,n],()=>{var e,t;o.value[a]={...o.value[a],apiKey:i.value,baseUrl:n.value||((t=(e=r.value)==null?void 0:e.defaultOptions)==null?void 0:t.baseUrl)||""}});function U(){var e;o.value[a]={...(e=r.value)==null?void 0:e.defaultOptions}}return(e,t)=>{var s,u;return x(),h(l(S),{"provider-name":(s=r.value)==null?void 0:s.localizedName,"provider-icon":(u=r.value)==null?void 0:u.icon,"on-back":()=>l(b).back()},{default:v(()=>[d(l(P),null,{default:v(()=>[d(l(R),{title:l(c)("settings.pages.providers.common.section.basic.title"),description:l(c)("settings.pages.providers.common.section.basic.description"),"on-reset":U},{default:v(()=>{var p;return[d(l(N),{modelValue:i.value,"onUpdate:modelValue":t[0]||(t[0]=m=>i.value=m),"provider-name":(p=r.value)==null?void 0:p.localizedName,placeholder:"sk-or-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),d(l(z),{title:l(c)("settings.pages.providers.common.section.advanced.title")},{default:v(()=>{var p,m;return[d(l(M),{modelValue:n.value,"onUpdate:modelValue":t[1]||(t[1]=g=>n.value=g),placeholder:((m=(p=r.value)==null?void 0:p.defaultOptions)==null?void 0:m.baseUrl)||""},null,8,["modelValue","placeholder"])]}),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{Q as default}; diff --git a/assets/openrouter-ai-BENIJVm4.js b/assets/openrouter-ai-BENIJVm4.js new file mode 100644 index 0000000000000000000000000000000000000000..7aaa4db27024846d17c1e1790bae28e4c406f8b7 --- /dev/null +++ b/assets/openrouter-ai-BENIJVm4.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as V,q as k,bG as y,s as $,h as _,l as K,w as O,x as h,o as x,y as v,b as d,u as l}from"./index-D8Nm21zW.js";import{u as w}from"./providers-DUDq6kdm.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="openrouter-ai",Q=V({__name:"openrouter-ai",setup(B){const{t:c}=k(),b=y(),f=w(),{providers:o}=$(f),r=_(()=>f.getProviderMetadata(a)),i=_({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),n=_({get:()=>{var e,t,s;return((e=o.value[a])==null?void 0:e.baseUrl)||((s=(t=r.value)==null?void 0:t.defaultOptions)==null?void 0:s.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});K(()=>{var e,t,s,u;f.initializeProvider(a),i.value=((e=o.value[a])==null?void 0:e.apiKey)||"",n.value=((t=o.value[a])==null?void 0:t.baseUrl)||((u=(s=r.value)==null?void 0:s.defaultOptions)==null?void 0:u.baseUrl)||""}),O([i,n],()=>{var e,t;o.value[a]={...o.value[a],apiKey:i.value,baseUrl:n.value||((t=(e=r.value)==null?void 0:e.defaultOptions)==null?void 0:t.baseUrl)||""}});function U(){var e;o.value[a]={...(e=r.value)==null?void 0:e.defaultOptions}}return(e,t)=>{var s,u;return x(),h(l(S),{"provider-name":(s=r.value)==null?void 0:s.localizedName,"provider-icon":(u=r.value)==null?void 0:u.icon,"on-back":()=>l(b).back()},{default:v(()=>[d(l(P),null,{default:v(()=>[d(l(R),{title:l(c)("settings.pages.providers.common.section.basic.title"),description:l(c)("settings.pages.providers.common.section.basic.description"),"on-reset":U},{default:v(()=>{var p;return[d(l(N),{modelValue:i.value,"onUpdate:modelValue":t[0]||(t[0]=m=>i.value=m),"provider-name":(p=r.value)==null?void 0:p.localizedName,placeholder:"sk-or-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),d(l(z),{title:l(c)("settings.pages.providers.common.section.advanced.title")},{default:v(()=>{var p,m;return[d(l(M),{modelValue:n.value,"onUpdate:modelValue":t[1]||(t[1]=g=>n.value=g),placeholder:((m=(p=r.value)==null?void 0:p.defaultOptions)==null?void 0:m.baseUrl)||""},null,8,["modelValue","placeholder"])]}),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{Q as default}; diff --git a/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm b/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm new file mode 100644 index 0000000000000000000000000000000000000000..eb8767bc243aba4af1f049b3727c9ba9199efe9f --- /dev/null +++ b/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c46655e8a94afc45338d4cb2b840475f88e5012d524509916e505079c00bfa39 +size 21596019 diff --git a/assets/ort-wasm-simd-threaded.jsep-BAR87mbD.wasm b/assets/ort-wasm-simd-threaded.jsep-BAR87mbD.wasm deleted file mode 100644 index b4ff7d19d4b58f586943245928326744ffa1a369..0000000000000000000000000000000000000000 --- a/assets/ort-wasm-simd-threaded.jsep-BAR87mbD.wasm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9b97d6fc585b8a3f93aa7fe13c64156bc65dcc4cf5b9462c84428a60fcb8113e -size 23929658 diff --git a/assets/providers-BqZLRXH1.js b/assets/providers-DUDq6kdm.js similarity index 99% rename from assets/providers-BqZLRXH1.js rename to assets/providers-DUDq6kdm.js index 6462b6f97d5aa3028f7e1ef553b1a0c285021aeb..d80d6cd546ce53074ee1ccdcabe766b97a191545 100644 --- a/assets/providers-BqZLRXH1.js +++ b/assets/providers-DUDq6kdm.js @@ -1 +1 @@ -import{f as oe,bD as le,q as de,g as q,w as ce,h as w}from"./index-20XXNHAB.js";import{r as Z,a as R,e as ee,o as k}from"./index-Be1NqeGb.js";const b=async a=>(a.fetch??globalThis.fetch)(Z("models",a.baseURL),{headers:R(a.headers,a.apiKey),signal:a.abortSignal}).then(ee).then(({data:i})=>i),_=a=>({chat:i=>Object.assign(a,{model:i})}),K=a=>({embed:i=>Object.assign(a,{model:i})}),f=a=>({model:()=>a}),pe=a=>({speech:i=>Object.assign(a,{model:i})}),ue=a=>({transcription:i=>Object.assign(a,{model:i})}),m=(a,i)=>({metadata:{id:a,...i}}),p=(...a)=>Object.assign(a[0],...a.slice(1)),ge=(a,i="https://api.anthropic.com/v1/")=>p(m("anthropic"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),L=(a,i="https://api.deepseek.com/")=>p(m("deepseek"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),G=(a,i="https://api.fireworks.ai/inference/v1/")=>p(m("fireworks"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),$=(a,i="https://generativelanguage.googleapis.com/v1beta/openai/")=>p(m("google-generative-ai"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),D=(a,i="https://api.mistral.ai/v1/")=>p(m("mistral"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),V=(a,i="https://api.moonshot.cn/v1/")=>p(m("moonshot"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),N=(a,i="https://api.novita.ai/v3/openai/")=>p(m("novita"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),S=(a,i="https://api.openai.com/v1/")=>p(m("openai"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i}),pe({apiKey:a,baseURL:i}),ue({apiKey:a,baseURL:i})),me=(a,i="")=>p(m("openrouter"),{chat:(d,o)=>{const h={apiKey:a,baseURL:i,model:d};return{...o?(({extraHeaders:n,models:v,provider:g})=>{n!=null&&(h.headers??(h.headers={}),Object.assign(h.headers,n));let c;return g!=null&&(c=k(g)),k({models:v,provider:c})})(o):{},...h}}},f({apiKey:a,baseURL:i})),ve=(a,i="https://api.perplexity.ai/")=>p(m("perplexity"),_({apiKey:a,baseURL:i})),W=(a,i="https://api.together.xyz/v1/")=>p(m("together-ai"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i,fetch:async(...d)=>globalThis.fetch(...d).then(async o=>o.json()).then(o=>Response.json({data:o,object:"list"}))})),_e=(a,i)=>{const d=`https://api.cloudflare.com/client/v4/accounts/${i}/ai/v1/`;return p(m("workers-ai"),_({apiKey:a,baseURL:d}),K({apiKey:a,baseURL:d}))},H=(a,i="https://api.x.ai/v1/")=>p(m("xai"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),A=(a="http://localhost:11434/v1/")=>p(m("ollama"),_({baseURL:a}),K({baseURL:a}),f({baseURL:a}));var J=(a,i="http://localhost:5933/v1/")=>{const d=({applyTextNormalization:t,languageCode:n,nextRequestIds:v,nextText:g,previousRequestIds:c,previousText:y,pronunciationDictionaryLocators:x,seed:M,voiceSettings:C})=>({extraBody:k({applyTextNormalization:t,languageCode:n,nextRequestIds:v,nextText:g,previousRequestIds:c,previousText:y,pronunciationDictionaryLocators:x?x.map(B=>k(B)):void 0,seed:M,voiceSettings:k(C??{similarityBoost:.75,stability:.5})})});return p({speech:(t,n)=>({...n?d(n):{},apiKey:a,baseURL:i,model:`elevenlabs/${t}`})},{voice:t=>(i.endsWith("v1/")?i=i.slice(0,-3):i.endsWith("v1")&&(i=i.slice(0,-2)),{query:"provider=elevenlabs",...t?d(t):{},apiKey:a,baseURL:i})})},X=(a,i="http://localhost:5933/v1/")=>{const d=t=>{const{deploymentId:n,region:v,sampleRate:g}=t,c={deploymentId:n,region:v,sampleRate:g};return"disableSsml"in t?c.disableSsml=t.disableSsml:"lang"in t&&(c.lang=t.lang,c.gender=t.gender,c.voice=t.voice),{extraBody:k(c)}};return p({speech:(t,n)=>({...n?d(n):{},apiKey:a,baseURL:i,model:`microsoft/${t}`})},{voice:t=>(i.endsWith("v1/")?i=i.slice(0,-3):i.endsWith("v1")&&(i=i.slice(0,-2)),{query:`region=${t==null?void 0:t.region}&provider=microsoft`,...t?d(t):{},apiKey:a,baseURL:i})})},Q=(a,i="http://localhost:5933/v1/")=>{const d=t=>{var v,g;const n={app:{appid:(v=t.app)==null?void 0:v.appId,token:a}};return typeof t.app<"u"&&(n.app={...t.app,appid:(g=t.app)==null?void 0:g.appId,token:a}),typeof t.user<"u"&&(n.user=t.user),typeof t.audio<"u"&&(n.audio=t.audio),{extraBody:k(n)}};return p({speech:(t,n)=>({...n?d(n):{},apiKey:a,baseURL:i,model:`volcengine/${t}`})},{voice:t=>(i.endsWith("v1/")?i=i.slice(0,-3):i.endsWith("v1")&&(i=i.slice(0,-2)),{query:"provider=volcengine",...t?d(t):{},apiKey:a,baseURL:i})})},Y=(a,i="http://localhost:5933/v1/")=>{const d=t=>{const{sampleRate:n,volume:v,rate:g,pitch:c}=t,y={sampleRate:n,volume:v,rate:g,pitch:c};return Object.keys(y).forEach(x=>y[x]===void 0&&delete y[x]),{extraBody:k(y)}};return p({speech:(t,n)=>({...n?d(n):{},apiKey:a,baseURL:i,model:`alibaba/${t}`})},{voice:t=>{let n=i;return n.endsWith("v1/")?n=n.slice(0,-3):n.endsWith("v1")&&(n=n.slice(0,-2)),{query:"provider=alibaba",...t?d(t):{},apiKey:a,baseURL:n}}})},E=async a=>(a.fetch??globalThis.fetch)(Z(a.query?`api/voices?${a.query}`:"api/voices",a.baseURL),{headers:R({...a.headers},a.apiKey),method:"GET",signal:a.abortSignal}).then(ee).then(({voices:i})=>i);const he=[{model_id:"eleven_multilingual_v2",name:"Eleven Multilingual v2",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!0,can_use_speaker_boost:!0,serves_pro_voices:!1,token_cost_factor:1,description:"Our most life-like, emotionally rich mode in 29 languages. Best for voice overs, audiobooks, post-production, or any other content creation needs.",requires_alpha_access:!1,max_characters_request_free_user:1e4,max_characters_request_subscribed_user:1e4,maximum_text_length_per_request:1e4,languages:[{language_id:"en",name:"English"},{language_id:"ja",name:"Japanese"},{language_id:"zh",name:"Chinese"},{language_id:"de",name:"German"},{language_id:"hi",name:"Hindi"},{language_id:"fr",name:"French"},{language_id:"ko",name:"Korean"},{language_id:"pt",name:"Portuguese"},{language_id:"it",name:"Italian"},{language_id:"es",name:"Spanish"},{language_id:"id",name:"Indonesian"},{language_id:"nl",name:"Dutch"},{language_id:"tr",name:"Turkish"},{language_id:"fil",name:"Filipino"},{language_id:"pl",name:"Polish"},{language_id:"sv",name:"Swedish"},{language_id:"bg",name:"Bulgarian"},{language_id:"ro",name:"Romanian"},{language_id:"ar",name:"Arabic"},{language_id:"cs",name:"Czech"},{language_id:"el",name:"Greek"},{language_id:"fi",name:"Finnish"},{language_id:"hr",name:"Croatian"},{language_id:"ms",name:"Malay"},{language_id:"sk",name:"Slovak"},{language_id:"da",name:"Danish"},{language_id:"ta",name:"Tamil"},{language_id:"uk",name:"Ukrainian"},{language_id:"ru",name:"Russian"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"},{model_id:"eleven_flash_v2_5",name:"Eleven Flash v2.5",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our ultra low latency model in 32 languages. Ideal for conversational use cases.",requires_alpha_access:!1,max_characters_request_free_user:4e4,max_characters_request_subscribed_user:4e4,maximum_text_length_per_request:4e4,languages:[{language_id:"en",name:"English"},{language_id:"ja",name:"Japanese"},{language_id:"zh",name:"Chinese"},{language_id:"de",name:"German"},{language_id:"hi",name:"Hindi"},{language_id:"fr",name:"French"},{language_id:"ko",name:"Korean"},{language_id:"pt",name:"Portuguese"},{language_id:"it",name:"Italian"},{language_id:"es",name:"Spanish"},{language_id:"ru",name:"Russian"},{language_id:"id",name:"Indonesian"},{language_id:"nl",name:"Dutch"},{language_id:"tr",name:"Turkish"},{language_id:"fil",name:"Filipino"},{language_id:"pl",name:"Polish"},{language_id:"sv",name:"Swedish"},{language_id:"bg",name:"Bulgarian"},{language_id:"ro",name:"Romanian"},{language_id:"ar",name:"Arabic"},{language_id:"cs",name:"Czech"},{language_id:"el",name:"Greek"},{language_id:"fi",name:"Finnish"},{language_id:"hr",name:"Croatian"},{language_id:"ms",name:"Malay"},{language_id:"sk",name:"Slovak"},{language_id:"da",name:"Danish"},{language_id:"ta",name:"Tamil"},{language_id:"uk",name:"Ukrainian"},{language_id:"hu",name:"Hungarian"},{language_id:"no",name:"Norwegian"},{language_id:"vi",name:"Vietnamese"}],model_rates:{character_cost_multiplier:.5},concurrency_group:"turbo"},{model_id:"eleven_turbo_v2_5",name:"Eleven Turbo v2.5",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our high quality, low latency model in 32 languages. Best for developer use cases where speed matters and you need non-English languages.",requires_alpha_access:!1,max_characters_request_free_user:4e4,max_characters_request_subscribed_user:4e4,maximum_text_length_per_request:4e4,languages:[{language_id:"en",name:"English"},{language_id:"ja",name:"Japanese"},{language_id:"zh",name:"Chinese"},{language_id:"de",name:"German"},{language_id:"hi",name:"Hindi"},{language_id:"fr",name:"French"},{language_id:"ko",name:"Korean"},{language_id:"pt",name:"Portuguese"},{language_id:"it",name:"Italian"},{language_id:"es",name:"Spanish"},{language_id:"ru",name:"Russian"},{language_id:"id",name:"Indonesian"},{language_id:"nl",name:"Dutch"},{language_id:"tr",name:"Turkish"},{language_id:"fil",name:"Filipino"},{language_id:"pl",name:"Polish"},{language_id:"sv",name:"Swedish"},{language_id:"bg",name:"Bulgarian"},{language_id:"ro",name:"Romanian"},{language_id:"ar",name:"Arabic"},{language_id:"cs",name:"Czech"},{language_id:"el",name:"Greek"},{language_id:"fi",name:"Finnish"},{language_id:"hr",name:"Croatian"},{language_id:"ms",name:"Malay"},{language_id:"sk",name:"Slovak"},{language_id:"da",name:"Danish"},{language_id:"ta",name:"Tamil"},{language_id:"uk",name:"Ukrainian"},{language_id:"vi",name:"Vietnamese"},{language_id:"no",name:"Norwegian"},{language_id:"hu",name:"Hungarian"}],model_rates:{character_cost_multiplier:.5},concurrency_group:"turbo"},{model_id:"eleven_turbo_v2",name:"Eleven Turbo v2",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our English-only, low latency model. Best for developer use cases where speed matters and you only need English. Performance is on par with Turbo v2.5.",requires_alpha_access:!1,max_characters_request_free_user:3e4,max_characters_request_subscribed_user:3e4,maximum_text_length_per_request:3e4,languages:[{language_id:"en",name:"English"}],model_rates:{character_cost_multiplier:.5},concurrency_group:"turbo"},{model_id:"eleven_flash_v2",name:"Eleven Flash v2",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our ultra low latency model in english. Ideal for conversational use cases.",requires_alpha_access:!1,max_characters_request_free_user:3e4,max_characters_request_subscribed_user:3e4,maximum_text_length_per_request:3e4,languages:[{language_id:"en",name:"English"}],model_rates:{character_cost_multiplier:.5},concurrency_group:"turbo"},{model_id:"eleven_english_sts_v2",name:"Eleven English v2",can_be_finetuned:!1,can_do_text_to_speech:!1,can_do_voice_conversion:!0,can_use_style:!0,can_use_speaker_boost:!0,serves_pro_voices:!1,token_cost_factor:1,description:"Our state-of-the-art speech to speech model suitable for scenarios where you need maximum control over the content and prosody of your generations.",requires_alpha_access:!1,max_characters_request_free_user:5e3,max_characters_request_subscribed_user:5e3,maximum_text_length_per_request:5e3,languages:[{language_id:"en",name:"English"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"},{model_id:"eleven_multilingual_v1",name:"Eleven Multilingual v1",can_be_finetuned:!1,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our first Multilingual model, capability of generating speech in 10 languages. Now outclassed by Multilingual v2 (for content creation) and Turbo v2.5 (for low latency use cases).",requires_alpha_access:!1,max_characters_request_free_user:1e4,max_characters_request_subscribed_user:1e4,maximum_text_length_per_request:1e4,languages:[{language_id:"en",name:"English"},{language_id:"de",name:"German"},{language_id:"pl",name:"Polish"},{language_id:"es",name:"Spanish"},{language_id:"it",name:"Italian"},{language_id:"fr",name:"French"},{language_id:"pt",name:"Portuguese"},{language_id:"hi",name:"Hindi"},{language_id:"ar",name:"Arabic"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"},{model_id:"eleven_multilingual_sts_v2",name:"Eleven Multilingual v2",can_be_finetuned:!0,can_do_text_to_speech:!1,can_do_voice_conversion:!0,can_use_style:!0,can_use_speaker_boost:!0,serves_pro_voices:!1,token_cost_factor:1,description:"Our cutting-edge, multilingual speech-to-speech model is designed for situations that demand unparalleled control over both the content and the prosody of the generated speech across various languages.",requires_alpha_access:!1,max_characters_request_free_user:1e4,max_characters_request_subscribed_user:1e4,maximum_text_length_per_request:1e4,languages:[{language_id:"en",name:"English"},{language_id:"ja",name:"Japanese"},{language_id:"zh",name:"Chinese"},{language_id:"de",name:"German"},{language_id:"hi",name:"Hindi"},{language_id:"fr",name:"French"},{language_id:"ko",name:"Korean"},{language_id:"pt",name:"Portuguese"},{language_id:"it",name:"Italian"},{language_id:"es",name:"Spanish"},{language_id:"ru",name:"Russian"},{language_id:"id",name:"Indonesian"},{language_id:"nl",name:"Dutch"},{language_id:"tr",name:"Turkish"},{language_id:"fil",name:"Filipino"},{language_id:"pl",name:"Polish"},{language_id:"sv",name:"Swedish"},{language_id:"bg",name:"Bulgarian"},{language_id:"ro",name:"Romanian"},{language_id:"ar",name:"Arabic"},{language_id:"cs",name:"Czech"},{language_id:"el",name:"Greek"},{language_id:"fi",name:"Finnish"},{language_id:"hr",name:"Croatian"},{language_id:"ms",name:"Malay"},{language_id:"sk",name:"Slovak"},{language_id:"da",name:"Danish"},{language_id:"ta",name:"Tamil"},{language_id:"uk",name:"Ukrainian"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"},{model_id:"eleven_monolingual_v1",name:"Eleven English v1",can_be_finetuned:!1,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our first ever text to speech model. Now outclassed by Multilingual v2 (for content creation) and Turbo v2.5 (for low latency use cases).",requires_alpha_access:!1,max_characters_request_free_user:1e4,max_characters_request_subscribed_user:1e4,maximum_text_length_per_request:1e4,languages:[{language_id:"en",name:"English"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"}],xe=oe("providers",()=>{const a=le("settings/credentials/providers",{}),{t:i}=de();async function d(e){try{const r=await fetch("https://openrouter.ai/api/v1/models",{headers:{Authorization:`Bearer ${e.apiKey.trim()}`,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to fetch OpenRouter models: ${r.statusText}`);return(await r.json()).data.map(s=>({id:s.id,name:s.name||s.id,provider:"openrouter-ai",description:s.description||"",contextLength:s.context_length,deprecated:!1}))}catch(r){throw console.error("Error fetching OpenRouter models:",r),r}}const o={"openrouter-ai":{id:"openrouter-ai",nameKey:"settings.pages.providers.provider.openrouter.title",name:"OpenRouter",descriptionKey:"settings.pages.providers.provider.openrouter.description",description:"openrouter.ai",icon:"i-lobe-icons:openrouter",defaultOptions:{baseUrl:"https://openrouter.ai/api/v1/"},createProvider:e=>me(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>d(e)},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},ollama:{id:"ollama",nameKey:"settings.pages.providers.provider.ollama.title",name:"Ollama",descriptionKey:"settings.pages.providers.provider.ollama.description",description:"ollama.com",icon:"i-lobe-icons:ollama",defaultOptions:{baseUrl:"http://localhost:11434/v1/"},createProvider:e=>A(e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...A(e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"ollama",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.baseUrl}},vllm:{id:"vllm",nameKey:"settings.pages.providers.provider.vllm.title",name:"vLLM",descriptionKey:"settings.pages.providers.provider.vllm.description",description:"vllm.ai",iconColor:"i-lobe-icons:vllm",createProvider:e=>A(e.baseUrl.trim()),capabilities:{listModels:async()=>[{id:"llama-2-7b",name:"Llama 2 (7B)",provider:"vllm",description:"Meta's Llama 2 7B parameter model",contextLength:4096},{id:"llama-2-13b",name:"Llama 2 (13B)",provider:"vllm",description:"Meta's Llama 2 13B parameter model",contextLength:4096},{id:"llama-2-70b",name:"Llama 2 (70B)",provider:"vllm",description:"Meta's Llama 2 70B parameter model",contextLength:4096},{id:"mistral-7b",name:"Mistral (7B)",provider:"vllm",description:"Mistral AI's 7B parameter model",contextLength:8192},{id:"mixtral-8x7b",name:"Mixtral (8x7B)",provider:"vllm",description:"Mistral AI's Mixtral 8x7B MoE model",contextLength:32768},{id:"custom",name:"Custom Model",provider:"vllm",description:"Specify a custom model name",contextLength:0}]},validators:{validateProviderConfig:e=>!!e.baseUrl}},openai:{id:"openai",nameKey:"settings.pages.providers.provider.openai.title",name:"OpenAI",descriptionKey:"settings.pages.providers.provider.openai.description",description:"openai.com",icon:"i-lobe-icons:openai",defaultOptions:{baseUrl:"https://api.openai.com/v1/"},createProvider:e=>S(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...S(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"openai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},anthropic:{id:"anthropic",nameKey:"settings.pages.providers.provider.anthropic.title",name:"Anthropic",descriptionKey:"settings.pages.providers.provider.anthropic.description",description:"anthropic.com",icon:"i-lobe-icons:anthropic",defaultOptions:{baseUrl:"https://api.anthropic.com/v1/"},createProvider:e=>ge(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async()=>[{id:"claude-3-7-sonnet-20250219",name:"Claude 3.7 Sonnet",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet (New)",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-5-haiku-20241022",name:"Claude 3.5 Haiku",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-5-sonnet-20240620",name:"Claude 3.5 Sonnet (Old)",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-haiku-20240307",name:"Claude 3 Haiku",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-opus-20240229",name:"Claude 3 Opus",provider:"anthropic",description:"",contextLength:0,deprecated:!1}]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"google-generative-ai":{id:"google-generative-ai",nameKey:"settings.pages.providers.provider.google-generative-ai.title",name:"Google Gemini",descriptionKey:"settings.pages.providers.provider.google-generative-ai.description",description:"ai.google.dev",icon:"i-lobe-icons:gemini",defaultOptions:{baseUrl:"https://generativelanguage.googleapis.com/v1beta/openai/"},createProvider:e=>$(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...$(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"google-generative-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},xai:{id:"xai",nameKey:"settings.pages.providers.provider.xai.title",name:"xAI",descriptionKey:"settings.pages.providers.provider.xai.description",description:"x.ai",icon:"i-lobe-icons:xai",createProvider:e=>H(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...H(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"xai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},deepseek:{id:"deepseek",nameKey:"settings.pages.providers.provider.deepseek.title",name:"DeepSeek",descriptionKey:"settings.pages.providers.provider.deepseek.description",description:"deepseek.com",iconColor:"i-lobe-icons:deepseek",createProvider:e=>L(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...L(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"deepseek",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},elevenlabs:{id:"elevenlabs",nameKey:"settings.pages.providers.provider.elevenlabs.title",name:"ElevenLabs",descriptionKey:"settings.pages.providers.provider.elevenlabs.description",description:"elevenlabs.io",icon:"i-simple-icons:elevenlabs",defaultOptions:{baseUrl:"https://unspeech.hyp3r.link/v1/",voiceSettings:{similarityBoost:.75,stability:.5}},createProvider:e=>J(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async()=>he.map(e=>({id:e.model_id,name:e.name,provider:"elevenlabs",description:e.description,contextLength:0,deprecated:!1})),listVoices:async e=>{const r=J(e.apiKey.trim(),e.baseUrl.trim()),l=await E({...r.voice()}),s=l.findIndex(P=>P.name.includes("Aria")),u=l.findIndex(P=>P.name.includes("Bill")),j=s!==-1?s:0,F=u!==-1?u:l.length-1,I=Math.min(j,F),z=Math.max(j,F);return[...l.slice(0,I),...l.slice(z+1),...l.slice(I,z+1)].map(P=>({id:P.id,name:P.name,provider:"elevenlabs",previewURL:P.preview_audio_url,languages:P.languages}))}},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"microsoft-speech":{id:"microsoft-speech",nameKey:"settings.pages.providers.provider.microsoft-speech.title",name:"Microsoft / Azure Speech",descriptionKey:"settings.pages.providers.provider.microsoft-speech.description",description:"speech.microsoft.com",iconColor:"i-lobe-icons:microsoft",defaultOptions:{baseUrl:"https://unspeech.hyp3r.link/v1/"},createProvider:e=>X(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async()=>[{id:"v1",name:"v1",provider:"microsoft-speech",description:"",contextLength:0,deprecated:!1}],listVoices:async e=>{const r=X(e.apiKey.trim(),e.baseUrl.trim());return(await E({...r.voice({region:e.region})})).map(s=>{var u;return{id:s.id,name:s.name,provider:"microsoft-speech",previewURL:s.preview_audio_url,languages:s.languages,gender:(u=s.labels)==null?void 0:u.gender}})}},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"alibaba-cloud-model-studio":{id:"alibaba-cloud-model-studio",nameKey:"settings.pages.providers.provider.alibaba-cloud-model-studio.title",name:"Alibaba Cloud Model Studio",descriptionKey:"settings.pages.providers.provider.alibaba-cloud-model-studio.description",description:"bailian.console.aliyun.com",iconColor:"i-lobe-icons:alibabacloud",defaultOptions:{baseUrl:"https://unspeech.hyp3r.link/v1/"},createProvider:e=>Y(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listVoices:async e=>{const r=Y(e.apiKey.trim(),e.baseUrl.trim());return(await E({...r.voice()})).map(s=>{var u;return{id:s.id,name:s.name,provider:"alibaba-cloud-model-studio",previewURL:s.preview_audio_url,languages:s.languages,gender:(u=s.labels)==null?void 0:u.gender}})},listModels:async()=>[{id:"cozyvoice-v1",name:"CozyVoice",provider:"alibaba-cloud-model-studio",description:"",contextLength:0,deprecated:!1},{id:"cozyvoice-v2",name:"CozyVoice (New)",provider:"alibaba-cloud-model-studio",description:"",contextLength:0,deprecated:!1}]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},volcengine:{id:"volcengine",nameKey:"settings.pages.providers.provider.volcengine.title",name:"settings.pages.providers.provider.volcengine.title",descriptionKey:"settings.pages.providers.provider.volcengine.description",description:"volcengine.com",iconColor:"i-lobe-icons:volcengine",defaultOptions:{baseUrl:"https://unspeech.hyp3r.link/v1/"},createProvider:e=>Q(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listVoices:async e=>{const r=Q(e.apiKey.trim(),e.baseUrl.trim());return(await E({...r.voice()})).map(s=>{var u;return{id:s.id,name:s.name,provider:"volcano-engine",previewURL:s.preview_audio_url,languages:s.languages,gender:(u=s.labels)==null?void 0:u.gender}})},listModels:async()=>[{id:"v1",name:"v1",provider:"volcano-engine",description:"",contextLength:0,deprecated:!1}]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl&&!!e.app&&!!e.app.appId}},"together-ai":{id:"together-ai",nameKey:"settings.pages.providers.provider.together.title",name:"Together.ai",descriptionKey:"settings.pages.providers.provider.together.description",description:"together.ai",iconColor:"i-lobe-icons:together",createProvider:e=>W(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...W(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"together-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"novita-ai":{id:"novita-ai",nameKey:"settings.pages.providers.provider.novita.title",name:"Novita",descriptionKey:"settings.pages.providers.provider.novita.description",description:"novita.ai",iconColor:"i-lobe-icons:novita",createProvider:e=>N(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...N(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"novita-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"fireworks-ai":{id:"fireworks-ai",nameKey:"settings.pages.providers.provider.fireworks.title",name:"Fireworks.ai",descriptionKey:"settings.pages.providers.provider.fireworks.description",description:"fireworks.ai",icon:"i-lobe-icons:fireworks",createProvider:e=>G(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...G(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"fireworks-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"featherless-ai":{id:"featherless-ai",nameKey:"settings.pages.providers.provider.featherless.title",name:"Featherless.ai",descriptionKey:"settings.pages.providers.provider.featherless.description",description:"featherless.ai",icon:"i-lobe-icons:featherless-ai",defaultOptions:{baseUrl:"https://api.featherless.ai/v1/"},createProvider:e=>S(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...S(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"featherless-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"cloudflare-workers-ai":{id:"cloudflare-workers-ai",nameKey:"settings.pages.providers.provider.cloudflare-workers-ai.title",name:"Cloudflare Workers AI",descriptionKey:"settings.pages.providers.provider.cloudflare-workers-ai.description",description:"cloudflare.com",iconColor:"i-lobe-icons:cloudflare",createProvider:e=>_e(e.apiKey.trim(),e.accountId),capabilities:{listModels:async()=>[]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.accountId}},"perplexity-ai":{id:"perplexity-ai",nameKey:"settings.pages.providers.provider.perplexity.title",name:"Perplexity",descriptionKey:"settings.pages.providers.provider.perplexity.description",description:"perplexity.ai",icon:"i-lobe-icons:perplexity",defaultOptions:{baseUrl:"https://api.perplexity.ai"},createProvider:e=>ve(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async()=>[{id:"sonar-small-online",name:"Sonar Small (Online)",provider:"perplexity-ai",description:"Efficient model with online search capabilities",contextLength:12e3},{id:"sonar-medium-online",name:"Sonar Medium (Online)",provider:"perplexity-ai",description:"Balanced model with online search capabilities",contextLength:12e3},{id:"sonar-large-online",name:"Sonar Large (Online)",provider:"perplexity-ai",description:"Powerful model with online search capabilities",contextLength:12e3},{id:"codey-small",name:"Codey Small",provider:"perplexity-ai",description:"Specialized for code generation and understanding",contextLength:12e3},{id:"codey-large",name:"Codey Large",provider:"perplexity-ai",description:"Advanced code generation and understanding",contextLength:12e3}]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"mistral-ai":{id:"mistral-ai",nameKey:"settings.pages.providers.provider.mistral.title",name:"Mistral",descriptionKey:"settings.pages.providers.provider.mistral.description",description:"mistral.ai",iconColor:"i-lobe-icons:mistral",createProvider:e=>D(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...D(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"mistral-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"moonshot-ai":{id:"moonshot-ai",nameKey:"settings.pages.providers.provider.moonshot.title",name:"Moonshot AI",descriptionKey:"settings.pages.providers.provider.moonshot.description",description:"moonshot.ai",icon:"i-lobe-icons:moonshot",createProvider:e=>V(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...V(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"moonshot-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}}};async function h(e){const r=a.value[e];if(!r)return!1;const l=o[e];return l?await l.validators.validateProviderConfig(r):!1}const t=q({});function n(e){var r;if(!a.value[e]){const l=o[e];a.value[e]={baseUrl:((r=l.defaultOptions)==null?void 0:r.baseUrl)||""}}}Object.keys(o).forEach(n);async function v(){await Promise.all(Object.keys(o).map(async e=>{t.value[e]=await h(e)}))}v(),ce(a,v,{deep:!0});const g=w(()=>Object.keys(o).filter(e=>t.value[e])),c=q({}),y=q({}),x=q({});async function M(e){const r=a.value[e];if(!r)return[];const l=o[e];if(!l)return[];y.value[e]=!0,x.value[e]=null;try{const s=l.capabilities.listModels?await l.capabilities.listModels(r):[];return c.value[e]=s.map(u=>({id:u.id,name:u.name,description:u.description,contextLength:u.contextLength,deprecated:u.deprecated,provider:e})),c.value[e]}catch(s){return console.error(`Error fetching models for ${e}:`,s),x.value[e]=s instanceof Error?s.message:"Unknown error",[]}finally{y.value[e]=!1}}function C(e){return c.value[e]||[]}const B=w(()=>{const e=[];for(const r of g.value)e.push(...c.value[r]||[]);return e});async function ae(){for(const e of g.value)o[e].capabilities.listModels&&await M(e)}function T(e){const r=o[e];if(!r)throw new Error(`Provider metadata for ${e} not found`);return{...r,localizedName:i(r.nameKey,r.name),localizedDescription:i(r.descriptionKey,r.description)}}const ie=w(()=>Object.values(o).map(e=>({...e,localizedName:i(e.nameKey,e.name),localizedDescription:i(e.descriptionKey,e.description),configured:t.value[e.id]||!1})));function O(e){const r=a.value[e];if(!r)throw new Error(`Provider credentials for ${e} not found`);const l=o[e];if(!l)throw new Error(`Provider metadata for ${e} not found`);try{return l.createProvider(r)}catch(s){throw console.error(`Error creating provider instance for ${e}:`,s),s}}const U=w(()=>g.value.map(e=>T(e))),re=w(()=>U.value.filter(e=>{const r=O(e.id);return"chat"in r&&typeof r.chat=="function"})),te=w(()=>U.value.filter(e=>{const r=O(e.id);return"transcription"in r&&typeof r.transcription=="function"})),ne=w(()=>U.value.filter(e=>{const r=O(e.id);return"speech"in r&&typeof r.speech=="function"}));function se(e){return a.value[e]}return{providers:a,getProviderConfig:se,availableProviders:g,configuredProviders:t,providerMetadata:o,getProviderMetadata:T,allProvidersMetadata:ie,initializeProvider:n,validateProvider:h,availableModels:c,isLoadingModels:y,modelLoadError:x,fetchModelsForProvider:M,getModelsForProvider:C,allAvailableModels:B,loadModelsForConfiguredProviders:ae,getProviderInstance:O,availableProvidersMetadata:U,availableTextGenerationsProvidersMetadata:re,availableAudioSpeechProvidersMetadata:ne,availableAudioTranscriptionProvidersMetadata:te}});export{b as l,xe as u}; +import{f as oe,bD as le,q as de,g as q,w as ce,h as w}from"./index-D8Nm21zW.js";import{r as Z,a as R,e as ee,o as k}from"./index-Be1NqeGb.js";const b=async a=>(a.fetch??globalThis.fetch)(Z("models",a.baseURL),{headers:R(a.headers,a.apiKey),signal:a.abortSignal}).then(ee).then(({data:i})=>i),_=a=>({chat:i=>Object.assign(a,{model:i})}),K=a=>({embed:i=>Object.assign(a,{model:i})}),f=a=>({model:()=>a}),pe=a=>({speech:i=>Object.assign(a,{model:i})}),ue=a=>({transcription:i=>Object.assign(a,{model:i})}),m=(a,i)=>({metadata:{id:a,...i}}),p=(...a)=>Object.assign(a[0],...a.slice(1)),ge=(a,i="https://api.anthropic.com/v1/")=>p(m("anthropic"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),L=(a,i="https://api.deepseek.com/")=>p(m("deepseek"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),G=(a,i="https://api.fireworks.ai/inference/v1/")=>p(m("fireworks"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),$=(a,i="https://generativelanguage.googleapis.com/v1beta/openai/")=>p(m("google-generative-ai"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),D=(a,i="https://api.mistral.ai/v1/")=>p(m("mistral"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),V=(a,i="https://api.moonshot.cn/v1/")=>p(m("moonshot"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),N=(a,i="https://api.novita.ai/v3/openai/")=>p(m("novita"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),S=(a,i="https://api.openai.com/v1/")=>p(m("openai"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i}),pe({apiKey:a,baseURL:i}),ue({apiKey:a,baseURL:i})),me=(a,i="")=>p(m("openrouter"),{chat:(d,o)=>{const h={apiKey:a,baseURL:i,model:d};return{...o?(({extraHeaders:n,models:v,provider:g})=>{n!=null&&(h.headers??(h.headers={}),Object.assign(h.headers,n));let c;return g!=null&&(c=k(g)),k({models:v,provider:c})})(o):{},...h}}},f({apiKey:a,baseURL:i})),ve=(a,i="https://api.perplexity.ai/")=>p(m("perplexity"),_({apiKey:a,baseURL:i})),W=(a,i="https://api.together.xyz/v1/")=>p(m("together-ai"),_({apiKey:a,baseURL:i}),K({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i,fetch:async(...d)=>globalThis.fetch(...d).then(async o=>o.json()).then(o=>Response.json({data:o,object:"list"}))})),_e=(a,i)=>{const d=`https://api.cloudflare.com/client/v4/accounts/${i}/ai/v1/`;return p(m("workers-ai"),_({apiKey:a,baseURL:d}),K({apiKey:a,baseURL:d}))},H=(a,i="https://api.x.ai/v1/")=>p(m("xai"),_({apiKey:a,baseURL:i}),f({apiKey:a,baseURL:i})),A=(a="http://localhost:11434/v1/")=>p(m("ollama"),_({baseURL:a}),K({baseURL:a}),f({baseURL:a}));var J=(a,i="http://localhost:5933/v1/")=>{const d=({applyTextNormalization:t,languageCode:n,nextRequestIds:v,nextText:g,previousRequestIds:c,previousText:y,pronunciationDictionaryLocators:x,seed:M,voiceSettings:C})=>({extraBody:k({applyTextNormalization:t,languageCode:n,nextRequestIds:v,nextText:g,previousRequestIds:c,previousText:y,pronunciationDictionaryLocators:x?x.map(B=>k(B)):void 0,seed:M,voiceSettings:k(C??{similarityBoost:.75,stability:.5})})});return p({speech:(t,n)=>({...n?d(n):{},apiKey:a,baseURL:i,model:`elevenlabs/${t}`})},{voice:t=>(i.endsWith("v1/")?i=i.slice(0,-3):i.endsWith("v1")&&(i=i.slice(0,-2)),{query:"provider=elevenlabs",...t?d(t):{},apiKey:a,baseURL:i})})},X=(a,i="http://localhost:5933/v1/")=>{const d=t=>{const{deploymentId:n,region:v,sampleRate:g}=t,c={deploymentId:n,region:v,sampleRate:g};return"disableSsml"in t?c.disableSsml=t.disableSsml:"lang"in t&&(c.lang=t.lang,c.gender=t.gender,c.voice=t.voice),{extraBody:k(c)}};return p({speech:(t,n)=>({...n?d(n):{},apiKey:a,baseURL:i,model:`microsoft/${t}`})},{voice:t=>(i.endsWith("v1/")?i=i.slice(0,-3):i.endsWith("v1")&&(i=i.slice(0,-2)),{query:`region=${t==null?void 0:t.region}&provider=microsoft`,...t?d(t):{},apiKey:a,baseURL:i})})},Q=(a,i="http://localhost:5933/v1/")=>{const d=t=>{var v,g;const n={app:{appid:(v=t.app)==null?void 0:v.appId,token:a}};return typeof t.app<"u"&&(n.app={...t.app,appid:(g=t.app)==null?void 0:g.appId,token:a}),typeof t.user<"u"&&(n.user=t.user),typeof t.audio<"u"&&(n.audio=t.audio),{extraBody:k(n)}};return p({speech:(t,n)=>({...n?d(n):{},apiKey:a,baseURL:i,model:`volcengine/${t}`})},{voice:t=>(i.endsWith("v1/")?i=i.slice(0,-3):i.endsWith("v1")&&(i=i.slice(0,-2)),{query:"provider=volcengine",...t?d(t):{},apiKey:a,baseURL:i})})},Y=(a,i="http://localhost:5933/v1/")=>{const d=t=>{const{sampleRate:n,volume:v,rate:g,pitch:c}=t,y={sampleRate:n,volume:v,rate:g,pitch:c};return Object.keys(y).forEach(x=>y[x]===void 0&&delete y[x]),{extraBody:k(y)}};return p({speech:(t,n)=>({...n?d(n):{},apiKey:a,baseURL:i,model:`alibaba/${t}`})},{voice:t=>{let n=i;return n.endsWith("v1/")?n=n.slice(0,-3):n.endsWith("v1")&&(n=n.slice(0,-2)),{query:"provider=alibaba",...t?d(t):{},apiKey:a,baseURL:n}}})},E=async a=>(a.fetch??globalThis.fetch)(Z(a.query?`api/voices?${a.query}`:"api/voices",a.baseURL),{headers:R({...a.headers},a.apiKey),method:"GET",signal:a.abortSignal}).then(ee).then(({voices:i})=>i);const he=[{model_id:"eleven_multilingual_v2",name:"Eleven Multilingual v2",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!0,can_use_speaker_boost:!0,serves_pro_voices:!1,token_cost_factor:1,description:"Our most life-like, emotionally rich mode in 29 languages. Best for voice overs, audiobooks, post-production, or any other content creation needs.",requires_alpha_access:!1,max_characters_request_free_user:1e4,max_characters_request_subscribed_user:1e4,maximum_text_length_per_request:1e4,languages:[{language_id:"en",name:"English"},{language_id:"ja",name:"Japanese"},{language_id:"zh",name:"Chinese"},{language_id:"de",name:"German"},{language_id:"hi",name:"Hindi"},{language_id:"fr",name:"French"},{language_id:"ko",name:"Korean"},{language_id:"pt",name:"Portuguese"},{language_id:"it",name:"Italian"},{language_id:"es",name:"Spanish"},{language_id:"id",name:"Indonesian"},{language_id:"nl",name:"Dutch"},{language_id:"tr",name:"Turkish"},{language_id:"fil",name:"Filipino"},{language_id:"pl",name:"Polish"},{language_id:"sv",name:"Swedish"},{language_id:"bg",name:"Bulgarian"},{language_id:"ro",name:"Romanian"},{language_id:"ar",name:"Arabic"},{language_id:"cs",name:"Czech"},{language_id:"el",name:"Greek"},{language_id:"fi",name:"Finnish"},{language_id:"hr",name:"Croatian"},{language_id:"ms",name:"Malay"},{language_id:"sk",name:"Slovak"},{language_id:"da",name:"Danish"},{language_id:"ta",name:"Tamil"},{language_id:"uk",name:"Ukrainian"},{language_id:"ru",name:"Russian"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"},{model_id:"eleven_flash_v2_5",name:"Eleven Flash v2.5",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our ultra low latency model in 32 languages. Ideal for conversational use cases.",requires_alpha_access:!1,max_characters_request_free_user:4e4,max_characters_request_subscribed_user:4e4,maximum_text_length_per_request:4e4,languages:[{language_id:"en",name:"English"},{language_id:"ja",name:"Japanese"},{language_id:"zh",name:"Chinese"},{language_id:"de",name:"German"},{language_id:"hi",name:"Hindi"},{language_id:"fr",name:"French"},{language_id:"ko",name:"Korean"},{language_id:"pt",name:"Portuguese"},{language_id:"it",name:"Italian"},{language_id:"es",name:"Spanish"},{language_id:"ru",name:"Russian"},{language_id:"id",name:"Indonesian"},{language_id:"nl",name:"Dutch"},{language_id:"tr",name:"Turkish"},{language_id:"fil",name:"Filipino"},{language_id:"pl",name:"Polish"},{language_id:"sv",name:"Swedish"},{language_id:"bg",name:"Bulgarian"},{language_id:"ro",name:"Romanian"},{language_id:"ar",name:"Arabic"},{language_id:"cs",name:"Czech"},{language_id:"el",name:"Greek"},{language_id:"fi",name:"Finnish"},{language_id:"hr",name:"Croatian"},{language_id:"ms",name:"Malay"},{language_id:"sk",name:"Slovak"},{language_id:"da",name:"Danish"},{language_id:"ta",name:"Tamil"},{language_id:"uk",name:"Ukrainian"},{language_id:"hu",name:"Hungarian"},{language_id:"no",name:"Norwegian"},{language_id:"vi",name:"Vietnamese"}],model_rates:{character_cost_multiplier:.5},concurrency_group:"turbo"},{model_id:"eleven_turbo_v2_5",name:"Eleven Turbo v2.5",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our high quality, low latency model in 32 languages. Best for developer use cases where speed matters and you need non-English languages.",requires_alpha_access:!1,max_characters_request_free_user:4e4,max_characters_request_subscribed_user:4e4,maximum_text_length_per_request:4e4,languages:[{language_id:"en",name:"English"},{language_id:"ja",name:"Japanese"},{language_id:"zh",name:"Chinese"},{language_id:"de",name:"German"},{language_id:"hi",name:"Hindi"},{language_id:"fr",name:"French"},{language_id:"ko",name:"Korean"},{language_id:"pt",name:"Portuguese"},{language_id:"it",name:"Italian"},{language_id:"es",name:"Spanish"},{language_id:"ru",name:"Russian"},{language_id:"id",name:"Indonesian"},{language_id:"nl",name:"Dutch"},{language_id:"tr",name:"Turkish"},{language_id:"fil",name:"Filipino"},{language_id:"pl",name:"Polish"},{language_id:"sv",name:"Swedish"},{language_id:"bg",name:"Bulgarian"},{language_id:"ro",name:"Romanian"},{language_id:"ar",name:"Arabic"},{language_id:"cs",name:"Czech"},{language_id:"el",name:"Greek"},{language_id:"fi",name:"Finnish"},{language_id:"hr",name:"Croatian"},{language_id:"ms",name:"Malay"},{language_id:"sk",name:"Slovak"},{language_id:"da",name:"Danish"},{language_id:"ta",name:"Tamil"},{language_id:"uk",name:"Ukrainian"},{language_id:"vi",name:"Vietnamese"},{language_id:"no",name:"Norwegian"},{language_id:"hu",name:"Hungarian"}],model_rates:{character_cost_multiplier:.5},concurrency_group:"turbo"},{model_id:"eleven_turbo_v2",name:"Eleven Turbo v2",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our English-only, low latency model. Best for developer use cases where speed matters and you only need English. Performance is on par with Turbo v2.5.",requires_alpha_access:!1,max_characters_request_free_user:3e4,max_characters_request_subscribed_user:3e4,maximum_text_length_per_request:3e4,languages:[{language_id:"en",name:"English"}],model_rates:{character_cost_multiplier:.5},concurrency_group:"turbo"},{model_id:"eleven_flash_v2",name:"Eleven Flash v2",can_be_finetuned:!0,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our ultra low latency model in english. Ideal for conversational use cases.",requires_alpha_access:!1,max_characters_request_free_user:3e4,max_characters_request_subscribed_user:3e4,maximum_text_length_per_request:3e4,languages:[{language_id:"en",name:"English"}],model_rates:{character_cost_multiplier:.5},concurrency_group:"turbo"},{model_id:"eleven_english_sts_v2",name:"Eleven English v2",can_be_finetuned:!1,can_do_text_to_speech:!1,can_do_voice_conversion:!0,can_use_style:!0,can_use_speaker_boost:!0,serves_pro_voices:!1,token_cost_factor:1,description:"Our state-of-the-art speech to speech model suitable for scenarios where you need maximum control over the content and prosody of your generations.",requires_alpha_access:!1,max_characters_request_free_user:5e3,max_characters_request_subscribed_user:5e3,maximum_text_length_per_request:5e3,languages:[{language_id:"en",name:"English"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"},{model_id:"eleven_multilingual_v1",name:"Eleven Multilingual v1",can_be_finetuned:!1,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our first Multilingual model, capability of generating speech in 10 languages. Now outclassed by Multilingual v2 (for content creation) and Turbo v2.5 (for low latency use cases).",requires_alpha_access:!1,max_characters_request_free_user:1e4,max_characters_request_subscribed_user:1e4,maximum_text_length_per_request:1e4,languages:[{language_id:"en",name:"English"},{language_id:"de",name:"German"},{language_id:"pl",name:"Polish"},{language_id:"es",name:"Spanish"},{language_id:"it",name:"Italian"},{language_id:"fr",name:"French"},{language_id:"pt",name:"Portuguese"},{language_id:"hi",name:"Hindi"},{language_id:"ar",name:"Arabic"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"},{model_id:"eleven_multilingual_sts_v2",name:"Eleven Multilingual v2",can_be_finetuned:!0,can_do_text_to_speech:!1,can_do_voice_conversion:!0,can_use_style:!0,can_use_speaker_boost:!0,serves_pro_voices:!1,token_cost_factor:1,description:"Our cutting-edge, multilingual speech-to-speech model is designed for situations that demand unparalleled control over both the content and the prosody of the generated speech across various languages.",requires_alpha_access:!1,max_characters_request_free_user:1e4,max_characters_request_subscribed_user:1e4,maximum_text_length_per_request:1e4,languages:[{language_id:"en",name:"English"},{language_id:"ja",name:"Japanese"},{language_id:"zh",name:"Chinese"},{language_id:"de",name:"German"},{language_id:"hi",name:"Hindi"},{language_id:"fr",name:"French"},{language_id:"ko",name:"Korean"},{language_id:"pt",name:"Portuguese"},{language_id:"it",name:"Italian"},{language_id:"es",name:"Spanish"},{language_id:"ru",name:"Russian"},{language_id:"id",name:"Indonesian"},{language_id:"nl",name:"Dutch"},{language_id:"tr",name:"Turkish"},{language_id:"fil",name:"Filipino"},{language_id:"pl",name:"Polish"},{language_id:"sv",name:"Swedish"},{language_id:"bg",name:"Bulgarian"},{language_id:"ro",name:"Romanian"},{language_id:"ar",name:"Arabic"},{language_id:"cs",name:"Czech"},{language_id:"el",name:"Greek"},{language_id:"fi",name:"Finnish"},{language_id:"hr",name:"Croatian"},{language_id:"ms",name:"Malay"},{language_id:"sk",name:"Slovak"},{language_id:"da",name:"Danish"},{language_id:"ta",name:"Tamil"},{language_id:"uk",name:"Ukrainian"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"},{model_id:"eleven_monolingual_v1",name:"Eleven English v1",can_be_finetuned:!1,can_do_text_to_speech:!0,can_do_voice_conversion:!1,can_use_style:!1,can_use_speaker_boost:!1,serves_pro_voices:!1,token_cost_factor:1,description:"Our first ever text to speech model. Now outclassed by Multilingual v2 (for content creation) and Turbo v2.5 (for low latency use cases).",requires_alpha_access:!1,max_characters_request_free_user:1e4,max_characters_request_subscribed_user:1e4,maximum_text_length_per_request:1e4,languages:[{language_id:"en",name:"English"}],model_rates:{character_cost_multiplier:1},concurrency_group:"standard"}],xe=oe("providers",()=>{const a=le("settings/credentials/providers",{}),{t:i}=de();async function d(e){try{const r=await fetch("https://openrouter.ai/api/v1/models",{headers:{Authorization:`Bearer ${e.apiKey.trim()}`,"Content-Type":"application/json"}});if(!r.ok)throw new Error(`Failed to fetch OpenRouter models: ${r.statusText}`);return(await r.json()).data.map(s=>({id:s.id,name:s.name||s.id,provider:"openrouter-ai",description:s.description||"",contextLength:s.context_length,deprecated:!1}))}catch(r){throw console.error("Error fetching OpenRouter models:",r),r}}const o={"openrouter-ai":{id:"openrouter-ai",nameKey:"settings.pages.providers.provider.openrouter.title",name:"OpenRouter",descriptionKey:"settings.pages.providers.provider.openrouter.description",description:"openrouter.ai",icon:"i-lobe-icons:openrouter",defaultOptions:{baseUrl:"https://openrouter.ai/api/v1/"},createProvider:e=>me(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>d(e)},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},ollama:{id:"ollama",nameKey:"settings.pages.providers.provider.ollama.title",name:"Ollama",descriptionKey:"settings.pages.providers.provider.ollama.description",description:"ollama.com",icon:"i-lobe-icons:ollama",defaultOptions:{baseUrl:"http://localhost:11434/v1/"},createProvider:e=>A(e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...A(e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"ollama",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.baseUrl}},vllm:{id:"vllm",nameKey:"settings.pages.providers.provider.vllm.title",name:"vLLM",descriptionKey:"settings.pages.providers.provider.vllm.description",description:"vllm.ai",iconColor:"i-lobe-icons:vllm",createProvider:e=>A(e.baseUrl.trim()),capabilities:{listModels:async()=>[{id:"llama-2-7b",name:"Llama 2 (7B)",provider:"vllm",description:"Meta's Llama 2 7B parameter model",contextLength:4096},{id:"llama-2-13b",name:"Llama 2 (13B)",provider:"vllm",description:"Meta's Llama 2 13B parameter model",contextLength:4096},{id:"llama-2-70b",name:"Llama 2 (70B)",provider:"vllm",description:"Meta's Llama 2 70B parameter model",contextLength:4096},{id:"mistral-7b",name:"Mistral (7B)",provider:"vllm",description:"Mistral AI's 7B parameter model",contextLength:8192},{id:"mixtral-8x7b",name:"Mixtral (8x7B)",provider:"vllm",description:"Mistral AI's Mixtral 8x7B MoE model",contextLength:32768},{id:"custom",name:"Custom Model",provider:"vllm",description:"Specify a custom model name",contextLength:0}]},validators:{validateProviderConfig:e=>!!e.baseUrl}},openai:{id:"openai",nameKey:"settings.pages.providers.provider.openai.title",name:"OpenAI",descriptionKey:"settings.pages.providers.provider.openai.description",description:"openai.com",icon:"i-lobe-icons:openai",defaultOptions:{baseUrl:"https://api.openai.com/v1/"},createProvider:e=>S(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...S(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"openai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},anthropic:{id:"anthropic",nameKey:"settings.pages.providers.provider.anthropic.title",name:"Anthropic",descriptionKey:"settings.pages.providers.provider.anthropic.description",description:"anthropic.com",icon:"i-lobe-icons:anthropic",defaultOptions:{baseUrl:"https://api.anthropic.com/v1/"},createProvider:e=>ge(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async()=>[{id:"claude-3-7-sonnet-20250219",name:"Claude 3.7 Sonnet",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet (New)",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-5-haiku-20241022",name:"Claude 3.5 Haiku",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-5-sonnet-20240620",name:"Claude 3.5 Sonnet (Old)",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-haiku-20240307",name:"Claude 3 Haiku",provider:"anthropic",description:"",contextLength:0,deprecated:!1},{id:"claude-3-opus-20240229",name:"Claude 3 Opus",provider:"anthropic",description:"",contextLength:0,deprecated:!1}]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"google-generative-ai":{id:"google-generative-ai",nameKey:"settings.pages.providers.provider.google-generative-ai.title",name:"Google Gemini",descriptionKey:"settings.pages.providers.provider.google-generative-ai.description",description:"ai.google.dev",icon:"i-lobe-icons:gemini",defaultOptions:{baseUrl:"https://generativelanguage.googleapis.com/v1beta/openai/"},createProvider:e=>$(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...$(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"google-generative-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},xai:{id:"xai",nameKey:"settings.pages.providers.provider.xai.title",name:"xAI",descriptionKey:"settings.pages.providers.provider.xai.description",description:"x.ai",icon:"i-lobe-icons:xai",createProvider:e=>H(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...H(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"xai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},deepseek:{id:"deepseek",nameKey:"settings.pages.providers.provider.deepseek.title",name:"DeepSeek",descriptionKey:"settings.pages.providers.provider.deepseek.description",description:"deepseek.com",iconColor:"i-lobe-icons:deepseek",createProvider:e=>L(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...L(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"deepseek",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},elevenlabs:{id:"elevenlabs",nameKey:"settings.pages.providers.provider.elevenlabs.title",name:"ElevenLabs",descriptionKey:"settings.pages.providers.provider.elevenlabs.description",description:"elevenlabs.io",icon:"i-simple-icons:elevenlabs",defaultOptions:{baseUrl:"https://unspeech.hyp3r.link/v1/",voiceSettings:{similarityBoost:.75,stability:.5}},createProvider:e=>J(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async()=>he.map(e=>({id:e.model_id,name:e.name,provider:"elevenlabs",description:e.description,contextLength:0,deprecated:!1})),listVoices:async e=>{const r=J(e.apiKey.trim(),e.baseUrl.trim()),l=await E({...r.voice()}),s=l.findIndex(P=>P.name.includes("Aria")),u=l.findIndex(P=>P.name.includes("Bill")),j=s!==-1?s:0,F=u!==-1?u:l.length-1,I=Math.min(j,F),z=Math.max(j,F);return[...l.slice(0,I),...l.slice(z+1),...l.slice(I,z+1)].map(P=>({id:P.id,name:P.name,provider:"elevenlabs",previewURL:P.preview_audio_url,languages:P.languages}))}},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"microsoft-speech":{id:"microsoft-speech",nameKey:"settings.pages.providers.provider.microsoft-speech.title",name:"Microsoft / Azure Speech",descriptionKey:"settings.pages.providers.provider.microsoft-speech.description",description:"speech.microsoft.com",iconColor:"i-lobe-icons:microsoft",defaultOptions:{baseUrl:"https://unspeech.hyp3r.link/v1/"},createProvider:e=>X(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async()=>[{id:"v1",name:"v1",provider:"microsoft-speech",description:"",contextLength:0,deprecated:!1}],listVoices:async e=>{const r=X(e.apiKey.trim(),e.baseUrl.trim());return(await E({...r.voice({region:e.region})})).map(s=>{var u;return{id:s.id,name:s.name,provider:"microsoft-speech",previewURL:s.preview_audio_url,languages:s.languages,gender:(u=s.labels)==null?void 0:u.gender}})}},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"alibaba-cloud-model-studio":{id:"alibaba-cloud-model-studio",nameKey:"settings.pages.providers.provider.alibaba-cloud-model-studio.title",name:"Alibaba Cloud Model Studio",descriptionKey:"settings.pages.providers.provider.alibaba-cloud-model-studio.description",description:"bailian.console.aliyun.com",iconColor:"i-lobe-icons:alibabacloud",defaultOptions:{baseUrl:"https://unspeech.hyp3r.link/v1/"},createProvider:e=>Y(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listVoices:async e=>{const r=Y(e.apiKey.trim(),e.baseUrl.trim());return(await E({...r.voice()})).map(s=>{var u;return{id:s.id,name:s.name,provider:"alibaba-cloud-model-studio",previewURL:s.preview_audio_url,languages:s.languages,gender:(u=s.labels)==null?void 0:u.gender}})},listModels:async()=>[{id:"cozyvoice-v1",name:"CozyVoice",provider:"alibaba-cloud-model-studio",description:"",contextLength:0,deprecated:!1},{id:"cozyvoice-v2",name:"CozyVoice (New)",provider:"alibaba-cloud-model-studio",description:"",contextLength:0,deprecated:!1}]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},volcengine:{id:"volcengine",nameKey:"settings.pages.providers.provider.volcengine.title",name:"settings.pages.providers.provider.volcengine.title",descriptionKey:"settings.pages.providers.provider.volcengine.description",description:"volcengine.com",iconColor:"i-lobe-icons:volcengine",defaultOptions:{baseUrl:"https://unspeech.hyp3r.link/v1/"},createProvider:e=>Q(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listVoices:async e=>{const r=Q(e.apiKey.trim(),e.baseUrl.trim());return(await E({...r.voice()})).map(s=>{var u;return{id:s.id,name:s.name,provider:"volcano-engine",previewURL:s.preview_audio_url,languages:s.languages,gender:(u=s.labels)==null?void 0:u.gender}})},listModels:async()=>[{id:"v1",name:"v1",provider:"volcano-engine",description:"",contextLength:0,deprecated:!1}]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl&&!!e.app&&!!e.app.appId}},"together-ai":{id:"together-ai",nameKey:"settings.pages.providers.provider.together.title",name:"Together.ai",descriptionKey:"settings.pages.providers.provider.together.description",description:"together.ai",iconColor:"i-lobe-icons:together",createProvider:e=>W(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...W(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"together-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"novita-ai":{id:"novita-ai",nameKey:"settings.pages.providers.provider.novita.title",name:"Novita",descriptionKey:"settings.pages.providers.provider.novita.description",description:"novita.ai",iconColor:"i-lobe-icons:novita",createProvider:e=>N(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...N(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"novita-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"fireworks-ai":{id:"fireworks-ai",nameKey:"settings.pages.providers.provider.fireworks.title",name:"Fireworks.ai",descriptionKey:"settings.pages.providers.provider.fireworks.description",description:"fireworks.ai",icon:"i-lobe-icons:fireworks",createProvider:e=>G(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...G(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"fireworks-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"featherless-ai":{id:"featherless-ai",nameKey:"settings.pages.providers.provider.featherless.title",name:"Featherless.ai",descriptionKey:"settings.pages.providers.provider.featherless.description",description:"featherless.ai",icon:"i-lobe-icons:featherless-ai",defaultOptions:{baseUrl:"https://api.featherless.ai/v1/"},createProvider:e=>S(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...S(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"featherless-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"cloudflare-workers-ai":{id:"cloudflare-workers-ai",nameKey:"settings.pages.providers.provider.cloudflare-workers-ai.title",name:"Cloudflare Workers AI",descriptionKey:"settings.pages.providers.provider.cloudflare-workers-ai.description",description:"cloudflare.com",iconColor:"i-lobe-icons:cloudflare",createProvider:e=>_e(e.apiKey.trim(),e.accountId),capabilities:{listModels:async()=>[]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.accountId}},"perplexity-ai":{id:"perplexity-ai",nameKey:"settings.pages.providers.provider.perplexity.title",name:"Perplexity",descriptionKey:"settings.pages.providers.provider.perplexity.description",description:"perplexity.ai",icon:"i-lobe-icons:perplexity",defaultOptions:{baseUrl:"https://api.perplexity.ai"},createProvider:e=>ve(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async()=>[{id:"sonar-small-online",name:"Sonar Small (Online)",provider:"perplexity-ai",description:"Efficient model with online search capabilities",contextLength:12e3},{id:"sonar-medium-online",name:"Sonar Medium (Online)",provider:"perplexity-ai",description:"Balanced model with online search capabilities",contextLength:12e3},{id:"sonar-large-online",name:"Sonar Large (Online)",provider:"perplexity-ai",description:"Powerful model with online search capabilities",contextLength:12e3},{id:"codey-small",name:"Codey Small",provider:"perplexity-ai",description:"Specialized for code generation and understanding",contextLength:12e3},{id:"codey-large",name:"Codey Large",provider:"perplexity-ai",description:"Advanced code generation and understanding",contextLength:12e3}]},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"mistral-ai":{id:"mistral-ai",nameKey:"settings.pages.providers.provider.mistral.title",name:"Mistral",descriptionKey:"settings.pages.providers.provider.mistral.description",description:"mistral.ai",iconColor:"i-lobe-icons:mistral",createProvider:e=>D(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...D(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"mistral-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}},"moonshot-ai":{id:"moonshot-ai",nameKey:"settings.pages.providers.provider.moonshot.title",name:"Moonshot AI",descriptionKey:"settings.pages.providers.provider.moonshot.description",description:"moonshot.ai",icon:"i-lobe-icons:moonshot",createProvider:e=>V(e.apiKey.trim(),e.baseUrl.trim()),capabilities:{listModels:async e=>(await b({...V(e.apiKey.trim(),e.baseUrl.trim()).model()})).map(r=>({id:r.id,name:r.id,provider:"moonshot-ai",description:"",contextLength:0,deprecated:!1}))},validators:{validateProviderConfig:e=>!!e.apiKey&&!!e.baseUrl}}};async function h(e){const r=a.value[e];if(!r)return!1;const l=o[e];return l?await l.validators.validateProviderConfig(r):!1}const t=q({});function n(e){var r;if(!a.value[e]){const l=o[e];a.value[e]={baseUrl:((r=l.defaultOptions)==null?void 0:r.baseUrl)||""}}}Object.keys(o).forEach(n);async function v(){await Promise.all(Object.keys(o).map(async e=>{t.value[e]=await h(e)}))}v(),ce(a,v,{deep:!0});const g=w(()=>Object.keys(o).filter(e=>t.value[e])),c=q({}),y=q({}),x=q({});async function M(e){const r=a.value[e];if(!r)return[];const l=o[e];if(!l)return[];y.value[e]=!0,x.value[e]=null;try{const s=l.capabilities.listModels?await l.capabilities.listModels(r):[];return c.value[e]=s.map(u=>({id:u.id,name:u.name,description:u.description,contextLength:u.contextLength,deprecated:u.deprecated,provider:e})),c.value[e]}catch(s){return console.error(`Error fetching models for ${e}:`,s),x.value[e]=s instanceof Error?s.message:"Unknown error",[]}finally{y.value[e]=!1}}function C(e){return c.value[e]||[]}const B=w(()=>{const e=[];for(const r of g.value)e.push(...c.value[r]||[]);return e});async function ae(){for(const e of g.value)o[e].capabilities.listModels&&await M(e)}function T(e){const r=o[e];if(!r)throw new Error(`Provider metadata for ${e} not found`);return{...r,localizedName:i(r.nameKey,r.name),localizedDescription:i(r.descriptionKey,r.description)}}const ie=w(()=>Object.values(o).map(e=>({...e,localizedName:i(e.nameKey,e.name),localizedDescription:i(e.descriptionKey,e.description),configured:t.value[e.id]||!1})));function O(e){const r=a.value[e];if(!r)throw new Error(`Provider credentials for ${e} not found`);const l=o[e];if(!l)throw new Error(`Provider metadata for ${e} not found`);try{return l.createProvider(r)}catch(s){throw console.error(`Error creating provider instance for ${e}:`,s),s}}const U=w(()=>g.value.map(e=>T(e))),re=w(()=>U.value.filter(e=>{const r=O(e.id);return"chat"in r&&typeof r.chat=="function"})),te=w(()=>U.value.filter(e=>{const r=O(e.id);return"transcription"in r&&typeof r.transcription=="function"})),ne=w(()=>U.value.filter(e=>{const r=O(e.id);return"speech"in r&&typeof r.speech=="function"}));function se(e){return a.value[e]}return{providers:a,getProviderConfig:se,availableProviders:g,configuredProviders:t,providerMetadata:o,getProviderMetadata:T,allProvidersMetadata:ie,initializeProvider:n,validateProvider:h,availableModels:c,isLoadingModels:y,modelLoadError:x,fetchModelsForProvider:M,getModelsForProvider:C,allAvailableModels:B,loadModelsForConfiguredProviders:ae,getProviderInstance:O,availableProvidersMetadata:U,availableTextGenerationsProvidersMetadata:re,availableAudioSpeechProvidersMetadata:ne,availableAudioTranscriptionProvidersMetadata:te}});export{b as l,xe as u}; diff --git a/assets/queue-DpWku5ab.js b/assets/queue-CEzllKo3.js similarity index 91% rename from assets/queue-DpWku5ab.js rename to assets/queue-CEzllKo3.js index 5b2e76e09a809f932f03c01f06d760e19f1ca9a7..ed5ec1ff225959f9f5c721d3ee74b96e7d22e4d7 100644 --- a/assets/queue-DpWku5ab.js +++ b/assets/queue-CEzllKo3.js @@ -1 +1 @@ -import{g as l}from"./index-20XXNHAB.js";function m(f){const t=l([]),a=l(!1),d={add:[],pick:[],processing:[],error:[],processed:[],done:[]},s={};function c(n,e){d[n].push(e)}function r(n,...e){d[n].forEach(i=>{i(...e)})}function h(n,e){s[n]=s[n]||[],s[n].push(e)}function p(n,...e){(s[n]||[]).forEach(i=>{i(...e)})}async function v(n){t.value.push(n),r("add",n)}function g(){const n=t.value.shift();if(n)return r("pick",n),n}async function u(){if(a.value)return;const n=g();if(n){a.value=!0;for(const e of f.handlers){r("processing",n,e);try{const o=await e({data:n,itemsToBeProcessed:()=>t.value.length,emit:p});r("processed",n,o,e)}catch(o){r("error",n,o,e);continue}}a.value=!1,r("done",n),t.value.length>0&&u()}}return c("add",u),c("done",u),{add:v,on:c,onHandlerEvent:h,queue:t}}export{m as u}; +import{g as l}from"./index-D8Nm21zW.js";function m(f){const t=l([]),a=l(!1),d={add:[],pick:[],processing:[],error:[],processed:[],done:[]},s={};function c(n,e){d[n].push(e)}function r(n,...e){d[n].forEach(i=>{i(...e)})}function h(n,e){s[n]=s[n]||[],s[n].push(e)}function p(n,...e){(s[n]||[]).forEach(i=>{i(...e)})}async function v(n){t.value.push(n),r("add",n)}function g(){const n=t.value.shift();if(n)return r("pick",n),n}async function u(){if(a.value)return;const n=g();if(n){a.value=!0;for(const e of f.handlers){r("processing",n,e);try{const o=await e({data:n,itemsToBeProcessed:()=>t.value.length,emit:p});r("processed",n,o,e)}catch(o){r("error",n,o,e);continue}}a.value=!1,r("done",n),t.value.length>0&&u()}}return c("add",u),c("done",u),{add:v,on:c,onHandlerEvent:h,queue:t}}export{m as u}; diff --git a/assets/queue-DbzwV61-.js b/assets/queue-D7nBskKs.js similarity index 90% rename from assets/queue-DbzwV61-.js rename to assets/queue-D7nBskKs.js index 6d2c2af3ed469ab91bf71f7260de9b9631363194..ed2e14bbf6a24cfcaf896277679b8838a7e9439d 100644 --- a/assets/queue-DbzwV61-.js +++ b/assets/queue-D7nBskKs.js @@ -1 +1 @@ -import{u as o}from"./queue-DpWku5ab.js";import{d as v,g as h,l as g,c as k,o as w,a as I}from"./index-20XXNHAB.js";const Q=v({__name:"queue",setup(P){function i(e){return new Promise(a=>setTimeout(a,e))}const n=h(""),d=o({handlers:[async e=>{console.log("ready to play speech audio for",e)}]}),u=o({handlers:[async e=>{console.log("ready to stream speech audio for",e),d.add(e.data)}]}),l=o({handlers:[async e=>{const a=[".","?","!"];let s=!1;for(const t of a){if(!e.data.includes(t))continue;const r=e.data.indexOf(t),p=e.data.slice(0,r+1),y=e.data.slice(r+1);n.value+=p,u.add(n.value.trim()),n.value=y,s=!0}s||(n.value+=e.data)}]}),c=["Hello"," N","eko","! I"," am"," an"," AI"," assistant"," trained"," to"," help"," with"," a"," variety"," of"," tasks"," such"," as"," answering"," questions",","," providing"," information",","," giving"," recommendations",","," and"," more",". How"," can"," I"," assist"," you"," today","?","Hello"," N","eko",","," I"," am"," an"," AI"," assistant","."," I"," can"," help"," answer"," questions",","," provide"," information",","," assist"," with"," tasks",","," and"," engage"," in"," conversation","."," How"," can"," I"," assist"," you"," today","?"];async function f(){for(const e of c)await i(100),l.add(e)}async function m(){f()}return g(()=>{m()}),(e,a)=>(w(),k("div",null,a[0]||(a[0]=[I("div",null,null,-1)])))}});export{Q as default}; +import{u as o}from"./queue-CEzllKo3.js";import{d as v,g as h,l as g,c as k,o as w,a as I}from"./index-D8Nm21zW.js";const Q=v({__name:"queue",setup(P){function i(e){return new Promise(a=>setTimeout(a,e))}const n=h(""),d=o({handlers:[async e=>{console.log("ready to play speech audio for",e)}]}),u=o({handlers:[async e=>{console.log("ready to stream speech audio for",e),d.add(e.data)}]}),l=o({handlers:[async e=>{const a=[".","?","!"];let s=!1;for(const t of a){if(!e.data.includes(t))continue;const r=e.data.indexOf(t),p=e.data.slice(0,r+1),y=e.data.slice(r+1);n.value+=p,u.add(n.value.trim()),n.value=y,s=!0}s||(n.value+=e.data)}]}),c=["Hello"," N","eko","! I"," am"," an"," AI"," assistant"," trained"," to"," help"," with"," a"," variety"," of"," tasks"," such"," as"," answering"," questions",","," providing"," information",","," giving"," recommendations",","," and"," more",". How"," can"," I"," assist"," you"," today","?","Hello"," N","eko",","," I"," am"," an"," AI"," assistant","."," I"," can"," help"," answer"," questions",","," provide"," information",","," assist"," with"," tasks",","," and"," engage"," in"," conversation","."," How"," can"," I"," assist"," you"," today","?"];async function f(){for(const e of c)await i(100),l.add(e)}async function m(){f()}return g(()=>{m()}),(e,a)=>(w(),k("div",null,a[0]||(a[0]=[I("div",null,null,-1)])))}});export{Q as default}; diff --git a/assets/queues-DD-Guues.js b/assets/queues-DD-Guues.js deleted file mode 100644 index 4c8d9369478210654c5ef53f7e40f3373d351172..0000000000000000000000000000000000000000 --- a/assets/queues-DD-Guues.js +++ /dev/null @@ -1 +0,0 @@ -import{j as i}from"./live2d-zip-loader-52aPyiCh.js";import{u as s}from"./queue-DpWku5ab.js";import{g as d}from"./index-20XXNHAB.js";const l="<|llm_inference_end|>";function y(o){function t(e){for(const n of i)if(e.includes(n))return{ok:!0,emotion:n};return{ok:!1,emotion:""}}return s({handlers:[async e=>{if(i.includes(e.data)){e.emit("emotion",e.data),await o.add(e.data);return}{const{ok:n,emotion:a}=t(e.data);n&&(e.emit("emotion",a),await o.add(a))}}]})}function k(){function o(e){if(!/<\|DELAY:\d+\|>/i.test(e))return{ok:!1,delay:0};const n=/<\|DELAY:(\d+)\|>/i.exec(e),a=n==null?void 0:n[1];if(!a)return{ok:!1,delay:0};const r=Number.parseFloat(a);return r<=0||Number.isNaN(r)?{ok:!0,delay:0}:{ok:!0,delay:r}}function t(e){return new Promise(n=>setTimeout(n,e))}return s({handlers:[async e=>{const{ok:n,delay:a}=o(e.data);n&&(e.emit("delay",a),await t(a*1e3))}]})}function p(o){const t=d("");return s({handlers:[async e=>{if(e.data===l){const a=t.value.trim();a&&await o.add(a),t.value="";return}const n=/[.?!]/;for(t.value+=e.data;t.value;){const a=n.exec(t.value);if(!a||typeof a.index>"u")break;const r=t.value.slice(0,a.index+1),u=t.value.slice(a.index+1);await o.add(r),t.value=u}}]})}export{y as a,k as b,l,p as u}; diff --git a/assets/queues-DJEZsGUG.js b/assets/queues-DJEZsGUG.js new file mode 100644 index 0000000000000000000000000000000000000000..cad3a50236521329a24af12ea9f5afc14a311735 --- /dev/null +++ b/assets/queues-DJEZsGUG.js @@ -0,0 +1 @@ +import{j as i}from"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{u as s}from"./queue-CEzllKo3.js";import{g as d}from"./index-D8Nm21zW.js";const l="<|llm_inference_end|>";function y(o){function t(e){for(const n of i)if(e.includes(n))return{ok:!0,emotion:n};return{ok:!1,emotion:""}}return s({handlers:[async e=>{if(i.includes(e.data)){e.emit("emotion",e.data),await o.add(e.data);return}{const{ok:n,emotion:a}=t(e.data);n&&(e.emit("emotion",a),await o.add(a))}}]})}function k(){function o(e){if(!/<\|DELAY:\d+\|>/i.test(e))return{ok:!1,delay:0};const n=/<\|DELAY:(\d+)\|>/i.exec(e),a=n==null?void 0:n[1];if(!a)return{ok:!1,delay:0};const r=Number.parseFloat(a);return r<=0||Number.isNaN(r)?{ok:!0,delay:0}:{ok:!0,delay:r}}function t(e){return new Promise(n=>setTimeout(n,e))}return s({handlers:[async e=>{const{ok:n,delay:a}=o(e.data);n&&(e.emit("delay",a),await t(a*1e3))}]})}function p(o){const t=d("");return s({handlers:[async e=>{if(e.data===l){const a=t.value.trim();a&&await o.add(a),t.value="";return}const n=/[.?!]/;for(t.value+=e.data;t.value;){const a=n.exec(t.value);if(!a||typeof a.index>"u")break;const r=t.value.slice(0,a.index+1),u=t.value.slice(a.index+1);await o.add(r),t.value=u}}]})}export{y as a,k as b,l,p as u}; diff --git a/assets/speech--gNAMctx.js b/assets/speech--gNAMctx.js new file mode 100644 index 0000000000000000000000000000000000000000..5e88b607e5b61c9c4140175204c8af54191e1d81 --- /dev/null +++ b/assets/speech--gNAMctx.js @@ -0,0 +1 @@ +import{d as D,g as V,l as ae,w as X,m as re,c as u,o as i,bx as H,by as K,a as e,n as ve,z as $,bI as W,bJ as Y,A as Q,bA as me,C as P,D as y,b as _,y as I,bn as Z,h as pe,c8 as fe,bE as ne,x as G,q as ge,s as te,H as xe,bw as be,u as t,bo as he,ad as F,bH as ye}from"./index-D8Nm21zW.js";import{_ as se,a as ke}from"./TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js";import{_ as we}from"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import{_ as le}from"./FieldRange.vue_vue_type_script_setup_true_lang-B670Jjy-.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{R as _e,a as Se}from"./RadioCardDetailManySelect-6Dh1XQsR.js";import{_ as Ve}from"./Textarea.vue_vue_type_script_setup_true_lang-CP4Ap1fe.js";import{_ as Me}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import{_ as Ce}from"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import{_ as $e}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";import{u as Pe}from"./providers-DUDq6kdm.js";import{u as Ue,g as Le}from"./speech-B27BwGQ-.js";import{b as oe}from"./route-block-B_A1xBdJ.js";import"./Basic.vue_vue_type_script_setup_true_lang-CrXWH1a1.js";import"./index-Be1NqeGb.js";const qe=D({__name:"AudioSpectrum",props:{stream:null,bars:{default:32},minFreq:{default:60},maxFreq:{default:4e3}},setup(o){const l=o,g=V(Array.from({length:l.bars}).fill(0));ae(()=>{m()}),X(()=>l.stream,()=>{m()});function m(){if(!l.stream)return;const c=new(window.AudioContext||window.webkitAudioContext),f=c.createMediaStreamSource(l.stream),v=c.createAnalyser();v.fftSize=2048,f.connect(v);const b=v.frequencyBinCount,M=new Uint8Array(b),p=c.sampleRate/v.fftSize,k=Math.floor(l.minFreq/p),U=Math.floor(l.maxFreq/p),q=U-k,E=Math.floor(q/l.bars),T=()=>{try{requestAnimationFrame(T),v.getByteFrequencyData(M);const A=Array.from({length:l.bars}).fill(0);for(let z=0;zre(c.$slots,"default",{frequencies:g.value})}}),Ae={"h-full":"",flex:"","items-center":"","gap-1":""},Ee=5,Re=D({__name:"AudioSpectrumVisualizer",props:{frequencies:null,barsClass:null},setup(o){const l=o;function g(c,f){return .1+(1-.1)*(c/f)}function m(c,f){const v=g(f,l.frequencies.length);return Math.min(100,Math.max(10,c*100*Ee*v))}return(c,f)=>(i(),u("div",Ae,[(i(!0),u(H,null,K(o.frequencies,(v,b)=>(i(),u("div",{key:b,"h-full":"",flex:"","flex-1":"","items-end":""},[e("div",{transition:"all 100 ease-in-out","mx-auto":"","my-0":"","w-full":"","rounded-full":"",class:$(o.barsClass),style:ve({height:`${m(v,b)}%`})},null,6)]))),128))]))}}),Te={class:"p-3"},ze={class:"flex items-start"},Be=["checked","name","value"],Fe={class:"relative mr-3 mt-0.5 flex-shrink-0"},Ie={key:0,class:"i-solar:pause-circle-bold-duotone text-xl text-neutral-400 dark:text-neutral-500"},Ne={key:1,class:"i-solar:play-circle-bold-duotone text-xl text-neutral-400 dark:text-neutral-500"},De={key:1,class:"mt-auto w-full flex items-center justify-center bg-neutral-50 py-3 text-xs text-neutral-400 italic dark:bg-neutral-800/50 dark:text-neutral-600"},je={class:"flex-1 cursor-pointer"},Oe={class:"flex items-center"},Qe={key:0,class:"mt-1 flex flex-wrap gap-1"},He={key:1,class:"mt-3"},Je={relative:""},Ge={key:0,class:"h-16 px-3 pb-2"},Ye=D({__name:"VoiceCard",props:W({name:null,voice:null,currentlyPlayingId:null,customInputPlaceholder:{default:"Enter custom voice name"},showVisualizer:{type:Boolean,default:!0},audioStream:{default:null}},{"voice-id":{required:!1,default:""},"voice-idModifiers":{},"custom-voice-name":{required:!1,default:""},"custom-voice-nameModifiers":{}}),emits:W(["togglePlayback"],["update:voice-id","update:custom-voice-name"]),setup(o,{emit:l}){const g=o,m=l,c=Y(o,"voice-id"),f=Y(o,"custom-voice-name");function v(h){return h.previewURL||h.preview_audio_url}function b(h){var k,U,q;const p=[];if((k=h.labels)!=null&&k.gender&&p.push(h.labels.gender),(U=h.labels)!=null&&U.age&&p.push(h.labels.age),(q=h.labels)!=null&&q.accent&&p.push(h.labels.accent),h.languages&&h.languages.length>0){const E=h.languages.map(T=>T.name).join(", ");p.push(E)}return p}function M(){m("togglePlayback",g.voice)}return(h,p)=>(i(),u("label",{border:"2px solid",class:$(["scroll-snap-align-start form_voice-card relative flex flex-col overflow-hidden rounded-xl",[c.value===g.voice.id?"bg-primary-50 dark:bg-primary-900/20 border-primary-100 dark:border-primary-900 hover:border-primary-500/30 dark:hover:border-primary-400/30":"bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30",c.value===g.voice.id?"form_voice-card-active":""]]),transition:"all duration-200 ease-in-out"},[e("div",Te,[e("div",ze,[Q(e("input",{"onUpdate:modelValue":p[0]||(p[0]=k=>c.value=k),checked:c.value===g.voice.id,type:"radio",name:o.name,value:g.voice.id,class:"absolute cursor-pointer opacity-0"},null,8,Be),[[me,c.value]]),e("div",Fe,[e("div",{class:$(["size-5 border-2 rounded-full transition-colors duration-200",[c.value===g.voice.id?"border-primary-500 dark:border-primary-400":"border-neutral-300 dark:border-neutral-600"]])},[e("div",{class:$(["absolute left-1/2 top-1/2 size-3 rounded-full transition-opacity duration-200 -translate-x-1/2 -translate-y-1/2",[c.value===g.voice.id?"opacity-100 bg-primary-500 dark:bg-primary-400":"opacity-0"]])},null,2)],2)]),v(o.voice)?(i(),u("button",{key:0,absolute:"","right-0":"",top:"0","z-100":"",class:$(["translate-x-[-50%] translate-y-[50%]",[o.currentlyPlayingId===o.voice.id?"text-white dark:text-white":""]]),onClick:M},[o.currentlyPlayingId===o.voice.id?(i(),u("div",Ie)):(i(),u("div",Ne))],2)):(i(),u("div",De," No preview available ")),e("div",je,[e("div",Oe,[e("span",{class:$(["line-clamp-1 font-medium",[c.value===o.voice.id?"text-neutral-700 dark:text-neutral-300":"text-neutral-700 dark:text-neutral-400"]])},y(o.voice.name),3)]),b(o.voice).length>0?(i(),u("div",Qe,[(i(!0),u(H,null,K(b(o.voice),(k,U)=>(i(),u("span",{key:U,class:$(["inline-flex items-center rounded-md px-1.5 py-0.5 text-xs",[c.value===o.voice.id?"bg-primary-100 text-primary-700 dark:bg-primary-900/30 dark:text-primary-400":"bg-neutral-100 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300"]])},y(k),3))),128))])):P("",!0),o.voice.customizable&&c.value===o.voice.id?(i(),u("div",He,[_(Ce,{modelValue:f.value,"onUpdate:modelValue":p[1]||(p[1]=k=>f.value=k),type:"text",class:"w-full border border-neutral-300 rounded bg-white px-2 py-1 text-sm dark:border-neutral-700 dark:bg-neutral-900",placeholder:o.customInputPlaceholder},null,8,["modelValue","placeholder"])])):P("",!0),o.voice.description?(i(),u("div",{key:2,class:$(["line-clamp-2 mt-1 text-xs",[c.value===o.voice.id?"text-neutral-600 dark:text-neutral-400":"text-neutral-500 dark:text-neutral-500"]])},y(o.voice.description),3)):P("",!0)])])]),e("div",Je,[_(Me,null,{default:I(()=>[o.showVisualizer&&o.currentlyPlayingId===o.voice.id&&o.audioStream?(i(),u("div",Ge,[_(qe,{stream:o.audioStream,bars:24,"min-freq":60,"max-freq":4e3},{default:I(({frequencies:k})=>[_(Re,{frequencies:k,"bars-class":c.value===o.voice.id?"bg-primary-500 dark:bg-primary-400":"bg-neutral-400 dark:bg-neutral-600"},null,8,["frequencies","bars-class"])]),_:1},8,["stream"])])):P("",!0)]),_:1})])],2))}}),Ke=Z(Ye,[["__scopeId","data-v-dbab964e"]]),We={class:"voice-preview-player"},Xe={key:0,class:"relative","inline-flex":"~","w-full":"","items-center":""},Ze=["placeholder"],et={class:"mt-4 space-y-2"},tt={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},st={key:1,class:"flex items-center gap-3 border border-2 border-amber-200 rounded-xl bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},lt={class:"flex flex-col"},ot={class:"font-medium"},at={class:"text-sm text-amber-600 dark:text-amber-400"},rt={class:"relative"},nt=D({__name:"VoiceCardManySelect",props:W({voices:null,searchable:{type:Boolean,default:!0},searchPlaceholder:{default:"Search voices..."},searchNoResultsTitle:{default:"No voices found"},searchNoResultsDescription:{default:"Try a different search term"},searchResultsText:{default:"{count} of {total} voices"},customInputPlaceholder:{default:"Enter custom voice name"},expandButtonText:{default:"Show more"},collapseButtonText:{default:"Show less"},playButtonText:{default:"Play sample"},pauseButtonText:{default:"Pause"},showVisualizer:{type:Boolean,default:!0}},{"search-query":{required:!1,default:""},"search-queryModifiers":{},"voice-id":{required:!1,default:""},"voice-idModifiers":{}}),emits:["update:search-query","update:voice-id"],setup(o){const l=o,g=V(!1),m=V(),c=V(new Map),f=V(new Map),v=V(new Map),b=V(new Map),M=V(null);function h(){return M.value||(M.value=new(window.AudioContext||window.webkitAudioContext)),M.value}const p=Y(o,"search-query"),k=Y(o,"voice-id"),U=pe(()=>{if(!p.value)return l.voices;const a=p.value.toLowerCase();return l.voices.filter(r=>{const n=r.name.toLowerCase().includes(a),x=r.description&&r.description.toLowerCase().includes(a),w=r.tags&&r.tags.some(S=>S.toLowerCase().includes(a)),L=r.labels&&Object.values(r.labels).some(S=>typeof S=="string"&&S.toLowerCase().includes(a)),C=r.languages&&r.languages.some(S=>S.name.toLowerCase().includes(a)||S.code.toLowerCase().includes(a));return n||x||w||L||C})});function q(a){return a.previewURL||a.preview_audio_url}function E(a){const r=q(a);if(!r)return null;if(c.value.has(a.id))return c.value.get(a.id)||null;const n=new Audio(r);return n.crossOrigin="anonymous",n.preload="auto",n.addEventListener("ended",()=>{if(m.value===a.id){m.value=void 0;const x=f.value.get(a.id);x&&(x.getTracks().forEach(w=>w.stop()),f.value.delete(a.id))}}),c.value.set(a.id,n),n}function T(a,r){try{if(f.value.has(r))return f.value.get(r)||null;const n=h();if(b.value.has(r)){const C=b.value.get(r),S=n.createMediaStreamDestination();C.connect(S);const j=S.stream;return f.value.set(r,j),j}const x=n.createMediaElementSource(a);b.value.set(r,x),x.connect(n.destination);const w=n.createMediaStreamDestination();x.connect(w);const L=w.stream;return f.value.set(r,L),L}catch(n){return console.error("Failed to create audio stream for visualizer:",n),null}}function A(a){try{if(!q(a))return;const n=E(a);if(!n)return;if(m.value===a.id){n.pause(),m.value=void 0;const x=f.value.get(a.id);x&&(x.getTracks().forEach(w=>w.stop()),f.value.delete(a.id));return}if(m.value){const x=c.value.get(m.value);x&&x.pause();const w=f.value.get(m.value);w&&(w.getTracks().forEach(L=>L.stop()),f.value.delete(m.value))}l.showVisualizer&&!f.value.has(a.id)&&T(n,a.id),n.currentTime=0,n.play().catch(x=>{console.error("Failed to play audio:",x)}),m.value=a.id}catch(r){console.error(r),m.value=void 0}}function z(){c.value.forEach(a=>{a.pause(),a.src=""}),c.value.clear(),f.value.forEach(a=>{a.getTracks().forEach(r=>r.stop())}),f.value.clear(),v.value.forEach(a=>{a.state!=="closed"&&a.close()}),v.value.clear(),b.value.clear(),m.value=void 0}X(p,()=>{if(m.value){const a=c.value.get(m.value);a&&a.pause();const r=f.value.get(m.value);r&&(r.getTracks().forEach(n=>n.stop()),f.value.delete(m.value)),m.value=void 0}}),fe(z);const B=V("");return(a,r)=>(i(),u("div",We,[o.searchable?(i(),u("div",Xe,[r[4]||(r[4]=e("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[e("div",{"i-solar:magnifer-line-duotone":"",class:"text-neutral-500 dark:text-neutral-400"})],-1)),Q(e("input",{"onUpdate:modelValue":r[0]||(r[0]=n=>p.value=n),type:"search",class:"w-full rounded-xl p-2.5 pl-10 text-sm outline-none",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",bg:"white dark:neutral-900",placeholder:o.searchPlaceholder},null,8,Ze),[[ne,p.value]])])):P("",!0),e("div",et,[p.value?(i(),u("div",tt,y(o.searchResultsText.replace("{count}",U.value.length.toString()).replace("{total}",o.voices.length.toString())),1)):P("",!0),p.value&&U.value.length===0?(i(),u("div",st,[r[5]||(r[5]=e("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),e("div",lt,[e("span",ot,y(o.searchNoResultsTitle),1),e("span",at,y(o.searchNoResultsDescription.replace("{query}",p.value)),1)])])):P("",!0),e("div",rt,[e("div",{class:$(["scrollbar-hide grid auto-cols-[350px] grid-flow-col max-h-[calc(100dvh-7lh)] gap-4 overflow-x-auto",[g.value?"grid-cols-1 md:grid-cols-2 grid-flow-row auto-cols-auto":""]]),transition:"all duration-200 ease-in-out",style:{"scroll-snap-type":"x mandatory"}},[(i(!0),u(H,null,K(U.value,n=>(i(),G(Ke,{key:n.id,"voice-id":k.value,"onUpdate:voiceId":r[1]||(r[1]=x=>k.value=x),"custom-voice-name":B.value,"onUpdate:customVoiceName":r[2]||(r[2]=x=>B.value=x),name:"voice",voice:n,"currently-playing-id":m.value,"custom-input-placeholder":o.customInputPlaceholder,"show-visualizer":o.showVisualizer,"audio-stream":f.value.get(n.id),onTogglePlayback:A},null,8,["voice-id","custom-voice-name","voice","currently-playing-id","custom-input-placeholder","show-visualizer","audio-stream"]))),128))],2),e("div",{bg:"neutral-100 dark:[rgba(0,0,0,0.3)]","rounded-xl":"",class:$([g.value?"w-full":"mt-4 w-full rounded-lg"])},[e("button",{"w-full":"",flex:"","items-center":"","justify-center":"","gap-2":"","rounded-lg":"","py-2":"",transition:"all duration-200 ease-in-out",class:$([g.value?"bg-primary-500 hover:bg-primary-600 text-white":"bg-white dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800"]),onClick:r[3]||(r[3]=n=>g.value=!g.value)},[e("span",null,y(g.value?o.collapseButtonText:o.expandButtonText),1),e("div",{class:$([g.value?"rotate-180":"","text-lg"]),"i-solar:alt-arrow-down-bold-duotone":"",transition:"transform duration-200 ease-in-out"},null,2)],2)],2)])])]))}}),it=Z(nt,[["__scopeId","data-v-070104a7"]]),ut=D({__name:"Skeleton",props:{animation:{default:"pulse"}},setup(o){const l=o;return(g,m)=>(i(),u("div",{class:$(["skeleton",l.animation!=="none"?`skeleton-${l.animation}`:""]),bg:"neutral-200 dark:neutral-800",overflow:"hidden"},[re(g.$slots,"default",{},void 0,!0)],2))}}),O=Z(ut,[["__scopeId","data-v-f404da2a"]]),dt={flex:"~ col md:row gap-6"},ct={bg:"neutral-100 dark:[rgba(0,0,0,0.3)]","rounded-xl":"","p-4":"",flex:"~ col gap-4",class:"w-full md:w-[40%]"},vt={flex:"~ col gap-4"},mt={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},pt={text:"neutral-400 dark:neutral-500"},ft={"max-w-full":""},gt={key:0,flex:"~ row gap-4",style:{"scrollbar-width":"none"},"min-w-0":"","of-x-scroll":"","scroll-smooth":"",role:"radiogroup"},xt={key:1},bt={key:0},ht={flex:"~ col gap-4"},yt={class:"text-lg md:text-2xl"},kt={text:"neutral-400 dark:neutral-400"},wt={key:0,class:"flex items-center justify-center py-4"},_t={key:1,class:"flex items-center gap-3 border border-red-200 rounded-lg bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"},St={class:"flex flex-col"},Vt={class:"font-medium"},Mt={class:"text-sm text-red-600 dark:text-red-400"},Ct={key:2,class:"flex items-center gap-3 border border-amber-200 rounded-lg bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},$t={class:"flex flex-col"},Pt={class:"font-medium"},Ut={class:"text-sm text-amber-600 dark:text-amber-400"},Lt={key:0},qt={flex:"~ col gap-4"},At={key:0},Et={class:"flex flex-col gap-4"},Rt={flex:"~ row gap-4"},Tt={key:1,class:"space-y-6"},zt={key:2,class:"flex items-center gap-3 border border-2 border-red-200 rounded-lg bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"},Bt={class:"flex flex-col"},Ft={class:"text-sm text-red-600 dark:text-red-400"},It={key:3,class:"flex items-center gap-3 border border-2 border-amber-200 rounded-lg bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},Nt={flex:"~ col gap-4"},Dt={key:4,class:"mt-2 space-y-6"},jt={key:0},Ot={flex:"~ col gap-4"},Qt={flex:"~ col gap-6",class:"w-full md:w-[60%]"},Ht={"w-full":"","rounded-xl":""},Jt={class:"mb-4 text-lg text-neutral-500 md:text-2xl dark:text-neutral-400","w-full":""},Gt={class:"inline-flex items-center gap-4"},Yt={flex:"~ col gap-4"},Kt={flex:"~ row","gap-4":""},Wt=["disabled"],Xt={flex:"~ row","items-center":"","gap-2":""},Zt=["src"],es={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},ts=D({__name:"speech",setup(o){const{t:l}=ge(),g=Pe(),m=Ue(),{availableProviders:c,availableAudioSpeechProvidersMetadata:f}=te(g),{activeSpeechProvider:v,activeSpeechModel:b,activeSpeechVoice:M,activeSpeechVoiceId:h,pitch:p,isLoadingSpeechProviderVoices:k,supportsModelListing:U,providerModels:q,isLoadingActiveProviderModels:E,activeProviderModelError:T,modelSearchQuery:A,speechProviderError:z,ssmlEnabled:B,availableVoices:a}=te(m),r=V(""),n=V(!1),x=V("Hello, my name is AI Assistant"),w=V(""),L=V(!1),C=V(""),S=V(null),j=V("");ae(async()=>{await m.loadVoicesForProvider(v.value),await g.loadModelsForConfiguredProviders()}),X(v,async()=>{await m.loadVoicesForProvider(v.value),await g.loadModelsForConfiguredProviders()});async function ie(){if(!x.value.trim()&&!n.value||n.value&&!w.value.trim())return;if(!b.value){console.error("No model selected");return}if(!M.value){console.error("No voice selected");return}const R=g.getProviderInstance(v.value);if(!R){console.error("Failed to initialize speech provider");return}const s=g.getProviderConfig(v.value);L.value=!0,j.value="";try{C.value&&ee();const N=n.value?w.value:m.generateSSML(x.value,M.value,{...s,pitch:p.value}),J=await Le({...R.speech(b.value,s),input:N,voice:M.value.id});C.value=URL.createObjectURL(new Blob([J])),setTimeout(()=>{S.value&&S.value.play()},100)}catch(N){console.error("Error generating speech:",N),j.value=N instanceof Error?N.message:"An unknown error occurred"}finally{L.value=!1}}function ee(){S.value&&(S.value.pause(),S.value.currentTime=0),C.value&&(URL.revokeObjectURL(C.value),C.value="")}xe(()=>{C.value&&URL.revokeObjectURL(C.value)});function ue(R){M.value={id:R,name:R,description:R,previewURL:R,languages:[{code:"en",title:"English"}],provider:v.value,gender:"male"}}function de(R){b.value=R}return(R,s)=>{var J;const N=be("motion");return i(),u(H,null,[_(t($e),{title:t(l)("settings.pages.modules.speech.title"),subtitle:t(l)("settings.pages.modules.title")},null,8,["title","subtitle"]),e("div",dt,[e("div",ct,[e("div",null,[e("div",vt,[e("div",null,[e("h2",mt,y(t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.title")),1),e("div",pt,[e("span",null,y(t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.description")),1)])]),e("div",ft,[t(c).length>0?(i(),u("fieldset",gt,[(i(!0),u(H,null,K(t(f),d=>(i(),G(t(Se),{id:d.id,key:d.id,modelValue:t(v),"onUpdate:modelValue":s[0]||(s[0]=ce=>F(v)?v.value=ce:null),name:"speech-provider",value:d.id,title:d.localizedName,description:d.localizedDescription},null,8,["id","modelValue","value","title","description"]))),128))])):(i(),u("div",xt,[_(t(he),{class:"flex items-center gap-3 rounded-lg p-4",border:"2 dashed neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-800",transition:"colors duration-200 ease-in-out",to:"/settings/providers"},{default:I(()=>s[13]||(s[13]=[e("div",{"i-solar:warning-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1),e("div",{class:"flex flex-col"},[e("span",{class:"font-medium"},"No Speech Providers Configured"),e("span",{class:"text-sm text-neutral-400 dark:text-neutral-500"},"Click here to set up your speech providers")],-1),e("div",{"i-solar:arrow-right-line-duotone":"",class:"ml-auto text-xl text-neutral-400 dark:text-neutral-500"},null,-1)])),_:1})]))])]),e("div",null,[t(v)&&t(U)?(i(),u("div",bt,[e("div",ht,[e("div",null,[e("h2",yt,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.title")),1),e("div",kt,[e("span",null,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.subtitle")),1)])]),t(E)?(i(),u("div",wt,[s[14]||(s[14]=e("div",{class:"mr-2 animate-spin"},[e("div",{"i-solar:spinner-line-duotone":"","text-xl":""})],-1)),e("span",null,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.loading")),1)])):t(T)?(i(),u("div",_t,[s[15]||(s[15]=e("div",{"i-solar:close-circle-line-duotone":"",class:"text-2xl text-red-500 dark:text-red-400"},null,-1)),e("div",St,[e("span",Vt,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.error")),1),e("span",Mt,y(t(T)),1)])])):t(q).length===0&&!t(E)?(i(),u("div",Ct,[s[16]||(s[16]=e("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),e("div",$t,[e("span",Pt,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_models")),1),e("span",Ut,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_models_description")),1)])])):t(q).length>0?(i(),G(t(_e),{key:3,modelValue:t(b),"onUpdate:modelValue":s[1]||(s[1]=d=>F(b)?b.value=d:null),"search-query":t(A),"onUpdate:searchQuery":s[2]||(s[2]=d=>F(A)?A.value=d:null),items:t(q),searchable:!0,"search-placeholder":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.search_placeholder"),"search-no-results-title":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_search_results"),"search-no-results-description":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_search_results_description",{query:t(A)}),"search-results-text":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.search_results",{count:"{count}",total:"{total}"}),"custom-input-placeholder":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.custom_model_placeholder"),"expand-button-text":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.expand"),"collapse-button-text":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.collapse"),"onUpdate:customValue":de},null,8,["modelValue","search-query","items","search-placeholder","search-no-results-title","search-no-results-description","search-results-text","custom-input-placeholder","expand-button-text","collapse-button-text"])):P("",!0)])])):P("",!0)])]),t(v)?(i(),u("div",Lt,[e("div",qt,[s[27]||(s[27]=e("div",null,[e("h2",{class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"}," Voice Configuration "),e("div",{text:"neutral-400 dark:neutral-500"},[e("span",null,"Customize how your AI assistant speaks")])],-1)),t(k)?(i(),u("div",At,[e("div",Et,[_(t(O),{class:"w-full rounded-lg p-2.5 text-sm"},{default:I(()=>s[17]||(s[17]=[e("div",{class:"h-1lh"},null,-1)])),_:1}),e("div",Rt,[_(t(O),{class:"w-full rounded-lg p-4 text-sm"},{default:I(()=>s[18]||(s[18]=[e("div",{class:"h-1lh"},null,-1)])),_:1}),_(t(O),{class:"w-full rounded-lg p-4 text-sm"},{default:I(()=>s[19]||(s[19]=[e("div",{class:"h-1lh"},null,-1)])),_:1}),_(t(O),{class:"w-full rounded-lg p-4 text-sm"},{default:I(()=>s[20]||(s[20]=[e("div",{class:"h-1lh"},null,-1)])),_:1})]),_(t(O),{class:"w-full rounded-lg p-3 text-sm"},{default:I(()=>s[21]||(s[21]=[e("div",{class:"h-1lh"},null,-1)])),_:1})])])):t(a)[t(v)]&&t(a)[t(v)].length>0?(i(),u("div",Tt,[_(t(it),{"search-query":r.value,"onUpdate:searchQuery":s[3]||(s[3]=d=>r.value=d),"voice-id":t(h),"onUpdate:voiceId":s[4]||(s[4]=d=>F(h)?h.value=d:null),voices:(J=t(a)[t(v)])==null?void 0:J.map(d=>({id:d.id,name:d.name,description:d.description,previewURL:d.previewURL,customizable:!1})),searchable:!0,"search-placeholder":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.search_voices_placeholder"),"search-no-results-title":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.no_voices"),"search-no-results-description":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.no_voices_description"),"search-results-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.search_voices_results",{count:0,total:0}),"custom-input-placeholder":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.custom_voice_placeholder"),"expand-button-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.show_more"),"collapse-button-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.show_less"),"play-button-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.play_sample"),"pause-button-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.pause"),"onUpdate:customValue":ue},null,8,["search-query","voice-id","voices","search-placeholder","search-no-results-title","search-no-results-description","search-results-text","custom-input-placeholder","expand-button-text","collapse-button-text","play-button-text","pause-button-text"])])):t(z)?(i(),u("div",zt,[s[23]||(s[23]=e("div",{"i-solar:close-circle-line-duotone":"",class:"text-2xl text-red-500 dark:text-red-400"},null,-1)),e("div",Bt,[s[22]||(s[22]=e("span",{class:"font-medium"},"Error loading voices",-1)),e("span",Ft,y(t(z)),1)])])):(i(),u("div",It,s[24]||(s[24]=[e("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1),e("div",{class:"flex flex-col"},[e("span",{class:"font-medium"},"No voices available"),e("span",{class:"text-sm text-amber-600 dark:text-amber-400"}," No voices were found for this provider. You can enter a custom voice name below. ")],-1)]))),e("div",Nt,[_(t(le),{modelValue:t(p),"onUpdate:modelValue":s[5]||(s[5]=d=>F(p)?p.value=d:null),label:"Pitch",description:"Tune the pitch of the voice",min:-100,max:100,step:1,"format-value":d=>`${d}%`},null,8,["modelValue","format-value"]),_(t(se),{modelValue:t(B),"onUpdate:modelValue":s[6]||(s[6]=d=>F(B)?B.value=d:null),label:"Enable SSML",description:"Enable Speech Synthesis Markup Language for more control over speech output"},null,8,["modelValue"])]),!t(a)[t(v)]||t(a)[t(v)].length===0?(i(),u("div",Dt,[_(t(we),{modelValue:t(h),"onUpdate:modelValue":s[7]||(s[7]=d=>F(h)?h.value=d:null),type:"text",label:"Voice ID",description:"Enter the voice ID for your custom voice",placeholder:"Enter voice name (e.g., 'Rachel', 'Josh')"},null,8,["modelValue"]),t(v)==="elevenlabs"?(i(),u("div",jt,[s[26]||(s[26]=e("label",{class:"mb-1 block text-sm font-medium"}," Model ",-1)),Q(e("select",{"onUpdate:modelValue":s[8]||(s[8]=d=>F(b)?b.value=d:null),class:"w-full border border-neutral-300 rounded bg-white px-3 py-2 dark:border-neutral-700 dark:bg-neutral-900"},s[25]||(s[25]=[e("option",{value:"eleven_monolingual_v1"}," Monolingual v1 ",-1),e("option",{value:"eleven_multilingual_v1"}," Multilingual v1 ",-1),e("option",{value:"eleven_multilingual_v2"}," Multilingual v2 ",-1)]),512),[[ye,t(b)]])])):P("",!0),e("div",Ot,[_(t(le),{modelValue:t(p),"onUpdate:modelValue":s[9]||(s[9]=d=>F(p)?p.value=d:null),label:"Pitch",description:"Tune the pitch of the voice",min:-100,max:100,step:1,"format-value":d=>`${d}%`},null,8,["modelValue","format-value"])])])):P("",!0)])])):P("",!0)]),e("div",Qt,[e("div",Ht,[e("h2",Jt,[e("div",Gt,[_(t(ke)),e("div",null,y(t(l)("settings.pages.providers.provider.elevenlabs.playground.title")),1)])]),e("div",Yt,[_(t(se),{modelValue:n.value,"onUpdate:modelValue":s[10]||(s[10]=d=>n.value=d),label:"Use Custom SSML",description:"Enable to input raw SSML instead of plain text"},null,8,["modelValue"]),n.value?Q((i(),u("textarea",{key:1,"onUpdate:modelValue":s[12]||(s[12]=d=>w.value=d),placeholder:"Enter SSML text...",border:"neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700",transition:"all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900","h-48":"","w-full":"","rounded-lg":"","px-3":"","py-2":"","text-sm":"","font-mono":"","outline-none":""},null,512)),[[ne,w.value]]):(i(),G(t(Ve),{key:0,modelValue:x.value,"onUpdate:modelValue":s[11]||(s[11]=d=>x.value=d),"h-24":"","w-full":"",placeholder:t(l)("settings.pages.providers.provider.elevenlabs.playground.fields.field.input.placeholder")},null,8,["modelValue","placeholder"])),e("div",Kt,[e("button",{border:"neutral-800 dark:neutral-200 solid 2",transition:"border duration-250 ease-in-out","rounded-lg":"","px-4":"",text:"neutral-100 dark:neutral-900","py-2":"","text-sm":"",disabled:L.value||!x.value.trim()&&!n.value||n.value&&!w.value.trim()||!t(M),class:$({"opacity-50 cursor-not-allowed":L.value||!x.value.trim()&&!n.value||n.value&&!w.value.trim()||!t(M)}),bg:"neutral-700 dark:neutral-300",onClick:ie},[e("div",Xt,[s[28]||(s[28]=e("div",{"i-solar:play-circle-bold-duotone":""},null,-1)),e("span",null,y(L.value?t(l)("settings.pages.providers.provider.elevenlabs.playground.buttons.button.test-voice.generating"):t(l)("settings.pages.providers.provider.elevenlabs.playground.buttons.button.test-voice.label")),1)])],10,Wt),C.value?(i(),u("button",{key:0,border:"primary-300 dark:primary-800 solid 2",transition:"border duration-250 ease-in-out","rounded-lg":"","px-4":"","py-2":"","text-sm":"",onClick:ee},s[29]||(s[29]=[e("div",{flex:"~ row","items-center":"","gap-2":""},[e("div",{"i-solar:stop-circle-bold-duotone":""}),e("span",null,"Stop")],-1)]))):P("",!0)]),C.value?(i(),u("audio",{key:2,ref_key:"audioPlayer",ref:S,src:C.value,controls:"",class:"mt-2 w-full"},null,8,Zt)):P("",!0)])])])]),Q((i(),u("div",es,s[30]||(s[30]=[e("div",{text:"60","i-solar:user-speak-rounded-bold-duotone":""},null,-1)]))),[[N]])],64)}}});typeof oe=="function"&&oe(ts);export{ts as default}; diff --git a/assets/speech-CF8Au8j4.js b/assets/speech-B27BwGQ-.js similarity index 98% rename from assets/speech-CF8Au8j4.js rename to assets/speech-B27BwGQ-.js index 066b66e5b346e4b358156cdc4da42b713164280e..55fb2e296653b8b0f5d839af7dd2c1b84ceac594 100644 --- a/assets/speech-CF8Au8j4.js +++ b/assets/speech-B27BwGQ-.js @@ -1,2 +1,2 @@ -import{f as te,bD as f,g as b,h as p,w as P,l as re}from"./index-20XXNHAB.js";import{r as ne,a as ae,b as oe,d as se}from"./index-Be1NqeGb.js";import{u as ce}from"./providers-BqZLRXH1.js";const ie=async e=>(e.fetch??globalThis.fetch)(ne("audio/speech",e.baseURL),{body:oe(e),headers:ae({"Content-Type":"application/json",...e.headers},e.apiKey),method:"POST",signal:e.abortSignal}).then(se).then(async t=>t.arrayBuffer()),ue=/["&'<>`]/g,le=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,de=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,me=/[|\\{}()[\]^$+*?.]/g,U=new WeakMap;function N(e,t){if(e=e.replace(t.subset?ge(t.subset):ue,n),t.subset||t.escapeOnly)return e;return e.replace(le,r).replace(de,n);function r(a,s,l){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,l.charCodeAt(s+2),t)}function n(a,s,l){return t.format(a.charCodeAt(0),l.charCodeAt(s+1),t)}}function ge(e){let t=U.get(e);return t||(t=fe(e),U.set(e,t)),t}function fe(e){const t=[];let r=-1;for(;++r",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:"€"},Se=["cent","copy","divide","gt","lt","not","para","times"],j={}.hasOwnProperty,L={};let S;for(S in C)j.call(C,S)&&(L[C[S]]=S);const xe=/[^\dA-Za-z]/;function Ee(e,t,r,n){const a=String.fromCharCode(e);if(j.call(L,a)){const s=L[a],l="&"+s;return r&&be.includes(s)&&!Se.includes(s)&&(!n||t&&t!==61&&xe.test(String.fromCharCode(t)))?l:l+";"}return""}function we(e,t,r){let n=he(e,t,r.omitOptionalSemicolons),a;if((r.useNamedReferences||r.useShortestReferences)&&(a=Ee(e,t,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!a)&&r.useShortestReferences){const s=ye(e,t,r.omitOptionalSemicolons);s.length/g,Te=[">"];function Le(e){return""}function Me(e){return""}const Re=[" ",` +import{f as te,bD as f,g as b,h as p,w as P,l as re}from"./index-D8Nm21zW.js";import{r as ne,a as ae,b as oe,d as se}from"./index-Be1NqeGb.js";import{u as ce}from"./providers-DUDq6kdm.js";const ie=async e=>(e.fetch??globalThis.fetch)(ne("audio/speech",e.baseURL),{body:oe(e),headers:ae({"Content-Type":"application/json",...e.headers},e.apiKey),method:"POST",signal:e.abortSignal}).then(se).then(async t=>t.arrayBuffer()),ue=/["&'<>`]/g,le=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,de=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,me=/[|\\{}()[\]^$+*?.]/g,U=new WeakMap;function N(e,t){if(e=e.replace(t.subset?ge(t.subset):ue,n),t.subset||t.escapeOnly)return e;return e.replace(le,r).replace(de,n);function r(a,s,l){return t.format((a.charCodeAt(0)-55296)*1024+a.charCodeAt(1)-56320+65536,l.charCodeAt(s+2),t)}function n(a,s,l){return t.format(a.charCodeAt(0),l.charCodeAt(s+1),t)}}function ge(e){let t=U.get(e);return t||(t=fe(e),U.set(e,t)),t}function fe(e){const t=[];let r=-1;for(;++r",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:"€"},Se=["cent","copy","divide","gt","lt","not","para","times"],j={}.hasOwnProperty,L={};let S;for(S in C)j.call(C,S)&&(L[C[S]]=S);const xe=/[^\dA-Za-z]/;function Ee(e,t,r,n){const a=String.fromCharCode(e);if(j.call(L,a)){const s=L[a],l="&"+s;return r&&be.includes(s)&&!Se.includes(s)&&(!n||t&&t!==61&&xe.test(String.fromCharCode(t)))?l:l+";"}return""}function we(e,t,r){let n=he(e,t,r.omitOptionalSemicolons),a;if((r.useNamedReferences||r.useShortestReferences)&&(a=Ee(e,t,r.omitOptionalSemicolons,r.attribute)),(r.useShortestReferences||!a)&&r.useShortestReferences){const s=ye(e,t,r.omitOptionalSemicolons);s.length/g,Te=[">"];function Le(e){return""}function Me(e){return""}const Re=[" ",` `," ",'"',"&","'","/","<","=",">"];function x(e){return y(e,Re)}function F(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,a=r.indexOf(t);for(;a!==-1;)n++,a=r.indexOf(t,a+t.length);return n}function M(e,t){const r=String(e);let n=t.options.quote||'"';if(t.options.quoteSmart){const a=n==='"'?"'":'"';F(r,n)>F(r,a)&&(n=a)}return n+y(r,["<","&",n])+n}function $e(e,t){const r=x(e.name),n=e.public,a=e.system;let s=""}const Ue={}.hasOwnProperty;function Fe(e,t){const r=x(e.name),n=k(e,t),a=e.attributes||{},s=n?!1:t.options.closeEmptyElements,l=[];let h;for(h in a)if(Ue.call(a,h)){const g=a[h];g!=null&&l.push(x(h)+"="+M(g,t))}return"<"+r+(l.length===0?"":" "+l.join(" "))+(s?(t.options.tightClose?"":" ")+"/":"")+">"+n+(s?"":"")}const De=/\?>/g,Ne=[">"];function je(e){const t=x(e.name)||"x",r=y(e.value,Ne,De);return""}const Ie=["&","<"];function I(e){return y(e.value,Ie)}function ze(e,t){return t.options.allowDangerousXml?e.value:I(e)}const ke={}.hasOwnProperty,D={cdata:Le,comment:Me,doctype:$e,element:Fe,instruction:je,raw:ze,root:k,text:I};function z(e,t){const r=e&&e.type;if(!r)throw new Error("Expected node, not `"+e+"`");if(!ke.call(D,r))throw new Error("Cannot compile unknown node `"+r+"`");const n=D[r];return n(e,t)}function k(e,t){const r=e&&e.children||[];let n=-1;const a=[];for(;++n{const e=ce(),t=f("settings/speech/active-provider",""),r=f("settings/speech/active-model","eleven_multilingual_v2"),n=f("settings/speech/voice",""),a=b(),s=f("settings/speech/pitch",0),l=f("settings/speech/rate",1),h=f("settings/speech/ssml-enabled",!1),g=b(!1),E=b(null),v=b({}),B=f("settings/speech/language","en-US"),w=b(""),H=p(()=>e.availableProviders.filter(o=>O(o)).map(o=>e.getProviderMetadata(o))),V=p(()=>{var o;return((o=e.getProviderMetadata(t.value))==null?void 0:o.capabilities.listModels)!==void 0}),A=p(()=>e.getModelsForProvider(t.value)),Y=p(()=>e.isLoadingModels[t.value]||!1),X=p(()=>e.modelLoadError[t.value]||null),G=p(()=>{if(!w.value.trim())return A.value;const o=w.value.toLowerCase().trim();return A.value.filter(c=>c.name.toLowerCase().includes(o)||c.id.toLowerCase().includes(o)||c.description&&c.description.toLowerCase().includes(o))}),_=p(()=>["elevenlabs","microsoft-speech","azure-speech","google","alibaba-cloud-model-studio","volcengine"].includes(t.value));function O(o){return["elevenlabs","microsoft-speech","azure-speech","google","amazon","alibaba-cloud-model-studio","volcengine"].includes(o)}async function q(o){var c,i;if(!o||!O(o))return[];g.value=!0,E.value=null;try{const u=await((i=(c=e.getProviderMetadata(o).capabilities).listVoices)==null?void 0:i.call(c,e.getProviderConfig(o)))||[];return v.value[o]=u,u}catch(u){return console.error(`Error fetching voices for ${o}:`,u),E.value=u instanceof Error?u.message:"Unknown error",[]}finally{g.value=!1}}function K(o){return v.value[o]||[]}P(t,async o=>{o&&await q(o)}),re(()=>{q(t.value).then(()=>{var o;n.value&&(a.value=(o=v.value[t.value])==null?void 0:o.find(c=>c.id===n.value))})}),P(n,o=>{var c;o&&(a.value=(c=v.value[t.value])==null?void 0:c.find(i=>i.id===o))},{immediate:!0}),P(v,o=>{var c;n.value&&(a.value=(c=o[t.value])==null?void 0:c.find(i=>i.id===n.value))},{immediate:!0});async function Q(o,c,i,u,m={}){return await ie({...o.speech(c,{...m}),input:i,voice:u})}function Z(o,c,i){var $;const u=i==null?void 0:i.pitch,m=i==null?void 0:i.speed,d=i==null?void 0:i.volume,W={pitch:u!=null?u>0?`+${u}%`:`-${u}%`:void 0,rate:m!=null?m!==1?`${m}`:"1":void 0,volume:d!=null?d>0?`+${d}%`:`${d}%`:void 0},J=T("speak",{version:"1.0",xmlns:"http://www.w3.org/2001/10/synthesis","xml:lang":(($=c.languages[0])==null?void 0:$.code)||"en-US"},[T("voice",{name:c.id,gender:c.gender||"neutral"},[Object.entries(W).filter(([Ve,ee])=>ee!=null).length>0?T("prosody",{pitch:u!=null?u>0?`+${u}%`:`-${u}%`:void 0,rate:m!=null?m!==1?`${m}`:"1":void 0,volume:d!=null?d>0?`+${d}%`:`${d}%`:void 0},[o]):o])]);return Be(J)}return{activeSpeechProvider:t,activeSpeechModel:r,activeSpeechVoice:a,activeSpeechVoiceId:n,pitch:s,rate:l,ssmlEnabled:h,selectedLanguage:B,isLoadingSpeechProviderVoices:g,speechProviderError:E,availableVoices:v,modelSearchQuery:w,availableSpeechProvidersMetadata:H,supportsSSML:_,supportsModelListing:V,providerModels:A,isLoadingActiveProviderModels:Y,activeProviderModelError:X,filteredModels:G,speech:Q,loadVoicesForProvider:q,getVoicesForProvider:K,generateSSML:Z,isSpeechProvider:O}});export{F as c,ie as g,_e as s,Ke as u}; diff --git a/assets/speech-Hr-CnTW2.css b/assets/speech-Hr-CnTW2.css deleted file mode 100644 index aa11d16d771532be7dc20178b5e0e664ddaf5f09..0000000000000000000000000000000000000000 --- a/assets/speech-Hr-CnTW2.css +++ /dev/null @@ -1 +0,0 @@ -.form_voice-card[data-v-dbab964e]{position:relative;overflow:hidden;display:flex;flex-direction:column}.form_voice-card[data-v-dbab964e]:before{pointer-events:none;--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .35s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .form_voice-card[data-v-dbab964e]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.form_voice-card[data-v-dbab964e]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .form_voice-card[data-v-dbab964e]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}input[type=search][data-v-070104a7]::-webkit-search-cancel-button{display:none}.voice-card[data-v-070104a7]{position:relative;overflow:hidden;display:flex;flex-direction:column}.voice-card[data-v-070104a7]:before{pointer-events:none;--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;width:25%;height:100%;transition:all .35s ease-in-out;-webkit-mask-image:linear-gradient(120deg,#fff);mask-image:linear-gradient(120deg,#fff);opacity:0}.dark .voice-card[data-v-070104a7]:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-from-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position)}.voice-card[data-v-070104a7]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(62% var(--theme-colors-chroma) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position);--un-gradient-shape:to right in oklch;--un-gradient:var(--un-gradient-shape), var(--un-gradient-stops);background-image:linear-gradient(var(--un-gradient));width:85%;opacity:1}.dark .voice-card[data-v-070104a7]:hover:before{--un-gradient-from-position:0%;--un-gradient-from:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .2) var(--un-gradient-from-position);--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0) var(--un-gradient-to-position);--un-gradient-stops:var(--un-gradient-from), var(--un-gradient-to);--un-gradient-via-position:50%;--un-gradient-to:oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / 0);--un-gradient-stops:var(--un-gradient-from), oklch(74% var(--theme-colors-chroma-400) calc(var(--theme-colors-hue) + 0) / .1) var(--un-gradient-via-position), var(--un-gradient-to);--un-gradient-to-position:100%;--un-gradient-to:transparent var(--un-gradient-to-position)}.skeleton[data-v-f404da2a]{position:relative;transition:all .2s ease-in-out}.skeleton-pulse[data-v-f404da2a]{animation:skeleton-pulse-f404da2a 1.5s ease-in-out .5s infinite}@keyframes skeleton-pulse-f404da2a{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.skeleton-wave[data-v-f404da2a]:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;transform:translate(-100%);background:linear-gradient(90deg,transparent,rgba(255,255,255,.2),transparent);animation:skeleton-wave-f404da2a 1.5s infinite;border-radius:inherit}.dark .skeleton-wave[data-v-f404da2a]:after{background:linear-gradient(90deg,transparent,rgba(255,255,255,.1),transparent)}@keyframes skeleton-wave-f404da2a{0%{transform:translate(-100%)}60%{transform:translate(100%)}to{transform:translate(100%)}} diff --git a/assets/speech-xpntho9b.js b/assets/speech-xpntho9b.js deleted file mode 100644 index ca7dc1e4a0d815db540640dca52a5ea2fbea7ea6..0000000000000000000000000000000000000000 --- a/assets/speech-xpntho9b.js +++ /dev/null @@ -1 +0,0 @@ -import{d as D,g as V,l as ae,w as X,m as re,c as u,o as i,bx as H,by as K,a as e,n as ve,z as $,bI as W,bJ as Y,A as Q,bA as me,C as P,D as y,b as _,y as I,bn as Z,h as pe,c8 as fe,bE as ne,x as G,q as ge,s as te,H as xe,bw as be,u as t,bo as he,ad as F,bH as ye}from"./index-20XXNHAB.js";import{_ as se,a as ke}from"./TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js";import{_ as we}from"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import{_ as le}from"./FieldRange.vue_vue_type_script_setup_true_lang-BtFz1_fe.js";import{R as _e,a as Se}from"./RadioCardDetailManySelect-CYbSNUGq.js";import{_ as Ve}from"./Textarea.vue_vue_type_script_setup_true_lang-BPvpJbgL.js";import{_ as Me}from"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import{_ as Ce}from"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import{_ as $e}from"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as Pe}from"./providers-BqZLRXH1.js";import{u as Ue,g as Le}from"./speech-CF8Au8j4.js";import{b as oe}from"./route-block-B_A1xBdJ.js";import"./Basic.vue_vue_type_script_setup_true_lang-0-fw0xSa.js";import"./index-Be1NqeGb.js";const qe=D({__name:"AudioSpectrum",props:{stream:null,bars:{default:32},minFreq:{default:60},maxFreq:{default:4e3}},setup(o){const l=o,g=V(Array.from({length:l.bars}).fill(0));ae(()=>{m()}),X(()=>l.stream,()=>{m()});function m(){if(!l.stream)return;const c=new(window.AudioContext||window.webkitAudioContext),f=c.createMediaStreamSource(l.stream),v=c.createAnalyser();v.fftSize=2048,f.connect(v);const b=v.frequencyBinCount,M=new Uint8Array(b),p=c.sampleRate/v.fftSize,k=Math.floor(l.minFreq/p),U=Math.floor(l.maxFreq/p),q=U-k,E=Math.floor(q/l.bars),T=()=>{try{requestAnimationFrame(T),v.getByteFrequencyData(M);const A=Array.from({length:l.bars}).fill(0);for(let z=0;zre(c.$slots,"default",{frequencies:g.value})}}),Ae={"h-full":"",flex:"","items-center":"","gap-1":""},Ee=5,Re=D({__name:"AudioSpectrumVisualizer",props:{frequencies:null,barsClass:null},setup(o){const l=o;function g(c,f){return .1+(1-.1)*(c/f)}function m(c,f){const v=g(f,l.frequencies.length);return Math.min(100,Math.max(10,c*100*Ee*v))}return(c,f)=>(i(),u("div",Ae,[(i(!0),u(H,null,K(o.frequencies,(v,b)=>(i(),u("div",{key:b,"h-full":"",flex:"","flex-1":"","items-end":""},[e("div",{transition:"all 100 ease-in-out","mx-auto":"","my-0":"","w-full":"","rounded-full":"",class:$(o.barsClass),style:ve({height:`${m(v,b)}%`})},null,6)]))),128))]))}}),Te={class:"p-3"},ze={class:"flex items-start"},Be=["checked","name","value"],Fe={class:"relative mr-3 mt-0.5 flex-shrink-0"},Ie={key:0,class:"i-solar:pause-circle-bold-duotone text-xl text-neutral-400 dark:text-neutral-500"},Ne={key:1,class:"i-solar:play-circle-bold-duotone text-xl text-neutral-400 dark:text-neutral-500"},De={key:1,class:"mt-auto w-full flex items-center justify-center bg-neutral-50 py-3 text-xs text-neutral-400 italic dark:bg-neutral-800/50 dark:text-neutral-600"},je={class:"flex-1 cursor-pointer"},Oe={class:"flex items-center"},Qe={key:0,class:"mt-1 flex flex-wrap gap-1"},He={key:1,class:"mt-3"},Je={relative:""},Ge={key:0,class:"h-16 px-3 pb-2"},Ye=D({__name:"VoiceCard",props:W({name:null,voice:null,currentlyPlayingId:null,customInputPlaceholder:{default:"Enter custom voice name"},showVisualizer:{type:Boolean,default:!0},audioStream:{default:null}},{"voice-id":{required:!1,default:""},"voice-idModifiers":{},"custom-voice-name":{required:!1,default:""},"custom-voice-nameModifiers":{}}),emits:W(["togglePlayback"],["update:voice-id","update:custom-voice-name"]),setup(o,{emit:l}){const g=o,m=l,c=Y(o,"voice-id"),f=Y(o,"custom-voice-name");function v(h){return h.previewURL||h.preview_audio_url}function b(h){var k,U,q;const p=[];if((k=h.labels)!=null&&k.gender&&p.push(h.labels.gender),(U=h.labels)!=null&&U.age&&p.push(h.labels.age),(q=h.labels)!=null&&q.accent&&p.push(h.labels.accent),h.languages&&h.languages.length>0){const E=h.languages.map(T=>T.name).join(", ");p.push(E)}return p}function M(){m("togglePlayback",g.voice)}return(h,p)=>(i(),u("label",{border:"2px solid",class:$(["scroll-snap-align-start form_voice-card relative flex flex-col overflow-hidden rounded-xl",[c.value===g.voice.id?"bg-primary-50 dark:bg-primary-900/20 border-primary-100 dark:border-primary-900 hover:border-primary-500/30 dark:hover:border-primary-400/30":"bg-white dark:bg-neutral-900/20 border-neutral-100 dark:border-neutral-900 hover:border-primary-500/30 dark:hover:border-primary-400/30",c.value===g.voice.id?"form_voice-card-active":""]]),transition:"all duration-200 ease-in-out"},[e("div",Te,[e("div",ze,[Q(e("input",{"onUpdate:modelValue":p[0]||(p[0]=k=>c.value=k),checked:c.value===g.voice.id,type:"radio",name:o.name,value:g.voice.id,class:"absolute cursor-pointer opacity-0"},null,8,Be),[[me,c.value]]),e("div",Fe,[e("div",{class:$(["size-5 border-2 rounded-full transition-colors duration-200",[c.value===g.voice.id?"border-primary-500 dark:border-primary-400":"border-neutral-300 dark:border-neutral-600"]])},[e("div",{class:$(["absolute left-1/2 top-1/2 size-3 rounded-full transition-opacity duration-200 -translate-x-1/2 -translate-y-1/2",[c.value===g.voice.id?"opacity-100 bg-primary-500 dark:bg-primary-400":"opacity-0"]])},null,2)],2)]),v(o.voice)?(i(),u("button",{key:0,absolute:"","right-0":"",top:"0","z-100":"",class:$(["translate-x-[-50%] translate-y-[50%]",[o.currentlyPlayingId===o.voice.id?"text-white dark:text-white":""]]),onClick:M},[o.currentlyPlayingId===o.voice.id?(i(),u("div",Ie)):(i(),u("div",Ne))],2)):(i(),u("div",De," No preview available ")),e("div",je,[e("div",Oe,[e("span",{class:$(["line-clamp-1 font-medium",[c.value===o.voice.id?"text-neutral-700 dark:text-neutral-300":"text-neutral-700 dark:text-neutral-400"]])},y(o.voice.name),3)]),b(o.voice).length>0?(i(),u("div",Qe,[(i(!0),u(H,null,K(b(o.voice),(k,U)=>(i(),u("span",{key:U,class:$(["inline-flex items-center rounded-md px-1.5 py-0.5 text-xs",[c.value===o.voice.id?"bg-primary-100 text-primary-700 dark:bg-primary-900/30 dark:text-primary-400":"bg-neutral-100 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-300"]])},y(k),3))),128))])):P("",!0),o.voice.customizable&&c.value===o.voice.id?(i(),u("div",He,[_(Ce,{modelValue:f.value,"onUpdate:modelValue":p[1]||(p[1]=k=>f.value=k),type:"text",class:"w-full border border-neutral-300 rounded bg-white px-2 py-1 text-sm dark:border-neutral-700 dark:bg-neutral-900",placeholder:o.customInputPlaceholder},null,8,["modelValue","placeholder"])])):P("",!0),o.voice.description?(i(),u("div",{key:2,class:$(["line-clamp-2 mt-1 text-xs",[c.value===o.voice.id?"text-neutral-600 dark:text-neutral-400":"text-neutral-500 dark:text-neutral-500"]])},y(o.voice.description),3)):P("",!0)])])]),e("div",Je,[_(Me,null,{default:I(()=>[o.showVisualizer&&o.currentlyPlayingId===o.voice.id&&o.audioStream?(i(),u("div",Ge,[_(qe,{stream:o.audioStream,bars:24,"min-freq":60,"max-freq":4e3},{default:I(({frequencies:k})=>[_(Re,{frequencies:k,"bars-class":c.value===o.voice.id?"bg-primary-500 dark:bg-primary-400":"bg-neutral-400 dark:bg-neutral-600"},null,8,["frequencies","bars-class"])]),_:1},8,["stream"])])):P("",!0)]),_:1})])],2))}}),Ke=Z(Ye,[["__scopeId","data-v-dbab964e"]]),We={class:"voice-preview-player"},Xe={key:0,class:"relative","inline-flex":"~","w-full":"","items-center":""},Ze=["placeholder"],et={class:"mt-4 space-y-2"},tt={key:0,class:"text-sm text-neutral-500 dark:text-neutral-400"},st={key:1,class:"flex items-center gap-3 border border-2 border-amber-200 rounded-xl bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},lt={class:"flex flex-col"},ot={class:"font-medium"},at={class:"text-sm text-amber-600 dark:text-amber-400"},rt={class:"relative"},nt=D({__name:"VoiceCardManySelect",props:W({voices:null,searchable:{type:Boolean,default:!0},searchPlaceholder:{default:"Search voices..."},searchNoResultsTitle:{default:"No voices found"},searchNoResultsDescription:{default:"Try a different search term"},searchResultsText:{default:"{count} of {total} voices"},customInputPlaceholder:{default:"Enter custom voice name"},expandButtonText:{default:"Show more"},collapseButtonText:{default:"Show less"},playButtonText:{default:"Play sample"},pauseButtonText:{default:"Pause"},showVisualizer:{type:Boolean,default:!0}},{"search-query":{required:!1,default:""},"search-queryModifiers":{},"voice-id":{required:!1,default:""},"voice-idModifiers":{}}),emits:["update:search-query","update:voice-id"],setup(o){const l=o,g=V(!1),m=V(),c=V(new Map),f=V(new Map),v=V(new Map),b=V(new Map),M=V(null);function h(){return M.value||(M.value=new(window.AudioContext||window.webkitAudioContext)),M.value}const p=Y(o,"search-query"),k=Y(o,"voice-id"),U=pe(()=>{if(!p.value)return l.voices;const a=p.value.toLowerCase();return l.voices.filter(r=>{const n=r.name.toLowerCase().includes(a),x=r.description&&r.description.toLowerCase().includes(a),w=r.tags&&r.tags.some(S=>S.toLowerCase().includes(a)),L=r.labels&&Object.values(r.labels).some(S=>typeof S=="string"&&S.toLowerCase().includes(a)),C=r.languages&&r.languages.some(S=>S.name.toLowerCase().includes(a)||S.code.toLowerCase().includes(a));return n||x||w||L||C})});function q(a){return a.previewURL||a.preview_audio_url}function E(a){const r=q(a);if(!r)return null;if(c.value.has(a.id))return c.value.get(a.id)||null;const n=new Audio(r);return n.crossOrigin="anonymous",n.preload="auto",n.addEventListener("ended",()=>{if(m.value===a.id){m.value=void 0;const x=f.value.get(a.id);x&&(x.getTracks().forEach(w=>w.stop()),f.value.delete(a.id))}}),c.value.set(a.id,n),n}function T(a,r){try{if(f.value.has(r))return f.value.get(r)||null;const n=h();if(b.value.has(r)){const C=b.value.get(r),S=n.createMediaStreamDestination();C.connect(S);const j=S.stream;return f.value.set(r,j),j}const x=n.createMediaElementSource(a);b.value.set(r,x),x.connect(n.destination);const w=n.createMediaStreamDestination();x.connect(w);const L=w.stream;return f.value.set(r,L),L}catch(n){return console.error("Failed to create audio stream for visualizer:",n),null}}function A(a){try{if(!q(a))return;const n=E(a);if(!n)return;if(m.value===a.id){n.pause(),m.value=void 0;const x=f.value.get(a.id);x&&(x.getTracks().forEach(w=>w.stop()),f.value.delete(a.id));return}if(m.value){const x=c.value.get(m.value);x&&x.pause();const w=f.value.get(m.value);w&&(w.getTracks().forEach(L=>L.stop()),f.value.delete(m.value))}l.showVisualizer&&!f.value.has(a.id)&&T(n,a.id),n.currentTime=0,n.play().catch(x=>{console.error("Failed to play audio:",x)}),m.value=a.id}catch(r){console.error(r),m.value=void 0}}function z(){c.value.forEach(a=>{a.pause(),a.src=""}),c.value.clear(),f.value.forEach(a=>{a.getTracks().forEach(r=>r.stop())}),f.value.clear(),v.value.forEach(a=>{a.state!=="closed"&&a.close()}),v.value.clear(),b.value.clear(),m.value=void 0}X(p,()=>{if(m.value){const a=c.value.get(m.value);a&&a.pause();const r=f.value.get(m.value);r&&(r.getTracks().forEach(n=>n.stop()),f.value.delete(m.value)),m.value=void 0}}),fe(z);const B=V("");return(a,r)=>(i(),u("div",We,[o.searchable?(i(),u("div",Xe,[r[4]||(r[4]=e("div",{class:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3"},[e("div",{"i-solar:magnifer-line-duotone":"",class:"text-neutral-500 dark:text-neutral-400"})],-1)),Q(e("input",{"onUpdate:modelValue":r[0]||(r[0]=n=>p.value=n),type:"search",class:"w-full rounded-xl p-2.5 pl-10 text-sm outline-none",border:"focus:primary-100 dark:focus:primary-400/50 2 solid neutral-200 dark:neutral-800",transition:"all duration-200 ease-in-out",bg:"white dark:neutral-900",placeholder:o.searchPlaceholder},null,8,Ze),[[ne,p.value]])])):P("",!0),e("div",et,[p.value?(i(),u("div",tt,y(o.searchResultsText.replace("{count}",U.value.length.toString()).replace("{total}",o.voices.length.toString())),1)):P("",!0),p.value&&U.value.length===0?(i(),u("div",st,[r[5]||(r[5]=e("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),e("div",lt,[e("span",ot,y(o.searchNoResultsTitle),1),e("span",at,y(o.searchNoResultsDescription.replace("{query}",p.value)),1)])])):P("",!0),e("div",rt,[e("div",{class:$(["scrollbar-hide grid auto-cols-[350px] grid-flow-col max-h-[calc(100dvh-7lh)] gap-4 overflow-x-auto",[g.value?"grid-cols-1 md:grid-cols-2 grid-flow-row auto-cols-auto":""]]),transition:"all duration-200 ease-in-out",style:{"scroll-snap-type":"x mandatory"}},[(i(!0),u(H,null,K(U.value,n=>(i(),G(Ke,{key:n.id,"voice-id":k.value,"onUpdate:voiceId":r[1]||(r[1]=x=>k.value=x),"custom-voice-name":B.value,"onUpdate:customVoiceName":r[2]||(r[2]=x=>B.value=x),name:"voice",voice:n,"currently-playing-id":m.value,"custom-input-placeholder":o.customInputPlaceholder,"show-visualizer":o.showVisualizer,"audio-stream":f.value.get(n.id),onTogglePlayback:A},null,8,["voice-id","custom-voice-name","voice","currently-playing-id","custom-input-placeholder","show-visualizer","audio-stream"]))),128))],2),e("div",{bg:"neutral-100 dark:[rgba(0,0,0,0.3)]","rounded-xl":"",class:$([g.value?"w-full":"mt-4 w-full rounded-lg"])},[e("button",{"w-full":"",flex:"","items-center":"","justify-center":"","gap-2":"","rounded-lg":"","py-2":"",transition:"all duration-200 ease-in-out",class:$([g.value?"bg-primary-500 hover:bg-primary-600 text-white":"bg-white dark:bg-neutral-900 hover:bg-neutral-100 dark:hover:bg-neutral-800"]),onClick:r[3]||(r[3]=n=>g.value=!g.value)},[e("span",null,y(g.value?o.collapseButtonText:o.expandButtonText),1),e("div",{class:$([g.value?"rotate-180":"","text-lg"]),"i-solar:alt-arrow-down-bold-duotone":"",transition:"transform duration-200 ease-in-out"},null,2)],2)],2)])])]))}}),it=Z(nt,[["__scopeId","data-v-070104a7"]]),ut=D({__name:"Skeleton",props:{animation:{default:"pulse"}},setup(o){const l=o;return(g,m)=>(i(),u("div",{class:$(["skeleton",l.animation!=="none"?`skeleton-${l.animation}`:""]),bg:"neutral-200 dark:neutral-800",overflow:"hidden"},[re(g.$slots,"default",{},void 0,!0)],2))}}),O=Z(ut,[["__scopeId","data-v-f404da2a"]]),dt={flex:"~ col md:row gap-6"},ct={bg:"neutral-100 dark:[rgba(0,0,0,0.3)]","rounded-xl":"","p-4":"",flex:"~ col gap-4",class:"w-full md:w-[40%]"},vt={flex:"~ col gap-4"},mt={class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"},pt={text:"neutral-400 dark:neutral-500"},ft={"max-w-full":""},gt={key:0,flex:"~ row gap-4",style:{"scrollbar-width":"none"},"min-w-0":"","of-x-scroll":"","scroll-smooth":"",role:"radiogroup"},xt={key:1},bt={key:0},ht={flex:"~ col gap-4"},yt={class:"text-lg md:text-2xl"},kt={text:"neutral-400 dark:neutral-400"},wt={key:0,class:"flex items-center justify-center py-4"},_t={key:1,class:"flex items-center gap-3 border border-red-200 rounded-lg bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"},St={class:"flex flex-col"},Vt={class:"font-medium"},Mt={class:"text-sm text-red-600 dark:text-red-400"},Ct={key:2,class:"flex items-center gap-3 border border-amber-200 rounded-lg bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},$t={class:"flex flex-col"},Pt={class:"font-medium"},Ut={class:"text-sm text-amber-600 dark:text-amber-400"},Lt={key:0},qt={flex:"~ col gap-4"},At={key:0},Et={class:"flex flex-col gap-4"},Rt={flex:"~ row gap-4"},Tt={key:1,class:"space-y-6"},zt={key:2,class:"flex items-center gap-3 border border-2 border-red-200 rounded-lg bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20"},Bt={class:"flex flex-col"},Ft={class:"text-sm text-red-600 dark:text-red-400"},It={key:3,class:"flex items-center gap-3 border border-2 border-amber-200 rounded-lg bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20"},Nt={flex:"~ col gap-4"},Dt={key:4,class:"mt-2 space-y-6"},jt={key:0},Ot={flex:"~ col gap-4"},Qt={flex:"~ col gap-6",class:"w-full md:w-[60%]"},Ht={"w-full":"","rounded-xl":""},Jt={class:"mb-4 text-lg text-neutral-500 md:text-2xl dark:text-neutral-400","w-full":""},Gt={class:"inline-flex items-center gap-4"},Yt={flex:"~ col gap-4"},Kt={flex:"~ row","gap-4":""},Wt=["disabled"],Xt={flex:"~ row","items-center":"","gap-2":""},Zt=["src"],es={text:"neutral-200/50 dark:neutral-600/20","pointer-events-none":"",fixed:"",top:"[calc(100dvh-15rem)]","bottom-0":"","right--5":"","z--1":"",initial:{scale:.9,opacity:0,x:20},enter:{scale:1,opacity:1,x:0},duration:500,"size-60":"",flex:"","items-center":"","justify-center":""},ts=D({__name:"speech",setup(o){const{t:l}=ge(),g=Pe(),m=Ue(),{availableProviders:c,availableAudioSpeechProvidersMetadata:f}=te(g),{activeSpeechProvider:v,activeSpeechModel:b,activeSpeechVoice:M,activeSpeechVoiceId:h,pitch:p,isLoadingSpeechProviderVoices:k,supportsModelListing:U,providerModels:q,isLoadingActiveProviderModels:E,activeProviderModelError:T,modelSearchQuery:A,speechProviderError:z,ssmlEnabled:B,availableVoices:a}=te(m),r=V(""),n=V(!1),x=V("Hello, my name is AI Assistant"),w=V(""),L=V(!1),C=V(""),S=V(null),j=V("");ae(async()=>{await m.loadVoicesForProvider(v.value),await g.loadModelsForConfiguredProviders()}),X(v,async()=>{await m.loadVoicesForProvider(v.value),await g.loadModelsForConfiguredProviders()});async function ie(){if(!x.value.trim()&&!n.value||n.value&&!w.value.trim())return;if(!b.value){console.error("No model selected");return}if(!M.value){console.error("No voice selected");return}const R=g.getProviderInstance(v.value);if(!R){console.error("Failed to initialize speech provider");return}const s=g.getProviderConfig(v.value);L.value=!0,j.value="";try{C.value&&ee();const N=n.value?w.value:m.generateSSML(x.value,M.value,{...s,pitch:p.value}),J=await Le({...R.speech(b.value,s),input:N,voice:M.value.id});C.value=URL.createObjectURL(new Blob([J])),setTimeout(()=>{S.value&&S.value.play()},100)}catch(N){console.error("Error generating speech:",N),j.value=N instanceof Error?N.message:"An unknown error occurred"}finally{L.value=!1}}function ee(){S.value&&(S.value.pause(),S.value.currentTime=0),C.value&&(URL.revokeObjectURL(C.value),C.value="")}xe(()=>{C.value&&URL.revokeObjectURL(C.value)});function ue(R){M.value={id:R,name:R,description:R,previewURL:R,languages:[{code:"en",title:"English"}],provider:v.value,gender:"male"}}function de(R){b.value=R}return(R,s)=>{var J;const N=be("motion");return i(),u(H,null,[_(t($e),{title:t(l)("settings.pages.modules.speech.title"),subtitle:t(l)("settings.pages.modules.title")},null,8,["title","subtitle"]),e("div",dt,[e("div",ct,[e("div",null,[e("div",vt,[e("div",null,[e("h2",mt,y(t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.title")),1),e("div",pt,[e("span",null,y(t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.description")),1)])]),e("div",ft,[t(c).length>0?(i(),u("fieldset",gt,[(i(!0),u(H,null,K(t(f),d=>(i(),G(t(Se),{id:d.id,key:d.id,modelValue:t(v),"onUpdate:modelValue":s[0]||(s[0]=ce=>F(v)?v.value=ce:null),name:"speech-provider",value:d.id,title:d.localizedName,description:d.localizedDescription},null,8,["id","modelValue","value","title","description"]))),128))])):(i(),u("div",xt,[_(t(he),{class:"flex items-center gap-3 rounded-lg p-4",border:"2 dashed neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-800",transition:"colors duration-200 ease-in-out",to:"/settings/providers"},{default:I(()=>s[13]||(s[13]=[e("div",{"i-solar:warning-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1),e("div",{class:"flex flex-col"},[e("span",{class:"font-medium"},"No Speech Providers Configured"),e("span",{class:"text-sm text-neutral-400 dark:text-neutral-500"},"Click here to set up your speech providers")],-1),e("div",{"i-solar:arrow-right-line-duotone":"",class:"ml-auto text-xl text-neutral-400 dark:text-neutral-500"},null,-1)])),_:1})]))])]),e("div",null,[t(v)&&t(U)?(i(),u("div",bt,[e("div",ht,[e("div",null,[e("h2",yt,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.title")),1),e("div",kt,[e("span",null,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.subtitle")),1)])]),t(E)?(i(),u("div",wt,[s[14]||(s[14]=e("div",{class:"mr-2 animate-spin"},[e("div",{"i-solar:spinner-line-duotone":"","text-xl":""})],-1)),e("span",null,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.loading")),1)])):t(T)?(i(),u("div",_t,[s[15]||(s[15]=e("div",{"i-solar:close-circle-line-duotone":"",class:"text-2xl text-red-500 dark:text-red-400"},null,-1)),e("div",St,[e("span",Vt,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.error")),1),e("span",Mt,y(t(T)),1)])])):t(q).length===0&&!t(E)?(i(),u("div",Ct,[s[16]||(s[16]=e("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1)),e("div",$t,[e("span",Pt,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_models")),1),e("span",Ut,y(t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_models_description")),1)])])):t(q).length>0?(i(),G(t(_e),{key:3,modelValue:t(b),"onUpdate:modelValue":s[1]||(s[1]=d=>F(b)?b.value=d:null),"search-query":t(A),"onUpdate:searchQuery":s[2]||(s[2]=d=>F(A)?A.value=d:null),items:t(q),searchable:!0,"search-placeholder":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.search_placeholder"),"search-no-results-title":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_search_results"),"search-no-results-description":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.no_search_results_description",{query:t(A)}),"search-results-text":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.search_results",{count:"{count}",total:"{total}"}),"custom-input-placeholder":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.custom_model_placeholder"),"expand-button-text":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.expand"),"collapse-button-text":t(l)("settings.pages.modules.consciousness.sections.section.provider-model-selection.collapse"),"onUpdate:customValue":de},null,8,["modelValue","search-query","items","search-placeholder","search-no-results-title","search-no-results-description","search-results-text","custom-input-placeholder","expand-button-text","collapse-button-text"])):P("",!0)])])):P("",!0)])]),t(v)?(i(),u("div",Lt,[e("div",qt,[s[27]||(s[27]=e("div",null,[e("h2",{class:"text-lg text-neutral-500 md:text-2xl dark:text-neutral-400"}," Voice Configuration "),e("div",{text:"neutral-400 dark:neutral-500"},[e("span",null,"Customize how your AI assistant speaks")])],-1)),t(k)?(i(),u("div",At,[e("div",Et,[_(t(O),{class:"w-full rounded-lg p-2.5 text-sm"},{default:I(()=>s[17]||(s[17]=[e("div",{class:"h-1lh"},null,-1)])),_:1}),e("div",Rt,[_(t(O),{class:"w-full rounded-lg p-4 text-sm"},{default:I(()=>s[18]||(s[18]=[e("div",{class:"h-1lh"},null,-1)])),_:1}),_(t(O),{class:"w-full rounded-lg p-4 text-sm"},{default:I(()=>s[19]||(s[19]=[e("div",{class:"h-1lh"},null,-1)])),_:1}),_(t(O),{class:"w-full rounded-lg p-4 text-sm"},{default:I(()=>s[20]||(s[20]=[e("div",{class:"h-1lh"},null,-1)])),_:1})]),_(t(O),{class:"w-full rounded-lg p-3 text-sm"},{default:I(()=>s[21]||(s[21]=[e("div",{class:"h-1lh"},null,-1)])),_:1})])])):t(a)[t(v)]&&t(a)[t(v)].length>0?(i(),u("div",Tt,[_(t(it),{"search-query":r.value,"onUpdate:searchQuery":s[3]||(s[3]=d=>r.value=d),"voice-id":t(h),"onUpdate:voiceId":s[4]||(s[4]=d=>F(h)?h.value=d:null),voices:(J=t(a)[t(v)])==null?void 0:J.map(d=>({id:d.id,name:d.name,description:d.description,previewURL:d.previewURL,customizable:!1})),searchable:!0,"search-placeholder":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.search_voices_placeholder"),"search-no-results-title":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.no_voices"),"search-no-results-description":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.no_voices_description"),"search-results-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.search_voices_results",{count:0,total:0}),"custom-input-placeholder":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.custom_voice_placeholder"),"expand-button-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.show_more"),"collapse-button-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.show_less"),"play-button-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.play_sample"),"pause-button-text":t(l)("settings.pages.modules.speech.sections.section.provider-voice-selection.pause"),"onUpdate:customValue":ue},null,8,["search-query","voice-id","voices","search-placeholder","search-no-results-title","search-no-results-description","search-results-text","custom-input-placeholder","expand-button-text","collapse-button-text","play-button-text","pause-button-text"])])):t(z)?(i(),u("div",zt,[s[23]||(s[23]=e("div",{"i-solar:close-circle-line-duotone":"",class:"text-2xl text-red-500 dark:text-red-400"},null,-1)),e("div",Bt,[s[22]||(s[22]=e("span",{class:"font-medium"},"Error loading voices",-1)),e("span",Ft,y(t(z)),1)])])):(i(),u("div",It,s[24]||(s[24]=[e("div",{"i-solar:info-circle-line-duotone":"",class:"text-2xl text-amber-500 dark:text-amber-400"},null,-1),e("div",{class:"flex flex-col"},[e("span",{class:"font-medium"},"No voices available"),e("span",{class:"text-sm text-amber-600 dark:text-amber-400"}," No voices were found for this provider. You can enter a custom voice name below. ")],-1)]))),e("div",Nt,[_(t(le),{modelValue:t(p),"onUpdate:modelValue":s[5]||(s[5]=d=>F(p)?p.value=d:null),label:"Pitch",description:"Tune the pitch of the voice",min:-100,max:100,step:1,"format-value":d=>`${d}%`},null,8,["modelValue","format-value"]),_(t(se),{modelValue:t(B),"onUpdate:modelValue":s[6]||(s[6]=d=>F(B)?B.value=d:null),label:"Enable SSML",description:"Enable Speech Synthesis Markup Language for more control over speech output"},null,8,["modelValue"])]),!t(a)[t(v)]||t(a)[t(v)].length===0?(i(),u("div",Dt,[_(t(we),{modelValue:t(h),"onUpdate:modelValue":s[7]||(s[7]=d=>F(h)?h.value=d:null),type:"text",label:"Voice ID",description:"Enter the voice ID for your custom voice",placeholder:"Enter voice name (e.g., 'Rachel', 'Josh')"},null,8,["modelValue"]),t(v)==="elevenlabs"?(i(),u("div",jt,[s[26]||(s[26]=e("label",{class:"mb-1 block text-sm font-medium"}," Model ",-1)),Q(e("select",{"onUpdate:modelValue":s[8]||(s[8]=d=>F(b)?b.value=d:null),class:"w-full border border-neutral-300 rounded bg-white px-3 py-2 dark:border-neutral-700 dark:bg-neutral-900"},s[25]||(s[25]=[e("option",{value:"eleven_monolingual_v1"}," Monolingual v1 ",-1),e("option",{value:"eleven_multilingual_v1"}," Multilingual v1 ",-1),e("option",{value:"eleven_multilingual_v2"}," Multilingual v2 ",-1)]),512),[[ye,t(b)]])])):P("",!0),e("div",Ot,[_(t(le),{modelValue:t(p),"onUpdate:modelValue":s[9]||(s[9]=d=>F(p)?p.value=d:null),label:"Pitch",description:"Tune the pitch of the voice",min:-100,max:100,step:1,"format-value":d=>`${d}%`},null,8,["modelValue","format-value"])])])):P("",!0)])])):P("",!0)]),e("div",Qt,[e("div",Ht,[e("h2",Jt,[e("div",Gt,[_(t(ke)),e("div",null,y(t(l)("settings.pages.providers.provider.elevenlabs.playground.title")),1)])]),e("div",Yt,[_(t(se),{modelValue:n.value,"onUpdate:modelValue":s[10]||(s[10]=d=>n.value=d),label:"Use Custom SSML",description:"Enable to input raw SSML instead of plain text"},null,8,["modelValue"]),n.value?Q((i(),u("textarea",{key:1,"onUpdate:modelValue":s[12]||(s[12]=d=>w.value=d),placeholder:"Enter SSML text...",border:"neutral-100 dark:neutral-800 solid 2 focus:neutral-200 dark:focus:neutral-700",transition:"all duration-250 ease-in-out",bg:"neutral-100 dark:neutral-800 focus:neutral-50 dark:focus:neutral-900","h-48":"","w-full":"","rounded-lg":"","px-3":"","py-2":"","text-sm":"","font-mono":"","outline-none":""},null,512)),[[ne,w.value]]):(i(),G(t(Ve),{key:0,modelValue:x.value,"onUpdate:modelValue":s[11]||(s[11]=d=>x.value=d),"h-24":"","w-full":"",placeholder:t(l)("settings.pages.providers.provider.elevenlabs.playground.fields.field.input.placeholder")},null,8,["modelValue","placeholder"])),e("div",Kt,[e("button",{border:"neutral-800 dark:neutral-200 solid 2",transition:"border duration-250 ease-in-out","rounded-lg":"","px-4":"",text:"neutral-100 dark:neutral-900","py-2":"","text-sm":"",disabled:L.value||!x.value.trim()&&!n.value||n.value&&!w.value.trim()||!t(M),class:$({"opacity-50 cursor-not-allowed":L.value||!x.value.trim()&&!n.value||n.value&&!w.value.trim()||!t(M)}),bg:"neutral-700 dark:neutral-300",onClick:ie},[e("div",Xt,[s[28]||(s[28]=e("div",{"i-solar:play-circle-bold-duotone":""},null,-1)),e("span",null,y(L.value?t(l)("settings.pages.providers.provider.elevenlabs.playground.buttons.button.test-voice.generating"):t(l)("settings.pages.providers.provider.elevenlabs.playground.buttons.button.test-voice.label")),1)])],10,Wt),C.value?(i(),u("button",{key:0,border:"primary-300 dark:primary-800 solid 2",transition:"border duration-250 ease-in-out","rounded-lg":"","px-4":"","py-2":"","text-sm":"",onClick:ee},s[29]||(s[29]=[e("div",{flex:"~ row","items-center":"","gap-2":""},[e("div",{"i-solar:stop-circle-bold-duotone":""}),e("span",null,"Stop")],-1)]))):P("",!0)]),C.value?(i(),u("audio",{key:2,ref_key:"audioPlayer",ref:S,src:C.value,controls:"",class:"mt-2 w-full"},null,8,Zt)):P("",!0)])])])]),Q((i(),u("div",es,s[30]||(s[30]=[e("div",{text:"60","i-solar:user-speak-rounded-bold-duotone":""},null,-1)]))),[[N]])],64)}}});typeof oe=="function"&&oe(ts);export{ts as default}; diff --git a/assets/stage-DMHqfEjy.js b/assets/stage-U8FCK4AA.js similarity index 84% rename from assets/stage-DMHqfEjy.js rename to assets/stage-U8FCK4AA.js index 1d07c870104cd67e7ecf7bba301d3e7bcff45674..6266befbc2042d28bfed4ae3f0f6cd9de9f3a3a7 100644 --- a/assets/stage-DMHqfEjy.js +++ b/assets/stage-U8FCK4AA.js @@ -1 +1 @@ -import{d as p,e as s,c,b as d,r as i,n as m,u as e,o as l}from"./index-20XXNHAB.js";const x=p({__name:"stage",setup(u){const{top:t,right:o,bottom:a,left:n}=s();return(f,_)=>{const r=i("RouterView");return l(),c("main",{text:"gray-700 dark:gray-200","h-full":"","font-cuteen":"",style:m({paddingTop:`${e(t)}px`,paddingRight:`${e(o)}px`,paddingBottom:`${e(a)}px`,paddingLeft:`${e(n)}px`})},[d(r)],4)}}});export{x as default}; +import{d as p,e as s,c,b as d,r as i,n as m,u as e,o as l}from"./index-D8Nm21zW.js";const x=p({__name:"stage",setup(u){const{top:t,right:o,bottom:a,left:n}=s();return(f,_)=>{const r=i("RouterView");return l(),c("main",{text:"gray-700 dark:gray-200","h-full":"","font-cuteen":"",style:m({paddingTop:`${e(t)}px`,paddingRight:`${e(o)}px`,paddingBottom:`${e(a)}px`,paddingLeft:`${e(n)}px`})},[d(r)],4)}}});export{x as default}; diff --git a/assets/together-ai-CmQtGg2y.js b/assets/together-ai-CmQtGg2y.js new file mode 100644 index 0000000000000000000000000000000000000000..59017ef07569303faad3623d718cee37173eea23 --- /dev/null +++ b/assets/together-ai-CmQtGg2y.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as h,q as y,bG as U,s as V,h as v,l as $,w as k,x,o as K,y as p,b as l,u as t}from"./index-D8Nm21zW.js";import{u as z}from"./providers-DUDq6kdm.js";import{_ as w,a as C}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as M}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as N,a as P}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as R}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="together-ai",L=h({__name:"together-ai",setup(S){const{t:d}=y(),_=U(),m=z(),{providers:o}=V(m),n=v(()=>m.getProviderMetadata(a)),i=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,r;m.initializeProvider(a),i.value=((e=o.value[a])==null?void 0:e.apiKey)||"",s.value=((r=o.value[a])==null?void 0:r.baseUrl)||""}),k([i,s],()=>{o.value[a]={...o.value[a],apiKey:i.value,baseUrl:s.value||""}});function g(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,r)=>{var c,f;return K(),x(t(R),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon-color":(f=n.value)==null?void 0:f.iconColor,"on-back":()=>t(_).back()},{default:p(()=>[l(t(N),null,{default:p(()=>[l(t(P),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":g},{default:p(()=>{var u;return[l(t(M),{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=b=>i.value=b),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"togetherapi-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(w),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(C),{modelValue:s.value,"onUpdate:modelValue":r[1]||(r[1]=u=>s.value=u),placeholder:"https://api.together.xyz/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{L as default}; diff --git a/assets/together-ai-D3xDReQZ.js b/assets/together-ai-D3xDReQZ.js deleted file mode 100644 index 1d3ad48f2d0857bb14b55895fe3a8cc833344c7b..0000000000000000000000000000000000000000 --- a/assets/together-ai-D3xDReQZ.js +++ /dev/null @@ -1 +0,0 @@ -import{d as h,q as y,bG as U,s as V,h as v,l as $,w as k,x,o as K,y as p,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as z}from"./providers-BqZLRXH1.js";import{_ as w,a as C}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as M}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as N,a as P}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as R}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="together-ai",L=h({__name:"together-ai",setup(S){const{t:d}=y(),_=U(),m=z(),{providers:o}=V(m),n=v(()=>m.getProviderMetadata(a)),i=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,r;m.initializeProvider(a),i.value=((e=o.value[a])==null?void 0:e.apiKey)||"",s.value=((r=o.value[a])==null?void 0:r.baseUrl)||""}),k([i,s],()=>{o.value[a]={...o.value[a],apiKey:i.value,baseUrl:s.value||""}});function g(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,r)=>{var c,f;return K(),x(t(R),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon-color":(f=n.value)==null?void 0:f.iconColor,"on-back":()=>t(_).back()},{default:p(()=>[l(t(N),null,{default:p(()=>[l(t(P),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":g},{default:p(()=>{var u;return[l(t(M),{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=b=>i.value=b),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"togetherapi-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(w),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(C),{modelValue:s.value,"onUpdate:modelValue":r[1]||(r[1]=u=>s.value=u),placeholder:"https://api.together.xyz/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon-color","on-back"])}}});export{L as default}; diff --git a/assets/useIconAnimation-D5irYuyi.js b/assets/useIconAnimation-D5irYuyi.js new file mode 100644 index 0000000000000000000000000000000000000000..ae7357dae2ea12e7179d78c9292a89ed748bd01a --- /dev/null +++ b/assets/useIconAnimation-D5irYuyi.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{g as t,v as u,h as r,l as c,H as m}from"./index-D8Nm21zW.js";function p(s){const n=t(!1),o=t(!1),a=t(s),e=u(),i=r(()=>o.value&&!e.disableTransitions&&e.usePageSpecificTransitions);return c(()=>{o.value=!0,requestAnimationFrame(()=>{n.value=!0})}),m(()=>{n.value=!1,o.value=!1}),{iconAnimationStarted:n,showIconAnimation:i,animationIcon:a}}export{p as u}; diff --git a/assets/useIconAnimation-HC6FusaE.js b/assets/useIconAnimation-HC6FusaE.js deleted file mode 100644 index cca4dc5bb3ce79caa927fadcdd0b09c3a92949b9..0000000000000000000000000000000000000000 --- a/assets/useIconAnimation-HC6FusaE.js +++ /dev/null @@ -1 +0,0 @@ -import"./live2d-zip-loader-52aPyiCh.js";import{g as t,v as u,h as r,l as c,H as m}from"./index-20XXNHAB.js";function p(s){const n=t(!1),o=t(!1),a=t(s),e=u(),i=r(()=>o.value&&!e.disableTransitions&&e.usePageSpecificTransitions);return c(()=>{o.value=!0,requestAnimationFrame(()=>{n.value=!0})}),m(()=>{n.value=!1,o.value=!1}),{iconAnimationStarted:n,showIconAnimation:i,animationIcon:a}}export{p as u}; diff --git a/assets/vibrant-B3lGp8kq.js b/assets/vibrant-B3lGp8kq.js deleted file mode 100644 index 9362d9a930918dab0de381df41de63256be553ef..0000000000000000000000000000000000000000 --- a/assets/vibrant-B3lGp8kq.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as g}from"./InputFile.vue_vue_type_script_setup_true_lang-61TbqfJt.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as p,g as n,w as v,c as r,o,a as s,bx as _,by as b,D as h,b as k,u as w,C as x,n as y}from"./index-20XXNHAB.js";import{V}from"./browser-CkchkNbv.js";const C={flex:"","flex-col":"","gap-4":""},j={border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","w-full":"",flex:"","gap-2":"","rounded-lg":"","p-4":""},L={border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","w-full":"",flex:"","gap-2":"","rounded-lg":"","p-4":""},N={flex:"","gap-2":""},O={"h-60":"",border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","rounded-lg":""},B=["src"],I=p({__name:"vibrant",setup(D){const u=n([]),t=n(),d=n([]),i=n([]);function c(l){const a=new Image;a.src=URL.createObjectURL(l),a.onload=f,t.value=a}async function f(){if(!t.value)return;const a=await new V(t.value).getPalette();d.value=Object.values(a).map(e=>e==null?void 0:e.hex).filter(e=>typeof e=="string"),i.value=Object.values(a).map(e=>JSON.stringify(e))}return v(u,l=>{c(l[0])},{deep:!0}),(l,a)=>(o(),r("div",C,[s("div",j,[(o(!0),r(_,null,b(d.value,(e,m)=>(o(),r("div",{key:m,style:y({backgroundColor:e}),"size-20":"","rounded-full":""},null,4))),128))]),s("div",L,h(i.value),1),s("div",N,[k(w(g),{modelValue:u.value,"onUpdate:modelValue":a[0]||(a[0]=e=>u.value=e),"h-60":"","w-full":""},null,8,["modelValue"])]),s("div",O,[t.value?(o(),r("img",{key:0,src:t.value.src,"h-full":"","w-full":"","object-contain":""},null,8,B)):x("",!0)])]))}});export{I as default}; diff --git a/assets/vibrant-Ck8ouQeR.js b/assets/vibrant-Ck8ouQeR.js new file mode 100644 index 0000000000000000000000000000000000000000..ae3caccde3973d8196c09376f8504d8fd3bc48fe --- /dev/null +++ b/assets/vibrant-Ck8ouQeR.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{_ as g}from"./InputFile.vue_vue_type_script_setup_true_lang-aVfE3xzX.js";import{d as p,g as n,w as v,c as r,o,a as s,bx as _,by as b,D as h,b as k,u as w,C as x,n as y}from"./index-D8Nm21zW.js";import{V}from"./browser-CkchkNbv.js";const C={flex:"","flex-col":"","gap-4":""},j={border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","w-full":"",flex:"","gap-2":"","rounded-lg":"","p-4":""},L={border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","w-full":"",flex:"","gap-2":"","rounded-lg":"","p-4":""},N={flex:"","gap-2":""},O={"h-60":"",border:"2 solid neutral-200 dark:neutral-800",bg:"neutral-50 dark:neutral-900","rounded-lg":""},B=["src"],I=p({__name:"vibrant",setup(D){const u=n([]),t=n(),d=n([]),i=n([]);function c(l){const a=new Image;a.src=URL.createObjectURL(l),a.onload=f,t.value=a}async function f(){if(!t.value)return;const a=await new V(t.value).getPalette();d.value=Object.values(a).map(e=>e==null?void 0:e.hex).filter(e=>typeof e=="string"),i.value=Object.values(a).map(e=>JSON.stringify(e))}return v(u,l=>{c(l[0])},{deep:!0}),(l,a)=>(o(),r("div",C,[s("div",j,[(o(!0),r(_,null,b(d.value,(e,m)=>(o(),r("div",{key:m,style:y({backgroundColor:e}),"size-20":"","rounded-full":""},null,4))),128))]),s("div",L,h(i.value),1),s("div",N,[k(w(g),{modelValue:u.value,"onUpdate:modelValue":a[0]||(a[0]=e=>u.value=e),"h-60":"","w-full":""},null,8,["modelValue"])]),s("div",O,[t.value?(o(),r("img",{key:0,src:t.value.src,"h-full":"","w-full":"","object-contain":""},null,8,B)):x("",!0)])]))}});export{I as default}; diff --git a/assets/volcengine-D-nJo8Wt.js b/assets/volcengine-D-nJo8Wt.js deleted file mode 100644 index 6fe2dc2e84d4808c2306a35a314fd180b1bc4c8a..0000000000000000000000000000000000000000 --- a/assets/volcengine-D-nJo8Wt.js +++ /dev/null @@ -1 +0,0 @@ -import{_ as V}from"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import{_ as y}from"./FieldRange.vue_vue_type_script_setup_true_lang-BtFz1_fe.js";import"./live2d-zip-loader-52aPyiCh.js";import{d as w,g as M,s as I,q as S,h as v,l as x,w as g,x as F,o as k,y as c,b as f,u as r,a as $}from"./index-20XXNHAB.js";import{u as B}from"./providers-BqZLRXH1.js";import{u as R}from"./speech-CF8Au8j4.js";import{_ as q,a as E}from"./SpeechProviderSettings.vue_vue_type_script_setup_true_lang-B6yYYFHK.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./index-Be1NqeGb.js";import"./TestDummyMarker.vue_vue_type_script_setup_true_lang-Cu9s70l8.js";import"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const K={flex:"~ col gap-4"},o="volcengine",_="v1",ee=w({__name:"volcengine",setup(L){const s=M(1),d=R(),a=B(),{providers:t}=I(a),{t:n}=S(),p=v({get:()=>{var e,i;return((i=(e=t.value[o])==null?void 0:e.app)==null?void 0:i.appId)||""},set:e=>{t.value[o]||(t.value[o]={}),t.value[o].app={appId:e}}}),b=v(()=>{var e;return!!((e=t.value[o])!=null&&e.apiKey)}),C=v(()=>d.availableVoices[o]||[]);async function h(e,i,l){const u=a.getProviderInstance(o);if(!u)throw new Error("Failed to initialize speech provider");const m=a.getProviderConfig(o),P=m.model||_;return await d.speech(u,P,e,i,{...m})}return x(async()=>{const e=a.getProviderConfig(o);await a.getProviderMetadata(o).validators.validateProviderConfig(e)?await d.loadVoicesForProvider(o):console.error("Failed to validate provider config",e)}),g(s,async()=>{const e=a.getProviderConfig(o);e.audio||(e.audio={}),e.audio.speedRatio=s.value}),g([t,p],async()=>{const e=a.getProviderConfig(o);await a.getProviderMetadata(o).validators.validateProviderConfig(e)?await d.loadVoicesForProvider(o):console.error("Failed to validate provider config",e)},{immediate:!0}),(e,i)=>(k(),F(r(E),{"provider-id":o,"default-model":_},{"basic-settings":c(()=>[$("div",K,[f(r(V),{modelValue:p.value,"onUpdate:modelValue":i[0]||(i[0]=l=>p.value=l),label:r(n)("settings.pages.providers.provider.volcengine.fields.field.appId.label"),description:r(n)("settings.pages.providers.provider.volcengine.fields.field.appId.description"),required:""},null,8,["modelValue","label","description"])])]),"voice-settings":c(()=>[f(r(y),{modelValue:s.value,"onUpdate:modelValue":i[1]||(i[1]=l=>s.value=l),label:r(n)("settings.pages.providers.provider.common.fields.field.speed.label"),description:r(n)("settings.pages.providers.provider.common.fields.field.speed.description"),min:.5,max:2,step:.01},null,8,["modelValue","label","description"])]),playground:c(()=>[f(r(q),{"available-voices":C.value,"generate-speech":h,"api-key-configured":b.value,"default-text":"Hello! This is a test of the ElevenLabs voice synthesis."},null,8,["available-voices","api-key-configured"])]),_:1}))}});export{ee as default}; diff --git a/assets/volcengine-DP5EEnId.js b/assets/volcengine-DP5EEnId.js new file mode 100644 index 0000000000000000000000000000000000000000..00eb0a3e15a8a033d4bf7ab159312201bdd13e55 --- /dev/null +++ b/assets/volcengine-DP5EEnId.js @@ -0,0 +1 @@ +import{_ as V}from"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import{_ as y}from"./FieldRange.vue_vue_type_script_setup_true_lang-B670Jjy-.js";import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as w,g as M,s as I,q as S,h as v,l as x,w as g,x as F,o as k,y as c,b as f,u as r,a as $}from"./index-D8Nm21zW.js";import{u as B}from"./providers-DUDq6kdm.js";import{u as R}from"./speech-B27BwGQ-.js";import{_ as q,a as E}from"./SpeechProviderSettings.vue_vue_type_script_setup_true_lang-Cscdqs1L.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./index-Be1NqeGb.js";import"./TestDummyMarker.vue_vue_type_script_setup_true_lang-CG5q9Jpo.js";import"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const K={flex:"~ col gap-4"},o="volcengine",_="v1",ee=w({__name:"volcengine",setup(L){const s=M(1),d=R(),a=B(),{providers:t}=I(a),{t:n}=S(),p=v({get:()=>{var e,i;return((i=(e=t.value[o])==null?void 0:e.app)==null?void 0:i.appId)||""},set:e=>{t.value[o]||(t.value[o]={}),t.value[o].app={appId:e}}}),b=v(()=>{var e;return!!((e=t.value[o])!=null&&e.apiKey)}),C=v(()=>d.availableVoices[o]||[]);async function h(e,i,l){const u=a.getProviderInstance(o);if(!u)throw new Error("Failed to initialize speech provider");const m=a.getProviderConfig(o),P=m.model||_;return await d.speech(u,P,e,i,{...m})}return x(async()=>{const e=a.getProviderConfig(o);await a.getProviderMetadata(o).validators.validateProviderConfig(e)?await d.loadVoicesForProvider(o):console.error("Failed to validate provider config",e)}),g(s,async()=>{const e=a.getProviderConfig(o);e.audio||(e.audio={}),e.audio.speedRatio=s.value}),g([t,p],async()=>{const e=a.getProviderConfig(o);await a.getProviderMetadata(o).validators.validateProviderConfig(e)?await d.loadVoicesForProvider(o):console.error("Failed to validate provider config",e)},{immediate:!0}),(e,i)=>(k(),F(r(E),{"provider-id":o,"default-model":_},{"basic-settings":c(()=>[$("div",K,[f(r(V),{modelValue:p.value,"onUpdate:modelValue":i[0]||(i[0]=l=>p.value=l),label:r(n)("settings.pages.providers.provider.volcengine.fields.field.appId.label"),description:r(n)("settings.pages.providers.provider.volcengine.fields.field.appId.description"),required:""},null,8,["modelValue","label","description"])])]),"voice-settings":c(()=>[f(r(y),{modelValue:s.value,"onUpdate:modelValue":i[1]||(i[1]=l=>s.value=l),label:r(n)("settings.pages.providers.provider.common.fields.field.speed.label"),description:r(n)("settings.pages.providers.provider.common.fields.field.speed.description"),min:.5,max:2,step:.01},null,8,["modelValue","label","description"])]),playground:c(()=>[f(r(q),{"available-voices":C.value,"generate-speech":h,"api-key-configured":b.value,"default-text":"Hello! This is a test of the ElevenLabs voice synthesis."},null,8,["available-voices","api-key-configured"])]),_:1}))}});export{ee as default}; diff --git a/assets/worker-Pjvo6JHG.js b/assets/worker-Pjvo6JHG.js deleted file mode 100644 index 98808d9efe8e025812caab5575a47bc39df92e97..0000000000000000000000000000000000000000 --- a/assets/worker-Pjvo6JHG.js +++ /dev/null @@ -1,2846 +0,0 @@ -var NT=Object.defineProperty;var jT=(bs,Sr,Ln)=>Sr in bs?NT(bs,Sr,{enumerable:!0,configurable:!0,writable:!0,value:Ln}):bs[Sr]=Ln;var re=(bs,Sr,Ln)=>jT(bs,typeof Sr!="symbol"?Sr+"":Sr,Ln);(function(){"use strict";const bs=new Map,Sr=[],Ln=(e,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){const s=bs.get(e);if(s===void 0)bs.set(e,{backend:r,priority:t});else{if(s.priority>t)return;if(s.priority===t&&s.backend!==r)throw new Error(`cannot register backend "${e}" using priority ${t}`)}if(t>=0){const i=Sr.indexOf(e);i!==-1&&Sr.splice(i,1);for(let n=0;n{const r=bs.get(e);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{const t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(e)),await r.initPromise,r.initialized=!0,r.backend}catch(s){return t||(r.error=`${s}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},$b=async e=>{const r=e.executionProviders||[],t=r.map(l=>typeof l=="string"?l:l.name),s=t.length===0?Sr:t;let i;const n=[],o=new Set;for(const l of s){const c=await Sb(l);typeof c=="string"?n.push({name:l,err:c}):(i||(i=c),i===c&&o.add(l))}if(!i)throw new Error(`no available backend found. ERR: ${n.map(l=>`[${l.name}] ${l.err}`).join(", ")}`);for(const{name:l,err:c}of n)t.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${c}`);const a=r.filter(l=>o.has(typeof l=="string"?l:l.name));return[i,new Proxy(e,{get:(l,c)=>c==="executionProviders"?a:Reflect.get(l,c)})]},kb="1.21.0";let Ou="warning";const es={wasm:{},webgl:{},webgpu:{},versions:{common:kb},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}`);Ou=e}},get logLevel(){return Ou}};Object.defineProperty(es,"logLevel",{enumerable:!0});const Ib=es,Ab=(e,r)=>{const t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=e.dims[3],t.height=e.dims[2];const s=t.getContext("2d");if(s!=null){let i,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(i=e.dims[2],n=e.dims[3]):(i=e.dims[3],n=e.dims[2]);const o=(r==null?void 0:r.format)!==void 0?r.format:"RGB",a=r==null?void 0:r.norm;let l,c;a===void 0||a.mean===void 0?l=[255,255,255,255]:typeof a.mean=="number"?l=[a.mean,a.mean,a.mean,a.mean]:(l=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(l[3]=a.mean[3])),a===void 0||a.bias===void 0?c=[0,0,0,0]:typeof a.bias=="number"?c=[a.bias,a.bias,a.bias,a.bias]:(c=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(c[3]=a.bias[3]));const p=n*i;let u=0,h=p,g=p*2,_=-1;o==="RGBA"?(u=0,h=p,g=p*2,_=p*3):o==="RGB"?(u=0,h=p,g=p*2):o==="RBG"&&(u=0,g=p,h=p*2);for(let P=0;P{const t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d");let s;if(t!=null){let i,n,o;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(i=e.dims[2],n=e.dims[1],o=e.dims[3]):(i=e.dims[3],n=e.dims[2],o=e.dims[1]);const a=r!==void 0&&r.format!==void 0?r.format:"RGB",l=r==null?void 0:r.norm;let c,p;l===void 0||l.mean===void 0?c=[255,255,255,255]:typeof l.mean=="number"?c=[l.mean,l.mean,l.mean,l.mean]:(c=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(c[3]=l.mean[3])),l===void 0||l.bias===void 0?p=[0,0,0,0]:typeof l.bias=="number"?p=[l.bias,l.bias,l.bias,l.bias]:(p=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(p[3]=l.bias[3]));const u=n*i;if(r!==void 0&&(r.format!==void 0&&o===4&&r.format!=="RGBA"||o===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");const h=4;let g=0,_=1,P=2,A=3,v=0,y=u,k=u*2,E=-1;a==="RGBA"?(v=0,y=u,k=u*2,E=u*3):a==="RGB"?(v=0,y=u,k=u*2):a==="RBG"&&(v=0,k=u,y=u*2),s=t.createImageData(i,n);for(let M=0;M{if(e===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");const{height:t,width:s}=r,i=r.norm??{mean:255,bias:0};let n,o;typeof i.mean=="number"?n=[i.mean,i.mean,i.mean,i.mean]:n=[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],typeof i.bias=="number"?o=[i.bias,i.bias,i.bias,i.bias]:o=[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];const a=r.format!==void 0?r.format:"RGBA",l=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",c=t*s,p=l==="RGBA"?new Float32Array(c*4):new Float32Array(c*3);let u=4,h=0,g=1,_=2,P=3,A=0,v=c,y=c*2,k=-1;a==="RGB"&&(u=3,h=0,g=1,_=2,P=-1),l==="RGBA"?k=c*3:l==="RBG"?(A=0,y=c,v=c*2):l==="BGR"&&(y=0,v=c,A=c*2);for(let M=0;M{const t=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,s=typeof ImageData<"u"&&e instanceof ImageData,i=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string";let o,a=r??{};const l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},c=p=>typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||p instanceof OffscreenCanvas?p.getContext("2d"):null;if(t){const p=l();p.width=e.width,p.height=e.height;const u=c(p);if(u!=null){let h=e.height,g=e.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(h=r.resizedHeight,g=r.resizedWidth),r!==void 0){if(a=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");a.tensorFormat="RGBA",a.height=h,a.width=g}else a.tensorFormat="RGBA",a.height=h,a.width=g;u.drawImage(e,0,0),o=u.getImageData(0,0,g,h).data}else throw new Error("Can not access image data")}else if(s){let p,u;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(p=r.resizedHeight,u=r.resizedWidth):(p=e.height,u=e.width),r!==void 0&&(a=r),a.format="RGBA",a.height=p,a.width=u,r!==void 0){const h=l();h.width=u,h.height=p;const g=c(h);if(g!=null)g.putImageData(e,0,0),o=g.getImageData(0,0,u,p).data;else throw new Error("Can not access image data")}else o=e.data}else if(i){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");const p=l();p.width=e.width,p.height=e.height;const u=c(p);if(u!=null){const h=e.height,g=e.width;return u.drawImage(e,0,0,g,h),o=u.getImageData(0,0,g,h).data,a.height=h,a.width=g,ad(o,a)}else throw new Error("Can not access image data")}else{if(n)return new Promise((p,u)=>{const h=l(),g=c(h);if(!e||!g)return u();const _=new Image;_.crossOrigin="Anonymous",_.src=e,_.onload=()=>{h.width=_.width,h.height=_.height,g.drawImage(_,0,0,h.width,h.height);const P=g.getImageData(0,0,h.width,h.height);a.height=h.height,a.width=h.width,p(ad(P.data,a))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(o!==void 0)return ad(o,a);throw new Error("Input data provided is not supported - aborted tensor creation")},Db=(e,r)=>{const{width:t,height:s,download:i,dispose:n}=r,o=[1,s,t,4];return new Gr({location:"texture",type:"float32",texture:e,dims:o,download:i,dispose:n})},Lb=(e,r)=>{const{dataType:t,dims:s,download:i,dispose:n}=r;return new Gr({location:"gpu-buffer",type:t??"float32",gpuBuffer:e,dims:s,download:i,dispose:n})},zb=(e,r)=>{const{dataType:t,dims:s,download:i,dispose:n}=r;return new Gr({location:"ml-tensor",type:t??"float32",mlTensor:e,dims:s,download:i,dispose:n})},Bb=(e,r,t)=>new Gr({location:"cpu-pinned",type:e,data:r,dims:t??[r.length]}),zn=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),ma=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);let Du=!1;const Rb=()=>{if(!Du){Du=!0;const e=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=globalThis.Float16Array,s=typeof t<"u"&&t.from;e&&(zn.set("int64",BigInt64Array),ma.set(BigInt64Array,"int64")),r&&(zn.set("uint64",BigUint64Array),ma.set(BigUint64Array,"uint64")),s?(zn.set("float16",t),ma.set(t,"float16")):zn.set("float16",Uint16Array)}},Nb=e=>{let r=1;for(let t=0;t{switch(e.location){case"cpu":return new Gr(e.type,e.data,r);case"cpu-pinned":return new Gr({location:"cpu-pinned",data:e.data,type:e.type,dims:r});case"texture":return new Gr({location:"texture",texture:e.texture,type:e.type,dims:r});case"gpu-buffer":return new Gr({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:r});case"ml-tensor":return new Gr({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}};let Gr=class{constructor(r,t,s){Rb();let i,n;if(typeof r=="object"&&"location"in r)switch(this.dataLocation=r.location,i=r.type,n=r.dims,r.location){case"cpu-pinned":{const a=zn.get(i);if(!a)throw new TypeError(`unsupported type "${i}" to create tensor from pinned buffer`);if(!(r.data instanceof a))throw new TypeError(`buffer should be of type ${a.name}`);this.cpuData=r.data;break}case"texture":{if(i!=="float32")throw new TypeError(`unsupported type "${i}" to create tensor from texture`);this.gpuTextureData=r.texture,this.downloader=r.download,this.disposer=r.dispose;break}case"gpu-buffer":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from gpu buffer`);this.gpuBufferData=r.gpuBuffer,this.downloader=r.download,this.disposer=r.dispose;break}case"ml-tensor":{if(i!=="float32"&&i!=="float16"&&i!=="int32"&&i!=="int64"&&i!=="uint32"&&i!=="uint64"&&i!=="int8"&&i!=="uint8"&&i!=="bool"&&i!=="uint4"&&i!=="int4")throw new TypeError(`unsupported type "${i}" to create tensor from MLTensor`);this.mlTensorData=r.mlTensor,this.downloader=r.download,this.disposer=r.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,l;if(typeof r=="string")if(i=r,l=s,r==="string"){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");a=t}else{const c=zn.get(r);if(c===void 0)throw new TypeError(`Unsupported tensor type: ${r}.`);if(Array.isArray(t)){if(r==="float16"&&c===Uint16Array||r==="uint4"||r==="int4")throw new TypeError(`Creating a ${r} tensor from number array is not supported. Please use ${c.name} as data.`);r==="uint64"||r==="int64"?a=c.from(t,BigInt):a=c.from(t)}else if(t instanceof c)a=t;else if(t instanceof Uint8ClampedArray)if(r==="uint8")a=Uint8Array.from(t);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(r==="float16"&&t instanceof Uint16Array&&c!==Uint16Array)a=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw new TypeError(`A ${i} tensor's data must be type of ${c}`)}else if(l=t,Array.isArray(r)){if(r.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");const c=typeof r[0];if(c==="string")i="string",a=r;else if(c==="boolean")i="bool",a=Uint8Array.from(r);else throw new TypeError(`Invalid element type of data array: ${c}.`)}else if(r instanceof Uint8ClampedArray)i="uint8",a=Uint8Array.from(r);else{const c=ma.get(r.constructor);if(c===void 0)throw new TypeError(`Unsupported type for tensor data: ${r.constructor}.`);i=c,a=r}if(l===void 0)l=[a.length];else if(!Array.isArray(l))throw new TypeError("A tensor's dims must be a number array");n=l,this.cpuData=a,this.dataLocation="cpu"}const o=Nb(n);if(this.cpuData&&o!==this.cpuData.length&&!((i==="uint4"||i==="int4")&&Math.ceil(o/2)===this.cpuData.length))throw new Error(`Tensor's size(${o}) does not match data length(${this.cpuData.length}).`);this.type=i,this.dims=n,this.size=o}static async fromImage(r,t){return Ob(r,t)}static fromTexture(r,t){return Db(r,t)}static fromGpuBuffer(r,t){return Lb(r,t)}static fromMLTensor(r,t){return zb(r,t)}static fromPinnedBuffer(r,t,s){return Bb(r,t,s)}toDataURL(r){return Ab(this,r)}toImageData(r){return Fb(this,r)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(r){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;const t=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=t,r&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(r){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return jb(this,r)}};const Bn=Gr,Lu=(e,r)=>{(typeof es.trace>"u"?!es.wasm.trace:!es.trace)||console.timeStamp(`${e}::ORT::${r}`)},zu=(e,r)=>{var i;const t=((i=new Error().stack)==null?void 0:i.split(/\r\n|\r|\n/g))||[];let s=!1;for(let n=0;n{(typeof es.trace>"u"?!es.wasm.trace:!es.trace)||zu("BEGIN",e)},dd=e=>{(typeof es.trace>"u"?!es.wasm.trace:!es.trace)||zu("END",e)};var Vb=Object.freeze({__proto__:null,InferenceSession:class Eb{constructor(r){this.handler=r}async run(r,t,s){ld();const i={};let n={};if(typeof r!="object"||r===null||r instanceof Bn||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let o=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof Bn)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");o=!1;for(const c of t){if(typeof c!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(c)===-1)throw new RangeError(`'fetches' contains invalid output name: ${c}.`);i[c]=null}if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else{let c=!1;const p=Object.getOwnPropertyNames(t);for(const u of this.outputNames)if(p.indexOf(u)!==-1){const h=t[u];(h===null||h instanceof Bn)&&(c=!0,o=!1,i[u]=h)}if(c){if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else n=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(const c of this.inputNames)if(typeof r[c]>"u")throw new Error(`input '${c}' is missing in 'feeds'.`);if(o)for(const c of this.outputNames)i[c]=null;const a=await this.handler.run(r,i,n),l={};for(const c in a)if(Object.hasOwnProperty.call(a,c)){const p=a[c];p instanceof Bn?l[c]=p:l[c]=new Bn(p.type,p.data,p.dims)}return dd(),l}async release(){return this.handler.dispose()}static async create(r,t,s,i){ld();let n,o={};if(typeof r=="string"){if(n=r,typeof t=="object"&&t!==null)o=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof t=="object"&&t!==null)o=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){const p=r;let u=0,h=r.byteLength;if(typeof t=="object"&&t!==null)o=t;else if(typeof t=="number"){if(u=t,!Number.isSafeInteger(u))throw new RangeError("'byteOffset' must be an integer.");if(u<0||u>=p.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${p.byteLength}).`);if(h=r.byteLength-u,typeof s=="number"){if(h=s,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||u+h>p.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${p.byteLength-u}].`);if(typeof i=="object"&&i!==null)o=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else if(typeof s<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(p,u,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const[a,l]=await $b(o),c=await a.createInferenceSessionHandler(n,l);return dd(),new Eb(c)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}},TRACE:Lu,TRACE_FUNC_BEGIN:ld,TRACE_FUNC_END:dd,Tensor:Bn,env:Ib,registerBackend:Ln});/*! - * ONNX Runtime Web v1.22.0-dev.20250306-ccf8fdd9ea - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. - */var cd=Object.defineProperty,Ub=Object.getOwnPropertyDescriptor,Wb=Object.getOwnPropertyNames,Gb=Object.prototype.hasOwnProperty,Kb=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Ve=(e,r)=>()=>(e&&(r=e(e=0)),r),Si=(e,r)=>{for(var t in r)cd(e,t,{get:r[t],enumerable:!0})},Hb=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Wb(r))!Gb.call(e,i)&&i!==t&&cd(e,i,{get:()=>r[i],enumerable:!(s=Ub(r,i))||s.enumerable});return e},fa=e=>Hb(cd({},"__esModule",{value:!0}),e),$i,Ws,un,Bu,Ru,Nu=Ve(()=>{$i=new Map,Ws=[],un=(e,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){let s=$i.get(e);if(s===void 0)$i.set(e,{backend:r,priority:t});else{if(s.priority>t)return;if(s.priority===t&&s.backend!==r)throw new Error(`cannot register backend "${e}" using priority ${t}`)}if(t>=0){let i=Ws.indexOf(e);i!==-1&&Ws.splice(i,1);for(let n=0;n{let r=$i.get(e);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{let t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(e)),await r.initPromise,r.initialized=!0,r.backend}catch(s){return t||(r.error=`${s}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},Ru=async e=>{let r=e.executionProviders||[],t=r.map(l=>typeof l=="string"?l:l.name),s=t.length===0?Ws:t,i,n=[],o=new Set;for(let l of s){let c=await Bu(l);typeof c=="string"?n.push({name:l,err:c}):(i||(i=c),i===c&&o.add(l))}if(!i)throw new Error(`no available backend found. ERR: ${n.map(l=>`[${l.name}] ${l.err}`).join(", ")}`);for(let{name:l,err:c}of n)t.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${c}`);let a=r.filter(l=>o.has(typeof l=="string"?l:l.name));return[i,new Proxy(e,{get:(l,c)=>c==="executionProviders"?a:Reflect.get(l,c)})]}}),qb=Ve(()=>{Nu()}),ju,Qb=Ve(()=>{ju="1.22.0-dev.20250306-aafa8d170a"}),ud,Kr,Vu=Ve(()=>{Qb(),ud="warning",Kr={wasm:{},webgl:{},webgpu:{},versions:{common:ju},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}`);ud=e}},get logLevel(){return ud}},Object.defineProperty(Kr,"logLevel",{enumerable:!0})}),Ut,Xb=Ve(()=>{Vu(),Ut=Kr}),Uu,Wu,Jb=Ve(()=>{Uu=(e,r)=>{let t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=e.dims[3],t.height=e.dims[2];let s=t.getContext("2d");if(s!=null){let i,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(i=e.dims[2],n=e.dims[3]):(i=e.dims[3],n=e.dims[2]);let o=(r==null?void 0:r.format)!==void 0?r.format:"RGB",a=r==null?void 0:r.norm,l,c;a===void 0||a.mean===void 0?l=[255,255,255,255]:typeof a.mean=="number"?l=[a.mean,a.mean,a.mean,a.mean]:(l=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(l[3]=a.mean[3])),a===void 0||a.bias===void 0?c=[0,0,0,0]:typeof a.bias=="number"?c=[a.bias,a.bias,a.bias,a.bias]:(c=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(c[3]=a.bias[3]));let p=n*i,u=0,h=p,g=p*2,_=-1;o==="RGBA"?(u=0,h=p,g=p*2,_=p*3):o==="RGB"?(u=0,h=p,g=p*2):o==="RBG"&&(u=0,g=p,h=p*2);for(let P=0;P{let t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),s;if(t!=null){let i,n,o;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(i=e.dims[2],n=e.dims[1],o=e.dims[3]):(i=e.dims[3],n=e.dims[2],o=e.dims[1]);let a=r!==void 0&&r.format!==void 0?r.format:"RGB",l=r==null?void 0:r.norm,c,p;l===void 0||l.mean===void 0?c=[255,255,255,255]:typeof l.mean=="number"?c=[l.mean,l.mean,l.mean,l.mean]:(c=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(c[3]=l.mean[3])),l===void 0||l.bias===void 0?p=[0,0,0,0]:typeof l.bias=="number"?p=[l.bias,l.bias,l.bias,l.bias]:(p=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(p[3]=l.bias[3]));let u=n*i;if(r!==void 0&&(r.format!==void 0&&o===4&&r.format!=="RGBA"||o===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let h=4,g=0,_=1,P=2,A=3,v=0,y=u,k=u*2,E=-1;a==="RGBA"?(v=0,y=u,k=u*2,E=u*3):a==="RGB"?(v=0,y=u,k=u*2):a==="RBG"&&(v=0,k=u,y=u*2),s=t.createImageData(i,n);for(let M=0;M{hd(),_a=(e,r)=>{if(e===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:t,width:s}=r,i=r.norm??{mean:255,bias:0},n,o;typeof i.mean=="number"?n=[i.mean,i.mean,i.mean,i.mean]:n=[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],typeof i.bias=="number"?o=[i.bias,i.bias,i.bias,i.bias]:o=[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];let a=r.format!==void 0?r.format:"RGBA",l=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",c=t*s,p=l==="RGBA"?new Float32Array(c*4):new Float32Array(c*3),u=4,h=0,g=1,_=2,P=3,A=0,v=c,y=c*2,k=-1;a==="RGB"&&(u=3,h=0,g=1,_=2,P=-1),l==="RGBA"?k=c*3:l==="RBG"?(A=0,y=c,v=c*2):l==="BGR"&&(y=0,v=c,A=c*2);for(let E=0;E{let t=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,s=typeof ImageData<"u"&&e instanceof ImageData,i=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string",o,a=r??{},l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},c=p=>typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||p instanceof OffscreenCanvas?p.getContext("2d"):null;if(t){let p=l();p.width=e.width,p.height=e.height;let u=c(p);if(u!=null){let h=e.height,g=e.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(h=r.resizedHeight,g=r.resizedWidth),r!==void 0){if(a=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");a.tensorFormat="RGBA",a.height=h,a.width=g}else a.tensorFormat="RGBA",a.height=h,a.width=g;u.drawImage(e,0,0),o=u.getImageData(0,0,g,h).data}else throw new Error("Can not access image data")}else if(s){let p,u;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(p=r.resizedHeight,u=r.resizedWidth):(p=e.height,u=e.width),r!==void 0&&(a=r),a.format="RGBA",a.height=p,a.width=u,r!==void 0){let h=l();h.width=u,h.height=p;let g=c(h);if(g!=null)g.putImageData(e,0,0),o=g.getImageData(0,0,u,p).data;else throw new Error("Can not access image data")}else o=e.data}else if(i){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");let p=l();p.width=e.width,p.height=e.height;let u=c(p);if(u!=null){let h=e.height,g=e.width;return u.drawImage(e,0,0,g,h),o=u.getImageData(0,0,g,h).data,a.height=h,a.width=g,_a(o,a)}else throw new Error("Can not access image data")}else{if(n)return new Promise((p,u)=>{let h=l(),g=c(h);if(!e||!g)return u();let _=new Image;_.crossOrigin="Anonymous",_.src=e,_.onload=()=>{h.width=_.width,h.height=_.height,g.drawImage(_,0,0,h.width,h.height);let P=g.getImageData(0,0,h.width,h.height);a.height=h.height,a.width=h.width,p(_a(P.data,a))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(o!==void 0)return _a(o,a);throw new Error("Input data provided is not supported - aborted tensor creation")},Ku=(e,r)=>{let{width:t,height:s,download:i,dispose:n}=r,o=[1,s,t,4];return new Br({location:"texture",type:"float32",texture:e,dims:o,download:i,dispose:n})},Hu=(e,r)=>{let{dataType:t,dims:s,download:i,dispose:n}=r;return new Br({location:"gpu-buffer",type:t??"float32",gpuBuffer:e,dims:s,download:i,dispose:n})},qu=(e,r)=>{let{dataType:t,dims:s,download:i,dispose:n}=r;return new Br({location:"ml-tensor",type:t??"float32",mlTensor:e,dims:s,download:i,dispose:n})},Qu=(e,r,t)=>new Br({location:"cpu-pinned",type:e,data:r,dims:t??[r.length]})}),pn,ki,pd,Xu,Zb=Ve(()=>{pn=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),ki=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),pd=!1,Xu=()=>{if(!pd){pd=!0;let e=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=globalThis.Float16Array,s=typeof t<"u"&&t.from;e&&(pn.set("int64",BigInt64Array),ki.set(BigInt64Array,"int64")),r&&(pn.set("uint64",BigUint64Array),ki.set(BigUint64Array,"uint64")),s?(pn.set("float16",t),ki.set(t,"float16")):pn.set("float16",Uint16Array)}}}),Ju,Yu,ev=Ve(()=>{hd(),Ju=e=>{let r=1;for(let t=0;t{switch(e.location){case"cpu":return new Br(e.type,e.data,r);case"cpu-pinned":return new Br({location:"cpu-pinned",data:e.data,type:e.type,dims:r});case"texture":return new Br({location:"texture",texture:e.texture,type:e.type,dims:r});case"gpu-buffer":return new Br({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:r});case"ml-tensor":return new Br({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}}}),Br,hd=Ve(()=>{Jb(),Yb(),Zb(),ev(),Br=class{constructor(e,r,t){Xu();let s,i;if(typeof e=="object"&&"location"in e)switch(this.dataLocation=e.location,s=e.type,i=e.dims,e.location){case"cpu-pinned":{let o=pn.get(s);if(!o)throw new TypeError(`unsupported type "${s}" to create tensor from pinned buffer`);if(!(e.data instanceof o))throw new TypeError(`buffer should be of type ${o.name}`);this.cpuData=e.data;break}case"texture":{if(s!=="float32")throw new TypeError(`unsupported type "${s}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break}case"gpu-buffer":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint8"&&s!=="bool"&&s!=="uint4"&&s!=="int4")throw new TypeError(`unsupported type "${s}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break}case"ml-tensor":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint64"&&s!=="int8"&&s!=="uint8"&&s!=="bool"&&s!=="uint4"&&s!=="int4")throw new TypeError(`unsupported type "${s}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let o,a;if(typeof e=="string")if(s=e,a=t,e==="string"){if(!Array.isArray(r))throw new TypeError("A string tensor's data must be a string array.");o=r}else{let l=pn.get(e);if(l===void 0)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(r)){if(e==="float16"&&l===Uint16Array||e==="uint4"||e==="int4")throw new TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${l.name} as data.`);e==="uint64"||e==="int64"?o=l.from(r,BigInt):o=l.from(r)}else if(r instanceof l)o=r;else if(r instanceof Uint8ClampedArray)if(e==="uint8")o=Uint8Array.from(r);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(e==="float16"&&r instanceof Uint16Array&&l!==Uint16Array)o=new globalThis.Float16Array(r.buffer,r.byteOffset,r.length);else throw new TypeError(`A ${s} tensor's data must be type of ${l}`)}else if(a=r,Array.isArray(e)){if(e.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let l=typeof e[0];if(l==="string")s="string",o=e;else if(l==="boolean")s="bool",o=Uint8Array.from(e);else throw new TypeError(`Invalid element type of data array: ${l}.`)}else if(e instanceof Uint8ClampedArray)s="uint8",o=Uint8Array.from(e);else{let l=ki.get(e.constructor);if(l===void 0)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);s=l,o=e}if(a===void 0)a=[o.length];else if(!Array.isArray(a))throw new TypeError("A tensor's dims must be a number array");i=a,this.cpuData=o,this.dataLocation="cpu"}let n=Ju(i);if(this.cpuData&&n!==this.cpuData.length&&!((s==="uint4"||s==="int4")&&Math.ceil(n/2)===this.cpuData.length))throw new Error(`Tensor's size(${n}) does not match data length(${this.cpuData.length}).`);this.type=s,this.dims=i,this.size=n}static async fromImage(e,r){return Gu(e,r)}static fromTexture(e,r){return Ku(e,r)}static fromGpuBuffer(e,r){return Hu(e,r)}static fromMLTensor(e,r){return qu(e,r)}static fromPinnedBuffer(e,r,t){return Qu(e,r,t)}toDataURL(e){return Uu(this,e)}toImageData(e){return Wu(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let r=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=r,e&&this.disposer&&(this.disposer(),this.disposer=void 0),r}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Yu(this,e)}}}),ts,Zu=Ve(()=>{hd(),ts=Br}),Ii,md,rs,Hr,ep=Ve(()=>{Vu(),Ii=(e,r)=>{(typeof Kr.trace>"u"?!Kr.wasm.trace:!Kr.trace)||console.timeStamp(`${e}::ORT::${r}`)},md=(e,r)=>{var i;let t=((i=new Error().stack)==null?void 0:i.split(/\r\n|\r|\n/g))||[],s=!1;for(let n=0;n{(typeof Kr.trace>"u"?!Kr.wasm.trace:!Kr.trace)||md("BEGIN",e)},Hr=e=>{(typeof Kr.trace>"u"?!Kr.wasm.trace:!Kr.trace)||md("END",e)}}),tp,tv=Ve(()=>{Nu(),Zu(),ep(),tp=class Pb{constructor(r){this.handler=r}async run(r,t,s){rs();let i={},n={};if(typeof r!="object"||r===null||r instanceof ts||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let o=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof ts)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");o=!1;for(let c of t){if(typeof c!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(c)===-1)throw new RangeError(`'fetches' contains invalid output name: ${c}.`);i[c]=null}if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else{let c=!1,p=Object.getOwnPropertyNames(t);for(let u of this.outputNames)if(p.indexOf(u)!==-1){let h=t[u];(h===null||h instanceof ts)&&(c=!0,o=!1,i[u]=h)}if(c){if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else n=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let c of this.inputNames)if(typeof r[c]>"u")throw new Error(`input '${c}' is missing in 'feeds'.`);if(o)for(let c of this.outputNames)i[c]=null;let a=await this.handler.run(r,i,n),l={};for(let c in a)if(Object.hasOwnProperty.call(a,c)){let p=a[c];p instanceof ts?l[c]=p:l[c]=new ts(p.type,p.data,p.dims)}return Hr(),l}async release(){return this.handler.dispose()}static async create(r,t,s,i){rs();let n,o={};if(typeof r=="string"){if(n=r,typeof t=="object"&&t!==null)o=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof t=="object"&&t!==null)o=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){let p=r,u=0,h=r.byteLength;if(typeof t=="object"&&t!==null)o=t;else if(typeof t=="number"){if(u=t,!Number.isSafeInteger(u))throw new RangeError("'byteOffset' must be an integer.");if(u<0||u>=p.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${p.byteLength}).`);if(h=r.byteLength-u,typeof s=="number"){if(h=s,!Number.isSafeInteger(h))throw new RangeError("'byteLength' must be an integer.");if(h<=0||u+h>p.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${p.byteLength-u}].`);if(typeof i=="object"&&i!==null)o=i;else if(typeof i<"u")throw new TypeError("'options' must be an object.")}else if(typeof s<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(p,u,h)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[a,l]=await Ru(o),c=await a.createInferenceSessionHandler(n,l);return Hr(),new Pb(c)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}}}),fd,rv=Ve(()=>{tv(),fd=tp}),sv=Ve(()=>{}),nv=Ve(()=>{}),iv=Ve(()=>{}),ov=Ve(()=>{}),rp={};Si(rp,{InferenceSession:()=>fd,TRACE:()=>Ii,TRACE_FUNC_BEGIN:()=>rs,TRACE_FUNC_END:()=>Hr,Tensor:()=>ts,env:()=>Ut,registerBackend:()=>un});var ss=Ve(()=>{qb(),Xb(),rv(),Zu(),sv(),nv(),ep(),iv(),ov()}),_d=Ve(()=>{}),sp={};Si(sp,{default:()=>np});var gd,wd,np,av=Ve(()=>{var e;Dw(),hn(),Pd(),gd="ort-wasm-proxy-worker",wd=((e=globalThis.self)==null?void 0:e.name)===gd,wd&&(self.onmessage=r=>{let{type:t,in:s}=r.data;try{switch(t){case"init-wasm":$d(s.wasm).then(()=>{Bc(s).then(()=>{postMessage({type:t})},i=>{postMessage({type:t,err:i})})},i=>{postMessage({type:t,err:i})});break;case"init-ep":{let{epName:i,env:n}=s;Rc(n,i).then(()=>{postMessage({type:t})},o=>{postMessage({type:t,err:o})});break}case"copy-from":{let{buffer:i}=s,n=Oa(i);postMessage({type:t,out:n});break}case"create":{let{model:i,options:n}=s;Nc(i,n).then(o=>{postMessage({type:t,out:o})},o=>{postMessage({type:t,err:o})});break}case"release":jc(s),postMessage({type:t});break;case"run":{let{sessionId:i,inputIndices:n,inputs:o,outputIndices:a,options:l}=s;Uc(i,n,o,a,new Array(a.length).fill(null),l).then(c=>{c.some(p=>p[3]!=="cpu")?postMessage({type:t,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:t,out:c},Gc([...o,...c]))},c=>{postMessage({type:t,err:c})});break}case"end-profiling":Wc(s),postMessage({type:t});break;default:}}catch(i){postMessage({type:t,err:i})}}),np=wd?null:r=>new Worker(r??Rr,{type:"module",name:gd})}),ip={};Si(ip,{default:()=>op});var yd,Md,op,ap,lv=Ve(()=>{var e,r;Md=(yd=self.location.href,async function(t={}){var ua;var s,i,n=t,o=new Promise((d,m)=>{s=d,i=m}),a=typeof window=="object",l=typeof WorkerGlobalScope<"u",c=l&&((ua=self.name)==null?void 0:ua.startsWith("em-pthread"));n.mountExternalData=(d,m)=>{d.startsWith("./")&&(d=d.substring(2)),(n.Bd||(n.Bd=new Map)).set(d,m)},n.unmountExternalData=()=>{delete n.Bd};var p=globalThis.SharedArrayBuffer??new WebAssembly.Memory({initial:0,maximum:0,shared:!0}).buffer.constructor;let u=()=>{let d=(T,C,I)=>(...W)=>{let ne=Rt,ye=C==null?void 0:C();W=T(...W);let Ee=C==null?void 0:C();return ye!==Ee&&(T=Ee,I(ye),C=I=null),Rt!=ne?new Promise((ze,Ye)=>{sn={resolve:ze,reject:Ye}}):W},m=T=>async(...C)=>{var I;try{if(n.Cd)throw Error("Session already started");let W=n.Cd={be:C[0],errors:[]},ne=await T(...C);if(n.Cd!==W)throw Error("Session mismatch");(I=n.Dd)==null||I.flush();let ye=W.errors;if(0ze),0n._OrtCreateSession,T=>n._OrtCreateSession=T),n._OrtRun=m(d(n._OrtRun,()=>n._OrtRun,T=>n._OrtRun=T)),n._OrtRunWithBinding=m(d(n._OrtRunWithBinding,()=>n._OrtRunWithBinding,T=>n._OrtRunWithBinding=T)),n._OrtBindInput=d(n._OrtBindInput,()=>n._OrtBindInput,T=>n._OrtBindInput=T),u=void 0};n.jsepInit=(d,m)=>{if(u==null||u(),d==="webgpu"){[n.Dd,n.Rd,n.Vd,n.Hd,n.Ud,n.hc,n.Wd,n.Zd,n.Sd,n.Td,n.Xd]=m;let T=n.Dd;n.jsepRegisterBuffer=(C,I,W,ne)=>T.registerBuffer(C,I,W,ne),n.jsepGetBuffer=C=>T.getBuffer(C),n.jsepCreateDownloader=(C,I,W)=>T.createDownloader(C,I,W),n.jsepOnCreateSession=C=>{T.onCreateSession(C)},n.jsepOnReleaseSession=C=>{T.onReleaseSession(C)},n.jsepOnRunStart=C=>T.onRunStart(C),n.$d=(C,I)=>{T.upload(C,I)}}else if(d==="webnn"){[n.Dd,n.Yd,n.Id,n.jsepEnsureTensor,n.Jd,n.jsepDownloadTensor]=m,n.jsepReleaseTensorId=n.Id,n.jsepUploadTensor=n.Jd;let T=n.Dd;n.jsepOnRunStart=C=>T.onRunStart(C),n.jsepOnRunEnd=T.onRunEnd.bind(T),n.jsepRegisterMLContext=(C,I)=>{T.registerMLContext(C,I)},n.jsepOnReleaseSession=C=>{T.onReleaseSession(C)},n.jsepCreateMLTensorDownloader=(C,I)=>T.createMLTensorDownloader(C,I),n.jsepRegisterMLTensor=(C,I,W,ne)=>T.registerMLTensor(C,I,W,ne),n.jsepCreateMLContext=C=>T.createMLContext(C),n.jsepRegisterMLConstant=(C,I,W,ne,ye)=>T.registerMLConstant(C,I,W,ne,ye,n.Bd),n.jsepRegisterGraphInput=T.registerGraphInput.bind(T),n.jsepIsGraphInput=T.isGraphInput.bind(T),n.jsepCreateTemporaryTensor=T.createTemporaryTensor.bind(T)}};var h,g,_=Object.assign({},n),P=(d,m)=>{throw m},A="";(a||l)&&(l?A=self.location.href:typeof document<"u"&&document.currentScript&&(A=document.currentScript.src),yd&&(A=yd),A=A.startsWith("blob:")?"":A.slice(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1),l&&(g=d=>{var m=new XMLHttpRequest;return m.open("GET",d,!1),m.responseType="arraybuffer",m.send(null),new Uint8Array(m.response)}),h=async d=>{if(he(d))return new Promise((T,C)=>{var I=new XMLHttpRequest;I.open("GET",d,!0),I.responseType="arraybuffer",I.onload=()=>{I.status==200||I.status==0&&I.response?T(I.response):C(I.status)},I.onerror=C,I.send(null)});var m=await fetch(d,{credentials:"same-origin"});if(m.ok)return m.arrayBuffer();throw Error(m.status+" : "+m.url)});var v=console.log.bind(console),y=console.error.bind(console),k=v,E=y;Object.assign(n,_),_=null;var M,w,x,$,z,R,Q,q,U,Z,H,J,ie,ae=n.wasmBinary,ce=!1,he=d=>d.startsWith("file://");function N(){return M.buffer!=$.buffer&&K(),$}function O(){return M.buffer!=$.buffer&&K(),z}function G(){return M.buffer!=$.buffer&&K(),R}function se(){return M.buffer!=$.buffer&&K(),Q}function X(){return M.buffer!=$.buffer&&K(),q}function we(){return M.buffer!=$.buffer&&K(),U}function _e(){return M.buffer!=$.buffer&&K(),Z}function ke(){return M.buffer!=$.buffer&&K(),ie}if(c){let d=function(m){try{var T=m.data,C=T.yd;if(C==="load"){let I=[];self.onmessage=W=>I.push(W),self.startWorker=()=>{postMessage({yd:"loaded"});for(let W of I)d(W);self.onmessage=d};for(let W of T.Od)n[W]&&!n[W].proxy||(n[W]=(...ne)=>{postMessage({yd:"callHandler",Nd:W,args:ne})},W=="print"&&(k=n[W]),W=="printErr"&&(E=n[W]));M=T.he,K(),He(T.ie)}else if(C==="run"){Os(T.xd),ri(T.xd,0,0,1,0,0),jt(),Ot(T.xd),Me||(ti(),Me=!0);try{Dr(T.de,T.Fd)}catch(I){if(I!="unwind")throw I}}else T.target!=="setimmediate"&&(C==="checkMailbox"?Me&&Vt():C&&(E(`worker: received unknown command ${C}`),E(T)))}catch(I){throw po(),I}};var He,Me=!1;E=function(...m){m=m.join(" "),console.error(m)},self.alert=function(...m){postMessage({yd:"alert",text:m.join(" "),fe:In()})},self.onunhandledrejection=m=>{throw m.reason||m},self.onmessage=d}function K(){var d=M.buffer;n.HEAP8=$=new Int8Array(d),n.HEAP16=R=new Int16Array(d),n.HEAPU8=z=new Uint8Array(d),n.HEAPU16=Q=new Uint16Array(d),n.HEAP32=q=new Int32Array(d),n.HEAPU32=U=new Uint32Array(d),n.HEAPF32=Z=new Float32Array(d),n.HEAPF64=ie=new Float64Array(d),n.HEAP64=H=new BigInt64Array(d),n.HEAPU64=J=new BigUint64Array(d)}function j(){c?startWorker(n):Oe.Bb()}c||(M=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),K());var me,Pe=0,xe=null;function Ae(){if(--Pe==0&&xe){var d=xe;xe=null,d()}}function Ie(d){throw E(d="Aborted("+d+")"),ce=!0,d=new WebAssembly.RuntimeError(d+". Build with -sASSERTIONS for more info."),i(d),d}function Le(){return{a:{Ta:D,Va:We,W:Ds,la:dt,b:Ts,u:xs,R:Es,Za:Ls,d:mr,pb:et,g:Vr,T:kr,Ga:ps,lb:ms,nb:fs,Ha:Qr,Ea:Ps,wb:Qs,Da:Xs,pa:Js,mb:Ys,jb:_s,Fa:Zs,kb:en,Ma:Cs,za:xn,eb:En,cb:Ss,ya:pe,V:F,N:V,db:Y,ma:ht,fb:Ct,zb:kt,hb:vr,qb:Yr,ab:Tr,Aa:gs,yb:Ot,Ja:Gt,S:Zr,Wa:ws,$:Ba,H:Ra,E:ja,l:Jr,F:Ki,B:Wa,X:Hi,J:Ga,v:qi,O:Jc,D:Ka,t:Qi,A:Ha,z:Kn,w:qa,r:Qa,tb:Xa,ub:Ja,vb:Hn,rb:qn,sb:Zi,bb:eo,Oa:Yc,La:Zc,y:Za,ja:el,Ba:tl,Ka:Ya,qa:rl,Ia:sl,ib:Jn,U:Vs,fa:nl,Sa:il,gb:ol,Qa:ro,Pa:al,Ab:no,Ca:Zn,ob:je,aa:io,oa:oo,xb:ei,na:ao,$a:Cl,ia:la,sa:zl,ga:sa,da:Il,ua:xi,p:xl,e:pl,c:cl,ea:ia,f:hl,n:ml,k:ta,Y:_l,ka:vl,j:El,wa:$l,Ra:ca,ca:aa,Ua:Rl,P:kl,K:ea,_:oa,Q:Pl,Z:Dl,x:gl,m:ul,va:Fl,i:Yo,h:fl,ra:Bl,ta:da,o:Zo,q:wl,s:Ml,I:bl,C:ra,L:Tl,xa:Sl,_a:na,G:Ol,Ya:Ti,ba:Ll,M:yl,Xa:Al,ha:lo,a:M,Na:Re}}}var Ne={1320978:()=>typeof wasmOffsetConverter<"u",1321035:(d,m,T,C,I)=>{if(n===void 0||!n.Bd)return 1;if((d=zt(Number(d>>>0))).startsWith("./")&&(d=d.substring(2)),!(d=n.Bd.get(d)))return 2;if(m=Number(m>>>0),T=Number(T>>>0),C=Number(C>>>0),m+T>d.byteLength)return 3;try{let W=d.subarray(m,m+T);switch(I){case 0:O().set(W,C>>>0);break;case 1:n.$d(C,W);break;default:return 4}return 0}catch{return 4}},1321750:(d,m,T)=>{n.Jd(d,O().subarray(m>>>0,m+T>>>0))},1321813:()=>n.Yd(),1321854:d=>{n.Id(d)},1321890:()=>{n.Sd()},1321921:()=>{n.Td()},1321950:()=>{n.Xd()},1321975:d=>n.Rd(d),1322008:d=>n.Vd(d),1322040:(d,m,T)=>{n.Hd(Number(d),Number(m),Number(T),!0)},1322103:(d,m,T)=>{n.Hd(Number(d),Number(m),Number(T))},1322160:d=>{n.hc("Abs",d,void 0)},1322211:d=>{n.hc("Neg",d,void 0)},1322262:d=>{n.hc("Floor",d,void 0)},1322315:d=>{n.hc("Ceil",d,void 0)},1322367:d=>{n.hc("Reciprocal",d,void 0)},1322425:d=>{n.hc("Sqrt",d,void 0)},1322477:d=>{n.hc("Exp",d,void 0)},1322528:d=>{n.hc("Erf",d,void 0)},1322579:d=>{n.hc("Sigmoid",d,void 0)},1322634:(d,m,T)=>{n.hc("HardSigmoid",d,{alpha:m,beta:T})},1322713:d=>{n.hc("Log",d,void 0)},1322764:d=>{n.hc("Sin",d,void 0)},1322815:d=>{n.hc("Cos",d,void 0)},1322866:d=>{n.hc("Tan",d,void 0)},1322917:d=>{n.hc("Asin",d,void 0)},1322969:d=>{n.hc("Acos",d,void 0)},1323021:d=>{n.hc("Atan",d,void 0)},1323073:d=>{n.hc("Sinh",d,void 0)},1323125:d=>{n.hc("Cosh",d,void 0)},1323177:d=>{n.hc("Asinh",d,void 0)},1323230:d=>{n.hc("Acosh",d,void 0)},1323283:d=>{n.hc("Atanh",d,void 0)},1323336:d=>{n.hc("Tanh",d,void 0)},1323388:d=>{n.hc("Not",d,void 0)},1323439:(d,m,T)=>{n.hc("Clip",d,{min:m,max:T})},1323508:d=>{n.hc("Clip",d,void 0)},1323560:(d,m)=>{n.hc("Elu",d,{alpha:m})},1323618:d=>{n.hc("Gelu",d,void 0)},1323670:d=>{n.hc("Relu",d,void 0)},1323722:(d,m)=>{n.hc("LeakyRelu",d,{alpha:m})},1323786:(d,m)=>{n.hc("ThresholdedRelu",d,{alpha:m})},1323856:(d,m)=>{n.hc("Cast",d,{to:m})},1323914:d=>{n.hc("Add",d,void 0)},1323965:d=>{n.hc("Sub",d,void 0)},1324016:d=>{n.hc("Mul",d,void 0)},1324067:d=>{n.hc("Div",d,void 0)},1324118:d=>{n.hc("Pow",d,void 0)},1324169:d=>{n.hc("Equal",d,void 0)},1324222:d=>{n.hc("Greater",d,void 0)},1324277:d=>{n.hc("GreaterOrEqual",d,void 0)},1324339:d=>{n.hc("Less",d,void 0)},1324391:d=>{n.hc("LessOrEqual",d,void 0)},1324450:(d,m,T,C,I)=>{n.hc("ReduceMean",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1324625:(d,m,T,C,I)=>{n.hc("ReduceMax",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1324799:(d,m,T,C,I)=>{n.hc("ReduceMin",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1324973:(d,m,T,C,I)=>{n.hc("ReduceProd",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1325148:(d,m,T,C,I)=>{n.hc("ReduceSum",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1325322:(d,m,T,C,I)=>{n.hc("ReduceL1",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1325495:(d,m,T,C,I)=>{n.hc("ReduceL2",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1325668:(d,m,T,C,I)=>{n.hc("ReduceLogSum",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1325845:(d,m,T,C,I)=>{n.hc("ReduceSumSquare",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1326025:(d,m,T,C,I)=>{n.hc("ReduceLogSumExp",d,{keepDims:!!m,noopWithEmptyAxes:!!T,axes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1326205:d=>{n.hc("Where",d,void 0)},1326258:(d,m,T)=>{n.hc("Transpose",d,{perm:m?Array.from(X().subarray(Number(m)>>>0,Number(T)>>>0)):[]})},1326382:(d,m,T,C)=>{n.hc("DepthToSpace",d,{blocksize:m,mode:zt(T),format:C?"NHWC":"NCHW"})},1326515:(d,m,T,C)=>{n.hc("DepthToSpace",d,{blocksize:m,mode:zt(T),format:C?"NHWC":"NCHW"})},1326648:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt,Fr)=>{n.hc("ConvTranspose",d,{format:Ee?"NHWC":"NCHW",autoPad:m,dilations:[T],group:C,kernelShape:[I],pads:[W,ne],strides:[ye],wIsConst:()=>!!N()[ze>>>0],outputPadding:Ye?Array.from(X().subarray(Number(Ye)>>>0,Number(ot)>>>0)):[],outputShape:_t?Array.from(X().subarray(Number(_t)>>>0,Number(Bt)>>>0)):[],activation:zt(Fr)})},1327081:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt)=>{n.hc("ConvTranspose",d,{format:ye?"NHWC":"NCHW",autoPad:m,dilations:Array.from(X().subarray(Number(T)>>>0,2+(Number(T)>>>0)>>>0)),group:C,kernelShape:Array.from(X().subarray(Number(I)>>>0,2+(Number(I)>>>0)>>>0)),pads:Array.from(X().subarray(Number(W)>>>0,4+(Number(W)>>>0)>>>0)),strides:Array.from(X().subarray(Number(ne)>>>0,2+(Number(ne)>>>0)>>>0)),wIsConst:()=>!!N()[Ee>>>0],outputPadding:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],outputShape:ot?Array.from(X().subarray(Number(ot)>>>0,Number(_t)>>>0)):[],activation:zt(Bt)})},1327742:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt,Fr)=>{n.hc("ConvTranspose",d,{format:Ee?"NHWC":"NCHW",autoPad:m,dilations:[T],group:C,kernelShape:[I],pads:[W,ne],strides:[ye],wIsConst:()=>!!N()[ze>>>0],outputPadding:Ye?Array.from(X().subarray(Number(Ye)>>>0,Number(ot)>>>0)):[],outputShape:_t?Array.from(X().subarray(Number(_t)>>>0,Number(Bt)>>>0)):[],activation:zt(Fr)})},1328175:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt)=>{n.hc("ConvTranspose",d,{format:ye?"NHWC":"NCHW",autoPad:m,dilations:Array.from(X().subarray(Number(T)>>>0,2+(Number(T)>>>0)>>>0)),group:C,kernelShape:Array.from(X().subarray(Number(I)>>>0,2+(Number(I)>>>0)>>>0)),pads:Array.from(X().subarray(Number(W)>>>0,4+(Number(W)>>>0)>>>0)),strides:Array.from(X().subarray(Number(ne)>>>0,2+(Number(ne)>>>0)>>>0)),wIsConst:()=>!!N()[Ee>>>0],outputPadding:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],outputShape:ot?Array.from(X().subarray(Number(ot)>>>0,Number(_t)>>>0)):[],activation:zt(Bt)})},1328836:(d,m)=>{n.hc("GlobalAveragePool",d,{format:m?"NHWC":"NCHW"})},1328927:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt)=>{n.hc("AveragePool",d,{format:Bt?"NHWC":"NCHW",auto_pad:m,ceil_mode:T,count_include_pad:C,storage_order:I,dilations:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],kernel_shape:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],pads:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],strides:ot?Array.from(X().subarray(Number(ot)>>>0,Number(_t)>>>0)):[]})},1329406:(d,m)=>{n.hc("GlobalAveragePool",d,{format:m?"NHWC":"NCHW"})},1329497:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt)=>{n.hc("AveragePool",d,{format:Bt?"NHWC":"NCHW",auto_pad:m,ceil_mode:T,count_include_pad:C,storage_order:I,dilations:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],kernel_shape:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],pads:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],strides:ot?Array.from(X().subarray(Number(ot)>>>0,Number(_t)>>>0)):[]})},1329976:(d,m)=>{n.hc("GlobalMaxPool",d,{format:m?"NHWC":"NCHW"})},1330063:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt)=>{n.hc("MaxPool",d,{format:Bt?"NHWC":"NCHW",auto_pad:m,ceil_mode:T,count_include_pad:C,storage_order:I,dilations:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],kernel_shape:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],pads:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],strides:ot?Array.from(X().subarray(Number(ot)>>>0,Number(_t)>>>0)):[]})},1330538:(d,m)=>{n.hc("GlobalMaxPool",d,{format:m?"NHWC":"NCHW"})},1330625:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt)=>{n.hc("MaxPool",d,{format:Bt?"NHWC":"NCHW",auto_pad:m,ceil_mode:T,count_include_pad:C,storage_order:I,dilations:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],kernel_shape:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],pads:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],strides:ot?Array.from(X().subarray(Number(ot)>>>0,Number(_t)>>>0)):[]})},1331100:(d,m,T,C,I)=>{n.hc("Gemm",d,{alpha:m,beta:T,transA:C,transB:I})},1331204:d=>{n.hc("MatMul",d,void 0)},1331258:(d,m,T,C)=>{n.hc("ArgMax",d,{keepDims:!!m,selectLastIndex:!!T,axis:C})},1331366:(d,m,T,C)=>{n.hc("ArgMin",d,{keepDims:!!m,selectLastIndex:!!T,axis:C})},1331474:(d,m)=>{n.hc("Softmax",d,{axis:m})},1331537:(d,m)=>{n.hc("Concat",d,{axis:m})},1331597:(d,m,T,C,I)=>{n.hc("Split",d,{axis:m,numOutputs:T,splitSizes:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1331753:d=>{n.hc("Expand",d,void 0)},1331807:(d,m)=>{n.hc("Gather",d,{axis:Number(m)})},1331878:(d,m)=>{n.hc("GatherElements",d,{axis:Number(m)})},1331957:(d,m)=>{n.hc("GatherND",d,{batch_dims:Number(m)})},1332036:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye)=>{n.hc("Resize",d,{antialias:m,axes:T?Array.from(X().subarray(Number(T)>>>0,Number(C)>>>0)):[],coordinateTransformMode:zt(I),cubicCoeffA:W,excludeOutside:ne,extrapolationValue:ye,keepAspectRatioPolicy:zt(Ee),mode:zt(ze),nearestMode:zt(Ye)})},1332398:(d,m,T,C,I,W,ne)=>{n.hc("Slice",d,{starts:m?Array.from(X().subarray(Number(m)>>>0,Number(T)>>>0)):[],ends:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[],axes:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[]})},1332662:d=>{n.hc("Tile",d,void 0)},1332714:(d,m,T)=>{n.hc("InstanceNormalization",d,{epsilon:m,format:T?"NHWC":"NCHW"})},1332828:(d,m,T)=>{n.hc("InstanceNormalization",d,{epsilon:m,format:T?"NHWC":"NCHW"})},1332942:d=>{n.hc("Range",d,void 0)},1332995:(d,m)=>{n.hc("Einsum",d,{equation:zt(m)})},1333076:(d,m,T,C,I)=>{n.hc("Pad",d,{mode:m,value:T,pads:C?Array.from(X().subarray(Number(C)>>>0,Number(I)>>>0)):[]})},1333219:(d,m,T,C,I,W)=>{n.hc("BatchNormalization",d,{epsilon:m,momentum:T,spatial:!!I,trainingMode:!!C,format:W?"NHWC":"NCHW"})},1333388:(d,m,T,C,I,W)=>{n.hc("BatchNormalization",d,{epsilon:m,momentum:T,spatial:!!I,trainingMode:!!C,format:W?"NHWC":"NCHW"})},1333557:(d,m,T)=>{n.hc("CumSum",d,{exclusive:Number(m),reverse:Number(T)})},1333654:(d,m,T)=>{n.hc("DequantizeLinear",d,{axis:m,blockSize:T})},1333744:(d,m,T,C,I)=>{n.hc("GridSample",d,{align_corners:m,mode:zt(T),padding_mode:zt(C),format:I?"NHWC":"NCHW"})},1333914:(d,m,T,C,I)=>{n.hc("GridSample",d,{align_corners:m,mode:zt(T),padding_mode:zt(C),format:I?"NHWC":"NCHW"})},1334084:(d,m)=>{n.hc("ScatterND",d,{reduction:zt(m)})},1334169:(d,m,T,C,I,W,ne,ye,Ee)=>{n.hc("Attention",d,{numHeads:m,isUnidirectional:T,maskFilterValue:C,scale:I,doRotary:W,qkvHiddenSizes:ne?Array.from(X().subarray(Number(ye)>>>0,Number(ye)+ne>>>0)):[],pastPresentShareBuffer:!!Ee})},1334441:d=>{n.hc("BiasAdd",d,void 0)},1334496:d=>{n.hc("BiasSplitGelu",d,void 0)},1334557:d=>{n.hc("FastGelu",d,void 0)},1334613:(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt,Fr,$s)=>{n.hc("Conv",d,{format:ot?"NHWC":"NCHW",auto_pad:m,dilations:T?Array.from(X().subarray(Number(T)>>>0,Number(C)>>>0)):[],group:I,kernel_shape:W?Array.from(X().subarray(Number(W)>>>0,Number(ne)>>>0)):[],pads:ye?Array.from(X().subarray(Number(ye)>>>0,Number(Ee)>>>0)):[],strides:ze?Array.from(X().subarray(Number(ze)>>>0,Number(Ye)>>>0)):[],w_is_const:()=>!!N()[Number(_t)>>>0],activation:zt(Bt),activation_params:Fr?Array.from(_e().subarray(Number(Fr)>>>0,Number($s)>>>0)):[]})},1335197:d=>{n.hc("Gelu",d,void 0)},1335249:(d,m,T,C,I,W,ne,ye,Ee)=>{n.hc("GroupQueryAttention",d,{numHeads:m,kvNumHeads:T,scale:C,softcap:I,doRotary:W,rotaryInterleaved:ne,smoothSoftmax:ye,localWindowSize:Ee})},1335466:(d,m,T,C)=>{n.hc("LayerNormalization",d,{axis:m,epsilon:T,simplified:!!C})},1335577:(d,m,T,C)=>{n.hc("LayerNormalization",d,{axis:m,epsilon:T,simplified:!!C})},1335688:(d,m,T,C,I,W)=>{n.hc("MatMulNBits",d,{k:m,n:T,accuracyLevel:C,bits:I,blockSize:W})},1335815:(d,m,T,C,I,W)=>{n.hc("MultiHeadAttention",d,{numHeads:m,isUnidirectional:T,maskFilterValue:C,scale:I,doRotary:W})},1335974:(d,m)=>{n.hc("QuickGelu",d,{alpha:m})},1336038:(d,m,T,C,I)=>{n.hc("RotaryEmbedding",d,{interleaved:!!m,numHeads:T,rotaryEmbeddingDim:C,scale:I})},1336177:(d,m,T)=>{n.hc("SkipLayerNormalization",d,{epsilon:m,simplified:!!T})},1336279:(d,m,T)=>{n.hc("SkipLayerNormalization",d,{epsilon:m,simplified:!!T})},1336381:(d,m,T,C)=>{n.hc("GatherBlockQuantized",d,{gatherAxis:m,quantizeAxis:T,blockSize:C})},1336502:d=>{n.Wd(d)},1336536:(d,m)=>n.Zd(Number(d),Number(m),n.Cd.be,n.Cd.errors)};function We(d,m,T){return Wi(async()=>{await n.Ud(Number(d),Number(m),Number(T))})}function D(){return typeof wasmOffsetConverter<"u"}class ee{constructor(m){re(this,"name","ExitStatus");this.message=`Program terminated with exit(${m})`,this.status=m}}var B=d=>{d.terminate(),d.onmessage=()=>{}},te=[],de=d=>{qe.length==0&&(ds(),dr(qe[0]));var m=qe.pop();if(!m)return 6;Xe.push(m),wt[d.xd]=m,m.xd=d.xd;var T={yd:"run",de:d.ce,Fd:d.Fd,xd:d.xd};return m.postMessage(T,d.Ld),0},be=0,ve=(d,m,...T)=>{for(var C=2*T.length,I=ft(),W=An(8*C),ne=W>>>3,ye=0;ye>>0]=Ee)}return d=si(d,0,C,W,m),mt(I),d};function Re(d){if(c)return ve(0,1,d);if(x=d,!(0{if(x=d,c)throw Fe(d),"unwind";Re(d)},qe=[],Xe=[],ut=[],wt={},nr=d=>{var m=d.xd;delete wt[m],qe.push(d),Xe.splice(Xe.indexOf(d),1),d.xd=0,ho(m)};function jt(){ut.forEach(d=>d())}var dr=d=>new Promise(m=>{d.onmessage=I=>{var W=(I=I.data).yd;if(I.Ed&&I.Ed!=In()){var ne=wt[I.Ed];ne?ne.postMessage(I,I.Ld):E(`Internal error! Worker sent a message "${W}" to target pthread ${I.Ed}, but that thread no longer exists!`)}else W==="checkMailbox"?Vt():W==="spawnThread"?de(I):W==="cleanupThread"?nr(wt[I.ee]):W==="loaded"?(d.loaded=!0,m(d)):W==="alert"?alert(`Thread ${I.fe}: ${I.text}`):I.target==="setimmediate"?d.postMessage(I):W==="callHandler"?n[I.Nd](...I.args):W&&E(`worker sent an unknown command ${W}`)},d.onerror=I=>{throw E(`worker sent an error! ${I.filename}:${I.lineno}: ${I.message}`),I};var T,C=[];for(T of[])n.propertyIsEnumerable(T)&&C.push(T);d.postMessage({yd:"load",Od:C,he:M,ie:w})});function ds(){var d=new Worker((()=>{let m=URL;return self.location.href>"file:"&&self.location.href<"file;"?new m("ort.bundle.min.mjs",self.location.href):new URL(self.location.href)})(),{type:"module",workerData:"em-pthread",name:"em-pthread"});qe.push(d)}var Os=d=>{K();var m=we()[d+52>>>2>>>0];d=we()[d+56>>>2>>>0],fo(m,m-d),mt(m)},Dr=(d,m)=>{be=0,d=li(d,m),0>>=0);if(N()[m.wd+12>>>0]==0){var T=1;N()[m.wd+12>>>0]=T}return T=0,N()[m.wd+13>>>0]=T,cs.push(m),oi(d),wo(d)}var jr=0,dt=()=>{gt(0,0);var d=cs.pop();_o(d.Gd),jr=0};class qr{constructor(m){this.Gd=m,this.wd=m-24}}function Vr(d){throw jr||(jr=d>>>0),jr}var us=d=>{var m=jr;if(!m)return Us(0),0;var T=new qr(m);we()[T.wd+16>>>2>>>0]=m;var C=we()[T.wd+4>>>2>>>0];if(!C)return Us(0),m;for(var I of d){if(I===0||I===C)break;if(go(I,C,T.wd+16))return Us(I),m}return Us(C),m};function Ts(){return us([])}function xs(d){return us([d>>>0])}function Es(d,m){return us([d>>>0,m>>>0])}var Ls=()=>{var d=cs.pop();d||Ie("no exception to throw");var m=d.Gd;if(N()[d.wd+13>>>0]==0){cs.push(d);var T=1;N()[d.wd+13>>>0]=T,T=0,N()[d.wd+12>>>0]=T}throw jr=m};function mr(d,m,T){var C=new qr(d>>>=0);throw m>>>=0,T>>>=0,we()[C.wd+16>>>2>>>0]=0,we()[C.wd+4>>>2>>>0]=m,we()[C.wd+8>>>2>>>0]=T,jr=d}function Be(d,m,T,C){return c?ve(2,1,d,m,T,C):et(d,m,T,C)}function et(d,m,T,C){if(d>>>=0,T>>>=0,C>>>=0,p===void 0)return 6;var I=[];return c&&I.length===0?Be(d,m>>>=0,T,C):(d={ce:T,xd:d,Fd:C,Ld:I},c?(d.yd="spawnThread",postMessage(d,I),0):de(d))}var it=typeof TextDecoder<"u"?new TextDecoder:void 0,rr=(d,m=0,T=NaN)=>{var C=(m>>>=0)+T;for(T=m;d[T]&&!(T>=C);)++T;if(16(I=(240&I)==224?(15&I)<<12|W<<6|ne:(7&I)<<18|W<<12|ne<<6|63&d[m++])?C+=String.fromCharCode(I):(I-=65536,C+=String.fromCharCode(55296|I>>10,56320|1023&I))}}else C+=String.fromCharCode(I)}return C},zt=(d,m)=>(d>>>=0)?rr(O(),d,m):"";function kr(d,m,T){return c?ve(3,1,d,m,T):0}function ps(d,m){if(c)return ve(4,1,d,m)}var hs=d=>{for(var m=0,T=0;T=C?m++:2047>=C?m+=2:55296<=C&&57343>=C?(m+=4,++T):m+=3}return m},Er=(d,m,T)=>{var C=O();if(m>>>=0,0=ne&&(ne=65536+((1023&ne)<<10)|1023&d.charCodeAt(++W)),127>=ne){if(m>=T)break;C[m++>>>0]=ne}else{if(2047>=ne){if(m+1>=T)break;C[m++>>>0]=192|ne>>6}else{if(65535>=ne){if(m+2>=T)break;C[m++>>>0]=224|ne>>12}else{if(m+3>=T)break;C[m++>>>0]=240|ne>>18,C[m++>>>0]=128|ne>>12&63}C[m++>>>0]=128|ne>>6&63}C[m++>>>0]=128|63&ne}}C[m>>>0]=0,d=m-I}else d=0;return d};function ms(d,m){if(c)return ve(5,1,d,m)}function fs(d,m,T){if(c)return ve(6,1,d,m,T)}function Qr(d,m,T){return c?ve(7,1,d,m,T):0}function Ps(d,m){if(c)return ve(8,1,d,m)}function Qs(d,m,T){if(c)return ve(9,1,d,m,T)}function Xs(d,m,T,C){if(c)return ve(10,1,d,m,T,C)}function Js(d,m,T,C){if(c)return ve(11,1,d,m,T,C)}function Ys(d,m,T,C){if(c)return ve(12,1,d,m,T,C)}function _s(d){if(c)return ve(13,1,d)}function Zs(d,m){if(c)return ve(14,1,d,m)}function en(d,m,T){if(c)return ve(15,1,d,m,T)}var tn,Lr,Cs=()=>Ie(""),br=d=>{for(var m="";O()[d>>>0];)m+=tn[O()[d++>>>0]];return m},zs={},Bs={};function Ir(d,m,T={}){return function(C,I,W={}){var ne=I.name;if(!C)throw new Lr(`type "${ne}" must have a positive integer typeid pointer`);if(Bs.hasOwnProperty(C)){if(W.Pd)return;throw new Lr(`Cannot register type '${ne}' twice`)}Bs[C]=I,zs.hasOwnProperty(C)&&(I=zs[C],delete zs[C],I.forEach(ye=>ye()))}(d,m,T)}var Xr=(d,m,T)=>{switch(m){case 1:return T?C=>N()[C>>>0]:C=>O()[C>>>0];case 2:return T?C=>G()[C>>>1>>>0]:C=>se()[C>>>1>>>0];case 4:return T?C=>X()[C>>>2>>>0]:C=>we()[C>>>2>>>0];case 8:return T?C=>H[C>>>3]:C=>J[C>>>3];default:throw new TypeError(`invalid integer width (${m}): ${d}`)}};function xn(d,m,T){T>>>=0,Ir(d>>>=0,{name:m=br(m>>>0),fromWireType:C=>C,toWireType:function(C,I){if(typeof I!="bigint"&&typeof I!="number")throw I=I===null?"null":(C=typeof I)=="object"||C==="array"||C==="function"?I.toString():""+I,new TypeError(`Cannot convert "${I}" to ${this.name}`);return typeof I=="number"&&(I=BigInt(I)),I},zd:zr,readValueFromPointer:Xr(m,T,m.indexOf("u")==-1),Ad:null})}var zr=8;function En(d,m,T,C){Ir(d>>>=0,{name:m=br(m>>>0),fromWireType:function(I){return!!I},toWireType:function(I,W){return W?T:C},zd:zr,readValueFromPointer:function(I){return this.fromWireType(O()[I>>>0])},Ad:null})}var Rs=[],Ar=[];function Jr(d){9<(d>>>=0)&&--Ar[d+1]==0&&(Ar[d]=void 0,Rs.push(d))}var cr=d=>{if(!d)throw new Lr("Cannot use deleted val. handle = "+d);return Ar[d]},fr=d=>{switch(d){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:let m=Rs.pop()||Ar.length;return Ar[m]=d,Ar[m+1]=1,m}};function Ns(d){return this.fromWireType(we()[d>>>2>>>0])}var Pn={name:"emscripten::val",fromWireType:d=>{var m=cr(d);return Jr(d),m},toWireType:(d,m)=>fr(m),zd:zr,readValueFromPointer:Ns,Ad:null};function Ss(d){return Ir(d>>>0,Pn)}var Cn=(d,m)=>{switch(m){case 4:return function(T){return this.fromWireType(_e()[T>>>2>>>0])};case 8:return function(T){return this.fromWireType(ke()[T>>>3>>>0])};default:throw new TypeError(`invalid float width (${m}): ${d}`)}};function pe(d,m,T){T>>>=0,Ir(d>>>=0,{name:m=br(m>>>0),fromWireType:C=>C,toWireType:(C,I)=>I,zd:zr,readValueFromPointer:Cn(m,T),Ad:null})}function F(d,m,T,C,I){if(d>>>=0,T>>>=0,m=br(m>>>0),I===-1&&(I=4294967295),I=ye=>ye,C===0){var W=32-8*T;I=ye=>ye<>>W}var ne=m.includes("unsigned")?function(ye,Ee){return Ee>>>0}:function(ye,Ee){return Ee};Ir(d,{name:m,fromWireType:I,toWireType:ne,zd:zr,readValueFromPointer:Xr(m,T,C!==0),Ad:null})}function V(d,m,T){function C(W){var ne=we()[W>>>2>>>0];return W=we()[W+4>>>2>>>0],new I(N().buffer,W,ne)}var I=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][m];Ir(d>>>=0,{name:T=br(T>>>0),fromWireType:C,zd:zr,readValueFromPointer:C},{Pd:!0})}function Y(d,m){Ir(d>>>=0,{name:m=br(m>>>0),fromWireType:function(T){for(var C,I=we()[T>>>2>>>0],W=T+4,ne=W,ye=0;ye<=I;++ye){var Ee=W+ye;ye!=I&&O()[Ee>>>0]!=0||(ne=zt(ne,Ee-ne),C===void 0?C=ne:(C+="\0",C+=ne),ne=Ee+1)}return Ur(T),C},toWireType:function(T,C){C instanceof ArrayBuffer&&(C=new Uint8Array(C));var I=typeof C=="string";if(!(I||C instanceof Uint8Array||C instanceof Uint8ClampedArray||C instanceof Int8Array))throw new Lr("Cannot pass non-string to std::string");var W=I?hs(C):C.length,ne=an(4+W+1),ye=ne+4;if(we()[ne>>>2>>>0]=W,I)Er(C,ye,W+1);else if(I)for(I=0;I>>0]=Ee}else for(I=0;I>>0]=C[I];return T!==null&&T.push(Ur,ne),ne},zd:zr,readValueFromPointer:Ns,Ad(T){Ur(T)}})}var le=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,ue=(d,m)=>{for(var T=d>>1,C=T+m/2;!(T>=C)&&se()[T>>>0];)++T;if(32<(T<<=1)-d&&le)return le.decode(O().slice(d,T));for(T="",C=0;!(C>=m/2);++C){var I=G()[d+2*C>>>1>>>0];if(I==0)break;T+=String.fromCharCode(I)}return T},Ce=(d,m,T)=>{if(T??(T=2147483647),2>T)return 0;var C=m;T=(T-=2)<2*d.length?T/2:d.length;for(var I=0;I>>1>>>0]=W,m+=2}return G()[m>>>1>>>0]=0,m-C},Ue=d=>2*d.length,Qe=(d,m)=>{for(var T=0,C="";!(T>=m/4);){var I=X()[d+4*T>>>2>>>0];if(I==0)break;++T,65536<=I?(I-=65536,C+=String.fromCharCode(55296|I>>10,56320|1023&I)):C+=String.fromCharCode(I)}return C},Ke=(d,m,T)=>{if(m>>>=0,T??(T=2147483647),4>T)return 0;var C=m;T=C+T-4;for(var I=0;I=W&&(W=65536+((1023&W)<<10)|1023&d.charCodeAt(++I)),X()[m>>>2>>>0]=W,(m+=4)+4>T)break}return X()[m>>>2>>>0]=0,m-C},Ze=d=>{for(var m=0,T=0;T=C&&++T,m+=4}return m};function ht(d,m,T){if(d>>>=0,m>>>=0,T=br(T>>>=0),m===2)var C=ue,I=Ce,W=Ue,ne=ye=>se()[ye>>>1>>>0];else m===4&&(C=Qe,I=Ke,W=Ze,ne=ye=>we()[ye>>>2>>>0]);Ir(d,{name:T,fromWireType:ye=>{for(var Ee,ze=we()[ye>>>2>>>0],Ye=ye+4,ot=0;ot<=ze;++ot){var _t=ye+4+ot*m;ot!=ze&&ne(_t)!=0||(Ye=C(Ye,_t-Ye),Ee===void 0?Ee=Ye:(Ee+="\0",Ee+=Ye),Ye=_t+m)}return Ur(ye),Ee},toWireType:(ye,Ee)=>{if(typeof Ee!="string")throw new Lr(`Cannot pass non-string to C++ string type ${T}`);var ze=W(Ee),Ye=an(4+ze+m);return we()[Ye>>>2>>>0]=ze/m,I(Ee,Ye+4,ze+m),ye!==null&&ye.push(Ur,Ye),Ye},zd:zr,readValueFromPointer:Ns,Ad(ye){Ur(ye)}})}function Ct(d,m){Ir(d>>>=0,{Qd:!0,name:m=br(m>>>0),zd:0,fromWireType:()=>{},toWireType:()=>{}})}function kt(d){ri(d>>>0,!l,1,!a,131072,!1),jt()}var Wt=d=>{if(!ce)try{if(d(),!(0>>=0,typeof Atomics.ge=="function"&&(Atomics.ge(X(),d>>>2,d).value.then(Vt),d+=128,Atomics.store(X(),d>>>2,1))}var Vt=()=>{var d=In();d&&(Ot(d),Wt(mo))};function vr(d,m){(d>>>=0)==m>>>0?setTimeout(Vt):c?postMessage({Ed:d,yd:"checkMailbox"}):(d=wt[d])&&d.postMessage({yd:"checkMailbox"})}var _r=[];function Yr(d,m,T,C,I){for(m>>>=0,C/=2,_r.length=C,T=I>>>0>>>3,I=0;I>>0];return(m?Ne[m]:dl[d])(..._r)}var Tr=()=>{be=0};function gs(d){d>>>=0,c?postMessage({yd:"cleanupThread",ee:d}):nr(wt[d])}function Gt(d){}var Zt=(d,m)=>{var T=Bs[d];if(T===void 0)throw d=uo(d),T=br(d),Ur(d),new Lr(`${m} has unknown type ${T}`);return T},gr=(d,m,T)=>{var C=[];return d=d.toWireType(C,T),C.length&&(we()[m>>>2>>>0]=fr(C)),d};function Zr(d,m,T){return m>>>=0,T>>>=0,d=cr(d>>>0),m=Zt(m,"emval::as"),gr(m,T,d)}function ws(d,m){return m>>>=0,d=cr(d>>>0),(m=Zt(m,"emval::as")).toWireType(null,d)}var Ht=d=>{try{d()}catch(m){Ie(m)}},ur=0,Rt=null,Jt=0,qt=[],er={},ir={},rn=0,sn=null,za=[];function Wi(d){return function(m){if(!ce){if(ur===0){var T=!1,C=!1;m((I=0)=>{if(!ce&&(Jt=I,T=!0,C)){ur=2,Ht(()=>Xo(Rt)),typeof MainLoop<"u"&&MainLoop.Md&&MainLoop.resume(),I=!1;try{var W=function(){var Ee=X()[Rt+8>>>2>>>0];return Ee=Oe[ir[Ee]],--be,Ee()}()}catch(Ee){W=Ee,I=!0}var ne=!1;if(!Rt){var ye=sn;ye&&(sn=null,(I?ye.reject:ye.resolve)(W),ne=!0)}if(I&&!ne)throw W}}),C=!0,T||(ur=1,Rt=function(){var I=an(65548),W=I+12;we()[I>>>2>>>0]=W,we()[I+4>>>2>>>0]=W+65536,W=qt[0];var ne=er[W];return ne===void 0&&(ne=rn++,er[W]=ne,ir[ne]=W),W=ne,X()[I+8>>>2>>>0]=W,I}(),typeof MainLoop<"u"&&MainLoop.Md&&MainLoop.pause(),Ht(()=>qo(Rt)))}else ur===2?(ur=0,Ht(Jo),Ur(Rt),Rt=null,za.forEach(Wt)):Ie(`invalid state: ${ur}`);return Jt}}(m=>{d().then(m)})}function Ba(d){return d>>>=0,Wi(async()=>{var m=await cr(d);return fr(m)})}var ys=[];function Ra(d,m,T,C){return T>>>=0,C>>>=0,(d=ys[d>>>0])(null,m=cr(m>>>0),T,C)}var Na={},Sn=d=>{var m=Na[d];return m===void 0?br(d):m};function ja(d,m,T,C,I){return T>>>=0,C>>>=0,I>>>=0,(d=ys[d>>>0])(m=cr(m>>>0),m[T=Sn(T)],C,I)}var Gi=()=>typeof globalThis=="object"?globalThis:Function("return this")();function Ki(d){return(d>>>=0)==0?fr(Gi()):(d=Sn(d),fr(Gi()[d]))}var Va=d=>{var m=ys.length;return ys.push(d),m},Ua=(d,m)=>{for(var T=Array(d),C=0;C>>2>>>0],"parameter "+C);return T},Gn=(d,m)=>Object.defineProperty(m,"name",{value:d});function Wa(d,m,T){var C=(m=Ua(d,m>>>0)).shift();d--;var I=`return function (obj, func, destructorsRef, args) { -`,W=0,ne=[];T===0&&ne.push("obj");for(var ye=["retType"],Ee=[C],ze=0;zeYe.name).join(", ")}) => ${C.name}>`,Va(Gn(T,d))}function Hi(d){return d=Sn(d>>>0),fr(n[d])}function Ga(d,m){return m>>>=0,d=cr(d>>>0),m=cr(m),fr(d[m])}function qi(d){9<(d>>>=0)&&(Ar[d+1]+=1)}function Jc(){return fr([])}function Ka(d){d=cr(d>>>0);for(var m=Array(d.length),T=0;T>>0))}function Ha(){return fr({})}function Kn(d){for(var m=cr(d>>>=0);m.length;){var T=m.pop();m.pop()(T)}Jr(d)}function qa(d,m,T){m>>>=0,T>>>=0,d=cr(d>>>0),m=cr(m),T=cr(T),d[m]=T}function Qa(d,m){return m>>>=0,d=(d=Zt(d>>>0,"_emval_take_value")).readValueFromPointer(m),fr(d)}function Xa(d,m){d=-9007199254740992>d||9007199254740992>>=0,d=new Date(1e3*d),X()[m>>>2>>>0]=d.getUTCSeconds(),X()[m+4>>>2>>>0]=d.getUTCMinutes(),X()[m+8>>>2>>>0]=d.getUTCHours(),X()[m+12>>>2>>>0]=d.getUTCDate(),X()[m+16>>>2>>>0]=d.getUTCMonth(),X()[m+20>>>2>>>0]=d.getUTCFullYear()-1900,X()[m+24>>>2>>>0]=d.getUTCDay(),d=(d.getTime()-Date.UTC(d.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,X()[m+28>>>2>>>0]=d}var Xi=d=>d%4==0&&(d%100!=0||d%400==0),Ji=[0,31,60,91,121,152,182,213,244,274,305,335],Yi=[0,31,59,90,120,151,181,212,243,273,304,334];function Ja(d,m){d=-9007199254740992>d||9007199254740992>>=0,d=new Date(1e3*d),X()[m>>>2>>>0]=d.getSeconds(),X()[m+4>>>2>>>0]=d.getMinutes(),X()[m+8>>>2>>>0]=d.getHours(),X()[m+12>>>2>>>0]=d.getDate(),X()[m+16>>>2>>>0]=d.getMonth(),X()[m+20>>>2>>>0]=d.getFullYear()-1900,X()[m+24>>>2>>>0]=d.getDay();var T=(Xi(d.getFullYear())?Ji:Yi)[d.getMonth()]+d.getDate()-1|0;X()[m+28>>>2>>>0]=T,X()[m+36>>>2>>>0]=-60*d.getTimezoneOffset(),T=new Date(d.getFullYear(),6,1).getTimezoneOffset();var C=new Date(d.getFullYear(),0,1).getTimezoneOffset();d=0|(T!=C&&d.getTimezoneOffset()==Math.min(C,T)),X()[m+32>>>2>>>0]=d}function Hn(d){d>>>=0;var m=new Date(X()[d+20>>>2>>>0]+1900,X()[d+16>>>2>>>0],X()[d+12>>>2>>>0],X()[d+8>>>2>>>0],X()[d+4>>>2>>>0],X()[d>>>2>>>0],0),T=X()[d+32>>>2>>>0],C=m.getTimezoneOffset(),I=new Date(m.getFullYear(),6,1).getTimezoneOffset(),W=new Date(m.getFullYear(),0,1).getTimezoneOffset(),ne=Math.min(W,I);return 0>T?X()[d+32>>>2>>>0]=+(I!=W&&ne==C):0>>2>>>0]=m.getDay(),T=(Xi(m.getFullYear())?Ji:Yi)[m.getMonth()]+m.getDate()-1|0,X()[d+28>>>2>>>0]=T,X()[d>>>2>>>0]=m.getSeconds(),X()[d+4>>>2>>>0]=m.getMinutes(),X()[d+8>>>2>>>0]=m.getHours(),X()[d+12>>>2>>>0]=m.getDate(),X()[d+16>>>2>>>0]=m.getMonth(),X()[d+20>>>2>>>0]=m.getYear(),d=m.getTime(),BigInt(isNaN(d)?-1:d/1e3)}function qn(d,m,T,C,I,W,ne){return c?ve(16,1,d,m,T,C,I,W,ne):-52}function Zi(d,m,T,C,I,W){if(c)return ve(17,1,d,m,T,C,I,W)}var js={},Vs=()=>performance.timeOrigin+performance.now();function eo(d,m){if(c)return ve(18,1,d,m);if(js[d]&&(clearTimeout(js[d].id),delete js[d]),!m)return 0;var T=setTimeout(()=>{delete js[d],Wt(()=>ii(d,performance.timeOrigin+performance.now()))},m);return js[d]={id:T,ke:m},0}function Yc(d,m,T,C){d>>>=0,m>>>=0,T>>>=0,C>>>=0;var I=new Date().getFullYear(),W=new Date(I,0,1).getTimezoneOffset();I=new Date(I,6,1).getTimezoneOffset();var ne=Math.max(W,I);we()[d>>>2>>>0]=60*ne,X()[m>>>2>>>0]=+(W!=I),d=(m=ye=>{var Ee=Math.abs(ye);return`UTC${0<=ye?"-":"+"}${String(Math.floor(Ee/60)).padStart(2,"0")}${String(Ee%60).padStart(2,"0")}`})(W),m=m(I),IDate.now();function Zc(d,m,T){return 0<=d&&3>=d?(d===0?d=Date.now():d=performance.timeOrigin+performance.now(),H[T>>>0>>>3]=BigInt(Math.round(1e6*d)),0):28}var Qn=[],Xn=(d,m)=>{Qn.length=0;for(var T;T=O()[d++>>>0];){var C=T!=105;m+=(C&=T!=112)&&m%8?4:0,Qn.push(T==112?we()[m>>>2>>>0]:T==106?H[m>>>3]:T==105?X()[m>>>2>>>0]:ke()[m>>>3>>>0]),m+=C?8:4}return Qn};function Za(d,m,T){return d>>>=0,m=Xn(m>>>0,T>>>0),Ne[d](...m)}function el(d,m,T){return d>>>=0,m=Xn(m>>>0,T>>>0),Ne[d](...m)}var tl=()=>{};function rl(d,m){return E(zt(d>>>0,m>>>0))}var sl=()=>{throw be+=1,"unwind"};function Jn(){return 4294901760}var nl=()=>navigator.hardwareConcurrency;function il(){return Ie("Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER"),0}function ol(d){d>>>=0;var m=O().length;if(d<=m||4294901760=T;T*=2){var C=m*(1+.2/T);C=Math.min(C,d+100663296);e:{C=(Math.min(4294901760,65536*Math.ceil(Math.max(d,C)/65536))-M.buffer.byteLength+65535)/65536|0;try{M.grow(C),K();var I=1;break e}catch{}I=void 0}if(I)return!0}return!1}var nn=()=>(Ie("Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER"),0),on={},to=d=>{d.forEach(m=>{nn()})};function ro(){var d=Error().stack.toString().split(` -`);return d[0]=="Error"&&d.shift(),to(d),on.Kd=nn(),on.ae=d,on.Kd}function al(d,m,T){if(d>>>=0,m>>>=0,on.Kd==d)var C=on.ae;else(C=Error().stack.toString().split(` -`))[0]=="Error"&&C.shift(),to(C);for(var I=3;C[I]&&nn()!=d;)++I;for(d=0;d>>2>>>0]=nn();return d}var Yn,$n={},so=()=>{if(!Yn){var d,m={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(d in $n)$n[d]===void 0?delete m[d]:m[d]=$n[d];var T=[];for(d in m)T.push(`${d}=${m[d]}`);Yn=T}return Yn};function no(d,m){if(c)return ve(19,1,d,m);d>>>=0,m>>>=0;var T=0;return so().forEach((C,I)=>{var W=m+T;for(I=we()[d+4*I>>>2>>>0]=W,W=0;W>>0]=C.charCodeAt(W);N()[I>>>0]=0,T+=C.length+1}),0}function Zn(d,m){if(c)return ve(20,1,d,m);d>>>=0,m>>>=0;var T=so();we()[d>>>2>>>0]=T.length;var C=0;return T.forEach(I=>C+=I.length+1),we()[m>>>2>>>0]=C,0}function io(d){return c?ve(21,1,d):52}function oo(d,m,T,C){return c?ve(22,1,d,m,T,C):52}function ei(d,m,T,C){return c?ve(23,1,d,m,T,C):70}var ll=[null,[],[]];function ao(d,m,T,C){if(c)return ve(24,1,d,m,T,C);m>>>=0,T>>>=0,C>>>=0;for(var I=0,W=0;W>>2>>>0],ye=we()[m+4>>>2>>>0];m+=8;for(var Ee=0;Ee>>0],Ye=ll[d];ze===0||ze===10?((d===1?k:E)(rr(Ye)),Ye.length=0):Ye.push(ze)}I+=ye}return we()[C>>>2>>>0]=I,0}function lo(d){return d>>>0}c||function(){for(var d=n.numThreads-1;d--;)ds();te.unshift(()=>{Pe++,function(m){c?m():Promise.all(qe.map(dr)).then(m)}(()=>Ae())})}();for(var co=Array(256),kn=0;256>kn;++kn)co[kn]=String.fromCharCode(kn);tn=co,Lr=n.BindingError=class extends Error{constructor(d){super(d),this.name="BindingError"}},n.InternalError=class extends Error{constructor(d){super(d),this.name="InternalError"}},Ar.push(0,1,void 0,1,null,1,!0,1,!1,1),n.count_emval_handles=()=>Ar.length/2-5-Rs.length;var Oe,dl=[Re,Fe,Be,kr,ps,ms,fs,Qr,Ps,Qs,Xs,Js,Ys,_s,Zs,en,qn,Zi,eo,no,Zn,io,oo,ei,ao];(async function(){function d(C,I){return Oe=C.exports,Oe=function(){var W=Oe,ne={};for(let[ye,Ee]of Object.entries(W))ne[ye]=typeof Ee=="function"?(...ze)=>{qt.push(ye);try{return Ee(...ze)}finally{ce||(qt.pop(),Rt&&ur===1&&qt.length===0&&(ur=0,be+=1,Ht(Qo),typeof Fibers<"u"&&Fibers.le()))}}:Ee;return ne}(),Oe=function(){var W=Oe,ne=Ee=>ze=>Ee(ze)>>>0,ye=Ee=>()=>Ee()>>>0;return(W=Object.assign({},W)).Cb=ne(W.Cb),W.fc=ye(W.fc),W.ic=ne(W.ic),W.vc=ne(W.vc),W.wc=ye(W.wc),W.Ac=ne(W.Ac),W}(),ut.push(Oe.jc),w=I,Ae(),Oe}Pe++;var m=Le();if(n.instantiateWasm)return new Promise(C=>{n.instantiateWasm(m,(I,W)=>{d(I,W),C(I.exports)})});if(c)return new Promise(C=>{He=I=>{var W=new WebAssembly.Instance(I,Le());C(d(W,I))}});me??(me=n.locateFile?n.locateFile?n.locateFile("ort-wasm-simd-threaded.jsep.wasm",A):A+"ort-wasm-simd-threaded.jsep.wasm":new URL("/assets/ort-wasm-simd-threaded.jsep-BAR87mbD.wasm",self.location.href).href);try{var T=await async function(C){var I=me;if(!ae&&typeof WebAssembly.instantiateStreaming=="function"&&!he(I))try{var W=fetch(I,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(W,C)}catch(ne){E(`wasm streaming compile failed: ${ne}`),E("falling back to ArrayBuffer instantiation")}return async function(ne,ye){try{var Ee=await async function(ze){if(!ae)try{var Ye=await h(ze);return new Uint8Array(Ye)}catch{}if(ze==me&&ae)ze=new Uint8Array(ae);else{if(!g)throw"both async and sync fetching of the wasm failed";ze=g(ze)}return ze}(ne);return await WebAssembly.instantiate(Ee,ye)}catch(ze){E(`failed to asynchronously prepare wasm: ${ze}`),Ie(ze)}}(I,C)}(m);return d(T.instance,T.module)}catch(C){return i(C),Promise.reject(C)}})();var uo=d=>(uo=Oe.Cb)(d),ti=()=>(ti=Oe.Db)();n._OrtInit=(d,m)=>(n._OrtInit=Oe.Eb)(d,m),n._OrtGetLastError=(d,m)=>(n._OrtGetLastError=Oe.Fb)(d,m),n._OrtCreateSessionOptions=(d,m,T,C,I,W,ne,ye,Ee,ze)=>(n._OrtCreateSessionOptions=Oe.Gb)(d,m,T,C,I,W,ne,ye,Ee,ze),n._OrtAppendExecutionProvider=(d,m)=>(n._OrtAppendExecutionProvider=Oe.Hb)(d,m),n._OrtAddFreeDimensionOverride=(d,m,T)=>(n._OrtAddFreeDimensionOverride=Oe.Ib)(d,m,T),n._OrtAddSessionConfigEntry=(d,m,T)=>(n._OrtAddSessionConfigEntry=Oe.Jb)(d,m,T),n._OrtReleaseSessionOptions=d=>(n._OrtReleaseSessionOptions=Oe.Kb)(d),n._OrtCreateSession=(d,m,T)=>(n._OrtCreateSession=Oe.Lb)(d,m,T),n._OrtReleaseSession=d=>(n._OrtReleaseSession=Oe.Mb)(d),n._OrtGetInputOutputCount=(d,m,T)=>(n._OrtGetInputOutputCount=Oe.Nb)(d,m,T),n._OrtGetInputName=(d,m)=>(n._OrtGetInputName=Oe.Ob)(d,m),n._OrtGetOutputName=(d,m)=>(n._OrtGetOutputName=Oe.Pb)(d,m),n._OrtFree=d=>(n._OrtFree=Oe.Qb)(d),n._OrtCreateTensor=(d,m,T,C,I,W)=>(n._OrtCreateTensor=Oe.Rb)(d,m,T,C,I,W),n._OrtGetTensorData=(d,m,T,C,I)=>(n._OrtGetTensorData=Oe.Sb)(d,m,T,C,I),n._OrtReleaseTensor=d=>(n._OrtReleaseTensor=Oe.Tb)(d),n._OrtCreateRunOptions=(d,m,T,C)=>(n._OrtCreateRunOptions=Oe.Ub)(d,m,T,C),n._OrtAddRunConfigEntry=(d,m,T)=>(n._OrtAddRunConfigEntry=Oe.Vb)(d,m,T),n._OrtReleaseRunOptions=d=>(n._OrtReleaseRunOptions=Oe.Wb)(d),n._OrtCreateBinding=d=>(n._OrtCreateBinding=Oe.Xb)(d),n._OrtBindInput=(d,m,T)=>(n._OrtBindInput=Oe.Yb)(d,m,T),n._OrtBindOutput=(d,m,T,C)=>(n._OrtBindOutput=Oe.Zb)(d,m,T,C),n._OrtClearBoundOutputs=d=>(n._OrtClearBoundOutputs=Oe._b)(d),n._OrtReleaseBinding=d=>(n._OrtReleaseBinding=Oe.$b)(d),n._OrtRunWithBinding=(d,m,T,C,I)=>(n._OrtRunWithBinding=Oe.ac)(d,m,T,C,I),n._OrtRun=(d,m,T,C,I,W,ne,ye)=>(n._OrtRun=Oe.bc)(d,m,T,C,I,W,ne,ye),n._OrtEndProfiling=d=>(n._OrtEndProfiling=Oe.cc)(d),n._JsepOutput=(d,m,T)=>(n._JsepOutput=Oe.dc)(d,m,T),n._JsepGetNodeName=d=>(n._JsepGetNodeName=Oe.ec)(d);var In=()=>(In=Oe.fc)(),Ur=n._free=d=>(Ur=n._free=Oe.gc)(d),an=n._malloc=d=>(an=n._malloc=Oe.ic)(d),ri=(d,m,T,C,I,W)=>(ri=Oe.kc)(d,m,T,C,I,W),po=()=>(po=Oe.lc)(),si=(d,m,T,C,I)=>(si=Oe.mc)(d,m,T,C,I),ho=d=>(ho=Oe.nc)(d),ni=d=>(ni=Oe.oc)(d),ii=(d,m)=>(ii=Oe.pc)(d,m),mo=()=>(mo=Oe.qc)(),gt=(d,m)=>(gt=Oe.rc)(d,m),Us=d=>(Us=Oe.sc)(d),fo=(d,m)=>(fo=Oe.tc)(d,m),mt=d=>(mt=Oe.uc)(d),An=d=>(An=Oe.vc)(d),ft=()=>(ft=Oe.wc)(),_o=d=>(_o=Oe.xc)(d),oi=d=>(oi=Oe.yc)(d),go=(d,m,T)=>(go=Oe.zc)(d,m,T),wo=d=>(wo=Oe.Ac)(d),ai=n.dynCall_iii=(d,m,T)=>(ai=n.dynCall_iii=Oe.Bc)(d,m,T),yo=n.dynCall_vi=(d,m)=>(yo=n.dynCall_vi=Oe.Cc)(d,m),li=n.dynCall_ii=(d,m)=>(li=n.dynCall_ii=Oe.Dc)(d,m),di=n.dynCall_vii=(d,m,T)=>(di=n.dynCall_vii=Oe.Ec)(d,m,T),Mo=n.dynCall_iiii=(d,m,T,C)=>(Mo=n.dynCall_iiii=Oe.Fc)(d,m,T,C),bo=n.dynCall_viii=(d,m,T,C)=>(bo=n.dynCall_viii=Oe.Gc)(d,m,T,C),ci=n.dynCall_iiiii=(d,m,T,C,I)=>(ci=n.dynCall_iiiii=Oe.Hc)(d,m,T,C,I),vo=n.dynCall_viiii=(d,m,T,C,I)=>(vo=n.dynCall_viiii=Oe.Ic)(d,m,T,C,I),To=n.dynCall_viiiiii=(d,m,T,C,I,W,ne)=>(To=n.dynCall_viiiiii=Oe.Jc)(d,m,T,C,I,W,ne),ui=n.dynCall_viiiiiii=(d,m,T,C,I,W,ne,ye)=>(ui=n.dynCall_viiiiiii=Oe.Kc)(d,m,T,C,I,W,ne,ye),xo=n.dynCall_ji=(d,m)=>(xo=n.dynCall_ji=Oe.Lc)(d,m),Eo=n.dynCall_v=d=>(Eo=n.dynCall_v=Oe.Mc)(d),pi=n.dynCall_viiiii=(d,m,T,C,I,W)=>(pi=n.dynCall_viiiii=Oe.Nc)(d,m,T,C,I,W),Po=n.dynCall_i=d=>(Po=n.dynCall_i=Oe.Oc)(d),Co=n.dynCall_fii=(d,m,T)=>(Co=n.dynCall_fii=Oe.Pc)(d,m,T),hi=n.dynCall_viiiiiiii=(d,m,T,C,I,W,ne,ye,Ee)=>(hi=n.dynCall_viiiiiiii=Oe.Qc)(d,m,T,C,I,W,ne,ye,Ee),So=n.dynCall_viiiiiiiiii=(d,m,T,C,I,W,ne,ye,Ee,ze,Ye)=>(So=n.dynCall_viiiiiiiiii=Oe.Rc)(d,m,T,C,I,W,ne,ye,Ee,ze,Ye),$o=n.dynCall_jiii=(d,m,T,C)=>($o=n.dynCall_jiii=Oe.Sc)(d,m,T,C),mi=n.dynCall_dii=(d,m,T)=>(mi=n.dynCall_dii=Oe.Tc)(d,m,T),ko=n.dynCall_viiiiiiiii=(d,m,T,C,I,W,ne,ye,Ee,ze)=>(ko=n.dynCall_viiiiiiiii=Oe.Uc)(d,m,T,C,I,W,ne,ye,Ee,ze),Io=n.dynCall_viiiiiiiiiii=(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot)=>(Io=n.dynCall_viiiiiiiiiii=Oe.Vc)(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot),fi=n.dynCall_iiiiii=(d,m,T,C,I,W)=>(fi=n.dynCall_iiiiii=Oe.Wc)(d,m,T,C,I,W),Ao=n.dynCall_iij=(d,m,T)=>(Ao=n.dynCall_iij=Oe.Xc)(d,m,T),Fo=n.dynCall_iiiiiiiiii=(d,m,T,C,I,W,ne,ye,Ee,ze)=>(Fo=n.dynCall_iiiiiiiiii=Oe.Yc)(d,m,T,C,I,W,ne,ye,Ee,ze),Oo=n.dynCall_iiiiiiiiiii=(d,m,T,C,I,W,ne,ye,Ee,ze,Ye)=>(Oo=n.dynCall_iiiiiiiiiii=Oe.Zc)(d,m,T,C,I,W,ne,ye,Ee,ze,Ye),Do=n.dynCall_vij=(d,m,T)=>(Do=n.dynCall_vij=Oe._c)(d,m,T),_i=n.dynCall_iiif=(d,m,T,C)=>(_i=n.dynCall_iiif=Oe.$c)(d,m,T,C),Lo=n.dynCall_iiij=(d,m,T,C)=>(Lo=n.dynCall_iiij=Oe.ad)(d,m,T,C),zo=n.dynCall_fiii=(d,m,T,C)=>(zo=n.dynCall_fiii=Oe.bd)(d,m,T,C),gi=n.dynCall_viiiiiiiiiiiii=(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt)=>(gi=n.dynCall_viiiiiiiiiiiii=Oe.cd)(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt),Bo=n.dynCall_vjiii=(d,m,T,C,I)=>(Bo=n.dynCall_vjiii=Oe.dd)(d,m,T,C,I),Ro=n.dynCall_vif=(d,m,T)=>(Ro=n.dynCall_vif=Oe.ed)(d,m,T),wi=n.dynCall_iiiiiii=(d,m,T,C,I,W,ne)=>(wi=n.dynCall_iiiiiii=Oe.fd)(d,m,T,C,I,W,ne),No=n.dynCall_iiiij=(d,m,T,C,I)=>(No=n.dynCall_iiiij=Oe.gd)(d,m,T,C,I),jo=n.dynCall_iiiiiiii=(d,m,T,C,I,W,ne,ye)=>(jo=n.dynCall_iiiiiiii=Oe.hd)(d,m,T,C,I,W,ne,ye),yi=n.dynCall_viiiiiiiiiiii=(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t)=>(yi=n.dynCall_viiiiiiiiiiii=Oe.id)(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t),Vo=n.dynCall_diii=(d,m,T,C)=>(Vo=n.dynCall_diii=Oe.jd)(d,m,T,C),Uo=n.dynCall_jiiii=(d,m,T,C,I)=>(Uo=n.dynCall_jiiii=Oe.kd)(d,m,T,C,I),Mi=n.dynCall_viiij=(d,m,T,C,I)=>(Mi=n.dynCall_viiij=Oe.ld)(d,m,T,C,I),Wo=n.dynCall_fiiii=(d,m,T,C,I)=>(Wo=n.dynCall_fiiii=Oe.md)(d,m,T,C,I),Go=n.dynCall_viiif=(d,m,T,C,I)=>(Go=n.dynCall_viiif=Oe.nd)(d,m,T,C,I),bi=n.dynCall_diiii=(d,m,T,C,I)=>(bi=n.dynCall_diiii=Oe.od)(d,m,T,C,I),Ko=n.dynCall_viiid=(d,m,T,C,I)=>(Ko=n.dynCall_viiid=Oe.pd)(d,m,T,C,I),Ho=n.dynCall_iiiijii=(d,m,T,C,I,W,ne)=>(Ho=n.dynCall_iiiijii=Oe.qd)(d,m,T,C,I,W,ne),vi=n.dynCall_iiiiiij=(d,m,T,C,I,W,ne)=>(vi=n.dynCall_iiiiiij=Oe.rd)(d,m,T,C,I,W,ne),qo=d=>(qo=Oe.sd)(d),Qo=()=>(Qo=Oe.td)(),Xo=d=>(Xo=Oe.ud)(d),Jo=()=>(Jo=Oe.vd)();function Yo(d,m,T){var C=ft();try{di(d,m,T)}catch(I){if(mt(C),I!==I+0)throw I;gt(1,0)}}function cl(d,m,T){var C=ft();try{return ai(d,m,T)}catch(I){if(mt(C),I!==I+0)throw I;gt(1,0)}}function ul(d,m){var T=ft();try{yo(d,m)}catch(C){if(mt(T),C!==C+0)throw C;gt(1,0)}}function pl(d,m){var T=ft();try{return li(d,m)}catch(C){if(mt(T),C!==C+0)throw C;gt(1,0)}}function hl(d,m,T,C){var I=ft();try{return Mo(d,m,T,C)}catch(W){if(mt(I),W!==W+0)throw W;gt(1,0)}}function Zo(d,m,T,C,I){var W=ft();try{vo(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function ml(d,m,T,C,I){var W=ft();try{return ci(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function fl(d,m,T,C){var I=ft();try{bo(d,m,T,C)}catch(W){if(mt(I),W!==W+0)throw W;gt(1,0)}}function _l(d,m,T,C,I,W,ne){var ye=ft();try{return wi(d,m,T,C,I,W,ne)}catch(Ee){if(mt(ye),Ee!==Ee+0)throw Ee;gt(1,0)}}function gl(d){var m=ft();try{Eo(d)}catch(T){if(mt(m),T!==T+0)throw T;gt(1,0)}}function ea(d,m,T){var C=ft();try{return Ao(d,m,T)}catch(I){if(mt(C),I!==I+0)throw I;gt(1,0)}}function wl(d,m,T,C,I,W){var ne=ft();try{pi(d,m,T,C,I,W)}catch(ye){if(mt(ne),ye!==ye+0)throw ye;gt(1,0)}}function yl(d,m,T){var C=ft();try{Do(d,m,T)}catch(I){if(mt(C),I!==I+0)throw I;gt(1,0)}}function Ml(d,m,T,C,I,W,ne){var ye=ft();try{To(d,m,T,C,I,W,ne)}catch(Ee){if(mt(ye),Ee!==Ee+0)throw Ee;gt(1,0)}}function bl(d,m,T,C,I,W,ne,ye){var Ee=ft();try{ui(d,m,T,C,I,W,ne,ye)}catch(ze){if(mt(Ee),ze!==ze+0)throw ze;gt(1,0)}}function ta(d,m,T,C,I,W){var ne=ft();try{return fi(d,m,T,C,I,W)}catch(ye){if(mt(ne),ye!==ye+0)throw ye;gt(1,0)}}function vl(d,m,T,C,I,W,ne,ye){var Ee=ft();try{return jo(d,m,T,C,I,W,ne,ye)}catch(ze){if(mt(Ee),ze!==ze+0)throw ze;gt(1,0)}}function Tl(d,m,T,C,I,W,ne,ye,Ee,ze){var Ye=ft();try{ko(d,m,T,C,I,W,ne,ye,Ee,ze)}catch(ot){if(mt(Ye),ot!==ot+0)throw ot;gt(1,0)}}function ra(d,m,T,C,I,W,ne,ye,Ee){var ze=ft();try{hi(d,m,T,C,I,W,ne,ye,Ee)}catch(Ye){if(mt(ze),Ye!==Ye+0)throw Ye;gt(1,0)}}function xl(d){var m=ft();try{return Po(d)}catch(T){if(mt(m),T!==T+0)throw T;gt(1,0)}}function El(d,m,T,C,I,W,ne,ye,Ee,ze){var Ye=ft();try{return Fo(d,m,T,C,I,W,ne,ye,Ee,ze)}catch(ot){if(mt(Ye),ot!==ot+0)throw ot;gt(1,0)}}function sa(d,m,T){var C=ft();try{return Co(d,m,T)}catch(I){if(mt(C),I!==I+0)throw I;gt(1,0)}}function Pl(d,m,T,C){var I=ft();try{return $o(d,m,T,C)}catch(W){if(mt(I),W!==W+0)throw W;return gt(1,0),0n}}function Cl(d,m,T){var C=ft();try{return mi(d,m,T)}catch(I){if(mt(C),I!==I+0)throw I;gt(1,0)}}function na(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot){var _t=ft();try{Io(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot)}catch(Bt){if(mt(_t),Bt!==Bt+0)throw Bt;gt(1,0)}}function Sl(d,m,T,C,I,W,ne,ye,Ee,ze,Ye){var ot=ft();try{So(d,m,T,C,I,W,ne,ye,Ee,ze,Ye)}catch(_t){if(mt(ot),_t!==_t+0)throw _t;gt(1,0)}}function $l(d,m,T,C,I,W,ne,ye,Ee,ze,Ye){var ot=ft();try{return Oo(d,m,T,C,I,W,ne,ye,Ee,ze,Ye)}catch(_t){if(mt(ot),_t!==_t+0)throw _t;gt(1,0)}}function ia(d,m,T,C){var I=ft();try{return _i(d,m,T,C)}catch(W){if(mt(I),W!==W+0)throw W;gt(1,0)}}function kl(d,m,T,C){var I=ft();try{return Lo(d,m,T,C)}catch(W){if(mt(I),W!==W+0)throw W;gt(1,0)}}function Il(d,m,T,C){var I=ft();try{return zo(d,m,T,C)}catch(W){if(mt(I),W!==W+0)throw W;gt(1,0)}}function Ti(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt){var Fr=ft();try{gi(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t,Bt)}catch($s){if(mt(Fr),$s!==$s+0)throw $s;gt(1,0)}}function Al(d,m,T,C,I){var W=ft();try{Bo(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function Fl(d,m,T){var C=ft();try{Ro(d,m,T)}catch(I){if(mt(C),I!==I+0)throw I;gt(1,0)}}function oa(d,m){var T=ft();try{return xo(d,m)}catch(C){if(mt(T),C!==C+0)throw C;return gt(1,0),0n}}function aa(d,m,T,C,I){var W=ft();try{return No(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function Ol(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t){var Bt=ft();try{yi(d,m,T,C,I,W,ne,ye,Ee,ze,Ye,ot,_t)}catch(Fr){if(mt(Bt),Fr!==Fr+0)throw Fr;gt(1,0)}}function la(d,m,T,C){var I=ft();try{return Vo(d,m,T,C)}catch(W){if(mt(I),W!==W+0)throw W;gt(1,0)}}function Dl(d,m,T,C,I){var W=ft();try{return Uo(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;return gt(1,0),0n}}function Ll(d,m,T,C,I){var W=ft();try{Mi(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function xi(d,m,T,C,I){var W=ft();try{return Wo(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function da(d,m,T,C,I){var W=ft();try{Go(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function zl(d,m,T,C,I){var W=ft();try{return bi(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function Bl(d,m,T,C,I){var W=ft();try{Ko(d,m,T,C,I)}catch(ne){if(mt(W),ne!==ne+0)throw ne;gt(1,0)}}function Rl(d,m,T,C,I,W,ne){var ye=ft();try{return Ho(d,m,T,C,I,W,ne)}catch(Ee){if(mt(ye),Ee!==Ee+0)throw Ee;gt(1,0)}}function ca(d,m,T,C,I,W,ne){var ye=ft();try{return vi(d,m,T,C,I,W,ne)}catch(Ee){if(mt(ye),Ee!==Ee+0)throw Ee;gt(1,0)}}return n.stackSave=()=>ft(),n.stackRestore=d=>mt(d),n.stackAlloc=d=>An(d),n.setValue=function(d,m,T="i8"){switch(T.endsWith("*")&&(T="*"),T){case"i1":case"i8":N()[d>>>0]=m;break;case"i16":G()[d>>>1>>>0]=m;break;case"i32":X()[d>>>2>>>0]=m;break;case"i64":H[d>>>3]=BigInt(m);break;case"float":_e()[d>>>2>>>0]=m;break;case"double":ke()[d>>>3>>>0]=m;break;case"*":we()[d>>>2>>>0]=m;break;default:Ie(`invalid type for setValue: ${T}`)}},n.getValue=function(d,m="i8"){switch(m.endsWith("*")&&(m="*"),m){case"i1":case"i8":return N()[d>>>0];case"i16":return G()[d>>>1>>>0];case"i32":return X()[d>>>2>>>0];case"i64":return H[d>>>3];case"float":return _e()[d>>>2>>>0];case"double":return ke()[d>>>3>>>0];case"*":return we()[d>>>2>>>0];default:Ie(`invalid type for getValue: ${m}`)}},n.UTF8ToString=zt,n.stringToUTF8=Er,n.lengthBytesUTF8=hs,function d(){if(0{_d(),bd=typeof location>"u"?void 0:location.origin,vd=self.location.href>"file:"&&self.location.href<"file;",lp=()=>{{if(vd){let e=URL;return new URL(new e("ort.bundle.min.mjs",self.location.href).href,bd).href}return self.location.href}},Rr=lp(),dp=()=>{if(Rr&&!Rr.startsWith("blob:"))return Rr.substring(0,Rr.lastIndexOf("/")+1)},ga=(e,r)=>{try{let t=r??Rr;return(t?new URL(e,t):new URL(e)).origin===bd}catch{return!1}},cp=(e,r)=>{let t=r??Rr;try{return(t?new URL(e,t):new URL(e)).href}catch{return}},up=(e,r)=>`${r??"./"}${e}`,Td=async e=>{let r=await(await fetch(e,{credentials:"same-origin"})).blob();return URL.createObjectURL(r)},pp=async e=>(await import(e)).default,xd=(av(),fa(sp)).default,hp=async()=>{if(!Rr)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(ga(Rr))return[void 0,xd()];let e=await Td(Rr);return[e,xd(e)]},Ed=(lv(),fa(ip)).default,mp=async(e,r,t)=>{if(!e&&!r&&Ed&&Rr&&ga(Rr))return[void 0,Ed];{let s="ort-wasm-simd-threaded.jsep.mjs",i=e??cp(s,r),n=t&&i&&!ga(i,r),o=n?await Td(i):i??up(s,r);return[n?o:void 0,await pp(o)]}}}),Cd,wa,Ai,Sd,fp,_p,$d,ar,hn=Ve(()=>{Pd(),wa=!1,Ai=!1,Sd=!1,fp=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return 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}},_p=()=>{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}},$d=async e=>{if(wa)return Promise.resolve();if(Ai)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(Sd)throw new Error("previous call to 'initializeWebAssembly()' failed.");Ai=!0;let r=e.initTimeout,t=e.numThreads;if(!_p())throw new Error("WebAssembly SIMD is not supported in the current environment.");let s=fp();t>1&&!s&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+t+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),e.numThreads=t=1);let i=e.wasmPaths,n=typeof i=="string"?i:void 0,o=i==null?void 0:i.mjs,a=(o==null?void 0:o.href)??o,l=i==null?void 0:i.wasm,c=(l==null?void 0:l.href)??l,p=e.wasmBinary,[u,h]=await mp(a,n,t>1),g=!1,_=[];if(r>0&&_.push(new Promise(P=>{setTimeout(()=>{g=!0,P()},r)})),_.push(new Promise((P,A)=>{let v={numThreads:t};if(p)v.wasmBinary=p;else if(c||n)v.locateFile=y=>c??n+y;else if(a&&a.indexOf("blob:")!==0)v.locateFile=y=>new URL(y,a).href;else if(u){let y=dp();y&&(v.locateFile=k=>y+k)}h(v).then(y=>{Ai=!1,wa=!0,Cd=y,P(),u&&URL.revokeObjectURL(u)},y=>{Ai=!1,Sd=!0,A(y)})})),await Promise.race(_),g)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},ar=()=>{if(wa&&Cd)return Cd;throw new Error("WebAssembly is not initialized yet.")}}),Mr,ya,At,kd=Ve(()=>{hn(),Mr=(e,r)=>{let t=ar(),s=t.lengthBytesUTF8(e)+1,i=t._malloc(s);return t.stringToUTF8(e,i,s),r.push(i),i},ya=(e,r,t,s)=>{if(typeof e=="object"&&e!==null){if(t.has(e))throw new Error("Circular reference in options");t.add(e)}Object.entries(e).forEach(([i,n])=>{let o=r?r+i:i;if(typeof n=="object")ya(n,o+".",t,s);else if(typeof n=="string"||typeof n=="number")s(o,n.toString());else if(typeof n=="boolean")s(o,n?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof n}`)})},At=e=>{let r=ar(),t=r.stackSave();try{let s=r.PTR_SIZE,i=r.stackAlloc(2*s);r._OrtGetLastError(i,i+s);let n=Number(r.getValue(i,s===4?"i32":"i64")),o=r.getValue(i+s,"*"),a=o?r.UTF8ToString(o):"";throw new Error(`${e} ERROR_CODE: ${n}, ERROR_MESSAGE: ${a}`)}finally{r.stackRestore(t)}}}),gp,dv=Ve(()=>{hn(),kd(),gp=e=>{let r=ar(),t=0,s=[],i=e||{};try{if((e==null?void 0:e.logSeverityLevel)===void 0)i.logSeverityLevel=2;else if(typeof e.logSeverityLevel!="number"||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if((e==null?void 0:e.logVerbosityLevel)===void 0)i.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!="number"||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);(e==null?void 0:e.terminate)===void 0&&(i.terminate=!1);let n=0;return(e==null?void 0:e.tag)!==void 0&&(n=Mr(e.tag,s)),t=r._OrtCreateRunOptions(i.logSeverityLevel,i.logVerbosityLevel,!!i.terminate,n),t===0&&At("Can't create run options."),(e==null?void 0:e.extra)!==void 0&&ya(e.extra,"",new WeakSet,(o,a)=>{let l=Mr(o,s),c=Mr(a,s);r._OrtAddRunConfigEntry(t,l,c)!==0&&At(`Can't set a run config entry: ${o} - ${a}.`)}),[t,s]}catch(n){throw t!==0&&r._OrtReleaseRunOptions(t),s.forEach(o=>r._free(o)),n}}}),wp,yp,Mp,bp,vp,cv=Ve(()=>{hn(),kd(),wp=e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}},yp=e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}},Mp=e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});let r=e.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some(t=>(typeof t=="string"?t:t.name)==="webgpu")&&(e.enableMemPattern=!1)},bp=(e,r,t)=>{for(let s of r){let i=typeof s=="string"?s:s.name;switch(i){case"webnn":if(i="WEBNN",typeof s!="string"){let o=s==null?void 0:s.deviceType;if(o){let a=Mr("deviceType",t),l=Mr(o,t);ar()._OrtAddSessionConfigEntry(e,a,l)!==0&&At(`Can't set a session config entry: 'deviceType' - ${o}.`)}}break;case"webgpu":if(i="JS",typeof s!="string"){let o=s;if(o!=null&&o.preferredLayout){if(o.preferredLayout!=="NCHW"&&o.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${o.preferredLayout}`);let a=Mr("preferredLayout",t),l=Mr(o.preferredLayout,t);ar()._OrtAddSessionConfigEntry(e,a,l)!==0&&At(`Can't set a session config entry: 'preferredLayout' - ${o.preferredLayout}.`)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${i}`)}let n=Mr(i,t);ar()._OrtAppendExecutionProvider(e,n)!==0&&At(`Can't append execution provider: ${i}.`)}},vp=e=>{let r=ar(),t=0,s=[],i=e||{};Mp(i);try{let n=wp(i.graphOptimizationLevel??"all"),o=yp(i.executionMode??"sequential"),a=typeof i.logId=="string"?Mr(i.logId,s):0,l=i.logSeverityLevel??2;if(!Number.isInteger(l)||l<0||l>4)throw new Error(`log serverity level is not valid: ${l}`);let c=i.logVerbosityLevel??0;if(!Number.isInteger(c)||c<0||c>4)throw new Error(`log verbosity level is not valid: ${c}`);let p=typeof i.optimizedModelFilePath=="string"?Mr(i.optimizedModelFilePath,s):0;if(t=r._OrtCreateSessionOptions(n,!!i.enableCpuMemArena,!!i.enableMemPattern,o,!!i.enableProfiling,0,a,l,c,p),t===0&&At("Can't create session options."),i.executionProviders&&bp(t,i.executionProviders,s),i.enableGraphCapture!==void 0){if(typeof i.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${i.enableGraphCapture}`);let u=Mr("enableGraphCapture",s),h=Mr(i.enableGraphCapture.toString(),s);r._OrtAddSessionConfigEntry(t,u,h)!==0&&At(`Can't set a session config entry: 'enableGraphCapture' - ${i.enableGraphCapture}.`)}if(i.freeDimensionOverrides)for(let[u,h]of Object.entries(i.freeDimensionOverrides)){if(typeof u!="string")throw new Error(`free dimension override name must be a string: ${u}`);if(typeof h!="number"||!Number.isInteger(h)||h<0)throw new Error(`free dimension override value must be a non-negative integer: ${h}`);let g=Mr(u,s);r._OrtAddFreeDimensionOverride(t,g,h)!==0&&At(`Can't set a free dimension override: ${u} - ${h}.`)}return i.extra!==void 0&&ya(i.extra,"",new WeakSet,(u,h)=>{let g=Mr(u,s),_=Mr(h,s);r._OrtAddSessionConfigEntry(t,g,_)!==0&&At(`Can't set a session config entry: ${u} - ${h}.`)}),[t,s]}catch(n){throw t!==0&&r._OrtReleaseSessionOptions(t)!==0&&At("Can't release session options."),s.forEach(o=>r._free(o)),n}}}),Rn,mn,fn,Id,Ma,Ad,Fd,Od,pt=Ve(()=>{Rn=e=>{switch(e){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"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${e}`)}},mn=e=>{switch(e){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 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${e}`)}},fn=(e,r)=>{let t=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],s=typeof r=="number"?r:r.reduce((i,n)=>i*n,1);return t>0?Math.ceil(s*t):void 0},Id=e=>{switch(e){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}},Ma=e=>{switch(e){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: ${e}`)}},Ad=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",Fd=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint64"||e==="int8"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",Od=e=>{switch(e){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${e}`)}}}),Dd,Tp=Ve(()=>{_d(),Dd=async e=>{if(typeof e=="string"){let r=await fetch(e);if(!r.ok)throw new Error(`failed to load external data file: ${e}`);let t=r.headers.get("Content-Length"),s=t?parseInt(t,10):0;if(s<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${e}, no response body.`);let i=r.body.getReader(),n;try{n=new ArrayBuffer(s)}catch(a){if(a instanceof RangeError){let l=Math.ceil(s/65536);n=new WebAssembly.Memory({initial:l,maximum:l}).buffer}else throw a}let o=0;for(;;){let{done:a,value:l}=await i.read();if(a)break;let c=l.byteLength;new Uint8Array(n,o,c).set(l),o+=c}return new Uint8Array(n,0,s)}}else return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),xp,Ep,Pp,Cp,Ld,Sp,St,Is=Ve(()=>{pt(),xp=["V","I","W","E","F"],Ep=(e,r)=>{console.log(`[${xp[e]},${new Date().toISOString()}]${r}`)},Ld=(e,r)=>{Pp=e,Cp=r},Sp=(e,r)=>{let t=Ma(e),s=Ma(Pp);t>=s&&Ep(t,typeof r=="function"?r():r)},St=(...e)=>{Cp&&Sp(...e)}}),zd,$p=Ve(()=>{pt(),zd=(e,r)=>new(Id(r))(e)}),Bd=Ve(()=>{}),Rd,ba,va,kp,Ip,Nd,jd,Ap,Fp,uv=Ve(()=>{Is(),Bd(),Rd=new Map([[64,250],[128,200],[256,200],[512,200],[2048,230],[4096,200],[8192,50],[16384,50],[32768,50],[65536,50],[131072,50],[262144,50],[524288,50],[1048576,50],[2097152,30],[4194304,20],[8388608,10],[12582912,10],[16777216,10],[26214400,15],[33554432,22],[44236800,2],[58982400,6],[67108864,6],[134217728,6],[167772160,6]]),ba=[],va=e=>Math.ceil(Number(e)/16)*16,kp=e=>{for(let r=0;rIp++,jd=async(e,r,t,s)=>{let i=va(t),n=e.device.createBuffer({size:i,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});try{let o=e.getCommandEncoder();e.endComputePass(),o.copyBufferToBuffer(r,0,n,0,i),e.flush(),await n.mapAsync(GPUMapMode.READ);let a=n.getMappedRange();if(s){let l=s();return l.set(new Uint8Array(a,0,t)),l}else return new Uint8Array(a.slice(0,t))}finally{n.destroy()}},Ap=class{constructor(e){this.backend=e,this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.buffersPending=[],this.capturedPendingBuffers=new Map;for(let[r]of Rd)ba.push(r),this.freeBuffers.set(r,[]),this.freeUniformBuffers.set(r,[]);this.sessionCount=0}upload(e,r){let t=r.buffer,s=r.byteOffset,i=r.byteLength,n=va(i),o=this.storageCache.get(e);if(!o)throw new Error("gpu data for uploading does not exist");if(Number(o.originalSize)!==i)throw new Error(`inconsistent data size. gpu data size=${o.originalSize}, data size=${i}`);let a=this.backend.device.createBuffer({mappedAtCreation:!0,size:n,usage:GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC}),l=a.getMappedRange();new Uint8Array(l).set(new Uint8Array(t,s,i)),a.unmap();let c=this.backend.device.createCommandEncoder();c.copyBufferToBuffer(a,0,o.gpuData.buffer,0,n),this.backend.device.queue.submit([c.finish()]),a.destroy(),St("verbose",()=>`[WebGPU] GpuDataManager.upload(id=${e})`)}memcpy(e,r){let t=this.storageCache.get(e);if(!t)throw new Error("source gpu data for memcpy does not exist");let s=this.storageCache.get(r);if(!s)throw new Error("destination gpu data for memcpy does not exist");if(t.originalSize!==s.originalSize)throw new Error("inconsistent source and destination gpu data size");let i=va(t.originalSize),n=this.backend.getCommandEncoder();this.backend.endComputePass(),n.copyBufferToBuffer(t.gpuData.buffer,0,s.gpuData.buffer,0,i)}registerExternalBuffer(e,r,t){let s;if(t){if(s=t[0],e===t[1])return St("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, buffer is the same, skip.`),s;if(this.backend.capturedCommandList.has(this.backend.currentSessionId))throw new Error(`Registering a different external buffer under graph capture mode is not supported yet. - Please use the previous external buffer!`)}else s=Nd();return this.storageCache.set(s,{gpuData:{id:s,type:0,buffer:e},originalSize:r}),St("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, registered.`),s}unregisterExternalBuffer(e){e!==void 0&&(this.storageCache.delete(e),St("verbose",()=>`[WebGPU] GpuDataManager.unregisterExternalBuffer() => id=${e}`))}create(e,r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST){let t=kp(e),s,i=(r&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE,n=(r&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM;if(i||n){let a=(i?this.freeBuffers:this.freeUniformBuffers).get(t);a?a.length>0?s=a.pop():s=this.backend.device.createBuffer({size:t,usage:r}):s=this.backend.device.createBuffer({size:t,usage:r})}else s=this.backend.device.createBuffer({size:t,usage:r});let o={id:Nd(),type:0,buffer:s};return this.storageCache.set(o.id,{gpuData:o,originalSize:Number(e)}),St("verbose",()=>`[WebGPU] GpuDataManager.create(size=${e}) => id=${o.id}`),o}get(e){var r;return(r=this.storageCache.get(e))==null?void 0:r.gpuData}release(e){let r=typeof e=="bigint"?Number(e):e,t=this.storageCache.get(r);if(!t){if(this.storageCache.size===0)return 0;throw new Error("releasing data does not exist")}return St("verbose",()=>`[WebGPU] GpuDataManager.release(id=${r}), gpuDataId=${t.gpuData.id}`),this.storageCache.delete(r),this.buffersPending.push(t.gpuData.buffer),t.originalSize}async download(e,r){let t=this.storageCache.get(Number(e));if(!t)throw new Error("data does not exist");await jd(this.backend,t.gpuData.buffer,t.originalSize,r)}refreshPendingBuffers(){if(this.buffersPending.length!==0)if(this.backend.sessionStatus==="default"){for(let e of this.buffersPending){let r=Rd.get(e.size);if((e.usage&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE){let t=this.freeBuffers.get(e.size)||[];r===void 0||t.length>=r?e.destroy():t.push(e)}else if((e.usage&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM){let t=this.freeUniformBuffers.get(e.size)||[];r===void 0||t.length>=r?e.destroy():t.push(e)}else e.destroy()}this.buffersPending=[]}else{let e=this.capturedPendingBuffers.get(this.backend.currentSessionId);e||(e=[],this.capturedPendingBuffers.set(this.backend.currentSessionId,e));for(let r of this.buffersPending)e.push(r);this.buffersPending=[]}}dispose(){this.freeBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.freeUniformBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache.forEach(e=>{e.gpuData.buffer.destroy()}),this.capturedPendingBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.capturedPendingBuffers=new Map}onCreateSession(){this.sessionCount+=1}onReleaseSession(e){let r=this.capturedPendingBuffers.get(e);r&&(r.forEach(t=>{t.destroy()}),this.capturedPendingBuffers.delete(e)),this.sessionCount-=1,this.sessionCount===0&&(St("warning",()=>"[WebGPU] Clearing webgpu buffer cache"),this.storageCache.forEach(t=>{t.gpuData.buffer.destroy()}),this.storageCache=new Map)}},Fp=(...e)=>new Ap(...e)}),Op,Dt,Yt=Ve(()=>{Op=class{constructor(e){Object.assign(this,e)}get cacheKey(){return this.key||(this.key=Object.getOwnPropertyNames(this).sort().map(e=>`${this[e]}`).join(";")),this.key}},Dt=e=>new Op(e)}),Dp,Nn,Te,Ta,Lp,zp,Bp,Mt=Ve(()=>{Dp=class{static calcMatMulShape(e,r){return e[1]!==r[0]?void 0:[e[0],r[1]]}},Nn=class{static calcShape(e,r,t=!1){let s=e.length,i=r.length;if(s===0)return r;if(i===0)return e;let n=Math.max(e.length,r.length),o=new Array(n);if(t){if(s<2||i<2)return;let a=Dp.calcMatMulShape([e[s-2],e[s-1]],[r[i-2],r[i-1]]);if(a===void 0)return;[o[n-2],o[n-1]]=a}for(let a=t?3:1;a<=n;a++){let l=s-a<0?1:e[s-a],c=i-a<0?1:r[i-a];if(l!==c&&l>1&&c>1)return;let p=Math.max(l,c);if(l&&c)o[n-a]=Math.max(l,c);else{if(p>1)return;o[n-a]=0}}return o}static isValidBroadcast(e,r){let t=e.length,s=r.length;if(t>s)return!1;for(let i=1;i<=t;i++)if(e[t-i]!==1&&e[t-i]!==r[s-i])return!1;return!0}},Te=class od{static size(r){return od.getSizeFromDimensionRange(r,0,r.length)}static convertShape(r,t=4){let s=r.length;if(s===0)return[];let i=new Array(s),n=s-1;for(;n>=0;){if(r[n]%t===0){i[n]=r[n]/t;break}if(t%r[n]!==0)throw new Error("cannot convert shape");i[n]=1,t/=r[n],n--}for(n--;n>=0;n--)i[n]=r[n];return i}static sizeFromDimension(r,t){if(t<0||t>r.length)throw new Error(`invalid dimension of ${t} for sizeFromDimension as Tensor has ${r.length} dimensions.`);return od.getSizeFromDimensionRange(r,t,r.length)}static sizeToDimension(r,t){if(t<0||t>r.length)throw new Error(`invalid dimension of ${t} for sizeToDimension as Tensor has ${r.length} dimensions.`);return od.getSizeFromDimensionRange(r,0,t)}static getSizeFromDimensionRange(r,t,s){let i=1;for(let n=t;n=0;--i)s[i]=s[i+1]*r[i+1];return s}static normalizeAxis(r,t){if(r<-t&&r>=t)throw new Error("unsupported axis for this operation.");return r<0?r+t:r}static normalizeAxes(r,t){return r.map(s=>this.normalizeAxis(s,t??r.length))}static sortBasedOnPerm(r,t){return t?t.map(s=>r[s]):r.slice().reverse()}static padShape(r,t){let s=r.length;return r.map((i,n)=>i+t[n]+t[n+s])}static areEqual(r,t){return r.length!==t.length?!1:r.every((s,i)=>s===t[i])}},Ta=class ha{static adjustPoolAttributes(r,t,s,i,n,o){if(!r&&s.length!==t.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(r)for(let a=0;a=s.length?s.push(t[a+2]):s[a]=t[a+2];for(let a=0;a=s[a]||o[a+s.length]>=s[a])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(r,t,s,i,n,o,a){if(a){if(n.length!==2*(r.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(t.length!==r.length-2)throw new Error("length of strides should be the length of data dimensions");if(i.length!==r.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let l=0;l{pt(),Mt(),jn=64,xa=(e,r)=>{if(r===3)throw new Error("vec3 has same alignment as vec4, use vec4 instead");switch(Number(e)){case 10:return r>1?`vec${r}`:"f16";case 1:return r>1?`vec${r}`:"f32";case 6:return r>1?`vec${r}`:"i32";case 12:return r>1?`vec${r}`:"u32";case 7:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","i32"];case 13:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","u32"];case 9:if(r!==4)throw new Error("bool must be vec4");return["u32","vec4"];case 22:return"i32";case 21:return"u32";default:throw new Error(`Unknown data type: ${e}`)}},lr=(e,r=1)=>{let t=xa(e,r);return typeof t=="string"?t:t[0]},xr=(e,r=1)=>{let t=xa(e,r);return typeof t=="string"?t:t[1]},nt=(...e)=>{let r=[];return e.forEach(t=>{t.length!==0&&r.push({type:12,data:t},{type:12,data:Te.computeStrides(t)})}),r},Xt=e=>e%4===0?4:e%2===0?2:1,Vd=(e="f32",r,t="0")=>!r||r===1?`${e}(${t})`:`vec${r}<${e}>(${t})`,Vn=(e,r,t)=>e==="f32"?t:r===1?`f32(${t})`:`vec${r}(${t})`,Gs=(e,r)=>r===4?`(${e}.x + ${e}.y + ${e}.z + ${e}.w)`:r===2?`(${e}.x + ${e}.y)`:r===3?`(${e}.x + ${e}.y + ${e}.z)`:e,rt=(e,r,t,s)=>e.startsWith("uniforms.")&&t>4?typeof r=="string"?s==="f16"?`${e}[(${r}) / 8][(${r}) % 8 / 4][(${r}) % 8 % 4]`:`${e}[(${r}) / 4][(${r}) % 4]`:s==="f16"?`${e}[${Math.floor(r/8)}][${Math.floor(r%8/4)}][${r%8%4}]`:`${e}[${Math.floor(r/4)}][${r%4}]`:t>1?`${e}[${r}]`:e,Fi=(e,r,t,s,i)=>{let n=typeof t=="number",o=n?t:t.length,a=[...new Array(o).keys()],l=o<2?"u32":o<=4?`vec${o}`:`array`,c=xa(r,i),p=typeof c=="string"?c:c[1],u=typeof c=="string"?c:c[0],h={indices:l,value:p,storage:u,tensor:r},g=N=>typeof N=="string"?N:`${N}u`,_={offsetToIndices:!1,indicesToOffset:!1,broadcastedIndicesToOffset:!1,set:!1,setByIndices:!1,get:!1,getByIndices:!1},P=n?"uniforms.":"",A=`${P}${e}_shape`,v=`${P}${e}_strides`,y="";for(let N=0;N ${h.indices} { - var indices: ${h.indices}; - var current = offset; - ${y} - return indices; - }`,E=N=>(_.offsetToIndices=!0,o<2?N:`o2i_${e}(${N})`),M=[];if(o>=2)for(let N=o-1;N>=0;N--)M.push(`${rt(v,N,o)} * (indices[${N}])`);let w=o<2?"":` - fn i2o_${e}(indices: ${h.indices}) -> u32 { - return ${M.join("+")}; - }`,x=N=>(_.indicesToOffset=!0,o<2?N:`i2o_${e}(${N})`),$=(...N)=>o===0?"0u":`${h.indices}(${N.map(g).join(",")})`,z=(N,O)=>o<2?`${N}`:`${rt(N,O,o)}`,R=(N,O,G)=>o<2?`${N}=${G};`:`${rt(N,O,o)}=${G};`,Q={},q=(N,O)=>{_.broadcastedIndicesToOffset=!0;let G=`${O.name}broadcastedIndicesTo${e}Offset`;if(G in Q)return`${G}(${N})`;let se=[];for(let X=o-1;X>=0;X--){let we=O.indicesGet("outputIndices",X+O.rank-o);se.push(`${z(v,X)} * (${we} % ${z(A,X)})`)}return Q[G]=`fn ${G}(outputIndices: ${O.type.indices}) -> u32 { - return ${se.length>0?se.join("+"):"0u"}; - }`,`${G}(${N})`},U=(N,O)=>(()=>{if(h.storage===h.value)return`${e}[${N}]=${O};`;if(h.storage==="vec2"&&h.value==="i32")return`${e}[${N}]=vec2(u32(${O}), select(0u, 0xFFFFFFFFu, ${O} < 0));`;if(h.storage==="vec2"&&h.value==="u32")return`${e}[${N}]=vec2(u32(${O}), 0u);`;if(h.storage==="u32"&&h.value==="vec4")return`${e}[${N}]=dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(${O}));`;throw new Error(`not supported combination of storage type ${h.storage} and value type ${h.value} yet`)})(),Z=N=>(()=>{if(h.storage===h.value)return`${e}[${N}]`;if(h.storage==="vec2"&&h.value==="i32")return`i32(${e}[${N}].x)`;if(h.storage==="vec2"&&h.value==="u32")return`u32(${e}[${N}].x)`;if(h.storage==="u32"&&h.value==="vec4")return`vec4(bool(${e}[${N}] & 0xFFu), bool(${e}[${N}] & 0xFF00u), bool(${e}[${N}] & 0xFF0000u), bool(${e}[${N}] & 0xFF000000u))`;throw new Error(`not supported combination of storage type ${h.storage} and value type ${h.value} yet`)})(),H=o<2?"":` - fn get_${e}ByIndices(indices: ${h.indices}) -> ${p} { - return ${Z(`i2o_${e}(indices)`)}; - }`,J=o<2?"":(()=>{let N=a.map(G=>`d${G}: u32`).join(", "),O=a.map(G=>`d${G}`).join(", ");return` - fn get_${e}(${N}) -> ${p} { - return get_${e}ByIndices(${$(O)}); - }`})(),ie=(...N)=>{if(N.length!==o)throw new Error(`indices length must be ${o}`);let O=N.map(g).join(",");return o===0?Z("0u"):o===1?Z(O[0]):(_.get=!0,_.getByIndices=!0,_.indicesToOffset=!0,`get_${e}(${O})`)},ae=N=>o<2?Z(N):(_.getByIndices=!0,_.indicesToOffset=!0,`get_${e}ByIndices(${N})`),ce=o<2?"":` - fn set_${e}ByIndices(indices: ${h.indices}, value: ${p}) { - ${U(`i2o_${e}(indices)`,"value")} - }`,he=o<2?"":(()=>{let N=a.map(G=>`d${G}: u32`).join(", "),O=a.map(G=>`d${G}`).join(", ");return` - fn set_${e}(${N}, value: ${p}) { - set_${e}ByIndices(${$(O)}, value); - }`})();return{impl:()=>{let N=[],O=!1;return _.offsetToIndices&&(N.push(k),O=!0),_.indicesToOffset&&(N.push(w),O=!0),_.broadcastedIndicesToOffset&&(Object.values(Q).forEach(G=>N.push(G)),O=!0),_.set&&(N.push(he),O=!0),_.setByIndices&&(N.push(ce),O=!0),_.get&&(N.push(J),O=!0),_.getByIndices&&(N.push(H),O=!0),!n&&O&&N.unshift(`const ${A} = ${h.indices}(${t.join(",")});`,`const ${v} = ${h.indices}(${Te.computeStrides(t).join(",")});`),N.join(` -`)},type:h,offsetToIndices:E,indicesToOffset:x,broadcastedIndicesToOffset:q,indices:$,indicesGet:z,indicesSet:R,set:(...N)=>{if(N.length!==o+1)throw new Error(`indices length must be ${o}`);let O=N[o];if(typeof O!="string")throw new Error("value must be string");let G=N.slice(0,o).map(g).join(",");return o===0?U("0u",O):o===1?U(G[0],O):(_.set=!0,_.setByIndices=!0,_.indicesToOffset=!0,`set_${e}(${G}, ${O})`)},setByOffset:U,setByIndices:(N,O)=>o<2?U(N,O):(_.setByIndices=!0,_.indicesToOffset=!0,`set_${e}ByIndices(${N}, ${O});`),get:ie,getByOffset:Z,getByIndices:ae,usage:s,name:e,strides:v,shape:A,rank:o}},$e=(e,r,t,s=1)=>Fi(e,r,t,"input",s),tt=(e,r,t,s=1)=>Fi(e,r,t,"output",s),Rp=(e,r,t)=>Fi(e,r,t,"atomicOutput",1),Ud=(e,r,t,s=1)=>Fi(e,r,t,"internal",s),Np=class{constructor(e,r){this.normalizedDispatchGroup=e,this.limits=r,this.internalVariables=[],this.variables=[],this.uniforms=[],this.variableIndex=0}guardAgainstOutOfBoundsWorkgroupSizes(e){return`if (global_idx >= ${typeof e=="number"?`${e}u`:e}) { return; }`}mainStart(e=jn){let r=typeof e=="number"?e:e[0],t=typeof e=="number"?1:e[1],s=typeof e=="number"?1:e[2];if(r>this.limits.maxComputeWorkgroupSizeX||t>this.limits.maxComputeWorkgroupSizeY||s>this.limits.maxComputeWorkgroupSizeZ)throw new Error(`workgroup size [${r}, ${t}, ${s}] exceeds the maximum workgroup size [${this.limits.maxComputeWorkgroupSizeX}, ${this.limits.maxComputeWorkgroupSizeY}, ${this.limits.maxComputeWorkgroupSizeZ}].`);if(r*t*s>this.limits.maxComputeInvocationsPerWorkgroup)throw new Error(`workgroup size [${r}, ${t}, ${s}] exceeds the maximum workgroup invocations ${this.limits.maxComputeInvocationsPerWorkgroup}.`);let i=this.normalizedDispatchGroup[1]===1&&this.normalizedDispatchGroup[2]===1,n=i?`@builtin(global_invocation_id) global_id : vec3, - @builtin(workgroup_id) workgroup_id : vec3, - @builtin(local_invocation_index) local_idx : u32, - @builtin(local_invocation_id) local_id : vec3`:`@builtin(global_invocation_id) global_id : vec3, - @builtin(local_invocation_id) local_id : vec3, - @builtin(local_invocation_index) local_idx : u32, - @builtin(workgroup_id) workgroup_id : vec3, - @builtin(num_workgroups) num_workgroups : vec3`,o=i?`let global_idx = global_id.x; - let workgroup_index = workgroup_id.x;`:`let workgroup_index = workgroup_id.z * num_workgroups[0] * num_workgroups[1] + - workgroup_id.y * num_workgroups[0] + workgroup_id.x; - let global_idx = workgroup_index * ${r*t*s}u + local_idx;`;return`@compute @workgroup_size(${r}, ${t}, ${s}) - fn main(${n}) { - ${o} - `}appendVariableUniforms(e){e.rank!==0&&(e.shape.startsWith("uniforms.")&&this.uniforms.push({name:e.shape.replace("uniforms.",""),type:"u32",length:e.rank}),e.strides.startsWith("uniforms.")&&this.uniforms.push({name:e.strides.replace("uniforms.",""),type:"u32",length:e.rank}))}declareVariable(e,r){if(e.usage==="internal")throw new Error("cannot use internal variable with declareVariable(). use registerInternalVariables() instead.");this.variables.push(e),this.appendVariableUniforms(e);let t=e.usage==="input"?"read":"read_write",s=e.usage==="atomicOutput"?"atomic":e.type.storage;return`@group(0) @binding(${r}) var ${e.name}: array<${s}>;`}declareVariables(...e){return e.map(r=>this.declareVariable(r,this.variableIndex++)).join(` -`)}registerInternalVariable(e){if(e.usage!=="internal")throw new Error("cannot use input or output variable with registerInternalVariable(). use declareVariables() instead.");this.internalVariables.push(e),this.appendVariableUniforms(e)}registerInternalVariables(...e){return e.forEach(r=>this.registerInternalVariable(r)),this}registerUniform(e,r,t=1){return this.uniforms.push({name:e,type:r,length:t}),this}registerUniforms(e){return this.uniforms=this.uniforms.concat(e),this}uniformDeclaration(){if(this.uniforms.length===0)return"";let e=[];for(let{name:r,type:t,length:s}of this.uniforms)if(s&&s>4)t==="f16"?e.push(`@align(16) ${r}:array, ${Math.ceil(s/8)}>`):e.push(`${r}:array, ${Math.ceil(s/4)}>`);else{let i=s==null||s===1?t:`vec${s}<${t}>`;e.push(`${r}:${i}`)}return` - struct Uniforms { ${e.join(", ")} }; - @group(0) @binding(${this.variableIndex}) var uniforms: Uniforms;`}get additionalImplementations(){return this.uniformDeclaration()+this.variables.map(e=>e.impl()).join(` -`)+this.internalVariables.map(e=>e.impl()).join(` -`)}get variablesInfo(){if(this.uniforms.length===0)return;let e=r=>[12,10,1,6][["u32","f16","f32","i32"].indexOf(r)];return this.uniforms.map(r=>[e(r.type),r.length??1])}},jp=(e,r)=>new Np(e,r)}),Vp,Wd,Up,Wp,Gp,Kp,Nr,Hp,qp,Ks=Ve(()=>{pt(),Mt(),Yt(),Tt(),Vp=(e,r)=>{if(!e||e.length!==1)throw new Error("Transpose requires 1 input.");if(r.length!==0&&r.length!==e[0].dims.length)throw new Error(`perm size ${r.length} does not match input rank ${e[0].dims.length}`)},Wd=(e,r)=>r.length!==0?r:[...new Array(e).keys()].reverse(),Up=(e,r)=>Te.sortBasedOnPerm(e,Wd(e.length,r)),Wp=(e,r,t,s)=>{let i=`fn perm(i: ${s.type.indices}) -> ${t.type.indices} { - var a: ${t.type.indices};`;for(let n=0;n{let t=[],s=[];for(let i=0;i{let t=0;for(let s=0;s{let t=e.dataType,s=e.dims.length,i=Wd(s,r),n=Up(e.dims,i),o=e.dims,a=n,l=s<2||Kp(i,e.dims),c;if(l)return c=_=>{let P=$e("input",t,o,4),A=tt("output",t,a,4);return` - ${_.registerUniform("output_size","u32").declareVariables(P,A)} - ${_.mainStart()} - ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - output[global_idx] = input[global_idx]; - }`},{name:"TransposeCopy",shaderCache:{inputDependencies:["type"]},getRunData:()=>{let _=Te.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(_/64/4)},programUniforms:[{type:12,data:Math.ceil(_/4)}]}},getShaderSource:c};let{newShape:p,newPerm:u}=Gp(e.dims,i),h=Te.areEqual(u,[2,3,1]),g=Te.areEqual(u,[3,1,2]);if(p.length===2||h||g){o=h?[p[0],p[1]*p[2]]:g?[p[0]*p[1],p[2]]:p,a=[o[1],o[0]];let _=16;return c=P=>{let A=$e("a",t,o.length),v=tt("output",t,a.length);return` - ${P.registerUniform("output_size","u32").declareVariables(A,v)} - var tile : array, ${_}>; - ${P.mainStart([_,_,1])} - let stride = (uniforms.output_shape[1] - 1) / ${_} + 1; - let workgroup_id_x = workgroup_index % stride; - let workgroup_id_y = workgroup_index / stride; - let input_col = workgroup_id_y * ${_}u + local_id.x; - let input_row = workgroup_id_x * ${_}u + local_id.y; - if (input_row < uniforms.a_shape[0] && input_col < uniforms.a_shape[1]) { - tile[local_id.y][local_id.x] = ${A.getByIndices(`${A.type.indices}(input_row, input_col)`)}; - } - workgroupBarrier(); - - let output_col = workgroup_id_x * ${_}u + local_id.x; - let output_row = workgroup_id_y * ${_}u + local_id.y; - if (output_row < uniforms.output_shape[0] && output_col < uniforms.output_shape[1]) { - ${v.setByIndices(`${v.type.indices}(output_row, output_col)`,"tile[local_id.x][local_id.y]")} - } - }`},{name:"TransposeShared",shaderCache:{inputDependencies:["type"]},getRunData:()=>{let P=Te.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(a[1]/_),y:Math.ceil(a[0]/_)},programUniforms:[{type:12,data:P},...nt(o,a)]}},getShaderSource:c}}return c=_=>{let P=$e("a",t,o.length),A=tt("output",t,a.length);return` - ${_.registerUniform("output_size","u32").declareVariables(P,A)} - - ${Wp(i,s,P,A)} - - ${_.mainStart()} - ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let indices = ${A.offsetToIndices("global_idx")}; - let aIndices = perm(indices); - - ${A.setByOffset("global_idx",P.getByIndices("aIndices"))} - }`},{name:"Transpose",shaderCache:{hint:`${r}`,inputDependencies:["rank"]},getRunData:()=>{let _=Te.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:[{type:12,data:_},...nt(o,a)]}},getShaderSource:c}},Hp=(e,r)=>{Vp(e.inputs,r.perm),e.compute(Nr(e.inputs[0],r.perm))},qp=e=>Dt({perm:e.perm})}),Qp,Xp,Jp,Yp,Zp,eh,th,rh,sh,nh,ns,ih,oh,ah,lh,dh,ch,uh,ph,hh,mh,pv=Ve(()=>{pt(),Mt(),Tt(),Kd(),Ks(),Qp={max:"select(bestValue, candidate, candidate > bestValue)",min:"select(bestValue, candidate, candidate < bestValue)",mean:"bestValue + candidate",sum:"bestValue + candidate",prod:"bestValue * candidate",sumSquare:"bestValue + candidate * candidate",logSumExp:"bestValue + exp(candidate)",l1:"bestValue + abs(candidate)",l2:"bestValue + candidate * candidate",logSum:"bestValue + candidate"},Xp={max:"select(bestValue, candidate, candidate > bestValue)",min:"select(bestValue, candidate, candidate < bestValue)",mean:"bestValue + candidate",sum:"bestValue + candidate",prod:"bestValue * candidate",sumSquare:"bestValue + candidate",logSumExp:"bestValue + candidate",l1:"bestValue + candidate",l2:"bestValue + candidate",logSum:"bestValue + candidate"},Jp={max:"_A[offset]",min:"_A[offset]",mean:"0",sum:"0",prod:"1",sumSquare:"0",logSumExp:"0",l1:"0",l2:"0",logSum:"0"},Yp={max:"bestValue",min:"bestValue",sum:"bestValue",prod:"bestValue",sumSquare:"bestValue",logSumExp:"log(bestValue)",l1:"bestValue",l2:"sqrt(bestValue)",logSum:"log(bestValue)"},Zp=(e,r)=>{let t=[];for(let s=r-e;s{let t=[],s=e.length;for(let n=0;ne[n]);return[t,i]},th=(e,r)=>{let t=e.length+r.length,s=[],i=0;for(let n=0;n{for(let t=0;t{let t=[];if(!rh(e,r)){for(let s=0;st.push(s))}return t},nh=(e,r,t,s,i,n,o)=>{let a=t[0].dims,l=Te.size(n),c=Te.size(o),p=$e("_A",t[0].dataType,a),u=tt("output",i,n),h=64;l===1&&(h=256);let g=` - var aBestValues : array; - `,_=P=>` - ${P.registerUniform("reduceSize","u32").declareVariables(p,u)} - ${g} - fn DIV_CEIL(a : u32, b : u32) -> u32 { - return ((a - 1u) / b + 1u); - } - ${P.mainStart(h)} - - let outputIndex = global_idx / ${h}; - let offset = outputIndex * uniforms.reduceSize; - - var bestValue = f32(${Jp[s]}); - let Length = uniforms.reduceSize; - for (var k = local_idx; k < Length; k = k + ${h}) { - let candidate = f32(${p.getByOffset("offset + k")}); - bestValue = ${Qp[s]}; - } - aBestValues[local_idx] = bestValue; - workgroupBarrier(); - - var reduceSize = min(Length, ${h}u); - for (var currentSize = reduceSize / 2u; reduceSize > 1u; - currentSize = reduceSize / 2u) { - let interval = DIV_CEIL(reduceSize, 2u); - if (local_idx < currentSize) { - let candidate = aBestValues[local_idx + interval]; - bestValue = ${Xp[s]}; - aBestValues[local_idx] = bestValue; - } - reduceSize = interval; - workgroupBarrier(); - } - - if (local_idx == 0u) { - ${u.setByOffset("outputIndex",`${s==="mean"?`${u.type.storage}(bestValue / f32(uniforms.reduceSize))`:`${u.type.storage}(${Yp[s]})`}`)}; - } - }`;return{name:e,shaderCache:{hint:`${r};${h}`,inputDependencies:["type"]},getShaderSource:_,getRunData:()=>({outputs:[{dims:n,dataType:i}],dispatchGroup:{x:l},programUniforms:[{type:12,data:c}]})}},ns=(e,r,t,s)=>{let i=e.inputs.length===1?t:Gd(e.inputs,t),n=i.axes;n.length===0&&!i.noopWithEmptyAxes&&(n=e.inputs[0].dims.map((g,_)=>_));let o=Te.normalizeAxes(n,e.inputs[0].dims.length),a=o,l=e.inputs[0],c=sh(a,e.inputs[0].dims.length);c.length>0&&(l=e.compute(Nr(e.inputs[0],c),{inputs:[0],outputs:[-1]})[0],a=Zp(a.length,l.dims.length));let[p,u]=eh(l.dims,a),h=p;i.keepDims&&(h=th(p,o)),e.compute(nh(r,i.cacheKey,[l],s,e.inputs[0].dataType,h,u),{inputs:[l]})},ih=(e,r)=>{ns(e,"ReduceMeanShared",r,"mean")},oh=(e,r)=>{ns(e,"ReduceL1Shared",r,"l1")},ah=(e,r)=>{ns(e,"ReduceL2Shared",r,"l2")},lh=(e,r)=>{ns(e,"ReduceLogSumExpShared",r,"logSumExp")},dh=(e,r)=>{ns(e,"ReduceMaxShared",r,"max")},ch=(e,r)=>{ns(e,"ReduceMinShared",r,"min")},uh=(e,r)=>{ns(e,"ReduceProdShared",r,"prod")},ph=(e,r)=>{ns(e,"ReduceSumShared",r,"sum")},hh=(e,r)=>{ns(e,"ReduceSumSquareShared",r,"sumSquare")},mh=(e,r)=>{ns(e,"ReduceLogSumShared",r,"logSum")}}),is,fh,Ea,Gd,os,_h,gh,wh,yh,Mh,bh,vh,Th,xh,Eh,as,Ph,Ch,Sh,$h,kh,Ih,Ah,Fh,Oh,Dh,Kd=Ve(()=>{pt(),Mt(),Yt(),Tt(),pv(),is=e=>{if(!e||e.length===0||e.length>2)throw new Error("Reduce op requires 1 or 2 inputs.");if(e.length===2&&e[1].dims.length!==1)throw new Error("Invalid axes input dims.")},fh=e=>["","",`var value = ${e.getByIndices("input_indices")};`,""],Ea=(e,r,t,s,i,n,o=!1,a=!1)=>{let l=[],c=t[0].dims,p=c.length,u=Te.normalizeAxes(i,p),h=!a&&u.length===0;c.forEach((P,A)=>{h||u.indexOf(A)>=0?o&&l.push(1):l.push(P)});let g=l.length,_=Te.size(l);return{name:e,shaderCache:r,getShaderSource:P=>{let A=[],v=$e("_A",t[0].dataType,p),y=tt("output",n,g),k=s(v,y,u),E=k[2];for(let M=0,w=0;M=0?(o&&w++,E=`for(var j${M}: u32 = 0; j${M} < ${c[M]}; j${M}++) { - ${k[2].includes("last_index")?`let last_index = j${M};`:""} - ${v.indicesSet("input_indices",M,`j${M}`)} - ${E} - }`):(A.push(`${v.indicesSet("input_indices",M,y.indicesGet("output_indices",w))};`),w++);return` - - ${P.registerUniform("output_size","u32").declareVariables(v,y)} - - ${P.mainStart()} - ${P.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - var input_indices: ${v.type.indices}; - let output_indices = ${y.offsetToIndices("global_idx")}; - - ${A.join(` -`)} - ${k[0]} // init ops for reduce max/min - ${k[1]} - ${E} - ${k[3]} - ${k.length===4?y.setByOffset("global_idx","value"):k.slice(4).join(` -`)} - }`},getRunData:()=>({outputs:[{dims:l,dataType:n}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:[{type:12,data:_},...nt(c,l)]})}},Gd=(e,r)=>{let t=[];return e[1].dims[0]>0&&e[1].getBigInt64Array().forEach(s=>t.push(Number(s))),Dt({axes:t,keepDims:r.keepDims,noopWithEmptyAxes:r.noopWithEmptyAxes})},os=(e,r,t,s)=>{let i=e.inputs,n=i.length===1?t:Gd(i,t);e.compute(Ea(r,{hint:n.cacheKey,inputDependencies:["rank"]},[i[0]],n.noopWithEmptyAxes&&n.axes.length===0?fh:s,n.axes,i[0].dataType,n.keepDims,n.noopWithEmptyAxes),{inputs:[0]})},_h=(e,r)=>{is(e.inputs),os(e,"ReduceLogSum",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += ${t.getByIndices("input_indices")};`,"value = log(value);"])},gh=(e,r)=>{is(e.inputs),os(e,"ReduceL1",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += abs(${t.getByIndices("input_indices")});`,""])},wh=(e,r)=>{is(e.inputs),os(e,"ReduceL2",r,(t,s)=>[`var t = ${s.type.value}(0); var value = ${s.type.value}(0);`,"",`t = ${t.getByIndices("input_indices")}; value += (t * t);`,"value = sqrt(value);"])},yh=(e,r)=>{is(e.inputs),os(e,"ReduceLogSumExp",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += exp(${t.getByIndices("input_indices")});`,"value = log(value);"])},Mh=(e,r)=>{is(e.inputs),os(e,"ReduceMax",r,(t,s,i)=>{let n=[];for(let o=0;o=0||i.length===0)&&n.push(t.indicesSet("input_indices",o,0));return[`${n.join(` -`)}`,`var value = ${t.getByIndices("input_indices")};`,`value = max(value, ${t.getByIndices("input_indices")});`,""]})},bh=(e,r)=>{is(e.inputs),os(e,"ReduceMean",r,(t,s,i)=>{let n=1;for(let o=0;o=0||i.length===0)&&(n*=e.inputs[0].dims[o]);return["var sum = f32(0);","",`sum += f32(${t.getByIndices("input_indices")});`,`let value = ${s.type.value}(sum / ${n});`]})},vh=(e,r)=>{is(e.inputs),os(e,"ReduceMin",r,(t,s,i)=>{let n=[];for(let o=0;o=0||i.length===0)&&n.push(`input_indices[${o}] = 0;`);return[`${n.join(` -`)}`,`var value = ${t.getByIndices("input_indices")};`,`value = min(value, ${t.getByIndices("input_indices")});`,""]})},Th=(e,r)=>{is(e.inputs),os(e,"ReduceProd",r,(t,s)=>[`var value = ${s.type.storage}(1);`,"",`value *= ${t.getByIndices("input_indices")};`,""])},xh=(e,r)=>{is(e.inputs),os(e,"ReduceSum",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += ${t.getByIndices("input_indices")};`,""])},Eh=(e,r)=>{is(e.inputs),os(e,"ReduceSumSquare",r,(t,s)=>[`var t = ${s.type.value}(0); var value = ${s.type.value}(0);`,"",`t = ${t.getByIndices("input_indices")}; value += t * t;`,""])},as=(e,r,t)=>{if(r.length===0)return t;let s=1,i=1;for(let n=0;n1024},Ph=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?bh(e,r):ih(e,r)},Ch=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?gh(e,r):oh(e,r)},Sh=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?wh(e,r):ah(e,r)},$h=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?yh(e,r):lh(e,r)},kh=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?Mh(e,r):dh(e,r)},Ih=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?vh(e,r):ch(e,r)},Ah=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?Th(e,r):uh(e,r)},Fh=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?xh(e,r):ph(e,r)},Oh=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?Eh(e,r):hh(e,r)},Dh=(e,r)=>{as(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?_h(e,r):mh(e,r)}}),Hd,Lh,zh,qd,hv=Ve(()=>{pt(),Yt(),Kd(),Hd=e=>{if(!e||e.length===0||e.length>2)throw new Error("ArgMinMaxOp op requires 1 or 2 inputs.");if(e[0].dataType!==1)throw new Error("Invalid input type.")},Lh=(e,r)=>{Hd(e.inputs);let t=(s,i,n)=>{let o=[];for(let a=0;a=0||n.length===0)&&o.push(`input_indices[${a}] = 0;`);return[`${o.join(` -`)}`,`var value = ${s.getByIndices("input_indices")}; -var best_index : i32 = 0;`,`if (${s.getByIndices("input_indices")} ${r.selectLastIndex>0?"<=":"<"} value) { - value = ${s.getByIndices("input_indices")}; - best_index = i32(last_index); - }`,"",i.setByOffset("global_idx","best_index")]};e.compute(Ea("ArgMin",{hint:r.cacheKey,inputDependencies:["rank"]},[e.inputs[0]],t,[r.axis],7,r.keepDims),{inputs:[0]})},zh=(e,r)=>{Hd(e.inputs);let t=(s,i,n)=>{let o=[];for(let a=0;a=0||n.length===0)&&o.push(`input_indices[${a}] = 0;`);return[`${o.join(` -`)}`,`var value = ${s.getByIndices("input_indices")}; -var best_index : i32 = 0;`,`if (${s.getByIndices("input_indices")} ${r.selectLastIndex>0?">=":">"} value) { - value = ${s.getByIndices("input_indices")}; - best_index = i32(last_index); - }`,"",i.setByOffset("global_idx","best_index")]};e.compute(Ea("argMax",{hint:r.cacheKey,inputDependencies:["rank"]},[e.inputs[0]],t,[r.axis],7,r.keepDims),{inputs:[0]})},qd=e=>Dt(e)}),Bh,Pa,Rh,Nh,jh,Oi,Vh,Uh,Qd=Ve(()=>{pt(),Mt(),Bd(),Tt(),Bh=(e,r)=>{let t=e[0],s=e[1],i=e[2],n=e[3],o=e[4],a=e[5];if(o&&a)throw new Error("Attention cannot have both past and attention_bias");if(t.dims.length!==3)throw new Error('Input "input" must have 3 dimensions');let l=t.dims[0],c=t.dims[1],p=t.dims[2];if(i.dims.length!==1)throw new Error('Input "bias" is expected to have 1 dimensions');if(s.dims.length!==2)throw new Error('Input "weights" is expected to have 2 dimensions');if(s.dims[0]!==p)throw new Error("Input 1 dimension 0 should have same length as dimension 2 of input 0");if(i.dims[0]!==s.dims[1])throw new Error('Input "bias" dimension 0 should have same length as dimension 1 of input "weights"');let u=i.dims[0]/3,h=u,g=h;if(r.qkvHiddenSizes.length>0){if(r.qkvHiddenSizes.length!==3)throw new Error("qkv_hidden_sizes attribute should have 3 elements");for(let k of r.qkvHiddenSizes)if(k%r.numHeads!==0)throw new Error("qkv_hidden_sizes should be divisible by num_heads");u=r.qkvHiddenSizes[0],h=r.qkvHiddenSizes[1],g=r.qkvHiddenSizes[2]}let _=c;if(u!==h)throw new Error("qkv_hidden_sizes first element should be same as the second");if(i.dims[0]!==u+h+g)throw new Error('Input "bias" dimension 0 should have same length as sum of Q/K/V hidden sizes');let P=0;if(o){if(h!==g)throw new Error('Input "past" expect k_hidden_size == v_hidden_size');if(o.dims.length!==5)throw new Error('Input "past" must have 5 dimensions');if(o.dims[0]!==2)throw new Error('Input "past" first dimension must be 2');if(o.dims[1]!==l)throw new Error('Input "past" second dimension must be batch_size');if(o.dims[2]!==r.numHeads)throw new Error('Input "past" third dimension must be num_heads');if(o.dims[4]!==h/r.numHeads)throw new Error('Input "past" fifth dimension must be k_hidden_size / num_heads');r.pastPresentShareBuffer||(P=o.dims[3])}let A=_+P,v=-1,y=0;if(n)throw new Error("Mask not supported");if(o)throw new Error("past is not supported");if(a){if(a.dims.length!==4)throw new Error('Input "attention_bias" must have 4 dimensions');if(a.dims[0]!==l||a.dims[1]!==r.numHeads||a.dims[2]!==c||a.dims[3]!==A)throw new Error('Expect "attention_bias" shape (batch_size, num_heads, sequence_length, total_sequence_length)')}return{batchSize:l,sequenceLength:c,pastSequenceLength:P,kvSequenceLength:_,totalSequenceLength:A,maxSequenceLength:v,inputHiddenSize:p,hiddenSize:u,vHiddenSize:g,headSize:Math.floor(u/r.numHeads),vHeadSize:Math.floor(g/r.numHeads),numHeads:r.numHeads,isUnidirectional:!1,pastPresentShareBuffer:!1,maskFilterValue:r.maskFilterValue,maskType:y,scale:r.scale,broadcastResPosBias:!1,passPastInKv:!1,qkvFormat:1}},Pa=(e,r,t)=>r&&e?` - let total_sequence_length_input = u32(${r.getByOffset("0")}); - let present_sequence_length = max(total_sequence_length_input, uniforms.past_sequence_length); - let is_subsequent_prompt: bool = sequence_length > 1 && sequence_length != total_sequence_length_input; - let is_first_prompt: bool = is_subsequent_prompt == false && sequence_length == total_sequence_length_input; - total_sequence_length = u32(${e==null?void 0:e.getByOffset("batchIdx")}) + 1; - var past_sequence_length: u32 = 0; - if (is_first_prompt == false) { - past_sequence_length = total_sequence_length - sequence_length; - } - `:` - ${t?"let past_sequence_length = uniforms.past_sequence_length":""}; - let present_sequence_length = total_sequence_length; - `,Rh=(e,r,t,s,i,n,o,a)=>{let l=Xt(o?1:n),c=64,p=n/l;p{let y=tt("x",e.dataType,e.dims,l),k=[y],E=o?$e("seq_lens",o.dataType,o.dims):void 0;E&&k.push(E);let M=a?$e("total_sequence_length_input",a.dataType,a.dims):void 0;M&&k.push(M);let w=xr(e.dataType),x=[{name:"batch_size",type:"u32"},{name:"num_heads",type:"u32"},{name:"past_sequence_length",type:"u32"},{name:"sequence_length",type:"u32"},{name:"total_sequence_length",type:"u32"},{name:"elements_per_thread",type:"u32"}];return` - var thread_max: array; - var thread_sum: array; - ${v.registerUniforms(x).declareVariables(...k)} - ${v.mainStart([c,1,1])} - let batchIdx = workgroup_id.z / uniforms.num_heads; - let headIdx = workgroup_id.z % uniforms.num_heads; - let sequence_length = uniforms.sequence_length; - var total_sequence_length = uniforms.total_sequence_length; - ${Pa(E,M,!1)} - let local_offset = local_idx * uniforms.elements_per_thread; - let offset = (global_idx / ${c}) * uniforms.total_sequence_length + local_offset; - let seq_causal_length = ${o?"u32(past_sequence_length + workgroup_id.y + 1)":"total_sequence_length"}; - var thread_max_vector = ${_}(-3.402823e+38f); - for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { - thread_max_vector = max(${_}(x[offset + i]), thread_max_vector); - } - thread_max[local_idx] = ${(()=>{switch(l){case 1:return"thread_max_vector";case 2:return"max(thread_max_vector.x, thread_max_vector.y)";case 4:return"max(max(thread_max_vector.x, thread_max_vector.y), max(thread_max_vector.z, thread_max_vector.w))";default:throw new Error(`Unsupported components: ${l}`)}})()}; - workgroupBarrier(); - - var max_value = f32(-3.402823e+38f); - for (var i = 0u; i < ${c}; i++) { - max_value = max(thread_max[i], max_value); - } - - var sum_vector = ${_}(0); - for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { - sum_vector += exp(${_}(x[offset + i]) - max_value); - } - thread_sum[local_idx] = ${(()=>{switch(l){case 1:return"sum_vector";case 2:return"sum_vector.x + sum_vector.y";case 4:return"sum_vector.x + sum_vector.y + sum_vector.z + sum_vector.w";default:throw new Error(`Unsupported components: ${l}`)}})()}; - workgroupBarrier(); - - var sum: f32 = 0; - for (var i = 0u; i < ${c}; i++) { - sum += thread_sum[i]; - } - - if (sum == 0) { - for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { - x[offset + i] = ${y.type.value}(${w}(1.0) / ${w}(seq_causal_length)); - } - } else { - for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { - var f32input = ${_}(x[offset + i]); - x[offset + i] = ${y.type.value}(exp(f32input - max_value) / sum); - } - } - ${o?` - for (var total_seq_id: u32 = seq_causal_length; total_seq_id + local_offset < uniforms.total_sequence_length; total_seq_id++) { - x[offset + total_seq_id] = ${y.type.value}(${w}(0)); - }`:""}; - }`};return{name:"AttentionProbsSoftmax",shaderCache:{hint:`${c};${g};${l}`,inputDependencies:P},getShaderSource:A,getRunData:()=>({outputs:[],dispatchGroup:{x:1,y:i,z:r*t},programUniforms:h})}},Nh=(e,r,t,s,i,n,o,a,l)=>{let c=o+n.kvSequenceLength,p=[n.batchSize,n.numHeads,n.sequenceLength,c],u=e>1&&s,h=n.kvNumHeads?n.kvNumHeads:n.numHeads,g=u?[n.batchSize,h,c,n.headSize]:void 0,_=n.nReps?n.nReps:1,P=n.scale===0?1/Math.sqrt(n.headSize):n.scale,A=Xt(n.headSize),v=n.headSize/A,y=12,k={x:Math.ceil(c/y),y:Math.ceil(n.sequenceLength/y),z:n.batchSize*n.numHeads},E=[{type:12,data:n.sequenceLength},{type:12,data:v},{type:12,data:c},{type:12,data:n.numHeads},{type:12,data:n.headSize},{type:1,data:P},{type:12,data:o},{type:12,data:n.kvSequenceLength},{type:12,data:_}],M=u&&s&&Te.size(s.dims)>0,w=["type","type"];M&&w.push("type"),i&&w.push("type"),a&&w.push("type"),l&&w.push("type");let x=[{dims:p,dataType:r.dataType,gpuDataType:0}];u&&x.push({dims:g,dataType:r.dataType,gpuDataType:0});let $=z=>{let R=$e("q",r.dataType,r.dims,A),Q=$e("key",t.dataType,t.dims,A),q=[R,Q];if(M){let ce=$e("past_key",s.dataType,s.dims,A);q.push(ce)}i&&q.push($e("attention_bias",i.dataType,i.dims));let U=a?$e("seq_lens",a.dataType,a.dims):void 0;U&&q.push(U);let Z=l?$e("total_sequence_length_input",l.dataType,l.dims):void 0;Z&&q.push(Z);let H=tt("output",r.dataType,p),J=[H];u&&J.push(tt("present_key",r.dataType,g,A));let ie=xr(1,A),ae=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"alpha",type:"f32"},{name:"past_sequence_length",type:"u32"},{name:"kv_sequence_length",type:"u32"},{name:"n_reps",type:"u32"}];return` - const TILE_SIZE = ${y}u; - - var tileQ: array<${R.type.storage}, ${y*y}>; - var tileK: array<${R.type.storage}, ${y*y}>; - ${z.registerUniforms(ae).declareVariables(...q,...J)} - ${z.mainStart([y,y,1])} - // x holds the N and y holds the M - let headIdx = workgroup_id.z % uniforms.num_heads; - let kvHeadIdx = ${_===1?"headIdx":"headIdx / uniforms.n_reps"}; - let kv_num_heads = ${_===1?"uniforms.num_heads":"uniforms.num_heads / uniforms.n_reps"}; - let batchIdx = workgroup_id.z / uniforms.num_heads; - let m = workgroup_id.y * TILE_SIZE; - let n = workgroup_id.x * TILE_SIZE; - let sequence_length = uniforms.M; - var total_sequence_length = uniforms.N; - ${Pa(U,Z,!0)} - let absKvHeadIdx = batchIdx * kv_num_heads + kvHeadIdx; - let qOffset = workgroup_id.z * uniforms.M * uniforms.K + m * uniforms.K; - ${M&&u?"let pastKeyOffset = absKvHeadIdx * uniforms.past_sequence_length * uniforms.K;":""}; - let kOffset = absKvHeadIdx * uniforms.kv_sequence_length * uniforms.K; - ${u?"let presentKeyOffset = absKvHeadIdx * uniforms.N * uniforms.K;":""} - var value = ${ie}(0); - for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { - if (global_id.y < uniforms.M && w + local_id.x < uniforms.K) { - tileQ[TILE_SIZE * local_id.y + local_id.x] = q[qOffset + local_id.y * uniforms.K + w + local_id.x]; - } - if (n + local_id.y < uniforms.N && w + local_id.x < uniforms.K) { - var idx = TILE_SIZE * local_id.y + local_id.x; - ${M&&u?` - if (n + local_id.y < past_sequence_length) { - tileK[idx] = past_key[pastKeyOffset + (n + local_id.y) * uniforms.K + w + local_id.x]; - } else if (n + local_id.y - past_sequence_length < uniforms.kv_sequence_length) { - tileK[idx] = key[kOffset + (n + local_id.y - past_sequence_length) * uniforms.K + w + local_id.x]; - }`:` - if (n + local_id.y < uniforms.kv_sequence_length) { - tileK[idx] = key[kOffset + (n + local_id.y) * uniforms.K + w + local_id.x]; - }`} - ${u?`if (n + local_id.y < present_sequence_length) { - present_key[presentKeyOffset + (n + local_id.y) * uniforms.K + w + local_id.x] = tileK[idx]; - }`:""} - } - workgroupBarrier(); - - for (var k: u32 = 0u; k < TILE_SIZE && w+k < uniforms.K; k++) { - value += ${ie}(tileQ[TILE_SIZE * local_id.y + k] * tileK[TILE_SIZE * local_id.x + k]); - } - - workgroupBarrier(); - } - - if (global_id.y < uniforms.M && global_id.x < total_sequence_length) { - let headOffset = workgroup_id.z * uniforms.M * uniforms.N; - let outputIdx = headOffset + global_id.y * uniforms.N + global_id.x; - var sum: f32 = ${(()=>{switch(A){case 1:return"value";case 2:return"value.x + value.y";case 4:return"value.x + value.y + value.z + value.w";default:throw new Error(`Unsupported components: ${A}`)}})()}; - output[outputIdx] = ${H.type.value} (sum * uniforms.alpha) + ${i?"attention_bias[outputIdx]":"0.0"}; - } - }`};return{name:"AttentionProbs",shaderCache:{hint:`${A};${i!==void 0};${s!==void 0};${e}`,inputDependencies:w},getRunData:()=>({outputs:x,dispatchGroup:k,programUniforms:E}),getShaderSource:$}},jh=(e,r,t,s,i,n,o=void 0,a=void 0)=>{let l=n+i.kvSequenceLength,c=i.nReps?i.nReps:1,p=i.vHiddenSize*c,u=e>1&&s,h=i.kvNumHeads?i.kvNumHeads:i.numHeads,g=u?[i.batchSize,h,l,i.headSize]:void 0,_=[i.batchSize,i.sequenceLength,p],P=12,A={x:Math.ceil(i.vHeadSize/P),y:Math.ceil(i.sequenceLength/P),z:i.batchSize*i.numHeads},v=[{type:12,data:i.sequenceLength},{type:12,data:l},{type:12,data:i.vHeadSize},{type:12,data:i.numHeads},{type:12,data:i.headSize},{type:12,data:p},{type:12,data:n},{type:12,data:i.kvSequenceLength},{type:12,data:c}],y=u&&s&&Te.size(s.dims)>0,k=["type","type"];y&&k.push("type"),o&&k.push("type"),a&&k.push("type");let E=[{dims:_,dataType:r.dataType,gpuDataType:0}];u&&E.push({dims:g,dataType:r.dataType,gpuDataType:0});let M=w=>{let x=$e("probs",r.dataType,r.dims),$=$e("v",t.dataType,t.dims),z=[x,$];y&&z.push($e("past_value",s.dataType,s.dims));let R=o?$e("seq_lens",o.dataType,o.dims):void 0;o&&z.push(R);let Q=a?$e("total_sequence_length_input",a.dataType,a.dims):void 0;a&&z.push(Q);let q=[tt("output",r.dataType,_)];u&&q.push(tt("present_value",r.dataType,g));let U=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"v_hidden_size",type:"u32"},{name:"past_sequence_length",type:"u32"},{name:"kv_sequence_length",type:"u32"},{name:"n_reps",type:"u32"}];return` - const TILE_SIZE = ${P}u; - var tileQ: array<${x.type.value}, ${P*P}>; - var tileV: array<${x.type.value}, ${P*P}>; - ${w.registerUniforms(U).declareVariables(...z,...q)} - ${w.mainStart([P,P,1])} - let headIdx = workgroup_id.z % uniforms.num_heads; - let batchIdx = workgroup_id.z / uniforms.num_heads; - let kvHeadIdx = ${c===1?"headIdx":"headIdx / uniforms.n_reps"}; - let kv_num_heads = ${c===1?"uniforms.num_heads":"uniforms.num_heads / uniforms.n_reps"}; - let m = global_id.y; - let n = global_id.x; - let sequence_length = uniforms.M; - var total_sequence_length = uniforms.K; - ${Pa(R,Q,!0)} - let offsetA = workgroup_id.z * uniforms.M * uniforms.K + m * uniforms.K; - let absKvHeadIdx = batchIdx * kv_num_heads + kvHeadIdx; // kvHeadIdx is relative to the batch - ${y&&u?"let pastValueOffset = absKvHeadIdx * uniforms.N * uniforms.past_sequence_length + n;":""}; - let vOffset = absKvHeadIdx * uniforms.N * uniforms.kv_sequence_length + n; - ${u?"let presentValueOffset = absKvHeadIdx * uniforms.N * uniforms.K + n;":""} - var value = ${x.type.storage}(0); - for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { - if (m < uniforms.M && w + local_id.x < uniforms.K) { - tileQ[TILE_SIZE * local_id.y + local_id.x] = probs[offsetA + w + local_id.x]; - } - if (n < uniforms.N && w + local_id.y < uniforms.K) { - var idx = TILE_SIZE * local_id.y + local_id.x; - ${y&&u?` - if (w + local_id.y < past_sequence_length) { - tileV[idx] = past_value[pastValueOffset + (w + local_id.y) * uniforms.N]; - } else if (w + local_id.y - past_sequence_length < uniforms.kv_sequence_length) { - tileV[idx] = v[vOffset + (w + local_id.y - past_sequence_length) * uniforms.N]; - } - `:` - if (w + local_id.y < uniforms.kv_sequence_length) { - tileV[idx] = v[vOffset + (w + local_id.y) * uniforms.N]; - }`} - ${u?` - if (w + local_id.y < present_sequence_length) { - present_value[presentValueOffset + (w + local_id.y) * uniforms.N] = tileV[idx]; - }`:""} - } - workgroupBarrier(); - for (var k: u32 = 0u; k < TILE_SIZE && w+k < total_sequence_length; k++) { - value += tileQ[TILE_SIZE * local_id.y + k] * tileV[TILE_SIZE * k + local_id.x]; - } - workgroupBarrier(); - } - - // we need to transpose output from BNSH_v to BSND_v - if (m < uniforms.M && n < uniforms.N) { - let outputIdx = batchIdx * uniforms.M * uniforms.v_hidden_size + m * uniforms.v_hidden_size - + headIdx * uniforms.N + n; - output[outputIdx] = value; - } - }`};return{name:"AttentionScore",shaderCache:{hint:`${s!==void 0};${e}`,inputDependencies:k},getRunData:()=>({outputs:E,dispatchGroup:A,programUniforms:v}),getShaderSource:M}},Oi=(e,r,t,s,i,n,o,a,l,c,p=void 0,u=void 0)=>{let h=Math.min(e.outputCount,1+(o?1:0)+(a?1:0)),g=h>1?c.pastSequenceLength:0,_=g+c.kvSequenceLength,P=l&&Te.size(l.dims)>0?l:void 0,A=[r,t];h>1&&o&&Te.size(o.dims)>0&&A.push(o),P&&A.push(P),p&&A.push(p),u&&A.push(u);let v=e.compute(Nh(h,r,t,o,P,c,g,p,u),{inputs:A,outputs:h>1?[-1,1]:[-1]})[0];e.compute(Rh(v,c.batchSize,c.numHeads,g,c.sequenceLength,_,p,u),{inputs:p&&u?[v,p,u]:[v],outputs:[]});let y=[v,s];h>1&&a&&Te.size(a.dims)>0&&y.push(a),p&&y.push(p),u&&y.push(u),e.compute(jh(h,v,s,a,c,g,p,u),{inputs:y,outputs:h>1?[0,2]:[0]})},Vh=(e,r)=>{let t=[r.batchSize,r.numHeads,r.sequenceLength,r.headSize],s=r.sequenceLength,i=r.inputHiddenSize,n=r.headSize,o=12,a={x:Math.ceil(r.headSize/o),y:Math.ceil(r.sequenceLength/o),z:r.batchSize*r.numHeads},l=[e.inputs[0],e.inputs[1],e.inputs[2]],c=[{type:12,data:s},{type:12,data:i},{type:12,data:n},{type:12,data:r.numHeads},{type:12,data:r.headSize},{type:12,data:r.hiddenSize},{type:12,data:r.hiddenSize+r.hiddenSize+r.vHiddenSize}],p=u=>{let h=tt("output_q",l[0].dataType,t),g=tt("output_k",l[0].dataType,t),_=tt("output_v",l[0].dataType,t),P=$e("input",l[0].dataType,l[0].dims),A=$e("weight",l[1].dataType,l[1].dims),v=$e("bias",l[2].dataType,l[2].dims),y=P.type.storage,k=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"hidden_size",type:"u32"},{name:"ldb",type:"u32"}];return` - const TILE_SIZE = ${o}u; - var tileInput: array<${y}, ${o*o}>; - var tileWeightQ: array<${y}, ${o*o}>; - var tileWeightK: array<${y}, ${o*o}>; - var tileWeightV: array<${y}, ${o*o}>; - ${u.registerUniforms(k).declareVariables(P,A,v,h,g,_)} - ${u.mainStart([o,o,1])} - let batchIndex = workgroup_id.z / uniforms.num_heads; - let headNumber = workgroup_id.z % uniforms.num_heads; - let m = global_id.y; - let n = global_id.x; - - let inputOffset = batchIndex * (uniforms.M * uniforms.K) + m * uniforms.K; - let biasOffsetQ = headNumber * uniforms.head_size; - let biasOffsetK = uniforms.hidden_size + biasOffsetQ; - let biasOffsetV = uniforms.hidden_size + biasOffsetK; - - var valueQ = ${y}(0); - var valueK = ${y}(0); - var valueV = ${y}(0); - for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { - if (m < uniforms.M && w + local_id.x < uniforms.K) { - tileInput[TILE_SIZE * local_id.y + local_id.x] = input[inputOffset + w + local_id.x]; - } - if (n < uniforms.N && w + local_id.y < uniforms.K) { - let offset = n + (w + local_id.y) * uniforms.ldb; - tileWeightQ[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetQ + offset]; - tileWeightK[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetK + offset]; - tileWeightV[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetV + offset]; - } - workgroupBarrier(); - for (var k: u32 = 0u; k({outputs:[{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0},{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0},{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0}],dispatchGroup:a,programUniforms:c}),getShaderSource:p},{inputs:l,outputs:[-1,-1,-1]})},Uh=(e,r)=>{let t=Bh(e.inputs,r),[s,i,n]=Vh(e,t);return Oi(e,s,i,n,e.inputs[4],void 0,void 0,void 0,e.inputs[5],t)}}),Wh,Gh,Kh,Hh,mv=Ve(()=>{ss(),pt(),Mt(),Yt(),Tt(),Wh=(e,r)=>{if(!e||e.length!==5)throw new Error("BatchNormalization requires 5 inputs");let t=(s,i,n)=>{let o=i.length;if(o!==s.length)throw new Error(`${n}: num dimensions != ${o}`);i.forEach((a,l)=>{if(a!==s[l])throw new Error(`${n}: dim[${l}] do not match`)})};if(e[0].dims.length>1){let s=r.format==="NHWC"?r.spatial?e[0].dims.slice(-1):e[0].dims.slice(-1).concat(e[0].dims.slice(1,e[0].dims.length-1)):e[0].dims.slice(1,r.spatial?2:void 0);t(e[1].dims,s,"Invalid input scale"),t(e[2].dims,s,"Invalid input B"),t(e[3].dims,s,"Invalid input mean"),t(e[4].dims,s,"Invalid input var")}else t(e[1].dims,[1],"Invalid input scale"),t(e[2].dims,[1],"Invalid input B"),t(e[3].dims,[1],"Invalid input mean"),t(e[4].dims,[1],"Invalid input var")},Gh=(e,r)=>{let{epsilon:t,spatial:s,format:i}=r,n=e[0].dims,o=s?Xt(n[n.length-1]):1,a=i==="NHWC"&&n.length>1?o:1,l=Te.size(n)/o,c=s,p=c?n.length:n,u=$e("x",e[0].dataType,e[0].dims,o),h=$e("scale",e[1].dataType,e[1].dims,a),g=$e("bias",e[2].dataType,e[2].dims,a),_=$e("inputMean",e[3].dataType,e[3].dims,a),P=$e("inputVar",e[4].dataType,e[4].dims,a),A=tt("y",e[0].dataType,p,o),v=()=>{let k="";if(s)k=`let cOffset = ${n.length===1?"0u":i==="NHWC"?`outputIndices[${n.length-1}] / ${o}`:"outputIndices[1]"};`;else if(i==="NCHW")k=` - ${A.indicesSet("outputIndices","0","0")} - let cOffset = ${A.indicesToOffset("outputIndices")};`;else{k=`var cIndices = ${h.type.indices}(0); - cIndices[0] = outputIndices[${n.length-1}];`;for(let E=1;E` - const epsilon = ${t}; - ${k.registerUniform("outputSize","u32").declareVariables(u,h,g,_,P,A)} - ${k.mainStart()} - ${k.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - var outputIndices = ${A.offsetToIndices(`global_idx * ${o}`)}; - ${v()} - let scale = ${h.getByOffset("cOffset")}; - let bias = ${g.getByOffset("cOffset")}; - let inputMean = ${_.getByOffset("cOffset")}; - let inputVar = ${P.getByOffset("cOffset")}; - let x = ${u.getByOffset("global_idx")}; - let value = (x - inputMean) * inverseSqrt(inputVar + epsilon) * scale + bias; - ${A.setByOffset("global_idx","value")} - }`;return{name:"BatchNormalization",shaderCache:{hint:`${r.epsilon}_${r.format}_${s}_${o}`,inputDependencies:c?["rank","type","type","type","type"]:void 0},getShaderSource:y,getRunData:()=>({outputs:[{dims:e[0].dims,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:c?[{type:12,data:l},...nt(n)]:[{type:12,data:l}]})}},Kh=e=>Dt(e),Hh=(e,r)=>{let{inputs:t,outputCount:s}=e,i=Kh({...r,outputCount:s});if(Ut.webgpu.validateInputContent&&Wh(t,i),r.trainingMode)throw new Error("BatchNormalization trainingMode is not supported yet.");e.compute(Gh(t,i))}}),qh,Qh,Xh,fv=Ve(()=>{Mt(),Tt(),qh=e=>{if(e[0].dims.length!==3)throw new Error("input should have 3 dimensions");if(![320,640,1280].includes(e[0].dims[2]))throw new Error("number of channels should be 320, 640 or 1280");if(e[1].dims.length!==1)throw new Error("bias is expected to have 1 dimensions");if(e[0].dims[2]!==e[1].dims[0])throw new Error("last dimension of input and bias are not the same")},Qh=e=>{let r=e[0].dims,t=e[0].dims[2],s=Te.size(r)/4,i=e[0].dataType,n=$e("input",i,r,4),o=$e("bias",i,[t],4),a=$e("residual",i,r,4),l=tt("output",i,r,4);return{name:"BiasAdd",getRunData:()=>({outputs:[{dims:r,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(s/64)}}),getShaderSource:c=>` - const channels = ${t}u / 4; - ${c.declareVariables(n,o,a,l)} - - ${c.mainStart()} - ${c.guardAgainstOutOfBoundsWorkgroupSizes(s)} - let value = ${n.getByOffset("global_idx")} - + ${o.getByOffset("global_idx % channels")} + ${a.getByOffset("global_idx")}; - ${l.setByOffset("global_idx","value")} - }`}},Xh=e=>{qh(e.inputs),e.compute(Qh(e.inputs))}}),Jh,$t,Yh,Zh,em,tm,rm,sm,nm,im,om,am,lm,dm,cm,um,Di,pm,Ca,hm,mm,fm,_m,gm,wm,ym,Mm,bm,vm,Tm,xm,Em,Pm,Cm,Sm,Xd,$m,Jd,Yd,km,Im,Am,Fm,Om,Dm,Zd=Ve(()=>{pt(),Mt(),Yt(),Tt(),Jh=(e,r,t,s,i,n,o)=>{let a=Math.ceil(r/4),l="";typeof i=="string"?l=`${i}(a)`:l=i("a");let c=$e("inputData",t,[a],4),p=tt("outputData",s,[a],4),u=[{name:"vec_size",type:"u32"}];return o&&u.push(...o),` - ${e.registerUniforms(u).declareVariables(c,p)} - - ${n??""} - - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} - - let a = ${c.getByOffset("global_idx")}; - ${p.setByOffset("global_idx",l)} - }`},$t=(e,r,t,s,i,n=e.dataType,o,a)=>{let l=[{type:12,data:Math.ceil(Te.size(e.dims)/4)}];return o&&l.push(...o),{name:r,shaderCache:{hint:i,inputDependencies:["type"]},getShaderSource:c=>Jh(c,Te.size(e.dims),e.dataType,n,t,s,a),getRunData:c=>({outputs:[{dims:e.dims,dataType:n}],dispatchGroup:{x:Math.ceil(Te.size(c[0].dims)/64/4)},programUniforms:l})}},Yh=e=>{e.compute($t(e.inputs[0],"Abs","abs"))},Zh=e=>{e.compute($t(e.inputs[0],"Acos","acos"))},em=e=>{e.compute($t(e.inputs[0],"Acosh","acosh"))},tm=e=>{e.compute($t(e.inputs[0],"Asin","asin"))},rm=e=>{e.compute($t(e.inputs[0],"Asinh","asinh"))},sm=e=>{e.compute($t(e.inputs[0],"Atan","atan"))},nm=e=>{e.compute($t(e.inputs[0],"Atanh","atanh"))},im=e=>Dt(e),om=(e,r)=>{let t;switch(r.to){case 10:t="vec4";break;case 1:t="vec4";break;case 12:t="vec4";break;case 6:t="vec4";break;case 9:t="vec4";break;default:throw new RangeError(`not supported type (specified in attribute 'to' from 'Cast' operator): ${r.to}`)}e.compute($t(e.inputs[0],"Cast",t,void 0,r.cacheKey,r.to))},am=e=>{let r,t,s=e.length>=2&&e[1].data!==0,i=e.length>=3&&e[2].data!==0;switch(e[0].dataType){case 1:r=s?e[1].getFloat32Array()[0]:-34028234663852886e22,t=i?e[2].getFloat32Array()[0]:34028234663852886e22;break;case 10:r=s?e[1].getUint16Array()[0]:64511,t=i?e[2].getUint16Array()[0]:31743;break;default:throw new Error("Unsupport data type")}return Dt({min:r,max:t})},lm=(e,r)=>{let t=r||am(e.inputs),s=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"Clip",i=>`clamp(${i}, vec4<${s}>(uniforms.min), vec4<${s}>(uniforms.max))`,void 0,t.cacheKey,void 0,[{type:e.inputs[0].dataType,data:t.min},{type:e.inputs[0].dataType,data:t.max}],[{name:"min",type:s},{name:"max",type:s}]),{inputs:[0]})},dm=e=>{e.compute($t(e.inputs[0],"Ceil","ceil"))},cm=e=>{e.compute($t(e.inputs[0],"Cos","cos"))},um=e=>{e.compute($t(e.inputs[0],"Cosh","cosh"))},Di=e=>Dt(e),pm=(e,r)=>{let t=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"Elu",s=>`elu_vf32(${s})`,` - const elu_alpha_ = ${t}(${r.alpha}); - - fn elu_f32(a: ${t}) -> ${t} { - return select((exp(a) - 1.0) * elu_alpha_, a, a >= 0.0); - } - - fn elu_vf32(v: vec4<${t}>) -> vec4<${t}> { - return vec4(elu_f32(v.x), elu_f32(v.y), elu_f32(v.z), elu_f32(v.w)); - }`,r.cacheKey))},Ca=(e="f32")=>` -const r0: ${e} = 0.3275911; -const r1: ${e} = 0.254829592; -const r2: ${e} = -0.284496736; -const r3: ${e} = 1.421413741; -const r4: ${e} = -1.453152027; -const r5: ${e} = 1.061405429; - -fn erf_vf32(v: vec4<${e}>) -> vec4<${e}> { - let absv = abs(v); - let x = 1.0 / (1.0 + r0 * absv); - return sign(v) * (1.0 - ((((r5 * x + r4) * x + r3) * x + r2) * x + r1) * x * exp(-absv * absv)); -}`,hm=e=>{let r=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"Erf",t=>`erf_vf32(${t})`,Ca(r)))},mm=e=>{e.compute($t(e.inputs[0],"Exp","exp"))},fm=e=>{e.compute($t(e.inputs[0],"Floor","floor"))},_m=e=>{let r=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"Gelu",t=>`0.5 * ${t} * (1.0 + erf_vf32(${t} * 0.7071067811865475))`,Ca(r)))},gm=(e,r)=>{let t=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"LeakyRelu",s=>`select(leaky_relu_alpha_ * ${s}, ${s}, ${s} >= vec4<${t}>(0.0))`,`const leaky_relu_alpha_ = ${t}(${r.alpha});`,r.cacheKey))},wm=e=>{e.compute($t(e.inputs[0],"Not",r=>`!${r}`))},ym=e=>{e.compute($t(e.inputs[0],"Neg",r=>`-${r}`))},Mm=e=>{e.compute($t(e.inputs[0],"Reciprocal",r=>`1.0/${r}`))},bm=e=>{let r=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"Relu",t=>`select(vec4<${r}>(0.0), ${t}, ${t} > vec4<${r}>(0.0))`))},vm=e=>{e.compute($t(e.inputs[0],"Sigmoid",r=>`(1.0 / (1.0 + exp(-${r})))`))},Tm=e=>Dt(e),xm=(e,r)=>{let t=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"HardSigmoid",s=>`max(vec4<${t}>(0.0), min(vec4<${t}>(1.0), ${r.alpha} * ${s} + vec4<${t}>(${r.beta})))`,void 0,r.cacheKey))},Em=e=>{e.compute($t(e.inputs[0],"Sin","sin"))},Pm=e=>{e.compute($t(e.inputs[0],"Sinh","sinh"))},Cm=e=>{e.compute($t(e.inputs[0],"Sqrt","sqrt"))},Sm=e=>{e.compute($t(e.inputs[0],"Tan","tan"))},Xd=e=>`sign(${e}) * (1 - exp(-2 * abs(${e}))) / (1 + exp(-2 * abs(${e})))`,$m=e=>{e.compute($t(e.inputs[0],"Tanh",Xd))},Jd=(e="f32")=>` -const fast_gelu_a: ${e} = 0.5; -const fast_gelu_b: ${e} = 0.7978845608028654; -const fast_gelu_c: ${e} = 0.035677408136300125; - -fn tanh_v(v: vec4<${e}>) -> vec4<${e}> { - return ${Xd("v")}; -} -`,Yd=e=>`(fast_gelu_a + fast_gelu_a * tanh_v(${e} * (fast_gelu_c * ${e} * ${e} + fast_gelu_b))) * ${e}`,km=e=>{let r=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"FastGelu",Yd,Jd(r),void 0,e.inputs[0].dataType))},Im=(e,r)=>{let t=xr(e.inputs[0].dataType);return e.compute($t(e.inputs[0],"ThresholdedRelu",s=>`select(vec4<${t}>(0.0), ${s}, ${s} > thresholded_relu_alpha_)`,`const thresholded_relu_alpha_ = vec4<${t}>(${r.alpha});`,r.cacheKey)),0},Am=e=>{e.compute($t(e.inputs[0],"Log","log"))},Fm=(e,r)=>` -const alpha = vec4<${e}>(${r}); -const one = ${e}(1.0); -const zero = ${e}(0.0); - -fn quick_gelu_impl(x: vec4<${e}>) -> vec4<${e}> { - let v = x *alpha; - var x1 : vec4<${e}>; - for (var i = 0; i < 4; i = i + 1) { - if (v[i] >= zero) { - x1[i] = one / (one + exp(-v[i])); - } else { - x1[i] = one - one / (one + exp(v[i])); - } - } - return x * x1; -} -`,Om=e=>`quick_gelu_impl(${e})`,Dm=(e,r)=>{let t=xr(e.inputs[0].dataType);e.compute($t(e.inputs[0],"QuickGelu",Om,Fm(t,r.alpha),r.cacheKey,e.inputs[0].dataType))}}),Lm,zm,Bm,_v=Ve(()=>{Mt(),Tt(),Zd(),Lm=e=>{if(e[0].dims.length!==3)throw new Error("input should have 3 dimensions");if(![2560,5120,10240].includes(e[0].dims[2]))throw new Error("hidden state should be 2560, 5120 or 10240");if(e[1].dims.length!==1)throw new Error("bias is expected to have 1 dimensions");if(e[0].dims[2]!==e[1].dims[0])throw new Error("last dimension of input and bias are not the same")},zm=e=>{let r=e[0].dims.slice();r[2]=r[2]/2;let t=$e("input",e[0].dataType,e[0].dims,4),s=$e("bias",e[0].dataType,[e[0].dims[2]],4),i=tt("output",e[0].dataType,r,4),n=Te.size(r)/4,o=lr(e[0].dataType);return{name:"BiasSplitGelu",getRunData:()=>({outputs:[{dims:r,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(n/64)}}),getShaderSource:a=>` - const M_SQRT2 = sqrt(2.0); - const halfChannels = ${e[0].dims[2]/4/2}u; - - ${a.declareVariables(t,s,i)} - - ${Ca(o)} - - ${a.mainStart()} - ${a.guardAgainstOutOfBoundsWorkgroupSizes(n)} - let biasIdx = global_idx % halfChannels; - let batchIndex = global_idx / halfChannels; - let inputOffset = biasIdx + batchIndex * halfChannels * 2; - let valueLeft = input[inputOffset] + bias[biasIdx]; - let valueRight = input[inputOffset + halfChannels] + bias[biasIdx + halfChannels]; - let geluRight = valueRight * 0.5 * (erf_vf32(valueRight / M_SQRT2) + 1); - - ${i.setByOffset("global_idx","valueLeft * geluRight")} - }`}},Bm=e=>{Lm(e.inputs),e.compute(zm(e.inputs))}}),Rm,Nm,ls,jm,Vm,Um,Wm,Gm,Km,Hm,qm,Qm,Xm,gv=Ve(()=>{pt(),Mt(),Tt(),Rm=(e,r,t,s,i,n,o,a,l,c,p,u)=>{let h,g;typeof a=="string"?h=g=(y,k)=>`${a}((${y}),(${k}))`:typeof a=="function"?h=g=a:(h=a.scalar,g=a.vector);let _=tt("outputData",p,s.length,4),P=$e("aData",l,r.length,4),A=$e("bData",c,t.length,4),v;if(i)if(n){let y=Te.size(r)===1,k=Te.size(t)===1,E=r.length>0&&r[r.length-1]%4===0,M=t.length>0&&t[t.length-1]%4===0;y||k?v=_.setByOffset("global_idx",g(y?`${P.type.value}(${P.getByOffset("0")}.x)`:P.getByOffset("global_idx"),k?`${A.type.value}(${A.getByOffset("0")}.x)`:A.getByOffset("global_idx"))):v=` - let outputIndices = ${_.offsetToIndices("global_idx * 4u")}; - let offsetA = ${P.broadcastedIndicesToOffset("outputIndices",_)}; - let offsetB = ${A.broadcastedIndicesToOffset("outputIndices",_)}; - ${_.setByOffset("global_idx",g(o||E?P.getByOffset("offsetA / 4u"):`${P.type.value}(${P.getByOffset("offsetA / 4u")}[offsetA % 4u])`,o||M?A.getByOffset("offsetB / 4u"):`${A.type.value}(${A.getByOffset("offsetB / 4u")}[offsetB % 4u])`))} - `}else v=_.setByOffset("global_idx",g(P.getByOffset("global_idx"),A.getByOffset("global_idx")));else{if(!n)throw new Error("no necessary to use scalar implementation for element-wise binary op implementation.");let y=(k,E,M="")=>{let w=`aData[indexA${E}][componentA${E}]`,x=`bData[indexB${E}][componentB${E}]`;return` - let outputIndices${E} = ${_.offsetToIndices(`global_idx * 4u + ${E}u`)}; - let offsetA${E} = ${P.broadcastedIndicesToOffset(`outputIndices${E}`,_)}; - let offsetB${E} = ${A.broadcastedIndicesToOffset(`outputIndices${E}`,_)}; - let indexA${E} = offsetA${E} / 4u; - let indexB${E} = offsetB${E} / 4u; - let componentA${E} = offsetA${E} % 4u; - let componentB${E} = offsetB${E} % 4u; - ${k}[${E}] = ${M}(${h(w,x)}); - `};p===9?v=` - var data = vec4(0); - ${y("data",0,"u32")} - ${y("data",1,"u32")} - ${y("data",2,"u32")} - ${y("data",3,"u32")} - outputData[global_idx] = dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(data));`:v=` - ${y("outputData[global_idx]",0)} - ${y("outputData[global_idx]",1)} - ${y("outputData[global_idx]",2)} - ${y("outputData[global_idx]",3)} - `}return` - ${e.registerUniform("vec_size","u32").declareVariables(P,A,_)} - - ${u??""} - - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} - ${v} - }`},Nm=(e,r,t,s,i,n,o=t.dataType)=>{let a=t.dims.map(P=>Number(P)??1),l=s.dims.map(P=>Number(P)??1),c=!Te.areEqual(a,l),p=a,u=Te.size(a),h=!1,g=!1,_=[c];if(c){let P=Nn.calcShape(a,l,!1);if(!P)throw new Error("Can't perform binary op on the given tensors");p=P.slice(),u=Te.size(p);let A=Te.size(a)===1,v=Te.size(l)===1,y=a.length>0&&a[a.length-1]%4===0,k=l.length>0&&l[l.length-1]%4===0;_.push(A),_.push(v),_.push(y),_.push(k);let E=1;for(let M=1;MP.toString()).join("_"),inputDependencies:["rank","rank"]},getShaderSource:P=>Rm(P,a,l,p,h,c,g,i,t.dataType,s.dataType,o,n),getRunData:()=>({outputs:[{dims:p,dataType:o}],dispatchGroup:{x:Math.ceil(u/64/4)},programUniforms:[{type:12,data:Math.ceil(Te.size(p)/4)},...nt(a,l,p)]})}},ls=(e,r,t,s,i,n)=>{e.compute(Nm(r,i??"",e.inputs[0],e.inputs[1],t,s,n))},jm=e=>{ls(e,"Add",(r,t)=>`${r}+${t}`)},Vm=e=>{ls(e,"Div",(r,t)=>`${r}/${t}`)},Um=e=>{ls(e,"Equal",{scalar:(r,t)=>`u32(${r}==${t})`,vector:(r,t)=>`vec4(${r}==${t})`},void 0,void 0,9)},Wm=e=>{ls(e,"Mul",(r,t)=>`${r}*${t}`)},Gm=e=>{let r=$e("input",e.inputs[0].dataType,e.inputs[0].dims).type.value;ls(e,"Pow",{scalar:(t,s)=>`pow_custom(${t},${s})`,vector:(t,s)=>`pow_vector_custom(${t},${s})`},` - fn pow_custom(a : ${r}, b : ${r}) -> ${r} { - if (b == ${r}(0.0)) { - return ${r}(1.0); - } else if (a < ${r}(0.0) && f32(b) != floor(f32(b))) { - return ${r}(pow(f32(a), f32(b))); // NaN - } - return select(sign(a), ${r}(1.0), round(f32(abs(b) % ${r}(2.0))) != 1.0) * ${r}(${r==="i32"?"round":""}(pow(f32(abs(a)), f32(b)))); - } - fn pow_vector_custom(a : vec4<${r}>, b : vec4<${r}>) -> vec4<${r}> { - // TODO: implement vectorized pow - return vec4<${r}>(pow_custom(a.x, b.x), pow_custom(a.y, b.y), pow_custom(a.z, b.z), pow_custom(a.w, b.w)); - } - `)},Km=e=>{ls(e,"Sub",(r,t)=>`${r}-${t}`)},Hm=e=>{ls(e,"Greater",{scalar:(r,t)=>`u32(${r}>${t})`,vector:(r,t)=>`vec4(${r}>${t})`},void 0,void 0,9)},qm=e=>{ls(e,"Less",{scalar:(r,t)=>`u32(${r}<${t})`,vector:(r,t)=>`vec4(${r}<${t})`},void 0,void 0,9)},Qm=e=>{ls(e,"GreaterOrEqual",{scalar:(r,t)=>`u32(${r}>=${t})`,vector:(r,t)=>`vec4(${r}>=${t})`},void 0,void 0,9)},Xm=e=>{ls(e,"LessOrEqual",{scalar:(r,t)=>`u32(${r}<=${t})`,vector:(r,t)=>`vec4(${r}<=${t})`},void 0,void 0,9)}}),Jm,Ym,Zm,ef,tf,rf,wv=Ve(()=>{pt(),Mt(),Yt(),Tt(),Jm=(e,r)=>{if(!e||e.length<1)throw new Error("too few inputs");let t=0,s=e[t],i=s.dataType,n=s.dims.length;e.forEach((o,a)=>{if(a!==t){if(o.dataType!==i)throw new Error("input tensors should be one type");if(o.dims.length!==n)throw new Error("input tensors should have the same shape");o.dims.forEach((l,c)=>{if(c!==r&&l!==s.dims[c])throw new Error("non concat dimensions must match")})}})},Ym=(e,r)=>` - fn calculateInputIndex(index: u32) -> u32 { - let sizeInConcatAxis = array(${r}); - for (var i: u32 = 0u; i < ${e}; i += 1u ) { - if (index < sizeInConcatAxis[i]) { - return i; - } - } - return ${e}u; - }`,Zm=(e,r)=>{let t=e.length,s=[];for(let i=0;i{let i=Te.size(t),n=new Array(e.length),o=new Array(e.length),a=0,l=[],c=[],p=[{type:12,data:i}];for(let P=0;P`uniforms.sizeInConcatAxis${P}`).join(","),_=P=>` - - ${(()=>{P.registerUniform("outputSize","u32");for(let A=0;A(${g}); - ${h} -= sizeInConcatAxis[inputIndex - 1u]; - } - - ${Zm(o,u)} - }`;return{name:"Concat",shaderCache:{hint:`${r}`,inputDependencies:l},getRunData:()=>({outputs:[{dims:t,dataType:s}],dispatchGroup:{x:Math.ceil(i/64)},programUniforms:p}),getShaderSource:_}},tf=(e,r)=>{let t=e.inputs,s=t[0].dims,i=Te.normalizeAxis(r.axis,s.length);Jm(t,i);let n=s.slice();n[i]=t.reduce((a,l)=>a+(l.dims.length>i?l.dims[i]:0),0);let o=t.filter(a=>Te.size(a.dims)>0);e.compute(ef(o,i,n,t[0].dataType),{inputs:o})},rf=e=>Dt({axis:e.axis})}),_n,gn,wn,ec,yn=Ve(()=>{pt(),Mt(),_n=(e,r,t="f32")=>{switch(e.activation){case"Relu":return`value = max(value, ${r}(0.0));`;case"Sigmoid":return`value = (${r}(1.0) / (${r}(1.0) + exp(-value)));`;case"Clip":return`value = clamp(value, ${r}(${t}(uniforms.clip_min)), ${r}(${t}(uniforms.clip_max)));`;case"HardSigmoid":return`value = max(${r}(0.0), min(${r}(1.0), ${t}(uniforms.alpha) * value + ${t}(uniforms.beta)));`;case"LeakyRelu":return`value = select(${t}(uniforms.alpha) * value, value, value >= ${r}(0.0));`;case"Tanh":return`let e2x = exp(-2.0 * abs(value)); - value = sign(value) * (1.0 - e2x) / (1.0 + e2x); - `;case"":return"";default:throw new Error(`Unsupported activation ${e.activation}`)}},gn=(e,r)=>{e.activation==="Clip"?r.push({type:1,data:e.clipMax},{type:1,data:e.clipMin}):e.activation==="HardSigmoid"?r.push({type:1,data:e.alpha},{type:1,data:e.beta}):e.activation==="LeakyRelu"&&r.push({type:1,data:e.alpha})},wn=(e,r)=>{e.activation==="Clip"?r.push({name:"clip_max",type:"f32"},{name:"clip_min",type:"f32"}):e.activation==="HardSigmoid"?r.push({name:"alpha",type:"f32"},{name:"beta",type:"f32"}):e.activation==="LeakyRelu"&&r.push({name:"alpha",type:"f32"})},ec=e=>{let r=(e==null?void 0:e.activation)||"";if(r==="HardSigmoid"){let[t,s]=(e==null?void 0:e.activation_params)||[.2,.5];return{activation:r,alpha:t,beta:s}}else if(r==="Clip"){let[t,s]=(e==null?void 0:e.activation_params)||[zp,Bp];return{activation:r,clipMax:s,clipMin:t}}else if(r==="LeakyRelu"){let[t]=(e==null?void 0:e.activation_params)||[.01];return{activation:r,alpha:t}}return{activation:r}}}),hr,sf,tc=Ve(()=>{hr=(e,r)=>{switch(e){case 1:return r;case 2:return`vec2<${r}>`;case 3:return`vec3<${r}>`;case 4:return`vec4<${r}>`;default:throw new Error(`${e}-component is not supported.`)}},sf=e=>` - ${e?"value = value + getBiasByOutputCoords(coords);":""} - `}),nf,yv=Ve(()=>{nf=e=>` -fn getIndexFromCoords4D(coords : vec4, shape : vec4) -> i32 { - return dot(coords, vec4( - shape.y * shape.z * shape.w, shape.z * shape.w, shape.w, 1)); -} -fn getOutputIndexFromCoords(coords : vec4) -> i32 { - return dot(coords, vec4( - i32(${e}.x), i32(${e}.y), i32(${e}.z), 1)); -} -`}),Li,rc,sc=Ve(()=>{pt(),Mt(),Tt(),yn(),Li=(e,r,t,s,i)=>{let n=s-t;return` - ${Array.from({length:t}).map((o,a)=>` - if (${rt(r.shape,a,r.rank)} != 1) { - ${r.indicesSet(e,a,rt(i,a+n,s))} - } else { - ${r.indicesSet(e,a,0)} - }`).join("")} -`},rc=(e,r,t,s,i=!1,n)=>{let o=e[0].dims,a=e[1].dims,l=o[o.length-2],c=a[a.length-1],p=o[o.length-1],u=Xt(c),h=Xt(p),g=Xt(l),_=Te.size(t)/u/g,P=e.length>2,A=s?s.slice(0,-2):t.slice(0,-2),v=[Te.size(A),l,c],y=[{type:12,data:_},{type:12,data:l},{type:12,data:c},{type:12,data:p}];gn(r,y),y.push(...nt(A,o,a)),P&&y.push(...nt(e[2].dims)),y.push(...nt(v));let k=E=>{let M=Ud("batch_dims",e[0].dataType,A.length),w=$e("a",e[0].dataType,o.length,h),x=$e("b",e[1].dataType,a.length,u),$=tt("output",e[0].dataType,v.length,u),z=lr($.type.tensor),R=_n(r,$.type.value,z),Q=[w,x],q="";if(P){let H=i?u:1;Q.push($e("bias",e[2].dataType,e[2].dims.length,H)),q=`${i?`value += bias[col / ${H}];`:`value += ${$.type.value}(bias[row + i]);`}`}let U=[{name:"output_size",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"}];wn(r,U);let Z=()=>{let H=`var a_data: ${w.type.value};`;for(let J=0;J; - for (var k: u32 = 0u; k < uniforms.K; k = k + ${h}) { - ${Z()} - } - for (var i = 0u; i < ${g}u; i++) { - var value = values[i]; - ${q} - ${R} - let cur_indices = ${$.type.indices}(batch, row + i, col); - let offset = ${$.indicesToOffset("cur_indices")}; - ${$.setByOffset(`offset / ${u}`,"value")}; - } - } - `};return{name:"MatMulNaive",shaderCache:{hint:`${r.activation};${u};${h};${g};${i}`,inputDependencies:P?["rank","rank","rank"]:["rank","rank"]},getRunData:()=>({outputs:[{dims:n?n(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:y}),getShaderSource:k}}}),of,af,nc,ic,lf,oc,df,Sa,ac=Ve(()=>{pt(),Mt(),Tt(),yn(),sc(),tc(),of=(e,r)=>e?` - mm_Asub[inputRow][inputCol] = mm_readA(batch, - kStart + inputRow, - globalRowStart / innerElementSize + inputCol${r?", batchIndices":""}); - `:` - mm_Asub[inputRow][inputCol] = mm_readA(batch, - globalRow + innerRow, - kStart / innerElementSize + inputCol${r?", batchIndices":""}); - `,af=(e,r)=>e?` - let ACached0 = mm_Asub[k * innerElementSize][localRow]; - let ACached1 = mm_Asub[k * innerElementSize + 1][localRow]; - let ACached2 = mm_Asub[k * innerElementSize + 2][localRow]; - ${r===3?"":"let ACached3 = mm_Asub[k * innerElementSize + 3][localRow];"} - for (var i = 0; i < rowPerThread; i = i + 1) { - acc[i] = BCached0 * ACached0[i] + acc[i]; - acc[i] = BCached1 * ACached1[i] + acc[i]; - acc[i] = BCached2 * ACached2[i] + acc[i]; - ${r===3?"":"acc[i] = BCached3 * ACached3[i] + acc[i];"} - }`:` - for (var i = 0; i < rowPerThread; i = i + 1) { - let ACached = mm_Asub[tileRow + i][k]; - acc[i] = BCached0 * ACached.x + acc[i]; - acc[i] = BCached1 * ACached.y + acc[i]; - acc[i] = BCached2 * ACached.z + acc[i]; - ${r===3?"":"acc[i] = BCached3 * ACached.w + acc[i];"} - }`,nc=(e,r,t="f32",s,i=!1,n=32,o=!1,a=32)=>{let l=r[1]*e[1],c=r[0]*e[0],p=i?l:n,u=i?n:l,h=p/r[0],g=n/r[1];if(!((i&&h===4&&e[1]===4||!i&&(h===3||h===4))&&p%r[0]===0&&n%r[1]===0&&e[0]===4))throw new Error(`If transposeA ${i} is true, innerElementSize ${h} and workPerThread[1] ${e[1]} must be 4. - Otherwise, innerElementSize ${h} must be 3 or 4. - tileAWidth ${p} must be divisible by workgroupSize[0]${r[0]}. tileInner ${n} must be divisible by workgroupSize[1] ${r[1]}. colPerThread ${e[0]} must be 4.`);return` -var mm_Asub: array, ${p/h}>, ${u}>; -var mm_Bsub: array, ${c/e[0]}>, ${n}>; - -const rowPerThread = ${e[1]}; -const colPerThread = ${e[0]}; -const innerElementSize = ${h}; -const tileInner = ${n}; - -@compute @workgroup_size(${r[0]}, ${r[1]}, ${r[2]}) -fn main(@builtin(local_invocation_id) localId : vec3, - @builtin(global_invocation_id) globalId : vec3, - @builtin(workgroup_id) workgroupId : vec3) { - let localRow = i32(localId.y); - let tileRow = localRow * rowPerThread; - let tileCol = i32(localId.x); - - let globalRow =i32(globalId.y) * rowPerThread; - let globalCol = i32(globalId.x); - let batch = ${o?"0":"i32(globalId.z)"}; - ${s?`let batchIndices = ${s.offsetToIndices("u32(batch)")};`:""} - let globalRowStart = i32(workgroupId.y) * ${l}; - - let num_tiles = ${o?`${Math.ceil(a/n)}`:"(uniforms.dim_inner - 1) / tileInner + 1"}; - var kStart = ${o?`i32(globalId.z) * ${a}`:"0"}; - - var acc: array, rowPerThread>; - - // Loop over shared dimension. - let tileRowB = localRow * ${g}; - for (var t = 0; t < num_tiles; t = t + 1) { - // Load one tile of A into local memory. - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - let inputRow = tileRow + innerRow; - let inputCol = tileCol; - ${of(i,s)} - } - - // Load one tile of B into local memory. - for (var innerRow = 0; innerRow < ${g}; innerRow = innerRow + 1) { - let inputRow = tileRowB + innerRow; - let inputCol = tileCol; - mm_Bsub[inputRow][inputCol] = mm_readB(batch, kStart + inputRow, globalCol${s?", batchIndices":""}); - } - kStart = kStart + tileInner; - workgroupBarrier(); - - // Compute acc values for a single thread. - for (var k = 0; k < tileInner / innerElementSize; k = k + 1) { - let BCached0 = mm_Bsub[k * innerElementSize][tileCol]; - let BCached1 = mm_Bsub[k * innerElementSize + 1][tileCol]; - let BCached2 = mm_Bsub[k * innerElementSize + 2][tileCol]; - ${h===3?"":"let BCached3 = mm_Bsub[k * innerElementSize + 3][tileCol];"} - - ${af(i,h)} - } - - workgroupBarrier(); - } - - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - mm_write(batch, globalRow + innerRow, globalCol, acc[innerRow]); - } -}`},ic=(e,r)=>e?` - mm_Asub[inputRow][inputCol] = mm_readA(batch, - kStart + inputRow, - globalRowStart + inputCol${r?", batchIndices":""}); - `:` - mm_Asub[inputRow][inputCol] = mm_readA(batch, - globalRowStart + inputRow, - kStart + inputCol${r?", batchIndices":""}); - `,lf=e=>e?"let ACached = mm_Asub[k][tileRow + innerRow];":"let ACached = mm_Asub[tileRow + innerRow][k];",oc=(e,r,t="f32",s,i=!1,n=32,o=!1,a=32,l=!1)=>{let c=e[1]*r[1],p=e[0]*r[0],u=i?c:n,h=i?n:c;if(!(h%r[1]===0&&u%r[0]===0&&n%r[1]===0))throw new Error(`tileAHight ${h} must be divisible by workgroupSize[1]${r[1]}, tileAWidth ${u} must be divisible by workgroupSize[0]${r[0]}, tileInner ${n} must be divisible by workgroupSize[1]${r[1]}`);let g=h/r[1],_=u/r[0],P=n/r[1],A=l?` - let localRow = i32(localId.y); - let localCol = i32(localId.x); - let globalRowStart = i32(workgroupId.y) * ${c}; - let globalColStart = i32(workgroupId.x) * ${p}; - - // Loop over shared dimension. - for (var t = 0; t < num_tiles; t = t + 1) { - // Load one tile of A into local memory. - for (var inputRow = localRow; inputRow < ${h}; inputRow = inputRow + ${r[1]}) { - for (var inputCol = localCol; inputCol < ${u}; inputCol = inputCol + ${r[0]}) { - ${ic(i,s)} - } - } - // Load one tile of B into local memory. - for (var inputRow = localRow; inputRow < ${n}; inputRow = inputRow + ${r[1]}) { - for (var inputCol = localCol; inputCol < ${p}; inputCol = inputCol + ${r[0]}) { - mm_Bsub[inputRow][inputCol] = mm_readB(batch, - kStart + inputRow, - globalColStart + inputCol${s?", batchIndices":""}); - } - } - kStart = kStart + tileInner; - workgroupBarrier(); - - // Compute acc values for a single thread. - var BCached : array<${t}, colPerThread>; - for (var k = 0; k < tileInner; k = k + 1) { - for (var inner = 0; inner < colPerThread; inner = inner + 1) { - BCached[inner] = mm_Bsub[k][localCol + inner * ${r[0]}]; - } - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - let ACached = ${i?`mm_Asub[k][localRow + innerRow * ${r[1]}];`:`mm_Asub[localRow + innerRow * ${r[1]}][k];`} - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - acc[innerRow][innerCol] = acc[innerRow][innerCol] + - ACached * BCached[innerCol]; - } - } - } - workgroupBarrier(); - } - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - let gRow = globalRowStart + localRow + innerRow * ${r[1]}; - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - let gCol = globalColStart + localCol + innerCol * ${r[0]}; - mm_write(batch, gRow, gCol, acc[innerRow][innerCol]); - } - } - `:` -let tileRow = i32(localId.y) * rowPerThread; -let tileCol = i32(localId.x) * colPerThread; - -let globalRow = i32(globalId.y) * rowPerThread; -let globalCol = i32(globalId.x) * colPerThread; -let globalRowStart = i32(workgroupId.y) * ${c}; - -let tileRowA = i32(localId.y) * ${g}; -let tileColA = i32(localId.x) * ${_}; -let tileRowB = i32(localId.y) * ${P}; -// Loop over shared dimension. -for (var t = 0; t < num_tiles; t = t + 1) { - // Load one tile of A into local memory. - for (var innerRow = 0; innerRow < ${g}; innerRow = innerRow + 1) { - for (var innerCol = 0; innerCol < ${_}; innerCol = innerCol + 1) { - let inputRow = tileRowA + innerRow; - let inputCol = tileColA + innerCol; - ${ic(i,s)} - } - } - - // Load one tile of B into local memory. - for (var innerRow = 0; innerRow < ${P}; innerRow = innerRow + 1) { - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - let inputRow = tileRowB + innerRow; - let inputCol = tileCol + innerCol; - mm_Bsub[inputRow][inputCol] = mm_readB(batch, - kStart + inputRow, - globalCol + innerCol${s?", batchIndices":""}); - } - } - kStart = kStart + tileInner; - workgroupBarrier(); - - // Compute acc values for a single thread. - var BCached : array<${t}, colPerThread>; - for (var k = 0; k < tileInner; k = k + 1) { - for (var inner = 0; inner < colPerThread; inner = inner + 1) { - BCached[inner] = mm_Bsub[k][tileCol + inner]; - } - - for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - ${lf(i)} - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - acc[innerRow][innerCol] = acc[innerRow][innerCol] + ACached * BCached[innerCol]; - } - } - } - - workgroupBarrier(); -} - -for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { - for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { - mm_write(batch, globalRow + innerRow, globalCol + innerCol, - acc[innerRow][innerCol]); - } -} -`;return` - var mm_Asub : array, ${h}>; - var mm_Bsub : array, ${n}>; - const rowPerThread = ${e[1]}; - const colPerThread = ${e[0]}; - const tileInner = ${n}; - -@compute @workgroup_size(${r[0]}, ${r[1]}, ${r[2]}) -fn main(@builtin(local_invocation_id) localId : vec3, - @builtin(global_invocation_id) globalId : vec3, - @builtin(workgroup_id) workgroupId : vec3) { - let batch = ${o?"0":"i32(globalId.z)"}; - ${s?`let batchIndices = ${s.offsetToIndices("u32(batch)")};`:""} - let num_tiles = ${o?`${Math.ceil(a/n)}`:"(uniforms.dim_inner - 1) / tileInner + 1"}; - var kStart = ${o?`i32(globalId.z) * ${a}`:"0"}; - - var acc : array, rowPerThread>; - ${A} - } -`},df=(e,r,t,s,i=!1)=>{let[n,o,a,l]=s,c=lr(s[0].type.tensor);return` - fn mm_readA(batch: i32, row: i32, colIn: i32, batchIndices: ${n.type.indices}) -> ${hr(e,c)} { - var value = ${hr(e,c)}(0.0); - let col = colIn * ${e}; - if(row < uniforms.dim_a_outer && col < uniforms.dim_inner) - { - var aIndices: ${o.type.indices}; - ${Li("aIndices",o,o.rank-2,n.rank,"batchIndices")} - ${o.indicesSet("aIndices",o.rank-2,"u32(row)")} - ${o.indicesSet("aIndices",o.rank-1,"u32(colIn)")} - value = ${o.getByIndices("aIndices")}; - } - return value; - } - - fn mm_readB(batch: i32, row: i32, colIn: i32, batchIndices: ${n.type.indices}) -> ${hr(e,c)} { - var value = ${hr(e,c)}(0.0); - let col = colIn * ${e}; - if(row < uniforms.dim_inner && col < uniforms.dim_b_outer) - { - var bIndices: ${a.type.indices}; - ${Li("bIndices",a,a.rank-2,n.rank,"batchIndices")} - ${a.indicesSet("bIndices",a.rank-2,"u32(row)")} - ${a.indicesSet("bIndices",a.rank-1,"u32(colIn)")} - value = ${a.getByIndices("bIndices")}; - } - return value; - } - - fn mm_write(batch: i32, row: i32, colIn: i32, valueIn: ${hr(e,c)}) { - let col = colIn * ${e}; - if (row < uniforms.dim_a_outer && col < uniforms.dim_b_outer) { - var value = valueIn; - let coords = vec3(batch, row, colIn); - ${r?`value = value + ${i?"bias[colIn]":`${hr(e,c)}(bias[row])`};`:""} - ${t} - ${l.setByIndices("vec3(coords)","value")} - } - } - `},Sa=(e,r,t,s,i=!1,n)=>{let o=e[0].dims,a=e[1].dims,l=o.slice(0,-2),c=a.slice(0,-2),p=s?s.slice(0,-2):t.slice(0,-2),u=Te.size(p),h=o[o.length-2],g=o[o.length-1],_=a[a.length-1],P=g%4===0&&_%4===0,A=h<=8?[4,1,1]:[4,4,1],v=[8,8,1],y=[Math.ceil(_/v[0]/A[0]),Math.ceil(h/v[1]/A[1]),Math.ceil(u/v[2]/A[2])],k=P?4:1,E=[...l,h,g/k],M=E.length,w=[...c,g,_/k],x=w.length,$=[u,h,_/k],z=[{type:6,data:h},{type:6,data:_},{type:6,data:g}];gn(r,z),z.push(...nt(p,E,w));let R=["rank","rank"],Q=e.length>2;Q&&(z.push(...nt(e[2].dims)),R.push("rank")),z.push(...nt($));let q=U=>{let Z=p.length,H=Ud("batchDims",e[0].dataType,Z,1),J=lr(e[0].dataType),ie=$e("a",e[0].dataType,M,k),ae=$e("b",e[1].dataType,x,k),ce=tt("result",e[0].dataType,$.length,k),he=[ie,ae];if(Q){let X=i?k:1;he.push($e("bias",e[2].dataType,e[2].dims.length,X))}let N=[{name:"dim_a_outer",type:"i32"},{name:"dim_b_outer",type:"i32"},{name:"dim_inner",type:"i32"}];wn(r,N);let O=lr(ce.type.tensor),G=_n(r,ce.type.value,O),se=df(k,Q,G,[H,ie,ae,ce],i);return` - ${U.registerUniforms(N).registerInternalVariables(H).declareVariables(...he,ce)} - ${se} - ${P?nc(A,v,J,H):oc(A,v,J,H)} - `};return{name:"MatMul",shaderCache:{hint:`${A};${r.activation};${P};${i}`,inputDependencies:R},getRunData:()=>({outputs:[{dims:n?n(t):t,dataType:e[0].dataType}],dispatchGroup:{x:y[0],y:y[1],z:y[2]},programUniforms:z}),getShaderSource:q}}}),cf,uf,Mv=Ve(()=>{pt(),Is(),Tt(),yn(),tc(),yv(),ac(),cf=(e,r,t,s,i=!1,n,o=4,a=4,l=4,c="f32")=>{let p=z=>{switch(z){case 1:return"resData = x[xIndex];";case 3:return`resData = vec3<${c}>(x[xIndex], x[xIndex + 1], x[xIndex + 2]);`;case 4:return"resData = x[xIndex / 4];";default:throw new Error(`innerElementSize ${z} is not supported.`)}},u=z=>{switch(z){case 1:return"return w[row * i32(uniforms.w_shape[3]) + colIn];";case 4:return"return w[row * i32(uniforms.w_shape[3]) / 4 + colIn];";default:throw new Error(`innerElementSize ${z} is not supported.`)}},h=e?` - let coord = vec4(batch, xRow, xCol, xCh); - `:` - let coord = vec4(batch, xCh, xRow, xCol); - `,g=e?` - let coords = vec4( - batch, - row / outWidth, - row % outWidth, - col); - `:` - let coords = vec4( - batch, - row, - col / outWidth, - col % outWidth); - `,_=e?"i32(uniforms.x_shape[1])":"i32(uniforms.x_shape[2])",P=e?"i32(uniforms.x_shape[2])":"i32(uniforms.x_shape[3])",A=e?"row":"col",v=e?"col":"row",y=` - let inChannels = i32(uniforms.w_shape[2]); - let outWidth = ${e?"i32(uniforms.result_shape[2])":"i32(uniforms.result_shape[3])"}; - let outRow = ${A} / outWidth; - let outCol = ${A} % outWidth; - - let WRow = ${v} / (i32(uniforms.w_shape[1]) * inChannels); - let WCol = ${v} / inChannels % i32(uniforms.w_shape[1]); - let xRow = outRow * uniforms.stride[0] + uniforms.dilation[0] * WRow - uniforms.pad[0]; - let xCol = outCol * uniforms.stride[1] + uniforms.dilation[1] * WCol - uniforms.pad[1]; - let xCh = ${v} % inChannels; - var resData = ${hr(o,c)}(0.0); - // The bounds checking is always needed since we use it to pad zero for - // the 'same' padding type. - if (xRow >= 0 && xRow < ${_} && xCol >= 0 && xCol < ${P}) { - ${h} - let xIndex = getIndexFromCoords4D(coord, vec4(uniforms.x_shape)); - ${p(o)} - } - return resData;`,k=e?r&&s?` - let col = colIn * ${o}; - ${y}`:` - let col = colIn * ${o}; - if (row < uniforms.dim_a_outer && col < uniforms.dim_inner) { - ${y} - } - return ${hr(o,c)}(0.0);`:s&&t?` - let col = colIn * ${o}; - ${y}`:` - let col = colIn * ${o}; - if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) { - ${y} - } - return ${hr(o,c)}(0.0);`,E=e?s&&t?u(a):` - let col = colIn * ${a}; - if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) { - ${u(a)} - } - return ${hr(a,c)}(0.0);`:` - let col = colIn * ${a}; - if (row < uniforms.dim_inner && col < uniforms.dim_a_outer) { - ${u(a)} - } - return ${hr(a,c)}(0.0);`,M=hr(l,c),w=hr(e?o:a,c),x=hr(e?a:o,c),$=_n(n,M,c);return` - fn mm_readA(batch: i32, row : i32, colIn : i32) -> ${w} { - ${e?k:E} - } - - fn mm_readB(batch: i32, row : i32, colIn : i32) -> ${x} { - ${e?E:k} - } - - fn mm_write(batch: i32, row : i32, colIn : i32, valueIn : ${M}) { - let col = colIn * ${l}; - if (row < uniforms.dim_a_outer && col < uniforms.dim_b_outer) - { - var value = valueIn; - let outWidth = ${e?"i32(uniforms.result_shape[2])":"i32(uniforms.result_shape[3])"}; - ${g} - ${sf(i)} - ${$} - setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value); - } - }`},uf=(e,r,t,s,i,n,o,a,l)=>{let c=r.format==="NHWC",p=c?e[0].dims[3]:e[0].dims[1],u=t[0],h=c?t[2]:t[3],g=c?t[1]:t[2],_=c?t[3]:t[1],P=c&&(p%4===0||p%3===0)&&_%4===0,A=c?_:h*g,v=c?h*g:_,y=[8,8,1],k=s<=8?[4,1,1]:[4,4,1],E=[Math.ceil(A/y[0]/k[0]),Math.ceil(v/y[1]/k[1]),Math.ceil(u/y[2]/k[2])];St("verbose",()=>`[conv2d_mm_webgpu] dispatch = ${E}`);let M=P?c&&p%4!==0?3:4:1,w=y[1]*k[1],x=y[0]*k[0],$=Math.max(y[0]*M,y[1]),z=s%w===0,R=i%x===0,Q=n%$===0,q=P?[M,4,4]:[1,1,1],U=[{type:6,data:s},{type:6,data:i},{type:6,data:n},{type:6,data:[r.pads[0],r.pads[1]]},{type:6,data:r.strides},{type:6,data:r.dilations}];gn(r,U),U.push(...nt(e[0].dims,e[1].dims));let Z=["rank","rank"];o&&(U.push(...nt(e[2].dims)),Z.push("rank")),U.push(...nt(t));let H=J=>{let ie=[{name:"dim_a_outer",type:"i32"},{name:"dim_b_outer",type:"i32"},{name:"dim_inner",type:"i32"},{name:"pad",type:"i32",length:2},{name:"stride",type:"i32",length:2},{name:"dilation",type:"i32",length:2}];wn(r,ie);let ae=P?4:1,ce=lr(e[0].dataType),he=` - fn setOutputAtIndex(flatIndex : i32, value : ${P?`vec4<${ce}>`:ce}) { - result[flatIndex] = ${P?`vec4<${ce}>`:ce}(value); - } - fn setOutputAtCoords(d0 : i32, d1 : i32, d2 : i32, d3 : i32, value : ${P?`vec4<${ce}>`:ce}) { - let flatIndex = getOutputIndexFromCoords(vec4(d0, d1, d2, d3)); - setOutputAtIndex(flatIndex ${P?"/ 4":""}, value); - }`,N=$e("x",e[0].dataType,e[0].dims.length,M===3?1:M),O=$e("w",e[1].dataType,e[1].dims.length,ae),G=[N,O],se=tt("result",e[0].dataType,t.length,ae);if(o){let X=$e("bias",e[2].dataType,e[2].dims.length,ae);G.push(X),he+=` - fn getBiasByOutputCoords(coords : vec4) -> ${P?`vec4<${ce}>`:ce} { - return bias[coords.${c?"w":"y"}${P?"/ 4":""}]; - }`}return` - ${nf("uniforms.result_strides")} - //struct Uniforms { xShape : vec4, wShape : vec4, outShape : vec4, - // outShapeStrides: vec3, filterDims : vec2, pad : vec2, stride : vec2, - // dilation : vec2, dimAOuter : i32, dimBOuter : i32, dimInner : i32 }; - ${J.registerUniforms(ie).declareVariables(...G,se)} - ${he} - ${cf(c,z,R,Q,o,r,q[0],q[1],q[2],ce)} - ${P?nc(k,y,ce,void 0,!c,$):oc(k,y,ce,void 0,!c,$,!1,void 0,a)}`};return{name:"Conv2DMatMul",shaderCache:{hint:`${r.cacheKey};${M};${P};${z};${R};${Q};${w};${x};${$}`,inputDependencies:Z},getRunData:()=>({outputs:[{dims:l?l(t):t,dataType:e[0].dataType}],dispatchGroup:{x:E[0],y:E[1],z:E[2]},programUniforms:U}),getShaderSource:H}}}),pf,lc,zi,hf,dc,mf,ff,_f,bv=Ve(()=>{pt(),Is(),Mt(),Tt(),yn(),tc(),pf=e=>{let r=1;for(let t=0;ttypeof e=="number"?[e,e,e]:e,zi=(e,r)=>r<=1?e:e+(e-1)*(r-1),hf=(e,r,t,s=1)=>{let i=zi(r,s);return Math.floor((e[0]*(t-1)-t+i)/2)},dc=(e,r,t,s,i)=>{i==null&&(i=hf(e,r[0],s[0]));let n=[0,0,0,t];for(let o=0;o<3;o++)e[o]+2*i>=r[o]&&(n[o]=Math.trunc((e[o]-r[o]+2*i)/s[o]+1));return n},mf=(e,r,t,s,i,n,o,a,l,c)=>{let p,u,h,g;if(e==="VALID"&&(e=0),typeof e=="number"){p={top:e,bottom:e,left:e,right:e,front:e,back:e};let _=dc([r,t,s,1],[a,l,c],1,[i,n,o],e);u=_[0],h=_[1],g=_[2]}else if(Array.isArray(e)){if(!e.every((P,A,v)=>P===v[0]))throw Error(`Unsupported padding parameter: ${e}`);p={top:e[0],bottom:e[1],left:e[2],right:e[3],front:e[4],back:e[5]};let _=dc([r,t,s,1],[a,l,c],1,[i,n,o],e[0]);u=_[0],h=_[1],g=_[2]}else if(e==="SAME_UPPER"){u=Math.ceil(r/i),h=Math.ceil(t/n),g=Math.ceil(s/o);let _=(u-1)*i+a-r,P=(h-1)*n+l-t,A=(g-1)*o+c-s,v=Math.floor(_/2),y=_-v,k=Math.floor(P/2),E=P-k,M=Math.floor(A/2),w=A-M;p={top:k,bottom:E,left:M,right:w,front:v,back:y}}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:p,outDepth:u,outHeight:h,outWidth:g}},ff=(e,r,t,s,i,n=!1,o="channelsLast")=>{let a,l,c,p,u;if(o==="channelsLast")[a,l,c,p,u]=e;else if(o==="channelsFirst")[a,u,l,c,p]=e;else throw new Error(`Unknown dataFormat ${o}`);let[h,,g,_,P]=r,[A,v,y]=lc(t),[k,E,M]=lc(s),w=zi(g,k),x=zi(_,E),$=zi(P,M),{padInfo:z,outDepth:R,outHeight:Q,outWidth:q}=mf(i,l,c,p,A,v,y,w,x,$),U=n?h*u:h,Z=[0,0,0,0,0];return o==="channelsFirst"?Z=[a,U,R,Q,q]:o==="channelsLast"&&(Z=[a,R,Q,q,U]),{batchSize:a,dataFormat:o,inDepth:l,inHeight:c,inWidth:p,inChannels:u,outDepth:R,outHeight:Q,outWidth:q,outChannels:U,padInfo:z,strideDepth:A,strideHeight:v,strideWidth:y,filterDepth:g,filterHeight:_,filterWidth:P,effectiveFilterDepth:w,effectiveFilterHeight:x,effectiveFilterWidth:$,dilationDepth:k,dilationHeight:E,dilationWidth:M,inShape:e,outShape:Z,filterShape:r}},_f=(e,r,t,s,i,n)=>{let o=n==="channelsLast";o?e[0].dims[3]:e[0].dims[1];let a=[64,1,1],l={x:t.map((A,v)=>v)},c=[Math.ceil(pf(l.x.map(A=>t[A]))/a[0]),1,1];St("verbose",()=>`[conv3d_naive_webgpu] dispatch = ${c}`);let p=1,u=Te.size(t),h=[{type:12,data:u},{type:12,data:s},{type:12,data:i},{type:12,data:r.strides},{type:12,data:r.dilations}];gn(r,h),h.push(...nt(e[0].dims,e[1].dims));let g=["rank","rank"],_=e.length===3;_&&(h.push(...nt(e[2].dims)),g.push("rank")),h.push(...nt(t));let P=A=>{let v=[{name:"output_size",type:"u32"},{name:"filter_dims",type:"u32",length:s.length},{name:"pads",type:"u32",length:i.length},{name:"strides",type:"u32",length:r.strides.length},{name:"dilations",type:"u32",length:r.dilations.length}];wn(r,v);let y=1,k=lr(e[0].dataType),E=$e("x",e[0].dataType,e[0].dims.length,p),M=$e("W",e[1].dataType,e[1].dims.length,y),w=[E,M],x=tt("result",e[0].dataType,t.length,y),$="";if(_){let Q=$e("bias",e[2].dataType,e[2].dims.length,y);w.push(Q),$+=` - fn getBiasByOutputCoords(coords : array) -> ${k} { - return bias[${o?rt("coords",4,5):rt("coords",1,5)}]; - }`}let z=hr(p,k),R=_n(r,z,k);return` - ${$} - fn getX(d0 : u32, d1 : u32, d2 : u32, d3 : u32, d4 : u32) -> f32 { - let aIndices = array(d0, d1, d2, d3, d4); - return ${E.getByIndices("aIndices")}; - } - fn getW(d0 : u32, d1 : u32, d2 : u32, d3 : u32, d4 : u32) -> f32 { - let aIndices = array(d0, d1, d2, d3, d4); - return ${M.getByIndices("aIndices")}; - } - ${A.registerUniforms(v).declareVariables(...w,x)} - ${A.mainStart()} - ${A.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let coords = ${x.offsetToIndices("global_idx")}; - let batch = ${rt("coords",0,E.rank)}; - let d2 = ${o?rt("coords",E.rank-1,E.rank):rt("coords",1,E.rank)}; - let xFRCCorner = vec3(${o?rt("coords",1,E.rank):rt("coords",2,E.rank)}, - ${o?rt("coords",2,E.rank):rt("coords",3,E.rank)}, - ${o?rt("coords",3,E.rank):rt("coords",4,E.rank)}) * uniforms.strides - uniforms.pads; - let xFCorner = xFRCCorner.x; - let xRCorner = xFRCCorner.y; - let xCCorner = xFRCCorner.z; - let xShapeY = ${o?rt("uniforms.x_shape",1,E.rank):rt("uniforms.x_shape",2,E.rank)}; - let xShapeZ = ${o?rt("uniforms.x_shape",2,E.rank):rt("uniforms.x_shape",3,E.rank)}; - let xShapeW = ${o?rt("uniforms.x_shape",3,E.rank):rt("uniforms.x_shape",4,E.rank)}; - let xShapeU = ${o?rt("uniforms.x_shape",4,E.rank):rt("uniforms.x_shape",1,E.rank)}; - let inputDepthNearestVec4 = (xShapeU / 4) * 4; - let inputDepthVec4Remainder = xShapeU % 4; - - var value = 0.0; - for (var wF = 0u; wF < uniforms.filter_dims[0]; wF++) { - let xF = xFCorner + wF * uniforms.dilations[0]; - if (xF < 0 || xF >= xShapeY) { - continue; - } - - for (var wR = 0u; wR < uniforms.filter_dims[1]; wR++) { - let xR = xRCorner + wR * uniforms.dilations[1]; - if (xR < 0 || xR >= xShapeZ) { - continue; - } - - for (var wC = 0u; wC < uniforms.filter_dims[2]; wC++) { - let xC = xCCorner + wC * uniforms.dilations[2]; - if (xC < 0 || xC >= xShapeW) { - continue; - } - - for (var d1 = 0u; d1 < inputDepthNearestVec4; d1 += 4) { - ${o?`let xValues = vec4( - getX(batch, xF, xR, xC, d1), - getX(batch, xF, xR, xC, d1 + 1), - getX(batch, xF, xR, xC, d1 + 2), - getX(batch, xF, xR, xC, d1 + 3)); - `:`let xValues = vec4( - getX(batch, d1, xF, xR, xC), - getX(batch, d1 + 1, xF, xR, xC), - getX(batch, d1 + 2, xF, xR, xC), - getX(batch, d1 + 3, xF, xR, xC)); - `} - let wValues = vec4( - getW(d2, d1, wF, wR, wC), - getW(d2, d1 + 1, wF, wR, wC), - getW(d2, d1 + 2, wF, wR, wC), - getW(d2, d1 + 3, wF, wR, wC)); - value += dot(xValues, wValues); - } - if (inputDepthVec4Remainder == 1) { - ${o?`value += getX(batch, xF, xR, xC, inputDepthNearestVec4) - * getW(d2, inputDepthNearestVec4, wF, wR, wC);`:`value += getX(batch, inputDepthNearestVec4, xF, xR, xC) - * getW(d2, inputDepthNearestVec4, wF, wR, wC);`} - } else if (inputDepthVec4Remainder == 2) { - ${o?`let xValues = vec2( - getX(batch, xF, xR, xC, inputDepthNearestVec4), - getX(batch, xF, xR, xC, inputDepthNearestVec4 + 1)); - `:`let xValues = vec2( - getX(batch, inputDepthNearestVec4, xF, xR, xC), - getX(batch, inputDepthNearestVec4 + 1, xF, xR, xC)); - `} - let wValues = vec2( - getW(d2, inputDepthNearestVec4, wF, wR, wC), - getW(d2, inputDepthNearestVec4 + 1, wF, wR, wC)); - value += dot(xValues, wValues); - } else if (inputDepthVec4Remainder == 3) { - ${o?`let xValues = vec3( - getX(batch, xF, xR, xC, inputDepthNearestVec4), - getX(batch, xF, xR, xC, inputDepthNearestVec4 + 1), - getX(batch, xF, xR, xC, inputDepthNearestVec4 + 2)); - `:`let xValues = vec3( - getX(batch, inputDepthNearestVec4, xF, xR, xC), - getX(batch, inputDepthNearestVec4 + 1, xF, xR, xC), - getX(batch, inputDepthNearestVec4 + 2, xF, xR, xC)); - `} - let wValues = vec3( - getW(d2, inputDepthNearestVec4, wF, wR, wC), - getW(d2, inputDepthNearestVec4 + 1, wF, wR, wC), - getW(d2, inputDepthNearestVec4 + 2, wF, wR, wC)); - value += dot(xValues, wValues); - } - } - } - } - ${_?"value = value + getBiasByOutputCoords(coords)":""}; - ${R} - result[global_idx] = f32(value); - }`};return{name:"Conv3DNaive",shaderCache:{hint:`${r.cacheKey};${o};${p};${_}`,inputDependencies:g},getRunData:()=>({outputs:[{dims:t,dataType:e[0].dataType}],dispatchGroup:{x:c[0],y:c[1],z:c[2]},programUniforms:h}),getShaderSource:P}}}),gf,wf,vv=Ve(()=>{pt(),Mt(),Tt(),yn(),gf=(e,r,t,s)=>{let i=e.length>2,n=i?"value += b[output_channel];":"",o=e[0].dims,a=e[1].dims,l=r.format==="NHWC",c=l?t[3]:t[1],p=c/r.group,u=l&&p>=4?Xt(c):1,h=Te.size(t)/u,g=[{type:12,data:h},{type:12,data:r.dilations},{type:12,data:[r.strides[0],r.strides[1]]},{type:12,data:[r.pads[0],r.pads[1]]},{type:12,data:p}];gn(r,g),g.push(...nt(o,[a[0],a[1],a[2],a[3]/u]));let _=i?["rank","rank","rank"]:["rank","rank"];g.push(...nt([t[0],t[1],t[2],t[3]/u]));let P=A=>{let v=tt("output",e[0].dataType,t.length,u),y=lr(v.type.tensor),k=_n(r,v.type.value,y),E=$e("x",e[0].dataType,o.length),M=$e("w",e[1].dataType,a.length,u),w=[E,M];i&&w.push($e("b",e[2].dataType,e[2].dims,u));let x=[{name:"output_size",type:"u32"},{name:"dilations",type:"u32",length:r.dilations.length},{name:"strides",type:"u32",length:2},{name:"pads",type:"u32",length:2},{name:"output_channels_per_group",type:"u32"}];wn(r,x);let $=l?` - for (var wHeight: u32 = 0u; wHeight < uniforms.w_shape[0]; wHeight++) { - let xHeight = xRCCorner.x + wHeight * uniforms.dilations[0]; - - if (xHeight < 0u || xHeight >= uniforms.x_shape[1]) { - continue; - } - - for (var wWidth: u32 = 0u; wWidth < uniforms.w_shape[1]; wWidth++) { - let xWidth = xRCCorner.y + wWidth * uniforms.dilations[1]; - if (xWidth < 0u || xWidth >= uniforms.x_shape[2]) { - continue; - } - - for (var wInChannel: u32 = 0u; wInChannel < uniforms.w_shape[2]; wInChannel++) { - let input_channel = in_channel_offset + wInChannel; - let xVal = ${E.get("batch","xHeight","xWidth","input_channel")}; - let wVal = ${M.get("wHeight","wWidth","wInChannel","output_channel")}; - value += xVal * wVal; - } - } - } - `:` - for (var wInChannel: u32 = 0u; wInChannel < uniforms.w_shape[1]; wInChannel++) { - let input_channel = in_channel_offset + wInChannel; - for (var wHeight: u32 = 0u; wHeight < uniforms.w_shape[2]; wHeight++) { - let xHeight = xRCCorner.x + wHeight * uniforms.dilations[0]; - - if (xHeight < 0u || xHeight >= uniforms.x_shape[2]) { - continue; - } - - for (var wWidth: u32 = 0u; wWidth < uniforms.w_shape[3]; wWidth++) { - let xWidth = xRCCorner.y + wWidth * uniforms.dilations[1]; - if (xWidth < 0u || xWidth >= uniforms.x_shape[3]) { - continue; - } - - let xVal = ${E.get("batch","input_channel","xHeight","xWidth")}; - let wVal = ${M.get("output_channel","wInChannel","wHeight","wWidth")}; - value += xVal * wVal; - } - } - } - `;return` - ${A.registerUniforms(x).declareVariables(...w,v)} - - ${A.mainStart()} - ${A.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let outputIndices = ${v.offsetToIndices("global_idx")}; - let batch: u32 = outputIndices[0]; - let output_channel: u32 = outputIndices[${l?3:1}]; - let xRCCorner: vec2 = vec2(outputIndices[${l?1:2}], outputIndices[${l?2:3}]) * uniforms.strides - uniforms.pads; - let group_id: u32 = output_channel * ${u} / uniforms.output_channels_per_group; - var in_channel_offset = group_id * uniforms.w_shape[${l?2:1}]; - - var value: ${v.type.value} = ${v.type.value}(0); - ${$} - ${n} - ${k} - ${v.setByOffset("global_idx","value")} - }`};return{name:"GroupedConv",shaderCache:{hint:`${r.cacheKey}_${u}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:s?s(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(h/64)},programUniforms:g}),getShaderSource:P}},wf=(e,r,t,s)=>{let i=e.length>2,n=Xt(t[3]),o=Xt(t[2]),a=Te.size(t)/n/o,l=[e[0].dims[0],e[0].dims[1],e[0].dims[2],e[0].dims[3]/n],c=[e[1].dims[0],e[1].dims[1],e[1].dims[2],e[1].dims[3]/n],p=[t[0],t[1],t[2],t[3]/n],u=[{type:12,data:a},{type:6,data:[r.strides[0],r.strides[1]]},{type:6,data:[r.pads[0],r.pads[1]]}];gn(r,u),u.push(...nt(l,c,p));let h=(o-1)*r.strides[1]+c[1],g=_=>{let P=tt("output",e[0].dataType,p.length,n),A=lr(P.type.tensor),v=_n(r,P.type.value,A),y=$e("x",e[0].dataType,l.length,n),k=$e("w",e[1].dataType,c.length,n),E=[y,k];i&&E.push($e("b",e[2].dataType,e[2].dims,n));let M=i?"value += b[output_channel];":"",w=[{name:"output_size",type:"u32"},{name:"strides",type:"i32",length:2},{name:"pads",type:"i32",length:2}];return wn(r,w),` - ${_.registerUniforms(w).declareVariables(...E,P)} - ${_.mainStart()} - ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let width0 = uniforms.output_shape[3]; - let output_channel = global_idx % width0; - var index1 = global_idx / width0; - let width1 = uniforms.output_shape[2] / ${o}u; - let col = (index1 % width1) * ${o}u; - index1 = index1 / width1; - let row = index1 % uniforms.output_shape[1]; - let batch = index1 / uniforms.output_shape[1]; - - let x_corner = vec2(i32(row), i32(col)) * uniforms.strides - uniforms.pads; - - var x_vals: array<${y.type.value}, ${h}>; - var values: array<${P.type.value}, ${o}>; - let input_channel = output_channel; - // Use constant instead of uniform can give better performance for w's height/width. - for (var w_height: u32 = 0u; w_height < ${c[0]}; w_height++) { - let x_height = x_corner.x + i32(w_height); - if (x_height >= 0 && u32(x_height) < uniforms.x_shape[1]) { - for (var i = 0; i < ${h}; i++) { - let x_width = x_corner.y + i; - if (x_width >= 0 && u32(x_width) < uniforms.x_shape[2]) { - x_vals[i] = ${y.get("batch","u32(x_height)","u32(x_width)","input_channel")}; - } else { - x_vals[i] = ${y.type.value}(0); - } - } - for (var w_width: u32 = 0u; w_width < ${c[1]}; w_width++) { - let w_val = ${k.get("w_height","w_width","0","output_channel")}; - for (var i = 0u; i < ${o}u; i++) { - values[i] = fma(x_vals[i * u32(uniforms.strides[1]) + w_width], w_val, values[i]); - } - } - } - } - - for (var i = 0u; i < ${o}u; i++) { - var value = values[i]; - ${M} - ${v} - ${P.set("batch","row","col + i","output_channel","value")}; - } - }`};return{name:"GroupedConv-Vectorize",shaderCache:{hint:`${r.cacheKey};${n};${o};${h};${c[0]};${c[1]}`,inputDependencies:i?["rank","rank","type"]:["rank","rank"]},getRunData:()=>({outputs:[{dims:s?s(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(a/64)},programUniforms:u}),getShaderSource:g}}}),yf,$a,Mf,ka,cc,uc,bf,vf,pc,Tv=Ve(()=>{Mt(),Mv(),bv(),ac(),vv(),yn(),sc(),Ks(),yf=(e,r,t,s,i,n)=>{let o=e[0],a=e.slice(n?1:2,n?3:4),l=a.length,c=r[0],p=r.slice(2).map((h,g)=>h+(h-1)*(t[g]-1)),u=a.map((h,g)=>h+s[g]+s[g+l]).map((h,g)=>Math.floor((h-p[g]+i[g])/i[g]));return u.splice(0,0,o),u.splice(n?3:1,0,c),u},$a=[2,3,1,0],Mf=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length>5)throw new Error("greater than 5D is not supported");if(e[0].dims.length!==e[1].dims.length)throw new Error("filter does not have same dimension as input");let t=e[0].dims[r.format==="NHWC"?e[0].dims.length-1:1],s=e[1].dims[1]*r.group;if(t!==s)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(e.length===3&&(e[2].dims.length!==1||e[1].dims[0]!==e[2].dims[0]))throw new Error("invalid bias");let i=e[0].dims.length-2;if(r.dilations.length!==i)throw new Error(`dilations should be ${i}D`);if(r.strides.length!==i)throw new Error(`strides should be ${i}D`);if(r.pads.length!==i*2)throw new Error(`pads should be ${i*2}D`);if(r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape")},ka=(e,r)=>{let t=e.kernelShape.slice();t.length{let r=ec(e),t=e.format,s=["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][e.auto_pad],i=e.dilations,n=e.group,o=e.kernel_shape,a=e.pads,l=e.strides,c=e.w_is_const();return{autoPad:s,format:t,dilations:i,group:n,kernelShape:o,pads:a,strides:l,wIsConst:c,...r,cacheKey:`${e.format};${r.activation};`}},uc=(e,r,t,s)=>{let i=t.format==="NHWC",n=yf(r[0].dims,r[1].dims,t.dilations,t.pads,t.strides,i);if(t.group!==1){let w=[r[0]];if(i){let x=e.kernelCustomData.wT??e.compute(Nr(r[1],$a),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=x),w.push(x)}else w.push(r[1]);r.length===3&&w.push(r[2]),!e.adapterInfo.isArchitecture("ampere")&&i&&r[1].dims[0]===t.group&&r[1].dims[1]===1&&t.dilations[0]===1&&t.dilations[1]===1?e.compute(wf(w,t,n,s),{inputs:w}):e.compute(gf(w,t,n,s),{inputs:w});return}let o=r.length===3,a=r[0].dims[i?1:2],l=r[0].dims[i?2:3],c=r[0].dims[i?3:1],p=r[1].dims[2],u=r[1].dims[3],h=n[i?1:2],g=n[i?2:3],_=n[i?3:1],P=i&&p===a&&u===l&&t.pads[0]===0&&t.pads[1]===0;if(P||p===1&&u===1&&t.dilations[0]===1&&t.dilations[1]===1&&t.strides[0]===1&&t.strides[1]===1&&t.pads[0]===0&&t.pads[1]===0){let w=n[0],x,$,z,R=[];if(i){let U=e.kernelCustomData.wT??e.compute(Nr(r[1],$a),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];if(t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=U),P){let Z=a*l*c;x=r[0].reshape([1,w,Z]),$=U.reshape([1,Z,_]),z=[1,w,_]}else x=r[0].reshape([w,a*l,c]),$=U.reshape([1,c,_]),z=[w,h*g,_];R.push(x),R.push($)}else x=r[0].reshape([w,c,a*l]),$=r[1].reshape([1,_,c]),z=[w,_,h*g],R.push($),R.push(x);o&&R.push(r[2]);let Q=z[2],q=R[0].dims[R[0].dims.length-1];Q<8&&q<8?e.compute(rc(R,t,n,z,i,s),{inputs:R}):e.compute(Sa(R,t,n,z,i,s),{inputs:R});return}let A=!0,v=e.kernelCustomData.wT??e.compute(Nr(r[1],$a),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=v);let y=[r[0],v];o&&y.push(r[2]);let k=i?h*g:_,E=i?_:h*g,M=p*u*c;e.compute(uf(y,t,n,k,E,M,o,A,s),{inputs:y})},bf=(e,r)=>{let t=r.format==="NHWC",s=[e.inputs[0].reshape(t?[e.inputs[0].dims[0],1,e.inputs[0].dims[1],e.inputs[0].dims[2]]:[e.inputs[0].dims[0],e.inputs[0].dims[1],1,e.inputs[0].dims[2]]),e.inputs[1].reshape([e.inputs[1].dims[0],e.inputs[1].dims[1],1,e.inputs[1].dims[2]])];e.inputs.length===3&&s.push(e.inputs[2]);let i=[0,r.pads[0],0,r.pads[1]],n=[1].concat(r.strides),o=[1].concat(r.dilations),a=[1].concat(r.kernelShape),l=ka({...r,pads:i,strides:n,dilations:o,kernelShape:a},s);uc(e,s,l,c=>t?[c[0],c[2],c[3]]:[c[0],c[1],c[3]])},vf=(e,r,t)=>{let s=t.format==="NHWC"?"channelsLast":"channelsFirst",i=ka(t,r),n=t.autoPad==="NOTSET"?t.pads:t.autoPad,o=ff(r[0].dims,r[1].dims,t.strides,t.dilations,n,!1,s);e.compute(_f(r,i,o.outShape,[o.filterDepth,o.filterHeight,o.filterWidth],[o.padInfo.front,o.padInfo.top,o.padInfo.left],s))},pc=(e,r)=>{if(Mf(e.inputs,r),e.inputs[0].dims.length===3)bf(e,r);else if(e.inputs[0].dims.length===5)vf(e,e.inputs,r);else{let t=ka(r,e.inputs);uc(e,e.inputs,t)}}}),Tf,xv=Ve(()=>{pt(),Is(),Mt(),Tt(),Tf=(e,r,t)=>{let s=e.length>2,i=r.outputShape,n=r.format==="NHWC",o=r.group,a=e[1].dims,l=a[2]/o,c=a[3],p=n?Xt(l):1,u=n&&c===1&&l>=4,h=u?Math.floor(l/4)*4:Math.floor(l/p)*p,g=l-h,_=n?Xt(c):1,P=n?c===1?p:_:1,A=Te.size(i)/_,v=[Math.ceil(A/64),1,1];St("verbose",()=>`[conv2d_backprop_webgpu] dispatch = ${v}`);let y=["rank","rank"],k=[r.strides[0],r.strides[1]],E=[r.kernelShape[n?1:2],r.kernelShape[n?2:3]],M=[r.dilations[0],r.dilations[1]],w=[E[0]+(r.dilations[0]<=1?0:(r.kernelShape[n?1:2]-1)*(r.dilations[0]-1)),E[1]+(r.dilations[1]<=1?0:(r.kernelShape[n?2:3]-1)*(r.dilations[1]-1))],x=[w[0]-1-Math.floor((r.pads[0]+r.pads[2])/2),w[1]-1-Math.floor((r.pads[1]+r.pads[3])/2)],$=[{type:12,data:A},{type:12,data:k},{type:12,data:E},{type:12,data:M},{type:12,data:w},{type:6,data:x},{type:12,data:h},{type:12,data:l},{type:12,data:c},...nt(e[0].dims,e[1].dims)];s&&($.push(...nt(e[2].dims)),y.push("rank")),$.push(...nt(i));let z=R=>{let Q=[{name:"output_size",type:"u32"},{name:"strides",type:"u32",length:k.length},{name:"filter_dims",type:"u32",length:E.length},{name:"dilations",type:"u32",length:E.length},{name:"effective_filter_dims",type:"u32",length:w.length},{name:"pads",type:"i32",length:x.length},{name:"input_channels_per_group_int",type:"u32"},{name:"input_channels_per_group",type:"u32"},{name:"output_channels_per_group",type:"u32"}],q=lr(e[0].dataType),U=n?1:2,Z=n?2:3,H=n?3:1,J=$e("W",e[1].dataType,e[1].dims.length,P),ie=$e("Dy",e[0].dataType,e[0].dims.length,p),ae=[ie,J];s&&ae.push($e("bias",e[2].dataType,[i[H]].length,_));let ce=tt("result",e[0].dataType,i.length,_),he=()=>{let G="";if(u)p===4?G+=` - let xValue = ${ie.getByOffset("x_offset")}; - let wValue = ${J.getByOffset("w_offset")}; - dotProd = dotProd + dot(xValue, wValue); - x_offset += 1u; - w_offset += 1u;`:p===2?G+=` - dotProd = dotProd + dot(vec4<${q}>(${ie.getByOffset("x_offset")}, ${ie.getByOffset("x_offset + 1u")}), vec4<${q}>(${J.getByOffset("w_offset")}, ${J.getByOffset("w_offset + 1u")})); - x_offset += 2u; - w_offset += 2u;`:p===1&&(G+=` - dotProd = dotProd + dot(vec4<${q}>(${ie.getByOffset("x_offset")}, ${ie.getByOffset("x_offset + 1u")}, ${ie.getByOffset("x_offset + 2u")}, ${ie.getByOffset("x_offset + 3u")}), vec4<${q}>(${J.getByOffset("w_offset")}, ${J.getByOffset("w_offset + 1u")}, ${J.getByOffset("w_offset + 2u")}, ${J.getByOffset("w_offset + 3u")})); - x_offset += 4u; - w_offset += 4u;`);else if(G+=` - let xValue = ${n?ie.getByOffset(`${ie.indicesToOffset(`${ie.type.indices}(batch, idyR, idyC, inputChannel)`)} / ${p}`):ie.get("batch","inputChannel","idyR","idyC")}; - `,p===1)G+=` - let w_offset = ${J.indicesToOffset(`${J.type.indices}(u32(wRPerm), u32(wCPerm), inputChannel, wOutChannel)`)}; - let wValue = ${J.getByOffset(`w_offset / ${P}`)}; - dotProd = dotProd + xValue * wValue;`;else for(let se=0;se{if(g===0)return"";if(!u)throw new Error(`packInputAs4 ${u} is not true.`);let G="";if(p===1){G+="dotProd = dotProd";for(let se=0;se(i32(r), i32(c)) - uniforms.pads; - let dyRCorner = dyCorner.x; - let dyCCorner = dyCorner.y; - let groupId = d1 / uniforms.output_channels_per_group; - let wOutChannel = d1 - groupId * uniforms.output_channels_per_group; - // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1). - // ? = to be determined. : = across all values in that axis. - var dotProd = ${ce.type.value}(0.0); - var wR: u32 = 0; - if (uniforms.dilations.x == 1) { - // Minimum wR >= 0 that satisfies (dyRCorner + wR) % (uniforms.strides.x) == 0 - wR = u32(((dyRCorner + i32(uniforms.strides.x) - 1) / i32(uniforms.strides.x)) * i32(uniforms.strides.x) - dyRCorner); - } - for (; wR < uniforms.effective_filter_dims.x; wR = wR + 1) { - if (wR % uniforms.dilations.x != 0) { - continue; - } - let dyR = (${q}(dyRCorner) + ${q}(wR)) / ${q}(uniforms.strides[0]); - let wRPerm = uniforms.filter_dims.x - 1 - wR / uniforms.dilations.x; - if (dyR < 0.0 || dyR >= ${q}(uniforms.Dy_shape[${U}]) || fract(dyR) > 0.0 || - wRPerm < 0) { - continue; - } - let idyR: u32 = u32(dyR); - var wC: u32 = 0; - if (uniforms.dilations.y == 1) { - // Minimum wC >= 0 that satisfies (dyCCorner + wC) % (uniforms.strides.y) == 0 - wC = u32(((dyCCorner + i32(uniforms.strides.y) - 1) / i32(uniforms.strides.y)) * i32(uniforms.strides.y) - dyCCorner); - } - for (; wC < uniforms.effective_filter_dims.y; wC = wC + 1) { - if (wC % uniforms.dilations.y != 0) { - continue; - } - let dyC = (${q}(dyCCorner) + ${q}(wC)) / ${q}(uniforms.strides.y); - let wCPerm = uniforms.filter_dims.y - 1 - wC / uniforms.dilations.y; - if (dyC < 0.0 || dyC >= ${q}(uniforms.Dy_shape[${Z}]) || - fract(dyC) > 0.0 || wCPerm < 0) { - continue; - } - let idyC: u32 = u32(dyC); - var inputChannel = groupId * uniforms.input_channels_per_group; - ${u?` - var x_offset = ${ie.indicesToOffset(`${ie.type.indices}(batch, idyR, idyC, inputChannel)`)} / ${p}; - var w_offset = ${J.indicesToOffset(`${J.type.indices}(wRPerm, wCPerm, inputChannel, wOutChannel)`)} / ${P}; - `:""} - for (var d2: u32 = 0; d2 < uniforms.input_channels_per_group_int; d2 = d2 + ${u?4:p}) { - ${he()} - inputChannel = inputChannel + ${u?4:p}; - } - ${N()} - wC = wC + uniforms.strides.y - 1; - } - wR = wR + uniforms.strides[0] - 1; - } - let value = dotProd${s?` + bias[d1 / ${_}]`:""}; - ${ce.setByOffset("global_idx","value")}; - `;return` - ${R.registerUniforms(Q).declareVariables(...ae,ce)} - ${R.mainStart()} - ${R.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")}; - ${O}}`};return{name:"ConvTranspose2D",shaderCache:{hint:`${r.cacheKey};${p}${P}${_}${u}${g}`,inputDependencies:y},getRunData:()=>({dispatchGroup:{x:v[0],y:v[1],z:v[2]},outputs:[{dims:t?t(i):i,dataType:e[0].dataType}],programUniforms:$}),getShaderSource:z}}}),xf,Ef,Pf,hc,Cf,Sf,mc,$f,kf,Ev=Ve(()=>{xv(),yn(),Ks(),xf=(e,r,t,s,i,n)=>(e-1)*r+t+(s-1)*i+1-n,Ef=(e,r,t,s,i)=>{let n=Math.floor(e/2);r==="SAME_UPPER"?(t[s]=n,t[i]=e-n):r==="SAME_LOWER"&&(t[s]=e-n,t[i]=n)},Pf=(e,r,t,s,i,n,o,a,l,c)=>{let p=e.length-2,u=c.length===0;l.length{let t=e.kernelShape.slice();if(e.kernelShape.length===0||e.kernelShape.reduce((u,h)=>u*h,1)===0){t.length=0;for(let u=2;uu+h,0)===0){let u=r[0].dims.length-2;l=new Array(u).fill(1)}let c=e.strides.slice();if(c.reduce((u,h)=>u+h,0)===0){let u=r[0].dims.length-2;c=new Array(u).fill(1)}Pf(a,t,l,e.autoPad,e.group,i,c,s,o,n);let p=Object.assign({},e);return Object.assign(p,{kernelShape:t,pads:i,outputPadding:o,outputShape:n,dilations:l,strides:c}),p},Cf=e=>{let r=ec(e),t=e.format,s=["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][typeof e.autoPad>"u"?0:e.autoPad],i=e.dilations,n=e.group,o=e.kernelShape,a=e.pads,l=e.strides,c=e.wIsConst(),p=e.outputPadding,u=e.outputShape;return{autoPad:s,format:t,dilations:i,group:n,kernelShape:o,outputPadding:p,outputShape:u,pads:a,strides:l,wIsConst:c,...r,cacheKey:`${e.format};${r.activation};`}},Sf=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length!==4&&e[0].dims.length!==3)throw new Error("currently only support 2-dimensional conv");if(e[0].dims.length!==e[1].dims.length)throw new Error("filter does not have same dimension as input");let t=e[0].dims[r.format==="NHWC"?e[0].dims.length-1:1],s=e[1].dims[0];if(t!==s)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");let i=e[1].dims[1]*r.group;if(e.length===3&&(e[2].dims.length!==1||e[2].dims[0]!==i))throw new Error("invalid bias");let n=e[0].dims.length-2;if(r.dilations.reduce((o,a)=>o+a,0)>0&&r.dilations.length!==n)throw new Error(`dilations should be ${n}D`);if(r.strides.reduce((o,a)=>o+a,0)>0&&r.strides.length!==n)throw new Error(`strides should be ${n}D`);if(r.pads.reduce((o,a)=>o+a,0)>0&&r.pads.length!==n*2)throw new Error(`pads should be ${n*2}D`);if(r.outputPadding.length!==n&&r.outputPadding.length!==0)throw new Error(`output_padding should be ${n}D`);if(r.kernelShape.reduce((o,a)=>o+a,0)>0&&r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape");if(r.outputShape.length!==0&&r.outputShape.length!==e[0].dims.length-2)throw new Error("invalid output shape")},mc=(e,r,t,s)=>{let i=e.kernelCustomData.wT??e.compute(Nr(r[1],[2,3,0,1]),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=i);let n=[r[0],i];r.length===3&&n.push(r[2]),e.compute(Tf(n,t,s),{inputs:n})},$f=(e,r)=>{let t=r.format==="NHWC",s=[e.inputs[0].reshape(t?[e.inputs[0].dims[0],1,e.inputs[0].dims[1],e.inputs[0].dims[2]]:[e.inputs[0].dims[0],e.inputs[0].dims[1],1,e.inputs[0].dims[2]]),e.inputs[1].reshape([e.inputs[1].dims[0],e.inputs[1].dims[1],1,e.inputs[1].dims[2]])];e.inputs.length===3&&s.push(e.inputs[2]);let i=r.kernelShape;(i.length===0||i[0]===0)&&(i=[e.inputs[1].dims[2]]);let n=r.dilations;(n.length===0||n[0]===0)&&(n=[1]);let o=r.strides;(o.length===0||o[0]===0)&&(o=[1]);let a=r.pads;a.length===0&&(a=[0,0]),a=[0,a[0],0,a[1]],o=[1].concat(o),n=[1].concat(n),i=[1].concat(i);let l=r.outputPadding;l=[0].concat(l);let c=hc({...r,pads:a,strides:o,dilations:n,kernelShape:i,outputPadding:l},s);mc(e,s,c,p=>t?[p[0],p[2],p[3]]:[p[0],p[1],p[3]])},kf=(e,r)=>{if(Sf(e.inputs,r),e.inputs[0].dims.length===3)$f(e,r);else{let t=hc(r,e.inputs);mc(e,e.inputs,t)}}}),If,Af,Ff,Pv=Ve(()=>{pt(),Mt(),Yt(),Tt(),If=(e,r,t,s)=>{let i=Te.size(r),n=r.length,o=$e("input",e,n),a=tt("output",e,n),l=t.dataType===6?t.getInt32Array()[0]:Number(t.getBigInt64Array()[0]),c=Te.normalizeAxis(l,n),p=u=>{let h=` i32(${o.indicesGet("inputIndices","uniforms.axis")}) `,g=rt("uniforms.input_shape","uniforms.axis",n),_=s.reverse?h+(s.exclusive?" + 1":""):"0",P=s.reverse?g:h+(s.exclusive?"":" + 1");return` - ${u.registerUniform("outputSize","u32").registerUniform("axis","u32").declareVariables(o,a)} - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - var inputIndices = ${a.offsetToIndices("global_idx")}; - var sum = ${a.type.value}(0); - let first : i32 = ${_}; - let last : i32 = ${P}; - for (var i : i32 = first; i < last; i++) { - ${o.indicesSet("inputIndices","uniforms.axis","u32(i)")}; - sum = sum + ${o.getByIndices("inputIndices")}; - } - ${a.setByOffset("global_idx","sum")}; - }`};return{name:"CumSum",shaderCache:{hint:s.cacheKey,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:r,dataType:e}],dispatchGroup:{x:Math.ceil(i/64)},programUniforms:[{type:12,data:i},{type:12,data:c},...nt(r,r)]}),getShaderSource:p}},Af=(e,r)=>{let t=e.inputs[0].dims,s=e.inputs[0].dataType,i=e.inputs[1];e.compute(If(s,t,i,r),{inputs:[0]})},Ff=e=>{let r=e.exclusive===1,t=e.reverse===1;return Dt({exclusive:r,reverse:t})}}),Of,Df,Lf,zf,Bf,Cv=Ve(()=>{pt(),Mt(),Yt(),Tt(),Of=e=>{if(!e||e.length!==1)throw new Error("DepthToSpace requires 1 input.");if(e[0].dims.length!==4)throw new Error("DepthToSpace requires 4D input.")},Df=(e,r,t,s)=>{let i=[];i.push(`fn perm(i: ${s.type.indices}) -> ${t.type.indices} { - var a: ${t.type.indices};`);for(let n=0;n{let t,s,i,n,o,a,l=r.format==="NHWC",c=r.blocksize,p=r.mode==="DCR";l?([t,s,i,n]=e.dims,o=p?[t,s,i,c,c,n/c**2]:[t,s,i,n/c**2,c,c],a=p?[0,1,3,2,4,5]:[0,1,4,2,5,3]):([t,s,i,n]=[e.dims[0],e.dims[2],e.dims[3],e.dims[1]],o=p?[t,c,c,n/c**2,s,i]:[t,n/c**2,c,c,s,i],a=p?[0,3,4,1,5,2]:[0,1,4,2,5,3]);let u=e.reshape(o),h=u.dims.length,g=e.dataType,_=$e("a",g,h),P=tt("output",g,h),A=v=>` - ${v.registerUniform("output_size","u32").declareVariables(_,P)} - - ${Df(a,h,_,P)} - - ${v.mainStart()} - ${v.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let indices = ${P.offsetToIndices("global_idx")}; - let aIndices = perm(indices); - - ${P.setByOffset("global_idx",_.getByIndices("aIndices"))} - }`;return{name:"DepthToSpace",shaderCache:{hint:`${e.dims};${r.blocksize};${r.mode}`,inputDependencies:["rank"]},getRunData:v=>{let y=l?[t,s*c,i*c,n/c**2]:[t,n/c**2,s*c,i*c],k=Te.size(y),E=u.dims,M=Te.sortBasedOnPerm(E,a);return{outputs:[{dims:y,dataType:v[0].dataType}],dispatchGroup:{x:Math.ceil(k/64)},programUniforms:[{type:12,data:k},...nt(E,M)]}},getShaderSource:A}},zf=(e,r)=>{Of(e.inputs),e.compute(Lf(e.inputs[0],r))},Bf=e=>Dt({blocksize:e.blocksize,mode:e.mode,format:e.format})}),Ia,Bi,fc,Rf,Nf,jf,Vf,_c,Uf,Wf,Gf,Sv=Ve(()=>{pt(),Mt(),Yt(),Tt(),Ia="[a-zA-Z]|\\.\\.\\.",Bi="("+Ia+")+",fc="^"+Bi+"$",Rf="("+Bi+",)*"+Bi,Nf="^"+Rf+"$",jf=class{constructor(e=-1){this.symbolToIndices=new Map,this.inputIndex=e}addSymbol(e,r){let t=this.symbolToIndices.get(e);t===void 0?t=[r]:t.push(r),this.symbolToIndices.set(e,t)}},Vf=class{constructor(e,r){var i;this.equation=r,this.hasEllipsis=!1,this.symbolToInfo=new Map,this.lhs=new Array,this.outputDims=[];let[t,s]=r.includes("->")?r.split("->",2):[r,""];if(!t.match(RegExp(Nf)))throw new Error("Invalid LHS term");if(t.split(",").forEach((n,o)=>{let a=e[o].dims.slice();if(!n.match(RegExp(fc)))throw new Error("Invalid LHS term");let l=this.processTerm(n,!0,a,o);this.lhs.push(l)}),s==="")s+=[...this.symbolToInfo.entries()].filter(([n,o])=>o.count===1||n==="...").map(([n])=>n).join("");else if(!s.match(RegExp(Bi)))throw new Error("Invalid RHS");(i=s.match(RegExp(Ia,"g")))==null||i.forEach(n=>{if(n==="...")this.outputDims=this.outputDims.concat(this.ellipsisDims);else{let o=this.symbolToInfo.get(n);if(o===void 0)throw new Error("Invalid RHS symbol");this.outputDims.push(o.dimValue)}}),this.rhs=this.processTerm(s,!1,this.outputDims)}addSymbol(e,r,t){let s=this.symbolToInfo.get(e);if(s!==void 0){if(s.dimValue!==r&&s.count!==1)throw new Error("Dimension mismatch");s.count++,s.inputIndices.push(t)}else s={count:1,dimValue:r,inputIndices:[t]};this.symbolToInfo.set(e,s)}processTerm(e,r,t,s=-1){let i=t.length,n=!1,o=[],a=0;if(!e.match(RegExp(fc))&&!r&&e!=="")throw new Error("Invalid LHS term");let l=e.match(RegExp(Ia,"g")),c=new jf(s);return l==null||l.forEach((p,u)=>{if(p==="..."){if(n)throw new Error("Only one ellipsis is allowed per input term");n=!0;let h=i-l.length+1;if(h<0)throw new Error("Ellipsis out of bounds");if(o=t.slice(a,a+h),this.hasEllipsis){if(this.ellipsisDims.length!==o.length||this.ellipsisDims.toString()!==o.toString())throw new Error("Ellipsis dimensions mismatch")}else if(r)this.hasEllipsis=!0,this.ellipsisDims=o;else throw new Error("Ellipsis must be specified in the LHS");for(let g=0;ge+"_max",Uf=(e,r,t,s)=>{let i=e.map(c=>c.length).map((c,p)=>$e(`input${p}`,r,c)),n=Te.size(s),o=tt("output",r,s.length),a=[...t.symbolToInfo.keys()].filter(c=>!t.rhs.symbolToIndices.has(c)),l=c=>{let p=[],u="var prod = 1.0;",h="var sum = 0.0;",g="sum += prod;",_=[],P=[],A=[],v=[],y=t.symbolToInfo.size===t.rhs.symbolToIndices.size;t.symbolToInfo.forEach((E,M)=>{var w;if(t.rhs.symbolToIndices.has(M)){let x=(w=t.rhs.symbolToIndices.get(M))==null?void 0:w[0];x!==void 0&&t.lhs.forEach(($,z)=>{if(E.inputIndices.includes(z)){let R=$.symbolToIndices.get(M);if(R===void 0)throw new Error("Invalid symbol error");R.forEach(Q=>{p.push(`${i[z].indicesSet(`input${z}Indices`,Q,o.indicesGet("outputIndices",x))}`)})}})}else t.lhs.forEach((x,$)=>{if(E.inputIndices.includes($)){let z=x.symbolToIndices.get(M);if(z===void 0)throw new Error("Invalid symbol error");z.forEach(R=>{_.push(`${i[$].indicesSet(`input${$}Indices`,R,`${M}`)}`)}),v.push(`prod *= ${i[$].getByIndices(`input${$}Indices`)};`)}}),P.push(`for(var ${M}: u32 = 0; ${M} < uniforms.${_c(M)}; ${M}++) {`),A.push("}")});let k=y?[...p,`let sum = ${i.map((E,M)=>E.getByIndices(`input${M}Indices`)).join(" * ")};`]:[...p,h,...P,..._,u,...v,g,...A];return` - ${c.registerUniforms(a.map(E=>({name:`${_c(E)}`,type:"u32"}))).registerUniform("outputSize","u32").declareVariables(...i,o)} - - ${c.mainStart()} - ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - var outputIndices = ${o.offsetToIndices("global_idx")}; - ${i.map((E,M)=>`var input${M}Indices: ${i[M].type.indices};`).join(` -`)} - ${k.join(` -`)}; - ${o.setByOffset("global_idx","sum")}; - }`};return{name:"Einsum",shaderCache:{hint:t.equation,inputDependencies:e.map(()=>"rank")},getRunData:()=>{let c=a.filter(u=>t.symbolToInfo.has(u)).map(u=>{var h;return{type:12,data:((h=t.symbolToInfo.get(u))==null?void 0:h.dimValue)||0}});c.push({type:12,data:n});let p=e.map((u,h)=>[...nt(u)]).reduce((u,h)=>u.concat(h),c);return p.push(...nt(s)),{outputs:[{dims:s,dataType:r}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:p}},getShaderSource:l}},Wf=(e,r)=>{let t=new Vf(e.inputs,r.equation),s=t.outputDims,i=e.inputs.map((n,o)=>n.dims);e.compute(Uf(i,e.inputs[0].dataType,t,s))},Gf=e=>{let r=e.equation.replace(/\s+/g,"");return Dt({equation:r})}}),Kf,gc,Hf,qf,Qf,$v=Ve(()=>{pt(),Mt(),Tt(),Kf=e=>{if(!e||e.length!==2)throw new Error("Expand requires 2 input.");let r=e[0].dims,t=Array.from(e[1].getBigInt64Array(),Number),s=t.length{let t=e.length-r.length,s=[];for(let i=0;ie.length>r.length?gc(e,r):gc(r,e),qf=e=>{let r=e[0].dims,t=Array.from(e[1].getBigInt64Array(),Number),s=Hf(r,t),i=e[0].dataType,n=i===9||Te.size(r)===1,o=i===9||r.length>0&&r[r.length-1]%4===0?4:1,a=n||s.length>0&&s[s.length-1]%4===0?4:1,l=Math.ceil(Te.size(s)/a),c=u=>{let h=$e("input",i,r.length,o),g=tt("output",i,s.length,a),_;if(i===9){let P=(A,v,y="")=>` - let outputIndices${v} = ${g.offsetToIndices(`outputOffset + ${v}u`)}; - let offset${v} = ${h.broadcastedIndicesToOffset(`outputIndices${v}`,g)}; - let index${v} = offset${v} / 4u; - let component${v} = offset${v} % 4u; - ${A}[${v}] = ${y}(${h.getByOffset(`index${v}`)}[component${v}]); - `;_=` - let outputOffset = global_idx * ${a}; - var data = vec4(0); - ${P("data",0,"u32")} - ${P("data",1,"u32")} - ${P("data",2,"u32")} - ${P("data",3,"u32")} - ${g.setByOffset("global_idx","data")} - }`}else _=` - let outputIndices = ${g.offsetToIndices(`global_idx * ${a}`)}; - let inputOffset = ${h.broadcastedIndicesToOffset("outputIndices",g)}; - let data = ${g.type.value}(${h.getByOffset(`inputOffset / ${o}`)}); - ${g.setByOffset("global_idx","data")} - }`;return` - ${u.registerUniform("vec_size","u32").declareVariables(h,g)} - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} - ${_}`},p=[{type:12,data:l},...nt(r,s)];return{name:"Expand",shaderCache:{hint:`${s.length};${o}${a}`,inputDependencies:["rank"]},getShaderSource:c,getRunData:()=>({outputs:[{dims:s,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:p})}},Qf=e=>{Kf(e.inputs),e.compute(qf(e.inputs),{inputs:[0]})}}),Xf,Jf,kv=Ve(()=>{pt(),Mt(),Tt(),Zd(),Xf=e=>{let r=e[0].dataType,t=Te.size(e[0].dims),s=Te.size(e[1].dims),i=s%4===0,n=o=>{let a=$e("x",r,[1],4),l=$e("bias",r,[1],4),c=tt("y",r,[1],4),p=[{name:"output_vec_size",type:"u32"},{name:"bias_size",type:"u32"}],u=g=>` - let bias${g}_offset: u32 = (global_idx * 4 + ${g}) % uniforms.bias_size; - let bias${g} = ${l.getByOffset(`bias${g}_offset / 4`)}[bias${g}_offset % 4];`,h=i?` - let bias = ${l.getByOffset("global_idx % (uniforms.bias_size / 4)")};`:`${u(0)}${u(1)}${u(2)}${u(3)} - let bias = ${a.type.value}(bias0, bias1, bias2, bias3);`;return`${o.registerUniforms(p).declareVariables(a,l,c)} - - ${Jd(xr(r))} - - ${o.mainStart(jn)} - ${o.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_vec_size")} - - let x = ${a.getByOffset("global_idx")}; - ${h} - let x_in = x + bias; - ${c.setByOffset("global_idx",Yd("x_in"))} - }`};return{name:"FastGeluWithBias",shaderCache:{hint:`${i}`,inputDependencies:["type","type"]},getShaderSource:n,getRunData:o=>({outputs:[{dims:o[0].dims,dataType:o[0].dataType}],programUniforms:[{type:12,data:Math.ceil(t/4)},{type:12,data:s}],dispatchGroup:{x:Math.ceil(t/jn/4)}})}},Jf=e=>{e.inputs.length<2||Te.size(e.inputs[1].dims)===0?km(e):e.compute(Xf(e.inputs))}}),Yf,Zf,e_,t_,Iv=Ve(()=>{pt(),Mt(),Yt(),Tt(),Yf=e=>{if(!e||e.length!==2)throw new Error("Gather requires 2 inputs.")},Zf=(e,r)=>{let t=e[0].dims,s=e[1].dims,i=t.length,n=Te.normalizeAxis(r.axis,i),o=t.slice(0);o.splice(n,1,...s);let a=t[n],l=e[0].dataType===9?4:1,c=Math.ceil(Te.size(o)/l),p=[{type:12,data:c},{type:6,data:a},{type:12,data:n},...nt(e[0].dims,e[1].dims,o)],u=h=>{let g=$e("data",e[0].dataType,e[0].dims.length,l),_=$e("inputIndices",e[1].dataType,e[1].dims.length),P=tt("output",e[0].dataType,o.length,l),A=y=>{let k=s.length,E=`var indicesIndices${y} = ${_.type.indices}(0);`;for(let M=0;M1?`indicesIndices${y}[${M}]`:`indicesIndices${y}`} = ${o.length>1?`outputIndices${y}[uniforms.axis + ${M}]`:`outputIndices${y}`};`;E+=` - var idx${y} = ${_.getByIndices(`indicesIndices${y}`)}; - if (idx${y} < 0) { - idx${y} = idx${y} + uniforms.axisDimLimit; - } - var dataIndices${y} : ${g.type.indices}; - `;for(let M=0,w=0;M1?`dataIndices${y}[${M}]`:`dataIndices${y}`} = u32(idx${y});`,w+=k):(E+=`${i>1?`dataIndices${y}[${M}]`:`dataIndices${y}`} = ${o.length>1?`outputIndices${y}[${w}]`:`outputIndices${y}`};`,w++);return E},v;if(e[0].dataType===9){let y=(k,E,M="")=>` - let outputIndices${E} = ${P.offsetToIndices(`outputOffset + ${E}u`)}; - ${A(E)}; - let offset${E} = ${g.indicesToOffset(`dataIndices${E}`)}; - let index${E} = offset${E} / 4u; - let component${E} = offset${E} % 4u; - ${k}[${E}] = ${M}(${g.getByOffset(`index${E}`)}[component${E}]); - `;v=` - let outputOffset = global_idx * ${l}; - var value = vec4(0); - ${y("value",0,"u32")} - ${y("value",1,"u32")} - ${y("value",2,"u32")} - ${y("value",3,"u32")} - ${P.setByOffset("global_idx","value")} - `}else v=` - let outputIndices = ${P.offsetToIndices("global_idx")}; - ${A("")}; - let value = ${g.getByIndices("dataIndices")}; - ${P.setByOffset("global_idx","value")}; - `;return` - ${h.registerUniform("outputSize","u32").registerUniform("axisDimLimit","i32").registerUniform("axis","u32").declareVariables(g,_,P)} - ${h.mainStart()} - ${h.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - ${v} - }`};return{name:"Gather",shaderCache:{hint:r.cacheKey,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:o,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:p}),getShaderSource:u}},e_=e=>Dt({axis:e.axis}),t_=(e,r)=>{let t=e.inputs;Yf(t),e.compute(Zf(e.inputs,r))}}),r_,s_,n_,Av=Ve(()=>{pt(),Mt(),Tt(),r_=(e,r,t,s,i,n,o,a,l)=>{let c=[{type:12,data:n},{type:12,data:s},{type:12,data:i},{type:12,data:t},{type:12,data:o},{type:12,data:a},{type:12,data:l}],p=[n];c.push(...nt(r.dims,p));let u=h=>{let g=$e("indices_data",r.dataType,r.dims.length),_=tt("input_slice_offsets_data",12,1,1),P=[g,_],A=[{name:"output_size",type:"u32"},{name:"batch_dims",type:"u32"},{name:"input_dims",type:"u32",length:i.length},{name:"sizes_from_slice_dims_data",type:"u32",length:t.length},{name:"num_slices_per_batch",type:"u32"},{name:"input_batch_stride",type:"u32"},{name:"num_slice_dims",type:"u32"}];return` - ${h.registerUniforms(A).declareVariables(...P)} - ${h.mainStart()} - ${h.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let batch_idx = global_idx / uniforms.num_slices_per_batch; - let base_offset = batch_idx * uniforms.input_batch_stride; - - let slice_indices_base_offset = global_idx * uniforms.num_slice_dims; - var relative_slice_offset = 0; - for (var dim_idx = 0u; dim_idx < uniforms.num_slice_dims; dim_idx ++) { - var index = i32(indices_data[dim_idx + slice_indices_base_offset].x); - let input_dim_idx = uniforms.batch_dims + dim_idx; - if (index < 0) { - ${i.length===1?"index += i32(uniforms.input_dims);":"index += i32(uniforms.input_dims[input_dim_idx]);"} - } - ${t.length===1?"relative_slice_offset += index * i32(uniforms.sizes_from_slice_dims_data);":"relative_slice_offset += index * i32(uniforms.sizes_from_slice_dims_data[dim_idx]);"} - } - - input_slice_offsets_data[global_idx] = base_offset + u32(relative_slice_offset); - }`};return e.compute({name:"computeSliceOffsets",shaderCache:{hint:`${i.length}_${t.length}`,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:p,dataType:e.inputs[1].dataType}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:c}),getShaderSource:u},{inputs:[r],outputs:[-1]})[0]},s_=(e,r)=>{let t=e.inputs,s=t[0].dims,i=t[0].dataType,n=t[1].dims,o=n[n.length-1],a=Te.sizeToDimension(n,n.length-1),l=Te.sizeFromDimension(s,r.batchDims+o),c=Te.sizeToDimension(s,r.batchDims),p=Te.sizeFromDimension(s,r.batchDims),u=a/c,h=new Array(o),g=l;for(let E=0;Es.length)throw new Error("last dimension of indices must not be larger than rank of input tensor");let A=n.slice(0,-1).concat(s.slice(P)),v=Te.size(A),y=[{type:12,data:v},{type:12,data:l},...nt(t[0].dims,_.dims,A)],k=E=>{let M=$e("data",t[0].dataType,t[0].dims.length),w=$e("slice_offsets",12,_.dims.length),x=tt("output",t[0].dataType,A.length);return` - ${E.registerUniform("output_size","u32").registerUniform("slice_size","u32").declareVariables(M,w,x)} - ${E.mainStart()} - ${E.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let slice_offset = slice_offsets[global_idx / uniforms.slice_size]; - output[global_idx] = data[u32(slice_offset) + global_idx % uniforms.slice_size]; - }`};e.compute({name:"GatherND",shaderCache:{hint:r.cacheKey,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:A,dataType:i}],dispatchGroup:{x:Math.ceil(v/64)},programUniforms:y}),getShaderSource:k},{inputs:[t[0],_]})},n_=e=>({batchDims:e.batch_dims,cacheKey:""})}),i_,o_,a_,l_,Fv=Ve(()=>{pt(),Mt(),Yt(),Tt(),i_=(e,r)=>{if(e.length<3||e.length>4)throw new Error("GatherBlockQuantized requires 3 or 4 inputs.");let t=Te.normalizeAxis(r.quantizeAxis,e[0].dims.length),s=r.blockSize,i=e[0],n=e[2],o=e.length===4?e[3]:void 0;if(n.dims.length!==i.dims.length||!i.dims.map((a,l)=>l===t?Math.ceil(a/s)===n.dims[l]:a===n.dims[l]).reduce((a,l)=>a&&l,!0))throw new Error("Scales must have the same rank as the input tensor and the dims should match except on gatherAxis.");if(o){if(o.dataType!==i.dataType)throw new Error("Zero point must have the same data type as the input tensor.");if(o.dims.length!==n.dims.length||!o.dims.map((a,l)=>a===n.dims[l]).reduce((a,l)=>a&&l,!0))throw new Error("Zero point must have the same rank as the input tensor and the dims should match except on quantizeAxis.")}},o_=(e,r)=>{let t=e[0].dims,s=e[1].dims,i=t.length,n=Te.normalizeAxis(r.gatherAxis,i),o=Te.normalizeAxis(r.quantizeAxis,i),a=t.slice(0);a.splice(n,1,...s);let l=Te.size(a),c=e[2].dataType,p=e[0].dataType===22,u=[{type:12,data:l},{type:12,data:o},{type:12,data:n},{type:12,data:r.blockSize},...nt(...e.map((g,_)=>g.dims),a)],h=g=>{let _=$e("data",e[0].dataType,e[0].dims.length),P=$e("inputIndices",e[1].dataType,e[1].dims.length),A=$e("scales",e[2].dataType,e[2].dims.length),v=e.length>3?$e("zeroPoint",e[3].dataType,e[3].dims.length):void 0,y=tt("output",c,a.length),k=[_,P,A];v&&k.push(v);let E=[{name:"output_size",type:"u32"},{name:"quantize_axis",type:"u32"},{name:"gather_axis",type:"u32"},{name:"block_size",type:"u32"}];return` - ${g.registerUniforms(E).declareVariables(...k,y)} - ${g.mainStart()} - let output_indices = ${y.offsetToIndices("global_idx")}; - var indices_indices = ${P.type.indices}(0); - ${s.length>1?` - for (var i: u32 = 0; i < ${s.length}; i++) { - let index = ${y.indicesGet("output_indices","uniforms.gather_axis + i")}; - ${P.indicesSet("indices_indices","i","index")}; - }`:`indices_indices = ${y.indicesGet("output_indices","uniforms.gather_axis")};`}; - var data_indices = ${_.type.indices}(0); - for (var i: u32 = 0; i < uniforms.gather_axis; i++) { - let index = ${y.indicesGet("output_indices","i")}; - ${_.indicesSet("data_indices","i","index")}; - } - var index_from_indices = ${P.getByIndices("indices_indices")}; - if (index_from_indices < 0) { - index_from_indices += ${t[n]}; - } - ${_.indicesSet("data_indices","uniforms.gather_axis","u32(index_from_indices)")}; - for (var i = uniforms.gather_axis + 1; i < ${a.length}; i++) { - let index = ${y.indicesGet("output_indices",`i + ${s.length} - 1`)}; - ${_.indicesSet("data_indices","i","index")}; - } - let data_offset = ${_.indicesToOffset("data_indices")}; - let data_index = data_offset % 8; - // Convert 4-bit packed data to 8-bit packed data. - let packed_4bit_quantized_data = ${_.getByOffset("data_offset / 8")}; - let packed_8bit_quantized_data = (packed_4bit_quantized_data >> (4 * (data_index % 2))) & 0x0f0f0f0f; - let quantized_data_vec = ${p?"unpack4xI8":"unpack4xU8"}(u32(packed_8bit_quantized_data)); - let quantized_data = quantized_data_vec[data_index / 2]; - var scale_indices = data_indices; - let quantize_axis_index = ${A.indicesGet("data_indices","uniforms.quantize_axis")} / uniforms.block_size; - ${A.indicesSet("scale_indices","uniforms.quantize_axis","quantize_axis_index")}; - var scale = ${A.getByIndices("scale_indices")}; - ${v?` - let zero_point_indices = scale_indices; - let zero_point_offset = ${v.indicesToOffset("zero_point_indices")}; - let zero_point_index = zero_point_offset % 8; - let packed_4bit_zero_points = ${v.getByOffset("zero_point_offset / 8")}; - let packed_8bit_zero_points = (packed_4bit_zero_points >> (4 * (zero_point_index % 2))) & 0x0f0f0f0f; - let zero_point_vec = ${p?"unpack4xI8":"unpack4xU8"}(u32(packed_8bit_zero_points)); - let zero_point = zero_point_vec[zero_point_index / 2];`:"var zero_point = 0"}; - let dequantized_data = ${xr(c)}(quantized_data - zero_point) * scale; - ${y.setByOffset("global_idx","dequantized_data")}; - }`};return{name:"GatherBlockQuantized",shaderCache:{hint:`${r.cacheKey};${e.filter((g,_)=>_!==1).map(g=>g.dims.join("_")).join(";")}`,inputDependencies:Array.from({length:e.length},(g,_)=>"rank")},getRunData:()=>({outputs:[{dims:a,dataType:c}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:u}),getShaderSource:h}},a_=(e,r)=>{let t=e.inputs;i_(t,r),e.compute(o_(e.inputs,r))},l_=e=>Dt({blockSize:e.blockSize,gatherAxis:e.gatherAxis,quantizeAxis:e.quantizeAxis})}),d_,c_,u_,p_,Ov=Ve(()=>{pt(),Mt(),Yt(),Tt(),d_=e=>{if(!e||e.length!==2)throw new Error("GatherElements requires 2 inputs.");if(e[0].dims.length<1)throw new Error("GatherElements requires that the data input be rank >= 1.");if(e[0].dims.length!==e[1].dims.length)throw new Error(`GatherElements requires that the data input and - indices input tensors be of same rank.`)},c_=(e,r)=>{let t=e[0].dims,s=e[0].dataType,i=t.length,n=e[1].dims,o=e[1].dataType,a=Te.normalizeAxis(r.axis,i),l=t[a],c=n.slice(0),p=Te.size(c),u=$e("input",s,i),h=$e("indicesInput",o,n.length),g=tt("output",s,c.length),_=[{type:12,data:p},{type:6,data:l},{type:12,data:a}];return _.push(...nt(t,n,c)),{name:"GatherElements",shaderCache:{inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:c,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(p/64)},programUniforms:_}),getShaderSource:P=>` - ${P.registerUniform("outputSize","u32").registerUniform("axisDimLimit","i32").registerUniform("axis","u32").declareVariables(u,h,g)} - ${P.mainStart()} - ${P.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - - let outputIndices = ${g.offsetToIndices("global_idx")}; - - var idx = ${h.getByOffset("global_idx")}; - if (idx < 0) { - idx = idx + uniforms.axisDimLimit; - } - var inputIndices = ${u.type.indices}(outputIndices); - ${u.indicesSet("inputIndices","uniforms.axis","u32(idx)")}; - let value = ${u.getByIndices("inputIndices")}; - - ${g.setByOffset("global_idx","value")}; - }`}},u_=e=>Dt({axis:e.axis}),p_=(e,r)=>{let t=e.inputs;d_(t),e.compute(c_(e.inputs,r))}}),h_,m_,f_,__,Dv=Ve(()=>{pt(),Mt(),Tt(),h_=e=>{if(!e)throw new Error("Input is missing");if(e.length<2||e.length>3)throw new Error("Invaid input number.");if(e.length===3&&e[2].dims.length>2)throw new Error("Invalid input shape of C");if(e[0].dataType!==e[1].dataType||e.length===3&&e[0].dataType!==e[2].dataType)throw new Error("Input types are mismatched")},m_=(e,r)=>{let t=e[0].dims.slice(),s=e[1].dims.slice(),[i,n,o]=Lp.getShapeOfGemmResult(t,r.transA,s,r.transB,e.length===3?e[2].dims:void 0),a=[i,n];if(!a)throw new Error("Can't use gemm on the given tensors");let l=16,c=Math.ceil(n/l),p=Math.ceil(i/l),u=!0,h=Te.size(a),g=[{type:12,data:u?c:h},{type:12,data:i},{type:12,data:n},{type:12,data:o},{type:1,data:r.alpha},{type:1,data:r.beta}],_=["type","type"];e.length===3&&(g.push(...nt(e[2].dims)),_.push("rank")),g.push(...nt(a));let P=v=>{let y="";r.transA&&r.transB?y="value += a[k * uniforms.M + m] * b[n * uniforms.K + k];":r.transA&&!r.transB?y="value += a[k * uniforms.M + m] * b[k * uniforms.N + n];":!r.transA&&r.transB?y="value += a[m * uniforms.K + k] * b[n * uniforms.K + k];":!r.transA&&!r.transB&&(y="value += a[m * uniforms.K + k] * b[k * uniforms.N + n];");let k=r.alpha===1?"":"value *= uniforms.alpha;",E=$e("a",e[0].dataType,e[0].dims),M=$e("b",e[1].dataType,e[1].dims),w=E.type.value,x=null,$=[E,M];e.length===3&&(x=$e("c",e[2].dataType,e[2].dims.length),$.push(x));let z=tt("output",e[0].dataType,a.length);$.push(z);let R=[{name:"output_size",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"},{name:"alpha",type:"f32"},{name:"beta",type:"f32"}];return` - ${v.registerUniforms(R).declareVariables(...$)} - - ${v.mainStart()} - ${v.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let m = global_idx / uniforms.N; - let n = global_idx % uniforms.N; - - var value = ${w}(0); - for (var k: u32 = 0u; k < uniforms.K; k++) { - ${y} - } - - ${k} - ${x!=null?`let cOffset = ${x.broadcastedIndicesToOffset("vec2(m, n)",z)}; value += ${w}(uniforms.beta) * ${x.getByOffset("cOffset")};`:""} - output[global_idx] = value; - }`},A=v=>{let y=$e("a",e[0].dataType,e[0].dims),k=$e("b",e[1].dataType,e[1].dims),E=null,M=[y,k];e.length===3&&(E=$e("c",e[2].dataType,e[2].dims.length),M.push(E));let w=tt("output",e[0].dataType,a.length);M.push(w);let x=[{name:"num_tile_n",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"},{name:"alpha",type:"f32"},{name:"beta",type:"f32"}],$="",z="";r.transA&&r.transB?(z=` - var col = tile_row_start + local_id.x; - var row = k_start + local_id.y; - if (col < uniforms.M && row < uniforms.K) { - tile_a[local_id.y][local_id.x] = a[row * uniforms.M + col]; - } else { - tile_a[local_id.y][local_id.x] = ${y.type.value}(0); - } - - col = k_start + local_id.x; - row = tile_col_start + local_id.y; - if (col < uniforms.K && row < uniforms.N) { - tile_b[local_id.y][local_id.x] = b[row * uniforms.K + col]; - } else { - tile_b[local_id.y][local_id.x] = ${k.type.value}(0); - } - `,$="value += tile_a[k][local_id.y] * tile_b[local_id.x][k];"):r.transA&&!r.transB?(z=` - var col = tile_row_start + local_id.x; - var row = k_start + local_id.y; - if (col < uniforms.M && row < uniforms.K) { - tile_a[local_id.y][local_id.x] = a[row * uniforms.M + col]; - } else { - tile_a[local_id.y][local_id.x] = ${y.type.value}(0); - } - - col = tile_col_start + local_id.x; - row = k_start + local_id.y; - if (col < uniforms.N && row < uniforms.K) { - tile_b[local_id.y][local_id.x] = b[row * uniforms.N + col]; - } else { - tile_b[local_id.y][local_id.x] = ${k.type.value}(0); - } - `,$="value += tile_a[k][local_id.y] * tile_b[k][local_id.x];"):!r.transA&&r.transB?(z=` - var col = k_start + local_id.x; - var row = tile_row_start + local_id.y; - if (col < uniforms.K && row < uniforms.M) { - tile_a[local_id.y][local_id.x] = a[row * uniforms.K + col]; - } else { - tile_a[local_id.y][local_id.x] = ${y.type.value}(0); - } - - col = k_start + local_id.x; - row = tile_col_start + local_id.y; - if (col < uniforms.K && row < uniforms.N) { - tile_b[local_id.y][local_id.x] = b[row * uniforms.K + col]; - } else { - tile_b[local_id.y][local_id.x] = ${k.type.value}(0); - } - `,$="value += tile_a[local_id.y][k] * tile_b[local_id.x][k];"):!r.transA&&!r.transB&&(z=` - var col = k_start + local_id.x; - var row = tile_row_start + local_id.y; - if (col < uniforms.K && row < uniforms.M) { - tile_a[local_id.y][local_id.x] = a[row * uniforms.K + col]; - } else { - tile_a[local_id.y][local_id.x] = ${y.type.value}(0); - } - - col = tile_col_start + local_id.x; - row = k_start + local_id.y; - if (col < uniforms.N && row < uniforms.K) { - tile_b[local_id.y][local_id.x] = b[row * uniforms.N + col]; - } else { - tile_b[local_id.y][local_id.x] = ${k.type.value}(0); - } - `,$="value += tile_a[local_id.y][k] * tile_b[k][local_id.x];");let R=r.alpha===1?"":"value *= uniforms.alpha;";return` - ${v.registerUniforms(x).declareVariables(...M)} - var tile_a: array, ${l}>; - var tile_b: array, ${l}>; - ${v.mainStart([l,l,1])} - let tile_col_start = (workgroup_index % uniforms.num_tile_n) * ${l}; - let tile_row_start = (workgroup_index / uniforms.num_tile_n) * ${l}; - let num_tiles = (uniforms.K - 1) / ${l} + 1; - var k_start = 0u; - var value = ${w.type.value}(0); - for (var t: u32 = 0u; t < num_tiles; t++) { - ${z} - k_start = k_start + ${l}; - workgroupBarrier(); - - for (var k: u32 = 0u; k < ${l}; k++) { - ${$} - } - workgroupBarrier(); - } - - ${R} - let m = tile_row_start + local_id.y; - let n = tile_col_start + local_id.x; - ${E!=null?`let cOffset = ${E.broadcastedIndicesToOffset("vec2(m, n)",w)}; value += ${w.type.value}(uniforms.beta) * ${E.getByOffset("cOffset")};`:""} - if (m < uniforms.M && n < uniforms.N) { - output[m * uniforms.N + n] = value; - } - }`};return u?{name:"GemmShared",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:a,dataType:e[0].dataType}],dispatchGroup:{x:c*p},programUniforms:g}),getShaderSource:A}:{name:"Gemm",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:a,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(h/64)},programUniforms:g}),getShaderSource:P}},f_=e=>{let r=e.transA,t=e.transB,s=e.alpha,i=e.beta;return{transA:r,transB:t,alpha:s,beta:i,cacheKey:`${e.transA};${e.transB};${e.alpha===1}`}},__=(e,r)=>{h_(e.inputs),e.compute(m_(e.inputs,r))}}),vs,As,Mn,bn,g_,w_,y_,M_,b_,v_,T_,x_,E_,P_,Lv=Ve(()=>{pt(),Mt(),Yt(),Tt(),[vs,As,Mn,bn]=[0,1,2,3],g_=e=>{if(e[0].dims.length!==4)throw new Error("only 4-D tensor is supported.");if(e[0].dims.length!==e[1].dims.length)throw new Error("input dimensions must be equal to grid dimensions");if(e[0].dims.length-2!==e[1].dims[e[1].dims.length-1])throw new Error(`last dimension of grid must be equal to ${e[0].dims.length-2}`);if(e[0].dims[0]!==e[1].dims[0])throw new Error("grid batch size must match input batch size")},w_=` - fn gs_get_cubic_coeffs(x: f32) -> vec4 { - let cubic_alpha = -0.75f; - let x_abs = abs(x); - var coeffs: vec4; - coeffs[0] = (((cubic_alpha * (x_abs + 1) - 5 * cubic_alpha) * (x_abs + 1) + 8 * cubic_alpha) * (x_abs + 1) - 4 * cubic_alpha); - coeffs[1] = (((cubic_alpha + 2) * x_abs - (cubic_alpha + 3)) * x_abs * x_abs + 1); - coeffs[2] = (((cubic_alpha + 2) * (1 - x_abs) - (cubic_alpha + 3)) * (1 - x_abs) * (1 - x_abs) + 1); - coeffs[3] = (((cubic_alpha * (2 - x_abs) - 5 * cubic_alpha) * (2 - x_abs) + 8 * cubic_alpha) * (2 - x_abs) - 4 * cubic_alpha); - return coeffs; - } -`,y_=e=>` - fn gs_bicubic_interpolate(p: mat4x4<${e}>, x: f32, y: f32) -> ${e} { - var v: vec4; - var coeffs = gs_get_cubic_coeffs(x); - for (var i = 0; i < 4; i++) { - v[i] = coeffs[0] * p[i][0] + coeffs[1] * p[i][1] + coeffs[2] * p[i][2] + coeffs[3] * p[i][3]; - } - coeffs = gs_get_cubic_coeffs(y); - let pixel = ${e}(coeffs[0] * v[0] + coeffs[1] * v[1] + coeffs[2] * v[2] + coeffs[3] * v[3]); - return pixel; - } -`,M_=e=>` - fn gs_denormalize(n: f32, length: i32) -> f32 { - ${e.alignCorners===0?` - // alignCorners: false => [-1, 1] to [-0.5, length - 0.5] - return ((n + 1.0) * f32(length) - 1.0) / 2.0; - `:` - // alignCorners: true => [-1, 1] to [0, length - 1] - return (n + 1.0) / 2.0 * (f32(length - 1)); - `} - } -`,b_=e=>` - ${e.paddingMode==="reflection"?` - fn gs_reflect(x: i32, x_min: f32, x_max: f32) -> u32 { - var dx = 0.0; - var fx = f32(x); - let range = x_max - x_min; - if (fx < x_min) { - dx = x_min - fx; - let n = u32(dx / range); - let r = dx - f32(n) * range; - if (n % 2 == 0) { - fx = x_min + r; - } else { - fx = x_max - r; - } - } else if (fx > x_max) { - dx = fx - x_max; - let n = u32(dx / range); - let r = dx - f32(n) * range; - if (n % 2 == 0) { - fx = x_max - r; - } else { - fx = x_min + r; - } - } - return u32(fx); - }`:""} -`,v_=(e,r,t)=>` - fn pixel_at_grid(r: i32, c: i32, H: i32, W: i32, batch: u32, channel: u32, border: vec4) -> ${r} { - var pixel = ${r}(0); - var indices = vec4(0); - indices[${vs}] = batch; - indices[${As}] = channel;`+(()=>{switch(t.paddingMode){case"zeros":return` - if (r >= 0 && r < H && c >=0 && c < W) { - indices[${Mn}] = u32(r); - indices[${bn}] = u32(c); - } - `;case"border":return` - indices[${Mn}] = u32(clamp(r, 0, H - 1)); - indices[${bn}] = u32(clamp(c, 0, W - 1)); - `;case"reflection":return` - indices[${Mn}] = gs_reflect(r, border[1], border[3]); - indices[${bn}] = gs_reflect(c, border[0], border[2]); - `;default:throw new Error(`padding mode ${t.paddingMode} is not supported`)}})()+` - return ${e.getByIndices("indices")}; - } -`,T_=(e,r,t)=>(()=>{switch(t.mode){case"nearest":return` - let result = pixel_at_grid(i32(round(y)), i32(round(x)), H_in, W_in, indices[${vs}], indices[${As}], border); - `;case"bilinear":return` - let x1 = i32(floor(x)); - let y1 = i32(floor(y)); - let x2 = x1 + 1; - let y2 = y1 + 1; - - let p11 = pixel_at_grid(y1, x1, H_in, W_in, indices[${vs}], indices[${As}], border); - let p12 = pixel_at_grid(y1, x2, H_in, W_in, indices[${vs}], indices[${As}], border); - let p21 = pixel_at_grid(y2, x1, H_in, W_in, indices[${vs}], indices[${As}], border); - let p22 = pixel_at_grid(y2, x2, H_in, W_in, indices[${vs}], indices[${As}], border); - - let dx2 = ${r}(f32(x2) - x); - let dx1 = ${r}(x - f32(x1)); - let dy2 = ${r}(f32(y2) - y); - let dy1 = ${r}(y - f32(y1)); - let result = dy2 * (dx2 * p11 + dx1 * p12) + dy1 * (dx2 * p21 + dx1 * p22); - `;case"bicubic":return` - let x0 = i32(floor(x)) - 1; - let y0 = i32(floor(y)) - 1; - var p: mat4x4<${r}>; - for (var h = 0; h < 4; h++) { - for (var w = 0; w < 4; w++) { - p[h][w] = pixel_at_grid(h + y0, w + x0, H_in, W_in, indices[${vs}], indices[${As}], border); - } - } - - let dx = x - f32(x0 + 1); - let dy = y - f32(y0 + 1); - let result = gs_bicubic_interpolate(p, dx, dy); - `;default:throw new Error(`mode ${t.mode} is not supported`)}})()+`${e.setByOffset("global_idx","result")}`,x_=(e,r)=>{let t=$e("x",e[0].dataType,e[0].dims.length),s=[e[1].dims[0],e[1].dims[1],e[1].dims[2]],i=$e("grid",e[1].dataType,s.length,2),n=[e[0].dims[0],e[0].dims[1],e[1].dims[1],e[1].dims[2]];r.format==="NHWC"&&(n=[e[0].dims[0],e[1].dims[1],e[1].dims[2],e[0].dims[3]],[vs,As,Mn,bn]=[0,3,1,2]);let o=tt("output",e[0].dataType,n.length),a=t.type.value,l=Te.size(n),c=[{type:12,data:l},...nt(e[0].dims,s,n)],p=u=>` - ${u.registerUniform("output_size","u32").declareVariables(t,i,o)} - ${w_} - ${y_(a)} - ${M_(r)} - ${b_(r)} - ${v_(t,a,r)} - - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let H_in = i32(uniforms.x_shape[${Mn}]); - let W_in = i32(uniforms.x_shape[${bn}]); - - ${r.alignCorners===0?` - let x_min = -0.5; - let x_max = f32(W_in) - 0.5; - let y_min = -0.5; - let y_max = f32(H_in) - 0.5; - `:` - let x_min = 0.0; - let x_max = f32(W_in) - 1.0; - let y_min = 0.0; - let y_max = f32(H_in) - 1.0; - `}; - let border = vec4(x_min, y_min, x_max, y_max); - - let indices = ${o.offsetToIndices("global_idx")}; - var grid_indices = vec3(indices[${vs}], indices[${Mn}], indices[${bn}]); - let nxy = ${i.getByIndices("grid_indices")}; - var x = gs_denormalize(f32(nxy[0]), W_in); - var y = gs_denormalize(f32(nxy[1]), H_in); - - ${T_(o,a,r)} - }`;return{name:"GridSample",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:["type","type"]},getRunData:u=>{let h=Te.size(n);return{outputs:[{dims:n,dataType:u[0].dataType}],dispatchGroup:{x:Math.ceil(h/64)},programUniforms:c}},getShaderSource:p}},E_=(e,r)=>{g_(e.inputs),e.compute(x_(e.inputs,r))},P_=e=>Dt({alignCorners:e.align_corners,mode:e.mode,paddingMode:e.padding_mode,format:e.format})}),$r,C_,S_,wc,$_,Ri,k_,I_=Ve(()=>{pt(),Mt(),Yt(),Bd(),Qd(),Tt(),Ks(),$r=(e,r)=>e.length>r&&e[r].dims.length>0?e[r]:void 0,C_=(e,r)=>{let t=e[0],s=$r(e,1),i=$r(e,2),n=$r(e,3),o=$r(e,4),a=$r(e,5),l=$r(e,6),c=$r(e,7);if(t.dims.length!==3&&t.dims.length!==5)throw new Error("Input query is expected to have 3 or 5 dimensions");let p=t.dims[0],u=t.dims[1],h=t.dims.length===3?t.dims[2]:r.numHeads*t.dims[4],g=u,_=0,P=0,A=Math.floor(h/r.numHeads);if(l&&c&&Te.size(l.dims)&&Te.size(c.dims)){if(l.dims.length!==4)throw new Error('Input "past_key" is expected to have 4 dimensions');if(l.dims[0]!==p||l.dims[1]!==r.numHeads||l.dims[3]!==A)throw new Error('Input "past_key" shape (batch_size, num_heads, past_sequence_length, head_size)');if(c.dims[0]!==p||c.dims[1]!==r.numHeads||c.dims[3]!==A)throw new Error('Input "past_value" shape (batch_size, num_heads, past_sequence_length, head_size)');if(l.dims[2]!==c.dims[2])throw new Error('Input "past_key" and "past_value" shall have same dim 2 (past_sequence_length)');if(c.dims.length!==4)throw new Error('Input "past_value" is expected to have 4 dimensions');_=l.dims[2],P=l.dims[2]}else if(l&&Te.size(l.dims)||c&&Te.size(c.dims))throw new Error('Input "past_key" and "past_value" shall be both present or both absent');let v;if(s&&Te.size(s.dims)>0){if(t.dims.length!==3)throw new Error('Input "query" is expected to have 3 dimensions when key is given');if(s.dims.length<3||s.dims.length>5)throw new Error('Input "key" is expected to have 3, 4, or 5 dimensions');if(t.dims[0]!==s.dims[0])throw new Error('Input "query" and "key" shall have same dim 0 (batch size)');if(s.dims.length===3){if(s.dims[2]!==t.dims[2])throw new Error('Input "query" and "key" shall have same dim 2 (hidden_size)');v=2,g=s.dims[1]}else if(s.dims.length===5){if(s.dims[2]!==r.numHeads||s.dims[3]!==2||s.dims[4]!==A)throw new Error('Expect "key" shape (batch_size, kv_sequence_length, num_heads, 2, head_size) for packed kv');if(i)throw new Error('Expect "value" be none when "key" has packed kv format.');v=5,g=s.dims[1]}else{if(s.dims[1]!==r.numHeads||s.dims[3]!==A)throw new Error('Expect "key" shape (batch_size, num_heads, kv_sequence_length, head_size) for past_key');v=0,g=s.dims[2]}}else{if(t.dims.length!==5)throw new Error('Input "query" is expected to have 5 dimensions when key is empty');if(t.dims[2]!==r.numHeads||t.dims[3]!==3)throw new Error('Expect "query" shape (batch_size, kv_sequence_length, num_heads, 3, head_size) for packed kv');v=3}if(n&&Te.size(n.dims)>0){if(n.dims.length!==1)throw new Error('Input "bias" is expected to have 1 dimension');if(s&&s.dims.length===5&&s.dims[3]===2)throw new Error("bias is not allowed for packed kv.")}let y=_+g,k=0;if(o&&Te.size(o.dims)>0){k=8;let x=o.dims;throw x.length===1?x[0]===p?k=1:x[0]===3*p+2&&(k=3):x.length===2&&x[0]===p&&x[1]===y&&(k=5),k===8?new Error('Input "key_padding_mask" shape shall be (batch_size) or (batch_size, total_sequence_length)'):new Error("Mask not supported")}let E=!1,M=h;if(i&&Te.size(i.dims)>0){if(i.dims.length!==3&&i.dims.length!==4)throw new Error('Input "value" is expected to have 3 or 4 dimensions');if(t.dims[0]!==i.dims[0])throw new Error('Input "query" and "value" shall have same dim 0 (batch_size)');if(i.dims.length===3){if(g!==i.dims[1])throw new Error('Input "key" and "value" shall have the same dim 1 (kv_sequence_length)');M=i.dims[2]}else{if(g!==i.dims[2])throw new Error('Input "key" and "value" shall have the same dim 2 (kv_sequence_length)');M=i.dims[1]*i.dims[3],E=!0}}let w=!1;if(o&&Te.size(o.dims)>0)throw new Error("Key padding mask is not supported");if(a&&Te.size(a.dims)>0){if(a.dims.length!==4)throw new Error('Input "attention_bias" is expected to have 4 dimensions');if(a.dims[0]!==p||a.dims[1]!==r.numHeads||a.dims[2]!==u||a.dims[3]!==y)throw new Error('Expect "attention_bias" shape (batch_size, num_heads, sequence_length, total_sequence_length)')}return{batchSize:p,sequenceLength:u,pastSequenceLength:_,kvSequenceLength:g,totalSequenceLength:y,maxSequenceLength:P,inputHiddenSize:0,hiddenSize:h,vHiddenSize:M,headSize:A,vHeadSize:Math.floor(M/r.numHeads),numHeads:r.numHeads,isUnidirectional:!1,pastPresentShareBuffer:!1,maskFilterValue:r.maskFilterValue,maskType:k,scale:r.scale,broadcastResPosBias:w,passPastInKv:E,qkvFormat:v}},S_=e=>Dt({...e}),wc=Dt({perm:[0,2,1,3]}),$_=(e,r,t,s,i,n,o)=>{let a=[s,i,n],l=Te.size(a),c=[{type:12,data:l},{type:12,data:o},{type:12,data:n}],p=u=>{let h=tt("qkv_with_bias",r.dataType,a),g=$e("qkv",r.dataType,a),_=$e("bias",t.dataType,a),P=[{name:"output_size",type:"u32"},{name:"bias_offset",type:"u32"},{name:"hidden_size",type:"u32"}];return` - ${u.registerUniforms(P).declareVariables(g,_,h)} - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let bias_offset_idx = (global_idx % uniforms.hidden_size) + uniforms.bias_offset; - - qkv_with_bias[global_idx] = qkv[global_idx] + bias[bias_offset_idx]; - }`};return e.compute({name:"MultiHeadAttentionAddBias",shaderCache:{inputDependencies:["type","type"]},getRunData:()=>({outputs:[{dims:a,dataType:r.dataType,gpuDataType:0}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:c}),getShaderSource:p},{inputs:[r,t],outputs:[-1]})[0]},Ri=(e,r,t,s,i,n,o,a)=>{let l=n;if(o&&Te.size(o.dims)>0){if(s===1)throw new Error("AddBiasReshape is not implemented. Please export your model with packed QKV or KV");return l=$_(e,n,o,r,s,t*i,a),l=l.reshape([r,s,t,i]),t===1||s===1?l:e.compute(Nr(l,wc.perm),{inputs:[l],outputs:[-1]})[0]}else return n.dims.length===3&&(l=n.reshape([r,s,t,i])),t===1||s===1?l:e.compute(Nr(l,wc.perm),{inputs:[l],outputs:[-1]})[0]},k_=(e,r)=>{let t=C_(e.inputs,r),s=e.inputs[0],i=$r(e.inputs,1),n=$r(e.inputs,2),o=$r(e.inputs,3),a=$r(e.inputs,4),l=$r(e.inputs,5),c=$r(e.inputs,6),p=$r(e.inputs,7);if(s.dims.length===5)throw new Error("Packed QKV is not implemented");if((i==null?void 0:i.dims.length)===5)throw new Error("Packed KV is not implemented");let u=i&&n&&i.dims.length===4&&n.dims.length===4,h=Ri(e,t.batchSize,t.numHeads,t.sequenceLength,t.headSize,s,o,0);if(u)return Oi(e,h,i,n,a,void 0,c,p,l,t);if(!i||!n)throw new Error("key and value must be provided");let g=Ri(e,t.batchSize,t.numHeads,t.kvSequenceLength,t.headSize,i,o,t.hiddenSize),_=Ri(e,t.batchSize,t.numHeads,t.kvSequenceLength,t.vHeadSize,n,o,2*t.hiddenSize);Oi(e,h,g,_,a,void 0,c,p,l,t)}}),A_,F_,O_,D_,yc,L_,z_,B_=Ve(()=>{pt(),Mt(),Yt(),Tt(),A_=e=>{if(!e||e.length<1)throw new Error("too few inputs")},F_=(e,r)=>{let t=[],s=r.numOutputs;return e[1].dims[0]>0&&(e[1].getBigInt64Array().forEach(i=>t.push(Number(i))),s=t.length),Dt({numOutputs:s,axis:r.axis,splitSizes:t})},O_=e=>` -fn calculateOutputIndex(index: u32) -> u32 { - for (var i: u32 = 0u; i < ${e}u; i += 1u ) { - if (index < ${rt("uniforms.size_in_split_axis","i",e)}) { - return i; - } - } - return ${e}u; -}`,D_=e=>{let r=e.length,t=[];for(let s=0;s{let t=e[0].dims,s=Te.size(t),i=e[0].dataType,n=Te.normalizeAxis(r.axis,t.length),o=new Array(r.numOutputs),a=$e("input",i,t.length),l=new Array(r.numOutputs),c=[],p=[],u=0,h=[{type:12,data:s}];for(let _=0;_` - ${_.registerUniform("input_size","u32").registerUniform("size_in_split_axis","u32",l.length).declareVariables(a,...o)} - ${O_(l.length)} - ${D_(o)} - - ${_.mainStart()} - ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.input_size")} - - var indices = ${a.offsetToIndices("global_idx")}; - var index = ${a.indicesGet("indices",n)}; - let output_number = calculateOutputIndex(index); - if (output_number != 0) { - index -= ${rt("uniforms.size_in_split_axis","output_number - 1u",l.length)}; - ${a.indicesSet("indices",n,"index")}; - } - writeBufferData(output_number, indices, global_idx); - }`;return{name:"Split",shaderCache:{hint:r.cacheKey,inputDependencies:["rank"]},getShaderSource:g,getRunData:()=>({outputs:c,dispatchGroup:{x:Math.ceil(s/64)},programUniforms:h})}},L_=(e,r)=>{A_(e.inputs);let t=e.inputs.length===1?r:F_(e.inputs,r);e.compute(yc(e.inputs,t),{inputs:[0]})},z_=e=>{let r=e.axis,t=e.splitSizes,s=e.numOutputs<0?t.length:e.numOutputs;if(s!==t.length)throw new Error("numOutputs and splitSizes lengh must be equal");return Dt({axis:r,numOutputs:s,splitSizes:t})}}),R_,N_,Mc,j_,zv=Ve(()=>{Yt(),Qd(),I_(),B_(),Ks(),R_=(e,r)=>{if(r.doRotary)throw new Error("GroupQuerryAttention do_rotary attribute is not supported");if(r.doRotary&&e.length<=7)throw new Error("cos_cache and sin_cache inputs are required if do_rotary is specified");let t=e[0],s=e[1],i=e[2],n=e[3],o=e[4];if(r.localWindowSize!==-1)throw new Error("Local attention is not supported");if(r.softcap!==0)throw new Error("Softcap is not supported");if(r.rotaryInterleaved!==0)throw new Error("Rotary interleaved is not supported");if(r.smoothSoftmax)throw new Error("Smooth softmax is not supported");if(t.dims.length!==3&&t.dims.length!==5)throw new Error("Input query is expected to have 3 or 5 dimensions");let a=!1,l=t.dims[0],c=t.dims[1],p=t.dims.length===3?a?t.dims[2]/3:t.dims[2]:r.numHeads*t.dims[4],u=c,h=0,g=!s||s.dims.length===0,_=Math.floor(g?p/(r.numHeads+2*r.kvNumHeads):p/r.numHeads);g&&(p=_*r.numHeads);let P=n&&n.dims.length!==0,A=o&&o.dims.length!==0;if(P&&n.dims.length===4&&n.dims[0]===l&&n.dims[1]!==r.kvNumHeads&&n.dims[2]===r.kvNumHeads&&n.dims[3]===_)throw new Error("BSNH pastKey/pastValue is not supported");if(P&&A){if(n.dims.length!==4)throw new Error('Input "past_key" is expected to have 4 dimensions');if(o.dims.length!==4)throw new Error('Input "past_value" is expected to have 4 dimensions');h=n.dims[2]}else if(P||A)throw new Error('Input "past_key" and "past_value" shall be both present or both absent');let v=1;if(s&&s.dims.length>0){if(t.dims.length!==3)throw new Error('Input "query" is expected to have 3 dimensions when key is given');if(s.dims.length<3||s.dims.length>5)throw new Error('Input "key" is expected to have 3, 4, or 5 dimensions');if(t.dims[0]!==s.dims[0])throw new Error('Input "query" and "key" shall have same dim 0 (batch size)');if(s.dims.length===3){if(t.dims[2]%s.dims[2]!==0)throw new Error('Dimension 2 of "query" should be a multiple of "key"');u=s.dims[1]}else if(s.dims.length===5){if(s.dims[2]!==r.numHeads||s.dims[3]!==2||s.dims[4]!==_)throw new Error('Expect "key" shape (batch_size, kv_sequence_length, num_heads, 2, head_size) for packed kv');if(i)throw new Error('Expect "value" be none when "key" has packed kv format.');u=s.dims[1]}else{if(s.dims[1]!==r.numHeads||s.dims[3]!==_)throw new Error('Expect "key" shape (batch_size, num_heads, kv_sequence_length, head_size) for past_key');u=s.dims[2]}}else{if(t.dims.length!==3&&t.dims.length!==5)throw new Error('Input "query" is expected to have 3 or 5 dimensions when key is empty');if(t.dims.length===5&&(t.dims[2]!==r.numHeads||t.dims[3]!==3))throw new Error('Expect "query" shape (batch_size, kv_sequence_length, num_heads, 3, head_size) for packed kv');v=3}let y=0,k=!1,E=r.kvNumHeads?_*r.kvNumHeads:p;if(i&&i.dims.length>0){if(i.dims.length!==3&&i.dims.length!==4)throw new Error('Input "value" is expected to have 3 or 4 dimensions');if(t.dims[0]!==i.dims[0])throw new Error('Input "query" and "value" shall have same dim 0 (batch_size)');if(i.dims.length===3){if(u!==i.dims[1])throw new Error('Input "key" and "value" shall have the same dim 1 (kv_sequence_length)');E=i.dims[2]}else{if(u!==i.dims[2])throw new Error('Input "past_key" and "past_value" shall have the same dim 2 (kv_sequence_length)');E=i.dims[1]*i.dims[3],k=!0}}let M=e.length>4?e[5]:void 0;if(M&&M.dims.length!==1&&M.dims[0]!==l)throw new Error('Input "seqlens" is expected to have 1 dimension and the same dim 0 as batch_size');return{batchSize:l,sequenceLength:c,pastSequenceLength:h,kvSequenceLength:u,totalSequenceLength:-1,maxSequenceLength:-1,inputHiddenSize:0,hiddenSize:p,vHiddenSize:E,headSize:_,vHeadSize:Math.floor(E/r.kvNumHeads),numHeads:r.numHeads,kvNumHeads:r.kvNumHeads,nReps:r.numHeads/r.kvNumHeads,pastPresentShareBuffer:!1,maskType:y,scale:r.scale,broadcastResPosBias:!1,passPastInKv:k,qkvFormat:v}},N_=Dt({perm:[0,2,1,3]}),Mc=(e,r,t)=>{let s=r,i=t.kvNumHeads;return r.dims.length===3&&t.kvSequenceLength!==0&&(s=r.reshape([t.batchSize,t.kvSequenceLength,i,t.headSize]),s=e.compute(Nr(s,N_.perm),{inputs:[s],outputs:[-1]})[0]),s},j_=(e,r)=>{var A;let t=R_(e.inputs,r);if(e.inputs[0].dims.length===5)throw new Error("Packed QKV is not implemented");if(((A=e.inputs[1])==null?void 0:A.dims.length)===5)throw new Error("Packed KV is not implemented");let s=e.inputs[0],i=e.inputs[1]&&e.inputs[1].dims.length>0?e.inputs[1]:void 0,n=e.inputs[2]&&e.inputs[2].dims.length>0?e.inputs[2]:void 0,o=e.inputs[3]&&e.inputs[3].dims.length!==0?e.inputs[3]:void 0,a=e.inputs[4]&&e.inputs[4].dims.length!==0?e.inputs[4]:void 0,l=e.inputs.length>4?e.inputs[5]:void 0,c=e.inputs.length>5?e.inputs[6]:void 0,p=t.kvNumHeads?t.kvNumHeads:t.numHeads,u=Dt({axis:2,numOutputs:3,splitSizes:[t.numHeads*t.headSize,p*t.headSize,p*t.headSize]}),[h,g,_]=!i&&!n?e.compute(yc([s],u),{inputs:[s],outputs:[-1,-1,-1]}):[s,i,n],P=Ri(e,t.batchSize,t.numHeads,t.sequenceLength,t.headSize,h,void 0,0);Oi(e,P,Mc(e,g,t),Mc(e,_,t),void 0,void 0,o,a,void 0,t,l,c)}}),bc,V_,U_,W_,Bv=Ve(()=>{pt(),Mt(),Ks(),Tt(),bc=(e,r,t,s,i,n,o,a)=>{let l=Xt(n),c=l===1?"f32":`vec${l}f`,p=l===1?"vec2f":`mat2x${l}f`,u=i*o,h=64;u===1&&(h=256);let g=[i,o,n/l],_=[i,o,2],P=["rank","type","type"],A=[];A.push(...nt(g,_));let v=y=>{let k=$e("x",r.dataType,3,l),E=$e("scale",t.dataType,t.dims),M=$e("bias",s.dataType,s.dims),w=tt("output",1,3,2),x=[k,E,M,w];return` - var workgroup_shared : array<${p}, ${h}>; - const workgroup_size = ${h}u; - ${y.declareVariables(...x)} - ${y.mainStart(h)} - let batch = workgroup_index / uniforms.x_shape[1]; - let channel = workgroup_index % uniforms.x_shape[1]; - let hight = uniforms.x_shape[2]; - // initialize workgroup memory - var sum = ${c}(0); - var squared_sum = ${c}(0); - for (var h = local_idx; h < hight; h += workgroup_size) { - let value = ${c}(${k.get("batch","channel","h")}); - sum += value; - squared_sum += value * value; - } - workgroup_shared[local_idx] = ${p}(sum, squared_sum); - workgroupBarrier(); - - for (var currSize = workgroup_size >> 1; currSize > 0; currSize = currSize >> 1) { - if (local_idx < currSize) { - workgroup_shared[local_idx] = workgroup_shared[local_idx] + workgroup_shared[local_idx + currSize]; - } - workgroupBarrier(); - } - if (local_idx == 0) { - let sum_final = ${Gs("workgroup_shared[0][0]",l)} / f32(hight * ${l}); - let squared_sum_final = ${Gs("workgroup_shared[0][1]",l)} / f32(hight * ${l}); - - let inv_std_dev = inverseSqrt(squared_sum_final - sum_final * sum_final + f32(${a})); - let channel_scale = inv_std_dev * f32(scale[channel]); - let channel_shift = f32(bias[channel]) - sum_final * channel_scale; - output[workgroup_index] = vec2f(channel_scale, channel_shift); - } - }`};return e.compute({name:"InstanceNormComputeChannelScaleShift",shaderCache:{hint:`${l};${a};${h}`,inputDependencies:P},getRunData:()=>({outputs:[{dims:_,dataType:1}],dispatchGroup:{x:u},programUniforms:A}),getShaderSource:v},{inputs:[r,t,s],outputs:[-1]})[0]},V_=(e,r,t)=>{let s=r[0].dims,i=s,n=2,o=s[0],a=s[1],l=Te.sizeFromDimension(s,n),c=Xt(l),p=Te.size(i)/c,u=bc(e,r[0],r[1],r[2],o,l,a,t.epsilon),h=[o,a,l/c],g=[o,a],_=["type","none"],P=A=>{let v=$e("x",r[0].dataType,h.length,c),y=$e("scale_shift",1,g.length,2),k=tt("output",r[0].dataType,h.length,c),E=[v,y,k];return` - ${A.registerUniform("output_size","u32").declareVariables(...E)} - ${A.mainStart()} - ${A.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let outputIndices = ${k.offsetToIndices("global_idx")}; - let batch = outputIndices[0]; - let channel = outputIndices[1]; - let scale_shift = ${y.getByIndices("vec2(batch, channel)")}; - let value = ${v.getByOffset("global_idx")} * ${k.type.value}(scale_shift.x) + ${k.type.value}(scale_shift.y); - ${k.setByOffset("global_idx","value")}; - }`};e.compute({name:"InstanceNormalization",shaderCache:{hint:`${c}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:i,dataType:r[0].dataType}],dispatchGroup:{x:Math.ceil(p/64)},programUniforms:[{type:12,data:p},...nt(h,g,h)]}),getShaderSource:P},{inputs:[r[0],u]})},U_=(e,r,t)=>{let s=r[0].dims,i=s,n=s[0],o=s[s.length-1],a=Te.sizeFromDimension(s,1)/o,l=Xt(o),c=Te.size(i)/l,p=[{type:12,data:a},{type:12,data:Math.floor(o/l)}],u=["type","type"],h=!1,g=[0,s.length-1];for(let v=0;vs[g[y]])),P=bc(e,_,r[1],r[2],n,a,o,t.epsilon),A=v=>{let y=lr(r[0].dataType),k=l===1?"vec2f":`mat${l}x2f`,E=x=>{let $=x===0?"x":"y",z=l===1?"f32":`vec${l}f`;switch(l){case 1:return`${y}(${z}(scale.${$}))`;case 2:return`vec2<${y}>(${z}(scale[0].${$}, scale[1].${$}))`;case 4:return`vec4<${y}>(${z}(scale[0].${$}, scale[1].${$}, scale[2].${$}, scale[3].${$}))`;default:throw new Error(`Not supported compoents ${l}`)}},M=$e("input",r[0].dataType,r[0].dims,l),w=tt("output",r[0].dataType,i,l);return` - @group(0) @binding(0) var input : array<${M.type.storage}>; - @group(0) @binding(1) var scale_input : array<${k}>; - @group(0) @binding(2) var output : array<${w.type.storage}>; - struct Uniforms {H: u32, C : u32}; - @group(0) @binding(3) var uniforms: Uniforms; - - ${v.mainStart()} - let current_image_number = global_idx / (uniforms.C * uniforms.H); - let current_channel_number = global_idx % uniforms.C; - - let scale_offset = current_image_number * uniforms.C + current_channel_number; - let scale = scale_input[scale_offset]; - output[global_idx] = fma(input[global_idx], ${E(0)}, ${E(1)}); - }`};e.compute({name:"InstanceNormalizationNHWC",shaderCache:{hint:`${l}`,inputDependencies:u},getRunData:()=>({outputs:[{dims:i,dataType:r[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:p}),getShaderSource:A},{inputs:[r[0],P]})},W_=(e,r)=>{r.format==="NHWC"?U_(e,e.inputs,r):V_(e,e.inputs,r)}}),G_,K_,H_,Rv=Ve(()=>{pt(),Mt(),Tt(),G_=e=>{if(!e||e.length<2)throw new Error("layerNorm requires at least 2 inputs.")},K_=(e,r,t)=>{let s=r.simplified,i=e[0].dims,n=e[1],o=!s&&e[2],a=i,l=Te.normalizeAxis(r.axis,i.length),c=Te.sizeToDimension(i,l),p=Te.sizeFromDimension(i,l),u=Te.size(n.dims),h=o?Te.size(o.dims):0;if(u!==p||o&&h!==p)throw new Error(`Size of X.shape()[axis:] == ${p}. - Size of scale and bias (if provided) must match this. - Got scale size of ${u} and bias size of ${h}`);let g=[];for(let M=0;M1,y=t>2,k=M=>{let w=lr(e[0].dataType),x=[$e("x",e[0].dataType,e[0].dims,_),$e("scale",n.dataType,n.dims,_)];o&&x.push($e("bias",o.dataType,o.dims,_)),x.push(tt("output",e[0].dataType,a,_)),v&&x.push(tt("mean_data_output",1,g)),y&&x.push(tt("inv_std_output",1,g));let $=[{name:"norm_count",type:"u32"},{name:"norm_size",type:"f32"},{name:"norm_size_vectorized",type:"u32"},{name:"epsilon",type:"f32"}];return` - ${M.registerUniforms($).declareVariables(...x)} - ${M.mainStart()} - ${M.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.norm_count")} - let offset = global_idx * uniforms.norm_size_vectorized; - var mean_vector = ${Vd("f32",_)}; - var mean_square_vector = ${Vd("f32",_)}; - - for (var h: u32 = 0u; h < uniforms.norm_size_vectorized; h++) { - let value = ${Vn(w,_,"x[h + offset]")}; - mean_vector += value; - mean_square_vector += value * value; - } - let mean = ${Gs("mean_vector",_)} / uniforms.norm_size; - let inv_std_dev = inverseSqrt(${Gs("mean_square_vector",_)} / uniforms.norm_size ${s?"":"- mean * mean"} + uniforms.epsilon); - - for (var j: u32 = 0; j < uniforms.norm_size_vectorized; j++) { - let f32input = ${Vn(w,_,"x[j + offset]")}; - let f32scale = ${Vn(w,_,"scale[j]")}; - output[j + offset] = ${x[0].type.value}((f32input ${s?"":"- mean"}) * inv_std_dev * f32scale - ${o?`+ ${Vn(w,_,"bias[j]")}`:""} - ); - } - - ${v?"mean_data_output[global_idx] = mean":""}; - ${y?"inv_std_output[global_idx] = inv_std_dev":""}; - }`},E=[{dims:a,dataType:e[0].dataType}];return v&&E.push({dims:g,dataType:1}),y&&E.push({dims:g,dataType:1}),{name:"LayerNormalization",shaderCache:{hint:`${_};${t};${s}`,inputDependencies:P},getRunData:()=>({outputs:E,dispatchGroup:{x:Math.ceil(c/64)},programUniforms:A}),getShaderSource:k}},H_=(e,r)=>{G_(e.inputs),e.compute(K_(e.inputs,r,e.outputCount))}}),q_,Q_,Nv=Ve(()=>{Mt(),sc(),ac(),q_=e=>{if(!e||e.length!==2)throw new Error("MatMul requires 2 inputs.");if(e[0].dims[e[0].dims.length-1]!==e[1].dims[e[1].dims.length-2])throw new Error("shared dimension does not match.")},Q_=e=>{q_(e.inputs);let r=Nn.calcShape(e.inputs[0].dims,e.inputs[1].dims,!0);if(!r)throw new Error("Can't use matmul on the given tensors");let t=r[r.length-1],s=e.inputs[0].dims[e.inputs[0].dims.length-1];if(t<8&&s<8)e.compute(rc(e.inputs,{activation:""},r));else{let i=r[r.length-2],n=Te.size(e.inputs[0].dims.slice(0,-2)),o=Te.size(e.inputs[1].dims.slice(0,-2));if(n!==1&&i===1&&o===1){let a=e.inputs[0].reshape([1,n,s]),l=e.inputs[1].reshape([1,s,t]),c=[1,n,t],p=[a,l];e.compute(Sa(p,{activation:""},r,c),{inputs:p})}else e.compute(Sa(e.inputs,{activation:""},r))}}}),X_,J_,Y_,Z_,eg,jv=Ve(()=>{pt(),Mt(),Yt(),Tt(),X_=(e,r)=>{if(e.length<3||e.length>4)throw new Error("MatMulNBits requires 3 or 4 inputs");let t=e[0],s=t.dims.length;if(t.dims[s-1]!==r.k)throw new Error("The last dim of input shape does not match the k value");let i=Math.floor((r.k+r.blockSize-1)/r.blockSize),n=r.blockSize/8*r.bits,o=e[1];if(!Te.areEqual(o.dims,[r.n,i,n]))throw new Error("The second inputs must be 3D tensor with shape N X nBlocksPerCol X blobSize");let a=e[2].dims;if(Te.size(a)!==r.n*i)throw new Error("scales input size error.");if(e.length===4){let l=e[3].dims,c=r.bits>4?r.n*i:r.n*Math.floor((i+1)/2);if(Te.size(l)!==c)throw new Error("zeroPoints input size error.")}},J_=(e,r)=>{let t=e[0].dims,s=t.length,i=t[s-2],n=r.k,o=r.n,a=t.slice(0,s-2),l=Te.size(a),c=e[1].dims[2]/4,p=e[0].dataType,u=Xt(r.k),h=Xt(c),g=Xt(o),_=a.concat([i,o]),P=i>1&&o/g%2===0?2:1,A=Te.size(_)/g/P,v=64,y=[],k=[l,i,n/u],E=Te.convertShape(e[1].dims).slice();E.splice(-1,1,c/h),y.push(...nt(k)),y.push(...nt(E)),y.push(...nt(e[2].dims)),e.length===4&&y.push(...nt(Te.convertShape(e[3].dims)));let M=[l,i,o/g];y.push(...nt(M));let w=x=>{let $=k.length,z=$e("a",e[0].dataType,$,u),R=$e("b",12,E.length,h),Q=$e("scales",e[2].dataType,e[2].dims.length),q=[z,R,Q],U=e.length===4?$e("zero_points",12,e[3].dims.length):void 0;U&&q.push(U);let Z=M.length,H=tt("output",e[0].dataType,Z,g),J=lr(e[0].dataType),ie=(()=>{switch(u){case 1:return`array<${J}, 8>`;case 2:return`mat4x2<${J}>`;case 4:return`mat2x4<${J}>`;default:throw new Error(`${u}-component is not supported.`)}})(),ae=()=>{let N=` - // reuse a data - var input_offset = ${z.indicesToOffset(`${z.type.indices}(batch, row, word_offset)`)}; - var a_data: ${ie}; - for (var j: u32 = 0; j < ${8/u}; j++) { - a_data[j] = ${z.getByOffset("input_offset")}; - input_offset++; - } - `;for(let O=0;O> 4) & b_mask); - b_quantized_values = ${ie}(${Array.from({length:4},(G,se)=>`${J}(b_value_lower[${se}]), ${J}(b_value_upper[${se}])`).join(", ")}); - b_dequantized_values = ${u===1?`${ie}(${Array.from({length:8},(G,se)=>`(b_quantized_values[${se}] - ${U?`zero_point${O}`:"zero_point"}) * scale${O}`).join(", ")});`:`(b_quantized_values - ${ie}(${Array(8).fill(`${U?`zero_point${O}`:"zero_point"}`).join(",")})) * scale${O};`}; - workgroup_shared[local_id.x * ${P} + ${Math.floor(O/g)}]${g>1?`[${O%g}]`:""} += ${Array.from({length:8/u},(G,se)=>`${u===1?`a_data[${se}] * b_dequantized_values[${se}]`:`dot(a_data[${se}], b_dequantized_values[${se}])`}`).join(" + ")}; - `;return N},ce=()=>{let N=` - var col_index = col * ${g}; - ${U?` - let zero_point_bytes_per_col = (nBlocksPerCol + 1) / 2; - var zero_point_byte_count: u32; - var zero_point_word_index: u32; - var zero_point_byte_offset: u32; - let zero_point_nibble_offset: u32 = block & 0x1u; - var zero_point_bits_offset: u32; - var zero_point_word: u32;`:` - // The default zero point is 8 for unsigned 4-bit quantization. - let zero_point = ${J}(8);`} - `;for(let O=0;O> 0x1u); - zero_point_word_index = zero_point_byte_count >> 0x2u; - zero_point_byte_offset = zero_point_byte_count & 0x3u; - zero_point_bits_offset = (zero_point_byte_offset << 3) + (zero_point_nibble_offset << 2); - zero_point_word = ${U.getByOffset("zero_point_word_index")} >> zero_point_bits_offset; - let zero_point${O} = ${J}((zero_point_word) & 0xFu);`:""} - col_index += 1;`;return N},he=()=>{let N=`col_index = col * ${g};`;for(let O=0;O; - var b_value_upper: vec4; - var b_quantized_values: ${ie}; - var b_dequantized_values: ${ie};`,N};return` - var workgroup_shared: array<${H.type.value}, ${P*v}>; - ${x.declareVariables(...q,H)} - ${x.mainStart([v,1,1])} - let output_indices = ${H.offsetToIndices(`(global_idx / ${v}) * ${P}`)}; - let col = output_indices[2]; - let row = output_indices[1]; - let batch = output_indices[0]; - let nBlocksPerCol = uniforms.b_shape[1]; - - for (var block = local_id.x; block < nBlocksPerCol; block += ${v}) { - //process one block - var word_offset: u32 = block * ${r.blockSize/u}; - ${ce()} - for (var word: u32 = 0; word < ${c}; word += ${h}) { - ${he()} - for (var i: u32 = 0; i < ${h}; i++) { - ${ae()} - word_offset += ${8/u}; - } - } - } - workgroupBarrier(); - - if (local_id.x < ${P}) { - var output_value: ${H.type.value} = ${H.type.value}(0); - var workgroup_shared_offset: u32 = local_id.x; - for (var b: u32 = 0u; b < ${v}u; b++) { - output_value += workgroup_shared[workgroup_shared_offset]; - workgroup_shared_offset += ${P}; - } - ${H.setByIndices(`${H.type.indices}(batch, row, col + local_id.x)`,"output_value")}; - } - }`};return{name:"MatMulNBits",shaderCache:{hint:`${r.blockSize};${r.bits};${u};${h};${g};${P};${v}`,inputDependencies:Array(e.length).fill("rank")},getRunData:()=>({outputs:[{dims:_,dataType:p}],dispatchGroup:{x:A},programUniforms:y}),getShaderSource:w}},Y_=(e,r)=>{let t=e[0].dims,s=t.length,i=t[s-2],n=r.k,o=r.n,a=t.slice(0,s-2),l=Te.size(a),c=e[1].dims[2]/4,p=e[0].dataType,u=Xt(r.k),h=Xt(c),g=a.concat([i,o]),_=128,P=o%8===0?8:o%4===0?4:1,A=_/P,v=A*h*8,y=v/u,k=v/r.blockSize,E=Te.size(g)/P,M=[],w=[l,i,n/u],x=Te.convertShape(e[1].dims).slice();x.splice(-1,1,c/h),M.push(...nt(w)),M.push(...nt(x)),M.push(...nt(e[2].dims)),e.length===4&&M.push(...nt(Te.convertShape(e[3].dims)));let $=[l,i,o];M.push(...nt($));let z=R=>{let Q=w.length,q=$e("a",e[0].dataType,Q,u),U=$e("b",12,x.length,h),Z=$e("scales",e[2].dataType,e[2].dims.length),H=[q,U,Z],J=e.length===4?$e("zero_points",12,e[3].dims.length):void 0;J&&H.push(J);let ie=$.length,ae=tt("output",e[0].dataType,ie),ce=lr(e[0].dataType),he=()=>{switch(u){case 1:return` - let a_data0 = vec4<${ce}>(sub_a[word_offset], sub_a[word_offset + 1], sub_a[word_offset + 2], sub_a[word_offset + 3]); - let a_data1 = vec4<${ce}>(sub_a[word_offset + 4], sub_a[word_offset + 5], sub_a[word_offset + 6], sub_a[word_offset + 7]);`;case 2:return` - let a_data0 = vec4<${ce}>(sub_a[word_offset], sub_a[word_offset + 1]); - let a_data1 = vec4<${ce}>(sub_a[word_offset + 2], sub_a[word_offset + 3]);`;case 4:return` - let a_data0 = sub_a[word_offset]; - let a_data1 = sub_a[word_offset + 1];`;default:throw new Error(`${u}-component is not supported.`)}};return` - var sub_a: array<${q.type.value}, ${y}>; - var inter_results: array, ${P}>; - ${R.declareVariables(...H,ae)} - ${R.mainStart([A,P,1])} - let output_indices = ${ae.offsetToIndices(`workgroup_index * ${P}`)}; - let col = output_indices[2]; - let row = output_indices[1]; - let batch = output_indices[0]; - let n_blocks_per_col = uniforms.b_shape[1]; - let num_tiles = (n_blocks_per_col - 1) / ${k} + 1; - - // Loop over shared dimension. - for (var tile: u32 = 0; tile < num_tiles; tile += 1) { - let a_col_start = tile * ${y}; - // load one tile A data into shared memory. - for (var a_offset = local_idx; a_offset < ${y}; a_offset += ${_}) - { - let a_col = a_col_start + a_offset; - if (a_col < uniforms.a_shape[2]) - { - sub_a[a_offset] = ${q.getByIndices(`${q.type.indices}(batch, row, a_col)`)}; - } else { - sub_a[a_offset] = ${q.type.value}(0); - } - } - workgroupBarrier(); - - // each thread process one block - let b_row = col + local_id.y; - let block = tile * ${k} + local_id.x; - ${J?` - let zero_point_bytes_per_col = (n_blocks_per_col + 1) / 2; - let zero_point_byte_count = b_row * zero_point_bytes_per_col + (block >> 0x1u); - let zero_point_word_index = zero_point_byte_count >> 0x2u; - let zero_point_byte_offset = zero_point_byte_count & 0x3u; - let zero_point_nibble_offset: u32 = block & 0x1u; - let zero_point_bits_offset = (zero_point_byte_offset << 3) + (zero_point_nibble_offset << 2); - let zero_point_word = ${J.getByOffset("zero_point_word_index")} >> zero_point_bits_offset; - let zero_point = ${ce}((zero_point_word) & 0xFu);`:` - // The default zero point is 8 for unsigned 4-bit quantization. - let zero_point = ${ce}(8);`} - let scale = ${Z.getByOffset("b_row * n_blocks_per_col + block")}; - let b_data = ${U.getByIndices(`${U.type.indices}(b_row, block, 0)`)}; - var word_offset = local_id.x * ${r.blockSize/u}; - for (var i: u32 = 0; i < ${h}; i++) { - ${he()} - let b_value = ${h===1?"b_data":"b_data[i]"}; - let b_value_lower = unpack4xU8(b_value & 0x0F0F0F0Fu); - let b_value_upper = unpack4xU8((b_value >> 4) & 0x0F0F0F0Fu); - let b_quantized_values = mat2x4<${ce}>(${Array.from({length:4},(N,O)=>`${ce}(b_value_lower[${O}]), ${ce}(b_value_upper[${O}])`).join(", ")}); - let b_dequantized_values = (b_quantized_values - mat2x4<${ce}>(${Array(8).fill("zero_point").join(",")})) * scale; - inter_results[local_id.y][local_id.x] += ${Array.from({length:2},(N,O)=>`${`dot(a_data${O}, b_dequantized_values[${O}])`}`).join(" + ")}; - word_offset += ${8/u}; - } - workgroupBarrier(); - } - - if (local_idx < ${P}) { - var output_value: ${ae.type.value} = ${ae.type.value}(0); - for (var b = 0u; b < ${A}; b++) { - output_value += inter_results[local_idx][b]; - } - if (col + local_idx < uniforms.output_shape[2]) - { - ${ae.setByIndices(`${ae.type.indices}(batch, row, col + local_idx)`,"output_value")} - } - } - }`};return{name:"BlockwiseMatMulNBits32",shaderCache:{hint:`${r.blockSize};${u};${h};${A};${P}`,inputDependencies:Array(e.length).fill("rank")},getRunData:()=>({outputs:[{dims:g,dataType:p}],dispatchGroup:{x:E},programUniforms:M}),getShaderSource:z}},Z_=(e,r)=>{X_(e.inputs,r),r.blockSize===32&&e.adapterInfo.isVendor("intel")&&e.adapterInfo.isArchitecture("gen-12lp")?e.compute(Y_(e.inputs,r)):e.compute(J_(e.inputs,r))},eg=e=>Dt(e)}),tg,rg,sg,ng,ig,og,ag,lg,dg,Vv=Ve(()=>{pt(),Mt(),Tt(),tg=e=>{if(!e||e.length<1)throw new Error("Too few inputs");if(e[0].dataType!==1&&e[0].dataType!==10)throw new Error("Input type must be float or float16.");if(e.length>=2){let r=e[0].dims.length*2===e[1].dims[0];if(e.length===4&&(r=e[3].dims[0]*2===e[1].dims[0]),!r)throw new Error("The pads should be a 1D tensor of shape [2 * input_rank] or [2 * num_axes].")}},rg=(e,r,t)=>{let s="";for(let i=r-1;i>=0;--i)s+=` - k = i32(${e.indicesGet("indices",i)}) - ${rt("uniforms.pads",i,t)}; - if (k < 0) { - break; - } - if (k >= i32(${rt("uniforms.x_shape",i,r)})) { - break; - } - offset += k * i32(${rt("uniforms.x_strides",i,r)}); - `;return` - value = ${e.type.value}(uniforms.constant_value); - for (var i = 0; i < 1; i++) { - var offset = 0; - var k = 0; - ${s} - value = x[offset]; - } - `},sg=(e,r,t)=>{let s="";for(let i=r-1;i>=0;--i)s+=` - k = i32(${e.indicesGet("indices",i)}) - ${rt("uniforms.pads",i,t)}; - if (k < 0) { - k = -k; - } - { - let _2n_1 = 2 * (i32(${rt("uniforms.x_shape",i,r)}) - 1); - k = k % _2n_1; - if(k >= i32(${rt("uniforms.x_shape",i,r)})) { - k = _2n_1 - k; - } - } - offset += k * i32(${rt("uniforms.x_strides",i,r)}); - `;return` - var offset = 0; - var k = 0; - ${s} - value = x[offset]; - `},ng=(e,r,t)=>{let s="";for(let i=r-1;i>=0;--i)s+=` - k = i32(${e.indicesGet("indices",i)}) - ${rt("uniforms.pads",i,t)}; - if (k < 0) { - k = 0; - } - if (k >= i32(${rt("uniforms.x_shape",i,r)})) { - k = i32(${rt("uniforms.x_shape",i,r)}) - 1; - } - offset += k * i32(${rt("uniforms.x_strides",i,r)}); - `;return` - var offset = 0; - var k = 0; - ${s} - value = x[offset]; - `},ig=(e,r,t)=>{let s="";for(let i=r-1;i>=0;--i)s+=` - k = i32(${e.indicesGet("indices",i)}) - ${rt("uniforms.pads",i,t)}; - if (k < 0) { - k += i32(${rt("uniforms.x_shape",i,r)}]); - } - if (k >= i32(${rt("uniforms.x_shape",i,r)})) { - k -= i32(${rt("uniforms.x_shape",i,r)}); - } - offset += k * i32(${rt("uniforms.x_strides",i,r)}); - `;return` - var offset = 0; - var k = 0; - ${s} - value = x[offset]; - `},og=(e,r,t)=>{switch(t.mode){case 0:return rg(e,r,t.pads.length);case 1:return sg(e,r,t.pads.length);case 2:return ng(e,r,t.pads.length);case 3:return ig(e,r,t.pads.length);default:throw new Error("Invalid mode")}},ag=(e,r)=>{let t=Te.padShape(e[0].dims.slice(),r.pads),s=e[0].dims,i=Te.size(t),n=[{type:12,data:i},{type:6,data:r.pads}],o=e.length>=3&&e[2].data;r.mode===0&&n.push({type:o?e[2].dataType:1,data:r.value}),n.push(...nt(e[0].dims,t));let a=["rank"],l=c=>{let p=tt("output",e[0].dataType,t.length),u=$e("x",e[0].dataType,s.length),h=u.type.value,g=og(p,s.length,r),_=[{name:"output_size",type:"u32"},{name:"pads",type:"i32",length:r.pads.length}];return r.mode===0&&_.push({name:"constant_value",type:o?h:"f32"}),` - ${c.registerUniforms(_).declareVariables(u,p)} - ${c.mainStart()} - ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - - let indices = ${p.offsetToIndices("global_idx")}; - - var value = ${h}(0); - ${g} - output[global_idx] = value; - }`};return{name:"Pad",shaderCache:{hint:`${r.mode}${o}`,inputDependencies:a},getRunData:()=>({outputs:[{dims:t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(Te.size(t)/64)},programUniforms:n}),getShaderSource:l}},lg=(e,r)=>{if(e.length>1){let t=e[1].getBigInt64Array(),s=e.length>=3&&e[2].data?e[2].dataType===10?e[2].getUint16Array()[0]:e[2].getFloat32Array()[0]:0,i=e[0].dims.length,n=new Int32Array(2*i).fill(0);if(e.length>=4){let a=e[3].getBigInt64Array();for(let l=0;ln[Number(l)]=Number(a));let o=[];return n.forEach(a=>o.push(a)),{mode:r.mode,value:s,pads:o}}else return r},dg=(e,r)=>{tg(e.inputs);let t=lg(e.inputs,r);e.compute(ag(e.inputs,t),{inputs:[0]})}}),Ni,vc,Tc,xc,Ec,cg,ug,Pc,Cc,pg,hg,Sc,mg,fg,$c,_g,gg,wg,yg,Uv=Ve(()=>{ss(),pt(),Mt(),Tt(),Ni=e=>{if(Ut.webgpu.validateInputContent&&(!e||e.length!==1))throw new Error("Pool ops requires 1 input.")},vc=(e,r,t)=>{let s=r.format==="NHWC",i=e.dims.slice();s&&i.splice(1,0,i.pop());let n=Object.hasOwnProperty.call(r,"dilations"),o=r.kernelShape.slice(),a=r.strides.slice(),l=n?r.dilations.slice():[],c=r.pads.slice();Ta.adjustPoolAttributes(t,i,o,a,l,c);let p=Ta.computePoolOutputShape(t,i,a,l,o,c,r.autoPad),u=Object.assign({},r);n?Object.assign(u,{kernelShape:o,strides:a,pads:c,dilations:l,cacheKey:r.cacheKey}):Object.assign(u,{kernelShape:o,strides:a,pads:c,cacheKey:r.cacheKey});let h=p.slice();return h.push(h.splice(1,1)[0]),[u,s?h:p]},Tc=(e,r)=>{let t=r.format==="NHWC",s=Te.size(e),i=Te.size(r.kernelShape),n=[{type:12,data:s},{type:12,data:i}],o=[{name:"outputSize",type:"u32"},{name:"kernelSize",type:"u32"}];if(r.kernelShape.length<=2){let a=r.kernelShape[r.kernelShape.length-1],l=r.strides[r.strides.length-1],c=r.pads[r.pads.length/2-1],p=r.pads[r.pads.length-1],u=!!(c+p);n.push({type:12,data:a},{type:12,data:l},{type:12,data:c},{type:12,data:p}),o.push({name:"kw",type:"u32"},{name:"sw",type:"u32"},{name:"pwStart",type:"u32"},{name:"pwEnd",type:"u32"});let h=!1;if(r.kernelShape.length===2){let g=r.kernelShape[r.kernelShape.length-2],_=r.strides[r.strides.length-2],P=r.pads[r.pads.length/2-2],A=r.pads[r.pads.length-2];h=!!(P+A),n.push({type:12,data:g},{type:12,data:_},{type:12,data:P},{type:12,data:A}),o.push({name:"kh",type:"u32"},{name:"sh",type:"u32"},{name:"phStart",type:"u32"},{name:"phEnd",type:"u32"})}return[n,o,!0,u,h]}else{if(t)throw new Error("Pooling with kernelShape.length > 2 is not supported for NHWC format.");let a=Te.computeStrides(r.kernelShape);n.push({type:12,data:a},{type:12,data:r.pads},{type:12,data:r.strides}),o.push({name:"kernelStrides",type:"u32",length:a.length},{name:"pads",type:"u32",length:r.pads.length},{name:"strides",type:"u32",length:r.strides.length});let l=r.pads.reduce((c,p)=>c+p);return[n,o,!!l,!1,!1]}},xc=(e,r,t,s,i,n,o,a,l,c,p,u)=>{let h=i.format==="NHWC",g=r.type.value,_=tt("output",r.type.tensor,s);if(i.kernelShape.length<=2){let P="",A="",v="",y=t-(h?2:1);if(p?P=` - for (var i: u32 = 0u; i < uniforms.kw; i++) { - xIndices[${y}] = indices[${y}] * uniforms.sw - uniforms.pwStart + i; - if (xIndices[${y}] < 0 || xIndices[${y}] - >= uniforms.x_shape[${y}]) { - pad++; - continue; - } - let x_val = x[${r.indicesToOffset("xIndices")}]; - ${n} - }`:P=` - for (var i: u32 = 0u; i < uniforms.kw; i++) { - xIndices[${y}] = indices[${y}] * uniforms.sw - uniforms.pwStart + i; - let x_val = x[${r.indicesToOffset("xIndices")}]; - ${n} - }`,i.kernelShape.length===2){let k=t-(h?3:2);u?A=` - for (var j: u32 = 0u; j < uniforms.kh; j++) { - xIndices[${k}] = indices[${k}] * uniforms.sh - uniforms.phStart + j; - if (xIndices[${k}] < 0 || xIndices[${k}] >= uniforms.x_shape[${k}]) { - pad += i32(uniforms.kw); - continue; - } - `:A=` - for (var j: u32 = 0u; j < uniforms.kh; j++) { - xIndices[${k}] = indices[${k}] * uniforms.sh - uniforms.phStart + j; - `,v=` - } - `}return` - ${e.registerUniforms(l).declareVariables(r,_)} - - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - - let indices = ${_.offsetToIndices("global_idx")}; - var xIndices = ${_.offsetToIndices("global_idx")}; - - var value = ${g}(${a}); - var pad = 0; - ${A} - ${P} - ${v} - ${o} - - output[global_idx] = value; - }`}else{if(h)throw new Error("Pooling with kernelShape.length > 2 is not supported for NHWC format.");let P=i.kernelShape.length,A=i.pads.length,v="";return c?v=` - if (xIndices[j] >= uniforms.x_shape[j]) { - pad++; - isPad = true; - break; - } - } - if (!isPad) { - let x_val = x[${r.indicesToOffset("xIndices")}]; - ${n} - }`:v=` - } - let x_val = x[${r.indicesToOffset("xIndices")}]; - ${n} - `,` - ${e.registerUniforms(l).declareVariables(r,_)} - - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - let indices = ${_.offsetToIndices("global_idx")}; - var xIndices = ${_.offsetToIndices("global_idx")}; - - var offsets: array; - - var value = ${g}(${a}); - var pad = 0; - var isPad = false; - - for (var i: u32 = 0u; i < uniforms.kernelSize; i++) { - var offset = i; - for (var j = 0u; j < ${P-1}u; j++) { - offsets[j] = offset / ${rt("uniforms.kernelStrides","j",P)}; - offset -= offsets[j] * ${rt("uniforms.kernelStrides","j",P)}; - } - offsets[${P-1}] = offset; - - isPad = false; - for (var j = ${t-P}u; j < ${t}u; j++) { - xIndices[j] = indices[j] * ${rt("uniforms.strides",`j - ${t-P}u`,P)} - + offsets[j - ${t-P}u] - ${rt("uniforms.pads","j - 2u",A)}; - ${v} - } - ${o} - - output[global_idx] = value; - }`}},Ec=e=>`${e.format};${e.ceilMode};${e.autoPad};${e.kernelShape.length}`,cg=e=>`${Ec(e)};${e.countIncludePad}`,ug=e=>`${Ec(e)};${e.storageOrder};${e.dilations}`,Pc=e=>({format:e.format,autoPad:["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][e.auto_pad],ceilMode:e.ceil_mode,kernelShape:e.kernel_shape,strides:e.strides,pads:e.pads}),Cc=(e,r,t,s)=>{let[i,n]=vc(r,s,t),o=$e("x",r.dataType,r.dims.length),a=o.type.value,l="value += x_val;",c="";i.countIncludePad?c+=`value /= ${a}(uniforms.kernelSize);`:c+=`value /= ${a}(i32(uniforms.kernelSize) - pad);`;let[p,u,h,g,_]=Tc(n,i);p.push(...nt(r.dims,n));let P=["rank"];return{name:e,shaderCache:{hint:`${s.cacheKey};${h};${g};${_}`,inputDependencies:P},getRunData:()=>({outputs:[{dims:n,dataType:r.dataType}],dispatchGroup:{x:Math.ceil(Te.size(n)/64)},programUniforms:p}),getShaderSource:A=>xc(A,o,r.dims.length,n.length,i,l,c,0,u,h,g,_)}},pg=e=>{let r=e.count_include_pad!==0,t=Pc(e);if(t.ceilMode!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");let s={countIncludePad:r,...t,cacheKey:""};return{...s,cacheKey:cg(s)}},hg=(e,r)=>{Ni(e.inputs),e.compute(Cc("AveragePool",e.inputs[0],!1,r))},Sc={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[]},mg=e=>{let r=e.format;return{format:r,...Sc,cacheKey:r}},fg=(e,r)=>{Ni(e.inputs),e.compute(Cc("GlobalAveragePool",e.inputs[0],!0,r))},$c=(e,r,t,s)=>{let[i,n]=vc(r,s,t),o=` - value = max(x_val, value); - `,a="",l=$e("x",r.dataType,r.dims.length),c=["rank"],[p,u,h,g,_]=Tc(n,i);return p.push(...nt(r.dims,n)),{name:e,shaderCache:{hint:`${s.cacheKey};${h};${g};${_}`,inputDependencies:c},getRunData:()=>({outputs:[{dims:n,dataType:r.dataType}],dispatchGroup:{x:Math.ceil(Te.size(n)/64)},programUniforms:p}),getShaderSource:P=>xc(P,l,r.dims.length,n.length,i,o,a,r.dataType===10?-65504:-1e5,u,h,g,_)}},_g=(e,r)=>{Ni(e.inputs),e.compute($c("MaxPool",e.inputs[0],!1,r))},gg=e=>{let r=e.storage_order,t=e.dilations,s=Pc(e);if(r!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(s.ceilMode!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");let i={storageOrder:r,dilations:t,...s,cacheKey:""};return{...i,cacheKey:ug(i)}},wg=e=>{let r=e.format;return{format:r,...Sc,cacheKey:r}},yg=(e,r)=>{Ni(e.inputs),e.compute($c("GlobalMaxPool",e.inputs[0],!0,r))}}),Mg,bg,vg,Tg,Wv=Ve(()=>{pt(),Mt(),Yt(),Tt(),Mg=(e,r)=>{if(e.length<2||e.length>3)throw new Error("DequantizeLinear requires 2 or 3 inputs.");if(e.length===3&&e[1].dims===e[2].dims)throw new Error("x-scale and x-zero-point must have the same shape.");if(e.length===3&&e[0].dataType!==e[2].dataType)throw new Error("x and x-zero-point must have the same data type.");if(e[0].dataType===6&&e.length>2)throw new Error("In the case of dequantizing int32 there is no zero point.");if(e[1].dims.length!==0&&e[1].dims.length!==1&&e[1].dims.length!==e[0].dims.length)throw new Error("scale input must be a scalar, a 1D tensor, or have the same rank as the input tensor.");if(e.length>2){if(e[0].dataType!==e[2].dataType)throw new Error("x and x-zero-point must have the same data type.");if(e[1].dims.length!==e[2].dims.length)throw new Error("scale and zero-point inputs must have the same rank.");if(!e[1].dims.map((t,s)=>t===e[2].dims[s]).reduce((t,s)=>t&&s,!0))throw new Error("scale and zero-point inputs must have the same shape.")}if(r.blockSize>0){if(e[1].dims.length===0||e[1].dims.length===1&&e[1].dims[0]===1)throw new Error("blockSize must be set only for block quantization.");if(!e[1].dims.map((i,n)=>n===r.axis||i===e[0].dims[n]).reduce((i,n)=>i&&n,!0))throw new Error("For block qunatization, scale input shape to match the input shape except for the axis");if(e[1].dims.length!==e[0].dims.length)throw new Error("For block qunatization the scale input rank must be the same as the x rank.");let t=e[0].dims[r.axis],s=e[1].dims[r.axis];if(r.blockSizeMath.ceil(t/(s-1)-1))throw new Error("blockSize must be with in the range [ceil(dI / Si), ceil(dI / (Si - 1) - 1)].")}},bg=(e,r)=>{let t=Te.normalizeAxis(r.axis,e[0].dims.length),s=e[0].dataType,i=s===3,n=e[0].dims,o=e[1].dataType,a=Te.size(n),l=s===3||s===2,c=l?[Math.ceil(Te.size(e[0].dims)/4)]:e[0].dims,p=e[1].dims,u=e.length>2?e[2]:void 0,h=u?l?[Math.ceil(Te.size(u.dims)/4)]:u.dims:void 0,g=p.length===0||p.length===1&&p[0]===1,_=g===!1&&p.length===1,P=Xt(a),A=g&&(!l||P===4),v=A?P:1,y=A&&!l?P:1,k=$e("input",l?12:s,c.length,y),E=$e("scale",o,p.length),M=u?$e("zero_point",l?12:s,h.length):void 0,w=tt("output",o,n.length,v),x=[k,E];M&&x.push(M);let $=[c,p];u&&$.push(h);let z=[{type:12,data:a/v},{type:12,data:t},{type:12,data:r.blockSize},...nt(...$,n)],R=Q=>{let q=[{name:"output_size",type:"u32"},{name:"axis",type:"u32"},{name:"block_size",type:"u32"}];return` - ${Q.registerUniforms(q).declareVariables(...x,w)} - ${Q.mainStart()} - ${Q.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let output_indices = ${w.offsetToIndices("global_idx")}; - - // Set input x - ${l?` - let input = ${k.getByOffset("global_idx / 4")}; - let x_vec = ${i?"unpack4xI8(input)":"unpack4xU8(input)"}; - let x_value = ${v===1?"x_vec[global_idx % 4]":"x_vec"};`:`let x_value = ${k.getByOffset("global_idx")};`}; - - // Set scale input - ${g?`let scale_value= ${E.getByOffset("0")}`:_?` - let scale_index = ${w.indicesGet("output_indices","uniforms.axis")}; - let scale_value= ${E.getByOffset("scale_index")};`:` - var scale_indices: ${E.type.indices} = output_indices; - let index = ${E.indicesGet("scale_indices","uniforms.axis")} / uniforms.block_size; - ${E.indicesSet("scale_indices","uniforms.axis","index")}; - let scale_value= ${E.getByIndices("scale_indices")};`}; - - // Set zero-point input - ${M?g?l?` - let zero_point_input = ${M.getByOffset("0")}; - let zero_point_vec = ${i?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; - let zero_point_value= zero_point_vec[0]`:`let zero_point_value = ${M.getByOffset("0")}`:_?l?` - let zero_point_index = ${w.indicesGet("output_indices","uniforms.axis")}; - let zero_point_input = ${M.getByOffset("zero_point_index / 4")}; - let zero_point_vec = ${i?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; - let zero_point_value = zero_point_vec[zero_point_index % 4]`:` - let zero_point_index = ${w.indicesGet("output_indices","uniforms.axis")}; - let zero_point_value = ${M.getByOffset("zero_point_index")};`:l?` - let zero_point_offset = ${E.indicesToOffset("scale_indices")}; - let zero_point_input = ${M.getByOffset("zero_point_offset / 4")}; - let zero_point_vec = ${i?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; - let zero_point_value = zero_point_vec[zero_point_offset % 4];`:`let zero_point_value = ${M.getByIndices("scale_indices")};`:`let zero_point_value = ${l?i?"i32":"u32":k.type.value}(0);`}; - // Compute and write output - ${w.setByOffset("global_idx",`${w.type.value}(x_value - zero_point_value) * scale_value`)}; - }`};return{name:"DequantizeLinear",shaderCache:{hint:r.cacheKey,inputDependencies:M?["rank","rank","rank"]:["rank","rank"]},getShaderSource:R,getRunData:()=>({outputs:[{dims:n,dataType:o}],dispatchGroup:{x:Math.ceil(a/v/64),y:1,z:1},programUniforms:z})}},vg=(e,r)=>{Mg(e.inputs,r),e.compute(bg(e.inputs,r))},Tg=e=>Dt({axis:e.axis,blockSize:e.blockSize})}),xg,Eg,Pg,Gv=Ve(()=>{ss(),pt(),Tt(),xg=(e,r,t)=>{let s=e===r,i=er&&t>0;if(s||i||n)throw new Error("Range these inputs' contents are invalid.")},Eg=(e,r,t,s)=>{let i=Math.abs(Math.ceil((r-e)/t)),n=[i],o=i,a=[{type:12,data:o},{type:s,data:e},{type:s,data:t},...nt(n)],l=c=>{let p=tt("output",s,n.length),u=p.type.value,h=[{name:"outputSize",type:"u32"},{name:"start",type:u},{name:"delta",type:u}];return` - ${c.registerUniforms(h).declareVariables(p)} - ${c.mainStart()} - ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - output[global_idx] = uniforms.start + ${u}(global_idx) * uniforms.delta; - }`};return{name:"Range",shaderCache:{hint:`${s}`},getShaderSource:l,getRunData:()=>({outputs:[{dims:n,dataType:s}],dispatchGroup:{x:Math.ceil(o/64)},programUniforms:a})}},Pg=e=>{let r=0,t=0,s=0;e.inputs[0].dataType===6?(r=e.inputs[0].getInt32Array()[0],t=e.inputs[1].getInt32Array()[0],s=e.inputs[2].getInt32Array()[0]):e.inputs[0].dataType===1&&(r=e.inputs[0].getFloat32Array()[0],t=e.inputs[1].getFloat32Array()[0],s=e.inputs[2].getFloat32Array()[0]),Ut.webgpu.validateInputContent&&xg(r,t,s),e.compute(Eg(r,t,s,e.inputs[0].dataType),{inputs:[]})}}),Cg,Sg,$g,kg,Kv=Ve(()=>{pt(),Mt(),Yt(),Tt(),Cg=(e,r,t,s)=>{if(e!=="none"&&s!=="i32"&&s!=="u32"&&s!=="f32")throw new Error(`Input ${s} is not supported with reduction ${e}.`);let i=`{ - var oldValue = 0; - loop { - let newValueF32 =`,n=`; - let newValue = bitcast(newValueF32); - let res = atomicCompareExchangeWeak(&${r}, oldValue, newValue); - if res.exchanged { - break; - } - oldValue = res.old_value; - } - }`;switch(e){case"none":return`${r}=${t};`;case"add":return s==="i32"||s==="u32"?`atomicAdd(&${r}, bitcast<${s}>(${t}));`:` - ${i}bitcast<${s}>(oldValue) + (${t})${n}`;case"max":return s==="i32"||s==="u32"?`atomicMax(&${r}, bitcast<${s}>(${t}));`:` - ${i}max(bitcast(oldValue), (${t}))${n}`;case"min":return s==="i32"||s==="u32"?`atomicMin(&${r}, bitcast<${s}>(${t}));`:`${i}min(bitcast<${s}>(oldValue), (${t}))${n}`;case"mul":return`${i}(bitcast<${s}>(oldValue) * (${t}))${n}`;default:throw new Error(`Reduction ${e} is not supported.`)}},Sg=(e,r)=>{let t=e[0].dims,s=e[1].dims,i=t,n=1,o=Math.ceil(Te.size(s)/n),a=s[s.length-1],l=Te.sizeFromDimension(t,a),c=[{type:12,data:o},{type:12,data:a},{type:12,data:l},...nt(e[1].dims,e[2].dims,i)],p=u=>{let h=$e("indices",e[1].dataType,e[1].dims.length),g=$e("updates",e[2].dataType,e[2].dims.length,n),_=r.reduction!=="none"&&r.reduction!==""?Rp("output",e[0].dataType,i.length):tt("output",e[0].dataType,i.length,n);return` - ${u.registerUniform("output_size","u32").registerUniform("last_index_dimension","u32").registerUniform("num_updates_elements","u32").declareVariables(h,g,_)} - ${u.mainStart()} - ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - var hasDuplicates = false; - if (${r.reduction==="none"}) { - let n = ${Te.size(s)}; - for (var i = 0; i < n; i = i + 1) { - for (var j = i + 1; j < n; j = j + 1) { - var index_i = i32(indices[i].x); - var index_j = i32(indices[j].x); - if (index_i == index_j) { - hasDuplicates = true; - break; - } - } - if (hasDuplicates) { - break; - } - } - } - - var data_offset = 0u; - var indices_start = uniforms.last_index_dimension * global_idx; - if (${r.reduction==="none"} && hasDuplicates) { - if (global_idx != 0u) { - return; - } - indices_start = 0u; - } - let indices_end = indices_start + uniforms.last_index_dimension; - for (var i = indices_start; i < indices_end; i++) { - var index = i32(indices[i].x); - ${e[0].dims.length===1?` - let element_count_dim = uniforms.output_strides; - let dim_value = uniforms.output_shape;`:` - let element_count_dim = uniforms.output_strides[i - indices_start]; - let dim_value = uniforms.output_shape[i - indices_start + uniforms.last_index_dimension];`} - if (index >= 0) { - if (index >= i32(dim_value)) { - index = i32(dim_value - 1); - } - } else { - if (index < -i32(dim_value)) { - index = 0; - } else { - index += i32(dim_value); - } - } - data_offset += u32((u32(index) * element_count_dim)); - } - - for (var i = 0u; i < uniforms.num_updates_elements; i++) { - let value = updates[uniforms.num_updates_elements * global_idx + i]; - ${Cg(r.reduction,"output[data_offset + i]","value",_.type.value)} - } - - }`};return{name:"ScatterND",shaderCache:{hint:`${r.cacheKey}_${r.reduction}`,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:i,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(o/64)},programUniforms:c}),getShaderSource:p}},$g=e=>Dt({reduction:e.reduction}),kg=(e,r)=>{e.compute(Sg(e.inputs,r),{inputs:[e.inputs[1],e.inputs[2]],outputs:[]})}}),Ig,Ag,Fg,kc,Og,Dg,Lg,zg,Bg,Rg,Ng,jg,Ic,Vg,Ug,Wg,Gg,Kg,Hg,qg,Hv=Ve(()=>{pt(),Mt(),Yt(),Tt(),Ig=(e,r)=>{if(e.every(t=>t>0||(()=>{throw new Error("Resize requires scales input values to be positive")})),e.length>0){if(r.mode==="linear"){if(!(e.length===2||e.length===3||e.length===4&&e[0]===1&&e[1]===1||e.length===4&&e[0]===1&&e[3]===1||e.length===5&&e[0]===1&&e[1]===1))throw new Error(`For linear mode, Resize requires scales to be 2D, 3D, 4D with either two outermost or one innermost and - one outermost scale values equal to 1, or 5D with two outermost scale values equal to 1`)}else if(r.mode==="cubic"&&!(e.length===2||e.length===4&&e[0]===1&&e[1]===1||e.length===4&&e[0]===1&&e[3]===1))throw new Error("Resize requires scales input size to be 2 or 4 for cubic mode")}},Ag=(e,r,t)=>{r.every(i=>i>=0&&i{throw new Error("Resize requires axes input values to be positive and less than rank")}));let s=new Array(t).fill(1);return r.forEach((i,n)=>s[i]=e[n]),s},Fg=(e,r,t,s,i,n)=>{let[o,a,l]=t>10?[1,2,3]:[-1,e.length>1?1:-1,-1],c=e[0].dims.length;if(o>0&&e.length>o&&e[o].dims.length>0)e[o].getFloat32Array().forEach(p=>n.push(p));else if(r.coordinateTransformMode==="tf_crop_and_resize")throw new Error("Resize requires RoI input to be specified when coordinateTransformMode is tfCropAndResize");if(a>0&&e.length>a&&e[a].dims.length===1&&e[a].dims[0]>0){if(e[a].getFloat32Array().forEach(p=>s.push(p)),s.length!==0&&s.length!==c&&t>=18&&s.length!==r.axes.length)throw new Error("Resize requires scales input size to be same as input rank or axes size for opset 18 and up");Ig(s,r),r.axes.length>0&&Ag(s,r.axes,c).forEach((p,u)=>s[u]=p)}if(l>0&&e.length>l&&e[l].dims.length===1&&e[l].dims[0]>0&&(e[l].getBigInt64Array().forEach(p=>i.push(Number(p))),i.length!==0&&i.length!==c&&t>=18&&i.length!==r.axes.length))throw new Error("Resize requires sizes input size to be same as input rank or axes size for opset 18 and up");if(r.axes.length>0){if(s.length!==0&&s.length!==r.axes.length)throw new Error('Resize requires "scales" input size to be of axes rank when axes attributes is specified');if(i.length!==0&&i.length!==r.axes.length)throw new Error('Resize requires "sizes" input size to be of rank axes rank when axes attributes is specified')}if(typeof s<"u"&&typeof i<"u"&&s.length>0&&i.length>c)throw new Error("Resize requires only of scales or sizes to be specified")},kc=(e,r,t,s)=>` - // The whole part and the fractional part are calculated separately due to inaccuracy of floating - // point division. As an example, f32(21) / f32(7) may evaluate to 2.99... instead of 3, causing an - // offset-by-one error later in floor(). - let big = (${e}) * (${r}); - let whole = ${s}(big / (${t})); - let fract = ${s}(big % (${t})) / ${s}(${t}); - return whole + fract; -`,Og=(e,r)=>`fn getOriginalCoordinateFromResizedCoordinate(xResized: u32, xScale: f32, lengthResized: u32, - lengthOriginal: u32, roiStart: f32, roiEnd: f32) -> ${r} { `+(()=>{switch(e){case"asymmetric":return` - if (xScale < 1.0 || floor(xScale) != xScale) { - return ${r}(xResized) / ${r}(xScale); - } else { - ${kc("xResized","lengthOriginal","lengthResized",r)} - } - `;case"pytorch_half_pixel":return`if (lengthResized > 1) { - return (${r}(xResized) + 0.5) / ${r}(xScale) - 0.5; - } else { - return 0.0; - }`;case"tf_half_pixel_for_nn":return`return (${r}(xResized) + 0.5) / ${r}(xScale);`;case"align_corners":return`if (lengthResized == 1) { - return 0.0; - } else { - ${kc("xResized","lengthOriginal - 1","lengthResized - 1",r)} - }`;case"tf_crop_and_resize":return`if (lengthResized > 1) { - return ${r}(roiStart) * ${r}(lengthOriginal - 1) + - (${r}(xResized) * ${r}(roiEnd - roiStart) * ${r}(lengthOriginal - 1)) / - ${r}(lengthResized - 1); - } else { - return 0.5 * ${r}(roiStart + roiEnd) * ${r}(lengthOriginal - 1); - }`;case"half_pixel_symmetric":return`const outputWidth = ${r}xScale * ${r}(lengthResized); - const adjustment = ${r}(lengthResized) / outputWidth; - const center = ${r}(lengthOriginal) / 2; - const offset = center * (1 - adjustment); - return offset + ((${r}(xResized) + 0.5) / ${r}(xScale)) - 0.5;`;case"half_pixel":return`return ((${r}(xResized) + 0.5) / ${r}(xScale)) - 0.5;`;default:throw new Error(`Coordinate transform mode ${e} is not supported`)}})()+"}",Dg=(e,r,t)=>`fn getNearestPixelFromOriginal(xOriginal: ${t}, isDownSample: bool) -> ${t} {`+(()=>{switch(e){case"round_prefer_ceil":return"if (fract(xOriginal) == 0.5) { return ceil(xOriginal); } else { return round(xOriginal); }";case"floor":return"return floor(xOriginal);";case"ceil":return"return ceil(xOriginal);";case"round_prefer_floor":return"if (fract(xOriginal) == 0.5) { return floor(xOriginal); } else { return round(xOriginal); }";case"simple":default:if(r<11)return"if (isDownSample) { return ceil(xOriginal); } else { return xOriginal; }";throw new Error(`Nearest mode ${e} is not supported`)}})()+"}",Lg=(e,r,t)=>{let s=new Array(t).fill(0).concat(new Array(t).fill(1)),i=e.length===0?s:e.slice();return r.length>0?(r.forEach((n,o)=>{s[n]=i[o],s[o+t]=i[r.length+o]}),s):i},zg=(e,r,t,s)=>{let i=[];if(t.length>0)if(s.length>0){if(e.forEach(n=>i.push(n)),Math.max(...s)>e.length)throw new Error("axes is out of bound");s.forEach((n,o)=>i[n]=t[o])}else t.forEach(n=>i.push(n));else{if(r.length===0)throw new Error("Resize requires either scales or sizes.");i=e.map((n,o)=>Math.round(n*r[o]))}return i},Bg=(e,r,t)=>{let s=(()=>{switch(t.keepAspectRatioPolicy){case"not_larger":return t.axes.length>0?Math.min(...t.axes.map(n=>r[n]),Number.MAX_VALUE):Math.min(...r,Number.MAX_VALUE);case"not_smaller":return t.axes.length>0?Math.max(...t.axes.map(n=>r[n]),Number.MIN_VALUE):Math.max(...r,Number.MIN_VALUE);default:throw new Error(`Keep aspect ratio policy ${t.keepAspectRatioPolicy} is not supported`)}})();r.fill(1,0,r.length);let i=e.slice();return t.axes.length>0?(t.axes.forEach(n=>r[n]=s),t.axes.forEach(n=>i[n]=Math.round(e[n]*r[n]))):(r.fill(s,0,r.length),i.forEach((n,o)=>i[o]=Math.round(n*r[o]))),i},Rg=(e,r,t,s,i)=>` - fn calculateOriginalIndicesFromOutputIndices(output_indices: ${e.type.indices}) -> array<${e.type.value}, ${t.length}> { - var original_indices: array<${e.type.value}, ${t.length}>; - for (var i:u32 = 0; i < ${t.length}; i++) { - var output_index = ${e.indicesGet("output_indices","i")}; - var scale = ${rt("uniforms.scales","i",s)}; - var roi_low = ${rt("uniforms.roi","i",i)}; - var roi_hi = ${rt("uniforms.roi",`i + ${r.length}`,i)}; - if (scale == 1.0) { - original_indices[i] = ${e.type.value}(output_index); - } else { - var input_shape_i = ${rt("uniforms.input_shape","i",r.length)}; - var output_shape_i = ${rt("uniforms.output_shape","i",t.length)}; - original_indices[i] = getOriginalCoordinateFromResizedCoordinate(output_index, scale, output_shape_i, - input_shape_i, roi_low, roi_hi); - } - } - return original_indices; - }`,Ng=(e,r,t,s,i,n,o)=>` - fn calculateInputIndicesFromOutputIndices(output_indices: ${r.type.indices}) -> ${e.type.indices} { - var input_indices: ${e.type.indices}; - for (var i:u32 = 0; i < ${s.length}; i++) { - var output_index = ${r.indicesGet("output_indices","i")}; - var input_index: u32; - var scale = ${rt("uniforms.scales","i",i)}; - if (scale == 1.0) { - input_index = output_index; - } else { - var roi_low = ${rt("uniforms.roi","i",n)}; - var roi_hi = ${rt("uniforms.roi",`i + ${t.length}`,n)}; - var input_shape_i = ${rt("uniforms.input_shape","i",t.length)}; - var output_shape_i = ${rt("uniforms.output_shape","i",s.length)}; - var original_idx = getOriginalCoordinateFromResizedCoordinate(output_index, scale, output_shape_i, - input_shape_i, roi_low, roi_hi); - if (!${o} || (original_idx >= 0 && original_idx < ${r.type.value}(input_shape_i))) { - if (original_idx < 0) { - input_index = 0; - } else if (original_idx > ${r.type.value}(input_shape_i - 1)) { - input_index = input_shape_i - 1; - } else { - input_index = u32(getNearestPixelFromOriginal(original_idx, scale < 1)); - } - } else { - input_index = u32(original_idx); - } - } - ${e.indicesSet("input_indices","i","input_index")} - } - return input_indices; - }`,jg=(e,r)=>` - fn checkInputIndices(input_indices: ${e.type.indices}) -> bool { - for (var i:u32 = 0; i < ${r.length}; i++) { - var input_index = ${e.indicesGet("input_indices","i")}; - if (input_index < 0 || input_index >= ${rt("uniforms.input_shape","i",r.length)}) { - return false; - } - } - return true; - }`,Ic=(e,r,t,s)=>e.rank>s?` - ${e.indicesSet("input_indices",r,"channel")}; - ${e.indicesSet("input_indices",t,"batch")}; -`:"",Vg=(e,r,t,s,i)=>{let[n,o,a,l]=t.length===2?[-1,0,1,-1]:[0,2,3,1],c=e.type.value;return` - fn getInputValue(batch: u32, channel: u32, row: u32, col: u32) -> ${c} { - var input_indices: ${e.type.indices}; - ${e.indicesSet("input_indices",o,`max(0, min(row, ${t[o]} - 1))`)}; - ${e.indicesSet("input_indices",a,`max(0, min(col, ${t[a]} - 1))`)}; - ${Ic(e,l,n,2)} - return ${e.getByIndices("input_indices")}; - } - - fn bilinearInterpolation(output_indices: ${r.type.indices}) -> ${c} { - var originalIndices = calculateOriginalIndicesFromOutputIndices(output_indices); - var row:${c} = originalIndices[${o}]; - var col:${c} = originalIndices[${a}]; - ${s?`if (row < 0 || row > (${t[o]} - 1) || col < 0 || col > (${t[a]} - 1)) { - return ${i}; - }`:""}; - row = max(0, min(row, ${t[o]} - 1)); - col = max(0, min(col, ${t[a]} - 1)); - var row1: u32 = u32(row); - var col1: u32 = u32(col); - var row2: u32 = u32(row + 1); - var col2: u32 = u32(col + 1); - var channel: u32 = ${t.length>2?`u32(originalIndices[${l}])`:"0"}; - var batch: u32 = ${t.length>2?`u32(originalIndices[${n}])`:"0"}; - var x11: ${c} = getInputValue(batch, channel, row1, col1); - var x12: ${c} = getInputValue(batch, channel, row1, col2); - var x21: ${c} = getInputValue(batch, channel, row2, col1); - var x22: ${c} = getInputValue(batch, channel, row2, col2); - var dx1: ${c} = abs(row - ${c}(row1)); - var dx2: ${c} = abs(${c}(row2) - row); - var dy1: ${c} = abs(col - ${c}(col1)); - var dy2: ${c} = abs(${c}(col2) - col); - if (row1 == row2) { - dx1 = 0.5; - dx2 = 0.5; - } - if (col1 == col2) { - dy1 = 0.5; - dy2 = 0.5; - } - return (x11 * dx2 * dy2 + x12 * dx2 * dy1 + x21 * dx1 * dy2 + x22 * dx1 * dy1); - }`},Ug=(e,r,t,s,i,n,o,a,l,c)=>{let p=t.length===2,[u,h]=p?[0,1]:[2,3],g=e.type.value,_=P=>{let A=P===u?"row":"col";return` - fn ${A}CubicInterpolation(input_indices: ${e.type.indices}, output_indices: ${r.type.indices}) -> ${g} { - var output_index = ${r.indicesGet("output_indices",P)}; - var originalIdx: ${g} = getOriginalCoordinateFromResizedCoordinate(output_index, ${i[P]}, - ${s[P]}, ${t[P]}, ${n[P]}, ${n[P]} + ${t.length}); - var fractOriginalIdx: ${g} = originalIdx - floor(originalIdx); - var coefs = getCubicInterpolationCoefs(fractOriginalIdx); - - if (${a} && (originalIdx < 0 || originalIdx > (${t[P]} - 1))) { - return ${l}; - } - var data: array<${g}, 4> = array<${g}, 4>(0.0, 0.0, 0.0, 0.0); - for (var i: i32 = -1; i < 3; i++) { - var ${A}: ${g} = originalIdx + ${g}(i); - if (${A} < 0 || ${A} >= ${t[P]}) { - ${c?`coefs[i + 1] = 0.0; - continue;`:a?`return ${l};`:`${A} = max(0, min(${A}, ${t[P]} - 1));`}; - } - var input_indices_copy: ${e.type.indices} = input_indices; - ${e.indicesSet("input_indices_copy",P,`u32(${A})`)}; - data[i + 1] = ${P===u?e.getByIndices("input_indices_copy"):"rowCubicInterpolation(input_indices_copy, output_indices)"}; - } - return cubicInterpolation1D(data, coefs); - }`};return` - ${_(u)}; - ${_(h)}; - fn getCubicInterpolationCoefs(s: ${g}) -> array<${g}, 4> { - var absS = abs(s); - var coeffs: array<${g}, 4> = array<${g}, 4>(0.0, 0.0, 0.0, 0.0); - var oneMinusAbsS: ${g} = 1.0 - absS; - var twoMinusAbsS: ${g} = 2.0 - absS; - var onePlusAbsS: ${g} = 1.0 + absS; - coeffs[0] = ((${o} * onePlusAbsS - 5 * ${o}) * onePlusAbsS + 8 * ${o}) * onePlusAbsS - 4 * ${o}; - coeffs[1] = ((${o} + 2) * absS - (${o} + 3)) * absS * absS + 1; - coeffs[2] = ((${o} + 2) * oneMinusAbsS - (${o} + 3)) * oneMinusAbsS * oneMinusAbsS + 1; - coeffs[3] = ((${o} * twoMinusAbsS - 5 * ${o}) * twoMinusAbsS + 8 * ${o}) * twoMinusAbsS - 4 * ${o}; - return coeffs; - } - - fn cubicInterpolation1D(x: array<${g}, 4>, coefs: array<${g}, 4>) -> ${g} { - var coefsSum: ${g} = coefs[0] + coefs[1] + coefs[2] + coefs[3]; - return (x[0] * coefs[0] + x[1] * coefs[1]+ x[2] * coefs[2]+ x[3] * coefs[3]) / coefsSum; - } - - fn bicubicInterpolation(output_indices: ${r.type.indices}) -> ${g} { - var input_indices: ${e.type.indices} = output_indices; - return colCubicInterpolation(input_indices, output_indices); - } - `},Wg=(e,r,t,s,i)=>{let[n,o,a,l,c]=t.length===3?[-1,0,1,2,-1]:[0,2,3,4,1],p=e.type.value;return` - fn getInputValue(batch: u32, channel: u32, depth:u32, height: u32, width: u32) -> ${p} { - var input_indices: ${e.type.indices}; - ${e.indicesSet("input_indices",o,`max(0, min(depth, ${t[o]} - 1))`)}; - ${e.indicesSet("input_indices",a,`max(0, min(height, ${t[a]} - 1))`)}; - ${e.indicesSet("input_indices",l,`max(0, min(width, ${t[l]} - 1))`)}; - ${Ic(e,c,n,3)} - return ${e.getByIndices("input_indices")}; - } - - fn trilinearInterpolation(output_indices: ${r.type.indices}) -> ${p} { - var originalIndices = calculateOriginalIndicesFromOutputIndices(output_indices); - var depth:${p} = originalIndices[${o}]; - var height:${p} = originalIndices[${a}]; - var width:${p} = originalIndices[${l}]; - ${s?`if (depth < 0 || depth > (${t[o]} - 1) || height < 0 || height > (${t[a]} - 1) || width < 0 || (width > ${t[l]} - 1)) { - return ${i}; - }`:""}; - - depth = max(0, min(depth, ${t[o]} - 1)); - height = max(0, min(height, ${t[a]} - 1)); - width = max(0, min(width, ${t[l]} - 1)); - var depth1: u32 = u32(depth); - var height1: u32 = u32(height); - var width1: u32 = u32(width); - var depth2: u32 = u32(depth + 1); - var height2: u32 = u32(height + 1); - var width2: u32 = u32(width + 1); - var channel: u32 = ${t.length>3?`u32(originalIndices[${c}])`:"0"}; - var batch: u32 = ${t.length>3?`u32(originalIndices[${n}])`:"0"}; - - var x111: ${p} = getInputValue(batch, channel, depth1, height1, width1); - var x112: ${p} = getInputValue(batch, channel, depth1, height1, width2); - var x121: ${p} = getInputValue(batch, channel, depth1, height2, width1); - var x122: ${p} = getInputValue(batch, channel, depth1, height2, width2); - var x211: ${p} = getInputValue(batch, channel, depth2, height1, width1); - var x212: ${p} = getInputValue(batch, channel, depth2, height1, width2); - var x221: ${p} = getInputValue(batch, channel, depth2, height2, width1); - var x222: ${p} = getInputValue(batch, channel, depth2, height2, width2); - var dx1: ${p} = abs(depth - ${p}(depth1)); - var dx2: ${p} = abs(${p}(depth2) - depth); - var dy1: ${p} = abs(height - ${p}(height1)); - var dy2: ${p} = abs(${p}(height2) - height); - var dz1: ${p} = abs(width - ${p}(width1)); - var dz2: ${p} = abs(${p}(width2) - width); - if (depth1 == depth2) { - dx1 = 0.5; - dx2 = 0.5; - } - if (height1 == height2) { - dy1 = 0.5; - dy2 = 0.5; - } - if (width1 == width2) { - dz1 = 0.5; - dz2 = 0.5; - } - return (x111 * dx2 * dy2 * dz2 + x112 * dx2 * dy2 * dz1 + x121 * dx2 * dy1 *dz2 + x122 * dx2 * dy1 * dz1 + - x211 * dx1 * dy2 * dz2 + x212 * dx1 * dy2 * dz1 + x221 * dx1 * dy1 *dz2 + x222 * dx1 * dy1 * dz1); - }`},Gg=(e,r,t,s,i,n)=>{let o=e.dims,a=Lg(n,r.axes,o.length),l=zg(o,s,i,r.axes),c=s.slice();s.length===0&&(c=o.map((y,k)=>y===0?1:l[k]/y),r.keepAspectRatioPolicy!=="stretch"&&(l=Bg(o,c,r)));let p=tt("output",e.dataType,l.length),u=$e("input",e.dataType,o.length),h=Te.size(l),g=o.length===l.length&&o.every((y,k)=>y===l[k]),_=r.coordinateTransformMode==="tf_crop_and_resize",P=r.extrapolationValue,A=u.type.value,v=y=>` - ${g?"":` - ${Og(r.coordinateTransformMode,A)}; - ${(()=>{switch(r.mode){case"nearest":return` - ${jg(u,o)}; - ${Dg(r.nearestMode,t,A)}; - ${Ng(u,p,o,l,c.length,a.length,_)}; - `;case"linear":return` - ${Rg(p,o,l,c.length,a.length)}; - ${(()=>{if(o.length===2||o.length===4)return`${Vg(u,p,o,_,P)}`;if(o.length===3||o.length===5)return`${Wg(u,p,o,_,P)}`;throw Error("Linear mode only supports input dims 2, 3, 4 and 5 are supported in linear mode.")})()}; - `;case"cubic":return` - ${(()=>{if(o.length===2||o.length===4)return`${Ug(u,p,o,l,c,a,r.cubicCoeffA,_,r.extrapolationValue,r.excludeOutside)}`;throw Error("Cubic mode only supports input dims 2 and 4 are supported in linear mode.")})()}; - `;default:throw Error("Invalid resize mode")}})()}; - `} - ${y.registerUniform("output_size","u32").registerUniform("scales","f32",c.length).registerUniform("roi","f32",a.length).declareVariables(u,p)} - ${y.mainStart()} - ${y.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - ${g?"output[global_idx] = input[global_idx];":` - let output_indices = ${p.offsetToIndices("global_idx")}; - var input_indices: ${u.type.indices}; - ${(()=>{switch(r.mode){case"nearest":return`input_indices = calculateInputIndicesFromOutputIndices(output_indices); - if (checkInputIndices(input_indices)) { - output[global_idx] = ${u.getByIndices("input_indices")}; - } else { - output[global_idx] = ${r.extrapolationValue}; - }`;case"linear":return`output[global_idx] = ${o.length===2||o.length===4?"bilinearInterpolation":"trilinearInterpolation"}(output_indices);`;case"cubic":return"output[global_idx] = bicubicInterpolation(output_indices);";default:throw Error(`Unsupported resize mode: ${r.mode}`)}})()}; -`} - }`;return{name:"Resize",shaderCache:{hint:`${r.cacheKey}|${t}|${c.length>0?r.mode==="cubic"?c:c.length:""}|${i.length>0?i:""}|${a.length>0?a:""}|${g}|${r.mode==="nearest"?o.length:o}`,inputDependencies:["rank"]},getShaderSource:v,getRunData:()=>({outputs:[{dims:l,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(h/64)},programUniforms:[{type:12,data:h},{type:1,data:c},{type:1,data:a},...nt(o,l)]})}},Kg=e=>{let r=e.customDataBuffer;return new Uint32Array(r,r.byteOffset,1)[0]},Hg=(e,r)=>{let t=[],s=[],i=[],n=Kg(e);if(r.antialias!==0)throw Error("Only default value (0) for Antialias attribute is supported");Fg(e.inputs,r,n,t,s,i),e.compute(Gg(e.inputs[0],r,n,t,s,i),{inputs:[0]})},qg=e=>{let r=e.antialias,t=e.axes,s=e.coordinateTransformMode,i=e.cubicCoeffA,n=e.excludeOutside!==0,o=e.extrapolationValue,a=e.keepAspectRatioPolicy,l=e.mode,c=e.nearestMode===""?"simple":e.nearestMode;return Dt({antialias:r,axes:t,coordinateTransformMode:s,cubicCoeffA:i,excludeOutside:n,extrapolationValue:o,keepAspectRatioPolicy:a,mode:l,nearestMode:c})}}),Qg,Xg,Jg,qv=Ve(()=>{pt(),Mt(),Yt(),Tt(),Qg=(e,r)=>{let[t,s,i,n]=e,{numHeads:o,rotaryEmbeddingDim:a}=r;if(t.dims.length!==3&&t.dims.length!==4)throw new Error(`Input 'x' is expected to have 3 or 4 dimensions, got ${t.dims.length}`);if(!Te.areEqual(s.dims,[])&&!Te.areEqual(s.dims,[1])&&s.dims.length!==2)throw new Error(`Input 'position_ids' is expected to have 0, 1, or 2 dimensions, got ${s.dims.length}`);if(i.dims.length!==2)throw new Error(`Input 'cos_cache' is expected to have 2 dimensions, got ${i.dims.length}`);if(n.dims.length!==2)throw new Error(`Input 'sin_cache' is expected to have 2 dimensions, got ${n.dims.length}`);if(!Te.areEqual(i.dims,n.dims))throw new Error("Inputs 'cos_cache' and 'sin_cache' are expected to have the same shape");if(a>0&&o===0)throw new Error("num_heads must be provided if rotary_embedding_dim is specified");let l=t.dims[0],c=t.dims[t.dims.length-2],p=i.dims[0],u=Te.sizeFromDimension(t.dims,1)/c,h=a===0?i.dims[1]*2:u/o;if(a>h)throw new Error("rotary_embedding_dim must be less than or equal to head_size");if(s.dims.length===2){if(l!==s.dims[0])throw new Error(`Input 'position_ids' dimension 0 should be of size batch_size, got ${s.dims[0]}`);if(c!==s.dims[1])throw new Error(`Input 'position_ids' dimension 1 should be of size sequence_length, got ${s.dims[1]}`)}if(h/2!==i.dims[1]&&a/2!==i.dims[1])throw new Error(`Input 'cos_cache' dimension 1 should be same as head_size / 2 or rotary_embedding_dim / 2, got ${i.dims[1]}`);if(c>p)throw new Error("Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported")},Xg=(e,r)=>{let{interleaved:t,numHeads:s,rotaryEmbeddingDim:i,scale:n}=r,o=e[0].dims[0],a=Te.sizeFromDimension(e[0].dims,1),l=e[0].dims[e[0].dims.length-2],c=a/l,p=e[2].dims[1],u=i===0?p*2:c/s,h=new Array(o,l,c/u,u-p),g=Te.computeStrides(h),_=[{type:1,data:n},{type:12,data:h},{type:12,data:g},...e[0].dims.length===3?new Array({type:12,data:[a,c,u,1]}):[],...e[0].dims.length===4?new Array({type:12,data:[a,u,l*u,1]}):[],...nt(e[0].dims,e[1].dims,e[2].dims,e[3].dims,e[0].dims)],P=A=>{let v=$e("input",e[0].dataType,e[0].dims.length),y=$e("position_ids",e[1].dataType,e[1].dims.length),k=$e("cos_cache",e[2].dataType,e[2].dims.length),E=$e("sin_cache",e[3].dataType,e[3].dims.length),M=tt("output",e[0].dataType,e[0].dims.length);return A.registerUniforms([{name:"scale",type:"f32"},{name:"global_shape",type:"u32",length:h.length},{name:"global_strides",type:"u32",length:g.length},{name:"input_output_strides",type:"u32",length:g.length}]),` - ${A.declareVariables(v,y,k,E,M)} - - ${A.mainStart(jn)} - let half_rotary_emb_dim = uniforms.${k.name}_shape[1]; - let bsnh = global_idx / uniforms.global_strides % uniforms.global_shape; - let size = uniforms.global_shape[0] * uniforms.global_strides[0]; - ${A.guardAgainstOutOfBoundsWorkgroupSizes("size")} - - if (bsnh[3] < half_rotary_emb_dim) { - let position_ids_idx = - ${y.broadcastedIndicesToOffset("bsnh.xy",tt("",y.type.tensor,2))}; - let position_id = - u32(${y.getByOffset("position_ids_idx")}) + select(0, bsnh[1], position_ids_idx == 0); - let i = dot(bsnh, uniforms.input_output_strides) + select(0, bsnh[3], ${t}); - let j = i + select(half_rotary_emb_dim, 1, ${t}); - let re = ${v.getByOffset("i")} * ${k.get("position_id","bsnh[3]")} - - ${v.getByOffset("j")} * ${E.get("position_id","bsnh[3]")}; - ${M.setByOffset("i","re")} - let im = ${v.getByOffset("i")} * ${E.get("position_id","bsnh[3]")} + - ${v.getByOffset("j")} * ${k.get("position_id","bsnh[3]")}; - ${M.setByOffset("j","im")} - } else { - let k = dot(bsnh, uniforms.input_output_strides) + half_rotary_emb_dim; - ${M.setByOffset("k",v.getByOffset("k"))} - } - }`};return{name:"RotaryEmbedding",shaderCache:{hint:Dt({interleaved:t}).cacheKey,inputDependencies:["rank","rank","rank","rank"]},getShaderSource:P,getRunData:()=>({outputs:[{dims:e[0].dims,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(Te.size(h)/jn)},programUniforms:_})}},Jg=(e,r)=>{Qg(e.inputs,r),e.compute(Xg(e.inputs,r))}}),Yg,Zg,ew,Qv=Ve(()=>{pt(),Mt(),Tt(),Yg=e=>{if(!e||e.length<3)throw new Error("layerNorm requires at least 3 inputs.");let r=e[0],t=e[1],s=e[2];if(r.dataType!==t.dataType||r.dataType!==s.dataType)throw new Error("All inputs must have the same data type");if(r.dims.length!==3&&r.dims.length!==2)throw new Error("Input must be 2D or 3D");if(t.dims.length!==3&&t.dims.length!==2)throw new Error("Skip must be 2D or 3D");let i=r.dims[r.dims.length-1],n=r.dims[r.dims.length-2];if(t.dims[t.dims.length-1]!==i)throw new Error("Skip must have the same hidden size as input");if(t.dims[t.dims.length-2]!==n)throw new Error("Skip must have the same sequence length as input");if(s.dims.length!==1)throw new Error("Gamma must be 1D");if(s.dims[s.dims.length-1]!==i)throw new Error("Gamma must have the same hidden size as input");if(e.length>3){let o=e[3];if(o.dims.length!==1)throw new Error("Beta must be 1D");if(o.dims[o.dims.length-1]!==i)throw new Error("Beta must have the same hidden size as input")}if(e.length>4){let o=e[4];if(o.dims.length!==1)throw new Error("Bias must be 1D");if(o.dims[o.dims.length-1]!==i)throw new Error("Bias must have the same hidden size as input")}},Zg=(e,r,t,s)=>{let i=r.simplified,n=e[0].dims,o=Te.size(n),a=n,l=o,c=n.slice(-1)[0],p=s?n.slice(0,-1).concat(1):[],u=!i&&e.length>3,h=e.length>4,g=s&&t>1,_=s&&t>2,P=t>3,A=64,v=Xt(c),y=[{type:12,data:l},{type:12,data:v},{type:12,data:c},{type:1,data:r.epsilon}],k=M=>{let w=[{name:"output_size",type:"u32"},{name:"components",type:"u32"},{name:"hidden_size",type:"u32"},{name:"epsilon",type:"f32"}],x=[$e("x",e[0].dataType,e[0].dims,v),$e("skip",e[1].dataType,e[1].dims,v),$e("gamma",e[2].dataType,e[2].dims,v)];u&&x.push($e("beta",e[3].dataType,e[3].dims,v)),h&&x.push($e("bias",e[4].dataType,e[4].dims,v)),x.push(tt("output",e[0].dataType,a,v)),g&&x.push(tt("mean_output",1,p)),_&&x.push(tt("inv_std_output",1,p)),P&&x.push(tt("input_skip_bias_sum",e[0].dataType,a,v));let $=lr(e[0].dataType),z=lr(1,v);return` - - ${M.registerUniforms(w).declareVariables(...x)} - var sum_shared : array<${z}, ${A}>; - var sum_squared_shared : array<${z}, ${A}>; - - ${M.mainStart([A,1,1])} - let ix = local_id.x; - let iy = global_id.x / ${A}; - - let hidden_size_vectorized: u32 = uniforms.hidden_size / uniforms.components; - var stride = hidden_size_vectorized / ${A}; - let offset = ix * stride + iy * hidden_size_vectorized; - let offset1d = stride * ix; - if (ix == ${A-1}) { - stride = hidden_size_vectorized - stride * ix; - } - for (var i: u32 = 0; i < stride; i++) { - let skip_value = skip[offset + i]; - let bias_value = ${h?"bias[offset1d + i]":$+"(0.0)"}; - let input_value = x[offset + i]; - let value = input_value + skip_value + bias_value; - ${P?"input_skip_bias_sum[offset + i] = value;":""} - output[offset + i] = value; - let f32_value = ${Vn($,v,"value")}; - sum_shared[ix] += f32_value; - sum_squared_shared[ix] += f32_value * f32_value; - } - workgroupBarrier(); - - var reduce_size : u32 = ${A}; - for (var curr_size = reduce_size >> 1; curr_size > 0; curr_size = reduce_size >> 1) { - reduce_size = curr_size + (reduce_size & 1); - if (ix < curr_size) { - sum_shared[ix] += sum_shared[ix + reduce_size]; - sum_squared_shared[ix] += sum_squared_shared[ix + reduce_size]; - } - workgroupBarrier(); - } - - let sum = sum_shared[0]; - let square_sum = sum_squared_shared[0]; - let mean = ${Gs("sum",v)} / f32(uniforms.hidden_size); - let inv_std_dev = inverseSqrt(${Gs("square_sum",v)} / f32(uniforms.hidden_size) ${i?"":"- mean * mean"} + uniforms.epsilon); - ${g?"mean_output[global_idx] = mean;":""} - ${_?"inv_std_output[global_idx] = inv_std_dev;":""} - - for (var i: u32 = 0; i < stride; i++) { - output[offset + i] = (output[offset + i] ${i?"":`- ${$}(mean)`}) * - ${$}(inv_std_dev) * gamma[offset1d + i] - ${u?"+ beta[offset1d + i]":""}; - } - }`},E=[{dims:a,dataType:e[0].dataType}];return t>1&&E.push({dims:p,dataType:1}),t>2&&E.push({dims:p,dataType:1}),t>3&&E.push({dims:n,dataType:e[0].dataType}),{name:"SkipLayerNormalization",shaderCache:{hint:`${v};${g};${_};${P}`,inputDependencies:e.map((M,w)=>"type")},getShaderSource:k,getRunData:()=>({outputs:E,dispatchGroup:{x:Math.ceil(l/c)},programUniforms:y})}},ew=(e,r)=>{Yg(e.inputs);let t=[0];e.outputCount>1&&t.push(-3),e.outputCount>2&&t.push(-3),e.outputCount>3&&t.push(3),e.compute(Zg(e.inputs,r,e.outputCount,!1),{outputs:t})}}),tw,ji,rw,Ac,sw,nw,iw,ow,Xv=Ve(()=>{pt(),Mt(),Yt(),Tt(),tw=(e,r)=>{if(!e||e.length<1)throw new Error("too few inputs");if(r.axes.length!==0){if(r.axes.length!==r.starts.length||r.axes.length!==r.ends.length)throw new Error("axes, starts and ends must have the same length")}else if(r.starts.length!==r.ends.length)throw new Error("starts and ends must have the same length");e.slice(1).forEach((t,s)=>{if(e[s+1].dataType!==6&&e[s+1].dataType!==7)throw new Error(`Input ${s} must be an array of int32 or int64`)})},ji=(e,r)=>{let t=[];if(e.length>r)if(e[r].dataType===7)e[r].getBigInt64Array().forEach(s=>t.push(Number(s)));else if(e[r].dataType===6)e[r].getInt32Array().forEach(s=>t.push(Number(s)));else throw new Error(`Input ${r} must be an array of int32 or int64`);return t},rw=(e,r)=>{if(e.length>1){let t=ji(e,1),s=ji(e,2),i=ji(e,3);return i.length===0&&(i=[...Array(e[0].dims.length).keys()]),Dt({starts:t,ends:s,axes:i})}else return r},Ac=(e,r,t,s,i)=>{let n=e;return e<0&&(n+=t[s[r]]),i[r]<0?Math.max(0,Math.min(n,t[s[r]]-1)):Math.max(0,Math.min(n,t[s[r]]))},sw=(e,r,t)=>`fn calculateInputIndices(output_indices: ${r.type.indices}) -> ${e.type.indices} { - var input_indices: ${e.type.indices}; - var carry = 0u; - for (var i = ${t.length}; i >= 0; i--) { - let input_shape_i = ${rt("uniforms.input_shape","i",t.length)}; - let steps_i = ${rt("uniforms.steps","i",t.length)}; - let signs_i = ${rt("uniforms.signs","i",t.length)}; - let starts_i = ${rt("uniforms.starts","i",t.length)}; - var output_index = ${r.indicesGet("output_indices","i")}; - var input_index = output_index * steps_i + starts_i + carry; - carry = input_index / input_shape_i; - input_index = input_index % input_shape_i; - if (signs_i < 0) { - input_index = input_shape_i - input_index - 1u + starts_i; - } - ${e.indicesSet("input_indices","i","input_index")}; - } - return input_indices; - }`,nw=(e,r)=>{let t=e[0].dims,s=Te.size(t),i=r.axes.length>0?Te.normalizeAxes(r.axes,t.length):[...Array(t.length).keys()],n=ji(e,4);n.forEach(v=>v!==0||(()=>{throw new Error("step cannot be 0")})),n.length===0&&(n=Array(i.length).fill(1));let o=r.starts.map((v,y)=>Ac(v,y,t,i,n)),a=r.ends.map((v,y)=>Ac(v,y,t,i,n));if(i.length!==o.length||i.length!==a.length)throw new Error("start, ends and axes should have the same number of elements");if(i.length!==t.length)for(let v=0;vMath.sign(v));n.forEach((v,y,k)=>{if(v<0){let E=(a[y]-o[y])/v,M=o[y],w=M+E*n[y];o[y]=w,a[y]=M,k[y]=-v}});let c=t.slice(0);i.forEach((v,y)=>{c[v]=Math.ceil((a[v]-o[v])/n[v])});let p={dims:c,dataType:e[0].dataType},u=tt("output",e[0].dataType,c.length),h=$e("input",e[0].dataType,e[0].dims.length),g=Te.size(c),_=[{name:"outputSize",type:"u32"},{name:"starts",type:"u32",length:o.length},{name:"signs",type:"i32",length:l.length},{name:"steps",type:"u32",length:n.length}],P=[{type:12,data:g},{type:12,data:o},{type:6,data:l},{type:12,data:n},...nt(e[0].dims,c)],A=v=>` - ${v.registerUniforms(_).declareVariables(h,u)} - ${sw(h,u,t)} - ${v.mainStart()} - ${v.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} - let output_indices = ${u.offsetToIndices("global_idx")}; - let input_indices = calculateInputIndices(output_indices); - ${u.setByOffset("global_idx",h.getByIndices("input_indices"))} - }`;return{name:"Slice",shaderCache:{hint:`${l.length}_${o.length}_${n.length}`,inputDependencies:["rank"]},getShaderSource:A,getRunData:()=>({outputs:[p],dispatchGroup:{x:Math.ceil(s/64)},programUniforms:P})}},iw=(e,r)=>{tw(e.inputs,r);let t=rw(e.inputs,r);e.compute(nw(e.inputs,t),{inputs:[0]})},ow=e=>{let r=e.starts,t=e.ends,s=e.axes;return Dt({starts:r,ends:t,axes:s})}}),aw,lw,dw,cw,Jv=Ve(()=>{pt(),Mt(),Yt(),Ks(),Tt(),aw=e=>{if(!e||e.length!==1)throw new Error("Softmax op requires 1 input.")},lw=(e,r)=>{let t=e.inputs[0],s=t.dims,i=Te.size(s),n=s.length,o=Te.normalizeAxis(r.axis,n),a=o$),c[o]=n-1,c[n-1]=o,l=e.compute(Nr(t,c),{inputs:[t],outputs:[-1]})[0]):l=t;let p=l.dims,u=p[n-1],h=i/u,g=Xt(u),_=u/g,P=64;h===1&&(P=256);let A=(x,$)=>$===4?`max(max(${x}.x, ${x}.y), max(${x}.z, ${x}.w))`:$===2?`max(${x}.x, ${x}.y)`:$===3?`max(max(${x}.x, ${x}.y), ${x}.z)`:x,v=$e("x",l.dataType,l.dims,g),y=tt("result",l.dataType,l.dims,g),k=v.type.value,E=lr(l.dataType)==="f32"?`var threadMax = ${k}(-3.402823e+38f);`:`var threadMax = ${k}(-65504.0h);`,M=x=>` - var rowMaxShared : ${k}; - var rowSumShared : ${k}; - var threadShared : array<${k}, ${P}>; - - fn getValue(row: i32, col: i32, row_stride: i32) -> ${k} { - let index = row * row_stride + col; - return x[index]; - } - - fn setValue(row: i32, col: i32, row_stride: i32, value: ${k}) { - let index = row * row_stride + col; - result[index] = value; - } - ${x.registerUniform("packedCols","i32").declareVariables(v,y)} - ${x.mainStart(P)} - let gindex = i32(global_idx); - let lindex = i32(local_idx); - const wg = ${P}; - let row = gindex / wg; - let cols = uniforms.packedCols; - let row_stride : i32 = uniforms.packedCols; - - // find the rows max - ${E} - for (var col = lindex; col < cols; col += wg) { - let value = getValue(row, col, row_stride); - threadMax = max(threadMax, value); - } - if (lindex < cols) { - threadShared[lindex] = threadMax; - } - workgroupBarrier(); - - var reduceSize = min(cols, wg); - for (var currSize = reduceSize >> 1; currSize > 0; currSize = reduceSize >> 1) { - reduceSize = currSize + (reduceSize & 1); - if (lindex < currSize) { - threadShared[lindex] = max(threadShared[lindex], threadShared[lindex + reduceSize]); - } - workgroupBarrier(); - } - if (lindex == 0) { - rowMaxShared = ${k}(${A("threadShared[0]",g)}); - } - workgroupBarrier(); - - // find the rows sum - var threadSum = ${k}(0.0); - for (var col = lindex; col < cols; col += wg) { - let subExp = exp(getValue(row, col, row_stride) - rowMaxShared); - threadSum += subExp; - } - threadShared[lindex] = threadSum; - workgroupBarrier(); - - for (var currSize = wg >> 1; currSize > 0; currSize = currSize >> 1) { - if (lindex < currSize) { - threadShared[lindex] = threadShared[lindex] + threadShared[lindex + currSize]; - } - workgroupBarrier(); - } - if (lindex == 0) { - rowSumShared = ${k}(${Gs("threadShared[0]",g)}); - } - workgroupBarrier(); - - // calculate final value for each element in the row - for (var col = lindex; col < cols; col += wg) { - let value = exp(getValue(row, col, row_stride) - rowMaxShared) / rowSumShared; - setValue(row, col, row_stride, value); - } - }`,w=e.compute({name:"Softmax",shaderCache:{hint:`${g};${P}`,inputDependencies:["type"]},getRunData:()=>({outputs:[{dims:p,dataType:l.dataType}],dispatchGroup:{x:h},programUniforms:[{type:6,data:_}]}),getShaderSource:M},{inputs:[l],outputs:[a?-1:0]})[0];a&&e.compute(Nr(w,c),{inputs:[w]})},dw=(e,r)=>{aw(e.inputs),lw(e,r)},cw=e=>Dt({axis:e.axis})}),Fc,uw,pw,hw,mw,Yv=Ve(()=>{pt(),Mt(),Tt(),Fc=e=>Array.from(e.getBigInt64Array(),Number),uw=e=>{if(!e||e.length!==2)throw new Error("Tile requires 2 inputs.");if(e[0].dataType!==1&&e[0].dataType!==10&&e[0].dataType!==6&&e[0].dataType!==12)throw new Error("Tile only support float, float16, int32, and uint32 data types");if(e[1].dataType!==7)throw new Error("Tile `repeats` input should be of int64 data type");if(e[1].dims.length!==1)throw new Error("Tile `repeats` input should be 1-D");if(Fc(e[1]).length!==e[0].dims.length)throw new Error("Tile `repeats` input should have same number of elements as rank of input data tensor")},pw=(e,r)=>{let t=[];for(let s=0;s{let t=e[0].dims,s=r??Fc(e[1]),i=pw(t,s),n=Te.size(i),o=e[0].dataType,a=$e("input",o,t.length),l=tt("output",o,i.length),c=p=>` - const inputShape = ${a.indices(...t)}; - ${p.registerUniform("output_size","u32").declareVariables(a,l)} - ${p.mainStart()} - ${p.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} - let output_indices = ${l.offsetToIndices("global_idx")}; - var input_indices: ${a.type.indices}; - for (var i = 0; i < ${t.length}; i++) { - let input_dim_i = ${a.indicesGet("uniforms.input_shape","i")}; - let input_dim_value = ${l.indicesGet("output_indices","i")} % input_dim_i; - - ${a.indicesSet("input_indices","i","input_dim_value")} - } - ${l.setByOffset("global_idx",a.getByIndices("input_indices"))} - }`;return{name:"Tile",shaderCache:{hint:`${s}`,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:i,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:[{type:12,data:n},...nt(e[0].dims,i)]}),getShaderSource:c}},mw=e=>{uw(e.inputs),e.compute(hw(e.inputs),{inputs:[0]})}}),fw,_w,gw,Zv=Ve(()=>{pt(),Mt(),Tt(),fw=(e,r,t,s,i)=>{let n=tt("output_data",i,t.length,4),o=$e("a_data",r[1].dataType,r[1].dims.length,4),a=$e("b_data",r[2].dataType,r[2].dims.length,4),l=$e("c_data",r[0].dataType,r[0].dims.length,4),c,p=(u,h,g)=>`select(${h}, ${u}, ${g})`;if(!s)c=n.setByOffset("global_idx",p(o.getByOffset("global_idx"),a.getByOffset("global_idx"),l.getByOffset("global_idx")));else{let u=(h,g,_="")=>{let P=`a_data[index_a${g}][component_a${g}]`,A=`b_data[index_b${g}][component_b${g}]`,v=`bool(c_data[index_c${g}] & (0xffu << (component_c${g} * 8)))`;return` - let output_indices${g} = ${n.offsetToIndices(`global_idx * 4u + ${g}u`)}; - let offset_a${g} = ${o.broadcastedIndicesToOffset(`output_indices${g}`,n)}; - let offset_b${g} = ${a.broadcastedIndicesToOffset(`output_indices${g}`,n)}; - let offset_c${g} = ${l.broadcastedIndicesToOffset(`output_indices${g}`,n)}; - let index_a${g} = offset_a${g} / 4u; - let index_b${g} = offset_b${g} / 4u; - let index_c${g} = offset_c${g} / 4u; - let component_a${g} = offset_a${g} % 4u; - let component_b${g} = offset_b${g} % 4u; - let component_c${g} = offset_c${g} % 4u; - ${h}[${g}] = ${_}(${p(P,A,v)}); - `};i===9?c=` - var data = vec4(0); - ${u("data",0,"u32")} - ${u("data",1,"u32")} - ${u("data",2,"u32")} - ${u("data",3,"u32")} - output_data[global_idx] = dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(data));`:c=` - ${u("output_data[global_idx]",0)} - ${u("output_data[global_idx]",1)} - ${u("output_data[global_idx]",2)} - ${u("output_data[global_idx]",3)} - `}return` - ${e.registerUniform("vec_size","u32").declareVariables(l,o,a,n)} - ${e.mainStart()} - ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} - ${c} - }`},_w=e=>{let r=e[1].dims,t=e[2].dims,s=e[0].dims,i=e[1].dataType,n=!(Te.areEqual(r,t)&&Te.areEqual(t,s)),o=r,a=Te.size(r);if(n){let c=Nn.calcShape(Nn.calcShape(r,t,!1),s,!1);if(!c)throw new Error("Can't perform where op on the given tensors");o=c,a=Te.size(o)}let l=Math.ceil(a/4);return{name:"Where",shaderCache:{inputDependencies:["rank","rank","rank"]},getShaderSource:c=>fw(c,e,o,n,i),getRunData:()=>({outputs:[{dims:o,dataType:i}],dispatchGroup:{x:Math.ceil(a/64/4)},programUniforms:[{type:12,data:l},...nt(s,r,t,o)]})}},gw=e=>{e.compute(_w(e.inputs))}}),ww,eT=Ve(()=>{hv(),Qd(),mv(),fv(),_v(),gv(),wv(),Tv(),Ev(),Pv(),Cv(),Sv(),$v(),kv(),Iv(),Av(),Fv(),Ov(),Dv(),Lv(),zv(),Bv(),Rv(),Nv(),jv(),I_(),Vv(),Uv(),Wv(),Gv(),Kv(),Kd(),Hv(),qv(),Qv(),Xv(),Jv(),B_(),Yv(),Ks(),Zd(),Zv(),ww=new Map([["Abs",[Yh]],["Acos",[Zh]],["Acosh",[em]],["Add",[jm]],["ArgMax",[zh,qd]],["ArgMin",[Lh,qd]],["Asin",[tm]],["Asinh",[rm]],["Atan",[sm]],["Atanh",[nm]],["Attention",[Uh]],["AveragePool",[hg,pg]],["BatchNormalization",[Hh]],["BiasAdd",[Xh]],["BiasSplitGelu",[Bm]],["Cast",[om,im]],["Ceil",[dm]],["Clip",[lm]],["Concat",[tf,rf]],["Conv",[pc,cc]],["ConvTranspose",[kf,Cf]],["Cos",[cm]],["Cosh",[um]],["CumSum",[Af,Ff]],["DepthToSpace",[zf,Bf]],["DequantizeLinear",[vg,Tg]],["Div",[Vm]],["Einsum",[Wf,Gf]],["Elu",[pm,Di]],["Equal",[Um]],["Erf",[hm]],["Exp",[mm]],["Expand",[Qf]],["FastGelu",[Jf]],["Floor",[fm]],["FusedConv",[pc,cc]],["Gather",[t_,e_]],["GatherElements",[p_,u_]],["GatherBlockQuantized",[a_,l_]],["GatherND",[s_,n_]],["Gelu",[_m]],["Gemm",[__,f_]],["GlobalAveragePool",[fg,mg]],["GlobalMaxPool",[yg,wg]],["Greater",[Hm]],["GreaterOrEqual",[Qm]],["GridSample",[E_,P_]],["GroupQueryAttention",[j_]],["HardSigmoid",[xm,Tm]],["InstanceNormalization",[W_]],["LayerNormalization",[H_]],["LeakyRelu",[gm,Di]],["Less",[qm]],["LessOrEqual",[Xm]],["Log",[Am]],["MatMul",[Q_]],["MatMulNBits",[Z_,eg]],["MaxPool",[_g,gg]],["Mul",[Wm]],["MultiHeadAttention",[k_,S_]],["Neg",[ym]],["Not",[wm]],["Pad",[dg]],["Pow",[Gm]],["QuickGelu",[Dm,Di]],["Range",[Pg]],["Reciprocal",[Mm]],["ReduceMin",[Ih]],["ReduceMean",[Ph]],["ReduceMax",[kh]],["ReduceSum",[Fh]],["ReduceProd",[Ah]],["ReduceL1",[Ch]],["ReduceL2",[Sh]],["ReduceLogSum",[Dh]],["ReduceLogSumExp",[$h]],["ReduceSumSquare",[Oh]],["Relu",[bm]],["Resize",[Hg,qg]],["RotaryEmbedding",[Jg]],["ScatterND",[kg,$g]],["Sigmoid",[vm]],["Sin",[Em]],["Sinh",[Pm]],["Slice",[iw,ow]],["SkipLayerNormalization",[ew]],["Split",[L_,z_]],["Sqrt",[Cm]],["Softmax",[dw,cw]],["Sub",[Km]],["Tan",[Sm]],["Tanh",[$m]],["ThresholdedRelu",[Im,Di]],["Tile",[mw]],["Transpose",[Hp,qp]],["Where",[gw]]])}),yw,tT=Ve(()=>{ss(),Is(),Tt(),yw=class{constructor(e){this.backend=e,this.repo=new Map,this.attributesBound=!1}getArtifact(e){return this.repo.get(e)}setArtifact(e,r){this.repo.set(e,r)}run(e,r,t,s,i){rs(e.programInfo.name);let n=this.backend.device,o=this.backend.getComputePassEncoder();this.backend.writeTimestamp(this.backend.pendingDispatchNumber*2);let a=[];for(let c of r)a.push({binding:a.length,resource:{buffer:c.buffer}});for(let c of t)a.push({binding:a.length,resource:{buffer:c.buffer}});i&&a.push({binding:a.length,resource:i});let l=n.createBindGroup({layout:e.computePipeline.getBindGroupLayout(0),entries:a,label:e.programInfo.name});if(this.backend.sessionStatus==="capturing"){let c={kernelId:this.backend.currentKernelId,computePipeline:e.computePipeline,bindGroup:l,dispatchGroup:s};this.backend.capturedCommandList.get(this.backend.currentSessionId).push(c)}o.setPipeline(e.computePipeline),o.setBindGroup(0,l),o.dispatchWorkgroups(...s),this.backend.writeTimestamp(this.backend.pendingDispatchNumber*2+1),this.backend.pendingDispatchNumber++,(this.backend.pendingDispatchNumber>=this.backend.maxDispatchNumber||this.backend.queryType==="at-passes")&&this.backend.endComputePass(),this.backend.pendingDispatchNumber>=this.backend.maxDispatchNumber&&this.backend.flush(),Hr(e.programInfo.name)}dispose(){}build(e,r){rs(e.name);let t=this.backend.device,s=[];[{feature:"shader-f16",extension:"f16"},{feature:"subgroups",extension:"subgroups"}].forEach(c=>{t.features.has(c.feature)&&s.push(`enable ${c.extension};`)});let i=jp(r,this.backend.device.limits),n=e.getShaderSource(i),o=`${s.join(` -`)} -${i.additionalImplementations} -${n}`,a=t.createShaderModule({code:o,label:e.name});St("verbose",()=>`[WebGPU] ${e.name} shader code: ${o}`);let l=t.createComputePipeline({compute:{module:a,entryPoint:"main"},layout:"auto",label:e.name});return Hr(e.name),{programInfo:e,computePipeline:l,uniformVariablesInfo:i.variablesInfo}}normalizeDispatchGroupSize(e){let r=typeof e=="number"?e:e.x,t=typeof e=="number"?1:e.y||1,s=typeof e=="number"?1:e.z||1,i=this.backend.device.limits.maxComputeWorkgroupsPerDimension;if(r<=i&&t<=i&&s<=i)return[r,t,s];let n=r*t*s,o=Math.ceil(Math.sqrt(n));if(o>i){if(o=Math.ceil(Math.cbrt(n)),o>i)throw new Error("Total dispatch size exceeds WebGPU maximum.");return[o,o,o]}else return[o,o,1]}}}),Mw,bw,vw,Tw,rT=Ve(()=>{ss(),pt(),Is(),$p(),uv(),eT(),tT(),Mw=(e,r)=>{if(r.length!==e.length)throw new Error(`inputDependencies length ${r.length} is not equal to inputTensors length ${e.length}.`);let t=[];for(let s=0;s{var i,n;let s=e.name;return(i=e.shaderCache)!=null&&i.hint&&(s+="["+e.shaderCache.hint+"]"),s+=":"+t+`:${Mw(r,((n=e.shaderCache)==null?void 0:n.inputDependencies)??new Array(r.length).fill("dims"))}`,s},vw=class{constructor(e){e&&(this.architecture=e.architecture,this.vendor=e.vendor)}isArchitecture(e){return this.architecture===e}isVendor(e){return this.vendor===e}},Tw=class{constructor(){this.currentSessionId=null,this.currentKernelId=null,this.commandEncoder=null,this.computePassEncoder=null,this.maxDispatchNumber=16,this.pendingDispatchNumber=0,this.pendingKernels=[],this.pendingQueries=new Map,this.sessionStatus="default",this.capturedCommandList=new Map,this.capturedPendingKernels=new Map,this.sessionExternalDataMapping=new Map}get currentKernelCustomData(){if(this.currentKernelId===null)throw new Error("currentKernelCustomData(): currentKernelId is null. (should not happen)");let e=this.kernelCustomData.get(this.currentKernelId);return e||(e={},this.kernelCustomData.set(this.currentKernelId,e)),e}async initialize(e,r){this.env=e;let t=[],s={requiredLimits:{maxComputeWorkgroupStorageSize:r.limits.maxComputeWorkgroupStorageSize,maxComputeWorkgroupsPerDimension:r.limits.maxComputeWorkgroupsPerDimension,maxStorageBufferBindingSize:r.limits.maxStorageBufferBindingSize,maxBufferSize:r.limits.maxBufferSize,maxComputeInvocationsPerWorkgroup:r.limits.maxComputeInvocationsPerWorkgroup,maxComputeWorkgroupSizeX:r.limits.maxComputeWorkgroupSizeX,maxComputeWorkgroupSizeY:r.limits.maxComputeWorkgroupSizeY,maxComputeWorkgroupSizeZ:r.limits.maxComputeWorkgroupSizeZ},requiredFeatures:t},i=n=>r.features.has(n)&&t.push(n)&&!0;i("chromium-experimental-timestamp-query-inside-passes")||i("timestamp-query"),i("shader-f16"),i("subgroups"),this.device=await r.requestDevice(s),this.adapterInfo=new vw(r.info||await r.requestAdapterInfo()),this.gpuDataManager=Fp(this),this.programManager=new yw(this),this.kernels=new Map,this.kernelPersistentData=new Map,this.kernelCustomData=new Map,Ld(e.logLevel,!!e.debug),this.device.onuncapturederror=n=>{n.error instanceof GPUValidationError&&console.error(`An uncaught WebGPU validation error was raised: ${n.error.message}`)},Object.defineProperty(this.env.webgpu,"device",{value:this.device,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(this.env.webgpu,"adapter",{value:r,writable:!1,enumerable:!0,configurable:!1}),this.setQueryType()}dispose(){typeof this.querySet<"u"&&this.querySet.destroy(),this.gpuDataManager.dispose()}getCommandEncoder(){return this.commandEncoder||(this.commandEncoder=this.device.createCommandEncoder()),this.commandEncoder}getComputePassEncoder(){if(!this.computePassEncoder){let e=this.getCommandEncoder(),r={};this.queryType==="at-passes"&&(r.timestampWrites={querySet:this.querySet,beginningOfPassWriteIndex:this.pendingDispatchNumber*2,endOfPassWriteIndex:this.pendingDispatchNumber*2+1}),this.computePassEncoder=e.beginComputePass(r)}return this.computePassEncoder}endComputePass(){this.computePassEncoder&&(this.computePassEncoder.end(),this.computePassEncoder=null)}flush(){if(!this.commandEncoder)return;rs(),this.endComputePass();let e;this.queryType!=="none"&&(this.commandEncoder.resolveQuerySet(this.querySet,0,this.pendingDispatchNumber*2,this.queryResolveBuffer,0),e=this.device.createBuffer({size:this.pendingDispatchNumber*2*8,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.pendingQueries.set(e,this.pendingKernels),this.pendingKernels=[],this.commandEncoder.copyBufferToBuffer(this.queryResolveBuffer,0,e,0,this.pendingDispatchNumber*2*8)),this.device.queue.submit([this.commandEncoder.finish()]),this.gpuDataManager.refreshPendingBuffers(),this.commandEncoder=null,this.pendingDispatchNumber=0,this.queryType!=="none"&&e.mapAsync(GPUMapMode.READ).then(()=>{var s;let r=new BigUint64Array(e.getMappedRange()),t=this.pendingQueries.get(e);for(let i=0;i"u"&&(this.queryTimeBase=g);let P=Number(g-this.queryTimeBase),A=Number(_-this.queryTimeBase);if(!Number.isSafeInteger(P)||!Number.isSafeInteger(A))throw new RangeError("incorrect timestamp range");if((s=this.env.webgpu.profiling)!=null&&s.ondata)this.env.webgpu.profiling.ondata({version:1,inputsMetadata:u.map(v=>({dims:v.dims,dataType:mn(v.dataType)})),outputsMetadata:h.map(v=>({dims:v.dims,dataType:mn(v.dataType)})),kernelId:o,kernelType:l,kernelName:c,programName:p,startTime:P,endTime:A});else{let v="";u.forEach((k,E)=>{v+=`input[${E}]: [${k.dims}] | ${mn(k.dataType)}, `});let y="";h.forEach((k,E)=>{y+=`output[${E}]: [${k.dims}] | ${mn(k.dataType)}, `}),console.log(`[profiling] kernel "${o}|${l}|${c}|${p}" ${v}${y}execution time: ${A-P} ns`)}Ii("GPU",`${p}::${g}::${_}`)}e.unmap(),this.pendingQueries.delete(e)}),Hr()}run(e,r,t,s,i,n){rs(e.name);let o=[];for(let y=0;yk):t;if(p.length!==a.length)throw new Error(`Output size ${p.length} must be equal to ${a.length}.`);let u=[],h=[];for(let y=0;y=n)throw new Error(`Invalid output index: ${p[y]}`);if(p[y]===-3)continue;let k=p[y]===-1,E=p[y]===-2,M=k||E?i(a[y].dataType,a[y].dims):s(p[y],a[y].dataType,a[y].dims);if(u.push(M),M.data===0)continue;let w=this.gpuDataManager.get(M.data);if(!w)throw new Error(`no GPU data for output: ${M.data}`);if(k&&this.temporaryData.push(w),E){let x=this.kernelPersistentData.get(this.currentKernelId);x||(x=[],this.kernelPersistentData.set(this.currentKernelId,x)),x.push(w)}h.push(w)}if(o.length!==r.length||h.length!==u.length){if(h.length===0)return Hr(e.name),u;throw new Error(`Program ${e.name} has zero-sized tensor(s) in inputs or outputs. This is not supported now.`)}let g;if(c){let y=0,k=[];c.forEach(x=>{let $=typeof x.data=="number"?[x.data]:x.data;if($.length===0)return;let z=x.type===10?2:4,R,Q;x.type===10?(Q=$.length>4?16:$.length>2?8:$.length*z,R=$.length>4?16:z*$.length):(Q=$.length<=2?$.length*z:16,R=16),y=Math.ceil(y/Q)*Q,k.push(y);let q=x.type===10?8:4;y+=$.length>4?Math.ceil($.length/q)*R:$.length*z});let E=16;y=Math.ceil(y/E)*E;let M=new ArrayBuffer(y);c.forEach((x,$)=>{let z=k[$],R=typeof x.data=="number"?[x.data]:x.data;if(x.type===6)new Int32Array(M,z,R.length).set(R);else if(x.type===12)new Uint32Array(M,z,R.length).set(R);else if(x.type===10)new Uint16Array(M,z,R.length).set(R);else if(x.type===1)new Float32Array(M,z,R.length).set(R);else throw new Error(`Unsupported uniform type: ${mn(x.type)}`)});let w=this.gpuDataManager.create(y,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM);this.device.queue.writeBuffer(w.buffer,0,M,0,y),this.gpuDataManager.release(w.id),g={offset:0,size:y,buffer:w.buffer}}let _=this.programManager.normalizeDispatchGroupSize(l),P=_[1]===1&&_[2]===1,A=bw(e,r,P),v=this.programManager.getArtifact(A);if(v||(v=this.programManager.build(e,_),this.programManager.setArtifact(A,v),St("info",()=>`[artifact] key: ${A}, programName: ${e.name}`)),c&&v.uniformVariablesInfo){if(c.length!==v.uniformVariablesInfo.length)throw new Error(`Uniform variables count mismatch: expect ${v.uniformVariablesInfo.length}, got ${c.length} in program "${v.programInfo.name}".`);for(let y=0;y`[ProgramManager] run "${e.name}" (key=${A}) with ${_[0]}x${_[1]}x${_[2]}`),this.queryType!=="none"||this.sessionStatus==="capturing"){let y={kernelId:this.currentKernelId,programName:v.programInfo.name,inputTensorViews:r,outputTensorViews:u};this.pendingKernels.push(y),this.sessionStatus==="capturing"&&this.capturedPendingKernels.get(this.currentSessionId).push(y)}return this.programManager.run(v,o,h,_,g),Hr(e.name),u}upload(e,r){this.gpuDataManager.upload(e,r)}memcpy(e,r){this.gpuDataManager.memcpy(e,r)}async download(e,r){await this.gpuDataManager.download(e,r)}alloc(e){return this.gpuDataManager.create(e).id}free(e){return this.gpuDataManager.release(e)}createKernel(e,r,t,s){let i=ww.get(e);if(!i)throw new Error(`kernel not implemented: ${e}`);let n={kernelType:e,kernelName:s,kernelEntry:i[0],attributes:[i[1],t]};this.kernels.set(r,n)}releaseKernel(e){let r=this.kernelPersistentData.get(e);if(r){for(let t of r)this.gpuDataManager.release(t.id);this.kernelPersistentData.delete(e)}this.kernelCustomData.delete(e),this.kernels.delete(e)}computeKernel(e,r,t){let s=this.kernels.get(e);if(!s)throw new Error(`kernel not created: ${e}`);let i=s.kernelType,n=s.kernelName,o=s.kernelEntry,a=s.attributes;if(this.currentKernelId!==null)throw new Error(`kernel "[${i}] ${n}" is not allowed to be called recursively`);this.currentKernelId=e,a[0]&&(a[1]=a[0](a[1]),a[0]=void 0),St("info",()=>`[WebGPU] Start to run kernel "[${i}] ${n}"...`);let l=this.env.debug;this.temporaryData=[];try{return l&&this.device.pushErrorScope("validation"),o(r,a[1]),0}catch(c){return t.push(Promise.resolve(`[WebGPU] Kernel "[${i}] ${n}" failed. ${c}`)),1}finally{l&&t.push(this.device.popErrorScope().then(c=>c?`GPU validation error for kernel "[${i}] ${n}": ${c.message}`:null));for(let c of this.temporaryData)this.gpuDataManager.release(c.id);this.temporaryData=[],this.currentKernelId=null}}registerBuffer(e,r,t,s){let i=this.sessionExternalDataMapping.get(e);i||(i=new Map,this.sessionExternalDataMapping.set(e,i));let n=i.get(r),o=this.gpuDataManager.registerExternalBuffer(t,s,n);return i.set(r,[o,t]),o}unregisterBuffers(e){let r=this.sessionExternalDataMapping.get(e);r&&(r.forEach(t=>this.gpuDataManager.unregisterExternalBuffer(t[0])),this.sessionExternalDataMapping.delete(e))}getBuffer(e){let r=this.gpuDataManager.get(e);if(!r)throw new Error(`no GPU data for buffer: ${e}`);return r.buffer}createDownloader(e,r,t){return async()=>{let s=await jd(this,e,r);return zd(s.buffer,t)}}writeTimestamp(e){this.queryType==="inside-passes"&&this.computePassEncoder.writeTimestamp(this.querySet,e)}setQueryType(){var e;this.queryType="none",(((e=this.env.webgpu.profiling)==null?void 0:e.mode)==="default"||(typeof this.env.trace>"u"?this.env.wasm.trace:this.env.trace))&&(this.device.features.has("chromium-experimental-timestamp-query-inside-passes")?this.queryType="inside-passes":this.device.features.has("timestamp-query")&&(this.queryType="at-passes"),this.queryType!=="none"&&typeof this.querySet>"u"&&(this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxDispatchNumber*2}),this.queryResolveBuffer=this.device.createBuffer({size:this.maxDispatchNumber*2*8,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.QUERY_RESOLVE})))}captureBegin(){St("info","captureBegin"),this.capturedCommandList.get(this.currentSessionId)||this.capturedCommandList.set(this.currentSessionId,[]),this.capturedPendingKernels.get(this.currentSessionId)||this.capturedPendingKernels.set(this.currentSessionId,[]),this.flush(),this.sessionStatus="capturing"}captureEnd(){St("info","captureEnd"),this.flush(),this.sessionStatus="default"}replay(){St("info","replay"),this.sessionStatus="replaying";let e=this.capturedCommandList.get(this.currentSessionId),r=this.capturedPendingKernels.get(this.currentSessionId),t=e.length;this.pendingKernels=[];for(let s=0;s=this.maxDispatchNumber||this.queryType==="at-passes")&&this.endComputePass(),this.pendingDispatchNumber>=this.maxDispatchNumber&&this.flush()}this.flush(),this.sessionStatus="default"}onCreateSession(){this.gpuDataManager.onCreateSession()}onReleaseSession(e){this.unregisterBuffers(e),this.capturedCommandList.has(e)&&this.capturedCommandList.delete(e),this.capturedPendingKernels.has(e)&&this.capturedPendingKernels.delete(e),this.gpuDataManager.onReleaseSession(e)}onRunStart(e){this.currentSessionId=e,this.setQueryType()}}}),xw,Oc,Ew,Dc,Lc,zc,Pw,Cw,sT=Ve(()=>{Is(),xw=1,Oc=()=>xw++,Ew=new Map([["float32",32],["float16",16],["int32",32],["uint32",32],["int64",64],["uint64",64],["int8",8],["uint8",8],["int4",4],["uint4",4]]),Dc=(e,r)=>{let t=Ew.get(e);if(!t)throw new Error("Unsupported data type.");return r.length>0?Math.ceil(r.reduce((s,i)=>s*i)*t/8):0},Lc=class{constructor(e){this.sessionId=e.sessionId,this.mlContext=e.context,this.mlTensor=e.tensor,this.dataType=e.dataType,this.tensorShape=e.shape}get tensor(){return this.mlTensor}get type(){return this.dataType}get shape(){return this.tensorShape}get byteLength(){return Dc(this.dataType,this.tensorShape)}destroy(){St("verbose",()=>"[WebNN] TensorWrapper.destroy"),this.mlTensor.destroy()}write(e){this.mlContext.writeTensor(this.mlTensor,e)}async read(e){return e?this.mlContext.readTensor(this.mlTensor,e):this.mlContext.readTensor(this.mlTensor)}canReuseTensor(e,r,t){return this.mlContext===e&&this.dataType===r&&this.tensorShape.length===t.length&&this.tensorShape.every((s,i)=>s===t[i])}},zc=class{constructor(e,r){this.tensorManager=e,this.wrapper=r}get tensorWrapper(){return this.wrapper}releaseTensor(){this.tensorWrapper&&(this.tensorManager.releaseTensor(this.tensorWrapper),this.wrapper=void 0)}async ensureTensor(e,r,t,s){let i=this.tensorManager.getMLContext(e);if(this.wrapper){if(this.wrapper.canReuseTensor(i,r,t))return this.wrapper.tensor;if(s){if(this.wrapper.byteLength!==Dc(r,t))throw new Error("Unable to copy data to tensor with different size.");this.activeUpload=new Uint8Array(await this.wrapper.read())}this.tensorManager.releaseTensor(this.wrapper)}let n=typeof MLTensorUsage>"u"?void 0:MLTensorUsage.READ|MLTensorUsage.WRITE;return this.wrapper=await this.tensorManager.getCachedTensor(e,r,t,n,!0,!0),s&&this.activeUpload&&(this.wrapper.write(this.activeUpload),this.activeUpload=void 0),this.wrapper.tensor}upload(e){if(this.wrapper)if(e.byteLength===this.wrapper.byteLength){this.wrapper.write(e);return}else St("verbose",()=>"Data size does not match tensor size. Releasing tensor."),this.releaseTensor();this.activeUpload?this.activeUpload.set(e):this.activeUpload=new Uint8Array(e)}async download(e){if(this.activeUpload)if(e){e instanceof ArrayBuffer?new Uint8Array(e).set(this.activeUpload):new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(this.activeUpload);return}else return this.activeUpload.buffer;if(!this.wrapper)throw new Error("Tensor has not been created.");return e?this.wrapper.read(e):this.wrapper.read()}},Pw=class{constructor(e){this.backend=e,this.tensorTrackersById=new Map,this.freeTensors=[],this.externalTensors=new Set}getMLContext(e){let r=this.backend.getMLContext(e);if(!r)throw new Error("MLContext not found for session.");return r}reserveTensorId(){let e=Oc();return this.tensorTrackersById.set(e,new zc(this)),e}releaseTensorId(e){let r=this.tensorTrackersById.get(e);r&&(this.tensorTrackersById.delete(e),r.tensorWrapper&&this.releaseTensor(r.tensorWrapper))}async ensureTensor(e,r,t,s,i){St("verbose",()=>`[WebNN] TensorManager.ensureTensor {tensorId: ${r}, dataType: ${t}, shape: ${s}, copyOld: ${i}}`);let n=this.tensorTrackersById.get(r);if(!n)throw new Error("Tensor not found.");return n.ensureTensor(e,t,s,i)}upload(e,r){let t=this.tensorTrackersById.get(e);if(!t)throw new Error("Tensor not found.");t.upload(r)}async download(e,r){St("verbose",()=>`[WebNN] TensorManager.download {tensorId: ${e}, dstBuffer: ${r==null?void 0:r.byteLength}}`);let t=this.tensorTrackersById.get(e);if(!t)throw new Error("Tensor not found.");return t.download(r)}releaseTensorsForSession(e){for(let r of this.freeTensors)r.sessionId===e&&r.destroy();this.freeTensors=this.freeTensors.filter(r=>r.sessionId!==e)}registerTensor(e,r,t,s){let i=this.getMLContext(e),n=Oc(),o=new Lc({sessionId:e,context:i,tensor:r,dataType:t,shape:s});return this.tensorTrackersById.set(n,new zc(this,o)),this.externalTensors.add(o),n}async getCachedTensor(e,r,t,s,i,n){let o=this.getMLContext(e);for(let[l,c]of this.freeTensors.entries())if(c.canReuseTensor(o,r,t)){St("verbose",()=>`[WebNN] Reusing tensor {dataType: ${r}, shape: ${t}}`);let p=this.freeTensors.splice(l,1)[0];return p.sessionId=e,p}St("verbose",()=>`[WebNN] MLContext.createTensor {dataType: ${r}, shape: ${t}}`);let a=await o.createTensor({dataType:r,shape:t,dimensions:t,usage:s,writable:i,readable:n});return new Lc({sessionId:e,context:o,tensor:a,dataType:r,shape:t})}releaseTensor(e){this.externalTensors.has(e)&&this.externalTensors.delete(e),this.freeTensors.push(e)}},Cw=(...e)=>new Pw(...e)}),Aa,Sw,$w,nT=Ve(()=>{pt(),hn(),$p(),sT(),Is(),Aa=new Map([[1,"float32"],[10,"float16"],[6,"int32"],[12,"uint32"],[7,"int64"],[13,"uint64"],[22,"int4"],[21,"uint4"],[3,"int8"],[2,"uint8"],[9,"uint8"]]),Sw=(e,r)=>{if(e===r)return!0;if(e===void 0||r===void 0)return!1;let t=Object.keys(e).sort(),s=Object.keys(r).sort();return t.length===s.length&&t.every((i,n)=>i===s[n]&&e[i]===r[i])},$w=class{constructor(e){this.tensorManager=Cw(this),this.mlContextBySessionId=new Map,this.sessionIdsByMLContext=new Map,this.mlContextCache=[],this.sessionGraphInputs=new Map,this.temporaryGraphInputs=[],this.temporarySessionTensorIds=new Map,Ld(e.logLevel,!!e.debug)}get currentSessionId(){if(this.activeSessionId===void 0)throw new Error("No active session");return this.activeSessionId}onRunStart(e){St("verbose",()=>`[WebNN] onRunStart {sessionId: ${e}}`),this.activeSessionId=e}onRunEnd(e){St("verbose",()=>`[WebNN] onRunEnd {sessionId: ${e}}`);let r=this.temporarySessionTensorIds.get(e);if(r){for(let t of r)St("verbose",()=>`[WebNN] releasing temporary tensor {tensorId: ${t}}`),this.tensorManager.releaseTensorId(t);this.temporarySessionTensorIds.delete(e),this.activeSessionId=void 0}}async createMLContext(e){if(e instanceof GPUDevice){let t=this.mlContextCache.findIndex(s=>s.gpuDevice===e);if(t!==-1)return this.mlContextCache[t].mlContext;{let s=await navigator.ml.createContext(e);return this.mlContextCache.push({gpuDevice:e,mlContext:s}),s}}else if(e===void 0){let t=this.mlContextCache.findIndex(s=>s.options===void 0&&s.gpuDevice===void 0);if(t!==-1)return this.mlContextCache[t].mlContext;{let s=await navigator.ml.createContext();return this.mlContextCache.push({mlContext:s}),s}}let r=this.mlContextCache.findIndex(t=>Sw(t.options,e));if(r!==-1)return this.mlContextCache[r].mlContext;{let t=await navigator.ml.createContext(e);return this.mlContextCache.push({options:e,mlContext:t}),t}}registerMLContext(e,r){this.mlContextBySessionId.set(e,r);let t=this.sessionIdsByMLContext.get(r);t||(t=new Set,this.sessionIdsByMLContext.set(r,t)),t.add(e),this.temporaryGraphInputs.length>0&&(this.sessionGraphInputs.set(e,this.temporaryGraphInputs),this.temporaryGraphInputs=[])}onReleaseSession(e){this.sessionGraphInputs.delete(e);let r=this.mlContextBySessionId.get(e);if(!r)return;this.tensorManager.releaseTensorsForSession(e),this.mlContextBySessionId.delete(e);let t=this.sessionIdsByMLContext.get(r);if(t.delete(e),t.size===0){this.sessionIdsByMLContext.delete(r);let s=this.mlContextCache.findIndex(i=>i.mlContext===r);s!==-1&&this.mlContextCache.splice(s,1)}}getMLContext(e){return this.mlContextBySessionId.get(e)}reserveTensorId(){return this.tensorManager.reserveTensorId()}releaseTensorId(e){St("verbose",()=>`[WebNN] releaseTensorId {tensorId: ${e}}`),this.tensorManager.releaseTensorId(e)}async ensureTensor(e,r,t,s,i){let n=Aa.get(t);if(!n)throw new Error(`Unsupported ONNX data type: ${t}`);return this.tensorManager.ensureTensor(e??this.currentSessionId,r,n,s,i)}async createTemporaryTensor(e,r,t){St("verbose",()=>`[WebNN] createTemporaryTensor {onnxDataType: ${r}, shape: ${t}}`);let s=Aa.get(r);if(!s)throw new Error(`Unsupported ONNX data type: ${r}`);let i=this.tensorManager.reserveTensorId();await this.tensorManager.ensureTensor(e,i,s,t,!1);let n=this.temporarySessionTensorIds.get(e);return n?n.push(i):this.temporarySessionTensorIds.set(e,[i]),i}uploadTensor(e,r){if(!ar().shouldTransferToMLTensor)throw new Error("Trying to upload to a MLTensor while shouldTransferToMLTensor is false");St("verbose",()=>`[WebNN] uploadTensor {tensorId: ${e}, data: ${r.byteLength}}`),this.tensorManager.upload(e,r)}async downloadTensor(e,r){return this.tensorManager.download(e,r)}createMLTensorDownloader(e,r){return async()=>{let t=await this.tensorManager.download(e);return zd(t,r)}}registerMLTensor(e,r,t,s){let i=Aa.get(t);if(!i)throw new Error(`Unsupported ONNX data type: ${t}`);let n=this.tensorManager.registerTensor(e,r,i,s);return St("verbose",()=>`[WebNN] registerMLTensor {tensor: ${r}, dataType: ${i}, dimensions: ${s}} -> {tensorId: ${n}}`),n}registerMLConstant(e,r,t,s,i,n){if(!n)throw new Error("External mounted files are not available.");let o=e;e.startsWith("./")&&(o=e.substring(2));let a=n.get(o);if(!a)throw new Error(`File with name ${o} not found in preloaded files.`);if(r+t>a.byteLength)throw new Error("Out of bounds: data offset and length exceed the external file data size.");let l=a.slice(r,r+t).buffer,c;switch(i.dataType){case"float32":c=new Float32Array(l);break;case"float16":c=typeof Float16Array<"u"&&Float16Array.from?new Float16Array(l):new Uint16Array(l);break;case"int32":c=new Int32Array(l);break;case"uint32":c=new Uint32Array(l);break;case"int64":c=new BigInt64Array(l);break;case"uint64":c=new BigUint64Array(l);break;case"int8":c=new Int8Array(l);break;case"int4":case"uint4":case"uint8":c=new Uint8Array(l);break;default:throw new Error(`Unsupported data type: ${i.dataType} in creating WebNN Constant from external data.`)}return St("verbose",()=>`[WebNN] registerMLConstant {dataType: ${i.dataType}, shape: ${i.shape}}}`),s.constant(i,c)}registerGraphInput(e){this.temporaryGraphInputs.push(e)}isGraphInput(e,r){let t=this.sessionGraphInputs.get(e);return t?t.includes(r):!1}flush(){}}}),kw={};Si(kw,{init:()=>Aw});var Fa,Iw,Aw,iT=Ve(()=>{pt(),rT(),Is(),Mt(),nT(),Fa=class Cb{constructor(r,t,s,i){this.module=r,this.dataType=t,this.data=s,this.dims=i}getFloat32Array(){if(this.dataType!==1)throw new Error("Invalid data type");let r=Te.size(this.dims);return r===0?new Float32Array:new Float32Array(this.module.HEAP8.buffer,this.data,r)}getBigInt64Array(){if(this.dataType!==7)throw new Error("Invalid data type");let r=Te.size(this.dims);return r===0?new BigInt64Array:new BigInt64Array(this.module.HEAP8.buffer,this.data,r)}getInt32Array(){if(this.dataType!==6)throw new Error("Invalid data type");let r=Te.size(this.dims);return r===0?new Int32Array:new Int32Array(this.module.HEAP8.buffer,this.data,r)}getUint16Array(){if(this.dataType!==10&&this.dataType!==4)throw new Error("Invalid data type");let r=Te.size(this.dims);return r===0?new Uint16Array:new Uint16Array(this.module.HEAP8.buffer,this.data,r)}reshape(r){if(Te.size(r)!==Te.size(this.dims))throw new Error("Invalid new shape");return new Cb(this.module,this.dataType,this.data,r)}},Iw=class{constructor(e,r,t){this.module=e,this.backend=r,this.customDataOffset=0,this.customDataSize=0,this.adapterInfo=r.adapterInfo;let s=e.PTR_SIZE,i=t/e.PTR_SIZE,n=s===4?"i32":"i64";this.opKernelContext=Number(e.getValue(s*i++,n));let o=Number(e.getValue(s*i++,n));this.outputCount=Number(e.getValue(s*i++,n)),this.customDataOffset=Number(e.getValue(s*i++,"*")),this.customDataSize=Number(e.getValue(s*i++,n));let a=[];for(let l=0;ltypeof a=="number"?this.inputs[a]:a))??this.inputs,s=(r==null?void 0:r.outputs)??[],i=(a,l,c)=>new Fa(this.module,l,this.output(a,c),c),n=(a,l)=>{let c=fn(a,l);if(!c)throw new Error(`Unsupported data type: ${a}`);let p=c>0?this.backend.gpuDataManager.create(c).id:0;return new Fa(this.module,a,p,l)};return this.backend.run(e,t,s,i,n,this.outputCount)}output(e,r){let t=this.module.stackSave();try{let s=this.module.PTR_SIZE,i=s===4?"i32":"i64",n=this.module.stackAlloc((1+r.length)*s);this.module.setValue(n,r.length,i);for(let o=0;o{let i=r.jsepInit;if(!i)throw new Error("Failed to initialize JSEP. The WebAssembly module is not built with JSEP support.");if(e==="webgpu"){let n=new Tw;await n.initialize(t,s),i("webgpu",[n,o=>n.alloc(Number(o)),o=>n.free(o),(o,a,l,c=!1)=>{if(c)St("verbose",()=>`[WebGPU] jsepCopyGpuToGpu: src=${Number(o)}, dst=${Number(a)}, size=${Number(l)}`),n.memcpy(Number(o),Number(a));else{St("verbose",()=>`[WebGPU] jsepCopyCpuToGpu: dataOffset=${Number(o)}, gpuDataId=${Number(a)}, size=${Number(l)}`);let p=r.HEAPU8.subarray(Number(o>>>0),Number(o>>>0)+Number(l));n.upload(Number(a),p)}},async(o,a,l)=>{St("verbose",()=>`[WebGPU] jsepCopyGpuToCpu: gpuDataId=${o}, dataOffset=${a}, size=${l}`),await n.download(Number(o),()=>r.HEAPU8.subarray(Number(a)>>>0,Number(a+l)>>>0))},(o,a,l)=>n.createKernel(o,Number(a),l,r.UTF8ToString(r._JsepGetNodeName(Number(a)))),o=>n.releaseKernel(o),(o,a,l,c)=>{St("verbose",()=>`[WebGPU] jsepRun: sessionHandle=${l}, kernel=${o}, contextDataOffset=${a}`);let p=new Iw(r,n,Number(a));return n.computeKernel(Number(o),p,c)},()=>n.captureBegin(),()=>n.captureEnd(),()=>n.replay()])}else{let n=new $w(t);i("webnn",[n,()=>n.reserveTensorId(),o=>n.releaseTensorId(o),async(o,a,l,c,p)=>n.ensureTensor(o,a,l,c,p),(o,a)=>{n.uploadTensor(o,a)},async(o,a)=>n.downloadTensor(o,a)])}}}),Fw,Bc,Rc,Hs,Ow,Oa,Nc,jc,Vc,Uc,Wc,Gc,Dw=Ve(()=>{dv(),cv(),pt(),hn(),kd(),Tp(),Fw=(e,r)=>{ar()._OrtInit(e,r)!==0&&At("Can't initialize onnxruntime.")},Bc=async e=>{Fw(e.wasm.numThreads,Ma(e.logLevel))},Rc=async(e,r)=>{{let t=(iT(),fa(kw)).init;if(r==="webgpu"){if(typeof navigator>"u"||!navigator.gpu)throw new Error("WebGPU is not supported in current environment");let s=e.webgpu.adapter;if(s){if(typeof s.limits!="object"||typeof s.features!="object"||typeof s.requestDevice!="function")throw new Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let i=e.webgpu.powerPreference;if(i!==void 0&&i!=="low-power"&&i!=="high-performance")throw new Error(`Invalid powerPreference setting: "${i}"`);let n=e.webgpu.forceFallbackAdapter;if(n!==void 0&&typeof n!="boolean")throw new Error(`Invalid forceFallbackAdapter setting: "${n}"`);if(s=await navigator.gpu.requestAdapter({powerPreference:i,forceFallbackAdapter:n}),!s)throw new Error('Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.')}await t("webgpu",ar(),e,s)}if(r==="webnn"){if(typeof navigator>"u"||!navigator.ml)throw new Error("WebNN is not supported in current environment");await t("webnn",ar(),e)}}},Hs=new Map,Ow=e=>{let r=ar(),t=r.stackSave();try{let s=r.PTR_SIZE,i=r.stackAlloc(2*s);r._OrtGetInputOutputCount(e,i,i+s)!==0&&At("Can't get session input/output count.");let n=s===4?"i32":"i64";return[Number(r.getValue(i,n)),Number(r.getValue(i+s,n))]}finally{r.stackRestore(t)}},Oa=e=>{let r=ar(),t=r._malloc(e.byteLength);if(t===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${e.byteLength}.`);return r.HEAPU8.set(e,t),[t,e.byteLength]},Nc=async(e,r)=>{var u,h,g;let t,s,i=ar();Array.isArray(e)?[t,s]=e:e.buffer===i.HEAPU8.buffer?[t,s]=[e.byteOffset,e.byteLength]:[t,s]=Oa(e);let n=0,o=0,a=0,l=[],c=[],p=[];try{if([o,l]=vp(r),(r==null?void 0:r.externalData)&&i.mountExternalData){let M=[];for(let w of r.externalData){let x=typeof w=="string"?w:w.path;M.push(Dd(typeof w=="string"?w:w.data).then($=>{i.mountExternalData(x,$)}))}await Promise.all(M)}for(let M of(r==null?void 0:r.executionProviders)??[])if((typeof M=="string"?M:M.name)==="webnn"){if(i.shouldTransferToMLTensor=!1,typeof M!="string"){let w=M,x=w==null?void 0:w.context,$=w==null?void 0:w.gpuDevice,z=w==null?void 0:w.deviceType,R=w==null?void 0:w.powerPreference;x?i.currentContext=x:$?i.currentContext=await i.jsepCreateMLContext($):i.currentContext=await i.jsepCreateMLContext({deviceType:z,powerPreference:R})}else i.currentContext=await i.jsepCreateMLContext();break}n=await i._OrtCreateSession(t,s,o),n===0&&At("Can't create a session."),(u=i.jsepOnCreateSession)==null||u.call(i),i.currentContext&&(i.jsepRegisterMLContext(n,i.currentContext),i.currentContext=void 0,i.shouldTransferToMLTensor=!0);let[_,P]=Ow(n),A=!!(r!=null&&r.enableGraphCapture),v=[],y=[],k=[];for(let M=0;M<_;M++){let w=i._OrtGetInputName(n,M);w===0&&At("Can't get an input name."),c.push(w),v.push(i.UTF8ToString(w))}for(let M=0;MM==="gpu-buffer"||M==="ml-tensor")&&(a=i._OrtCreateBinding(n),a===0&&At("Can't create IO binding."),E={handle:a,outputPreferredLocations:k,outputPreferredLocationsEncoded:k.map(M=>Od(M))}),Hs.set(n,[n,c,p,E,A,!1]),[n,v,y]}catch(_){throw c.forEach(P=>i._OrtFree(P)),p.forEach(P=>i._OrtFree(P)),a!==0&&i._OrtReleaseBinding(a)!==0&&At("Can't release IO binding."),n!==0&&i._OrtReleaseSession(n)!==0&&At("Can't release session."),_}finally{i._free(t),o!==0&&i._OrtReleaseSessionOptions(o)!==0&&At("Can't release session options."),l.forEach(_=>i._free(_)),(g=i.unmountExternalData)==null||g.call(i)}},jc=e=>{var l;let r=ar(),t=Hs.get(e);if(!t)throw new Error(`cannot release session. invalid session id: ${e}`);let[s,i,n,o,a]=t;o&&(a&&r._OrtClearBoundOutputs(o.handle)!==0&&At("Can't clear bound outputs."),r._OrtReleaseBinding(o.handle)!==0&&At("Can't release IO binding.")),(l=r.jsepOnReleaseSession)==null||l.call(r,e),i.forEach(c=>r._OrtFree(c)),n.forEach(c=>r._OrtFree(c)),r._OrtReleaseSession(s)!==0&&At("Can't release session."),Hs.delete(e)},Vc=async(e,r,t,s,i,n=!1)=>{if(!e){r.push(0);return}let o=ar(),a=o.PTR_SIZE,l=e[0],c=e[1],p=e[3],u=p,h,g;if(l==="string"&&(p==="gpu-buffer"||p==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(n&&p!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${i} when enableGraphCapture is true.`);if(p==="gpu-buffer"){let A=e[2].gpuBuffer;g=fn(Rn(l),c);let v=o.jsepRegisterBuffer;if(!v)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');h=v(s,i,A,g)}else if(p==="ml-tensor"){let A=e[2].mlTensor;g=fn(Rn(l),c);let v=o.jsepRegisterMLTensor;if(!v)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');h=v(s,A,Rn(l),c)}else{let A=e[2];if(Array.isArray(A)){g=a*A.length,h=o._malloc(g),t.push(h);for(let v=0;vo.setValue(P+y*a,v,a===4?"i32":"i64"));let A=o._OrtCreateTensor(Rn(l),h,g,P,c.length,Od(u));A===0&&At(`Can't create tensor for input/output. session=${s}, index=${i}.`),r.push(A)}finally{o.stackRestore(_)}},Uc=async(e,r,t,s,i,n)=>{var Q,q,U;let o=ar(),a=o.PTR_SIZE,l=Hs.get(e);if(!l)throw new Error(`cannot run inference. invalid session id: ${e}`);let c=l[0],p=l[1],u=l[2],h=l[3],g=l[4],_=l[5],P=r.length,A=s.length,v=0,y=[],k=[],E=[],M=[],w=o.stackSave(),x=o.stackAlloc(P*a),$=o.stackAlloc(P*a),z=o.stackAlloc(A*a),R=o.stackAlloc(A*a);try{[v,y]=gp(n);for(let J=0;JMe*K,1);N=mn(se);let He=h==null?void 0:h.outputPreferredLocations[s[J]];if(N==="string"){if(He==="gpu-buffer"||He==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let Me=[];for(let K=0;K0){let Me=o.jsepGetBuffer;if(!Me)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let K=Me(O),j=fn(se,ke);if(j===void 0||!Ad(N))throw new Error(`Unsupported data type: ${N}`);he=!0,H.push([N,_e,{gpuBuffer:K,download:o.jsepCreateDownloader(K,j,N),dispose:()=>{o._OrtReleaseTensor(ie)!==0&&At("Can't release tensor.")}},"gpu-buffer"])}else if(He==="ml-tensor"&&ke>0){let Me=o.jsepEnsureTensor;if(!Me)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(fn(se,ke)===void 0||!Fd(N))throw new Error(`Unsupported data type: ${N}`);let K=await Me(e,O,se,_e,!1);he=!0,H.push([N,_e,{mlTensor:K,download:o.jsepCreateMLTensorDownloader(O,N),dispose:()=>{o.jsepReleaseTensorId(O),o._OrtReleaseTensor(ie)}},"ml-tensor"])}else{let Me=Id(N),K=new Me(ke);new Uint8Array(K.buffer,K.byteOffset,K.byteLength).set(o.HEAPU8.subarray(O,O+K.byteLength)),H.push([N,_e,K,"cpu"])}}finally{o.stackRestore(ae),N==="string"&&O&&o._free(O),he||o._OrtReleaseTensor(ie),(U=o.jsepOnRunEnd)==null||U.call(o,c)}}return h&&!g&&(o._OrtClearBoundOutputs(h.handle)!==0&&At("Can't clear bound outputs."),Hs.set(e,[c,p,u,h,g,!1])),H}finally{o.stackRestore(w),k.forEach(Z=>o._OrtReleaseTensor(Z)),E.forEach(Z=>o._OrtReleaseTensor(Z)),M.forEach(Z=>o._free(Z)),v!==0&&o._OrtReleaseRunOptions(v),y.forEach(Z=>o._free(Z))}},Wc=e=>{let r=ar(),t=Hs.get(e);if(!t)throw new Error("invalid session id");let s=t[0],i=r._OrtEndProfiling(s);i===0&&At("Can't get an profile file name."),r._OrtFree(i)},Gc=e=>{let r=[];for(let t of e){let s=t[2];!Array.isArray(s)&&"buffer"in s&&r.push(s.buffer)}return r}}),qs,Or,Un,Vi,Ui,Da,Kc,La,vn,Tn,Lw,zw,Bw,Rw,Nw,jw,Vw,Uw,Ww=Ve(()=>{ss(),Dw(),hn(),Pd(),qs=()=>!!Ut.wasm.proxy&&typeof document<"u",Un=!1,Vi=!1,Ui=!1,La=new Map,vn=(e,r)=>{let t=La.get(e);t?t.push(r):La.set(e,[r])},Tn=()=>{if(Un||!Vi||Ui||!Or)throw new Error("worker not ready")},Lw=e=>{switch(e.data.type){case"init-wasm":Un=!1,e.data.err?(Ui=!0,Kc[1](e.data.err)):(Vi=!0,Kc[0]()),Da&&(URL.revokeObjectURL(Da),Da=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let r=La.get(e.data.type);e.data.err?r.shift()[1](e.data.err):r.shift()[0](e.data.out);break}}},zw=async()=>{if(!Vi){if(Un)throw new Error("multiple calls to 'initWasm()' detected.");if(Ui)throw new Error("previous call to 'initWasm()' failed.");if(Un=!0,qs())return new Promise((e,r)=>{Or==null||Or.terminate(),hp().then(([t,s])=>{try{Or=s,Or.onerror=n=>r(n),Or.onmessage=Lw,Kc=[e,r];let i={type:"init-wasm",in:Ut};!i.in.wasm.wasmPaths&&(t||vd)&&(i.in.wasm.wasmPaths={wasm:new URL("/assets/ort-wasm-simd-threaded.jsep-BAR87mbD.wasm",self.location.href).href}),Or.postMessage(i),Da=t}catch(i){r(i)}},r)});try{await $d(Ut.wasm),await Bc(Ut),Vi=!0}catch(e){throw Ui=!0,e}finally{Un=!1}}},Bw=async e=>{if(qs())return Tn(),new Promise((r,t)=>{vn("init-ep",[r,t]);let s={type:"init-ep",in:{epName:e,env:Ut}};Or.postMessage(s)});await Rc(Ut,e)},Rw=async e=>qs()?(Tn(),new Promise((r,t)=>{vn("copy-from",[r,t]);let s={type:"copy-from",in:{buffer:e}};Or.postMessage(s,[e.buffer])})):Oa(e),Nw=async(e,r)=>{if(qs()){if(r!=null&&r.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return Tn(),new Promise((t,s)=>{vn("create",[t,s]);let i={type:"create",in:{model:e,options:{...r}}},n=[];e instanceof Uint8Array&&n.push(e.buffer),Or.postMessage(i,n)})}else return Nc(e,r)},jw=async e=>{if(qs())return Tn(),new Promise((r,t)=>{vn("release",[r,t]);let s={type:"release",in:e};Or.postMessage(s)});jc(e)},Vw=async(e,r,t,s,i,n)=>{if(qs()){if(t.some(o=>o[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(i.some(o=>o))throw new Error("pre-allocated output tensor is not supported for proxy.");return Tn(),new Promise((o,a)=>{vn("run",[o,a]);let l=t,c={type:"run",in:{sessionId:e,inputIndices:r,inputs:l,outputIndices:s,options:n}};Or.postMessage(c,Gc(l))})}else return Uc(e,r,t,s,i,n)},Uw=async e=>{if(qs())return Tn(),new Promise((r,t)=>{vn("end-profiling",[r,t]);let s={type:"end-profiling",in:e};Or.postMessage(s)});Wc(e)}}),Hc,Gw,Kw,oT=Ve(()=>{ss(),Ww(),pt(),_d(),Tp(),Hc=(e,r)=>{switch(e.location){case"cpu":return[e.type,e.dims,e.data,"cpu"];case"gpu-buffer":return[e.type,e.dims,{gpuBuffer:e.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[e.type,e.dims,{mlTensor:e.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${e.location} for ${r()}`)}},Gw=e=>{switch(e[3]){case"cpu":return new ts(e[0],e[2],e[1]);case"gpu-buffer":{let r=e[0];if(!Ad(r))throw new Error(`not supported data type: ${r} for deserializing GPU tensor`);let{gpuBuffer:t,download:s,dispose:i}=e[2];return ts.fromGpuBuffer(t,{dataType:r,dims:e[1],download:s,dispose:i})}case"ml-tensor":{let r=e[0];if(!Fd(r))throw new Error(`not supported data type: ${r} for deserializing MLTensor tensor`);let{mlTensor:t,download:s,dispose:i}=e[2];return ts.fromMLTensor(t,{dataType:r,dims:e[1],download:s,dispose:i})}default:throw new Error(`invalid data location: ${e[3]}`)}},Kw=class{async fetchModelAndCopyToWasmMemory(e){return Rw(await Dd(e))}async loadModel(e,r){rs();let t;typeof e=="string"?t=await this.fetchModelAndCopyToWasmMemory(e):t=e,[this.sessionId,this.inputNames,this.outputNames]=await Nw(t,r),Hr()}async dispose(){return jw(this.sessionId)}async run(e,r,t){rs();let s=[],i=[];Object.entries(e).forEach(u=>{let h=u[0],g=u[1],_=this.inputNames.indexOf(h);if(_===-1)throw new Error(`invalid input '${h}'`);s.push(g),i.push(_)});let n=[],o=[];Object.entries(r).forEach(u=>{let h=u[0],g=u[1],_=this.outputNames.indexOf(h);if(_===-1)throw new Error(`invalid output '${h}'`);n.push(g),o.push(_)});let a=s.map((u,h)=>Hc(u,()=>`input "${this.inputNames[i[h]]}"`)),l=n.map((u,h)=>u?Hc(u,()=>`output "${this.outputNames[o[h]]}"`):null),c=await Vw(this.sessionId,i,a,o,l,t),p={};for(let u=0;uQc,initializeFlags:()=>qc,wasmBackend:()=>qw});var qc,Qc,qw,aT=Ve(()=>{ss(),Ww(),oT(),qc=()=>{if((typeof Ut.wasm.initTimeout!="number"||Ut.wasm.initTimeout<0)&&(Ut.wasm.initTimeout=0),Ut.wasm.simd===!1&&console.warn('Deprecated property "env.wasm.simd" is set to false. non-SIMD build is no longer provided, and this setting will be ignored.'),typeof Ut.wasm.proxy!="boolean"&&(Ut.wasm.proxy=!1),typeof Ut.wasm.trace!="boolean"&&(Ut.wasm.trace=!1),typeof Ut.wasm.numThreads!="number"||!Number.isInteger(Ut.wasm.numThreads)||Ut.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)Ut.wasm.numThreads=1;else{let e=typeof navigator>"u"?Kb("node:os").cpus().length:navigator.hardwareConcurrency;Ut.wasm.numThreads=Math.min(4,Math.ceil((e||1)/2))}},Qc=class{async init(e){qc(),await zw(),await Bw(e)}async createInferenceSessionHandler(e,r){let t=new Kw;return await t.loadModel(e,r),Promise.resolve(t)}},qw=new Qc});ss(),ss(),ss();var lT="1.22.0-dev.20250306-ccf8fdd9ea",dT=rp;{let e=(aT(),fa(Hw)).wasmBackend;un("webgpu",e,5),un("webnn",e,5),un("cpu",e,10),un("wasm",e,10)}Object.defineProperty(Ut.versions,"web",{value:lT,enumerable:!0});/** -* @license -* Copyright 2021 Google LLC. All Rights Reserved. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ============================================================================= -*//** - * @license - * Copyright 2020 Google LLC. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================================= - *//** - * @license - * Copyright 2019 Google LLC. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================================= - */var cT=Object.freeze({__proto__:null,get InferenceSession(){return fd},get TRACE(){return Ii},get TRACE_FUNC_BEGIN(){return rs},get TRACE_FUNC_END(){return Hr},get Tensor(){return ts},default:dT,get env(){return Ut},get registerBackend(){return un}}),Fs={},uT={"onnxruntime-common":e=>{e.exports=Vb},"onnxruntime-web":e=>{e.exports=cT},"?2ce3":()=>{},"?7a2c":()=>{},"?a42a":()=>{},"?2b25":()=>{},"?569f":()=>{},"?3f59":()=>{},"?154a":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,r,t)=>{t.r(r),t.d(r,{Environment:()=>Ae,Interpreter:()=>Ie,Template:()=>We,parse:()=>N,tokenize:()=>u});var s=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",NullLiteral:"NullLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator",Macro:"Macro",EndMacro:"EndMacro"}),i=Object.freeze({set:s.Set,for:s.For,in:s.In,is:s.Is,if:s.If,else:s.Else,endif:s.EndIf,elif:s.ElseIf,endfor:s.EndFor,and:s.And,or:s.Or,not:s.Not,"not in":s.NotIn,macro:s.Macro,endmacro:s.EndMacro,true:s.BooleanLiteral,false:s.BooleanLiteral,none:s.NullLiteral,True:s.BooleanLiteral,False:s.BooleanLiteral,None:s.NullLiteral}),n=class{constructor(D,ee){this.value=D,this.type=ee}};function o(D){return/\w/.test(D)}function a(D){return/[0-9]/.test(D)}var l=[["{%",s.OpenStatement],["%}",s.CloseStatement],["{{",s.OpenExpression],["}}",s.CloseExpression],["(",s.OpenParen],[")",s.CloseParen],["{",s.OpenCurlyBracket],["}",s.CloseCurlyBracket],["[",s.OpenSquareBracket],["]",s.CloseSquareBracket],[",",s.Comma],[".",s.Dot],[":",s.Colon],["|",s.Pipe],["<=",s.ComparisonBinaryOperator],[">=",s.ComparisonBinaryOperator],["==",s.ComparisonBinaryOperator],["!=",s.ComparisonBinaryOperator],["<",s.ComparisonBinaryOperator],[">",s.ComparisonBinaryOperator],["+",s.AdditiveBinaryOperator],["-",s.AdditiveBinaryOperator],["*",s.MultiplicativeBinaryOperator],["/",s.MultiplicativeBinaryOperator],["%",s.MultiplicativeBinaryOperator],["=",s.Equals]],c=new Map([["n",` -`],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function p(D,ee={}){return D.endsWith(` -`)&&(D=D.slice(0,-1)),D=D.replace(/{#.*?#}/gs,"{##}"),ee.lstrip_blocks&&(D=D.replace(/^[ \t]*({[#%])/gm,"$1")),ee.trim_blocks&&(D=D.replace(/([#%]})\n/g,"$1")),D.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}function u(D,ee={}){var ve,Re,Fe;const B=[],te=p(D,ee);let de=0;const be=je=>{let qe="";for(;je(te[de]);){if(te[de]==="\\"){if(++de,de>=te.length)throw new SyntaxError("Unexpected end of input");const Xe=te[de++],ut=c.get(Xe);if(ut===void 0)throw new SyntaxError(`Unexpected escaped character: ${Xe}`);qe+=ut;continue}if(qe+=te[de++],de>=te.length)throw new SyntaxError("Unexpected end of input")}return qe};e:for(;de0){B.push(new n(Xe,s.Text));continue}}be(Xe=>/\s/.test(Xe));const qe=te[de];if(qe==="-"||qe==="+"){const Xe=(Re=B.at(-1))==null?void 0:Re.type;if(Xe===s.Text||Xe===void 0)throw new SyntaxError(`Unexpected character: ${qe}`);switch(Xe){case s.Identifier:case s.NumericLiteral:case s.BooleanLiteral:case s.NullLiteral:case s.StringLiteral:case s.CloseParen:case s.CloseSquareBracket:break;default:{++de;const ut=be(a);B.push(new n(`${qe}${ut}`,ut.length>0?s.NumericLiteral:s.UnaryOperator));continue}}}for(const[Xe,ut]of l)if(te.slice(de,de+Xe.length)===Xe){B.push(new n(Xe,ut)),de+=Xe.length;continue e}if(qe==="'"||qe==='"'){++de;const Xe=be(ut=>ut!==qe);B.push(new n(Xe,s.StringLiteral)),++de;continue}if(a(qe)){const Xe=be(a);B.push(new n(Xe,s.NumericLiteral));continue}if(o(qe)){const Xe=be(o),ut=Object.hasOwn(i,Xe)?i[Xe]:s.Identifier;ut===s.In&&((Fe=B.at(-1))==null?void 0:Fe.type)===s.Not?(B.pop(),B.push(new n("not in",s.NotIn))):B.push(new n(Xe,ut));continue}throw new SyntaxError(`Unexpected character: ${qe}`)}return B}var h=class{constructor(){re(this,"type","Statement")}},g=class extends h{constructor(ee){super();re(this,"type","Program");this.body=ee}},_=class extends h{constructor(ee,B,te){super();re(this,"type","If");this.test=ee,this.body=B,this.alternate=te}},P=class extends h{constructor(ee,B,te,de){super();re(this,"type","For");this.loopvar=ee,this.iterable=B,this.body=te,this.defaultBlock=de}},A=class extends h{constructor(ee,B){super();re(this,"type","Set");this.assignee=ee,this.value=B}},v=class extends h{constructor(ee,B,te){super();re(this,"type","Macro");this.name=ee,this.args=B,this.body=te}},y=class extends h{constructor(){super(...arguments);re(this,"type","Expression")}},k=class extends y{constructor(ee,B,te){super();re(this,"type","MemberExpression");this.object=ee,this.property=B,this.computed=te}},E=class extends y{constructor(ee,B){super();re(this,"type","CallExpression");this.callee=ee,this.args=B}},M=class extends y{constructor(ee){super();re(this,"type","Identifier");this.value=ee}},w=class extends y{constructor(ee){super();re(this,"type","Literal");this.value=ee}},x=class extends w{constructor(){super(...arguments);re(this,"type","NumericLiteral")}},$=class extends w{constructor(){super(...arguments);re(this,"type","StringLiteral")}},z=class extends w{constructor(){super(...arguments);re(this,"type","BooleanLiteral")}},R=class extends w{constructor(){super(...arguments);re(this,"type","NullLiteral")}},Q=class extends w{constructor(){super(...arguments);re(this,"type","ArrayLiteral")}},q=class extends w{constructor(){super(...arguments);re(this,"type","TupleLiteral")}},U=class extends w{constructor(){super(...arguments);re(this,"type","ObjectLiteral")}},Z=class extends y{constructor(ee,B,te){super();re(this,"type","BinaryExpression");this.operator=ee,this.left=B,this.right=te}},H=class extends y{constructor(ee,B){super();re(this,"type","FilterExpression");this.operand=ee,this.filter=B}},J=class extends y{constructor(ee,B){super();re(this,"type","SelectExpression");this.iterable=ee,this.test=B}},ie=class extends y{constructor(ee,B,te){super();re(this,"type","TestExpression");this.operand=ee,this.negate=B,this.test=te}},ae=class extends y{constructor(ee,B){super();re(this,"type","UnaryExpression");this.operator=ee,this.argument=B}},ce=class extends y{constructor(ee=void 0,B=void 0,te=void 0){super();re(this,"type","SliceExpression");this.start=ee,this.stop=B,this.step=te}},he=class extends y{constructor(ee,B){super();re(this,"type","KeywordArgumentExpression");this.key=ee,this.value=B}};function N(D){const ee=new g([]);let B=0;function te(Be,et){const it=D[B++];if(!it||it.type!==Be)throw new Error(`Parser Error: ${et}. ${it.type} !== ${Be}.`);return it}function de(){switch(D[B].type){case s.Text:return Re();case s.OpenStatement:return Fe();case s.OpenExpression:return je();default:throw new SyntaxError(`Unexpected token type: ${D[B].type}`)}}function be(...Be){return B+Be.length<=D.length&&Be.some((et,it)=>et!==D[B+it].type)}function ve(...Be){return B+Be.length<=D.length&&Be.every((et,it)=>et===D[B+it].type)}function Re(){return new $(te(s.Text,"Expected text token").value)}function Fe(){te(s.OpenStatement,"Expected opening statement token");let Be;switch(D[B].type){case s.Set:++B,Be=qe(),te(s.CloseStatement,"Expected closing statement token");break;case s.If:++B,Be=Xe(),te(s.OpenStatement,"Expected {% token"),te(s.EndIf,"Expected endif token"),te(s.CloseStatement,"Expected %} token");break;case s.Macro:++B,Be=ut(),te(s.OpenStatement,"Expected {% token"),te(s.EndMacro,"Expected endmacro token"),te(s.CloseStatement,"Expected %} token");break;case s.For:++B,Be=nr(),te(s.OpenStatement,"Expected {% token"),te(s.EndFor,"Expected endfor token"),te(s.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${D[B].type}`)}return Be}function je(){te(s.OpenExpression,"Expected opening expression token");const Be=jt();return te(s.CloseExpression,"Expected closing expression token"),Be}function qe(){const Be=jt();if(ve(s.Equals)){++B;const et=qe();return new A(Be,et)}return Be}function Xe(){var rr,zt,kr,ps,hs,Er,ms,fs;const Be=jt();te(s.CloseStatement,"Expected closing statement token");const et=[],it=[];for(;!(((rr=D[B])==null?void 0:rr.type)===s.OpenStatement&&(((zt=D[B+1])==null?void 0:zt.type)===s.ElseIf||((kr=D[B+1])==null?void 0:kr.type)===s.Else||((ps=D[B+1])==null?void 0:ps.type)===s.EndIf));)et.push(de());if(((hs=D[B])==null?void 0:hs.type)===s.OpenStatement&&((Er=D[B+1])==null?void 0:Er.type)!==s.EndIf)if(++B,ve(s.ElseIf))te(s.ElseIf,"Expected elseif token"),it.push(Xe());else for(te(s.Else,"Expected else token"),te(s.CloseStatement,"Expected closing statement token");!(((ms=D[B])==null?void 0:ms.type)===s.OpenStatement&&((fs=D[B+1])==null?void 0:fs.type)===s.EndIf);)it.push(de());return new _(Be,et,it)}function ut(){const Be=mr();if(Be.type!=="Identifier")throw new SyntaxError("Expected identifier following macro statement");const et=qr();te(s.CloseStatement,"Expected closing statement token");const it=[];for(;be(s.OpenStatement,s.EndMacro);)it.push(de());return new v(Be,et,it)}function wt(Be=!1){const et=Be?mr:jt,it=[et()],rr=ve(s.Comma);for(;rr&&(++B,it.push(et()),!!ve(s.Comma)););return rr?new q(it):it[0]}function nr(){const Be=wt(!0);if(!(Be instanceof M||Be instanceof q))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${Be.type} instead`);te(s.In,"Expected `in` keyword following loop variable");const et=jt();te(s.CloseStatement,"Expected closing statement token");const it=[];for(;be(s.OpenStatement,s.EndFor)&&be(s.OpenStatement,s.Else);)it.push(de());const rr=[];if(ve(s.OpenStatement,s.Else))for(++B,++B,te(s.CloseStatement,"Expected closing statement token");be(s.OpenStatement,s.EndFor);)rr.push(de());return new P(Be,et,it,rr)}function jt(){return dr()}function dr(){const Be=ds();if(ve(s.If)){++B;const et=ds();if(ve(s.Else)){++B;const it=ds();return new _(et,[Be],[it])}else return new J(Be,et)}return Be}function ds(){let Be=Os();for(;ve(s.Or);){const et=D[B];++B;const it=Os();Be=new Z(et,Be,it)}return Be}function Os(){let Be=Dr();for(;ve(s.And);){const et=D[B];++B;const it=Dr();Be=new Z(et,Be,it)}return Be}function Dr(){let Be;for(;ve(s.Not);){const et=D[B];++B;const it=Dr();Be=new ae(et,it)}return Be??cs()}function cs(){let Be=Ds();for(;ve(s.ComparisonBinaryOperator)||ve(s.In)||ve(s.NotIn);){const et=D[B];++B;const it=Ds();Be=new Z(et,Be,it)}return Be}function Ds(){let Be=xs();for(;ve(s.AdditiveBinaryOperator);){const et=D[B];++B;const it=xs();Be=new Z(et,Be,it)}return Be}function jr(){const Be=Ts(mr());return ve(s.OpenParen)?dt(Be):Be}function dt(Be){let et=new E(Be,qr());return et=Ts(et),ve(s.OpenParen)&&(et=dt(et)),et}function qr(){te(s.OpenParen,"Expected opening parenthesis for arguments list");const Be=Vr();return te(s.CloseParen,"Expected closing parenthesis for arguments list"),Be}function Vr(){const Be=[];for(;!ve(s.CloseParen);){let et=jt();if(ve(s.Equals)){if(++B,!(et instanceof M))throw new SyntaxError("Expected identifier for keyword argument");const it=jt();et=new he(et,it)}Be.push(et),ve(s.Comma)&&++B}return Be}function us(){const Be=[];let et=!1;for(;!ve(s.CloseSquareBracket);)ve(s.Colon)?(Be.push(void 0),++B,et=!0):(Be.push(jt()),ve(s.Colon)&&(++B,et=!0));if(Be.length===0)throw new SyntaxError("Expected at least one argument for member/slice expression");if(et){if(Be.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new ce(...Be)}return Be[0]}function Ts(Be){for(;ve(s.Dot)||ve(s.OpenSquareBracket);){const et=D[B];++B;let it;const rr=et.type!==s.Dot;if(rr)it=us(),te(s.CloseSquareBracket,"Expected closing square bracket");else if(it=mr(),it.type!=="Identifier")throw new SyntaxError("Expected identifier following dot operator");Be=new k(Be,it,rr)}return Be}function xs(){let Be=Es();for(;ve(s.MultiplicativeBinaryOperator);){const et=D[B];++B;const it=Es();Be=new Z(et,Be,it)}return Be}function Es(){let Be=Ls();for(;ve(s.Is);){++B;const et=ve(s.Not);et&&++B;let it=mr();if(it instanceof z?it=new M(it.value.toString()):it instanceof R&&(it=new M("none")),!(it instanceof M))throw new SyntaxError("Expected identifier for the test");Be=new ie(Be,et,it)}return Be}function Ls(){let Be=jr();for(;ve(s.Pipe);){++B;let et=mr();if(!(et instanceof M))throw new SyntaxError("Expected identifier for the filter");ve(s.OpenParen)&&(et=dt(et)),Be=new H(Be,et)}return Be}function mr(){const Be=D[B];switch(Be.type){case s.NumericLiteral:return++B,new x(Number(Be.value));case s.StringLiteral:return++B,new $(Be.value);case s.BooleanLiteral:return++B,new z(Be.value.toLowerCase()==="true");case s.NullLiteral:return++B,new R(null);case s.Identifier:return++B,new M(Be.value);case s.OpenParen:{++B;const et=wt();if(D[B].type!==s.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${D[B].type} instead`);return++B,et}case s.OpenSquareBracket:{++B;const et=[];for(;!ve(s.CloseSquareBracket);)et.push(jt()),ve(s.Comma)&&++B;return++B,new Q(et)}case s.OpenCurlyBracket:{++B;const et=new Map;for(;!ve(s.CloseCurlyBracket);){const it=jt();te(s.Colon,"Expected colon between key and value in object literal");const rr=jt();et.set(it,rr),ve(s.Comma)&&++B}return++B,new U(et)}default:throw new SyntaxError(`Unexpected token: ${Be.type}`)}}for(;B=0?(ee=(ee??(ee=0))<0?Math.max(D.length+ee,0):Math.min(ee,D.length),B=(B??(B=D.length))<0?Math.max(D.length+B,0):Math.min(B,D.length)):(ee=(ee??(ee=D.length-1))<0?Math.max(D.length+ee,-1):Math.min(ee,D.length-1),B=(B??(B=-1))<-1?Math.max(D.length+B,-1):Math.min(B,D.length-1));const be=[];for(let ve=ee;de*veee.toUpperCase())}var X=class{constructor(D=void 0){re(this,"type","RuntimeValue");re(this,"value");re(this,"builtins",new Map);this.value=D}__bool__(){return new ke(!!this.value)}},we=class extends X{constructor(){super(...arguments);re(this,"type","NumericValue")}},_e=class extends X{constructor(){super(...arguments);re(this,"type","StringValue");re(this,"builtins",new Map([["upper",new me(()=>new _e(this.value.toUpperCase()))],["lower",new me(()=>new _e(this.value.toLowerCase()))],["strip",new me(()=>new _e(this.value.trim()))],["title",new me(()=>new _e(se(this.value)))],["length",new we(this.value.length)],["rstrip",new me(()=>new _e(this.value.trimEnd()))],["lstrip",new me(()=>new _e(this.value.trimStart()))],["split",new me(ee=>{const B=ee[0]??new Pe;if(!(B instanceof _e||B instanceof Pe))throw new Error("sep argument must be a string or null");const te=ee[1]??new we(-1);if(!(te instanceof we))throw new Error("maxsplit argument must be a number");let de=[];if(B instanceof Pe){const be=this.value.trimStart();for(const{0:ve,index:Re}of be.matchAll(/\S+/g)){if(te.value!==-1&&de.length>=te.value&&Re!==void 0){de.push(ve+be.slice(Re+ve.length));break}de.push(ve)}}else{if(B.value==="")throw new Error("empty separator");de=this.value.split(B.value),te.value!==-1&&de.length>te.value&&de.push(de.splice(te.value).join(B.value))}return new K(de.map(be=>new _e(be)))})]]))}},ke=class extends X{constructor(){super(...arguments);re(this,"type","BooleanValue")}},He=class extends X{constructor(){super(...arguments);re(this,"type","ObjectValue");re(this,"builtins",new Map([["get",new me(([ee,B])=>{if(!(ee instanceof _e))throw new Error(`Object key must be a string: got ${ee.type}`);return this.value.get(ee.value)??B??new Pe})],["items",new me(()=>new K(Array.from(this.value.entries()).map(([ee,B])=>new K([new _e(ee),B]))))]]))}__bool__(){return new ke(this.value.size>0)}},Me=class extends He{constructor(){super(...arguments);re(this,"type","KeywordArgumentsValue")}},K=class extends X{constructor(){super(...arguments);re(this,"type","ArrayValue");re(this,"builtins",new Map([["length",new we(this.value.length)]]))}__bool__(){return new ke(this.value.length>0)}},j=class extends K{constructor(){super(...arguments);re(this,"type","TupleValue")}},me=class extends X{constructor(){super(...arguments);re(this,"type","FunctionValue")}},Pe=class extends X{constructor(){super(...arguments);re(this,"type","NullValue")}},xe=class extends X{constructor(){super(...arguments);re(this,"type","UndefinedValue")}},Ae=class{constructor(D){re(this,"variables",new Map([["namespace",new me(D=>{if(D.length===0)return new He(new Map);if(D.length!==1||!(D[0]instanceof He))throw new Error("`namespace` expects either zero arguments or a single object argument");return D[0]})]]));re(this,"tests",new Map([["boolean",D=>D.type==="BooleanValue"],["callable",D=>D instanceof me],["odd",D=>{if(D.type!=="NumericValue")throw new Error(`Cannot apply test "odd" to type: ${D.type}`);return D.value%2!==0}],["even",D=>{if(D.type!=="NumericValue")throw new Error(`Cannot apply test "even" to type: ${D.type}`);return D.value%2===0}],["false",D=>D.type==="BooleanValue"&&!D.value],["true",D=>D.type==="BooleanValue"&&D.value],["none",D=>D.type==="NullValue"],["string",D=>D.type==="StringValue"],["number",D=>D.type==="NumericValue"],["integer",D=>D.type==="NumericValue"&&Number.isInteger(D.value)],["iterable",D=>D.type==="ArrayValue"||D.type==="StringValue"],["mapping",D=>D.type==="ObjectValue"],["lower",D=>{const ee=D.value;return D.type==="StringValue"&&ee===ee.toLowerCase()}],["upper",D=>{const ee=D.value;return D.type==="StringValue"&&ee===ee.toUpperCase()}],["none",D=>D.type==="NullValue"],["defined",D=>D.type!=="UndefinedValue"],["undefined",D=>D.type==="UndefinedValue"],["equalto",(D,ee)=>D.value===ee.value],["eq",(D,ee)=>D.value===ee.value]]));this.parent=D}set(D,ee){return this.declareVariable(D,Le(ee))}declareVariable(D,ee){if(this.variables.has(D))throw new SyntaxError(`Variable already declared: ${D}`);return this.variables.set(D,ee),ee}setVariable(D,ee){return this.variables.set(D,ee),ee}resolve(D){if(this.variables.has(D))return this;if(this.parent)return this.parent.resolve(D);throw new Error(`Unknown variable: ${D}`)}lookupVariable(D){try{return this.resolve(D).variables.get(D)??new xe}catch{return new xe}}},Ie=class{constructor(D){re(this,"global");this.global=D??new Ae}run(D){return this.evaluate(D,this.global)}evaluateBinaryExpression(D,ee){const B=this.evaluate(D.left,ee);switch(D.operator.value){case"and":return B.__bool__().value?this.evaluate(D.right,ee):B;case"or":return B.__bool__().value?B:this.evaluate(D.right,ee)}const te=this.evaluate(D.right,ee);switch(D.operator.value){case"==":return new ke(B.value==te.value);case"!=":return new ke(B.value!=te.value)}if(B instanceof xe||te instanceof xe)throw new Error("Cannot perform operation on undefined values");if(B instanceof Pe||te instanceof Pe)throw new Error("Cannot perform operation on null values");if(B instanceof we&&te instanceof we)switch(D.operator.value){case"+":return new we(B.value+te.value);case"-":return new we(B.value-te.value);case"*":return new we(B.value*te.value);case"/":return new we(B.value/te.value);case"%":return new we(B.value%te.value);case"<":return new ke(B.value":return new ke(B.value>te.value);case">=":return new ke(B.value>=te.value);case"<=":return new ke(B.value<=te.value)}else if(B instanceof K&&te instanceof K)switch(D.operator.value){case"+":return new K(B.value.concat(te.value))}else if(te instanceof K){const de=te.value.find(be=>be.value===B.value)!==void 0;switch(D.operator.value){case"in":return new ke(de);case"not in":return new ke(!de)}}if(B instanceof _e||te instanceof _e)switch(D.operator.value){case"+":return new _e(B.value.toString()+te.value.toString())}if(B instanceof _e&&te instanceof _e)switch(D.operator.value){case"in":return new ke(te.value.includes(B.value));case"not in":return new ke(!te.value.includes(B.value))}if(B instanceof _e&&te instanceof He)switch(D.operator.value){case"in":return new ke(te.value.has(B.value));case"not in":return new ke(!te.value.has(B.value))}throw new SyntaxError(`Unknown operator "${D.operator.value}" between ${B.type} and ${te.type}`)}evaluateArguments(D,ee){const B=[],te=new Map;for(const de of D)if(de.type==="KeywordArgumentExpression"){const be=de;te.set(be.key.value,this.evaluate(be.value,ee))}else{if(te.size>0)throw new Error("Positional arguments must come before keyword arguments");B.push(this.evaluate(de,ee))}return[B,te]}evaluateFilterExpression(D,ee){const B=this.evaluate(D.operand,ee);if(D.filter.type==="Identifier"){const te=D.filter;if(te.value==="tojson")return new _e(Ne(B));if(B instanceof K)switch(te.value){case"list":return B;case"first":return B.value[0];case"last":return B.value[B.value.length-1];case"length":return new we(B.value.length);case"reverse":return new K(B.value.reverse());case"sort":return new K(B.value.sort((de,be)=>{if(de.type!==be.type)throw new Error(`Cannot compare different types: ${de.type} and ${be.type}`);switch(de.type){case"NumericValue":return de.value-be.value;case"StringValue":return de.value.localeCompare(be.value);default:throw new Error(`Cannot compare type: ${de.type}`)}}));case"join":return new _e(B.value.map(de=>de.value).join(""));default:throw new Error(`Unknown ArrayValue filter: ${te.value}`)}else if(B instanceof _e)switch(te.value){case"length":return new we(B.value.length);case"upper":return new _e(B.value.toUpperCase());case"lower":return new _e(B.value.toLowerCase());case"title":return new _e(se(B.value));case"capitalize":return new _e(B.value.charAt(0).toUpperCase()+B.value.slice(1));case"trim":return new _e(B.value.trim());case"indent":return new _e(B.value.split(` -`).map((de,be)=>be===0||de.length===0?de:" "+de).join(` -`));case"join":case"string":return B;default:throw new Error(`Unknown StringValue filter: ${te.value}`)}else if(B instanceof we)switch(te.value){case"abs":return new we(Math.abs(B.value));default:throw new Error(`Unknown NumericValue filter: ${te.value}`)}else if(B instanceof He)switch(te.value){case"items":return new K(Array.from(B.value.entries()).map(([de,be])=>new K([new _e(de),be])));case"length":return new we(B.value.size);default:throw new Error(`Unknown ObjectValue filter: ${te.value}`)}throw new Error(`Cannot apply filter "${te.value}" to type: ${B.type}`)}else if(D.filter.type==="CallExpression"){const te=D.filter;if(te.callee.type!=="Identifier")throw new Error(`Unknown filter: ${te.callee.type}`);const de=te.callee.value;if(de==="tojson"){const[,be]=this.evaluateArguments(te.args,ee),ve=be.get("indent")??new Pe;if(!(ve instanceof we||ve instanceof Pe))throw new Error("If set, indent must be a number");return new _e(Ne(B,ve.value))}else if(de==="join"){let be;if(B instanceof _e)be=Array.from(B.value);else if(B instanceof K)be=B.value.map(je=>je.value);else throw new Error(`Cannot apply filter "${de}" to type: ${B.type}`);const[ve,Re]=this.evaluateArguments(te.args,ee),Fe=ve.at(0)??Re.get("separator")??new _e("");if(!(Fe instanceof _e))throw new Error("separator must be a string");return new _e(be.join(Fe.value))}if(B instanceof K){switch(de){case"selectattr":case"rejectattr":{const be=de==="selectattr";if(B.value.some(Xe=>!(Xe instanceof He)))throw new Error(`\`${de}\` can only be applied to array of objects`);if(te.args.some(Xe=>Xe.type!=="StringLiteral"))throw new Error(`arguments of \`${de}\` must be strings`);const[ve,Re,Fe]=te.args.map(Xe=>this.evaluate(Xe,ee));let je;if(Re){const Xe=ee.tests.get(Re.value);if(!Xe)throw new Error(`Unknown test: ${Re.value}`);je=Xe}else je=(...Xe)=>Xe[0].__bool__().value;const qe=B.value.filter(Xe=>{const ut=Xe.value.get(ve.value),wt=ut?je(ut,Fe):!1;return be?wt:!wt});return new K(qe)}case"map":{const[,be]=this.evaluateArguments(te.args,ee);if(be.has("attribute")){const ve=be.get("attribute");if(!(ve instanceof _e))throw new Error("attribute must be a string");const Re=be.get("default"),Fe=B.value.map(je=>{if(!(je instanceof He))throw new Error("items in map must be an object");return je.value.get(ve.value)??Re??new xe});return new K(Fe)}else throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${de}`)}else if(B instanceof _e){switch(de){case"indent":{const[be,ve]=this.evaluateArguments(te.args,ee),Re=be.at(0)??ve.get("width")??new we(4);if(!(Re instanceof we))throw new Error("width must be a number");const Fe=be.at(1)??ve.get("first")??new ke(!1),je=be.at(2)??ve.get("blank")??new ke(!1),qe=B.value.split(` -`),Xe=" ".repeat(Re.value),ut=qe.map((wt,nr)=>!Fe.value&&nr===0||!je.value&&wt.length===0?wt:Xe+wt);return new _e(ut.join(` -`))}}throw new Error(`Unknown StringValue filter: ${de}`)}else throw new Error(`Cannot apply filter "${de}" to type: ${B.type}`)}throw new Error(`Unknown filter: ${D.filter.type}`)}evaluateTestExpression(D,ee){const B=this.evaluate(D.operand,ee),te=ee.tests.get(D.test.value);if(!te)throw new Error(`Unknown test: ${D.test.value}`);const de=te(B);return new ke(D.negate?!de:de)}evaluateUnaryExpression(D,ee){const B=this.evaluate(D.argument,ee);switch(D.operator.value){case"not":return new ke(!B.value);default:throw new SyntaxError(`Unknown operator: ${D.operator.value}`)}}evalProgram(D,ee){return this.evaluateBlock(D.body,ee)}evaluateBlock(D,ee){let B="";for(const te of D){const de=this.evaluate(te,ee);de.type!=="NullValue"&&de.type!=="UndefinedValue"&&(B+=de.value)}return new _e(B)}evaluateIdentifier(D,ee){return ee.lookupVariable(D.value)}evaluateCallExpression(D,ee){const[B,te]=this.evaluateArguments(D.args,ee);te.size>0&&B.push(new Me(te));const de=this.evaluate(D.callee,ee);if(de.type!=="FunctionValue")throw new Error(`Cannot call something that is not a function: got ${de.type}`);return de.value(B,ee)}evaluateSliceExpression(D,ee,B){if(!(D instanceof K||D instanceof _e))throw new Error("Slice object must be an array or string");const te=this.evaluate(ee.start,B),de=this.evaluate(ee.stop,B),be=this.evaluate(ee.step,B);if(!(te instanceof we||te instanceof xe))throw new Error("Slice start must be numeric or undefined");if(!(de instanceof we||de instanceof xe))throw new Error("Slice stop must be numeric or undefined");if(!(be instanceof we||be instanceof xe))throw new Error("Slice step must be numeric or undefined");return D instanceof K?new K(G(D.value,te.value,de.value,be.value)):new _e(G(Array.from(D.value),te.value,de.value,be.value).join(""))}evaluateMemberExpression(D,ee){const B=this.evaluate(D.object,ee);let te;if(D.computed){if(D.property.type==="SliceExpression")return this.evaluateSliceExpression(B,D.property,ee);te=this.evaluate(D.property,ee)}else te=new _e(D.property.value);let de;if(B instanceof He){if(!(te instanceof _e))throw new Error(`Cannot access property with non-string: got ${te.type}`);de=B.value.get(te.value)??B.builtins.get(te.value)}else if(B instanceof K||B instanceof _e)if(te instanceof we)de=B.value.at(te.value),B instanceof _e&&(de=new _e(B.value.at(te.value)));else if(te instanceof _e)de=B.builtins.get(te.value);else throw new Error(`Cannot access property with non-string/non-number: got ${te.type}`);else{if(!(te instanceof _e))throw new Error(`Cannot access property with non-string: got ${te.type}`);de=B.builtins.get(te.value)}return de instanceof X?de:new xe}evaluateSet(D,ee){const B=this.evaluate(D.value,ee);if(D.assignee.type==="Identifier"){const te=D.assignee.value;ee.setVariable(te,B)}else if(D.assignee.type==="MemberExpression"){const te=D.assignee,de=this.evaluate(te.object,ee);if(!(de instanceof He))throw new Error("Cannot assign to member of non-object");if(te.property.type!=="Identifier")throw new Error("Cannot assign to member with non-identifier property");de.value.set(te.property.value,B)}else throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(D.assignee)}`);return new Pe}evaluateIf(D,ee){const B=this.evaluate(D.test,ee);return this.evaluateBlock(B.__bool__().value?D.body:D.alternate,ee)}evaluateFor(D,ee){const B=new Ae(ee);let te,de;if(D.iterable.type==="SelectExpression"){const je=D.iterable;de=this.evaluate(je.iterable,B),te=je.test}else de=this.evaluate(D.iterable,B);if(!(de instanceof K))throw new Error(`Expected iterable type in for loop: got ${de.type}`);const be=[],ve=[];for(let je=0;jewt.setVariable(D.loopvar.value,Xe);else if(D.loopvar.type==="TupleLiteral"){const wt=D.loopvar;if(Xe.type!=="ArrayValue")throw new Error(`Cannot unpack non-iterable type: ${Xe.type}`);const nr=Xe;if(wt.value.length!==nr.value.length)throw new Error(`Too ${wt.value.length>nr.value.length?"few":"many"} items to unpack`);ut=jt=>{for(let dr=0;dr0?be[je-1]:new xe],["nextitem",je{var ve;const de=new Ae(te);B=B.slice();let be;((ve=B.at(-1))==null?void 0:ve.type)==="KeywordArgumentsValue"&&(be=B.pop());for(let Re=0;Rethis.evaluate(B,ee)));case"TupleLiteral":return new j(D.value.map(B=>this.evaluate(B,ee)));case"ObjectLiteral":{const B=new Map;for(const[te,de]of D.value){const be=this.evaluate(te,ee);if(!(be instanceof _e))throw new Error(`Object keys must be strings: got ${be.type}`);B.set(be.value,this.evaluate(de,ee))}return new He(B)}case"Identifier":return this.evaluateIdentifier(D,ee);case"CallExpression":return this.evaluateCallExpression(D,ee);case"MemberExpression":return this.evaluateMemberExpression(D,ee);case"UnaryExpression":return this.evaluateUnaryExpression(D,ee);case"BinaryExpression":return this.evaluateBinaryExpression(D,ee);case"FilterExpression":return this.evaluateFilterExpression(D,ee);case"TestExpression":return this.evaluateTestExpression(D,ee);default:throw new SyntaxError(`Unknown node type: ${D.type}`)}}};function Le(D){switch(typeof D){case"number":return new we(D);case"string":return new _e(D);case"boolean":return new ke(D);case"undefined":return new xe;case"object":return D===null?new Pe:Array.isArray(D)?new K(D.map(Le)):new He(new Map(Object.entries(D).map(([ee,B])=>[ee,Le(B)])));case"function":return new me((ee,B)=>{const te=D(...ee.map(de=>de.value))??null;return Le(te)});default:throw new Error(`Cannot convert to runtime value: ${D}`)}}function Ne(D,ee,B){const te=B??0;switch(D.type){case"NullValue":case"UndefinedValue":return"null";case"NumericValue":case"StringValue":case"BooleanValue":return JSON.stringify(D.value);case"ArrayValue":case"ObjectValue":{const de=ee?" ".repeat(ee):"",be=` -`+de.repeat(te),ve=be+de;if(D.type==="ArrayValue"){const Re=D.value.map(Fe=>Ne(Fe,ee,te+1));return ee?`[${ve}${Re.join(`,${ve}`)}${be}]`:`[${Re.join(", ")}]`}else{const Re=Array.from(D.value.entries()).map(([Fe,je])=>{const qe=`"${Fe}": ${Ne(je,ee,te+1)}`;return ee?`${ve}${qe}`:qe});return ee?`{${Re.join(",")}${be}}`:`{${Re.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${D.type}`)}}var We=class{constructor(D){re(this,"parsed");const ee=u(D,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=N(ee)}render(D){const ee=new Ae;if(ee.set("false",!1),ee.set("true",!0),ee.set("raise_exception",de=>{throw new Error(de)}),ee.set("range",O),D)for(const[de,be]of Object.entries(D))ee.set(de,be);return new Ie(ee).run(this.parsed).value}}},"./src/backends/onnx.js":(e,r,t)=>{var s;t.r(r),t.d(r,{Tensor:()=>a.Tensor,createInferenceSession:()=>A,deviceToExecutionProviders:()=>_,isONNXProxy:()=>k,isONNXTensor:()=>v});var i=t("./src/env.js"),n=t("?2ce3"),o=t("onnxruntime-web"),a=t("onnxruntime-common");const l=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}}),c=[];let p,u;const h=Symbol.for("onnxruntime");if(h in globalThis)u=globalThis[h];else if(i.apis.IS_NODE_ENV){switch(u=n??(s||(s=t.t(n,2))),process.platform){case"win32":c.push("dml");break;case"linux":process.arch==="x64"&&c.push("cuda");break}c.push("cpu"),p=["cpu"]}else u=o,i.apis.IS_WEBNN_AVAILABLE&&c.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),i.apis.IS_WEBGPU_AVAILABLE&&c.push("webgpu"),c.push("wasm"),p=["wasm"];const g=u.InferenceSession;function _(E=null){if(!E)return p;switch(E){case"auto":return c;case"gpu":return c.filter(M=>["webgpu","cuda","dml","webnn-gpu"].includes(M))}if(c.includes(E))return[l[E]??E];throw new Error(`Unsupported device: "${E}". Should be one of: ${c.join(", ")}.`)}let P=null;async function A(E,M,w){P&&await P;const x=g.create(E,M);P??(P=x);const $=await x;return $.config=w,$}function v(E){return E instanceof u.Tensor}const y=u==null?void 0:u.env;y!=null&&y.wasm&&(!(typeof ServiceWorkerGlobalScope<"u"&&self instanceof ServiceWorkerGlobalScope)&&!y.wasm.wasmPaths&&(y.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${i.env.version}/dist/`),y.wasm.proxy=!1),y!=null&&y.webgpu&&(y.webgpu.powerPreference="high-performance");function k(){var E;return(E=y==null?void 0:y.wasm)==null?void 0:E.proxy}i.env.backends.onnx=y},"./src/base/feature_extraction_utils.js":(e,r,t)=>{t.r(r),t.d(r,{FeatureExtractor:()=>o,validate_audio_inputs:()=>a});var s=t("./src/utils/constants.js"),i=t("./src/utils/generic.js"),n=t("./src/utils/hub.js");class o extends i.Callable{constructor(c){super(),this.config=c}static async from_pretrained(c,p){const u=await(0,n.getModelJSON)(c,s.FEATURE_EXTRACTOR_NAME,!0,p);return new this(u)}}function a(l,c){var p;if(!(l instanceof Float32Array||l instanceof Float64Array))throw new Error(`${c} expects input to be a Float32Array or a Float64Array, but got ${((p=l==null?void 0:l.constructor)==null?void 0:p.name)??typeof l} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}},"./src/base/image_processors_utils.js":(e,r,t)=>{t.r(r),t.d(r,{ImageProcessor:()=>E,center_to_corners_format:()=>u,post_process_instance_segmentation:()=>k,post_process_object_detection:()=>h,post_process_panoptic_segmentation:()=>y,post_process_semantic_segmentation:()=>g});var s=t("./src/utils/generic.js"),i=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");t("./src/utils/image.js");var o=t("./src/utils/core.js"),a=t("./src/utils/hub.js"),l=t("./src/utils/constants.js");function c(M,w,x=0,$=null){const z=M/w;let R=(0,n.bankers_round)(z)*w;return $!==null&&R>$&&(R=Math.floor(z)*w),Rw&&O.push(se)}else{let se=(0,n.max)(N.data)[1];if(se===U-1||(G=(0,n.softmax)(N.data),G[se]we*J[(_e+1)%2])),ie.boxes.push(X),ie.classes.push(se),ie.scores.push(G[se])}}Z.push(ie)}return Z}function g(M,w=null){const x=M.logits,$=x.dims[0];if(w!==null&&w.length!==$)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const z=[];for(let R=0;R<$;++R){const Q=w!==null?w[R]:null;let q=x[R];Q!==null&&(q=(0,i.interpolate)(q,Q,"bilinear",!1));const[U,Z]=Q??q.dims.slice(-2),H=new i.Tensor("int32",new Int32Array(U*Z),[U,Z]),J=q[0].data,ie=H.data;for(let he=1;heJ[O]&&(J[O]=N[O],ie[O]=he)}const ae=new Array(q.dims[0]);for(let he=0;hehe!==void 0);z.push({segmentation:H,labels:ce})}return z}function _(M,w,x,$){const z=[],R=[],Q=[];for(let q=0;qx&&(z.push(Z),R.push(ie),Q.push(H))}return[z,R,Q]}function P(M,w,x,$=.5,z=.8){const R=[];let Q=0,q=0;const U=w[x].data;for(let H=0;H=$&&++q;let Z=Q>0&&q>0;return Z&&(Z=Q/q>z),[Z,R]}function A(M,w,x,$,z,R=null,Q=null){const[q,U]=Q??M[0].dims,Z=new i.Tensor("int32",new Int32Array(q*U),[q,U]),H=[];if(Q!==null)for(let he=0;heie[G]&&(J[G]=he,ie[G]=O[G])}let ae=0;const ce=Z.data;for(let he=0;he200)throw new Error(`absolute aspect ratio must be smaller than 200, got ${Math.max(M,w)/Math.min(M,w)}`);let R=Math.round(M/x)*x,Q=Math.round(w/x)*x;if(R*Q>z){const q=Math.sqrt(M*w/z);R=Math.floor(M/q/x)*x,Q=Math.floor(w/q/x)*x}else if(R*Q<$){const q=Math.sqrt($/(M*w));R=Math.ceil(M*q/x)*x,Q=Math.ceil(w*q/x)*x}return[R,Q]}function y(M,w=.5,x=.5,$=.8,z=null,R=null){z===null&&(console.warn("`label_ids_to_fuse` unset. No instance will be fused."),z=new Set);const Q=M.class_queries_logits??M.logits,U=(M.masks_queries_logits??M.pred_masks).sigmoid();let[Z,H,J]=Q.dims;if(J-=1,R!==null&&R.length!==Z)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");let ie=[];for(let ae=0;aeR?Z=Math.floor(R*U/z):R>z&&(U=Math.floor(z*Z/R)),await w.resize(Z,U,{resample:$}))}async crop_margin(w,x=200){const $=w.clone().grayscale(),z=(0,n.min)($.data)[0],Q=(0,n.max)($.data)[0]-z;if(Q===0)return w;const q=x/255;let U=$.width,Z=$.height,H=0,J=0;const ie=$.data;for(let ae=0;ae<$.height;++ae){const ce=ae*$.width;for(let he=0;he<$.width;++he)(ie[ce+he]-z)/Qthis.preprocess(R)));return{pixel_values:(0,i.stack)($.map(R=>R.pixel_values),0),original_sizes:$.map(R=>R.original_size),reshaped_input_sizes:$.map(R=>R.reshaped_input_size)}}static async from_pretrained(w,x){const $=await(0,a.getModelJSON)(w,l.IMAGE_PROCESSOR_NAME,!0,x);return new this($)}}},"./src/base/processing_utils.js":(e,r,t)=>{t.r(r),t.d(r,{Processor:()=>o});var s=t("./src/utils/constants.js"),i=t("./src/utils/generic.js"),n=t("./src/utils/hub.js");class o extends i.Callable{constructor(l,c){super(),this.config=l,this.components=c}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(l,c={}){if(!this.tokenizer)throw new Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(l,{tokenize:!1,...c})}batch_decode(...l){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...l)}decode(...l){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...l)}async _call(l,...c){for(const p of[this.image_processor,this.feature_extractor,this.tokenizer])if(p)return p(l,...c);throw new Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(l,c){const[p,u]=await Promise.all([this.uses_processor_config?(0,n.getModelJSON)(l,s.PROCESSOR_NAME,!0,c):{},Promise.all(this.classes.filter(h=>h in this).map(async h=>{const g=await this[h].from_pretrained(l,c);return[h.replace(/_class$/,""),g]})).then(Object.fromEntries)]);return new this(p,u)}}re(o,"classes",["image_processor_class","tokenizer_class","feature_extractor_class"]),re(o,"uses_processor_config",!1)},"./src/configs.js":(e,r,t)=>{t.r(r),t.d(r,{AutoConfig:()=>c,PretrainedConfig:()=>l,getKeyValueShapes:()=>a});var s=t("./src/utils/core.js"),i=t("./src/utils/hub.js");async function n(p,u){return await(0,i.getModelJSON)(p,"config.json",!0,u)}function o(p){const u={};let h={};switch(p.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"smolvlm":h=o(p.text_config);break;case"moondream1":h=o(p.phi_config);break;case"musicgen":h=o(p.decoder);break;case"multi_modality":h=o(p.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":u.num_heads="n_head",u.num_layers="n_layer",u.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":u.num_heads="num_attention_heads",u.num_layers="num_hidden_layers",u.hidden_size="hidden_size";break;case"llama":case"olmo":case"olmo2":case"mobilellm":case"granite":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":u.num_heads="num_key_value_heads",u.num_layers="num_hidden_layers",u.hidden_size="hidden_size",u.num_attention_heads="num_attention_heads";break;case"gemma":case"gemma2":case"gemma3_text":case"glm":case"helium":u.num_heads="num_key_value_heads",u.num_layers="num_hidden_layers",u.dim_kv="head_dim";break;case"openelm":u.num_heads="num_kv_heads",u.num_layers="num_transformer_layers",u.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":u.num_heads="num_heads",u.num_layers="num_layers",u.hidden_size="hidden_size";break;case"bloom":u.num_heads="n_head",u.num_layers="n_layer",u.hidden_size="hidden_size";break;case"mpt":u.num_heads="n_heads",u.num_layers="n_layers",u.hidden_size="d_model";break;case"exaone":u.num_heads="num_key_value_heads",u.num_layers="num_layers",u.dim_kv="head_dim",u.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":u.num_decoder_layers="num_decoder_layers",u.num_decoder_heads="num_heads",u.decoder_dim_kv="d_kv",u.num_encoder_layers="num_layers",u.num_encoder_heads="num_heads",u.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":u.num_decoder_layers="decoder_layers",u.num_decoder_heads="decoder_attention_heads",u.decoder_hidden_size="d_model",u.num_encoder_layers="encoder_layers",u.num_encoder_heads="encoder_attention_heads",u.encoder_hidden_size="d_model";break;case"speecht5":u.num_decoder_layers="decoder_layers",u.num_decoder_heads="decoder_attention_heads",u.decoder_hidden_size="hidden_size",u.num_encoder_layers="encoder_layers",u.num_encoder_heads="encoder_attention_heads",u.encoder_hidden_size="hidden_size";break;case"trocr":u.num_encoder_layers=u.num_decoder_layers="decoder_layers",u.num_encoder_heads=u.num_decoder_heads="decoder_attention_heads",u.encoder_hidden_size=u.decoder_hidden_size="d_model";break;case"musicgen_decoder":u.num_encoder_layers=u.num_decoder_layers="num_hidden_layers",u.num_encoder_heads=u.num_decoder_heads="num_attention_heads",u.encoder_hidden_size=u.decoder_hidden_size="hidden_size";break;case"moonshine":u.num_decoder_layers="decoder_num_hidden_layers",u.num_decoder_heads="decoder_num_key_value_heads",u.num_encoder_layers="encoder_num_hidden_layers",u.num_encoder_heads="encoder_num_key_value_heads",u.encoder_hidden_size=u.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":const _=o(p.decoder),P="num_decoder_layers"in _,A=(0,s.pick)(p,["model_type","is_encoder_decoder"]);return P?(A.num_decoder_layers=_.num_decoder_layers,A.num_decoder_heads=_.num_decoder_heads,A.decoder_hidden_size=_.decoder_hidden_size,A.num_encoder_layers=_.num_encoder_layers,A.num_encoder_heads=_.num_encoder_heads,A.encoder_hidden_size=_.encoder_hidden_size):(A.num_layers=_.num_layers,A.num_heads=_.num_heads,A.hidden_size=_.hidden_size),A}const g={...h,...(0,s.pick)(p,["model_type","multi_query","is_encoder_decoder"])};for(const _ in u)g[_]=p[u[_]];return g}function a(p,{prefix:u="past_key_values",batch_size:h=1}={}){const g={},_=p.normalized_config;if(_.is_encoder_decoder&&"num_encoder_heads"in _&&"num_decoder_heads"in _){const P=_.encoder_dim_kv??_.encoder_hidden_size/_.num_encoder_heads,A=_.decoder_dim_kv??_.decoder_hidden_size/_.num_decoder_heads,v=[h,_.num_encoder_heads,0,P],y=[h,_.num_decoder_heads,0,A];for(let k=0;k<_.num_decoder_layers;++k)g[`${u}.${k}.encoder.key`]=v,g[`${u}.${k}.encoder.value`]=v,g[`${u}.${k}.decoder.key`]=y,g[`${u}.${k}.decoder.value`]=y}else{const P=_.num_heads,A=_.num_layers,v=_.dim_kv??_.hidden_size/(_.num_attention_heads??P);if(_.model_type==="falcon"){const y=[h*P,0,v];for(let k=0;k{var $,z;t.r(r),t.d(r,{apis:()=>A,env:()=>w});var s=t("?569f"),i=t("?3f59"),n=t("?154a");const o="3.4.2",a=typeof window<"u"&&typeof window.document<"u",l=typeof self<"u"&&(($=self.constructor)==null?void 0:$.name)==="DedicatedWorkerGlobalScope",c=typeof self<"u"&&"caches"in self,p=typeof navigator<"u"&&"gpu"in navigator,u=typeof navigator<"u"&&"ml"in navigator,h=typeof process<"u",g=h&&((z=process==null?void 0:process.release)==null?void 0:z.name)==="node",_=!x(s),P=!x(i),A=Object.freeze({IS_BROWSER_ENV:a,IS_WEBWORKER_ENV:l,IS_WEB_CACHE_AVAILABLE:c,IS_WEBGPU_AVAILABLE:p,IS_WEBNN_AVAILABLE:u,IS_PROCESS_AVAILABLE:h,IS_NODE_ENV:g,IS_FS_AVAILABLE:_,IS_PATH_AVAILABLE:P}),v=_&&P;let y="./";if(v){const R=Object({url:self.location.href}).url;R?y=i.dirname(i.dirname(n.fileURLToPath(R))):typeof __dirname<"u"&&(y=i.dirname(__dirname))}const k=v?i.join(y,"/.cache/"):null,E="/models/",M=v?i.join(y,E):E,w={version:o,backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(a||l),localModelPath:M,useFS:_,useBrowserCache:c,useFSCache:_,cacheDir:k,useCustomCache:!1,customCache:null};function x(R){return Object.keys(R).length===0}},"./src/generation/configuration_utils.js":(e,r,t)=>{t.r(r),t.d(r,{GenerationConfig:()=>i});var s=t("./src/utils/core.js");class i{constructor(o){re(this,"max_length",20);re(this,"max_new_tokens",null);re(this,"min_length",0);re(this,"min_new_tokens",null);re(this,"early_stopping",!1);re(this,"max_time",null);re(this,"do_sample",!1);re(this,"num_beams",1);re(this,"num_beam_groups",1);re(this,"penalty_alpha",null);re(this,"use_cache",!0);re(this,"temperature",1);re(this,"top_k",50);re(this,"top_p",1);re(this,"typical_p",1);re(this,"epsilon_cutoff",0);re(this,"eta_cutoff",0);re(this,"diversity_penalty",0);re(this,"repetition_penalty",1);re(this,"encoder_repetition_penalty",1);re(this,"length_penalty",1);re(this,"no_repeat_ngram_size",0);re(this,"bad_words_ids",null);re(this,"force_words_ids",null);re(this,"renormalize_logits",!1);re(this,"constraints",null);re(this,"forced_bos_token_id",null);re(this,"forced_eos_token_id",null);re(this,"remove_invalid_values",!1);re(this,"exponential_decay_length_penalty",null);re(this,"suppress_tokens",null);re(this,"streamer",null);re(this,"begin_suppress_tokens",null);re(this,"forced_decoder_ids",null);re(this,"guidance_scale",null);re(this,"num_return_sequences",1);re(this,"output_attentions",!1);re(this,"output_hidden_states",!1);re(this,"output_scores",!1);re(this,"return_dict_in_generate",!1);re(this,"pad_token_id",null);re(this,"bos_token_id",null);re(this,"eos_token_id",null);re(this,"encoder_no_repeat_ngram_size",0);re(this,"decoder_start_token_id",null);re(this,"generation_kwargs",{});Object.assign(this,(0,s.pick)(o,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":(e,r,t)=>{t.r(r),t.d(r,{ClassifierFreeGuidanceLogitsProcessor:()=>v,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>c,LogitsProcessor:()=>n,LogitsProcessorList:()=>a,LogitsWarper:()=>o,MinLengthLogitsProcessor:()=>_,MinNewTokensLengthLogitsProcessor:()=>P,NoBadWordsLogitsProcessor:()=>A,NoRepeatNGramLogitsProcessor:()=>h,RepetitionPenaltyLogitsProcessor:()=>g,SuppressTokensAtBeginLogitsProcessor:()=>p,TemperatureLogitsWarper:()=>y,TopKLogitsWarper:()=>E,TopPLogitsWarper:()=>k,WhisperTimeStampLogitsProcessor:()=>u});var s=t("./src/utils/generic.js");t("./src/utils/tensor.js");var i=t("./src/utils/maths.js");class n extends s.Callable{_call(w,x){throw Error("`_call` should be implemented in a subclass")}}class o extends s.Callable{_call(w,x){throw Error("`_call` should be implemented in a subclass")}}class a extends s.Callable{constructor(){super(),this.processors=[]}push(w){this.processors.push(w)}extend(w){this.processors.push(...w)}_call(w,x){let $=x;for(const z of this.processors)$=z(w,$);return $}[Symbol.iterator](){return this.processors.values()}}class l extends n{constructor(w){super(),this.bos_token_id=w}_call(w,x){for(let $=0;$=1&&R[R.length-1]>=this.timestamp_begin,q=R.length<2||R[R.length-2]>=this.timestamp_begin;if(Q&&(q?z.subarray(this.timestamp_begin).fill(-1/0):z.subarray(0,this.eos_token_id).fill(-1/0)),w[$].length===this.begin_index&&this.max_initial_timestamp_index!==null){const J=this.timestamp_begin+this.max_initial_timestamp_index;z.subarray(J+1).fill(-1/0)}const U=(0,i.log_softmax)(z),Z=Math.log(U.subarray(this.timestamp_begin).map(Math.exp).reduce((J,ie)=>J+ie)),H=(0,i.max)(U.subarray(0,this.timestamp_begin))[0];Z>H&&z.subarray(0,this.timestamp_begin).fill(-1/0)}return x}}class h extends n{constructor(w){super(),this.no_repeat_ngram_size=w}getNgrams(w){const x=w.length,$=[];for(let R=0;R1 to use the classifier free guidance processor, got guidance scale ${w}.`);this.guidance_scale=w}_call(w,x){if(x.dims[0]!==2*w.length)throw new Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${x.dims[0]} for the logits and ${w.length} for the input ids.`);const $=w.length,z=x.slice([0,$],null),R=x.slice([$,x.dims[0]],null);for(let Q=0;Q1)throw new Error(`\`top_p\` must be a float > 0 and < 1, but is ${w}`);if(!Number.isInteger($)||$<1)throw new Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${$}`);this.top_p=w,this.filter_value=x,this.min_tokens_to_keep=$}}class E extends o{constructor(w,{filter_value:x=-1/0,min_tokens_to_keep:$=1}={}){if(super(),!Number.isInteger(w)||w<0)throw new Error(`\`top_k\` must be a positive integer, but is ${w}`);this.top_k=Math.max(w,$),this.filter_value=x}}},"./src/generation/logits_sampler.js":(e,r,t)=>{t.r(r),t.d(r,{LogitsSampler:()=>o});var s=t("./src/utils/generic.js"),i=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");t("./src/generation/configuration_utils.js");class o extends s.Callable{constructor(u){super(),this.generation_config=u}async _call(u){return this.sample(u)}async sample(u){throw Error("sample should be implemented in subclasses.")}getLogits(u,h){let g=u.dims.at(-1),_=u.data;if(h===-1)_=_.slice(-g);else{let P=h*g;_=_.slice(P,P+g)}return _}randomSelect(u){let h=0;for(let _=0;_1)return new c(u);if(u.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${u.num_return_sequences}.`);return new a(u)}}class a extends o{async sample(u){const h=(0,n.max)(u.data)[1];return[[BigInt(h),0]]}}class l extends o{async sample(u){let h=u.dims.at(-1);this.generation_config.top_k>0&&(h=Math.min(this.generation_config.top_k,h));const[g,_]=await(0,i.topk)(u,h),P=(0,n.softmax)(g.data);return Array.from({length:this.generation_config.num_beams},()=>{const A=this.randomSelect(P);return[_.data[A],Math.log(P[A])]})}}class c extends o{async sample(u){let h=u.dims.at(-1);this.generation_config.top_k>0&&(h=Math.min(this.generation_config.top_k,h));const[g,_]=await(0,i.topk)(u,h),P=(0,n.softmax)(g.data);return Array.from({length:this.generation_config.num_beams},(A,v)=>[_.data[v],Math.log(P[v])])}}},"./src/generation/stopping_criteria.js":(e,r,t)=>{t.r(r),t.d(r,{EosTokenCriteria:()=>a,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>o,StoppingCriteria:()=>i,StoppingCriteriaList:()=>n});var s=t("./src/utils/generic.js");class i extends s.Callable{_call(p,u){throw Error("StoppingCriteria needs to be subclassed")}}class n extends s.Callable{constructor(){super(),this.criteria=[]}push(p){this.criteria.push(p)}extend(p){p instanceof n?p=p.criteria:p instanceof i&&(p=[p]),this.criteria.push(...p)}_call(p,u){const h=new Array(p.length).fill(!1);for(const g of this.criteria){const _=g(p,u);for(let P=0;Pu.length>=this.max_length)}}class a extends i{constructor(p){super(),Array.isArray(p)||(p=[p]),this.eos_token_id=p}_call(p,u){return p.map(h=>{const g=h.at(-1);return this.eos_token_id.some(_=>g==_)})}}class l extends i{constructor(){super(),this.interrupted=!1}interrupt(){this.interrupted=!0}reset(){this.interrupted=!1}_call(p,u){return new Array(p.length).fill(this.interrupted)}}},"./src/generation/streamers.js":(e,r,t)=>{t.r(r),t.d(r,{BaseStreamer:()=>o,TextStreamer:()=>l,WhisperTextStreamer:()=>c});var s=t("./src/utils/core.js"),i=t("./src/tokenizers.js"),n=t("./src/env.js");class o{put(u){throw Error("Not implemented")}end(){throw Error("Not implemented")}}const a=n.apis.IS_PROCESS_AVAILABLE?p=>process.stdout.write(p):p=>console.log(p);class l extends o{constructor(u,{skip_prompt:h=!1,callback_function:g=null,token_callback_function:_=null,skip_special_tokens:P=!0,decode_kwargs:A={},...v}={}){super(),this.tokenizer=u,this.skip_prompt=h,this.callback_function=g??a,this.token_callback_function=_,this.decode_kwargs={skip_special_tokens:P,...A,...v},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(u){var A;if(u.length>1)throw Error("TextStreamer only supports batch size of 1");const h=this.next_tokens_are_prompt;if(h&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;const g=u[0];(A=this.token_callback_function)==null||A.call(this,g),this.token_cache=(0,s.mergeArrays)(this.token_cache,g);const _=this.tokenizer.decode(this.token_cache,this.decode_kwargs);let P;h||_.endsWith(` -`)?(P=_.slice(this.print_len),this.token_cache=[],this.print_len=0):_.length>0&&(0,i.is_chinese_char)(_.charCodeAt(_.length-1))?(P=_.slice(this.print_len),this.print_len+=P.length):(P=_.slice(this.print_len,_.lastIndexOf(" ")+1),this.print_len+=P.length),this.on_finalized_text(P,!1)}end(){let u;this.token_cache.length>0?(u=this.tokenizer.decode(this.token_cache,this.decode_kwargs).slice(this.print_len),this.token_cache=[],this.print_len=0):u="",this.next_tokens_are_prompt=!0,this.on_finalized_text(u,!0)}on_finalized_text(u,h){var g,_;u.length>0&&((g=this.callback_function)==null||g.call(this,u)),h&&this.callback_function===a&&n.apis.IS_PROCESS_AVAILABLE&&((_=this.callback_function)==null||_.call(this,` -`))}}class c extends l{constructor(u,{skip_prompt:h=!1,callback_function:g=null,token_callback_function:_=null,on_chunk_start:P=null,on_chunk_end:A=null,on_finalize:v=null,time_precision:y=.02,skip_special_tokens:k=!0,decode_kwargs:E={}}={}){super(u,{skip_prompt:h,skip_special_tokens:k,callback_function:g,token_callback_function:_,decode_kwargs:E}),this.timestamp_begin=u.timestamp_begin,this.on_chunk_start=P,this.on_chunk_end=A,this.on_finalize=v,this.time_precision=y,this.waiting_for_timestamp=!1}put(u){var g,_;if(u.length>1)throw Error("WhisperTextStreamer only supports batch size of 1");const h=u[0];if(h.length===1){const P=Number(h[0])-this.timestamp_begin;if(P>=0){const A=P*this.time_precision;this.waiting_for_timestamp?(g=this.on_chunk_end)==null||g.call(this,A):(_=this.on_chunk_start)==null||_.call(this,A),this.waiting_for_timestamp=!this.waiting_for_timestamp,u=[[]]}}return super.put(u)}end(){var u;super.end(),(u=this.on_finalize)==null||u.call(this)}}},"./src/models.js":(e,r,t)=>{t.r(r),t.d(r,{ASTForAudioClassification:()=>Ua,ASTModel:()=>Va,ASTPreTrainedModel:()=>Ki,AlbertForMaskedLM:()=>V,AlbertForQuestionAnswering:()=>F,AlbertForSequenceClassification:()=>pe,AlbertModel:()=>Cn,AlbertPreTrainedModel:()=>Ss,AutoModel:()=>Pu,AutoModelForAudioClassification:()=>db,AutoModelForAudioFrameClassification:()=>ub,AutoModelForAudioTextToText:()=>Mb,AutoModelForCTC:()=>lb,AutoModelForCausalLM:()=>J0,AutoModelForDepthEstimation:()=>fb,AutoModelForDocumentQuestionAnswering:()=>pb,AutoModelForImageClassification:()=>tb,AutoModelForImageFeatureExtraction:()=>wb,AutoModelForImageMatting:()=>hb,AutoModelForImageSegmentation:()=>rb,AutoModelForImageTextToText:()=>yb,AutoModelForImageToImage:()=>mb,AutoModelForMaskGeneration:()=>ab,AutoModelForMaskedLM:()=>Y0,AutoModelForNormalEstimation:()=>_b,AutoModelForObjectDetection:()=>ib,AutoModelForPoseEstimation:()=>gb,AutoModelForQuestionAnswering:()=>Z0,AutoModelForSemanticSegmentation:()=>sb,AutoModelForSeq2SeqLM:()=>H0,AutoModelForSequenceClassification:()=>G0,AutoModelForSpeechSeq2Seq:()=>q0,AutoModelForTextToSpectrogram:()=>Q0,AutoModelForTextToWaveform:()=>X0,AutoModelForTokenClassification:()=>K0,AutoModelForUniversalSegmentation:()=>nb,AutoModelForVision2Seq:()=>eb,AutoModelForXVector:()=>cb,AutoModelForZeroShotObjectDetection:()=>ob,BartForConditionalGeneration:()=>Wt,BartForSequenceClassification:()=>Ot,BartModel:()=>kt,BartPretrainedModel:()=>Ct,BaseModelOutput:()=>Pe,BeitForImageClassification:()=>Il,BeitModel:()=>kl,BeitPreTrainedModel:()=>ia,BertForMaskedLM:()=>Ie,BertForQuestionAnswering:()=>We,BertForSequenceClassification:()=>Le,BertForTokenClassification:()=>Ne,BertModel:()=>Ae,BertPreTrainedModel:()=>xe,BlenderbotForConditionalGeneration:()=>Zt,BlenderbotModel:()=>Gt,BlenderbotPreTrainedModel:()=>gs,BlenderbotSmallForConditionalGeneration:()=>ws,BlenderbotSmallModel:()=>Zr,BlenderbotSmallPreTrainedModel:()=>gr,BloomForCausalLM:()=>jo,BloomModel:()=>No,BloomPreTrainedModel:()=>wi,CLIPModel:()=>eo,CLIPPreTrainedModel:()=>Vs,CLIPSegForImageSegmentation:()=>to,CLIPSegModel:()=>on,CLIPSegPreTrainedModel:()=>nn,CLIPTextModel:()=>Yc,CLIPTextModelWithProjection:()=>Ya,CLIPVisionModel:()=>Zc,CLIPVisionModelWithProjection:()=>Qn,CamembertForMaskedLM:()=>Ts,CamembertForQuestionAnswering:()=>Ls,CamembertForSequenceClassification:()=>xs,CamembertForTokenClassification:()=>Es,CamembertModel:()=>us,CamembertPreTrainedModel:()=>Vr,CausalLMOutput:()=>Fn,CausalLMOutputWithPast:()=>DT,ChineseCLIPModel:()=>sl,ChineseCLIPPreTrainedModel:()=>rl,ClapAudioModelWithProjection:()=>CM,ClapModel:()=>EM,ClapPreTrainedModel:()=>Wl,ClapTextModelWithProjection:()=>PM,CodeGenForCausalLM:()=>Ur,CodeGenModel:()=>In,CodeGenPreTrainedModel:()=>ti,CohereForCausalLM:()=>To,CohereModel:()=>vo,CoherePreTrainedModel:()=>ci,ConvBertForMaskedLM:()=>jt,ConvBertForQuestionAnswering:()=>Os,ConvBertForSequenceClassification:()=>dr,ConvBertForTokenClassification:()=>ds,ConvBertModel:()=>nr,ConvBertPreTrainedModel:()=>wt,ConvNextForImageClassification:()=>by,ConvNextModel:()=>My,ConvNextPreTrainedModel:()=>nu,ConvNextV2ForImageClassification:()=>Ty,ConvNextV2Model:()=>vy,ConvNextV2PreTrainedModel:()=>iu,DPTForDepthEstimation:()=>ry,DPTModel:()=>ty,DPTPreTrainedModel:()=>tu,DacDecoderModel:()=>f0,DacDecoderOutput:()=>p0,DacEncoderModel:()=>m0,DacEncoderOutput:()=>u0,DacModel:()=>h0,DacPreTrainedModel:()=>Jl,DebertaForMaskedLM:()=>et,DebertaForQuestionAnswering:()=>zt,DebertaForSequenceClassification:()=>it,DebertaForTokenClassification:()=>rr,DebertaModel:()=>Be,DebertaPreTrainedModel:()=>mr,DebertaV2ForMaskedLM:()=>hs,DebertaV2ForQuestionAnswering:()=>fs,DebertaV2ForSequenceClassification:()=>Er,DebertaV2ForTokenClassification:()=>ms,DebertaV2Model:()=>ps,DebertaV2PreTrainedModel:()=>kr,DecisionTransformerModel:()=>qM,DecisionTransformerPreTrainedModel:()=>HM,DeiTForImageClassification:()=>Ee,DeiTModel:()=>ye,DeiTPreTrainedModel:()=>ne,DepthAnythingForDepthEstimation:()=>ny,DepthAnythingPreTrainedModel:()=>sy,DepthProForDepthEstimation:()=>dy,DepthProPreTrainedModel:()=>ly,DetrForObjectDetection:()=>Fl,DetrForSegmentation:()=>oa,DetrModel:()=>Al,DetrObjectDetectionOutput:()=>aa,DetrPreTrainedModel:()=>Ti,DetrSegmentationOutput:()=>Ol,Dinov2ForImageClassification:()=>Ey,Dinov2Model:()=>xy,Dinov2PreTrainedModel:()=>ou,Dinov2WithRegistersForImageClassification:()=>Cy,Dinov2WithRegistersModel:()=>Py,Dinov2WithRegistersPreTrainedModel:()=>au,DistilBertForMaskedLM:()=>Ys,DistilBertForQuestionAnswering:()=>Js,DistilBertForSequenceClassification:()=>Qs,DistilBertForTokenClassification:()=>Xs,DistilBertModel:()=>Ps,DistilBertPreTrainedModel:()=>Qr,DonutSwinModel:()=>yy,DonutSwinPreTrainedModel:()=>wy,EfficientNetForImageClassification:()=>OM,EfficientNetModel:()=>FM,EfficientNetPreTrainedModel:()=>gu,ElectraForMaskedLM:()=>Ds,ElectraForQuestionAnswering:()=>qr,ElectraForSequenceClassification:()=>jr,ElectraForTokenClassification:()=>dt,ElectraModel:()=>cs,ElectraPreTrainedModel:()=>Dr,EsmForMaskedLM:()=>en,EsmForSequenceClassification:()=>tn,EsmForTokenClassification:()=>Lr,EsmModel:()=>Zs,EsmPreTrainedModel:()=>_s,ExaoneForCausalLM:()=>mt,ExaoneModel:()=>fo,ExaonePreTrainedModel:()=>Us,FalconForCausalLM:()=>xM,FalconModel:()=>TM,FalconPreTrainedModel:()=>mu,FastViTForImageClassification:()=>yl,FastViTModel:()=>wl,FastViTPreTrainedModel:()=>ea,Florence2ForConditionalGeneration:()=>Xi,Florence2PreTrainedModel:()=>Xa,GLPNForDepthEstimation:()=>gy,GLPNModel:()=>_y,GLPNPreTrainedModel:()=>su,GPT2LMHeadModel:()=>Yn,GPT2Model:()=>al,GPT2PreTrainedModel:()=>ro,GPTBigCodeForCausalLM:()=>uo,GPTBigCodeModel:()=>dl,GPTBigCodePreTrainedModel:()=>Oe,GPTJForCausalLM:()=>kn,GPTJModel:()=>co,GPTJPreTrainedModel:()=>lo,GPTNeoForCausalLM:()=>oo,GPTNeoModel:()=>io,GPTNeoPreTrainedModel:()=>Zn,GPTNeoXForCausalLM:()=>ao,GPTNeoXModel:()=>ll,GPTNeoXPreTrainedModel:()=>ei,Gemma2ForCausalLM:()=>Co,Gemma2Model:()=>Po,Gemma2PreTrainedModel:()=>pi,Gemma3ForCausalLM:()=>$o,Gemma3Model:()=>So,Gemma3PreTrainedModel:()=>hi,GemmaForCausalLM:()=>Eo,GemmaModel:()=>xo,GemmaPreTrainedModel:()=>ui,GlmForCausalLM:()=>gt,GlmModel:()=>mo,GlmPreTrainedModel:()=>ii,GraniteForCausalLM:()=>bo,GraniteModel:()=>Mo,GranitePreTrainedModel:()=>di,GroundingDinoForObjectDetection:()=>$y,GroundingDinoPreTrainedModel:()=>Sy,GroupViTModel:()=>gl,GroupViTPreTrainedModel:()=>_l,HeliumForCausalLM:()=>ni,HeliumModel:()=>ho,HeliumPreTrainedModel:()=>si,HieraForImageClassification:()=>ot,HieraModel:()=>Ye,HieraPreTrainedModel:()=>ze,HubertForCTC:()=>iM,HubertForSequenceClassification:()=>oM,HubertModel:()=>nM,HubertPreTrainedModel:()=>bT,IJepaForImageClassification:()=>Qo,IJepaModel:()=>qo,IJepaPreTrainedModel:()=>vi,Idefics3ForConditionalGeneration:()=>Hn,Idefics3PreTrainedModel:()=>Ja,ImageMattingOutput:()=>vb,JAISLMHeadModel:()=>no,JAISModel:()=>so,JAISPreTrainedModel:()=>$n,JinaCLIPModel:()=>nl,JinaCLIPPreTrainedModel:()=>Jn,JinaCLIPTextModel:()=>il,JinaCLIPVisionModel:()=>ol,LiteWhisperForConditionalGeneration:()=>Ga,LlamaForCausalLM:()=>po,LlamaModel:()=>ri,LlamaPreTrainedModel:()=>an,LlavaForConditionalGeneration:()=>Kn,LlavaOnevisionForConditionalGeneration:()=>qa,LlavaPreTrainedModel:()=>Ha,LongT5ForConditionalGeneration:()=>Qe,LongT5Model:()=>Ue,LongT5PreTrainedModel:()=>Ce,M2M100ForConditionalGeneration:()=>Ry,M2M100Model:()=>By,M2M100PreTrainedModel:()=>cu,MBartForCausalLM:()=>Tr,MBartForConditionalGeneration:()=>_r,MBartForSequenceClassification:()=>Yr,MBartModel:()=>vr,MBartPreTrainedModel:()=>Vt,MPNetForMaskedLM:()=>zr,MPNetForQuestionAnswering:()=>Ar,MPNetForSequenceClassification:()=>En,MPNetForTokenClassification:()=>Rs,MPNetModel:()=>xn,MPNetPreTrainedModel:()=>Xr,MT5ForConditionalGeneration:()=>ht,MT5Model:()=>Ze,MT5PreTrainedModel:()=>Ke,MarianMTModel:()=>zy,MarianModel:()=>Ly,MarianPreTrainedModel:()=>du,MaskFormerForInstanceSegmentation:()=>fy,MaskFormerModel:()=>my,MaskFormerPreTrainedModel:()=>ru,MaskedLMOutput:()=>wr,Metric3DForDepthEstimation:()=>uy,Metric3DPreTrainedModel:()=>cy,Metric3Dv2ForDepthEstimation:()=>hy,Metric3Dv2PreTrainedModel:()=>py,MgpstrForSceneTextRecognition:()=>ZM,MgpstrModelOutput:()=>JM,MgpstrPreTrainedModel:()=>YM,MimiDecoderModel:()=>c0,MimiDecoderOutput:()=>a0,MimiEncoderModel:()=>d0,MimiEncoderOutput:()=>o0,MimiModel:()=>l0,MimiPreTrainedModel:()=>Xl,MistralForCausalLM:()=>MM,MistralModel:()=>yM,MistralPreTrainedModel:()=>pu,MobileBertForMaskedLM:()=>zs,MobileBertForQuestionAnswering:()=>Ir,MobileBertForSequenceClassification:()=>Bs,MobileBertModel:()=>br,MobileBertPreTrainedModel:()=>Cs,MobileLLMForCausalLM:()=>_o,MobileLLMModel:()=>ft,MobileLLMPreTrainedModel:()=>An,MobileNetV1ForImageClassification:()=>LM,MobileNetV1ForSemanticSegmentation:()=>zM,MobileNetV1Model:()=>DM,MobileNetV1PreTrainedModel:()=>Kl,MobileNetV2ForImageClassification:()=>RM,MobileNetV2ForSemanticSegmentation:()=>NM,MobileNetV2Model:()=>BM,MobileNetV2PreTrainedModel:()=>Hl,MobileNetV3ForImageClassification:()=>VM,MobileNetV3ForSemanticSegmentation:()=>UM,MobileNetV3Model:()=>jM,MobileNetV3PreTrainedModel:()=>ql,MobileNetV4ForImageClassification:()=>GM,MobileNetV4ForSemanticSegmentation:()=>KM,MobileNetV4Model:()=>WM,MobileNetV4PreTrainedModel:()=>Ql,MobileViTForImageClassification:()=>Tl,MobileViTModel:()=>vl,MobileViTPreTrainedModel:()=>ta,MobileViTV2ForImageClassification:()=>El,MobileViTV2Model:()=>xl,MobileViTV2PreTrainedModel:()=>ra,ModelOutput:()=>me,ModernBertForMaskedLM:()=>B,ModernBertForSequenceClassification:()=>te,ModernBertForTokenClassification:()=>de,ModernBertModel:()=>ee,ModernBertPreTrainedModel:()=>D,Moondream1ForConditionalGeneration:()=>Qa,MoonshineForConditionalGeneration:()=>Ka,MoonshineModel:()=>Jc,MoonshinePreTrainedModel:()=>qi,MptForCausalLM:()=>Uo,MptModel:()=>Vo,MptPreTrainedModel:()=>yi,MultiModalityCausalLM:()=>XM,MultiModalityPreTrainedModel:()=>QM,MusicgenForCausalLM:()=>ET,MusicgenForConditionalGeneration:()=>yu,MusicgenModel:()=>xT,MusicgenPreTrainedModel:()=>wu,NomicBertModel:()=>ve,NomicBertPreTrainedModel:()=>be,OPTForCausalLM:()=>Go,OPTModel:()=>Wo,OPTPreTrainedModel:()=>Mi,Olmo2ForCausalLM:()=>li,Olmo2Model:()=>yo,Olmo2PreTrainedModel:()=>ai,OlmoForCausalLM:()=>wo,OlmoModel:()=>go,OlmoPreTrainedModel:()=>oi,OpenELMForCausalLM:()=>Io,OpenELMModel:()=>ko,OpenELMPreTrainedModel:()=>mi,OwlViTForObjectDetection:()=>Cl,OwlViTModel:()=>Pl,OwlViTPreTrainedModel:()=>sa,Owlv2ForObjectDetection:()=>$l,Owlv2Model:()=>Sl,Owlv2PreTrainedModel:()=>na,PaliGemmaForConditionalGeneration:()=>Yi,PaliGemmaPreTrainedModel:()=>Ji,PatchTSMixerForPrediction:()=>s0,PatchTSMixerModel:()=>r0,PatchTSMixerPreTrainedModel:()=>bu,PatchTSTForPrediction:()=>t0,PatchTSTModel:()=>e0,PatchTSTPreTrainedModel:()=>Mu,Phi3ForCausalLM:()=>Ro,Phi3Model:()=>Bo,Phi3PreTrainedModel:()=>gi,Phi3VForCausalLM:()=>js,Phi3VPreTrainedModel:()=>Zi,PhiForCausalLM:()=>zo,PhiModel:()=>Lo,PhiPreTrainedModel:()=>_i,PreTrainedModel:()=>j,PretrainedMixin:()=>It,PvtForImageClassification:()=>ul,PvtModel:()=>cl,PvtPreTrainedModel:()=>Yo,PyAnnoteForAudioFrameClassification:()=>Gy,PyAnnoteModel:()=>Wy,PyAnnotePreTrainedModel:()=>uu,QuestionAnsweringModelOutput:()=>Pr,Qwen2ForCausalLM:()=>Fo,Qwen2Model:()=>Ao,Qwen2PreTrainedModel:()=>fi,Qwen2VLForConditionalGeneration:()=>Do,Qwen2VLPreTrainedModel:()=>Oo,RFDetrForObjectDetection:()=>d,RFDetrModel:()=>ua,RFDetrObjectDetectionOutput:()=>m,RFDetrPreTrainedModel:()=>ca,RTDetrForObjectDetection:()=>Ll,RTDetrModel:()=>Dl,RTDetrObjectDetectionOutput:()=>xi,RTDetrPreTrainedModel:()=>la,RTDetrV2ForObjectDetection:()=>Bl,RTDetrV2Model:()=>zl,RTDetrV2ObjectDetectionOutput:()=>Rl,RTDetrV2PreTrainedModel:()=>da,ResNetForImageClassification:()=>Fr,ResNetModel:()=>Bt,ResNetPreTrainedModel:()=>_t,RoFormerForMaskedLM:()=>je,RoFormerForQuestionAnswering:()=>ut,RoFormerForSequenceClassification:()=>qe,RoFormerForTokenClassification:()=>Xe,RoFormerModel:()=>Fe,RoFormerPreTrainedModel:()=>Re,RobertaForMaskedLM:()=>Rt,RobertaForQuestionAnswering:()=>er,RobertaForSequenceClassification:()=>Jt,RobertaForTokenClassification:()=>qt,RobertaModel:()=>ur,RobertaPreTrainedModel:()=>Ht,SamImageSegmentationOutput:()=>Dy,SamModel:()=>Oy,SamPreTrainedModel:()=>Fy,SapiensForDepthEstimation:()=>oy,SapiensForNormalEstimation:()=>ay,SapiensForSemanticSegmentation:()=>iy,SapiensPreTrainedModel:()=>Nl,SegformerForImageClassification:()=>$M,SegformerForSemanticSegmentation:()=>kM,SegformerModel:()=>TT,SegformerPreTrainedModel:()=>Gl,Seq2SeqLMOutput:()=>OT,SequenceClassifierOutput:()=>bt,SiglipModel:()=>Za,SiglipPreTrainedModel:()=>Xn,SiglipTextModel:()=>el,SiglipVisionModel:()=>tl,SmolVLMForConditionalGeneration:()=>qn,SnacDecoderModel:()=>w0,SnacEncoderModel:()=>g0,SnacModel:()=>_0,SnacPreTrainedModel:()=>Yl,SpeechT5ForSpeechToText:()=>mM,SpeechT5ForTextToSpeech:()=>fM,SpeechT5HifiGan:()=>_M,SpeechT5Model:()=>vT,SpeechT5PreTrainedModel:()=>Ul,SqueezeBertForMaskedLM:()=>fr,SqueezeBertForQuestionAnswering:()=>Pn,SqueezeBertForSequenceClassification:()=>Ns,SqueezeBertModel:()=>cr,SqueezeBertPreTrainedModel:()=>Jr,StableLmForCausalLM:()=>AM,StableLmModel:()=>IM,StableLmPreTrainedModel:()=>_u,Starcoder2ForCausalLM:()=>vM,Starcoder2Model:()=>bM,Starcoder2PreTrainedModel:()=>hu,StyleTextToSpeech2Model:()=>hM,StyleTextToSpeech2PreTrainedModel:()=>pM,Swin2SRForImageSuperResolution:()=>ey,Swin2SRModel:()=>Zw,Swin2SRPreTrainedModel:()=>eu,SwinForImageClassification:()=>Jw,SwinForSemanticSegmentation:()=>Yw,SwinModel:()=>Xw,SwinPreTrainedModel:()=>$s,T5ForConditionalGeneration:()=>ue,T5Model:()=>le,T5PreTrainedModel:()=>Y,TableTransformerForObjectDetection:()=>I,TableTransformerModel:()=>C,TableTransformerObjectDetectionOutput:()=>W,TableTransformerPreTrainedModel:()=>T,TokenClassifierOutput:()=>pr,TrOCRForCausalLM:()=>wM,TrOCRPreTrainedModel:()=>gM,UltravoxModel:()=>i0,UltravoxPreTrainedModel:()=>n0,UniSpeechForCTC:()=>Qy,UniSpeechForSequenceClassification:()=>Xy,UniSpeechModel:()=>qy,UniSpeechPreTrainedModel:()=>jl,UniSpeechSatForAudioFrameClassification:()=>eM,UniSpeechSatForCTC:()=>Yy,UniSpeechSatForSequenceClassification:()=>Zy,UniSpeechSatModel:()=>Jy,UniSpeechSatPreTrainedModel:()=>pa,ViTForImageClassification:()=>Ho,ViTMAEModel:()=>hl,ViTMAEPreTrainedModel:()=>pl,ViTMSNForImageClassification:()=>fl,ViTMSNModel:()=>ml,ViTMSNPreTrainedModel:()=>Zo,ViTModel:()=>Ko,ViTPreTrainedModel:()=>bi,VisionEncoderDecoderModel:()=>Qi,VitMatteForImageMatting:()=>bl,VitMattePreTrainedModel:()=>Ml,VitPoseForPoseEstimation:()=>Jo,VitPosePreTrainedModel:()=>Xo,VitsModel:()=>fu,VitsModelOutput:()=>Tb,VitsPreTrainedModel:()=>SM,Wav2Vec2BertForCTC:()=>rM,Wav2Vec2BertForSequenceClassification:()=>sM,Wav2Vec2BertModel:()=>tM,Wav2Vec2BertPreTrainedModel:()=>Vl,Wav2Vec2ForAudioFrameClassification:()=>Uy,Wav2Vec2ForCTC:()=>jy,Wav2Vec2ForSequenceClassification:()=>Vy,Wav2Vec2Model:()=>Ny,Wav2Vec2PreTrainedModel:()=>ln,WavLMForAudioFrameClassification:()=>uM,WavLMForCTC:()=>lM,WavLMForSequenceClassification:()=>dM,WavLMForXVector:()=>cM,WavLMModel:()=>aM,WavLMPreTrainedModel:()=>Ei,WeSpeakerResNetModel:()=>Hy,WeSpeakerResNetPreTrainedModel:()=>Ky,WhisperForConditionalGeneration:()=>Hi,WhisperModel:()=>Wa,WhisperPreTrainedModel:()=>Gn,XLMForQuestionAnswering:()=>Ba,XLMForSequenceClassification:()=>za,XLMForTokenClassification:()=>Wi,XLMModel:()=>rn,XLMPreTrainedModel:()=>ir,XLMRobertaForMaskedLM:()=>Na,XLMRobertaForQuestionAnswering:()=>Gi,XLMRobertaForSequenceClassification:()=>Sn,XLMRobertaForTokenClassification:()=>ja,XLMRobertaModel:()=>Ra,XLMRobertaPreTrainedModel:()=>ys,XLMWithLMHeadModel:()=>sn,XVectorOutput:()=>bb,YolosForObjectDetection:()=>Iy,YolosModel:()=>ky,YolosObjectDetectionOutput:()=>Ay,YolosPreTrainedModel:()=>lu});var s=t("./src/configs.js"),i=t("./src/backends/onnx.js"),n=t("./src/utils/dtypes.js"),o=t("./src/utils/generic.js"),a=t("./src/utils/core.js"),l=t("./src/utils/hub.js"),c=t("./src/utils/constants.js"),p=t("./src/generation/logits_process.js"),u=t("./src/generation/configuration_utils.js"),h=t("./src/utils/tensor.js"),g=t("./src/utils/image.js"),_=t("./src/utils/maths.js"),P=t("./src/generation/stopping_criteria.js"),A=t("./src/generation/logits_sampler.js"),v=t("./src/env.js"),y=t("./src/models/whisper/generation_whisper.js"),k=t("./src/models/whisper/common_whisper.js");const E={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5,ImageTextToText:6,Musicgen:7,MultiModality:8,Phi3V:9,AudioTextToText:10,AutoEncoder:11},M=new Map,w=new Map,x=new Map;async function $(b,S,L){var yr;const oe=((yr=L.config)==null?void 0:yr["transformers.js_config"])??{};let ge=L.device??oe.device;ge&&typeof ge!="string"&&(ge.hasOwnProperty(S)?ge=ge[S]:(console.warn(`device not specified for "${S}". Using the default device.`),ge=null));const fe=ge??(v.apis.IS_NODE_ENV?"cpu":"wasm"),Se=(0,i.deviceToExecutionProviders)(fe);let De=L.dtype??oe.dtype;if(typeof De!="string"&&(De&&De.hasOwnProperty(S)?De=De[S]:(De=n.DEFAULT_DEVICE_DTYPE_MAPPING[fe]??n.DATA_TYPES.fp32,console.warn(`dtype not specified for "${S}". Using the default dtype (${De}) for this device (${fe}).`))),De===n.DATA_TYPES.auto){let Pt=oe.dtype;typeof Pt!="string"&&(Pt=Pt[S]),Pt&&Pt!==n.DATA_TYPES.auto&&n.DATA_TYPES.hasOwnProperty(Pt)?De=Pt:De=n.DEFAULT_DEVICE_DTYPE_MAPPING[fe]??n.DATA_TYPES.fp32}const Ge=De;if(n.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(Ge)){if(Ge===n.DATA_TYPES.fp16&&fe==="webgpu"&&!await(0,n.isWebGpuFp16Supported)())throw new Error(`The device (${fe}) does not support fp16.`)}else throw new Error(`Invalid dtype: ${Ge}. Should be one of: ${Object.keys(n.DATA_TYPES).join(", ")}`);const Je=oe.kv_cache_dtype?typeof oe.kv_cache_dtype=="string"?oe.kv_cache_dtype:oe.kv_cache_dtype[Ge]??"float32":void 0;if(Je&&!["float32","float16"].includes(Je))throw new Error(`Invalid kv_cache_dtype: ${Je}. Should be one of: float32, float16`);const lt={dtype:Ge,kv_cache_dtype:Je},yt=n.DEFAULT_DTYPE_SUFFIX_MAPPING[Ge],st=`${S}${yt}.onnx`,Et=`${L.subfolder??""}/${st}`,at={...L.session_options};at.executionProviders??(at.executionProviders=Se);const vt=oe.free_dimension_overrides;vt?at.freeDimensionOverrides??(at.freeDimensionOverrides=vt):fe.startsWith("webnn")&&!at.freeDimensionOverrides&&console.warn('WebNN does not currently support dynamic shapes and requires `free_dimension_overrides` to be set in config.json as a field within "transformers.js_config". When `free_dimension_overrides` is not set, you may experience significant performance degradation.');const ct=(0,l.getModelFile)(b,Et,!0,L,v.apis.IS_NODE_ENV),xt=L.use_external_data_format??oe.use_external_data_format;let Lt=[];if(xt){let Pt;typeof xt=="object"?xt.hasOwnProperty(st)?Pt=xt[st]:xt.hasOwnProperty(S)?Pt=xt[S]:Pt=!1:Pt=xt;const Nt=+Pt;if(Nt>l.MAX_EXTERNAL_DATA_CHUNKS)throw new Error(`The number of external data chunks (${Nt}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let tr=0;tr{const Cr=await(0,l.getModelFile)(b,Wr,!0,L,v.apis.IS_NODE_ENV);dn(Cr instanceof Uint8Array?{path:sr,data:Cr}:sr)}))}}else at.externalData!==void 0&&(Lt=at.externalData.map(async Pt=>{if(typeof Pt.data=="string"){const Nt=await(0,l.getModelFile)(b,Pt.data,!0,L);return{...Pt,data:Nt}}return Pt}));if(Lt.length>0){const Pt=await Promise.all(Lt);v.apis.IS_NODE_ENV||(at.externalData=Pt)}if(fe==="webgpu"){const Pt=(0,s.getKeyValueShapes)(L.config,{prefix:"present"});if(Object.keys(Pt).length>0&&!(0,i.isONNXProxy)()){const Nt={};for(const tr in Pt)Nt[tr]="gpu-buffer";at.preferredOutputLocation=Nt}}return{buffer_or_path:await ct,session_options:at,session_config:lt}}async function z(b,S,L){return Object.fromEntries(await Promise.all(Object.keys(S).map(async oe=>{const{buffer_or_path:ge,session_options:fe,session_config:Se}=await $(b,S[oe],L),De=await(0,i.createInferenceSession)(ge,fe,Se);return[oe,De]})))}async function R(b,S,L){return Object.fromEntries(await Promise.all(Object.keys(S).map(async oe=>{const ge=await(0,l.getModelJSON)(b,S[oe],!1,L);return[oe,ge]})))}function Q(b,S){const L=Object.create(null),oe=[];for(const Se of b.inputNames){const De=S[Se];if(!(De instanceof h.Tensor)){oe.push(Se);continue}L[Se]=(0,i.isONNXProxy)()?De.clone():De}if(oe.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${oe.join(", ")}.`);const ge=Object.keys(S).length,fe=b.inputNames.length;if(ge>fe){let Se=Object.keys(S).filter(De=>!b.inputNames.includes(De));console.warn(`WARNING: Too many inputs were provided (${ge} > ${fe}). The following inputs will be ignored: "${Se.join(", ")}".`)}return L}async function q(b,S){const L=Q(b,S);try{const oe=Object.fromEntries(Object.entries(L).map(([fe,Se])=>[fe,Se.ort_tensor]));let ge=await b.run(oe);return ge=U(ge),ge}catch(oe){const ge=Object.fromEntries(Object.entries(L).map(([fe,{type:Se,dims:De,data:Ge}])=>[fe,{type:Se,dims:De,data:Ge}]));throw console.error(`An error occurred during model execution: "${oe}".`),console.error("Inputs given to model:",ge),oe}}function U(b){for(let S in b)(0,i.isONNXTensor)(b[S])?b[S]=new h.Tensor(b[S]):typeof b[S]=="object"&&U(b[S]);return b}function Z(b){if(b instanceof h.Tensor)return b;if(b.length===0)throw Error("items must be non-empty");if(Array.isArray(b[0])){if(b.some(S=>S.length!==b[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new h.Tensor("int64",BigInt64Array.from(b.flat().map(S=>BigInt(S))),[b.length,b[0].length])}else return new h.Tensor("int64",BigInt64Array.from(b.map(S=>BigInt(S))),[1,b.length])}function H(b){return new h.Tensor("bool",[b],[1])}async function J(b,S){let{encoder_outputs:L,input_ids:oe,decoder_input_ids:ge,...fe}=S;if(!L){const De=(0,a.pick)(S,b.sessions.model.inputNames);L=(await ie(b,De)).last_hidden_state}return fe.input_ids=ge,fe.encoder_hidden_states=L,b.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(fe.encoder_attention_mask=S.attention_mask),await ce(b,fe,!0)}async function ie(b,S){const L=b.sessions.model,oe=(0,a.pick)(S,L.inputNames);if(L.inputNames.includes("inputs_embeds")&&!oe.inputs_embeds){if(!S.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");oe.inputs_embeds=await b.encode_text({input_ids:S.input_ids})}if(L.inputNames.includes("token_type_ids")&&!oe.token_type_ids){if(!oe.input_ids)throw new Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");oe.token_type_ids=(0,h.zeros_like)(oe.input_ids)}if(L.inputNames.includes("pixel_mask")&&!oe.pixel_mask){if(!oe.pixel_values)throw new Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");const ge=oe.pixel_values.dims;oe.pixel_mask=(0,h.ones)([ge[0],ge[2],ge[3]])}return await q(L,oe)}async function ae(b,S){const L=await b.encode(S);return await b.decode(L)}async function ce(b,S,L=!1){const oe=b.sessions[L?"decoder_model_merged":"model"],{past_key_values:ge,...fe}=S;if(oe.inputNames.includes("use_cache_branch")&&(fe.use_cache_branch=H(!!ge)),oe.inputNames.includes("position_ids")&&fe.attention_mask&&!fe.position_ids){const De=["paligemma","gemma3_text","gemma3"].includes(b.config.model_type)?1:0;fe.position_ids=_e(fe,ge,De)}b.addPastKeyValues(fe,ge);const Se=(0,a.pick)(fe,oe.inputNames);return await q(oe,Se)}function he({modality_token_id:b,inputs_embeds:S,modality_features:L,input_ids:oe,attention_mask:ge}){const fe=oe.tolist().map(Je=>Je.reduce((lt,yt,st)=>(yt==b&<.push(st),lt),[])),Se=fe.reduce((Je,lt)=>Je+lt.length,0),De=L.dims[0];if(Se!==De)throw new Error(`Number of tokens and features do not match: tokens: ${Se}, features ${De}`);let Ge=0;for(let Je=0;Jefe.dims[1])){if(geDe==b.config.image_token_index)){const De=b.config.num_image_tokens;if(!De)throw new Error("`num_image_tokens` is missing in the model configuration.");const Ge=fe.dims[1]-(ge-De);L.input_ids=fe.slice(null,[-Ge,null]),L.attention_mask=(0,h.ones)([1,ge+Ge])}}}return L}function He(b,S,L,oe){return L.past_key_values&&(S=S.map(ge=>[ge.at(-1)])),{...L,decoder_input_ids:Z(S)}}function Me(b,...S){return b.config.is_encoder_decoder?He(b,...S):ke(b,...S)}function K(b,S,L,oe){const ge=!!L.past_key_values;return oe.guidance_scale!==null&&oe.guidance_scale>1&&(ge?L.input_ids=(0,h.cat)([L.input_ids,L.input_ids],0):(L.input_ids=(0,h.cat)([L.input_ids,(0,h.full_like)(L.input_ids,BigInt(oe.pad_token_id))],0),L.attention_mask=(0,h.cat)([L.attention_mask,(0,h.full_like)(L.attention_mask,0n)],0))),(ge||!L.pixel_values)&&(L.pixel_values=(0,h.full)([0,0,3,384,384],1)),ge&&(L.images_seq_mask=new h.Tensor("bool",new Array(1).fill(!0).fill(!1,0,1),[1,1]),L.images_emb_mask=new h.Tensor("bool",new Array(0).fill(!1),[1,1,0])),L}class j extends o.Callable{constructor(L,oe,ge){super();re(this,"main_input_name","input_ids");re(this,"forward_params",["input_ids","attention_mask"]);this.config=L,this.sessions=oe,this.configs=ge;const fe=x.get(this.constructor),Se=M.get(fe);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,Se){case E.DecoderOnly:this.can_generate=!0,this._forward=ce,this._prepare_inputs_for_generation=ke;break;case E.Seq2Seq:case E.Vision2Seq:case E.Musicgen:this.can_generate=!0,this._forward=J,this._prepare_inputs_for_generation=He;break;case E.EncoderDecoder:this._forward=J;break;case E.ImageTextToText:this.can_generate=!0,this._forward=X,this._prepare_inputs_for_generation=Me;break;case E.AudioTextToText:this.can_generate=!0,this._forward=se,this._prepare_inputs_for_generation=Me;break;case E.Phi3V:this.can_generate=!0,this._prepare_inputs_for_generation=Me;break;case E.MultiModality:this.can_generate=!0,this._prepare_inputs_for_generation=K;break;case E.AutoEncoder:this._forward=ae;break;default:this._forward=ie;break}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){var oe;const L=[];for(const ge of Object.values(this.sessions))(oe=ge==null?void 0:ge.handler)!=null&&oe.dispose&&L.push(ge.handler.dispose());return await Promise.all(L)}static async from_pretrained(L,{progress_callback:oe=null,config:ge=null,cache_dir:fe=null,local_files_only:Se=!1,revision:De="main",model_file_name:Ge=null,subfolder:Je="onnx",device:lt=null,dtype:yt=null,use_external_data_format:st=null,session_options:Et={}}={}){let at={progress_callback:oe,config:ge,cache_dir:fe,local_files_only:Se,revision:De,model_file_name:Ge,subfolder:Je,device:lt,dtype:yt,use_external_data_format:st,session_options:Et};const vt=x.get(this),ct=M.get(vt);ge=at.config=await s.AutoConfig.from_pretrained(L,at);let xt;if(ct===E.DecoderOnly)xt=await Promise.all([z(L,{model:at.model_file_name??"model"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===E.Seq2Seq||ct===E.Vision2Seq)xt=await Promise.all([z(L,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===E.MaskGeneration)xt=await Promise.all([z(L,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},at)]);else if(ct===E.EncoderDecoder)xt=await Promise.all([z(L,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},at)]);else if(ct===E.ImageTextToText){const Lt={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};ge.is_encoder_decoder&&(Lt.model="encoder_model"),xt=await Promise.all([z(L,Lt,at),R(L,{generation_config:"generation_config.json"},at)])}else if(ct===E.AudioTextToText){const Lt={embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"};xt=await Promise.all([z(L,Lt,at),R(L,{generation_config:"generation_config.json"},at)])}else if(ct===E.Musicgen)xt=await Promise.all([z(L,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===E.MultiModality)xt=await Promise.all([z(L,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===E.Phi3V)xt=await Promise.all([z(L,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},at),R(L,{generation_config:"generation_config.json"},at)]);else if(ct===E.AutoEncoder)xt=await Promise.all([z(L,{encoder_model:"encoder_model",decoder_model:"decoder_model"},at)]);else{if(ct!==E.EncoderOnly){const Lt=vt??(ge==null?void 0:ge.model_type);Lt!=="custom"&&console.warn(`Model type for '${Lt}' not found, assuming encoder-only architecture. Please report this at ${c.GITHUB_ISSUE_URL}.`)}xt=await Promise.all([z(L,{model:at.model_file_name??"model"},at)])}return new this(ge,...xt)}async _call(L){return await this.forward(L)}async forward(L){return await this._forward(this,L)}get generation_config(){var L;return((L=this.configs)==null?void 0:L.generation_config)??null}_get_logits_warper(L){const oe=new p.LogitsProcessorList;return L.temperature!==null&&L.temperature!==1&&oe.push(new p.TemperatureLogitsWarper(L.temperature)),L.top_k!==null&&L.top_k!==0&&oe.push(new p.TopKLogitsWarper(L.top_k)),L.top_p!==null&&L.top_p<1&&oe.push(new p.TopPLogitsWarper(L.top_p)),oe}_get_logits_processor(L,oe,ge=null){const fe=new p.LogitsProcessorList;if(L.repetition_penalty!==null&&L.repetition_penalty!==1&&fe.push(new p.RepetitionPenaltyLogitsProcessor(L.repetition_penalty)),L.no_repeat_ngram_size!==null&&L.no_repeat_ngram_size>0&&fe.push(new p.NoRepeatNGramLogitsProcessor(L.no_repeat_ngram_size)),L.bad_words_ids!==null&&fe.push(new p.NoBadWordsLogitsProcessor(L.bad_words_ids,L.eos_token_id)),L.min_length!==null&&L.eos_token_id!==null&&L.min_length>0&&fe.push(new p.MinLengthLogitsProcessor(L.min_length,L.eos_token_id)),L.min_new_tokens!==null&&L.eos_token_id!==null&&L.min_new_tokens>0&&fe.push(new p.MinNewTokensLengthLogitsProcessor(oe,L.min_new_tokens,L.eos_token_id)),L.forced_bos_token_id!==null&&fe.push(new p.ForcedBOSTokenLogitsProcessor(L.forced_bos_token_id)),L.forced_eos_token_id!==null&&fe.push(new p.ForcedEOSTokenLogitsProcessor(L.max_length,L.forced_eos_token_id)),L.begin_suppress_tokens!==null){const Se=oe>1||L.forced_bos_token_id===null?oe:oe+1;fe.push(new p.SuppressTokensAtBeginLogitsProcessor(L.begin_suppress_tokens,Se))}return L.guidance_scale!==null&&L.guidance_scale>1&&fe.push(new p.ClassifierFreeGuidanceLogitsProcessor(L.guidance_scale)),ge!==null&&fe.extend(ge),fe}_prepare_generation_config(L,oe,ge=u.GenerationConfig){const fe={...this.config};for(const De of["decoder","generator","text_config"])De in fe&&Object.assign(fe,fe[De]);const Se=new ge(fe);return Object.assign(Se,this.generation_config??{}),L&&Object.assign(Se,L),oe&&Object.assign(Se,(0,a.pick)(oe,Object.getOwnPropertyNames(Se))),Se}_get_stopping_criteria(L,oe=null){const ge=new P.StoppingCriteriaList;return L.max_length!==null&&ge.push(new P.MaxLengthCriteria(L.max_length,this.config.max_position_embeddings??null)),L.eos_token_id!==null&&ge.push(new P.EosTokenCriteria(L.eos_token_id)),oe&&ge.extend(oe),ge}_validate_model_class(){if(!this.can_generate){const L=[xu,Eu,Tu,vu],oe=x.get(this.constructor),ge=new Set,fe=this.config.model_type;for(const De of L){const Ge=De.get(fe);Ge&&ge.add(Ge[0])}let Se=`The current model class (${oe}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw ge.size>0&&(Se+=` Please use the following class instead: ${[...ge].join(", ")}`),Error(Se)}}prepare_inputs_for_generation(...L){return this._prepare_inputs_for_generation(this,...L)}_update_model_kwargs_for_generation({generated_input_ids:L,outputs:oe,model_inputs:ge,is_encoder_decoder:fe}){return ge.past_key_values=this.getPastKeyValues(oe,ge.past_key_values),ge.input_ids=new h.Tensor("int64",L.flat(),[L.length,1]),fe||(ge.attention_mask=(0,h.cat)([ge.attention_mask,(0,h.ones)([ge.attention_mask.dims[0],1])],1)),ge.position_ids=null,ge}_prepare_model_inputs({inputs:L,bos_token_id:oe,model_kwargs:ge}){const fe=(0,a.pick)(ge,this.forward_params),Se=this.main_input_name;if(Se in fe){if(L)throw new Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else fe[Se]=L;return{inputs_tensor:fe[Se],model_inputs:fe,model_input_name:Se}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:L,model_inputs:oe,model_input_name:ge,generation_config:fe}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!oe.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:De,pixel_values:Ge,attention_mask:Je,...lt}=oe,yt=await this._prepare_inputs_embeds(oe);oe={...lt,...(0,a.pick)(yt,["inputs_embeds","attention_mask"])}}let{last_hidden_state:Se}=await ie(this,oe);if(fe.guidance_scale!==null&&fe.guidance_scale>1)Se=(0,h.cat)([Se,(0,h.full_like)(Se,0)],0),"attention_mask"in oe&&(oe.attention_mask=(0,h.cat)([oe.attention_mask,(0,h.zeros_like)(oe.attention_mask)],0));else if(oe.decoder_input_ids){const De=Z(oe.decoder_input_ids).dims[0];if(De!==Se.dims[0]){if(Se.dims[0]!==1)throw new Error(`The encoder outputs have a different batch size (${Se.dims[0]}) than the decoder inputs (${De}).`);Se=(0,h.cat)(Array.from({length:De},()=>Se),0)}}return oe.encoder_outputs=Se,oe}_prepare_decoder_input_ids_for_generation({batch_size:L,model_input_name:oe,model_kwargs:ge,decoder_start_token_id:fe,bos_token_id:Se,generation_config:De}){let{decoder_input_ids:Ge,...Je}=ge;if(!(Ge instanceof h.Tensor)){if(Ge)Array.isArray(Ge[0])||(Ge=Array.from({length:L},()=>Ge));else if(fe??(fe=Se),this.config.model_type==="musicgen")Ge=Array.from({length:L*this.config.decoder.num_codebooks},()=>[fe]);else if(Array.isArray(fe)){if(fe.length!==L)throw new Error(`\`decoder_start_token_id\` expcted to have length ${L} but got ${fe.length}`);Ge=fe}else Ge=Array.from({length:L},()=>[fe]);Ge=Z(Ge)}return ge.decoder_attention_mask=(0,h.ones_like)(Ge),{input_ids:Ge,model_inputs:Je}}async generate({inputs:L=null,generation_config:oe=null,logits_processor:ge=null,stopping_criteria:fe=null,streamer:Se=null,...De}){this._validate_model_class(),oe=this._prepare_generation_config(oe,De);let{inputs_tensor:Ge,model_inputs:Je,model_input_name:lt}=this._prepare_model_inputs({inputs:L,model_kwargs:De});const yt=this.config.is_encoder_decoder;yt&&("encoder_outputs"in Je||(Je=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:Ge,model_inputs:Je,model_input_name:lt,generation_config:oe})));let st;yt?{input_ids:st,model_inputs:Je}=this._prepare_decoder_input_ids_for_generation({batch_size:Je[lt].dims.at(0),model_input_name:lt,model_kwargs:Je,decoder_start_token_id:oe.decoder_start_token_id,bos_token_id:oe.bos_token_id,generation_config:oe}):st=Je[lt];let Et=st.dims.at(-1);oe.max_new_tokens!==null&&(oe.max_length=Et+oe.max_new_tokens);const at=this._get_logits_processor(oe,Et,ge),vt=this._get_stopping_criteria(oe,fe),ct=Je[lt].dims.at(0),xt=A.LogitsSampler.getSampler(oe),Lt=new Array(ct).fill(0),Qt=st.tolist();Se&&Se.put(Qt);let yr,Pt={};for(;;){if(Je=this.prepare_inputs_for_generation(Qt,Je,oe),yr=await this.forward(Je),oe.output_attentions&&oe.return_dict_in_generate){const Cr=this.getAttentions(yr);for(const ks in Cr)ks in Pt||(Pt[ks]=[]),Pt[ks].push(Cr[ks])}const sr=yr.logits.slice(null,-1,null),Wr=at(Qt,sr),dn=[];for(let Cr=0;CrCr))break;Je=this._update_model_kwargs_for_generation({generated_input_ids:dn,outputs:yr,model_inputs:Je,is_encoder_decoder:yt})}Se&&Se.end();const Nt=this.getPastKeyValues(yr,Je.past_key_values,!0),tr=new h.Tensor("int64",Qt.flat(),[Qt.length,Qt[0].length]);if(oe.return_dict_in_generate)return{sequences:tr,past_key_values:Nt,...Pt};for(const sr of Object.values(yr))sr.location==="gpu-buffer"&&sr.dispose();return tr}getPastKeyValues(L,oe,ge=!1){const fe=Object.create(null);for(const Se in L)if(Se.startsWith("present")){const De=Se.replace("present","past_key_values"),Ge=Se.includes("encoder");if(Ge&&oe?fe[De]=oe[De]:fe[De]=L[Se],oe&&(!Ge||ge)){const Je=oe[De];Je.location==="gpu-buffer"&&Je.dispose()}}return fe}getAttentions(L){const oe={};for(const ge of["cross_attentions","encoder_attentions","decoder_attentions"])for(const fe in L)fe.startsWith(ge)&&(ge in oe||(oe[ge]=[]),oe[ge].push(L[fe]));return oe}addPastKeyValues(L,oe){var ge,fe,Se;if(oe)Object.assign(L,oe);else{const De=this.sessions.decoder_model_merged??this.sessions.model,Ge=((ge=De==null?void 0:De.config)==null?void 0:ge.kv_cache_dtype)??"float32",Je=Ge==="float16"?new h.DataTypeMap.float16:[],lt=((Se=(fe=L[this.main_input_name]??L.attention_mask)==null?void 0:fe.dims)==null?void 0:Se[0])??1,yt=(0,s.getKeyValueShapes)(this.config,{batch_size:lt});for(const st in yt)L[st]=new h.Tensor(Ge,Je,yt[st])}}async encode_image({pixel_values:L}){const oe=(await q(this.sessions.vision_encoder,{pixel_values:L})).image_features;return this.config.num_image_tokens||(console.warn(`The number of image tokens was not set in the model configuration. Setting it to the number of features detected by the vision encoder (${oe.dims[1]}).`),this.config.num_image_tokens=oe.dims[1]),oe}async encode_text({input_ids:L}){return(await q(this.sessions.embed_tokens,{input_ids:L})).inputs_embeds}async encode_audio({audio_values:L}){return(await q(this.sessions.audio_encoder,{audio_values:L})).audio_features}}class me{}class Pe extends me{constructor({last_hidden_state:S,hidden_states:L=null,attentions:oe=null}){super(),this.last_hidden_state=S,this.hidden_states=L,this.attentions=oe}}class xe extends j{}class Ae extends xe{}class Ie extends xe{async _call(S){return new wr(await super._call(S))}}class Le extends xe{async _call(S){return new bt(await super._call(S))}}class Ne extends xe{async _call(S){return new pr(await super._call(S))}}class We extends xe{async _call(S){return new Pr(await super._call(S))}}class D extends j{}class ee extends D{}class B extends D{async _call(S){return new wr(await super._call(S))}}class te extends D{async _call(S){return new bt(await super._call(S))}}class de extends D{async _call(S){return new pr(await super._call(S))}}class be extends j{}class ve extends be{}class Re extends j{}class Fe extends Re{}class je extends Re{async _call(S){return new wr(await super._call(S))}}class qe extends Re{async _call(S){return new bt(await super._call(S))}}class Xe extends Re{async _call(S){return new pr(await super._call(S))}}class ut extends Re{async _call(S){return new Pr(await super._call(S))}}class wt extends j{}class nr extends wt{}class jt extends wt{async _call(S){return new wr(await super._call(S))}}class dr extends wt{async _call(S){return new bt(await super._call(S))}}class ds extends wt{async _call(S){return new pr(await super._call(S))}}class Os extends wt{async _call(S){return new Pr(await super._call(S))}}class Dr extends j{}class cs extends Dr{}class Ds extends Dr{async _call(S){return new wr(await super._call(S))}}class jr extends Dr{async _call(S){return new bt(await super._call(S))}}class dt extends Dr{async _call(S){return new pr(await super._call(S))}}class qr extends Dr{async _call(S){return new Pr(await super._call(S))}}class Vr extends j{}class us extends Vr{}class Ts extends Vr{async _call(S){return new wr(await super._call(S))}}class xs extends Vr{async _call(S){return new bt(await super._call(S))}}class Es extends Vr{async _call(S){return new pr(await super._call(S))}}class Ls extends Vr{async _call(S){return new Pr(await super._call(S))}}class mr extends j{}class Be extends mr{}class et extends mr{async _call(S){return new wr(await super._call(S))}}class it extends mr{async _call(S){return new bt(await super._call(S))}}class rr extends mr{async _call(S){return new pr(await super._call(S))}}class zt extends mr{async _call(S){return new Pr(await super._call(S))}}class kr extends j{}class ps extends kr{}class hs extends kr{async _call(S){return new wr(await super._call(S))}}class Er extends kr{async _call(S){return new bt(await super._call(S))}}class ms extends kr{async _call(S){return new pr(await super._call(S))}}class fs extends kr{async _call(S){return new Pr(await super._call(S))}}class Qr extends j{}class Ps extends Qr{}class Qs extends Qr{async _call(S){return new bt(await super._call(S))}}class Xs extends Qr{async _call(S){return new pr(await super._call(S))}}class Js extends Qr{async _call(S){return new Pr(await super._call(S))}}class Ys extends Qr{async _call(S){return new wr(await super._call(S))}}class _s extends j{}class Zs extends _s{}class en extends _s{async _call(S){return new wr(await super._call(S))}}class tn extends _s{async _call(S){return new bt(await super._call(S))}}class Lr extends _s{async _call(S){return new pr(await super._call(S))}}class Cs extends j{}class br extends Cs{}class zs extends Cs{async _call(S){return new wr(await super._call(S))}}class Bs extends Cs{async _call(S){return new bt(await super._call(S))}}class Ir extends Cs{async _call(S){return new Pr(await super._call(S))}}class Xr extends j{}class xn extends Xr{}class zr extends Xr{async _call(S){return new wr(await super._call(S))}}class En extends Xr{async _call(S){return new bt(await super._call(S))}}class Rs extends Xr{async _call(S){return new pr(await super._call(S))}}class Ar extends Xr{async _call(S){return new Pr(await super._call(S))}}class Jr extends j{}class cr extends Jr{}class fr extends Jr{async _call(S){return new wr(await super._call(S))}}class Ns extends Jr{async _call(S){return new bt(await super._call(S))}}class Pn extends Jr{async _call(S){return new Pr(await super._call(S))}}class Ss extends j{}class Cn extends Ss{}class pe extends Ss{async _call(S){return new bt(await super._call(S))}}class F extends Ss{async _call(S){return new Pr(await super._call(S))}}class V extends Ss{async _call(S){return new wr(await super._call(S))}}class Y extends j{constructor(){super(...arguments);re(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}}class le extends Y{}class ue extends Y{}class Ce extends j{}class Ue extends Ce{}class Qe extends Ce{}class Ke extends j{}class Ze extends Ke{}class ht extends Ke{}class Ct extends j{}class kt extends Ct{}class Wt extends Ct{}class Ot extends Ct{async _call(S){return new bt(await super._call(S))}}class Vt extends j{}class vr extends Vt{}class _r extends Vt{}class Yr extends Vt{async _call(S){return new bt(await super._call(S))}}class Tr extends Vt{}class gs extends j{}class Gt extends gs{}class Zt extends gs{}class gr extends j{}class Zr extends gr{}class ws extends gr{}class Ht extends j{}class ur extends Ht{}class Rt extends Ht{async _call(S){return new wr(await super._call(S))}}class Jt extends Ht{async _call(S){return new bt(await super._call(S))}}class qt extends Ht{async _call(S){return new pr(await super._call(S))}}class er extends Ht{async _call(S){return new Pr(await super._call(S))}}class ir extends j{}class rn extends ir{}class sn extends ir{async _call(S){return new wr(await super._call(S))}}class za extends ir{async _call(S){return new bt(await super._call(S))}}class Wi extends ir{async _call(S){return new pr(await super._call(S))}}class Ba extends ir{async _call(S){return new Pr(await super._call(S))}}class ys extends j{}class Ra extends ys{}class Na extends ys{async _call(S){return new wr(await super._call(S))}}class Sn extends ys{async _call(S){return new bt(await super._call(S))}}class ja extends ys{async _call(S){return new pr(await super._call(S))}}class Gi extends ys{async _call(S){return new Pr(await super._call(S))}}class Ki extends j{}class Va extends Ki{}class Ua extends Ki{}class Gn extends j{constructor(){super(...arguments);re(this,"requires_attention_mask",!1);re(this,"main_input_name","input_features");re(this,"forward_params",["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"])}}class Wa extends Gn{}class Hi extends Gn{_prepare_generation_config(S,L){return super._prepare_generation_config(S,L,y.WhisperGenerationConfig)}_retrieve_init_tokens(S){const L=[S.decoder_start_token_id];let oe=S.language;const ge=S.task;if(S.is_multilingual){oe||(console.warn("No language specified - defaulting to English (en)."),oe="en");const Se=`<|${(0,k.whisper_language_to_code)(oe)}|>`;L.push(S.lang_to_id[Se]),L.push(S.task_to_id[ge??"transcribe"])}else if(oe||ge)throw new Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!S.return_timestamps&&S.no_timestamps_token_id&&L.at(-1)!==S.no_timestamps_token_id?L.push(S.no_timestamps_token_id):S.return_timestamps&&L.at(-1)===S.no_timestamps_token_id&&(console.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),L.pop()),L.filter(fe=>fe!=null)}async generate({inputs:S=null,generation_config:L=null,logits_processor:oe=null,stopping_criteria:ge=null,...fe}){L=this._prepare_generation_config(L,fe);const Se=fe.decoder_input_ids??this._retrieve_init_tokens(L);if(L.return_timestamps&&(oe??(oe=new p.LogitsProcessorList),oe.push(new p.WhisperTimeStampLogitsProcessor(L,Se))),L.begin_suppress_tokens&&(oe??(oe=new p.LogitsProcessorList),oe.push(new p.SuppressTokensAtBeginLogitsProcessor(L.begin_suppress_tokens,Se.length))),L.return_token_timestamps){if(!L.alignment_heads)throw new Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");L.task==="translate"&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),L.output_attentions=!0,L.return_dict_in_generate=!0}const De=await super.generate({inputs:S,generation_config:L,logits_processor:oe,decoder_input_ids:Se,...fe});return L.return_token_timestamps&&(De.token_timestamps=this._extract_token_timestamps(De,L.alignment_heads,L.num_frames)),De}_extract_token_timestamps(S,L,oe=null,ge=.02){if(!S.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");oe==null&&console.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let fe=this.config.median_filter_width;fe===void 0&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),fe=7);const Se=S.cross_attentions,De=Array.from({length:this.config.decoder_layers},(vt,ct)=>(0,h.cat)(Se.map(xt=>xt[ct]),2)),Ge=(0,h.stack)(L.map(([vt,ct])=>{if(vt>=De.length)throw new Error(`Layer index ${vt} is out of bounds for cross attentions (length ${De.length}).`);return oe?De[vt].slice(null,ct,null,[0,oe]):De[vt].slice(null,ct)})).transpose(1,0,2,3),[Je,lt]=(0,h.std_mean)(Ge,-2,0,!0),yt=Ge.clone();for(let vt=0;vtxt[tr+1]-xt[tr]),yr=(0,a.mergeArrays)([1],Qt).map(Nt=>!!Nt),Pt=[];for(let Nt=0;Ntst.findIndex(Et=>Et==fe)),Ge=De.every(st=>st===-1),Je=De.every(st=>st!==-1);if(!Ge&&!Je)throw new Error("Every input should contain either 0 or 1 image token.");if(Ge)return{inputs_embeds:S,attention_mask:ge};const lt=[],yt=[];for(let st=0;stArray.from({length:S.dims[0]},Qt=>Array.from({length:S.dims[1]},yr=>1))),at=L?L.tolist():[],vt=oe?oe.tolist():[];let ct=0,xt=0;for(let Lt=0;Ltst[Lt][or]==1),Pt=Qt.reduce((Kt,or,cn)=>(or==Ge&&Kt.push(cn),Kt),[]).map(Kt=>Qt[Kt+1]),Nt=Pt.filter(Kt=>Kt==Se).length,tr=Pt.filter(Kt=>Kt==De).length;let sr=[],Wr=0,dn=Nt,Zl=tr;for(let Kt=0;KtMs>Wr&&Dn==Se),cn=Qt.findIndex((Dn,Ms)=>Ms>Wr&&Dn==De),On=dn>0&&or!==-1?or:Qt.length+1,Ci=Zl>0&&cn!==-1?cn:Qt.length+1;let sd,Su,$u,ku;On0?(0,_.max)(sr.at(-1))[0]+1:0;sr.push(Array.from({length:3*Au},(Dn,Ms)=>xb+Ms%Au));const Fu=Au+xb,id=LT*Iu*nd,zT=Array.from({length:id},(Dn,Ms)=>Fu+Math.floor(Ms/(Iu*nd))),BT=Array.from({length:id},(Dn,Ms)=>Fu+Math.floor(Ms/nd)%Iu),RT=Array.from({length:id},(Dn,Ms)=>Fu+Ms%nd);sr.push([zT,BT,RT].flat()),Wr=sd+id}if(Wr0?(0,_.max)(sr.at(-1))[0]+1:0,or=Qt.length-Wr;sr.push(Array.from({length:3*or},(cn,On)=>Kt+On%or))}const Cr=sr.reduce((Kt,or)=>Kt+or.length,0),ks=new Array(Cr);let Cu=0;for(let Kt=0;Kt<3;++Kt)for(let or=0;oryt[ct%yt.length]),at=Array.from({length:st[0]},(vt,ct)=>(0,_.max)(yt.subarray(st[1]*ct,st[1]*(ct+1)))[0]+1n+BigInt(st[1]));return[new h.Tensor("int64",Et,[3,...st]),new h.Tensor("int64",at,[at.length,1])]}else{const[yt,st]=S.dims,Et=BigInt64Array.from({length:3*yt*st},(at,vt)=>BigInt(Math.floor(vt%st/yt)));return[new h.Tensor("int64",Et,[3,...S.dims]),(0,h.zeros)([yt,1])]}}async encode_image({pixel_values:S,image_grid_thw:L}){return(await q(this.sessions.vision_encoder,{pixel_values:S,grid_thw:L})).image_features}_merge_input_ids_with_image_features(S){return N({image_token_id:this.config.image_token_id,...S})}prepare_inputs_for_generation(S,L,oe){if(L.attention_mask&&!L.position_ids)if(!L.past_key_values)[L.position_ids,L.rope_deltas]=this.get_rope_index(L.input_ids,L.image_grid_thw,L.video_grid_thw,L.attention_mask);else{L.pixel_values=null;const ge=BigInt(Object.values(L.past_key_values)[0].dims.at(-2)),fe=L.rope_deltas.map(Se=>ge+Se);L.position_ids=(0,h.stack)([fe,fe,fe],0)}return L}}class _i extends j{}class Lo extends _i{}class zo extends _i{}class gi extends j{}class Bo extends gi{}class Ro extends gi{}class wi extends j{}class No extends wi{}class jo extends wi{}class yi extends j{}class Vo extends yi{}class Uo extends yi{}class Mi extends j{}class Wo extends Mi{}class Go extends Mi{}class bi extends j{}class Ko extends bi{}class Ho extends bi{async _call(S){return new bt(await super._call(S))}}class vi extends j{}class qo extends vi{}class Qo extends vi{async _call(S){return new bt(await super._call(S))}}class Xo extends j{}class Jo extends Xo{}class Yo extends j{}class cl extends Yo{}class ul extends Yo{async _call(S){return new bt(await super._call(S))}}class pl extends j{}class hl extends pl{}class Zo extends j{}class ml extends Zo{}class fl extends Zo{async _call(S){return new bt(await super._call(S))}}class _l extends j{}class gl extends _l{}class ea extends j{}class wl extends ea{}class yl extends ea{async _call(S){return new bt(await super._call(S))}}class Ml extends j{}class bl extends Ml{async _call(S){return new vb(await super._call(S))}}class ta extends j{}class vl extends ta{}class Tl extends ta{async _call(S){return new bt(await super._call(S))}}class ra extends j{}class xl extends ra{}class El extends ra{async _call(S){return new bt(await super._call(S))}}class sa extends j{}class Pl extends sa{}class Cl extends sa{}class na extends j{}class Sl extends na{}class $l extends na{}class ia extends j{}class kl extends ia{}class Il extends ia{async _call(S){return new bt(await super._call(S))}}class Ti extends j{}class Al extends Ti{}class Fl extends Ti{async _call(S){return new aa(await super._call(S))}}class oa extends Ti{async _call(S){return new Ol(await super._call(S))}}class aa extends me{constructor({logits:S,pred_boxes:L}){super(),this.logits=S,this.pred_boxes=L}}class Ol extends me{constructor({logits:S,pred_boxes:L,pred_masks:oe}){super(),this.logits=S,this.pred_boxes=L,this.pred_masks=oe}}class la extends j{}class Dl extends la{}class Ll extends la{async _call(S){return new xi(await super._call(S))}}class xi extends me{constructor({logits:S,pred_boxes:L}){super(),this.logits=S,this.pred_boxes=L}}class da extends j{}class zl extends da{}class Bl extends da{async _call(S){return new Rl(await super._call(S))}}class Rl extends xi{}class ca extends j{}class ua extends ca{}class d extends ca{async _call(S){return new m(await super._call(S))}}class m extends xi{}class T extends j{}class C extends T{}class I extends T{async _call(S){return new W(await super._call(S))}}class W extends aa{}class ne extends j{}class ye extends ne{}class Ee extends ne{async _call(S){return new bt(await super._call(S))}}class ze extends j{}class Ye extends ze{}class ot extends ze{async _call(S){return new bt(await super._call(S))}}class _t extends j{}class Bt extends _t{}class Fr extends _t{async _call(S){return new bt(await super._call(S))}}class $s extends j{}class Xw extends $s{}class Jw extends $s{async _call(S){return new bt(await super._call(S))}}class Yw extends $s{}class eu extends j{}class Zw extends eu{}class ey extends eu{}class tu extends j{}class ty extends tu{}class ry extends tu{}class sy extends j{}class ny extends sy{}class Nl extends j{}class iy extends Nl{}class oy extends Nl{}class ay extends Nl{}class ly extends j{}class dy extends ly{}class cy extends j{}class uy extends cy{}class py extends j{}class hy extends py{}class ru extends j{}class my extends ru{}class fy extends ru{}class su extends j{}class _y extends su{}class gy extends su{}class wy extends j{}class yy extends wy{}class nu extends j{}class My extends nu{}class by extends nu{async _call(S){return new bt(await super._call(S))}}class iu extends j{}class vy extends iu{}class Ty extends iu{async _call(S){return new bt(await super._call(S))}}class ou extends j{}class xy extends ou{}class Ey extends ou{async _call(S){return new bt(await super._call(S))}}class au extends j{}class Py extends au{}class Cy extends au{async _call(S){return new bt(await super._call(S))}}class Sy extends j{}class $y extends Sy{}class lu extends j{}class ky extends lu{}class Iy extends lu{async _call(S){return new Ay(await super._call(S))}}class Ay extends me{constructor({logits:S,pred_boxes:L}){super(),this.logits=S,this.pred_boxes=L}}class Fy extends j{}class Oy extends Fy{async get_image_embeddings({pixel_values:S}){return await ie(this,{pixel_values:S})}async forward(S){if((!S.image_embeddings||!S.image_positional_embeddings)&&(S={...S,...await this.get_image_embeddings(S)}),!S.input_labels&&S.input_points){const oe=S.input_points.dims.slice(0,-1),ge=oe.reduce((fe,Se)=>fe*Se,1);S.input_labels=new h.Tensor("int64",new BigInt64Array(ge).fill(1n),oe)}const L={image_embeddings:S.image_embeddings,image_positional_embeddings:S.image_positional_embeddings};return S.input_points&&(L.input_points=S.input_points),S.input_labels&&(L.input_labels=S.input_labels),S.input_boxes&&(L.input_boxes=S.input_boxes),await q(this.sessions.prompt_encoder_mask_decoder,L)}async _call(S){return new Dy(await super._call(S))}}class Dy extends me{constructor({iou_scores:S,pred_masks:L}){super(),this.iou_scores=S,this.pred_masks=L}}class du extends j{}class Ly extends du{}class zy extends du{}class cu extends j{}class By extends cu{}class Ry extends cu{}class ln extends j{}class Ny extends ln{}class jy extends ln{async _call(S){return new Fn(await super._call(S))}}class Vy extends ln{async _call(S){return new bt(await super._call(S))}}class Uy extends ln{async _call(S){return new pr(await super._call(S))}}class uu extends j{}class Wy extends uu{}class Gy extends uu{async _call(S){return new pr(await super._call(S))}}class Ky extends j{}class Hy extends Ky{}class jl extends j{}class qy extends jl{}class Qy extends jl{async _call(S){return new Fn(await super._call(S))}}class Xy extends jl{async _call(S){return new bt(await super._call(S))}}class pa extends j{}class Jy extends pa{}class Yy extends pa{async _call(S){return new Fn(await super._call(S))}}class Zy extends pa{async _call(S){return new bt(await super._call(S))}}class eM extends pa{async _call(S){return new pr(await super._call(S))}}class Vl extends j{}class tM extends Vl{}class rM extends Vl{async _call(S){return new Fn(await super._call(S))}}class sM extends Vl{async _call(S){return new bt(await super._call(S))}}class bT extends j{}class nM extends ln{}class iM extends ln{async _call(S){return new Fn(await super._call(S))}}class oM extends ln{async _call(S){return new bt(await super._call(S))}}class Ei extends j{}class aM extends Ei{}class lM extends Ei{async _call(S){return new Fn(await super._call(S))}}class dM extends Ei{async _call(S){return new bt(await super._call(S))}}class cM extends Ei{async _call(S){return new bb(await super._call(S))}}class uM extends Ei{async _call(S){return new pr(await super._call(S))}}class pM extends j{}class hM extends pM{}class Ul extends j{}class vT extends Ul{}class mM extends Ul{}class fM extends Ul{async generate_speech(S,L,{threshold:oe=.5,minlenratio:ge=0,maxlenratio:fe=20,vocoder:Se=null}={}){const De={input_ids:S},{encoder_outputs:Ge,encoder_attention_mask:Je}=await ie(this,De),lt=Ge.dims[1]/this.config.reduction_factor,yt=Math.floor(lt*fe),st=Math.floor(lt*ge),Et=this.config.num_mel_bins;let at=[],vt=null,ct=null,xt=0;for(;;){++xt;const yr=H(!!ct);let Pt;ct?Pt=ct.output_sequence_out:Pt=new h.Tensor("float32",new Float32Array(Et),[1,1,Et]);let Nt={use_cache_branch:yr,output_sequence:Pt,encoder_attention_mask:Je,speaker_embeddings:L,encoder_hidden_states:Ge};this.addPastKeyValues(Nt,vt),ct=await q(this.sessions.decoder_model_merged,Nt),vt=this.getPastKeyValues(ct,vt);const{prob:tr,spectrum:sr}=ct;if(at.push(sr),xt>=st&&(Array.from(tr.data).filter(Wr=>Wr>=oe).length>0||xt>=yt))break}const Lt=(0,h.cat)(at),{waveform:Qt}=await q(Se.sessions.model,{spectrogram:Lt});return{spectrogram:Lt,waveform:Qt}}}class _M extends j{constructor(){super(...arguments);re(this,"main_input_name","spectrogram")}}class gM extends j{}class wM extends gM{}class pu extends j{}class yM extends pu{}class MM extends pu{}class hu extends j{}class bM extends hu{}class vM extends hu{}class mu extends j{}class TM extends mu{}class xM extends mu{}class Wl extends j{}class EM extends Wl{}class PM extends Wl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"text_model"})}}class CM extends Wl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"audio_model"})}}class SM extends j{}class fu extends SM{async _call(S){return new Tb(await super._call(S))}}class Gl extends j{}class TT extends Gl{}class $M extends Gl{}class kM extends Gl{}class _u extends j{}class IM extends _u{}class AM extends _u{}class gu extends j{}class FM extends gu{}class OM extends gu{async _call(S){return new bt(await super._call(S))}}class wu extends j{}class xT extends wu{}class ET extends wu{}class yu extends j{constructor(){super(...arguments);re(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}_apply_and_filter_by_delay_pattern_mask(L){const[oe,ge]=L.dims,fe=this.config.decoder.num_codebooks,Se=ge-fe;let De=0;for(let lt=0;lt0&&Et<=Se&&(L.data[De++]=L.data[lt])}const Ge=Math.floor(oe/fe),Je=De/(Ge*fe);return new h.Tensor(L.type,L.data.slice(0,De),[Ge,fe,Je])}prepare_inputs_for_generation(L,oe,ge){let fe=structuredClone(L);for(let De=0;De=Ge&&(fe[De][Ge]=BigInt(this.config.decoder.pad_token_id));return ge.guidance_scale!==null&&ge.guidance_scale>1&&(fe=fe.concat(fe)),super.prepare_inputs_for_generation(fe,oe,ge)}async generate(L){const oe=await super.generate(L),ge=this._apply_and_filter_by_delay_pattern_mask(oe).unsqueeze_(0),{audio_values:fe}=await q(this.sessions.encodec_decode,{audio_codes:ge});return fe}}class Kl extends j{}class DM extends Kl{}class LM extends Kl{async _call(S){return new bt(await super._call(S))}}class zM extends Kl{}class Hl extends j{}class BM extends Hl{}class RM extends Hl{async _call(S){return new bt(await super._call(S))}}class NM extends Hl{}class ql extends j{}class jM extends ql{}class VM extends ql{async _call(S){return new bt(await super._call(S))}}class UM extends ql{}class Ql extends j{}class WM extends Ql{}class GM extends Ql{async _call(S){return new bt(await super._call(S))}}class KM extends Ql{}class HM extends j{}class qM extends HM{}class QM extends j{}class XM extends QM{constructor(...L){super(...L);re(this,"forward_params",["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"]);this._generation_mode="text"}async forward(L){const oe=this._generation_mode??"text";let ge;if(oe==="text"||!L.past_key_values){const Je=this.sessions.prepare_inputs_embeds,lt=(0,a.pick)(L,Je.inputNames);ge=await q(Je,lt)}else{const Je=this.sessions.gen_img_embeds,lt=(0,a.pick)({image_ids:L.input_ids},Je.inputNames);ge=await q(Je,lt)}const fe={...L,...ge},Se=await ce(this,fe),De=this.sessions[oe==="text"?"lm_head":"gen_head"];if(!De)throw new Error(`Unable to find "${De}" generation head`);const Ge=await q(De,(0,a.pick)(Se,De.inputNames));return{...ge,...Se,...Ge}}async generate(L){return this._generation_mode="text",super.generate(L)}async generate_images(L){this._generation_mode="image";const oe=(L.inputs??L[this.main_input_name]).dims[1],fe=(await super.generate(L)).slice(null,[oe,null]),Se=this.sessions.image_decode,{decoded_image:De}=await q(Se,{generated_tokens:fe}),Ge=De.add_(1).mul_(255/2).clamp_(0,255).to("uint8"),Je=[];for(const lt of Ge){const yt=g.RawImage.fromTensor(lt);Je.push(yt)}return Je}}class JM extends me{constructor({char_logits:S,bpe_logits:L,wp_logits:oe}){super(),this.char_logits=S,this.bpe_logits=L,this.wp_logits=oe}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class YM extends j{}class ZM extends YM{async _call(S){return new JM(await super._call(S))}}class Mu extends j{}class e0 extends Mu{}class t0 extends Mu{}class bu extends j{}class r0 extends bu{}class s0 extends bu{}class n0 extends j{constructor(){super(...arguments);re(this,"forward_params",["input_ids","attention_mask","position_ids","audio_values","past_key_values"])}}class i0 extends n0{_merge_input_ids_with_audio_features(S){const L=S.audio_features.dims.at(-1),oe=S.audio_features.view(-1,L);return O({audio_token_id:this.config.ignore_index,...S,audio_features:oe})}}class Xl extends j{constructor(){super(...arguments);re(this,"main_input_name","input_values");re(this,"forward_params",["input_values"])}}class o0 extends me{constructor({audio_codes:S}){super(),this.audio_codes=S}}class a0 extends me{constructor({audio_values:S}){super(),this.audio_values=S}}class l0 extends Xl{async encode(S){return new o0(await q(this.sessions.encoder_model,S))}async decode(S){return new a0(await q(this.sessions.decoder_model,S))}}class d0 extends Xl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"encoder_model"})}}class c0 extends Xl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"decoder_model"})}}class Jl extends j{constructor(){super(...arguments);re(this,"main_input_name","input_values");re(this,"forward_params",["input_values"])}}class u0 extends me{constructor({audio_codes:S}){super(),this.audio_codes=S}}class p0 extends me{constructor({audio_values:S}){super(),this.audio_values=S}}class h0 extends Jl{async encode(S){return new u0(await q(this.sessions.encoder_model,S))}async decode(S){return new p0(await q(this.sessions.decoder_model,S))}}class m0 extends Jl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"encoder_model"})}}class f0 extends Jl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"decoder_model"})}}class Yl extends j{constructor(){super(...arguments);re(this,"main_input_name","input_values");re(this,"forward_params",["input_values"])}}class _0 extends Yl{async encode(S){return await q(this.sessions.encoder_model,S)}async decode(S){return await q(this.sessions.decoder_model,S)}}class g0 extends Yl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"encoder_model"})}}class w0 extends Yl{static async from_pretrained(S,L={}){return super.from_pretrained(S,{...L,model_file_name:L.model_file_name??"decoder_model"})}}class It{static async from_pretrained(S,{progress_callback:L=null,config:oe=null,cache_dir:ge=null,local_files_only:fe=!1,revision:Se="main",model_file_name:De=null,subfolder:Ge="onnx",device:Je=null,dtype:lt=null,use_external_data_format:yt=null,session_options:st={}}={}){const Et={progress_callback:L,config:oe,cache_dir:ge,local_files_only:fe,revision:Se,model_file_name:De,subfolder:Ge,device:Je,dtype:lt,use_external_data_format:yt,session_options:st};if(Et.config=await s.AutoConfig.from_pretrained(S,Et),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);const at=Et.config.model_type;for(const vt of this.MODEL_CLASS_MAPPINGS){let ct=vt.get(at);if(!ct){for(const xt of vt.values())if(xt[0]===at){ct=xt;break}if(!ct)continue}return await ct[1].from_pretrained(S,Et)}if(this.BASE_IF_FAIL)return W0.has(at)||console.warn(`Unknown model class "${at}", attempting to construct from base class.`),await j.from_pretrained(S,Et);throw Error(`Unsupported model type: ${at}`)}}re(It,"MODEL_CLASS_MAPPINGS",null),re(It,"BASE_IF_FAIL",!1);const PT=new Map([["bert",["BertModel",Ae]],["modernbert",["ModernBertModel",ee]],["nomic_bert",["NomicBertModel",ve]],["roformer",["RoFormerModel",Fe]],["electra",["ElectraModel",cs]],["esm",["EsmModel",Zs]],["convbert",["ConvBertModel",nr]],["camembert",["CamembertModel",us]],["deberta",["DebertaModel",Be]],["deberta-v2",["DebertaV2Model",ps]],["mpnet",["MPNetModel",xn]],["albert",["AlbertModel",Cn]],["distilbert",["DistilBertModel",Ps]],["roberta",["RobertaModel",ur]],["xlm",["XLMModel",rn]],["xlm-roberta",["XLMRobertaModel",Ra]],["clap",["ClapModel",EM]],["clip",["CLIPModel",eo]],["clipseg",["CLIPSegModel",on]],["chinese_clip",["ChineseCLIPModel",sl]],["siglip",["SiglipModel",Za]],["jina_clip",["JinaCLIPModel",nl]],["mobilebert",["MobileBertModel",br]],["squeezebert",["SqueezeBertModel",cr]],["wav2vec2",["Wav2Vec2Model",Ny]],["wav2vec2-bert",["Wav2Vec2BertModel",tM]],["unispeech",["UniSpeechModel",qy]],["unispeech-sat",["UniSpeechSatModel",Jy]],["hubert",["HubertModel",nM]],["wavlm",["WavLMModel",aM]],["audio-spectrogram-transformer",["ASTModel",Va]],["vits",["VitsModel",fu]],["pyannote",["PyAnnoteModel",Wy]],["wespeaker-resnet",["WeSpeakerResNetModel",Hy]],["detr",["DetrModel",Al]],["rt_detr",["RTDetrModel",Dl]],["rt_detr_v2",["RTDetrV2Model",zl]],["rf_detr",["RFDetrModel",ua]],["table-transformer",["TableTransformerModel",C]],["vit",["ViTModel",Ko]],["ijepa",["IJepaModel",qo]],["pvt",["PvtModel",cl]],["vit_msn",["ViTMSNModel",ml]],["vit_mae",["ViTMAEModel",hl]],["groupvit",["GroupViTModel",gl]],["fastvit",["FastViTModel",wl]],["mobilevit",["MobileViTModel",vl]],["mobilevitv2",["MobileViTV2Model",xl]],["owlvit",["OwlViTModel",Pl]],["owlv2",["Owlv2Model",Sl]],["beit",["BeitModel",kl]],["deit",["DeiTModel",ye]],["hiera",["HieraModel",Ye]],["convnext",["ConvNextModel",My]],["convnextv2",["ConvNextV2Model",vy]],["dinov2",["Dinov2Model",xy]],["dinov2_with_registers",["Dinov2WithRegistersModel",Py]],["resnet",["ResNetModel",Bt]],["swin",["SwinModel",Xw]],["swin2sr",["Swin2SRModel",Zw]],["donut-swin",["DonutSwinModel",yy]],["yolos",["YolosModel",ky]],["dpt",["DPTModel",ty]],["glpn",["GLPNModel",_y]],["hifigan",["SpeechT5HifiGan",_M]],["efficientnet",["EfficientNetModel",FM]],["decision_transformer",["DecisionTransformerModel",qM]],["patchtst",["PatchTSTForPrediction",e0]],["patchtsmixer",["PatchTSMixerForPrediction",r0]],["mobilenet_v1",["MobileNetV1Model",DM]],["mobilenet_v2",["MobileNetV2Model",BM]],["mobilenet_v3",["MobileNetV3Model",jM]],["mobilenet_v4",["MobileNetV4Model",WM]],["maskformer",["MaskFormerModel",my]],["mgp-str",["MgpstrForSceneTextRecognition",ZM]],["style_text_to_speech_2",["StyleTextToSpeech2Model",hM]]]),CT=new Map([["t5",["T5Model",le]],["longt5",["LongT5Model",Ue]],["mt5",["MT5Model",Ze]],["bart",["BartModel",kt]],["mbart",["MBartModel",vr]],["marian",["MarianModel",Ly]],["whisper",["WhisperModel",Wa]],["m2m_100",["M2M100Model",By]],["blenderbot",["BlenderbotModel",Gt]],["blenderbot-small",["BlenderbotSmallModel",Zr]]]),ST=new Map([["mimi",["MimiModel",l0]],["dac",["DacModel",h0]],["snac",["SnacModel",_0]]]),$T=new Map([["bloom",["BloomModel",No]],["jais",["JAISModel",so]],["gpt2",["GPT2Model",al]],["gptj",["GPTJModel",co]],["gpt_bigcode",["GPTBigCodeModel",dl]],["gpt_neo",["GPTNeoModel",io]],["gpt_neox",["GPTNeoXModel",ll]],["codegen",["CodeGenModel",In]],["llama",["LlamaModel",ri]],["exaone",["ExaoneModel",fo]],["olmo",["OlmoModel",go]],["olmo2",["Olmo2Model",yo]],["mobilellm",["MobileLLMModel",ft]],["granite",["GraniteModel",Mo]],["cohere",["CohereModel",vo]],["gemma",["GemmaModel",xo]],["gemma2",["Gemma2Model",Po]],["gemma3_text",["Gemma3Model",So]],["helium",["HeliumModel",ho]],["glm",["GlmModel",mo]],["openelm",["OpenELMModel",ko]],["qwen2",["Qwen2Model",Ao]],["phi",["PhiModel",Lo]],["phi3",["Phi3Model",Bo]],["mpt",["MptModel",Vo]],["opt",["OPTModel",Wo]],["mistral",["MistralModel",yM]],["starcoder2",["Starcoder2Model",bM]],["falcon",["FalconModel",TM]],["stablelm",["StableLmModel",IM]]]),vu=new Map([["speecht5",["SpeechT5ForSpeechToText",mM]],["whisper",["WhisperForConditionalGeneration",Hi]],["lite-whisper",["LiteWhisperForConditionalGeneration",Ga]],["moonshine",["MoonshineForConditionalGeneration",Ka]]]),y0=new Map([["speecht5",["SpeechT5ForTextToSpeech",fM]]]),M0=new Map([["vits",["VitsModel",fu]],["musicgen",["MusicgenForConditionalGeneration",yu]]]),b0=new Map([["bert",["BertForSequenceClassification",Le]],["modernbert",["ModernBertForSequenceClassification",te]],["roformer",["RoFormerForSequenceClassification",qe]],["electra",["ElectraForSequenceClassification",jr]],["esm",["EsmForSequenceClassification",tn]],["convbert",["ConvBertForSequenceClassification",dr]],["camembert",["CamembertForSequenceClassification",xs]],["deberta",["DebertaForSequenceClassification",it]],["deberta-v2",["DebertaV2ForSequenceClassification",Er]],["mpnet",["MPNetForSequenceClassification",En]],["albert",["AlbertForSequenceClassification",pe]],["distilbert",["DistilBertForSequenceClassification",Qs]],["roberta",["RobertaForSequenceClassification",Jt]],["xlm",["XLMForSequenceClassification",za]],["xlm-roberta",["XLMRobertaForSequenceClassification",Sn]],["bart",["BartForSequenceClassification",Ot]],["mbart",["MBartForSequenceClassification",Yr]],["mobilebert",["MobileBertForSequenceClassification",Bs]],["squeezebert",["SqueezeBertForSequenceClassification",Ns]]]),v0=new Map([["bert",["BertForTokenClassification",Ne]],["modernbert",["ModernBertForTokenClassification",de]],["roformer",["RoFormerForTokenClassification",Xe]],["electra",["ElectraForTokenClassification",dt]],["esm",["EsmForTokenClassification",Lr]],["convbert",["ConvBertForTokenClassification",ds]],["camembert",["CamembertForTokenClassification",Es]],["deberta",["DebertaForTokenClassification",rr]],["deberta-v2",["DebertaV2ForTokenClassification",ms]],["mpnet",["MPNetForTokenClassification",Rs]],["distilbert",["DistilBertForTokenClassification",Xs]],["roberta",["RobertaForTokenClassification",qt]],["xlm",["XLMForTokenClassification",Wi]],["xlm-roberta",["XLMRobertaForTokenClassification",ja]]]),Tu=new Map([["t5",["T5ForConditionalGeneration",ue]],["longt5",["LongT5ForConditionalGeneration",Qe]],["mt5",["MT5ForConditionalGeneration",ht]],["bart",["BartForConditionalGeneration",Wt]],["mbart",["MBartForConditionalGeneration",_r]],["marian",["MarianMTModel",zy]],["m2m_100",["M2M100ForConditionalGeneration",Ry]],["blenderbot",["BlenderbotForConditionalGeneration",Zt]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",ws]]]),xu=new Map([["bloom",["BloomForCausalLM",jo]],["gpt2",["GPT2LMHeadModel",Yn]],["jais",["JAISLMHeadModel",no]],["gptj",["GPTJForCausalLM",kn]],["gpt_bigcode",["GPTBigCodeForCausalLM",uo]],["gpt_neo",["GPTNeoForCausalLM",oo]],["gpt_neox",["GPTNeoXForCausalLM",ao]],["codegen",["CodeGenForCausalLM",Ur]],["llama",["LlamaForCausalLM",po]],["exaone",["ExaoneForCausalLM",mt]],["olmo",["OlmoForCausalLM",wo]],["olmo2",["Olmo2ForCausalLM",li]],["mobilellm",["MobileLLMForCausalLM",_o]],["granite",["GraniteForCausalLM",bo]],["cohere",["CohereForCausalLM",To]],["gemma",["GemmaForCausalLM",Eo]],["gemma2",["Gemma2ForCausalLM",Co]],["gemma3_text",["Gemma3ForCausalLM",$o]],["helium",["HeliumForCausalLM",ni]],["glm",["GlmForCausalLM",gt]],["openelm",["OpenELMForCausalLM",Io]],["qwen2",["Qwen2ForCausalLM",Fo]],["phi",["PhiForCausalLM",zo]],["phi3",["Phi3ForCausalLM",Ro]],["mpt",["MptForCausalLM",Uo]],["opt",["OPTForCausalLM",Go]],["mbart",["MBartForCausalLM",Tr]],["mistral",["MistralForCausalLM",MM]],["starcoder2",["Starcoder2ForCausalLM",vM]],["falcon",["FalconForCausalLM",xM]],["trocr",["TrOCRForCausalLM",wM]],["stablelm",["StableLmForCausalLM",AM]],["phi3_v",["Phi3VForCausalLM",js]]]),kT=new Map([["multi_modality",["MultiModalityCausalLM",XM]]]),T0=new Map([["bert",["BertForMaskedLM",Ie]],["modernbert",["ModernBertForMaskedLM",B]],["roformer",["RoFormerForMaskedLM",je]],["electra",["ElectraForMaskedLM",Ds]],["esm",["EsmForMaskedLM",en]],["convbert",["ConvBertForMaskedLM",jt]],["camembert",["CamembertForMaskedLM",Ts]],["deberta",["DebertaForMaskedLM",et]],["deberta-v2",["DebertaV2ForMaskedLM",hs]],["mpnet",["MPNetForMaskedLM",zr]],["albert",["AlbertForMaskedLM",V]],["distilbert",["DistilBertForMaskedLM",Ys]],["roberta",["RobertaForMaskedLM",Rt]],["xlm",["XLMWithLMHeadModel",sn]],["xlm-roberta",["XLMRobertaForMaskedLM",Na]],["mobilebert",["MobileBertForMaskedLM",zs]],["squeezebert",["SqueezeBertForMaskedLM",fr]]]),x0=new Map([["bert",["BertForQuestionAnswering",We]],["roformer",["RoFormerForQuestionAnswering",ut]],["electra",["ElectraForQuestionAnswering",qr]],["convbert",["ConvBertForQuestionAnswering",Os]],["camembert",["CamembertForQuestionAnswering",Ls]],["deberta",["DebertaForQuestionAnswering",zt]],["deberta-v2",["DebertaV2ForQuestionAnswering",fs]],["mpnet",["MPNetForQuestionAnswering",Ar]],["albert",["AlbertForQuestionAnswering",F]],["distilbert",["DistilBertForQuestionAnswering",Js]],["roberta",["RobertaForQuestionAnswering",er]],["xlm",["XLMForQuestionAnswering",Ba]],["xlm-roberta",["XLMRobertaForQuestionAnswering",Gi]],["mobilebert",["MobileBertForQuestionAnswering",Ir]],["squeezebert",["SqueezeBertForQuestionAnswering",Pn]]]),Eu=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Qi]],["idefics3",["Idefics3ForConditionalGeneration",Hn]],["smolvlm",["SmolVLMForConditionalGeneration",qn]]]),E0=new Map([["llava",["LlavaForConditionalGeneration",Kn]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",qa]],["moondream1",["Moondream1ForConditionalGeneration",Qa]],["florence2",["Florence2ForConditionalGeneration",Xi]],["qwen2-vl",["Qwen2VLForConditionalGeneration",Do]],["idefics3",["Idefics3ForConditionalGeneration",Hn]],["smolvlm",["SmolVLMForConditionalGeneration",qn]],["paligemma",["PaliGemmaForConditionalGeneration",Yi]]]),P0=new Map([["ultravox",["UltravoxModel",i0]]]),IT=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",Qi]]]),C0=new Map([["vit",["ViTForImageClassification",Ho]],["ijepa",["IJepaForImageClassification",Qo]],["pvt",["PvtForImageClassification",ul]],["vit_msn",["ViTMSNForImageClassification",fl]],["fastvit",["FastViTForImageClassification",yl]],["mobilevit",["MobileViTForImageClassification",Tl]],["mobilevitv2",["MobileViTV2ForImageClassification",El]],["beit",["BeitForImageClassification",Il]],["deit",["DeiTForImageClassification",Ee]],["hiera",["HieraForImageClassification",ot]],["convnext",["ConvNextForImageClassification",by]],["convnextv2",["ConvNextV2ForImageClassification",Ty]],["dinov2",["Dinov2ForImageClassification",Ey]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",Cy]],["resnet",["ResNetForImageClassification",Fr]],["swin",["SwinForImageClassification",Jw]],["segformer",["SegformerForImageClassification",$M]],["efficientnet",["EfficientNetForImageClassification",OM]],["mobilenet_v1",["MobileNetV1ForImageClassification",LM]],["mobilenet_v2",["MobileNetV2ForImageClassification",RM]],["mobilenet_v3",["MobileNetV3ForImageClassification",VM]],["mobilenet_v4",["MobileNetV4ForImageClassification",GM]]]),S0=new Map([["detr",["DetrForObjectDetection",Fl]],["rt_detr",["RTDetrForObjectDetection",Ll]],["rt_detr_v2",["RTDetrV2ForObjectDetection",Bl]],["rf_detr",["RFDetrForObjectDetection",d]],["table-transformer",["TableTransformerForObjectDetection",I]],["yolos",["YolosForObjectDetection",Iy]]]),$0=new Map([["owlvit",["OwlViTForObjectDetection",Cl]],["owlv2",["Owlv2ForObjectDetection",$l]],["grounding-dino",["GroundingDinoForObjectDetection",$y]]]),Pi=new Map([["detr",["DetrForSegmentation",oa]],["clipseg",["CLIPSegForImageSegmentation",to]]]),k0=new Map([["segformer",["SegformerForSemanticSegmentation",kM]],["sapiens",["SapiensForSemanticSegmentation",iy]],["swin",["SwinForSemanticSegmentation",Yw]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",zM]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",NM]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",UM]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",KM]]]),I0=new Map([["detr",["DetrForSegmentation",oa]],["maskformer",["MaskFormerForInstanceSegmentation",fy]]]),A0=new Map([["sam",["SamModel",Oy]]]),F0=new Map([["wav2vec2",["Wav2Vec2ForCTC",jy]],["wav2vec2-bert",["Wav2Vec2BertForCTC",rM]],["unispeech",["UniSpeechForCTC",Qy]],["unispeech-sat",["UniSpeechSatForCTC",Yy]],["wavlm",["WavLMForCTC",lM]],["hubert",["HubertForCTC",iM]]]),O0=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",Vy]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",sM]],["unispeech",["UniSpeechForSequenceClassification",Xy]],["unispeech-sat",["UniSpeechSatForSequenceClassification",Zy]],["wavlm",["WavLMForSequenceClassification",dM]],["hubert",["HubertForSequenceClassification",oM]],["audio-spectrogram-transformer",["ASTForAudioClassification",Ua]]]),D0=new Map([["wavlm",["WavLMForXVector",cM]]]),L0=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",eM]],["wavlm",["WavLMForAudioFrameClassification",uM]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",Uy]],["pyannote",["PyAnnoteForAudioFrameClassification",Gy]]]),z0=new Map([["vitmatte",["VitMatteForImageMatting",bl]]]),AT=new Map([["patchtst",["PatchTSTForPrediction",t0]],["patchtsmixer",["PatchTSMixerForPrediction",s0]]]),B0=new Map([["swin2sr",["Swin2SRForImageSuperResolution",ey]]]),R0=new Map([["dpt",["DPTForDepthEstimation",ry]],["depth_anything",["DepthAnythingForDepthEstimation",ny]],["glpn",["GLPNForDepthEstimation",gy]],["sapiens",["SapiensForDepthEstimation",oy]],["depth_pro",["DepthProForDepthEstimation",dy]],["metric3d",["Metric3DForDepthEstimation",uy]],["metric3dv2",["Metric3Dv2ForDepthEstimation",hy]]]),N0=new Map([["sapiens",["SapiensForNormalEstimation",ay]]]),j0=new Map([["vitpose",["VitPoseForPoseEstimation",Jo]]]),V0=new Map([["clip",["CLIPVisionModelWithProjection",Qn]],["siglip",["SiglipVisionModel",tl]],["jina_clip",["JinaCLIPVisionModel",ol]]]),U0=[[PT,E.EncoderOnly],[CT,E.EncoderDecoder],[$T,E.DecoderOnly],[ST,E.AutoEncoder],[b0,E.EncoderOnly],[v0,E.EncoderOnly],[Tu,E.Seq2Seq],[vu,E.Seq2Seq],[xu,E.DecoderOnly],[kT,E.MultiModality],[T0,E.EncoderOnly],[x0,E.EncoderOnly],[Eu,E.Vision2Seq],[E0,E.ImageTextToText],[P0,E.AudioTextToText],[C0,E.EncoderOnly],[Pi,E.EncoderOnly],[I0,E.EncoderOnly],[k0,E.EncoderOnly],[z0,E.EncoderOnly],[AT,E.EncoderOnly],[B0,E.EncoderOnly],[R0,E.EncoderOnly],[N0,E.EncoderOnly],[j0,E.EncoderOnly],[S0,E.EncoderOnly],[$0,E.EncoderOnly],[A0,E.MaskGeneration],[F0,E.EncoderOnly],[O0,E.EncoderOnly],[y0,E.Seq2Seq],[M0,E.EncoderOnly],[D0,E.EncoderOnly],[L0,E.EncoderOnly],[V0,E.EncoderOnly]];for(const[b,S]of U0)for(const[L,oe]of b.values())M.set(L,S),x.set(oe,L),w.set(L,oe);const FT=[["MusicgenForConditionalGeneration",yu,E.Musicgen],["Phi3VForCausalLM",js,E.Phi3V],["CLIPTextModelWithProjection",Ya,E.EncoderOnly],["SiglipTextModel",el,E.EncoderOnly],["JinaCLIPTextModel",il,E.EncoderOnly],["ClapTextModelWithProjection",PM,E.EncoderOnly],["ClapAudioModelWithProjection",CM,E.EncoderOnly],["DacEncoderModel",m0,E.EncoderOnly],["DacDecoderModel",f0,E.EncoderOnly],["MimiEncoderModel",d0,E.EncoderOnly],["MimiDecoderModel",c0,E.EncoderOnly],["SnacEncoderModel",g0,E.EncoderOnly],["SnacDecoderModel",w0,E.EncoderOnly]];for(const[b,S,L]of FT)M.set(b,L),x.set(S,b),w.set(b,S);const W0=new Map([["modnet",Pi],["birefnet",Pi],["isnet",Pi],["ben",Pi]]);for(const[b,S]of W0.entries())S.set(b,["PreTrainedModel",j]),M.set(b,E.EncoderOnly),x.set(j,b),w.set(b,j);class Pu extends It{}re(Pu,"MODEL_CLASS_MAPPINGS",U0.map(S=>S[0])),re(Pu,"BASE_IF_FAIL",!0);class G0 extends It{}re(G0,"MODEL_CLASS_MAPPINGS",[b0]);class K0 extends It{}re(K0,"MODEL_CLASS_MAPPINGS",[v0]);class H0 extends It{}re(H0,"MODEL_CLASS_MAPPINGS",[Tu]);class q0 extends It{}re(q0,"MODEL_CLASS_MAPPINGS",[vu]);class Q0 extends It{}re(Q0,"MODEL_CLASS_MAPPINGS",[y0]);class X0 extends It{}re(X0,"MODEL_CLASS_MAPPINGS",[M0]);class J0 extends It{}re(J0,"MODEL_CLASS_MAPPINGS",[xu]);class Y0 extends It{}re(Y0,"MODEL_CLASS_MAPPINGS",[T0]);class Z0 extends It{}re(Z0,"MODEL_CLASS_MAPPINGS",[x0]);class eb extends It{}re(eb,"MODEL_CLASS_MAPPINGS",[Eu]);class tb extends It{}re(tb,"MODEL_CLASS_MAPPINGS",[C0]);class rb extends It{}re(rb,"MODEL_CLASS_MAPPINGS",[Pi]);class sb extends It{}re(sb,"MODEL_CLASS_MAPPINGS",[k0]);class nb extends It{}re(nb,"MODEL_CLASS_MAPPINGS",[I0]);class ib extends It{}re(ib,"MODEL_CLASS_MAPPINGS",[S0]);class ob extends It{}re(ob,"MODEL_CLASS_MAPPINGS",[$0]);class ab extends It{}re(ab,"MODEL_CLASS_MAPPINGS",[A0]);class lb extends It{}re(lb,"MODEL_CLASS_MAPPINGS",[F0]);class db extends It{}re(db,"MODEL_CLASS_MAPPINGS",[O0]);class cb extends It{}re(cb,"MODEL_CLASS_MAPPINGS",[D0]);class ub extends It{}re(ub,"MODEL_CLASS_MAPPINGS",[L0]);class pb extends It{}re(pb,"MODEL_CLASS_MAPPINGS",[IT]);class hb extends It{}re(hb,"MODEL_CLASS_MAPPINGS",[z0]);class mb extends It{}re(mb,"MODEL_CLASS_MAPPINGS",[B0]);class fb extends It{}re(fb,"MODEL_CLASS_MAPPINGS",[R0]);class _b extends It{}re(_b,"MODEL_CLASS_MAPPINGS",[N0]);class gb extends It{}re(gb,"MODEL_CLASS_MAPPINGS",[j0]);class wb extends It{}re(wb,"MODEL_CLASS_MAPPINGS",[V0]);class yb extends It{}re(yb,"MODEL_CLASS_MAPPINGS",[E0]);class Mb extends It{}re(Mb,"MODEL_CLASS_MAPPINGS",[P0]);class OT extends me{constructor({logits:S,past_key_values:L,encoder_outputs:oe,decoder_attentions:ge=null,cross_attentions:fe=null}){super(),this.logits=S,this.past_key_values=L,this.encoder_outputs=oe,this.decoder_attentions=ge,this.cross_attentions=fe}}class bt extends me{constructor({logits:S,...L}){super(),this.logits=S;const oe=Object.values(L);oe.length>0&&(this.attentions=oe)}}class bb extends me{constructor({logits:S,embeddings:L}){super(),this.logits=S,this.embeddings=L}}class pr extends me{constructor({logits:S}){super(),this.logits=S}}class wr extends me{constructor({logits:S}){super(),this.logits=S}}class Pr extends me{constructor({start_logits:S,end_logits:L}){super(),this.start_logits=S,this.end_logits=L}}class Fn extends me{constructor({logits:S}){super(),this.logits=S}}class DT extends me{constructor({logits:S,past_key_values:L}){super(),this.logits=S,this.past_key_values=L}}class vb extends me{constructor({alphas:S}){super(),this.alphas=S}}class Tb extends me{constructor({waveform:S,spectrogram:L}){super(),this.waveform=S,this.spectrogram=L}}},"./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js":(e,r,t)=>{t.r(r),t.d(r,{ASTFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var i=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a);const l=this.config.sampling_rate,c=(0,i.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(l/2),l,null,"kaldi",!0);for(let p=0;p{t.r(r),t.d(r,{AutoFeatureExtractor:()=>o});var s=t("./src/utils/constants.js"),i=t("./src/utils/hub.js");t("./src/base/feature_extraction_utils.js");var n=t("./src/models/feature_extractors.js");class o{static async from_pretrained(l,c={}){const p=await(0,i.getModelJSON)(l,s.FEATURE_EXTRACTOR_NAME,!0,c),u=p.feature_extractor_type,h=n[u];if(!h)throw new Error(`Unknown feature_extractor_type: '${u}'. Please report this at ${s.GITHUB_ISSUE_URL}.`);return new h(p)}}},"./src/models/auto/image_processing_auto.js":(e,r,t)=>{t.r(r),t.d(r,{AutoImageProcessor:()=>a});var s=t("./src/utils/constants.js"),i=t("./src/utils/hub.js"),n=t("./src/base/image_processors_utils.js"),o=t("./src/models/image_processors.js");class a{static async from_pretrained(c,p={}){const u=await(0,i.getModelJSON)(c,s.IMAGE_PROCESSOR_NAME,!0,p),h=u.image_processor_type??u.feature_extractor_type;let g=o[h];return g||(h!==void 0&&console.warn(`Image processor type '${h}' not found, assuming base ImageProcessor. Please report this at ${s.GITHUB_ISSUE_URL}.`),g=n.ImageProcessor),new g(u)}}},"./src/models/auto/processing_auto.js":(e,r,t)=>{t.r(r),t.d(r,{AutoProcessor:()=>c});var s=t("./src/utils/constants.js"),i=t("./src/utils/hub.js"),n=t("./src/base/processing_utils.js"),o=t("./src/models/processors.js"),a=t("./src/models/image_processors.js"),l=t("./src/models/feature_extractors.js");class c{static async from_pretrained(u,h={}){const g=await(0,i.getModelJSON)(u,s.IMAGE_PROCESSOR_NAME,!0,h),{image_processor_type:_,feature_extractor_type:P,processor_class:A}=g;if(A&&o[A])return o[A].from_pretrained(u,h);if(!_&&!P)throw new Error("No `image_processor_type` or `feature_extractor_type` found in the config.");const v={};if(_){const k=a[_];if(!k)throw new Error(`Unknown image_processor_type: '${_}'.`);v.image_processor=new k(g)}if(P){const k=a[P];if(k)v.image_processor=new k(g);else{const E=l[P];if(!E)throw new Error(`Unknown feature_extractor_type: '${P}'.`);v.feature_extractor=new E(g)}}const y={};return new n.Processor(y,v)}}},"./src/models/beit/image_processing_beit.js":(e,r,t)=>{t.r(r),t.d(r,{BeitFeatureExtractor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}},"./src/models/bit/image_processing_bit.js":(e,r,t)=>{t.r(r),t.d(r,{BitImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}},"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,r,t)=>{t.r(r),t.d(r,{ChineseCLIPFeatureExtractor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}},"./src/models/clap/feature_extraction_clap.js":(e,r,t)=>{t.r(r),t.d(r,{ClapFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var i=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a),this.mel_filters=(0,i.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=(0,i.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=(0,i.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(a,l,c,p){let u;const h=a.length-l;if(h>0)if(c==="rand_trunc"){const g=Math.floor(Math.random()*(h+1));a=a.subarray(g,g+l),u=await this._extract_fbank_features(a,this.mel_filters_slaney,this.config.nb_max_samples)}else throw new Error(`Truncation strategy "${c}" not implemented`);else{if(h<0){let g=new Float64Array(l);if(g.set(a),p==="repeat")for(let _=a.length;_{t.r(r),t.d(r,{CLIPFeatureExtractor:()=>n,CLIPImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/convnext/image_processing_convnext.js":(e,r,t)=>{t.r(r),t.d(r,{ConvNextFeatureExtractor:()=>n,ConvNextImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{constructor(a){super(a),this.crop_pct=this.config.crop_pct??224/256}async resize(a){var c;const l=(c=this.size)==null?void 0:c.shortest_edge;if(l===void 0)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(l<384){const p=Math.floor(l/this.crop_pct),[u,h]=this.get_resize_output_image_size(a,{shortest_edge:p});a=await a.resize(u,h,{resample:this.resample}),a=await a.center_crop(l,l)}else a=await a.resize(l,l,{resample:this.resample});return a}}class n extends i{}},"./src/models/dac/feature_extraction_dac.js":(e,r,t)=>{t.r(r),t.d(r,{DacFeatureExtractor:()=>i});var s=t("./src/models/encodec/feature_extraction_encodec.js");class i extends s.EncodecFeatureExtractor{}},"./src/models/deit/image_processing_deit.js":(e,r,t)=>{t.r(r),t.d(r,{DeiTFeatureExtractor:()=>n,DeiTImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/detr/image_processing_detr.js":(e,r,t)=>{t.r(r),t.d(r,{DetrFeatureExtractor:()=>o,DetrImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),i=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(l){const c=await super._call(l),p=[c.pixel_values.dims[0],64,64],u=(0,i.full)(p,1n);return{...c,pixel_mask:u}}post_process_object_detection(...l){return(0,s.post_process_object_detection)(...l)}post_process_panoptic_segmentation(...l){return(0,s.post_process_panoptic_segmentation)(...l)}post_process_instance_segmentation(...l){return(0,s.post_process_instance_segmentation)(...l)}}class o extends n{}},"./src/models/donut/image_processing_donut.js":(e,r,t)=>{t.r(r),t.d(r,{DonutFeatureExtractor:()=>n,DonutImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{pad_image(a,l,c,p={}){const[u,h,g]=l;let _=this.image_mean;Array.isArray(this.image_mean)||(_=new Array(g).fill(_));let P=this.image_std;Array.isArray(P)||(P=new Array(g).fill(_));const A=_.map((v,y)=>-v/P[y]);return super.pad_image(a,l,c,{center:!0,constant_values:A,...p})}}class n extends i{}},"./src/models/dpt/image_processing_dpt.js":(e,r,t)=>{t.r(r),t.d(r,{DPTFeatureExtractor:()=>n,DPTImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/efficientnet/image_processing_efficientnet.js":(e,r,t)=>{t.r(r),t.d(r,{EfficientNetImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{constructor(o){super(o),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(a=>a*a))}}},"./src/models/encodec/feature_extraction_encodec.js":(e,r,t)=>{t.r(r),t.d(r,{EncodecFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),i=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(a){(0,s.validate_audio_inputs)(a,"EncodecFeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));const l=this.config.feature_size;if(a.length%l!==0)throw new Error(`The length of the audio data must be a multiple of the number of channels (${l}).`);const c=[1,l,a.length/l];return{input_values:new i.Tensor("float32",a,c)}}}},"./src/models/feature_extractors.js":(e,r,t)=>{t.r(r),t.d(r,{ASTFeatureExtractor:()=>s.ASTFeatureExtractor,ClapFeatureExtractor:()=>n.ClapFeatureExtractor,DacFeatureExtractor:()=>o.DacFeatureExtractor,EncodecFeatureExtractor:()=>i.EncodecFeatureExtractor,ImageFeatureExtractor:()=>P.ImageProcessor,MoonshineFeatureExtractor:()=>a.MoonshineFeatureExtractor,PyAnnoteFeatureExtractor:()=>l.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>c.SeamlessM4TFeatureExtractor,SnacFeatureExtractor:()=>p.SnacFeatureExtractor,SpeechT5FeatureExtractor:()=>u.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>h.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>g.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>_.WhisperFeatureExtractor});var s=t("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),i=t("./src/models/encodec/feature_extraction_encodec.js"),n=t("./src/models/clap/feature_extraction_clap.js"),o=t("./src/models/dac/feature_extraction_dac.js"),a=t("./src/models/moonshine/feature_extraction_moonshine.js"),l=t("./src/models/pyannote/feature_extraction_pyannote.js"),c=t("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),p=t("./src/models/snac/feature_extraction_snac.js"),u=t("./src/models/speecht5/feature_extraction_speecht5.js"),h=t("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),g=t("./src/models/wespeaker/feature_extraction_wespeaker.js"),_=t("./src/models/whisper/feature_extraction_whisper.js"),P=t("./src/base/image_processors_utils.js")},"./src/models/florence2/processing_florence2.js":(e,r,t)=>{t.r(r),t.d(r,{Florence2Processor:()=>o});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class o extends s.Processor{constructor(l,c){super(l,c);const{tasks_answer_post_processing_type:p,task_prompts_without_inputs:u,task_prompts_with_input:h}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(p??{})),this.task_prompts_without_inputs=new Map(Object.entries(u??{})),this.task_prompts_with_input=new Map(Object.entries(h??{})),this.regexes={quad_boxes:/(.+?)/gm,bboxes:/([^<]+)?/gm},this.size_per_bin=1e3}construct_prompts(l){typeof l=="string"&&(l=[l]);const c=[];for(const p of l)if(this.task_prompts_without_inputs.has(p))c.push(this.task_prompts_without_inputs.get(p));else{for(const[u,h]of this.task_prompts_with_input)if(p.includes(u)){c.push(h.replaceAll("{input}",p).replaceAll(u,""));break}c.length!==l.length&&c.push(p)}return c}post_process_generation(l,c,p){const u=this.tasks_answer_post_processing_type.get(c)??"pure_text";l=l.replaceAll("","").replaceAll("","");let h;switch(u){case"pure_text":h=l;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const g=u==="ocr"?"quad_boxes":"bboxes",_=l.matchAll(this.regexes[g]),P=[],A=[];for(const[v,y,...k]of _)P.push(y?y.trim():P.at(-1)??""),A.push(k.map((E,M)=>(Number(E)+.5)/this.size_per_bin*p[M%2]));h={labels:P,[g]:A};break;default:throw new Error(`Task "${c}" (of type "${u}") not yet implemented.`)}return{[c]:h}}async _call(l,c=null,p={}){if(!l&&!c)throw new Error("Either text or images must be provided");const u=await this.image_processor(l,p),h=c?this.tokenizer(c,p):{};return{...u,...h}}}re(o,"tokenizer_class",n.AutoTokenizer),re(o,"image_processor_class",i.AutoImageProcessor)},"./src/models/glpn/image_processing_glpn.js":(e,r,t)=>{t.r(r),t.d(r,{GLPNFeatureExtractor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}},"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,r,t)=>{t.r(r),t.d(r,{GroundingDinoImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),i=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a){const l=await super._call(a),c=l.pixel_values.dims,p=(0,i.ones)([c[0],c[2],c[3]]);return{...l,pixel_mask:p}}}},"./src/models/grounding_dino/processing_grounding_dino.js":(e,r,t)=>{t.r(r),t.d(r,{GroundingDinoProcessor:()=>l});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),o=t("./src/base/image_processors_utils.js");function a(c,p){const h=c.dims.at(-1)-1,g=c.tolist();g.fill(!1,0,1),g.fill(!1,h);const _=p.tolist();return g.map((P,A)=>P?A:null).filter(P=>P!==null).map(P=>_[P])}class l extends s.Processor{async _call(p,u,h={}){const g=p?await this.image_processor(p,h):{};return{...u?this.tokenizer(u,h):{},...g}}post_process_grounded_object_detection(p,u,{box_threshold:h=.25,text_threshold:g=.25,target_sizes:_=null}={}){const{logits:P,pred_boxes:A}=p,v=P.dims[0];if(_!==null&&_.length!==v)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const y=P.dims.at(1),k=P.sigmoid(),E=k.max(-1).tolist(),M=A.tolist().map(x=>x.map($=>(0,o.center_to_corners_format)($))),w=[];for(let x=0;xU.map((Z,H)=>Z*$[(H+1)%2])));const z=E[x],R=[],Q=[],q=[];for(let U=0;U{t.r(r),t.d(r,{Idefics3ImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),i=t("./src/utils/tensor.js");class n extends s.ImageProcessor{constructor(a){super(a),this.do_image_splitting=a.do_image_splitting??!0,this.max_image_size=a.max_image_size}get_resize_for_vision_encoder(a,l){let[c,p]=a.dims.slice(-2);const u=p/c;return p>=c?(p=Math.ceil(p/l)*l,c=Math.floor(p/u),c=Math.ceil(c/l)*l):(c=Math.ceil(c/l)*l,p=Math.floor(c*u),p=Math.ceil(p/l)*l),{height:c,width:p}}async _call(a,{do_image_splitting:l=null,return_row_col_info:c=!1}={}){let p;if(!Array.isArray(a))p=[[a]];else{if(a.length===0||!a[0])throw new Error("No images provided.");Array.isArray(a[0])?p=a:p=[a]}let u=[],h=[],g=[];const _=[],P=[];for(const x of p){let $=await Promise.all(x.map(Q=>this.preprocess(Q)));_.push(...$.map(Q=>Q.original_size)),P.push(...$.map(Q=>Q.reshaped_input_size)),$.forEach(Q=>Q.pixel_values.unsqueeze_(0));const{longest_edge:z}=this.max_image_size;let R;if(l??this.do_image_splitting){let Q=new Array($.length),q=new Array($.length);R=await Promise.all($.map(async(U,Z)=>{const H=this.get_resize_for_vision_encoder(U.pixel_values,z),J=await(0,i.interpolate_4d)(U.pixel_values,{size:[H.height,H.width]}),{frames:ie,num_splits_h:ae,num_splits_w:ce}=await this.split_image(J,this.max_image_size);return Q[Z]=ae,q[Z]=ce,(0,i.cat)(ie,0)})),h.push(Q),g.push(q)}else{const Q=[z,z];R=await Promise.all($.map(q=>(0,i.interpolate_4d)(q.pixel_values,{size:Q}))),h.push(new Array($.length).fill(0)),g.push(new Array($.length).fill(0))}u.push((0,i.cat)(R,0))}const A=u.length,[v,y,k,E]=u[0].dims;let M,w;if(A===1)M=u[0].unsqueeze_(0),w=(0,i.full)([A,v,k,E],!0);else{const x=Math.max(...u.map(R=>R.dims.at(0)));w=(0,i.full)([A,x,k,E],!0);const $=w.data,z=x*k*E;for(let R=0;Rc||g>p){_=Math.ceil(h/c),P=Math.ceil(g/p);const A=Math.ceil(h/_),v=Math.ceil(g/P);for(let E=0;E<_;++E)for(let M=0;M{t.r(r),t.d(r,{Idefics3Processor:()=>p});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");var o=t("./src/utils/core.js");function a(u,h,g,_,P,A){let v="";for(let y=0;y`+P.repeat(u);v+=` -`}return v+=` -${_}${A}`+P.repeat(u)+`${_}`,v}function l(u,h,g,_){return`${h}${_}`+g.repeat(u)+`${h}`}function c(u,h,g,_,P,A){return u===0&&h===0?l(g,_,P,A):a(g,u,h,_,P,A)}class p extends s.Processor{constructor(){super(...arguments);re(this,"fake_image_token","");re(this,"image_token","");re(this,"global_img_token","")}async _call(g,_=null,P={}){P.return_row_col_info??(P.return_row_col_info=!0);let A;_&&(A=await this.image_processor(_,P)),Array.isArray(g)||(g=[g]);const v=A.rows??[new Array(g.length).fill(0)],y=A.cols??[new Array(g.length).fill(0)],k=this.config.image_seq_len,E=[],M=[];for(let x=0;xc(Z,R[H],k,this.fake_image_token,this.image_token,this.global_img_token)),q=$.split(this.image_token);if(q.length===0)throw new Error("The image token should be present in the text.");let U=q[0];for(let Z=0;Z{t.r(r),t.d(r,{BeitFeatureExtractor:()=>s.BeitFeatureExtractor,BitImageProcessor:()=>i.BitImageProcessor,CLIPFeatureExtractor:()=>o.CLIPFeatureExtractor,CLIPImageProcessor:()=>o.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>n.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>a.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>a.ConvNextImageProcessor,DPTFeatureExtractor:()=>u.DPTFeatureExtractor,DPTImageProcessor:()=>u.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>c.DetrFeatureExtractor,DetrImageProcessor:()=>c.DetrImageProcessor,DonutFeatureExtractor:()=>p.DonutFeatureExtractor,DonutImageProcessor:()=>p.DonutImageProcessor,EfficientNetImageProcessor:()=>h.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>g.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>_.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>P.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>v.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>y.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>k.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>E.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>E.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>M.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>M.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>w.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>w.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>x.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>x.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>$.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>$.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>z.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>z.MobileViTImageProcessor,NougatImageProcessor:()=>R.NougatImageProcessor,OwlViTFeatureExtractor:()=>q.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>q.OwlViTImageProcessor,Owlv2ImageProcessor:()=>Q.Owlv2ImageProcessor,Phi3VImageProcessor:()=>U.Phi3VImageProcessor,PvtImageProcessor:()=>Z.PvtImageProcessor,Qwen2VLImageProcessor:()=>H.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>J.RTDetrImageProcessor,SamImageProcessor:()=>ie.SamImageProcessor,SegformerFeatureExtractor:()=>ae.SegformerFeatureExtractor,SegformerImageProcessor:()=>ae.SegformerImageProcessor,SiglipImageProcessor:()=>ce.SiglipImageProcessor,SmolVLMImageProcessor:()=>he.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>N.Swin2SRImageProcessor,VLMImageProcessor:()=>A.VLMImageProcessor,ViTFeatureExtractor:()=>O.ViTFeatureExtractor,ViTImageProcessor:()=>O.ViTImageProcessor,VitMatteImageProcessor:()=>G.VitMatteImageProcessor,VitPoseImageProcessor:()=>se.VitPoseImageProcessor,YolosFeatureExtractor:()=>X.YolosFeatureExtractor,YolosImageProcessor:()=>X.YolosImageProcessor});var s=t("./src/models/beit/image_processing_beit.js"),i=t("./src/models/bit/image_processing_bit.js"),n=t("./src/models/chinese_clip/image_processing_chinese_clip.js"),o=t("./src/models/clip/image_processing_clip.js"),a=t("./src/models/convnext/image_processing_convnext.js"),l=t("./src/models/deit/image_processing_deit.js"),c=t("./src/models/detr/image_processing_detr.js"),p=t("./src/models/donut/image_processing_donut.js"),u=t("./src/models/dpt/image_processing_dpt.js"),h=t("./src/models/efficientnet/image_processing_efficientnet.js"),g=t("./src/models/glpn/image_processing_glpn.js"),_=t("./src/models/grounding_dino/image_processing_grounding_dino.js"),P=t("./src/models/idefics3/image_processing_idefics3.js"),A=t("./src/models/janus/image_processing_janus.js"),v=t("./src/models/jina_clip/image_processing_jina_clip.js"),y=t("./src/models/llava_onevision/image_processing_llava_onevision.js"),k=t("./src/models/mask2former/image_processing_mask2former.js"),E=t("./src/models/maskformer/image_processing_maskformer.js"),M=t("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),w=t("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),x=t("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),$=t("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),z=t("./src/models/mobilevit/image_processing_mobilevit.js"),R=t("./src/models/nougat/image_processing_nougat.js"),Q=t("./src/models/owlv2/image_processing_owlv2.js"),q=t("./src/models/owlvit/image_processing_owlvit.js"),U=t("./src/models/phi3_v/image_processing_phi3_v.js"),Z=t("./src/models/pvt/image_processing_pvt.js"),H=t("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),J=t("./src/models/rt_detr/image_processing_rt_detr.js"),ie=t("./src/models/sam/image_processing_sam.js"),ae=t("./src/models/segformer/image_processing_segformer.js"),ce=t("./src/models/siglip/image_processing_siglip.js"),he=t("./src/models/smolvlm/image_processing_smolvlm.js"),N=t("./src/models/swin2sr/image_processing_swin2sr.js"),O=t("./src/models/vit/image_processing_vit.js"),G=t("./src/models/vitmatte/image_processing_vitmatte.js"),se=t("./src/models/vitpose/image_processing_vitpose.js"),X=t("./src/models/yolos/image_processing_yolos.js")},"./src/models/janus/image_processing_janus.js":(e,r,t)=>{t.r(r),t.d(r,{VLMImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{constructor(o){super({do_pad:!0,pad_size:{width:o.image_size,height:o.image_size},...o}),this.constant_values=this.config.background_color.map(a=>a*this.rescale_factor)}pad_image(o,a,l,c){return super.pad_image(o,a,l,{constant_values:this.constant_values,center:!0,...c})}}},"./src/models/janus/processing_janus.js":(e,r,t)=>{t.r(r),t.d(r,{VLChatProcessor:()=>c});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),o=t("./src/utils/core.js"),a=t("./src/utils/tensor.js"),l=t("./src/utils/image.js");class c extends s.Processor{constructor(u,h){super(u,h),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(u,{images:h=null,chat_template:g="default"}={}){h?Array.isArray(h)||(h=[h]):h=await Promise.all(u.filter(R=>R.images).flatMap(R=>R.images).map(R=>l.RawImage.read(R)));const _=this.tokenizer,P=_.apply_chat_template(u,{tokenize:!1,add_generation_prompt:!0,chat_template:g}),A=R=>_.encode(R,{add_special_tokens:!1}),v=P.split(this.image_tag),y=v.length-1;if(h.length!==y)throw new Error(`Number of images provided (${h.length}) does not match number of "${this.image_tag}" image tags (${y})`);const[k,E,M]=_.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]);let w=A(v[0]),x=new Array(w.length).fill(!1);for(let R=1;R0){const R=await this.image_processor(h);return R.pixel_values.unsqueeze_(0),{...z,...R}}return z}}re(c,"image_processor_class",i.AutoImageProcessor),re(c,"tokenizer_class",n.AutoTokenizer),re(c,"uses_processor_config",!0)},"./src/models/jina_clip/image_processing_jina_clip.js":(e,r,t)=>{t.r(r),t.d(r,{JinaCLIPImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{constructor(o){const{resize_mode:a,fill_color:l,interpolation:c,size:p,...u}=o,h=a==="squash"?{width:p,height:p}:a==="shortest"?{shortest_edge:p}:{longest_edge:p},g=c==="bicubic"?3:2;super({...u,size:h,resample:g,do_center_crop:!0,crop_size:p,do_normalize:!0})}}},"./src/models/jina_clip/processing_jina_clip.js":(e,r,t)=>{t.r(r),t.d(r,{JinaCLIPProcessor:()=>o});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class o extends s.Processor{async _call(l=null,c=null,p={}){if(!l&&!c)throw new Error("Either text or images must be provided");const u=l?this.tokenizer(l,p):{},h=c?await this.image_processor(c,p):{};return{...u,...h}}}re(o,"tokenizer_class",n.AutoTokenizer),re(o,"image_processor_class",i.AutoImageProcessor)},"./src/models/llava_onevision/image_processing_llava_onevision.js":(e,r,t)=>{t.r(r),t.d(r,{LlavaOnevisionImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}},"./src/models/mask2former/image_processing_mask2former.js":(e,r,t)=>{t.r(r),t.d(r,{Mask2FormerImageProcessor:()=>i});var s=t("./src/models/maskformer/image_processing_maskformer.js");class i extends s.MaskFormerImageProcessor{}},"./src/models/maskformer/image_processing_maskformer.js":(e,r,t)=>{t.r(r),t.d(r,{MaskFormerFeatureExtractor:()=>n,MaskFormerImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{post_process_panoptic_segmentation(...a){return(0,s.post_process_panoptic_segmentation)(...a)}post_process_instance_segmentation(...a){return(0,s.post_process_instance_segmentation)(...a)}}class n extends i{}},"./src/models/mgp_str/processing_mgp_str.js":(e,r,t)=>{t.r(r),t.d(r,{MgpstrProcessor:()=>l});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),o=t("./src/utils/maths.js");const a={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends s.Processor{get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(p,u){if(!a.hasOwnProperty(u))throw new Error(`Format ${u} is not supported.`);const[h,g]=a[u],_=this[h].bind(this),[P,A]=p.dims,v=[],y=[],k=p.tolist();for(let M=0;M0?$.reduce((R,Q)=>R*Q,1):0;y.push(x),v.push(z)}return[_(y),v]}char_decode(p){return this.char_tokenizer.batch_decode(p).map(u=>u.replaceAll(" ",""))}bpe_decode(p){return this.bpe_tokenizer.batch_decode(p)}wp_decode(p){return this.wp_tokenizer.batch_decode(p).map(u=>u.replaceAll(" ",""))}batch_decode([p,u,h]){const[g,_]=this._decode_helper(p,"char"),[P,A]=this._decode_helper(u,"bpe"),[v,y]=this._decode_helper(h,"wp"),k=[],E=[];for(let M=0;M{t.r(r),t.d(r,{MobileNetV1FeatureExtractor:()=>n,MobileNetV1ImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV2FeatureExtractor:()=>n,MobileNetV2ImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV3FeatureExtractor:()=>n,MobileNetV3ImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV4FeatureExtractor:()=>n,MobileNetV4ImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/mobilevit/image_processing_mobilevit.js":(e,r,t)=>{t.r(r),t.d(r,{MobileViTFeatureExtractor:()=>n,MobileViTImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/moonshine/feature_extraction_moonshine.js":(e,r,t)=>{t.r(r),t.d(r,{MoonshineFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),i=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(a){(0,s.validate_audio_inputs)(a,"MoonshineFeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));const l=[1,a.length];return{input_values:new i.Tensor("float32",a,l)}}}},"./src/models/moonshine/processing_moonshine.js":(e,r,t)=>{t.r(r),t.d(r,{MoonshineProcessor:()=>o});var s=t("./src/models/auto/feature_extraction_auto.js"),i=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class o extends n.Processor{async _call(l){return await this.feature_extractor(l)}}re(o,"tokenizer_class",i.AutoTokenizer),re(o,"feature_extractor_class",s.AutoFeatureExtractor)},"./src/models/nougat/image_processing_nougat.js":(e,r,t)=>{t.r(r),t.d(r,{NougatImageProcessor:()=>i});var s=t("./src/models/donut/image_processing_donut.js");class i extends s.DonutImageProcessor{}},"./src/models/owlv2/image_processing_owlv2.js":(e,r,t)=>{t.r(r),t.d(r,{Owlv2ImageProcessor:()=>i});var s=t("./src/models/owlvit/image_processing_owlvit.js");class i extends s.OwlViTImageProcessor{}},"./src/models/owlvit/image_processing_owlvit.js":(e,r,t)=>{t.r(r),t.d(r,{OwlViTFeatureExtractor:()=>n,OwlViTImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{post_process_object_detection(...a){return(0,s.post_process_object_detection)(...a)}}class n extends i{}},"./src/models/owlvit/processing_owlvit.js":(e,r,t)=>{t.r(r),t.d(r,{OwlViTProcessor:()=>o});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class o extends s.Processor{}re(o,"tokenizer_class",n.AutoTokenizer),re(o,"image_processor_class",i.AutoImageProcessor)},"./src/models/paligemma/processing_paligemma.js":(e,r,t)=>{t.r(r),t.d(r,{PaliGemmaProcessor:()=>l});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");const o="";function a(c,p,u,h,g){return`${h.repeat(u*g)}${p}${c} -`}class l extends s.Processor{async _call(p,u=null,h={}){u||(console.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),u=""),Array.isArray(p)||(p=[p]),Array.isArray(u)||(u=[u]);const g=this.tokenizer.bos_token,_=this.image_processor.config.image_seq_length;let P;u.some(y=>y.includes(o))?P=u.map(y=>{const k=y.replaceAll(o,o.repeat(_)),E=k.lastIndexOf(o),M=E===-1?0:E+o.length;return k.slice(0,M)+g+k.slice(M)+` -`}):(console.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),P=u.map(y=>a(y,g,_,o,p.length)));const A=this.tokenizer(P,h);return{...await this.image_processor(p,h),...A}}}re(l,"tokenizer_class",n.AutoTokenizer),re(l,"image_processor_class",i.AutoImageProcessor),re(l,"uses_processor_config",!1)},"./src/models/phi3_v/image_processing_phi3_v.js":(e,r,t)=>{t.r(r),t.d(r,{Phi3VImageProcessor:()=>p});var s=t("./src/base/image_processors_utils.js"),i=t("./src/utils/tensor.js");const n=336,o=[2,3],{ceil:a,floor:l,sqrt:c}=Math;class p extends s.ImageProcessor{constructor(h){super({...h,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=h.num_crops}calc_num_image_tokens_from_image_size(h,g){const{num_img_tokens:_}=this.config;return l((l(g/n)*l(h/n)+1)*_+1+(l(g/n)+1)*c(_))}get_resize_output_image_size(h,g){const _=this._num_crops,[P,A]=h.size;let v=P/A,y=1;for(;y*Math.ceil(y/v)<=_;)y+=1;y-=1;const k=Math.floor(y*336),E=Math.floor(k/v);return[k,E]}pad_image(h,g,_,P={}){const[A,v]=g,y=n*a(A/n),k=n*a(v/n),E=[1,1,1].map((M,w)=>(M-this.image_mean[w])/this.image_std[w]);return super.pad_image(h,g,{width:k,height:y},{center:!0,constant_values:E,...P})}async _call(h,{num_crops:g=null}={}){if(this._num_crops=g??(g=this.config.num_crops),g<4||c(g)%1!==0)throw new Error("num_crops must be a square number >= 4");Array.isArray(h)||(h=[h]);const _=h.length,P=await Promise.all(h.map(x=>this.preprocess(x))),A=P.map(x=>x.original_size),v=P.map(x=>x.reshaped_input_size),y=[];for(const{pixel_values:x}of P){x.unsqueeze_(0);const[$,z]=x.dims.slice(-2),R=await(0,i.interpolate_4d)(x,{size:[n,n],mode:"bicubic"});if(g>0){const Q=[],q=c(g),U=l(z/q),Z=l($/q);for(let J=0;Jx.map($=>n*a($/n))),M=new i.Tensor("int64",E.flat(),[_,2]),w=E.map(([x,$])=>this.calc_num_image_tokens_from_image_size($,x));return{pixel_values:k,original_sizes:A,reshaped_input_sizes:v,image_sizes:M,num_img_tokens:w}}}},"./src/models/phi3_v/processing_phi3_v.js":(e,r,t)=>{t.r(r),t.d(r,{Phi3VProcessor:()=>l});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");const o="<|image|>",a=/<\|image_\d+\|>/g;class l extends s.Processor{async _call(p,u=null,{padding:h=!0,truncation:g=!0,num_crops:_=null}={}){Array.isArray(p)||(p=[p]);let P,A;if(u){A=await this.image_processor(u,{num_crops:_});const{num_img_tokens:v}=A,y=p.map((E,M)=>E.split(a).join(o.repeat(v[M])));P=this.tokenizer(y,{padding:h,truncation:g});const k=this.tokenizer.model.convert_tokens_to_ids([o])[0];P.input_ids.map_(E=>E==k?-E:E)}else P=this.tokenizer(p);return{...P,...A}}}re(l,"image_processor_class",i.AutoImageProcessor),re(l,"tokenizer_class",n.AutoTokenizer)},"./src/models/processors.js":(e,r,t)=>{t.r(r),t.d(r,{Florence2Processor:()=>s.Florence2Processor,GroundingDinoProcessor:()=>i.GroundingDinoProcessor,Idefics3Processor:()=>n.Idefics3Processor,JinaCLIPProcessor:()=>a.JinaCLIPProcessor,MgpstrProcessor:()=>l.MgpstrProcessor,MoonshineProcessor:()=>c.MoonshineProcessor,OwlViTProcessor:()=>p.OwlViTProcessor,PaliGemmaProcessor:()=>h.PaliGemmaProcessor,Phi3VProcessor:()=>u.Phi3VProcessor,PyAnnoteProcessor:()=>g.PyAnnoteProcessor,Qwen2VLProcessor:()=>_.Qwen2VLProcessor,SamProcessor:()=>P.SamProcessor,SmolVLMProcessor:()=>A.SmolVLMProcessor,SpeechT5Processor:()=>v.SpeechT5Processor,UltravoxProcessor:()=>y.UltravoxProcessor,VLChatProcessor:()=>o.VLChatProcessor,Wav2Vec2Processor:()=>k.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>E.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>M.WhisperProcessor});var s=t("./src/models/florence2/processing_florence2.js"),i=t("./src/models/grounding_dino/processing_grounding_dino.js"),n=t("./src/models/idefics3/processing_idefics3.js"),o=t("./src/models/janus/processing_janus.js"),a=t("./src/models/jina_clip/processing_jina_clip.js"),l=t("./src/models/mgp_str/processing_mgp_str.js"),c=t("./src/models/moonshine/processing_moonshine.js"),p=t("./src/models/owlvit/processing_owlvit.js"),u=t("./src/models/phi3_v/processing_phi3_v.js"),h=t("./src/models/paligemma/processing_paligemma.js"),g=t("./src/models/pyannote/processing_pyannote.js"),_=t("./src/models/qwen2_vl/processing_qwen2_vl.js"),P=t("./src/models/sam/processing_sam.js"),A=t("./src/models/smolvlm/processing_smolvlm.js"),v=t("./src/models/speecht5/processing_speecht5.js"),y=t("./src/models/ultravox/processing_ultravox.js"),k=t("./src/models/wav2vec2/processing_wav2vec2.js"),E=t("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),M=t("./src/models/whisper/processing_whisper.js")},"./src/models/pvt/image_processing_pvt.js":(e,r,t)=>{t.r(r),t.d(r,{PvtImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}},"./src/models/pyannote/feature_extraction_pyannote.js":(e,r,t)=>{t.r(r),t.d(r,{PyAnnoteFeatureExtractor:()=>o});var s=t("./src/base/feature_extraction_utils.js"),i=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");class o extends s.FeatureExtractor{async _call(l){(0,s.validate_audio_inputs)(l,"PyAnnoteFeatureExtractor"),l instanceof Float64Array&&(l=new Float32Array(l));const c=[1,1,l.length];return{input_values:new i.Tensor("float32",l,c)}}samples_to_frames(l){return(l-this.config.offset)/this.config.step}post_process_speaker_diarization(l,c){const p=c/this.samples_to_frames(c)/this.config.sampling_rate,u=[];for(const h of l.tolist()){const g=[];let _=-1;for(let P=0;P({id:P,start:A*p,end:v*p,confidence:y/(v-A)})))}return u}}},"./src/models/pyannote/processing_pyannote.js":(e,r,t)=>{t.r(r),t.d(r,{PyAnnoteProcessor:()=>n});var s=t("./src/base/processing_utils.js"),i=t("./src/models/pyannote/feature_extraction_pyannote.js");class n extends s.Processor{async _call(a){return await this.feature_extractor(a)}post_process_speaker_diarization(...a){return this.feature_extractor.post_process_speaker_diarization(...a)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}}re(n,"feature_extractor_class",i.PyAnnoteFeatureExtractor)},"./src/models/qwen2_vl/image_processing_qwen2_vl.js":(e,r,t)=>{t.r(r),t.d(r,{Qwen2VLImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),i=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a,...l){const{pixel_values:c,original_sizes:p,reshaped_input_sizes:u}=await super._call(a,...l);let h=c;const{temporal_patch_size:g,merge_size:_,patch_size:P}=this.config;h.dims[0]===1&&(h=(0,i.cat)(Array.from({length:g},()=>h),0));const A=h.dims[0]/g,v=h.dims[1],y=Math.floor(h.dims[2]/P),k=Math.floor(h.dims[3]/P),E=h.view(A,g,v,Math.floor(y/_),_,P,Math.floor(k/_),_,P).permute(0,3,6,4,7,2,1,5,8).view(A*y*k,v*g*P*P),M=new i.Tensor("int64",[A,y,k],[1,3]);return{pixel_values:E,image_grid_thw:M,original_sizes:p,reshaped_input_sizes:u}}}},"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,r,t)=>{t.r(r),t.d(r,{Qwen2VLProcessor:()=>o});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");class o extends s.Processor{async _call(l,c=null,...p){Array.isArray(l)||(l=[l]);let u,h;if(c&&(u=await this.image_processor(c),h=u.image_grid_thw),h){let _=this.image_processor.config.merge_size**2,P=0;const A=h.tolist();l=l.map(v=>{for(;v.includes("<|image_pad|>");){const y=Number(A[P++].reduce((k,E)=>k*E,1n));v=v.replace("<|image_pad|>","<|placeholder|>".repeat(Math.floor(y/_)))}return v.replaceAll("<|placeholder|>","<|image_pad|>")})}return{...this.tokenizer(l),...u}}}re(o,"image_processor_class",i.AutoImageProcessor),re(o,"tokenizer_class",n.AutoTokenizer)},"./src/models/rt_detr/image_processing_rt_detr.js":(e,r,t)=>{t.r(r),t.d(r,{RTDetrImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{post_process_object_detection(...o){return(0,s.post_process_object_detection)(...o)}}},"./src/models/sam/image_processing_sam.js":(e,r,t)=>{t.r(r),t.d(r,{SamImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js"),i=t("./src/utils/core.js"),n=t("./src/utils/tensor.js");class o extends s.ImageProcessor{reshape_input_points(l,c,p,u=!1){l=structuredClone(l);let h=(0,i.calculateDimensions)(l);if(h.length===3)u||(h=[1,...h]),l=[l];else if(h.length!==4)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let g=0;gu!==c.dims[h]))throw Error(`The first ${p.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new n.Tensor("int64",l.flat(1/0).map(BigInt),p)}async _call(l,{input_points:c=null,input_labels:p=null,input_boxes:u=null}={}){const h=await super._call(l);if(c&&(h.input_points=this.reshape_input_points(c,h.original_sizes,h.reshaped_input_sizes)),p){if(!h.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");h.input_labels=this.add_input_labels(p,h.input_points)}return u&&(h.input_boxes=this.reshape_input_points(u,h.original_sizes,h.reshaped_input_sizes,!0)),h}async post_process_masks(l,c,p,{mask_threshold:u=0,binarize:h=!0,pad_size:g=null}={}){const _=[];g=g??this.pad_size;const P=[g.height,g.width];for(let A=0;Au&&(M[w]=1);k=new n.Tensor("bool",M,k.dims)}_.push(k)}return _}generate_crop_boxes(l,c,{crop_n_layers:p=0,overlap_ratio:u=512/1500,points_per_crop:h=32,crop_n_points_downscale_factor:g=1}={}){}}},"./src/models/sam/processing_sam.js":(e,r,t)=>{t.r(r),t.d(r,{SamProcessor:()=>n});var s=t("./src/base/processing_utils.js"),i=t("./src/models/auto/image_processing_auto.js");class n extends s.Processor{async _call(...a){return await this.image_processor(...a)}post_process_masks(...a){return this.image_processor.post_process_masks(...a)}reshape_input_points(...a){return this.image_processor.reshape_input_points(...a)}}re(n,"image_processor_class",i.AutoImageProcessor)},"./src/models/seamless_m4t/feature_extraction_seamless_m4t.js":(e,r,t)=>{t.r(r),t.d(r,{SeamlessM4TFeatureExtractor:()=>o});var s=t("./src/base/feature_extraction_utils.js"),i=t("./src/utils/tensor.js"),n=t("./src/utils/audio.js");class o extends s.FeatureExtractor{constructor(l){super(l);const c=this.config.sampling_rate,p=(0,n.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(c/2),c,null,"kaldi",!0);for(let u=0;up*32768),(0,n.spectrogram)(l,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:c,transpose:!0})}async _call(l,{padding:c=!0,pad_to_multiple_of:p=2,do_normalize_per_mel_bins:u=!0,return_attention_mask:h=!0}={}){(0,s.validate_audio_inputs)(l,"SeamlessM4TFeatureExtractor");let g=await this._extract_fbank_features(l,this.config.max_length);if(u){const[M,w]=g.dims,x=g.data;for(let $=0;$0){const z=new Float32Array(w*(M+$));z.set(x),z.fill(this.config.padding_value,x.length);const R=M+$;g=new i.Tensor(g.type,z,[R,w]),h&&(_=new i.Tensor("int64",new BigInt64Array(R),[1,R]),_.data.fill(1n,0,M))}}const[P,A]=g.dims,v=this.config.stride;if(P%v!==0)throw new Error(`The number of frames (${P}) must be a multiple of the stride (${v}).`);const k=g.view(1,Math.floor(P/v),A*v),E={input_features:k};if(h){const M=k.dims[1],w=new BigInt64Array(M);if(_){const x=_.data;for(let $=1,z=0;${t.r(r),t.d(r,{SegformerFeatureExtractor:()=>n,SegformerImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{post_process_semantic_segmentation(...a){return(0,s.post_process_semantic_segmentation)(...a)}}class n extends i{}},"./src/models/siglip/image_processing_siglip.js":(e,r,t)=>{t.r(r),t.d(r,{SiglipImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}},"./src/models/smolvlm/image_processing_smolvlm.js":(e,r,t)=>{t.r(r),t.d(r,{SmolVLMImageProcessor:()=>s.Idefics3ImageProcessor});var s=t("./src/models/idefics3/image_processing_idefics3.js")},"./src/models/smolvlm/processing_smolvlm.js":(e,r,t)=>{t.r(r),t.d(r,{SmolVLMProcessor:()=>s.Idefics3Processor});var s=t("./src/models/idefics3/processing_idefics3.js")},"./src/models/snac/feature_extraction_snac.js":(e,r,t)=>{t.r(r),t.d(r,{SnacFeatureExtractor:()=>i});var s=t("./src/models/dac/feature_extraction_dac.js");class i extends s.DacFeatureExtractor{}},"./src/models/speecht5/feature_extraction_speecht5.js":(e,r,t)=>{t.r(r),t.d(r,{SpeechT5FeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js");class i extends s.FeatureExtractor{}},"./src/models/speecht5/processing_speecht5.js":(e,r,t)=>{t.r(r),t.d(r,{SpeechT5Processor:()=>o});var s=t("./src/base/processing_utils.js"),i=t("./src/tokenizers.js"),n=t("./src/models/auto/feature_extraction_auto.js");class o extends s.Processor{async _call(l){return await this.feature_extractor(l)}}re(o,"tokenizer_class",i.AutoTokenizer),re(o,"feature_extractor_class",n.AutoFeatureExtractor)},"./src/models/swin2sr/image_processing_swin2sr.js":(e,r,t)=>{t.r(r),t.d(r,{Swin2SRImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{pad_image(o,a,l,c={}){const[p,u,h]=a;return super.pad_image(o,a,{width:u+(l-u%l)%l,height:p+(l-p%l)%l},{mode:"symmetric",center:!1,constant_values:-1,...c})}}},"./src/models/ultravox/processing_ultravox.js":(e,r,t)=>{t.r(r),t.d(r,{UltravoxProcessor:()=>o});var s=t("./src/models/auto/feature_extraction_auto.js"),i=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class o extends n.Processor{async _call(l,c=null,p={}){if(Array.isArray(l))throw new Error("Batched inputs are not supported yet.");let u={};if(c){const g=c.length,{input_features:_}=await this.feature_extractor(c,{...p,max_length:g}),P=Math.round(g/this.config.encoder_ds_factor+1e-4),A=1+Math.ceil(P/this.config.stack_factor);u.audio_token_len=[A],u.audio_values=_;const v=this.config.audio_placeholder;if(!l.includes(v))throw new Error(`The input text does not contain the image token ${v}.`);l=l.replaceAll(v,v.repeat(A))}return{...this.tokenizer(l,{add_special_tokens:!1,...p}),...u}}}re(o,"tokenizer_class",i.AutoTokenizer),re(o,"feature_extractor_class",s.AutoFeatureExtractor),re(o,"uses_processor_config",!0)},"./src/models/vit/image_processing_vit.js":(e,r,t)=>{t.r(r),t.d(r,{ViTFeatureExtractor:()=>n,ViTImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{}class n extends i{}},"./src/models/vitmatte/image_processing_vitmatte.js":(e,r,t)=>{t.r(r),t.d(r,{VitMatteImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),i=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a,l){Array.isArray(a)||(a=[a]),Array.isArray(l)||(l=[l]);const c=await Promise.all(a.map(h=>this.preprocess(h))),p=await Promise.all(l.map(h=>this.preprocess(h,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,i.stack)(c.map((h,g)=>(0,i.cat)([h.pixel_values,p[g].pixel_values],0)),0),original_sizes:c.map(h=>h.original_size),reshaped_input_sizes:c.map(h=>h.reshaped_input_size)}}}},"./src/models/vitpose/image_processing_vitpose.js":(e,r,t)=>{t.r(r),t.d(r,{VitPoseImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{post_process_pose_estimation(o,a,{threshold:l=null}={}){const c=o.tolist(),[p,u,h,g]=o.dims,_=[];for(let P=0;P{t.r(r),t.d(r,{Wav2Vec2FeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),i=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{_zero_mean_unit_var_norm(a){const c=a.reduce((u,h)=>u+h,0)/a.length,p=a.reduce((u,h)=>u+(h-c)**2,0)/a.length;return a.map(u=>(u-c)/Math.sqrt(p+1e-7))}async _call(a){(0,s.validate_audio_inputs)(a,"Wav2Vec2FeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));let l=a;this.config.do_normalize&&(l=this._zero_mean_unit_var_norm(l));const c=[1,l.length];return{input_values:new i.Tensor("float32",l,c),attention_mask:new i.Tensor("int64",new BigInt64Array(l.length).fill(1n),c)}}}},"./src/models/wav2vec2/processing_wav2vec2.js":(e,r,t)=>{t.r(r),t.d(r,{Wav2Vec2Processor:()=>o});var s=t("./src/tokenizers.js"),i=t("./src/models/auto/feature_extraction_auto.js"),n=t("./src/base/processing_utils.js");class o extends n.Processor{async _call(l){return await this.feature_extractor(l)}}re(o,"tokenizer_class",s.AutoTokenizer),re(o,"feature_extractor_class",i.AutoFeatureExtractor)},"./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js":(e,r,t)=>{t.r(r),t.d(r,{Wav2Vec2ProcessorWithLM:()=>o});var s=t("./src/tokenizers.js"),i=t("./src/models/auto/feature_extraction_auto.js"),n=t("./src/base/processing_utils.js");class o extends n.Processor{async _call(l){return await this.feature_extractor(l)}}re(o,"tokenizer_class",s.AutoTokenizer),re(o,"feature_extractor_class",i.AutoFeatureExtractor)},"./src/models/wespeaker/feature_extraction_wespeaker.js":(e,r,t)=>{t.r(r),t.d(r,{WeSpeakerFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var i=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a);const l=this.config.sampling_rate,c=(0,i.mel_filter_bank)(256,this.config.num_mel_bins,20,Math.floor(l/2),l,null,"kaldi",!0);for(let p=0;pl*32768),(0,i.spectrogram)(a,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(a){(0,s.validate_audio_inputs)(a,"WeSpeakerFeatureExtractor");const l=(await this._extract_fbank_features(a)).unsqueeze_(0);if(this.config.fbank_centering_span===null){const c=l.mean(1).data,p=l.data,[u,h,g]=l.dims;for(let _=0;_{t.r(r),t.d(r,{WHISPER_LANGUAGE_MAPPING:()=>i,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>n,whisper_language_to_code:()=>o});const s=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],i=new Map(s),n=new Map([...s.map(([a,l])=>[l,a]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function o(a){a=a.toLowerCase();let l=n.get(a);if(l===void 0){const c=a.match(/^<\|([a-z]{2})\|>$/);if(c&&(a=c[1]),i.has(a))l=a;else{const u=a.length===2?i.keys():i.values();throw new Error(`Language "${a}" is not supported. Must be one of: ${JSON.stringify(Array.from(u))}`)}}return l}},"./src/models/whisper/feature_extraction_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperFeatureExtractor:()=>o});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var i=t("./src/utils/audio.js"),n=t("./src/utils/maths.js");class o extends s.FeatureExtractor{constructor(l){var c;super(l),(c=this.config).mel_filters??(c.mel_filters=(0,i.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney")),this.window=(0,i.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(l){const c=await(0,i.spectrogram)(l,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:Math.min(Math.floor(l.length/this.config.hop_length),this.config.nb_max_frames)}),p=c.data,u=(0,n.max)(p)[0];for(let h=0;hu?(l.length>this.config.n_samples&&console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),p=l.slice(0,u)):(p=new Float32Array(u),p.set(l)),{input_features:(await this._extract_fbank_features(p)).unsqueeze_(0)}}}},"./src/models/whisper/generation_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperGenerationConfig:()=>i});var s=t("./src/generation/configuration_utils.js");class i extends s.GenerationConfig{constructor(){super(...arguments);re(this,"return_timestamps",null);re(this,"return_token_timestamps",null);re(this,"num_frames",null);re(this,"alignment_heads",null);re(this,"task",null);re(this,"language",null);re(this,"no_timestamps_token_id",null);re(this,"prompt_ids",null);re(this,"is_multilingual",null);re(this,"lang_to_id",null);re(this,"task_to_id",null);re(this,"max_initial_timestamp_index",1)}}},"./src/models/whisper/processing_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperProcessor:()=>o});var s=t("./src/models/auto/feature_extraction_auto.js"),i=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class o extends n.Processor{async _call(l){return await this.feature_extractor(l)}}re(o,"tokenizer_class",i.AutoTokenizer),re(o,"feature_extractor_class",s.AutoFeatureExtractor)},"./src/models/yolos/image_processing_yolos.js":(e,r,t)=>{t.r(r),t.d(r,{YolosFeatureExtractor:()=>n,YolosImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js");class i extends s.ImageProcessor{post_process_object_detection(...a){return(0,s.post_process_object_detection)(...a)}}class n extends i{}},"./src/ops/registry.js":(e,r,t)=>{t.r(r),t.d(r,{TensorOpRegistry:()=>l});var s=t("./src/backends/onnx.js"),i=t("./src/utils/tensor.js"),n=t("./src/env.js");const o=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV,a=async(c,p,u)=>{const h=await(0,s.createInferenceSession)(new Uint8Array(c),p);let g=Promise.resolve();return async _=>{const P=(0,s.isONNXProxy)(),A=Object.fromEntries(Object.entries(_).map(([y,k])=>[y,(P?k.clone():k).ort_tensor])),v=await(g=o?g.then(()=>h.run(A)):h.run(A));return Array.isArray(u)?u.map(y=>new i.Tensor(v[y])):new i.Tensor(v[u])}};class l{static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=a([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=a([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=a([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=a([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=a([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=a([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=a([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=a([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}}re(l,"session_options",{})},"./src/pipelines.js":(e,r,t)=>{t.r(r),t.d(r,{AudioClassificationPipeline:()=>q,AutomaticSpeechRecognitionPipeline:()=>Z,BackgroundRemovalPipeline:()=>ae,DepthEstimationPipeline:()=>X,DocumentQuestionAnsweringPipeline:()=>O,FeatureExtractionPipeline:()=>R,FillMaskPipeline:()=>k,ImageClassificationPipeline:()=>J,ImageFeatureExtractionPipeline:()=>Q,ImageSegmentationPipeline:()=>ie,ImageToImagePipeline:()=>se,ImageToTextPipeline:()=>H,ObjectDetectionPipeline:()=>he,Pipeline:()=>P,QuestionAnsweringPipeline:()=>y,SummarizationPipeline:()=>M,Text2TextGenerationPipeline:()=>E,TextClassificationPipeline:()=>A,TextGenerationPipeline:()=>$,TextToAudioPipeline:()=>G,TokenClassificationPipeline:()=>v,TranslationPipeline:()=>w,ZeroShotAudioClassificationPipeline:()=>U,ZeroShotClassificationPipeline:()=>z,ZeroShotImageClassificationPipeline:()=>ce,ZeroShotObjectDetectionPipeline:()=>N,pipeline:()=>ke});var s=t("./src/tokenizers.js"),i=t("./src/models.js"),n=t("./src/models/auto/processing_auto.js");t("./src/base/processing_utils.js");var o=t("./src/utils/generic.js"),a=t("./src/utils/core.js"),l=t("./src/utils/maths.js"),c=t("./src/utils/audio.js"),p=t("./src/utils/tensor.js"),u=t("./src/utils/image.js");async function h(Me){return Array.isArray(Me)||(Me=[Me]),await Promise.all(Me.map(K=>u.RawImage.read(K)))}async function g(Me,K){return Array.isArray(Me)||(Me=[Me]),await Promise.all(Me.map(j=>typeof j=="string"||j instanceof URL?(0,c.read_audio)(j,K):j instanceof Float64Array?new Float32Array(j):j))}function _(Me,K){K&&(Me=Me.map(Ae=>Ae|0));const[j,me,Pe,xe]=Me;return{xmin:j,ymin:me,xmax:Pe,ymax:xe}}class P extends o.Callable{constructor({task:K,model:j,tokenizer:me=null,processor:Pe=null}){super(),this.task=K,this.model=j,this.tokenizer=me,this.processor=Pe}async dispose(){await this.model.dispose()}}class A extends P{constructor(K){super(K)}async _call(K,{top_k:j=1}={}){const me=this.tokenizer(K,{padding:!0,truncation:!0}),Pe=await this.model(me),xe=this.model.config.problem_type==="multi_label_classification"?Le=>Le.sigmoid():Le=>new p.Tensor("float32",(0,l.softmax)(Le.data),Le.dims),Ae=this.model.config.id2label,Ie=[];for(const Le of Pe.logits){const Ne=xe(Le),We=await(0,p.topk)(Ne,j),D=We[0].tolist(),B=We[1].tolist().map((te,de)=>({label:Ae?Ae[te]:`LABEL_${te}`,score:D[de]}));j===1?Ie.push(...B):Ie.push(B)}return Array.isArray(K)||j===1?Ie:Ie[0]}}class v extends P{constructor(K){super(K)}async _call(K,{ignore_labels:j=["O"]}={}){const me=Array.isArray(K),Pe=this.tokenizer(me?K:[K],{padding:!0,truncation:!0}),Ae=(await this.model(Pe)).logits,Ie=this.model.config.id2label,Le=[];for(let Ne=0;NeFe==this.tokenizer.sep_token_id);Le[D].map((Fe,je)=>Fe==1&&(je===0||je>B&&Ne.findIndex(qe=>qe==ee[je])===-1));const te=xe[D].tolist(),de=Ae[D].tolist();for(let Fe=1;Feje==ee[Fe])!==-1)&&(te[Fe]=-1/0,de[Fe]=-1/0);const be=(0,l.softmax)(te).map((Fe,je)=>[Fe,je]),ve=(0,l.softmax)(de).map((Fe,je)=>[Fe,je]);be[0][0]=0,ve[0][0]=0;const Re=(0,a.product)(be,ve).filter(Fe=>Fe[0][1]<=Fe[1][1]).map(Fe=>[Fe[0][1],Fe[1][1],Fe[0][0]*Fe[1][0]]).sort((Fe,je)=>je[2]-Fe[2]);for(let Fe=0;Fete==this.tokenizer.mask_token_id);if(Ne===-1)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);const We=Pe[Ie][Ne],D=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(We.data),We.dims),j),ee=D[0].tolist(),B=D[1].tolist();xe.push(B.map((te,de)=>{const be=Le.slice();return be[Ne]=te,{score:ee[de],token:Number(te),token_str:this.tokenizer.decode([te]),sequence:this.tokenizer.decode(be,{skip_special_tokens:!0})}}))}return Array.isArray(K)?xe:xe[0]}}class E extends P{constructor(j){super(j);re(this,"_key","generated_text")}async _call(j,me={}){Array.isArray(j)||(j=[j]),this.model.config.prefix&&(j=j.map(Ne=>this.model.config.prefix+Ne));const Pe=this.model.config.task_specific_params;Pe&&Pe[this.task]&&Pe[this.task].prefix&&(j=j.map(Ne=>Pe[this.task].prefix+Ne));const xe=this.tokenizer,Ae={padding:!0,truncation:!0};let Ie;this instanceof w&&"_build_translation_inputs"in xe?Ie=xe._build_translation_inputs(j,Ae,me):Ie=xe(j,Ae);const Le=await this.model.generate({...Ie,...me});return xe.batch_decode(Le,{skip_special_tokens:!0}).map(Ne=>({[this._key]:Ne}))}}class M extends E{constructor(j){super(j);re(this,"_key","summary_text")}}class w extends E{constructor(j){super(j);re(this,"_key","translation_text")}}function x(Me){return Array.isArray(Me)&&Me.every(K=>"role"in K&&"content"in K)}class $ extends P{constructor(K){super(K)}async _call(K,j={}){let me=!1,Pe=!1,xe;if(typeof K=="string")xe=K=[K];else if(Array.isArray(K)&&K.every(B=>typeof B=="string"))me=!0,xe=K;else{if(x(K))K=[K];else if(Array.isArray(K)&&K.every(x))me=!0;else throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");Pe=!0,xe=K.map(B=>this.tokenizer.apply_chat_template(B,{tokenize:!1,add_generation_prompt:!0}))}const Ae=j.add_special_tokens??!1,Ie=Pe?!1:j.return_full_text??!0;this.tokenizer.padding_side="left";const Le=this.tokenizer(xe,{add_special_tokens:Ae,padding:!0,truncation:!0}),Ne=await this.model.generate({...Le,...j}),We=this.tokenizer.batch_decode(Ne,{skip_special_tokens:!0});let D;!Ie&&Le.input_ids.dims.at(-1)>0&&(D=this.tokenizer.batch_decode(Le.input_ids,{skip_special_tokens:!0}).map(B=>B.length));const ee=Array.from({length:K.length},B=>[]);for(let B=0;B[j.toLowerCase(),me])),this.entailment_id=this.label2id.entailment,this.entailment_id===void 0&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,this.contradiction_id===void 0&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(K,j,{hypothesis_template:me="This example is {}.",multi_label:Pe=!1}={}){const xe=Array.isArray(K);xe||(K=[K]),Array.isArray(j)||(j=[j]);const Ae=j.map(Ne=>me.replace("{}",Ne)),Ie=Pe||j.length===1,Le=[];for(const Ne of K){const We=[];for(const B of Ae){const te=this.tokenizer(Ne,{text_pair:B,padding:!0,truncation:!0}),de=await this.model(te);Ie?We.push([de.logits.data[this.contradiction_id],de.logits.data[this.entailment_id]]):We.push(de.logits.data[this.entailment_id])}const ee=(Ie?We.map(B=>(0,l.softmax)(B)[1]):(0,l.softmax)(We)).map((B,te)=>[B,te]).sort((B,te)=>te[0]-B[0]);Le.push({sequence:Ne,labels:ee.map(B=>j[B[1]]),scores:ee.map(B=>B[0])})}return xe?Le:Le[0]}}class R extends P{constructor(K){super(K)}async _call(K,{pooling:j="none",normalize:me=!1,quantize:Pe=!1,precision:xe="binary"}={}){const Ae=this.tokenizer(K,{padding:!0,truncation:!0}),Ie=await this.model(Ae);let Le=Ie.last_hidden_state??Ie.logits??Ie.token_embeddings;if(j!=="none")if(j==="mean")Le=(0,p.mean_pooling)(Le,Ae.attention_mask);else if(j==="cls")Le=Le.slice(null,0);else throw Error(`Pooling method '${j}' not supported.`);return me&&(Le=Le.normalize(2,-1)),Pe&&(Le=(0,p.quantize_embeddings)(Le,xe)),Le}}class Q extends P{constructor(K){super(K)}async _call(K,{pool:j=null}={}){const me=await h(K),{pixel_values:Pe}=await this.processor(me),xe=await this.model({pixel_values:Pe});let Ae;if(j){if(!("pooler_output"in xe))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");Ae=xe.pooler_output}else Ae=xe.last_hidden_state??xe.logits??xe.image_embeds;return Ae}}class q extends P{constructor(K){super(K)}async _call(K,{top_k:j=5}={}){const me=this.processor.feature_extractor.config.sampling_rate,Pe=await g(K,me),xe=this.model.config.id2label,Ae=[];for(const Ie of Pe){const Le=await this.processor(Ie),We=(await this.model(Le)).logits[0],D=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(We.data),We.dims),j),ee=D[0].tolist(),te=D[1].tolist().map((de,be)=>({label:xe?xe[de]:`LABEL_${de}`,score:ee[be]}));Ae.push(te)}return Array.isArray(K)?Ae:Ae[0]}}class U extends P{constructor(K){super(K)}async _call(K,j,{hypothesis_template:me="This is a sound of {}."}={}){const Pe=!Array.isArray(K);Pe&&(K=[K]);const xe=j.map(We=>me.replace("{}",We)),Ae=this.tokenizer(xe,{padding:!0,truncation:!0}),Ie=this.processor.feature_extractor.config.sampling_rate,Le=await g(K,Ie),Ne=[];for(const We of Le){const D=await this.processor(We),ee=await this.model({...Ae,...D}),B=(0,l.softmax)(ee.logits_per_audio.data);Ne.push([...B].map((te,de)=>({score:te,label:j[de]})))}return Pe?Ne[0]:Ne}}class Z extends P{constructor(K){super(K)}async _call(K,j={}){switch(this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(K,j);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(K,j);case"moonshine":return this._call_moonshine(K,j);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(K,j){j.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),j.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const me=!Array.isArray(K);me&&(K=[K]);const Pe=this.processor.feature_extractor.config.sampling_rate,xe=await g(K,Pe),Ae=[];for(const Ie of xe){const Le=await this.processor(Ie),We=(await this.model(Le)).logits[0],D=[];for(const B of We)D.push((0,l.max)(B.data)[1]);const ee=this.tokenizer.decode(D);Ae.push({text:ee})}return me?Ae[0]:Ae}async _call_whisper(K,j){const me=j.return_timestamps??!1,Pe=j.chunk_length_s??0,xe=j.force_full_sequences??!1;let Ae=j.stride_length_s??null;const Ie={...j};me==="word"&&(Ie.return_token_timestamps=!0,Ie.return_timestamps=!1);const Le=!Array.isArray(K);Le&&(K=[K]);const Ne=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,We=this.processor.feature_extractor.config.hop_length,D=this.processor.feature_extractor.config.sampling_rate,ee=await g(K,D),B=[];for(const te of ee){let de=[];if(Pe>0){if(Ae===null)Ae=Pe/6;else if(Pe<=Ae)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const Re=D*Pe,Fe=D*Ae,je=Re-2*Fe;let qe=0;for(;;){const Xe=qe+Re,ut=te.subarray(qe,Xe),wt=await this.processor(ut),nr=qe===0,jt=Xe>=te.length;if(de.push({stride:[ut.length,nr?0:Fe,jt?0:Fe],input_features:wt.input_features,is_last:jt}),jt)break;qe+=je}}else de=[{stride:[te.length,0,0],input_features:(await this.processor(te)).input_features,is_last:!0}];for(const Re of de){Ie.num_frames=Math.floor(Re.stride[0]/We);const Fe=await this.model.generate({inputs:Re.input_features,...Ie});me==="word"?(Re.tokens=Fe.sequences.tolist()[0],Re.token_timestamps=Fe.token_timestamps.tolist()[0].map(je=>(0,l.round)(je,2))):Re.tokens=Fe[0].tolist(),Re.stride=Re.stride.map(je=>je/D)}const[be,ve]=this.tokenizer._decode_asr(de,{time_precision:Ne,return_timestamps:me,force_full_sequences:xe});B.push({text:be,...ve})}return Le?B[0]:B}async _call_moonshine(K,j){const me=!Array.isArray(K);me&&(K=[K]);const Pe=this.processor.feature_extractor.config.sampling_rate,xe=await g(K,Pe),Ae=[];for(const Ie of xe){const Le=await this.processor(Ie),Ne=Math.floor(Ie.length/Pe)*6,We=await this.model.generate({max_new_tokens:Ne,...j,...Le}),D=this.processor.batch_decode(We,{skip_special_tokens:!0})[0];Ae.push({text:D})}return me?Ae[0]:Ae}}class H extends P{constructor(K){super(K)}async _call(K,j={}){const me=Array.isArray(K),Pe=await h(K),{pixel_values:xe}=await this.processor(Pe),Ae=[];for(const Ie of xe){Ie.dims=[1,...Ie.dims];const Le=await this.model.generate({inputs:Ie,...j}),Ne=this.tokenizer.batch_decode(Le,{skip_special_tokens:!0}).map(We=>({generated_text:We.trim()}));Ae.push(Ne)}return me?Ae:Ae[0]}}class J extends P{constructor(K){super(K)}async _call(K,{top_k:j=5}={}){const me=await h(K),{pixel_values:Pe}=await this.processor(me),xe=await this.model({pixel_values:Pe}),Ae=this.model.config.id2label,Ie=[];for(const Le of xe.logits){const Ne=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(Le.data),Le.dims),j),We=Ne[0].tolist(),ee=Ne[1].tolist().map((B,te)=>({label:Ae?Ae[B]:`LABEL_${B}`,score:We[te]}));Ie.push(ee)}return Array.isArray(K)?Ie:Ie[0]}}class ie extends P{constructor(K){super(K),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(K,{threshold:j=.5,mask_threshold:me=.5,overlap_mask_area_threshold:Pe=.8,label_ids_to_fuse:xe=null,target_sizes:Ae=null,subtask:Ie=null}={}){if(Array.isArray(K)&&K.length!==1)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const Ne=await h(K),We=Ne.map(Re=>[Re.height,Re.width]),D=await this.processor(Ne),{inputNames:ee,outputNames:B}=this.model.sessions.model;if(!ee.includes("pixel_values")){if(ee.length!==1)throw Error(`Expected a single input name, but got ${ee.length} inputs: ${ee}.`);const Re=ee[0];if(Re in D)throw Error(`Input name ${Re} already exists in the inputs.`);D[Re]=D.pixel_values}const te=await this.model(D);let de=null;if(Ie!==null)de=this.subtasks_mapping[Ie];else if(this.processor.image_processor){for(const[Re,Fe]of Object.entries(this.subtasks_mapping))if(Fe in this.processor.image_processor){de=this.processor.image_processor[Fe].bind(this.processor.image_processor),Ie=Re;break}}const be=this.model.config.id2label,ve=[];if(Ie)if(Ie==="panoptic"||Ie==="instance"){const Re=de(te,j,me,Pe,xe,Ae??We)[0],Fe=Re.segmentation;for(const je of Re.segments_info){const qe=new Uint8ClampedArray(Fe.data.length);for(let ut=0;utwt<-1e-5||wt>1+1e-5)&&Xe.sigmoid_();const ut=await u.RawImage.fromTensor(Xe.mul_(255).to("uint8")).resize(qe[1],qe[0]);ve.push({label:null,score:null,mask:ut})}}return ve}}class ae extends ie{constructor(K){super(K)}async _call(K,j={}){if(Array.isArray(K)&&K.length!==1)throw Error("Background removal pipeline currently only supports a batch size of 1.");const Pe=await h(K),xe=await super._call(K,j);return Pe.map((Ie,Le)=>{const Ne=Ie.clone();return Ne.putAlpha(xe[Le].mask),Ne})}}class ce extends P{constructor(K){super(K)}async _call(K,j,{hypothesis_template:me="This is a photo of {}"}={}){const Pe=Array.isArray(K),xe=await h(K),Ae=j.map(ee=>me.replace("{}",ee)),Ie=this.tokenizer(Ae,{padding:this.model.config.model_type==="siglip"?"max_length":!0,truncation:!0}),{pixel_values:Le}=await this.processor(xe),Ne=await this.model({...Ie,pixel_values:Le}),We=this.model.config.model_type==="siglip"?ee=>ee.sigmoid().data:ee=>(0,l.softmax)(ee.data),D=[];for(const ee of Ne.logits_per_image){const te=[...We(ee)].map((de,be)=>({score:de,label:j[be]}));te.sort((de,be)=>be.score-de.score),D.push(te)}return Pe?D:D[0]}}class he extends P{constructor(K){super(K)}async _call(K,{threshold:j=.9,percentage:me=!1}={}){const Pe=Array.isArray(K);if(Pe&&K.length!==1)throw Error("Object detection pipeline currently only supports a batch size of 1.");const xe=await h(K),Ae=me?null:xe.map(B=>[B.height,B.width]),{pixel_values:Ie,pixel_mask:Le}=await this.processor(xe),Ne=await this.model({pixel_values:Ie,pixel_mask:Le}),We=this.processor.image_processor.post_process_object_detection(Ne,j,Ae),D=this.model.config.id2label,ee=We.map(B=>B.boxes.map((te,de)=>({score:B.scores[de],label:D[B.classes[de]],box:_(te,!me)})));return Pe?ee:ee[0]}}class N extends P{constructor(K){super(K)}async _call(K,j,{threshold:me=.1,top_k:Pe=null,percentage:xe=!1}={}){const Ae=Array.isArray(K),Ie=await h(K),Le=this.tokenizer(j,{padding:!0,truncation:!0}),Ne=await this.processor(Ie),We=[];for(let D=0;D({score:ve.scores[Fe],label:ve.labels[Fe],box:_(Re,!xe)}))}else{const ve=this.processor.image_processor.post_process_object_detection(de,me,B,!0)[0];be=ve.boxes.map((Re,Fe)=>({score:ve.scores[Fe],label:j[ve.classes[Fe]],box:_(Re,!xe)}))}be.sort((ve,Re)=>Re.score-ve.score),Pe!==null&&(be=be.slice(0,Pe)),We.push(be)}return Ae?We:We[0]}}class O extends P{constructor(K){super(K)}async _call(K,j,me={}){const Pe=(await h(K))[0],{pixel_values:xe}=await this.processor(Pe),Ae=`${j}`,Ie=this.tokenizer(Ae,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,Le=await this.model.generate({inputs:xe,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:Ie,...me}),We=this.tokenizer.batch_decode(Le)[0].match(/(.*?)<\/s_answer>/);let D=null;return We&&We.length>=2&&(D=We[1].trim()),[{answer:D}]}}class G extends P{constructor(j){super(j);re(this,"DEFAULT_VOCODER_ID","Xenova/speecht5_hifigan");this.vocoder=j.vocoder??null}async _call(j,{speaker_embeddings:me=null}={}){return this.processor?this._call_text_to_spectrogram(j,{speaker_embeddings:me}):this._call_text_to_waveform(j)}async _call_text_to_waveform(j){const me=this.tokenizer(j,{padding:!0,truncation:!0}),{waveform:Pe}=await this.model(me),xe=this.model.config.sampling_rate;return new c.RawAudio(Pe.data,xe)}async _call_text_to_spectrogram(j,{speaker_embeddings:me}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await i.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"})),(typeof me=="string"||me instanceof URL)&&(me=new Float32Array(await(await fetch(me)).arrayBuffer())),me instanceof Float32Array)me=new p.Tensor("float32",me,[1,me.length]);else if(!(me instanceof p.Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");const{input_ids:Pe}=this.tokenizer(j,{padding:!0,truncation:!0}),{waveform:xe}=await this.model.generate_speech(Pe,me,{vocoder:this.vocoder}),Ae=this.processor.feature_extractor.config.sampling_rate;return new c.RawAudio(xe.data,Ae)}}class se extends P{constructor(K){super(K)}async _call(K){const j=await h(K),me=await this.processor(j),Pe=await this.model(me),xe=[];for(const Ae of Pe.reconstruction){const Ie=Ae.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");xe.push(u.RawImage.fromTensor(Ie))}return xe.length>1?xe:xe[0]}}class X extends P{constructor(K){super(K)}async _call(K){const j=await h(K),me=await this.processor(j),{predicted_depth:Pe}=await this.model(me),xe=[];for(let Ae=0;Ae1?xe:xe[0]}}const we=Object.freeze({"text-classification":{tokenizer:s.AutoTokenizer,pipeline:A,model:i.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:s.AutoTokenizer,pipeline:v,model:i.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:s.AutoTokenizer,pipeline:y,model:i.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:s.AutoTokenizer,pipeline:k,model:i.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:s.AutoTokenizer,pipeline:M,model:i.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:s.AutoTokenizer,pipeline:w,model:i.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:s.AutoTokenizer,pipeline:E,model:i.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:s.AutoTokenizer,pipeline:$,model:i.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:s.AutoTokenizer,pipeline:z,model:i.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:q,model:i.AutoModelForAudioClassification,processor:n.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:s.AutoTokenizer,pipeline:U,model:i.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:s.AutoTokenizer,pipeline:Z,model:[i.AutoModelForSpeechSeq2Seq,i.AutoModelForCTC],processor:n.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:s.AutoTokenizer,pipeline:G,model:[i.AutoModelForTextToWaveform,i.AutoModelForTextToSpectrogram],processor:[n.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:s.AutoTokenizer,pipeline:H,model:i.AutoModelForVision2Seq,processor:n.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:J,model:i.AutoModelForImageClassification,processor:n.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:ie,model:[i.AutoModelForImageSegmentation,i.AutoModelForSemanticSegmentation,i.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:ae,model:[i.AutoModelForImageSegmentation,i.AutoModelForSemanticSegmentation,i.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{tokenizer:s.AutoTokenizer,pipeline:ce,model:i.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:he,model:i.AutoModelForObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:s.AutoTokenizer,pipeline:N,model:i.AutoModelForZeroShotObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:s.AutoTokenizer,pipeline:O,model:i.AutoModelForDocumentQuestionAnswering,processor:n.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:se,model:i.AutoModelForImageToImage,processor:n.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:X,model:i.AutoModelForDepthEstimation,processor:n.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:s.AutoTokenizer,pipeline:R,model:i.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:n.AutoProcessor,pipeline:Q,model:[i.AutoModelForImageFeatureExtraction,i.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),_e=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function ke(Me,K=null,{progress_callback:j=null,config:me=null,cache_dir:Pe=null,local_files_only:xe=!1,revision:Ae="main",device:Ie=null,dtype:Le=null,subfolder:Ne="onnx",use_external_data_format:We=null,model_file_name:D=null,session_options:ee={}}={}){Me=_e[Me]??Me;const B=we[Me.split("_",1)[0]];if(!B)throw Error(`Unsupported pipeline: ${Me}. Must be one of [${Object.keys(we)}]`);K||(K=B.default.model,console.log(`No model specified. Using default model: "${K}".`));const te={progress_callback:j,config:me,cache_dir:Pe,local_files_only:xe,revision:Ae,device:Ie,dtype:Le,subfolder:Ne,use_external_data_format:We,model_file_name:D,session_options:ee},de=new Map([["tokenizer",B.tokenizer],["model",B.model],["processor",B.processor]]),be=await He(de,K,te);be.task=Me,(0,a.dispatchCallback)(j,{status:"ready",task:Me,model:K});const ve=B.pipeline;return new ve(be)}async function He(Me,K,j){const me=Object.create(null),Pe=[];for(const[xe,Ae]of Me.entries()){if(!Ae)continue;let Ie;Array.isArray(Ae)?Ie=new Promise(async(Le,Ne)=>{var D,ee;let We;for(const B of Ae){if(B===null){Le(null);return}try{Le(await B.from_pretrained(K,j));return}catch(te){if((D=te.message)!=null&&D.includes("Unsupported model type"))We=te;else if((ee=te.message)!=null&&ee.includes("Could not locate file"))We=te;else{Ne(te);return}}}Ne(We)}):Ie=Ae.from_pretrained(K,j),me[xe]=Ie,Pe.push(Ie)}await Promise.all(Pe);for(const[xe,Ae]of Object.entries(me))me[xe]=await Ae;return me}},"./src/tokenizers.js":(e,r,t)=>{t.r(r),t.d(r,{AlbertTokenizer:()=>Vr,AutoTokenizer:()=>Cn,BartTokenizer:()=>hs,BertTokenizer:()=>qr,BlenderbotSmallTokenizer:()=>Jr,BlenderbotTokenizer:()=>Ar,BloomTokenizer:()=>Qr,CLIPTokenizer:()=>xn,CamembertTokenizer:()=>it,CodeGenTokenizer:()=>Xr,CodeLlamaTokenizer:()=>Xs,CohereTokenizer:()=>Pn,ConvBertTokenizer:()=>mr,DebertaTokenizer:()=>xs,DebertaV2Tokenizer:()=>Es,DistilBertTokenizer:()=>et,ElectraTokenizer:()=>zt,EsmTokenizer:()=>en,FalconTokenizer:()=>_s,GPT2Tokenizer:()=>ps,GPTNeoXTokenizer:()=>Zs,GemmaTokenizer:()=>Lr,Grok1Tokenizer:()=>Cs,HerbertTokenizer:()=>Ls,LlamaTokenizer:()=>Qs,M2M100Tokenizer:()=>Bs,MBart50Tokenizer:()=>ms,MBartTokenizer:()=>Er,MPNetTokenizer:()=>Ys,MarianTokenizer:()=>En,MgpstrTokenizer:()=>Ss,MobileBertTokenizer:()=>us,NllbTokenizer:()=>zs,NougatTokenizer:()=>fr,PreTrainedTokenizer:()=>dt,Qwen2Tokenizer:()=>tn,RoFormerTokenizer:()=>Be,RobertaTokenizer:()=>fs,SiglipTokenizer:()=>zr,SpeechT5Tokenizer:()=>cr,SqueezeBertTokenizer:()=>Ts,T5Tokenizer:()=>kr,TokenizerModel:()=>Q,VitsTokenizer:()=>Ns,Wav2Vec2CTCTokenizer:()=>Rs,WhisperTokenizer:()=>Ir,XLMRobertaTokenizer:()=>Js,XLMTokenizer:()=>rr,is_chinese_char:()=>k});var s=t("./src/utils/generic.js"),i=t("./src/utils/core.js"),n=t("./src/utils/hub.js"),o=t("./src/utils/maths.js"),a=t("./src/utils/tensor.js"),l=t("./src/utils/data-structures.js"),c=t("./node_modules/@huggingface/jinja/dist/index.js"),p=t("./src/models/whisper/common_whisper.js");async function u(pe,F){const V=await Promise.all([(0,n.getModelJSON)(pe,"tokenizer.json",!0,F),(0,n.getModelJSON)(pe,"tokenizer_config.json",!0,F)]);return F.legacy!==null&&(V[1].legacy=F.legacy),V}function h(pe,F){const V=[];let Y=0;for(const le of pe.matchAll(F)){const ue=le[0];Y0&&V.push(ue),Y=le.index+ue.length}return Y=19968&&pe<=40959||pe>=13312&&pe<=19903||pe>=131072&&pe<=173791||pe>=173824&&pe<=177983||pe>=177984&&pe<=178207||pe>=178208&&pe<=183983||pe>=63744&&pe<=64255||pe>=194560&&pe<=195103}function E(pe,F,V){const Y=[];let le=0;for(;lethis.tokens_to_ids.get(V)??this.unk_token_id)}convert_ids_to_tokens(F){return F.map(V=>this.vocab[V]??this.unk_token)}}class q extends Q{constructor(F){super(F),this.tokens_to_ids=_(F.vocab),this.unk_token_id=this.tokens_to_ids.get(F.unk_token),this.unk_token=F.unk_token,this.max_input_chars_per_word=F.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[V,Y]of this.tokens_to_ids)this.vocab[Y]=V}encode(F){const V=[];for(const Y of F){const le=[...Y];if(le.length>this.max_input_chars_per_word){V.push(this.unk_token);continue}let ue=!1,Ce=0;const Ue=[];for(;Ce0&&(Ze=this.config.continuing_subword_prefix+Ze),this.tokens_to_ids.has(Ze)){Ke=Ze;break}--Qe}if(Ke===null){ue=!0;break}Ue.push(Ke),Ce=Qe}ue?V.push(this.unk_token):V.push(...Ue)}return V}}class U extends Q{constructor(F,V){super(F);const Y=F.vocab.length;this.vocab=new Array(Y),this.scores=new Array(Y);for(let le=0;le[le,ue])),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=V.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.minScore=(0,o.min)(this.scores)[0],this.unk_score=this.minScore-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new l.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes(F){const V=F.chars,Y=1;let le=0;for(;le{const pe=[...Array.from({length:94},(le,ue)=>ue+33),...Array.from({length:12},(le,ue)=>ue+161),...Array.from({length:82},(le,ue)=>ue+174)],F=pe.slice();let V=0;for(let le=0;le<256;++le)pe.includes(le)||(pe.push(le),F.push(256+V),V+=1);const Y=F.map(le=>String.fromCharCode(le));return Object.fromEntries(pe.map((le,ue)=>[le,Y[ue]]))})(),H=(0,i.reverseDictionary)(Z);class J extends Q{constructor(F){super(F),this.tokens_to_ids=_(F.vocab),this.unk_token_id=this.tokens_to_ids.get(F.unk_token),this.unk_token=F.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[Y,le]of this.tokens_to_ids)this.vocab[le]=Y;const V=Array.isArray(F.merges[0]);this.merges=V?F.merges:F.merges.map(Y=>Y.split(" ",2)),this.bpe_ranks=new Map(this.merges.map((Y,le)=>[JSON.stringify(Y),le])),this.end_of_word_suffix=F.end_of_word_suffix,this.continuing_subword_suffix=F.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.cache=new Map}bpe(F){if(F.length===0)return[];const V=this.cache.get(F);if(V!==void 0)return V;const Y=Array.from(F);this.end_of_word_suffix&&(Y[Y.length-1]+=this.end_of_word_suffix);let le=[];if(Y.length>1){const ue=new l.PriorityQueue((Qe,Ke)=>Qe.score`<0x${Ue.toString(16).toUpperCase().padStart(2,"0")}>`);Ce.every(Ue=>this.tokens_to_ids.has(Ue))?V.push(...Ce):V.push(this.unk_token)}else V.push(this.unk_token)}return V}}class ie extends Q{constructor(F,V){super(F),this.tokens_to_ids=_(V.target_lang?F.vocab[V.target_lang]:F.vocab),this.bos_token=V.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=V.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=V.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=V.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[Y,le]of this.tokens_to_ids)this.vocab[le]=Y}encode(F){return F}}class ae extends s.Callable{constructor(F){super(),this.config=F}static fromConfig(F){if(F===null)return null;switch(F.type){case"BertNormalizer":return new Me(F);case"Precompiled":return new jt(F);case"Sequence":return new He(F);case"Replace":return new ce(F);case"NFC":return new N(F);case"NFD":return new O(F);case"NFKC":return new G(F);case"NFKD":return new se(F);case"Strip":return new X(F);case"StripAccents":return new we(F);case"Lowercase":return new _e(F);case"Prepend":return new ke(F);default:throw new Error(`Unknown Normalizer type: ${F.type}`)}}normalize(F){throw Error("normalize should be implemented in subclass.")}_call(F){return this.normalize(F)}}class ce extends ae{normalize(F){const V=g(this.config.pattern);return V===null?F:F.replaceAll(V,this.config.content)}}class he extends ae{constructor(){super(...arguments);re(this,"form")}normalize(V){return V=V.normalize(this.form),V}}class N extends he{constructor(){super(...arguments);re(this,"form","NFC")}}class O extends he{constructor(){super(...arguments);re(this,"form","NFD")}}class G extends he{constructor(){super(...arguments);re(this,"form","NFKC")}}class se extends he{constructor(){super(...arguments);re(this,"form","NFKD")}}class X extends ae{normalize(F){return this.config.strip_left&&this.config.strip_right?F=F.trim():(this.config.strip_left&&(F=F.trimStart()),this.config.strip_right&&(F=F.trimEnd())),F}}class we extends ae{normalize(F){return F=v(F),F}}class _e extends ae{normalize(F){return F=F.toLowerCase(),F}}class ke extends ae{normalize(F){return F=this.config.prepend+F,F}}class He extends ae{constructor(F){super(F),this.normalizers=F.normalizers.map(V=>ae.fromConfig(V))}normalize(F){return this.normalizers.reduce((V,Y)=>Y.normalize(V),F)}}class Me extends ae{_tokenize_chinese_chars(F){const V=[];for(let Y=0;Ythis.pre_tokenize_text(Y,V)):this.pre_tokenize_text(F,V)).flat()}_call(F,V){return this.pre_tokenize(F,V)}}class j extends K{constructor(F){super(),this.pattern=new RegExp(`[^\\s${w}]+|[${w}]`,"gu")}pre_tokenize_text(F,V){return F.trim().match(this.pattern)||[]}}class me extends K{constructor(F){super(),this.config=F,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=new RegExp("'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)|\\s+","gu"),this.byte_encoder=Z,this.text_encoder=new TextEncoder}pre_tokenize_text(F,V){return this.add_prefix_space&&!F.startsWith(" ")&&(F=" "+F),(this.use_regex?F.match(this.pattern)||[]:[F]).map(le=>Array.from(this.text_encoder.encode(le),ue=>this.byte_encoder[ue]).join(""))}}class Pe extends K{constructor(F){super(),this.config=F,this.pattern=g(this.config.pattern,this.config.invert)}pre_tokenize_text(F,V){var Y;return this.pattern===null?[]:this.config.invert?F.match(this.pattern)||[]:((Y=this.config.behavior)==null?void 0:Y.toLowerCase())==="removed"?F.split(this.pattern).filter(le=>le):h(F,this.pattern)}}class xe extends K{constructor(F){super(),this.config=F,this.pattern=new RegExp(`[^${w}]+|[${w}]+`,"gu")}pre_tokenize_text(F,V){return F.match(this.pattern)||[]}}class Ae extends K{constructor(F){super(),this.config=F;const V=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=new RegExp(V,"gu")}pre_tokenize_text(F,V){return F.match(this.pattern)||[]}}class Ie extends s.Callable{constructor(F){super(),this.config=F}static fromConfig(F){if(F===null)return null;switch(F.type){case"TemplateProcessing":return new We(F);case"ByteLevel":return new D(F);case"RobertaProcessing":return new Ne(F);case"BertProcessing":return new Le(F);case"Sequence":return new ee(F);default:throw new Error(`Unknown PostProcessor type: ${F.type}`)}}post_process(F,...V){throw Error("post_process should be implemented in subclass.")}_call(F,...V){return this.post_process(F,...V)}}class Le extends Ie{constructor(F){super(F),this.cls=F.cls[0],this.sep=F.sep[0]}post_process(F,V=null,{add_special_tokens:Y=!0}={}){Y&&(F=(0,i.mergeArrays)([this.cls],F,[this.sep]));let le=new Array(F.length).fill(0);if(V!==null){const ue=Y&&this instanceof Ne?[this.sep]:[],Ce=Y?[this.sep]:[];F=(0,i.mergeArrays)(F,ue,V,Ce),le=(0,i.mergeArrays)(le,new Array(V.length+ue.length+Ce.length).fill(1))}return{tokens:F,token_type_ids:le}}}class Ne extends Le{}class We extends Ie{constructor(F){super(F),this.single=F.single,this.pair=F.pair}post_process(F,V=null,{add_special_tokens:Y=!0}={}){const le=V===null?this.single:this.pair;let ue=[],Ce=[];for(const Ue of le)"SpecialToken"in Ue?Y&&(ue.push(Ue.SpecialToken.id),Ce.push(Ue.SpecialToken.type_id)):"Sequence"in Ue&&(Ue.Sequence.id==="A"?(ue=(0,i.mergeArrays)(ue,F),Ce=(0,i.mergeArrays)(Ce,new Array(F.length).fill(Ue.Sequence.type_id))):Ue.Sequence.id==="B"&&(ue=(0,i.mergeArrays)(ue,V),Ce=(0,i.mergeArrays)(Ce,new Array(V.length).fill(Ue.Sequence.type_id))));return{tokens:ue,token_type_ids:Ce}}}class D extends Ie{post_process(F,V=null){return V&&(F=(0,i.mergeArrays)(F,V)),{tokens:F}}}class ee extends Ie{constructor(F){super(F),this.processors=F.processors.map(V=>Ie.fromConfig(V))}post_process(F,V=null,Y={}){let le;for(const ue of this.processors)if(ue instanceof D)F=ue.post_process(F).tokens,V&&(V=ue.post_process(V).tokens);else{const Ce=ue.post_process(F,V,Y);F=Ce.tokens,le=Ce.token_type_ids}return{tokens:F,token_type_ids:le}}}class B extends s.Callable{constructor(F){super(),this.config=F,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=F.trim_offsets}static fromConfig(F){if(F===null)return null;switch(F.type){case"WordPiece":return new Re(F);case"Metaspace":return new nr(F);case"ByteLevel":return new Fe(F);case"Replace":return new te(F);case"ByteFallback":return new de(F);case"Fuse":return new be(F);case"Strip":return new ve(F);case"Sequence":return new qe(F);case"CTC":return new je(F);case"BPEDecoder":return new Xe(F);default:throw new Error(`Unknown Decoder type: ${F.type}`)}}_call(F){return this.decode(F)}decode(F){return this.decode_chain(F).join("")}decode_chain(F){throw Error("`decode_chain` should be implemented in subclass.")}}class te extends B{decode_chain(F){const V=g(this.config.pattern);return V===null?F:F.map(Y=>Y.replaceAll(V,this.config.content))}}class de extends B{constructor(F){super(F),this.text_decoder=new TextDecoder}decode_chain(F){const V=[];let Y=[];for(const le of F){let ue=null;if(le.length===6&&le.startsWith("<0x")&&le.endsWith(">")){const Ce=parseInt(le.slice(3,5),16);isNaN(Ce)||(ue=Ce)}if(ue!==null)Y.push(ue);else{if(Y.length>0){const Ce=this.text_decoder.decode(Uint8Array.from(Y));V.push(Ce),Y=[]}V.push(le)}}if(Y.length>0){const le=this.text_decoder.decode(Uint8Array.from(Y));V.push(le),Y=[]}return V}}class be extends B{decode_chain(F){return[F.join("")]}}class ve extends B{constructor(F){super(F),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain(F){return F.map(V=>{let Y=0;for(let ue=0;ue(Y!==0&&(V.startsWith(this.config.prefix)?V=V.replace(this.config.prefix,""):V=" "+V),this.cleanup&&(V=A(V)),V))}}class Fe extends B{constructor(F){super(F),this.byte_decoder=H,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string(F){const V=F.join(""),Y=new Uint8Array([...V].map(ue=>this.byte_decoder[ue]));return this.text_decoder.decode(Y)}decode_chain(F){const V=[];let Y=[];for(const le of F)this.added_tokens.find(ue=>ue.content===le)!==void 0?(Y.length>0&&(V.push(this.convert_tokens_to_string(Y)),Y=[]),V.push(le)):Y.push(le);return Y.length>0&&V.push(this.convert_tokens_to_string(Y)),V}}class je extends B{constructor(F){super(F),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string(F){if(F.length===0)return"";const V=[F[0]];for(let ue=1;ueue!==this.pad_token).join("");return this.cleanup&&(le=A(le).replaceAll(this.word_delimiter_token," ").trim()),le}decode_chain(F){return[this.convert_tokens_to_string(F)]}}class qe extends B{constructor(F){super(F),this.decoders=F.decoders.map(V=>B.fromConfig(V))}decode_chain(F){return this.decoders.reduce((V,Y)=>Y.decode_chain(V),F)}}class Xe extends B{constructor(F){super(F),this.suffix=this.config.suffix}decode_chain(F){return F.map((V,Y)=>V.replaceAll(this.suffix,Y===F.length-1?"":" "))}}class ut extends B{decode_chain(F){let V="";for(let Y=1;YY.normalize("NFKC")).join("~"):F=F.normalize("NFKC"),F}}class dr extends K{constructor(F){super(),this.tokenizers=F.pretokenizers.map(V=>K.fromConfig(V))}pre_tokenize_text(F,V){return this.tokenizers.reduce((Y,le)=>le.pre_tokenize(Y,V),[F])}}class ds extends K{constructor(F){super()}pre_tokenize_text(F,V){return F.match(/\w+|[^\w\s]+/g)||[]}}class Os extends K{constructor(F){super()}pre_tokenize_text(F,V){return M(F)}}class Dr extends K{constructor(F){super(),this.config=F,this.pattern=g(this.config.pattern),this.content=this.config.content}pre_tokenize_text(F,V){return this.pattern===null?[F]:[F.replaceAll(this.pattern,this.config.content)]}}const cs=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function Ds(pe,F,V,Y){for(const le of Object.keys(pe)){const ue=F-pe[le].length,Ce=V(le),Ue=new Array(ue).fill(Ce);pe[le]=Y==="right"?(0,i.mergeArrays)(pe[le],Ue):(0,i.mergeArrays)(Ue,pe[le])}}function jr(pe,F){for(const V of Object.keys(pe))pe[V].length=F}class dt extends s.Callable{constructor(V,Y){super();re(this,"return_token_type_ids",!1);re(this,"padding_side","right");this._tokenizer_config=Y,this.normalizer=ae.fromConfig(V.normalizer),this.pre_tokenizer=K.fromConfig(V.pre_tokenizer),this.model=Q.fromConfig(V.model,Y),this.post_processor=Ie.fromConfig(V.post_processor),this.decoder=B.fromConfig(V.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(const le of V.added_tokens){const ue=new R(le);this.added_tokens.push(ue),this.model.tokens_to_ids.set(ue.content,ue.id),this.model.vocab[ue.id]=ue.content,ue.special&&(this.special_tokens.push(ue.content),this.all_special_ids.push(ue.id))}if(this.additional_special_tokens=Y.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_splitter=new l.DictionarySplitter(this.added_tokens.map(le=>le.content)),this.added_tokens_map=new Map(this.added_tokens.map(le=>[le.content,le])),this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.bos_token=this.getToken("bos_token"),this.bos_token_id=this.model.tokens_to_ids.get(this.bos_token),this.eos_token=this.getToken("eos_token"),this.eos_token_id=this.model.tokens_to_ids.get(this.eos_token),this.model_max_length=Y.model_max_length,this.remove_space=Y.remove_space,this.clean_up_tokenization_spaces=Y.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=Y.do_lowercase_and_remove_accent??!1,Y.padding_side&&(this.padding_side=Y.padding_side),this.legacy=!1,this.chat_template=Y.chat_template??null,Array.isArray(this.chat_template)){const le=Object.create(null);for(const{name:ue,template:Ce}of this.chat_template){if(typeof ue!="string"||typeof Ce!="string")throw new Error('Chat template must be a list of objects with "name" and "template" properties');le[ue]=Ce}this.chat_template=le}this._compiled_template_cache=new Map}getToken(...V){for(const Y of V){const le=this._tokenizer_config[Y];if(le)if(typeof le=="object"){if(le.__type==="AddedToken")return le.content;throw Error(`Unknown token: ${le}`)}else return le}return null}static async from_pretrained(V,{progress_callback:Y=null,config:le=null,cache_dir:ue=null,local_files_only:Ce=!1,revision:Ue="main",legacy:Qe=null}={}){const Ke=await u(V,{progress_callback:Y,config:le,cache_dir:ue,local_files_only:Ce,revision:Ue,legacy:Qe});return new this(...Ke)}_call(V,{text_pair:Y=null,add_special_tokens:le=!0,padding:ue=!1,truncation:Ce=null,max_length:Ue=null,return_tensor:Qe=!0,return_token_type_ids:Ke=null}={}){const Ze=Array.isArray(V);let ht;if(Ze){if(V.length===0)throw Error("text array must be non-empty");if(Y!==null){if(Array.isArray(Y)){if(V.length!==Y.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");ht=V.map((kt,Wt)=>this._encode_plus(kt,{text_pair:Y[Wt],add_special_tokens:le,return_token_type_ids:Ke}))}else ht=V.map(kt=>this._encode_plus(kt,{add_special_tokens:le,return_token_type_ids:Ke}))}else{if(V==null)throw Error("text may not be null or undefined");if(Array.isArray(Y))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");ht=[this._encode_plus(V,{text_pair:Y,add_special_tokens:le,return_token_type_ids:Ke})]}if(Ue===null?ue==="max_length"?Ue=this.model_max_length:Ue=(0,o.max)(ht.map(kt=>kt.input_ids.length))[0]:Ce||console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."),Ue=Math.min(Ue,this.model_max_length??1/0),ue||Ce)for(let kt=0;ktUe?Ce&&jr(ht[kt],Ue):ue&&Ds(ht[kt],Ue,Wt=>Wt==="input_ids"?this.pad_token_id:0,this.padding_side));const Ct={};if(Qe){if(!(ue&&Ce)&&ht.some(Wt=>{var Ot;for(const Vt of Object.keys(Wt))if(Wt[Vt].length!==((Ot=ht[0][Vt])==null?void 0:Ot.length))return!0;return!1}))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const kt=[ht.length,ht[0].input_ids.length];for(const Wt of Object.keys(ht[0]))Ct[Wt]=new a.Tensor("int64",BigInt64Array.from(ht.flatMap(Ot=>Ot[Wt]).map(BigInt)),kt)}else{for(const kt of Object.keys(ht[0]))Ct[kt]=ht.map(Wt=>Wt[kt]);if(!Ze)for(const kt of Object.keys(Ct))Ct[kt]=Ct[kt][0]}return Ct}_encode_text(V){if(V===null)return null;const Y=this.added_tokens_splitter.split(V);for(let ue=0;ue0&&(Y[ue-1]=Y[ue-1].trimEnd()),Ce.rstrip&&ue{if(ue.length===0)return[];if(this.added_tokens_map.has(ue))return[ue];if(this.remove_space===!0&&(ue=ue.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(ue=y(ue)),this.normalizer!==null&&(ue=this.normalizer(ue)),ue.length===0)return[];const Ue=this.pre_tokenizer!==null?this.pre_tokenizer(ue,{section_index:Ce}):[ue];return this.model(Ue)})}_encode_plus(V,{text_pair:Y=null,add_special_tokens:le=!0,return_token_type_ids:ue=null}={}){const{tokens:Ce,token_type_ids:Ue}=this._tokenize_helper(V,{pair:Y,add_special_tokens:le}),Qe=this.model.convert_tokens_to_ids(Ce),Ke={input_ids:Qe,attention_mask:new Array(Qe.length).fill(1)};return(ue??this.return_token_type_ids)&&Ue&&(Ke.token_type_ids=Ue),Ke}_tokenize_helper(V,{pair:Y=null,add_special_tokens:le=!1}={}){const ue=this._encode_text(V),Ce=this._encode_text(Y);return this.post_processor?this.post_processor(ue,Ce,{add_special_tokens:le}):{tokens:(0,i.mergeArrays)(ue??[],Ce??[])}}tokenize(V,{pair:Y=null,add_special_tokens:le=!1}={}){return this._tokenize_helper(V,{pair:Y,add_special_tokens:le}).tokens}encode(V,{text_pair:Y=null,add_special_tokens:le=!0,return_token_type_ids:ue=null}={}){return this._encode_plus(V,{text_pair:Y,add_special_tokens:le,return_token_type_ids:ue}).input_ids}batch_decode(V,Y={}){return V instanceof a.Tensor&&(V=V.tolist()),V.map(le=>this.decode(le,Y))}decode(V,Y={}){if(V instanceof a.Tensor&&(V=P(V)),!Array.isArray(V)||V.length===0||!(0,i.isIntegralNumber)(V[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(V,Y)}decode_single(V,{skip_special_tokens:Y=!1,clean_up_tokenization_spaces:le=null}){let ue=this.model.convert_ids_to_tokens(V);Y&&(ue=ue.filter(Ue=>!this.special_tokens.includes(Ue)));let Ce=this.decoder?this.decoder(ue):ue.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(Ce=Ce.replaceAll(this.decoder.end_of_word_suffix," "),Y&&(Ce=Ce.trim())),(le??this.clean_up_tokenization_spaces)&&(Ce=A(Ce)),Ce}get_chat_template({chat_template:V=null,tools:Y=null}={}){if(this.chat_template&&typeof this.chat_template=="object"){const le=this.chat_template;if(V!==null&&Object.hasOwn(le,V))V=le[V];else if(V===null)if(Y!==null&&"tool_use"in le)V=le.tool_use;else if("default"in le)V=le.default;else throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(le).sort()}.`)}else if(V===null)if(this.chat_template)V=this.chat_template;else throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");return V}apply_chat_template(V,{tools:Y=null,documents:le=null,chat_template:ue=null,add_generation_prompt:Ce=!1,tokenize:Ue=!0,padding:Qe=!1,truncation:Ke=!1,max_length:Ze=null,return_tensor:ht=!0,return_dict:Ct=!1,tokenizer_kwargs:kt={},...Wt}={}){if(ue=this.get_chat_template({chat_template:ue,tools:Y}),typeof ue!="string")throw Error(`chat_template must be a string, but got ${typeof ue}`);let Ot=this._compiled_template_cache.get(ue);Ot===void 0&&(Ot=new c.Template(ue),this._compiled_template_cache.set(ue,Ot));const Vt=Object.create(null);for(const _r of cs){const Yr=this.getToken(_r);Yr&&(Vt[_r]=Yr)}const vr=Ot.render({messages:V,add_generation_prompt:Ce,tools:Y,documents:le,...Vt,...Wt});if(Ue){const _r=this._call(vr,{add_special_tokens:!1,padding:Qe,truncation:Ke,max_length:Ze,return_tensor:ht,...kt});return Ct?_r:_r.input_ids}return vr}}class qr extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class Vr extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class us extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class Ts extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class xs extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class Es extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class Ls extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class mr extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class Be extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class et extends dt{}class it extends dt{}class rr extends dt{constructor(V,Y){super(V,Y);re(this,"return_token_type_ids",!0);console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class zt extends dt{constructor(){super(...arguments);re(this,"return_token_type_ids",!0)}}class kr extends dt{}class ps extends dt{}class hs extends dt{}class Er extends dt{constructor(F,V){super(F,V),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter(Y=>this.languageRegex.test(Y)),this.lang_to_token=Y=>Y}_build_translation_inputs(F,V,Y){return br(this,F,V,Y)}}class ms extends Er{}class fs extends dt{}class Qr extends dt{}const Ps="▁";class Qs extends dt{constructor(V,Y){super(V,Y);re(this,"padding_side","left");this.legacy=Y.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new wt({replacement:Ps,add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(V){if(V===null)return null;if(this.legacy||V.length===0)return super._encode_text(V);let Y=super._encode_text(Ps+V.replaceAll(Ps," "));return Y.length>1&&Y[0]===Ps&&this.special_tokens.includes(Y[1])&&(Y=Y.slice(1)),Y}}class Xs extends dt{}class Js extends dt{}class Ys extends dt{}class _s extends dt{}class Zs extends dt{}class en extends dt{}class tn extends dt{}class Lr extends dt{}class Cs extends dt{}function br(pe,F,V,Y){if(!("language_codes"in pe)||!Array.isArray(pe.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in pe)||!(pe.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in pe)||typeof pe.lang_to_token!="function")throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const le=Y.src_lang,ue=Y.tgt_lang;if(!pe.language_codes.includes(ue))throw new Error(`Target language code "${ue}" is not valid. Must be one of: {${pe.language_codes.join(", ")}}`);if(le!==void 0){if(!pe.language_codes.includes(le))throw new Error(`Source language code "${le}" is not valid. Must be one of: {${pe.language_codes.join(", ")}}`);for(const Ce of pe.post_processor.config.single)if("SpecialToken"in Ce&&pe.languageRegex.test(Ce.SpecialToken.id)){Ce.SpecialToken.id=pe.lang_to_token(le);break}}return Y.forced_bos_token_id=pe.model.convert_tokens_to_ids([pe.lang_to_token(ue)])[0],pe._call(F,V)}class zs extends dt{constructor(F,V){super(F,V),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(Y=>this.languageRegex.test(Y)),this.lang_to_token=Y=>Y}_build_translation_inputs(F,V,Y){return br(this,F,V,Y)}}class Bs extends dt{constructor(F,V){super(F,V),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter(Y=>this.languageRegex.test(Y)).map(Y=>Y.slice(2,-2)),this.lang_to_token=Y=>`__${Y}__`}_build_translation_inputs(F,V,Y){return br(this,F,V,Y)}}class Ir extends dt{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr(F,{return_timestamps:V=!1,return_language:Y=!1,time_precision:le=null,force_full_sequences:ue=!0}={}){if(le===null)throw Error("Must specify time_precision");let Ce=null;const Ue=V==="word";function Qe(){return{language:Ce,timestamp:[null,null],text:""}}const Ke=[];let Ze=Qe(),ht=0;const Ct=this.timestamp_begin,Wt=Ct+1500;let Ot=[],Vt=[],vr=!1,_r=null;const Yr=new Set(this.all_special_ids);for(const Gt of F){const Zt=Gt.tokens,gr=Ue?Gt.token_timestamps:null;let Zr=null,ws=Ct;if("stride"in Gt){const[Rt,Jt,qt]=Gt.stride;if(ht-=Jt,_r=Rt-qt,Jt&&(ws=Jt/le+Ct),qt)for(let er=Zt.length-1;er>=0;--er){const ir=Number(Zt[er]);if(ir>=Ct){if(Zr!==null&&(ir-Ct)*le<_r)break;Zr=ir}}}let Ht=[],ur=[];for(let Rt=0;Rt=Ct&&Jt<=Wt){const qt=(Jt-Ct)*le+ht,er=(0,o.round)(qt,2);if(Zr!==null&&Jt>=Zr)vr=!0;else if(vr||Ot.length>0&&Jt0?(Ot.push(Ht),Ue&&Vt.push(ur)):Ot.every(Rt=>Rt.length===0)&&(Ze=Qe(),Ot=[],Ht=[],Vt=[],ur=[])}if(Ot.length>0){if(ue&&V)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[Gt,Zt]=this.findLongestCommonSequence(Ot,Vt),gr=this.decode(Gt);Ze.text=gr,Ue&&(Ze.words=this.collateWordTimestamps(Gt,Zt,Ce)),Ke.push(Ze)}let Tr=Object.create(null);const gs=Ke.map(Gt=>Gt.text).join("");if(V||Y){for(let Gt=0;Gt0;let Ue=Ce?[]:null,Qe=Ce?V[0]:null;for(let Ke=1;KeJt===ws[qt]&&Qe[gs+qt]<=V[Ke][gr+qt]).length:Ht=Zt.filter((Jt,qt)=>Jt===ws[qt]).length;const ur=Tr/1e4,Rt=Ht/Tr+ur;Ht>1&&Rt>ht&&(ht=Rt,Ct=[gs,Gt,gr,Zr])}const[Wt,Ot,Vt,vr]=Ct,_r=Math.floor((Ot+Wt)/2),Yr=Math.floor((vr+Vt)/2);ue.push(...Y.slice(0,_r)),Y=Ze.slice(Yr),le=Y.length,Ce&&(Ue.push(...Qe.slice(0,_r)),Qe=V[Ke].slice(Yr))}return ue.push(...Y),Ce?(Ue.push(...Qe),[ue,Ue]):[ue,[]]}collateWordTimestamps(F,V,Y){const[le,ue,Ce]=this.combineTokensIntoWords(F,Y),Ue=[];for(let Qe=0;Qe=le){const Ue=((Ce-le)*Y).toFixed(2);ue.push(`<|${Ue}|>`),ue.push([])}else ue[ue.length-1].push(Ce);return ue=ue.map(Ce=>typeof Ce=="string"?Ce:super.decode(Ce,V)),ue.join("")}splitTokensOnUnicode(F){const V=this.decode(F,{decode_with_timestamps:!0}),Y="�",le=[],ue=[],Ce=[];let Ue=[],Qe=[],Ke=0;for(let Ze=0;Ze=this.model.tokens_to_ids.get("<|endoftext|>"),Wt=Ze.startsWith(" "),Ot=Ze.trim(),Vt=Qe.test(Ot);if(kt||Wt||Vt||ue.length===0)ue.push(Ze),Ce.push(ht),Ue.push(Ct);else{const vr=ue.length-1;ue[vr]+=Ze,Ce[vr].push(...ht),Ue[vr].push(...Ct)}}return[ue,Ce,Ue]}mergePunctuations(F,V,Y,le,ue){const Ce=structuredClone(F),Ue=structuredClone(V),Qe=structuredClone(Y);let Ke=Ce.length-2,Ze=Ce.length-1;for(;Ke>=0;)Ce[Ke].startsWith(" ")&&le.includes(Ce[Ke].trim())?(Ce[Ze]=Ce[Ke]+Ce[Ze],Ue[Ze]=(0,i.mergeArrays)(Ue[Ke],Ue[Ze]),Qe[Ze]=(0,i.mergeArrays)(Qe[Ke],Qe[Ze]),Ce[Ke]="",Ue[Ke]=[],Qe[Ke]=[]):Ze=Ke,--Ke;for(Ke=0,Ze=1;Zeht),Ue.filter(ht=>ht.length>0),Qe.filter(ht=>ht.length>0)]}}class Xr extends dt{}class xn extends dt{}class zr extends dt{}class En extends dt{constructor(F,V){super(F,V),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(Y=>this.languageRegex.test(Y)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text(F){if(F===null)return null;const[V,...Y]=F.trim().split(this.languageRegex);if(Y.length===0)return super._encode_text(V);if(Y.length===2){const[le,ue]=Y;return this.supported_language_codes.includes(le)||console.warn(`Unsupported language code "${le}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,i.mergeArrays)([le],super._encode_text(ue))}}}class Rs extends dt{}class Ar extends dt{}class Jr extends dt{}class cr extends dt{}class fr extends dt{}class Ns extends dt{constructor(F,V){super(F,V),this.decoder=new ut({})}}class Pn extends dt{}class Ss extends dt{}class Cn{static async from_pretrained(F,{progress_callback:V=null,config:Y=null,cache_dir:le=null,local_files_only:ue=!1,revision:Ce="main",legacy:Ue=null}={}){var Ct;const[Qe,Ke]=await u(F,{progress_callback:V,config:Y,cache_dir:le,local_files_only:ue,revision:Ce,legacy:Ue}),Ze=((Ct=Ke.tokenizer_class)==null?void 0:Ct.replace(/Fast$/,""))??"PreTrainedTokenizer";let ht=this.TOKENIZER_CLASS_MAPPING[Ze];return ht||(console.warn(`Unknown tokenizer class "${Ze}", attempting to construct from base class.`),ht=dt),new ht(Qe,Ke)}}re(Cn,"TOKENIZER_CLASS_MAPPING",{T5Tokenizer:kr,DistilBertTokenizer:et,CamembertTokenizer:it,DebertaTokenizer:xs,DebertaV2Tokenizer:Es,BertTokenizer:qr,HerbertTokenizer:Ls,ConvBertTokenizer:mr,RoFormerTokenizer:Be,XLMTokenizer:rr,ElectraTokenizer:zt,MobileBertTokenizer:us,SqueezeBertTokenizer:Ts,AlbertTokenizer:Vr,GPT2Tokenizer:ps,BartTokenizer:hs,MBartTokenizer:Er,MBart50Tokenizer:ms,RobertaTokenizer:fs,WhisperTokenizer:Ir,CodeGenTokenizer:Xr,CLIPTokenizer:xn,SiglipTokenizer:zr,MarianTokenizer:En,BloomTokenizer:Qr,NllbTokenizer:zs,M2M100Tokenizer:Bs,LlamaTokenizer:Qs,CodeLlamaTokenizer:Xs,XLMRobertaTokenizer:Js,MPNetTokenizer:Ys,FalconTokenizer:_s,GPTNeoXTokenizer:Zs,EsmTokenizer:en,Wav2Vec2CTCTokenizer:Rs,BlenderbotTokenizer:Ar,BlenderbotSmallTokenizer:Jr,SpeechT5Tokenizer:cr,NougatTokenizer:fr,VitsTokenizer:Ns,Qwen2Tokenizer:tn,GemmaTokenizer:Lr,Grok1Tokenizer:Cs,CohereTokenizer:Pn,MgpstrTokenizer:Ss,PreTrainedTokenizer:dt})},"./src/utils/audio.js":(e,r,t)=>{t.r(r),t.d(r,{RawAudio:()=>q,hamming:()=>h,hanning:()=>u,mel_filter_bank:()=>k,read_audio:()=>c,spectrogram:()=>$,window_function:()=>z});var s=t("./src/utils/hub.js"),i=t("./src/utils/maths.js"),n=t("./src/utils/core.js"),o=t("./src/env.js"),a=t("?7a2c"),l=t("./src/utils/tensor.js");async function c(U,Z){if(typeof AudioContext>"u")throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const H=await(await(0,s.getFile)(U)).arrayBuffer(),J=new AudioContext({sampleRate:Z});typeof Z>"u"&&console.warn(`No sampling rate provided, using default of ${J.sampleRate}Hz.`);const ie=await J.decodeAudioData(H);let ae;if(ie.numberOfChannels===2){const ce=Math.sqrt(2),he=ie.getChannelData(0),N=ie.getChannelData(1);ae=new Float32Array(he.length);for(let O=0;O2595*Math.log10(1+U/700),kaldi:U=>1127*Math.log(1+U/700),slaney:(U,Z=1e3,H=15,J=27/Math.log(6.4))=>U>=Z?H+Math.log(U/Z)*J:3*U/200};function _(U,Z="htk"){const H=g[Z];if(!H)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof U=="number"?H(U):U.map(J=>H(J))}const P={htk:U=>700*(10**(U/2595)-1),kaldi:U=>700*(Math.exp(U/1127)-1),slaney:(U,Z=1e3,H=15,J=Math.log(6.4)/27)=>U>=H?Z*Math.exp(J*(U-H)):200*U/3};function A(U,Z="htk"){const H=P[Z];if(!H)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof U=="number"?H(U):U.map(J=>H(J))}function v(U,Z){const H=Float64Array.from({length:Z.length-1},(ce,he)=>Z[he+1]-Z[he]),J=Array.from({length:U.length},()=>new Array(Z.length));for(let ce=0;cenew Array(U.length));for(let ce=0;ceU+J*ae)}function k(U,Z,H,J,ie,ae=null,ce="htk",he=!1){if(ae!==null&&ae!=="slaney")throw new Error('norm must be one of null or "slaney"');const N=_(H,ce),O=_(J,ce),G=y(N,O,Z+2);let se=A(G,ce),X;if(he){const _e=ie/(U*2);X=_(Float64Array.from({length:U},(ke,He)=>He*_e),ce),se=G}else X=y(0,Math.floor(ie/2),U);const we=v(X,se);if(ae!==null&&ae==="slaney")for(let _e=0;_eie)throw Error(`frame_length (${H}) may not be larger than fft_length (${ie})`);if(Pe!==H)throw new Error(`Length of the window (${Pe}) must equal frame_length (${H})`);if(J<=0)throw new Error("hop_length must be greater than zero");if(ae===null&&G!==null)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(ce){if(he!=="reflect")throw new Error(`pad_mode="${he}" not implemented yet.`);const be=Math.floor((ie-1)/2)+1;U=E(U,be,be)}let xe=Math.floor(1+Math.floor((U.length-H)/J));Me!==null&&xexe?j&&(Le=K):Le=Ie=K);const Ne=new i.FFT(ie),We=new Float64Array(ie),D=new Float64Array(Ne.outputBufferSize),ee=new Float32Array(Ae*Le);for(let be=0;be=1;--Fe)We[Fe]-=O*We[Fe-1];We[0]*=1-O}for(let Fe=0;FeMath.pow(he,.85));break;default:throw new Error(`Unknown window type ${Z}.`)}if(H&&(ce=ce.subarray(0,U)),J===null)return ce;if(U>J)throw new Error(`Length of the window (${U}) may not be larger than frame_length (${J})`);return ce}function R(U,Z){let H=44;const J=new ArrayBuffer(H+U.length*4),ie=new DataView(J);Q(ie,0,"RIFF"),ie.setUint32(4,36+U.length*4,!0),Q(ie,8,"WAVE"),Q(ie,12,"fmt "),ie.setUint32(16,16,!0),ie.setUint16(20,3,!0),ie.setUint16(22,1,!0),ie.setUint32(24,Z,!0),ie.setUint32(28,Z*4,!0),ie.setUint16(32,4,!0),ie.setUint16(34,32,!0),Q(ie,36,"data"),ie.setUint32(40,U.length*4,!0);for(let ae=0;ae{let ae=await ie.arrayBuffer();a.writeFileSync(J,Buffer.from(ae))};else throw new Error("Unable to save because filesystem is disabled in this environment.");await H(Z,this.toBlob())}}},"./src/utils/constants.js":(e,r,t)=>{t.r(r),t.d(r,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>i,FEATURE_EXTRACTOR_NAME:()=>n,GENERATION_CONFIG_NAME:()=>c,GITHUB_ISSUE_URL:()=>s,IMAGE_PROCESSOR_NAME:()=>o,PROCESSOR_NAME:()=>a});const s="https://github.com/huggingface/transformers.js/issues/new/choose",i="config.json",n="preprocessor_config.json",o=n,a="processor_config.json",l="chat_template.json",c="generation_config.json"},"./src/utils/core.js":(e,r,t)=>{t.r(r),t.d(r,{calculateDimensions:()=>c,calculateReflectOffset:()=>g,count:()=>v,dispatchCallback:()=>s,escapeRegExp:()=>n,isIntegralNumber:()=>a,isNullishDimension:()=>l,isTypedArray:()=>o,len:()=>A,mergeArrays:()=>u,pick:()=>P,pop:()=>p,product:()=>h,reverseDictionary:()=>i,saveBlob:()=>_});function s(y,k){y&&y(k)}function i(y){return Object.fromEntries(Object.entries(y).map(([k,E])=>[E,k]))}function n(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function o(y){var k,E,M;return((M=(E=(k=y==null?void 0:y.prototype)==null?void 0:k.__proto__)==null?void 0:E.constructor)==null?void 0:M.name)==="TypedArray"}function a(y){return Number.isInteger(y)||typeof y=="bigint"}function l(y){return y==null||y===-1}function c(y){const k=[];let E=y;for(;Array.isArray(E);)k.push(E.length),E=E[0];return k}function p(y,k,E=void 0){const M=y[k];if(M!==void 0)return delete y[k],M;if(E===void 0)throw Error(`Key ${k} does not exist in object.`);return E}function u(...y){return Array.prototype.concat.apply([],y)}function h(...y){return y.reduce((k,E)=>k.flatMap(M=>E.map(w=>[M,w])))}function g(y,k){return Math.abs((y+k)%(2*k)-k)}function _(y,k){const E=URL.createObjectURL(k),M=document.createElement("a");M.href=E,M.download=y,M.click(),M.remove(),URL.revokeObjectURL(E)}function P(y,k){return Object.assign({},...k.map(E=>{if(y[E]!==void 0)return{[E]:y[E]}}))}function A(y){let k=0;for(const E of y)++k;return k}function v(y,k){let E=0;for(const M of y)M===k&&++E;return E}},"./src/utils/data-structures.js":(e,r,t)=>{t.r(r),t.d(r,{CharTrie:()=>i,DictionarySplitter:()=>l,PriorityQueue:()=>s,TokenLattice:()=>o});class s{constructor(p=(h,g)=>h>g,u=1/0){this._heap=[],this._comparator=p,this._maxSize=u}get size(){return this._heap.length}isEmpty(){return this.size===0}peek(){return this._heap[0]}push(...p){return this.extend(p)}extend(p){for(const u of p)if(this.size0&&this._swap(0,u),this._heap.pop(),this._siftDown(),p}replace(p){const u=this.peek();return this._heap[0]=p,this._siftDown(),u}_parent(p){return(p+1>>>1)-1}_left(p){return(p<<1)+1}_right(p){return p+1<<1}_greater(p,u){return this._comparator(this._heap[p],this._heap[u])}_swap(p,u){const h=this._heap[p];this._heap[p]=this._heap[u],this._heap[u]=h}_siftUp(){this._siftUpFrom(this.size-1)}_siftUpFrom(p){for(;p>0&&this._greater(p,this._parent(p));)this._swap(p,this._parent(p)),p=this._parent(p)}_siftDown(){let p=0;for(;this._left(p)[]),this.endNodes=Array.from({length:this.len+1},()=>[]);const g=new a(this.bosTokenId,0,0,0,0),_=new a(this.eosTokenId,1,this.len,0,0);this.nodes.push(g.clone()),this.nodes.push(_.clone()),this.beginNodes[this.len].push(_),this.endNodes[0].push(g)}insert(p,u,h,g){const _=this.nodes.length,P=new a(g,_,p,u,h);this.beginNodes[p].push(P),this.endNodes[p+u].push(P),this.nodes.push(P)}viterbi(){const p=this.len;let u=0;for(;u<=p;){if(this.beginNodes[u].length==0)return[];for(let A of this.beginNodes[u]){A.prev=null;let v=0,y=null;for(let k of this.endNodes[u]){const E=k.backtraceScore+A.score;(y===null||E>v)&&(y=k.clone(),v=E)}if(y!==null)A.prev=y,A.backtraceScore=v;else return[]}++u}const h=[],_=this.beginNodes[p][0].prev;if(_===null)return[];let P=_.clone();for(;P.prev!==null;)h.push(P.clone()),P=P.clone().prev.clone();return h.reverse(),h}piece(p){return this.chars.slice(p.pos,p.pos+p.length).join("")}tokens(){return this.viterbi().map(u=>this.piece(u))}tokenIds(){return this.viterbi().map(u=>u.tokenId)}}class a{constructor(p,u,h,g,_){this.tokenId=p,this.nodeId=u,this.pos=h,this.length=g,this.score=_,this.prev=null,this.backtraceScore=0}clone(){const p=new a(this.tokenId,this.nodeId,this.pos,this.length,this.score);return p.prev=this.prev,p.backtraceScore=this.backtraceScore,p}}class l{constructor(p){this.trie=this._buildTrie(p)}_buildTrie(p){var h;const u=Object.create(null);for(const g of p){let _=u;for(let P=0;Pg&&u.push(p.slice(g,_)),u.push(A),_+=A.length,g=_):++_}return g{t.r(r),t.d(r,{DEVICE_TYPES:()=>s});const s=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"})},"./src/utils/dtypes.js":(e,r,t)=>{t.r(r),t.d(r,{DATA_TYPES:()=>o,DEFAULT_DEVICE_DTYPE_MAPPING:()=>a,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>n});var s=t("./src/env.js"),i=t("./src/utils/devices.js");const n=function(){let c;return async function(){if(c===void 0)if(!s.apis.IS_WEBGPU_AVAILABLE)c=!1;else try{c=(await navigator.gpu.requestAdapter()).features.has("shader-f16")}catch{c=!1}return c}}(),o=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16"}),a=Object.freeze({[i.DEVICE_TYPES.wasm]:o.q8}),l=Object.freeze({[o.fp32]:"",[o.fp16]:"_fp16",[o.int8]:"_int8",[o.uint8]:"_uint8",[o.q8]:"_quantized",[o.q4]:"_q4",[o.q4f16]:"_q4f16",[o.bnb4]:"_bnb4"})},"./src/utils/generic.js":(e,r,t)=>{t.r(r),t.d(r,{Callable:()=>s});const s=class{constructor(){let i=function(...n){return i._call(...n)};return Object.setPrototypeOf(i,new.target.prototype)}_call(...i){throw Error("Must implement _call method in subclass")}}},"./src/utils/hub.js":(e,r,t)=>{t.r(r),t.d(r,{MAX_EXTERNAL_DATA_CHUNKS:()=>a,getFile:()=>g,getModelFile:()=>y,getModelJSON:()=>k});var s=t("?7a2c"),i=t("?a42a"),n=t("./src/env.js"),o=t("./src/utils/core.js");const a=100,l={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};class c{constructor(x){if(this.filePath=x,this.headers=new Headers,this.exists=s.existsSync(x),this.exists){this.status=200,this.statusText="OK";let $=s.statSync(x);this.headers.set("content-length",$.size.toString()),this.updateContentType();const z=s.createReadStream(x);this.body=new ReadableStream({start(R){z.on("data",Q=>R.enqueue(Q)),z.on("end",()=>R.close()),z.on("error",Q=>R.error(Q))},cancel(){z.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const x=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",l[x]??"application/octet-stream")}clone(){let x=new c(this.filePath);return x.exists=this.exists,x.status=this.status,x.statusText=this.statusText,x.headers=new Headers(this.headers),x}async arrayBuffer(){return(await s.promises.readFile(this.filePath)).buffer}async blob(){const x=await s.promises.readFile(this.filePath);return new Blob([x],{type:this.headers.get("content-type")})}async text(){return await s.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function p(w,x=null,$=null){let z;try{z=new URL(w)}catch{return!1}return!(x&&!x.includes(z.protocol)||$&&!$.includes(z.hostname))}const u=/^(\b[\w\-.]+\b\/)?\b[\w\-.]{1,96}\b$/;function h(w){return!(!u.test(w)||w.includes("..")||w.includes("--")||w.endsWith(".git")||w.endsWith(".ipynb"))}async function g(w){var x;if(n.env.useFS&&!p(w,["http:","https:","blob:"]))return new c(w.toString());if(typeof process<"u"&&((x=process==null?void 0:process.release)==null?void 0:x.name)==="node"){const $=!!(Fs!=null&&Fs.TESTING_REMOTELY),z=n.env.version,R=new Headers;if(R.set("User-Agent",`transformers.js/${z}; is_ci/${$};`),p(w,["http:","https:"],["huggingface.co","hf.co"])){const q=(Fs==null?void 0:Fs.HF_TOKEN)??(Fs==null?void 0:Fs.HF_ACCESS_TOKEN);q&&R.set("Authorization",`Bearer ${q}`)}return fetch(w,{headers:R})}else return fetch(w)}const _={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};function P(w,x,$){if(!$)return null;const z=_[w]??`Error (${w}) occurred while trying to load file`;throw Error(`${z}: "${x}".`)}class A{constructor(x){this.path=x}async match(x){let $=i.join(this.path,x),z=new c($);if(z.exists)return z}async put(x,$,z=void 0){let R=i.join(this.path,x);try{const Q=$.headers.get("Content-Length"),q=parseInt(Q??"0");let U=0;await s.promises.mkdir(i.dirname(R),{recursive:!0});const Z=s.createWriteStream(R),H=$.body.getReader();for(;;){const{done:J,value:ie}=await H.read();if(J)break;await new Promise((ce,he)=>{Z.write(ie,N=>{if(N){he(N);return}ce()})}),U+=ie.length;const ae=q?U/q*100:0;z==null||z({progress:ae,loaded:U,total:q})}Z.close()}catch(Q){try{await s.promises.unlink(R)}catch{}throw Q}}}async function v(w,...x){for(let $ of x)try{let z=await w.match($);if(z)return z}catch{continue}}async function y(w,x,$=!0,z={},R=!1){if(!n.env.allowLocalModels){if(z.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!n.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}(0,o.dispatchCallback)(z.progress_callback,{status:"initiate",name:w,file:x});let Q;if(!Q&&n.env.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");try{Q=await caches.open("transformers-cache")}catch(se){console.warn("An error occurred while opening the browser cache:",se)}}if(!Q&&n.env.useFSCache&&(Q=new A(z.cache_dir??n.env.cacheDir)),!Q&&n.env.useCustomCache){if(!n.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!n.env.customCache.match||!n.env.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");Q=n.env.customCache}const q=z.revision??"main",U=M(w,x),Z=h(w),H=Z?M(n.env.localModelPath,U):U,J=M(n.env.remoteHost,n.env.remotePathTemplate.replaceAll("{model}",w).replaceAll("{revision}",encodeURIComponent(q)),x);let ie;const ae=Q instanceof A?q==="main"?U:M(w,q,x):J;let ce=!1,he;Q&&(he=await v(Q,H,ae));const N=he!==void 0;if(he===void 0){if(n.env.allowLocalModels)if(p(U,["http:","https:"])){if(z.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${U}.`);if(!n.env.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${U}.`)}else try{he=await g(H),ie=H}catch(X){console.warn(`Unable to load from local path "${H}": "${X}"`)}if(he===void 0||he.status===404){if(z.local_files_only||!n.env.allowRemoteModels){if($)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${H}".`);return null}if(!Z)throw Error(`Local file missing at "${H}" and download aborted due to invalid model ID "${w}".`);if(he=await g(J),he.status!==200)return P(he.status,J,$);ie=ae}ce=Q&&typeof Response<"u"&&he instanceof Response&&he.status===200}(0,o.dispatchCallback)(z.progress_callback,{status:"download",name:w,file:x});let O;if(!(n.apis.IS_NODE_ENV&&R)){let se;z.progress_callback?N&&typeof navigator<"u"&&/firefox/i.test(navigator.userAgent)?(se=new Uint8Array(await he.arrayBuffer()),(0,o.dispatchCallback)(z.progress_callback,{status:"progress",name:w,file:x,progress:100,loaded:se.length,total:se.length})):se=await E(he,X=>{(0,o.dispatchCallback)(z.progress_callback,{status:"progress",name:w,file:x,...X})}):se=new Uint8Array(await he.arrayBuffer()),O=se}if(ce&&ie&&await Q.match(ie)===void 0&&(O?await Q.put(ie,new Response(O,{headers:he.headers})).catch(se=>{console.warn(`Unable to add response to browser cache: ${se}.`)}):await Q.put(ie,he,z.progress_callback)),(0,o.dispatchCallback)(z.progress_callback,{status:"done",name:w,file:x}),O){if(R)throw new Error("Cannot return path in a browser environment.");return O}if(he instanceof c)return he.filePath;const G=await Q.match(ie);if(G instanceof c)return G.filePath;throw new Error("Unable to return path for response.")}async function k(w,x,$=!0,z={}){const R=await y(w,x,$,z,!1);if(R===null)return{};const q=new TextDecoder("utf-8").decode(R);return JSON.parse(q)}async function E(w,x){const $=w.headers.get("Content-Length");$===null&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let z=parseInt($??"0"),R=new Uint8Array(z),Q=0;const q=w.body.getReader();async function U(){const{done:Z,value:H}=await q.read();if(Z)return;const J=Q+H.length;if(J>z){z=J;const ae=new Uint8Array(z);ae.set(R),R=ae}R.set(H,Q),Q=J;const ie=Q/z*100;return x({progress:ie,loaded:Q,total:z}),U()}return await U(),R}function M(...w){return w=w.map((x,$)=>($&&(x=x.replace(new RegExp("^/"),"")),$!==w.length-1&&(x=x.replace(new RegExp("/$"),"")),x)),w.join("/")}},"./src/utils/image.js":(e,r,t)=>{t.r(r),t.d(r,{RawImage:()=>_,load_image:()=>P});var s=t("./src/utils/core.js"),i=t("./src/utils/hub.js"),n=t("./src/env.js"),o=t("./src/utils/tensor.js"),a=t("?2b25");let l,c,p;const u=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV;if(u)l=(A,v)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(A,v)},p=self.createImageBitmap,c=self.ImageData;else if(a)p=async A=>{const y=(await A.metadata()).channels,{data:k,info:E}=await A.rotate().raw().toBuffer({resolveWithObject:!0}),M=new _(new Uint8ClampedArray(k),E.width,E.height,E.channels);return y!==void 0&&y!==E.channels&&M.convert(y),M};else throw new Error("Unable to load image processing library.");const h={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},g=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class _{constructor(v,y,k,E){this.data=v,this.width=y,this.height=k,this.channels=E}get size(){return[this.width,this.height]}static async read(v){if(v instanceof _)return v;if(typeof v=="string"||v instanceof URL)return await this.fromURL(v);if(v instanceof Blob)return await this.fromBlob(v);if(typeof HTMLCanvasElement<"u"&&v instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&v instanceof OffscreenCanvas)return this.fromCanvas(v);throw new Error(`Unsupported input type: ${typeof v}`)}static fromCanvas(v){if(!u)throw new Error("fromCanvas() is only supported in browser environments.");const k=v.getContext("2d").getImageData(0,0,v.width,v.height).data;return new _(k,v.width,v.height,4)}static async fromURL(v){const y=await(0,i.getFile)(v);if(y.status!==200)throw new Error(`Unable to read image from "${v}" (${y.status} ${y.statusText})`);const k=await y.blob();return this.fromBlob(k)}static async fromBlob(v){if(u){const y=await p(v),k=l(y.width,y.height).getContext("2d");return k.drawImage(y,0,0),new this(k.getImageData(0,0,y.width,y.height).data,y.width,y.height,4)}else{const y=a(await v.arrayBuffer());return await p(y)}}static fromTensor(v,y="CHW"){if(v.dims.length!==3)throw new Error(`Tensor should have 3 dimensions, but has ${v.dims.length} dimensions.`);if(y==="CHW")v=v.transpose(1,2,0);else if(y!=="HWC")throw new Error(`Unsupported channel format: ${y}`);if(!(v.data instanceof Uint8ClampedArray||v.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${v.type}`);switch(v.dims[2]){case 1:case 2:case 3:case 4:return new _(v.data,v.dims[1],v.dims[0],v.dims[2]);default:throw new Error(`Unsupported number of channels: ${v.dims[2]}`)}}grayscale(){if(this.channels===1)return this;const v=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let y=0,k=0;y=0?$=k:R=-k,E>=0?z=E:Q=-E,x.drawImage(w,$,z,v,y,R,Q,v,y),new _(x.getImageData(0,0,v,y).data,v,y,4).convert(M)}else{let M=this.toSharp();if(k>=0&&E>=0)M=M.extract({left:Math.floor(k),top:Math.floor(E),width:v,height:y});else if(k<=0&&E<=0){const w=Math.floor(-E),x=Math.floor(-k);M=M.extend({top:w,left:x,right:v-this.width-x,bottom:y-this.height-w})}else{let w=[0,0],x=0;E<0?(w[0]=Math.floor(-E),w[1]=y-this.height-w[0]):x=Math.floor(E);let $=[0,0],z=0;k<0?($[0]=Math.floor(-k),$[1]=v-this.width-$[0]):z=Math.floor(k),M=M.extend({top:w[0],bottom:w[1],left:$[0],right:$[1]}).extract({left:z,top:x,width:v,height:y})}return await p(M)}}async toBlob(v="image/png",y=1){if(!u)throw new Error("toBlob() is only supported in browser environments.");return await this.toCanvas().convertToBlob({type:v,quality:y})}toTensor(v="CHW"){let y=new o.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if(v!=="HWC")if(v==="CHW")y=y.permute(2,0,1);else throw new Error(`Unsupported channel format: ${v}`);return y}toCanvas(){if(!u)throw new Error("toCanvas() is only supported in browser environments.");const v=this.clone().rgba(),y=l(v.width,v.height),k=new c(v.data,v.width,v.height);return y.getContext("2d").putImageData(k,0,0),y}split(){const{data:v,width:y,height:k,channels:E}=this,M=v.constructor,w=v.length/E,x=Array.from({length:E},()=>new M(w));for(let $=0;$new _($,y,k,1))}_update(v,y,k,E=null){return this.data=v,this.width=y,this.height=k,E!==null&&(this.channels=E),this}clone(){return new _(this.data.slice(),this.width,this.height,this.channels)}convert(v){if(this.channels===v)return this;switch(v){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(v){if(u){if(n.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const y=v.split(".").pop().toLowerCase(),k=g.get(y)??"image/png",E=await this.toBlob(k);(0,s.saveBlob)(v,E)}else{if(n.apis.IS_FS_AVAILABLE)return await this.toSharp().toFile(v);throw new Error("Unable to save the image because filesystem is disabled in this environment.")}}toSharp(){if(u)throw new Error("toSharp() is only supported in server-side environments.");return a(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}const P=_.read.bind(_)},"./src/utils/maths.js":(e,r,t)=>{t.r(r),t.d(r,{FFT:()=>P,bankers_round:()=>y,cos_sim:()=>l,dot:()=>a,dynamic_time_warping:()=>k,interpolate_data:()=>s,log_softmax:()=>o,magnitude:()=>c,max:()=>u,medianFilter:()=>A,min:()=>p,permute_data:()=>i,round:()=>v,softmax:()=>n});function s(E,[M,w,x],[$,z],R="bilinear",Q=!1){const q=z/x,U=$/w,Z=new E.constructor($*z*M),H=w*x,J=$*z;for(let ie=0;ie<$;++ie)for(let ae=0;ae=0;--Q)$[Q]=q,x[Q]=M[w[Q]],q*=x[Q];const z=w.map((Q,q)=>$[w.indexOf(q)]),R=new E.constructor(E.length);for(let Q=0;Q=0;--U)q+=Z%M[U]*z[U],Z=Math.floor(Z/M[U]);R[q]=E[Q]}return[R,x]}function n(E){const M=u(E)[0],w=E.map(z=>Math.exp(z-M)),x=w.reduce((z,R)=>z+R,0);return w.map(z=>z/x)}function o(E){const M=u(E)[0];let w=0;for(let z=0;zz-M-x)}function a(E,M){let w=0;for(let x=0;xM+w*w,0))}function p(E){if(E.length===0)throw Error("Array must not be empty");let M=E[0],w=0;for(let x=1;xM&&(M=E[x],w=x);return[M,w]}function h(E){return E>0&&(E&E-1)===0}class g{constructor(M){if(this.size=M|0,this.size<=1||!h(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=M<<1,this.table=new Float64Array(this.size*2);for(let x=0;xx;x<<=1)++w;this._width=w%2===0?w-1:w,this._bitrev=new Int32Array(1<>>$&3)<>>1);for(let $=0;$>>1]=M[$];return x}toComplexArray(M,w){const x=w||this.createComplexArray();for(let $=0;$>>1],x[$+1]=0;return x}transform(M,w){if(M===w)throw new Error("Input and output buffers must be different");this._transform4(M,w,1)}realTransform(M,w){if(M===w)throw new Error("Input and output buffers must be different");this._realTransform4(M,w,1)}inverseTransform(M,w){if(M===w)throw new Error("Input and output buffers must be different");this._transform4(M,w,-1);for(let x=0;x>=2;R>=2;R>>=2){Q=$/R<<1;const J=Q>>>2;for(q=0;q<$;q+=Q){const ie=q+J-1;for(let ae=q,ce=0;ae>>1,R>>>1)}else for(q=0,U=0;q<$;q+=Q,++U){const ie=Z[U];this._singleRealTransform4(w,M,q,ie>>>1,R>>>1,x)}const H=this.table;for(R>>=2;R>=2;R>>=2){Q=$/R<<1;const ie=Q>>>1,ae=ie>>>1,ce=ae>>>1;for(q=0;q<$;q+=Q)for(let he=0,N=0;he<=ce;he+=2,N+=R){const O=q+he,G=O+ae,se=G+ae,X=se+ae,we=M[O],_e=M[O+1],ke=M[G],He=M[G+1],Me=M[se],K=M[se+1],j=M[X],me=M[X+1],Pe=we,xe=_e,Ae=H[N],Ie=x*H[N+1],Le=ke*Ae-He*Ie,Ne=ke*Ie+He*Ae,We=H[2*N],D=x*H[2*N+1],ee=Me*We-K*D,B=Me*D+K*We,te=H[3*N],de=x*H[3*N+1],be=j*te-me*de,ve=j*de+me*te,Re=Pe+ee,Fe=xe+B,je=Pe-ee,qe=xe-B,Xe=Le+be,ut=Ne+ve,wt=x*(Le-be),nr=x*(Ne-ve);if(M[O]=Re+Xe,M[O+1]=Fe+ut,M[G]=je+nr,M[G+1]=qe-wt,he===0){M[se]=Re-Xe,M[se+1]=Fe-ut;continue}if(he===ce)continue;const jt=q+ae-he,dr=q+ie-he;M[jt]=je-x*nr,M[jt+1]=-qe-x*wt,M[dr]=Re-x*Xe,M[dr+1]=-Fe+x*ut}}const J=$>>>1;for(let ie=2;ie>1;++Z){const H=(Z+1-M)**2/2,J=Math.sqrt(q**2+U**2)**H,ie=H*Math.atan2(U,q),ae=2*Z;z[ae]=J*Math.cos(ie),z[ae+1]=J*Math.sin(ie),R[ae]=z[ae],R[ae+1]=-z[ae+1]}this._slicedChirpBuffer=z.subarray(w,x),this._f=new g($>>1),this._f.transform(this._chirpBuffer,R)}_transform(M,w,x){const $=this._buffer1,z=this._buffer2,R=this._outBuffer1,Q=this._outBuffer2,q=this._chirpBuffer,U=this._slicedChirpBuffer,Z=this._a;if(x)for(let H=0;H>1,ae=w[ie];$[H]=ae*U[H],$[J]=ae*U[J]}else for(let H=0;H=E.length&&(q=2*(E.length-1)-q),x[R++]=E[q]}x.sort(),w[z]=x[$]}return w}function v(E,M){const w=Math.pow(10,M);return Math.round(E*w)/w}function y(E){const M=Math.round(E);return Math.abs(E)%1===.5?M%2===0?M:M-1:M}function k(E){const M=E.length,w=E[0].length,x=[M+1,w+1],$=Array.from({length:x[0]},()=>Array(x[1]).fill(1/0));$[0][0]=0;const z=Array.from({length:x[0]},()=>Array(x[1]).fill(-1));for(let Z=1;Z0||Q>0;)switch(q.push(R-1),U.push(Q-1),z[R][Q]){case 0:--R,--Q;break;case 1:--R;break;case 2:--Q;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${R}, ${Q}]. Please file a bug report.`)}return q.reverse(),U.reverse(),[q,U]}},"./src/utils/tensor.js":(e,r,t)=>{t.r(r),t.d(r,{DataTypeMap:()=>o,Tensor:()=>a,cat:()=>w,full:()=>U,full_like:()=>Z,interpolate:()=>p,interpolate_4d:()=>u,layer_norm:()=>y,matmul:()=>h,mean:()=>R,mean_pooling:()=>v,ones:()=>H,ones_like:()=>J,permute:()=>c,quantize_embeddings:()=>he,rand:()=>ce,rfft:()=>g,slice:()=>A,stack:()=>x,std_mean:()=>z,topk:()=>_,zeros:()=>ie,zeros_like:()=>ae});var s=t("./src/utils/maths.js"),i=t("./src/backends/onnx.js"),n=t("./src/ops/registry.js");const o=Object.freeze({float32:Float32Array,float16:typeof Float16Array<"u"?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array});class a{constructor(...O){re(this,"ort_tensor");return(0,i.isONNXTensor)(O[0])?this.ort_tensor=O[0]:this.ort_tensor=new i.Tensor(O[0],O[1],O[2]),new Proxy(this,{get:(G,se)=>{if(typeof se=="string"){let X=Number(se);if(Number.isInteger(X))return G._getitem(X)}return G[se]},set:(G,se,X)=>G[se]=X})}get dims(){return this.ort_tensor.dims}set dims(O){this.ort_tensor.dims=O}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[O,...G]=this.dims;if(G.length>0){const se=G.reduce((X,we)=>X*we);for(let X=0;X0){const X=se.reduce((we,_e)=>we*_e);return this._subarray(O,X,se)}else return new a(this.type,[this.data[O]],se)}indexOf(O){const G=this.data;for(let se=0;seme)throw new Error(`Invalid slice: ${K}`);const Pe=[Math.max(j,0),Math.min(me,this.dims[Me])];se.push(Pe),G.push(Pe[1]-Pe[0])}else throw new Error(`Invalid slice: ${K}`)}const X=se.map(([Me,K])=>K-Me),we=X.reduce((Me,K)=>Me*K),_e=this.data,ke=new _e.constructor(we),He=this.stride();for(let Me=0;Me=0;--j){const Pe=X[j];K+=(me%Pe+se[j][0])*He[j],me=Math.floor(me/Pe)}ke[Me]=_e[K]}return new a(this.type,ke,G)}permute(...O){return c(this,O)}transpose(...O){return this.permute(...O)}sum(O=null,G=!1){return this.norm(1,O,G)}norm(O="fro",G=null,se=!1){if(O==="fro")O=2;else if(typeof O=="string")throw Error(`Unsupported norm: ${O}`);const X=this.data,we=(Me,K)=>Me+K**O;if(G===null){const Me=X.reduce(we,0)**(1/O);return new a(this.type,[Me],[])}const[_e,ke,He]=$(we,this,G,se);if(O!==1)for(let Me=0;Me=0;--He){const j=this.dims[He];if(He!==G){const me=Me%j;ke+=me*K,K*=this.dims[He]}Me=Math.floor(Me/j)}X[_e]/=we[ke]}return this}normalize(O=2,G=1){return this.clone().normalize_(O,G)}stride(){return Q(this.dims)}squeeze(O=null){return new a(this.type,this.data,k(this.dims,O))}squeeze_(O=null){return this.dims=k(this.dims,O),this}unsqueeze(O=null){return new a(this.type,this.data,E(this.dims,O))}unsqueeze_(O=null){return this.dims=E(this.dims,O),this}flatten_(O=0,G=-1){G=(G+this.dims.length)%this.dims.length;let se=this.dims.slice(0,O),X=this.dims.slice(O,G+1),we=this.dims.slice(G+1);return this.dims=[...se,X.reduce((_e,ke)=>_e*ke,1),...we],this}flatten(O=0,G=-1){return this.clone().flatten_(O,G)}view(...O){let G=-1;for(let X=0;Xke!==G?we*_e:we,1);O[G]=se.length/X}return new a(this.type,se,O)}neg_(){const O=this.data;for(let G=0;GO?1:0;return new a("bool",G,this.dims)}lt(O){const G=new Uint8Array(this.data.length),se=this.data;for(let X=0;XMath.min(_e,ke),this,O,G,1/0);return new a(se,X,we)}max(O=null,G=!1){if(O===null){const _e=(0,s.max)(this.data)[0];return new a(this.type,[_e],[])}const[se,X,we]=$((_e,ke)=>Math.max(_e,ke),this,O,G,-1/0);return new a(se,X,we)}argmin(O=null,G=!1){if(O!==null)throw new Error("`dim !== null` not yet implemented.");const se=(0,s.min)(this.data)[1];return new a("int64",[BigInt(se)],[])}argmax(O=null,G=!1){if(O!==null)throw new Error("`dim !== null` not yet implemented.");const se=(0,s.max)(this.data)[1];return new a("int64",[BigInt(se)],[])}to(O){if(this.type===O)return this;if(!o.hasOwnProperty(O))throw new Error(`Unsupported type: ${O}`);let G;const se=["int64","uint64"].includes(this.type),X=["int64","uint64"].includes(O);return se&&!X?G=Number:!se&&X&&(G=BigInt),new a(O,o[O].from(this.data,G),this.dims)}}function l(N,O){const G=N.length,se=O.reduce((we,_e)=>we*_e);if(G!==se)throw Error(`cannot reshape array of size ${G} into shape (${O})`);let X=N;for(let we=O.length-1;we>=0;we--)X=X.reduce((_e,ke)=>{let He=_e[_e.length-1];return He.lengthnew a("int64",N,[N.length]);async function A(N,O,G,se,X){return await(await n.TensorOpRegistry.slice)({x:N,s:P(O),e:P(G),a:P(se),t:P(X??new Array(se.length).fill(1))})}function v(N,O){const G=N.data,se=O.data,X=[N.dims[0],N.dims[2]],we=new G.constructor(X[0]*X[1]),[_e,ke,He]=N.dims;let Me=0;for(let K=0;K<_e;++K){const j=K*He*ke;for(let me=0;meG!==1):typeof O=="number"?N[O]===1&&N.splice(O,1):Array.isArray(O)&&(N=N.filter((G,se)=>G!==1||!O.includes(se))),N}function E(N,O){return O=M(O,N.length+1),N=N.slice(),N.splice(O,0,1),N}function M(N,O,G=null,se=!0){if(N<-O||N>=O){if(se)throw new Error(`IndexError: index ${N} is out of bounds for dimension${G===null?"":" "+G} with size ${O}`);return N<-O?0:O}return N<0&&(N=(N%O+O)%O),N}function w(N,O=0){O=M(O,N[0].dims.length);const G=N[0].dims.slice();G[O]=N.reduce((_e,ke)=>_e+ke.dims[O],0);const se=G.reduce((_e,ke)=>_e*ke,1),X=new N[0].data.constructor(se),we=N[0].type;if(O===0){let _e=0;for(const ke of N){const He=ke.data;X.set(He,_e),_e+=He.length}}else{let _e=0;for(let ke=0;ke=0;--me){const Ae=Me[me];let Ie=Pe%Ae;me===O&&(Ie+=_e),j+=Ie*xe,xe*=G[me],Pe=Math.floor(Pe/Ae)}X[j]=He[K]}_e+=Me[O]}}return new a(we,X,G)}function x(N,O=0){return w(N.map(G=>G.unsqueeze(O)),O)}function $(N,O,G=null,se=!1,X=null){const we=O.data,_e=O.dims;G=M(G,_e.length);const ke=_e.slice();ke[G]=1;const He=new we.constructor(we.length/_e[G]);X!==null&&He.fill(X);for(let Me=0;Me=0;--j){const xe=_e[j];if(j!==G){const Ae=me%xe;K+=Ae*Pe,Pe*=ke[j]}me=Math.floor(me/xe)}He[K]=N(He[K],we[Me],Me,K)}return se||ke.splice(G,1),[O.type,He,ke]}function z(N,O=null,G=1,se=!1){const X=N.data,we=N.dims;if(O===null){const Pe=X.reduce((Le,Ne)=>Le+Ne,0)/X.length,xe=Math.sqrt(X.reduce((Le,Ne)=>Le+(Ne-Pe)**2,0)/(X.length-G)),Ae=new a(N.type,[Pe],[]);return[new a(N.type,[xe],[]),Ae]}O=M(O,we.length);const _e=R(N,O,se),ke=_e.data,[He,Me,K]=$((me,Pe,xe,Ae)=>me+(Pe-ke[Ae])**2,N,O,se);for(let me=0;meMe+K,0);return new a(N.type,[He/X.length],[])}O=M(O,se.length);const[we,_e,ke]=$((He,Me)=>He+Me,N,O,G);if(se[O]!==1)for(let He=0;He<_e.length;++He)_e[He]/=se[O];return new a(we,_e,ke)}function Q(N){const O=new Array(N.length);for(let G=N.length-1,se=1;G>=0;--G)O[G]=se,se*=N[G];return O}function q(N,O,G,se){const X=N.reduce((we,_e)=>we*_e,1);return new a(G,new se(X).fill(O),N)}function U(N,O){let G,se;if(typeof O=="number")G="float32",se=Float32Array;else if(typeof O=="bigint")G="int64",se=BigInt64Array;else if(typeof O=="boolean")G="bool",se=Uint8Array;else throw new Error(`Unsupported data type: ${typeof O}`);return q(N,O,G,se)}function Z(N,O){return U(N.dims,O)}function H(N){return q(N,1n,"int64",BigInt64Array)}function J(N){return H(N.dims)}function ie(N){return q(N,0n,"int64",BigInt64Array)}function ae(N){return ie(N.dims)}function ce(N){const O=N.reduce((G,se)=>G*se,1);return new a("float32",Float32Array.from({length:O},()=>Math.random()),N)}function he(N,O){if(N.dims.length!==2)throw new Error("The tensor must have 2 dimensions");if(N.dims.at(-1)%8!==0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(O))throw new Error("The precision must be either 'binary' or 'ubinary'");const G=O==="binary",se=G?"int8":"uint8",X=G?Int8Array:Uint8Array,we=N.data,_e=new X(we.length/8);for(let ke=0;ke0?1:0,Me=Math.floor(ke/8),K=ke%8;_e[Me]|=He<<7-K,G&&K===0&&(_e[Me]-=128)}return new a(se,_e,[N.dims[0],N.dims[1]/8])}},"./src/utils/video.js":(e,r,t)=>{t.r(r),t.d(r,{RawVideo:()=>o,RawVideoFrame:()=>n,load_video:()=>a});var s=t("./src/utils/image.js"),i=t("./src/env.js");class n{constructor(c,p){this.image=c,this.timestamp=p}}class o{constructor(c,p){c.length>0&&c[0]instanceof s.RawImage&&(c=c.map((u,h)=>new n(u,(h+1)/(c.length+1)*p))),this.frames=c,this.duration=p}get width(){return this.frames[0].image.width}get height(){return this.frames[0].image.height}get fps(){return this.frames.length/this.duration}}async function a(l,{num_frames:c=null,fps:p=null}={}){if(!i.apis.IS_BROWSER_ENV)throw new Error("`load_video` is currently only supported in browser environments.");if(c==null&&p==null)throw new Error("Either num_frames or fps must be provided.");const u=[],h=document.createElement("video");if(h.crossOrigin="anonymous",h.muted=!0,typeof l=="string")h.src=l;else if(l instanceof Blob)h.src=URL.createObjectURL(l);else if(l instanceof HTMLVideoElement)h.src=l.src;else throw new Error("Invalid URL or video element provided.");if(await new Promise(k=>h.onloadedmetadata=k),h.seekable.start(0)===h.seekable.end(0)){const E=await(await fetch(h.src)).blob();h.src=URL.createObjectURL(E),await new Promise(M=>h.onloadedmetadata=M)}const g=h.duration;let _,P;c!=null?(_=c,P=c===1?0:g/(c-1)):(P=1/p,_=Math.floor(g/P));let A=[];for(let k=0;k<_;++k)A.push(c===1?g/2:k*P);const v=document.createElement("canvas");v.width=h.videoWidth,v.height=h.videoHeight;const y=v.getContext("2d",{willReadFrequently:!0});for(const k of A){h.currentTime=k,await new Promise(x=>{h.onseeked=x}),y.drawImage(h,0,0,v.width,v.height);const E=y.getImageData(0,0,v.width,v.height),M=new s.RawImage(E.data,v.width,v.height,4),w=new n(M,k);u.push(w)}return h.remove(),new o(u,g)}}},Qw={};function Ft(e){var r=Qw[e];if(r!==void 0)return r.exports;var t=Qw[e]={exports:{}};return uT[e](t,t.exports,Ft),t.exports}(()=>{var e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,r;Ft.t=function(t,s){if(s&1&&(t=this(t)),s&8||typeof t=="object"&&t&&(s&4&&t.__esModule||s&16&&typeof t.then=="function"))return t;var i=Object.create(null);Ft.r(i);var n={};r=r||[null,e({}),e([]),e(e)];for(var o=s&2&&t;typeof o=="object"&&!~r.indexOf(o);o=e(o))Object.getOwnPropertyNames(o).forEach(a=>n[a]=()=>t[a]);return n.default=()=>t,Ft.d(i,n),i}})(),Ft.d=(e,r)=>{for(var t in r)Ft.o(r,t)&&!Ft.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},Ft.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),Ft.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var f={};(()=>{/*!*****************************!*\ - !*** ./src/transformers.js ***! - \*****************************/Ft.r(f),Ft.d(f,{ASTFeatureExtractor:()=>u.ASTFeatureExtractor,ASTForAudioClassification:()=>t.ASTForAudioClassification,ASTModel:()=>t.ASTModel,ASTPreTrainedModel:()=>t.ASTPreTrainedModel,AlbertForMaskedLM:()=>t.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>t.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>t.AlbertForSequenceClassification,AlbertModel:()=>t.AlbertModel,AlbertPreTrainedModel:()=>t.AlbertPreTrainedModel,AlbertTokenizer:()=>s.AlbertTokenizer,AudioClassificationPipeline:()=>r.AudioClassificationPipeline,AutoConfig:()=>i.AutoConfig,AutoFeatureExtractor:()=>h.AutoFeatureExtractor,AutoImageProcessor:()=>P.AutoImageProcessor,AutoModel:()=>t.AutoModel,AutoModelForAudioClassification:()=>t.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>t.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>t.AutoModelForAudioTextToText,AutoModelForCTC:()=>t.AutoModelForCTC,AutoModelForCausalLM:()=>t.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>t.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>t.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>t.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>t.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>t.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>t.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>t.AutoModelForImageTextToText,AutoModelForImageToImage:()=>t.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>t.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>t.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>t.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>t.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>t.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>t.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>t.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>t.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>t.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>t.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>t.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>t.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>t.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>t.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>t.AutoModelForVision2Seq,AutoModelForXVector:()=>t.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>t.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>y.AutoProcessor,AutoTokenizer:()=>s.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>r.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>r.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>t.BartForConditionalGeneration,BartForSequenceClassification:()=>t.BartForSequenceClassification,BartModel:()=>t.BartModel,BartPretrainedModel:()=>t.BartPretrainedModel,BartTokenizer:()=>s.BartTokenizer,BaseModelOutput:()=>t.BaseModelOutput,BaseStreamer:()=>k.BaseStreamer,BeitFeatureExtractor:()=>_.BeitFeatureExtractor,BeitForImageClassification:()=>t.BeitForImageClassification,BeitModel:()=>t.BeitModel,BeitPreTrainedModel:()=>t.BeitPreTrainedModel,BertForMaskedLM:()=>t.BertForMaskedLM,BertForQuestionAnswering:()=>t.BertForQuestionAnswering,BertForSequenceClassification:()=>t.BertForSequenceClassification,BertForTokenClassification:()=>t.BertForTokenClassification,BertModel:()=>t.BertModel,BertPreTrainedModel:()=>t.BertPreTrainedModel,BertTokenizer:()=>s.BertTokenizer,BitImageProcessor:()=>_.BitImageProcessor,BlenderbotForConditionalGeneration:()=>t.BlenderbotForConditionalGeneration,BlenderbotModel:()=>t.BlenderbotModel,BlenderbotPreTrainedModel:()=>t.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>t.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>t.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>t.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>s.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>s.BlenderbotTokenizer,BloomForCausalLM:()=>t.BloomForCausalLM,BloomModel:()=>t.BloomModel,BloomPreTrainedModel:()=>t.BloomPreTrainedModel,BloomTokenizer:()=>s.BloomTokenizer,CLIPFeatureExtractor:()=>_.CLIPFeatureExtractor,CLIPImageProcessor:()=>_.CLIPImageProcessor,CLIPModel:()=>t.CLIPModel,CLIPPreTrainedModel:()=>t.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>t.CLIPSegForImageSegmentation,CLIPSegModel:()=>t.CLIPSegModel,CLIPSegPreTrainedModel:()=>t.CLIPSegPreTrainedModel,CLIPTextModel:()=>t.CLIPTextModel,CLIPTextModelWithProjection:()=>t.CLIPTextModelWithProjection,CLIPTokenizer:()=>s.CLIPTokenizer,CLIPVisionModel:()=>t.CLIPVisionModel,CLIPVisionModelWithProjection:()=>t.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>t.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>t.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>t.CamembertForSequenceClassification,CamembertForTokenClassification:()=>t.CamembertForTokenClassification,CamembertModel:()=>t.CamembertModel,CamembertPreTrainedModel:()=>t.CamembertPreTrainedModel,CamembertTokenizer:()=>s.CamembertTokenizer,CausalLMOutput:()=>t.CausalLMOutput,CausalLMOutputWithPast:()=>t.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>_.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>t.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>t.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>t.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>u.ClapFeatureExtractor,ClapModel:()=>t.ClapModel,ClapPreTrainedModel:()=>t.ClapPreTrainedModel,ClapTextModelWithProjection:()=>t.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>M.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>t.CodeGenForCausalLM,CodeGenModel:()=>t.CodeGenModel,CodeGenPreTrainedModel:()=>t.CodeGenPreTrainedModel,CodeGenTokenizer:()=>s.CodeGenTokenizer,CodeLlamaTokenizer:()=>s.CodeLlamaTokenizer,CohereForCausalLM:()=>t.CohereForCausalLM,CohereModel:()=>t.CohereModel,CoherePreTrainedModel:()=>t.CoherePreTrainedModel,CohereTokenizer:()=>s.CohereTokenizer,ConvBertForMaskedLM:()=>t.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>t.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>t.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>t.ConvBertForTokenClassification,ConvBertModel:()=>t.ConvBertModel,ConvBertPreTrainedModel:()=>t.ConvBertPreTrainedModel,ConvBertTokenizer:()=>s.ConvBertTokenizer,ConvNextFeatureExtractor:()=>_.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>t.ConvNextForImageClassification,ConvNextImageProcessor:()=>_.ConvNextImageProcessor,ConvNextModel:()=>t.ConvNextModel,ConvNextPreTrainedModel:()=>t.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>t.ConvNextV2ForImageClassification,ConvNextV2Model:()=>t.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>t.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>_.DPTFeatureExtractor,DPTForDepthEstimation:()=>t.DPTForDepthEstimation,DPTImageProcessor:()=>_.DPTImageProcessor,DPTModel:()=>t.DPTModel,DPTPreTrainedModel:()=>t.DPTPreTrainedModel,DacDecoderModel:()=>t.DacDecoderModel,DacDecoderOutput:()=>t.DacDecoderOutput,DacEncoderModel:()=>t.DacEncoderModel,DacEncoderOutput:()=>t.DacEncoderOutput,DacFeatureExtractor:()=>u.DacFeatureExtractor,DacModel:()=>t.DacModel,DacPreTrainedModel:()=>t.DacPreTrainedModel,DataTypeMap:()=>l.DataTypeMap,DebertaForMaskedLM:()=>t.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>t.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>t.DebertaForSequenceClassification,DebertaForTokenClassification:()=>t.DebertaForTokenClassification,DebertaModel:()=>t.DebertaModel,DebertaPreTrainedModel:()=>t.DebertaPreTrainedModel,DebertaTokenizer:()=>s.DebertaTokenizer,DebertaV2ForMaskedLM:()=>t.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>t.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>t.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>t.DebertaV2ForTokenClassification,DebertaV2Model:()=>t.DebertaV2Model,DebertaV2PreTrainedModel:()=>t.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>s.DebertaV2Tokenizer,DecisionTransformerModel:()=>t.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>t.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>_.DeiTFeatureExtractor,DeiTForImageClassification:()=>t.DeiTForImageClassification,DeiTImageProcessor:()=>_.DeiTImageProcessor,DeiTModel:()=>t.DeiTModel,DeiTPreTrainedModel:()=>t.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>t.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>t.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>r.DepthEstimationPipeline,DepthProForDepthEstimation:()=>t.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>t.DepthProPreTrainedModel,DetrFeatureExtractor:()=>_.DetrFeatureExtractor,DetrForObjectDetection:()=>t.DetrForObjectDetection,DetrForSegmentation:()=>t.DetrForSegmentation,DetrImageProcessor:()=>_.DetrImageProcessor,DetrModel:()=>t.DetrModel,DetrObjectDetectionOutput:()=>t.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>t.DetrPreTrainedModel,DetrSegmentationOutput:()=>t.DetrSegmentationOutput,Dinov2ForImageClassification:()=>t.Dinov2ForImageClassification,Dinov2Model:()=>t.Dinov2Model,Dinov2PreTrainedModel:()=>t.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>t.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>t.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>t.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>t.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>t.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>t.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>t.DistilBertForTokenClassification,DistilBertModel:()=>t.DistilBertModel,DistilBertPreTrainedModel:()=>t.DistilBertPreTrainedModel,DistilBertTokenizer:()=>s.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>r.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>_.DonutFeatureExtractor,DonutImageProcessor:()=>_.DonutImageProcessor,DonutSwinModel:()=>t.DonutSwinModel,DonutSwinPreTrainedModel:()=>t.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>t.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>_.EfficientNetImageProcessor,EfficientNetModel:()=>t.EfficientNetModel,EfficientNetPreTrainedModel:()=>t.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>t.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>t.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>t.ElectraForSequenceClassification,ElectraForTokenClassification:()=>t.ElectraForTokenClassification,ElectraModel:()=>t.ElectraModel,ElectraPreTrainedModel:()=>t.ElectraPreTrainedModel,ElectraTokenizer:()=>s.ElectraTokenizer,EncodecFeatureExtractor:()=>u.EncodecFeatureExtractor,EosTokenCriteria:()=>E.EosTokenCriteria,EsmForMaskedLM:()=>t.EsmForMaskedLM,EsmForSequenceClassification:()=>t.EsmForSequenceClassification,EsmForTokenClassification:()=>t.EsmForTokenClassification,EsmModel:()=>t.EsmModel,EsmPreTrainedModel:()=>t.EsmPreTrainedModel,EsmTokenizer:()=>s.EsmTokenizer,ExaoneForCausalLM:()=>t.ExaoneForCausalLM,ExaoneModel:()=>t.ExaoneModel,ExaonePreTrainedModel:()=>t.ExaonePreTrainedModel,FFT:()=>c.FFT,FalconForCausalLM:()=>t.FalconForCausalLM,FalconModel:()=>t.FalconModel,FalconPreTrainedModel:()=>t.FalconPreTrainedModel,FalconTokenizer:()=>s.FalconTokenizer,FastViTForImageClassification:()=>t.FastViTForImageClassification,FastViTModel:()=>t.FastViTModel,FastViTPreTrainedModel:()=>t.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>r.FeatureExtractionPipeline,FeatureExtractor:()=>p.FeatureExtractor,FillMaskPipeline:()=>r.FillMaskPipeline,Florence2ForConditionalGeneration:()=>t.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>t.Florence2PreTrainedModel,Florence2Processor:()=>v.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>M.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>M.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>_.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>t.GLPNForDepthEstimation,GLPNModel:()=>t.GLPNModel,GLPNPreTrainedModel:()=>t.GLPNPreTrainedModel,GPT2LMHeadModel:()=>t.GPT2LMHeadModel,GPT2Model:()=>t.GPT2Model,GPT2PreTrainedModel:()=>t.GPT2PreTrainedModel,GPT2Tokenizer:()=>s.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>t.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>t.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>t.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>t.GPTJForCausalLM,GPTJModel:()=>t.GPTJModel,GPTJPreTrainedModel:()=>t.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>t.GPTNeoForCausalLM,GPTNeoModel:()=>t.GPTNeoModel,GPTNeoPreTrainedModel:()=>t.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>t.GPTNeoXForCausalLM,GPTNeoXModel:()=>t.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>t.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>s.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>t.Gemma2ForCausalLM,Gemma2Model:()=>t.Gemma2Model,Gemma2PreTrainedModel:()=>t.Gemma2PreTrainedModel,Gemma3ForCausalLM:()=>t.Gemma3ForCausalLM,Gemma3Model:()=>t.Gemma3Model,Gemma3PreTrainedModel:()=>t.Gemma3PreTrainedModel,GemmaForCausalLM:()=>t.GemmaForCausalLM,GemmaModel:()=>t.GemmaModel,GemmaPreTrainedModel:()=>t.GemmaPreTrainedModel,GemmaTokenizer:()=>s.GemmaTokenizer,GlmForCausalLM:()=>t.GlmForCausalLM,GlmModel:()=>t.GlmModel,GlmPreTrainedModel:()=>t.GlmPreTrainedModel,GraniteForCausalLM:()=>t.GraniteForCausalLM,GraniteModel:()=>t.GraniteModel,GranitePreTrainedModel:()=>t.GranitePreTrainedModel,Grok1Tokenizer:()=>s.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>t.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>_.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>t.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>v.GroundingDinoProcessor,GroupViTModel:()=>t.GroupViTModel,GroupViTPreTrainedModel:()=>t.GroupViTPreTrainedModel,HeliumForCausalLM:()=>t.HeliumForCausalLM,HeliumModel:()=>t.HeliumModel,HeliumPreTrainedModel:()=>t.HeliumPreTrainedModel,HerbertTokenizer:()=>s.HerbertTokenizer,HieraForImageClassification:()=>t.HieraForImageClassification,HieraModel:()=>t.HieraModel,HieraPreTrainedModel:()=>t.HieraPreTrainedModel,HubertForCTC:()=>t.HubertForCTC,HubertForSequenceClassification:()=>t.HubertForSequenceClassification,HubertModel:()=>t.HubertModel,HubertPreTrainedModel:()=>t.HubertPreTrainedModel,IJepaForImageClassification:()=>t.IJepaForImageClassification,IJepaModel:()=>t.IJepaModel,IJepaPreTrainedModel:()=>t.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>t.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>_.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>t.Idefics3PreTrainedModel,Idefics3Processor:()=>v.Idefics3Processor,ImageClassificationPipeline:()=>r.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>r.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>u.ImageFeatureExtractor,ImageMattingOutput:()=>t.ImageMattingOutput,ImageProcessor:()=>g.ImageProcessor,ImageSegmentationPipeline:()=>r.ImageSegmentationPipeline,ImageToImagePipeline:()=>r.ImageToImagePipeline,ImageToTextPipeline:()=>r.ImageToTextPipeline,InterruptableStoppingCriteria:()=>E.InterruptableStoppingCriteria,JAISLMHeadModel:()=>t.JAISLMHeadModel,JAISModel:()=>t.JAISModel,JAISPreTrainedModel:()=>t.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>_.JinaCLIPImageProcessor,JinaCLIPModel:()=>t.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>t.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>v.JinaCLIPProcessor,JinaCLIPTextModel:()=>t.JinaCLIPTextModel,JinaCLIPVisionModel:()=>t.JinaCLIPVisionModel,LiteWhisperForConditionalGeneration:()=>t.LiteWhisperForConditionalGeneration,LlamaForCausalLM:()=>t.LlamaForCausalLM,LlamaModel:()=>t.LlamaModel,LlamaPreTrainedModel:()=>t.LlamaPreTrainedModel,LlamaTokenizer:()=>s.LlamaTokenizer,LlavaForConditionalGeneration:()=>t.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>t.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>_.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>t.LlavaPreTrainedModel,LogitsProcessor:()=>M.LogitsProcessor,LogitsProcessorList:()=>M.LogitsProcessorList,LogitsWarper:()=>M.LogitsWarper,LongT5ForConditionalGeneration:()=>t.LongT5ForConditionalGeneration,LongT5Model:()=>t.LongT5Model,LongT5PreTrainedModel:()=>t.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>t.M2M100ForConditionalGeneration,M2M100Model:()=>t.M2M100Model,M2M100PreTrainedModel:()=>t.M2M100PreTrainedModel,M2M100Tokenizer:()=>s.M2M100Tokenizer,MBart50Tokenizer:()=>s.MBart50Tokenizer,MBartForCausalLM:()=>t.MBartForCausalLM,MBartForConditionalGeneration:()=>t.MBartForConditionalGeneration,MBartForSequenceClassification:()=>t.MBartForSequenceClassification,MBartModel:()=>t.MBartModel,MBartPreTrainedModel:()=>t.MBartPreTrainedModel,MBartTokenizer:()=>s.MBartTokenizer,MPNetForMaskedLM:()=>t.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>t.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>t.MPNetForSequenceClassification,MPNetForTokenClassification:()=>t.MPNetForTokenClassification,MPNetModel:()=>t.MPNetModel,MPNetPreTrainedModel:()=>t.MPNetPreTrainedModel,MPNetTokenizer:()=>s.MPNetTokenizer,MT5ForConditionalGeneration:()=>t.MT5ForConditionalGeneration,MT5Model:()=>t.MT5Model,MT5PreTrainedModel:()=>t.MT5PreTrainedModel,MarianMTModel:()=>t.MarianMTModel,MarianModel:()=>t.MarianModel,MarianPreTrainedModel:()=>t.MarianPreTrainedModel,MarianTokenizer:()=>s.MarianTokenizer,Mask2FormerImageProcessor:()=>_.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>_.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>t.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>_.MaskFormerImageProcessor,MaskFormerModel:()=>t.MaskFormerModel,MaskFormerPreTrainedModel:()=>t.MaskFormerPreTrainedModel,MaskedLMOutput:()=>t.MaskedLMOutput,MaxLengthCriteria:()=>E.MaxLengthCriteria,Metric3DForDepthEstimation:()=>t.Metric3DForDepthEstimation,Metric3DPreTrainedModel:()=>t.Metric3DPreTrainedModel,Metric3Dv2ForDepthEstimation:()=>t.Metric3Dv2ForDepthEstimation,Metric3Dv2PreTrainedModel:()=>t.Metric3Dv2PreTrainedModel,MgpstrForSceneTextRecognition:()=>t.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>t.MgpstrModelOutput,MgpstrPreTrainedModel:()=>t.MgpstrPreTrainedModel,MgpstrProcessor:()=>v.MgpstrProcessor,MgpstrTokenizer:()=>s.MgpstrTokenizer,MimiDecoderModel:()=>t.MimiDecoderModel,MimiDecoderOutput:()=>t.MimiDecoderOutput,MimiEncoderModel:()=>t.MimiEncoderModel,MimiEncoderOutput:()=>t.MimiEncoderOutput,MimiModel:()=>t.MimiModel,MimiPreTrainedModel:()=>t.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>M.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>M.MinNewTokensLengthLogitsProcessor,MistralForCausalLM:()=>t.MistralForCausalLM,MistralModel:()=>t.MistralModel,MistralPreTrainedModel:()=>t.MistralPreTrainedModel,MobileBertForMaskedLM:()=>t.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>t.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>t.MobileBertForSequenceClassification,MobileBertModel:()=>t.MobileBertModel,MobileBertPreTrainedModel:()=>t.MobileBertPreTrainedModel,MobileBertTokenizer:()=>s.MobileBertTokenizer,MobileLLMForCausalLM:()=>t.MobileLLMForCausalLM,MobileLLMModel:()=>t.MobileLLMModel,MobileLLMPreTrainedModel:()=>t.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>_.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>t.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>t.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>_.MobileNetV1ImageProcessor,MobileNetV1Model:()=>t.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>t.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>_.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>t.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>t.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>_.MobileNetV2ImageProcessor,MobileNetV2Model:()=>t.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>t.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>_.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>t.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>t.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>_.MobileNetV3ImageProcessor,MobileNetV3Model:()=>t.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>t.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>_.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>t.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>t.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>_.MobileNetV4ImageProcessor,MobileNetV4Model:()=>t.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>t.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>_.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>t.MobileViTForImageClassification,MobileViTImageProcessor:()=>_.MobileViTImageProcessor,MobileViTModel:()=>t.MobileViTModel,MobileViTPreTrainedModel:()=>t.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>t.MobileViTV2ForImageClassification,MobileViTV2Model:()=>t.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>t.MobileViTV2PreTrainedModel,ModelOutput:()=>t.ModelOutput,ModernBertForMaskedLM:()=>t.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>t.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>t.ModernBertForTokenClassification,ModernBertModel:()=>t.ModernBertModel,ModernBertPreTrainedModel:()=>t.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>t.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>u.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>t.MoonshineForConditionalGeneration,MoonshineModel:()=>t.MoonshineModel,MoonshinePreTrainedModel:()=>t.MoonshinePreTrainedModel,MoonshineProcessor:()=>v.MoonshineProcessor,MptForCausalLM:()=>t.MptForCausalLM,MptModel:()=>t.MptModel,MptPreTrainedModel:()=>t.MptPreTrainedModel,MultiModalityCausalLM:()=>t.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>t.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>t.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>t.MusicgenForConditionalGeneration,MusicgenModel:()=>t.MusicgenModel,MusicgenPreTrainedModel:()=>t.MusicgenPreTrainedModel,NllbTokenizer:()=>s.NllbTokenizer,NoBadWordsLogitsProcessor:()=>M.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>M.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>t.NomicBertModel,NomicBertPreTrainedModel:()=>t.NomicBertPreTrainedModel,NougatImageProcessor:()=>_.NougatImageProcessor,NougatTokenizer:()=>s.NougatTokenizer,OPTForCausalLM:()=>t.OPTForCausalLM,OPTModel:()=>t.OPTModel,OPTPreTrainedModel:()=>t.OPTPreTrainedModel,ObjectDetectionPipeline:()=>r.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>t.Olmo2ForCausalLM,Olmo2Model:()=>t.Olmo2Model,Olmo2PreTrainedModel:()=>t.Olmo2PreTrainedModel,OlmoForCausalLM:()=>t.OlmoForCausalLM,OlmoModel:()=>t.OlmoModel,OlmoPreTrainedModel:()=>t.OlmoPreTrainedModel,OpenELMForCausalLM:()=>t.OpenELMForCausalLM,OpenELMModel:()=>t.OpenELMModel,OpenELMPreTrainedModel:()=>t.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>_.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>t.OwlViTForObjectDetection,OwlViTImageProcessor:()=>_.OwlViTImageProcessor,OwlViTModel:()=>t.OwlViTModel,OwlViTPreTrainedModel:()=>t.OwlViTPreTrainedModel,OwlViTProcessor:()=>v.OwlViTProcessor,Owlv2ForObjectDetection:()=>t.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>_.Owlv2ImageProcessor,Owlv2Model:()=>t.Owlv2Model,Owlv2PreTrainedModel:()=>t.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>t.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>t.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>v.PaliGemmaProcessor,PatchTSMixerForPrediction:()=>t.PatchTSMixerForPrediction,PatchTSMixerModel:()=>t.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>t.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>t.PatchTSTForPrediction,PatchTSTModel:()=>t.PatchTSTModel,PatchTSTPreTrainedModel:()=>t.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>t.Phi3ForCausalLM,Phi3Model:()=>t.Phi3Model,Phi3PreTrainedModel:()=>t.Phi3PreTrainedModel,Phi3VForCausalLM:()=>t.Phi3VForCausalLM,Phi3VImageProcessor:()=>_.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>t.Phi3VPreTrainedModel,Phi3VProcessor:()=>v.Phi3VProcessor,PhiForCausalLM:()=>t.PhiForCausalLM,PhiModel:()=>t.PhiModel,PhiPreTrainedModel:()=>t.PhiPreTrainedModel,Pipeline:()=>r.Pipeline,PreTrainedModel:()=>t.PreTrainedModel,PreTrainedTokenizer:()=>s.PreTrainedTokenizer,PretrainedConfig:()=>i.PretrainedConfig,PretrainedMixin:()=>t.PretrainedMixin,Processor:()=>A.Processor,PvtForImageClassification:()=>t.PvtForImageClassification,PvtImageProcessor:()=>_.PvtImageProcessor,PvtModel:()=>t.PvtModel,PvtPreTrainedModel:()=>t.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>u.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>t.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>t.PyAnnoteModel,PyAnnotePreTrainedModel:()=>t.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>v.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>t.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>r.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>t.Qwen2ForCausalLM,Qwen2Model:()=>t.Qwen2Model,Qwen2PreTrainedModel:()=>t.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>s.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>t.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>_.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>t.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>v.Qwen2VLProcessor,RFDetrForObjectDetection:()=>t.RFDetrForObjectDetection,RFDetrModel:()=>t.RFDetrModel,RFDetrObjectDetectionOutput:()=>t.RFDetrObjectDetectionOutput,RFDetrPreTrainedModel:()=>t.RFDetrPreTrainedModel,RTDetrForObjectDetection:()=>t.RTDetrForObjectDetection,RTDetrImageProcessor:()=>_.RTDetrImageProcessor,RTDetrModel:()=>t.RTDetrModel,RTDetrObjectDetectionOutput:()=>t.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>t.RTDetrPreTrainedModel,RTDetrV2ForObjectDetection:()=>t.RTDetrV2ForObjectDetection,RTDetrV2Model:()=>t.RTDetrV2Model,RTDetrV2ObjectDetectionOutput:()=>t.RTDetrV2ObjectDetectionOutput,RTDetrV2PreTrainedModel:()=>t.RTDetrV2PreTrainedModel,RawAudio:()=>n.RawAudio,RawImage:()=>o.RawImage,RawVideo:()=>a.RawVideo,RawVideoFrame:()=>a.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>M.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>t.ResNetForImageClassification,ResNetModel:()=>t.ResNetModel,ResNetPreTrainedModel:()=>t.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>t.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>t.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>t.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>t.RoFormerForTokenClassification,RoFormerModel:()=>t.RoFormerModel,RoFormerPreTrainedModel:()=>t.RoFormerPreTrainedModel,RoFormerTokenizer:()=>s.RoFormerTokenizer,RobertaForMaskedLM:()=>t.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>t.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>t.RobertaForSequenceClassification,RobertaForTokenClassification:()=>t.RobertaForTokenClassification,RobertaModel:()=>t.RobertaModel,RobertaPreTrainedModel:()=>t.RobertaPreTrainedModel,RobertaTokenizer:()=>s.RobertaTokenizer,SamImageProcessor:()=>_.SamImageProcessor,SamImageSegmentationOutput:()=>t.SamImageSegmentationOutput,SamModel:()=>t.SamModel,SamPreTrainedModel:()=>t.SamPreTrainedModel,SamProcessor:()=>v.SamProcessor,SapiensForDepthEstimation:()=>t.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>t.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>t.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>t.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>u.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>_.SegformerFeatureExtractor,SegformerForImageClassification:()=>t.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>t.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>_.SegformerImageProcessor,SegformerModel:()=>t.SegformerModel,SegformerPreTrainedModel:()=>t.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>t.Seq2SeqLMOutput,SequenceClassifierOutput:()=>t.SequenceClassifierOutput,SiglipImageProcessor:()=>_.SiglipImageProcessor,SiglipModel:()=>t.SiglipModel,SiglipPreTrainedModel:()=>t.SiglipPreTrainedModel,SiglipTextModel:()=>t.SiglipTextModel,SiglipTokenizer:()=>s.SiglipTokenizer,SiglipVisionModel:()=>t.SiglipVisionModel,SmolVLMForConditionalGeneration:()=>t.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>_.SmolVLMImageProcessor,SmolVLMProcessor:()=>v.SmolVLMProcessor,SnacDecoderModel:()=>t.SnacDecoderModel,SnacEncoderModel:()=>t.SnacEncoderModel,SnacFeatureExtractor:()=>u.SnacFeatureExtractor,SnacModel:()=>t.SnacModel,SnacPreTrainedModel:()=>t.SnacPreTrainedModel,SpeechT5FeatureExtractor:()=>u.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>t.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>t.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>t.SpeechT5HifiGan,SpeechT5Model:()=>t.SpeechT5Model,SpeechT5PreTrainedModel:()=>t.SpeechT5PreTrainedModel,SpeechT5Processor:()=>v.SpeechT5Processor,SpeechT5Tokenizer:()=>s.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>t.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>t.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>t.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>t.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>t.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>s.SqueezeBertTokenizer,StableLmForCausalLM:()=>t.StableLmForCausalLM,StableLmModel:()=>t.StableLmModel,StableLmPreTrainedModel:()=>t.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>t.Starcoder2ForCausalLM,Starcoder2Model:()=>t.Starcoder2Model,Starcoder2PreTrainedModel:()=>t.Starcoder2PreTrainedModel,StoppingCriteria:()=>E.StoppingCriteria,StoppingCriteriaList:()=>E.StoppingCriteriaList,StyleTextToSpeech2Model:()=>t.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>t.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>r.SummarizationPipeline,SuppressTokensAtBeginLogitsProcessor:()=>M.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>t.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>_.Swin2SRImageProcessor,Swin2SRModel:()=>t.Swin2SRModel,Swin2SRPreTrainedModel:()=>t.Swin2SRPreTrainedModel,SwinForImageClassification:()=>t.SwinForImageClassification,SwinForSemanticSegmentation:()=>t.SwinForSemanticSegmentation,SwinModel:()=>t.SwinModel,SwinPreTrainedModel:()=>t.SwinPreTrainedModel,T5ForConditionalGeneration:()=>t.T5ForConditionalGeneration,T5Model:()=>t.T5Model,T5PreTrainedModel:()=>t.T5PreTrainedModel,T5Tokenizer:()=>s.T5Tokenizer,TableTransformerForObjectDetection:()=>t.TableTransformerForObjectDetection,TableTransformerModel:()=>t.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>t.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>t.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>M.TemperatureLogitsWarper,Tensor:()=>l.Tensor,Text2TextGenerationPipeline:()=>r.Text2TextGenerationPipeline,TextClassificationPipeline:()=>r.TextClassificationPipeline,TextGenerationPipeline:()=>r.TextGenerationPipeline,TextStreamer:()=>k.TextStreamer,TextToAudioPipeline:()=>r.TextToAudioPipeline,TokenClassificationPipeline:()=>r.TokenClassificationPipeline,TokenClassifierOutput:()=>t.TokenClassifierOutput,TokenizerModel:()=>s.TokenizerModel,TopKLogitsWarper:()=>M.TopKLogitsWarper,TopPLogitsWarper:()=>M.TopPLogitsWarper,TrOCRForCausalLM:()=>t.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>t.TrOCRPreTrainedModel,TranslationPipeline:()=>r.TranslationPipeline,UltravoxModel:()=>t.UltravoxModel,UltravoxPreTrainedModel:()=>t.UltravoxPreTrainedModel,UltravoxProcessor:()=>v.UltravoxProcessor,UniSpeechForCTC:()=>t.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>t.UniSpeechForSequenceClassification,UniSpeechModel:()=>t.UniSpeechModel,UniSpeechPreTrainedModel:()=>t.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>t.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>t.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>t.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>t.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>t.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>v.VLChatProcessor,VLMImageProcessor:()=>_.VLMImageProcessor,ViTFeatureExtractor:()=>_.ViTFeatureExtractor,ViTForImageClassification:()=>t.ViTForImageClassification,ViTImageProcessor:()=>_.ViTImageProcessor,ViTMAEModel:()=>t.ViTMAEModel,ViTMAEPreTrainedModel:()=>t.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>t.ViTMSNForImageClassification,ViTMSNModel:()=>t.ViTMSNModel,ViTMSNPreTrainedModel:()=>t.ViTMSNPreTrainedModel,ViTModel:()=>t.ViTModel,ViTPreTrainedModel:()=>t.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>t.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>t.VitMatteForImageMatting,VitMatteImageProcessor:()=>_.VitMatteImageProcessor,VitMattePreTrainedModel:()=>t.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>t.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>_.VitPoseImageProcessor,VitPosePreTrainedModel:()=>t.VitPosePreTrainedModel,VitsModel:()=>t.VitsModel,VitsModelOutput:()=>t.VitsModelOutput,VitsPreTrainedModel:()=>t.VitsPreTrainedModel,VitsTokenizer:()=>s.VitsTokenizer,Wav2Vec2BertForCTC:()=>t.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>t.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>t.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>t.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>s.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>u.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>t.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>t.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>t.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>t.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>t.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>v.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>v.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>t.WavLMForAudioFrameClassification,WavLMForCTC:()=>t.WavLMForCTC,WavLMForSequenceClassification:()=>t.WavLMForSequenceClassification,WavLMForXVector:()=>t.WavLMForXVector,WavLMModel:()=>t.WavLMModel,WavLMPreTrainedModel:()=>t.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>u.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>t.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>t.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>u.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>t.WhisperForConditionalGeneration,WhisperModel:()=>t.WhisperModel,WhisperPreTrainedModel:()=>t.WhisperPreTrainedModel,WhisperProcessor:()=>v.WhisperProcessor,WhisperTextStreamer:()=>k.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>M.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>s.WhisperTokenizer,XLMForQuestionAnswering:()=>t.XLMForQuestionAnswering,XLMForSequenceClassification:()=>t.XLMForSequenceClassification,XLMForTokenClassification:()=>t.XLMForTokenClassification,XLMModel:()=>t.XLMModel,XLMPreTrainedModel:()=>t.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>t.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>t.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>t.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>t.XLMRobertaForTokenClassification,XLMRobertaModel:()=>t.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>t.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>s.XLMRobertaTokenizer,XLMTokenizer:()=>s.XLMTokenizer,XLMWithLMHeadModel:()=>t.XLMWithLMHeadModel,XVectorOutput:()=>t.XVectorOutput,YolosFeatureExtractor:()=>_.YolosFeatureExtractor,YolosForObjectDetection:()=>t.YolosForObjectDetection,YolosImageProcessor:()=>_.YolosImageProcessor,YolosModel:()=>t.YolosModel,YolosObjectDetectionOutput:()=>t.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>t.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>r.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>r.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>r.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>r.ZeroShotObjectDetectionPipeline,bankers_round:()=>c.bankers_round,cat:()=>l.cat,cos_sim:()=>c.cos_sim,dot:()=>c.dot,dynamic_time_warping:()=>c.dynamic_time_warping,env:()=>e.env,full:()=>l.full,full_like:()=>l.full_like,getKeyValueShapes:()=>i.getKeyValueShapes,hamming:()=>n.hamming,hanning:()=>n.hanning,interpolate:()=>l.interpolate,interpolate_4d:()=>l.interpolate_4d,interpolate_data:()=>c.interpolate_data,is_chinese_char:()=>s.is_chinese_char,layer_norm:()=>l.layer_norm,load_image:()=>o.load_image,load_video:()=>a.load_video,log_softmax:()=>c.log_softmax,magnitude:()=>c.magnitude,matmul:()=>l.matmul,max:()=>c.max,mean:()=>l.mean,mean_pooling:()=>l.mean_pooling,medianFilter:()=>c.medianFilter,mel_filter_bank:()=>n.mel_filter_bank,min:()=>c.min,ones:()=>l.ones,ones_like:()=>l.ones_like,permute:()=>l.permute,permute_data:()=>c.permute_data,pipeline:()=>r.pipeline,quantize_embeddings:()=>l.quantize_embeddings,rand:()=>l.rand,read_audio:()=>n.read_audio,rfft:()=>l.rfft,round:()=>c.round,slice:()=>l.slice,softmax:()=>c.softmax,spectrogram:()=>n.spectrogram,stack:()=>l.stack,std_mean:()=>l.std_mean,topk:()=>l.topk,window_function:()=>n.window_function,zeros:()=>l.zeros,zeros_like:()=>l.zeros_like});var e=Ft("./src/env.js"),r=Ft("./src/pipelines.js"),t=Ft("./src/models.js"),s=Ft("./src/tokenizers.js"),i=Ft("./src/configs.js"),n=Ft("./src/utils/audio.js"),o=Ft("./src/utils/image.js"),a=Ft("./src/utils/video.js"),l=Ft("./src/utils/tensor.js"),c=Ft("./src/utils/maths.js"),p=Ft("./src/base/feature_extraction_utils.js"),u=Ft("./src/models/feature_extractors.js"),h=Ft("./src/models/auto/feature_extraction_auto.js"),g=Ft("./src/base/image_processors_utils.js"),_=Ft("./src/models/image_processors.js"),P=Ft("./src/models/auto/image_processing_auto.js"),A=Ft("./src/base/processing_utils.js"),v=Ft("./src/models/processors.js"),y=Ft("./src/models/auto/processing_auto.js"),k=Ft("./src/generation/streamers.js"),E=Ft("./src/generation/stopping_criteria.js"),M=Ft("./src/generation/logits_process.js")})(),f.ASTFeatureExtractor,f.ASTForAudioClassification,f.ASTModel,f.ASTPreTrainedModel,f.AlbertForMaskedLM,f.AlbertForQuestionAnswering,f.AlbertForSequenceClassification,f.AlbertModel,f.AlbertPreTrainedModel,f.AlbertTokenizer,f.AudioClassificationPipeline,f.AutoConfig,f.AutoFeatureExtractor,f.AutoImageProcessor,f.AutoModel,f.AutoModelForAudioClassification,f.AutoModelForAudioFrameClassification,f.AutoModelForAudioTextToText,f.AutoModelForCTC,f.AutoModelForCausalLM,f.AutoModelForDepthEstimation,f.AutoModelForDocumentQuestionAnswering,f.AutoModelForImageClassification,f.AutoModelForImageFeatureExtraction,f.AutoModelForImageMatting,f.AutoModelForImageSegmentation,f.AutoModelForImageTextToText,f.AutoModelForImageToImage,f.AutoModelForMaskGeneration,f.AutoModelForMaskedLM,f.AutoModelForNormalEstimation,f.AutoModelForObjectDetection,f.AutoModelForPoseEstimation,f.AutoModelForQuestionAnswering,f.AutoModelForSemanticSegmentation,f.AutoModelForSeq2SeqLM,f.AutoModelForSequenceClassification,f.AutoModelForSpeechSeq2Seq,f.AutoModelForTextToSpectrogram,f.AutoModelForTextToWaveform,f.AutoModelForTokenClassification,f.AutoModelForUniversalSegmentation,f.AutoModelForVision2Seq,f.AutoModelForXVector,f.AutoModelForZeroShotObjectDetection;var pT=f.AutoProcessor,hT=f.AutoTokenizer;f.AutomaticSpeechRecognitionPipeline,f.BackgroundRemovalPipeline,f.BartForConditionalGeneration,f.BartForSequenceClassification,f.BartModel,f.BartPretrainedModel,f.BartTokenizer,f.BaseModelOutput,f.BaseStreamer,f.BeitFeatureExtractor,f.BeitForImageClassification,f.BeitModel,f.BeitPreTrainedModel,f.BertForMaskedLM,f.BertForQuestionAnswering,f.BertForSequenceClassification,f.BertForTokenClassification,f.BertModel,f.BertPreTrainedModel,f.BertTokenizer,f.BitImageProcessor,f.BlenderbotForConditionalGeneration,f.BlenderbotModel,f.BlenderbotPreTrainedModel,f.BlenderbotSmallForConditionalGeneration,f.BlenderbotSmallModel,f.BlenderbotSmallPreTrainedModel,f.BlenderbotSmallTokenizer,f.BlenderbotTokenizer,f.BloomForCausalLM,f.BloomModel,f.BloomPreTrainedModel,f.BloomTokenizer,f.CLIPFeatureExtractor,f.CLIPImageProcessor,f.CLIPModel,f.CLIPPreTrainedModel,f.CLIPSegForImageSegmentation,f.CLIPSegModel,f.CLIPSegPreTrainedModel,f.CLIPTextModel,f.CLIPTextModelWithProjection,f.CLIPTokenizer,f.CLIPVisionModel,f.CLIPVisionModelWithProjection,f.CamembertForMaskedLM,f.CamembertForQuestionAnswering,f.CamembertForSequenceClassification,f.CamembertForTokenClassification,f.CamembertModel,f.CamembertPreTrainedModel,f.CamembertTokenizer,f.CausalLMOutput,f.CausalLMOutputWithPast,f.ChineseCLIPFeatureExtractor,f.ChineseCLIPModel,f.ChineseCLIPPreTrainedModel,f.ClapAudioModelWithProjection,f.ClapFeatureExtractor,f.ClapModel,f.ClapPreTrainedModel,f.ClapTextModelWithProjection,f.ClassifierFreeGuidanceLogitsProcessor,f.CodeGenForCausalLM,f.CodeGenModel,f.CodeGenPreTrainedModel,f.CodeGenTokenizer,f.CodeLlamaTokenizer,f.CohereForCausalLM,f.CohereModel,f.CoherePreTrainedModel,f.CohereTokenizer,f.ConvBertForMaskedLM,f.ConvBertForQuestionAnswering,f.ConvBertForSequenceClassification,f.ConvBertForTokenClassification,f.ConvBertModel,f.ConvBertPreTrainedModel,f.ConvBertTokenizer,f.ConvNextFeatureExtractor,f.ConvNextForImageClassification,f.ConvNextImageProcessor,f.ConvNextModel,f.ConvNextPreTrainedModel,f.ConvNextV2ForImageClassification,f.ConvNextV2Model,f.ConvNextV2PreTrainedModel,f.DPTFeatureExtractor,f.DPTForDepthEstimation,f.DPTImageProcessor,f.DPTModel,f.DPTPreTrainedModel,f.DacDecoderModel,f.DacDecoderOutput,f.DacEncoderModel,f.DacEncoderOutput,f.DacFeatureExtractor,f.DacModel,f.DacPreTrainedModel,f.DataTypeMap,f.DebertaForMaskedLM,f.DebertaForQuestionAnswering,f.DebertaForSequenceClassification,f.DebertaForTokenClassification,f.DebertaModel,f.DebertaPreTrainedModel,f.DebertaTokenizer,f.DebertaV2ForMaskedLM,f.DebertaV2ForQuestionAnswering,f.DebertaV2ForSequenceClassification,f.DebertaV2ForTokenClassification,f.DebertaV2Model,f.DebertaV2PreTrainedModel,f.DebertaV2Tokenizer,f.DecisionTransformerModel,f.DecisionTransformerPreTrainedModel,f.DeiTFeatureExtractor,f.DeiTForImageClassification,f.DeiTImageProcessor,f.DeiTModel,f.DeiTPreTrainedModel,f.DepthAnythingForDepthEstimation,f.DepthAnythingPreTrainedModel,f.DepthEstimationPipeline,f.DepthProForDepthEstimation,f.DepthProPreTrainedModel,f.DetrFeatureExtractor,f.DetrForObjectDetection,f.DetrForSegmentation,f.DetrImageProcessor,f.DetrModel,f.DetrObjectDetectionOutput,f.DetrPreTrainedModel,f.DetrSegmentationOutput,f.Dinov2ForImageClassification,f.Dinov2Model,f.Dinov2PreTrainedModel,f.Dinov2WithRegistersForImageClassification,f.Dinov2WithRegistersModel,f.Dinov2WithRegistersPreTrainedModel,f.DistilBertForMaskedLM,f.DistilBertForQuestionAnswering,f.DistilBertForSequenceClassification,f.DistilBertForTokenClassification,f.DistilBertModel,f.DistilBertPreTrainedModel,f.DistilBertTokenizer,f.DocumentQuestionAnsweringPipeline,f.DonutFeatureExtractor,f.DonutImageProcessor,f.DonutSwinModel,f.DonutSwinPreTrainedModel,f.EfficientNetForImageClassification,f.EfficientNetImageProcessor,f.EfficientNetModel,f.EfficientNetPreTrainedModel,f.ElectraForMaskedLM,f.ElectraForQuestionAnswering,f.ElectraForSequenceClassification,f.ElectraForTokenClassification,f.ElectraModel,f.ElectraPreTrainedModel,f.ElectraTokenizer,f.EncodecFeatureExtractor,f.EosTokenCriteria,f.EsmForMaskedLM,f.EsmForSequenceClassification,f.EsmForTokenClassification,f.EsmModel,f.EsmPreTrainedModel,f.EsmTokenizer,f.ExaoneForCausalLM,f.ExaoneModel,f.ExaonePreTrainedModel,f.FFT,f.FalconForCausalLM,f.FalconModel,f.FalconPreTrainedModel,f.FalconTokenizer,f.FastViTForImageClassification,f.FastViTModel,f.FastViTPreTrainedModel,f.FeatureExtractionPipeline,f.FeatureExtractor,f.FillMaskPipeline,f.Florence2ForConditionalGeneration,f.Florence2PreTrainedModel,f.Florence2Processor,f.ForcedBOSTokenLogitsProcessor,f.ForcedEOSTokenLogitsProcessor,f.GLPNFeatureExtractor,f.GLPNForDepthEstimation,f.GLPNModel,f.GLPNPreTrainedModel,f.GPT2LMHeadModel,f.GPT2Model,f.GPT2PreTrainedModel,f.GPT2Tokenizer,f.GPTBigCodeForCausalLM,f.GPTBigCodeModel,f.GPTBigCodePreTrainedModel,f.GPTJForCausalLM,f.GPTJModel,f.GPTJPreTrainedModel,f.GPTNeoForCausalLM,f.GPTNeoModel,f.GPTNeoPreTrainedModel,f.GPTNeoXForCausalLM,f.GPTNeoXModel,f.GPTNeoXPreTrainedModel,f.GPTNeoXTokenizer,f.Gemma2ForCausalLM,f.Gemma2Model,f.Gemma2PreTrainedModel,f.Gemma3ForCausalLM,f.Gemma3Model,f.Gemma3PreTrainedModel,f.GemmaForCausalLM,f.GemmaModel,f.GemmaPreTrainedModel,f.GemmaTokenizer,f.GlmForCausalLM,f.GlmModel,f.GlmPreTrainedModel,f.GraniteForCausalLM,f.GraniteModel,f.GranitePreTrainedModel,f.Grok1Tokenizer,f.GroundingDinoForObjectDetection,f.GroundingDinoImageProcessor,f.GroundingDinoPreTrainedModel,f.GroundingDinoProcessor,f.GroupViTModel,f.GroupViTPreTrainedModel,f.HeliumForCausalLM,f.HeliumModel,f.HeliumPreTrainedModel,f.HerbertTokenizer,f.HieraForImageClassification,f.HieraModel,f.HieraPreTrainedModel,f.HubertForCTC,f.HubertForSequenceClassification,f.HubertModel,f.HubertPreTrainedModel,f.IJepaForImageClassification,f.IJepaModel,f.IJepaPreTrainedModel,f.Idefics3ForConditionalGeneration,f.Idefics3ImageProcessor,f.Idefics3PreTrainedModel,f.Idefics3Processor,f.ImageClassificationPipeline,f.ImageFeatureExtractionPipeline,f.ImageFeatureExtractor,f.ImageMattingOutput,f.ImageProcessor,f.ImageSegmentationPipeline,f.ImageToImagePipeline,f.ImageToTextPipeline,f.InterruptableStoppingCriteria,f.JAISLMHeadModel,f.JAISModel,f.JAISPreTrainedModel,f.JinaCLIPImageProcessor,f.JinaCLIPModel,f.JinaCLIPPreTrainedModel,f.JinaCLIPProcessor,f.JinaCLIPTextModel,f.JinaCLIPVisionModel,f.LiteWhisperForConditionalGeneration,f.LlamaForCausalLM,f.LlamaModel,f.LlamaPreTrainedModel,f.LlamaTokenizer,f.LlavaForConditionalGeneration,f.LlavaOnevisionForConditionalGeneration,f.LlavaOnevisionImageProcessor,f.LlavaPreTrainedModel,f.LogitsProcessor,f.LogitsProcessorList,f.LogitsWarper,f.LongT5ForConditionalGeneration,f.LongT5Model,f.LongT5PreTrainedModel,f.M2M100ForConditionalGeneration,f.M2M100Model,f.M2M100PreTrainedModel,f.M2M100Tokenizer,f.MBart50Tokenizer,f.MBartForCausalLM,f.MBartForConditionalGeneration,f.MBartForSequenceClassification,f.MBartModel,f.MBartPreTrainedModel,f.MBartTokenizer,f.MPNetForMaskedLM,f.MPNetForQuestionAnswering,f.MPNetForSequenceClassification,f.MPNetForTokenClassification,f.MPNetModel,f.MPNetPreTrainedModel,f.MPNetTokenizer,f.MT5ForConditionalGeneration,f.MT5Model,f.MT5PreTrainedModel,f.MarianMTModel,f.MarianModel,f.MarianPreTrainedModel,f.MarianTokenizer,f.Mask2FormerImageProcessor,f.MaskFormerFeatureExtractor,f.MaskFormerForInstanceSegmentation,f.MaskFormerImageProcessor,f.MaskFormerModel,f.MaskFormerPreTrainedModel,f.MaskedLMOutput,f.MaxLengthCriteria,f.Metric3DForDepthEstimation,f.Metric3DPreTrainedModel,f.Metric3Dv2ForDepthEstimation,f.Metric3Dv2PreTrainedModel,f.MgpstrForSceneTextRecognition,f.MgpstrModelOutput,f.MgpstrPreTrainedModel,f.MgpstrProcessor,f.MgpstrTokenizer,f.MimiDecoderModel,f.MimiDecoderOutput,f.MimiEncoderModel,f.MimiEncoderOutput,f.MimiModel,f.MimiPreTrainedModel,f.MinLengthLogitsProcessor,f.MinNewTokensLengthLogitsProcessor,f.MistralForCausalLM,f.MistralModel,f.MistralPreTrainedModel,f.MobileBertForMaskedLM,f.MobileBertForQuestionAnswering,f.MobileBertForSequenceClassification,f.MobileBertModel,f.MobileBertPreTrainedModel,f.MobileBertTokenizer,f.MobileLLMForCausalLM,f.MobileLLMModel,f.MobileLLMPreTrainedModel,f.MobileNetV1FeatureExtractor,f.MobileNetV1ForImageClassification,f.MobileNetV1ForSemanticSegmentation,f.MobileNetV1ImageProcessor,f.MobileNetV1Model,f.MobileNetV1PreTrainedModel,f.MobileNetV2FeatureExtractor,f.MobileNetV2ForImageClassification,f.MobileNetV2ForSemanticSegmentation,f.MobileNetV2ImageProcessor,f.MobileNetV2Model,f.MobileNetV2PreTrainedModel,f.MobileNetV3FeatureExtractor,f.MobileNetV3ForImageClassification,f.MobileNetV3ForSemanticSegmentation,f.MobileNetV3ImageProcessor,f.MobileNetV3Model,f.MobileNetV3PreTrainedModel,f.MobileNetV4FeatureExtractor,f.MobileNetV4ForImageClassification,f.MobileNetV4ForSemanticSegmentation,f.MobileNetV4ImageProcessor,f.MobileNetV4Model,f.MobileNetV4PreTrainedModel,f.MobileViTFeatureExtractor,f.MobileViTForImageClassification,f.MobileViTImageProcessor,f.MobileViTModel,f.MobileViTPreTrainedModel,f.MobileViTV2ForImageClassification,f.MobileViTV2Model,f.MobileViTV2PreTrainedModel,f.ModelOutput,f.ModernBertForMaskedLM,f.ModernBertForSequenceClassification,f.ModernBertForTokenClassification,f.ModernBertModel,f.ModernBertPreTrainedModel,f.Moondream1ForConditionalGeneration,f.MoonshineFeatureExtractor,f.MoonshineForConditionalGeneration,f.MoonshineModel,f.MoonshinePreTrainedModel,f.MoonshineProcessor,f.MptForCausalLM,f.MptModel,f.MptPreTrainedModel,f.MultiModalityCausalLM,f.MultiModalityPreTrainedModel,f.MusicgenForCausalLM,f.MusicgenForConditionalGeneration,f.MusicgenModel,f.MusicgenPreTrainedModel,f.NllbTokenizer,f.NoBadWordsLogitsProcessor,f.NoRepeatNGramLogitsProcessor,f.NomicBertModel,f.NomicBertPreTrainedModel,f.NougatImageProcessor,f.NougatTokenizer,f.OPTForCausalLM,f.OPTModel,f.OPTPreTrainedModel,f.ObjectDetectionPipeline,f.Olmo2ForCausalLM,f.Olmo2Model,f.Olmo2PreTrainedModel,f.OlmoForCausalLM,f.OlmoModel,f.OlmoPreTrainedModel,f.OpenELMForCausalLM,f.OpenELMModel,f.OpenELMPreTrainedModel,f.OwlViTFeatureExtractor,f.OwlViTForObjectDetection,f.OwlViTImageProcessor,f.OwlViTModel,f.OwlViTPreTrainedModel,f.OwlViTProcessor,f.Owlv2ForObjectDetection,f.Owlv2ImageProcessor,f.Owlv2Model,f.Owlv2PreTrainedModel,f.PaliGemmaForConditionalGeneration,f.PaliGemmaPreTrainedModel,f.PaliGemmaProcessor,f.PatchTSMixerForPrediction,f.PatchTSMixerModel,f.PatchTSMixerPreTrainedModel,f.PatchTSTForPrediction,f.PatchTSTModel,f.PatchTSTPreTrainedModel,f.Phi3ForCausalLM,f.Phi3Model,f.Phi3PreTrainedModel,f.Phi3VForCausalLM,f.Phi3VImageProcessor,f.Phi3VPreTrainedModel,f.Phi3VProcessor,f.PhiForCausalLM,f.PhiModel,f.PhiPreTrainedModel,f.Pipeline,f.PreTrainedModel,f.PreTrainedTokenizer,f.PretrainedConfig,f.PretrainedMixin,f.Processor,f.PvtForImageClassification,f.PvtImageProcessor,f.PvtModel,f.PvtPreTrainedModel,f.PyAnnoteFeatureExtractor,f.PyAnnoteForAudioFrameClassification,f.PyAnnoteModel,f.PyAnnotePreTrainedModel,f.PyAnnoteProcessor,f.QuestionAnsweringModelOutput,f.QuestionAnsweringPipeline,f.Qwen2ForCausalLM,f.Qwen2Model,f.Qwen2PreTrainedModel,f.Qwen2Tokenizer,f.Qwen2VLForConditionalGeneration,f.Qwen2VLImageProcessor,f.Qwen2VLPreTrainedModel,f.Qwen2VLProcessor,f.RFDetrForObjectDetection,f.RFDetrModel,f.RFDetrObjectDetectionOutput,f.RFDetrPreTrainedModel,f.RTDetrForObjectDetection,f.RTDetrImageProcessor,f.RTDetrModel,f.RTDetrObjectDetectionOutput,f.RTDetrPreTrainedModel,f.RTDetrV2ForObjectDetection,f.RTDetrV2Model,f.RTDetrV2ObjectDetectionOutput,f.RTDetrV2PreTrainedModel,f.RawAudio,f.RawImage,f.RawVideo,f.RawVideoFrame,f.RepetitionPenaltyLogitsProcessor,f.ResNetForImageClassification,f.ResNetModel,f.ResNetPreTrainedModel,f.RoFormerForMaskedLM,f.RoFormerForQuestionAnswering,f.RoFormerForSequenceClassification,f.RoFormerForTokenClassification,f.RoFormerModel,f.RoFormerPreTrainedModel,f.RoFormerTokenizer,f.RobertaForMaskedLM,f.RobertaForQuestionAnswering,f.RobertaForSequenceClassification,f.RobertaForTokenClassification,f.RobertaModel,f.RobertaPreTrainedModel,f.RobertaTokenizer,f.SamImageProcessor,f.SamImageSegmentationOutput,f.SamModel,f.SamPreTrainedModel,f.SamProcessor,f.SapiensForDepthEstimation,f.SapiensForNormalEstimation,f.SapiensForSemanticSegmentation,f.SapiensPreTrainedModel,f.SeamlessM4TFeatureExtractor,f.SegformerFeatureExtractor,f.SegformerForImageClassification,f.SegformerForSemanticSegmentation,f.SegformerImageProcessor,f.SegformerModel,f.SegformerPreTrainedModel,f.Seq2SeqLMOutput,f.SequenceClassifierOutput,f.SiglipImageProcessor,f.SiglipModel,f.SiglipPreTrainedModel,f.SiglipTextModel,f.SiglipTokenizer,f.SiglipVisionModel,f.SmolVLMForConditionalGeneration,f.SmolVLMImageProcessor,f.SmolVLMProcessor,f.SnacDecoderModel,f.SnacEncoderModel,f.SnacFeatureExtractor,f.SnacModel,f.SnacPreTrainedModel,f.SpeechT5FeatureExtractor,f.SpeechT5ForSpeechToText,f.SpeechT5ForTextToSpeech,f.SpeechT5HifiGan,f.SpeechT5Model,f.SpeechT5PreTrainedModel,f.SpeechT5Processor,f.SpeechT5Tokenizer,f.SqueezeBertForMaskedLM,f.SqueezeBertForQuestionAnswering,f.SqueezeBertForSequenceClassification,f.SqueezeBertModel,f.SqueezeBertPreTrainedModel,f.SqueezeBertTokenizer,f.StableLmForCausalLM,f.StableLmModel,f.StableLmPreTrainedModel,f.Starcoder2ForCausalLM,f.Starcoder2Model,f.Starcoder2PreTrainedModel,f.StoppingCriteria,f.StoppingCriteriaList,f.StyleTextToSpeech2Model,f.StyleTextToSpeech2PreTrainedModel,f.SummarizationPipeline,f.SuppressTokensAtBeginLogitsProcessor,f.Swin2SRForImageSuperResolution,f.Swin2SRImageProcessor,f.Swin2SRModel,f.Swin2SRPreTrainedModel,f.SwinForImageClassification,f.SwinForSemanticSegmentation,f.SwinModel,f.SwinPreTrainedModel,f.T5ForConditionalGeneration,f.T5Model,f.T5PreTrainedModel,f.T5Tokenizer,f.TableTransformerForObjectDetection,f.TableTransformerModel,f.TableTransformerObjectDetectionOutput,f.TableTransformerPreTrainedModel,f.TemperatureLogitsWarper,f.Tensor,f.Text2TextGenerationPipeline,f.TextClassificationPipeline,f.TextGenerationPipeline;var mT=f.TextStreamer;f.TextToAudioPipeline,f.TokenClassificationPipeline,f.TokenClassifierOutput,f.TokenizerModel,f.TopKLogitsWarper,f.TopPLogitsWarper,f.TrOCRForCausalLM,f.TrOCRPreTrainedModel,f.TranslationPipeline,f.UltravoxModel,f.UltravoxPreTrainedModel,f.UltravoxProcessor,f.UniSpeechForCTC,f.UniSpeechForSequenceClassification,f.UniSpeechModel,f.UniSpeechPreTrainedModel,f.UniSpeechSatForAudioFrameClassification,f.UniSpeechSatForCTC,f.UniSpeechSatForSequenceClassification,f.UniSpeechSatModel,f.UniSpeechSatPreTrainedModel,f.VLChatProcessor,f.VLMImageProcessor,f.ViTFeatureExtractor,f.ViTForImageClassification,f.ViTImageProcessor,f.ViTMAEModel,f.ViTMAEPreTrainedModel,f.ViTMSNForImageClassification,f.ViTMSNModel,f.ViTMSNPreTrainedModel,f.ViTModel,f.ViTPreTrainedModel,f.VisionEncoderDecoderModel,f.VitMatteForImageMatting,f.VitMatteImageProcessor,f.VitMattePreTrainedModel,f.VitPoseForPoseEstimation,f.VitPoseImageProcessor,f.VitPosePreTrainedModel,f.VitsModel,f.VitsModelOutput,f.VitsPreTrainedModel,f.VitsTokenizer,f.Wav2Vec2BertForCTC,f.Wav2Vec2BertForSequenceClassification,f.Wav2Vec2BertModel,f.Wav2Vec2BertPreTrainedModel,f.Wav2Vec2CTCTokenizer,f.Wav2Vec2FeatureExtractor,f.Wav2Vec2ForAudioFrameClassification,f.Wav2Vec2ForCTC,f.Wav2Vec2ForSequenceClassification,f.Wav2Vec2Model,f.Wav2Vec2PreTrainedModel,f.Wav2Vec2Processor,f.Wav2Vec2ProcessorWithLM,f.WavLMForAudioFrameClassification,f.WavLMForCTC,f.WavLMForSequenceClassification,f.WavLMForXVector,f.WavLMModel,f.WavLMPreTrainedModel,f.WeSpeakerFeatureExtractor,f.WeSpeakerResNetModel,f.WeSpeakerResNetPreTrainedModel,f.WhisperFeatureExtractor;var fT=f.WhisperForConditionalGeneration;f.WhisperModel,f.WhisperPreTrainedModel,f.WhisperProcessor,f.WhisperTextStreamer,f.WhisperTimeStampLogitsProcessor,f.WhisperTokenizer,f.XLMForQuestionAnswering,f.XLMForSequenceClassification,f.XLMForTokenClassification,f.XLMModel,f.XLMPreTrainedModel,f.XLMRobertaForMaskedLM,f.XLMRobertaForQuestionAnswering,f.XLMRobertaForSequenceClassification,f.XLMRobertaForTokenClassification,f.XLMRobertaModel,f.XLMRobertaPreTrainedModel,f.XLMRobertaTokenizer,f.XLMTokenizer,f.XLMWithLMHeadModel,f.XVectorOutput,f.YolosFeatureExtractor,f.YolosForObjectDetection,f.YolosImageProcessor,f.YolosModel,f.YolosObjectDetectionOutput,f.YolosPreTrainedModel,f.ZeroShotAudioClassificationPipeline,f.ZeroShotClassificationPipeline,f.ZeroShotImageClassificationPipeline,f.ZeroShotObjectDetectionPipeline,f.bankers_round,f.cat,f.cos_sim,f.dot,f.dynamic_time_warping,f.env;var _T=f.full;f.full_like,f.getKeyValueShapes,f.hamming,f.hanning,f.interpolate,f.interpolate_4d,f.interpolate_data,f.is_chinese_char,f.layer_norm,f.load_image,f.load_video,f.log_softmax,f.magnitude,f.matmul,f.max,f.mean,f.mean_pooling,f.medianFilter,f.mel_filter_bank,f.min,f.ones,f.ones_like,f.permute,f.permute_data,f.pipeline,f.quantize_embeddings,f.rand,f.read_audio,f.rfft,f.round,f.slice,f.softmax,f.spectrogram,f.stack,f.std_mean,f.topk,f.window_function,f.zeros,f.zeros_like;const gT=64;class Wn{static async getInstance(r){return this.model_id="onnx-community/whisper-large-v3-turbo",this.tokenizer??(this.tokenizer=hT.from_pretrained(this.model_id,{progress_callback:r})),this.processor??(this.processor=pT.from_pretrained(this.model_id,{progress_callback:r})),this.model??(this.model=fT.from_pretrained(this.model_id,{dtype:{encoder_model:"fp16",decoder_model_merged:"q4"},device:"webgpu",progress_callback:r})),Promise.all([this.tokenizer,this.processor,this.model])}}re(Wn,"model_id",null),re(Wn,"tokenizer"),re(Wn,"processor"),re(Wn,"model");async function wT(e){const r=atob(e),t=new Uint8Array(r.length);for(let n=0;n{o??(o=performance.now());let _;a++>0&&(_=a/(performance.now()-o)*1e3),globalThis.postMessage({status:"update",output:g,tps:_,numTokens:a})},c=new mT(s,{skip_prompt:!0,decode_kwargs:{skip_special_tokens:!0},callback_function:l}),p=await i(t),u=await n.generate({...p,max_new_tokens:gT,language:r,streamer:c}),h=s.batch_decode(u,{skip_special_tokens:!0});globalThis.postMessage({status:"complete",output:h}),Xc=!1}async function MT(){globalThis.postMessage({status:"loading",data:"Loading model..."});const[e,r,t]=await Wn.getInstance(s=>{globalThis.postMessage(s)});globalThis.postMessage({status:"loading",data:"Compiling shaders and warming up model..."}),await t.generate({input_features:_T([1,128,3e3],0),max_new_tokens:1}),globalThis.postMessage({status:"ready"})}globalThis.addEventListener("message",async e=>{const{type:r,data:t}=e.data;switch(r){case"load":MT();break;case"generate":yT(t);break}})})(); diff --git a/assets/worker-kM8CmLr7.js b/assets/worker-kM8CmLr7.js new file mode 100644 index 0000000000000000000000000000000000000000..3c71f9ab1b0c3432779d097011614e58754fd620 --- /dev/null +++ b/assets/worker-kM8CmLr7.js @@ -0,0 +1,2887 @@ +var Xx=Object.defineProperty;var Qx=(gs,Pr,Ln)=>Pr in gs?Xx(gs,Pr,{enumerable:!0,configurable:!0,writable:!0,value:Ln}):gs[Pr]=Ln;var te=(gs,Pr,Ln)=>Qx(gs,typeof Pr!="symbol"?Pr+"":Pr,Ln);(function(){"use strict";const gs=new Map,Pr=[],Ln=(e,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){const s=gs.get(e);if(s===void 0)gs.set(e,{backend:r,priority:t});else{if(s.priority>t)return;if(s.priority===t&&s.backend!==r)throw new Error(`cannot register backend "${e}" using priority ${t}`)}if(t>=0){const o=Pr.indexOf(e);o!==-1&&Pr.splice(o,1);for(let n=0;n{const r=gs.get(e);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{const t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(e)),await r.initPromise,r.initialized=!0,r.backend}catch(s){return t||(r.error=`${s}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},R0=async e=>{const r=e.executionProviders||[],t=r.map(l=>typeof l=="string"?l:l.name),s=t.length===0?Pr:t;let o;const n=[],i=new Set;for(const l of s){const u=await B0(l);typeof u=="string"?n.push({name:l,err:u}):(o||(o=u),o===u&&i.add(l))}if(!o)throw new Error(`no available backend found. ERR: ${n.map(l=>`[${l.name}] ${l.err}`).join(", ")}`);for(const{name:l,err:u}of n)t.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${u}`);const a=r.filter(l=>i.has(typeof l=="string"?l:l.name));return[o,new Proxy(e,{get:(l,u)=>u==="executionProviders"?a:Reflect.get(l,u)})]},j0="1.21.0";let xd="warning";const Yr={wasm:{},webgl:{},webgpu:{},versions:{common:j0},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}`);xd=e}},get logLevel(){return xd}};Object.defineProperty(Yr,"logLevel",{enumerable:!0});const N0=Yr,V0=(e,r)=>{const t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=e.dims[3],t.height=e.dims[2];const s=t.getContext("2d");if(s!=null){let o,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[3]):(o=e.dims[3],n=e.dims[2]);const i=(r==null?void 0:r.format)!==void 0?r.format:"RGB",a=r==null?void 0:r.norm;let l,u;a===void 0||a.mean===void 0?l=[255,255,255,255]:typeof a.mean=="number"?l=[a.mean,a.mean,a.mean,a.mean]:(l=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(l[3]=a.mean[3])),a===void 0||a.bias===void 0?u=[0,0,0,0]:typeof a.bias=="number"?u=[a.bias,a.bias,a.bias,a.bias]:(u=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(u[3]=a.bias[3]));const p=n*o;let d=0,c=p,f=p*2,_=-1;i==="RGBA"?(d=0,c=p,f=p*2,_=p*3):i==="RGB"?(d=0,c=p,f=p*2):i==="RBG"&&(d=0,f=p,c=p*2);for(let T=0;T{const t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d");let s;if(t!=null){let o,n,i;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[1],i=e.dims[3]):(o=e.dims[3],n=e.dims[2],i=e.dims[1]);const a=r!==void 0&&r.format!==void 0?r.format:"RGB",l=r==null?void 0:r.norm;let u,p;l===void 0||l.mean===void 0?u=[255,255,255,255]:typeof l.mean=="number"?u=[l.mean,l.mean,l.mean,l.mean]:(u=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(u[3]=l.mean[3])),l===void 0||l.bias===void 0?p=[0,0,0,0]:typeof l.bias=="number"?p=[l.bias,l.bias,l.bias,l.bias]:(p=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(p[3]=l.bias[3]));const d=n*o;if(r!==void 0&&(r.format!==void 0&&i===4&&r.format!=="RGBA"||i===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");const c=4;let f=0,_=1,T=2,k=3,w=0,g=d,S=d*2,E=-1;a==="RGBA"?(w=0,g=d,S=d*2,E=d*3):a==="RGB"?(w=0,g=d,S=d*2):a==="RBG"&&(w=0,S=d,g=d*2),s=t.createImageData(o,n);for(let y=0;y{if(e===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");const{height:t,width:s}=r,o=r.norm??{mean:255,bias:0};let n,i;typeof o.mean=="number"?n=[o.mean,o.mean,o.mean,o.mean]:n=[o.mean[0],o.mean[1],o.mean[2],o.mean[3]??255],typeof o.bias=="number"?i=[o.bias,o.bias,o.bias,o.bias]:i=[o.bias[0],o.bias[1],o.bias[2],o.bias[3]??0];const a=r.format!==void 0?r.format:"RGBA",l=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",u=t*s,p=l==="RGBA"?new Float32Array(u*4):new Float32Array(u*3);let d=4,c=0,f=1,_=2,T=3,k=0,w=u,g=u*2,S=-1;a==="RGB"&&(d=3,c=0,f=1,_=2,T=-1),l==="RGBA"?S=u*3:l==="RBG"?(k=0,g=u,w=u*2):l==="BGR"&&(g=0,w=u,k=u*2);for(let y=0;y{const t=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,s=typeof ImageData<"u"&&e instanceof ImageData,o=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string";let i,a=r??{};const l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},u=p=>typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||p instanceof OffscreenCanvas?p.getContext("2d"):null;if(t){const p=l();p.width=e.width,p.height=e.height;const d=u(p);if(d!=null){let c=e.height,f=e.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(c=r.resizedHeight,f=r.resizedWidth),r!==void 0){if(a=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");a.tensorFormat="RGBA",a.height=c,a.width=f}else a.tensorFormat="RGBA",a.height=c,a.width=f;d.drawImage(e,0,0),i=d.getImageData(0,0,f,c).data}else throw new Error("Can not access image data")}else if(s){let p,d;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(p=r.resizedHeight,d=r.resizedWidth):(p=e.height,d=e.width),r!==void 0&&(a=r),a.format="RGBA",a.height=p,a.width=d,r!==void 0){const c=l();c.width=d,c.height=p;const f=u(c);if(f!=null)f.putImageData(e,0,0),i=f.getImageData(0,0,d,p).data;else throw new Error("Can not access image data")}else i=e.data}else if(o){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");const p=l();p.width=e.width,p.height=e.height;const d=u(p);if(d!=null){const c=e.height,f=e.width;return d.drawImage(e,0,0,f,c),i=d.getImageData(0,0,f,c).data,a.height=c,a.width=f,ga(i,a)}else throw new Error("Can not access image data")}else{if(n)return new Promise((p,d)=>{const c=l(),f=u(c);if(!e||!f)return d();const _=new Image;_.crossOrigin="Anonymous",_.src=e,_.onload=()=>{c.width=_.width,c.height=_.height,f.drawImage(_,0,0,c.width,c.height);const T=f.getImageData(0,0,c.width,c.height);a.height=c.height,a.width=c.width,p(ga(T.data,a))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(i!==void 0)return ga(i,a);throw new Error("Input data provided is not supported - aborted tensor creation")},G0=(e,r)=>{const{width:t,height:s,download:o,dispose:n}=r,i=[1,s,t,4];return new Ur({location:"texture",type:"float32",texture:e,dims:i,download:o,dispose:n})},K0=(e,r)=>{const{dataType:t,dims:s,download:o,dispose:n}=r;return new Ur({location:"gpu-buffer",type:t??"float32",gpuBuffer:e,dims:s,download:o,dispose:n})},H0=(e,r)=>{const{dataType:t,dims:s,download:o,dispose:n}=r;return new Ur({location:"ml-tensor",type:t??"float32",mlTensor:e,dims:s,download:o,dispose:n})},q0=(e,r,t)=>new Ur({location:"cpu-pinned",type:e,data:r,dims:t??[r.length]}),zn=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),Zo=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]);let Td=!1;const X0=()=>{if(!Td){Td=!0;const e=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=globalThis.Float16Array,s=typeof t<"u"&&t.from;e&&(zn.set("int64",BigInt64Array),Zo.set(BigInt64Array,"int64")),r&&(zn.set("uint64",BigUint64Array),Zo.set(BigUint64Array,"uint64")),s?(zn.set("float16",t),Zo.set(t,"float16")):zn.set("float16",Uint16Array)}},Q0=e=>{let r=1;for(let t=0;t{switch(e.location){case"cpu":return new Ur(e.type,e.data,r);case"cpu-pinned":return new Ur({location:"cpu-pinned",data:e.data,type:e.type,dims:r});case"texture":return new Ur({location:"texture",texture:e.texture,type:e.type,dims:r});case"gpu-buffer":return new Ur({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:r});case"ml-tensor":return new Ur({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}};let Ur=class{constructor(r,t,s){X0();let o,n;if(typeof r=="object"&&"location"in r)switch(this.dataLocation=r.location,o=r.type,n=r.dims,r.location){case"cpu-pinned":{const a=zn.get(o);if(!a)throw new TypeError(`unsupported type "${o}" to create tensor from pinned buffer`);if(!(r.data instanceof a))throw new TypeError(`buffer should be of type ${a.name}`);this.cpuData=r.data;break}case"texture":{if(o!=="float32")throw new TypeError(`unsupported type "${o}" to create tensor from texture`);this.gpuTextureData=r.texture,this.downloader=r.download,this.disposer=r.dispose;break}case"gpu-buffer":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint8"&&o!=="bool"&&o!=="uint4"&&o!=="int4")throw new TypeError(`unsupported type "${o}" to create tensor from gpu buffer`);this.gpuBufferData=r.gpuBuffer,this.downloader=r.download,this.disposer=r.dispose;break}case"ml-tensor":{if(o!=="float32"&&o!=="float16"&&o!=="int32"&&o!=="int64"&&o!=="uint32"&&o!=="uint64"&&o!=="int8"&&o!=="uint8"&&o!=="bool"&&o!=="uint4"&&o!=="int4")throw new TypeError(`unsupported type "${o}" to create tensor from MLTensor`);this.mlTensorData=r.mlTensor,this.downloader=r.download,this.disposer=r.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,l;if(typeof r=="string")if(o=r,l=s,r==="string"){if(!Array.isArray(t))throw new TypeError("A string tensor's data must be a string array.");a=t}else{const u=zn.get(r);if(u===void 0)throw new TypeError(`Unsupported tensor type: ${r}.`);if(Array.isArray(t)){if(r==="float16"&&u===Uint16Array||r==="uint4"||r==="int4")throw new TypeError(`Creating a ${r} tensor from number array is not supported. Please use ${u.name} as data.`);r==="uint64"||r==="int64"?a=u.from(t,BigInt):a=u.from(t)}else if(t instanceof u)a=t;else if(t instanceof Uint8ClampedArray)if(r==="uint8")a=Uint8Array.from(t);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(r==="float16"&&t instanceof Uint16Array&&u!==Uint16Array)a=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw new TypeError(`A ${o} tensor's data must be type of ${u}`)}else if(l=t,Array.isArray(r)){if(r.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");const u=typeof r[0];if(u==="string")o="string",a=r;else if(u==="boolean")o="bool",a=Uint8Array.from(r);else throw new TypeError(`Invalid element type of data array: ${u}.`)}else if(r instanceof Uint8ClampedArray)o="uint8",a=Uint8Array.from(r);else{const u=Zo.get(r.constructor);if(u===void 0)throw new TypeError(`Unsupported type for tensor data: ${r.constructor}.`);o=u,a=r}if(l===void 0)l=[a.length];else if(!Array.isArray(l))throw new TypeError("A tensor's dims must be a number array");n=l,this.cpuData=a,this.dataLocation="cpu"}const i=Q0(n);if(this.cpuData&&i!==this.cpuData.length&&!((o==="uint4"||o==="int4")&&Math.ceil(i/2)===this.cpuData.length))throw new Error(`Tensor's size(${i}) does not match data length(${this.cpuData.length}).`);this.type=o,this.dims=n,this.size=i}static async fromImage(r,t){return W0(r,t)}static fromTexture(r,t){return G0(r,t)}static fromGpuBuffer(r,t){return K0(r,t)}static fromMLTensor(r,t){return H0(r,t)}static fromPinnedBuffer(r,t,s){return q0(r,t,s)}toDataURL(r){return V0(this,r)}toImageData(r){return U0(this,r)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(r){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;const t=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=t,r&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(r){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return J0(this,r)}};const Bn=Ur,Ed=(e,r)=>{(typeof Yr.trace>"u"?!Yr.wasm.trace:!Yr.trace)||console.timeStamp(`${e}::ORT::${r}`)},Pd=(e,r)=>{var o;const t=((o=new Error().stack)==null?void 0:o.split(/\r\n|\r|\n/g))||[];let s=!1;for(let n=0;n{(typeof Yr.trace>"u"?!Yr.wasm.trace:!Yr.trace)||Pd("BEGIN",e)},Ma=e=>{(typeof Yr.trace>"u"?!Yr.wasm.trace:!Yr.trace)||Pd("END",e)};var Y0=Object.freeze({__proto__:null,InferenceSession:class D0{constructor(r){this.handler=r}async run(r,t,s){wa();const o={};let n={};if(typeof r!="object"||r===null||r instanceof Bn||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let i=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof Bn)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");i=!1;for(const u of t){if(typeof u!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(u)===-1)throw new RangeError(`'fetches' contains invalid output name: ${u}.`);o[u]=null}if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else{let u=!1;const p=Object.getOwnPropertyNames(t);for(const d of this.outputNames)if(p.indexOf(d)!==-1){const c=t[d];(c===null||c instanceof Bn)&&(u=!0,i=!1,o[d]=c)}if(u){if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else n=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(const u of this.inputNames)if(typeof r[u]>"u")throw new Error(`input '${u}' is missing in 'feeds'.`);if(i)for(const u of this.outputNames)o[u]=null;const a=await this.handler.run(r,o,n),l={};for(const u in a)if(Object.hasOwnProperty.call(a,u)){const p=a[u];p instanceof Bn?l[u]=p:l[u]=new Bn(p.type,p.data,p.dims)}return Ma(),l}async release(){return this.handler.dispose()}static async create(r,t,s,o){wa();let n,i={};if(typeof r=="string"){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){const p=r;let d=0,c=r.byteLength;if(typeof t=="object"&&t!==null)i=t;else if(typeof t=="number"){if(d=t,!Number.isSafeInteger(d))throw new RangeError("'byteOffset' must be an integer.");if(d<0||d>=p.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${p.byteLength}).`);if(c=r.byteLength-d,typeof s=="number"){if(c=s,!Number.isSafeInteger(c))throw new RangeError("'byteLength' must be an integer.");if(c<=0||d+c>p.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${p.byteLength-d}].`);if(typeof o=="object"&&o!==null)i=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof s<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(p,d,c)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");const[a,l]=await R0(i),u=await a.createInferenceSessionHandler(n,l);return Ma(),new D0(u)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}},TRACE:Ed,TRACE_FUNC_BEGIN:wa,TRACE_FUNC_END:Ma,Tensor:Bn,env:N0,registerBackend:Ln});/*! + * ONNX Runtime Web v1.22.0-dev.20250409-89f8206ba4 + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */var ba=Object.defineProperty,Z0=Object.getOwnPropertyDescriptor,ev=Object.getOwnPropertyNames,tv=Object.prototype.hasOwnProperty,rv=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Be=(e,r)=>()=>(e&&(r=e(e=0)),r),Rn=(e,r)=>{for(var t in r)ba(e,t,{get:r[t],enumerable:!0})},sv=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of ev(r))!tv.call(e,o)&&o!==t&&ba(e,o,{get:()=>r[o],enumerable:!(s=Z0(r,o))||s.enumerable});return e},ao=e=>sv(ba({},"__esModule",{value:!0}),e),lo,Ds,Ys,Cd,Sd,$d=Be(()=>{lo=new Map,Ds=[],Ys=(e,r,t)=>{if(r&&typeof r.init=="function"&&typeof r.createInferenceSessionHandler=="function"){let s=lo.get(e);if(s===void 0)lo.set(e,{backend:r,priority:t});else{if(s.priority>t)return;if(s.priority===t&&s.backend!==r)throw new Error(`cannot register backend "${e}" using priority ${t}`)}if(t>=0){let o=Ds.indexOf(e);o!==-1&&Ds.splice(o,1);for(let n=0;n{let r=lo.get(e);if(!r)return"backend not found.";if(r.initialized)return r.backend;if(r.aborted)return r.error;{let t=!!r.initPromise;try{return t||(r.initPromise=r.backend.init(e)),await r.initPromise,r.initialized=!0,r.backend}catch(s){return t||(r.error=`${s}`,r.aborted=!0),r.error}finally{delete r.initPromise}}},Sd=async e=>{let r=e.executionProviders||[],t=r.map(l=>typeof l=="string"?l:l.name),s=t.length===0?Ds:t,o,n=[],i=new Set;for(let l of s){let u=await Cd(l);typeof u=="string"?n.push({name:l,err:u}):(o||(o=u),o===u&&i.add(l))}if(!o)throw new Error(`no available backend found. ERR: ${n.map(l=>`[${l.name}] ${l.err}`).join(", ")}`);for(let{name:l,err:u}of n)t.includes(l)&&console.warn(`removing requested execution provider "${l}" from session options because it is not available: ${u}`);let a=r.filter(l=>i.has(typeof l=="string"?l:l.name));return[o,new Proxy(e,{get:(l,u)=>u==="executionProviders"?a:Reflect.get(l,u)})]}}),nv=Be(()=>{$d()}),kd,ov=Be(()=>{kd="1.22.0-dev.20250409-89f8206ba4"}),ya,Wr,Id=Be(()=>{ov(),ya="warning",Wr={wasm:{},webgl:{},webgpu:{},versions:{common:kd},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}`);ya=e}},get logLevel(){return ya}},Object.defineProperty(Wr,"logLevel",{enumerable:!0})}),Bt,iv=Be(()=>{Id(),Bt=Wr}),Ad,Fd,av=Be(()=>{Ad=(e,r)=>{let t=typeof document<"u"?document.createElement("canvas"):new OffscreenCanvas(1,1);t.width=e.dims[3],t.height=e.dims[2];let s=t.getContext("2d");if(s!=null){let o,n;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[3]):(o=e.dims[3],n=e.dims[2]);let i=(r==null?void 0:r.format)!==void 0?r.format:"RGB",a=r==null?void 0:r.norm,l,u;a===void 0||a.mean===void 0?l=[255,255,255,255]:typeof a.mean=="number"?l=[a.mean,a.mean,a.mean,a.mean]:(l=[a.mean[0],a.mean[1],a.mean[2],0],a.mean[3]!==void 0&&(l[3]=a.mean[3])),a===void 0||a.bias===void 0?u=[0,0,0,0]:typeof a.bias=="number"?u=[a.bias,a.bias,a.bias,a.bias]:(u=[a.bias[0],a.bias[1],a.bias[2],0],a.bias[3]!==void 0&&(u[3]=a.bias[3]));let p=n*o,d=0,c=p,f=p*2,_=-1;i==="RGBA"?(d=0,c=p,f=p*2,_=p*3):i==="RGB"?(d=0,c=p,f=p*2):i==="RBG"&&(d=0,f=p,c=p*2);for(let T=0;T{let t=typeof document<"u"?document.createElement("canvas").getContext("2d"):new OffscreenCanvas(1,1).getContext("2d"),s;if(t!=null){let o,n,i;(r==null?void 0:r.tensorLayout)!==void 0&&r.tensorLayout==="NHWC"?(o=e.dims[2],n=e.dims[1],i=e.dims[3]):(o=e.dims[3],n=e.dims[2],i=e.dims[1]);let a=r!==void 0&&r.format!==void 0?r.format:"RGB",l=r==null?void 0:r.norm,u,p;l===void 0||l.mean===void 0?u=[255,255,255,255]:typeof l.mean=="number"?u=[l.mean,l.mean,l.mean,l.mean]:(u=[l.mean[0],l.mean[1],l.mean[2],255],l.mean[3]!==void 0&&(u[3]=l.mean[3])),l===void 0||l.bias===void 0?p=[0,0,0,0]:typeof l.bias=="number"?p=[l.bias,l.bias,l.bias,l.bias]:(p=[l.bias[0],l.bias[1],l.bias[2],0],l.bias[3]!==void 0&&(p[3]=l.bias[3]));let d=n*o;if(r!==void 0&&(r.format!==void 0&&i===4&&r.format!=="RGBA"||i===3&&r.format!=="RGB"&&r.format!=="BGR"))throw new Error("Tensor format doesn't match input tensor dims");let c=4,f=0,_=1,T=2,k=3,w=0,g=d,S=d*2,E=-1;a==="RGBA"?(w=0,g=d,S=d*2,E=d*3):a==="RGB"?(w=0,g=d,S=d*2):a==="RBG"&&(w=0,S=d,g=d*2),s=t.createImageData(o,n);for(let y=0;y{xa(),ei=(e,r)=>{if(e===void 0)throw new Error("Image buffer must be defined");if(r.height===void 0||r.width===void 0)throw new Error("Image height and width must be defined");if(r.tensorLayout==="NHWC")throw new Error("NHWC Tensor layout is not supported yet");let{height:t,width:s}=r,o=r.norm??{mean:255,bias:0},n,i;typeof o.mean=="number"?n=[o.mean,o.mean,o.mean,o.mean]:n=[o.mean[0],o.mean[1],o.mean[2],o.mean[3]??255],typeof o.bias=="number"?i=[o.bias,o.bias,o.bias,o.bias]:i=[o.bias[0],o.bias[1],o.bias[2],o.bias[3]??0];let a=r.format!==void 0?r.format:"RGBA",l=r.tensorFormat!==void 0&&r.tensorFormat!==void 0?r.tensorFormat:"RGB",u=t*s,p=l==="RGBA"?new Float32Array(u*4):new Float32Array(u*3),d=4,c=0,f=1,_=2,T=3,k=0,w=u,g=u*2,S=-1;a==="RGB"&&(d=3,c=0,f=1,_=2,T=-1),l==="RGBA"?S=u*3:l==="RBG"?(k=0,g=u,w=u*2):l==="BGR"&&(g=0,w=u,k=u*2);for(let E=0;E{let t=typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement,s=typeof ImageData<"u"&&e instanceof ImageData,o=typeof ImageBitmap<"u"&&e instanceof ImageBitmap,n=typeof e=="string",i,a=r??{},l=()=>{if(typeof document<"u")return document.createElement("canvas");if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(1,1);throw new Error("Canvas is not supported")},u=p=>typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||p instanceof OffscreenCanvas?p.getContext("2d"):null;if(t){let p=l();p.width=e.width,p.height=e.height;let d=u(p);if(d!=null){let c=e.height,f=e.width;if(r!==void 0&&r.resizedHeight!==void 0&&r.resizedWidth!==void 0&&(c=r.resizedHeight,f=r.resizedWidth),r!==void 0){if(a=r,r.tensorFormat!==void 0)throw new Error("Image input config format must be RGBA for HTMLImageElement");a.tensorFormat="RGBA",a.height=c,a.width=f}else a.tensorFormat="RGBA",a.height=c,a.width=f;d.drawImage(e,0,0),i=d.getImageData(0,0,f,c).data}else throw new Error("Can not access image data")}else if(s){let p,d;if(r!==void 0&&r.resizedWidth!==void 0&&r.resizedHeight!==void 0?(p=r.resizedHeight,d=r.resizedWidth):(p=e.height,d=e.width),r!==void 0&&(a=r),a.format="RGBA",a.height=p,a.width=d,r!==void 0){let c=l();c.width=d,c.height=p;let f=u(c);if(f!=null)f.putImageData(e,0,0),i=f.getImageData(0,0,d,p).data;else throw new Error("Can not access image data")}else i=e.data}else if(o){if(r===void 0)throw new Error("Please provide image config with format for Imagebitmap");let p=l();p.width=e.width,p.height=e.height;let d=u(p);if(d!=null){let c=e.height,f=e.width;return d.drawImage(e,0,0,f,c),i=d.getImageData(0,0,f,c).data,a.height=c,a.width=f,ei(i,a)}else throw new Error("Can not access image data")}else{if(n)return new Promise((p,d)=>{let c=l(),f=u(c);if(!e||!f)return d();let _=new Image;_.crossOrigin="Anonymous",_.src=e,_.onload=()=>{c.width=_.width,c.height=_.height,f.drawImage(_,0,0,c.width,c.height);let T=f.getImageData(0,0,c.width,c.height);a.height=c.height,a.width=c.width,p(ei(T.data,a))}});throw new Error("Input data provided is not supported - aborted tensor creation")}if(i!==void 0)return ei(i,a);throw new Error("Input data provided is not supported - aborted tensor creation")},Dd=(e,r)=>{let{width:t,height:s,download:o,dispose:n}=r,i=[1,s,t,4];return new Or({location:"texture",type:"float32",texture:e,dims:i,download:o,dispose:n})},Ld=(e,r)=>{let{dataType:t,dims:s,download:o,dispose:n}=r;return new Or({location:"gpu-buffer",type:t??"float32",gpuBuffer:e,dims:s,download:o,dispose:n})},zd=(e,r)=>{let{dataType:t,dims:s,download:o,dispose:n}=r;return new Or({location:"ml-tensor",type:t??"float32",mlTensor:e,dims:s,download:o,dispose:n})},Bd=(e,r,t)=>new Or({location:"cpu-pinned",type:e,data:r,dims:t??[r.length]})}),Zs,uo,va,Rd,uv=Be(()=>{Zs=new Map([["float32",Float32Array],["uint8",Uint8Array],["int8",Int8Array],["uint16",Uint16Array],["int16",Int16Array],["int32",Int32Array],["bool",Uint8Array],["float64",Float64Array],["uint32",Uint32Array],["int4",Uint8Array],["uint4",Uint8Array]]),uo=new Map([[Float32Array,"float32"],[Uint8Array,"uint8"],[Int8Array,"int8"],[Uint16Array,"uint16"],[Int16Array,"int16"],[Int32Array,"int32"],[Float64Array,"float64"],[Uint32Array,"uint32"]]),va=!1,Rd=()=>{if(!va){va=!0;let e=typeof BigInt64Array<"u"&&BigInt64Array.from,r=typeof BigUint64Array<"u"&&BigUint64Array.from,t=globalThis.Float16Array,s=typeof t<"u"&&t.from;e&&(Zs.set("int64",BigInt64Array),uo.set(BigInt64Array,"int64")),r&&(Zs.set("uint64",BigUint64Array),uo.set(BigUint64Array,"uint64")),s?(Zs.set("float16",t),uo.set(t,"float16")):Zs.set("float16",Uint16Array)}}}),jd,Nd,dv=Be(()=>{xa(),jd=e=>{let r=1;for(let t=0;t{switch(e.location){case"cpu":return new Or(e.type,e.data,r);case"cpu-pinned":return new Or({location:"cpu-pinned",data:e.data,type:e.type,dims:r});case"texture":return new Or({location:"texture",texture:e.texture,type:e.type,dims:r});case"gpu-buffer":return new Or({location:"gpu-buffer",gpuBuffer:e.gpuBuffer,type:e.type,dims:r});case"ml-tensor":return new Or({location:"ml-tensor",mlTensor:e.mlTensor,type:e.type,dims:r});default:throw new Error(`tensorReshape: tensor location ${e.location} is not supported`)}}}),Or,xa=Be(()=>{av(),lv(),uv(),dv(),Or=class{constructor(e,r,t){Rd();let s,o;if(typeof e=="object"&&"location"in e)switch(this.dataLocation=e.location,s=e.type,o=e.dims,e.location){case"cpu-pinned":{let i=Zs.get(s);if(!i)throw new TypeError(`unsupported type "${s}" to create tensor from pinned buffer`);if(!(e.data instanceof i))throw new TypeError(`buffer should be of type ${i.name}`);this.cpuData=e.data;break}case"texture":{if(s!=="float32")throw new TypeError(`unsupported type "${s}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break}case"gpu-buffer":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint8"&&s!=="bool"&&s!=="uint4"&&s!=="int4")throw new TypeError(`unsupported type "${s}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break}case"ml-tensor":{if(s!=="float32"&&s!=="float16"&&s!=="int32"&&s!=="int64"&&s!=="uint32"&&s!=="uint64"&&s!=="int8"&&s!=="uint8"&&s!=="bool"&&s!=="uint4"&&s!=="int4")throw new TypeError(`unsupported type "${s}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break}default:throw new Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let i,a;if(typeof e=="string")if(s=e,a=t,e==="string"){if(!Array.isArray(r))throw new TypeError("A string tensor's data must be a string array.");i=r}else{let l=Zs.get(e);if(l===void 0)throw new TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(r)){if(e==="float16"&&l===Uint16Array||e==="uint4"||e==="int4")throw new TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${l.name} as data.`);e==="uint64"||e==="int64"?i=l.from(r,BigInt):i=l.from(r)}else if(r instanceof l)i=r;else if(r instanceof Uint8ClampedArray)if(e==="uint8")i=Uint8Array.from(r);else throw new TypeError("A Uint8ClampedArray tensor's data must be type of uint8");else if(e==="float16"&&r instanceof Uint16Array&&l!==Uint16Array)i=new globalThis.Float16Array(r.buffer,r.byteOffset,r.length);else throw new TypeError(`A ${s} tensor's data must be type of ${l}`)}else if(a=r,Array.isArray(e)){if(e.length===0)throw new TypeError("Tensor type cannot be inferred from an empty array.");let l=typeof e[0];if(l==="string")s="string",i=e;else if(l==="boolean")s="bool",i=Uint8Array.from(e);else throw new TypeError(`Invalid element type of data array: ${l}.`)}else if(e instanceof Uint8ClampedArray)s="uint8",i=Uint8Array.from(e);else{let l=uo.get(e.constructor);if(l===void 0)throw new TypeError(`Unsupported type for tensor data: ${e.constructor}.`);s=l,i=e}if(a===void 0)a=[i.length];else if(!Array.isArray(a))throw new TypeError("A tensor's dims must be a number array");o=a,this.cpuData=i,this.dataLocation="cpu"}let n=jd(o);if(this.cpuData&&n!==this.cpuData.length&&!((s==="uint4"||s==="int4")&&Math.ceil(n/2)===this.cpuData.length))throw new Error(`Tensor's size(${n}) does not match data length(${this.cpuData.length}).`);this.type=s,this.dims=o,this.size=n}static async fromImage(e,r){return Od(e,r)}static fromTexture(e,r){return Dd(e,r)}static fromGpuBuffer(e,r){return Ld(e,r)}static fromMLTensor(e,r){return zd(e,r)}static fromPinnedBuffer(e,r,t){return Bd(e,r,t)}toDataURL(e){return Ad(this,e)}toImageData(e){return Fd(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw new Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw new Error("The data is not stored as a WebGL texture.");return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw new Error("The data is not stored as a WebGPU buffer.");return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw new Error("The data is not stored as a WebNN MLTensor.");return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case"cpu":case"cpu-pinned":return this.data;case"texture":case"gpu-buffer":case"ml-tensor":{if(!this.downloader)throw new Error("The current tensor is not created with a specified data downloader.");if(this.isDownloading)throw new Error("The current tensor is being downloaded.");try{this.isDownloading=!0;let r=await this.downloader();return this.downloader=void 0,this.dataLocation="cpu",this.cpuData=r,e&&this.disposer&&(this.disposer(),this.disposer=void 0),r}finally{this.isDownloading=!1}}default:throw new Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw new Error("The current tensor is being downloaded.");this.disposer&&(this.disposer(),this.disposer=void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation="none"}ensureValid(){if(this.dataLocation==="none")throw new Error("The tensor is disposed.")}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw new Error("Cannot reshape a tensor that owns GPU resource.");return Nd(this,e)}}}),Zr,Vd=Be(()=>{xa(),Zr=Or}),co,Ta,es,Gr,Ud=Be(()=>{Id(),co=(e,r)=>{(typeof Wr.trace>"u"?!Wr.wasm.trace:!Wr.trace)||console.timeStamp(`${e}::ORT::${r}`)},Ta=(e,r)=>{var o;let t=((o=new Error().stack)==null?void 0:o.split(/\r\n|\r|\n/g))||[],s=!1;for(let n=0;n{(typeof Wr.trace>"u"?!Wr.wasm.trace:!Wr.trace)||Ta("BEGIN",e)},Gr=e=>{(typeof Wr.trace>"u"?!Wr.wasm.trace:!Wr.trace)||Ta("END",e)}}),Wd,cv=Be(()=>{$d(),Vd(),Ud(),Wd=class L0{constructor(r){this.handler=r}async run(r,t,s){es();let o={},n={};if(typeof r!="object"||r===null||r instanceof Zr||Array.isArray(r))throw new TypeError("'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.");let i=!0;if(typeof t=="object"){if(t===null)throw new TypeError("Unexpected argument[1]: cannot be null.");if(t instanceof Zr)throw new TypeError("'fetches' cannot be a Tensor");if(Array.isArray(t)){if(t.length===0)throw new TypeError("'fetches' cannot be an empty array.");i=!1;for(let u of t){if(typeof u!="string")throw new TypeError("'fetches' must be a string array or an object.");if(this.outputNames.indexOf(u)===-1)throw new RangeError(`'fetches' contains invalid output name: ${u}.`);o[u]=null}if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else{let u=!1,p=Object.getOwnPropertyNames(t);for(let d of this.outputNames)if(p.indexOf(d)!==-1){let c=t[d];(c===null||c instanceof Zr)&&(u=!0,i=!1,o[d]=c)}if(u){if(typeof s=="object"&&s!==null)n=s;else if(typeof s<"u")throw new TypeError("'options' must be an object.")}else n=t}}else if(typeof t<"u")throw new TypeError("Unexpected argument[1]: must be 'fetches' or 'options'.");for(let u of this.inputNames)if(typeof r[u]>"u")throw new Error(`input '${u}' is missing in 'feeds'.`);if(i)for(let u of this.outputNames)o[u]=null;let a=await this.handler.run(r,o,n),l={};for(let u in a)if(Object.hasOwnProperty.call(a,u)){let p=a[u];p instanceof Zr?l[u]=p:l[u]=new Zr(p.type,p.data,p.dims)}return Gr(),l}async release(){return this.handler.dispose()}static async create(r,t,s,o){es();let n,i={};if(typeof r=="string"){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof Uint8Array){if(n=r,typeof t=="object"&&t!==null)i=t;else if(typeof t<"u")throw new TypeError("'options' must be an object.")}else if(r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer){let p=r,d=0,c=r.byteLength;if(typeof t=="object"&&t!==null)i=t;else if(typeof t=="number"){if(d=t,!Number.isSafeInteger(d))throw new RangeError("'byteOffset' must be an integer.");if(d<0||d>=p.byteLength)throw new RangeError(`'byteOffset' is out of range [0, ${p.byteLength}).`);if(c=r.byteLength-d,typeof s=="number"){if(c=s,!Number.isSafeInteger(c))throw new RangeError("'byteLength' must be an integer.");if(c<=0||d+c>p.byteLength)throw new RangeError(`'byteLength' is out of range (0, ${p.byteLength-d}].`);if(typeof o=="object"&&o!==null)i=o;else if(typeof o<"u")throw new TypeError("'options' must be an object.")}else if(typeof s<"u")throw new TypeError("'byteLength' must be a number.")}else if(typeof t<"u")throw new TypeError("'options' must be an object.");n=new Uint8Array(p,d,c)}else throw new TypeError("Unexpected argument[0]: must be 'path' or 'buffer'.");let[a,l]=await Sd(i),u=await a.createInferenceSessionHandler(n,l);return Gr(),new L0(u)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),Ea,pv=Be(()=>{cv(),Ea=Wd}),hv=Be(()=>{}),mv=Be(()=>{}),_v=Be(()=>{}),fv=Be(()=>{}),Gd={};Rn(Gd,{InferenceSession:()=>Ea,TRACE:()=>co,TRACE_FUNC_BEGIN:()=>es,TRACE_FUNC_END:()=>Gr,Tensor:()=>Zr,env:()=>Bt,registerBackend:()=>Ys});var ts=Be(()=>{nv(),iv(),pv(),Vd(),hv(),mv(),Ud(),_v(),fv()}),Pa=Be(()=>{}),Kd={};Rn(Kd,{default:()=>Hd});var Ca,Sa,Hd,gv=Be(()=>{var e;Cg(),en(),La(),Ca="ort-wasm-proxy-worker",Sa=((e=globalThis.self)==null?void 0:e.name)===Ca,Sa&&(self.onmessage=r=>{let{type:t,in:s}=r.data;try{switch(t){case"init-wasm":Ra(s.wasm).then(()=>{Yl(s).then(()=>{postMessage({type:t})},o=>{postMessage({type:t,err:o})})},o=>{postMessage({type:t,err:o})});break;case"init-ep":{let{epName:o,env:n}=s;Zl(n,o).then(()=>{postMessage({type:t})},i=>{postMessage({type:t,err:i})});break}case"copy-from":{let{buffer:o}=s,n=Mi(o);postMessage({type:t,out:n});break}case"create":{let{model:o,options:n}=s;tu(o,n).then(i=>{postMessage({type:t,out:i})},i=>{postMessage({type:t,err:i})});break}case"release":ru(s),postMessage({type:t});break;case"run":{let{sessionId:o,inputIndices:n,inputs:i,outputIndices:a,options:l}=s;nu(o,n,i,a,new Array(a.length).fill(null),l).then(u=>{u.some(p=>p[3]!=="cpu")?postMessage({type:t,err:"Proxy does not support non-cpu tensor location."}):postMessage({type:t,out:u},iu([...i,...u]))},u=>{postMessage({type:t,err:u})});break}case"end-profiling":ou(s),postMessage({type:t});break;default:}}catch(o){postMessage({type:t,err:o})}}),Hd=Sa?null:r=>new Worker(r??Dr,{type:"module",name:Ca})}),qd={};Rn(qd,{default:()=>Xd});var $a,ka,Xd,Qd,wv=Be(()=>{var e,r;ka=($a=self.location.href,async function(t={}){var Qo;var s,o,n=t,i=new Promise((h,x)=>{s=h,o=x}),a=typeof window=="object",l=typeof WorkerGlobalScope<"u",u=l&&((Qo=self.name)==null?void 0:Qo.startsWith("em-pthread"));n.mountExternalData=(h,x)=>{h.startsWith("./")&&(h=h.substring(2)),(n.Eb||(n.Eb=new Map)).set(h,x)},n.unmountExternalData=()=>{delete n.Eb};var p=globalThis.SharedArrayBuffer??new WebAssembly.Memory({initial:0,maximum:0,pc:!0}).buffer.constructor;let d=h=>async(...x)=>{var I;try{if(n.Fb)throw Error("Session already started");let L=n.Fb={dc:x[0],errors:[]},U=await h(...x);if(n.Fb!==L)throw Error("Session mismatch");(I=n.Jb)==null||I.flush();let ue=L.errors;if(0Oe),0{if(h==="webgpu"){[n.Jb,n.Ub,n.Yb,n.Kb,n.Xb,n.jb,n.Zb,n.ac,n.Vb,n.Wb,n.$b]=x;let I=n.Jb;n.jsepRegisterBuffer=(L,U,ue,Te)=>I.registerBuffer(L,U,ue,Te),n.jsepGetBuffer=L=>I.getBuffer(L),n.jsepCreateDownloader=(L,U,ue)=>I.createDownloader(L,U,ue),n.jsepOnCreateSession=L=>{I.onCreateSession(L)},n.jsepOnReleaseSession=L=>{I.onReleaseSession(L)},n.jsepOnRunStart=L=>I.onRunStart(L),n.bc=(L,U)=>{I.upload(L,U)}}else if(h==="webnn"){let I=x[0];[n.nc,n.Nb,n.webnnEnsureTensor,n.Ob,n.webnnDownloadTensor]=x.slice(1),n.webnnReleaseTensorId=n.Nb,n.webnnUploadTensor=n.Ob,n.webnnOnRunStart=L=>I.onRunStart(L),n.webnnOnRunEnd=I.onRunEnd.bind(I),n.webnnRegisterMLContext=(L,U)=>{I.registerMLContext(L,U)},n.webnnOnReleaseSession=L=>{I.onReleaseSession(L)},n.webnnCreateMLTensorDownloader=(L,U)=>I.createMLTensorDownloader(L,U),n.webnnRegisterMLTensor=(L,U,ue,Te)=>I.registerMLTensor(L,U,ue,Te),n.webnnCreateMLContext=L=>I.createMLContext(L),n.webnnRegisterMLConstant=(L,U,ue,Te,Oe,Ke)=>I.registerMLConstant(L,U,ue,Te,Oe,n.Eb,Ke),n.webnnRegisterGraphInput=I.registerGraphInput.bind(I),n.webnnIsGraphInput=I.isGraphInput.bind(I),n.webnnCreateTemporaryTensor=I.createTemporaryTensor.bind(I),n.webnnIsInt64Supported=I.isInt64Supported.bind(I)}};let c=()=>{let h=(x,I,L)=>(...U)=>{let ue=Nt,Te=I==null?void 0:I();U=x(...U);let Oe=I==null?void 0:I();return Te!==Oe&&(x=Oe,L(Te),I=L=null),Nt!=ue?new Promise((Ke,Ze)=>{Rr={resolve:Ke,reject:Ze}}):U};(()=>{for(let x of["_OrtAppendExecutionProvider","_OrtCreateSession","_OrtRun","_OrtRunWithBinding","_OrtBindInput"])n[x]=h(n[x],()=>n[x],I=>n[x]=I)})(),d!==void 0&&(n._OrtRun=d(n._OrtRun),n._OrtRunWithBinding=d(n._OrtRunWithBinding)),c=void 0};n.asyncInit=()=>{c==null||c()};var f,_,T=Object.assign({},n),k=(h,x)=>{throw x},w="";(a||l)&&(l?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),$a&&(w=$a),w=w.startsWith("blob:")?"":w.slice(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1),l&&(_=h=>{var x=new XMLHttpRequest;return x.open("GET",h,!1),x.responseType="arraybuffer",x.send(null),new Uint8Array(x.response)}),f=async h=>{if(V(h))return new Promise((I,L)=>{var U=new XMLHttpRequest;U.open("GET",h,!0),U.responseType="arraybuffer",U.onload=()=>{U.status==200||U.status==0&&U.response?I(U.response):L(U.status)},U.onerror=L,U.send(null)});var x=await fetch(h,{credentials:"same-origin"});if(x.ok)return x.arrayBuffer();throw Error(x.status+" : "+x.url)});var g=console.log.bind(console),S=console.error.bind(console),E=g,y=S;Object.assign(n,T),T=null;var M,v,C,A,B,K,G,j,ee,H,Z,X,oe,me=n.wasmBinary,ae=!1,V=h=>h.startsWith("file://");function F(){return M.buffer!=A.buffer&&R(),A}function W(){return M.buffer!=A.buffer&&R(),B}function re(){return M.buffer!=A.buffer&&R(),K}function _e(){return M.buffer!=A.buffer&&R(),G}function se(){return M.buffer!=A.buffer&&R(),j}function ce(){return M.buffer!=A.buffer&&R(),ee}function $e(){return M.buffer!=A.buffer&&R(),H}function Ue(){return M.buffer!=A.buffer&&R(),oe}if(u){let h=function(x){try{var I=x.data,L=I.Bb;if(L==="load"){let U=[];self.onmessage=ue=>U.push(ue),self.startWorker=()=>{postMessage({Bb:"loaded"});for(let ue of U)h(ue);self.onmessage=h};for(let ue of I.Rb)n[ue]&&!n[ue].proxy||(n[ue]=(...Te)=>{postMessage({Bb:"callHandler",Qb:ue,args:Te})},ue=="print"&&(E=n[ue]),ue=="printErr"&&(y=n[ue]));M=I.kc,R(),we(I.lc)}else if(L==="run"){Ir(I.Ab),Sn(I.Ab,0,0,1,0,0),ur(),ve(I.Ab),q||(Vo(),q=!0);try{js(I.fc,I.Hb)}catch(U){if(U!="unwind")throw U}}else I.target!=="setimmediate"&&(L==="checkMailbox"?q&&je():L&&(y(`worker: received unknown command ${L}`),y(I)))}catch(U){throw Uo(),U}};var we,q=!1;y=function(...x){x=x.join(" "),console.error(x)},self.alert=function(...x){postMessage({Bb:"alert",text:x.join(" "),ic:Xs()})},self.onunhandledrejection=x=>{throw x.reason||x},self.onmessage=h}function R(){var h=M.buffer;n.HEAP8=A=new Int8Array(h),n.HEAP16=K=new Int16Array(h),n.HEAPU8=B=new Uint8Array(h),n.HEAPU16=G=new Uint16Array(h),n.HEAP32=j=new Int32Array(h),n.HEAPU32=ee=new Uint32Array(h),n.HEAPF32=H=new Float32Array(h),n.HEAPF64=oe=new Float64Array(h),n.HEAP64=Z=new BigInt64Array(h),n.HEAPU64=X=new BigUint64Array(h)}function pe(){u?startWorker(n):nt.Ca()}u||(M=new WebAssembly.Memory({initial:256,maximum:65536,shared:!0}),R());var xe,be=0,Se=null;function Ae(){if(--be==0&&Se){var h=Se;Se=null,h()}}function Fe(h){throw y(h="Aborted("+h+")"),ae=!0,h=new WebAssembly.RuntimeError(h+". Build with -sASSERTIONS for more info."),o(h),h}function ze(){return{a:{L:Y,Aa:O,b:Ns,$:us,A:ds,pa:cs,X:De,Z:Qe,qa:tt,na:Rt,ga:zr,ma:Sr,J:ps,Y:hs,V:Kr,oa:ms,W:_s,va:cn,E:pn,Q:hn,O:_n,D:gn,u:wn,r:vs,P:Mn,z:N,R:Q,ja:ie,T:He,aa:Je,M:dt,F:xt,ia:ve,sa:Pt,t:Ht,Ba:br,w:or,o:Zt,l:Ws,c:Is,n:vi,j:Ei,v:Pi,p:Ci,f:Si,s:$i,m:Eo,e:ki,k:Ii,i:Po,g:Ai,d:Co,da:Fi,ea:$o,fa:Di,ba:Tn,ca:ko,N:Io,xa:zi,ua:Ri,h:ji,C:Ao,G:Fs,ta:Bi,x:Ni,ra:pu,U:Vi,q:Li,y:hu,K:Ui,S:Fo,za:Wi,ya:Gi,ka:Lo,la:Xn,_:Xe,B:zo,I:Bo,ha:Qn,H:Ro,a:M,wa:Ie}}}var Ve={829644:(h,x,I,L,U)=>{if(n===void 0||!n.Eb)return 1;if((h=Ft(Number(h>>>0))).startsWith("./")&&(h=h.substring(2)),!(h=n.Eb.get(h)))return 2;if(x=Number(x>>>0),I=Number(I>>>0),L=Number(L>>>0),x+I>h.byteLength)return 3;try{let ue=h.subarray(x,x+I);switch(U){case 0:W().set(ue,L>>>0);break;case 1:n.mc?n.mc(L,ue):n.bc(L,ue);break;default:return 4}return 0}catch{return 4}},830468:(h,x,I)=>{n.Ob(h,W().subarray(x>>>0,x+I>>>0))},830532:()=>n.nc(),830574:h=>{n.Nb(h)},830611:()=>{n.Vb()},830642:()=>{n.Wb()},830671:()=>{n.$b()},830696:h=>n.Ub(h),830729:h=>n.Yb(h),830761:(h,x,I)=>{n.Kb(Number(h),Number(x),Number(I),!0)},830824:(h,x,I)=>{n.Kb(Number(h),Number(x),Number(I))},830881:()=>typeof wasmOffsetConverter<"u",830938:h=>{n.jb("Abs",h,void 0)},830989:h=>{n.jb("Neg",h,void 0)},831040:h=>{n.jb("Floor",h,void 0)},831093:h=>{n.jb("Ceil",h,void 0)},831145:h=>{n.jb("Reciprocal",h,void 0)},831203:h=>{n.jb("Sqrt",h,void 0)},831255:h=>{n.jb("Exp",h,void 0)},831306:h=>{n.jb("Erf",h,void 0)},831357:h=>{n.jb("Sigmoid",h,void 0)},831412:(h,x,I)=>{n.jb("HardSigmoid",h,{alpha:x,beta:I})},831491:h=>{n.jb("Log",h,void 0)},831542:h=>{n.jb("Sin",h,void 0)},831593:h=>{n.jb("Cos",h,void 0)},831644:h=>{n.jb("Tan",h,void 0)},831695:h=>{n.jb("Asin",h,void 0)},831747:h=>{n.jb("Acos",h,void 0)},831799:h=>{n.jb("Atan",h,void 0)},831851:h=>{n.jb("Sinh",h,void 0)},831903:h=>{n.jb("Cosh",h,void 0)},831955:h=>{n.jb("Asinh",h,void 0)},832008:h=>{n.jb("Acosh",h,void 0)},832061:h=>{n.jb("Atanh",h,void 0)},832114:h=>{n.jb("Tanh",h,void 0)},832166:h=>{n.jb("Not",h,void 0)},832217:(h,x,I)=>{n.jb("Clip",h,{min:x,max:I})},832286:h=>{n.jb("Clip",h,void 0)},832338:(h,x)=>{n.jb("Elu",h,{alpha:x})},832396:h=>{n.jb("Gelu",h,void 0)},832448:h=>{n.jb("Relu",h,void 0)},832500:(h,x)=>{n.jb("LeakyRelu",h,{alpha:x})},832564:(h,x)=>{n.jb("ThresholdedRelu",h,{alpha:x})},832634:(h,x)=>{n.jb("Cast",h,{to:x})},832692:h=>{n.jb("Add",h,void 0)},832743:h=>{n.jb("Sub",h,void 0)},832794:h=>{n.jb("Mul",h,void 0)},832845:h=>{n.jb("Div",h,void 0)},832896:h=>{n.jb("Pow",h,void 0)},832947:h=>{n.jb("Equal",h,void 0)},833e3:h=>{n.jb("Greater",h,void 0)},833055:h=>{n.jb("GreaterOrEqual",h,void 0)},833117:h=>{n.jb("Less",h,void 0)},833169:h=>{n.jb("LessOrEqual",h,void 0)},833228:(h,x,I,L,U)=>{n.jb("ReduceMean",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},833403:(h,x,I,L,U)=>{n.jb("ReduceMax",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},833577:(h,x,I,L,U)=>{n.jb("ReduceMin",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},833751:(h,x,I,L,U)=>{n.jb("ReduceProd",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},833926:(h,x,I,L,U)=>{n.jb("ReduceSum",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834100:(h,x,I,L,U)=>{n.jb("ReduceL1",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834273:(h,x,I,L,U)=>{n.jb("ReduceL2",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834446:(h,x,I,L,U)=>{n.jb("ReduceLogSum",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834623:(h,x,I,L,U)=>{n.jb("ReduceSumSquare",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834803:(h,x,I,L,U)=>{n.jb("ReduceLogSumExp",h,{keepDims:!!x,noopWithEmptyAxes:!!I,axes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},834983:h=>{n.jb("Where",h,void 0)},835036:(h,x,I)=>{n.jb("Transpose",h,{perm:x?Array.from(se().subarray(Number(x)>>>0,Number(I)>>>0)):[]})},835160:(h,x,I,L)=>{n.jb("DepthToSpace",h,{blocksize:x,mode:Ft(I),format:L?"NHWC":"NCHW"})},835293:(h,x,I,L)=>{n.jb("DepthToSpace",h,{blocksize:x,mode:Ft(I),format:L?"NHWC":"NCHW"})},835426:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr,Os)=>{n.jb("ConvTranspose",h,{format:Ke?"NHWC":"NCHW",autoPad:x,dilations:[I],group:L,kernelShape:[U],pads:[ue,Te],strides:[Oe],wIsConst:()=>!!F()[Ze>>>0],outputPadding:ht?Array.from(se().subarray(Number(ht)>>>0,Number(Tt)>>>0)):[],outputShape:It?Array.from(se().subarray(Number(It)>>>0,Number(sr)>>>0)):[],activation:Ft(Os)})},835859:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr)=>{n.jb("ConvTranspose",h,{format:Oe?"NHWC":"NCHW",autoPad:x,dilations:Array.from(se().subarray(Number(I)>>>0,2+(Number(I)>>>0)>>>0)),group:L,kernelShape:Array.from(se().subarray(Number(U)>>>0,2+(Number(U)>>>0)>>>0)),pads:Array.from(se().subarray(Number(ue)>>>0,4+(Number(ue)>>>0)>>>0)),strides:Array.from(se().subarray(Number(Te)>>>0,2+(Number(Te)>>>0)>>>0)),wIsConst:()=>!!F()[Ke>>>0],outputPadding:Ze?Array.from(se().subarray(Number(Ze)>>>0,Number(ht)>>>0)):[],outputShape:Tt?Array.from(se().subarray(Number(Tt)>>>0,Number(It)>>>0)):[],activation:Ft(sr)})},836520:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr,Os)=>{n.jb("ConvTranspose",h,{format:Ke?"NHWC":"NCHW",autoPad:x,dilations:[I],group:L,kernelShape:[U],pads:[ue,Te],strides:[Oe],wIsConst:()=>!!F()[Ze>>>0],outputPadding:ht?Array.from(se().subarray(Number(ht)>>>0,Number(Tt)>>>0)):[],outputShape:It?Array.from(se().subarray(Number(It)>>>0,Number(sr)>>>0)):[],activation:Ft(Os)})},836953:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr)=>{n.jb("ConvTranspose",h,{format:Oe?"NHWC":"NCHW",autoPad:x,dilations:Array.from(se().subarray(Number(I)>>>0,2+(Number(I)>>>0)>>>0)),group:L,kernelShape:Array.from(se().subarray(Number(U)>>>0,2+(Number(U)>>>0)>>>0)),pads:Array.from(se().subarray(Number(ue)>>>0,4+(Number(ue)>>>0)>>>0)),strides:Array.from(se().subarray(Number(Te)>>>0,2+(Number(Te)>>>0)>>>0)),wIsConst:()=>!!F()[Ke>>>0],outputPadding:Ze?Array.from(se().subarray(Number(Ze)>>>0,Number(ht)>>>0)):[],outputShape:Tt?Array.from(se().subarray(Number(Tt)>>>0,Number(It)>>>0)):[],activation:Ft(sr)})},837614:(h,x)=>{n.jb("GlobalAveragePool",h,{format:x?"NHWC":"NCHW"})},837705:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr)=>{n.jb("AveragePool",h,{format:sr?"NHWC":"NCHW",auto_pad:x,ceil_mode:I,count_include_pad:L,storage_order:U,dilations:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],kernel_shape:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],pads:Ze?Array.from(se().subarray(Number(Ze)>>>0,Number(ht)>>>0)):[],strides:Tt?Array.from(se().subarray(Number(Tt)>>>0,Number(It)>>>0)):[]})},838184:(h,x)=>{n.jb("GlobalAveragePool",h,{format:x?"NHWC":"NCHW"})},838275:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr)=>{n.jb("AveragePool",h,{format:sr?"NHWC":"NCHW",auto_pad:x,ceil_mode:I,count_include_pad:L,storage_order:U,dilations:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],kernel_shape:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],pads:Ze?Array.from(se().subarray(Number(Ze)>>>0,Number(ht)>>>0)):[],strides:Tt?Array.from(se().subarray(Number(Tt)>>>0,Number(It)>>>0)):[]})},838754:(h,x)=>{n.jb("GlobalMaxPool",h,{format:x?"NHWC":"NCHW"})},838841:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr)=>{n.jb("MaxPool",h,{format:sr?"NHWC":"NCHW",auto_pad:x,ceil_mode:I,count_include_pad:L,storage_order:U,dilations:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],kernel_shape:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],pads:Ze?Array.from(se().subarray(Number(Ze)>>>0,Number(ht)>>>0)):[],strides:Tt?Array.from(se().subarray(Number(Tt)>>>0,Number(It)>>>0)):[]})},839316:(h,x)=>{n.jb("GlobalMaxPool",h,{format:x?"NHWC":"NCHW"})},839403:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr)=>{n.jb("MaxPool",h,{format:sr?"NHWC":"NCHW",auto_pad:x,ceil_mode:I,count_include_pad:L,storage_order:U,dilations:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],kernel_shape:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],pads:Ze?Array.from(se().subarray(Number(Ze)>>>0,Number(ht)>>>0)):[],strides:Tt?Array.from(se().subarray(Number(Tt)>>>0,Number(It)>>>0)):[]})},839878:(h,x,I,L,U)=>{n.jb("Gemm",h,{alpha:x,beta:I,transA:L,transB:U})},839982:h=>{n.jb("MatMul",h,void 0)},840036:(h,x,I,L)=>{n.jb("ArgMax",h,{keepDims:!!x,selectLastIndex:!!I,axis:L})},840144:(h,x,I,L)=>{n.jb("ArgMin",h,{keepDims:!!x,selectLastIndex:!!I,axis:L})},840252:(h,x)=>{n.jb("Softmax",h,{axis:x})},840315:(h,x)=>{n.jb("Concat",h,{axis:x})},840375:(h,x,I,L,U)=>{n.jb("Split",h,{axis:x,numOutputs:I,splitSizes:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},840531:h=>{n.jb("Expand",h,void 0)},840585:(h,x)=>{n.jb("Gather",h,{axis:Number(x)})},840656:(h,x)=>{n.jb("GatherElements",h,{axis:Number(x)})},840735:(h,x)=>{n.jb("GatherND",h,{batch_dims:Number(x)})},840814:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht)=>{n.jb("Resize",h,{antialias:x,axes:I?Array.from(se().subarray(Number(I)>>>0,Number(L)>>>0)):[],coordinateTransformMode:Ft(U),cubicCoeffA:ue,excludeOutside:Te,extrapolationValue:Oe,keepAspectRatioPolicy:Ft(Ke),mode:Ft(Ze),nearestMode:Ft(ht)})},841176:(h,x,I,L,U,ue,Te)=>{n.jb("Slice",h,{starts:x?Array.from(se().subarray(Number(x)>>>0,Number(I)>>>0)):[],ends:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[],axes:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[]})},841440:h=>{n.jb("Tile",h,void 0)},841492:(h,x,I)=>{n.jb("InstanceNormalization",h,{epsilon:x,format:I?"NHWC":"NCHW"})},841606:(h,x,I)=>{n.jb("InstanceNormalization",h,{epsilon:x,format:I?"NHWC":"NCHW"})},841720:h=>{n.jb("Range",h,void 0)},841773:(h,x)=>{n.jb("Einsum",h,{equation:Ft(x)})},841854:(h,x,I,L,U)=>{n.jb("Pad",h,{mode:x,value:I,pads:L?Array.from(se().subarray(Number(L)>>>0,Number(U)>>>0)):[]})},841997:(h,x,I,L,U,ue)=>{n.jb("BatchNormalization",h,{epsilon:x,momentum:I,spatial:!!U,trainingMode:!!L,format:ue?"NHWC":"NCHW"})},842166:(h,x,I,L,U,ue)=>{n.jb("BatchNormalization",h,{epsilon:x,momentum:I,spatial:!!U,trainingMode:!!L,format:ue?"NHWC":"NCHW"})},842335:(h,x,I)=>{n.jb("CumSum",h,{exclusive:Number(x),reverse:Number(I)})},842432:(h,x,I)=>{n.jb("DequantizeLinear",h,{axis:x,blockSize:I})},842522:(h,x,I,L,U)=>{n.jb("GridSample",h,{align_corners:x,mode:Ft(I),padding_mode:Ft(L),format:U?"NHWC":"NCHW"})},842692:(h,x,I,L,U)=>{n.jb("GridSample",h,{align_corners:x,mode:Ft(I),padding_mode:Ft(L),format:U?"NHWC":"NCHW"})},842862:(h,x)=>{n.jb("ScatterND",h,{reduction:Ft(x)})},842947:(h,x,I,L,U,ue,Te,Oe,Ke)=>{n.jb("Attention",h,{numHeads:x,isUnidirectional:I,maskFilterValue:L,scale:U,doRotary:ue,qkvHiddenSizes:Te?Array.from(se().subarray(Number(Oe)>>>0,Number(Oe)+Te>>>0)):[],pastPresentShareBuffer:!!Ke})},843219:h=>{n.jb("BiasAdd",h,void 0)},843274:h=>{n.jb("BiasSplitGelu",h,void 0)},843335:h=>{n.jb("FastGelu",h,void 0)},843391:(h,x,I,L,U,ue,Te,Oe,Ke,Ze,ht,Tt,It,sr,Os,Hi)=>{n.jb("Conv",h,{format:Tt?"NHWC":"NCHW",auto_pad:x,dilations:I?Array.from(se().subarray(Number(I)>>>0,Number(L)>>>0)):[],group:U,kernel_shape:ue?Array.from(se().subarray(Number(ue)>>>0,Number(Te)>>>0)):[],pads:Oe?Array.from(se().subarray(Number(Oe)>>>0,Number(Ke)>>>0)):[],strides:Ze?Array.from(se().subarray(Number(Ze)>>>0,Number(ht)>>>0)):[],w_is_const:()=>!!F()[Number(It)>>>0],activation:Ft(sr),activation_params:Os?Array.from($e().subarray(Number(Os)>>>0,Number(Hi)>>>0)):[]})},843975:h=>{n.jb("Gelu",h,void 0)},844027:(h,x,I,L,U,ue,Te,Oe,Ke)=>{n.jb("GroupQueryAttention",h,{numHeads:x,kvNumHeads:I,scale:L,softcap:U,doRotary:ue,rotaryInterleaved:Te,smoothSoftmax:Oe,localWindowSize:Ke})},844244:(h,x,I,L)=>{n.jb("LayerNormalization",h,{axis:x,epsilon:I,simplified:!!L})},844355:(h,x,I,L)=>{n.jb("LayerNormalization",h,{axis:x,epsilon:I,simplified:!!L})},844466:(h,x,I,L,U,ue)=>{n.jb("MatMulNBits",h,{k:x,n:I,accuracyLevel:L,bits:U,blockSize:ue})},844593:(h,x,I,L,U,ue)=>{n.jb("MultiHeadAttention",h,{numHeads:x,isUnidirectional:I,maskFilterValue:L,scale:U,doRotary:ue})},844752:(h,x)=>{n.jb("QuickGelu",h,{alpha:x})},844816:(h,x,I,L,U)=>{n.jb("RotaryEmbedding",h,{interleaved:!!x,numHeads:I,rotaryEmbeddingDim:L,scale:U})},844955:(h,x,I)=>{n.jb("SkipLayerNormalization",h,{epsilon:x,simplified:!!I})},845057:(h,x,I)=>{n.jb("SkipLayerNormalization",h,{epsilon:x,simplified:!!I})},845159:(h,x,I,L)=>{n.jb("GatherBlockQuantized",h,{gatherAxis:x,quantizeAxis:I,blockSize:L})},845280:h=>{n.Zb(h)},845314:(h,x)=>n.ac(Number(h),Number(x),n.Fb.dc,n.Fb.errors)};function O(h,x,I){return jr(async()=>{await n.Xb(Number(h),Number(x),Number(I))})}function Y(){return typeof wasmOffsetConverter<"u"}class z{constructor(x){te(this,"name","ExitStatus");this.message=`Program terminated with exit(${x})`,this.status=x}}var J=h=>{h.terminate(),h.onmessage=()=>{}},le=[],ye=h=>{Ge.length==0&&(Ms(),ls(Ge[0]));var x=Ge.pop();if(!x)return 6;lt.push(x),Gt[h.Ab]=x,x.Ab=h.Ab;var I={Bb:"run",fc:h.ec,Hb:h.Hb,Ab:h.Ab};return x.postMessage(I,h.Mb),0},Ee=0,ke=(h,x,...I)=>{for(var L=2*I.length,U=to(),ue=kn(8*L),Te=ue>>>3,Oe=0;Oe>>0]=Ke)}return h=Wo(h,0,L,ue,x),$n(U),h};function Ie(h){if(u)return ke(0,1,h);if(C=h,!(0{if(C=h,u)throw Re(h),"unwind";Ie(h)},Ge=[],lt=[],wt=[],Gt={},Ot=h=>{var x=h.Ab;delete Gt[x],Ge.push(h),lt.splice(lt.indexOf(h),1),h.Ab=0,Yn(x)};function ur(){wt.forEach(h=>h())}var ls=h=>new Promise(x=>{h.onmessage=U=>{var ue=(U=U.data).Bb;if(U.Gb&&U.Gb!=Xs()){var Te=Gt[U.Gb];Te?Te.postMessage(U,U.Mb):y(`Internal error! Worker sent a message "${ue}" to target pthread ${U.Gb}, but that thread no longer exists!`)}else ue==="checkMailbox"?je():ue==="spawnThread"?ye(U):ue==="cleanupThread"?Ot(Gt[U.hc]):ue==="loaded"?(h.loaded=!0,x(h)):ue==="alert"?alert(`Thread ${U.ic}: ${U.text}`):U.target==="setimmediate"?h.postMessage(U):ue==="callHandler"?n[U.Qb](...U.args):ue&&y(`worker sent an unknown command ${ue}`)},h.onerror=U=>{throw y(`worker sent an error! ${U.filename}:${U.lineno}: ${U.message}`),U};var I,L=[];for(I of[])n.propertyIsEnumerable(I)&&L.push(I);h.postMessage({Bb:"load",Rb:L,kc:M,lc:v})});function Ms(){var h=new Worker((()=>{let x=URL;return self.location.href>"file:"&&self.location.href<"file;"?new x("ort.bundle.min.mjs",self.location.href):new URL(self.location.href)})(),{type:"module",workerData:"em-pthread",name:"em-pthread"});Ge.push(h)}var Ir=h=>{R();var x=ce()[h+52>>>2>>>0];h=ce()[h+56>>>2>>>0],Ko(x,x-h),$n(x)},js=(h,x)=>{Ee=0,h=Ho(h,x),0>>=0);throw x>>>=0,I>>>=0,ce()[L.Ib+16>>>2>>>0]=0,ce()[L.Ib+4>>>2>>>0]=x,ce()[L.Ib+8>>>2>>>0]=I,h}function at(h,x,I,L){return u?ke(2,1,h,x,I,L):us(h,x,I,L)}function us(h,x,I,L){if(h>>>=0,I>>>=0,L>>>=0,p===void 0)return 6;var U=[];return u&&U.length===0?at(h,x>>>=0,I,L):(h={ec:I,Ab:h,Hb:L,Mb:U},u?(h.Bb="spawnThread",postMessage(h,U),0):ye(h))}var Ar=typeof TextDecoder<"u"?new TextDecoder:void 0,bs=(h,x=0,I=NaN)=>{var L=(x>>>=0)+I;for(I=x;h[I]&&!(I>=L);)++I;if(16(U=(240&U)==224?(15&U)<<12|ue<<6|Te:(7&U)<<18|ue<<12|Te<<6|63&h[x++])?L+=String.fromCharCode(U):(U-=65536,L+=String.fromCharCode(55296|U>>10,56320|1023&U))}}else L+=String.fromCharCode(U)}return L},Ft=(h,x)=>(h>>>=0)?bs(W(),h,x):"";function ds(h,x,I){return u?ke(3,1,h,x,I):0}function cs(h,x){if(u)return ke(4,1,h,x)}var ys=h=>{for(var x=0,I=0;I=L?x++:2047>=L?x+=2:55296<=L&&57343>=L?(x+=4,++I):x+=3}return x},Qt=(h,x,I)=>{var L=W();if(x>>>=0,0=Te&&(Te=65536+((1023&Te)<<10)|1023&h.charCodeAt(++ue)),127>=Te){if(x>=I)break;L[x++>>>0]=Te}else{if(2047>=Te){if(x+1>=I)break;L[x++>>>0]=192|Te>>6}else{if(65535>=Te){if(x+2>=I)break;L[x++>>>0]=224|Te>>12}else{if(x+3>=I)break;L[x++>>>0]=240|Te>>18,L[x++>>>0]=128|Te>>12&63}L[x++>>>0]=128|Te>>6&63}L[x++>>>0]=128|63&Te}}L[x>>>0]=0,h=x-U}else h=0;return h};function De(h,x){if(u)return ke(5,1,h,x)}function Qe(h,x,I){if(u)return ke(6,1,h,x,I)}function tt(h,x,I){return u?ke(7,1,h,x,I):0}function Rt(h,x){if(u)return ke(8,1,h,x)}function zr(h,x,I){if(u)return ke(9,1,h,x,I)}function Sr(h,x,I,L){if(u)return ke(10,1,h,x,I,L)}function ps(h,x,I,L){if(u)return ke(11,1,h,x,I,L)}function hs(h,x,I,L){if(u)return ke(12,1,h,x,I,L)}function Kr(h){if(u)return ke(13,1,h)}function ms(h,x){if(u)return ke(14,1,h,x)}function _s(h,x,I){if(u)return ke(15,1,h,x,I)}var Hr,vr,cn=()=>Fe(""),xr=h=>{for(var x="";W()[h>>>0];)x+=Hr[W()[h++>>>0]];return x},$s={},ks={};function fr(h,x,I={}){return function(L,U,ue={}){var Te=U.name;if(!L)throw new vr(`type "${Te}" must have a positive integer typeid pointer`);if(ks.hasOwnProperty(L)){if(ue.Sb)return;throw new vr(`Cannot register type '${Te}' twice`)}ks[L]=U,$s.hasOwnProperty(L)&&(U=$s[L],delete $s[L],U.forEach(Oe=>Oe()))}(h,x,I)}var Vs=(h,x,I)=>{switch(x){case 1:return I?L=>F()[L>>>0]:L=>W()[L>>>0];case 2:return I?L=>re()[L>>>1>>>0]:L=>_e()[L>>>1>>>0];case 4:return I?L=>se()[L>>>2>>>0]:L=>ce()[L>>>2>>>0];case 8:return I?L=>Z[L>>>3]:L=>X[L>>>3];default:throw new TypeError(`invalid integer width (${x}): ${h}`)}};function pn(h,x,I){I>>>=0,fr(h>>>=0,{name:x=xr(x>>>0),fromWireType:L=>L,toWireType:function(L,U){if(typeof U!="bigint"&&typeof U!="number")throw U=U===null?"null":(L=typeof U)=="object"||L==="array"||L==="function"?U.toString():""+U,new TypeError(`Cannot convert "${U}" to ${this.name}`);return typeof U=="number"&&(U=BigInt(U)),U},Cb:Fr,readValueFromPointer:Vs(x,I,x.indexOf("u")==-1),Db:null})}var Fr=8;function hn(h,x,I,L){fr(h>>>=0,{name:x=xr(x>>>0),fromWireType:function(U){return!!U},toWireType:function(U,ue){return ue?I:L},Cb:Fr,readValueFromPointer:function(U){return this.fromWireType(W()[U>>>0])},Db:null})}var qr=[],Tr=[];function Is(h){9<(h>>>=0)&&--Tr[h+1]==0&&(Tr[h]=void 0,qr.push(h))}var dr=h=>{if(!h)throw new vr("Cannot use deleted val. handle = "+h);return Tr[h]},gr=h=>{switch(h){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:let x=qr.pop()||Tr.length;return Tr[x]=h,Tr[x+1]=1,x}};function Br(h){return this.fromWireType(ce()[h>>>2>>>0])}var mn={name:"emscripten::val",fromWireType:h=>{var x=dr(h);return Is(h),x},toWireType:(h,x)=>gr(x),Cb:Fr,readValueFromPointer:Br,Db:null};function _n(h){return fr(h>>>0,mn)}var fn=(h,x)=>{switch(x){case 4:return function(I){return this.fromWireType($e()[I>>>2>>>0])};case 8:return function(I){return this.fromWireType(Ue()[I>>>3>>>0])};default:throw new TypeError(`invalid float width (${x}): ${h}`)}};function gn(h,x,I){I>>>=0,fr(h>>>=0,{name:x=xr(x>>>0),fromWireType:L=>L,toWireType:(L,U)=>U,Cb:Fr,readValueFromPointer:fn(x,I),Db:null})}function wn(h,x,I,L,U){if(h>>>=0,I>>>=0,x=xr(x>>>0),U===-1&&(U=4294967295),U=Oe=>Oe,L===0){var ue=32-8*I;U=Oe=>Oe<>>ue}var Te=x.includes("unsigned")?function(Oe,Ke){return Ke>>>0}:function(Oe,Ke){return Ke};fr(h,{name:x,fromWireType:U,toWireType:Te,Cb:Fr,readValueFromPointer:Vs(x,I,L!==0),Db:null})}function vs(h,x,I){function L(ue){var Te=ce()[ue>>>2>>>0];return ue=ce()[ue+4>>>2>>>0],new U(F().buffer,ue,Te)}var U=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][x];fr(h>>>=0,{name:I=xr(I>>>0),fromWireType:L,Cb:Fr,readValueFromPointer:L},{Sb:!0})}function Mn(h,x){fr(h>>>=0,{name:x=xr(x>>>0),fromWireType:function(I){for(var L,U=ce()[I>>>2>>>0],ue=I+4,Te=ue,Oe=0;Oe<=U;++Oe){var Ke=ue+Oe;Oe!=U&&W()[Ke>>>0]!=0||(Te=Ft(Te,Ke-Te),L===void 0?L=Te:(L+="\0",L+=Te),Te=Ke+1)}return Nr(I),L},toWireType:function(I,L){L instanceof ArrayBuffer&&(L=new Uint8Array(L));var U=typeof L=="string";if(!(U||L instanceof Uint8Array||L instanceof Uint8ClampedArray||L instanceof Int8Array))throw new vr("Cannot pass non-string to std::string");var ue=U?ys(L):L.length,Te=Cn(4+ue+1),Oe=Te+4;if(ce()[Te>>>2>>>0]=ue,U)Qt(L,Oe,ue+1);else if(U)for(U=0;U>>0]=Ke}else for(U=0;U>>0]=L[U];return I!==null&&I.push(Nr,Te),Te},Cb:Fr,readValueFromPointer:Br,Db(I){Nr(I)}})}var Us=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0,bn=(h,x)=>{for(var I=h>>1,L=I+x/2;!(I>=L)&&_e()[I>>>0];)++I;if(32<(I<<=1)-h&&Us)return Us.decode(W().slice(h,I));for(I="",L=0;!(L>=x/2);++L){var U=re()[h+2*L>>>1>>>0];if(U==0)break;I+=String.fromCharCode(U)}return I},yn=(h,x,I)=>{if(I??(I=2147483647),2>I)return 0;var L=x;I=(I-=2)<2*h.length?I/2:h.length;for(var U=0;U>>1>>>0]=ue,x+=2}return re()[x>>>1>>>0]=0,x-L},xs=h=>2*h.length,vn=(h,x)=>{for(var I=0,L="";!(I>=x/4);){var U=se()[h+4*I>>>2>>>0];if(U==0)break;++I,65536<=U?(U-=65536,L+=String.fromCharCode(55296|U>>10,56320|1023&U)):L+=String.fromCharCode(U)}return L},he=(h,x,I)=>{if(x>>>=0,I??(I=2147483647),4>I)return 0;var L=x;I=L+I-4;for(var U=0;U=ue&&(ue=65536+((1023&ue)<<10)|1023&h.charCodeAt(++U)),se()[x>>>2>>>0]=ue,(x+=4)+4>I)break}return se()[x>>>2>>>0]=0,x-L},$=h=>{for(var x=0,I=0;I=L&&++I,x+=4}return x};function N(h,x,I){if(h>>>=0,x>>>=0,I=xr(I>>>=0),x===2)var L=bn,U=yn,ue=xs,Te=Oe=>_e()[Oe>>>1>>>0];else x===4&&(L=vn,U=he,ue=$,Te=Oe=>ce()[Oe>>>2>>>0]);fr(h,{name:I,fromWireType:Oe=>{for(var Ke,Ze=ce()[Oe>>>2>>>0],ht=Oe+4,Tt=0;Tt<=Ze;++Tt){var It=Oe+4+Tt*x;Tt!=Ze&&Te(It)!=0||(ht=L(ht,It-ht),Ke===void 0?Ke=ht:(Ke+="\0",Ke+=ht),ht=It+x)}return Nr(Oe),Ke},toWireType:(Oe,Ke)=>{if(typeof Ke!="string")throw new vr(`Cannot pass non-string to C++ string type ${I}`);var Ze=ue(Ke),ht=Cn(4+Ze+x);return ce()[ht>>>2>>>0]=Ze/x,U(Ke,ht+4,Ze+x),Oe!==null&&Oe.push(Nr,ht),ht},Cb:Fr,readValueFromPointer:Br,Db(Oe){Nr(Oe)}})}function Q(h,x){fr(h>>>=0,{Tb:!0,name:x=xr(x>>>0),Cb:0,fromWireType:()=>{},toWireType:()=>{}})}function ie(h){Sn(h>>>0,!l,1,!a,131072,!1),ur()}var de=h=>{if(!ae)try{if(h(),!(0>>=0,typeof Atomics.jc=="function"&&(Atomics.jc(se(),h>>>2,h).value.then(je),h+=128,Atomics.store(se(),h>>>2,1))}var je=()=>{var h=Xs();h&&(ve(h),de(eo))};function He(h,x){(h>>>=0)==x>>>0?setTimeout(je):u?postMessage({Gb:h,Bb:"checkMailbox"}):(h=Gt[h])&&h.postMessage({Bb:"checkMailbox"})}var We=[];function Je(h,x,I,L,U){for(x>>>=0,L/=2,We.length=L,I=U>>>0>>>3,U=0;U>>0];return(x?Ve[x]:jo[h])(...We)}var dt=()=>{Ee=0};function xt(h){h>>>=0,u?postMessage({Bb:"cleanupThread",hc:h}):Ot(Gt[h])}function Pt(h){}var jt=(h,x)=>{var I=ks[h];if(I===void 0)throw h=No(h),I=xr(h),Nr(h),new vr(`${x} has unknown type ${I}`);return I},kt=(h,x,I)=>{var L=[];return h=h.toWireType(L,I),L.length&&(ce()[x>>>2>>>0]=gr(L)),h};function Ht(h,x,I){return x>>>=0,I>>>=0,h=dr(h>>>0),x=jt(x,"emval::as"),kt(x,I,h)}function br(h,x){return x>>>=0,h=dr(h>>>0),(x=jt(x,"emval::as")).toWireType(null,h)}var cr=h=>{try{h()}catch(x){Fe(x)}},pr=0,Nt=null,Xr=0,Dt=[],rr={},wr={},Qr=0,Rr=null,Yt=[];function jr(h){return function(x){if(!ae){if(pr===0){var I=!1,L=!1;x((U=0)=>{if(!ae&&(Xr=U,I=!0,L)){pr=2,cr(()=>Xo(Nt)),typeof MainLoop<"u"&&MainLoop.Pb&&MainLoop.resume(),U=!1;try{var ue=function(){var Ke=se()[Nt+8>>>2>>>0];return Ke=nt[wr[Ke]],--Ee,Ke()}()}catch(Ke){ue=Ke,U=!0}var Te=!1;if(!Nt){var Oe=Rr;Oe&&(Rr=null,(U?Oe.reject:Oe.resolve)(ue),Te=!0)}if(U&&!Te)throw ue}}),L=!0,I||(pr=1,Nt=function(){var U=Cn(65548),ue=U+12;ce()[U>>>2>>>0]=ue,ce()[U+4>>>2>>>0]=ue+65536,ue=Dt[0];var Te=rr[ue];return Te===void 0&&(Te=Qr++,rr[ue]=Te,wr[Te]=ue),ue=Te,se()[U+8>>>2>>>0]=ue,U}(),typeof MainLoop<"u"&&MainLoop.Pb&&MainLoop.pause(),cr(()=>ro(Nt)))}else pr===2?(pr=0,cr(so),Nr(Nt),Nt=null,Yt.forEach(de)):Fe(`invalid state: ${pr}`);return Xr}}(x=>{h().then(x)})}function or(h){return h>>>=0,jr(async()=>{var x=await dr(h);return gr(x)})}var Vt=[];function Zt(h,x,I,L){return I>>>=0,L>>>=0,(h=Vt[h>>>0])(null,x=dr(x>>>0),I,L)}var er={},tr=h=>{var x=er[h];return x===void 0?xr(h):x};function Ws(h,x,I,L,U){return I>>>=0,L>>>=0,U>>>=0,(h=Vt[h>>>0])(x=dr(x>>>0),x[I=tr(I)],L,U)}var xn=()=>typeof globalThis=="object"?globalThis:Function("return this")();function vi(h){return(h>>>=0)==0?gr(xn()):(h=tr(h),gr(xn()[h]))}var xi=h=>{var x=Vt.length;return Vt.push(h),x},Ti=(h,x)=>{for(var I=Array(h),L=0;L>>2>>>0],"parameter "+L);return I},As=(h,x)=>Object.defineProperty(x,"name",{value:h});function Ei(h,x,I){var L=(x=Ti(h,x>>>0)).shift();h--;var U=`return function (obj, func, destructorsRef, args) { +`,ue=0,Te=[];I===0&&Te.push("obj");for(var Oe=["retType"],Ke=[L],Ze=0;Zeht.name).join(", ")}) => ${L.name}>`,xi(As(I,h))}function Pi(h){return h=tr(h>>>0),gr(n[h])}function Ci(h,x){return x>>>=0,h=dr(h>>>0),x=dr(x),gr(h[x])}function Si(h){9<(h>>>=0)&&(Tr[h+1]+=1)}function $i(){return gr([])}function Eo(h){h=dr(h>>>0);for(var x=Array(h.length),I=0;I>>0))}function Ii(){return gr({})}function Po(h){for(var x=dr(h>>>=0);x.length;){var I=x.pop();x.pop()(I)}Is(h)}function Ai(h,x,I){x>>>=0,I>>>=0,h=dr(h>>>0),x=dr(x),I=dr(I),h[x]=I}function Co(h,x){return x>>>=0,h=(h=jt(h>>>0,"_emval_take_value")).readValueFromPointer(x),gr(h)}function Fi(h,x){h=-9007199254740992>h||9007199254740992>>=0,h=new Date(1e3*h),se()[x>>>2>>>0]=h.getUTCSeconds(),se()[x+4>>>2>>>0]=h.getUTCMinutes(),se()[x+8>>>2>>>0]=h.getUTCHours(),se()[x+12>>>2>>>0]=h.getUTCDate(),se()[x+16>>>2>>>0]=h.getUTCMonth(),se()[x+20>>>2>>>0]=h.getUTCFullYear()-1900,se()[x+24>>>2>>>0]=h.getUTCDay(),h=(h.getTime()-Date.UTC(h.getUTCFullYear(),0,1,0,0,0,0))/864e5|0,se()[x+28>>>2>>>0]=h}var Kn=h=>h%4==0&&(h%100!=0||h%400==0),Oi=[0,31,60,91,121,152,182,213,244,274,305,335],So=[0,31,59,90,120,151,181,212,243,273,304,334];function $o(h,x){h=-9007199254740992>h||9007199254740992>>=0,h=new Date(1e3*h),se()[x>>>2>>>0]=h.getSeconds(),se()[x+4>>>2>>>0]=h.getMinutes(),se()[x+8>>>2>>>0]=h.getHours(),se()[x+12>>>2>>>0]=h.getDate(),se()[x+16>>>2>>>0]=h.getMonth(),se()[x+20>>>2>>>0]=h.getFullYear()-1900,se()[x+24>>>2>>>0]=h.getDay();var I=(Kn(h.getFullYear())?Oi:So)[h.getMonth()]+h.getDate()-1|0;se()[x+28>>>2>>>0]=I,se()[x+36>>>2>>>0]=-60*h.getTimezoneOffset(),I=new Date(h.getFullYear(),6,1).getTimezoneOffset();var L=new Date(h.getFullYear(),0,1).getTimezoneOffset();h=0|(I!=L&&h.getTimezoneOffset()==Math.min(L,I)),se()[x+32>>>2>>>0]=h}function Di(h){h>>>=0;var x=new Date(se()[h+20>>>2>>>0]+1900,se()[h+16>>>2>>>0],se()[h+12>>>2>>>0],se()[h+8>>>2>>>0],se()[h+4>>>2>>>0],se()[h>>>2>>>0],0),I=se()[h+32>>>2>>>0],L=x.getTimezoneOffset(),U=new Date(x.getFullYear(),6,1).getTimezoneOffset(),ue=new Date(x.getFullYear(),0,1).getTimezoneOffset(),Te=Math.min(ue,U);return 0>I?se()[h+32>>>2>>>0]=+(U!=ue&&Te==L):0>>2>>>0]=x.getDay(),I=(Kn(x.getFullYear())?Oi:So)[x.getMonth()]+x.getDate()-1|0,se()[h+28>>>2>>>0]=I,se()[h>>>2>>>0]=x.getSeconds(),se()[h+4>>>2>>>0]=x.getMinutes(),se()[h+8>>>2>>>0]=x.getHours(),se()[h+12>>>2>>>0]=x.getDate(),se()[h+16>>>2>>>0]=x.getMonth(),se()[h+20>>>2>>>0]=x.getYear(),h=x.getTime(),BigInt(isNaN(h)?-1:h/1e3)}function Tn(h,x,I,L,U,ue,Te){return u?ke(16,1,h,x,I,L,U,ue,Te):-52}function ko(h,x,I,L,U,ue){if(u)return ke(17,1,h,x,I,L,U,ue)}var Gs={},Li=()=>performance.timeOrigin+performance.now();function Io(h,x){if(u)return ke(18,1,h,x);if(Gs[h]&&(clearTimeout(Gs[h].id),delete Gs[h]),!x)return 0;var I=setTimeout(()=>{delete Gs[h],de(()=>Go(h,performance.timeOrigin+performance.now()))},x);return Gs[h]={id:I,qc:x},0}function zi(h,x,I,L){h>>>=0,x>>>=0,I>>>=0,L>>>=0;var U=new Date().getFullYear(),ue=new Date(U,0,1).getTimezoneOffset();U=new Date(U,6,1).getTimezoneOffset();var Te=Math.max(ue,U);ce()[h>>>2>>>0]=60*Te,se()[x>>>2>>>0]=+(ue!=U),h=(x=Oe=>{var Ke=Math.abs(Oe);return`UTC${0<=Oe?"-":"+"}${String(Math.floor(Ke/60)).padStart(2,"0")}${String(Ke%60).padStart(2,"0")}`})(ue),x=x(U),UDate.now();function Ri(h,x,I){return 0<=h&&3>=h?(h===0?h=Date.now():h=performance.timeOrigin+performance.now(),Z[I>>>0>>>3]=BigInt(Math.round(1e6*h)),0):28}var Ks=[],Hn=(h,x)=>{Ks.length=0;for(var I;I=W()[h++>>>0];){var L=I!=105;x+=(L&=I!=112)&&x%8?4:0,Ks.push(I==112?ce()[x>>>2>>>0]:I==106?Z[x>>>3]:I==105?se()[x>>>2>>>0]:Ue()[x>>>3>>>0]),x+=L?8:4}return Ks};function ji(h,x,I){return h>>>=0,x=Hn(x>>>0,I>>>0),Ve[h](...x)}function Ao(h,x,I){return h>>>=0,x=Hn(x>>>0,I>>>0),Ve[h](...x)}var Fs=()=>{};function Ni(h,x){return y(Ft(h>>>0,x>>>0))}var pu=()=>{throw Ee+=1,"unwind"};function Vi(){return 4294901760}var hu=()=>navigator.hardwareConcurrency;function Ui(){return Fe("Cannot use emscripten_pc_get_function without -sUSE_OFFSET_CONVERTER"),0}function Fo(h){h>>>=0;var x=W().length;if(h<=x||4294901760=I;I*=2){var L=x*(1+.2/I);L=Math.min(L,h+100663296);e:{L=(Math.min(4294901760,65536*Math.ceil(Math.max(h,L)/65536))-M.buffer.byteLength+65535)/65536|0;try{M.grow(L),R();var U=1;break e}catch{}U=void 0}if(U)return!0}return!1}var En=()=>(Fe("Cannot use convertFrameToPC (needed by __builtin_return_address) without -sUSE_OFFSET_CONVERTER"),0),Hs={},Oo=h=>{h.forEach(x=>{En()})};function Wi(){var h=Error().stack.toString().split(` +`);return h[0]=="Error"&&h.shift(),Oo(h),Hs.Lb=En(),Hs.cc=h,Hs.Lb}function Gi(h,x,I){if(h>>>=0,x>>>=0,Hs.Lb==h)var L=Hs.cc;else(L=Error().stack.toString().split(` +`))[0]=="Error"&&L.shift(),Oo(L);for(var U=3;L[U]&&En()!=h;)++U;for(h=0;h>>2>>>0]=En();return h}var qs,qn={},Do=()=>{if(!qs){var h,x={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(h in qn)qn[h]===void 0?delete x[h]:x[h]=qn[h];var I=[];for(h in x)I.push(`${h}=${x[h]}`);qs=I}return qs};function Lo(h,x){if(u)return ke(19,1,h,x);h>>>=0,x>>>=0;var I=0;return Do().forEach((L,U)=>{var ue=x+I;for(U=ce()[h+4*U>>>2>>>0]=ue,ue=0;ue>>0]=L.charCodeAt(ue);F()[U>>>0]=0,I+=L.length+1}),0}function Xn(h,x){if(u)return ke(20,1,h,x);h>>>=0,x>>>=0;var I=Do();ce()[h>>>2>>>0]=I.length;var L=0;return I.forEach(U=>L+=U.length+1),ce()[x>>>2>>>0]=L,0}function zo(h){return u?ke(21,1,h):52}function Bo(h,x,I,L){return u?ke(22,1,h,x,I,L):52}function Qn(h,x,I,L){return u?ke(23,1,h,x,I,L):70}var Ki=[null,[],[]];function Ro(h,x,I,L){if(u)return ke(24,1,h,x,I,L);x>>>=0,I>>>=0,L>>>=0;for(var U=0,ue=0;ue>>2>>>0],Oe=ce()[x+4>>>2>>>0];x+=8;for(var Ke=0;Ke>>0],ht=Ki[h];Ze===0||Ze===10?((h===1?E:y)(bs(ht)),ht.length=0):ht.push(Ze)}U+=Oe}return ce()[L>>>2>>>0]=U,0}u||function(){for(var h=n.numThreads-1;h--;)Ms();le.unshift(()=>{be++,function(x){u?x():Promise.all(Ge.map(ls)).then(x)}(()=>Ae())})}();for(var Jn=Array(256),Pn=0;256>Pn;++Pn)Jn[Pn]=String.fromCharCode(Pn);Hr=Jn,vr=n.BindingError=class extends Error{constructor(h){super(h),this.name="BindingError"}},n.InternalError=class extends Error{constructor(h){super(h),this.name="InternalError"}},Tr.push(0,1,void 0,1,null,1,!0,1,!1,1),n.count_emval_handles=()=>Tr.length/2-5-qr.length;var nt,jo=[Ie,Re,at,ds,cs,De,Qe,tt,Rt,zr,Sr,ps,hs,Kr,ms,_s,Tn,ko,Io,Lo,Xn,zo,Bo,Qn,Ro];(async function(){function h(L,U){return nt=L.exports,nt=function(){var ue=nt,Te={};for(let[Oe,Ke]of Object.entries(ue))Te[Oe]=typeof Ke=="function"?(...Ze)=>{Dt.push(Oe);try{return Ke(...Ze)}finally{ae||(Dt.pop(),Nt&&pr===1&&Dt.length===0&&(pr=0,Ee+=1,cr(qo),typeof Fibers<"u"&&Fibers.rc()))}}:Ke;return Te}(),nt=function(){var ue=nt,Te=Ke=>Ze=>Ke(Ze)>>>0,Oe=Ke=>()=>Ke()>>>0;return(ue=Object.assign({},ue)).Da=Te(ue.Da),ue.fb=Oe(ue.fb),ue.hb=Te(ue.hb),ue.tb=Te(ue.tb),ue.ub=Oe(ue.ub),ue.__cxa_get_exception_ptr=Te(ue.__cxa_get_exception_ptr),ue}(),wt.push(nt.ib),v=U,Ae(),nt}be++;var x=ze();if(n.instantiateWasm)return new Promise(L=>{n.instantiateWasm(x,(U,ue)=>{h(U,ue),L(U.exports)})});if(u)return new Promise(L=>{we=U=>{var ue=new WebAssembly.Instance(U,ze());L(h(ue,U))}});xe??(xe=n.locateFile?n.locateFile?n.locateFile("ort-wasm-simd-threaded.jsep.wasm",w):w+"ort-wasm-simd-threaded.jsep.wasm":new URL("/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm",self.location.href).href);try{var I=await async function(L){var U=xe;if(!me&&typeof WebAssembly.instantiateStreaming=="function"&&!V(U))try{var ue=fetch(U,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(ue,L)}catch(Te){y(`wasm streaming compile failed: ${Te}`),y("falling back to ArrayBuffer instantiation")}return async function(Te,Oe){try{var Ke=await async function(Ze){if(!me)try{var ht=await f(Ze);return new Uint8Array(ht)}catch{}if(Ze==xe&&me)Ze=new Uint8Array(me);else{if(!_)throw"both async and sync fetching of the wasm failed";Ze=_(Ze)}return Ze}(Te);return await WebAssembly.instantiate(Ke,Oe)}catch(Ze){y(`failed to asynchronously prepare wasm: ${Ze}`),Fe(Ze)}}(U,L)}(x);return h(I.instance,I.module)}catch(L){return o(L),Promise.reject(L)}})();var No=h=>(No=nt.Da)(h),Vo=()=>(Vo=nt.Ea)();n._OrtInit=(h,x)=>(n._OrtInit=nt.Fa)(h,x),n._OrtGetLastError=(h,x)=>(n._OrtGetLastError=nt.Ga)(h,x),n._OrtCreateSessionOptions=(h,x,I,L,U,ue,Te,Oe,Ke,Ze)=>(n._OrtCreateSessionOptions=nt.Ha)(h,x,I,L,U,ue,Te,Oe,Ke,Ze),n._OrtAppendExecutionProvider=(h,x,I,L,U)=>(n._OrtAppendExecutionProvider=nt.Ia)(h,x,I,L,U),n._OrtAddFreeDimensionOverride=(h,x,I)=>(n._OrtAddFreeDimensionOverride=nt.Ja)(h,x,I),n._OrtAddSessionConfigEntry=(h,x,I)=>(n._OrtAddSessionConfigEntry=nt.Ka)(h,x,I),n._OrtReleaseSessionOptions=h=>(n._OrtReleaseSessionOptions=nt.La)(h),n._OrtCreateSession=(h,x,I)=>(n._OrtCreateSession=nt.Ma)(h,x,I),n._OrtReleaseSession=h=>(n._OrtReleaseSession=nt.Na)(h),n._OrtGetInputOutputCount=(h,x,I)=>(n._OrtGetInputOutputCount=nt.Oa)(h,x,I),n._OrtGetInputOutputMetadata=(h,x,I,L)=>(n._OrtGetInputOutputMetadata=nt.Pa)(h,x,I,L),n._OrtFree=h=>(n._OrtFree=nt.Qa)(h),n._OrtCreateTensor=(h,x,I,L,U,ue)=>(n._OrtCreateTensor=nt.Ra)(h,x,I,L,U,ue),n._OrtGetTensorData=(h,x,I,L,U)=>(n._OrtGetTensorData=nt.Sa)(h,x,I,L,U),n._OrtReleaseTensor=h=>(n._OrtReleaseTensor=nt.Ta)(h),n._OrtCreateRunOptions=(h,x,I,L)=>(n._OrtCreateRunOptions=nt.Ua)(h,x,I,L),n._OrtAddRunConfigEntry=(h,x,I)=>(n._OrtAddRunConfigEntry=nt.Va)(h,x,I),n._OrtReleaseRunOptions=h=>(n._OrtReleaseRunOptions=nt.Wa)(h),n._OrtCreateBinding=h=>(n._OrtCreateBinding=nt.Xa)(h),n._OrtBindInput=(h,x,I)=>(n._OrtBindInput=nt.Ya)(h,x,I),n._OrtBindOutput=(h,x,I,L)=>(n._OrtBindOutput=nt.Za)(h,x,I,L),n._OrtClearBoundOutputs=h=>(n._OrtClearBoundOutputs=nt._a)(h),n._OrtReleaseBinding=h=>(n._OrtReleaseBinding=nt.$a)(h),n._OrtRunWithBinding=(h,x,I,L,U)=>(n._OrtRunWithBinding=nt.ab)(h,x,I,L,U),n._OrtRun=(h,x,I,L,U,ue,Te,Oe)=>(n._OrtRun=nt.bb)(h,x,I,L,U,ue,Te,Oe),n._OrtEndProfiling=h=>(n._OrtEndProfiling=nt.cb)(h),n._JsepOutput=(h,x,I)=>(n._JsepOutput=nt.db)(h,x,I),n._JsepGetNodeName=h=>(n._JsepGetNodeName=nt.eb)(h);var Xs=()=>(Xs=nt.fb)(),Nr=n._free=h=>(Nr=n._free=nt.gb)(h),Cn=n._malloc=h=>(Cn=n._malloc=nt.hb)(h),Sn=(h,x,I,L,U,ue)=>(Sn=nt.kb)(h,x,I,L,U,ue),Uo=()=>(Uo=nt.lb)(),Wo=(h,x,I,L,U)=>(Wo=nt.mb)(h,x,I,L,U),Yn=h=>(Yn=nt.nb)(h),Zn=h=>(Zn=nt.ob)(h),Go=(h,x)=>(Go=nt.pb)(h,x),eo=()=>(eo=nt.qb)(),Ko=(h,x)=>(Ko=nt.rb)(h,x),$n=h=>($n=nt.sb)(h),kn=h=>(kn=nt.tb)(h),to=()=>(to=nt.ub)(),Ho=n.dynCall_ii=(h,x)=>(Ho=n.dynCall_ii=nt.vb)(h,x),ro=h=>(ro=nt.wb)(h),qo=()=>(qo=nt.xb)(),Xo=h=>(Xo=nt.yb)(h),so=()=>(so=nt.zb)();return n.stackSave=()=>to(),n.stackRestore=h=>$n(h),n.stackAlloc=h=>kn(h),n.setValue=function(h,x,I="i8"){switch(I.endsWith("*")&&(I="*"),I){case"i1":case"i8":F()[h>>>0]=x;break;case"i16":re()[h>>>1>>>0]=x;break;case"i32":se()[h>>>2>>>0]=x;break;case"i64":Z[h>>>3]=BigInt(x);break;case"float":$e()[h>>>2>>>0]=x;break;case"double":Ue()[h>>>3>>>0]=x;break;case"*":ce()[h>>>2>>>0]=x;break;default:Fe(`invalid type for setValue: ${I}`)}},n.getValue=function(h,x="i8"){switch(x.endsWith("*")&&(x="*"),x){case"i1":case"i8":return F()[h>>>0];case"i16":return re()[h>>>1>>>0];case"i32":return se()[h>>>2>>>0];case"i64":return Z[h>>>3];case"float":return $e()[h>>>2>>>0];case"double":return Ue()[h>>>3>>>0];case"*":return ce()[h>>>2>>>0];default:Fe(`invalid type for getValue: ${x}`)}},n.UTF8ToString=Ft,n.stringToUTF8=Qt,n.lengthBytesUTF8=ys,function h(){if(0{Pa(),Ia=typeof location>"u"?void 0:location.origin,Aa=self.location.href>"file:"&&self.location.href<"file;",Jd=()=>{{if(Aa){let e=URL;return new URL(new e("ort.bundle.min.mjs",self.location.href).href,Ia).href}return self.location.href}},Dr=Jd(),Yd=()=>{if(Dr&&!Dr.startsWith("blob:"))return Dr.substring(0,Dr.lastIndexOf("/")+1)},ti=(e,r)=>{try{let t=r??Dr;return(t?new URL(e,t):new URL(e)).origin===Ia}catch{return!1}},Zd=(e,r)=>{let t=r??Dr;try{return(t?new URL(e,t):new URL(e)).href}catch{return}},ec=(e,r)=>`${r??"./"}${e}`,Fa=async e=>{let r=await(await fetch(e,{credentials:"same-origin"})).blob();return URL.createObjectURL(r)},tc=async e=>(await import(e)).default,Oa=(gv(),ao(Kd)).default,rc=async()=>{if(!Dr)throw new Error("Failed to load proxy worker: cannot determine the script source URL.");if(ti(Dr))return[void 0,Oa()];let e=await Fa(Dr);return[e,Oa(e)]},Da=(wv(),ao(qd)).default,sc=async(e,r,t)=>{if(!e&&!r&&Da&&Dr&&ti(Dr))return[void 0,Da];{let s="ort-wasm-simd-threaded.jsep.mjs",o=e??Zd(s,r),n=t&&o&&!ti(o,r),i=n?await Fa(o):o??ec(s,r);return[n?i:void 0,await tc(i)]}}}),za,ri,po,Ba,nc,oc,ic,Ra,zt,en=Be(()=>{La(),ri=!1,po=!1,Ba=!1,nc=()=>{if(typeof SharedArrayBuffer>"u")return!1;try{return 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}},oc=()=>{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}},ic=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},Ra=async e=>{if(ri)return Promise.resolve();if(po)throw new Error("multiple calls to 'initializeWebAssembly()' detected.");if(Ba)throw new Error("previous call to 'initializeWebAssembly()' failed.");po=!0;let r=e.initTimeout,t=e.numThreads;if(e.simd!==!1){if(e.simd==="relaxed"){if(!ic())throw new Error("Relaxed WebAssembly SIMD is not supported in the current environment.")}else if(!oc())throw new Error("WebAssembly SIMD is not supported in the current environment.")}let s=nc();t>1&&!s&&(typeof self<"u"&&!self.crossOriginIsolated&&console.warn("env.wasm.numThreads is set to "+t+", but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info."),console.warn("WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading."),e.numThreads=t=1);let o=e.wasmPaths,n=typeof o=="string"?o:void 0,i=o==null?void 0:o.mjs,a=(i==null?void 0:i.href)??i,l=o==null?void 0:o.wasm,u=(l==null?void 0:l.href)??l,p=e.wasmBinary,[d,c]=await sc(a,n,t>1),f=!1,_=[];if(r>0&&_.push(new Promise(T=>{setTimeout(()=>{f=!0,T()},r)})),_.push(new Promise((T,k)=>{let w={numThreads:t};if(p)w.wasmBinary=p;else if(u||n)w.locateFile=g=>u??n+g;else if(a&&a.indexOf("blob:")!==0)w.locateFile=g=>new URL(g,a).href;else if(d){let g=Yd();g&&(w.locateFile=S=>g+S)}c(w).then(g=>{po=!1,ri=!0,za=g,T(),d&&URL.revokeObjectURL(d)},g=>{po=!1,Ba=!0,k(g)})})),await Promise.race(_),f)throw new Error(`WebAssembly backend initializing failed due to timeout: ${r}ms`)},zt=()=>{if(ri&&za)return za;throw new Error("WebAssembly is not initialized yet.")}}),rs,si,At,ja=Be(()=>{en(),rs=(e,r)=>{let t=zt(),s=t.lengthBytesUTF8(e)+1,o=t._malloc(s);return t.stringToUTF8(e,o,s),r.push(o),o},si=(e,r,t,s)=>{if(typeof e=="object"&&e!==null){if(t.has(e))throw new Error("Circular reference in options");t.add(e)}Object.entries(e).forEach(([o,n])=>{let i=r?r+o:o;if(typeof n=="object")si(n,i+".",t,s);else if(typeof n=="string"||typeof n=="number")s(i,n.toString());else if(typeof n=="boolean")s(i,n?"1":"0");else throw new Error(`Can't handle extra config type: ${typeof n}`)})},At=e=>{let r=zt(),t=r.stackSave();try{let s=r.PTR_SIZE,o=r.stackAlloc(2*s);r._OrtGetLastError(o,o+s);let n=Number(r.getValue(o,s===4?"i32":"i64")),i=r.getValue(o+s,"*"),a=i?r.UTF8ToString(i):"";throw new Error(`${e} ERROR_CODE: ${n}, ERROR_MESSAGE: ${a}`)}finally{r.stackRestore(t)}}}),ac,Mv=Be(()=>{en(),ja(),ac=e=>{let r=zt(),t=0,s=[],o=e||{};try{if((e==null?void 0:e.logSeverityLevel)===void 0)o.logSeverityLevel=2;else if(typeof e.logSeverityLevel!="number"||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw new Error(`log serverity level is not valid: ${e.logSeverityLevel}`);if((e==null?void 0:e.logVerbosityLevel)===void 0)o.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!="number"||!Number.isInteger(e.logVerbosityLevel))throw new Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);(e==null?void 0:e.terminate)===void 0&&(o.terminate=!1);let n=0;return(e==null?void 0:e.tag)!==void 0&&(n=rs(e.tag,s)),t=r._OrtCreateRunOptions(o.logSeverityLevel,o.logVerbosityLevel,!!o.terminate,n),t===0&&At("Can't create run options."),(e==null?void 0:e.extra)!==void 0&&si(e.extra,"",new WeakSet,(i,a)=>{let l=rs(i,s),u=rs(a,s);r._OrtAddRunConfigEntry(t,l,u)!==0&&At(`Can't set a run config entry: ${i} - ${a}.`)}),[t,s]}catch(n){throw t!==0&&r._OrtReleaseRunOptions(t),s.forEach(i=>r._free(i)),n}}}),lc,uc,dc,ho,cc,pc,bv=Be(()=>{en(),ja(),lc=e=>{switch(e){case"disabled":return 0;case"basic":return 1;case"extended":return 2;case"all":return 99;default:throw new Error(`unsupported graph optimization level: ${e}`)}},uc=e=>{switch(e){case"sequential":return 0;case"parallel":return 1;default:throw new Error(`unsupported execution mode: ${e}`)}},dc=e=>{e.extra||(e.extra={}),e.extra.session||(e.extra.session={});let r=e.extra.session;r.use_ort_model_bytes_directly||(r.use_ort_model_bytes_directly="1"),e.executionProviders&&e.executionProviders.some(t=>(typeof t=="string"?t:t.name)==="webgpu")&&(e.enableMemPattern=!1)},ho=(e,r,t,s)=>{let o=rs(r,s),n=rs(t,s);zt()._OrtAddSessionConfigEntry(e,o,n)!==0&&At(`Can't set a session config entry: ${r} - ${t}.`)},cc=async(e,r,t)=>{for(let s of r){let o=typeof s=="string"?s:s.name,n=[];switch(o){case"webnn":if(o="WEBNN",typeof s!="string"){let p=s==null?void 0:s.deviceType;p&&ho(e,"deviceType",p,t)}break;case"webgpu":if(o="JS",typeof s!="string"){let p=s;if(p!=null&&p.preferredLayout){if(p.preferredLayout!=="NCHW"&&p.preferredLayout!=="NHWC")throw new Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${p.preferredLayout}`);ho(e,"preferredLayout",p.preferredLayout,t)}}break;case"wasm":case"cpu":continue;default:throw new Error(`not supported execution provider: ${o}`)}let i=rs(o,t),a=n.length,l=0,u=0;if(a>0){l=zt()._malloc(a*zt().PTR_SIZE),t.push(l),u=zt()._malloc(a*zt().PTR_SIZE),t.push(u);for(let p=0;p{let r=zt(),t=0,s=[],o=e||{};dc(o);try{let n=lc(o.graphOptimizationLevel??"all"),i=uc(o.executionMode??"sequential"),a=typeof o.logId=="string"?rs(o.logId,s):0,l=o.logSeverityLevel??2;if(!Number.isInteger(l)||l<0||l>4)throw new Error(`log serverity level is not valid: ${l}`);let u=o.logVerbosityLevel??0;if(!Number.isInteger(u)||u<0||u>4)throw new Error(`log verbosity level is not valid: ${u}`);let p=typeof o.optimizedModelFilePath=="string"?rs(o.optimizedModelFilePath,s):0;if(t=r._OrtCreateSessionOptions(n,!!o.enableCpuMemArena,!!o.enableMemPattern,i,!!o.enableProfiling,0,a,l,u,p),t===0&&At("Can't create session options."),o.executionProviders&&await cc(t,o.executionProviders,s),o.enableGraphCapture!==void 0){if(typeof o.enableGraphCapture!="boolean")throw new Error(`enableGraphCapture must be a boolean value: ${o.enableGraphCapture}`);ho(t,"enableGraphCapture",o.enableGraphCapture.toString(),s)}if(o.freeDimensionOverrides)for(let[d,c]of Object.entries(o.freeDimensionOverrides)){if(typeof d!="string")throw new Error(`free dimension override name must be a string: ${d}`);if(typeof c!="number"||!Number.isInteger(c)||c<0)throw new Error(`free dimension override value must be a non-negative integer: ${c}`);let f=rs(d,s);r._OrtAddFreeDimensionOverride(t,f,c)!==0&&At(`Can't set a free dimension override: ${d} - ${c}.`)}return o.extra!==void 0&&si(o.extra,"",new WeakSet,(d,c)=>{ho(t,d,c,s)}),[t,s]}catch(n){throw t!==0&&r._OrtReleaseSessionOptions(t)!==0&&At("Can't release session options."),s.forEach(i=>r._free(i)),n}}}),jn,Ts,tn,Na,ni,Va,Ua,Wa,ut=Be(()=>{jn=e=>{switch(e){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"float16":return 10;case"float32":return 1;case"float64":return 11;case"string":return 8;case"int64":return 7;case"uint64":return 13;case"int4":return 22;case"uint4":return 21;default:throw new Error(`unsupported data type: ${e}`)}},Ts=e=>{switch(e){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 10:return"float16";case 1:return"float32";case 11:return"float64";case 8:return"string";case 7:return"int64";case 13:return"uint64";case 22:return"int4";case 21:return"uint4";default:throw new Error(`unsupported data type: ${e}`)}},tn=(e,r)=>{let t=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],s=typeof r=="number"?r:r.reduce((o,n)=>o*n,1);return t>0?Math.ceil(s*t):void 0},Na=e=>{switch(e){case"float16":return typeof Float16Array<"u"&&Float16Array.from?Float16Array:Uint16Array;case"float32":return Float32Array;case"uint8":return Uint8Array;case"int8":return Int8Array;case"uint16":return Uint16Array;case"int16":return Int16Array;case"int32":return Int32Array;case"bool":return Uint8Array;case"float64":return Float64Array;case"uint32":return Uint32Array;case"int64":return BigInt64Array;case"uint64":return BigUint64Array;default:throw new Error(`unsupported type: ${e}`)}},ni=e=>{switch(e){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: ${e}`)}},Va=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",Ua=e=>e==="float32"||e==="float16"||e==="int32"||e==="int64"||e==="uint32"||e==="uint64"||e==="int8"||e==="uint8"||e==="bool"||e==="uint4"||e==="int4",Wa=e=>{switch(e){case"none":return 0;case"cpu":return 1;case"cpu-pinned":return 2;case"texture":return 3;case"gpu-buffer":return 4;case"ml-tensor":return 5;default:throw new Error(`unsupported data location: ${e}`)}}}),Ga,hc=Be(()=>{Pa(),Ga=async e=>{if(typeof e=="string"){let r=await fetch(e);if(!r.ok)throw new Error(`failed to load external data file: ${e}`);let t=r.headers.get("Content-Length"),s=t?parseInt(t,10):0;if(s<1073741824)return new Uint8Array(await r.arrayBuffer());{if(!r.body)throw new Error(`failed to load external data file: ${e}, no response body.`);let o=r.body.getReader(),n;try{n=new ArrayBuffer(s)}catch(a){if(a instanceof RangeError){let l=Math.ceil(s/65536);n=new WebAssembly.Memory({initial:l,maximum:l}).buffer}else throw a}let i=0;for(;;){let{done:a,value:l}=await o.read();if(a)break;let u=l.byteLength;new Uint8Array(n,i,u).set(l),i+=u}return new Uint8Array(n,0,s)}}else return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),mc,_c,fc,gc,Ka,wc,vt,Es=Be(()=>{ut(),mc=["V","I","W","E","F"],_c=(e,r)=>{console.log(`[${mc[e]},${new Date().toISOString()}]${r}`)},Ka=(e,r)=>{fc=e,gc=r},wc=(e,r)=>{let t=ni(e),s=ni(fc);t>=s&&_c(t,typeof r=="function"?r():r)},vt=(...e)=>{gc&&wc(...e)}}),Mc,Nn,Me,oi,bc,yc,vc,mt=Be(()=>{Mc=class{static calcMatMulShape(e,r){return e[1]!==r[0]?void 0:[e[0],r[1]]}},Nn=class{static calcShape(e,r,t=!1){let s=e.length,o=r.length;if(s===0)return r;if(o===0)return e;let n=Math.max(e.length,r.length),i=new Array(n);if(t){if(s<2||o<2)return;let a=Mc.calcMatMulShape([e[s-2],e[s-1]],[r[o-2],r[o-1]]);if(a===void 0)return;[i[n-2],i[n-1]]=a}for(let a=t?3:1;a<=n;a++){let l=s-a<0?1:e[s-a],u=o-a<0?1:r[o-a];if(l!==u&&l>1&&u>1)return;let p=Math.max(l,u);if(l&&u)i[n-a]=Math.max(l,u);else{if(p>1)return;i[n-a]=0}}return i}static isValidBroadcast(e,r){let t=e.length,s=r.length;if(t>s)return!1;for(let o=1;o<=t;o++)if(e[t-o]!==1&&e[t-o]!==r[s-o])return!1;return!0}},Me=class fa{static size(r){return fa.getSizeFromDimensionRange(r,0,r.length)}static convertShape(r,t=4){let s=r.length;if(s===0)return[];let o=new Array(s),n=s-1;for(;n>=0;){if(r[n]%t===0){o[n]=r[n]/t;break}if(t%r[n]!==0)throw new Error("cannot convert shape");o[n]=1,t/=r[n],n--}for(n--;n>=0;n--)o[n]=r[n];return o}static sizeFromDimension(r,t){if(t<0||t>r.length)throw new Error(`invalid dimension of ${t} for sizeFromDimension as Tensor has ${r.length} dimensions.`);return fa.getSizeFromDimensionRange(r,t,r.length)}static sizeToDimension(r,t){if(t<0||t>r.length)throw new Error(`invalid dimension of ${t} for sizeToDimension as Tensor has ${r.length} dimensions.`);return fa.getSizeFromDimensionRange(r,0,t)}static getSizeFromDimensionRange(r,t,s){let o=1;for(let n=t;n=0;--o)s[o]=s[o+1]*r[o+1];return s}static normalizeAxis(r,t){if(r<-t&&r>=t)throw new Error("unsupported axis for this operation.");return r<0?r+t:r}static normalizeAxes(r,t){return r.map(s=>this.normalizeAxis(s,t??r.length))}static sortBasedOnPerm(r,t){return t?t.map(s=>r[s]):r.slice().reverse()}static padShape(r,t){let s=r.length;return r.map((o,n)=>o+t[n]+t[n+s])}static areEqual(r,t){return r.length!==t.length?!1:r.every((s,o)=>s===t[o])}},oi=class Yo{static adjustPoolAttributes(r,t,s,o,n,i){if(!r&&s.length!==t.length-2)throw new Error("length of specified kernel shapes should be 2 less than length of input dimensions");if(r)for(let a=0;a=s.length?s.push(t[a+2]):s[a]=t[a+2];for(let a=0;a=s[a]||i[a+s.length]>=s[a])throw new Error("pads should be smaller than kernel")}}static adjustPadsBasedOnAutoPad(r,t,s,o,n,i,a){if(a){if(n.length!==2*(r.length-2))throw new Error("length of pads should be twice the length of data dimensions");if(t.length!==r.length-2)throw new Error("length of strides should be the length of data dimensions");if(o.length!==r.length-2)throw new Error("length of kernel shapes should be the length of data dimensions");for(let l=0;l{ut(),Ha=(e,r)=>new(Na(r))(e)}),qa,Xa,Tc,Qa,Ec,Ja,Ya,Za,Pc,Cc,yv=Be(()=>{Es(),qa=(e,r=!0)=>{if(e.byteLength%8!==0)throw new Error("Invalid Uint8Array length - must be a multiple of 8 (BigInt).");let t=e.byteLength/8,s=new BigInt64Array(e.buffer,e.byteOffset,t),o=new Int32Array(t);for(let n=0;n2147483647n||i<-2147483648n)throw new Error(`Overflow occurred when converting BigInt to Int32 at index ${n}: ${i}`);o[n]=Number(i)}return r?new Uint8Array(o.buffer):o},Xa=(e,r=!0)=>{if(e.byteLength%4!==0)throw new Error("Invalid Uint8Array length - must be a multiple of 4 (Int32).");let t=e.byteLength/4,s=new Int32Array(e.buffer,e.byteOffset,t),o=BigInt64Array.from(s,BigInt);return r?new Uint8Array(o.buffer):o},Tc=1,Qa=()=>Tc++,Ec=new Map([["float32",32],["float16",16],["int32",32],["uint32",32],["int64",64],["uint64",64],["int8",8],["uint8",8],["int4",4],["uint4",4]]),Ja=(e,r)=>{let t=Ec.get(e);if(!t)throw new Error("Unsupported data type.");return r.length>0?Math.ceil(r.reduce((s,o)=>s*o)*t/8):0},Ya=class{constructor(e){this.shouldConvertInt64toInt32=!1,this.isInt64ToInt32Converted=!1;let{sessionId:r,context:t,tensor:s,dataType:o,shape:n,shouldConvertInt64toInt32:i=!1}=e;this.sessionId=r,this.mlContext=t,this.mlTensor=s,this.dataType=o,this.tensorShape=n,this.shouldConvertInt64toInt32=i}get tensor(){return this.mlTensor}get type(){return this.dataType}get shape(){return this.tensorShape}get byteLength(){return Ja(this.dataType,this.tensorShape)}destroy(){vt("verbose",()=>"[WebNN] TensorWrapper.destroy"),this.mlTensor.destroy()}write(e){this.mlContext.writeTensor(this.mlTensor,e)}async read(e,r){if(e){let t=await this.mlContext.readTensor(this.mlTensor),s=Xa(new Uint8Array(t));if(r){(r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).set(s);return}else return s.buffer}else return r?this.mlContext.readTensor(this.mlTensor,r):this.mlContext.readTensor(this.mlTensor)}canReuseTensor(e,r,t){return this.mlContext===e&&this.dataType===r&&this.tensorShape.length===t.length&&this.tensorShape.every((s,o)=>s===t[o])}setIsInt64ToInt32Converted(e){this.isInt64ToInt32Converted=e}},Za=class{constructor(e,r){this.tensorManager=e,this.wrapper=r}get tensorWrapper(){return this.wrapper}releaseTensor(){this.tensorWrapper&&(this.tensorManager.releaseTensor(this.tensorWrapper),this.wrapper=void 0)}async ensureTensor(e,r,t,s){let o=r,n=this.tensorManager.getMLContext(e),i=o==="int64"&&!n.opSupportLimits().input.dataTypes.includes("int64");if(i&&(o="int32",vt("verbose",()=>"[WebNN] TensorIdTracker.ensureTensor: convert dataType from int64 to int32")),this.wrapper){if(this.wrapper.canReuseTensor(n,o,t))return this.wrapper.tensor;if(s){if(this.wrapper.byteLength!==Ja(o,t))throw new Error("Unable to copy data to tensor with different size.");this.activeUpload=new Uint8Array(await this.wrapper.read())}this.tensorManager.releaseTensor(this.wrapper)}let a=typeof MLTensorUsage>"u"?void 0:MLTensorUsage.READ|MLTensorUsage.WRITE;return this.wrapper=await this.tensorManager.getCachedTensor(e,o,t,a,!0,!0,i),s&&this.activeUpload&&(this.wrapper.write(this.activeUpload),this.activeUpload=void 0),this.wrapper.tensor}upload(e){let r=e;if(this.wrapper)if(this.wrapper.shouldConvertInt64toInt32&&(r=qa(e,!0),this.wrapper.setIsInt64ToInt32Converted(!0)),r.byteLength===this.wrapper.byteLength){this.wrapper.write(r);return}else vt("verbose",()=>"Data size does not match tensor size. Releasing tensor."),this.releaseTensor();this.activeUpload?this.activeUpload.set(r):this.activeUpload=new Uint8Array(r)}async download(e){var r,t,s;if(this.activeUpload){let o=(r=this.wrapper)!=null&&r.isInt64ToInt32Converted?Xa(this.activeUpload):this.activeUpload;if(e){e instanceof ArrayBuffer?new Uint8Array(e).set(o):new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(o);return}else return o.buffer}if(!this.wrapper)throw new Error("Tensor has not been created.");return e?this.wrapper.read((t=this.wrapper)==null?void 0:t.shouldConvertInt64toInt32,e):this.wrapper.read((s=this.wrapper)==null?void 0:s.shouldConvertInt64toInt32)}},Pc=class{constructor(e){this.backend=e,this.tensorTrackersById=new Map,this.freeTensors=[],this.externalTensors=new Set}getMLContext(e){let r=this.backend.getMLContext(e);if(!r)throw new Error("MLContext not found for session.");return r}reserveTensorId(){let e=Qa();return this.tensorTrackersById.set(e,new Za(this)),e}releaseTensorId(e){let r=this.tensorTrackersById.get(e);r&&(this.tensorTrackersById.delete(e),r.tensorWrapper&&this.releaseTensor(r.tensorWrapper))}async ensureTensor(e,r,t,s,o){vt("verbose",()=>`[WebNN] TensorManager.ensureTensor {tensorId: ${r}, dataType: ${t}, shape: ${s}, copyOld: ${o}}`);let n=this.tensorTrackersById.get(r);if(!n)throw new Error("Tensor not found.");return n.ensureTensor(e,t,s,o)}upload(e,r){let t=this.tensorTrackersById.get(e);if(!t)throw new Error("Tensor not found.");t.upload(r)}async download(e,r){vt("verbose",()=>`[WebNN] TensorManager.download {tensorId: ${e}, dstBuffer: ${r==null?void 0:r.byteLength}}`);let t=this.tensorTrackersById.get(e);if(!t)throw new Error("Tensor not found.");return t.download(r)}releaseTensorsForSession(e){for(let r of this.freeTensors)r.sessionId===e&&r.destroy();this.freeTensors=this.freeTensors.filter(r=>r.sessionId!==e)}registerTensor(e,r,t,s){let o=this.getMLContext(e),n=Qa(),i=new Ya({sessionId:e,context:o,tensor:r,dataType:t,shape:s});return this.tensorTrackersById.set(n,new Za(this,i)),this.externalTensors.add(i),n}async getCachedTensor(e,r,t,s,o,n,i=!1){let a=this.getMLContext(e);for(let[u,p]of this.freeTensors.entries())if(p.canReuseTensor(a,r,t)){vt("verbose",()=>`[WebNN] Reusing tensor {dataType: ${r}, shape: ${t}}`);let d=this.freeTensors.splice(u,1)[0];return d.sessionId=e,d}vt("verbose",()=>`[WebNN] MLContext.createTensor {dataType: ${r}, shape: ${t}}`);let l=await a.createTensor({dataType:r,shape:t,dimensions:t,usage:s,writable:o,readable:n});return new Ya({sessionId:e,context:a,tensor:l,dataType:r,shape:t,shouldConvertInt64toInt32:i})}releaseTensor(e){this.externalTensors.has(e)&&this.externalTensors.delete(e),this.freeTensors.push(e)}},Cc=(...e)=>new Pc(...e)}),ii,Sc,$c,vv=Be(()=>{ut(),en(),xc(),yv(),Es(),ii=new Map([[1,"float32"],[10,"float16"],[6,"int32"],[12,"uint32"],[7,"int64"],[13,"uint64"],[22,"int4"],[21,"uint4"],[3,"int8"],[2,"uint8"],[9,"uint8"]]),Sc=(e,r)=>{if(e===r)return!0;if(e===void 0||r===void 0)return!1;let t=Object.keys(e).sort(),s=Object.keys(r).sort();return t.length===s.length&&t.every((o,n)=>o===s[n]&&e[o]===r[o])},$c=class{constructor(e){this.tensorManager=Cc(this),this.mlContextBySessionId=new Map,this.sessionIdsByMLContext=new Map,this.mlContextCache=[],this.sessionGraphInputs=new Map,this.temporaryGraphInputs=[],this.temporarySessionTensorIds=new Map,Ka(e.logLevel,!!e.debug)}get currentSessionId(){if(this.activeSessionId===void 0)throw new Error("No active session");return this.activeSessionId}onRunStart(e){vt("verbose",()=>`[WebNN] onRunStart {sessionId: ${e}}`),this.activeSessionId=e}onRunEnd(e){vt("verbose",()=>`[WebNN] onRunEnd {sessionId: ${e}}`);let r=this.temporarySessionTensorIds.get(e);if(r){for(let t of r)vt("verbose",()=>`[WebNN] releasing temporary tensor {tensorId: ${t}}`),this.tensorManager.releaseTensorId(t);this.temporarySessionTensorIds.delete(e),this.activeSessionId=void 0}}async createMLContext(e){if(e instanceof GPUDevice){let t=this.mlContextCache.findIndex(s=>s.gpuDevice===e);if(t!==-1)return this.mlContextCache[t].mlContext;{let s=await navigator.ml.createContext(e);return this.mlContextCache.push({gpuDevice:e,mlContext:s}),s}}else if(e===void 0){let t=this.mlContextCache.findIndex(s=>s.options===void 0&&s.gpuDevice===void 0);if(t!==-1)return this.mlContextCache[t].mlContext;{let s=await navigator.ml.createContext();return this.mlContextCache.push({mlContext:s}),s}}let r=this.mlContextCache.findIndex(t=>Sc(t.options,e));if(r!==-1)return this.mlContextCache[r].mlContext;{let t=await navigator.ml.createContext(e);return this.mlContextCache.push({options:e,mlContext:t}),t}}registerMLContext(e,r){this.mlContextBySessionId.set(e,r);let t=this.sessionIdsByMLContext.get(r);t||(t=new Set,this.sessionIdsByMLContext.set(r,t)),t.add(e),this.temporaryGraphInputs.length>0&&(this.sessionGraphInputs.set(e,this.temporaryGraphInputs),this.temporaryGraphInputs=[])}onReleaseSession(e){this.sessionGraphInputs.delete(e);let r=this.mlContextBySessionId.get(e);if(!r)return;this.tensorManager.releaseTensorsForSession(e),this.mlContextBySessionId.delete(e);let t=this.sessionIdsByMLContext.get(r);if(t.delete(e),t.size===0){this.sessionIdsByMLContext.delete(r);let s=this.mlContextCache.findIndex(o=>o.mlContext===r);s!==-1&&this.mlContextCache.splice(s,1)}}getMLContext(e){return this.mlContextBySessionId.get(e)}reserveTensorId(){return this.tensorManager.reserveTensorId()}releaseTensorId(e){vt("verbose",()=>`[WebNN] releaseTensorId {tensorId: ${e}}`),this.tensorManager.releaseTensorId(e)}async ensureTensor(e,r,t,s,o){let n=ii.get(t);if(!n)throw new Error(`Unsupported ONNX data type: ${t}`);return this.tensorManager.ensureTensor(e??this.currentSessionId,r,n,s,o)}async createTemporaryTensor(e,r,t){vt("verbose",()=>`[WebNN] createTemporaryTensor {onnxDataType: ${r}, shape: ${t}}`);let s=ii.get(r);if(!s)throw new Error(`Unsupported ONNX data type: ${r}`);let o=this.tensorManager.reserveTensorId();await this.tensorManager.ensureTensor(e,o,s,t,!1);let n=this.temporarySessionTensorIds.get(e);return n?n.push(o):this.temporarySessionTensorIds.set(e,[o]),o}uploadTensor(e,r){if(!zt().shouldTransferToMLTensor)throw new Error("Trying to upload to a MLTensor while shouldTransferToMLTensor is false");vt("verbose",()=>`[WebNN] uploadTensor {tensorId: ${e}, data: ${r.byteLength}}`),this.tensorManager.upload(e,r)}async downloadTensor(e,r){return this.tensorManager.download(e,r)}createMLTensorDownloader(e,r){return async()=>{let t=await this.tensorManager.download(e);return Ha(t,r)}}registerMLTensor(e,r,t,s){let o=ii.get(t);if(!o)throw new Error(`Unsupported ONNX data type: ${t}`);let n=this.tensorManager.registerTensor(e,r,o,s);return vt("verbose",()=>`[WebNN] registerMLTensor {tensor: ${r}, dataType: ${o}, dimensions: ${s}} -> {tensorId: ${n}}`),n}registerMLConstant(e,r,t,s,o,n,i=!1){if(!n)throw new Error("External mounted files are not available.");let a=e;e.startsWith("./")&&(a=e.substring(2));let l=n.get(a);if(!l)throw new Error(`File with name ${a} not found in preloaded files.`);if(r+t>l.byteLength)throw new Error("Out of bounds: data offset and length exceed the external file data size.");let u=l.slice(r,r+t).buffer,p;switch(o.dataType){case"float32":p=new Float32Array(u);break;case"float16":p=typeof Float16Array<"u"&&Float16Array.from?new Float16Array(u):new Uint16Array(u);break;case"int32":p=new Int32Array(u);break;case"uint32":p=new Uint32Array(u);break;case"int64":i?(p=qa(new Uint8Array(u),!1),o.dataType="int32"):p=new BigInt64Array(u);break;case"uint64":p=new BigUint64Array(u);break;case"int8":p=new Int8Array(u);break;case"int4":case"uint4":case"uint8":p=new Uint8Array(u);break;default:throw new Error(`Unsupported data type: ${o.dataType} in creating WebNN Constant from external data.`)}return vt("verbose",()=>`[WebNN] registerMLConstant {dataType: ${o.dataType}, shape: ${o.shape}}} ${i?"(Note: it was int64 data type and registered to int32 as workaround)":""}`),s.constant(o,p)}registerGraphInput(e){this.temporaryGraphInputs.push(e)}isGraphInput(e,r){let t=this.sessionGraphInputs.get(e);return t?t.includes(r):!1}isInt64Supported(e){var r;return!!((r=this.mlContextBySessionId.get(e))!=null&&r.opSupportLimits().input.dataTypes.includes("int64"))}flush(){}}}),el=Be(()=>{}),tl,ai,li,kc,Ic,rl,sl,Ac,Fc,xv=Be(()=>{Es(),el(),tl=new Map([[64,250],[128,200],[256,200],[512,200],[2048,230],[4096,200],[8192,50],[16384,50],[32768,50],[65536,50],[131072,50],[262144,50],[524288,50],[1048576,50],[2097152,30],[4194304,20],[8388608,10],[12582912,10],[16777216,10],[26214400,15],[33554432,22],[44236800,2],[58982400,6],[67108864,6],[134217728,6],[167772160,6]]),ai=[],li=e=>Math.ceil(Number(e)/16)*16,kc=e=>{for(let r=0;rIc++,sl=async(e,r,t,s)=>{let o=li(t),n=e.device.createBuffer({size:o,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});try{let i=e.getCommandEncoder();e.endComputePass(),i.copyBufferToBuffer(r,0,n,0,o),e.flush(),await n.mapAsync(GPUMapMode.READ);let a=n.getMappedRange();if(s){let l=s();return l.set(new Uint8Array(a,0,t)),l}else return new Uint8Array(a.slice(0,t))}finally{n.destroy()}},Ac=class{constructor(e){this.backend=e,this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.buffersPending=[],this.capturedPendingBuffers=new Map;for(let[r]of tl)ai.push(r),this.freeBuffers.set(r,[]),this.freeUniformBuffers.set(r,[]);this.sessionCount=0}upload(e,r){let t=r.buffer,s=r.byteOffset,o=r.byteLength,n=li(o),i=this.storageCache.get(e);if(!i)throw new Error("gpu data for uploading does not exist");if(Number(i.originalSize)!==o)throw new Error(`inconsistent data size. gpu data size=${i.originalSize}, data size=${o}`);let a=this.backend.device.createBuffer({mappedAtCreation:!0,size:n,usage:GPUBufferUsage.MAP_WRITE|GPUBufferUsage.COPY_SRC}),l=a.getMappedRange();new Uint8Array(l).set(new Uint8Array(t,s,o)),a.unmap();let u=this.backend.device.createCommandEncoder();u.copyBufferToBuffer(a,0,i.gpuData.buffer,0,n),this.backend.device.queue.submit([u.finish()]),a.destroy(),vt("verbose",()=>`[WebGPU] GpuDataManager.upload(id=${e})`)}memcpy(e,r){let t=this.storageCache.get(e);if(!t)throw new Error("source gpu data for memcpy does not exist");let s=this.storageCache.get(r);if(!s)throw new Error("destination gpu data for memcpy does not exist");if(t.originalSize!==s.originalSize)throw new Error("inconsistent source and destination gpu data size");let o=li(t.originalSize),n=this.backend.getCommandEncoder();this.backend.endComputePass(),n.copyBufferToBuffer(t.gpuData.buffer,0,s.gpuData.buffer,0,o)}registerExternalBuffer(e,r,t){let s;if(t){if(s=t[0],e===t[1])return vt("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, buffer is the same, skip.`),s;if(this.backend.capturedCommandList.has(this.backend.currentSessionId))throw new Error(`Registering a different external buffer under graph capture mode is not supported yet. + Please use the previous external buffer!`)}else s=rl();return this.storageCache.set(s,{gpuData:{id:s,type:0,buffer:e},originalSize:r}),vt("verbose",()=>`[WebGPU] GpuDataManager.registerExternalBuffer(size=${r}) => id=${s}, registered.`),s}unregisterExternalBuffer(e){e!==void 0&&(this.storageCache.delete(e),vt("verbose",()=>`[WebGPU] GpuDataManager.unregisterExternalBuffer() => id=${e}`))}create(e,r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST){let t=kc(e),s,o=(r&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE,n=(r&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM;if(o||n){let a=(o?this.freeBuffers:this.freeUniformBuffers).get(t);a?a.length>0?s=a.pop():s=this.backend.device.createBuffer({size:t,usage:r}):s=this.backend.device.createBuffer({size:t,usage:r})}else s=this.backend.device.createBuffer({size:t,usage:r});let i={id:rl(),type:0,buffer:s};return this.storageCache.set(i.id,{gpuData:i,originalSize:Number(e)}),vt("verbose",()=>`[WebGPU] GpuDataManager.create(size=${e}) => id=${i.id}`),i}get(e){var r;return(r=this.storageCache.get(e))==null?void 0:r.gpuData}release(e){let r=typeof e=="bigint"?Number(e):e,t=this.storageCache.get(r);if(!t){if(this.storageCache.size===0)return 0;throw new Error("releasing data does not exist")}return vt("verbose",()=>`[WebGPU] GpuDataManager.release(id=${r}), gpuDataId=${t.gpuData.id}`),this.storageCache.delete(r),this.buffersPending.push(t.gpuData.buffer),t.originalSize}async download(e,r){let t=this.storageCache.get(Number(e));if(!t)throw new Error("data does not exist");await sl(this.backend,t.gpuData.buffer,t.originalSize,r)}refreshPendingBuffers(){if(this.buffersPending.length!==0)if(this.backend.sessionStatus==="default"){for(let e of this.buffersPending){let r=tl.get(e.size);if((e.usage&GPUBufferUsage.STORAGE)===GPUBufferUsage.STORAGE){let t=this.freeBuffers.get(e.size)||[];r===void 0||t.length>=r?e.destroy():t.push(e)}else if((e.usage&GPUBufferUsage.UNIFORM)===GPUBufferUsage.UNIFORM){let t=this.freeUniformBuffers.get(e.size)||[];r===void 0||t.length>=r?e.destroy():t.push(e)}else e.destroy()}this.buffersPending=[]}else{let e=this.capturedPendingBuffers.get(this.backend.currentSessionId);e||(e=[],this.capturedPendingBuffers.set(this.backend.currentSessionId,e));for(let r of this.buffersPending)e.push(r);this.buffersPending=[]}}dispose(){this.freeBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.freeUniformBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache.forEach(e=>{e.gpuData.buffer.destroy()}),this.capturedPendingBuffers.forEach(e=>{e.forEach(r=>{r.destroy()})}),this.storageCache=new Map,this.freeBuffers=new Map,this.freeUniformBuffers=new Map,this.capturedPendingBuffers=new Map}onCreateSession(){this.sessionCount+=1}onReleaseSession(e){let r=this.capturedPendingBuffers.get(e);r&&(r.forEach(t=>{t.destroy()}),this.capturedPendingBuffers.delete(e)),this.sessionCount-=1,this.sessionCount===0&&(vt("warning",()=>"[WebGPU] Clearing webgpu buffer cache"),this.storageCache.forEach(t=>{t.gpuData.buffer.destroy()}),this.storageCache=new Map)}},Fc=(...e)=>new Ac(...e)}),Oc,St,Xt=Be(()=>{Oc=class{constructor(e){Object.assign(this,e)}get cacheKey(){return this.key||(this.key=Object.getOwnPropertyNames(this).sort().map(e=>`${this[e]}`).join(";")),this.key}},St=e=>new Oc(e)}),Vn,ui,lr,yr,st,Kt,nl,Un,Ls,et,mo,Pe,Ye,Dc,ol,Lc,zc,ft=Be(()=>{ut(),mt(),Vn=64,ui=(e,r)=>{if(r===3)throw new Error("vec3 has same alignment as vec4, use vec4 instead");switch(Number(e)){case 10:return r>1?`vec${r}`:"f16";case 1:return r>1?`vec${r}`:"f32";case 6:return r>1?`vec${r}`:"i32";case 12:return r>1?`vec${r}`:"u32";case 7:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","i32"];case 13:if(r>1)throw new Error("currently not supported vecX of uint64 yet");return["vec2","u32"];case 9:if(r!==4)throw new Error("bool must be vec4");return["u32","vec4"];case 22:return"i32";case 21:return"u32";default:throw new Error(`Unknown data type: ${e}`)}},lr=(e,r=1)=>{let t=ui(e,r);return typeof t=="string"?t:t[0]},yr=(e,r=1)=>{let t=ui(e,r);return typeof t=="string"?t:t[1]},st=(...e)=>{let r=[];return e.forEach(t=>{t.length!==0&&r.push({type:12,data:t},{type:12,data:Me.computeStrides(t)})}),r},Kt=e=>e%4===0?4:e%2===0?2:1,nl=(e="f32",r,t="0")=>!r||r===1?`${e}(${t})`:`vec${r}<${e}>(${t})`,Un=(e,r,t)=>e==="f32"?t:r===1?`f32(${t})`:`vec${r}(${t})`,Ls=(e,r)=>r===4?`(${e}.x + ${e}.y + ${e}.z + ${e}.w)`:r===2?`(${e}.x + ${e}.y)`:r===3?`(${e}.x + ${e}.y + ${e}.z)`:e,et=(e,r,t,s)=>e.startsWith("uniforms.")&&t>4?typeof r=="string"?s==="f16"?`${e}[(${r}) / 8][(${r}) % 8 / 4][(${r}) % 8 % 4]`:`${e}[(${r}) / 4][(${r}) % 4]`:s==="f16"?`${e}[${Math.floor(r/8)}][${Math.floor(r%8/4)}][${r%8%4}]`:`${e}[${Math.floor(r/4)}][${r%4}]`:t>1?`${e}[${r}]`:e,mo=(e,r,t,s,o)=>{let n=typeof t=="number",i=n?t:t.length,a=[...new Array(i).keys()],l=i<2?"u32":i<=4?`vec${i}`:`array`,u=ui(r,o),p=typeof u=="string"?u:u[1],d=typeof u=="string"?u:u[0],c={indices:l,value:p,storage:d,tensor:r},f=V=>typeof V=="string"?V:`${V}u`,_={offsetToIndices:!1,indicesToOffset:!1,broadcastedIndicesToOffset:!1,set:!1,setByIndices:!1,get:!1,getByIndices:!1},T=n?"uniforms.":"",k=`${T}${e}_shape`,w=`${T}${e}_strides`,g="";for(let V=0;V ${c.indices} { + var indices: ${c.indices}; + var current = offset; + ${g} + return indices; + }`,E=V=>(_.offsetToIndices=!0,i<2?V:`o2i_${e}(${V})`),y=[];if(i>=2)for(let V=i-1;V>=0;V--)y.push(`${et(w,V,i)} * (indices[${V}])`);let M=i<2?"":` + fn i2o_${e}(indices: ${c.indices}) -> u32 { + return ${y.join("+")}; + }`,v=V=>(_.indicesToOffset=!0,i<2?V:`i2o_${e}(${V})`),C=(...V)=>i===0?"0u":`${c.indices}(${V.map(f).join(",")})`,A=(V,F)=>i<2?`${V}`:`${et(V,F,i)}`,B=(V,F,W)=>i<2?`${V}=${W};`:`${et(V,F,i)}=${W};`,K={},G=(V,F)=>{_.broadcastedIndicesToOffset=!0;let W=`${F.name}broadcastedIndicesTo${e}Offset`;if(W in K)return`${W}(${V})`;let re=[];for(let _e=i-1;_e>=0;_e--){let se=F.indicesGet("outputIndices",_e+F.rank-i);re.push(`${A(w,_e)} * (${se} % ${A(k,_e)})`)}return K[W]=`fn ${W}(outputIndices: ${F.type.indices}) -> u32 { + return ${re.length>0?re.join("+"):"0u"}; + }`,`${W}(${V})`},j=(V,F)=>(()=>{if(c.storage===c.value)return`${e}[${V}]=${F};`;if(c.storage==="vec2"&&c.value==="i32")return`${e}[${V}]=vec2(u32(${F}), select(0u, 0xFFFFFFFFu, ${F} < 0));`;if(c.storage==="vec2"&&c.value==="u32")return`${e}[${V}]=vec2(u32(${F}), 0u);`;if(c.storage==="u32"&&c.value==="vec4")return`${e}[${V}]=dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(${F}));`;throw new Error(`not supported combination of storage type ${c.storage} and value type ${c.value} yet`)})(),ee=V=>(()=>{if(c.storage===c.value)return`${e}[${V}]`;if(c.storage==="vec2"&&c.value==="i32")return`i32(${e}[${V}].x)`;if(c.storage==="vec2"&&c.value==="u32")return`u32(${e}[${V}].x)`;if(c.storage==="u32"&&c.value==="vec4")return`vec4(bool(${e}[${V}] & 0xFFu), bool(${e}[${V}] & 0xFF00u), bool(${e}[${V}] & 0xFF0000u), bool(${e}[${V}] & 0xFF000000u))`;throw new Error(`not supported combination of storage type ${c.storage} and value type ${c.value} yet`)})(),H=i<2?"":` + fn get_${e}ByIndices(indices: ${c.indices}) -> ${p} { + return ${ee(`i2o_${e}(indices)`)}; + }`,Z=i<2?"":(()=>{let V=a.map(W=>`d${W}: u32`).join(", "),F=a.map(W=>`d${W}`).join(", ");return` + fn get_${e}(${V}) -> ${p} { + return get_${e}ByIndices(${C(F)}); + }`})(),X=(...V)=>{if(V.length!==i)throw new Error(`indices length must be ${i}`);let F=V.map(f).join(",");return i===0?ee("0u"):i===1?ee(F[0]):(_.get=!0,_.getByIndices=!0,_.indicesToOffset=!0,`get_${e}(${F})`)},oe=V=>i<2?ee(V):(_.getByIndices=!0,_.indicesToOffset=!0,`get_${e}ByIndices(${V})`),me=i<2?"":` + fn set_${e}ByIndices(indices: ${c.indices}, value: ${p}) { + ${j(`i2o_${e}(indices)`,"value")} + }`,ae=i<2?"":(()=>{let V=a.map(W=>`d${W}: u32`).join(", "),F=a.map(W=>`d${W}`).join(", ");return` + fn set_${e}(${V}, value: ${p}) { + set_${e}ByIndices(${C(F)}, value); + }`})();return{impl:()=>{let V=[],F=!1;return _.offsetToIndices&&(V.push(S),F=!0),_.indicesToOffset&&(V.push(M),F=!0),_.broadcastedIndicesToOffset&&(Object.values(K).forEach(W=>V.push(W)),F=!0),_.set&&(V.push(ae),F=!0),_.setByIndices&&(V.push(me),F=!0),_.get&&(V.push(Z),F=!0),_.getByIndices&&(V.push(H),F=!0),!n&&F&&V.unshift(`const ${k} = ${c.indices}(${t.join(",")});`,`const ${w} = ${c.indices}(${Me.computeStrides(t).join(",")});`),V.join(` +`)},type:c,offsetToIndices:E,indicesToOffset:v,broadcastedIndicesToOffset:G,indices:C,indicesGet:A,indicesSet:B,set:(...V)=>{if(V.length!==i+1)throw new Error(`indices length must be ${i}`);let F=V[i];if(typeof F!="string")throw new Error("value must be string");let W=V.slice(0,i).map(f).join(",");return i===0?j("0u",F):i===1?j(W[0],F):(_.set=!0,_.setByIndices=!0,_.indicesToOffset=!0,`set_${e}(${W}, ${F})`)},setByOffset:j,setByIndices:(V,F)=>i<2?j(V,F):(_.setByIndices=!0,_.indicesToOffset=!0,`set_${e}ByIndices(${V}, ${F});`),get:X,getByOffset:ee,getByIndices:oe,usage:s,name:e,strides:w,shape:k,rank:i}},Pe=(e,r,t,s=1)=>mo(e,r,t,"input",s),Ye=(e,r,t,s=1)=>mo(e,r,t,"output",s),Dc=(e,r,t)=>mo(e,r,t,"atomicOutput",1),ol=(e,r,t,s=1)=>mo(e,r,t,"internal",s),Lc=class{constructor(e,r){this.normalizedDispatchGroup=e,this.limits=r,this.internalVariables=[],this.variables=[],this.uniforms=[],this.variableIndex=0}guardAgainstOutOfBoundsWorkgroupSizes(e){return`if (global_idx >= ${typeof e=="number"?`${e}u`:e}) { return; }`}mainStart(e=Vn){let r=typeof e=="number"?e:e[0],t=typeof e=="number"?1:e[1],s=typeof e=="number"?1:e[2];if(r>this.limits.maxComputeWorkgroupSizeX||t>this.limits.maxComputeWorkgroupSizeY||s>this.limits.maxComputeWorkgroupSizeZ)throw new Error(`workgroup size [${r}, ${t}, ${s}] exceeds the maximum workgroup size [${this.limits.maxComputeWorkgroupSizeX}, ${this.limits.maxComputeWorkgroupSizeY}, ${this.limits.maxComputeWorkgroupSizeZ}].`);if(r*t*s>this.limits.maxComputeInvocationsPerWorkgroup)throw new Error(`workgroup size [${r}, ${t}, ${s}] exceeds the maximum workgroup invocations ${this.limits.maxComputeInvocationsPerWorkgroup}.`);let o=this.normalizedDispatchGroup[1]===1&&this.normalizedDispatchGroup[2]===1,n=o?`@builtin(global_invocation_id) global_id : vec3, + @builtin(workgroup_id) workgroup_id : vec3, + @builtin(local_invocation_index) local_idx : u32, + @builtin(local_invocation_id) local_id : vec3`:`@builtin(global_invocation_id) global_id : vec3, + @builtin(local_invocation_id) local_id : vec3, + @builtin(local_invocation_index) local_idx : u32, + @builtin(workgroup_id) workgroup_id : vec3, + @builtin(num_workgroups) num_workgroups : vec3`,i=o?`let global_idx = global_id.x; + let workgroup_index = workgroup_id.x;`:`let workgroup_index = workgroup_id.z * num_workgroups[0] * num_workgroups[1] + + workgroup_id.y * num_workgroups[0] + workgroup_id.x; + let global_idx = workgroup_index * ${r*t*s}u + local_idx;`;return`@compute @workgroup_size(${r}, ${t}, ${s}) + fn main(${n}) { + ${i} + `}appendVariableUniforms(e){e.rank!==0&&(e.shape.startsWith("uniforms.")&&this.uniforms.push({name:e.shape.replace("uniforms.",""),type:"u32",length:e.rank}),e.strides.startsWith("uniforms.")&&this.uniforms.push({name:e.strides.replace("uniforms.",""),type:"u32",length:e.rank}))}declareVariable(e,r){if(e.usage==="internal")throw new Error("cannot use internal variable with declareVariable(). use registerInternalVariables() instead.");this.variables.push(e),this.appendVariableUniforms(e);let t=e.usage==="input"?"read":"read_write",s=e.usage==="atomicOutput"?"atomic":e.type.storage;return`@group(0) @binding(${r}) var ${e.name}: array<${s}>;`}declareVariables(...e){return e.map(r=>this.declareVariable(r,this.variableIndex++)).join(` +`)}registerInternalVariable(e){if(e.usage!=="internal")throw new Error("cannot use input or output variable with registerInternalVariable(). use declareVariables() instead.");this.internalVariables.push(e),this.appendVariableUniforms(e)}registerInternalVariables(...e){return e.forEach(r=>this.registerInternalVariable(r)),this}registerUniform(e,r,t=1){return this.uniforms.push({name:e,type:r,length:t}),this}registerUniforms(e){return this.uniforms=this.uniforms.concat(e),this}uniformDeclaration(){if(this.uniforms.length===0)return"";let e=[];for(let{name:r,type:t,length:s}of this.uniforms)if(s&&s>4)t==="f16"?e.push(`@align(16) ${r}:array, ${Math.ceil(s/8)}>`):e.push(`${r}:array, ${Math.ceil(s/4)}>`);else{let o=s==null||s===1?t:`vec${s}<${t}>`;e.push(`${r}:${o}`)}return` + struct Uniforms { ${e.join(", ")} }; + @group(0) @binding(${this.variableIndex}) var uniforms: Uniforms;`}get additionalImplementations(){return this.uniformDeclaration()+this.variables.map(e=>e.impl()).join(` +`)+this.internalVariables.map(e=>e.impl()).join(` +`)}get variablesInfo(){if(this.uniforms.length===0)return;let e=r=>[12,10,1,6][["u32","f16","f32","i32"].indexOf(r)];return this.uniforms.map(r=>[e(r.type),r.length??1])}},zc=(e,r)=>new Lc(e,r)}),Bc,il,Rc,jc,Nc,Vc,Lr,Uc,Wc,zs=Be(()=>{ut(),mt(),Xt(),ft(),Bc=(e,r)=>{if(!e||e.length!==1)throw new Error("Transpose requires 1 input.");if(r.length!==0&&r.length!==e[0].dims.length)throw new Error(`perm size ${r.length} does not match input rank ${e[0].dims.length}`)},il=(e,r)=>r.length!==0?r:[...new Array(e).keys()].reverse(),Rc=(e,r)=>Me.sortBasedOnPerm(e,il(e.length,r)),jc=(e,r,t,s)=>{let o=`fn perm(i: ${s.type.indices}) -> ${t.type.indices} { + var a: ${t.type.indices};`;for(let n=0;n{let t=[],s=[];for(let o=0;o{let t=0;for(let s=0;s{let t=e.dataType,s=e.dims.length,o=il(s,r),n=Rc(e.dims,o),i=e.dims,a=n,l=s<2||Vc(o,e.dims),u;if(l)return u=_=>{let T=Pe("input",t,i,4),k=Ye("output",t,a,4);return` + ${_.registerUniform("output_size","u32").declareVariables(T,k)} + ${_.mainStart()} + ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + output[global_idx] = input[global_idx]; + }`},{name:"TransposeCopy",shaderCache:{inputDependencies:["type"]},getRunData:()=>{let _=Me.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(_/64/4)},programUniforms:[{type:12,data:Math.ceil(_/4)}]}},getShaderSource:u};let{newShape:p,newPerm:d}=Nc(e.dims,o),c=Me.areEqual(d,[2,3,1]),f=Me.areEqual(d,[3,1,2]);if(p.length===2||c||f){i=c?[p[0],p[1]*p[2]]:f?[p[0]*p[1],p[2]]:p,a=[i[1],i[0]];let _=16;return u=T=>{let k=Pe("a",t,i.length),w=Ye("output",t,a.length);return` + ${T.registerUniform("output_size","u32").declareVariables(k,w)} + var tile : array, ${_}>; + ${T.mainStart([_,_,1])} + let stride = (uniforms.output_shape[1] - 1) / ${_} + 1; + let workgroup_id_x = workgroup_index % stride; + let workgroup_id_y = workgroup_index / stride; + let input_col = workgroup_id_y * ${_}u + local_id.x; + let input_row = workgroup_id_x * ${_}u + local_id.y; + if (input_row < uniforms.a_shape[0] && input_col < uniforms.a_shape[1]) { + tile[local_id.y][local_id.x] = ${k.getByIndices(`${k.type.indices}(input_row, input_col)`)}; + } + workgroupBarrier(); + + let output_col = workgroup_id_x * ${_}u + local_id.x; + let output_row = workgroup_id_y * ${_}u + local_id.y; + if (output_row < uniforms.output_shape[0] && output_col < uniforms.output_shape[1]) { + ${w.setByIndices(`${w.type.indices}(output_row, output_col)`,"tile[local_id.x][local_id.y]")} + } + }`},{name:"TransposeShared",shaderCache:{inputDependencies:["type"]},getRunData:()=>{let T=Me.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(a[1]/_),y:Math.ceil(a[0]/_)},programUniforms:[{type:12,data:T},...st(i,a)]}},getShaderSource:u}}return u=_=>{let T=Pe("a",t,i.length),k=Ye("output",t,a.length);return` + ${_.registerUniform("output_size","u32").declareVariables(T,k)} + + ${jc(o,s,T,k)} + + ${_.mainStart()} + ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let indices = ${k.offsetToIndices("global_idx")}; + let aIndices = perm(indices); + + ${k.setByOffset("global_idx",T.getByIndices("aIndices"))} + }`},{name:"Transpose",shaderCache:{hint:`${r}`,inputDependencies:["rank"]},getRunData:()=>{let _=Me.size(n);return{outputs:[{dims:n,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:[{type:12,data:_},...st(i,a)]}},getShaderSource:u}},Uc=(e,r)=>{Bc(e.inputs,r.perm),e.compute(Lr(e.inputs[0],r.perm))},Wc=e=>St({perm:e.perm})}),Gc,Kc,Hc,qc,Xc,Qc,Jc,Yc,Zc,ep,ss,tp,rp,sp,np,op,ip,ap,lp,up,dp,Tv=Be(()=>{ut(),mt(),ft(),ll(),zs(),Gc={max:"select(bestValue, candidate, candidate > bestValue)",min:"select(bestValue, candidate, candidate < bestValue)",mean:"bestValue + candidate",sum:"bestValue + candidate",prod:"bestValue * candidate",sumSquare:"bestValue + candidate * candidate",logSumExp:"bestValue + exp(candidate)",l1:"bestValue + abs(candidate)",l2:"bestValue + candidate * candidate",logSum:"bestValue + candidate"},Kc={max:"select(bestValue, candidate, candidate > bestValue)",min:"select(bestValue, candidate, candidate < bestValue)",mean:"bestValue + candidate",sum:"bestValue + candidate",prod:"bestValue * candidate",sumSquare:"bestValue + candidate",logSumExp:"bestValue + candidate",l1:"bestValue + candidate",l2:"bestValue + candidate",logSum:"bestValue + candidate"},Hc={max:"_A[offset]",min:"_A[offset]",mean:"0",sum:"0",prod:"1",sumSquare:"0",logSumExp:"0",l1:"0",l2:"0",logSum:"0"},qc={max:"bestValue",min:"bestValue",sum:"bestValue",prod:"bestValue",sumSquare:"bestValue",logSumExp:"log(bestValue)",l1:"bestValue",l2:"sqrt(bestValue)",logSum:"log(bestValue)"},Xc=(e,r)=>{let t=[];for(let s=r-e;s{let t=[],s=e.length;for(let n=0;ne[n]);return[t,o]},Jc=(e,r)=>{let t=e.length+r.length,s=[],o=0;for(let n=0;n{for(let t=0;t{let t=[];if(!Yc(e,r)){for(let s=0;st.push(s))}return t},ep=(e,r,t,s,o,n,i)=>{let a=t[0].dims,l=Me.size(n),u=Me.size(i),p=Pe("_A",t[0].dataType,a),d=Ye("output",o,n),c=64;l===1&&(c=256);let f=` + var aBestValues : array; + `,_=T=>` + ${T.registerUniform("reduceSize","u32").declareVariables(p,d)} + ${f} + fn DIV_CEIL(a : u32, b : u32) -> u32 { + return ((a - 1u) / b + 1u); + } + ${T.mainStart(c)} + + let outputIndex = global_idx / ${c}; + let offset = outputIndex * uniforms.reduceSize; + + var bestValue = f32(${Hc[s]}); + let Length = uniforms.reduceSize; + for (var k = local_idx; k < Length; k = k + ${c}) { + let candidate = f32(${p.getByOffset("offset + k")}); + bestValue = ${Gc[s]}; + } + aBestValues[local_idx] = bestValue; + workgroupBarrier(); + + var reduceSize = min(Length, ${c}u); + for (var currentSize = reduceSize / 2u; reduceSize > 1u; + currentSize = reduceSize / 2u) { + let interval = DIV_CEIL(reduceSize, 2u); + if (local_idx < currentSize) { + let candidate = aBestValues[local_idx + interval]; + bestValue = ${Kc[s]}; + aBestValues[local_idx] = bestValue; + } + reduceSize = interval; + workgroupBarrier(); + } + + if (local_idx == 0u) { + ${d.setByOffset("outputIndex",`${s==="mean"?`${d.type.storage}(bestValue / f32(uniforms.reduceSize))`:`${d.type.storage}(${qc[s]})`}`)}; + } + }`;return{name:e,shaderCache:{hint:`${r};${c}`,inputDependencies:["type"]},getShaderSource:_,getRunData:()=>({outputs:[{dims:n,dataType:o}],dispatchGroup:{x:l},programUniforms:[{type:12,data:u}]})}},ss=(e,r,t,s)=>{let o=e.inputs.length===1?t:al(e.inputs,t),n=o.axes;n.length===0&&!o.noopWithEmptyAxes&&(n=e.inputs[0].dims.map((f,_)=>_));let i=Me.normalizeAxes(n,e.inputs[0].dims.length),a=i,l=e.inputs[0],u=Zc(a,e.inputs[0].dims.length);u.length>0&&(l=e.compute(Lr(e.inputs[0],u),{inputs:[0],outputs:[-1]})[0],a=Xc(a.length,l.dims.length));let[p,d]=Qc(l.dims,a),c=p;o.keepDims&&(c=Jc(p,i)),e.compute(ep(r,o.cacheKey,[l],s,e.inputs[0].dataType,c,d),{inputs:[l]})},tp=(e,r)=>{ss(e,"ReduceMeanShared",r,"mean")},rp=(e,r)=>{ss(e,"ReduceL1Shared",r,"l1")},sp=(e,r)=>{ss(e,"ReduceL2Shared",r,"l2")},np=(e,r)=>{ss(e,"ReduceLogSumExpShared",r,"logSumExp")},op=(e,r)=>{ss(e,"ReduceMaxShared",r,"max")},ip=(e,r)=>{ss(e,"ReduceMinShared",r,"min")},ap=(e,r)=>{ss(e,"ReduceProdShared",r,"prod")},lp=(e,r)=>{ss(e,"ReduceSumShared",r,"sum")},up=(e,r)=>{ss(e,"ReduceSumSquareShared",r,"sumSquare")},dp=(e,r)=>{ss(e,"ReduceLogSumShared",r,"logSum")}}),ns,cp,di,al,os,pp,hp,mp,_p,fp,gp,wp,Mp,bp,yp,is,vp,xp,Tp,Ep,Pp,Cp,Sp,$p,kp,Ip,ll=Be(()=>{ut(),mt(),Xt(),ft(),Tv(),ns=e=>{if(!e||e.length===0||e.length>2)throw new Error("Reduce op requires 1 or 2 inputs.");if(e.length===2&&e[1].dims.length!==1)throw new Error("Invalid axes input dims.")},cp=e=>["","",`var value = ${e.getByIndices("input_indices")};`,""],di=(e,r,t,s,o,n,i=!1,a=!1)=>{let l=[],u=t[0].dims,p=u.length,d=Me.normalizeAxes(o,p),c=!a&&d.length===0;u.forEach((T,k)=>{c||d.indexOf(k)>=0?i&&l.push(1):l.push(T)});let f=l.length,_=Me.size(l);return{name:e,shaderCache:r,getShaderSource:T=>{let k=[],w=Pe("_A",t[0].dataType,p),g=Ye("output",n,f),S=s(w,g,d),E=S[2];for(let y=0,M=0;y=0?(i&&M++,E=`for(var j${y}: u32 = 0; j${y} < ${u[y]}; j${y}++) { + ${S[2].includes("last_index")?`let last_index = j${y};`:""} + ${w.indicesSet("input_indices",y,`j${y}`)} + ${E} + }`):(k.push(`${w.indicesSet("input_indices",y,g.indicesGet("output_indices",M))};`),M++);return` + + ${T.registerUniform("output_size","u32").declareVariables(w,g)} + + ${T.mainStart()} + ${T.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + var input_indices: ${w.type.indices}; + let output_indices = ${g.offsetToIndices("global_idx")}; + + ${k.join(` +`)} + ${S[0]} // init ops for reduce max/min + ${S[1]} + ${E} + ${S[3]} + ${S.length===4?g.setByOffset("global_idx","value"):S.slice(4).join(` +`)} + }`},getRunData:()=>({outputs:[{dims:l,dataType:n}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:[{type:12,data:_},...st(u,l)]})}},al=(e,r)=>{let t=[];return e[1].dims[0]>0&&e[1].getBigInt64Array().forEach(s=>t.push(Number(s))),St({axes:t,keepDims:r.keepDims,noopWithEmptyAxes:r.noopWithEmptyAxes})},os=(e,r,t,s)=>{let o=e.inputs,n=o.length===1?t:al(o,t);e.compute(di(r,{hint:n.cacheKey,inputDependencies:["rank"]},[o[0]],n.noopWithEmptyAxes&&n.axes.length===0?cp:s,n.axes,o[0].dataType,n.keepDims,n.noopWithEmptyAxes),{inputs:[0]})},pp=(e,r)=>{ns(e.inputs),os(e,"ReduceLogSum",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += ${t.getByIndices("input_indices")};`,"value = log(value);"])},hp=(e,r)=>{ns(e.inputs),os(e,"ReduceL1",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += abs(${t.getByIndices("input_indices")});`,""])},mp=(e,r)=>{ns(e.inputs),os(e,"ReduceL2",r,(t,s)=>[`var t = ${s.type.value}(0); var value = ${s.type.value}(0);`,"",`t = ${t.getByIndices("input_indices")}; value += (t * t);`,"value = sqrt(value);"])},_p=(e,r)=>{ns(e.inputs),os(e,"ReduceLogSumExp",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += exp(${t.getByIndices("input_indices")});`,"value = log(value);"])},fp=(e,r)=>{ns(e.inputs),os(e,"ReduceMax",r,(t,s,o)=>{let n=[];for(let i=0;i=0||o.length===0)&&n.push(t.indicesSet("input_indices",i,0));return[`${n.join(` +`)}`,`var value = ${t.getByIndices("input_indices")};`,`value = max(value, ${t.getByIndices("input_indices")});`,""]})},gp=(e,r)=>{ns(e.inputs),os(e,"ReduceMean",r,(t,s,o)=>{let n=1;for(let i=0;i=0||o.length===0)&&(n*=e.inputs[0].dims[i]);return["var sum = f32(0);","",`sum += f32(${t.getByIndices("input_indices")});`,`let value = ${s.type.value}(sum / ${n});`]})},wp=(e,r)=>{ns(e.inputs),os(e,"ReduceMin",r,(t,s,o)=>{let n=[];for(let i=0;i=0||o.length===0)&&n.push(`input_indices[${i}] = 0;`);return[`${n.join(` +`)}`,`var value = ${t.getByIndices("input_indices")};`,`value = min(value, ${t.getByIndices("input_indices")});`,""]})},Mp=(e,r)=>{ns(e.inputs),os(e,"ReduceProd",r,(t,s)=>[`var value = ${s.type.storage}(1);`,"",`value *= ${t.getByIndices("input_indices")};`,""])},bp=(e,r)=>{ns(e.inputs),os(e,"ReduceSum",r,(t,s)=>[`var value = ${s.type.storage}(0);`,"",`value += ${t.getByIndices("input_indices")};`,""])},yp=(e,r)=>{ns(e.inputs),os(e,"ReduceSumSquare",r,(t,s)=>[`var t = ${s.type.value}(0); var value = ${s.type.value}(0);`,"",`t = ${t.getByIndices("input_indices")}; value += t * t;`,""])},is=(e,r,t)=>{if(r.length===0)return t;let s=1,o=1;for(let n=0;n1024},vp=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?gp(e,r):tp(e,r)},xp=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?hp(e,r):rp(e,r)},Tp=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?mp(e,r):sp(e,r)},Ep=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?_p(e,r):np(e,r)},Pp=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?fp(e,r):op(e,r)},Cp=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?wp(e,r):ip(e,r)},Sp=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?Mp(e,r):ap(e,r)},$p=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?bp(e,r):lp(e,r)},kp=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?yp(e,r):up(e,r)},Ip=(e,r)=>{is(e.inputs[0].dims,r.axes,r.noopWithEmptyAxes)?pp(e,r):dp(e,r)}}),ul,Ap,Fp,dl,Ev=Be(()=>{ut(),Xt(),ll(),ul=e=>{if(!e||e.length===0||e.length>2)throw new Error("ArgMinMaxOp op requires 1 or 2 inputs.");if(e[0].dataType!==1)throw new Error("Invalid input type.")},Ap=(e,r)=>{ul(e.inputs);let t=(s,o,n)=>{let i=[];for(let a=0;a=0||n.length===0)&&i.push(`input_indices[${a}] = 0;`);return[`${i.join(` +`)}`,`var value = ${s.getByIndices("input_indices")}; +var best_index : i32 = 0;`,`if (${s.getByIndices("input_indices")} ${r.selectLastIndex>0?"<=":"<"} value) { + value = ${s.getByIndices("input_indices")}; + best_index = i32(last_index); + }`,"",o.setByOffset("global_idx","best_index")]};e.compute(di("ArgMin",{hint:r.cacheKey,inputDependencies:["rank"]},[e.inputs[0]],t,[r.axis],7,r.keepDims),{inputs:[0]})},Fp=(e,r)=>{ul(e.inputs);let t=(s,o,n)=>{let i=[];for(let a=0;a=0||n.length===0)&&i.push(`input_indices[${a}] = 0;`);return[`${i.join(` +`)}`,`var value = ${s.getByIndices("input_indices")}; +var best_index : i32 = 0;`,`if (${s.getByIndices("input_indices")} ${r.selectLastIndex>0?">=":">"} value) { + value = ${s.getByIndices("input_indices")}; + best_index = i32(last_index); + }`,"",o.setByOffset("global_idx","best_index")]};e.compute(di("argMax",{hint:r.cacheKey,inputDependencies:["rank"]},[e.inputs[0]],t,[r.axis],7,r.keepDims),{inputs:[0]})},dl=e=>St(e)}),Op,ci,Dp,Lp,zp,_o,Bp,Rp,cl=Be(()=>{ut(),mt(),el(),ft(),Op=(e,r)=>{let t=e[0],s=e[1],o=e[2],n=e[3],i=e[4],a=e[5];if(i&&a)throw new Error("Attention cannot have both past and attention_bias");if(t.dims.length!==3)throw new Error('Input "input" must have 3 dimensions');let l=t.dims[0],u=t.dims[1],p=t.dims[2];if(o.dims.length!==1)throw new Error('Input "bias" is expected to have 1 dimensions');if(s.dims.length!==2)throw new Error('Input "weights" is expected to have 2 dimensions');if(s.dims[0]!==p)throw new Error("Input 1 dimension 0 should have same length as dimension 2 of input 0");if(o.dims[0]!==s.dims[1])throw new Error('Input "bias" dimension 0 should have same length as dimension 1 of input "weights"');let d=o.dims[0]/3,c=d,f=c;if(r.qkvHiddenSizes.length>0){if(r.qkvHiddenSizes.length!==3)throw new Error("qkv_hidden_sizes attribute should have 3 elements");for(let S of r.qkvHiddenSizes)if(S%r.numHeads!==0)throw new Error("qkv_hidden_sizes should be divisible by num_heads");d=r.qkvHiddenSizes[0],c=r.qkvHiddenSizes[1],f=r.qkvHiddenSizes[2]}let _=u;if(d!==c)throw new Error("qkv_hidden_sizes first element should be same as the second");if(o.dims[0]!==d+c+f)throw new Error('Input "bias" dimension 0 should have same length as sum of Q/K/V hidden sizes');let T=0;if(i){if(c!==f)throw new Error('Input "past" expect k_hidden_size == v_hidden_size');if(i.dims.length!==5)throw new Error('Input "past" must have 5 dimensions');if(i.dims[0]!==2)throw new Error('Input "past" first dimension must be 2');if(i.dims[1]!==l)throw new Error('Input "past" second dimension must be batch_size');if(i.dims[2]!==r.numHeads)throw new Error('Input "past" third dimension must be num_heads');if(i.dims[4]!==c/r.numHeads)throw new Error('Input "past" fifth dimension must be k_hidden_size / num_heads');r.pastPresentShareBuffer||(T=i.dims[3])}let k=_+T,w=-1,g=0;if(n)throw new Error("Mask not supported");if(i)throw new Error("past is not supported");if(a){if(a.dims.length!==4)throw new Error('Input "attention_bias" must have 4 dimensions');if(a.dims[0]!==l||a.dims[1]!==r.numHeads||a.dims[2]!==u||a.dims[3]!==k)throw new Error('Expect "attention_bias" shape (batch_size, num_heads, sequence_length, total_sequence_length)')}return{batchSize:l,sequenceLength:u,pastSequenceLength:T,kvSequenceLength:_,totalSequenceLength:k,maxSequenceLength:w,inputHiddenSize:p,hiddenSize:d,vHiddenSize:f,headSize:Math.floor(d/r.numHeads),vHeadSize:Math.floor(f/r.numHeads),numHeads:r.numHeads,isUnidirectional:!1,pastPresentShareBuffer:!1,maskFilterValue:r.maskFilterValue,maskType:g,scale:r.scale,broadcastResPosBias:!1,passPastInKv:!1,qkvFormat:1}},ci=(e,r,t)=>r&&e?` + let total_sequence_length_input = u32(${r.getByOffset("0")}); + let present_sequence_length = max(total_sequence_length_input, uniforms.past_sequence_length); + let is_subsequent_prompt: bool = sequence_length > 1 && sequence_length != total_sequence_length_input; + let is_first_prompt: bool = is_subsequent_prompt == false && sequence_length == total_sequence_length_input; + total_sequence_length = u32(${e==null?void 0:e.getByOffset("batchIdx")}) + 1; + var past_sequence_length: u32 = 0; + if (is_first_prompt == false) { + past_sequence_length = total_sequence_length - sequence_length; + } + `:` + ${t?"let past_sequence_length = uniforms.past_sequence_length":""}; + let present_sequence_length = total_sequence_length; + `,Dp=(e,r,t,s,o,n,i,a)=>{let l=Kt(i?1:n),u=64,p=n/l;p{let g=Ye("x",e.dataType,e.dims,l),S=[g],E=i?Pe("seq_lens",i.dataType,i.dims):void 0;E&&S.push(E);let y=a?Pe("total_sequence_length_input",a.dataType,a.dims):void 0;y&&S.push(y);let M=yr(e.dataType),v=[{name:"batch_size",type:"u32"},{name:"num_heads",type:"u32"},{name:"past_sequence_length",type:"u32"},{name:"sequence_length",type:"u32"},{name:"total_sequence_length",type:"u32"},{name:"elements_per_thread",type:"u32"}];return` + var thread_max: array; + var thread_sum: array; + ${w.registerUniforms(v).declareVariables(...S)} + ${w.mainStart([u,1,1])} + let batchIdx = workgroup_id.z / uniforms.num_heads; + let headIdx = workgroup_id.z % uniforms.num_heads; + let sequence_length = uniforms.sequence_length; + var total_sequence_length = uniforms.total_sequence_length; + ${ci(E,y,!1)} + let local_offset = local_idx * uniforms.elements_per_thread; + let offset = (global_idx / ${u}) * uniforms.total_sequence_length + local_offset; + let seq_causal_length = ${i?"u32(past_sequence_length + workgroup_id.y + 1)":"total_sequence_length"}; + var thread_max_vector = ${_}(-3.402823e+38f); + for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { + thread_max_vector = max(${_}(x[offset + i]), thread_max_vector); + } + thread_max[local_idx] = ${(()=>{switch(l){case 1:return"thread_max_vector";case 2:return"max(thread_max_vector.x, thread_max_vector.y)";case 4:return"max(max(thread_max_vector.x, thread_max_vector.y), max(thread_max_vector.z, thread_max_vector.w))";default:throw new Error(`Unsupported components: ${l}`)}})()}; + workgroupBarrier(); + + var max_value = f32(-3.402823e+38f); + for (var i = 0u; i < ${u}; i++) { + max_value = max(thread_max[i], max_value); + } + + var sum_vector = ${_}(0); + for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { + sum_vector += exp(${_}(x[offset + i]) - max_value); + } + thread_sum[local_idx] = ${(()=>{switch(l){case 1:return"sum_vector";case 2:return"sum_vector.x + sum_vector.y";case 4:return"sum_vector.x + sum_vector.y + sum_vector.z + sum_vector.w";default:throw new Error(`Unsupported components: ${l}`)}})()}; + workgroupBarrier(); + + var sum: f32 = 0; + for (var i = 0u; i < ${u}; i++) { + sum += thread_sum[i]; + } + + if (sum == 0) { + for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { + x[offset + i] = ${g.type.value}(${M}(1.0) / ${M}(seq_causal_length)); + } + } else { + for (var i: u32 = 0; i < uniforms.elements_per_thread && i + local_offset < seq_causal_length; i++) { + var f32input = ${_}(x[offset + i]); + x[offset + i] = ${g.type.value}(exp(f32input - max_value) / sum); + } + } + ${i?` + for (var total_seq_id: u32 = seq_causal_length; total_seq_id + local_offset < uniforms.total_sequence_length; total_seq_id++) { + x[offset + total_seq_id] = ${g.type.value}(${M}(0)); + }`:""}; + }`};return{name:"AttentionProbsSoftmax",shaderCache:{hint:`${u};${f};${l}`,inputDependencies:T},getShaderSource:k,getRunData:()=>({outputs:[],dispatchGroup:{x:1,y:o,z:r*t},programUniforms:c})}},Lp=(e,r,t,s,o,n,i,a,l)=>{let u=i+n.kvSequenceLength,p=[n.batchSize,n.numHeads,n.sequenceLength,u],d=e>1&&s,c=n.kvNumHeads?n.kvNumHeads:n.numHeads,f=d?[n.batchSize,c,u,n.headSize]:void 0,_=n.nReps?n.nReps:1,T=n.scale===0?1/Math.sqrt(n.headSize):n.scale,k=Kt(n.headSize),w=n.headSize/k,g=12,S={x:Math.ceil(u/g),y:Math.ceil(n.sequenceLength/g),z:n.batchSize*n.numHeads},E=[{type:12,data:n.sequenceLength},{type:12,data:w},{type:12,data:u},{type:12,data:n.numHeads},{type:12,data:n.headSize},{type:1,data:T},{type:12,data:i},{type:12,data:n.kvSequenceLength},{type:12,data:_}],y=d&&s&&Me.size(s.dims)>0,M=["type","type"];y&&M.push("type"),o&&M.push("type"),a&&M.push("type"),l&&M.push("type");let v=[{dims:p,dataType:r.dataType,gpuDataType:0}];d&&v.push({dims:f,dataType:r.dataType,gpuDataType:0});let C=A=>{let B=Pe("q",r.dataType,r.dims,k),K=Pe("key",t.dataType,t.dims,k),G=[B,K];if(y){let me=Pe("past_key",s.dataType,s.dims,k);G.push(me)}o&&G.push(Pe("attention_bias",o.dataType,o.dims));let j=a?Pe("seq_lens",a.dataType,a.dims):void 0;j&&G.push(j);let ee=l?Pe("total_sequence_length_input",l.dataType,l.dims):void 0;ee&&G.push(ee);let H=Ye("output",r.dataType,p),Z=[H];d&&Z.push(Ye("present_key",r.dataType,f,k));let X=yr(1,k),oe=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"alpha",type:"f32"},{name:"past_sequence_length",type:"u32"},{name:"kv_sequence_length",type:"u32"},{name:"n_reps",type:"u32"}];return` + const TILE_SIZE = ${g}u; + + var tileQ: array<${B.type.storage}, ${g*g}>; + var tileK: array<${B.type.storage}, ${g*g}>; + ${A.registerUniforms(oe).declareVariables(...G,...Z)} + ${A.mainStart([g,g,1])} + // x holds the N and y holds the M + let headIdx = workgroup_id.z % uniforms.num_heads; + let kvHeadIdx = ${_===1?"headIdx":"headIdx / uniforms.n_reps"}; + let kv_num_heads = ${_===1?"uniforms.num_heads":"uniforms.num_heads / uniforms.n_reps"}; + let batchIdx = workgroup_id.z / uniforms.num_heads; + let m = workgroup_id.y * TILE_SIZE; + let n = workgroup_id.x * TILE_SIZE; + let sequence_length = uniforms.M; + var total_sequence_length = uniforms.N; + ${ci(j,ee,!0)} + let absKvHeadIdx = batchIdx * kv_num_heads + kvHeadIdx; + let qOffset = workgroup_id.z * uniforms.M * uniforms.K + m * uniforms.K; + ${y&&d?"let pastKeyOffset = absKvHeadIdx * uniforms.past_sequence_length * uniforms.K;":""}; + let kOffset = absKvHeadIdx * uniforms.kv_sequence_length * uniforms.K; + ${d?"let presentKeyOffset = absKvHeadIdx * uniforms.N * uniforms.K;":""} + var value = ${X}(0); + for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { + if (global_id.y < uniforms.M && w + local_id.x < uniforms.K) { + tileQ[TILE_SIZE * local_id.y + local_id.x] = q[qOffset + local_id.y * uniforms.K + w + local_id.x]; + } + if (n + local_id.y < uniforms.N && w + local_id.x < uniforms.K) { + var idx = TILE_SIZE * local_id.y + local_id.x; + ${y&&d?` + if (n + local_id.y < past_sequence_length) { + tileK[idx] = past_key[pastKeyOffset + (n + local_id.y) * uniforms.K + w + local_id.x]; + } else if (n + local_id.y - past_sequence_length < uniforms.kv_sequence_length) { + tileK[idx] = key[kOffset + (n + local_id.y - past_sequence_length) * uniforms.K + w + local_id.x]; + }`:` + if (n + local_id.y < uniforms.kv_sequence_length) { + tileK[idx] = key[kOffset + (n + local_id.y) * uniforms.K + w + local_id.x]; + }`} + ${d?`if (n + local_id.y < present_sequence_length) { + present_key[presentKeyOffset + (n + local_id.y) * uniforms.K + w + local_id.x] = tileK[idx]; + }`:""} + } + workgroupBarrier(); + + for (var k: u32 = 0u; k < TILE_SIZE && w+k < uniforms.K; k++) { + value += ${X}(tileQ[TILE_SIZE * local_id.y + k] * tileK[TILE_SIZE * local_id.x + k]); + } + + workgroupBarrier(); + } + + if (global_id.y < uniforms.M && global_id.x < total_sequence_length) { + let headOffset = workgroup_id.z * uniforms.M * uniforms.N; + let outputIdx = headOffset + global_id.y * uniforms.N + global_id.x; + var sum: f32 = ${(()=>{switch(k){case 1:return"value";case 2:return"value.x + value.y";case 4:return"value.x + value.y + value.z + value.w";default:throw new Error(`Unsupported components: ${k}`)}})()}; + output[outputIdx] = ${H.type.value} (sum * uniforms.alpha) + ${o?"attention_bias[outputIdx]":"0.0"}; + } + }`};return{name:"AttentionProbs",shaderCache:{hint:`${k};${o!==void 0};${s!==void 0};${e}`,inputDependencies:M},getRunData:()=>({outputs:v,dispatchGroup:S,programUniforms:E}),getShaderSource:C}},zp=(e,r,t,s,o,n,i=void 0,a=void 0)=>{let l=n+o.kvSequenceLength,u=o.nReps?o.nReps:1,p=o.vHiddenSize*u,d=e>1&&s,c=o.kvNumHeads?o.kvNumHeads:o.numHeads,f=d?[o.batchSize,c,l,o.headSize]:void 0,_=[o.batchSize,o.sequenceLength,p],T=12,k={x:Math.ceil(o.vHeadSize/T),y:Math.ceil(o.sequenceLength/T),z:o.batchSize*o.numHeads},w=[{type:12,data:o.sequenceLength},{type:12,data:l},{type:12,data:o.vHeadSize},{type:12,data:o.numHeads},{type:12,data:o.headSize},{type:12,data:p},{type:12,data:n},{type:12,data:o.kvSequenceLength},{type:12,data:u}],g=d&&s&&Me.size(s.dims)>0,S=["type","type"];g&&S.push("type"),i&&S.push("type"),a&&S.push("type");let E=[{dims:_,dataType:r.dataType,gpuDataType:0}];d&&E.push({dims:f,dataType:r.dataType,gpuDataType:0});let y=M=>{let v=Pe("probs",r.dataType,r.dims),C=Pe("v",t.dataType,t.dims),A=[v,C];g&&A.push(Pe("past_value",s.dataType,s.dims));let B=i?Pe("seq_lens",i.dataType,i.dims):void 0;i&&A.push(B);let K=a?Pe("total_sequence_length_input",a.dataType,a.dims):void 0;a&&A.push(K);let G=[Ye("output",r.dataType,_)];d&&G.push(Ye("present_value",r.dataType,f));let j=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"v_hidden_size",type:"u32"},{name:"past_sequence_length",type:"u32"},{name:"kv_sequence_length",type:"u32"},{name:"n_reps",type:"u32"}];return` + const TILE_SIZE = ${T}u; + var tileQ: array<${v.type.value}, ${T*T}>; + var tileV: array<${v.type.value}, ${T*T}>; + ${M.registerUniforms(j).declareVariables(...A,...G)} + ${M.mainStart([T,T,1])} + let headIdx = workgroup_id.z % uniforms.num_heads; + let batchIdx = workgroup_id.z / uniforms.num_heads; + let kvHeadIdx = ${u===1?"headIdx":"headIdx / uniforms.n_reps"}; + let kv_num_heads = ${u===1?"uniforms.num_heads":"uniforms.num_heads / uniforms.n_reps"}; + let m = global_id.y; + let n = global_id.x; + let sequence_length = uniforms.M; + var total_sequence_length = uniforms.K; + ${ci(B,K,!0)} + let offsetA = workgroup_id.z * uniforms.M * uniforms.K + m * uniforms.K; + let absKvHeadIdx = batchIdx * kv_num_heads + kvHeadIdx; // kvHeadIdx is relative to the batch + ${g&&d?"let pastValueOffset = absKvHeadIdx * uniforms.N * uniforms.past_sequence_length + n;":""}; + let vOffset = absKvHeadIdx * uniforms.N * uniforms.kv_sequence_length + n; + ${d?"let presentValueOffset = absKvHeadIdx * uniforms.N * uniforms.K + n;":""} + var value = ${v.type.storage}(0); + for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { + if (m < uniforms.M && w + local_id.x < uniforms.K) { + tileQ[TILE_SIZE * local_id.y + local_id.x] = probs[offsetA + w + local_id.x]; + } + if (n < uniforms.N && w + local_id.y < uniforms.K) { + var idx = TILE_SIZE * local_id.y + local_id.x; + ${g&&d?` + if (w + local_id.y < past_sequence_length) { + tileV[idx] = past_value[pastValueOffset + (w + local_id.y) * uniforms.N]; + } else if (w + local_id.y - past_sequence_length < uniforms.kv_sequence_length) { + tileV[idx] = v[vOffset + (w + local_id.y - past_sequence_length) * uniforms.N]; + } + `:` + if (w + local_id.y < uniforms.kv_sequence_length) { + tileV[idx] = v[vOffset + (w + local_id.y) * uniforms.N]; + }`} + ${d?` + if (w + local_id.y < present_sequence_length) { + present_value[presentValueOffset + (w + local_id.y) * uniforms.N] = tileV[idx]; + }`:""} + } + workgroupBarrier(); + for (var k: u32 = 0u; k < TILE_SIZE && w+k < total_sequence_length; k++) { + value += tileQ[TILE_SIZE * local_id.y + k] * tileV[TILE_SIZE * k + local_id.x]; + } + workgroupBarrier(); + } + + // we need to transpose output from BNSH_v to BSND_v + if (m < uniforms.M && n < uniforms.N) { + let outputIdx = batchIdx * uniforms.M * uniforms.v_hidden_size + m * uniforms.v_hidden_size + + headIdx * uniforms.N + n; + output[outputIdx] = value; + } + }`};return{name:"AttentionScore",shaderCache:{hint:`${s!==void 0};${e}`,inputDependencies:S},getRunData:()=>({outputs:E,dispatchGroup:k,programUniforms:w}),getShaderSource:y}},_o=(e,r,t,s,o,n,i,a,l,u,p=void 0,d=void 0)=>{let c=Math.min(e.outputCount,1+(i?1:0)+(a?1:0)),f=c>1?u.pastSequenceLength:0,_=f+u.kvSequenceLength,T=l&&Me.size(l.dims)>0?l:void 0,k=[r,t];c>1&&i&&Me.size(i.dims)>0&&k.push(i),T&&k.push(T),p&&k.push(p),d&&k.push(d);let w=e.compute(Lp(c,r,t,i,T,u,f,p,d),{inputs:k,outputs:c>1?[-1,1]:[-1]})[0];e.compute(Dp(w,u.batchSize,u.numHeads,f,u.sequenceLength,_,p,d),{inputs:p&&d?[w,p,d]:[w],outputs:[]});let g=[w,s];c>1&&a&&Me.size(a.dims)>0&&g.push(a),p&&g.push(p),d&&g.push(d),e.compute(zp(c,w,s,a,u,f,p,d),{inputs:g,outputs:c>1?[0,2]:[0]})},Bp=(e,r)=>{let t=[r.batchSize,r.numHeads,r.sequenceLength,r.headSize],s=r.sequenceLength,o=r.inputHiddenSize,n=r.headSize,i=12,a={x:Math.ceil(r.headSize/i),y:Math.ceil(r.sequenceLength/i),z:r.batchSize*r.numHeads},l=[e.inputs[0],e.inputs[1],e.inputs[2]],u=[{type:12,data:s},{type:12,data:o},{type:12,data:n},{type:12,data:r.numHeads},{type:12,data:r.headSize},{type:12,data:r.hiddenSize},{type:12,data:r.hiddenSize+r.hiddenSize+r.vHiddenSize}],p=d=>{let c=Ye("output_q",l[0].dataType,t),f=Ye("output_k",l[0].dataType,t),_=Ye("output_v",l[0].dataType,t),T=Pe("input",l[0].dataType,l[0].dims),k=Pe("weight",l[1].dataType,l[1].dims),w=Pe("bias",l[2].dataType,l[2].dims),g=T.type.storage,S=[{name:"M",type:"u32"},{name:"K",type:"u32"},{name:"N",type:"u32"},{name:"num_heads",type:"u32"},{name:"head_size",type:"u32"},{name:"hidden_size",type:"u32"},{name:"ldb",type:"u32"}];return` + const TILE_SIZE = ${i}u; + var tileInput: array<${g}, ${i*i}>; + var tileWeightQ: array<${g}, ${i*i}>; + var tileWeightK: array<${g}, ${i*i}>; + var tileWeightV: array<${g}, ${i*i}>; + ${d.registerUniforms(S).declareVariables(T,k,w,c,f,_)} + ${d.mainStart([i,i,1])} + let batchIndex = workgroup_id.z / uniforms.num_heads; + let headNumber = workgroup_id.z % uniforms.num_heads; + let m = global_id.y; + let n = global_id.x; + + let inputOffset = batchIndex * (uniforms.M * uniforms.K) + m * uniforms.K; + let biasOffsetQ = headNumber * uniforms.head_size; + let biasOffsetK = uniforms.hidden_size + biasOffsetQ; + let biasOffsetV = uniforms.hidden_size + biasOffsetK; + + var valueQ = ${g}(0); + var valueK = ${g}(0); + var valueV = ${g}(0); + for (var w: u32 = 0u; w < uniforms.K; w += TILE_SIZE) { + if (m < uniforms.M && w + local_id.x < uniforms.K) { + tileInput[TILE_SIZE * local_id.y + local_id.x] = input[inputOffset + w + local_id.x]; + } + if (n < uniforms.N && w + local_id.y < uniforms.K) { + let offset = n + (w + local_id.y) * uniforms.ldb; + tileWeightQ[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetQ + offset]; + tileWeightK[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetK + offset]; + tileWeightV[TILE_SIZE * local_id.y + local_id.x] = weight[biasOffsetV + offset]; + } + workgroupBarrier(); + for (var k: u32 = 0u; k({outputs:[{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0},{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0},{dims:t,dataType:e.inputs[0].dataType,gpuDataType:0}],dispatchGroup:a,programUniforms:u}),getShaderSource:p},{inputs:l,outputs:[-1,-1,-1]})},Rp=(e,r)=>{let t=Op(e.inputs,r),[s,o,n]=Bp(e,t);return _o(e,s,o,n,e.inputs[4],void 0,void 0,void 0,e.inputs[5],t)}}),jp,Np,Vp,Up,Pv=Be(()=>{ts(),ut(),mt(),Xt(),ft(),jp=(e,r)=>{if(!e||e.length!==5)throw new Error("BatchNormalization requires 5 inputs");let t=(s,o,n)=>{let i=o.length;if(i!==s.length)throw new Error(`${n}: num dimensions != ${i}`);o.forEach((a,l)=>{if(a!==s[l])throw new Error(`${n}: dim[${l}] do not match`)})};if(e[0].dims.length>1){let s=r.format==="NHWC"?r.spatial?e[0].dims.slice(-1):e[0].dims.slice(-1).concat(e[0].dims.slice(1,e[0].dims.length-1)):e[0].dims.slice(1,r.spatial?2:void 0);t(e[1].dims,s,"Invalid input scale"),t(e[2].dims,s,"Invalid input B"),t(e[3].dims,s,"Invalid input mean"),t(e[4].dims,s,"Invalid input var")}else t(e[1].dims,[1],"Invalid input scale"),t(e[2].dims,[1],"Invalid input B"),t(e[3].dims,[1],"Invalid input mean"),t(e[4].dims,[1],"Invalid input var")},Np=(e,r)=>{let{epsilon:t,spatial:s,format:o}=r,n=e[0].dims,i=s?Kt(n[n.length-1]):1,a=o==="NHWC"&&n.length>1?i:1,l=Me.size(n)/i,u=s,p=u?n.length:n,d=Pe("x",e[0].dataType,e[0].dims,i),c=Pe("scale",e[1].dataType,e[1].dims,a),f=Pe("bias",e[2].dataType,e[2].dims,a),_=Pe("inputMean",e[3].dataType,e[3].dims,a),T=Pe("inputVar",e[4].dataType,e[4].dims,a),k=Ye("y",e[0].dataType,p,i),w=()=>{let S="";if(s)S=`let cOffset = ${n.length===1?"0u":o==="NHWC"?`outputIndices[${n.length-1}] / ${i}`:"outputIndices[1]"};`;else if(o==="NCHW")S=` + ${k.indicesSet("outputIndices","0","0")} + let cOffset = ${k.indicesToOffset("outputIndices")};`;else{S=`var cIndices = ${c.type.indices}(0); + cIndices[0] = outputIndices[${n.length-1}];`;for(let E=1;E` + const epsilon = ${t}; + ${S.registerUniform("outputSize","u32").declareVariables(d,c,f,_,T,k)} + ${S.mainStart()} + ${S.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + var outputIndices = ${k.offsetToIndices(`global_idx * ${i}`)}; + ${w()} + let scale = ${c.getByOffset("cOffset")}; + let bias = ${f.getByOffset("cOffset")}; + let inputMean = ${_.getByOffset("cOffset")}; + let inputVar = ${T.getByOffset("cOffset")}; + let x = ${d.getByOffset("global_idx")}; + let value = (x - inputMean) * inverseSqrt(inputVar + epsilon) * scale + bias; + ${k.setByOffset("global_idx","value")} + }`;return{name:"BatchNormalization",shaderCache:{hint:`${r.epsilon}_${r.format}_${s}_${i}`,inputDependencies:u?["rank","type","type","type","type"]:void 0},getShaderSource:g,getRunData:()=>({outputs:[{dims:e[0].dims,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:u?[{type:12,data:l},...st(n)]:[{type:12,data:l}]})}},Vp=e=>St(e),Up=(e,r)=>{let{inputs:t,outputCount:s}=e,o=Vp({...r,outputCount:s});if(Bt.webgpu.validateInputContent&&jp(t,o),r.trainingMode)throw new Error("BatchNormalization trainingMode is not supported yet.");e.compute(Np(t,o))}}),Wp,Gp,Kp,Cv=Be(()=>{mt(),ft(),Wp=e=>{if(e[0].dims.length!==3)throw new Error("input should have 3 dimensions");if(![320,640,1280].includes(e[0].dims[2]))throw new Error("number of channels should be 320, 640 or 1280");if(e[1].dims.length!==1)throw new Error("bias is expected to have 1 dimensions");if(e[0].dims[2]!==e[1].dims[0])throw new Error("last dimension of input and bias are not the same")},Gp=e=>{let r=e[0].dims,t=e[0].dims[2],s=Me.size(r)/4,o=e[0].dataType,n=Pe("input",o,r,4),i=Pe("bias",o,[t],4),a=Pe("residual",o,r,4),l=Ye("output",o,r,4);return{name:"BiasAdd",getRunData:()=>({outputs:[{dims:r,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(s/64)}}),getShaderSource:u=>` + const channels = ${t}u / 4; + ${u.declareVariables(n,i,a,l)} + + ${u.mainStart()} + ${u.guardAgainstOutOfBoundsWorkgroupSizes(s)} + let value = ${n.getByOffset("global_idx")} + + ${i.getByOffset("global_idx % channels")} + ${a.getByOffset("global_idx")}; + ${l.setByOffset("global_idx","value")} + }`}},Kp=e=>{Wp(e.inputs),e.compute(Gp(e.inputs))}}),Hp,Et,qp,Xp,Qp,Jp,Yp,Zp,eh,th,rh,sh,nh,oh,ih,ah,fo,lh,pi,uh,dh,ch,ph,hh,mh,_h,fh,gh,wh,Mh,bh,yh,vh,xh,Th,pl,Eh,hl,ml,Ph,Ch,Sh,$h,kh,Ih,_l=Be(()=>{ut(),mt(),Xt(),ft(),Hp=(e,r,t,s,o,n,i)=>{let a=Math.ceil(r/4),l="";typeof o=="string"?l=`${o}(a)`:l=o("a");let u=Pe("inputData",t,[a],4),p=Ye("outputData",s,[a],4),d=[{name:"vec_size",type:"u32"}];return i&&d.push(...i),` + ${e.registerUniforms(d).declareVariables(u,p)} + + ${n??""} + + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} + + let a = ${u.getByOffset("global_idx")}; + ${p.setByOffset("global_idx",l)} + }`},Et=(e,r,t,s,o,n=e.dataType,i,a)=>{let l=[{type:12,data:Math.ceil(Me.size(e.dims)/4)}];return i&&l.push(...i),{name:r,shaderCache:{hint:o,inputDependencies:["type"]},getShaderSource:u=>Hp(u,Me.size(e.dims),e.dataType,n,t,s,a),getRunData:u=>({outputs:[{dims:e.dims,dataType:n}],dispatchGroup:{x:Math.ceil(Me.size(u[0].dims)/64/4)},programUniforms:l})}},qp=e=>{e.compute(Et(e.inputs[0],"Abs","abs"))},Xp=e=>{e.compute(Et(e.inputs[0],"Acos","acos"))},Qp=e=>{e.compute(Et(e.inputs[0],"Acosh","acosh"))},Jp=e=>{e.compute(Et(e.inputs[0],"Asin","asin"))},Yp=e=>{e.compute(Et(e.inputs[0],"Asinh","asinh"))},Zp=e=>{e.compute(Et(e.inputs[0],"Atan","atan"))},eh=e=>{e.compute(Et(e.inputs[0],"Atanh","atanh"))},th=e=>St(e),rh=(e,r)=>{let t;switch(r.to){case 10:t="vec4";break;case 1:t="vec4";break;case 12:t="vec4";break;case 6:t="vec4";break;case 9:t="vec4";break;default:throw new RangeError(`not supported type (specified in attribute 'to' from 'Cast' operator): ${r.to}`)}e.compute(Et(e.inputs[0],"Cast",t,void 0,r.cacheKey,r.to))},sh=e=>{let r,t,s=e.length>=2&&e[1].data!==0,o=e.length>=3&&e[2].data!==0;switch(e[0].dataType){case 1:r=s?e[1].getFloat32Array()[0]:-34028234663852886e22,t=o?e[2].getFloat32Array()[0]:34028234663852886e22;break;case 10:r=s?e[1].getUint16Array()[0]:64511,t=o?e[2].getUint16Array()[0]:31743;break;default:throw new Error("Unsupport data type")}return St({min:r,max:t})},nh=(e,r)=>{let t=r||sh(e.inputs),s=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"Clip",o=>`clamp(${o}, vec4<${s}>(uniforms.min), vec4<${s}>(uniforms.max))`,void 0,t.cacheKey,void 0,[{type:e.inputs[0].dataType,data:t.min},{type:e.inputs[0].dataType,data:t.max}],[{name:"min",type:s},{name:"max",type:s}]),{inputs:[0]})},oh=e=>{e.compute(Et(e.inputs[0],"Ceil","ceil"))},ih=e=>{e.compute(Et(e.inputs[0],"Cos","cos"))},ah=e=>{e.compute(Et(e.inputs[0],"Cosh","cosh"))},fo=e=>St(e),lh=(e,r)=>{let t=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"Elu",s=>`elu_vf32(${s})`,` + const elu_alpha_ = ${t}(${r.alpha}); + + fn elu_f32(a: ${t}) -> ${t} { + return select((exp(a) - 1.0) * elu_alpha_, a, a >= 0.0); + } + + fn elu_vf32(v: vec4<${t}>) -> vec4<${t}> { + return vec4(elu_f32(v.x), elu_f32(v.y), elu_f32(v.z), elu_f32(v.w)); + }`,r.cacheKey))},pi=(e="f32")=>` +const r0: ${e} = 0.3275911; +const r1: ${e} = 0.254829592; +const r2: ${e} = -0.284496736; +const r3: ${e} = 1.421413741; +const r4: ${e} = -1.453152027; +const r5: ${e} = 1.061405429; + +fn erf_vf32(v: vec4<${e}>) -> vec4<${e}> { + let absv = abs(v); + let x = 1.0 / (1.0 + r0 * absv); + return sign(v) * (1.0 - ((((r5 * x + r4) * x + r3) * x + r2) * x + r1) * x * exp(-absv * absv)); +}`,uh=e=>{let r=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"Erf",t=>`erf_vf32(${t})`,pi(r)))},dh=e=>{e.compute(Et(e.inputs[0],"Exp","exp"))},ch=e=>{e.compute(Et(e.inputs[0],"Floor","floor"))},ph=e=>{let r=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"Gelu",t=>`0.5 * ${t} * (1.0 + erf_vf32(${t} * 0.7071067811865475))`,pi(r)))},hh=(e,r)=>{let t=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"LeakyRelu",s=>`select(leaky_relu_alpha_ * ${s}, ${s}, ${s} >= vec4<${t}>(0.0))`,`const leaky_relu_alpha_ = ${t}(${r.alpha});`,r.cacheKey))},mh=e=>{e.compute(Et(e.inputs[0],"Not",r=>`!${r}`))},_h=e=>{e.compute(Et(e.inputs[0],"Neg",r=>`-${r}`))},fh=e=>{e.compute(Et(e.inputs[0],"Reciprocal",r=>`1.0/${r}`))},gh=e=>{let r=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"Relu",t=>`select(vec4<${r}>(0.0), ${t}, ${t} > vec4<${r}>(0.0))`))},wh=e=>{e.compute(Et(e.inputs[0],"Sigmoid",r=>`(1.0 / (1.0 + exp(-${r})))`))},Mh=e=>St(e),bh=(e,r)=>{let t=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"HardSigmoid",s=>`max(vec4<${t}>(0.0), min(vec4<${t}>(1.0), ${r.alpha} * ${s} + vec4<${t}>(${r.beta})))`,void 0,r.cacheKey))},yh=e=>{e.compute(Et(e.inputs[0],"Sin","sin"))},vh=e=>{e.compute(Et(e.inputs[0],"Sinh","sinh"))},xh=e=>{e.compute(Et(e.inputs[0],"Sqrt","sqrt"))},Th=e=>{e.compute(Et(e.inputs[0],"Tan","tan"))},pl=e=>`sign(${e}) * (1 - exp(-2 * abs(${e}))) / (1 + exp(-2 * abs(${e})))`,Eh=e=>{e.compute(Et(e.inputs[0],"Tanh",pl))},hl=(e="f32")=>` +const fast_gelu_a: ${e} = 0.5; +const fast_gelu_b: ${e} = 0.7978845608028654; +const fast_gelu_c: ${e} = 0.035677408136300125; + +fn tanh_v(v: vec4<${e}>) -> vec4<${e}> { + return ${pl("v")}; +} +`,ml=e=>`(fast_gelu_a + fast_gelu_a * tanh_v(${e} * (fast_gelu_c * ${e} * ${e} + fast_gelu_b))) * ${e}`,Ph=e=>{let r=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"FastGelu",ml,hl(r),void 0,e.inputs[0].dataType))},Ch=(e,r)=>{let t=yr(e.inputs[0].dataType);return e.compute(Et(e.inputs[0],"ThresholdedRelu",s=>`select(vec4<${t}>(0.0), ${s}, ${s} > thresholded_relu_alpha_)`,`const thresholded_relu_alpha_ = vec4<${t}>(${r.alpha});`,r.cacheKey)),0},Sh=e=>{e.compute(Et(e.inputs[0],"Log","log"))},$h=(e,r)=>` +const alpha = vec4<${e}>(${r}); +const one = ${e}(1.0); +const zero = ${e}(0.0); + +fn quick_gelu_impl(x: vec4<${e}>) -> vec4<${e}> { + let v = x *alpha; + var x1 : vec4<${e}>; + for (var i = 0; i < 4; i = i + 1) { + if (v[i] >= zero) { + x1[i] = one / (one + exp(-v[i])); + } else { + x1[i] = one - one / (one + exp(v[i])); + } + } + return x * x1; +} +`,kh=e=>`quick_gelu_impl(${e})`,Ih=(e,r)=>{let t=yr(e.inputs[0].dataType);e.compute(Et(e.inputs[0],"QuickGelu",kh,$h(t,r.alpha),r.cacheKey,e.inputs[0].dataType))}}),Ah,Fh,Oh,Sv=Be(()=>{mt(),ft(),_l(),Ah=e=>{if(e[0].dims.length!==3)throw new Error("input should have 3 dimensions");if(![2560,5120,10240].includes(e[0].dims[2]))throw new Error("hidden state should be 2560, 5120 or 10240");if(e[1].dims.length!==1)throw new Error("bias is expected to have 1 dimensions");if(e[0].dims[2]!==e[1].dims[0])throw new Error("last dimension of input and bias are not the same")},Fh=e=>{let r=e[0].dims.slice();r[2]=r[2]/2;let t=Pe("input",e[0].dataType,e[0].dims,4),s=Pe("bias",e[0].dataType,[e[0].dims[2]],4),o=Ye("output",e[0].dataType,r,4),n=Me.size(r)/4,i=lr(e[0].dataType);return{name:"BiasSplitGelu",getRunData:()=>({outputs:[{dims:r,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(n/64)}}),getShaderSource:a=>` + const M_SQRT2 = sqrt(2.0); + const halfChannels = ${e[0].dims[2]/4/2}u; + + ${a.declareVariables(t,s,o)} + + ${pi(i)} + + ${a.mainStart()} + ${a.guardAgainstOutOfBoundsWorkgroupSizes(n)} + let biasIdx = global_idx % halfChannels; + let batchIndex = global_idx / halfChannels; + let inputOffset = biasIdx + batchIndex * halfChannels * 2; + let valueLeft = input[inputOffset] + bias[biasIdx]; + let valueRight = input[inputOffset + halfChannels] + bias[biasIdx + halfChannels]; + let geluRight = valueRight * 0.5 * (erf_vf32(valueRight / M_SQRT2) + 1); + + ${o.setByOffset("global_idx","valueLeft * geluRight")} + }`}},Oh=e=>{Ah(e.inputs),e.compute(Fh(e.inputs))}}),Dh,Lh,as,zh,Bh,Rh,jh,Nh,Vh,Uh,Wh,Gh,Kh,$v=Be(()=>{ut(),mt(),ft(),Dh=(e,r,t,s,o,n,i,a,l,u,p,d)=>{let c,f;typeof a=="string"?c=f=(g,S)=>`${a}((${g}),(${S}))`:typeof a=="function"?c=f=a:(c=a.scalar,f=a.vector);let _=Ye("outputData",p,s.length,4),T=Pe("aData",l,r.length,4),k=Pe("bData",u,t.length,4),w;if(o)if(n){let g=Me.size(r)===1,S=Me.size(t)===1,E=r.length>0&&r[r.length-1]%4===0,y=t.length>0&&t[t.length-1]%4===0;g||S?w=_.setByOffset("global_idx",f(g?`${T.type.value}(${T.getByOffset("0")}.x)`:T.getByOffset("global_idx"),S?`${k.type.value}(${k.getByOffset("0")}.x)`:k.getByOffset("global_idx"))):w=` + let outputIndices = ${_.offsetToIndices("global_idx * 4u")}; + let offsetA = ${T.broadcastedIndicesToOffset("outputIndices",_)}; + let offsetB = ${k.broadcastedIndicesToOffset("outputIndices",_)}; + ${_.setByOffset("global_idx",f(i||E?T.getByOffset("offsetA / 4u"):`${T.type.value}(${T.getByOffset("offsetA / 4u")}[offsetA % 4u])`,i||y?k.getByOffset("offsetB / 4u"):`${k.type.value}(${k.getByOffset("offsetB / 4u")}[offsetB % 4u])`))} + `}else w=_.setByOffset("global_idx",f(T.getByOffset("global_idx"),k.getByOffset("global_idx")));else{if(!n)throw new Error("no necessary to use scalar implementation for element-wise binary op implementation.");let g=(S,E,y="")=>{let M=`aData[indexA${E}][componentA${E}]`,v=`bData[indexB${E}][componentB${E}]`;return` + let outputIndices${E} = ${_.offsetToIndices(`global_idx * 4u + ${E}u`)}; + let offsetA${E} = ${T.broadcastedIndicesToOffset(`outputIndices${E}`,_)}; + let offsetB${E} = ${k.broadcastedIndicesToOffset(`outputIndices${E}`,_)}; + let indexA${E} = offsetA${E} / 4u; + let indexB${E} = offsetB${E} / 4u; + let componentA${E} = offsetA${E} % 4u; + let componentB${E} = offsetB${E} % 4u; + ${S}[${E}] = ${y}(${c(M,v)}); + `};p===9?w=` + var data = vec4(0); + ${g("data",0,"u32")} + ${g("data",1,"u32")} + ${g("data",2,"u32")} + ${g("data",3,"u32")} + outputData[global_idx] = dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(data));`:w=` + ${g("outputData[global_idx]",0)} + ${g("outputData[global_idx]",1)} + ${g("outputData[global_idx]",2)} + ${g("outputData[global_idx]",3)} + `}return` + ${e.registerUniform("vec_size","u32").declareVariables(T,k,_)} + + ${d??""} + + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} + ${w} + }`},Lh=(e,r,t,s,o,n,i=t.dataType)=>{let a=t.dims.map(T=>Number(T)??1),l=s.dims.map(T=>Number(T)??1),u=!Me.areEqual(a,l),p=a,d=Me.size(a),c=!1,f=!1,_=[u];if(u){let T=Nn.calcShape(a,l,!1);if(!T)throw new Error("Can't perform binary op on the given tensors");p=T.slice(),d=Me.size(p);let k=Me.size(a)===1,w=Me.size(l)===1,g=a.length>0&&a[a.length-1]%4===0,S=l.length>0&&l[l.length-1]%4===0;_.push(k),_.push(w),_.push(g),_.push(S);let E=1;for(let y=1;yT.toString()).join("_"),inputDependencies:["rank","rank"]},getShaderSource:T=>Dh(T,a,l,p,c,u,f,o,t.dataType,s.dataType,i,n),getRunData:()=>({outputs:[{dims:p,dataType:i}],dispatchGroup:{x:Math.ceil(d/64/4)},programUniforms:[{type:12,data:Math.ceil(Me.size(p)/4)},...st(a,l,p)]})}},as=(e,r,t,s,o,n)=>{e.compute(Lh(r,o??"",e.inputs[0],e.inputs[1],t,s,n))},zh=e=>{as(e,"Add",(r,t)=>`${r}+${t}`)},Bh=e=>{as(e,"Div",(r,t)=>`${r}/${t}`)},Rh=e=>{as(e,"Equal",{scalar:(r,t)=>`u32(${r}==${t})`,vector:(r,t)=>`vec4(${r}==${t})`},void 0,void 0,9)},jh=e=>{as(e,"Mul",(r,t)=>`${r}*${t}`)},Nh=e=>{let r=Pe("input",e.inputs[0].dataType,e.inputs[0].dims).type.value;as(e,"Pow",{scalar:(t,s)=>`pow_custom(${t},${s})`,vector:(t,s)=>`pow_vector_custom(${t},${s})`},` + fn pow_custom(a : ${r}, b : ${r}) -> ${r} { + if (b == ${r}(0.0)) { + return ${r}(1.0); + } else if (a < ${r}(0.0) && f32(b) != floor(f32(b))) { + return ${r}(pow(f32(a), f32(b))); // NaN + } + return select(sign(a), ${r}(1.0), round(f32(abs(b) % ${r}(2.0))) != 1.0) * ${r}(${r==="i32"?"round":""}(pow(f32(abs(a)), f32(b)))); + } + fn pow_vector_custom(a : vec4<${r}>, b : vec4<${r}>) -> vec4<${r}> { + // TODO: implement vectorized pow + return vec4<${r}>(pow_custom(a.x, b.x), pow_custom(a.y, b.y), pow_custom(a.z, b.z), pow_custom(a.w, b.w)); + } + `)},Vh=e=>{as(e,"Sub",(r,t)=>`${r}-${t}`)},Uh=e=>{as(e,"Greater",{scalar:(r,t)=>`u32(${r}>${t})`,vector:(r,t)=>`vec4(${r}>${t})`},void 0,void 0,9)},Wh=e=>{as(e,"Less",{scalar:(r,t)=>`u32(${r}<${t})`,vector:(r,t)=>`vec4(${r}<${t})`},void 0,void 0,9)},Gh=e=>{as(e,"GreaterOrEqual",{scalar:(r,t)=>`u32(${r}>=${t})`,vector:(r,t)=>`vec4(${r}>=${t})`},void 0,void 0,9)},Kh=e=>{as(e,"LessOrEqual",{scalar:(r,t)=>`u32(${r}<=${t})`,vector:(r,t)=>`vec4(${r}<=${t})`},void 0,void 0,9)}}),Hh,qh,Xh,Qh,Jh,Yh,kv=Be(()=>{ut(),mt(),Xt(),ft(),Hh=(e,r)=>{if(!e||e.length<1)throw new Error("too few inputs");let t=0,s=e[t],o=s.dataType,n=s.dims.length;e.forEach((i,a)=>{if(a!==t){if(i.dataType!==o)throw new Error("input tensors should be one type");if(i.dims.length!==n)throw new Error("input tensors should have the same shape");i.dims.forEach((l,u)=>{if(u!==r&&l!==s.dims[u])throw new Error("non concat dimensions must match")})}})},qh=(e,r)=>` + fn calculateInputIndex(index: u32) -> u32 { + let sizeInConcatAxis = array(${r}); + for (var i: u32 = 0u; i < ${e}; i += 1u ) { + if (index < sizeInConcatAxis[i]) { + return i; + } + } + return ${e}u; + }`,Xh=(e,r)=>{let t=e.length,s=[];for(let o=0;o{let o=Me.size(t),n=new Array(e.length),i=new Array(e.length),a=0,l=[],u=[],p=[{type:12,data:o}];for(let T=0;T`uniforms.sizeInConcatAxis${T}`).join(","),_=T=>` + + ${(()=>{T.registerUniform("outputSize","u32");for(let k=0;k(${f}); + ${c} -= sizeInConcatAxis[inputIndex - 1u]; + } + + ${Xh(i,d)} + }`;return{name:"Concat",shaderCache:{hint:`${r}`,inputDependencies:l},getRunData:()=>({outputs:[{dims:t,dataType:s}],dispatchGroup:{x:Math.ceil(o/64)},programUniforms:p}),getShaderSource:_}},Jh=(e,r)=>{let t=e.inputs,s=t[0].dims,o=Me.normalizeAxis(r.axis,s.length);Hh(t,o);let n=s.slice();n[o]=t.reduce((a,l)=>a+(l.dims.length>o?l.dims[o]:0),0);let i=t.filter(a=>Me.size(a.dims)>0);e.compute(Qh(i,o,n,t[0].dataType),{inputs:i})},Yh=e=>St({axis:e.axis})}),rn,sn,nn,fl,on=Be(()=>{ut(),mt(),rn=(e,r,t="f32")=>{switch(e.activation){case"Relu":return`value = max(value, ${r}(0.0));`;case"Sigmoid":return`value = (${r}(1.0) / (${r}(1.0) + exp(-value)));`;case"Clip":return`value = clamp(value, ${r}(${t}(uniforms.clip_min)), ${r}(${t}(uniforms.clip_max)));`;case"HardSigmoid":return`value = max(${r}(0.0), min(${r}(1.0), ${t}(uniforms.alpha) * value + ${t}(uniforms.beta)));`;case"LeakyRelu":return`value = select(${t}(uniforms.alpha) * value, value, value >= ${r}(0.0));`;case"Tanh":return`let e2x = exp(-2.0 * abs(value)); + value = sign(value) * (1.0 - e2x) / (1.0 + e2x); + `;case"":return"";default:throw new Error(`Unsupported activation ${e.activation}`)}},sn=(e,r)=>{e.activation==="Clip"?r.push({type:1,data:e.clipMax},{type:1,data:e.clipMin}):e.activation==="HardSigmoid"?r.push({type:1,data:e.alpha},{type:1,data:e.beta}):e.activation==="LeakyRelu"&&r.push({type:1,data:e.alpha})},nn=(e,r)=>{e.activation==="Clip"?r.push({name:"clip_max",type:"f32"},{name:"clip_min",type:"f32"}):e.activation==="HardSigmoid"?r.push({name:"alpha",type:"f32"},{name:"beta",type:"f32"}):e.activation==="LeakyRelu"&&r.push({name:"alpha",type:"f32"})},fl=e=>{let r=(e==null?void 0:e.activation)||"";if(r==="HardSigmoid"){let[t,s]=(e==null?void 0:e.activation_params)||[.2,.5];return{activation:r,alpha:t,beta:s}}else if(r==="Clip"){let[t,s]=(e==null?void 0:e.activation_params)||[yc,vc];return{activation:r,clipMax:s,clipMin:t}}else if(r==="LeakyRelu"){let[t]=(e==null?void 0:e.activation_params)||[.01];return{activation:r,alpha:t}}return{activation:r}}}),_r,Zh,gl=Be(()=>{_r=(e,r)=>{switch(e){case 1:return r;case 2:return`vec2<${r}>`;case 3:return`vec3<${r}>`;case 4:return`vec4<${r}>`;default:throw new Error(`${e}-component is not supported.`)}},Zh=e=>` + ${e?"value = value + getBiasByOutputCoords(coords);":""} + `}),em,Iv=Be(()=>{em=e=>` +fn getIndexFromCoords4D(coords : vec4, shape : vec4) -> i32 { + return dot(coords, vec4( + shape.y * shape.z * shape.w, shape.z * shape.w, shape.w, 1)); +} +fn getOutputIndexFromCoords(coords : vec4) -> i32 { + return dot(coords, vec4( + i32(${e}.x), i32(${e}.y), i32(${e}.z), 1)); +} +`}),go,wl,Ml=Be(()=>{ut(),mt(),ft(),on(),go=(e,r,t,s,o)=>{let n=s-t;return` + ${Array.from({length:t}).map((i,a)=>` + if (${et(r.shape,a,r.rank)} != 1) { + ${r.indicesSet(e,a,et(o,a+n,s))} + } else { + ${r.indicesSet(e,a,0)} + }`).join("")} +`},wl=(e,r,t,s,o=!1,n)=>{let i=e[0].dims,a=e[1].dims,l=i[i.length-2],u=a[a.length-1],p=i[i.length-1],d=Kt(u),c=Kt(p),f=Kt(l),_=Me.size(t)/d/f,T=e.length>2,k=s?s.slice(0,-2):t.slice(0,-2),w=[Me.size(k),l,u],g=[{type:12,data:_},{type:12,data:l},{type:12,data:u},{type:12,data:p}];sn(r,g),g.push(...st(k,i,a)),T&&g.push(...st(e[2].dims)),g.push(...st(w));let S=E=>{let y=ol("batch_dims",e[0].dataType,k.length),M=Pe("a",e[0].dataType,i.length,c),v=Pe("b",e[1].dataType,a.length,d),C=Ye("output",e[0].dataType,w.length,d),A=lr(C.type.tensor),B=rn(r,C.type.value,A),K=[M,v],G="";if(T){let H=o?d:1;K.push(Pe("bias",e[2].dataType,e[2].dims.length,H)),G=`${o?`value += bias[col / ${H}];`:`value += ${C.type.value}(bias[row + i]);`}`}let j=[{name:"output_size",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"}];nn(r,j);let ee=()=>{let H=`var a_data: ${M.type.value};`;for(let Z=0;Z; + for (var k: u32 = 0u; k < uniforms.K; k = k + ${c}) { + ${ee()} + } + for (var i = 0u; i < ${f}u; i++) { + var value = values[i]; + ${G} + ${B} + let cur_indices = ${C.type.indices}(batch, row + i, col); + let offset = ${C.indicesToOffset("cur_indices")}; + ${C.setByOffset(`offset / ${d}`,"value")}; + } + } + `};return{name:"MatMulNaive",shaderCache:{hint:`${r.activation};${d};${c};${f};${o}`,inputDependencies:T?["rank","rank","rank"]:["rank","rank"]},getRunData:()=>({outputs:[{dims:n?n(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(_/64)},programUniforms:g}),getShaderSource:S}}}),tm,rm,bl,yl,sm,vl,nm,hi,xl=Be(()=>{ut(),mt(),ft(),on(),Ml(),gl(),tm=(e,r)=>e?` + mm_Asub[inputRow][inputCol] = mm_readA(batch, + kStart + inputRow, + globalRowStart / innerElementSize + inputCol${r?", batchIndices":""}); + `:` + mm_Asub[inputRow][inputCol] = mm_readA(batch, + globalRow + innerRow, + kStart / innerElementSize + inputCol${r?", batchIndices":""}); + `,rm=(e,r)=>e?` + let ACached0 = mm_Asub[k * innerElementSize][localRow]; + let ACached1 = mm_Asub[k * innerElementSize + 1][localRow]; + let ACached2 = mm_Asub[k * innerElementSize + 2][localRow]; + ${r===3?"":"let ACached3 = mm_Asub[k * innerElementSize + 3][localRow];"} + for (var i = 0; i < rowPerThread; i = i + 1) { + acc[i] = BCached0 * ACached0[i] + acc[i]; + acc[i] = BCached1 * ACached1[i] + acc[i]; + acc[i] = BCached2 * ACached2[i] + acc[i]; + ${r===3?"":"acc[i] = BCached3 * ACached3[i] + acc[i];"} + }`:` + for (var i = 0; i < rowPerThread; i = i + 1) { + let ACached = mm_Asub[tileRow + i][k]; + acc[i] = BCached0 * ACached.x + acc[i]; + acc[i] = BCached1 * ACached.y + acc[i]; + acc[i] = BCached2 * ACached.z + acc[i]; + ${r===3?"":"acc[i] = BCached3 * ACached.w + acc[i];"} + }`,bl=(e,r,t="f32",s,o=!1,n=32,i=!1,a=32)=>{let l=r[1]*e[1],u=r[0]*e[0],p=o?l:n,d=o?n:l,c=p/r[0],f=n/r[1];if(!((o&&c===4&&e[1]===4||!o&&(c===3||c===4))&&p%r[0]===0&&n%r[1]===0&&e[0]===4))throw new Error(`If transposeA ${o} is true, innerElementSize ${c} and workPerThread[1] ${e[1]} must be 4. + Otherwise, innerElementSize ${c} must be 3 or 4. + tileAWidth ${p} must be divisible by workgroupSize[0]${r[0]}. tileInner ${n} must be divisible by workgroupSize[1] ${r[1]}. colPerThread ${e[0]} must be 4.`);return` +var mm_Asub: array, ${p/c}>, ${d}>; +var mm_Bsub: array, ${u/e[0]}>, ${n}>; + +const rowPerThread = ${e[1]}; +const colPerThread = ${e[0]}; +const innerElementSize = ${c}; +const tileInner = ${n}; + +@compute @workgroup_size(${r[0]}, ${r[1]}, ${r[2]}) +fn main(@builtin(local_invocation_id) localId : vec3, + @builtin(global_invocation_id) globalId : vec3, + @builtin(workgroup_id) workgroupId : vec3) { + let localRow = i32(localId.y); + let tileRow = localRow * rowPerThread; + let tileCol = i32(localId.x); + + let globalRow =i32(globalId.y) * rowPerThread; + let globalCol = i32(globalId.x); + let batch = ${i?"0":"i32(globalId.z)"}; + ${s?`let batchIndices = ${s.offsetToIndices("u32(batch)")};`:""} + let globalRowStart = i32(workgroupId.y) * ${l}; + + let num_tiles = ${i?`${Math.ceil(a/n)}`:"(uniforms.dim_inner - 1) / tileInner + 1"}; + var kStart = ${i?`i32(globalId.z) * ${a}`:"0"}; + + var acc: array, rowPerThread>; + + // Loop over shared dimension. + let tileRowB = localRow * ${f}; + for (var t = 0; t < num_tiles; t = t + 1) { + // Load one tile of A into local memory. + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + let inputRow = tileRow + innerRow; + let inputCol = tileCol; + ${tm(o,s)} + } + + // Load one tile of B into local memory. + for (var innerRow = 0; innerRow < ${f}; innerRow = innerRow + 1) { + let inputRow = tileRowB + innerRow; + let inputCol = tileCol; + mm_Bsub[inputRow][inputCol] = mm_readB(batch, kStart + inputRow, globalCol${s?", batchIndices":""}); + } + kStart = kStart + tileInner; + workgroupBarrier(); + + // Compute acc values for a single thread. + for (var k = 0; k < tileInner / innerElementSize; k = k + 1) { + let BCached0 = mm_Bsub[k * innerElementSize][tileCol]; + let BCached1 = mm_Bsub[k * innerElementSize + 1][tileCol]; + let BCached2 = mm_Bsub[k * innerElementSize + 2][tileCol]; + ${c===3?"":"let BCached3 = mm_Bsub[k * innerElementSize + 3][tileCol];"} + + ${rm(o,c)} + } + + workgroupBarrier(); + } + + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + mm_write(batch, globalRow + innerRow, globalCol, acc[innerRow]); + } +}`},yl=(e,r)=>e?` + mm_Asub[inputRow][inputCol] = mm_readA(batch, + kStart + inputRow, + globalRowStart + inputCol${r?", batchIndices":""}); + `:` + mm_Asub[inputRow][inputCol] = mm_readA(batch, + globalRowStart + inputRow, + kStart + inputCol${r?", batchIndices":""}); + `,sm=e=>e?"let ACached = mm_Asub[k][tileRow + innerRow];":"let ACached = mm_Asub[tileRow + innerRow][k];",vl=(e,r,t="f32",s,o=!1,n=32,i=!1,a=32,l=!1)=>{let u=e[1]*r[1],p=e[0]*r[0],d=o?u:n,c=o?n:u;if(!(c%r[1]===0&&d%r[0]===0&&n%r[1]===0))throw new Error(`tileAHight ${c} must be divisible by workgroupSize[1]${r[1]}, tileAWidth ${d} must be divisible by workgroupSize[0]${r[0]}, tileInner ${n} must be divisible by workgroupSize[1]${r[1]}`);let f=c/r[1],_=d/r[0],T=n/r[1],k=l?` + let localRow = i32(localId.y); + let localCol = i32(localId.x); + let globalRowStart = i32(workgroupId.y) * ${u}; + let globalColStart = i32(workgroupId.x) * ${p}; + + // Loop over shared dimension. + for (var t = 0; t < num_tiles; t = t + 1) { + // Load one tile of A into local memory. + for (var inputRow = localRow; inputRow < ${c}; inputRow = inputRow + ${r[1]}) { + for (var inputCol = localCol; inputCol < ${d}; inputCol = inputCol + ${r[0]}) { + ${yl(o,s)} + } + } + // Load one tile of B into local memory. + for (var inputRow = localRow; inputRow < ${n}; inputRow = inputRow + ${r[1]}) { + for (var inputCol = localCol; inputCol < ${p}; inputCol = inputCol + ${r[0]}) { + mm_Bsub[inputRow][inputCol] = mm_readB(batch, + kStart + inputRow, + globalColStart + inputCol${s?", batchIndices":""}); + } + } + kStart = kStart + tileInner; + workgroupBarrier(); + + // Compute acc values for a single thread. + var BCached : array<${t}, colPerThread>; + for (var k = 0; k < tileInner; k = k + 1) { + for (var inner = 0; inner < colPerThread; inner = inner + 1) { + BCached[inner] = mm_Bsub[k][localCol + inner * ${r[0]}]; + } + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + let ACached = ${o?`mm_Asub[k][localRow + innerRow * ${r[1]}];`:`mm_Asub[localRow + innerRow * ${r[1]}][k];`} + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + acc[innerRow][innerCol] = acc[innerRow][innerCol] + + ACached * BCached[innerCol]; + } + } + } + workgroupBarrier(); + } + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + let gRow = globalRowStart + localRow + innerRow * ${r[1]}; + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + let gCol = globalColStart + localCol + innerCol * ${r[0]}; + mm_write(batch, gRow, gCol, acc[innerRow][innerCol]); + } + } + `:` +let tileRow = i32(localId.y) * rowPerThread; +let tileCol = i32(localId.x) * colPerThread; + +let globalRow = i32(globalId.y) * rowPerThread; +let globalCol = i32(globalId.x) * colPerThread; +let globalRowStart = i32(workgroupId.y) * ${u}; + +let tileRowA = i32(localId.y) * ${f}; +let tileColA = i32(localId.x) * ${_}; +let tileRowB = i32(localId.y) * ${T}; +// Loop over shared dimension. +for (var t = 0; t < num_tiles; t = t + 1) { + // Load one tile of A into local memory. + for (var innerRow = 0; innerRow < ${f}; innerRow = innerRow + 1) { + for (var innerCol = 0; innerCol < ${_}; innerCol = innerCol + 1) { + let inputRow = tileRowA + innerRow; + let inputCol = tileColA + innerCol; + ${yl(o,s)} + } + } + + // Load one tile of B into local memory. + for (var innerRow = 0; innerRow < ${T}; innerRow = innerRow + 1) { + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + let inputRow = tileRowB + innerRow; + let inputCol = tileCol + innerCol; + mm_Bsub[inputRow][inputCol] = mm_readB(batch, + kStart + inputRow, + globalCol + innerCol${s?", batchIndices":""}); + } + } + kStart = kStart + tileInner; + workgroupBarrier(); + + // Compute acc values for a single thread. + var BCached : array<${t}, colPerThread>; + for (var k = 0; k < tileInner; k = k + 1) { + for (var inner = 0; inner < colPerThread; inner = inner + 1) { + BCached[inner] = mm_Bsub[k][tileCol + inner]; + } + + for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + ${sm(o)} + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + acc[innerRow][innerCol] = acc[innerRow][innerCol] + ACached * BCached[innerCol]; + } + } + } + + workgroupBarrier(); +} + +for (var innerRow = 0; innerRow < rowPerThread; innerRow = innerRow + 1) { + for (var innerCol = 0; innerCol < colPerThread; innerCol = innerCol + 1) { + mm_write(batch, globalRow + innerRow, globalCol + innerCol, + acc[innerRow][innerCol]); + } +} +`;return` + var mm_Asub : array, ${c}>; + var mm_Bsub : array, ${n}>; + const rowPerThread = ${e[1]}; + const colPerThread = ${e[0]}; + const tileInner = ${n}; + +@compute @workgroup_size(${r[0]}, ${r[1]}, ${r[2]}) +fn main(@builtin(local_invocation_id) localId : vec3, + @builtin(global_invocation_id) globalId : vec3, + @builtin(workgroup_id) workgroupId : vec3) { + let batch = ${i?"0":"i32(globalId.z)"}; + ${s?`let batchIndices = ${s.offsetToIndices("u32(batch)")};`:""} + let num_tiles = ${i?`${Math.ceil(a/n)}`:"(uniforms.dim_inner - 1) / tileInner + 1"}; + var kStart = ${i?`i32(globalId.z) * ${a}`:"0"}; + + var acc : array, rowPerThread>; + ${k} + } +`},nm=(e,r,t,s,o=!1)=>{let[n,i,a,l]=s,u=lr(s[0].type.tensor);return` + fn mm_readA(batch: i32, row: i32, colIn: i32, batchIndices: ${n.type.indices}) -> ${_r(e,u)} { + var value = ${_r(e,u)}(0.0); + let col = colIn * ${e}; + if(row < uniforms.dim_a_outer && col < uniforms.dim_inner) + { + var aIndices: ${i.type.indices}; + ${go("aIndices",i,i.rank-2,n.rank,"batchIndices")} + ${i.indicesSet("aIndices",i.rank-2,"u32(row)")} + ${i.indicesSet("aIndices",i.rank-1,"u32(colIn)")} + value = ${i.getByIndices("aIndices")}; + } + return value; + } + + fn mm_readB(batch: i32, row: i32, colIn: i32, batchIndices: ${n.type.indices}) -> ${_r(e,u)} { + var value = ${_r(e,u)}(0.0); + let col = colIn * ${e}; + if(row < uniforms.dim_inner && col < uniforms.dim_b_outer) + { + var bIndices: ${a.type.indices}; + ${go("bIndices",a,a.rank-2,n.rank,"batchIndices")} + ${a.indicesSet("bIndices",a.rank-2,"u32(row)")} + ${a.indicesSet("bIndices",a.rank-1,"u32(colIn)")} + value = ${a.getByIndices("bIndices")}; + } + return value; + } + + fn mm_write(batch: i32, row: i32, colIn: i32, valueIn: ${_r(e,u)}) { + let col = colIn * ${e}; + if (row < uniforms.dim_a_outer && col < uniforms.dim_b_outer) { + var value = valueIn; + let coords = vec3(batch, row, colIn); + ${r?`value = value + ${o?"bias[colIn]":`${_r(e,u)}(bias[row])`};`:""} + ${t} + ${l.setByIndices("vec3(coords)","value")} + } + } + `},hi=(e,r,t,s,o=!1,n)=>{let i=e[0].dims,a=e[1].dims,l=i.slice(0,-2),u=a.slice(0,-2),p=s?s.slice(0,-2):t.slice(0,-2),d=Me.size(p),c=i[i.length-2],f=i[i.length-1],_=a[a.length-1],T=f%4===0&&_%4===0,k=c<=8?[4,1,1]:[4,4,1],w=[8,8,1],g=[Math.ceil(_/w[0]/k[0]),Math.ceil(c/w[1]/k[1]),Math.ceil(d/w[2]/k[2])],S=T?4:1,E=[...l,c,f/S],y=E.length,M=[...u,f,_/S],v=M.length,C=[d,c,_/S],A=[{type:6,data:c},{type:6,data:_},{type:6,data:f}];sn(r,A),A.push(...st(p,E,M));let B=["rank","rank"],K=e.length>2;K&&(A.push(...st(e[2].dims)),B.push("rank")),A.push(...st(C));let G=j=>{let ee=p.length,H=ol("batchDims",e[0].dataType,ee,1),Z=lr(e[0].dataType),X=Pe("a",e[0].dataType,y,S),oe=Pe("b",e[1].dataType,v,S),me=Ye("result",e[0].dataType,C.length,S),ae=[X,oe];if(K){let _e=o?S:1;ae.push(Pe("bias",e[2].dataType,e[2].dims.length,_e))}let V=[{name:"dim_a_outer",type:"i32"},{name:"dim_b_outer",type:"i32"},{name:"dim_inner",type:"i32"}];nn(r,V);let F=lr(me.type.tensor),W=rn(r,me.type.value,F),re=nm(S,K,W,[H,X,oe,me],o);return` + ${j.registerUniforms(V).registerInternalVariables(H).declareVariables(...ae,me)} + ${re} + ${T?bl(k,w,Z,H):vl(k,w,Z,H)} + `};return{name:"MatMul",shaderCache:{hint:`${k};${r.activation};${T};${o}`,inputDependencies:B},getRunData:()=>({outputs:[{dims:n?n(t):t,dataType:e[0].dataType}],dispatchGroup:{x:g[0],y:g[1],z:g[2]},programUniforms:A}),getShaderSource:G}}}),om,im,Av=Be(()=>{ut(),Es(),ft(),on(),gl(),Iv(),xl(),om=(e,r,t,s,o=!1,n,i=4,a=4,l=4,u="f32")=>{let p=A=>{switch(A){case 1:return"resData = x[xIndex];";case 3:return`resData = vec3<${u}>(x[xIndex], x[xIndex + 1], x[xIndex + 2]);`;case 4:return"resData = x[xIndex / 4];";default:throw new Error(`innerElementSize ${A} is not supported.`)}},d=A=>{switch(A){case 1:return"return w[row * i32(uniforms.w_shape[3]) + colIn];";case 4:return"return w[row * i32(uniforms.w_shape[3]) / 4 + colIn];";default:throw new Error(`innerElementSize ${A} is not supported.`)}},c=e?` + let coord = vec4(batch, xRow, xCol, xCh); + `:` + let coord = vec4(batch, xCh, xRow, xCol); + `,f=e?` + let coords = vec4( + batch, + row / outWidth, + row % outWidth, + col); + `:` + let coords = vec4( + batch, + row, + col / outWidth, + col % outWidth); + `,_=e?"i32(uniforms.x_shape[1])":"i32(uniforms.x_shape[2])",T=e?"i32(uniforms.x_shape[2])":"i32(uniforms.x_shape[3])",k=e?"row":"col",w=e?"col":"row",g=` + let inChannels = i32(uniforms.w_shape[2]); + let outWidth = ${e?"i32(uniforms.result_shape[2])":"i32(uniforms.result_shape[3])"}; + let outRow = ${k} / outWidth; + let outCol = ${k} % outWidth; + + let WRow = ${w} / (i32(uniforms.w_shape[1]) * inChannels); + let WCol = ${w} / inChannels % i32(uniforms.w_shape[1]); + let xRow = outRow * uniforms.stride[0] + uniforms.dilation[0] * WRow - uniforms.pad[0]; + let xCol = outCol * uniforms.stride[1] + uniforms.dilation[1] * WCol - uniforms.pad[1]; + let xCh = ${w} % inChannels; + var resData = ${_r(i,u)}(0.0); + // The bounds checking is always needed since we use it to pad zero for + // the 'same' padding type. + if (xRow >= 0 && xRow < ${_} && xCol >= 0 && xCol < ${T}) { + ${c} + let xIndex = getIndexFromCoords4D(coord, vec4(uniforms.x_shape)); + ${p(i)} + } + return resData;`,S=e?r&&s?` + let col = colIn * ${i}; + ${g}`:` + let col = colIn * ${i}; + if (row < uniforms.dim_a_outer && col < uniforms.dim_inner) { + ${g} + } + return ${_r(i,u)}(0.0);`:s&&t?` + let col = colIn * ${i}; + ${g}`:` + let col = colIn * ${i}; + if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) { + ${g} + } + return ${_r(i,u)}(0.0);`,E=e?s&&t?d(a):` + let col = colIn * ${a}; + if (row < uniforms.dim_inner && col < uniforms.dim_b_outer) { + ${d(a)} + } + return ${_r(a,u)}(0.0);`:` + let col = colIn * ${a}; + if (row < uniforms.dim_inner && col < uniforms.dim_a_outer) { + ${d(a)} + } + return ${_r(a,u)}(0.0);`,y=_r(l,u),M=_r(e?i:a,u),v=_r(e?a:i,u),C=rn(n,y,u);return` + fn mm_readA(batch: i32, row : i32, colIn : i32) -> ${M} { + ${e?S:E} + } + + fn mm_readB(batch: i32, row : i32, colIn : i32) -> ${v} { + ${e?E:S} + } + + fn mm_write(batch: i32, row : i32, colIn : i32, valueIn : ${y}) { + let col = colIn * ${l}; + if (row < uniforms.dim_a_outer && col < uniforms.dim_b_outer) + { + var value = valueIn; + let outWidth = ${e?"i32(uniforms.result_shape[2])":"i32(uniforms.result_shape[3])"}; + ${f} + ${Zh(o)} + ${C} + setOutputAtCoords(coords[0], coords[1], coords[2], coords[3], value); + } + }`},im=(e,r,t,s,o,n,i,a,l)=>{let u=r.format==="NHWC",p=u?e[0].dims[3]:e[0].dims[1],d=t[0],c=u?t[2]:t[3],f=u?t[1]:t[2],_=u?t[3]:t[1],T=u&&(p%4===0||p%3===0)&&_%4===0,k=u?_:c*f,w=u?c*f:_,g=[8,8,1],S=s<=8?[4,1,1]:[4,4,1],E=[Math.ceil(k/g[0]/S[0]),Math.ceil(w/g[1]/S[1]),Math.ceil(d/g[2]/S[2])];vt("verbose",()=>`[conv2d_mm_webgpu] dispatch = ${E}`);let y=T?u&&p%4!==0?3:4:1,M=g[1]*S[1],v=g[0]*S[0],C=Math.max(g[0]*y,g[1]),A=s%M===0,B=o%v===0,K=n%C===0,G=T?[y,4,4]:[1,1,1],j=[{type:6,data:s},{type:6,data:o},{type:6,data:n},{type:6,data:[r.pads[0],r.pads[1]]},{type:6,data:r.strides},{type:6,data:r.dilations}];sn(r,j),j.push(...st(e[0].dims,e[1].dims));let ee=["rank","rank"];i&&(j.push(...st(e[2].dims)),ee.push("rank")),j.push(...st(t));let H=Z=>{let X=[{name:"dim_a_outer",type:"i32"},{name:"dim_b_outer",type:"i32"},{name:"dim_inner",type:"i32"},{name:"pad",type:"i32",length:2},{name:"stride",type:"i32",length:2},{name:"dilation",type:"i32",length:2}];nn(r,X);let oe=T?4:1,me=lr(e[0].dataType),ae=` + fn setOutputAtIndex(flatIndex : i32, value : ${T?`vec4<${me}>`:me}) { + result[flatIndex] = ${T?`vec4<${me}>`:me}(value); + } + fn setOutputAtCoords(d0 : i32, d1 : i32, d2 : i32, d3 : i32, value : ${T?`vec4<${me}>`:me}) { + let flatIndex = getOutputIndexFromCoords(vec4(d0, d1, d2, d3)); + setOutputAtIndex(flatIndex ${T?"/ 4":""}, value); + }`,V=Pe("x",e[0].dataType,e[0].dims.length,y===3?1:y),F=Pe("w",e[1].dataType,e[1].dims.length,oe),W=[V,F],re=Ye("result",e[0].dataType,t.length,oe);if(i){let _e=Pe("bias",e[2].dataType,e[2].dims.length,oe);W.push(_e),ae+=` + fn getBiasByOutputCoords(coords : vec4) -> ${T?`vec4<${me}>`:me} { + return bias[coords.${u?"w":"y"}${T?"/ 4":""}]; + }`}return` + ${em("uniforms.result_strides")} + //struct Uniforms { xShape : vec4, wShape : vec4, outShape : vec4, + // outShapeStrides: vec3, filterDims : vec2, pad : vec2, stride : vec2, + // dilation : vec2, dimAOuter : i32, dimBOuter : i32, dimInner : i32 }; + ${Z.registerUniforms(X).declareVariables(...W,re)} + ${ae} + ${om(u,A,B,K,i,r,G[0],G[1],G[2],me)} + ${T?bl(S,g,me,void 0,!u,C):vl(S,g,me,void 0,!u,C,!1,void 0,a)}`};return{name:"Conv2DMatMul",shaderCache:{hint:`${r.cacheKey};${y};${T};${A};${B};${K};${M};${v};${C}`,inputDependencies:ee},getRunData:()=>({outputs:[{dims:l?l(t):t,dataType:e[0].dataType}],dispatchGroup:{x:E[0],y:E[1],z:E[2]},programUniforms:j}),getShaderSource:H}}}),am,Tl,wo,lm,El,um,dm,cm,Fv=Be(()=>{ut(),Es(),mt(),ft(),on(),gl(),am=e=>{let r=1;for(let t=0;ttypeof e=="number"?[e,e,e]:e,wo=(e,r)=>r<=1?e:e+(e-1)*(r-1),lm=(e,r,t,s=1)=>{let o=wo(r,s);return Math.floor((e[0]*(t-1)-t+o)/2)},El=(e,r,t,s,o)=>{o==null&&(o=lm(e,r[0],s[0]));let n=[0,0,0,t];for(let i=0;i<3;i++)e[i]+2*o>=r[i]&&(n[i]=Math.trunc((e[i]-r[i]+2*o)/s[i]+1));return n},um=(e,r,t,s,o,n,i,a,l,u)=>{let p,d,c,f;if(e==="VALID"&&(e=0),typeof e=="number"){p={top:e,bottom:e,left:e,right:e,front:e,back:e};let _=El([r,t,s,1],[a,l,u],1,[o,n,i],e);d=_[0],c=_[1],f=_[2]}else if(Array.isArray(e)){if(!e.every((T,k,w)=>T===w[0]))throw Error(`Unsupported padding parameter: ${e}`);p={top:e[0],bottom:e[1],left:e[2],right:e[3],front:e[4],back:e[5]};let _=El([r,t,s,1],[a,l,u],1,[o,n,i],e[0]);d=_[0],c=_[1],f=_[2]}else if(e==="SAME_UPPER"){d=Math.ceil(r/o),c=Math.ceil(t/n),f=Math.ceil(s/i);let _=(d-1)*o+a-r,T=(c-1)*n+l-t,k=(f-1)*i+u-s,w=Math.floor(_/2),g=_-w,S=Math.floor(T/2),E=T-S,y=Math.floor(k/2),M=k-y;p={top:S,bottom:E,left:y,right:M,front:w,back:g}}else throw Error(`Unknown padding parameter: ${e}`);return{padInfo:p,outDepth:d,outHeight:c,outWidth:f}},dm=(e,r,t,s,o,n=!1,i="channelsLast")=>{let a,l,u,p,d;if(i==="channelsLast")[a,l,u,p,d]=e;else if(i==="channelsFirst")[a,d,l,u,p]=e;else throw new Error(`Unknown dataFormat ${i}`);let[c,,f,_,T]=r,[k,w,g]=Tl(t),[S,E,y]=Tl(s),M=wo(f,S),v=wo(_,E),C=wo(T,y),{padInfo:A,outDepth:B,outHeight:K,outWidth:G}=um(o,l,u,p,k,w,g,M,v,C),j=n?c*d:c,ee=[0,0,0,0,0];return i==="channelsFirst"?ee=[a,j,B,K,G]:i==="channelsLast"&&(ee=[a,B,K,G,j]),{batchSize:a,dataFormat:i,inDepth:l,inHeight:u,inWidth:p,inChannels:d,outDepth:B,outHeight:K,outWidth:G,outChannels:j,padInfo:A,strideDepth:k,strideHeight:w,strideWidth:g,filterDepth:f,filterHeight:_,filterWidth:T,effectiveFilterDepth:M,effectiveFilterHeight:v,effectiveFilterWidth:C,dilationDepth:S,dilationHeight:E,dilationWidth:y,inShape:e,outShape:ee,filterShape:r}},cm=(e,r,t,s,o,n)=>{let i=n==="channelsLast";i?e[0].dims[3]:e[0].dims[1];let a=[64,1,1],l={x:t.map((k,w)=>w)},u=[Math.ceil(am(l.x.map(k=>t[k]))/a[0]),1,1];vt("verbose",()=>`[conv3d_naive_webgpu] dispatch = ${u}`);let p=1,d=Me.size(t),c=[{type:12,data:d},{type:12,data:s},{type:12,data:o},{type:12,data:r.strides},{type:12,data:r.dilations}];sn(r,c),c.push(...st(e[0].dims,e[1].dims));let f=["rank","rank"],_=e.length===3;_&&(c.push(...st(e[2].dims)),f.push("rank")),c.push(...st(t));let T=k=>{let w=[{name:"output_size",type:"u32"},{name:"filter_dims",type:"u32",length:s.length},{name:"pads",type:"u32",length:o.length},{name:"strides",type:"u32",length:r.strides.length},{name:"dilations",type:"u32",length:r.dilations.length}];nn(r,w);let g=1,S=lr(e[0].dataType),E=Pe("x",e[0].dataType,e[0].dims.length,p),y=Pe("W",e[1].dataType,e[1].dims.length,g),M=[E,y],v=Ye("result",e[0].dataType,t.length,g),C="";if(_){let K=Pe("bias",e[2].dataType,e[2].dims.length,g);M.push(K),C+=` + fn getBiasByOutputCoords(coords : array) -> ${S} { + return bias[${i?et("coords",4,5):et("coords",1,5)}]; + }`}let A=_r(p,S),B=rn(r,A,S);return` + ${C} + fn getX(d0 : u32, d1 : u32, d2 : u32, d3 : u32, d4 : u32) -> f32 { + let aIndices = array(d0, d1, d2, d3, d4); + return ${E.getByIndices("aIndices")}; + } + fn getW(d0 : u32, d1 : u32, d2 : u32, d3 : u32, d4 : u32) -> f32 { + let aIndices = array(d0, d1, d2, d3, d4); + return ${y.getByIndices("aIndices")}; + } + ${k.registerUniforms(w).declareVariables(...M,v)} + ${k.mainStart()} + ${k.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let coords = ${v.offsetToIndices("global_idx")}; + let batch = ${et("coords",0,E.rank)}; + let d2 = ${i?et("coords",E.rank-1,E.rank):et("coords",1,E.rank)}; + let xFRCCorner = vec3(${i?et("coords",1,E.rank):et("coords",2,E.rank)}, + ${i?et("coords",2,E.rank):et("coords",3,E.rank)}, + ${i?et("coords",3,E.rank):et("coords",4,E.rank)}) * uniforms.strides - uniforms.pads; + let xFCorner = xFRCCorner.x; + let xRCorner = xFRCCorner.y; + let xCCorner = xFRCCorner.z; + let xShapeY = ${i?et("uniforms.x_shape",1,E.rank):et("uniforms.x_shape",2,E.rank)}; + let xShapeZ = ${i?et("uniforms.x_shape",2,E.rank):et("uniforms.x_shape",3,E.rank)}; + let xShapeW = ${i?et("uniforms.x_shape",3,E.rank):et("uniforms.x_shape",4,E.rank)}; + let xShapeU = ${i?et("uniforms.x_shape",4,E.rank):et("uniforms.x_shape",1,E.rank)}; + let inputDepthNearestVec4 = (xShapeU / 4) * 4; + let inputDepthVec4Remainder = xShapeU % 4; + + var value = 0.0; + for (var wF = 0u; wF < uniforms.filter_dims[0]; wF++) { + let xF = xFCorner + wF * uniforms.dilations[0]; + if (xF < 0 || xF >= xShapeY) { + continue; + } + + for (var wR = 0u; wR < uniforms.filter_dims[1]; wR++) { + let xR = xRCorner + wR * uniforms.dilations[1]; + if (xR < 0 || xR >= xShapeZ) { + continue; + } + + for (var wC = 0u; wC < uniforms.filter_dims[2]; wC++) { + let xC = xCCorner + wC * uniforms.dilations[2]; + if (xC < 0 || xC >= xShapeW) { + continue; + } + + for (var d1 = 0u; d1 < inputDepthNearestVec4; d1 += 4) { + ${i?`let xValues = vec4( + getX(batch, xF, xR, xC, d1), + getX(batch, xF, xR, xC, d1 + 1), + getX(batch, xF, xR, xC, d1 + 2), + getX(batch, xF, xR, xC, d1 + 3)); + `:`let xValues = vec4( + getX(batch, d1, xF, xR, xC), + getX(batch, d1 + 1, xF, xR, xC), + getX(batch, d1 + 2, xF, xR, xC), + getX(batch, d1 + 3, xF, xR, xC)); + `} + let wValues = vec4( + getW(d2, d1, wF, wR, wC), + getW(d2, d1 + 1, wF, wR, wC), + getW(d2, d1 + 2, wF, wR, wC), + getW(d2, d1 + 3, wF, wR, wC)); + value += dot(xValues, wValues); + } + if (inputDepthVec4Remainder == 1) { + ${i?`value += getX(batch, xF, xR, xC, inputDepthNearestVec4) + * getW(d2, inputDepthNearestVec4, wF, wR, wC);`:`value += getX(batch, inputDepthNearestVec4, xF, xR, xC) + * getW(d2, inputDepthNearestVec4, wF, wR, wC);`} + } else if (inputDepthVec4Remainder == 2) { + ${i?`let xValues = vec2( + getX(batch, xF, xR, xC, inputDepthNearestVec4), + getX(batch, xF, xR, xC, inputDepthNearestVec4 + 1)); + `:`let xValues = vec2( + getX(batch, inputDepthNearestVec4, xF, xR, xC), + getX(batch, inputDepthNearestVec4 + 1, xF, xR, xC)); + `} + let wValues = vec2( + getW(d2, inputDepthNearestVec4, wF, wR, wC), + getW(d2, inputDepthNearestVec4 + 1, wF, wR, wC)); + value += dot(xValues, wValues); + } else if (inputDepthVec4Remainder == 3) { + ${i?`let xValues = vec3( + getX(batch, xF, xR, xC, inputDepthNearestVec4), + getX(batch, xF, xR, xC, inputDepthNearestVec4 + 1), + getX(batch, xF, xR, xC, inputDepthNearestVec4 + 2)); + `:`let xValues = vec3( + getX(batch, inputDepthNearestVec4, xF, xR, xC), + getX(batch, inputDepthNearestVec4 + 1, xF, xR, xC), + getX(batch, inputDepthNearestVec4 + 2, xF, xR, xC)); + `} + let wValues = vec3( + getW(d2, inputDepthNearestVec4, wF, wR, wC), + getW(d2, inputDepthNearestVec4 + 1, wF, wR, wC), + getW(d2, inputDepthNearestVec4 + 2, wF, wR, wC)); + value += dot(xValues, wValues); + } + } + } + } + ${_?"value = value + getBiasByOutputCoords(coords)":""}; + ${B} + result[global_idx] = f32(value); + }`};return{name:"Conv3DNaive",shaderCache:{hint:`${r.cacheKey};${i};${p};${_}`,inputDependencies:f},getRunData:()=>({outputs:[{dims:t,dataType:e[0].dataType}],dispatchGroup:{x:u[0],y:u[1],z:u[2]},programUniforms:c}),getShaderSource:T}}}),pm,hm,Ov=Be(()=>{ut(),mt(),ft(),on(),pm=(e,r,t,s)=>{let o=e.length>2,n=o?"value += b[output_channel];":"",i=e[0].dims,a=e[1].dims,l=r.format==="NHWC",u=l?t[3]:t[1],p=u/r.group,d=l&&p>=4?Kt(u):1,c=Me.size(t)/d,f=[{type:12,data:c},{type:12,data:r.dilations},{type:12,data:[r.strides[0],r.strides[1]]},{type:12,data:[r.pads[0],r.pads[1]]},{type:12,data:p}];sn(r,f),f.push(...st(i,[a[0],a[1],a[2],a[3]/d]));let _=o?["rank","rank","rank"]:["rank","rank"];f.push(...st([t[0],t[1],t[2],t[3]/d]));let T=k=>{let w=Ye("output",e[0].dataType,t.length,d),g=lr(w.type.tensor),S=rn(r,w.type.value,g),E=Pe("x",e[0].dataType,i.length),y=Pe("w",e[1].dataType,a.length,d),M=[E,y];o&&M.push(Pe("b",e[2].dataType,e[2].dims,d));let v=[{name:"output_size",type:"u32"},{name:"dilations",type:"u32",length:r.dilations.length},{name:"strides",type:"u32",length:2},{name:"pads",type:"u32",length:2},{name:"output_channels_per_group",type:"u32"}];nn(r,v);let C=l?` + for (var wHeight: u32 = 0u; wHeight < uniforms.w_shape[0]; wHeight++) { + let xHeight = xRCCorner.x + wHeight * uniforms.dilations[0]; + + if (xHeight < 0u || xHeight >= uniforms.x_shape[1]) { + continue; + } + + for (var wWidth: u32 = 0u; wWidth < uniforms.w_shape[1]; wWidth++) { + let xWidth = xRCCorner.y + wWidth * uniforms.dilations[1]; + if (xWidth < 0u || xWidth >= uniforms.x_shape[2]) { + continue; + } + + for (var wInChannel: u32 = 0u; wInChannel < uniforms.w_shape[2]; wInChannel++) { + let input_channel = in_channel_offset + wInChannel; + let xVal = ${E.get("batch","xHeight","xWidth","input_channel")}; + let wVal = ${y.get("wHeight","wWidth","wInChannel","output_channel")}; + value += xVal * wVal; + } + } + } + `:` + for (var wInChannel: u32 = 0u; wInChannel < uniforms.w_shape[1]; wInChannel++) { + let input_channel = in_channel_offset + wInChannel; + for (var wHeight: u32 = 0u; wHeight < uniforms.w_shape[2]; wHeight++) { + let xHeight = xRCCorner.x + wHeight * uniforms.dilations[0]; + + if (xHeight < 0u || xHeight >= uniforms.x_shape[2]) { + continue; + } + + for (var wWidth: u32 = 0u; wWidth < uniforms.w_shape[3]; wWidth++) { + let xWidth = xRCCorner.y + wWidth * uniforms.dilations[1]; + if (xWidth < 0u || xWidth >= uniforms.x_shape[3]) { + continue; + } + + let xVal = ${E.get("batch","input_channel","xHeight","xWidth")}; + let wVal = ${y.get("output_channel","wInChannel","wHeight","wWidth")}; + value += xVal * wVal; + } + } + } + `;return` + ${k.registerUniforms(v).declareVariables(...M,w)} + + ${k.mainStart()} + ${k.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let outputIndices = ${w.offsetToIndices("global_idx")}; + let batch: u32 = outputIndices[0]; + let output_channel: u32 = outputIndices[${l?3:1}]; + let xRCCorner: vec2 = vec2(outputIndices[${l?1:2}], outputIndices[${l?2:3}]) * uniforms.strides - uniforms.pads; + let group_id: u32 = output_channel * ${d} / uniforms.output_channels_per_group; + var in_channel_offset = group_id * uniforms.w_shape[${l?2:1}]; + + var value: ${w.type.value} = ${w.type.value}(0); + ${C} + ${n} + ${S} + ${w.setByOffset("global_idx","value")} + }`};return{name:"GroupedConv",shaderCache:{hint:`${r.cacheKey}_${d}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:s?s(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:f}),getShaderSource:T}},hm=(e,r,t,s)=>{let o=e.length>2,n=Kt(t[3]),i=Kt(t[2]),a=Me.size(t)/n/i,l=[e[0].dims[0],e[0].dims[1],e[0].dims[2],e[0].dims[3]/n],u=[e[1].dims[0],e[1].dims[1],e[1].dims[2],e[1].dims[3]/n],p=[t[0],t[1],t[2],t[3]/n],d=[{type:12,data:a},{type:6,data:[r.strides[0],r.strides[1]]},{type:6,data:[r.pads[0],r.pads[1]]}];sn(r,d),d.push(...st(l,u,p));let c=(i-1)*r.strides[1]+u[1],f=_=>{let T=Ye("output",e[0].dataType,p.length,n),k=lr(T.type.tensor),w=rn(r,T.type.value,k),g=Pe("x",e[0].dataType,l.length,n),S=Pe("w",e[1].dataType,u.length,n),E=[g,S];o&&E.push(Pe("b",e[2].dataType,e[2].dims,n));let y=o?"value += b[output_channel];":"",M=[{name:"output_size",type:"u32"},{name:"strides",type:"i32",length:2},{name:"pads",type:"i32",length:2}];return nn(r,M),` + ${_.registerUniforms(M).declareVariables(...E,T)} + ${_.mainStart()} + ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let width0 = uniforms.output_shape[3]; + let output_channel = global_idx % width0; + var index1 = global_idx / width0; + let width1 = uniforms.output_shape[2] / ${i}u; + let col = (index1 % width1) * ${i}u; + index1 = index1 / width1; + let row = index1 % uniforms.output_shape[1]; + let batch = index1 / uniforms.output_shape[1]; + + let x_corner = vec2(i32(row), i32(col)) * uniforms.strides - uniforms.pads; + + var x_vals: array<${g.type.value}, ${c}>; + var values: array<${T.type.value}, ${i}>; + let input_channel = output_channel; + // Use constant instead of uniform can give better performance for w's height/width. + for (var w_height: u32 = 0u; w_height < ${u[0]}; w_height++) { + let x_height = x_corner.x + i32(w_height); + if (x_height >= 0 && u32(x_height) < uniforms.x_shape[1]) { + for (var i = 0; i < ${c}; i++) { + let x_width = x_corner.y + i; + if (x_width >= 0 && u32(x_width) < uniforms.x_shape[2]) { + x_vals[i] = ${g.get("batch","u32(x_height)","u32(x_width)","input_channel")}; + } else { + x_vals[i] = ${g.type.value}(0); + } + } + for (var w_width: u32 = 0u; w_width < ${u[1]}; w_width++) { + let w_val = ${S.get("w_height","w_width","0","output_channel")}; + for (var i = 0u; i < ${i}u; i++) { + values[i] = fma(x_vals[i * u32(uniforms.strides[1]) + w_width], w_val, values[i]); + } + } + } + } + + for (var i = 0u; i < ${i}u; i++) { + var value = values[i]; + ${y} + ${w} + ${T.set("batch","row","col + i","output_channel","value")}; + } + }`};return{name:"GroupedConv-Vectorize",shaderCache:{hint:`${r.cacheKey};${n};${i};${c};${u[0]};${u[1]}`,inputDependencies:o?["rank","rank","type"]:["rank","rank"]},getRunData:()=>({outputs:[{dims:s?s(t):t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(a/64)},programUniforms:d}),getShaderSource:f}}}),mm,mi,_m,_i,Pl,Cl,fm,gm,Sl,Dv=Be(()=>{mt(),Av(),Fv(),xl(),Ov(),on(),Ml(),zs(),mm=(e,r,t,s,o,n)=>{let i=e[0],a=e.slice(n?1:2,n?3:4),l=a.length,u=r[0],p=r.slice(2).map((c,f)=>c+(c-1)*(t[f]-1)),d=a.map((c,f)=>c+s[f]+s[f+l]).map((c,f)=>Math.floor((c-p[f]+o[f])/o[f]));return d.splice(0,0,i),d.splice(n?3:1,0,u),d},mi=[2,3,1,0],_m=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length>5)throw new Error("greater than 5D is not supported");if(e[0].dims.length!==e[1].dims.length)throw new Error("filter does not have same dimension as input");let t=e[0].dims[r.format==="NHWC"?e[0].dims.length-1:1],s=e[1].dims[1]*r.group;if(t!==s)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");if(e.length===3&&(e[2].dims.length!==1||e[1].dims[0]!==e[2].dims[0]))throw new Error("invalid bias");let o=e[0].dims.length-2;if(r.dilations.length!==o)throw new Error(`dilations should be ${o}D`);if(r.strides.length!==o)throw new Error(`strides should be ${o}D`);if(r.pads.length!==o*2)throw new Error(`pads should be ${o*2}D`);if(r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape")},_i=(e,r)=>{let t=e.kernelShape.slice();t.length{let r=fl(e),t=e.format,s=["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][e.auto_pad],o=e.dilations,n=e.group,i=e.kernel_shape,a=e.pads,l=e.strides,u=e.w_is_const();return{autoPad:s,format:t,dilations:o,group:n,kernelShape:i,pads:a,strides:l,wIsConst:u,...r,cacheKey:`${e.format};${r.activation};`}},Cl=(e,r,t,s)=>{let o=t.format==="NHWC",n=mm(r[0].dims,r[1].dims,t.dilations,t.pads,t.strides,o);if(t.group!==1){let M=[r[0]];if(o){let v=e.kernelCustomData.wT??e.compute(Lr(r[1],mi),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=v),M.push(v)}else M.push(r[1]);r.length===3&&M.push(r[2]),!e.adapterInfo.isArchitecture("ampere")&&o&&r[1].dims[0]===t.group&&r[1].dims[1]===1&&t.dilations[0]===1&&t.dilations[1]===1?e.compute(hm(M,t,n,s),{inputs:M}):e.compute(pm(M,t,n,s),{inputs:M});return}let i=r.length===3,a=r[0].dims[o?1:2],l=r[0].dims[o?2:3],u=r[0].dims[o?3:1],p=r[1].dims[2],d=r[1].dims[3],c=n[o?1:2],f=n[o?2:3],_=n[o?3:1],T=o&&p===a&&d===l&&t.pads[0]===0&&t.pads[1]===0;if(T||p===1&&d===1&&t.dilations[0]===1&&t.dilations[1]===1&&t.strides[0]===1&&t.strides[1]===1&&t.pads[0]===0&&t.pads[1]===0){let M=n[0],v,C,A,B=[];if(o){let j=e.kernelCustomData.wT??e.compute(Lr(r[1],mi),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];if(t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=j),T){let ee=a*l*u;v=r[0].reshape([1,M,ee]),C=j.reshape([1,ee,_]),A=[1,M,_]}else v=r[0].reshape([M,a*l,u]),C=j.reshape([1,u,_]),A=[M,c*f,_];B.push(v),B.push(C)}else v=r[0].reshape([M,u,a*l]),C=r[1].reshape([1,_,u]),A=[M,_,c*f],B.push(C),B.push(v);i&&B.push(r[2]);let K=A[2],G=B[0].dims[B[0].dims.length-1];K<8&&G<8?e.compute(wl(B,t,n,A,o,s),{inputs:B}):e.compute(hi(B,t,n,A,o,s),{inputs:B});return}let k=!0,w=e.kernelCustomData.wT??e.compute(Lr(r[1],mi),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=w);let g=[r[0],w];i&&g.push(r[2]);let S=o?c*f:_,E=o?_:c*f,y=p*d*u;e.compute(im(g,t,n,S,E,y,i,k,s),{inputs:g})},fm=(e,r)=>{let t=r.format==="NHWC",s=[e.inputs[0].reshape(t?[e.inputs[0].dims[0],1,e.inputs[0].dims[1],e.inputs[0].dims[2]]:[e.inputs[0].dims[0],e.inputs[0].dims[1],1,e.inputs[0].dims[2]]),e.inputs[1].reshape([e.inputs[1].dims[0],e.inputs[1].dims[1],1,e.inputs[1].dims[2]])];e.inputs.length===3&&s.push(e.inputs[2]);let o=[0,r.pads[0],0,r.pads[1]],n=[1].concat(r.strides),i=[1].concat(r.dilations),a=[1].concat(r.kernelShape),l=_i({...r,pads:o,strides:n,dilations:i,kernelShape:a},s);Cl(e,s,l,u=>t?[u[0],u[2],u[3]]:[u[0],u[1],u[3]])},gm=(e,r,t)=>{let s=t.format==="NHWC"?"channelsLast":"channelsFirst",o=_i(t,r),n=t.autoPad==="NOTSET"?t.pads:t.autoPad,i=dm(r[0].dims,r[1].dims,t.strides,t.dilations,n,!1,s);e.compute(cm(r,o,i.outShape,[i.filterDepth,i.filterHeight,i.filterWidth],[i.padInfo.front,i.padInfo.top,i.padInfo.left],s))},Sl=(e,r)=>{if(_m(e.inputs,r),e.inputs[0].dims.length===3)fm(e,r);else if(e.inputs[0].dims.length===5)gm(e,e.inputs,r);else{let t=_i(r,e.inputs);Cl(e,e.inputs,t)}}}),wm,Lv=Be(()=>{ut(),Es(),mt(),ft(),wm=(e,r,t)=>{let s=e.length>2,o=r.outputShape,n=r.format==="NHWC",i=r.group,a=e[1].dims,l=a[2]/i,u=a[3],p=n?Kt(l):1,d=n&&u===1&&l>=4,c=d?Math.floor(l/4)*4:Math.floor(l/p)*p,f=l-c,_=n?Kt(u):1,T=n?u===1?p:_:1,k=Me.size(o)/_,w=[Math.ceil(k/64),1,1];vt("verbose",()=>`[conv2d_backprop_webgpu] dispatch = ${w}`);let g=["rank","rank"],S=[r.strides[0],r.strides[1]],E=[r.kernelShape[n?1:2],r.kernelShape[n?2:3]],y=[r.dilations[0],r.dilations[1]],M=[E[0]+(r.dilations[0]<=1?0:(r.kernelShape[n?1:2]-1)*(r.dilations[0]-1)),E[1]+(r.dilations[1]<=1?0:(r.kernelShape[n?2:3]-1)*(r.dilations[1]-1))],v=[M[0]-1-Math.floor((r.pads[0]+r.pads[2])/2),M[1]-1-Math.floor((r.pads[1]+r.pads[3])/2)],C=[{type:12,data:k},{type:12,data:S},{type:12,data:E},{type:12,data:y},{type:12,data:M},{type:6,data:v},{type:12,data:c},{type:12,data:l},{type:12,data:u},...st(e[0].dims,e[1].dims)];s&&(C.push(...st(e[2].dims)),g.push("rank")),C.push(...st(o));let A=B=>{let K=[{name:"output_size",type:"u32"},{name:"strides",type:"u32",length:S.length},{name:"filter_dims",type:"u32",length:E.length},{name:"dilations",type:"u32",length:E.length},{name:"effective_filter_dims",type:"u32",length:M.length},{name:"pads",type:"i32",length:v.length},{name:"input_channels_per_group_int",type:"u32"},{name:"input_channels_per_group",type:"u32"},{name:"output_channels_per_group",type:"u32"}],G=lr(e[0].dataType),j=n?1:2,ee=n?2:3,H=n?3:1,Z=Pe("W",e[1].dataType,e[1].dims.length,T),X=Pe("Dy",e[0].dataType,e[0].dims.length,p),oe=[X,Z];s&&oe.push(Pe("bias",e[2].dataType,[o[H]].length,_));let me=Ye("result",e[0].dataType,o.length,_),ae=()=>{let W="";if(d)p===4?W+=` + let xValue = ${X.getByOffset("x_offset")}; + let wValue = ${Z.getByOffset("w_offset")}; + dotProd = dotProd + dot(xValue, wValue); + x_offset += 1u; + w_offset += 1u;`:p===2?W+=` + dotProd = dotProd + dot(vec4<${G}>(${X.getByOffset("x_offset")}, ${X.getByOffset("x_offset + 1u")}), vec4<${G}>(${Z.getByOffset("w_offset")}, ${Z.getByOffset("w_offset + 1u")})); + x_offset += 2u; + w_offset += 2u;`:p===1&&(W+=` + dotProd = dotProd + dot(vec4<${G}>(${X.getByOffset("x_offset")}, ${X.getByOffset("x_offset + 1u")}, ${X.getByOffset("x_offset + 2u")}, ${X.getByOffset("x_offset + 3u")}), vec4<${G}>(${Z.getByOffset("w_offset")}, ${Z.getByOffset("w_offset + 1u")}, ${Z.getByOffset("w_offset + 2u")}, ${Z.getByOffset("w_offset + 3u")})); + x_offset += 4u; + w_offset += 4u;`);else if(W+=` + let xValue = ${n?X.getByOffset(`${X.indicesToOffset(`${X.type.indices}(batch, idyR, idyC, inputChannel)`)} / ${p}`):X.get("batch","inputChannel","idyR","idyC")}; + `,p===1)W+=` + let w_offset = ${Z.indicesToOffset(`${Z.type.indices}(u32(wRPerm), u32(wCPerm), inputChannel, wOutChannel)`)}; + let wValue = ${Z.getByOffset(`w_offset / ${T}`)}; + dotProd = dotProd + xValue * wValue;`;else for(let re=0;re{if(f===0)return"";if(!d)throw new Error(`packInputAs4 ${d} is not true.`);let W="";if(p===1){W+="dotProd = dotProd";for(let re=0;re(i32(r), i32(c)) - uniforms.pads; + let dyRCorner = dyCorner.x; + let dyCCorner = dyCorner.y; + let groupId = d1 / uniforms.output_channels_per_group; + let wOutChannel = d1 - groupId * uniforms.output_channels_per_group; + // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1). + // ? = to be determined. : = across all values in that axis. + var dotProd = ${me.type.value}(0.0); + var wR: u32 = 0; + if (uniforms.dilations.x == 1) { + // Minimum wR >= 0 that satisfies (dyRCorner + wR) % (uniforms.strides.x) == 0 + wR = u32(((dyRCorner + i32(uniforms.strides.x) - 1) / i32(uniforms.strides.x)) * i32(uniforms.strides.x) - dyRCorner); + } + for (; wR < uniforms.effective_filter_dims.x; wR = wR + 1) { + if (wR % uniforms.dilations.x != 0) { + continue; + } + let dyR = (${G}(dyRCorner) + ${G}(wR)) / ${G}(uniforms.strides[0]); + let wRPerm = uniforms.filter_dims.x - 1 - wR / uniforms.dilations.x; + if (dyR < 0.0 || dyR >= ${G}(uniforms.Dy_shape[${j}]) || fract(dyR) > 0.0 || + wRPerm < 0) { + continue; + } + let idyR: u32 = u32(dyR); + var wC: u32 = 0; + if (uniforms.dilations.y == 1) { + // Minimum wC >= 0 that satisfies (dyCCorner + wC) % (uniforms.strides.y) == 0 + wC = u32(((dyCCorner + i32(uniforms.strides.y) - 1) / i32(uniforms.strides.y)) * i32(uniforms.strides.y) - dyCCorner); + } + for (; wC < uniforms.effective_filter_dims.y; wC = wC + 1) { + if (wC % uniforms.dilations.y != 0) { + continue; + } + let dyC = (${G}(dyCCorner) + ${G}(wC)) / ${G}(uniforms.strides.y); + let wCPerm = uniforms.filter_dims.y - 1 - wC / uniforms.dilations.y; + if (dyC < 0.0 || dyC >= ${G}(uniforms.Dy_shape[${ee}]) || + fract(dyC) > 0.0 || wCPerm < 0) { + continue; + } + let idyC: u32 = u32(dyC); + var inputChannel = groupId * uniforms.input_channels_per_group; + ${d?` + var x_offset = ${X.indicesToOffset(`${X.type.indices}(batch, idyR, idyC, inputChannel)`)} / ${p}; + var w_offset = ${Z.indicesToOffset(`${Z.type.indices}(wRPerm, wCPerm, inputChannel, wOutChannel)`)} / ${T}; + `:""} + for (var d2: u32 = 0; d2 < uniforms.input_channels_per_group_int; d2 = d2 + ${d?4:p}) { + ${ae()} + inputChannel = inputChannel + ${d?4:p}; + } + ${V()} + wC = wC + uniforms.strides.y - 1; + } + wR = wR + uniforms.strides[0] - 1; + } + let value = dotProd${s?` + bias[d1 / ${_}]`:""}; + ${me.setByOffset("global_idx","value")}; + `;return` + ${B.registerUniforms(K).declareVariables(...oe,me)} + ${B.mainStart()} + ${B.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")}; + ${F}}`};return{name:"ConvTranspose2D",shaderCache:{hint:`${r.cacheKey};${p}${T}${_}${d}${f}`,inputDependencies:g},getRunData:()=>({dispatchGroup:{x:w[0],y:w[1],z:w[2]},outputs:[{dims:t?t(o):o,dataType:e[0].dataType}],programUniforms:C}),getShaderSource:A}}}),Mm,bm,ym,$l,vm,xm,kl,Tm,Em,zv=Be(()=>{Lv(),on(),zs(),Mm=(e,r,t,s,o,n)=>(e-1)*r+t+(s-1)*o+1-n,bm=(e,r,t,s,o)=>{let n=Math.floor(e/2);r==="SAME_UPPER"?(t[s]=n,t[o]=e-n):r==="SAME_LOWER"&&(t[s]=e-n,t[o]=n)},ym=(e,r,t,s,o,n,i,a,l,u)=>{let p=e.length-2,d=u.length===0;l.length{let t=e.kernelShape.slice();if(e.kernelShape.length===0||e.kernelShape.reduce((d,c)=>d*c,1)===0){t.length=0;for(let d=2;dd+c,0)===0){let d=r[0].dims.length-2;l=new Array(d).fill(1)}let u=e.strides.slice();if(u.reduce((d,c)=>d+c,0)===0){let d=r[0].dims.length-2;u=new Array(d).fill(1)}ym(a,t,l,e.autoPad,e.group,o,u,s,i,n);let p=Object.assign({},e);return Object.assign(p,{kernelShape:t,pads:o,outputPadding:i,outputShape:n,dilations:l,strides:u}),p},vm=e=>{let r=fl(e),t=e.format,s=["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][typeof e.autoPad>"u"?0:e.autoPad],o=e.dilations,n=e.group,i=e.kernelShape,a=e.pads,l=e.strides,u=e.wIsConst(),p=e.outputPadding,d=e.outputShape;return{autoPad:s,format:t,dilations:o,group:n,kernelShape:i,outputPadding:p,outputShape:d,pads:a,strides:l,wIsConst:u,...r,cacheKey:`${e.format};${r.activation};`}},xm=(e,r)=>{if(!e||e.length!==2&&e.length!==3)throw new Error("Conv requires 2 or 3 inputs");if(e[0].dims.length!==4&&e[0].dims.length!==3)throw new Error("currently only support 2-dimensional conv");if(e[0].dims.length!==e[1].dims.length)throw new Error("filter does not have same dimension as input");let t=e[0].dims[r.format==="NHWC"?e[0].dims.length-1:1],s=e[1].dims[0];if(t!==s)throw new Error("FILTER_IN_CHANNEL should be equal to DATA_CHANNEL");let o=e[1].dims[1]*r.group;if(e.length===3&&(e[2].dims.length!==1||e[2].dims[0]!==o))throw new Error("invalid bias");let n=e[0].dims.length-2;if(r.dilations.reduce((i,a)=>i+a,0)>0&&r.dilations.length!==n)throw new Error(`dilations should be ${n}D`);if(r.strides.reduce((i,a)=>i+a,0)>0&&r.strides.length!==n)throw new Error(`strides should be ${n}D`);if(r.pads.reduce((i,a)=>i+a,0)>0&&r.pads.length!==n*2)throw new Error(`pads should be ${n*2}D`);if(r.outputPadding.length!==n&&r.outputPadding.length!==0)throw new Error(`output_padding should be ${n}D`);if(r.kernelShape.reduce((i,a)=>i+a,0)>0&&r.kernelShape.length!==0&&r.kernelShape.length!==e[1].dims.length-2)throw new Error("invalid kernel shape");if(r.outputShape.length!==0&&r.outputShape.length!==e[0].dims.length-2)throw new Error("invalid output shape")},kl=(e,r,t,s)=>{let o=e.kernelCustomData.wT??e.compute(Lr(r[1],[2,3,0,1]),{inputs:[1],outputs:[t.wIsConst?-2:-1]})[0];t.wIsConst&&!e.kernelCustomData.wT&&(e.kernelCustomData.wT=o);let n=[r[0],o];r.length===3&&n.push(r[2]),e.compute(wm(n,t,s),{inputs:n})},Tm=(e,r)=>{let t=r.format==="NHWC",s=[e.inputs[0].reshape(t?[e.inputs[0].dims[0],1,e.inputs[0].dims[1],e.inputs[0].dims[2]]:[e.inputs[0].dims[0],e.inputs[0].dims[1],1,e.inputs[0].dims[2]]),e.inputs[1].reshape([e.inputs[1].dims[0],e.inputs[1].dims[1],1,e.inputs[1].dims[2]])];e.inputs.length===3&&s.push(e.inputs[2]);let o=r.kernelShape;(o.length===0||o[0]===0)&&(o=[e.inputs[1].dims[2]]);let n=r.dilations;(n.length===0||n[0]===0)&&(n=[1]);let i=r.strides;(i.length===0||i[0]===0)&&(i=[1]);let a=r.pads;a.length===0&&(a=[0,0]),a=[0,a[0],0,a[1]],i=[1].concat(i),n=[1].concat(n),o=[1].concat(o);let l=r.outputPadding;l=[0].concat(l);let u=$l({...r,pads:a,strides:i,dilations:n,kernelShape:o,outputPadding:l},s);kl(e,s,u,p=>t?[p[0],p[2],p[3]]:[p[0],p[1],p[3]])},Em=(e,r)=>{if(xm(e.inputs,r),e.inputs[0].dims.length===3)Tm(e,r);else{let t=$l(r,e.inputs);kl(e,e.inputs,t)}}}),Pm,Cm,Sm,Bv=Be(()=>{ut(),mt(),Xt(),ft(),Pm=(e,r,t,s)=>{let o=Me.size(r),n=r.length,i=Pe("input",e,n),a=Ye("output",e,n),l=t.dataType===6?t.getInt32Array()[0]:Number(t.getBigInt64Array()[0]),u=Me.normalizeAxis(l,n),p=d=>{let c=` i32(${i.indicesGet("inputIndices","uniforms.axis")}) `,f=et("uniforms.input_shape","uniforms.axis",n),_=s.reverse?c+(s.exclusive?" + 1":""):"0",T=s.reverse?f:c+(s.exclusive?"":" + 1");return` + ${d.registerUniform("outputSize","u32").registerUniform("axis","u32").declareVariables(i,a)} + ${d.mainStart()} + ${d.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + var inputIndices = ${a.offsetToIndices("global_idx")}; + var sum = ${a.type.value}(0); + let first : i32 = ${_}; + let last : i32 = ${T}; + for (var i : i32 = first; i < last; i++) { + ${i.indicesSet("inputIndices","uniforms.axis","u32(i)")}; + sum = sum + ${i.getByIndices("inputIndices")}; + } + ${a.setByOffset("global_idx","sum")}; + }`};return{name:"CumSum",shaderCache:{hint:s.cacheKey,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:r,dataType:e}],dispatchGroup:{x:Math.ceil(o/64)},programUniforms:[{type:12,data:o},{type:12,data:u},...st(r,r)]}),getShaderSource:p}},Cm=(e,r)=>{let t=e.inputs[0].dims,s=e.inputs[0].dataType,o=e.inputs[1];e.compute(Pm(s,t,o,r),{inputs:[0]})},Sm=e=>{let r=e.exclusive===1,t=e.reverse===1;return St({exclusive:r,reverse:t})}}),$m,km,Im,Am,Fm,Rv=Be(()=>{ut(),mt(),Xt(),ft(),$m=e=>{if(!e||e.length!==1)throw new Error("DepthToSpace requires 1 input.");if(e[0].dims.length!==4)throw new Error("DepthToSpace requires 4D input.")},km=(e,r,t,s)=>{let o=[];o.push(`fn perm(i: ${s.type.indices}) -> ${t.type.indices} { + var a: ${t.type.indices};`);for(let n=0;n{let t,s,o,n,i,a,l=r.format==="NHWC",u=r.blocksize,p=r.mode==="DCR";l?([t,s,o,n]=e.dims,i=p?[t,s,o,u,u,n/u**2]:[t,s,o,n/u**2,u,u],a=p?[0,1,3,2,4,5]:[0,1,4,2,5,3]):([t,s,o,n]=[e.dims[0],e.dims[2],e.dims[3],e.dims[1]],i=p?[t,u,u,n/u**2,s,o]:[t,n/u**2,u,u,s,o],a=p?[0,3,4,1,5,2]:[0,1,4,2,5,3]);let d=e.reshape(i),c=d.dims.length,f=e.dataType,_=Pe("a",f,c),T=Ye("output",f,c),k=w=>` + ${w.registerUniform("output_size","u32").declareVariables(_,T)} + + ${km(a,c,_,T)} + + ${w.mainStart()} + ${w.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let indices = ${T.offsetToIndices("global_idx")}; + let aIndices = perm(indices); + + ${T.setByOffset("global_idx",_.getByIndices("aIndices"))} + }`;return{name:"DepthToSpace",shaderCache:{hint:`${e.dims};${r.blocksize};${r.mode}`,inputDependencies:["rank"]},getRunData:w=>{let g=l?[t,s*u,o*u,n/u**2]:[t,n/u**2,s*u,o*u],S=Me.size(g),E=d.dims,y=Me.sortBasedOnPerm(E,a);return{outputs:[{dims:g,dataType:w[0].dataType}],dispatchGroup:{x:Math.ceil(S/64)},programUniforms:[{type:12,data:S},...st(E,y)]}},getShaderSource:k}},Am=(e,r)=>{$m(e.inputs),e.compute(Im(e.inputs[0],r))},Fm=e=>St({blocksize:e.blocksize,mode:e.mode,format:e.format})}),fi,Mo,Il,Om,Dm,Lm,zm,Al,Bm,Rm,jm,jv=Be(()=>{ut(),mt(),Xt(),ft(),fi="[a-zA-Z]|\\.\\.\\.",Mo="("+fi+")+",Il="^"+Mo+"$",Om="("+Mo+",)*"+Mo,Dm="^"+Om+"$",Lm=class{constructor(e=-1){this.symbolToIndices=new Map,this.inputIndex=e}addSymbol(e,r){let t=this.symbolToIndices.get(e);t===void 0?t=[r]:t.push(r),this.symbolToIndices.set(e,t)}},zm=class{constructor(e,r){var o;this.equation=r,this.hasEllipsis=!1,this.symbolToInfo=new Map,this.lhs=new Array,this.outputDims=[];let[t,s]=r.includes("->")?r.split("->",2):[r,""];if(!t.match(RegExp(Dm)))throw new Error("Invalid LHS term");if(t.split(",").forEach((n,i)=>{let a=e[i].dims.slice();if(!n.match(RegExp(Il)))throw new Error("Invalid LHS term");let l=this.processTerm(n,!0,a,i);this.lhs.push(l)}),s==="")s+=[...this.symbolToInfo.entries()].filter(([n,i])=>i.count===1||n==="...").map(([n])=>n).join("");else if(!s.match(RegExp(Mo)))throw new Error("Invalid RHS");(o=s.match(RegExp(fi,"g")))==null||o.forEach(n=>{if(n==="...")this.outputDims=this.outputDims.concat(this.ellipsisDims);else{let i=this.symbolToInfo.get(n);if(i===void 0)throw new Error("Invalid RHS symbol");this.outputDims.push(i.dimValue)}}),this.rhs=this.processTerm(s,!1,this.outputDims)}addSymbol(e,r,t){let s=this.symbolToInfo.get(e);if(s!==void 0){if(s.dimValue!==r&&s.count!==1)throw new Error("Dimension mismatch");s.count++,s.inputIndices.push(t)}else s={count:1,dimValue:r,inputIndices:[t]};this.symbolToInfo.set(e,s)}processTerm(e,r,t,s=-1){let o=t.length,n=!1,i=[],a=0;if(!e.match(RegExp(Il))&&!r&&e!=="")throw new Error("Invalid LHS term");let l=e.match(RegExp(fi,"g")),u=new Lm(s);return l==null||l.forEach((p,d)=>{if(p==="..."){if(n)throw new Error("Only one ellipsis is allowed per input term");n=!0;let c=o-l.length+1;if(c<0)throw new Error("Ellipsis out of bounds");if(i=t.slice(a,a+c),this.hasEllipsis){if(this.ellipsisDims.length!==i.length||this.ellipsisDims.toString()!==i.toString())throw new Error("Ellipsis dimensions mismatch")}else if(r)this.hasEllipsis=!0,this.ellipsisDims=i;else throw new Error("Ellipsis must be specified in the LHS");for(let f=0;fe+"_max",Bm=(e,r,t,s)=>{let o=e.map(u=>u.length).map((u,p)=>Pe(`input${p}`,r,u)),n=Me.size(s),i=Ye("output",r,s.length),a=[...t.symbolToInfo.keys()].filter(u=>!t.rhs.symbolToIndices.has(u)),l=u=>{let p=[],d="var prod = 1.0;",c="var sum = 0.0;",f="sum += prod;",_=[],T=[],k=[],w=[],g=t.symbolToInfo.size===t.rhs.symbolToIndices.size;t.symbolToInfo.forEach((E,y)=>{var M;if(t.rhs.symbolToIndices.has(y)){let v=(M=t.rhs.symbolToIndices.get(y))==null?void 0:M[0];v!==void 0&&t.lhs.forEach((C,A)=>{if(E.inputIndices.includes(A)){let B=C.symbolToIndices.get(y);if(B===void 0)throw new Error("Invalid symbol error");B.forEach(K=>{p.push(`${o[A].indicesSet(`input${A}Indices`,K,i.indicesGet("outputIndices",v))}`)})}})}else t.lhs.forEach((v,C)=>{if(E.inputIndices.includes(C)){let A=v.symbolToIndices.get(y);if(A===void 0)throw new Error("Invalid symbol error");A.forEach(B=>{_.push(`${o[C].indicesSet(`input${C}Indices`,B,`${y}`)}`)}),w.push(`prod *= ${o[C].getByIndices(`input${C}Indices`)};`)}}),T.push(`for(var ${y}: u32 = 0; ${y} < uniforms.${Al(y)}; ${y}++) {`),k.push("}")});let S=g?[...p,`let sum = ${o.map((E,y)=>E.getByIndices(`input${y}Indices`)).join(" * ")};`]:[...p,c,...T,..._,d,...w,f,...k];return` + ${u.registerUniforms(a.map(E=>({name:`${Al(E)}`,type:"u32"}))).registerUniform("outputSize","u32").declareVariables(...o,i)} + + ${u.mainStart()} + ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + var outputIndices = ${i.offsetToIndices("global_idx")}; + ${o.map((E,y)=>`var input${y}Indices: ${o[y].type.indices};`).join(` +`)} + ${S.join(` +`)}; + ${i.setByOffset("global_idx","sum")}; + }`};return{name:"Einsum",shaderCache:{hint:t.equation,inputDependencies:e.map(()=>"rank")},getRunData:()=>{let u=a.filter(d=>t.symbolToInfo.has(d)).map(d=>{var c;return{type:12,data:((c=t.symbolToInfo.get(d))==null?void 0:c.dimValue)||0}});u.push({type:12,data:n});let p=e.map((d,c)=>[...st(d)]).reduce((d,c)=>d.concat(c),u);return p.push(...st(s)),{outputs:[{dims:s,dataType:r}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:p}},getShaderSource:l}},Rm=(e,r)=>{let t=new zm(e.inputs,r.equation),s=t.outputDims,o=e.inputs.map((n,i)=>n.dims);e.compute(Bm(o,e.inputs[0].dataType,t,s))},jm=e=>{let r=e.equation.replace(/\s+/g,"");return St({equation:r})}}),Nm,Fl,Vm,Um,Wm,Nv=Be(()=>{ut(),mt(),ft(),Nm=e=>{if(!e||e.length!==2)throw new Error("Expand requires 2 input.");let r=e[0].dims,t=Array.from(e[1].getBigInt64Array(),Number),s=t.length{let t=e.length-r.length,s=[];for(let o=0;oe.length>r.length?Fl(e,r):Fl(r,e),Um=e=>{let r=e[0].dims,t=Array.from(e[1].getBigInt64Array(),Number),s=Vm(r,t),o=e[0].dataType,n=o===9||Me.size(r)===1,i=o===9||r.length>0&&r[r.length-1]%4===0?4:1,a=n||s.length>0&&s[s.length-1]%4===0?4:1,l=Math.ceil(Me.size(s)/a),u=d=>{let c=Pe("input",o,r.length,i),f=Ye("output",o,s.length,a),_;if(o===9){let T=(k,w,g="")=>` + let outputIndices${w} = ${f.offsetToIndices(`outputOffset + ${w}u`)}; + let offset${w} = ${c.broadcastedIndicesToOffset(`outputIndices${w}`,f)}; + let index${w} = offset${w} / 4u; + let component${w} = offset${w} % 4u; + ${k}[${w}] = ${g}(${c.getByOffset(`index${w}`)}[component${w}]); + `;_=` + let outputOffset = global_idx * ${a}; + var data = vec4(0); + ${T("data",0,"u32")} + ${T("data",1,"u32")} + ${T("data",2,"u32")} + ${T("data",3,"u32")} + ${f.setByOffset("global_idx","data")} + }`}else _=` + let outputIndices = ${f.offsetToIndices(`global_idx * ${a}`)}; + let inputOffset = ${c.broadcastedIndicesToOffset("outputIndices",f)}; + let data = ${f.type.value}(${c.getByOffset(`inputOffset / ${i}`)}); + ${f.setByOffset("global_idx","data")} + }`;return` + ${d.registerUniform("vec_size","u32").declareVariables(c,f)} + ${d.mainStart()} + ${d.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} + ${_}`},p=[{type:12,data:l},...st(r,s)];return{name:"Expand",shaderCache:{hint:`${s.length};${i}${a}`,inputDependencies:["rank"]},getShaderSource:u,getRunData:()=>({outputs:[{dims:s,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:p})}},Wm=e=>{Nm(e.inputs),e.compute(Um(e.inputs),{inputs:[0]})}}),Gm,Km,Vv=Be(()=>{ut(),mt(),ft(),_l(),Gm=e=>{let r=e[0].dataType,t=Me.size(e[0].dims),s=Me.size(e[1].dims),o=s%4===0,n=i=>{let a=Pe("x",r,[1],4),l=Pe("bias",r,[1],4),u=Ye("y",r,[1],4),p=[{name:"output_vec_size",type:"u32"},{name:"bias_size",type:"u32"}],d=f=>` + let bias${f}_offset: u32 = (global_idx * 4 + ${f}) % uniforms.bias_size; + let bias${f} = ${l.getByOffset(`bias${f}_offset / 4`)}[bias${f}_offset % 4];`,c=o?` + let bias = ${l.getByOffset("global_idx % (uniforms.bias_size / 4)")};`:`${d(0)}${d(1)}${d(2)}${d(3)} + let bias = ${a.type.value}(bias0, bias1, bias2, bias3);`;return`${i.registerUniforms(p).declareVariables(a,l,u)} + + ${hl(yr(r))} + + ${i.mainStart(Vn)} + ${i.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_vec_size")} + + let x = ${a.getByOffset("global_idx")}; + ${c} + let x_in = x + bias; + ${u.setByOffset("global_idx",ml("x_in"))} + }`};return{name:"FastGeluWithBias",shaderCache:{hint:`${o}`,inputDependencies:["type","type"]},getShaderSource:n,getRunData:i=>({outputs:[{dims:i[0].dims,dataType:i[0].dataType}],programUniforms:[{type:12,data:Math.ceil(t/4)},{type:12,data:s}],dispatchGroup:{x:Math.ceil(t/Vn/4)}})}},Km=e=>{e.inputs.length<2||Me.size(e.inputs[1].dims)===0?Ph(e):e.compute(Gm(e.inputs))}}),Hm,qm,Xm,Qm,Uv=Be(()=>{ut(),mt(),Xt(),ft(),Hm=e=>{if(!e||e.length!==2)throw new Error("Gather requires 2 inputs.")},qm=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t.length,n=Me.normalizeAxis(r.axis,o),i=t.slice(0);i.splice(n,1,...s);let a=t[n],l=e[0].dataType===9?4:1,u=Math.ceil(Me.size(i)/l),p=[{type:12,data:u},{type:6,data:a},{type:12,data:n},...st(e[0].dims,e[1].dims,i)],d=c=>{let f=Pe("data",e[0].dataType,e[0].dims.length,l),_=Pe("inputIndices",e[1].dataType,e[1].dims.length),T=Ye("output",e[0].dataType,i.length,l),k=g=>{let S=s.length,E=`var indicesIndices${g} = ${_.type.indices}(0);`;for(let y=0;y1?`indicesIndices${g}[${y}]`:`indicesIndices${g}`} = ${i.length>1?`outputIndices${g}[uniforms.axis + ${y}]`:`outputIndices${g}`};`;E+=` + var idx${g} = ${_.getByIndices(`indicesIndices${g}`)}; + if (idx${g} < 0) { + idx${g} = idx${g} + uniforms.axisDimLimit; + } + var dataIndices${g} : ${f.type.indices}; + `;for(let y=0,M=0;y1?`dataIndices${g}[${y}]`:`dataIndices${g}`} = u32(idx${g});`,M+=S):(E+=`${o>1?`dataIndices${g}[${y}]`:`dataIndices${g}`} = ${i.length>1?`outputIndices${g}[${M}]`:`outputIndices${g}`};`,M++);return E},w;if(e[0].dataType===9){let g=(S,E,y="")=>` + let outputIndices${E} = ${T.offsetToIndices(`outputOffset + ${E}u`)}; + ${k(E)}; + let offset${E} = ${f.indicesToOffset(`dataIndices${E}`)}; + let index${E} = offset${E} / 4u; + let component${E} = offset${E} % 4u; + ${S}[${E}] = ${y}(${f.getByOffset(`index${E}`)}[component${E}]); + `;w=` + let outputOffset = global_idx * ${l}; + var value = vec4(0); + ${g("value",0,"u32")} + ${g("value",1,"u32")} + ${g("value",2,"u32")} + ${g("value",3,"u32")} + ${T.setByOffset("global_idx","value")} + `}else w=` + let outputIndices = ${T.offsetToIndices("global_idx")}; + ${k("")}; + let value = ${f.getByIndices("dataIndices")}; + ${T.setByOffset("global_idx","value")}; + `;return` + ${c.registerUniform("outputSize","u32").registerUniform("axisDimLimit","i32").registerUniform("axis","u32").declareVariables(f,_,T)} + ${c.mainStart()} + ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + ${w} + }`};return{name:"Gather",shaderCache:{hint:r.cacheKey,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:i,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(u/64)},programUniforms:p}),getShaderSource:d}},Xm=e=>St({axis:e.axis}),Qm=(e,r)=>{let t=e.inputs;Hm(t),e.compute(qm(e.inputs,r))}}),Jm,Ym,Zm,Wv=Be(()=>{ut(),mt(),ft(),Jm=(e,r,t,s,o,n,i,a,l)=>{let u=[{type:12,data:n},{type:12,data:s},{type:12,data:o},{type:12,data:t},{type:12,data:i},{type:12,data:a},{type:12,data:l}],p=[n];u.push(...st(r.dims,p));let d=c=>{let f=Pe("indices_data",r.dataType,r.dims.length),_=Ye("input_slice_offsets_data",12,1,1),T=[f,_],k=[{name:"output_size",type:"u32"},{name:"batch_dims",type:"u32"},{name:"input_dims",type:"u32",length:o.length},{name:"sizes_from_slice_dims_data",type:"u32",length:t.length},{name:"num_slices_per_batch",type:"u32"},{name:"input_batch_stride",type:"u32"},{name:"num_slice_dims",type:"u32"}];return` + ${c.registerUniforms(k).declareVariables(...T)} + ${c.mainStart()} + ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let batch_idx = global_idx / uniforms.num_slices_per_batch; + let base_offset = batch_idx * uniforms.input_batch_stride; + + let slice_indices_base_offset = global_idx * uniforms.num_slice_dims; + var relative_slice_offset = 0; + for (var dim_idx = 0u; dim_idx < uniforms.num_slice_dims; dim_idx ++) { + var index = i32(indices_data[dim_idx + slice_indices_base_offset].x); + let input_dim_idx = uniforms.batch_dims + dim_idx; + if (index < 0) { + ${o.length===1?"index += i32(uniforms.input_dims);":"index += i32(uniforms.input_dims[input_dim_idx]);"} + } + ${t.length===1?"relative_slice_offset += index * i32(uniforms.sizes_from_slice_dims_data);":"relative_slice_offset += index * i32(uniforms.sizes_from_slice_dims_data[dim_idx]);"} + } + + input_slice_offsets_data[global_idx] = base_offset + u32(relative_slice_offset); + }`};return e.compute({name:"computeSliceOffsets",shaderCache:{hint:`${o.length}_${t.length}`,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:p,dataType:e.inputs[1].dataType}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:u}),getShaderSource:d},{inputs:[r],outputs:[-1]})[0]},Ym=(e,r)=>{let t=e.inputs,s=t[0].dims,o=t[0].dataType,n=t[1].dims,i=n[n.length-1],a=Me.sizeToDimension(n,n.length-1),l=Me.sizeFromDimension(s,r.batchDims+i),u=Me.sizeToDimension(s,r.batchDims),p=Me.sizeFromDimension(s,r.batchDims),d=a/u,c=new Array(i),f=l;for(let E=0;Es.length)throw new Error("last dimension of indices must not be larger than rank of input tensor");let k=n.slice(0,-1).concat(s.slice(T)),w=Me.size(k),g=[{type:12,data:w},{type:12,data:l},...st(t[0].dims,_.dims,k)],S=E=>{let y=Pe("data",t[0].dataType,t[0].dims.length),M=Pe("slice_offsets",12,_.dims.length),v=Ye("output",t[0].dataType,k.length);return` + ${E.registerUniform("output_size","u32").registerUniform("slice_size","u32").declareVariables(y,M,v)} + ${E.mainStart()} + ${E.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let slice_offset = slice_offsets[global_idx / uniforms.slice_size]; + output[global_idx] = data[u32(slice_offset) + global_idx % uniforms.slice_size]; + }`};e.compute({name:"GatherND",shaderCache:{hint:r.cacheKey,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:k,dataType:o}],dispatchGroup:{x:Math.ceil(w/64)},programUniforms:g}),getShaderSource:S},{inputs:[t[0],_]})},Zm=e=>({batchDims:e.batch_dims,cacheKey:""})}),e_,t_,r_,s_,Gv=Be(()=>{ut(),mt(),Xt(),ft(),e_=(e,r)=>{if(e.length<3||e.length>4)throw new Error("GatherBlockQuantized requires 3 or 4 inputs.");let t=Me.normalizeAxis(r.quantizeAxis,e[0].dims.length),s=r.blockSize,o=e[0],n=e[2],i=e.length===4?e[3]:void 0;if(n.dims.length!==o.dims.length||!o.dims.map((a,l)=>l===t?Math.ceil(a/s)===n.dims[l]:a===n.dims[l]).reduce((a,l)=>a&&l,!0))throw new Error("Scales must have the same rank as the input tensor and the dims should match except on gatherAxis.");if(i){if(i.dataType!==o.dataType)throw new Error("Zero point must have the same data type as the input tensor.");if(i.dims.length!==n.dims.length||!i.dims.map((a,l)=>a===n.dims[l]).reduce((a,l)=>a&&l,!0))throw new Error("Zero point must have the same rank as the input tensor and the dims should match except on quantizeAxis.")}},t_=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t.length,n=Me.normalizeAxis(r.gatherAxis,o),i=Me.normalizeAxis(r.quantizeAxis,o),a=t.slice(0);a.splice(n,1,...s);let l=Me.size(a),u=e[2].dataType,p=e[0].dataType===22,d=[{type:12,data:l},{type:12,data:i},{type:12,data:n},{type:12,data:r.blockSize},...st(...e.map((f,_)=>f.dims),a)],c=f=>{let _=Pe("data",e[0].dataType,e[0].dims.length),T=Pe("inputIndices",e[1].dataType,e[1].dims.length),k=Pe("scales",e[2].dataType,e[2].dims.length),w=e.length>3?Pe("zeroPoint",e[3].dataType,e[3].dims.length):void 0,g=Ye("output",u,a.length),S=[_,T,k];w&&S.push(w);let E=[{name:"output_size",type:"u32"},{name:"quantize_axis",type:"u32"},{name:"gather_axis",type:"u32"},{name:"block_size",type:"u32"}];return` + ${f.registerUniforms(E).declareVariables(...S,g)} + ${f.mainStart()} + let output_indices = ${g.offsetToIndices("global_idx")}; + var indices_indices = ${T.type.indices}(0); + ${s.length>1?` + for (var i: u32 = 0; i < ${s.length}; i++) { + let index = ${g.indicesGet("output_indices","uniforms.gather_axis + i")}; + ${T.indicesSet("indices_indices","i","index")}; + }`:`indices_indices = ${g.indicesGet("output_indices","uniforms.gather_axis")};`}; + var data_indices = ${_.type.indices}(0); + for (var i: u32 = 0; i < uniforms.gather_axis; i++) { + let index = ${g.indicesGet("output_indices","i")}; + ${_.indicesSet("data_indices","i","index")}; + } + var index_from_indices = ${T.getByIndices("indices_indices")}; + if (index_from_indices < 0) { + index_from_indices += ${t[n]}; + } + ${_.indicesSet("data_indices","uniforms.gather_axis","u32(index_from_indices)")}; + for (var i = uniforms.gather_axis + 1; i < ${a.length}; i++) { + let index = ${g.indicesGet("output_indices",`i + ${s.length} - 1`)}; + ${_.indicesSet("data_indices","i","index")}; + } + let data_offset = ${_.indicesToOffset("data_indices")}; + let data_index = data_offset % 8; + // Convert 4-bit packed data to 8-bit packed data. + let packed_4bit_quantized_data = ${_.getByOffset("data_offset / 8")}; + let packed_8bit_quantized_data = (packed_4bit_quantized_data >> (4 * (data_index % 2))) & 0x0f0f0f0f; + let quantized_data_vec = ${p?"unpack4xI8":"unpack4xU8"}(u32(packed_8bit_quantized_data)); + let quantized_data = quantized_data_vec[data_index / 2]; + var scale_indices = data_indices; + let quantize_axis_index = ${k.indicesGet("data_indices","uniforms.quantize_axis")} / uniforms.block_size; + ${k.indicesSet("scale_indices","uniforms.quantize_axis","quantize_axis_index")}; + var scale = ${k.getByIndices("scale_indices")}; + ${w?` + let zero_point_indices = scale_indices; + let zero_point_offset = ${w.indicesToOffset("zero_point_indices")}; + let zero_point_index = zero_point_offset % 8; + let packed_4bit_zero_points = ${w.getByOffset("zero_point_offset / 8")}; + let packed_8bit_zero_points = (packed_4bit_zero_points >> (4 * (zero_point_index % 2))) & 0x0f0f0f0f; + let zero_point_vec = ${p?"unpack4xI8":"unpack4xU8"}(u32(packed_8bit_zero_points)); + let zero_point = zero_point_vec[zero_point_index / 2];`:"var zero_point = 0"}; + let dequantized_data = ${yr(u)}(quantized_data - zero_point) * scale; + ${g.setByOffset("global_idx","dequantized_data")}; + }`};return{name:"GatherBlockQuantized",shaderCache:{hint:`${r.cacheKey};${e.filter((f,_)=>_!==1).map(f=>f.dims.join("_")).join(";")}`,inputDependencies:Array.from({length:e.length},(f,_)=>"rank")},getRunData:()=>({outputs:[{dims:a,dataType:u}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:d}),getShaderSource:c}},r_=(e,r)=>{let t=e.inputs;e_(t,r),e.compute(t_(e.inputs,r))},s_=e=>St({blockSize:e.blockSize,gatherAxis:e.gatherAxis,quantizeAxis:e.quantizeAxis})}),n_,o_,i_,a_,Kv=Be(()=>{ut(),mt(),Xt(),ft(),n_=e=>{if(!e||e.length!==2)throw new Error("GatherElements requires 2 inputs.");if(e[0].dims.length<1)throw new Error("GatherElements requires that the data input be rank >= 1.");if(e[0].dims.length!==e[1].dims.length)throw new Error(`GatherElements requires that the data input and + indices input tensors be of same rank.`)},o_=(e,r)=>{let t=e[0].dims,s=e[0].dataType,o=t.length,n=e[1].dims,i=e[1].dataType,a=Me.normalizeAxis(r.axis,o),l=t[a],u=n.slice(0),p=Me.size(u),d=Pe("input",s,o),c=Pe("indicesInput",i,n.length),f=Ye("output",s,u.length),_=[{type:12,data:p},{type:6,data:l},{type:12,data:a}];return _.push(...st(t,n,u)),{name:"GatherElements",shaderCache:{inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:u,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(p/64)},programUniforms:_}),getShaderSource:T=>` + ${T.registerUniform("outputSize","u32").registerUniform("axisDimLimit","i32").registerUniform("axis","u32").declareVariables(d,c,f)} + ${T.mainStart()} + ${T.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + + let outputIndices = ${f.offsetToIndices("global_idx")}; + + var idx = ${c.getByOffset("global_idx")}; + if (idx < 0) { + idx = idx + uniforms.axisDimLimit; + } + var inputIndices = ${d.type.indices}(outputIndices); + ${d.indicesSet("inputIndices","uniforms.axis","u32(idx)")}; + let value = ${d.getByIndices("inputIndices")}; + + ${f.setByOffset("global_idx","value")}; + }`}},i_=e=>St({axis:e.axis}),a_=(e,r)=>{let t=e.inputs;n_(t),e.compute(o_(e.inputs,r))}}),l_,u_,d_,c_,Hv=Be(()=>{ut(),mt(),ft(),l_=e=>{if(!e)throw new Error("Input is missing");if(e.length<2||e.length>3)throw new Error("Invaid input number.");if(e.length===3&&e[2].dims.length>2)throw new Error("Invalid input shape of C");if(e[0].dataType!==e[1].dataType||e.length===3&&e[0].dataType!==e[2].dataType)throw new Error("Input types are mismatched")},u_=(e,r)=>{let t=e[0].dims.slice(),s=e[1].dims.slice(),[o,n,i]=bc.getShapeOfGemmResult(t,r.transA,s,r.transB,e.length===3?e[2].dims:void 0),a=[o,n];if(!a)throw new Error("Can't use gemm on the given tensors");let l=16,u=Math.ceil(n/l),p=Math.ceil(o/l),d=!0,c=Me.size(a),f=[{type:12,data:d?u:c},{type:12,data:o},{type:12,data:n},{type:12,data:i},{type:1,data:r.alpha},{type:1,data:r.beta}],_=["type","type"];e.length===3&&(f.push(...st(e[2].dims)),_.push("rank")),f.push(...st(a));let T=w=>{let g="";r.transA&&r.transB?g="value += a[k * uniforms.M + m] * b[n * uniforms.K + k];":r.transA&&!r.transB?g="value += a[k * uniforms.M + m] * b[k * uniforms.N + n];":!r.transA&&r.transB?g="value += a[m * uniforms.K + k] * b[n * uniforms.K + k];":!r.transA&&!r.transB&&(g="value += a[m * uniforms.K + k] * b[k * uniforms.N + n];");let S=r.alpha===1?"":"value *= uniforms.alpha;",E=Pe("a",e[0].dataType,e[0].dims),y=Pe("b",e[1].dataType,e[1].dims),M=E.type.value,v=null,C=[E,y];e.length===3&&(v=Pe("c",e[2].dataType,e[2].dims.length),C.push(v));let A=Ye("output",e[0].dataType,a.length);C.push(A);let B=[{name:"output_size",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"},{name:"alpha",type:"f32"},{name:"beta",type:"f32"}];return` + ${w.registerUniforms(B).declareVariables(...C)} + + ${w.mainStart()} + ${w.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let m = global_idx / uniforms.N; + let n = global_idx % uniforms.N; + + var value = ${M}(0); + for (var k: u32 = 0u; k < uniforms.K; k++) { + ${g} + } + + ${S} + ${v!=null?`let cOffset = ${v.broadcastedIndicesToOffset("vec2(m, n)",A)}; value += ${M}(uniforms.beta) * ${v.getByOffset("cOffset")};`:""} + output[global_idx] = value; + }`},k=w=>{let g=Pe("a",e[0].dataType,e[0].dims),S=Pe("b",e[1].dataType,e[1].dims),E=null,y=[g,S];e.length===3&&(E=Pe("c",e[2].dataType,e[2].dims.length),y.push(E));let M=Ye("output",e[0].dataType,a.length);y.push(M);let v=[{name:"num_tile_n",type:"u32"},{name:"M",type:"u32"},{name:"N",type:"u32"},{name:"K",type:"u32"},{name:"alpha",type:"f32"},{name:"beta",type:"f32"}],C="",A="";r.transA&&r.transB?(A=` + var col = tile_row_start + local_id.x; + var row = k_start + local_id.y; + if (col < uniforms.M && row < uniforms.K) { + tile_a[local_id.y][local_id.x] = a[row * uniforms.M + col]; + } else { + tile_a[local_id.y][local_id.x] = ${g.type.value}(0); + } + + col = k_start + local_id.x; + row = tile_col_start + local_id.y; + if (col < uniforms.K && row < uniforms.N) { + tile_b[local_id.y][local_id.x] = b[row * uniforms.K + col]; + } else { + tile_b[local_id.y][local_id.x] = ${S.type.value}(0); + } + `,C="value += tile_a[k][local_id.y] * tile_b[local_id.x][k];"):r.transA&&!r.transB?(A=` + var col = tile_row_start + local_id.x; + var row = k_start + local_id.y; + if (col < uniforms.M && row < uniforms.K) { + tile_a[local_id.y][local_id.x] = a[row * uniforms.M + col]; + } else { + tile_a[local_id.y][local_id.x] = ${g.type.value}(0); + } + + col = tile_col_start + local_id.x; + row = k_start + local_id.y; + if (col < uniforms.N && row < uniforms.K) { + tile_b[local_id.y][local_id.x] = b[row * uniforms.N + col]; + } else { + tile_b[local_id.y][local_id.x] = ${S.type.value}(0); + } + `,C="value += tile_a[k][local_id.y] * tile_b[k][local_id.x];"):!r.transA&&r.transB?(A=` + var col = k_start + local_id.x; + var row = tile_row_start + local_id.y; + if (col < uniforms.K && row < uniforms.M) { + tile_a[local_id.y][local_id.x] = a[row * uniforms.K + col]; + } else { + tile_a[local_id.y][local_id.x] = ${g.type.value}(0); + } + + col = k_start + local_id.x; + row = tile_col_start + local_id.y; + if (col < uniforms.K && row < uniforms.N) { + tile_b[local_id.y][local_id.x] = b[row * uniforms.K + col]; + } else { + tile_b[local_id.y][local_id.x] = ${S.type.value}(0); + } + `,C="value += tile_a[local_id.y][k] * tile_b[local_id.x][k];"):!r.transA&&!r.transB&&(A=` + var col = k_start + local_id.x; + var row = tile_row_start + local_id.y; + if (col < uniforms.K && row < uniforms.M) { + tile_a[local_id.y][local_id.x] = a[row * uniforms.K + col]; + } else { + tile_a[local_id.y][local_id.x] = ${g.type.value}(0); + } + + col = tile_col_start + local_id.x; + row = k_start + local_id.y; + if (col < uniforms.N && row < uniforms.K) { + tile_b[local_id.y][local_id.x] = b[row * uniforms.N + col]; + } else { + tile_b[local_id.y][local_id.x] = ${S.type.value}(0); + } + `,C="value += tile_a[local_id.y][k] * tile_b[k][local_id.x];");let B=r.alpha===1?"":"value *= uniforms.alpha;";return` + ${w.registerUniforms(v).declareVariables(...y)} + var tile_a: array, ${l}>; + var tile_b: array, ${l}>; + ${w.mainStart([l,l,1])} + let tile_col_start = (workgroup_index % uniforms.num_tile_n) * ${l}; + let tile_row_start = (workgroup_index / uniforms.num_tile_n) * ${l}; + let num_tiles = (uniforms.K - 1) / ${l} + 1; + var k_start = 0u; + var value = ${M.type.value}(0); + for (var t: u32 = 0u; t < num_tiles; t++) { + ${A} + k_start = k_start + ${l}; + workgroupBarrier(); + + for (var k: u32 = 0u; k < ${l}; k++) { + ${C} + } + workgroupBarrier(); + } + + ${B} + let m = tile_row_start + local_id.y; + let n = tile_col_start + local_id.x; + ${E!=null?`let cOffset = ${E.broadcastedIndicesToOffset("vec2(m, n)",M)}; value += ${M.type.value}(uniforms.beta) * ${E.getByOffset("cOffset")};`:""} + if (m < uniforms.M && n < uniforms.N) { + output[m * uniforms.N + n] = value; + } + }`};return d?{name:"GemmShared",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:a,dataType:e[0].dataType}],dispatchGroup:{x:u*p},programUniforms:f}),getShaderSource:k}:{name:"Gemm",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:a,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:f}),getShaderSource:T}},d_=e=>{let r=e.transA,t=e.transB,s=e.alpha,o=e.beta;return{transA:r,transB:t,alpha:s,beta:o,cacheKey:`${e.transA};${e.transB};${e.alpha===1}`}},c_=(e,r)=>{l_(e.inputs),e.compute(u_(e.inputs,r))}}),ws,Ps,an,ln,p_,h_,m_,__,f_,g_,w_,M_,b_,y_,qv=Be(()=>{ut(),mt(),Xt(),ft(),[ws,Ps,an,ln]=[0,1,2,3],p_=e=>{if(e[0].dims.length!==4)throw new Error("only 4-D tensor is supported.");if(e[0].dims.length!==e[1].dims.length)throw new Error("input dimensions must be equal to grid dimensions");if(e[0].dims.length-2!==e[1].dims[e[1].dims.length-1])throw new Error(`last dimension of grid must be equal to ${e[0].dims.length-2}`);if(e[0].dims[0]!==e[1].dims[0])throw new Error("grid batch size must match input batch size")},h_=` + fn gs_get_cubic_coeffs(x: f32) -> vec4 { + let cubic_alpha = -0.75f; + let x_abs = abs(x); + var coeffs: vec4; + coeffs[0] = (((cubic_alpha * (x_abs + 1) - 5 * cubic_alpha) * (x_abs + 1) + 8 * cubic_alpha) * (x_abs + 1) - 4 * cubic_alpha); + coeffs[1] = (((cubic_alpha + 2) * x_abs - (cubic_alpha + 3)) * x_abs * x_abs + 1); + coeffs[2] = (((cubic_alpha + 2) * (1 - x_abs) - (cubic_alpha + 3)) * (1 - x_abs) * (1 - x_abs) + 1); + coeffs[3] = (((cubic_alpha * (2 - x_abs) - 5 * cubic_alpha) * (2 - x_abs) + 8 * cubic_alpha) * (2 - x_abs) - 4 * cubic_alpha); + return coeffs; + } +`,m_=e=>` + fn gs_bicubic_interpolate(p: mat4x4<${e}>, x: f32, y: f32) -> ${e} { + var v: vec4; + var coeffs = gs_get_cubic_coeffs(x); + for (var i = 0; i < 4; i++) { + v[i] = coeffs[0] * p[i][0] + coeffs[1] * p[i][1] + coeffs[2] * p[i][2] + coeffs[3] * p[i][3]; + } + coeffs = gs_get_cubic_coeffs(y); + let pixel = ${e}(coeffs[0] * v[0] + coeffs[1] * v[1] + coeffs[2] * v[2] + coeffs[3] * v[3]); + return pixel; + } +`,__=e=>` + fn gs_denormalize(n: f32, length: i32) -> f32 { + ${e.alignCorners===0?` + // alignCorners: false => [-1, 1] to [-0.5, length - 0.5] + return ((n + 1.0) * f32(length) - 1.0) / 2.0; + `:` + // alignCorners: true => [-1, 1] to [0, length - 1] + return (n + 1.0) / 2.0 * (f32(length - 1)); + `} + } +`,f_=e=>` + ${e.paddingMode==="reflection"?` + fn gs_reflect(x: i32, x_min: f32, x_max: f32) -> u32 { + var dx = 0.0; + var fx = f32(x); + let range = x_max - x_min; + if (fx < x_min) { + dx = x_min - fx; + let n = u32(dx / range); + let r = dx - f32(n) * range; + if (n % 2 == 0) { + fx = x_min + r; + } else { + fx = x_max - r; + } + } else if (fx > x_max) { + dx = fx - x_max; + let n = u32(dx / range); + let r = dx - f32(n) * range; + if (n % 2 == 0) { + fx = x_max - r; + } else { + fx = x_min + r; + } + } + return u32(fx); + }`:""} +`,g_=(e,r,t)=>` + fn pixel_at_grid(r: i32, c: i32, H: i32, W: i32, batch: u32, channel: u32, border: vec4) -> ${r} { + var pixel = ${r}(0); + var indices = vec4(0); + indices[${ws}] = batch; + indices[${Ps}] = channel;`+(()=>{switch(t.paddingMode){case"zeros":return` + if (r >= 0 && r < H && c >=0 && c < W) { + indices[${an}] = u32(r); + indices[${ln}] = u32(c); + } else { + return ${r}(0); + } + `;case"border":return` + indices[${an}] = u32(clamp(r, 0, H - 1)); + indices[${ln}] = u32(clamp(c, 0, W - 1)); + `;case"reflection":return` + indices[${an}] = gs_reflect(r, border[1], border[3]); + indices[${ln}] = gs_reflect(c, border[0], border[2]); + `;default:throw new Error(`padding mode ${t.paddingMode} is not supported`)}})()+` + return ${e.getByIndices("indices")}; + } +`,w_=(e,r,t)=>(()=>{switch(t.mode){case"nearest":return` + let result = pixel_at_grid(i32(round(y)), i32(round(x)), H_in, W_in, indices[${ws}], indices[${Ps}], border); + `;case"bilinear":return` + let x1 = i32(floor(x)); + let y1 = i32(floor(y)); + let x2 = x1 + 1; + let y2 = y1 + 1; + + let p11 = pixel_at_grid(y1, x1, H_in, W_in, indices[${ws}], indices[${Ps}], border); + let p12 = pixel_at_grid(y1, x2, H_in, W_in, indices[${ws}], indices[${Ps}], border); + let p21 = pixel_at_grid(y2, x1, H_in, W_in, indices[${ws}], indices[${Ps}], border); + let p22 = pixel_at_grid(y2, x2, H_in, W_in, indices[${ws}], indices[${Ps}], border); + + let dx2 = ${r}(f32(x2) - x); + let dx1 = ${r}(x - f32(x1)); + let dy2 = ${r}(f32(y2) - y); + let dy1 = ${r}(y - f32(y1)); + let result = dy2 * (dx2 * p11 + dx1 * p12) + dy1 * (dx2 * p21 + dx1 * p22); + `;case"bicubic":return` + let x0 = i32(floor(x)) - 1; + let y0 = i32(floor(y)) - 1; + var p: mat4x4<${r}>; + for (var h = 0; h < 4; h++) { + for (var w = 0; w < 4; w++) { + p[h][w] = pixel_at_grid(h + y0, w + x0, H_in, W_in, indices[${ws}], indices[${Ps}], border); + } + } + + let dx = x - f32(x0 + 1); + let dy = y - f32(y0 + 1); + let result = gs_bicubic_interpolate(p, dx, dy); + `;default:throw new Error(`mode ${t.mode} is not supported`)}})()+`${e.setByOffset("global_idx","result")}`,M_=(e,r)=>{let t=Pe("x",e[0].dataType,e[0].dims.length),s=[e[1].dims[0],e[1].dims[1],e[1].dims[2]],o=Pe("grid",e[1].dataType,s.length,2),n=[e[0].dims[0],e[0].dims[1],e[1].dims[1],e[1].dims[2]];r.format==="NHWC"&&(n=[e[0].dims[0],e[1].dims[1],e[1].dims[2],e[0].dims[3]],[ws,Ps,an,ln]=[0,3,1,2]);let i=Ye("output",e[0].dataType,n.length),a=t.type.value,l=Me.size(n),u=[{type:12,data:l},...st(e[0].dims,s,n)],p=d=>` + ${d.registerUniform("output_size","u32").declareVariables(t,o,i)} + ${h_} + ${m_(a)} + ${__(r)} + ${f_(r)} + ${g_(t,a,r)} + + ${d.mainStart()} + ${d.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let H_in = i32(uniforms.x_shape[${an}]); + let W_in = i32(uniforms.x_shape[${ln}]); + + ${r.alignCorners===0?` + let x_min = -0.5; + let x_max = f32(W_in) - 0.5; + let y_min = -0.5; + let y_max = f32(H_in) - 0.5; + `:` + let x_min = 0.0; + let x_max = f32(W_in) - 1.0; + let y_min = 0.0; + let y_max = f32(H_in) - 1.0; + `}; + let border = vec4(x_min, y_min, x_max, y_max); + + let indices = ${i.offsetToIndices("global_idx")}; + var grid_indices = vec3(indices[${ws}], indices[${an}], indices[${ln}]); + let nxy = ${o.getByIndices("grid_indices")}; + var x = gs_denormalize(f32(nxy[0]), W_in); + var y = gs_denormalize(f32(nxy[1]), H_in); + + ${w_(i,a,r)} + }`;return{name:"GridSample",shaderCache:{hint:`${r.cacheKey}`,inputDependencies:["type","type"]},getRunData:d=>{let c=Me.size(n);return{outputs:[{dims:n,dataType:d[0].dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:u}},getShaderSource:p}},b_=(e,r)=>{p_(e.inputs),e.compute(M_(e.inputs,r))},y_=e=>St({alignCorners:e.align_corners,mode:e.mode,paddingMode:e.padding_mode,format:e.format})}),Cr,v_,x_,Ol,T_,bo,E_,P_=Be(()=>{ut(),mt(),Xt(),el(),cl(),ft(),zs(),Cr=(e,r)=>e.length>r&&e[r].dims.length>0?e[r]:void 0,v_=(e,r)=>{let t=e[0],s=Cr(e,1),o=Cr(e,2),n=Cr(e,3),i=Cr(e,4),a=Cr(e,5),l=Cr(e,6),u=Cr(e,7);if(t.dims.length!==3&&t.dims.length!==5)throw new Error("Input query is expected to have 3 or 5 dimensions");let p=t.dims[0],d=t.dims[1],c=t.dims.length===3?t.dims[2]:r.numHeads*t.dims[4],f=d,_=0,T=0,k=Math.floor(c/r.numHeads);if(l&&u&&Me.size(l.dims)&&Me.size(u.dims)){if(l.dims.length!==4)throw new Error('Input "past_key" is expected to have 4 dimensions');if(l.dims[0]!==p||l.dims[1]!==r.numHeads||l.dims[3]!==k)throw new Error('Input "past_key" shape (batch_size, num_heads, past_sequence_length, head_size)');if(u.dims[0]!==p||u.dims[1]!==r.numHeads||u.dims[3]!==k)throw new Error('Input "past_value" shape (batch_size, num_heads, past_sequence_length, head_size)');if(l.dims[2]!==u.dims[2])throw new Error('Input "past_key" and "past_value" shall have same dim 2 (past_sequence_length)');if(u.dims.length!==4)throw new Error('Input "past_value" is expected to have 4 dimensions');_=l.dims[2],T=l.dims[2]}else if(l&&Me.size(l.dims)||u&&Me.size(u.dims))throw new Error('Input "past_key" and "past_value" shall be both present or both absent');let w;if(s&&Me.size(s.dims)>0){if(t.dims.length!==3)throw new Error('Input "query" is expected to have 3 dimensions when key is given');if(s.dims.length<3||s.dims.length>5)throw new Error('Input "key" is expected to have 3, 4, or 5 dimensions');if(t.dims[0]!==s.dims[0])throw new Error('Input "query" and "key" shall have same dim 0 (batch size)');if(s.dims.length===3){if(s.dims[2]!==t.dims[2])throw new Error('Input "query" and "key" shall have same dim 2 (hidden_size)');w=2,f=s.dims[1]}else if(s.dims.length===5){if(s.dims[2]!==r.numHeads||s.dims[3]!==2||s.dims[4]!==k)throw new Error('Expect "key" shape (batch_size, kv_sequence_length, num_heads, 2, head_size) for packed kv');if(o)throw new Error('Expect "value" be none when "key" has packed kv format.');w=5,f=s.dims[1]}else{if(s.dims[1]!==r.numHeads||s.dims[3]!==k)throw new Error('Expect "key" shape (batch_size, num_heads, kv_sequence_length, head_size) for past_key');w=0,f=s.dims[2]}}else{if(t.dims.length!==5)throw new Error('Input "query" is expected to have 5 dimensions when key is empty');if(t.dims[2]!==r.numHeads||t.dims[3]!==3)throw new Error('Expect "query" shape (batch_size, kv_sequence_length, num_heads, 3, head_size) for packed kv');w=3}if(n&&Me.size(n.dims)>0){if(n.dims.length!==1)throw new Error('Input "bias" is expected to have 1 dimension');if(s&&s.dims.length===5&&s.dims[3]===2)throw new Error("bias is not allowed for packed kv.")}let g=_+f,S=0;if(i&&Me.size(i.dims)>0){S=8;let v=i.dims;throw v.length===1?v[0]===p?S=1:v[0]===3*p+2&&(S=3):v.length===2&&v[0]===p&&v[1]===g&&(S=5),S===8?new Error('Input "key_padding_mask" shape shall be (batch_size) or (batch_size, total_sequence_length)'):new Error("Mask not supported")}let E=!1,y=c;if(o&&Me.size(o.dims)>0){if(o.dims.length!==3&&o.dims.length!==4)throw new Error('Input "value" is expected to have 3 or 4 dimensions');if(t.dims[0]!==o.dims[0])throw new Error('Input "query" and "value" shall have same dim 0 (batch_size)');if(o.dims.length===3){if(f!==o.dims[1])throw new Error('Input "key" and "value" shall have the same dim 1 (kv_sequence_length)');y=o.dims[2]}else{if(f!==o.dims[2])throw new Error('Input "key" and "value" shall have the same dim 2 (kv_sequence_length)');y=o.dims[1]*o.dims[3],E=!0}}let M=!1;if(i&&Me.size(i.dims)>0)throw new Error("Key padding mask is not supported");if(a&&Me.size(a.dims)>0){if(a.dims.length!==4)throw new Error('Input "attention_bias" is expected to have 4 dimensions');if(a.dims[0]!==p||a.dims[1]!==r.numHeads||a.dims[2]!==d||a.dims[3]!==g)throw new Error('Expect "attention_bias" shape (batch_size, num_heads, sequence_length, total_sequence_length)')}return{batchSize:p,sequenceLength:d,pastSequenceLength:_,kvSequenceLength:f,totalSequenceLength:g,maxSequenceLength:T,inputHiddenSize:0,hiddenSize:c,vHiddenSize:y,headSize:k,vHeadSize:Math.floor(y/r.numHeads),numHeads:r.numHeads,isUnidirectional:!1,pastPresentShareBuffer:!1,maskFilterValue:r.maskFilterValue,maskType:S,scale:r.scale,broadcastResPosBias:M,passPastInKv:E,qkvFormat:w}},x_=e=>St({...e}),Ol=St({perm:[0,2,1,3]}),T_=(e,r,t,s,o,n,i)=>{let a=[s,o,n],l=Me.size(a),u=[{type:12,data:l},{type:12,data:i},{type:12,data:n}],p=d=>{let c=Ye("qkv_with_bias",r.dataType,a),f=Pe("qkv",r.dataType,a),_=Pe("bias",t.dataType,a),T=[{name:"output_size",type:"u32"},{name:"bias_offset",type:"u32"},{name:"hidden_size",type:"u32"}];return` + ${d.registerUniforms(T).declareVariables(f,_,c)} + ${d.mainStart()} + ${d.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let bias_offset_idx = (global_idx % uniforms.hidden_size) + uniforms.bias_offset; + + qkv_with_bias[global_idx] = qkv[global_idx] + bias[bias_offset_idx]; + }`};return e.compute({name:"MultiHeadAttentionAddBias",shaderCache:{inputDependencies:["type","type"]},getRunData:()=>({outputs:[{dims:a,dataType:r.dataType,gpuDataType:0}],dispatchGroup:{x:Math.ceil(l/64)},programUniforms:u}),getShaderSource:p},{inputs:[r,t],outputs:[-1]})[0]},bo=(e,r,t,s,o,n,i,a)=>{let l=n;if(i&&Me.size(i.dims)>0){if(s===1)throw new Error("AddBiasReshape is not implemented. Please export your model with packed QKV or KV");return l=T_(e,n,i,r,s,t*o,a),l=l.reshape([r,s,t,o]),t===1||s===1?l:e.compute(Lr(l,Ol.perm),{inputs:[l],outputs:[-1]})[0]}else return n.dims.length===3&&(l=n.reshape([r,s,t,o])),t===1||s===1?l:e.compute(Lr(l,Ol.perm),{inputs:[l],outputs:[-1]})[0]},E_=(e,r)=>{let t=v_(e.inputs,r),s=e.inputs[0],o=Cr(e.inputs,1),n=Cr(e.inputs,2),i=Cr(e.inputs,3),a=Cr(e.inputs,4),l=Cr(e.inputs,5),u=Cr(e.inputs,6),p=Cr(e.inputs,7);if(s.dims.length===5)throw new Error("Packed QKV is not implemented");if((o==null?void 0:o.dims.length)===5)throw new Error("Packed KV is not implemented");let d=o&&n&&o.dims.length===4&&n.dims.length===4,c=bo(e,t.batchSize,t.numHeads,t.sequenceLength,t.headSize,s,i,0);if(d)return _o(e,c,o,n,a,void 0,u,p,l,t);if(!o||!n)throw new Error("key and value must be provided");let f=bo(e,t.batchSize,t.numHeads,t.kvSequenceLength,t.headSize,o,i,t.hiddenSize),_=bo(e,t.batchSize,t.numHeads,t.kvSequenceLength,t.vHeadSize,n,i,2*t.hiddenSize);_o(e,c,f,_,a,void 0,u,p,l,t)}}),C_,S_,$_,k_,Dl,I_,A_,F_=Be(()=>{ut(),mt(),Xt(),ft(),C_=e=>{if(!e||e.length<1)throw new Error("too few inputs")},S_=(e,r)=>{let t=[],s=r.numOutputs;return e[1].dims[0]>0&&(e[1].getBigInt64Array().forEach(o=>t.push(Number(o))),s=t.length),St({numOutputs:s,axis:r.axis,splitSizes:t})},$_=e=>` +fn calculateOutputIndex(index: u32) -> u32 { + for (var i: u32 = 0u; i < ${e}u; i += 1u ) { + if (index < ${et("uniforms.size_in_split_axis","i",e)}) { + return i; + } + } + return ${e}u; +}`,k_=e=>{let r=e.length,t=[];for(let s=0;s{let t=e[0].dims,s=Me.size(t),o=e[0].dataType,n=Me.normalizeAxis(r.axis,t.length),i=new Array(r.numOutputs),a=Pe("input",o,t.length),l=new Array(r.numOutputs),u=[],p=[],d=0,c=[{type:12,data:s}];for(let _=0;_` + ${_.registerUniform("input_size","u32").registerUniform("size_in_split_axis","u32",l.length).declareVariables(a,...i)} + ${$_(l.length)} + ${k_(i)} + + ${_.mainStart()} + ${_.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.input_size")} + + var indices = ${a.offsetToIndices("global_idx")}; + var index = ${a.indicesGet("indices",n)}; + let output_number = calculateOutputIndex(index); + if (output_number != 0) { + index -= ${et("uniforms.size_in_split_axis","output_number - 1u",l.length)}; + ${a.indicesSet("indices",n,"index")}; + } + writeBufferData(output_number, indices, global_idx); + }`;return{name:"Split",shaderCache:{hint:r.cacheKey,inputDependencies:["rank"]},getShaderSource:f,getRunData:()=>({outputs:u,dispatchGroup:{x:Math.ceil(s/64)},programUniforms:c})}},I_=(e,r)=>{C_(e.inputs);let t=e.inputs.length===1?r:S_(e.inputs,r);e.compute(Dl(e.inputs,t),{inputs:[0]})},A_=e=>{let r=e.axis,t=e.splitSizes,s=e.numOutputs<0?t.length:e.numOutputs;if(s!==t.length)throw new Error("numOutputs and splitSizes lengh must be equal");return St({axis:r,numOutputs:s,splitSizes:t})}}),O_,gi,D_,L_=Be(()=>{ut(),mt(),Xt(),ft(),O_=(e,r)=>{let[t,s,o,n]=e,{numHeads:i,rotaryEmbeddingDim:a}=r;if(t.dims.length!==3&&t.dims.length!==4)throw new Error(`Input 'x' is expected to have 3 or 4 dimensions, got ${t.dims.length}`);if(!Me.areEqual(s.dims,[])&&!Me.areEqual(s.dims,[1])&&s.dims.length!==2)throw new Error(`Input 'position_ids' is expected to have 0, 1, or 2 dimensions, got ${s.dims.length}`);if(o.dims.length!==2)throw new Error(`Input 'cos_cache' is expected to have 2 dimensions, got ${o.dims.length}`);if(n.dims.length!==2)throw new Error(`Input 'sin_cache' is expected to have 2 dimensions, got ${n.dims.length}`);if(!Me.areEqual(o.dims,n.dims))throw new Error("Inputs 'cos_cache' and 'sin_cache' are expected to have the same shape");if(a>0&&i===0)throw new Error("num_heads must be provided if rotary_embedding_dim is specified");let l=t.dims[0],u=t.dims[t.dims.length-2],p=o.dims[0],d=Me.sizeFromDimension(t.dims,1)/u,c=a===0?o.dims[1]*2:d/i;if(a>c)throw new Error("rotary_embedding_dim must be less than or equal to head_size");if(s.dims.length===2){if(l!==s.dims[0])throw new Error(`Input 'position_ids' dimension 0 should be of size batch_size, got ${s.dims[0]}`);if(u!==s.dims[1])throw new Error(`Input 'position_ids' dimension 1 should be of size sequence_length, got ${s.dims[1]}`)}if(c/2!==o.dims[1]&&a/2!==o.dims[1])throw new Error(`Input 'cos_cache' dimension 1 should be same as head_size / 2 or rotary_embedding_dim / 2, got ${o.dims[1]}`);if(u>p)throw new Error("Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported")},gi=(e,r)=>{let{interleaved:t,numHeads:s,rotaryEmbeddingDim:o,scale:n}=r,i=e[0].dims[0],a=Me.sizeFromDimension(e[0].dims,1),l=e[0].dims[e[0].dims.length-2],u=a/l,p=e[2].dims[1],d=o===0?p*2:u/s,c=new Array(i,l,u/d,d-p),f=Me.computeStrides(c),_=[{type:1,data:n},{type:12,data:c},{type:12,data:f},...e[0].dims.length===3?new Array({type:12,data:[a,u,d,1]}):[],...e[0].dims.length===4?new Array({type:12,data:[a,d,l*d,1]}):[],...st(e[0].dims,e[1].dims,e[2].dims,e[3].dims,e[0].dims)],T=k=>{let w=Pe("input",e[0].dataType,e[0].dims.length),g=Pe("position_ids",e[1].dataType,e[1].dims.length),S=Pe("cos_cache",e[2].dataType,e[2].dims.length),E=Pe("sin_cache",e[3].dataType,e[3].dims.length),y=Ye("output",e[0].dataType,e[0].dims.length);return k.registerUniforms([{name:"scale",type:"f32"},{name:"global_shape",type:"u32",length:c.length},{name:"global_strides",type:"u32",length:f.length},{name:"input_output_strides",type:"u32",length:f.length}]),` + ${k.declareVariables(w,g,S,E,y)} + + ${k.mainStart(Vn)} + let half_rotary_emb_dim = uniforms.${S.name}_shape[1]; + let bsnh = global_idx / uniforms.global_strides % uniforms.global_shape; + let size = uniforms.global_shape[0] * uniforms.global_strides[0]; + ${k.guardAgainstOutOfBoundsWorkgroupSizes("size")} + + if (bsnh[3] < half_rotary_emb_dim) { + let position_ids_idx = + ${g.broadcastedIndicesToOffset("bsnh.xy",Ye("",g.type.tensor,2))}; + let position_id = + u32(${g.getByOffset("position_ids_idx")}) + select(0, bsnh[1], position_ids_idx == 0); + let i = dot(bsnh, uniforms.input_output_strides) + select(0, bsnh[3], ${t}); + let j = i + select(half_rotary_emb_dim, 1, ${t}); + let re = ${w.getByOffset("i")} * ${S.get("position_id","bsnh[3]")} - + ${w.getByOffset("j")} * ${E.get("position_id","bsnh[3]")}; + ${y.setByOffset("i","re")} + let im = ${w.getByOffset("i")} * ${E.get("position_id","bsnh[3]")} + + ${w.getByOffset("j")} * ${S.get("position_id","bsnh[3]")}; + ${y.setByOffset("j","im")} + } else { + let k = dot(bsnh, uniforms.input_output_strides) + half_rotary_emb_dim; + ${y.setByOffset("k",w.getByOffset("k"))} + } + }`};return{name:"RotaryEmbedding",shaderCache:{hint:St({interleaved:t}).cacheKey,inputDependencies:["rank","rank","rank","rank"]},getShaderSource:T,getRunData:()=>({outputs:[{dims:e[0].dims,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(Me.size(c)/Vn)},programUniforms:_})}},D_=(e,r)=>{O_(e.inputs,r),e.compute(gi(e.inputs,r))}}),z_,B_,Ll,R_,j_,Xv=Be(()=>{Xt(),ut(),cl(),P_(),F_(),zs(),L_(),ft(),z_=(e,r)=>{if(r.doRotary&&e.length<=7)throw new Error("cos_cache and sin_cache inputs are required if do_rotary is specified");let t=e[0],s=e[1],o=e[2],n=e[3],i=e[4];if(r.doRotary!==0&&e.length<=7)throw new Error("cos_cast and sin_cache are expected if do_rotary attribute is non-zero");if(r.localWindowSize!==-1)throw new Error("Local attention is not supported");if(r.softcap!==0)throw new Error("Softcap is not supported");if(r.rotaryInterleaved!==0)throw new Error("Rotary interleaved is not supported");if(r.smoothSoftmax)throw new Error("Smooth softmax is not supported");if(t.dims.length!==3&&t.dims.length!==5)throw new Error("Input query is expected to have 3 or 5 dimensions");let a=!1,l=t.dims[0],u=t.dims[1],p=t.dims.length===3?a?t.dims[2]/3:t.dims[2]:r.numHeads*t.dims[4],d=u,c=0,f=!s||s.dims.length===0,_=Math.floor(f?p/(r.numHeads+2*r.kvNumHeads):p/r.numHeads);f&&(p=_*r.numHeads);let T=n&&n.dims.length!==0,k=i&&i.dims.length!==0;if(T&&n.dims.length===4&&n.dims[0]===l&&n.dims[1]!==r.kvNumHeads&&n.dims[2]===r.kvNumHeads&&n.dims[3]===_)throw new Error("BSNH pastKey/pastValue is not supported");if(T&&k){if(n.dims.length!==4)throw new Error('Input "past_key" is expected to have 4 dimensions');if(i.dims.length!==4)throw new Error('Input "past_value" is expected to have 4 dimensions');c=n.dims[2]}else if(T||k)throw new Error('Input "past_key" and "past_value" shall be both present or both absent');let w=1;if(s&&s.dims.length>0){if(t.dims.length!==3)throw new Error('Input "query" is expected to have 3 dimensions when key is given');if(s.dims.length<3||s.dims.length>5)throw new Error('Input "key" is expected to have 3, 4, or 5 dimensions');if(t.dims[0]!==s.dims[0])throw new Error('Input "query" and "key" shall have same dim 0 (batch size)');if(s.dims.length===3){if(t.dims[2]%s.dims[2]!==0)throw new Error('Dimension 2 of "query" should be a multiple of "key"');d=s.dims[1]}else if(s.dims.length===5){if(s.dims[2]!==r.numHeads||s.dims[3]!==2||s.dims[4]!==_)throw new Error('Expect "key" shape (batch_size, kv_sequence_length, num_heads, 2, head_size) for packed kv');if(o)throw new Error('Expect "value" be none when "key" has packed kv format.');d=s.dims[1]}else{if(s.dims[1]!==r.numHeads||s.dims[3]!==_)throw new Error('Expect "key" shape (batch_size, num_heads, kv_sequence_length, head_size) for past_key');d=s.dims[2]}}else{if(t.dims.length!==3&&t.dims.length!==5)throw new Error('Input "query" is expected to have 3 or 5 dimensions when key is empty');if(t.dims.length===5&&(t.dims[2]!==r.numHeads||t.dims[3]!==3))throw new Error('Expect "query" shape (batch_size, kv_sequence_length, num_heads, 3, head_size) for packed kv');w=3}let g=0,S=!1,E=r.kvNumHeads?_*r.kvNumHeads:p;if(o&&o.dims.length>0){if(o.dims.length!==3&&o.dims.length!==4)throw new Error('Input "value" is expected to have 3 or 4 dimensions');if(t.dims[0]!==o.dims[0])throw new Error('Input "query" and "value" shall have same dim 0 (batch_size)');if(o.dims.length===3){if(d!==o.dims[1])throw new Error('Input "key" and "value" shall have the same dim 1 (kv_sequence_length)');E=o.dims[2]}else{if(d!==o.dims[2])throw new Error('Input "past_key" and "past_value" shall have the same dim 2 (kv_sequence_length)');E=o.dims[1]*o.dims[3],S=!0}}let y=e.length>4?e[5]:void 0;if(y&&y.dims.length!==1&&y.dims[0]!==l)throw new Error('Input "seqlens" is expected to have 1 dimension and the same dim 0 as batch_size');return{batchSize:l,sequenceLength:u,pastSequenceLength:c,kvSequenceLength:d,totalSequenceLength:-1,maxSequenceLength:-1,inputHiddenSize:0,hiddenSize:p,vHiddenSize:E,headSize:_,vHeadSize:Math.floor(E/r.kvNumHeads),numHeads:r.numHeads,kvNumHeads:r.kvNumHeads,nReps:r.numHeads/r.kvNumHeads,pastPresentShareBuffer:!1,maskType:g,scale:r.scale,broadcastResPosBias:!1,passPastInKv:S,qkvFormat:w}},B_=St({perm:[0,2,1,3]}),Ll=(e,r,t)=>{let s=r,o=t.kvNumHeads;return r.dims.length===3&&t.kvSequenceLength!==0&&(s=r.reshape([t.batchSize,t.kvSequenceLength,o,t.headSize]),s=e.compute(Lr(s,B_.perm),{inputs:[s],outputs:[-1]})[0]),s},R_=(e,r,t,s)=>{let o=7,n=["type","type"],i=[e*r],a=e*r,l=[{type:12,data:a},{type:12,data:r},{type:12,data:e}],u=p=>{let d=Pe("seq_lens",t.dataType,t.dims),c=Pe("total_seq_lens",s.dataType,s.dims),f=Ye("pos_ids",o,i),_=[{name:"output_size",type:"u32"},{name:"sequence_length",type:"u32"},{name:"batch_size",type:"u32"}];return` + ${p.registerUniforms(_).declareVariables(d,c,f)} + ${p.mainStart()} + ${p.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let total_sequence_length = u32(${c.getByOffset("0")}); + let is_subsequent_prompt = uniforms.sequence_length > 1 && uniforms.sequence_length != total_sequence_length; + let is_first_prompt = !is_subsequent_prompt && uniforms.sequence_length == total_sequence_length; + let batch_idx = global_idx / uniforms.sequence_length; + let sequence_idx = i32(global_idx % uniforms.sequence_length); + var pos_id: i32 = 0; + let seqlen = ${d.getByOffset("batch_idx")}; + let total_seqlen = seqlen + 1; + if (is_first_prompt) { + if (sequence_idx < total_seqlen) { + pos_id = sequence_idx; + } else { + pos_id = 1; + } + ${f.setByOffset("global_idx","pos_id")} + } else if (is_subsequent_prompt) { + let past_seqlen = total_seqlen - i32(uniforms.sequence_length); + if (past_seqlen + sequence_idx < total_seqlen) { + pos_id = past_seqlen + sequence_idx; + } else { + pos_id = 1; + } + ${f.setByOffset("global_idx","pos_id")} + } else if (global_idx < uniforms.batch_size) { + ${f.setByOffset("global_idx","seqlen")} + }; + } + `};return{name:"GeneratePositionIds",shaderCache:{hint:`${e};${r}`,inputDependencies:n},getRunData:()=>({outputs:[{dims:i,dataType:o}],dispatchGroup:{x:Math.ceil(a/64)},programUniforms:l}),getShaderSource:u}},j_=(e,r)=>{var E;let t=z_(e.inputs,r);if(e.inputs[0].dims.length===5)throw new Error("Packed QKV is not implemented");if(((E=e.inputs[1])==null?void 0:E.dims.length)===5)throw new Error("Packed KV is not implemented");let s=e.inputs[0],o=e.inputs[1]&&e.inputs[1].dims.length>0?e.inputs[1]:void 0,n=e.inputs[2]&&e.inputs[2].dims.length>0?e.inputs[2]:void 0,i=e.inputs[3]&&e.inputs[3].dims.length!==0?e.inputs[3]:void 0,a=e.inputs[4]&&e.inputs[4].dims.length!==0?e.inputs[4]:void 0,l=e.inputs.length>4?e.inputs[5]:void 0,u=e.inputs.length>5?e.inputs[6]:void 0,p=t.kvNumHeads?t.kvNumHeads:t.numHeads,d=St({axis:2,numOutputs:3,splitSizes:[t.numHeads*t.headSize,p*t.headSize,p*t.headSize]}),[c,f,_]=!o&&!n?e.compute(Dl([s],d),{inputs:[s],outputs:[-1,-1,-1]}):[s,o,n],T,k;if(r.doRotary){let y=e.compute(R_(t.batchSize,t.sequenceLength,l,u),{inputs:[l,u],outputs:[-1]})[0],M=e.inputs[7],v=e.inputs[8],C=St({interleaved:r.rotaryInterleaved!==0,numHeads:t.numHeads,rotaryEmbeddingDim:0,scale:r.scale}),A=[c,y,M,v],B=[-1];T=e.compute(gi(A,C),{inputs:A,outputs:B})[0],A.splice(0,1,f);let K=St({interleaved:r.rotaryInterleaved!==0,numHeads:t.kvNumHeads,rotaryEmbeddingDim:0,scale:r.scale});k=e.compute(gi(A,K),{inputs:A,outputs:B})[0]}let w=bo(e,t.batchSize,t.numHeads,t.sequenceLength,t.headSize,r.doRotary?T:c,void 0,0),g=Ll(e,r.doRotary?k:f,t),S=Ll(e,_,t);_o(e,w,g,S,void 0,void 0,i,a,void 0,t,l,u)}}),zl,N_,V_,U_,Qv=Be(()=>{ut(),mt(),zs(),ft(),zl=(e,r,t,s,o,n,i,a)=>{let l=Kt(n),u=l===1?"f32":`vec${l}f`,p=l===1?"vec2f":`mat2x${l}f`,d=o*i,c=64;d===1&&(c=256);let f=[o,i,n/l],_=[o,i,2],T=["rank","type","type"],k=[];k.push(...st(f,_));let w=g=>{let S=Pe("x",r.dataType,3,l),E=Pe("scale",t.dataType,t.dims),y=Pe("bias",s.dataType,s.dims),M=Ye("output",1,3,2),v=[S,E,y,M];return` + var workgroup_shared : array<${p}, ${c}>; + const workgroup_size = ${c}u; + ${g.declareVariables(...v)} + ${g.mainStart(c)} + let batch = workgroup_index / uniforms.x_shape[1]; + let channel = workgroup_index % uniforms.x_shape[1]; + let hight = uniforms.x_shape[2]; + // initialize workgroup memory + var sum = ${u}(0); + var squared_sum = ${u}(0); + for (var h = local_idx; h < hight; h += workgroup_size) { + let value = ${u}(${S.get("batch","channel","h")}); + sum += value; + squared_sum += value * value; + } + workgroup_shared[local_idx] = ${p}(sum, squared_sum); + workgroupBarrier(); + + for (var currSize = workgroup_size >> 1; currSize > 0; currSize = currSize >> 1) { + if (local_idx < currSize) { + workgroup_shared[local_idx] = workgroup_shared[local_idx] + workgroup_shared[local_idx + currSize]; + } + workgroupBarrier(); + } + if (local_idx == 0) { + let sum_final = ${Ls("workgroup_shared[0][0]",l)} / f32(hight * ${l}); + let squared_sum_final = ${Ls("workgroup_shared[0][1]",l)} / f32(hight * ${l}); + + let inv_std_dev = inverseSqrt(squared_sum_final - sum_final * sum_final + f32(${a})); + let channel_scale = inv_std_dev * f32(scale[channel]); + let channel_shift = f32(bias[channel]) - sum_final * channel_scale; + output[workgroup_index] = vec2f(channel_scale, channel_shift); + } + }`};return e.compute({name:"InstanceNormComputeChannelScaleShift",shaderCache:{hint:`${l};${a};${c}`,inputDependencies:T},getRunData:()=>({outputs:[{dims:_,dataType:1}],dispatchGroup:{x:d},programUniforms:k}),getShaderSource:w},{inputs:[r,t,s],outputs:[-1]})[0]},N_=(e,r,t)=>{let s=r[0].dims,o=s,n=2,i=s[0],a=s[1],l=Me.sizeFromDimension(s,n),u=Kt(l),p=Me.size(o)/u,d=zl(e,r[0],r[1],r[2],i,l,a,t.epsilon),c=[i,a,l/u],f=[i,a],_=["type","none"],T=k=>{let w=Pe("x",r[0].dataType,c.length,u),g=Pe("scale_shift",1,f.length,2),S=Ye("output",r[0].dataType,c.length,u),E=[w,g,S];return` + ${k.registerUniform("output_size","u32").declareVariables(...E)} + ${k.mainStart()} + ${k.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let outputIndices = ${S.offsetToIndices("global_idx")}; + let batch = outputIndices[0]; + let channel = outputIndices[1]; + let scale_shift = ${g.getByIndices("vec2(batch, channel)")}; + let value = ${w.getByOffset("global_idx")} * ${S.type.value}(scale_shift.x) + ${S.type.value}(scale_shift.y); + ${S.setByOffset("global_idx","value")}; + }`};e.compute({name:"InstanceNormalization",shaderCache:{hint:`${u}`,inputDependencies:_},getRunData:()=>({outputs:[{dims:o,dataType:r[0].dataType}],dispatchGroup:{x:Math.ceil(p/64)},programUniforms:[{type:12,data:p},...st(c,f,c)]}),getShaderSource:T},{inputs:[r[0],d]})},V_=(e,r,t)=>{let s=r[0].dims,o=s,n=s[0],i=s[s.length-1],a=Me.sizeFromDimension(s,1)/i,l=Kt(i),u=Me.size(o)/l,p=[{type:12,data:a},{type:12,data:Math.floor(i/l)}],d=["type","type"],c=!1,f=[0,s.length-1];for(let w=0;ws[f[g]])),T=zl(e,_,r[1],r[2],n,a,i,t.epsilon),k=w=>{let g=lr(r[0].dataType),S=l===1?"vec2f":`mat${l}x2f`,E=v=>{let C=v===0?"x":"y",A=l===1?"f32":`vec${l}f`;switch(l){case 1:return`${g}(${A}(scale.${C}))`;case 2:return`vec2<${g}>(${A}(scale[0].${C}, scale[1].${C}))`;case 4:return`vec4<${g}>(${A}(scale[0].${C}, scale[1].${C}, scale[2].${C}, scale[3].${C}))`;default:throw new Error(`Not supported compoents ${l}`)}},y=Pe("input",r[0].dataType,r[0].dims,l),M=Ye("output",r[0].dataType,o,l);return` + @group(0) @binding(0) var input : array<${y.type.storage}>; + @group(0) @binding(1) var scale_input : array<${S}>; + @group(0) @binding(2) var output : array<${M.type.storage}>; + struct Uniforms {H: u32, C : u32}; + @group(0) @binding(3) var uniforms: Uniforms; + + ${w.mainStart()} + let current_image_number = global_idx / (uniforms.C * uniforms.H); + let current_channel_number = global_idx % uniforms.C; + + let scale_offset = current_image_number * uniforms.C + current_channel_number; + let scale = scale_input[scale_offset]; + output[global_idx] = fma(input[global_idx], ${E(0)}, ${E(1)}); + }`};e.compute({name:"InstanceNormalizationNHWC",shaderCache:{hint:`${l}`,inputDependencies:d},getRunData:()=>({outputs:[{dims:o,dataType:r[0].dataType}],dispatchGroup:{x:Math.ceil(u/64)},programUniforms:p}),getShaderSource:k},{inputs:[r[0],T]})},U_=(e,r)=>{r.format==="NHWC"?V_(e,e.inputs,r):N_(e,e.inputs,r)}}),W_,G_,K_,Jv=Be(()=>{ut(),mt(),ft(),W_=e=>{if(!e||e.length<2)throw new Error("layerNorm requires at least 2 inputs.")},G_=(e,r,t)=>{let s=r.simplified,o=e[0].dims,n=e[1],i=!s&&e[2],a=o,l=Me.normalizeAxis(r.axis,o.length),u=Me.sizeToDimension(o,l),p=Me.sizeFromDimension(o,l),d=Me.size(n.dims),c=i?Me.size(i.dims):0;if(d!==p||i&&c!==p)throw new Error(`Size of X.shape()[axis:] == ${p}. + Size of scale and bias (if provided) must match this. + Got scale size of ${d} and bias size of ${c}`);let f=[];for(let y=0;y1,g=t>2,S=y=>{let M=lr(e[0].dataType),v=[Pe("x",e[0].dataType,e[0].dims,_),Pe("scale",n.dataType,n.dims,_)];i&&v.push(Pe("bias",i.dataType,i.dims,_)),v.push(Ye("output",e[0].dataType,a,_)),w&&v.push(Ye("mean_data_output",1,f)),g&&v.push(Ye("inv_std_output",1,f));let C=[{name:"norm_count",type:"u32"},{name:"norm_size",type:"f32"},{name:"norm_size_vectorized",type:"u32"},{name:"epsilon",type:"f32"}];return` + ${y.registerUniforms(C).declareVariables(...v)} + ${y.mainStart()} + ${y.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.norm_count")} + let offset = global_idx * uniforms.norm_size_vectorized; + var mean_vector = ${nl("f32",_)}; + var mean_square_vector = ${nl("f32",_)}; + + for (var h: u32 = 0u; h < uniforms.norm_size_vectorized; h++) { + let value = ${Un(M,_,"x[h + offset]")}; + mean_vector += value; + mean_square_vector += value * value; + } + let mean = ${Ls("mean_vector",_)} / uniforms.norm_size; + let inv_std_dev = inverseSqrt(${Ls("mean_square_vector",_)} / uniforms.norm_size ${s?"":"- mean * mean"} + uniforms.epsilon); + + for (var j: u32 = 0; j < uniforms.norm_size_vectorized; j++) { + let f32input = ${Un(M,_,"x[j + offset]")}; + let f32scale = ${Un(M,_,"scale[j]")}; + output[j + offset] = ${v[0].type.value}((f32input ${s?"":"- mean"}) * inv_std_dev * f32scale + ${i?`+ ${Un(M,_,"bias[j]")}`:""} + ); + } + + ${w?"mean_data_output[global_idx] = mean":""}; + ${g?"inv_std_output[global_idx] = inv_std_dev":""}; + }`},E=[{dims:a,dataType:e[0].dataType}];return w&&E.push({dims:f,dataType:1}),g&&E.push({dims:f,dataType:1}),{name:"LayerNormalization",shaderCache:{hint:`${_};${t};${s}`,inputDependencies:T},getRunData:()=>({outputs:E,dispatchGroup:{x:Math.ceil(u/64)},programUniforms:k}),getShaderSource:S}},K_=(e,r)=>{W_(e.inputs),e.compute(G_(e.inputs,r,e.outputCount))}}),H_,q_,Yv=Be(()=>{mt(),Ml(),xl(),H_=e=>{if(!e||e.length!==2)throw new Error("MatMul requires 2 inputs.");if(e[0].dims[e[0].dims.length-1]!==e[1].dims[e[1].dims.length-2])throw new Error("shared dimension does not match.")},q_=e=>{H_(e.inputs);let r=Nn.calcShape(e.inputs[0].dims,e.inputs[1].dims,!0);if(!r)throw new Error("Can't use matmul on the given tensors");let t=r[r.length-1],s=e.inputs[0].dims[e.inputs[0].dims.length-1];if(t<8&&s<8)e.compute(wl(e.inputs,{activation:""},r));else{let o=r[r.length-2],n=Me.size(e.inputs[0].dims.slice(0,-2)),i=Me.size(e.inputs[1].dims.slice(0,-2));if(n!==1&&o===1&&i===1){let a=e.inputs[0].reshape([1,n,s]),l=e.inputs[1].reshape([1,s,t]),u=[1,n,t],p=[a,l];e.compute(hi(p,{activation:""},r,u),{inputs:p})}else e.compute(hi(e.inputs,{activation:""},r))}}}),X_,Q_,J_,Y_,Z_,Zv=Be(()=>{ut(),mt(),Xt(),ft(),X_=(e,r)=>{if(e.length<3||e.length>4)throw new Error("MatMulNBits requires 3 or 4 inputs");let t=e[0],s=t.dims.length;if(t.dims[s-1]!==r.k)throw new Error("The last dim of input shape does not match the k value");let o=Math.floor((r.k+r.blockSize-1)/r.blockSize),n=r.blockSize/8*r.bits,i=e[1];if(!Me.areEqual(i.dims,[r.n,o,n]))throw new Error("The second inputs must be 3D tensor with shape N X nBlocksPerCol X blobSize");let a=e[2].dims;if(Me.size(a)!==r.n*o)throw new Error("scales input size error.");if(e.length===4){let l=e[3].dims,u=r.bits>4?r.n*o:r.n*Math.floor((o+1)/2);if(Me.size(l)!==u)throw new Error("zeroPoints input size error.")}},Q_=(e,r)=>{let t=e[0].dims,s=t.length,o=t[s-2],n=r.k,i=r.n,a=t.slice(0,s-2),l=Me.size(a),u=e[1].dims[2]/4,p=e[0].dataType,d=Kt(r.k),c=Kt(u),f=Kt(i),_=a.concat([o,i]),T=o>1&&i/f%2===0?2:1,k=Me.size(_)/f/T,w=64,g=[],S=[l,o,n/d],E=Me.convertShape(e[1].dims).slice();E.splice(-1,1,u/c),g.push(...st(S)),g.push(...st(E)),g.push(...st(e[2].dims)),e.length===4&&g.push(...st(Me.convertShape(e[3].dims)));let y=[l,o,i/f];g.push(...st(y));let M=v=>{let C=S.length,A=Pe("a",e[0].dataType,C,d),B=Pe("b",12,E.length,c),K=Pe("scales",e[2].dataType,e[2].dims.length),G=[A,B,K],j=e.length===4?Pe("zero_points",12,e[3].dims.length):void 0;j&&G.push(j);let ee=y.length,H=Ye("output",e[0].dataType,ee,f),Z=lr(e[0].dataType),X=(()=>{switch(d){case 1:return`array<${Z}, 8>`;case 2:return`mat4x2<${Z}>`;case 4:return`mat2x4<${Z}>`;default:throw new Error(`${d}-component is not supported.`)}})(),oe=()=>{let V=` + // reuse a data + var input_offset = ${A.indicesToOffset(`${A.type.indices}(batch, row, word_offset)`)}; + var a_data: ${X}; + for (var j: u32 = 0; j < ${8/d}; j++) { + a_data[j] = ${A.getByOffset("input_offset")}; + input_offset++; + } + `;for(let F=0;F> 4) & b_mask); + b_quantized_values = ${X}(${Array.from({length:4},(W,re)=>`${Z}(b_value_lower[${re}]), ${Z}(b_value_upper[${re}])`).join(", ")}); + b_dequantized_values = ${d===1?`${X}(${Array.from({length:8},(W,re)=>`(b_quantized_values[${re}] - ${j?`zero_point${F}`:"zero_point"}) * scale${F}`).join(", ")});`:`(b_quantized_values - ${X}(${Array(8).fill(`${j?`zero_point${F}`:"zero_point"}`).join(",")})) * scale${F};`}; + workgroup_shared[local_id.x * ${T} + ${Math.floor(F/f)}]${f>1?`[${F%f}]`:""} += ${Array.from({length:8/d},(W,re)=>`${d===1?`a_data[${re}] * b_dequantized_values[${re}]`:`dot(a_data[${re}], b_dequantized_values[${re}])`}`).join(" + ")}; + `;return V},me=()=>{let V=` + var col_index = col * ${f}; + ${j?` + let zero_point_bytes_per_col = (nBlocksPerCol + 1) / 2; + var zero_point_byte_count: u32; + var zero_point_word_index: u32; + var zero_point_byte_offset: u32; + let zero_point_nibble_offset: u32 = block & 0x1u; + var zero_point_bits_offset: u32; + var zero_point_word: u32;`:` + // The default zero point is 8 for unsigned 4-bit quantization. + let zero_point = ${Z}(8);`} + `;for(let F=0;F> 0x1u); + zero_point_word_index = zero_point_byte_count >> 0x2u; + zero_point_byte_offset = zero_point_byte_count & 0x3u; + zero_point_bits_offset = (zero_point_byte_offset << 3) + (zero_point_nibble_offset << 2); + zero_point_word = ${j.getByOffset("zero_point_word_index")} >> zero_point_bits_offset; + let zero_point${F} = ${Z}((zero_point_word) & 0xFu);`:""} + col_index += 1;`;return V},ae=()=>{let V=`col_index = col * ${f};`;for(let F=0;F; + var b_value_upper: vec4; + var b_quantized_values: ${X}; + var b_dequantized_values: ${X};`,V};return` + var workgroup_shared: array<${H.type.value}, ${T*w}>; + ${v.declareVariables(...G,H)} + ${v.mainStart([w,1,1])} + let output_indices = ${H.offsetToIndices(`(global_idx / ${w}) * ${T}`)}; + let col = output_indices[2]; + let row = output_indices[1]; + let batch = output_indices[0]; + let nBlocksPerCol = uniforms.b_shape[1]; + + for (var block = local_id.x; block < nBlocksPerCol; block += ${w}) { + //process one block + var word_offset: u32 = block * ${r.blockSize/d}; + ${me()} + for (var word: u32 = 0; word < ${u}; word += ${c}) { + ${ae()} + for (var i: u32 = 0; i < ${c}; i++) { + ${oe()} + word_offset += ${8/d}; + } + } + } + workgroupBarrier(); + + if (local_id.x < ${T}) { + var output_value: ${H.type.value} = ${H.type.value}(0); + var workgroup_shared_offset: u32 = local_id.x; + for (var b: u32 = 0u; b < ${w}u; b++) { + output_value += workgroup_shared[workgroup_shared_offset]; + workgroup_shared_offset += ${T}; + } + ${H.setByIndices(`${H.type.indices}(batch, row, col + local_id.x)`,"output_value")}; + } + }`};return{name:"MatMulNBits",shaderCache:{hint:`${r.blockSize};${r.bits};${d};${c};${f};${T};${w}`,inputDependencies:Array(e.length).fill("rank")},getRunData:()=>({outputs:[{dims:_,dataType:p}],dispatchGroup:{x:k},programUniforms:g}),getShaderSource:M}},J_=(e,r)=>{let t=e[0].dims,s=t.length,o=t[s-2],n=r.k,i=r.n,a=t.slice(0,s-2),l=Me.size(a),u=e[1].dims[2]/4,p=e[0].dataType,d=Kt(r.k),c=Kt(u),f=a.concat([o,i]),_=128,T=i%8===0?8:i%4===0?4:1,k=_/T,w=k*c*8,g=w/d,S=w/r.blockSize,E=Me.size(f)/T,y=[],M=[l,o,n/d],v=Me.convertShape(e[1].dims).slice();v.splice(-1,1,u/c),y.push(...st(M)),y.push(...st(v)),y.push(...st(e[2].dims)),e.length===4&&y.push(...st(Me.convertShape(e[3].dims)));let C=[l,o,i];y.push(...st(C));let A=B=>{let K=M.length,G=Pe("a",e[0].dataType,K,d),j=Pe("b",12,v.length,c),ee=Pe("scales",e[2].dataType,e[2].dims.length),H=[G,j,ee],Z=e.length===4?Pe("zero_points",12,e[3].dims.length):void 0;Z&&H.push(Z);let X=C.length,oe=Ye("output",e[0].dataType,X),me=lr(e[0].dataType),ae=()=>{switch(d){case 1:return` + let a_data0 = vec4<${me}>(sub_a[word_offset], sub_a[word_offset + 1], sub_a[word_offset + 2], sub_a[word_offset + 3]); + let a_data1 = vec4<${me}>(sub_a[word_offset + 4], sub_a[word_offset + 5], sub_a[word_offset + 6], sub_a[word_offset + 7]);`;case 2:return` + let a_data0 = vec4<${me}>(sub_a[word_offset], sub_a[word_offset + 1]); + let a_data1 = vec4<${me}>(sub_a[word_offset + 2], sub_a[word_offset + 3]);`;case 4:return` + let a_data0 = sub_a[word_offset]; + let a_data1 = sub_a[word_offset + 1];`;default:throw new Error(`${d}-component is not supported.`)}};return` + var sub_a: array<${G.type.value}, ${g}>; + var inter_results: array, ${T}>; + ${B.declareVariables(...H,oe)} + ${B.mainStart([k,T,1])} + let output_indices = ${oe.offsetToIndices(`workgroup_index * ${T}`)}; + let col = output_indices[2]; + let row = output_indices[1]; + let batch = output_indices[0]; + let n_blocks_per_col = uniforms.b_shape[1]; + let num_tiles = (n_blocks_per_col - 1) / ${S} + 1; + + // Loop over shared dimension. + for (var tile: u32 = 0; tile < num_tiles; tile += 1) { + let a_col_start = tile * ${g}; + // load one tile A data into shared memory. + for (var a_offset = local_idx; a_offset < ${g}; a_offset += ${_}) + { + let a_col = a_col_start + a_offset; + if (a_col < uniforms.a_shape[2]) + { + sub_a[a_offset] = ${G.getByIndices(`${G.type.indices}(batch, row, a_col)`)}; + } else { + sub_a[a_offset] = ${G.type.value}(0); + } + } + workgroupBarrier(); + + // each thread process one block + let b_row = col + local_id.y; + let block = tile * ${S} + local_id.x; + ${Z?` + let zero_point_bytes_per_col = (n_blocks_per_col + 1) / 2; + let zero_point_byte_count = b_row * zero_point_bytes_per_col + (block >> 0x1u); + let zero_point_word_index = zero_point_byte_count >> 0x2u; + let zero_point_byte_offset = zero_point_byte_count & 0x3u; + let zero_point_nibble_offset: u32 = block & 0x1u; + let zero_point_bits_offset = (zero_point_byte_offset << 3) + (zero_point_nibble_offset << 2); + let zero_point_word = ${Z.getByOffset("zero_point_word_index")} >> zero_point_bits_offset; + let zero_point = ${me}((zero_point_word) & 0xFu);`:` + // The default zero point is 8 for unsigned 4-bit quantization. + let zero_point = ${me}(8);`} + let scale = ${ee.getByOffset("b_row * n_blocks_per_col + block")}; + let b_data = ${j.getByIndices(`${j.type.indices}(b_row, block, 0)`)}; + var word_offset = local_id.x * ${r.blockSize/d}; + for (var i: u32 = 0; i < ${c}; i++) { + ${ae()} + let b_value = ${c===1?"b_data":"b_data[i]"}; + let b_value_lower = unpack4xU8(b_value & 0x0F0F0F0Fu); + let b_value_upper = unpack4xU8((b_value >> 4) & 0x0F0F0F0Fu); + let b_quantized_values = mat2x4<${me}>(${Array.from({length:4},(V,F)=>`${me}(b_value_lower[${F}]), ${me}(b_value_upper[${F}])`).join(", ")}); + let b_dequantized_values = (b_quantized_values - mat2x4<${me}>(${Array(8).fill("zero_point").join(",")})) * scale; + inter_results[local_id.y][local_id.x] += ${Array.from({length:2},(V,F)=>`${`dot(a_data${F}, b_dequantized_values[${F}])`}`).join(" + ")}; + word_offset += ${8/d}; + } + workgroupBarrier(); + } + + if (local_idx < ${T}) { + var output_value: ${oe.type.value} = ${oe.type.value}(0); + for (var b = 0u; b < ${k}; b++) { + output_value += inter_results[local_idx][b]; + } + if (col + local_idx < uniforms.output_shape[2]) + { + ${oe.setByIndices(`${oe.type.indices}(batch, row, col + local_idx)`,"output_value")} + } + } + }`};return{name:"BlockwiseMatMulNBits32",shaderCache:{hint:`${r.blockSize};${d};${c};${k};${T}`,inputDependencies:Array(e.length).fill("rank")},getRunData:()=>({outputs:[{dims:f,dataType:p}],dispatchGroup:{x:E},programUniforms:y}),getShaderSource:A}},Y_=(e,r)=>{X_(e.inputs,r),r.blockSize===32&&e.adapterInfo.isVendor("intel")&&e.adapterInfo.isArchitecture("gen-12lp")?e.compute(J_(e.inputs,r)):e.compute(Q_(e.inputs,r))},Z_=e=>St(e)}),ef,tf,rf,sf,nf,of,af,lf,uf,ex=Be(()=>{ut(),mt(),ft(),ef=e=>{if(!e||e.length<1)throw new Error("Too few inputs");if(e[0].dataType!==1&&e[0].dataType!==10)throw new Error("Input type must be float or float16.");if(e.length>=2){let r=e[0].dims.length*2===e[1].dims[0];if(e.length===4&&(r=e[3].dims[0]*2===e[1].dims[0]),!r)throw new Error("The pads should be a 1D tensor of shape [2 * input_rank] or [2 * num_axes].")}},tf=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` + k = i32(${e.indicesGet("indices",o)}) - ${et("uniforms.pads",o,t)}; + if (k < 0) { + break; + } + if (k >= i32(${et("uniforms.x_shape",o,r)})) { + break; + } + offset += k * i32(${et("uniforms.x_strides",o,r)}); + `;return` + value = ${e.type.value}(uniforms.constant_value); + for (var i = 0; i < 1; i++) { + var offset = 0; + var k = 0; + ${s} + value = x[offset]; + } + `},rf=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` + k = i32(${e.indicesGet("indices",o)}) - ${et("uniforms.pads",o,t)}; + if (k < 0) { + k = -k; + } + { + let _2n_1 = 2 * (i32(${et("uniforms.x_shape",o,r)}) - 1); + k = k % _2n_1; + if(k >= i32(${et("uniforms.x_shape",o,r)})) { + k = _2n_1 - k; + } + } + offset += k * i32(${et("uniforms.x_strides",o,r)}); + `;return` + var offset = 0; + var k = 0; + ${s} + value = x[offset]; + `},sf=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` + k = i32(${e.indicesGet("indices",o)}) - ${et("uniforms.pads",o,t)}; + if (k < 0) { + k = 0; + } + if (k >= i32(${et("uniforms.x_shape",o,r)})) { + k = i32(${et("uniforms.x_shape",o,r)}) - 1; + } + offset += k * i32(${et("uniforms.x_strides",o,r)}); + `;return` + var offset = 0; + var k = 0; + ${s} + value = x[offset]; + `},nf=(e,r,t)=>{let s="";for(let o=r-1;o>=0;--o)s+=` + k = i32(${e.indicesGet("indices",o)}) - ${et("uniforms.pads",o,t)}; + if (k < 0) { + k += i32(${et("uniforms.x_shape",o,r)}]); + } + if (k >= i32(${et("uniforms.x_shape",o,r)})) { + k -= i32(${et("uniforms.x_shape",o,r)}); + } + offset += k * i32(${et("uniforms.x_strides",o,r)}); + `;return` + var offset = 0; + var k = 0; + ${s} + value = x[offset]; + `},of=(e,r,t)=>{switch(t.mode){case 0:return tf(e,r,t.pads.length);case 1:return rf(e,r,t.pads.length);case 2:return sf(e,r,t.pads.length);case 3:return nf(e,r,t.pads.length);default:throw new Error("Invalid mode")}},af=(e,r)=>{let t=Me.padShape(e[0].dims.slice(),r.pads),s=e[0].dims,o=Me.size(t),n=[{type:12,data:o},{type:6,data:r.pads}],i=e.length>=3&&e[2].data;r.mode===0&&n.push({type:i?e[2].dataType:1,data:r.value}),n.push(...st(e[0].dims,t));let a=["rank"],l=u=>{let p=Ye("output",e[0].dataType,t.length),d=Pe("x",e[0].dataType,s.length),c=d.type.value,f=of(p,s.length,r),_=[{name:"output_size",type:"u32"},{name:"pads",type:"i32",length:r.pads.length}];return r.mode===0&&_.push({name:"constant_value",type:i?c:"f32"}),` + ${u.registerUniforms(_).declareVariables(d,p)} + ${u.mainStart()} + ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + + let indices = ${p.offsetToIndices("global_idx")}; + + var value = ${c}(0); + ${f} + output[global_idx] = value; + }`};return{name:"Pad",shaderCache:{hint:`${r.mode}${i}`,inputDependencies:a},getRunData:()=>({outputs:[{dims:t,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(Me.size(t)/64)},programUniforms:n}),getShaderSource:l}},lf=(e,r)=>{if(e.length>1){let t=e[1].getBigInt64Array(),s=e.length>=3&&e[2].data?e[2].dataType===10?e[2].getUint16Array()[0]:e[2].getFloat32Array()[0]:0,o=e[0].dims.length,n=new Int32Array(2*o).fill(0);if(e.length>=4){let a=e[3].getBigInt64Array();for(let l=0;ln[Number(l)]=Number(a));let i=[];return n.forEach(a=>i.push(a)),{mode:r.mode,value:s,pads:i}}else return r},uf=(e,r)=>{ef(e.inputs);let t=lf(e.inputs,r);e.compute(af(e.inputs,t),{inputs:[0]})}}),yo,Bl,Rl,jl,Nl,df,cf,Vl,Ul,pf,hf,Wl,mf,_f,Gl,ff,gf,wf,Mf,tx=Be(()=>{ts(),ut(),mt(),ft(),yo=e=>{if(Bt.webgpu.validateInputContent&&(!e||e.length!==1))throw new Error("Pool ops requires 1 input.")},Bl=(e,r,t)=>{let s=r.format==="NHWC",o=e.dims.slice();s&&o.splice(1,0,o.pop());let n=Object.hasOwnProperty.call(r,"dilations"),i=r.kernelShape.slice(),a=r.strides.slice(),l=n?r.dilations.slice():[],u=r.pads.slice();oi.adjustPoolAttributes(t,o,i,a,l,u);let p=oi.computePoolOutputShape(t,o,a,l,i,u,r.autoPad),d=Object.assign({},r);n?Object.assign(d,{kernelShape:i,strides:a,pads:u,dilations:l,cacheKey:r.cacheKey}):Object.assign(d,{kernelShape:i,strides:a,pads:u,cacheKey:r.cacheKey});let c=p.slice();return c.push(c.splice(1,1)[0]),[d,s?c:p]},Rl=(e,r)=>{let t=r.format==="NHWC",s=Me.size(e),o=Me.size(r.kernelShape),n=[{type:12,data:s},{type:12,data:o}],i=[{name:"outputSize",type:"u32"},{name:"kernelSize",type:"u32"}];if(r.kernelShape.length<=2){let a=r.kernelShape[r.kernelShape.length-1],l=r.strides[r.strides.length-1],u=r.pads[r.pads.length/2-1],p=r.pads[r.pads.length-1],d=!!(u+p);n.push({type:12,data:a},{type:12,data:l},{type:12,data:u},{type:12,data:p}),i.push({name:"kw",type:"u32"},{name:"sw",type:"u32"},{name:"pwStart",type:"u32"},{name:"pwEnd",type:"u32"});let c=!1;if(r.kernelShape.length===2){let f=r.kernelShape[r.kernelShape.length-2],_=r.strides[r.strides.length-2],T=r.pads[r.pads.length/2-2],k=r.pads[r.pads.length-2];c=!!(T+k),n.push({type:12,data:f},{type:12,data:_},{type:12,data:T},{type:12,data:k}),i.push({name:"kh",type:"u32"},{name:"sh",type:"u32"},{name:"phStart",type:"u32"},{name:"phEnd",type:"u32"})}return[n,i,!0,d,c]}else{if(t)throw new Error("Pooling with kernelShape.length > 2 is not supported for NHWC format.");let a=Me.computeStrides(r.kernelShape);n.push({type:12,data:a},{type:12,data:r.pads},{type:12,data:r.strides}),i.push({name:"kernelStrides",type:"u32",length:a.length},{name:"pads",type:"u32",length:r.pads.length},{name:"strides",type:"u32",length:r.strides.length});let l=r.pads.reduce((u,p)=>u+p);return[n,i,!!l,!1,!1]}},jl=(e,r,t,s,o,n,i,a,l,u,p,d)=>{let c=o.format==="NHWC",f=r.type.value,_=Ye("output",r.type.tensor,s);if(o.kernelShape.length<=2){let T="",k="",w="",g=t-(c?2:1);if(p?T=` + for (var i: u32 = 0u; i < uniforms.kw; i++) { + xIndices[${g}] = indices[${g}] * uniforms.sw - uniforms.pwStart + i; + if (xIndices[${g}] < 0 || xIndices[${g}] + >= uniforms.x_shape[${g}]) { + pad++; + continue; + } + let x_val = x[${r.indicesToOffset("xIndices")}]; + ${n} + }`:T=` + for (var i: u32 = 0u; i < uniforms.kw; i++) { + xIndices[${g}] = indices[${g}] * uniforms.sw - uniforms.pwStart + i; + let x_val = x[${r.indicesToOffset("xIndices")}]; + ${n} + }`,o.kernelShape.length===2){let S=t-(c?3:2);d?k=` + for (var j: u32 = 0u; j < uniforms.kh; j++) { + xIndices[${S}] = indices[${S}] * uniforms.sh - uniforms.phStart + j; + if (xIndices[${S}] < 0 || xIndices[${S}] >= uniforms.x_shape[${S}]) { + pad += i32(uniforms.kw); + continue; + } + `:k=` + for (var j: u32 = 0u; j < uniforms.kh; j++) { + xIndices[${S}] = indices[${S}] * uniforms.sh - uniforms.phStart + j; + `,w=` + } + `}return` + ${e.registerUniforms(l).declareVariables(r,_)} + + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + + let indices = ${_.offsetToIndices("global_idx")}; + var xIndices = ${_.offsetToIndices("global_idx")}; + + var value = ${f}(${a}); + var pad = 0; + ${k} + ${T} + ${w} + ${i} + + output[global_idx] = value; + }`}else{if(c)throw new Error("Pooling with kernelShape.length > 2 is not supported for NHWC format.");let T=o.kernelShape.length,k=o.pads.length,w="";return u?w=` + if (xIndices[j] >= uniforms.x_shape[j]) { + pad++; + isPad = true; + break; + } + } + if (!isPad) { + let x_val = x[${r.indicesToOffset("xIndices")}]; + ${n} + }`:w=` + } + let x_val = x[${r.indicesToOffset("xIndices")}]; + ${n} + `,` + ${e.registerUniforms(l).declareVariables(r,_)} + + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + let indices = ${_.offsetToIndices("global_idx")}; + var xIndices = ${_.offsetToIndices("global_idx")}; + + var offsets: array; + + var value = ${f}(${a}); + var pad = 0; + var isPad = false; + + for (var i: u32 = 0u; i < uniforms.kernelSize; i++) { + var offset = i; + for (var j = 0u; j < ${T-1}u; j++) { + offsets[j] = offset / ${et("uniforms.kernelStrides","j",T)}; + offset -= offsets[j] * ${et("uniforms.kernelStrides","j",T)}; + } + offsets[${T-1}] = offset; + + isPad = false; + for (var j = ${t-T}u; j < ${t}u; j++) { + xIndices[j] = indices[j] * ${et("uniforms.strides",`j - ${t-T}u`,T)} + + offsets[j - ${t-T}u] - ${et("uniforms.pads","j - 2u",k)}; + ${w} + } + ${i} + + output[global_idx] = value; + }`}},Nl=e=>`${e.format};${e.ceilMode};${e.autoPad};${e.kernelShape.length}`,df=e=>`${Nl(e)};${e.countIncludePad}`,cf=e=>`${Nl(e)};${e.storageOrder};${e.dilations}`,Vl=e=>({format:e.format,autoPad:["NOTSET","VALID","SAME_UPPER","SAME_LOWER"][e.auto_pad],ceilMode:e.ceil_mode,kernelShape:e.kernel_shape,strides:e.strides,pads:e.pads}),Ul=(e,r,t,s)=>{let[o,n]=Bl(r,s,t),i=Pe("x",r.dataType,r.dims.length),a=i.type.value,l="value += x_val;",u="";o.countIncludePad?u+=`value /= ${a}(uniforms.kernelSize);`:u+=`value /= ${a}(i32(uniforms.kernelSize) - pad);`;let[p,d,c,f,_]=Rl(n,o);p.push(...st(r.dims,n));let T=["rank"];return{name:e,shaderCache:{hint:`${s.cacheKey};${c};${f};${_}`,inputDependencies:T},getRunData:()=>({outputs:[{dims:n,dataType:r.dataType}],dispatchGroup:{x:Math.ceil(Me.size(n)/64)},programUniforms:p}),getShaderSource:k=>jl(k,i,r.dims.length,n.length,o,l,u,0,d,c,f,_)}},pf=e=>{let r=e.count_include_pad!==0,t=Vl(e);if(t.ceilMode!==0)throw new Error("using ceil() in shape computation is not yet supported for AveragePool");let s={countIncludePad:r,...t,cacheKey:""};return{...s,cacheKey:df(s)}},hf=(e,r)=>{yo(e.inputs),e.compute(Ul("AveragePool",e.inputs[0],!1,r))},Wl={autoPad:"",ceilMode:0,countIncludePad:!1,kernelShape:[],strides:[],pads:[],storageOrder:0,dilations:[]},mf=e=>{let r=e.format;return{format:r,...Wl,cacheKey:r}},_f=(e,r)=>{yo(e.inputs),e.compute(Ul("GlobalAveragePool",e.inputs[0],!0,r))},Gl=(e,r,t,s)=>{let[o,n]=Bl(r,s,t),i=` + value = max(x_val, value); + `,a="",l=Pe("x",r.dataType,r.dims.length),u=["rank"],[p,d,c,f,_]=Rl(n,o);return p.push(...st(r.dims,n)),{name:e,shaderCache:{hint:`${s.cacheKey};${c};${f};${_}`,inputDependencies:u},getRunData:()=>({outputs:[{dims:n,dataType:r.dataType}],dispatchGroup:{x:Math.ceil(Me.size(n)/64)},programUniforms:p}),getShaderSource:T=>jl(T,l,r.dims.length,n.length,o,i,a,r.dataType===10?-65504:-1e5,d,c,f,_)}},ff=(e,r)=>{yo(e.inputs),e.compute(Gl("MaxPool",e.inputs[0],!1,r))},gf=e=>{let r=e.storage_order,t=e.dilations,s=Vl(e);if(r!==0)throw new Error("column major storage order is not yet supported for MaxPool");if(s.ceilMode!==0)throw new Error("using ceil() in shape computation is not yet supported for MaxPool");let o={storageOrder:r,dilations:t,...s,cacheKey:""};return{...o,cacheKey:cf(o)}},wf=e=>{let r=e.format;return{format:r,...Wl,cacheKey:r}},Mf=(e,r)=>{yo(e.inputs),e.compute(Gl("GlobalMaxPool",e.inputs[0],!0,r))}}),bf,yf,vf,xf,rx=Be(()=>{ut(),mt(),Xt(),ft(),bf=(e,r)=>{if(e.length<2||e.length>3)throw new Error("DequantizeLinear requires 2 or 3 inputs.");if(e.length===3&&e[1].dims===e[2].dims)throw new Error("x-scale and x-zero-point must have the same shape.");if(e.length===3&&e[0].dataType!==e[2].dataType)throw new Error("x and x-zero-point must have the same data type.");if(e[0].dataType===6&&e.length>2)throw new Error("In the case of dequantizing int32 there is no zero point.");if(e[1].dims.length!==0&&e[1].dims.length!==1&&e[1].dims.length!==e[0].dims.length)throw new Error("scale input must be a scalar, a 1D tensor, or have the same rank as the input tensor.");if(e.length>2){if(e[0].dataType!==e[2].dataType)throw new Error("x and x-zero-point must have the same data type.");if(e[1].dims.length!==e[2].dims.length)throw new Error("scale and zero-point inputs must have the same rank.");if(!e[1].dims.map((t,s)=>t===e[2].dims[s]).reduce((t,s)=>t&&s,!0))throw new Error("scale and zero-point inputs must have the same shape.")}if(r.blockSize>0){if(e[1].dims.length===0||e[1].dims.length===1&&e[1].dims[0]===1)throw new Error("blockSize must be set only for block quantization.");if(!e[1].dims.map((o,n)=>n===r.axis||o===e[0].dims[n]).reduce((o,n)=>o&&n,!0))throw new Error("For block qunatization, scale input shape to match the input shape except for the axis");if(e[1].dims.length!==e[0].dims.length)throw new Error("For block qunatization the scale input rank must be the same as the x rank.");let t=e[0].dims[r.axis],s=e[1].dims[r.axis];if(r.blockSizeMath.ceil(t/(s-1)-1))throw new Error("blockSize must be with in the range [ceil(dI / Si), ceil(dI / (Si - 1) - 1)].")}},yf=(e,r)=>{let t=Me.normalizeAxis(r.axis,e[0].dims.length),s=e[0].dataType,o=s===3,n=e[0].dims,i=e[1].dataType,a=Me.size(n),l=s===3||s===2,u=l?[Math.ceil(Me.size(e[0].dims)/4)]:e[0].dims,p=e[1].dims,d=e.length>2?e[2]:void 0,c=d?l?[Math.ceil(Me.size(d.dims)/4)]:d.dims:void 0,f=p.length===0||p.length===1&&p[0]===1,_=f===!1&&p.length===1,T=Kt(a),k=f&&(!l||T===4),w=k?T:1,g=k&&!l?T:1,S=Pe("input",l?12:s,u.length,g),E=Pe("scale",i,p.length),y=d?Pe("zero_point",l?12:s,c.length):void 0,M=Ye("output",i,n.length,w),v=[S,E];y&&v.push(y);let C=[u,p];d&&C.push(c);let A=[{type:12,data:a/w},{type:12,data:t},{type:12,data:r.blockSize},...st(...C,n)],B=K=>{let G=[{name:"output_size",type:"u32"},{name:"axis",type:"u32"},{name:"block_size",type:"u32"}];return` + ${K.registerUniforms(G).declareVariables(...v,M)} + ${K.mainStart()} + ${K.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let output_indices = ${M.offsetToIndices("global_idx")}; + + // Set input x + ${l?` + let input = ${S.getByOffset("global_idx / 4")}; + let x_vec = ${o?"unpack4xI8(input)":"unpack4xU8(input)"}; + let x_value = ${w===1?"x_vec[global_idx % 4]":"x_vec"};`:`let x_value = ${S.getByOffset("global_idx")};`}; + + // Set scale input + ${f?`let scale_value= ${E.getByOffset("0")}`:_?` + let scale_index = ${M.indicesGet("output_indices","uniforms.axis")}; + let scale_value= ${E.getByOffset("scale_index")};`:` + var scale_indices: ${E.type.indices} = output_indices; + let index = ${E.indicesGet("scale_indices","uniforms.axis")} / uniforms.block_size; + ${E.indicesSet("scale_indices","uniforms.axis","index")}; + let scale_value= ${E.getByIndices("scale_indices")};`}; + + // Set zero-point input + ${y?f?l?` + let zero_point_input = ${y.getByOffset("0")}; + let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; + let zero_point_value= zero_point_vec[0]`:`let zero_point_value = ${y.getByOffset("0")}`:_?l?` + let zero_point_index = ${M.indicesGet("output_indices","uniforms.axis")}; + let zero_point_input = ${y.getByOffset("zero_point_index / 4")}; + let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; + let zero_point_value = zero_point_vec[zero_point_index % 4]`:` + let zero_point_index = ${M.indicesGet("output_indices","uniforms.axis")}; + let zero_point_value = ${y.getByOffset("zero_point_index")};`:l?` + let zero_point_offset = ${E.indicesToOffset("scale_indices")}; + let zero_point_input = ${y.getByOffset("zero_point_offset / 4")}; + let zero_point_vec = ${o?"unpack4xI8(zero_point_input)":"unpack4xU8(zero_point_input)"}; + let zero_point_value = zero_point_vec[zero_point_offset % 4];`:`let zero_point_value = ${y.getByIndices("scale_indices")};`:`let zero_point_value = ${l?o?"i32":"u32":S.type.value}(0);`}; + // Compute and write output + ${M.setByOffset("global_idx",`${M.type.value}(x_value - zero_point_value) * scale_value`)}; + }`};return{name:"DequantizeLinear",shaderCache:{hint:r.cacheKey,inputDependencies:y?["rank","rank","rank"]:["rank","rank"]},getShaderSource:B,getRunData:()=>({outputs:[{dims:n,dataType:i}],dispatchGroup:{x:Math.ceil(a/w/64),y:1,z:1},programUniforms:A})}},vf=(e,r)=>{bf(e.inputs,r),e.compute(yf(e.inputs,r))},xf=e=>St({axis:e.axis,blockSize:e.blockSize})}),Tf,Ef,Pf,sx=Be(()=>{ts(),ut(),ft(),Tf=(e,r,t)=>{let s=e===r,o=er&&t>0;if(s||o||n)throw new Error("Range these inputs' contents are invalid.")},Ef=(e,r,t,s)=>{let o=Math.abs(Math.ceil((r-e)/t)),n=[o],i=o,a=[{type:12,data:i},{type:s,data:e},{type:s,data:t},...st(n)],l=u=>{let p=Ye("output",s,n.length),d=p.type.value,c=[{name:"outputSize",type:"u32"},{name:"start",type:d},{name:"delta",type:d}];return` + ${u.registerUniforms(c).declareVariables(p)} + ${u.mainStart()} + ${u.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + output[global_idx] = uniforms.start + ${d}(global_idx) * uniforms.delta; + }`};return{name:"Range",shaderCache:{hint:`${s}`},getShaderSource:l,getRunData:()=>({outputs:[{dims:n,dataType:s}],dispatchGroup:{x:Math.ceil(i/64)},programUniforms:a})}},Pf=e=>{let r=0,t=0,s=0;e.inputs[0].dataType===6?(r=e.inputs[0].getInt32Array()[0],t=e.inputs[1].getInt32Array()[0],s=e.inputs[2].getInt32Array()[0]):e.inputs[0].dataType===1&&(r=e.inputs[0].getFloat32Array()[0],t=e.inputs[1].getFloat32Array()[0],s=e.inputs[2].getFloat32Array()[0]),Bt.webgpu.validateInputContent&&Tf(r,t,s),e.compute(Ef(r,t,s,e.inputs[0].dataType),{inputs:[]})}}),Cf,Kl,Hl,Sf,$f,kf,nx=Be(()=>{ut(),mt(),Xt(),ft(),Cf=(e,r,t,s)=>{if(e!=="none"&&s!=="i32"&&s!=="u32"&&s!=="f32")throw new Error(`Input ${s} is not supported with reduction ${e}.`);let o=`{ + var oldValue = 0; + loop { + let newValueF32 =`,n=`; + let newValue = bitcast(newValueF32); + let res = atomicCompareExchangeWeak(&${r}, oldValue, newValue); + if res.exchanged { + break; + } + oldValue = res.old_value; + } + }`;switch(e){case"none":return`${r}=${t};`;case"add":return s==="i32"||s==="u32"?`atomicAdd(&${r}, bitcast<${s}>(${t}));`:` + ${o}bitcast<${s}>(oldValue) + (${t})${n}`;case"max":return s==="i32"||s==="u32"?`atomicMax(&${r}, bitcast<${s}>(${t}));`:` + ${o}max(bitcast(oldValue), (${t}))${n}`;case"min":return s==="i32"||s==="u32"?`atomicMin(&${r}, bitcast<${s}>(${t}));`:`${o}min(bitcast<${s}>(oldValue), (${t}))${n}`;case"mul":return`${o}(bitcast<${s}>(oldValue) * (${t}))${n}`;default:throw new Error(`Reduction ${e} is not supported.`)}},Kl=(e,r)=>`${e===1?` + let element_count_dim = uniforms.output_strides; + let dim_value = uniforms.output_shape;`:` + let element_count_dim = uniforms.output_strides[${r?"i - indices_start":"i"}]; + let dim_value = uniforms.output_shape[${r?"i - indices_start":"i"} + uniforms.last_index_dimension];`} + + if (index >= 0) { + if (index >= i32(dim_value)) { + index = i32(dim_value - 1); + } + } else { + if (index < -i32(dim_value)) { + index = 0; + } else { + index += i32(dim_value); + } + } + data_offset += u32((u32(index) * element_count_dim));`,Hl=(e,r,t)=>`for (var i = 0u; i < uniforms.num_updates_elements; i++) { + let value = updates[uniforms.num_updates_elements * ${t?"global_idx":"idx"} + i]; + ${Cf(e.reduction,"output[data_offset + i]","value",r)} + }`,Sf=(e,r)=>{let t=e[0].dims,s=e[1].dims,o=t,n=1,i=Math.ceil(Me.size(s)/n),a=s[s.length-1],l=Me.sizeFromDimension(t,a),u=Me.sizeFromDimension(s,0)/a,p=[{type:12,data:i},{type:12,data:a},{type:12,data:l},...st(e[1].dims,e[2].dims,o)],d=c=>{let f=Pe("indices",e[1].dataType,e[1].dims.length),_=Pe("updates",e[2].dataType,e[2].dims.length,n),T=r.reduction!=="none"&&r.reduction!==""?Dc("output",e[0].dataType,o.length):Ye("output",e[0].dataType,o.length,n);return` + ${c.registerUniform("output_size","u32").registerUniform("last_index_dimension","u32").registerUniform("num_updates_elements","u32").declareVariables(f,_,T)} + ${c.mainStart()} + ${c.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + var hasDuplicates = false; + if (${r.reduction==="none"}) { + for (var i = 0; i < ${u}; i = i + 1) { + for (var j = i + 1; j < ${u}; j = j + 1) { + var index_i = i32(indices[i].x); + var index_j = i32(indices[j].x); + if (index_i == index_j) { + hasDuplicates = true; + break; + } + } + if (hasDuplicates) { + break; + } + } + } + + if (${r.reduction==="none"} && hasDuplicates) { + if (global_idx != 0u) { + return; + } + // Process each index-update pair individually when duplicates exist + for (var idx = 0u; idx < ${u}u; idx++) { + var data_offset = 0u; + for (var i = 0u; i < uniforms.last_index_dimension; i++) { + var index = i32(indices[idx * uniforms.last_index_dimension + i].x); + ${Kl(t.length,!1)} + } + ${Hl(r,T.type.value,!1)} + } + return; + } + + var data_offset = 0u; + var indices_start = uniforms.last_index_dimension * global_idx; + var indices_end = indices_start + uniforms.last_index_dimension; + for (var i = indices_start; i < indices_end; i++) { + var index = i32(indices[i].x); + ${Kl(t.length,!0)} + } + ${Hl(r,T.type.value,!0)} + }`};return{name:"ScatterND",shaderCache:{hint:`${r.cacheKey}_${r.reduction}`,inputDependencies:["rank","rank"]},getRunData:()=>({outputs:[{dims:o,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(i/64)},programUniforms:p}),getShaderSource:d}},$f=e=>St({reduction:e.reduction}),kf=(e,r)=>{e.compute(Sf(e.inputs,r),{inputs:[e.inputs[1],e.inputs[2]],outputs:[]})}}),If,Af,Ff,ql,Of,Df,Lf,zf,Bf,Rf,jf,Nf,Xl,Vf,Uf,Wf,Gf,Kf,Hf,qf,ox=Be(()=>{ut(),mt(),Xt(),ft(),If=(e,r)=>{if(e.every(t=>t>0||(()=>{throw new Error("Resize requires scales input values to be positive")})),e.length>0){if(r.mode==="linear"){if(!(e.length===2||e.length===3||e.length===4&&e[0]===1&&e[1]===1||e.length===4&&e[0]===1&&e[3]===1||e.length===5&&e[0]===1&&e[1]===1))throw new Error(`For linear mode, Resize requires scales to be 2D, 3D, 4D with either two outermost or one innermost and + one outermost scale values equal to 1, or 5D with two outermost scale values equal to 1`)}else if(r.mode==="cubic"&&!(e.length===2||e.length===4&&e[0]===1&&e[1]===1||e.length===4&&e[0]===1&&e[3]===1))throw new Error("Resize requires scales input size to be 2 or 4 for cubic mode")}},Af=(e,r,t)=>{r.every(o=>o>=0&&o{throw new Error("Resize requires axes input values to be positive and less than rank")}));let s=new Array(t).fill(1);return r.forEach((o,n)=>s[o]=e[n]),s},Ff=(e,r,t,s,o,n)=>{let[i,a,l]=t>10?[1,2,3]:[-1,e.length>1?1:-1,-1],u=e[0].dims.length;if(i>0&&e.length>i&&e[i].dims.length>0)e[i].getFloat32Array().forEach(p=>n.push(p));else if(r.coordinateTransformMode==="tf_crop_and_resize")throw new Error("Resize requires RoI input to be specified when coordinateTransformMode is tfCropAndResize");if(a>0&&e.length>a&&e[a].dims.length===1&&e[a].dims[0]>0){if(e[a].getFloat32Array().forEach(p=>s.push(p)),s.length!==0&&s.length!==u&&t>=18&&s.length!==r.axes.length)throw new Error("Resize requires scales input size to be same as input rank or axes size for opset 18 and up");If(s,r),r.axes.length>0&&Af(s,r.axes,u).forEach((p,d)=>s[d]=p)}if(l>0&&e.length>l&&e[l].dims.length===1&&e[l].dims[0]>0&&(e[l].getBigInt64Array().forEach(p=>o.push(Number(p))),o.length!==0&&o.length!==u&&t>=18&&o.length!==r.axes.length))throw new Error("Resize requires sizes input size to be same as input rank or axes size for opset 18 and up");if(r.axes.length>0){if(s.length!==0&&s.length!==r.axes.length)throw new Error('Resize requires "scales" input size to be of axes rank when axes attributes is specified');if(o.length!==0&&o.length!==r.axes.length)throw new Error('Resize requires "sizes" input size to be of rank axes rank when axes attributes is specified')}if(typeof s<"u"&&typeof o<"u"&&s.length>0&&o.length>u)throw new Error("Resize requires only of scales or sizes to be specified")},ql=(e,r,t,s)=>` + // The whole part and the fractional part are calculated separately due to inaccuracy of floating + // point division. As an example, f32(21) / f32(7) may evaluate to 2.99... instead of 3, causing an + // offset-by-one error later in floor(). + let big = (${e}) * (${r}); + let whole = ${s}(big / (${t})); + let fract = ${s}(big % (${t})) / ${s}(${t}); + return whole + fract; +`,Of=(e,r)=>`fn getOriginalCoordinateFromResizedCoordinate(xResized: u32, xScale: f32, lengthResized: u32, + lengthOriginal: u32, roiStart: f32, roiEnd: f32) -> ${r} { `+(()=>{switch(e){case"asymmetric":return` + if (xScale < 1.0 || floor(xScale) != xScale) { + return ${r}(xResized) / ${r}(xScale); + } else { + ${ql("xResized","lengthOriginal","lengthResized",r)} + } + `;case"pytorch_half_pixel":return`if (lengthResized > 1) { + return (${r}(xResized) + 0.5) / ${r}(xScale) - 0.5; + } else { + return 0.0; + }`;case"tf_half_pixel_for_nn":return`return (${r}(xResized) + 0.5) / ${r}(xScale);`;case"align_corners":return`if (lengthResized == 1) { + return 0.0; + } else { + ${ql("xResized","lengthOriginal - 1","lengthResized - 1",r)} + }`;case"tf_crop_and_resize":return`if (lengthResized > 1) { + return ${r}(roiStart) * ${r}(lengthOriginal - 1) + + (${r}(xResized) * ${r}(roiEnd - roiStart) * ${r}(lengthOriginal - 1)) / + ${r}(lengthResized - 1); + } else { + return 0.5 * ${r}(roiStart + roiEnd) * ${r}(lengthOriginal - 1); + }`;case"half_pixel_symmetric":return`const outputWidth = ${r}xScale * ${r}(lengthResized); + const adjustment = ${r}(lengthResized) / outputWidth; + const center = ${r}(lengthOriginal) / 2; + const offset = center * (1 - adjustment); + return offset + ((${r}(xResized) + 0.5) / ${r}(xScale)) - 0.5;`;case"half_pixel":return`return ((${r}(xResized) + 0.5) / ${r}(xScale)) - 0.5;`;default:throw new Error(`Coordinate transform mode ${e} is not supported`)}})()+"}",Df=(e,r,t)=>`fn getNearestPixelFromOriginal(xOriginal: ${t}, isDownSample: bool) -> ${t} {`+(()=>{switch(e){case"round_prefer_ceil":return"if (fract(xOriginal) == 0.5) { return ceil(xOriginal); } else { return round(xOriginal); }";case"floor":return"return floor(xOriginal);";case"ceil":return"return ceil(xOriginal);";case"round_prefer_floor":return"if (fract(xOriginal) == 0.5) { return floor(xOriginal); } else { return round(xOriginal); }";case"simple":default:if(r<11)return"if (isDownSample) { return ceil(xOriginal); } else { return xOriginal; }";throw new Error(`Nearest mode ${e} is not supported`)}})()+"}",Lf=(e,r,t)=>{let s=new Array(t).fill(0).concat(new Array(t).fill(1)),o=e.length===0?s:e.slice();return r.length>0?(r.forEach((n,i)=>{s[n]=o[i],s[i+t]=o[r.length+i]}),s):o},zf=(e,r,t,s)=>{let o=[];if(t.length>0)if(s.length>0){if(e.forEach(n=>o.push(n)),Math.max(...s)>e.length)throw new Error("axes is out of bound");s.forEach((n,i)=>o[n]=t[i])}else t.forEach(n=>o.push(n));else{if(r.length===0)throw new Error("Resize requires either scales or sizes.");o=e.map((n,i)=>Math.round(n*r[i]))}return o},Bf=(e,r,t)=>{let s=(()=>{switch(t.keepAspectRatioPolicy){case"not_larger":return t.axes.length>0?Math.min(...t.axes.map(n=>r[n]),Number.MAX_VALUE):Math.min(...r,Number.MAX_VALUE);case"not_smaller":return t.axes.length>0?Math.max(...t.axes.map(n=>r[n]),Number.MIN_VALUE):Math.max(...r,Number.MIN_VALUE);default:throw new Error(`Keep aspect ratio policy ${t.keepAspectRatioPolicy} is not supported`)}})();r.fill(1,0,r.length);let o=e.slice();return t.axes.length>0?(t.axes.forEach(n=>r[n]=s),t.axes.forEach(n=>o[n]=Math.round(e[n]*r[n]))):(r.fill(s,0,r.length),o.forEach((n,i)=>o[i]=Math.round(n*r[i]))),o},Rf=(e,r,t,s,o)=>` + fn calculateOriginalIndicesFromOutputIndices(output_indices: ${e.type.indices}) -> array<${e.type.value}, ${t.length}> { + var original_indices: array<${e.type.value}, ${t.length}>; + for (var i:u32 = 0; i < ${t.length}; i++) { + var output_index = ${e.indicesGet("output_indices","i")}; + var scale = ${et("uniforms.scales","i",s)}; + var roi_low = ${et("uniforms.roi","i",o)}; + var roi_hi = ${et("uniforms.roi",`i + ${r.length}`,o)}; + if (scale == 1.0) { + original_indices[i] = ${e.type.value}(output_index); + } else { + var input_shape_i = ${et("uniforms.input_shape","i",r.length)}; + var output_shape_i = ${et("uniforms.output_shape","i",t.length)}; + original_indices[i] = getOriginalCoordinateFromResizedCoordinate(output_index, scale, output_shape_i, + input_shape_i, roi_low, roi_hi); + } + } + return original_indices; + }`,jf=(e,r,t,s,o,n,i)=>` + fn calculateInputIndicesFromOutputIndices(output_indices: ${r.type.indices}) -> ${e.type.indices} { + var input_indices: ${e.type.indices}; + for (var i:u32 = 0; i < ${s.length}; i++) { + var output_index = ${r.indicesGet("output_indices","i")}; + var input_index: u32; + var scale = ${et("uniforms.scales","i",o)}; + if (scale == 1.0) { + input_index = output_index; + } else { + var roi_low = ${et("uniforms.roi","i",n)}; + var roi_hi = ${et("uniforms.roi",`i + ${t.length}`,n)}; + var input_shape_i = ${et("uniforms.input_shape","i",t.length)}; + var output_shape_i = ${et("uniforms.output_shape","i",s.length)}; + var original_idx = getOriginalCoordinateFromResizedCoordinate(output_index, scale, output_shape_i, + input_shape_i, roi_low, roi_hi); + if (!${i} || (original_idx >= 0 && original_idx < ${r.type.value}(input_shape_i))) { + if (original_idx < 0) { + input_index = 0; + } else if (original_idx > ${r.type.value}(input_shape_i - 1)) { + input_index = input_shape_i - 1; + } else { + input_index = u32(getNearestPixelFromOriginal(original_idx, scale < 1)); + } + } else { + input_index = u32(original_idx); + } + } + ${e.indicesSet("input_indices","i","input_index")} + } + return input_indices; + }`,Nf=(e,r)=>` + fn checkInputIndices(input_indices: ${e.type.indices}) -> bool { + for (var i:u32 = 0; i < ${r.length}; i++) { + var input_index = ${e.indicesGet("input_indices","i")}; + if (input_index < 0 || input_index >= ${et("uniforms.input_shape","i",r.length)}) { + return false; + } + } + return true; + }`,Xl=(e,r,t,s)=>e.rank>s?` + ${e.indicesSet("input_indices",r,"channel")}; + ${e.indicesSet("input_indices",t,"batch")}; +`:"",Vf=(e,r,t,s,o)=>{let[n,i,a,l]=t.length===2?[-1,0,1,-1]:[0,2,3,1],u=e.type.value;return` + fn getInputValue(batch: u32, channel: u32, row: u32, col: u32) -> ${u} { + var input_indices: ${e.type.indices}; + ${e.indicesSet("input_indices",i,`max(0, min(row, ${t[i]} - 1))`)}; + ${e.indicesSet("input_indices",a,`max(0, min(col, ${t[a]} - 1))`)}; + ${Xl(e,l,n,2)} + return ${e.getByIndices("input_indices")}; + } + + fn bilinearInterpolation(output_indices: ${r.type.indices}) -> ${u} { + var originalIndices = calculateOriginalIndicesFromOutputIndices(output_indices); + var row:${u} = originalIndices[${i}]; + var col:${u} = originalIndices[${a}]; + ${s?`if (row < 0 || row > (${t[i]} - 1) || col < 0 || col > (${t[a]} - 1)) { + return ${o}; + }`:""}; + row = max(0, min(row, ${t[i]} - 1)); + col = max(0, min(col, ${t[a]} - 1)); + var row1: u32 = u32(row); + var col1: u32 = u32(col); + var row2: u32 = u32(row + 1); + var col2: u32 = u32(col + 1); + var channel: u32 = ${t.length>2?`u32(originalIndices[${l}])`:"0"}; + var batch: u32 = ${t.length>2?`u32(originalIndices[${n}])`:"0"}; + var x11: ${u} = getInputValue(batch, channel, row1, col1); + var x12: ${u} = getInputValue(batch, channel, row1, col2); + var x21: ${u} = getInputValue(batch, channel, row2, col1); + var x22: ${u} = getInputValue(batch, channel, row2, col2); + var dx1: ${u} = abs(row - ${u}(row1)); + var dx2: ${u} = abs(${u}(row2) - row); + var dy1: ${u} = abs(col - ${u}(col1)); + var dy2: ${u} = abs(${u}(col2) - col); + if (row1 == row2) { + dx1 = 0.5; + dx2 = 0.5; + } + if (col1 == col2) { + dy1 = 0.5; + dy2 = 0.5; + } + return (x11 * dx2 * dy2 + x12 * dx2 * dy1 + x21 * dx1 * dy2 + x22 * dx1 * dy1); + }`},Uf=(e,r,t,s,o,n,i,a,l,u)=>{let p=t.length===2,[d,c]=p?[0,1]:[2,3],f=e.type.value,_=T=>{let k=T===d?"row":"col";return` + fn ${k}CubicInterpolation(input_indices: ${e.type.indices}, output_indices: ${r.type.indices}) -> ${f} { + var output_index = ${r.indicesGet("output_indices",T)}; + var originalIdx: ${f} = getOriginalCoordinateFromResizedCoordinate(output_index, ${o[T]}, + ${s[T]}, ${t[T]}, ${n[T]}, ${n[T]} + ${t.length}); + var fractOriginalIdx: ${f} = originalIdx - floor(originalIdx); + var coefs = getCubicInterpolationCoefs(fractOriginalIdx); + + if (${a} && (originalIdx < 0 || originalIdx > (${t[T]} - 1))) { + return ${l}; + } + var data: array<${f}, 4> = array<${f}, 4>(0.0, 0.0, 0.0, 0.0); + for (var i: i32 = -1; i < 3; i++) { + var ${k}: ${f} = originalIdx + ${f}(i); + if (${k} < 0 || ${k} >= ${t[T]}) { + ${u?`coefs[i + 1] = 0.0; + continue;`:a?`return ${l};`:`${k} = max(0, min(${k}, ${t[T]} - 1));`}; + } + var input_indices_copy: ${e.type.indices} = input_indices; + ${e.indicesSet("input_indices_copy",T,`u32(${k})`)}; + data[i + 1] = ${T===d?e.getByIndices("input_indices_copy"):"rowCubicInterpolation(input_indices_copy, output_indices)"}; + } + return cubicInterpolation1D(data, coefs); + }`};return` + ${_(d)}; + ${_(c)}; + fn getCubicInterpolationCoefs(s: ${f}) -> array<${f}, 4> { + var absS = abs(s); + var coeffs: array<${f}, 4> = array<${f}, 4>(0.0, 0.0, 0.0, 0.0); + var oneMinusAbsS: ${f} = 1.0 - absS; + var twoMinusAbsS: ${f} = 2.0 - absS; + var onePlusAbsS: ${f} = 1.0 + absS; + coeffs[0] = ((${i} * onePlusAbsS - 5 * ${i}) * onePlusAbsS + 8 * ${i}) * onePlusAbsS - 4 * ${i}; + coeffs[1] = ((${i} + 2) * absS - (${i} + 3)) * absS * absS + 1; + coeffs[2] = ((${i} + 2) * oneMinusAbsS - (${i} + 3)) * oneMinusAbsS * oneMinusAbsS + 1; + coeffs[3] = ((${i} * twoMinusAbsS - 5 * ${i}) * twoMinusAbsS + 8 * ${i}) * twoMinusAbsS - 4 * ${i}; + return coeffs; + } + + fn cubicInterpolation1D(x: array<${f}, 4>, coefs: array<${f}, 4>) -> ${f} { + var coefsSum: ${f} = coefs[0] + coefs[1] + coefs[2] + coefs[3]; + return (x[0] * coefs[0] + x[1] * coefs[1]+ x[2] * coefs[2]+ x[3] * coefs[3]) / coefsSum; + } + + fn bicubicInterpolation(output_indices: ${r.type.indices}) -> ${f} { + var input_indices: ${e.type.indices} = output_indices; + return colCubicInterpolation(input_indices, output_indices); + } + `},Wf=(e,r,t,s,o)=>{let[n,i,a,l,u]=t.length===3?[-1,0,1,2,-1]:[0,2,3,4,1],p=e.type.value;return` + fn getInputValue(batch: u32, channel: u32, depth:u32, height: u32, width: u32) -> ${p} { + var input_indices: ${e.type.indices}; + ${e.indicesSet("input_indices",i,`max(0, min(depth, ${t[i]} - 1))`)}; + ${e.indicesSet("input_indices",a,`max(0, min(height, ${t[a]} - 1))`)}; + ${e.indicesSet("input_indices",l,`max(0, min(width, ${t[l]} - 1))`)}; + ${Xl(e,u,n,3)} + return ${e.getByIndices("input_indices")}; + } + + fn trilinearInterpolation(output_indices: ${r.type.indices}) -> ${p} { + var originalIndices = calculateOriginalIndicesFromOutputIndices(output_indices); + var depth:${p} = originalIndices[${i}]; + var height:${p} = originalIndices[${a}]; + var width:${p} = originalIndices[${l}]; + ${s?`if (depth < 0 || depth > (${t[i]} - 1) || height < 0 || height > (${t[a]} - 1) || width < 0 || (width > ${t[l]} - 1)) { + return ${o}; + }`:""}; + + depth = max(0, min(depth, ${t[i]} - 1)); + height = max(0, min(height, ${t[a]} - 1)); + width = max(0, min(width, ${t[l]} - 1)); + var depth1: u32 = u32(depth); + var height1: u32 = u32(height); + var width1: u32 = u32(width); + var depth2: u32 = u32(depth + 1); + var height2: u32 = u32(height + 1); + var width2: u32 = u32(width + 1); + var channel: u32 = ${t.length>3?`u32(originalIndices[${u}])`:"0"}; + var batch: u32 = ${t.length>3?`u32(originalIndices[${n}])`:"0"}; + + var x111: ${p} = getInputValue(batch, channel, depth1, height1, width1); + var x112: ${p} = getInputValue(batch, channel, depth1, height1, width2); + var x121: ${p} = getInputValue(batch, channel, depth1, height2, width1); + var x122: ${p} = getInputValue(batch, channel, depth1, height2, width2); + var x211: ${p} = getInputValue(batch, channel, depth2, height1, width1); + var x212: ${p} = getInputValue(batch, channel, depth2, height1, width2); + var x221: ${p} = getInputValue(batch, channel, depth2, height2, width1); + var x222: ${p} = getInputValue(batch, channel, depth2, height2, width2); + var dx1: ${p} = abs(depth - ${p}(depth1)); + var dx2: ${p} = abs(${p}(depth2) - depth); + var dy1: ${p} = abs(height - ${p}(height1)); + var dy2: ${p} = abs(${p}(height2) - height); + var dz1: ${p} = abs(width - ${p}(width1)); + var dz2: ${p} = abs(${p}(width2) - width); + if (depth1 == depth2) { + dx1 = 0.5; + dx2 = 0.5; + } + if (height1 == height2) { + dy1 = 0.5; + dy2 = 0.5; + } + if (width1 == width2) { + dz1 = 0.5; + dz2 = 0.5; + } + return (x111 * dx2 * dy2 * dz2 + x112 * dx2 * dy2 * dz1 + x121 * dx2 * dy1 *dz2 + x122 * dx2 * dy1 * dz1 + + x211 * dx1 * dy2 * dz2 + x212 * dx1 * dy2 * dz1 + x221 * dx1 * dy1 *dz2 + x222 * dx1 * dy1 * dz1); + }`},Gf=(e,r,t,s,o,n)=>{let i=e.dims,a=Lf(n,r.axes,i.length),l=zf(i,s,o,r.axes),u=s.slice();s.length===0&&(u=i.map((g,S)=>g===0?1:l[S]/g),r.keepAspectRatioPolicy!=="stretch"&&(l=Bf(i,u,r)));let p=Ye("output",e.dataType,l.length),d=Pe("input",e.dataType,i.length),c=Me.size(l),f=i.length===l.length&&i.every((g,S)=>g===l[S]),_=r.coordinateTransformMode==="tf_crop_and_resize",T=r.extrapolationValue,k=d.type.value,w=g=>` + ${f?"":` + ${Of(r.coordinateTransformMode,k)}; + ${(()=>{switch(r.mode){case"nearest":return` + ${Nf(d,i)}; + ${Df(r.nearestMode,t,k)}; + ${jf(d,p,i,l,u.length,a.length,_)}; + `;case"linear":return` + ${Rf(p,i,l,u.length,a.length)}; + ${(()=>{if(i.length===2||i.length===4)return`${Vf(d,p,i,_,T)}`;if(i.length===3||i.length===5)return`${Wf(d,p,i,_,T)}`;throw Error("Linear mode only supports input dims 2, 3, 4 and 5 are supported in linear mode.")})()}; + `;case"cubic":return` + ${(()=>{if(i.length===2||i.length===4)return`${Uf(d,p,i,l,u,a,r.cubicCoeffA,_,r.extrapolationValue,r.excludeOutside)}`;throw Error("Cubic mode only supports input dims 2 and 4 are supported in linear mode.")})()}; + `;default:throw Error("Invalid resize mode")}})()}; + `} + ${g.registerUniform("output_size","u32").registerUniform("scales","f32",u.length).registerUniform("roi","f32",a.length).declareVariables(d,p)} + ${g.mainStart()} + ${g.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + ${f?"output[global_idx] = input[global_idx];":` + let output_indices = ${p.offsetToIndices("global_idx")}; + var input_indices: ${d.type.indices}; + ${(()=>{switch(r.mode){case"nearest":return`input_indices = calculateInputIndicesFromOutputIndices(output_indices); + if (checkInputIndices(input_indices)) { + output[global_idx] = ${d.getByIndices("input_indices")}; + } else { + output[global_idx] = ${r.extrapolationValue}; + }`;case"linear":return`output[global_idx] = ${i.length===2||i.length===4?"bilinearInterpolation":"trilinearInterpolation"}(output_indices);`;case"cubic":return"output[global_idx] = bicubicInterpolation(output_indices);";default:throw Error(`Unsupported resize mode: ${r.mode}`)}})()}; +`} + }`;return{name:"Resize",shaderCache:{hint:`${r.cacheKey}|${t}|${u.length>0?r.mode==="cubic"?u:u.length:""}|${o.length>0?o:""}|${a.length>0?a:""}|${f}|${r.mode==="nearest"?i.length:i}`,inputDependencies:["rank"]},getShaderSource:w,getRunData:()=>({outputs:[{dims:l,dataType:e.dataType}],dispatchGroup:{x:Math.ceil(c/64)},programUniforms:[{type:12,data:c},{type:1,data:u},{type:1,data:a},...st(i,l)]})}},Kf=e=>{let r=e.customDataBuffer;return new Uint32Array(r,r.byteOffset,1)[0]},Hf=(e,r)=>{let t=[],s=[],o=[],n=Kf(e);if(r.antialias!==0)throw Error("Only default value (0) for Antialias attribute is supported");Ff(e.inputs,r,n,t,s,o),e.compute(Gf(e.inputs[0],r,n,t,s,o),{inputs:[0]})},qf=e=>{let r=e.antialias,t=e.axes,s=e.coordinateTransformMode,o=e.cubicCoeffA,n=e.excludeOutside!==0,i=e.extrapolationValue,a=e.keepAspectRatioPolicy,l=e.mode,u=e.nearestMode===""?"simple":e.nearestMode;return St({antialias:r,axes:t,coordinateTransformMode:s,cubicCoeffA:o,excludeOutside:n,extrapolationValue:i,keepAspectRatioPolicy:a,mode:l,nearestMode:u})}}),Xf,Qf,Jf,ix=Be(()=>{ut(),mt(),ft(),Xf=e=>{if(!e||e.length<3)throw new Error("layerNorm requires at least 3 inputs.");let r=e[0],t=e[1],s=e[2];if(r.dataType!==t.dataType||r.dataType!==s.dataType)throw new Error("All inputs must have the same data type");if(r.dims.length!==3&&r.dims.length!==2)throw new Error("Input must be 2D or 3D");if(t.dims.length!==3&&t.dims.length!==2)throw new Error("Skip must be 2D or 3D");let o=r.dims[r.dims.length-1],n=r.dims[r.dims.length-2];if(t.dims[t.dims.length-1]!==o)throw new Error("Skip must have the same hidden size as input");if(t.dims[t.dims.length-2]!==n)throw new Error("Skip must have the same sequence length as input");if(s.dims.length!==1)throw new Error("Gamma must be 1D");if(s.dims[s.dims.length-1]!==o)throw new Error("Gamma must have the same hidden size as input");if(e.length>3){let i=e[3];if(i.dims.length!==1)throw new Error("Beta must be 1D");if(i.dims[i.dims.length-1]!==o)throw new Error("Beta must have the same hidden size as input")}if(e.length>4){let i=e[4];if(i.dims.length!==1)throw new Error("Bias must be 1D");if(i.dims[i.dims.length-1]!==o)throw new Error("Bias must have the same hidden size as input")}},Qf=(e,r,t,s)=>{let o=r.simplified,n=e[0].dims,i=Me.size(n),a=n,l=i,u=n.slice(-1)[0],p=s?n.slice(0,-1).concat(1):[],d=!o&&e.length>3,c=e.length>4,f=s&&t>1,_=s&&t>2,T=t>3,k=64,w=Kt(u),g=[{type:12,data:l},{type:12,data:w},{type:12,data:u},{type:1,data:r.epsilon}],S=y=>{let M=[{name:"output_size",type:"u32"},{name:"components",type:"u32"},{name:"hidden_size",type:"u32"},{name:"epsilon",type:"f32"}],v=[Pe("x",e[0].dataType,e[0].dims,w),Pe("skip",e[1].dataType,e[1].dims,w),Pe("gamma",e[2].dataType,e[2].dims,w)];d&&v.push(Pe("beta",e[3].dataType,e[3].dims,w)),c&&v.push(Pe("bias",e[4].dataType,e[4].dims,w)),v.push(Ye("output",e[0].dataType,a,w)),f&&v.push(Ye("mean_output",1,p)),_&&v.push(Ye("inv_std_output",1,p)),T&&v.push(Ye("input_skip_bias_sum",e[0].dataType,a,w));let C=lr(e[0].dataType),A=lr(1,w);return` + + ${y.registerUniforms(M).declareVariables(...v)} + var sum_shared : array<${A}, ${k}>; + var sum_squared_shared : array<${A}, ${k}>; + + ${y.mainStart([k,1,1])} + let ix = local_id.x; + let iy = global_id.x / ${k}; + + let hidden_size_vectorized: u32 = uniforms.hidden_size / uniforms.components; + var stride = hidden_size_vectorized / ${k}; + let offset = ix * stride + iy * hidden_size_vectorized; + let offset1d = stride * ix; + if (ix == ${k-1}) { + stride = hidden_size_vectorized - stride * ix; + } + for (var i: u32 = 0; i < stride; i++) { + let skip_value = skip[offset + i]; + let bias_value = ${c?"bias[offset1d + i]":C+"(0.0)"}; + let input_value = x[offset + i]; + let value = input_value + skip_value + bias_value; + ${T?"input_skip_bias_sum[offset + i] = value;":""} + output[offset + i] = value; + let f32_value = ${Un(C,w,"value")}; + sum_shared[ix] += f32_value; + sum_squared_shared[ix] += f32_value * f32_value; + } + workgroupBarrier(); + + var reduce_size : u32 = ${k}; + for (var curr_size = reduce_size >> 1; curr_size > 0; curr_size = reduce_size >> 1) { + reduce_size = curr_size + (reduce_size & 1); + if (ix < curr_size) { + sum_shared[ix] += sum_shared[ix + reduce_size]; + sum_squared_shared[ix] += sum_squared_shared[ix + reduce_size]; + } + workgroupBarrier(); + } + + let sum = sum_shared[0]; + let square_sum = sum_squared_shared[0]; + let mean = ${Ls("sum",w)} / f32(uniforms.hidden_size); + let inv_std_dev = inverseSqrt(${Ls("square_sum",w)} / f32(uniforms.hidden_size) ${o?"":"- mean * mean"} + uniforms.epsilon); + ${f?"mean_output[global_idx] = mean;":""} + ${_?"inv_std_output[global_idx] = inv_std_dev;":""} + + for (var i: u32 = 0; i < stride; i++) { + output[offset + i] = (output[offset + i] ${o?"":`- ${C}(mean)`}) * + ${C}(inv_std_dev) * gamma[offset1d + i] + ${d?"+ beta[offset1d + i]":""}; + } + }`},E=[{dims:a,dataType:e[0].dataType}];return t>1&&E.push({dims:p,dataType:1}),t>2&&E.push({dims:p,dataType:1}),t>3&&E.push({dims:n,dataType:e[0].dataType}),{name:"SkipLayerNormalization",shaderCache:{hint:`${w};${f};${_};${T}`,inputDependencies:e.map((y,M)=>"type")},getShaderSource:S,getRunData:()=>({outputs:E,dispatchGroup:{x:Math.ceil(l/u)},programUniforms:g})}},Jf=(e,r)=>{Xf(e.inputs);let t=[0];e.outputCount>1&&t.push(-3),e.outputCount>2&&t.push(-3),e.outputCount>3&&t.push(3),e.compute(Qf(e.inputs,r,e.outputCount,!1),{outputs:t})}}),Yf,vo,Zf,Ql,eg,tg,rg,sg,ax=Be(()=>{ut(),mt(),Xt(),ft(),Yf=(e,r)=>{if(!e||e.length<1)throw new Error("too few inputs");if(r.axes.length!==0){if(r.axes.length!==r.starts.length||r.axes.length!==r.ends.length)throw new Error("axes, starts and ends must have the same length")}else if(r.starts.length!==r.ends.length)throw new Error("starts and ends must have the same length");e.slice(1).forEach((t,s)=>{if(e[s+1].dataType!==6&&e[s+1].dataType!==7)throw new Error(`Input ${s} must be an array of int32 or int64`)})},vo=(e,r)=>{let t=[];if(e.length>r)if(e[r].dataType===7)e[r].getBigInt64Array().forEach(s=>t.push(Number(s)));else if(e[r].dataType===6)e[r].getInt32Array().forEach(s=>t.push(Number(s)));else throw new Error(`Input ${r} must be an array of int32 or int64`);return t},Zf=(e,r)=>{if(e.length>1){let t=vo(e,1),s=vo(e,2),o=vo(e,3);return o.length===0&&(o=[...Array(e[0].dims.length).keys()]),St({starts:t,ends:s,axes:o})}else return r},Ql=(e,r,t,s,o)=>{let n=e;return e<0&&(n+=t[s[r]]),o[r]<0?Math.max(0,Math.min(n,t[s[r]]-1)):Math.max(0,Math.min(n,t[s[r]]))},eg=(e,r,t)=>`fn calculateInputIndices(output_indices: ${r.type.indices}) -> ${e.type.indices} { + var input_indices: ${e.type.indices}; + var carry = 0u; + for (var i = ${t.length}; i >= 0; i--) { + let input_shape_i = ${et("uniforms.input_shape","i",t.length)}; + let steps_i = ${et("uniforms.steps","i",t.length)}; + let signs_i = ${et("uniforms.signs","i",t.length)}; + let starts_i = ${et("uniforms.starts","i",t.length)}; + var output_index = ${r.indicesGet("output_indices","i")}; + var input_index = output_index * steps_i + starts_i + carry; + carry = input_index / input_shape_i; + input_index = input_index % input_shape_i; + if (signs_i < 0) { + input_index = input_shape_i - input_index - 1u + starts_i; + } + ${e.indicesSet("input_indices","i","input_index")}; + } + return input_indices; + }`,tg=(e,r)=>{let t=e[0].dims,s=Me.size(t),o=r.axes.length>0?Me.normalizeAxes(r.axes,t.length):[...Array(t.length).keys()],n=vo(e,4);n.forEach(w=>w!==0||(()=>{throw new Error("step cannot be 0")})),n.length===0&&(n=Array(o.length).fill(1));let i=r.starts.map((w,g)=>Ql(w,g,t,o,n)),a=r.ends.map((w,g)=>Ql(w,g,t,o,n));if(o.length!==i.length||o.length!==a.length)throw new Error("start, ends and axes should have the same number of elements");if(o.length!==t.length)for(let w=0;wMath.sign(w));n.forEach((w,g,S)=>{if(w<0){let E=(a[g]-i[g])/w,y=i[g],M=y+E*n[g];i[g]=M,a[g]=y,S[g]=-w}});let u=t.slice(0);o.forEach((w,g)=>{u[w]=Math.ceil((a[w]-i[w])/n[w])});let p={dims:u,dataType:e[0].dataType},d=Ye("output",e[0].dataType,u.length),c=Pe("input",e[0].dataType,e[0].dims.length),f=Me.size(u),_=[{name:"outputSize",type:"u32"},{name:"starts",type:"u32",length:i.length},{name:"signs",type:"i32",length:l.length},{name:"steps",type:"u32",length:n.length}],T=[{type:12,data:f},{type:12,data:i},{type:6,data:l},{type:12,data:n},...st(e[0].dims,u)],k=w=>` + ${w.registerUniforms(_).declareVariables(c,d)} + ${eg(c,d,t)} + ${w.mainStart()} + ${w.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.outputSize")} + let output_indices = ${d.offsetToIndices("global_idx")}; + let input_indices = calculateInputIndices(output_indices); + ${d.setByOffset("global_idx",c.getByIndices("input_indices"))} + }`;return{name:"Slice",shaderCache:{hint:`${l.length}_${i.length}_${n.length}`,inputDependencies:["rank"]},getShaderSource:k,getRunData:()=>({outputs:[p],dispatchGroup:{x:Math.ceil(s/64)},programUniforms:T})}},rg=(e,r)=>{Yf(e.inputs,r);let t=Zf(e.inputs,r);e.compute(tg(e.inputs,t),{inputs:[0]})},sg=e=>{let r=e.starts,t=e.ends,s=e.axes;return St({starts:r,ends:t,axes:s})}}),ng,og,ig,ag,lx=Be(()=>{ut(),mt(),Xt(),zs(),ft(),ng=e=>{if(!e||e.length!==1)throw new Error("Softmax op requires 1 input.")},og=(e,r)=>{let t=e.inputs[0],s=t.dims,o=Me.size(s),n=s.length,i=Me.normalizeAxis(r.axis,n),a=iC),u[i]=n-1,u[n-1]=i,l=e.compute(Lr(t,u),{inputs:[t],outputs:[-1]})[0]):l=t;let p=l.dims,d=p[n-1],c=o/d,f=Kt(d),_=d/f,T=64;c===1&&(T=256);let k=(v,C)=>C===4?`max(max(${v}.x, ${v}.y), max(${v}.z, ${v}.w))`:C===2?`max(${v}.x, ${v}.y)`:C===3?`max(max(${v}.x, ${v}.y), ${v}.z)`:v,w=Pe("x",l.dataType,l.dims,f),g=Ye("result",l.dataType,l.dims,f),S=w.type.value,E=lr(l.dataType)==="f32"?`var threadMax = ${S}(-3.402823e+38f);`:`var threadMax = ${S}(-65504.0h);`,y=v=>` + var rowMaxShared : ${S}; + var rowSumShared : ${S}; + var threadShared : array<${S}, ${T}>; + + fn getValue(row: i32, col: i32, row_stride: i32) -> ${S} { + let index = row * row_stride + col; + return x[index]; + } + + fn setValue(row: i32, col: i32, row_stride: i32, value: ${S}) { + let index = row * row_stride + col; + result[index] = value; + } + ${v.registerUniform("packedCols","i32").declareVariables(w,g)} + ${v.mainStart(T)} + let gindex = i32(global_idx); + let lindex = i32(local_idx); + const wg = ${T}; + let row = gindex / wg; + let cols = uniforms.packedCols; + let row_stride : i32 = uniforms.packedCols; + + // find the rows max + ${E} + for (var col = lindex; col < cols; col += wg) { + let value = getValue(row, col, row_stride); + threadMax = max(threadMax, value); + } + if (lindex < cols) { + threadShared[lindex] = threadMax; + } + workgroupBarrier(); + + var reduceSize = min(cols, wg); + for (var currSize = reduceSize >> 1; currSize > 0; currSize = reduceSize >> 1) { + reduceSize = currSize + (reduceSize & 1); + if (lindex < currSize) { + threadShared[lindex] = max(threadShared[lindex], threadShared[lindex + reduceSize]); + } + workgroupBarrier(); + } + if (lindex == 0) { + rowMaxShared = ${S}(${k("threadShared[0]",f)}); + } + workgroupBarrier(); + + // find the rows sum + var threadSum = ${S}(0.0); + for (var col = lindex; col < cols; col += wg) { + let subExp = exp(getValue(row, col, row_stride) - rowMaxShared); + threadSum += subExp; + } + threadShared[lindex] = threadSum; + workgroupBarrier(); + + for (var currSize = wg >> 1; currSize > 0; currSize = currSize >> 1) { + if (lindex < currSize) { + threadShared[lindex] = threadShared[lindex] + threadShared[lindex + currSize]; + } + workgroupBarrier(); + } + if (lindex == 0) { + rowSumShared = ${S}(${Ls("threadShared[0]",f)}); + } + workgroupBarrier(); + + // calculate final value for each element in the row + for (var col = lindex; col < cols; col += wg) { + let value = exp(getValue(row, col, row_stride) - rowMaxShared) / rowSumShared; + setValue(row, col, row_stride, value); + } + }`,M=e.compute({name:"Softmax",shaderCache:{hint:`${f};${T}`,inputDependencies:["type"]},getRunData:()=>({outputs:[{dims:p,dataType:l.dataType}],dispatchGroup:{x:c},programUniforms:[{type:6,data:_}]}),getShaderSource:y},{inputs:[l],outputs:[a?-1:0]})[0];a&&e.compute(Lr(M,u),{inputs:[M]})},ig=(e,r)=>{ng(e.inputs),og(e,r)},ag=e=>St({axis:e.axis})}),Jl,lg,ug,dg,cg,ux=Be(()=>{ut(),mt(),ft(),Jl=e=>Array.from(e.getBigInt64Array(),Number),lg=e=>{if(!e||e.length!==2)throw new Error("Tile requires 2 inputs.");if(e[0].dataType!==1&&e[0].dataType!==10&&e[0].dataType!==6&&e[0].dataType!==12)throw new Error("Tile only support float, float16, int32, and uint32 data types");if(e[1].dataType!==7)throw new Error("Tile `repeats` input should be of int64 data type");if(e[1].dims.length!==1)throw new Error("Tile `repeats` input should be 1-D");if(Jl(e[1]).length!==e[0].dims.length)throw new Error("Tile `repeats` input should have same number of elements as rank of input data tensor")},ug=(e,r)=>{let t=[];for(let s=0;s{let t=e[0].dims,s=r??Jl(e[1]),o=ug(t,s),n=Me.size(o),i=e[0].dataType,a=Pe("input",i,t.length),l=Ye("output",i,o.length),u=p=>` + const inputShape = ${a.indices(...t)}; + ${p.registerUniform("output_size","u32").declareVariables(a,l)} + ${p.mainStart()} + ${p.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.output_size")} + let output_indices = ${l.offsetToIndices("global_idx")}; + var input_indices: ${a.type.indices}; + for (var i = 0; i < ${t.length}; i++) { + let input_dim_i = ${a.indicesGet("uniforms.input_shape","i")}; + let input_dim_value = ${l.indicesGet("output_indices","i")} % input_dim_i; + + ${a.indicesSet("input_indices","i","input_dim_value")} + } + ${l.setByOffset("global_idx",a.getByIndices("input_indices"))} + }`;return{name:"Tile",shaderCache:{hint:`${s}`,inputDependencies:["rank"]},getRunData:()=>({outputs:[{dims:o,dataType:e[0].dataType}],dispatchGroup:{x:Math.ceil(n/64)},programUniforms:[{type:12,data:n},...st(e[0].dims,o)]}),getShaderSource:u}},cg=e=>{lg(e.inputs),e.compute(dg(e.inputs),{inputs:[0]})}}),pg,hg,mg,dx=Be(()=>{ut(),mt(),ft(),pg=(e,r,t,s,o)=>{let n=Ye("output_data",o,t.length,4),i=Pe("a_data",r[1].dataType,r[1].dims.length,4),a=Pe("b_data",r[2].dataType,r[2].dims.length,4),l=Pe("c_data",r[0].dataType,r[0].dims.length,4),u,p=(d,c,f)=>`select(${c}, ${d}, ${f})`;if(!s)u=n.setByOffset("global_idx",p(i.getByOffset("global_idx"),a.getByOffset("global_idx"),l.getByOffset("global_idx")));else{let d=(c,f,_="")=>{let T=`a_data[index_a${f}][component_a${f}]`,k=`b_data[index_b${f}][component_b${f}]`,w=`bool(c_data[index_c${f}] & (0xffu << (component_c${f} * 8)))`;return` + let output_indices${f} = ${n.offsetToIndices(`global_idx * 4u + ${f}u`)}; + let offset_a${f} = ${i.broadcastedIndicesToOffset(`output_indices${f}`,n)}; + let offset_b${f} = ${a.broadcastedIndicesToOffset(`output_indices${f}`,n)}; + let offset_c${f} = ${l.broadcastedIndicesToOffset(`output_indices${f}`,n)}; + let index_a${f} = offset_a${f} / 4u; + let index_b${f} = offset_b${f} / 4u; + let index_c${f} = offset_c${f} / 4u; + let component_a${f} = offset_a${f} % 4u; + let component_b${f} = offset_b${f} % 4u; + let component_c${f} = offset_c${f} % 4u; + ${c}[${f}] = ${_}(${p(T,k,w)}); + `};o===9?u=` + var data = vec4(0); + ${d("data",0,"u32")} + ${d("data",1,"u32")} + ${d("data",2,"u32")} + ${d("data",3,"u32")} + output_data[global_idx] = dot(vec4(0x1, 0x100, 0x10000, 0x1000000), vec4(data));`:u=` + ${d("output_data[global_idx]",0)} + ${d("output_data[global_idx]",1)} + ${d("output_data[global_idx]",2)} + ${d("output_data[global_idx]",3)} + `}return` + ${e.registerUniform("vec_size","u32").declareVariables(l,i,a,n)} + ${e.mainStart()} + ${e.guardAgainstOutOfBoundsWorkgroupSizes("uniforms.vec_size")} + ${u} + }`},hg=e=>{let r=e[1].dims,t=e[2].dims,s=e[0].dims,o=e[1].dataType,n=!(Me.areEqual(r,t)&&Me.areEqual(t,s)),i=r,a=Me.size(r);if(n){let u=Nn.calcShape(Nn.calcShape(r,t,!1),s,!1);if(!u)throw new Error("Can't perform where op on the given tensors");i=u,a=Me.size(i)}let l=Math.ceil(a/4);return{name:"Where",shaderCache:{inputDependencies:["rank","rank","rank"]},getShaderSource:u=>pg(u,e,i,n,o),getRunData:()=>({outputs:[{dims:i,dataType:o}],dispatchGroup:{x:Math.ceil(a/64/4)},programUniforms:[{type:12,data:l},...st(s,r,t,i)]})}},mg=e=>{e.compute(hg(e.inputs))}}),_g,cx=Be(()=>{Ev(),cl(),Pv(),Cv(),Sv(),$v(),kv(),Dv(),zv(),Bv(),Rv(),jv(),Nv(),Vv(),Uv(),Wv(),Gv(),Kv(),Hv(),qv(),Xv(),Qv(),Jv(),Yv(),Zv(),P_(),ex(),tx(),rx(),sx(),nx(),ll(),ox(),L_(),ix(),ax(),lx(),F_(),ux(),zs(),_l(),dx(),_g=new Map([["Abs",[qp]],["Acos",[Xp]],["Acosh",[Qp]],["Add",[zh]],["ArgMax",[Fp,dl]],["ArgMin",[Ap,dl]],["Asin",[Jp]],["Asinh",[Yp]],["Atan",[Zp]],["Atanh",[eh]],["Attention",[Rp]],["AveragePool",[hf,pf]],["BatchNormalization",[Up]],["BiasAdd",[Kp]],["BiasSplitGelu",[Oh]],["Cast",[rh,th]],["Ceil",[oh]],["Clip",[nh]],["Concat",[Jh,Yh]],["Conv",[Sl,Pl]],["ConvTranspose",[Em,vm]],["Cos",[ih]],["Cosh",[ah]],["CumSum",[Cm,Sm]],["DepthToSpace",[Am,Fm]],["DequantizeLinear",[vf,xf]],["Div",[Bh]],["Einsum",[Rm,jm]],["Elu",[lh,fo]],["Equal",[Rh]],["Erf",[uh]],["Exp",[dh]],["Expand",[Wm]],["FastGelu",[Km]],["Floor",[ch]],["FusedConv",[Sl,Pl]],["Gather",[Qm,Xm]],["GatherElements",[a_,i_]],["GatherBlockQuantized",[r_,s_]],["GatherND",[Ym,Zm]],["Gelu",[ph]],["Gemm",[c_,d_]],["GlobalAveragePool",[_f,mf]],["GlobalMaxPool",[Mf,wf]],["Greater",[Uh]],["GreaterOrEqual",[Gh]],["GridSample",[b_,y_]],["GroupQueryAttention",[j_]],["HardSigmoid",[bh,Mh]],["InstanceNormalization",[U_]],["LayerNormalization",[K_]],["LeakyRelu",[hh,fo]],["Less",[Wh]],["LessOrEqual",[Kh]],["Log",[Sh]],["MatMul",[q_]],["MatMulNBits",[Y_,Z_]],["MaxPool",[ff,gf]],["Mul",[jh]],["MultiHeadAttention",[E_,x_]],["Neg",[_h]],["Not",[mh]],["Pad",[uf]],["Pow",[Nh]],["QuickGelu",[Ih,fo]],["Range",[Pf]],["Reciprocal",[fh]],["ReduceMin",[Cp]],["ReduceMean",[vp]],["ReduceMax",[Pp]],["ReduceSum",[$p]],["ReduceProd",[Sp]],["ReduceL1",[xp]],["ReduceL2",[Tp]],["ReduceLogSum",[Ip]],["ReduceLogSumExp",[Ep]],["ReduceSumSquare",[kp]],["Relu",[gh]],["Resize",[Hf,qf]],["RotaryEmbedding",[D_]],["ScatterND",[kf,$f]],["Sigmoid",[wh]],["Sin",[yh]],["Sinh",[vh]],["Slice",[rg,sg]],["SkipLayerNormalization",[Jf]],["Split",[I_,A_]],["Sqrt",[xh]],["Softmax",[ig,ag]],["Sub",[Vh]],["Tan",[Th]],["Tanh",[Eh]],["ThresholdedRelu",[Ch,fo]],["Tile",[cg]],["Transpose",[Uc,Wc]],["Where",[mg]]])}),fg,px=Be(()=>{ts(),Es(),ft(),fg=class{constructor(e){this.backend=e,this.repo=new Map,this.attributesBound=!1}getArtifact(e){return this.repo.get(e)}setArtifact(e,r){this.repo.set(e,r)}run(e,r,t,s,o){es(e.programInfo.name);let n=this.backend.device,i=this.backend.getComputePassEncoder();this.backend.writeTimestamp(this.backend.pendingDispatchNumber*2);let a=[];for(let u of r)a.push({binding:a.length,resource:{buffer:u.buffer}});for(let u of t)a.push({binding:a.length,resource:{buffer:u.buffer}});o&&a.push({binding:a.length,resource:o});let l=n.createBindGroup({layout:e.computePipeline.getBindGroupLayout(0),entries:a,label:e.programInfo.name});if(this.backend.sessionStatus==="capturing"){let u={kernelId:this.backend.currentKernelId,computePipeline:e.computePipeline,bindGroup:l,dispatchGroup:s};this.backend.capturedCommandList.get(this.backend.currentSessionId).push(u)}i.setPipeline(e.computePipeline),i.setBindGroup(0,l),i.dispatchWorkgroups(...s),this.backend.writeTimestamp(this.backend.pendingDispatchNumber*2+1),this.backend.pendingDispatchNumber++,(this.backend.pendingDispatchNumber>=this.backend.maxDispatchNumber||this.backend.queryType==="at-passes")&&this.backend.endComputePass(),this.backend.pendingDispatchNumber>=this.backend.maxDispatchNumber&&this.backend.flush(),Gr(e.programInfo.name)}dispose(){}build(e,r){es(e.name);let t=this.backend.device,s=[];[{feature:"shader-f16",extension:"f16"},{feature:"subgroups",extension:"subgroups"}].forEach(u=>{t.features.has(u.feature)&&s.push(`enable ${u.extension};`)});let o=zc(r,this.backend.device.limits),n=e.getShaderSource(o),i=`${s.join(` +`)} +${o.additionalImplementations} +${n}`,a=t.createShaderModule({code:i,label:e.name});vt("verbose",()=>`[WebGPU] ${e.name} shader code: ${i}`);let l=t.createComputePipeline({compute:{module:a,entryPoint:"main"},layout:"auto",label:e.name});return Gr(e.name),{programInfo:e,computePipeline:l,uniformVariablesInfo:o.variablesInfo}}normalizeDispatchGroupSize(e){let r=typeof e=="number"?e:e.x,t=typeof e=="number"?1:e.y||1,s=typeof e=="number"?1:e.z||1,o=this.backend.device.limits.maxComputeWorkgroupsPerDimension;if(r<=o&&t<=o&&s<=o)return[r,t,s];let n=r*t*s,i=Math.ceil(Math.sqrt(n));if(i>o){if(i=Math.ceil(Math.cbrt(n)),i>o)throw new Error("Total dispatch size exceeds WebGPU maximum.");return[i,i,i]}else return[i,i,1]}}}),gg={};Rn(gg,{WebGpuBackend:()=>yg});var wg,Mg,bg,yg,hx=Be(()=>{ts(),ut(),Es(),xc(),xv(),cx(),px(),wg=(e,r)=>{if(r.length!==e.length)throw new Error(`inputDependencies length ${r.length} is not equal to inputTensors length ${e.length}.`);let t=[];for(let s=0;s{var o,n;let s=e.name;return(o=e.shaderCache)!=null&&o.hint&&(s+="["+e.shaderCache.hint+"]"),s+=":"+t+`:${wg(r,((n=e.shaderCache)==null?void 0:n.inputDependencies)??new Array(r.length).fill("dims"))}`,s},bg=class{constructor(e){e&&(this.architecture=e.architecture,this.vendor=e.vendor)}isArchitecture(e){return this.architecture===e}isVendor(e){return this.vendor===e}},yg=class{constructor(){this.currentSessionId=null,this.currentKernelId=null,this.commandEncoder=null,this.computePassEncoder=null,this.maxDispatchNumber=16,this.pendingDispatchNumber=0,this.pendingKernels=[],this.pendingQueries=new Map,this.sessionStatus="default",this.capturedCommandList=new Map,this.capturedPendingKernels=new Map,this.sessionExternalDataMapping=new Map}get currentKernelCustomData(){if(this.currentKernelId===null)throw new Error("currentKernelCustomData(): currentKernelId is null. (should not happen)");let e=this.kernelCustomData.get(this.currentKernelId);return e||(e={},this.kernelCustomData.set(this.currentKernelId,e)),e}async initialize(e,r){this.env=e;let t=[],s={requiredLimits:{maxComputeWorkgroupStorageSize:r.limits.maxComputeWorkgroupStorageSize,maxComputeWorkgroupsPerDimension:r.limits.maxComputeWorkgroupsPerDimension,maxStorageBufferBindingSize:r.limits.maxStorageBufferBindingSize,maxBufferSize:r.limits.maxBufferSize,maxComputeInvocationsPerWorkgroup:r.limits.maxComputeInvocationsPerWorkgroup,maxComputeWorkgroupSizeX:r.limits.maxComputeWorkgroupSizeX,maxComputeWorkgroupSizeY:r.limits.maxComputeWorkgroupSizeY,maxComputeWorkgroupSizeZ:r.limits.maxComputeWorkgroupSizeZ},requiredFeatures:t},o=n=>r.features.has(n)&&t.push(n)&&!0;o("chromium-experimental-timestamp-query-inside-passes")||o("timestamp-query"),o("shader-f16"),o("subgroups"),this.device=await r.requestDevice(s),this.adapterInfo=new bg(r.info||await r.requestAdapterInfo()),this.gpuDataManager=Fc(this),this.programManager=new fg(this),this.kernels=new Map,this.kernelPersistentData=new Map,this.kernelCustomData=new Map,Ka(e.logLevel,!!e.debug),this.device.onuncapturederror=n=>{n.error instanceof GPUValidationError&&console.error(`An uncaught WebGPU validation error was raised: ${n.error.message}`)},Object.defineProperty(this.env.webgpu,"device",{value:this.device,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(this.env.webgpu,"adapter",{value:r,writable:!1,enumerable:!0,configurable:!1}),this.setQueryType()}dispose(){typeof this.querySet<"u"&&this.querySet.destroy(),this.gpuDataManager.dispose()}getCommandEncoder(){return this.commandEncoder||(this.commandEncoder=this.device.createCommandEncoder()),this.commandEncoder}getComputePassEncoder(){if(!this.computePassEncoder){let e=this.getCommandEncoder(),r={};this.queryType==="at-passes"&&(r.timestampWrites={querySet:this.querySet,beginningOfPassWriteIndex:this.pendingDispatchNumber*2,endOfPassWriteIndex:this.pendingDispatchNumber*2+1}),this.computePassEncoder=e.beginComputePass(r)}return this.computePassEncoder}endComputePass(){this.computePassEncoder&&(this.computePassEncoder.end(),this.computePassEncoder=null)}flush(){if(!this.commandEncoder)return;es(),this.endComputePass();let e;this.queryType!=="none"&&(this.commandEncoder.resolveQuerySet(this.querySet,0,this.pendingDispatchNumber*2,this.queryResolveBuffer,0),e=this.device.createBuffer({size:this.pendingDispatchNumber*2*8,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.pendingQueries.set(e,this.pendingKernels),this.pendingKernels=[],this.commandEncoder.copyBufferToBuffer(this.queryResolveBuffer,0,e,0,this.pendingDispatchNumber*2*8)),this.device.queue.submit([this.commandEncoder.finish()]),this.gpuDataManager.refreshPendingBuffers(),this.commandEncoder=null,this.pendingDispatchNumber=0,this.queryType!=="none"&&e.mapAsync(GPUMapMode.READ).then(()=>{var s;let r=new BigUint64Array(e.getMappedRange()),t=this.pendingQueries.get(e);for(let o=0;o"u"&&(this.queryTimeBase=f);let T=Number(f-this.queryTimeBase),k=Number(_-this.queryTimeBase);if(!Number.isSafeInteger(T)||!Number.isSafeInteger(k))throw new RangeError("incorrect timestamp range");if((s=this.env.webgpu.profiling)!=null&&s.ondata)this.env.webgpu.profiling.ondata({version:1,inputsMetadata:d.map(w=>({dims:w.dims,dataType:Ts(w.dataType)})),outputsMetadata:c.map(w=>({dims:w.dims,dataType:Ts(w.dataType)})),kernelId:i,kernelType:l,kernelName:u,programName:p,startTime:T,endTime:k});else{let w="";d.forEach((S,E)=>{w+=`input[${E}]: [${S.dims}] | ${Ts(S.dataType)}, `});let g="";c.forEach((S,E)=>{g+=`output[${E}]: [${S.dims}] | ${Ts(S.dataType)}, `}),console.log(`[profiling] kernel "${i}|${l}|${u}|${p}" ${w}${g}execution time: ${k-T} ns`)}co("GPU",`${p}::${f}::${_}`)}e.unmap(),this.pendingQueries.delete(e)}),Gr()}run(e,r,t,s,o,n){es(e.name);let i=[];for(let g=0;gS):t;if(p.length!==a.length)throw new Error(`Output size ${p.length} must be equal to ${a.length}.`);let d=[],c=[];for(let g=0;g=n)throw new Error(`Invalid output index: ${p[g]}`);if(p[g]===-3)continue;let S=p[g]===-1,E=p[g]===-2,y=S||E?o(a[g].dataType,a[g].dims):s(p[g],a[g].dataType,a[g].dims);if(d.push(y),y.data===0)continue;let M=this.gpuDataManager.get(y.data);if(!M)throw new Error(`no GPU data for output: ${y.data}`);if(S&&this.temporaryData.push(M),E){let v=this.kernelPersistentData.get(this.currentKernelId);v||(v=[],this.kernelPersistentData.set(this.currentKernelId,v)),v.push(M)}c.push(M)}if(i.length!==r.length||c.length!==d.length){if(c.length===0)return Gr(e.name),d;throw new Error(`Program ${e.name} has zero-sized tensor(s) in inputs or outputs. This is not supported now.`)}let f;if(u){let g=0,S=[];u.forEach(v=>{let C=typeof v.data=="number"?[v.data]:v.data;if(C.length===0)return;let A=v.type===10?2:4,B,K;v.type===10?(K=C.length>4?16:C.length>2?8:C.length*A,B=C.length>4?16:A*C.length):(K=C.length<=2?C.length*A:16,B=16),g=Math.ceil(g/K)*K,S.push(g);let G=v.type===10?8:4;g+=C.length>4?Math.ceil(C.length/G)*B:C.length*A});let E=16;g=Math.ceil(g/E)*E;let y=new ArrayBuffer(g);u.forEach((v,C)=>{let A=S[C],B=typeof v.data=="number"?[v.data]:v.data;if(v.type===6)new Int32Array(y,A,B.length).set(B);else if(v.type===12)new Uint32Array(y,A,B.length).set(B);else if(v.type===10)new Uint16Array(y,A,B.length).set(B);else if(v.type===1)new Float32Array(y,A,B.length).set(B);else throw new Error(`Unsupported uniform type: ${Ts(v.type)}`)});let M=this.gpuDataManager.create(g,GPUBufferUsage.COPY_DST|GPUBufferUsage.UNIFORM);this.device.queue.writeBuffer(M.buffer,0,y,0,g),this.gpuDataManager.release(M.id),f={offset:0,size:g,buffer:M.buffer}}let _=this.programManager.normalizeDispatchGroupSize(l),T=_[1]===1&&_[2]===1,k=Mg(e,r,T),w=this.programManager.getArtifact(k);if(w||(w=this.programManager.build(e,_),this.programManager.setArtifact(k,w),vt("info",()=>`[artifact] key: ${k}, programName: ${e.name}`)),u&&w.uniformVariablesInfo){if(u.length!==w.uniformVariablesInfo.length)throw new Error(`Uniform variables count mismatch: expect ${w.uniformVariablesInfo.length}, got ${u.length} in program "${w.programInfo.name}".`);for(let g=0;g`[ProgramManager] run "${e.name}" (key=${k}) with ${_[0]}x${_[1]}x${_[2]}`),this.queryType!=="none"||this.sessionStatus==="capturing"){let g={kernelId:this.currentKernelId,programName:w.programInfo.name,inputTensorViews:r,outputTensorViews:d};this.pendingKernels.push(g),this.sessionStatus==="capturing"&&this.capturedPendingKernels.get(this.currentSessionId).push(g)}return this.programManager.run(w,i,c,_,f),Gr(e.name),d}upload(e,r){this.gpuDataManager.upload(e,r)}memcpy(e,r){this.gpuDataManager.memcpy(e,r)}async download(e,r){await this.gpuDataManager.download(e,r)}alloc(e){return this.gpuDataManager.create(e).id}free(e){return this.gpuDataManager.release(e)}createKernel(e,r,t,s){let o=_g.get(e);if(!o)throw new Error(`kernel not implemented: ${e}`);let n={kernelType:e,kernelName:s,kernelEntry:o[0],attributes:[o[1],t]};this.kernels.set(r,n)}releaseKernel(e){let r=this.kernelPersistentData.get(e);if(r){for(let t of r)this.gpuDataManager.release(t.id);this.kernelPersistentData.delete(e)}this.kernelCustomData.delete(e),this.kernels.delete(e)}computeKernel(e,r,t){let s=this.kernels.get(e);if(!s)throw new Error(`kernel not created: ${e}`);let o=s.kernelType,n=s.kernelName,i=s.kernelEntry,a=s.attributes;if(this.currentKernelId!==null)throw new Error(`kernel "[${o}] ${n}" is not allowed to be called recursively`);this.currentKernelId=e,a[0]&&(a[1]=a[0](a[1]),a[0]=void 0),vt("info",()=>`[WebGPU] Start to run kernel "[${o}] ${n}"...`);let l=this.env.debug;this.temporaryData=[];try{return l&&this.device.pushErrorScope("validation"),i(r,a[1]),0}catch(u){return t.push(Promise.resolve(`[WebGPU] Kernel "[${o}] ${n}" failed. ${u}`)),1}finally{l&&t.push(this.device.popErrorScope().then(u=>u?`GPU validation error for kernel "[${o}] ${n}": ${u.message}`:null));for(let u of this.temporaryData)this.gpuDataManager.release(u.id);this.temporaryData=[],this.currentKernelId=null}}registerBuffer(e,r,t,s){let o=this.sessionExternalDataMapping.get(e);o||(o=new Map,this.sessionExternalDataMapping.set(e,o));let n=o.get(r),i=this.gpuDataManager.registerExternalBuffer(t,s,n);return o.set(r,[i,t]),i}unregisterBuffers(e){let r=this.sessionExternalDataMapping.get(e);r&&(r.forEach(t=>this.gpuDataManager.unregisterExternalBuffer(t[0])),this.sessionExternalDataMapping.delete(e))}getBuffer(e){let r=this.gpuDataManager.get(e);if(!r)throw new Error(`no GPU data for buffer: ${e}`);return r.buffer}createDownloader(e,r,t){return async()=>{let s=await sl(this,e,r);return Ha(s.buffer,t)}}writeTimestamp(e){this.queryType==="inside-passes"&&this.computePassEncoder.writeTimestamp(this.querySet,e)}setQueryType(){var e;this.queryType="none",(((e=this.env.webgpu.profiling)==null?void 0:e.mode)==="default"||(typeof this.env.trace>"u"?this.env.wasm.trace:this.env.trace))&&(this.device.features.has("chromium-experimental-timestamp-query-inside-passes")?this.queryType="inside-passes":this.device.features.has("timestamp-query")&&(this.queryType="at-passes"),this.queryType!=="none"&&typeof this.querySet>"u"&&(this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxDispatchNumber*2}),this.queryResolveBuffer=this.device.createBuffer({size:this.maxDispatchNumber*2*8,usage:GPUBufferUsage.COPY_SRC|GPUBufferUsage.QUERY_RESOLVE})))}captureBegin(){vt("info","captureBegin"),this.capturedCommandList.get(this.currentSessionId)||this.capturedCommandList.set(this.currentSessionId,[]),this.capturedPendingKernels.get(this.currentSessionId)||this.capturedPendingKernels.set(this.currentSessionId,[]),this.flush(),this.sessionStatus="capturing"}captureEnd(){vt("info","captureEnd"),this.flush(),this.sessionStatus="default"}replay(){vt("info","replay"),this.sessionStatus="replaying";let e=this.capturedCommandList.get(this.currentSessionId),r=this.capturedPendingKernels.get(this.currentSessionId),t=e.length;this.pendingKernels=[];for(let s=0;s=this.maxDispatchNumber||this.queryType==="at-passes")&&this.endComputePass(),this.pendingDispatchNumber>=this.maxDispatchNumber&&this.flush()}this.flush(),this.sessionStatus="default"}onCreateSession(){this.gpuDataManager.onCreateSession()}onReleaseSession(e){this.unregisterBuffers(e),this.capturedCommandList.has(e)&&this.capturedCommandList.delete(e),this.capturedPendingKernels.has(e)&&this.capturedPendingKernels.delete(e),this.gpuDataManager.onReleaseSession(e)}onRunStart(e){this.currentSessionId=e,this.setQueryType()}}}),vg={};Rn(vg,{init:()=>Tg});var wi,xg,Tg,mx=Be(()=>{ut(),Es(),mt(),vv(),wi=class z0{constructor(r,t,s,o){this.module=r,this.dataType=t,this.data=s,this.dims=o}getFloat32Array(){if(this.dataType!==1)throw new Error("Invalid data type");let r=Me.size(this.dims);return r===0?new Float32Array:new Float32Array(this.module.HEAP8.buffer,this.data,r)}getBigInt64Array(){if(this.dataType!==7)throw new Error("Invalid data type");let r=Me.size(this.dims);return r===0?new BigInt64Array:new BigInt64Array(this.module.HEAP8.buffer,this.data,r)}getInt32Array(){if(this.dataType!==6)throw new Error("Invalid data type");let r=Me.size(this.dims);return r===0?new Int32Array:new Int32Array(this.module.HEAP8.buffer,this.data,r)}getUint16Array(){if(this.dataType!==10&&this.dataType!==4)throw new Error("Invalid data type");let r=Me.size(this.dims);return r===0?new Uint16Array:new Uint16Array(this.module.HEAP8.buffer,this.data,r)}reshape(r){if(Me.size(r)!==Me.size(this.dims))throw new Error("Invalid new shape");return new z0(this.module,this.dataType,this.data,r)}},xg=class{constructor(e,r,t){this.module=e,this.backend=r,this.customDataOffset=0,this.customDataSize=0,this.adapterInfo=r.adapterInfo;let s=e.PTR_SIZE,o=t/e.PTR_SIZE,n=s===4?"i32":"i64";this.opKernelContext=Number(e.getValue(s*o++,n));let i=Number(e.getValue(s*o++,n));this.outputCount=Number(e.getValue(s*o++,n)),this.customDataOffset=Number(e.getValue(s*o++,"*")),this.customDataSize=Number(e.getValue(s*o++,n));let a=[];for(let l=0;ltypeof a=="number"?this.inputs[a]:a))??this.inputs,s=(r==null?void 0:r.outputs)??[],o=(a,l,u)=>new wi(this.module,l,this.output(a,u),u),n=(a,l)=>{let u=tn(a,l);if(!u)throw new Error(`Unsupported data type: ${a}`);let p=u>0?this.backend.gpuDataManager.create(u).id:0;return new wi(this.module,a,p,l)};return this.backend.run(e,t,s,o,n,this.outputCount)}output(e,r){let t=this.module.stackSave();try{let s=this.module.PTR_SIZE,o=s===4?"i32":"i64",n=this.module.stackAlloc((1+r.length)*s);this.module.setValue(n,r.length,o);for(let i=0;i{let o=r.jsepInit;if(!o)throw new Error("Failed to initialize JSEP. The WebAssembly module is not built with JSEP support.");if(e==="webgpu"){let n=(hx(),ao(gg)).WebGpuBackend,i=new n;await i.initialize(t,s),o("webgpu",[i,a=>i.alloc(Number(a)),a=>i.free(a),(a,l,u,p=!1)=>{if(p)vt("verbose",()=>`[WebGPU] jsepCopyGpuToGpu: src=${Number(a)}, dst=${Number(l)}, size=${Number(u)}`),i.memcpy(Number(a),Number(l));else{vt("verbose",()=>`[WebGPU] jsepCopyCpuToGpu: dataOffset=${Number(a)}, gpuDataId=${Number(l)}, size=${Number(u)}`);let d=r.HEAPU8.subarray(Number(a>>>0),Number(a>>>0)+Number(u));i.upload(Number(l),d)}},async(a,l,u)=>{vt("verbose",()=>`[WebGPU] jsepCopyGpuToCpu: gpuDataId=${a}, dataOffset=${l}, size=${u}`),await i.download(Number(a),()=>r.HEAPU8.subarray(Number(l)>>>0,Number(l+u)>>>0))},(a,l,u)=>i.createKernel(a,Number(l),u,r.UTF8ToString(r._JsepGetNodeName(Number(l)))),a=>i.releaseKernel(a),(a,l,u,p)=>{vt("verbose",()=>`[WebGPU] jsepRun: sessionHandle=${u}, kernel=${a}, contextDataOffset=${l}`);let d=new xg(r,i,Number(l));return i.computeKernel(Number(a),d,p)},()=>i.captureBegin(),()=>i.captureEnd(),()=>i.replay()])}else{let n=new $c(t);o("webnn",[n,()=>n.reserveTensorId(),i=>n.releaseTensorId(i),async(i,a,l,u,p)=>n.ensureTensor(i,a,l,u,p),(i,a)=>{n.uploadTensor(i,a)},async(i,a)=>n.downloadTensor(i,a)])}}}),Eg,Yl,Zl,Bs,Pg,eu,Mi,tu,ru,su,nu,ou,iu,Cg=Be(()=>{Mv(),bv(),ut(),en(),ja(),hc(),Eg=(e,r)=>{zt()._OrtInit(e,r)!==0&&At("Can't initialize onnxruntime.")},Yl=async e=>{Eg(e.wasm.numThreads,ni(e.logLevel))},Zl=async(e,r)=>{var t,s;(s=(t=zt()).asyncInit)==null||s.call(t);{let o=(mx(),ao(vg)).init;if(r==="webgpu"){if(typeof navigator>"u"||!navigator.gpu)throw new Error("WebGPU is not supported in current environment");let n=e.webgpu.adapter;if(n){if(typeof n.limits!="object"||typeof n.features!="object"||typeof n.requestDevice!="function")throw new Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let i=e.webgpu.powerPreference;if(i!==void 0&&i!=="low-power"&&i!=="high-performance")throw new Error(`Invalid powerPreference setting: "${i}"`);let a=e.webgpu.forceFallbackAdapter;if(a!==void 0&&typeof a!="boolean")throw new Error(`Invalid forceFallbackAdapter setting: "${a}"`);if(n=await navigator.gpu.requestAdapter({powerPreference:i,forceFallbackAdapter:a}),!n)throw new Error('Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.')}await o("webgpu",zt(),e,n)}if(r==="webnn"){if(typeof navigator>"u"||!navigator.ml)throw new Error("WebNN is not supported in current environment");await o("webnn",zt(),e)}}},Bs=new Map,Pg=e=>{let r=zt(),t=r.stackSave();try{let s=r.PTR_SIZE,o=r.stackAlloc(2*s);r._OrtGetInputOutputCount(e,o,o+s)!==0&&At("Can't get session input/output count.");let n=s===4?"i32":"i64";return[Number(r.getValue(o,n)),Number(r.getValue(o+s,n))]}finally{r.stackRestore(t)}},eu=(e,r)=>{let t=zt(),s=t.stackSave(),o=0;try{let n=t.PTR_SIZE,i=t.stackAlloc(2*n);t._OrtGetInputOutputMetadata(e,r,i,i+n)!==0&&At("Can't get session input/output metadata.");let a=Number(t.getValue(i,"*"));o=Number(t.getValue(i+n,"*"));let l=t.HEAP32[o/4];if(l===0)return[a,0];let u=t.HEAPU32[o/4+1],p=[];for(let d=0;d{let r=zt(),t=r._malloc(e.byteLength);if(t===0)throw new Error(`Can't create a session. failed to allocate a buffer of size ${e.byteLength}.`);return r.HEAPU8.set(e,t),[t,e.byteLength]},tu=async(e,r)=>{var d,c,f,_;let t,s,o=zt();Array.isArray(e)?[t,s]=e:e.buffer===o.HEAPU8.buffer?[t,s]=[e.byteOffset,e.byteLength]:[t,s]=Mi(e);let n=0,i=0,a=0,l=[],u=[],p=[];try{if([i,l]=await pc(r),(r==null?void 0:r.externalData)&&o.mountExternalData){let C=[];for(let A of r.externalData){let B=typeof A=="string"?A:A.path;C.push(Ga(typeof A=="string"?A:A.data).then(K=>{o.mountExternalData(B,K)}))}await Promise.all(C)}for(let C of(r==null?void 0:r.executionProviders)??[])if((typeof C=="string"?C:C.name)==="webnn"){if(o.shouldTransferToMLTensor=!1,typeof C!="string"){let A=C,B=A==null?void 0:A.context,K=A==null?void 0:A.gpuDevice,G=A==null?void 0:A.deviceType,j=A==null?void 0:A.powerPreference;B?o.currentContext=B:K?o.currentContext=await o.webnnCreateMLContext(K):o.currentContext=await o.webnnCreateMLContext({deviceType:G,powerPreference:j})}else o.currentContext=await o.webnnCreateMLContext();break}n=await o._OrtCreateSession(t,s,i),(d=o.webgpuOnCreateSession)==null||d.call(o,n),n===0&&At("Can't create a session."),(c=o.jsepOnCreateSession)==null||c.call(o),o.currentContext&&(o.webnnRegisterMLContext(n,o.currentContext),o.currentContext=void 0,o.shouldTransferToMLTensor=!0);let[T,k]=Pg(n),w=!!(r!=null&&r.enableGraphCapture),g=[],S=[],E=[],y=[],M=[];for(let C=0;CC==="gpu-buffer"||C==="ml-tensor")&&(a=o._OrtCreateBinding(n),a===0&&At("Can't create IO binding."),v={handle:a,outputPreferredLocations:M,outputPreferredLocationsEncoded:M.map(C=>Wa(C))}),Bs.set(n,[n,u,p,v,w,!1]),[n,g,S,E,y]}catch(T){throw u.forEach(k=>o._OrtFree(k)),p.forEach(k=>o._OrtFree(k)),a!==0&&o._OrtReleaseBinding(a)!==0&&At("Can't release IO binding."),n!==0&&o._OrtReleaseSession(n)!==0&&At("Can't release session."),T}finally{o._free(t),i!==0&&o._OrtReleaseSessionOptions(i)!==0&&At("Can't release session options."),l.forEach(T=>o._free(T)),(_=o.unmountExternalData)==null||_.call(o)}},ru=e=>{var l,u,p;let r=zt(),t=Bs.get(e);if(!t)throw new Error(`cannot release session. invalid session id: ${e}`);let[s,o,n,i,a]=t;i&&(a&&r._OrtClearBoundOutputs(i.handle)!==0&&At("Can't clear bound outputs."),r._OrtReleaseBinding(i.handle)!==0&&At("Can't release IO binding.")),(l=r.jsepOnReleaseSession)==null||l.call(r,e),(u=r.webnnOnReleaseSession)==null||u.call(r,e),(p=r.webgpuOnReleaseSession)==null||p.call(r,e),o.forEach(d=>r._OrtFree(d)),n.forEach(d=>r._OrtFree(d)),r._OrtReleaseSession(s)!==0&&At("Can't release session."),Bs.delete(e)},su=async(e,r,t,s,o,n,i=!1)=>{if(!e){r.push(0);return}let a=zt(),l=a.PTR_SIZE,u=e[0],p=e[1],d=e[3],c=d,f,_;if(u==="string"&&(d==="gpu-buffer"||d==="ml-tensor"))throw new Error("String tensor is not supported on GPU.");if(i&&d!=="gpu-buffer")throw new Error(`External buffer must be provided for input/output index ${n} when enableGraphCapture is true.`);if(d==="gpu-buffer"){let w=e[2].gpuBuffer;_=tn(jn(u),p);{let g=a.jsepRegisterBuffer;if(!g)throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');f=g(s,n,w,_)}}else if(d==="ml-tensor"){let w=e[2].mlTensor;_=tn(jn(u),p);let g=a.webnnRegisterMLTensor;if(!g)throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');f=g(s,w,jn(u),p)}else{let w=e[2];if(Array.isArray(w)){_=l*w.length,f=a._malloc(_),t.push(f);for(let g=0;ga.setValue(k+S*l,g,l===4?"i32":"i64"));let w=a._OrtCreateTensor(jn(u),f,_,k,p.length,Wa(c));w===0&&At(`Can't create tensor for input/output. session=${s}, index=${n}.`),r.push(w)}finally{a.stackRestore(T)}},nu=async(e,r,t,s,o,n)=>{var K,G,j,ee;let i=zt(),a=i.PTR_SIZE,l=Bs.get(e);if(!l)throw new Error(`cannot run inference. invalid session id: ${e}`);let u=l[0],p=l[1],d=l[2],c=l[3],f=l[4],_=l[5],T=r.length,k=s.length,w=0,g=[],S=[],E=[],y=[],M=i.stackSave(),v=i.stackAlloc(T*a),C=i.stackAlloc(T*a),A=i.stackAlloc(k*a),B=i.stackAlloc(k*a);try{[w,g]=ac(n);for(let X=0;Xq*R,1);F=Ts(_e);let we=c==null?void 0:c.outputPreferredLocations[s[X]];if(F==="string"){if(we==="gpu-buffer"||we==="ml-tensor")throw new Error("String tensor is not supported on GPU.");let q=[];for(let R=0;R0){let q=i.jsepGetBuffer;if(!q)throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');let R=q(W),pe=tn(_e,Ue);if(pe===void 0||!Va(F))throw new Error(`Unsupported data type: ${F}`);V=!0,Z.push([F,$e,{gpuBuffer:R,download:i.jsepCreateDownloader(R,pe,F),dispose:()=>{i._OrtReleaseTensor(oe)!==0&&At("Can't release tensor.")}},"gpu-buffer"])}else if(we==="ml-tensor"&&Ue>0){let q=i.webnnEnsureTensor,R=i.webnnIsInt64Supported;if(!q||!R)throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');if(tn(_e,Ue)===void 0||!Ua(F))throw new Error(`Unsupported data type: ${F}`);if(F==="int64"&&!R(e))throw new Error('preferredLocation "ml-tensor" for int64 output is not supported by current WebNN Context.');let pe=await q(e,W,_e,$e,!1);V=!0,Z.push([F,$e,{mlTensor:pe,download:i.webnnCreateMLTensorDownloader(W,F),dispose:()=>{i.webnnReleaseTensorId(W),i._OrtReleaseTensor(oe)}},"ml-tensor"])}else{let q=Na(F),R=new q(Ue);new Uint8Array(R.buffer,R.byteOffset,R.byteLength).set(i.HEAPU8.subarray(W,W+R.byteLength)),Z.push([F,$e,R,"cpu"])}}finally{i.stackRestore(me),F==="string"&&W&&i._free(W),V||i._OrtReleaseTensor(oe),(ee=i.webnnOnRunEnd)==null||ee.call(i,u)}}return c&&!f&&(i._OrtClearBoundOutputs(c.handle)!==0&&At("Can't clear bound outputs."),Bs.set(e,[u,p,d,c,f,!1])),Z}finally{i.stackRestore(M),S.forEach(H=>i._OrtReleaseTensor(H)),E.forEach(H=>i._OrtReleaseTensor(H)),y.forEach(H=>i._free(H)),w!==0&&i._OrtReleaseRunOptions(w),g.forEach(H=>i._free(H))}},ou=e=>{let r=zt(),t=Bs.get(e);if(!t)throw new Error("invalid session id");let s=t[0],o=r._OrtEndProfiling(s);o===0&&At("Can't get an profile file name."),r._OrtFree(o)},iu=e=>{let r=[];for(let t of e){let s=t[2];!Array.isArray(s)&&"buffer"in s&&r.push(s.buffer)}return r}}),Rs,kr,Wn,xo,To,bi,au,yi,un,dn,Sg,$g,kg,Ig,Ag,Fg,Og,Dg,Lg=Be(()=>{ts(),Cg(),en(),La(),Rs=()=>!!Bt.wasm.proxy&&typeof document<"u",Wn=!1,xo=!1,To=!1,yi=new Map,un=(e,r)=>{let t=yi.get(e);t?t.push(r):yi.set(e,[r])},dn=()=>{if(Wn||!xo||To||!kr)throw new Error("worker not ready")},Sg=e=>{switch(e.data.type){case"init-wasm":Wn=!1,e.data.err?(To=!0,au[1](e.data.err)):(xo=!0,au[0]()),bi&&(URL.revokeObjectURL(bi),bi=void 0);break;case"init-ep":case"copy-from":case"create":case"release":case"run":case"end-profiling":{let r=yi.get(e.data.type);e.data.err?r.shift()[1](e.data.err):r.shift()[0](e.data.out);break}}},$g=async()=>{if(!xo){if(Wn)throw new Error("multiple calls to 'initWasm()' detected.");if(To)throw new Error("previous call to 'initWasm()' failed.");if(Wn=!0,Rs())return new Promise((e,r)=>{kr==null||kr.terminate(),rc().then(([t,s])=>{try{kr=s,kr.onerror=n=>r(n),kr.onmessage=Sg,au=[e,r];let o={type:"init-wasm",in:Bt};!o.in.wasm.wasmPaths&&(t||Aa)&&(o.in.wasm.wasmPaths={wasm:new URL("/assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm",self.location.href).href}),kr.postMessage(o),bi=t}catch(o){r(o)}},r)});try{await Ra(Bt.wasm),await Yl(Bt),xo=!0}catch(e){throw To=!0,e}finally{Wn=!1}}},kg=async e=>{if(Rs())return dn(),new Promise((r,t)=>{un("init-ep",[r,t]);let s={type:"init-ep",in:{epName:e,env:Bt}};kr.postMessage(s)});await Zl(Bt,e)},Ig=async e=>Rs()?(dn(),new Promise((r,t)=>{un("copy-from",[r,t]);let s={type:"copy-from",in:{buffer:e}};kr.postMessage(s,[e.buffer])})):Mi(e),Ag=async(e,r)=>{if(Rs()){if(r!=null&&r.preferredOutputLocation)throw new Error('session option "preferredOutputLocation" is not supported for proxy.');return dn(),new Promise((t,s)=>{un("create",[t,s]);let o={type:"create",in:{model:e,options:{...r}}},n=[];e instanceof Uint8Array&&n.push(e.buffer),kr.postMessage(o,n)})}else return tu(e,r)},Fg=async e=>{if(Rs())return dn(),new Promise((r,t)=>{un("release",[r,t]);let s={type:"release",in:e};kr.postMessage(s)});ru(e)},Og=async(e,r,t,s,o,n)=>{if(Rs()){if(t.some(i=>i[3]!=="cpu"))throw new Error("input tensor on GPU is not supported for proxy.");if(o.some(i=>i))throw new Error("pre-allocated output tensor is not supported for proxy.");return dn(),new Promise((i,a)=>{un("run",[i,a]);let l=t,u={type:"run",in:{sessionId:e,inputIndices:r,inputs:l,outputIndices:s,options:n}};kr.postMessage(u,iu(l))})}else return nu(e,r,t,s,o,n)},Dg=async e=>{if(Rs())return dn(),new Promise((r,t)=>{un("end-profiling",[r,t]);let s={type:"end-profiling",in:e};kr.postMessage(s)});ou(e)}}),lu,zg,Bg,_x=Be(()=>{ts(),Lg(),ut(),Pa(),hc(),lu=(e,r)=>{switch(e.location){case"cpu":return[e.type,e.dims,e.data,"cpu"];case"gpu-buffer":return[e.type,e.dims,{gpuBuffer:e.gpuBuffer},"gpu-buffer"];case"ml-tensor":return[e.type,e.dims,{mlTensor:e.mlTensor},"ml-tensor"];default:throw new Error(`invalid data location: ${e.location} for ${r()}`)}},zg=e=>{switch(e[3]){case"cpu":return new Zr(e[0],e[2],e[1]);case"gpu-buffer":{let r=e[0];if(!Va(r))throw new Error(`not supported data type: ${r} for deserializing GPU tensor`);let{gpuBuffer:t,download:s,dispose:o}=e[2];return Zr.fromGpuBuffer(t,{dataType:r,dims:e[1],download:s,dispose:o})}case"ml-tensor":{let r=e[0];if(!Ua(r))throw new Error(`not supported data type: ${r} for deserializing MLTensor tensor`);let{mlTensor:t,download:s,dispose:o}=e[2];return Zr.fromMLTensor(t,{dataType:r,dims:e[1],download:s,dispose:o})}default:throw new Error(`invalid data location: ${e[3]}`)}},Bg=class{async fetchModelAndCopyToWasmMemory(e){return Ig(await Ga(e))}async loadModel(e,r){es();let t;typeof e=="string"?t=await this.fetchModelAndCopyToWasmMemory(e):t=e,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await Ag(t,r),Gr()}async dispose(){return Fg(this.sessionId)}async run(e,r,t){es();let s=[],o=[];Object.entries(e).forEach(d=>{let c=d[0],f=d[1],_=this.inputNames.indexOf(c);if(_===-1)throw new Error(`invalid input '${c}'`);s.push(f),o.push(_)});let n=[],i=[];Object.entries(r).forEach(d=>{let c=d[0],f=d[1],_=this.outputNames.indexOf(c);if(_===-1)throw new Error(`invalid output '${c}'`);n.push(f),i.push(_)});let a=s.map((d,c)=>lu(d,()=>`input "${this.inputNames[o[c]]}"`)),l=n.map((d,c)=>d?lu(d,()=>`output "${this.outputNames[i[c]]}"`):null),u=await Og(this.sessionId,o,a,i,l,t),p={};for(let d=0;ddu,initializeFlags:()=>uu,wasmBackend:()=>jg});var uu,du,jg,fx=Be(()=>{ts(),Lg(),_x(),uu=()=>{(typeof Bt.wasm.initTimeout!="number"||Bt.wasm.initTimeout<0)&&(Bt.wasm.initTimeout=0);let e=Bt.wasm.simd;if(typeof e!="boolean"&&e!==void 0&&e!=="fixed"&&e!=="relaxed"&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${e}". Reset it to \`false\` and ignore SIMD feature checking.`),Bt.wasm.simd=!1),typeof Bt.wasm.proxy!="boolean"&&(Bt.wasm.proxy=!1),typeof Bt.wasm.trace!="boolean"&&(Bt.wasm.trace=!1),typeof Bt.wasm.numThreads!="number"||!Number.isInteger(Bt.wasm.numThreads)||Bt.wasm.numThreads<=0)if(typeof self<"u"&&!self.crossOriginIsolated)Bt.wasm.numThreads=1;else{let r=typeof navigator>"u"?rv("node:os").cpus().length:navigator.hardwareConcurrency;Bt.wasm.numThreads=Math.min(4,Math.ceil((r||1)/2))}},du=class{async init(e){uu(),await $g(),await kg(e)}async createInferenceSessionHandler(e,r){let t=new Bg;return await t.loadModel(e,r),t}},jg=new du});ts(),ts(),ts();var gx="1.22.0-dev.20250409-89f8206ba4",wx=Gd;{let e=(fx(),ao(Rg)).wasmBackend;Ys("webgpu",e,5),Ys("webnn",e,5),Ys("cpu",e,10),Ys("wasm",e,10)}Object.defineProperty(Bt.versions,"web",{value:gx,enumerable:!0});/** +* @license +* Copyright 2021 Google LLC. All Rights Reserved. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* ============================================================================= +*//** + * @license + * Copyright 2020 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + *//** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============================================================================= + */var Mx=Object.freeze({__proto__:null,get InferenceSession(){return Ea},get TRACE(){return co},get TRACE_FUNC_BEGIN(){return es},get TRACE_FUNC_END(){return Gr},get Tensor(){return Zr},default:wx,get env(){return Bt},get registerBackend(){return Ys}}),Cs={},bx={"onnxruntime-common":e=>{e.exports=Y0},"onnxruntime-web":e=>{e.exports=Mx},"?2ce3":()=>{},"?7a2c":()=>{},"?a42a":()=>{},"?2b25":()=>{},"?569f":()=>{},"?3f59":()=>{},"?154a":()=>{},"./node_modules/@huggingface/jinja/dist/index.js":(e,r,t)=>{t.r(r),t.d(r,{Environment:()=>Se,Interpreter:()=>Ae,Template:()=>Ve,parse:()=>V,tokenize:()=>d});var s=Object.freeze({Text:"Text",NumericLiteral:"NumericLiteral",BooleanLiteral:"BooleanLiteral",NullLiteral:"NullLiteral",StringLiteral:"StringLiteral",Identifier:"Identifier",Equals:"Equals",OpenParen:"OpenParen",CloseParen:"CloseParen",OpenStatement:"OpenStatement",CloseStatement:"CloseStatement",OpenExpression:"OpenExpression",CloseExpression:"CloseExpression",OpenSquareBracket:"OpenSquareBracket",CloseSquareBracket:"CloseSquareBracket",OpenCurlyBracket:"OpenCurlyBracket",CloseCurlyBracket:"CloseCurlyBracket",Comma:"Comma",Dot:"Dot",Colon:"Colon",Pipe:"Pipe",CallOperator:"CallOperator",AdditiveBinaryOperator:"AdditiveBinaryOperator",MultiplicativeBinaryOperator:"MultiplicativeBinaryOperator",ComparisonBinaryOperator:"ComparisonBinaryOperator",UnaryOperator:"UnaryOperator",Set:"Set",If:"If",For:"For",In:"In",Is:"Is",NotIn:"NotIn",Else:"Else",EndSet:"EndSet",EndIf:"EndIf",ElseIf:"ElseIf",EndFor:"EndFor",And:"And",Or:"Or",Not:"UnaryOperator",Macro:"Macro",EndMacro:"EndMacro"}),o=Object.freeze({set:s.Set,for:s.For,in:s.In,is:s.Is,if:s.If,else:s.Else,endset:s.EndSet,endif:s.EndIf,elif:s.ElseIf,endfor:s.EndFor,and:s.And,or:s.Or,not:s.Not,"not in":s.NotIn,macro:s.Macro,endmacro:s.EndMacro,true:s.BooleanLiteral,false:s.BooleanLiteral,none:s.NullLiteral,True:s.BooleanLiteral,False:s.BooleanLiteral,None:s.NullLiteral}),n=class{constructor(O,Y){this.value=O,this.type=Y}};function i(O){return/\w/.test(O)}function a(O){return/[0-9]/.test(O)}var l=[["{%",s.OpenStatement],["%}",s.CloseStatement],["{{",s.OpenExpression],["}}",s.CloseExpression],["(",s.OpenParen],[")",s.CloseParen],["{",s.OpenCurlyBracket],["}",s.CloseCurlyBracket],["[",s.OpenSquareBracket],["]",s.CloseSquareBracket],[",",s.Comma],[".",s.Dot],[":",s.Colon],["|",s.Pipe],["<=",s.ComparisonBinaryOperator],[">=",s.ComparisonBinaryOperator],["==",s.ComparisonBinaryOperator],["!=",s.ComparisonBinaryOperator],["<",s.ComparisonBinaryOperator],[">",s.ComparisonBinaryOperator],["+",s.AdditiveBinaryOperator],["-",s.AdditiveBinaryOperator],["*",s.MultiplicativeBinaryOperator],["/",s.MultiplicativeBinaryOperator],["%",s.MultiplicativeBinaryOperator],["=",s.Equals]],u=new Map([["n",` +`],["t"," "],["r","\r"],["b","\b"],["f","\f"],["v","\v"],["'","'"],['"','"'],["\\","\\"]]);function p(O,Y={}){return O.endsWith(` +`)&&(O=O.slice(0,-1)),O=O.replace(/{#.*?#}/gs,"{##}"),Y.lstrip_blocks&&(O=O.replace(/^[ \t]*({[#%])/gm,"$1")),Y.trim_blocks&&(O=O.replace(/([#%]})\n/g,"$1")),O.replace(/{##}/g,"").replace(/-%}\s*/g,"%}").replace(/\s*{%-/g,"{%").replace(/-}}\s*/g,"}}").replace(/\s*{{-/g,"{{")}function d(O,Y={}){var Ee,ke,Ie;const z=[],J=p(O,Y);let le=0;const ye=Re=>{let Xe="";for(;Re(J[le]);){if(J[le]==="\\"){if(++le,le>=J.length)throw new SyntaxError("Unexpected end of input");const Ge=J[le++],lt=u.get(Ge);if(lt===void 0)throw new SyntaxError(`Unexpected escaped character: ${Ge}`);Xe+=lt;continue}if(Xe+=J[le++],le>=J.length)throw new SyntaxError("Unexpected end of input")}return Xe};e:for(;le0){z.push(new n(Ge,s.Text));continue}}ye(Ge=>/\s/.test(Ge));const Xe=J[le];if(Xe==="-"||Xe==="+"){const Ge=(ke=z.at(-1))==null?void 0:ke.type;if(Ge===s.Text||Ge===void 0)throw new SyntaxError(`Unexpected character: ${Xe}`);switch(Ge){case s.Identifier:case s.NumericLiteral:case s.BooleanLiteral:case s.NullLiteral:case s.StringLiteral:case s.CloseParen:case s.CloseSquareBracket:break;default:{++le;const lt=ye(a);z.push(new n(`${Xe}${lt}`,lt.length>0?s.NumericLiteral:s.UnaryOperator));continue}}}for(const[Ge,lt]of l)if(J.slice(le,le+Ge.length)===Ge){z.push(new n(Ge,lt)),le+=Ge.length;continue e}if(Xe==="'"||Xe==='"'){++le;const Ge=ye(lt=>lt!==Xe);z.push(new n(Ge,s.StringLiteral)),++le;continue}if(a(Xe)){const Ge=ye(a);z.push(new n(Ge,s.NumericLiteral));continue}if(i(Xe)){const Ge=ye(i),lt=Object.hasOwn(o,Ge)?o[Ge]:s.Identifier;lt===s.In&&((Ie=z.at(-1))==null?void 0:Ie.type)===s.Not?(z.pop(),z.push(new n("not in",s.NotIn))):z.push(new n(Ge,lt));continue}throw new SyntaxError(`Unexpected character: ${Xe}`)}return z}var c=class{constructor(){te(this,"type","Statement")}},f=class extends c{constructor(Y){super();te(this,"type","Program");this.body=Y}},_=class extends c{constructor(Y,z,J){super();te(this,"type","If");this.test=Y,this.body=z,this.alternate=J}},T=class extends c{constructor(Y,z,J,le){super();te(this,"type","For");this.loopvar=Y,this.iterable=z,this.body=J,this.defaultBlock=le}},k=class extends c{constructor(Y,z,J){super();te(this,"type","Set");this.assignee=Y,this.value=z,this.body=J}},w=class extends c{constructor(Y,z,J){super();te(this,"type","Macro");this.name=Y,this.args=z,this.body=J}},g=class extends c{constructor(){super(...arguments);te(this,"type","Expression")}},S=class extends g{constructor(Y,z,J){super();te(this,"type","MemberExpression");this.object=Y,this.property=z,this.computed=J}},E=class extends g{constructor(Y,z){super();te(this,"type","CallExpression");this.callee=Y,this.args=z}},y=class extends g{constructor(Y){super();te(this,"type","Identifier");this.value=Y}},M=class extends g{constructor(Y){super();te(this,"type","Literal");this.value=Y}},v=class extends M{constructor(){super(...arguments);te(this,"type","NumericLiteral")}},C=class extends M{constructor(){super(...arguments);te(this,"type","StringLiteral")}},A=class extends M{constructor(){super(...arguments);te(this,"type","BooleanLiteral")}},B=class extends M{constructor(){super(...arguments);te(this,"type","NullLiteral")}},K=class extends M{constructor(){super(...arguments);te(this,"type","ArrayLiteral")}},G=class extends M{constructor(){super(...arguments);te(this,"type","TupleLiteral")}},j=class extends M{constructor(){super(...arguments);te(this,"type","ObjectLiteral")}},ee=class extends g{constructor(Y,z,J){super();te(this,"type","BinaryExpression");this.operator=Y,this.left=z,this.right=J}},H=class extends g{constructor(Y,z){super();te(this,"type","FilterExpression");this.operand=Y,this.filter=z}},Z=class extends g{constructor(Y,z){super();te(this,"type","SelectExpression");this.iterable=Y,this.test=z}},X=class extends g{constructor(Y,z,J){super();te(this,"type","TestExpression");this.operand=Y,this.negate=z,this.test=J}},oe=class extends g{constructor(Y,z){super();te(this,"type","UnaryExpression");this.operator=Y,this.argument=z}},me=class extends g{constructor(Y=void 0,z=void 0,J=void 0){super();te(this,"type","SliceExpression");this.start=Y,this.stop=z,this.step=J}},ae=class extends g{constructor(Y,z){super();te(this,"type","KeywordArgumentExpression");this.key=Y,this.value=z}};function V(O){const Y=new f([]);let z=0;function J(De,Qe){const tt=O[z++];if(!tt||tt.type!==De)throw new Error(`Parser Error: ${Qe}. ${tt.type} !== ${De}.`);return tt}function le(){switch(O[z].type){case s.Text:return ke();case s.OpenStatement:return Ie();case s.OpenExpression:return Re();default:throw new SyntaxError(`Unexpected token type: ${O[z].type}`)}}function ye(...De){return z+De.length<=O.length&&De.some((Qe,tt)=>Qe!==O[z+tt].type)}function Ee(...De){return z+De.length<=O.length&&De.every((Qe,tt)=>Qe===O[z+tt].type)}function ke(){return new C(J(s.Text,"Expected text token").value)}function Ie(){J(s.OpenStatement,"Expected opening statement token");let De;switch(O[z].type){case s.Set:++z,De=Xe(),J(s.CloseStatement,"Expected closing statement token");break;case s.If:++z,De=Ge(),J(s.OpenStatement,"Expected {% token"),J(s.EndIf,"Expected endif token"),J(s.CloseStatement,"Expected %} token");break;case s.Macro:++z,De=lt(),J(s.OpenStatement,"Expected {% token"),J(s.EndMacro,"Expected endmacro token"),J(s.CloseStatement,"Expected %} token");break;case s.For:++z,De=Gt(),J(s.OpenStatement,"Expected {% token"),J(s.EndFor,"Expected endfor token"),J(s.CloseStatement,"Expected %} token");break;default:throw new SyntaxError(`Unknown statement type: ${O[z].type}`)}return De}function Re(){J(s.OpenExpression,"Expected opening expression token");const De=Ot();return J(s.CloseExpression,"Expected closing expression token"),De}function Xe(){var Qe,tt;const De=Ot();if(Ee(s.Equals)){++z;const Rt=Ot();return new k(De,Rt,[])}else{const Rt=[];for(J(s.CloseStatement,"Expected %} token");!(((Qe=O[z])==null?void 0:Qe.type)===s.OpenStatement&&((tt=O[z+1])==null?void 0:tt.type)===s.EndSet);){const zr=le();Rt.push(zr)}return J(s.OpenStatement,"Expected {% token"),J(s.EndSet,"Expected endset token"),new k(De,null,Rt)}}function Ge(){var Rt,zr,Sr,ps,hs,Kr,ms,_s;const De=Ot();J(s.CloseStatement,"Expected closing statement token");const Qe=[],tt=[];for(;!(((Rt=O[z])==null?void 0:Rt.type)===s.OpenStatement&&(((zr=O[z+1])==null?void 0:zr.type)===s.ElseIf||((Sr=O[z+1])==null?void 0:Sr.type)===s.Else||((ps=O[z+1])==null?void 0:ps.type)===s.EndIf));)Qe.push(le());if(((hs=O[z])==null?void 0:hs.type)===s.OpenStatement&&((Kr=O[z+1])==null?void 0:Kr.type)!==s.EndIf)if(++z,Ee(s.ElseIf))J(s.ElseIf,"Expected elseif token"),tt.push(Ge());else for(J(s.Else,"Expected else token"),J(s.CloseStatement,"Expected closing statement token");!(((ms=O[z])==null?void 0:ms.type)===s.OpenStatement&&((_s=O[z+1])==null?void 0:_s.type)===s.EndIf);)tt.push(le());return new _(De,Qe,tt)}function lt(){const De=Qt();if(De.type!=="Identifier")throw new SyntaxError("Expected identifier following macro statement");const Qe=us();J(s.CloseStatement,"Expected closing statement token");const tt=[];for(;ye(s.OpenStatement,s.EndMacro);)tt.push(le());return new w(De,Qe,tt)}function wt(De=!1){const Qe=De?Qt:Ot,tt=[Qe()],Rt=Ee(s.Comma);for(;Rt&&(++z,tt.push(Qe()),!!Ee(s.Comma)););return Rt?new G(tt):tt[0]}function Gt(){const De=wt(!0);if(!(De instanceof y||De instanceof G))throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${De.type} instead`);J(s.In,"Expected `in` keyword following loop variable");const Qe=Ot();J(s.CloseStatement,"Expected closing statement token");const tt=[];for(;ye(s.OpenStatement,s.EndFor)&&ye(s.OpenStatement,s.Else);)tt.push(le());const Rt=[];if(Ee(s.OpenStatement,s.Else))for(++z,++z,J(s.CloseStatement,"Expected closing statement token");ye(s.OpenStatement,s.EndFor);)Rt.push(le());return new T(De,Qe,tt,Rt)}function Ot(){return ur()}function ur(){const De=ls();if(Ee(s.If)){++z;const Qe=ls();if(Ee(s.Else)){++z;const tt=ls();return new _(Qe,[De],[tt])}else return new Z(De,Qe)}return De}function ls(){let De=Ms();for(;Ee(s.Or);){const Qe=O[z];++z;const tt=Ms();De=new ee(Qe,De,tt)}return De}function Ms(){let De=Ir();for(;Ee(s.And);){const Qe=O[z];++z;const tt=Ir();De=new ee(Qe,De,tt)}return De}function Ir(){let De;for(;Ee(s.Not);){const Qe=O[z];++z;const tt=Ir();De=new oe(Qe,tt)}return De??js()}function js(){let De=Ss();for(;Ee(s.ComparisonBinaryOperator)||Ee(s.In)||Ee(s.NotIn);){const Qe=O[z];++z;const tt=Ss();De=new ee(Qe,De,tt)}return De}function Ss(){let De=ds();for(;Ee(s.AdditiveBinaryOperator);){const Qe=O[z];++z;const tt=ds();De=new ee(Qe,De,tt)}return De}function Ns(){const De=Ft(Qt());return Ee(s.OpenParen)?at(De):De}function at(De){let Qe=new E(De,us());return Qe=Ft(Qe),Ee(s.OpenParen)&&(Qe=at(Qe)),Qe}function us(){J(s.OpenParen,"Expected opening parenthesis for arguments list");const De=Ar();return J(s.CloseParen,"Expected closing parenthesis for arguments list"),De}function Ar(){const De=[];for(;!Ee(s.CloseParen);){let Qe=Ot();if(Ee(s.Equals)){if(++z,!(Qe instanceof y))throw new SyntaxError("Expected identifier for keyword argument");const tt=Ot();Qe=new ae(Qe,tt)}De.push(Qe),Ee(s.Comma)&&++z}return De}function bs(){const De=[];let Qe=!1;for(;!Ee(s.CloseSquareBracket);)Ee(s.Colon)?(De.push(void 0),++z,Qe=!0):(De.push(Ot()),Ee(s.Colon)&&(++z,Qe=!0));if(De.length===0)throw new SyntaxError("Expected at least one argument for member/slice expression");if(Qe){if(De.length>3)throw new SyntaxError("Expected 0-3 arguments for slice expression");return new me(...De)}return De[0]}function Ft(De){for(;Ee(s.Dot)||Ee(s.OpenSquareBracket);){const Qe=O[z];++z;let tt;const Rt=Qe.type!==s.Dot;if(Rt)tt=bs(),J(s.CloseSquareBracket,"Expected closing square bracket");else if(tt=Qt(),tt.type!=="Identifier")throw new SyntaxError("Expected identifier following dot operator");De=new S(De,tt,Rt)}return De}function ds(){let De=cs();for(;Ee(s.MultiplicativeBinaryOperator);){const Qe=O[z];++z;const tt=cs();De=new ee(Qe,De,tt)}return De}function cs(){let De=ys();for(;Ee(s.Is);){++z;const Qe=Ee(s.Not);Qe&&++z;let tt=Qt();if(tt instanceof A?tt=new y(tt.value.toString()):tt instanceof B&&(tt=new y("none")),!(tt instanceof y))throw new SyntaxError("Expected identifier for the test");De=new X(De,Qe,tt)}return De}function ys(){let De=Ns();for(;Ee(s.Pipe);){++z;let Qe=Qt();if(!(Qe instanceof y))throw new SyntaxError("Expected identifier for the filter");Ee(s.OpenParen)&&(Qe=at(Qe)),De=new H(De,Qe)}return De}function Qt(){const De=O[z];switch(De.type){case s.NumericLiteral:return++z,new v(Number(De.value));case s.StringLiteral:return++z,new C(De.value);case s.BooleanLiteral:return++z,new A(De.value.toLowerCase()==="true");case s.NullLiteral:return++z,new B(null);case s.Identifier:return++z,new y(De.value);case s.OpenParen:{++z;const Qe=wt();if(O[z].type!==s.CloseParen)throw new SyntaxError(`Expected closing parenthesis, got ${O[z].type} instead`);return++z,Qe}case s.OpenSquareBracket:{++z;const Qe=[];for(;!Ee(s.CloseSquareBracket);)Qe.push(Ot()),Ee(s.Comma)&&++z;return++z,new K(Qe)}case s.OpenCurlyBracket:{++z;const Qe=new Map;for(;!Ee(s.CloseCurlyBracket);){const tt=Ot();J(s.Colon,"Expected colon between key and value in object literal");const Rt=Ot();Qe.set(tt,Rt),Ee(s.Comma)&&++z}return++z,new j(Qe)}default:throw new SyntaxError(`Unexpected token: ${De.type}`)}}for(;z=0?(Y=(Y??(Y=0))<0?Math.max(O.length+Y,0):Math.min(Y,O.length),z=(z??(z=O.length))<0?Math.max(O.length+z,0):Math.min(z,O.length)):(Y=(Y??(Y=O.length-1))<0?Math.max(O.length+Y,-1):Math.min(Y,O.length-1),z=(z??(z=-1))<-1?Math.max(O.length+z,-1):Math.min(z,O.length-1));const ye=[];for(let Ee=Y;le*EeY.toUpperCase())}var _e=class{constructor(O=void 0){te(this,"type","RuntimeValue");te(this,"value");te(this,"builtins",new Map);this.value=O}__bool__(){return new $e(!!this.value)}},se=class extends _e{constructor(){super(...arguments);te(this,"type","NumericValue")}},ce=class extends _e{constructor(){super(...arguments);te(this,"type","StringValue");te(this,"builtins",new Map([["upper",new pe(()=>new ce(this.value.toUpperCase()))],["lower",new pe(()=>new ce(this.value.toLowerCase()))],["strip",new pe(()=>new ce(this.value.trim()))],["title",new pe(()=>new ce(re(this.value)))],["length",new se(this.value.length)],["rstrip",new pe(()=>new ce(this.value.trimEnd()))],["lstrip",new pe(()=>new ce(this.value.trimStart()))],["split",new pe(Y=>{const z=Y[0]??new xe;if(!(z instanceof ce||z instanceof xe))throw new Error("sep argument must be a string or null");const J=Y[1]??new se(-1);if(!(J instanceof se))throw new Error("maxsplit argument must be a number");let le=[];if(z instanceof xe){const ye=this.value.trimStart();for(const{0:Ee,index:ke}of ye.matchAll(/\S+/g)){if(J.value!==-1&&le.length>=J.value&&ke!==void 0){le.push(Ee+ye.slice(ke+Ee.length));break}le.push(Ee)}}else{if(z.value==="")throw new Error("empty separator");le=this.value.split(z.value),J.value!==-1&&le.length>J.value&&le.push(le.splice(J.value).join(z.value))}return new q(le.map(ye=>new ce(ye)))})]]))}},$e=class extends _e{constructor(){super(...arguments);te(this,"type","BooleanValue")}},Ue=class extends _e{constructor(){super(...arguments);te(this,"type","ObjectValue");te(this,"builtins",new Map([["get",new pe(([Y,z])=>{if(!(Y instanceof ce))throw new Error(`Object key must be a string: got ${Y.type}`);return this.value.get(Y.value)??z??new xe})],["items",new pe(()=>new q(Array.from(this.value.entries()).map(([Y,z])=>new q([new ce(Y),z]))))]]))}__bool__(){return new $e(this.value.size>0)}},we=class extends Ue{constructor(){super(...arguments);te(this,"type","KeywordArgumentsValue")}},q=class extends _e{constructor(){super(...arguments);te(this,"type","ArrayValue");te(this,"builtins",new Map([["length",new se(this.value.length)]]))}__bool__(){return new $e(this.value.length>0)}},R=class extends q{constructor(){super(...arguments);te(this,"type","TupleValue")}},pe=class extends _e{constructor(){super(...arguments);te(this,"type","FunctionValue")}},xe=class extends _e{constructor(){super(...arguments);te(this,"type","NullValue")}},be=class extends _e{constructor(){super(...arguments);te(this,"type","UndefinedValue")}},Se=class{constructor(O){te(this,"variables",new Map([["namespace",new pe(O=>{if(O.length===0)return new Ue(new Map);if(O.length!==1||!(O[0]instanceof Ue))throw new Error("`namespace` expects either zero arguments or a single object argument");return O[0]})]]));te(this,"tests",new Map([["boolean",O=>O.type==="BooleanValue"],["callable",O=>O instanceof pe],["odd",O=>{if(O.type!=="NumericValue")throw new Error(`Cannot apply test "odd" to type: ${O.type}`);return O.value%2!==0}],["even",O=>{if(O.type!=="NumericValue")throw new Error(`Cannot apply test "even" to type: ${O.type}`);return O.value%2===0}],["false",O=>O.type==="BooleanValue"&&!O.value],["true",O=>O.type==="BooleanValue"&&O.value],["none",O=>O.type==="NullValue"],["string",O=>O.type==="StringValue"],["number",O=>O.type==="NumericValue"],["integer",O=>O.type==="NumericValue"&&Number.isInteger(O.value)],["iterable",O=>O.type==="ArrayValue"||O.type==="StringValue"],["mapping",O=>O.type==="ObjectValue"],["lower",O=>{const Y=O.value;return O.type==="StringValue"&&Y===Y.toLowerCase()}],["upper",O=>{const Y=O.value;return O.type==="StringValue"&&Y===Y.toUpperCase()}],["none",O=>O.type==="NullValue"],["defined",O=>O.type!=="UndefinedValue"],["undefined",O=>O.type==="UndefinedValue"],["equalto",(O,Y)=>O.value===Y.value],["eq",(O,Y)=>O.value===Y.value]]));this.parent=O}set(O,Y){return this.declareVariable(O,Fe(Y))}declareVariable(O,Y){if(this.variables.has(O))throw new SyntaxError(`Variable already declared: ${O}`);return this.variables.set(O,Y),Y}setVariable(O,Y){return this.variables.set(O,Y),Y}resolve(O){if(this.variables.has(O))return this;if(this.parent)return this.parent.resolve(O);throw new Error(`Unknown variable: ${O}`)}lookupVariable(O){try{return this.resolve(O).variables.get(O)??new be}catch{return new be}}},Ae=class{constructor(O){te(this,"global");this.global=O??new Se}run(O){return this.evaluate(O,this.global)}evaluateBinaryExpression(O,Y){const z=this.evaluate(O.left,Y);switch(O.operator.value){case"and":return z.__bool__().value?this.evaluate(O.right,Y):z;case"or":return z.__bool__().value?z:this.evaluate(O.right,Y)}const J=this.evaluate(O.right,Y);switch(O.operator.value){case"==":return new $e(z.value==J.value);case"!=":return new $e(z.value!=J.value)}if(z instanceof be||J instanceof be)throw new Error("Cannot perform operation on undefined values");if(z instanceof xe||J instanceof xe)throw new Error("Cannot perform operation on null values");if(z instanceof se&&J instanceof se)switch(O.operator.value){case"+":return new se(z.value+J.value);case"-":return new se(z.value-J.value);case"*":return new se(z.value*J.value);case"/":return new se(z.value/J.value);case"%":return new se(z.value%J.value);case"<":return new $e(z.value":return new $e(z.value>J.value);case">=":return new $e(z.value>=J.value);case"<=":return new $e(z.value<=J.value)}else if(z instanceof q&&J instanceof q)switch(O.operator.value){case"+":return new q(z.value.concat(J.value))}else if(J instanceof q){const le=J.value.find(ye=>ye.value===z.value)!==void 0;switch(O.operator.value){case"in":return new $e(le);case"not in":return new $e(!le)}}if(z instanceof ce||J instanceof ce)switch(O.operator.value){case"+":return new ce(z.value.toString()+J.value.toString())}if(z instanceof ce&&J instanceof ce)switch(O.operator.value){case"in":return new $e(J.value.includes(z.value));case"not in":return new $e(!J.value.includes(z.value))}if(z instanceof ce&&J instanceof Ue)switch(O.operator.value){case"in":return new $e(J.value.has(z.value));case"not in":return new $e(!J.value.has(z.value))}throw new SyntaxError(`Unknown operator "${O.operator.value}" between ${z.type} and ${J.type}`)}evaluateArguments(O,Y){const z=[],J=new Map;for(const le of O)if(le.type==="KeywordArgumentExpression"){const ye=le;J.set(ye.key.value,this.evaluate(ye.value,Y))}else{if(J.size>0)throw new Error("Positional arguments must come before keyword arguments");z.push(this.evaluate(le,Y))}return[z,J]}evaluateFilterExpression(O,Y){const z=this.evaluate(O.operand,Y);if(O.filter.type==="Identifier"){const J=O.filter;if(J.value==="tojson")return new ce(ze(z));if(z instanceof q)switch(J.value){case"list":return z;case"first":return z.value[0];case"last":return z.value[z.value.length-1];case"length":return new se(z.value.length);case"reverse":return new q(z.value.reverse());case"sort":return new q(z.value.sort((le,ye)=>{if(le.type!==ye.type)throw new Error(`Cannot compare different types: ${le.type} and ${ye.type}`);switch(le.type){case"NumericValue":return le.value-ye.value;case"StringValue":return le.value.localeCompare(ye.value);default:throw new Error(`Cannot compare type: ${le.type}`)}}));case"join":return new ce(z.value.map(le=>le.value).join(""));case"string":return new ce(ze(z));default:throw new Error(`Unknown ArrayValue filter: ${J.value}`)}else if(z instanceof ce)switch(J.value){case"length":return new se(z.value.length);case"upper":return new ce(z.value.toUpperCase());case"lower":return new ce(z.value.toLowerCase());case"title":return new ce(re(z.value));case"capitalize":return new ce(z.value.charAt(0).toUpperCase()+z.value.slice(1));case"trim":return new ce(z.value.trim());case"indent":return new ce(z.value.split(` +`).map((le,ye)=>ye===0||le.length===0?le:" "+le).join(` +`));case"join":case"string":return z;default:throw new Error(`Unknown StringValue filter: ${J.value}`)}else if(z instanceof se)switch(J.value){case"abs":return new se(Math.abs(z.value));default:throw new Error(`Unknown NumericValue filter: ${J.value}`)}else if(z instanceof Ue)switch(J.value){case"items":return new q(Array.from(z.value.entries()).map(([le,ye])=>new q([new ce(le),ye])));case"length":return new se(z.value.size);default:throw new Error(`Unknown ObjectValue filter: ${J.value}`)}throw new Error(`Cannot apply filter "${J.value}" to type: ${z.type}`)}else if(O.filter.type==="CallExpression"){const J=O.filter;if(J.callee.type!=="Identifier")throw new Error(`Unknown filter: ${J.callee.type}`);const le=J.callee.value;if(le==="tojson"){const[,ye]=this.evaluateArguments(J.args,Y),Ee=ye.get("indent")??new xe;if(!(Ee instanceof se||Ee instanceof xe))throw new Error("If set, indent must be a number");return new ce(ze(z,Ee.value))}else if(le==="join"){let ye;if(z instanceof ce)ye=Array.from(z.value);else if(z instanceof q)ye=z.value.map(Re=>Re.value);else throw new Error(`Cannot apply filter "${le}" to type: ${z.type}`);const[Ee,ke]=this.evaluateArguments(J.args,Y),Ie=Ee.at(0)??ke.get("separator")??new ce("");if(!(Ie instanceof ce))throw new Error("separator must be a string");return new ce(ye.join(Ie.value))}if(z instanceof q){switch(le){case"selectattr":case"rejectattr":{const ye=le==="selectattr";if(z.value.some(Ge=>!(Ge instanceof Ue)))throw new Error(`\`${le}\` can only be applied to array of objects`);if(J.args.some(Ge=>Ge.type!=="StringLiteral"))throw new Error(`arguments of \`${le}\` must be strings`);const[Ee,ke,Ie]=J.args.map(Ge=>this.evaluate(Ge,Y));let Re;if(ke){const Ge=Y.tests.get(ke.value);if(!Ge)throw new Error(`Unknown test: ${ke.value}`);Re=Ge}else Re=(...Ge)=>Ge[0].__bool__().value;const Xe=z.value.filter(Ge=>{const lt=Ge.value.get(Ee.value),wt=lt?Re(lt,Ie):!1;return ye?wt:!wt});return new q(Xe)}case"map":{const[,ye]=this.evaluateArguments(J.args,Y);if(ye.has("attribute")){const Ee=ye.get("attribute");if(!(Ee instanceof ce))throw new Error("attribute must be a string");const ke=ye.get("default"),Ie=z.value.map(Re=>{if(!(Re instanceof Ue))throw new Error("items in map must be an object");return Re.value.get(Ee.value)??ke??new be});return new q(Ie)}else throw new Error("`map` expressions without `attribute` set are not currently supported.")}}throw new Error(`Unknown ArrayValue filter: ${le}`)}else if(z instanceof ce){switch(le){case"indent":{const[ye,Ee]=this.evaluateArguments(J.args,Y),ke=ye.at(0)??Ee.get("width")??new se(4);if(!(ke instanceof se))throw new Error("width must be a number");const Ie=ye.at(1)??Ee.get("first")??new $e(!1),Re=ye.at(2)??Ee.get("blank")??new $e(!1),Xe=z.value.split(` +`),Ge=" ".repeat(ke.value),lt=Xe.map((wt,Gt)=>!Ie.value&&Gt===0||!Re.value&&wt.length===0?wt:Ge+wt);return new ce(lt.join(` +`))}}throw new Error(`Unknown StringValue filter: ${le}`)}else throw new Error(`Cannot apply filter "${le}" to type: ${z.type}`)}throw new Error(`Unknown filter: ${O.filter.type}`)}evaluateTestExpression(O,Y){const z=this.evaluate(O.operand,Y),J=Y.tests.get(O.test.value);if(!J)throw new Error(`Unknown test: ${O.test.value}`);const le=J(z);return new $e(O.negate?!le:le)}evaluateUnaryExpression(O,Y){const z=this.evaluate(O.argument,Y);switch(O.operator.value){case"not":return new $e(!z.value);default:throw new SyntaxError(`Unknown operator: ${O.operator.value}`)}}evalProgram(O,Y){return this.evaluateBlock(O.body,Y)}evaluateBlock(O,Y){let z="";for(const J of O){const le=this.evaluate(J,Y);le.type!=="NullValue"&&le.type!=="UndefinedValue"&&(z+=le.value)}return new ce(z)}evaluateIdentifier(O,Y){return Y.lookupVariable(O.value)}evaluateCallExpression(O,Y){const[z,J]=this.evaluateArguments(O.args,Y);J.size>0&&z.push(new we(J));const le=this.evaluate(O.callee,Y);if(le.type!=="FunctionValue")throw new Error(`Cannot call something that is not a function: got ${le.type}`);return le.value(z,Y)}evaluateSliceExpression(O,Y,z){if(!(O instanceof q||O instanceof ce))throw new Error("Slice object must be an array or string");const J=this.evaluate(Y.start,z),le=this.evaluate(Y.stop,z),ye=this.evaluate(Y.step,z);if(!(J instanceof se||J instanceof be))throw new Error("Slice start must be numeric or undefined");if(!(le instanceof se||le instanceof be))throw new Error("Slice stop must be numeric or undefined");if(!(ye instanceof se||ye instanceof be))throw new Error("Slice step must be numeric or undefined");return O instanceof q?new q(W(O.value,J.value,le.value,ye.value)):new ce(W(Array.from(O.value),J.value,le.value,ye.value).join(""))}evaluateMemberExpression(O,Y){const z=this.evaluate(O.object,Y);let J;if(O.computed){if(O.property.type==="SliceExpression")return this.evaluateSliceExpression(z,O.property,Y);J=this.evaluate(O.property,Y)}else J=new ce(O.property.value);let le;if(z instanceof Ue){if(!(J instanceof ce))throw new Error(`Cannot access property with non-string: got ${J.type}`);le=z.value.get(J.value)??z.builtins.get(J.value)}else if(z instanceof q||z instanceof ce)if(J instanceof se)le=z.value.at(J.value),z instanceof ce&&(le=new ce(z.value.at(J.value)));else if(J instanceof ce)le=z.builtins.get(J.value);else throw new Error(`Cannot access property with non-string/non-number: got ${J.type}`);else{if(!(J instanceof ce))throw new Error(`Cannot access property with non-string: got ${J.type}`);le=z.builtins.get(J.value)}return le instanceof _e?le:new be}evaluateSet(O,Y){const z=O.value?this.evaluate(O.value,Y):this.evaluateBlock(O.body,Y);if(O.assignee.type==="Identifier"){const J=O.assignee.value;Y.setVariable(J,z)}else if(O.assignee.type==="MemberExpression"){const J=O.assignee,le=this.evaluate(J.object,Y);if(!(le instanceof Ue))throw new Error("Cannot assign to member of non-object");if(J.property.type!=="Identifier")throw new Error("Cannot assign to member with non-identifier property");le.value.set(J.property.value,z)}else throw new Error(`Invalid LHS inside assignment expression: ${JSON.stringify(O.assignee)}`);return new xe}evaluateIf(O,Y){const z=this.evaluate(O.test,Y);return this.evaluateBlock(z.__bool__().value?O.body:O.alternate,Y)}evaluateFor(O,Y){const z=new Se(Y);let J,le;if(O.iterable.type==="SelectExpression"){const Re=O.iterable;le=this.evaluate(Re.iterable,z),J=Re.test}else le=this.evaluate(O.iterable,z);if(!(le instanceof q))throw new Error(`Expected iterable type in for loop: got ${le.type}`);const ye=[],Ee=[];for(let Re=0;Rewt.setVariable(O.loopvar.value,Ge);else if(O.loopvar.type==="TupleLiteral"){const wt=O.loopvar;if(Ge.type!=="ArrayValue")throw new Error(`Cannot unpack non-iterable type: ${Ge.type}`);const Gt=Ge;if(wt.value.length!==Gt.value.length)throw new Error(`Too ${wt.value.length>Gt.value.length?"few":"many"} items to unpack`);lt=Ot=>{for(let ur=0;ur0?ye[Re-1]:new be],["nextitem",Re{var Ee;const le=new Se(J);z=z.slice();let ye;((Ee=z.at(-1))==null?void 0:Ee.type)==="KeywordArgumentsValue"&&(ye=z.pop());for(let ke=0;kethis.evaluate(z,Y)));case"TupleLiteral":return new R(O.value.map(z=>this.evaluate(z,Y)));case"ObjectLiteral":{const z=new Map;for(const[J,le]of O.value){const ye=this.evaluate(J,Y);if(!(ye instanceof ce))throw new Error(`Object keys must be strings: got ${ye.type}`);z.set(ye.value,this.evaluate(le,Y))}return new Ue(z)}case"Identifier":return this.evaluateIdentifier(O,Y);case"CallExpression":return this.evaluateCallExpression(O,Y);case"MemberExpression":return this.evaluateMemberExpression(O,Y);case"UnaryExpression":return this.evaluateUnaryExpression(O,Y);case"BinaryExpression":return this.evaluateBinaryExpression(O,Y);case"FilterExpression":return this.evaluateFilterExpression(O,Y);case"TestExpression":return this.evaluateTestExpression(O,Y);default:throw new SyntaxError(`Unknown node type: ${O.type}`)}}};function Fe(O){switch(typeof O){case"number":return new se(O);case"string":return new ce(O);case"boolean":return new $e(O);case"undefined":return new be;case"object":return O===null?new xe:Array.isArray(O)?new q(O.map(Fe)):new Ue(new Map(Object.entries(O).map(([Y,z])=>[Y,Fe(z)])));case"function":return new pe((Y,z)=>{const J=O(...Y.map(le=>le.value))??null;return Fe(J)});default:throw new Error(`Cannot convert to runtime value: ${O}`)}}function ze(O,Y,z){const J=z??0;switch(O.type){case"NullValue":case"UndefinedValue":return"null";case"NumericValue":case"StringValue":case"BooleanValue":return JSON.stringify(O.value);case"ArrayValue":case"ObjectValue":{const le=Y?" ".repeat(Y):"",ye=` +`+le.repeat(J),Ee=ye+le;if(O.type==="ArrayValue"){const ke=O.value.map(Ie=>ze(Ie,Y,J+1));return Y?`[${Ee}${ke.join(`,${Ee}`)}${ye}]`:`[${ke.join(", ")}]`}else{const ke=Array.from(O.value.entries()).map(([Ie,Re])=>{const Xe=`"${Ie}": ${ze(Re,Y,J+1)}`;return Y?`${Ee}${Xe}`:Xe});return Y?`{${ke.join(",")}${ye}}`:`{${ke.join(", ")}}`}}default:throw new Error(`Cannot convert to JSON: ${O.type}`)}}var Ve=class{constructor(O){te(this,"parsed");const Y=d(O,{lstrip_blocks:!0,trim_blocks:!0});this.parsed=V(Y)}render(O){const Y=new Se;if(Y.set("false",!1),Y.set("true",!0),Y.set("raise_exception",le=>{throw new Error(le)}),Y.set("range",F),O)for(const[le,ye]of Object.entries(O))Y.set(le,ye);return new Ae(Y).run(this.parsed).value}}},"./src/backends/onnx.js":(e,r,t)=>{var s;t.r(r),t.d(r,{Tensor:()=>a.Tensor,createInferenceSession:()=>k,deviceToExecutionProviders:()=>_,isONNXProxy:()=>S,isONNXTensor:()=>w});var o=t("./src/env.js"),n=t("?2ce3"),i=t("onnxruntime-web"),a=t("onnxruntime-common");const l=Object.freeze({auto:null,gpu:null,cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:{name:"webnn",deviceType:"cpu"},"webnn-npu":{name:"webnn",deviceType:"npu"},"webnn-gpu":{name:"webnn",deviceType:"gpu"},"webnn-cpu":{name:"webnn",deviceType:"cpu"}}),u=[];let p,d;const c=Symbol.for("onnxruntime");if(c in globalThis)d=globalThis[c];else if(o.apis.IS_NODE_ENV){switch(d=n??(s||(s=t.t(n,2))),process.platform){case"win32":u.push("dml");break;case"linux":process.arch==="x64"&&u.push("cuda");break}u.push("cpu"),p=["cpu"]}else d=i,o.apis.IS_WEBNN_AVAILABLE&&u.push("webnn-npu","webnn-gpu","webnn-cpu","webnn"),o.apis.IS_WEBGPU_AVAILABLE&&u.push("webgpu"),u.push("wasm"),p=["wasm"];const f=d.InferenceSession;function _(E=null){if(!E)return p;switch(E){case"auto":return u;case"gpu":return u.filter(y=>["webgpu","cuda","dml","webnn-gpu"].includes(y))}if(u.includes(E))return[l[E]??E];throw new Error(`Unsupported device: "${E}". Should be one of: ${u.join(", ")}.`)}let T=null;async function k(E,y,M){T&&await T;const v=f.create(E,y);T??(T=v);const C=await v;return C.config=M,C}function w(E){return E instanceof d.Tensor}const g=d==null?void 0:d.env;g!=null&&g.wasm&&(!(typeof ServiceWorkerGlobalScope<"u"&&self instanceof ServiceWorkerGlobalScope)&&!g.wasm.wasmPaths&&(g.wasm.wasmPaths=`https://cdn.jsdelivr.net/npm/@huggingface/transformers@${o.env.version}/dist/`),g.wasm.proxy=!1),g!=null&&g.webgpu&&(g.webgpu.powerPreference="high-performance");function S(){var E;return(E=g==null?void 0:g.wasm)==null?void 0:E.proxy}o.env.backends.onnx=g},"./src/base/feature_extraction_utils.js":(e,r,t)=>{t.r(r),t.d(r,{FeatureExtractor:()=>i,validate_audio_inputs:()=>a});var s=t("./src/utils/constants.js"),o=t("./src/utils/generic.js"),n=t("./src/utils/hub.js");class i extends o.Callable{constructor(u){super(),this.config=u}static async from_pretrained(u,p){const d=await(0,n.getModelJSON)(u,s.FEATURE_EXTRACTOR_NAME,!0,p);return new this(d)}}function a(l,u){var p;if(!(l instanceof Float32Array||l instanceof Float64Array))throw new Error(`${u} expects input to be a Float32Array or a Float64Array, but got ${((p=l==null?void 0:l.constructor)==null?void 0:p.name)??typeof l} instead. If using the feature extractor directly, remember to use \`read_audio(url, sampling_rate)\` to obtain the raw audio data of the file/url.`)}},"./src/base/image_processors_utils.js":(e,r,t)=>{t.r(r),t.d(r,{ImageProcessor:()=>E,center_to_corners_format:()=>d,post_process_instance_segmentation:()=>S,post_process_object_detection:()=>c,post_process_panoptic_segmentation:()=>g,post_process_semantic_segmentation:()=>f});var s=t("./src/utils/generic.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");t("./src/utils/image.js");var i=t("./src/utils/core.js"),a=t("./src/utils/hub.js"),l=t("./src/utils/constants.js");function u(y,M,v=0,C=null){const A=y/M;let B=(0,n.bankers_round)(A)*M;return C!==null&&B>C&&(B=Math.floor(A)*M),BM&&F.push(re)}else{let re=(0,n.max)(V.data)[1];if(re===j-1||(W=(0,n.softmax)(V.data),W[re]se*Z[(ce+1)%2])),X.boxes.push(_e),X.classes.push(re),X.scores.push(W[re])}}ee.push(X)}return ee}function f(y,M=null){const v=y.logits,C=v.dims[0];if(M!==null&&M.length!==C)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const A=[];for(let B=0;BZ[F]&&(Z[F]=V[F],X[F]=ae)}const oe=new Array(G.dims[0]);for(let ae=0;aeae!==void 0);A.push({segmentation:H,labels:me})}return A}function _(y,M,v,C){const A=[],B=[],K=[];for(let G=0;Gv&&(A.push(ee),B.push(X),K.push(H))}return[A,B,K]}function T(y,M,v,C=.5,A=.8){const B=[];let K=0,G=0;const j=M[v].data;for(let H=0;H=C&&++G;let ee=K>0&&G>0;return ee&&(ee=K/G>A),[ee,B]}function k(y,M,v,C,A,B=null,K=null){const[G,j]=K??y[0].dims,ee=new o.Tensor("int32",new Int32Array(G*j),[G,j]),H=[];if(K!==null)for(let ae=0;aeX[W]&&(Z[W]=ae,X[W]=F[W])}let oe=0;const me=ee.data;for(let ae=0;ae200)throw new Error(`absolute aspect ratio must be smaller than 200, got ${Math.max(y,M)/Math.min(y,M)}`);let B=Math.round(y/v)*v,K=Math.round(M/v)*v;if(B*K>A){const G=Math.sqrt(y*M/A);B=Math.floor(y/G/v)*v,K=Math.floor(M/G/v)*v}else if(B*KB?ee=Math.floor(B*j/A):B>A&&(j=Math.floor(A*ee/B)),await M.resize(ee,j,{resample:C}))}async crop_margin(M,v=200){const C=M.clone().grayscale(),A=(0,n.min)(C.data)[0],K=(0,n.max)(C.data)[0]-A;if(K===0)return M;const G=v/255;let j=C.width,ee=C.height,H=0,Z=0;const X=C.data;for(let oe=0;oethis.preprocess(B)));return{pixel_values:(0,o.stack)(C.map(B=>B.pixel_values),0),original_sizes:C.map(B=>B.original_size),reshaped_input_sizes:C.map(B=>B.reshaped_input_size)}}static async from_pretrained(M,v){const C=await(0,a.getModelJSON)(M,l.IMAGE_PROCESSOR_NAME,!0,v);return new this(C)}}},"./src/base/processing_utils.js":(e,r,t)=>{t.r(r),t.d(r,{Processor:()=>i});var s=t("./src/utils/constants.js"),o=t("./src/utils/generic.js"),n=t("./src/utils/hub.js");class i extends o.Callable{constructor(l,u){super(),this.config=l,this.components=u}get image_processor(){return this.components.image_processor}get tokenizer(){return this.components.tokenizer}get feature_extractor(){return this.components.feature_extractor}apply_chat_template(l,u={}){if(!this.tokenizer)throw new Error("Unable to apply chat template without a tokenizer.");return this.tokenizer.apply_chat_template(l,{tokenize:!1,...u})}batch_decode(...l){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.batch_decode(...l)}decode(...l){if(!this.tokenizer)throw new Error("Unable to decode without a tokenizer.");return this.tokenizer.decode(...l)}async _call(l,...u){for(const p of[this.image_processor,this.feature_extractor,this.tokenizer])if(p)return p(l,...u);throw new Error("No image processor, feature extractor, or tokenizer found.")}static async from_pretrained(l,u){const[p,d]=await Promise.all([this.uses_processor_config?(0,n.getModelJSON)(l,s.PROCESSOR_NAME,!0,u):{},Promise.all(this.classes.filter(c=>c in this).map(async c=>{const f=await this[c].from_pretrained(l,u);return[c.replace(/_class$/,""),f]})).then(Object.fromEntries)]);return new this(p,d)}}te(i,"classes",["image_processor_class","tokenizer_class","feature_extractor_class"]),te(i,"uses_processor_config",!1)},"./src/configs.js":(e,r,t)=>{t.r(r),t.d(r,{AutoConfig:()=>u,PretrainedConfig:()=>l,getKeyValueShapes:()=>a});var s=t("./src/utils/core.js"),o=t("./src/utils/hub.js");async function n(p,d){return await(0,o.getModelJSON)(p,"config.json",!0,d)}function i(p){const d={};let c={};switch(p.model_type){case"llava":case"paligemma":case"gemma3":case"florence2":case"llava_onevision":case"idefics3":case"ultravox":case"smolvlm":c=i(p.text_config);break;case"moondream1":c=i(p.phi_config);break;case"musicgen":c=i(p.decoder);break;case"multi_modality":c=i(p.language_config);break;case"gpt2":case"gptj":case"jais":case"codegen":case"gpt_bigcode":d.num_heads="n_head",d.num_layers="n_layer",d.hidden_size="n_embd";break;case"gpt_neox":case"stablelm":case"opt":case"falcon":d.num_heads="num_attention_heads",d.num_layers="num_hidden_layers",d.hidden_size="hidden_size";break;case"llama":case"olmo":case"olmo2":case"mobilellm":case"granite":case"cohere":case"mistral":case"starcoder2":case"qwen2":case"qwen2_vl":case"phi":case"phi3":case"phi3_v":d.num_heads="num_key_value_heads",d.num_layers="num_hidden_layers",d.hidden_size="hidden_size",d.num_attention_heads="num_attention_heads";break;case"gemma":case"gemma2":case"gemma3_text":case"glm":case"helium":d.num_heads="num_key_value_heads",d.num_layers="num_hidden_layers",d.dim_kv="head_dim";break;case"openelm":d.num_heads="num_kv_heads",d.num_layers="num_transformer_layers",d.dim_kv="head_dim";break;case"gpt_neo":case"donut-swin":d.num_heads="num_heads",d.num_layers="num_layers",d.hidden_size="hidden_size";break;case"bloom":d.num_heads="n_head",d.num_layers="n_layer",d.hidden_size="hidden_size";break;case"mpt":d.num_heads="n_heads",d.num_layers="n_layers",d.hidden_size="d_model";break;case"exaone":d.num_heads="num_key_value_heads",d.num_layers="num_layers",d.dim_kv="head_dim",d.num_attention_heads="num_attention_heads";break;case"t5":case"mt5":case"longt5":d.num_decoder_layers="num_decoder_layers",d.num_decoder_heads="num_heads",d.decoder_dim_kv="d_kv",d.num_encoder_layers="num_layers",d.num_encoder_heads="num_heads",d.encoder_dim_kv="d_kv";break;case"bart":case"mbart":case"marian":case"whisper":case"lite-whisper":case"m2m_100":case"blenderbot":case"blenderbot-small":case"florence2_language":d.num_decoder_layers="decoder_layers",d.num_decoder_heads="decoder_attention_heads",d.decoder_hidden_size="d_model",d.num_encoder_layers="encoder_layers",d.num_encoder_heads="encoder_attention_heads",d.encoder_hidden_size="d_model";break;case"speecht5":d.num_decoder_layers="decoder_layers",d.num_decoder_heads="decoder_attention_heads",d.decoder_hidden_size="hidden_size",d.num_encoder_layers="encoder_layers",d.num_encoder_heads="encoder_attention_heads",d.encoder_hidden_size="hidden_size";break;case"trocr":d.num_encoder_layers=d.num_decoder_layers="decoder_layers",d.num_encoder_heads=d.num_decoder_heads="decoder_attention_heads",d.encoder_hidden_size=d.decoder_hidden_size="d_model";break;case"musicgen_decoder":d.num_encoder_layers=d.num_decoder_layers="num_hidden_layers",d.num_encoder_heads=d.num_decoder_heads="num_attention_heads",d.encoder_hidden_size=d.decoder_hidden_size="hidden_size";break;case"moonshine":d.num_decoder_layers="decoder_num_hidden_layers",d.num_decoder_heads="decoder_num_key_value_heads",d.num_encoder_layers="encoder_num_hidden_layers",d.num_encoder_heads="encoder_num_key_value_heads",d.encoder_hidden_size=d.decoder_hidden_size="hidden_size";break;case"vision-encoder-decoder":const _=i(p.decoder),T="num_decoder_layers"in _,k=(0,s.pick)(p,["model_type","is_encoder_decoder"]);return T?(k.num_decoder_layers=_.num_decoder_layers,k.num_decoder_heads=_.num_decoder_heads,k.decoder_hidden_size=_.decoder_hidden_size,k.num_encoder_layers=_.num_encoder_layers,k.num_encoder_heads=_.num_encoder_heads,k.encoder_hidden_size=_.encoder_hidden_size):(k.num_layers=_.num_layers,k.num_heads=_.num_heads,k.hidden_size=_.hidden_size),k}const f={...c,...(0,s.pick)(p,["model_type","multi_query","is_encoder_decoder"])};for(const _ in d)f[_]=p[d[_]];return f}function a(p,{prefix:d="past_key_values",batch_size:c=1}={}){const f={},_=p.normalized_config;if(_.is_encoder_decoder&&"num_encoder_heads"in _&&"num_decoder_heads"in _){const T=_.encoder_dim_kv??_.encoder_hidden_size/_.num_encoder_heads,k=_.decoder_dim_kv??_.decoder_hidden_size/_.num_decoder_heads,w=[c,_.num_encoder_heads,0,T],g=[c,_.num_decoder_heads,0,k];for(let S=0;S<_.num_decoder_layers;++S)f[`${d}.${S}.encoder.key`]=w,f[`${d}.${S}.encoder.value`]=w,f[`${d}.${S}.decoder.key`]=g,f[`${d}.${S}.decoder.value`]=g}else{const T=_.num_heads,k=_.num_layers,w=_.dim_kv??_.hidden_size/(_.num_attention_heads??T);if(_.model_type==="falcon"){const g=[c*T,0,w];for(let S=0;S{var C,A;t.r(r),t.d(r,{apis:()=>k,env:()=>M});var s=t("?569f"),o=t("?3f59"),n=t("?154a");const i="3.5.0",a=typeof window<"u"&&typeof window.document<"u",l=typeof self<"u"&&((C=self.constructor)==null?void 0:C.name)==="DedicatedWorkerGlobalScope",u=typeof self<"u"&&"caches"in self,p=typeof navigator<"u"&&"gpu"in navigator,d=typeof navigator<"u"&&"ml"in navigator,c=typeof process<"u",f=c&&((A=process==null?void 0:process.release)==null?void 0:A.name)==="node",_=!v(s),T=!v(o),k=Object.freeze({IS_BROWSER_ENV:a,IS_WEBWORKER_ENV:l,IS_WEB_CACHE_AVAILABLE:u,IS_WEBGPU_AVAILABLE:p,IS_WEBNN_AVAILABLE:d,IS_PROCESS_AVAILABLE:c,IS_NODE_ENV:f,IS_FS_AVAILABLE:_,IS_PATH_AVAILABLE:T}),w=_&&T;let g="./";if(w){const B=Object({url:self.location.href}).url;B?g=o.dirname(o.dirname(n.fileURLToPath(B))):typeof __dirname<"u"&&(g=o.dirname(__dirname))}const S=w?o.join(g,"/.cache/"):null,E="/models/",y=w?o.join(g,E):E,M={version:i,backends:{onnx:{}},allowRemoteModels:!0,remoteHost:"https://huggingface.co/",remotePathTemplate:"{model}/resolve/{revision}/",allowLocalModels:!(a||l),localModelPath:y,useFS:_,useBrowserCache:u,useFSCache:_,cacheDir:S,useCustomCache:!1,customCache:null};function v(B){return Object.keys(B).length===0}},"./src/generation/configuration_utils.js":(e,r,t)=>{t.r(r),t.d(r,{GenerationConfig:()=>o});var s=t("./src/utils/core.js");class o{constructor(i){te(this,"max_length",20);te(this,"max_new_tokens",null);te(this,"min_length",0);te(this,"min_new_tokens",null);te(this,"early_stopping",!1);te(this,"max_time",null);te(this,"do_sample",!1);te(this,"num_beams",1);te(this,"num_beam_groups",1);te(this,"penalty_alpha",null);te(this,"use_cache",!0);te(this,"temperature",1);te(this,"top_k",50);te(this,"top_p",1);te(this,"typical_p",1);te(this,"epsilon_cutoff",0);te(this,"eta_cutoff",0);te(this,"diversity_penalty",0);te(this,"repetition_penalty",1);te(this,"encoder_repetition_penalty",1);te(this,"length_penalty",1);te(this,"no_repeat_ngram_size",0);te(this,"bad_words_ids",null);te(this,"force_words_ids",null);te(this,"renormalize_logits",!1);te(this,"constraints",null);te(this,"forced_bos_token_id",null);te(this,"forced_eos_token_id",null);te(this,"remove_invalid_values",!1);te(this,"exponential_decay_length_penalty",null);te(this,"suppress_tokens",null);te(this,"streamer",null);te(this,"begin_suppress_tokens",null);te(this,"forced_decoder_ids",null);te(this,"guidance_scale",null);te(this,"num_return_sequences",1);te(this,"output_attentions",!1);te(this,"output_hidden_states",!1);te(this,"output_scores",!1);te(this,"return_dict_in_generate",!1);te(this,"pad_token_id",null);te(this,"bos_token_id",null);te(this,"eos_token_id",null);te(this,"encoder_no_repeat_ngram_size",0);te(this,"decoder_start_token_id",null);te(this,"generation_kwargs",{});Object.assign(this,(0,s.pick)(i,Object.getOwnPropertyNames(this)))}}},"./src/generation/logits_process.js":(e,r,t)=>{t.r(r),t.d(r,{ClassifierFreeGuidanceLogitsProcessor:()=>w,ForcedBOSTokenLogitsProcessor:()=>l,ForcedEOSTokenLogitsProcessor:()=>u,LogitsProcessor:()=>n,LogitsProcessorList:()=>a,LogitsWarper:()=>i,MinLengthLogitsProcessor:()=>_,MinNewTokensLengthLogitsProcessor:()=>T,NoBadWordsLogitsProcessor:()=>k,NoRepeatNGramLogitsProcessor:()=>c,RepetitionPenaltyLogitsProcessor:()=>f,SuppressTokensAtBeginLogitsProcessor:()=>p,TemperatureLogitsWarper:()=>g,TopKLogitsWarper:()=>E,TopPLogitsWarper:()=>S,WhisperTimeStampLogitsProcessor:()=>d});var s=t("./src/utils/generic.js");t("./src/utils/tensor.js");var o=t("./src/utils/maths.js");class n extends s.Callable{_call(M,v){throw Error("`_call` should be implemented in a subclass")}}class i extends s.Callable{_call(M,v){throw Error("`_call` should be implemented in a subclass")}}class a extends s.Callable{constructor(){super(),this.processors=[]}push(M){this.processors.push(M)}extend(M){this.processors.push(...M)}_call(M,v){let C=v;for(const A of this.processors)C=A(M,C);return C}[Symbol.iterator](){return this.processors.values()}}class l extends n{constructor(M){super(),this.bos_token_id=M}_call(M,v){for(let C=0;C=1&&B[B.length-1]>=this.timestamp_begin,G=B.length<2||B[B.length-2]>=this.timestamp_begin;if(K&&(G?A.subarray(this.timestamp_begin).fill(-1/0):A.subarray(0,this.eos_token_id).fill(-1/0)),M[C].length===this.begin_index&&this.max_initial_timestamp_index!==null){const Z=this.timestamp_begin+this.max_initial_timestamp_index;A.subarray(Z+1).fill(-1/0)}const j=(0,o.log_softmax)(A),ee=Math.log(j.subarray(this.timestamp_begin).map(Math.exp).reduce((Z,X)=>Z+X)),H=(0,o.max)(j.subarray(0,this.timestamp_begin))[0];ee>H&&A.subarray(0,this.timestamp_begin).fill(-1/0)}return v}}class c extends n{constructor(M){super(),this.no_repeat_ngram_size=M}getNgrams(M){const v=M.length,C=[];for(let B=0;B1 to use the classifier free guidance processor, got guidance scale ${M}.`);this.guidance_scale=M}_call(M,v){if(v.dims[0]!==2*M.length)throw new Error(`Logits should have twice the batch size of the input ids, the first half of batches corresponding to the conditional inputs, and the second half of batches corresponding to the unconditional inputs. Got batch size ${v.dims[0]} for the logits and ${M.length} for the input ids.`);const C=M.length,A=v.slice([0,C],null),B=v.slice([C,v.dims[0]],null);for(let K=0;K1)throw new Error(`\`top_p\` must be a float > 0 and < 1, but is ${M}`);if(!Number.isInteger(C)||C<1)throw new Error(`\`min_tokens_to_keep\` must be a positive integer, but is ${C}`);this.top_p=M,this.filter_value=v,this.min_tokens_to_keep=C}}class E extends i{constructor(M,{filter_value:v=-1/0,min_tokens_to_keep:C=1}={}){if(super(),!Number.isInteger(M)||M<0)throw new Error(`\`top_k\` must be a positive integer, but is ${M}`);this.top_k=Math.max(M,C),this.filter_value=v}}},"./src/generation/logits_sampler.js":(e,r,t)=>{t.r(r),t.d(r,{LogitsSampler:()=>i});var s=t("./src/utils/generic.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");t("./src/generation/configuration_utils.js");class i extends s.Callable{constructor(d){super(),this.generation_config=d}async _call(d){return this.sample(d)}async sample(d){throw Error("sample should be implemented in subclasses.")}getLogits(d,c){let f=d.dims.at(-1),_=d.data;if(c===-1)_=_.slice(-f);else{let T=c*f;_=_.slice(T,T+f)}return _}randomSelect(d){let c=0;for(let _=0;_1)return new u(d);if(d.num_return_sequences>1)throw Error(`num_return_sequences has to be 1 when doing greedy search, but is ${d.num_return_sequences}.`);return new a(d)}}class a extends i{async sample(d){const c=(0,n.max)(d.data)[1];return[[BigInt(c),0]]}}class l extends i{async sample(d){let c=d.dims.at(-1);this.generation_config.top_k>0&&(c=Math.min(this.generation_config.top_k,c));const[f,_]=await(0,o.topk)(d,c),T=(0,n.softmax)(f.data);return Array.from({length:this.generation_config.num_beams},()=>{const k=this.randomSelect(T);return[_.data[k],Math.log(T[k])]})}}class u extends i{async sample(d){let c=d.dims.at(-1);this.generation_config.top_k>0&&(c=Math.min(this.generation_config.top_k,c));const[f,_]=await(0,o.topk)(d,c),T=(0,n.softmax)(f.data);return Array.from({length:this.generation_config.num_beams},(k,w)=>[_.data[w],Math.log(T[w])])}}},"./src/generation/stopping_criteria.js":(e,r,t)=>{t.r(r),t.d(r,{EosTokenCriteria:()=>a,InterruptableStoppingCriteria:()=>l,MaxLengthCriteria:()=>i,StoppingCriteria:()=>o,StoppingCriteriaList:()=>n});var s=t("./src/utils/generic.js");class o extends s.Callable{_call(p,d){throw Error("StoppingCriteria needs to be subclassed")}}class n extends s.Callable{constructor(){super(),this.criteria=[]}push(p){this.criteria.push(p)}extend(p){p instanceof n?p=p.criteria:p instanceof o&&(p=[p]),this.criteria.push(...p)}_call(p,d){const c=new Array(p.length).fill(!1);for(const f of this.criteria){const _=f(p,d);for(let T=0;Td.length>=this.max_length)}}class a extends o{constructor(p){super(),Array.isArray(p)||(p=[p]),this.eos_token_id=p}_call(p,d){return p.map(c=>{const f=c.at(-1);return this.eos_token_id.some(_=>f==_)})}}class l extends o{constructor(){super(),this.interrupted=!1}interrupt(){this.interrupted=!0}reset(){this.interrupted=!1}_call(p,d){return new Array(p.length).fill(this.interrupted)}}},"./src/generation/streamers.js":(e,r,t)=>{t.r(r),t.d(r,{BaseStreamer:()=>i,TextStreamer:()=>l,WhisperTextStreamer:()=>u});var s=t("./src/utils/core.js"),o=t("./src/tokenizers.js"),n=t("./src/env.js");class i{put(d){throw Error("Not implemented")}end(){throw Error("Not implemented")}}const a=n.apis.IS_PROCESS_AVAILABLE?p=>process.stdout.write(p):p=>console.log(p);class l extends i{constructor(d,{skip_prompt:c=!1,callback_function:f=null,token_callback_function:_=null,skip_special_tokens:T=!0,decode_kwargs:k={},...w}={}){super(),this.tokenizer=d,this.skip_prompt=c,this.callback_function=f??a,this.token_callback_function=_,this.decode_kwargs={skip_special_tokens:T,...k,...w},this.token_cache=[],this.print_len=0,this.next_tokens_are_prompt=!0}put(d){var k;if(d.length>1)throw Error("TextStreamer only supports batch size of 1");const c=this.next_tokens_are_prompt;if(c&&(this.next_tokens_are_prompt=!1,this.skip_prompt))return;const f=d[0];(k=this.token_callback_function)==null||k.call(this,f),this.token_cache=(0,s.mergeArrays)(this.token_cache,f);const _=this.tokenizer.decode(this.token_cache,this.decode_kwargs);let T;c||_.endsWith(` +`)?(T=_.slice(this.print_len),this.token_cache=[],this.print_len=0):_.length>0&&(0,o.is_chinese_char)(_.charCodeAt(_.length-1))?(T=_.slice(this.print_len),this.print_len+=T.length):(T=_.slice(this.print_len,_.lastIndexOf(" ")+1),this.print_len+=T.length),this.on_finalized_text(T,!1)}end(){let d;this.token_cache.length>0?(d=this.tokenizer.decode(this.token_cache,this.decode_kwargs).slice(this.print_len),this.token_cache=[],this.print_len=0):d="",this.next_tokens_are_prompt=!0,this.on_finalized_text(d,!0)}on_finalized_text(d,c){var f,_;d.length>0&&((f=this.callback_function)==null||f.call(this,d)),c&&this.callback_function===a&&n.apis.IS_PROCESS_AVAILABLE&&((_=this.callback_function)==null||_.call(this,` +`))}}class u extends l{constructor(d,{skip_prompt:c=!1,callback_function:f=null,token_callback_function:_=null,on_chunk_start:T=null,on_chunk_end:k=null,on_finalize:w=null,time_precision:g=.02,skip_special_tokens:S=!0,decode_kwargs:E={}}={}){super(d,{skip_prompt:c,skip_special_tokens:S,callback_function:f,token_callback_function:_,decode_kwargs:E}),this.timestamp_begin=d.timestamp_begin,this.on_chunk_start=T,this.on_chunk_end=k,this.on_finalize=w,this.time_precision=g,this.waiting_for_timestamp=!1}put(d){var f,_;if(d.length>1)throw Error("WhisperTextStreamer only supports batch size of 1");const c=d[0];if(c.length===1){const T=Number(c[0])-this.timestamp_begin;if(T>=0){const k=T*this.time_precision;this.waiting_for_timestamp?(f=this.on_chunk_end)==null||f.call(this,k):(_=this.on_chunk_start)==null||_.call(this,k),this.waiting_for_timestamp=!this.waiting_for_timestamp,d=[[]]}}return super.put(d)}end(){var d;super.end(),(d=this.on_finalize)==null||d.call(this)}}},"./src/models.js":(e,r,t)=>{t.r(r),t.d(r,{ASTForAudioClassification:()=>Ii,ASTModel:()=>ki,ASTPreTrainedModel:()=>Eo,AlbertForMaskedLM:()=>N,AlbertForQuestionAnswering:()=>$,AlbertForSequenceClassification:()=>he,AlbertModel:()=>vn,AlbertPreTrainedModel:()=>xs,AutoModel:()=>fd,AutoModelForAudioClassification:()=>M0,AutoModelForAudioFrameClassification:()=>y0,AutoModelForAudioTextToText:()=>k0,AutoModelForCTC:()=>w0,AutoModelForCausalLM:()=>a0,AutoModelForDepthEstimation:()=>E0,AutoModelForDocumentQuestionAnswering:()=>v0,AutoModelForImageClassification:()=>c0,AutoModelForImageFeatureExtraction:()=>S0,AutoModelForImageMatting:()=>x0,AutoModelForImageSegmentation:()=>p0,AutoModelForImageTextToText:()=>$0,AutoModelForImageToImage:()=>T0,AutoModelForMaskGeneration:()=>g0,AutoModelForMaskedLM:()=>l0,AutoModelForNormalEstimation:()=>P0,AutoModelForObjectDetection:()=>_0,AutoModelForPoseEstimation:()=>C0,AutoModelForQuestionAnswering:()=>u0,AutoModelForSemanticSegmentation:()=>h0,AutoModelForSeq2SeqLM:()=>s0,AutoModelForSequenceClassification:()=>t0,AutoModelForSpeechSeq2Seq:()=>n0,AutoModelForTextToSpectrogram:()=>o0,AutoModelForTextToWaveform:()=>i0,AutoModelForTokenClassification:()=>r0,AutoModelForUniversalSegmentation:()=>m0,AutoModelForVision2Seq:()=>d0,AutoModelForXVector:()=>b0,AutoModelForZeroShotObjectDetection:()=>f0,BartForConditionalGeneration:()=>jt,BartForSequenceClassification:()=>kt,BartModel:()=>Pt,BartPretrainedModel:()=>xt,BaseModelOutput:()=>xe,BeitForImageClassification:()=>Rw,BeitModel:()=>Bw,BeitPreTrainedModel:()=>Ou,BertForMaskedLM:()=>Ae,BertForQuestionAnswering:()=>Ve,BertForSequenceClassification:()=>Fe,BertForTokenClassification:()=>ze,BertModel:()=>Se,BertPreTrainedModel:()=>be,BlenderbotForConditionalGeneration:()=>rr,BlenderbotModel:()=>Dt,BlenderbotPreTrainedModel:()=>Xr,BlenderbotSmallForConditionalGeneration:()=>Rr,BlenderbotSmallModel:()=>Qr,BlenderbotSmallPreTrainedModel:()=>wr,BloomForCausalLM:()=>aw,BloomModel:()=>iw,BloomPreTrainedModel:()=>vu,CLIPModel:()=>Ni,CLIPPreTrainedModel:()=>Fs,CLIPSegForImageSegmentation:()=>Bo,CLIPSegModel:()=>zo,CLIPSegPreTrainedModel:()=>Xn,CLIPTextModel:()=>pu,CLIPTextModelWithProjection:()=>Vi,CLIPVisionModel:()=>hu,CLIPVisionModelWithProjection:()=>Ui,CamembertForMaskedLM:()=>Ft,CamembertForQuestionAnswering:()=>ys,CamembertForSequenceClassification:()=>ds,CamembertForTokenClassification:()=>cs,CamembertModel:()=>bs,CamembertPreTrainedModel:()=>Ar,CausalLMOutput:()=>In,CausalLMOutputWithPast:()=>Wx,ChineseCLIPModel:()=>Gi,ChineseCLIPPreTrainedModel:()=>Wi,ClapAudioModelWithProjection:()=>zb,ClapModel:()=>Db,ClapPreTrainedModel:()=>ta,ClapTextModelWithProjection:()=>Lb,CodeGenForCausalLM:()=>$n,CodeGenModel:()=>Ko,CodeGenPreTrainedModel:()=>eo,CohereForCausalLM:()=>Ug,CohereModel:()=>Vg,CoherePreTrainedModel:()=>mu,ConvBertForMaskedLM:()=>Ot,ConvBertForQuestionAnswering:()=>Ms,ConvBertForSequenceClassification:()=>ur,ConvBertForTokenClassification:()=>ls,ConvBertModel:()=>Gt,ConvBertPreTrainedModel:()=>wt,ConvNextForImageClassification:()=>IM,ConvNextModel:()=>kM,ConvNextPreTrainedModel:()=>qu,ConvNextV2ForImageClassification:()=>FM,ConvNextV2Model:()=>AM,ConvNextV2PreTrainedModel:()=>Xu,DPTForDepthEstimation:()=>pM,DPTModel:()=>cM,DPTPreTrainedModel:()=>Gu,DacDecoderModel:()=>Ey,DacDecoderOutput:()=>vy,DacEncoderModel:()=>Ty,DacEncoderOutput:()=>yy,DacModel:()=>xy,DacPreTrainedModel:()=>la,DebertaForMaskedLM:()=>Qe,DebertaForQuestionAnswering:()=>zr,DebertaForSequenceClassification:()=>tt,DebertaForTokenClassification:()=>Rt,DebertaModel:()=>De,DebertaPreTrainedModel:()=>Qt,DebertaV2ForMaskedLM:()=>hs,DebertaV2ForQuestionAnswering:()=>_s,DebertaV2ForSequenceClassification:()=>Kr,DebertaV2ForTokenClassification:()=>ms,DebertaV2Model:()=>ps,DebertaV2PreTrainedModel:()=>Sr,DecisionTransformerModel:()=>ny,DecisionTransformerPreTrainedModel:()=>sy,DeiTForImageClassification:()=>tM,DeiTModel:()=>eM,DeiTPreTrainedModel:()=>Nu,DepthAnythingForDepthEstimation:()=>mM,DepthAnythingPreTrainedModel:()=>hM,DepthProForDepthEstimation:()=>MM,DepthProPreTrainedModel:()=>wM,DetrForObjectDetection:()=>Nw,DetrForSegmentation:()=>Du,DetrModel:()=>jw,DetrObjectDetectionOutput:()=>Lu,DetrPreTrainedModel:()=>qi,DetrSegmentationOutput:()=>Vw,Dinov2ForImageClassification:()=>DM,Dinov2Model:()=>OM,Dinov2PreTrainedModel:()=>Qu,Dinov2WithRegistersForImageClassification:()=>zM,Dinov2WithRegistersModel:()=>LM,Dinov2WithRegistersPreTrainedModel:()=>Ju,DistilBertForMaskedLM:()=>ks,DistilBertForQuestionAnswering:()=>$s,DistilBertForSequenceClassification:()=>cn,DistilBertForTokenClassification:()=>xr,DistilBertModel:()=>vr,DistilBertPreTrainedModel:()=>Hr,DonutSwinModel:()=>$M,DonutSwinPreTrainedModel:()=>SM,EfficientNetForImageClassification:()=>Wb,EfficientNetModel:()=>Ub,EfficientNetPreTrainedModel:()=>ad,ElectraForMaskedLM:()=>Ss,ElectraForQuestionAnswering:()=>us,ElectraForSequenceClassification:()=>Ns,ElectraForTokenClassification:()=>at,ElectraModel:()=>js,ElectraPreTrainedModel:()=>Ir,EsmForMaskedLM:()=>pn,EsmForSequenceClassification:()=>Fr,EsmForTokenClassification:()=>hn,EsmModel:()=>Vs,EsmPreTrainedModel:()=>fr,ExaoneForCausalLM:()=>L,ExaoneModel:()=>I,ExaonePreTrainedModel:()=>x,FalconForCausalLM:()=>Ob,FalconModel:()=>Fb,FalconPreTrainedModel:()=>nd,FastViTForImageClassification:()=>Cw,FastViTModel:()=>Pw,FastViTPreTrainedModel:()=>$u,Florence2ForConditionalGeneration:()=>Io,Florence2PreTrainedModel:()=>Li,GLPNForDepthEstimation:()=>CM,GLPNModel:()=>PM,GLPNPreTrainedModel:()=>Hu,GPT2LMHeadModel:()=>Ro,GPT2Model:()=>Ki,GPT2PreTrainedModel:()=>Qn,GPTBigCodeForCausalLM:()=>Go,GPTBigCodeModel:()=>Zn,GPTBigCodePreTrainedModel:()=>Yn,GPTJForCausalLM:()=>Wo,GPTJModel:()=>Uo,GPTJPreTrainedModel:()=>Sn,GPTNeoForCausalLM:()=>Vo,GPTNeoModel:()=>No,GPTNeoPreTrainedModel:()=>jo,GPTNeoXForCausalLM:()=>Cn,GPTNeoXModel:()=>Nr,GPTNeoXPreTrainedModel:()=>Xs,Gemma2ForCausalLM:()=>Hg,Gemma2Model:()=>Kg,Gemma2PreTrainedModel:()=>fu,Gemma3ForCausalLM:()=>Xg,Gemma3Model:()=>qg,Gemma3PreTrainedModel:()=>gu,GemmaForCausalLM:()=>Gg,GemmaModel:()=>Wg,GemmaPreTrainedModel:()=>_u,GlmForCausalLM:()=>h,GlmModel:()=>Qo,GlmPreTrainedModel:()=>so,GraniteForCausalLM:()=>Hi,GraniteModel:()=>Os,GranitePreTrainedModel:()=>sr,GroundingDinoForObjectDetection:()=>RM,GroundingDinoPreTrainedModel:()=>BM,GroupViTModel:()=>Ew,GroupViTPreTrainedModel:()=>Tw,HeliumForCausalLM:()=>Xo,HeliumModel:()=>qo,HeliumPreTrainedModel:()=>ro,HieraForImageClassification:()=>sM,HieraModel:()=>rM,HieraPreTrainedModel:()=>Vu,HubertForCTC:()=>_b,HubertForSequenceClassification:()=>fb,HubertModel:()=>mb,HubertPreTrainedModel:()=>kx,IJepaForImageClassification:()=>_w,IJepaModel:()=>mw,IJepaPreTrainedModel:()=>Pu,Idefics3ForConditionalGeneration:()=>Ks,Idefics3PreTrainedModel:()=>Ri,ImageMattingOutput:()=>A0,JAISLMHeadModel:()=>nt,JAISModel:()=>Pn,JAISPreTrainedModel:()=>Jn,JinaCLIPModel:()=>qn,JinaCLIPPreTrainedModel:()=>qs,JinaCLIPTextModel:()=>Do,JinaCLIPVisionModel:()=>Lo,LiteWhisperForConditionalGeneration:()=>Fi,LlamaForCausalLM:()=>Ho,LlamaModel:()=>to,LlamaPreTrainedModel:()=>kn,LlavaForConditionalGeneration:()=>Tn,LlavaOnevisionForConditionalGeneration:()=>ko,LlavaPreTrainedModel:()=>Di,LongT5ForConditionalGeneration:()=>He,LongT5Model:()=>je,LongT5PreTrainedModel:()=>ve,M2M100ForConditionalGeneration:()=>XM,M2M100Model:()=>qM,M2M100PreTrainedModel:()=>ed,MBartForCausalLM:()=>Nt,MBartForConditionalGeneration:()=>cr,MBartForSequenceClassification:()=>pr,MBartModel:()=>br,MBartPreTrainedModel:()=>Ht,MPNetForMaskedLM:()=>_n,MPNetForQuestionAnswering:()=>wn,MPNetForSequenceClassification:()=>fn,MPNetForTokenClassification:()=>gn,MPNetModel:()=>mn,MPNetPreTrainedModel:()=>Br,MT5ForConditionalGeneration:()=>dt,MT5Model:()=>Je,MT5PreTrainedModel:()=>We,MarianMTModel:()=>HM,MarianModel:()=>KM,MarianPreTrainedModel:()=>Zu,MaskFormerForInstanceSegmentation:()=>EM,MaskFormerModel:()=>TM,MaskFormerPreTrainedModel:()=>Ku,MaskedLMOutput:()=>Mr,Metric3DForDepthEstimation:()=>yM,Metric3DPreTrainedModel:()=>bM,Metric3Dv2ForDepthEstimation:()=>xM,Metric3Dv2PreTrainedModel:()=>vM,MgpstrForSceneTextRecognition:()=>uy,MgpstrModelOutput:()=>ay,MgpstrPreTrainedModel:()=>ly,MimiDecoderModel:()=>by,MimiDecoderOutput:()=>gy,MimiEncoderModel:()=>My,MimiEncoderOutput:()=>fy,MimiModel:()=>wy,MimiPreTrainedModel:()=>aa,MistralForCausalLM:()=>kb,MistralModel:()=>$b,MistralPreTrainedModel:()=>rd,MobileBertForMaskedLM:()=>Is,MobileBertForQuestionAnswering:()=>gr,MobileBertForSequenceClassification:()=>dr,MobileBertModel:()=>Tr,MobileBertPreTrainedModel:()=>qr,MobileLLMForCausalLM:()=>Te,MobileLLMModel:()=>ue,MobileLLMPreTrainedModel:()=>U,MobileNetV1ForImageClassification:()=>Kb,MobileNetV1ForSemanticSegmentation:()=>Hb,MobileNetV1Model:()=>Gb,MobileNetV1PreTrainedModel:()=>sa,MobileNetV2ForImageClassification:()=>Xb,MobileNetV2ForSemanticSegmentation:()=>Qb,MobileNetV2Model:()=>qb,MobileNetV2PreTrainedModel:()=>na,MobileNetV3ForImageClassification:()=>Yb,MobileNetV3ForSemanticSegmentation:()=>Zb,MobileNetV3Model:()=>Jb,MobileNetV3PreTrainedModel:()=>oa,MobileNetV4ForImageClassification:()=>ty,MobileNetV4ForSemanticSegmentation:()=>ry,MobileNetV4Model:()=>ey,MobileNetV4PreTrainedModel:()=>ia,MobileViTForImageClassification:()=>Iw,MobileViTModel:()=>kw,MobileViTPreTrainedModel:()=>ku,MobileViTV2ForImageClassification:()=>Fw,MobileViTV2Model:()=>Aw,MobileViTV2PreTrainedModel:()=>Iu,ModelOutput:()=>pe,ModernBertForMaskedLM:()=>z,ModernBertForSequenceClassification:()=>J,ModernBertForTokenClassification:()=>le,ModernBertModel:()=>Y,ModernBertPreTrainedModel:()=>O,Moondream1ForConditionalGeneration:()=>Gs,MoonshineForConditionalGeneration:()=>So,MoonshineModel:()=>Oi,MoonshinePreTrainedModel:()=>Kn,MptForCausalLM:()=>uw,MptModel:()=>lw,MptPreTrainedModel:()=>xu,MultiModalityCausalLM:()=>iy,MultiModalityPreTrainedModel:()=>oy,MusicgenForCausalLM:()=>Ox,MusicgenForConditionalGeneration:()=>ud,MusicgenModel:()=>Fx,MusicgenPreTrainedModel:()=>ld,NomicBertModel:()=>Ee,NomicBertPreTrainedModel:()=>ye,OPTForCausalLM:()=>cw,OPTModel:()=>dw,OPTPreTrainedModel:()=>Tu,Olmo2ForCausalLM:()=>It,Olmo2Model:()=>Tt,Olmo2PreTrainedModel:()=>ht,OlmoForCausalLM:()=>Ze,OlmoModel:()=>Ke,OlmoPreTrainedModel:()=>Oe,OpenELMForCausalLM:()=>Jg,OpenELMModel:()=>Qg,OpenELMPreTrainedModel:()=>wu,OwlViTForObjectDetection:()=>Dw,OwlViTModel:()=>Ow,OwlViTPreTrainedModel:()=>Au,Owlv2ForObjectDetection:()=>zw,Owlv2Model:()=>Lw,Owlv2PreTrainedModel:()=>Fu,PaliGemmaForConditionalGeneration:()=>Bi,PaliGemmaPreTrainedModel:()=>zi,PatchTSMixerForPrediction:()=>hy,PatchTSMixerModel:()=>py,PatchTSMixerPreTrainedModel:()=>cd,PatchTSTForPrediction:()=>cy,PatchTSTModel:()=>dy,PatchTSTPreTrainedModel:()=>dd,Phi3ForCausalLM:()=>ow,Phi3Model:()=>nw,Phi3PreTrainedModel:()=>yu,Phi3VForCausalLM:()=>Ao,Phi3VPreTrainedModel:()=>ji,PhiForCausalLM:()=>sw,PhiModel:()=>rw,PhiPreTrainedModel:()=>bu,PreTrainedModel:()=>R,PretrainedMixin:()=>Ct,PvtForImageClassification:()=>Mw,PvtModel:()=>ww,PvtPreTrainedModel:()=>Cu,PyAnnoteForAudioFrameClassification:()=>tb,PyAnnoteModel:()=>eb,PyAnnotePreTrainedModel:()=>td,QuestionAnsweringModelOutput:()=>Er,Qwen2ForCausalLM:()=>Zg,Qwen2Model:()=>Yg,Qwen2PreTrainedModel:()=>Mu,Qwen2VLForConditionalGeneration:()=>tw,Qwen2VLPreTrainedModel:()=>ew,RFDetrForObjectDetection:()=>Xw,RFDetrModel:()=>qw,RFDetrObjectDetectionOutput:()=>Qw,RFDetrPreTrainedModel:()=>Ru,RTDetrForObjectDetection:()=>Ww,RTDetrModel:()=>Uw,RTDetrObjectDetectionOutput:()=>Xi,RTDetrPreTrainedModel:()=>zu,RTDetrV2ForObjectDetection:()=>Kw,RTDetrV2Model:()=>Gw,RTDetrV2ObjectDetectionOutput:()=>Hw,RTDetrV2PreTrainedModel:()=>Bu,ResNetForImageClassification:()=>oM,ResNetModel:()=>nM,ResNetPreTrainedModel:()=>Uu,RoFormerForMaskedLM:()=>Re,RoFormerForQuestionAnswering:()=>lt,RoFormerForSequenceClassification:()=>Xe,RoFormerForTokenClassification:()=>Ge,RoFormerModel:()=>Ie,RoFormerPreTrainedModel:()=>ke,RobertaForMaskedLM:()=>or,RobertaForQuestionAnswering:()=>er,RobertaForSequenceClassification:()=>Vt,RobertaForTokenClassification:()=>Zt,RobertaModel:()=>jr,RobertaPreTrainedModel:()=>Yt,SamImageSegmentationOutput:()=>GM,SamModel:()=>WM,SamPreTrainedModel:()=>UM,SapiensForDepthEstimation:()=>fM,SapiensForNormalEstimation:()=>gM,SapiensForSemanticSegmentation:()=>_M,SapiensPreTrainedModel:()=>Ji,SegformerForImageClassification:()=>Rb,SegformerForSemanticSegmentation:()=>jb,SegformerModel:()=>Ax,SegformerPreTrainedModel:()=>ra,Seq2SeqLMOutput:()=>Ux,SequenceClassifierOutput:()=>_t,SiglipModel:()=>En,SiglipPreTrainedModel:()=>Fo,SiglipTextModel:()=>Hs,SiglipVisionModel:()=>Oo,SmolVLMForConditionalGeneration:()=>Hn,SnacDecoderModel:()=>Sy,SnacEncoderModel:()=>Cy,SnacModel:()=>Py,SnacPreTrainedModel:()=>ua,SpeechT5ForSpeechToText:()=>Tb,SpeechT5ForTextToSpeech:()=>Eb,SpeechT5HifiGan:()=>Pb,SpeechT5Model:()=>Ix,SpeechT5PreTrainedModel:()=>ea,SqueezeBertForMaskedLM:()=>Us,SqueezeBertForQuestionAnswering:()=>yn,SqueezeBertForSequenceClassification:()=>bn,SqueezeBertModel:()=>Mn,SqueezeBertPreTrainedModel:()=>vs,StableLmForCausalLM:()=>Vb,StableLmModel:()=>Nb,StableLmPreTrainedModel:()=>id,Starcoder2ForCausalLM:()=>Ab,Starcoder2Model:()=>Ib,Starcoder2PreTrainedModel:()=>sd,StyleTextToSpeech2Model:()=>xb,StyleTextToSpeech2PreTrainedModel:()=>vb,Swin2SRForImageSuperResolution:()=>dM,Swin2SRModel:()=>uM,Swin2SRPreTrainedModel:()=>Wu,SwinForImageClassification:()=>aM,SwinForSemanticSegmentation:()=>lM,SwinModel:()=>iM,SwinPreTrainedModel:()=>Qi,T5ForConditionalGeneration:()=>de,T5Model:()=>ie,T5PreTrainedModel:()=>Q,TableTransformerForObjectDetection:()=>Yw,TableTransformerModel:()=>Jw,TableTransformerObjectDetectionOutput:()=>Zw,TableTransformerPreTrainedModel:()=>ju,TokenClassifierOutput:()=>hr,TrOCRForCausalLM:()=>Sb,TrOCRPreTrainedModel:()=>Cb,UltravoxModel:()=>_y,UltravoxPreTrainedModel:()=>my,UniSpeechForCTC:()=>ob,UniSpeechForSequenceClassification:()=>ib,UniSpeechModel:()=>nb,UniSpeechPreTrainedModel:()=>Yi,UniSpeechSatForAudioFrameClassification:()=>db,UniSpeechSatForCTC:()=>lb,UniSpeechSatForSequenceClassification:()=>ub,UniSpeechSatModel:()=>ab,UniSpeechSatPreTrainedModel:()=>Jo,ViTForImageClassification:()=>hw,ViTMAEModel:()=>yw,ViTMAEPreTrainedModel:()=>bw,ViTMSNForImageClassification:()=>xw,ViTMSNModel:()=>vw,ViTMSNPreTrainedModel:()=>Su,ViTModel:()=>pw,ViTPreTrainedModel:()=>Eu,VisionEncoderDecoderModel:()=>$o,VitMatteForImageMatting:()=>$w,VitMattePreTrainedModel:()=>Sw,VitPoseForPoseEstimation:()=>gw,VitPosePreTrainedModel:()=>fw,VitsModel:()=>od,VitsModelOutput:()=>F0,VitsPreTrainedModel:()=>Bb,Wav2Vec2BertForCTC:()=>pb,Wav2Vec2BertForSequenceClassification:()=>hb,Wav2Vec2BertModel:()=>cb,Wav2Vec2BertPreTrainedModel:()=>Zi,Wav2Vec2ForAudioFrameClassification:()=>ZM,Wav2Vec2ForCTC:()=>JM,Wav2Vec2ForSequenceClassification:()=>YM,Wav2Vec2Model:()=>QM,Wav2Vec2PreTrainedModel:()=>Qs,WavLMForAudioFrameClassification:()=>yb,WavLMForCTC:()=>wb,WavLMForSequenceClassification:()=>Mb,WavLMForXVector:()=>bb,WavLMModel:()=>gb,WavLMPreTrainedModel:()=>no,WeSpeakerResNetModel:()=>sb,WeSpeakerResNetPreTrainedModel:()=>rb,WhisperForConditionalGeneration:()=>Co,WhisperModel:()=>Ai,WhisperPreTrainedModel:()=>Po,XLMForQuestionAnswering:()=>Ti,XLMForSequenceClassification:()=>vi,XLMForTokenClassification:()=>xi,XLMModel:()=>Ws,XLMPreTrainedModel:()=>tr,XLMRobertaForMaskedLM:()=>Pi,XLMRobertaForQuestionAnswering:()=>$i,XLMRobertaForSequenceClassification:()=>Ci,XLMRobertaForTokenClassification:()=>Si,XLMRobertaModel:()=>Ei,XLMRobertaPreTrainedModel:()=>As,XLMWithLMHeadModel:()=>xn,XVectorOutput:()=>I0,YolosForObjectDetection:()=>NM,YolosModel:()=>jM,YolosObjectDetectionOutput:()=>VM,YolosPreTrainedModel:()=>Yu});var s=t("./src/configs.js"),o=t("./src/backends/onnx.js"),n=t("./src/utils/dtypes.js"),i=t("./src/utils/generic.js"),a=t("./src/utils/core.js"),l=t("./src/utils/hub.js"),u=t("./src/utils/constants.js"),p=t("./src/generation/logits_process.js"),d=t("./src/generation/configuration_utils.js"),c=t("./src/utils/tensor.js"),f=t("./src/utils/image.js"),_=t("./src/utils/maths.js"),T=t("./src/generation/stopping_criteria.js"),k=t("./src/generation/logits_sampler.js"),w=t("./src/env.js"),g=t("./src/models/whisper/generation_whisper.js"),S=t("./src/models/whisper/common_whisper.js");const E={EncoderOnly:0,EncoderDecoder:1,Seq2Seq:2,Vision2Seq:3,DecoderOnly:4,MaskGeneration:5,ImageTextToText:6,Musicgen:7,MultiModality:8,Phi3V:9,AudioTextToText:10,AutoEncoder:11},y=new Map,M=new Map,v=new Map;async function C(b,P,D){var mr;let ne=((mr=D.config)==null?void 0:mr["transformers.js_config"])??{},ge=D.device??ne.device;ge&&typeof ge!="string"&&(ge.hasOwnProperty(P)?ge=ge[P]:(console.warn(`device not specified for "${P}". Using the default device.`),ge=null));const fe=ge??(w.apis.IS_NODE_ENV?"cpu":"wasm"),Ce=(0,o.deviceToExecutionProviders)(fe),Le=ne.device_config??{};Le.hasOwnProperty(fe)&&(ne={...ne,...Le[fe]});let Ne=D.dtype??ne.dtype;if(typeof Ne!="string"&&(Ne&&Ne.hasOwnProperty(P)?Ne=Ne[P]:(Ne=n.DEFAULT_DEVICE_DTYPE_MAPPING[fe]??n.DATA_TYPES.fp32,console.warn(`dtype not specified for "${P}". Using the default dtype (${Ne}) for this device (${fe}).`))),Ne===n.DATA_TYPES.auto){let bt=ne.dtype;typeof bt!="string"&&(bt=bt==null?void 0:bt[P]),bt&&bt!==n.DATA_TYPES.auto&&n.DATA_TYPES.hasOwnProperty(bt)?Ne=bt:Ne=n.DEFAULT_DEVICE_DTYPE_MAPPING[fe]??n.DATA_TYPES.fp32}const qe=Ne;if(n.DEFAULT_DTYPE_SUFFIX_MAPPING.hasOwnProperty(qe)){if(qe===n.DATA_TYPES.fp16&&fe==="webgpu"&&!await(0,n.isWebGpuFp16Supported)())throw new Error(`The device (${fe}) does not support fp16.`)}else throw new Error(`Invalid dtype: ${qe}. Should be one of: ${Object.keys(n.DATA_TYPES).join(", ")}`);const it=ne.kv_cache_dtype,pt=it?typeof it=="string"?it:it[qe]??"float32":void 0;if(pt&&!["float32","float16"].includes(pt))throw new Error(`Invalid kv_cache_dtype: ${pt}. Should be one of: float32, float16`);const ot={dtype:qe,kv_cache_dtype:pt},Mt=n.DEFAULT_DTYPE_SUFFIX_MAPPING[qe],ct=`${P}${Mt}.onnx`,gt=`${D.subfolder??""}/${ct}`,rt={...D.session_options};rt.executionProviders??(rt.executionProviders=Ce);const yt=ne.free_dimension_overrides;yt?rt.freeDimensionOverrides??(rt.freeDimensionOverrides=yt):fe.startsWith("webnn")&&!rt.freeDimensionOverrides&&console.warn(`WebNN does not currently support dynamic shapes and requires 'free_dimension_overrides' to be set in config.json, preferably as a field within config["transformers.js_config"]["device_config"]["${fe}"]. When 'free_dimension_overrides' is not set, you may experience significant performance degradation.`);const Lt=w.apis.IS_NODE_ENV&&w.env.useFSCache,Ut=(0,l.getModelFile)(b,gt,!0,D,Lt),Jt=D.use_external_data_format??ne.use_external_data_format;let qt=[];if(Jt){let bt;typeof Jt=="object"?Jt.hasOwnProperty(ct)?bt=Jt[ct]:Jt.hasOwnProperty(P)?bt=Jt[P]:bt=!1:bt=Jt;const ir=+bt;if(ir>l.MAX_EXTERNAL_DATA_CHUNKS)throw new Error(`The number of external data chunks (${ir}) exceeds the maximum allowed value (${l.MAX_EXTERNAL_DATA_CHUNKS}).`);for(let Vr=0;Vr{const Fn=await(0,l.getModelFile)(b,$r,!0,D,Lt);Jr(Fn instanceof Uint8Array?{path:An,data:Fn}:An)}))}}else rt.externalData!==void 0&&(qt=rt.externalData.map(async bt=>{if(typeof bt.data=="string"){const ir=await(0,l.getModelFile)(b,bt.data,!0,D);return{...bt,data:ir}}return bt}));if(qt.length>0){const bt=await Promise.all(qt);w.apis.IS_NODE_ENV||(rt.externalData=bt)}if(fe==="webgpu"){const bt=(0,s.getKeyValueShapes)(D.config,{prefix:"present"});if(Object.keys(bt).length>0&&!(0,o.isONNXProxy)()){const ir={};for(const Vr in bt)ir[Vr]="gpu-buffer";rt.preferredOutputLocation=ir}}return{buffer_or_path:await Ut,session_options:rt,session_config:ot}}async function A(b,P,D){return Object.fromEntries(await Promise.all(Object.keys(P).map(async ne=>{const{buffer_or_path:ge,session_options:fe,session_config:Ce}=await C(b,P[ne],D),Le=await(0,o.createInferenceSession)(ge,fe,Ce);return[ne,Le]})))}async function B(b,P,D){return Object.fromEntries(await Promise.all(Object.keys(P).map(async ne=>{const ge=await(0,l.getModelJSON)(b,P[ne],!1,D);return[ne,ge]})))}function K(b,P){const D=Object.create(null),ne=[];for(const Ce of b.inputNames){const Le=P[Ce];if(!(Le instanceof c.Tensor)){ne.push(Ce);continue}D[Ce]=(0,o.isONNXProxy)()?Le.clone():Le}if(ne.length>0)throw new Error(`An error occurred during model execution: "Missing the following inputs: ${ne.join(", ")}.`);const ge=Object.keys(P).length,fe=b.inputNames.length;if(ge>fe){let Ce=Object.keys(P).filter(Le=>!b.inputNames.includes(Le));console.warn(`WARNING: Too many inputs were provided (${ge} > ${fe}). The following inputs will be ignored: "${Ce.join(", ")}".`)}return D}async function G(b,P){const D=K(b,P);try{const ne=Object.fromEntries(Object.entries(D).map(([fe,Ce])=>[fe,Ce.ort_tensor]));let ge=await b.run(ne);return ge=j(ge),ge}catch(ne){const ge=Object.fromEntries(Object.entries(D).map(([fe,{type:Ce,dims:Le,data:Ne}])=>[fe,{type:Ce,dims:Le,data:Ne}]));throw console.error(`An error occurred during model execution: "${ne}".`),console.error("Inputs given to model:",ge),ne}}function j(b){for(let P in b)(0,o.isONNXTensor)(b[P])?b[P]=new c.Tensor(b[P]):typeof b[P]=="object"&&j(b[P]);return b}function ee(b){if(b instanceof c.Tensor)return b;if(b.length===0)throw Error("items must be non-empty");if(Array.isArray(b[0])){if(b.some(P=>P.length!==b[0].length))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=True' and/or 'truncation=True' to have batched tensors with the same length.");return new c.Tensor("int64",BigInt64Array.from(b.flat().map(P=>BigInt(P))),[b.length,b[0].length])}else return new c.Tensor("int64",BigInt64Array.from(b.map(P=>BigInt(P))),[1,b.length])}function H(b){return new c.Tensor("bool",[b],[1])}async function Z(b,P){let{encoder_outputs:D,input_ids:ne,decoder_input_ids:ge,...fe}=P;if(!D){const Le=(0,a.pick)(P,b.sessions.model.inputNames);D=(await X(b,Le)).last_hidden_state}return fe.input_ids=ge,fe.encoder_hidden_states=D,b.sessions.decoder_model_merged.inputNames.includes("encoder_attention_mask")&&(fe.encoder_attention_mask=P.attention_mask),await me(b,fe,!0)}async function X(b,P){const D=b.sessions.model,ne=(0,a.pick)(P,D.inputNames);if(D.inputNames.includes("inputs_embeds")&&!ne.inputs_embeds){if(!P.input_ids)throw new Error("Both `input_ids` and `inputs_embeds` are missing in the model inputs.");ne.inputs_embeds=await b.encode_text({input_ids:P.input_ids})}if(D.inputNames.includes("token_type_ids")&&!ne.token_type_ids){if(!ne.input_ids)throw new Error("Both `input_ids` and `token_type_ids` are missing in the model inputs.");ne.token_type_ids=(0,c.zeros_like)(ne.input_ids)}if(D.inputNames.includes("pixel_mask")&&!ne.pixel_mask){if(!ne.pixel_values)throw new Error("Both `pixel_values` and `pixel_mask` are missing in the model inputs.");const ge=ne.pixel_values.dims;ne.pixel_mask=(0,c.ones)([ge[0],ge[2],ge[3]])}return await G(D,ne)}async function oe(b,P){const D=await b.encode(P);return await b.decode(D)}async function me(b,P,D=!1){const ne=b.sessions[D?"decoder_model_merged":"model"],{past_key_values:ge,...fe}=P;if(ne.inputNames.includes("use_cache_branch")&&(fe.use_cache_branch=H(!!ge)),ne.inputNames.includes("position_ids")&&fe.attention_mask&&!fe.position_ids){const Le=["paligemma","gemma3_text","gemma3"].includes(b.config.model_type)?1:0;fe.position_ids=ce(fe,ge,Le)}b.addPastKeyValues(fe,ge);const Ce=(0,a.pick)(fe,ne.inputNames);return await G(ne,Ce)}function ae({modality_token_id:b,inputs_embeds:P,modality_features:D,input_ids:ne,attention_mask:ge}){const fe=ne.tolist().map(qe=>qe.reduce((it,pt,ot)=>(pt==b&&it.push(ot),it),[])),Ce=fe.reduce((qe,it)=>qe+it.length,0),Le=D.dims[0];if(Ce!==Le)throw new Error(`Number of tokens and features do not match: tokens: ${Ce}, features ${Le}`);let Ne=0;for(let qe=0;qefe.dims[1])){if(geLe==b.config.image_token_index)){const Le=b.config.num_image_tokens;if(!Le)throw new Error("`num_image_tokens` is missing in the model configuration.");const Ne=fe.dims[1]-(ge-Le);D.input_ids=fe.slice(null,[-Ne,null]),D.attention_mask=(0,c.ones)([1,ge+Ne])}}}return D}function Ue(b,P,D,ne){return D.past_key_values&&(P=P.map(ge=>[ge.at(-1)])),{...D,decoder_input_ids:ee(P)}}function we(b,...P){return b.config.is_encoder_decoder?Ue(b,...P):$e(b,...P)}function q(b,P,D,ne){const ge=!!D.past_key_values;return ne.guidance_scale!==null&&ne.guidance_scale>1&&(ge?D.input_ids=(0,c.cat)([D.input_ids,D.input_ids],0):(D.input_ids=(0,c.cat)([D.input_ids,(0,c.full_like)(D.input_ids,BigInt(ne.pad_token_id))],0),D.attention_mask=(0,c.cat)([D.attention_mask,(0,c.full_like)(D.attention_mask,0n)],0))),(ge||!D.pixel_values)&&(D.pixel_values=(0,c.full)([0,0,3,384,384],1)),ge&&(D.images_seq_mask=new c.Tensor("bool",new Array(1).fill(!0).fill(!1,0,1),[1,1]),D.images_emb_mask=new c.Tensor("bool",new Array(0).fill(!1),[1,1,0])),D}class R extends i.Callable{constructor(D,ne,ge){super();te(this,"main_input_name","input_ids");te(this,"forward_params",["input_ids","attention_mask"]);this.config=D,this.sessions=ne,this.configs=ge;const fe=v.get(this.constructor),Ce=y.get(fe);switch(this.can_generate=!1,this._forward=null,this._prepare_inputs_for_generation=null,Ce){case E.DecoderOnly:this.can_generate=!0,this._forward=me,this._prepare_inputs_for_generation=$e;break;case E.Seq2Seq:case E.Vision2Seq:case E.Musicgen:this.can_generate=!0,this._forward=Z,this._prepare_inputs_for_generation=Ue;break;case E.EncoderDecoder:this._forward=Z;break;case E.ImageTextToText:this.can_generate=!0,this._forward=_e,this._prepare_inputs_for_generation=we;break;case E.AudioTextToText:this.can_generate=!0,this._forward=re,this._prepare_inputs_for_generation=we;break;case E.Phi3V:this.can_generate=!0,this._prepare_inputs_for_generation=we;break;case E.MultiModality:this.can_generate=!0,this._prepare_inputs_for_generation=q;break;case E.AutoEncoder:this._forward=oe;break;default:this._forward=X;break}this.can_generate&&this.forward_params.push("past_key_values"),this.custom_config=this.config["transformers.js_config"]??{}}async dispose(){var ne;const D=[];for(const ge of Object.values(this.sessions))(ne=ge==null?void 0:ge.handler)!=null&&ne.dispose&&D.push(ge.handler.dispose());return await Promise.all(D)}static async from_pretrained(D,{progress_callback:ne=null,config:ge=null,cache_dir:fe=null,local_files_only:Ce=!1,revision:Le="main",model_file_name:Ne=null,subfolder:qe="onnx",device:it=null,dtype:pt=null,use_external_data_format:ot=null,session_options:Mt={}}={}){let ct={progress_callback:ne,config:ge,cache_dir:fe,local_files_only:Ce,revision:Le,model_file_name:Ne,subfolder:qe,device:it,dtype:pt,use_external_data_format:ot,session_options:Mt};const gt=v.get(this),rt=y.get(gt);ge=ct.config=await s.AutoConfig.from_pretrained(D,ct);let yt;if(rt===E.DecoderOnly)yt=await Promise.all([A(D,{model:ct.model_file_name??"model"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(rt===E.Seq2Seq||rt===E.Vision2Seq)yt=await Promise.all([A(D,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(rt===E.MaskGeneration)yt=await Promise.all([A(D,{model:"vision_encoder",prompt_encoder_mask_decoder:"prompt_encoder_mask_decoder"},ct)]);else if(rt===E.EncoderDecoder)yt=await Promise.all([A(D,{model:"encoder_model",decoder_model_merged:"decoder_model_merged"},ct)]);else if(rt===E.ImageTextToText){const Lt={embed_tokens:"embed_tokens",vision_encoder:"vision_encoder",decoder_model_merged:"decoder_model_merged"};ge.is_encoder_decoder&&(Lt.model="encoder_model"),yt=await Promise.all([A(D,Lt,ct),B(D,{generation_config:"generation_config.json"},ct)])}else if(rt===E.AudioTextToText){const Lt={embed_tokens:"embed_tokens",audio_encoder:"audio_encoder",decoder_model_merged:"decoder_model_merged"};yt=await Promise.all([A(D,Lt,ct),B(D,{generation_config:"generation_config.json"},ct)])}else if(rt===E.Musicgen)yt=await Promise.all([A(D,{model:"text_encoder",decoder_model_merged:"decoder_model_merged",encodec_decode:"encodec_decode"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(rt===E.MultiModality)yt=await Promise.all([A(D,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"language_model",lm_head:"lm_head",gen_head:"gen_head",gen_img_embeds:"gen_img_embeds",image_decode:"image_decode"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(rt===E.Phi3V)yt=await Promise.all([A(D,{prepare_inputs_embeds:"prepare_inputs_embeds",model:"model",vision_encoder:"vision_encoder"},ct),B(D,{generation_config:"generation_config.json"},ct)]);else if(rt===E.AutoEncoder)yt=await Promise.all([A(D,{encoder_model:"encoder_model",decoder_model:"decoder_model"},ct)]);else{if(rt!==E.EncoderOnly){const Lt=gt??(ge==null?void 0:ge.model_type);Lt!=="custom"&&console.warn(`Model type for '${Lt}' not found, assuming encoder-only architecture. Please report this at ${u.GITHUB_ISSUE_URL}.`)}yt=await Promise.all([A(D,{model:ct.model_file_name??"model"},ct)])}return new this(ge,...yt)}async _call(D){return await this.forward(D)}async forward(D){return await this._forward(this,D)}get generation_config(){var D;return((D=this.configs)==null?void 0:D.generation_config)??null}_get_logits_warper(D){const ne=new p.LogitsProcessorList;return D.temperature!==null&&D.temperature!==1&&ne.push(new p.TemperatureLogitsWarper(D.temperature)),D.top_k!==null&&D.top_k!==0&&ne.push(new p.TopKLogitsWarper(D.top_k)),D.top_p!==null&&D.top_p<1&&ne.push(new p.TopPLogitsWarper(D.top_p)),ne}_get_logits_processor(D,ne,ge=null){const fe=new p.LogitsProcessorList;if(D.repetition_penalty!==null&&D.repetition_penalty!==1&&fe.push(new p.RepetitionPenaltyLogitsProcessor(D.repetition_penalty)),D.no_repeat_ngram_size!==null&&D.no_repeat_ngram_size>0&&fe.push(new p.NoRepeatNGramLogitsProcessor(D.no_repeat_ngram_size)),D.bad_words_ids!==null&&fe.push(new p.NoBadWordsLogitsProcessor(D.bad_words_ids,D.eos_token_id)),D.min_length!==null&&D.eos_token_id!==null&&D.min_length>0&&fe.push(new p.MinLengthLogitsProcessor(D.min_length,D.eos_token_id)),D.min_new_tokens!==null&&D.eos_token_id!==null&&D.min_new_tokens>0&&fe.push(new p.MinNewTokensLengthLogitsProcessor(ne,D.min_new_tokens,D.eos_token_id)),D.forced_bos_token_id!==null&&fe.push(new p.ForcedBOSTokenLogitsProcessor(D.forced_bos_token_id)),D.forced_eos_token_id!==null&&fe.push(new p.ForcedEOSTokenLogitsProcessor(D.max_length,D.forced_eos_token_id)),D.begin_suppress_tokens!==null){const Ce=ne>1||D.forced_bos_token_id===null?ne:ne+1;fe.push(new p.SuppressTokensAtBeginLogitsProcessor(D.begin_suppress_tokens,Ce))}return D.guidance_scale!==null&&D.guidance_scale>1&&fe.push(new p.ClassifierFreeGuidanceLogitsProcessor(D.guidance_scale)),ge!==null&&fe.extend(ge),fe}_prepare_generation_config(D,ne,ge=d.GenerationConfig){const fe={...this.config};for(const Le of["decoder","generator","text_config"])Le in fe&&Object.assign(fe,fe[Le]);const Ce=new ge(fe);return Object.assign(Ce,this.generation_config??{}),D&&Object.assign(Ce,D),ne&&Object.assign(Ce,(0,a.pick)(ne,Object.getOwnPropertyNames(Ce))),Ce}_get_stopping_criteria(D,ne=null){const ge=new T.StoppingCriteriaList;return D.max_length!==null&&ge.push(new T.MaxLengthCriteria(D.max_length,this.config.max_position_embeddings??null)),D.eos_token_id!==null&&ge.push(new T.EosTokenCriteria(D.eos_token_id)),ne&&ge.extend(ne),ge}_validate_model_class(){if(!this.can_generate){const D=[md,_d,hd,pd],ne=v.get(this.constructor),ge=new Set,fe=this.config.model_type;for(const Le of D){const Ne=Le.get(fe);Ne&&ge.add(Ne[0])}let Ce=`The current model class (${ne}) is not compatible with \`.generate()\`, as it doesn't have a language model head.`;throw ge.size>0&&(Ce+=` Please use the following class instead: ${[...ge].join(", ")}`),Error(Ce)}}prepare_inputs_for_generation(...D){return this._prepare_inputs_for_generation(this,...D)}_update_model_kwargs_for_generation({generated_input_ids:D,outputs:ne,model_inputs:ge,is_encoder_decoder:fe}){return ge.past_key_values=this.getPastKeyValues(ne,ge.past_key_values),ge.input_ids=new c.Tensor("int64",D.flat(),[D.length,1]),fe||(ge.attention_mask=(0,c.cat)([ge.attention_mask,(0,c.ones)([ge.attention_mask.dims[0],1])],1)),ge.position_ids=null,ge}_prepare_model_inputs({inputs:D,bos_token_id:ne,model_kwargs:ge}){const fe=(0,a.pick)(ge,this.forward_params),Ce=this.main_input_name;if(Ce in fe){if(D)throw new Error("`inputs`: {inputs}` were passed alongside {input_name} which is not allowed. Make sure to either pass {inputs} or {input_name}=...")}else fe[Ce]=D;return{inputs_tensor:fe[Ce],model_inputs:fe,model_input_name:Ce}}async _prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:D,model_inputs:ne,model_input_name:ge,generation_config:fe}){if(this.sessions.model.inputNames.includes("inputs_embeds")&&!ne.inputs_embeds&&"_prepare_inputs_embeds"in this){const{input_ids:Le,pixel_values:Ne,attention_mask:qe,...it}=ne,pt=await this._prepare_inputs_embeds(ne);ne={...it,...(0,a.pick)(pt,["inputs_embeds","attention_mask"])}}let{last_hidden_state:Ce}=await X(this,ne);if(fe.guidance_scale!==null&&fe.guidance_scale>1)Ce=(0,c.cat)([Ce,(0,c.full_like)(Ce,0)],0),"attention_mask"in ne&&(ne.attention_mask=(0,c.cat)([ne.attention_mask,(0,c.zeros_like)(ne.attention_mask)],0));else if(ne.decoder_input_ids){const Le=ee(ne.decoder_input_ids).dims[0];if(Le!==Ce.dims[0]){if(Ce.dims[0]!==1)throw new Error(`The encoder outputs have a different batch size (${Ce.dims[0]}) than the decoder inputs (${Le}).`);Ce=(0,c.cat)(Array.from({length:Le},()=>Ce),0)}}return ne.encoder_outputs=Ce,ne}_prepare_decoder_input_ids_for_generation({batch_size:D,model_input_name:ne,model_kwargs:ge,decoder_start_token_id:fe,bos_token_id:Ce,generation_config:Le}){let{decoder_input_ids:Ne,...qe}=ge;if(!(Ne instanceof c.Tensor)){if(Ne)Array.isArray(Ne[0])||(Ne=Array.from({length:D},()=>Ne));else if(fe??(fe=Ce),this.config.model_type==="musicgen")Ne=Array.from({length:D*this.config.decoder.num_codebooks},()=>[fe]);else if(Array.isArray(fe)){if(fe.length!==D)throw new Error(`\`decoder_start_token_id\` expcted to have length ${D} but got ${fe.length}`);Ne=fe}else Ne=Array.from({length:D},()=>[fe]);Ne=ee(Ne)}return ge.decoder_attention_mask=(0,c.ones_like)(Ne),{input_ids:Ne,model_inputs:qe}}async generate({inputs:D=null,generation_config:ne=null,logits_processor:ge=null,stopping_criteria:fe=null,streamer:Ce=null,...Le}){this._validate_model_class(),ne=this._prepare_generation_config(ne,Le);let{inputs_tensor:Ne,model_inputs:qe,model_input_name:it}=this._prepare_model_inputs({inputs:D,model_kwargs:Le});const pt=this.config.is_encoder_decoder;pt&&("encoder_outputs"in qe||(qe=await this._prepare_encoder_decoder_kwargs_for_generation({inputs_tensor:Ne,model_inputs:qe,model_input_name:it,generation_config:ne})));let ot;pt?{input_ids:ot,model_inputs:qe}=this._prepare_decoder_input_ids_for_generation({batch_size:qe[it].dims.at(0),model_input_name:it,model_kwargs:qe,decoder_start_token_id:ne.decoder_start_token_id,bos_token_id:ne.bos_token_id,generation_config:ne}):ot=qe[it];let Mt=ot.dims.at(-1);ne.max_new_tokens!==null&&(ne.max_length=Mt+ne.max_new_tokens);const ct=this._get_logits_processor(ne,Mt,ge),gt=this._get_stopping_criteria(ne,fe),rt=qe[it].dims.at(0),yt=k.LogitsSampler.getSampler(ne),Lt=new Array(rt).fill(0),Ut=ot.tolist();Ce&&Ce.put(Ut);let Jt,qt={};for(;;){if(qe=this.prepare_inputs_for_generation(Ut,qe,ne),Jt=await this.forward(qe),ne.output_attentions&&ne.return_dict_in_generate){const $r=this.getAttentions(Jt);for(const Jr in $r)Jr in qt||(qt[Jr]=[]),qt[Jr].push($r[Jr])}const bt=Jt.logits.slice(null,-1,null),ir=ct(Ut,bt),Vr=[];for(let $r=0;$r$r))break;qe=this._update_model_kwargs_for_generation({generated_input_ids:Vr,outputs:Jt,model_inputs:qe,is_encoder_decoder:pt})}Ce&&Ce.end();const nr=this.getPastKeyValues(Jt,qe.past_key_values,!0),mr=new c.Tensor("int64",Ut.flat(),[Ut.length,Ut[0].length]);if(ne.return_dict_in_generate)return{sequences:mr,past_key_values:nr,...qt};for(const bt of Object.values(Jt))bt.location==="gpu-buffer"&&bt.dispose();return mr}getPastKeyValues(D,ne,ge=!1){const fe=Object.create(null);for(const Ce in D)if(Ce.startsWith("present")){const Le=Ce.replace("present","past_key_values"),Ne=Ce.includes("encoder");if(Ne&&ne?fe[Le]=ne[Le]:fe[Le]=D[Ce],ne&&(!Ne||ge)){const qe=ne[Le];qe.location==="gpu-buffer"&&qe.dispose()}}return fe}getAttentions(D){const ne={};for(const ge of["cross_attentions","encoder_attentions","decoder_attentions"])for(const fe in D)fe.startsWith(ge)&&(ge in ne||(ne[ge]=[]),ne[ge].push(D[fe]));return ne}addPastKeyValues(D,ne){var ge,fe,Ce;if(ne)Object.assign(D,ne);else{const Le=this.sessions.decoder_model_merged??this.sessions.model,Ne=((ge=Le==null?void 0:Le.config)==null?void 0:ge.kv_cache_dtype)??"float32",qe=Ne==="float16"?new c.DataTypeMap.float16:[],it=((Ce=(fe=D[this.main_input_name]??D.attention_mask)==null?void 0:fe.dims)==null?void 0:Ce[0])??1,pt=(0,s.getKeyValueShapes)(this.config,{batch_size:it});for(const ot in pt)D[ot]=new c.Tensor(Ne,qe,pt[ot])}}async encode_image({pixel_values:D}){const ne=(await G(this.sessions.vision_encoder,{pixel_values:D})).image_features;return this.config.num_image_tokens||(console.warn(`The number of image tokens was not set in the model configuration. Setting it to the number of features detected by the vision encoder (${ne.dims[1]}).`),this.config.num_image_tokens=ne.dims[1]),ne}async encode_text({input_ids:D}){return(await G(this.sessions.embed_tokens,{input_ids:D})).inputs_embeds}async encode_audio({audio_values:D}){return(await G(this.sessions.audio_encoder,{audio_values:D})).audio_features}}class pe{}class xe extends pe{constructor({last_hidden_state:P,hidden_states:D=null,attentions:ne=null}){super(),this.last_hidden_state=P,this.hidden_states=D,this.attentions=ne}}class be extends R{}class Se extends be{}class Ae extends be{async _call(P){return new Mr(await super._call(P))}}class Fe extends be{async _call(P){return new _t(await super._call(P))}}class ze extends be{async _call(P){return new hr(await super._call(P))}}class Ve extends be{async _call(P){return new Er(await super._call(P))}}class O extends R{}class Y extends O{}class z extends O{async _call(P){return new Mr(await super._call(P))}}class J extends O{async _call(P){return new _t(await super._call(P))}}class le extends O{async _call(P){return new hr(await super._call(P))}}class ye extends R{}class Ee extends ye{}class ke extends R{}class Ie extends ke{}class Re extends ke{async _call(P){return new Mr(await super._call(P))}}class Xe extends ke{async _call(P){return new _t(await super._call(P))}}class Ge extends ke{async _call(P){return new hr(await super._call(P))}}class lt extends ke{async _call(P){return new Er(await super._call(P))}}class wt extends R{}class Gt extends wt{}class Ot extends wt{async _call(P){return new Mr(await super._call(P))}}class ur extends wt{async _call(P){return new _t(await super._call(P))}}class ls extends wt{async _call(P){return new hr(await super._call(P))}}class Ms extends wt{async _call(P){return new Er(await super._call(P))}}class Ir extends R{}class js extends Ir{}class Ss extends Ir{async _call(P){return new Mr(await super._call(P))}}class Ns extends Ir{async _call(P){return new _t(await super._call(P))}}class at extends Ir{async _call(P){return new hr(await super._call(P))}}class us extends Ir{async _call(P){return new Er(await super._call(P))}}class Ar extends R{}class bs extends Ar{}class Ft extends Ar{async _call(P){return new Mr(await super._call(P))}}class ds extends Ar{async _call(P){return new _t(await super._call(P))}}class cs extends Ar{async _call(P){return new hr(await super._call(P))}}class ys extends Ar{async _call(P){return new Er(await super._call(P))}}class Qt extends R{}class De extends Qt{}class Qe extends Qt{async _call(P){return new Mr(await super._call(P))}}class tt extends Qt{async _call(P){return new _t(await super._call(P))}}class Rt extends Qt{async _call(P){return new hr(await super._call(P))}}class zr extends Qt{async _call(P){return new Er(await super._call(P))}}class Sr extends R{}class ps extends Sr{}class hs extends Sr{async _call(P){return new Mr(await super._call(P))}}class Kr extends Sr{async _call(P){return new _t(await super._call(P))}}class ms extends Sr{async _call(P){return new hr(await super._call(P))}}class _s extends Sr{async _call(P){return new Er(await super._call(P))}}class Hr extends R{}class vr extends Hr{}class cn extends Hr{async _call(P){return new _t(await super._call(P))}}class xr extends Hr{async _call(P){return new hr(await super._call(P))}}class $s extends Hr{async _call(P){return new Er(await super._call(P))}}class ks extends Hr{async _call(P){return new Mr(await super._call(P))}}class fr extends R{}class Vs extends fr{}class pn extends fr{async _call(P){return new Mr(await super._call(P))}}class Fr extends fr{async _call(P){return new _t(await super._call(P))}}class hn extends fr{async _call(P){return new hr(await super._call(P))}}class qr extends R{}class Tr extends qr{}class Is extends qr{async _call(P){return new Mr(await super._call(P))}}class dr extends qr{async _call(P){return new _t(await super._call(P))}}class gr extends qr{async _call(P){return new Er(await super._call(P))}}class Br extends R{}class mn extends Br{}class _n extends Br{async _call(P){return new Mr(await super._call(P))}}class fn extends Br{async _call(P){return new _t(await super._call(P))}}class gn extends Br{async _call(P){return new hr(await super._call(P))}}class wn extends Br{async _call(P){return new Er(await super._call(P))}}class vs extends R{}class Mn extends vs{}class Us extends vs{async _call(P){return new Mr(await super._call(P))}}class bn extends vs{async _call(P){return new _t(await super._call(P))}}class yn extends vs{async _call(P){return new Er(await super._call(P))}}class xs extends R{}class vn extends xs{}class he extends xs{async _call(P){return new _t(await super._call(P))}}class $ extends xs{async _call(P){return new Er(await super._call(P))}}class N extends xs{async _call(P){return new Mr(await super._call(P))}}class Q extends R{constructor(){super(...arguments);te(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}}class ie extends Q{}class de extends Q{}class ve extends R{}class je extends ve{}class He extends ve{}class We extends R{}class Je extends We{}class dt extends We{}class xt extends R{}class Pt extends xt{}class jt extends xt{}class kt extends xt{async _call(P){return new _t(await super._call(P))}}class Ht extends R{}class br extends Ht{}class cr extends Ht{}class pr extends Ht{async _call(P){return new _t(await super._call(P))}}class Nt extends Ht{}class Xr extends R{}class Dt extends Xr{}class rr extends Xr{}class wr extends R{}class Qr extends wr{}class Rr extends wr{}class Yt extends R{}class jr extends Yt{}class or extends Yt{async _call(P){return new Mr(await super._call(P))}}class Vt extends Yt{async _call(P){return new _t(await super._call(P))}}class Zt extends Yt{async _call(P){return new hr(await super._call(P))}}class er extends Yt{async _call(P){return new Er(await super._call(P))}}class tr extends R{}class Ws extends tr{}class xn extends tr{async _call(P){return new Mr(await super._call(P))}}class vi extends tr{async _call(P){return new _t(await super._call(P))}}class xi extends tr{async _call(P){return new hr(await super._call(P))}}class Ti extends tr{async _call(P){return new Er(await super._call(P))}}class As extends R{}class Ei extends As{}class Pi extends As{async _call(P){return new Mr(await super._call(P))}}class Ci extends As{async _call(P){return new _t(await super._call(P))}}class Si extends As{async _call(P){return new hr(await super._call(P))}}class $i extends As{async _call(P){return new Er(await super._call(P))}}class Eo extends R{}class ki extends Eo{}class Ii extends Eo{}class Po extends R{constructor(){super(...arguments);te(this,"requires_attention_mask",!1);te(this,"main_input_name","input_features");te(this,"forward_params",["input_features","attention_mask","decoder_input_ids","decoder_attention_mask","past_key_values"])}}class Ai extends Po{}class Co extends Po{_prepare_generation_config(P,D){return super._prepare_generation_config(P,D,g.WhisperGenerationConfig)}_retrieve_init_tokens(P){const D=[P.decoder_start_token_id];let ne=P.language;const ge=P.task;if(P.is_multilingual){ne||(console.warn("No language specified - defaulting to English (en)."),ne="en");const Ce=`<|${(0,S.whisper_language_to_code)(ne)}|>`;D.push(P.lang_to_id[Ce]),D.push(P.task_to_id[ge??"transcribe"])}else if(ne||ge)throw new Error("Cannot specify `task` or `language` for an English-only model. If the model is intended to be multilingual, pass `is_multilingual=true` to generate, or update the generation config.");return!P.return_timestamps&&P.no_timestamps_token_id&&D.at(-1)!==P.no_timestamps_token_id?D.push(P.no_timestamps_token_id):P.return_timestamps&&D.at(-1)===P.no_timestamps_token_id&&(console.warn("<|notimestamps|> prompt token is removed from generation_config since `return_timestamps` is set to `true`."),D.pop()),D.filter(fe=>fe!=null)}async generate({inputs:P=null,generation_config:D=null,logits_processor:ne=null,stopping_criteria:ge=null,...fe}){D=this._prepare_generation_config(D,fe);const Ce=fe.decoder_input_ids??this._retrieve_init_tokens(D);if(D.return_timestamps&&(ne??(ne=new p.LogitsProcessorList),ne.push(new p.WhisperTimeStampLogitsProcessor(D,Ce))),D.begin_suppress_tokens&&(ne??(ne=new p.LogitsProcessorList),ne.push(new p.SuppressTokensAtBeginLogitsProcessor(D.begin_suppress_tokens,Ce.length))),D.return_token_timestamps){if(!D.alignment_heads)throw new Error("Model generation config has no `alignment_heads`, token-level timestamps not available. See https://gist.github.com/hollance/42e32852f24243b748ae6bc1f985b13a on how to add this property to the generation config.");D.task==="translate"&&console.warn("Token-level timestamps may not be reliable for task 'translate'."),D.output_attentions=!0,D.return_dict_in_generate=!0}const Le=await super.generate({inputs:P,generation_config:D,logits_processor:ne,decoder_input_ids:Ce,...fe});return D.return_token_timestamps&&(Le.token_timestamps=this._extract_token_timestamps(Le,D.alignment_heads,D.num_frames)),Le}_extract_token_timestamps(P,D,ne=null,ge=.02){if(!P.cross_attentions)throw new Error("Model outputs must contain cross attentions to extract timestamps. This is most likely because the model was not exported with `output_attentions=True`.");ne==null&&console.warn("`num_frames` has not been set, meaning the entire audio will be analyzed. This may lead to inaccurate token-level timestamps for short audios (< 30 seconds).");let fe=this.config.median_filter_width;fe===void 0&&(console.warn("Model config has no `median_filter_width`, using default value of 7."),fe=7);const Ce=P.cross_attentions,Le=Array.from({length:this.config.decoder_layers},(gt,rt)=>(0,c.cat)(Ce.map(yt=>yt[rt]),2)),Ne=(0,c.stack)(D.map(([gt,rt])=>{if(gt>=Le.length)throw new Error(`Layer index ${gt} is out of bounds for cross attentions (length ${Le.length}).`);return ne?Le[gt].slice(null,rt,null,[0,ne]):Le[gt].slice(null,rt)})).transpose(1,0,2,3),[qe,it]=(0,c.std_mean)(Ne,-2,0,!0),pt=Ne.clone();for(let gt=0;gtyt[mr+1]-yt[mr]),Jt=(0,a.mergeArrays)([1],Ut).map(nr=>!!nr),qt=[];for(let nr=0;nrot.findIndex(Mt=>Mt==fe)),Ne=Le.every(ot=>ot===-1),qe=Le.every(ot=>ot!==-1);if(!Ne&&!qe)throw new Error("Every input should contain either 0 or 1 image token.");if(Ne)return{inputs_embeds:P,attention_mask:ge};const it=[],pt=[];for(let ot=0;otArray.from({length:P.dims[0]},Ut=>Array.from({length:P.dims[1]},Jt=>1))),ct=D?D.tolist():[],gt=ne?ne.tolist():[];let rt=0,yt=0;for(let Lt=0;Ltot[Lt][ar]==1),qt=Ut.reduce((Wt,ar,Js)=>(ar==Ne&&Wt.push(Js),Wt),[]).map(Wt=>Ut[Wt+1]),nr=qt.filter(Wt=>Wt==Ce).length,mr=qt.filter(Wt=>Wt==Le).length;let bt=[],ir=0,Vr=nr,An=mr;for(let Wt=0;Wtfs>ir&&Dn==Ce),Js=Ut.findIndex((Dn,fs)=>fs>ir&&Dn==Le),On=Vr>0&&ar!==-1?ar:Ut.length+1,io=An>0&&Js!==-1?Js:Ut.length+1;let ha,gd,wd,Md;On0?(0,_.max)(bt.at(-1))[0]+1:0;bt.push(Array.from({length:3*yd},(Dn,fs)=>O0+fs%yd));const vd=yd+O0,_a=Gx*bd*ma,Kx=Array.from({length:_a},(Dn,fs)=>vd+Math.floor(fs/(bd*ma))),Hx=Array.from({length:_a},(Dn,fs)=>vd+Math.floor(fs/ma)%bd),qx=Array.from({length:_a},(Dn,fs)=>vd+fs%ma);bt.push([Kx,Hx,qx].flat()),ir=ha+_a}if(ir0?(0,_.max)(bt.at(-1))[0]+1:0,ar=Ut.length-ir;bt.push(Array.from({length:3*ar},(Js,On)=>Wt+On%ar))}const $r=bt.reduce((Wt,ar)=>Wt+ar.length,0),Jr=new Array($r);let da=0;for(let Wt=0;Wt<3;++Wt)for(let ar=0;arpt[rt%pt.length]),ct=Array.from({length:ot[0]},(gt,rt)=>(0,_.max)(pt.subarray(ot[1]*rt,ot[1]*(rt+1)))[0]+1n+BigInt(ot[1]));return[new c.Tensor("int64",Mt,[3,...ot]),new c.Tensor("int64",ct,[ct.length,1])]}else{const[pt,ot]=P.dims,Mt=BigInt64Array.from({length:3*pt*ot},(ct,gt)=>BigInt(Math.floor(gt%ot/pt)));return[new c.Tensor("int64",Mt,[3,...P.dims]),(0,c.zeros)([pt,1])]}}async encode_image({pixel_values:P,image_grid_thw:D}){return(await G(this.sessions.vision_encoder,{pixel_values:P,grid_thw:D})).image_features}_merge_input_ids_with_image_features(P){return V({image_token_id:this.config.image_token_id,...P})}prepare_inputs_for_generation(P,D,ne){if(D.attention_mask&&!D.position_ids)if(!D.past_key_values)[D.position_ids,D.rope_deltas]=this.get_rope_index(D.input_ids,D.image_grid_thw,D.video_grid_thw,D.attention_mask);else{D.pixel_values=null;const ge=BigInt(Object.values(D.past_key_values)[0].dims.at(-2)),fe=D.rope_deltas.map(Ce=>ge+Ce);D.position_ids=(0,c.stack)([fe,fe,fe],0)}return D}}class bu extends R{}class rw extends bu{}class sw extends bu{}class yu extends R{}class nw extends yu{}class ow extends yu{}class vu extends R{}class iw extends vu{}class aw extends vu{}class xu extends R{}class lw extends xu{}class uw extends xu{}class Tu extends R{}class dw extends Tu{}class cw extends Tu{}class Eu extends R{}class pw extends Eu{}class hw extends Eu{async _call(P){return new _t(await super._call(P))}}class Pu extends R{}class mw extends Pu{}class _w extends Pu{async _call(P){return new _t(await super._call(P))}}class fw extends R{}class gw extends fw{}class Cu extends R{}class ww extends Cu{}class Mw extends Cu{async _call(P){return new _t(await super._call(P))}}class bw extends R{}class yw extends bw{}class Su extends R{}class vw extends Su{}class xw extends Su{async _call(P){return new _t(await super._call(P))}}class Tw extends R{}class Ew extends Tw{}class $u extends R{}class Pw extends $u{}class Cw extends $u{async _call(P){return new _t(await super._call(P))}}class Sw extends R{}class $w extends Sw{async _call(P){return new A0(await super._call(P))}}class ku extends R{}class kw extends ku{}class Iw extends ku{async _call(P){return new _t(await super._call(P))}}class Iu extends R{}class Aw extends Iu{}class Fw extends Iu{async _call(P){return new _t(await super._call(P))}}class Au extends R{}class Ow extends Au{}class Dw extends Au{}class Fu extends R{}class Lw extends Fu{}class zw extends Fu{}class Ou extends R{}class Bw extends Ou{}class Rw extends Ou{async _call(P){return new _t(await super._call(P))}}class qi extends R{}class jw extends qi{}class Nw extends qi{async _call(P){return new Lu(await super._call(P))}}class Du extends qi{async _call(P){return new Vw(await super._call(P))}}class Lu extends pe{constructor({logits:P,pred_boxes:D}){super(),this.logits=P,this.pred_boxes=D}}class Vw extends pe{constructor({logits:P,pred_boxes:D,pred_masks:ne}){super(),this.logits=P,this.pred_boxes=D,this.pred_masks=ne}}class zu extends R{}class Uw extends zu{}class Ww extends zu{async _call(P){return new Xi(await super._call(P))}}class Xi extends pe{constructor({logits:P,pred_boxes:D}){super(),this.logits=P,this.pred_boxes=D}}class Bu extends R{}class Gw extends Bu{}class Kw extends Bu{async _call(P){return new Hw(await super._call(P))}}class Hw extends Xi{}class Ru extends R{}class qw extends Ru{}class Xw extends Ru{async _call(P){return new Qw(await super._call(P))}}class Qw extends Xi{}class ju extends R{}class Jw extends ju{}class Yw extends ju{async _call(P){return new Zw(await super._call(P))}}class Zw extends Lu{}class Nu extends R{}class eM extends Nu{}class tM extends Nu{async _call(P){return new _t(await super._call(P))}}class Vu extends R{}class rM extends Vu{}class sM extends Vu{async _call(P){return new _t(await super._call(P))}}class Uu extends R{}class nM extends Uu{}class oM extends Uu{async _call(P){return new _t(await super._call(P))}}class Qi extends R{}class iM extends Qi{}class aM extends Qi{async _call(P){return new _t(await super._call(P))}}class lM extends Qi{}class Wu extends R{}class uM extends Wu{}class dM extends Wu{}class Gu extends R{}class cM extends Gu{}class pM extends Gu{}class hM extends R{}class mM extends hM{}class Ji extends R{}class _M extends Ji{}class fM extends Ji{}class gM extends Ji{}class wM extends R{}class MM extends wM{}class bM extends R{}class yM extends bM{}class vM extends R{}class xM extends vM{}class Ku extends R{}class TM extends Ku{}class EM extends Ku{}class Hu extends R{}class PM extends Hu{}class CM extends Hu{}class SM extends R{}class $M extends SM{}class qu extends R{}class kM extends qu{}class IM extends qu{async _call(P){return new _t(await super._call(P))}}class Xu extends R{}class AM extends Xu{}class FM extends Xu{async _call(P){return new _t(await super._call(P))}}class Qu extends R{}class OM extends Qu{}class DM extends Qu{async _call(P){return new _t(await super._call(P))}}class Ju extends R{}class LM extends Ju{}class zM extends Ju{async _call(P){return new _t(await super._call(P))}}class BM extends R{}class RM extends BM{}class Yu extends R{}class jM extends Yu{}class NM extends Yu{async _call(P){return new VM(await super._call(P))}}class VM extends pe{constructor({logits:P,pred_boxes:D}){super(),this.logits=P,this.pred_boxes=D}}class UM extends R{}class WM extends UM{async get_image_embeddings({pixel_values:P}){return await X(this,{pixel_values:P})}async forward(P){if((!P.image_embeddings||!P.image_positional_embeddings)&&(P={...P,...await this.get_image_embeddings(P)}),!P.input_labels&&P.input_points){const ne=P.input_points.dims.slice(0,-1),ge=ne.reduce((fe,Ce)=>fe*Ce,1);P.input_labels=new c.Tensor("int64",new BigInt64Array(ge).fill(1n),ne)}const D={image_embeddings:P.image_embeddings,image_positional_embeddings:P.image_positional_embeddings};return P.input_points&&(D.input_points=P.input_points),P.input_labels&&(D.input_labels=P.input_labels),P.input_boxes&&(D.input_boxes=P.input_boxes),await G(this.sessions.prompt_encoder_mask_decoder,D)}async _call(P){return new GM(await super._call(P))}}class GM extends pe{constructor({iou_scores:P,pred_masks:D}){super(),this.iou_scores=P,this.pred_masks=D}}class Zu extends R{}class KM extends Zu{}class HM extends Zu{}class ed extends R{}class qM extends ed{}class XM extends ed{}class Qs extends R{}class QM extends Qs{}class JM extends Qs{async _call(P){return new In(await super._call(P))}}class YM extends Qs{async _call(P){return new _t(await super._call(P))}}class ZM extends Qs{async _call(P){return new hr(await super._call(P))}}class td extends R{}class eb extends td{}class tb extends td{async _call(P){return new hr(await super._call(P))}}class rb extends R{}class sb extends rb{}class Yi extends R{}class nb extends Yi{}class ob extends Yi{async _call(P){return new In(await super._call(P))}}class ib extends Yi{async _call(P){return new _t(await super._call(P))}}class Jo extends R{}class ab extends Jo{}class lb extends Jo{async _call(P){return new In(await super._call(P))}}class ub extends Jo{async _call(P){return new _t(await super._call(P))}}class db extends Jo{async _call(P){return new hr(await super._call(P))}}class Zi extends R{}class cb extends Zi{}class pb extends Zi{async _call(P){return new In(await super._call(P))}}class hb extends Zi{async _call(P){return new _t(await super._call(P))}}class kx extends R{}class mb extends Qs{}class _b extends Qs{async _call(P){return new In(await super._call(P))}}class fb extends Qs{async _call(P){return new _t(await super._call(P))}}class no extends R{}class gb extends no{}class wb extends no{async _call(P){return new In(await super._call(P))}}class Mb extends no{async _call(P){return new _t(await super._call(P))}}class bb extends no{async _call(P){return new I0(await super._call(P))}}class yb extends no{async _call(P){return new hr(await super._call(P))}}class vb extends R{}class xb extends vb{}class ea extends R{}class Ix extends ea{}class Tb extends ea{}class Eb extends ea{async generate_speech(P,D,{threshold:ne=.5,minlenratio:ge=0,maxlenratio:fe=20,vocoder:Ce=null}={}){const Le={input_ids:P},{encoder_outputs:Ne,encoder_attention_mask:qe}=await X(this,Le),it=Ne.dims[1]/this.config.reduction_factor,pt=Math.floor(it*fe),ot=Math.floor(it*ge),Mt=this.config.num_mel_bins;let ct=[],gt=null,rt=null,yt=0;for(;;){++yt;const Jt=H(!!rt);let qt;rt?qt=rt.output_sequence_out:qt=new c.Tensor("float32",new Float32Array(Mt),[1,1,Mt]);let nr={use_cache_branch:Jt,output_sequence:qt,encoder_attention_mask:qe,speaker_embeddings:D,encoder_hidden_states:Ne};this.addPastKeyValues(nr,gt),rt=await G(this.sessions.decoder_model_merged,nr),gt=this.getPastKeyValues(rt,gt);const{prob:mr,spectrum:bt}=rt;if(ct.push(bt),yt>=ot&&(Array.from(mr.data).filter(ir=>ir>=ne).length>0||yt>=pt))break}const Lt=(0,c.cat)(ct),{waveform:Ut}=await G(Ce.sessions.model,{spectrogram:Lt});return{spectrogram:Lt,waveform:Ut}}}class Pb extends R{constructor(){super(...arguments);te(this,"main_input_name","spectrogram")}}class Cb extends R{}class Sb extends Cb{}class rd extends R{}class $b extends rd{}class kb extends rd{}class sd extends R{}class Ib extends sd{}class Ab extends sd{}class nd extends R{}class Fb extends nd{}class Ob extends nd{}class ta extends R{}class Db extends ta{}class Lb extends ta{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"text_model"})}}class zb extends ta{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"audio_model"})}}class Bb extends R{}class od extends Bb{async _call(P){return new F0(await super._call(P))}}class ra extends R{}class Ax extends ra{}class Rb extends ra{}class jb extends ra{}class id extends R{}class Nb extends id{}class Vb extends id{}class ad extends R{}class Ub extends ad{}class Wb extends ad{async _call(P){return new _t(await super._call(P))}}class ld extends R{}class Fx extends ld{}class Ox extends ld{}class ud extends R{constructor(){super(...arguments);te(this,"forward_params",["input_ids","attention_mask","encoder_outputs","decoder_input_ids","decoder_attention_mask","past_key_values"])}_apply_and_filter_by_delay_pattern_mask(D){const[ne,ge]=D.dims,fe=this.config.decoder.num_codebooks,Ce=ge-fe;let Le=0;for(let it=0;it0&&Mt<=Ce&&(D.data[Le++]=D.data[it])}const Ne=Math.floor(ne/fe),qe=Le/(Ne*fe);return new c.Tensor(D.type,D.data.slice(0,Le),[Ne,fe,qe])}prepare_inputs_for_generation(D,ne,ge){let fe=structuredClone(D);for(let Le=0;Le=Ne&&(fe[Le][Ne]=BigInt(this.config.decoder.pad_token_id));return ge.guidance_scale!==null&&ge.guidance_scale>1&&(fe=fe.concat(fe)),super.prepare_inputs_for_generation(fe,ne,ge)}async generate(D){const ne=await super.generate(D),ge=this._apply_and_filter_by_delay_pattern_mask(ne).unsqueeze_(0),{audio_values:fe}=await G(this.sessions.encodec_decode,{audio_codes:ge});return fe}}class sa extends R{}class Gb extends sa{}class Kb extends sa{async _call(P){return new _t(await super._call(P))}}class Hb extends sa{}class na extends R{}class qb extends na{}class Xb extends na{async _call(P){return new _t(await super._call(P))}}class Qb extends na{}class oa extends R{}class Jb extends oa{}class Yb extends oa{async _call(P){return new _t(await super._call(P))}}class Zb extends oa{}class ia extends R{}class ey extends ia{}class ty extends ia{async _call(P){return new _t(await super._call(P))}}class ry extends ia{}class sy extends R{}class ny extends sy{}class oy extends R{}class iy extends oy{constructor(...D){super(...D);te(this,"forward_params",["input_ids","pixel_values","images_seq_mask","images_emb_mask","attention_mask","position_ids","past_key_values"]);this._generation_mode="text"}async forward(D){const ne=this._generation_mode??"text";let ge;if(ne==="text"||!D.past_key_values){const qe=this.sessions.prepare_inputs_embeds,it=(0,a.pick)(D,qe.inputNames);ge=await G(qe,it)}else{const qe=this.sessions.gen_img_embeds,it=(0,a.pick)({image_ids:D.input_ids},qe.inputNames);ge=await G(qe,it)}const fe={...D,...ge},Ce=await me(this,fe),Le=this.sessions[ne==="text"?"lm_head":"gen_head"];if(!Le)throw new Error(`Unable to find "${Le}" generation head`);const Ne=await G(Le,(0,a.pick)(Ce,Le.inputNames));return{...ge,...Ce,...Ne}}async generate(D){return this._generation_mode="text",super.generate(D)}async generate_images(D){this._generation_mode="image";const ne=(D.inputs??D[this.main_input_name]).dims[1],fe=(await super.generate(D)).slice(null,[ne,null]),Ce=this.sessions.image_decode,{decoded_image:Le}=await G(Ce,{generated_tokens:fe}),Ne=Le.add_(1).mul_(255/2).clamp_(0,255).to("uint8"),qe=[];for(const it of Ne){const pt=f.RawImage.fromTensor(it);qe.push(pt)}return qe}}class ay extends pe{constructor({char_logits:P,bpe_logits:D,wp_logits:ne}){super(),this.char_logits=P,this.bpe_logits=D,this.wp_logits=ne}get logits(){return[this.char_logits,this.bpe_logits,this.wp_logits]}}class ly extends R{}class uy extends ly{async _call(P){return new ay(await super._call(P))}}class dd extends R{}class dy extends dd{}class cy extends dd{}class cd extends R{}class py extends cd{}class hy extends cd{}class my extends R{constructor(){super(...arguments);te(this,"forward_params",["input_ids","attention_mask","position_ids","audio_values","past_key_values"])}}class _y extends my{_merge_input_ids_with_audio_features(P){const D=P.audio_features.dims.at(-1),ne=P.audio_features.view(-1,D);return F({audio_token_id:this.config.ignore_index,...P,audio_features:ne})}}class aa extends R{constructor(){super(...arguments);te(this,"main_input_name","input_values");te(this,"forward_params",["input_values"])}}class fy extends pe{constructor({audio_codes:P}){super(),this.audio_codes=P}}class gy extends pe{constructor({audio_values:P}){super(),this.audio_values=P}}class wy extends aa{async encode(P){return new fy(await G(this.sessions.encoder_model,P))}async decode(P){return new gy(await G(this.sessions.decoder_model,P))}}class My extends aa{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"encoder_model"})}}class by extends aa{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"decoder_model"})}}class la extends R{constructor(){super(...arguments);te(this,"main_input_name","input_values");te(this,"forward_params",["input_values"])}}class yy extends pe{constructor({audio_codes:P}){super(),this.audio_codes=P}}class vy extends pe{constructor({audio_values:P}){super(),this.audio_values=P}}class xy extends la{async encode(P){return new yy(await G(this.sessions.encoder_model,P))}async decode(P){return new vy(await G(this.sessions.decoder_model,P))}}class Ty extends la{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"encoder_model"})}}class Ey extends la{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"decoder_model"})}}class ua extends R{constructor(){super(...arguments);te(this,"main_input_name","input_values");te(this,"forward_params",["input_values"])}}class Py extends ua{async encode(P){return await G(this.sessions.encoder_model,P)}async decode(P){return await G(this.sessions.decoder_model,P)}}class Cy extends ua{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"encoder_model"})}}class Sy extends ua{static async from_pretrained(P,D={}){return super.from_pretrained(P,{...D,model_file_name:D.model_file_name??"decoder_model"})}}class Ct{static async from_pretrained(P,{progress_callback:D=null,config:ne=null,cache_dir:ge=null,local_files_only:fe=!1,revision:Ce="main",model_file_name:Le=null,subfolder:Ne="onnx",device:qe=null,dtype:it=null,use_external_data_format:pt=null,session_options:ot={}}={}){const Mt={progress_callback:D,config:ne,cache_dir:ge,local_files_only:fe,revision:Ce,model_file_name:Le,subfolder:Ne,device:qe,dtype:it,use_external_data_format:pt,session_options:ot};if(Mt.config=await s.AutoConfig.from_pretrained(P,Mt),!this.MODEL_CLASS_MAPPINGS)throw new Error("`MODEL_CLASS_MAPPINGS` not implemented for this type of `AutoClass`: "+this.name);const ct=Mt.config.model_type;for(const gt of this.MODEL_CLASS_MAPPINGS){let rt=gt.get(ct);if(!rt){for(const yt of gt.values())if(yt[0]===ct){rt=yt;break}if(!rt)continue}return await rt[1].from_pretrained(P,Mt)}if(this.BASE_IF_FAIL)return e0.has(ct)||console.warn(`Unknown model class "${ct}", attempting to construct from base class.`),await R.from_pretrained(P,Mt);throw Error(`Unsupported model type: ${ct}`)}}te(Ct,"MODEL_CLASS_MAPPINGS",null),te(Ct,"BASE_IF_FAIL",!1);const Dx=new Map([["bert",["BertModel",Se]],["modernbert",["ModernBertModel",Y]],["nomic_bert",["NomicBertModel",Ee]],["roformer",["RoFormerModel",Ie]],["electra",["ElectraModel",js]],["esm",["EsmModel",Vs]],["convbert",["ConvBertModel",Gt]],["camembert",["CamembertModel",bs]],["deberta",["DebertaModel",De]],["deberta-v2",["DebertaV2Model",ps]],["mpnet",["MPNetModel",mn]],["albert",["AlbertModel",vn]],["distilbert",["DistilBertModel",vr]],["roberta",["RobertaModel",jr]],["xlm",["XLMModel",Ws]],["xlm-roberta",["XLMRobertaModel",Ei]],["clap",["ClapModel",Db]],["clip",["CLIPModel",Ni]],["clipseg",["CLIPSegModel",zo]],["chinese_clip",["ChineseCLIPModel",Gi]],["siglip",["SiglipModel",En]],["jina_clip",["JinaCLIPModel",qn]],["mobilebert",["MobileBertModel",Tr]],["squeezebert",["SqueezeBertModel",Mn]],["wav2vec2",["Wav2Vec2Model",QM]],["wav2vec2-bert",["Wav2Vec2BertModel",cb]],["unispeech",["UniSpeechModel",nb]],["unispeech-sat",["UniSpeechSatModel",ab]],["hubert",["HubertModel",mb]],["wavlm",["WavLMModel",gb]],["audio-spectrogram-transformer",["ASTModel",ki]],["vits",["VitsModel",od]],["pyannote",["PyAnnoteModel",eb]],["wespeaker-resnet",["WeSpeakerResNetModel",sb]],["detr",["DetrModel",jw]],["rt_detr",["RTDetrModel",Uw]],["rt_detr_v2",["RTDetrV2Model",Gw]],["rf_detr",["RFDetrModel",qw]],["table-transformer",["TableTransformerModel",Jw]],["vit",["ViTModel",pw]],["ijepa",["IJepaModel",mw]],["pvt",["PvtModel",ww]],["vit_msn",["ViTMSNModel",vw]],["vit_mae",["ViTMAEModel",yw]],["groupvit",["GroupViTModel",Ew]],["fastvit",["FastViTModel",Pw]],["mobilevit",["MobileViTModel",kw]],["mobilevitv2",["MobileViTV2Model",Aw]],["owlvit",["OwlViTModel",Ow]],["owlv2",["Owlv2Model",Lw]],["beit",["BeitModel",Bw]],["deit",["DeiTModel",eM]],["hiera",["HieraModel",rM]],["convnext",["ConvNextModel",kM]],["convnextv2",["ConvNextV2Model",AM]],["dinov2",["Dinov2Model",OM]],["dinov2_with_registers",["Dinov2WithRegistersModel",LM]],["resnet",["ResNetModel",nM]],["swin",["SwinModel",iM]],["swin2sr",["Swin2SRModel",uM]],["donut-swin",["DonutSwinModel",$M]],["yolos",["YolosModel",jM]],["dpt",["DPTModel",cM]],["glpn",["GLPNModel",PM]],["hifigan",["SpeechT5HifiGan",Pb]],["efficientnet",["EfficientNetModel",Ub]],["decision_transformer",["DecisionTransformerModel",ny]],["patchtst",["PatchTSTForPrediction",dy]],["patchtsmixer",["PatchTSMixerForPrediction",py]],["mobilenet_v1",["MobileNetV1Model",Gb]],["mobilenet_v2",["MobileNetV2Model",qb]],["mobilenet_v3",["MobileNetV3Model",Jb]],["mobilenet_v4",["MobileNetV4Model",ey]],["maskformer",["MaskFormerModel",TM]],["mgp-str",["MgpstrForSceneTextRecognition",uy]],["style_text_to_speech_2",["StyleTextToSpeech2Model",xb]]]),Lx=new Map([["t5",["T5Model",ie]],["longt5",["LongT5Model",je]],["mt5",["MT5Model",Je]],["bart",["BartModel",Pt]],["mbart",["MBartModel",br]],["marian",["MarianModel",KM]],["whisper",["WhisperModel",Ai]],["m2m_100",["M2M100Model",qM]],["blenderbot",["BlenderbotModel",Dt]],["blenderbot-small",["BlenderbotSmallModel",Qr]]]),zx=new Map([["mimi",["MimiModel",wy]],["dac",["DacModel",xy]],["snac",["SnacModel",Py]]]),Bx=new Map([["bloom",["BloomModel",iw]],["jais",["JAISModel",Pn]],["gpt2",["GPT2Model",Ki]],["gptj",["GPTJModel",Uo]],["gpt_bigcode",["GPTBigCodeModel",Zn]],["gpt_neo",["GPTNeoModel",No]],["gpt_neox",["GPTNeoXModel",Nr]],["codegen",["CodeGenModel",Ko]],["llama",["LlamaModel",to]],["exaone",["ExaoneModel",I]],["olmo",["OlmoModel",Ke]],["olmo2",["Olmo2Model",Tt]],["mobilellm",["MobileLLMModel",ue]],["granite",["GraniteModel",Os]],["cohere",["CohereModel",Vg]],["gemma",["GemmaModel",Wg]],["gemma2",["Gemma2Model",Kg]],["gemma3_text",["Gemma3Model",qg]],["helium",["HeliumModel",qo]],["glm",["GlmModel",Qo]],["openelm",["OpenELMModel",Qg]],["qwen2",["Qwen2Model",Yg]],["phi",["PhiModel",rw]],["phi3",["Phi3Model",nw]],["mpt",["MptModel",lw]],["opt",["OPTModel",dw]],["mistral",["MistralModel",$b]],["starcoder2",["Starcoder2Model",Ib]],["falcon",["FalconModel",Fb]],["stablelm",["StableLmModel",Nb]]]),pd=new Map([["speecht5",["SpeechT5ForSpeechToText",Tb]],["whisper",["WhisperForConditionalGeneration",Co]],["lite-whisper",["LiteWhisperForConditionalGeneration",Fi]],["moonshine",["MoonshineForConditionalGeneration",So]]]),$y=new Map([["speecht5",["SpeechT5ForTextToSpeech",Eb]]]),ky=new Map([["vits",["VitsModel",od]],["musicgen",["MusicgenForConditionalGeneration",ud]]]),Iy=new Map([["bert",["BertForSequenceClassification",Fe]],["modernbert",["ModernBertForSequenceClassification",J]],["roformer",["RoFormerForSequenceClassification",Xe]],["electra",["ElectraForSequenceClassification",Ns]],["esm",["EsmForSequenceClassification",Fr]],["convbert",["ConvBertForSequenceClassification",ur]],["camembert",["CamembertForSequenceClassification",ds]],["deberta",["DebertaForSequenceClassification",tt]],["deberta-v2",["DebertaV2ForSequenceClassification",Kr]],["mpnet",["MPNetForSequenceClassification",fn]],["albert",["AlbertForSequenceClassification",he]],["distilbert",["DistilBertForSequenceClassification",cn]],["roberta",["RobertaForSequenceClassification",Vt]],["xlm",["XLMForSequenceClassification",vi]],["xlm-roberta",["XLMRobertaForSequenceClassification",Ci]],["bart",["BartForSequenceClassification",kt]],["mbart",["MBartForSequenceClassification",pr]],["mobilebert",["MobileBertForSequenceClassification",dr]],["squeezebert",["SqueezeBertForSequenceClassification",bn]]]),Ay=new Map([["bert",["BertForTokenClassification",ze]],["modernbert",["ModernBertForTokenClassification",le]],["roformer",["RoFormerForTokenClassification",Ge]],["electra",["ElectraForTokenClassification",at]],["esm",["EsmForTokenClassification",hn]],["convbert",["ConvBertForTokenClassification",ls]],["camembert",["CamembertForTokenClassification",cs]],["deberta",["DebertaForTokenClassification",Rt]],["deberta-v2",["DebertaV2ForTokenClassification",ms]],["mpnet",["MPNetForTokenClassification",gn]],["distilbert",["DistilBertForTokenClassification",xr]],["roberta",["RobertaForTokenClassification",Zt]],["xlm",["XLMForTokenClassification",xi]],["xlm-roberta",["XLMRobertaForTokenClassification",Si]]]),hd=new Map([["t5",["T5ForConditionalGeneration",de]],["longt5",["LongT5ForConditionalGeneration",He]],["mt5",["MT5ForConditionalGeneration",dt]],["bart",["BartForConditionalGeneration",jt]],["mbart",["MBartForConditionalGeneration",cr]],["marian",["MarianMTModel",HM]],["m2m_100",["M2M100ForConditionalGeneration",XM]],["blenderbot",["BlenderbotForConditionalGeneration",rr]],["blenderbot-small",["BlenderbotSmallForConditionalGeneration",Rr]]]),md=new Map([["bloom",["BloomForCausalLM",aw]],["gpt2",["GPT2LMHeadModel",Ro]],["jais",["JAISLMHeadModel",nt]],["gptj",["GPTJForCausalLM",Wo]],["gpt_bigcode",["GPTBigCodeForCausalLM",Go]],["gpt_neo",["GPTNeoForCausalLM",Vo]],["gpt_neox",["GPTNeoXForCausalLM",Cn]],["codegen",["CodeGenForCausalLM",$n]],["llama",["LlamaForCausalLM",Ho]],["exaone",["ExaoneForCausalLM",L]],["olmo",["OlmoForCausalLM",Ze]],["olmo2",["Olmo2ForCausalLM",It]],["mobilellm",["MobileLLMForCausalLM",Te]],["granite",["GraniteForCausalLM",Hi]],["cohere",["CohereForCausalLM",Ug]],["gemma",["GemmaForCausalLM",Gg]],["gemma2",["Gemma2ForCausalLM",Hg]],["gemma3_text",["Gemma3ForCausalLM",Xg]],["helium",["HeliumForCausalLM",Xo]],["glm",["GlmForCausalLM",h]],["openelm",["OpenELMForCausalLM",Jg]],["qwen2",["Qwen2ForCausalLM",Zg]],["phi",["PhiForCausalLM",sw]],["phi3",["Phi3ForCausalLM",ow]],["mpt",["MptForCausalLM",uw]],["opt",["OPTForCausalLM",cw]],["mbart",["MBartForCausalLM",Nt]],["mistral",["MistralForCausalLM",kb]],["starcoder2",["Starcoder2ForCausalLM",Ab]],["falcon",["FalconForCausalLM",Ob]],["trocr",["TrOCRForCausalLM",Sb]],["stablelm",["StableLmForCausalLM",Vb]],["phi3_v",["Phi3VForCausalLM",Ao]]]),Rx=new Map([["multi_modality",["MultiModalityCausalLM",iy]]]),Fy=new Map([["bert",["BertForMaskedLM",Ae]],["modernbert",["ModernBertForMaskedLM",z]],["roformer",["RoFormerForMaskedLM",Re]],["electra",["ElectraForMaskedLM",Ss]],["esm",["EsmForMaskedLM",pn]],["convbert",["ConvBertForMaskedLM",Ot]],["camembert",["CamembertForMaskedLM",Ft]],["deberta",["DebertaForMaskedLM",Qe]],["deberta-v2",["DebertaV2ForMaskedLM",hs]],["mpnet",["MPNetForMaskedLM",_n]],["albert",["AlbertForMaskedLM",N]],["distilbert",["DistilBertForMaskedLM",ks]],["roberta",["RobertaForMaskedLM",or]],["xlm",["XLMWithLMHeadModel",xn]],["xlm-roberta",["XLMRobertaForMaskedLM",Pi]],["mobilebert",["MobileBertForMaskedLM",Is]],["squeezebert",["SqueezeBertForMaskedLM",Us]]]),Oy=new Map([["bert",["BertForQuestionAnswering",Ve]],["roformer",["RoFormerForQuestionAnswering",lt]],["electra",["ElectraForQuestionAnswering",us]],["convbert",["ConvBertForQuestionAnswering",Ms]],["camembert",["CamembertForQuestionAnswering",ys]],["deberta",["DebertaForQuestionAnswering",zr]],["deberta-v2",["DebertaV2ForQuestionAnswering",_s]],["mpnet",["MPNetForQuestionAnswering",wn]],["albert",["AlbertForQuestionAnswering",$]],["distilbert",["DistilBertForQuestionAnswering",$s]],["roberta",["RobertaForQuestionAnswering",er]],["xlm",["XLMForQuestionAnswering",Ti]],["xlm-roberta",["XLMRobertaForQuestionAnswering",$i]],["mobilebert",["MobileBertForQuestionAnswering",gr]],["squeezebert",["SqueezeBertForQuestionAnswering",yn]]]),_d=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",$o]],["idefics3",["Idefics3ForConditionalGeneration",Ks]],["smolvlm",["SmolVLMForConditionalGeneration",Hn]]]),Dy=new Map([["llava",["LlavaForConditionalGeneration",Tn]],["llava_onevision",["LlavaOnevisionForConditionalGeneration",ko]],["moondream1",["Moondream1ForConditionalGeneration",Gs]],["florence2",["Florence2ForConditionalGeneration",Io]],["qwen2-vl",["Qwen2VLForConditionalGeneration",tw]],["idefics3",["Idefics3ForConditionalGeneration",Ks]],["smolvlm",["SmolVLMForConditionalGeneration",Hn]],["paligemma",["PaliGemmaForConditionalGeneration",Bi]]]),Ly=new Map([["ultravox",["UltravoxModel",_y]]]),jx=new Map([["vision-encoder-decoder",["VisionEncoderDecoderModel",$o]]]),zy=new Map([["vit",["ViTForImageClassification",hw]],["ijepa",["IJepaForImageClassification",_w]],["pvt",["PvtForImageClassification",Mw]],["vit_msn",["ViTMSNForImageClassification",xw]],["fastvit",["FastViTForImageClassification",Cw]],["mobilevit",["MobileViTForImageClassification",Iw]],["mobilevitv2",["MobileViTV2ForImageClassification",Fw]],["beit",["BeitForImageClassification",Rw]],["deit",["DeiTForImageClassification",tM]],["hiera",["HieraForImageClassification",sM]],["convnext",["ConvNextForImageClassification",IM]],["convnextv2",["ConvNextV2ForImageClassification",FM]],["dinov2",["Dinov2ForImageClassification",DM]],["dinov2_with_registers",["Dinov2WithRegistersForImageClassification",zM]],["resnet",["ResNetForImageClassification",oM]],["swin",["SwinForImageClassification",aM]],["segformer",["SegformerForImageClassification",Rb]],["efficientnet",["EfficientNetForImageClassification",Wb]],["mobilenet_v1",["MobileNetV1ForImageClassification",Kb]],["mobilenet_v2",["MobileNetV2ForImageClassification",Xb]],["mobilenet_v3",["MobileNetV3ForImageClassification",Yb]],["mobilenet_v4",["MobileNetV4ForImageClassification",ty]]]),By=new Map([["detr",["DetrForObjectDetection",Nw]],["rt_detr",["RTDetrForObjectDetection",Ww]],["rt_detr_v2",["RTDetrV2ForObjectDetection",Kw]],["rf_detr",["RFDetrForObjectDetection",Xw]],["table-transformer",["TableTransformerForObjectDetection",Yw]],["yolos",["YolosForObjectDetection",NM]]]),Ry=new Map([["owlvit",["OwlViTForObjectDetection",Dw]],["owlv2",["Owlv2ForObjectDetection",zw]],["grounding-dino",["GroundingDinoForObjectDetection",RM]]]),oo=new Map([["detr",["DetrForSegmentation",Du]],["clipseg",["CLIPSegForImageSegmentation",Bo]]]),jy=new Map([["segformer",["SegformerForSemanticSegmentation",jb]],["sapiens",["SapiensForSemanticSegmentation",_M]],["swin",["SwinForSemanticSegmentation",lM]],["mobilenet_v1",["MobileNetV1ForSemanticSegmentation",Hb]],["mobilenet_v2",["MobileNetV2ForSemanticSegmentation",Qb]],["mobilenet_v3",["MobileNetV3ForSemanticSegmentation",Zb]],["mobilenet_v4",["MobileNetV4ForSemanticSegmentation",ry]]]),Ny=new Map([["detr",["DetrForSegmentation",Du]],["maskformer",["MaskFormerForInstanceSegmentation",EM]]]),Vy=new Map([["sam",["SamModel",WM]]]),Uy=new Map([["wav2vec2",["Wav2Vec2ForCTC",JM]],["wav2vec2-bert",["Wav2Vec2BertForCTC",pb]],["unispeech",["UniSpeechForCTC",ob]],["unispeech-sat",["UniSpeechSatForCTC",lb]],["wavlm",["WavLMForCTC",wb]],["hubert",["HubertForCTC",_b]]]),Wy=new Map([["wav2vec2",["Wav2Vec2ForSequenceClassification",YM]],["wav2vec2-bert",["Wav2Vec2BertForSequenceClassification",hb]],["unispeech",["UniSpeechForSequenceClassification",ib]],["unispeech-sat",["UniSpeechSatForSequenceClassification",ub]],["wavlm",["WavLMForSequenceClassification",Mb]],["hubert",["HubertForSequenceClassification",fb]],["audio-spectrogram-transformer",["ASTForAudioClassification",Ii]]]),Gy=new Map([["wavlm",["WavLMForXVector",bb]]]),Ky=new Map([["unispeech-sat",["UniSpeechSatForAudioFrameClassification",db]],["wavlm",["WavLMForAudioFrameClassification",yb]],["wav2vec2",["Wav2Vec2ForAudioFrameClassification",ZM]],["pyannote",["PyAnnoteForAudioFrameClassification",tb]]]),Hy=new Map([["vitmatte",["VitMatteForImageMatting",$w]]]),Nx=new Map([["patchtst",["PatchTSTForPrediction",cy]],["patchtsmixer",["PatchTSMixerForPrediction",hy]]]),qy=new Map([["swin2sr",["Swin2SRForImageSuperResolution",dM]]]),Xy=new Map([["dpt",["DPTForDepthEstimation",pM]],["depth_anything",["DepthAnythingForDepthEstimation",mM]],["glpn",["GLPNForDepthEstimation",CM]],["sapiens",["SapiensForDepthEstimation",fM]],["depth_pro",["DepthProForDepthEstimation",MM]],["metric3d",["Metric3DForDepthEstimation",yM]],["metric3dv2",["Metric3Dv2ForDepthEstimation",xM]]]),Qy=new Map([["sapiens",["SapiensForNormalEstimation",gM]]]),Jy=new Map([["vitpose",["VitPoseForPoseEstimation",gw]]]),Yy=new Map([["clip",["CLIPVisionModelWithProjection",Ui]],["siglip",["SiglipVisionModel",Oo]],["jina_clip",["JinaCLIPVisionModel",Lo]]]),Zy=[[Dx,E.EncoderOnly],[Lx,E.EncoderDecoder],[Bx,E.DecoderOnly],[zx,E.AutoEncoder],[Iy,E.EncoderOnly],[Ay,E.EncoderOnly],[hd,E.Seq2Seq],[pd,E.Seq2Seq],[md,E.DecoderOnly],[Rx,E.MultiModality],[Fy,E.EncoderOnly],[Oy,E.EncoderOnly],[_d,E.Vision2Seq],[Dy,E.ImageTextToText],[Ly,E.AudioTextToText],[zy,E.EncoderOnly],[oo,E.EncoderOnly],[Ny,E.EncoderOnly],[jy,E.EncoderOnly],[Hy,E.EncoderOnly],[Nx,E.EncoderOnly],[qy,E.EncoderOnly],[Xy,E.EncoderOnly],[Qy,E.EncoderOnly],[Jy,E.EncoderOnly],[By,E.EncoderOnly],[Ry,E.EncoderOnly],[Vy,E.MaskGeneration],[Uy,E.EncoderOnly],[Wy,E.EncoderOnly],[$y,E.Seq2Seq],[ky,E.EncoderOnly],[Gy,E.EncoderOnly],[Ky,E.EncoderOnly],[Yy,E.EncoderOnly]];for(const[b,P]of Zy)for(const[D,ne]of b.values())y.set(D,P),v.set(ne,D),M.set(D,ne);const Vx=[["MusicgenForConditionalGeneration",ud,E.Musicgen],["Phi3VForCausalLM",Ao,E.Phi3V],["CLIPTextModelWithProjection",Vi,E.EncoderOnly],["SiglipTextModel",Hs,E.EncoderOnly],["JinaCLIPTextModel",Do,E.EncoderOnly],["ClapTextModelWithProjection",Lb,E.EncoderOnly],["ClapAudioModelWithProjection",zb,E.EncoderOnly],["DacEncoderModel",Ty,E.EncoderOnly],["DacDecoderModel",Ey,E.EncoderOnly],["MimiEncoderModel",My,E.EncoderOnly],["MimiDecoderModel",by,E.EncoderOnly],["SnacEncoderModel",Cy,E.EncoderOnly],["SnacDecoderModel",Sy,E.EncoderOnly]];for(const[b,P,D]of Vx)y.set(b,D),v.set(P,b),M.set(b,P);const e0=new Map([["modnet",oo],["birefnet",oo],["isnet",oo],["ben",oo]]);for(const[b,P]of e0.entries())P.set(b,["PreTrainedModel",R]),y.set(b,E.EncoderOnly),v.set(R,b),M.set(b,R);class fd extends Ct{}te(fd,"MODEL_CLASS_MAPPINGS",Zy.map(P=>P[0])),te(fd,"BASE_IF_FAIL",!0);class t0 extends Ct{}te(t0,"MODEL_CLASS_MAPPINGS",[Iy]);class r0 extends Ct{}te(r0,"MODEL_CLASS_MAPPINGS",[Ay]);class s0 extends Ct{}te(s0,"MODEL_CLASS_MAPPINGS",[hd]);class n0 extends Ct{}te(n0,"MODEL_CLASS_MAPPINGS",[pd]);class o0 extends Ct{}te(o0,"MODEL_CLASS_MAPPINGS",[$y]);class i0 extends Ct{}te(i0,"MODEL_CLASS_MAPPINGS",[ky]);class a0 extends Ct{}te(a0,"MODEL_CLASS_MAPPINGS",[md]);class l0 extends Ct{}te(l0,"MODEL_CLASS_MAPPINGS",[Fy]);class u0 extends Ct{}te(u0,"MODEL_CLASS_MAPPINGS",[Oy]);class d0 extends Ct{}te(d0,"MODEL_CLASS_MAPPINGS",[_d]);class c0 extends Ct{}te(c0,"MODEL_CLASS_MAPPINGS",[zy]);class p0 extends Ct{}te(p0,"MODEL_CLASS_MAPPINGS",[oo]);class h0 extends Ct{}te(h0,"MODEL_CLASS_MAPPINGS",[jy]);class m0 extends Ct{}te(m0,"MODEL_CLASS_MAPPINGS",[Ny]);class _0 extends Ct{}te(_0,"MODEL_CLASS_MAPPINGS",[By]);class f0 extends Ct{}te(f0,"MODEL_CLASS_MAPPINGS",[Ry]);class g0 extends Ct{}te(g0,"MODEL_CLASS_MAPPINGS",[Vy]);class w0 extends Ct{}te(w0,"MODEL_CLASS_MAPPINGS",[Uy]);class M0 extends Ct{}te(M0,"MODEL_CLASS_MAPPINGS",[Wy]);class b0 extends Ct{}te(b0,"MODEL_CLASS_MAPPINGS",[Gy]);class y0 extends Ct{}te(y0,"MODEL_CLASS_MAPPINGS",[Ky]);class v0 extends Ct{}te(v0,"MODEL_CLASS_MAPPINGS",[jx]);class x0 extends Ct{}te(x0,"MODEL_CLASS_MAPPINGS",[Hy]);class T0 extends Ct{}te(T0,"MODEL_CLASS_MAPPINGS",[qy]);class E0 extends Ct{}te(E0,"MODEL_CLASS_MAPPINGS",[Xy]);class P0 extends Ct{}te(P0,"MODEL_CLASS_MAPPINGS",[Qy]);class C0 extends Ct{}te(C0,"MODEL_CLASS_MAPPINGS",[Jy]);class S0 extends Ct{}te(S0,"MODEL_CLASS_MAPPINGS",[Yy]);class $0 extends Ct{}te($0,"MODEL_CLASS_MAPPINGS",[Dy]);class k0 extends Ct{}te(k0,"MODEL_CLASS_MAPPINGS",[Ly]);class Ux extends pe{constructor({logits:P,past_key_values:D,encoder_outputs:ne,decoder_attentions:ge=null,cross_attentions:fe=null}){super(),this.logits=P,this.past_key_values=D,this.encoder_outputs=ne,this.decoder_attentions=ge,this.cross_attentions=fe}}class _t extends pe{constructor({logits:P,...D}){super(),this.logits=P;const ne=Object.values(D);ne.length>0&&(this.attentions=ne)}}class I0 extends pe{constructor({logits:P,embeddings:D}){super(),this.logits=P,this.embeddings=D}}class hr extends pe{constructor({logits:P}){super(),this.logits=P}}class Mr extends pe{constructor({logits:P}){super(),this.logits=P}}class Er extends pe{constructor({start_logits:P,end_logits:D}){super(),this.start_logits=P,this.end_logits=D}}class In extends pe{constructor({logits:P}){super(),this.logits=P}}class Wx extends pe{constructor({logits:P,past_key_values:D}){super(),this.logits=P,this.past_key_values=D}}class A0 extends pe{constructor({alphas:P}){super(),this.alphas=P}}class F0 extends pe{constructor({waveform:P,spectrogram:D}){super(),this.waveform=P,this.spectrogram=D}}},"./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js":(e,r,t)=>{t.r(r),t.d(r,{ASTFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a);const l=this.config.sampling_rate,u=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(l/2),l,null,"kaldi",!0);this.mel_filters=u,this.window=(0,o.window_function)(400,"hann",{periodic:!1}),this.mean=this.config.mean,this.std=this.config.std}async _extract_fbank_features(a,l){return(0,o.spectrogram)(a,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:l,transpose:!0})}async _call(a){(0,s.validate_audio_inputs)(a,"ASTFeatureExtractor");const l=await this._extract_fbank_features(a,this.config.max_length);if(this.config.do_normalize){const u=this.std*2,p=l.data;for(let d=0;d{t.r(r),t.d(r,{AutoFeatureExtractor:()=>i});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js");t("./src/base/feature_extraction_utils.js");var n=t("./src/models/feature_extractors.js");class i{static async from_pretrained(l,u={}){const p=await(0,o.getModelJSON)(l,s.FEATURE_EXTRACTOR_NAME,!0,u),d=p.feature_extractor_type,c=n[d];if(!c)throw new Error(`Unknown feature_extractor_type: '${d}'. Please report this at ${s.GITHUB_ISSUE_URL}.`);return new c(p)}}},"./src/models/auto/image_processing_auto.js":(e,r,t)=>{t.r(r),t.d(r,{AutoImageProcessor:()=>a});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js"),n=t("./src/base/image_processors_utils.js"),i=t("./src/models/image_processors.js");class a{static async from_pretrained(u,p={}){const d=await(0,o.getModelJSON)(u,s.IMAGE_PROCESSOR_NAME,!0,p),c=d.image_processor_type??d.feature_extractor_type;let f=i[c];return f||(c!==void 0&&console.warn(`Image processor type '${c}' not found, assuming base ImageProcessor. Please report this at ${s.GITHUB_ISSUE_URL}.`),f=n.ImageProcessor),new f(d)}}},"./src/models/auto/processing_auto.js":(e,r,t)=>{t.r(r),t.d(r,{AutoProcessor:()=>u});var s=t("./src/utils/constants.js"),o=t("./src/utils/hub.js"),n=t("./src/base/processing_utils.js"),i=t("./src/models/processors.js"),a=t("./src/models/image_processors.js"),l=t("./src/models/feature_extractors.js");class u{static async from_pretrained(d,c={}){const f=await(0,o.getModelJSON)(d,s.IMAGE_PROCESSOR_NAME,!0,c),{image_processor_type:_,feature_extractor_type:T,processor_class:k}=f;if(k&&i[k])return i[k].from_pretrained(d,c);if(!_&&!T)throw new Error("No `image_processor_type` or `feature_extractor_type` found in the config.");const w={};if(_){const S=a[_];if(!S)throw new Error(`Unknown image_processor_type: '${_}'.`);w.image_processor=new S(f)}if(T){const S=a[T];if(S)w.image_processor=new S(f);else{const E=l[T];if(!E)throw new Error(`Unknown feature_extractor_type: '${T}'.`);w.feature_extractor=new E(f)}}const g={};return new n.Processor(g,w)}}},"./src/models/beit/image_processing_beit.js":(e,r,t)=>{t.r(r),t.d(r,{BeitFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/bit/image_processing_bit.js":(e,r,t)=>{t.r(r),t.d(r,{BitImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/chinese_clip/image_processing_chinese_clip.js":(e,r,t)=>{t.r(r),t.d(r,{ChineseCLIPFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/clap/feature_extraction_clap.js":(e,r,t)=>{t.r(r),t.d(r,{ClapFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a),this.mel_filters=(0,o.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,null,"htk"),this.mel_filters_slaney=(0,o.mel_filter_bank)(this.config.nb_frequency_bins,this.config.feature_size,this.config.frequency_min,this.config.frequency_max,this.config.sampling_rate,"slaney","slaney"),this.window=(0,o.window_function)(this.config.fft_window_size,"hann")}async _get_input_mel(a,l,u,p){let d;const c=a.length-l;if(c>0)if(u==="rand_trunc"){const f=Math.floor(Math.random()*(c+1));a=a.subarray(f,f+l),d=await this._extract_fbank_features(a,this.mel_filters_slaney,this.config.nb_max_samples)}else throw new Error(`Truncation strategy "${u}" not implemented`);else{if(c<0){let f=new Float64Array(l);if(f.set(a),p==="repeat")for(let _=a.length;_{t.r(r),t.d(r,{CLIPFeatureExtractor:()=>n,CLIPImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/convnext/image_processing_convnext.js":(e,r,t)=>{t.r(r),t.d(r,{ConvNextFeatureExtractor:()=>n,ConvNextImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(a){super(a),this.crop_pct=this.config.crop_pct??224/256}async resize(a){var u;const l=(u=this.size)==null?void 0:u.shortest_edge;if(l===void 0)throw new Error("Size dictionary must contain 'shortest_edge' key.");if(l<384){const p=Math.floor(l/this.crop_pct),[d,c]=this.get_resize_output_image_size(a,{shortest_edge:p});a=await a.resize(d,c,{resample:this.resample}),a=await a.center_crop(l,l)}else a=await a.resize(l,l,{resample:this.resample});return a}}class n extends o{}},"./src/models/dac/feature_extraction_dac.js":(e,r,t)=>{t.r(r),t.d(r,{DacFeatureExtractor:()=>o});var s=t("./src/models/encodec/feature_extraction_encodec.js");class o extends s.EncodecFeatureExtractor{}},"./src/models/deit/image_processing_deit.js":(e,r,t)=>{t.r(r),t.d(r,{DeiTFeatureExtractor:()=>n,DeiTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/detr/image_processing_detr.js":(e,r,t)=>{t.r(r),t.d(r,{DetrFeatureExtractor:()=>i,DetrImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(l){const u=await super._call(l),p=[u.pixel_values.dims[0],64,64],d=(0,o.full)(p,1n);return{...u,pixel_mask:d}}post_process_object_detection(...l){return(0,s.post_process_object_detection)(...l)}post_process_panoptic_segmentation(...l){return(0,s.post_process_panoptic_segmentation)(...l)}post_process_instance_segmentation(...l){return(0,s.post_process_instance_segmentation)(...l)}}class i extends n{}},"./src/models/donut/image_processing_donut.js":(e,r,t)=>{t.r(r),t.d(r,{DonutFeatureExtractor:()=>n,DonutImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(a,l,u,p={}){const[d,c,f]=l;let _=this.image_mean;Array.isArray(this.image_mean)||(_=new Array(f).fill(_));let T=this.image_std;Array.isArray(T)||(T=new Array(f).fill(_));const k=_.map((w,g)=>-w/T[g]);return super.pad_image(a,l,u,{center:!0,constant_values:k,...p})}}class n extends o{}},"./src/models/dpt/image_processing_dpt.js":(e,r,t)=>{t.r(r),t.d(r,{DPTFeatureExtractor:()=>n,DPTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/efficientnet/image_processing_efficientnet.js":(e,r,t)=>{t.r(r),t.d(r,{EfficientNetImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){super(i),this.include_top=this.config.include_top??!0,this.include_top&&(this.image_std=this.image_std.map(a=>a*a))}}},"./src/models/encodec/feature_extraction_encodec.js":(e,r,t)=>{t.r(r),t.d(r,{EncodecFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(a){(0,s.validate_audio_inputs)(a,"EncodecFeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));const l=this.config.feature_size;if(a.length%l!==0)throw new Error(`The length of the audio data must be a multiple of the number of channels (${l}).`);const u=[1,l,a.length/l];return{input_values:new o.Tensor("float32",a,u)}}}},"./src/models/feature_extractors.js":(e,r,t)=>{t.r(r),t.d(r,{ASTFeatureExtractor:()=>s.ASTFeatureExtractor,ClapFeatureExtractor:()=>n.ClapFeatureExtractor,DacFeatureExtractor:()=>i.DacFeatureExtractor,EncodecFeatureExtractor:()=>o.EncodecFeatureExtractor,ImageFeatureExtractor:()=>T.ImageProcessor,MoonshineFeatureExtractor:()=>a.MoonshineFeatureExtractor,PyAnnoteFeatureExtractor:()=>l.PyAnnoteFeatureExtractor,SeamlessM4TFeatureExtractor:()=>u.SeamlessM4TFeatureExtractor,SnacFeatureExtractor:()=>p.SnacFeatureExtractor,SpeechT5FeatureExtractor:()=>d.SpeechT5FeatureExtractor,Wav2Vec2FeatureExtractor:()=>c.Wav2Vec2FeatureExtractor,WeSpeakerFeatureExtractor:()=>f.WeSpeakerFeatureExtractor,WhisperFeatureExtractor:()=>_.WhisperFeatureExtractor});var s=t("./src/models/audio_spectrogram_transformer/feature_extraction_audio_spectrogram_transformer.js"),o=t("./src/models/encodec/feature_extraction_encodec.js"),n=t("./src/models/clap/feature_extraction_clap.js"),i=t("./src/models/dac/feature_extraction_dac.js"),a=t("./src/models/moonshine/feature_extraction_moonshine.js"),l=t("./src/models/pyannote/feature_extraction_pyannote.js"),u=t("./src/models/seamless_m4t/feature_extraction_seamless_m4t.js"),p=t("./src/models/snac/feature_extraction_snac.js"),d=t("./src/models/speecht5/feature_extraction_speecht5.js"),c=t("./src/models/wav2vec2/feature_extraction_wav2vec2.js"),f=t("./src/models/wespeaker/feature_extraction_wespeaker.js"),_=t("./src/models/whisper/feature_extraction_whisper.js"),T=t("./src/base/image_processors_utils.js")},"./src/models/florence2/processing_florence2.js":(e,r,t)=>{t.r(r),t.d(r,{Florence2Processor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{constructor(l,u){super(l,u);const{tasks_answer_post_processing_type:p,task_prompts_without_inputs:d,task_prompts_with_input:c}=this.image_processor.config;this.tasks_answer_post_processing_type=new Map(Object.entries(p??{})),this.task_prompts_without_inputs=new Map(Object.entries(d??{})),this.task_prompts_with_input=new Map(Object.entries(c??{})),this.regexes={quad_boxes:/(.+?)/gm,bboxes:/([^<]+)?/gm},this.size_per_bin=1e3}construct_prompts(l){typeof l=="string"&&(l=[l]);const u=[];for(const p of l)if(this.task_prompts_without_inputs.has(p))u.push(this.task_prompts_without_inputs.get(p));else{for(const[d,c]of this.task_prompts_with_input)if(p.includes(d)){u.push(c.replaceAll("{input}",p).replaceAll(d,""));break}u.length!==l.length&&u.push(p)}return u}post_process_generation(l,u,p){const d=this.tasks_answer_post_processing_type.get(u)??"pure_text";l=l.replaceAll("","").replaceAll("","");let c;switch(d){case"pure_text":c=l;break;case"description_with_bboxes":case"bboxes":case"phrase_grounding":case"ocr":const f=d==="ocr"?"quad_boxes":"bboxes",_=l.matchAll(this.regexes[f]),T=[],k=[];for(const[w,g,...S]of _)T.push(g?g.trim():T.at(-1)??""),k.push(S.map((E,y)=>(Number(E)+.5)/this.size_per_bin*p[y%2]));c={labels:T,[f]:k};break;default:throw new Error(`Task "${u}" (of type "${d}") not yet implemented.`)}return{[u]:c}}async _call(l,u=null,p={}){if(!l&&!u)throw new Error("Either text or images must be provided");const d=await this.image_processor(l,p),c=u?this.tokenizer(u,p):{};return{...d,...c}}}te(i,"tokenizer_class",n.AutoTokenizer),te(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/glpn/image_processing_glpn.js":(e,r,t)=>{t.r(r),t.d(r,{GLPNFeatureExtractor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/grounding_dino/image_processing_grounding_dino.js":(e,r,t)=>{t.r(r),t.d(r,{GroundingDinoImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a){const l=await super._call(a),u=l.pixel_values.dims,p=(0,o.ones)([u[0],u[2],u[3]]);return{...l,pixel_mask:p}}}},"./src/models/grounding_dino/processing_grounding_dino.js":(e,r,t)=>{t.r(r),t.d(r,{GroundingDinoProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/base/image_processors_utils.js");function a(u,p){const c=u.dims.at(-1)-1,f=u.tolist();f.fill(!1,0,1),f.fill(!1,c);const _=p.tolist();return f.map((T,k)=>T?k:null).filter(T=>T!==null).map(T=>_[T])}class l extends s.Processor{async _call(p,d,c={}){const f=p?await this.image_processor(p,c):{};return{...d?this.tokenizer(d,c):{},...f}}post_process_grounded_object_detection(p,d,{box_threshold:c=.25,text_threshold:f=.25,target_sizes:_=null}={}){const{logits:T,pred_boxes:k}=p,w=T.dims[0];if(_!==null&&_.length!==w)throw Error("Make sure that you pass in as many target sizes as the batch dimension of the logits");const g=T.dims.at(1),S=T.sigmoid(),E=S.max(-1).tolist(),y=k.tolist().map(v=>v.map(C=>(0,i.center_to_corners_format)(C))),M=[];for(let v=0;vj.map((ee,H)=>ee*C[(H+1)%2])));const A=E[v],B=[],K=[],G=[];for(let j=0;j{t.r(r),t.d(r,{Idefics3ImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{constructor(a){super(a),this.do_image_splitting=a.do_image_splitting??!0,this.max_image_size=a.max_image_size}get_resize_for_vision_encoder(a,l){let[u,p]=a.dims.slice(-2);const d=p/u;return p>=u?(p=Math.ceil(p/l)*l,u=Math.floor(p/d),u=Math.ceil(u/l)*l):(u=Math.ceil(u/l)*l,p=Math.floor(u*d),p=Math.ceil(p/l)*l),{height:u,width:p}}async _call(a,{do_image_splitting:l=null,return_row_col_info:u=!1}={}){let p;if(!Array.isArray(a))p=[[a]];else{if(a.length===0||!a[0])throw new Error("No images provided.");Array.isArray(a[0])?p=a:p=[a]}let d=[],c=[],f=[];const _=[],T=[];for(const v of p){let C=await Promise.all(v.map(K=>this.preprocess(K)));_.push(...C.map(K=>K.original_size)),T.push(...C.map(K=>K.reshaped_input_size)),C.forEach(K=>K.pixel_values.unsqueeze_(0));const{longest_edge:A}=this.max_image_size;let B;if(l??this.do_image_splitting){let K=new Array(C.length),G=new Array(C.length);B=await Promise.all(C.map(async(j,ee)=>{const H=this.get_resize_for_vision_encoder(j.pixel_values,A),Z=await(0,o.interpolate_4d)(j.pixel_values,{size:[H.height,H.width]}),{frames:X,num_splits_h:oe,num_splits_w:me}=await this.split_image(Z,this.max_image_size);return K[ee]=oe,G[ee]=me,(0,o.cat)(X,0)})),c.push(K),f.push(G)}else{const K=[A,A];B=await Promise.all(C.map(G=>(0,o.interpolate_4d)(G.pixel_values,{size:K}))),c.push(new Array(C.length).fill(0)),f.push(new Array(C.length).fill(0))}d.push((0,o.cat)(B,0))}const k=d.length,[w,g,S,E]=d[0].dims;let y,M;if(k===1)y=d[0].unsqueeze_(0),M=(0,o.full)([k,w,S,E],!0);else{const v=Math.max(...d.map(B=>B.dims.at(0)));M=(0,o.full)([k,v,S,E],!0);const C=M.data,A=v*S*E;for(let B=0;Bu||f>p){_=Math.ceil(c/u),T=Math.ceil(f/p);const k=Math.ceil(c/_),w=Math.ceil(f/T);for(let E=0;E<_;++E)for(let y=0;y{t.r(r),t.d(r,{Idefics3Processor:()=>p});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");var i=t("./src/utils/core.js");function a(d,c,f,_,T,k){let w="";for(let g=0;g`+T.repeat(d);w+=` +`}return w+=` +${_}${k}`+T.repeat(d)+`${_}`,w}function l(d,c,f,_){return`${c}${_}`+f.repeat(d)+`${c}`}function u(d,c,f,_,T,k){return d===0&&c===0?l(f,_,T,k):a(f,d,c,_,T,k)}class p extends s.Processor{constructor(){super(...arguments);te(this,"fake_image_token","");te(this,"image_token","");te(this,"global_img_token","")}async _call(f,_=null,T={}){T.return_row_col_info??(T.return_row_col_info=!0);let k;_&&(k=await this.image_processor(_,T)),Array.isArray(f)||(f=[f]);const w=k.rows??[new Array(f.length).fill(0)],g=k.cols??[new Array(f.length).fill(0)],S=this.config.image_seq_len,E=[],y=[];for(let v=0;vu(ee,B[H],S,this.fake_image_token,this.image_token,this.global_img_token)),G=C.split(this.image_token);if(G.length===0)throw new Error("The image token should be present in the text.");let j=G[0];for(let ee=0;ee{t.r(r),t.d(r,{BeitFeatureExtractor:()=>s.BeitFeatureExtractor,BitImageProcessor:()=>o.BitImageProcessor,CLIPFeatureExtractor:()=>i.CLIPFeatureExtractor,CLIPImageProcessor:()=>i.CLIPImageProcessor,ChineseCLIPFeatureExtractor:()=>n.ChineseCLIPFeatureExtractor,ConvNextFeatureExtractor:()=>a.ConvNextFeatureExtractor,ConvNextImageProcessor:()=>a.ConvNextImageProcessor,DPTFeatureExtractor:()=>d.DPTFeatureExtractor,DPTImageProcessor:()=>d.DPTImageProcessor,DeiTFeatureExtractor:()=>l.DeiTFeatureExtractor,DeiTImageProcessor:()=>l.DeiTImageProcessor,DetrFeatureExtractor:()=>u.DetrFeatureExtractor,DetrImageProcessor:()=>u.DetrImageProcessor,DonutFeatureExtractor:()=>p.DonutFeatureExtractor,DonutImageProcessor:()=>p.DonutImageProcessor,EfficientNetImageProcessor:()=>c.EfficientNetImageProcessor,GLPNFeatureExtractor:()=>f.GLPNFeatureExtractor,GroundingDinoImageProcessor:()=>_.GroundingDinoImageProcessor,Idefics3ImageProcessor:()=>T.Idefics3ImageProcessor,JinaCLIPImageProcessor:()=>w.JinaCLIPImageProcessor,LlavaOnevisionImageProcessor:()=>g.LlavaOnevisionImageProcessor,Mask2FormerImageProcessor:()=>S.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>E.MaskFormerFeatureExtractor,MaskFormerImageProcessor:()=>E.MaskFormerImageProcessor,MobileNetV1FeatureExtractor:()=>y.MobileNetV1FeatureExtractor,MobileNetV1ImageProcessor:()=>y.MobileNetV1ImageProcessor,MobileNetV2FeatureExtractor:()=>M.MobileNetV2FeatureExtractor,MobileNetV2ImageProcessor:()=>M.MobileNetV2ImageProcessor,MobileNetV3FeatureExtractor:()=>v.MobileNetV3FeatureExtractor,MobileNetV3ImageProcessor:()=>v.MobileNetV3ImageProcessor,MobileNetV4FeatureExtractor:()=>C.MobileNetV4FeatureExtractor,MobileNetV4ImageProcessor:()=>C.MobileNetV4ImageProcessor,MobileViTFeatureExtractor:()=>A.MobileViTFeatureExtractor,MobileViTImageProcessor:()=>A.MobileViTImageProcessor,NougatImageProcessor:()=>B.NougatImageProcessor,OwlViTFeatureExtractor:()=>G.OwlViTFeatureExtractor,OwlViTImageProcessor:()=>G.OwlViTImageProcessor,Owlv2ImageProcessor:()=>K.Owlv2ImageProcessor,Phi3VImageProcessor:()=>j.Phi3VImageProcessor,PvtImageProcessor:()=>ee.PvtImageProcessor,Qwen2VLImageProcessor:()=>H.Qwen2VLImageProcessor,RTDetrImageProcessor:()=>Z.RTDetrImageProcessor,SamImageProcessor:()=>X.SamImageProcessor,SegformerFeatureExtractor:()=>oe.SegformerFeatureExtractor,SegformerImageProcessor:()=>oe.SegformerImageProcessor,SiglipImageProcessor:()=>me.SiglipImageProcessor,SmolVLMImageProcessor:()=>ae.SmolVLMImageProcessor,Swin2SRImageProcessor:()=>V.Swin2SRImageProcessor,VLMImageProcessor:()=>k.VLMImageProcessor,ViTFeatureExtractor:()=>F.ViTFeatureExtractor,ViTImageProcessor:()=>F.ViTImageProcessor,VitMatteImageProcessor:()=>W.VitMatteImageProcessor,VitPoseImageProcessor:()=>re.VitPoseImageProcessor,YolosFeatureExtractor:()=>_e.YolosFeatureExtractor,YolosImageProcessor:()=>_e.YolosImageProcessor});var s=t("./src/models/beit/image_processing_beit.js"),o=t("./src/models/bit/image_processing_bit.js"),n=t("./src/models/chinese_clip/image_processing_chinese_clip.js"),i=t("./src/models/clip/image_processing_clip.js"),a=t("./src/models/convnext/image_processing_convnext.js"),l=t("./src/models/deit/image_processing_deit.js"),u=t("./src/models/detr/image_processing_detr.js"),p=t("./src/models/donut/image_processing_donut.js"),d=t("./src/models/dpt/image_processing_dpt.js"),c=t("./src/models/efficientnet/image_processing_efficientnet.js"),f=t("./src/models/glpn/image_processing_glpn.js"),_=t("./src/models/grounding_dino/image_processing_grounding_dino.js"),T=t("./src/models/idefics3/image_processing_idefics3.js"),k=t("./src/models/janus/image_processing_janus.js"),w=t("./src/models/jina_clip/image_processing_jina_clip.js"),g=t("./src/models/llava_onevision/image_processing_llava_onevision.js"),S=t("./src/models/mask2former/image_processing_mask2former.js"),E=t("./src/models/maskformer/image_processing_maskformer.js"),y=t("./src/models/mobilenet_v1/image_processing_mobilenet_v1.js"),M=t("./src/models/mobilenet_v2/image_processing_mobilenet_v2.js"),v=t("./src/models/mobilenet_v3/image_processing_mobilenet_v3.js"),C=t("./src/models/mobilenet_v4/image_processing_mobilenet_v4.js"),A=t("./src/models/mobilevit/image_processing_mobilevit.js"),B=t("./src/models/nougat/image_processing_nougat.js"),K=t("./src/models/owlv2/image_processing_owlv2.js"),G=t("./src/models/owlvit/image_processing_owlvit.js"),j=t("./src/models/phi3_v/image_processing_phi3_v.js"),ee=t("./src/models/pvt/image_processing_pvt.js"),H=t("./src/models/qwen2_vl/image_processing_qwen2_vl.js"),Z=t("./src/models/rt_detr/image_processing_rt_detr.js"),X=t("./src/models/sam/image_processing_sam.js"),oe=t("./src/models/segformer/image_processing_segformer.js"),me=t("./src/models/siglip/image_processing_siglip.js"),ae=t("./src/models/smolvlm/image_processing_smolvlm.js"),V=t("./src/models/swin2sr/image_processing_swin2sr.js"),F=t("./src/models/vit/image_processing_vit.js"),W=t("./src/models/vitmatte/image_processing_vitmatte.js"),re=t("./src/models/vitpose/image_processing_vitpose.js"),_e=t("./src/models/yolos/image_processing_yolos.js")},"./src/models/janus/image_processing_janus.js":(e,r,t)=>{t.r(r),t.d(r,{VLMImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){super({do_pad:!0,pad_size:{width:i.image_size,height:i.image_size},...i}),this.constant_values=this.config.background_color.map(a=>a*this.rescale_factor)}pad_image(i,a,l,u){return super.pad_image(i,a,l,{constant_values:this.constant_values,center:!0,...u})}}},"./src/models/janus/processing_janus.js":(e,r,t)=>{t.r(r),t.d(r,{VLChatProcessor:()=>u});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/utils/core.js"),a=t("./src/utils/tensor.js"),l=t("./src/utils/image.js");class u extends s.Processor{constructor(d,c){super(d,c),this.image_tag=this.config.image_tag,this.image_start_tag=this.config.image_start_tag,this.image_end_tag=this.config.image_end_tag,this.num_image_tokens=this.config.num_image_tokens}async _call(d,{images:c=null,chat_template:f="default"}={}){c?Array.isArray(c)||(c=[c]):c=await Promise.all(d.filter(B=>B.images).flatMap(B=>B.images).map(B=>l.RawImage.read(B)));const _=this.tokenizer,T=_.apply_chat_template(d,{tokenize:!1,add_generation_prompt:!0,chat_template:f}),k=B=>_.encode(B,{add_special_tokens:!1}),w=T.split(this.image_tag),g=w.length-1;if(c.length!==g)throw new Error(`Number of images provided (${c.length}) does not match number of "${this.image_tag}" image tags (${g})`);const[S,E,y]=_.model.convert_tokens_to_ids([this.image_tag,this.image_start_tag,this.image_end_tag]);let M=k(w[0]),v=new Array(M.length).fill(!1);for(let B=1;B0){const B=await this.image_processor(c);return B.pixel_values.unsqueeze_(0),{...A,...B}}return A}}te(u,"image_processor_class",o.AutoImageProcessor),te(u,"tokenizer_class",n.AutoTokenizer),te(u,"uses_processor_config",!0)},"./src/models/jina_clip/image_processing_jina_clip.js":(e,r,t)=>{t.r(r),t.d(r,{JinaCLIPImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{constructor(i){const{resize_mode:a,fill_color:l,interpolation:u,size:p,...d}=i,c=a==="squash"?{width:p,height:p}:a==="shortest"?{shortest_edge:p}:{longest_edge:p},f=u==="bicubic"?3:2;super({...d,size:c,resample:f,do_center_crop:!0,crop_size:p,do_normalize:!0})}}},"./src/models/jina_clip/processing_jina_clip.js":(e,r,t)=>{t.r(r),t.d(r,{JinaCLIPProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{async _call(l=null,u=null,p={}){if(!l&&!u)throw new Error("Either text or images must be provided");const d=l?this.tokenizer(l,p):{},c=u?await this.image_processor(u,p):{};return{...d,...c}}}te(i,"tokenizer_class",n.AutoTokenizer),te(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/llava_onevision/image_processing_llava_onevision.js":(e,r,t)=>{t.r(r),t.d(r,{LlavaOnevisionImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/mask2former/image_processing_mask2former.js":(e,r,t)=>{t.r(r),t.d(r,{Mask2FormerImageProcessor:()=>o});var s=t("./src/models/maskformer/image_processing_maskformer.js");class o extends s.MaskFormerImageProcessor{}},"./src/models/maskformer/image_processing_maskformer.js":(e,r,t)=>{t.r(r),t.d(r,{MaskFormerFeatureExtractor:()=>n,MaskFormerImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_panoptic_segmentation(...a){return(0,s.post_process_panoptic_segmentation)(...a)}post_process_instance_segmentation(...a){return(0,s.post_process_instance_segmentation)(...a)}}class n extends o{}},"./src/models/mgp_str/processing_mgp_str.js":(e,r,t)=>{t.r(r),t.d(r,{MgpstrProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js"),i=t("./src/utils/maths.js");const a={char:["char_decode",1],bpe:["bpe_decode",2],wp:["wp_decode",102]};class l extends s.Processor{get char_tokenizer(){return this.components.char_tokenizer}get bpe_tokenizer(){return this.components.bpe_tokenizer}get wp_tokenizer(){return this.components.wp_tokenizer}_decode_helper(p,d){if(!a.hasOwnProperty(d))throw new Error(`Format ${d} is not supported.`);const[c,f]=a[d],_=this[c].bind(this),[T,k]=p.dims,w=[],g=[],S=p.tolist();for(let y=0;y0?C.reduce((B,K)=>B*K,1):0;g.push(v),w.push(A)}return[_(g),w]}char_decode(p){return this.char_tokenizer.batch_decode(p).map(d=>d.replaceAll(" ",""))}bpe_decode(p){return this.bpe_tokenizer.batch_decode(p)}wp_decode(p){return this.wp_tokenizer.batch_decode(p).map(d=>d.replaceAll(" ",""))}batch_decode([p,d,c]){const[f,_]=this._decode_helper(p,"char"),[T,k]=this._decode_helper(d,"bpe"),[w,g]=this._decode_helper(c,"wp"),S=[],E=[];for(let y=0;y{t.r(r),t.d(r,{MobileNetV1FeatureExtractor:()=>n,MobileNetV1ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v2/image_processing_mobilenet_v2.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV2FeatureExtractor:()=>n,MobileNetV2ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v3/image_processing_mobilenet_v3.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV3FeatureExtractor:()=>n,MobileNetV3ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilenet_v4/image_processing_mobilenet_v4.js":(e,r,t)=>{t.r(r),t.d(r,{MobileNetV4FeatureExtractor:()=>n,MobileNetV4ImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/mobilevit/image_processing_mobilevit.js":(e,r,t)=>{t.r(r),t.d(r,{MobileViTFeatureExtractor:()=>n,MobileViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/moonshine/feature_extraction_moonshine.js":(e,r,t)=>{t.r(r),t.d(r,{MoonshineFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{async _call(a){(0,s.validate_audio_inputs)(a,"MoonshineFeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));const l=[1,a.length];return{input_values:new o.Tensor("float32",a,l)}}}},"./src/models/moonshine/processing_moonshine.js":(e,r,t)=>{t.r(r),t.d(r,{MoonshineProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",o.AutoTokenizer),te(i,"feature_extractor_class",s.AutoFeatureExtractor)},"./src/models/nougat/image_processing_nougat.js":(e,r,t)=>{t.r(r),t.d(r,{NougatImageProcessor:()=>o});var s=t("./src/models/donut/image_processing_donut.js");class o extends s.DonutImageProcessor{}},"./src/models/owlv2/image_processing_owlv2.js":(e,r,t)=>{t.r(r),t.d(r,{Owlv2ImageProcessor:()=>o});var s=t("./src/models/owlvit/image_processing_owlvit.js");class o extends s.OwlViTImageProcessor{}},"./src/models/owlvit/image_processing_owlvit.js":(e,r,t)=>{t.r(r),t.d(r,{OwlViTFeatureExtractor:()=>n,OwlViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...a){return(0,s.post_process_object_detection)(...a)}}class n extends o{}},"./src/models/owlvit/processing_owlvit.js":(e,r,t)=>{t.r(r),t.d(r,{OwlViTProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");class i extends s.Processor{}te(i,"tokenizer_class",n.AutoTokenizer),te(i,"image_processor_class",o.AutoImageProcessor)},"./src/models/paligemma/processing_paligemma.js":(e,r,t)=>{t.r(r),t.d(r,{PaliGemmaProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");const i="";function a(u,p,d,c,f){return`${c.repeat(d*f)}${p}${u} +`}class l extends s.Processor{async _call(p,d=null,c={}){d||(console.warn("You are using PaliGemma without a text prefix. It will perform as a picture-captioning model."),d=""),Array.isArray(p)||(p=[p]),Array.isArray(d)||(d=[d]);const f=this.tokenizer.bos_token,_=this.image_processor.config.image_seq_length;let T;d.some(g=>g.includes(i))?T=d.map(g=>{const S=g.replaceAll(i,i.repeat(_)),E=S.lastIndexOf(i),y=E===-1?0:E+i.length;return S.slice(0,y)+f+S.slice(y)+` +`}):(console.warn("You are passing both `text` and `images` to `PaliGemmaProcessor`. The processor expects special image tokens in the text, as many tokens as there are images per each text. It is recommended to add `` tokens in the very beginning of your text. For this call, we will infer how many images each text has and add special tokens."),T=d.map(g=>a(g,f,_,i,p.length)));const k=this.tokenizer(T,c);return{...await this.image_processor(p,c),...k}}}te(l,"tokenizer_class",n.AutoTokenizer),te(l,"image_processor_class",o.AutoImageProcessor),te(l,"uses_processor_config",!1)},"./src/models/phi3_v/image_processing_phi3_v.js":(e,r,t)=>{t.r(r),t.d(r,{Phi3VImageProcessor:()=>p});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");const n=336,i=[2,3],{ceil:a,floor:l,sqrt:u}=Math;class p extends s.ImageProcessor{constructor(c){super({...c,do_normalize:!0,do_pad:!0,pad_size:"custom",do_convert_rgb:!0,do_resize:!0}),this._num_crops=c.num_crops}calc_num_image_tokens_from_image_size(c,f){const{num_img_tokens:_}=this.config;return l((l(f/n)*l(c/n)+1)*_+1+(l(f/n)+1)*u(_))}get_resize_output_image_size(c,f){const _=this._num_crops,[T,k]=c.size;let w=T/k,g=1;for(;g*Math.ceil(g/w)<=_;)g+=1;g-=1;const S=Math.floor(g*336),E=Math.floor(S/w);return[S,E]}pad_image(c,f,_,T={}){const[k,w]=f,g=n*a(k/n),S=n*a(w/n),E=[1,1,1].map((y,M)=>(y-this.image_mean[M])/this.image_std[M]);return super.pad_image(c,f,{width:S,height:g},{center:!0,constant_values:E,...T})}async _call(c,{num_crops:f=null}={}){if(this._num_crops=f??(f=this.config.num_crops),f<4||u(f)%1!==0)throw new Error("num_crops must be a square number >= 4");Array.isArray(c)||(c=[c]);const _=c.length,T=await Promise.all(c.map(v=>this.preprocess(v))),k=T.map(v=>v.original_size),w=T.map(v=>v.reshaped_input_size),g=[];for(const{pixel_values:v}of T){v.unsqueeze_(0);const[C,A]=v.dims.slice(-2),B=await(0,o.interpolate_4d)(v,{size:[n,n],mode:"bicubic"});if(f>0){const K=[],G=u(f),j=l(A/G),ee=l(C/G);for(let Z=0;Zv.map(C=>n*a(C/n))),y=new o.Tensor("int64",E.flat(),[_,2]),M=E.map(([v,C])=>this.calc_num_image_tokens_from_image_size(C,v));return{pixel_values:S,original_sizes:k,reshaped_input_sizes:w,image_sizes:y,num_img_tokens:M}}}},"./src/models/phi3_v/processing_phi3_v.js":(e,r,t)=>{t.r(r),t.d(r,{Phi3VProcessor:()=>l});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");const i="<|image|>",a=/<\|image_\d+\|>/g;class l extends s.Processor{async _call(p,d=null,{padding:c=!0,truncation:f=!0,num_crops:_=null}={}){Array.isArray(p)||(p=[p]);let T,k;if(d){k=await this.image_processor(d,{num_crops:_});const{num_img_tokens:w}=k,g=p.map((E,y)=>E.split(a).join(i.repeat(w[y])));T=this.tokenizer(g,{padding:c,truncation:f});const S=this.tokenizer.model.convert_tokens_to_ids([i])[0];T.input_ids.map_(E=>E==S?-E:E)}else T=this.tokenizer(p);return{...T,...k}}}te(l,"image_processor_class",o.AutoImageProcessor),te(l,"tokenizer_class",n.AutoTokenizer)},"./src/models/processors.js":(e,r,t)=>{t.r(r),t.d(r,{Florence2Processor:()=>s.Florence2Processor,GroundingDinoProcessor:()=>o.GroundingDinoProcessor,Idefics3Processor:()=>n.Idefics3Processor,JinaCLIPProcessor:()=>a.JinaCLIPProcessor,MgpstrProcessor:()=>l.MgpstrProcessor,MoonshineProcessor:()=>u.MoonshineProcessor,OwlViTProcessor:()=>p.OwlViTProcessor,PaliGemmaProcessor:()=>c.PaliGemmaProcessor,Phi3VProcessor:()=>d.Phi3VProcessor,PyAnnoteProcessor:()=>f.PyAnnoteProcessor,Qwen2VLProcessor:()=>_.Qwen2VLProcessor,SamProcessor:()=>T.SamProcessor,SmolVLMProcessor:()=>k.SmolVLMProcessor,SpeechT5Processor:()=>w.SpeechT5Processor,UltravoxProcessor:()=>g.UltravoxProcessor,VLChatProcessor:()=>i.VLChatProcessor,Wav2Vec2Processor:()=>S.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>E.Wav2Vec2ProcessorWithLM,WhisperProcessor:()=>y.WhisperProcessor});var s=t("./src/models/florence2/processing_florence2.js"),o=t("./src/models/grounding_dino/processing_grounding_dino.js"),n=t("./src/models/idefics3/processing_idefics3.js"),i=t("./src/models/janus/processing_janus.js"),a=t("./src/models/jina_clip/processing_jina_clip.js"),l=t("./src/models/mgp_str/processing_mgp_str.js"),u=t("./src/models/moonshine/processing_moonshine.js"),p=t("./src/models/owlvit/processing_owlvit.js"),d=t("./src/models/phi3_v/processing_phi3_v.js"),c=t("./src/models/paligemma/processing_paligemma.js"),f=t("./src/models/pyannote/processing_pyannote.js"),_=t("./src/models/qwen2_vl/processing_qwen2_vl.js"),T=t("./src/models/sam/processing_sam.js"),k=t("./src/models/smolvlm/processing_smolvlm.js"),w=t("./src/models/speecht5/processing_speecht5.js"),g=t("./src/models/ultravox/processing_ultravox.js"),S=t("./src/models/wav2vec2/processing_wav2vec2.js"),E=t("./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js"),y=t("./src/models/whisper/processing_whisper.js")},"./src/models/pvt/image_processing_pvt.js":(e,r,t)=>{t.r(r),t.d(r,{PvtImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/pyannote/feature_extraction_pyannote.js":(e,r,t)=>{t.r(r),t.d(r,{PyAnnoteFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/maths.js");class i extends s.FeatureExtractor{async _call(l){(0,s.validate_audio_inputs)(l,"PyAnnoteFeatureExtractor"),l instanceof Float64Array&&(l=new Float32Array(l));const u=[1,1,l.length];return{input_values:new o.Tensor("float32",l,u)}}samples_to_frames(l){return(l-this.config.offset)/this.config.step}post_process_speaker_diarization(l,u){const p=u/this.samples_to_frames(u)/this.config.sampling_rate,d=[];for(const c of l.tolist()){const f=[];let _=-1;for(let T=0;T({id:T,start:k*p,end:w*p,confidence:g/(w-k)})))}return d}}},"./src/models/pyannote/processing_pyannote.js":(e,r,t)=>{t.r(r),t.d(r,{PyAnnoteProcessor:()=>n});var s=t("./src/base/processing_utils.js"),o=t("./src/models/pyannote/feature_extraction_pyannote.js");class n extends s.Processor{async _call(a){return await this.feature_extractor(a)}post_process_speaker_diarization(...a){return this.feature_extractor.post_process_speaker_diarization(...a)}get sampling_rate(){return this.feature_extractor.config.sampling_rate}}te(n,"feature_extractor_class",o.PyAnnoteFeatureExtractor)},"./src/models/qwen2_vl/image_processing_qwen2_vl.js":(e,r,t)=>{t.r(r),t.d(r,{Qwen2VLImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a,...l){const{pixel_values:u,original_sizes:p,reshaped_input_sizes:d}=await super._call(a,...l);let c=u;const{temporal_patch_size:f,merge_size:_,patch_size:T}=this.config;c.dims[0]===1&&(c=(0,o.cat)(Array.from({length:f},()=>c),0));const k=c.dims[0]/f,w=c.dims[1],g=Math.floor(c.dims[2]/T),S=Math.floor(c.dims[3]/T),E=c.view(k,f,w,Math.floor(g/_),_,T,Math.floor(S/_),_,T).permute(0,3,6,4,7,2,1,5,8).view(k*g*S,w*f*T*T),y=new o.Tensor("int64",[k,g,S],[1,3]);return{pixel_values:E,image_grid_thw:y,original_sizes:p,reshaped_input_sizes:d}}}},"./src/models/qwen2_vl/processing_qwen2_vl.js":(e,r,t)=>{t.r(r),t.d(r,{Qwen2VLProcessor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js"),n=t("./src/tokenizers.js");t("./src/utils/image.js");class i extends s.Processor{async _call(l,u=null,...p){Array.isArray(l)||(l=[l]);let d,c;if(u&&(d=await this.image_processor(u),c=d.image_grid_thw),c){let _=this.image_processor.config.merge_size**2,T=0;const k=c.tolist();l=l.map(w=>{for(;w.includes("<|image_pad|>");){const g=Number(k[T++].reduce((S,E)=>S*E,1n));w=w.replace("<|image_pad|>","<|placeholder|>".repeat(Math.floor(g/_)))}return w.replaceAll("<|placeholder|>","<|image_pad|>")})}return{...this.tokenizer(l),...d}}}te(i,"image_processor_class",o.AutoImageProcessor),te(i,"tokenizer_class",n.AutoTokenizer)},"./src/models/rt_detr/image_processing_rt_detr.js":(e,r,t)=>{t.r(r),t.d(r,{RTDetrImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...i){return(0,s.post_process_object_detection)(...i)}}},"./src/models/sam/image_processing_sam.js":(e,r,t)=>{t.r(r),t.d(r,{SamImageProcessor:()=>i});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/core.js"),n=t("./src/utils/tensor.js");class i extends s.ImageProcessor{reshape_input_points(l,u,p,d=!1){l=structuredClone(l);let c=(0,o.calculateDimensions)(l);if(c.length===3)d||(c=[1,...c]),l=[l];else if(c.length!==4)throw Error("The input_points must be a 4D tensor of shape `batch_size`, `point_batch_size`, `nb_points_per_image`, `2`.");for(let f=0;fd!==u.dims[c]))throw Error(`The first ${p.length} dimensions of 'input_points' and 'input_labels' must be the same.`);return new n.Tensor("int64",l.flat(1/0).map(BigInt),p)}async _call(l,{input_points:u=null,input_labels:p=null,input_boxes:d=null}={}){const c=await super._call(l);if(u&&(c.input_points=this.reshape_input_points(u,c.original_sizes,c.reshaped_input_sizes)),p){if(!c.input_points)throw Error("`input_points` must be provided if `input_labels` are provided.");c.input_labels=this.add_input_labels(p,c.input_points)}return d&&(c.input_boxes=this.reshape_input_points(d,c.original_sizes,c.reshaped_input_sizes,!0)),c}async post_process_masks(l,u,p,{mask_threshold:d=0,binarize:c=!0,pad_size:f=null}={}){const _=[];f=f??this.pad_size;const T=[f.height,f.width];for(let k=0;kd&&(y[M]=1);S=new n.Tensor("bool",y,S.dims)}_.push(S)}return _}generate_crop_boxes(l,u,{crop_n_layers:p=0,overlap_ratio:d=512/1500,points_per_crop:c=32,crop_n_points_downscale_factor:f=1}={}){}}},"./src/models/sam/processing_sam.js":(e,r,t)=>{t.r(r),t.d(r,{SamProcessor:()=>n});var s=t("./src/base/processing_utils.js"),o=t("./src/models/auto/image_processing_auto.js");class n extends s.Processor{async _call(...a){return await this.image_processor(...a)}post_process_masks(...a){return this.image_processor.post_process_masks(...a)}reshape_input_points(...a){return this.image_processor.reshape_input_points(...a)}}te(n,"image_processor_class",o.AutoImageProcessor)},"./src/models/seamless_m4t/feature_extraction_seamless_m4t.js":(e,r,t)=>{t.r(r),t.d(r,{SeamlessM4TFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js"),n=t("./src/utils/audio.js");class i extends s.FeatureExtractor{constructor(l){super(l);const u=this.config.sampling_rate,p=(0,n.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(u/2),u,null,"kaldi",!0);this.mel_filters=p,this.window=(0,n.window_function)(400,"povey",{periodic:!1})}async _extract_fbank_features(l,u){return l=l.map(p=>p*32768),(0,n.spectrogram)(l,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,max_num_frames:u,transpose:!0})}async _call(l,{padding:u=!0,pad_to_multiple_of:p=2,do_normalize_per_mel_bins:d=!0,return_attention_mask:c=!0}={}){(0,s.validate_audio_inputs)(l,"SeamlessM4TFeatureExtractor");let f=await this._extract_fbank_features(l,this.config.max_length);if(d){const[y,M]=f.dims,v=f.data;for(let C=0;C0){const A=new Float32Array(M*(y+C));A.set(v),A.fill(this.config.padding_value,v.length);const B=y+C;f=new o.Tensor(f.type,A,[B,M]),c&&(_=new o.Tensor("int64",new BigInt64Array(B),[1,B]),_.data.fill(1n,0,y))}}const[T,k]=f.dims,w=this.config.stride;if(T%w!==0)throw new Error(`The number of frames (${T}) must be a multiple of the stride (${w}).`);const S=f.view(1,Math.floor(T/w),k*w),E={input_features:S};if(c){const y=S.dims[1],M=new BigInt64Array(y);if(_){const v=_.data;for(let C=1,A=0;C{t.r(r),t.d(r,{SegformerFeatureExtractor:()=>n,SegformerImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_semantic_segmentation(...a){return(0,s.post_process_semantic_segmentation)(...a)}}class n extends o{}},"./src/models/siglip/image_processing_siglip.js":(e,r,t)=>{t.r(r),t.d(r,{SiglipImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}},"./src/models/smolvlm/image_processing_smolvlm.js":(e,r,t)=>{t.r(r),t.d(r,{SmolVLMImageProcessor:()=>s.Idefics3ImageProcessor});var s=t("./src/models/idefics3/image_processing_idefics3.js")},"./src/models/smolvlm/processing_smolvlm.js":(e,r,t)=>{t.r(r),t.d(r,{SmolVLMProcessor:()=>s.Idefics3Processor});var s=t("./src/models/idefics3/processing_idefics3.js")},"./src/models/snac/feature_extraction_snac.js":(e,r,t)=>{t.r(r),t.d(r,{SnacFeatureExtractor:()=>o});var s=t("./src/models/dac/feature_extraction_dac.js");class o extends s.DacFeatureExtractor{}},"./src/models/speecht5/feature_extraction_speecht5.js":(e,r,t)=>{t.r(r),t.d(r,{SpeechT5FeatureExtractor:()=>o});var s=t("./src/base/feature_extraction_utils.js");class o extends s.FeatureExtractor{}},"./src/models/speecht5/processing_speecht5.js":(e,r,t)=>{t.r(r),t.d(r,{SpeechT5Processor:()=>i});var s=t("./src/base/processing_utils.js"),o=t("./src/tokenizers.js"),n=t("./src/models/auto/feature_extraction_auto.js");class i extends s.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",o.AutoTokenizer),te(i,"feature_extractor_class",n.AutoFeatureExtractor)},"./src/models/swin2sr/image_processing_swin2sr.js":(e,r,t)=>{t.r(r),t.d(r,{Swin2SRImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{pad_image(i,a,l,u={}){const[p,d,c]=a;return super.pad_image(i,a,{width:d+(l-d%l)%l,height:p+(l-p%l)%l},{mode:"symmetric",center:!1,constant_values:-1,...u})}}},"./src/models/ultravox/processing_ultravox.js":(e,r,t)=>{t.r(r),t.d(r,{UltravoxProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l,u=null,p={}){if(Array.isArray(l))throw new Error("Batched inputs are not supported yet.");let d={};if(u){const f=u.length,{input_features:_}=await this.feature_extractor(u,{...p,max_length:f}),T=Math.round(f/this.config.encoder_ds_factor+1e-4),k=1+Math.ceil(T/this.config.stack_factor);d.audio_token_len=[k],d.audio_values=_;const w=this.config.audio_placeholder;if(!l.includes(w))throw new Error(`The input text does not contain the image token ${w}.`);l=l.replaceAll(w,w.repeat(k))}return{...this.tokenizer(l,{add_special_tokens:!1,...p}),...d}}}te(i,"tokenizer_class",o.AutoTokenizer),te(i,"feature_extractor_class",s.AutoFeatureExtractor),te(i,"uses_processor_config",!0)},"./src/models/vit/image_processing_vit.js":(e,r,t)=>{t.r(r),t.d(r,{ViTFeatureExtractor:()=>n,ViTImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{}class n extends o{}},"./src/models/vitmatte/image_processing_vitmatte.js":(e,r,t)=>{t.r(r),t.d(r,{VitMatteImageProcessor:()=>n});var s=t("./src/base/image_processors_utils.js"),o=t("./src/utils/tensor.js");class n extends s.ImageProcessor{async _call(a,l){Array.isArray(a)||(a=[a]),Array.isArray(l)||(l=[l]);const u=await Promise.all(a.map(c=>this.preprocess(c))),p=await Promise.all(l.map(c=>this.preprocess(c,{do_normalize:!1,do_convert_rgb:!1,do_convert_grayscale:!0})));return{pixel_values:(0,o.stack)(u.map((c,f)=>(0,o.cat)([c.pixel_values,p[f].pixel_values],0)),0),original_sizes:u.map(c=>c.original_size),reshaped_input_sizes:u.map(c=>c.reshaped_input_size)}}}},"./src/models/vitpose/image_processing_vitpose.js":(e,r,t)=>{t.r(r),t.d(r,{VitPoseImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_pose_estimation(i,a,{threshold:l=null}={}){const u=i.tolist(),[p,d,c,f]=i.dims,_=[];for(let T=0;T{t.r(r),t.d(r,{Wav2Vec2FeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js"),o=t("./src/utils/tensor.js");class n extends s.FeatureExtractor{_zero_mean_unit_var_norm(a){const u=a.reduce((d,c)=>d+c,0)/a.length,p=a.reduce((d,c)=>d+(c-u)**2,0)/a.length;return a.map(d=>(d-u)/Math.sqrt(p+1e-7))}async _call(a){(0,s.validate_audio_inputs)(a,"Wav2Vec2FeatureExtractor"),a instanceof Float64Array&&(a=new Float32Array(a));let l=a;this.config.do_normalize&&(l=this._zero_mean_unit_var_norm(l));const u=[1,l.length];return{input_values:new o.Tensor("float32",l,u),attention_mask:new o.Tensor("int64",new BigInt64Array(l.length).fill(1n),u)}}}},"./src/models/wav2vec2/processing_wav2vec2.js":(e,r,t)=>{t.r(r),t.d(r,{Wav2Vec2Processor:()=>i});var s=t("./src/tokenizers.js"),o=t("./src/models/auto/feature_extraction_auto.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",s.AutoTokenizer),te(i,"feature_extractor_class",o.AutoFeatureExtractor)},"./src/models/wav2vec2_with_lm/processing_wav2vec2_with_lm.js":(e,r,t)=>{t.r(r),t.d(r,{Wav2Vec2ProcessorWithLM:()=>i});var s=t("./src/tokenizers.js"),o=t("./src/models/auto/feature_extraction_auto.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",s.AutoTokenizer),te(i,"feature_extractor_class",o.AutoFeatureExtractor)},"./src/models/wespeaker/feature_extraction_wespeaker.js":(e,r,t)=>{t.r(r),t.d(r,{WeSpeakerFeatureExtractor:()=>n});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js");class n extends s.FeatureExtractor{constructor(a){super(a);const l=this.config.sampling_rate,u=(0,o.mel_filter_bank)(257,this.config.num_mel_bins,20,Math.floor(l/2),l,null,"kaldi",!0);this.mel_filters=u,this.window=(0,o.window_function)(400,"hamming",{periodic:!1}),this.min_num_frames=this.config.min_num_frames}async _extract_fbank_features(a){return a=a.map(l=>l*32768),(0,o.spectrogram)(a,this.window,400,160,{fft_length:512,power:2,center:!1,preemphasis:.97,mel_filters:this.mel_filters,log_mel:"log",mel_floor:1192092955078125e-22,remove_dc_offset:!0,transpose:!0,min_num_frames:this.min_num_frames})}async _call(a){(0,s.validate_audio_inputs)(a,"WeSpeakerFeatureExtractor");const l=(await this._extract_fbank_features(a)).unsqueeze_(0);if(this.config.fbank_centering_span===null){const u=l.mean(1).data,p=l.data,[d,c,f]=l.dims;for(let _=0;_{t.r(r),t.d(r,{WHISPER_LANGUAGE_MAPPING:()=>o,WHISPER_TO_LANGUAGE_CODE_MAPPING:()=>n,whisper_language_to_code:()=>i});const s=[["en","english"],["zh","chinese"],["de","german"],["es","spanish"],["ru","russian"],["ko","korean"],["fr","french"],["ja","japanese"],["pt","portuguese"],["tr","turkish"],["pl","polish"],["ca","catalan"],["nl","dutch"],["ar","arabic"],["sv","swedish"],["it","italian"],["id","indonesian"],["hi","hindi"],["fi","finnish"],["vi","vietnamese"],["he","hebrew"],["uk","ukrainian"],["el","greek"],["ms","malay"],["cs","czech"],["ro","romanian"],["da","danish"],["hu","hungarian"],["ta","tamil"],["no","norwegian"],["th","thai"],["ur","urdu"],["hr","croatian"],["bg","bulgarian"],["lt","lithuanian"],["la","latin"],["mi","maori"],["ml","malayalam"],["cy","welsh"],["sk","slovak"],["te","telugu"],["fa","persian"],["lv","latvian"],["bn","bengali"],["sr","serbian"],["az","azerbaijani"],["sl","slovenian"],["kn","kannada"],["et","estonian"],["mk","macedonian"],["br","breton"],["eu","basque"],["is","icelandic"],["hy","armenian"],["ne","nepali"],["mn","mongolian"],["bs","bosnian"],["kk","kazakh"],["sq","albanian"],["sw","swahili"],["gl","galician"],["mr","marathi"],["pa","punjabi"],["si","sinhala"],["km","khmer"],["sn","shona"],["yo","yoruba"],["so","somali"],["af","afrikaans"],["oc","occitan"],["ka","georgian"],["be","belarusian"],["tg","tajik"],["sd","sindhi"],["gu","gujarati"],["am","amharic"],["yi","yiddish"],["lo","lao"],["uz","uzbek"],["fo","faroese"],["ht","haitian creole"],["ps","pashto"],["tk","turkmen"],["nn","nynorsk"],["mt","maltese"],["sa","sanskrit"],["lb","luxembourgish"],["my","myanmar"],["bo","tibetan"],["tl","tagalog"],["mg","malagasy"],["as","assamese"],["tt","tatar"],["haw","hawaiian"],["ln","lingala"],["ha","hausa"],["ba","bashkir"],["jw","javanese"],["su","sundanese"]],o=new Map(s),n=new Map([...s.map(([a,l])=>[l,a]),["burmese","my"],["valencian","ca"],["flemish","nl"],["haitian","ht"],["letzeburgesch","lb"],["pushto","ps"],["panjabi","pa"],["moldavian","ro"],["moldovan","ro"],["sinhalese","si"],["castilian","es"]]);function i(a){a=a.toLowerCase();let l=n.get(a);if(l===void 0){const u=a.match(/^<\|([a-z]{2})\|>$/);if(u&&(a=u[1]),o.has(a))l=a;else{const d=a.length===2?o.keys():o.values();throw new Error(`Language "${a}" is not supported. Must be one of: ${JSON.stringify(Array.from(d))}`)}}return l}},"./src/models/whisper/feature_extraction_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperFeatureExtractor:()=>i});var s=t("./src/base/feature_extraction_utils.js");t("./src/utils/tensor.js");var o=t("./src/utils/audio.js"),n=t("./src/utils/maths.js");class i extends s.FeatureExtractor{constructor(l){var u;super(l),(u=this.config).mel_filters??(u.mel_filters=(0,o.mel_filter_bank)(Math.floor(1+this.config.n_fft/2),this.config.feature_size,0,8e3,this.config.sampling_rate,"slaney","slaney")),this.window=(0,o.window_function)(this.config.n_fft,"hann")}async _extract_fbank_features(l){const u=await(0,o.spectrogram)(l,this.window,this.config.n_fft,this.config.hop_length,{power:2,mel_filters:this.config.mel_filters,log_mel:"log10",max_num_frames:Math.min(Math.floor(l.length/this.config.hop_length),this.config.nb_max_frames)}),p=u.data,d=(0,n.max)(p)[0];for(let c=0;cd?(l.length>this.config.n_samples&&console.warn("Attempting to extract features for audio longer than 30 seconds. If using a pipeline to extract transcript from a long audio clip, remember to specify `chunk_length_s` and/or `stride_length_s`."),p=l.slice(0,d)):(p=new Float32Array(d),p.set(l)),{input_features:(await this._extract_fbank_features(p)).unsqueeze_(0)}}}},"./src/models/whisper/generation_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperGenerationConfig:()=>o});var s=t("./src/generation/configuration_utils.js");class o extends s.GenerationConfig{constructor(){super(...arguments);te(this,"return_timestamps",null);te(this,"return_token_timestamps",null);te(this,"num_frames",null);te(this,"alignment_heads",null);te(this,"task",null);te(this,"language",null);te(this,"no_timestamps_token_id",null);te(this,"prompt_ids",null);te(this,"is_multilingual",null);te(this,"lang_to_id",null);te(this,"task_to_id",null);te(this,"max_initial_timestamp_index",1)}}},"./src/models/whisper/processing_whisper.js":(e,r,t)=>{t.r(r),t.d(r,{WhisperProcessor:()=>i});var s=t("./src/models/auto/feature_extraction_auto.js"),o=t("./src/tokenizers.js"),n=t("./src/base/processing_utils.js");class i extends n.Processor{async _call(l){return await this.feature_extractor(l)}}te(i,"tokenizer_class",o.AutoTokenizer),te(i,"feature_extractor_class",s.AutoFeatureExtractor)},"./src/models/yolos/image_processing_yolos.js":(e,r,t)=>{t.r(r),t.d(r,{YolosFeatureExtractor:()=>n,YolosImageProcessor:()=>o});var s=t("./src/base/image_processors_utils.js");class o extends s.ImageProcessor{post_process_object_detection(...a){return(0,s.post_process_object_detection)(...a)}}class n extends o{}},"./src/ops/registry.js":(e,r,t)=>{t.r(r),t.d(r,{TensorOpRegistry:()=>l});var s=t("./src/backends/onnx.js"),o=t("./src/utils/tensor.js"),n=t("./src/env.js");const i=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV,a=async(u,p,d)=>{const c=await(0,s.createInferenceSession)(new Uint8Array(u),p);let f=Promise.resolve();return async _=>{const T=(0,s.isONNXProxy)(),k=Object.fromEntries(Object.entries(_).map(([g,S])=>[g,(T?S.clone():S).ort_tensor])),w=await(f=i?f.then(()=>c.run(k)):c.run(k));return Array.isArray(d)?d.map(g=>new o.Tensor(w[g])):new o.Tensor(w[d])}};class l{static get nearest_interpolate_4d(){return this._nearest_interpolate_4d||(this._nearest_interpolate_4d=a([8,10,18,0,58,129,1,10,41,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,18,10,4,109,111,100,101,34,7,110,101,97,114,101,115,116,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,21],this.session_options,"y")),this._nearest_interpolate_4d}static get bilinear_interpolate_4d(){return this._bilinear_interpolate_4d||(this._bilinear_interpolate_4d=a([8,9,18,0,58,128,1,10,40,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,17,10,4,109,111,100,101,34,6,108,105,110,101,97,114,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bilinear_interpolate_4d}static get bicubic_interpolate_4d(){return this._bicubic_interpolate_4d||(this._bicubic_interpolate_4d=a([8,9,18,0,58,127,10,39,10,1,120,10,0,10,0,10,1,115,18,1,121,34,6,82,101,115,105,122,101,42,16,10,4,109,111,100,101,34,5,99,117,98,105,99,160,1,3,18,1,114,90,31,10,1,120,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,90,15,10,1,115,18,10,10,8,8,7,18,4,10,2,8,4,98,31,10,1,121,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,99,10,3,18,1,104,10,3,18,1,119,66,2,16,20],this.session_options,"y")),this._bicubic_interpolate_4d}static get matmul(){return this._matmul||(this._matmul=a([8,9,18,0,58,55,10,17,10,1,97,10,1,98,18,1,99,34,6,77,97,116,77,117,108,18,1,114,90,9,10,1,97,18,4,10,2,8,1,90,9,10,1,98,18,4,10,2,8,1,98,9,10,1,99,18,4,10,2,8,1,66,2,16,20],this.session_options,"c")),this._matmul}static get stft(){return this._stft||(this._stft=a([8,7,18,0,58,148,1,10,38,10,1,115,10,1,106,10,1,119,10,1,108,18,1,111,34,4,83,84,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,115,90,26,10,1,115,18,21,10,19,8,1,18,15,10,3,18,1,98,10,3,18,1,115,10,3,18,1,99,90,11,10,1,106,18,6,10,4,8,7,18,0,90,16,10,1,119,18,11,10,9,8,1,18,5,10,3,18,1,119,90,11,10,1,108,18,6,10,4,8,7,18,0,98,31,10,1,111,18,26,10,24,8,1,18,20,10,3,18,1,98,10,3,18,1,102,10,3,18,1,100,10,3,18,1,99,66,2,16,17],this.session_options,"o")),this._stft}static get rfft(){return this._rfft||(this._rfft=a([8,9,18,0,58,97,10,33,10,1,120,10,0,10,1,97,18,1,121,34,3,68,70,84,42,15,10,8,111,110,101,115,105,100,101,100,24,1,160,1,2,18,1,100,90,21,10,1,120,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,90,11,10,1,97,18,6,10,4,8,7,18,0,98,21,10,1,121,18,16,10,14,8,1,18,10,10,3,18,1,115,10,3,18,1,99,66,2,16,20],this.session_options,"y")),this._rfft}static get top_k(){return this._top_k||(this._top_k=a([8,10,18,0,58,73,10,18,10,1,120,10,1,107,18,1,118,18,1,105,34,4,84,111,112,75,18,1,116,90,9,10,1,120,18,4,10,2,8,1,90,15,10,1,107,18,10,10,8,8,7,18,4,10,2,8,1,98,9,10,1,118,18,4,10,2,8,1,98,9,10,1,105,18,4,10,2,8,7,66,2,16,21],this.session_options,["v","i"])),this._top_k}static get slice(){return this._slice||(this._slice=a([8,7,18,0,58,96,10,25,10,1,120,10,1,115,10,1,101,10,1,97,10,1,116,18,1,121,34,5,83,108,105,99,101,18,1,114,90,9,10,1,120,18,4,10,2,8,1,90,9,10,1,115,18,4,10,2,8,7,90,9,10,1,101,18,4,10,2,8,7,90,9,10,1,97,18,4,10,2,8,7,90,9,10,1,116,18,4,10,2,8,7,98,9,10,1,121,18,4,10,2,8,1,66,2,16,13],this.session_options,"y")),this._slice}}te(l,"session_options",{})},"./src/pipelines.js":(e,r,t)=>{t.r(r),t.d(r,{AudioClassificationPipeline:()=>G,AutomaticSpeechRecognitionPipeline:()=>ee,BackgroundRemovalPipeline:()=>oe,DepthEstimationPipeline:()=>_e,DocumentQuestionAnsweringPipeline:()=>F,FeatureExtractionPipeline:()=>B,FillMaskPipeline:()=>S,ImageClassificationPipeline:()=>Z,ImageFeatureExtractionPipeline:()=>K,ImageSegmentationPipeline:()=>X,ImageToImagePipeline:()=>re,ImageToTextPipeline:()=>H,ObjectDetectionPipeline:()=>ae,Pipeline:()=>T,QuestionAnsweringPipeline:()=>g,SummarizationPipeline:()=>y,Text2TextGenerationPipeline:()=>E,TextClassificationPipeline:()=>k,TextGenerationPipeline:()=>C,TextToAudioPipeline:()=>W,TokenClassificationPipeline:()=>w,TranslationPipeline:()=>M,ZeroShotAudioClassificationPipeline:()=>j,ZeroShotClassificationPipeline:()=>A,ZeroShotImageClassificationPipeline:()=>me,ZeroShotObjectDetectionPipeline:()=>V,pipeline:()=>$e});var s=t("./src/tokenizers.js"),o=t("./src/models.js"),n=t("./src/models/auto/processing_auto.js");t("./src/base/processing_utils.js");var i=t("./src/utils/generic.js"),a=t("./src/utils/core.js"),l=t("./src/utils/maths.js"),u=t("./src/utils/audio.js"),p=t("./src/utils/tensor.js"),d=t("./src/utils/image.js");async function c(we){return Array.isArray(we)||(we=[we]),await Promise.all(we.map(q=>d.RawImage.read(q)))}async function f(we,q){return Array.isArray(we)||(we=[we]),await Promise.all(we.map(R=>typeof R=="string"||R instanceof URL?(0,u.read_audio)(R,q):R instanceof Float64Array?new Float32Array(R):R))}function _(we,q){q&&(we=we.map(Se=>Se|0));const[R,pe,xe,be]=we;return{xmin:R,ymin:pe,xmax:xe,ymax:be}}class T extends i.Callable{constructor({task:q,model:R,tokenizer:pe=null,processor:xe=null}){super(),this.task=q,this.model=R,this.tokenizer=pe,this.processor=xe}async dispose(){await this.model.dispose()}}class k extends T{constructor(q){super(q)}async _call(q,{top_k:R=1}={}){const pe=this.tokenizer(q,{padding:!0,truncation:!0}),xe=await this.model(pe),be=this.model.config.problem_type==="multi_label_classification"?Fe=>Fe.sigmoid():Fe=>new p.Tensor("float32",(0,l.softmax)(Fe.data),Fe.dims),Se=this.model.config.id2label,Ae=[];for(const Fe of xe.logits){const ze=be(Fe),Ve=await(0,p.topk)(ze,R),O=Ve[0].tolist(),z=Ve[1].tolist().map((J,le)=>({label:Se?Se[J]:`LABEL_${J}`,score:O[le]}));R===1?Ae.push(...z):Ae.push(z)}return Array.isArray(q)||R===1?Ae:Ae[0]}}class w extends T{constructor(q){super(q)}async _call(q,{ignore_labels:R=["O"]}={}){const pe=Array.isArray(q),xe=this.tokenizer(pe?q:[q],{padding:!0,truncation:!0}),Se=(await this.model(xe)).logits,Ae=this.model.config.id2label,Fe=[];for(let ze=0;zeIe==this.tokenizer.sep_token_id);Fe[O].map((Ie,Re)=>Ie==1&&(Re===0||Re>z&&ze.findIndex(Xe=>Xe==Y[Re])===-1));const J=be[O].tolist(),le=Se[O].tolist();for(let Ie=1;IeRe==Y[Ie])!==-1)&&(J[Ie]=-1/0,le[Ie]=-1/0);const ye=(0,l.softmax)(J).map((Ie,Re)=>[Ie,Re]),Ee=(0,l.softmax)(le).map((Ie,Re)=>[Ie,Re]);ye[0][0]=0,Ee[0][0]=0;const ke=(0,a.product)(ye,Ee).filter(Ie=>Ie[0][1]<=Ie[1][1]).map(Ie=>[Ie[0][1],Ie[1][1],Ie[0][0]*Ie[1][0]]).sort((Ie,Re)=>Re[2]-Ie[2]);for(let Ie=0;IeJ==this.tokenizer.mask_token_id);if(ze===-1)throw Error(`Mask token (${this.tokenizer.mask_token}) not found in text.`);const Ve=xe[Ae][ze],O=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(Ve.data),Ve.dims),R),Y=O[0].tolist(),z=O[1].tolist();be.push(z.map((J,le)=>{const ye=Fe.slice();return ye[ze]=J,{score:Y[le],token:Number(J),token_str:this.tokenizer.decode([J]),sequence:this.tokenizer.decode(ye,{skip_special_tokens:!0})}}))}return Array.isArray(q)?be:be[0]}}class E extends T{constructor(R){super(R);te(this,"_key","generated_text")}async _call(R,pe={}){Array.isArray(R)||(R=[R]),this.model.config.prefix&&(R=R.map(ze=>this.model.config.prefix+ze));const xe=this.model.config.task_specific_params;xe&&xe[this.task]&&xe[this.task].prefix&&(R=R.map(ze=>xe[this.task].prefix+ze));const be=this.tokenizer,Se={padding:!0,truncation:!0};let Ae;this instanceof M&&"_build_translation_inputs"in be?Ae=be._build_translation_inputs(R,Se,pe):Ae=be(R,Se);const Fe=await this.model.generate({...Ae,...pe});return be.batch_decode(Fe,{skip_special_tokens:!0}).map(ze=>({[this._key]:ze}))}}class y extends E{constructor(R){super(R);te(this,"_key","summary_text")}}class M extends E{constructor(R){super(R);te(this,"_key","translation_text")}}function v(we){return Array.isArray(we)&&we.every(q=>"role"in q&&"content"in q)}class C extends T{constructor(q){super(q)}async _call(q,R={}){let pe=!1,xe=!1,be;if(typeof q=="string")be=q=[q];else if(Array.isArray(q)&&q.every(z=>typeof z=="string"))pe=!0,be=q;else{if(v(q))q=[q];else if(Array.isArray(q)&&q.every(v))pe=!0;else throw new Error("Input must be a string, an array of strings, a Chat, or an array of Chats");xe=!0,be=q.map(z=>this.tokenizer.apply_chat_template(z,{tokenize:!1,add_generation_prompt:!0}))}const Se=R.add_special_tokens??!1,Ae=xe?!1:R.return_full_text??!0;this.tokenizer.padding_side="left";const Fe=this.tokenizer(be,{add_special_tokens:Se,padding:!0,truncation:!0}),ze=await this.model.generate({...Fe,...R}),Ve=this.tokenizer.batch_decode(ze,{skip_special_tokens:!0});let O;!Ae&&Fe.input_ids.dims.at(-1)>0&&(O=this.tokenizer.batch_decode(Fe.input_ids,{skip_special_tokens:!0}).map(z=>z.length));const Y=Array.from({length:q.length},z=>[]);for(let z=0;z[R.toLowerCase(),pe])),this.entailment_id=this.label2id.entailment,this.entailment_id===void 0&&(console.warn("Could not find 'entailment' in label2id mapping. Using 2 as entailment_id."),this.entailment_id=2),this.contradiction_id=this.label2id.contradiction??this.label2id.not_entailment,this.contradiction_id===void 0&&(console.warn("Could not find 'contradiction' in label2id mapping. Using 0 as contradiction_id."),this.contradiction_id=0)}async _call(q,R,{hypothesis_template:pe="This example is {}.",multi_label:xe=!1}={}){const be=Array.isArray(q);be||(q=[q]),Array.isArray(R)||(R=[R]);const Se=R.map(ze=>pe.replace("{}",ze)),Ae=xe||R.length===1,Fe=[];for(const ze of q){const Ve=[];for(const z of Se){const J=this.tokenizer(ze,{text_pair:z,padding:!0,truncation:!0}),le=await this.model(J);Ae?Ve.push([le.logits.data[this.contradiction_id],le.logits.data[this.entailment_id]]):Ve.push(le.logits.data[this.entailment_id])}const Y=(Ae?Ve.map(z=>(0,l.softmax)(z)[1]):(0,l.softmax)(Ve)).map((z,J)=>[z,J]).sort((z,J)=>J[0]-z[0]);Fe.push({sequence:ze,labels:Y.map(z=>R[z[1]]),scores:Y.map(z=>z[0])})}return be?Fe:Fe[0]}}class B extends T{constructor(q){super(q)}async _call(q,{pooling:R="none",normalize:pe=!1,quantize:xe=!1,precision:be="binary"}={}){const Se=this.tokenizer(q,{padding:!0,truncation:!0}),Ae=await this.model(Se);let Fe=Ae.last_hidden_state??Ae.logits??Ae.token_embeddings;if(R!=="none")if(R==="mean")Fe=(0,p.mean_pooling)(Fe,Se.attention_mask);else if(R==="cls")Fe=Fe.slice(null,0);else throw Error(`Pooling method '${R}' not supported.`);return pe&&(Fe=Fe.normalize(2,-1)),xe&&(Fe=(0,p.quantize_embeddings)(Fe,be)),Fe}}class K extends T{constructor(q){super(q)}async _call(q,{pool:R=null}={}){const pe=await c(q),{pixel_values:xe}=await this.processor(pe),be=await this.model({pixel_values:xe});let Se;if(R){if(!("pooler_output"in be))throw Error("No pooled output was returned. Make sure the model has a 'pooler' layer when using the 'pool' option.");Se=be.pooler_output}else Se=be.last_hidden_state??be.logits??be.image_embeds;return Se}}class G extends T{constructor(q){super(q)}async _call(q,{top_k:R=5}={}){const pe=this.processor.feature_extractor.config.sampling_rate,xe=await f(q,pe),be=this.model.config.id2label,Se=[];for(const Ae of xe){const Fe=await this.processor(Ae),Ve=(await this.model(Fe)).logits[0],O=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(Ve.data),Ve.dims),R),Y=O[0].tolist(),J=O[1].tolist().map((le,ye)=>({label:be?be[le]:`LABEL_${le}`,score:Y[ye]}));Se.push(J)}return Array.isArray(q)?Se:Se[0]}}class j extends T{constructor(q){super(q)}async _call(q,R,{hypothesis_template:pe="This is a sound of {}."}={}){const xe=!Array.isArray(q);xe&&(q=[q]);const be=R.map(Ve=>pe.replace("{}",Ve)),Se=this.tokenizer(be,{padding:!0,truncation:!0}),Ae=this.processor.feature_extractor.config.sampling_rate,Fe=await f(q,Ae),ze=[];for(const Ve of Fe){const O=await this.processor(Ve),Y=await this.model({...Se,...O}),z=(0,l.softmax)(Y.logits_per_audio.data);ze.push([...z].map((J,le)=>({score:J,label:R[le]})))}return xe?ze[0]:ze}}class ee extends T{constructor(q){super(q)}async _call(q,R={}){switch(this.model.config.model_type){case"whisper":case"lite-whisper":return this._call_whisper(q,R);case"wav2vec2":case"wav2vec2-bert":case"unispeech":case"unispeech-sat":case"hubert":return this._call_wav2vec2(q,R);case"moonshine":return this._call_moonshine(q,R);default:throw new Error(`AutomaticSpeechRecognitionPipeline does not support model type '${this.model.config.model_type}'.`)}}async _call_wav2vec2(q,R){R.language&&console.warn('`language` parameter is not yet supported for `wav2vec2` models, defaulting to "English".'),R.task&&console.warn('`task` parameter is not yet supported for `wav2vec2` models, defaulting to "transcribe".');const pe=!Array.isArray(q);pe&&(q=[q]);const xe=this.processor.feature_extractor.config.sampling_rate,be=await f(q,xe),Se=[];for(const Ae of be){const Fe=await this.processor(Ae),Ve=(await this.model(Fe)).logits[0],O=[];for(const z of Ve)O.push((0,l.max)(z.data)[1]);const Y=this.tokenizer.decode(O);Se.push({text:Y})}return pe?Se[0]:Se}async _call_whisper(q,R){const pe=R.return_timestamps??!1,xe=R.chunk_length_s??0,be=R.force_full_sequences??!1;let Se=R.stride_length_s??null;const Ae={...R};pe==="word"&&(Ae.return_token_timestamps=!0,Ae.return_timestamps=!1);const Fe=!Array.isArray(q);Fe&&(q=[q]);const ze=this.processor.feature_extractor.config.chunk_length/this.model.config.max_source_positions,Ve=this.processor.feature_extractor.config.hop_length,O=this.processor.feature_extractor.config.sampling_rate,Y=await f(q,O),z=[];for(const J of Y){let le=[];if(xe>0){if(Se===null)Se=xe/6;else if(xe<=Se)throw Error("`chunk_length_s` must be larger than `stride_length_s`.");const ke=O*xe,Ie=O*Se,Re=ke-2*Ie;let Xe=0;for(;;){const Ge=Xe+ke,lt=J.subarray(Xe,Ge),wt=await this.processor(lt),Gt=Xe===0,Ot=Ge>=J.length;if(le.push({stride:[lt.length,Gt?0:Ie,Ot?0:Ie],input_features:wt.input_features,is_last:Ot}),Ot)break;Xe+=Re}}else le=[{stride:[J.length,0,0],input_features:(await this.processor(J)).input_features,is_last:!0}];for(const ke of le){Ae.num_frames=Math.floor(ke.stride[0]/Ve);const Ie=await this.model.generate({inputs:ke.input_features,...Ae});pe==="word"?(ke.tokens=Ie.sequences.tolist()[0],ke.token_timestamps=Ie.token_timestamps.tolist()[0].map(Re=>(0,l.round)(Re,2))):ke.tokens=Ie[0].tolist(),ke.stride=ke.stride.map(Re=>Re/O)}const[ye,Ee]=this.tokenizer._decode_asr(le,{time_precision:ze,return_timestamps:pe,force_full_sequences:be});z.push({text:ye,...Ee})}return Fe?z[0]:z}async _call_moonshine(q,R){const pe=!Array.isArray(q);pe&&(q=[q]);const xe=this.processor.feature_extractor.config.sampling_rate,be=await f(q,xe),Se=[];for(const Ae of be){const Fe=await this.processor(Ae),ze=Math.floor(Ae.length/xe)*6,Ve=await this.model.generate({max_new_tokens:ze,...R,...Fe}),O=this.processor.batch_decode(Ve,{skip_special_tokens:!0})[0];Se.push({text:O})}return pe?Se[0]:Se}}class H extends T{constructor(q){super(q)}async _call(q,R={}){const pe=Array.isArray(q),xe=await c(q),{pixel_values:be}=await this.processor(xe),Se=[];for(const Ae of be){Ae.dims=[1,...Ae.dims];const Fe=await this.model.generate({inputs:Ae,...R}),ze=this.tokenizer.batch_decode(Fe,{skip_special_tokens:!0}).map(Ve=>({generated_text:Ve.trim()}));Se.push(ze)}return pe?Se:Se[0]}}class Z extends T{constructor(q){super(q)}async _call(q,{top_k:R=5}={}){const pe=await c(q),{pixel_values:xe}=await this.processor(pe),be=await this.model({pixel_values:xe}),Se=this.model.config.id2label,Ae=[];for(const Fe of be.logits){const ze=await(0,p.topk)(new p.Tensor("float32",(0,l.softmax)(Fe.data),Fe.dims),R),Ve=ze[0].tolist(),Y=ze[1].tolist().map((z,J)=>({label:Se?Se[z]:`LABEL_${z}`,score:Ve[J]}));Ae.push(Y)}return Array.isArray(q)?Ae:Ae[0]}}class X extends T{constructor(q){super(q),this.subtasks_mapping={panoptic:"post_process_panoptic_segmentation",instance:"post_process_instance_segmentation",semantic:"post_process_semantic_segmentation"}}async _call(q,{threshold:R=.5,mask_threshold:pe=.5,overlap_mask_area_threshold:xe=.8,label_ids_to_fuse:be=null,target_sizes:Se=null,subtask:Ae=null}={}){if(Array.isArray(q)&&q.length!==1)throw Error("Image segmentation pipeline currently only supports a batch size of 1.");const ze=await c(q),Ve=ze.map(ke=>[ke.height,ke.width]),O=await this.processor(ze),{inputNames:Y,outputNames:z}=this.model.sessions.model;if(!Y.includes("pixel_values")){if(Y.length!==1)throw Error(`Expected a single input name, but got ${Y.length} inputs: ${Y}.`);const ke=Y[0];if(ke in O)throw Error(`Input name ${ke} already exists in the inputs.`);O[ke]=O.pixel_values}const J=await this.model(O);let le=null;if(Ae!==null)le=this.subtasks_mapping[Ae];else if(this.processor.image_processor){for(const[ke,Ie]of Object.entries(this.subtasks_mapping))if(Ie in this.processor.image_processor){le=this.processor.image_processor[Ie].bind(this.processor.image_processor),Ae=ke;break}}const ye=this.model.config.id2label,Ee=[];if(Ae)if(Ae==="panoptic"||Ae==="instance"){const ke=le(J,R,pe,xe,be,Se??Ve)[0],Ie=ke.segmentation;for(const Re of ke.segments_info){const Xe=new Uint8ClampedArray(Ie.data.length);for(let lt=0;ltwt<-1e-5||wt>1+1e-5)&&Ge.sigmoid_();const lt=await d.RawImage.fromTensor(Ge.mul_(255).to("uint8")).resize(Xe[1],Xe[0]);Ee.push({label:null,score:null,mask:lt})}}return Ee}}class oe extends X{constructor(q){super(q)}async _call(q,R={}){if(Array.isArray(q)&&q.length!==1)throw Error("Background removal pipeline currently only supports a batch size of 1.");const xe=await c(q),be=await super._call(q,R);return xe.map((Ae,Fe)=>{const ze=Ae.clone();return ze.putAlpha(be[Fe].mask),ze})}}class me extends T{constructor(q){super(q)}async _call(q,R,{hypothesis_template:pe="This is a photo of {}"}={}){const xe=Array.isArray(q),be=await c(q),Se=R.map(Y=>pe.replace("{}",Y)),Ae=this.tokenizer(Se,{padding:this.model.config.model_type==="siglip"?"max_length":!0,truncation:!0}),{pixel_values:Fe}=await this.processor(be),ze=await this.model({...Ae,pixel_values:Fe}),Ve=this.model.config.model_type==="siglip"?Y=>Y.sigmoid().data:Y=>(0,l.softmax)(Y.data),O=[];for(const Y of ze.logits_per_image){const J=[...Ve(Y)].map((le,ye)=>({score:le,label:R[ye]}));J.sort((le,ye)=>ye.score-le.score),O.push(J)}return xe?O:O[0]}}class ae extends T{constructor(q){super(q)}async _call(q,{threshold:R=.9,percentage:pe=!1}={}){const xe=Array.isArray(q);if(xe&&q.length!==1)throw Error("Object detection pipeline currently only supports a batch size of 1.");const be=await c(q),Se=pe?null:be.map(z=>[z.height,z.width]),{pixel_values:Ae,pixel_mask:Fe}=await this.processor(be),ze=await this.model({pixel_values:Ae,pixel_mask:Fe}),Ve=this.processor.image_processor.post_process_object_detection(ze,R,Se),O=this.model.config.id2label,Y=Ve.map(z=>z.boxes.map((J,le)=>({score:z.scores[le],label:O[z.classes[le]],box:_(J,!pe)})));return xe?Y:Y[0]}}class V extends T{constructor(q){super(q)}async _call(q,R,{threshold:pe=.1,top_k:xe=null,percentage:be=!1}={}){const Se=Array.isArray(q),Ae=await c(q),Fe=this.tokenizer(R,{padding:!0,truncation:!0}),ze=await this.processor(Ae),Ve=[];for(let O=0;O({score:Ee.scores[Ie],label:Ee.labels[Ie],box:_(ke,!be)}))}else{const Ee=this.processor.image_processor.post_process_object_detection(le,pe,z,!0)[0];ye=Ee.boxes.map((ke,Ie)=>({score:Ee.scores[Ie],label:R[Ee.classes[Ie]],box:_(ke,!be)}))}ye.sort((Ee,ke)=>ke.score-Ee.score),xe!==null&&(ye=ye.slice(0,xe)),Ve.push(ye)}return Se?Ve:Ve[0]}}class F extends T{constructor(q){super(q)}async _call(q,R,pe={}){const xe=(await c(q))[0],{pixel_values:be}=await this.processor(xe),Se=`${R}`,Ae=this.tokenizer(Se,{add_special_tokens:!1,padding:!0,truncation:!0}).input_ids,Fe=await this.model.generate({inputs:be,max_length:this.model.config.decoder.max_position_embeddings,decoder_input_ids:Ae,...pe}),Ve=this.tokenizer.batch_decode(Fe)[0].match(/(.*?)<\/s_answer>/);let O=null;return Ve&&Ve.length>=2&&(O=Ve[1].trim()),[{answer:O}]}}class W extends T{constructor(R){super(R);te(this,"DEFAULT_VOCODER_ID","Xenova/speecht5_hifigan");this.vocoder=R.vocoder??null}async _call(R,{speaker_embeddings:pe=null}={}){return this.processor?this._call_text_to_spectrogram(R,{speaker_embeddings:pe}):this._call_text_to_waveform(R)}async _call_text_to_waveform(R){const pe=this.tokenizer(R,{padding:!0,truncation:!0}),{waveform:xe}=await this.model(pe),be=this.model.config.sampling_rate;return new u.RawAudio(xe.data,be)}async _call_text_to_spectrogram(R,{speaker_embeddings:pe}){if(this.vocoder||(console.log("No vocoder specified, using default HifiGan vocoder."),this.vocoder=await o.AutoModel.from_pretrained(this.DEFAULT_VOCODER_ID,{dtype:"fp32"})),(typeof pe=="string"||pe instanceof URL)&&(pe=new Float32Array(await(await fetch(pe)).arrayBuffer())),pe instanceof Float32Array)pe=new p.Tensor("float32",pe,[1,pe.length]);else if(!(pe instanceof p.Tensor))throw new Error("Speaker embeddings must be a `Tensor`, `Float32Array`, `string`, or `URL`.");const{input_ids:xe}=this.tokenizer(R,{padding:!0,truncation:!0}),{waveform:be}=await this.model.generate_speech(xe,pe,{vocoder:this.vocoder}),Se=this.processor.feature_extractor.config.sampling_rate;return new u.RawAudio(be.data,Se)}}class re extends T{constructor(q){super(q)}async _call(q){const R=await c(q),pe=await this.processor(R),xe=await this.model(pe),be=[];for(const Se of xe.reconstruction){const Ae=Se.squeeze().clamp_(0,1).mul_(255).round_().to("uint8");be.push(d.RawImage.fromTensor(Ae))}return be.length>1?be:be[0]}}class _e extends T{constructor(q){super(q)}async _call(q){const R=await c(q),pe=await this.processor(R),{predicted_depth:xe}=await this.model(pe),be=[];for(let Se=0;Se1?be:be[0]}}const se=Object.freeze({"text-classification":{tokenizer:s.AutoTokenizer,pipeline:k,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-finetuned-sst-2-english"},type:"text"},"token-classification":{tokenizer:s.AutoTokenizer,pipeline:w,model:o.AutoModelForTokenClassification,default:{model:"Xenova/bert-base-multilingual-cased-ner-hrl"},type:"text"},"question-answering":{tokenizer:s.AutoTokenizer,pipeline:g,model:o.AutoModelForQuestionAnswering,default:{model:"Xenova/distilbert-base-cased-distilled-squad"},type:"text"},"fill-mask":{tokenizer:s.AutoTokenizer,pipeline:S,model:o.AutoModelForMaskedLM,default:{model:"Xenova/bert-base-uncased"},type:"text"},summarization:{tokenizer:s.AutoTokenizer,pipeline:y,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/distilbart-cnn-6-6"},type:"text"},translation:{tokenizer:s.AutoTokenizer,pipeline:M,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/t5-small"},type:"text"},"text2text-generation":{tokenizer:s.AutoTokenizer,pipeline:E,model:o.AutoModelForSeq2SeqLM,default:{model:"Xenova/flan-t5-small"},type:"text"},"text-generation":{tokenizer:s.AutoTokenizer,pipeline:C,model:o.AutoModelForCausalLM,default:{model:"Xenova/gpt2"},type:"text"},"zero-shot-classification":{tokenizer:s.AutoTokenizer,pipeline:A,model:o.AutoModelForSequenceClassification,default:{model:"Xenova/distilbert-base-uncased-mnli"},type:"text"},"audio-classification":{pipeline:G,model:o.AutoModelForAudioClassification,processor:n.AutoProcessor,default:{model:"Xenova/wav2vec2-base-superb-ks"},type:"audio"},"zero-shot-audio-classification":{tokenizer:s.AutoTokenizer,pipeline:j,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clap-htsat-unfused"},type:"multimodal"},"automatic-speech-recognition":{tokenizer:s.AutoTokenizer,pipeline:ee,model:[o.AutoModelForSpeechSeq2Seq,o.AutoModelForCTC],processor:n.AutoProcessor,default:{model:"Xenova/whisper-tiny.en"},type:"multimodal"},"text-to-audio":{tokenizer:s.AutoTokenizer,pipeline:W,model:[o.AutoModelForTextToWaveform,o.AutoModelForTextToSpectrogram],processor:[n.AutoProcessor,null],default:{model:"Xenova/speecht5_tts"},type:"text"},"image-to-text":{tokenizer:s.AutoTokenizer,pipeline:H,model:o.AutoModelForVision2Seq,processor:n.AutoProcessor,default:{model:"Xenova/vit-gpt2-image-captioning"},type:"multimodal"},"image-classification":{pipeline:Z,model:o.AutoModelForImageClassification,processor:n.AutoProcessor,default:{model:"Xenova/vit-base-patch16-224"},type:"multimodal"},"image-segmentation":{pipeline:X,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50-panoptic"},type:"multimodal"},"background-removal":{pipeline:oe,model:[o.AutoModelForImageSegmentation,o.AutoModelForSemanticSegmentation,o.AutoModelForUniversalSegmentation],processor:n.AutoProcessor,default:{model:"Xenova/modnet"},type:"image"},"zero-shot-image-classification":{tokenizer:s.AutoTokenizer,pipeline:me,model:o.AutoModel,processor:n.AutoProcessor,default:{model:"Xenova/clip-vit-base-patch32"},type:"multimodal"},"object-detection":{pipeline:ae,model:o.AutoModelForObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/detr-resnet-50"},type:"multimodal"},"zero-shot-object-detection":{tokenizer:s.AutoTokenizer,pipeline:V,model:o.AutoModelForZeroShotObjectDetection,processor:n.AutoProcessor,default:{model:"Xenova/owlvit-base-patch32"},type:"multimodal"},"document-question-answering":{tokenizer:s.AutoTokenizer,pipeline:F,model:o.AutoModelForDocumentQuestionAnswering,processor:n.AutoProcessor,default:{model:"Xenova/donut-base-finetuned-docvqa"},type:"multimodal"},"image-to-image":{pipeline:re,model:o.AutoModelForImageToImage,processor:n.AutoProcessor,default:{model:"Xenova/swin2SR-classical-sr-x2-64"},type:"image"},"depth-estimation":{pipeline:_e,model:o.AutoModelForDepthEstimation,processor:n.AutoProcessor,default:{model:"Xenova/dpt-large"},type:"image"},"feature-extraction":{tokenizer:s.AutoTokenizer,pipeline:B,model:o.AutoModel,default:{model:"Xenova/all-MiniLM-L6-v2"},type:"text"},"image-feature-extraction":{processor:n.AutoProcessor,pipeline:K,model:[o.AutoModelForImageFeatureExtraction,o.AutoModel],default:{model:"Xenova/vit-base-patch16-224-in21k"},type:"image"}}),ce=Object.freeze({"sentiment-analysis":"text-classification",ner:"token-classification",asr:"automatic-speech-recognition","text-to-speech":"text-to-audio",embeddings:"feature-extraction"});async function $e(we,q=null,{progress_callback:R=null,config:pe=null,cache_dir:xe=null,local_files_only:be=!1,revision:Se="main",device:Ae=null,dtype:Fe=null,subfolder:ze="onnx",use_external_data_format:Ve=null,model_file_name:O=null,session_options:Y={}}={}){we=ce[we]??we;const z=se[we.split("_",1)[0]];if(!z)throw Error(`Unsupported pipeline: ${we}. Must be one of [${Object.keys(se)}]`);q||(q=z.default.model,console.log(`No model specified. Using default model: "${q}".`));const J={progress_callback:R,config:pe,cache_dir:xe,local_files_only:be,revision:Se,device:Ae,dtype:Fe,subfolder:ze,use_external_data_format:Ve,model_file_name:O,session_options:Y},le=new Map([["tokenizer",z.tokenizer],["model",z.model],["processor",z.processor]]),ye=await Ue(le,q,J);ye.task=we,(0,a.dispatchCallback)(R,{status:"ready",task:we,model:q});const Ee=z.pipeline;return new Ee(ye)}async function Ue(we,q,R){const pe=Object.create(null),xe=[];for(const[be,Se]of we.entries()){if(!Se)continue;let Ae;Array.isArray(Se)?Ae=new Promise(async(Fe,ze)=>{var O,Y;let Ve;for(const z of Se){if(z===null){Fe(null);return}try{Fe(await z.from_pretrained(q,R));return}catch(J){if((O=J.message)!=null&&O.includes("Unsupported model type"))Ve=J;else if((Y=J.message)!=null&&Y.includes("Could not locate file"))Ve=J;else{ze(J);return}}}ze(Ve)}):Ae=Se.from_pretrained(q,R),pe[be]=Ae,xe.push(Ae)}await Promise.all(xe);for(const[be,Se]of Object.entries(pe))pe[be]=await Se;return pe}},"./src/tokenizers.js":(e,r,t)=>{t.r(r),t.d(r,{AlbertTokenizer:()=>Ar,AutoTokenizer:()=>vn,BartTokenizer:()=>hs,BertTokenizer:()=>us,BlenderbotSmallTokenizer:()=>vs,BlenderbotTokenizer:()=>wn,BloomTokenizer:()=>Hr,CLIPTokenizer:()=>mn,CamembertTokenizer:()=>tt,CodeGenTokenizer:()=>Br,CodeLlamaTokenizer:()=>xr,CohereTokenizer:()=>yn,ConvBertTokenizer:()=>Qt,DebertaTokenizer:()=>ds,DebertaV2Tokenizer:()=>cs,DistilBertTokenizer:()=>Qe,ElectraTokenizer:()=>zr,EsmTokenizer:()=>pn,FalconTokenizer:()=>fr,GPT2Tokenizer:()=>ps,GPTNeoXTokenizer:()=>Vs,GemmaTokenizer:()=>hn,Grok1Tokenizer:()=>qr,HerbertTokenizer:()=>ys,LlamaTokenizer:()=>cn,M2M100Tokenizer:()=>dr,MBart50Tokenizer:()=>ms,MBartTokenizer:()=>Kr,MPNetTokenizer:()=>ks,MarianTokenizer:()=>fn,MgpstrTokenizer:()=>xs,MobileBertTokenizer:()=>bs,NllbTokenizer:()=>Is,NougatTokenizer:()=>Us,PreTrainedTokenizer:()=>at,Qwen2Tokenizer:()=>Fr,RoFormerTokenizer:()=>De,RobertaTokenizer:()=>_s,SiglipTokenizer:()=>_n,SpeechT5Tokenizer:()=>Mn,SqueezeBertTokenizer:()=>Ft,T5Tokenizer:()=>Sr,TokenizerModel:()=>K,VitsTokenizer:()=>bn,Wav2Vec2CTCTokenizer:()=>gn,WhisperTokenizer:()=>gr,XLMRobertaTokenizer:()=>$s,XLMTokenizer:()=>Rt,is_chinese_char:()=>S});var s=t("./src/utils/generic.js"),o=t("./src/utils/core.js"),n=t("./src/utils/hub.js"),i=t("./src/utils/maths.js"),a=t("./src/utils/tensor.js"),l=t("./src/utils/data-structures.js"),u=t("./node_modules/@huggingface/jinja/dist/index.js"),p=t("./src/models/whisper/common_whisper.js");async function d(he,$){const N=await Promise.all([(0,n.getModelJSON)(he,"tokenizer.json",!0,$),(0,n.getModelJSON)(he,"tokenizer_config.json",!0,$)]);return $.legacy!==null&&(N[1].legacy=$.legacy),N}function c(he,$){const N=[];let Q=0;for(const ie of he.matchAll($)){const de=ie[0];Q0&&N.push(de),Q=ie.index+de.length}return Q=19968&&he<=40959||he>=13312&&he<=19903||he>=131072&&he<=173791||he>=173824&&he<=177983||he>=177984&&he<=178207||he>=178208&&he<=183983||he>=63744&&he<=64255||he>=194560&&he<=195103}function E(he,$,N){const Q=[];let ie=0;for(;iethis.tokens_to_ids.get(N)??this.unk_token_id)}convert_ids_to_tokens($){return $.map(N=>this.vocab[N]??this.unk_token)}}class G extends K{constructor($){super($),this.tokens_to_ids=_($.vocab),this.unk_token_id=this.tokens_to_ids.get($.unk_token),this.unk_token=$.unk_token,this.max_input_chars_per_word=$.max_input_chars_per_word??100,this.vocab=new Array(this.tokens_to_ids.size);for(const[N,Q]of this.tokens_to_ids)this.vocab[Q]=N}encode($){const N=[];for(const Q of $){const ie=[...Q];if(ie.length>this.max_input_chars_per_word){N.push(this.unk_token);continue}let de=!1,ve=0;const je=[];for(;ve0&&(Je=this.config.continuing_subword_prefix+Je),this.tokens_to_ids.has(Je)){We=Je;break}--He}if(We===null){de=!0;break}je.push(We),ve=He}de?N.push(this.unk_token):N.push(...je)}return N}}class j extends K{constructor($,N){super($);const Q=$.vocab.length;this.vocab=new Array(Q),this.scores=new Array(Q);for(let ie=0;ie[ie,de])),this.bos_token=" ",this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=N.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.unk_token=this.vocab[this.unk_token_id],this.minScore=(0,i.min)(this.scores)[0],this.unk_score=this.minScore-10,this.scores[this.unk_token_id]=this.unk_score,this.trie=new l.CharTrie,this.trie.extend(this.vocab),this.fuse_unk=!0}populateNodes($){const N=$.chars,Q=1;let ie=0;for(;ie{const he=[...Array.from({length:94},(ie,de)=>de+33),...Array.from({length:12},(ie,de)=>de+161),...Array.from({length:82},(ie,de)=>de+174)],$=he.slice();let N=0;for(let ie=0;ie<256;++ie)he.includes(ie)||(he.push(ie),$.push(256+N),N+=1);const Q=$.map(ie=>String.fromCharCode(ie));return Object.fromEntries(he.map((ie,de)=>[ie,Q[de]]))})(),H=(0,o.reverseDictionary)(ee);class Z extends K{constructor($){super($),this.tokens_to_ids=_($.vocab),this.unk_token_id=this.tokens_to_ids.get($.unk_token),this.unk_token=$.unk_token,this.vocab=new Array(this.tokens_to_ids.size);for(const[Q,ie]of this.tokens_to_ids)this.vocab[ie]=Q;const N=Array.isArray($.merges[0]);this.merges=N?$.merges:$.merges.map(Q=>Q.split(" ",2)),this.bpe_ranks=new Map(this.merges.map((Q,ie)=>[JSON.stringify(Q),ie])),this.end_of_word_suffix=$.end_of_word_suffix,this.continuing_subword_suffix=$.continuing_subword_suffix??null,this.byte_fallback=this.config.byte_fallback??!1,this.byte_fallback&&(this.text_encoder=new TextEncoder),this.ignore_merges=this.config.ignore_merges??!1,this.max_length_to_cache=256,this.cache_capacity=1e4,this.cache=new l.LRUCache(this.cache_capacity)}clear_cache(){this.cache.clear()}bpe($){if($.length===0)return[];const N=this.cache.get($);if(N!==void 0)return N;const Q=Array.from($);this.end_of_word_suffix&&(Q[Q.length-1]+=this.end_of_word_suffix);let ie=[];if(Q.length>1){const de=new l.PriorityQueue((He,We)=>He.score`<0x${je.toString(16).toUpperCase().padStart(2,"0")}>`);ve.every(je=>this.tokens_to_ids.has(je))?N.push(...ve):N.push(this.unk_token)}else N.push(this.unk_token)}return N}}class X extends K{constructor($,N){super($),this.tokens_to_ids=_(N.target_lang?$.vocab[N.target_lang]:$.vocab),this.bos_token=N.bos_token,this.bos_token_id=this.tokens_to_ids.get(this.bos_token),this.eos_token=N.eos_token,this.eos_token_id=this.tokens_to_ids.get(this.eos_token),this.pad_token=N.pad_token,this.pad_token_id=this.tokens_to_ids.get(this.pad_token),this.unk_token=N.unk_token,this.unk_token_id=this.tokens_to_ids.get(this.unk_token),this.vocab=new Array(this.tokens_to_ids.size);for(const[Q,ie]of this.tokens_to_ids)this.vocab[ie]=Q}encode($){return $}}class oe extends s.Callable{constructor($){super(),this.config=$}static fromConfig($){if($===null)return null;switch($.type){case"BertNormalizer":return new we($);case"Precompiled":return new Ot($);case"Sequence":return new Ue($);case"Replace":return new me($);case"NFC":return new V($);case"NFD":return new F($);case"NFKC":return new W($);case"NFKD":return new re($);case"Strip":return new _e($);case"StripAccents":return new se($);case"Lowercase":return new ce($);case"Prepend":return new $e($);default:throw new Error(`Unknown Normalizer type: ${$.type}`)}}normalize($){throw Error("normalize should be implemented in subclass.")}_call($){return this.normalize($)}}class me extends oe{normalize($){const N=f(this.config.pattern);return N===null?$:$.replaceAll(N,this.config.content)}}class ae extends oe{constructor(){super(...arguments);te(this,"form")}normalize(N){return N=N.normalize(this.form),N}}class V extends ae{constructor(){super(...arguments);te(this,"form","NFC")}}class F extends ae{constructor(){super(...arguments);te(this,"form","NFD")}}class W extends ae{constructor(){super(...arguments);te(this,"form","NFKC")}}class re extends ae{constructor(){super(...arguments);te(this,"form","NFKD")}}class _e extends oe{normalize($){return this.config.strip_left&&this.config.strip_right?$=$.trim():(this.config.strip_left&&($=$.trimStart()),this.config.strip_right&&($=$.trimEnd())),$}}class se extends oe{normalize($){return $=w($),$}}class ce extends oe{normalize($){return $=$.toLowerCase(),$}}class $e extends oe{normalize($){return $=this.config.prepend+$,$}}class Ue extends oe{constructor($){super($),this.normalizers=$.normalizers.map(N=>oe.fromConfig(N))}normalize($){return this.normalizers.reduce((N,Q)=>Q.normalize(N),$)}}class we extends oe{_tokenize_chinese_chars($){const N=[];for(let Q=0;Q<$.length;++Q){const ie=$[Q],de=ie.charCodeAt(0);S(de)?(N.push(" "),N.push(ie),N.push(" ")):N.push(ie)}return N.join("")}stripAccents($){return $.normalize("NFD").replace(new RegExp("\\p{Mn}","gu"),"")}_is_control($){switch($){case" ":case` +`:case"\r":return!1;default:return new RegExp("^\\p{Cc}|\\p{Cf}|\\p{Co}|\\p{Cs}$","u").test($)}}_clean_text($){const N=[];for(const Q of $){const ie=Q.charCodeAt(0);ie===0||ie===65533||this._is_control(Q)||(/^\s$/.test(Q)?N.push(" "):N.push(Q))}return N.join("")}normalize($){return this.config.clean_text&&($=this._clean_text($)),this.config.handle_chinese_chars&&($=this._tokenize_chinese_chars($)),this.config.lowercase?($=$.toLowerCase(),this.config.strip_accents!==!1&&($=this.stripAccents($))):this.config.strip_accents&&($=this.stripAccents($)),$}}class q extends s.Callable{static fromConfig($){if($===null)return null;switch($.type){case"BertPreTokenizer":return new R($);case"Sequence":return new ur($);case"Whitespace":return new ls($);case"WhitespaceSplit":return new Ms($);case"Metaspace":return new wt($);case"ByteLevel":return new pe($);case"Split":return new xe($);case"Punctuation":return new be($);case"Digits":return new Se($);case"Replace":return new Ir($);default:throw new Error(`Unknown PreTokenizer type: ${$.type}`)}}pre_tokenize_text($,N){throw Error("pre_tokenize_text should be implemented in subclass.")}pre_tokenize($,N){return(Array.isArray($)?$.map(Q=>this.pre_tokenize_text(Q,N)):this.pre_tokenize_text($,N)).flat()}_call($,N){return this.pre_tokenize($,N)}}class R extends q{constructor($){super(),this.pattern=new RegExp(`[^\\s${M}]+|[${M}]`,"gu")}pre_tokenize_text($,N){return $.trim().match(this.pattern)||[]}}class pe extends q{constructor($){super(),this.config=$,this.add_prefix_space=this.config.add_prefix_space,this.trim_offsets=this.config.trim_offsets,this.use_regex=this.config.use_regex??!0,this.pattern=new RegExp("'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)|\\s+","gu"),this.byte_encoder=ee,this.text_encoder=new TextEncoder}pre_tokenize_text($,N){return this.add_prefix_space&&!$.startsWith(" ")&&($=" "+$),(this.use_regex?$.match(this.pattern)||[]:[$]).map(ie=>Array.from(this.text_encoder.encode(ie),de=>this.byte_encoder[de]).join(""))}}class xe extends q{constructor($){super(),this.config=$,this.pattern=f(this.config.pattern,this.config.invert)}pre_tokenize_text($,N){var Q;return this.pattern===null?[]:this.config.invert?$.match(this.pattern)||[]:((Q=this.config.behavior)==null?void 0:Q.toLowerCase())==="removed"?$.split(this.pattern).filter(ie=>ie):c($,this.pattern)}}class be extends q{constructor($){super(),this.config=$,this.pattern=new RegExp(`[^${M}]+|[${M}]+`,"gu")}pre_tokenize_text($,N){return $.match(this.pattern)||[]}}class Se extends q{constructor($){super(),this.config=$;const N=`[^\\d]+|\\d${this.config.individual_digits?"":"+"}`;this.pattern=new RegExp(N,"gu")}pre_tokenize_text($,N){return $.match(this.pattern)||[]}}class Ae extends s.Callable{constructor($){super(),this.config=$}static fromConfig($){if($===null)return null;switch($.type){case"TemplateProcessing":return new Ve($);case"ByteLevel":return new O($);case"RobertaProcessing":return new ze($);case"BertProcessing":return new Fe($);case"Sequence":return new Y($);default:throw new Error(`Unknown PostProcessor type: ${$.type}`)}}post_process($,...N){throw Error("post_process should be implemented in subclass.")}_call($,...N){return this.post_process($,...N)}}class Fe extends Ae{constructor($){super($),this.cls=$.cls[0],this.sep=$.sep[0]}post_process($,N=null,{add_special_tokens:Q=!0}={}){Q&&($=(0,o.mergeArrays)([this.cls],$,[this.sep]));let ie=new Array($.length).fill(0);if(N!==null){const de=Q&&this instanceof ze?[this.sep]:[],ve=Q?[this.sep]:[];$=(0,o.mergeArrays)($,de,N,ve),ie=(0,o.mergeArrays)(ie,new Array(N.length+de.length+ve.length).fill(1))}return{tokens:$,token_type_ids:ie}}}class ze extends Fe{}class Ve extends Ae{constructor($){super($),this.single=$.single,this.pair=$.pair}post_process($,N=null,{add_special_tokens:Q=!0}={}){const ie=N===null?this.single:this.pair;let de=[],ve=[];for(const je of ie)"SpecialToken"in je?Q&&(de.push(je.SpecialToken.id),ve.push(je.SpecialToken.type_id)):"Sequence"in je&&(je.Sequence.id==="A"?(de=(0,o.mergeArrays)(de,$),ve=(0,o.mergeArrays)(ve,new Array($.length).fill(je.Sequence.type_id))):je.Sequence.id==="B"&&(de=(0,o.mergeArrays)(de,N),ve=(0,o.mergeArrays)(ve,new Array(N.length).fill(je.Sequence.type_id))));return{tokens:de,token_type_ids:ve}}}class O extends Ae{post_process($,N=null){return N&&($=(0,o.mergeArrays)($,N)),{tokens:$}}}class Y extends Ae{constructor($){super($),this.processors=$.processors.map(N=>Ae.fromConfig(N))}post_process($,N=null,Q={}){let ie;for(const de of this.processors)if(de instanceof O)$=de.post_process($).tokens,N&&(N=de.post_process(N).tokens);else{const ve=de.post_process($,N,Q);$=ve.tokens,ie=ve.token_type_ids}return{tokens:$,token_type_ids:ie}}}class z extends s.Callable{constructor($){super(),this.config=$,this.added_tokens=[],this.end_of_word_suffix=null,this.trim_offsets=$.trim_offsets}static fromConfig($){if($===null)return null;switch($.type){case"WordPiece":return new ke($);case"Metaspace":return new Gt($);case"ByteLevel":return new Ie($);case"Replace":return new J($);case"ByteFallback":return new le($);case"Fuse":return new ye($);case"Strip":return new Ee($);case"Sequence":return new Xe($);case"CTC":return new Re($);case"BPEDecoder":return new Ge($);default:throw new Error(`Unknown Decoder type: ${$.type}`)}}_call($){return this.decode($)}decode($){return this.decode_chain($).join("")}decode_chain($){throw Error("`decode_chain` should be implemented in subclass.")}}class J extends z{decode_chain($){const N=f(this.config.pattern);return N===null?$:$.map(Q=>Q.replaceAll(N,this.config.content))}}class le extends z{constructor($){super($),this.text_decoder=new TextDecoder}decode_chain($){const N=[];let Q=[];for(const ie of $){let de=null;if(ie.length===6&&ie.startsWith("<0x")&&ie.endsWith(">")){const ve=parseInt(ie.slice(3,5),16);isNaN(ve)||(de=ve)}if(de!==null)Q.push(de);else{if(Q.length>0){const ve=this.text_decoder.decode(Uint8Array.from(Q));N.push(ve),Q=[]}N.push(ie)}}if(Q.length>0){const ie=this.text_decoder.decode(Uint8Array.from(Q));N.push(ie),Q=[]}return N}}class ye extends z{decode_chain($){return[$.join("")]}}class Ee extends z{constructor($){super($),this.content=this.config.content,this.start=this.config.start,this.stop=this.config.stop}decode_chain($){return $.map(N=>{let Q=0;for(let de=0;de(Q!==0&&(N.startsWith(this.config.prefix)?N=N.replace(this.config.prefix,""):N=" "+N),this.cleanup&&(N=k(N)),N))}}class Ie extends z{constructor($){super($),this.byte_decoder=H,this.text_decoder=new TextDecoder("utf-8",{fatal:!1,ignoreBOM:!0}),this.end_of_word_suffix=null}convert_tokens_to_string($){const N=$.join(""),Q=new Uint8Array([...N].map(de=>this.byte_decoder[de]));return this.text_decoder.decode(Q)}decode_chain($){const N=[];let Q=[];for(const ie of $)this.added_tokens.find(de=>de.content===ie)!==void 0?(Q.length>0&&(N.push(this.convert_tokens_to_string(Q)),Q=[]),N.push(ie)):Q.push(ie);return Q.length>0&&N.push(this.convert_tokens_to_string(Q)),N}}class Re extends z{constructor($){super($),this.pad_token=this.config.pad_token,this.word_delimiter_token=this.config.word_delimiter_token,this.cleanup=this.config.cleanup}convert_tokens_to_string($){if($.length===0)return"";const N=[$[0]];for(let de=1;de<$.length;++de)$[de]!==N.at(-1)&&N.push($[de]);let ie=N.filter(de=>de!==this.pad_token).join("");return this.cleanup&&(ie=k(ie).replaceAll(this.word_delimiter_token," ").trim()),ie}decode_chain($){return[this.convert_tokens_to_string($)]}}class Xe extends z{constructor($){super($),this.decoders=$.decoders.map(N=>z.fromConfig(N))}decode_chain($){return this.decoders.reduce((N,Q)=>Q.decode_chain(N),$)}}class Ge extends z{constructor($){super($),this.suffix=this.config.suffix}decode_chain($){return $.map((N,Q)=>N.replaceAll(this.suffix,Q===$.length-1?"":" "))}}class lt extends z{decode_chain($){let N="";for(let Q=1;Q<$.length;Q+=2)N+=$[Q];return[N]}}class wt extends q{constructor($){super(),this.addPrefixSpace=$.add_prefix_space,this.replacement=$.replacement,this.strRep=$.str_rep||this.replacement,this.prepend_scheme=$.prepend_scheme??"always"}pre_tokenize_text($,{section_index:N=void 0}={}){let Q=$.replaceAll(" ",this.strRep);return this.addPrefixSpace&&!Q.startsWith(this.replacement)&&(this.prepend_scheme==="always"||this.prepend_scheme==="first"&&N===0)&&(Q=this.strRep+Q),[Q]}}class Gt extends z{constructor($){super($),this.addPrefixSpace=$.add_prefix_space,this.replacement=$.replacement}decode_chain($){const N=[];for(let Q=0;Q<$.length;++Q){let ie=$[Q].replaceAll(this.replacement," ");this.addPrefixSpace&&Q==0&&ie.startsWith(" ")&&(ie=ie.substring(1)),N.push(ie)}return N}}class Ot extends oe{constructor($){super($),this.charsmap=$.precompiled_charsmap}normalize($){return $=$.replace(/[\u0001-\u0008\u000B\u000E-\u001F\u007F\u008F\u009F]/gm,""),$=$.replace(/[\u0009\u000A\u000C\u000D\u00A0\u1680\u2000-\u200F\u2028\u2029\u202F\u205F\u2581\u3000\uFEFF\uFFFD]/gm," "),$.includes("~")?$=$.split("~").map(Q=>Q.normalize("NFKC")).join("~"):$=$.normalize("NFKC"),$}}class ur extends q{constructor($){super(),this.tokenizers=$.pretokenizers.map(N=>q.fromConfig(N))}pre_tokenize_text($,N){return this.tokenizers.reduce((Q,ie)=>ie.pre_tokenize(Q,N),[$])}}class ls extends q{constructor($){super()}pre_tokenize_text($,N){return $.match(/\w+|[^\w\s]+/g)||[]}}class Ms extends q{constructor($){super()}pre_tokenize_text($,N){return y($)}}class Ir extends q{constructor($){super(),this.config=$,this.pattern=f(this.config.pattern),this.content=this.config.content}pre_tokenize_text($,N){return this.pattern===null?[$]:[$.replaceAll(this.pattern,this.config.content)]}}const js=["bos_token","eos_token","unk_token","sep_token","pad_token","cls_token","mask_token"];function Ss(he,$,N,Q){for(const ie of Object.keys(he)){const de=$-he[ie].length,ve=N(ie),je=new Array(de).fill(ve);he[ie]=Q==="right"?(0,o.mergeArrays)(he[ie],je):(0,o.mergeArrays)(je,he[ie])}}function Ns(he,$){for(const N of Object.keys(he))he[N].length=$}class at extends s.Callable{constructor(N,Q){super();te(this,"return_token_type_ids",!1);te(this,"padding_side","right");this._tokenizer_config=Q,this.normalizer=oe.fromConfig(N.normalizer),this.pre_tokenizer=q.fromConfig(N.pre_tokenizer),this.model=K.fromConfig(N.model,Q),this.post_processor=Ae.fromConfig(N.post_processor),this.decoder=z.fromConfig(N.decoder),this.special_tokens=[],this.all_special_ids=[],this.added_tokens=[];for(const ie of N.added_tokens){const de=new B(ie);this.added_tokens.push(de),this.model.tokens_to_ids.set(de.content,de.id),this.model.vocab[de.id]=de.content,de.special&&(this.special_tokens.push(de.content),this.all_special_ids.push(de.id))}if(this.additional_special_tokens=Q.additional_special_tokens??[],this.special_tokens.push(...this.additional_special_tokens),this.special_tokens=[...new Set(this.special_tokens)],this.decoder&&(this.decoder.added_tokens=this.added_tokens,this.decoder.end_of_word_suffix=this.model.end_of_word_suffix),this.added_tokens_splitter=new l.DictionarySplitter(this.added_tokens.map(ie=>ie.content)),this.added_tokens_map=new Map(this.added_tokens.map(ie=>[ie.content,ie])),this.mask_token=this.getToken("mask_token"),this.mask_token_id=this.model.tokens_to_ids.get(this.mask_token),this.pad_token=this.getToken("pad_token","eos_token"),this.pad_token_id=this.model.tokens_to_ids.get(this.pad_token),this.sep_token=this.getToken("sep_token"),this.sep_token_id=this.model.tokens_to_ids.get(this.sep_token),this.unk_token=this.getToken("unk_token"),this.unk_token_id=this.model.tokens_to_ids.get(this.unk_token),this.bos_token=this.getToken("bos_token"),this.bos_token_id=this.model.tokens_to_ids.get(this.bos_token),this.eos_token=this.getToken("eos_token"),this.eos_token_id=this.model.tokens_to_ids.get(this.eos_token),this.model_max_length=Q.model_max_length,this.remove_space=Q.remove_space,this.clean_up_tokenization_spaces=Q.clean_up_tokenization_spaces??!0,this.do_lowercase_and_remove_accent=Q.do_lowercase_and_remove_accent??!1,Q.padding_side&&(this.padding_side=Q.padding_side),this.legacy=!1,this.chat_template=Q.chat_template??null,Array.isArray(this.chat_template)){const ie=Object.create(null);for(const{name:de,template:ve}of this.chat_template){if(typeof de!="string"||typeof ve!="string")throw new Error('Chat template must be a list of objects with "name" and "template" properties');ie[de]=ve}this.chat_template=ie}this._compiled_template_cache=new Map}getToken(...N){for(const Q of N){const ie=this._tokenizer_config[Q];if(ie)if(typeof ie=="object"){if(ie.__type==="AddedToken")return ie.content;throw Error(`Unknown token: ${ie}`)}else return ie}return null}static async from_pretrained(N,{progress_callback:Q=null,config:ie=null,cache_dir:de=null,local_files_only:ve=!1,revision:je="main",legacy:He=null}={}){const We=await d(N,{progress_callback:Q,config:ie,cache_dir:de,local_files_only:ve,revision:je,legacy:He});return new this(...We)}_call(N,{text_pair:Q=null,add_special_tokens:ie=!0,padding:de=!1,truncation:ve=null,max_length:je=null,return_tensor:He=!0,return_token_type_ids:We=null}={}){const Je=Array.isArray(N);let dt;if(Je){if(N.length===0)throw Error("text array must be non-empty");if(Q!==null){if(Array.isArray(Q)){if(N.length!==Q.length)throw Error("text and text_pair must have the same length")}else throw Error("text_pair must also be an array");dt=N.map((Pt,jt)=>this._encode_plus(Pt,{text_pair:Q[jt],add_special_tokens:ie,return_token_type_ids:We}))}else dt=N.map(Pt=>this._encode_plus(Pt,{add_special_tokens:ie,return_token_type_ids:We}))}else{if(N==null)throw Error("text may not be null or undefined");if(Array.isArray(Q))throw Error("When specifying `text_pair`, since `text` is a string, `text_pair` must also be a string (i.e., not an array).");dt=[this._encode_plus(N,{text_pair:Q,add_special_tokens:ie,return_token_type_ids:We})]}if(je===null?de==="max_length"?je=this.model_max_length:je=(0,i.max)(dt.map(Pt=>Pt.input_ids.length))[0]:ve||console.warn("Truncation was not explicitly activated but `max_length` is provided a specific value, please use `truncation=true` to explicitly truncate examples to max length."),je=Math.min(je,this.model_max_length??1/0),de||ve)for(let Pt=0;Ptje?ve&&Ns(dt[Pt],je):de&&Ss(dt[Pt],je,jt=>jt==="input_ids"?this.pad_token_id:0,this.padding_side));const xt={};if(He){if(!(de&&ve)&&dt.some(jt=>{var kt;for(const Ht of Object.keys(jt))if(jt[Ht].length!==((kt=dt[0][Ht])==null?void 0:kt.length))return!0;return!1}))throw Error("Unable to create tensor, you should probably activate truncation and/or padding with 'padding=true' and 'truncation=true' to have batched tensors with the same length.");const Pt=[dt.length,dt[0].input_ids.length];for(const jt of Object.keys(dt[0]))xt[jt]=new a.Tensor("int64",BigInt64Array.from(dt.flatMap(kt=>kt[jt]).map(BigInt)),Pt)}else{for(const Pt of Object.keys(dt[0]))xt[Pt]=dt.map(jt=>jt[Pt]);if(!Je)for(const Pt of Object.keys(xt))xt[Pt]=xt[Pt][0]}return xt}_encode_text(N){if(N===null)return null;const Q=this.added_tokens_splitter.split(N);for(let de=0;de0&&(Q[de-1]=Q[de-1].trimEnd()),ve.rstrip&&de{if(de.length===0)return[];if(this.added_tokens_map.has(de))return[de];if(this.remove_space===!0&&(de=de.trim().split(/\s+/).join(" ")),this.do_lowercase_and_remove_accent&&(de=g(de)),this.normalizer!==null&&(de=this.normalizer(de)),de.length===0)return[];const je=this.pre_tokenizer!==null?this.pre_tokenizer(de,{section_index:ve}):[de];return this.model(je)})}_encode_plus(N,{text_pair:Q=null,add_special_tokens:ie=!0,return_token_type_ids:de=null}={}){const{tokens:ve,token_type_ids:je}=this._tokenize_helper(N,{pair:Q,add_special_tokens:ie}),He=this.model.convert_tokens_to_ids(ve),We={input_ids:He,attention_mask:new Array(He.length).fill(1)};return(de??this.return_token_type_ids)&&je&&(We.token_type_ids=je),We}_tokenize_helper(N,{pair:Q=null,add_special_tokens:ie=!1}={}){const de=this._encode_text(N),ve=this._encode_text(Q);return this.post_processor?this.post_processor(de,ve,{add_special_tokens:ie}):{tokens:(0,o.mergeArrays)(de??[],ve??[])}}tokenize(N,{pair:Q=null,add_special_tokens:ie=!1}={}){return this._tokenize_helper(N,{pair:Q,add_special_tokens:ie}).tokens}encode(N,{text_pair:Q=null,add_special_tokens:ie=!0,return_token_type_ids:de=null}={}){return this._encode_plus(N,{text_pair:Q,add_special_tokens:ie,return_token_type_ids:de}).input_ids}batch_decode(N,Q={}){return N instanceof a.Tensor&&(N=N.tolist()),N.map(ie=>this.decode(ie,Q))}decode(N,Q={}){if(N instanceof a.Tensor&&(N=T(N)),!Array.isArray(N)||N.length===0||!(0,o.isIntegralNumber)(N[0]))throw Error("token_ids must be a non-empty array of integers.");return this.decode_single(N,Q)}decode_single(N,{skip_special_tokens:Q=!1,clean_up_tokenization_spaces:ie=null}){let de=this.model.convert_ids_to_tokens(N);Q&&(de=de.filter(je=>!this.special_tokens.includes(je)));let ve=this.decoder?this.decoder(de):de.join(" ");return this.decoder&&this.decoder.end_of_word_suffix&&(ve=ve.replaceAll(this.decoder.end_of_word_suffix," "),Q&&(ve=ve.trim())),(ie??this.clean_up_tokenization_spaces)&&(ve=k(ve)),ve}get_chat_template({chat_template:N=null,tools:Q=null}={}){if(this.chat_template&&typeof this.chat_template=="object"){const ie=this.chat_template;if(N!==null&&Object.hasOwn(ie,N))N=ie[N];else if(N===null)if(Q!==null&&"tool_use"in ie)N=ie.tool_use;else if("default"in ie)N=ie.default;else throw Error(`This model has multiple chat templates with no default specified! Please either pass a chat template or the name of the template you wish to use to the 'chat_template' argument. Available template names are ${Object.keys(ie).sort()}.`)}else if(N===null)if(this.chat_template)N=this.chat_template;else throw Error("Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating");return N}apply_chat_template(N,{tools:Q=null,documents:ie=null,chat_template:de=null,add_generation_prompt:ve=!1,tokenize:je=!0,padding:He=!1,truncation:We=!1,max_length:Je=null,return_tensor:dt=!0,return_dict:xt=!1,tokenizer_kwargs:Pt={},...jt}={}){if(de=this.get_chat_template({chat_template:de,tools:Q}),typeof de!="string")throw Error(`chat_template must be a string, but got ${typeof de}`);let kt=this._compiled_template_cache.get(de);kt===void 0&&(kt=new u.Template(de),this._compiled_template_cache.set(de,kt));const Ht=Object.create(null);for(const cr of js){const pr=this.getToken(cr);pr&&(Ht[cr]=pr)}const br=kt.render({messages:N,add_generation_prompt:ve,tools:Q,documents:ie,...Ht,...jt});if(je){const cr=this._call(br,{add_special_tokens:!1,padding:He,truncation:We,max_length:Je,return_tensor:dt,...Pt});return xt?cr:cr.input_ids}return br}}class us extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Ar extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class bs extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Ft extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class ds extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class cs extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class ys extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Qt extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class De extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Qe extends at{}class tt extends at{}class Rt extends at{constructor(N,Q){super(N,Q);te(this,"return_token_type_ids",!0);console.warn('WARNING: `XLMTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}}class zr extends at{constructor(){super(...arguments);te(this,"return_token_type_ids",!0)}}class Sr extends at{}class ps extends at{}class hs extends at{}class Kr extends at{constructor($,N){super($,N),this.languageRegex=/^[a-z]{2}_[A-Z]{2}$/,this.language_codes=this.special_tokens.filter(Q=>this.languageRegex.test(Q)),this.lang_to_token=Q=>Q}_build_translation_inputs($,N,Q){return Tr(this,$,N,Q)}}class ms extends Kr{}class _s extends at{}class Hr extends at{}const vr="▁";class cn extends at{constructor(N,Q){super(N,Q);te(this,"padding_side","left");this.legacy=Q.legacy??!0,this.legacy||(this.normalizer=null,this.pre_tokenizer=new wt({replacement:vr,add_prefix_space:!0,prepend_scheme:"first"}))}_encode_text(N){if(N===null)return null;if(this.legacy||N.length===0)return super._encode_text(N);let Q=super._encode_text(vr+N.replaceAll(vr," "));return Q.length>1&&Q[0]===vr&&this.special_tokens.includes(Q[1])&&(Q=Q.slice(1)),Q}}class xr extends at{}class $s extends at{}class ks extends at{}class fr extends at{}class Vs extends at{}class pn extends at{}class Fr extends at{}class hn extends at{}class qr extends at{}function Tr(he,$,N,Q){if(!("language_codes"in he)||!Array.isArray(he.language_codes))throw new Error("Tokenizer must have `language_codes` attribute set and it should be an array of language ids.");if(!("languageRegex"in he)||!(he.languageRegex instanceof RegExp))throw new Error("Tokenizer must have `languageRegex` attribute set and it should be a regular expression.");if(!("lang_to_token"in he)||typeof he.lang_to_token!="function")throw new Error("Tokenizer must have `lang_to_token` attribute set and it should be a function.");const ie=Q.src_lang,de=Q.tgt_lang;if(!he.language_codes.includes(de))throw new Error(`Target language code "${de}" is not valid. Must be one of: {${he.language_codes.join(", ")}}`);if(ie!==void 0){if(!he.language_codes.includes(ie))throw new Error(`Source language code "${ie}" is not valid. Must be one of: {${he.language_codes.join(", ")}}`);for(const ve of he.post_processor.config.single)if("SpecialToken"in ve&&he.languageRegex.test(ve.SpecialToken.id)){ve.SpecialToken.id=he.lang_to_token(ie);break}}return Q.forced_bos_token_id=he.model.convert_tokens_to_ids([he.lang_to_token(de)])[0],he._call($,N)}class Is extends at{constructor($,N){super($,N),this.languageRegex=/^[a-z]{3}_[A-Z][a-z]{3}$/,this.language_codes=this.special_tokens.filter(Q=>this.languageRegex.test(Q)),this.lang_to_token=Q=>Q}_build_translation_inputs($,N,Q){return Tr(this,$,N,Q)}}class dr extends at{constructor($,N){super($,N),this.languageRegex=/^__[a-z]{2,3}__$/,this.language_codes=this.special_tokens.filter(Q=>this.languageRegex.test(Q)).map(Q=>Q.slice(2,-2)),this.lang_to_token=Q=>`__${Q}__`}_build_translation_inputs($,N,Q){return Tr(this,$,N,Q)}}class gr extends at{get timestamp_begin(){return this.model.convert_tokens_to_ids(["<|notimestamps|>"])[0]+1}_decode_asr($,{return_timestamps:N=!1,return_language:Q=!1,time_precision:ie=null,force_full_sequences:de=!0}={}){if(ie===null)throw Error("Must specify time_precision");let ve=null;const je=N==="word";function He(){return{language:ve,timestamp:[null,null],text:""}}const We=[];let Je=He(),dt=0;const xt=this.timestamp_begin,jt=xt+1500;let kt=[],Ht=[],br=!1,cr=null;const pr=new Set(this.all_special_ids);for(const Dt of $){const rr=Dt.tokens,wr=je?Dt.token_timestamps:null;let Qr=null,Rr=xt;if("stride"in Dt){const[or,Vt,Zt]=Dt.stride;if(dt-=Vt,cr=or-Zt,Vt&&(Rr=Vt/ie+xt),Zt)for(let er=rr.length-1;er>=0;--er){const tr=Number(rr[er]);if(tr>=xt){if(Qr!==null&&(tr-xt)*ie=xt&&Vt<=jt){const Zt=(Vt-xt)*ie+dt,er=(0,i.round)(Zt,2);if(Qr!==null&&Vt>=Qr)br=!0;else if(br||kt.length>0&&Vt0?(kt.push(Yt),je&&Ht.push(jr)):kt.every(or=>or.length===0)&&(Je=He(),kt=[],Yt=[],Ht=[],jr=[])}if(kt.length>0){if(de&&N)throw new Error("Whisper did not predict an ending timestamp, which can happen if audio is cut off in the middle of a word. Also make sure WhisperTimeStampLogitsProcessor was used during generation.");const[Dt,rr]=this.findLongestCommonSequence(kt,Ht),wr=this.decode(Dt);Je.text=wr,je&&(Je.words=this.collateWordTimestamps(Dt,rr,ve)),We.push(Je)}let Nt=Object.create(null);const Xr=We.map(Dt=>Dt.text).join("");if(N||Q){for(let Dt=0;Dt0;let je=ve?[]:null,He=ve?N[0]:null;for(let We=1;We<$.length;++We){const Je=$[We];let dt=0,xt=[ie,ie,0,0];const Pt=Je.length;for(let Nt=1;NtVt===Rr[Zt]&&He[Xr+Zt]<=N[We][wr+Zt]).length:Yt=rr.filter((Vt,Zt)=>Vt===Rr[Zt]).length;const jr=Nt/1e4,or=Yt/Nt+jr;Yt>1&&or>dt&&(dt=or,xt=[Xr,Dt,wr,Qr])}const[jt,kt,Ht,br]=xt,cr=Math.floor((kt+jt)/2),pr=Math.floor((br+Ht)/2);de.push(...Q.slice(0,cr)),Q=Je.slice(pr),ie=Q.length,ve&&(je.push(...He.slice(0,cr)),He=N[We].slice(pr))}return de.push(...Q),ve?(je.push(...He),[de,je]):[de,[]]}collateWordTimestamps($,N,Q){const[ie,de,ve]=this.combineTokensIntoWords($,Q),je=[];for(let He=0;He=ie){const je=((ve-ie)*Q).toFixed(2);de.push(`<|${je}|>`),de.push([])}else de[de.length-1].push(ve);return de=de.map(ve=>typeof ve=="string"?ve:super.decode(ve,N)),de.join("")}splitTokensOnUnicode($){const N=this.decode($,{decode_with_timestamps:!0}),Q="�",ie=[],de=[],ve=[];let je=[],He=[],We=0;for(let Je=0;Je<$.length;++Je){const dt=$[Je];je.push(dt),He.push(Je);const xt=this.decode(je,{decode_with_timestamps:!0});(!xt.includes(Q)||N[We+xt.indexOf(Q)]===Q)&&(ie.push(xt),de.push(je),ve.push(He),je=[],He=[],We+=xt.length)}return[ie,de,ve]}splitTokensOnSpaces($){const[N,Q,ie]=this.splitTokensOnUnicode($),de=[],ve=[],je=[],He=new RegExp(`^[${M}]$`,"gu");for(let We=0;We=this.model.tokens_to_ids.get("<|endoftext|>"),jt=Je.startsWith(" "),kt=Je.trim(),Ht=He.test(kt);if(Pt||jt||Ht||de.length===0)de.push(Je),ve.push(dt),je.push(xt);else{const br=de.length-1;de[br]+=Je,ve[br].push(...dt),je[br].push(...xt)}}return[de,ve,je]}mergePunctuations($,N,Q,ie,de){const ve=structuredClone($),je=structuredClone(N),He=structuredClone(Q);let We=ve.length-2,Je=ve.length-1;for(;We>=0;)ve[We].startsWith(" ")&&ie.includes(ve[We].trim())?(ve[Je]=ve[We]+ve[Je],je[Je]=(0,o.mergeArrays)(je[We],je[Je]),He[Je]=(0,o.mergeArrays)(He[We],He[Je]),ve[We]="",je[We]=[],He[We]=[]):Je=We,--We;for(We=0,Je=1;Jedt),je.filter(dt=>dt.length>0),He.filter(dt=>dt.length>0)]}}class Br extends at{}class mn extends at{}class _n extends at{}class fn extends at{constructor($,N){super($,N),this.languageRegex=/^(>>\w+<<)\s*/g,this.supported_language_codes=this.model.vocab.filter(Q=>this.languageRegex.test(Q)),console.warn('WARNING: `MarianTokenizer` is not yet supported by Hugging Face\'s "fast" tokenizers library. Therefore, you may experience slightly inaccurate results.')}_encode_text($){if($===null)return null;const[N,...Q]=$.trim().split(this.languageRegex);if(Q.length===0)return super._encode_text(N);if(Q.length===2){const[ie,de]=Q;return this.supported_language_codes.includes(ie)||console.warn(`Unsupported language code "${ie}" detected, which may lead to unexpected behavior. Should be one of: ${JSON.stringify(this.supported_language_codes)}`),(0,o.mergeArrays)([ie],super._encode_text(de))}}}class gn extends at{}class wn extends at{}class vs extends at{}class Mn extends at{}class Us extends at{}class bn extends at{constructor($,N){super($,N),this.decoder=new lt({})}}class yn extends at{}class xs extends at{}class vn{static async from_pretrained($,{progress_callback:N=null,config:Q=null,cache_dir:ie=null,local_files_only:de=!1,revision:ve="main",legacy:je=null}={}){var xt;const[He,We]=await d($,{progress_callback:N,config:Q,cache_dir:ie,local_files_only:de,revision:ve,legacy:je}),Je=((xt=We.tokenizer_class)==null?void 0:xt.replace(/Fast$/,""))??"PreTrainedTokenizer";let dt=this.TOKENIZER_CLASS_MAPPING[Je];return dt||(console.warn(`Unknown tokenizer class "${Je}", attempting to construct from base class.`),dt=at),new dt(He,We)}}te(vn,"TOKENIZER_CLASS_MAPPING",{T5Tokenizer:Sr,DistilBertTokenizer:Qe,CamembertTokenizer:tt,DebertaTokenizer:ds,DebertaV2Tokenizer:cs,BertTokenizer:us,HerbertTokenizer:ys,ConvBertTokenizer:Qt,RoFormerTokenizer:De,XLMTokenizer:Rt,ElectraTokenizer:zr,MobileBertTokenizer:bs,SqueezeBertTokenizer:Ft,AlbertTokenizer:Ar,GPT2Tokenizer:ps,BartTokenizer:hs,MBartTokenizer:Kr,MBart50Tokenizer:ms,RobertaTokenizer:_s,WhisperTokenizer:gr,CodeGenTokenizer:Br,CLIPTokenizer:mn,SiglipTokenizer:_n,MarianTokenizer:fn,BloomTokenizer:Hr,NllbTokenizer:Is,M2M100Tokenizer:dr,LlamaTokenizer:cn,CodeLlamaTokenizer:xr,XLMRobertaTokenizer:$s,MPNetTokenizer:ks,FalconTokenizer:fr,GPTNeoXTokenizer:Vs,EsmTokenizer:pn,Wav2Vec2CTCTokenizer:gn,BlenderbotTokenizer:wn,BlenderbotSmallTokenizer:vs,SpeechT5Tokenizer:Mn,NougatTokenizer:Us,VitsTokenizer:bn,Qwen2Tokenizer:Fr,GemmaTokenizer:hn,Grok1Tokenizer:qr,CohereTokenizer:yn,MgpstrTokenizer:xs,PreTrainedTokenizer:at})},"./src/utils/audio.js":(e,r,t)=>{t.r(r),t.d(r,{RawAudio:()=>G,hamming:()=>c,hanning:()=>d,mel_filter_bank:()=>S,read_audio:()=>u,spectrogram:()=>C,window_function:()=>A});var s=t("./src/utils/hub.js"),o=t("./src/utils/maths.js"),n=t("./src/utils/core.js"),i=t("./src/env.js"),a=t("?7a2c"),l=t("./src/utils/tensor.js");async function u(j,ee){if(typeof AudioContext>"u")throw Error("Unable to load audio from path/URL since `AudioContext` is not available in your environment. Instead, audio data should be passed directly to the pipeline/processor. For more information and some example code, see https://huggingface.co/docs/transformers.js/guides/node-audio-processing.");const H=await(await(0,s.getFile)(j)).arrayBuffer(),Z=new AudioContext({sampleRate:ee});typeof ee>"u"&&console.warn(`No sampling rate provided, using default of ${Z.sampleRate}Hz.`);const X=await Z.decodeAudioData(H);let oe;if(X.numberOfChannels===2){const me=Math.sqrt(2),ae=X.getChannelData(0),V=X.getChannelData(1);oe=new Float32Array(ae.length);for(let F=0;F2595*Math.log10(1+j/700),kaldi:j=>1127*Math.log(1+j/700),slaney:(j,ee=1e3,H=15,Z=27/Math.log(6.4))=>j>=ee?H+Math.log(j/ee)*Z:3*j/200};function _(j,ee="htk"){const H=f[ee];if(!H)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof j=="number"?H(j):j.map(Z=>H(Z))}const T={htk:j=>700*(10**(j/2595)-1),kaldi:j=>700*(Math.exp(j/1127)-1),slaney:(j,ee=1e3,H=15,Z=Math.log(6.4)/27)=>j>=H?ee*Math.exp(Z*(j-H)):200*j/3};function k(j,ee="htk"){const H=T[ee];if(!H)throw new Error('mel_scale should be one of "htk", "slaney" or "kaldi".');return typeof j=="number"?H(j):j.map(Z=>H(Z))}function w(j,ee){const H=Float64Array.from({length:ee.length-1},(me,ae)=>ee[ae+1]-ee[ae]),Z=Array.from({length:j.length},()=>new Array(ee.length));for(let me=0;menew Array(j.length));for(let me=0;mej+Z*oe)}function S(j,ee,H,Z,X,oe=null,me="htk",ae=!1){if(oe!==null&&oe!=="slaney")throw new Error('norm must be one of null or "slaney"');if(j<2)throw new Error(`Require num_frequency_bins: ${j} >= 2`);if(H>Z)throw new Error(`Require min_frequency: ${H} <= max_frequency: ${Z}`);const V=_(H,me),F=_(Z,me),W=g(V,F,ee+2);let re=k(W,me),_e;if(ae){const ce=X/((j-1)*2);_e=_(Float64Array.from({length:j},($e,Ue)=>Ue*ce),me),re=W}else _e=g(0,Math.floor(X/2),j);const se=w(_e,re);if(oe!==null&&oe==="slaney")for(let ce=0;ceX)throw Error(`frame_length (${H}) may not be larger than fft_length (${X})`);if(xe!==H)throw new Error(`Length of the window (${xe}) must equal frame_length (${H})`);if(Z<=0)throw new Error("hop_length must be greater than zero");if(oe===null&&W!==null)throw new Error("You have provided `mel_filters` but `power` is `None`. Mel spectrogram computation is not yet supported for complex-valued spectrogram. Specify `power` to fix this issue.");if(me){if(ae!=="reflect")throw new Error(`pad_mode="${ae}" not implemented yet.`);const ye=Math.floor((X-1)/2)+1;j=E(j,ye,ye)}let be=Math.floor(1+Math.floor((j.length-H)/Z));we!==null&&bebe?R&&(Fe=q):Fe=Ae=q);const ze=new o.FFT(X),Ve=new Float64Array(X),O=new Float64Array(ze.outputBufferSize),Y=new Float32Array(Se*Fe);for(let ye=0;ye=1;--Ie)Ve[Ie]-=F*Ve[Ie-1];Ve[0]*=1-F}for(let Ie=0;IeMath.pow(ae,.85));break;default:throw new Error(`Unknown window type ${ee}.`)}if(H&&(me=me.subarray(0,j)),Z===null)return me;if(j>Z)throw new Error(`Length of the window (${j}) may not be larger than frame_length (${Z})`);return me}function B(j,ee){let H=44;const Z=new ArrayBuffer(H+j.length*4),X=new DataView(Z);K(X,0,"RIFF"),X.setUint32(4,36+j.length*4,!0),K(X,8,"WAVE"),K(X,12,"fmt "),X.setUint32(16,16,!0),X.setUint16(20,3,!0),X.setUint16(22,1,!0),X.setUint32(24,ee,!0),X.setUint32(28,ee*4,!0),X.setUint16(32,4,!0),X.setUint16(34,32,!0),K(X,36,"data"),X.setUint32(40,j.length*4,!0);for(let oe=0;oe{let oe=await X.arrayBuffer();a.writeFileSync(Z,Buffer.from(oe))};else throw new Error("Unable to save because filesystem is disabled in this environment.");await H(ee,this.toBlob())}}},"./src/utils/constants.js":(e,r,t)=>{t.r(r),t.d(r,{CHAT_TEMPLATE_NAME:()=>l,CONFIG_NAME:()=>o,FEATURE_EXTRACTOR_NAME:()=>n,GENERATION_CONFIG_NAME:()=>u,GITHUB_ISSUE_URL:()=>s,IMAGE_PROCESSOR_NAME:()=>i,PROCESSOR_NAME:()=>a});const s="https://github.com/huggingface/transformers.js/issues/new/choose",o="config.json",n="preprocessor_config.json",i=n,a="processor_config.json",l="chat_template.json",u="generation_config.json"},"./src/utils/core.js":(e,r,t)=>{t.r(r),t.d(r,{calculateDimensions:()=>u,calculateReflectOffset:()=>f,count:()=>w,dispatchCallback:()=>s,escapeRegExp:()=>n,isIntegralNumber:()=>a,isNullishDimension:()=>l,isTypedArray:()=>i,len:()=>k,mergeArrays:()=>d,pick:()=>T,pop:()=>p,product:()=>c,reverseDictionary:()=>o,saveBlob:()=>_});function s(g,S){g&&g(S)}function o(g){return Object.fromEntries(Object.entries(g).map(([S,E])=>[E,S]))}function n(g){return g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i(g){var S,E,y;return((y=(E=(S=g==null?void 0:g.prototype)==null?void 0:S.__proto__)==null?void 0:E.constructor)==null?void 0:y.name)==="TypedArray"}function a(g){return Number.isInteger(g)||typeof g=="bigint"}function l(g){return g==null||g===-1}function u(g){const S=[];let E=g;for(;Array.isArray(E);)S.push(E.length),E=E[0];return S}function p(g,S,E=void 0){const y=g[S];if(y!==void 0)return delete g[S],y;if(E===void 0)throw Error(`Key ${S} does not exist in object.`);return E}function d(...g){return Array.prototype.concat.apply([],g)}function c(...g){return g.reduce((S,E)=>S.flatMap(y=>E.map(M=>[y,M])))}function f(g,S){return Math.abs((g+S)%(2*S)-S)}function _(g,S){const E=URL.createObjectURL(S),y=document.createElement("a");y.href=E,y.download=g,y.click(),y.remove(),URL.revokeObjectURL(E)}function T(g,S){return Object.assign({},...S.map(E=>{if(g[E]!==void 0)return{[E]:g[E]}}))}function k(g){let S=0;for(const E of g)++S;return S}function w(g,S){let E=0;for(const y of g)y===S&&++E;return E}},"./src/utils/data-structures.js":(e,r,t)=>{t.r(r),t.d(r,{CharTrie:()=>o,DictionarySplitter:()=>l,LRUCache:()=>u,PriorityQueue:()=>s,TokenLattice:()=>i});class s{constructor(d=(f,_)=>f>_,c=1/0){this._heap=[],this._comparator=d,this._maxSize=c}get size(){return this._heap.length}isEmpty(){return this.size===0}peek(){return this._heap[0]}push(...d){return this.extend(d)}extend(d){for(const c of d)if(this.size0&&this._swap(0,c),this._heap.pop(),this._siftDown(),d}replace(d){const c=this.peek();return this._heap[0]=d,this._siftDown(),c}_parent(d){return(d+1>>>1)-1}_left(d){return(d<<1)+1}_right(d){return d+1<<1}_greater(d,c){return this._comparator(this._heap[d],this._heap[c])}_swap(d,c){const f=this._heap[d];this._heap[d]=this._heap[c],this._heap[c]=f}_siftUp(){this._siftUpFrom(this.size-1)}_siftUpFrom(d){for(;d>0&&this._greater(d,this._parent(d));)this._swap(d,this._parent(d)),d=this._parent(d)}_siftDown(){let d=0;for(;this._left(d)[]),this.endNodes=Array.from({length:this.len+1},()=>[]);const _=new a(this.bosTokenId,0,0,0,0),T=new a(this.eosTokenId,1,this.len,0,0);this.nodes.push(_.clone()),this.nodes.push(T.clone()),this.beginNodes[this.len].push(T),this.endNodes[0].push(_)}insert(d,c,f,_){const T=this.nodes.length,k=new a(_,T,d,c,f);this.beginNodes[d].push(k),this.endNodes[d+c].push(k),this.nodes.push(k)}viterbi(){const d=this.len;let c=0;for(;c<=d;){if(this.beginNodes[c].length==0)return[];for(let w of this.beginNodes[c]){w.prev=null;let g=0,S=null;for(let E of this.endNodes[c]){const y=E.backtraceScore+w.score;(S===null||y>g)&&(S=E.clone(),g=y)}if(S!==null)w.prev=S,w.backtraceScore=g;else return[]}++c}const f=[],T=this.beginNodes[d][0].prev;if(T===null)return[];let k=T.clone();for(;k.prev!==null;)f.push(k.clone()),k=k.clone().prev.clone();return f.reverse(),f}piece(d){return this.chars.slice(d.pos,d.pos+d.length).join("")}tokens(){return this.viterbi().map(c=>this.piece(c))}tokenIds(){return this.viterbi().map(c=>c.tokenId)}}class a{constructor(d,c,f,_,T){this.tokenId=d,this.nodeId=c,this.pos=f,this.length=_,this.score=T,this.prev=null,this.backtraceScore=0}clone(){const d=new a(this.tokenId,this.nodeId,this.pos,this.length,this.score);return d.prev=this.prev,d.backtraceScore=this.backtraceScore,d}}class l{constructor(d){this.trie=this._buildTrie(d)}_buildTrie(d){var f;const c=Object.create(null);for(const _ of d){let T=c;for(let k=0;k<_.length;++k)T=T[f=_[k]]??(T[f]=Object.create(null));T.end=_}return c}split(d){const c=[],f=d.length;let _=0,T=0;for(;T_&&c.push(d.slice(_,T)),c.push(w),T+=w.length,_=T):++T}return _this.capacity&&this.cache.delete(this.cache.keys().next().value)}clear(){this.cache.clear()}}},"./src/utils/devices.js":(e,r,t)=>{t.r(r),t.d(r,{DEVICE_TYPES:()=>s});const s=Object.freeze({auto:"auto",gpu:"gpu",cpu:"cpu",wasm:"wasm",webgpu:"webgpu",cuda:"cuda",dml:"dml",webnn:"webnn","webnn-npu":"webnn-npu","webnn-gpu":"webnn-gpu","webnn-cpu":"webnn-cpu"})},"./src/utils/dtypes.js":(e,r,t)=>{t.r(r),t.d(r,{DATA_TYPES:()=>i,DEFAULT_DEVICE_DTYPE_MAPPING:()=>a,DEFAULT_DTYPE_SUFFIX_MAPPING:()=>l,isWebGpuFp16Supported:()=>n});var s=t("./src/env.js"),o=t("./src/utils/devices.js");const n=function(){let u;return async function(){if(u===void 0)if(!s.apis.IS_WEBGPU_AVAILABLE)u=!1;else try{u=(await navigator.gpu.requestAdapter()).features.has("shader-f16")}catch{u=!1}return u}}(),i=Object.freeze({auto:"auto",fp32:"fp32",fp16:"fp16",q8:"q8",int8:"int8",uint8:"uint8",q4:"q4",bnb4:"bnb4",q4f16:"q4f16"}),a=Object.freeze({[o.DEVICE_TYPES.wasm]:i.q8}),l=Object.freeze({[i.fp32]:"",[i.fp16]:"_fp16",[i.int8]:"_int8",[i.uint8]:"_uint8",[i.q8]:"_quantized",[i.q4]:"_q4",[i.q4f16]:"_q4f16",[i.bnb4]:"_bnb4"})},"./src/utils/generic.js":(e,r,t)=>{t.r(r),t.d(r,{Callable:()=>s});const s=class{constructor(){let o=function(...n){return o._call(...n)};return Object.setPrototypeOf(o,new.target.prototype)}_call(...o){throw Error("Must implement _call method in subclass")}}},"./src/utils/hub.js":(e,r,t)=>{t.r(r),t.d(r,{MAX_EXTERNAL_DATA_CHUNKS:()=>a,getFile:()=>f,getModelFile:()=>g,getModelJSON:()=>S});var s=t("?7a2c"),o=t("?a42a"),n=t("./src/env.js"),i=t("./src/utils/core.js");const a=100,l={txt:"text/plain",html:"text/html",css:"text/css",js:"text/javascript",json:"application/json",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif"};class u{constructor(v){if(this.filePath=v,this.headers=new Headers,this.exists=s.existsSync(v),this.exists){this.status=200,this.statusText="OK";let C=s.statSync(v);this.headers.set("content-length",C.size.toString()),this.updateContentType();const A=s.createReadStream(v);this.body=new ReadableStream({start(B){A.on("data",K=>B.enqueue(K)),A.on("end",()=>B.close()),A.on("error",K=>B.error(K))},cancel(){A.destroy()}})}else this.status=404,this.statusText="Not Found",this.body=null}updateContentType(){const v=this.filePath.toString().split(".").pop().toLowerCase();this.headers.set("content-type",l[v]??"application/octet-stream")}clone(){let v=new u(this.filePath);return v.exists=this.exists,v.status=this.status,v.statusText=this.statusText,v.headers=new Headers(this.headers),v}async arrayBuffer(){return(await s.promises.readFile(this.filePath)).buffer}async blob(){const v=await s.promises.readFile(this.filePath);return new Blob([v],{type:this.headers.get("content-type")})}async text(){return await s.promises.readFile(this.filePath,"utf8")}async json(){return JSON.parse(await this.text())}}function p(M,v=null,C=null){let A;try{A=new URL(M)}catch{return!1}return!(v&&!v.includes(A.protocol)||C&&!C.includes(A.hostname))}const d=/^(\b[\w\-.]+\b\/)?\b[\w\-.]{1,96}\b$/;function c(M){return!(!d.test(M)||M.includes("..")||M.includes("--")||M.endsWith(".git")||M.endsWith(".ipynb"))}async function f(M){var v;if(n.env.useFS&&!p(M,["http:","https:","blob:"]))return new u(M.toString());if(typeof process<"u"&&((v=process==null?void 0:process.release)==null?void 0:v.name)==="node"){const C=!!(Cs!=null&&Cs.TESTING_REMOTELY),A=n.env.version,B=new Headers;if(B.set("User-Agent",`transformers.js/${A}; is_ci/${C};`),p(M,["http:","https:"],["huggingface.co","hf.co"])){const G=(Cs==null?void 0:Cs.HF_TOKEN)??(Cs==null?void 0:Cs.HF_ACCESS_TOKEN);G&&B.set("Authorization",`Bearer ${G}`)}return fetch(M,{headers:B})}else return fetch(M)}const _={400:"Bad request error occurred while trying to load file",401:"Unauthorized access to file",403:"Forbidden access to file",404:"Could not locate file",408:"Request timeout error occurred while trying to load file",500:"Internal server error error occurred while trying to load file",502:"Bad gateway error occurred while trying to load file",503:"Service unavailable error occurred while trying to load file",504:"Gateway timeout error occurred while trying to load file"};function T(M,v,C){if(!C)return null;const A=_[M]??`Error (${M}) occurred while trying to load file`;throw Error(`${A}: "${v}".`)}class k{constructor(v){this.path=v}async match(v){let C=o.join(this.path,v),A=new u(C);if(A.exists)return A}async put(v,C,A=void 0){let B=o.join(this.path,v);try{const K=C.headers.get("Content-Length"),G=parseInt(K??"0");let j=0;await s.promises.mkdir(o.dirname(B),{recursive:!0});const ee=s.createWriteStream(B),H=C.body.getReader();for(;;){const{done:Z,value:X}=await H.read();if(Z)break;await new Promise((me,ae)=>{ee.write(X,V=>{if(V){ae(V);return}me()})}),j+=X.length;const oe=G?j/G*100:0;A==null||A({progress:oe,loaded:j,total:G})}ee.close()}catch(K){try{await s.promises.unlink(B)}catch{}throw K}}}async function w(M,...v){for(let C of v)try{let A=await M.match(C);if(A)return A}catch{continue}}async function g(M,v,C=!0,A={},B=!1){if(!n.env.allowLocalModels){if(A.local_files_only)throw Error("Invalid configuration detected: local models are disabled (`env.allowLocalModels=false`) but you have requested to only use local models (`local_files_only=true`).");if(!n.env.allowRemoteModels)throw Error("Invalid configuration detected: both local and remote models are disabled. Fix by setting `env.allowLocalModels` or `env.allowRemoteModels` to `true`.")}(0,i.dispatchCallback)(A.progress_callback,{status:"initiate",name:M,file:v});let K;if(!K&&n.env.useCustomCache){if(!n.env.customCache)throw Error("`env.useCustomCache=true`, but `env.customCache` is not defined.");if(!n.env.customCache.match||!n.env.customCache.put)throw new Error("`env.customCache` must be an object which implements the `match` and `put` functions of the Web Cache API. For more information, see https://developer.mozilla.org/en-US/docs/Web/API/Cache");K=n.env.customCache}if(!K&&n.env.useBrowserCache){if(typeof caches>"u")throw Error("Browser cache is not available in this environment.");try{K=await caches.open("transformers-cache")}catch(re){console.warn("An error occurred while opening the browser cache:",re)}}if(!K&&n.env.useFSCache){if(!n.apis.IS_FS_AVAILABLE)throw Error("File System Cache is not available in this environment.");K=new k(A.cache_dir??n.env.cacheDir)}const G=A.revision??"main",j=y(M,v),ee=c(M),H=ee?y(n.env.localModelPath,j):j,Z=y(n.env.remoteHost,n.env.remotePathTemplate.replaceAll("{model}",M).replaceAll("{revision}",encodeURIComponent(G)),v);let X;const oe=K instanceof k?G==="main"?j:y(M,G,v):Z;let me=!1,ae;K&&(ae=await w(K,H,oe));const V=ae!==void 0;if(ae===void 0){if(n.env.allowLocalModels)if(p(j,["http:","https:"])){if(A.local_files_only)throw new Error(`\`local_files_only=true\`, but attempted to load a remote file from: ${j}.`);if(!n.env.allowRemoteModels)throw new Error(`\`env.allowRemoteModels=false\`, but attempted to load a remote file from: ${j}.`)}else try{ae=await f(H),X=H}catch(_e){console.warn(`Unable to load from local path "${H}": "${_e}"`)}if(ae===void 0||ae.status===404){if(A.local_files_only||!n.env.allowRemoteModels){if(C)throw Error(`\`local_files_only=true\` or \`env.allowRemoteModels=false\` and file was not found locally at "${H}".`);return null}if(!ee)throw Error(`Local file missing at "${H}" and download aborted due to invalid model ID "${M}".`);if(ae=await f(Z),ae.status!==200)return T(ae.status,Z,C);X=oe}me=K&&typeof Response<"u"&&ae instanceof Response&&ae.status===200}(0,i.dispatchCallback)(A.progress_callback,{status:"download",name:M,file:v});let F;if(!(n.apis.IS_NODE_ENV&&B)){let re;A.progress_callback?V&&typeof navigator<"u"&&/firefox/i.test(navigator.userAgent)?(re=new Uint8Array(await ae.arrayBuffer()),(0,i.dispatchCallback)(A.progress_callback,{status:"progress",name:M,file:v,progress:100,loaded:re.length,total:re.length})):re=await E(ae,_e=>{(0,i.dispatchCallback)(A.progress_callback,{status:"progress",name:M,file:v,..._e})}):re=new Uint8Array(await ae.arrayBuffer()),F=re}if(me&&X&&await K.match(X)===void 0&&(F?await K.put(X,new Response(F,{headers:ae.headers})).catch(re=>{console.warn(`Unable to add response to browser cache: ${re}.`)}):await K.put(X,ae,A.progress_callback)),(0,i.dispatchCallback)(A.progress_callback,{status:"done",name:M,file:v}),F){if(!n.apis.IS_NODE_ENV&&B)throw new Error("Cannot return path in a browser environment.");return F}if(ae instanceof u)return ae.filePath;const W=await(K==null?void 0:K.match(X));if(W instanceof u)return W.filePath;if(W instanceof Response)return new Uint8Array(await W.arrayBuffer());if(typeof W=="string")return W;throw new Error("Unable to get model file path or buffer.")}async function S(M,v,C=!0,A={}){const B=await g(M,v,C,A,!1);if(B===null)return{};const G=new TextDecoder("utf-8").decode(B);return JSON.parse(G)}async function E(M,v){const C=M.headers.get("Content-Length");C===null&&console.warn("Unable to determine content-length from response headers. Will expand buffer when needed.");let A=parseInt(C??"0"),B=new Uint8Array(A),K=0;const G=M.body.getReader();async function j(){const{done:ee,value:H}=await G.read();if(ee)return;const Z=K+H.length;if(Z>A){A=Z;const oe=new Uint8Array(A);oe.set(B),B=oe}B.set(H,K),K=Z;const X=K/A*100;return v({progress:X,loaded:K,total:A}),j()}return await j(),B}function y(...M){return M=M.map((v,C)=>(C&&(v=v.replace(new RegExp("^/"),"")),C!==M.length-1&&(v=v.replace(new RegExp("/$"),"")),v)),M.join("/")}},"./src/utils/image.js":(e,r,t)=>{t.r(r),t.d(r,{RawImage:()=>_,load_image:()=>T});var s=t("./src/utils/core.js"),o=t("./src/utils/hub.js"),n=t("./src/env.js"),i=t("./src/utils/tensor.js"),a=t("?2b25");let l,u,p;const d=n.apis.IS_BROWSER_ENV||n.apis.IS_WEBWORKER_ENV;if(d)l=(k,w)=>{if(!self.OffscreenCanvas)throw new Error("OffscreenCanvas not supported by this browser.");return new self.OffscreenCanvas(k,w)},p=self.createImageBitmap,u=self.ImageData;else if(a)p=async k=>{const g=(await k.metadata()).channels,{data:S,info:E}=await k.rotate().raw().toBuffer({resolveWithObject:!0}),y=new _(new Uint8ClampedArray(S),E.width,E.height,E.channels);return g!==void 0&&g!==E.channels&&y.convert(g),y};else throw new Error("Unable to load image processing library.");const c={0:"nearest",1:"lanczos",2:"bilinear",3:"bicubic",4:"box",5:"hamming"},f=new Map([["png","image/png"],["jpg","image/jpeg"],["jpeg","image/jpeg"],["gif","image/gif"]]);class _{constructor(w,g,S,E){this.data=w,this.width=g,this.height=S,this.channels=E}get size(){return[this.width,this.height]}static async read(w){if(w instanceof _)return w;if(typeof w=="string"||w instanceof URL)return await this.fromURL(w);if(w instanceof Blob)return await this.fromBlob(w);if(typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&w instanceof OffscreenCanvas)return this.fromCanvas(w);throw new Error(`Unsupported input type: ${typeof w}`)}static fromCanvas(w){if(!d)throw new Error("fromCanvas() is only supported in browser environments.");const S=w.getContext("2d").getImageData(0,0,w.width,w.height).data;return new _(S,w.width,w.height,4)}static async fromURL(w){const g=await(0,o.getFile)(w);if(g.status!==200)throw new Error(`Unable to read image from "${w}" (${g.status} ${g.statusText})`);const S=await g.blob();return this.fromBlob(S)}static async fromBlob(w){if(d){const g=await p(w),S=l(g.width,g.height).getContext("2d");return S.drawImage(g,0,0),new this(S.getImageData(0,0,g.width,g.height).data,g.width,g.height,4)}else{const g=a(await w.arrayBuffer());return await p(g)}}static fromTensor(w,g="CHW"){if(w.dims.length!==3)throw new Error(`Tensor should have 3 dimensions, but has ${w.dims.length} dimensions.`);if(g==="CHW")w=w.transpose(1,2,0);else if(g!=="HWC")throw new Error(`Unsupported channel format: ${g}`);if(!(w.data instanceof Uint8ClampedArray||w.data instanceof Uint8Array))throw new Error(`Unsupported tensor type: ${w.type}`);switch(w.dims[2]){case 1:case 2:case 3:case 4:return new _(w.data,w.dims[1],w.dims[0],w.dims[2]);default:throw new Error(`Unsupported number of channels: ${w.dims[2]}`)}}grayscale(){if(this.channels===1)return this;const w=new Uint8ClampedArray(this.width*this.height*1);switch(this.channels){case 3:case 4:for(let g=0,S=0;g=0?C=S:B=-S,E>=0?A=E:K=-E,v.drawImage(M,C,A,w,g,B,K,w,g),new _(v.getImageData(0,0,w,g).data,w,g,4).convert(y)}else{let y=this.toSharp();if(S>=0&&E>=0)y=y.extract({left:Math.floor(S),top:Math.floor(E),width:w,height:g});else if(S<=0&&E<=0){const M=Math.floor(-E),v=Math.floor(-S);y=y.extend({top:M,left:v,right:w-this.width-v,bottom:g-this.height-M})}else{let M=[0,0],v=0;E<0?(M[0]=Math.floor(-E),M[1]=g-this.height-M[0]):v=Math.floor(E);let C=[0,0],A=0;S<0?(C[0]=Math.floor(-S),C[1]=w-this.width-C[0]):A=Math.floor(S),y=y.extend({top:M[0],bottom:M[1],left:C[0],right:C[1]}).extract({left:A,top:v,width:w,height:g})}return await p(y)}}async toBlob(w="image/png",g=1){if(!d)throw new Error("toBlob() is only supported in browser environments.");return await this.toCanvas().convertToBlob({type:w,quality:g})}toTensor(w="CHW"){let g=new i.Tensor("uint8",new Uint8Array(this.data),[this.height,this.width,this.channels]);if(w!=="HWC")if(w==="CHW")g=g.permute(2,0,1);else throw new Error(`Unsupported channel format: ${w}`);return g}toCanvas(){if(!d)throw new Error("toCanvas() is only supported in browser environments.");const w=this.clone().rgba(),g=l(w.width,w.height),S=new u(w.data,w.width,w.height);return g.getContext("2d").putImageData(S,0,0),g}split(){const{data:w,width:g,height:S,channels:E}=this,y=w.constructor,M=w.length/E,v=Array.from({length:E},()=>new y(M));for(let C=0;Cnew _(C,g,S,1))}_update(w,g,S,E=null){return this.data=w,this.width=g,this.height=S,E!==null&&(this.channels=E),this}clone(){return new _(this.data.slice(),this.width,this.height,this.channels)}convert(w){if(this.channels===w)return this;switch(w){case 1:this.grayscale();break;case 3:this.rgb();break;case 4:this.rgba();break;default:throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`)}return this}async save(w){if(d){if(n.apis.IS_WEBWORKER_ENV)throw new Error("Unable to save an image from a Web Worker.");const g=w.split(".").pop().toLowerCase(),S=f.get(g)??"image/png",E=await this.toBlob(S);(0,s.saveBlob)(w,E)}else{if(n.apis.IS_FS_AVAILABLE)return await this.toSharp().toFile(w);throw new Error("Unable to save the image because filesystem is disabled in this environment.")}}toSharp(){if(d)throw new Error("toSharp() is only supported in server-side environments.");return a(this.data,{raw:{width:this.width,height:this.height,channels:this.channels}})}}const T=_.read.bind(_)},"./src/utils/maths.js":(e,r,t)=>{t.r(r),t.d(r,{FFT:()=>T,bankers_round:()=>g,cos_sim:()=>l,dot:()=>a,dynamic_time_warping:()=>S,interpolate_data:()=>s,log_softmax:()=>i,magnitude:()=>u,max:()=>d,medianFilter:()=>k,min:()=>p,permute_data:()=>o,round:()=>w,softmax:()=>n});function s(E,[y,M,v],[C,A],B="bilinear",K=!1){const G=A/v,j=C/M,ee=new E.constructor(C*A*y),H=M*v,Z=C*A;for(let X=0;X=0;--K)C[K]=G,v[K]=y[M[K]],G*=v[K];const A=M.map((K,G)=>C[M.indexOf(G)]),B=new E.constructor(E.length);for(let K=0;K=0;--j)G+=ee%y[j]*A[j],ee=Math.floor(ee/y[j]);B[G]=E[K]}return[B,v]}function n(E){const y=d(E)[0],M=E.map(A=>Math.exp(A-y)),v=M.reduce((A,B)=>A+B,0);return M.map(A=>A/v)}function i(E){const y=d(E)[0];let M=0;for(let A=0;AA-y-v)}function a(E,y){let M=0;for(let v=0;vy+M*M,0))}function p(E){if(E.length===0)throw Error("Array must not be empty");let y=E[0],M=0;for(let v=1;vy&&(y=E[v],M=v);return[y,M]}function c(E){return E>0&&(E&E-1)===0}class f{constructor(y){if(this.size=y|0,this.size<=1||!c(this.size))throw new Error("FFT size must be a power of two larger than 1");this._csize=y<<1,this.table=new Float64Array(this.size*2);for(let v=0;vv;v<<=1)++M;this._width=M%2===0?M-1:M,this._bitrev=new Int32Array(1<>>C&3)<>>1);for(let C=0;C>>1]=y[C];return v}toComplexArray(y,M){const v=M||this.createComplexArray();for(let C=0;C>>1],v[C+1]=0;return v}transform(y,M){if(y===M)throw new Error("Input and output buffers must be different");this._transform4(y,M,1)}realTransform(y,M){if(y===M)throw new Error("Input and output buffers must be different");this._realTransform4(y,M,1)}inverseTransform(y,M){if(y===M)throw new Error("Input and output buffers must be different");this._transform4(y,M,-1);for(let v=0;v>=2;B>=2;B>>=2){K=C/B<<1;const Z=K>>>2;for(G=0;G>>1,B>>>1)}else for(G=0,j=0;G>>1,B>>>1,v)}const H=this.table;for(B>>=2;B>=2;B>>=2){K=C/B<<1;const X=K>>>1,oe=X>>>1,me=oe>>>1;for(G=0;G>>1;for(let X=2;X>1;++ee){const H=(ee+1-y)**2/2,Z=Math.sqrt(G**2+j**2)**H,X=H*Math.atan2(j,G),oe=2*ee;A[oe]=Z*Math.cos(X),A[oe+1]=Z*Math.sin(X),B[oe]=A[oe],B[oe+1]=-A[oe+1]}this._slicedChirpBuffer=A.subarray(M,v),this._f=new f(C>>1),this._f.transform(this._chirpBuffer,B)}_transform(y,M,v){const C=this._buffer1,A=this._buffer2,B=this._outBuffer1,K=this._outBuffer2,G=this._chirpBuffer,j=this._slicedChirpBuffer,ee=this._a;if(v)for(let H=0;H>1,oe=M[X];C[H]=oe*j[H],C[Z]=oe*j[Z]}else for(let H=0;H=E.length&&(G=2*(E.length-1)-G),v[B++]=E[G]}v.sort(),M[A]=v[C]}return M}function w(E,y){const M=Math.pow(10,y);return Math.round(E*M)/M}function g(E){const y=Math.round(E);return Math.abs(E)%1===.5?y%2===0?y:y-1:y}function S(E){const y=E.length,M=E[0].length,v=[y+1,M+1],C=Array.from({length:v[0]},()=>Array(v[1]).fill(1/0));C[0][0]=0;const A=Array.from({length:v[0]},()=>Array(v[1]).fill(-1));for(let ee=1;ee0||K>0;)switch(G.push(B-1),j.push(K-1),A[B][K]){case 0:--B,--K;break;case 1:--B;break;case 2:--K;break;default:throw new Error(`Internal error in dynamic time warping. Unexpected trace[${B}, ${K}]. Please file a bug report.`)}return G.reverse(),j.reverse(),[G,j]}},"./src/utils/tensor.js":(e,r,t)=>{t.r(r),t.d(r,{DataTypeMap:()=>i,Tensor:()=>a,cat:()=>M,full:()=>j,full_like:()=>ee,interpolate:()=>p,interpolate_4d:()=>d,layer_norm:()=>g,matmul:()=>c,mean:()=>B,mean_pooling:()=>w,ones:()=>H,ones_like:()=>Z,permute:()=>u,quantize_embeddings:()=>ae,rand:()=>me,rfft:()=>f,slice:()=>k,stack:()=>v,std_mean:()=>A,topk:()=>_,zeros:()=>X,zeros_like:()=>oe});var s=t("./src/utils/maths.js"),o=t("./src/backends/onnx.js"),n=t("./src/ops/registry.js");const i=Object.freeze({float32:Float32Array,float16:typeof Float16Array<"u"?Float16Array:Uint16Array,float64:Float64Array,string:Array,int8:Int8Array,uint8:Uint8Array,int16:Int16Array,uint16:Uint16Array,int32:Int32Array,uint32:Uint32Array,int64:BigInt64Array,uint64:BigUint64Array,bool:Uint8Array,uint4:Uint8Array,int4:Int8Array});class a{constructor(...F){te(this,"ort_tensor");return(0,o.isONNXTensor)(F[0])?this.ort_tensor=F[0]:this.ort_tensor=new o.Tensor(F[0],F[1],F[2]),new Proxy(this,{get:(W,re)=>{if(typeof re=="string"){let _e=Number(re);if(Number.isInteger(_e))return W._getitem(_e)}return W[re]},set:(W,re,_e)=>W[re]=_e})}get dims(){return this.ort_tensor.dims}set dims(F){this.ort_tensor.dims=F}get type(){return this.ort_tensor.type}get data(){return this.ort_tensor.data}get size(){return this.ort_tensor.size}get location(){return this.ort_tensor.location}dispose(){this.ort_tensor.dispose()}*[Symbol.iterator](){const[F,...W]=this.dims;if(W.length>0){const re=W.reduce((_e,se)=>_e*se);for(let _e=0;_e0){const _e=re.reduce((se,ce)=>se*ce);return this._subarray(F,_e,re)}else return new a(this.type,[this.data[F]],re)}indexOf(F){const W=this.data;for(let re=0;repe)throw new Error(`Invalid slice: ${q}`);const xe=[Math.max(R,0),Math.min(pe,this.dims[we])];re.push(xe),W.push(xe[1]-xe[0])}else throw new Error(`Invalid slice: ${q}`)}const _e=re.map(([we,q])=>q-we),se=_e.reduce((we,q)=>we*q),ce=this.data,$e=new ce.constructor(se),Ue=this.stride();for(let we=0;we=0;--R){const xe=_e[R];q+=(pe%xe+re[R][0])*Ue[R],pe=Math.floor(pe/xe)}$e[we]=ce[q]}return new a(this.type,$e,W)}permute(...F){return u(this,F)}transpose(...F){return this.permute(...F)}sum(F=null,W=!1){return this.norm(1,F,W)}norm(F="fro",W=null,re=!1){if(F==="fro")F=2;else if(typeof F=="string")throw Error(`Unsupported norm: ${F}`);const _e=this.data,se=(we,q)=>we+q**F;if(W===null){const we=_e.reduce(se,0)**(1/F);return new a(this.type,[we],[])}const[ce,$e,Ue]=C(se,this,W,re);if(F!==1)for(let we=0;we<$e.length;++we)$e[we]=$e[we]**(1/F);return new a(ce,$e,Ue)}normalize_(F=2,W=1){W=y(W,this.dims.length);const re=this.norm(F,W,!0),_e=this.data,se=re.data;for(let ce=0;ce<_e.length;++ce){let $e=0;for(let Ue=this.dims.length-1,we=ce,q=1;Ue>=0;--Ue){const R=this.dims[Ue];if(Ue!==W){const pe=we%R;$e+=pe*q,q*=this.dims[Ue]}we=Math.floor(we/R)}_e[ce]/=se[$e]}return this}normalize(F=2,W=1){return this.clone().normalize_(F,W)}stride(){return K(this.dims)}squeeze(F=null){return new a(this.type,this.data,S(this.dims,F))}squeeze_(F=null){return this.dims=S(this.dims,F),this}unsqueeze(F=null){return new a(this.type,this.data,E(this.dims,F))}unsqueeze_(F=null){return this.dims=E(this.dims,F),this}flatten_(F=0,W=-1){W=(W+this.dims.length)%this.dims.length;let re=this.dims.slice(0,F),_e=this.dims.slice(F,W+1),se=this.dims.slice(W+1);return this.dims=[...re,_e.reduce((ce,$e)=>ce*$e,1),...se],this}flatten(F=0,W=-1){return this.clone().flatten_(F,W)}view(...F){let W=-1;for(let _e=0;_e$e!==W?se*ce:se,1);F[W]=re.length/_e}return new a(this.type,re,F)}neg_(){const F=this.data;for(let W=0;WF?1:0;return new a("bool",W,this.dims)}lt(F){const W=new Uint8Array(this.data.length),re=this.data;for(let _e=0;_eMath.min(ce,$e),this,F,W,1/0);return new a(re,_e,se)}max(F=null,W=!1){if(F===null){const ce=(0,s.max)(this.data)[0];return new a(this.type,[ce],[])}const[re,_e,se]=C((ce,$e)=>Math.max(ce,$e),this,F,W,-1/0);return new a(re,_e,se)}argmin(F=null,W=!1){if(F!==null)throw new Error("`dim !== null` not yet implemented.");const re=(0,s.min)(this.data)[1];return new a("int64",[BigInt(re)],[])}argmax(F=null,W=!1){if(F!==null)throw new Error("`dim !== null` not yet implemented.");const re=(0,s.max)(this.data)[1];return new a("int64",[BigInt(re)],[])}to(F){if(this.type===F)return this;if(!i.hasOwnProperty(F))throw new Error(`Unsupported type: ${F}`);let W;const re=["int64","uint64"].includes(this.type),_e=["int64","uint64"].includes(F);return re&&!_e?W=Number:!re&&_e&&(W=BigInt),new a(F,i[F].from(this.data,W),this.dims)}}function l(V,F){const W=V.length,re=F.reduce((se,ce)=>se*ce);if(W!==re)throw Error(`cannot reshape array of size ${W} into shape (${F})`);let _e=V;for(let se=F.length-1;se>=0;se--)_e=_e.reduce((ce,$e)=>{let Ue=ce[ce.length-1];return Ue.lengthnew a("int64",V,[V.length]);async function k(V,F,W,re,_e){return await(await n.TensorOpRegistry.slice)({x:V,s:T(F),e:T(W),a:T(re),t:T(_e??new Array(re.length).fill(1))})}function w(V,F){const W=V.data,re=F.data,_e=[V.dims[0],V.dims[2]],se=new W.constructor(_e[0]*_e[1]),[ce,$e,Ue]=V.dims;let we=0;for(let q=0;qW!==1):typeof F=="number"?V[F]===1&&V.splice(F,1):Array.isArray(F)&&(V=V.filter((W,re)=>W!==1||!F.includes(re))),V}function E(V,F){return F=y(F,V.length+1),V=V.slice(),V.splice(F,0,1),V}function y(V,F,W=null,re=!0){if(V<-F||V>=F){if(re)throw new Error(`IndexError: index ${V} is out of bounds for dimension${W===null?"":" "+W} with size ${F}`);return V<-F?0:F}return V<0&&(V=(V%F+F)%F),V}function M(V,F=0){F=y(F,V[0].dims.length);const W=V[0].dims.slice();W[F]=V.reduce((ce,$e)=>ce+$e.dims[F],0);const re=W.reduce((ce,$e)=>ce*$e,1),_e=new V[0].data.constructor(re),se=V[0].type;if(F===0){let ce=0;for(const $e of V){const Ue=$e.data;_e.set(Ue,ce),ce+=Ue.length}}else{let ce=0;for(let $e=0;$e=0;--pe){const Se=we[pe];let Ae=xe%Se;pe===F&&(Ae+=ce),R+=Ae*be,be*=W[pe],xe=Math.floor(xe/Se)}_e[R]=Ue[q]}ce+=we[F]}}return new a(se,_e,W)}function v(V,F=0){return M(V.map(W=>W.unsqueeze(F)),F)}function C(V,F,W=null,re=!1,_e=null){const se=F.data,ce=F.dims;W=y(W,ce.length);const $e=ce.slice();$e[W]=1;const Ue=new se.constructor(se.length/ce[W]);_e!==null&&Ue.fill(_e);for(let we=0;we=0;--R){const be=ce[R];if(R!==W){const Se=pe%be;q+=Se*xe,xe*=$e[R]}pe=Math.floor(pe/be)}Ue[q]=V(Ue[q],se[we],we,q)}return re||$e.splice(W,1),[F.type,Ue,$e]}function A(V,F=null,W=1,re=!1){const _e=V.data,se=V.dims;if(F===null){const xe=_e.reduce((Fe,ze)=>Fe+ze,0)/_e.length,be=Math.sqrt(_e.reduce((Fe,ze)=>Fe+(ze-xe)**2,0)/(_e.length-W)),Se=new a(V.type,[xe],[]);return[new a(V.type,[be],[]),Se]}F=y(F,se.length);const ce=B(V,F,re),$e=ce.data,[Ue,we,q]=C((pe,xe,be,Se)=>pe+(xe-$e[Se])**2,V,F,re);for(let pe=0;pewe+q,0);return new a(V.type,[Ue/_e.length],[])}F=y(F,re.length);const[se,ce,$e]=C((Ue,we)=>Ue+we,V,F,W);if(re[F]!==1)for(let Ue=0;Ue=0;--W)F[W]=re,re*=V[W];return F}function G(V,F,W,re){const _e=V.reduce((se,ce)=>se*ce,1);return new a(W,new re(_e).fill(F),V)}function j(V,F){let W,re;if(typeof F=="number")W="float32",re=Float32Array;else if(typeof F=="bigint")W="int64",re=BigInt64Array;else if(typeof F=="boolean")W="bool",re=Uint8Array;else throw new Error(`Unsupported data type: ${typeof F}`);return G(V,F,W,re)}function ee(V,F){return j(V.dims,F)}function H(V){return G(V,1n,"int64",BigInt64Array)}function Z(V){return H(V.dims)}function X(V){return G(V,0n,"int64",BigInt64Array)}function oe(V){return X(V.dims)}function me(V){const F=V.reduce((W,re)=>W*re,1);return new a("float32",Float32Array.from({length:F},()=>Math.random()),V)}function ae(V,F){if(V.dims.length!==2)throw new Error("The tensor must have 2 dimensions");if(V.dims.at(-1)%8!==0)throw new Error("The last dimension of the tensor must be a multiple of 8");if(!["binary","ubinary"].includes(F))throw new Error("The precision must be either 'binary' or 'ubinary'");const W=F==="binary",re=W?"int8":"uint8",_e=W?Int8Array:Uint8Array,se=V.data,ce=new _e(se.length/8);for(let $e=0;$e0?1:0,we=Math.floor($e/8),q=$e%8;ce[we]|=Ue<<7-q,W&&q===0&&(ce[we]-=128)}return new a(re,ce,[V.dims[0],V.dims[1]/8])}},"./src/utils/video.js":(e,r,t)=>{t.r(r),t.d(r,{RawVideo:()=>i,RawVideoFrame:()=>n,load_video:()=>a});var s=t("./src/utils/image.js"),o=t("./src/env.js");class n{constructor(u,p){this.image=u,this.timestamp=p}}class i{constructor(u,p){u.length>0&&u[0]instanceof s.RawImage&&(u=u.map((d,c)=>new n(d,(c+1)/(u.length+1)*p))),this.frames=u,this.duration=p}get width(){return this.frames[0].image.width}get height(){return this.frames[0].image.height}get fps(){return this.frames.length/this.duration}}async function a(l,{num_frames:u=null,fps:p=null}={}){if(!o.apis.IS_BROWSER_ENV)throw new Error("`load_video` is currently only supported in browser environments.");if(u==null&&p==null)throw new Error("Either num_frames or fps must be provided.");const d=[],c=document.createElement("video");if(c.crossOrigin="anonymous",c.muted=!0,typeof l=="string")c.src=l;else if(l instanceof Blob)c.src=URL.createObjectURL(l);else if(l instanceof HTMLVideoElement)c.src=l.src;else throw new Error("Invalid URL or video element provided.");if(await new Promise(S=>c.onloadedmetadata=S),c.seekable.start(0)===c.seekable.end(0)){const E=await(await fetch(c.src)).blob();c.src=URL.createObjectURL(E),await new Promise(y=>c.onloadedmetadata=y)}const f=c.duration;let _,T;u!=null?(_=u,T=u===1?0:f/(u-1)):(T=1/p,_=Math.floor(f/T));let k=[];for(let S=0;S<_;++S)k.push(u===1?f/2:S*T);const w=document.createElement("canvas");w.width=c.videoWidth,w.height=c.videoHeight;const g=w.getContext("2d",{willReadFrequently:!0});for(const S of k){c.currentTime=S,await new Promise(v=>{c.onseeked=v}),g.drawImage(c,0,0,w.width,w.height);const E=g.getImageData(0,0,w.width,w.height),y=new s.RawImage(E.data,w.width,w.height,4),M=new n(y,S);d.push(M)}return c.remove(),new i(d,f)}}},Ng={};function $t(e){var r=Ng[e];if(r!==void 0)return r.exports;var t=Ng[e]={exports:{}};return bx[e](t,t.exports,$t),t.exports}(()=>{var e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,r;$t.t=function(t,s){if(s&1&&(t=this(t)),s&8||typeof t=="object"&&t&&(s&4&&t.__esModule||s&16&&typeof t.then=="function"))return t;var o=Object.create(null);$t.r(o);var n={};r=r||[null,e({}),e([]),e(e)];for(var i=s&2&&t;typeof i=="object"&&!~r.indexOf(i);i=e(i))Object.getOwnPropertyNames(i).forEach(a=>n[a]=()=>t[a]);return n.default=()=>t,$t.d(o,n),o}})(),$t.d=(e,r)=>{for(var t in r)$t.o(r,t)&&!$t.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},$t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),$t.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var m={};(()=>{/*!*****************************!*\ + !*** ./src/transformers.js ***! + \*****************************/$t.r(m),$t.d(m,{ASTFeatureExtractor:()=>d.ASTFeatureExtractor,ASTForAudioClassification:()=>t.ASTForAudioClassification,ASTModel:()=>t.ASTModel,ASTPreTrainedModel:()=>t.ASTPreTrainedModel,AlbertForMaskedLM:()=>t.AlbertForMaskedLM,AlbertForQuestionAnswering:()=>t.AlbertForQuestionAnswering,AlbertForSequenceClassification:()=>t.AlbertForSequenceClassification,AlbertModel:()=>t.AlbertModel,AlbertPreTrainedModel:()=>t.AlbertPreTrainedModel,AlbertTokenizer:()=>s.AlbertTokenizer,AudioClassificationPipeline:()=>r.AudioClassificationPipeline,AutoConfig:()=>o.AutoConfig,AutoFeatureExtractor:()=>c.AutoFeatureExtractor,AutoImageProcessor:()=>T.AutoImageProcessor,AutoModel:()=>t.AutoModel,AutoModelForAudioClassification:()=>t.AutoModelForAudioClassification,AutoModelForAudioFrameClassification:()=>t.AutoModelForAudioFrameClassification,AutoModelForAudioTextToText:()=>t.AutoModelForAudioTextToText,AutoModelForCTC:()=>t.AutoModelForCTC,AutoModelForCausalLM:()=>t.AutoModelForCausalLM,AutoModelForDepthEstimation:()=>t.AutoModelForDepthEstimation,AutoModelForDocumentQuestionAnswering:()=>t.AutoModelForDocumentQuestionAnswering,AutoModelForImageClassification:()=>t.AutoModelForImageClassification,AutoModelForImageFeatureExtraction:()=>t.AutoModelForImageFeatureExtraction,AutoModelForImageMatting:()=>t.AutoModelForImageMatting,AutoModelForImageSegmentation:()=>t.AutoModelForImageSegmentation,AutoModelForImageTextToText:()=>t.AutoModelForImageTextToText,AutoModelForImageToImage:()=>t.AutoModelForImageToImage,AutoModelForMaskGeneration:()=>t.AutoModelForMaskGeneration,AutoModelForMaskedLM:()=>t.AutoModelForMaskedLM,AutoModelForNormalEstimation:()=>t.AutoModelForNormalEstimation,AutoModelForObjectDetection:()=>t.AutoModelForObjectDetection,AutoModelForPoseEstimation:()=>t.AutoModelForPoseEstimation,AutoModelForQuestionAnswering:()=>t.AutoModelForQuestionAnswering,AutoModelForSemanticSegmentation:()=>t.AutoModelForSemanticSegmentation,AutoModelForSeq2SeqLM:()=>t.AutoModelForSeq2SeqLM,AutoModelForSequenceClassification:()=>t.AutoModelForSequenceClassification,AutoModelForSpeechSeq2Seq:()=>t.AutoModelForSpeechSeq2Seq,AutoModelForTextToSpectrogram:()=>t.AutoModelForTextToSpectrogram,AutoModelForTextToWaveform:()=>t.AutoModelForTextToWaveform,AutoModelForTokenClassification:()=>t.AutoModelForTokenClassification,AutoModelForUniversalSegmentation:()=>t.AutoModelForUniversalSegmentation,AutoModelForVision2Seq:()=>t.AutoModelForVision2Seq,AutoModelForXVector:()=>t.AutoModelForXVector,AutoModelForZeroShotObjectDetection:()=>t.AutoModelForZeroShotObjectDetection,AutoProcessor:()=>g.AutoProcessor,AutoTokenizer:()=>s.AutoTokenizer,AutomaticSpeechRecognitionPipeline:()=>r.AutomaticSpeechRecognitionPipeline,BackgroundRemovalPipeline:()=>r.BackgroundRemovalPipeline,BartForConditionalGeneration:()=>t.BartForConditionalGeneration,BartForSequenceClassification:()=>t.BartForSequenceClassification,BartModel:()=>t.BartModel,BartPretrainedModel:()=>t.BartPretrainedModel,BartTokenizer:()=>s.BartTokenizer,BaseModelOutput:()=>t.BaseModelOutput,BaseStreamer:()=>S.BaseStreamer,BeitFeatureExtractor:()=>_.BeitFeatureExtractor,BeitForImageClassification:()=>t.BeitForImageClassification,BeitModel:()=>t.BeitModel,BeitPreTrainedModel:()=>t.BeitPreTrainedModel,BertForMaskedLM:()=>t.BertForMaskedLM,BertForQuestionAnswering:()=>t.BertForQuestionAnswering,BertForSequenceClassification:()=>t.BertForSequenceClassification,BertForTokenClassification:()=>t.BertForTokenClassification,BertModel:()=>t.BertModel,BertPreTrainedModel:()=>t.BertPreTrainedModel,BertTokenizer:()=>s.BertTokenizer,BitImageProcessor:()=>_.BitImageProcessor,BlenderbotForConditionalGeneration:()=>t.BlenderbotForConditionalGeneration,BlenderbotModel:()=>t.BlenderbotModel,BlenderbotPreTrainedModel:()=>t.BlenderbotPreTrainedModel,BlenderbotSmallForConditionalGeneration:()=>t.BlenderbotSmallForConditionalGeneration,BlenderbotSmallModel:()=>t.BlenderbotSmallModel,BlenderbotSmallPreTrainedModel:()=>t.BlenderbotSmallPreTrainedModel,BlenderbotSmallTokenizer:()=>s.BlenderbotSmallTokenizer,BlenderbotTokenizer:()=>s.BlenderbotTokenizer,BloomForCausalLM:()=>t.BloomForCausalLM,BloomModel:()=>t.BloomModel,BloomPreTrainedModel:()=>t.BloomPreTrainedModel,BloomTokenizer:()=>s.BloomTokenizer,CLIPFeatureExtractor:()=>_.CLIPFeatureExtractor,CLIPImageProcessor:()=>_.CLIPImageProcessor,CLIPModel:()=>t.CLIPModel,CLIPPreTrainedModel:()=>t.CLIPPreTrainedModel,CLIPSegForImageSegmentation:()=>t.CLIPSegForImageSegmentation,CLIPSegModel:()=>t.CLIPSegModel,CLIPSegPreTrainedModel:()=>t.CLIPSegPreTrainedModel,CLIPTextModel:()=>t.CLIPTextModel,CLIPTextModelWithProjection:()=>t.CLIPTextModelWithProjection,CLIPTokenizer:()=>s.CLIPTokenizer,CLIPVisionModel:()=>t.CLIPVisionModel,CLIPVisionModelWithProjection:()=>t.CLIPVisionModelWithProjection,CamembertForMaskedLM:()=>t.CamembertForMaskedLM,CamembertForQuestionAnswering:()=>t.CamembertForQuestionAnswering,CamembertForSequenceClassification:()=>t.CamembertForSequenceClassification,CamembertForTokenClassification:()=>t.CamembertForTokenClassification,CamembertModel:()=>t.CamembertModel,CamembertPreTrainedModel:()=>t.CamembertPreTrainedModel,CamembertTokenizer:()=>s.CamembertTokenizer,CausalLMOutput:()=>t.CausalLMOutput,CausalLMOutputWithPast:()=>t.CausalLMOutputWithPast,ChineseCLIPFeatureExtractor:()=>_.ChineseCLIPFeatureExtractor,ChineseCLIPModel:()=>t.ChineseCLIPModel,ChineseCLIPPreTrainedModel:()=>t.ChineseCLIPPreTrainedModel,ClapAudioModelWithProjection:()=>t.ClapAudioModelWithProjection,ClapFeatureExtractor:()=>d.ClapFeatureExtractor,ClapModel:()=>t.ClapModel,ClapPreTrainedModel:()=>t.ClapPreTrainedModel,ClapTextModelWithProjection:()=>t.ClapTextModelWithProjection,ClassifierFreeGuidanceLogitsProcessor:()=>y.ClassifierFreeGuidanceLogitsProcessor,CodeGenForCausalLM:()=>t.CodeGenForCausalLM,CodeGenModel:()=>t.CodeGenModel,CodeGenPreTrainedModel:()=>t.CodeGenPreTrainedModel,CodeGenTokenizer:()=>s.CodeGenTokenizer,CodeLlamaTokenizer:()=>s.CodeLlamaTokenizer,CohereForCausalLM:()=>t.CohereForCausalLM,CohereModel:()=>t.CohereModel,CoherePreTrainedModel:()=>t.CoherePreTrainedModel,CohereTokenizer:()=>s.CohereTokenizer,ConvBertForMaskedLM:()=>t.ConvBertForMaskedLM,ConvBertForQuestionAnswering:()=>t.ConvBertForQuestionAnswering,ConvBertForSequenceClassification:()=>t.ConvBertForSequenceClassification,ConvBertForTokenClassification:()=>t.ConvBertForTokenClassification,ConvBertModel:()=>t.ConvBertModel,ConvBertPreTrainedModel:()=>t.ConvBertPreTrainedModel,ConvBertTokenizer:()=>s.ConvBertTokenizer,ConvNextFeatureExtractor:()=>_.ConvNextFeatureExtractor,ConvNextForImageClassification:()=>t.ConvNextForImageClassification,ConvNextImageProcessor:()=>_.ConvNextImageProcessor,ConvNextModel:()=>t.ConvNextModel,ConvNextPreTrainedModel:()=>t.ConvNextPreTrainedModel,ConvNextV2ForImageClassification:()=>t.ConvNextV2ForImageClassification,ConvNextV2Model:()=>t.ConvNextV2Model,ConvNextV2PreTrainedModel:()=>t.ConvNextV2PreTrainedModel,DPTFeatureExtractor:()=>_.DPTFeatureExtractor,DPTForDepthEstimation:()=>t.DPTForDepthEstimation,DPTImageProcessor:()=>_.DPTImageProcessor,DPTModel:()=>t.DPTModel,DPTPreTrainedModel:()=>t.DPTPreTrainedModel,DacDecoderModel:()=>t.DacDecoderModel,DacDecoderOutput:()=>t.DacDecoderOutput,DacEncoderModel:()=>t.DacEncoderModel,DacEncoderOutput:()=>t.DacEncoderOutput,DacFeatureExtractor:()=>d.DacFeatureExtractor,DacModel:()=>t.DacModel,DacPreTrainedModel:()=>t.DacPreTrainedModel,DataTypeMap:()=>l.DataTypeMap,DebertaForMaskedLM:()=>t.DebertaForMaskedLM,DebertaForQuestionAnswering:()=>t.DebertaForQuestionAnswering,DebertaForSequenceClassification:()=>t.DebertaForSequenceClassification,DebertaForTokenClassification:()=>t.DebertaForTokenClassification,DebertaModel:()=>t.DebertaModel,DebertaPreTrainedModel:()=>t.DebertaPreTrainedModel,DebertaTokenizer:()=>s.DebertaTokenizer,DebertaV2ForMaskedLM:()=>t.DebertaV2ForMaskedLM,DebertaV2ForQuestionAnswering:()=>t.DebertaV2ForQuestionAnswering,DebertaV2ForSequenceClassification:()=>t.DebertaV2ForSequenceClassification,DebertaV2ForTokenClassification:()=>t.DebertaV2ForTokenClassification,DebertaV2Model:()=>t.DebertaV2Model,DebertaV2PreTrainedModel:()=>t.DebertaV2PreTrainedModel,DebertaV2Tokenizer:()=>s.DebertaV2Tokenizer,DecisionTransformerModel:()=>t.DecisionTransformerModel,DecisionTransformerPreTrainedModel:()=>t.DecisionTransformerPreTrainedModel,DeiTFeatureExtractor:()=>_.DeiTFeatureExtractor,DeiTForImageClassification:()=>t.DeiTForImageClassification,DeiTImageProcessor:()=>_.DeiTImageProcessor,DeiTModel:()=>t.DeiTModel,DeiTPreTrainedModel:()=>t.DeiTPreTrainedModel,DepthAnythingForDepthEstimation:()=>t.DepthAnythingForDepthEstimation,DepthAnythingPreTrainedModel:()=>t.DepthAnythingPreTrainedModel,DepthEstimationPipeline:()=>r.DepthEstimationPipeline,DepthProForDepthEstimation:()=>t.DepthProForDepthEstimation,DepthProPreTrainedModel:()=>t.DepthProPreTrainedModel,DetrFeatureExtractor:()=>_.DetrFeatureExtractor,DetrForObjectDetection:()=>t.DetrForObjectDetection,DetrForSegmentation:()=>t.DetrForSegmentation,DetrImageProcessor:()=>_.DetrImageProcessor,DetrModel:()=>t.DetrModel,DetrObjectDetectionOutput:()=>t.DetrObjectDetectionOutput,DetrPreTrainedModel:()=>t.DetrPreTrainedModel,DetrSegmentationOutput:()=>t.DetrSegmentationOutput,Dinov2ForImageClassification:()=>t.Dinov2ForImageClassification,Dinov2Model:()=>t.Dinov2Model,Dinov2PreTrainedModel:()=>t.Dinov2PreTrainedModel,Dinov2WithRegistersForImageClassification:()=>t.Dinov2WithRegistersForImageClassification,Dinov2WithRegistersModel:()=>t.Dinov2WithRegistersModel,Dinov2WithRegistersPreTrainedModel:()=>t.Dinov2WithRegistersPreTrainedModel,DistilBertForMaskedLM:()=>t.DistilBertForMaskedLM,DistilBertForQuestionAnswering:()=>t.DistilBertForQuestionAnswering,DistilBertForSequenceClassification:()=>t.DistilBertForSequenceClassification,DistilBertForTokenClassification:()=>t.DistilBertForTokenClassification,DistilBertModel:()=>t.DistilBertModel,DistilBertPreTrainedModel:()=>t.DistilBertPreTrainedModel,DistilBertTokenizer:()=>s.DistilBertTokenizer,DocumentQuestionAnsweringPipeline:()=>r.DocumentQuestionAnsweringPipeline,DonutFeatureExtractor:()=>_.DonutFeatureExtractor,DonutImageProcessor:()=>_.DonutImageProcessor,DonutSwinModel:()=>t.DonutSwinModel,DonutSwinPreTrainedModel:()=>t.DonutSwinPreTrainedModel,EfficientNetForImageClassification:()=>t.EfficientNetForImageClassification,EfficientNetImageProcessor:()=>_.EfficientNetImageProcessor,EfficientNetModel:()=>t.EfficientNetModel,EfficientNetPreTrainedModel:()=>t.EfficientNetPreTrainedModel,ElectraForMaskedLM:()=>t.ElectraForMaskedLM,ElectraForQuestionAnswering:()=>t.ElectraForQuestionAnswering,ElectraForSequenceClassification:()=>t.ElectraForSequenceClassification,ElectraForTokenClassification:()=>t.ElectraForTokenClassification,ElectraModel:()=>t.ElectraModel,ElectraPreTrainedModel:()=>t.ElectraPreTrainedModel,ElectraTokenizer:()=>s.ElectraTokenizer,EncodecFeatureExtractor:()=>d.EncodecFeatureExtractor,EosTokenCriteria:()=>E.EosTokenCriteria,EsmForMaskedLM:()=>t.EsmForMaskedLM,EsmForSequenceClassification:()=>t.EsmForSequenceClassification,EsmForTokenClassification:()=>t.EsmForTokenClassification,EsmModel:()=>t.EsmModel,EsmPreTrainedModel:()=>t.EsmPreTrainedModel,EsmTokenizer:()=>s.EsmTokenizer,ExaoneForCausalLM:()=>t.ExaoneForCausalLM,ExaoneModel:()=>t.ExaoneModel,ExaonePreTrainedModel:()=>t.ExaonePreTrainedModel,FFT:()=>u.FFT,FalconForCausalLM:()=>t.FalconForCausalLM,FalconModel:()=>t.FalconModel,FalconPreTrainedModel:()=>t.FalconPreTrainedModel,FalconTokenizer:()=>s.FalconTokenizer,FastViTForImageClassification:()=>t.FastViTForImageClassification,FastViTModel:()=>t.FastViTModel,FastViTPreTrainedModel:()=>t.FastViTPreTrainedModel,FeatureExtractionPipeline:()=>r.FeatureExtractionPipeline,FeatureExtractor:()=>p.FeatureExtractor,FillMaskPipeline:()=>r.FillMaskPipeline,Florence2ForConditionalGeneration:()=>t.Florence2ForConditionalGeneration,Florence2PreTrainedModel:()=>t.Florence2PreTrainedModel,Florence2Processor:()=>w.Florence2Processor,ForcedBOSTokenLogitsProcessor:()=>y.ForcedBOSTokenLogitsProcessor,ForcedEOSTokenLogitsProcessor:()=>y.ForcedEOSTokenLogitsProcessor,GLPNFeatureExtractor:()=>_.GLPNFeatureExtractor,GLPNForDepthEstimation:()=>t.GLPNForDepthEstimation,GLPNModel:()=>t.GLPNModel,GLPNPreTrainedModel:()=>t.GLPNPreTrainedModel,GPT2LMHeadModel:()=>t.GPT2LMHeadModel,GPT2Model:()=>t.GPT2Model,GPT2PreTrainedModel:()=>t.GPT2PreTrainedModel,GPT2Tokenizer:()=>s.GPT2Tokenizer,GPTBigCodeForCausalLM:()=>t.GPTBigCodeForCausalLM,GPTBigCodeModel:()=>t.GPTBigCodeModel,GPTBigCodePreTrainedModel:()=>t.GPTBigCodePreTrainedModel,GPTJForCausalLM:()=>t.GPTJForCausalLM,GPTJModel:()=>t.GPTJModel,GPTJPreTrainedModel:()=>t.GPTJPreTrainedModel,GPTNeoForCausalLM:()=>t.GPTNeoForCausalLM,GPTNeoModel:()=>t.GPTNeoModel,GPTNeoPreTrainedModel:()=>t.GPTNeoPreTrainedModel,GPTNeoXForCausalLM:()=>t.GPTNeoXForCausalLM,GPTNeoXModel:()=>t.GPTNeoXModel,GPTNeoXPreTrainedModel:()=>t.GPTNeoXPreTrainedModel,GPTNeoXTokenizer:()=>s.GPTNeoXTokenizer,Gemma2ForCausalLM:()=>t.Gemma2ForCausalLM,Gemma2Model:()=>t.Gemma2Model,Gemma2PreTrainedModel:()=>t.Gemma2PreTrainedModel,Gemma3ForCausalLM:()=>t.Gemma3ForCausalLM,Gemma3Model:()=>t.Gemma3Model,Gemma3PreTrainedModel:()=>t.Gemma3PreTrainedModel,GemmaForCausalLM:()=>t.GemmaForCausalLM,GemmaModel:()=>t.GemmaModel,GemmaPreTrainedModel:()=>t.GemmaPreTrainedModel,GemmaTokenizer:()=>s.GemmaTokenizer,GlmForCausalLM:()=>t.GlmForCausalLM,GlmModel:()=>t.GlmModel,GlmPreTrainedModel:()=>t.GlmPreTrainedModel,GraniteForCausalLM:()=>t.GraniteForCausalLM,GraniteModel:()=>t.GraniteModel,GranitePreTrainedModel:()=>t.GranitePreTrainedModel,Grok1Tokenizer:()=>s.Grok1Tokenizer,GroundingDinoForObjectDetection:()=>t.GroundingDinoForObjectDetection,GroundingDinoImageProcessor:()=>_.GroundingDinoImageProcessor,GroundingDinoPreTrainedModel:()=>t.GroundingDinoPreTrainedModel,GroundingDinoProcessor:()=>w.GroundingDinoProcessor,GroupViTModel:()=>t.GroupViTModel,GroupViTPreTrainedModel:()=>t.GroupViTPreTrainedModel,HeliumForCausalLM:()=>t.HeliumForCausalLM,HeliumModel:()=>t.HeliumModel,HeliumPreTrainedModel:()=>t.HeliumPreTrainedModel,HerbertTokenizer:()=>s.HerbertTokenizer,HieraForImageClassification:()=>t.HieraForImageClassification,HieraModel:()=>t.HieraModel,HieraPreTrainedModel:()=>t.HieraPreTrainedModel,HubertForCTC:()=>t.HubertForCTC,HubertForSequenceClassification:()=>t.HubertForSequenceClassification,HubertModel:()=>t.HubertModel,HubertPreTrainedModel:()=>t.HubertPreTrainedModel,IJepaForImageClassification:()=>t.IJepaForImageClassification,IJepaModel:()=>t.IJepaModel,IJepaPreTrainedModel:()=>t.IJepaPreTrainedModel,Idefics3ForConditionalGeneration:()=>t.Idefics3ForConditionalGeneration,Idefics3ImageProcessor:()=>_.Idefics3ImageProcessor,Idefics3PreTrainedModel:()=>t.Idefics3PreTrainedModel,Idefics3Processor:()=>w.Idefics3Processor,ImageClassificationPipeline:()=>r.ImageClassificationPipeline,ImageFeatureExtractionPipeline:()=>r.ImageFeatureExtractionPipeline,ImageFeatureExtractor:()=>d.ImageFeatureExtractor,ImageMattingOutput:()=>t.ImageMattingOutput,ImageProcessor:()=>f.ImageProcessor,ImageSegmentationPipeline:()=>r.ImageSegmentationPipeline,ImageToImagePipeline:()=>r.ImageToImagePipeline,ImageToTextPipeline:()=>r.ImageToTextPipeline,InterruptableStoppingCriteria:()=>E.InterruptableStoppingCriteria,JAISLMHeadModel:()=>t.JAISLMHeadModel,JAISModel:()=>t.JAISModel,JAISPreTrainedModel:()=>t.JAISPreTrainedModel,JinaCLIPImageProcessor:()=>_.JinaCLIPImageProcessor,JinaCLIPModel:()=>t.JinaCLIPModel,JinaCLIPPreTrainedModel:()=>t.JinaCLIPPreTrainedModel,JinaCLIPProcessor:()=>w.JinaCLIPProcessor,JinaCLIPTextModel:()=>t.JinaCLIPTextModel,JinaCLIPVisionModel:()=>t.JinaCLIPVisionModel,LiteWhisperForConditionalGeneration:()=>t.LiteWhisperForConditionalGeneration,LlamaForCausalLM:()=>t.LlamaForCausalLM,LlamaModel:()=>t.LlamaModel,LlamaPreTrainedModel:()=>t.LlamaPreTrainedModel,LlamaTokenizer:()=>s.LlamaTokenizer,LlavaForConditionalGeneration:()=>t.LlavaForConditionalGeneration,LlavaOnevisionForConditionalGeneration:()=>t.LlavaOnevisionForConditionalGeneration,LlavaOnevisionImageProcessor:()=>_.LlavaOnevisionImageProcessor,LlavaPreTrainedModel:()=>t.LlavaPreTrainedModel,LogitsProcessor:()=>y.LogitsProcessor,LogitsProcessorList:()=>y.LogitsProcessorList,LogitsWarper:()=>y.LogitsWarper,LongT5ForConditionalGeneration:()=>t.LongT5ForConditionalGeneration,LongT5Model:()=>t.LongT5Model,LongT5PreTrainedModel:()=>t.LongT5PreTrainedModel,M2M100ForConditionalGeneration:()=>t.M2M100ForConditionalGeneration,M2M100Model:()=>t.M2M100Model,M2M100PreTrainedModel:()=>t.M2M100PreTrainedModel,M2M100Tokenizer:()=>s.M2M100Tokenizer,MBart50Tokenizer:()=>s.MBart50Tokenizer,MBartForCausalLM:()=>t.MBartForCausalLM,MBartForConditionalGeneration:()=>t.MBartForConditionalGeneration,MBartForSequenceClassification:()=>t.MBartForSequenceClassification,MBartModel:()=>t.MBartModel,MBartPreTrainedModel:()=>t.MBartPreTrainedModel,MBartTokenizer:()=>s.MBartTokenizer,MPNetForMaskedLM:()=>t.MPNetForMaskedLM,MPNetForQuestionAnswering:()=>t.MPNetForQuestionAnswering,MPNetForSequenceClassification:()=>t.MPNetForSequenceClassification,MPNetForTokenClassification:()=>t.MPNetForTokenClassification,MPNetModel:()=>t.MPNetModel,MPNetPreTrainedModel:()=>t.MPNetPreTrainedModel,MPNetTokenizer:()=>s.MPNetTokenizer,MT5ForConditionalGeneration:()=>t.MT5ForConditionalGeneration,MT5Model:()=>t.MT5Model,MT5PreTrainedModel:()=>t.MT5PreTrainedModel,MarianMTModel:()=>t.MarianMTModel,MarianModel:()=>t.MarianModel,MarianPreTrainedModel:()=>t.MarianPreTrainedModel,MarianTokenizer:()=>s.MarianTokenizer,Mask2FormerImageProcessor:()=>_.Mask2FormerImageProcessor,MaskFormerFeatureExtractor:()=>_.MaskFormerFeatureExtractor,MaskFormerForInstanceSegmentation:()=>t.MaskFormerForInstanceSegmentation,MaskFormerImageProcessor:()=>_.MaskFormerImageProcessor,MaskFormerModel:()=>t.MaskFormerModel,MaskFormerPreTrainedModel:()=>t.MaskFormerPreTrainedModel,MaskedLMOutput:()=>t.MaskedLMOutput,MaxLengthCriteria:()=>E.MaxLengthCriteria,Metric3DForDepthEstimation:()=>t.Metric3DForDepthEstimation,Metric3DPreTrainedModel:()=>t.Metric3DPreTrainedModel,Metric3Dv2ForDepthEstimation:()=>t.Metric3Dv2ForDepthEstimation,Metric3Dv2PreTrainedModel:()=>t.Metric3Dv2PreTrainedModel,MgpstrForSceneTextRecognition:()=>t.MgpstrForSceneTextRecognition,MgpstrModelOutput:()=>t.MgpstrModelOutput,MgpstrPreTrainedModel:()=>t.MgpstrPreTrainedModel,MgpstrProcessor:()=>w.MgpstrProcessor,MgpstrTokenizer:()=>s.MgpstrTokenizer,MimiDecoderModel:()=>t.MimiDecoderModel,MimiDecoderOutput:()=>t.MimiDecoderOutput,MimiEncoderModel:()=>t.MimiEncoderModel,MimiEncoderOutput:()=>t.MimiEncoderOutput,MimiModel:()=>t.MimiModel,MimiPreTrainedModel:()=>t.MimiPreTrainedModel,MinLengthLogitsProcessor:()=>y.MinLengthLogitsProcessor,MinNewTokensLengthLogitsProcessor:()=>y.MinNewTokensLengthLogitsProcessor,MistralForCausalLM:()=>t.MistralForCausalLM,MistralModel:()=>t.MistralModel,MistralPreTrainedModel:()=>t.MistralPreTrainedModel,MobileBertForMaskedLM:()=>t.MobileBertForMaskedLM,MobileBertForQuestionAnswering:()=>t.MobileBertForQuestionAnswering,MobileBertForSequenceClassification:()=>t.MobileBertForSequenceClassification,MobileBertModel:()=>t.MobileBertModel,MobileBertPreTrainedModel:()=>t.MobileBertPreTrainedModel,MobileBertTokenizer:()=>s.MobileBertTokenizer,MobileLLMForCausalLM:()=>t.MobileLLMForCausalLM,MobileLLMModel:()=>t.MobileLLMModel,MobileLLMPreTrainedModel:()=>t.MobileLLMPreTrainedModel,MobileNetV1FeatureExtractor:()=>_.MobileNetV1FeatureExtractor,MobileNetV1ForImageClassification:()=>t.MobileNetV1ForImageClassification,MobileNetV1ForSemanticSegmentation:()=>t.MobileNetV1ForSemanticSegmentation,MobileNetV1ImageProcessor:()=>_.MobileNetV1ImageProcessor,MobileNetV1Model:()=>t.MobileNetV1Model,MobileNetV1PreTrainedModel:()=>t.MobileNetV1PreTrainedModel,MobileNetV2FeatureExtractor:()=>_.MobileNetV2FeatureExtractor,MobileNetV2ForImageClassification:()=>t.MobileNetV2ForImageClassification,MobileNetV2ForSemanticSegmentation:()=>t.MobileNetV2ForSemanticSegmentation,MobileNetV2ImageProcessor:()=>_.MobileNetV2ImageProcessor,MobileNetV2Model:()=>t.MobileNetV2Model,MobileNetV2PreTrainedModel:()=>t.MobileNetV2PreTrainedModel,MobileNetV3FeatureExtractor:()=>_.MobileNetV3FeatureExtractor,MobileNetV3ForImageClassification:()=>t.MobileNetV3ForImageClassification,MobileNetV3ForSemanticSegmentation:()=>t.MobileNetV3ForSemanticSegmentation,MobileNetV3ImageProcessor:()=>_.MobileNetV3ImageProcessor,MobileNetV3Model:()=>t.MobileNetV3Model,MobileNetV3PreTrainedModel:()=>t.MobileNetV3PreTrainedModel,MobileNetV4FeatureExtractor:()=>_.MobileNetV4FeatureExtractor,MobileNetV4ForImageClassification:()=>t.MobileNetV4ForImageClassification,MobileNetV4ForSemanticSegmentation:()=>t.MobileNetV4ForSemanticSegmentation,MobileNetV4ImageProcessor:()=>_.MobileNetV4ImageProcessor,MobileNetV4Model:()=>t.MobileNetV4Model,MobileNetV4PreTrainedModel:()=>t.MobileNetV4PreTrainedModel,MobileViTFeatureExtractor:()=>_.MobileViTFeatureExtractor,MobileViTForImageClassification:()=>t.MobileViTForImageClassification,MobileViTImageProcessor:()=>_.MobileViTImageProcessor,MobileViTModel:()=>t.MobileViTModel,MobileViTPreTrainedModel:()=>t.MobileViTPreTrainedModel,MobileViTV2ForImageClassification:()=>t.MobileViTV2ForImageClassification,MobileViTV2Model:()=>t.MobileViTV2Model,MobileViTV2PreTrainedModel:()=>t.MobileViTV2PreTrainedModel,ModelOutput:()=>t.ModelOutput,ModernBertForMaskedLM:()=>t.ModernBertForMaskedLM,ModernBertForSequenceClassification:()=>t.ModernBertForSequenceClassification,ModernBertForTokenClassification:()=>t.ModernBertForTokenClassification,ModernBertModel:()=>t.ModernBertModel,ModernBertPreTrainedModel:()=>t.ModernBertPreTrainedModel,Moondream1ForConditionalGeneration:()=>t.Moondream1ForConditionalGeneration,MoonshineFeatureExtractor:()=>d.MoonshineFeatureExtractor,MoonshineForConditionalGeneration:()=>t.MoonshineForConditionalGeneration,MoonshineModel:()=>t.MoonshineModel,MoonshinePreTrainedModel:()=>t.MoonshinePreTrainedModel,MoonshineProcessor:()=>w.MoonshineProcessor,MptForCausalLM:()=>t.MptForCausalLM,MptModel:()=>t.MptModel,MptPreTrainedModel:()=>t.MptPreTrainedModel,MultiModalityCausalLM:()=>t.MultiModalityCausalLM,MultiModalityPreTrainedModel:()=>t.MultiModalityPreTrainedModel,MusicgenForCausalLM:()=>t.MusicgenForCausalLM,MusicgenForConditionalGeneration:()=>t.MusicgenForConditionalGeneration,MusicgenModel:()=>t.MusicgenModel,MusicgenPreTrainedModel:()=>t.MusicgenPreTrainedModel,NllbTokenizer:()=>s.NllbTokenizer,NoBadWordsLogitsProcessor:()=>y.NoBadWordsLogitsProcessor,NoRepeatNGramLogitsProcessor:()=>y.NoRepeatNGramLogitsProcessor,NomicBertModel:()=>t.NomicBertModel,NomicBertPreTrainedModel:()=>t.NomicBertPreTrainedModel,NougatImageProcessor:()=>_.NougatImageProcessor,NougatTokenizer:()=>s.NougatTokenizer,OPTForCausalLM:()=>t.OPTForCausalLM,OPTModel:()=>t.OPTModel,OPTPreTrainedModel:()=>t.OPTPreTrainedModel,ObjectDetectionPipeline:()=>r.ObjectDetectionPipeline,Olmo2ForCausalLM:()=>t.Olmo2ForCausalLM,Olmo2Model:()=>t.Olmo2Model,Olmo2PreTrainedModel:()=>t.Olmo2PreTrainedModel,OlmoForCausalLM:()=>t.OlmoForCausalLM,OlmoModel:()=>t.OlmoModel,OlmoPreTrainedModel:()=>t.OlmoPreTrainedModel,OpenELMForCausalLM:()=>t.OpenELMForCausalLM,OpenELMModel:()=>t.OpenELMModel,OpenELMPreTrainedModel:()=>t.OpenELMPreTrainedModel,OwlViTFeatureExtractor:()=>_.OwlViTFeatureExtractor,OwlViTForObjectDetection:()=>t.OwlViTForObjectDetection,OwlViTImageProcessor:()=>_.OwlViTImageProcessor,OwlViTModel:()=>t.OwlViTModel,OwlViTPreTrainedModel:()=>t.OwlViTPreTrainedModel,OwlViTProcessor:()=>w.OwlViTProcessor,Owlv2ForObjectDetection:()=>t.Owlv2ForObjectDetection,Owlv2ImageProcessor:()=>_.Owlv2ImageProcessor,Owlv2Model:()=>t.Owlv2Model,Owlv2PreTrainedModel:()=>t.Owlv2PreTrainedModel,PaliGemmaForConditionalGeneration:()=>t.PaliGemmaForConditionalGeneration,PaliGemmaPreTrainedModel:()=>t.PaliGemmaPreTrainedModel,PaliGemmaProcessor:()=>w.PaliGemmaProcessor,PatchTSMixerForPrediction:()=>t.PatchTSMixerForPrediction,PatchTSMixerModel:()=>t.PatchTSMixerModel,PatchTSMixerPreTrainedModel:()=>t.PatchTSMixerPreTrainedModel,PatchTSTForPrediction:()=>t.PatchTSTForPrediction,PatchTSTModel:()=>t.PatchTSTModel,PatchTSTPreTrainedModel:()=>t.PatchTSTPreTrainedModel,Phi3ForCausalLM:()=>t.Phi3ForCausalLM,Phi3Model:()=>t.Phi3Model,Phi3PreTrainedModel:()=>t.Phi3PreTrainedModel,Phi3VForCausalLM:()=>t.Phi3VForCausalLM,Phi3VImageProcessor:()=>_.Phi3VImageProcessor,Phi3VPreTrainedModel:()=>t.Phi3VPreTrainedModel,Phi3VProcessor:()=>w.Phi3VProcessor,PhiForCausalLM:()=>t.PhiForCausalLM,PhiModel:()=>t.PhiModel,PhiPreTrainedModel:()=>t.PhiPreTrainedModel,Pipeline:()=>r.Pipeline,PreTrainedModel:()=>t.PreTrainedModel,PreTrainedTokenizer:()=>s.PreTrainedTokenizer,PretrainedConfig:()=>o.PretrainedConfig,PretrainedMixin:()=>t.PretrainedMixin,Processor:()=>k.Processor,PvtForImageClassification:()=>t.PvtForImageClassification,PvtImageProcessor:()=>_.PvtImageProcessor,PvtModel:()=>t.PvtModel,PvtPreTrainedModel:()=>t.PvtPreTrainedModel,PyAnnoteFeatureExtractor:()=>d.PyAnnoteFeatureExtractor,PyAnnoteForAudioFrameClassification:()=>t.PyAnnoteForAudioFrameClassification,PyAnnoteModel:()=>t.PyAnnoteModel,PyAnnotePreTrainedModel:()=>t.PyAnnotePreTrainedModel,PyAnnoteProcessor:()=>w.PyAnnoteProcessor,QuestionAnsweringModelOutput:()=>t.QuestionAnsweringModelOutput,QuestionAnsweringPipeline:()=>r.QuestionAnsweringPipeline,Qwen2ForCausalLM:()=>t.Qwen2ForCausalLM,Qwen2Model:()=>t.Qwen2Model,Qwen2PreTrainedModel:()=>t.Qwen2PreTrainedModel,Qwen2Tokenizer:()=>s.Qwen2Tokenizer,Qwen2VLForConditionalGeneration:()=>t.Qwen2VLForConditionalGeneration,Qwen2VLImageProcessor:()=>_.Qwen2VLImageProcessor,Qwen2VLPreTrainedModel:()=>t.Qwen2VLPreTrainedModel,Qwen2VLProcessor:()=>w.Qwen2VLProcessor,RFDetrForObjectDetection:()=>t.RFDetrForObjectDetection,RFDetrModel:()=>t.RFDetrModel,RFDetrObjectDetectionOutput:()=>t.RFDetrObjectDetectionOutput,RFDetrPreTrainedModel:()=>t.RFDetrPreTrainedModel,RTDetrForObjectDetection:()=>t.RTDetrForObjectDetection,RTDetrImageProcessor:()=>_.RTDetrImageProcessor,RTDetrModel:()=>t.RTDetrModel,RTDetrObjectDetectionOutput:()=>t.RTDetrObjectDetectionOutput,RTDetrPreTrainedModel:()=>t.RTDetrPreTrainedModel,RTDetrV2ForObjectDetection:()=>t.RTDetrV2ForObjectDetection,RTDetrV2Model:()=>t.RTDetrV2Model,RTDetrV2ObjectDetectionOutput:()=>t.RTDetrV2ObjectDetectionOutput,RTDetrV2PreTrainedModel:()=>t.RTDetrV2PreTrainedModel,RawAudio:()=>n.RawAudio,RawImage:()=>i.RawImage,RawVideo:()=>a.RawVideo,RawVideoFrame:()=>a.RawVideoFrame,RepetitionPenaltyLogitsProcessor:()=>y.RepetitionPenaltyLogitsProcessor,ResNetForImageClassification:()=>t.ResNetForImageClassification,ResNetModel:()=>t.ResNetModel,ResNetPreTrainedModel:()=>t.ResNetPreTrainedModel,RoFormerForMaskedLM:()=>t.RoFormerForMaskedLM,RoFormerForQuestionAnswering:()=>t.RoFormerForQuestionAnswering,RoFormerForSequenceClassification:()=>t.RoFormerForSequenceClassification,RoFormerForTokenClassification:()=>t.RoFormerForTokenClassification,RoFormerModel:()=>t.RoFormerModel,RoFormerPreTrainedModel:()=>t.RoFormerPreTrainedModel,RoFormerTokenizer:()=>s.RoFormerTokenizer,RobertaForMaskedLM:()=>t.RobertaForMaskedLM,RobertaForQuestionAnswering:()=>t.RobertaForQuestionAnswering,RobertaForSequenceClassification:()=>t.RobertaForSequenceClassification,RobertaForTokenClassification:()=>t.RobertaForTokenClassification,RobertaModel:()=>t.RobertaModel,RobertaPreTrainedModel:()=>t.RobertaPreTrainedModel,RobertaTokenizer:()=>s.RobertaTokenizer,SamImageProcessor:()=>_.SamImageProcessor,SamImageSegmentationOutput:()=>t.SamImageSegmentationOutput,SamModel:()=>t.SamModel,SamPreTrainedModel:()=>t.SamPreTrainedModel,SamProcessor:()=>w.SamProcessor,SapiensForDepthEstimation:()=>t.SapiensForDepthEstimation,SapiensForNormalEstimation:()=>t.SapiensForNormalEstimation,SapiensForSemanticSegmentation:()=>t.SapiensForSemanticSegmentation,SapiensPreTrainedModel:()=>t.SapiensPreTrainedModel,SeamlessM4TFeatureExtractor:()=>d.SeamlessM4TFeatureExtractor,SegformerFeatureExtractor:()=>_.SegformerFeatureExtractor,SegformerForImageClassification:()=>t.SegformerForImageClassification,SegformerForSemanticSegmentation:()=>t.SegformerForSemanticSegmentation,SegformerImageProcessor:()=>_.SegformerImageProcessor,SegformerModel:()=>t.SegformerModel,SegformerPreTrainedModel:()=>t.SegformerPreTrainedModel,Seq2SeqLMOutput:()=>t.Seq2SeqLMOutput,SequenceClassifierOutput:()=>t.SequenceClassifierOutput,SiglipImageProcessor:()=>_.SiglipImageProcessor,SiglipModel:()=>t.SiglipModel,SiglipPreTrainedModel:()=>t.SiglipPreTrainedModel,SiglipTextModel:()=>t.SiglipTextModel,SiglipTokenizer:()=>s.SiglipTokenizer,SiglipVisionModel:()=>t.SiglipVisionModel,SmolVLMForConditionalGeneration:()=>t.SmolVLMForConditionalGeneration,SmolVLMImageProcessor:()=>_.SmolVLMImageProcessor,SmolVLMProcessor:()=>w.SmolVLMProcessor,SnacDecoderModel:()=>t.SnacDecoderModel,SnacEncoderModel:()=>t.SnacEncoderModel,SnacFeatureExtractor:()=>d.SnacFeatureExtractor,SnacModel:()=>t.SnacModel,SnacPreTrainedModel:()=>t.SnacPreTrainedModel,SpeechT5FeatureExtractor:()=>d.SpeechT5FeatureExtractor,SpeechT5ForSpeechToText:()=>t.SpeechT5ForSpeechToText,SpeechT5ForTextToSpeech:()=>t.SpeechT5ForTextToSpeech,SpeechT5HifiGan:()=>t.SpeechT5HifiGan,SpeechT5Model:()=>t.SpeechT5Model,SpeechT5PreTrainedModel:()=>t.SpeechT5PreTrainedModel,SpeechT5Processor:()=>w.SpeechT5Processor,SpeechT5Tokenizer:()=>s.SpeechT5Tokenizer,SqueezeBertForMaskedLM:()=>t.SqueezeBertForMaskedLM,SqueezeBertForQuestionAnswering:()=>t.SqueezeBertForQuestionAnswering,SqueezeBertForSequenceClassification:()=>t.SqueezeBertForSequenceClassification,SqueezeBertModel:()=>t.SqueezeBertModel,SqueezeBertPreTrainedModel:()=>t.SqueezeBertPreTrainedModel,SqueezeBertTokenizer:()=>s.SqueezeBertTokenizer,StableLmForCausalLM:()=>t.StableLmForCausalLM,StableLmModel:()=>t.StableLmModel,StableLmPreTrainedModel:()=>t.StableLmPreTrainedModel,Starcoder2ForCausalLM:()=>t.Starcoder2ForCausalLM,Starcoder2Model:()=>t.Starcoder2Model,Starcoder2PreTrainedModel:()=>t.Starcoder2PreTrainedModel,StoppingCriteria:()=>E.StoppingCriteria,StoppingCriteriaList:()=>E.StoppingCriteriaList,StyleTextToSpeech2Model:()=>t.StyleTextToSpeech2Model,StyleTextToSpeech2PreTrainedModel:()=>t.StyleTextToSpeech2PreTrainedModel,SummarizationPipeline:()=>r.SummarizationPipeline,SuppressTokensAtBeginLogitsProcessor:()=>y.SuppressTokensAtBeginLogitsProcessor,Swin2SRForImageSuperResolution:()=>t.Swin2SRForImageSuperResolution,Swin2SRImageProcessor:()=>_.Swin2SRImageProcessor,Swin2SRModel:()=>t.Swin2SRModel,Swin2SRPreTrainedModel:()=>t.Swin2SRPreTrainedModel,SwinForImageClassification:()=>t.SwinForImageClassification,SwinForSemanticSegmentation:()=>t.SwinForSemanticSegmentation,SwinModel:()=>t.SwinModel,SwinPreTrainedModel:()=>t.SwinPreTrainedModel,T5ForConditionalGeneration:()=>t.T5ForConditionalGeneration,T5Model:()=>t.T5Model,T5PreTrainedModel:()=>t.T5PreTrainedModel,T5Tokenizer:()=>s.T5Tokenizer,TableTransformerForObjectDetection:()=>t.TableTransformerForObjectDetection,TableTransformerModel:()=>t.TableTransformerModel,TableTransformerObjectDetectionOutput:()=>t.TableTransformerObjectDetectionOutput,TableTransformerPreTrainedModel:()=>t.TableTransformerPreTrainedModel,TemperatureLogitsWarper:()=>y.TemperatureLogitsWarper,Tensor:()=>l.Tensor,Text2TextGenerationPipeline:()=>r.Text2TextGenerationPipeline,TextClassificationPipeline:()=>r.TextClassificationPipeline,TextGenerationPipeline:()=>r.TextGenerationPipeline,TextStreamer:()=>S.TextStreamer,TextToAudioPipeline:()=>r.TextToAudioPipeline,TokenClassificationPipeline:()=>r.TokenClassificationPipeline,TokenClassifierOutput:()=>t.TokenClassifierOutput,TokenizerModel:()=>s.TokenizerModel,TopKLogitsWarper:()=>y.TopKLogitsWarper,TopPLogitsWarper:()=>y.TopPLogitsWarper,TrOCRForCausalLM:()=>t.TrOCRForCausalLM,TrOCRPreTrainedModel:()=>t.TrOCRPreTrainedModel,TranslationPipeline:()=>r.TranslationPipeline,UltravoxModel:()=>t.UltravoxModel,UltravoxPreTrainedModel:()=>t.UltravoxPreTrainedModel,UltravoxProcessor:()=>w.UltravoxProcessor,UniSpeechForCTC:()=>t.UniSpeechForCTC,UniSpeechForSequenceClassification:()=>t.UniSpeechForSequenceClassification,UniSpeechModel:()=>t.UniSpeechModel,UniSpeechPreTrainedModel:()=>t.UniSpeechPreTrainedModel,UniSpeechSatForAudioFrameClassification:()=>t.UniSpeechSatForAudioFrameClassification,UniSpeechSatForCTC:()=>t.UniSpeechSatForCTC,UniSpeechSatForSequenceClassification:()=>t.UniSpeechSatForSequenceClassification,UniSpeechSatModel:()=>t.UniSpeechSatModel,UniSpeechSatPreTrainedModel:()=>t.UniSpeechSatPreTrainedModel,VLChatProcessor:()=>w.VLChatProcessor,VLMImageProcessor:()=>_.VLMImageProcessor,ViTFeatureExtractor:()=>_.ViTFeatureExtractor,ViTForImageClassification:()=>t.ViTForImageClassification,ViTImageProcessor:()=>_.ViTImageProcessor,ViTMAEModel:()=>t.ViTMAEModel,ViTMAEPreTrainedModel:()=>t.ViTMAEPreTrainedModel,ViTMSNForImageClassification:()=>t.ViTMSNForImageClassification,ViTMSNModel:()=>t.ViTMSNModel,ViTMSNPreTrainedModel:()=>t.ViTMSNPreTrainedModel,ViTModel:()=>t.ViTModel,ViTPreTrainedModel:()=>t.ViTPreTrainedModel,VisionEncoderDecoderModel:()=>t.VisionEncoderDecoderModel,VitMatteForImageMatting:()=>t.VitMatteForImageMatting,VitMatteImageProcessor:()=>_.VitMatteImageProcessor,VitMattePreTrainedModel:()=>t.VitMattePreTrainedModel,VitPoseForPoseEstimation:()=>t.VitPoseForPoseEstimation,VitPoseImageProcessor:()=>_.VitPoseImageProcessor,VitPosePreTrainedModel:()=>t.VitPosePreTrainedModel,VitsModel:()=>t.VitsModel,VitsModelOutput:()=>t.VitsModelOutput,VitsPreTrainedModel:()=>t.VitsPreTrainedModel,VitsTokenizer:()=>s.VitsTokenizer,Wav2Vec2BertForCTC:()=>t.Wav2Vec2BertForCTC,Wav2Vec2BertForSequenceClassification:()=>t.Wav2Vec2BertForSequenceClassification,Wav2Vec2BertModel:()=>t.Wav2Vec2BertModel,Wav2Vec2BertPreTrainedModel:()=>t.Wav2Vec2BertPreTrainedModel,Wav2Vec2CTCTokenizer:()=>s.Wav2Vec2CTCTokenizer,Wav2Vec2FeatureExtractor:()=>d.Wav2Vec2FeatureExtractor,Wav2Vec2ForAudioFrameClassification:()=>t.Wav2Vec2ForAudioFrameClassification,Wav2Vec2ForCTC:()=>t.Wav2Vec2ForCTC,Wav2Vec2ForSequenceClassification:()=>t.Wav2Vec2ForSequenceClassification,Wav2Vec2Model:()=>t.Wav2Vec2Model,Wav2Vec2PreTrainedModel:()=>t.Wav2Vec2PreTrainedModel,Wav2Vec2Processor:()=>w.Wav2Vec2Processor,Wav2Vec2ProcessorWithLM:()=>w.Wav2Vec2ProcessorWithLM,WavLMForAudioFrameClassification:()=>t.WavLMForAudioFrameClassification,WavLMForCTC:()=>t.WavLMForCTC,WavLMForSequenceClassification:()=>t.WavLMForSequenceClassification,WavLMForXVector:()=>t.WavLMForXVector,WavLMModel:()=>t.WavLMModel,WavLMPreTrainedModel:()=>t.WavLMPreTrainedModel,WeSpeakerFeatureExtractor:()=>d.WeSpeakerFeatureExtractor,WeSpeakerResNetModel:()=>t.WeSpeakerResNetModel,WeSpeakerResNetPreTrainedModel:()=>t.WeSpeakerResNetPreTrainedModel,WhisperFeatureExtractor:()=>d.WhisperFeatureExtractor,WhisperForConditionalGeneration:()=>t.WhisperForConditionalGeneration,WhisperModel:()=>t.WhisperModel,WhisperPreTrainedModel:()=>t.WhisperPreTrainedModel,WhisperProcessor:()=>w.WhisperProcessor,WhisperTextStreamer:()=>S.WhisperTextStreamer,WhisperTimeStampLogitsProcessor:()=>y.WhisperTimeStampLogitsProcessor,WhisperTokenizer:()=>s.WhisperTokenizer,XLMForQuestionAnswering:()=>t.XLMForQuestionAnswering,XLMForSequenceClassification:()=>t.XLMForSequenceClassification,XLMForTokenClassification:()=>t.XLMForTokenClassification,XLMModel:()=>t.XLMModel,XLMPreTrainedModel:()=>t.XLMPreTrainedModel,XLMRobertaForMaskedLM:()=>t.XLMRobertaForMaskedLM,XLMRobertaForQuestionAnswering:()=>t.XLMRobertaForQuestionAnswering,XLMRobertaForSequenceClassification:()=>t.XLMRobertaForSequenceClassification,XLMRobertaForTokenClassification:()=>t.XLMRobertaForTokenClassification,XLMRobertaModel:()=>t.XLMRobertaModel,XLMRobertaPreTrainedModel:()=>t.XLMRobertaPreTrainedModel,XLMRobertaTokenizer:()=>s.XLMRobertaTokenizer,XLMTokenizer:()=>s.XLMTokenizer,XLMWithLMHeadModel:()=>t.XLMWithLMHeadModel,XVectorOutput:()=>t.XVectorOutput,YolosFeatureExtractor:()=>_.YolosFeatureExtractor,YolosForObjectDetection:()=>t.YolosForObjectDetection,YolosImageProcessor:()=>_.YolosImageProcessor,YolosModel:()=>t.YolosModel,YolosObjectDetectionOutput:()=>t.YolosObjectDetectionOutput,YolosPreTrainedModel:()=>t.YolosPreTrainedModel,ZeroShotAudioClassificationPipeline:()=>r.ZeroShotAudioClassificationPipeline,ZeroShotClassificationPipeline:()=>r.ZeroShotClassificationPipeline,ZeroShotImageClassificationPipeline:()=>r.ZeroShotImageClassificationPipeline,ZeroShotObjectDetectionPipeline:()=>r.ZeroShotObjectDetectionPipeline,bankers_round:()=>u.bankers_round,cat:()=>l.cat,cos_sim:()=>u.cos_sim,dot:()=>u.dot,dynamic_time_warping:()=>u.dynamic_time_warping,env:()=>e.env,full:()=>l.full,full_like:()=>l.full_like,getKeyValueShapes:()=>o.getKeyValueShapes,hamming:()=>n.hamming,hanning:()=>n.hanning,interpolate:()=>l.interpolate,interpolate_4d:()=>l.interpolate_4d,interpolate_data:()=>u.interpolate_data,is_chinese_char:()=>s.is_chinese_char,layer_norm:()=>l.layer_norm,load_image:()=>i.load_image,load_video:()=>a.load_video,log_softmax:()=>u.log_softmax,magnitude:()=>u.magnitude,matmul:()=>l.matmul,max:()=>u.max,mean:()=>l.mean,mean_pooling:()=>l.mean_pooling,medianFilter:()=>u.medianFilter,mel_filter_bank:()=>n.mel_filter_bank,min:()=>u.min,ones:()=>l.ones,ones_like:()=>l.ones_like,permute:()=>l.permute,permute_data:()=>u.permute_data,pipeline:()=>r.pipeline,quantize_embeddings:()=>l.quantize_embeddings,rand:()=>l.rand,read_audio:()=>n.read_audio,rfft:()=>l.rfft,round:()=>u.round,slice:()=>l.slice,softmax:()=>u.softmax,spectrogram:()=>n.spectrogram,stack:()=>l.stack,std_mean:()=>l.std_mean,topk:()=>l.topk,window_function:()=>n.window_function,zeros:()=>l.zeros,zeros_like:()=>l.zeros_like});var e=$t("./src/env.js"),r=$t("./src/pipelines.js"),t=$t("./src/models.js"),s=$t("./src/tokenizers.js"),o=$t("./src/configs.js"),n=$t("./src/utils/audio.js"),i=$t("./src/utils/image.js"),a=$t("./src/utils/video.js"),l=$t("./src/utils/tensor.js"),u=$t("./src/utils/maths.js"),p=$t("./src/base/feature_extraction_utils.js"),d=$t("./src/models/feature_extractors.js"),c=$t("./src/models/auto/feature_extraction_auto.js"),f=$t("./src/base/image_processors_utils.js"),_=$t("./src/models/image_processors.js"),T=$t("./src/models/auto/image_processing_auto.js"),k=$t("./src/base/processing_utils.js"),w=$t("./src/models/processors.js"),g=$t("./src/models/auto/processing_auto.js"),S=$t("./src/generation/streamers.js"),E=$t("./src/generation/stopping_criteria.js"),y=$t("./src/generation/logits_process.js")})(),m.ASTFeatureExtractor,m.ASTForAudioClassification,m.ASTModel,m.ASTPreTrainedModel,m.AlbertForMaskedLM,m.AlbertForQuestionAnswering,m.AlbertForSequenceClassification,m.AlbertModel,m.AlbertPreTrainedModel,m.AlbertTokenizer,m.AudioClassificationPipeline,m.AutoConfig,m.AutoFeatureExtractor,m.AutoImageProcessor,m.AutoModel,m.AutoModelForAudioClassification,m.AutoModelForAudioFrameClassification,m.AutoModelForAudioTextToText,m.AutoModelForCTC,m.AutoModelForCausalLM,m.AutoModelForDepthEstimation,m.AutoModelForDocumentQuestionAnswering,m.AutoModelForImageClassification,m.AutoModelForImageFeatureExtraction,m.AutoModelForImageMatting,m.AutoModelForImageSegmentation,m.AutoModelForImageTextToText,m.AutoModelForImageToImage,m.AutoModelForMaskGeneration,m.AutoModelForMaskedLM,m.AutoModelForNormalEstimation,m.AutoModelForObjectDetection,m.AutoModelForPoseEstimation,m.AutoModelForQuestionAnswering,m.AutoModelForSemanticSegmentation,m.AutoModelForSeq2SeqLM,m.AutoModelForSequenceClassification,m.AutoModelForSpeechSeq2Seq,m.AutoModelForTextToSpectrogram,m.AutoModelForTextToWaveform,m.AutoModelForTokenClassification,m.AutoModelForUniversalSegmentation,m.AutoModelForVision2Seq,m.AutoModelForXVector,m.AutoModelForZeroShotObjectDetection;var yx=m.AutoProcessor,vx=m.AutoTokenizer;m.AutomaticSpeechRecognitionPipeline,m.BackgroundRemovalPipeline,m.BartForConditionalGeneration,m.BartForSequenceClassification,m.BartModel,m.BartPretrainedModel,m.BartTokenizer,m.BaseModelOutput,m.BaseStreamer,m.BeitFeatureExtractor,m.BeitForImageClassification,m.BeitModel,m.BeitPreTrainedModel,m.BertForMaskedLM,m.BertForQuestionAnswering,m.BertForSequenceClassification,m.BertForTokenClassification,m.BertModel,m.BertPreTrainedModel,m.BertTokenizer,m.BitImageProcessor,m.BlenderbotForConditionalGeneration,m.BlenderbotModel,m.BlenderbotPreTrainedModel,m.BlenderbotSmallForConditionalGeneration,m.BlenderbotSmallModel,m.BlenderbotSmallPreTrainedModel,m.BlenderbotSmallTokenizer,m.BlenderbotTokenizer,m.BloomForCausalLM,m.BloomModel,m.BloomPreTrainedModel,m.BloomTokenizer,m.CLIPFeatureExtractor,m.CLIPImageProcessor,m.CLIPModel,m.CLIPPreTrainedModel,m.CLIPSegForImageSegmentation,m.CLIPSegModel,m.CLIPSegPreTrainedModel,m.CLIPTextModel,m.CLIPTextModelWithProjection,m.CLIPTokenizer,m.CLIPVisionModel,m.CLIPVisionModelWithProjection,m.CamembertForMaskedLM,m.CamembertForQuestionAnswering,m.CamembertForSequenceClassification,m.CamembertForTokenClassification,m.CamembertModel,m.CamembertPreTrainedModel,m.CamembertTokenizer,m.CausalLMOutput,m.CausalLMOutputWithPast,m.ChineseCLIPFeatureExtractor,m.ChineseCLIPModel,m.ChineseCLIPPreTrainedModel,m.ClapAudioModelWithProjection,m.ClapFeatureExtractor,m.ClapModel,m.ClapPreTrainedModel,m.ClapTextModelWithProjection,m.ClassifierFreeGuidanceLogitsProcessor,m.CodeGenForCausalLM,m.CodeGenModel,m.CodeGenPreTrainedModel,m.CodeGenTokenizer,m.CodeLlamaTokenizer,m.CohereForCausalLM,m.CohereModel,m.CoherePreTrainedModel,m.CohereTokenizer,m.ConvBertForMaskedLM,m.ConvBertForQuestionAnswering,m.ConvBertForSequenceClassification,m.ConvBertForTokenClassification,m.ConvBertModel,m.ConvBertPreTrainedModel,m.ConvBertTokenizer,m.ConvNextFeatureExtractor,m.ConvNextForImageClassification,m.ConvNextImageProcessor,m.ConvNextModel,m.ConvNextPreTrainedModel,m.ConvNextV2ForImageClassification,m.ConvNextV2Model,m.ConvNextV2PreTrainedModel,m.DPTFeatureExtractor,m.DPTForDepthEstimation,m.DPTImageProcessor,m.DPTModel,m.DPTPreTrainedModel,m.DacDecoderModel,m.DacDecoderOutput,m.DacEncoderModel,m.DacEncoderOutput,m.DacFeatureExtractor,m.DacModel,m.DacPreTrainedModel,m.DataTypeMap,m.DebertaForMaskedLM,m.DebertaForQuestionAnswering,m.DebertaForSequenceClassification,m.DebertaForTokenClassification,m.DebertaModel,m.DebertaPreTrainedModel,m.DebertaTokenizer,m.DebertaV2ForMaskedLM,m.DebertaV2ForQuestionAnswering,m.DebertaV2ForSequenceClassification,m.DebertaV2ForTokenClassification,m.DebertaV2Model,m.DebertaV2PreTrainedModel,m.DebertaV2Tokenizer,m.DecisionTransformerModel,m.DecisionTransformerPreTrainedModel,m.DeiTFeatureExtractor,m.DeiTForImageClassification,m.DeiTImageProcessor,m.DeiTModel,m.DeiTPreTrainedModel,m.DepthAnythingForDepthEstimation,m.DepthAnythingPreTrainedModel,m.DepthEstimationPipeline,m.DepthProForDepthEstimation,m.DepthProPreTrainedModel,m.DetrFeatureExtractor,m.DetrForObjectDetection,m.DetrForSegmentation,m.DetrImageProcessor,m.DetrModel,m.DetrObjectDetectionOutput,m.DetrPreTrainedModel,m.DetrSegmentationOutput,m.Dinov2ForImageClassification,m.Dinov2Model,m.Dinov2PreTrainedModel,m.Dinov2WithRegistersForImageClassification,m.Dinov2WithRegistersModel,m.Dinov2WithRegistersPreTrainedModel,m.DistilBertForMaskedLM,m.DistilBertForQuestionAnswering,m.DistilBertForSequenceClassification,m.DistilBertForTokenClassification,m.DistilBertModel,m.DistilBertPreTrainedModel,m.DistilBertTokenizer,m.DocumentQuestionAnsweringPipeline,m.DonutFeatureExtractor,m.DonutImageProcessor,m.DonutSwinModel,m.DonutSwinPreTrainedModel,m.EfficientNetForImageClassification,m.EfficientNetImageProcessor,m.EfficientNetModel,m.EfficientNetPreTrainedModel,m.ElectraForMaskedLM,m.ElectraForQuestionAnswering,m.ElectraForSequenceClassification,m.ElectraForTokenClassification,m.ElectraModel,m.ElectraPreTrainedModel,m.ElectraTokenizer,m.EncodecFeatureExtractor,m.EosTokenCriteria,m.EsmForMaskedLM,m.EsmForSequenceClassification,m.EsmForTokenClassification,m.EsmModel,m.EsmPreTrainedModel,m.EsmTokenizer,m.ExaoneForCausalLM,m.ExaoneModel,m.ExaonePreTrainedModel,m.FFT,m.FalconForCausalLM,m.FalconModel,m.FalconPreTrainedModel,m.FalconTokenizer,m.FastViTForImageClassification,m.FastViTModel,m.FastViTPreTrainedModel,m.FeatureExtractionPipeline,m.FeatureExtractor,m.FillMaskPipeline,m.Florence2ForConditionalGeneration,m.Florence2PreTrainedModel,m.Florence2Processor,m.ForcedBOSTokenLogitsProcessor,m.ForcedEOSTokenLogitsProcessor,m.GLPNFeatureExtractor,m.GLPNForDepthEstimation,m.GLPNModel,m.GLPNPreTrainedModel,m.GPT2LMHeadModel,m.GPT2Model,m.GPT2PreTrainedModel,m.GPT2Tokenizer,m.GPTBigCodeForCausalLM,m.GPTBigCodeModel,m.GPTBigCodePreTrainedModel,m.GPTJForCausalLM,m.GPTJModel,m.GPTJPreTrainedModel,m.GPTNeoForCausalLM,m.GPTNeoModel,m.GPTNeoPreTrainedModel,m.GPTNeoXForCausalLM,m.GPTNeoXModel,m.GPTNeoXPreTrainedModel,m.GPTNeoXTokenizer,m.Gemma2ForCausalLM,m.Gemma2Model,m.Gemma2PreTrainedModel,m.Gemma3ForCausalLM,m.Gemma3Model,m.Gemma3PreTrainedModel,m.GemmaForCausalLM,m.GemmaModel,m.GemmaPreTrainedModel,m.GemmaTokenizer,m.GlmForCausalLM,m.GlmModel,m.GlmPreTrainedModel,m.GraniteForCausalLM,m.GraniteModel,m.GranitePreTrainedModel,m.Grok1Tokenizer,m.GroundingDinoForObjectDetection,m.GroundingDinoImageProcessor,m.GroundingDinoPreTrainedModel,m.GroundingDinoProcessor,m.GroupViTModel,m.GroupViTPreTrainedModel,m.HeliumForCausalLM,m.HeliumModel,m.HeliumPreTrainedModel,m.HerbertTokenizer,m.HieraForImageClassification,m.HieraModel,m.HieraPreTrainedModel,m.HubertForCTC,m.HubertForSequenceClassification,m.HubertModel,m.HubertPreTrainedModel,m.IJepaForImageClassification,m.IJepaModel,m.IJepaPreTrainedModel,m.Idefics3ForConditionalGeneration,m.Idefics3ImageProcessor,m.Idefics3PreTrainedModel,m.Idefics3Processor,m.ImageClassificationPipeline,m.ImageFeatureExtractionPipeline,m.ImageFeatureExtractor,m.ImageMattingOutput,m.ImageProcessor,m.ImageSegmentationPipeline,m.ImageToImagePipeline,m.ImageToTextPipeline,m.InterruptableStoppingCriteria,m.JAISLMHeadModel,m.JAISModel,m.JAISPreTrainedModel,m.JinaCLIPImageProcessor,m.JinaCLIPModel,m.JinaCLIPPreTrainedModel,m.JinaCLIPProcessor,m.JinaCLIPTextModel,m.JinaCLIPVisionModel,m.LiteWhisperForConditionalGeneration,m.LlamaForCausalLM,m.LlamaModel,m.LlamaPreTrainedModel,m.LlamaTokenizer,m.LlavaForConditionalGeneration,m.LlavaOnevisionForConditionalGeneration,m.LlavaOnevisionImageProcessor,m.LlavaPreTrainedModel,m.LogitsProcessor,m.LogitsProcessorList,m.LogitsWarper,m.LongT5ForConditionalGeneration,m.LongT5Model,m.LongT5PreTrainedModel,m.M2M100ForConditionalGeneration,m.M2M100Model,m.M2M100PreTrainedModel,m.M2M100Tokenizer,m.MBart50Tokenizer,m.MBartForCausalLM,m.MBartForConditionalGeneration,m.MBartForSequenceClassification,m.MBartModel,m.MBartPreTrainedModel,m.MBartTokenizer,m.MPNetForMaskedLM,m.MPNetForQuestionAnswering,m.MPNetForSequenceClassification,m.MPNetForTokenClassification,m.MPNetModel,m.MPNetPreTrainedModel,m.MPNetTokenizer,m.MT5ForConditionalGeneration,m.MT5Model,m.MT5PreTrainedModel,m.MarianMTModel,m.MarianModel,m.MarianPreTrainedModel,m.MarianTokenizer,m.Mask2FormerImageProcessor,m.MaskFormerFeatureExtractor,m.MaskFormerForInstanceSegmentation,m.MaskFormerImageProcessor,m.MaskFormerModel,m.MaskFormerPreTrainedModel,m.MaskedLMOutput,m.MaxLengthCriteria,m.Metric3DForDepthEstimation,m.Metric3DPreTrainedModel,m.Metric3Dv2ForDepthEstimation,m.Metric3Dv2PreTrainedModel,m.MgpstrForSceneTextRecognition,m.MgpstrModelOutput,m.MgpstrPreTrainedModel,m.MgpstrProcessor,m.MgpstrTokenizer,m.MimiDecoderModel,m.MimiDecoderOutput,m.MimiEncoderModel,m.MimiEncoderOutput,m.MimiModel,m.MimiPreTrainedModel,m.MinLengthLogitsProcessor,m.MinNewTokensLengthLogitsProcessor,m.MistralForCausalLM,m.MistralModel,m.MistralPreTrainedModel,m.MobileBertForMaskedLM,m.MobileBertForQuestionAnswering,m.MobileBertForSequenceClassification,m.MobileBertModel,m.MobileBertPreTrainedModel,m.MobileBertTokenizer,m.MobileLLMForCausalLM,m.MobileLLMModel,m.MobileLLMPreTrainedModel,m.MobileNetV1FeatureExtractor,m.MobileNetV1ForImageClassification,m.MobileNetV1ForSemanticSegmentation,m.MobileNetV1ImageProcessor,m.MobileNetV1Model,m.MobileNetV1PreTrainedModel,m.MobileNetV2FeatureExtractor,m.MobileNetV2ForImageClassification,m.MobileNetV2ForSemanticSegmentation,m.MobileNetV2ImageProcessor,m.MobileNetV2Model,m.MobileNetV2PreTrainedModel,m.MobileNetV3FeatureExtractor,m.MobileNetV3ForImageClassification,m.MobileNetV3ForSemanticSegmentation,m.MobileNetV3ImageProcessor,m.MobileNetV3Model,m.MobileNetV3PreTrainedModel,m.MobileNetV4FeatureExtractor,m.MobileNetV4ForImageClassification,m.MobileNetV4ForSemanticSegmentation,m.MobileNetV4ImageProcessor,m.MobileNetV4Model,m.MobileNetV4PreTrainedModel,m.MobileViTFeatureExtractor,m.MobileViTForImageClassification,m.MobileViTImageProcessor,m.MobileViTModel,m.MobileViTPreTrainedModel,m.MobileViTV2ForImageClassification,m.MobileViTV2Model,m.MobileViTV2PreTrainedModel,m.ModelOutput,m.ModernBertForMaskedLM,m.ModernBertForSequenceClassification,m.ModernBertForTokenClassification,m.ModernBertModel,m.ModernBertPreTrainedModel,m.Moondream1ForConditionalGeneration,m.MoonshineFeatureExtractor,m.MoonshineForConditionalGeneration,m.MoonshineModel,m.MoonshinePreTrainedModel,m.MoonshineProcessor,m.MptForCausalLM,m.MptModel,m.MptPreTrainedModel,m.MultiModalityCausalLM,m.MultiModalityPreTrainedModel,m.MusicgenForCausalLM,m.MusicgenForConditionalGeneration,m.MusicgenModel,m.MusicgenPreTrainedModel,m.NllbTokenizer,m.NoBadWordsLogitsProcessor,m.NoRepeatNGramLogitsProcessor,m.NomicBertModel,m.NomicBertPreTrainedModel,m.NougatImageProcessor,m.NougatTokenizer,m.OPTForCausalLM,m.OPTModel,m.OPTPreTrainedModel,m.ObjectDetectionPipeline,m.Olmo2ForCausalLM,m.Olmo2Model,m.Olmo2PreTrainedModel,m.OlmoForCausalLM,m.OlmoModel,m.OlmoPreTrainedModel,m.OpenELMForCausalLM,m.OpenELMModel,m.OpenELMPreTrainedModel,m.OwlViTFeatureExtractor,m.OwlViTForObjectDetection,m.OwlViTImageProcessor,m.OwlViTModel,m.OwlViTPreTrainedModel,m.OwlViTProcessor,m.Owlv2ForObjectDetection,m.Owlv2ImageProcessor,m.Owlv2Model,m.Owlv2PreTrainedModel,m.PaliGemmaForConditionalGeneration,m.PaliGemmaPreTrainedModel,m.PaliGemmaProcessor,m.PatchTSMixerForPrediction,m.PatchTSMixerModel,m.PatchTSMixerPreTrainedModel,m.PatchTSTForPrediction,m.PatchTSTModel,m.PatchTSTPreTrainedModel,m.Phi3ForCausalLM,m.Phi3Model,m.Phi3PreTrainedModel,m.Phi3VForCausalLM,m.Phi3VImageProcessor,m.Phi3VPreTrainedModel,m.Phi3VProcessor,m.PhiForCausalLM,m.PhiModel,m.PhiPreTrainedModel,m.Pipeline,m.PreTrainedModel,m.PreTrainedTokenizer,m.PretrainedConfig,m.PretrainedMixin,m.Processor,m.PvtForImageClassification,m.PvtImageProcessor,m.PvtModel,m.PvtPreTrainedModel,m.PyAnnoteFeatureExtractor,m.PyAnnoteForAudioFrameClassification,m.PyAnnoteModel,m.PyAnnotePreTrainedModel,m.PyAnnoteProcessor,m.QuestionAnsweringModelOutput,m.QuestionAnsweringPipeline,m.Qwen2ForCausalLM,m.Qwen2Model,m.Qwen2PreTrainedModel,m.Qwen2Tokenizer,m.Qwen2VLForConditionalGeneration,m.Qwen2VLImageProcessor,m.Qwen2VLPreTrainedModel,m.Qwen2VLProcessor,m.RFDetrForObjectDetection,m.RFDetrModel,m.RFDetrObjectDetectionOutput,m.RFDetrPreTrainedModel,m.RTDetrForObjectDetection,m.RTDetrImageProcessor,m.RTDetrModel,m.RTDetrObjectDetectionOutput,m.RTDetrPreTrainedModel,m.RTDetrV2ForObjectDetection,m.RTDetrV2Model,m.RTDetrV2ObjectDetectionOutput,m.RTDetrV2PreTrainedModel,m.RawAudio,m.RawImage,m.RawVideo,m.RawVideoFrame,m.RepetitionPenaltyLogitsProcessor,m.ResNetForImageClassification,m.ResNetModel,m.ResNetPreTrainedModel,m.RoFormerForMaskedLM,m.RoFormerForQuestionAnswering,m.RoFormerForSequenceClassification,m.RoFormerForTokenClassification,m.RoFormerModel,m.RoFormerPreTrainedModel,m.RoFormerTokenizer,m.RobertaForMaskedLM,m.RobertaForQuestionAnswering,m.RobertaForSequenceClassification,m.RobertaForTokenClassification,m.RobertaModel,m.RobertaPreTrainedModel,m.RobertaTokenizer,m.SamImageProcessor,m.SamImageSegmentationOutput,m.SamModel,m.SamPreTrainedModel,m.SamProcessor,m.SapiensForDepthEstimation,m.SapiensForNormalEstimation,m.SapiensForSemanticSegmentation,m.SapiensPreTrainedModel,m.SeamlessM4TFeatureExtractor,m.SegformerFeatureExtractor,m.SegformerForImageClassification,m.SegformerForSemanticSegmentation,m.SegformerImageProcessor,m.SegformerModel,m.SegformerPreTrainedModel,m.Seq2SeqLMOutput,m.SequenceClassifierOutput,m.SiglipImageProcessor,m.SiglipModel,m.SiglipPreTrainedModel,m.SiglipTextModel,m.SiglipTokenizer,m.SiglipVisionModel,m.SmolVLMForConditionalGeneration,m.SmolVLMImageProcessor,m.SmolVLMProcessor,m.SnacDecoderModel,m.SnacEncoderModel,m.SnacFeatureExtractor,m.SnacModel,m.SnacPreTrainedModel,m.SpeechT5FeatureExtractor,m.SpeechT5ForSpeechToText,m.SpeechT5ForTextToSpeech,m.SpeechT5HifiGan,m.SpeechT5Model,m.SpeechT5PreTrainedModel,m.SpeechT5Processor,m.SpeechT5Tokenizer,m.SqueezeBertForMaskedLM,m.SqueezeBertForQuestionAnswering,m.SqueezeBertForSequenceClassification,m.SqueezeBertModel,m.SqueezeBertPreTrainedModel,m.SqueezeBertTokenizer,m.StableLmForCausalLM,m.StableLmModel,m.StableLmPreTrainedModel,m.Starcoder2ForCausalLM,m.Starcoder2Model,m.Starcoder2PreTrainedModel,m.StoppingCriteria,m.StoppingCriteriaList,m.StyleTextToSpeech2Model,m.StyleTextToSpeech2PreTrainedModel,m.SummarizationPipeline,m.SuppressTokensAtBeginLogitsProcessor,m.Swin2SRForImageSuperResolution,m.Swin2SRImageProcessor,m.Swin2SRModel,m.Swin2SRPreTrainedModel,m.SwinForImageClassification,m.SwinForSemanticSegmentation,m.SwinModel,m.SwinPreTrainedModel,m.T5ForConditionalGeneration,m.T5Model,m.T5PreTrainedModel,m.T5Tokenizer,m.TableTransformerForObjectDetection,m.TableTransformerModel,m.TableTransformerObjectDetectionOutput,m.TableTransformerPreTrainedModel,m.TemperatureLogitsWarper,m.Tensor,m.Text2TextGenerationPipeline,m.TextClassificationPipeline,m.TextGenerationPipeline;var xx=m.TextStreamer;m.TextToAudioPipeline,m.TokenClassificationPipeline,m.TokenClassifierOutput,m.TokenizerModel,m.TopKLogitsWarper,m.TopPLogitsWarper,m.TrOCRForCausalLM,m.TrOCRPreTrainedModel,m.TranslationPipeline,m.UltravoxModel,m.UltravoxPreTrainedModel,m.UltravoxProcessor,m.UniSpeechForCTC,m.UniSpeechForSequenceClassification,m.UniSpeechModel,m.UniSpeechPreTrainedModel,m.UniSpeechSatForAudioFrameClassification,m.UniSpeechSatForCTC,m.UniSpeechSatForSequenceClassification,m.UniSpeechSatModel,m.UniSpeechSatPreTrainedModel,m.VLChatProcessor,m.VLMImageProcessor,m.ViTFeatureExtractor,m.ViTForImageClassification,m.ViTImageProcessor,m.ViTMAEModel,m.ViTMAEPreTrainedModel,m.ViTMSNForImageClassification,m.ViTMSNModel,m.ViTMSNPreTrainedModel,m.ViTModel,m.ViTPreTrainedModel,m.VisionEncoderDecoderModel,m.VitMatteForImageMatting,m.VitMatteImageProcessor,m.VitMattePreTrainedModel,m.VitPoseForPoseEstimation,m.VitPoseImageProcessor,m.VitPosePreTrainedModel,m.VitsModel,m.VitsModelOutput,m.VitsPreTrainedModel,m.VitsTokenizer,m.Wav2Vec2BertForCTC,m.Wav2Vec2BertForSequenceClassification,m.Wav2Vec2BertModel,m.Wav2Vec2BertPreTrainedModel,m.Wav2Vec2CTCTokenizer,m.Wav2Vec2FeatureExtractor,m.Wav2Vec2ForAudioFrameClassification,m.Wav2Vec2ForCTC,m.Wav2Vec2ForSequenceClassification,m.Wav2Vec2Model,m.Wav2Vec2PreTrainedModel,m.Wav2Vec2Processor,m.Wav2Vec2ProcessorWithLM,m.WavLMForAudioFrameClassification,m.WavLMForCTC,m.WavLMForSequenceClassification,m.WavLMForXVector,m.WavLMModel,m.WavLMPreTrainedModel,m.WeSpeakerFeatureExtractor,m.WeSpeakerResNetModel,m.WeSpeakerResNetPreTrainedModel,m.WhisperFeatureExtractor;var Tx=m.WhisperForConditionalGeneration;m.WhisperModel,m.WhisperPreTrainedModel,m.WhisperProcessor,m.WhisperTextStreamer,m.WhisperTimeStampLogitsProcessor,m.WhisperTokenizer,m.XLMForQuestionAnswering,m.XLMForSequenceClassification,m.XLMForTokenClassification,m.XLMModel,m.XLMPreTrainedModel,m.XLMRobertaForMaskedLM,m.XLMRobertaForQuestionAnswering,m.XLMRobertaForSequenceClassification,m.XLMRobertaForTokenClassification,m.XLMRobertaModel,m.XLMRobertaPreTrainedModel,m.XLMRobertaTokenizer,m.XLMTokenizer,m.XLMWithLMHeadModel,m.XVectorOutput,m.YolosFeatureExtractor,m.YolosForObjectDetection,m.YolosImageProcessor,m.YolosModel,m.YolosObjectDetectionOutput,m.YolosPreTrainedModel,m.ZeroShotAudioClassificationPipeline,m.ZeroShotClassificationPipeline,m.ZeroShotImageClassificationPipeline,m.ZeroShotObjectDetectionPipeline,m.bankers_round,m.cat,m.cos_sim,m.dot,m.dynamic_time_warping,m.env;var Ex=m.full;m.full_like,m.getKeyValueShapes,m.hamming,m.hanning,m.interpolate,m.interpolate_4d,m.interpolate_data,m.is_chinese_char,m.layer_norm,m.load_image,m.load_video,m.log_softmax,m.magnitude,m.matmul,m.max,m.mean,m.mean_pooling,m.medianFilter,m.mel_filter_bank,m.min,m.ones,m.ones_like,m.permute,m.permute_data,m.pipeline,m.quantize_embeddings,m.rand,m.read_audio,m.rfft,m.round,m.slice,m.softmax,m.spectrogram,m.stack,m.std_mean,m.topk,m.window_function,m.zeros,m.zeros_like;const Px=64;class Gn{static async getInstance(r){return this.model_id="onnx-community/whisper-large-v3-turbo",this.tokenizer??(this.tokenizer=vx.from_pretrained(this.model_id,{progress_callback:r})),this.processor??(this.processor=yx.from_pretrained(this.model_id,{progress_callback:r})),this.model??(this.model=Tx.from_pretrained(this.model_id,{dtype:{encoder_model:"fp16",decoder_model_merged:"q4"},device:"webgpu",progress_callback:r})),Promise.all([this.tokenizer,this.processor,this.model])}}te(Gn,"model_id",null),te(Gn,"tokenizer"),te(Gn,"processor"),te(Gn,"model");async function Cx(e){const r=atob(e),t=new Uint8Array(r.length);for(let n=0;n{i??(i=performance.now());let _;a++>0&&(_=a/(performance.now()-i)*1e3),globalThis.postMessage({status:"update",output:f,tps:_,numTokens:a})},u=new xx(s,{skip_prompt:!0,decode_kwargs:{skip_special_tokens:!0},callback_function:l}),p=await o(t),d=await n.generate({...p,max_new_tokens:Px,language:r,streamer:u}),c=s.batch_decode(d,{skip_special_tokens:!0});globalThis.postMessage({status:"complete",output:c}),cu=!1}async function $x(){globalThis.postMessage({status:"loading",data:"Loading model..."});const[e,r,t]=await Gn.getInstance(s=>{globalThis.postMessage(s)});globalThis.postMessage({status:"loading",data:"Compiling shaders and warming up model..."}),await t.generate({input_features:Ex([1,128,3e3],0),max_new_tokens:1}),globalThis.postMessage({status:"ready"})}globalThis.addEventListener("message",async e=>{const{type:r,data:t}=e.data;switch(r){case"load":$x();break;case"generate":Sx(t);break}})})(); diff --git a/assets/xai-93geoyGl.js b/assets/xai-93geoyGl.js new file mode 100644 index 0000000000000000000000000000000000000000..85c7ccf9836ba9cbf06cc767f8758b995fc4f93d --- /dev/null +++ b/assets/xai-93geoyGl.js @@ -0,0 +1 @@ +import"./Stage.vue_vue_type_style_index_0_scoped_3380f248_lang-CUt5gv4H.js";import{d as x,q as U,bG as V,s as y,h as v,l as $,w as k,x as K,o as h,y as p,b as l,u as t}from"./index-D8Nm21zW.js";import{u as w}from"./providers-DUDq6kdm.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-Blzu2N2U.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-DFTTO3aS.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-Bq_0Y-1M.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-Ccg-E6bm.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-CYg3DjVq.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-CL9MLblt.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-BNHdvI3g.js";import"./Input.vue_vue_type_script_setup_true_lang-DacRzqGb.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bau-0jfN.js";const a="xai",L=x({__name:"xai",setup(B){const{t:d}=U(),_=V(),m=w(),{providers:o}=y(m),n=v(()=>m.getProviderMetadata(a)),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,i;m.initializeProvider(a),s.value=((e=o.value[a])==null?void 0:e.apiKey)||"",r.value=((i=o.value[a])==null?void 0:i.baseUrl)||""}),k([s,r],()=>{o.value[a]={...o.value[a],apiKey:s.value,baseUrl:r.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,i)=>{var c,f;return h(),K(t(S),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon":(f=n.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:p(()=>[l(t(P),null,{default:p(()=>[l(t(R),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:p(()=>{var u;return[l(t(N),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=g=>s.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"xai-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(M),{modelValue:r.value,"onUpdate:modelValue":i[1]||(i[1]=u=>r.value=u),placeholder:"https://api.x.ai/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/assets/xai-BMv8Zk5j.js b/assets/xai-BMv8Zk5j.js deleted file mode 100644 index b6e52585b82032fd052c2118f40d22f831d362fb..0000000000000000000000000000000000000000 --- a/assets/xai-BMv8Zk5j.js +++ /dev/null @@ -1 +0,0 @@ -import{d as x,q as U,bG as V,s as y,h as v,l as $,w as k,x as K,o as h,y as p,b as l,u as t}from"./index-20XXNHAB.js";import"./live2d-zip-loader-52aPyiCh.js";import{u as w}from"./providers-BqZLRXH1.js";import{_ as z,a as M}from"./ProviderBaseUrlInput.vue_vue_type_script_setup_true_lang-mBbebT7S.js";import{_ as N}from"./ProviderApiKeyInput.vue_vue_type_script_setup_true_lang-B8fGkHxA.js";import{_ as P,a as R}from"./ProviderSettingsContainer.vue_vue_type_script_setup_true_lang-CzMfEMYt.js";import{_ as S}from"./ProviderSettingsLayout.vue_vue_type_script_setup_true_lang-D7CFd7qJ.js";import"./index-Be1NqeGb.js";import"./Collapsable.vue_vue_type_script_setup_true_lang-YnsNz_w_.js";import"./TransitionVertical.vue_vue_type_script_setup_true_lang-BxmxCSf0.js";import"./FieldInput.vue_vue_type_script_setup_true_lang-DcS2Zqm7.js";import"./Input.vue_vue_type_script_setup_true_lang-Cxyqel1x.js";import"./PageHeader.vue_vue_type_script_setup_true_lang-Bdr2VyWh.js";const a="xai",L=x({__name:"xai",setup(B){const{t:d}=U(),_=V(),m=w(),{providers:o}=y(m),n=v(()=>m.getProviderMetadata(a)),s=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.apiKey)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].apiKey=e}}),r=v({get:()=>{var e;return((e=o.value[a])==null?void 0:e.baseUrl)||""},set:e=>{o.value[a]||(o.value[a]={}),o.value[a].baseUrl=e}});$(()=>{var e,i;m.initializeProvider(a),s.value=((e=o.value[a])==null?void 0:e.apiKey)||"",r.value=((i=o.value[a])==null?void 0:i.baseUrl)||""}),k([s,r],()=>{o.value[a]={...o.value[a],apiKey:s.value,baseUrl:r.value||""}});function b(){var e;o.value[a]={...(e=n.value)==null?void 0:e.defaultOptions}}return(e,i)=>{var c,f;return h(),K(t(S),{"provider-name":(c=n.value)==null?void 0:c.localizedName,"provider-icon":(f=n.value)==null?void 0:f.icon,"on-back":()=>t(_).back()},{default:p(()=>[l(t(P),null,{default:p(()=>[l(t(R),{title:t(d)("settings.pages.providers.common.section.basic.title"),description:t(d)("settings.pages.providers.common.section.basic.description"),"on-reset":b},{default:p(()=>{var u;return[l(t(N),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=g=>s.value=g),"provider-name":(u=n.value)==null?void 0:u.localizedName,placeholder:"xai-..."},null,8,["modelValue","provider-name"])]}),_:1},8,["title","description"]),l(t(z),{title:t(d)("settings.pages.providers.common.section.advanced.title")},{default:p(()=>[l(t(M),{modelValue:r.value,"onUpdate:modelValue":i[1]||(i[1]=u=>r.value=u),placeholder:"https://api.x.ai/v1/"},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})]),_:1},8,["provider-name","provider-icon","on-back"])}}});export{L as default}; diff --git a/index.html b/index.html index c80643ee1e9e2149940cb6e177ea614b99c81de6..84d8f58b9369533f16b5169c67f2dbaf089f979c 100644 --- a/index.html +++ b/index.html @@ -23,8 +23,8 @@ src="/remote-assets/page-external-data/js/script.js" > - - + +