import{e as C,r as w,g as M,q as b,h as I,o as E,c as B,k as L,v as O,a as p,j as $,w as K,s as V,T as N,x as S}from"./index-WOIPm_2l.js";import{J as A,o as D,X,K as H,M as P,V as U}from"./MessageList-DFdDzCzJ.js";import"./toast-CbgsPrO_.js";var R=(c,n,l)=>new Promise((a,r)=>{var v=e=>{try{t(l.next(e))}catch(f){r(f)}},d=e=>{try{t(l.throw(e))}catch(f){r(f)}},t=e=>e.done?a(e.value):Promise.resolve(e.value).then(v,d);t((l=l.apply(c,n)).next())});const W={class:"math-inline__loading",role:"status","aria-live":"polite"},y=A(C({__name:"MathInlineNode",props:{node:{}},setup(c){const n=c,l=w(null),a=w(null);let r=!1,v=0,d=!1,t=null;const e=w(!0),f=D();let s=null;function T(){return R(this,null,function*(){if(!a.value||d)return;if(!n.node.content)return e.value=!1,a.value.textContent=n.node.raw,void(r=!0);t&&(t.abort(),t=null);const i=++v,u=new AbortController;if(t=u,!r)try{!s&&l.value&&(s=f(l.value)),yield s==null?void 0:s.whenVisible}catch{}const g=n.node.markup==="$$";X(n.node.content,g,{timeout:1500,waitTimeout:0,maxRetries:0,signal:u.signal}).then(o=>{d||i!==v||a.value&&(a.value.innerHTML=o,e.value=!1,r=!0)}).catch(o=>R(null,null,function*(){if(d||i!==v||!a.value)return;const m=(o==null?void 0:o.code)||(o==null?void 0:o.name),h=m==="KATEX_DISABLED";if(m==="WORKER_INIT_ERROR"||o!=null&&o.fallbackToRenderer||m===H||m==="WORKER_TIMEOUT"){const k=yield P();if(k){try{const _=n.node.markup==="$$",x=k.renderToString(n.node.content,{throwOnError:n.node.loading,displayMode:_});e.value=!1,a.value.innerHTML=x,r=!0,U(n.node.content,_,x)}catch{}return}}if(h)return e.value=!1,void(a.value.textContent=n.node.raw);r||(e.value=!h),n.node.loading?h&&(a.value.textContent=n.node.raw):(e.value=!1,a.value.textContent=n.node.raw)}))})}return M(()=>n.node.content,()=>{T()}),b(()=>{T()}),I(()=>{var i;d=!0,t&&(t.abort(),t=null),(i=s==null?void 0:s.destroy)==null||i.call(s),s=null}),(i,u)=>(E(),B("span",{ref_key:"containerEl",ref:l,class:"math-inline-wrapper"},[L(p("span",{ref_key:"mathElement",ref:a,class:"math-inline"},null,512),[[O,!e.value]]),e.value?(E(),$(N,{key:0,name:"table-node-fade"},{default:K(()=>[p("span",W,[V(i.$slots,"loading",{isLoading:e.value},()=>[u[0]||(u[0]=p("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),u[1]||(u[1]=p("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):S("",!0)],512))}}),[["__scopeId","data-v-32b58f6e"]]);y.install=c=>{c.component(y.__name,y)};export{y as default};
