@rulecms/widget-vue 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2050 @@
1
+ var Ke = Object.defineProperty;
2
+ var Ue = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var fe = (e, t, n) => Ue(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { defineComponent as x, reactive as He, watch as Ie, provide as Ge, renderSlot as ne, computed as f, openBlock as m, createElementBlock as v, normalizeStyle as S, normalizeClass as j, createBlock as A, resolveDynamicComponent as O, withCtx as G, createTextVNode as ke, toDisplayString as oe, createCommentVNode as B, Fragment as E, normalizeProps as q, guardReactiveProps as ye, mergeProps as ze, resolveComponent as Ye, renderList as ee, createElementVNode as $, createVNode as qe, ref as _, onMounted as Xe, onBeforeUnmount as De, inject as Ze, unref as D } from "vue";
5
+ const F = "default";
6
+ function xe(e, t) {
7
+ return !(e != null && e.length) || e === F ? t : `${e}/${t}`;
8
+ }
9
+ const Je = `RuleCMS widget: this widget config uses components from the default component library, but no "default" library is registered. The default library is registered by the consumer app: add the RuleCMS default source components package as a direct dependency and register it, e.g. libraries: { default: sourceComponentsModule } (statically imported for SSR) or libraries: { default: () => import('<default source components package>') }. See the @rulecms/widget-vue README.`;
10
+ function me(e) {
11
+ if (!e || typeof e != "object")
12
+ return !1;
13
+ const t = e;
14
+ return !!t.manifest && typeof t.manifest == "object" && !!t.components && typeof t.components == "object" && !Array.isArray(t.components);
15
+ }
16
+ function Qe(e) {
17
+ if (me(e))
18
+ return e;
19
+ const t = e;
20
+ return me(t == null ? void 0 : t.default) ? t.default : null;
21
+ }
22
+ function X(e) {
23
+ return e.usesDefaultLibrary ? [F, ...e.libraryIds] : [...e.libraryIds];
24
+ }
25
+ function ge({ registrations: e, referenced: t }) {
26
+ if (t.usesDefaultLibrary && !(e != null && e[F]))
27
+ throw new Error(Je);
28
+ }
29
+ function et(e) {
30
+ const t = {};
31
+ for (const [n, o] of e) {
32
+ const s = n === F;
33
+ for (const [i, c] of Object.entries(o.components))
34
+ t[s ? i : `${n}/${i}`] = c;
35
+ }
36
+ return { components: t };
37
+ }
38
+ function z() {
39
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
40
+ let s = 0;
41
+ function i(r, l) {
42
+ var y;
43
+ e.get(r) !== l && ((y = l.manifest) != null && y.id && l.manifest.id !== r && console.warn(
44
+ `RuleCMS widget: component library registered as "${r}" declares manifest id "${l.manifest.id}". The registered id wins for resolution.`
45
+ ), e.set(r, l), s += 1);
46
+ }
47
+ function c(r) {
48
+ const l = X(r), y = [...l].sort().join("|"), u = o.get(y);
49
+ if (u && u.loadedVersion === s)
50
+ return u.plugin;
51
+ const d = /* @__PURE__ */ new Map();
52
+ for (const g of l) {
53
+ const C = e.get(g);
54
+ C && d.set(g, C);
55
+ }
56
+ const h = et(d);
57
+ return o.set(y, { loadedVersion: s, plugin: h }), h;
58
+ }
59
+ function p(r) {
60
+ ge(r);
61
+ const { registrations: l, referenced: y } = r;
62
+ for (const u of X(y)) {
63
+ if (e.has(u) || n.has(u))
64
+ continue;
65
+ const d = l == null ? void 0 : l[u];
66
+ if (!d) {
67
+ console.error(
68
+ `RuleCMS widget: no component library registered for libraryId "${u}"; its components will not render.`
69
+ ), n.set(u, new Error(`No registration for libraryId "${u}"`));
70
+ continue;
71
+ }
72
+ if (typeof d == "function")
73
+ return null;
74
+ i(u, d);
75
+ }
76
+ return c(y);
77
+ }
78
+ async function a(r) {
79
+ ge(r);
80
+ const { registrations: l, referenced: y } = r, u = X(y);
81
+ return await Promise.all(
82
+ u.map(async (d) => {
83
+ if (e.has(d) || n.has(d))
84
+ return;
85
+ const h = l == null ? void 0 : l[d];
86
+ if (!h) {
87
+ console.error(
88
+ `RuleCMS widget: no component library registered for libraryId "${d}"; its components will not render.`
89
+ ), n.set(d, new Error(`No registration for libraryId "${d}"`));
90
+ return;
91
+ }
92
+ if (typeof h != "function") {
93
+ i(d, h);
94
+ return;
95
+ }
96
+ let g = t.get(d);
97
+ g || (g = h().then((C) => {
98
+ const w = Qe(C);
99
+ if (!w)
100
+ throw new Error(
101
+ `Registration for libraryId "${d}" did not resolve to a ComponentLibraryModule (expected { manifest, components }).`
102
+ );
103
+ i(d, w);
104
+ }).catch((C) => {
105
+ n.set(d, C), console.error(
106
+ `RuleCMS widget: failed to load component library "${d}":`,
107
+ C
108
+ );
109
+ }).finally(() => {
110
+ t.delete(d);
111
+ }), t.set(d, g)), await g;
112
+ })
113
+ ), c(y);
114
+ }
115
+ return { resolveSync: p, resolve: a };
116
+ }
117
+ const xo = {
118
+ Preview: "Preview",
119
+ Compose: "Compose",
120
+ RenderedPage: "RenderedPage"
121
+ }, se = {
122
+ DroppableBox: "droppable-box"
123
+ }, he = {
124
+ FlexStart: "flex-start",
125
+ FlexEnd: "flex-end",
126
+ Center: "center",
127
+ SpaceBetween: "space-between",
128
+ SpaceAround: "space-around",
129
+ SpaceEvenly: "space-evenly"
130
+ }, To = {
131
+ FlexStart: "flex-start",
132
+ FlexEnd: "flex-end",
133
+ Center: "center",
134
+ SpaceBetween: "space-between",
135
+ SpaceAround: "space-around",
136
+ SpaceEvenly: "space-evenly",
137
+ Stretch: "stretch"
138
+ }, Z = "cssAttrArray", Po = {
139
+ Phone: "phone",
140
+ Tablet: "tablet",
141
+ Desktop: "desktop"
142
+ }, Te = {
143
+ ComposerComponent: "ComposerWidget",
144
+ Collection: "Collection",
145
+ MoveComponentHandle: "MoveWidgetHandle"
146
+ }, Pe = `${Te.Collection}_`, tt = "dev.", nt = "https://rulecms.com", ot = "https://widget-cache.rulecms.com", st = "/api/v1/c/widget/get", it = "/api/v1/c/dev/widget/get";
147
+ function R(e) {
148
+ return typeof e == "string" && e.startsWith(tt);
149
+ }
150
+ function rt(e, t) {
151
+ return t ? t.replace(/\/$/, "") : R(e) ? nt : ot;
152
+ }
153
+ function Ee({
154
+ publishedKey: e,
155
+ token: t,
156
+ endpoint: n
157
+ }) {
158
+ const o = R(t), s = o ? it : st, i = o ? new URLSearchParams({ widgetKey: e, token: t }) : new URLSearchParams({ publishedKey: e, token: t });
159
+ return `${rt(t, n)}${s}?${i.toString()}`;
160
+ }
161
+ const Eo = ({ id: e, prefix: t }) => `${t}_${e}`, lt = (e) => {
162
+ if (!(e != null && e.length) || !e.includes("_")) {
163
+ console.error(`Invalid drag item id: ${e}. Type does not exist.`);
164
+ return;
165
+ }
166
+ return ct(e);
167
+ }, $e = (e) => e.includes("_"), ct = (e) => {
168
+ const t = e.indexOf("_"), n = e.substring(0, t), o = e.substring(t + 1);
169
+ return {
170
+ prefix: n,
171
+ id: o
172
+ };
173
+ }, Re = (e) => {
174
+ if (!$e(e))
175
+ return;
176
+ const n = lt(e);
177
+ return (n == null ? void 0 : n.prefix) === Te.Collection || console.error(
178
+ "getCollectionIdForCollectionType - Invalid component type: ${componentType}. Invalid prefix type."
179
+ ), n == null ? void 0 : n.id;
180
+ }, $o = (e) => {
181
+ if (!(e != null && e.length)) {
182
+ console.error("getNameAndInstanceIdFromWidgetKey: Missing widget key");
183
+ return;
184
+ }
185
+ const t = e.split("$");
186
+ if (t.length < 2) {
187
+ console.error("getNameAndInstanceIdFromWidgetKey: Invalid widget key format");
188
+ return;
189
+ }
190
+ const n = t[0];
191
+ if (!t[1].includes("@"))
192
+ return { name: n, instanceId: t[1] };
193
+ const s = t[1].split("@");
194
+ return { name: n, instanceId: s[0], parentId: s[1] };
195
+ }, Ro = (e) => {
196
+ if (!(e != null && e.length))
197
+ return { errorMessage: "getNameFromWidgetKey: Missing widget key" };
198
+ const t = e.split("$");
199
+ return t.length < 2 ? { errorMessage: "getNameFromWidgetKey: Invalid widget key format" } : { name: t[0] };
200
+ }, at = (e) => {
201
+ var s, i, c, p;
202
+ if (!e)
203
+ return { error: "getWidgetKeyForCollection: Missing collection" };
204
+ if (!((s = e.name) != null && s.length))
205
+ return { error: "getWidgetKeyForCollection: Missing collection name" };
206
+ const t = (i = e.name) == null ? void 0 : i.trim().toLowerCase();
207
+ if (!((c = e.id) != null && c.length))
208
+ return { error: "getWidgetKeyForCollection: Missing collection id" };
209
+ const o = ((p = e.parentId) == null ? void 0 : p.length) ? `${e.id}@${e.parentId}` : `${e.id}`;
210
+ return { data: `${t}$${o}` };
211
+ }, ut = (e) => {
212
+ var s, i, c, p;
213
+ if (!e)
214
+ return { error: "getWidgetKeyForPublishedCollection: Missing collection" };
215
+ if (!((s = e.name) != null && s.length))
216
+ return { error: "getWidgetKeyForPublishedCollection: Missing collection name" };
217
+ const t = (i = e.name) == null ? void 0 : i.trim().toLowerCase();
218
+ if (!((c = e.publishedKey) != null && c.length))
219
+ return { error: "getWidgetKeyForPublishedCollection: Missing collection publishedKey" };
220
+ const o = ((p = e.parentId) == null ? void 0 : p.length) ? `${e.publishedKey}@${e.parentId}` : `${e.publishedKey}`;
221
+ return { data: `${t}$${o}` };
222
+ }, Lo = (e) => {
223
+ const t = at(e);
224
+ return `${Pe}${t.data}`;
225
+ }, Mo = (e) => {
226
+ const t = ut(e);
227
+ return `${Pe}${t.data}`;
228
+ }, dt = "---", pt = "___";
229
+ function ft(e, t) {
230
+ return `${e}${dt}${t}`;
231
+ }
232
+ function No(e, t, n) {
233
+ return `${ft(e, t)}${pt}${n}`;
234
+ }
235
+ function Wo(e) {
236
+ const t = e.split(".");
237
+ if (t.length !== 3)
238
+ throw new Error(`Invalid version format: ${e}. Expected format: x.y.z`);
239
+ const n = t[0], o = t[1], s = parseInt(t[2], 10);
240
+ if (isNaN(s))
241
+ throw new Error(`Invalid patch version: ${t[2]}. Expected a number.`);
242
+ return `${n}.${o}.${s + 1}`;
243
+ }
244
+ function ie({
245
+ displayItemList: e,
246
+ widgetCollections: t
247
+ }) {
248
+ const n = /* @__PURE__ */ new Set();
249
+ let o = !1;
250
+ const s = (i) => {
251
+ var c, p, a;
252
+ if ((c = i == null ? void 0 : i.rows) != null && c.length) {
253
+ for (const r of i.rows)
254
+ if ((p = r == null ? void 0 : r.columns) != null && p.length)
255
+ for (const l of r.columns)
256
+ l.collection && s(l.collection.collectionRows), !(!l.type || l.type === se.DroppableBox) && ($e(l.type) || (!((a = l.libraryId) != null && a.length) || l.libraryId === F ? o = !0 : n.add(l.libraryId)));
257
+ }
258
+ };
259
+ s(e);
260
+ for (const i of Object.values(t ?? {}))
261
+ s(i == null ? void 0 : i.collectionRows);
262
+ return { libraryIds: Array.from(n), usesDefaultLibrary: o };
263
+ }
264
+ const Le = Symbol("rulecms-widget-context");
265
+ function yt() {
266
+ return {
267
+ token: "",
268
+ endpoint: void 0,
269
+ libraries: void 0,
270
+ libraryRegistry: z()
271
+ };
272
+ }
273
+ const _o = /* @__PURE__ */ x({
274
+ __name: "RuleCMSWidgetProvider",
275
+ props: {
276
+ token: {},
277
+ endpoint: {},
278
+ libraries: {}
279
+ },
280
+ setup(e) {
281
+ const t = e, n = He(yt());
282
+ return Ie(
283
+ () => [t.token, t.endpoint, t.libraries],
284
+ () => {
285
+ n.token = t.token, n.endpoint = t.endpoint, n.libraries = t.libraries;
286
+ },
287
+ { immediate: !0 }
288
+ ), Ge(Le, n), (o, s) => ne(o.$slots, "default");
289
+ }
290
+ }), mt = "1200px", Me = "500px", Ne = "820px", Oo = mt, gt = "rulecms", ht = 1920, bt = {
291
+ f: "auto",
292
+ q: "auto",
293
+ c: "limit"
294
+ }, wt = /^[A-Za-z0-9][A-Za-z0-9._\-/]*$/, Ct = 300, vt = /^[A-Za-z0-9][A-Za-z0-9_-]*$/, At = 100, St = /^https:\/\/[^\s"'()\\<>]+$/, It = 2e3, kt = /^[A-Za-z0-9_,.:\-/]*$/, Dt = 300, xt = (e) => typeof e == "string" && e.length <= Ct && wt.test(e), Tt = (e) => typeof e == "string" && e.length <= At && vt.test(e), Pt = (e) => typeof e == "string" && e.length <= It && St.test(e), Et = (e) => typeof e == "string" && e.length <= Dt && kt.test(e), $t = (e) => Object.entries(e).map(([t, n]) => `${t}_${n}`).join(","), Rt = (e) => {
295
+ const t = {};
296
+ for (const n of e.split(",")) {
297
+ const o = n.trim(), s = o.indexOf("_");
298
+ s <= 0 || (t[o.slice(0, s)] = o.slice(s + 1));
299
+ }
300
+ return t;
301
+ }, Lt = ({
302
+ publicId: e,
303
+ cloudName: t = gt,
304
+ transformations: n,
305
+ width: o = ht
306
+ }) => {
307
+ const s = typeof n == "string" ? Rt(n) : n, i = {
308
+ ...bt,
309
+ ...s,
310
+ w: o
311
+ };
312
+ return encodeURI(
313
+ `https://res.cloudinary.com/${t}/image/upload/${$t(i)}/${e}`
314
+ );
315
+ }, Mt = /^--[A-Za-z0-9_-]+$/, Nt = 200, We = (e) => {
316
+ if (typeof e != "string")
317
+ return !1;
318
+ const t = e.trim();
319
+ return t.length <= Nt && Mt.test(t);
320
+ }, I = (e) => `var(${e.trim()})`, b = (e) => {
321
+ if (typeof e != "object" || e === null || Array.isArray(e))
322
+ return;
323
+ const t = e.cssVariable;
324
+ if (t != null)
325
+ return We(t) ? t.trim() : void 0;
326
+ }, T = (e) => {
327
+ if (typeof e != "object" || e === null || Array.isArray(e))
328
+ return !1;
329
+ const t = e.cssVariable;
330
+ return t == null ? !1 : !We(t);
331
+ }, jo = (e, t) => {
332
+ const n = b(e);
333
+ return n ? { [t]: I(n) } : void 0;
334
+ }, Wt = (e) => {
335
+ if (typeof e != "object" || e === null || Array.isArray(e) || T(e))
336
+ return !1;
337
+ if (b(e))
338
+ return !0;
339
+ const t = e;
340
+ return t.source === "none" ? !0 : t.source === "url" ? Pt(t.url) : t.source === "cloudinary" ? !xt(t.publicId) || t.cloudName !== void 0 && t.cloudName !== null && !Tt(t.cloudName) ? !1 : t.transformations === void 0 || t.transformations === null || Et(t.transformations) : !1;
341
+ }, _t = ["px", "%", "em", "rem", "vh", "vw"], re = ["inherit", "unset"], Ot = ["allSides", "top", "right", "bottom", "left"], L = (e, t = {}) => {
342
+ if (typeof e != "object" || e === null || Array.isArray(e))
343
+ return !1;
344
+ const n = e;
345
+ return T(e) ? !1 : b(e) ? !0 : n.unit === "auto" ? t.allowAuto !== !1 : n.unit === "keyword" ? t.allowKeywords !== !1 && re.includes(n.keyword) : _t.includes(n.unit) ? typeof n.value != "number" || !Number.isFinite(n.value) ? !1 : t.allowNegative !== !1 || n.value >= 0 : !1;
346
+ }, jt = (e, t = {}) => {
347
+ if (typeof e != "object" || e === null || Array.isArray(e))
348
+ return !1;
349
+ const n = e;
350
+ for (const o of Ot) {
351
+ const s = n[o];
352
+ if (s != null && !L(s, t))
353
+ return !1;
354
+ }
355
+ return !0;
356
+ }, Bt = [...re, "transparent", "currentColor"], Ft = /^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/, le = (e) => {
357
+ if (typeof e != "object" || e === null || Array.isArray(e))
358
+ return !1;
359
+ const t = e;
360
+ return T(e) ? !1 : b(e) ? !0 : t.unit === "keyword" ? Bt.includes(t.keyword) : t.unit === "color" ? typeof t.value == "string" && Ft.test(t.value.trim()) : !1;
361
+ }, ce = (e) => {
362
+ const t = b(e);
363
+ return t ? I(t) : "unit" in e ? e.unit === "keyword" ? e.keyword : e.value.trim() : "";
364
+ }, Vt = (e, t) => typeof e == "object" && e !== null && !Array.isArray(e) ? !T(e) && !!b(e) : typeof e != "string" || !e.length ? !1 : t.includes(e) ? !0 : re.includes(e), Kt = [
365
+ 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
366
+ 'Georgia, "Times New Roman", Times, serif',
367
+ "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
368
+ "Arial, Helvetica, sans-serif",
369
+ '"Helvetica Neue", Helvetica, Arial, sans-serif',
370
+ "Verdana, Geneva, sans-serif"
371
+ ], Ut = [
372
+ "normal",
373
+ "bold",
374
+ "100",
375
+ "200",
376
+ "300",
377
+ "400",
378
+ "500",
379
+ "600",
380
+ "700",
381
+ "800",
382
+ "900"
383
+ ], Ht = ["normal", "italic", "oblique"], Gt = [
384
+ "left",
385
+ "center",
386
+ "right",
387
+ "justify",
388
+ "start",
389
+ "end"
390
+ ], zt = [
391
+ "none",
392
+ "underline",
393
+ "line-through",
394
+ "overline"
395
+ ], Yt = [
396
+ "none",
397
+ "uppercase",
398
+ "lowercase",
399
+ "capitalize"
400
+ ], J = [
401
+ "visible",
402
+ "hidden",
403
+ "scroll",
404
+ "auto",
405
+ "clip"
406
+ ], qt = [
407
+ "flex-start",
408
+ "flex-end",
409
+ "center",
410
+ "space-between",
411
+ "space-around",
412
+ "space-evenly"
413
+ ], Xt = [
414
+ "flex-start",
415
+ "flex-end",
416
+ "center",
417
+ "baseline",
418
+ "stretch"
419
+ ], Zt = ["wrap", "nowrap"], Jt = [
420
+ "flex-start",
421
+ "flex-end",
422
+ "center",
423
+ "space-between",
424
+ "space-around",
425
+ "space-evenly",
426
+ "stretch"
427
+ ], Qt = [
428
+ "row",
429
+ "row-reverse",
430
+ "column",
431
+ "column-reverse"
432
+ ], en = ["cover", "contain", "auto"], tn = [
433
+ "center center",
434
+ "center top",
435
+ "center bottom",
436
+ "left center",
437
+ "left top",
438
+ "left bottom",
439
+ "right center",
440
+ "right top",
441
+ "right bottom"
442
+ ], nn = [
443
+ "no-repeat",
444
+ "repeat",
445
+ "repeat-x",
446
+ "repeat-y",
447
+ "space",
448
+ "round"
449
+ ], on = [
450
+ "justifyContent",
451
+ "alignItems",
452
+ "flexWrap",
453
+ "alignContent",
454
+ "flexDirection"
455
+ ], sn = [
456
+ "none",
457
+ "solid",
458
+ "dashed",
459
+ "dotted",
460
+ "double",
461
+ "groove",
462
+ "ridge",
463
+ "inset",
464
+ "outset"
465
+ ], rn = (e) => typeof e == "object" && e !== null && !Array.isArray(e) ? !T(e) && !!b(e) : sn.includes(e), ln = (e) => {
466
+ if (typeof e != "object" || e === null || Array.isArray(e))
467
+ return !1;
468
+ const t = e;
469
+ return T(e) ? !1 : b(e) ? !0 : !(t.width !== void 0 && t.width !== null && !L(t.width, { allowAuto: !1, allowNegative: !1 }) || t.style !== void 0 && t.style !== null && !rn(t.style) || t.color !== void 0 && t.color !== null && !le(t.color));
470
+ }, cn = {
471
+ allowAuto: !1,
472
+ allowKeywords: !1,
473
+ allowNegative: !0
474
+ }, an = {
475
+ allowAuto: !1,
476
+ allowKeywords: !1,
477
+ allowNegative: !1
478
+ }, un = (e) => {
479
+ if (typeof e != "object" || e === null || Array.isArray(e))
480
+ return !1;
481
+ const t = e;
482
+ if (T(e))
483
+ return !1;
484
+ if (b(e))
485
+ return !0;
486
+ for (const n of ["offsetX", "offsetY", "spread"]) {
487
+ const o = t[n];
488
+ if (o != null && !L(o, cn))
489
+ return !1;
490
+ }
491
+ return !(t.blur !== void 0 && t.blur !== null && !L(t.blur, an) || t.color !== void 0 && t.color !== null && !le(t.color) || t.inset !== void 0 && t.inset !== null && typeof t.inset != "boolean");
492
+ }, dn = (e) => e ? e.cssVariable !== void 0 && e.cssVariable !== null || e.offsetX !== void 0 || e.offsetY !== void 0 || e.blur !== void 0 || e.spread !== void 0 || e.color !== void 0 : !1, pn = (e) => {
493
+ if (typeof e != "object" || e === null || Array.isArray(e))
494
+ return !1;
495
+ const t = e;
496
+ return T(e) ? !1 : b(e) ? !0 : t.unit === "number" ? typeof t.value == "number" && Number.isFinite(t.value) && t.value > 0 : L(e, { allowAuto: !1, allowNegative: !1 });
497
+ }, fn = (e) => typeof e == "object" && e !== null && !Array.isArray(e) ? !T(e) && !!b(e) : typeof e == "number" && Number.isFinite(e) && e >= 0 && e <= 1, yn = (e) => {
498
+ if (!Wt(e))
499
+ return {};
500
+ const t = b(e);
501
+ if (t)
502
+ return { backgroundImage: I(t) };
503
+ const n = e;
504
+ return n.source === "none" ? { backgroundImage: "none" } : n.source === "url" ? { backgroundImage: `url("${n.url}")` } : {
505
+ backgroundImage: `url("${Lt({
506
+ publicId: n.publicId,
507
+ cloudName: n.cloudName,
508
+ transformations: n.transformations
509
+ })}")`
510
+ };
511
+ }, M = (e) => {
512
+ const t = b(e);
513
+ return t ? I(t) : "unit" in e ? e.unit === "auto" ? "auto" : e.unit === "keyword" ? e.keyword : `${e.value}${e.unit}` : "";
514
+ }, mn = (e) => {
515
+ if (!ln(e))
516
+ return {};
517
+ const t = b(e);
518
+ if (t)
519
+ return { border: I(t) };
520
+ const n = {};
521
+ if (e.width && (n.borderWidth = M(e.width)), e.style) {
522
+ const o = b(e.style);
523
+ n.borderStyle = o ? I(o) : e.style;
524
+ }
525
+ return e.color && (n.borderColor = ce(e.color)), n;
526
+ }, K = (e) => e ? M(e) : "0px", gn = (e) => {
527
+ if (!un(e) || !dn(e))
528
+ return {};
529
+ const t = b(e);
530
+ if (t)
531
+ return { boxShadow: I(t) };
532
+ const n = [
533
+ K(e.offsetX),
534
+ K(e.offsetY),
535
+ K(e.blur),
536
+ K(e.spread)
537
+ ];
538
+ return e.color && n.push(ce(e.color)), e.inset && n.unshift("inset"), { boxShadow: n.join(" ") };
539
+ }, hn = (e) => `${e.charAt(0).toUpperCase()}${e.slice(1)}`, bn = (e, t) => {
540
+ if (!jt(e))
541
+ return {};
542
+ if (e.allSides)
543
+ return { [t]: M(e.allSides) };
544
+ const n = {};
545
+ for (const o of ["top", "right", "bottom", "left"]) {
546
+ const s = e[o];
547
+ s && (n[`${t}${hn(o)}`] = M(s));
548
+ }
549
+ return n;
550
+ }, wn = (e, t) => le(e) ? { [t]: ce(e) } : {}, Cn = (e, t, n) => {
551
+ if (!Vt(e, n))
552
+ return {};
553
+ const o = b(e);
554
+ return o ? { [t]: I(o) } : { [t]: e };
555
+ }, vn = (e, t, n = {}) => L(e, n) ? { [t]: M(e) } : {}, An = (e) => {
556
+ if (!pn(e))
557
+ return {};
558
+ const t = b(e);
559
+ return t ? { lineHeight: I(t) } : "unit" in e && e.unit === "number" ? { lineHeight: e.value } : { lineHeight: M(e) };
560
+ }, Sn = (e) => {
561
+ if (!fn(e))
562
+ return {};
563
+ const t = b(e);
564
+ return t ? { opacity: I(t) } : { opacity: e };
565
+ }, ae = {
566
+ // Box spacing (4-sided)
567
+ "margin-3-resolutions": { kind: "boxSpacing", cssProperty: "margin" },
568
+ "padding-3-resolutions": { kind: "boxSpacing", cssProperty: "padding" },
569
+ // Border (compound — longhands only)
570
+ "border-3-resolutions": { kind: "border" },
571
+ // Box shadow (compound — offsets, blur, spread, color, inset)
572
+ "box-shadow-3-resolutions": { kind: "boxShadow" },
573
+ // Single length / keyword
574
+ "border-radius-3-resolutions": {
575
+ kind: "length",
576
+ cssProperty: "borderRadius",
577
+ capabilities: { allowAuto: !1, allowNegative: !1 }
578
+ },
579
+ "width-3-resolutions": {
580
+ kind: "length",
581
+ cssProperty: "width",
582
+ capabilities: { allowAuto: !0, allowNegative: !1 }
583
+ },
584
+ "height-3-resolutions": {
585
+ kind: "length",
586
+ cssProperty: "height",
587
+ capabilities: { allowAuto: !0, allowNegative: !1 }
588
+ },
589
+ "min-width-3-resolutions": {
590
+ kind: "length",
591
+ cssProperty: "minWidth",
592
+ capabilities: { allowAuto: !1, allowNegative: !1 }
593
+ },
594
+ "max-width-3-resolutions": {
595
+ kind: "length",
596
+ cssProperty: "maxWidth",
597
+ capabilities: { allowAuto: !1, allowNegative: !1 }
598
+ },
599
+ "min-height-3-resolutions": {
600
+ kind: "length",
601
+ cssProperty: "minHeight",
602
+ capabilities: { allowAuto: !1, allowNegative: !1 }
603
+ },
604
+ "max-height-3-resolutions": {
605
+ kind: "length",
606
+ cssProperty: "maxHeight",
607
+ capabilities: { allowAuto: !1, allowNegative: !1 }
608
+ },
609
+ "gap-3-resolutions": {
610
+ kind: "length",
611
+ cssProperty: "gap",
612
+ capabilities: { allowAuto: !1, allowNegative: !1 }
613
+ },
614
+ // Flex layout — display:flex is derived at render when any of these (not
615
+ // gap alone) is set. See deriveDisplayFlexIfNeeded.
616
+ "justify-content-3-resolutions": {
617
+ kind: "enum",
618
+ cssProperty: "justifyContent",
619
+ allowedValues: qt
620
+ },
621
+ "align-items-3-resolutions": {
622
+ kind: "enum",
623
+ cssProperty: "alignItems",
624
+ allowedValues: Xt
625
+ },
626
+ "flex-wrap-3-resolutions": {
627
+ kind: "enum",
628
+ cssProperty: "flexWrap",
629
+ allowedValues: Zt
630
+ },
631
+ "align-content-3-resolutions": {
632
+ kind: "enum",
633
+ cssProperty: "alignContent",
634
+ allowedValues: Jt
635
+ },
636
+ "flex-direction-3-resolutions": {
637
+ kind: "enum",
638
+ cssProperty: "flexDirection",
639
+ allowedValues: Qt
640
+ },
641
+ // Overflow — shorthand and longhands are independent attributes; when
642
+ // both are set, the browser's cascade decides the effective overflow.
643
+ "overflow-3-resolutions": {
644
+ kind: "enum",
645
+ cssProperty: "overflow",
646
+ allowedValues: J
647
+ },
648
+ "overflow-x-3-resolutions": {
649
+ kind: "enum",
650
+ cssProperty: "overflowX",
651
+ allowedValues: J
652
+ },
653
+ "overflow-y-3-resolutions": {
654
+ kind: "enum",
655
+ cssProperty: "overflowY",
656
+ allowedValues: J
657
+ },
658
+ // Color
659
+ "background-color-3-resolutions": { kind: "color", cssProperty: "backgroundColor" },
660
+ "color-3-resolutions": { kind: "color", cssProperty: "color" },
661
+ // Background image and the painting properties that go with it. Independent
662
+ // attributes rather than one compound value: only the image needs a bespoke
663
+ // leaf, and each is separately per-device.
664
+ "background-image-3-resolutions": { kind: "backgroundImage" },
665
+ "background-size-3-resolutions": {
666
+ kind: "enum",
667
+ cssProperty: "backgroundSize",
668
+ allowedValues: en
669
+ },
670
+ "background-position-3-resolutions": {
671
+ kind: "enum",
672
+ cssProperty: "backgroundPosition",
673
+ allowedValues: tn
674
+ },
675
+ "background-repeat-3-resolutions": {
676
+ kind: "enum",
677
+ cssProperty: "backgroundRepeat",
678
+ allowedValues: nn
679
+ },
680
+ // Opacity (0–1 number)
681
+ "opacity-3-resolutions": { kind: "opacity" },
682
+ // Typography — applied on the column wrapper; text inherits
683
+ "font-family-3-resolutions": {
684
+ kind: "enum",
685
+ cssProperty: "fontFamily",
686
+ allowedValues: Kt
687
+ },
688
+ "font-size-3-resolutions": {
689
+ kind: "length",
690
+ cssProperty: "fontSize",
691
+ capabilities: { allowAuto: !1, allowNegative: !1 }
692
+ },
693
+ "font-weight-3-resolutions": {
694
+ kind: "enum",
695
+ cssProperty: "fontWeight",
696
+ allowedValues: Ut
697
+ },
698
+ "font-style-3-resolutions": {
699
+ kind: "enum",
700
+ cssProperty: "fontStyle",
701
+ allowedValues: Ht
702
+ },
703
+ "line-height-3-resolutions": { kind: "lineHeight" },
704
+ "letter-spacing-3-resolutions": {
705
+ kind: "length",
706
+ cssProperty: "letterSpacing",
707
+ capabilities: { allowAuto: !1, allowNegative: !0 }
708
+ },
709
+ "text-align-3-resolutions": {
710
+ kind: "enum",
711
+ cssProperty: "textAlign",
712
+ allowedValues: Gt
713
+ },
714
+ "text-decoration-3-resolutions": {
715
+ kind: "enum",
716
+ cssProperty: "textDecoration",
717
+ allowedValues: zt
718
+ },
719
+ "text-transform-3-resolutions": {
720
+ kind: "enum",
721
+ cssProperty: "textTransform",
722
+ allowedValues: Yt
723
+ }
724
+ }, In = (e, t) => {
725
+ const n = ae[e];
726
+ if (!n)
727
+ return {};
728
+ switch (n.kind) {
729
+ case "boxSpacing":
730
+ return bn(t, n.cssProperty);
731
+ case "length":
732
+ return vn(t, n.cssProperty, n.capabilities);
733
+ case "border":
734
+ return mn(t);
735
+ case "boxShadow":
736
+ return gn(t);
737
+ case "color":
738
+ return wn(t, n.cssProperty);
739
+ case "opacity":
740
+ return Sn(t);
741
+ case "enum":
742
+ return Cn(t, n.cssProperty, n.allowedValues);
743
+ case "lineHeight":
744
+ return An(t);
745
+ case "backgroundImage":
746
+ return yn(t);
747
+ default:
748
+ return {};
749
+ }
750
+ }, Bo = Object.fromEntries(
751
+ Object.entries(ae).filter(([, e]) => e.kind === "boxSpacing").map(([e, t]) => [
752
+ e,
753
+ t.cssProperty
754
+ ])
755
+ ), kn = (e) => e != null && e !== "", Dn = (e) => e ? !on.some(
756
+ (n) => kn(e[n])
757
+ ) || e.display === "flex" ? e : { ...e, display: "flex" } : {}, xn = ({
758
+ dbEntryType: e,
759
+ libraryId: t,
760
+ sourceComponentsPlugin: n
761
+ }) => {
762
+ if (!(e != null && e.length))
763
+ return;
764
+ const o = n.components[xe(t, e)];
765
+ if (!o || !("defaultAttributeValues" in o))
766
+ return;
767
+ const i = o.defaultAttributeValues;
768
+ if (i != null && i.length)
769
+ return i.reduce((c, p) => ({
770
+ ...c,
771
+ [p.name]: p.defaultValues
772
+ }), {});
773
+ }, N = ({
774
+ deviceDisplayType: e,
775
+ componentAttributes: t
776
+ }) => {
777
+ if (!t)
778
+ return;
779
+ const n = {}, o = {};
780
+ for (const [s, i] of Object.entries(
781
+ t
782
+ )) {
783
+ if (!s.includes("3-resolutions") || !i)
784
+ continue;
785
+ const c = i.all, p = c ?? i[e.toLowerCase()];
786
+ o[s] = p, ae[s] && Object.assign(n, In(s, p));
787
+ }
788
+ return Object.keys(n).length || Object.keys(o).length ? {
789
+ styles: Object.keys(n).length ? n : void 0,
790
+ componentAttributesSpecificToDeviceType: Object.keys(
791
+ o
792
+ ).length ? o : void 0
793
+ } : void 0;
794
+ }, Tn = ({
795
+ defaultAttributes: e,
796
+ userModifiedAttributes: t
797
+ }) => e ? t ? { ...e, ...t } : e : t;
798
+ function H(e) {
799
+ return e.componentAttributes ?? e.widgetAttributes;
800
+ }
801
+ function be({
802
+ col: e,
803
+ deviceDisplayType: t,
804
+ isComposeMode: n,
805
+ sourceComponentsPlugin: o
806
+ }) {
807
+ const s = H(e), i = xn({
808
+ dbEntryType: e.type,
809
+ libraryId: e.libraryId,
810
+ sourceComponentsPlugin: o
811
+ }) || [], c = Tn({
812
+ defaultAttributes: i,
813
+ userModifiedAttributes: s
814
+ }), { styles: p, componentAttributesSpecificToDeviceType: a } = N({
815
+ deviceDisplayType: t,
816
+ componentAttributes: c
817
+ }) || {
818
+ styles: void 0,
819
+ componentAttributesSpecificToDeviceType: void 0
820
+ };
821
+ let r = {};
822
+ const l = {};
823
+ if (p)
824
+ for (const [u, d] of Object.entries(p))
825
+ n && l[u] || (r = {
826
+ ...r,
827
+ [u]: d
828
+ });
829
+ let y = H(e);
830
+ for (const u in a)
831
+ if (u.includes("3-resolutions")) {
832
+ y = {
833
+ ...H(e) || {},
834
+ ...a || {}
835
+ };
836
+ break;
837
+ }
838
+ return {
839
+ componentAttributesBasedOnDevice: y,
840
+ componentStyles: Dn(r)
841
+ };
842
+ }
843
+ const Pn = (e) => {
844
+ const t = (e == null ? void 0 : e.rows) || [];
845
+ for (const n of t)
846
+ if (((n == null ? void 0 : n.columns) || []).length > 0)
847
+ return !0;
848
+ return (e == null ? void 0 : e.containerAttributes) && Object.keys(e.containerAttributes).length > 0;
849
+ }, En = "var(--sl-spacing-x-small)";
850
+ function $n(e) {
851
+ return e != null && e.horizontalAlignment || e != null && e.verticalAlignment || e != null && e.flexWrap || e != null && e.gap || e != null && e.alignContent ? !0 : !!(e != null && e.rowAttributes && Object.keys(e.rowAttributes).length > 0);
852
+ }
853
+ function Rn({
854
+ row: e,
855
+ deviceDisplayType: t
856
+ }) {
857
+ var o;
858
+ const n = N({
859
+ deviceDisplayType: t,
860
+ componentAttributes: e.rowAttributes
861
+ });
862
+ return ((o = n == null ? void 0 : n.componentAttributesSpecificToDeviceType) == null ? void 0 : o["hide-component-3-resolutions"]) === "true";
863
+ }
864
+ function Ln({
865
+ row: e,
866
+ deviceDisplayType: t,
867
+ isComposeMode: n
868
+ }) {
869
+ var d;
870
+ const o = ((d = N({
871
+ deviceDisplayType: t,
872
+ componentAttributes: e.rowAttributes
873
+ })) == null ? void 0 : d.styles) || {}, s = o.justifyContent ?? e.horizontalAlignment ?? he.Center, i = o.alignItems ?? e.verticalAlignment ?? he.Center, c = o.flexDirection ?? "row", p = o.gap ?? e.gap ?? En, a = n ? "nowrap" : o.flexWrap ?? e.flexWrap ?? "nowrap", r = o.alignContent ?? e.alignContent ?? void 0, l = /* @__PURE__ */ new Set([
874
+ "justifyContent",
875
+ "alignItems",
876
+ "flexDirection",
877
+ "gap",
878
+ "flexWrap",
879
+ "alignContent",
880
+ "display"
881
+ ]), y = {};
882
+ for (const [h, g] of Object.entries(o))
883
+ l.has(h) || (y[h] = g);
884
+ const u = {
885
+ display: "flex",
886
+ flexDirection: c,
887
+ gap: p,
888
+ flexWrap: a,
889
+ justifyContent: s,
890
+ alignItems: i,
891
+ ...y
892
+ };
893
+ return r !== void 0 && (u.alignContent = r), u;
894
+ }
895
+ const ue = "css-classes-3-resolutions", Mn = 500, Nn = /[\x00-\x1f\x7f]/g, de = (e) => {
896
+ if (typeof e != "string")
897
+ return;
898
+ const t = /* @__PURE__ */ new Set(), n = [];
899
+ for (const s of e.split(/\s+/)) {
900
+ const i = s.replace(Nn, "");
901
+ i && (t.has(i) || (t.add(i), n.push(i)));
902
+ }
903
+ if (!n.length)
904
+ return;
905
+ let o = "";
906
+ for (const s of n) {
907
+ const i = o ? `${o} ${s}` : s;
908
+ if (i.length > Mn)
909
+ break;
910
+ o = i;
911
+ }
912
+ return o.length ? o : void 0;
913
+ }, _e = "hide-component-3-resolutions", Wn = [
914
+ "width-3-resolutions",
915
+ "min-width-3-resolutions",
916
+ "max-width-3-resolutions",
917
+ "height-3-resolutions",
918
+ "min-height-3-resolutions",
919
+ "max-height-3-resolutions",
920
+ "margin-3-resolutions",
921
+ "padding-3-resolutions",
922
+ "border-3-resolutions",
923
+ "border-radius-3-resolutions",
924
+ "box-shadow-3-resolutions",
925
+ "overflow-3-resolutions",
926
+ "overflow-x-3-resolutions",
927
+ "overflow-y-3-resolutions",
928
+ _e
929
+ ], _n = new Set(
930
+ Wn
931
+ );
932
+ function On({
933
+ containerAttributes: e,
934
+ deviceDisplayType: t
935
+ }) {
936
+ var o;
937
+ const n = N({
938
+ deviceDisplayType: t,
939
+ componentAttributes: e
940
+ });
941
+ return ((o = n == null ? void 0 : n.componentAttributesSpecificToDeviceType) == null ? void 0 : o[_e]) === "true";
942
+ }
943
+ function jn({
944
+ containerAttributes: e,
945
+ deviceDisplayType: t,
946
+ isComposeMode: n
947
+ }) {
948
+ var i;
949
+ if (!e)
950
+ return { styles: {} };
951
+ const o = n ? Object.fromEntries(
952
+ Object.entries(e).filter(
953
+ ([c]) => !_n.has(c)
954
+ )
955
+ ) : e, s = N({
956
+ deviceDisplayType: t,
957
+ componentAttributes: o
958
+ });
959
+ return {
960
+ styles: (s == null ? void 0 : s.styles) ?? {},
961
+ cssClasses: de(
962
+ (i = s == null ? void 0 : s.componentAttributesSpecificToDeviceType) == null ? void 0 : i[ue]
963
+ )
964
+ };
965
+ }
966
+ function Bn(e) {
967
+ return Object.keys(e.styles).length > 0 || !!e.cssClasses;
968
+ }
969
+ const pe = "/";
970
+ function Fn({
971
+ componentProps: e,
972
+ ancestorColumnIds: t,
973
+ columnId: n
974
+ }) {
975
+ if (!e || !n)
976
+ return;
977
+ const o = [...t ?? [], n];
978
+ for (let s = 0; s < o.length; s += 1) {
979
+ const i = o.slice(s).join(pe), c = e[i];
980
+ if (c)
981
+ return c;
982
+ }
983
+ }
984
+ function Vn({
985
+ displayItemList: e,
986
+ widgetCollections: t
987
+ }) {
988
+ const n = [], o = (s, i) => {
989
+ var c;
990
+ if ((c = s == null ? void 0 : s.rows) != null && c.length)
991
+ for (const p of s.rows)
992
+ for (const a of p.columns) {
993
+ if (!a.id || a.type === se.DroppableBox)
994
+ continue;
995
+ const r = Re(a.type);
996
+ if (r != null && r.length) {
997
+ const l = a.collection ?? (t == null ? void 0 : t[r]);
998
+ l && !i.includes(a.id) && o(l.collectionRows, [...i, a.id]);
999
+ continue;
1000
+ }
1001
+ n.push(
1002
+ [...i, a.id].join(pe)
1003
+ );
1004
+ }
1005
+ };
1006
+ return o(e, []), n;
1007
+ }
1008
+ function Kn(e, t) {
1009
+ const n = `${pe}${e}`;
1010
+ return t.some((o) => o === e || o.endsWith(n));
1011
+ }
1012
+ function Un({
1013
+ componentProps: e,
1014
+ displayItemList: t,
1015
+ widgetCollections: n
1016
+ }) {
1017
+ const o = e ? Object.keys(e) : [];
1018
+ if (!o.length)
1019
+ return [];
1020
+ const s = Vn({
1021
+ displayItemList: t,
1022
+ widgetCollections: n
1023
+ });
1024
+ return o.filter((i) => !Kn(i, s));
1025
+ }
1026
+ function Hn({
1027
+ componentProps: e,
1028
+ displayItemList: t,
1029
+ widgetCollections: n,
1030
+ publishedKey: o
1031
+ }) {
1032
+ if (process.env.NODE_ENV === "production")
1033
+ return;
1034
+ const s = Un({
1035
+ componentProps: e,
1036
+ displayItemList: t,
1037
+ widgetCollections: n
1038
+ });
1039
+ s.length && console.warn(
1040
+ `RuleCMSWidget "${o}": componentProps ${s.map((i) => `"${i}"`).join(", ")} ${s.length === 1 ? "matches" : "match"} no component in this widget, so those props were not passed to anything. Keys are column ids from the widget config — the composer's Modify drawer shows the id of the selected component.`
1041
+ );
1042
+ }
1043
+ function Gn(e) {
1044
+ return typeof e == "object" && e !== null && !Array.isArray(e);
1045
+ }
1046
+ function zn(e) {
1047
+ if (e.all !== void 0 && e.all !== null)
1048
+ return !1;
1049
+ const t = e.phone, n = e.tablet, o = e.desktop;
1050
+ return t !== n || t !== o || n !== o;
1051
+ }
1052
+ function we(e) {
1053
+ var t;
1054
+ if (!((t = e == null ? void 0 : e.rows) != null && t.length))
1055
+ return !1;
1056
+ for (const n of e.rows) {
1057
+ if (Ce(n.rowAttributes))
1058
+ return !0;
1059
+ for (const o of n.columns)
1060
+ if (Ce(H(o)))
1061
+ return !0;
1062
+ }
1063
+ return !1;
1064
+ }
1065
+ function Ce(e) {
1066
+ if (!e)
1067
+ return !1;
1068
+ for (const [t, n] of Object.entries(e))
1069
+ if (!(!t.includes("3-resolutions") || !Gn(n))) {
1070
+ if (t === "hide-component-3-resolutions") {
1071
+ const o = n, s = (i) => i === "true" || i === !0;
1072
+ if (s(o.phone) !== s(o.tablet) || s(o.phone) !== s(o.desktop))
1073
+ return !0;
1074
+ continue;
1075
+ }
1076
+ if (zn(n))
1077
+ return !0;
1078
+ }
1079
+ return !1;
1080
+ }
1081
+ function Yn(e, t) {
1082
+ if (we(e))
1083
+ return !0;
1084
+ for (const n of Object.values(t))
1085
+ if (we(n.collectionRows))
1086
+ return !0;
1087
+ return !1;
1088
+ }
1089
+ const Oe = parseInt(Me, 10), je = parseInt(Ne, 10), qn = Oe + 1, Xn = je + 1;
1090
+ function Zn(e) {
1091
+ const t = `.${e}-phone`, n = `.${e}-tablet`, o = `.${e}-desktop`;
1092
+ return `
1093
+ ${t}, ${n}, ${o} { display: none; }
1094
+ @media (max-width: ${Oe}px) { ${t} { display: block; } }
1095
+ @media (min-width: ${qn}px) and (max-width: ${je}px) { ${n} { display: block; } }
1096
+ @media (min-width: ${Xn}px) { ${o} { display: block; } }
1097
+ `.trim();
1098
+ }
1099
+ function Q(e) {
1100
+ if (!e)
1101
+ throw new Error("Source components plugin is required, but no plugins were provided");
1102
+ const t = e.sourceComponents;
1103
+ if (!t)
1104
+ throw new Error("Source components plugin is required, but was not found in plugins object");
1105
+ if (!t.components)
1106
+ throw new Error("Source components plugin is missing required property: components");
1107
+ if (typeof t.components != "object" || t.components === null || Array.isArray(t.components))
1108
+ throw new Error(
1109
+ "Source components plugin components must be an object (Record<string, LibraryComponentEntry>)"
1110
+ );
1111
+ return t;
1112
+ }
1113
+ const Jn = ["hidden"], Qn = /* @__PURE__ */ x({
1114
+ __name: "EmbedInVerticalContainer",
1115
+ props: {
1116
+ displayItemList: {},
1117
+ isComposeMode: { type: Boolean, default: !1 },
1118
+ showDropContainers: { type: Boolean, default: !1 },
1119
+ isWithinCollection: { type: Boolean, default: !1 },
1120
+ deviceDisplayType: { default: "Desktop" }
1121
+ },
1122
+ setup(e) {
1123
+ const t = e;
1124
+ let n = 0;
1125
+ const o = `rulecms-vc-${++n}`;
1126
+ function s(h, g, C) {
1127
+ const w = h && !C ? 3 : 1;
1128
+ return !!(g != null && g.length) && g.length > w;
1129
+ }
1130
+ const i = f(() => {
1131
+ var g;
1132
+ return (((g = t.displayItemList.containerAttributes) == null ? void 0 : g[Z]) || []).join(`;
1133
+ `);
1134
+ }), c = f(
1135
+ () => i.value ? `.${o} {
1136
+ ${i.value}
1137
+ }` : ""
1138
+ ), p = f(
1139
+ () => !t.isComposeMode && On({
1140
+ containerAttributes: t.displayItemList.containerAttributes,
1141
+ deviceDisplayType: t.deviceDisplayType
1142
+ })
1143
+ ), a = f(
1144
+ () => jn({
1145
+ containerAttributes: t.displayItemList.containerAttributes,
1146
+ deviceDisplayType: t.deviceDisplayType,
1147
+ isComposeMode: t.isComposeMode
1148
+ })
1149
+ ), r = f(() => {
1150
+ var C;
1151
+ const h = ((C = t.displayItemList.containerAttributes) == null ? void 0 : C[Z]) || [], g = Bn(a.value);
1152
+ return t.isComposeMode && !t.isWithinCollection || t.showDropContainers || h.length > 0 || g || s(t.isComposeMode, t.displayItemList.rows, t.isWithinCollection);
1153
+ }), l = f(
1154
+ () => [i.value ? o : void 0, a.value.cssClasses].filter(Boolean).join(" ")
1155
+ ), y = f(() => {
1156
+ var g;
1157
+ return {
1158
+ ...(((g = t.displayItemList.containerAttributes) == null ? void 0 : g[Z]) || []).some((C) => C.toLowerCase().startsWith("height:")) ? {} : { height: t.isWithinCollection ? "auto" : "100%" },
1159
+ display: "flex",
1160
+ flexDirection: "column",
1161
+ ...a.value.styles
1162
+ };
1163
+ }), u = f(() => r.value ? l.value : ""), d = f(() => p.value ? { display: "none" } : r.value ? y.value : { display: "contents" });
1164
+ return (h, g) => (m(), v("div", {
1165
+ hidden: p.value || void 0,
1166
+ class: j(u.value || void 0),
1167
+ style: S(d.value)
1168
+ }, [
1169
+ i.value ? (m(), A(O("style"), { key: 0 }, {
1170
+ default: G(() => [
1171
+ ke(oe(c.value), 1)
1172
+ ]),
1173
+ _: 1
1174
+ })) : B("", !0),
1175
+ ne(h.$slots, "default")
1176
+ ], 14, Jn));
1177
+ }
1178
+ }), eo = ["hidden"], to = /* @__PURE__ */ x({
1179
+ __name: "EmbedInRow",
1180
+ props: {
1181
+ row: {},
1182
+ isComposeMode: { type: Boolean, default: !1 },
1183
+ showDropContainers: { type: Boolean, default: !1 },
1184
+ isWithinCollection: { type: Boolean, default: !1 },
1185
+ deviceDisplayType: { default: "Desktop" }
1186
+ },
1187
+ setup(e) {
1188
+ const t = e;
1189
+ function n(r, l, y) {
1190
+ var d;
1191
+ const u = r && !y ? 3 : 1;
1192
+ return !!((d = l == null ? void 0 : l.columns) != null && d.length) && l.columns.length > u;
1193
+ }
1194
+ const o = f(
1195
+ () => !t.isComposeMode && Rn({ row: t.row, deviceDisplayType: t.deviceDisplayType })
1196
+ ), s = f(
1197
+ () => t.showDropContainers || $n(t.row) || n(t.isComposeMode, t.row, t.isWithinCollection)
1198
+ ), i = f(
1199
+ () => Ln({
1200
+ row: t.row,
1201
+ deviceDisplayType: t.deviceDisplayType,
1202
+ isComposeMode: t.isComposeMode
1203
+ })
1204
+ ), c = f(() => {
1205
+ var l;
1206
+ const r = N({
1207
+ deviceDisplayType: t.deviceDisplayType,
1208
+ componentAttributes: t.row.rowAttributes
1209
+ });
1210
+ return de(
1211
+ (l = r == null ? void 0 : r.componentAttributesSpecificToDeviceType) == null ? void 0 : l[ue]
1212
+ ) ?? "";
1213
+ }), p = f(() => s.value ? c.value : ""), a = f(() => o.value ? { display: "none" } : s.value ? i.value : { display: "contents" });
1214
+ return (r, l) => (m(), v("div", {
1215
+ hidden: o.value || void 0,
1216
+ class: j(p.value || void 0),
1217
+ style: S(a.value)
1218
+ }, [
1219
+ ne(r.$slots, "default")
1220
+ ], 14, eo));
1221
+ }
1222
+ }), Be = [
1223
+ "minWidth",
1224
+ "maxWidth",
1225
+ "minHeight",
1226
+ "maxHeight",
1227
+ "margin",
1228
+ "marginTop",
1229
+ "marginRight",
1230
+ "marginBottom",
1231
+ "marginLeft",
1232
+ "padding",
1233
+ "paddingTop",
1234
+ "paddingRight",
1235
+ "paddingBottom",
1236
+ "paddingLeft",
1237
+ "borderWidth",
1238
+ "borderStyle",
1239
+ "borderColor",
1240
+ // Whole-border design token: the one case where the shorthand is emitted
1241
+ "border",
1242
+ "borderRadius",
1243
+ "boxShadow",
1244
+ "width",
1245
+ "height",
1246
+ "gap",
1247
+ // Flex layout (display is derived when any flex layout prop is set)
1248
+ "display",
1249
+ "justifyContent",
1250
+ "alignItems",
1251
+ "flexWrap",
1252
+ "alignContent",
1253
+ "flexDirection",
1254
+ "overflow",
1255
+ "overflowX",
1256
+ "overflowY",
1257
+ "backgroundColor",
1258
+ "backgroundImage",
1259
+ "backgroundSize",
1260
+ "backgroundPosition",
1261
+ "backgroundRepeat",
1262
+ "opacity",
1263
+ // Typography (inherited by text descendants from the column wrapper)
1264
+ "fontFamily",
1265
+ "fontSize",
1266
+ "fontWeight",
1267
+ "fontStyle",
1268
+ "color",
1269
+ "lineHeight",
1270
+ "letterSpacing",
1271
+ "textAlign",
1272
+ "textDecoration",
1273
+ "textTransform"
1274
+ ], no = (e) => e != null && e !== "", oo = (e) => e ? Be.reduce(
1275
+ (t, n) => {
1276
+ const o = e[n];
1277
+ return no(o) && (t[n] = o), t;
1278
+ },
1279
+ {}
1280
+ ) : {}, so = (e) => {
1281
+ if (!e)
1282
+ return;
1283
+ const t = { ...e };
1284
+ for (const n of Be)
1285
+ delete t[n];
1286
+ return Object.keys(t).length ? t : void 0;
1287
+ }, io = (e) => Object.keys(e).length > 0, ro = (e, t) => {
1288
+ const n = (e == null ? void 0 : e.noContainer) ?? !1, o = e == null ? void 0 : e.resolveNoContainer;
1289
+ if (typeof o != "function")
1290
+ return n;
1291
+ try {
1292
+ const s = o(t);
1293
+ if (typeof s == "boolean")
1294
+ return s;
1295
+ console.error(
1296
+ `resolveNoContainer: component "${e == null ? void 0 : e.id}" returned ${typeof s} instead of a boolean; falling back to noContainer=${n}`
1297
+ );
1298
+ } catch (s) {
1299
+ console.error(
1300
+ `resolveNoContainer: component "${e == null ? void 0 : e.id}" threw; falling back to noContainer=${n}`,
1301
+ s
1302
+ );
1303
+ }
1304
+ return n;
1305
+ }, lo = (e, t) => {
1306
+ const n = e == null ? void 0 : e.resolveRendersOwnElement;
1307
+ if (typeof n != "function")
1308
+ return !1;
1309
+ try {
1310
+ const o = n(t);
1311
+ if (typeof o == "boolean")
1312
+ return o;
1313
+ console.error(
1314
+ `resolveRendersOwnElement: component "${e == null ? void 0 : e.id}" returned ${typeof o} instead of a boolean; falling back to false`
1315
+ );
1316
+ } catch (o) {
1317
+ console.error(
1318
+ `resolveRendersOwnElement: component "${e == null ? void 0 : e.id}" threw; falling back to false`,
1319
+ o
1320
+ );
1321
+ }
1322
+ return !1;
1323
+ }, co = /* @__PURE__ */ x({
1324
+ __name: "DisplayComponent",
1325
+ props: {
1326
+ componentType: {},
1327
+ libraryId: {},
1328
+ componentAttributes: {},
1329
+ components: {},
1330
+ styleProps: {},
1331
+ widgetInstanceProps: {}
1332
+ },
1333
+ setup(e) {
1334
+ const t = e, n = f(() => t.components[xe(t.libraryId, t.componentType)]), o = f(() => {
1335
+ var h;
1336
+ const d = (h = n.value) == null ? void 0 : h.card;
1337
+ return d || (console.error(
1338
+ `DisplayComponent: Component with type ${t.componentType}${t.libraryId ? ` (library "${t.libraryId}")` : ""} not found in components`
1339
+ ), null);
1340
+ }), s = f(() => ({
1341
+ componentAttributes: t.componentAttributes,
1342
+ styleProps: t.styleProps
1343
+ })), i = f(
1344
+ () => n.value ? ro(n.value, s.value) : !1
1345
+ ), c = f(() => oo(t.styleProps)), p = f(
1346
+ () => i.value ? so(t.styleProps) : t.styleProps
1347
+ ), a = f(
1348
+ () => {
1349
+ var d;
1350
+ return de((d = t.componentAttributes) == null ? void 0 : d[ue]);
1351
+ }
1352
+ ), r = f(() => i.value && io(c.value)), l = f(
1353
+ () => !i.value || (n.value ? lo(n.value, s.value) : !1)
1354
+ ), y = f(
1355
+ () => !r.value && l.value ? a.value : void 0
1356
+ ), u = f(() => ({
1357
+ componentAttributes: t.componentAttributes,
1358
+ styleProps: p.value,
1359
+ className: y.value,
1360
+ widgetInstanceProps: t.widgetInstanceProps
1361
+ }));
1362
+ return (d, h) => o.value ? (m(), v(E, { key: 0 }, [
1363
+ r.value ? (m(), v("div", {
1364
+ key: 0,
1365
+ class: j(a.value || void 0),
1366
+ style: S(c.value)
1367
+ }, [
1368
+ (m(), A(O(o.value), q(ye(u.value)), null, 16))
1369
+ ], 6)) : !l.value && a.value ? (m(), v("div", {
1370
+ key: 1,
1371
+ class: j(a.value)
1372
+ }, [
1373
+ (m(), A(O(o.value), q(ye(u.value)), null, 16))
1374
+ ], 2)) : (m(), A(O(o.value), q(ze({ key: 2 }, u.value)), null, 16))
1375
+ ], 64)) : B("", !0);
1376
+ }
1377
+ }), ao = /* @__PURE__ */ x({
1378
+ __name: "RenderComponentsInner",
1379
+ props: {
1380
+ displayItemList: {},
1381
+ isComposeMode: { type: Boolean, default: !1 },
1382
+ isWithinCollection: { type: Boolean, default: !1 },
1383
+ widgetCollections: {},
1384
+ showDropContainers: { type: Boolean, default: !1 },
1385
+ reduxDeviceDisplayType: {},
1386
+ plugins: {},
1387
+ deviceDisplayType: {},
1388
+ componentProps: {},
1389
+ ancestorColumnIds: {}
1390
+ },
1391
+ setup(e) {
1392
+ const t = e, n = () => Q(t.plugins).components;
1393
+ function o(a) {
1394
+ if (t.isComposeMode && a.type === se.DroppableBox)
1395
+ return !1;
1396
+ const { componentAttributesBasedOnDevice: r } = be({
1397
+ col: a,
1398
+ deviceDisplayType: t.deviceDisplayType,
1399
+ isComposeMode: t.isComposeMode,
1400
+ sourceComponentsPlugin: Q(t.plugins)
1401
+ }), l = !!r && r["hide-component-3-resolutions"] === "true";
1402
+ return !(!t.isComposeMode && l);
1403
+ }
1404
+ function s(a) {
1405
+ const { componentAttributesBasedOnDevice: r, componentStyles: l } = be({
1406
+ col: a,
1407
+ deviceDisplayType: t.deviceDisplayType,
1408
+ isComposeMode: t.isComposeMode,
1409
+ sourceComponentsPlugin: Q(t.plugins)
1410
+ });
1411
+ return {
1412
+ componentAttributes: r,
1413
+ styleProps: l
1414
+ };
1415
+ }
1416
+ function i(a) {
1417
+ const r = Re(a.type);
1418
+ if (!(r != null && r.length))
1419
+ return null;
1420
+ const l = a.collection ?? t.widgetCollections[r];
1421
+ if (!l)
1422
+ throw new Error(
1423
+ `DisplayCollection - Collection with ID ${r} not found in widgetCollections. Available collections: ${Object.keys(t.widgetCollections).join(", ")}`
1424
+ );
1425
+ return !l.collectionRows || !Pn(l.collectionRows) ? null : l.collectionRows;
1426
+ }
1427
+ function c(a) {
1428
+ return [...t.ancestorColumnIds ?? [], a];
1429
+ }
1430
+ function p(a) {
1431
+ return Fn({
1432
+ componentProps: t.componentProps,
1433
+ ancestorColumnIds: t.ancestorColumnIds,
1434
+ columnId: a
1435
+ });
1436
+ }
1437
+ return (a, r) => {
1438
+ const l = Ye("RenderComponentsInner", !0);
1439
+ return m(), A(Qn, {
1440
+ "display-item-list": e.displayItemList,
1441
+ "is-compose-mode": e.isComposeMode,
1442
+ "show-drop-containers": e.showDropContainers,
1443
+ "is-within-collection": e.isWithinCollection,
1444
+ "device-display-type": e.deviceDisplayType
1445
+ }, {
1446
+ default: G(() => [
1447
+ (m(!0), v(E, null, ee(e.displayItemList.rows, (y) => (m(), A(to, {
1448
+ key: y.id,
1449
+ row: y,
1450
+ "is-compose-mode": e.isComposeMode,
1451
+ "show-drop-containers": e.showDropContainers,
1452
+ "is-within-collection": e.isWithinCollection,
1453
+ "device-display-type": e.deviceDisplayType
1454
+ }, {
1455
+ default: G(() => [
1456
+ (m(!0), v(E, null, ee(y.columns, (u) => (m(), v(E, {
1457
+ key: u.id
1458
+ }, [
1459
+ o(u) ? (m(), v(E, { key: 0 }, [
1460
+ i(u) ? (m(), A(l, {
1461
+ key: 0,
1462
+ "display-item-list": i(u),
1463
+ "is-compose-mode": e.isComposeMode,
1464
+ "is-within-collection": !0,
1465
+ "widget-collections": e.widgetCollections,
1466
+ "show-drop-containers": e.showDropContainers,
1467
+ "redux-device-display-type": e.reduxDeviceDisplayType,
1468
+ plugins: e.plugins,
1469
+ "device-display-type": e.deviceDisplayType,
1470
+ "component-props": e.componentProps,
1471
+ "ancestor-column-ids": c(u.id)
1472
+ }, null, 8, ["display-item-list", "is-compose-mode", "widget-collections", "show-drop-containers", "redux-device-display-type", "plugins", "device-display-type", "component-props", "ancestor-column-ids"])) : (m(), A(co, {
1473
+ key: 1,
1474
+ "component-type": u.type,
1475
+ "library-id": u.libraryId,
1476
+ "component-attributes": s(u).componentAttributes,
1477
+ components: n(),
1478
+ "style-props": s(u).styleProps,
1479
+ "widget-instance-props": p(u.id)
1480
+ }, null, 8, ["component-type", "library-id", "component-attributes", "components", "style-props", "widget-instance-props"]))
1481
+ ], 64)) : B("", !0)
1482
+ ], 64))), 128))
1483
+ ]),
1484
+ _: 2
1485
+ }, 1032, ["row", "is-compose-mode", "show-drop-containers", "is-within-collection", "device-display-type"]))), 128))
1486
+ ]),
1487
+ _: 1
1488
+ }, 8, ["display-item-list", "is-compose-mode", "show-drop-containers", "is-within-collection", "device-display-type"]);
1489
+ };
1490
+ }
1491
+ }), te = /* @__PURE__ */ x({
1492
+ __name: "RenderComponentsForDevice",
1493
+ props: {
1494
+ displayItemList: {},
1495
+ isComposeMode: { type: Boolean },
1496
+ isWithinCollection: { type: Boolean },
1497
+ widgetCollections: {},
1498
+ showDropContainers: { type: Boolean },
1499
+ reduxDeviceDisplayType: {},
1500
+ deviceDisplayType: {},
1501
+ plugins: {},
1502
+ componentProps: {},
1503
+ ancestorColumnIds: {}
1504
+ },
1505
+ setup(e) {
1506
+ return (t, n) => {
1507
+ var o, s;
1508
+ return (s = (o = e.displayItemList) == null ? void 0 : o.rows) != null && s.length ? (m(), A(ao, {
1509
+ key: 0,
1510
+ "display-item-list": e.displayItemList,
1511
+ "is-compose-mode": e.isComposeMode,
1512
+ "is-within-collection": e.isWithinCollection,
1513
+ "widget-collections": e.widgetCollections,
1514
+ "show-drop-containers": e.showDropContainers,
1515
+ "redux-device-display-type": e.reduxDeviceDisplayType,
1516
+ plugins: e.plugins,
1517
+ "device-display-type": e.deviceDisplayType,
1518
+ "component-props": e.componentProps,
1519
+ "ancestor-column-ids": e.ancestorColumnIds
1520
+ }, null, 8, ["display-item-list", "is-compose-mode", "is-within-collection", "widget-collections", "show-drop-containers", "redux-device-display-type", "plugins", "device-display-type", "component-props", "ancestor-column-ids"])) : B("", !0);
1521
+ };
1522
+ }
1523
+ }), uo = /* @__PURE__ */ x({
1524
+ __name: "BreakpointVariantRender",
1525
+ props: {
1526
+ displayItemList: {},
1527
+ widgetCollections: {},
1528
+ plugins: {},
1529
+ componentProps: {},
1530
+ scopeIdInput: {}
1531
+ },
1532
+ setup(e) {
1533
+ const t = ["Phone", "Tablet", "Desktop"];
1534
+ let n = 0;
1535
+ const o = e, s = `rulecms-bp-${++n}`, i = f(() => o.scopeIdInput ?? s), c = f(
1536
+ () => Yn(o.displayItemList, o.widgetCollections)
1537
+ ), p = f(() => Zn(i.value));
1538
+ return (a, r) => c.value ? (m(), v(E, { key: 1 }, [
1539
+ (m(), A(O("style"), null, {
1540
+ default: G(() => [
1541
+ ke(oe(p.value), 1)
1542
+ ]),
1543
+ _: 1
1544
+ })),
1545
+ (m(), v(E, null, ee(t, (l) => $("div", {
1546
+ key: l,
1547
+ class: j(`${i.value}-${l.toLowerCase()}`)
1548
+ }, [
1549
+ qe(te, {
1550
+ "display-item-list": e.displayItemList,
1551
+ "is-compose-mode": !1,
1552
+ "is-within-collection": !1,
1553
+ "widget-collections": e.widgetCollections,
1554
+ "show-drop-containers": !1,
1555
+ "redux-device-display-type": "desktop",
1556
+ "device-display-type": l,
1557
+ plugins: e.plugins,
1558
+ "component-props": e.componentProps
1559
+ }, null, 8, ["display-item-list", "widget-collections", "device-display-type", "plugins", "component-props"])
1560
+ ], 2)), 64))
1561
+ ], 64)) : (m(), A(te, {
1562
+ key: 0,
1563
+ "display-item-list": e.displayItemList,
1564
+ "is-compose-mode": !1,
1565
+ "is-within-collection": !1,
1566
+ "widget-collections": e.widgetCollections,
1567
+ "show-drop-containers": !1,
1568
+ "redux-device-display-type": "desktop",
1569
+ "device-display-type": "Desktop",
1570
+ plugins: e.plugins,
1571
+ "component-props": e.componentProps
1572
+ }, null, 8, ["display-item-list", "widget-collections", "plugins", "component-props"]));
1573
+ }
1574
+ });
1575
+ function po(e, t, n) {
1576
+ if (e)
1577
+ return "Phone";
1578
+ if (t)
1579
+ return "Tablet";
1580
+ const o = (n == null ? void 0 : n.toLowerCase()) || "desktop";
1581
+ return o === "phone" ? "Phone" : o === "tablet" ? "Tablet" : "Desktop";
1582
+ }
1583
+ const fo = `(max-width: ${Me})`, yo = `(max-width: ${Ne})`, mo = /* @__PURE__ */ x({
1584
+ __name: "RenderComponents",
1585
+ props: {
1586
+ displayItemList: {},
1587
+ isComposeMode: { type: Boolean },
1588
+ isWithinCollection: { type: Boolean },
1589
+ widgetCollections: {},
1590
+ showDropContainers: { type: Boolean },
1591
+ reduxDeviceDisplayType: {},
1592
+ plugins: {},
1593
+ componentProps: {}
1594
+ },
1595
+ setup(e) {
1596
+ const t = e, n = _("Desktop");
1597
+ let o, s;
1598
+ function i() {
1599
+ n.value = po(
1600
+ (o == null ? void 0 : o.matches) ?? !1,
1601
+ (s == null ? void 0 : s.matches) ?? !1,
1602
+ t.reduxDeviceDisplayType
1603
+ );
1604
+ }
1605
+ return Xe(() => {
1606
+ typeof matchMedia == "function" && (o = matchMedia(fo), s = matchMedia(yo), o.addEventListener("change", i), s.addEventListener("change", i)), i();
1607
+ }), De(() => {
1608
+ o == null || o.removeEventListener("change", i), s == null || s.removeEventListener("change", i);
1609
+ }), (c, p) => (m(), A(te, {
1610
+ "display-item-list": e.displayItemList,
1611
+ "is-compose-mode": e.isComposeMode,
1612
+ "is-within-collection": e.isWithinCollection,
1613
+ "widget-collections": e.widgetCollections,
1614
+ "show-drop-containers": e.showDropContainers,
1615
+ "redux-device-display-type": e.reduxDeviceDisplayType,
1616
+ "device-display-type": n.value,
1617
+ plugins: e.plugins,
1618
+ "component-props": e.componentProps
1619
+ }, null, 8, ["display-item-list", "is-compose-mode", "is-within-collection", "widget-collections", "show-drop-containers", "redux-device-display-type", "device-display-type", "plugins", "component-props"]));
1620
+ }
1621
+ });
1622
+ function go(e) {
1623
+ const t = {};
1624
+ return Object.entries(e).forEach(([n, o]) => {
1625
+ const s = { ...o };
1626
+ if (s.itemList)
1627
+ try {
1628
+ s.collectionRows = typeof s.itemList == "string" ? JSON.parse(s.itemList) : s.itemList;
1629
+ } catch (c) {
1630
+ console.error(`Failed to parse itemList for collection ${n}:`, c), s.collectionRows = { rows: [] };
1631
+ }
1632
+ let i = `${s.name}$${n}`;
1633
+ s.parentId && (i = `${i}@${s.parentId}`), t[i] = s;
1634
+ }), t;
1635
+ }
1636
+ function ho(e) {
1637
+ return typeof e.itemList == "string" ? JSON.parse(e.itemList) : e.itemList;
1638
+ }
1639
+ function Fe(e) {
1640
+ return {
1641
+ displayItemList: ho(e.widget),
1642
+ widgetCollections: go(e.childCollections),
1643
+ ...e.libraries ? { libraries: e.libraries } : {}
1644
+ };
1645
+ }
1646
+ function bo(e) {
1647
+ const t = e.registry ?? z(), n = ie({
1648
+ displayItemList: e.displayItemList,
1649
+ widgetCollections: e.widgetCollections
1650
+ });
1651
+ return t.resolveSync({ registrations: e.libraries, referenced: n });
1652
+ }
1653
+ function wo(e) {
1654
+ const t = e.registry ?? z(), n = ie({
1655
+ displayItemList: e.displayItemList,
1656
+ widgetCollections: e.widgetCollections
1657
+ });
1658
+ return t.resolve({ registrations: e.libraries, referenced: n });
1659
+ }
1660
+ const Co = {
1661
+ display: "flex",
1662
+ justifyContent: "center",
1663
+ alignItems: "center",
1664
+ padding: "3rem",
1665
+ color: "#e2e8f0"
1666
+ }, vo = {
1667
+ display: "flex",
1668
+ alignItems: "center",
1669
+ gap: "1rem"
1670
+ }, Ao = {
1671
+ width: "40px",
1672
+ height: "40px",
1673
+ border: "4px solid #4a5568",
1674
+ borderTopColor: "#63b3ed",
1675
+ borderRadius: "50%",
1676
+ animation: "spin 1s linear infinite"
1677
+ }, ve = {
1678
+ padding: "1.5rem",
1679
+ backgroundColor: "#742a2a",
1680
+ border: "1px solid #9b2c2c",
1681
+ borderRadius: "8px",
1682
+ color: "#fed7d7"
1683
+ }, Ae = {
1684
+ fontSize: "16px",
1685
+ fontWeight: "600",
1686
+ marginBottom: "0.5rem",
1687
+ color: "#feb2b2"
1688
+ }, Se = {
1689
+ fontSize: "14px",
1690
+ color: "#fed7d7"
1691
+ }, So = `
1692
+ @keyframes spin {
1693
+ from {
1694
+ transform: rotate(0deg);
1695
+ }
1696
+ to {
1697
+ transform: rotate(360deg);
1698
+ }
1699
+ }
1700
+ `, Fo = "data-rulecms-published-key", Io = ["data-rulecms-published-key"], Vo = /* @__PURE__ */ x({
1701
+ __name: "RuleCMSWidget",
1702
+ props: {
1703
+ publishedKey: {},
1704
+ token: {},
1705
+ endpoint: {},
1706
+ mode: { default: "client-fetch" },
1707
+ initialData: {},
1708
+ libraries: {},
1709
+ componentProps: {}
1710
+ },
1711
+ setup(e) {
1712
+ const t = e, n = Ze(Le, null), o = _(!1), s = _(null), i = _(null), c = _(null), p = f(() => t.mode === "pre-fetched"), a = f(() => ({
1713
+ sourceComponents: c.value ?? void 0
1714
+ }));
1715
+ let r = null, l = null, y = !1;
1716
+ function u() {
1717
+ if (!i.value) {
1718
+ c.value = null;
1719
+ return;
1720
+ }
1721
+ const w = t.libraries ?? (n == null ? void 0 : n.libraries), k = n == null ? void 0 : n.libraryRegistry, W = bo({
1722
+ displayItemList: i.value.displayItemList,
1723
+ widgetCollections: i.value.widgetCollections,
1724
+ libraries: w,
1725
+ registry: k
1726
+ });
1727
+ if (W) {
1728
+ c.value = W;
1729
+ return;
1730
+ }
1731
+ wo({
1732
+ displayItemList: i.value.displayItemList,
1733
+ widgetCollections: i.value.widgetCollections,
1734
+ libraries: w,
1735
+ registry: k
1736
+ }).then((Y) => {
1737
+ c.value = Y;
1738
+ });
1739
+ }
1740
+ function d() {
1741
+ i.value && Hn({
1742
+ componentProps: t.componentProps,
1743
+ displayItemList: i.value.displayItemList,
1744
+ widgetCollections: i.value.widgetCollections,
1745
+ publishedKey: t.publishedKey
1746
+ });
1747
+ }
1748
+ function h() {
1749
+ if (y || typeof document > "u")
1750
+ return;
1751
+ const w = "rulecms-widget-spinner-styles";
1752
+ if (!document.getElementById(w)) {
1753
+ const k = document.createElement("style");
1754
+ k.id = w, k.textContent = So, document.head.appendChild(k);
1755
+ }
1756
+ y = !0;
1757
+ }
1758
+ function g() {
1759
+ const w = t.token ?? (n == null ? void 0 : n.token), k = t.endpoint ?? (n == null ? void 0 : n.endpoint);
1760
+ if (!t.publishedKey || !w) {
1761
+ s.value = t.publishedKey ? "Token is required. Provide it either directly as a prop (`token`) or via RuleCMSWidgetProvider." : R(w) ? "Widget key is required" : "Published key is required", i.value = null;
1762
+ return;
1763
+ }
1764
+ const W = `${t.publishedKey}|${w}`;
1765
+ if (l === W && i.value) {
1766
+ u();
1767
+ return;
1768
+ }
1769
+ r == null || r.abort(), r = new AbortController();
1770
+ const Y = r.signal;
1771
+ l = W, o.value = !0, s.value = null;
1772
+ const Ve = Ee({ publishedKey: t.publishedKey, token: w, endpoint: k });
1773
+ fetch(Ve, {
1774
+ method: "GET",
1775
+ headers: { "Content-Type": "application/json" },
1776
+ ...R(w) ? { cache: "no-store" } : {},
1777
+ signal: Y
1778
+ }).then(async (P) => {
1779
+ if (P.ok) {
1780
+ const V = await P.json();
1781
+ V.success ? (i.value = Fe(V.data), s.value = null, u(), d()) : (s.value = "Failed to fetch widget data", i.value = null);
1782
+ } else {
1783
+ const V = await P.json().catch(() => ({ error: "Unknown error" }));
1784
+ s.value = V.error || `Request failed with status ${P.status}`, i.value = null;
1785
+ }
1786
+ }).catch((P) => {
1787
+ P instanceof DOMException && P.name === "AbortError" || (console.error("Error fetching widget:", P), s.value = "Failed to fetch widget", i.value = null);
1788
+ }).finally(() => {
1789
+ o.value = !1;
1790
+ });
1791
+ }
1792
+ function C() {
1793
+ if (t.mode === "pre-fetched") {
1794
+ i.value = t.initialData ?? null, o.value = !1, s.value = null, u(), d();
1795
+ return;
1796
+ }
1797
+ h(), g();
1798
+ }
1799
+ return Ie(
1800
+ () => [
1801
+ t.publishedKey,
1802
+ t.token,
1803
+ t.endpoint,
1804
+ t.mode,
1805
+ t.initialData,
1806
+ t.libraries,
1807
+ t.componentProps
1808
+ ],
1809
+ () => {
1810
+ C();
1811
+ },
1812
+ { immediate: !0 }
1813
+ ), De(() => {
1814
+ r == null || r.abort();
1815
+ }), (w, k) => (m(), v("span", {
1816
+ "data-rulecms-published-key": e.publishedKey,
1817
+ style: { display: "contents" }
1818
+ }, [
1819
+ e.mode !== "pre-fetched" && o.value ? (m(), v("div", {
1820
+ key: 0,
1821
+ style: S(D(Co))
1822
+ }, [
1823
+ $("div", {
1824
+ style: S(D(vo))
1825
+ }, [
1826
+ $("div", {
1827
+ style: S(D(Ao))
1828
+ }, null, 4)
1829
+ ], 4)
1830
+ ], 4)) : e.mode !== "pre-fetched" && s.value ? (m(), v("div", {
1831
+ key: 1,
1832
+ style: S(D(ve))
1833
+ }, [
1834
+ $("div", {
1835
+ style: S(D(Ae))
1836
+ }, "Error Loading Widget", 4),
1837
+ $("div", {
1838
+ style: S(D(Se))
1839
+ }, oe(s.value), 5)
1840
+ ], 4)) : e.mode !== "pre-fetched" && !i.value ? (m(), v("div", {
1841
+ key: 2,
1842
+ style: S(D(ve))
1843
+ }, [
1844
+ $("div", {
1845
+ style: S(D(Ae))
1846
+ }, "No Widget Data", 4),
1847
+ $("div", {
1848
+ style: S(D(Se))
1849
+ }, "No widget data available", 4)
1850
+ ], 4)) : c.value && i.value ? (m(), v(E, { key: 3 }, [
1851
+ p.value ? (m(), A(uo, {
1852
+ key: 0,
1853
+ "display-item-list": i.value.displayItemList,
1854
+ "widget-collections": i.value.widgetCollections,
1855
+ plugins: a.value,
1856
+ "component-props": e.componentProps
1857
+ }, null, 8, ["display-item-list", "widget-collections", "plugins", "component-props"])) : (m(), A(mo, {
1858
+ key: 1,
1859
+ "display-item-list": i.value.displayItemList,
1860
+ "is-compose-mode": !1,
1861
+ "is-within-collection": !1,
1862
+ "widget-collections": i.value.widgetCollections,
1863
+ "show-drop-containers": !1,
1864
+ "redux-device-display-type": "desktop",
1865
+ plugins: a.value,
1866
+ "component-props": e.componentProps
1867
+ }, null, 8, ["display-item-list", "widget-collections", "plugins", "component-props"]))
1868
+ ], 64)) : B("", !0)
1869
+ ], 8, Io));
1870
+ }
1871
+ });
1872
+ class U extends Error {
1873
+ constructor(n, o) {
1874
+ super(n);
1875
+ fe(this, "status");
1876
+ this.name = "FetchRuleCMSWidgetError", this.status = o;
1877
+ }
1878
+ }
1879
+ async function Ko(e) {
1880
+ const { publishedKey: t, token: n, endpoint: o, fetchOptions: s } = e;
1881
+ if (!t)
1882
+ throw new U(
1883
+ R(n) ? "Widget key is required" : "Published key is required"
1884
+ );
1885
+ if (!n)
1886
+ throw new U("Token is required");
1887
+ const i = Ee({ publishedKey: t, token: n, endpoint: o }), c = await fetch(i, {
1888
+ method: "GET",
1889
+ headers: { "Content-Type": "application/json" },
1890
+ ...R(n) ? { cache: "no-store" } : {},
1891
+ ...s
1892
+ });
1893
+ if (!c.ok) {
1894
+ const a = await c.json().catch(() => ({ error: "Unknown error" }));
1895
+ throw new U(
1896
+ a.error || `Request failed with status ${c.status}`,
1897
+ c.status
1898
+ );
1899
+ }
1900
+ const p = await c.json();
1901
+ if (!p.success)
1902
+ throw new U("Failed to fetch widget data");
1903
+ return Fe(p.data);
1904
+ }
1905
+ async function Uo(e) {
1906
+ const { data: t, libraries: n } = e, o = ie({
1907
+ displayItemList: t.displayItemList,
1908
+ widgetCollections: t.widgetCollections
1909
+ });
1910
+ return z().resolve({ registrations: n, referenced: o });
1911
+ }
1912
+ export {
1913
+ To as AlignContentTypes,
1914
+ uo as BreakpointVariantRender,
1915
+ Pe as COLLECTION_TYPE_PREFIX,
1916
+ pe as COMPONENT_PROPS_PATH_SEPARATOR,
1917
+ ue as CSS_CLASSES_ATTRIBUTE_NAME,
1918
+ Nt as CSS_VARIABLE_NAME_MAX_LENGTH,
1919
+ Mt as CSS_VARIABLE_NAME_PATTERN,
1920
+ gt as DEFAULT_CLOUDINARY_CLOUD_NAME,
1921
+ F as DEFAULT_LIBRARY_ID,
1922
+ En as DEFAULT_ROW_GAP,
1923
+ tt as DEV_CLIENT_TOKEN_PREFIX,
1924
+ it as DEV_WIDGET_API_PATH,
1925
+ Po as DeviceDisplayTypes,
1926
+ co as DisplayComponent,
1927
+ se as DisplayItemTypes,
1928
+ Te as DragItemIdPrefixTypes,
1929
+ pt as EMBEDDED_KEY_SEPARATOR,
1930
+ on as FLEX_LAYOUT_STYLE_KEYS_THAT_DERIVE_DISPLAY,
1931
+ U as FetchRuleCMSWidgetError,
1932
+ _e as HIDE_WIDGET_ATTRIBUTE_NAME,
1933
+ he as JustifyContentTypes,
1934
+ dt as PUBLISHED_KEY_SEPARATOR,
1935
+ st as PUBLISHED_WIDGET_API_PATH,
1936
+ xo as PageViewTypes,
1937
+ nt as RULECMS_API_ORIGIN,
1938
+ Fo as RULECMS_PUBLISHED_KEY_ATTRIBUTE,
1939
+ Le as RULECMS_WIDGET_CONTEXT_KEY,
1940
+ mo as RenderComponents,
1941
+ te as RenderComponentsForDevice,
1942
+ ao as RenderComponentsInner,
1943
+ Vo as RuleCMSWidget,
1944
+ _o as RuleCMSWidgetProvider,
1945
+ Wn as WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE,
1946
+ ot as WIDGET_CACHE_API_ORIGIN,
1947
+ Jt as alignContentAllowlist,
1948
+ Xt as alignItemsAllowlist,
1949
+ tn as backgroundPositionAllowlist,
1950
+ nn as backgroundRepeatAllowlist,
1951
+ en as backgroundSizeAllowlist,
1952
+ sn as borderStyleKeywords,
1953
+ Ot as boxSpacingSideKeys,
1954
+ Bo as boxSpacingStyleAttributeEntries,
1955
+ Lt as buildCloudinaryBackgroundUrl,
1956
+ Ee as buildWidgetFetchUrl,
1957
+ Vn as collectComponentInstancePaths,
1958
+ ie as collectReferencedLibraryIds,
1959
+ et as composeSourceComponentsPlugin,
1960
+ z as createComponentLibraryRegistry,
1961
+ Z as cssAttrArrayKey,
1962
+ mt as defaultPageWidth,
1963
+ Dn as deriveDisplayFlexIfNeeded,
1964
+ Oo as desktopModeWidth,
1965
+ Ko as fetchRuleCMSWidget,
1966
+ Un as findUnmatchedComponentPropsKeys,
1967
+ Qt as flexDirectionAllowlist,
1968
+ Zt as flexWrapAllowlist,
1969
+ Kt as fontFamilyAllowlist,
1970
+ Ht as fontStyleAllowlist,
1971
+ Ut as fontWeightAllowlist,
1972
+ yn as formatBackgroundImageStyles,
1973
+ mn as formatBorderStyles,
1974
+ gn as formatBoxShadowStyles,
1975
+ bn as formatBoxSpacingStyles,
1976
+ wn as formatCssColorStyles,
1977
+ ce as formatCssColorValue,
1978
+ Cn as formatCssEnumStyles,
1979
+ vn as formatCssLengthStyles,
1980
+ I as formatCssVariable,
1981
+ jo as formatCssVariableStyles,
1982
+ An as formatLineHeightStyles,
1983
+ In as formatObjectStyleAttribute,
1984
+ Sn as formatOpacityStyles,
1985
+ M as formatSpacingSideValue,
1986
+ ft as generatePublishedKey,
1987
+ No as generatePublishedKeyForEmbedded,
1988
+ Re as getCollectionIdForCollectionType,
1989
+ H as getColumnAttributes,
1990
+ be as getComponentAttributesAndStyles,
1991
+ Q as getComponentsPluginFromPlugins,
1992
+ b as getCssVariableFromLeaf,
1993
+ xn as getDefaultDimensionAttributes,
1994
+ N as getDeviceTypeBasedAttributes,
1995
+ Eo as getDragItemId,
1996
+ lt as getDragItemPrefixAndId,
1997
+ ct as getIdAndPrefix,
1998
+ Tn as getMergedAttributes,
1999
+ $o as getNameAndInstanceIdFromWidgetKey,
2000
+ Ro as getNameFromWidgetKey,
2001
+ at as getWidgetKeyForCollection,
2002
+ Lo as getWidgetKeyForCollectionWithPrefix,
2003
+ ut as getWidgetKeyForPublishedCollection,
2004
+ Mo as getWidgetKeyForPublishedCollectionWithPrefix,
2005
+ dn as hasBoxShadowLeaf,
2006
+ Yn as hasDeviceDivergentValues,
2007
+ T as hasInvalidCssVariable,
2008
+ Pn as hasItems,
2009
+ Wo as incrementVersion,
2010
+ Wt as isBackgroundImageValue,
2011
+ rn as isBorderStyleValue,
2012
+ ln as isBorderValue,
2013
+ un as isBoxShadowValue,
2014
+ jt as isBoxSpacingValue,
2015
+ Tt as isCloudinaryCloudName,
2016
+ xt as isCloudinaryPublicId,
2017
+ Et as isCloudinaryTransformationString,
2018
+ le as isCssColorValue,
2019
+ Vt as isCssEnumValue,
2020
+ We as isCssVariableName,
2021
+ R as isDevClientToken,
2022
+ pn as isLineHeightValue,
2023
+ fn as isOpacityValue,
2024
+ Rn as isRowHiddenForDevice,
2025
+ Pt as isSafeImageUrl,
2026
+ L as isSpacingSideValue,
2027
+ On as isWidgetHiddenForDevice,
2028
+ qt as justifyContentAllowlist,
2029
+ de as normalizeCssClasses,
2030
+ ae as objectStyleAttributeRegistry,
2031
+ J as overflowAllowlist,
2032
+ Me as phoneModeWidth,
2033
+ Fe as prepareRuleCMSWidgetData,
2034
+ xe as resolveKey,
2035
+ Ln as resolveRowStyles,
2036
+ rt as resolveWidgetApiOrigin,
2037
+ jn as resolveWidgetContainerStyles,
2038
+ Fn as resolveWidgetInstanceProps,
2039
+ Uo as resolveWidgetLibraries,
2040
+ $n as rowBasedPropertiesAreAssigned,
2041
+ re as spacingKeywords,
2042
+ _t as spacingLengthUnits,
2043
+ Ne as tabletModeWidth,
2044
+ Gt as textAlignAllowlist,
2045
+ zt as textDecorationAllowlist,
2046
+ Yt as textTransformAllowlist,
2047
+ $e as typeHasPrefix,
2048
+ Hn as warnUnmatchedComponentProps,
2049
+ Bn as widgetBasedPropertiesAreAssigned
2050
+ };