import { a as be, b as _e, c as Ye, d as Pe, e as Y, } from "./chunk-V2NOINMQ.mjs"; import { a as Ce } from "./chunk-K45JCPO7.mjs"; import { a as le, b as q } from "./chunk-CSODDE67.mjs"; import "./chunk-42U43NKG.mjs"; import { G as ee, K as j, N as D, P as U, R as er, S as ye, T as v, U as S, W as re, X as rr, Y as tr, b as l, ba as f, d as O, h as xe, ha as te, i as z, ia as ar, j as J, k as Je, ka as ir, l as we, la as nr, m as E, ma as ve, n as oe, na as C, oa as g, p as se, q as e, qa as Ee, r as h, ra as s, sa as ae, t as K, ta as N, u as A, v as Ke, w as $, z as $e, } from "./chunk-YK6GNT7F.mjs"; import "./chunk-JR5VT52U.mjs"; import { c as x } from "./chunk-RIUMFBNJ.mjs"; function me({ type: t, url: r, html: a, style: i = {} }) { return t === "url" && r ? e(kr, { url: r, style: i }) : t === "html" && a ? e(Lr, { html: a, style: i }) : e(Hr, { style: i }); } D(me, { type: { type: j.Enum, defaultValue: "url", displaySegmentedControl: !0, options: ["url", "html"], optionTitles: ["URL", "HTML"], }, url: { title: "URL", type: j.String, description: "Some websites don\u2019t support embedding.", hidden(t) { return t.type !== "url"; }, }, html: { title: "HTML", type: j.String, displayTextArea: !0, hidden(t) { return t.type !== "html"; }, }, }); function Hr({ style: t }) { return e("div", { style: { minHeight: mr(t), ..._e, overflow: "hidden", ...t }, children: e("div", { style: Te, children: "To embed a website or widget, add it to the properties\xA0panel.", }), }); } function kr({ url: t, style: r }) { let a = !r.height; /[a-z]+:\/\//.test(t) || (t = "https://" + t); let i = Ye(), [o, m] = oe(i ? void 0 : !1); if ( (z(() => { if (!i) return; let c = !0; m(void 0); async function d() { let u = await fetch( "https://api.framer.com/functions/check-iframe-url?url=" + encodeURIComponent(t) ); if (u.status == 200) { let { isBlocked: n } = await u.json(); c && m(n); } else { let n = await u.text(); console.error(n); let y = new Error("This site can\u2019t be reached."); m(y); } } return ( d().catch((u) => { console.error(u), m(u); }), () => { c = !1; } ); }, [t]), i && a) ) return e(He, { message: "URL embeds do not support auto height.", style: r, }); if (!t.startsWith("https://")) return e(He, { message: "Unsupported protocol.", style: r }); if (o === void 0) return e(Sr, {}); if (o instanceof Error) return e(He, { message: o.message, style: r }); if (o === !0) { let c = `Can\u2019t embed ${t} due to its content security policy.`; return e(He, { message: c, style: r }); } return e("iframe", { src: t, style: { ...or, ...r }, loading: "lazy", fetchPriority: i ? "low" : "auto", referrerPolicy: "no-referrer", sandbox: Zr(i), }); } var or = { width: "100%", height: "100%", border: "none" }; function Zr(t) { let r = ["allow-same-origin", "allow-scripts"]; return ( t || r.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" ), r.join(" ") ); } function Lr({ html: t, ...r }) { if (t.includes("")) { let i = t.includes(""), o = t.includes(""); return i || o ? e(Ar, { html: t, ...r }) : e(Wr, { html: t, ...r }); } return e(jr, { html: t, ...r }); } function Wr({ html: t, style: r }) { let a = E(), [i, o] = oe(0); z(() => { var u; let n = (u = a.current) === null || u === void 0 ? void 0 : u.contentWindow; function y(H) { if (H.source !== n) return; let k = H.data; if (typeof k != "object" || k === null) return; let L = k.embedHeight; typeof L == "number" && o(L); } return ( x.addEventListener("message", y), n?.postMessage("getEmbedHeight", "*"), () => { x.removeEventListener("message", y); } ); }, []); let m = ` ${t}