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

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