@builder.io/sdk-react 4.1.1 → 4.1.2

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 (70) hide show
  1. package/lib/browser/blocks-exports.cjs +2 -2
  2. package/lib/browser/blocks-exports.mjs +246 -246
  3. package/lib/browser/index.cjs +1 -1
  4. package/lib/browser/index.mjs +1 -1
  5. package/lib/browser/{server-entry-7fc3706d.js → server-entry-275748e0.js} +120 -144
  6. package/lib/browser/server-entry-d2f19ab1.cjs +2 -0
  7. package/lib/browser/server-entry.cjs +1 -1
  8. package/lib/browser/server-entry.mjs +1 -1
  9. package/lib/edge/{accordion-97979a98.cjs → accordion-59377bdf.cjs} +1 -1
  10. package/lib/edge/{accordion-52165801.js → accordion-59685072.js} +1 -1
  11. package/lib/edge/{blocks-f69d48c0.js → blocks-803a3669.js} +2 -2
  12. package/lib/edge/{blocks-b38b39ff.cjs → blocks-ab4caea4.cjs} +1 -1
  13. package/lib/edge/blocks-exports.cjs +1 -1
  14. package/lib/edge/blocks-exports.mjs +2 -2
  15. package/lib/edge/{button-3acce335.js → button-244756d9.js} +2 -2
  16. package/lib/edge/{button-c2b48e86.cjs → button-d9ead397.cjs} +1 -1
  17. package/lib/edge/{columns-600ece77.cjs → columns-88904faf.cjs} +1 -1
  18. package/lib/edge/{columns-301795ee.js → columns-ac088b45.js} +3 -3
  19. package/lib/edge/{content-variants-d80a626a.js → content-variants-7ba31977.js} +133 -133
  20. package/lib/edge/{content-variants-cb452ad4.cjs → content-variants-d0558de3.cjs} +5 -5
  21. package/lib/edge/{custom-code-38a0e487.js → custom-code-3d893bd2.js} +1 -1
  22. package/lib/edge/{custom-code-381f399e.cjs → custom-code-e2904013.cjs} +1 -1
  23. package/lib/edge/{embed-57e9672d.cjs → embed-7710e674.cjs} +1 -1
  24. package/lib/edge/{embed-3e62c6c0.js → embed-7c2fe6ce.js} +1 -1
  25. package/lib/edge/{form-01ee1ef4.js → form-a5b57678.js} +3 -3
  26. package/lib/edge/{form-dfb33605.cjs → form-ec1cd318.cjs} +1 -1
  27. package/lib/edge/{get-class-prop-name-7a52ddda.cjs → get-class-prop-name-31bfc4d6.cjs} +1 -1
  28. package/lib/edge/{get-class-prop-name-ca3fff6a.js → get-class-prop-name-4ca8bda9.js} +1 -1
  29. package/lib/edge/{img-35c030d0.js → img-1b034d45.js} +1 -1
  30. package/lib/edge/{img-ff08ac3a.cjs → img-f00b7db5.cjs} +1 -1
  31. package/lib/edge/index.cjs +1 -1
  32. package/lib/edge/index.mjs +1 -1
  33. package/lib/edge/{input-bd84e8ab.cjs → input-19390442.cjs} +1 -1
  34. package/lib/edge/{input-d466ec13.js → input-dfd8b37e.js} +1 -1
  35. package/lib/edge/{personalization-container-8b04de3e.cjs → personalization-container-40c62fee.cjs} +1 -1
  36. package/lib/edge/{personalization-container-87ff6375.js → personalization-container-660938a9.js} +4 -4
  37. package/lib/edge/{select-5d4ffe3b.js → select-155fc504.js} +1 -1
  38. package/lib/edge/{select-ef4ce171.cjs → select-9839622b.cjs} +1 -1
  39. package/lib/edge/{server-entry-db512751.js → server-entry-75006b6f.js} +119 -143
  40. package/lib/edge/server-entry-bdf7aa30.cjs +2 -0
  41. package/lib/edge/server-entry.cjs +1 -1
  42. package/lib/edge/server-entry.mjs +1 -1
  43. package/lib/edge/{slot-78b8ee2b.cjs → slot-28225152.cjs} +1 -1
  44. package/lib/edge/{slot-d0cbcacf.js → slot-c14c2de1.js} +3 -3
  45. package/lib/edge/{symbol-2e54d716.js → symbol-2419b184.js} +2 -2
  46. package/lib/edge/{symbol-6d9bb0a7.cjs → symbol-e5dc7a91.cjs} +1 -1
  47. package/lib/edge/{tabs-b8c2b851.js → tabs-c7011fa2.js} +3 -3
  48. package/lib/edge/{tabs-3f775737.cjs → tabs-d7aa6ac2.cjs} +1 -1
  49. package/lib/node/blocks-exports.cjs +2 -2
  50. package/lib/node/blocks-exports.mjs +244 -244
  51. package/lib/node/index.cjs +1 -1
  52. package/lib/node/index.mjs +3 -3
  53. package/lib/node/init.cjs +1 -1
  54. package/lib/node/init.mjs +3 -3
  55. package/lib/node/{server-entry-b0a12b94.js → server-entry-0cf21855.js} +120 -144
  56. package/lib/node/server-entry-7a611f62.cjs +2 -0
  57. package/lib/node/server-entry.cjs +1 -1
  58. package/lib/node/server-entry.mjs +1 -1
  59. package/lib/node/{setIvm-f591fbda.js → setIvm-4171d613.js} +1 -1
  60. package/lib/node/{setIvm-513e193d.cjs → setIvm-68685828.cjs} +1 -1
  61. package/lib/node/setIvm.cjs +1 -1
  62. package/lib/node/setIvm.mjs +2 -2
  63. package/lib/node/{should-force-browser-runtime-in-node-0fb1bbdd.cjs → should-force-browser-runtime-in-node-88656beb.cjs} +1 -1
  64. package/lib/node/{should-force-browser-runtime-in-node-da05f5c3.js → should-force-browser-runtime-in-node-9fe42073.js} +1 -1
  65. package/package.json +1 -1
  66. package/types/constants/sdk-version.d.ts +1 -1
  67. package/types/scripts/init-editing.d.ts +0 -1
  68. package/lib/browser/server-entry-7291b0a0.cjs +0 -2
  69. package/lib/edge/server-entry-afc62633.cjs +0 -2
  70. package/lib/node/server-entry-47ceca47.cjs +0 -2
@@ -1,4 +1,4 @@
1
- const y = "react";
1
+ const b = "react";
2
2
  function c() {
3
3
  return typeof window != "undefined" && typeof document != "undefined";
4
4
  }
@@ -7,7 +7,7 @@ const v = "[Builder.io]: ", f = {
7
7
  error: (...t) => console.error(v, ...t),
8
8
  warn: (...t) => console.warn(v, ...t),
9
9
  debug: (...t) => console.debug(v, ...t)
10
- }, S = (t) => t != null, at = (t) => {
10
+ }, y = (t) => t != null, at = (t) => {
11
11
  if (t === "localhost" || t === "127.0.0.1")
12
12
  return t;
13
13
  const e = t.split(".");
@@ -23,7 +23,7 @@ const v = "[Builder.io]: ", f = {
23
23
  f.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
24
24
  return;
25
25
  }
26
- }, K = async (t) => O(t), ct = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(S).join("; "), ut = [["secure", ""], ["SameSite", "None"]], lt = ({
26
+ }, M = async (t) => O(t), ct = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(y).join("; "), ut = [["secure", ""], ["SameSite", "None"]], lt = ({
27
27
  name: t,
28
28
  value: e,
29
29
  expires: n
@@ -86,8 +86,8 @@ function L() {
86
86
  };
87
87
  }
88
88
  let k;
89
- c() && y === "qwik" ? (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ || (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ = L()), k = window.__BUILDER_USER_ATTRIBUTES_SERVICE__) : k = L();
90
- const W = k, ne = (t) => {
89
+ c() && b === "qwik" ? (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ || (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ = L()), k = window.__BUILDER_USER_ATTRIBUTES_SERVICE__) : k = L();
90
+ const W = k, ee = (t) => {
91
91
  W.setUserAttributes(t);
92
92
  }, dt = (t) => {
93
93
  const e = {};
@@ -102,11 +102,11 @@ function ht(t) {
102
102
  return ft() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
103
103
  $(t || window.location.search).indexOf("builder.frameEditing=") !== -1;
104
104
  }
105
- function re(t) {
105
+ function ne(t) {
106
106
  const e = t || (c() ? window.location.search : void 0);
107
107
  return e ? $(e).indexOf("builder.preview=") !== -1 : !1;
108
108
  }
109
- const se = (t) => ({
109
+ const re = (t) => ({
110
110
  type: "builder.registerComponent",
111
111
  data: G(t)
112
112
  }), gt = (t) => {
@@ -117,7 +117,7 @@ function G(t) {
117
117
  return JSON.parse(JSON.stringify(t, (e, n) => typeof n == "function" ? gt(n) : n));
118
118
  }
119
119
  const N = {};
120
- function pt(t, e) {
120
+ function se(t, e) {
121
121
  t === "plugin" && (e = G(e));
122
122
  let n = N[t];
123
123
  if (n || (n = N[t] = []), n.push(e), c()) {
@@ -146,13 +146,13 @@ function oe(t) {
146
146
  parent.postMessage(e, "*");
147
147
  }
148
148
  }
149
- const D = "builder.", mt = "options.", J = (t) => {
149
+ const D = "builder.", pt = "options.", J = (t) => {
150
150
  if (!t)
151
151
  return {};
152
152
  const e = j(t), n = {};
153
153
  return Object.keys(e).forEach((r) => {
154
154
  if (r.startsWith(D)) {
155
- const s = r.replace(D, "").replace(mt, "");
155
+ const s = r.replace(D, "").replace(pt, "");
156
156
  n[s] = e[r];
157
157
  }
158
158
  }), n;
@@ -161,8 +161,8 @@ const D = "builder.", mt = "options.", J = (t) => {
161
161
  return {};
162
162
  const t = new URLSearchParams(window.location.search);
163
163
  return J(t);
164
- }, z = "4.1.1", X = () => ({
165
- "X-Builder-SDK": y,
164
+ }, z = "4.1.2", X = () => ({
165
+ "X-Builder-SDK": b,
166
166
  "X-Builder-SDK-GEN": "2",
167
167
  "X-Builder-SDK-Version": z
168
168
  });
@@ -180,27 +180,27 @@ const Q = "builderSessionId", bt = async ({
180
180
  }) => {
181
181
  if (!t)
182
182
  return;
183
- const e = await K({
183
+ const e = await M({
184
184
  name: Q,
185
185
  canTrack: t
186
186
  });
187
- if (S(e))
187
+ if (y(e))
188
188
  return e;
189
189
  {
190
- const n = wt();
191
- return Et({
190
+ const n = mt();
191
+ return wt({
192
192
  id: n,
193
193
  canTrack: t
194
194
  }), n;
195
195
  }
196
- }, wt = () => H(), Et = ({
196
+ }, mt = () => H(), wt = ({
197
197
  id: t,
198
198
  canTrack: e
199
199
  }) => T({
200
200
  name: Q,
201
201
  value: t,
202
202
  canTrack: e
203
- }), Y = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, It = ({
203
+ }), Y = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, Et = ({
204
204
  key: t,
205
205
  canTrack: e
206
206
  }) => {
@@ -211,7 +211,7 @@ const Q = "builderSessionId", bt = async ({
211
211
  console.debug("[LocalStorage] GET error: ", r);
212
212
  return;
213
213
  }
214
- }, vt = ({
214
+ }, It = ({
215
215
  key: t,
216
216
  canTrack: e,
217
217
  value: n
@@ -222,44 +222,44 @@ const Q = "builderSessionId", bt = async ({
222
222
  } catch (s) {
223
223
  console.debug("[LocalStorage] SET error: ", s);
224
224
  }
225
- }, Z = "builderVisitorId", At = ({
225
+ }, Z = "builderVisitorId", vt = ({
226
226
  canTrack: t
227
227
  }) => {
228
228
  if (!t)
229
229
  return;
230
- const e = It({
230
+ const e = Et({
231
231
  key: Z,
232
232
  canTrack: t
233
233
  });
234
- if (S(e))
234
+ if (y(e))
235
235
  return e;
236
236
  {
237
- const n = kt();
238
- return Ut({
237
+ const n = At();
238
+ return kt({
239
239
  id: n,
240
240
  canTrack: t
241
241
  }), n;
242
242
  }
243
- }, kt = () => H(), Ut = ({
243
+ }, At = () => H(), kt = ({
244
244
  id: t,
245
245
  canTrack: e
246
- }) => vt({
246
+ }) => It({
247
247
  key: Z,
248
248
  value: t,
249
249
  canTrack: e
250
250
  });
251
- function Ot(t) {
251
+ function Ut(t) {
252
252
  var e;
253
253
  typeof process != "undefined" && ((e = process.env) != null && e.DEBUG) && String(process.env.DEBUG) == "true" && f.log(t);
254
254
  }
255
- const Tt = () => {
255
+ const Ot = () => {
256
256
  if (c()) {
257
257
  const t = new URL(location.href);
258
258
  return t.pathname === "" && (t.pathname = "/"), t;
259
259
  } else
260
260
  return console.warn("Cannot get location for tracking in non-browser environment"), null;
261
- }, Ct = () => typeof navigator == "object" && navigator.userAgent || "", Pt = () => {
262
- const t = Ct(), e = {
261
+ }, Tt = () => typeof navigator == "object" && navigator.userAgent || "", Pt = () => {
262
+ const t = Tt(), e = {
263
263
  Android() {
264
264
  return t.match(/Android/i);
265
265
  },
@@ -276,9 +276,9 @@ const Tt = () => {
276
276
  return t.match(/IEMobile/i) || t.match(/WPDesktop/i);
277
277
  },
278
278
  any() {
279
- return e.Android() || e.BlackBerry() || e.iOS() || e.Opera() || e.Windows() || y === "reactNative";
279
+ return e.Android() || e.BlackBerry() || e.iOS() || e.Opera() || e.Windows() || b === "reactNative";
280
280
  }
281
- }, n = t.match(/Tablet|iPad/i), r = Tt();
281
+ }, n = t.match(/Tablet|iPad/i), r = Ot();
282
282
  return {
283
283
  urlPath: r == null ? void 0 : r.pathname,
284
284
  host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
@@ -294,14 +294,14 @@ const Tt = () => {
294
294
  };
295
295
  const e = await bt({
296
296
  canTrack: t
297
- }), n = At({
297
+ }), n = vt({
298
298
  canTrack: t
299
299
  });
300
300
  return {
301
301
  sessionId: e,
302
302
  visitorId: n
303
303
  };
304
- }, Bt = async ({
304
+ }, Ct = async ({
305
305
  type: t,
306
306
  canTrack: e,
307
307
  apiKey: n,
@@ -322,7 +322,7 @@ const Tt = () => {
322
322
  ownerId: n
323
323
  }
324
324
  });
325
- async function xt({
325
+ async function Bt({
326
326
  apiHost: t,
327
327
  ...e
328
328
  }) {
@@ -330,13 +330,13 @@ async function xt({
330
330
  f.error("Missing API key for track call. Please provide your API key.");
331
331
  return;
332
332
  }
333
- if (!e.canTrack || ht() || !(c() || y === "reactNative"))
333
+ if (!e.canTrack || ht() || !(c() || b === "reactNative"))
334
334
  return;
335
335
  const r = `${t || "https://cdn.builder.io"}/api/v1/track`;
336
- return Ot(r), fetch(r, {
336
+ return Ut(r), fetch(r, {
337
337
  method: "POST",
338
338
  body: JSON.stringify({
339
- events: [await Bt(e)]
339
+ events: [await Ct(e)]
340
340
  }),
341
341
  headers: {
342
342
  "content-type": "application/json",
@@ -347,46 +347,23 @@ async function xt({
347
347
  console.error("Failed to track: ", s);
348
348
  });
349
349
  }
350
- const ie = (t) => xt({
350
+ const ie = (t) => Bt({
351
351
  ...t,
352
352
  canTrack: !0
353
- }), _t = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
353
+ }), xt = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
354
354
  function q(t, e) {
355
355
  if (!e.origin.startsWith("http") && !e.origin.startsWith("https"))
356
356
  return !1;
357
357
  const n = new URL(e.origin), r = n.hostname;
358
- return (t || _t).findIndex((s) => s.startsWith("*.") ? r.endsWith(s.slice(1)) : s === r) > -1;
358
+ return (t || xt).findIndex((s) => s.startsWith("*.") ? r.endsWith(s.slice(1)) : s === r) > -1;
359
359
  }
360
- const ae = () => {
361
- pt("insertMenu", {
362
- name: "_default",
363
- default: !0,
364
- items: [{
365
- name: "Box"
366
- }, {
367
- name: "Text"
368
- }, {
369
- name: "Image"
370
- }, {
371
- name: "Columns"
372
- }, {
373
- name: "Core:Section"
374
- }, {
375
- name: "Core:Button"
376
- }, {
377
- name: "Embed"
378
- }, {
379
- name: "Custom Code"
380
- }]
381
- });
382
- };
383
360
  let F = !1;
384
- const Lt = (t) => {
361
+ const _t = (t) => {
385
362
  var e, n;
386
363
  F || (F = !0, c() && ((e = window.parent) == null || e.postMessage({
387
364
  type: "builder.sdkInfo",
388
365
  data: {
389
- target: y,
366
+ target: b,
390
367
  version: z,
391
368
  supportsPatchUpdates: !1,
392
369
  // Supports builder-model="..." attribute which is needed to
@@ -413,10 +390,10 @@ const Lt = (t) => {
413
390
  if (s != null && s.type)
414
391
  switch (s.type) {
415
392
  case "builder.evaluate": {
416
- const u = s.data.text, b = s.data.arguments || [], p = s.data.id, w = new Function(u);
393
+ const u = s.data.text, m = s.data.arguments || [], p = s.data.id, w = new Function(u);
417
394
  let l, h = null;
418
395
  try {
419
- l = w.apply(null, b);
396
+ l = w.apply(null, m);
420
397
  } catch (g) {
421
398
  h = g;
422
399
  }
@@ -446,7 +423,7 @@ const Lt = (t) => {
446
423
  }
447
424
  }
448
425
  })));
449
- }, Nt = ({
426
+ }, Lt = ({
450
427
  model: t,
451
428
  trustedHosts: e,
452
429
  callbacks: n
@@ -477,7 +454,7 @@ const Lt = (t) => {
477
454
  break;
478
455
  }
479
456
  }
480
- }, ce = ({
457
+ }, ae = ({
481
458
  model: t,
482
459
  apiKey: e,
483
460
  callback: n,
@@ -486,11 +463,11 @@ const Lt = (t) => {
486
463
  if (!c)
487
464
  return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
488
465
  };
489
- Lt({
466
+ _t({
490
467
  modelName: t,
491
468
  apiKey: e
492
469
  });
493
- const s = Nt({
470
+ const s = Lt({
494
471
  callbacks: {
495
472
  contentUpdate: n,
496
473
  animation: () => {
@@ -506,24 +483,24 @@ const Lt = (t) => {
506
483
  return window.addEventListener("message", s), () => {
507
484
  window.removeEventListener("message", s);
508
485
  };
509
- }, Vt = "builder.tests", C = (t) => `${Vt}.${t}`, Dt = ({
486
+ }, Nt = "builder.tests", P = (t) => `${Nt}.${t}`, Vt = ({
510
487
  contentId: t
511
- }) => K({
512
- name: C(t),
488
+ }) => M({
489
+ name: P(t),
513
490
  canTrack: !0
514
- }), Ft = ({
491
+ }), Dt = ({
515
492
  contentId: t
516
493
  }) => O({
517
- name: C(t),
494
+ name: P(t),
518
495
  canTrack: !0
519
- }), Mt = ({
496
+ }), Ft = ({
520
497
  contentId: t,
521
498
  value: e
522
499
  }) => T({
523
- name: C(t),
500
+ name: P(t),
524
501
  value: e,
525
502
  canTrack: !0
526
- }), tt = (t) => S(t.id) && S(t.variations) && Object.keys(t.variations).length > 0, Kt = ({
503
+ }), tt = (t) => y(t.id) && y(t.variations) && Object.keys(t.variations).length > 0, Kt = ({
527
504
  id: t,
528
505
  variations: e
529
506
  }) => {
@@ -538,7 +515,7 @@ const Lt = (t) => {
538
515
  return t;
539
516
  }, et = (t) => {
540
517
  const e = Kt(t);
541
- return Mt({
518
+ return Ft({
542
519
  contentId: t.id,
543
520
  value: e
544
521
  }).catch((n) => {
@@ -558,7 +535,7 @@ const Lt = (t) => {
558
535
  testVariationId: n.id,
559
536
  testVariationName: n.name || (n.id === t.id ? "Default" : "")
560
537
  };
561
- }, ue = ({
538
+ }, ce = ({
562
539
  item: t,
563
540
  canTrack: e
564
541
  }) => {
@@ -568,7 +545,7 @@ const Lt = (t) => {
568
545
  return;
569
546
  if (!tt(t))
570
547
  return t;
571
- const n = Ft({
548
+ const n = Dt({
572
549
  contentId: t.id
573
550
  }) || et({
574
551
  variations: t.variations,
@@ -581,13 +558,13 @@ const Lt = (t) => {
581
558
  ...t,
582
559
  ...r
583
560
  };
584
- }, Wt = async ({
561
+ }, Mt = async ({
585
562
  item: t,
586
563
  canTrack: e
587
564
  }) => {
588
565
  if (!e || !tt(t))
589
566
  return t;
590
- const r = await Dt({
567
+ const r = await Vt({
591
568
  contentId: t.id
592
569
  }) || et({
593
570
  variations: t.variations,
@@ -600,21 +577,21 @@ const Lt = (t) => {
600
577
  ...t,
601
578
  ...s
602
579
  };
603
- }, jt = (t) => {
604
- const e = S(t) ? t : !0;
580
+ }, Wt = (t) => {
581
+ const e = y(t) ? t : !0;
605
582
  return W.setCanTrack(e), e;
606
583
  };
607
- function $t() {
584
+ function jt() {
608
585
  return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
609
586
  }
610
- function Gt() {
611
- const t = $t().fetch;
587
+ function $t() {
588
+ const t = jt().fetch;
612
589
  if (typeof t == "undefined")
613
590
  throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
614
591
  For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
615
592
  return t;
616
593
  }
617
- const Jt = Gt();
594
+ const Gt = $t();
618
595
  function U(t, e = null, n = ".") {
619
596
  return Object.keys(t).reduce((r, s) => {
620
597
  const o = t[s], i = [e, s].filter(Boolean).join(n);
@@ -634,7 +611,7 @@ function rt(t, e, n = {}) {
634
611
  }
635
612
  return n;
636
613
  }
637
- function zt(t) {
614
+ function Jt(t) {
638
615
  const e = {};
639
616
  for (const n in t) {
640
617
  const r = n.split(".");
@@ -646,7 +623,7 @@ function zt(t) {
646
623
  }
647
624
  return e;
648
625
  }
649
- const Xt = "v3", M = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t) => {
626
+ const zt = "v3", K = (t) => typeof t == "number" && !isNaN(t) && t >= 0, R = (t) => {
650
627
  const {
651
628
  limit: e = 30,
652
629
  userAttributes: n,
@@ -655,28 +632,28 @@ const Xt = "v3", M = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t)
655
632
  apiKey: o,
656
633
  enrich: i,
657
634
  locale: u,
658
- apiVersion: b = Xt,
635
+ apiVersion: m = zt,
659
636
  fields: p,
660
637
  omit: w,
661
638
  offset: l,
662
639
  cacheSeconds: h,
663
640
  staleCacheSeconds: g,
664
641
  sort: E,
665
- includeUnpublished: R,
642
+ includeUnpublished: C,
666
643
  apiHost: st
667
644
  } = t;
668
645
  if (!o)
669
646
  throw new Error("Missing API key");
670
- if (!["v3"].includes(b))
671
- throw new Error(`Invalid apiVersion: expected 'v3', received '${b}'`);
672
- const ot = e !== 1, it = st || "https://cdn.builder.io", a = new URL(`${it}/api/${b}/content/${s}`);
647
+ if (!["v3"].includes(m))
648
+ throw new Error(`Invalid apiVersion: expected 'v3', received '${m}'`);
649
+ const ot = e !== 1, it = st || "https://cdn.builder.io", a = new URL(`${it}/api/${m}/content/${s}`);
673
650
  a.searchParams.set("apiKey", o), a.searchParams.set("limit", String(e)), a.searchParams.set("noTraverse", String(ot)), a.searchParams.set("includeRefs", String(!0));
674
651
  const A = u || (n == null ? void 0 : n.locale);
675
- let m = n || {};
676
- if (A && (a.searchParams.set("locale", A), m = {
652
+ let S = n || {};
653
+ if (A && (a.searchParams.set("locale", A), S = {
677
654
  locale: A,
678
- ...m
679
- }), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", w != null ? w : "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(l) && l > -1 && a.searchParams.set("offset", String(Math.floor(l))), typeof R == "boolean" && a.searchParams.set("includeUnpublished", String(R)), h && M(h) && a.searchParams.set("cacheSeconds", String(h)), g && M(g) && a.searchParams.set("staleCacheSeconds", String(g)), E) {
655
+ ...S
656
+ }), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", w != null ? w : "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(l) && l > -1 && a.searchParams.set("offset", String(Math.floor(l))), typeof C == "boolean" && a.searchParams.set("includeUnpublished", String(C)), h && K(h) && a.searchParams.set("cacheSeconds", String(h)), g && K(g) && a.searchParams.set("staleCacheSeconds", String(g)), E) {
680
657
  const d = U({
681
658
  sort: E
682
659
  });
@@ -687,14 +664,14 @@ const Xt = "v3", M = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t)
687
664
  ...St(),
688
665
  ...j(t.options || {})
689
666
  };
690
- m = {
691
- ...m,
692
- ...Qt(B)
667
+ S = {
668
+ ...S,
669
+ ...Ht(B)
693
670
  };
694
671
  const x = U(B);
695
672
  for (const d in x)
696
673
  a.searchParams.set(d, String(x[d]));
697
- if (Object.keys(m).length > 0 && a.searchParams.set("userAttributes", JSON.stringify(m)), r) {
674
+ if (Object.keys(S).length > 0 && a.searchParams.set("userAttributes", JSON.stringify(S)), r) {
698
675
  const d = rt({
699
676
  query: r
700
677
  });
@@ -702,31 +679,31 @@ const Xt = "v3", M = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t)
702
679
  a.searchParams.set(I, JSON.stringify(d[I]));
703
680
  }
704
681
  return a;
705
- }, Ht = (t) => {
682
+ }, Xt = (t) => {
706
683
  const e = {};
707
684
  for (const n in t)
708
685
  n.startsWith("userAttributes.") && (e[n] = t[n], delete t[n]);
709
686
  return e;
710
- }, Qt = (t) => {
687
+ }, Ht = (t) => {
711
688
  if (c() && t.preview === "BUILDER_STUDIO") {
712
689
  t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
713
- const e = Ht(t), {
690
+ const e = Xt(t), {
714
691
  userAttributes: n
715
- } = zt(e);
692
+ } = Jt(e);
716
693
  return n;
717
694
  }
718
695
  return {};
719
- }, Yt = (t) => "results" in t;
720
- async function Zt(t) {
721
- const e = await ee({
696
+ }, Qt = (t) => "results" in t;
697
+ async function Yt(t) {
698
+ const e = await te({
722
699
  ...t,
723
700
  limit: 1
724
701
  });
725
702
  return e && e[0] || null;
726
703
  }
727
- const qt = async (t) => {
704
+ const Zt = async (t) => {
728
705
  var i, u;
729
- const e = P(t), n = (i = t.fetch) != null ? i : Jt, r = {
706
+ const e = R(t), n = (i = t.fetch) != null ? i : Gt, r = {
730
707
  ...t.fetchOptions,
731
708
  headers: {
732
709
  ...(u = t.fetchOptions) == null ? void 0 : u.headers,
@@ -734,14 +711,14 @@ const qt = async (t) => {
734
711
  }
735
712
  };
736
713
  return await (await n(e.href, r)).json();
737
- }, te = async (t, e, n = P(t)) => {
738
- const r = jt(t.canTrack);
739
- if (n.search.includes("preview="), !r || !(c() || y === "reactNative"))
714
+ }, qt = async (t, e, n = R(t)) => {
715
+ const r = Wt(t.canTrack);
716
+ if (n.search.includes("preview="), !r || !(c() || b === "reactNative"))
740
717
  return e.results;
741
718
  try {
742
719
  const s = [];
743
720
  for (const o of e.results)
744
- s.push(await Wt({
721
+ s.push(await Mt({
745
722
  item: o,
746
723
  canTrack: r
747
724
  }));
@@ -751,17 +728,17 @@ const qt = async (t) => {
751
728
  }
752
729
  return e.results;
753
730
  };
754
- async function ee(t) {
755
- const e = P(t), n = await qt(t);
756
- if (!Yt(n))
731
+ async function te(t) {
732
+ const e = R(t), n = await Zt(t);
733
+ if (!Qt(n))
757
734
  throw f.error("Error fetching data. ", {
758
735
  url: e,
759
736
  content: n,
760
737
  options: t
761
738
  }), n;
762
- return te(t, n);
739
+ return qt(t, n);
763
740
  }
764
- const le = async (t) => {
741
+ const ue = async (t) => {
765
742
  var r, s, o;
766
743
  const e = t.path || ((r = t.url) == null ? void 0 : r.pathname) || ((s = t.userAttributes) == null ? void 0 : s.urlPath), n = {
767
744
  ...t,
@@ -778,36 +755,35 @@ const le = async (t) => {
778
755
  return {
779
756
  apiKey: n.apiKey,
780
757
  model: n.model,
781
- content: await Zt(n)
758
+ content: await Yt(n)
782
759
  };
783
760
  };
784
761
  export {
785
- y as TARGET,
786
- te as _processContentResult,
787
- xt as _track,
788
- S as checkIsDefined,
789
- Nt as createEditorListener,
790
- se as createRegisterComponentMessage,
791
- le as fetchBuilderProps,
792
- ee as fetchEntries,
793
- Zt as fetchOneEntry,
762
+ b as TARGET,
763
+ qt as _processContentResult,
764
+ Bt as _track,
765
+ y as checkIsDefined,
766
+ Lt as createEditorListener,
767
+ re as createRegisterComponentMessage,
768
+ ue as fetchBuilderProps,
769
+ te as fetchEntries,
770
+ Yt as fetchOneEntry,
794
771
  J as getBuilderSearchParams,
795
772
  O as getCookieSync,
796
- jt as getDefaultCanTrack,
773
+ Wt as getDefaultCanTrack,
797
774
  Pt as getUserAttributes,
798
- ue as handleABTestingSync,
775
+ ce as handleABTestingSync,
799
776
  c as isBrowser,
800
777
  ht as isEditing,
801
- re as isPreviewing,
802
- Ot as logFetch,
778
+ ne as isPreviewing,
779
+ Ut as logFetch,
803
780
  f as logger,
804
- pt as register,
805
- ae as registerInsertMenu,
781
+ se as register,
806
782
  G as serializeIncludingFunctions,
807
- ne as setClientUserAttributes,
783
+ ee as setClientUserAttributes,
808
784
  oe as setEditorSettings,
809
- Lt as setupBrowserForEditing,
810
- ce as subscribeToEditor,
785
+ _t as setupBrowserForEditing,
786
+ ae as subscribeToEditor,
811
787
  ie as track,
812
788
  W as userAttributesService
813
789
  };
@@ -0,0 +1,2 @@
1
+ "use strict";const S="react";function c(){return typeof window!="undefined"&&typeof document!="undefined"}const v="[Builder.io]: ",d={log:(...t)=>console.log(v,...t),error:(...t)=>console.error(v,...t),warn:(...t)=>console.warn(v,...t),debug:(...t)=>console.debug(v,...t)},p=t=>t!=null,bt=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},A=({name:t,canTrack:e})=>{var r;try{return e?(r=document.cookie.split("; ").find(n=>n.startsWith(`${t}=`)))==null?void 0:r.split("=")[1]:void 0}catch(n){d.warn("[COOKIE] GET error: ",(n==null?void 0:n.message)||n);return}},$=async t=>A(t),yt=t=>t.map(([e,r])=>r?`${e}=${r}`:e).filter(p).join("; "),mt=[["secure",""],["SameSite","None"]],wt=({name:t,value:e,expires:r})=>{const s=(c()?location.protocol==="https:":!0)?mt:[[]],o=r?[["expires",r.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",bt(window.location.hostname)],...s];return yt(i)},O=async({name:t,value:e,expires:r,canTrack:n})=>{try{if(!n)return;const s=wt({name:t,value:e,expires:r});document.cookie=s}catch(s){d.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};const V="builder.userAttributes";function D(){let t=!0;const e=new Set;return{setUserAttributes(r){if(!c())return;const n={...this.getUserAttributes(),...r};O({name:V,value:JSON.stringify(n),canTrack:t}),e.forEach(s=>s(n))},getUserAttributes(){return c()?JSON.parse(A({name:V,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(r,{fireImmediately:n}={}){return e.add(r),n&&r(this.getUserAttributes()),function(){e.delete(r)}},setCanTrack(r){t=r}}}let U;c()&&S==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=D()),U=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):U=D();const P=U,Et=t=>{P.setUserAttributes(t)},It=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},G=t=>t instanceof URLSearchParams?It(t):t,z=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function vt(){return c()&&window.self!==window.top}function J(t){return vt()&&z(t||window.location.search).indexOf("builder.frameEditing=")!==-1}function At(t){const e=t||(c()?window.location.search:void 0);return e?z(e).indexOf("builder.preview=")!==-1:!1}const kt=t=>({type:"builder.registerComponent",data:R(t)}),Ut=t=>{const e=t.toString().trim(),r=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!r?"function ":""}${e}).apply(this, arguments)`};function R(t){return JSON.parse(JSON.stringify(t,(e,r)=>typeof r=="function"?Ut(r):r))}const F={};function Tt(t,e){t==="plugin"&&(e=R(e));let r=F[t];if(r||(r=F[t]=[]),r.push(e),c()){const n={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(n,"*"),parent!==window&&window.postMessage(n,"*")}catch(s){console.debug("Could not postmessage",s)}}}const K={};function Ot(t){if(c()){Object.assign(K,t);const e={type:"builder.settingsChange",data:K};parent.postMessage(e,"*")}}const M="builder.",Pt="options.",C=t=>{if(!t)return{};const e=G(t),r={};return Object.keys(e).forEach(n=>{if(n.startsWith(M)){const s=n.replace(M,"").replace(Pt,"");r[s]=e[n]}}),r},Rt=()=>{if(!c())return{};const t=new URLSearchParams(window.location.search);return C(t)},X="4.1.2",H=()=>({"X-Builder-SDK":S,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":X});function Ct(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function Q(){return Ct().replace(/-/g,"")}const Y="builderSessionId",Bt=async({canTrack:t})=>{if(!t)return;const e=await $({name:Y,canTrack:t});if(p(e))return e;{const r=xt();return _t({id:r,canTrack:t}),r}},xt=()=>Q(),_t=({id:t,canTrack:e})=>O({name:Y,value:t,canTrack:e}),Z=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,Lt=({key:t,canTrack:e})=>{var r;try{return e?(r=Z())==null?void 0:r.getItem(t):void 0}catch(n){console.debug("[LocalStorage] GET error: ",n);return}},Nt=({key:t,canTrack:e,value:r})=>{var n;try{e&&((n=Z())==null||n.setItem(t,r))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},q="builderVisitorId",Vt=({canTrack:t})=>{if(!t)return;const e=Lt({key:q,canTrack:t});if(p(e))return e;{const r=Dt();return Ft({id:r,canTrack:t}),r}},Dt=()=>Q(),Ft=({id:t,canTrack:e})=>Nt({key:q,value:t,canTrack:e});function tt(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&d.log(t)}const Kt=()=>{if(c()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},Mt=()=>typeof navigator=="object"&&navigator.userAgent||"",et=()=>{const t=Mt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||S==="reactNative"}},r=t.match(/Tablet|iPad/i),n=Kt();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:r?"tablet":e.any()?"mobile":"desktop"}},Wt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await Bt({canTrack:t}),r=Vt({canTrack:t});return{sessionId:e,visitorId:r}},jt=async({type:t,canTrack:e,apiKey:r,metadata:n,...s})=>({type:t,data:{...s,metadata:{url:location.href,...n},...await Wt({canTrack:e}),userAttributes:et(),ownerId:r}});async function rt({apiHost:t,...e}){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||J()||!(c()||S==="reactNative"))return;const n=`${t||"https://cdn.builder.io"}/api/v1/track`;return tt(n),fetch(n,{method:"POST",body:JSON.stringify({events:[await jt(e)]}),headers:{"content-type":"application/json",...H()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const $t=t=>rt({...t,canTrack:!0}),Gt=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function nt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const r=new URL(e.origin),n=r.hostname;return(t||Gt).findIndex(s=>s.startsWith("*.")?n.endsWith(s.slice(1)):s===n)>-1}let W=!1;const st=t=>{var e,r;W||(W=!0,c()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:S,version:X,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:t.modelName,apiKey:t.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(r=window.parent)==null||r.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",n=>{var o,i;if(!nt(t.trustedHosts,n))return;const{data:s}=n;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,m=s.data.arguments||[],b=s.data.id,w=new Function(u);let l,h=null;try{l=w.apply(null,m)}catch(g){h=g}h?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:b,error:h.message}},"*"):l&&typeof l.then=="function"?l.then(g=>{var E;(E=window.parent)==null||E.postMessage({type:"builder.evaluateResult",data:{id:b,result:g}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:l,id:b}},"*");break}}})))},ot=({model:t,trustedHosts:e,callbacks:r})=>n=>{if(!nt(e,n))return;const{data:s}=n;if(s)switch(s.type){case"builder.configureSdk":{r.configureSdk(s.data);break}case"builder.triggerAnimation":{r.animation(s.data);break}case"builder.resetState":{const o=s.data,i=o.model,u=o==null?void 0:o.state;i===t&&u&&r.stateUpdate(u);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data;i===t&&r.contentUpdate(u);break}}},zt=({model:t,apiKey:e,callback:r,trustedHosts:n})=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};st({modelName:t,apiKey:e});const s=ot({callbacks:{contentUpdate:r,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:t,trustedHosts:n});return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},Jt="builder.tests",B=t=>`${Jt}.${t}`,Xt=({contentId:t})=>$({name:B(t),canTrack:!0}),Ht=({contentId:t})=>A({name:B(t),canTrack:!0}),Qt=({contentId:t,value:e})=>O({name:B(t),value:e,canTrack:!0}),it=t=>p(t.id)&&p(t.variations)&&Object.keys(t.variations).length>0,Yt=({id:t,variations:e})=>{var s;let r=0;const n=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(r+=i,n<r)return o}return t},at=t=>{const e=Yt(t);return Qt({contentId:t.id,value:e}).catch(r=>{d.error("could not store A/B test variation: ",r)}),e},ct=({item:t,testGroupId:e})=>{const r=t.variations[e];return e===t.id||!r?{testVariationId:t.id,testVariationName:"Default"}:{data:r.data,testVariationId:r.id,testVariationName:r.name||(r.id===t.id?"Default":"")}},Zt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!it(t))return t;const r=Ht({contentId:t.id})||at({variations:t.variations,id:t.id}),n=ct({item:t,testGroupId:r});return{...t,...n}},qt=async({item:t,canTrack:e})=>{if(!e||!it(t))return t;const n=await Xt({contentId:t.id})||at({variations:t.variations,id:t.id}),s=ct({item:t,testGroupId:n});return{...t,...s}},ut=t=>{const e=p(t)?t:!0;return P.setCanTrack(e),e};function te(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ee(){const t=te().fetch;if(typeof t=="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 t}const re=ee();function T(t,e=null,r="."){return Object.keys(t).reduce((n,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(r);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...n,...T(o,i,r)}:{...n,[i]:o}},{})}function lt(t,e,r={}){for(const n in t){const s=t[n],o=e?e+"."+n:n;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?lt(s,o,r):r[o]=s}return r}function ne(t){const e={};for(const r in t){const n=r.split(".");let s=e;for(let o=0;o<n.length;o++){const i=n[o];o===n.length-1?s[i]=t[r]:(s[i]=s[i]||{},s=s[i])}}return e}const se="v3",j=t=>typeof t=="number"&&!isNaN(t)&&t>=0,x=t=>{const{limit:e=30,userAttributes:r,query:n,model:s,apiKey:o,enrich:i,locale:u,apiVersion:m=se,fields:b,omit:w,offset:l,cacheSeconds:h,staleCacheSeconds:g,sort:E,includeUnpublished:_,apiHost:gt}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(m))throw new Error(`Invalid apiVersion: expected 'v3', received '${m}'`);const pt=e!==1,St=gt||"https://cdn.builder.io",a=new URL(`${St}/api/${m}/content/${s}`);a.searchParams.set("apiKey",o),a.searchParams.set("limit",String(e)),a.searchParams.set("noTraverse",String(pt)),a.searchParams.set("includeRefs",String(!0));const k=u||(r==null?void 0:r.locale);let y=r||{};if(k&&(a.searchParams.set("locale",k),y={locale:k,...y}),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",w!=null?w:"meta.componentsUsed"),b&&a.searchParams.set("fields",b),Number.isFinite(l)&&l>-1&&a.searchParams.set("offset",String(Math.floor(l))),typeof _=="boolean"&&a.searchParams.set("includeUnpublished",String(_)),h&&j(h)&&a.searchParams.set("cacheSeconds",String(h)),g&&j(g)&&a.searchParams.set("staleCacheSeconds",String(g)),E){const f=T({sort:E});for(const I in f)a.searchParams.set(I,JSON.stringify(f[I]))}const L={...Rt(),...G(t.options||{})};y={...y,...ie(L)};const N=T(L);for(const f in N)a.searchParams.set(f,String(N[f]));if(Object.keys(y).length>0&&a.searchParams.set("userAttributes",JSON.stringify(y)),n){const f=lt({query:n});for(const I in f)a.searchParams.set(I,JSON.stringify(f[I]))}return a},oe=t=>{const e={};for(const r in t)r.startsWith("userAttributes.")&&(e[r]=t[r],delete t[r]);return e},ie=t=>{if(c()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=oe(t),{userAttributes:r}=ne(e);return r}return{}},ae=t=>"results"in t;async function dt(t){const e=await ht({...t,limit:1});return e&&e[0]||null}const ce=async t=>{var i,u;const e=x(t),r=(i=t.fetch)!=null?i:re,n={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,...H()}};return await(await r(e.href,n)).json()},ft=async(t,e,r=x(t))=>{const n=ut(t.canTrack);if(r.search.includes("preview="),!n||!(c()||S==="reactNative"))return e.results;try{const s=[];for(const o of e.results)s.push(await qt({item:o,canTrack:n}));e.results=s}catch(s){d.error("Could not process A/B tests. ",s)}return e.results};async function ht(t){const e=x(t),r=await ce(t);if(!ae(r))throw d.error("Error fetching data. ",{url:e,content:r,options:t}),r;return ft(t,r)}const ue=async t=>{var n,s,o;const e=t.path||((n=t.url)==null?void 0:n.pathname)||((s=t.userAttributes)==null?void 0:s.urlPath),r={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:C(t.searchParams||((o=t.url)==null?void 0:o.searchParams)||t.options)};return{apiKey:r.apiKey,model:r.model,content:await dt(r)}};exports.TARGET=S;exports._processContentResult=ft;exports._track=rt;exports.checkIsDefined=p;exports.createEditorListener=ot;exports.createRegisterComponentMessage=kt;exports.fetchBuilderProps=ue;exports.fetchEntries=ht;exports.fetchOneEntry=dt;exports.getBuilderSearchParams=C;exports.getCookieSync=A;exports.getDefaultCanTrack=ut;exports.getUserAttributes=et;exports.handleABTestingSync=Zt;exports.isBrowser=c;exports.isEditing=J;exports.isPreviewing=At;exports.logFetch=tt;exports.logger=d;exports.register=Tt;exports.serializeIncludingFunctions=R;exports.setClientUserAttributes=Et;exports.setEditorSettings=Ot;exports.setupBrowserForEditing=st;exports.subscribeToEditor=zt;exports.track=$t;exports.userAttributesService=P;