@builder.io/sdk-react-nextjs 0.7.0 → 0.7.1-0

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.
Files changed (37) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-7a3bf41a.mjs +657 -0
  2. package/lib/browser/USE_CLIENT_BUNDLE-9195e6a5.js +23 -0
  3. package/lib/{edge/USE_SERVER_BUNDLE-105e9ef3.js → browser/USE_SERVER_BUNDLE-d7b13097.js} +1 -1
  4. package/lib/browser/USE_SERVER_BUNDLE-e5c2279a.mjs +11 -0
  5. package/lib/browser/{bundle-0fae602b.js → bundle-620ae296.js} +5 -5
  6. package/lib/browser/{bundle-3b073b16.mjs → bundle-7285a09d.mjs} +265 -268
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +7 -7
  9. package/lib/edge/USE_CLIENT_BUNDLE-3cca560e.js +23 -0
  10. package/lib/edge/USE_CLIENT_BUNDLE-4a0cfa69.mjs +657 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-d8c698c8.js → edge/USE_SERVER_BUNDLE-3f12faf4.js} +1 -1
  12. package/lib/edge/USE_SERVER_BUNDLE-f184d7eb.mjs +11 -0
  13. package/lib/edge/{bundle-0c1d9099.js → bundle-a0f5cad2.js} +5 -5
  14. package/lib/edge/{bundle-ed178c62.mjs → bundle-a5949d33.mjs} +265 -268
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +7 -7
  17. package/lib/node/USE_CLIENT_BUNDLE-63c7fe77.js +61 -0
  18. package/lib/node/USE_CLIENT_BUNDLE-d9e90ed7.mjs +747 -0
  19. package/lib/node/USE_SERVER_BUNDLE-22e86776.mjs +11 -0
  20. package/lib/{browser/USE_SERVER_BUNDLE-d8c698c8.js → node/USE_SERVER_BUNDLE-cd844269.js} +1 -1
  21. package/lib/node/{bundle-3b073b16.mjs → bundle-0358b224.mjs} +415 -444
  22. package/lib/node/bundle-630ffe6d.js +76 -0
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +23 -22
  25. package/package.json +5 -3
  26. package/types/blocks/image/image.d.ts +1 -1
  27. package/types/constants/sdk-version.d.ts +1 -1
  28. package/lib/browser/USE_CLIENT_BUNDLE-3a41b1ba.js +0 -23
  29. package/lib/browser/USE_CLIENT_BUNDLE-fc8c1bc0.mjs +0 -618
  30. package/lib/browser/USE_SERVER_BUNDLE-226a15ac.mjs +0 -11
  31. package/lib/edge/USE_CLIENT_BUNDLE-0e9f8e67.mjs +0 -618
  32. package/lib/edge/USE_CLIENT_BUNDLE-d48583e8.js +0 -23
  33. package/lib/edge/USE_SERVER_BUNDLE-f6a1e321.mjs +0 -11
  34. package/lib/node/USE_CLIENT_BUNDLE-3a41b1ba.js +0 -23
  35. package/lib/node/USE_CLIENT_BUNDLE-fc8c1bc0.mjs +0 -618
  36. package/lib/node/USE_SERVER_BUNDLE-226a15ac.mjs +0 -11
  37. package/lib/node/bundle-0fae602b.js +0 -76
@@ -1,7 +1,8 @@
1
+ import "isolated-vm";
1
2
  import { LRUCache as Re } from "lru-cache";
2
3
  import { jsx as l, Fragment as x, jsxs as w } from "react/jsx-runtime";
3
4
  import { createElement as Ee } from "react";
4
- import { I as Ae, B as q, a as Ve, b as $e, C as Be, E as Pe, F as Fe, c as Oe, d as We, S as Ne, V as Le, e as Me } from "./USE_CLIENT_BUNDLE-fc8c1bc0.mjs";
5
+ import { e as Ae, I as Ve, B as q, a as $e, b as Be, C as Pe, E as Fe, F as Oe, c as We, d as Ne, S as Le, V as Me, f as Ue } from "./USE_CLIENT_BUNDLE-d9e90ed7.mjs";
5
6
  import "next/navigation";
6
7
  const A = (e) => JSON.parse(JSON.stringify(e)), ae = {
7
8
  small: {
@@ -54,20 +55,20 @@ const A = (e) => JSON.parse(JSON.stringify(e)), ae = {
54
55
  function v() {
55
56
  return typeof window < "u" && typeof document < "u";
56
57
  }
57
- function Ue() {
58
+ function _e() {
58
59
  return v() && window.self !== window.top;
59
60
  }
60
61
  function L() {
61
- return Ue() && window.location.search.indexOf("builder.frameEditing=") !== -1;
62
+ return _e() && window.location.search.indexOf("builder.frameEditing=") !== -1;
62
63
  }
63
- const _e = () => {
64
+ const je = () => {
64
65
  if (v()) {
65
66
  const e = new URL(location.href);
66
67
  return e.pathname === "" && (e.pathname = "/"), e;
67
68
  } else
68
69
  return console.warn("Cannot get location for tracking in non-browser environment"), null;
69
- }, je = () => typeof navigator == "object" && navigator.userAgent || "", ce = () => {
70
- const e = je(), t = {
70
+ }, Ke = () => typeof navigator == "object" && navigator.userAgent || "", ce = () => {
71
+ const e = Ke(), t = {
71
72
  Android() {
72
73
  return e.match(/Android/i);
73
74
  },
@@ -86,13 +87,13 @@ const _e = () => {
86
87
  any() {
87
88
  return t.Android() || t.BlackBerry() || t.iOS() || t.Opera() || t.Windows() || I === "reactNative";
88
89
  }
89
- }, n = e.match(/Tablet|iPad/i), o = _e();
90
+ }, n = e.match(/Tablet|iPad/i), o = je();
90
91
  return {
91
92
  urlPath: o == null ? void 0 : o.pathname,
92
93
  host: (o == null ? void 0 : o.host) || (o == null ? void 0 : o.hostname),
93
94
  device: n ? "tablet" : t.any() ? "mobile" : "desktop"
94
95
  };
95
- }, Ke = ({
96
+ }, Fn = ({
96
97
  builder: e,
97
98
  context: t,
98
99
  event: n,
@@ -104,35 +105,7 @@ const _e = () => {
104
105
  builder: e,
105
106
  context: t,
106
107
  event: n
107
- }), He = ({
108
- code: e,
109
- builder: t,
110
- context: n,
111
- event: o,
112
- localState: i,
113
- rootSetState: r,
114
- rootState: a
115
- }) => {
116
- const c = Ke({
117
- builder: t,
118
- context: n,
119
- event: o,
120
- state: De(a, i, r)
121
- });
122
- return new Function(...c.map(([s]) => s), e)(...c.map(([, s]) => s));
123
- };
124
- function De(e, t, n) {
125
- if (e === t)
126
- throw new Error("rootState === localState");
127
- return new Proxy(e, {
128
- get: (o, i) => t && i in t ? t[i] : e[i],
129
- set: (o, i, r) => {
130
- if (t && i in t)
131
- throw new Error("Writing to local state is not allowed as it is read-only.");
132
- return e[i] = r, n == null || n(e), !0;
133
- }
134
- });
135
- }
108
+ });
136
109
  function M({
137
110
  code: e,
138
111
  context: t,
@@ -161,7 +134,7 @@ function M({
161
134
  localState: n
162
135
  };
163
136
  try {
164
- return He(f);
137
+ return Ae(f);
165
138
  } catch (g) {
166
139
  k.error("Failed code evaluation: " + g.message, {
167
140
  code: e
@@ -169,13 +142,13 @@ function M({
169
142
  return;
170
143
  }
171
144
  }
172
- const ze = (e, t, n) => {
145
+ const He = (e, t, n) => {
173
146
  if (Object(e) !== e)
174
147
  return e;
175
148
  const o = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
176
149
  return o.slice(0, -1).reduce((i, r, a) => Object(i[r]) === i[r] ? i[r] : i[r] = Math.abs(Number(o[a + 1])) >> 0 === +o[a + 1] ? [] : {}, e)[o[o.length - 1]] = n, e;
177
150
  };
178
- const qe = ({
151
+ const De = ({
179
152
  block: e,
180
153
  context: t,
181
154
  localState: n,
@@ -201,7 +174,7 @@ const qe = ({
201
174
  rootSetState: i,
202
175
  context: t
203
176
  });
204
- ze(a, c, u);
177
+ He(a, c, u);
205
178
  }
206
179
  return a;
207
180
  };
@@ -214,7 +187,7 @@ function E({
214
187
  rootSetState: r
215
188
  }) {
216
189
  const a = e;
217
- return n ? qe({
190
+ return n ? De({
218
191
  block: a,
219
192
  localState: o,
220
193
  rootState: i,
@@ -222,17 +195,17 @@ function E({
222
195
  context: t
223
196
  }) : a;
224
197
  }
225
- const Ge = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), C = (e) => e != null, le = (e) => Object.entries(e).map(([n, o]) => {
198
+ const ze = (e) => e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase(), C = (e) => e != null, le = (e) => Object.entries(e).map(([n, o]) => {
226
199
  if (typeof o == "string")
227
- return `${Ge(n)}: ${o};`;
228
- }).filter(C), Je = (e) => le(e).join(`
200
+ return `${ze(n)}: ${o};`;
201
+ }).filter(C), qe = (e) => le(e).join(`
229
202
  `), B = ({
230
203
  mediaQuery: e,
231
204
  className: t,
232
205
  styles: n
233
206
  }) => {
234
207
  const o = `.${t} {
235
- ${Je(n)}
208
+ ${qe(n)}
236
209
  }`;
237
210
  return e ? `${e} {
238
211
  ${o}
@@ -288,7 +261,7 @@ function U(e) {
288
261
  };
289
262
  return /* @__PURE__ */ l(x, { children: n() && t() ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(V, { styles: n() }) }) : null });
290
263
  }
291
- function Ye(e) {
264
+ function Ge(e) {
292
265
  var t;
293
266
  return {
294
267
  ...(t = e.component) == null ? void 0 : t.options,
@@ -299,7 +272,7 @@ function Ye(e) {
299
272
  builderBlock: e
300
273
  };
301
274
  }
302
- const Xe = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"], P = (e) => typeof e == "string" && Xe.includes(e.toLowerCase()), Qe = ({
275
+ const Je = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"], P = (e) => typeof e == "string" && Je.includes(e.toLowerCase()), Ye = ({
303
276
  block: e,
304
277
  context: t,
305
278
  registeredComponents: n
@@ -321,7 +294,7 @@ const Xe = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen"
321
294
  console.warn(`
322
295
  Could not find a registered component named "${o}".
323
296
  If you registered it, is the file that registered it imported by the file that needs to render it?`);
324
- }, Ze = ({
297
+ }, Xe = ({
325
298
  block: e,
326
299
  context: t
327
300
  }) => {
@@ -355,7 +328,7 @@ const Xe = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen"
355
328
  block: o
356
329
  }));
357
330
  };
358
- function et(e) {
331
+ function Qe(e) {
359
332
  const t = e.repeatContext;
360
333
  return /* @__PURE__ */ l(
361
334
  $,
@@ -366,10 +339,10 @@ function et(e) {
366
339
  }
367
340
  );
368
341
  }
369
- function tt(e) {
342
+ function Ze(e) {
370
343
  return e.charAt(0).toUpperCase() + e.slice(1);
371
344
  }
372
- const nt = (e) => `on${tt(e)}`, ot = (e, t) => (n) => M({
345
+ const et = (e) => `on${Ze(e)}`, tt = (e, t) => (n) => M({
373
346
  code: e,
374
347
  context: t.context,
375
348
  localState: t.localState,
@@ -384,7 +357,7 @@ function On(e) {
384
357
  if (!n.hasOwnProperty(o))
385
358
  continue;
386
359
  const i = n[o];
387
- let r = nt(o);
360
+ let r = et(o);
388
361
  if (e.stripPrefix)
389
362
  switch (I) {
390
363
  case "vue2":
@@ -395,31 +368,31 @@ function On(e) {
395
368
  r = r.replace("on:", "");
396
369
  break;
397
370
  }
398
- t[r] = ot(i, e);
371
+ t[r] = tt(i, e);
399
372
  }
400
373
  return t;
401
374
  }
402
- function it(e) {
375
+ function nt(e) {
403
376
  return e.className = e.class, delete e.class, e;
404
377
  }
405
- const rt = (e) => ({
378
+ const ot = (e) => ({
406
379
  href: e.href
407
380
  });
408
- function at({
381
+ function it({
409
382
  block: e,
410
383
  context: t
411
384
  }) {
412
385
  var o;
413
386
  const n = {
414
- ...rt(e),
387
+ ...ot(e),
415
388
  ...e.properties,
416
389
  "builder-id": e.id,
417
- style: e.style ? st(e.style) : void 0,
390
+ style: e.style ? rt(e.style) : void 0,
418
391
  class: [e.id, "builder-block", e.class, (o = e.properties) == null ? void 0 : o.class].filter(Boolean).join(" ")
419
392
  };
420
- return it(n);
393
+ return nt(n);
421
394
  }
422
- function st(e) {
395
+ function rt(e) {
423
396
  switch (I) {
424
397
  case "svelte":
425
398
  case "vue2":
@@ -433,7 +406,7 @@ function st(e) {
433
406
  return e;
434
407
  }
435
408
  }
436
- const ct = ({
409
+ const at = ({
437
410
  componentOptions: e,
438
411
  builderBlock: t,
439
412
  context: n,
@@ -453,7 +426,7 @@ const ct = ({
453
426
  * component itself directly. Otherwise, they are provided to the wrapper element.
454
427
  */
455
428
  ...i ? {
456
- attributes: at({
429
+ attributes: it({
457
430
  block: t,
458
431
  context: a
459
432
  })
@@ -461,11 +434,11 @@ const ct = ({
461
434
  };
462
435
  function J(e) {
463
436
  var n, o;
464
- const t = e.isInteractive ? Ae : e.componentRef;
437
+ const t = e.isInteractive ? Ve : e.componentRef;
465
438
  return /* @__PURE__ */ l(x, { children: e.componentRef ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ w(
466
439
  t,
467
440
  {
468
- ...ct({
441
+ ...at({
469
442
  componentOptions: e.componentOptions,
470
443
  builderBlock: e.builderBlock,
471
444
  context: e.context,
@@ -499,13 +472,13 @@ function J(e) {
499
472
  function $(e) {
500
473
  var u, f, g, p;
501
474
  const t = function() {
502
- return Qe({
475
+ return Ye({
503
476
  block: e.block,
504
477
  context: e.context,
505
478
  registeredComponents: e.registeredComponents
506
479
  });
507
480
  }, n = function() {
508
- return Ze({
481
+ return Xe({
509
482
  block: e.block,
510
483
  context: e.context
511
484
  });
@@ -531,7 +504,7 @@ function $(e) {
531
504
  blockChildren: o().children ?? [],
532
505
  componentRef: (h = t()) == null ? void 0 : h.component,
533
506
  componentOptions: {
534
- ...Ye(o()),
507
+ ...Ge(o()),
535
508
  builderContext: e.context,
536
509
  ...((d = t()) == null ? void 0 : d.name) === "Symbol" || ((b = t()) == null ? void 0 : b.name) === "Columns" ? {
537
510
  builderComponents: e.registeredComponents
@@ -555,7 +528,7 @@ function $(e) {
555
528
  }
556
529
  ) }) : null,
557
530
  !P(i()) && n() ? /* @__PURE__ */ l(x, { children: (f = n()) == null ? void 0 : f.map((m, h) => /* @__PURE__ */ l(
558
- et,
531
+ Qe,
559
532
  {
560
533
  repeatContext: m.context,
561
534
  block: m.block,
@@ -597,7 +570,7 @@ function $(e) {
597
570
  function _(e) {
598
571
  var t, n;
599
572
  return /* @__PURE__ */ w(
600
- Ve,
573
+ $e,
601
574
  {
602
575
  blocks: e.blocks,
603
576
  parent: e.parent,
@@ -625,7 +598,7 @@ function _(e) {
625
598
  }
626
599
  );
627
600
  }
628
- function lt(e) {
601
+ function st(e) {
629
602
  var m;
630
603
  const t = typeof e.space == "number" ? e.space || 0 : 20, n = e.columns || [], o = e.stackColumnsAt || "tablet", i = function(d) {
631
604
  var b;
@@ -709,14 +682,14 @@ function lt(e) {
709
682
  /* @__PURE__ */ w(
710
683
  "div",
711
684
  {
712
- className: `builder-columns ${e.builderBlock.id}-breakpoints div-119431c8`,
685
+ className: `builder-columns ${e.builderBlock.id}-breakpoints div-666689ca`,
713
686
  style: u(),
714
687
  children: [
715
688
  /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(V, { styles: p() }) }),
716
689
  (m = e.columns) == null ? void 0 : m.map((h, d) => /* @__PURE__ */ Ee(
717
690
  "div",
718
691
  {
719
- className: "builder-column div-119431c8-2",
692
+ className: "builder-column div-666689ca-2",
720
693
  style: f(d),
721
694
  key: d
722
695
  },
@@ -737,10 +710,10 @@ function lt(e) {
737
710
  ]
738
711
  }
739
712
  ),
740
- /* @__PURE__ */ l("style", { children: `.div-119431c8 {
713
+ /* @__PURE__ */ l("style", { children: `.div-666689ca {
741
714
  display: flex;
742
715
  line-height: normal;
743
- }.div-119431c8-2 {
716
+ }.div-666689ca-2 {
744
717
  display: flex;
745
718
  flex-direction: column;
746
719
  align-items: stretch;
@@ -750,11 +723,11 @@ function lt(e) {
750
723
  function Y(e) {
751
724
  return e.replace(/http(s)?:/, "");
752
725
  }
753
- function ut(e = "", t, n) {
726
+ function ct(e = "", t, n) {
754
727
  const o = new RegExp("([?&])" + t + "=.*?(&|$)", "i"), i = e.indexOf("?") !== -1 ? "&" : "?";
755
728
  return e.match(o) ? e.replace(o, "$1" + t + "=" + encodeURIComponent(n) + "$2") : e + i + t + "=" + encodeURIComponent(n);
756
729
  }
757
- function dt(e, t) {
730
+ function lt(e, t) {
758
731
  if (!e || !(e != null && e.match(/cdn\.shopify\.com/)) || !t)
759
732
  return e;
760
733
  if (t === "master")
@@ -773,19 +746,19 @@ function Wn(e) {
773
746
  if (e.match(/builder\.io/)) {
774
747
  let n = e;
775
748
  const o = Number(e.split("?width=")[1]);
776
- return isNaN(o) || (n = `${n} ${o}w`), t.filter((i) => i !== o).map((i) => `${ut(e, "width", i)} ${i}w`).concat([n]).join(", ");
749
+ return isNaN(o) || (n = `${n} ${o}w`), t.filter((i) => i !== o).map((i) => `${ct(e, "width", i)} ${i}w`).concat([n]).join(", ");
777
750
  }
778
- return e.match(/cdn\.shopify\.com/) ? t.map((n) => [dt(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, o]) => `${n} ${o}w`).concat([e]).join(", ") : e;
751
+ return e.match(/cdn\.shopify\.com/) ? t.map((n) => [lt(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, o]) => `${n} ${o}w`).concat([e]).join(", ") : e;
779
752
  }
780
753
  const R = (e) => Object.values((e == null ? void 0 : e.variations) || {}).map((t) => ({
781
754
  ...t,
782
755
  testVariationId: t.id,
783
756
  id: e == null ? void 0 : e.id
784
- })), mt = ({
757
+ })), ut = ({
785
758
  canTrack: e,
786
759
  content: t
787
760
  }) => !(!(R(t).length > 0) || !e || v());
788
- function ft(e, t, n) {
761
+ function dt(e, t, n) {
789
762
  var a;
790
763
  function o() {
791
764
  function c(h, d, b) {
@@ -832,7 +805,7 @@ function ft(e, t, n) {
832
805
  r.innerHTML = c;
833
806
  }
834
807
  }
835
- function ht(e, t, n) {
808
+ function mt(e, t, n) {
836
809
  var s;
837
810
  if (!navigator.cookieEnabled)
838
811
  return;
@@ -857,18 +830,18 @@ function ht(e, t, n) {
857
830
  return;
858
831
  }
859
832
  }
860
- const gt = (e) => e === "react" || e === "reactNative", ue = gt(I), de = "builderIoAbTest", me = "builderIoRenderContent", pt = () => {
861
- const e = ft.toString().replace(/\s+/g, " "), t = ht.toString().replace(/\s+/g, " ");
833
+ const ft = (e) => e === "react" || e === "reactNative", ue = ft(I), de = "builderIoAbTest", me = "builderIoRenderContent", ht = () => {
834
+ const e = dt.toString().replace(/\s+/g, " "), t = mt.toString().replace(/\s+/g, " ");
862
835
  return `
863
836
  window.${de} = ${e}
864
837
  window.${me} = ${t}
865
838
  `;
866
- }, bt = (e, t) => `
867
- window.${de}("${t}",${JSON.stringify(e)}, ${ue})`, yt = ({
839
+ }, gt = (e, t) => `
840
+ window.${de}("${t}",${JSON.stringify(e)}, ${ue})`, pt = ({
868
841
  contentId: e,
869
842
  variationId: t
870
843
  }) => `
871
- window.${me}("${t}", "${e}", ${ue})`, xt = {
844
+ window.${me}("${t}", "${e}", ${ue})`, bt = {
872
845
  name: "Core:Button",
873
846
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
874
847
  defaultStyles: {
@@ -901,7 +874,7 @@ const gt = (e) => e === "react" || e === "reactNative", ue = gt(I), de = "builde
901
874
  }],
902
875
  static: !0,
903
876
  noWrap: !0
904
- }, St = {
877
+ }, yt = {
905
878
  // TODO: ways to statically preprocess JSON for references, functions, etc
906
879
  name: "Columns",
907
880
  isRSC: !0,
@@ -1102,13 +1075,13 @@ const gt = (e) => e === "react" || e === "reactNative", ue = gt(I), de = "builde
1102
1075
  helperText: "When stacking columns for mobile devices, reverse the ordering",
1103
1076
  advanced: !0
1104
1077
  }]
1105
- }, vt = {
1078
+ }, xt = {
1106
1079
  name: "Fragment",
1107
1080
  static: !0,
1108
1081
  hidden: !0,
1109
1082
  canHaveChildren: !0,
1110
1083
  noWrap: !0
1111
- }, kt = {
1084
+ }, St = {
1112
1085
  name: "Image",
1113
1086
  static: !0,
1114
1087
  image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
@@ -1208,7 +1181,7 @@ const gt = (e) => e === "react" || e === "reactNative", ue = gt(I), de = "builde
1208
1181
  advanced: !0,
1209
1182
  defaultValue: 0.7041
1210
1183
  }]
1211
- }, wt = {
1184
+ }, vt = {
1212
1185
  name: "Core:Section",
1213
1186
  static: !0,
1214
1187
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
@@ -1247,7 +1220,7 @@ const gt = (e) => e === "react" || e === "reactNative", ue = gt(I), de = "builde
1247
1220
  }
1248
1221
  }
1249
1222
  }]
1250
- }, Ct = {
1223
+ }, kt = {
1251
1224
  name: "Symbol",
1252
1225
  noWrap: !0,
1253
1226
  static: !0,
@@ -1280,7 +1253,7 @@ const gt = (e) => e === "react" || e === "reactNative", ue = gt(I), de = "builde
1280
1253
  hideFromUI: !0,
1281
1254
  type: "boolean"
1282
1255
  }]
1283
- }, It = {
1256
+ }, wt = {
1284
1257
  name: "Text",
1285
1258
  static: !0,
1286
1259
  isRSC: !0,
@@ -1299,7 +1272,7 @@ const gt = (e) => e === "react" || e === "reactNative", ue = gt(I), de = "builde
1299
1272
  textAlign: "center"
1300
1273
  }
1301
1274
  };
1302
- function Tt(e) {
1275
+ function Ct(e) {
1303
1276
  var t;
1304
1277
  return /* @__PURE__ */ l(
1305
1278
  "div",
@@ -1312,7 +1285,7 @@ function Tt(e) {
1312
1285
  }
1313
1286
  );
1314
1287
  }
1315
- const Rt = {
1288
+ const It = {
1316
1289
  name: "Video",
1317
1290
  canHaveChildren: !0,
1318
1291
  defaultStyles: {
@@ -1393,7 +1366,7 @@ const Rt = {
1393
1366
  defaultValue: !0,
1394
1367
  advanced: !0
1395
1368
  }]
1396
- }, Et = {
1369
+ }, Tt = {
1397
1370
  name: "Embed",
1398
1371
  static: !0,
1399
1372
  inputs: [{
@@ -1418,7 +1391,7 @@ const Rt = {
1418
1391
  defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
1419
1392
  hideFromUI: !0
1420
1393
  }]
1421
- }, At = ["text/javascript", "application/javascript", "application/ecmascript"], Nn = (e) => At.includes(e.type), Vt = {
1394
+ }, Rt = ["text/javascript", "application/javascript", "application/ecmascript"], Nn = (e) => Rt.includes(e.type), Et = {
1422
1395
  // friendlyName?
1423
1396
  name: "Raw:Img",
1424
1397
  hideFromInsertMenu: !0,
@@ -1432,7 +1405,7 @@ const Rt = {
1432
1405
  }],
1433
1406
  noWrap: !0,
1434
1407
  static: !0
1435
- }, $t = {
1408
+ }, At = {
1436
1409
  name: "Custom Code",
1437
1410
  static: !0,
1438
1411
  requiredPermissions: ["editCode"],
@@ -1455,54 +1428,54 @@ const Rt = {
1455
1428
  advanced: !0
1456
1429
  }]
1457
1430
  }, X = () => [{
1458
- component: $e,
1459
- ...xt
1460
- }, {
1461
- component: lt,
1462
- ...St
1463
- }, {
1464
1431
  component: Be,
1465
- ...$t
1432
+ ...bt
1433
+ }, {
1434
+ component: st,
1435
+ ...yt
1466
1436
  }, {
1467
1437
  component: Pe,
1468
- ...Et
1438
+ ...At
1469
1439
  }, {
1470
1440
  component: Fe,
1471
- ...vt
1441
+ ...Tt
1472
1442
  }, {
1473
1443
  component: Oe,
1474
- ...kt
1444
+ ...xt
1475
1445
  }, {
1476
1446
  component: We,
1477
- ...Vt
1447
+ ...St
1478
1448
  }, {
1479
1449
  component: Ne,
1480
- ...wt
1450
+ ...Et
1481
1451
  }, {
1482
- component: xn,
1483
- ...Ct
1452
+ component: Le,
1453
+ ...vt
1484
1454
  }, {
1485
- component: Tt,
1486
- ...It
1455
+ component: Tn,
1456
+ ...kt
1487
1457
  }, {
1488
- component: Le,
1489
- ...Rt
1458
+ component: Ct,
1459
+ ...wt
1460
+ }, {
1461
+ component: Me,
1462
+ ...It
1490
1463
  }], Q = [], Ln = (e) => ({
1491
1464
  type: "builder.registerComponent",
1492
1465
  data: F(e)
1493
- }), Bt = (e) => {
1466
+ }), Vt = (e) => {
1494
1467
  const t = e.toString().trim();
1495
1468
  return `return (${!t.startsWith("function") && !t.startsWith("(") ? "function " : ""}${t}).apply(this, arguments)`;
1496
- }, Pt = (e) => typeof e == "function" ? Bt(e) : A(e), F = ({
1469
+ }, $t = (e) => typeof e == "function" ? Vt(e) : A(e), F = ({
1497
1470
  inputs: e,
1498
1471
  ...t
1499
1472
  }) => ({
1500
1473
  ...A(t),
1501
1474
  inputs: e == null ? void 0 : e.map((n) => Object.entries(n).reduce((o, [i, r]) => ({
1502
1475
  ...o,
1503
- [i]: Pt(r)
1476
+ [i]: $t(r)
1504
1477
  }), {}))
1505
- }), Ft = (e) => {
1478
+ }), Bt = (e) => {
1506
1479
  var r;
1507
1480
  const t = e.family + (e.kind && !e.kind.includes("#") ? ", " + e.kind : ""), n = t.split(",")[0], o = e.fileUrl ?? ((r = e == null ? void 0 : e.files) == null ? void 0 : r.regular);
1508
1481
  let i = "";
@@ -1528,22 +1501,22 @@ font-weight: ${a};
1528
1501
  `.trim());
1529
1502
  }
1530
1503
  return i;
1531
- }, Ot = ({
1504
+ }, Pt = ({
1532
1505
  customFonts: e
1533
1506
  }) => {
1534
1507
  var t;
1535
- return ((t = e == null ? void 0 : e.map((n) => Ft(n))) == null ? void 0 : t.join(" ")) || "";
1536
- }, Wt = ({
1508
+ return ((t = e == null ? void 0 : e.map((n) => Bt(n))) == null ? void 0 : t.join(" ")) || "";
1509
+ }, Ft = ({
1537
1510
  cssCode: e,
1538
1511
  contentId: t
1539
1512
  }) => e ? t ? (e == null ? void 0 : e.replace(/&/g, `div[builder-content-id="${t}"]`)) || "" : e : "";
1540
- function Nt(e) {
1513
+ function Ot(e) {
1541
1514
  const t = `
1542
- ${Wt({
1515
+ ${Ft({
1543
1516
  cssCode: e.cssCode,
1544
1517
  contentId: e.contentId
1545
1518
  })}
1546
- ${Ot({
1519
+ ${Pt({
1547
1520
  customFonts: e.customFonts
1548
1521
  })}
1549
1522
 
@@ -1562,7 +1535,7 @@ ${Ot({
1562
1535
  `.trim();
1563
1536
  return /* @__PURE__ */ l(V, { styles: t });
1564
1537
  }
1565
- const Lt = ({
1538
+ const Wt = ({
1566
1539
  content: e,
1567
1540
  data: t,
1568
1541
  locale: n
@@ -1584,7 +1557,7 @@ const Lt = ({
1584
1557
  ...o,
1585
1558
  ...i
1586
1559
  };
1587
- }, Mt = ({
1560
+ }, Nt = ({
1588
1561
  content: e,
1589
1562
  data: t
1590
1563
  }) => e ? {
@@ -1595,17 +1568,17 @@ const Lt = ({
1595
1568
  },
1596
1569
  meta: e == null ? void 0 : e.meta
1597
1570
  } : void 0;
1598
- function Ut() {
1571
+ function Lt() {
1599
1572
  return typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : globalThis;
1600
1573
  }
1601
- function _t() {
1602
- const e = Ut().fetch;
1574
+ function Mt() {
1575
+ const e = Lt().fetch;
1603
1576
  if (typeof e > "u")
1604
1577
  throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
1605
1578
  For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
1606
1579
  return e;
1607
1580
  }
1608
- const jt = _t(), Kt = (e) => {
1581
+ const Ut = Mt(), _t = (e) => {
1609
1582
  if (e === "localhost" || e === "127.0.0.1")
1610
1583
  return e;
1611
1584
  const t = e.split(".");
@@ -1621,13 +1594,13 @@ const jt = _t(), Kt = (e) => {
1621
1594
  k.warn("[COOKIE] GET error: ", (o == null ? void 0 : o.message) || o);
1622
1595
  return;
1623
1596
  }
1624
- }, he = async (e) => fe(e), Ht = (e) => e.map(([t, n]) => n ? `${t}=${n}` : t).filter(C).join("; "), Dt = [["secure", ""], ["SameSite", "None"]], zt = ({
1597
+ }, he = async (e) => fe(e), jt = (e) => e.map(([t, n]) => n ? `${t}=${n}` : t).filter(C).join("; "), Kt = [["secure", ""], ["SameSite", "None"]], Ht = ({
1625
1598
  name: e,
1626
1599
  value: t,
1627
1600
  expires: n
1628
1601
  }) => {
1629
- const i = (v() ? location.protocol === "https:" : !0) ? Dt : [[]], r = n ? [["expires", n.toUTCString()]] : [[]], a = [[e, t], ...r, ["path", "/"], ["domain", Kt(window.location.hostname)], ...i];
1630
- return Ht(a);
1602
+ const i = (v() ? location.protocol === "https:" : !0) ? Kt : [[]], r = n ? [["expires", n.toUTCString()]] : [[]], a = [[e, t], ...r, ["path", "/"], ["domain", _t(window.location.hostname)], ...i];
1603
+ return jt(a);
1631
1604
  }, ge = async ({
1632
1605
  name: e,
1633
1606
  value: t,
@@ -1637,7 +1610,7 @@ const jt = _t(), Kt = (e) => {
1637
1610
  try {
1638
1611
  if (!o)
1639
1612
  return;
1640
- const i = zt({
1613
+ const i = Ht({
1641
1614
  name: e,
1642
1615
  value: t,
1643
1616
  expires: n
@@ -1647,16 +1620,16 @@ const jt = _t(), Kt = (e) => {
1647
1620
  k.warn("[COOKIE] SET error: ", (i == null ? void 0 : i.message) || i);
1648
1621
  }
1649
1622
  };
1650
- function qt() {
1623
+ function Dt() {
1651
1624
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
1652
1625
  const t = Math.random() * 16 | 0;
1653
1626
  return (e == "x" ? t : t & 3 | 8).toString(16);
1654
1627
  });
1655
1628
  }
1656
1629
  function pe() {
1657
- return qt().replace(/-/g, "");
1630
+ return Dt().replace(/-/g, "");
1658
1631
  }
1659
- const be = "builderSessionId", Gt = async ({
1632
+ const be = "builderSessionId", zt = async ({
1660
1633
  canTrack: e
1661
1634
  }) => {
1662
1635
  if (!e)
@@ -1668,20 +1641,20 @@ const be = "builderSessionId", Gt = async ({
1668
1641
  if (C(t))
1669
1642
  return t;
1670
1643
  {
1671
- const n = Jt();
1672
- return Yt({
1644
+ const n = qt();
1645
+ return Gt({
1673
1646
  id: n,
1674
1647
  canTrack: e
1675
1648
  }), n;
1676
1649
  }
1677
- }, Jt = () => pe(), Yt = ({
1650
+ }, qt = () => pe(), Gt = ({
1678
1651
  id: e,
1679
1652
  canTrack: t
1680
1653
  }) => ge({
1681
1654
  name: be,
1682
1655
  value: e,
1683
1656
  canTrack: t
1684
- }), ye = () => v() && typeof localStorage < "u" ? localStorage : void 0, Xt = ({
1657
+ }), ye = () => v() && typeof localStorage < "u" ? localStorage : void 0, Jt = ({
1685
1658
  key: e,
1686
1659
  canTrack: t
1687
1660
  }) => {
@@ -1692,7 +1665,7 @@ const be = "builderSessionId", Gt = async ({
1692
1665
  console.debug("[LocalStorage] GET error: ", o);
1693
1666
  return;
1694
1667
  }
1695
- }, Qt = ({
1668
+ }, Yt = ({
1696
1669
  key: e,
1697
1670
  canTrack: t,
1698
1671
  value: n
@@ -1703,32 +1676,32 @@ const be = "builderSessionId", Gt = async ({
1703
1676
  } catch (i) {
1704
1677
  console.debug("[LocalStorage] SET error: ", i);
1705
1678
  }
1706
- }, xe = "builderVisitorId", Zt = ({
1679
+ }, xe = "builderVisitorId", Xt = ({
1707
1680
  canTrack: e
1708
1681
  }) => {
1709
1682
  if (!e)
1710
1683
  return;
1711
- const t = Xt({
1684
+ const t = Jt({
1712
1685
  key: xe,
1713
1686
  canTrack: e
1714
1687
  });
1715
1688
  if (C(t))
1716
1689
  return t;
1717
1690
  {
1718
- const n = en();
1719
- return tn({
1691
+ const n = Qt();
1692
+ return Zt({
1720
1693
  id: n,
1721
1694
  canTrack: e
1722
1695
  }), n;
1723
1696
  }
1724
- }, en = () => pe(), tn = ({
1697
+ }, Qt = () => pe(), Zt = ({
1725
1698
  id: e,
1726
1699
  canTrack: t
1727
- }) => Qt({
1700
+ }) => Yt({
1728
1701
  key: xe,
1729
1702
  value: e,
1730
1703
  canTrack: t
1731
- }), nn = async ({
1704
+ }), en = async ({
1732
1705
  canTrack: e
1733
1706
  }) => {
1734
1707
  if (!e)
@@ -1736,16 +1709,16 @@ const be = "builderSessionId", Gt = async ({
1736
1709
  visitorId: void 0,
1737
1710
  sessionId: void 0
1738
1711
  };
1739
- const t = await Gt({
1712
+ const t = await zt({
1740
1713
  canTrack: e
1741
- }), n = Zt({
1714
+ }), n = Xt({
1742
1715
  canTrack: e
1743
1716
  });
1744
1717
  return {
1745
1718
  sessionId: t,
1746
1719
  visitorId: n
1747
1720
  };
1748
- }, on = async ({
1721
+ }, tn = async ({
1749
1722
  type: e,
1750
1723
  canTrack: t,
1751
1724
  apiKey: n,
@@ -1759,14 +1732,14 @@ const be = "builderSessionId", Gt = async ({
1759
1732
  url: location.href,
1760
1733
  ...o
1761
1734
  },
1762
- ...await nn({
1735
+ ...await en({
1763
1736
  canTrack: t
1764
1737
  }),
1765
1738
  userAttributes: ce(),
1766
1739
  ownerId: n
1767
1740
  }
1768
1741
  });
1769
- async function rn(e) {
1742
+ async function nn(e) {
1770
1743
  if (!e.apiKey) {
1771
1744
  k.error("Missing API key for track call. Please provide your API key.");
1772
1745
  return;
@@ -1775,7 +1748,7 @@ async function rn(e) {
1775
1748
  return fetch("https://cdn.builder.io/api/v1/track", {
1776
1749
  method: "POST",
1777
1750
  body: JSON.stringify({
1778
- events: [await on(e)]
1751
+ events: [await tn(e)]
1779
1752
  }),
1780
1753
  headers: {
1781
1754
  "content-type": "application/json"
@@ -1785,11 +1758,11 @@ async function rn(e) {
1785
1758
  console.error("Failed to track: ", t);
1786
1759
  });
1787
1760
  }
1788
- const Mn = (e) => rn({
1761
+ const Mn = (e) => nn({
1789
1762
  ...e,
1790
1763
  canTrack: !0
1791
- }), an = "0.7.0", Z = {};
1792
- function sn(e, t) {
1764
+ }), on = "0.7.1-0", Z = {};
1765
+ function rn(e, t) {
1793
1766
  let n = Z[e];
1794
1767
  if (n || (n = Z[e] = []), n.push(t), v()) {
1795
1768
  const o = {
@@ -1807,7 +1780,7 @@ function sn(e, t) {
1807
1780
  }
1808
1781
  }
1809
1782
  const Un = () => {
1810
- sn("insertMenu", {
1783
+ rn("insertMenu", {
1811
1784
  name: "_default",
1812
1785
  default: !0,
1813
1786
  items: [{
@@ -1836,7 +1809,7 @@ const _n = (e = {}) => {
1836
1809
  type: "builder.sdkInfo",
1837
1810
  data: {
1838
1811
  target: I,
1839
- version: an,
1812
+ version: on,
1840
1813
  supportsPatchUpdates: !1,
1841
1814
  // Supports builder-model="..." attribute which is needed to
1842
1815
  // scope our '+ add block' button styling
@@ -1892,7 +1865,7 @@ const _n = (e = {}) => {
1892
1865
  function te(e) {
1893
1866
  return Math.round(e * 1e3) / 1e3;
1894
1867
  }
1895
- const cn = (e, t, n = !0) => {
1868
+ const an = (e, t, n = !0) => {
1896
1869
  if (!(e instanceof HTMLElement))
1897
1870
  return null;
1898
1871
  let o = n ? e : e.parentElement;
@@ -1903,7 +1876,7 @@ const cn = (e, t, n = !0) => {
1903
1876
  return o;
1904
1877
  } while (o = o.parentElement);
1905
1878
  return null;
1906
- }, ln = (e) => cn(e, (t) => {
1879
+ }, sn = (e) => an(e, (t) => {
1907
1880
  const n = t.getAttribute("builder-id") || t.id;
1908
1881
  return (n == null ? void 0 : n.indexOf("builder-")) === 0;
1909
1882
  }), ne = ({
@@ -1916,7 +1889,7 @@ const cn = (e, t, n = !0) => {
1916
1889
  y: a
1917
1890
  };
1918
1891
  }, jn = (e) => {
1919
- const t = e.target, n = t && ln(t), o = (n == null ? void 0 : n.getAttribute("builder-id")) || (n == null ? void 0 : n.id);
1892
+ const t = e.target, n = t && sn(t), o = (n == null ? void 0 : n.getAttribute("builder-id")) || (n == null ? void 0 : n.id);
1920
1893
  return {
1921
1894
  targetBuilderElement: o || void 0,
1922
1895
  metadata: {
@@ -1931,16 +1904,235 @@ const cn = (e, t, n = !0) => {
1931
1904
  builderElementIndex: n && o ? [].slice.call(document.getElementsByClassName(o)).indexOf(n) : void 0
1932
1905
  }
1933
1906
  };
1907
+ }, cn = "builder.tests", j = (e) => `${cn}.${e}`, ln = ({
1908
+ contentId: e
1909
+ }) => he({
1910
+ name: j(e),
1911
+ canTrack: !0
1912
+ }), un = ({
1913
+ contentId: e
1914
+ }) => fe({
1915
+ name: j(e),
1916
+ canTrack: !0
1917
+ }), dn = ({
1918
+ contentId: e,
1919
+ value: t
1920
+ }) => ge({
1921
+ name: j(e),
1922
+ value: t,
1923
+ canTrack: !0
1924
+ }), Se = (e) => C(e.id) && C(e.variations) && Object.keys(e.variations).length > 0, mn = ({
1925
+ id: e,
1926
+ variations: t
1927
+ }) => {
1928
+ var i;
1929
+ let n = 0;
1930
+ const o = Math.random();
1931
+ for (const r in t) {
1932
+ const a = (i = t[r]) == null ? void 0 : i.testRatio;
1933
+ if (n += a, o < n)
1934
+ return r;
1935
+ }
1936
+ return e;
1937
+ }, ve = (e) => {
1938
+ const t = mn(e);
1939
+ return dn({
1940
+ contentId: e.id,
1941
+ value: t
1942
+ }).catch((n) => {
1943
+ k.error("could not store A/B test variation: ", n);
1944
+ }), t;
1945
+ }, ke = ({
1946
+ item: e,
1947
+ testGroupId: t
1948
+ }) => {
1949
+ const n = e.variations[t];
1950
+ return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
1951
+ !n ? {
1952
+ testVariationId: e.id,
1953
+ testVariationName: "Default"
1954
+ } : {
1955
+ data: n.data,
1956
+ testVariationId: n.id,
1957
+ testVariationName: n.name || (n.id === e.id ? "Default" : "")
1958
+ };
1959
+ }, fn = ({
1960
+ item: e,
1961
+ canTrack: t
1962
+ }) => {
1963
+ if (!t)
1964
+ return e;
1965
+ if (!e)
1966
+ return;
1967
+ if (!Se(e))
1968
+ return e;
1969
+ const n = un({
1970
+ contentId: e.id
1971
+ }) || ve({
1972
+ variations: e.variations,
1973
+ id: e.id
1974
+ }), o = ke({
1975
+ item: e,
1976
+ testGroupId: n
1977
+ });
1978
+ return {
1979
+ ...e,
1980
+ ...o
1981
+ };
1982
+ }, hn = async ({
1983
+ item: e,
1984
+ canTrack: t
1985
+ }) => {
1986
+ if (!t || !Se(e))
1987
+ return e;
1988
+ const o = await ln({
1989
+ contentId: e.id
1990
+ }) || ve({
1991
+ variations: e.variations,
1992
+ id: e.id
1993
+ }), i = ke({
1994
+ item: e,
1995
+ testGroupId: o
1996
+ });
1997
+ return {
1998
+ ...e,
1999
+ ...i
2000
+ };
2001
+ }, O = (e) => C(e) ? e : !0, gn = (e) => {
2002
+ const t = e.get("preview"), n = e.get("overrides." + t);
2003
+ return n || k.warn("No previewed ID found in search params."), n;
1934
2004
  };
1935
- function un() {
2005
+ function pn() {
1936
2006
  globalThis._BUILDER_PREVIEW_LRU_CACHE || (globalThis._BUILDER_PREVIEW_LRU_CACHE = new Re({
1937
2007
  max: 500,
1938
2008
  // how long to live in ms
1939
2009
  ttl: 1e3 * 60 * 5
1940
2010
  }));
1941
2011
  }
1942
- const O = (e) => C(e) ? e : !0;
1943
- function W(e) {
2012
+ function bn(e) {
2013
+ pn();
2014
+ const t = gn(e);
2015
+ return typeof t == "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t) : void 0;
2016
+ }
2017
+ function W(e, t = null, n = ".") {
2018
+ return Object.keys(e).reduce((o, i) => {
2019
+ const r = e[i], a = [t, i].filter(Boolean).join(n);
2020
+ return [typeof r == "object", r !== null, !(Array.isArray(r) && r.length === 0)].every(Boolean) ? {
2021
+ ...o,
2022
+ ...W(r, a, n)
2023
+ } : {
2024
+ ...o,
2025
+ [a]: r
2026
+ };
2027
+ }, {});
2028
+ }
2029
+ const oe = "builder.", yn = "options.", xn = (e) => {
2030
+ const t = {};
2031
+ return e.forEach((n, o) => {
2032
+ t[o] = n;
2033
+ }), t;
2034
+ }, we = (e) => {
2035
+ if (!e)
2036
+ return {};
2037
+ const t = Ce(e), n = {};
2038
+ return Object.keys(t).forEach((o) => {
2039
+ if (o.startsWith(oe)) {
2040
+ const i = o.replace(oe, "").replace(yn, "");
2041
+ n[i] = t[o];
2042
+ }
2043
+ }), n;
2044
+ }, Sn = () => {
2045
+ if (!v())
2046
+ return {};
2047
+ const e = new URLSearchParams(window.location.search);
2048
+ return we(e);
2049
+ }, Ce = (e) => e instanceof URLSearchParams ? xn(e) : e, vn = "v3", K = (e) => {
2050
+ let {
2051
+ noTraverse: t = !1
2052
+ } = e;
2053
+ const {
2054
+ limit: n = 30,
2055
+ userAttributes: o,
2056
+ query: i,
2057
+ model: r,
2058
+ apiKey: a,
2059
+ includeRefs: c = !0,
2060
+ enrich: s,
2061
+ locale: u,
2062
+ apiVersion: f = vn
2063
+ } = e;
2064
+ if (!a)
2065
+ throw new Error("Missing API key");
2066
+ if (!["v2", "v3"].includes(f))
2067
+ throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
2068
+ (e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
2069
+ const g = new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${c}${u ? `&locale=${u}` : ""}${s ? `&enrich=${s}` : ""}`), p = {
2070
+ ...Sn(),
2071
+ ...Ce(e.options || {})
2072
+ }, m = W(p);
2073
+ for (const h in m)
2074
+ g.searchParams.set(h, String(m[h]));
2075
+ if (o && g.searchParams.set("userAttributes", JSON.stringify(o)), i) {
2076
+ const h = W({
2077
+ query: i
2078
+ });
2079
+ for (const d in h)
2080
+ g.searchParams.set(d, JSON.stringify(h[d]));
2081
+ }
2082
+ return g;
2083
+ }, kn = (e) => "results" in e;
2084
+ async function H(e) {
2085
+ const t = await Ie({
2086
+ ...e,
2087
+ limit: 1
2088
+ });
2089
+ return t && t.results[0] || null;
2090
+ }
2091
+ const Kn = H, wn = async (e) => {
2092
+ const t = K(e);
2093
+ return await (await Ut(t.href)).json();
2094
+ }, Cn = async (e, t, n = K(e)) => {
2095
+ const o = O(e.canTrack);
2096
+ if (n.search.includes("preview=")) {
2097
+ const r = [];
2098
+ for (const a of t.results) {
2099
+ const c = bn(n.searchParams);
2100
+ r.push(c || a);
2101
+ }
2102
+ t.results = r;
2103
+ }
2104
+ if (!o || !(v() || I === "reactNative"))
2105
+ return t;
2106
+ try {
2107
+ const r = [];
2108
+ for (const a of t.results)
2109
+ r.push(await hn({
2110
+ item: a,
2111
+ canTrack: o
2112
+ }));
2113
+ t.results = r;
2114
+ } catch (r) {
2115
+ k.error("Could not process A/B tests. ", r);
2116
+ }
2117
+ return t;
2118
+ };
2119
+ async function Ie(e) {
2120
+ try {
2121
+ const t = K(e), n = await wn(e);
2122
+ return kn(n) ? Cn(e, n) : (k.error("Error fetching data. ", {
2123
+ url: t,
2124
+ content: n,
2125
+ options: e
2126
+ }), null);
2127
+ } catch (t) {
2128
+ return k.error("Error fetching data. ", t), null;
2129
+ }
2130
+ }
2131
+ const Hn = Ie;
2132
+ function Dn() {
2133
+ return !v() || L() ? !1 : location.search.indexOf("builder.preview=") !== -1;
2134
+ }
2135
+ function N(e) {
1944
2136
  return /* @__PURE__ */ l(
1945
2137
  "script",
1946
2138
  {
@@ -1949,9 +2141,9 @@ function W(e) {
1949
2141
  }
1950
2142
  );
1951
2143
  }
1952
- function oe(e) {
2144
+ function ie(e) {
1953
2145
  var i, r, a, c, s, u, f, g, p;
1954
- const t = yt({
2146
+ const t = pt({
1955
2147
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
1956
2148
  variationId: (i = e.content) == null ? void 0 : i.testVariationId,
1957
2149
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
@@ -1975,12 +2167,12 @@ function oe(e) {
1975
2167
  }),
1976
2168
  {}
1977
2169
  ), o = {
1978
- content: Mt({
2170
+ content: Nt({
1979
2171
  content: e.content,
1980
2172
  data: e.data
1981
2173
  }),
1982
2174
  localState: void 0,
1983
- rootState: Lt({
2175
+ rootState: Wt({
1984
2176
  content: e.content,
1985
2177
  data: e.data,
1986
2178
  locale: e.locale
@@ -2008,7 +2200,7 @@ function oe(e) {
2008
2200
  inheritedStyles: {}
2009
2201
  };
2010
2202
  return /* @__PURE__ */ w(
2011
- Me,
2203
+ Ue,
2012
2204
  {
2013
2205
  content: e.content,
2014
2206
  model: e.model,
@@ -2022,9 +2214,9 @@ function oe(e) {
2022
2214
  showContent: e.showContent,
2023
2215
  builderContextSignal: o,
2024
2216
  children: [
2025
- e.isSsrAbTest ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(W, { scriptStr: t }) }) : null,
2217
+ e.isSsrAbTest ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(N, { scriptStr: t }) }) : null,
2026
2218
  /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(
2027
- Nt,
2219
+ Ot,
2028
2220
  {
2029
2221
  contentId: (a = o.content) == null ? void 0 : a.id,
2030
2222
  cssCode: (s = (c = o.content) == null ? void 0 : c.data) == null ? void 0 : s.cssCode,
@@ -2043,109 +2235,14 @@ function oe(e) {
2043
2235
  }
2044
2236
  );
2045
2237
  }
2046
- const dn = "builder.tests", j = (e) => `${dn}.${e}`, mn = ({
2047
- contentId: e
2048
- }) => he({
2049
- name: j(e),
2050
- canTrack: !0
2051
- }), fn = ({
2052
- contentId: e
2053
- }) => fe({
2054
- name: j(e),
2055
- canTrack: !0
2056
- }), hn = ({
2057
- contentId: e,
2058
- value: t
2059
- }) => ge({
2060
- name: j(e),
2061
- value: t,
2062
- canTrack: !0
2063
- }), Se = (e) => C(e.id) && C(e.variations) && Object.keys(e.variations).length > 0, gn = ({
2064
- id: e,
2065
- variations: t
2066
- }) => {
2067
- var i;
2068
- let n = 0;
2069
- const o = Math.random();
2070
- for (const r in t) {
2071
- const a = (i = t[r]) == null ? void 0 : i.testRatio;
2072
- if (n += a, o < n)
2073
- return r;
2074
- }
2075
- return e;
2076
- }, ve = (e) => {
2077
- const t = gn(e);
2078
- return hn({
2079
- contentId: e.id,
2080
- value: t
2081
- }).catch((n) => {
2082
- k.error("could not store A/B test variation: ", n);
2083
- }), t;
2084
- }, ke = ({
2085
- item: e,
2086
- testGroupId: t
2087
- }) => {
2088
- const n = e.variations[t];
2089
- return t === e.id || // handle edge-case where `testGroupId` points to non-existing variation
2090
- !n ? {
2091
- testVariationId: e.id,
2092
- testVariationName: "Default"
2093
- } : {
2094
- data: n.data,
2095
- testVariationId: n.id,
2096
- testVariationName: n.name || (n.id === e.id ? "Default" : "")
2097
- };
2098
- }, pn = ({
2099
- item: e,
2100
- canTrack: t
2101
- }) => {
2102
- if (!t)
2103
- return e;
2104
- if (!e)
2105
- return;
2106
- if (!Se(e))
2107
- return e;
2108
- const n = fn({
2109
- contentId: e.id
2110
- }) || ve({
2111
- variations: e.variations,
2112
- id: e.id
2113
- }), o = ke({
2114
- item: e,
2115
- testGroupId: n
2116
- });
2117
- return {
2118
- ...e,
2119
- ...o
2120
- };
2121
- }, bn = async ({
2122
- item: e,
2123
- canTrack: t
2124
- }) => {
2125
- if (!t || !Se(e))
2126
- return e;
2127
- const o = await mn({
2128
- contentId: e.id
2129
- }) || ve({
2130
- variations: e.variations,
2131
- id: e.id
2132
- }), i = ke({
2133
- item: e,
2134
- testGroupId: o
2135
- });
2136
- return {
2137
- ...e,
2138
- ...i
2139
- };
2140
- };
2141
- function we(e) {
2238
+ function Te(e) {
2142
2239
  var r, a, c;
2143
- const t = mt({
2240
+ const t = ut({
2144
2241
  canTrack: O(e.canTrack),
2145
2242
  content: e.content
2146
2243
  }), n = function() {
2147
2244
  var u;
2148
- return bt(
2245
+ return gt(
2149
2246
  R(e.content).map((f) => ({
2150
2247
  id: f.testVariationId,
2151
2248
  testRatio: f.testRatio
@@ -2159,13 +2256,13 @@ function we(e) {
2159
2256
  return t ? {
2160
2257
  ...e.content,
2161
2258
  testVariationId: (u = e.content) == null ? void 0 : u.id
2162
- } : pn({
2259
+ } : fn({
2163
2260
  item: e.content,
2164
2261
  canTrack: O(e.canTrack)
2165
2262
  });
2166
2263
  };
2167
2264
  return /* @__PURE__ */ w(x, { children: [
2168
- !e.__isNestedRender && I !== "reactNative" ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(W, { scriptStr: pt() }) }) : null,
2265
+ !e.__isNestedRender && I !== "reactNative" ? /* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(N, { scriptStr: ht() }) }) : null,
2169
2266
  t ? /* @__PURE__ */ w(x, { children: [
2170
2267
  /* @__PURE__ */ l(
2171
2268
  V,
@@ -2174,9 +2271,9 @@ function we(e) {
2174
2271
  styles: o()
2175
2272
  }
2176
2273
  ),
2177
- /* @__PURE__ */ l(W, { scriptStr: n() }),
2274
+ /* @__PURE__ */ l(N, { scriptStr: n() }),
2178
2275
  (a = R(e.content)) == null ? void 0 : a.map((s) => /* @__PURE__ */ l(
2179
- oe,
2276
+ ie,
2180
2277
  {
2181
2278
  content: s,
2182
2279
  showContent: !1,
@@ -2197,7 +2294,7 @@ function we(e) {
2197
2294
  ))
2198
2295
  ] }) : null,
2199
2296
  /* @__PURE__ */ l(
2200
- oe,
2297
+ ie,
2201
2298
  {
2202
2299
  content: i(),
2203
2300
  classNameProp: `variant-${(c = e.content) == null ? void 0 : c.id}`,
@@ -2217,7 +2314,7 @@ function we(e) {
2217
2314
  )
2218
2315
  ] });
2219
2316
  }
2220
- const yn = async ({
2317
+ const In = async ({
2221
2318
  builderContextValue: e,
2222
2319
  symbol: t
2223
2320
  }) => {
@@ -2236,7 +2333,7 @@ const yn = async ({
2236
2333
  k.error("Could not fetch symbol content: ", n);
2237
2334
  });
2238
2335
  };
2239
- async function xn(e) {
2336
+ async function Tn(e) {
2240
2337
  var o, i, r, a;
2241
2338
  const t = function() {
2242
2339
  var s, u;
@@ -2246,12 +2343,12 @@ async function xn(e) {
2246
2343
  (s = e.symbol) != null && s.inline ? "builder-inline-symbol" : void 0,
2247
2344
  (u = e.symbol) != null && u.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
2248
2345
  ].filter(Boolean).join(" ");
2249
- }, n = ((o = e.symbol) == null ? void 0 : o.content) || await yn({
2346
+ }, n = ((o = e.symbol) == null ? void 0 : o.content) || await In({
2250
2347
  symbol: e.symbol,
2251
2348
  builderContextValue: e.builderContext
2252
2349
  });
2253
2350
  return /* @__PURE__ */ l("div", { ...e.attributes, className: t(), children: /* @__PURE__ */ l(
2254
- we,
2351
+ Te,
2255
2352
  {
2256
2353
  __isNestedRender: !0,
2257
2354
  apiVersion: e.builderContext.apiVersion,
@@ -2268,145 +2365,18 @@ async function xn(e) {
2268
2365
  }
2269
2366
  ) });
2270
2367
  }
2271
- const Kn = _, Hn = we;
2272
- function Dn() {
2273
- return !v() || L() ? !1 : location.search.indexOf("builder.preview=") !== -1;
2274
- }
2275
- const ie = {};
2276
- function zn(e) {
2368
+ const zn = _, qn = Te, re = {};
2369
+ function Gn(e) {
2277
2370
  if (v()) {
2278
- Object.assign(ie, e);
2371
+ Object.assign(re, e);
2279
2372
  const t = {
2280
2373
  type: "builder.settingsChange",
2281
- data: ie
2374
+ data: re
2282
2375
  };
2283
2376
  parent.postMessage(t, "*");
2284
2377
  }
2285
2378
  }
2286
- const Sn = (e) => {
2287
- const t = e.get("preview"), n = e.get("overrides." + t);
2288
- return n || k.warn("No previewed ID found in search params."), n;
2289
- };
2290
- function vn(e) {
2291
- un();
2292
- const t = Sn(e);
2293
- return typeof t == "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t) : void 0;
2294
- }
2295
- function N(e, t = null, n = ".") {
2296
- return Object.keys(e).reduce((o, i) => {
2297
- const r = e[i], a = [t, i].filter(Boolean).join(n);
2298
- return [typeof r == "object", r !== null, !(Array.isArray(r) && r.length === 0)].every(Boolean) ? {
2299
- ...o,
2300
- ...N(r, a, n)
2301
- } : {
2302
- ...o,
2303
- [a]: r
2304
- };
2305
- }, {});
2306
- }
2307
- const re = "builder.", kn = "options.", wn = (e) => {
2308
- const t = {};
2309
- return e.forEach((n, o) => {
2310
- t[o] = n;
2311
- }), t;
2312
- }, Ce = (e) => {
2313
- if (!e)
2314
- return {};
2315
- const t = Ie(e), n = {};
2316
- return Object.keys(t).forEach((o) => {
2317
- if (o.startsWith(re)) {
2318
- const i = o.replace(re, "").replace(kn, "");
2319
- n[i] = t[o];
2320
- }
2321
- }), n;
2322
- }, Cn = () => {
2323
- if (!v())
2324
- return {};
2325
- const e = new URLSearchParams(window.location.search);
2326
- return Ce(e);
2327
- }, Ie = (e) => e instanceof URLSearchParams ? wn(e) : e, In = "v3", K = (e) => {
2328
- let {
2329
- noTraverse: t = !1
2330
- } = e;
2331
- const {
2332
- limit: n = 30,
2333
- userAttributes: o,
2334
- query: i,
2335
- model: r,
2336
- apiKey: a,
2337
- includeRefs: c = !0,
2338
- enrich: s,
2339
- locale: u,
2340
- apiVersion: f = In
2341
- } = e;
2342
- if (!a)
2343
- throw new Error("Missing API key");
2344
- if (!["v2", "v3"].includes(f))
2345
- throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${f}'`);
2346
- (e.limit === void 0 || e.limit > 1) && !("noTraverse" in e) && (t = !0);
2347
- const g = new URL(`https://cdn.builder.io/api/${f}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${c}${u ? `&locale=${u}` : ""}${s ? `&enrich=${s}` : ""}`), p = {
2348
- ...Cn(),
2349
- ...Ie(e.options || {})
2350
- }, m = N(p);
2351
- for (const h in m)
2352
- g.searchParams.set(h, String(m[h]));
2353
- if (o && g.searchParams.set("userAttributes", JSON.stringify(o)), i) {
2354
- const h = N({
2355
- query: i
2356
- });
2357
- for (const d in h)
2358
- g.searchParams.set(d, JSON.stringify(h[d]));
2359
- }
2360
- return g;
2361
- }, Tn = (e) => "results" in e;
2362
- async function H(e) {
2363
- const t = await Te({
2364
- ...e,
2365
- limit: 1
2366
- });
2367
- return t && t.results[0] || null;
2368
- }
2369
- const qn = H, Rn = async (e) => {
2370
- const t = K(e);
2371
- return await (await jt(t.href)).json();
2372
- }, En = async (e, t, n = K(e)) => {
2373
- const o = O(e.canTrack);
2374
- if (n.search.includes("preview=")) {
2375
- const r = [];
2376
- for (const a of t.results) {
2377
- const c = vn(n.searchParams);
2378
- r.push(c || a);
2379
- }
2380
- t.results = r;
2381
- }
2382
- if (!o || !(v() || I === "reactNative"))
2383
- return t;
2384
- try {
2385
- const r = [];
2386
- for (const a of t.results)
2387
- r.push(await bn({
2388
- item: a,
2389
- canTrack: o
2390
- }));
2391
- t.results = r;
2392
- } catch (r) {
2393
- k.error("Could not process A/B tests. ", r);
2394
- }
2395
- return t;
2396
- };
2397
- async function Te(e) {
2398
- try {
2399
- const t = K(e), n = await Rn(e);
2400
- return Tn(n) ? En(e, n) : (k.error("Error fetching data. ", {
2401
- url: t,
2402
- content: n,
2403
- options: e
2404
- }), null);
2405
- } catch (t) {
2406
- return k.error("Error fetching data. ", t), null;
2407
- }
2408
- }
2409
- const Gn = Te, Jn = async (e) => {
2379
+ const Jn = async (e) => {
2410
2380
  var o, i, r;
2411
2381
  const t = e.path || ((o = e.url) == null ? void 0 : o.pathname) || ((i = e.userAttributes) == null ? void 0 : i.urlPath), n = {
2412
2382
  ...e,
@@ -2418,7 +2388,7 @@ const Gn = Te, Jn = async (e) => {
2418
2388
  urlPath: t
2419
2389
  } : {}
2420
2390
  },
2421
- options: Ce(e.searchParams || ((r = e.url) == null ? void 0 : r.searchParams) || e.options)
2391
+ options: we(e.searchParams || ((r = e.url) == null ? void 0 : r.searchParams) || e.options)
2422
2392
  };
2423
2393
  return {
2424
2394
  apiKey: n.apiKey,
@@ -2427,39 +2397,40 @@ const Gn = Te, Jn = async (e) => {
2427
2397
  };
2428
2398
  };
2429
2399
  export {
2430
- Ce as A,
2400
+ Cn as A,
2431
2401
  _ as B,
2432
- we as C,
2433
- Mn as D,
2434
- Jn as E,
2435
- Kn as R,
2436
- xn as S,
2437
- Tt as T,
2438
- rn as _,
2439
- On as a,
2440
- Wn as b,
2441
- Nn as c,
2442
- v as d,
2443
- Ln as e,
2402
+ Te as C,
2403
+ we as D,
2404
+ Mn as E,
2405
+ Jn as F,
2406
+ zn as R,
2407
+ Tn as S,
2408
+ Ct as T,
2409
+ nn as _,
2410
+ it as a,
2411
+ On as b,
2412
+ Wn as c,
2413
+ Nn as d,
2414
+ v as e,
2444
2415
  O as f,
2445
- at as g,
2446
- M as h,
2416
+ Fn as g,
2417
+ Dn as h,
2447
2418
  L as i,
2448
- jn as j,
2449
- A as k,
2419
+ M as j,
2420
+ jn as k,
2450
2421
  k as l,
2451
- jt as m,
2452
- un as n,
2453
- Hn as o,
2454
- lt as p,
2455
- Dn as q,
2422
+ A as m,
2423
+ Ln as n,
2424
+ H as o,
2425
+ Ut as p,
2426
+ pn as q,
2456
2427
  Un as r,
2457
2428
  _n as s,
2458
- sn as t,
2459
- zn as u,
2460
- Te as v,
2461
- H as w,
2462
- Gn as x,
2463
- qn as y,
2464
- En as z
2429
+ qn as t,
2430
+ st as u,
2431
+ rn as v,
2432
+ Gn as w,
2433
+ Ie as x,
2434
+ Hn as y,
2435
+ Kn as z
2465
2436
  };