{"version":3,"file":"Embed.CS3Rcpuo.mjs","names":["useState","useRef","__esmMin","init_npm_react_18_3_1","_e","p","c","init_jsx_runtime","ce","de","addPropertyControls","init_framer_BkYB2Gqq","ControlType","emptyStateStyle","containerStyles","useIsOnCanvas","init_OIjZRBmWDcIE2B6qgG1j","init_default_utils","Embed","type","url","EmbedURL","html","EmbedHTML","Instructions","centerTextStyle","onCanvas","state","setState","isLastEffect","load","response","isBlocked","message","error","ErrorMessage","LoadingIndicator","iframeStyle","getSandbox","result","ref","div","htmlStyle","__FramerMetadata__","init_Embed","props","\"exports\"","\"default\"","\"type\"","\"name\"","\"slots\"","\"annotations\"","\"framerSupportedLayoutWidth\"","\"framerSupportedLayoutHeight\"","\"framerIntrinsicWidth\"","\"framerIntrinsicHeight\"","\"framerContractVersion\"","\"__FramerMetadata__\""],"sources":["https:/framer.com/m/framer/default-utils.js","https:/framerusercontent.com/modules/o1PI5S8YtkA5bP5g4dFz/4uFi0eQcCd35PpjiP8FM/Embed.js"],"sourcesContent":["/*\n * index (framer/default-utils@0.45.0)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/G4IfyjvwmaeSBpdb4TWu/OIjZRBmWDcIE2B6qgG1j/index.js\"\n","import{jsx as _jsx,jsxs as _jsxs}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 fixed\n */ export default function Embed({type,url,html}){if(type===\"url\"&&url){return(/*#__PURE__*/ _jsx(EmbedURL,{url:url}));}if(type===\"html\"&&html){return(/*#__PURE__*/ _jsx(EmbedHTML,{html:html}));}return(/*#__PURE__*/ _jsx(Instructions,{}));};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’t support embedding.\",hidden(props){return props.type!==\"url\";}},html:{title:\"HTML\",displayTextArea:true,type:ControlType.String,hidden(props){return props.type!==\"html\";}}});function Instructions(){return(/*#__PURE__*/ _jsx(\"div\",{style:{...emptyStateStyle,overflow:\"hidden\"},children:/*#__PURE__*/ _jsx(\"div\",{style:centerTextStyle,children:\"To embed a website or widget, add it to the properties\\xa0panel.\"})}));}function EmbedURL({url}){// 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’t be reached.\");setState(error);}}load().catch(error=>{console.error(error);setState(error);});return()=>{isLastEffect=false;};},[url]);if(!url.startsWith(\"https://\")){return(/*#__PURE__*/ _jsx(ErrorMessage,{message:\"Unsupported protocol.\"}));}if(state===undefined){return(/*#__PURE__*/ _jsx(LoadingIndicator,{}));}if(state instanceof Error){return(/*#__PURE__*/ _jsx(ErrorMessage,{message:state.message}));}if(state===true){const message=`Can't embed ${url} due to its content security policy.`;return(/*#__PURE__*/ _jsx(ErrorMessage,{message:message}));}return(/*#__PURE__*/ _jsx(\"iframe\",{src:url,style:iframeStyle,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}){const ref=useRef();useEffect(()=>{const div=ref.current;div.innerHTML=html;return()=>{div.innerHTML=\"\";};},[html]);return(/*#__PURE__*/ _jsx(\"div\",{ref:ref,style:htmlStyle}));}const htmlStyle={width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\"};// Generic components\nfunction LoadingIndicator(){return(/*#__PURE__*/ _jsx(\"div\",{className:\"framerInternalUI-componentPlaceholder\",style:{...containerStyles,overflow:\"hidden\"},children:/*#__PURE__*/ _jsx(\"div\",{style:centerTextStyle,children:\"Loading…\"})}));}function ErrorMessage({message}){return(/*#__PURE__*/ _jsx(\"div\",{className:\"framerInternalUI-errorPlaceholder\",style:{...containerStyles,overflow:\"hidden\"},children:/*#__PURE__*/ _jsxs(\"div\",{style:centerTextStyle,children:[\"Error: \",message]})}));}const centerTextStyle={textAlign:\"center\",minWidth:140};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Embed\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerIntrinsicWidth\":\"600\",\"framerIntrinsicHeight\":\"400\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Embed.map"],"mappings":"A,6VCMI,SAAwBkB,EAAM,CAAC,OAAK,MAAI,QAAM,CAAkJ,OAA9IC,IAAO,OAAOC,EAA0B,gBAAKC,EAAS,CAAK,KA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