import{d as L,f as O,U as g,a as x,T as B,W as S,bk as N,o as y,c as A,p as C,t as D,w as K,b,bn as W,aL as $}from"./index-DSCno0m2.js";import{d as H,E as P,x as U,i as V,e as J,I as j,J as X}from"./index-3OlSoxmB.js";import"./chatbot-Dfd2mpvB.js";import"./FormItem-CHgZe7qM.js";import"./Alert-Cm6VlYYh.js";import"./Flex-CK9o7tXW.js";import"./get-slot-Bk_rJcZu.js";import"./assistant-Vu8dw-ko.js";var R=(f,e,r)=>new Promise((p,d)=>{var c=n=>{try{a(r.next(n))}catch(m){d(m)}},t=n=>{try{a(r.throw(n))}catch(m){d(m)}},a=n=>n.done?p(n.value):Promise.resolve(n.value).then(c,t);a((r=r.apply(f,e)).next())});const q=["data-markstream-mode"],z=["innerHTML"],F={key:1,class:"math-inline math-inline--fallback"},G={class:"math-inline__loading",role:"status","aria-live":"polite"},E=H(L({__name:"MathInlineNode",props:{node:{}},setup(f){const e=f,r=g(null),p=typeof window>"u",d=O(()=>e.node.markup==="$$"),c=(function(){if(!e.node.content)return{html:"",text:e.node.raw,loading:!1};if(!p)return{html:"",text:e.node.raw,loading:!1};const l=P();if(!l)return{html:"",text:e.node.raw,loading:!1};try{return{html:l.renderToString(e.node.content,{throwOnError:e.node.loading,displayMode:d.value}),text:"",loading:!1}}catch{return{html:"",text:e.node.raw,loading:!1}}})(),t=g(c.html),a=g(c.text);let n=!1,m=0,h=!1,v=null;const i=g(c.loading),M=U();let s=null;function T(){return R(this,null,function*(){if(h)return;if(!e.node.content)return i.value=!1,t.value="",a.value=e.node.raw,void(n=!0);v&&(v.abort(),v=null);const l=++m,u=new AbortController;if(v=u,!n)try{!s&&r.value&&(s=M(r.value)),yield s?.whenVisible}catch{}V(e.node.content,d.value,{timeout:1500,waitTimeout:0,maxRetries:0,signal:u.signal}).then(o=>{h||l!==m||(t.value=o,a.value="",i.value=!1,n=!0)}).catch(o=>R(null,null,function*(){if(h||l!==m)return;const w=o?.code||o?.name,k=w==="KATEX_DISABLED";if(w==="WORKER_INIT_ERROR"||o?.fallbackToRenderer||w===J||w==="WORKER_TIMEOUT"){const I=yield j();if(I){try{const _=I.renderToString(e.node.content,{throwOnError:e.node.loading,displayMode:d.value});t.value=_,a.value="",i.value=!1,n=!0,X(e.node.content,d.value,_)}catch{}return}}if(k)return i.value=!1,t.value="",void(a.value=e.node.raw);n||(i.value=!k),e.node.loading?k&&(t.value="",a.value=e.node.raw):(i.value=!1,t.value="",a.value=e.node.raw)}))})}return(c.html||c.text)&&(n=!0),B(()=>e.node.content,()=>{T()}),S(()=>{p||t.value||T()}),N(()=>{var l;h=!0,v&&(v.abort(),v=null),(l=s?.destroy)==null||l.call(s),s=null}),(l,u)=>(y(),x("span",{ref_key:"containerEl",ref:r,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":t.value?"katex":a.value?"fallback":"loading"},[t.value?(y(),x("span",{key:0,class:"math-inline",innerHTML:t.value},null,8,z)):a.value?(y(),x("span",F,D(a.value),1)):i.value?(y(),A($,{key:2,name:"table-node-fade"},{default:K(()=>[b("span",G,[W(l.$slots,"loading",{isLoading:i.value},()=>[u[0]||(u[0]=b("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),u[1]||(u[1]=b("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):C("",!0)],8,q))}}),[["__scopeId","data-v-d4b863b7"]]);E.install=f=>{f.component(E.__name,E)};export{E as default};
