@rulecms/widget-svelte 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,4337 @@
1
+ var xo = Object.defineProperty;
2
+ var rr = (e) => {
3
+ throw TypeError(e);
4
+ };
5
+ var Do = (e, t, n) => t in e ? xo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var pe = (e, t, n) => Do(e, typeof t != "symbol" ? t + "" : t, n), vn = (e, t, n) => t.has(e) || rr("Cannot " + n);
7
+ var v = (e, t, n) => (vn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), O = (e, t, n) => t.has(e) ? rr("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), Z = (e, t, n, r) => (vn(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), V = (e, t, n) => (vn(e, t, "access private method"), n);
8
+ import { setContext as Po, getContext as Ro, untrack as Lo } from "svelte";
9
+ const Mo = "5";
10
+ var Ar;
11
+ typeof window < "u" && ((Ar = window.__svelte ?? (window.__svelte = {})).v ?? (Ar.v = /* @__PURE__ */ new Set())).add(Mo);
12
+ const No = 1, Oo = 2, Er = 4, Fo = 8, Wo = 16, jo = 1, Vo = 2, K = Symbol("uninitialized"), Ir = "http://www.w3.org/1999/xhtml", Bo = "http://www.w3.org/2000/svg", Tr = !1;
13
+ var kr = Array.isArray, Ko = Array.prototype.indexOf, Qt = Array.prototype.includes, Nn = Array.from, Et = Object.getOwnPropertyDescriptor, Uo = Object.getOwnPropertyDescriptors, Ho = Object.prototype, Yo = Array.prototype, xr = Object.getPrototypeOf;
14
+ function _t(e) {
15
+ return typeof e == "function";
16
+ }
17
+ const zo = () => {
18
+ };
19
+ function Go(e) {
20
+ for (var t = 0; t < e.length; t++)
21
+ e[t]();
22
+ }
23
+ function Dr() {
24
+ var e, t, n = new Promise((r, o) => {
25
+ e = r, t = o;
26
+ });
27
+ return { promise: n, resolve: e, reject: t };
28
+ }
29
+ const Y = 2, Tt = 4, On = 8, Pr = 1 << 24, ye = 16, fe = 32, Ve = 64, qo = 128, ae = 512, U = 1024, B = 2048, we = 4096, X = 8192, ue = 16384, vt = 32768, or = 1 << 25, Be = 65536, $t = 1 << 17, Xo = 1 << 18, dn = 1 << 19, Zo = 1 << 20, Ae = 1 << 25, Ze = 65536, en = 1 << 21, ot = 1 << 22, We = 1 << 23, qt = Symbol("$state"), Jo = Symbol("legacy props"), Qo = Symbol(""), mn = Symbol("attributes"), ir = Symbol("class"), sr = Symbol("style"), Yt = Symbol("text"), Wt = new class extends Error {
30
+ constructor() {
31
+ super(...arguments);
32
+ pe(this, "name", "StaleReactionError");
33
+ pe(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
34
+ }
35
+ }();
36
+ function $o() {
37
+ throw new Error("https://svelte.dev/e/async_derived_orphan");
38
+ }
39
+ function ei(e, t, n) {
40
+ throw new Error("https://svelte.dev/e/each_key_duplicate");
41
+ }
42
+ function ti(e) {
43
+ throw new Error("https://svelte.dev/e/effect_in_teardown");
44
+ }
45
+ function ni() {
46
+ throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
47
+ }
48
+ function ri(e) {
49
+ throw new Error("https://svelte.dev/e/effect_orphan");
50
+ }
51
+ function oi() {
52
+ throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
53
+ }
54
+ function ii() {
55
+ throw new Error("https://svelte.dev/e/state_descriptors_fixed");
56
+ }
57
+ function si() {
58
+ throw new Error("https://svelte.dev/e/state_prototype_fixed");
59
+ }
60
+ function li() {
61
+ throw new Error("https://svelte.dev/e/state_unsafe_mutation");
62
+ }
63
+ function ai() {
64
+ console.warn("https://svelte.dev/e/derived_inert");
65
+ }
66
+ function Rr(e) {
67
+ return e === this.v;
68
+ }
69
+ function ui(e, t) {
70
+ return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
71
+ }
72
+ function Lr(e) {
73
+ return !ui(e, this.v);
74
+ }
75
+ let ci = !1, ce = null;
76
+ function tn(e) {
77
+ ce = e;
78
+ }
79
+ function Pe(e, t = !1, n) {
80
+ ce = {
81
+ p: ce,
82
+ i: !1,
83
+ c: null,
84
+ e: null,
85
+ s: e,
86
+ x: null,
87
+ r: (
88
+ /** @type {Effect} */
89
+ D
90
+ ),
91
+ l: null
92
+ };
93
+ }
94
+ function Re(e) {
95
+ var t = (
96
+ /** @type {ComponentContext} */
97
+ ce
98
+ ), n = t.e;
99
+ if (n !== null) {
100
+ t.e = null;
101
+ for (var r of n)
102
+ Zr(r);
103
+ }
104
+ return t.i = !0, ce = t.p, /** @type {T} */
105
+ {};
106
+ }
107
+ function Mr() {
108
+ return !0;
109
+ }
110
+ let tt = [];
111
+ function fi() {
112
+ var e = tt;
113
+ tt = [], Go(e);
114
+ }
115
+ function kn(e) {
116
+ if (tt.length === 0) {
117
+ var t = tt;
118
+ queueMicrotask(() => {
119
+ t === tt && fi();
120
+ });
121
+ }
122
+ tt.push(e);
123
+ }
124
+ function di(e) {
125
+ var t = D;
126
+ if (t === null)
127
+ return E.f |= We, e;
128
+ if ((t.f & vt) === 0 && (t.f & Tt) === 0)
129
+ throw e;
130
+ nn(e, t);
131
+ }
132
+ function nn(e, t) {
133
+ if (!(t !== null && (t.f & ue) !== 0)) {
134
+ for (; t !== null; ) {
135
+ if ((t.f & qo) !== 0) {
136
+ if ((t.f & vt) === 0)
137
+ throw e;
138
+ try {
139
+ t.b.error(e);
140
+ return;
141
+ } catch (n) {
142
+ e = n;
143
+ }
144
+ }
145
+ t = t.parent;
146
+ }
147
+ throw e;
148
+ }
149
+ }
150
+ const pi = -7169;
151
+ function W(e, t) {
152
+ e.f = e.f & pi | t;
153
+ }
154
+ function Fn(e) {
155
+ (e.f & ae) !== 0 || e.deps === null ? W(e, U) : W(e, we);
156
+ }
157
+ function Nr(e) {
158
+ if (e !== null)
159
+ for (const t of e)
160
+ (t.f & Y) === 0 || (t.f & Ze) === 0 || (t.f ^= Ze, Nr(
161
+ /** @type {Derived} */
162
+ t.deps
163
+ ));
164
+ }
165
+ function hi(e, t, n) {
166
+ (e.f & B) !== 0 ? t.add(e) : (e.f & we) !== 0 && n.add(e), Nr(e.deps), W(e, U);
167
+ }
168
+ function pn(e) {
169
+ var t = E, n = D;
170
+ Ue(null), ft(null);
171
+ try {
172
+ return e();
173
+ } finally {
174
+ Ue(t), ft(n);
175
+ }
176
+ }
177
+ function gi(e, t, n, r) {
178
+ const o = Wn;
179
+ var i = e.filter((d) => !d.settled), s = t.map(o);
180
+ if (n.length === 0 && i.length === 0) {
181
+ r(s);
182
+ return;
183
+ }
184
+ var l = (
185
+ /** @type {Effect} */
186
+ D
187
+ ), a = vi(), c = i.length === 1 ? i[0].promise : i.length > 1 ? Promise.all(i.map((d) => d.promise)) : null;
188
+ function f(d) {
189
+ if ((l.f & ue) === 0) {
190
+ a();
191
+ try {
192
+ r([...s, ...d]);
193
+ } catch (m) {
194
+ nn(m, l);
195
+ }
196
+ rn();
197
+ }
198
+ }
199
+ var h = Or();
200
+ if (n.length === 0) {
201
+ c.then(() => f([])).finally(h);
202
+ return;
203
+ }
204
+ function u() {
205
+ Promise.all(n.map((d) => /* @__PURE__ */ mi(d))).then(f).catch((d) => nn(d, l)).finally(h);
206
+ }
207
+ c ? c.then(() => {
208
+ a(), u(), rn();
209
+ }) : u();
210
+ }
211
+ function vi() {
212
+ var e = (
213
+ /** @type {Effect} */
214
+ D
215
+ ), t = E, n = ce, r = (
216
+ /** @type {Batch} */
217
+ T
218
+ );
219
+ return function(i = !0) {
220
+ ft(e), Ue(t), tn(n), i && (e.f & ue) === 0 && (r == null || r.activate(), r == null || r.apply());
221
+ };
222
+ }
223
+ function rn(e = !0) {
224
+ ft(null), Ue(null), tn(null), e && (T == null || T.deactivate());
225
+ }
226
+ function Or() {
227
+ var e = (
228
+ /** @type {Effect} */
229
+ D
230
+ ), t = e.b, n = (
231
+ /** @type {Batch} */
232
+ T
233
+ ), r = !!(t != null && t.is_rendered());
234
+ return t == null || t.update_pending_count(1, n), n.increment(r, e), () => {
235
+ t == null || t.update_pending_count(-1, n), n.decrement(r, e);
236
+ };
237
+ }
238
+ // @__NO_SIDE_EFFECTS__
239
+ function Wn(e) {
240
+ var t = Y | B;
241
+ return D !== null && (D.f |= dn), {
242
+ ctx: ce,
243
+ deps: null,
244
+ effects: null,
245
+ equals: Rr,
246
+ f: t,
247
+ fn: e,
248
+ reactions: null,
249
+ rv: 0,
250
+ v: (
251
+ /** @type {V} */
252
+ K
253
+ ),
254
+ wv: 0,
255
+ parent: D,
256
+ ac: null
257
+ };
258
+ }
259
+ const bt = Symbol("obsolete");
260
+ // @__NO_SIDE_EFFECTS__
261
+ function mi(e, t, n) {
262
+ let r = (
263
+ /** @type {Effect | null} */
264
+ D
265
+ );
266
+ r === null && $o();
267
+ var o = (
268
+ /** @type {Promise<V>} */
269
+ /** @type {unknown} */
270
+ void 0
271
+ ), i = xt(
272
+ /** @type {V} */
273
+ K
274
+ ), s = !E, l = /* @__PURE__ */ new Set();
275
+ return Ri(() => {
276
+ var d, m;
277
+ var a = (
278
+ /** @type {Effect} */
279
+ D
280
+ ), c = Dr();
281
+ o = c.promise;
282
+ try {
283
+ Promise.resolve(e()).then(c.resolve, (y) => {
284
+ y !== Wt && c.reject(y);
285
+ }).finally(rn);
286
+ } catch (y) {
287
+ c.reject(y), rn();
288
+ }
289
+ var f = (
290
+ /** @type {Batch} */
291
+ T
292
+ );
293
+ if (s) {
294
+ if ((a.f & vt) !== 0)
295
+ var h = Or();
296
+ if (
297
+ // boundary can be null if the async derived is inside an $effect.root not connected to the component render tree
298
+ (d = r.b) != null && d.is_rendered()
299
+ )
300
+ (m = f.async_deriveds.get(a)) == null || m.reject(bt);
301
+ else
302
+ for (const y of l.values())
303
+ y.reject(bt);
304
+ l.add(c), f.async_deriveds.set(a, c);
305
+ }
306
+ const u = (y, g = void 0) => {
307
+ h == null || h(), l.delete(c), g !== bt && (f.activate(), g ? (i.f |= We, Dt(i, g)) : ((i.f & We) !== 0 && (i.f ^= We), Dt(i, y)), f.deactivate());
308
+ };
309
+ c.promise.then(u, (y) => u(null, y || "unknown"));
310
+ }), Xr(() => {
311
+ for (const a of l)
312
+ a.reject(bt);
313
+ }), new Promise((a) => {
314
+ function c(f) {
315
+ function h() {
316
+ f === o ? a(i) : c(o);
317
+ }
318
+ f.then(h, h);
319
+ }
320
+ c(o);
321
+ });
322
+ }
323
+ // @__NO_SIDE_EFFECTS__
324
+ function A(e) {
325
+ const t = /* @__PURE__ */ Wn(e);
326
+ return no(t), t;
327
+ }
328
+ // @__NO_SIDE_EFFECTS__
329
+ function yi(e) {
330
+ const t = /* @__PURE__ */ Wn(e);
331
+ return t.equals = Lr, t;
332
+ }
333
+ function _i(e) {
334
+ var t = e.effects;
335
+ if (t !== null) {
336
+ e.effects = null;
337
+ for (var n = 0; n < t.length; n += 1)
338
+ xe(
339
+ /** @type {Effect} */
340
+ t[n]
341
+ );
342
+ }
343
+ }
344
+ function jn(e) {
345
+ var t, n = D, r = e.parent;
346
+ if (!Ke && r !== null && e.v !== K && // if it was never evaluated before, it's guaranteed to fail downstream, so we try to execute instead
347
+ (r.f & (ue | X)) !== 0)
348
+ return ai(), e.v;
349
+ ft(r);
350
+ try {
351
+ e.f &= ~Ze, _i(e), t = so(e);
352
+ } finally {
353
+ ft(n);
354
+ }
355
+ return t;
356
+ }
357
+ function Fr(e) {
358
+ var t = jn(e);
359
+ if (!e.equals(t) && (e.wv = oo(), (!(T != null && T.is_fork) || e.deps === null) && (T !== null ? (T.capture(e, t, !0), It == null || It.capture(e, t, !0)) : e.v = t, e.deps === null))) {
360
+ W(e, U);
361
+ return;
362
+ }
363
+ Ke || (G !== null ? (qr() || T != null && T.is_fork) && G.set(e, t) : Fn(e));
364
+ }
365
+ function wi(e) {
366
+ var t;
367
+ if (e.effects !== null)
368
+ for (const n of e.effects)
369
+ (n.teardown || n.ac) && ((t = n.teardown) == null || t.call(n), n.ac !== null && pn(() => {
370
+ n.ac.abort(Wt), n.ac = null;
371
+ }), n.fn !== null && (n.teardown = zo), Rt(n, 0), Un(n));
372
+ }
373
+ function Wr(e) {
374
+ if (e.effects !== null)
375
+ for (const t of e.effects)
376
+ t.teardown && t.fn !== null && dt(t);
377
+ }
378
+ let yn = null, $e = null, T = null, It = null, G = null, xn = null, _n = !1, nt = null, Xt = null;
379
+ var lr = 0;
380
+ let bi = 1;
381
+ var it, Oe, Ye, st, lt, at, Te, ut, J, Nt, ke, ge, be, ct, ze, P, Dn, Ct, Pn, jr, Vr, et, Ci, At;
382
+ const cn = class cn {
383
+ constructor() {
384
+ O(this, P);
385
+ pe(this, "id", bi++);
386
+ /** True as soon as `#process` was called */
387
+ O(this, it, !1);
388
+ pe(this, "linked", !0);
389
+ /** @type {Batch | null} */
390
+ O(this, Oe, null);
391
+ /** @type {Batch | null} */
392
+ O(this, Ye, null);
393
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
394
+ pe(this, "async_deriveds", /* @__PURE__ */ new Map());
395
+ /**
396
+ * The current values of any signals that are updated in this batch.
397
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
398
+ * They keys of this map are identical to `this.#previous`
399
+ * @type {Map<Value, [any, boolean]>}
400
+ */
401
+ pe(this, "current", /* @__PURE__ */ new Map());
402
+ /**
403
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
404
+ * They keys of this map are identical to `this.#current`
405
+ * @type {Map<Value, any>}
406
+ */
407
+ pe(this, "previous", /* @__PURE__ */ new Map());
408
+ /**
409
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
410
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
411
+ * @type {Set<(batch: Batch) => void>}
412
+ */
413
+ O(this, st, /* @__PURE__ */ new Set());
414
+ /**
415
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
416
+ * @type {Set<(batch: Batch) => void>}
417
+ */
418
+ O(this, lt, /* @__PURE__ */ new Set());
419
+ /**
420
+ * The number of async effects that are currently in flight
421
+ */
422
+ O(this, at, 0);
423
+ /**
424
+ * Async effects that are currently in flight, _not_ inside a pending boundary
425
+ * @type {Map<Effect, number>}
426
+ */
427
+ O(this, Te, /* @__PURE__ */ new Map());
428
+ /**
429
+ * A deferred that resolves when the batch is committed, used with `settled()`
430
+ * TODO replace with Promise.withResolvers once supported widely enough
431
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
432
+ */
433
+ O(this, ut, null);
434
+ /**
435
+ * The root effects that need to be flushed
436
+ * @type {Effect[]}
437
+ */
438
+ O(this, J, []);
439
+ /**
440
+ * Effects created while this batch was active.
441
+ * @type {Effect[]}
442
+ */
443
+ O(this, Nt, []);
444
+ /**
445
+ * Deferred effects (which run after async work has completed) that are DIRTY
446
+ * @type {Set<Effect>}
447
+ */
448
+ O(this, ke, /* @__PURE__ */ new Set());
449
+ /**
450
+ * Deferred effects that are MAYBE_DIRTY
451
+ * @type {Set<Effect>}
452
+ */
453
+ O(this, ge, /* @__PURE__ */ new Set());
454
+ /**
455
+ * A map of branches that still exist, but will be destroyed when this batch
456
+ * is committed — we skip over these during `process`.
457
+ * The value contains child effects that were dirty/maybe_dirty before being reset,
458
+ * so they can be rescheduled if the branch survives.
459
+ * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
460
+ */
461
+ O(this, be, /* @__PURE__ */ new Map());
462
+ /**
463
+ * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
464
+ * @type {Set<Effect>}
465
+ */
466
+ O(this, ct, /* @__PURE__ */ new Set());
467
+ pe(this, "is_fork", !1);
468
+ O(this, ze, !1);
469
+ $e === null ? yn = $e = this : (Z($e, Ye, this), Z(this, Oe, $e)), $e = this;
470
+ }
471
+ /**
472
+ * Add an effect to the #skipped_branches map and reset its children
473
+ * @param {Effect} effect
474
+ */
475
+ skip_effect(t) {
476
+ v(this, be).has(t) || v(this, be).set(t, { d: [], m: [] }), v(this, ct).delete(t);
477
+ }
478
+ /**
479
+ * Remove an effect from the #skipped_branches map and reschedule
480
+ * any tracked dirty/maybe_dirty child effects
481
+ * @param {Effect} effect
482
+ * @param {(e: Effect) => void} callback
483
+ */
484
+ unskip_effect(t, n = (r) => this.schedule(r)) {
485
+ var r = v(this, be).get(t);
486
+ if (r) {
487
+ v(this, be).delete(t);
488
+ for (var o of r.d)
489
+ W(o, B), n(o);
490
+ for (o of r.m)
491
+ W(o, we), n(o);
492
+ }
493
+ v(this, ct).add(t);
494
+ }
495
+ /**
496
+ * Associate a change to a given source with the current
497
+ * batch, noting its previous and current values
498
+ * @param {Value} source
499
+ * @param {any} value
500
+ * @param {boolean} [is_derived]
501
+ */
502
+ capture(t, n, r = !1) {
503
+ t.v !== K && !this.previous.has(t) && this.previous.set(t, t.v), (t.f & We) === 0 && (this.current.set(t, [n, r]), G == null || G.set(t, n)), this.is_fork || (t.v = n);
504
+ }
505
+ activate() {
506
+ T = this;
507
+ }
508
+ deactivate() {
509
+ T = null, G = null;
510
+ }
511
+ flush() {
512
+ try {
513
+ _n = !0, T = this, V(this, P, Ct).call(this);
514
+ } finally {
515
+ lr = 0, xn = null, nt = null, Xt = null, _n = !1, T = null, G = null, qe.clear();
516
+ }
517
+ }
518
+ discard() {
519
+ var t;
520
+ for (const n of v(this, lt)) n(this);
521
+ v(this, lt).clear();
522
+ for (const n of this.async_deriveds.values())
523
+ n.reject(bt);
524
+ V(this, P, At).call(this), (t = v(this, ut)) == null || t.resolve();
525
+ }
526
+ /**
527
+ * @param {Effect} effect
528
+ */
529
+ register_created_effect(t) {
530
+ v(this, Nt).push(t);
531
+ }
532
+ /**
533
+ * @param {boolean} blocking
534
+ * @param {Effect} effect
535
+ */
536
+ increment(t, n) {
537
+ if (Z(this, at, v(this, at) + 1), t) {
538
+ let r = v(this, Te).get(n) ?? 0;
539
+ v(this, Te).set(n, r + 1);
540
+ }
541
+ }
542
+ /**
543
+ * @param {boolean} blocking
544
+ * @param {Effect} effect
545
+ */
546
+ decrement(t, n) {
547
+ if (Z(this, at, v(this, at) - 1), t) {
548
+ let r = v(this, Te).get(n) ?? 0;
549
+ r === 1 ? v(this, Te).delete(n) : v(this, Te).set(n, r - 1);
550
+ }
551
+ v(this, ze) || (Z(this, ze, !0), kn(() => {
552
+ Z(this, ze, !1), this.linked && this.flush();
553
+ }));
554
+ }
555
+ /**
556
+ * @param {Set<Effect>} dirty_effects
557
+ * @param {Set<Effect>} maybe_dirty_effects
558
+ */
559
+ transfer_effects(t, n) {
560
+ for (const r of t)
561
+ v(this, ke).add(r);
562
+ for (const r of n)
563
+ v(this, ge).add(r);
564
+ t.clear(), n.clear();
565
+ }
566
+ /** @param {(batch: Batch) => void} fn */
567
+ oncommit(t) {
568
+ v(this, st).add(t);
569
+ }
570
+ /** @param {(batch: Batch) => void} fn */
571
+ ondiscard(t) {
572
+ v(this, lt).add(t);
573
+ }
574
+ settled() {
575
+ return (v(this, ut) ?? Z(this, ut, Dr())).promise;
576
+ }
577
+ static ensure() {
578
+ if (T === null) {
579
+ const t = T = new cn();
580
+ _n || kn(() => {
581
+ v(t, it) || t.flush();
582
+ });
583
+ }
584
+ return T;
585
+ }
586
+ apply() {
587
+ {
588
+ G = null;
589
+ return;
590
+ }
591
+ }
592
+ /**
593
+ *
594
+ * @param {Effect} effect
595
+ */
596
+ schedule(t) {
597
+ var o;
598
+ if (xn = t, (o = t.b) != null && o.is_pending && (t.f & (Tt | On | Pr)) !== 0 && (t.f & vt) === 0) {
599
+ t.b.defer_effect(t);
600
+ return;
601
+ }
602
+ for (var n = t; n.parent !== null; ) {
603
+ n = n.parent;
604
+ var r = n.f;
605
+ if (nt !== null && n === D && (E === null || (E.f & Y) === 0))
606
+ return;
607
+ if ((r & (Ve | fe)) !== 0) {
608
+ if ((r & U) === 0)
609
+ return;
610
+ n.f ^= U;
611
+ }
612
+ }
613
+ v(this, J).push(n);
614
+ }
615
+ };
616
+ it = new WeakMap(), Oe = new WeakMap(), Ye = new WeakMap(), st = new WeakMap(), lt = new WeakMap(), at = new WeakMap(), Te = new WeakMap(), ut = new WeakMap(), J = new WeakMap(), Nt = new WeakMap(), ke = new WeakMap(), ge = new WeakMap(), be = new WeakMap(), ct = new WeakMap(), ze = new WeakMap(), P = new WeakSet(), Dn = function() {
617
+ if (this.is_fork) return !0;
618
+ for (const r of v(this, Te).keys()) {
619
+ for (var t = r, n = !1; t.parent !== null; ) {
620
+ if (v(this, be).has(t)) {
621
+ n = !0;
622
+ break;
623
+ }
624
+ t = t.parent;
625
+ }
626
+ if (!n)
627
+ return !0;
628
+ }
629
+ return !1;
630
+ }, Ct = function() {
631
+ var a, c, f, h;
632
+ Z(this, it, !0), lr++ > 1e3 && (V(this, P, At).call(this), Ai());
633
+ for (const u of v(this, ke))
634
+ v(this, ge).delete(u), W(u, B), this.schedule(u);
635
+ for (const u of v(this, ge))
636
+ W(u, we), this.schedule(u);
637
+ const t = v(this, J);
638
+ Z(this, J, []), this.apply();
639
+ var n = nt = [], r = [], o = Xt = [];
640
+ for (const u of t)
641
+ try {
642
+ V(this, P, Pn).call(this, u, n, r);
643
+ } catch (d) {
644
+ throw Ur(u), V(this, P, Dn).call(this) || this.discard(), d;
645
+ }
646
+ if (T = null, o.length > 0) {
647
+ var i = cn.ensure();
648
+ for (const u of o)
649
+ i.schedule(u);
650
+ }
651
+ if (nt = null, Xt = null, V(this, P, Dn).call(this)) {
652
+ V(this, P, et).call(this, r), V(this, P, et).call(this, n);
653
+ for (const [u, d] of v(this, be))
654
+ Kr(u, d);
655
+ o.length > 0 && /** @type {unknown} */
656
+ V(a = T, P, Ct).call(a);
657
+ return;
658
+ }
659
+ const s = V(this, P, jr).call(this);
660
+ if (s) {
661
+ V(this, P, et).call(this, r), V(this, P, et).call(this, n), V(c = s, P, Vr).call(c, this);
662
+ return;
663
+ }
664
+ v(this, ke).clear(), v(this, ge).clear();
665
+ for (const u of v(this, st)) u(this);
666
+ v(this, st).clear(), It = this, ar(r), ar(n), It = null, (f = v(this, ut)) == null || f.resolve();
667
+ var l = (
668
+ /** @type {Batch | null} */
669
+ /** @type {unknown} */
670
+ T
671
+ );
672
+ if (v(this, at) === 0 && (v(this, J).length === 0 || l !== null) && V(this, P, At).call(this), v(this, J).length > 0)
673
+ if (l !== null) {
674
+ const u = l;
675
+ v(u, J).push(...v(this, J).filter((d) => !v(u, J).includes(d)));
676
+ } else
677
+ l = this;
678
+ l !== null && V(h = l, P, Ct).call(h);
679
+ }, /**
680
+ * Traverse the effect tree, executing effects or stashing
681
+ * them for later execution as appropriate
682
+ * @param {Effect} root
683
+ * @param {Effect[]} effects
684
+ * @param {Effect[]} render_effects
685
+ */
686
+ Pn = function(t, n, r) {
687
+ t.f ^= U;
688
+ for (var o = t.first; o !== null; ) {
689
+ var i = o.f, s = (i & (fe | Ve)) !== 0, l = s && (i & U) !== 0, a = l || (i & X) !== 0 || v(this, be).has(o);
690
+ if (!a && o.fn !== null) {
691
+ s ? o.f ^= U : (i & Tt) !== 0 ? n.push(o) : Bt(o) && ((i & ye) !== 0 && v(this, ge).add(o), dt(o));
692
+ var c = o.first;
693
+ if (c !== null) {
694
+ o = c;
695
+ continue;
696
+ }
697
+ }
698
+ for (; o !== null; ) {
699
+ var f = o.next;
700
+ if (f !== null) {
701
+ o = f;
702
+ break;
703
+ }
704
+ o = o.parent;
705
+ }
706
+ }
707
+ }, jr = function() {
708
+ for (var t = v(this, Oe); t !== null; ) {
709
+ if (!t.is_fork) {
710
+ for (const [n, [, r]] of this.current)
711
+ if (t.current.has(n) && !r)
712
+ return t;
713
+ }
714
+ t = v(t, Oe);
715
+ }
716
+ return null;
717
+ }, /**
718
+ * @param {Batch} batch
719
+ */
720
+ Vr = function(t) {
721
+ var r;
722
+ for (const [o, i] of t.current)
723
+ !this.previous.has(o) && t.previous.has(o) && this.previous.set(o, t.previous.get(o)), this.current.set(o, i);
724
+ for (const [o, i] of t.async_deriveds) {
725
+ const s = this.async_deriveds.get(o);
726
+ s && i.promise.then(s.resolve).catch(s.reject);
727
+ }
728
+ t.async_deriveds.clear(), this.transfer_effects(v(t, ke), v(t, ge));
729
+ const n = (o) => {
730
+ var i = o.reactions;
731
+ if (i !== null && !((o.f & Y) !== 0 && (o.f & (B | we)) === 0))
732
+ for (const a of i) {
733
+ var s = a.f;
734
+ if ((s & Y) !== 0)
735
+ n(
736
+ /** @type {Derived} */
737
+ a
738
+ );
739
+ else {
740
+ var l = (
741
+ /** @type {Effect} */
742
+ a
743
+ );
744
+ s & (ot | ye) && !this.async_deriveds.has(l) && (v(this, ge).delete(l), W(l, B), this.schedule(l));
745
+ }
746
+ }
747
+ };
748
+ for (const o of this.current.keys())
749
+ n(o);
750
+ this.oncommit(() => t.discard()), V(r = t, P, At).call(r), T = this, V(this, P, Ct).call(this);
751
+ }, /**
752
+ * @param {Effect[]} effects
753
+ */
754
+ et = function(t) {
755
+ for (var n = 0; n < t.length; n += 1)
756
+ hi(t[n], v(this, ke), v(this, ge));
757
+ }, Ci = function() {
758
+ var h;
759
+ for (let u = yn; u !== null; u = v(u, Ye)) {
760
+ var t = u.id < this.id, n = [];
761
+ for (const [d, [m, y]] of this.current) {
762
+ if (u.current.has(d)) {
763
+ var r = (
764
+ /** @type {[any, boolean]} */
765
+ u.current.get(d)[0]
766
+ );
767
+ if (t && m !== r)
768
+ u.current.set(d, [m, y]);
769
+ else
770
+ continue;
771
+ }
772
+ n.push(d);
773
+ }
774
+ if (t)
775
+ for (const [d, m] of this.async_deriveds) {
776
+ const y = u.async_deriveds.get(d);
777
+ y && m.promise.then(y.resolve).catch(y.reject);
778
+ }
779
+ var o = [...u.current.keys()].filter(
780
+ (d) => !/** @type {[any, boolean]} */
781
+ u.current.get(d)[1]
782
+ );
783
+ if (!(!v(u, it) || o.length === 0)) {
784
+ var i = o.filter((d) => !this.current.has(d));
785
+ if (i.length === 0)
786
+ t && u.discard();
787
+ else if (n.length > 0) {
788
+ if (t)
789
+ for (const d of v(this, ct))
790
+ u.unskip_effect(d, (m) => {
791
+ var y;
792
+ (m.f & (ye | ot)) !== 0 ? u.schedule(m) : V(y = u, P, et).call(y, [m]);
793
+ });
794
+ u.activate();
795
+ var s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
796
+ for (var a of n)
797
+ Br(a, i, s, l);
798
+ l = /* @__PURE__ */ new Map();
799
+ var c = [...u.current].filter(([d, m]) => {
800
+ const y = this.current.get(d);
801
+ return y ? y[0] !== m[0] || y[1] !== m[1] : !0;
802
+ }).map(([d]) => d);
803
+ if (c.length > 0)
804
+ for (const d of v(this, Nt))
805
+ (d.f & (ue | X | $t)) === 0 && Vn(d, c, l) && ((d.f & (ot | ye)) !== 0 ? (W(d, B), u.schedule(d)) : v(u, ke).add(d));
806
+ if (v(u, J).length > 0 && !v(u, ze)) {
807
+ u.apply();
808
+ for (var f of v(u, J))
809
+ V(h = u, P, Pn).call(h, f, [], []);
810
+ Z(u, J, []);
811
+ }
812
+ u.deactivate();
813
+ }
814
+ }
815
+ }
816
+ }, At = function() {
817
+ if (this.linked) {
818
+ var t = v(this, Oe), n = v(this, Ye);
819
+ t === null ? yn = n : Z(t, Ye, n), n === null ? $e = t : Z(n, Oe, t), this.linked = !1;
820
+ }
821
+ };
822
+ let kt = cn;
823
+ function Ai() {
824
+ try {
825
+ oi();
826
+ } catch (e) {
827
+ nn(e, xn);
828
+ }
829
+ }
830
+ let he = null;
831
+ function ar(e) {
832
+ var t = e.length;
833
+ if (t !== 0) {
834
+ for (var n = 0; n < t; ) {
835
+ var r = e[n++];
836
+ if ((r.f & (ue | X)) === 0 && Bt(r) && (he = /* @__PURE__ */ new Set(), dt(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && Qr(r), (he == null ? void 0 : he.size) > 0)) {
837
+ qe.clear();
838
+ for (const o of he) {
839
+ if ((o.f & (ue | X)) !== 0) continue;
840
+ const i = [o];
841
+ let s = o.parent;
842
+ for (; s !== null; )
843
+ he.has(s) && (he.delete(s), i.push(s)), s = s.parent;
844
+ for (let l = i.length - 1; l >= 0; l--) {
845
+ const a = i[l];
846
+ (a.f & (ue | X)) === 0 && dt(a);
847
+ }
848
+ }
849
+ he.clear();
850
+ }
851
+ }
852
+ he = null;
853
+ }
854
+ }
855
+ function Br(e, t, n, r) {
856
+ if (!n.has(e) && (n.add(e), e.reactions !== null))
857
+ for (const o of e.reactions) {
858
+ const i = o.f;
859
+ (i & Y) !== 0 ? Br(
860
+ /** @type {Derived} */
861
+ o,
862
+ t,
863
+ n,
864
+ r
865
+ ) : (i & (ot | ye)) !== 0 && (i & B) === 0 && Vn(o, t, r) && (W(o, B), Bn(
866
+ /** @type {Effect} */
867
+ o
868
+ ));
869
+ }
870
+ }
871
+ function Vn(e, t, n) {
872
+ const r = n.get(e);
873
+ if (r !== void 0) return r;
874
+ if (e.deps !== null)
875
+ for (const o of e.deps) {
876
+ if (Qt.call(t, o))
877
+ return !0;
878
+ if ((o.f & Y) !== 0 && Vn(
879
+ /** @type {Derived} */
880
+ o,
881
+ t,
882
+ n
883
+ ))
884
+ return n.set(
885
+ /** @type {Derived} */
886
+ o,
887
+ !0
888
+ ), !0;
889
+ }
890
+ return n.set(e, !1), !1;
891
+ }
892
+ function Bn(e) {
893
+ T.schedule(e);
894
+ }
895
+ function Kr(e, t) {
896
+ if (!((e.f & fe) !== 0 && (e.f & U) !== 0)) {
897
+ (e.f & B) !== 0 ? t.d.push(e) : (e.f & we) !== 0 && t.m.push(e), W(e, U);
898
+ for (var n = e.first; n !== null; )
899
+ Kr(n, t), n = n.next;
900
+ }
901
+ }
902
+ function Ur(e) {
903
+ W(e, U);
904
+ for (var t = e.first; t !== null; )
905
+ Ur(t), t = t.next;
906
+ }
907
+ let on = /* @__PURE__ */ new Set();
908
+ const qe = /* @__PURE__ */ new Map();
909
+ let Hr = !1;
910
+ function xt(e, t) {
911
+ var n = {
912
+ f: 0,
913
+ // TODO ideally we could skip this altogether, but it causes type errors
914
+ v: e,
915
+ reactions: null,
916
+ equals: Rr,
917
+ rv: 0,
918
+ wv: 0
919
+ };
920
+ return n;
921
+ }
922
+ // @__NO_SIDE_EFFECTS__
923
+ function te(e, t) {
924
+ const n = xt(e);
925
+ return no(n), n;
926
+ }
927
+ // @__NO_SIDE_EFFECTS__
928
+ function Si(e, t = !1, n = !0) {
929
+ const r = xt(e);
930
+ return t || (r.equals = Lr), r;
931
+ }
932
+ function N(e, t, n = !1) {
933
+ E !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
934
+ // to ensure we error if state is set inside an inspect effect
935
+ (!Fe || (E.f & $t) !== 0) && Mr() && (E.f & (Y | ye | ot | $t)) !== 0 && (Se === null || !Se.has(e)) && li();
936
+ let r = n ? rt(t) : t;
937
+ return Dt(e, r, Xt);
938
+ }
939
+ function Dt(e, t, n = null) {
940
+ if (!e.equals(t)) {
941
+ qe.set(e, Ke ? t : e.v);
942
+ var r = kt.ensure();
943
+ if (r.capture(e, t), (e.f & Y) !== 0) {
944
+ const o = (
945
+ /** @type {Derived} */
946
+ e
947
+ );
948
+ (e.f & B) !== 0 && jn(o), G === null && Fn(o);
949
+ }
950
+ e.wv = oo(), Yr(e, B, n), D !== null && (D.f & U) !== 0 && (D.f & (fe | Ve)) === 0 && (re === null ? Ni([e]) : re.push(e)), !r.is_fork && on.size > 0 && !Hr && Ei();
951
+ }
952
+ return t;
953
+ }
954
+ function Ei() {
955
+ Hr = !1;
956
+ for (const e of on) {
957
+ (e.f & U) !== 0 && W(e, we);
958
+ let t;
959
+ try {
960
+ t = Bt(e);
961
+ } catch {
962
+ t = !0;
963
+ }
964
+ t && dt(e);
965
+ }
966
+ on.clear();
967
+ }
968
+ function wn(e) {
969
+ N(e, e.v + 1);
970
+ }
971
+ function Yr(e, t, n) {
972
+ var r = e.reactions;
973
+ if (r !== null)
974
+ for (var o = r.length, i = 0; i < o; i++) {
975
+ var s = r[i], l = s.f, a = (l & B) === 0;
976
+ if (a && W(s, t), (l & $t) !== 0)
977
+ on.add(
978
+ /** @type {Effect} */
979
+ s
980
+ );
981
+ else if ((l & Y) !== 0) {
982
+ var c = (
983
+ /** @type {Derived} */
984
+ s
985
+ );
986
+ G == null || G.delete(c), (l & Ze) === 0 && (l & ae && (D === null || (D.f & en) === 0) && (s.f |= Ze), Yr(c, we, n));
987
+ } else if (a) {
988
+ var f = (
989
+ /** @type {Effect} */
990
+ s
991
+ );
992
+ (l & ye) !== 0 && he !== null && he.add(f), n !== null ? n.push(f) : Bn(f);
993
+ }
994
+ }
995
+ }
996
+ function rt(e) {
997
+ if (typeof e != "object" || e === null || qt in e)
998
+ return e;
999
+ const t = xr(e);
1000
+ if (t !== Ho && t !== Yo)
1001
+ return e;
1002
+ var n = /* @__PURE__ */ new Map(), r = kr(e), o = /* @__PURE__ */ te(0), i = Xe, s = (l) => {
1003
+ if (Xe === i)
1004
+ return l();
1005
+ var a = E, c = Xe;
1006
+ Ue(null), cr(i);
1007
+ var f = l();
1008
+ return Ue(a), cr(c), f;
1009
+ };
1010
+ return r && n.set("length", /* @__PURE__ */ te(
1011
+ /** @type {any[]} */
1012
+ e.length
1013
+ )), new Proxy(
1014
+ /** @type {any} */
1015
+ e,
1016
+ {
1017
+ defineProperty(l, a, c) {
1018
+ (!("value" in c) || c.configurable === !1 || c.enumerable === !1 || c.writable === !1) && ii();
1019
+ var f = n.get(a);
1020
+ return f === void 0 ? s(() => {
1021
+ var h = /* @__PURE__ */ te(c.value);
1022
+ return n.set(a, h), h;
1023
+ }) : N(f, c.value, !0), !0;
1024
+ },
1025
+ deleteProperty(l, a) {
1026
+ var c = n.get(a);
1027
+ if (c === void 0) {
1028
+ if (a in l) {
1029
+ const f = s(() => /* @__PURE__ */ te(K));
1030
+ n.set(a, f), wn(o);
1031
+ }
1032
+ } else
1033
+ N(c, K), wn(o);
1034
+ return !0;
1035
+ },
1036
+ get(l, a, c) {
1037
+ var d;
1038
+ if (a === qt)
1039
+ return e;
1040
+ var f = n.get(a), h = a in l;
1041
+ if (f === void 0 && (!h || (d = Et(l, a)) != null && d.writable) && (f = s(() => {
1042
+ var m = rt(h ? l[a] : K), y = /* @__PURE__ */ te(m);
1043
+ return y;
1044
+ }), n.set(a, f)), f !== void 0) {
1045
+ var u = p(f);
1046
+ return u === K ? void 0 : u;
1047
+ }
1048
+ return Reflect.get(l, a, c);
1049
+ },
1050
+ getOwnPropertyDescriptor(l, a) {
1051
+ var c = Reflect.getOwnPropertyDescriptor(l, a);
1052
+ if (c && "value" in c) {
1053
+ var f = n.get(a);
1054
+ f && (c.value = p(f));
1055
+ } else if (c === void 0) {
1056
+ var h = n.get(a), u = h == null ? void 0 : h.v;
1057
+ if (h !== void 0 && u !== K)
1058
+ return {
1059
+ enumerable: !0,
1060
+ configurable: !0,
1061
+ value: u,
1062
+ writable: !0
1063
+ };
1064
+ }
1065
+ return c;
1066
+ },
1067
+ has(l, a) {
1068
+ var u;
1069
+ if (a === qt)
1070
+ return !0;
1071
+ var c = n.get(a), f = c !== void 0 && c.v !== K || Reflect.has(l, a);
1072
+ if (c !== void 0 || D !== null && (!f || (u = Et(l, a)) != null && u.writable)) {
1073
+ c === void 0 && (c = s(() => {
1074
+ var d = f ? rt(l[a]) : K, m = /* @__PURE__ */ te(d);
1075
+ return m;
1076
+ }), n.set(a, c));
1077
+ var h = p(c);
1078
+ if (h === K)
1079
+ return !1;
1080
+ }
1081
+ return f;
1082
+ },
1083
+ set(l, a, c, f) {
1084
+ var I;
1085
+ var h = n.get(a), u = a in l;
1086
+ if (r && a === "length")
1087
+ for (var d = c; d < /** @type {Source<number>} */
1088
+ h.v; d += 1) {
1089
+ var m = n.get(d + "");
1090
+ m !== void 0 ? N(m, K) : d in l && (m = s(() => /* @__PURE__ */ te(K)), n.set(d + "", m));
1091
+ }
1092
+ if (h === void 0)
1093
+ (!u || (I = Et(l, a)) != null && I.writable) && (h = s(() => /* @__PURE__ */ te(void 0)), N(h, rt(c)), n.set(a, h));
1094
+ else {
1095
+ u = h.v !== K;
1096
+ var y = s(() => rt(c));
1097
+ N(h, y);
1098
+ }
1099
+ var g = Reflect.getOwnPropertyDescriptor(l, a);
1100
+ if (g != null && g.set && g.set.call(f, c), !u) {
1101
+ if (r && typeof a == "string") {
1102
+ var _ = (
1103
+ /** @type {Source<number>} */
1104
+ n.get("length")
1105
+ ), R = Number(a);
1106
+ Number.isInteger(R) && R >= _.v && N(_, R + 1);
1107
+ }
1108
+ wn(o);
1109
+ }
1110
+ return !0;
1111
+ },
1112
+ ownKeys(l) {
1113
+ p(o);
1114
+ var a = Reflect.ownKeys(l).filter((h) => {
1115
+ var u = n.get(h);
1116
+ return u === void 0 || u.v !== K;
1117
+ });
1118
+ for (var [c, f] of n)
1119
+ f.v !== K && !(c in l) && a.push(c);
1120
+ return a;
1121
+ },
1122
+ setPrototypeOf() {
1123
+ si();
1124
+ }
1125
+ }
1126
+ );
1127
+ }
1128
+ var Ii, Ti, ki;
1129
+ function je(e = "") {
1130
+ return document.createTextNode(e);
1131
+ }
1132
+ // @__NO_SIDE_EFFECTS__
1133
+ function sn(e) {
1134
+ return (
1135
+ /** @type {TemplateNode | null} */
1136
+ Ti.call(e)
1137
+ );
1138
+ }
1139
+ // @__NO_SIDE_EFFECTS__
1140
+ function jt(e) {
1141
+ return (
1142
+ /** @type {TemplateNode | null} */
1143
+ ki.call(e)
1144
+ );
1145
+ }
1146
+ function me(e, t) {
1147
+ return /* @__PURE__ */ sn(e);
1148
+ }
1149
+ function ne(e, t = !1) {
1150
+ {
1151
+ var n = /* @__PURE__ */ sn(e);
1152
+ return n instanceof Comment && n.data === "" ? /* @__PURE__ */ jt(n) : n;
1153
+ }
1154
+ }
1155
+ function ln(e, t = 1, n = !1) {
1156
+ let r = e;
1157
+ for (; t--; )
1158
+ r = /** @type {TemplateNode} */
1159
+ /* @__PURE__ */ jt(r);
1160
+ return r;
1161
+ }
1162
+ function xi(e) {
1163
+ e.textContent = "";
1164
+ }
1165
+ function zr() {
1166
+ return !1;
1167
+ }
1168
+ function Gr(e, t, n) {
1169
+ return t == null || t === Ir ? (
1170
+ /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
1171
+ n ? document.createElement(e, { is: n }) : document.createElement(e)
1172
+ ) : (
1173
+ /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
1174
+ n ? document.createElementNS(t, e, { is: n }) : document.createElementNS(t, e)
1175
+ );
1176
+ }
1177
+ function Di(e) {
1178
+ D === null && (E === null && ri(), ni()), Ke && ti();
1179
+ }
1180
+ function Pi(e, t) {
1181
+ var n = t.last;
1182
+ n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
1183
+ }
1184
+ function mt(e, t) {
1185
+ var n = D;
1186
+ n !== null && (n.f & X) !== 0 && (e |= X);
1187
+ var r = {
1188
+ ctx: ce,
1189
+ deps: null,
1190
+ nodes: null,
1191
+ f: e | B | ae,
1192
+ first: null,
1193
+ fn: t,
1194
+ last: null,
1195
+ next: null,
1196
+ parent: n,
1197
+ b: n && n.b,
1198
+ prev: null,
1199
+ teardown: null,
1200
+ wv: 0,
1201
+ ac: null
1202
+ };
1203
+ T == null || T.register_created_effect(r);
1204
+ var o = r;
1205
+ if ((e & Tt) !== 0)
1206
+ nt !== null ? nt.push(r) : kt.ensure().schedule(r);
1207
+ else if (t !== null) {
1208
+ try {
1209
+ dt(r);
1210
+ } catch (s) {
1211
+ throw xe(r), s;
1212
+ }
1213
+ o.deps === null && o.teardown === null && o.nodes === null && o.first === o.last && // either `null`, or a singular child
1214
+ (o.f & dn) === 0 && (o = o.first, (e & ye) !== 0 && (e & Be) !== 0 && o !== null && (o.f |= Be));
1215
+ }
1216
+ if (o !== null && (o.parent = n, n !== null && Pi(o, n), E !== null && (E.f & Y) !== 0 && (e & Ve) === 0)) {
1217
+ var i = (
1218
+ /** @type {Derived} */
1219
+ E
1220
+ );
1221
+ (i.effects ?? (i.effects = [])).push(o);
1222
+ }
1223
+ return r;
1224
+ }
1225
+ function qr() {
1226
+ return E !== null && !Fe;
1227
+ }
1228
+ function Xr(e) {
1229
+ const t = mt(On, null);
1230
+ return W(t, U), t.teardown = e, t;
1231
+ }
1232
+ function Kn(e) {
1233
+ Di();
1234
+ var t = (
1235
+ /** @type {Effect} */
1236
+ D.f
1237
+ ), n = !E && (t & fe) !== 0 && ce !== null && !ce.i;
1238
+ if (n) {
1239
+ var r = (
1240
+ /** @type {ComponentContext} */
1241
+ ce
1242
+ );
1243
+ (r.e ?? (r.e = [])).push(e);
1244
+ } else
1245
+ return Zr(e);
1246
+ }
1247
+ function Zr(e) {
1248
+ return mt(Tt | Zo, e);
1249
+ }
1250
+ function Ri(e) {
1251
+ return mt(ot | dn, e);
1252
+ }
1253
+ function _e(e, t = [], n = [], r = []) {
1254
+ gi(r, t, n, (o) => {
1255
+ mt(On, () => {
1256
+ e(...o.map(p));
1257
+ });
1258
+ });
1259
+ }
1260
+ function Vt(e, t = 0) {
1261
+ var n = mt(ye | t, e);
1262
+ return n;
1263
+ }
1264
+ function Pt(e) {
1265
+ return mt(fe | dn, e);
1266
+ }
1267
+ function Jr(e) {
1268
+ var t = e.teardown;
1269
+ if (t !== null) {
1270
+ const n = Ke, r = E;
1271
+ ur(!0), Ue(null);
1272
+ try {
1273
+ t.call(null);
1274
+ } finally {
1275
+ ur(n), Ue(r);
1276
+ }
1277
+ }
1278
+ }
1279
+ function Un(e, t = !1) {
1280
+ var n = e.first;
1281
+ for (e.first = e.last = null; n !== null; ) {
1282
+ const o = n.ac;
1283
+ o !== null && pn(() => {
1284
+ o.abort(Wt);
1285
+ });
1286
+ var r = n.next;
1287
+ (n.f & Ve) !== 0 ? n.parent = null : xe(n, t), n = r;
1288
+ }
1289
+ }
1290
+ function Li(e) {
1291
+ for (var t = e.first; t !== null; ) {
1292
+ var n = t.next;
1293
+ (t.f & fe) === 0 && xe(t), t = n;
1294
+ }
1295
+ }
1296
+ function xe(e, t = !0) {
1297
+ var n = !1;
1298
+ (t || (e.f & Xo) !== 0) && e.nodes !== null && e.nodes.end !== null && (Mi(
1299
+ e.nodes.start,
1300
+ /** @type {TemplateNode} */
1301
+ e.nodes.end
1302
+ ), n = !0), e.f |= or, Un(e, t && !n), Rt(e, 0);
1303
+ var r = e.nodes && e.nodes.t;
1304
+ if (r !== null)
1305
+ for (const i of r)
1306
+ i.stop();
1307
+ Jr(e), e.f ^= or, e.f |= ue;
1308
+ var o = e.parent;
1309
+ o !== null && o.first !== null && Qr(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = e.b = null;
1310
+ }
1311
+ function Mi(e, t) {
1312
+ for (; e !== null; ) {
1313
+ var n = e === t ? null : /* @__PURE__ */ jt(e);
1314
+ e.remove(), e = n;
1315
+ }
1316
+ }
1317
+ function Qr(e) {
1318
+ var t = e.parent, n = e.prev, r = e.next;
1319
+ n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
1320
+ }
1321
+ function Hn(e, t, n = !0) {
1322
+ var r = [];
1323
+ $r(e, r, !0);
1324
+ var o = () => {
1325
+ n && xe(e), t && t();
1326
+ }, i = r.length;
1327
+ if (i > 0) {
1328
+ var s = () => --i || o();
1329
+ for (var l of r)
1330
+ l.out(s);
1331
+ } else
1332
+ o();
1333
+ }
1334
+ function $r(e, t, n) {
1335
+ if ((e.f & X) === 0) {
1336
+ e.f ^= X;
1337
+ var r = e.nodes && e.nodes.t;
1338
+ if (r !== null)
1339
+ for (const l of r)
1340
+ (l.is_global || n) && t.push(l);
1341
+ for (var o = e.first; o !== null; ) {
1342
+ var i = o.next;
1343
+ if ((o.f & Ve) === 0) {
1344
+ var s = (o.f & Be) !== 0 || // If this is a branch effect without a block effect parent,
1345
+ // it means the parent block effect was pruned. In that case,
1346
+ // transparency information was transferred to the branch effect.
1347
+ (o.f & fe) !== 0 && (e.f & ye) !== 0;
1348
+ $r(o, t, s ? n : !1);
1349
+ }
1350
+ o = i;
1351
+ }
1352
+ }
1353
+ }
1354
+ function an(e) {
1355
+ eo(e, !0);
1356
+ }
1357
+ function eo(e, t) {
1358
+ if ((e.f & X) !== 0) {
1359
+ e.f ^= X, (e.f & U) === 0 && (W(e, B), kt.ensure().schedule(e));
1360
+ for (var n = e.first; n !== null; ) {
1361
+ var r = n.next, o = (n.f & Be) !== 0 || (n.f & fe) !== 0;
1362
+ eo(n, o ? t : !1), n = r;
1363
+ }
1364
+ var i = e.nodes && e.nodes.t;
1365
+ if (i !== null)
1366
+ for (const s of i)
1367
+ (s.is_global || t) && s.in();
1368
+ }
1369
+ }
1370
+ function to(e, t) {
1371
+ if (e.nodes)
1372
+ for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
1373
+ var o = n === r ? null : /* @__PURE__ */ jt(n);
1374
+ t.append(n), n = o;
1375
+ }
1376
+ }
1377
+ let Zt = !1, Ke = !1;
1378
+ function ur(e) {
1379
+ Ke = e;
1380
+ }
1381
+ let E = null, Fe = !1;
1382
+ function Ue(e) {
1383
+ E = e;
1384
+ }
1385
+ let D = null;
1386
+ function ft(e) {
1387
+ D = e;
1388
+ }
1389
+ let Se = null;
1390
+ function no(e) {
1391
+ E !== null && (Se ?? (Se = /* @__PURE__ */ new Set())).add(e);
1392
+ }
1393
+ let Q = null, $ = 0, re = null;
1394
+ function Ni(e) {
1395
+ re = e;
1396
+ }
1397
+ let ro = 1, He = 0, Xe = He;
1398
+ function cr(e) {
1399
+ Xe = e;
1400
+ }
1401
+ function oo() {
1402
+ return ++ro;
1403
+ }
1404
+ function Bt(e) {
1405
+ var t = e.f;
1406
+ if ((t & B) !== 0)
1407
+ return !0;
1408
+ if (t & Y && (e.f &= ~Ze), (t & we) !== 0) {
1409
+ for (var n = (
1410
+ /** @type {Value[]} */
1411
+ e.deps
1412
+ ), r = n.length, o = 0; o < r; o++) {
1413
+ var i = n[o];
1414
+ if (Bt(
1415
+ /** @type {Derived} */
1416
+ i
1417
+ ) && Fr(
1418
+ /** @type {Derived} */
1419
+ i
1420
+ ), i.wv > e.wv)
1421
+ return !0;
1422
+ }
1423
+ (t & ae) !== 0 && // During time traveling we don't want to reset the status so that
1424
+ // traversal of the graph in the other batches still happens
1425
+ G === null && W(e, U);
1426
+ }
1427
+ return !1;
1428
+ }
1429
+ function io(e, t, n = !0) {
1430
+ var r = e.reactions;
1431
+ if (r !== null && !(Se !== null && Se.has(e)))
1432
+ for (var o = 0; o < r.length; o++) {
1433
+ var i = r[o];
1434
+ (i.f & Y) !== 0 ? io(
1435
+ /** @type {Derived} */
1436
+ i,
1437
+ t,
1438
+ !1
1439
+ ) : t === i && (n ? W(i, B) : (i.f & U) !== 0 && W(i, we), Bn(
1440
+ /** @type {Effect} */
1441
+ i
1442
+ ));
1443
+ }
1444
+ }
1445
+ function so(e) {
1446
+ var y;
1447
+ var t = Q, n = $, r = re, o = E, i = Se, s = ce, l = Fe, a = Xe, c = e.f;
1448
+ Q = /** @type {null | Value[]} */
1449
+ null, $ = 0, re = null, E = (c & (fe | Ve)) === 0 ? e : null, Se = null, tn(e.ctx), Fe = !1, Xe = ++He, e.ac !== null && (pn(() => {
1450
+ e.ac.abort(Wt);
1451
+ }), e.ac = null);
1452
+ try {
1453
+ e.f |= en;
1454
+ var f = (
1455
+ /** @type {Function} */
1456
+ e.fn
1457
+ ), h = f();
1458
+ e.f |= vt;
1459
+ var u = e.deps, d = T == null ? void 0 : T.is_fork;
1460
+ if (Q !== null) {
1461
+ var m;
1462
+ if (d || Rt(e, $), u !== null && $ > 0)
1463
+ for (u.length = $ + Q.length, m = 0; m < Q.length; m++)
1464
+ u[$ + m] = Q[m];
1465
+ else
1466
+ e.deps = u = Q;
1467
+ if (qr() && (e.f & ae) !== 0)
1468
+ for (m = $; m < u.length; m++)
1469
+ ((y = u[m]).reactions ?? (y.reactions = [])).push(e);
1470
+ } else !d && u !== null && $ < u.length && (Rt(e, $), u.length = $);
1471
+ if (Mr() && re !== null && !Fe && u !== null && (e.f & (Y | we | B)) === 0)
1472
+ for (m = 0; m < /** @type {Source[]} */
1473
+ re.length; m++)
1474
+ io(
1475
+ re[m],
1476
+ /** @type {Effect} */
1477
+ e
1478
+ );
1479
+ if (o !== null && o !== e) {
1480
+ if (He++, o.deps !== null)
1481
+ for (let g = 0; g < n; g += 1)
1482
+ o.deps[g].rv = He;
1483
+ if (t !== null)
1484
+ for (const g of t)
1485
+ g.rv = He;
1486
+ re !== null && (r === null ? r = re : r.push(.../** @type {Source[]} */
1487
+ re));
1488
+ }
1489
+ return (e.f & We) !== 0 && (e.f ^= We), h;
1490
+ } catch (g) {
1491
+ return di(g);
1492
+ } finally {
1493
+ e.f ^= en, Q = t, $ = n, re = r, E = o, Se = i, tn(s), Fe = l, Xe = a;
1494
+ }
1495
+ }
1496
+ function Oi(e, t) {
1497
+ let n = t.reactions;
1498
+ if (n !== null) {
1499
+ var r = Ko.call(n, e);
1500
+ if (r !== -1) {
1501
+ var o = n.length - 1;
1502
+ o === 0 ? n = t.reactions = null : (n[r] = n[o], n.pop());
1503
+ }
1504
+ }
1505
+ if (n === null && (t.f & Y) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1506
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1507
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1508
+ (Q === null || !Qt.call(Q, t))) {
1509
+ var i = (
1510
+ /** @type {Derived} */
1511
+ t
1512
+ );
1513
+ (i.f & ae) !== 0 && (i.f ^= ae, i.f &= ~Ze), i.v !== K && Fn(i), i.ac !== null && pn(() => {
1514
+ i.ac.abort(Wt), i.ac = null, W(i, B);
1515
+ }), wi(i), Rt(i, 0);
1516
+ }
1517
+ }
1518
+ function Rt(e, t) {
1519
+ var n = e.deps;
1520
+ if (n !== null)
1521
+ for (var r = t; r < n.length; r++)
1522
+ Oi(e, n[r]);
1523
+ }
1524
+ function dt(e) {
1525
+ var t = e.f;
1526
+ if ((t & ue) === 0) {
1527
+ W(e, U);
1528
+ var n = D, r = Zt;
1529
+ D = e, Zt = (t & (fe | Ve)) === 0;
1530
+ try {
1531
+ (t & (ye | Pr)) !== 0 ? Li(e) : Un(e), Jr(e);
1532
+ var o = so(e);
1533
+ e.teardown = typeof o == "function" ? o : null, e.wv = ro;
1534
+ var i;
1535
+ Tr && ci && (e.f & B) !== 0 && e.deps;
1536
+ } finally {
1537
+ Zt = r, D = n;
1538
+ }
1539
+ }
1540
+ }
1541
+ function p(e) {
1542
+ var t = e.f, n = (t & Y) !== 0;
1543
+ if (E !== null && !Fe) {
1544
+ var r = D !== null && (D.f & ue) !== 0;
1545
+ if (!r && (Se === null || !Se.has(e))) {
1546
+ var o = E.deps;
1547
+ if ((E.f & en) !== 0)
1548
+ e.rv < He && (e.rv = He, Q === null && o !== null && o[$] === e ? $++ : Q === null ? Q = [e] : Q.push(e));
1549
+ else {
1550
+ E.deps ?? (E.deps = []), Qt.call(E.deps, e) || E.deps.push(e);
1551
+ var i = e.reactions;
1552
+ i === null ? e.reactions = [E] : Qt.call(i, E) || i.push(E);
1553
+ }
1554
+ }
1555
+ }
1556
+ if (Ke && qe.has(e))
1557
+ return qe.get(e);
1558
+ if (n) {
1559
+ var s = (
1560
+ /** @type {Derived} */
1561
+ e
1562
+ );
1563
+ if (Ke) {
1564
+ var l = s.v;
1565
+ return ((s.f & U) === 0 && s.reactions !== null || ao(s)) && (l = jn(s)), qe.set(s, l), l;
1566
+ }
1567
+ var a = (s.f & ae) === 0 && !Fe && E !== null && (Zt || (E.f & ae) !== 0), c = (s.f & vt) === 0;
1568
+ Bt(s) && (a && (s.f |= ae), Fr(s)), a && !c && (Wr(s), lo(s));
1569
+ }
1570
+ if (G != null && G.has(e))
1571
+ return G.get(e);
1572
+ if ((e.f & We) !== 0)
1573
+ throw e.v;
1574
+ return e.v;
1575
+ }
1576
+ function lo(e) {
1577
+ if (e.f |= ae, e.deps !== null)
1578
+ for (const t of e.deps)
1579
+ (t.reactions ?? (t.reactions = [])).push(e), (t.f & Y) !== 0 && (t.f & ae) === 0 && (Wr(
1580
+ /** @type {Derived} */
1581
+ t
1582
+ ), lo(
1583
+ /** @type {Derived} */
1584
+ t
1585
+ ));
1586
+ }
1587
+ function ao(e) {
1588
+ if (e.v === K) return !0;
1589
+ if (e.deps === null) return !1;
1590
+ for (const t of e.deps)
1591
+ if (qe.has(t) || (t.f & Y) !== 0 && ao(
1592
+ /** @type {Derived} */
1593
+ t
1594
+ ))
1595
+ return !0;
1596
+ return !1;
1597
+ }
1598
+ var Sr;
1599
+ const bn = (
1600
+ // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
1601
+ ((Sr = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : Sr.trustedTypes) && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
1602
+ /** @param {string} html */
1603
+ createHTML: (e) => e
1604
+ })
1605
+ );
1606
+ function Fi(e) {
1607
+ return (
1608
+ /** @type {string} */
1609
+ (bn == null ? void 0 : bn.createHTML(e)) ?? e
1610
+ );
1611
+ }
1612
+ function Wi(e) {
1613
+ var t = Gr("template");
1614
+ return t.innerHTML = Fi(e.replaceAll("<!>", "<!---->")), t.content;
1615
+ }
1616
+ function Lt(e, t) {
1617
+ var n = (
1618
+ /** @type {Effect} */
1619
+ D
1620
+ );
1621
+ n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
1622
+ }
1623
+ // @__NO_SIDE_EFFECTS__
1624
+ function Le(e, t) {
1625
+ var n = (t & jo) !== 0, r = (t & Vo) !== 0, o, i = !e.startsWith("<!>");
1626
+ return () => {
1627
+ o === void 0 && (o = Wi(i ? e : "<!>" + e), n || (o = /** @type {TemplateNode} */
1628
+ /* @__PURE__ */ sn(o)));
1629
+ var s = (
1630
+ /** @type {TemplateNode} */
1631
+ r || Ii ? document.importNode(o, !0) : o.cloneNode(!0)
1632
+ );
1633
+ if (n) {
1634
+ var l = (
1635
+ /** @type {TemplateNode} */
1636
+ /* @__PURE__ */ sn(s)
1637
+ ), a = (
1638
+ /** @type {TemplateNode} */
1639
+ s.lastChild
1640
+ );
1641
+ Lt(l, a);
1642
+ } else
1643
+ Lt(s, s);
1644
+ return s;
1645
+ };
1646
+ }
1647
+ function uo(e = "") {
1648
+ {
1649
+ var t = je(e + "");
1650
+ return Lt(t, t), t;
1651
+ }
1652
+ }
1653
+ function se() {
1654
+ var e = document.createDocumentFragment(), t = document.createComment(""), n = je();
1655
+ return e.append(t, n), Lt(t, n), e;
1656
+ }
1657
+ function F(e, t) {
1658
+ e !== null && e.before(
1659
+ /** @type {Node} */
1660
+ t
1661
+ );
1662
+ }
1663
+ function Yn(e, t) {
1664
+ var n = t == null ? "" : typeof t == "object" ? `${t}` : t;
1665
+ n !== /** @type {any} */
1666
+ (e[Yt] ?? (e[Yt] = e.nodeValue)) && (e[Yt] = n, e.nodeValue = `${n}`);
1667
+ }
1668
+ var ve, Ce, ee, Ge, Ot, Ft, fn;
1669
+ class hn {
1670
+ /**
1671
+ * @param {TemplateNode} anchor
1672
+ * @param {boolean} transition
1673
+ */
1674
+ constructor(t, n = !0) {
1675
+ /** @type {TemplateNode} */
1676
+ pe(this, "anchor");
1677
+ /** @type {Map<Batch, Key>} */
1678
+ O(this, ve, /* @__PURE__ */ new Map());
1679
+ /**
1680
+ * Map of keys to effects that are currently rendered in the DOM.
1681
+ * These effects are visible and actively part of the document tree.
1682
+ * Example:
1683
+ * ```
1684
+ * {#if condition}
1685
+ * foo
1686
+ * {:else}
1687
+ * bar
1688
+ * {/if}
1689
+ * ```
1690
+ * Can result in the entries `true->Effect` and `false->Effect`
1691
+ * @type {Map<Key, Effect>}
1692
+ */
1693
+ O(this, Ce, /* @__PURE__ */ new Map());
1694
+ /**
1695
+ * Similar to #onscreen with respect to the keys, but contains branches that are not yet
1696
+ * in the DOM, because their insertion is deferred.
1697
+ * @type {Map<Key, Branch>}
1698
+ */
1699
+ O(this, ee, /* @__PURE__ */ new Map());
1700
+ /**
1701
+ * Keys of effects that are currently outroing
1702
+ * @type {Set<Key>}
1703
+ */
1704
+ O(this, Ge, /* @__PURE__ */ new Set());
1705
+ /**
1706
+ * Whether to pause (i.e. outro) on change, or destroy immediately.
1707
+ * This is necessary for `<svelte:element>`
1708
+ */
1709
+ O(this, Ot, !0);
1710
+ /**
1711
+ * @param {Batch} batch
1712
+ */
1713
+ O(this, Ft, (t) => {
1714
+ if (v(this, ve).has(t)) {
1715
+ var n = (
1716
+ /** @type {Key} */
1717
+ v(this, ve).get(t)
1718
+ ), r = v(this, Ce).get(n);
1719
+ if (r)
1720
+ an(r), v(this, Ge).delete(n);
1721
+ else {
1722
+ var o = v(this, ee).get(n);
1723
+ o && (an(o.effect), v(this, Ce).set(n, o.effect), v(this, ee).delete(n), o.fragment.lastChild.remove(), this.anchor.before(o.fragment), r = o.effect);
1724
+ }
1725
+ for (const [i, s] of v(this, ve)) {
1726
+ if (v(this, ve).delete(i), i === t)
1727
+ break;
1728
+ const l = v(this, ee).get(s);
1729
+ l && (xe(l.effect), v(this, ee).delete(s));
1730
+ }
1731
+ for (const [i, s] of v(this, Ce)) {
1732
+ if (i === n || v(this, Ge).has(i)) continue;
1733
+ const l = () => {
1734
+ if (Array.from(v(this, ve).values()).includes(i)) {
1735
+ var c = document.createDocumentFragment();
1736
+ to(s, c), c.append(je()), v(this, ee).set(i, { effect: s, fragment: c });
1737
+ } else
1738
+ xe(s);
1739
+ v(this, Ge).delete(i), v(this, Ce).delete(i);
1740
+ };
1741
+ v(this, Ot) || !r ? (v(this, Ge).add(i), Hn(s, l, !1)) : l();
1742
+ }
1743
+ }
1744
+ });
1745
+ /**
1746
+ * @param {Batch} batch
1747
+ */
1748
+ O(this, fn, (t) => {
1749
+ v(this, ve).delete(t);
1750
+ const n = Array.from(v(this, ve).values());
1751
+ for (const [r, o] of v(this, ee))
1752
+ n.includes(r) || (xe(o.effect), v(this, ee).delete(r));
1753
+ });
1754
+ this.anchor = t, Z(this, Ot, n);
1755
+ }
1756
+ /**
1757
+ *
1758
+ * @param {any} key
1759
+ * @param {null | ((target: TemplateNode) => void)} fn
1760
+ */
1761
+ ensure(t, n) {
1762
+ var r = (
1763
+ /** @type {Batch} */
1764
+ T
1765
+ ), o = zr();
1766
+ if (n && !v(this, Ce).has(t) && !v(this, ee).has(t))
1767
+ if (o) {
1768
+ var i = document.createDocumentFragment(), s = je();
1769
+ i.append(s), v(this, ee).set(t, {
1770
+ effect: Pt(() => n(s)),
1771
+ fragment: i
1772
+ });
1773
+ } else
1774
+ v(this, Ce).set(
1775
+ t,
1776
+ Pt(() => n(this.anchor))
1777
+ );
1778
+ if (v(this, ve).set(r, t), o) {
1779
+ for (const [l, a] of v(this, Ce))
1780
+ l === t ? r.unskip_effect(a) : r.skip_effect(a);
1781
+ for (const [l, a] of v(this, ee))
1782
+ l === t ? r.unskip_effect(a.effect) : r.skip_effect(a.effect);
1783
+ r.oncommit(v(this, Ft)), r.ondiscard(v(this, fn));
1784
+ } else
1785
+ v(this, Ft).call(this, r);
1786
+ }
1787
+ }
1788
+ ve = new WeakMap(), Ce = new WeakMap(), ee = new WeakMap(), Ge = new WeakMap(), Ot = new WeakMap(), Ft = new WeakMap(), fn = new WeakMap();
1789
+ function zn(e, t, ...n) {
1790
+ var r = new hn(e);
1791
+ Vt(() => {
1792
+ const o = t() ?? null;
1793
+ r.ensure(o, o && ((i) => o(i, ...n)));
1794
+ }, Be);
1795
+ }
1796
+ function De(e, t, n = !1) {
1797
+ var r = new hn(e), o = n ? Be : 0;
1798
+ function i(s, l) {
1799
+ r.ensure(s, l);
1800
+ }
1801
+ Vt(() => {
1802
+ var s = !1;
1803
+ t((l, a = 0) => {
1804
+ s = !0, i(a, l);
1805
+ }), s || i(-1, null);
1806
+ }, o);
1807
+ }
1808
+ function ji(e, t, n) {
1809
+ for (var r = [], o = t.length, i, s = t.length, l = 0; l < o; l++) {
1810
+ let h = t[l];
1811
+ Hn(
1812
+ h,
1813
+ () => {
1814
+ if (i) {
1815
+ if (i.pending.delete(h), i.done.add(h), i.pending.size === 0) {
1816
+ var u = (
1817
+ /** @type {Set<EachOutroGroup>} */
1818
+ e.outrogroups
1819
+ );
1820
+ Rn(e, Nn(i.done)), u.delete(i), u.size === 0 && (e.outrogroups = null);
1821
+ }
1822
+ } else
1823
+ s -= 1;
1824
+ },
1825
+ !1
1826
+ );
1827
+ }
1828
+ if (s === 0) {
1829
+ var a = r.length === 0 && n !== null && e.pending.size === 0;
1830
+ if (a) {
1831
+ var c = (
1832
+ /** @type {Element} */
1833
+ n
1834
+ ), f = (
1835
+ /** @type {Element} */
1836
+ c.parentNode
1837
+ );
1838
+ xi(f), f.append(c), e.items.clear();
1839
+ }
1840
+ Rn(e, t, !a);
1841
+ } else
1842
+ i = {
1843
+ pending: new Set(t),
1844
+ done: /* @__PURE__ */ new Set()
1845
+ }, (e.outrogroups ?? (e.outrogroups = /* @__PURE__ */ new Set())).add(i);
1846
+ }
1847
+ function Rn(e, t, n = !0) {
1848
+ var r;
1849
+ if (e.pending.size > 0) {
1850
+ r = /* @__PURE__ */ new Set();
1851
+ for (const s of e.pending.values())
1852
+ for (const l of s)
1853
+ r.add(
1854
+ /** @type {EachItem} */
1855
+ e.items.get(l).e
1856
+ );
1857
+ }
1858
+ for (var o = 0; o < t.length; o++) {
1859
+ var i = t[o];
1860
+ if (r != null && r.has(i)) {
1861
+ i.f |= Ae;
1862
+ const s = document.createDocumentFragment();
1863
+ to(i, s);
1864
+ } else
1865
+ xe(t[o], n);
1866
+ }
1867
+ }
1868
+ var fr;
1869
+ function Ln(e, t, n, r, o, i = null) {
1870
+ var s = e, l = /* @__PURE__ */ new Map(), a = (t & Er) !== 0;
1871
+ if (a) {
1872
+ var c = (
1873
+ /** @type {Element} */
1874
+ e
1875
+ );
1876
+ s = c.appendChild(je());
1877
+ }
1878
+ var f = null, h = /* @__PURE__ */ yi(() => {
1879
+ var I = n();
1880
+ return (
1881
+ /** @type {V[]} */
1882
+ kr(I) ? I : I == null ? [] : Nn(I)
1883
+ );
1884
+ }), u, d = /* @__PURE__ */ new Map(), m = !0;
1885
+ function y(I) {
1886
+ (R.effect.f & ue) === 0 && (R.pending.delete(I), R.fallback = f, Vi(R, u, s, t, r), f !== null && (u.length === 0 ? (f.f & Ae) === 0 ? an(f) : (f.f ^= Ae, St(f, null, s)) : Hn(f, () => {
1887
+ f = null;
1888
+ })));
1889
+ }
1890
+ function g(I) {
1891
+ R.pending.delete(I);
1892
+ }
1893
+ var _ = Vt(() => {
1894
+ u = /** @type {V[]} */
1895
+ p(h);
1896
+ for (var I = u.length, j = /* @__PURE__ */ new Set(), x = (
1897
+ /** @type {Batch} */
1898
+ T
1899
+ ), k = zr(), S = 0; S < I; S += 1) {
1900
+ var w = u[S], C = r(w, S), b = m ? null : l.get(C);
1901
+ b ? (b.v && Dt(b.v, w), b.i && Dt(b.i, S), k && x.unskip_effect(b.e)) : (b = Bi(
1902
+ l,
1903
+ m ? s : fr ?? (fr = je()),
1904
+ w,
1905
+ C,
1906
+ S,
1907
+ o,
1908
+ t,
1909
+ n
1910
+ ), m || (b.e.f |= Ae), l.set(C, b)), j.add(C);
1911
+ }
1912
+ if (I === 0 && i && !f && (m ? f = Pt(() => i(s)) : (f = Pt(() => i(fr ?? (fr = je()))), f.f |= Ae)), I > j.size && ei(), !m)
1913
+ if (d.set(x, j), k) {
1914
+ for (const [L, z] of l)
1915
+ j.has(L) || x.skip_effect(z.e);
1916
+ x.oncommit(y), x.ondiscard(g);
1917
+ } else
1918
+ y(x);
1919
+ p(h);
1920
+ }), R = { effect: _, items: l, pending: d, outrogroups: null, fallback: f };
1921
+ m = !1;
1922
+ }
1923
+ function wt(e) {
1924
+ for (; e !== null && (e.f & fe) === 0; )
1925
+ e = e.next;
1926
+ return e;
1927
+ }
1928
+ function Vi(e, t, n, r, o) {
1929
+ var b, L, z, M, q, Je, Ut, Ie, Qe;
1930
+ var i = (r & Fo) !== 0, s = t.length, l = e.items, a = wt(e.effect.first), c, f = null, h, u = [], d = [], m, y, g, _;
1931
+ if (i)
1932
+ for (_ = 0; _ < s; _ += 1)
1933
+ m = t[_], y = o(m, _), g = /** @type {EachItem} */
1934
+ l.get(y).e, (g.f & Ae) === 0 && ((L = (b = g.nodes) == null ? void 0 : b.a) == null || L.measure(), (h ?? (h = /* @__PURE__ */ new Set())).add(g));
1935
+ for (_ = 0; _ < s; _ += 1) {
1936
+ if (m = t[_], y = o(m, _), g = /** @type {EachItem} */
1937
+ l.get(y).e, e.outrogroups !== null)
1938
+ for (const de of e.outrogroups)
1939
+ de.pending.delete(g), de.done.delete(g);
1940
+ if ((g.f & X) !== 0 && (an(g), i && ((M = (z = g.nodes) == null ? void 0 : z.a) == null || M.unfix(), (h ?? (h = /* @__PURE__ */ new Set())).delete(g))), (g.f & Ae) !== 0)
1941
+ if (g.f ^= Ae, g === a)
1942
+ St(g, null, n);
1943
+ else {
1944
+ var R = f ? f.next : a;
1945
+ g === e.effect.last && (e.effect.last = g.prev), g.prev && (g.prev.next = g.next), g.next && (g.next.prev = g.prev), Ne(e, f, g), Ne(e, g, R), St(g, R, n), f = g, u = [], d = [], a = wt(f.next);
1946
+ continue;
1947
+ }
1948
+ if (g !== a) {
1949
+ if (c !== void 0 && c.has(g)) {
1950
+ if (u.length < d.length) {
1951
+ var I = d[0], j;
1952
+ f = I.prev;
1953
+ var x = u[0], k = u[u.length - 1];
1954
+ for (j = 0; j < u.length; j += 1)
1955
+ St(u[j], I, n);
1956
+ for (j = 0; j < d.length; j += 1)
1957
+ c.delete(d[j]);
1958
+ Ne(e, x.prev, k.next), Ne(e, f, x), Ne(e, k, I), a = I, f = k, _ -= 1, u = [], d = [];
1959
+ } else
1960
+ c.delete(g), St(g, a, n), Ne(e, g.prev, g.next), Ne(e, g, f === null ? e.effect.first : f.next), Ne(e, f, g), f = g;
1961
+ continue;
1962
+ }
1963
+ for (u = [], d = []; a !== null && a !== g; )
1964
+ (c ?? (c = /* @__PURE__ */ new Set())).add(a), d.push(a), a = wt(a.next);
1965
+ if (a === null)
1966
+ continue;
1967
+ }
1968
+ (g.f & Ae) === 0 && u.push(g), f = g, a = wt(g.next);
1969
+ }
1970
+ if (e.outrogroups !== null) {
1971
+ for (const de of e.outrogroups)
1972
+ de.pending.size === 0 && (Rn(e, Nn(de.done)), (q = e.outrogroups) == null || q.delete(de));
1973
+ e.outrogroups.size === 0 && (e.outrogroups = null);
1974
+ }
1975
+ if (a !== null || c !== void 0) {
1976
+ var S = [];
1977
+ if (c !== void 0)
1978
+ for (g of c)
1979
+ (g.f & X) === 0 && S.push(g);
1980
+ for (; a !== null; )
1981
+ (a.f & X) === 0 && a !== e.fallback && S.push(a), a = wt(a.next);
1982
+ var w = S.length;
1983
+ if (w > 0) {
1984
+ var C = (r & Er) !== 0 && s === 0 ? n : null;
1985
+ if (i) {
1986
+ for (_ = 0; _ < w; _ += 1)
1987
+ (Ut = (Je = S[_].nodes) == null ? void 0 : Je.a) == null || Ut.measure();
1988
+ for (_ = 0; _ < w; _ += 1)
1989
+ (Qe = (Ie = S[_].nodes) == null ? void 0 : Ie.a) == null || Qe.fix();
1990
+ }
1991
+ ji(e, S, C);
1992
+ }
1993
+ }
1994
+ i && kn(() => {
1995
+ var de, Ht;
1996
+ if (h !== void 0)
1997
+ for (g of h)
1998
+ (Ht = (de = g.nodes) == null ? void 0 : de.a) == null || Ht.apply();
1999
+ });
2000
+ }
2001
+ function Bi(e, t, n, r, o, i, s, l) {
2002
+ var a = (s & No) !== 0 ? (s & Wo) === 0 ? /* @__PURE__ */ Si(n, !1, !1) : xt(n) : null, c = (s & Oo) !== 0 ? xt(o) : null;
2003
+ return {
2004
+ v: a,
2005
+ i: c,
2006
+ e: Pt(() => (i(t, a ?? n, c ?? o, l), () => {
2007
+ e.delete(r);
2008
+ }))
2009
+ };
2010
+ }
2011
+ function St(e, t, n) {
2012
+ if (e.nodes)
2013
+ for (var r = e.nodes.start, o = e.nodes.end, i = t && (t.f & Ae) === 0 ? (
2014
+ /** @type {EffectNodes} */
2015
+ t.nodes.start
2016
+ ) : n; r !== null; ) {
2017
+ var s = (
2018
+ /** @type {TemplateNode} */
2019
+ /* @__PURE__ */ jt(r)
2020
+ );
2021
+ if (i.before(r), r === o)
2022
+ return;
2023
+ r = s;
2024
+ }
2025
+ }
2026
+ function Ne(e, t, n) {
2027
+ t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
2028
+ }
2029
+ function Cn(e, t, n) {
2030
+ var r = new hn(e);
2031
+ Vt(() => {
2032
+ var o = t() ?? null;
2033
+ r.ensure(o, o && ((i) => n(i, o)));
2034
+ }, Be);
2035
+ }
2036
+ function co(e, t, n, r, o, i) {
2037
+ var s = null, l = (
2038
+ /** @type {TemplateNode} */
2039
+ e
2040
+ ), a = new hn(l, !1);
2041
+ Vt(() => {
2042
+ const c = t() || null;
2043
+ var f = c === "svg" ? Bo : void 0;
2044
+ if (c === null) {
2045
+ a.ensure(null, null);
2046
+ return;
2047
+ }
2048
+ return a.ensure(c, (h) => {
2049
+ if (c) {
2050
+ if (s = Gr(c, f), Lt(s, s), r) {
2051
+ var u = null, d = s.appendChild(je());
2052
+ r(s, d), u == null || u.remove();
2053
+ }
2054
+ D.nodes.end = s, h.before(s);
2055
+ }
2056
+ }), () => {
2057
+ };
2058
+ }, Be), Xr(() => {
2059
+ });
2060
+ }
2061
+ function fo(e) {
2062
+ var t, n, r = "";
2063
+ if (typeof e == "string" || typeof e == "number") r += e;
2064
+ else if (typeof e == "object") if (Array.isArray(e)) {
2065
+ var o = e.length;
2066
+ for (t = 0; t < o; t++) e[t] && (n = fo(e[t])) && (r && (r += " "), r += n);
2067
+ } else for (n in e) e[n] && (r && (r += " "), r += n);
2068
+ return r;
2069
+ }
2070
+ function Ki() {
2071
+ for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = fo(e)) && (r && (r += " "), r += t);
2072
+ return r;
2073
+ }
2074
+ function un(e) {
2075
+ return typeof e == "object" ? Ki(e) : e ?? "";
2076
+ }
2077
+ function Ui(e, t, n) {
2078
+ var r = e == null ? "" : "" + e;
2079
+ return r === "" ? null : r;
2080
+ }
2081
+ function Hi(e, t) {
2082
+ return e == null ? null : String(e);
2083
+ }
2084
+ function Mt(e, t, n, r, o, i) {
2085
+ var s = (
2086
+ /** @type {any} */
2087
+ e[ir]
2088
+ );
2089
+ if (s !== n || s === void 0) {
2090
+ var l = Ui(n);
2091
+ l == null ? e.removeAttribute("class") : e.className = l, e[ir] = n;
2092
+ }
2093
+ return i;
2094
+ }
2095
+ function oe(e, t, n, r) {
2096
+ var o = (
2097
+ /** @type {any} */
2098
+ e[sr]
2099
+ );
2100
+ if (o !== t) {
2101
+ var i = Hi(t);
2102
+ i == null ? e.removeAttribute("style") : e.style.cssText = i, e[sr] = t;
2103
+ }
2104
+ return r;
2105
+ }
2106
+ const Yi = Symbol("is custom element"), zi = Symbol("is html");
2107
+ function Gn(e, t, n, r) {
2108
+ var o = Gi(e);
2109
+ o[t] !== (o[t] = n) && (t === "loading" && (e[Qo] = n), n == null ? e.removeAttribute(t) : typeof n != "string" && qi(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
2110
+ }
2111
+ function Gi(e) {
2112
+ return (
2113
+ /** @type {Record<string | symbol, unknown>} **/
2114
+ /** @type {any} */
2115
+ e[mn] ?? (e[mn] = {
2116
+ [Yi]: e.nodeName.includes("-"),
2117
+ [zi]: e.namespaceURI === Ir
2118
+ })
2119
+ );
2120
+ }
2121
+ var dr = /* @__PURE__ */ new Map();
2122
+ function qi(e) {
2123
+ var t = e.getAttribute("is") || e.nodeName, n = dr.get(t);
2124
+ if (n) return n;
2125
+ dr.set(t, n = []);
2126
+ for (var r, o = e, i = Element.prototype; i !== o; ) {
2127
+ r = Uo(o);
2128
+ for (var s in r)
2129
+ r[s].set && // better safe than sorry, we don't want spread attributes to mess with HTML content
2130
+ s !== "innerHTML" && s !== "textContent" && s !== "innerText" && n.push(s);
2131
+ o = xr(o);
2132
+ }
2133
+ return n;
2134
+ }
2135
+ const Xi = {
2136
+ get(e, t) {
2137
+ let n = e.props.length;
2138
+ for (; n--; ) {
2139
+ let r = e.props[n];
2140
+ if (_t(r) && (r = r()), typeof r == "object" && r !== null && t in r) return r[t];
2141
+ }
2142
+ },
2143
+ set(e, t, n) {
2144
+ let r = e.props.length;
2145
+ for (; r--; ) {
2146
+ let o = e.props[r];
2147
+ _t(o) && (o = o());
2148
+ const i = Et(o, t);
2149
+ if (i && i.set)
2150
+ return i.set(n), !0;
2151
+ }
2152
+ return !1;
2153
+ },
2154
+ getOwnPropertyDescriptor(e, t) {
2155
+ let n = e.props.length;
2156
+ for (; n--; ) {
2157
+ let r = e.props[n];
2158
+ if (_t(r) && (r = r()), typeof r == "object" && r !== null && t in r) {
2159
+ const o = Et(r, t);
2160
+ return o && !o.configurable && (o.configurable = !0), o;
2161
+ }
2162
+ }
2163
+ },
2164
+ has(e, t) {
2165
+ if (t === qt || t === Jo) return !1;
2166
+ for (let n of e.props)
2167
+ if (_t(n) && (n = n()), n != null && t in n) return !0;
2168
+ return !1;
2169
+ },
2170
+ ownKeys(e) {
2171
+ const t = [];
2172
+ for (let n of e.props)
2173
+ if (_t(n) && (n = n()), !!n) {
2174
+ for (const r in n)
2175
+ t.includes(r) || t.push(r);
2176
+ for (const r of Object.getOwnPropertySymbols(n))
2177
+ t.includes(r) || t.push(r);
2178
+ }
2179
+ return t;
2180
+ }
2181
+ };
2182
+ function An(...e) {
2183
+ return new Proxy({ props: e }, Xi);
2184
+ }
2185
+ function le(e, t, n, r) {
2186
+ var o = (
2187
+ /** @type {V} */
2188
+ r
2189
+ ), i = !0, s = () => (i && (i = !1, o = /** @type {V} */
2190
+ r), o), l;
2191
+ l = /** @type {V} */
2192
+ e[t], l === void 0 && r !== void 0 && (l = s());
2193
+ var a;
2194
+ return a = () => {
2195
+ var c = (
2196
+ /** @type {V} */
2197
+ e[t]
2198
+ );
2199
+ return c === void 0 ? s() : (i = !0, c);
2200
+ }, a;
2201
+ }
2202
+ const Kt = "default";
2203
+ function po(e, t) {
2204
+ return !(e != null && e.length) || e === Kt ? t : `${e}/${t}`;
2205
+ }
2206
+ const Zi = `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-svelte README.`;
2207
+ function pr(e) {
2208
+ if (!e || typeof e != "object")
2209
+ return !1;
2210
+ const t = e;
2211
+ return !!t.manifest && typeof t.manifest == "object" && !!t.components && typeof t.components == "object" && !Array.isArray(t.components);
2212
+ }
2213
+ function Ji(e) {
2214
+ if (pr(e))
2215
+ return e;
2216
+ const t = e;
2217
+ return pr(t == null ? void 0 : t.default) ? t.default : null;
2218
+ }
2219
+ function Sn(e) {
2220
+ return e.usesDefaultLibrary ? [Kt, ...e.libraryIds] : [...e.libraryIds];
2221
+ }
2222
+ function hr({ registrations: e, referenced: t }) {
2223
+ if (t.usesDefaultLibrary && !(e != null && e[Kt]))
2224
+ throw new Error(Zi);
2225
+ }
2226
+ function Qi(e) {
2227
+ const t = {};
2228
+ for (const [n, r] of e) {
2229
+ const o = n === Kt;
2230
+ for (const [i, s] of Object.entries(r.components))
2231
+ t[o ? i : `${n}/${i}`] = s;
2232
+ }
2233
+ return { components: t };
2234
+ }
2235
+ function gn() {
2236
+ const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
2237
+ let o = 0;
2238
+ function i(c, f) {
2239
+ var h;
2240
+ e.get(c) !== f && ((h = f.manifest) != null && h.id && f.manifest.id !== c && console.warn(
2241
+ `RuleCMS widget: component library registered as "${c}" declares manifest id "${f.manifest.id}". The registered id wins for resolution.`
2242
+ ), e.set(c, f), o += 1);
2243
+ }
2244
+ function s(c) {
2245
+ const f = Sn(c), h = [...f].sort().join("|"), u = r.get(h);
2246
+ if (u && u.loadedVersion === o)
2247
+ return u.plugin;
2248
+ const d = /* @__PURE__ */ new Map();
2249
+ for (const y of f) {
2250
+ const g = e.get(y);
2251
+ g && d.set(y, g);
2252
+ }
2253
+ const m = Qi(d);
2254
+ return r.set(h, { loadedVersion: o, plugin: m }), m;
2255
+ }
2256
+ function l(c) {
2257
+ hr(c);
2258
+ const { registrations: f, referenced: h } = c;
2259
+ for (const u of Sn(h)) {
2260
+ if (e.has(u) || n.has(u))
2261
+ continue;
2262
+ const d = f == null ? void 0 : f[u];
2263
+ if (!d) {
2264
+ console.error(
2265
+ `RuleCMS widget: no component library registered for libraryId "${u}"; its components will not render.`
2266
+ ), n.set(u, new Error(`No registration for libraryId "${u}"`));
2267
+ continue;
2268
+ }
2269
+ if (typeof d == "function")
2270
+ return null;
2271
+ i(u, d);
2272
+ }
2273
+ return s(h);
2274
+ }
2275
+ async function a(c) {
2276
+ hr(c);
2277
+ const { registrations: f, referenced: h } = c, u = Sn(h);
2278
+ return await Promise.all(
2279
+ u.map(async (d) => {
2280
+ if (e.has(d) || n.has(d))
2281
+ return;
2282
+ const m = f == null ? void 0 : f[d];
2283
+ if (!m) {
2284
+ console.error(
2285
+ `RuleCMS widget: no component library registered for libraryId "${d}"; its components will not render.`
2286
+ ), n.set(d, new Error(`No registration for libraryId "${d}"`));
2287
+ return;
2288
+ }
2289
+ if (typeof m != "function") {
2290
+ i(d, m);
2291
+ return;
2292
+ }
2293
+ let y = t.get(d);
2294
+ y || (y = m().then((g) => {
2295
+ const _ = Ji(g);
2296
+ if (!_)
2297
+ throw new Error(
2298
+ `Registration for libraryId "${d}" did not resolve to a ComponentLibraryModule (expected { manifest, components }).`
2299
+ );
2300
+ i(d, _);
2301
+ }).catch((g) => {
2302
+ n.set(d, g), console.error(
2303
+ `RuleCMS widget: failed to load component library "${d}":`,
2304
+ g
2305
+ );
2306
+ }).finally(() => {
2307
+ t.delete(d);
2308
+ }), t.set(d, y)), await y;
2309
+ })
2310
+ ), s(h);
2311
+ }
2312
+ return { resolveSync: l, resolve: a };
2313
+ }
2314
+ const Da = {
2315
+ Preview: "Preview",
2316
+ Compose: "Compose",
2317
+ RenderedPage: "RenderedPage"
2318
+ }, qn = {
2319
+ DroppableBox: "droppable-box"
2320
+ }, gr = {
2321
+ FlexStart: "flex-start",
2322
+ FlexEnd: "flex-end",
2323
+ Center: "center",
2324
+ SpaceBetween: "space-between",
2325
+ SpaceAround: "space-around",
2326
+ SpaceEvenly: "space-evenly"
2327
+ }, Pa = {
2328
+ FlexStart: "flex-start",
2329
+ FlexEnd: "flex-end",
2330
+ Center: "center",
2331
+ SpaceBetween: "space-between",
2332
+ SpaceAround: "space-around",
2333
+ SpaceEvenly: "space-evenly",
2334
+ Stretch: "stretch"
2335
+ }, En = "cssAttrArray", Ra = {
2336
+ Phone: "phone",
2337
+ Tablet: "tablet",
2338
+ Desktop: "desktop"
2339
+ }, ho = {
2340
+ ComposerComponent: "ComposerWidget",
2341
+ Collection: "Collection",
2342
+ MoveComponentHandle: "MoveWidgetHandle"
2343
+ }, go = `${ho.Collection}_`, $i = "dev.", es = "https://rulecms.com", ts = "https://widget-cache.rulecms.com", ns = "/api/v1/c/widget/get", rs = "/api/v1/c/dev/widget/get";
2344
+ function pt(e) {
2345
+ return typeof e == "string" && e.startsWith($i);
2346
+ }
2347
+ function os(e, t) {
2348
+ return t ? t.replace(/\/$/, "") : pt(e) ? es : ts;
2349
+ }
2350
+ function vo({
2351
+ publishedKey: e,
2352
+ token: t,
2353
+ endpoint: n
2354
+ }) {
2355
+ const r = pt(t), o = r ? rs : ns, i = r ? new URLSearchParams({ widgetKey: e, token: t }) : new URLSearchParams({ publishedKey: e, token: t });
2356
+ return `${os(t, n)}${o}?${i.toString()}`;
2357
+ }
2358
+ const La = ({ id: e, prefix: t }) => `${t}_${e}`, is = (e) => {
2359
+ if (!(e != null && e.length) || !e.includes("_")) {
2360
+ console.error(`Invalid drag item id: ${e}. Type does not exist.`);
2361
+ return;
2362
+ }
2363
+ return ss(e);
2364
+ }, mo = (e) => e.includes("_"), ss = (e) => {
2365
+ const t = e.indexOf("_"), n = e.substring(0, t), r = e.substring(t + 1);
2366
+ return {
2367
+ prefix: n,
2368
+ id: r
2369
+ };
2370
+ }, yo = (e) => {
2371
+ if (!mo(e))
2372
+ return;
2373
+ const n = is(e);
2374
+ return (n == null ? void 0 : n.prefix) === ho.Collection || console.error(
2375
+ "getCollectionIdForCollectionType - Invalid component type: ${componentType}. Invalid prefix type."
2376
+ ), n == null ? void 0 : n.id;
2377
+ }, Ma = (e) => {
2378
+ if (!(e != null && e.length)) {
2379
+ console.error("getNameAndInstanceIdFromWidgetKey: Missing widget key");
2380
+ return;
2381
+ }
2382
+ const t = e.split("$");
2383
+ if (t.length < 2) {
2384
+ console.error("getNameAndInstanceIdFromWidgetKey: Invalid widget key format");
2385
+ return;
2386
+ }
2387
+ const n = t[0];
2388
+ if (!t[1].includes("@"))
2389
+ return { name: n, instanceId: t[1] };
2390
+ const o = t[1].split("@");
2391
+ return { name: n, instanceId: o[0], parentId: o[1] };
2392
+ }, Na = (e) => {
2393
+ if (!(e != null && e.length))
2394
+ return { errorMessage: "getNameFromWidgetKey: Missing widget key" };
2395
+ const t = e.split("$");
2396
+ return t.length < 2 ? { errorMessage: "getNameFromWidgetKey: Invalid widget key format" } : { name: t[0] };
2397
+ }, ls = (e) => {
2398
+ var o, i, s, l;
2399
+ if (!e)
2400
+ return { error: "getWidgetKeyForCollection: Missing collection" };
2401
+ if (!((o = e.name) != null && o.length))
2402
+ return { error: "getWidgetKeyForCollection: Missing collection name" };
2403
+ const t = (i = e.name) == null ? void 0 : i.trim().toLowerCase();
2404
+ if (!((s = e.id) != null && s.length))
2405
+ return { error: "getWidgetKeyForCollection: Missing collection id" };
2406
+ const r = ((l = e.parentId) == null ? void 0 : l.length) ? `${e.id}@${e.parentId}` : `${e.id}`;
2407
+ return { data: `${t}$${r}` };
2408
+ }, as = (e) => {
2409
+ var o, i, s, l;
2410
+ if (!e)
2411
+ return { error: "getWidgetKeyForPublishedCollection: Missing collection" };
2412
+ if (!((o = e.name) != null && o.length))
2413
+ return { error: "getWidgetKeyForPublishedCollection: Missing collection name" };
2414
+ const t = (i = e.name) == null ? void 0 : i.trim().toLowerCase();
2415
+ if (!((s = e.publishedKey) != null && s.length))
2416
+ return { error: "getWidgetKeyForPublishedCollection: Missing collection publishedKey" };
2417
+ const r = ((l = e.parentId) == null ? void 0 : l.length) ? `${e.publishedKey}@${e.parentId}` : `${e.publishedKey}`;
2418
+ return { data: `${t}$${r}` };
2419
+ }, Oa = (e) => {
2420
+ const t = ls(e);
2421
+ return `${go}${t.data}`;
2422
+ }, Fa = (e) => {
2423
+ const t = as(e);
2424
+ return `${go}${t.data}`;
2425
+ }, us = "---", cs = "___";
2426
+ function fs(e, t) {
2427
+ return `${e}${us}${t}`;
2428
+ }
2429
+ function Wa(e, t, n) {
2430
+ return `${fs(e, t)}${cs}${n}`;
2431
+ }
2432
+ function ja(e) {
2433
+ const t = e.split(".");
2434
+ if (t.length !== 3)
2435
+ throw new Error(`Invalid version format: ${e}. Expected format: x.y.z`);
2436
+ const n = t[0], r = t[1], o = parseInt(t[2], 10);
2437
+ if (isNaN(o))
2438
+ throw new Error(`Invalid patch version: ${t[2]}. Expected a number.`);
2439
+ return `${n}.${r}.${o + 1}`;
2440
+ }
2441
+ function Xn({
2442
+ displayItemList: e,
2443
+ widgetCollections: t
2444
+ }) {
2445
+ const n = /* @__PURE__ */ new Set();
2446
+ let r = !1;
2447
+ const o = (i) => {
2448
+ var s, l, a;
2449
+ if ((s = i == null ? void 0 : i.rows) != null && s.length) {
2450
+ for (const c of i.rows)
2451
+ if ((l = c == null ? void 0 : c.columns) != null && l.length)
2452
+ for (const f of c.columns)
2453
+ f.collection && o(f.collection.collectionRows), !(!f.type || f.type === qn.DroppableBox) && (mo(f.type) || (!((a = f.libraryId) != null && a.length) || f.libraryId === Kt ? r = !0 : n.add(f.libraryId)));
2454
+ }
2455
+ };
2456
+ o(e);
2457
+ for (const i of Object.values(t ?? {}))
2458
+ o(i == null ? void 0 : i.collectionRows);
2459
+ return { libraryIds: Array.from(n), usesDefaultLibrary: r };
2460
+ }
2461
+ const _o = Symbol("rulecms-widget-context");
2462
+ function ds() {
2463
+ return {
2464
+ token: "",
2465
+ endpoint: void 0,
2466
+ libraries: void 0,
2467
+ libraryRegistry: gn()
2468
+ };
2469
+ }
2470
+ function Va(e, t) {
2471
+ Pe(t, !0);
2472
+ const n = rt(ds());
2473
+ Kn(() => {
2474
+ n.token = t.token, n.endpoint = t.endpoint, n.libraries = t.libraries;
2475
+ }), Po(_o, n);
2476
+ var r = se(), o = ne(r);
2477
+ zn(o, () => t.children), F(e, r), Re();
2478
+ }
2479
+ const ps = "1200px", wo = "500px", bo = "820px", Ba = ps, hs = "rulecms", gs = 1920, vs = {
2480
+ f: "auto",
2481
+ q: "auto",
2482
+ c: "limit"
2483
+ }, ms = /^[A-Za-z0-9][A-Za-z0-9._\-/]*$/, ys = 300, _s = /^[A-Za-z0-9][A-Za-z0-9_-]*$/, ws = 100, bs = /^https:\/\/[^\s"'()\\<>]+$/, Cs = 2e3, As = /^[A-Za-z0-9_,.:\-/]*$/, Ss = 300, Es = (e) => typeof e == "string" && e.length <= ys && ms.test(e), Is = (e) => typeof e == "string" && e.length <= ws && _s.test(e), Ts = (e) => typeof e == "string" && e.length <= Cs && bs.test(e), ks = (e) => typeof e == "string" && e.length <= Ss && As.test(e), xs = (e) => Object.entries(e).map(([t, n]) => `${t}_${n}`).join(","), Ds = (e) => {
2484
+ const t = {};
2485
+ for (const n of e.split(",")) {
2486
+ const r = n.trim(), o = r.indexOf("_");
2487
+ o <= 0 || (t[r.slice(0, o)] = r.slice(o + 1));
2488
+ }
2489
+ return t;
2490
+ }, Ps = ({
2491
+ publicId: e,
2492
+ cloudName: t = hs,
2493
+ transformations: n,
2494
+ width: r = gs
2495
+ }) => {
2496
+ const o = typeof n == "string" ? Ds(n) : n, i = {
2497
+ ...vs,
2498
+ ...o,
2499
+ w: r
2500
+ };
2501
+ return encodeURI(
2502
+ `https://res.cloudinary.com/${t}/image/upload/${xs(i)}/${e}`
2503
+ );
2504
+ }, Rs = /^--[A-Za-z0-9_-]+$/, Ls = 200, Co = (e) => {
2505
+ if (typeof e != "string")
2506
+ return !1;
2507
+ const t = e.trim();
2508
+ return t.length <= Ls && Rs.test(t);
2509
+ }, Ee = (e) => `var(${e.trim()})`, H = (e) => {
2510
+ if (typeof e != "object" || e === null || Array.isArray(e))
2511
+ return;
2512
+ const t = e.cssVariable;
2513
+ if (t != null)
2514
+ return Co(t) ? t.trim() : void 0;
2515
+ }, Me = (e) => {
2516
+ if (typeof e != "object" || e === null || Array.isArray(e))
2517
+ return !1;
2518
+ const t = e.cssVariable;
2519
+ return t == null ? !1 : !Co(t);
2520
+ }, Ka = (e, t) => {
2521
+ const n = H(e);
2522
+ return n ? { [t]: Ee(n) } : void 0;
2523
+ }, Ms = (e) => {
2524
+ if (typeof e != "object" || e === null || Array.isArray(e) || Me(e))
2525
+ return !1;
2526
+ if (H(e))
2527
+ return !0;
2528
+ const t = e;
2529
+ return t.source === "none" ? !0 : t.source === "url" ? Ts(t.url) : t.source === "cloudinary" ? !Es(t.publicId) || t.cloudName !== void 0 && t.cloudName !== null && !Is(t.cloudName) ? !1 : t.transformations === void 0 || t.transformations === null || ks(t.transformations) : !1;
2530
+ }, Ns = ["px", "%", "em", "rem", "vh", "vw"], Zn = ["inherit", "unset"], Os = ["allSides", "top", "right", "bottom", "left"], ht = (e, t = {}) => {
2531
+ if (typeof e != "object" || e === null || Array.isArray(e))
2532
+ return !1;
2533
+ const n = e;
2534
+ return Me(e) ? !1 : H(e) ? !0 : n.unit === "auto" ? t.allowAuto !== !1 : n.unit === "keyword" ? t.allowKeywords !== !1 && Zn.includes(n.keyword) : Ns.includes(n.unit) ? typeof n.value != "number" || !Number.isFinite(n.value) ? !1 : t.allowNegative !== !1 || n.value >= 0 : !1;
2535
+ }, Fs = (e, t = {}) => {
2536
+ if (typeof e != "object" || e === null || Array.isArray(e))
2537
+ return !1;
2538
+ const n = e;
2539
+ for (const r of Os) {
2540
+ const o = n[r];
2541
+ if (o != null && !ht(o, t))
2542
+ return !1;
2543
+ }
2544
+ return !0;
2545
+ }, Ws = [...Zn, "transparent", "currentColor"], js = /^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/, Jn = (e) => {
2546
+ if (typeof e != "object" || e === null || Array.isArray(e))
2547
+ return !1;
2548
+ const t = e;
2549
+ return Me(e) ? !1 : H(e) ? !0 : t.unit === "keyword" ? Ws.includes(t.keyword) : t.unit === "color" ? typeof t.value == "string" && js.test(t.value.trim()) : !1;
2550
+ }, Qn = (e) => {
2551
+ const t = H(e);
2552
+ return t ? Ee(t) : "unit" in e ? e.unit === "keyword" ? e.keyword : e.value.trim() : "";
2553
+ }, Vs = (e, t) => typeof e == "object" && e !== null && !Array.isArray(e) ? !Me(e) && !!H(e) : typeof e != "string" || !e.length ? !1 : t.includes(e) ? !0 : Zn.includes(e), Bs = [
2554
+ 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
2555
+ 'Georgia, "Times New Roman", Times, serif',
2556
+ "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",
2557
+ "Arial, Helvetica, sans-serif",
2558
+ '"Helvetica Neue", Helvetica, Arial, sans-serif',
2559
+ "Verdana, Geneva, sans-serif"
2560
+ ], Ks = [
2561
+ "normal",
2562
+ "bold",
2563
+ "100",
2564
+ "200",
2565
+ "300",
2566
+ "400",
2567
+ "500",
2568
+ "600",
2569
+ "700",
2570
+ "800",
2571
+ "900"
2572
+ ], Us = ["normal", "italic", "oblique"], Hs = [
2573
+ "left",
2574
+ "center",
2575
+ "right",
2576
+ "justify",
2577
+ "start",
2578
+ "end"
2579
+ ], Ys = [
2580
+ "none",
2581
+ "underline",
2582
+ "line-through",
2583
+ "overline"
2584
+ ], zs = [
2585
+ "none",
2586
+ "uppercase",
2587
+ "lowercase",
2588
+ "capitalize"
2589
+ ], In = [
2590
+ "visible",
2591
+ "hidden",
2592
+ "scroll",
2593
+ "auto",
2594
+ "clip"
2595
+ ], Gs = [
2596
+ "flex-start",
2597
+ "flex-end",
2598
+ "center",
2599
+ "space-between",
2600
+ "space-around",
2601
+ "space-evenly"
2602
+ ], qs = [
2603
+ "flex-start",
2604
+ "flex-end",
2605
+ "center",
2606
+ "baseline",
2607
+ "stretch"
2608
+ ], Xs = ["wrap", "nowrap"], Zs = [
2609
+ "flex-start",
2610
+ "flex-end",
2611
+ "center",
2612
+ "space-between",
2613
+ "space-around",
2614
+ "space-evenly",
2615
+ "stretch"
2616
+ ], Js = [
2617
+ "row",
2618
+ "row-reverse",
2619
+ "column",
2620
+ "column-reverse"
2621
+ ], Qs = ["cover", "contain", "auto"], $s = [
2622
+ "center center",
2623
+ "center top",
2624
+ "center bottom",
2625
+ "left center",
2626
+ "left top",
2627
+ "left bottom",
2628
+ "right center",
2629
+ "right top",
2630
+ "right bottom"
2631
+ ], el = [
2632
+ "no-repeat",
2633
+ "repeat",
2634
+ "repeat-x",
2635
+ "repeat-y",
2636
+ "space",
2637
+ "round"
2638
+ ], tl = [
2639
+ "justifyContent",
2640
+ "alignItems",
2641
+ "flexWrap",
2642
+ "alignContent",
2643
+ "flexDirection"
2644
+ ], nl = [
2645
+ "none",
2646
+ "solid",
2647
+ "dashed",
2648
+ "dotted",
2649
+ "double",
2650
+ "groove",
2651
+ "ridge",
2652
+ "inset",
2653
+ "outset"
2654
+ ], rl = (e) => typeof e == "object" && e !== null && !Array.isArray(e) ? !Me(e) && !!H(e) : nl.includes(e), ol = (e) => {
2655
+ if (typeof e != "object" || e === null || Array.isArray(e))
2656
+ return !1;
2657
+ const t = e;
2658
+ return Me(e) ? !1 : H(e) ? !0 : !(t.width !== void 0 && t.width !== null && !ht(t.width, { allowAuto: !1, allowNegative: !1 }) || t.style !== void 0 && t.style !== null && !rl(t.style) || t.color !== void 0 && t.color !== null && !Jn(t.color));
2659
+ }, il = {
2660
+ allowAuto: !1,
2661
+ allowKeywords: !1,
2662
+ allowNegative: !0
2663
+ }, sl = {
2664
+ allowAuto: !1,
2665
+ allowKeywords: !1,
2666
+ allowNegative: !1
2667
+ }, ll = (e) => {
2668
+ if (typeof e != "object" || e === null || Array.isArray(e))
2669
+ return !1;
2670
+ const t = e;
2671
+ if (Me(e))
2672
+ return !1;
2673
+ if (H(e))
2674
+ return !0;
2675
+ for (const n of ["offsetX", "offsetY", "spread"]) {
2676
+ const r = t[n];
2677
+ if (r != null && !ht(r, il))
2678
+ return !1;
2679
+ }
2680
+ return !(t.blur !== void 0 && t.blur !== null && !ht(t.blur, sl) || t.color !== void 0 && t.color !== null && !Jn(t.color) || t.inset !== void 0 && t.inset !== null && typeof t.inset != "boolean");
2681
+ }, al = (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, ul = (e) => {
2682
+ if (typeof e != "object" || e === null || Array.isArray(e))
2683
+ return !1;
2684
+ const t = e;
2685
+ return Me(e) ? !1 : H(e) ? !0 : t.unit === "number" ? typeof t.value == "number" && Number.isFinite(t.value) && t.value > 0 : ht(e, { allowAuto: !1, allowNegative: !1 });
2686
+ }, cl = (e) => typeof e == "object" && e !== null && !Array.isArray(e) ? !Me(e) && !!H(e) : typeof e == "number" && Number.isFinite(e) && e >= 0 && e <= 1, fl = (e) => {
2687
+ if (!Ms(e))
2688
+ return {};
2689
+ const t = H(e);
2690
+ if (t)
2691
+ return { backgroundImage: Ee(t) };
2692
+ const n = e;
2693
+ return n.source === "none" ? { backgroundImage: "none" } : n.source === "url" ? { backgroundImage: `url("${n.url}")` } : {
2694
+ backgroundImage: `url("${Ps({
2695
+ publicId: n.publicId,
2696
+ cloudName: n.cloudName,
2697
+ transformations: n.transformations
2698
+ })}")`
2699
+ };
2700
+ }, gt = (e) => {
2701
+ const t = H(e);
2702
+ return t ? Ee(t) : "unit" in e ? e.unit === "auto" ? "auto" : e.unit === "keyword" ? e.keyword : `${e.value}${e.unit}` : "";
2703
+ }, dl = (e) => {
2704
+ if (!ol(e))
2705
+ return {};
2706
+ const t = H(e);
2707
+ if (t)
2708
+ return { border: Ee(t) };
2709
+ const n = {};
2710
+ if (e.width && (n.borderWidth = gt(e.width)), e.style) {
2711
+ const r = H(e.style);
2712
+ n.borderStyle = r ? Ee(r) : e.style;
2713
+ }
2714
+ return e.color && (n.borderColor = Qn(e.color)), n;
2715
+ }, zt = (e) => e ? gt(e) : "0px", pl = (e) => {
2716
+ if (!ll(e) || !al(e))
2717
+ return {};
2718
+ const t = H(e);
2719
+ if (t)
2720
+ return { boxShadow: Ee(t) };
2721
+ const n = [
2722
+ zt(e.offsetX),
2723
+ zt(e.offsetY),
2724
+ zt(e.blur),
2725
+ zt(e.spread)
2726
+ ];
2727
+ return e.color && n.push(Qn(e.color)), e.inset && n.unshift("inset"), { boxShadow: n.join(" ") };
2728
+ }, hl = (e) => `${e.charAt(0).toUpperCase()}${e.slice(1)}`, gl = (e, t) => {
2729
+ if (!Fs(e))
2730
+ return {};
2731
+ if (e.allSides)
2732
+ return { [t]: gt(e.allSides) };
2733
+ const n = {};
2734
+ for (const r of ["top", "right", "bottom", "left"]) {
2735
+ const o = e[r];
2736
+ o && (n[`${t}${hl(r)}`] = gt(o));
2737
+ }
2738
+ return n;
2739
+ }, vl = (e, t) => Jn(e) ? { [t]: Qn(e) } : {}, ml = (e, t, n) => {
2740
+ if (!Vs(e, n))
2741
+ return {};
2742
+ const r = H(e);
2743
+ return r ? { [t]: Ee(r) } : { [t]: e };
2744
+ }, yl = (e, t, n = {}) => ht(e, n) ? { [t]: gt(e) } : {}, _l = (e) => {
2745
+ if (!ul(e))
2746
+ return {};
2747
+ const t = H(e);
2748
+ return t ? { lineHeight: Ee(t) } : "unit" in e && e.unit === "number" ? { lineHeight: e.value } : { lineHeight: gt(e) };
2749
+ }, wl = (e) => {
2750
+ if (!cl(e))
2751
+ return {};
2752
+ const t = H(e);
2753
+ return t ? { opacity: Ee(t) } : { opacity: e };
2754
+ }, $n = {
2755
+ // Box spacing (4-sided)
2756
+ "margin-3-resolutions": { kind: "boxSpacing", cssProperty: "margin" },
2757
+ "padding-3-resolutions": { kind: "boxSpacing", cssProperty: "padding" },
2758
+ // Border (compound — longhands only)
2759
+ "border-3-resolutions": { kind: "border" },
2760
+ // Box shadow (compound — offsets, blur, spread, color, inset)
2761
+ "box-shadow-3-resolutions": { kind: "boxShadow" },
2762
+ // Single length / keyword
2763
+ "border-radius-3-resolutions": {
2764
+ kind: "length",
2765
+ cssProperty: "borderRadius",
2766
+ capabilities: { allowAuto: !1, allowNegative: !1 }
2767
+ },
2768
+ "width-3-resolutions": {
2769
+ kind: "length",
2770
+ cssProperty: "width",
2771
+ capabilities: { allowAuto: !0, allowNegative: !1 }
2772
+ },
2773
+ "height-3-resolutions": {
2774
+ kind: "length",
2775
+ cssProperty: "height",
2776
+ capabilities: { allowAuto: !0, allowNegative: !1 }
2777
+ },
2778
+ "min-width-3-resolutions": {
2779
+ kind: "length",
2780
+ cssProperty: "minWidth",
2781
+ capabilities: { allowAuto: !1, allowNegative: !1 }
2782
+ },
2783
+ "max-width-3-resolutions": {
2784
+ kind: "length",
2785
+ cssProperty: "maxWidth",
2786
+ capabilities: { allowAuto: !1, allowNegative: !1 }
2787
+ },
2788
+ "min-height-3-resolutions": {
2789
+ kind: "length",
2790
+ cssProperty: "minHeight",
2791
+ capabilities: { allowAuto: !1, allowNegative: !1 }
2792
+ },
2793
+ "max-height-3-resolutions": {
2794
+ kind: "length",
2795
+ cssProperty: "maxHeight",
2796
+ capabilities: { allowAuto: !1, allowNegative: !1 }
2797
+ },
2798
+ "gap-3-resolutions": {
2799
+ kind: "length",
2800
+ cssProperty: "gap",
2801
+ capabilities: { allowAuto: !1, allowNegative: !1 }
2802
+ },
2803
+ // Flex layout — display:flex is derived at render when any of these (not
2804
+ // gap alone) is set. See deriveDisplayFlexIfNeeded.
2805
+ "justify-content-3-resolutions": {
2806
+ kind: "enum",
2807
+ cssProperty: "justifyContent",
2808
+ allowedValues: Gs
2809
+ },
2810
+ "align-items-3-resolutions": {
2811
+ kind: "enum",
2812
+ cssProperty: "alignItems",
2813
+ allowedValues: qs
2814
+ },
2815
+ "flex-wrap-3-resolutions": {
2816
+ kind: "enum",
2817
+ cssProperty: "flexWrap",
2818
+ allowedValues: Xs
2819
+ },
2820
+ "align-content-3-resolutions": {
2821
+ kind: "enum",
2822
+ cssProperty: "alignContent",
2823
+ allowedValues: Zs
2824
+ },
2825
+ "flex-direction-3-resolutions": {
2826
+ kind: "enum",
2827
+ cssProperty: "flexDirection",
2828
+ allowedValues: Js
2829
+ },
2830
+ // Overflow — shorthand and longhands are independent attributes; when
2831
+ // both are set, the browser's cascade decides the effective overflow.
2832
+ "overflow-3-resolutions": {
2833
+ kind: "enum",
2834
+ cssProperty: "overflow",
2835
+ allowedValues: In
2836
+ },
2837
+ "overflow-x-3-resolutions": {
2838
+ kind: "enum",
2839
+ cssProperty: "overflowX",
2840
+ allowedValues: In
2841
+ },
2842
+ "overflow-y-3-resolutions": {
2843
+ kind: "enum",
2844
+ cssProperty: "overflowY",
2845
+ allowedValues: In
2846
+ },
2847
+ // Color
2848
+ "background-color-3-resolutions": { kind: "color", cssProperty: "backgroundColor" },
2849
+ "color-3-resolutions": { kind: "color", cssProperty: "color" },
2850
+ // Background image and the painting properties that go with it. Independent
2851
+ // attributes rather than one compound value: only the image needs a bespoke
2852
+ // leaf, and each is separately per-device.
2853
+ "background-image-3-resolutions": { kind: "backgroundImage" },
2854
+ "background-size-3-resolutions": {
2855
+ kind: "enum",
2856
+ cssProperty: "backgroundSize",
2857
+ allowedValues: Qs
2858
+ },
2859
+ "background-position-3-resolutions": {
2860
+ kind: "enum",
2861
+ cssProperty: "backgroundPosition",
2862
+ allowedValues: $s
2863
+ },
2864
+ "background-repeat-3-resolutions": {
2865
+ kind: "enum",
2866
+ cssProperty: "backgroundRepeat",
2867
+ allowedValues: el
2868
+ },
2869
+ // Opacity (0–1 number)
2870
+ "opacity-3-resolutions": { kind: "opacity" },
2871
+ // Typography — applied on the column wrapper; text inherits
2872
+ "font-family-3-resolutions": {
2873
+ kind: "enum",
2874
+ cssProperty: "fontFamily",
2875
+ allowedValues: Bs
2876
+ },
2877
+ "font-size-3-resolutions": {
2878
+ kind: "length",
2879
+ cssProperty: "fontSize",
2880
+ capabilities: { allowAuto: !1, allowNegative: !1 }
2881
+ },
2882
+ "font-weight-3-resolutions": {
2883
+ kind: "enum",
2884
+ cssProperty: "fontWeight",
2885
+ allowedValues: Ks
2886
+ },
2887
+ "font-style-3-resolutions": {
2888
+ kind: "enum",
2889
+ cssProperty: "fontStyle",
2890
+ allowedValues: Us
2891
+ },
2892
+ "line-height-3-resolutions": { kind: "lineHeight" },
2893
+ "letter-spacing-3-resolutions": {
2894
+ kind: "length",
2895
+ cssProperty: "letterSpacing",
2896
+ capabilities: { allowAuto: !1, allowNegative: !0 }
2897
+ },
2898
+ "text-align-3-resolutions": {
2899
+ kind: "enum",
2900
+ cssProperty: "textAlign",
2901
+ allowedValues: Hs
2902
+ },
2903
+ "text-decoration-3-resolutions": {
2904
+ kind: "enum",
2905
+ cssProperty: "textDecoration",
2906
+ allowedValues: Ys
2907
+ },
2908
+ "text-transform-3-resolutions": {
2909
+ kind: "enum",
2910
+ cssProperty: "textTransform",
2911
+ allowedValues: zs
2912
+ }
2913
+ }, bl = (e, t) => {
2914
+ const n = $n[e];
2915
+ if (!n)
2916
+ return {};
2917
+ switch (n.kind) {
2918
+ case "boxSpacing":
2919
+ return gl(t, n.cssProperty);
2920
+ case "length":
2921
+ return yl(t, n.cssProperty, n.capabilities);
2922
+ case "border":
2923
+ return dl(t);
2924
+ case "boxShadow":
2925
+ return pl(t);
2926
+ case "color":
2927
+ return vl(t, n.cssProperty);
2928
+ case "opacity":
2929
+ return wl(t);
2930
+ case "enum":
2931
+ return ml(t, n.cssProperty, n.allowedValues);
2932
+ case "lineHeight":
2933
+ return _l(t);
2934
+ case "backgroundImage":
2935
+ return fl(t);
2936
+ default:
2937
+ return {};
2938
+ }
2939
+ }, Ua = Object.fromEntries(
2940
+ Object.entries($n).filter(([, e]) => e.kind === "boxSpacing").map(([e, t]) => [
2941
+ e,
2942
+ t.cssProperty
2943
+ ])
2944
+ ), Cl = (e) => e != null && e !== "", Al = (e) => e ? !tl.some(
2945
+ (n) => Cl(e[n])
2946
+ ) || e.display === "flex" ? e : { ...e, display: "flex" } : {}, Sl = ({
2947
+ dbEntryType: e,
2948
+ libraryId: t,
2949
+ sourceComponentsPlugin: n
2950
+ }) => {
2951
+ if (!(e != null && e.length))
2952
+ return;
2953
+ const r = n.components[po(t, e)];
2954
+ if (!r || !("defaultAttributeValues" in r))
2955
+ return;
2956
+ const i = r.defaultAttributeValues;
2957
+ if (i != null && i.length)
2958
+ return i.reduce((s, l) => ({
2959
+ ...s,
2960
+ [l.name]: l.defaultValues
2961
+ }), {});
2962
+ }, yt = ({
2963
+ deviceDisplayType: e,
2964
+ componentAttributes: t
2965
+ }) => {
2966
+ if (!t)
2967
+ return;
2968
+ const n = {}, r = {};
2969
+ for (const [o, i] of Object.entries(
2970
+ t
2971
+ )) {
2972
+ if (!o.includes("3-resolutions") || !i)
2973
+ continue;
2974
+ const s = i.all, l = s ?? i[e.toLowerCase()];
2975
+ r[o] = l, $n[o] && Object.assign(n, bl(o, l));
2976
+ }
2977
+ return Object.keys(n).length || Object.keys(r).length ? {
2978
+ styles: Object.keys(n).length ? n : void 0,
2979
+ componentAttributesSpecificToDeviceType: Object.keys(
2980
+ r
2981
+ ).length ? r : void 0
2982
+ } : void 0;
2983
+ }, El = ({
2984
+ defaultAttributes: e,
2985
+ userModifiedAttributes: t
2986
+ }) => e ? t ? { ...e, ...t } : e : t;
2987
+ function Jt(e) {
2988
+ return e.componentAttributes ?? e.widgetAttributes;
2989
+ }
2990
+ function vr({
2991
+ col: e,
2992
+ deviceDisplayType: t,
2993
+ isComposeMode: n,
2994
+ sourceComponentsPlugin: r
2995
+ }) {
2996
+ const o = Jt(e), i = Sl({
2997
+ dbEntryType: e.type,
2998
+ libraryId: e.libraryId,
2999
+ sourceComponentsPlugin: r
3000
+ }) || [], s = El({
3001
+ defaultAttributes: i,
3002
+ userModifiedAttributes: o
3003
+ }), { styles: l, componentAttributesSpecificToDeviceType: a } = yt({
3004
+ deviceDisplayType: t,
3005
+ componentAttributes: s
3006
+ }) || {
3007
+ styles: void 0,
3008
+ componentAttributesSpecificToDeviceType: void 0
3009
+ };
3010
+ let c = {};
3011
+ const f = {};
3012
+ if (l)
3013
+ for (const [u, d] of Object.entries(l))
3014
+ n && f[u] || (c = {
3015
+ ...c,
3016
+ [u]: d
3017
+ });
3018
+ let h = Jt(e);
3019
+ for (const u in a)
3020
+ if (u.includes("3-resolutions")) {
3021
+ h = {
3022
+ ...Jt(e) || {},
3023
+ ...a || {}
3024
+ };
3025
+ break;
3026
+ }
3027
+ return {
3028
+ componentAttributesBasedOnDevice: h,
3029
+ componentStyles: Al(c)
3030
+ };
3031
+ }
3032
+ const Il = (e) => {
3033
+ const t = (e == null ? void 0 : e.rows) || [];
3034
+ for (const n of t)
3035
+ if (((n == null ? void 0 : n.columns) || []).length > 0)
3036
+ return !0;
3037
+ return (e == null ? void 0 : e.containerAttributes) && Object.keys(e.containerAttributes).length > 0;
3038
+ }, Tl = "var(--sl-spacing-x-small)";
3039
+ function kl(e) {
3040
+ 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);
3041
+ }
3042
+ function xl({
3043
+ row: e,
3044
+ deviceDisplayType: t
3045
+ }) {
3046
+ var r;
3047
+ const n = yt({
3048
+ deviceDisplayType: t,
3049
+ componentAttributes: e.rowAttributes
3050
+ });
3051
+ return ((r = n == null ? void 0 : n.componentAttributesSpecificToDeviceType) == null ? void 0 : r["hide-component-3-resolutions"]) === "true";
3052
+ }
3053
+ function Dl({
3054
+ row: e,
3055
+ deviceDisplayType: t,
3056
+ isComposeMode: n
3057
+ }) {
3058
+ var d;
3059
+ const r = ((d = yt({
3060
+ deviceDisplayType: t,
3061
+ componentAttributes: e.rowAttributes
3062
+ })) == null ? void 0 : d.styles) || {}, o = r.justifyContent ?? e.horizontalAlignment ?? gr.Center, i = r.alignItems ?? e.verticalAlignment ?? gr.Center, s = r.flexDirection ?? "row", l = r.gap ?? e.gap ?? Tl, a = n ? "nowrap" : r.flexWrap ?? e.flexWrap ?? "nowrap", c = r.alignContent ?? e.alignContent ?? void 0, f = /* @__PURE__ */ new Set([
3063
+ "justifyContent",
3064
+ "alignItems",
3065
+ "flexDirection",
3066
+ "gap",
3067
+ "flexWrap",
3068
+ "alignContent",
3069
+ "display"
3070
+ ]), h = {};
3071
+ for (const [m, y] of Object.entries(r))
3072
+ f.has(m) || (h[m] = y);
3073
+ const u = {
3074
+ display: "flex",
3075
+ flexDirection: s,
3076
+ gap: l,
3077
+ flexWrap: a,
3078
+ justifyContent: o,
3079
+ alignItems: i,
3080
+ ...h
3081
+ };
3082
+ return c !== void 0 && (u.alignContent = c), u;
3083
+ }
3084
+ const er = "css-classes-3-resolutions", Pl = 500, Rl = /[\x00-\x1f\x7f]/g, tr = (e) => {
3085
+ if (typeof e != "string")
3086
+ return;
3087
+ const t = /* @__PURE__ */ new Set(), n = [];
3088
+ for (const o of e.split(/\s+/)) {
3089
+ const i = o.replace(Rl, "");
3090
+ i && (t.has(i) || (t.add(i), n.push(i)));
3091
+ }
3092
+ if (!n.length)
3093
+ return;
3094
+ let r = "";
3095
+ for (const o of n) {
3096
+ const i = r ? `${r} ${o}` : o;
3097
+ if (i.length > Pl)
3098
+ break;
3099
+ r = i;
3100
+ }
3101
+ return r.length ? r : void 0;
3102
+ }, Ao = "hide-component-3-resolutions", Ll = [
3103
+ "width-3-resolutions",
3104
+ "min-width-3-resolutions",
3105
+ "max-width-3-resolutions",
3106
+ "height-3-resolutions",
3107
+ "min-height-3-resolutions",
3108
+ "max-height-3-resolutions",
3109
+ "margin-3-resolutions",
3110
+ "padding-3-resolutions",
3111
+ "border-3-resolutions",
3112
+ "border-radius-3-resolutions",
3113
+ "box-shadow-3-resolutions",
3114
+ "overflow-3-resolutions",
3115
+ "overflow-x-3-resolutions",
3116
+ "overflow-y-3-resolutions",
3117
+ Ao
3118
+ ], Ml = new Set(
3119
+ Ll
3120
+ );
3121
+ function Nl({
3122
+ containerAttributes: e,
3123
+ deviceDisplayType: t
3124
+ }) {
3125
+ var r;
3126
+ const n = yt({
3127
+ deviceDisplayType: t,
3128
+ componentAttributes: e
3129
+ });
3130
+ return ((r = n == null ? void 0 : n.componentAttributesSpecificToDeviceType) == null ? void 0 : r[Ao]) === "true";
3131
+ }
3132
+ function Ol({
3133
+ containerAttributes: e,
3134
+ deviceDisplayType: t,
3135
+ isComposeMode: n
3136
+ }) {
3137
+ var i;
3138
+ if (!e)
3139
+ return { styles: {} };
3140
+ const r = n ? Object.fromEntries(
3141
+ Object.entries(e).filter(
3142
+ ([s]) => !Ml.has(s)
3143
+ )
3144
+ ) : e, o = yt({
3145
+ deviceDisplayType: t,
3146
+ componentAttributes: r
3147
+ });
3148
+ return {
3149
+ styles: (o == null ? void 0 : o.styles) ?? {},
3150
+ cssClasses: tr(
3151
+ (i = o == null ? void 0 : o.componentAttributesSpecificToDeviceType) == null ? void 0 : i[er]
3152
+ )
3153
+ };
3154
+ }
3155
+ function Fl(e) {
3156
+ return Object.keys(e.styles).length > 0 || !!e.cssClasses;
3157
+ }
3158
+ function ie(e) {
3159
+ if (!e)
3160
+ return;
3161
+ const t = [];
3162
+ for (const [n, r] of Object.entries(e)) {
3163
+ if (r == null || r === "")
3164
+ continue;
3165
+ const o = n.replace(/[A-Z]/g, (i) => `-${i.toLowerCase()}`);
3166
+ t.push(`${o}: ${r}`);
3167
+ }
3168
+ return t.length > 0 ? t.join("; ") : void 0;
3169
+ }
3170
+ const nr = "/";
3171
+ function Wl({
3172
+ componentProps: e,
3173
+ ancestorColumnIds: t,
3174
+ columnId: n
3175
+ }) {
3176
+ if (!e || !n)
3177
+ return;
3178
+ const r = [...t ?? [], n];
3179
+ for (let o = 0; o < r.length; o += 1) {
3180
+ const i = r.slice(o).join(nr), s = e[i];
3181
+ if (s)
3182
+ return s;
3183
+ }
3184
+ }
3185
+ function jl({
3186
+ displayItemList: e,
3187
+ widgetCollections: t
3188
+ }) {
3189
+ const n = [], r = (o, i) => {
3190
+ var s;
3191
+ if ((s = o == null ? void 0 : o.rows) != null && s.length)
3192
+ for (const l of o.rows)
3193
+ for (const a of l.columns) {
3194
+ if (!a.id || a.type === qn.DroppableBox)
3195
+ continue;
3196
+ const c = yo(a.type);
3197
+ if (c != null && c.length) {
3198
+ const f = a.collection ?? (t == null ? void 0 : t[c]);
3199
+ f && !i.includes(a.id) && r(f.collectionRows, [...i, a.id]);
3200
+ continue;
3201
+ }
3202
+ n.push(
3203
+ [...i, a.id].join(nr)
3204
+ );
3205
+ }
3206
+ };
3207
+ return r(e, []), n;
3208
+ }
3209
+ function Vl(e, t) {
3210
+ const n = `${nr}${e}`;
3211
+ return t.some((r) => r === e || r.endsWith(n));
3212
+ }
3213
+ function Bl({
3214
+ componentProps: e,
3215
+ displayItemList: t,
3216
+ widgetCollections: n
3217
+ }) {
3218
+ const r = e ? Object.keys(e) : [];
3219
+ if (!r.length)
3220
+ return [];
3221
+ const o = jl({
3222
+ displayItemList: t,
3223
+ widgetCollections: n
3224
+ });
3225
+ return r.filter((i) => !Vl(i, o));
3226
+ }
3227
+ function Kl({
3228
+ componentProps: e,
3229
+ displayItemList: t,
3230
+ widgetCollections: n,
3231
+ publishedKey: r
3232
+ }) {
3233
+ if (process.env.NODE_ENV === "production")
3234
+ return;
3235
+ const o = Bl({
3236
+ componentProps: e,
3237
+ displayItemList: t,
3238
+ widgetCollections: n
3239
+ });
3240
+ o.length && console.warn(
3241
+ `RuleCMSWidget "${r}": componentProps ${o.map((i) => `"${i}"`).join(", ")} ${o.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.`
3242
+ );
3243
+ }
3244
+ function Ul(e) {
3245
+ return typeof e == "object" && e !== null && !Array.isArray(e);
3246
+ }
3247
+ function Hl(e) {
3248
+ if (e.all !== void 0 && e.all !== null)
3249
+ return !1;
3250
+ const t = e.phone, n = e.tablet, r = e.desktop;
3251
+ return t !== n || t !== r || n !== r;
3252
+ }
3253
+ function mr(e) {
3254
+ var t;
3255
+ if (!((t = e == null ? void 0 : e.rows) != null && t.length))
3256
+ return !1;
3257
+ for (const n of e.rows) {
3258
+ if (yr(n.rowAttributes))
3259
+ return !0;
3260
+ for (const r of n.columns)
3261
+ if (yr(Jt(r)))
3262
+ return !0;
3263
+ }
3264
+ return !1;
3265
+ }
3266
+ function yr(e) {
3267
+ if (!e)
3268
+ return !1;
3269
+ for (const [t, n] of Object.entries(e))
3270
+ if (!(!t.includes("3-resolutions") || !Ul(n))) {
3271
+ if (t === "hide-component-3-resolutions") {
3272
+ const r = n, o = (i) => i === "true" || i === !0;
3273
+ if (o(r.phone) !== o(r.tablet) || o(r.phone) !== o(r.desktop))
3274
+ return !0;
3275
+ continue;
3276
+ }
3277
+ if (Hl(n))
3278
+ return !0;
3279
+ }
3280
+ return !1;
3281
+ }
3282
+ function Yl(e, t) {
3283
+ if (mr(e))
3284
+ return !0;
3285
+ for (const n of Object.values(t))
3286
+ if (mr(n.collectionRows))
3287
+ return !0;
3288
+ return !1;
3289
+ }
3290
+ const So = parseInt(wo, 10), Eo = parseInt(bo, 10), zl = So + 1, Gl = Eo + 1;
3291
+ function ql(e) {
3292
+ const t = `.${e}-phone`, n = `.${e}-tablet`, r = `.${e}-desktop`;
3293
+ return `
3294
+ ${t}, ${n}, ${r} { display: none; }
3295
+ @media (max-width: ${So}px) { ${t} { display: block; } }
3296
+ @media (min-width: ${zl}px) and (max-width: ${Eo}px) { ${n} { display: block; } }
3297
+ @media (min-width: ${Gl}px) { ${r} { display: block; } }
3298
+ `.trim();
3299
+ }
3300
+ function Tn(e) {
3301
+ if (!e)
3302
+ throw new Error("Source components plugin is required, but no plugins were provided");
3303
+ const t = e.sourceComponents;
3304
+ if (!t)
3305
+ throw new Error("Source components plugin is required, but was not found in plugins object");
3306
+ if (!t.components)
3307
+ throw new Error("Source components plugin is missing required property: components");
3308
+ if (typeof t.components != "object" || t.components === null || Array.isArray(t.components))
3309
+ throw new Error(
3310
+ "Source components plugin components must be an object (Record<string, LibraryComponentEntry>)"
3311
+ );
3312
+ return t;
3313
+ }
3314
+ let Xl = 0;
3315
+ var Zl = /* @__PURE__ */ Le("<div><!> <!></div>");
3316
+ function Jl(e, t) {
3317
+ Pe(t, !0);
3318
+ let n = le(t, "isComposeMode", 3, !1), r = le(t, "showDropContainers", 3, !1), o = le(t, "isWithinCollection", 3, !1), i = le(t, "deviceDisplayType", 3, "Desktop");
3319
+ const s = `rulecms-vc-${++Xl}`;
3320
+ function l(x, k, S) {
3321
+ const w = x && !S ? 3 : 1;
3322
+ return !!(k != null && k.length) && k.length > w;
3323
+ }
3324
+ const a = /* @__PURE__ */ A(() => {
3325
+ var x;
3326
+ return (((x = t.displayItemList.containerAttributes) == null ? void 0 : x[En]) || []).join(`;
3327
+ `);
3328
+ }), c = /* @__PURE__ */ A(() => p(a) ? `.${s} {
3329
+ ${p(a)}
3330
+ }` : ""), f = /* @__PURE__ */ A(() => !n() && Nl({
3331
+ containerAttributes: t.displayItemList.containerAttributes,
3332
+ deviceDisplayType: i()
3333
+ })), h = /* @__PURE__ */ A(() => Ol({
3334
+ containerAttributes: t.displayItemList.containerAttributes,
3335
+ deviceDisplayType: i(),
3336
+ isComposeMode: n()
3337
+ })), u = /* @__PURE__ */ A(() => {
3338
+ var S;
3339
+ const x = ((S = t.displayItemList.containerAttributes) == null ? void 0 : S[En]) || [], k = Fl(p(h));
3340
+ return n() && !o() || r() || x.length > 0 || k || l(n(), t.displayItemList.rows, o());
3341
+ }), d = /* @__PURE__ */ A(() => [
3342
+ p(a) ? s : void 0,
3343
+ p(h).cssClasses
3344
+ ].filter(Boolean).join(" ")), m = /* @__PURE__ */ A(() => {
3345
+ var k;
3346
+ return {
3347
+ ...(((k = t.displayItemList.containerAttributes) == null ? void 0 : k[En]) || []).some((S) => S.toLowerCase().startsWith("height:")) ? {} : { height: o() ? "auto" : "100%" },
3348
+ display: "flex",
3349
+ flexDirection: "column",
3350
+ ...p(h).styles
3351
+ };
3352
+ }), y = /* @__PURE__ */ A(() => p(u) ? p(d) : ""), g = /* @__PURE__ */ A(() => p(f) ? { display: "none" } : p(u) ? p(m) : { display: "contents" });
3353
+ var _ = Zl(), R = me(_);
3354
+ {
3355
+ var I = (x) => {
3356
+ var k = se(), S = ne(k);
3357
+ co(S, () => "style", !1, (w, C) => {
3358
+ var b = uo();
3359
+ _e(() => Yn(b, p(c))), F(C, b);
3360
+ }), F(x, k);
3361
+ };
3362
+ De(R, (x) => {
3363
+ p(a) && x(I);
3364
+ });
3365
+ }
3366
+ var j = ln(R, 2);
3367
+ zn(j, () => t.children), _e(
3368
+ (x) => {
3369
+ Gn(_, "hidden", p(f) || void 0), Mt(_, 1, un(p(y) || void 0)), oe(_, x);
3370
+ },
3371
+ [() => ie(p(g))]
3372
+ ), F(e, _), Re();
3373
+ }
3374
+ var Ql = /* @__PURE__ */ Le("<div><!></div>");
3375
+ function $l(e, t) {
3376
+ Pe(t, !0);
3377
+ let n = le(t, "isComposeMode", 3, !1), r = le(t, "showDropContainers", 3, !1), o = le(t, "isWithinCollection", 3, !1), i = le(t, "deviceDisplayType", 3, "Desktop");
3378
+ function s(y, g, _) {
3379
+ var I;
3380
+ const R = y && !_ ? 3 : 1;
3381
+ return !!((I = g == null ? void 0 : g.columns) != null && I.length) && g.columns.length > R;
3382
+ }
3383
+ const l = /* @__PURE__ */ A(() => !n() && xl({ row: t.row, deviceDisplayType: i() })), a = /* @__PURE__ */ A(() => r() || kl(t.row) || s(n(), t.row, o())), c = /* @__PURE__ */ A(() => Dl({
3384
+ row: t.row,
3385
+ deviceDisplayType: i(),
3386
+ isComposeMode: n()
3387
+ })), f = /* @__PURE__ */ A(() => {
3388
+ var g;
3389
+ const y = yt({
3390
+ deviceDisplayType: i(),
3391
+ componentAttributes: t.row.rowAttributes
3392
+ });
3393
+ return tr((g = y == null ? void 0 : y.componentAttributesSpecificToDeviceType) == null ? void 0 : g[er]) ?? "";
3394
+ }), h = /* @__PURE__ */ A(() => p(a) ? p(f) : ""), u = /* @__PURE__ */ A(() => p(l) ? { display: "none" } : p(a) ? p(c) : { display: "contents" });
3395
+ var d = Ql(), m = me(d);
3396
+ zn(m, () => t.children), _e(
3397
+ (y) => {
3398
+ Gn(d, "hidden", p(l) || void 0), Mt(d, 1, un(p(h) || void 0)), oe(d, y);
3399
+ },
3400
+ [() => ie(p(u))]
3401
+ ), F(e, d), Re();
3402
+ }
3403
+ const Io = [
3404
+ "minWidth",
3405
+ "maxWidth",
3406
+ "minHeight",
3407
+ "maxHeight",
3408
+ "margin",
3409
+ "marginTop",
3410
+ "marginRight",
3411
+ "marginBottom",
3412
+ "marginLeft",
3413
+ "padding",
3414
+ "paddingTop",
3415
+ "paddingRight",
3416
+ "paddingBottom",
3417
+ "paddingLeft",
3418
+ "borderWidth",
3419
+ "borderStyle",
3420
+ "borderColor",
3421
+ // Whole-border design token: the one case where the shorthand is emitted
3422
+ "border",
3423
+ "borderRadius",
3424
+ "boxShadow",
3425
+ "width",
3426
+ "height",
3427
+ "gap",
3428
+ // Flex layout (display is derived when any flex layout prop is set)
3429
+ "display",
3430
+ "justifyContent",
3431
+ "alignItems",
3432
+ "flexWrap",
3433
+ "alignContent",
3434
+ "flexDirection",
3435
+ "overflow",
3436
+ "overflowX",
3437
+ "overflowY",
3438
+ "backgroundColor",
3439
+ "backgroundImage",
3440
+ "backgroundSize",
3441
+ "backgroundPosition",
3442
+ "backgroundRepeat",
3443
+ "opacity",
3444
+ // Typography (inherited by text descendants from the column wrapper)
3445
+ "fontFamily",
3446
+ "fontSize",
3447
+ "fontWeight",
3448
+ "fontStyle",
3449
+ "color",
3450
+ "lineHeight",
3451
+ "letterSpacing",
3452
+ "textAlign",
3453
+ "textDecoration",
3454
+ "textTransform"
3455
+ ], ea = (e) => e != null && e !== "", ta = (e) => e ? Io.reduce(
3456
+ (t, n) => {
3457
+ const r = e[n];
3458
+ return ea(r) && (t[n] = r), t;
3459
+ },
3460
+ {}
3461
+ ) : {}, na = (e) => {
3462
+ if (!e)
3463
+ return;
3464
+ const t = { ...e };
3465
+ for (const n of Io)
3466
+ delete t[n];
3467
+ return Object.keys(t).length ? t : void 0;
3468
+ }, ra = (e) => Object.keys(e).length > 0, oa = (e, t) => {
3469
+ const n = (e == null ? void 0 : e.noContainer) ?? !1, r = e == null ? void 0 : e.resolveNoContainer;
3470
+ if (typeof r != "function")
3471
+ return n;
3472
+ try {
3473
+ const o = r(t);
3474
+ if (typeof o == "boolean")
3475
+ return o;
3476
+ console.error(
3477
+ `resolveNoContainer: component "${e == null ? void 0 : e.id}" returned ${typeof o} instead of a boolean; falling back to noContainer=${n}`
3478
+ );
3479
+ } catch (o) {
3480
+ console.error(
3481
+ `resolveNoContainer: component "${e == null ? void 0 : e.id}" threw; falling back to noContainer=${n}`,
3482
+ o
3483
+ );
3484
+ }
3485
+ return n;
3486
+ }, ia = (e, t) => {
3487
+ const n = e == null ? void 0 : e.resolveRendersOwnElement;
3488
+ if (typeof n != "function")
3489
+ return !1;
3490
+ try {
3491
+ const r = n(t);
3492
+ if (typeof r == "boolean")
3493
+ return r;
3494
+ console.error(
3495
+ `resolveRendersOwnElement: component "${e == null ? void 0 : e.id}" returned ${typeof r} instead of a boolean; falling back to false`
3496
+ );
3497
+ } catch (r) {
3498
+ console.error(
3499
+ `resolveRendersOwnElement: component "${e == null ? void 0 : e.id}" threw; falling back to false`,
3500
+ r
3501
+ );
3502
+ }
3503
+ return !1;
3504
+ };
3505
+ var _r = /* @__PURE__ */ Le("<div><!></div>");
3506
+ function sa(e, t) {
3507
+ Pe(t, !0);
3508
+ const n = /* @__PURE__ */ A(() => t.components[po(t.libraryId, t.componentType)]), r = /* @__PURE__ */ A(() => {
3509
+ var _;
3510
+ const g = (_ = p(n)) == null ? void 0 : _.card;
3511
+ return g || (console.error(`DisplayComponent: Component with type ${t.componentType}${t.libraryId ? ` (library "${t.libraryId}")` : ""} not found in components`), null);
3512
+ }), o = /* @__PURE__ */ A(() => ({
3513
+ componentAttributes: t.componentAttributes,
3514
+ styleProps: t.styleProps
3515
+ })), i = /* @__PURE__ */ A(() => p(n) ? oa(p(n), p(o)) : !1), s = /* @__PURE__ */ A(() => ta(t.styleProps)), l = /* @__PURE__ */ A(() => p(i) ? na(t.styleProps) : t.styleProps), a = /* @__PURE__ */ A(() => {
3516
+ var g;
3517
+ return tr((g = t.componentAttributes) == null ? void 0 : g[er]);
3518
+ }), c = /* @__PURE__ */ A(() => p(i) && ra(p(s))), f = /* @__PURE__ */ A(() => !p(i) || (p(n) ? ia(p(n), p(o)) : !1)), h = /* @__PURE__ */ A(() => !p(c) && p(f) ? p(a) : void 0), u = /* @__PURE__ */ A(() => ({
3519
+ componentAttributes: t.componentAttributes,
3520
+ styleProps: p(l),
3521
+ className: p(h),
3522
+ widgetInstanceProps: t.widgetInstanceProps
3523
+ }));
3524
+ var d = se(), m = ne(d);
3525
+ {
3526
+ var y = (g) => {
3527
+ const _ = /* @__PURE__ */ A(() => p(r));
3528
+ var R = se(), I = ne(R);
3529
+ {
3530
+ var j = (S) => {
3531
+ var w = _r(), C = me(w);
3532
+ Cn(C, () => p(_), (b, L) => {
3533
+ L(b, An(() => p(u)));
3534
+ }), _e(
3535
+ (b) => {
3536
+ Mt(w, 1, un(p(a) || void 0)), oe(w, b);
3537
+ },
3538
+ [() => ie(p(s))]
3539
+ ), F(S, w);
3540
+ }, x = (S) => {
3541
+ var w = _r(), C = me(w);
3542
+ Cn(C, () => p(_), (b, L) => {
3543
+ L(b, An(() => p(u)));
3544
+ }), _e(() => Mt(w, 1, un(p(a)))), F(S, w);
3545
+ }, k = (S) => {
3546
+ var w = se(), C = ne(w);
3547
+ Cn(C, () => p(_), (b, L) => {
3548
+ L(b, An(() => p(u)));
3549
+ }), F(S, w);
3550
+ };
3551
+ De(I, (S) => {
3552
+ p(c) ? S(j) : !p(f) && p(a) ? S(x, 1) : S(k, -1);
3553
+ });
3554
+ }
3555
+ F(g, R);
3556
+ };
3557
+ De(m, (g) => {
3558
+ p(r) && g(y);
3559
+ });
3560
+ }
3561
+ F(e, d), Re();
3562
+ }
3563
+ function To(e, t) {
3564
+ Pe(t, !0);
3565
+ let n = le(t, "isComposeMode", 3, !1), r = le(t, "isWithinCollection", 3, !1), o = le(t, "showDropContainers", 3, !1);
3566
+ const i = /* @__PURE__ */ A(() => Tn(t.plugins).components);
3567
+ function s(h) {
3568
+ if (n() && h.type === qn.DroppableBox)
3569
+ return !1;
3570
+ const { componentAttributesBasedOnDevice: u } = vr({
3571
+ col: h,
3572
+ deviceDisplayType: t.deviceDisplayType,
3573
+ isComposeMode: n(),
3574
+ sourceComponentsPlugin: Tn(t.plugins)
3575
+ }), d = !!u && u["hide-component-3-resolutions"] === "true";
3576
+ return !(!n() && d);
3577
+ }
3578
+ function l(h) {
3579
+ const { componentAttributesBasedOnDevice: u, componentStyles: d } = vr({
3580
+ col: h,
3581
+ deviceDisplayType: t.deviceDisplayType,
3582
+ isComposeMode: n(),
3583
+ sourceComponentsPlugin: Tn(t.plugins)
3584
+ });
3585
+ return {
3586
+ componentAttributes: u,
3587
+ styleProps: d
3588
+ };
3589
+ }
3590
+ function a(h) {
3591
+ const u = yo(h.type);
3592
+ if (!(u != null && u.length))
3593
+ return null;
3594
+ const d = h.collection ?? t.widgetCollections[u];
3595
+ if (!d)
3596
+ throw new Error(`DisplayCollection - Collection with ID ${u} not found in widgetCollections. Available collections: ${Object.keys(t.widgetCollections).join(", ")}`);
3597
+ return !d.collectionRows || !Il(d.collectionRows) ? null : d.collectionRows;
3598
+ }
3599
+ function c(h) {
3600
+ return [...t.ancestorColumnIds ?? [], h];
3601
+ }
3602
+ function f(h) {
3603
+ return Wl({
3604
+ componentProps: t.componentProps,
3605
+ ancestorColumnIds: t.ancestorColumnIds,
3606
+ columnId: h
3607
+ });
3608
+ }
3609
+ Jl(e, {
3610
+ get displayItemList() {
3611
+ return t.displayItemList;
3612
+ },
3613
+ get isComposeMode() {
3614
+ return n();
3615
+ },
3616
+ get showDropContainers() {
3617
+ return o();
3618
+ },
3619
+ get isWithinCollection() {
3620
+ return r();
3621
+ },
3622
+ get deviceDisplayType() {
3623
+ return t.deviceDisplayType;
3624
+ },
3625
+ children: (h, u) => {
3626
+ var d = se(), m = ne(d);
3627
+ Ln(m, 17, () => t.displayItemList.rows, (y) => y.id, (y, g) => {
3628
+ $l(y, {
3629
+ get row() {
3630
+ return p(g);
3631
+ },
3632
+ get isComposeMode() {
3633
+ return n();
3634
+ },
3635
+ get showDropContainers() {
3636
+ return o();
3637
+ },
3638
+ get isWithinCollection() {
3639
+ return r();
3640
+ },
3641
+ get deviceDisplayType() {
3642
+ return t.deviceDisplayType;
3643
+ },
3644
+ children: (_, R) => {
3645
+ var I = se(), j = ne(I);
3646
+ Ln(j, 17, () => p(g).columns, (x) => x.id, (x, k) => {
3647
+ var S = se(), w = ne(S);
3648
+ {
3649
+ var C = (L) => {
3650
+ const z = /* @__PURE__ */ A(() => a(p(k)));
3651
+ var M = se(), q = ne(M);
3652
+ {
3653
+ var Je = (Ie) => {
3654
+ {
3655
+ let Qe = /* @__PURE__ */ A(() => c(p(k).id));
3656
+ To(Ie, {
3657
+ get displayItemList() {
3658
+ return p(z);
3659
+ },
3660
+ get isComposeMode() {
3661
+ return n();
3662
+ },
3663
+ isWithinCollection: !0,
3664
+ get widgetCollections() {
3665
+ return t.widgetCollections;
3666
+ },
3667
+ get showDropContainers() {
3668
+ return o();
3669
+ },
3670
+ get reduxDeviceDisplayType() {
3671
+ return t.reduxDeviceDisplayType;
3672
+ },
3673
+ get plugins() {
3674
+ return t.plugins;
3675
+ },
3676
+ get deviceDisplayType() {
3677
+ return t.deviceDisplayType;
3678
+ },
3679
+ get componentProps() {
3680
+ return t.componentProps;
3681
+ },
3682
+ get ancestorColumnIds() {
3683
+ return p(Qe);
3684
+ }
3685
+ });
3686
+ }
3687
+ }, Ut = (Ie) => {
3688
+ {
3689
+ let Qe = /* @__PURE__ */ A(() => l(p(k)).componentAttributes), de = /* @__PURE__ */ A(() => l(p(k)).styleProps), Ht = /* @__PURE__ */ A(() => f(p(k).id));
3690
+ sa(Ie, {
3691
+ get componentType() {
3692
+ return p(k).type;
3693
+ },
3694
+ get libraryId() {
3695
+ return p(k).libraryId;
3696
+ },
3697
+ get componentAttributes() {
3698
+ return p(Qe);
3699
+ },
3700
+ get components() {
3701
+ return p(i);
3702
+ },
3703
+ get styleProps() {
3704
+ return p(de);
3705
+ },
3706
+ get widgetInstanceProps() {
3707
+ return p(Ht);
3708
+ }
3709
+ });
3710
+ }
3711
+ };
3712
+ De(q, (Ie) => {
3713
+ p(z) ? Ie(Je) : Ie(Ut, -1);
3714
+ });
3715
+ }
3716
+ F(L, M);
3717
+ }, b = /* @__PURE__ */ A(() => s(p(k)));
3718
+ De(w, (L) => {
3719
+ p(b) && L(C);
3720
+ });
3721
+ }
3722
+ F(x, S);
3723
+ }), F(_, I);
3724
+ },
3725
+ $$slots: { default: !0 }
3726
+ });
3727
+ }), F(h, d);
3728
+ },
3729
+ $$slots: { default: !0 }
3730
+ }), Re();
3731
+ }
3732
+ function Mn(e, t) {
3733
+ Pe(t, !0);
3734
+ var n = se(), r = ne(n);
3735
+ {
3736
+ var o = (i) => {
3737
+ To(i, {
3738
+ get displayItemList() {
3739
+ return t.displayItemList;
3740
+ },
3741
+ get isComposeMode() {
3742
+ return t.isComposeMode;
3743
+ },
3744
+ get isWithinCollection() {
3745
+ return t.isWithinCollection;
3746
+ },
3747
+ get widgetCollections() {
3748
+ return t.widgetCollections;
3749
+ },
3750
+ get showDropContainers() {
3751
+ return t.showDropContainers;
3752
+ },
3753
+ get reduxDeviceDisplayType() {
3754
+ return t.reduxDeviceDisplayType;
3755
+ },
3756
+ get plugins() {
3757
+ return t.plugins;
3758
+ },
3759
+ get deviceDisplayType() {
3760
+ return t.deviceDisplayType;
3761
+ },
3762
+ get componentProps() {
3763
+ return t.componentProps;
3764
+ },
3765
+ get ancestorColumnIds() {
3766
+ return t.ancestorColumnIds;
3767
+ }
3768
+ });
3769
+ };
3770
+ De(r, (i) => {
3771
+ var s, l;
3772
+ (l = (s = t.displayItemList) == null ? void 0 : s.rows) != null && l.length && i(o);
3773
+ });
3774
+ }
3775
+ F(e, n), Re();
3776
+ }
3777
+ let la = 0;
3778
+ var aa = /* @__PURE__ */ Le("<div><!></div>"), ua = /* @__PURE__ */ Le("<!> <!>", 1);
3779
+ function ca(e, t) {
3780
+ Pe(t, !0);
3781
+ const n = ["Phone", "Tablet", "Desktop"], r = `rulecms-bp-${++la}`, o = /* @__PURE__ */ A(() => t.scopeIdInput ?? r), i = /* @__PURE__ */ A(() => Yl(t.displayItemList, t.widgetCollections)), s = /* @__PURE__ */ A(() => ql(p(o)));
3782
+ var l = se(), a = ne(l);
3783
+ {
3784
+ var c = (h) => {
3785
+ Mn(h, {
3786
+ get displayItemList() {
3787
+ return t.displayItemList;
3788
+ },
3789
+ isComposeMode: !1,
3790
+ isWithinCollection: !1,
3791
+ get widgetCollections() {
3792
+ return t.widgetCollections;
3793
+ },
3794
+ showDropContainers: !1,
3795
+ reduxDeviceDisplayType: "desktop",
3796
+ deviceDisplayType: "Desktop",
3797
+ get plugins() {
3798
+ return t.plugins;
3799
+ },
3800
+ get componentProps() {
3801
+ return t.componentProps;
3802
+ }
3803
+ });
3804
+ }, f = (h) => {
3805
+ var u = ua(), d = ne(u);
3806
+ co(d, () => "style", !1, (y, g) => {
3807
+ var _ = uo();
3808
+ _e(() => Yn(_, p(s))), F(g, _);
3809
+ });
3810
+ var m = ln(d, 2);
3811
+ Ln(m, 16, () => n, (y) => y, (y, g) => {
3812
+ var _ = aa(), R = me(_);
3813
+ Mn(R, {
3814
+ get displayItemList() {
3815
+ return t.displayItemList;
3816
+ },
3817
+ isComposeMode: !1,
3818
+ isWithinCollection: !1,
3819
+ get widgetCollections() {
3820
+ return t.widgetCollections;
3821
+ },
3822
+ showDropContainers: !1,
3823
+ reduxDeviceDisplayType: "desktop",
3824
+ get deviceDisplayType() {
3825
+ return g;
3826
+ },
3827
+ get plugins() {
3828
+ return t.plugins;
3829
+ },
3830
+ get componentProps() {
3831
+ return t.componentProps;
3832
+ }
3833
+ }), _e((I) => Mt(_, 1, I), [() => `${p(o)}-${g.toLowerCase()}`]), F(y, _);
3834
+ }), F(h, u);
3835
+ };
3836
+ De(a, (h) => {
3837
+ p(i) ? h(f, -1) : h(c);
3838
+ });
3839
+ }
3840
+ F(e, l), Re();
3841
+ }
3842
+ function fa(e, t, n) {
3843
+ if (e)
3844
+ return "Phone";
3845
+ if (t)
3846
+ return "Tablet";
3847
+ const r = (n == null ? void 0 : n.toLowerCase()) || "desktop";
3848
+ return r === "phone" ? "Phone" : r === "tablet" ? "Tablet" : "Desktop";
3849
+ }
3850
+ const da = `(max-width: ${wo})`, pa = `(max-width: ${bo})`;
3851
+ function ha(e, t) {
3852
+ Pe(t, !0);
3853
+ let n = /* @__PURE__ */ te("Desktop"), r, o;
3854
+ function i() {
3855
+ N(n, fa((r == null ? void 0 : r.matches) ?? !1, (o == null ? void 0 : o.matches) ?? !1, t.reduxDeviceDisplayType), !0);
3856
+ }
3857
+ Kn(() => (typeof matchMedia == "function" && (r = matchMedia(da), o = matchMedia(pa), r.addEventListener("change", i), o.addEventListener("change", i)), i(), () => {
3858
+ r == null || r.removeEventListener("change", i), o == null || o.removeEventListener("change", i);
3859
+ })), Mn(e, {
3860
+ get displayItemList() {
3861
+ return t.displayItemList;
3862
+ },
3863
+ get isComposeMode() {
3864
+ return t.isComposeMode;
3865
+ },
3866
+ get isWithinCollection() {
3867
+ return t.isWithinCollection;
3868
+ },
3869
+ get widgetCollections() {
3870
+ return t.widgetCollections;
3871
+ },
3872
+ get showDropContainers() {
3873
+ return t.showDropContainers;
3874
+ },
3875
+ get reduxDeviceDisplayType() {
3876
+ return t.reduxDeviceDisplayType;
3877
+ },
3878
+ get deviceDisplayType() {
3879
+ return p(n);
3880
+ },
3881
+ get plugins() {
3882
+ return t.plugins;
3883
+ },
3884
+ get componentProps() {
3885
+ return t.componentProps;
3886
+ }
3887
+ }), Re();
3888
+ }
3889
+ function ga(e) {
3890
+ const t = {};
3891
+ return Object.entries(e).forEach(([n, r]) => {
3892
+ const o = { ...r };
3893
+ if (o.itemList)
3894
+ try {
3895
+ o.collectionRows = typeof o.itemList == "string" ? JSON.parse(o.itemList) : o.itemList;
3896
+ } catch (s) {
3897
+ console.error(`Failed to parse itemList for collection ${n}:`, s), o.collectionRows = { rows: [] };
3898
+ }
3899
+ let i = `${o.name}$${n}`;
3900
+ o.parentId && (i = `${i}@${o.parentId}`), t[i] = o;
3901
+ }), t;
3902
+ }
3903
+ function va(e) {
3904
+ return typeof e.itemList == "string" ? JSON.parse(e.itemList) : e.itemList;
3905
+ }
3906
+ function ko(e) {
3907
+ return {
3908
+ displayItemList: va(e.widget),
3909
+ widgetCollections: ga(e.childCollections),
3910
+ ...e.libraries ? { libraries: e.libraries } : {}
3911
+ };
3912
+ }
3913
+ function ma(e) {
3914
+ const t = e.registry ?? gn(), n = Xn({
3915
+ displayItemList: e.displayItemList,
3916
+ widgetCollections: e.widgetCollections
3917
+ });
3918
+ return t.resolveSync({ registrations: e.libraries, referenced: n });
3919
+ }
3920
+ function ya(e) {
3921
+ const t = e.registry ?? gn(), n = Xn({
3922
+ displayItemList: e.displayItemList,
3923
+ widgetCollections: e.widgetCollections
3924
+ });
3925
+ return t.resolve({ registrations: e.libraries, referenced: n });
3926
+ }
3927
+ const _a = {
3928
+ display: "flex",
3929
+ justifyContent: "center",
3930
+ alignItems: "center",
3931
+ padding: "3rem",
3932
+ color: "#e2e8f0"
3933
+ }, wa = {
3934
+ display: "flex",
3935
+ alignItems: "center",
3936
+ gap: "1rem"
3937
+ }, ba = {
3938
+ width: "40px",
3939
+ height: "40px",
3940
+ border: "4px solid #4a5568",
3941
+ borderTopColor: "#63b3ed",
3942
+ borderRadius: "50%",
3943
+ animation: "spin 1s linear infinite"
3944
+ }, wr = {
3945
+ padding: "1.5rem",
3946
+ backgroundColor: "#742a2a",
3947
+ border: "1px solid #9b2c2c",
3948
+ borderRadius: "8px",
3949
+ color: "#fed7d7"
3950
+ }, br = {
3951
+ fontSize: "16px",
3952
+ fontWeight: "600",
3953
+ marginBottom: "0.5rem",
3954
+ color: "#feb2b2"
3955
+ }, Cr = {
3956
+ fontSize: "14px",
3957
+ color: "#fed7d7"
3958
+ }, Ca = `
3959
+ @keyframes spin {
3960
+ from {
3961
+ transform: rotate(0deg);
3962
+ }
3963
+ to {
3964
+ transform: rotate(360deg);
3965
+ }
3966
+ }
3967
+ `, Ha = "data-rulecms-published-key";
3968
+ var Aa = /* @__PURE__ */ Le("<div><div><div></div></div></div>"), Sa = /* @__PURE__ */ Le("<div><div>Error Loading Widget</div> <div> </div></div>"), Ea = /* @__PURE__ */ Le("<div><div>No Widget Data</div> <div>No widget data available</div></div>"), Ia = /* @__PURE__ */ Le('<span style="display: contents"><!></span>');
3969
+ function Ya(e, t) {
3970
+ Pe(t, !0);
3971
+ let n = le(t, "mode", 3, "client-fetch");
3972
+ const r = Ro(_o);
3973
+ let o = /* @__PURE__ */ te(!1), i = /* @__PURE__ */ te(null), s = /* @__PURE__ */ te(null), l = /* @__PURE__ */ te(null);
3974
+ const a = /* @__PURE__ */ A(() => n() === "pre-fetched"), c = /* @__PURE__ */ A(() => ({ sourceComponents: p(l) ?? void 0 }));
3975
+ let f = null, h = null, u = !1;
3976
+ function d() {
3977
+ if (!p(s)) {
3978
+ N(l, null);
3979
+ return;
3980
+ }
3981
+ const w = t.libraries ?? (r == null ? void 0 : r.libraries), C = r == null ? void 0 : r.libraryRegistry, b = ma({
3982
+ displayItemList: p(s).displayItemList,
3983
+ widgetCollections: p(s).widgetCollections,
3984
+ libraries: w,
3985
+ registry: C
3986
+ });
3987
+ if (b) {
3988
+ N(l, b, !0);
3989
+ return;
3990
+ }
3991
+ ya({
3992
+ displayItemList: p(s).displayItemList,
3993
+ widgetCollections: p(s).widgetCollections,
3994
+ libraries: w,
3995
+ registry: C
3996
+ }).then((L) => {
3997
+ N(l, L, !0);
3998
+ });
3999
+ }
4000
+ function m() {
4001
+ p(s) && Kl({
4002
+ componentProps: t.componentProps,
4003
+ displayItemList: p(s).displayItemList,
4004
+ widgetCollections: p(s).widgetCollections,
4005
+ publishedKey: t.publishedKey
4006
+ });
4007
+ }
4008
+ function y() {
4009
+ if (u || typeof document > "u")
4010
+ return;
4011
+ const w = "rulecms-widget-spinner-styles";
4012
+ if (!document.getElementById(w)) {
4013
+ const C = document.createElement("style");
4014
+ C.id = w, C.textContent = Ca, document.head.appendChild(C);
4015
+ }
4016
+ u = !0;
4017
+ }
4018
+ function g() {
4019
+ const w = t.token ?? (r == null ? void 0 : r.token), C = t.endpoint ?? (r == null ? void 0 : r.endpoint);
4020
+ if (!t.publishedKey || !w) {
4021
+ N(
4022
+ i,
4023
+ t.publishedKey ? "Token is required. Provide it either directly as a prop (`token`) or via RuleCMSWidgetProvider." : pt(w) ? "Widget key is required" : "Published key is required",
4024
+ !0
4025
+ ), N(s, null);
4026
+ return;
4027
+ }
4028
+ const b = `${t.publishedKey}|${w}`;
4029
+ if (h === b && p(s)) {
4030
+ d();
4031
+ return;
4032
+ }
4033
+ f == null || f.abort(), f = new AbortController();
4034
+ const L = f.signal;
4035
+ h = b, N(o, !0), N(i, null);
4036
+ const z = vo({
4037
+ publishedKey: t.publishedKey,
4038
+ token: w,
4039
+ endpoint: C
4040
+ });
4041
+ fetch(z, {
4042
+ method: "GET",
4043
+ headers: { "Content-Type": "application/json" },
4044
+ ...pt(w) ? { cache: "no-store" } : {},
4045
+ signal: L
4046
+ }).then(async (M) => {
4047
+ if (M.ok) {
4048
+ const q = await M.json();
4049
+ q.success ? (N(s, ko(q.data), !0), N(i, null), d(), m()) : (N(i, "Failed to fetch widget data"), N(s, null));
4050
+ } else {
4051
+ const q = await M.json().catch(() => ({ error: "Unknown error" }));
4052
+ N(i, q.error || `Request failed with status ${M.status}`, !0), N(s, null);
4053
+ }
4054
+ }).catch((M) => {
4055
+ M instanceof DOMException && M.name === "AbortError" || (console.error("Error fetching widget:", M), N(i, "Failed to fetch widget"), N(s, null));
4056
+ }).finally(() => {
4057
+ N(o, !1);
4058
+ });
4059
+ }
4060
+ function _() {
4061
+ if (n() === "pre-fetched") {
4062
+ N(s, t.initialData ?? null, !0), N(o, !1), N(i, null), d(), m();
4063
+ return;
4064
+ }
4065
+ y(), g();
4066
+ }
4067
+ Kn(() => (t.publishedKey, t.token, t.endpoint, n(), t.initialData, t.libraries, t.componentProps, Lo(() => _()), () => {
4068
+ f == null || f.abort();
4069
+ }));
4070
+ var R = Ia(), I = me(R);
4071
+ {
4072
+ var j = (w) => {
4073
+ var C = Aa(), b = me(C), L = me(b);
4074
+ _e(
4075
+ (z, M, q) => {
4076
+ oe(C, z), oe(b, M), oe(L, q);
4077
+ },
4078
+ [
4079
+ () => ie(_a),
4080
+ () => ie(wa),
4081
+ () => ie(ba)
4082
+ ]
4083
+ ), F(w, C);
4084
+ }, x = (w) => {
4085
+ var C = Sa(), b = me(C), L = ln(b, 2), z = me(L);
4086
+ _e(
4087
+ (M, q, Je) => {
4088
+ oe(C, M), oe(b, q), oe(L, Je), Yn(z, p(i));
4089
+ },
4090
+ [
4091
+ () => ie(wr),
4092
+ () => ie(br),
4093
+ () => ie(Cr)
4094
+ ]
4095
+ ), F(w, C);
4096
+ }, k = (w) => {
4097
+ var C = Ea(), b = me(C), L = ln(b, 2);
4098
+ _e(
4099
+ (z, M, q) => {
4100
+ oe(C, z), oe(b, M), oe(L, q);
4101
+ },
4102
+ [
4103
+ () => ie(wr),
4104
+ () => ie(br),
4105
+ () => ie(Cr)
4106
+ ]
4107
+ ), F(w, C);
4108
+ }, S = (w) => {
4109
+ var C = se(), b = ne(C);
4110
+ {
4111
+ var L = (M) => {
4112
+ ca(M, {
4113
+ get displayItemList() {
4114
+ return p(s).displayItemList;
4115
+ },
4116
+ get widgetCollections() {
4117
+ return p(s).widgetCollections;
4118
+ },
4119
+ get plugins() {
4120
+ return p(c);
4121
+ },
4122
+ get componentProps() {
4123
+ return t.componentProps;
4124
+ }
4125
+ });
4126
+ }, z = (M) => {
4127
+ ha(M, {
4128
+ get displayItemList() {
4129
+ return p(s).displayItemList;
4130
+ },
4131
+ isComposeMode: !1,
4132
+ isWithinCollection: !1,
4133
+ get widgetCollections() {
4134
+ return p(s).widgetCollections;
4135
+ },
4136
+ showDropContainers: !1,
4137
+ reduxDeviceDisplayType: "desktop",
4138
+ get plugins() {
4139
+ return p(c);
4140
+ },
4141
+ get componentProps() {
4142
+ return t.componentProps;
4143
+ }
4144
+ });
4145
+ };
4146
+ De(b, (M) => {
4147
+ p(a) ? M(L) : M(z, -1);
4148
+ });
4149
+ }
4150
+ F(w, C);
4151
+ };
4152
+ De(I, (w) => {
4153
+ n() !== "pre-fetched" && p(o) ? w(j) : n() !== "pre-fetched" && p(i) ? w(x, 1) : n() !== "pre-fetched" && !p(s) ? w(k, 2) : p(l) && p(s) && w(S, 3);
4154
+ });
4155
+ }
4156
+ _e(() => Gn(R, "data-rulecms-published-key", t.publishedKey)), F(e, R), Re();
4157
+ }
4158
+ class Gt extends Error {
4159
+ constructor(n, r) {
4160
+ super(n);
4161
+ pe(this, "status");
4162
+ this.name = "FetchRuleCMSWidgetError", this.status = r;
4163
+ }
4164
+ }
4165
+ async function za(e) {
4166
+ const { publishedKey: t, token: n, endpoint: r, fetchOptions: o } = e;
4167
+ if (!t)
4168
+ throw new Gt(
4169
+ pt(n) ? "Widget key is required" : "Published key is required"
4170
+ );
4171
+ if (!n)
4172
+ throw new Gt("Token is required");
4173
+ const i = vo({ publishedKey: t, token: n, endpoint: r }), s = await fetch(i, {
4174
+ method: "GET",
4175
+ headers: { "Content-Type": "application/json" },
4176
+ ...pt(n) ? { cache: "no-store" } : {},
4177
+ ...o
4178
+ });
4179
+ if (!s.ok) {
4180
+ const a = await s.json().catch(() => ({ error: "Unknown error" }));
4181
+ throw new Gt(
4182
+ a.error || `Request failed with status ${s.status}`,
4183
+ s.status
4184
+ );
4185
+ }
4186
+ const l = await s.json();
4187
+ if (!l.success)
4188
+ throw new Gt("Failed to fetch widget data");
4189
+ return ko(l.data);
4190
+ }
4191
+ async function Ga(e) {
4192
+ const { data: t, libraries: n } = e, r = Xn({
4193
+ displayItemList: t.displayItemList,
4194
+ widgetCollections: t.widgetCollections
4195
+ });
4196
+ return gn().resolve({ registrations: n, referenced: r });
4197
+ }
4198
+ export {
4199
+ Pa as AlignContentTypes,
4200
+ ca as BreakpointVariantRender,
4201
+ go as COLLECTION_TYPE_PREFIX,
4202
+ nr as COMPONENT_PROPS_PATH_SEPARATOR,
4203
+ er as CSS_CLASSES_ATTRIBUTE_NAME,
4204
+ Ls as CSS_VARIABLE_NAME_MAX_LENGTH,
4205
+ Rs as CSS_VARIABLE_NAME_PATTERN,
4206
+ hs as DEFAULT_CLOUDINARY_CLOUD_NAME,
4207
+ Kt as DEFAULT_LIBRARY_ID,
4208
+ Tl as DEFAULT_ROW_GAP,
4209
+ $i as DEV_CLIENT_TOKEN_PREFIX,
4210
+ rs as DEV_WIDGET_API_PATH,
4211
+ Ra as DeviceDisplayTypes,
4212
+ sa as DisplayComponent,
4213
+ qn as DisplayItemTypes,
4214
+ ho as DragItemIdPrefixTypes,
4215
+ cs as EMBEDDED_KEY_SEPARATOR,
4216
+ tl as FLEX_LAYOUT_STYLE_KEYS_THAT_DERIVE_DISPLAY,
4217
+ Gt as FetchRuleCMSWidgetError,
4218
+ Ao as HIDE_WIDGET_ATTRIBUTE_NAME,
4219
+ gr as JustifyContentTypes,
4220
+ us as PUBLISHED_KEY_SEPARATOR,
4221
+ ns as PUBLISHED_WIDGET_API_PATH,
4222
+ Da as PageViewTypes,
4223
+ es as RULECMS_API_ORIGIN,
4224
+ Ha as RULECMS_PUBLISHED_KEY_ATTRIBUTE,
4225
+ _o as RULECMS_WIDGET_CONTEXT_KEY,
4226
+ ha as RenderComponents,
4227
+ Mn as RenderComponentsForDevice,
4228
+ To as RenderComponentsInner,
4229
+ Ya as RuleCMSWidget,
4230
+ Va as RuleCMSWidgetProvider,
4231
+ Ll as WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE,
4232
+ ts as WIDGET_CACHE_API_ORIGIN,
4233
+ Zs as alignContentAllowlist,
4234
+ qs as alignItemsAllowlist,
4235
+ $s as backgroundPositionAllowlist,
4236
+ el as backgroundRepeatAllowlist,
4237
+ Qs as backgroundSizeAllowlist,
4238
+ nl as borderStyleKeywords,
4239
+ Os as boxSpacingSideKeys,
4240
+ Ua as boxSpacingStyleAttributeEntries,
4241
+ Ps as buildCloudinaryBackgroundUrl,
4242
+ vo as buildWidgetFetchUrl,
4243
+ jl as collectComponentInstancePaths,
4244
+ Xn as collectReferencedLibraryIds,
4245
+ Qi as composeSourceComponentsPlugin,
4246
+ gn as createComponentLibraryRegistry,
4247
+ En as cssAttrArrayKey,
4248
+ ps as defaultPageWidth,
4249
+ Al as deriveDisplayFlexIfNeeded,
4250
+ Ba as desktopModeWidth,
4251
+ za as fetchRuleCMSWidget,
4252
+ Bl as findUnmatchedComponentPropsKeys,
4253
+ Js as flexDirectionAllowlist,
4254
+ Xs as flexWrapAllowlist,
4255
+ Bs as fontFamilyAllowlist,
4256
+ Us as fontStyleAllowlist,
4257
+ Ks as fontWeightAllowlist,
4258
+ fl as formatBackgroundImageStyles,
4259
+ dl as formatBorderStyles,
4260
+ pl as formatBoxShadowStyles,
4261
+ gl as formatBoxSpacingStyles,
4262
+ vl as formatCssColorStyles,
4263
+ Qn as formatCssColorValue,
4264
+ ml as formatCssEnumStyles,
4265
+ yl as formatCssLengthStyles,
4266
+ Ee as formatCssVariable,
4267
+ Ka as formatCssVariableStyles,
4268
+ _l as formatLineHeightStyles,
4269
+ bl as formatObjectStyleAttribute,
4270
+ wl as formatOpacityStyles,
4271
+ gt as formatSpacingSideValue,
4272
+ fs as generatePublishedKey,
4273
+ Wa as generatePublishedKeyForEmbedded,
4274
+ yo as getCollectionIdForCollectionType,
4275
+ Jt as getColumnAttributes,
4276
+ vr as getComponentAttributesAndStyles,
4277
+ Tn as getComponentsPluginFromPlugins,
4278
+ H as getCssVariableFromLeaf,
4279
+ Sl as getDefaultDimensionAttributes,
4280
+ yt as getDeviceTypeBasedAttributes,
4281
+ La as getDragItemId,
4282
+ is as getDragItemPrefixAndId,
4283
+ ss as getIdAndPrefix,
4284
+ El as getMergedAttributes,
4285
+ Ma as getNameAndInstanceIdFromWidgetKey,
4286
+ Na as getNameFromWidgetKey,
4287
+ ls as getWidgetKeyForCollection,
4288
+ Oa as getWidgetKeyForCollectionWithPrefix,
4289
+ as as getWidgetKeyForPublishedCollection,
4290
+ Fa as getWidgetKeyForPublishedCollectionWithPrefix,
4291
+ al as hasBoxShadowLeaf,
4292
+ Yl as hasDeviceDivergentValues,
4293
+ Me as hasInvalidCssVariable,
4294
+ Il as hasItems,
4295
+ ja as incrementVersion,
4296
+ Ms as isBackgroundImageValue,
4297
+ rl as isBorderStyleValue,
4298
+ ol as isBorderValue,
4299
+ ll as isBoxShadowValue,
4300
+ Fs as isBoxSpacingValue,
4301
+ Is as isCloudinaryCloudName,
4302
+ Es as isCloudinaryPublicId,
4303
+ ks as isCloudinaryTransformationString,
4304
+ Jn as isCssColorValue,
4305
+ Vs as isCssEnumValue,
4306
+ Co as isCssVariableName,
4307
+ pt as isDevClientToken,
4308
+ ul as isLineHeightValue,
4309
+ cl as isOpacityValue,
4310
+ xl as isRowHiddenForDevice,
4311
+ Ts as isSafeImageUrl,
4312
+ ht as isSpacingSideValue,
4313
+ Nl as isWidgetHiddenForDevice,
4314
+ Gs as justifyContentAllowlist,
4315
+ tr as normalizeCssClasses,
4316
+ $n as objectStyleAttributeRegistry,
4317
+ In as overflowAllowlist,
4318
+ wo as phoneModeWidth,
4319
+ ko as prepareRuleCMSWidgetData,
4320
+ po as resolveKey,
4321
+ Dl as resolveRowStyles,
4322
+ os as resolveWidgetApiOrigin,
4323
+ Ol as resolveWidgetContainerStyles,
4324
+ Wl as resolveWidgetInstanceProps,
4325
+ Ga as resolveWidgetLibraries,
4326
+ kl as rowBasedPropertiesAreAssigned,
4327
+ Zn as spacingKeywords,
4328
+ Ns as spacingLengthUnits,
4329
+ bo as tabletModeWidth,
4330
+ Hs as textAlignAllowlist,
4331
+ Ys as textDecorationAllowlist,
4332
+ zs as textTransformAllowlist,
4333
+ ie as toStyleAttr,
4334
+ mo as typeHasPrefix,
4335
+ Kl as warnUnmatchedComponentProps,
4336
+ Fl as widgetBasedPropertiesAreAssigned
4337
+ };