import{U as k,x as w,y as C,N as M,aX as B,o as T,h as I,a2 as L,a3 as O,B as f,b as $,w as K,ar as N,bg as V,q as S}from"./index-c3b77b9a.js";import{J as X,o as A,X as D,K as U,a as H,V as P}from"./MessageList-702dd606.js";import"./toast-b30e06c0.js";var b=(c,n,l)=>new Promise((a,r)=>{var v=e=>{try{t(l.next(e))}catch(m){r(m)}},d=e=>{try{t(l.throw(e))}catch(m){r(m)}},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=X(k({__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),m=A();let i=null;function x(){return b(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 s=++v,u=new AbortController;if(t=u,!r)try{!i&&l.value&&(i=m(l.value)),yield i==null?void 0:i.whenVisible}catch{}const g=n.node.markup==="$$";D(n.node.content,g,{timeout:1500,waitTimeout:0,maxRetries:0,signal:u.signal}).then(o=>{d||s!==v||a.value&&(a.value.innerHTML=o,e.value=!1,r=!0)}).catch(o=>b(null,null,function*(){if(d||s!==v||!a.value)return;const p=(o==null?void 0:o.code)||(o==null?void 0:o.name),h=p==="KATEX_DISABLED";if(p==="WORKER_INIT_ERROR"||o!=null&&o.fallbackToRenderer||p===U||p==="WORKER_TIMEOUT"){const E=yield H();if(E){try{const _=n.node.markup==="$$",R=E.renderToString(n.node.content,{throwOnError:n.node.loading,displayMode:_});e.value=!1,a.value.innerHTML=R,r=!0,P(n.node.content,_,R)}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 C(()=>n.node.content,()=>{x()}),M(()=>{x()}),B(()=>{var s;d=!0,t&&(t.abort(),t=null),(s=i==null?void 0:i.destroy)==null||s.call(i),i=null}),(s,u)=>(T(),I("span",{ref_key:"containerEl",ref:l,class:"math-inline-wrapper"},[L(f("span",{ref_key:"mathElement",ref:a,class:"math-inline"},null,512),[[O,!e.value]]),e.value?(T(),$(V,{key:0,name:"table-node-fade"},{default:K(()=>[f("span",W,[N(s.$slots,"loading",{isLoading:e.value},()=>[u[0]||(u[0]=f("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),u[1]||(u[1]=f("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};
