{"version":3,"file":"MarketoForm.N2P2KCbl.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/PN5c9Lm200xYeKxP2Gcy/PVRWqcAS5FromVQ03eYl/Utils.js","https:/framer.com/m/Utils-QTIc.js@PVRWqcAS5FromVQ03eYl","https:/framerusercontent.com/modules/OkXJ0yDMyvOgNdexnQnt/iwSczH7pEL9aPvnFrOfc/MarketoForm.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{ControlType}from\"framer\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";export const updateChildren=(children,properties)=>{return[{...children,props:{...children.props,children:{...children.props.children,props:{...children.props.children.props,children:{...children.props.children.props.children,props:{...children.props.children.props.children.props,...properties}}}}}}];};export const SettingsMessage=({icon=\"✨\",title,description,containerStyle})=>{return /*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",textAlign:\"center\",justifyContent:\"center\",backgroundColor:\"rgba(136, 85, 255, 0.1)\",overflow:\"hidden\",...containerStyle},children:[/*#__PURE__*/_jsx(\"span\",{role:\"img\",\"aria-label\":\"icon\",style:{fontSize:\"32px\"},children:icon}),/*#__PURE__*/_jsxs(\"div\",{style:{maxWidth:\"240px\"},children:[/*#__PURE__*/_jsx(\"h1\",{style:{fontSize:11,color:\"#96F\",fontWeight:600},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{fontSize:11,color:\"rgba(153, 102, 255, 0.7)\",lineHeight:1.5},children:description})]})]});};export const getBorder=border=>{if(!border)return{border:\"none\"};const{width,color,style}=border;return{borderWidth:width,borderColor:color,borderStyle:style};};export const borderProperty=(title=\"Border\",width=\"0px\",color=\"#fff\")=>({title,type:ControlType.Object,controls:{width:{title:\"Width\",type:ControlType.Padding,defaultValue:width},color:{title:\"Color\",type:ControlType.Color,defaultValue:color},style:{type:ControlType.Enum,defaultValue:\"solid\",options:[\"solid\",\"dashed\",\"dotted\",\"double\"],optionTitles:[\"Solid\",\"Dashed\",\"Dotted\",\"Double\"]}}});export const getBoxShadow=property=>{const{x,y,blur,color}=property.shadow;return`${x}px ${y}px ${blur}px ${color}`;};export const shadowProperty={type:ControlType.Object,controls:{color:{title:\"Color\",type:ControlType.Color,defaultValue:\"#bfbfbf\"},x:{title:\"X\",type:ControlType.Number,defaultValue:0,min:-100,max:100},y:{title:\"Y\",type:ControlType.Number,defaultValue:0,min:-100,max:100},blur:{title:\"Blur\",type:ControlType.Number,defaultValue:0,min:0,max:100}}};export const heightProperty={height:{type:ControlType.Enum,defaultValue:\"auto\",displaySegmentedControl:true,options:[\"auto\",\"fixed\"],optionTitles:[\"Auto\",\"Fixed\"]},heightNumber:{title:\" \",type:ControlType.Number,defaultValue:50,hidden(props){return props.height===\"auto\";}}};export const getHeight=property=>{if(property.height===\"auto\"){return property.height;}else{return`${property.heightNumber}px`;}};export const getPageQueryParam=()=>{const urlParams=new URLSearchParams(window.location.search);const pageParam=urlParams.get(\"page\");return pageParam?parseInt(pageParam,10):1;};export const updatePageQueryParam=newPage=>{const url=new URL(window.location.href);url.searchParams.set(\"page\",newPage);window.history.replaceState({},\"\",url.toString());};export const scrollToTop=(withScroll,scrollTop,scrollBehavior)=>{if(withScroll){window.scrollTo({top:scrollTop,behavior:scrollBehavior});}};//Pagination\nexport const usePaginationStore=createStore({});//Table of Content\nexport const useTableOfContentStore=createStore({headings:[],scrollOffsetY:0});\nexport const __FramerMetadata__ = {\"exports\":{\"getPageQueryParam\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useTableOfContentStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"usePaginationStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getHeight\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"heightProperty\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"borderProperty\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"shadowProperty\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"updateChildren\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"scrollToTop\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SettingsMessage\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getBoxShadow\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getBorder\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"updatePageQueryParam\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Utils.map","/*\n * Utils\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/PN5c9Lm200xYeKxP2Gcy/PVRWqcAS5FromVQ03eYl/Utils.js\"\n","import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect}from\"react\";import{SettingsMessage}from\"https://framer.com/m/Utils-QTIc.js@PVRWqcAS5FromVQ03eYl\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerIntrinsicWidth 600\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicHeight 300\n */export default function MarketoForm(props){const{embed,style}=props;const[isEmbedValid,setIsEmbedValid]=useState(false);const[formId,setFormId]=useState(null);const[script,setScript]=useState(null);const[isLoading,setIsLoading]=useState(true);if(!embed||embed.length===0){return /*#__PURE__*/_jsx(SettingsMessage,{title:\"Marketo Embed Component\",description:\"Enter the Marketo Embed Code here\",containerStyle:style});}useEffect(()=>{setIsLoading(true);const embedRegex=/MktoForms2\\.loadForm\\(\"(.+?)\", \"(.+?)\", (\\d+)(?:, .+?)?\\);/;const embedMatch=embed.match(embedRegex);const[,link,value,id]=embedMatch||[];setFormId(`mktoForm_${id}`);const embedFirstLine=`<script src=\"${link}/js/forms2/js/forms2.min.js\"></script>`;const isValidEmbed=embed.startsWith(embedFirstLine)&&value&&id&&link;setIsEmbedValid(isValidEmbed);if(isValidEmbed){const newScript=document.createElement(\"script\");newScript.src=`${link}/js/forms2/js/forms2.min.js`;newScript.async=true;const handleError=(error,message)=>{setIsEmbedValid(false);setIsLoading(false);console.error(message,error);};const handleScriptLoad=()=>{try{if(window.MktoForms2){window.MktoForms2.loadForm(link,value,id);}}catch(error){handleError(error,\"Error loading form:\");}};newScript.onload=handleScriptLoad;document.body.appendChild(newScript);setScript(newScript);try{document.body.appendChild(newScript);setScript(newScript);}catch(error){handleError(error,\"Error appending script:\");}}setIsLoading(false);return()=>{if(script){try{document.body.removeChild(script);}catch(error){setIsEmbedValid(false);console.error(\"Error removing script:\",error);}}};},[embed]);return /*#__PURE__*/_jsx(_Fragment,{children:isLoading?/*#__PURE__*/_jsx(_Fragment,{}):isEmbedValid?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:customCSS}),/*#__PURE__*/_jsx(\"form\",{id:formId})]}):/*#__PURE__*/_jsx(SettingsMessage,{title:\"Your embed code is incorrect!\",description:\"Update the Marketo embed form in the component property.\",containerStyle:style,icon:\"🚨\"})});}const customCSS=`\n    .mktoLabel {\n        width: auto !important;\n        float: none !important;\n        display: block !important;\n    }\n`;MarketoForm.displayName=\"Marketo Form\";addPropertyControls(MarketoForm,{embed:{title:\"Embed Code\",type:ControlType.String,displayTextArea:true,description:\"[Where to find my Marketo embed form](https://experienceleague.adobe.com/en/docs/marketo/using/product-docs/demand-generation/forms/form-actions/embed-a-form-on-your-website).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MarketoForm\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"300\",\"framerDisableUnlink\":\"*\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MarketoForm.map"],"mappings":"6RAAyD,IAAgC,IAAqE,CAA6T,GAAiB,CAAC,OAAK,IAAI,QAAM,cAAY,oBAAuC,EAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,cAAc,SAAS,WAAW,SAAS,UAAU,SAAS,eAAe,SAAS,gBAAgB,0BAA0B,SAAS,SAAS,GAAG,EAAe,CAAC,SAAS,CAAc,EAAK,OAAO,CAAC,KAAK,MAAM,aAAa,OAAO,MAAM,CAAC,SAAS,OAAO,CAAC,SAAS,EAAK,CAAC,CAAc,EAAM,MAAM,CAAC,MAAM,CAAC,SAAS,QAAQ,CAAC,SAAS,CAAc,EAAK,KAAK,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,OAAO,WAAW,IAAI,CAAC,SAAS,EAAM,CAAC,CAAc,EAAK,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,2BAA2B,WAAW,IAAI,CAAC,SAAS,EAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAosB,EAAY,OAA2C,EAAY,MAAgD,EAAY,OAA0D,EAAY,OAAgE,EAAY,OAAiF,EAAY,KAA2I,EAAY,OACxxE,EAAY,EAAE,CAAC,CACX,EAAY,CAAC,SAAS,EAAE,CAAC,cAAc,EAAE,CAAC,qBEK3E,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,QAAM,SAAO,EAAW,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAM,CAAC,EAAO,GAAWA,EAAS,KAAK,CAAM,CAAC,EAAO,GAAWA,EAAS,KAAK,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAK,CAA21C,MAAv1C,CAAC,GAAO,EAAM,SAAS,EAAuB,EAAK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