@builder.io/sdk-vue 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/packages/_vue2/dist/{block-styles.cacb4849.cjs → block-styles.aaf62526.cjs} +1 -1
  3. package/packages/_vue2/dist/{block-styles.6a1d7394.js → block-styles.c38fdaef.js} +4 -4
  4. package/packages/_vue2/dist/{css.49cc4003.js → css.377600fa.js} +2 -2
  5. package/packages/{_vue3/dist/css.627e21ae.cjs → _vue2/dist/css.4a664d41.cjs} +1 -1
  6. package/packages/_vue2/dist/{evaluate.6ab6e7cb.js → evaluate.d2d16952.js} +1 -1
  7. package/packages/_vue2/dist/{evaluate.7d21bb04.cjs → evaluate.d837a845.cjs} +2 -2
  8. package/packages/_vue2/dist/{index.2473a355.js → index.1074d675.js} +102 -102
  9. package/packages/_vue2/dist/{index.95d9006f.cjs → index.3d5a7a37.cjs} +6 -6
  10. package/packages/_vue2/dist/{render-block.22052bd8.js → render-block.1ec27d4d.js} +6 -6
  11. package/packages/_vue2/dist/{render-block.9342f7b5.cjs → render-block.43f24cc4.cjs} +2 -2
  12. package/packages/_vue2/dist/{render-component.ec485884.js → render-component.82a8e6f7.js} +3 -3
  13. package/packages/_vue2/dist/{render-component.f3cccaa9.cjs → render-component.ba549c84.cjs} +1 -1
  14. package/packages/_vue2/dist/{render-content.d53085e5.cjs → render-content.2c57f5bb.cjs} +1 -1
  15. package/packages/_vue2/dist/{render-content.a6b17a6c.js → render-content.3afd4a46.js} +5 -5
  16. package/packages/_vue2/dist/{render-inlined-styles.b322c74a.cjs → render-inlined-styles.1ed1b531.cjs} +1 -1
  17. package/packages/_vue2/dist/{render-inlined-styles.2286ef7c.js → render-inlined-styles.f76aba42.js} +1 -1
  18. package/packages/_vue2/dist/{render-repeated-block.253c96e6.cjs → render-repeated-block.625e26fc.cjs} +1 -1
  19. package/packages/_vue2/dist/{render-repeated-block.ac4f1559.js → render-repeated-block.d3c2411b.js} +2 -2
  20. package/packages/_vue2/dist/{render-styles.a148b748.js → render-styles.7b01db22.js} +2 -2
  21. package/packages/_vue2/dist/{render-styles.0cb949b0.cjs → render-styles.f1413001.cjs} +3 -3
  22. package/packages/_vue2/dist/sdk.cjs +1 -1
  23. package/packages/_vue2/dist/sdk.js +1 -1
  24. package/packages/_vue2/dist/src/components/render-block/render-repeated-block.vue.d.ts +0 -9
  25. package/packages/_vue2/dist/src/constants/sdk-version.d.ts +1 -1
  26. package/packages/_vue3/dist/sdk.cjs +72 -1
  27. package/packages/_vue3/dist/sdk.js +3251 -22
  28. package/packages/_vue3/dist/src/components/render-block/render-repeated-block.vue.d.ts +0 -9
  29. package/packages/_vue3/dist/src/constants/sdk-version.d.ts +1 -1
  30. package/packages/_vue3/dist/style.css +1 -1
  31. package/packages/_vue2/dist/css.c26b7ab4.cjs +0 -6
  32. package/packages/_vue3/dist/block-styles.5b949efb.cjs +0 -1
  33. package/packages/_vue3/dist/block-styles.e91165b8.js +0 -72
  34. package/packages/_vue3/dist/css.41ed2294.js +0 -75
  35. package/packages/_vue3/dist/evaluate.0662f166.js +0 -63
  36. package/packages/_vue3/dist/evaluate.da45a33b.cjs +0 -4
  37. package/packages/_vue3/dist/index.3a561c6a.js +0 -1394
  38. package/packages/_vue3/dist/index.3e17c057.cjs +0 -32
  39. package/packages/_vue3/dist/render-block.20c07cb1.cjs +0 -3
  40. package/packages/_vue3/dist/render-block.e9a2cb71.js +0 -273
  41. package/packages/_vue3/dist/render-component.20ef18f7.cjs +0 -1
  42. package/packages/_vue3/dist/render-component.afa60a7b.js +0 -42
  43. package/packages/_vue3/dist/render-content.20bd0f8d.js +0 -1354
  44. package/packages/_vue3/dist/render-content.e790eee5.cjs +0 -1
  45. package/packages/_vue3/dist/render-inlined-styles.0444f4fe.js +0 -16
  46. package/packages/_vue3/dist/render-inlined-styles.14d9ba36.cjs +0 -1
  47. package/packages/_vue3/dist/render-repeated-block.5a245883.js +0 -32
  48. package/packages/_vue3/dist/render-repeated-block.75230844.cjs +0 -1
  49. package/packages/_vue3/dist/render-styles.73c7ba5a.js +0 -80
  50. package/packages/_vue3/dist/render-styles.bd7475f8.cjs +0 -31
@@ -1,1394 +0,0 @@
1
- import { defineComponent as S, openBlock as l, createElementBlock as u, mergeProps as E, toHandlers as P, toDisplayString as H, defineAsyncComponent as T, resolveComponent as I, normalizeClass as K, normalizeStyle as _, createBlock as V, createCommentVNode as $, Fragment as C, renderList as N, createVNode as M, renderSlot as L, createElementVNode as J, resolveDynamicComponent as ge } from "vue";
2
- const ye = S({
3
- name: "builder-button",
4
- props: ["attributes", "text", "link", "openLinkInNewTab"],
5
- methods: {
6
- filterAttrs: function(t = {}, n) {
7
- const o = "v-on:";
8
- return Object.keys(t).filter((r) => {
9
- if (!t[r])
10
- return !1;
11
- const s = r.startsWith(o);
12
- return n ? s : !s;
13
- }).reduce(
14
- (r, s) => ({
15
- ...r,
16
- [s.replace(o, "")]: t[s]
17
- }),
18
- {}
19
- );
20
- },
21
- _classStringToObject(e) {
22
- const t = {};
23
- if (typeof e != "string")
24
- return t;
25
- const n = e.trim().split(/\s+/);
26
- for (const o of n)
27
- t[o] = !0;
28
- return t;
29
- }
30
- }
31
- });
32
- const v = (e, t) => {
33
- const n = e.__vccOpts || e;
34
- for (const [o, r] of t)
35
- n[o] = r;
36
- return n;
37
- }, ke = ["href", "target"];
38
- function Se(e, t, n, o, r, s) {
39
- return e.link ? (l(), u("a", E({
40
- key: 0,
41
- role: "button",
42
- href: e.link,
43
- target: e.openLinkInNewTab ? "_blank" : void 0
44
- }, e.filterAttrs(e.attributes, !1), P(e.filterAttrs(e.attributes, !0), !0)), H(e.text), 17, ke)) : (l(), u("button", E({
45
- key: 1,
46
- class: e._classStringToObject(
47
- e.attributes.class + " button-361b1o6wv2k"
48
- )
49
- }, e.filterAttrs(e.attributes, !1), P(e.filterAttrs(e.attributes, !0), !0)), H(e.text), 17));
50
- }
51
- const Xt = /* @__PURE__ */ v(ye, [["render", Se], ["__scopeId", "data-v-a4481d84"]]), z = (e) => JSON.parse(JSON.stringify(e)), te = {
52
- small: {
53
- min: 320,
54
- default: 321,
55
- max: 640
56
- },
57
- medium: {
58
- min: 641,
59
- default: 642,
60
- max: 991
61
- },
62
- large: {
63
- min: 990,
64
- default: 991,
65
- max: 1200
66
- }
67
- }, Yt = (e, t = te) => `@media (max-width: ${t[e].max}px)`, ve = ({ small: e, medium: t }) => {
68
- const n = z(te);
69
- if (!e || !t)
70
- return n;
71
- const o = Math.floor(e / 2);
72
- n.small = {
73
- max: e,
74
- min: o,
75
- default: o + 1
76
- };
77
- const r = n.small.max + 1;
78
- n.medium = {
79
- max: t,
80
- min: r,
81
- default: r + 1
82
- };
83
- const s = n.medium.max + 1;
84
- return n.large = {
85
- max: 2e3,
86
- min: s,
87
- default: s + 1
88
- }, n;
89
- }, x = "vue3", $e = Symbol(), D = {
90
- Builder: {
91
- content: null,
92
- context: {},
93
- localState: void 0,
94
- rootSetState() {
95
- },
96
- rootState: {},
97
- apiKey: null,
98
- apiVersion: void 0,
99
- registeredComponents: {},
100
- inheritedStyles: {}
101
- },
102
- key: $e
103
- }, we = () => Promise.resolve().then(() => Ke).then((e) => e.default).catch((e) => {
104
- throw console.error(
105
- "Error while attempting to dynamically import component RenderBlocks at ../../components/render-blocks.vue",
106
- e
107
- ), e;
108
- }), Ce = () => import("./render-inlined-styles.0444f4fe.js").then((e) => e.default).catch((e) => {
109
- throw console.error(
110
- "Error while attempting to dynamically import component RenderInlinedStyles at ../../components/render-inlined-styles.vue",
111
- e
112
- ), e;
113
- }), Te = S({
114
- name: "builder-columns",
115
- components: {
116
- RenderInlinedStyles: T(Ce),
117
- RenderBlocks: T(we)
118
- },
119
- props: [
120
- "space",
121
- "columns",
122
- "stackColumnsAt",
123
- "reverseColumnsWhenStacked",
124
- "builderBlock"
125
- ],
126
- data() {
127
- return {
128
- gutterSize: typeof this.space == "number" ? this.space || 0 : 20,
129
- cols: this.columns || [],
130
- stackAt: this.stackColumnsAt || "tablet",
131
- flexDir: this.stackColumnsAt === "never" ? "row" : this.reverseColumnsWhenStacked ? "column-reverse" : "column",
132
- TARGET: x
133
- };
134
- },
135
- inject: {
136
- builderContext: D.key
137
- },
138
- computed: {
139
- columnsCssVars() {
140
- return {
141
- "--flex-dir": this.flexDir,
142
- "--flex-dir-tablet": this.getTabletStyle({
143
- stackedStyle: this.flexDir,
144
- desktopStyle: "row"
145
- })
146
- };
147
- },
148
- columnsStyles() {
149
- return `
150
- @media (max-width: ${this.getWidthForBreakpointSize("medium")}px) {
151
- .${this.builderBlock.id}-breakpoints {
152
- flex-direction: var(--flex-dir-tablet);
153
- align-items: stretch;
154
- }
155
-
156
- .${this.builderBlock.id}-breakpoints > .builder-column {
157
- width: var(--column-width-tablet) !important;
158
- margin-left: var(--column-margin-left-tablet) !important;
159
- }
160
- }
161
-
162
- @media (max-width: ${this.getWidthForBreakpointSize("small")}px) {
163
- .${this.builderBlock.id}-breakpoints {
164
- flex-direction: var(--flex-dir);
165
- align-items: stretch;
166
- }
167
-
168
- .${this.builderBlock.id}-breakpoints > .builder-column {
169
- width: var(--column-width-mobile) !important;
170
- margin-left: var(--column-margin-left-mobile) !important;
171
- }
172
- },
173
- `;
174
- }
175
- },
176
- methods: {
177
- getWidth(e) {
178
- var t;
179
- return ((t = this.cols[e]) == null ? void 0 : t.width) || 100 / this.cols.length;
180
- },
181
- getColumnCssWidth(e) {
182
- const t = this.gutterSize * (this.cols.length - 1) / this.cols.length;
183
- return `calc(${this.getWidth(e)}% - ${t}px)`;
184
- },
185
- getTabletStyle({
186
- stackedStyle: e,
187
- desktopStyle: t
188
- }) {
189
- return this.stackAt === "tablet" ? e : t;
190
- },
191
- getMobileStyle({
192
- stackedStyle: e,
193
- desktopStyle: t
194
- }) {
195
- return this.stackAt === "never" ? t : e;
196
- },
197
- columnCssVars(e) {
198
- const t = e === 0 ? 0 : this.gutterSize, n = this.getColumnCssWidth(e), o = `${t}px`, r = "100%", s = 0;
199
- return {
200
- width: n,
201
- "margin-left": o,
202
- "--column-width-mobile": this.getMobileStyle({
203
- stackedStyle: r,
204
- desktopStyle: n
205
- }),
206
- "--column-margin-left-mobile": this.getMobileStyle({
207
- stackedStyle: s,
208
- desktopStyle: o
209
- }),
210
- "--column-width-tablet": this.getTabletStyle({
211
- stackedStyle: r,
212
- desktopStyle: n
213
- }),
214
- "--column-margin-left-tablet": this.getTabletStyle({
215
- stackedStyle: s,
216
- desktopStyle: o
217
- })
218
- };
219
- },
220
- getWidthForBreakpointSize(e) {
221
- var n, o;
222
- return ve(
223
- ((o = (n = this.builderContext.content) == null ? void 0 : n.meta) == null ? void 0 : o.breakpoints) || {}
224
- )[e].max;
225
- },
226
- _classStringToObject(e) {
227
- const t = {};
228
- if (typeof e != "string")
229
- return t;
230
- const n = e.trim().split(/\s+/);
231
- for (const o of n)
232
- t[o] = !0;
233
- return t;
234
- }
235
- }
236
- });
237
- function Ie(e, t, n, o, r, s) {
238
- const i = I("render-inlined-styles"), c = I("render-blocks");
239
- return l(), u("div", {
240
- class: K(
241
- e._classStringToObject(
242
- `builder-columns ${e.builderBlock.id}-breakpoints div-1eih9th5ow6`
243
- )
244
- ),
245
- style: _(e.columnsCssVars),
246
- dataSet: {
247
- "builder-block-name": "builder-columns"
248
- }
249
- }, [
250
- e.TARGET !== "reactNative" ? (l(), V(i, {
251
- key: 0,
252
- styles: e.columnsStyles
253
- }, null, 8, ["styles"])) : $("", !0),
254
- (l(!0), u(C, null, N(e.columns, (a, d) => (l(), u("div", {
255
- key: d,
256
- class: "builder-column div-1eih9th5ow6-2",
257
- style: _(e.columnCssVars(d)),
258
- dataSet: {
259
- "builder-block-name": "builder-column"
260
- }
261
- }, [
262
- M(c, {
263
- blocks: a.blocks,
264
- path: `component.options.columns.${d}.blocks`,
265
- parent: e.builderBlock.id,
266
- styleProp: {
267
- flexGrow: "1"
268
- }
269
- }, null, 8, ["blocks", "path", "parent"])
270
- ], 4))), 128))
271
- ], 6);
272
- }
273
- const Zt = /* @__PURE__ */ v(Te, [["render", Ie], ["__scopeId", "data-v-cc8d4c1f"]]), Re = S({
274
- name: "builder-fragment-component",
275
- props: []
276
- });
277
- function Ae(e, t, n, o, r, s) {
278
- return l(), u("span", null, [
279
- L(e.$slots, "default")
280
- ]);
281
- }
282
- const en = /* @__PURE__ */ v(Re, [["render", Ae]]);
283
- function q(e) {
284
- return e.replace(/http(s)?:/, "");
285
- }
286
- function Ee(e = "", t, n) {
287
- const o = new RegExp("([?&])" + t + "=.*?(&|$)", "i"), r = e.indexOf("?") !== -1 ? "&" : "?";
288
- return e.match(o) ? e.replace(o, "$1" + t + "=" + encodeURIComponent(n) + "$2") : e + r + t + "=" + encodeURIComponent(n);
289
- }
290
- function _e(e, t) {
291
- if (!e || !(e != null && e.match(/cdn\.shopify\.com/)) || !t)
292
- return e;
293
- if (t === "master")
294
- return q(e);
295
- const n = e.match(
296
- /(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i
297
- );
298
- if (n) {
299
- const o = e.split(n[0]), r = n[3], s = t.match("x") ? t : `${t}x`;
300
- return q(`${o[0]}_${s}${r}`);
301
- }
302
- return null;
303
- }
304
- function W(e) {
305
- if (!e)
306
- return e;
307
- const t = [100, 200, 400, 800, 1200, 1600, 2e3];
308
- if (e.match(/builder\.io/)) {
309
- let n = e;
310
- const o = Number(e.split("?width=")[1]);
311
- return isNaN(o) || (n = `${n} ${o}w`), t.filter((r) => r !== o).map((r) => `${Ee(e, "width", r)} ${r}w`).concat([n]).join(", ");
312
- }
313
- return e.match(/cdn\.shopify\.com/) ? t.map((n) => [_e(e, `${n}x${n}`), n]).filter(([n]) => !!n).map(([n, o]) => `${n} ${o}w`).concat([e]).join(", ") : e;
314
- }
315
- const Ve = S({
316
- name: "builder-image",
317
- props: [
318
- "image",
319
- "src",
320
- "srcset",
321
- "noWebp",
322
- "aspectRatio",
323
- "altText",
324
- "backgroundPosition",
325
- "backgroundSize",
326
- "className",
327
- "sizes",
328
- "builderBlock",
329
- "fitContent"
330
- ],
331
- computed: {
332
- srcSetToUse() {
333
- var n;
334
- const t = this.image || this.src;
335
- if (!t || !(t.match(/builder\.io/) || t.match(/cdn\.shopify\.com/)))
336
- return this.srcset;
337
- if (this.srcset && ((n = this.image) == null ? void 0 : n.includes("builder.io/api/v1/image"))) {
338
- if (!this.srcset.includes(this.image.split("?")[0]))
339
- return console.debug("Removed given srcset"), W(t);
340
- } else if (this.image && !this.srcset)
341
- return W(t);
342
- return W(t);
343
- },
344
- webpSrcSet() {
345
- var e;
346
- return ((e = this.srcSetToUse) == null ? void 0 : e.match(/builder\.io/)) && !this.noWebp ? this.srcSetToUse.replace(/\?/g, "?format=webp&") : "";
347
- },
348
- aspectRatioCss() {
349
- const e = {
350
- position: "absolute",
351
- height: "100%",
352
- width: "100%",
353
- left: "0px",
354
- top: "0px"
355
- };
356
- return this.aspectRatio ? e : void 0;
357
- }
358
- },
359
- methods: {
360
- _classStringToObject(e) {
361
- const t = {};
362
- if (typeof e != "string")
363
- return t;
364
- const n = e.trim().split(/\s+/);
365
- for (const o of n)
366
- t[o] = !0;
367
- return t;
368
- }
369
- }
370
- });
371
- const Oe = ["srcset"], Be = ["alt", "role", "src", "srcset", "sizes"], je = {
372
- key: 2,
373
- class: "div-256wrwn33ry-2"
374
- };
375
- function Pe(e, t, n, o, r, s) {
376
- var i, c, a, d;
377
- return l(), u(C, null, [
378
- J("picture", null, [
379
- e.webpSrcSet ? (l(), u("source", {
380
- key: 0,
381
- type: "image/webp",
382
- srcset: e.webpSrcSet
383
- }, null, 8, Oe)) : $("", !0),
384
- J("img", {
385
- loading: "lazy",
386
- alt: e.altText,
387
- role: e.altText ? "presentation" : void 0,
388
- style: _({
389
- objectPosition: e.backgroundPosition || "center",
390
- objectFit: e.backgroundSize || "cover",
391
- ...e.aspectRatioCss
392
- }),
393
- class: K(
394
- e._classStringToObject(
395
- "builder-image" + (e.className ? " " + e.className : "") + " img-256wrwn33ry"
396
- )
397
- ),
398
- src: e.image,
399
- srcset: e.srcSetToUse,
400
- sizes: e.sizes
401
- }, null, 14, Be)
402
- ]),
403
- e.aspectRatio && !(((c = (i = e.builderBlock) == null ? void 0 : i.children) == null ? void 0 : c.length) && e.fitContent) ? (l(), u("div", {
404
- key: 0,
405
- class: "builder-image-sizer div-256wrwn33ry",
406
- style: _({
407
- paddingTop: e.aspectRatio * 100 + "%"
408
- })
409
- }, null, 4)) : $("", !0),
410
- ((d = (a = e.builderBlock) == null ? void 0 : a.children) == null ? void 0 : d.length) && e.fitContent ? L(e.$slots, "default", { key: 1 }, void 0, !0) : $("", !0),
411
- !e.fitContent && e.children ? (l(), u("div", je, [
412
- L(e.$slots, "default", {}, void 0, !0)
413
- ])) : $("", !0)
414
- ], 64);
415
- }
416
- const tn = /* @__PURE__ */ v(Ve, [["render", Pe], ["__scopeId", "data-v-15a2d98b"]]);
417
- function y() {
418
- return typeof window < "u" && typeof document < "u";
419
- }
420
- function Ne() {
421
- return y() && window.self !== window.top;
422
- }
423
- function U() {
424
- return Ne() && window.location.search.indexOf("builder.frameEditing=") !== -1;
425
- }
426
- const Me = () => import("./block-styles.e91165b8.js").then((e) => e.default).catch((e) => {
427
- throw console.error(
428
- "Error while attempting to dynamically import component BlockStyles at ./render-block/block-styles.vue",
429
- e
430
- ), e;
431
- }), Le = () => import("./render-block.e9a2cb71.js").then((e) => e.default).catch((e) => {
432
- throw console.error(
433
- "Error while attempting to dynamically import component RenderBlock at ./render-block/render-block.vue",
434
- e
435
- ), e;
436
- }), Ue = S({
437
- name: "render-blocks",
438
- components: {
439
- RenderBlock: T(Le),
440
- BlockStyles: T(Me)
441
- },
442
- props: ["blocks", "parent", "path", "styleProp"],
443
- inject: {
444
- builderContext: D.key
445
- },
446
- computed: {
447
- className() {
448
- var e;
449
- return "builder-blocks" + ((e = this.blocks) != null && e.length ? "" : " no-blocks");
450
- }
451
- },
452
- methods: {
453
- onClick() {
454
- var e, t;
455
- U() && !((e = this.blocks) != null && e.length) && ((t = window.parent) == null || t.postMessage(
456
- {
457
- type: "builder.clickEmptyBlocks",
458
- data: {
459
- parentElementId: this.parent,
460
- dataPath: this.path
461
- }
462
- },
463
- "*"
464
- ));
465
- },
466
- onMouseEnter() {
467
- var e, t;
468
- U() && !((e = this.blocks) != null && e.length) && ((t = window.parent) == null || t.postMessage(
469
- {
470
- type: "builder.hoverEmptyBlocks",
471
- data: {
472
- parentElementId: this.parent,
473
- dataPath: this.path
474
- }
475
- },
476
- "*"
477
- ));
478
- },
479
- _classStringToObject(e) {
480
- const t = {};
481
- if (typeof e != "string")
482
- return t;
483
- const n = e.trim().split(/\s+/);
484
- for (const o of n)
485
- t[o] = !0;
486
- return t;
487
- }
488
- }
489
- });
490
- const xe = ["builder-path", "builder-parent-id", "dataSet"];
491
- function We(e, t, n, o, r, s) {
492
- const i = I("render-block"), c = I("block-styles");
493
- return l(), u("div", {
494
- class: K(e._classStringToObject(e.className + " div-4o9pb21oca6")),
495
- "builder-path": e.path,
496
- "builder-parent-id": e.parent,
497
- dataSet: {
498
- class: e.className
499
- },
500
- style: _(e.styleProp),
501
- onClick: t[0] || (t[0] = (a) => e.onClick()),
502
- onMouseenter: t[1] || (t[1] = (a) => e.onMouseEnter()),
503
- onKeypress: t[2] || (t[2] = (a) => e.onClick())
504
- }, [
505
- e.blocks ? (l(!0), u(C, { key: 0 }, N(e.blocks, (a, d) => (l(), V(i, {
506
- key: "render-block-" + a.id,
507
- block: a,
508
- context: e.builderContext
509
- }, null, 8, ["block", "context"]))), 128)) : $("", !0),
510
- e.blocks ? (l(!0), u(C, { key: 1 }, N(e.blocks, (a, d) => (l(), V(c, {
511
- key: "block-style-" + a.id,
512
- block: a,
513
- context: e.builderContext
514
- }, null, 8, ["block", "context"]))), 128)) : $("", !0)
515
- ], 46, xe);
516
- }
517
- const Fe = /* @__PURE__ */ v(Ue, [["render", We], ["__scopeId", "data-v-07645c8e"]]), Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
518
- __proto__: null,
519
- default: Fe
520
- }, Symbol.toStringTag, { value: "Module" })), ze = S({
521
- name: "builder-section-component",
522
- props: ["maxWidth", "attributes"],
523
- methods: {
524
- filterAttrs: function(t = {}, n) {
525
- const o = "v-on:";
526
- return Object.keys(t).filter((r) => {
527
- if (!t[r])
528
- return !1;
529
- const s = r.startsWith(o);
530
- return n ? s : !s;
531
- }).reduce(
532
- (r, s) => ({
533
- ...r,
534
- [s.replace(o, "")]: t[s]
535
- }),
536
- {}
537
- );
538
- }
539
- }
540
- });
541
- function De(e, t, n, o, r, s) {
542
- return l(), u("section", E({
543
- style: {
544
- width: "100%",
545
- alignSelf: "stretch",
546
- flexGrow: 1,
547
- boxSizing: "border-box",
548
- maxWidth: e.maxWidth || 1200,
549
- display: "flex",
550
- flexDirection: "column",
551
- alignItems: "stretch",
552
- marginLeft: "auto",
553
- marginRight: "auto"
554
- }
555
- }, e.filterAttrs(e.attributes, !1), P(e.filterAttrs(e.attributes, !0), !0)), [
556
- L(e.$slots, "default")
557
- ], 16);
558
- }
559
- const nn = /* @__PURE__ */ v(ze, [["render", De]]), O = "[Builder.io]: ", w = {
560
- log: (...e) => console.log(O, ...e),
561
- error: (...e) => console.error(O, ...e),
562
- warn: (...e) => console.warn(O, ...e),
563
- debug: (...e) => console.debug(O, ...e)
564
- }, A = (e) => e != null, Ge = (e) => {
565
- if (e === "localhost" || e === "127.0.0.1")
566
- return e;
567
- const t = e.split(".");
568
- return t.length > 2 ? t.slice(1).join(".") : e;
569
- }, ne = ({
570
- name: e,
571
- canTrack: t
572
- }) => {
573
- var n;
574
- try {
575
- return t ? (n = document.cookie.split("; ").find((o) => o.startsWith(`${e}=`))) == null ? void 0 : n.split("=")[1] : void 0;
576
- } catch (o) {
577
- w.warn("[COOKIE] GET error: ", (o == null ? void 0 : o.message) || o);
578
- return;
579
- }
580
- }, oe = async (e) => ne(e), He = (e) => e.map(([t, n]) => n ? `${t}=${n}` : t).filter(A).join("; "), Je = [
581
- ["secure", ""],
582
- ["SameSite", "None"]
583
- ], qe = ({
584
- name: e,
585
- value: t,
586
- expires: n
587
- }) => {
588
- const r = (y() ? location.protocol === "https:" : !0) ? Je : [[]], s = n ? [["expires", n.toUTCString()]] : [[]], i = [
589
- [e, t],
590
- ...s,
591
- ["path", "/"],
592
- ["domain", Ge(window.location.hostname)],
593
- ...r
594
- ];
595
- return He(i);
596
- }, re = async ({
597
- name: e,
598
- value: t,
599
- expires: n,
600
- canTrack: o
601
- }) => {
602
- try {
603
- if (!o)
604
- return;
605
- const r = qe({ name: e, value: t, expires: n });
606
- document.cookie = r;
607
- } catch (r) {
608
- w.warn("[COOKIE] SET error: ", (r == null ? void 0 : r.message) || r);
609
- }
610
- }, Qe = "builder.tests", G = (e) => `${Qe}.${e}`, Xe = ({ contentId: e }) => oe({ name: G(e), canTrack: !0 }), Ye = ({ contentId: e }) => ne({ name: G(e), canTrack: !0 }), Ze = ({
611
- contentId: e,
612
- value: t
613
- }) => re({ name: G(e), value: t, canTrack: !0 }), se = (e) => A(e.id) && A(e.variations) && Object.keys(e.variations).length > 0, et = ({
614
- id: e,
615
- variations: t
616
- }) => {
617
- var r;
618
- let n = 0;
619
- const o = Math.random();
620
- for (const s in t) {
621
- const i = (r = t[s]) == null ? void 0 : r.testRatio;
622
- if (n += i, o < n)
623
- return s;
624
- }
625
- return e;
626
- }, ie = (e) => {
627
- const t = et(e);
628
- return Ze({
629
- contentId: e.id,
630
- value: t
631
- }).catch((n) => {
632
- w.error("could not store A/B test variation: ", n);
633
- }), t;
634
- }, ae = ({
635
- item: e,
636
- testGroupId: t
637
- }) => {
638
- const n = e.variations[t];
639
- return t === e.id || !n ? {
640
- testVariationId: e.id,
641
- testVariationName: "Default"
642
- } : {
643
- data: n.data,
644
- testVariationId: n.id,
645
- testVariationName: n.name || (n.id === e.id ? "Default" : "")
646
- };
647
- }, tt = ({
648
- item: e,
649
- canTrack: t
650
- }) => {
651
- if (!t)
652
- return e;
653
- if (!e)
654
- return;
655
- if (!se(e))
656
- return e;
657
- const n = Ye({
658
- contentId: e.id
659
- }) || ie({
660
- variations: e.variations,
661
- id: e.id
662
- }), o = ae({ item: e, testGroupId: n });
663
- return {
664
- ...e,
665
- ...o
666
- };
667
- }, nt = async ({
668
- item: e,
669
- canTrack: t
670
- }) => {
671
- if (!t || !se(e))
672
- return e;
673
- const o = await Xe({
674
- contentId: e.id
675
- }) || ie({
676
- variations: e.variations,
677
- id: e.id
678
- }), r = ae({ item: e, testGroupId: o });
679
- return {
680
- ...e,
681
- ...r
682
- };
683
- }, B = (e) => A(e) ? e : !0;
684
- function ot() {
685
- return typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : globalThis;
686
- }
687
- function rt() {
688
- const e = ot().fetch;
689
- if (typeof e > "u")
690
- throw console.warn(
691
- `Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
692
- For more information, read https://github.com/BuilderIO/this-package-uses-fetch`
693
- ), new Error("Builder SDK could not find a global `fetch` function");
694
- return e;
695
- }
696
- const st = rt();
697
- function F(e, t = null, n = ".") {
698
- return Object.keys(e).reduce((o, r) => {
699
- const s = e[r], i = [t, r].filter(Boolean).join(n);
700
- return [
701
- typeof s == "object",
702
- s !== null,
703
- !(Array.isArray(s) && s.length === 0)
704
- ].every(Boolean) ? { ...o, ...F(s, i, n) } : { ...o, [i]: s };
705
- }, {});
706
- }
707
- const Q = "builder.", it = "options.", at = (e) => {
708
- const t = {};
709
- return e.forEach((n, o) => {
710
- t[o] = n;
711
- }), t;
712
- }, ct = (e) => {
713
- if (!e)
714
- return {};
715
- const t = ce(e), n = {};
716
- return Object.keys(t).forEach((o) => {
717
- if (o.startsWith(Q)) {
718
- const r = o.replace(Q, "").replace(it, "");
719
- n[r] = t[o];
720
- }
721
- }), n;
722
- }, lt = () => {
723
- if (!y())
724
- return {};
725
- const e = new URLSearchParams(window.location.search);
726
- return ct(e);
727
- }, ce = (e) => e instanceof URLSearchParams ? at(e) : e, dt = "v3", le = (e) => {
728
- const {
729
- limit: t = 30,
730
- userAttributes: n,
731
- query: o,
732
- noTraverse: r = !1,
733
- model: s,
734
- apiKey: i,
735
- includeRefs: c = !0,
736
- enrich: a,
737
- locale: d,
738
- apiVersion: m = dt
739
- } = e;
740
- if (!i)
741
- throw new Error("Missing API key");
742
- if (!["v2", "v3"].includes(m))
743
- throw new Error(
744
- `Invalid apiVersion: expected 'v2' or 'v3', received '${m}'`
745
- );
746
- const f = new URL(
747
- `https://cdn.builder.io/api/${m}/content/${s}?apiKey=${i}&limit=${t}&noTraverse=${r}&includeRefs=${c}${d ? `&locale=${d}` : ""}${a ? `&enrich=${a}` : ""}`
748
- ), h = {
749
- ...lt(),
750
- ...ce(e.options || {})
751
- }, b = F(h);
752
- for (const p in b)
753
- f.searchParams.set(p, String(b[p]));
754
- if (n && f.searchParams.set("userAttributes", JSON.stringify(n)), o) {
755
- const p = F({ query: o });
756
- for (const k in p)
757
- f.searchParams.set(k, JSON.stringify(p[k]));
758
- }
759
- return f;
760
- }, de = (e) => "results" in e;
761
- async function ut(e) {
762
- const t = await ft({ ...e, limit: 1 });
763
- return t && de(t) && t.results[0] || null;
764
- }
765
- const pt = async (e) => {
766
- const t = le(e);
767
- return await (await st(t.href)).json();
768
- }, mt = async (e, t) => {
769
- const n = B(e.canTrack);
770
- if (!n || !(y() || x === "reactNative"))
771
- return t;
772
- try {
773
- const o = [];
774
- for (const r of t.results)
775
- o.push(await nt({ item: r, canTrack: n }));
776
- t.results = o;
777
- } catch (o) {
778
- w.error("Could not process A/B tests. ", o);
779
- }
780
- return t;
781
- };
782
- async function ft(e) {
783
- try {
784
- const t = le(e), n = await pt(e);
785
- return de(n) ? mt(e, n) : (w.error("Error fetching data. ", { url: t, content: n, options: e }), n);
786
- } catch (t) {
787
- return w.error("Error fetching data. ", t), null;
788
- }
789
- }
790
- const ht = () => import("./render-content.20bd0f8d.js").then((e) => e.default).catch((e) => {
791
- throw console.error(
792
- "Error while attempting to dynamically import component RenderContent at ../../components/render-content/render-content.vue",
793
- e
794
- ), e;
795
- }), bt = S({
796
- name: "builder-symbol",
797
- components: { RenderContent: T(ht) },
798
- props: ["attributes", "symbol", "dynamic"],
799
- data() {
800
- var e, t, n;
801
- return {
802
- className: [
803
- ...Object.keys(this.attributes.class),
804
- "builder-symbol",
805
- (e = this.symbol) != null && e.inline ? "builder-inline-symbol" : void 0,
806
- ((t = this.symbol) == null ? void 0 : t.dynamic) || this.dynamic ? "builder-dynamic-symbol" : void 0
807
- ].filter(Boolean).join(" "),
808
- contentToUse: (n = this.symbol) == null ? void 0 : n.content
809
- };
810
- },
811
- inject: {
812
- builderContext: D.key
813
- },
814
- mounted() {
815
- this.fetchContent();
816
- },
817
- watch: {
818
- onUpdateHook0: {
819
- handler() {
820
- this.fetchContent();
821
- },
822
- immediate: !0
823
- }
824
- },
825
- computed: {
826
- onUpdateHook0() {
827
- return {
828
- 0: this.symbol
829
- };
830
- }
831
- },
832
- methods: {
833
- fetchContent() {
834
- var e, t;
835
- !this.contentToUse && ((e = this.symbol) == null ? void 0 : e.model) && ((t = this.builderContext) == null ? void 0 : t.apiKey) && ut({
836
- model: this.symbol.model,
837
- apiKey: this.builderContext.apiKey,
838
- apiVersion: this.builderContext.apiVersion,
839
- query: {
840
- id: this.symbol.entry
841
- }
842
- }).then((n) => {
843
- n && (this.contentToUse = n);
844
- }).catch((n) => {
845
- w.error("Could not fetch symbol content: ", n);
846
- });
847
- },
848
- filterAttrs: function(t = {}, n) {
849
- const o = "v-on:";
850
- return Object.keys(t).filter((r) => {
851
- if (!t[r])
852
- return !1;
853
- const s = r.startsWith(o);
854
- return n ? s : !s;
855
- }).reduce(
856
- (r, s) => ({
857
- ...r,
858
- [s.replace(o, "")]: t[s]
859
- }),
860
- {}
861
- );
862
- },
863
- _classStringToObject(e) {
864
- const t = {};
865
- if (typeof e != "string")
866
- return t;
867
- const n = e.trim().split(/\s+/);
868
- for (const o of n)
869
- t[o] = !0;
870
- return t;
871
- }
872
- }
873
- }), gt = ["dataSet"];
874
- function yt(e, t, n, o, r, s) {
875
- var c, a, d, m;
876
- const i = I("render-content");
877
- return l(), u("div", E({
878
- dataSet: {
879
- class: e.className
880
- },
881
- class: e._classStringToObject(e.className)
882
- }, e.filterAttrs(e.attributes, !1), P(e.filterAttrs(e.attributes, !0), !0)), [
883
- M(i, {
884
- apiVersion: e.builderContext.apiVersion,
885
- apiKey: e.builderContext.apiKey,
886
- context: e.builderContext.context,
887
- customComponents: Object.values(e.builderContext.registeredComponents),
888
- data: {
889
- ...(c = e.symbol) == null ? void 0 : c.data,
890
- ...e.builderContext.localState,
891
- ...(d = (a = e.contentToUse) == null ? void 0 : a.data) == null ? void 0 : d.state
892
- },
893
- model: (m = e.symbol) == null ? void 0 : m.model,
894
- content: e.contentToUse
895
- }, null, 8, ["apiVersion", "apiKey", "context", "customComponents", "data", "model", "content"])
896
- ], 16, gt);
897
- }
898
- const on = /* @__PURE__ */ v(bt, [["render", yt]]), kt = S({
899
- name: "builder-text",
900
- props: ["text"]
901
- }), St = ["innerHTML"];
902
- function vt(e, t, n, o, r, s) {
903
- return l(), u("span", {
904
- class: "builder-text",
905
- innerHTML: e.text,
906
- style: {
907
- outline: "none"
908
- }
909
- }, null, 8, St);
910
- }
911
- const rn = /* @__PURE__ */ v(kt, [["render", vt]]), $t = S({
912
- name: "builder-video",
913
- props: [
914
- "autoPlay",
915
- "muted",
916
- "controls",
917
- "loop",
918
- "playsInline",
919
- "attributes",
920
- "fit",
921
- "position",
922
- "video",
923
- "posterImage"
924
- ],
925
- computed: {
926
- videoProps() {
927
- return {
928
- ...this.autoPlay === !0 ? {
929
- autoPlay: !0
930
- } : {},
931
- ...this.muted === !0 ? {
932
- muted: !0
933
- } : {},
934
- ...this.controls === !0 ? {
935
- controls: !0
936
- } : {},
937
- ...this.loop === !0 ? {
938
- loop: !0
939
- } : {},
940
- ...this.playsInline === !0 ? {
941
- playsInline: !0
942
- } : {}
943
- };
944
- },
945
- spreadProps() {
946
- return {
947
- ...this.attributes,
948
- ...this.videoProps
949
- };
950
- }
951
- }
952
- }), wt = ["src", "poster"];
953
- function Ct(e, t, n, o, r, s) {
954
- var i;
955
- return l(), u("video", E({
956
- style: {
957
- width: "100%",
958
- height: "100%",
959
- ...(i = e.attributes) == null ? void 0 : i.style,
960
- objectFit: e.fit,
961
- objectPosition: e.position,
962
- borderRadius: 1
963
- },
964
- src: e.video || "no-src",
965
- poster: e.posterImage
966
- }, e.spreadProps), null, 16, wt);
967
- }
968
- const sn = /* @__PURE__ */ v($t, [["render", Ct]]), j = (e) => Object.values((e == null ? void 0 : e.variations) || {}), X = ({
969
- canTrack: e,
970
- content: t
971
- }) => !(!(j(t).length > 0) || !e || y());
972
- function Tt(e, t, n) {
973
- function o() {
974
- function i(b, p, k) {
975
- let R = "";
976
- if (k) {
977
- const g = new Date();
978
- g.setTime(g.getTime() + k * 24 * 60 * 60 * 1e3), R = "; expires=" + g.toUTCString();
979
- }
980
- document.cookie = b + "=" + (p || "") + R + "; path=/; Secure; SameSite=None";
981
- }
982
- function c(b) {
983
- const p = b + "=", k = document.cookie.split(";");
984
- for (let R = 0; R < k.length; R++) {
985
- let g = k[R];
986
- for (; g.charAt(0) === " "; )
987
- g = g.substring(1, g.length);
988
- if (g.indexOf(p) === 0)
989
- return g.substring(p.length, g.length);
990
- }
991
- return null;
992
- }
993
- const a = `builder.tests.${e}`, d = c(a), m = t.map((b) => b.id).concat(e);
994
- if (d && m.includes(d))
995
- return d;
996
- let f = 0;
997
- const h = Math.random();
998
- for (let b = 0; b < t.length; b++) {
999
- const p = t[b], k = p.testRatio;
1000
- if (f += k, h < f)
1001
- return i(a, p.id), p.id;
1002
- }
1003
- return i(a, e), e;
1004
- }
1005
- const r = o(), s = document.getElementById(
1006
- `variants-styles-${e}`
1007
- );
1008
- if (n) {
1009
- s.remove();
1010
- const i = document.getElementById(
1011
- `variants-script-${e}`
1012
- );
1013
- i == null || i.remove();
1014
- } else {
1015
- const i = t.concat({ id: e }).filter((c) => c.id !== r).map((c) => `.variant-${c.id} { display: none; }
1016
- `).join("");
1017
- s.innerHTML = i;
1018
- }
1019
- }
1020
- function It(e, t, n) {
1021
- if (!navigator.cookieEnabled)
1022
- return;
1023
- function o(a) {
1024
- const d = a + "=", m = document.cookie.split(";");
1025
- for (let f = 0; f < m.length; f++) {
1026
- let h = m[f];
1027
- for (; h.charAt(0) === " "; )
1028
- h = h.substring(1, h.length);
1029
- if (h.indexOf(d) === 0)
1030
- return h.substring(d.length, h.length);
1031
- }
1032
- return null;
1033
- }
1034
- const r = `builder.tests.${t}`, s = o(r), i = document.querySelector(
1035
- `[builder-content-id="${e}"]`
1036
- ), c = e === t;
1037
- if (s === e) {
1038
- if (c)
1039
- return;
1040
- i == null || i.removeAttribute("hidden"), i == null || i.removeAttribute("aria-hidden");
1041
- } else {
1042
- c && (n ? i == null || i.remove() : (i == null || i.setAttribute("hidden", "true"), i == null || i.setAttribute("aria-hidden", "true")));
1043
- return;
1044
- }
1045
- }
1046
- const ue = (e) => e === "react" || e === "reactNative" || e === "vue3" || e === "vue2", Y = "bldrAbTest", pe = "bldrCntntScrpt", Rt = (e, t) => {
1047
- const n = Tt.toString().replace(/\s+/g, " "), o = It.toString().replace(/\s+/g, " ");
1048
- return `
1049
- const ${Y} = ${n}
1050
- const ${pe} = ${o}
1051
- ${Y}("${t}", ${JSON.stringify(
1052
- e
1053
- )}, ${ue})
1054
- `;
1055
- }, an = ({
1056
- parentContentId: e,
1057
- contentId: t
1058
- }) => `
1059
- ${pe}("${t}", "${e}", ${ue})`, At = () => import("./render-content.20bd0f8d.js").then((e) => e.default).catch((e) => {
1060
- throw console.error(
1061
- "Error while attempting to dynamically import component RenderContent at ../render-content/render-content.vue",
1062
- e
1063
- ), e;
1064
- }), Et = () => import("./render-inlined-styles.0444f4fe.js").then((e) => e.default).catch((e) => {
1065
- throw console.error(
1066
- "Error while attempting to dynamically import component RenderInlinedStyles at ../render-inlined-styles.vue",
1067
- e
1068
- ), e;
1069
- }), _t = S({
1070
- name: "render-content-variants",
1071
- components: {
1072
- RenderInlinedStyles: T(Et),
1073
- RenderContent: T(At)
1074
- },
1075
- props: [
1076
- "content",
1077
- "canTrack",
1078
- "apiKey",
1079
- "apiVersion",
1080
- "customComponents",
1081
- "model"
1082
- ],
1083
- data() {
1084
- var e;
1085
- return {
1086
- variantScriptStr: Rt(
1087
- j(this.content).map((t) => ({
1088
- id: t.id,
1089
- testRatio: t.testRatio
1090
- })),
1091
- ((e = this.content) == null ? void 0 : e.id) || ""
1092
- ),
1093
- shouldRenderVariants: X({
1094
- canTrack: B(this.canTrack),
1095
- content: this.content
1096
- }),
1097
- hideVariantsStyleString: j(this.content).map((t) => `.variant-${t.id} { display: none; } `).join(""),
1098
- contentToRender: X({
1099
- canTrack: B(this.canTrack),
1100
- content: this.content
1101
- }) ? this.content : tt({
1102
- item: this.content,
1103
- canTrack: B(this.canTrack)
1104
- }),
1105
- getVariants: j
1106
- };
1107
- }
1108
- });
1109
- function Vt(e, t, n, o, r, s) {
1110
- var a, d, m, f;
1111
- const i = I("render-inlined-styles"), c = I("render-content");
1112
- return l(), u(C, null, [
1113
- e.shouldRenderVariants ? (l(), u(C, { key: 0 }, [
1114
- M(i, {
1115
- id: `variants-styles-${(a = e.content) == null ? void 0 : a.id}`,
1116
- styles: e.hideVariantsStyleString
1117
- }, null, 8, ["id", "styles"]),
1118
- (l(), V(ge("script"), {
1119
- id: `variants-script-${(d = e.content) == null ? void 0 : d.id}`,
1120
- innerHTML: e.variantScriptStr
1121
- }, null, 8, ["id", "innerHTML"])),
1122
- (l(!0), u(C, null, N(e.getVariants(e.content), (h, b) => {
1123
- var p;
1124
- return l(), V(c, {
1125
- key: h.id,
1126
- content: h,
1127
- apiKey: e.apiKey,
1128
- apiVersion: e.apiVersion,
1129
- canTrack: e.canTrack,
1130
- customComponents: e.customComponents,
1131
- hideContent: !0,
1132
- parentContentId: (p = e.content) == null ? void 0 : p.id,
1133
- isSsrAbTest: e.shouldRenderVariants
1134
- }, null, 8, ["content", "apiKey", "apiVersion", "canTrack", "customComponents", "parentContentId", "isSsrAbTest"]);
1135
- }), 128))
1136
- ], 64)) : $("", !0),
1137
- M(c, {
1138
- model: e.model,
1139
- content: e.contentToRender,
1140
- apiKey: e.apiKey,
1141
- apiVersion: e.apiVersion,
1142
- canTrack: e.canTrack,
1143
- customComponents: e.customComponents,
1144
- classNameProp: `variant-${(m = e.content) == null ? void 0 : m.id}`,
1145
- parentContentId: (f = e.content) == null ? void 0 : f.id,
1146
- isSsrAbTest: e.shouldRenderVariants
1147
- }, null, 8, ["model", "content", "apiKey", "apiVersion", "canTrack", "customComponents", "classNameProp", "parentContentId", "isSsrAbTest"])
1148
- ], 64);
1149
- }
1150
- const cn = /* @__PURE__ */ v(_t, [["render", Vt]]);
1151
- function ln() {
1152
- return !y() || U() ? !1 : Boolean(location.search.indexOf("builder.preview=") !== -1);
1153
- }
1154
- const Ot = (e) => {
1155
- const t = e.toString().trim();
1156
- return `return (${!t.startsWith("function") && !t.startsWith("(") ? "function " : ""}${t}).apply(this, arguments)`;
1157
- }, dn = [], un = ({
1158
- component: e,
1159
- ...t
1160
- }) => ({
1161
- type: "builder.registerComponent",
1162
- data: jt(t)
1163
- }), Bt = (e) => typeof e == "function" ? Ot(e) : z(e), jt = ({
1164
- inputs: e,
1165
- ...t
1166
- }) => ({
1167
- ...z(t),
1168
- inputs: e == null ? void 0 : e.map(
1169
- (n) => Object.entries(n).reduce(
1170
- (o, [r, s]) => ({
1171
- ...o,
1172
- [r]: Bt(s)
1173
- }),
1174
- {}
1175
- )
1176
- )
1177
- }), Z = {};
1178
- function pn(e, t) {
1179
- let n = Z[e];
1180
- if (n || (n = Z[e] = []), n.push(t), y()) {
1181
- const o = {
1182
- type: "builder.register",
1183
- data: {
1184
- type: e,
1185
- info: t
1186
- }
1187
- };
1188
- try {
1189
- parent.postMessage(o, "*"), parent !== window && window.postMessage(o, "*");
1190
- } catch (r) {
1191
- console.debug("Could not postmessage", r);
1192
- }
1193
- }
1194
- }
1195
- const ee = {};
1196
- function mn(e) {
1197
- if (y()) {
1198
- Object.assign(ee, e);
1199
- const t = {
1200
- type: "builder.settingsChange",
1201
- data: ee
1202
- };
1203
- parent.postMessage(t, "*");
1204
- }
1205
- }
1206
- function Pt() {
1207
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
1208
- const t = Math.random() * 16 | 0;
1209
- return (e == "x" ? t : t & 3 | 8).toString(16);
1210
- });
1211
- }
1212
- function me() {
1213
- return Pt().replace(/-/g, "");
1214
- }
1215
- const fe = "builderSessionId", Nt = async ({
1216
- canTrack: e
1217
- }) => {
1218
- if (!e)
1219
- return;
1220
- const t = await oe({
1221
- name: fe,
1222
- canTrack: e
1223
- });
1224
- if (A(t))
1225
- return t;
1226
- {
1227
- const n = Mt();
1228
- return Lt({ id: n, canTrack: e }), n;
1229
- }
1230
- }, Mt = () => me(), Lt = ({
1231
- id: e,
1232
- canTrack: t
1233
- }) => re({ name: fe, value: e, canTrack: t }), he = () => y() && typeof localStorage < "u" ? localStorage : void 0, Ut = ({
1234
- key: e,
1235
- canTrack: t
1236
- }) => {
1237
- var n;
1238
- try {
1239
- return t ? (n = he()) == null ? void 0 : n.getItem(e) : void 0;
1240
- } catch (o) {
1241
- console.debug("[LocalStorage] GET error: ", o);
1242
- return;
1243
- }
1244
- }, xt = ({
1245
- key: e,
1246
- canTrack: t,
1247
- value: n
1248
- }) => {
1249
- var o;
1250
- try {
1251
- t && ((o = he()) == null || o.setItem(e, n));
1252
- } catch (r) {
1253
- console.debug("[LocalStorage] SET error: ", r);
1254
- }
1255
- }, be = "builderVisitorId", Wt = ({ canTrack: e }) => {
1256
- if (!e)
1257
- return;
1258
- const t = Ut({
1259
- key: be,
1260
- canTrack: e
1261
- });
1262
- if (A(t))
1263
- return t;
1264
- {
1265
- const n = Ft();
1266
- return Kt({ id: n, canTrack: e }), n;
1267
- }
1268
- }, Ft = () => me(), Kt = ({
1269
- id: e,
1270
- canTrack: t
1271
- }) => xt({
1272
- key: be,
1273
- value: e,
1274
- canTrack: t
1275
- }), zt = () => {
1276
- if (y()) {
1277
- const e = new URL(location.href);
1278
- return e.pathname === "" && (e.pathname = "/"), e;
1279
- } else
1280
- return console.warn("Cannot get location for tracking in non-browser environment"), null;
1281
- }, Dt = () => typeof navigator == "object" && navigator.userAgent || "", Gt = () => {
1282
- const e = Dt(), t = {
1283
- Android() {
1284
- return e.match(/Android/i);
1285
- },
1286
- BlackBerry() {
1287
- return e.match(/BlackBerry/i);
1288
- },
1289
- iOS() {
1290
- return e.match(/iPhone|iPod/i);
1291
- },
1292
- Opera() {
1293
- return e.match(/Opera Mini/i);
1294
- },
1295
- Windows() {
1296
- return e.match(/IEMobile/i) || e.match(/WPDesktop/i);
1297
- },
1298
- any() {
1299
- return t.Android() || t.BlackBerry() || t.iOS() || t.Opera() || t.Windows() || x === "reactNative";
1300
- }
1301
- }, n = e.match(/Tablet|iPad/i), o = zt();
1302
- return {
1303
- urlPath: o == null ? void 0 : o.pathname,
1304
- host: (o == null ? void 0 : o.host) || (o == null ? void 0 : o.hostname),
1305
- device: n ? "tablet" : t.any() ? "mobile" : "desktop"
1306
- };
1307
- }, Ht = async ({
1308
- canTrack: e
1309
- }) => {
1310
- if (!e)
1311
- return { visitorId: void 0, sessionId: void 0 };
1312
- const t = await Nt({ canTrack: e }), n = Wt({ canTrack: e });
1313
- return {
1314
- sessionId: t,
1315
- visitorId: n
1316
- };
1317
- }, Jt = async ({
1318
- type: e,
1319
- canTrack: t,
1320
- apiKey: n,
1321
- metadata: o,
1322
- ...r
1323
- }) => ({
1324
- type: e,
1325
- data: {
1326
- ...r,
1327
- metadata: {
1328
- url: location.href,
1329
- ...o
1330
- },
1331
- ...await Ht({ canTrack: t }),
1332
- userAttributes: Gt(),
1333
- ownerId: n
1334
- }
1335
- });
1336
- async function qt(e) {
1337
- if (!e.apiKey) {
1338
- w.error(
1339
- "Missing API key for track call. Please provide your API key."
1340
- );
1341
- return;
1342
- }
1343
- if (!!e.canTrack && !U() && !!(y() || x === "reactNative"))
1344
- return fetch("https://builder.io/api/v1/track", {
1345
- method: "POST",
1346
- body: JSON.stringify({
1347
- events: [await Jt(e)]
1348
- }),
1349
- headers: {
1350
- "content-type": "application/json"
1351
- },
1352
- mode: "cors"
1353
- }).catch((t) => {
1354
- console.error("Failed to track: ", t);
1355
- });
1356
- }
1357
- const fn = (e) => qt({ ...e, canTrack: !0 });
1358
- export {
1359
- Ke as A,
1360
- Xt as B,
1361
- Zt as C,
1362
- en as F,
1363
- tn as I,
1364
- nn as S,
1365
- x as T,
1366
- sn as V,
1367
- v as _,
1368
- Yt as a,
1369
- y as b,
1370
- A as c,
1371
- on as d,
1372
- rn as e,
1373
- z as f,
1374
- ve as g,
1375
- an as h,
1376
- U as i,
1377
- dn as j,
1378
- D as k,
1379
- w as l,
1380
- un as m,
1381
- qt as n,
1382
- ln as o,
1383
- ut as p,
1384
- st as q,
1385
- pn as r,
1386
- Ot as s,
1387
- mn as t,
1388
- ft as u,
1389
- mt as v,
1390
- ct as w,
1391
- fn as x,
1392
- Fe as y,
1393
- cn as z
1394
- };