{"version":3,"file":"Markdown_table_cms.CJEtyYtk.mjs","names":["React.useCallback","__esmMin","init_npm_react_18_3_1","window","init_ssg_sandbox_shims","init_jsx_runtime","ne","c","ce","createStore","init_store_js__1_0","TableOverride","store","useStore","extractAndFormatTable","contentDiv","codeBlock","framerCbDiv","styleAttr","cssVars","key","value","pair","s","colorScheme","borderDiv","borderStyle","borderWidth","borderColor","borderRadius","padding","outerContainer","innerContainer","table","line","cells","row","cell","index","cellIndex","style","observer","Component","props","init_Markdown_table_cms"],"sources":["https:/framerusercontent.com/modules/OUq9x5j8Ze0f5NF8as9v/vyQugADwxExvjjKlCttV/Markdown_table_cms.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";const useStore=createStore({background:\"#f0f0f0\"});export function TableOverride(Component){return props=>{const[store]=useStore();const extractAndFormatTable=React.useCallback(()=>{const contentDivs=document.querySelectorAll('[data-framer-name=\"Content\"][data-framer-component-type=\"RichTextContainer\"]');contentDivs.forEach(contentDiv=>{const codeBlocks=contentDiv.querySelectorAll(\".framer-text.framer-text-module\");codeBlocks.forEach(codeBlock=>{if(codeBlock instanceof HTMLElement){// Get the framer-cb div to access CSS variables\nconst framerCbDiv=codeBlock.querySelector(\".framer-cb\");if(!framerCbDiv)return;// Extract CSS variables from the style attribute\nconst styleAttr=framerCbDiv.getAttribute(\"style\")||\"\";const cssVars={};styleAttr.split(\";\").forEach(pair=>{const[key,value]=pair.split(\":\").map(s=>s.trim());if(key.startsWith(\"--\")){cssVars[key]=value;}});// Determine if we're in light or dark mode\nconst colorScheme=cssVars[\"--cb-color-scheme-dark\"]===\"light\"?\"light\":\"dark\";// Find the div with the border (sp-layout)\nconst borderDiv=codeBlock.querySelector(\".sp-layout\");if(!borderDiv)return;// Extract the border properties and padding from the style attribute\nconst borderStyle=window.getComputedStyle(borderDiv);const borderWidth=borderStyle.borderWidth;const borderColor=borderStyle.borderColor;const borderRadius=borderStyle.borderRadius;const padding=borderStyle.getPropertyValue(\"--cb-padding\")||\"27px\"// Default to 27px if not set\n;// Create an outer container for the border\nconst outerContainer=document.createElement(\"div\");outerContainer.style.cssText=`\n                            border: ${borderWidth} solid ${borderColor};\n                            border-radius: ${borderRadius};\n                            overflow: hidden;\n                            width: 100%;\n                            height: 100%;\n                        `;// Create an inner container for the scrollable content\nconst innerContainer=document.createElement(\"div\");innerContainer.style.cssText=`\n                            overflow: auto;\n                            width: 100%;\n                            height: 100%;\n                        `;// Create the table\nconst table=document.createElement(\"table\");table.style.cssText=`\n                            border-collapse: separate;\n                            border-spacing: 0;\n                            width: 100%;\n                        `;// Convert extracted content to HTML table\nconst codeContent=codeBlock.textContent||\"\";const tableLines=codeContent.split(/\\r?\\n/).filter(line=>line.trim()!==\"\");const tableHtml=tableLines.map((row,index)=>{const cells=row.split(\"|\").map(cell=>cell.trim()).filter(cell=>cell!==\"\");if(index===0){return`<tr>${cells.map((cell,cellIndex)=>`<th${cellIndex===0?' class=\"first-column\"':\"\"}>${cell}</th>`).join(\"\")}</tr>`;}else if(index===1){return\"\"// Skip the separator row\n;}else{while(cells.length<3){cells.push(\"\");}return`<tr>${cells.map((cell,cellIndex)=>`<td${cellIndex===0?' class=\"first-column\"':\"\"}>${cell.replace(/\\<br\\>/g,\"<br>\")}</td>`).join(\"\")}</tr>`;}}).filter(row=>row!==\"\").join(\"\");table.innerHTML=`\n                            <table style=\"width: 100%; border-collapse: separate; border-spacing: 0;\">\n                                ${tableHtml}\n                            </table>\n                        `;// Add styles\nconst style=document.createElement(\"style\");style.textContent=`\n                            table th, table td {\n                                padding: ${padding};\n                                text-align: left;\n                                background-color: ${cssVars[`--cb-colors-surface1-${colorScheme}`]};\n                                border-right: 1px solid ${borderColor};\n                                border-bottom: 1px solid ${borderColor};\n                            }\n                            table th {\n                                font-weight: bold;\n                                color: ${cssVars[`--cb-syntax-color-plain-${colorScheme}`]};\n                                position: sticky;\n                                top: 0;\n                                z-index: 1;\n                            }\n                            .first-column {\n                                white-space: nowrap;\n                                overflow: hidden;\n                                text-overflow: ellipsis;\n                            }\n                            table tr:last-child td {\n                                border-bottom: none;\n                            }\n                            table th:last-child,\n                            table td:last-child {\n                                border-right: none;\n                            }\n                        `;outerContainer.appendChild(style);// Assemble the structure\ninnerContainer.appendChild(table);outerContainer.appendChild(innerContainer);// Replace the content of the code block with the new structure\ncodeBlock.innerHTML=\"\";codeBlock.appendChild(outerContainer);}});});},[store.background]);React.useEffect(()=>{extractAndFormatTable();// Add a MutationObserver to handle dynamic content changes\nconst observer=new MutationObserver(extractAndFormatTable);const contentDivs=document.querySelectorAll('[data-framer-name=\"Content\"][data-framer-component-type=\"RichTextContainer\"]');contentDivs.forEach(contentDiv=>{observer.observe(contentDiv,{childList:true,subtree:true});});// Remove white-space: pre-wrap from the Content div and set opacity to 1\nconst style=document.createElement(\"style\");style.textContent=`\n                [data-framer-name=\"Content\"][data-framer-component-type=\"RichTextContainer\"] {\n                    white-space: normal !important;\n                    opacity: 1 !important;\n                }\n                [data-framer-name=\"Content\"][data-framer-component-type=\"RichTextContainer\"] > div {\n                    white-space: normal !important;\n                    opacity: 1 !important;\n                }\n            `;document.head.appendChild(style);return()=>{observer.disconnect();document.head.removeChild(style);};},[extractAndFormatTable]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"TableOverride\":{\"type\":\"reactHoc\",\"name\":\"TableOverride\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Markdown_table_cms.map"],"mappings":"A,+LAA+L,SAAgBW,EAAc,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAACC,GAAOC,EAAS,EAAQC,EAAsBd,MAAsB,CAA6H,SAAjG,iBAAiB,8EAA0F,CAAC,CAAC,QAAQ,GAAY,CAAiFe,EAApD,iBAAiB,iCAA4C,CAAC,CAAC,QAAQ,GAAW,CAAC,GAA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