{"version":3,"file":"FormModal.RzdNHQSj.mjs","names":["useState","useRef","startTransition"],"sources":["https:/framerusercontent.com/modules/1uICeKvv1Cbiv3qphoGI/L7ftZ1jm7DGt2EXaRPCD/FormModal.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";import React from\"react\";/**\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 400\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function FormModal(props){const{children,backgroundColor,overlayColor,overlayOpacity,borderRadius,maxWidth,padding,animationDuration,containerOverflow,contentAlignment,verticalAlignment,horizontalOffset,verticalOffset,formVariant}=props;const[isVisible,setIsVisible]=useState(true);const isStatic=RenderTarget.current()===RenderTarget.thumbnail;// Observe inside the modal for the \"Thank you\" state\nconst modalContentRef=useRef(null);const close=()=>startTransition(()=>setIsVisible(false));/**\n     * ✅ Close ONLY after success:\n     * In Framer Forms, success usually triggers a \"Thank you\" UI state.\n     * We watch DOM changes inside the modal and close when that state appears.\n     */useEffect(()=>{if(typeof window===\"undefined\"||isStatic)return;if(!isVisible)return;const root=modalContentRef.current;if(!root)return;const isThankYouStatePresent=()=>{// Match common Framer thank-you patterns:\n// - visible text \"Thank you\"\n// - buttons/labels that include \"Thank you\"\n// - you can add your exact thank-you CTA text here too\nconst textNeedles=[\"thank you\",\"thanks\",\"got it\",\"done\"];const text=(root.textContent||\"\").toLowerCase();return textNeedles.some(n=>text.includes(n));};// If already in thank-you state (rare but possible), close\nif(isThankYouStatePresent()){close();return;}const mo=new MutationObserver(()=>{if(isThankYouStatePresent()){close();}});mo.observe(root,{subtree:true,childList:true,characterData:true,attributes:true});return()=>mo.disconnect();},[isStatic,isVisible]);const ResponsiveChildren=/*#__PURE__*/_jsxs(\"div\",{className:\"fm-modal-form-wrap\",style:{width:\"100%\",display:\"flex\",justifyContent:\"center\",boxSizing:\"border-box\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .fm-modal-form-wrap { width: 100%; }\n\n                .fm-modal-form-inner {\n                    width: 100%;\n                    max-width: ${maxWidth||600}px;\n                    box-sizing: border-box;\n                    margin-left: auto;\n                    margin-right: auto;\n                }\n\n                .fm-modal-form-wrap,\n                .fm-modal-form-wrap * {\n                    box-sizing: border-box;\n                    min-width: 0;\n                    max-width: 100%;\n                }\n\n                .fm-modal-form-root {\n                    width: 100%;\n                    display: flex;\n                    justify-content: center;\n                }\n\n                .fm-modal-form-root > * {\n                    margin-left: auto !important;\n                    margin-right: auto !important;\n                    align-self: center !important;\n                }\n\n                .fm-modal-form-wrap form {\n                    width: 100% !important;\n                    max-width: 100% !important;\n                    margin-left: auto !important;\n                    margin-right: auto !important;\n                }\n\n                .fm-modal-form-wrap form,\n                .fm-modal-form-wrap form > div,\n                .fm-modal-form-wrap form > div > div,\n                .fm-modal-form-wrap form > div > div > div {\n                    margin-left: auto !important;\n                    margin-right: auto !important;\n                    align-items: center !important;\n                }\n\n                .fm-modal-form-wrap input,\n                .fm-modal-form-wrap textarea,\n                .fm-modal-form-wrap select,\n                .fm-modal-form-wrap button {\n                    width: 100% !important;\n                    max-width: 100% !important;\n                }\n            `}),/*#__PURE__*/_jsx(\"div\",{className:\"fm-modal-form-inner\",children:/*#__PURE__*/_jsx(\"div\",{className:\"fm-modal-form-root\",children:children&&typeof children===\"object\"&&\"props\"in children&&formVariant?/*#__PURE__*/React.cloneElement(children,{variant:formVariant}):children})})]});const overlayBg=`${overlayColor}${Math.round(overlayOpacity*255).toString(16).padStart(2,\"0\")}`;const overlayStyle={position:\"absolute\",top:0,left:0,right:0,bottom:0,width:\"100%\",height:\"100%\",display:\"flex\",alignItems:verticalAlignment===\"top\"?\"flex-start\":verticalAlignment===\"bottom\"?\"flex-end\":\"center\",justifyContent:contentAlignment===\"left\"?\"flex-start\":contentAlignment===\"right\"?\"flex-end\":\"center\",backgroundColor:overlayBg,zIndex:9999};const modalStyle={backgroundColor,borderRadius,padding,width:\"100%\",height:\"100%\",boxSizing:\"border-box\",overflow:containerOverflow,boxShadow:\"0 20px 60px rgba(0, 0, 0, 0.15)\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"flex-start\",transform:`translate(${horizontalOffset}px, ${verticalOffset}px)`};if(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:overlayStyle,children:/*#__PURE__*/_jsx(\"div\",{style:modalStyle,children:ResponsiveChildren})});}return /*#__PURE__*/_jsx(AnimatePresence,{children:isVisible&&/*#__PURE__*/_jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:animationDuration},style:overlayStyle,children:/*#__PURE__*/_jsx(motion.div,{ref:modalContentRef,initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.9,opacity:0},transition:{duration:animationDuration},style:modalStyle,children:ResponsiveChildren})})});}addPropertyControls(FormModal,{children:{type:ControlType.ComponentInstance,title:\"Form Content\"},formVariant:{type:ControlType.String,title:\"Form Variant\",defaultValue:\"desktop\",placeholder:\"e.g., desktop, mobile\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},overlayColor:{type:ControlType.Color,title:\"Overlay Color\",defaultValue:\"#000000\"},overlayOpacity:{type:ControlType.Number,title:\"Overlay Opacity\",defaultValue:.5,min:0,max:1,step:.1},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},maxWidth:{type:ControlType.Number,title:\"Max Width\",defaultValue:600,min:300,max:1200,step:50,unit:\"px\",hidden:()=>true},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:40,min:0,max:80,step:4,unit:\"px\"},containerOverflow:{type:ControlType.Enum,title:\"Container Overflow\",options:[\"hidden\",\"visible\"],optionTitles:[\"Hidden\",\"Visible\"],defaultValue:\"hidden\",displaySegmentedControl:true},contentAlignment:{type:ControlType.Enum,title:\"Horizontal Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"center\",displaySegmentedControl:true},verticalAlignment:{type:ControlType.Enum,title:\"Vertical Align\",options:[\"top\",\"center\",\"bottom\"],optionTitles:[\"Top\",\"Center\",\"Bottom\"],defaultValue:\"center\",displaySegmentedControl:true},horizontalOffset:{type:ControlType.Number,title:\"Horizontal Offset\",defaultValue:0,min:-500,max:500,step:1,unit:\"px\"},verticalOffset:{type:ControlType.Number,title:\"Vertical Offset\",defaultValue:0,min:-500,max:500,step:1,unit:\"px\"},animationDuration:{type:ControlType.Number,title:\"Animation Duration\",defaultValue:.3,min:.1,max:1,step:.1,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FormModal\",\"slots\":[\"children\"],\"annotations\":{\"framerIntrinsicHeight\":\"400\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"600\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FormModal.map"],"mappings":"qRAKG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,WAAS,kBAAgB,eAAa,iBAAe,eAAa,WAAS,UAAQ,oBAAkB,oBAAkB,mBAAiB,oBAAkB,mBAAiB,iBAAe,eAAa,EAAW,CAAC,EAAU,GAAcA,EAAS,GAAK,CAAO,EAAS,EAAa,SAAS,GAAG,EAAa,UAC3V,EAAgBC,EAAO,KAAK,CAAO,MAAUC,MAAoB,EAAa,GAAM,CAAC,CAIpF,MAAc,CAAiD,GAAtC,IAAS,QAAa,GAAmB,CAAC,EAAU,OAAO,IAAM,EAAK,EAAgB,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,MAA2B,CAI/K,IAAM,EAAY,CAAC,YAAY,SAAS,SAAS,OAAO,CAAO,GAAM,EA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