@builder.io/sdk-vue
Version:
Builder.io SDK for Vue
1,809 lines (1,806 loc) • 141 kB
JavaScript
import { defineComponent as b, openBlock as c, createElementBlock as p, Fragment as w, createBlock as y, resolveDynamicComponent as j, mergeProps as C, toHandlers as B, withCtx as N, renderSlot as x, resolveComponent as k, createTextVNode as bt, toDisplayString as te, defineAsyncComponent as M, createVNode as $, renderList as V, createCommentVNode as v, h as Ae, createElementVNode as q, normalizeStyle as O, normalizeClass as z, markRaw as gt } from "vue";
import { T as E, g as yt, f as kt, i as R, s as vt, r as St, p as Ct, a as Tt, l as A, b as Ve, c as pe, d as wt, n as We, e as L, h as P, j as It } from "./should-force-browser-runtime-in-node-ikxWrCvn.js";
const $t = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), Rt = (e) => typeof e == "string" && $t.has(e.toLowerCase());
function W(e = {}, t, n) {
const o = {};
for (const r in e) {
if (!e[r] || n && !r.startsWith(t))
continue;
const s = n ? r.replace(t, "") : r;
o[s] = e[r];
}
return o;
}
const Et = b({
name: "dynamic-renderer",
props: ["TagName", "attributes", "actionAttributes"],
data() {
return { isEmptyElement: Rt };
}
}), g = (e, t) => {
const n = e.__vccOpts || e;
for (const [o, r] of t)
n[o] = r;
return n;
};
function Pt(e, t, n, o, r, s) {
return e.isEmptyElement(e.TagName) ? (c(), y(j(e.TagName), C({ key: 1 }, e.attributes, B(e.actionAttributes)), null, 16)) : (c(), p(w, { key: 0 }, [
typeof e.TagName == "string" ? (c(), y(j(e.TagName), C({ key: 0 }, e.attributes, B(e.actionAttributes)), {
default: N(() => [
x(e.$slots, "default")
]),
_: 3
}, 16)) : (c(), y(j(e.TagName), C({ key: 1 }, e.attributes, B(e.actionAttributes)), {
default: N(() => [
x(e.$slots, "default")
]),
_: 3
}, 16))
], 64));
}
const me = /* @__PURE__ */ g(Et, [["render", Pt]]), Us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: me
}, Symbol.toStringTag, { value: "Module" })), Z = () => {
switch (E) {
case "react":
case "reactNative":
case "rsc":
return "className";
case "svelte":
case "vue":
case "solid":
case "qwik":
case "angular":
return "class";
}
}, Bt = b({
name: "builder-button",
components: { DynamicRenderer: me },
props: [
"attributes",
"link",
"openLinkInNewTab",
"builderLinkComponent",
"text"
],
data() {
return { filterAttrs: W };
},
methods: {
attrs() {
return {
...W(this.attributes, "v-on:", !1),
[Z()]: `${this.link ? "" : "builder-button"} ${this.attributes[Z()] || ""}`,
...this.link ? {
href: this.link,
target: this.openLinkInNewTab ? "_blank" : void 0,
role: "link"
} : {
role: "button"
}
};
}
}
});
function xt(e, t, n, o, r, s) {
const i = k("DynamicRenderer");
return c(), y(i, {
attributes: e.attrs(),
TagName: e.link ? e.builderLinkComponent || "a" : "button",
actionAttributes: e.filterAttrs(e.attributes, "v-on:", !0)
}, {
default: N(() => [
bt(te(e.text), 1)
]),
_: 1
}, 8, ["attributes", "TagName", "actionAttributes"]);
}
const At = /* @__PURE__ */ g(Bt, [["render", xt]]), Vt = Symbol(), le = {
Builder: {
content: null,
context: {},
localState: void 0,
rootSetState() {
},
rootState: {},
apiKey: null,
apiVersion: void 0,
componentInfos: {},
inheritedStyles: {},
BlocksWrapper: "div",
BlocksWrapperProps: {},
nonce: "",
model: ""
},
key: Vt
}, Wt = Symbol(), Ne = {
Components: { registeredComponents: {} },
key: Wt
};
function Nt(e) {
var t;
return {
...(t = e.component) == null ? void 0 : t.options,
...e.options
};
}
function Ft(e, ...t) {
const n = Object.assign({}, e);
for (const o of t)
delete n[o];
return n;
}
const Fe = (e, t, n) => {
const o = String.prototype.split.call(t, /[,[\].]+?/).filter(Boolean).reduce((r, s) => r != null ? r[s] : r, e);
return o === void 0 || o === e ? n : o;
}, Ot = ({
code: e,
builder: t,
context: n,
event: o,
localState: r,
rootSetState: s,
rootState: i
}) => {
const l = yt({
builder: t,
context: n,
event: o,
state: kt({
rootState: i,
localState: r,
rootSetState: s
})
});
return new Function(...l.map(([a]) => a), e)(...l.map(([, a]) => a));
}, Dt = (e) => R() || vt({
shouldLogWarning: !0
}) ? Ot(e) : St(e), Lt = /^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/, Ut = /(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/, Ht = (e) => {
var t, n, o, r, s, i;
return ((o = (n = (t = Lt.exec(e.trim())) == null ? void 0 : t.groups) == null ? void 0 : n.getPath) == null ? void 0 : o.slice(1)) || ((i = (s = (r = Ut.exec(e.trim())) == null ? void 0 : r.groups) == null ? void 0 : s.getPath) == null ? void 0 : i.slice(1));
};
function J({
code: e,
context: t,
localState: n,
rootState: o,
rootSetState: r,
event: s,
isExpression: i = !0
}) {
if (e.trim() === "")
return;
const l = Ht(e.trim());
if (l)
return Fe({
...o,
...n
}, l);
const a = {
code: Ct(e, {
isExpression: i
}),
builder: Tt(),
context: t,
event: s,
rootSetState: r,
rootState: o,
localState: n
};
try {
return Dt(a);
} catch (u) {
A.error("Failed code evaluation: " + u.message, {
code: e
});
return;
}
}
function _(e, t, n = null, o = null, r = /* @__PURE__ */ new WeakSet()) {
if (e == null || typeof e != "object") {
t(e, (s) => {
n !== null && o !== null && (n[o] = s);
});
return;
}
r.has(e) || (r.add(e), Array.isArray(e) ? e.forEach((s, i) => {
t(s, (a) => {
e[i] = a;
}), _(s, t, e, i, r);
}) : Object.entries(e).forEach(([s, i]) => {
t(i, (a) => {
e[s] = a;
}), _(i, t, e, s, r);
}));
}
function Oe(e) {
return e && typeof e == "object" && e["@type"] === "@builder.io/core:LocalizedValue";
}
function Mt(e) {
if (!e || !Object.getOwnPropertyNames(e).length)
return !1;
let t = !1;
return _(e, (n) => {
if (Oe(n)) {
t = !0;
return;
}
}), t;
}
function jt(e, t) {
return !e || !Object.getOwnPropertyNames(e).length ? {} : (_(e, (n, o) => {
Oe(n) && o(n[t] ?? void 0);
}), e);
}
function Kt(e, t) {
var n, o;
return (n = e.component) != null && n.options && Mt((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 = jt(e.component.options, t ?? "Default")), e;
}
function ce(e) {
if (e === null || typeof e != "object")
return e;
if (Array.isArray(e))
return e.map((n) => ce(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] = ce(e[n]));
return t;
}
const qt = ["svelte", "vue", "angular", "qwik", "solid"].includes(E), zt = (e) => {
if (qt) {
const t = pe(e);
return {
...t,
properties: {
...t.properties
},
actions: {
...t.actions
}
};
} else {
const t = ce(Ft(e, "children", "meta"));
return {
...t,
properties: {
...t.properties
},
actions: {
...t.actions
},
children: e.children,
meta: e.meta
};
}
}, Gt = ({
block: e,
context: t,
localState: n,
rootState: o,
rootSetState: r
}) => {
if (!e.bindings)
return e;
const s = zt(e);
for (const i in e.bindings) {
const l = e.bindings[i], a = J({
code: l,
localState: n,
rootState: o,
rootSetState: r,
context: t
});
Ve(s, i, a);
}
return s;
};
function Jt({
block: e,
context: t,
shouldEvaluateBindings: n,
localState: o,
rootState: r,
rootSetState: s
}) {
let i = Kt(e, r.locale);
return i = i, n ? Gt({
block: i,
localState: o,
rootState: r,
rootSetState: s,
context: t
}) : i;
}
function De(e) {
const t = e || (R() ? window.location.search : void 0);
return t ? wt(t).indexOf("builder.preview=") !== -1 : !1;
}
const Yt = (e) => ({
type: "builder.registerComponent",
data: ee(e)
}), Xt = (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 ee(e) {
return JSON.parse(JSON.stringify(e, (t, n) => typeof n == "function" ? Xt(n) : n));
}
const Te = {};
function Qt(e, t) {
e === "plugin" && (t = ee(t));
let n = Te[e];
if (n || (n = Te[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);
}
}
}
const we = {};
function Hs(e) {
if (R()) {
Object.assign(we, e);
const t = {
type: "builder.settingsChange",
data: we
};
parent.postMessage(t, "*");
}
}
const Ie = "builder.", Zt = "options.", Le = (e) => {
if (!e)
return {};
const t = We(e), n = {};
return Object.keys(t).forEach((o) => {
if (o.startsWith(Ie)) {
const r = o.replace(Ie, "").replace(Zt, "");
n[r] = t[o];
}
}), n;
}, _t = () => {
if (!R())
return {};
const e = new URLSearchParams(window.location.search);
return Le(e);
}, Ue = "3.0.1", He = () => ({
"X-Builder-SDK": E,
"X-Builder-SDK-GEN": "2",
"X-Builder-SDK-Version": Ue
}), en = (e) => {
if (e === "localhost" || e === "127.0.0.1")
return e;
const t = e.split(".");
return t.length > 2 ? t.slice(1).join(".") : e;
}, Me = ({
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) {
A.warn("[COOKIE] GET error: ", (o == null ? void 0 : o.message) || o);
return;
}
}, je = async (e) => Me(e), tn = (e) => e.map(([t, n]) => n ? `${t}=${n}` : t).filter(L).join("; "), nn = [["secure", ""], ["SameSite", "None"]], on = ({
name: e,
value: t,
expires: n
}) => {
const r = (R() ? location.protocol === "https:" : !0) ? nn : [[]], s = n ? [["expires", n.toUTCString()]] : [[]], i = [[e, t], ...s, ["path", "/"], ["domain", en(window.location.hostname)], ...r];
return tn(i);
}, Ke = async ({
name: e,
value: t,
expires: n,
canTrack: o
}) => {
try {
if (!o)
return;
const r = on({
name: e,
value: t,
expires: n
});
document.cookie = r;
} catch (r) {
A.warn("[COOKIE] SET error: ", (r == null ? void 0 : r.message) || r);
}
};
function rn() {
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 qe() {
return rn().replace(/-/g, "");
}
const ze = "builderSessionId", sn = async ({
canTrack: e
}) => {
if (!e)
return;
const t = await je({
name: ze,
canTrack: e
});
if (L(t))
return t;
{
const n = an();
return ln({
id: n,
canTrack: e
}), n;
}
}, an = () => qe(), ln = ({
id: e,
canTrack: t
}) => Ke({
name: ze,
value: e,
canTrack: t
}), Ge = () => R() && typeof localStorage < "u" ? localStorage : void 0, cn = ({
key: e,
canTrack: t
}) => {
var n;
try {
return t ? (n = Ge()) == null ? void 0 : n.getItem(e) : void 0;
} catch (o) {
console.debug("[LocalStorage] GET error: ", o);
return;
}
}, dn = ({
key: e,
canTrack: t,
value: n
}) => {
var o;
try {
t && ((o = Ge()) == null || o.setItem(e, n));
} catch (r) {
console.debug("[LocalStorage] SET error: ", r);
}
}, Je = "builderVisitorId", un = ({
canTrack: e
}) => {
if (!e)
return;
const t = cn({
key: Je,
canTrack: e
});
if (L(t))
return t;
{
const n = pn();
return mn({
id: n,
canTrack: e
}), n;
}
}, pn = () => qe(), mn = ({
id: e,
canTrack: t
}) => dn({
key: Je,
value: e,
canTrack: t
});
function he(e) {
var t;
typeof process < "u" && ((t = process.env) != null && t.DEBUG) && String(process.env.DEBUG) == "true" && A.log(e);
}
const hn = async ({
canTrack: e
}) => {
if (!e)
return {
visitorId: void 0,
sessionId: void 0
};
const t = await sn({
canTrack: e
}), n = un({
canTrack: e
});
return {
sessionId: t,
visitorId: n
};
}, fn = async ({
type: e,
canTrack: t,
apiKey: n,
metadata: o,
...r
}) => ({
type: e,
data: {
...r,
metadata: {
url: location.href,
...o
},
...await hn({
canTrack: t
}),
userAttributes: It(),
ownerId: n
}
});
async function de({
apiHost: e,
...t
}) {
if (!t.apiKey) {
A.error("Missing API key for track call. Please provide your API key.");
return;
}
if (!t.canTrack || P() || !(R() || E === "reactNative"))
return;
const o = `${e || "https://cdn.builder.io"}/api/v1/track`;
return he(o), fetch(o, {
method: "POST",
body: JSON.stringify({
events: [await fn(t)]
}),
headers: {
"content-type": "application/json",
...He()
},
mode: "cors"
}).catch((r) => {
console.error("Failed to track: ", r);
});
}
const Ms = (e) => de({
...e,
canTrack: !0
}), bn = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
function Ye(e, t) {
if (!t.origin.startsWith("http") && !t.origin.startsWith("https"))
return !1;
const n = new URL(t.origin), o = n.hostname;
return (e || bn).findIndex((r) => r.startsWith("*.") ? o.endsWith(r.slice(1)) : r === o) > -1;
}
const gn = () => {
Qt("insertMenu", {
name: "_default",
default: !0,
items: [{
name: "Box"
}, {
name: "Text"
}, {
name: "Image"
}, {
name: "Columns"
}, {
name: "Core:Section"
}, {
name: "Core:Button"
}, {
name: "Embed"
}, {
name: "Custom Code"
}]
});
};
let $e = !1;
const Xe = (e = {}) => {
var t, n;
$e || ($e = !0, R() && ((t = window.parent) == null || t.postMessage({
type: "builder.sdkInfo",
data: {
target: E,
version: Ue,
supportsPatchUpdates: !1,
// Supports builder-model="..." attribute which is needed to
// scope our '+ add block' button styling
supportsAddBlockScoping: !0,
supportsCustomBreakpoints: !0
}
}, "*"), (n = window.parent) == null || n.postMessage({
type: "builder.updateContent",
data: {
options: e
}
}, "*"), window.addEventListener("message", (o) => {
var s, i;
if (!Ye(e.trustedHosts, o))
return;
const {
data: r
} = o;
if (r != null && r.type)
switch (r.type) {
case "builder.evaluate": {
const l = r.data.text, a = r.data.arguments || [], u = r.data.id, m = new Function(l);
let h, d = null;
try {
h = m.apply(null, a);
} catch (f) {
d = f;
}
d ? (s = window.parent) == null || s.postMessage({
type: "builder.evaluateError",
data: {
id: u,
error: d.message
}
}, "*") : h && typeof h.then == "function" ? h.then((f) => {
var S;
(S = window.parent) == null || S.postMessage({
type: "builder.evaluateResult",
data: {
id: u,
result: f
}
}, "*");
}).catch(console.error) : (i = window.parent) == null || i.postMessage({
type: "builder.evaluateResult",
data: {
result: h,
id: u
}
}, "*");
break;
}
}
})));
}, Qe = ({
model: e,
trustedHosts: t,
callbacks: n
}) => (o) => {
if (!Ye(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.contentUpdate": {
const s = r.data, i = s.key || s.alias || s.entry || s.modelName, l = s.data;
i === e && n.contentUpdate(l);
break;
}
}
}, js = (e, t, n) => {
if (!R)
return A.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
};
Xe();
const o = Qe({
callbacks: {
contentUpdate: t,
animation: () => {
},
configureSdk: () => {
}
},
model: e,
trustedHosts: n == null ? void 0 : n.trustedHosts
});
return window.addEventListener("message", o), () => {
window.removeEventListener("message", o);
};
}, yn = "builder.tests", fe = (e) => `${yn}.${e}`, kn = ({
contentId: e
}) => je({
name: fe(e),
canTrack: !0
}), vn = ({
contentId: e
}) => Me({
name: fe(e),
canTrack: !0
}), Sn = ({
contentId: e,
value: t
}) => Ke({
name: fe(e),
value: t,
canTrack: !0
}), Ze = (e) => L(e.id) && L(e.variations) && Object.keys(e.variations).length > 0, Cn = ({
id: e,
variations: t
}) => {
var r;
let n = 0;
const o = Math.random();
for (const s in t) {
const i = (r = t[s]) == null ? void 0 : r.testRatio;
if (n += i, o < n)
return s;
}
return e;
}, _e = (e) => {
const t = Cn(e);
return Sn({
contentId: e.id,
value: t
}).catch((n) => {
A.error("could not store A/B test variation: ", n);
}), t;
}, et = ({
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" : "")
};
}, Tn = ({
item: e,
canTrack: t
}) => {
if (!t)
return e;
if (!e)
return;
if (!Ze(e))
return e;
const n = vn({
contentId: e.id
}) || _e({
variations: e.variations,
id: e.id
}), o = et({
item: e,
testGroupId: n
});
return {
...e,
...o
};
}, wn = async ({
item: e,
canTrack: t
}) => {
if (!t || !Ze(e))
return e;
const o = await kn({
contentId: e.id
}) || _e({
variations: e.variations,
id: e.id
}), r = et({
item: e,
testGroupId: o
});
return {
...e,
...r
};
}, G = (e) => L(e) ? e : !0;
function In() {
return typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : globalThis;
}
function $n() {
const e = In().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 Rn = $n();
function ue(e, t = null, n = ".") {
return Object.keys(e).reduce((o, r) => {
const s = e[r], i = [t, r].filter(Boolean).join(n);
return [typeof s == "object", s !== null, !(Array.isArray(s) && s.length === 0)].every(Boolean) ? {
...o,
...ue(s, i, n)
} : {
...o,
[i]: s
};
}, {});
}
function tt(e, t, n = {}) {
for (const o in e) {
const r = e[o], s = t ? t + "." + o : o;
r && typeof r == "object" && !Array.isArray(r) && !Object.keys(r).find((i) => i.startsWith("$")) ? tt(r, s, n) : n[s] = r;
}
return n;
}
const En = "v3", Re = (e) => typeof e == "number" && !isNaN(e) && e >= 0, be = (e) => {
const {
limit: t = 30,
userAttributes: n,
query: o,
model: r,
apiKey: s,
enrich: i,
locale: l,
apiVersion: a = En,
fields: u,
omit: m,
offset: h,
cacheSeconds: d,
staleCacheSeconds: f,
sort: S,
includeUnpublished: T,
apiHost: D
} = e;
if (!s)
throw new Error("Missing API key");
if (!["v3"].includes(a))
throw new Error(`Invalid apiVersion: expected 'v3', received '${a}'`);
const mt = t !== 1, ht = D || "https://cdn.builder.io", I = new URL(`${ht}/api/${a}/content/${r}`);
I.searchParams.set("apiKey", s), I.searchParams.set("limit", String(t)), I.searchParams.set("noTraverse", String(mt)), I.searchParams.set("includeRefs", String(!0));
const ne = l || (n == null ? void 0 : n.locale);
let X = n;
if (ne && (I.searchParams.set("locale", ne), X = {
locale: ne,
...X
}), i && I.searchParams.set("enrich", String(i)), I.searchParams.set("omit", m || "meta.componentsUsed"), u && I.searchParams.set("fields", u), Number.isFinite(h) && h > -1 && I.searchParams.set("offset", String(Math.floor(h))), typeof T == "boolean" && I.searchParams.set("includeUnpublished", String(T)), d && Re(d) && I.searchParams.set("cacheSeconds", String(d)), f && Re(f) && I.searchParams.set("staleCacheSeconds", String(f)), S) {
const F = ue({
sort: S
});
for (const H in F)
I.searchParams.set(H, JSON.stringify(F[H]));
}
const ft = {
..._t(),
...We(e.options || {})
}, Ce = ue(ft);
for (const F in Ce)
I.searchParams.set(F, String(Ce[F]));
if (X && I.searchParams.set("userAttributes", JSON.stringify(X)), o) {
const F = tt({
query: o
});
for (const H in F)
I.searchParams.set(H, JSON.stringify(F[H]));
}
return I;
}, Pn = (e) => "results" in e;
async function ge(e) {
const t = await An({
...e,
limit: 1
});
return t && t[0] || null;
}
const Bn = async (e) => {
var i;
const t = be(e), n = e.fetch ?? Rn, o = {
...e.fetchOptions,
headers: {
...(i = e.fetchOptions) == null ? void 0 : i.headers,
...He()
}
};
return await (await n(t.href, o)).json();
}, xn = async (e, t, n = be(e)) => {
const o = G(e.canTrack);
if (n.search.includes("preview="), !o || !(R() || E === "reactNative"))
return t.results;
try {
const r = [];
for (const s of t.results)
r.push(await wn({
item: s,
canTrack: o
}));
t.results = r;
} catch (r) {
A.error("Could not process A/B tests. ", r);
}
return t.results;
};
async function An(e) {
const t = be(e), n = await Bn(e);
if (!Pn(n))
throw A.error("Error fetching data. ", {
url: t,
content: n,
options: e
}), n;
return xn(e, n);
}
const Ks = async (e) => {
var o, r, s;
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: Le(e.searchParams || ((s = e.url) == null ? void 0 : s.searchParams) || e.options)
};
return {
apiKey: n.apiKey,
model: n.model,
content: await ge(n)
};
}, ye = (e) => e ? e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase() : "";
function Vn(e, t, n = {}) {
let o, r, s, i = null, l = 0;
const a = function() {
l = n.leading === !1 ? 0 : Date.now(), i = null, s = e.apply(o, r), i || (o = r = null);
};
return function() {
const u = Date.now();
!l && n.leading === !1 && (l = u);
const m = t - (u - l);
return o = this, r = arguments, m <= 0 || m > t ? (i && (clearTimeout(i), i = null), l = u, s = e.apply(o, r), i || (o = r = null)) : !i && n.trailing !== !1 && (i = setTimeout(a, m)), s;
};
}
function K(e, ...t) {
const n = Object(e);
for (let o = 1; o < arguments.length; o++) {
const r = arguments[o];
if (r != null)
for (const s in r)
Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
}
return n;
}
function Wn(e) {
for (const t of e)
switch (t.trigger) {
case "pageLoad":
rt(t);
break;
case "scrollInView":
Fn(t);
break;
}
}
function nt(e) {
console.warn(`Cannot animate element: element with ID ${e} not found!`);
}
function ot(e, t) {
const n = Nn(e), o = getComputedStyle(t), r = e.steps[0].styles, s = e.steps[e.steps.length - 1].styles, i = [r, s];
for (const l of i)
for (const a of n)
a in l || (l[a] = o[a]);
}
function Nn(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 rt(e) {
const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || ""));
if (!t.length) {
nt(e.elementId || e.id || "");
return;
}
Array.from(t).forEach((n) => {
ot(e, n), n.style.transition = "none", n.style.transitionDelay = "0", K(n.style, e.steps[0].styles), setTimeout(() => {
n.style.transition = `all ${e.duration}s ${ye(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s"), K(n.style, e.steps[1].styles), setTimeout(() => {
n.style.transition = "", n.style.transitionDelay = "";
}, (e.delay || 0) * 1e3 + e.duration * 1e3 + 100);
});
});
}
function Fn(e) {
const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || ""));
if (!t.length) {
nt(e.elementId || e.id || "");
return;
}
Array.from(t).forEach((n) => {
ot(e, n);
let o = !1, r = !1;
function s() {
!o && l(n) ? (o = !0, r = !0, setTimeout(() => {
K(n.style, e.steps[1].styles), e.repeat || document.removeEventListener("scroll", i), setTimeout(() => {
r = !1, e.repeat || (n.style.transition = "", n.style.transitionDelay = "");
}, (e.duration + (e.delay || 0)) * 1e3 + 100);
})) : e.repeat && o && !r && !l(n) && (o = !1, K(n.style, e.steps[0].styles));
}
const i = Vn(s, 200, {
leading: !1
});
function l(m) {
const h = m.getBoundingClientRect(), d = window.innerHeight, S = (e.thresholdPercent || 0) / 100 * d;
return h.bottom > S && h.top < d - S;
}
const a = e.steps[0].styles;
function u() {
K(n.style, a);
}
u(), setTimeout(() => {
n.style.transition = `all ${e.duration}s ${ye(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s");
}), document.addEventListener("scroll", i, {
capture: !0,
passive: !0
}), s();
});
}
const st = (e) => Object.entries(e).map(([n, o]) => {
if (typeof o == "string")
return `${ye(n)}: ${o};`;
}).filter(L), On = (e) => st(e).join(`
`), qs = ({
mediaQuery: e,
className: t,
styles: n
}) => {
const o = `.${t} {
${On(n)}
}`;
return e ? `${e} {
${o}
}` : o;
};
function Dn({
style: e
}) {
return e;
}
const zs = ({
block: e,
context: t
}) => it(Dn({
style: e.style || {},
context: t,
block: e
}));
function it(e) {
switch (E) {
case "svelte":
case "vue":
case "solid":
case "angular":
return st(e).join(" ");
case "qwik":
case "reactNative":
case "react":
case "rsc":
return e;
}
}
const at = (e, t) => e ? t ? e.models && e.models.length > 0 && !e.models.includes(t) : !1 : !0, Ln = ({
block: e,
registeredComponents: t,
model: n
}) => {
var s;
const o = (s = e.component) == null ? void 0 : s.name;
if (!o)
return null;
const r = t[o];
if (!r || at(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;
}, Un = ({
block: e,
context: t
}) => {
const {
repeat: n,
...o
} = e;
if (!(n != null && n.collection))
return;
const r = J({
code: n.collection,
localState: t.localState,
rootState: t.rootState,
rootSetState: t.rootSetState,
context: t.context
});
if (!Array.isArray(r))
return;
const s = n.collection.split(".").pop(), i = n.itemName || (s ? s + "Item" : "item");
return r.map((a, u) => ({
context: {
...t,
localState: {
...t.localState,
$index: u,
$item: a,
[i]: a,
[`$${i}Index`]: u
}
},
block: o
}));
}, Hn = (e, t) => {
var n;
return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderLinkComponent ? {
builderLinkComponent: t
} : {};
}, Mn = (e, t, n) => {
var o;
return (o = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && o.builderComponents ? {
builderComponents: Object.fromEntries(Object.entries(t).filter(([s, i]) => !at(i, n)))
} : {};
}, jn = (e, t) => {
var n;
return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderBlock ? {
builderBlock: t
} : {};
}, Kn = (e, t) => {
var n;
return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderContext ? {
builderContext: t
} : {};
}, qn = () => 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;
}), zn = () => import("./block-styles-mnvxO4c9.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;
}), Gn = () => import("./block-wrapper-TDtFNLpV.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;
}), Jn = () => import("./component-ref-nu3ur2Zz.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;
}), Yn = () => import("./repeated-block-XwjQQ8Do.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;
}), Xn = b({
name: "block",
components: {
BlockStyles: M(zn),
RepeatedBlock: M(Yn),
ComponentRef: M(Jn),
BlockWrapper: M(Gn),
DynamicDiv: M(qn)
},
props: ["block", "context", "registeredComponents", "linkComponent"],
data() {
return {
_processedBlock: {
value: null,
update: !1
}
};
},
mounted() {
const e = this.processedBlock.id, t = this.processedBlock.animations;
t && e && Wn(
t.map((n) => ({
...n,
elementId: e
}))
);
},
updated() {
},
computed: {
repeatItem() {
return Un({
block: this.block,
context: this.context
});
},
processedBlock() {
var t;
return (t = this.block.repeat) != null && t.collection ? this.block : Jt({
block: this.block,
localState: this.context.localState,
rootState: this.context.rootState,
rootSetState: this.context.rootSetState,
context: this.context.context,
shouldEvaluateBindings: !0
});
},
blockComponent() {
return Ln({
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: {
...Nt(this.processedBlock),
...jn(this.blockComponent, this.processedBlock),
...Kn(this.blockComponent, this.context),
...Hn(this.blockComponent, this.linkComponent),
...Mn(
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 && E === "rsc")
};
}
}
});
function Qn(e, t, n, o, r, s) {
var h;
const i = k("BlockStyles"), l = k("ComponentRef"), a = k("Block", !0), u = k("BlockWrapper"), m = k("RepeatedBlock");
return e.canShowBlock ? (c(), p(w, { key: 0 }, [
$(i, {
block: e.processedBlock,
context: e.context
}, null, 8, ["block", "context"]),
(h = e.blockComponent) != null && h.noWrap ? (c(), p(w, { key: 1 }, [
e.repeatItem ? (c(!0), p(w, { key: 1 }, V(e.repeatItem, (d, f) => (c(), y(m, {
key: f,
repeatContext: d.context,
block: d.block,
registeredComponents: e.registeredComponents,
linkComponent: e.linkComponent
}, null, 8, ["repeatContext", "block", "registeredComponents", "linkComponent"]))), 128)) : (c(), y(l, {
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)) : (c(), p(w, { key: 0 }, [
e.repeatItem ? (c(!0), p(w, { key: 1 }, V(e.repeatItem, (d, f) => (c(), y(m, {
key: f,
repeatContext: d.context,
block: d.block,
registeredComponents: e.registeredComponents,
linkComponent: e.linkComponent
}, null, 8, ["repeatContext", "block", "registeredComponents", "linkComponent"]))), 128)) : (c(), y(u, {
key: 0,
Wrapper: e.Tag,
block: e.processedBlock,
context: e.context
}, {
default: N(() => [
$(l, {
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"]),
(c(!0), p(w, null, V(e.childrenWithoutParentComponent, (d, f) => (c(), y(a, {
key: d.id,
block: d,
registeredComponents: e.registeredComponents,
linkComponent: e.linkComponent,
context: e.context
}, null, 8, ["block", "registeredComponents", "linkComponent", "context"]))), 128))
]),
_: 1
}, 8, ["Wrapper", "block", "context"]))
], 64))
], 64)) : v("", !0);
}
const ke = /* @__PURE__ */ g(Xn, [["render", Qn]]), Gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: ke
}, Symbol.toStringTag, { value: "Module" })), Zn = b({
name: "builder-blocks-wrapper",
props: [
"blocks",
"classNameProp",
"path",
"parent",
"styleProp",
"BlocksWrapperProps",
"BlocksWrapper"
],
mounted() {
},
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 = "component.options.";
return this.path.startsWith(e) ? this.path : `${e}${this.path || ""}`;
}
},
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 _n(e, t, n, o, r, s) {
return c(), y(j(e.BlocksWrapper), C({
ref: "blocksWrapperRef",
class: e.className + " component-1k2igrjdg3x",
"builder-path": e.dataPath,
"builder-parent-id": e.parent,
style: e.styleProp,
onClick: (i) => e.onClick(),
onMouseEnter: (i) => e.onMouseEnter(),
onKeyPress: (i) => e.onClick()
}, { ...e.BlocksWrapperProps }), {
default: N(() => [
x(e.$slots, "default", {}, void 0, !0)
]),
_: 3
}, 16, ["class", "builder-path", "builder-parent-id", "style", "onClick", "onMouseEnter", "onKeyPress"]);
}
const eo = /* @__PURE__ */ g(Zn, [["render", _n], ["__scopeId", "data-v-ba2bc5c0"]]), to = b({
name: "builder-blocks",
components: { BlocksWrapper: eo, Block: ke },
props: [
"blocks",
"parent",
"path",
"styleProp",
"className",
"context",
"linkComponent",
"registeredComponents"
],
inject: {
builderContext: le.key,
componentsContext: Ne.key
}
});
function no(e, t, n, o, r, s) {
var a, u, m, h;
const i = k("Block"), l = k("BlocksWrapper");
return c(), y(l, {
blocks: e.blocks,
parent: e.parent,
path: e.path,
styleProp: e.styleProp,
classNameProp: e.className,
BlocksWrapper: ((a = e.context) == null ? void 0 : a.BlocksWrapper) || ((u = e.builderContext) == null ? void 0 : u.BlocksWrapper),
BlocksWrapperProps: ((m = e.context) == null ? void 0 : m.BlocksWrapperProps) || ((h = e.builderContext) == null ? void 0 : h.BlocksWrapperProps)
}, {
default: N(() => [
e.blocks ? (c(!0), p(w, { key: 0 }, V(e.blocks, (d, f) => {
var S;
return c(), y(i, {
key: d.id,
block: d,
linkComponent: e.linkComponent,
context: e.context || e.builderContext,
registeredComponents: e.registeredComponents || ((S = e.componentsContext) == null ? void 0 : S.registeredComponents)
}, null, 8, ["block", "linkComponent", "context", "registeredComponents"]);
}), 128)) : v("", !0)
]),
_: 1
}, 8, ["blocks", "parent", "path", "styleProp", "classNameProp", "BlocksWrapper", "BlocksWrapperProps"]);
}
const U = /* @__PURE__ */ g(to, [["render", no]]), oo = b({
name: "dynamic-div",
props: []
});
function ro(e, t, n, o, r, s) {
return c(), p("div", null, [
x(e.$slots, "default")
]);
}
const Y = /* @__PURE__ */ g(oo, [["render", ro]]), so = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Y
}, Symbol.toStringTag, { value: "Module" })), ve = b({
render() {
return Ae("style", {
innerHTML: this.styles,
"data-id": this.id,
nonce: this.nonce
});
},
name: "inlined-styles",
props: ["styles", "id", "nonce"]
}), lt = {
small: {
min: 320,
default: 321,
max: 640
},
medium: {
min: 641,
default: 642,
max: 991
},
large: {
min: 990,
default: 991,
max: 1200
}
}, Js = (e, t = lt) => `@media (max-width: ${t[e].max}px)`, io = ({
small: e,
medium: t
}) => {
const n = pe(lt);
if (!e || !t)
return n;
const o = Math.floor(e / 2);
n.small = {
max: e,
min: o,
default: o + 1
};
const r = n.small.max + 1;
n.medium = {
max: t,
min: r,
default: r + 1
};
const s = n.medium.max + 1;
return n.large = {
max: 2e3,
// TODO: decide upper limit
min: s,
default: s + 1
}, n;
}, ao = (e) => `builder-columns ${e}-breakpoints`, lo = b({
name: "builder-columns",
components: {
InlinedStyles: ve,
DynamicRenderer: me,
Blocks: U,
DynamicDiv: Y
},
props: [
"space",
"columns",
"stackColumnsAt",
"builderLinkComponent",
"reverseColumnsWhenStacked",
"builderContext",
"builderBlock",
"builderComponents"
],
data() {
return { TARGET: E, getColumnsClass: ao };
},
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%", s = 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: s,
desktopStyle: o
}),
"--column-width-tablet": this.getTabletStyle({
stackedStyle: r,
desktopStyle: n
}),
"--column-margin-left-tablet": this.getTabletStyle({
stackedStyle: s,
desktopStyle: o
})
};
},
getWidthForBreakpointSize(e) {
var n, o;
return io(
((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
} : {},
[Z()]: "builder-column",
style: it(this.columnCssVars(t))
};
}
}
});
function co(e, t, n, o, r, s) {
var u;
const i = k("InlinedStyles"), l = k("Blocks"), a = k("DynamicRenderer");
return c(), p("div", C({
class: e.getColumnsClass((u = e.builderBlock) == null ? void 0 : u.id) + " div-4wbls88y960",
style: e.columnsCssVars()
}, {}), [
e.TARGET !== "reactNative" ? (c(), y(i, {
key: 0,
id: "builderio-columns",
styles: e.columnsStyles(),
nonce: e.builderContext.nonce
}, null, 8, ["styles", "nonce"])) : v("", !0),
(c(!0), p(w, null, V(e.columns, (m, h) => (c(), y(a, {
key: h,
TagName: e.getTagName(m),
actionAttributes: {},
attributes: e.getAttributes(m, h)
}, {
default: N(() => [
$(l, {
path: `columns.${h}.blocks`,
parent: e.builderBlock.id,
styleProp: {
flexGrow: "1"
},
context: e.builderContext,
registeredComponents: e.builderComponents,
linkComponent: e.builderLinkComponent,
blocks: m.blocks
}, null, 8, ["path", "parent", "context", "registeredComponents", "linkComponent", "blocks"])
]),
_: 2
}, 1032, ["TagName", "attributes"]))), 128))
], 16);
}
const uo = /* @__PURE__ */ g(lo, [["render", co], ["__scopeId", "data-v-3354f136"]]), po = b({
name: "builder-fragment-component",
props: []
});
function mo(e, t, n, o, r, s) {
return c(), p("span", null, [
x(e.$slots, "default")
]);
}
const ho = /* @__PURE__ */ g(po, [["render", mo]]);
function Ee(e) {
return e.replace(/http(s)?:/, "");
}
function fo(e = "", t, n) {
const o = new RegExp("([?&])" + t + "=.*?(&|$)", "i"), r = e.indexOf("?") !== -1 ? "&" : "?";
return e.match(o) ? e.replace(o, "$1" + t + "=" + encodeURIComponent(n) + "$2") : e + r + t + "=" + encodeURIComponent(n);
}
function bo(e, t) {
if (!e || !(e != null && e.match(/cdn\.shopify\.com/)) || !t)
return e;
if (t === "master")
return Ee(e);
const n = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
if (n) {
const o = e.split(n[0]), r = n[3], s = t.match("x") ? t : `${t}x`;
return Ee(`${o[0]}_${s}${r}`);
}
return null;
}
function oe(e) {
if (!e)
return e;
const t = [100, 200, 400, 800, 1200, 1600, 2e3];
if (e.match(/builder\.io/)) {
let n = e;
const o = Number(e.split("?width=")[1]);
return isNaN(o) || (n = `${n} ${o}w`), t.filter((r) => r !== o).map((r) => `${fo(e, "width", r)} ${r}w`).concat([n]).join(", ");
}
return e.match(/cdn\.shopify\.com/) ? t.map((n) => [bo(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, o]) => `${n} ${o}w`).concat([e]).join(", ") : e;
}
const go = b({
name: "builder-image",
props: [
"image",
"src",
"srcset",
"noWebp",
"aspectRatio",
"highPriority",
"altText",
"backgroundPosition",
"backgroundSize",
"className",
"sizes",
"builderBlock",
"fitContent"
],
mounted() {
},
computed: {
srcSetToUse() {
var n;
const t = this.image || this.src;
if (!t || // We can auto add srcset for cdn.builder.io and shopify
// images, otherwise you can supply this prop manually
!(typeof t == "string" && (t.match(/builder\.io/) || t.match(/cdn\.shopify\.com/))))
return this.srcset;
if (!this.noWebp) {
if (this.srcset && ((n = this.image) != null && n.includes("builder.io/api/v1/image"))) {
if (!this.srcset.includes(this.image.split("?")[0]))
return console.debug("Removed given srcset"), oe(t);
} else if (this.image && !this.srcset)
return oe(t);
return oe(t);
}
},
webpSrcSet() {
var e;
return (e = this.srcSetToUse) != null && e.match(/builder\.io/) && !this.noWebp ? this.srcSetToUse.replace(/\?/g, "?format=webp&") : "";
},
aspectRatioCss() {
const e = {
position: "absolute",
height: "100%",
width: "100%",
left: "0px",
top: "0px"
};
return this.aspectRatio ? e : void 0;
}
}
}), yo = ["srcset"], ko = ["loading", "fetchpriority", "alt", "role", "src", "srcset", "sizes"], vo = {
key: 2,
class: "div-29wpyomtntv-2"
};
function So(e, t, n, o, r, s) {
var i, l, a, u, m, h;
return c(