@builder.io/sdk-qwik 0.5.3-2 → 0.5.3-4

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.
@@ -1,25 +1,4328 @@
1
- import { B, C, F, I, f, j, S, h, T, V, c, g, e, d, i, a, p, r, b, t } from "./index.b9537b42.js";
2
- import "@builder.io/qwik";
3
- import "@builder.io/qwik/jsx-runtime";
1
+ import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useStore, useComputedQrl, useLexicalScope, _IMMUTABLE, Slot, useContextProvider, useContext, createElement, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl } from "@builder.io/qwik";
2
+ import { Fragment } from "@builder.io/qwik/jsx-runtime";
3
+ import Interpreter from "js-interpreter";
4
+ const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
5
+ useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
6
+ return /* @__PURE__ */ _jsxC(Fragment, {
7
+ children: props.link ? /* @__PURE__ */ _jsxS("a", {
8
+ ...props.attributes,
9
+ children: _fnSignal((p0) => p0.text, [
10
+ props
11
+ ], "p0.text")
12
+ }, {
13
+ href: _fnSignal((p0) => p0.link, [
14
+ props
15
+ ], "p0.link"),
16
+ role: "button",
17
+ target: _fnSignal((p0) => p0.openLinkInNewTab ? "_blank" : void 0, [
18
+ props
19
+ ], 'p0.openLinkInNewTab?"_blank":undefined')
20
+ }, 0, "jc_0") : /* @__PURE__ */ _jsxS("button", {
21
+ ...props.attributes,
22
+ children: _fnSignal((p0) => p0.text, [
23
+ props
24
+ ], "p0.text")
25
+ }, {
26
+ class: _fnSignal((p0) => p0.attributes.class + " button-Button", [
27
+ props
28
+ ], 'p0.attributes.class+" button-Button"'),
29
+ style: _fnSignal((p0) => p0.attributes.style, [
30
+ props
31
+ ], "p0.attributes.style")
32
+ }, 0, null)
33
+ }, 1, "jc_1");
34
+ }, "Button_component_gJoMUICXoUQ"));
35
+ const STYLES$3 = `
36
+ .button-Button {
37
+ all: unset;
38
+ }
39
+ `;
40
+ const builderContext = createContextId("Builder");
41
+ const ComponentsContext = createContextId("Components");
42
+ function getBlockComponentOptions(block) {
43
+ var _a;
44
+ return {
45
+ ...(_a = block.component) == null ? void 0 : _a.options,
46
+ ...block.options,
47
+ /**
48
+ * Our built-in components frequently make use of the block, so we provide all of it under `builderBlock`
49
+ */
50
+ builderBlock: block
51
+ };
52
+ }
53
+ const MSG_PREFIX = "[Builder.io]: ";
54
+ const logger = {
55
+ log: (...message) => console.log(MSG_PREFIX, ...message),
56
+ error: (...message) => console.error(MSG_PREFIX, ...message),
57
+ warn: (...message) => console.warn(MSG_PREFIX, ...message),
58
+ debug: (...message) => console.debug(MSG_PREFIX, ...message)
59
+ };
60
+ function isBrowser() {
61
+ return typeof window !== "undefined" && typeof document !== "undefined";
62
+ }
63
+ const TARGET = "qwik";
64
+ function isIframe() {
65
+ return isBrowser() && window.self !== window.top;
66
+ }
67
+ function isEditing() {
68
+ return isIframe() && window.location.search.indexOf("builder.frameEditing=") !== -1;
69
+ }
70
+ function isNonNodeServer() {
71
+ const hasNode = () => {
72
+ var _a;
73
+ return typeof process !== "undefined" && ((_a = process == null ? void 0 : process.versions) == null ? void 0 : _a.node);
74
+ };
75
+ return !isBrowser() && !hasNode();
76
+ }
77
+ const set = (obj, _path, value) => {
78
+ if (Object(obj) !== obj)
79
+ return obj;
80
+ const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
81
+ path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
82
+ return obj;
83
+ };
84
+ const processCode = (code) => {
85
+ return code.split("\n").map((line) => {
86
+ const trimmed = line.trim();
87
+ if (line.includes("__awaiter"))
88
+ return void 0;
89
+ const isStateSetter = trimmed.startsWith("state.");
90
+ if (!isStateSetter)
91
+ return line;
92
+ const [lhs, rhs] = trimmed.split("=");
93
+ const setStr = lhs.replace("state.", "").trim();
94
+ const setExpr = `setRootState('${setStr}', ${rhs.trim()})`;
95
+ return `
96
+ ${line}
97
+ ${setExpr}
98
+ `;
99
+ }).filter(Boolean).join("\n");
100
+ };
101
+ const getJSONValName = (val) => val + "JSON";
102
+ const runInNonNode = ({ builder, context, event, rootState, localState, rootSetState, useCode }) => {
103
+ const state = {
104
+ ...rootState,
105
+ ...localState
106
+ };
107
+ const properties = {
108
+ state,
109
+ Builder: builder,
110
+ builder,
111
+ context,
112
+ event
113
+ };
114
+ const prependedCode = Object.keys(properties).map((key) => `var ${key} = JSON.parse(${getJSONValName(key)});`).join("\n");
115
+ const cleanedCode = processCode(useCode);
116
+ if (cleanedCode === "") {
117
+ logger.warn("Skipping evaluation of empty code block.");
118
+ return;
119
+ }
120
+ const transformed = `
121
+ function theFunction() {
122
+ ${prependedCode}
123
+
124
+ ${cleanedCode}
125
+ }
126
+ theFunction();
127
+ `;
128
+ const setRootState = (prop, value) => {
129
+ const newState = set(state, prop, value);
130
+ rootSetState == null ? void 0 : rootSetState(newState);
131
+ };
132
+ const initFunc = function(interpreter, globalObject) {
133
+ Object.keys(properties).forEach((key) => {
134
+ const val = properties[key] || {};
135
+ const jsonVal = JSON.stringify(val);
136
+ interpreter.setProperty(globalObject, getJSONValName(key), jsonVal);
137
+ });
138
+ interpreter.setProperty(globalObject, "setRootState", interpreter.createNativeFunction(setRootState));
139
+ };
140
+ try {
141
+ const myInterpreter = new Interpreter(transformed, initFunc);
142
+ myInterpreter.run();
143
+ const output = myInterpreter.pseudoToNative(myInterpreter.value);
144
+ return output;
145
+ } catch (e) {
146
+ logger.warn("Custom code error in non-node runtime. SDK can only execute ES5 JavaScript.", {
147
+ e
148
+ });
149
+ return;
150
+ }
151
+ };
152
+ function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression = true }) {
153
+ if (code === "") {
154
+ logger.warn("Skipping evaluation of empty code block.");
155
+ return;
156
+ }
157
+ const builder = {
158
+ isEditing: isEditing(),
159
+ isBrowser: isBrowser(),
160
+ isServer: !isBrowser()
161
+ };
162
+ const useReturn = (
163
+ // we disable this for cases where we definitely don't want a return
164
+ isExpression && !(code.includes(";") || code.includes(" return ") || code.trim().startsWith("return "))
165
+ );
166
+ const useCode = useReturn ? `return (${code});` : code;
167
+ const args = {
168
+ useCode,
169
+ builder,
170
+ context,
171
+ event,
172
+ rootSetState,
173
+ rootState,
174
+ localState
175
+ };
176
+ if (isBrowser())
177
+ return runInBrowser(args);
178
+ if (isNonNodeServer())
179
+ return runInNonNode(args);
180
+ return runInNode(args);
181
+ }
182
+ const runInBrowser = ({ useCode, builder, context, event, localState, rootSetState, rootState }) => {
183
+ const state = flattenState(rootState, localState, rootSetState);
184
+ try {
185
+ return new Function("builder", "Builder", "state", "context", "event", useCode)(builder, builder, state, context, event);
186
+ } catch (e) {
187
+ logger.warn("Builder custom code error: \n While Evaluating: \n ", useCode, "\n", e);
188
+ }
189
+ };
190
+ const runInNode = (args) => {
191
+ return runInBrowser(args);
192
+ };
193
+ function flattenState(rootState, localState, rootSetState) {
194
+ if (rootState === localState)
195
+ throw new Error("rootState === localState");
196
+ return new Proxy(rootState, {
197
+ get: (_, prop) => {
198
+ if (localState && prop in localState)
199
+ return localState[prop];
200
+ return rootState[prop];
201
+ },
202
+ set: (_, prop, value) => {
203
+ if (localState && prop in localState)
204
+ throw new Error("Writing to local state is not allowed as it is read-only.");
205
+ rootState[prop] = value;
206
+ rootSetState == null ? void 0 : rootSetState(rootState);
207
+ return true;
208
+ }
209
+ });
210
+ }
211
+ const fastClone = (obj) => JSON.parse(JSON.stringify(obj));
212
+ function transformBlock(block) {
213
+ return block;
214
+ }
215
+ const evaluateBindings = ({ block, context, localState, rootState, rootSetState }) => {
216
+ if (!block.bindings)
217
+ return block;
218
+ const copy = fastClone(block);
219
+ const copied = {
220
+ ...copy,
221
+ properties: {
222
+ ...copy.properties
223
+ },
224
+ actions: {
225
+ ...copy.actions
226
+ }
227
+ };
228
+ for (const binding in block.bindings) {
229
+ const expression = block.bindings[binding];
230
+ const value = evaluate({
231
+ code: expression,
232
+ localState,
233
+ rootState,
234
+ rootSetState,
235
+ context
236
+ });
237
+ set(copied, binding, value);
238
+ }
239
+ return copied;
240
+ };
241
+ function getProcessedBlock({ block, context, shouldEvaluateBindings, localState, rootState, rootSetState }) {
242
+ const transformedBlock = transformBlock(block);
243
+ if (shouldEvaluateBindings)
244
+ return evaluateBindings({
245
+ block: transformedBlock,
246
+ localState,
247
+ rootState,
248
+ rootSetState,
249
+ context
250
+ });
251
+ else
252
+ return transformedBlock;
253
+ }
254
+ const EMPTY_HTML_ELEMENTS = [
255
+ "area",
256
+ "base",
257
+ "br",
258
+ "col",
259
+ "embed",
260
+ "hr",
261
+ "img",
262
+ "input",
263
+ "keygen",
264
+ "link",
265
+ "meta",
266
+ "param",
267
+ "source",
268
+ "track",
269
+ "wbr"
270
+ ];
271
+ const isEmptyHtmlElement = (tagName) => {
272
+ return typeof tagName === "string" && EMPTY_HTML_ELEMENTS.includes(tagName.toLowerCase());
273
+ };
274
+ const getComponent = ({ block, context, registeredComponents }) => {
275
+ var _a;
276
+ const componentName = (_a = getProcessedBlock({
277
+ block,
278
+ localState: context.localState,
279
+ rootState: context.rootState,
280
+ rootSetState: context.rootSetState,
281
+ context: context.context,
282
+ shouldEvaluateBindings: false
283
+ }).component) == null ? void 0 : _a.name;
284
+ if (!componentName)
285
+ return null;
286
+ const ref = registeredComponents[componentName];
287
+ if (!ref) {
288
+ console.warn(`
289
+ Could not find a registered component named "${componentName}".
290
+ If you registered it, is the file that registered it imported by the file that needs to render it?`);
291
+ return void 0;
292
+ } else
293
+ return ref;
294
+ };
295
+ const getRepeatItemData = ({ block, context }) => {
296
+ const { repeat, ...blockWithoutRepeat } = block;
297
+ if (!(repeat == null ? void 0 : repeat.collection))
298
+ return void 0;
299
+ const itemsArray = evaluate({
300
+ code: repeat.collection,
301
+ localState: context.localState,
302
+ rootState: context.rootState,
303
+ rootSetState: context.rootSetState,
304
+ context: context.context
305
+ });
306
+ if (!Array.isArray(itemsArray))
307
+ return void 0;
308
+ const collectionName = repeat.collection.split(".").pop();
309
+ const itemNameToUse = repeat.itemName || (collectionName ? collectionName + "Item" : "item");
310
+ const repeatArray = itemsArray.map((item, index) => ({
311
+ context: {
312
+ ...context,
313
+ localState: {
314
+ ...context.localState,
315
+ $index: index,
316
+ $item: item,
317
+ [itemNameToUse]: item,
318
+ [`$${itemNameToUse}Index`]: index
319
+ }
320
+ },
321
+ block: blockWithoutRepeat
322
+ }));
323
+ return repeatArray;
324
+ };
325
+ const SIZES = {
326
+ small: {
327
+ min: 320,
328
+ default: 321,
329
+ max: 640
330
+ },
331
+ medium: {
332
+ min: 641,
333
+ default: 642,
334
+ max: 991
335
+ },
336
+ large: {
337
+ min: 990,
338
+ default: 991,
339
+ max: 1200
340
+ }
341
+ };
342
+ const getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
343
+ const getSizesForBreakpoints = ({ small, medium }) => {
344
+ const newSizes = fastClone(SIZES);
345
+ if (!small || !medium)
346
+ return newSizes;
347
+ const smallMin = Math.floor(small / 2);
348
+ newSizes.small = {
349
+ max: small,
350
+ min: smallMin,
351
+ default: smallMin + 1
352
+ };
353
+ const mediumMin = newSizes.small.max + 1;
354
+ newSizes.medium = {
355
+ max: medium,
356
+ min: mediumMin,
357
+ default: mediumMin + 1
358
+ };
359
+ const largeMin = newSizes.medium.max + 1;
360
+ newSizes.large = {
361
+ max: 2e3,
362
+ // TODO: decide upper limit
363
+ min: largeMin,
364
+ default: largeMin + 1
365
+ };
366
+ return newSizes;
367
+ };
368
+ const camelToKebabCase = (string) => string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
369
+ const checkIsDefined = (maybeT) => maybeT !== null && maybeT !== void 0;
370
+ const convertStyleMapToCSSArray = (style) => {
371
+ const cssProps = Object.entries(style).map(([key, value]) => {
372
+ if (typeof value === "string")
373
+ return `${camelToKebabCase(key)}: ${value};`;
374
+ else
375
+ return void 0;
376
+ });
377
+ return cssProps.filter(checkIsDefined);
378
+ };
379
+ const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
380
+ const createCssClass = ({ mediaQuery, className, styles }) => {
381
+ const cssClass = `.${className} {
382
+ ${convertStyleMapToCSS(styles)}
383
+ }`;
384
+ if (mediaQuery)
385
+ return `${mediaQuery} {
386
+ ${cssClass}
387
+ }`;
388
+ else
389
+ return cssClass;
390
+ };
391
+ const InlinedStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
392
+ return /* @__PURE__ */ _jsxQ("style", null, {
393
+ dangerouslySetInnerHTML: _fnSignal((p0) => p0.styles, [
394
+ props
395
+ ], "p0.styles"),
396
+ id: _fnSignal((p0) => p0.id, [
397
+ props
398
+ ], "p0.id")
399
+ }, null, 3, "NG_0");
400
+ }, "InlinedStyles_component_IOsg46hMexk"));
401
+ const BlockStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
402
+ _jsxBranch();
403
+ const state = useStore({
404
+ processedBlock: getProcessedBlock({
405
+ block: props.block,
406
+ localState: props.context.localState,
407
+ rootState: props.context.rootState,
408
+ rootSetState: props.context.rootSetState,
409
+ context: props.context.context,
410
+ shouldEvaluateBindings: true
411
+ })
412
+ });
413
+ const canShowBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
414
+ const [state2] = useLexicalScope();
415
+ if (checkIsDefined(state2.processedBlock.hide))
416
+ return !state2.processedBlock.hide;
417
+ if (checkIsDefined(state2.processedBlock.show))
418
+ return state2.processedBlock.show;
419
+ return true;
420
+ }, "BlockStyles_component_canShowBlock_useComputed_YHoS9Lak9z4", [
421
+ state
422
+ ]));
423
+ const css = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
424
+ var _a;
425
+ const [props2, state2] = useLexicalScope();
426
+ const styles = state2.processedBlock.responsiveStyles;
427
+ const content = props2.context.content;
428
+ const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(((_a = content == null ? void 0 : content.meta) == null ? void 0 : _a.breakpoints) || {});
429
+ const largeStyles = styles == null ? void 0 : styles.large;
430
+ const mediumStyles = styles == null ? void 0 : styles.medium;
431
+ const smallStyles = styles == null ? void 0 : styles.small;
432
+ const className = state2.processedBlock.id;
433
+ if (!className)
434
+ return "";
435
+ const largeStylesClass = largeStyles ? createCssClass({
436
+ className,
437
+ styles: largeStyles
438
+ }) : "";
439
+ const mediumStylesClass = mediumStyles ? createCssClass({
440
+ className,
441
+ styles: mediumStyles,
442
+ mediaQuery: getMaxWidthQueryForSize("medium", sizesWithUpdatedBreakpoints)
443
+ }) : "";
444
+ const smallStylesClass = smallStyles ? createCssClass({
445
+ className,
446
+ styles: smallStyles,
447
+ mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
448
+ }) : "";
449
+ return [
450
+ largeStylesClass,
451
+ mediumStylesClass,
452
+ smallStylesClass
453
+ ].join(" ");
454
+ }, "BlockStyles_component_css_useComputed_b9Ru8qTcNik", [
455
+ props,
456
+ state
457
+ ]));
458
+ return /* @__PURE__ */ _jsxC(Fragment, {
459
+ children: css.value && canShowBlock.value ? /* @__PURE__ */ _jsxC(InlinedStyles, {
460
+ get styles() {
461
+ return css.value;
462
+ },
463
+ [_IMMUTABLE]: {
464
+ styles: _fnSignal((p0) => p0.value, [
465
+ css
466
+ ], "p0.value")
467
+ }
468
+ }, 3, "8B_0") : null
469
+ }, 1, "8B_1");
470
+ }, "BlockStyles_component_0lZeirBI638"));
471
+ function capitalizeFirstLetter(string) {
472
+ return string.charAt(0).toUpperCase() + string.slice(1);
473
+ }
474
+ const getEventHandlerName = (key) => `on${capitalizeFirstLetter(key)}$`;
475
+ function createEventHandler(value, options) {
476
+ return /* @__PURE__ */ inlinedQrl((event) => {
477
+ const [options2, value2] = useLexicalScope();
478
+ return evaluate({
479
+ code: value2,
480
+ context: options2.context,
481
+ localState: options2.localState,
482
+ rootState: options2.rootState,
483
+ rootSetState: options2.rootSetState,
484
+ event
485
+ });
486
+ }, "createEventHandler_7wCAiJVliNE", [
487
+ options,
488
+ value
489
+ ]);
490
+ }
491
+ function getBlockActions(options) {
492
+ const obj = {};
493
+ const optionActions = options.block.actions ?? {};
494
+ for (const key in optionActions) {
495
+ if (!optionActions.hasOwnProperty(key))
496
+ continue;
497
+ const value = optionActions[key];
498
+ let eventHandlerName = getEventHandlerName(key);
499
+ if (options.stripPrefix)
500
+ switch (TARGET) {
501
+ case "vue2":
502
+ case "vue3":
503
+ eventHandlerName = eventHandlerName.replace("v-on:", "");
504
+ break;
505
+ case "svelte":
506
+ eventHandlerName = eventHandlerName.replace("on:", "");
507
+ break;
508
+ }
509
+ obj[eventHandlerName] = createEventHandler(value, options);
510
+ }
511
+ return obj;
512
+ }
513
+ function transformBlockProperties(properties) {
514
+ return properties;
515
+ }
516
+ const extractRelevantRootBlockProperties = (block) => {
517
+ return {
518
+ href: block.href
519
+ };
520
+ };
521
+ function getBlockProperties({ block, context }) {
522
+ var _a;
523
+ const properties = {
524
+ ...extractRelevantRootBlockProperties(block),
525
+ ...block.properties,
526
+ "builder-id": block.id,
527
+ style: block.style ? getStyleAttribute(block.style) : void 0,
528
+ class: [
529
+ block.id,
530
+ "builder-block",
531
+ block.class,
532
+ (_a = block.properties) == null ? void 0 : _a.class
533
+ ].filter(Boolean).join(" ")
534
+ };
535
+ return transformBlockProperties(properties);
536
+ }
537
+ function getStyleAttribute(style) {
538
+ switch (TARGET) {
539
+ case "svelte":
540
+ case "vue2":
541
+ case "vue3":
542
+ case "solid":
543
+ return convertStyleMapToCSSArray(style).join(" ");
544
+ case "qwik":
545
+ case "reactNative":
546
+ case "react":
547
+ case "rsc":
548
+ return style;
549
+ }
550
+ }
551
+ const BlockWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
552
+ _jsxBranch();
553
+ return /* @__PURE__ */ _jsxC(Fragment, {
554
+ children: props.hasChildren ? /* @__PURE__ */ _jsxC(props.Wrapper, {
555
+ ...getBlockProperties({
556
+ block: props.block,
557
+ context: props.context
558
+ }),
559
+ ...getBlockActions({
560
+ block: props.block,
561
+ rootState: props.context.rootState,
562
+ rootSetState: props.context.rootSetState,
563
+ localState: props.context.localState,
564
+ context: props.context.context,
565
+ stripPrefix: true
566
+ }),
567
+ children: /* @__PURE__ */ _jsxC(Slot, null, 3, "87_0")
568
+ }, 0, "87_1") : /* @__PURE__ */ _jsxC(props.Wrapper, {
569
+ ...getBlockProperties({
570
+ block: props.block,
571
+ context: props.context
572
+ }),
573
+ ...getBlockActions({
574
+ block: props.block,
575
+ rootState: props.context.rootState,
576
+ rootSetState: props.context.rootSetState,
577
+ localState: props.context.localState,
578
+ context: props.context.context,
579
+ stripPrefix: true
580
+ })
581
+ }, 0, "87_2")
582
+ }, 1, "87_3");
583
+ }, "BlockWrapper_component_kOI0j0aW8Nw"));
584
+ const InteractiveElement = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
585
+ return /* @__PURE__ */ _jsxC(props.Wrapper, {
586
+ ...props.wrapperProps,
587
+ attributes: {
588
+ ...getBlockProperties({
589
+ block: props.block,
590
+ context: props.context
591
+ }),
592
+ ...getBlockActions({
593
+ block: props.block,
594
+ rootState: props.context.rootState,
595
+ rootSetState: props.context.rootSetState,
596
+ localState: props.context.localState,
597
+ context: props.context.context
598
+ })
599
+ },
600
+ children: /* @__PURE__ */ _jsxC(Slot, null, 3, "q0_0")
601
+ }, 0, "q0_1");
602
+ }, "InteractiveElement_component_0UqfJpjhn0g"));
603
+ const getWrapperProps = ({ componentOptions, builderBlock, context, componentRef, includeBlockProps, isInteractive, contextValue }) => {
604
+ const interactiveElementProps = {
605
+ Wrapper: componentRef,
606
+ block: builderBlock,
607
+ context,
608
+ wrapperProps: componentOptions
609
+ };
610
+ return isInteractive ? interactiveElementProps : {
611
+ ...componentOptions,
612
+ /**
613
+ * If `noWrap` is set to `true`, then the block's props/attributes are provided to the
614
+ * component itself directly. Otherwise, they are provided to the wrapper element.
615
+ */
616
+ ...includeBlockProps ? {
617
+ attributes: getBlockProperties({
618
+ block: builderBlock,
619
+ context: contextValue
620
+ })
621
+ } : {}
622
+ };
623
+ };
624
+ const ComponentRef = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
625
+ const state = useStore({
626
+ Wrapper: props.isInteractive ? InteractiveElement : props.componentRef
627
+ });
628
+ return /* @__PURE__ */ _jsxC(Fragment, {
629
+ children: props.componentRef ? /* @__PURE__ */ _jsxC(state.Wrapper, {
630
+ ...getWrapperProps({
631
+ componentOptions: props.componentOptions,
632
+ builderBlock: props.builderBlock,
633
+ context: props.context,
634
+ componentRef: props.componentRef,
635
+ includeBlockProps: props.includeBlockProps,
636
+ isInteractive: props.isInteractive,
637
+ contextValue: props.context
638
+ }),
639
+ children: [
640
+ (props.blockChildren || []).map(function(child) {
641
+ return /* @__PURE__ */ _jsxC(Block, {
642
+ get block() {
643
+ return child;
644
+ },
645
+ get context() {
646
+ return props.context;
647
+ },
648
+ get registeredComponents() {
649
+ return props.registeredComponents;
650
+ },
651
+ [_IMMUTABLE]: {
652
+ block: _IMMUTABLE,
653
+ context: _fnSignal((p0) => p0.context, [
654
+ props
655
+ ], "p0.context"),
656
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
657
+ props
658
+ ], "p0.registeredComponents")
659
+ }
660
+ }, 3, "block-" + child.id);
661
+ }),
662
+ (props.blockChildren || []).map(function(child) {
663
+ return /* @__PURE__ */ _jsxC(BlockStyles, {
664
+ get block() {
665
+ return child;
666
+ },
667
+ get context() {
668
+ return props.context;
669
+ },
670
+ [_IMMUTABLE]: {
671
+ block: _IMMUTABLE,
672
+ context: _fnSignal((p0) => p0.context, [
673
+ props
674
+ ], "p0.context")
675
+ }
676
+ }, 3, "block-style-" + child.id);
677
+ })
678
+ ]
679
+ }, 0, "z6_0") : null
680
+ }, 1, "z6_1");
681
+ }, "ComponentRef_component_tFQoBV6UFdc"));
682
+ const RepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
683
+ const state = useStore({
684
+ store: props.repeatContext
685
+ });
686
+ useContextProvider(builderContext, state.store);
687
+ return /* @__PURE__ */ _jsxC(Block, {
688
+ get block() {
689
+ return props.block;
690
+ },
691
+ get context() {
692
+ return state.store;
693
+ },
694
+ get registeredComponents() {
695
+ return props.registeredComponents;
696
+ },
697
+ [_IMMUTABLE]: {
698
+ block: _fnSignal((p0) => p0.block, [
699
+ props
700
+ ], "p0.block"),
701
+ context: _fnSignal((p0) => p0.store, [
702
+ state
703
+ ], "p0.store"),
704
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
705
+ props
706
+ ], "p0.registeredComponents")
707
+ }
708
+ }, 3, "GO_0");
709
+ }, "RepeatedBlock_component_JK1l2jKcfwA"));
710
+ const Block = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
711
+ var _a;
712
+ _jsxBranch();
713
+ const state = useStore({
714
+ childrenContext: props.context
715
+ });
716
+ const blockComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
717
+ const [props2] = useLexicalScope();
718
+ return getComponent({
719
+ block: props2.block,
720
+ context: props2.context,
721
+ registeredComponents: props2.registeredComponents
722
+ });
723
+ }, "Block_component_blockComponent_useComputed_83sGy9Xlsi0", [
724
+ props
725
+ ]));
726
+ const repeatItem = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
727
+ const [props2] = useLexicalScope();
728
+ return getRepeatItemData({
729
+ block: props2.block,
730
+ context: props2.context
731
+ });
732
+ }, "Block_component_repeatItem_useComputed_j31Y3wFqSCM", [
733
+ props
734
+ ]));
735
+ const processedBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
736
+ const [props2, repeatItem2] = useLexicalScope();
737
+ return repeatItem2.value ? props2.block : getProcessedBlock({
738
+ block: props2.block,
739
+ localState: props2.context.localState,
740
+ rootState: props2.context.rootState,
741
+ rootSetState: props2.context.rootSetState,
742
+ context: props2.context.context,
743
+ shouldEvaluateBindings: true
744
+ });
745
+ }, "Block_component_processedBlock_useComputed_ESKw0l5FcBc", [
746
+ props,
747
+ repeatItem
748
+ ]));
749
+ const Tag = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
750
+ const [props2] = useLexicalScope();
751
+ return props2.block.tagName || "div";
752
+ }, "Block_component_Tag_useComputed_eQnDgbcBW2A", [
753
+ props
754
+ ]));
755
+ const canShowBlock = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
756
+ const [processedBlock2] = useLexicalScope();
757
+ if ("hide" in processedBlock2.value)
758
+ return !processedBlock2.value.hide;
759
+ if ("show" in processedBlock2.value)
760
+ return processedBlock2.value.show;
761
+ return true;
762
+ }, "Block_component_canShowBlock_useComputed_NJEFz8ICF08", [
763
+ processedBlock
764
+ ]));
765
+ const childrenWithoutParentComponent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
766
+ var _a2;
767
+ const [blockComponent2, processedBlock2, repeatItem2] = useLexicalScope();
768
+ const shouldRenderChildrenOutsideRef = !((_a2 = blockComponent2.value) == null ? void 0 : _a2.component) && !repeatItem2.value;
769
+ return shouldRenderChildrenOutsideRef ? processedBlock2.value.children ?? [] : [];
770
+ }, "Block_component_childrenWithoutParentComponent_useComputed_0WENYGElWnc", [
771
+ blockComponent,
772
+ processedBlock,
773
+ repeatItem
774
+ ]));
775
+ const componentRefProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
776
+ var _a2, _b, _c, _d, _e;
777
+ const [blockComponent2, processedBlock2, props2, state2] = useLexicalScope();
778
+ return {
779
+ blockChildren: processedBlock2.value.children ?? [],
780
+ componentRef: (_a2 = blockComponent2.value) == null ? void 0 : _a2.component,
781
+ componentOptions: {
782
+ ...getBlockComponentOptions(processedBlock2.value),
783
+ builderContext: props2.context,
784
+ ...((_b = blockComponent2.value) == null ? void 0 : _b.name) === "Symbol" || ((_c = blockComponent2.value) == null ? void 0 : _c.name) === "Columns" ? {
785
+ builderComponents: props2.registeredComponents
786
+ } : {}
787
+ },
788
+ context: state2.childrenContext,
789
+ registeredComponents: props2.registeredComponents,
790
+ builderBlock: processedBlock2.value,
791
+ includeBlockProps: ((_d = blockComponent2.value) == null ? void 0 : _d.noWrap) === true,
792
+ isInteractive: !((_e = blockComponent2.value) == null ? void 0 : _e.isRSC)
793
+ };
794
+ }, "Block_component_componentRefProps_useComputed_Ikbl8VO04ho", [
795
+ blockComponent,
796
+ processedBlock,
797
+ props,
798
+ state
799
+ ]));
800
+ return /* @__PURE__ */ _jsxC(Fragment, {
801
+ children: canShowBlock.value ? !((_a = blockComponent.value) == null ? void 0 : _a.noWrap) ? /* @__PURE__ */ _jsxC(Fragment, {
802
+ children: [
803
+ isEmptyHtmlElement(Tag.value) ? /* @__PURE__ */ _jsxC(BlockWrapper, {
804
+ get Wrapper() {
805
+ return Tag.value;
806
+ },
807
+ get block() {
808
+ return processedBlock.value;
809
+ },
810
+ get context() {
811
+ return props.context;
812
+ },
813
+ hasChildren: false,
814
+ [_IMMUTABLE]: {
815
+ Wrapper: _fnSignal((p0) => p0.value, [
816
+ Tag
817
+ ], "p0.value"),
818
+ block: _fnSignal((p0) => p0.value, [
819
+ processedBlock
820
+ ], "p0.value"),
821
+ context: _fnSignal((p0) => p0.context, [
822
+ props
823
+ ], "p0.context"),
824
+ hasChildren: _IMMUTABLE
825
+ }
826
+ }, 3, "jN_0") : null,
827
+ !isEmptyHtmlElement(Tag.value) && repeatItem.value ? (repeatItem.value || []).map(function(data, index) {
828
+ return /* @__PURE__ */ _jsxC(RepeatedBlock, {
829
+ get repeatContext() {
830
+ return data.context;
831
+ },
832
+ get block() {
833
+ return data.block;
834
+ },
835
+ get registeredComponents() {
836
+ return props.registeredComponents;
837
+ },
838
+ [_IMMUTABLE]: {
839
+ block: _IMMUTABLE,
840
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
841
+ props
842
+ ], "p0.registeredComponents"),
843
+ repeatContext: _IMMUTABLE
844
+ }
845
+ }, 3, index);
846
+ }) : null,
847
+ !isEmptyHtmlElement(Tag.value) && !repeatItem.value ? /* @__PURE__ */ _jsxC(BlockWrapper, {
848
+ get Wrapper() {
849
+ return Tag.value;
850
+ },
851
+ get block() {
852
+ return processedBlock.value;
853
+ },
854
+ get context() {
855
+ return props.context;
856
+ },
857
+ children: [
858
+ /* @__PURE__ */ _jsxC(ComponentRef, {
859
+ ...componentRefProps.value
860
+ }, 0, "jN_1"),
861
+ (childrenWithoutParentComponent.value || []).map(function(child) {
862
+ return /* @__PURE__ */ _jsxC(Block, {
863
+ get block() {
864
+ return child;
865
+ },
866
+ get context() {
867
+ return state.childrenContext;
868
+ },
869
+ get registeredComponents() {
870
+ return props.registeredComponents;
871
+ },
872
+ [_IMMUTABLE]: {
873
+ block: _IMMUTABLE,
874
+ context: _fnSignal((p0) => p0.childrenContext, [
875
+ state
876
+ ], "p0.childrenContext"),
877
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
878
+ props
879
+ ], "p0.registeredComponents")
880
+ }
881
+ }, 3, "block-" + child.id);
882
+ }),
883
+ (childrenWithoutParentComponent.value || []).map(function(child) {
884
+ return /* @__PURE__ */ _jsxC(BlockStyles, {
885
+ get block() {
886
+ return child;
887
+ },
888
+ get context() {
889
+ return state.childrenContext;
890
+ },
891
+ [_IMMUTABLE]: {
892
+ block: _IMMUTABLE,
893
+ context: _fnSignal((p0) => p0.childrenContext, [
894
+ state
895
+ ], "p0.childrenContext")
896
+ }
897
+ }, 3, "block-style-" + child.id);
898
+ })
899
+ ],
900
+ hasChildren: true,
901
+ [_IMMUTABLE]: {
902
+ Wrapper: _fnSignal((p0) => p0.value, [
903
+ Tag
904
+ ], "p0.value"),
905
+ block: _fnSignal((p0) => p0.value, [
906
+ processedBlock
907
+ ], "p0.value"),
908
+ context: _fnSignal((p0) => p0.context, [
909
+ props
910
+ ], "p0.context"),
911
+ hasChildren: _IMMUTABLE
912
+ }
913
+ }, 1, "jN_2") : null
914
+ ]
915
+ }, 1, "jN_3") : /* @__PURE__ */ _jsxC(ComponentRef, {
916
+ ...componentRefProps.value
917
+ }, 0, "jN_4") : null
918
+ }, 1, "jN_5");
919
+ }, "Block_component_nnPv0RY0U0k"));
920
+ const onClick$1 = function onClick2(props, state) {
921
+ var _a, _b;
922
+ if (isEditing() && !((_a = props.blocks) == null ? void 0 : _a.length))
923
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
924
+ type: "builder.clickEmptyBlocks",
925
+ data: {
926
+ parentElementId: props.parent,
927
+ dataPath: props.path
928
+ }
929
+ }, "*");
930
+ };
931
+ const onMouseEnter = function onMouseEnter2(props, state) {
932
+ var _a, _b;
933
+ if (isEditing() && !((_a = props.blocks) == null ? void 0 : _a.length))
934
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
935
+ type: "builder.hoverEmptyBlocks",
936
+ data: {
937
+ parentElementId: props.parent,
938
+ dataPath: props.path
939
+ }
940
+ }, "*");
941
+ };
942
+ const BlocksWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
943
+ useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$2, "BlocksWrapper_component_useStylesScoped_Kj0S9AOXQ0o"));
944
+ const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
945
+ var _a;
946
+ const [props2] = useLexicalScope();
947
+ return "builder-blocks" + (!((_a = props2.blocks) == null ? void 0 : _a.length) ? " no-blocks" : "");
948
+ }, "BlocksWrapper_component_className_useComputed_J5SSSH2Xf08", [
949
+ props
950
+ ]));
951
+ const state = {};
952
+ return /* @__PURE__ */ _jsxQ("div", {
953
+ onClick$: /* @__PURE__ */ inlinedQrl((event) => {
954
+ const [props2, state2] = useLexicalScope();
955
+ return onClick$1(props2);
956
+ }, "BlocksWrapper_component_div_onClick_1NkidSBS3D0", [
957
+ props,
958
+ state
959
+ ]),
960
+ onKeyPress$: /* @__PURE__ */ inlinedQrl((event) => {
961
+ const [props2, state2] = useLexicalScope();
962
+ return onClick$1(props2);
963
+ }, "BlocksWrapper_component_div_onKeyPress_Aaf0oNYOi80", [
964
+ props,
965
+ state
966
+ ]),
967
+ onMouseEnter$: /* @__PURE__ */ inlinedQrl((event) => {
968
+ const [props2, state2] = useLexicalScope();
969
+ return onMouseEnter(props2);
970
+ }, "BlocksWrapper_component_div_onMouseEnter_TxzAP5tI9Zc", [
971
+ props,
972
+ state
973
+ ])
974
+ }, {
975
+ "builder-parent-id": _fnSignal((p0) => p0.parent, [
976
+ props
977
+ ], "p0.parent"),
978
+ "builder-path": _fnSignal((p0) => p0.path, [
979
+ props
980
+ ], "p0.path"),
981
+ class: _fnSignal((p0) => p0.value + " div-BlocksWrapper", [
982
+ className
983
+ ], 'p0.value+" div-BlocksWrapper"'),
984
+ style: _fnSignal((p0) => p0.styleProp, [
985
+ props
986
+ ], "p0.styleProp")
987
+ }, /* @__PURE__ */ _jsxC(Slot, null, 3, "3u_0"), 0, "3u_1");
988
+ }, "BlocksWrapper_component_45hR0o6abzg"));
989
+ const STYLES$2 = `
990
+ .div-BlocksWrapper {
991
+ display: flex;
992
+ flex-direction: column;
993
+ align-items: stretch;
994
+ }
995
+ `;
996
+ const Blocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
997
+ const builderContext$1 = useContext(builderContext);
998
+ const componentsContext = useContext(ComponentsContext);
999
+ return /* @__PURE__ */ _jsxC(BlocksWrapper, {
1000
+ get blocks() {
1001
+ return props.blocks;
1002
+ },
1003
+ get parent() {
1004
+ return props.parent;
1005
+ },
1006
+ get path() {
1007
+ return props.path;
1008
+ },
1009
+ get styleProp() {
1010
+ return props.styleProp;
1011
+ },
1012
+ children: [
1013
+ props.blocks ? (props.blocks || []).map(function(block) {
1014
+ return /* @__PURE__ */ _jsxC(Block, {
1015
+ get block() {
1016
+ return block;
1017
+ },
1018
+ get context() {
1019
+ return props.context || builderContext$1;
1020
+ },
1021
+ get registeredComponents() {
1022
+ return props.registeredComponents || componentsContext.registeredComponents;
1023
+ },
1024
+ [_IMMUTABLE]: {
1025
+ block: _IMMUTABLE,
1026
+ context: _fnSignal((p0, p1) => p1.context || p0, [
1027
+ builderContext$1,
1028
+ props
1029
+ ], "p1.context||p0"),
1030
+ registeredComponents: _fnSignal((p0, p1) => p1.registeredComponents || p0.registeredComponents, [
1031
+ componentsContext,
1032
+ props
1033
+ ], "p1.registeredComponents||p0.registeredComponents")
1034
+ }
1035
+ }, 3, "render-block-" + block.id);
1036
+ }) : null,
1037
+ props.blocks ? (props.blocks || []).map(function(block) {
1038
+ return /* @__PURE__ */ _jsxC(BlockStyles, {
1039
+ get block() {
1040
+ return block;
1041
+ },
1042
+ get context() {
1043
+ return props.context || builderContext$1;
1044
+ },
1045
+ [_IMMUTABLE]: {
1046
+ block: _IMMUTABLE,
1047
+ context: _fnSignal((p0, p1) => p1.context || p0, [
1048
+ builderContext$1,
1049
+ props
1050
+ ], "p1.context||p0")
1051
+ }
1052
+ }, 3, "block-style-" + block.id);
1053
+ }) : null
1054
+ ],
1055
+ [_IMMUTABLE]: {
1056
+ blocks: _fnSignal((p0) => p0.blocks, [
1057
+ props
1058
+ ], "p0.blocks"),
1059
+ parent: _fnSignal((p0) => p0.parent, [
1060
+ props
1061
+ ], "p0.parent"),
1062
+ path: _fnSignal((p0) => p0.path, [
1063
+ props
1064
+ ], "p0.path"),
1065
+ styleProp: _fnSignal((p0) => p0.styleProp, [
1066
+ props
1067
+ ], "p0.styleProp")
1068
+ }
1069
+ }, 1, "0n_0");
1070
+ }, "Blocks_component_PI1ErWPzPEg"));
1071
+ const getWidth = function getWidth2(props, state, index) {
1072
+ var _a;
1073
+ return ((_a = state.cols[index]) == null ? void 0 : _a.width) || 100 / state.cols.length;
1074
+ };
1075
+ const getColumnCssWidth = function getColumnCssWidth2(props, state, index) {
1076
+ const subtractWidth = state.gutterSize * (state.cols.length - 1) / state.cols.length;
1077
+ return `calc(${getWidth(props, state, index)}% - ${subtractWidth}px)`;
1078
+ };
1079
+ const getTabletStyle = function getTabletStyle2(props, state, { stackedStyle, desktopStyle }) {
1080
+ return state.stackAt === "tablet" ? stackedStyle : desktopStyle;
1081
+ };
1082
+ const getMobileStyle = function getMobileStyle2(props, state, { stackedStyle, desktopStyle }) {
1083
+ return state.stackAt === "never" ? desktopStyle : stackedStyle;
1084
+ };
1085
+ const columnCssVars = function columnCssVars2(props, state, index) {
1086
+ const gutter = index === 0 ? 0 : state.gutterSize;
1087
+ const width = getColumnCssWidth(props, state, index);
1088
+ const gutterPixels = `${gutter}px`;
1089
+ const mobileWidth = "100%";
1090
+ const mobileMarginLeft = 0;
1091
+ const marginLeftKey = "margin-left";
1092
+ return {
1093
+ width,
1094
+ [marginLeftKey]: gutterPixels,
1095
+ "--column-width-mobile": getMobileStyle(props, state, {
1096
+ stackedStyle: mobileWidth,
1097
+ desktopStyle: width
1098
+ }),
1099
+ "--column-margin-left-mobile": getMobileStyle(props, state, {
1100
+ stackedStyle: mobileMarginLeft,
1101
+ desktopStyle: gutterPixels
1102
+ }),
1103
+ "--column-width-tablet": getTabletStyle(props, state, {
1104
+ stackedStyle: mobileWidth,
1105
+ desktopStyle: width
1106
+ }),
1107
+ "--column-margin-left-tablet": getTabletStyle(props, state, {
1108
+ stackedStyle: mobileMarginLeft,
1109
+ desktopStyle: gutterPixels
1110
+ })
1111
+ };
1112
+ };
1113
+ const getWidthForBreakpointSize = function getWidthForBreakpointSize2(props, state, size) {
1114
+ var _a, _b;
1115
+ const breakpointSizes = getSizesForBreakpoints(((_b = (_a = props.builderContext.content) == null ? void 0 : _a.meta) == null ? void 0 : _b.breakpoints) || {});
1116
+ return breakpointSizes[size].max;
1117
+ };
1118
+ const Columns = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1119
+ _jsxBranch();
1120
+ const state = useStore({
1121
+ cols: props.columns || [],
1122
+ flexDir: props.stackColumnsAt === "never" ? "row" : props.reverseColumnsWhenStacked ? "column-reverse" : "column",
1123
+ gutterSize: typeof props.space === "number" ? props.space || 0 : 20,
1124
+ stackAt: props.stackColumnsAt || "tablet"
1125
+ });
1126
+ useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$1, "Columns_component_useStylesScoped_s7JLZz7MCCQ"));
1127
+ const columnsCssVars = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1128
+ const [props2, state2] = useLexicalScope();
1129
+ return {
1130
+ "--flex-dir": state2.flexDir,
1131
+ "--flex-dir-tablet": getTabletStyle(props2, state2, {
1132
+ stackedStyle: state2.flexDir,
1133
+ desktopStyle: "row"
1134
+ })
1135
+ };
1136
+ }, "Columns_component_columnsCssVars_useComputed_adFEq2RWT9s", [
1137
+ props,
1138
+ state
1139
+ ]));
1140
+ const columnsStyles = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1141
+ const [props2, state2] = useLexicalScope();
1142
+ return `
1143
+ @media (max-width: ${getWidthForBreakpointSize(props2, state2, "medium")}px) {
1144
+ .${props2.builderBlock.id}-breakpoints {
1145
+ flex-direction: var(--flex-dir-tablet);
1146
+ align-items: stretch;
1147
+ }
1148
+
1149
+ .${props2.builderBlock.id}-breakpoints > .builder-column {
1150
+ width: var(--column-width-tablet) !important;
1151
+ margin-left: var(--column-margin-left-tablet) !important;
1152
+ }
1153
+ }
1154
+
1155
+ @media (max-width: ${getWidthForBreakpointSize(props2, state2, "small")}px) {
1156
+ .${props2.builderBlock.id}-breakpoints {
1157
+ flex-direction: var(--flex-dir);
1158
+ align-items: stretch;
1159
+ }
1160
+
1161
+ .${props2.builderBlock.id}-breakpoints > .builder-column {
1162
+ width: var(--column-width-mobile) !important;
1163
+ margin-left: var(--column-margin-left-mobile) !important;
1164
+ }
1165
+ },
1166
+ `;
1167
+ }, "Columns_component_columnsStyles_useComputed_nBtMPbzd1Wc", [
1168
+ props,
1169
+ state
1170
+ ]));
1171
+ return /* @__PURE__ */ _jsxQ("div", null, {
1172
+ class: _fnSignal((p0) => `builder-columns ${p0.builderBlock.id}-breakpoints div-Columns`, [
1173
+ props
1174
+ ], '`builder-columns ${p0.builderBlock.id}-breakpoints`+" div-Columns"'),
1175
+ style: _fnSignal((p0) => p0.value, [
1176
+ columnsCssVars
1177
+ ], "p0.value")
1178
+ }, [
1179
+ /* @__PURE__ */ _jsxC(InlinedStyles, {
1180
+ get styles() {
1181
+ return columnsStyles.value;
1182
+ },
1183
+ [_IMMUTABLE]: {
1184
+ styles: _fnSignal((p0) => p0.value, [
1185
+ columnsStyles
1186
+ ], "p0.value")
1187
+ }
1188
+ }, 3, "c0_0"),
1189
+ (props.columns || []).map(function(column, index) {
1190
+ return /* @__PURE__ */ createElement("div", {
1191
+ class: "builder-column div-Columns-2",
1192
+ style: columnCssVars(props, state, index),
1193
+ key: index
1194
+ }, /* @__PURE__ */ _jsxC(Blocks, {
1195
+ get blocks() {
1196
+ return column.blocks;
1197
+ },
1198
+ get path() {
1199
+ return `component.options.columns.${index}.blocks`;
1200
+ },
1201
+ get parent() {
1202
+ return props.builderBlock.id;
1203
+ },
1204
+ get styleProp() {
1205
+ return {
1206
+ flexGrow: "1"
1207
+ };
1208
+ },
1209
+ get context() {
1210
+ return props.builderContext;
1211
+ },
1212
+ get registeredComponents() {
1213
+ return props.builderComponents;
1214
+ },
1215
+ [_IMMUTABLE]: {
1216
+ blocks: _IMMUTABLE,
1217
+ context: _fnSignal((p0) => p0.builderContext, [
1218
+ props
1219
+ ], "p0.builderContext"),
1220
+ parent: _fnSignal((p0) => p0.builderBlock.id, [
1221
+ props
1222
+ ], "p0.builderBlock.id"),
1223
+ path: _IMMUTABLE,
1224
+ registeredComponents: _fnSignal((p0) => p0.builderComponents, [
1225
+ props
1226
+ ], "p0.builderComponents"),
1227
+ styleProp: _IMMUTABLE
1228
+ }
1229
+ }, 3, "c0_1"));
1230
+ })
1231
+ ], 1, "c0_2");
1232
+ }, "Columns_component_7yLj4bxdI6c"));
1233
+ const STYLES$1 = `
1234
+ .div-Columns {
1235
+ display: flex;
1236
+ line-height: normal;
1237
+ }
1238
+ .div-Columns-2 {
1239
+ display: flex;
1240
+ flex-direction: column;
1241
+ align-items: stretch;
1242
+ }
1243
+ `;
1244
+ const FragmentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1245
+ return /* @__PURE__ */ _jsxQ("span", null, null, /* @__PURE__ */ _jsxC(Slot, null, 3, "oj_0"), 1, "oj_1");
1246
+ }, "FragmentComponent_component_T0AypnadAK0"));
1247
+ function removeProtocol(path) {
1248
+ return path.replace(/http(s)?:/, "");
1249
+ }
1250
+ function updateQueryParam(uri = "", key, value) {
1251
+ const re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
1252
+ const separator = uri.indexOf("?") !== -1 ? "&" : "?";
1253
+ if (uri.match(re))
1254
+ return uri.replace(re, "$1" + key + "=" + encodeURIComponent(value) + "$2");
1255
+ return uri + separator + key + "=" + encodeURIComponent(value);
1256
+ }
1257
+ function getShopifyImageUrl(src, size) {
1258
+ if (!src || !(src == null ? void 0 : src.match(/cdn\.shopify\.com/)) || !size)
1259
+ return src;
1260
+ if (size === "master")
1261
+ return removeProtocol(src);
1262
+ const match = src.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
1263
+ if (match) {
1264
+ const prefix = src.split(match[0]);
1265
+ const suffix = match[3];
1266
+ const useSize = size.match("x") ? size : `${size}x`;
1267
+ return removeProtocol(`${prefix[0]}_${useSize}${suffix}`);
1268
+ }
1269
+ return null;
1270
+ }
1271
+ function getSrcSet(url) {
1272
+ if (!url)
1273
+ return url;
1274
+ const sizes = [
1275
+ 100,
1276
+ 200,
1277
+ 400,
1278
+ 800,
1279
+ 1200,
1280
+ 1600,
1281
+ 2e3
1282
+ ];
1283
+ if (url.match(/builder\.io/)) {
1284
+ let srcUrl = url;
1285
+ const widthInSrc = Number(url.split("?width=")[1]);
1286
+ if (!isNaN(widthInSrc))
1287
+ srcUrl = `${srcUrl} ${widthInSrc}w`;
1288
+ return sizes.filter((size) => size !== widthInSrc).map((size) => `${updateQueryParam(url, "width", size)} ${size}w`).concat([
1289
+ srcUrl
1290
+ ]).join(", ");
1291
+ }
1292
+ if (url.match(/cdn\.shopify\.com/))
1293
+ return sizes.map((size) => [
1294
+ getShopifyImageUrl(url, `${size}x${size}`),
1295
+ size
1296
+ ]).filter(([sizeUrl]) => !!sizeUrl).map(([sizeUrl, size]) => `${sizeUrl} ${size}w`).concat([
1297
+ url
1298
+ ]).join(", ");
1299
+ return url;
1300
+ }
1301
+ const Image = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1302
+ var _a, _b, _c, _d;
1303
+ _jsxBranch();
1304
+ useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES, "Image_component_useStylesScoped_fBMYiVf9fuU"));
1305
+ const srcSetToUse = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1306
+ var _a2;
1307
+ const [props2] = useLexicalScope();
1308
+ const imageToUse = props2.image || props2.src;
1309
+ const url = imageToUse;
1310
+ if (!url || // We can auto add srcset for cdn.builder.io and shopify
1311
+ // images, otherwise you can supply this prop manually
1312
+ !(url.match(/builder\.io/) || url.match(/cdn\.shopify\.com/)))
1313
+ return props2.srcset;
1314
+ if (props2.srcset && ((_a2 = props2.image) == null ? void 0 : _a2.includes("builder.io/api/v1/image"))) {
1315
+ if (!props2.srcset.includes(props2.image.split("?")[0])) {
1316
+ console.debug("Removed given srcset");
1317
+ return getSrcSet(url);
1318
+ }
1319
+ } else if (props2.image && !props2.srcset)
1320
+ return getSrcSet(url);
1321
+ return getSrcSet(url);
1322
+ }, "Image_component_srcSetToUse_useComputed_TZMibf9Gpvw", [
1323
+ props
1324
+ ]));
1325
+ const webpSrcSet = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1326
+ var _a2;
1327
+ const [props2, srcSetToUse2] = useLexicalScope();
1328
+ if (((_a2 = srcSetToUse2.value) == null ? void 0 : _a2.match(/builder\.io/)) && !props2.noWebp)
1329
+ return srcSetToUse2.value.replace(/\?/g, "?format=webp&");
1330
+ else
1331
+ return "";
1332
+ }, "Image_component_webpSrcSet_useComputed_01YCu72BBtA", [
1333
+ props,
1334
+ srcSetToUse
1335
+ ]));
1336
+ const aspectRatioCss = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
1337
+ const [props2] = useLexicalScope();
1338
+ const aspectRatioStyles = {
1339
+ position: "absolute",
1340
+ height: "100%",
1341
+ width: "100%",
1342
+ left: "0px",
1343
+ top: "0px"
1344
+ };
1345
+ const out = props2.aspectRatio ? aspectRatioStyles : void 0;
1346
+ return out;
1347
+ }, "Image_component_aspectRatioCss_useComputed_yJ1jG0g5fbw", [
1348
+ props
1349
+ ]));
1350
+ return /* @__PURE__ */ _jsxC(Fragment$1, {
1351
+ children: [
1352
+ /* @__PURE__ */ _jsxQ("picture", null, null, [
1353
+ webpSrcSet.value ? /* @__PURE__ */ _jsxQ("source", null, {
1354
+ srcSet: _fnSignal((p0) => p0.value, [
1355
+ webpSrcSet
1356
+ ], "p0.value"),
1357
+ type: "image/webp"
1358
+ }, null, 3, "0A_0") : null,
1359
+ /* @__PURE__ */ _jsxQ("img", null, {
1360
+ alt: _fnSignal((p0) => p0.altText, [
1361
+ props
1362
+ ], "p0.altText"),
1363
+ class: _fnSignal((p0) => "builder-image" + (p0.className ? " " + p0.className : "") + " img-Image", [
1364
+ props
1365
+ ], '"builder-image"+(p0.className?" "+p0.className:"")+" img-Image"'),
1366
+ loading: "lazy",
1367
+ role: _fnSignal((p0) => p0.altText ? "presentation" : void 0, [
1368
+ props
1369
+ ], 'p0.altText?"presentation":undefined'),
1370
+ sizes: _fnSignal((p0) => p0.sizes, [
1371
+ props
1372
+ ], "p0.sizes"),
1373
+ src: _fnSignal((p0) => p0.image, [
1374
+ props
1375
+ ], "p0.image"),
1376
+ srcSet: _fnSignal((p0) => p0.value, [
1377
+ srcSetToUse
1378
+ ], "p0.value"),
1379
+ style: _fnSignal((p0, p1) => ({
1380
+ objectPosition: p1.backgroundPosition || "center",
1381
+ objectFit: p1.backgroundSize || "cover",
1382
+ ...p0.value
1383
+ }), [
1384
+ aspectRatioCss,
1385
+ props
1386
+ ], '{objectPosition:p1.backgroundPosition||"center",objectFit:p1.backgroundSize||"cover",...p0.value}')
1387
+ }, null, 3, null)
1388
+ ], 1, null),
1389
+ props.aspectRatio && !(((_b = (_a = props.builderBlock) == null ? void 0 : _a.children) == null ? void 0 : _b.length) && props.fitContent) ? /* @__PURE__ */ _jsxQ("div", null, {
1390
+ class: "builder-image-sizer div-Image",
1391
+ style: _fnSignal((p0) => ({
1392
+ paddingTop: p0.aspectRatio * 100 + "%"
1393
+ }), [
1394
+ props
1395
+ ], '{paddingTop:p0.aspectRatio*100+"%"}')
1396
+ }, null, 3, "0A_1") : null,
1397
+ ((_d = (_c = props.builderBlock) == null ? void 0 : _c.children) == null ? void 0 : _d.length) && props.fitContent ? /* @__PURE__ */ _jsxC(Slot, null, 3, "0A_2") : null,
1398
+ !props.fitContent && props.children ? /* @__PURE__ */ _jsxQ("div", null, {
1399
+ class: "div-Image-2"
1400
+ }, /* @__PURE__ */ _jsxC(Slot, null, 3, "0A_3"), 1, "0A_4") : null
1401
+ ]
1402
+ }, 1, "0A_5");
1403
+ }, "Image_component_LRxDkFa1EfU"));
1404
+ const STYLES = `
1405
+ .img-Image {
1406
+ opacity: 1;
1407
+ transition: opacity 0.2s ease-in-out;
1408
+ }
1409
+ .div-Image {
1410
+ width: 100%;
1411
+ pointer-events: none;
1412
+ font-size: 0;
1413
+ }
1414
+ .div-Image-2 {
1415
+ display: flex;
1416
+ flex-direction: column;
1417
+ align-items: stretch;
1418
+ position: absolute;
1419
+ top: 0;
1420
+ left: 0;
1421
+ width: 100%;
1422
+ height: 100%;
1423
+ }
1424
+ `;
1425
+ const SectionComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
1426
+ return /* @__PURE__ */ _jsxS("section", {
1427
+ ...props.attributes,
1428
+ children: /* @__PURE__ */ _jsxC(Slot, null, 3, "2Y_0"),
1429
+ style: {
1430
+ width: "100%",
1431
+ alignSelf: "stretch",
1432
+ flexGrow: 1,
1433
+ boxSizing: "border-box",
1434
+ maxWidth: props.maxWidth || 1200,
1435
+ display: "flex",
1436
+ flexDirection: "column",
1437
+ alignItems: "stretch",
1438
+ marginLeft: "auto",
1439
+ marginRight: "auto"
1440
+ }
1441
+ }, null, 0, "2Y_1");
1442
+ }, "SectionComponent_component_ZWF9iD5WeLg"));
1443
+ const getTopLevelDomain = (host) => {
1444
+ if (host === "localhost" || host === "127.0.0.1")
1445
+ return host;
1446
+ const parts = host.split(".");
1447
+ if (parts.length > 2)
1448
+ return parts.slice(1).join(".");
1449
+ return host;
1450
+ };
1451
+ const getCookieSync = ({ name, canTrack }) => {
1452
+ var _a;
1453
+ try {
1454
+ if (!canTrack)
1455
+ return void 0;
1456
+ return (_a = document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))) == null ? void 0 : _a.split("=")[1];
1457
+ } catch (err) {
1458
+ logger.warn("[COOKIE] GET error: ", (err == null ? void 0 : err.message) || err);
1459
+ return void 0;
1460
+ }
1461
+ };
1462
+ const getCookie = async (args) => getCookieSync(args);
1463
+ const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(checkIsDefined).join("; ");
1464
+ const SECURE_CONFIG = [
1465
+ [
1466
+ "secure",
1467
+ ""
1468
+ ],
1469
+ [
1470
+ "SameSite",
1471
+ "None"
1472
+ ]
1473
+ ];
1474
+ const createCookieString = ({ name, value, expires }) => {
1475
+ const secure = isBrowser() ? location.protocol === "https:" : true;
1476
+ const secureObj = secure ? SECURE_CONFIG : [
1477
+ []
1478
+ ];
1479
+ const expiresObj = expires ? [
1480
+ [
1481
+ "expires",
1482
+ expires.toUTCString()
1483
+ ]
1484
+ ] : [
1485
+ []
1486
+ ];
1487
+ const cookieValue = [
1488
+ [
1489
+ name,
1490
+ value
1491
+ ],
1492
+ ...expiresObj,
1493
+ [
1494
+ "path",
1495
+ "/"
1496
+ ],
1497
+ [
1498
+ "domain",
1499
+ getTopLevelDomain(window.location.hostname)
1500
+ ],
1501
+ ...secureObj
1502
+ ];
1503
+ const cookie = stringifyCookie(cookieValue);
1504
+ return cookie;
1505
+ };
1506
+ const setCookie = async ({ name, value, expires, canTrack }) => {
1507
+ try {
1508
+ if (!canTrack)
1509
+ return;
1510
+ const cookie = createCookieString({
1511
+ name,
1512
+ value,
1513
+ expires
1514
+ });
1515
+ document.cookie = cookie;
1516
+ } catch (err) {
1517
+ logger.warn("[COOKIE] SET error: ", (err == null ? void 0 : err.message) || err);
1518
+ }
1519
+ };
1520
+ const BUILDER_STORE_PREFIX = "builder.tests";
1521
+ const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
1522
+ const getContentVariationCookie = ({ contentId }) => getCookie({
1523
+ name: getContentTestKey(contentId),
1524
+ canTrack: true
1525
+ });
1526
+ const getContentVariationCookieSync = ({ contentId }) => getCookieSync({
1527
+ name: getContentTestKey(contentId),
1528
+ canTrack: true
1529
+ });
1530
+ const setContentVariationCookie = ({ contentId, value }) => setCookie({
1531
+ name: getContentTestKey(contentId),
1532
+ value,
1533
+ canTrack: true
1534
+ });
1535
+ const checkIsBuilderContentWithVariations = (item) => checkIsDefined(item.id) && checkIsDefined(item.variations) && Object.keys(item.variations).length > 0;
1536
+ const getRandomVariationId = ({ id, variations }) => {
1537
+ var _a;
1538
+ let n = 0;
1539
+ const random = Math.random();
1540
+ for (const id2 in variations) {
1541
+ const testRatio = (_a = variations[id2]) == null ? void 0 : _a.testRatio;
1542
+ n += testRatio;
1543
+ if (random < n)
1544
+ return id2;
1545
+ }
1546
+ return id;
1547
+ };
1548
+ const getAndSetVariantId = (args) => {
1549
+ const randomVariationId = getRandomVariationId(args);
1550
+ setContentVariationCookie({
1551
+ contentId: args.id,
1552
+ value: randomVariationId
1553
+ }).catch((err) => {
1554
+ logger.error("could not store A/B test variation: ", err);
1555
+ });
1556
+ return randomVariationId;
1557
+ };
1558
+ const getTestFields = ({ item, testGroupId }) => {
1559
+ const variationValue = item.variations[testGroupId];
1560
+ if (testGroupId === item.id || // handle edge-case where `testGroupId` points to non-existing variation
1561
+ !variationValue)
1562
+ return {
1563
+ testVariationId: item.id,
1564
+ testVariationName: "Default"
1565
+ };
1566
+ else
1567
+ return {
1568
+ data: variationValue.data,
1569
+ testVariationId: variationValue.id,
1570
+ testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
1571
+ };
1572
+ };
1573
+ const handleABTestingSync = ({ item, canTrack }) => {
1574
+ if (!canTrack)
1575
+ return item;
1576
+ if (!item)
1577
+ return void 0;
1578
+ if (!checkIsBuilderContentWithVariations(item))
1579
+ return item;
1580
+ const testGroupId = getContentVariationCookieSync({
1581
+ contentId: item.id
1582
+ }) || getAndSetVariantId({
1583
+ variations: item.variations,
1584
+ id: item.id
1585
+ });
1586
+ const variationValue = getTestFields({
1587
+ item,
1588
+ testGroupId
1589
+ });
1590
+ return {
1591
+ ...item,
1592
+ ...variationValue
1593
+ };
1594
+ };
1595
+ const handleABTesting = async ({ item, canTrack }) => {
1596
+ if (!canTrack)
1597
+ return item;
1598
+ if (!checkIsBuilderContentWithVariations(item))
1599
+ return item;
1600
+ const cookieValue = await getContentVariationCookie({
1601
+ contentId: item.id
1602
+ });
1603
+ const testGroupId = cookieValue || getAndSetVariantId({
1604
+ variations: item.variations,
1605
+ id: item.id
1606
+ });
1607
+ const variationValue = getTestFields({
1608
+ item,
1609
+ testGroupId
1610
+ });
1611
+ return {
1612
+ ...item,
1613
+ ...variationValue
1614
+ };
1615
+ };
1616
+ const getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
1617
+ const componentInfo$a = {
1618
+ name: "Core:Button",
1619
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",
1620
+ defaultStyles: {
1621
+ // TODO: make min width more intuitive and set one
1622
+ appearance: "none",
1623
+ paddingTop: "15px",
1624
+ paddingBottom: "15px",
1625
+ paddingLeft: "25px",
1626
+ paddingRight: "25px",
1627
+ backgroundColor: "#000000",
1628
+ color: "white",
1629
+ borderRadius: "4px",
1630
+ textAlign: "center",
1631
+ cursor: "pointer"
1632
+ },
1633
+ inputs: [
1634
+ {
1635
+ name: "text",
1636
+ type: "text",
1637
+ defaultValue: "Click me!",
1638
+ bubble: true
1639
+ },
1640
+ {
1641
+ name: "link",
1642
+ type: "url",
1643
+ bubble: true
1644
+ },
1645
+ {
1646
+ name: "openLinkInNewTab",
1647
+ type: "boolean",
1648
+ defaultValue: false,
1649
+ friendlyName: "Open link in new tab"
1650
+ }
1651
+ ],
1652
+ static: true,
1653
+ noWrap: true
1654
+ };
1655
+ const componentInfo$9 = {
1656
+ // TODO: ways to statically preprocess JSON for references, functions, etc
1657
+ name: "Columns",
1658
+ isRSC: true,
1659
+ inputs: [
1660
+ {
1661
+ name: "columns",
1662
+ type: "array",
1663
+ broadcast: true,
1664
+ subFields: [
1665
+ {
1666
+ name: "blocks",
1667
+ type: "array",
1668
+ hideFromUI: true,
1669
+ defaultValue: [
1670
+ {
1671
+ "@type": "@builder.io/sdk:Element",
1672
+ responsiveStyles: {
1673
+ large: {
1674
+ display: "flex",
1675
+ flexDirection: "column",
1676
+ alignItems: "stretch",
1677
+ flexShrink: "0",
1678
+ position: "relative",
1679
+ marginTop: "30px",
1680
+ textAlign: "center",
1681
+ lineHeight: "normal",
1682
+ height: "auto",
1683
+ minHeight: "20px",
1684
+ minWidth: "20px",
1685
+ overflow: "hidden"
1686
+ }
1687
+ },
1688
+ component: {
1689
+ name: "Image",
1690
+ options: {
1691
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
1692
+ backgroundPosition: "center",
1693
+ backgroundSize: "cover",
1694
+ aspectRatio: 0.7004048582995948
1695
+ }
1696
+ }
1697
+ },
1698
+ {
1699
+ "@type": "@builder.io/sdk:Element",
1700
+ responsiveStyles: {
1701
+ large: {
1702
+ display: "flex",
1703
+ flexDirection: "column",
1704
+ alignItems: "stretch",
1705
+ flexShrink: "0",
1706
+ position: "relative",
1707
+ marginTop: "30px",
1708
+ textAlign: "center",
1709
+ lineHeight: "normal",
1710
+ height: "auto"
1711
+ }
1712
+ },
1713
+ component: {
1714
+ name: "Text",
1715
+ options: {
1716
+ text: "<p>Enter some text...</p>"
1717
+ }
1718
+ }
1719
+ }
1720
+ ]
1721
+ },
1722
+ {
1723
+ name: "width",
1724
+ type: "number",
1725
+ hideFromUI: true,
1726
+ helperText: "Width %, e.g. set to 50 to fill half of the space"
1727
+ },
1728
+ {
1729
+ name: "link",
1730
+ type: "url",
1731
+ helperText: "Optionally set a url that clicking this column will link to"
1732
+ }
1733
+ ],
1734
+ defaultValue: [
1735
+ {
1736
+ blocks: [
1737
+ {
1738
+ "@type": "@builder.io/sdk:Element",
1739
+ responsiveStyles: {
1740
+ large: {
1741
+ display: "flex",
1742
+ flexDirection: "column",
1743
+ alignItems: "stretch",
1744
+ flexShrink: "0",
1745
+ position: "relative",
1746
+ marginTop: "30px",
1747
+ textAlign: "center",
1748
+ lineHeight: "normal",
1749
+ height: "auto",
1750
+ minHeight: "20px",
1751
+ minWidth: "20px",
1752
+ overflow: "hidden"
1753
+ }
1754
+ },
1755
+ component: {
1756
+ name: "Image",
1757
+ options: {
1758
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
1759
+ backgroundPosition: "center",
1760
+ backgroundSize: "cover",
1761
+ aspectRatio: 0.7004048582995948
1762
+ }
1763
+ }
1764
+ },
1765
+ {
1766
+ "@type": "@builder.io/sdk:Element",
1767
+ responsiveStyles: {
1768
+ large: {
1769
+ display: "flex",
1770
+ flexDirection: "column",
1771
+ alignItems: "stretch",
1772
+ flexShrink: "0",
1773
+ position: "relative",
1774
+ marginTop: "30px",
1775
+ textAlign: "center",
1776
+ lineHeight: "normal",
1777
+ height: "auto"
1778
+ }
1779
+ },
1780
+ component: {
1781
+ name: "Text",
1782
+ options: {
1783
+ text: "<p>Enter some text...</p>"
1784
+ }
1785
+ }
1786
+ }
1787
+ ]
1788
+ },
1789
+ {
1790
+ blocks: [
1791
+ {
1792
+ "@type": "@builder.io/sdk:Element",
1793
+ responsiveStyles: {
1794
+ large: {
1795
+ display: "flex",
1796
+ flexDirection: "column",
1797
+ alignItems: "stretch",
1798
+ flexShrink: "0",
1799
+ position: "relative",
1800
+ marginTop: "30px",
1801
+ textAlign: "center",
1802
+ lineHeight: "normal",
1803
+ height: "auto",
1804
+ minHeight: "20px",
1805
+ minWidth: "20px",
1806
+ overflow: "hidden"
1807
+ }
1808
+ },
1809
+ component: {
1810
+ name: "Image",
1811
+ options: {
1812
+ image: "https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",
1813
+ backgroundPosition: "center",
1814
+ backgroundSize: "cover",
1815
+ aspectRatio: 0.7004048582995948
1816
+ }
1817
+ }
1818
+ },
1819
+ {
1820
+ "@type": "@builder.io/sdk:Element",
1821
+ responsiveStyles: {
1822
+ large: {
1823
+ display: "flex",
1824
+ flexDirection: "column",
1825
+ alignItems: "stretch",
1826
+ flexShrink: "0",
1827
+ position: "relative",
1828
+ marginTop: "30px",
1829
+ textAlign: "center",
1830
+ lineHeight: "normal",
1831
+ height: "auto"
1832
+ }
1833
+ },
1834
+ component: {
1835
+ name: "Text",
1836
+ options: {
1837
+ text: "<p>Enter some text...</p>"
1838
+ }
1839
+ }
1840
+ }
1841
+ ]
1842
+ }
1843
+ ],
1844
+ onChange: (options) => {
1845
+ function clearWidths() {
1846
+ columns.forEach((col) => {
1847
+ col.delete("width");
1848
+ });
1849
+ }
1850
+ const columns = options.get("columns");
1851
+ if (Array.isArray(columns)) {
1852
+ const containsColumnWithWidth = !!columns.find((col) => col.get("width"));
1853
+ if (containsColumnWithWidth) {
1854
+ const containsColumnWithoutWidth = !!columns.find((col) => !col.get("width"));
1855
+ if (containsColumnWithoutWidth)
1856
+ clearWidths();
1857
+ else {
1858
+ const sumWidths = columns.reduce((memo, col) => {
1859
+ return memo + col.get("width");
1860
+ }, 0);
1861
+ const widthsDontAddUp = sumWidths !== 100;
1862
+ if (widthsDontAddUp)
1863
+ clearWidths();
1864
+ }
1865
+ }
1866
+ }
1867
+ }
1868
+ },
1869
+ {
1870
+ name: "space",
1871
+ type: "number",
1872
+ defaultValue: 20,
1873
+ helperText: "Size of gap between columns",
1874
+ advanced: true
1875
+ },
1876
+ {
1877
+ name: "stackColumnsAt",
1878
+ type: "string",
1879
+ defaultValue: "tablet",
1880
+ helperText: "Convert horizontal columns to vertical at what device size",
1881
+ enum: [
1882
+ "tablet",
1883
+ "mobile",
1884
+ "never"
1885
+ ],
1886
+ advanced: true
1887
+ },
1888
+ {
1889
+ name: "reverseColumnsWhenStacked",
1890
+ type: "boolean",
1891
+ defaultValue: false,
1892
+ helperText: "When stacking columns for mobile devices, reverse the ordering",
1893
+ advanced: true
1894
+ }
1895
+ ]
1896
+ };
1897
+ const componentInfo$8 = {
1898
+ name: "Fragment",
1899
+ static: true,
1900
+ hidden: true,
1901
+ canHaveChildren: true,
1902
+ noWrap: true
1903
+ };
1904
+ const componentInfo$7 = {
1905
+ name: "Image",
1906
+ static: true,
1907
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
1908
+ defaultStyles: {
1909
+ position: "relative",
1910
+ minHeight: "20px",
1911
+ minWidth: "20px",
1912
+ overflow: "hidden"
1913
+ },
1914
+ canHaveChildren: true,
1915
+ inputs: [
1916
+ {
1917
+ name: "image",
1918
+ type: "file",
1919
+ bubble: true,
1920
+ allowedFileTypes: [
1921
+ "jpeg",
1922
+ "jpg",
1923
+ "png",
1924
+ "svg"
1925
+ ],
1926
+ required: true,
1927
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",
1928
+ onChange: (options) => {
1929
+ const DEFAULT_ASPECT_RATIO = 0.7041;
1930
+ options.delete("srcset");
1931
+ options.delete("noWebp");
1932
+ function loadImage(url, timeout = 6e4) {
1933
+ return new Promise((resolve, reject) => {
1934
+ const img = document.createElement("img");
1935
+ let loaded = false;
1936
+ img.onload = () => {
1937
+ loaded = true;
1938
+ resolve(img);
1939
+ };
1940
+ img.addEventListener("error", (event) => {
1941
+ console.warn("Image load failed", event.error);
1942
+ reject(event.error);
1943
+ });
1944
+ img.src = url;
1945
+ setTimeout(() => {
1946
+ if (!loaded)
1947
+ reject(new Error("Image load timed out"));
1948
+ }, timeout);
1949
+ });
1950
+ }
1951
+ function round2(num) {
1952
+ return Math.round(num * 1e3) / 1e3;
1953
+ }
1954
+ const value = options.get("image");
1955
+ const aspectRatio = options.get("aspectRatio");
1956
+ fetch(value).then((res) => res.blob()).then((blob) => {
1957
+ if (blob.type.includes("svg"))
1958
+ options.set("noWebp", true);
1959
+ });
1960
+ if (value && (!aspectRatio || aspectRatio === DEFAULT_ASPECT_RATIO))
1961
+ return loadImage(value).then((img) => {
1962
+ const possiblyUpdatedAspectRatio = options.get("aspectRatio");
1963
+ if (options.get("image") === value && (!possiblyUpdatedAspectRatio || possiblyUpdatedAspectRatio === DEFAULT_ASPECT_RATIO)) {
1964
+ if (img.width && img.height) {
1965
+ options.set("aspectRatio", round2(img.height / img.width));
1966
+ options.set("height", img.height);
1967
+ options.set("width", img.width);
1968
+ }
1969
+ }
1970
+ });
1971
+ }
1972
+ },
1973
+ {
1974
+ name: "backgroundSize",
1975
+ type: "text",
1976
+ defaultValue: "cover",
1977
+ enum: [
1978
+ {
1979
+ label: "contain",
1980
+ value: "contain",
1981
+ helperText: "The image should never get cropped"
1982
+ },
1983
+ {
1984
+ label: "cover",
1985
+ value: "cover",
1986
+ helperText: "The image should fill it's box, cropping when needed"
1987
+ }
1988
+ ]
1989
+ },
1990
+ {
1991
+ name: "backgroundPosition",
1992
+ type: "text",
1993
+ defaultValue: "center",
1994
+ enum: [
1995
+ "center",
1996
+ "top",
1997
+ "left",
1998
+ "right",
1999
+ "bottom",
2000
+ "top left",
2001
+ "top right",
2002
+ "bottom left",
2003
+ "bottom right"
2004
+ ]
2005
+ },
2006
+ {
2007
+ name: "altText",
2008
+ type: "string",
2009
+ helperText: "Text to display when the user has images off"
2010
+ },
2011
+ {
2012
+ name: "height",
2013
+ type: "number",
2014
+ hideFromUI: true
2015
+ },
2016
+ {
2017
+ name: "width",
2018
+ type: "number",
2019
+ hideFromUI: true
2020
+ },
2021
+ {
2022
+ name: "sizes",
2023
+ type: "string",
2024
+ hideFromUI: true
2025
+ },
2026
+ {
2027
+ name: "srcset",
2028
+ type: "string",
2029
+ hideFromUI: true
2030
+ },
2031
+ {
2032
+ name: "lazy",
2033
+ type: "boolean",
2034
+ defaultValue: true,
2035
+ hideFromUI: true
2036
+ },
2037
+ {
2038
+ name: "fitContent",
2039
+ type: "boolean",
2040
+ helperText: "When child blocks are provided, fit to them instead of using the image's aspect ratio",
2041
+ defaultValue: true
2042
+ },
2043
+ {
2044
+ name: "aspectRatio",
2045
+ type: "number",
2046
+ helperText: "This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",
2047
+ advanced: true,
2048
+ defaultValue: 0.7041
2049
+ }
2050
+ ]
2051
+ };
2052
+ const componentInfo$6 = {
2053
+ name: "Core:Section",
2054
+ static: true,
2055
+ image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
2056
+ inputs: [
2057
+ {
2058
+ name: "maxWidth",
2059
+ type: "number",
2060
+ defaultValue: 1200
2061
+ },
2062
+ {
2063
+ name: "lazyLoad",
2064
+ type: "boolean",
2065
+ defaultValue: false,
2066
+ advanced: true,
2067
+ description: "Only render this section when in view"
2068
+ }
2069
+ ],
2070
+ defaultStyles: {
2071
+ paddingLeft: "20px",
2072
+ paddingRight: "20px",
2073
+ paddingTop: "50px",
2074
+ paddingBottom: "50px",
2075
+ marginTop: "0px",
2076
+ width: "100vw",
2077
+ marginLeft: "calc(50% - 50vw)"
2078
+ },
2079
+ canHaveChildren: true,
2080
+ defaultChildren: [
2081
+ {
2082
+ "@type": "@builder.io/sdk:Element",
2083
+ responsiveStyles: {
2084
+ large: {
2085
+ textAlign: "center"
2086
+ }
2087
+ },
2088
+ component: {
2089
+ name: "Text",
2090
+ options: {
2091
+ text: "<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"
2092
+ }
2093
+ }
2094
+ }
2095
+ ]
2096
+ };
2097
+ const componentInfo$5 = {
2098
+ name: "Symbol",
2099
+ noWrap: true,
2100
+ static: true,
2101
+ isRSC: true,
2102
+ inputs: [
2103
+ {
2104
+ name: "symbol",
2105
+ type: "uiSymbol"
2106
+ },
2107
+ {
2108
+ name: "dataOnly",
2109
+ helperText: "Make this a data symbol that doesn't display any UI",
2110
+ type: "boolean",
2111
+ defaultValue: false,
2112
+ advanced: true,
2113
+ hideFromUI: true
2114
+ },
2115
+ {
2116
+ name: "inheritState",
2117
+ helperText: "Inherit the parent component state and data",
2118
+ type: "boolean",
2119
+ defaultValue: false,
2120
+ advanced: true
2121
+ },
2122
+ {
2123
+ name: "renderToLiquid",
2124
+ helperText: "Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",
2125
+ type: "boolean",
2126
+ defaultValue: false,
2127
+ advanced: true,
2128
+ hideFromUI: true
2129
+ },
2130
+ {
2131
+ name: "useChildren",
2132
+ hideFromUI: true,
2133
+ type: "boolean"
2134
+ }
2135
+ ]
2136
+ };
2137
+ const componentInfo$4 = {
2138
+ name: "Text",
2139
+ static: true,
2140
+ isRSC: true,
2141
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",
2142
+ inputs: [
2143
+ {
2144
+ name: "text",
2145
+ type: "html",
2146
+ required: true,
2147
+ autoFocus: true,
2148
+ bubble: true,
2149
+ defaultValue: "Enter some text..."
2150
+ }
2151
+ ],
2152
+ defaultStyles: {
2153
+ lineHeight: "normal",
2154
+ height: "auto",
2155
+ textAlign: "center"
2156
+ }
2157
+ };
2158
+ const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2159
+ return /* @__PURE__ */ _jsxQ("span", null, {
2160
+ class: "builder-text",
2161
+ dangerouslySetInnerHTML: _fnSignal((p0) => {
2162
+ var _a;
2163
+ return ((_a = p0.text) == null ? void 0 : _a.toString()) || "";
2164
+ }, [
2165
+ props
2166
+ ], 'p0.text?.toString()||""'),
2167
+ style: {
2168
+ outline: "none"
2169
+ }
2170
+ }, null, 3, "yO_0");
2171
+ }, "Text_component_15p0cKUxgIE"));
2172
+ const componentInfo$3 = {
2173
+ name: "Video",
2174
+ canHaveChildren: true,
2175
+ defaultStyles: {
2176
+ minHeight: "20px",
2177
+ minWidth: "20px"
2178
+ },
2179
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",
2180
+ inputs: [
2181
+ {
2182
+ name: "video",
2183
+ type: "file",
2184
+ allowedFileTypes: [
2185
+ "mp4"
2186
+ ],
2187
+ bubble: true,
2188
+ defaultValue: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",
2189
+ required: true
2190
+ },
2191
+ {
2192
+ name: "posterImage",
2193
+ type: "file",
2194
+ allowedFileTypes: [
2195
+ "jpeg",
2196
+ "png"
2197
+ ],
2198
+ helperText: "Image to show before the video plays"
2199
+ },
2200
+ {
2201
+ name: "autoPlay",
2202
+ type: "boolean",
2203
+ defaultValue: true
2204
+ },
2205
+ {
2206
+ name: "controls",
2207
+ type: "boolean",
2208
+ defaultValue: false
2209
+ },
2210
+ {
2211
+ name: "muted",
2212
+ type: "boolean",
2213
+ defaultValue: true
2214
+ },
2215
+ {
2216
+ name: "loop",
2217
+ type: "boolean",
2218
+ defaultValue: true
2219
+ },
2220
+ {
2221
+ name: "playsInline",
2222
+ type: "boolean",
2223
+ defaultValue: true
2224
+ },
2225
+ {
2226
+ name: "fit",
2227
+ type: "text",
2228
+ defaultValue: "cover",
2229
+ enum: [
2230
+ "contain",
2231
+ "cover",
2232
+ "fill",
2233
+ "auto"
2234
+ ]
2235
+ },
2236
+ {
2237
+ name: "preload",
2238
+ type: "text",
2239
+ defaultValue: "metadata",
2240
+ enum: [
2241
+ "auto",
2242
+ "metadata",
2243
+ "none"
2244
+ ]
2245
+ },
2246
+ {
2247
+ name: "fitContent",
2248
+ type: "boolean",
2249
+ helperText: "When child blocks are provided, fit to them instead of using the aspect ratio",
2250
+ defaultValue: true,
2251
+ advanced: true
2252
+ },
2253
+ {
2254
+ name: "position",
2255
+ type: "text",
2256
+ defaultValue: "center",
2257
+ enum: [
2258
+ "center",
2259
+ "top",
2260
+ "left",
2261
+ "right",
2262
+ "bottom",
2263
+ "top left",
2264
+ "top right",
2265
+ "bottom left",
2266
+ "bottom right"
2267
+ ]
2268
+ },
2269
+ {
2270
+ name: "height",
2271
+ type: "number",
2272
+ advanced: true
2273
+ },
2274
+ {
2275
+ name: "width",
2276
+ type: "number",
2277
+ advanced: true
2278
+ },
2279
+ {
2280
+ name: "aspectRatio",
2281
+ type: "number",
2282
+ advanced: true,
2283
+ defaultValue: 0.7004048582995948
2284
+ },
2285
+ {
2286
+ name: "lazyLoad",
2287
+ type: "boolean",
2288
+ helperText: 'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',
2289
+ defaultValue: true,
2290
+ advanced: true
2291
+ }
2292
+ ]
2293
+ };
2294
+ const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2295
+ const videoProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
2296
+ const [props2] = useLexicalScope();
2297
+ return {
2298
+ ...props2.autoPlay === true ? {
2299
+ autoPlay: true
2300
+ } : {},
2301
+ ...props2.muted === true ? {
2302
+ muted: true
2303
+ } : {},
2304
+ ...props2.controls === true ? {
2305
+ controls: true
2306
+ } : {},
2307
+ ...props2.loop === true ? {
2308
+ loop: true
2309
+ } : {},
2310
+ ...props2.playsInline === true ? {
2311
+ playsInline: true
2312
+ } : {}
2313
+ };
2314
+ }, "Video_component_videoProps_useComputed_60AadUGY06E", [
2315
+ props
2316
+ ]));
2317
+ const spreadProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
2318
+ const [props2, videoProps2] = useLexicalScope();
2319
+ return {
2320
+ ...props2.attributes,
2321
+ ...videoProps2.value
2322
+ };
2323
+ }, "Video_component_spreadProps_useComputed_ZdLsx18NYH4", [
2324
+ props,
2325
+ videoProps
2326
+ ]));
2327
+ return /* @__PURE__ */ _jsxS("video", {
2328
+ ...spreadProps.value
2329
+ }, {
2330
+ poster: _fnSignal((p0) => p0.posterImage, [
2331
+ props
2332
+ ], "p0.posterImage"),
2333
+ preload: _fnSignal((p0) => p0.preload || "metadata", [
2334
+ props
2335
+ ], 'p0.preload||"metadata"'),
2336
+ src: _fnSignal((p0) => p0.video || "no-src", [
2337
+ props
2338
+ ], 'p0.video||"no-src"'),
2339
+ style: _fnSignal((p0) => {
2340
+ var _a;
2341
+ return {
2342
+ width: "100%",
2343
+ height: "100%",
2344
+ ...(_a = p0.attributes) == null ? void 0 : _a.style,
2345
+ objectFit: p0.fit,
2346
+ objectPosition: p0.position,
2347
+ // Hack to get object fit to work as expected and
2348
+ // not have the video overflow
2349
+ borderRadius: 1
2350
+ };
2351
+ }, [
2352
+ props
2353
+ ], '{width:"100%",height:"100%",...p0.attributes?.style,objectFit:p0.fit,objectPosition:p0.position,borderRadius:1}')
2354
+ }, 0, "j7_0");
2355
+ }, "Video_component_qdcTZflYyoQ"));
2356
+ const componentInfo$2 = {
2357
+ name: "Embed",
2358
+ static: true,
2359
+ inputs: [
2360
+ {
2361
+ name: "url",
2362
+ type: "url",
2363
+ required: true,
2364
+ defaultValue: "",
2365
+ helperText: "e.g. enter a youtube url, google map, etc",
2366
+ onChange: (options) => {
2367
+ const url = options.get("url");
2368
+ if (url) {
2369
+ options.set("content", "Loading...");
2370
+ const apiKey = "ae0e60e78201a3f2b0de4b";
2371
+ return fetch(`https://iframe.ly/api/iframely?url=${url}&api_key=${apiKey}`).then((res) => res.json()).then((data) => {
2372
+ if (options.get("url") === url) {
2373
+ if (data.html)
2374
+ options.set("content", data.html);
2375
+ else
2376
+ options.set("content", "Invalid url, please try another");
2377
+ }
2378
+ }).catch((_err) => {
2379
+ options.set("content", "There was an error embedding this URL, please try again or another URL");
2380
+ });
2381
+ } else
2382
+ options.delete("content");
2383
+ }
2384
+ },
2385
+ {
2386
+ name: "content",
2387
+ type: "html",
2388
+ defaultValue: '<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',
2389
+ hideFromUI: true
2390
+ }
2391
+ ]
2392
+ };
2393
+ const SCRIPT_MIME_TYPES = [
2394
+ "text/javascript",
2395
+ "application/javascript",
2396
+ "application/ecmascript"
2397
+ ];
2398
+ const isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
2399
+ const findAndRunScripts$1 = function findAndRunScripts2(props, state, elem) {
2400
+ if (!elem.value || !elem.value.getElementsByTagName)
2401
+ return;
2402
+ const scripts = elem.value.getElementsByTagName("script");
2403
+ for (let i = 0; i < scripts.length; i++) {
2404
+ const script = scripts[i];
2405
+ if (script.src && !state.scriptsInserted.includes(script.src)) {
2406
+ state.scriptsInserted.push(script.src);
2407
+ const newScript = document.createElement("script");
2408
+ newScript.async = true;
2409
+ newScript.src = script.src;
2410
+ document.head.appendChild(newScript);
2411
+ } else if (isJsScript(script) && !state.scriptsRun.includes(script.innerText))
2412
+ try {
2413
+ state.scriptsRun.push(script.innerText);
2414
+ new Function(script.innerText)();
2415
+ } catch (error) {
2416
+ console.warn("`Embed`: Error running script:", error);
2417
+ }
2418
+ }
2419
+ };
2420
+ const Embed = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2421
+ const elem = useSignal();
2422
+ const state = useStore({
2423
+ ranInitFn: false,
2424
+ scriptsInserted: [],
2425
+ scriptsRun: []
2426
+ });
2427
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
2428
+ const [elem2, props2, state2] = useLexicalScope();
2429
+ track2(() => elem2.value);
2430
+ track2(() => state2.ranInitFn);
2431
+ if (elem2.value && !state2.ranInitFn) {
2432
+ state2.ranInitFn = true;
2433
+ findAndRunScripts$1(props2, state2, elem2);
2434
+ }
2435
+ }, "Embed_component_useTask_bg7ez0XUtiM", [
2436
+ elem,
2437
+ props,
2438
+ state
2439
+ ]));
2440
+ return /* @__PURE__ */ _jsxQ("div", {
2441
+ ref: elem
2442
+ }, {
2443
+ class: "builder-embed",
2444
+ dangerouslySetInnerHTML: _fnSignal((p0) => p0.content, [
2445
+ props
2446
+ ], "p0.content")
2447
+ }, null, 3, "9r_0");
2448
+ }, "Embed_component_Uji08ORjXbE"));
2449
+ const ImgComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2450
+ return /* @__PURE__ */ _jsxS("img", {
2451
+ ...props.attributes
2452
+ }, {
2453
+ alt: _fnSignal((p0) => p0.altText, [
2454
+ props
2455
+ ], "p0.altText"),
2456
+ src: _fnSignal((p0) => p0.imgSrc || p0.image, [
2457
+ props
2458
+ ], "p0.imgSrc||p0.image"),
2459
+ style: _fnSignal((p0) => ({
2460
+ objectFit: p0.backgroundSize || "cover",
2461
+ objectPosition: p0.backgroundPosition || "center"
2462
+ }), [
2463
+ props
2464
+ ], '{objectFit:p0.backgroundSize||"cover",objectPosition:p0.backgroundPosition||"center"}')
2465
+ }, 0, isEditing() && props.imgSrc || "default-key");
2466
+ }, "ImgComponent_component_FXvIDBSffO8"));
2467
+ const componentInfo$1 = {
2468
+ // friendlyName?
2469
+ name: "Raw:Img",
2470
+ hideFromInsertMenu: true,
2471
+ image: "https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",
2472
+ inputs: [
2473
+ {
2474
+ name: "image",
2475
+ bubble: true,
2476
+ type: "file",
2477
+ allowedFileTypes: [
2478
+ "jpeg",
2479
+ "jpg",
2480
+ "png",
2481
+ "svg",
2482
+ "gif",
2483
+ "webp"
2484
+ ],
2485
+ required: true
2486
+ }
2487
+ ],
2488
+ noWrap: true,
2489
+ static: true
2490
+ };
2491
+ const findAndRunScripts = function findAndRunScripts22(props, state, elem) {
2492
+ if (elem.value && elem.value.getElementsByTagName && typeof window !== "undefined") {
2493
+ const scripts = elem.value.getElementsByTagName("script");
2494
+ for (let i = 0; i < scripts.length; i++) {
2495
+ const script = scripts[i];
2496
+ if (script.src) {
2497
+ if (state.scriptsInserted.includes(script.src))
2498
+ continue;
2499
+ state.scriptsInserted.push(script.src);
2500
+ const newScript = document.createElement("script");
2501
+ newScript.async = true;
2502
+ newScript.src = script.src;
2503
+ document.head.appendChild(newScript);
2504
+ } else if (!script.type || [
2505
+ "text/javascript",
2506
+ "application/javascript",
2507
+ "application/ecmascript"
2508
+ ].includes(script.type)) {
2509
+ if (state.scriptsRun.includes(script.innerText))
2510
+ continue;
2511
+ try {
2512
+ state.scriptsRun.push(script.innerText);
2513
+ new Function(script.innerText)();
2514
+ } catch (error) {
2515
+ console.warn("`CustomCode`: Error running script:", error);
2516
+ }
2517
+ }
2518
+ }
2519
+ }
2520
+ };
2521
+ const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2522
+ const elem = useSignal();
2523
+ const state = useStore({
2524
+ scriptsInserted: [],
2525
+ scriptsRun: []
2526
+ });
2527
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
2528
+ const [elem2, props2, state2] = useLexicalScope();
2529
+ findAndRunScripts(props2, state2, elem2);
2530
+ }, "CustomCode_component_useVisibleTask_S5QgEQZj6YE", [
2531
+ elem,
2532
+ props,
2533
+ state
2534
+ ]));
2535
+ return /* @__PURE__ */ _jsxQ("div", {
2536
+ ref: elem
2537
+ }, {
2538
+ class: _fnSignal((p0) => "builder-custom-code" + (p0.replaceNodes ? " replace-nodes" : ""), [
2539
+ props
2540
+ ], '"builder-custom-code"+(p0.replaceNodes?" replace-nodes":"")'),
2541
+ dangerouslySetInnerHTML: _fnSignal((p0) => p0.code, [
2542
+ props
2543
+ ], "p0.code")
2544
+ }, null, 3, "bY_0");
2545
+ }, "CustomCode_component_uYOSy7w7Zqw"));
2546
+ const componentInfo = {
2547
+ name: "Custom Code",
2548
+ static: true,
2549
+ requiredPermissions: [
2550
+ "editCode"
2551
+ ],
2552
+ inputs: [
2553
+ {
2554
+ name: "code",
2555
+ type: "html",
2556
+ required: true,
2557
+ defaultValue: "<p>Hello there, I am custom HTML code!</p>",
2558
+ code: true
2559
+ },
2560
+ {
2561
+ name: "replaceNodes",
2562
+ type: "boolean",
2563
+ helperText: "Preserve server rendered dom nodes",
2564
+ advanced: true
2565
+ },
2566
+ {
2567
+ name: "scriptsClientOnly",
2568
+ type: "boolean",
2569
+ defaultValue: false,
2570
+ helperText: "Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",
2571
+ advanced: true
2572
+ }
2573
+ ]
2574
+ };
2575
+ const getDefaultRegisteredComponents = () => [
2576
+ {
2577
+ component: Button,
2578
+ ...componentInfo$a
2579
+ },
2580
+ {
2581
+ component: Columns,
2582
+ ...componentInfo$9
2583
+ },
2584
+ {
2585
+ component: CustomCode,
2586
+ ...componentInfo
2587
+ },
2588
+ {
2589
+ component: Embed,
2590
+ ...componentInfo$2
2591
+ },
2592
+ {
2593
+ component: FragmentComponent,
2594
+ ...componentInfo$8
2595
+ },
2596
+ {
2597
+ component: Image,
2598
+ ...componentInfo$7
2599
+ },
2600
+ {
2601
+ component: ImgComponent,
2602
+ ...componentInfo$1
2603
+ },
2604
+ {
2605
+ component: SectionComponent,
2606
+ ...componentInfo$6
2607
+ },
2608
+ {
2609
+ component: Symbol$1,
2610
+ ...componentInfo$5
2611
+ },
2612
+ {
2613
+ component: Text,
2614
+ ...componentInfo$4
2615
+ },
2616
+ {
2617
+ component: Video,
2618
+ ...componentInfo$3
2619
+ }
2620
+ ];
2621
+ const components = [];
2622
+ const createRegisterComponentMessage = (info) => ({
2623
+ type: "builder.registerComponent",
2624
+ data: info
2625
+ });
2626
+ const serializeFn = (fnValue) => {
2627
+ const fnStr = fnValue.toString().trim();
2628
+ const appendFunction = !fnStr.startsWith("function") && !fnStr.startsWith("(");
2629
+ return `return (${appendFunction ? "function " : ""}${fnStr}).apply(this, arguments)`;
2630
+ };
2631
+ const serializeValue = (value) => typeof value === "function" ? serializeFn(value) : fastClone(value);
2632
+ const serializeComponentInfo = ({ inputs, ...info }) => ({
2633
+ ...fastClone(info),
2634
+ inputs: inputs == null ? void 0 : inputs.map((input) => Object.entries(input).reduce((acc, [key, value]) => ({
2635
+ ...acc,
2636
+ [key]: serializeValue(value)
2637
+ }), {}))
2638
+ });
2639
+ const getVariants = (content) => Object.values((content == null ? void 0 : content.variations) || {}).map((variant) => ({
2640
+ ...variant,
2641
+ testVariationId: variant.id,
2642
+ id: content == null ? void 0 : content.id
2643
+ }));
2644
+ const checkShouldRunVariants = ({ canTrack, content }) => {
2645
+ const hasVariants = getVariants(content).length > 0;
2646
+ if (!hasVariants)
2647
+ return false;
2648
+ if (!canTrack)
2649
+ return false;
2650
+ if (isBrowser())
2651
+ return false;
2652
+ return true;
2653
+ };
2654
+ function bldrAbTest(contentId, variants, isHydrationTarget2) {
2655
+ var _a;
2656
+ function getAndSetVariantId2() {
2657
+ function setCookie2(name, value, days) {
2658
+ let expires = "";
2659
+ if (days) {
2660
+ const date = /* @__PURE__ */ new Date();
2661
+ date.setTime(date.getTime() + days * 864e5);
2662
+ expires = "; expires=" + date.toUTCString();
2663
+ }
2664
+ document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
2665
+ }
2666
+ function getCookie2(name) {
2667
+ const nameEQ = name + "=";
2668
+ const ca = document.cookie.split(";");
2669
+ for (let i = 0; i < ca.length; i++) {
2670
+ let c = ca[i];
2671
+ while (c.charAt(0) === " ")
2672
+ c = c.substring(1, c.length);
2673
+ if (c.indexOf(nameEQ) === 0)
2674
+ return c.substring(nameEQ.length, c.length);
2675
+ }
2676
+ return null;
2677
+ }
2678
+ const cookieName = `builder.tests.${contentId}`;
2679
+ const variantInCookie = getCookie2(cookieName);
2680
+ const availableIDs = variants.map((vr) => vr.id).concat(contentId);
2681
+ if (variantInCookie && availableIDs.includes(variantInCookie))
2682
+ return variantInCookie;
2683
+ let n = 0;
2684
+ const random = Math.random();
2685
+ for (let i = 0; i < variants.length; i++) {
2686
+ const variant = variants[i];
2687
+ const testRatio = variant.testRatio;
2688
+ n += testRatio;
2689
+ if (random < n) {
2690
+ setCookie2(cookieName, variant.id);
2691
+ return variant.id;
2692
+ }
2693
+ }
2694
+ setCookie2(cookieName, contentId);
2695
+ return contentId;
2696
+ }
2697
+ const winningVariantId = getAndSetVariantId2();
2698
+ const styleEl = (_a = document.currentScript) == null ? void 0 : _a.previousElementSibling;
2699
+ if (isHydrationTarget2) {
2700
+ styleEl.remove();
2701
+ const thisScriptEl = document.currentScript;
2702
+ thisScriptEl == null ? void 0 : thisScriptEl.remove();
2703
+ } else {
2704
+ const newStyleStr = variants.concat({
2705
+ id: contentId
2706
+ }).filter((variant) => variant.id !== winningVariantId).map((value) => {
2707
+ return `.variant-${value.id} { display: none; }
2708
+ `;
2709
+ }).join("");
2710
+ styleEl.innerHTML = newStyleStr;
2711
+ }
2712
+ }
2713
+ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
2714
+ var _a;
2715
+ if (!navigator.cookieEnabled)
2716
+ return;
2717
+ function getCookie2(name) {
2718
+ const nameEQ = name + "=";
2719
+ const ca = document.cookie.split(";");
2720
+ for (let i = 0; i < ca.length; i++) {
2721
+ let c = ca[i];
2722
+ while (c.charAt(0) === " ")
2723
+ c = c.substring(1, c.length);
2724
+ if (c.indexOf(nameEQ) === 0)
2725
+ return c.substring(nameEQ.length, c.length);
2726
+ }
2727
+ return null;
2728
+ }
2729
+ const cookieName = `builder.tests.${defaultContentId}`;
2730
+ const variantId = getCookie2(cookieName);
2731
+ const parentDiv = (_a = document.currentScript) == null ? void 0 : _a.parentElement;
2732
+ const variantIsDefaultContent = variantContentId === defaultContentId;
2733
+ if (variantId === variantContentId) {
2734
+ if (variantIsDefaultContent)
2735
+ return;
2736
+ parentDiv == null ? void 0 : parentDiv.removeAttribute("hidden");
2737
+ parentDiv == null ? void 0 : parentDiv.removeAttribute("aria-hidden");
2738
+ } else {
2739
+ if (variantIsDefaultContent) {
2740
+ if (isHydrationTarget2)
2741
+ parentDiv == null ? void 0 : parentDiv.remove();
2742
+ else {
2743
+ parentDiv == null ? void 0 : parentDiv.setAttribute("hidden", "true");
2744
+ parentDiv == null ? void 0 : parentDiv.setAttribute("aria-hidden", "true");
2745
+ }
2746
+ }
2747
+ return;
2748
+ }
2749
+ return;
2750
+ }
2751
+ const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
2752
+ const isHydrationTarget = getIsHydrationTarget(TARGET);
2753
+ const AB_TEST_FN_NAME = "builderIoAbTest";
2754
+ const CONTENT_FN_NAME = "builderIoRenderContent";
2755
+ const getScriptString = () => {
2756
+ const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
2757
+ const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
2758
+ return `
2759
+ window.${AB_TEST_FN_NAME} = ${fnStr}
2760
+ window.${CONTENT_FN_NAME} = ${fnStr2}
2761
+ `;
2762
+ };
2763
+ const getVariantsScriptString = (variants, contentId) => {
2764
+ return `
2765
+ window.${AB_TEST_FN_NAME}("${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget})`;
2766
+ };
2767
+ const getRenderContentScriptString = ({ contentId, variationId }) => {
2768
+ return `
2769
+ window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
2770
+ };
2771
+ const InlinedScript = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
2772
+ return /* @__PURE__ */ _jsxQ("script", null, {
2773
+ dangerouslySetInnerHTML: _fnSignal((p0) => p0.scriptStr, [
2774
+ props
2775
+ ], "p0.scriptStr"),
2776
+ id: _fnSignal((p0) => p0.id, [
2777
+ props
2778
+ ], "p0.id")
2779
+ }, null, 3, "WO_0");
2780
+ }, "InlinedScript_component_hwThBdhA8rw"));
2781
+ function getGlobalThis() {
2782
+ if (typeof globalThis !== "undefined")
2783
+ return globalThis;
2784
+ if (typeof window !== "undefined")
2785
+ return window;
2786
+ if (typeof global !== "undefined")
2787
+ return global;
2788
+ if (typeof self !== "undefined")
2789
+ return self;
2790
+ return globalThis;
2791
+ }
2792
+ function getFetch() {
2793
+ const globalFetch = getGlobalThis().fetch;
2794
+ if (typeof globalFetch === "undefined") {
2795
+ console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
2796
+ For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
2797
+ throw new Error("Builder SDK could not find a global `fetch` function");
2798
+ }
2799
+ return globalFetch;
2800
+ }
2801
+ const fetch$1 = getFetch();
2802
+ function flatten(object, path = null, separator = ".") {
2803
+ return Object.keys(object).reduce((acc, key) => {
2804
+ const value = object[key];
2805
+ const newPath = [
2806
+ path,
2807
+ key
2808
+ ].filter(Boolean).join(separator);
2809
+ const isObject = [
2810
+ typeof value === "object",
2811
+ value !== null,
2812
+ !(Array.isArray(value) && value.length === 0)
2813
+ ].every(Boolean);
2814
+ return isObject ? {
2815
+ ...acc,
2816
+ ...flatten(value, newPath, separator)
2817
+ } : {
2818
+ ...acc,
2819
+ [newPath]: value
2820
+ };
2821
+ }, {});
2822
+ }
2823
+ const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
2824
+ const BUILDER_OPTIONS_PREFIX = "options.";
2825
+ const convertSearchParamsToQueryObject = (searchParams) => {
2826
+ const options = {};
2827
+ searchParams.forEach((value, key) => {
2828
+ options[key] = value;
2829
+ });
2830
+ return options;
2831
+ };
2832
+ const getBuilderSearchParams = (_options) => {
2833
+ if (!_options)
2834
+ return {};
2835
+ const options = normalizeSearchParams(_options);
2836
+ const newOptions = {};
2837
+ Object.keys(options).forEach((key) => {
2838
+ if (key.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
2839
+ const trimmedKey = key.replace(BUILDER_SEARCHPARAMS_PREFIX, "").replace(BUILDER_OPTIONS_PREFIX, "");
2840
+ newOptions[trimmedKey] = options[key];
2841
+ }
2842
+ });
2843
+ return newOptions;
2844
+ };
2845
+ const getBuilderSearchParamsFromWindow = () => {
2846
+ if (!isBrowser())
2847
+ return {};
2848
+ const searchParams = new URLSearchParams(window.location.search);
2849
+ return getBuilderSearchParams(searchParams);
2850
+ };
2851
+ const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
2852
+ const DEFAULT_API_VERSION = "v3";
2853
+ const generateContentUrl = (options) => {
2854
+ const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
2855
+ if (!apiKey)
2856
+ throw new Error("Missing API key");
2857
+ if (![
2858
+ "v2",
2859
+ "v3"
2860
+ ].includes(apiVersion))
2861
+ throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
2862
+ const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}${enrich ? `&enrich=${enrich}` : ""}`);
2863
+ const queryOptions = {
2864
+ ...getBuilderSearchParamsFromWindow(),
2865
+ ...normalizeSearchParams(options.options || {})
2866
+ };
2867
+ const flattened = flatten(queryOptions);
2868
+ for (const key in flattened)
2869
+ url.searchParams.set(key, String(flattened[key]));
2870
+ if (userAttributes)
2871
+ url.searchParams.set("userAttributes", JSON.stringify(userAttributes));
2872
+ if (query) {
2873
+ const flattened2 = flatten({
2874
+ query
2875
+ });
2876
+ for (const key in flattened2)
2877
+ url.searchParams.set(key, JSON.stringify(flattened2[key]));
2878
+ }
2879
+ return url;
2880
+ };
2881
+ const checkContentHasResults = (content) => "results" in content;
2882
+ async function getContent(options) {
2883
+ const allContent = await getAllContent({
2884
+ ...options,
2885
+ limit: 1
2886
+ });
2887
+ if (allContent)
2888
+ return allContent.results[0] || null;
2889
+ return null;
2890
+ }
2891
+ const fetchContent$1 = async (options) => {
2892
+ const url = generateContentUrl(options);
2893
+ const res = await fetch$1(url.href);
2894
+ const content = await res.json();
2895
+ return content;
2896
+ };
2897
+ const processContentResult = async (options, content, url = generateContentUrl(options)) => {
2898
+ const canTrack = getDefaultCanTrack(options.canTrack);
2899
+ url.search.includes(`preview=`);
2900
+ if (!canTrack)
2901
+ return content;
2902
+ if (!(isBrowser() || TARGET === "reactNative"))
2903
+ return content;
2904
+ try {
2905
+ const newResults = [];
2906
+ for (const item of content.results)
2907
+ newResults.push(await handleABTesting({
2908
+ item,
2909
+ canTrack
2910
+ }));
2911
+ content.results = newResults;
2912
+ } catch (e) {
2913
+ logger.error("Could not process A/B tests. ", e);
2914
+ }
2915
+ return content;
2916
+ };
2917
+ async function getAllContent(options) {
2918
+ try {
2919
+ const url = generateContentUrl(options);
2920
+ const content = await fetchContent$1(options);
2921
+ if (!checkContentHasResults(content)) {
2922
+ logger.error("Error fetching data. ", {
2923
+ url,
2924
+ content,
2925
+ options
2926
+ });
2927
+ return null;
2928
+ }
2929
+ return processContentResult(options, content);
2930
+ } catch (error) {
2931
+ logger.error("Error fetching data. ", error);
2932
+ return null;
2933
+ }
2934
+ }
2935
+ function isPreviewing() {
2936
+ if (!isBrowser())
2937
+ return false;
2938
+ if (isEditing())
2939
+ return false;
2940
+ return Boolean(location.search.indexOf("builder.preview=") !== -1);
2941
+ }
2942
+ function uuidv4() {
2943
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
2944
+ const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
2945
+ return v.toString(16);
2946
+ });
2947
+ }
2948
+ function uuid() {
2949
+ return uuidv4().replace(/-/g, "");
2950
+ }
2951
+ const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
2952
+ const getSessionId = async ({ canTrack }) => {
2953
+ if (!canTrack)
2954
+ return void 0;
2955
+ const sessionId = await getCookie({
2956
+ name: SESSION_LOCAL_STORAGE_KEY,
2957
+ canTrack
2958
+ });
2959
+ if (checkIsDefined(sessionId))
2960
+ return sessionId;
2961
+ else {
2962
+ const newSessionId = createSessionId();
2963
+ setSessionId({
2964
+ id: newSessionId,
2965
+ canTrack
2966
+ });
2967
+ return newSessionId;
2968
+ }
2969
+ };
2970
+ const createSessionId = () => uuid();
2971
+ const setSessionId = ({ id, canTrack }) => setCookie({
2972
+ name: SESSION_LOCAL_STORAGE_KEY,
2973
+ value: id,
2974
+ canTrack
2975
+ });
2976
+ const getLocalStorage = () => isBrowser() && typeof localStorage !== "undefined" ? localStorage : void 0;
2977
+ const getLocalStorageItem = ({ key, canTrack }) => {
2978
+ var _a;
2979
+ try {
2980
+ if (canTrack)
2981
+ return (_a = getLocalStorage()) == null ? void 0 : _a.getItem(key);
2982
+ return void 0;
2983
+ } catch (err) {
2984
+ console.debug("[LocalStorage] GET error: ", err);
2985
+ return void 0;
2986
+ }
2987
+ };
2988
+ const setLocalStorageItem = ({ key, canTrack, value }) => {
2989
+ var _a;
2990
+ try {
2991
+ if (canTrack)
2992
+ (_a = getLocalStorage()) == null ? void 0 : _a.setItem(key, value);
2993
+ } catch (err) {
2994
+ console.debug("[LocalStorage] SET error: ", err);
2995
+ }
2996
+ };
2997
+ const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
2998
+ const getVisitorId = ({ canTrack }) => {
2999
+ if (!canTrack)
3000
+ return void 0;
3001
+ const visitorId = getLocalStorageItem({
3002
+ key: VISITOR_LOCAL_STORAGE_KEY,
3003
+ canTrack
3004
+ });
3005
+ if (checkIsDefined(visitorId))
3006
+ return visitorId;
3007
+ else {
3008
+ const newVisitorId = createVisitorId();
3009
+ setVisitorId({
3010
+ id: newVisitorId,
3011
+ canTrack
3012
+ });
3013
+ return newVisitorId;
3014
+ }
3015
+ };
3016
+ const createVisitorId = () => uuid();
3017
+ const setVisitorId = ({ id, canTrack }) => setLocalStorageItem({
3018
+ key: VISITOR_LOCAL_STORAGE_KEY,
3019
+ value: id,
3020
+ canTrack
3021
+ });
3022
+ const getLocation = () => {
3023
+ if (isBrowser()) {
3024
+ const parsedLocation = new URL(location.href);
3025
+ if (parsedLocation.pathname === "")
3026
+ parsedLocation.pathname = "/";
3027
+ return parsedLocation;
3028
+ } else {
3029
+ console.warn("Cannot get location for tracking in non-browser environment");
3030
+ return null;
3031
+ }
3032
+ };
3033
+ const getUserAgent = () => typeof navigator === "object" && navigator.userAgent || "";
3034
+ const getUserAttributes = () => {
3035
+ const userAgent = getUserAgent();
3036
+ const isMobile = {
3037
+ Android() {
3038
+ return userAgent.match(/Android/i);
3039
+ },
3040
+ BlackBerry() {
3041
+ return userAgent.match(/BlackBerry/i);
3042
+ },
3043
+ iOS() {
3044
+ return userAgent.match(/iPhone|iPod/i);
3045
+ },
3046
+ Opera() {
3047
+ return userAgent.match(/Opera Mini/i);
3048
+ },
3049
+ Windows() {
3050
+ return userAgent.match(/IEMobile/i) || userAgent.match(/WPDesktop/i);
3051
+ },
3052
+ any() {
3053
+ return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows() || TARGET === "reactNative";
3054
+ }
3055
+ };
3056
+ const isTablet = userAgent.match(/Tablet|iPad/i);
3057
+ const url = getLocation();
3058
+ return {
3059
+ urlPath: url == null ? void 0 : url.pathname,
3060
+ host: (url == null ? void 0 : url.host) || (url == null ? void 0 : url.hostname),
3061
+ device: isTablet ? "tablet" : isMobile.any() ? "mobile" : "desktop"
3062
+ };
3063
+ };
3064
+ const getTrackingEventData = async ({ canTrack }) => {
3065
+ if (!canTrack)
3066
+ return {
3067
+ visitorId: void 0,
3068
+ sessionId: void 0
3069
+ };
3070
+ const sessionId = await getSessionId({
3071
+ canTrack
3072
+ });
3073
+ const visitorId = getVisitorId({
3074
+ canTrack
3075
+ });
3076
+ return {
3077
+ sessionId,
3078
+ visitorId
3079
+ };
3080
+ };
3081
+ const createEvent = async ({ type: eventType, canTrack, apiKey, metadata, ...properties }) => ({
3082
+ type: eventType,
3083
+ data: {
3084
+ ...properties,
3085
+ metadata: {
3086
+ url: location.href,
3087
+ ...metadata
3088
+ },
3089
+ ...await getTrackingEventData({
3090
+ canTrack
3091
+ }),
3092
+ userAttributes: getUserAttributes(),
3093
+ ownerId: apiKey
3094
+ }
3095
+ });
3096
+ async function _track(eventProps) {
3097
+ if (!eventProps.apiKey) {
3098
+ logger.error("Missing API key for track call. Please provide your API key.");
3099
+ return;
3100
+ }
3101
+ if (!eventProps.canTrack)
3102
+ return;
3103
+ if (isEditing())
3104
+ return;
3105
+ if (!(isBrowser() || TARGET === "reactNative"))
3106
+ return;
3107
+ return fetch(`https://cdn.builder.io/api/v1/track`, {
3108
+ method: "POST",
3109
+ body: JSON.stringify({
3110
+ events: [
3111
+ await createEvent(eventProps)
3112
+ ]
3113
+ }),
3114
+ headers: {
3115
+ "content-type": "application/json"
3116
+ },
3117
+ mode: "cors"
3118
+ }).catch((err) => {
3119
+ console.error("Failed to track: ", err);
3120
+ });
3121
+ }
3122
+ const track = (args) => _track({
3123
+ ...args,
3124
+ canTrack: true
3125
+ });
3126
+ function round(num) {
3127
+ return Math.round(num * 1e3) / 1e3;
3128
+ }
3129
+ const findParentElement = (target, callback, checkElement = true) => {
3130
+ if (!(target instanceof HTMLElement))
3131
+ return null;
3132
+ let parent2 = checkElement ? target : target.parentElement;
3133
+ do {
3134
+ if (!parent2)
3135
+ return null;
3136
+ const matches = callback(parent2);
3137
+ if (matches)
3138
+ return parent2;
3139
+ } while (parent2 = parent2.parentElement);
3140
+ return null;
3141
+ };
3142
+ const findBuilderParent = (target) => findParentElement(target, (el) => {
3143
+ const id = el.getAttribute("builder-id") || el.id;
3144
+ return Boolean((id == null ? void 0 : id.indexOf("builder-")) === 0);
3145
+ });
3146
+ const computeOffset = ({ event, target }) => {
3147
+ const targetRect = target.getBoundingClientRect();
3148
+ const xOffset = event.clientX - targetRect.left;
3149
+ const yOffset = event.clientY - targetRect.top;
3150
+ const xRatio = round(xOffset / targetRect.width);
3151
+ const yRatio = round(yOffset / targetRect.height);
3152
+ return {
3153
+ x: xRatio,
3154
+ y: yRatio
3155
+ };
3156
+ };
3157
+ const getInteractionPropertiesForEvent = (event) => {
3158
+ const target = event.target;
3159
+ const targetBuilderElement = target && findBuilderParent(target);
3160
+ const builderId = (targetBuilderElement == null ? void 0 : targetBuilderElement.getAttribute("builder-id")) || (targetBuilderElement == null ? void 0 : targetBuilderElement.id);
3161
+ return {
3162
+ targetBuilderElement: builderId || void 0,
3163
+ metadata: {
3164
+ targetOffset: target ? computeOffset({
3165
+ event,
3166
+ target
3167
+ }) : void 0,
3168
+ builderTargetOffset: targetBuilderElement ? computeOffset({
3169
+ event,
3170
+ target: targetBuilderElement
3171
+ }) : void 0,
3172
+ builderElementIndex: targetBuilderElement && builderId ? [].slice.call(document.getElementsByClassName(builderId)).indexOf(targetBuilderElement) : void 0
3173
+ }
3174
+ };
3175
+ };
3176
+ const SDK_VERSION = "UNKNOWN_VERSION";
3177
+ const registry = {};
3178
+ function register(type, info) {
3179
+ let typeList = registry[type];
3180
+ if (!typeList)
3181
+ typeList = registry[type] = [];
3182
+ typeList.push(info);
3183
+ if (isBrowser()) {
3184
+ const message = {
3185
+ type: "builder.register",
3186
+ data: {
3187
+ type,
3188
+ info
3189
+ }
3190
+ };
3191
+ try {
3192
+ parent.postMessage(message, "*");
3193
+ if (parent !== window)
3194
+ window.postMessage(message, "*");
3195
+ } catch (err) {
3196
+ console.debug("Could not postmessage", err);
3197
+ }
3198
+ }
3199
+ }
3200
+ const registerInsertMenu = () => {
3201
+ register("insertMenu", {
3202
+ name: "_default",
3203
+ default: true,
3204
+ items: [
3205
+ {
3206
+ name: "Box"
3207
+ },
3208
+ {
3209
+ name: "Text"
3210
+ },
3211
+ {
3212
+ name: "Image"
3213
+ },
3214
+ {
3215
+ name: "Columns"
3216
+ },
3217
+ ...[
3218
+ {
3219
+ name: "Core:Section"
3220
+ },
3221
+ {
3222
+ name: "Core:Button"
3223
+ },
3224
+ {
3225
+ name: "Embed"
3226
+ },
3227
+ {
3228
+ name: "Custom Code"
3229
+ }
3230
+ ]
3231
+ ]
3232
+ });
3233
+ };
3234
+ let isSetupForEditing = false;
3235
+ const setupBrowserForEditing = (options = {}) => {
3236
+ var _a, _b;
3237
+ if (isSetupForEditing)
3238
+ return;
3239
+ isSetupForEditing = true;
3240
+ if (isBrowser()) {
3241
+ (_a = window.parent) == null ? void 0 : _a.postMessage({
3242
+ type: "builder.sdkInfo",
3243
+ data: {
3244
+ target: TARGET,
3245
+ version: SDK_VERSION,
3246
+ supportsPatchUpdates: false,
3247
+ // Supports builder-model="..." attribute which is needed to
3248
+ // scope our '+ add block' button styling
3249
+ supportsAddBlockScoping: true,
3250
+ supportsCustomBreakpoints: true
3251
+ }
3252
+ }, "*");
3253
+ (_b = window.parent) == null ? void 0 : _b.postMessage({
3254
+ type: "builder.updateContent",
3255
+ data: {
3256
+ options
3257
+ }
3258
+ }, "*");
3259
+ window.addEventListener("message", ({ data }) => {
3260
+ var _a2, _b2;
3261
+ if (!(data == null ? void 0 : data.type))
3262
+ return;
3263
+ switch (data.type) {
3264
+ case "builder.evaluate": {
3265
+ const text = data.data.text;
3266
+ const args = data.data.arguments || [];
3267
+ const id = data.data.id;
3268
+ const fn = new Function(text);
3269
+ let result;
3270
+ let error = null;
3271
+ try {
3272
+ result = fn.apply(null, args);
3273
+ } catch (err) {
3274
+ error = err;
3275
+ }
3276
+ if (error)
3277
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage({
3278
+ type: "builder.evaluateError",
3279
+ data: {
3280
+ id,
3281
+ error: error.message
3282
+ }
3283
+ }, "*");
3284
+ else if (result && typeof result.then === "function")
3285
+ result.then((finalResult) => {
3286
+ var _a3;
3287
+ (_a3 = window.parent) == null ? void 0 : _a3.postMessage({
3288
+ type: "builder.evaluateResult",
3289
+ data: {
3290
+ id,
3291
+ result: finalResult
3292
+ }
3293
+ }, "*");
3294
+ }).catch(console.error);
3295
+ else
3296
+ (_b2 = window.parent) == null ? void 0 : _b2.postMessage({
3297
+ type: "builder.evaluateResult",
3298
+ data: {
3299
+ result,
3300
+ id
3301
+ }
3302
+ }, "*");
3303
+ break;
3304
+ }
3305
+ }
3306
+ });
3307
+ }
3308
+ };
3309
+ const mergeNewContent = function mergeNewContent2(props, state, elementRef, newContent) {
3310
+ var _a, _b, _c, _d, _e;
3311
+ const newContentValue = {
3312
+ ...props.builderContextSignal.content,
3313
+ ...newContent,
3314
+ data: {
3315
+ ...(_a = props.builderContextSignal.content) == null ? void 0 : _a.data,
3316
+ ...newContent == null ? void 0 : newContent.data
3317
+ },
3318
+ meta: {
3319
+ ...(_b = props.builderContextSignal.content) == null ? void 0 : _b.meta,
3320
+ ...newContent == null ? void 0 : newContent.meta,
3321
+ breakpoints: ((_c = newContent == null ? void 0 : newContent.meta) == null ? void 0 : _c.breakpoints) || ((_e = (_d = props.builderContextSignal.content) == null ? void 0 : _d.meta) == null ? void 0 : _e.breakpoints)
3322
+ }
3323
+ };
3324
+ props.builderContextSignal.content = newContentValue;
3325
+ };
3326
+ const processMessage = function processMessage2(props, state, elementRef, event) {
3327
+ var _a;
3328
+ const { data } = event;
3329
+ if (data)
3330
+ switch (data.type) {
3331
+ case "builder.configureSdk": {
3332
+ const messageContent = data.data;
3333
+ const { breakpoints, contentId } = messageContent;
3334
+ if (!contentId || contentId !== ((_a = props.builderContextSignal.content) == null ? void 0 : _a.id))
3335
+ return;
3336
+ if (breakpoints)
3337
+ mergeNewContent(props, state, elementRef, {
3338
+ meta: {
3339
+ breakpoints
3340
+ }
3341
+ });
3342
+ state.forceReRenderCount = state.forceReRenderCount + 1;
3343
+ break;
3344
+ }
3345
+ case "builder.contentUpdate": {
3346
+ const messageContent = data.data;
3347
+ const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
3348
+ const contentData = messageContent.data;
3349
+ if (key === props.model) {
3350
+ mergeNewContent(props, state, elementRef, contentData);
3351
+ state.forceReRenderCount = state.forceReRenderCount + 1;
3352
+ }
3353
+ break;
3354
+ }
3355
+ }
3356
+ };
3357
+ const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
3358
+ var _a, _b;
3359
+ const jsCode = (_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
3360
+ if (jsCode)
3361
+ evaluate({
3362
+ code: jsCode,
3363
+ context: props.context || {},
3364
+ localState: void 0,
3365
+ rootState: props.builderContextSignal.rootState,
3366
+ rootSetState: props.builderContextSignal.rootSetState
3367
+ });
3368
+ };
3369
+ const onClick = function onClick22(props, state, elementRef, event) {
3370
+ var _a, _b;
3371
+ if (props.builderContextSignal.content) {
3372
+ const variationId = (_a = props.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
3373
+ const contentId = (_b = props.builderContextSignal.content) == null ? void 0 : _b.id;
3374
+ _track({
3375
+ type: "click",
3376
+ canTrack: state.canTrackToUse,
3377
+ contentId,
3378
+ apiKey: props.apiKey,
3379
+ variationId: variationId !== contentId ? variationId : void 0,
3380
+ ...getInteractionPropertiesForEvent(event),
3381
+ unique: !state.clicked
3382
+ });
3383
+ }
3384
+ if (!state.clicked)
3385
+ state.clicked = true;
3386
+ };
3387
+ const evalExpression = function evalExpression2(props, state, elementRef, expression) {
3388
+ return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
3389
+ code: group,
3390
+ context: props.context || {},
3391
+ localState: void 0,
3392
+ rootState: props.builderContextSignal.rootState,
3393
+ rootSetState: props.builderContextSignal.rootSetState
3394
+ }));
3395
+ };
3396
+ const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
3397
+ fetch$1(url).then((response) => response.json()).then((json) => {
3398
+ var _a, _b;
3399
+ const newState = {
3400
+ ...props.builderContextSignal.rootState,
3401
+ [key]: json
3402
+ };
3403
+ (_b = (_a = props.builderContextSignal).rootSetState) == null ? void 0 : _b.call(_a, newState);
3404
+ state.httpReqsData[key] = true;
3405
+ }).catch((err) => {
3406
+ console.error("error fetching dynamic data", url, err);
3407
+ });
3408
+ };
3409
+ const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
3410
+ var _a, _b;
3411
+ const requests = ((_b = (_a = props.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests) ?? {};
3412
+ Object.entries(requests).forEach(([key, url]) => {
3413
+ if (url && (!state.httpReqsData[key] || isEditing())) {
3414
+ const evaluatedUrl = evalExpression(props, state, elementRef, url);
3415
+ handleRequest(props, state, elementRef, {
3416
+ url: evaluatedUrl,
3417
+ key
3418
+ });
3419
+ }
3420
+ });
3421
+ };
3422
+ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
3423
+ if (isEditing())
3424
+ window.dispatchEvent(new CustomEvent("builder:component:stateChange", {
3425
+ detail: {
3426
+ state: props.builderContextSignal.rootState,
3427
+ ref: {
3428
+ name: props.model
3429
+ }
3430
+ }
3431
+ }));
3432
+ };
3433
+ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3434
+ _jsxBranch();
3435
+ const elementRef = useSignal();
3436
+ const state = useStore({
3437
+ canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
3438
+ clicked: false,
3439
+ forceReRenderCount: 0,
3440
+ httpReqsData: {},
3441
+ lastUpdated: 0,
3442
+ shouldSendResetCookie: false
3443
+ }, {
3444
+ deep: true
3445
+ });
3446
+ useContextProvider(builderContext, props.builderContextSignal);
3447
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
3448
+ var _a, _b;
3449
+ const [elementRef2, props2, state2] = useLexicalScope();
3450
+ if (!props2.apiKey)
3451
+ logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
3452
+ if (isBrowser()) {
3453
+ if (isEditing()) {
3454
+ state2.forceReRenderCount = state2.forceReRenderCount + 1;
3455
+ window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
3456
+ registerInsertMenu();
3457
+ setupBrowserForEditing({
3458
+ ...props2.locale ? {
3459
+ locale: props2.locale
3460
+ } : {},
3461
+ ...props2.includeRefs ? {
3462
+ includeRefs: props2.includeRefs
3463
+ } : {},
3464
+ ...props2.enrich ? {
3465
+ enrich: props2.enrich
3466
+ } : {}
3467
+ });
3468
+ Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
3469
+ var _a2;
3470
+ const message = createRegisterComponentMessage(registeredComponent);
3471
+ (_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
3472
+ });
3473
+ window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
3474
+ }
3475
+ if (props2.builderContextSignal.content) {
3476
+ const variationId = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.testVariationId;
3477
+ const contentId = (_b = props2.builderContextSignal.content) == null ? void 0 : _b.id;
3478
+ _track({
3479
+ type: "impression",
3480
+ canTrack: state2.canTrackToUse,
3481
+ contentId,
3482
+ apiKey: props2.apiKey,
3483
+ variationId: variationId !== contentId ? variationId : void 0
3484
+ });
3485
+ }
3486
+ if (isPreviewing()) {
3487
+ const searchParams = new URL(location.href).searchParams;
3488
+ const searchParamPreviewModel = searchParams.get("builder.preview");
3489
+ const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
3490
+ const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
3491
+ if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
3492
+ getContent({
3493
+ model: props2.model,
3494
+ apiKey: props2.apiKey,
3495
+ apiVersion: props2.builderContextSignal.apiVersion
3496
+ }).then((content) => {
3497
+ if (content)
3498
+ mergeNewContent(props2, state2, elementRef2, content);
3499
+ });
3500
+ }
3501
+ evaluateJsCode(props2);
3502
+ runHttpRequests(props2, state2, elementRef2);
3503
+ emitStateUpdate(props2);
3504
+ }
3505
+ }, "EnableEditor_component_useVisibleTask_Olaxc9jCOFk", [
3506
+ elementRef,
3507
+ props,
3508
+ state
3509
+ ]));
3510
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3511
+ const [elementRef2, props2, state2] = useLexicalScope();
3512
+ track2(() => props2.content);
3513
+ if (props2.content)
3514
+ mergeNewContent(props2, state2, elementRef2, props2.content);
3515
+ }, "EnableEditor_component_useTask_Nb2VI04qp0M", [
3516
+ elementRef,
3517
+ props,
3518
+ state
3519
+ ]));
3520
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3521
+ const [state2] = useLexicalScope();
3522
+ track2(() => state2.shouldSendResetCookie);
3523
+ }, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
3524
+ state
3525
+ ]));
3526
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3527
+ const [elementRef2, props2, state2] = useLexicalScope();
3528
+ track2(() => {
3529
+ var _a, _b;
3530
+ return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.jsCode;
3531
+ });
3532
+ track2(() => props2.builderContextSignal.rootState);
3533
+ evaluateJsCode(props2);
3534
+ }, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
3535
+ elementRef,
3536
+ props,
3537
+ state
3538
+ ]));
3539
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3540
+ const [elementRef2, props2, state2] = useLexicalScope();
3541
+ track2(() => {
3542
+ var _a, _b;
3543
+ return (_b = (_a = props2.builderContextSignal.content) == null ? void 0 : _a.data) == null ? void 0 : _b.httpRequests;
3544
+ });
3545
+ runHttpRequests(props2, state2, elementRef2);
3546
+ }, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
3547
+ elementRef,
3548
+ props,
3549
+ state
3550
+ ]));
3551
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
3552
+ const [elementRef2, props2, state2] = useLexicalScope();
3553
+ track2(() => props2.builderContextSignal.rootState);
3554
+ emitStateUpdate(props2);
3555
+ }, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
3556
+ elementRef,
3557
+ props,
3558
+ state
3559
+ ]));
3560
+ return /* @__PURE__ */ _jsxC(Fragment, {
3561
+ children: props.builderContextSignal.content ? /* @__PURE__ */ _jsxS("div", {
3562
+ ref: elementRef,
3563
+ ...props.showContent ? {} : {
3564
+ hidden: true,
3565
+ "aria-hidden": true
3566
+ },
3567
+ children: /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0"),
3568
+ onClick$: /* @__PURE__ */ inlinedQrl((event) => {
3569
+ const [elementRef2, props2, state2] = useLexicalScope();
3570
+ return onClick(props2, state2, elementRef2, event);
3571
+ }, "EnableEditor_component__Fragment_div_onClick_1QOkLijjH0M", [
3572
+ elementRef,
3573
+ props,
3574
+ state
3575
+ ])
3576
+ }, {
3577
+ "builder-content-id": _fnSignal((p0) => {
3578
+ var _a;
3579
+ return (_a = p0.builderContextSignal.content) == null ? void 0 : _a.id;
3580
+ }, [
3581
+ props
3582
+ ], "p0.builderContextSignal.content?.id"),
3583
+ "builder-model": _fnSignal((p0) => p0.model, [
3584
+ props
3585
+ ], "p0.model"),
3586
+ class: _fnSignal((p0) => p0.classNameProp, [
3587
+ props
3588
+ ], "p0.classNameProp")
3589
+ }, 0, state.forceReRenderCount) : null
3590
+ }, 1, "06_1");
3591
+ }, "EnableEditor_component_ko1mO8oaj8k"));
3592
+ const getCssFromFont = (font) => {
3593
+ var _a;
3594
+ const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
3595
+ const name = family.split(",")[0];
3596
+ const url = font.fileUrl ?? ((_a = font == null ? void 0 : font.files) == null ? void 0 : _a.regular);
3597
+ let str = "";
3598
+ if (url && family && name)
3599
+ str += `
3600
+ @font-face {
3601
+ font-family: "${family}";
3602
+ src: local("${name}"), url('${url}') format('woff2');
3603
+ font-display: fallback;
3604
+ font-weight: 400;
3605
+ }
3606
+ `.trim();
3607
+ if (font.files)
3608
+ for (const weight in font.files) {
3609
+ const isNumber = String(Number(weight)) === weight;
3610
+ if (!isNumber)
3611
+ continue;
3612
+ const weightUrl = font.files[weight];
3613
+ if (weightUrl && weightUrl !== url)
3614
+ str += `
3615
+ @font-face {
3616
+ font-family: "${family}";
3617
+ src: url('${weightUrl}') format('woff2');
3618
+ font-display: fallback;
3619
+ font-weight: ${weight};
3620
+ }
3621
+ `.trim();
3622
+ }
3623
+ return str;
3624
+ };
3625
+ const getFontCss = ({ customFonts }) => {
3626
+ var _a;
3627
+ return ((_a = customFonts == null ? void 0 : customFonts.map((font) => getCssFromFont(font))) == null ? void 0 : _a.join(" ")) || "";
3628
+ };
3629
+ const getCss = ({ cssCode, contentId }) => {
3630
+ if (!cssCode)
3631
+ return "";
3632
+ if (!contentId)
3633
+ return cssCode;
3634
+ return (cssCode == null ? void 0 : cssCode.replace(/&/g, `div[builder-content-id="${contentId}"]`)) || "";
3635
+ };
3636
+ const ContentStyles = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3637
+ const state = useStore({
3638
+ injectedStyles: `
3639
+ ${getCss({
3640
+ cssCode: props.cssCode,
3641
+ contentId: props.contentId
3642
+ })}
3643
+ ${getFontCss({
3644
+ customFonts: props.customFonts
3645
+ })}
3646
+
3647
+ .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
3648
+ margin: 0;
3649
+ }
3650
+ .builder-text > p, .builder-text > .builder-paragraph {
3651
+ color: inherit;
3652
+ line-height: inherit;
3653
+ letter-spacing: inherit;
3654
+ font-weight: inherit;
3655
+ font-size: inherit;
3656
+ text-align: inherit;
3657
+ font-family: inherit;
3658
+ }
3659
+ `.trim()
3660
+ });
3661
+ return /* @__PURE__ */ _jsxC(InlinedStyles, {
3662
+ get styles() {
3663
+ return state.injectedStyles;
3664
+ },
3665
+ [_IMMUTABLE]: {
3666
+ styles: _fnSignal((p0) => p0.injectedStyles, [
3667
+ state
3668
+ ], "p0.injectedStyles")
3669
+ }
3670
+ }, 3, "8O_0");
3671
+ }, "ContentStyles_component_Qbhu1myPWm0"));
3672
+ const getContextStateInitialValue = ({ content, data, locale }) => {
3673
+ var _a, _b, _c;
3674
+ const defaultValues = {};
3675
+ (_b = (_a = content == null ? void 0 : content.data) == null ? void 0 : _a.inputs) == null ? void 0 : _b.forEach((input) => {
3676
+ var _a2;
3677
+ if (input.name && input.defaultValue !== void 0 && ((_a2 = content == null ? void 0 : content.data) == null ? void 0 : _a2.state) && content.data.state[input.name] === void 0)
3678
+ defaultValues[input.name] = input.defaultValue;
3679
+ });
3680
+ const stateToUse = {
3681
+ ...(_c = content == null ? void 0 : content.data) == null ? void 0 : _c.state,
3682
+ ...data,
3683
+ ...locale ? {
3684
+ locale
3685
+ } : {}
3686
+ };
3687
+ return {
3688
+ ...defaultValues,
3689
+ ...stateToUse
3690
+ };
3691
+ };
3692
+ const getContentInitialValue = ({ content, data }) => {
3693
+ return !content ? void 0 : {
3694
+ ...content,
3695
+ data: {
3696
+ ...content == null ? void 0 : content.data,
3697
+ ...data
3698
+ },
3699
+ meta: content == null ? void 0 : content.meta
3700
+ };
3701
+ };
3702
+ const ContentComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3703
+ var _a, _b;
3704
+ _jsxBranch();
3705
+ const state = useStore({
3706
+ builderContextSignal: {
3707
+ content: getContentInitialValue({
3708
+ content: props.content,
3709
+ data: props.data
3710
+ }),
3711
+ localState: void 0,
3712
+ rootState: getContextStateInitialValue({
3713
+ content: props.content,
3714
+ data: props.data,
3715
+ locale: props.locale
3716
+ }),
3717
+ rootSetState: void 0,
3718
+ context: props.context || {},
3719
+ apiKey: props.apiKey,
3720
+ apiVersion: props.apiVersion,
3721
+ componentInfos: [
3722
+ ...getDefaultRegisteredComponents(),
3723
+ // While this `components` object is deprecated, we must maintain support for it.
3724
+ // Since users are able to override our default components, we need to make sure that we do not break such
3725
+ // existing usage.
3726
+ // This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
3727
+ // which is the new standard way of providing custom components, and must therefore take precedence.
3728
+ ...components,
3729
+ ...props.customComponents || []
3730
+ ].reduce((acc, { component: _, ...info }) => ({
3731
+ ...acc,
3732
+ [info.name]: serializeComponentInfo(info)
3733
+ }), {}),
3734
+ inheritedStyles: {}
3735
+ },
3736
+ registeredComponents: [
3737
+ ...getDefaultRegisteredComponents(),
3738
+ // While this `components` object is deprecated, we must maintain support for it.
3739
+ // Since users are able to override our default components, we need to make sure that we do not break such
3740
+ // existing usage.
3741
+ // This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
3742
+ // which is the new standard way of providing custom components, and must therefore take precedence.
3743
+ ...components,
3744
+ ...props.customComponents || []
3745
+ ].reduce((acc, { component, ...info }) => ({
3746
+ ...acc,
3747
+ [info.name]: {
3748
+ component,
3749
+ ...serializeComponentInfo(info)
3750
+ }
3751
+ }), {}),
3752
+ scriptStr: getRenderContentScriptString({
3753
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
3754
+ variationId: (_a = props.content) == null ? void 0 : _a.testVariationId,
3755
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
3756
+ contentId: (_b = props.content) == null ? void 0 : _b.id
3757
+ })
3758
+ }, {
3759
+ deep: true
3760
+ });
3761
+ useContextProvider(ComponentsContext, useStore({
3762
+ registeredComponents: state.registeredComponents
3763
+ }));
3764
+ return /* @__PURE__ */ _jsxC(EnableEditor, {
3765
+ get content() {
3766
+ return props.content;
3767
+ },
3768
+ get model() {
3769
+ return props.model;
3770
+ },
3771
+ get context() {
3772
+ return props.context;
3773
+ },
3774
+ get apiKey() {
3775
+ return props.apiKey;
3776
+ },
3777
+ get canTrack() {
3778
+ return props.canTrack;
3779
+ },
3780
+ get locale() {
3781
+ return props.locale;
3782
+ },
3783
+ get includeRefs() {
3784
+ return props.includeRefs;
3785
+ },
3786
+ get enrich() {
3787
+ return props.enrich;
3788
+ },
3789
+ get classNameProp() {
3790
+ return props.classNameProp;
3791
+ },
3792
+ get showContent() {
3793
+ return props.showContent;
3794
+ },
3795
+ get builderContextSignal() {
3796
+ return state.builderContextSignal;
3797
+ },
3798
+ children: [
3799
+ props.isSsrAbTest ? /* @__PURE__ */ _jsxC(InlinedScript, {
3800
+ get scriptStr() {
3801
+ return state.scriptStr;
3802
+ },
3803
+ [_IMMUTABLE]: {
3804
+ scriptStr: _fnSignal((p0) => p0.scriptStr, [
3805
+ state
3806
+ ], "p0.scriptStr")
3807
+ }
3808
+ }, 3, "LQ_0") : null,
3809
+ /* @__PURE__ */ _jsxC(ContentStyles, {
3810
+ get contentId() {
3811
+ var _a2;
3812
+ return (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.id;
3813
+ },
3814
+ get cssCode() {
3815
+ var _a2, _b2;
3816
+ return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cssCode;
3817
+ },
3818
+ get customFonts() {
3819
+ var _a2, _b2;
3820
+ return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
3821
+ },
3822
+ [_IMMUTABLE]: {
3823
+ contentId: _fnSignal((p0) => {
3824
+ var _a2;
3825
+ return (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.id;
3826
+ }, [
3827
+ state
3828
+ ], "p0.builderContextSignal.content?.id"),
3829
+ cssCode: _fnSignal((p0) => {
3830
+ var _a2, _b2;
3831
+ return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.cssCode;
3832
+ }, [
3833
+ state
3834
+ ], "p0.builderContextSignal.content?.data?.cssCode"),
3835
+ customFonts: _fnSignal((p0) => {
3836
+ var _a2, _b2;
3837
+ return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.customFonts;
3838
+ }, [
3839
+ state
3840
+ ], "p0.builderContextSignal.content?.data?.customFonts")
3841
+ }
3842
+ }, 3, "LQ_1"),
3843
+ /* @__PURE__ */ _jsxC(Blocks, {
3844
+ get blocks() {
3845
+ var _a2, _b2;
3846
+ return (_b2 = (_a2 = state.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.blocks;
3847
+ },
3848
+ get context() {
3849
+ return state.builderContextSignal;
3850
+ },
3851
+ get registeredComponents() {
3852
+ return state.registeredComponents;
3853
+ },
3854
+ [_IMMUTABLE]: {
3855
+ blocks: _fnSignal((p0) => {
3856
+ var _a2, _b2;
3857
+ return (_b2 = (_a2 = p0.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.blocks;
3858
+ }, [
3859
+ state
3860
+ ], "p0.builderContextSignal.content?.data?.blocks"),
3861
+ context: _fnSignal((p0) => p0.builderContextSignal, [
3862
+ state
3863
+ ], "p0.builderContextSignal"),
3864
+ registeredComponents: _fnSignal((p0) => p0.registeredComponents, [
3865
+ state
3866
+ ], "p0.registeredComponents")
3867
+ }
3868
+ }, 3, "LQ_2")
3869
+ ],
3870
+ [_IMMUTABLE]: {
3871
+ apiKey: _fnSignal((p0) => p0.apiKey, [
3872
+ props
3873
+ ], "p0.apiKey"),
3874
+ builderContextSignal: _fnSignal((p0) => p0.builderContextSignal, [
3875
+ state
3876
+ ], "p0.builderContextSignal"),
3877
+ canTrack: _fnSignal((p0) => p0.canTrack, [
3878
+ props
3879
+ ], "p0.canTrack"),
3880
+ classNameProp: _fnSignal((p0) => p0.classNameProp, [
3881
+ props
3882
+ ], "p0.classNameProp"),
3883
+ content: _fnSignal((p0) => p0.content, [
3884
+ props
3885
+ ], "p0.content"),
3886
+ context: _fnSignal((p0) => p0.context, [
3887
+ props
3888
+ ], "p0.context"),
3889
+ enrich: _fnSignal((p0) => p0.enrich, [
3890
+ props
3891
+ ], "p0.enrich"),
3892
+ includeRefs: _fnSignal((p0) => p0.includeRefs, [
3893
+ props
3894
+ ], "p0.includeRefs"),
3895
+ locale: _fnSignal((p0) => p0.locale, [
3896
+ props
3897
+ ], "p0.locale"),
3898
+ model: _fnSignal((p0) => p0.model, [
3899
+ props
3900
+ ], "p0.model"),
3901
+ showContent: _fnSignal((p0) => p0.showContent, [
3902
+ props
3903
+ ], "p0.showContent")
3904
+ }
3905
+ }, 1, "LQ_3");
3906
+ }, "ContentComponent_component_HIsczUcxjCE"));
3907
+ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
3908
+ _jsxBranch();
3909
+ const state = useStore({
3910
+ shouldRenderVariants: checkShouldRunVariants({
3911
+ canTrack: getDefaultCanTrack(props.canTrack),
3912
+ content: props.content
3913
+ })
3914
+ });
3915
+ const variantScriptStr = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
3916
+ var _a;
3917
+ const [props2] = useLexicalScope();
3918
+ return getVariantsScriptString(getVariants(props2.content).map((value) => ({
3919
+ id: value.testVariationId,
3920
+ testRatio: value.testRatio
3921
+ })), ((_a = props2.content) == null ? void 0 : _a.id) || "");
3922
+ }, "ContentVariants_component_variantScriptStr_useComputed_ldWqWafT8Ww", [
3923
+ props
3924
+ ]));
3925
+ const hideVariantsStyleString = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
3926
+ const [props2] = useLexicalScope();
3927
+ return getVariants(props2.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
3928
+ }, "ContentVariants_component_hideVariantsStyleString_useComputed_fQIC0fJqAl4", [
3929
+ props
3930
+ ]));
3931
+ const defaultContent = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
3932
+ var _a;
3933
+ const [props2, state2] = useLexicalScope();
3934
+ return state2.shouldRenderVariants ? {
3935
+ ...props2.content,
3936
+ testVariationId: (_a = props2.content) == null ? void 0 : _a.id
3937
+ } : handleABTestingSync({
3938
+ item: props2.content,
3939
+ canTrack: getDefaultCanTrack(props2.canTrack)
3940
+ });
3941
+ }, "ContentVariants_component_defaultContent_useComputed_00q2HQsQPYc", [
3942
+ props,
3943
+ state
3944
+ ]));
3945
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
3946
+ }, "ContentVariants_component_useVisibleTask_10cWAqcJ45I"));
3947
+ return /* @__PURE__ */ _jsxC(Fragment$1, {
3948
+ children: [
3949
+ !props.__isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(InlinedScript, {
3950
+ get scriptStr() {
3951
+ return getScriptString();
3952
+ },
3953
+ [_IMMUTABLE]: {
3954
+ scriptStr: _IMMUTABLE
3955
+ }
3956
+ }, 3, "XM_0") : null,
3957
+ state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment, {
3958
+ children: [
3959
+ /* @__PURE__ */ _jsxC(InlinedStyles, {
3960
+ get id() {
3961
+ var _a;
3962
+ return `variants-styles-${(_a = props.content) == null ? void 0 : _a.id}`;
3963
+ },
3964
+ get styles() {
3965
+ return hideVariantsStyleString.value;
3966
+ },
3967
+ [_IMMUTABLE]: {
3968
+ id: _fnSignal((p0) => {
3969
+ var _a;
3970
+ return `variants-styles-${(_a = p0.content) == null ? void 0 : _a.id}`;
3971
+ }, [
3972
+ props
3973
+ ], "`variants-styles-${p0.content?.id}`"),
3974
+ styles: _fnSignal((p0) => p0.value, [
3975
+ hideVariantsStyleString
3976
+ ], "p0.value")
3977
+ }
3978
+ }, 3, "XM_1"),
3979
+ /* @__PURE__ */ _jsxC(InlinedScript, {
3980
+ get scriptStr() {
3981
+ return variantScriptStr.value;
3982
+ },
3983
+ [_IMMUTABLE]: {
3984
+ scriptStr: _fnSignal((p0) => p0.value, [
3985
+ variantScriptStr
3986
+ ], "p0.value")
3987
+ }
3988
+ }, 3, "XM_2"),
3989
+ (getVariants(props.content) || []).map(function(variant) {
3990
+ return /* @__PURE__ */ _jsxC(ContentComponent, {
3991
+ get content() {
3992
+ return variant;
3993
+ },
3994
+ showContent: false,
3995
+ get classNameProp() {
3996
+ return void 0;
3997
+ },
3998
+ get model() {
3999
+ return props.model;
4000
+ },
4001
+ get data() {
4002
+ return props.data;
4003
+ },
4004
+ get context() {
4005
+ return props.context;
4006
+ },
4007
+ get apiKey() {
4008
+ return props.apiKey;
4009
+ },
4010
+ get apiVersion() {
4011
+ return props.apiVersion;
4012
+ },
4013
+ get customComponents() {
4014
+ return props.customComponents;
4015
+ },
4016
+ get canTrack() {
4017
+ return props.canTrack;
4018
+ },
4019
+ get locale() {
4020
+ return props.locale;
4021
+ },
4022
+ get includeRefs() {
4023
+ return props.includeRefs;
4024
+ },
4025
+ get enrich() {
4026
+ return props.enrich;
4027
+ },
4028
+ get isSsrAbTest() {
4029
+ return state.shouldRenderVariants;
4030
+ },
4031
+ [_IMMUTABLE]: {
4032
+ apiKey: _fnSignal((p0) => p0.apiKey, [
4033
+ props
4034
+ ], "p0.apiKey"),
4035
+ apiVersion: _fnSignal((p0) => p0.apiVersion, [
4036
+ props
4037
+ ], "p0.apiVersion"),
4038
+ canTrack: _fnSignal((p0) => p0.canTrack, [
4039
+ props
4040
+ ], "p0.canTrack"),
4041
+ classNameProp: _IMMUTABLE,
4042
+ content: _IMMUTABLE,
4043
+ context: _fnSignal((p0) => p0.context, [
4044
+ props
4045
+ ], "p0.context"),
4046
+ customComponents: _fnSignal((p0) => p0.customComponents, [
4047
+ props
4048
+ ], "p0.customComponents"),
4049
+ data: _fnSignal((p0) => p0.data, [
4050
+ props
4051
+ ], "p0.data"),
4052
+ enrich: _fnSignal((p0) => p0.enrich, [
4053
+ props
4054
+ ], "p0.enrich"),
4055
+ includeRefs: _fnSignal((p0) => p0.includeRefs, [
4056
+ props
4057
+ ], "p0.includeRefs"),
4058
+ isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
4059
+ state
4060
+ ], "p0.shouldRenderVariants"),
4061
+ locale: _fnSignal((p0) => p0.locale, [
4062
+ props
4063
+ ], "p0.locale"),
4064
+ model: _fnSignal((p0) => p0.model, [
4065
+ props
4066
+ ], "p0.model"),
4067
+ showContent: _IMMUTABLE
4068
+ }
4069
+ }, 3, variant.testVariationId);
4070
+ })
4071
+ ]
4072
+ }, 1, "XM_3") : null,
4073
+ /* @__PURE__ */ _jsxC(ContentComponent, {
4074
+ get content() {
4075
+ return defaultContent.value;
4076
+ },
4077
+ get classNameProp() {
4078
+ var _a;
4079
+ return `variant-${(_a = props.content) == null ? void 0 : _a.id}`;
4080
+ },
4081
+ showContent: true,
4082
+ get model() {
4083
+ return props.model;
4084
+ },
4085
+ get data() {
4086
+ return props.data;
4087
+ },
4088
+ get context() {
4089
+ return props.context;
4090
+ },
4091
+ get apiKey() {
4092
+ return props.apiKey;
4093
+ },
4094
+ get apiVersion() {
4095
+ return props.apiVersion;
4096
+ },
4097
+ get customComponents() {
4098
+ return props.customComponents;
4099
+ },
4100
+ get canTrack() {
4101
+ return props.canTrack;
4102
+ },
4103
+ get locale() {
4104
+ return props.locale;
4105
+ },
4106
+ get includeRefs() {
4107
+ return props.includeRefs;
4108
+ },
4109
+ get enrich() {
4110
+ return props.enrich;
4111
+ },
4112
+ get isSsrAbTest() {
4113
+ return state.shouldRenderVariants;
4114
+ },
4115
+ [_IMMUTABLE]: {
4116
+ apiKey: _fnSignal((p0) => p0.apiKey, [
4117
+ props
4118
+ ], "p0.apiKey"),
4119
+ apiVersion: _fnSignal((p0) => p0.apiVersion, [
4120
+ props
4121
+ ], "p0.apiVersion"),
4122
+ canTrack: _fnSignal((p0) => p0.canTrack, [
4123
+ props
4124
+ ], "p0.canTrack"),
4125
+ classNameProp: _fnSignal((p0) => {
4126
+ var _a;
4127
+ return `variant-${(_a = p0.content) == null ? void 0 : _a.id}`;
4128
+ }, [
4129
+ props
4130
+ ], "`variant-${p0.content?.id}`"),
4131
+ content: _fnSignal((p0) => p0.value, [
4132
+ defaultContent
4133
+ ], "p0.value"),
4134
+ context: _fnSignal((p0) => p0.context, [
4135
+ props
4136
+ ], "p0.context"),
4137
+ customComponents: _fnSignal((p0) => p0.customComponents, [
4138
+ props
4139
+ ], "p0.customComponents"),
4140
+ data: _fnSignal((p0) => p0.data, [
4141
+ props
4142
+ ], "p0.data"),
4143
+ enrich: _fnSignal((p0) => p0.enrich, [
4144
+ props
4145
+ ], "p0.enrich"),
4146
+ includeRefs: _fnSignal((p0) => p0.includeRefs, [
4147
+ props
4148
+ ], "p0.includeRefs"),
4149
+ isSsrAbTest: _fnSignal((p0) => p0.shouldRenderVariants, [
4150
+ state
4151
+ ], "p0.shouldRenderVariants"),
4152
+ locale: _fnSignal((p0) => p0.locale, [
4153
+ props
4154
+ ], "p0.locale"),
4155
+ model: _fnSignal((p0) => p0.model, [
4156
+ props
4157
+ ], "p0.model"),
4158
+ showContent: _IMMUTABLE
4159
+ }
4160
+ }, 3, "XM_4")
4161
+ ]
4162
+ }, 1, "XM_5");
4163
+ }, "ContentVariants_component_4tFRiQMMEfM"));
4164
+ const fetchContent = async ({ builderContextValue, symbol }) => {
4165
+ if ((symbol == null ? void 0 : symbol.model) && // This is a hack, we should not need to check for this, but it is needed for Svelte.
4166
+ (builderContextValue == null ? void 0 : builderContextValue.apiKey))
4167
+ return getContent({
4168
+ model: symbol.model,
4169
+ apiKey: builderContextValue.apiKey,
4170
+ apiVersion: builderContextValue.apiVersion,
4171
+ ...(symbol == null ? void 0 : symbol.entry) && {
4172
+ query: {
4173
+ id: symbol.entry
4174
+ }
4175
+ }
4176
+ }).catch((err) => {
4177
+ logger.error("Could not fetch symbol content: ", err);
4178
+ return void 0;
4179
+ });
4180
+ return void 0;
4181
+ };
4182
+ const setContent = function setContent2(props, state) {
4183
+ if (state.contentToUse)
4184
+ return;
4185
+ fetchContent({
4186
+ symbol: props.symbol,
4187
+ builderContextValue: props.builderContext
4188
+ }).then((newContent) => {
4189
+ if (newContent)
4190
+ state.contentToUse = newContent;
4191
+ });
4192
+ };
4193
+ const Symbol$1 = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
4194
+ var _a;
4195
+ const className = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
4196
+ var _a2, _b;
4197
+ const [props2] = useLexicalScope();
4198
+ return [
4199
+ props2.attributes.class,
4200
+ "builder-symbol",
4201
+ ((_a2 = props2.symbol) == null ? void 0 : _a2.inline) ? "builder-inline-symbol" : void 0,
4202
+ ((_b = props2.symbol) == null ? void 0 : _b.dynamic) || props2.dynamic ? "builder-dynamic-symbol" : void 0
4203
+ ].filter(Boolean).join(" ");
4204
+ }, "Symbol_component_className_useComputed_Wb6GqgtDHpE", [
4205
+ props
4206
+ ]));
4207
+ const state = useStore({
4208
+ contentToUse: (_a = props.symbol) == null ? void 0 : _a.content
4209
+ });
4210
+ useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
4211
+ const [props2, state2] = useLexicalScope();
4212
+ setContent(props2, state2);
4213
+ }, "Symbol_component_useVisibleTask_oMPs8W5ZhwE", [
4214
+ props,
4215
+ state
4216
+ ]));
4217
+ useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
4218
+ const [props2, state2] = useLexicalScope();
4219
+ track2(() => props2.symbol);
4220
+ setContent(props2, state2);
4221
+ }, "Symbol_component_useTask_NIAWAC1bMBo", [
4222
+ props,
4223
+ state
4224
+ ]));
4225
+ return /* @__PURE__ */ _jsxS("div", {
4226
+ ...props.attributes,
4227
+ children: /* @__PURE__ */ _jsxC(ContentVariants, {
4228
+ get apiVersion() {
4229
+ return props.builderContext.apiVersion;
4230
+ },
4231
+ get apiKey() {
4232
+ return props.builderContext.apiKey;
4233
+ },
4234
+ get context() {
4235
+ return props.builderContext.context;
4236
+ },
4237
+ get customComponents() {
4238
+ return Object.values(props.builderComponents);
4239
+ },
4240
+ get data() {
4241
+ var _a2, _b, _c;
4242
+ return {
4243
+ ...(_a2 = props.symbol) == null ? void 0 : _a2.data,
4244
+ ...props.builderContext.localState,
4245
+ ...(_c = (_b = state.contentToUse) == null ? void 0 : _b.data) == null ? void 0 : _c.state
4246
+ };
4247
+ },
4248
+ get model() {
4249
+ var _a2;
4250
+ return (_a2 = props.symbol) == null ? void 0 : _a2.model;
4251
+ },
4252
+ get content() {
4253
+ return state.contentToUse;
4254
+ },
4255
+ [_IMMUTABLE]: {
4256
+ apiKey: _fnSignal((p0) => p0.builderContext.apiKey, [
4257
+ props
4258
+ ], "p0.builderContext.apiKey"),
4259
+ apiVersion: _fnSignal((p0) => p0.builderContext.apiVersion, [
4260
+ props
4261
+ ], "p0.builderContext.apiVersion"),
4262
+ content: _fnSignal((p0) => p0.contentToUse, [
4263
+ state
4264
+ ], "p0.contentToUse"),
4265
+ context: _fnSignal((p0) => p0.builderContext.context, [
4266
+ props
4267
+ ], "p0.builderContext.context"),
4268
+ customComponents: _fnSignal((p0) => Object.values(p0.builderComponents), [
4269
+ props
4270
+ ], "Object.values(p0.builderComponents)"),
4271
+ data: _fnSignal((p0, p1) => {
4272
+ var _a2, _b, _c;
4273
+ return {
4274
+ ...(_a2 = p0.symbol) == null ? void 0 : _a2.data,
4275
+ ...p0.builderContext.localState,
4276
+ ...(_c = (_b = p1.contentToUse) == null ? void 0 : _b.data) == null ? void 0 : _c.state
4277
+ };
4278
+ }, [
4279
+ props,
4280
+ state
4281
+ ], "{...p0.symbol?.data,...p0.builderContext.localState,...p1.contentToUse?.data?.state}"),
4282
+ model: _fnSignal((p0) => {
4283
+ var _a2;
4284
+ return (_a2 = p0.symbol) == null ? void 0 : _a2.model;
4285
+ }, [
4286
+ props
4287
+ ], "p0.symbol?.model")
4288
+ }
4289
+ }, 3, "Wt_0")
4290
+ }, {
4291
+ class: _fnSignal((p0) => p0.value, [
4292
+ className
4293
+ ], "p0.value")
4294
+ }, 0, "Wt_1");
4295
+ }, "Symbol_component_WVvggdkUPdk"));
4296
+ const settings = {};
4297
+ function setEditorSettings(newSettings) {
4298
+ if (isBrowser()) {
4299
+ Object.assign(settings, newSettings);
4300
+ const message = {
4301
+ type: "builder.settingsChange",
4302
+ data: settings
4303
+ };
4304
+ parent.postMessage(message, "*");
4305
+ }
4306
+ }
4
4307
  export {
5
- B as Button,
6
- C as Columns,
7
- F as Fragment,
8
- I as Image,
9
- f as RenderBlocks,
10
- j as RenderContent,
11
- S as Section,
12
- h as Symbol,
13
- T as Text,
14
- V as Video,
15
- c as createRegisterComponentMessage,
16
- g as getAllContent,
17
- e as getBuilderSearchParams,
18
- d as getContent,
19
- i as isEditing,
20
- a as isPreviewing,
21
- p as processContentResult,
22
- r as register,
23
- b as setEditorSettings,
24
- t as track
4308
+ Button,
4309
+ Columns,
4310
+ FragmentComponent as Fragment,
4311
+ Image,
4312
+ Blocks as RenderBlocks,
4313
+ ContentVariants as RenderContent,
4314
+ SectionComponent as Section,
4315
+ Symbol$1 as Symbol,
4316
+ Text,
4317
+ Video,
4318
+ createRegisterComponentMessage,
4319
+ getAllContent,
4320
+ getBuilderSearchParams,
4321
+ getContent,
4322
+ isEditing,
4323
+ isPreviewing,
4324
+ processContentResult,
4325
+ register,
4326
+ setEditorSettings,
4327
+ track
25
4328
  };