{"version":3,"file":"Math_LaTeX_.C4pDlkLF.mjs","names":["useState","useMemo","__esmMin","init_npm_react_18_3_1","te","pe","window","_e","init_jsx_runtime","ce","init_ssg_sandbox_shims","addPropertyControls","init_framer_DKtAEkcX","ControlType","MathLaTeX","props","html","setHtml","cancelled","renderMath","KATEX_CSS_ID","link","KATEX_CSS_URL","katexModule","output","latex","fallback","displayMode","containerStyle","align","style","color","fontSize","__FramerMetadata__","init_Math_LaTeX_","\"exports\"","\"default\"","\"type\"","\"name\"","\"slots\"","\"annotations\"","\"framerSupportedLayoutWidth\"","\"framerSupportedLayoutHeight\"","\"framerContractVersion\"","\"__FramerMetadata__\""],"sources":["https:/framerusercontent.com/modules/iR8CgAEuDAa4PXx8gKyB/dlASOtR91wb1TOfC705g/Math_LaTeX_.js"],"sourcesContent":["// Requested: Create a Framer React code component named \"Math (LaTeX)\" that renders LaTeX as proper typeset math via KaTeX, loads KaTeX CSS, gracefully handles invalid LaTeX, is SSR/canvas-safe, and exposes configurable property controls.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{startTransition,useEffect,useMemo,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";const KATEX_CSS_ID=\"framer-katex-stylesheet\";const KATEX_CSS_URL=\"https://esm.sh/katex/dist/katex.min.css\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function MathLaTeX(props){const{latex=\"\\\\frac{p(\\\\text{customer})}{p(\\\\text{unknown})} = e^{z_{\\\\text{customer}} - z_{\\\\text{unknown}}}\",displayMode=true,color=\"#111111\",fontSize=20,align=\"center\",style}=props;const[html,setHtml]=useState(\"\");useEffect(()=>{let cancelled=false;async function renderMath(){if(typeof window===\"undefined\")return;if(typeof document!==\"undefined\"&&!document.getElementById(KATEX_CSS_ID)){const link=document.createElement(\"link\");link.id=KATEX_CSS_ID;link.rel=\"stylesheet\";link.href=KATEX_CSS_URL;document.head.appendChild(link);}try{const dynamicImport=new Function(\"u\",\"return import(u)\");const katexModule=await dynamicImport(\"https://esm.sh/katex\");const katex=katexModule.default??katexModule;const output=katex.renderToString(latex,{displayMode,throwOnError:false});if(!cancelled){startTransition(()=>setHtml(output));}}catch(_error){if(!cancelled){const fallback=String(latex??\"\");startTransition(()=>setHtml(fallback));}}}renderMath();return()=>{cancelled=true;};},[latex,displayMode]);const containerStyle=useMemo(()=>({position:\"relative\",width:\"100%\",minHeight:1,color,fontSize,textAlign:align,lineHeight:1.25,...style}),[align,color,fontSize,style]);if(typeof window===\"undefined\"){return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,\"aria-label\":\"Math expression\",children:latex});}return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,\"aria-label\":\"Math expression\",dangerouslySetInnerHTML:{__html:html||latex}});}addPropertyControls(MathLaTeX,{latex:{type:ControlType.String,title:\"LaTeX\",displayTextArea:true,defaultValue:\"\\\\frac{p(\\\\text{customer})}{p(\\\\text{unknown})} = e^{z_{\\\\text{customer}} - z_{\\\\text{unknown}}}\"},displayMode:{type:ControlType.Boolean,title:\"Display mode\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#111111\"},fontSize:{type:ControlType.Number,title:\"Font Size\",defaultValue:20,min:8,max:160,unit:\"px\",step:1},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MathLaTeX\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Math_LaTeX_.map"],"mappings":"A,wMAIG,SAAwBc,EAAU,EAAM,CAAC,GAAK,CAAC,QAAM,mGAAmG,cAAY,GAAK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