@cntrl-site/components 1.0.107-alpha.1 → 1.0.107-alpha.3

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