@builder.io/sdk-react-nextjs 0.16.2 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/blocks-exports.cjs +24 -24
- package/lib/browser/blocks-exports.mjs +93 -92
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/init.cjs +1 -1
- package/lib/browser/init.mjs +1 -1
- package/lib/browser/server-entry-8a47b9f9.cjs +2 -0
- package/lib/browser/{server-entry-242f596f.js → server-entry-b8ecec52.js} +152 -158
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/blocks-exports.cjs +33 -33
- package/lib/edge/blocks-exports.mjs +60 -58
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/init.cjs +1 -1
- package/lib/edge/init.mjs +1 -1
- package/lib/edge/server-entry-8a47b9f9.cjs +2 -0
- package/lib/{node/server-entry-fbf4e3a9.js → edge/server-entry-b8ecec52.js} +152 -158
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/node/blocks-exports.cjs +8 -8
- package/lib/node/blocks-exports.mjs +60 -59
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +2 -2
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +2 -2
- package/lib/node/{node-runtime-e1243cd6.cjs → node-runtime-e2a21ba1.cjs} +2 -2
- package/lib/node/{node-runtime-42e494ca.js → node-runtime-ffe74dec.js} +3 -2
- package/lib/node/server-entry-8a47b9f9.cjs +2 -0
- package/lib/{edge/server-entry-242f596f.js → node/server-entry-b8ecec52.js} +152 -158
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/package.json +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/functions/register-component.d.ts +2 -2
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/functions/register-component.d.ts +2 -2
- package/lib/browser/server-entry-494604dc.cjs +0 -2
- package/lib/edge/server-entry-494604dc.cjs +0 -2
- package/lib/node/server-entry-db7b41aa.cjs +0 -2
|
@@ -3,12 +3,12 @@ var Vr = Object.defineProperty;
|
|
|
3
3
|
var _r = (e, t, n) => t in e ? Vr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
4
4
|
var Kt = (e, t, n) => (_r(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
5
5
|
import { jsx as y, Fragment as K, jsxs as se } from "react/jsx-runtime";
|
|
6
|
-
import { TARGET as it, isEditing as Ce, isBrowser as De, getUserAttributes as $r, logger as ot, checkIsDefined as yt,
|
|
7
|
-
import { useRef as
|
|
6
|
+
import { TARGET as it, isEditing as Ce, isBrowser as De, getUserAttributes as $r, logger as ot, checkIsDefined as yt, init as Hr, getDefaultCanTrack as vt, _track as Gn, isPreviewing as Kr, createEditorListener as Gr, fetch as zr, registerInsertMenu as Yr, setupBrowserForEditing as Xr, createRegisterComponentMessage as Jr, fetchOneEntry as lr, serializeComponentInfo as zn, handleABTestingSync as qr } from "./server-entry-b8ecec52.js";
|
|
7
|
+
import { useRef as Zt, useState as ye, useEffect as ie, createContext as Zr } from "react";
|
|
8
8
|
import { useRouter as Qr } from "next/navigation";
|
|
9
9
|
import "lru-cache";
|
|
10
10
|
const ei = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), ti = (e) => typeof e == "string" && ei.has(e.toLowerCase());
|
|
11
|
-
function
|
|
11
|
+
function Qt(e) {
|
|
12
12
|
return /* @__PURE__ */ y(K, { children: ti(e.TagName) ? /* @__PURE__ */ y(K, { children: /* @__PURE__ */ y(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ y(K, { children: typeof e.TagName == "string" ? /* @__PURE__ */ y(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ y(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
|
13
13
|
}
|
|
14
14
|
const et = () => {
|
|
@@ -40,7 +40,7 @@ function ni(e) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
return /* @__PURE__ */ y(
|
|
43
|
-
|
|
43
|
+
Qt,
|
|
44
44
|
{
|
|
45
45
|
attributes: t(),
|
|
46
46
|
TagName: e.link ? e.builderLinkComponent || "a" : "button",
|
|
@@ -915,7 +915,7 @@ function p(e, t) {
|
|
|
915
915
|
var Yn = {
|
|
916
916
|
C: !0,
|
|
917
917
|
kc: 5
|
|
918
|
-
},
|
|
918
|
+
}, en = {
|
|
919
919
|
configurable: !0,
|
|
920
920
|
enumerable: !0,
|
|
921
921
|
writable: !1
|
|
@@ -944,7 +944,7 @@ var Yn = {
|
|
|
944
944
|
}, Me = {
|
|
945
945
|
REGEXP_TIMEOUT: !0
|
|
946
946
|
}, Jn = [], ve = null, Ze = null, we = typeof globalThis == "undefined" ? void 0 : globalThis, li = ["onmessage = function(e) {", "var result;", "var data = e.data;", "switch (data[0]) {", "case 'split':", "result = data[1].split(data[2], data[3]);", "break;", "case 'match':", "result = data[1].match(data[2]);", "break;", "case 'search':", "result = data[1].search(data[2]);", "break;", "case 'replace':", "result = data[1].replace(data[2], data[3]);", "break;", "case 'exec':", "var regexp = data[1];", "regexp.lastIndex = data[2];", "result = [regexp.exec(data[3]), data[1].lastIndex];", "break;", "default:", "throw Error('Unknown RegExp operation: ' + data[0]);", "}", "postMessage(result);", "close();", "};"];
|
|
947
|
-
function
|
|
947
|
+
function tn(e) {
|
|
948
948
|
var t = e >>> 0;
|
|
949
949
|
return t === Number(e) ? t : NaN;
|
|
950
950
|
}
|
|
@@ -1026,7 +1026,7 @@ F.Eb = function() {
|
|
|
1026
1026
|
return this.za;
|
|
1027
1027
|
};
|
|
1028
1028
|
function ci(e, t) {
|
|
1029
|
-
e.g(t, "NaN", NaN, ze), e.g(t, "Infinity", 1 / 0, ze), e.g(t, "undefined", void 0, ze), e.g(t, "window", t,
|
|
1029
|
+
e.g(t, "NaN", NaN, ze), e.g(t, "Infinity", 1 / 0, ze), e.g(t, "undefined", void 0, ze), e.g(t, "window", t, en), e.g(t, "this", t, ze), e.g(t, "self", t), e.M = new N(null), e.Z = new N(e.M), ui(e, t), di(e, t), t.xa = e.M, e.g(t, "constructor", e.v, k), fi(e, t), hi(e, t), pi(e, t), mi(e, t), gi(e, t), yi(e, t), vi(e, t), bi(e, t), xi(e, t);
|
|
1030
1030
|
var n = e.i(function() {
|
|
1031
1031
|
throw EvalError("Can't happen");
|
|
1032
1032
|
}, !1);
|
|
@@ -1068,7 +1068,7 @@ function ui(e, t) {
|
|
|
1068
1068
|
} catch (b) {
|
|
1069
1069
|
w(e, e.T, "Invalid code: " + b.message);
|
|
1070
1070
|
}
|
|
1071
|
-
return g.body.length !== 1 && w(e, e.T, "Invalid code in function body"),
|
|
1071
|
+
return g.body.length !== 1 && w(e, e.T, "Invalid code in function body"), on(e, g.body[0].la, e.N, "anonymous");
|
|
1072
1072
|
};
|
|
1073
1073
|
e.O = e.i(r, !0), e.g(t, "Function", e.O, k), e.g(e.O, "prototype", e.Z, k), e.g(e.Z, "constructor", e.O, k), e.Z.Ta = function() {
|
|
1074
1074
|
}, e.Z.Ta.id = e.Ya++, e.Z.Ab = !0, e.g(e.Z, "length", 0, ne), e.Z.H = "Function", r = function(i, a) {
|
|
@@ -1135,7 +1135,7 @@ function fi(e, t) {
|
|
|
1135
1135
|
var n = function(r) {
|
|
1136
1136
|
var i = xe(e) ? this : Ue(e), a = arguments[0];
|
|
1137
1137
|
if (arguments.length === 1 && typeof a == "number")
|
|
1138
|
-
isNaN(
|
|
1138
|
+
isNaN(tn(a)) && w(e, e.ob, "Invalid array length: " + a), i.h.length = a;
|
|
1139
1139
|
else {
|
|
1140
1140
|
for (a = 0; a < arguments.length; a++)
|
|
1141
1141
|
i.h[a] = arguments[a];
|
|
@@ -1312,7 +1312,7 @@ function yi(e, t) {
|
|
|
1312
1312
|
} catch (c) {
|
|
1313
1313
|
w(e, e.T, c.message);
|
|
1314
1314
|
}
|
|
1315
|
-
return
|
|
1315
|
+
return nn(e, a, s), a;
|
|
1316
1316
|
};
|
|
1317
1317
|
e.I = e.i(n, !0), e.Ma = e.I.h.prototype, e.g(t, "RegExp", e.I, k), e.g(e.I.h.prototype, "global", void 0, ne), e.g(e.I.h.prototype, "ignoreCase", void 0, ne), e.g(e.I.h.prototype, "multiline", void 0, ne), e.g(e.I.h.prototype, "source", "(?:)", ne), e.ba.push("Object.defineProperty(RegExp.prototype, 'test',", "{configurable: true, writable: true, value:", "function test(str) {", "return !!this.exec(str);", "}", "});"), n = function(r, i) {
|
|
1318
1318
|
function a(b) {
|
|
@@ -1394,7 +1394,7 @@ function q(e, t, n) {
|
|
|
1394
1394
|
}
|
|
1395
1395
|
return !1;
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1397
|
+
function nn(e, t, n) {
|
|
1398
1398
|
t.data = new RegExp(n.source, n.flags), e.g(t, "lastIndex", n.lastIndex, k), e.g(t, "source", n.source, ne), e.g(t, "global", n.global, ne), e.g(t, "ignoreCase", n.ignoreCase, ne), e.g(t, "multiline", n.multiline, ne);
|
|
1399
1399
|
}
|
|
1400
1400
|
function Xt(e, t, n) {
|
|
@@ -1476,19 +1476,19 @@ function Ue(e) {
|
|
|
1476
1476
|
writable: !0
|
|
1477
1477
|
}), t.H = "Array", t;
|
|
1478
1478
|
}
|
|
1479
|
-
function
|
|
1479
|
+
function rn(e, t, n) {
|
|
1480
1480
|
var r = e.s(e.Z);
|
|
1481
1481
|
return n ? (n = e.s(e.M), e.g(r, "prototype", n, k), e.g(n, "constructor", r, k)) : r.Ab = !0, e.g(r, "length", t, ne), r.H = "Function", r;
|
|
1482
1482
|
}
|
|
1483
|
-
function
|
|
1484
|
-
var i =
|
|
1483
|
+
function on(e, t, n, r) {
|
|
1484
|
+
var i = rn(e, t.oa.length, !0);
|
|
1485
1485
|
return i.Va = n, i.node = t, e.g(i, "name", t.id ? String(t.id.name) : r || "", ne), i;
|
|
1486
1486
|
}
|
|
1487
1487
|
F.i = function(e, t) {
|
|
1488
|
-
return t =
|
|
1488
|
+
return t = rn(this, e.length, t), t.Ta = e, e.id = this.Ya++, this.g(t, "name", e.name, ne), t;
|
|
1489
1489
|
};
|
|
1490
1490
|
F.ub = function(e) {
|
|
1491
|
-
var t =
|
|
1491
|
+
var t = rn(this, e.length, !0);
|
|
1492
1492
|
return t.Za = e, e.id = this.Ya++, this.g(t, "name", e.name, ne), t;
|
|
1493
1493
|
};
|
|
1494
1494
|
F.Ia = function(e) {
|
|
@@ -1498,7 +1498,7 @@ F.Ia = function(e) {
|
|
|
1498
1498
|
return e;
|
|
1499
1499
|
if (e instanceof RegExp) {
|
|
1500
1500
|
var t = this.s(this.Ma);
|
|
1501
|
-
return
|
|
1501
|
+
return nn(this, t, e), t;
|
|
1502
1502
|
}
|
|
1503
1503
|
if (e instanceof Date)
|
|
1504
1504
|
return t = this.s(this.nb), t.data = new Date(e.valueOf()), t;
|
|
@@ -1561,7 +1561,7 @@ function hr(e, t) {
|
|
|
1561
1561
|
var n = [], r;
|
|
1562
1562
|
for (r in t.h)
|
|
1563
1563
|
n[r] = e.G(t, r);
|
|
1564
|
-
return n.length =
|
|
1564
|
+
return n.length = tn(e.G(t, "length")) || 0, n;
|
|
1565
1565
|
}
|
|
1566
1566
|
function be(e, t) {
|
|
1567
1567
|
switch (typeof t) {
|
|
@@ -1614,7 +1614,7 @@ F.g = function(e, t, n, r) {
|
|
|
1614
1614
|
if (t = String(t), e != null || w(this, this.j, "Cannot set property '" + t + "' of " + e), typeof e == "object" && !(e instanceof N))
|
|
1615
1615
|
throw TypeError("Expecting native value or pseudo object");
|
|
1616
1616
|
r && ("get" in r || "set" in r) && ("value" in r || "writable" in r) && w(this, this.j, "Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");
|
|
1617
|
-
var i = !this.o ||
|
|
1617
|
+
var i = !this.o || an(this).S;
|
|
1618
1618
|
if (e instanceof N) {
|
|
1619
1619
|
if (q(this, e, this.J)) {
|
|
1620
1620
|
var a = Qe(t);
|
|
@@ -1630,7 +1630,7 @@ F.g = function(e, t, n, r) {
|
|
|
1630
1630
|
return;
|
|
1631
1631
|
n = r.value;
|
|
1632
1632
|
}
|
|
1633
|
-
if (n =
|
|
1633
|
+
if (n = tn(n), isNaN(n) && w(this, this.ob, "Invalid array length"), n < a)
|
|
1634
1634
|
for (s in e.h) {
|
|
1635
1635
|
var s = Qe(s);
|
|
1636
1636
|
!isNaN(s) && n <= s && delete e.h[s];
|
|
@@ -1682,7 +1682,7 @@ function X(e, t, n, r) {
|
|
|
1682
1682
|
function qe(e, t, n, r) {
|
|
1683
1683
|
e.g(t.h.prototype, n, e.ub(r), k);
|
|
1684
1684
|
}
|
|
1685
|
-
function
|
|
1685
|
+
function an(e) {
|
|
1686
1686
|
if (e = e.o[e.o.length - 1].scope, !e)
|
|
1687
1687
|
throw Error("No scope found");
|
|
1688
1688
|
return e;
|
|
@@ -1697,13 +1697,13 @@ function Jt(e, t, n) {
|
|
|
1697
1697
|
}
|
|
1698
1698
|
return i = e.s(null), r = new gr(n, r, i), n || ci(e, r.object), nt(e, t, r), r;
|
|
1699
1699
|
}
|
|
1700
|
-
function
|
|
1700
|
+
function sn(e, t, n) {
|
|
1701
1701
|
if (!t)
|
|
1702
1702
|
throw Error("parentScope required");
|
|
1703
1703
|
return e = n || e.s(null), new gr(t, t.S, e);
|
|
1704
1704
|
}
|
|
1705
|
-
function
|
|
1706
|
-
for (var n =
|
|
1705
|
+
function ln(e, t) {
|
|
1706
|
+
for (var n = an(e); n && n !== e.N; ) {
|
|
1707
1707
|
if (t in n.object.h)
|
|
1708
1708
|
return n.object.h[t];
|
|
1709
1709
|
n = n.Va;
|
|
@@ -1713,7 +1713,7 @@ function cn(e, t) {
|
|
|
1713
1713
|
n = e.o[e.o.length - 1].node, n.type === "UnaryExpression" && n.operator === "typeof" || w(e, e.pb, t + " is not defined");
|
|
1714
1714
|
}
|
|
1715
1715
|
function pr(e, t, n) {
|
|
1716
|
-
for (var r =
|
|
1716
|
+
for (var r = an(e), i = r.S; r && r !== e.N; ) {
|
|
1717
1717
|
if (t in r.object.h) {
|
|
1718
1718
|
try {
|
|
1719
1719
|
r.object.h[t] = n;
|
|
@@ -1774,16 +1774,16 @@ function nt(e, t, n) {
|
|
|
1774
1774
|
t.jb = r;
|
|
1775
1775
|
}
|
|
1776
1776
|
for (s in r)
|
|
1777
|
-
r[s] === !0 ? e.g(n.object, s, void 0, Xn) : e.g(n.object, s,
|
|
1777
|
+
r[s] === !0 ? e.g(n.object, s, void 0, Xn) : e.g(n.object, s, on(e, r[s], n), Xn);
|
|
1778
1778
|
return r;
|
|
1779
1779
|
}
|
|
1780
1780
|
function xe(e) {
|
|
1781
1781
|
return e.o[e.o.length - 1].isConstructor;
|
|
1782
1782
|
}
|
|
1783
|
-
function
|
|
1784
|
-
return t[0] === Le ?
|
|
1783
|
+
function cn(e, t) {
|
|
1784
|
+
return t[0] === Le ? ln(e, t[1]) : e.G(t[0], t[1]);
|
|
1785
1785
|
}
|
|
1786
|
-
function
|
|
1786
|
+
function un(e, t, n) {
|
|
1787
1787
|
return t[0] === Le ? pr(e, t[1], n) : e.g(t[0], t[1], n);
|
|
1788
1788
|
}
|
|
1789
1789
|
function w(e, t, n) {
|
|
@@ -1901,7 +1901,7 @@ function st(e, t, n) {
|
|
|
1901
1901
|
var r = e.ya();
|
|
1902
1902
|
return r.type = "CallExpression", e = new C(r, e.o[e.o.length - 1].scope), e.ia = 2, e.B = n, e.U = t, e.Qa = !0, e.F = [], e;
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function dn(e, t, n, r) {
|
|
1905
1905
|
if (!e.Ka)
|
|
1906
1906
|
throw Error("Unexpected call to createSetter");
|
|
1907
1907
|
e.Ka = !1, n = Array.isArray(n) ? n[0] : e.Na;
|
|
@@ -2002,7 +2002,7 @@ p.prototype.stepAssignmentExpression = function(e, t, n) {
|
|
|
2002
2002
|
if (!t.ja)
|
|
2003
2003
|
return t.ja = !0, t = new C(n.left, t.scope), t.sa = !0, t;
|
|
2004
2004
|
if (!t.Da)
|
|
2005
|
-
return t.Fa || (t.Fa = t.value), t.Ba && (t.ma = t.value), !t.Ba && n.operator !== "=" && (e =
|
|
2005
|
+
return t.Fa || (t.Fa = t.value), t.Ba && (t.ma = t.value), !t.Ba && n.operator !== "=" && (e = cn(this, t.Fa), t.ma = e, this.P) ? (t.Ba = !0, st(this, e, t.Fa)) : (t.Da = !0, n.operator === "=" && n.left.type === "Identifier" && (t.Pa = n.left.name), new C(n.right, t.scope));
|
|
2006
2006
|
if (t.ta)
|
|
2007
2007
|
e.pop(), e[e.length - 1].value = t.ib;
|
|
2008
2008
|
else {
|
|
@@ -2047,8 +2047,8 @@ p.prototype.stepAssignmentExpression = function(e, t, n) {
|
|
|
2047
2047
|
default:
|
|
2048
2048
|
throw SyntaxError("Unknown assignment expression: " + n.operator);
|
|
2049
2049
|
}
|
|
2050
|
-
if (n =
|
|
2051
|
-
return t.ta = !0, t.ib = r,
|
|
2050
|
+
if (n = un(this, t.Fa, r))
|
|
2051
|
+
return t.ta = !0, t.ib = r, dn(this, n, t.Fa, r);
|
|
2052
2052
|
e.pop(), e[e.length - 1].value = r;
|
|
2053
2053
|
}
|
|
2054
2054
|
};
|
|
@@ -2148,7 +2148,7 @@ p.prototype.stepCallExpression = function(e, t, n) {
|
|
|
2148
2148
|
t.ia = 2;
|
|
2149
2149
|
var i = t.value;
|
|
2150
2150
|
if (Array.isArray(i)) {
|
|
2151
|
-
if (t.U =
|
|
2151
|
+
if (t.U = cn(this, i), i[0] === Le ? t.Pb = i[1] === "eval" : t.B = i[0], i = t.U, this.P)
|
|
2152
2152
|
return t.ia = 1, st(this, i, t.value);
|
|
2153
2153
|
} else
|
|
2154
2154
|
t.U = i;
|
|
@@ -2176,7 +2176,7 @@ p.prototype.stepCallExpression = function(e, t, n) {
|
|
|
2176
2176
|
this.g(r, i, t.F[i]);
|
|
2177
2177
|
for (this.g(n.object, "arguments", r), i = 0; i < e.oa.length; i++)
|
|
2178
2178
|
this.g(n.object, e.oa[i].name, t.F.length > i ? t.F[i] : void 0);
|
|
2179
|
-
return n.S || (t.B = Gt(this, t.B)), this.g(n.object, "this", t.B,
|
|
2179
|
+
return n.S || (t.B = Gt(this, t.B)), this.g(n.object, "this", t.B, en), t.value = void 0, new C(e.body, n);
|
|
2180
2180
|
}
|
|
2181
2181
|
if (i.eval)
|
|
2182
2182
|
if (i = t.F[0], typeof i != "string")
|
|
@@ -2276,8 +2276,8 @@ p.prototype.stepForInStatement = function(e, t, n) {
|
|
|
2276
2276
|
t.pa = [Le, e.fa[0].id.name];
|
|
2277
2277
|
else
|
|
2278
2278
|
return t.pa = null, t = new C(e, t.scope), t.sa = !0, t;
|
|
2279
|
-
if (t.pa || (t.pa = t.value), !t.ta && (t.ta = !0, e = t.Ra, r =
|
|
2280
|
-
return
|
|
2279
|
+
if (t.pa || (t.pa = t.value), !t.ta && (t.ta = !0, e = t.Ra, r = un(this, t.pa, e)))
|
|
2280
|
+
return dn(this, r, t.pa, e);
|
|
2281
2281
|
if (t.Ra = void 0, t.wb = !1, t.ta = !1, n.body)
|
|
2282
2282
|
return new C(n.body, t.scope);
|
|
2283
2283
|
};
|
|
@@ -2306,13 +2306,13 @@ p.prototype.stepFunctionDeclaration = function(e) {
|
|
|
2306
2306
|
e.pop();
|
|
2307
2307
|
};
|
|
2308
2308
|
p.prototype.stepFunctionExpression = function(e, t, n) {
|
|
2309
|
-
e.pop(), t = e[e.length - 1], e = t.scope, n.id && (e =
|
|
2309
|
+
e.pop(), t = e[e.length - 1], e = t.scope, n.id && (e = sn(this, e)), t.value = on(this, n, e, t.Pa), n.id && this.g(e.object, n.id.name, t.value, en);
|
|
2310
2310
|
};
|
|
2311
2311
|
p.prototype.stepIdentifier = function(e, t, n) {
|
|
2312
2312
|
if (e.pop(), t.sa)
|
|
2313
2313
|
e[e.length - 1].value = [Le, n.name];
|
|
2314
2314
|
else {
|
|
2315
|
-
if (t =
|
|
2315
|
+
if (t = ln(this, n.name), this.P)
|
|
2316
2316
|
return st(this, t, this.Na);
|
|
2317
2317
|
e[e.length - 1].value = t;
|
|
2318
2318
|
}
|
|
@@ -2322,7 +2322,7 @@ p.prototype.stepLabeledStatement = function(e, t, n) {
|
|
|
2322
2322
|
return e.pop(), e = t.labels || [], e.push(n.label.name), t = new C(n.body, t.scope), t.labels = e, t;
|
|
2323
2323
|
};
|
|
2324
2324
|
p.prototype.stepLiteral = function(e, t, n) {
|
|
2325
|
-
e.pop(), t = n.value, t instanceof RegExp && (n = this.s(this.Ma),
|
|
2325
|
+
e.pop(), t = n.value, t instanceof RegExp && (n = this.s(this.Ma), nn(this, n, t), t = n), e[e.length - 1].value = t;
|
|
2326
2326
|
};
|
|
2327
2327
|
p.prototype.stepLogicalExpression = function(e, t, n) {
|
|
2328
2328
|
if (n.operator !== "&&" && n.operator !== "||")
|
|
@@ -2425,7 +2425,7 @@ p.prototype.stepSwitchStatement = function(e, t, n) {
|
|
|
2425
2425
|
}
|
|
2426
2426
|
};
|
|
2427
2427
|
p.prototype.stepThisExpression = function(e) {
|
|
2428
|
-
e.pop(), e[e.length - 1].value =
|
|
2428
|
+
e.pop(), e[e.length - 1].value = ln(this, "this");
|
|
2429
2429
|
};
|
|
2430
2430
|
p.prototype.stepThrowStatement = function(e, t, n) {
|
|
2431
2431
|
if (t.ka)
|
|
@@ -2437,7 +2437,7 @@ p.prototype.stepTryStatement = function(e, t, n) {
|
|
|
2437
2437
|
if (!t.Rb)
|
|
2438
2438
|
return t.Rb = !0, new C(n.block, t.scope);
|
|
2439
2439
|
if (t.ea && t.ea.type === 4 && !t.Tb && n.Ea)
|
|
2440
|
-
return t.Tb = !0, e =
|
|
2440
|
+
return t.Tb = !0, e = sn(this, t.scope), this.g(e.object, n.Ea.Ua.name, t.ea.value), t.ea = void 0, new C(n.Ea.body, e);
|
|
2441
2441
|
if (!t.Sb && n.fb)
|
|
2442
2442
|
return t.Sb = !0, new C(n.fb, t.scope);
|
|
2443
2443
|
e.pop(), t.ea && at(this, t.ea.type, t.ea.value, t.ea.label);
|
|
@@ -2487,7 +2487,7 @@ p.prototype.stepUpdateExpression = function(e, t, n) {
|
|
|
2487
2487
|
if (!t.ja)
|
|
2488
2488
|
return t.ja = !0, e = new C(n.K, t.scope), e.sa = !0, e;
|
|
2489
2489
|
if (t.Ga || (t.Ga = t.value), t.Ba && (t.ma = t.value), !t.Ba) {
|
|
2490
|
-
var r =
|
|
2490
|
+
var r = cn(this, t.Ga);
|
|
2491
2491
|
if (t.ma = r, this.P)
|
|
2492
2492
|
return t.Ba = !0, st(this, r, t.Ga);
|
|
2493
2493
|
}
|
|
@@ -2500,8 +2500,8 @@ p.prototype.stepUpdateExpression = function(e, t, n) {
|
|
|
2500
2500
|
i = r - 1;
|
|
2501
2501
|
else
|
|
2502
2502
|
throw SyntaxError("Unknown update expression: " + n.operator);
|
|
2503
|
-
if (n = n.prefix ? i : r, r =
|
|
2504
|
-
return t.ta = !0, t.ib = n,
|
|
2503
|
+
if (n = n.prefix ? i : r, r = un(this, t.Ga, i))
|
|
2504
|
+
return t.ta = !0, t.ib = n, dn(this, r, t.Ga, i);
|
|
2505
2505
|
e.pop(), e[e.length - 1].value = n;
|
|
2506
2506
|
}
|
|
2507
2507
|
};
|
|
@@ -2516,7 +2516,7 @@ p.prototype.stepVariableDeclaration = function(e, t, n) {
|
|
|
2516
2516
|
e.pop();
|
|
2517
2517
|
};
|
|
2518
2518
|
p.prototype.stepWithStatement = function(e, t, n) {
|
|
2519
|
-
return t.Ca ? (e.pop(), e =
|
|
2519
|
+
return t.Ca ? (e.pop(), e = sn(this, t.scope, t.value), new C(n.body, e)) : (t.Ca = !0, new C(n.object, t.scope));
|
|
2520
2520
|
};
|
|
2521
2521
|
p.prototype.stepWhileStatement = p.prototype.stepDoWhileStatement;
|
|
2522
2522
|
we.Interpreter = p;
|
|
@@ -2664,6 +2664,7 @@ function rt({
|
|
|
2664
2664
|
return;
|
|
2665
2665
|
}
|
|
2666
2666
|
}
|
|
2667
|
+
const fn = (e) => JSON.parse(JSON.stringify(e));
|
|
2667
2668
|
const Ai = ({
|
|
2668
2669
|
block: e,
|
|
2669
2670
|
context: t,
|
|
@@ -2673,7 +2674,7 @@ const Ai = ({
|
|
|
2673
2674
|
}) => {
|
|
2674
2675
|
if (!e.bindings)
|
|
2675
2676
|
return e;
|
|
2676
|
-
const a =
|
|
2677
|
+
const a = fn(e), s = {
|
|
2677
2678
|
...a,
|
|
2678
2679
|
properties: {
|
|
2679
2680
|
...a.properties
|
|
@@ -2851,7 +2852,7 @@ const Pi = ({
|
|
|
2851
2852
|
small: e,
|
|
2852
2853
|
medium: t
|
|
2853
2854
|
}) => {
|
|
2854
|
-
const n =
|
|
2855
|
+
const n = fn(br);
|
|
2855
2856
|
if (!e || !t)
|
|
2856
2857
|
return n;
|
|
2857
2858
|
const r = Math.floor(e / 2);
|
|
@@ -3022,7 +3023,7 @@ function pn({
|
|
|
3022
3023
|
}
|
|
3023
3024
|
function Hi(e) {
|
|
3024
3025
|
return /* @__PURE__ */ y(
|
|
3025
|
-
|
|
3026
|
+
Qt,
|
|
3026
3027
|
{
|
|
3027
3028
|
TagName: e.Wrapper,
|
|
3028
3029
|
attributes: pn({
|
|
@@ -3387,6 +3388,7 @@ function Ji(e) {
|
|
|
3387
3388
|
((oe = (G = e.builderContext.content) == null ? void 0 : G.meta) == null ? void 0 : oe.breakpoints) || {}
|
|
3388
3389
|
)[v].max;
|
|
3389
3390
|
}, D = function() {
|
|
3391
|
+
const v = `.${e.builderBlock.id}-breakpoints > .builder-column`;
|
|
3390
3392
|
return `
|
|
3391
3393
|
@media (max-width: ${j("medium")}px) {
|
|
3392
3394
|
.${e.builderBlock.id}-breakpoints {
|
|
@@ -3394,7 +3396,7 @@ function Ji(e) {
|
|
|
3394
3396
|
align-items: stretch;
|
|
3395
3397
|
}
|
|
3396
3398
|
|
|
3397
|
-
|
|
3399
|
+
${v} {
|
|
3398
3400
|
width: var(--column-width-tablet) !important;
|
|
3399
3401
|
margin-left: var(--column-margin-left-tablet) !important;
|
|
3400
3402
|
}
|
|
@@ -3406,7 +3408,7 @@ function Ji(e) {
|
|
|
3406
3408
|
align-items: stretch;
|
|
3407
3409
|
}
|
|
3408
3410
|
|
|
3409
|
-
|
|
3411
|
+
${v} {
|
|
3410
3412
|
width: var(--column-width-mobile) !important;
|
|
3411
3413
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
3412
3414
|
}
|
|
@@ -3425,7 +3427,7 @@ function Ji(e) {
|
|
|
3425
3427
|
/* @__PURE__ */ se(
|
|
3426
3428
|
"div",
|
|
3427
3429
|
{
|
|
3428
|
-
className: Xi((P = e.builderBlock) == null ? void 0 : P.id) + " div-
|
|
3430
|
+
className: Xi((P = e.builderBlock) == null ? void 0 : P.id) + " div-2cd13691",
|
|
3429
3431
|
style: b(),
|
|
3430
3432
|
children: [
|
|
3431
3433
|
/* @__PURE__ */ y(
|
|
@@ -3437,7 +3439,7 @@ function Ji(e) {
|
|
|
3437
3439
|
}
|
|
3438
3440
|
),
|
|
3439
3441
|
(_ = e.columns) == null ? void 0 : _.map((O, v) => /* @__PURE__ */ y(
|
|
3440
|
-
|
|
3442
|
+
Qt,
|
|
3441
3443
|
{
|
|
3442
3444
|
TagName: i(O),
|
|
3443
3445
|
actionAttributes: {},
|
|
@@ -3462,7 +3464,7 @@ function Ji(e) {
|
|
|
3462
3464
|
]
|
|
3463
3465
|
}
|
|
3464
3466
|
),
|
|
3465
|
-
/* @__PURE__ */ y("style", { children: `.div-
|
|
3467
|
+
/* @__PURE__ */ y("style", { children: `.div-2cd13691 {
|
|
3466
3468
|
display: flex;
|
|
3467
3469
|
line-height: normal;
|
|
3468
3470
|
}` })
|
|
@@ -4142,7 +4144,7 @@ const ho = {
|
|
|
4142
4144
|
}]
|
|
4143
4145
|
};
|
|
4144
4146
|
function po(e) {
|
|
4145
|
-
const t =
|
|
4147
|
+
const t = Zt(null), [n, r] = ye(() => []), [i, a] = ye(() => []);
|
|
4146
4148
|
return ie(() => {
|
|
4147
4149
|
var c;
|
|
4148
4150
|
if (!((c = t.current) != null && c.getElementsByTagName) || typeof window == "undefined")
|
|
@@ -4196,7 +4198,7 @@ const mo = {
|
|
|
4196
4198
|
}]
|
|
4197
4199
|
}, go = ["text/javascript", "application/javascript", "application/ecmascript"], yo = (e) => go.includes(e.type);
|
|
4198
4200
|
function vo(e) {
|
|
4199
|
-
const t =
|
|
4201
|
+
const t = Zt(null), [n, r] = ye(() => []), [i, a] = ye(() => []), [s, c] = ye(() => !1);
|
|
4200
4202
|
function f() {
|
|
4201
4203
|
if (!t.current || !t.current.getElementsByTagName)
|
|
4202
4204
|
return;
|
|
@@ -4755,7 +4757,7 @@ font-weight: ${c};
|
|
|
4755
4757
|
`, Ho = (e) => e ? "" : $o, Ko = (e) => `variant-${e}`;
|
|
4756
4758
|
function Go(e) {
|
|
4757
4759
|
var oe, $, Q, E, Ee, L, Ie;
|
|
4758
|
-
const t =
|
|
4760
|
+
const t = Zt(null);
|
|
4759
4761
|
function n(I) {
|
|
4760
4762
|
var B, W;
|
|
4761
4763
|
const x = {
|
|
@@ -4887,7 +4889,7 @@ function Go(e) {
|
|
|
4887
4889
|
"builder:component:stateChange",
|
|
4888
4890
|
{
|
|
4889
4891
|
detail: {
|
|
4890
|
-
state:
|
|
4892
|
+
state: fn(e.builderContextSignal.rootState),
|
|
4891
4893
|
ref: {
|
|
4892
4894
|
name: e.model
|
|
4893
4895
|
}
|
package/lib/edge/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-8a47b9f9.cjs");require("react/jsx-runtime");require("react");require("next/navigation");require("lru-cache");exports.Blocks=t.Blocks;exports.BuilderContext=t.BuilderContext;exports.Button=t.Button;exports.Columns=t.Columns;exports.Content=t.Content;exports.Fragment=t.Fragment;exports.Image=t.Image;exports.Section=t.Section;exports.Symbol=t.Symbol;exports.Text=t.Text;exports.Video=t.Video;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/edge/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Blocks as n, BuilderContext as m, Button as c, Columns as g, Content as p, Fragment as a, Image as d, Section as l, Symbol as u, Text as f, Video as B } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as E, createRegisterComponentMessage as h, fetchBuilderProps as x, fetchEntries as S, fetchOneEntry as b, getBuilderSearchParams as P, isEditing as k, isPreviewing as y, register as R, setEditorSettings as T, subscribeToEditor as v, track as w } from "./server-entry-
|
|
2
|
+
import { _processContentResult as E, createRegisterComponentMessage as h, fetchBuilderProps as x, fetchEntries as S, fetchOneEntry as b, getBuilderSearchParams as P, isEditing as k, isPreviewing as y, register as R, setEditorSettings as T, subscribeToEditor as v, track as w } from "./server-entry-b8ecec52.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "next/navigation";
|
package/lib/edge/init.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ivm=require("isolated-vm"),serverEntry=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ivm=require("isolated-vm"),serverEntry=require("./server-entry-8a47b9f9.cjs");require("lru-cache");const SDK_NAME_FOR_TARGET=(()=>{switch(serverEntry.TARGET){case"rsc":return"react-nextjs";case"reactNative":return"react-native";default:return serverEntry.TARGET}})(),SDK_NAME=`@builder.io/sdk-${SDK_NAME_FOR_TARGET}`,noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=eval("require")}catch(t){}const INJECTED_IVM_GLOBAL="BUILDER_IVM";let IVM_INSTANCE=null;const setIvm=(t,e={})=>{IVM_INSTANCE=t,setIsolateContext(e)},SHOULD_MENTION_INITIALIZE_SCRIPT=SDK_NAME==="@builder.io/sdk-react-nextjs"||SDK_NAME==="@builder.io/sdk-react",getIvm=()=>{try{if(IVM_INSTANCE)return IVM_INSTANCE;const e=safeDynamicRequire("isolated-vm");if(e)return e}catch(e){serverEntry.logger.error("isolated-vm import error.",e)}const t=`${serverEntry.MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on a Node server.
|
|
2
2
|
|
|
3
3
|
SOLUTION: In a server-only execution path within your application, do one of the following:
|
|
4
4
|
|
package/lib/edge/init.mjs
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const ue=require("lru-cache"),I="rsc",b="[Builder.io]: ",d={log:(...e)=>console.log(b,...e),error:(...e)=>console.error(b,...e),warn:(...e)=>console.warn(b,...e),debug:(...e)=>console.debug(b,...e)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const de=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},U=e=>e instanceof URLSearchParams?de(e):e,V=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function le(){return c()&&window.self!==window.top}function M(e){return le()&&V(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const fe=()=>{if(c()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},ge=()=>typeof navigator=="object"&&navigator.userAgent||"",_=()=>{const e=ge(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||I==="reactNative"}},n=e.match(/Tablet|iPad/i),r=fe();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},p=e=>e!=null,he=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},F=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},D=async e=>F(e),pe=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),me=[["secure",""],["SameSite","None"]],ye=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?me:[[]],s=n?[["expires",n.toUTCString()]]:[[]],i=[[e,t],...s,["path","/"],["domain",he(window.location.hostname)],...o];return pe(i)},N=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=ye({name:e,value:t,expires:n});document.cookie=o}catch(o){d.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}},we="builder.tests",k=e=>`${we}.${e}`,Se=({contentId:e})=>D({name:k(e),canTrack:!0}),be=({contentId:e})=>F({name:k(e),canTrack:!0}),Ie=({contentId:e,value:t})=>N({name:k(e),value:t,canTrack:!0}),j=e=>p(e.id)&&p(e.variations)&&Object.keys(e.variations).length>0,ve=({id:e,variations:t})=>{var o;let n=0;const r=Math.random();for(const s in t){const i=(o=t[s])==null?void 0:o.testRatio;if(n+=i,r<n)return s}return e},K=e=>{const t=ve(e);return Ie({contentId:e.id,value:t}).catch(n=>{d.error("could not store A/B test variation: ",n)}),t},W=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},Ee=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!j(e))return e;const n=be({contentId:e.id})||K({variations:e.variations,id:e.id}),r=W({item:e,testGroupId:n});return{...e,...r}},ke=async({item:e,canTrack:t})=>{if(!t||!j(e))return e;const r=await Se({contentId:e.id})||K({variations:e.variations,id:e.id}),o=W({item:e,testGroupId:r});return{...e,...o}},$=e=>p(e)?e:!0,Ce=e=>({type:"builder.registerComponent",data:G(e)}),Pe=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`};function G(e){return JSON.parse(JSON.stringify(e,(t,n)=>typeof n=="function"?Pe(n):n))}const Re=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||d.warn("No previewed ID found in search params."),n};function H(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new ue.LRUCache({max:500,ttl:1e3*60*5}))}function Oe(e){H();const t=Re(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function Ae(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function Te(){const e=Ae().fetch;if(typeof e=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
|
+
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 z=Te();function E(e,t=null,n="."){return Object.keys(e).reduce((r,o)=>{const s=e[o],i=[t,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...E(s,i,n)}:{...r,[i]:s}},{})}function J(e,t,n={}){for(const r in e){const o=e[r],s=t?t+"."+r:r;o&&typeof o=="object"&&!Array.isArray(o)&&!Object.keys(o).find(i=>i.startsWith("$"))?J(o,s,n):n[s]=o}return n}const xe="v3",A="builder.",Be="options.",C=e=>{if(!e)return{};const t=U(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(A)){const o=r.replace(A,"").replace(Be,"");n[o]=t[r]}}),n},Le=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return C(e)},T=e=>typeof e=="number"&&!isNaN(e)&&e>=0,P=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:i,locale:u,apiVersion:y=xe,fields:m,omit:v,offset:l,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:R}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(y))throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);const ae=t!==1,a=new URL(`https://cdn.builder.io/api/${y}/content/${o}`);if(a.searchParams.set("apiKey",s),a.searchParams.set("limit",String(t)),a.searchParams.set("noTraverse",String(ae)),a.searchParams.set("includeRefs",String(!0)),u&&a.searchParams.set("locale",u),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",v||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(l)&&l>-1&&a.searchParams.set("offset",String(Math.floor(l))),typeof R=="boolean"&&a.searchParams.set("includeUnpublished",String(R)),g&&T(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&T(h)&&a.searchParams.set("staleCacheSeconds",String(h)),w){const f=E({sort:w});for(const S in f)a.searchParams.set(S,JSON.stringify(f[S]))}const ce={...Le(),...U(e.options||{})},O=E(ce);for(const f in O)a.searchParams.set(f,String(O[f]));if(n&&a.searchParams.set("userAttributes",JSON.stringify(n)),r){const f=J({query:r});for(const S in f)a.searchParams.set(S,JSON.stringify(f[S]))}return a},Ue=e=>"results"in e;async function X(e){const t=await Q({...e,limit:1});return t&&t[0]||null}const Ve=async e=>{var s;const t=P(e);return await(await((s=e.fetch)!=null?s:z)(t.href,e.fetchOptions)).json()},q=async(e,t,n=P(e))=>{const r=$(e.canTrack);if(n.search.includes("preview=")){const s=[];for(const i of t.results){const u=Oe(n.searchParams);s.push(u||i)}t.results=s}if(!r||!(c()||I==="reactNative"))return t.results;try{const s=[];for(const i of t.results)s.push(await ke({item:i,canTrack:r}));t.results=s}catch(s){d.error("Could not process A/B tests. ",s)}return t.results};async function Q(e){try{const t=P(e),n=await Ve(e);return Ue(n)?q(e,n):(d.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return d.error("Error fetching data. ",t),null}}function Me(e){const t=e||(c()?window.location.search:void 0);return t?V(t).indexOf("builder.preview=")!==-1:!1}function _e(){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 Y(){return _e().replace(/-/g,"")}const Z="builderSessionId",Fe=async({canTrack:e})=>{if(!e)return;const t=await D({name:Z,canTrack:e});if(p(t))return t;{const n=De();return Ne({id:n,canTrack:e}),n}},De=()=>Y(),Ne=({id:e,canTrack:t})=>N({name:Z,value:e,canTrack:t}),ee=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,je=({key:e,canTrack:t})=>{var n;try{return t?(n=ee())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Ke=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=ee())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},te="builderVisitorId",We=({canTrack:e})=>{if(!e)return;const t=je({key:te,canTrack:e});if(p(t))return t;{const n=$e();return Ge({id:n,canTrack:e}),n}},$e=()=>Y(),Ge=({id:e,canTrack:t})=>Ke({key:te,value:e,canTrack:t}),He=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Fe({canTrack:e}),n=We({canTrack:e});return{sessionId:t,visitorId:n}},ze=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await He({canTrack:t}),userAttributes:_(),ownerId:n}});async function ne(e){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!M()&&(c()||I==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await ze(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const Je=e=>ne({...e,canTrack:!0}),Xe=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function re(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),r=n.hostname;return(e||Xe).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const qe="0.16.3",x={};function oe(e,t){let n=x[e];if(n||(n=x[e]=[]),n.push(t),c()){const r={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const Qe=()=>{oe("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 B=!1;const se=(e={})=>{var t,n;B||(B=!0,c()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:I,version:qe,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",r=>{var s,i;if(!re(e.trustedHosts,r))return;const{data:o}=r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const u=o.data.text,y=o.data.arguments||[],m=o.data.id,v=new Function(u);let l,g=null;try{l=v.apply(null,y)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):l&&typeof l.then=="function"?l.then(h=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:m,result:h}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:l,id:m}},"*");break}}})))},ie=({model:e,trustedHosts:t,callbacks:n})=>r=>{if(!re(t,r))return;const{data:o}=r;if(o)switch(o.type){case"builder.configureSdk":{n.configureSdk(o.data);break}case"builder.triggerAnimation":{n.animation(o.data);break}case"builder.contentUpdate":{const s=o.data,i=s.key||s.alias||s.entry||s.modelName,u=s.data;i===e&&n.contentUpdate(u);break}}},Ye=(e,t,n)=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};se();const r=ie({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},L={};function Ze(e){if(c()){Object.assign(L,e);const t={type:"builder.settingsChange",data:L};parent.postMessage(t,"*")}}const et=async e=>{var r,o,s;const t=e.path||((r=e.url)==null?void 0:r.pathname)||((o=e.userAttributes)==null?void 0:o.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:C(e.searchParams||((s=e.url)==null?void 0:s.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await X(n)}};exports.MSG_PREFIX=b;exports.TARGET=I;exports._processContentResult=q;exports._track=ne;exports.checkIsDefined=p;exports.createEditorListener=ie;exports.createRegisterComponentMessage=Ce;exports.fetch=z;exports.fetchBuilderProps=et;exports.fetchEntries=Q;exports.fetchOneEntry=X;exports.getBuilderSearchParams=C;exports.getDefaultCanTrack=$;exports.getUserAttributes=_;exports.handleABTestingSync=Ee;exports.init=H;exports.isBrowser=c;exports.isEditing=M;exports.isPreviewing=Me;exports.logger=d;exports.register=oe;exports.registerInsertMenu=Qe;exports.serializeComponentInfo=G;exports.setEditorSettings=Ze;exports.setupBrowserForEditing=se;exports.subscribeToEditor=Ye;exports.track=Je;
|