@builder.io/sdk-qwik 0.5.8 → 0.6.0

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