@cntrl-site/components 1.0.107-alpha.5 → 1.0.107-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,794 +0,0 @@
1
- import { jsx as u, jsxs as A, Fragment as Qe } from "react/jsx-runtime";
2
- import { useRef as _, useState as h, useMemo as Ge, useEffect as y, useCallback as Ot, useLayoutEffect as re, Fragment as Ft } from "react";
3
- import { createPortal as Ht } from "react-dom";
4
- import x from "classnames";
5
- import { s as Ut } from "./scalingValue-C9JH5L6O.mjs";
6
- import { b as kt } from "./buildColorVars-CLyWQm5K.mjs";
7
- import { u as zt } from "./useScopedStyles-DhBG3557.mjs";
8
- import { b as Bt } from "./LinkWrapper-CFEH047t.mjs";
9
- import { o as Ke, t as Xe } from "./textStylesToCss-05Mn6I_2.mjs";
10
- import { u as Dt } from "./useLightboxScrollLock-VQ07s7EJ.mjs";
11
- const Vt = 1, Pe = 2, Wt = 5, jt = ["title2", "title3", "title4"], G = ["column1Width", "column2Width", "column3Width", "column4Width"], ae = {
12
- center: { x: "50%", y: "50%" },
13
- "left-top": { x: "0%", y: "0%" },
14
- "top-center": { x: "50%", y: "0%" },
15
- "top-right": { x: "100%", y: "0%" },
16
- "left-center": { x: "0%", y: "50%" },
17
- "right-center": { x: "100%", y: "50%" },
18
- "left-bottom": { x: "0%", y: "100%" },
19
- "bottom-center": { x: "50%", y: "100%" },
20
- "right-bottom": { x: "100%", y: "100%" }
21
- }, yo = Object.keys(ae), Gt = ["column1", "column2", "column3", "column4", "column5"], Kt = {
22
- triggerColor: "trigger-color",
23
- triggerHoverColor: "trigger-hover-color",
24
- closeColor: "close-color",
25
- closeHoverColor: "close-hover-color",
26
- panelColor: "panel-color",
27
- textColor: "text-color",
28
- textHoverColor: "text-hover-color",
29
- overlayColor: "overlay-color"
30
- }, Xt = ["hover", "open"], z = 300, et = 4e-3, Ye = 4e-3, Yt = 20, tt = 0.0139, ot = 0.3194, nt = { top: 972e-5, right: 972e-5, bottom: 972e-5, left: 972e-5 }, le = 300, qt = 1e3, Zt = [
31
- "--cntrl-article-width",
32
- "--cntrl-article-top",
33
- "--cntrl-article-left",
34
- "--cntrl-viewport-height"
35
- ];
36
- function K(e) {
37
- return Math.min(Math.max(Math.round(e ?? Pe), Vt), Wt);
38
- }
39
- function rt(e) {
40
- const { panelWidth: o = ot, panelPadding: n = nt, columnGap: i = tt } = e, a = (K(e.columns) - 1) * i;
41
- return Math.max(0, o - n.left - n.right - a);
42
- }
43
- function Jt(e) {
44
- const o = K(e.columns), n = rt(e) / o;
45
- return Object.fromEntries(G.slice(0, o - 1).map((i) => [i, n]));
46
- }
47
- function Qt(e) {
48
- const o = K(e.columns), n = rt(e), i = G.slice(0, o - 1).map((m) => {
49
- const p = e[m];
50
- return typeof p == "number" ? Math.max(0, p) : n / o;
51
- }), a = i.reduce((m, p) => m + p, 0), s = a > n ? n / a : 1;
52
- return [...i.map((m) => m * s), Math.max(0, n - a * s)];
53
- }
54
- function wo(e, o) {
55
- return typeof e.columns != "number" || e.columns === o.columns ? e : { ...e, ...Jt({ ...o, ...e }) };
56
- }
57
- function Pt(e) {
58
- const o = e.reduce((n, i) => n + i, 0);
59
- return e.map((n) => `minmax(0, ${o > 0 ? n / o * 100 : 1}fr)`).join(" ");
60
- }
61
- function eo(e) {
62
- const o = [];
63
- return e.forEach((n, i) => {
64
- var d;
65
- const a = ((d = n.group) == null ? void 0 : d.trim()) ?? "", s = o[o.length - 1];
66
- if (!s || a !== "" && a !== s.label) {
67
- o.push({ label: a, rows: [{ item: n, index: i }] });
68
- return;
69
- }
70
- s.rows.push({ item: n, index: i });
71
- }), o;
72
- }
73
- function k(e) {
74
- const { image: o } = e ?? {};
75
- return (Array.isArray(o) ? o : o ? [o] : []).filter((n) => !!(n != null && n.assetId));
76
- }
77
- function to(e) {
78
- if (!Array.isArray(e)) return e ?? "";
79
- const o = (n) => n.text ?? (n.children ?? []).map(o).join("");
80
- return e.map(o).join(`
81
- `);
82
- }
83
- function qe(e, o, n) {
84
- return `${e}-${o}-${n}`;
85
- }
86
- function at(e) {
87
- return e.type === "video" ? !0 : e.type === "image" ? !1 : /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.name ?? "") || /\.(mp4|webm|ogg|mov)(\?|$)/i.test(e.assetId);
88
- }
89
- function oo(e) {
90
- let o = e;
91
- for (; o; ) {
92
- if (getComputedStyle(o).getPropertyValue("--cntrl-article-width").trim())
93
- return o;
94
- o = o.parentElement;
95
- }
96
- return e;
97
- }
98
- function Ze(e) {
99
- const o = {}, n = oo(e);
100
- if (!n) return o;
101
- const i = getComputedStyle(n);
102
- for (const a of Zt) {
103
- const s = i.getPropertyValue(a).trim();
104
- s && (o[a] = s);
105
- }
106
- return o;
107
- }
108
- function Je(e, o, n) {
109
- const i = e, a = (d) => i[`${o}${d}`] ?? (n ? i[`${n}${d}`] : void 0), s = a("FontSettings");
110
- return {
111
- fontSettings: {
112
- fontFamily: a("FontFamily"),
113
- fontWeight: (s == null ? void 0 : s.fontWeight) ?? 400,
114
- fontStyle: (s == null ? void 0 : s.fontStyle) ?? "normal"
115
- },
116
- fontSize: a("FontSize") ?? 0.01,
117
- lineHeight: a("LineHeight"),
118
- letterSpacing: a("LetterSpacing") ?? 0,
119
- wordSpacing: a("WordSpacing") ?? 0,
120
- textAlign: a("TextAlign"),
121
- textAppearance: a("TextAppearance"),
122
- color: "#000000"
123
- };
124
- }
125
- function no(e) {
126
- return `
127
- .${e}-trigger,
128
- .${e}-close {
129
- display: inline-block;
130
- margin: 0;
131
- padding: 0;
132
- border: 0;
133
- background: none;
134
- cursor: pointer;
135
- white-space: nowrap;
136
- transition: color 150ms ease;
137
- -webkit-appearance: none;
138
- appearance: none;
139
- -webkit-tap-highlight-color: transparent;
140
- }
141
- .${e}-trigger {
142
- color: var(--${e}-trigger-color);
143
- transition: color 150ms ease, opacity ${z}ms ease;
144
- }
145
- .${e}-trigger-hidden {
146
- opacity: 0;
147
- }
148
- .${e}-close {
149
- color: var(--${e}-close-color);
150
- }
151
- .${e}-trigger:focus,
152
- .${e}-close:focus {
153
- outline: none;
154
- }
155
- .${e}-trigger:focus-visible,
156
- .${e}-close:focus-visible {
157
- outline: 1px solid currentColor;
158
- outline-offset: 2px;
159
- }
160
- .${e}-interactive .${e}-trigger:hover,
161
- .${e}-state-hover .${e}-trigger {
162
- color: var(--${e}-trigger-hover-color, var(--${e}-trigger-color));
163
- }
164
- .${e}-close:hover {
165
- color: var(--${e}-close-hover-color, var(--${e}-close-color));
166
- }
167
- .${e}-editor .${e}-trigger {
168
- cursor: default;
169
- }
170
- .${e}-overlay {
171
- position: fixed;
172
- inset: 0;
173
- z-index: 9997;
174
- overflow: hidden;
175
- overscroll-behavior: none;
176
- opacity: 0;
177
- pointer-events: none;
178
- transition: opacity ${z}ms ease;
179
- }
180
- .${e}-inline-layer {
181
- position: fixed;
182
- inset: 0;
183
- z-index: 9997;
184
- overflow: hidden;
185
- pointer-events: none;
186
- }
187
- .${e}-overlay-editor {
188
- inset: auto;
189
- top: var(--cntrl-article-top, 0);
190
- left: var(--cntrl-article-left, 0);
191
- width: var(--cntrl-article-width, 100vw) !important;
192
- height: var(--cntrl-viewport-height, 100vh) !important;
193
- }
194
- .${e}-overlay-edit-mode {
195
- z-index: 1;
196
- }
197
- .${e}-overlay-active {
198
- opacity: 1;
199
- pointer-events: auto;
200
- }
201
- .${e}-backdrop {
202
- position: absolute;
203
- inset: 0;
204
- background-color: var(--${e}-overlay-color);
205
- }
206
- .${e}-media-layer {
207
- position: absolute;
208
- inset: 0;
209
- pointer-events: none;
210
- }
211
- .${e}-media {
212
- position: absolute;
213
- inset: 0;
214
- width: 100%;
215
- height: 100%;
216
- object-fit: cover;
217
- opacity: 0;
218
- }
219
- .${e}-media-contain {
220
- object-fit: contain;
221
- }
222
- /* The image replaced stays whole under the next until that is in, then goes at once, so neither the page nor an older
223
- image shows between them; only the image coming in and, as the list is left, those on screen fade. */
224
- .${e}-media-visible,
225
- .${e}-media-fading {
226
- transition: opacity ${le}ms cubic-bezier(0, 0, 0.58, 1);
227
- }
228
- .${e}-media-visible {
229
- z-index: 1;
230
- opacity: 1;
231
- }
232
- .${e}-media-covered {
233
- opacity: 1;
234
- }
235
- .${e}-media-fading {
236
- opacity: 0;
237
- }
238
- .${e}-close {
239
- position: absolute;
240
- z-index: 2;
241
- }
242
- .${e}-panel {
243
- position: absolute;
244
- top: var(--${e}-panel-y);
245
- left: var(--${e}-panel-x);
246
- z-index: 1;
247
- box-sizing: border-box;
248
- max-width: 100%;
249
- max-height: 100%;
250
- overflow-y: auto;
251
- transform: translate(calc(-1 * var(--${e}-panel-x)), calc(-1 * var(--${e}-panel-y) + 12px));
252
- background-color: var(--${e}-panel-color);
253
- color: var(--${e}-text-color);
254
- overscroll-behavior: contain;
255
- transition: transform ${z}ms cubic-bezier(0, 0, 0.58, 1);
256
- }
257
- .${e}-overlay-active .${e}-panel {
258
- transform: translate(calc(-1 * var(--${e}-panel-x)), calc(-1 * var(--${e}-panel-y)));
259
- }
260
- .${e}-panel-settled {
261
- transition: none;
262
- }
263
- .${e}-panel-inline {
264
- position: relative;
265
- top: auto;
266
- left: auto;
267
- max-height: none;
268
- transform: none;
269
- transition: none;
270
- }
271
- .${e}-media-layer-instant .${e}-media {
272
- transition: none;
273
- }
274
- .${e}-panel-copy {
275
- position: absolute;
276
- pointer-events: none;
277
- }
278
- @media (prefers-reduced-motion: reduce) {
279
- .${e}-panel {
280
- transition: none;
281
- }
282
- }
283
- .${e}-group ~ .${e}-group {
284
- margin-top: var(--${e}-group-gap);
285
- }
286
- .${e}-group {
287
- display: grid;
288
- grid-template-columns: var(--${e}-grid-columns);
289
- column-gap: var(--${e}-column-gap);
290
- }
291
- .${e}-row {
292
- grid-column: 2 / -1;
293
- display: grid;
294
- grid-template-columns: subgrid;
295
- align-items: baseline;
296
- }
297
- a.${e}-row {
298
- color: inherit;
299
- text-decoration: none;
300
- }
301
- .${e}-group-unlabeled .${e}-row {
302
- grid-column: 1 / -1;
303
- }
304
- .${e}-group-label {
305
- grid-column: 1;
306
- align-self: start;
307
- min-width: 0;
308
- overflow-wrap: anywhere;
309
- }
310
- .${e}-title {
311
- min-width: 0;
312
- overflow-wrap: anywhere;
313
- white-space: pre-line;
314
- transition: color 150ms cubic-bezier(0, 0, 0.58, 1);
315
- }
316
- .${e}-control-anchor {
317
- position: absolute;
318
- pointer-events: none;
319
- z-index: 2;
320
- }
321
- .${e}-interactive .${e}-row:hover .${e}-title,
322
- .${e}-row:focus-visible .${e}-title,
323
- .${e}-panel-copy .${e}-row-active .${e}-title,
324
- .${e}-state-hover .${e}-row:first-of-type .${e}-title {
325
- color: var(--${e}-text-hover-color, var(--${e}-text-color));
326
- }
327
- `;
328
- }
329
- function ro({
330
- P: e,
331
- media: o,
332
- isVisible: n,
333
- isLoaded: i,
334
- isCovered: a,
335
- isFading: s,
336
- onLoad: d
337
- }) {
338
- const m = _(null), p = at(o), r = x(
339
- `${e}-media`,
340
- o.objectFit === "contain" && `${e}-media-contain`,
341
- n && i && `${e}-media-visible`,
342
- a && `${e}-media-covered`,
343
- s && `${e}-media-fading`
344
- );
345
- return y(() => {
346
- var T;
347
- const R = m.current;
348
- !p || !R || (n ? (T = R.play()) == null || T.catch(() => {
349
- }) : R.pause());
350
- }, [p, n]), p ? /* @__PURE__ */ u(
351
- "video",
352
- {
353
- ref: m,
354
- className: r,
355
- src: o.assetId,
356
- muted: !0,
357
- loop: !0,
358
- playsInline: !0,
359
- preload: "auto",
360
- onLoadedData: d
361
- }
362
- ) : /* @__PURE__ */ u(
363
- "img",
364
- {
365
- className: r,
366
- src: o.assetId,
367
- alt: "",
368
- decoding: "async",
369
- onLoad: d
370
- }
371
- );
372
- }
373
- function ao(e, o, n, i, a) {
374
- const s = o[o.length - 1];
375
- let d = n;
376
- return o.slice(0, -1).map((m, p) => {
377
- const r = d + m + i / 2;
378
- return d += m + i, /* @__PURE__ */ u(
379
- "div",
380
- {
381
- "data-controls": G[p],
382
- "data-controls-axis": "x",
383
- "data-controls-variant": "column-width",
384
- "data-controls-min": String(Yt),
385
- "data-controls-max-fraction": String(m + s),
386
- className: `${e}-control-anchor`,
387
- style: { top: 0, left: a(r - Ye / 2), width: a(Ye), height: "100%" }
388
- },
389
- G[p]
390
- );
391
- });
392
- }
393
- function lo(e, o, n, i) {
394
- const a = (s) => i(Math.max(s, et));
395
- return /* @__PURE__ */ A(Qe, { children: [
396
- /* @__PURE__ */ u(
397
- "div",
398
- {
399
- "data-controls": "panelPadding.top",
400
- "data-controls-axis": "y",
401
- "data-controls-variant": "row-padding",
402
- "data-controls-min": "0",
403
- className: `${e}-control-anchor`,
404
- style: { top: 0, left: 0, width: "100%", height: a(n.top) }
405
- }
406
- ),
407
- /* @__PURE__ */ u(
408
- "div",
409
- {
410
- "data-controls": "panelPadding.bottom",
411
- "data-controls-axis": "y",
412
- "data-controls-variant": "row-padding",
413
- "data-controls-reverse": "",
414
- "data-controls-min": "0",
415
- className: `${e}-control-anchor`,
416
- style: { bottom: 0, left: 0, width: "100%", height: a(n.bottom) }
417
- }
418
- ),
419
- /* @__PURE__ */ u(
420
- "div",
421
- {
422
- "data-controls": "panelPadding.left",
423
- "data-controls-axis": "x",
424
- "data-controls-variant": "column-padding",
425
- "data-controls-min": "0",
426
- "data-controls-max-fraction": String(Math.max(0, o - n.right)),
427
- className: `${e}-control-anchor`,
428
- style: { top: 0, left: 0, width: a(n.left), height: "100%" }
429
- }
430
- ),
431
- /* @__PURE__ */ u(
432
- "div",
433
- {
434
- "data-controls": "panelPadding.right",
435
- "data-controls-axis": "x",
436
- "data-controls-variant": "column-padding",
437
- "data-controls-reverse": "",
438
- "data-controls-min": "0",
439
- "data-controls-max-fraction": String(Math.max(0, o - n.left)),
440
- className: `${e}-control-anchor`,
441
- style: { top: 0, right: 0, width: a(n.right), height: "100%" }
442
- }
443
- )
444
- ] });
445
- }
446
- function bo({
447
- settings: e,
448
- content: o,
449
- isEditor: n,
450
- isEditMode: i,
451
- isPreviewMode: a,
452
- activeEvent: s,
453
- portalId: d,
454
- currentState: m,
455
- unavailableStates: p
456
- }) {
457
- var De, Ve;
458
- const { prefix: r } = zt(), {
459
- type: R = "b",
460
- triggerLabel: T = "Archive",
461
- closeLabel: lt = "Close",
462
- columns: it = Pe,
463
- columnGap: ie = tt,
464
- hoverInterval: se = qt,
465
- panelPosition: st,
466
- panelWidth: ce = ot,
467
- panelPadding: S = nt,
468
- panelRadius: ct = 0,
469
- groupGap: ue = 0.0139,
470
- triggerColor: ut = "#000000",
471
- triggerHoverColor: dt = "#666666",
472
- closeColor: pt = "#000000",
473
- closeHoverColor: mt = "#666666",
474
- panelColor: gt = "#FFFFFF",
475
- textColor: ht = "#333132",
476
- textHoverColor: ft = "#BBBBBB",
477
- overlayColor: vt = "#FFFFFFE6"
478
- } = e, B = o ?? [], X = _(null), Y = _(null), q = _(null), de = _(null), pe = _(null), me = _(null), [$t, D] = h(!1), [N, ge] = h(!1), [O, he] = h(!1), [fe, ve] = h(!1), [g, I] = h(null), [$e, ye] = h(0), [we, yt] = h(() => /* @__PURE__ */ new Set()), [be, wt] = h(() => /* @__PURE__ */ new Set()), [V, Ce] = h(null), [bt, Ct] = h(null), xe = _(null), [M, xt] = h(null), [Le, Ae] = h({}), [E, Z] = h(null), [Lt, _e] = h(!1), F = !!(n && !a), b = !n || !!a, v = R === "a", At = F && m === "open" && !(p != null && p.includes("open")), C = !v && (At || (b || !!i) && $t), $ = (t) => Ut(t, n ?? !1), _t = Ge(() => no(r), [r]), Me = ae[st] ?? ae.center, J = K(it), Se = Qt(e), Mt = ["title", ...jt].slice(0, J - 1), H = J > 1, St = Ge(() => H ? eo(o ?? []) : [{ label: "", rows: (o ?? []).map((t, l) => ({ item: t, index: l })) }], [o, H]);
479
- Dt(C && !F), y(() => {
480
- F && !i && D(!1);
481
- }, [F, i]), y(() => {
482
- if (C) {
483
- Ae(Ze(X.current)), ge(!0);
484
- return;
485
- }
486
- he(!1), I(null);
487
- const t = window.setTimeout(() => ge(!1), z);
488
- return () => window.clearTimeout(t);
489
- }, [C]), y(() => {
490
- var l;
491
- if (!C || !N) return;
492
- (l = q.current) == null || l.getBoundingClientRect();
493
- const t = requestAnimationFrame(() => he(!0));
494
- return () => cancelAnimationFrame(t);
495
- }, [C, N]), y(() => {
496
- if (!O) {
497
- ve(!1);
498
- return;
499
- }
500
- const t = window.setTimeout(() => ve(!0), z);
501
- return () => window.clearTimeout(t);
502
- }, [O]);
503
- const W = Ot(() => {
504
- const t = Y.current, l = q.current;
505
- if (!t || !l) return;
506
- const f = t.getBoundingClientRect(), c = l.getBoundingClientRect();
507
- xt({ top: f.top - c.top, left: f.left - c.left });
508
- }, []);
509
- re(() => {
510
- if (N)
511
- return W(), window.addEventListener("resize", W), () => window.removeEventListener("resize", W);
512
- }, [N, W]), y(() => {
513
- var l;
514
- if (!C || !b) return;
515
- (l = de.current) == null || l.focus({ preventScroll: !0 });
516
- const t = (f) => {
517
- f.key === "Escape" && D(!1);
518
- };
519
- return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
520
- }, [C, b]), re(() => {
521
- if (!v || g === null) return;
522
- const t = pe.current, l = me.current;
523
- if (!t || !l) return;
524
- const f = t.getBoundingClientRect(), c = l.getBoundingClientRect();
525
- Z({ top: f.top - c.top, left: f.left - c.left, width: f.width });
526
- }, [v, g]), y(() => {
527
- if (g !== null) return;
528
- const t = window.setTimeout(() => Z(null), le);
529
- return () => window.clearTimeout(t);
530
- }, [g]);
531
- const Ie = E !== null;
532
- y(() => {
533
- if (!v || !Ie) return;
534
- const t = () => {
535
- _e(!0), I(null), Z(null);
536
- };
537
- return document.addEventListener("scroll", t, { capture: !0, passive: !0 }), window.addEventListener("resize", t), () => {
538
- document.removeEventListener("scroll", t, { capture: !0 }), window.removeEventListener("resize", t);
539
- };
540
- }, [v, Ie]);
541
- const Ee = () => {
542
- var t;
543
- b && (D(!1), (t = Y.current) == null || t.focus({ preventScroll: !0 }));
544
- }, Re = b && (v || C);
545
- y(() => {
546
- Re && (o ?? []).forEach((t) => k(t).forEach((l) => {
547
- at(l) || (new Image().src = l.assetId);
548
- }));
549
- }, [Re, o]);
550
- const Q = g === null ? 0 : k(B[g]).length;
551
- y(() => {
552
- if (Q < 2) return;
553
- const t = window.setInterval(() => {
554
- ye((l) => (l + 1) % Q);
555
- }, Math.max(100, se));
556
- return () => window.clearInterval(t);
557
- }, [g, Q, se]);
558
- const Te = g === null || (De = k(B[g])[$e]) == null ? void 0 : De.assetId, L = g !== null && Te !== void 0 ? qe(g, $e, Te) : null, Ne = L !== null && be.has(L);
559
- re(() => {
560
- const t = xe.current;
561
- xe.current = L, L !== null && (Ct(L), Ce(t));
562
- }, [L]), y(() => {
563
- if (!Ne || V === null) return;
564
- const t = window.setTimeout(() => Ce(null), le);
565
- return () => window.clearTimeout(t);
566
- }, [Ne, V]);
567
- const Oe = (t) => {
568
- if (!b || k(B[t]).length === 0) {
569
- I(null);
570
- return;
571
- }
572
- yt((l) => l.has(t) ? l : new Set(l).add(t)), v && g === null && Ae(Ze(X.current)), g !== t && ye(0), _e(!1), I(t);
573
- }, Fe = (t) => {
574
- I((l) => l === t ? null : l);
575
- }, It = (t) => {
576
- !b && t.target.closest("a") && t.preventDefault();
577
- }, He = Ke(Xe(Je(e, "trigger"), n)), U = Gt.slice(0, J).map((t) => Ke(Xe(Je(e, t, "list"), n))), Ue = U[0].lineHeight, ke = (Ve = U[1]) == null ? void 0 : Ve.lineHeight, Et = Ue !== void 0 && ke !== void 0 ? `calc((${ke} - ${Ue}) / 2)` : void 0, P = kt(r, {
578
- triggerColor: ut,
579
- triggerHoverColor: dt,
580
- closeColor: pt,
581
- closeHoverColor: mt,
582
- panelColor: gt,
583
- textColor: ht,
584
- textHoverColor: ft,
585
- overlayColor: vt
586
- }, Kt, Xt), ee = s && s !== "default" ? `${r}-state-${s}` : "", te = b ? `${r}-interactive` : "", ze = /* @__PURE__ */ u("div", { className: x(`${r}-media-layer`, Lt && `${r}-media-layer-instant`), "aria-hidden": "true", children: [...we].flatMap((t) => k(B[t]).map((l, f) => {
587
- const c = qe(t, f, l.assetId);
588
- return /* @__PURE__ */ u(
589
- ro,
590
- {
591
- P: r,
592
- media: l,
593
- isVisible: c === L,
594
- isLoaded: be.has(c),
595
- isCovered: c === V,
596
- isFading: L === null && (c === bt || c === V),
597
- onLoad: () => wt((w) => w.has(c) ? w : new Set(w).add(c))
598
- },
599
- c
600
- );
601
- })) }), oe = !!i && (v || fe), ne = (t) => /* @__PURE__ */ A(
602
- "div",
603
- {
604
- ref: t ? void 0 : pe,
605
- className: x(
606
- `${r}-panel`,
607
- // Only the open and close slide; once open, a new position or size moves the panel straight there.
608
- O && fe && `${r}-panel-settled`,
609
- v && `${r}-panel-inline`,
610
- t && `${r}-panel-copy`
611
- ),
612
- style: {
613
- width: $(ce),
614
- paddingTop: $(S.top),
615
- paddingRight: $(S.right),
616
- paddingBottom: $(S.bottom),
617
- paddingLeft: $(S.left),
618
- borderRadius: $(ct),
619
- [`--${r}-group-gap`]: $(ue),
620
- [`--${r}-panel-x`]: Me.x,
621
- [`--${r}-panel-y`]: Me.y,
622
- [`--${r}-grid-columns`]: Pt(Se),
623
- [`--${r}-column-gap`]: $(ie),
624
- ...t && E ? { top: E.top, left: E.left, width: E.width } : {}
625
- },
626
- "data-lightbox-scrollable": v ? void 0 : "",
627
- "aria-hidden": t || void 0,
628
- onMouseLeave: t ? void 0 : () => I(null),
629
- onClickCapture: t ? void 0 : It,
630
- children: [
631
- !t && oe && lo(r, ce, S, $),
632
- !t && oe && ao(r, Se, S.left, ie, $),
633
- St.map((l, f) => /* @__PURE__ */ A(Ft, { children: [
634
- !t && oe && f > 0 && // Left at its static top, the anchor sits right where the gap above this group starts.
635
- /* @__PURE__ */ u(
636
- "div",
637
- {
638
- "data-controls": "groupGap",
639
- "data-controls-paired": "",
640
- "data-controls-axis": "y",
641
- "data-controls-reverse": "",
642
- "data-controls-min": "0",
643
- className: `${r}-control-anchor`,
644
- style: { left: 0, width: "100%", height: $(Math.max(ue, et)) }
645
- }
646
- ),
647
- /* @__PURE__ */ A(
648
- "div",
649
- {
650
- className: x(`${r}-group`, !H && `${r}-group-unlabeled`),
651
- style: { gridTemplateRows: `repeat(${l.rows.length}, auto) 1fr` },
652
- children: [
653
- H && /* @__PURE__ */ u(
654
- "span",
655
- {
656
- className: `${r}-group-label`,
657
- style: { ...U[0], gridRow: `1 / span ${l.rows.length + 1}`, marginTop: Et },
658
- children: l.label
659
- }
660
- ),
661
- l.rows.map(({ item: c, index: w }) => {
662
- var We;
663
- const j = !t && ((We = c.link) != null && We.value) ? c.link : void 0;
664
- return /* @__PURE__ */ A(
665
- j ? "a" : "div",
666
- {
667
- className: x(`${r}-row`, t && w === g && `${r}-row-active`),
668
- ...j ? {
669
- href: Bt(j.value),
670
- ...j.target === "blank" && { target: "_blank", rel: "noreferrer" }
671
- } : {},
672
- ...t ? {} : {
673
- onMouseEnter: () => Oe(w),
674
- onMouseLeave: () => Fe(w),
675
- onFocus: () => Oe(w),
676
- onBlur: () => Fe(w)
677
- },
678
- children: [
679
- !H && /* @__PURE__ */ u("div", { className: `${r}-title`, style: U[0], children: c.group }),
680
- Mt.map((je, Nt) => /* @__PURE__ */ u("div", { className: `${r}-title`, style: U[Nt + 1], children: to(c[je]) }, je))
681
- ]
682
- },
683
- w
684
- );
685
- })
686
- ]
687
- }
688
- )
689
- ] }, f))
690
- ]
691
- }
692
- ), Rt = N ? /* @__PURE__ */ A(
693
- "div",
694
- {
695
- ref: q,
696
- className: x(
697
- `${r}-overlay`,
698
- n && `${r}-overlay-editor`,
699
- i && `${r}-overlay-edit-mode`,
700
- O && `${r}-overlay-active`,
701
- te,
702
- ee
703
- ),
704
- style: { ...P, ...Le },
705
- role: "dialog",
706
- "aria-modal": "true",
707
- "aria-label": T,
708
- "data-selection": "none",
709
- children: [
710
- /* @__PURE__ */ u("div", { className: `${r}-backdrop`, "aria-hidden": "true", onClick: Ee }),
711
- ze,
712
- /* @__PURE__ */ u(
713
- "button",
714
- {
715
- ref: de,
716
- type: "button",
717
- className: `${r}-close`,
718
- style: {
719
- ...He,
720
- top: (M == null ? void 0 : M.top) ?? 0,
721
- left: (M == null ? void 0 : M.left) ?? 0,
722
- visibility: M ? "visible" : "hidden"
723
- },
724
- onClick: Ee,
725
- children: lt
726
- }
727
- ),
728
- ne(!1)
729
- ]
730
- }
731
- ) : null, Tt = v && we.size > 0 ? /* @__PURE__ */ A(
732
- "div",
733
- {
734
- ref: me,
735
- className: x(`${r}-inline-layer`, n && `${r}-overlay-editor`, te, ee),
736
- style: { ...P, ...Le },
737
- "aria-hidden": "true",
738
- "data-selection": "none",
739
- children: [
740
- ze,
741
- E && ne(!0)
742
- ]
743
- }
744
- ) : null, Be = Rt ?? Tt;
745
- return /* @__PURE__ */ A(Qe, { children: [
746
- /* @__PURE__ */ u("style", { dangerouslySetInnerHTML: { __html: _t } }),
747
- /* @__PURE__ */ u(
748
- "div",
749
- {
750
- ref: X,
751
- className: x(F && `${r}-editor`, te, ee),
752
- style: P,
753
- children: v ? ne(!1) : (
754
- // The overlay lets the page show through, so the label fades out with it rather than sit under the close.
755
- // Only faded, it keeps the component's size and can still take focus back on close.
756
- /* @__PURE__ */ u(
757
- "button",
758
- {
759
- ref: Y,
760
- type: "button",
761
- className: x(`${r}-trigger`, O && `${r}-trigger-hidden`),
762
- style: He,
763
- "aria-haspopup": "dialog",
764
- "aria-expanded": C,
765
- onClick: () => {
766
- b && D(!0);
767
- },
768
- children: T
769
- }
770
- )
771
- )
772
- }
773
- ),
774
- Be && typeof document < "u" && Ht(
775
- Be,
776
- (d ? document.getElementById(d) : null) ?? document.body
777
- )
778
- ] });
779
- }
780
- export {
781
- Gt as ARCHIVE_POPUP_COLUMN_STYLE_PREFIXES,
782
- G as ARCHIVE_POPUP_COLUMN_WIDTH_KEYS,
783
- Pe as ARCHIVE_POPUP_DEFAULT_COLUMNS,
784
- jt as ARCHIVE_POPUP_EXTRA_TITLE_KEYS,
785
- Wt as ARCHIVE_POPUP_MAX_COLUMNS,
786
- Vt as ARCHIVE_POPUP_MIN_COLUMNS,
787
- yo as ARCHIVE_POPUP_PANEL_POSITIONS,
788
- bo as ArchivePopup,
789
- wo as applyArchivePopupColumnCountChange,
790
- Jt as getArchivePopupEqualColumnWidths,
791
- k as getArchivePopupRowMedia,
792
- eo as groupArchiveRows,
793
- Qt as resolveArchivePopupColumnWidths
794
- };