{"version":3,"file":"TypeformEnhanced.BlwHeXRx.mjs","names":["useState","useRef","useCallback","useMemo","fullUrl","_Fragment"],"sources":["https:/framerusercontent.com/modules/s7NrwGDZxAZLOcNEVAMX/ALAigtXq3QQrPzS7FEOn/TypeformEnhanced.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState,useCallback,useMemo,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{motion}from\"framer-motion\";const styles={container:{position:\"relative\",height:\"100%\",width:\"100%\",overflow:\"hidden\"},iframe:{border:0,width:\"100%\",height:\"100%\"},debugPanel:{position:\"absolute\",top:10,right:10,width:\"300px\",maxHeight:\"80%\",padding:\"10px\",backgroundColor:\"rgba(255, 255, 255, 0.9)\",backdropFilter:\"blur(5px)\",color:\"#000000\",fontFamily:\"Inter, Arial, sans-serif\",fontSize:\"12px\",overflowY:\"auto\",zIndex:1e4,cursor:\"move\",borderRadius:\"8px\",boxShadow:\"0 2px 10px rgba(0, 0, 0, 0.2)\"},debugTitle:{margin:\"0 0 10px 0\",color:\"#000000\",fontSize:\"14px\",fontWeight:\"bold\"},debugInfo:{marginBottom:\"8px\"},infoLabel:{color:\"#000000\",fontWeight:\"bold\",display:\"block\",marginBottom:\"3px\"},infoValue:{marginTop:\"2px\",padding:\"5px\",background:\"rgba(240, 240, 240, 0.5)\",borderRadius:\"4px\",wordBreak:\"break-all\",fontSize:\"11px\",fontFamily:\"monospace\"},loadingContainer:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:\"100%\",background:\"#f7f7f7\"},loadingMessage:{fontSize:\"16px\",color:\"#555555\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\"},loadingSpinner:{width:\"30px\",height:\"30px\",border:\"3px solid rgba(0, 0, 0, 0.1)\",borderRadius:\"50%\",borderTopColor:\"#3498db\",animation:\"typeform-spinner 1s ease-in-out infinite\",marginBottom:\"10px\"},errorContainer:{padding:\"20px\",backgroundColor:\"#ffebee\",borderRadius:\"8px\",color:\"#d32f2f\",fontFamily:\"Inter, Arial, sans-serif\",textAlign:\"center\"},\"@keyframes typeform-spinner\":{to:{transform:\"rotate(360deg)\"}}};/**\n * Enhanced Typeform Embed Component by Nelon\n * @framerDisableUnlink\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 400\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function TypeformEmbed({typeformId,showDebugInfo,borderRadius,disableAutoFocus,style}){const[debugInfo,setDebugInfo]=useState({renders:0,urlParams:\"None\",typeformParams:\"None\",glcid:\"None\",fullUrl:null,loadTime:0});const[isLoading,setIsLoading]=useState(true);const[hasError,setHasError]=useState(false);const[errorMessage,setErrorMessage]=useState(\"\");const loadStartTime=useRef(Date.now());const iframeRef=useRef(null);const isCanvasRender=RenderTarget.current()===RenderTarget.canvas;// Create debug info updater\nconst updateDebugInfo=useCallback(newInfo=>{setDebugInfo(prev=>({...prev,...newInfo}));},[]);// Build the base Typeform URL with all necessary parameters\nconst baseTypeformUrl=useMemo(()=>{try{if(!typeformId){throw new Error(\"Typeform ID is required\");}const baseUrl=`https://form.typeform.com/to/${typeformId}`;const params=new URLSearchParams({\"typeform-embed\":\"embed-widget\",\"typeform-source\":\"framer\",\"typeform-medium\":\"embed-sdk\",\"typeform-medium-version\":\"next\"});// Add optional parameters\nif(disableAutoFocus)params.append(\"typeform-embed-disable-auto-focus\",\"true\");return`${baseUrl}?${params.toString()}`;}catch(error){setHasError(true);setErrorMessage(error.message);return null;}},[typeformId,disableAutoFocus]);// Handle iframe loading and parameter passing\nuseEffect(()=>{if(isCanvasRender||!baseTypeformUrl)return;const constructFullUrl=()=>{if(typeof window===\"undefined\")return null;try{const urlParams=new URLSearchParams(window.location.search);const typeformParams=new URLSearchParams(baseTypeformUrl.split(\"?\")[1]||\"\");// Forward URL parameters to Typeform\nfor(let[key,value]of urlParams){// Don't override existing Typeform params with the same name\nif(!typeformParams.has(key)){typeformParams.append(key,value);}}const fullUrl=`${baseTypeformUrl.split(\"?\")[0]}?${typeformParams.toString()}`;updateDebugInfo({urlParams:urlParams.toString()||\"None\",typeformParams:typeformParams.toString(),glcid:urlParams.get(\"glcid\")||\"Not present\",fullUrl:fullUrl});return fullUrl;}catch(error){setHasError(true);setErrorMessage(`Error constructing URL: ${error.message}`);return null;}};const fullUrl=constructFullUrl();updateDebugInfo({fullUrl});},[baseTypeformUrl,updateDebugInfo,isCanvasRender]);// Debug information update timer\nuseEffect(()=>{const timer=setInterval(()=>{updateDebugInfo(prev=>({...prev,renders:prev.renders+1}));},1e3);return()=>{clearInterval(timer);};},[updateDebugInfo]);// Handle iframe loading events\nconst handleIframeLoad=()=>{const loadTime=Date.now()-loadStartTime.current;updateDebugInfo({loadTime:`${loadTime}ms`});setIsLoading(false);};const handleIframeError=()=>{setHasError(true);setErrorMessage(\"Failed to load Typeform\");setIsLoading(false);};const DebugPanel=()=>/*#__PURE__*/_jsxs(motion.div,{drag:true,dragMomentum:false,style:{...styles.debugPanel,opacity:showDebugInfo?1:0,pointerEvents:showDebugInfo?\"auto\":\"none\"},children:[/*#__PURE__*/_jsx(\"h3\",{style:styles.debugTitle,children:\"Debug Panel\"}),Object.entries(debugInfo).map(([key,value])=>/*#__PURE__*/_jsxs(\"div\",{style:styles.debugInfo,children:[/*#__PURE__*/_jsxs(\"span\",{style:styles.infoLabel,children:[key,\":\"]}),/*#__PURE__*/_jsx(\"div\",{style:styles.infoValue,children:value})]},key))]});// Canvas placeholder\nif(isCanvasRender){return /*#__PURE__*/_jsx(\"div\",{style:{...styles.container,backgroundColor:\"#f0f0f0\",borderRadius:`${borderRadius}px`,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",...style},children:/*#__PURE__*/_jsxs(\"div\",{style:{textAlign:\"center\",padding:\"20px\",color:\"#666\"},children:[/*#__PURE__*/_jsx(\"div\",{style:{fontSize:\"16px\",fontWeight:\"bold\",marginBottom:\"8px\"},children:\"Typeform Embed\"}),/*#__PURE__*/_jsxs(\"div\",{style:{fontSize:\"13px\"},children:[\"ID: \",typeformId||\"Not set\"]})]})});}// Error state\nif(hasError){return /*#__PURE__*/_jsxs(\"div\",{style:{...styles.container,...style},children:[/*#__PURE__*/_jsxs(\"div\",{style:styles.errorContainer,children:[/*#__PURE__*/_jsx(\"h3\",{children:\"Typeform Loading Error\"}),/*#__PURE__*/_jsx(\"p\",{children:errorMessage||\"Failed to load Typeform\"})]}),showDebugInfo&&/*#__PURE__*/_jsx(DebugPanel,{})]});}return /*#__PURE__*/_jsxs(\"div\",{style:{...styles.container,...style},children:[debugInfo.fullUrl&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,src:debugInfo.fullUrl,style:{...styles.iframe,borderRadius:`${borderRadius}px`,visibility:isLoading?\"hidden\":\"visible\"},allow:\"camera; microphone; autoplay; encrypted-media;\",sandbox:\"allow-same-origin allow-scripts allow-forms allow-popups allow-top-navigation\",title:\"Typeform Embed\",onLoad:handleIframeLoad,onError:handleIframeError}),isLoading&&/*#__PURE__*/_jsx(\"div\",{style:styles.loadingContainer,children:/*#__PURE__*/_jsxs(\"div\",{style:styles.loadingMessage,children:[/*#__PURE__*/_jsx(\"div\",{style:styles.loadingSpinner}),/*#__PURE__*/_jsx(\"span\",{children:\"Loading Typeform...\"})]})})]}),showDebugInfo&&/*#__PURE__*/_jsx(DebugPanel,{}),/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes typeform-spinner {\n                    to { transform: rotate(360deg); }\n                }\n                `})]});}TypeformEmbed.defaultProps={typeformId:\"Pzd3V25i\",showDebugInfo:false,borderRadius:0,disableAutoFocus:false};addPropertyControls(TypeformEmbed,{borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:0,min:0,max:100,step:1},disableAutoFocus:{type:ControlType.Boolean,title:\"Disable Auto Focus\",defaultValue:false},showDebugInfo:{type:ControlType.Boolean,title:\"Show Debug Info\",defaultValue:false},typeformId:{type:ControlType.String,title:\"Typeform ID\",defaultValue:\"Pzd3V25i\"}});TypeformEmbed.displayName=\"Typeform w/ UTM Support\";\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypeformEmbed\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"400\",\"framerSupportedLayoutWidth\":\"any\",\"framerDisableUnlink\":\"* @framerIntrinsicWidth 600\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TypeformEnhanced.map"],"mappings":"0bAOG,SAAwB,EAAc,CAAC,aAAW,gBAAc,eAAa,mBAAiB,SAAO,CAAC,GAAK,CAAC,EAAU,GAAcA,EAAS,CAAC,QAAQ,EAAE,UAAU,OAAO,eAAe,OAAO,MAAM,OAAO,QAAQ,KAAK,SAAS,EAAE,CAAC,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAK,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAG,CAAO,EAAcC,EAAO,KAAK,KAAK,CAAC,CAAO,EAAUA,EAAO,KAAK,CAAO,EAAe,EAAa,SAAS,GAAG,EAAa,OAC5e,EAAgBC,EAAY,GAAS,CAAC,EAAa,IAAO,CAAC,GAAG,EAAK,GAAG,EAAQ,EAAE,EAAG,EAAE,CAAC,CACtF,EAAgBC,MAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAY,MAAU,MAAM,0BAA0B,CAAE,IAAM,EAAQ,gCAAgC,IAAmB,EAAO,IAAI,gBAAgB,CAAC,iBAAiB,eAAe,kBAAkB,SAAS,kBAAkB,YAAY,0BAA0B,OAAO,CAAC,CAC7O,OAA3E,GAAiB,EAAO,OAAO,oCAAoC,OAAO,CAAO,GAAG,EAAQ,GAAG,EAAO,UAAU,SAAU,EAAM,CAAkD,OAAjD,EAAY,GAAK,CAAC,EAAg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