{"version":3,"file":"vJd1VkFwD.HT3rwSWb.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/SQrkX3iKYLEk6bos7rSK/Xj6k6p8RY9kJKlxXoAjf/ChartOverride.js","https:/framerusercontent.com/modules/vFap6VubkRC6XuUxcHD9/Q1M55GmmXnlt7Fc0WTEm/vJd1VkFwD.js"],"sourcesContent":["/**\n * Estimate Chart Override - Renders Plotly bar chart from stored data\n */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{getEstimate}from\"https://framerusercontent.com/modules/YtL1Zm8DwyUmgXIdDzMa/FfnJtZoc7TqQf1M2n9M7/Store.js\";// ===== Plotly Loader =====\nasync function loadPlotly(){const win=window;if(win.Plotly)return win.Plotly;return new Promise((resolve,reject)=>{const script=document.createElement(\"script\");script.src=\"https://cdn.plot.ly/plotly-2.27.0.min.js\";script.onload=()=>resolve(win.Plotly);script.onerror=()=>reject(new Error(\"Failed to load Plotly\"));document.head.appendChild(script);});}// ===== Chart Override =====\n/**\n * Renders a Plotly bar chart from localStorage data.\n * Uses Plotly.react() which handles binary data format better.\n * @framerDisableUnlink\n */export function withPlotlyChart(Component){return props=>{const containerRef=useRef(null);const[status,setStatus]=useState(\"loading\");const[error,setError]=useState(\"\");useEffect(()=>{let mounted=true;async function loadChart(){try{// Read estimate from localStorage\nconst estimate=getEstimate();if(!estimate||!estimate.chart){console.log(\"[Chart] No estimate data in localStorage\");if(mounted)setStatus(\"no-data\");return;}// Load Plotly\nconst Plotly=await loadPlotly();if(!mounted)return;console.log(\"[Chart] Rendering chart with Plotly.react()...\");if(containerRef.current){// Use Plotly.react() instead of newPlot() - handles binary format better\nPlotly.react(containerRef.current,estimate.chart.data,estimate.chart.layout,{responsive:true});setStatus(\"ready\");}}catch(err){if(mounted){console.error(\"[Chart] Error:\",err);setError(err instanceof Error?err.message:\"Unknown error\");setStatus(\"error\");}}}loadChart();return()=>{mounted=false;};},[]);return /*#__PURE__*/_jsxs(Component,{...props,children:[status===\"loading\"&&/*#__PURE__*/_jsx(\"div\",{style:{padding:\"20px\",textAlign:\"center\"},children:\"Loading chart...\"}),status===\"no-data\"&&/*#__PURE__*/_jsx(\"div\",{style:{padding:\"20px\",textAlign:\"center\",color:\"#666\"},children:\"No estimate data available. Please complete the estimate flow first.\"}),status===\"error\"&&/*#__PURE__*/_jsxs(\"div\",{style:{padding:\"20px\",color:\"red\",textAlign:\"center\"},children:[\"Error: \",error]}),status!==\"error\"&&status!==\"no-data\"&&/*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{width:\"100%\",height:\"100%\"}})]});};}/**\n * MCP COMPATIBILITY FOOTER. DO NOT MODIFY.\n * FEROX SYSTEMS 2025\n * @framerDisableUnlink\n */export function withMcp(Component){return Component;}\nexport const __FramerMetadata__ = {\"exports\":{\"withPlotlyChart\":{\"type\":\"reactHoc\",\"name\":\"withPlotlyChart\",\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\"}},\"withMcp\":{\"type\":\"reactHoc\",\"name\":\"withMcp\",\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","// Generated by Framer (c9d77eb)\nimport{fontStore}from\"framer\";fontStore.loadFonts([]);export const fonts=[{explicitInter:true,fonts:[]}];export const css=[\".framer-XbSd6 .framer-styles-preset-46tzc2:not(.rich-text-wrapper), .framer-XbSd6 .framer-styles-preset-46tzc2.rich-text-wrapper a { --framer-link-text-color: #006cff; --framer-link-text-decoration: underline; }\"];export const className=\"framer-XbSd6\";\nexport const __FramerMetadata__ = {\"exports\":{\"css\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fonts\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"className\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"sP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