import{r as w,j as i}from"./index-D2K-duz6.js";const y="glitch-player-mathjax",E="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";let x=null;function M(){var d;return typeof window>"u"||typeof document>"u"||(d=window.MathJax)!=null&&d.typesetPromise?Promise.resolve():x||(x=new Promise((s,u)=>{var l;window.MathJax=window.MathJax??{};const n=document.getElementById(y),a=()=>{var e,c;n&&(n.dataset.loaded="true");const f=(c=(e=window.MathJax)==null?void 0:e.startup)==null?void 0:c.promise;if(f){f.then(()=>s()).catch(u);return}s()};if(n){if(n.dataset.loaded==="true"||(l=window.MathJax)!=null&&l.typesetPromise){a();return}n.addEventListener("load",a,{once:!0}),n.addEventListener("error",()=>u(new Error("Failed to load MathJax.")),{once:!0});return}const t=document.createElement("script");t.id=y,t.async=!0,t.src=E,t.addEventListener("load",()=>{t.dataset.loaded="true",a()},{once:!0}),t.addEventListener("error",()=>u(new Error("Failed to load MathJax.")),{once:!0}),document.head.appendChild(t)}),x)}function g({props:d,latexString:s,displayMode:u,paused:n}){const a=d,t=String(a.header??a.eyebrow??"Equation focus"),l=String(a.title??"Definition of the mean"),f=String(a.annotation??"The mean is the total of all observations divided by the number of observations."),e=w.useRef(null),[c,p]=w.useState("loading");return w.useEffect(()=>{const J=e.current,_=s??String.raw`\bar{x} = \frac{1}{N}\sum_{i=0}^{N} x_i`;if(!J)return;let h=!1;return p("loading"),M().then(async()=>{var r,q,m,v;if(h||!e.current)return;const o=e.current;o.textContent=`\\[${_}\\]`,(q=(r=window.MathJax)==null?void 0:r.typesetClear)==null||q.call(r,[o]),await((v=(m=window.MathJax)==null?void 0:m.typesetPromise)==null?void 0:v.call(m,[o])),h||p("ready")}).catch(()=>{!h&&e.current&&(e.current.textContent=_,p("error"))}),()=>{var o,r;h=!0,e.current&&((r=(o=window.MathJax)==null?void 0:o.typesetClear)==null||r.call(o,[e.current]))}},[s]),i.jsx("article",{className:`equation-focus equation-focus--${u} ${n?"equation-focus--paused":""}`,children:i.jsxs("div",{className:"equation-focus__content",children:[i.jsx("p",{className:"equation-focus__eyebrow",children:t}),i.jsx("h2",{className:"equation-focus__title",children:l}),i.jsx("div",{className:"equation-focus__equation-frame",children:i.jsx("div",{ref:e,className:`equation-focus__equation equation-focus__equation--mathjax ${c==="loading"?"equation-focus__equation--loading":""} ${c==="error"?"equation-focus__equation--error":""}`,"aria-live":"polite"})}),i.jsx("p",{className:"equation-focus__annotation",children:f})]})})}export{g as default};
