{"version":3,"file":"RebateCalculator_light.CPB20Hnd.mjs","names":["useState","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/33IeHpWXJyXOiyloKbCb/9xhvzIdVSZFrLkwfAQsv/RebateCalculator_light.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useMemo,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Update the RebateCalculatorLight code component used on the homepage estimate section.\n// It currently shows a dark/black input background on a light off-white section, and the result after pressing Calculate appears white against a white/light background.\n// Adjust the light visual treatment to match the Hamptons calculator reference: label text should be dark, input should be a light/white field with a thin dark border and dark typed text/placeholder,\n// the calculate button should use the burgundy/chocolate fill with white label, and the result state should render dark readable text on the light section (or a lightly bordered light surface if it has a container).\n// Do not change behavior, calculations, props, exported component name, or sizing contract. Keep it responsive and canvas-embeddable.\n// Avoid hardcoding anything that would break existing usages beyond improving the light theme color contrast.\n/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function RebateCalculatorLight(props){const{labelColor,inputBackground,inputBorderColor,inputTextColor,inputPlaceholderColor,buttonBackground,buttonTextColor,resultTextColor}=props;const[price,setPrice]=useState(\"\");const[rebate,setRebate]=useState(null);const[showResult,setShowResult]=useState(false);const[error,setError]=useState(\"\");// Formats input as $1,000, $10,000, etc.\nconst formatCurrencyInput=useCallback(value=>{const numericValue=value.replace(/[^\\d]/g,\"\");if(!numericValue)return\"\";return new Intl.NumberFormat(\"en-US\",{style:\"currency\",currency:\"USD\",maximumFractionDigits:0}).format(Number(numericValue));},[]);// Formats final output (NO decimals)\nconst formatCurrency=useCallback(value=>{return new Intl.NumberFormat(\"en-US\",{style:\"currency\",currency:\"USD\",maximumFractionDigits:0}).format(value);},[]);const formattedPrice=useMemo(()=>formatCurrencyInput(price),[price,formatCurrencyInput]);const calculateRebate=useCallback(()=>{const value=Number(price);if(isNaN(value)||value<=0){startTransition(()=>setError(\"Please enter a valid amount.\"));return;}startTransition(()=>setError(\"\"));// rebate amount\nconst result=value*.015;startTransition(()=>setRebate(result));startTransition(()=>setShowResult(true));if(typeof window!==\"undefined\"){const priceBucket=value<1e6?\"under-1m\":value<2e6?\"1m-2m\":value<3e6?\"2m-3m\":value<5e6?\"3m-5m\":value<1e7?\"5m-10m\":\"10m-plus\";window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:\"return_estimator_complete\",estimator_id:\"rebate_calculator\",page_path:window.location.pathname,price_bucket:priceBucket});}},[price]);return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",padding:0,borderRadius:0,width:\"100%\",fontFamily:\"Inter, sans-serif\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n            .priceInput::placeholder {\n                color: ${inputPlaceholderColor};\n                opacity: 0.6;\n            }\n        `}),!showResult?/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\"},children:[/*#__PURE__*/_jsx(\"div\",{children:/*#__PURE__*/_jsx(\"p\",{style:{marginBottom:10,opacity:1,fontSize:\"0.9rem\",color:labelColor},children:\"Expected purchase price:\"})}),/*#__PURE__*/_jsx(\"input\",{className:\"priceInput\",type:\"text\",placeholder:\"$3,000,000\",value:formattedPrice,onChange:e=>{const raw=e.target.value.replace(/[^\\d]/g,\"\");startTransition(()=>setPrice(raw));},style:{width:\"100%\",padding:\"10px 16px\",borderRadius:0,border:`1px solid ${inputBorderColor}`,backgroundColor:inputBackground,marginBottom:30,fontSize:\"1.0rem\",boxSizing:\"border-box\",color:inputTextColor}}),error&&/*#__PURE__*/_jsx(\"div\",{style:{color:resultTextColor,fontSize:14},children:error}),/*#__PURE__*/_jsx(\"button\",{onClick:calculateRebate,style:{width:\"fit-content\",padding:\"10px 16px\",textTransform:\"uppercase\",letterSpacing:\"0.05em\",borderRadius:0,border:\"none\",cursor:\"pointer\",fontSize:\"1.02rem\",fontWeight:600,backgroundColor:buttonBackground,color:buttonTextColor},children:\"Calculate →\"})]}):/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:24},children:[/*#__PURE__*/_jsxs(\"div\",{children:[/*#__PURE__*/_jsxs(\"div\",{style:{fontSize:\"1.2rem\",color:resultTextColor,opacity:1,fontWeight:400,marginBottom:10},children:[\"On a \",formatCurrency(Number(price)),\" home, your estimated return at closing would be approximately\"]}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"4.0rem\",fontWeight:700,letterSpacing:\"0em\",marginBottom:10,color:resultTextColor},children:formatCurrency(rebate??0)})]}),/*#__PURE__*/_jsx(\"a\",{href:\"/contact\",rel:\"noopener noreferrer\",style:{width:\"fit-content\",padding:\"10px 16px\",borderRadius:0,border:\"none\",textTransform:\"uppercase\",letterSpacing:\"0.05em\",backgroundColor:buttonBackground,color:buttonTextColor,fontSize:\"1.02rem\",fontWeight:600,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",textDecoration:\"none\",cursor:\"pointer\"},children:\"Get in Touch →\"})]})]});}addPropertyControls(RebateCalculatorLight,{labelColor:{type:ControlType.Color,title:\"Label\",defaultValue:\"#1B140E\"},inputBackground:{type:ControlType.Color,title:\"Input Bg\",defaultValue:\"#FFFFFF\"},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"#1B140E\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"#1B140E\"},inputPlaceholderColor:{type:ControlType.Color,title:\"Placeholder\",defaultValue:\"#1B140E\"},buttonBackground:{type:ControlType.Color,title:\"Button Bg\",defaultValue:\"#5A2E2A\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#FFFFFF\"},resultTextColor:{type:ControlType.Color,title:\"Result Text\",defaultValue:\"#1B140E\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RebateCalculatorLight\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"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