UNPKG

@builder.io/sdk-vue

Version:
1,831 lines (1,828 loc) 165 kB
import { defineComponent as y, openBlock as d, createElementBlock as h, Fragment as I, createBlock as S, resolveDynamicComponent as Z, mergeProps as w, toHandlers as O, withCtx as U, renderSlot as V, resolveComponent as k, createTextVNode as Rt, toDisplayString as ce, defineAsyncComponent as X, createVNode as E, renderList as L, createCommentVNode as C, h as Ke, createElementVNode as z, normalizeStyle as j, normalizeClass as ee, markRaw as Et } from "vue"; import { T as $, g as Pt, f as At, i as R, s as Bt, r as Vt, p as Nt, a as Wt, l as N, b as qe, c as ke, d as xt, n as ze, e as K, h as P, j as Dt } from "./should-force-browser-runtime-in-node-ikxWrCvn.js"; const Ot = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), Ut = (e) => typeof e == "string" && Ot.has(e.toLowerCase()); function W(e = {}, t, n) { const o = {}; for (const r in e) { if (!e[r] || n && !r.startsWith(t)) continue; const i = n ? r.replace(t, "") : r; o[i] = e[r]; } return o; } const Ft = y({ name: "dynamic-renderer", props: ["TagName", "attributes", "actionAttributes"], data() { return { isEmptyElement: Ut }; } }), v = (e, t) => { const n = e.__vccOpts || e; for (const [o, r] of t) n[o] = r; return n; }; function Lt(e, t, n, o, r, i) { return e.isEmptyElement(e.TagName) ? (d(), S(Z(e.TagName), w({ key: 1 }, e.attributes, O(e.actionAttributes)), null, 16)) : (d(), h(I, { key: 0 }, [ typeof e.TagName == "string" ? (d(), S(Z(e.TagName), w({ key: 0 }, e.attributes, O(e.actionAttributes)), { default: U(() => [ V(e.$slots, "default") ]), _: 3 }, 16)) : (d(), S(Z(e.TagName), w({ key: 1 }, e.attributes, O(e.actionAttributes)), { default: U(() => [ V(e.$slots, "default") ]), _: 3 }, 16)) ], 64)); } const Ce = /* @__PURE__ */ v(Ft, [["render", Lt]]), hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Ce }, Symbol.toStringTag, { value: "Module" })), G = () => { switch ($) { case "react": case "reactNative": case "rsc": return "className"; case "svelte": case "vue": case "solid": case "qwik": case "angular": return "class"; } }, Ht = y({ name: "builder-button", components: { DynamicRenderer: Ce }, props: [ "attributes", "link", "openLinkInNewTab", "builderLinkComponent", "text" ], data() { return { filterAttrs: W }; }, methods: { attrs() { return { ...W(this.attributes, "v-on:", !1), [G()]: `${this.link ? "" : "builder-button"} ${this.attributes[G()] || ""}`, ...this.link ? { href: this.link, target: this.openLinkInNewTab ? "_blank" : void 0, role: "link" } : { role: "button" } }; } } }); function Mt(e, t, n, o, r, i) { const s = k("DynamicRenderer"); return d(), S(s, { attributes: e.attrs(), TagName: e.link ? e.builderLinkComponent || "a" : "button", actionAttributes: e.filterAttrs(e.attributes, "v-on:", !0) }, { default: U(() => [ Rt(ce(e.text), 1) ]), _: 1 }, 8, ["attributes", "TagName", "actionAttributes"]); } const jt = /* @__PURE__ */ v(Ht, [["render", Mt]]), Kt = Symbol(), be = { Builder: { content: null, context: {}, localState: void 0, rootSetState() { }, rootState: {}, apiKey: null, apiVersion: void 0, componentInfos: {}, inheritedStyles: {}, BlocksWrapper: "div", BlocksWrapperProps: {}, nonce: "", model: "" }, key: Kt }, qt = Symbol(), Ge = { Components: { registeredComponents: {} }, key: qt }, Je = (e, t, n) => { const o = String.prototype.split.call(t, /[,[\].]+?/).filter(Boolean).reduce((r, i) => r != null ? r[i] : r, e); return o === void 0 || o === e ? n : o; }, zt = ({ code: e, builder: t, context: n, event: o, localState: r, rootSetState: i, rootState: s }) => { const a = Pt({ builder: t, context: n, event: o, state: At({ rootState: s, localState: r, rootSetState: i }) }); return new Function(...a.map(([l]) => l), e)(...a.map(([, l]) => l)); }, Gt = (e) => R() || Bt({ shouldLogWarning: !0 }) ? zt(e) : Vt(e), Jt = /^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/, Qt = /(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/, Yt = (e) => { var t, n, o, r, i, s; return ((o = (n = (t = Jt.exec(e.trim())) == null ? void 0 : t.groups) == null ? void 0 : n.getPath) == null ? void 0 : o.slice(1)) || ((s = (i = (r = Qt.exec(e.trim())) == null ? void 0 : r.groups) == null ? void 0 : i.getPath) == null ? void 0 : s.slice(1)); }; function te({ code: e, context: t, localState: n, rootState: o, rootSetState: r, event: i, isExpression: s = !0 }) { if (e.trim() === "") return; const a = Yt(e.trim()); if (a) return Je({ ...o, ...n }, a); const l = { code: Nt(e, { isExpression: s }), builder: Wt(), context: t, event: i, rootSetState: r, rootState: o, localState: n }; try { return Gt(l); } catch (u) { N.error("Failed code evaluation: " + u.message, { code: e }); return; } } function Xt(e, t) { var n; return { ...(n = e.component) == null ? void 0 : n.options, ...e.options, ...Zt(e, t) }; } const Zt = (e, t) => { var n, o; if (((n = e.component) == null ? void 0 : n.name) === "Text" && ((o = e.component.options) != null && o.text) && typeof e.component.options.text == "string") return { ...e.component.options, text: e.component.options.text.replace(/{{([^}]+)}}/g, (r, i) => te({ code: i, context: t, localState: t.localState, rootState: t.rootState, rootSetState: t.rootSetState })) }; }; function _t(e, ...t) { const n = Object.assign({}, e); for (const o of t) delete n[o]; return n; } function se(e, t, n = null, o = null, r = /* @__PURE__ */ new WeakSet()) { if (e == null || typeof e != "object") { t(e, (i) => { n !== null && o !== null && (n[o] = i); }); return; } r.has(e) || (r.add(e), Array.isArray(e) ? e.forEach((i, s) => { t(i, (l) => { e[s] = l; }), se(i, t, e, s, r); }) : Object.entries(e).forEach(([i, s]) => { t(s, (l) => { e[i] = l; }), se(s, t, e, i, r); })); } function Qe(e) { return e && typeof e == "object" && e["@type"] === "@builder.io/core:LocalizedValue"; } function en(e) { if (!e || !Object.getOwnPropertyNames(e).length) return !1; let t = !1; return se(e, (n) => { if (Qe(n)) { t = !0; return; } }), t; } function tn(e, t) { return !e || !Object.getOwnPropertyNames(e).length ? {} : (se(e, (n, o) => { Qe(n) && o(n[t] ?? void 0); }), e); } function nn(e, t) { var n, o; return (n = e.component) != null && n.options && en((o = e.component) == null ? void 0 : o.options) && (t || console.warn("[Builder.io] In order to use localized fields in Builder, you must pass a locale prop to the BuilderComponent or to options object while fetching the content to resolve localized fields. Learn more: https://www.builder.io/c/docs/localization-inline#targeting-and-inline-localization"), e.component.options = tn(e.component.options, t ?? "Default")), e; } function ge(e) { if (e === null || typeof e != "object") return e; if (Array.isArray(e)) return e.map((n) => ge(n)); if (e["@type"] === "@builder.io/sdk:Element") return e; const t = {}; for (const n in e) n !== "meta" && Object.prototype.hasOwnProperty.call(e, n) && (t[n] = ge(e[n])); return t; } const on = ["svelte", "vue", "angular", "qwik", "solid"].includes($), rn = (e) => { if (on) { const t = ke(e); return { ...t, properties: { ...t.properties }, actions: { ...t.actions } }; } else { const t = ge(_t(e, "children", "meta")); return { ...t, properties: { ...t.properties }, actions: { ...t.actions }, children: e.children, meta: e.meta }; } }, sn = ({ block: e, context: t, localState: n, rootState: o, rootSetState: r }) => { if (!e.bindings) return e; const i = rn(e); for (const s in e.bindings) { const a = e.bindings[s], l = te({ code: a, localState: n, rootState: o, rootSetState: r, context: t }); qe(i, s, l); } return i; }; function an({ block: e, context: t, localState: n, rootState: o, rootSetState: r }) { let i = e; return i = sn({ block: i, localState: n, rootState: o, rootSetState: r, context: t }), i = nn(i, o.locale), i; } function Te(e) { const t = e || (R() ? window.location.search : void 0); return t ? xt(t).indexOf("builder.preview=") !== -1 : !1; } const ln = (e) => ({ type: "builder.registerComponent", data: ae(e) }), cn = (e) => { const t = e.toString().trim(), n = /^[a-zA-Z0-9_]+\s*=>/i.test(t); return `return (${!t.startsWith("function") && !t.startsWith("async") && !t.startsWith("(") && !n ? "function " : ""}${t}).apply(this, arguments)`; }; function ae(e) { return JSON.parse(JSON.stringify(e, (t, n) => typeof n == "function" ? cn(n) : n)); } const Ne = {}; function fs(e, t) { e === "plugin" && (t = ae(t)); let n = Ne[e]; if (n || (n = Ne[e] = []), n.push(t), R()) { const o = { type: "builder.register", data: { type: e, info: t } }; try { parent.postMessage(o, "*"), parent !== window && window.postMessage(o, "*"); } catch (r) { console.debug("Could not postmessage", r); } } } function bs(e) { var t; if (R()) { const n = JSON.parse(JSON.stringify(e)); e.action && (n.action = e.action.toString()), (t = window.parent) == null || t.postMessage({ type: "builder.registerAction", data: n }, "*"); } } const We = {}; function gs(e) { if (R()) { Object.assign(We, e); const t = { type: "builder.settingsChange", data: We }; parent.postMessage(t, "*"); } } const xe = "builder.", dn = "options.", Ye = (e) => { if (!e) return {}; const t = ze(e), n = {}; return Object.keys(t).forEach((o) => { if (o.startsWith(xe)) { const r = o.replace(xe, "").replace(dn, ""); n[r] = t[o]; } }), n; }, un = () => { if (!R()) return {}; const e = new URLSearchParams(window.location.search); return Ye(e); }, Xe = "4.2.1", Ze = () => ({ "X-Builder-SDK": $, "X-Builder-SDK-GEN": "2", "X-Builder-SDK-Version": Xe }), pn = (e) => { if (e === "localhost" || e === "127.0.0.1") return e; const t = e.split("."); return t.length > 2 ? t.slice(1).join(".") : e; }, de = ({ name: e, canTrack: t }) => { var n; try { return t ? (n = document.cookie.split("; ").find((o) => o.startsWith(`${e}=`))) == null ? void 0 : n.split("=")[1] : void 0; } catch (o) { N.warn("[COOKIE] GET error: ", (o == null ? void 0 : o.message) || o); return; } }, _e = async (e) => de(e), mn = (e) => e.map(([t, n]) => n ? `${t}=${n}` : t).filter(K).join("; "), hn = [["secure", ""], ["SameSite", "None"]], fn = ({ name: e, value: t, expires: n }) => { const r = (R() ? location.protocol === "https:" : !0) ? hn : [[]], i = n ? [["expires", n.toUTCString()]] : [[]], s = [[e, t], ...i, ["path", "/"], ["domain", pn(window.location.hostname)], ...r]; return mn(s); }, Ie = async ({ name: e, value: t, expires: n, canTrack: o }) => { try { if (!o) return; const r = fn({ name: e, value: t, expires: n }); document.cookie = r; } catch (r) { N.warn("[COOKIE] SET error: ", (r == null ? void 0 : r.message) || r); } }; function bn() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) { const t = Math.random() * 16 | 0; return (e == "x" ? t : t & 3 | 8).toString(16); }); } function et() { return bn().replace(/-/g, ""); } const tt = "builderSessionId", gn = async ({ canTrack: e }) => { if (!e) return; const t = await _e({ name: tt, canTrack: e }); if (K(t)) return t; { const n = yn(); return vn({ id: n, canTrack: e }), n; } }, yn = () => et(), vn = ({ id: e, canTrack: t }) => Ie({ name: tt, value: e, canTrack: t }), nt = () => R() && typeof localStorage < "u" ? localStorage : void 0, Sn = ({ key: e, canTrack: t }) => { var n; try { return t ? (n = nt()) == null ? void 0 : n.getItem(e) : void 0; } catch (o) { console.debug("[LocalStorage] GET error: ", o); return; } }, kn = ({ key: e, canTrack: t, value: n }) => { var o; try { t && ((o = nt()) == null || o.setItem(e, n)); } catch (r) { console.debug("[LocalStorage] SET error: ", r); } }, ot = "builderVisitorId", Cn = ({ canTrack: e }) => { if (!e) return; const t = Sn({ key: ot, canTrack: e }); if (K(t)) return t; { const n = Tn(); return In({ id: n, canTrack: e }), n; } }, Tn = () => et(), In = ({ id: e, canTrack: t }) => kn({ key: ot, value: e, canTrack: t }); function we(e) { var t; typeof process < "u" && ((t = process.env) != null && t.DEBUG) && String(process.env.DEBUG) == "true" && N.log(e); } const wn = async ({ canTrack: e }) => { if (!e) return { visitorId: void 0, sessionId: void 0 }; const t = await gn({ canTrack: e }), n = Cn({ canTrack: e }); return { sessionId: t, visitorId: n }; }, $n = async ({ type: e, canTrack: t, apiKey: n, metadata: o, ...r }) => ({ type: e, data: { ...r, metadata: { url: location.href, ...o }, ...await wn({ canTrack: t }), userAttributes: Dt(), ownerId: n } }); async function ye({ apiHost: e, ...t }) { if (!t.apiKey) { N.error("Missing API key for track call. Please provide your API key."); return; } if (!t.canTrack || P() || !(R() || $ === "reactNative")) return; const o = `${e || "https://cdn.builder.io"}/api/v1/track`; return we(o), fetch(o, { method: "POST", body: JSON.stringify({ events: [await $n(t)] }), headers: { "content-type": "application/json", ...Ze() }, mode: "cors" }).catch((r) => { console.error("Failed to track: ", r); }); } const ys = (e) => ye({ ...e, canTrack: !0 }), Rn = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"]; function rt(e, t) { if (!t.origin.startsWith("http") && !t.origin.startsWith("https")) return !1; const n = new URL(t.origin), o = n.hostname; return (e || Rn).findIndex((r) => r.startsWith("*.") ? o.endsWith(r.slice(1)) : r === o) > -1; } let De = !1; const it = (e) => { var t, n; De || (De = !0, R() && ((t = window.parent) == null || t.postMessage({ type: "builder.sdkInfo", data: { target: $, version: Xe, supportsPatchUpdates: !1, // Supports builder-model="..." attribute which is needed to // scope our '+ add block' button styling supportsAddBlockScoping: !0, supportsCustomBreakpoints: !0, modelName: e.modelName, apiKey: e.apiKey, supportsXSmallBreakpoint: !0, blockLevelPersonalization: !0 } }, "*"), (n = window.parent) == null || n.postMessage({ type: "builder.updateContent", data: { options: e } }, "*"), window.addEventListener("message", (o) => { var i, s; if (!rt(e.trustedHosts, o)) return; const { data: r } = o; if (r != null && r.type) switch (r.type) { case "builder.evaluate": { const a = r.data.text, l = r.data.arguments || [], u = r.data.id, p = new Function(a); let f, c = null; try { f = p.apply(null, l); } catch (m) { c = m; } c ? (i = window.parent) == null || i.postMessage({ type: "builder.evaluateError", data: { id: u, error: c.message } }, "*") : f && typeof f.then == "function" ? f.then((m) => { var b; (b = window.parent) == null || b.postMessage({ type: "builder.evaluateResult", data: { id: u, result: m } }, "*"); }).catch(console.error) : (s = window.parent) == null || s.postMessage({ type: "builder.evaluateResult", data: { result: f, id: u } }, "*"); break; } } }))); }, st = ({ model: e, trustedHosts: t, callbacks: n }) => (o) => { if (!rt(t, o)) return; const { data: r } = o; if (r) switch (r.type) { case "builder.configureSdk": { n.configureSdk(r.data); break; } case "builder.triggerAnimation": { n.animation(r.data); break; } case "builder.resetState": { const i = r.data, s = i.model, a = i == null ? void 0 : i.state; s === e && a && n.stateUpdate(a); break; } case "builder.contentUpdate": { const i = r.data, s = i.key || i.alias || i.entry || i.modelName, a = i.data; s === e && n.contentUpdate(a); break; } } }, vs = ({ model: e, apiKey: t, callback: n, trustedHosts: o }) => { if (!R) return N.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => { }; it({ modelName: e, apiKey: t }); const r = st({ callbacks: { contentUpdate: n, animation: () => { }, configureSdk: () => { }, stateUpdate: () => { } }, model: e, trustedHosts: o }); return window.addEventListener("message", r), () => { window.removeEventListener("message", r); }; }, En = "builder.tests", $e = (e) => `${En}.${e}`, Pn = ({ contentId: e }) => _e({ name: $e(e), canTrack: !0 }), An = ({ contentId: e }) => de({ name: $e(e), canTrack: !0 }), Bn = ({ contentId: e, value: t }) => Ie({ name: $e(e), value: t, canTrack: !0 }), at = (e) => K(e.id) && K(e.variations) && Object.keys(e.variations).length > 0, Vn = ({ id: e, variations: t }) => { var r; let n = 0; const o = Math.random(); for (const i in t) { const s = (r = t[i]) == null ? void 0 : r.testRatio; if (n += s, o < n) return i; } return e; }, lt = (e) => { const t = Vn(e); return Bn({ contentId: e.id, value: t }).catch((n) => { N.error("could not store A/B test variation: ", n); }), t; }, ct = ({ item: e, testGroupId: t }) => { const n = e.variations[t]; return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation !n ? { testVariationId: e.id, testVariationName: "Default" } : { data: n.data, testVariationId: n.id, testVariationName: n.name || (n.id === e.id ? "Default" : "") }; }, Nn = ({ item: e, canTrack: t }) => { if (!t) return e; if (!e) return; if (!at(e)) return e; const n = An({ contentId: e.id }) || lt({ variations: e.variations, id: e.id }), o = ct({ item: e, testGroupId: n }); return { ...e, ...o }; }, Wn = async ({ item: e, canTrack: t }) => { if (!t || !at(e)) return e; const o = await Pn({ contentId: e.id }) || lt({ variations: e.variations, id: e.id }), r = ct({ item: e, testGroupId: o }); return { ...e, ...r }; }; const Oe = "builder.userAttributes"; function Ue() { let e = !0; const t = /* @__PURE__ */ new Set(); return { setUserAttributes(n) { if (!R()) return; const o = { ...this.getUserAttributes(), ...n }; Ie({ name: Oe, value: JSON.stringify(o), canTrack: e }), t.forEach((r) => r(o)); }, getUserAttributes() { return R() ? JSON.parse(de({ name: Oe, canTrack: e }) || "{}") : {}; }, subscribeOnUserAttributesChange(n, { fireImmediately: o } = {}) { return t.add(n), o && n(this.getUserAttributes()), function() { t.delete(n); }; }, setCanTrack(n) { e = n; } }; } let ve; R() && $ === "qwik" ? (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ || (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ = Ue()), ve = window.__BUILDER_USER_ATTRIBUTES_SERVICE__) : ve = Ue(); const le = ve, Ss = (e) => { le.setUserAttributes(e); }, J = (e) => { const t = K(e) ? e : !0; return le.setCanTrack(t), t; }; function xn() { return typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : globalThis; } function Dn() { const e = xn().fetch; if (typeof e > "u") throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project. For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function"); return e; } const On = Dn(); function Se(e, t = null, n = ".") { return Object.keys(e).reduce((o, r) => { const i = e[r], s = [t, r].filter(Boolean).join(n); return [typeof i == "object", i !== null, !(Array.isArray(i) && i.length === 0)].every(Boolean) ? { ...o, ...Se(i, s, n) } : { ...o, [s]: i }; }, {}); } function dt(e, t, n = {}) { for (const o in e) { const r = e[o], i = t ? t + "." + o : o; r && typeof r == "object" && !Array.isArray(r) && !Object.keys(r).find((s) => s.startsWith("$")) ? dt(r, i, n) : n[i] = r; } return n; } function Un(e) { const t = {}; for (const n in e) { const o = n.split("."); let r = t; for (let i = 0; i < o.length; i++) { const s = o[i]; i === o.length - 1 ? r[s] = e[n] : (r[s] = r[s] || {}, r = r[s]); } } return t; } const Fn = "v3", Fe = (e) => typeof e == "number" && !isNaN(e) && e >= 0, Re = (e) => { const { limit: t = 30, userAttributes: n, query: o, model: r, apiKey: i, enrich: s, locale: a, apiVersion: l = Fn, fields: u, omit: p, offset: f, cacheSeconds: c, staleCacheSeconds: m, sort: b, includeUnpublished: g, apiHost: A } = e; if (!i) throw new Error("Missing API key"); if (!["v3"].includes(l)) throw new Error(`Invalid apiVersion: expected 'v3', received '${l}'`); const F = t !== 1, B = A || "https://cdn.builder.io", T = new URL(`${B}/api/${l}/content/${r}`); T.searchParams.set("apiKey", i), T.searchParams.set("limit", String(t)), T.searchParams.set("noTraverse", String(F)), T.searchParams.set("includeRefs", String(!0)); const x = a || (n == null ? void 0 : n.locale); let H = n || {}; if (x && (T.searchParams.set("locale", x), H = { locale: x, ...H }), s && T.searchParams.set("enrich", String(s)), T.searchParams.set("omit", p ?? "meta.componentsUsed"), u && T.searchParams.set("fields", u), Number.isFinite(f) && f > -1 && T.searchParams.set("offset", String(Math.floor(f))), typeof g == "boolean" && T.searchParams.set("includeUnpublished", String(g)), c && Fe(c) && T.searchParams.set("cacheSeconds", String(c)), m && Fe(m) && T.searchParams.set("staleCacheSeconds", String(m)), b) { const D = Se({ sort: b }); for (const M in D) T.searchParams.set(M, JSON.stringify(D[M])); } const Q = { ...un(), ...ze(e.options || {}) }; H = { ...H, ...Hn(Q) }; const Y = Se(Q); for (const D in Y) T.searchParams.set(D, String(Y[D])); if (Object.keys(H).length > 0 && T.searchParams.set("userAttributes", JSON.stringify(H)), o) { const D = dt({ query: o }); for (const M in D) T.searchParams.set(M, JSON.stringify(D[M])); } return T; }, Ln = (e) => { const t = {}; for (const n in e) n.startsWith("userAttributes.") && (t[n] = e[n], delete e[n]); return t; }, Hn = (e) => { if (R() && e.preview === "BUILDER_STUDIO") { e["userAttributes.urlPath"] = window.location.pathname, e["userAttributes.host"] = window.location.host; const t = Ln(e), { userAttributes: n } = Un(t); return n; } return {}; }, Mn = (e) => "results" in e; async function Ee(e) { const t = await qn({ ...e, limit: 1 }); return t && t[0] || null; } const jn = async (e) => { var s; const t = Re(e), n = e.fetch ?? On, o = { ...e.fetchOptions, headers: { ...(s = e.fetchOptions) == null ? void 0 : s.headers, ...Ze() } }; return await (await n(t.href, o)).json(); }, Kn = async (e, t, n = Re(e)) => { const o = J(e.canTrack); if (n.search.includes("preview="), !o || !(R() || $ === "reactNative")) return t.results; try { const r = []; for (const i of t.results) r.push(await Wn({ item: i, canTrack: o })); t.results = r; } catch (r) { N.error("Could not process A/B tests. ", r); } return t.results; }; async function qn(e) { const t = Re(e), n = await jn(e); if (!Mn(n)) throw N.error("Error fetching data. ", { url: t, content: n, options: e }), n; return Kn(e, n); } const ks = async (e) => { var o, r, i; const t = e.path || ((o = e.url) == null ? void 0 : o.pathname) || ((r = e.userAttributes) == null ? void 0 : r.urlPath), n = { ...e, apiKey: e.apiKey, model: e.model || "page", userAttributes: { ...e.userAttributes, ...t ? { urlPath: t } : {} }, options: Ye(e.searchParams || ((i = e.url) == null ? void 0 : i.searchParams) || e.options) }; return { apiKey: n.apiKey, model: n.model, content: await Ee(n) }; }, Pe = (e) => e ? e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase() : ""; function zn(e, t, n = {}) { let o, r, i, s = null, a = 0; const l = function() { a = n.leading === !1 ? 0 : Date.now(), s = null, i = e.apply(o, r), s || (o = r = null); }; return function() { const u = Date.now(); !a && n.leading === !1 && (a = u); const p = t - (u - a); return o = this, r = arguments, p <= 0 || p > t ? (s && (clearTimeout(s), s = null), a = u, i = e.apply(o, r), s || (o = r = null)) : !s && n.trailing !== !1 && (s = setTimeout(l, p)), i; }; } function _(e, ...t) { const n = Object(e); for (let o = 1; o < arguments.length; o++) { const r = arguments[o]; if (r != null) for (const i in r) Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]); } return n; } function Gn(e) { for (const t of e) switch (t.trigger) { case "pageLoad": mt(t); break; case "scrollInView": Qn(t); break; } } function ut(e) { console.warn(`Cannot animate element: element with ID ${e} not found!`); } function pt(e, t) { const n = Jn(e), o = getComputedStyle(t), r = e.steps[0].styles, i = e.steps[e.steps.length - 1].styles, s = [r, i]; for (const a of s) for (const l of n) l in a || (a[l] = o[l]); } function Jn(e) { const t = []; for (const n of e.steps) for (const o in n.styles) t.indexOf(o) === -1 && t.push(o); return t; } function mt(e) { const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || "")); if (!t.length) { ut(e.elementId || e.id || ""); return; } Array.from(t).forEach((n) => { pt(e, n), n.style.transition = "none", n.style.transitionDelay = "0", _(n.style, e.steps[0].styles), setTimeout(() => { n.style.transition = `all ${e.duration}s ${Pe(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s"), _(n.style, e.steps[1].styles), setTimeout(() => { n.style.transition = "", n.style.transitionDelay = ""; }, (e.delay || 0) * 1e3 + e.duration * 1e3 + 100); }); }); } function Qn(e) { const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || "")); if (!t.length) { ut(e.elementId || e.id || ""); return; } Array.from(t).forEach((n) => { pt(e, n); let o = !1, r = !1; function i() { !o && a(n) ? (o = !0, r = !0, setTimeout(() => { _(n.style, e.steps[1].styles), e.repeat || document.removeEventListener("scroll", s), setTimeout(() => { r = !1, e.repeat || (n.style.transition = "", n.style.transitionDelay = ""); }, (e.duration + (e.delay || 0)) * 1e3 + 100); })) : e.repeat && o && !r && !a(n) && (o = !1, _(n.style, e.steps[0].styles)); } const s = zn(i, 200, { leading: !1 }); function a(p) { const f = p.getBoundingClientRect(), c = window.innerHeight, b = (e.thresholdPercent || 0) / 100 * c; return f.bottom > b && f.top < c - b; } const l = e.steps[0].styles; function u() { _(n.style, l); } u(), setTimeout(() => { n.style.transition = `all ${e.duration}s ${Pe(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s"); }), document.addEventListener("scroll", s, { capture: !0, passive: !0 }), i(); }); } const ht = (e) => Object.entries(e).map(([n, o]) => { if (typeof o == "string") return `${Pe(n)}: ${o};`; }).filter(K), Yn = (e) => ht(e).join(` `), Cs = ({ mediaQuery: e, className: t, styles: n }) => { const o = `.${t} { ${Yn(n)} }`; return e ? `${e} { ${o} }` : o; }; function Xn({ style: e }) { return e; } const Ts = ({ block: e, context: t }) => ft(Xn({ style: e.style || {}, context: t, block: e })); function ft(e) { switch ($) { case "svelte": case "vue": case "solid": case "angular": return ht(e).join(" "); case "qwik": case "reactNative": case "react": case "rsc": return e; } } const bt = (e, t) => e ? t ? e.models && e.models.length > 0 && !e.models.includes(t) : !1 : !0, Zn = ({ block: e, registeredComponents: t, model: n }) => { var i; const o = (i = e.component) == null ? void 0 : i.name; if (!o) return null; const r = t[o]; if (!r || bt(r, n)) { console.warn(` Could not find a registered component named "${o}". If you registered it, is the file that registered it imported by the file that needs to render it?`); return; } else return r; }, _n = ({ block: e, context: t }) => { const { repeat: n, ...o } = e; if (!(n != null && n.collection)) return; const r = te({ code: n.collection, localState: t.localState, rootState: t.rootState, rootSetState: t.rootSetState, context: t.context }); if (!Array.isArray(r)) return; const i = n.collection.split(".").pop(), s = n.itemName || (i ? i + "Item" : "item"); return r.map((l, u) => ({ context: { ...t, localState: { ...t.localState, $index: u, $item: l, [s]: l, [`$${s}Index`]: u } }, block: o })); }, eo = (e, t) => { var n; return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderLinkComponent ? { builderLinkComponent: t } : {}; }, to = (e, t, n) => { var o; return (o = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && o.builderComponents ? { builderComponents: Object.fromEntries(Object.entries(t).filter(([i, s]) => !bt(s, n))) } : {}; }, no = (e, t) => { var n; return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderBlock ? { builderBlock: t } : {}; }, oo = (e, t) => { var n; return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderContext ? { builderContext: t } : {}; }, ro = (e) => e.toString(), io = () => Promise.resolve().then(() => So).then((e) => e.default).catch((e) => { throw console.error( "Error while attempting to dynamically import component DynamicDiv at ../dynamic-div.vue", e ), e; }), so = () => import("./block-styles-8zkB2lOv.js").then((e) => e.default).catch((e) => { throw console.error( "Error while attempting to dynamically import component BlockStyles at ./components/block-styles.vue", e ), e; }), ao = () => import("./block-wrapper-YFKoP-Sr.js").then((e) => e.default).catch((e) => { throw console.error( "Error while attempting to dynamically import component BlockWrapper at ./components/block-wrapper.vue", e ), e; }), lo = () => import("./component-ref-CL-UB2rM.js").then((e) => e.default).catch((e) => { throw console.error( "Error while attempting to dynamically import component ComponentRef at ./components/component-ref/component-ref.vue", e ), e; }), co = () => import("./repeated-block-dhWJ0p4C.js").then((e) => e.default).catch((e) => { throw console.error( "Error while attempting to dynamically import component RepeatedBlock at ./components/repeated-block.vue", e ), e; }), uo = y({ name: "block", components: { BlockStyles: X(so), RepeatedBlock: X(co), ComponentRef: X(lo), BlockWrapper: X(ao), DynamicDiv: X(io) }, props: ["block", "context", "registeredComponents", "linkComponent"], data() { return { _processedBlock: { value: null, update: !1 }, generateKey: ro }; }, mounted() { const e = this.processedBlock.id, t = this.processedBlock.animations; t && e && Gn( t.map((n) => ({ ...n, elementId: e })) ); }, updated() { }, computed: { repeatItem() { return _n({ block: this.block, context: this.context }); }, processedBlock() { var t; return (t = this.block.repeat) != null && t.collection ? this.block : an({ block: this.block, localState: this.context.localState, rootState: this.context.rootState, rootSetState: this.context.rootSetState, context: this.context.context }); }, blockComponent() { return Zn({ block: this.processedBlock, registeredComponents: this.registeredComponents, model: this.context.model }); }, Tag() { var t; return this.block.tagName === "a" || ((t = this.processedBlock.properties) == null ? void 0 : t.href) || this.processedBlock.href ? this.linkComponent || "a" : this.block.tagName || "div"; }, canShowBlock() { var n, o; if ((n = this.block.repeat) != null && n.collection) return !!((o = this.repeatItem) != null && o.length); const e = "hide" in this.processedBlock ? this.processedBlock.hide : !1; return ("show" in this.processedBlock ? this.processedBlock.show : !0) && !e; }, childrenWithoutParentComponent() { var t; return !((t = this.blockComponent) != null && t.component) && !this.repeatItem ? this.processedBlock.children ?? [] : []; }, componentRefProps() { var e, t, n; return { blockChildren: this.processedBlock.children ?? [], componentRef: (e = this.blockComponent) == null ? void 0 : e.component, componentOptions: { ...Xt(this.processedBlock, this.context), ...no(this.blockComponent, this.processedBlock), ...oo(this.blockComponent, this.context), ...eo(this.blockComponent, this.linkComponent), ...to( this.blockComponent, this.registeredComponents, this.context.model ) }, context: this.context, linkComponent: this.linkComponent, registeredComponents: this.registeredComponents, builderBlock: this.processedBlock, includeBlockProps: ((t = this.blockComponent) == null ? void 0 : t.noWrap) === !0, isInteractive: !((n = this.blockComponent) != null && n.isRSC && $ === "rsc") }; } } }); function po(e, t, n, o, r, i) { var f; const s = k("BlockStyles"), a = k("ComponentRef"), l = k("Block", !0), u = k("BlockWrapper"), p = k("RepeatedBlock"); return e.canShowBlock ? (d(), h(I, { key: 0 }, [ E(s, { block: e.processedBlock, context: e.context }, null, 8, ["block", "context"]), (f = e.blockComponent) != null && f.noWrap ? (d(), h(I, { key: 1 }, [ e.repeatItem ? (d(!0), h(I, { key: 1 }, L(e.repeatItem, (c, m) => (d(), S(p, { key: e.generateKey(m), repeatContext: c.context, block: c.block, registeredComponents: e.registeredComponents, linkComponent: e.linkComponent }, null, 8, ["repeatContext", "block", "registeredComponents", "linkComponent"]))), 128)) : (d(), S(a, { key: 0, componentRef: e.componentRefProps.componentRef, componentOptions: e.componentRefProps.componentOptions, blockChildren: e.componentRefProps.blockChildren, context: e.componentRefProps.context, registeredComponents: e.componentRefProps.registeredComponents, linkComponent: e.componentRefProps.linkComponent, builderBlock: e.componentRefProps.builderBlock, includeBlockProps: e.componentRefProps.includeBlockProps, isInteractive: e.componentRefProps.isInteractive }, null, 8, ["componentRef", "componentOptions", "blockChildren", "context", "registeredComponents", "linkComponent", "builderBlock", "includeBlockProps", "isInteractive"])) ], 64)) : (d(), h(I, { key: 0 }, [ e.repeatItem ? (d(!0), h(I, { key: 1 }, L(e.repeatItem, (c, m) => (d(), S(p, { key: e.generateKey(m), repeatContext: c.context, block: c.block, registeredComponents: e.registeredComponents, linkComponent: e.linkComponent }, null, 8, ["repeatContext", "block", "registeredComponents", "linkComponent"]))), 128)) : (d(), S(u, { key: 0, Wrapper: e.Tag, block: e.processedBlock, context: e.context }, { default: U(() => [ E(a, { componentRef: e.componentRefProps.componentRef, componentOptions: e.componentRefProps.componentOptions, blockChildren: e.componentRefProps.blockChildren, context: e.componentRefProps.context, registeredComponents: e.componentRefProps.registeredComponents, linkComponent: e.componentRefProps.linkComponent, builderBlock: e.componentRefProps.builderBlock, includeBlockProps: e.componentRefProps.includeBlockProps, isInteractive: e.componentRefProps.isInteractive }, null, 8, ["componentRef", "componentOptions", "blockChildren", "context", "registeredComponents", "linkComponent", "builderBlock", "includeBlockProps", "isInteractive"]), (d(!0), h(I, null, L(e.childrenWithoutParentComponent, (c, m) => (d(), S(l, { key: c.id, block: c, registeredComponents: e.registeredComponents, linkComponent: e.linkComponent, context: e.context }, null, 8, ["block", "registeredComponents", "linkComponent", "context"]))), 128)) ]), _: 1 }, 8, ["Wrapper", "block", "context"])) ], 64)) ], 64)) : C("", !0); } const gt = /* @__PURE__ */ v(uo, [["render", po]]), Is = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: gt }, Symbol.toStringTag, { value: "Module" })), mo = y({ name: "builder-blocks-wrapper", props: [ "blocks", "classNameProp", "path", "parent", "styleProp", "BlocksWrapperProps", "BlocksWrapper" ], data() { return { shouldUpdate: !1 }; }, mounted() { }, watch: { onUpdateHook0: { handler() { }, immediate: !0 } }, computed: { className() { var e; return [ "builder-blocks", (e = this.blocks) != null && e.length ? "" : "no-blocks", this.classNameProp ].filter(Boolean).join(" "); }, dataPath() { if (!this.path) return; const e = "this.", t = "component.options."; return this.path.startsWith(e) ? this.path.replace(e, "") : this.path.startsWith(t) ? this.path : `${t}${this.path || ""}`; }, onUpdateHook0() { return { 0: this.blocks }; } }, methods: { onClick() { var e, t; P() && !((e = this.blocks) != null && e.length) && ((t = window.parent) == null || t.postMessage( { type: "builder.clickEmptyBlocks", data: { parentElementId: this.parent, dataPath: this.dataPath } }, "*" )); }, onMouseEnter() { var e, t; P() && !((e = this.blocks) != null && e.length) && ((t = window.parent) == null || t.postMessage( { type: "builder.hoverEmptyBlocks", data: { parentElementId: this.parent, dataPath: this.dataPath } }, "*" )); } } }); function ho(e, t, n, o, r, i) { return d(), S(Z(e.BlocksWrapper), w({ ref: "blocksWrapperRef", class: e.className + " component-tqyw9m0iue", "builder-path": e.dataPath, "builder-parent-id": e.parent, style: e.styleProp, onClick: (s) => e.onClick(), onMouseEnter: (s) => e.onMouseEnter(), onKeyPress: (s) => e.onClick() }, { ...e.BlocksWrapperProps }), { default: U(() => [ V(e.$slots, "default", {}, void 0, !0) ]), _: 3 }, 16, ["class", "builder-path", "builder-parent-id", "style", "onClick", "onMouseEnter", "onKeyPress"]); } const fo = /* @__PURE__ */ v(mo, [["render", ho], ["__scopeId", "data-v-161c6b74"]]), bo = y({ name: "builder-blocks", components: { BlocksWrapper: fo, Block: gt }, props: [ "blocks", "parent", "path", "styleProp", "BlocksWrapperProps", "context", "className", "linkComponent", "registeredComponents" ], inject: { builderContext: be.key, componentsContext: Ge.key } }); function go(e, t, n, o, r, i) { var l, u, p, f; const s = k("Block"), a = k("BlocksWrapper"); return d(), S(a, { blocks: e.blocks, parent: e.parent, path: e.path, styleProp: e.styleProp, BlocksWrapperProps: e.BlocksWrapperProps || ((l = e.context) == null ? void 0 : l.BlocksWrapperProps) || ((u = e.builderContext) == null ? void 0 : u.BlocksWrapperProps), classNameProp: e.className, BlocksWrapper: ((p = e.context) == null ? void 0 : p.BlocksWrapper) || ((f = e.builderContext) == null ? void 0 : f.BlocksWrapper) }, { default: U(() => [ V(e.$slots, "default"), e.blocks ? (d(!0), h(I, { key: 0 }, L(e.blocks, (c, m) => { var b; return d(), S(s, { key: c.id, block: c, linkComponent: e.linkComponent, context: e.context || e.builderContext, registeredComponents: e.registeredComponents || ((b = e.componentsContext) == null ? void 0 : b.registeredComponents) }, null, 8, ["block", "linkComponent", "context", "registeredComponents"]); }), 128)) : C("", !0) ]), _: 3 }, 8, ["blocks", "parent", "path", "styleProp", "BlocksWrapperProps", "classNameProp", "BlocksWrapper"]); } const q = /* @__PURE__ */ v(bo, [["render", go]]), yo = y({ name: "dynamic-div", props: [] }); function vo(e, t, n, o, r, i) { return d(), h("div", null, [ V(e.$slots, "default") ]); } const ne = /* @__PURE__ */ v(yo, [["render", vo]]), So = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: ne }, Symbol.toStringTag, { value: "Module" })), ue = y({ render() { return Ke("style", { innerHTML: this.styles, "data-id": this.id, nonce: this.nonce }); }, name: "inlined-styles", props: ["styles", "id", "nonce"] }), yt = { xsmall: { min: 0, default: 160, max: 320 }, small: { min: 321, default: 321, max: 640 }, medium: { min: 641, default: 642, max: 991 }, large: { min: 990, default: 991, max: 1200 } }, ws = (e, t = yt) => `@media (max-width: ${t[e].max}px)`, ko = (e) => { const t = ke(yt); if (!e) return t; const { xsmall: n, small: o, medium: r } = e; if (n) { const l = Math.floor(n / 2); t.xsmall = { max: n, min: l, default: l + 1 }; } if (!o || !r) return t; const i = n ? t.xsmall.max + 1 : Math.floor(o / 2); t.small = { max: o, min: i, default: i + 1 }; const s = t.small.max + 1; t.medium = { max: r, min: s, default: s + 1 }; const a = t.medium.max + 1; return t.large = { max: 2e3, // TODO: decide upper limit min: a, default: a + 1 }, t; }, Co = (e) => `builder-columns ${e}-breakpoints`, To = y({ name: "builder-columns", components: { InlinedStyles: ue, DynamicRenderer: Ce, Blocks: q, DynamicDiv: ne }, props: [ "space", "columns", "stackColumnsAt", "builderLinkComponent", "reverseColumnsWhenStacked", "builderContext", "builderBlock", "builderComponents" ], data() { return { TARGET: $, getColumnsClass: Co }; }, computed: { gutterSize() { return typeof this.space == "number" ? this.space || 0 : 20; }, cols() { return this.columns || []; }, stackAt() { return this.stackColumnsAt || "tablet"; }, flexDir() { return this.stackColumnsAt === "never" ? "row" : this.reverseColumnsWhenStacked ? "column-reverse" : "column"; } }, methods: { getTagName(e) { return e.link ? this.builderLinkComponent || "a" : "div"; }, getWidth(e) { var t; return ((t = this.cols[e]) == null ? void 0 : t.width) || 100 / this.cols.length; }, getColumnCssWidth(e) { const t = this.getWidth(e), n = this.gutterSize * (this.cols.length - 1) * (t / 100); return `calc(${t}% - ${n}px)`; }, getTabletStyle({ stackedStyle: e, desktopStyle: t }) { return this.stackAt === "tablet" ? e : t; }, getMobileStyle({ stackedStyle: e, desktopStyle: t }) { return this.stackAt === "never" ? t : e; }, columnsCssVars() { return { "--flex-dir": this.flexDir, "--flex-dir-tablet": this.getTabletStyle({ stackedStyle: this.flexDir, desktopStyle: "row" }) }; }, columnCssVars(e) { const t = e === 0 ? 0 : this.gutterSize, n = this.getColumnCssWidth(e), o = `${t}px`, r = "100%", i = 0; return { ...{ display: "flex", flexDirection: "column", alignItems: "stretch" }, width: n, ["margin-left"]: o, "--column-width-mobile": this.getMobileStyle({ stackedStyle: r, desktopStyle: n }), "--column-margin-left-mobile": this.getMobileStyle({ stackedStyle: i, desktopStyle: o }), "--column-width-tablet": this.getTabletStyle({ stackedStyle: r, desktopStyle: n }), "--column-margin-left-tablet": this.getTabletStyle({ stackedStyle: i, desktopStyle: o }) }; }, getWidthForBreakpointSize(e) { var n, o; return ko( ((o = (n = this.builderContext.content) == null ? void 0 : n.meta) == null ? void 0 : o.breakpoints) || {} )[e].max; }, columnsStyles() { const e = `.${this.builderBlock.id}-breakpoints > .builder-column`; return ` @media (max-width: ${this.getWidthForBreakpointSize("medium")}px) { .${this.builderBlock.id}-breakpoints { flex-direction: var(--flex-dir-tablet); align-items: stretch; } ${e} { width: var(--column-width-tablet) !important; margin-left: var(--column-margin-left-tablet) !important; } } @media (max-width: ${this.getWidthForBreakpointSize("small")}px) { .${this.builderBlock.id}-breakpoints { flex-direction: var(--flex-dir); align-items: stretch; } ${e} { width: var(--column-width-mobile) !important; margin-left: var(--column-margin-left-mobile) !important; } }, `; }, getAttributes(e, t) { return { ...e.link ? { href: e.link } : {}, [G()]: "builder-column", style: ft(this.columnCssVars(t)) }; } } }); function Io(e, t, n, o, r, i) { var u; const s = k("InlinedStyles"), a = k("Blocks"), l = k("DynamicRenderer"); return d(), h("div", w({ class: e.getColumnsClass((u = e.builderBlock) == null ? void 0 : u.id) + " div-4wbls88y960", style: e.columnsCssVars() }, {}), [ e.TARGET !== "reactNative" ? (d(), S(s, { key: 0, id: "builderio-columns", styles: e.columnsStyles(), nonce: e.builderContext.nonce }, null, 8, ["styles", "nonce"])) : C("", !0), (d(!0), h(I, null, L(e.columns, (p, f) => (d(), S(l, { key: f, TagName: e.getTagName(p), actionAttributes: {}, attributes: e.getAttributes(p, f) }, { default: U(() => [ E(a, { path: `columns.${f}.blocks`, parent: e.builderBlock.id, context: e.builderContext, registeredComponents: e.builderComponents, linkComponent: e.builderLinkComponent, blocks: p.blocks, styleProp: { flexGrow: "1" } }, null, 8, ["path", "parent", "context", "registeredComponent