@builder.io/sdk-react 3.0.1 → 3.0.3-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 (107) hide show
  1. package/lib/browser/blocks-exports.cjs +169 -32
  2. package/lib/browser/blocks-exports.mjs +1331 -922
  3. package/lib/browser/index.cjs +1 -1
  4. package/lib/browser/index.mjs +17 -16
  5. package/lib/browser/server-entry-c7bda8b5.cjs +2 -0
  6. package/lib/browser/server-entry-da1754bd.js +790 -0
  7. package/lib/browser/server-entry.cjs +1 -1
  8. package/lib/browser/server-entry.mjs +1 -1
  9. package/lib/edge/accordion-388f5e60.cjs +1 -0
  10. package/lib/edge/{accordion-1572cb0d.js → accordion-50de133c.js} +17 -16
  11. package/lib/edge/blocks-5e476ddc.js +3534 -0
  12. package/lib/edge/blocks-a5193d52.cjs +30 -0
  13. package/lib/edge/blocks-exports.cjs +1 -1
  14. package/lib/edge/blocks-exports.mjs +13 -12
  15. package/lib/edge/{button-0709893d.js → button-4261ae64.js} +2 -2
  16. package/lib/edge/{button-cf66cf8d.cjs → button-c6ec3aea.cjs} +1 -1
  17. package/lib/edge/{columns-e234acc6.js → columns-28e9fb0a.js} +14 -15
  18. package/lib/edge/columns-8c831c02.cjs +28 -0
  19. package/lib/edge/{content-variants-3ab9230f.js → content-variants-36ca4fe5.js} +297 -252
  20. package/lib/edge/content-variants-81713434.cjs +134 -0
  21. package/lib/edge/{custom-code-6d9730ff.cjs → custom-code-8119ea3f.cjs} +1 -1
  22. package/lib/edge/dynamic-blocks-exports.cjs +3 -1
  23. package/lib/edge/dynamic-blocks-exports.mjs +5 -2
  24. package/lib/edge/{form-27bcc23a.js → form-039fb5ff.js} +7 -8
  25. package/lib/edge/form-e7a1dec9.cjs +1 -0
  26. package/lib/edge/{get-class-prop-name-a3bd113c.js → get-class-prop-name-65d6824c.js} +1 -1
  27. package/lib/edge/{get-class-prop-name-0b3d48a4.cjs → get-class-prop-name-a86a3e60.cjs} +1 -1
  28. package/lib/edge/{image-5c9e156f.js → image-2a2b26d2.js} +6 -6
  29. package/lib/edge/{image-94922c87.cjs → image-4db81d72.cjs} +3 -3
  30. package/lib/edge/{img-80be6914.js → img-61d29fb3.js} +1 -1
  31. package/lib/edge/{img-e0c8f7f9.cjs → img-7de3a3de.cjs} +1 -1
  32. package/lib/edge/index.cjs +1 -1
  33. package/lib/edge/index.mjs +18 -17
  34. package/lib/edge/{input-f5ba6b1e.cjs → input-bd5387a6.cjs} +1 -1
  35. package/lib/edge/{input-920922d5.js → input-c8539054.js} +1 -1
  36. package/lib/edge/personalization-container-3fda6014.cjs +138 -0
  37. package/lib/edge/personalization-container-c76e4fef.js +379 -0
  38. package/lib/edge/{select-673864b7.js → select-6b5cda00.js} +1 -1
  39. package/lib/edge/{select-2ced1aca.cjs → select-73accaf4.cjs} +1 -1
  40. package/lib/edge/server-entry-838c1f06.js +788 -0
  41. package/lib/edge/server-entry-ea2a8b0e.cjs +2 -0
  42. package/lib/edge/server-entry.cjs +1 -1
  43. package/lib/edge/server-entry.mjs +1 -1
  44. package/lib/edge/slot-099112f1.cjs +1 -0
  45. package/lib/edge/{slot-68f2b177.js → slot-403c77da.js} +5 -6
  46. package/lib/edge/{symbol-7e260a70.js → symbol-97f456f4.js} +2 -2
  47. package/lib/edge/{symbol-ded9dba9.cjs → symbol-ffa6e6cd.cjs} +1 -1
  48. package/lib/edge/{tabs-5156494d.js → tabs-a7c94ead.js} +15 -16
  49. package/lib/edge/tabs-ad55c6a7.cjs +1 -0
  50. package/lib/edge/text-5915f038.js +17 -0
  51. package/lib/edge/text-e6dbb721.cjs +1 -0
  52. package/lib/node/blocks-exports.cjs +169 -32
  53. package/lib/node/blocks-exports.mjs +1359 -950
  54. package/lib/node/index.cjs +1 -1
  55. package/lib/node/index.mjs +17 -16
  56. package/lib/node/init.cjs +1 -1
  57. package/lib/node/init.mjs +3 -3
  58. package/lib/node/server-entry-51bc0b1d.js +791 -0
  59. package/lib/node/server-entry-d7316893.cjs +2 -0
  60. package/lib/node/server-entry.cjs +1 -1
  61. package/lib/node/server-entry.mjs +1 -1
  62. package/lib/node/{setIvm-8b303d4e.js → setIvm-575cf1f1.js} +1 -1
  63. package/lib/node/{setIvm-aba1bed8.cjs → setIvm-d912cf4d.cjs} +1 -1
  64. package/lib/node/setIvm.cjs +1 -1
  65. package/lib/node/setIvm.mjs +2 -2
  66. package/lib/node/{should-force-browser-runtime-in-node-491a9b55.cjs → should-force-browser-runtime-in-node-23225980.cjs} +1 -1
  67. package/lib/node/{should-force-browser-runtime-in-node-0a037bde.js → should-force-browser-runtime-in-node-66df4856.js} +1 -1
  68. package/package.json +1 -1
  69. package/types/blocks/index.d.ts +4 -0
  70. package/types/blocks/personalization-container/component-info.d.ts +2 -0
  71. package/types/blocks/personalization-container/helpers/index.d.ts +15 -0
  72. package/types/blocks/personalization-container/helpers/inlined-fns.d.ts +8 -0
  73. package/types/blocks/personalization-container/helpers.d.ts +27 -0
  74. package/types/blocks/personalization-container/index.d.ts +1 -0
  75. package/types/blocks/personalization-container/personalization-container.d.ts +4 -0
  76. package/types/blocks/personalization-container/personalization-container.types.d.ts +14 -0
  77. package/types/blocks/textarea/component-info.d.ts +2 -0
  78. package/types/blocks/textarea/index.d.ts +1 -0
  79. package/types/blocks/textarea/textarea.d.ts +14 -0
  80. package/types/constants/sdk-version.d.ts +1 -1
  81. package/types/functions/filter-with-custom-targeting.d.ts +15 -0
  82. package/types/functions/get-block-component-options.d.ts +2 -1
  83. package/types/functions/get-processed-block.d.ts +1 -6
  84. package/types/helpers/flatten.d.ts +6 -0
  85. package/types/helpers/user-attributes.d.ts +17 -0
  86. package/types/index-helpers/blocks-exports.d.ts +1 -0
  87. package/types/server-index.d.ts +1 -1
  88. package/types/types/builder-content.d.ts +1 -0
  89. package/types/types/input.d.ts +11 -0
  90. package/lib/browser/server-entry-017b8439.js +0 -717
  91. package/lib/browser/server-entry-9f80066e.cjs +0 -2
  92. package/lib/edge/accordion-decb24cf.cjs +0 -1
  93. package/lib/edge/blocks-9c35be74.js +0 -916
  94. package/lib/edge/blocks-d3823063.cjs +0 -12
  95. package/lib/edge/columns-2fdf0656.cjs +0 -28
  96. package/lib/edge/content-variants-616a6c0f.cjs +0 -134
  97. package/lib/edge/evaluate-ccf1ad96.cjs +0 -19
  98. package/lib/edge/evaluate-f0b82ede.js +0 -2612
  99. package/lib/edge/form-7c61693d.cjs +0 -1
  100. package/lib/edge/server-entry-6c0047ea.js +0 -715
  101. package/lib/edge/server-entry-de142ee8.cjs +0 -2
  102. package/lib/edge/slot-cc8b4e5b.cjs +0 -1
  103. package/lib/edge/tabs-d422921f.cjs +0 -1
  104. package/lib/edge/text-27a917c0.js +0 -37
  105. package/lib/edge/text-5796f488.cjs +0 -1
  106. package/lib/node/server-entry-e91e06a3.cjs +0 -2
  107. package/lib/node/server-entry-fdedc1aa.js +0 -718
@@ -1,916 +0,0 @@
1
- import { jsx as c, Fragment as h, jsxs as R } from "react/jsx-runtime";
2
- import { createContext as J, useEffect as B, useState as W, useRef as Q, useContext as T } from "react";
3
- import { BuilderContext as _ } from "./blocks-exports.mjs";
4
- import { TARGET as b, checkIsDefined as A, isPreviewing as G, isEditing as L } from "./server-entry-6c0047ea.js";
5
- import { evaluate as E } from "./evaluate-f0b82ede.js";
6
- import { getClassPropName as X } from "./get-class-prop-name-a3bd113c.js";
7
- import { DynamicRenderer as Y } from "./dynamic-renderer-8b343325.js";
8
- const ee = J({ registeredComponents: {} });
9
- function te(e) {
10
- var t;
11
- return {
12
- ...(t = e.component) == null ? void 0 : t.options,
13
- ...e.options
14
- };
15
- }
16
- function ne(e, ...t) {
17
- const n = Object.assign({}, e);
18
- for (const r of t)
19
- delete n[r];
20
- return n;
21
- }
22
- function v(e, t, n = null, r = null, o = /* @__PURE__ */ new WeakSet()) {
23
- if (e == null || typeof e != "object") {
24
- t(e, (i) => {
25
- n !== null && r !== null && (n[r] = i);
26
- });
27
- return;
28
- }
29
- o.has(e) || (o.add(e), Array.isArray(e) ? e.forEach((i, s) => {
30
- t(i, (d) => {
31
- e[s] = d;
32
- }), v(i, t, e, s, o);
33
- }) : Object.entries(e).forEach(([i, s]) => {
34
- t(s, (d) => {
35
- e[i] = d;
36
- }), v(s, t, e, i, o);
37
- }));
38
- }
39
- function H(e) {
40
- return e && typeof e == "object" && e["@type"] === "@builder.io/core:LocalizedValue";
41
- }
42
- function oe(e) {
43
- if (!e || !Object.getOwnPropertyNames(e).length)
44
- return !1;
45
- let t = !1;
46
- return v(e, (n) => {
47
- if (H(n)) {
48
- t = !0;
49
- return;
50
- }
51
- }), t;
52
- }
53
- function re(e, t) {
54
- return !e || !Object.getOwnPropertyNames(e).length ? {} : (v(e, (n, r) => {
55
- var o;
56
- H(n) && r((o = n[t]) != null ? o : void 0);
57
- }), e);
58
- }
59
- function ie(e, t) {
60
- var n, r;
61
- return (n = e.component) != null && n.options && oe((r = e.component) == null ? void 0 : r.options) && (t || console.warn("[Builder.io] In order to use localized fields in Builder, you must pass a locale prop to the BuilderComponent or to options object while fetching the content to resolve localized fields. Learn more: https://www.builder.io/c/docs/localization-inline#targeting-and-inline-localization"), e.component.options = re(e.component.options, t != null ? t : "Default")), e;
62
- }
63
- const U = (e) => JSON.parse(JSON.stringify(e)), se = (e, t, n) => {
64
- if (Object(e) !== e)
65
- return e;
66
- const r = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
67
- return r.slice(0, -1).reduce((o, i, s) => Object(o[i]) === o[i] ? o[i] : o[i] = Math.abs(Number(r[s + 1])) >> 0 === +r[s + 1] ? [] : {}, e)[r[r.length - 1]] = n, e;
68
- };
69
- function I(e) {
70
- if (e === null || typeof e != "object")
71
- return e;
72
- if (Array.isArray(e))
73
- return e.map((n) => I(n));
74
- if (e["@type"] === "@builder.io/sdk:Element")
75
- return e;
76
- const t = {};
77
- for (const n in e)
78
- n !== "meta" && Object.prototype.hasOwnProperty.call(e, n) && (t[n] = I(e[n]));
79
- return t;
80
- }
81
- const le = ["svelte", "vue", "angular", "qwik", "solid"].includes(b), ce = (e) => {
82
- if (le) {
83
- const t = U(e);
84
- return {
85
- ...t,
86
- properties: {
87
- ...t.properties
88
- },
89
- actions: {
90
- ...t.actions
91
- }
92
- };
93
- } else {
94
- const t = I(ne(e, "children", "meta"));
95
- return {
96
- ...t,
97
- properties: {
98
- ...t.properties
99
- },
100
- actions: {
101
- ...t.actions
102
- },
103
- children: e.children,
104
- meta: e.meta
105
- };
106
- }
107
- }, ae = ({
108
- block: e,
109
- context: t,
110
- localState: n,
111
- rootState: r,
112
- rootSetState: o
113
- }) => {
114
- if (!e.bindings)
115
- return e;
116
- const i = ce(e);
117
- for (const s in e.bindings) {
118
- const u = e.bindings[s], d = E({
119
- code: u,
120
- localState: n,
121
- rootState: r,
122
- rootSetState: o,
123
- context: t
124
- });
125
- se(i, s, d);
126
- }
127
- return i;
128
- };
129
- function ue({
130
- block: e,
131
- context: t,
132
- shouldEvaluateBindings: n,
133
- localState: r,
134
- rootState: o,
135
- rootSetState: i
136
- }) {
137
- let s = ie(e, o.locale);
138
- return s = s, n ? ae({
139
- block: s,
140
- localState: r,
141
- rootState: o,
142
- rootSetState: i,
143
- context: t
144
- }) : s;
145
- }
146
- const P = (e) => e ? e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase() : "";
147
- function de(e, t, n = {}) {
148
- let r, o, i, s = null, u = 0;
149
- const d = function() {
150
- u = n.leading === !1 ? 0 : Date.now(), s = null, i = e.apply(r, o), s || (r = o = null);
151
- };
152
- return function() {
153
- const a = Date.now();
154
- !u && n.leading === !1 && (u = a);
155
- const m = t - (a - u);
156
- return r = this, o = arguments, m <= 0 || m > t ? (s && (clearTimeout(s), s = null), u = a, i = e.apply(r, o), s || (r = o = null)) : !s && n.trailing !== !1 && (s = setTimeout(d, m)), i;
157
- };
158
- }
159
- function C(e, ...t) {
160
- const n = Object(e);
161
- for (let r = 1; r < arguments.length; r++) {
162
- const o = arguments[r];
163
- if (o != null)
164
- for (const i in o)
165
- Object.prototype.hasOwnProperty.call(o, i) && (n[i] = o[i]);
166
- }
167
- return n;
168
- }
169
- function fe(e) {
170
- for (const t of e)
171
- switch (t.trigger) {
172
- case "pageLoad":
173
- he(t);
174
- break;
175
- case "scrollInView":
176
- pe(t);
177
- break;
178
- }
179
- }
180
- function V(e) {
181
- console.warn(`Cannot animate element: element with ID ${e} not found!`);
182
- }
183
- function j(e, t) {
184
- const n = me(e), r = getComputedStyle(t), o = e.steps[0].styles, i = e.steps[e.steps.length - 1].styles, s = [o, i];
185
- for (const u of s)
186
- for (const d of n)
187
- d in u || (u[d] = r[d]);
188
- }
189
- function me(e) {
190
- const t = [];
191
- for (const n of e.steps)
192
- for (const r in n.styles)
193
- t.indexOf(r) === -1 && t.push(r);
194
- return t;
195
- }
196
- function he(e) {
197
- const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || ""));
198
- if (!t.length) {
199
- V(e.elementId || e.id || "");
200
- return;
201
- }
202
- Array.from(t).forEach((n) => {
203
- j(e, n), n.style.transition = "none", n.style.transitionDelay = "0", C(n.style, e.steps[0].styles), setTimeout(() => {
204
- n.style.transition = `all ${e.duration}s ${P(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s"), C(n.style, e.steps[1].styles), setTimeout(() => {
205
- n.style.transition = "", n.style.transitionDelay = "";
206
- }, (e.delay || 0) * 1e3 + e.duration * 1e3 + 100);
207
- });
208
- });
209
- }
210
- function pe(e) {
211
- const t = Array.prototype.slice.call(document.getElementsByClassName(e.elementId || e.id || ""));
212
- if (!t.length) {
213
- V(e.elementId || e.id || "");
214
- return;
215
- }
216
- Array.from(t).forEach((n) => {
217
- j(e, n);
218
- let r = !1, o = !1;
219
- function i() {
220
- !r && u(n) ? (r = !0, o = !0, setTimeout(() => {
221
- C(n.style, e.steps[1].styles), e.repeat || document.removeEventListener("scroll", s), setTimeout(() => {
222
- o = !1, e.repeat || (n.style.transition = "", n.style.transitionDelay = "");
223
- }, (e.duration + (e.delay || 0)) * 1e3 + 100);
224
- })) : e.repeat && r && !o && !u(n) && (r = !1, C(n.style, e.steps[0].styles));
225
- }
226
- const s = de(i, 200, {
227
- leading: !1
228
- });
229
- function u(m) {
230
- const g = m.getBoundingClientRect(), k = window.innerHeight, l = (e.thresholdPercent || 0) / 100 * k;
231
- return g.bottom > l && g.top < k - l;
232
- }
233
- const d = e.steps[0].styles;
234
- function a() {
235
- C(n.style, d);
236
- }
237
- a(), setTimeout(() => {
238
- n.style.transition = `all ${e.duration}s ${P(e.easing)}`, e.delay && (n.style.transitionDelay = e.delay + "s");
239
- }), document.addEventListener("scroll", s, {
240
- capture: !0,
241
- passive: !0
242
- }), i();
243
- });
244
- }
245
- const F = (e) => Object.entries(e).map(([n, r]) => {
246
- if (typeof r == "string")
247
- return `${P(n)}: ${r};`;
248
- }).filter(A), ye = (e) => F(e).join(`
249
- `), x = ({
250
- mediaQuery: e,
251
- className: t,
252
- styles: n
253
- }) => {
254
- const r = `.${t} {
255
- ${ye(n)}
256
- }`;
257
- return e ? `${e} {
258
- ${r}
259
- }` : r;
260
- };
261
- function ge({
262
- style: e
263
- }) {
264
- return e;
265
- }
266
- const ke = ({
267
- block: e,
268
- context: t
269
- }) => Se(ge({
270
- style: e.style || {},
271
- context: t,
272
- block: e
273
- }));
274
- function Se(e) {
275
- switch (b) {
276
- case "svelte":
277
- case "vue":
278
- case "solid":
279
- case "angular":
280
- return F(e).join(" ");
281
- case "qwik":
282
- case "reactNative":
283
- case "react":
284
- case "rsc":
285
- return e;
286
- }
287
- }
288
- const K = (e, t) => e ? t ? e.models && e.models.length > 0 && !e.models.includes(t) : !1 : !0, Ce = ({
289
- block: e,
290
- registeredComponents: t,
291
- model: n
292
- }) => {
293
- var i;
294
- const r = (i = e.component) == null ? void 0 : i.name;
295
- if (!r)
296
- return null;
297
- const o = t[r];
298
- if (!o || K(o, n)) {
299
- console.warn(`
300
- Could not find a registered component named "${r}".
301
- If you registered it, is the file that registered it imported by the file that needs to render it?`);
302
- return;
303
- } else
304
- return o;
305
- }, xe = ({
306
- block: e,
307
- context: t
308
- }) => {
309
- const {
310
- repeat: n,
311
- ...r
312
- } = e;
313
- if (!(n != null && n.collection))
314
- return;
315
- const o = E({
316
- code: n.collection,
317
- localState: t.localState,
318
- rootState: t.rootState,
319
- rootSetState: t.rootSetState,
320
- context: t.context
321
- });
322
- if (!Array.isArray(o))
323
- return;
324
- const i = n.collection.split(".").pop(), s = n.itemName || (i ? i + "Item" : "item");
325
- return o.map((d, a) => ({
326
- context: {
327
- ...t,
328
- localState: {
329
- ...t.localState,
330
- $index: a,
331
- $item: d,
332
- [s]: d,
333
- [`$${s}Index`]: a
334
- }
335
- },
336
- block: r
337
- }));
338
- }, Be = (e, t) => {
339
- var n;
340
- return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderLinkComponent ? {
341
- builderLinkComponent: t
342
- } : {};
343
- }, ve = (e, t, n) => {
344
- var r;
345
- return (r = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && r.builderComponents ? {
346
- builderComponents: Object.fromEntries(Object.entries(t).filter(([i, s]) => !K(s, n)))
347
- } : {};
348
- }, be = (e, t) => {
349
- var n;
350
- return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderBlock ? {
351
- builderBlock: t
352
- } : {};
353
- }, Pe = (e, t) => {
354
- var n;
355
- return (n = e == null ? void 0 : e.shouldReceiveBuilderProps) != null && n.builderContext ? {
356
- builderContext: t
357
- } : {};
358
- }, Z = {
359
- small: {
360
- min: 320,
361
- default: 321,
362
- max: 640
363
- },
364
- medium: {
365
- min: 641,
366
- default: 642,
367
- max: 991
368
- },
369
- large: {
370
- min: 990,
371
- default: 991,
372
- max: 1200
373
- }
374
- }, z = (e, t = Z) => `@media (max-width: ${t[e].max}px)`, we = ({
375
- small: e,
376
- medium: t
377
- }) => {
378
- const n = U(Z);
379
- if (!e || !t)
380
- return n;
381
- const r = Math.floor(e / 2);
382
- n.small = {
383
- max: e,
384
- min: r,
385
- default: r + 1
386
- };
387
- const o = n.small.max + 1;
388
- n.medium = {
389
- max: t,
390
- min: o,
391
- default: o + 1
392
- };
393
- const i = n.medium.max + 1;
394
- return n.large = {
395
- max: 2e3,
396
- // TODO: decide upper limit
397
- min: i,
398
- default: i + 1
399
- }, n;
400
- };
401
- function Oe(e) {
402
- return /* @__PURE__ */ c(
403
- "style",
404
- {
405
- dangerouslySetInnerHTML: { __html: e.styles },
406
- "data-id": e.id,
407
- nonce: e.nonce
408
- }
409
- );
410
- }
411
- function Re(e) {
412
- function t() {
413
- const r = e.block;
414
- return A(r.hide) ? !r.hide : A(r.show) ? r.show : !0;
415
- }
416
- function n() {
417
- var p, y, $;
418
- const r = e.block, o = r.responsiveStyles, i = e.context.content, s = we(
419
- ((p = i == null ? void 0 : i.meta) == null ? void 0 : p.breakpoints) || {}
420
- ), u = o == null ? void 0 : o.large, d = o == null ? void 0 : o.medium, a = o == null ? void 0 : o.small, m = r.id;
421
- if (!m)
422
- return "";
423
- const g = u ? x({
424
- className: m,
425
- styles: u
426
- }) : "", k = d ? x({
427
- className: m,
428
- styles: d,
429
- mediaQuery: z(
430
- "medium",
431
- s
432
- )
433
- }) : "", S = a ? x({
434
- className: m,
435
- styles: a,
436
- mediaQuery: z(
437
- "small",
438
- s
439
- )
440
- }) : "", l = r.animations && r.animations.find((O) => O.trigger === "hover");
441
- let f = "";
442
- if (l) {
443
- const O = (($ = (y = l.steps) == null ? void 0 : y[1]) == null ? void 0 : $.styles) || {};
444
- f = x({
445
- className: `${m}:hover`,
446
- styles: {
447
- ...O,
448
- transition: `all ${l.duration}s ${P(
449
- l.easing
450
- )}`,
451
- transitionDelay: l.delay ? `${l.delay}s` : "0s"
452
- }
453
- }) || "";
454
- }
455
- return [
456
- g,
457
- k,
458
- S,
459
- f
460
- ].join(" ");
461
- }
462
- return /* @__PURE__ */ c(h, { children: n() && t() ? /* @__PURE__ */ c(h, { children: /* @__PURE__ */ c(
463
- Oe,
464
- {
465
- id: "builderio-block",
466
- styles: n(),
467
- nonce: e.context.nonce
468
- }
469
- ) }) : null });
470
- }
471
- function Ae(e) {
472
- return e.charAt(0).toUpperCase() + e.slice(1);
473
- }
474
- const Ie = (e) => `on${Ae(e)}`, We = (e, t) => (n) => E({
475
- code: e,
476
- context: t.context,
477
- localState: t.localState,
478
- rootState: t.rootState,
479
- rootSetState: t.rootSetState,
480
- event: n,
481
- isExpression: !1
482
- });
483
- function q(e) {
484
- var r;
485
- const t = {}, n = (r = e.block.actions) != null ? r : {};
486
- for (const o in n) {
487
- if (!n.hasOwnProperty(o))
488
- continue;
489
- const i = n[o];
490
- let s = Ie(o);
491
- if (e.stripPrefix)
492
- switch (b) {
493
- case "vue":
494
- s = s.replace("v-on:", "");
495
- break;
496
- case "svelte":
497
- s = s.replace("on:", "");
498
- break;
499
- }
500
- t[s] = We(i, e);
501
- }
502
- return t;
503
- }
504
- function Ee({
505
- properties: e
506
- }) {
507
- return e;
508
- }
509
- const Ne = (e) => ({
510
- href: e.href
511
- });
512
- function N({
513
- block: e,
514
- context: t
515
- }) {
516
- var r;
517
- const n = {
518
- ...Ne(e),
519
- ...e.properties,
520
- "builder-id": e.id,
521
- style: ke({
522
- block: e,
523
- context: t
524
- }),
525
- [X()]: [e.id, "builder-block", e.class, (r = e.properties) == null ? void 0 : r.class].filter(Boolean).join(" ")
526
- };
527
- return Ee({
528
- properties: n,
529
- context: t,
530
- block: e
531
- });
532
- }
533
- function $e(e) {
534
- return /* @__PURE__ */ c(
535
- Y,
536
- {
537
- TagName: e.Wrapper,
538
- attributes: N({
539
- block: e.block,
540
- context: e.context
541
- }),
542
- actionAttributes: q({
543
- block: e.block,
544
- rootState: e.context.rootState,
545
- rootSetState: e.context.rootSetState,
546
- localState: e.context.localState,
547
- context: e.context.context,
548
- stripPrefix: !0
549
- }),
550
- children: e.children
551
- }
552
- );
553
- }
554
- function Te(e) {
555
- return B(() => {
556
- }, []), /* @__PURE__ */ c(h, { children: e.children });
557
- }
558
- function Le(e) {
559
- function t() {
560
- return e.includeBlockProps ? {
561
- ...N({
562
- block: e.block,
563
- context: e.context
564
- }),
565
- ...q({
566
- block: e.block,
567
- rootState: e.context.rootState,
568
- rootSetState: e.context.rootSetState,
569
- localState: e.context.localState,
570
- context: e.context.context
571
- })
572
- } : {};
573
- }
574
- return /* @__PURE__ */ c(h, { children: e.Wrapper.load ? /* @__PURE__ */ c(h, { children: /* @__PURE__ */ c(
575
- Te,
576
- {
577
- load: e.Wrapper.load,
578
- fallback: e.Wrapper.fallback,
579
- props: e.wrapperProps,
580
- attributes: t(),
581
- children: e.children
582
- }
583
- ) }) : /* @__PURE__ */ c(e.Wrapper, { ...e.wrapperProps, attributes: t(), children: e.children }) });
584
- }
585
- const ze = ({
586
- componentOptions: e,
587
- builderBlock: t,
588
- context: n,
589
- componentRef: r,
590
- includeBlockProps: o,
591
- isInteractive: i,
592
- contextValue: s
593
- }) => {
594
- const u = {
595
- ...e,
596
- /**
597
- * If `noWrap` is set to `true`, then the block's props/attributes are provided to the
598
- * component itself directly. Otherwise, they are provided to the wrapper element.
599
- */
600
- ...o ? {
601
- attributes: N({
602
- block: t,
603
- context: s
604
- })
605
- } : {}
606
- };
607
- return i ? {
608
- Wrapper: r,
609
- block: t,
610
- context: n,
611
- wrapperProps: e,
612
- includeBlockProps: o
613
- } : u;
614
- };
615
- function D(e) {
616
- var r;
617
- const [t, n] = W(
618
- () => e.isInteractive ? Le : e.componentRef
619
- );
620
- return /* @__PURE__ */ c(h, { children: e.componentRef ? /* @__PURE__ */ c(h, { children: /* @__PURE__ */ c(
621
- t,
622
- {
623
- ...ze({
624
- componentOptions: e.componentOptions,
625
- builderBlock: e.builderBlock,
626
- context: e.context,
627
- componentRef: e.componentRef,
628
- linkComponent: e.linkComponent,
629
- includeBlockProps: e.includeBlockProps,
630
- isInteractive: e.isInteractive,
631
- contextValue: e.context
632
- }),
633
- children: (r = e.blockChildren) == null ? void 0 : r.map((o) => /* @__PURE__ */ c(
634
- w,
635
- {
636
- block: o,
637
- context: e.context,
638
- registeredComponents: e.registeredComponents,
639
- linkComponent: e.linkComponent
640
- },
641
- o.id
642
- ))
643
- }
644
- ) }) : null });
645
- }
646
- function M(e) {
647
- const [t, n] = W(() => e.repeatContext);
648
- return /* @__PURE__ */ c(_.Provider, { value: t, children: /* @__PURE__ */ c(
649
- w,
650
- {
651
- block: e.block,
652
- context: t,
653
- registeredComponents: e.registeredComponents,
654
- linkComponent: e.linkComponent
655
- }
656
- ) });
657
- }
658
- function w(e) {
659
- var m, g, k, S;
660
- function t() {
661
- return xe({
662
- block: e.block,
663
- context: e.context
664
- });
665
- }
666
- const [n, r] = W(() => ({
667
- value: null,
668
- update: !1
669
- }));
670
- function o() {
671
- var f;
672
- if (n.value && !n.update && !G())
673
- return n.value;
674
- const l = (f = e.block.repeat) != null && f.collection ? e.block : ue({
675
- block: e.block,
676
- localState: e.context.localState,
677
- rootState: e.context.rootState,
678
- rootSetState: e.context.rootSetState,
679
- context: e.context.context,
680
- shouldEvaluateBindings: !0
681
- });
682
- return n.value = l, n.update = !1, l;
683
- }
684
- function i() {
685
- return Ce({
686
- block: o(),
687
- registeredComponents: e.registeredComponents,
688
- model: e.context.model
689
- });
690
- }
691
- function s() {
692
- var f;
693
- return e.block.tagName === "a" || ((f = o().properties) == null ? void 0 : f.href) || o().href ? e.linkComponent || "a" : e.block.tagName || "div";
694
- }
695
- function u() {
696
- var p, y;
697
- if ((p = e.block.repeat) != null && p.collection)
698
- return !!((y = t == null ? void 0 : t()) != null && y.length);
699
- const l = "hide" in o() ? o().hide : !1;
700
- return ("show" in o() ? o().show : !0) && !l;
701
- }
702
- function d() {
703
- var f, p;
704
- return !((f = i == null ? void 0 : i()) != null && f.component) && !t() ? (p = o().children) != null ? p : [] : [];
705
- }
706
- function a() {
707
- var l, f, p, y;
708
- return {
709
- blockChildren: (l = o().children) != null ? l : [],
710
- componentRef: (f = i == null ? void 0 : i()) == null ? void 0 : f.component,
711
- componentOptions: {
712
- ...te(o()),
713
- ...be(i(), o()),
714
- ...Pe(i(), e.context),
715
- ...Be(i(), e.linkComponent),
716
- ...ve(
717
- i(),
718
- e.registeredComponents,
719
- e.context.model
720
- )
721
- },
722
- context: e.context,
723
- linkComponent: e.linkComponent,
724
- registeredComponents: e.registeredComponents,
725
- builderBlock: o(),
726
- includeBlockProps: ((p = i == null ? void 0 : i()) == null ? void 0 : p.noWrap) === !0,
727
- isInteractive: !((y = i == null ? void 0 : i()) != null && y.isRSC && b === "rsc")
728
- };
729
- }
730
- return B(() => {
731
- const l = o().id, f = o().animations;
732
- f && l && fe(
733
- f.map((p) => ({
734
- ...p,
735
- elementId: l
736
- }))
737
- );
738
- }, []), B(() => {
739
- n.update = !0;
740
- }), /* @__PURE__ */ c(h, { children: u() ? /* @__PURE__ */ R(h, { children: [
741
- /* @__PURE__ */ c(Re, { block: o(), context: e.context }),
742
- (m = i == null ? void 0 : i()) != null && m.noWrap ? t() ? /* @__PURE__ */ c(h, { children: (S = t()) == null ? void 0 : S.map((l, f) => /* @__PURE__ */ c(
743
- M,
744
- {
745
- repeatContext: l.context,
746
- block: l.block,
747
- registeredComponents: e.registeredComponents,
748
- linkComponent: e.linkComponent
749
- },
750
- f
751
- )) }) : /* @__PURE__ */ c(
752
- D,
753
- {
754
- componentRef: a().componentRef,
755
- componentOptions: a().componentOptions,
756
- blockChildren: a().blockChildren,
757
- context: a().context,
758
- registeredComponents: a().registeredComponents,
759
- linkComponent: a().linkComponent,
760
- builderBlock: a().builderBlock,
761
- includeBlockProps: a().includeBlockProps,
762
- isInteractive: a().isInteractive
763
- }
764
- ) : /* @__PURE__ */ c(h, { children: t() ? /* @__PURE__ */ c(h, { children: (k = t()) == null ? void 0 : k.map((l, f) => /* @__PURE__ */ c(
765
- M,
766
- {
767
- repeatContext: l.context,
768
- block: l.block,
769
- registeredComponents: e.registeredComponents,
770
- linkComponent: e.linkComponent
771
- },
772
- f
773
- )) }) : /* @__PURE__ */ R(
774
- $e,
775
- {
776
- Wrapper: s(),
777
- block: o(),
778
- context: e.context,
779
- children: [
780
- /* @__PURE__ */ c(
781
- D,
782
- {
783
- componentRef: a().componentRef,
784
- componentOptions: a().componentOptions,
785
- blockChildren: a().blockChildren,
786
- context: a().context,
787
- registeredComponents: a().registeredComponents,
788
- linkComponent: a().linkComponent,
789
- builderBlock: a().builderBlock,
790
- includeBlockProps: a().includeBlockProps,
791
- isInteractive: a().isInteractive
792
- }
793
- ),
794
- (g = d()) == null ? void 0 : g.map((l) => /* @__PURE__ */ c(
795
- w,
796
- {
797
- block: l,
798
- registeredComponents: e.registeredComponents,
799
- linkComponent: e.linkComponent,
800
- context: e.context
801
- },
802
- l.id
803
- ))
804
- ]
805
- }
806
- ) })
807
- ] }) : null });
808
- }
809
- function De(e) {
810
- const t = Q(null);
811
- function n() {
812
- var s;
813
- return [
814
- "builder-blocks",
815
- (s = e.blocks) != null && s.length ? "" : "no-blocks",
816
- e.classNameProp
817
- ].filter(Boolean).join(" ");
818
- }
819
- function r() {
820
- if (!e.path)
821
- return;
822
- const s = "component.options.";
823
- return e.path.startsWith(s) ? e.path : `${s}${e.path || ""}`;
824
- }
825
- function o() {
826
- var s, u;
827
- L() && !((s = e.blocks) != null && s.length) && ((u = window.parent) == null || u.postMessage(
828
- {
829
- type: "builder.clickEmptyBlocks",
830
- data: {
831
- parentElementId: e.parent,
832
- dataPath: r()
833
- }
834
- },
835
- "*"
836
- ));
837
- }
838
- function i() {
839
- var s, u;
840
- L() && !((s = e.blocks) != null && s.length) && ((u = window.parent) == null || u.postMessage(
841
- {
842
- type: "builder.hoverEmptyBlocks",
843
- data: {
844
- parentElementId: e.parent,
845
- dataPath: r()
846
- }
847
- },
848
- "*"
849
- ));
850
- }
851
- return B(() => {
852
- }, []), /* @__PURE__ */ R(h, { children: [
853
- /* @__PURE__ */ c(
854
- e.BlocksWrapper,
855
- {
856
- ref: t,
857
- className: n() + " props-blocks-wrapper-215a41e0",
858
- "builder-path": r(),
859
- "builder-parent-id": e.parent,
860
- style: e.styleProp,
861
- onClick: (s) => o(),
862
- onMouseEnter: (s) => i(),
863
- onKeyPress: (s) => o(),
864
- ...e.BlocksWrapperProps,
865
- children: e.children
866
- }
867
- ),
868
- /* @__PURE__ */ c("style", { children: `.props-blocks-wrapper-215a41e0 {
869
- display: flex;
870
- flex-direction: column;
871
- align-items: stretch;
872
- }` })
873
- ] });
874
- }
875
- function Me(e) {
876
- var r, o, i;
877
- const t = T(_), n = T(ee);
878
- return /* @__PURE__ */ c(
879
- De,
880
- {
881
- blocks: e.blocks,
882
- parent: e.parent,
883
- path: e.path,
884
- styleProp: e.styleProp,
885
- classNameProp: e.className,
886
- BlocksWrapper: ((r = e.context) == null ? void 0 : r.BlocksWrapper) || (t == null ? void 0 : t.BlocksWrapper),
887
- BlocksWrapperProps: ((o = e.context) == null ? void 0 : o.BlocksWrapperProps) || (t == null ? void 0 : t.BlocksWrapperProps),
888
- children: e.blocks ? /* @__PURE__ */ c(h, { children: (i = e.blocks) == null ? void 0 : i.map((s) => /* @__PURE__ */ c(
889
- w,
890
- {
891
- block: s,
892
- linkComponent: e.linkComponent,
893
- context: e.context || t,
894
- registeredComponents: e.registeredComponents || (n == null ? void 0 : n.registeredComponents)
895
- },
896
- s.id
897
- )) }) : null
898
- }
899
- );
900
- }
901
- const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
902
- __proto__: null,
903
- default: Me
904
- }, Symbol.toStringTag, { value: "Module" }));
905
- export {
906
- w as Block,
907
- Me as Blocks,
908
- ee as ComponentsContext,
909
- Oe as InlinedStyles,
910
- Ze as blocks,
911
- U as fastClone,
912
- we as getSizesForBreakpoints,
913
- Se as mapStyleObjToStrIfNeeded,
914
- se as set,
915
- he as triggerAnimation
916
- };