{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/o1PI5S8YtkA5bP5g4dFz/11s9YFAv2sX8gzsFhiCz/Embed.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useIsOnCanvas,emptyStateStyle,containerStyles}from\"https://framer.com/m/framer/default-utils.js\";/**\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n *\n * @framerDisableUnlink\n */export default function Embed({type,url,html,style={}}){if(type===\"url\"&&url){return /*#__PURE__*/_jsx(EmbedURL,{url:url,style:style});}if(type===\"html\"&&html){return /*#__PURE__*/_jsx(EmbedHTML,{html:html,style:style});}return /*#__PURE__*/_jsx(Instructions,{style:style});}addPropertyControls(Embed,{type:{type:ControlType.Enum,defaultValue:\"url\",displaySegmentedControl:true,options:[\"url\",\"html\"],optionTitles:[\"URL\",\"HTML\"]},url:{title:\"URL\",type:ControlType.String,description:\"Some websites don\u2019t support embedding.\",hidden(props){return props.type!==\"url\";}},html:{title:\"HTML\",type:ControlType.String,displayTextArea:true,hidden(props){return props.type!==\"html\";}}});function Instructions({style}){return /*#__PURE__*/_jsx(\"div\",{style:{minHeight:getMinHeight(style),...emptyStateStyle,overflow:\"hidden\",...style},children:/*#__PURE__*/_jsx(\"div\",{style:centerTextStyle,children:\"To embed a website or widget, add it to the properties\\xa0panel.\"})});}function EmbedURL({url,style}){const hasAutoHeight=!style.height;// Add https:// if the URL does not have a protocol.\nif(!/[a-z]+:\\/\\//.test(url)){url=\"https://\"+url;}const onCanvas=useIsOnCanvas();// We need to check if the url is blocked inside an iframe by the X-Frame-Options\n// or Content-Security-Policy headers on the backend.\nconst[state,setState]=useState(onCanvas?undefined:false);useEffect(()=>{// We only want to check on the canvas.\n// On the website we want to avoid the additional delay.\nif(!onCanvas)return;// TODO: We could also use AbortController here.\nlet isLastEffect=true;setState(undefined);async function load(){const response=await fetch(\"https://api.framer.com/functions/check-iframe-url?url=\"+encodeURIComponent(url));if(response.status==200){const{isBlocked}=await response.json();if(isLastEffect){setState(isBlocked);}}else{const message=await response.text();console.error(message);const error=new Error(\"This site can\u2019t be reached.\");setState(error);}}load().catch(error=>{console.error(error);setState(error);});return()=>{isLastEffect=false;};},[url]);if(onCanvas&&hasAutoHeight){return /*#__PURE__*/_jsx(ErrorMessage,{message:\"URL embeds do not support auto height.\",style:style});}if(!url.startsWith(\"https://\")){return /*#__PURE__*/_jsx(ErrorMessage,{message:\"Unsupported protocol.\",style:style});}if(state===undefined){return /*#__PURE__*/_jsx(LoadingIndicator,{});}if(state instanceof Error){return /*#__PURE__*/_jsx(ErrorMessage,{message:state.message,style:style});}if(state===true){const message=`Can\u2019t embed ${url} due to its content security policy.`;return /*#__PURE__*/_jsx(ErrorMessage,{message:message,style:style});}return /*#__PURE__*/_jsx(\"iframe\",{src:url,style:{...iframeStyle,...style},loading:\"lazy\",// @ts-ignore\nfetchPriority:onCanvas?\"low\":\"auto\",referrerPolicy:\"no-referrer\",sandbox:getSandbox(onCanvas)});}const iframeStyle={width:\"100%\",height:\"100%\",border:\"none\"};function getSandbox(onCanvas){const result=[\"allow-same-origin\",\"allow-scripts\"];if(!onCanvas){result.push(\"allow-downloads\",\"allow-forms\",\"allow-modals\",\"allow-orientation-lock\",\"allow-pointer-lock\",\"allow-popups\",\"allow-popups-to-escape-sandbox\",\"allow-presentation\",\"allow-storage-access-by-user-activation\",\"allow-top-navigation-by-user-activation\");}return result.join(\" \");}function EmbedHTML({html,style}){const iframeRef=useRef();const divRef=useRef();const onCanvas=useIsOnCanvas();const[iframeHeight,setIframeHeight]=useState(0);const hasAutoHeight=!style.height;const hasScript=html.includes(\"</script>\");const hasSplineViewer=html.includes(\"</spline-viewer>\");const useSrcDocIframe=hasScript&&!hasSplineViewer;// Handle auto sizing\nuseEffect(()=>{var _iframeRef_current;const iframeWindow=(_iframeRef_current=iframeRef.current)===null||_iframeRef_current===void 0?void 0:_iframeRef_current.contentWindow;function handleMessage(event){if(event.source!==iframeWindow)return;const data=event.data;if(typeof data!==\"object\"||data===null)return;const height=data.embedHeight;if(typeof height!==\"number\")return;setIframeHeight(height);}window.addEventListener(\"message\",handleMessage);// After SSG the iframe loads before we attach the event handler,\n// therefore we need to request the latest height from the iframe.\niframeWindow===null||iframeWindow===void 0?void 0:iframeWindow.postMessage(\"getEmbedHeight\",\"*\");return()=>{window.removeEventListener(\"message\",handleMessage);};},[]);// Handle script execution\nuseEffect(()=>{if(!hasScript||useSrcDocIframe)return;const div=divRef.current;if(!div)return;div.innerHTML=html;executeScripts(div);return()=>{div.innerHTML=\"\";};},[html,hasScript,useSrcDocIframe]);if(useSrcDocIframe){const srcDoc=`<html>\n    <head>\n        <style>body { margin: 0; }</style>\n    </head>\n    <body>\n        ${html}\n        <script type=\"module\">\n            let height = 0\n\n            function sendEmbedHeight() {\n                window.parent.postMessage({\n                    embedHeight: height\n                }, \"*\")\n            }\n\n            const observer = new ResizeObserver((entries) => {\n                if (entries.length !== 1) return\n                const entry = entries[0]\n                if (entry.target !== document.body) return\n\n                height = entry.contentRect.height\n                sendEmbedHeight()\n            })\n\n            observer.observe(document.body)\n\n            window.addEventListener(\"message\", (event) => {\n                if (event.source !== window.parent) return\n                if (event.data !== \"getEmbedHeight\") return\n                sendEmbedHeight()\n            })\n        </script>\n    <body>\n</html>`;const currentStyle={...iframeStyle,...style};if(hasAutoHeight){currentStyle.height=iframeHeight+\"px\";}return /*#__PURE__*/_jsx(\"iframe\",{ref:iframeRef,style:currentStyle,srcDoc:srcDoc});}// else\nreturn /*#__PURE__*/_jsx(\"div\",{ref:divRef,style:{...htmlStyle,...style},dangerouslySetInnerHTML:!hasScript?{__html:html}:undefined});}const htmlStyle={width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\"};// This function replaces scripts with executable ones.\n// https://stackoverflow.com/questions/1197575/can-scripts-be-inserted-with-innerhtml\nfunction executeScripts(node){if(node instanceof Element&&node.tagName===\"SCRIPT\"){const script=document.createElement(\"script\");script.text=node.innerHTML;for(const{name,value}of node.attributes){script.setAttribute(name,value);}node.parentElement.replaceChild(script,node);}else{for(const child of node.childNodes){executeScripts(child);}}}// Generic components\nfunction LoadingIndicator(){return /*#__PURE__*/_jsx(\"div\",{className:\"framerInternalUI-componentPlaceholder\",style:{...containerStyles,overflow:\"hidden\"},children:/*#__PURE__*/_jsx(\"div\",{style:centerTextStyle,children:\"Loading\u2026\"})});}function ErrorMessage({message,style}){return /*#__PURE__*/_jsx(\"div\",{className:\"framerInternalUI-errorPlaceholder\",style:{minHeight:getMinHeight(style),...containerStyles,overflow:\"hidden\",...style},children:/*#__PURE__*/_jsx(\"div\",{style:centerTextStyle,children:message})});}const centerTextStyle={textAlign:\"center\",minWidth:140};// Returns a min-height if the component is using auto-height.\nfunction getMinHeight(style){const hasAutoHeight=!style.height;if(hasAutoHeight)return 200;}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Embed\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerIntrinsicWidth\":\"600\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicHeight\":\"400\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Embed.map"],
  "mappings": "8KAQkB,SAARA,EAAuB,CAAC,KAAAC,EAAK,IAAAC,EAAI,KAAAC,EAAK,MAAAC,EAAM,CAAC,CAAC,EAAE,CAAC,OAAGH,IAAO,OAAOC,EAAyBG,EAAKC,EAAS,CAAC,IAAIJ,EAAI,MAAME,CAAK,CAAC,EAAMH,IAAO,QAAQE,EAA0BE,EAAKE,EAAU,CAAC,KAAKJ,EAAK,MAAMC,CAAK,CAAC,EAAuBC,EAAKG,E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,EAAgB,CAAC,UAAU,SAAS,SAAS,GAAG,EACzjB,SAASF,EAAaR,EAAM,CAAmC,GAAd,CAACA,EAAM,OAAwB,MAAO,IAAI",
  "names": ["Embed", "type", "url", "html", "style", "p", "EmbedURL", "EmbedHTML", "Instructions", "addPropertyControls", "ControlType", "props", "getMinHeight", "emptyStateStyle", "centerTextStyle", "hasAutoHeight", "onCanvas", "useIsOnCanvas", "state", "setState", "ye", "ue", "isLastEffect", "load", "response", "isBlocked", "message", "error", "ErrorMessage", "LoadingIndicator", "iframeStyle", "getSandbox", "result", "iframeRef", "pe", "divRef", "iframeHeight", "setIframeHeight", "hasScript", "hasSplineViewer", "useSrcDocIframe", "_iframeRef_current", "iframeWindow", "handleMessage", "event", "data", "height", "window", "div", "executeScripts", "srcDoc", "currentStyle", "htmlStyle", "node", "script", "name", "value", "child", "containerStyles"]
}
