@cntrl-site/components 1.0.112 → 1.0.113-alpha.1

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.
Files changed (61) hide show
  1. package/dist/{Burger-C3yVbQcq.js → Burger-B4kXX9aY.js} +1 -1
  2. package/dist/{Burger-BkVgNMGU.mjs → Burger-DyORh_vF.mjs} +1 -1
  3. package/dist/{ChroniclesComponent-FFenN7yL.js → ChroniclesComponent-B6L-8Gn2.js} +1 -1
  4. package/dist/{ChroniclesComponent-cZLqN307.mjs → ChroniclesComponent-adaAqTy8.mjs} +12 -12
  5. package/dist/Components/PopupMenu/PopupMenu.d.ts +70 -0
  6. package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +597 -0
  7. package/dist/Components/PopupMenu/popupMenuLayout.d.ts +176 -0
  8. package/dist/Components/helpers/SvgImage/loadSvgMaskUrl.d.ts +7 -0
  9. package/dist/{ControlSlider-DqKfaKMG.mjs → ControlSlider-3w-bHQEg.mjs} +1 -1
  10. package/dist/{ControlSlider-C8ckUIDm.js → ControlSlider-DB4nbVLT.js} +1 -1
  11. package/dist/{FAQ-BS-vO0l-.mjs → FAQ-BjLLn81l.mjs} +1 -1
  12. package/dist/{FAQ-Ct0YfqX1.js → FAQ-C5evIqbl.js} +1 -1
  13. package/dist/{Grid-CU1dsdoO.js → Grid-BXUT_Hn6.js} +1 -1
  14. package/dist/{Grid-qbqchSLi.mjs → Grid-Dn44dvgx.mjs} +1 -1
  15. package/dist/{Hive-CzabuuCc.js → Hive-34KvKNsa.js} +1 -1
  16. package/dist/{Hive-DyxYd5eg.mjs → Hive-7xHXyMM1.mjs} +1 -1
  17. package/dist/{HiveLightboxTitles-DhEeFKWs.mjs → HiveLightboxTitles-BCoL46-V.mjs} +1 -1
  18. package/dist/{HiveLightboxTitles-DlyptAaK.js → HiveLightboxTitles-DEeyQGcf.js} +1 -1
  19. package/dist/{Lightbox-DZckgBzK.js → Lightbox-Cb7lyaNt.js} +1 -1
  20. package/dist/{Lightbox-BY99NS14.mjs → Lightbox-DzPqgKP4.mjs} +1 -1
  21. package/dist/{LightboxJournal-DAEZOPDi.js → LightboxJournal-BFF5aKRz.js} +1 -1
  22. package/dist/{LightboxJournal-D59ex6wH.mjs → LightboxJournal-C_q7_s-B.mjs} +1 -1
  23. package/dist/{LightboxStrip-YspzBP8N.mjs → LightboxStrip-BrNj7ipX.mjs} +1 -1
  24. package/dist/{LightboxStrip-BDjI1jyH.js → LightboxStrip-CC2e0_9A.js} +1 -1
  25. package/dist/{Mercury-B-s2Kvuq.js → Mercury-BmhtFYOw.js} +1 -1
  26. package/dist/{Mercury-CCW0Es-s.mjs → Mercury-Q788wrYQ.mjs} +1 -1
  27. package/dist/{OnelinerForm-C2Y_XMCY.js → OnelinerForm-CUmY-bXL.js} +1 -1
  28. package/dist/{OnelinerForm-BEu7_sho.mjs → OnelinerForm-D8WIB9Qy.mjs} +1 -1
  29. package/dist/PopupMenu-On4dKyT3.js +369 -0
  30. package/dist/PopupMenu-RPz8MN6s.mjs +1026 -0
  31. package/dist/{SimpleButton-C-o2W9bS.mjs → SimpleButton-DTpzfmb6.mjs} +1 -1
  32. package/dist/{SimpleButton-nGEcO2gB.js → SimpleButton-DtaCYa3y.js} +1 -1
  33. package/dist/{Slider20-DUi6qwnd.mjs → Slider20-CKngROrc.mjs} +1 -1
  34. package/dist/{Slider20-BOmjDRf2.js → Slider20-q0iGgnE3.js} +1 -1
  35. package/dist/SvgImage-CwRq9-ec.mjs +56 -0
  36. package/dist/SvgImage-_QN8ngad.js +1 -0
  37. package/dist/{TestimonialSingle-DrnyReim.mjs → TestimonialSingle-Bax71Hyo.mjs} +1 -1
  38. package/dist/{TestimonialSingle-BORQom3u.js → TestimonialSingle-CpEUendN.js} +1 -1
  39. package/dist/{Waterfall-DII4-WV5.js → Waterfall-B9YWMhrg.js} +1 -1
  40. package/dist/{Waterfall-3kKioKh2.mjs → Waterfall-znaoynn5.mjs} +1 -1
  41. package/dist/{components-DtO0Ti47.mjs → components-AFk1BYaV.mjs} +652 -29
  42. package/dist/components-Dcrw_wyy.js +1 -0
  43. package/dist/elements.js +1 -1
  44. package/dist/elements.mjs +23 -22
  45. package/dist/elements.node.js +1 -1
  46. package/dist/elements.node.mjs +1 -1
  47. package/dist/index.d.ts +3 -1
  48. package/dist/index.js +1 -1
  49. package/dist/index.mjs +48 -27
  50. package/dist/loadSvgMaskUrl-B6kHUyof.js +1 -0
  51. package/dist/loadSvgMaskUrl-DUhCVvpl.mjs +39 -0
  52. package/dist/sources.js +1 -1
  53. package/dist/sources.mjs +1 -1
  54. package/dist/types/Component.d.ts +7 -0
  55. package/dist/types/SchemaV1.d.ts +3 -0
  56. package/package.json +1 -1
  57. package/dist/SvgImage-B5mR9y6q.mjs +0 -51
  58. package/dist/SvgImage-DFlmxAoL.js +0 -1
  59. package/dist/components-f82884Bk.js +0 -1
  60. package/dist/loadSvgMaskUrl-DfF7ay6h.js +0 -1
  61. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +0 -20
@@ -0,0 +1,1026 @@
1
+ import { jsx as I, jsxs as q } from "react/jsx-runtime";
2
+ import { useMemo as Z, useState as j, useEffect as U, useRef as H, useLayoutEffect as Ut } from "react";
3
+ import { createPortal as fe } from "react-dom";
4
+ import { s as qt } from "./scalingValue-C9JH5L6O.mjs";
5
+ import { u as $e } from "./useScopedStyles-DhBG3557.mjs";
6
+ import { u as be } from "./useLightboxScrollLock-VQ07s7EJ.mjs";
7
+ import { n as ve } from "./textStylesToCss-05Mn6I_2.mjs";
8
+ import { R as xe } from "./RichTextRenderer-D52Xto59.mjs";
9
+ import { S as we } from "./SvgImage-CwRq9-ec.mjs";
10
+ const ye = 60, Me = 900 / 1440, ke = ["left", "center", "right"], Zt = {
11
+ columns: 12,
12
+ columnWidth: 99 / 1440,
13
+ gutter: 20 / 1440
14
+ };
15
+ function Ce(t, e = Zt) {
16
+ const o = (c) => typeof c == "number" && Number.isFinite(c), n = (c, ...s) => s.find(o) ?? c, r = t.gridLayout ?? {}, u = Math.max(0, n(e.gutter, r.horizontalGap, t.gridGutter));
17
+ return {
18
+ columns: Math.max(1, Math.round(n(e.columns, r.columnsCount, t.gridColumns))),
19
+ columnWidth: Math.max(0, n(e.columnWidth, r.entryWidth, t.gridColumnWidth)),
20
+ gutter: u,
21
+ rowGap: Math.max(0, n(u, t.verticalGap))
22
+ };
23
+ }
24
+ function et(t) {
25
+ return t.rowGap ?? t.gutter;
26
+ }
27
+ function Kt(t) {
28
+ const e = t.popupHeight;
29
+ return Math.min(100, Math.max(0, typeof e == "number" && Number.isFinite(e) ? e : ye));
30
+ }
31
+ function Ie(t, e = Me) {
32
+ return Kt(t) / 100 * e;
33
+ }
34
+ function Re(t) {
35
+ return ke.includes(t.popupAlign) ? t.popupAlign : "center";
36
+ }
37
+ function _e(t, e) {
38
+ var r;
39
+ const o = (r = t.gridLayout) == null ? void 0 : r.wrapperWidth, n = e.columns * e.columnWidth + (e.columns - 1) * e.gutter;
40
+ return typeof o == "number" && Number.isFinite(o) && o > 0 ? Math.max(o, n) : n > 0 ? n : 1;
41
+ }
42
+ function Se(t) {
43
+ if (typeof t == "number") return { top: t, right: t, bottom: t, left: t };
44
+ const e = (o) => typeof o == "number" && Number.isFinite(o) ? Math.max(0, o) : 0;
45
+ return { top: e(t == null ? void 0 : t.top), right: e(t == null ? void 0 : t.right), bottom: e(t == null ? void 0 : t.bottom), left: e(t == null ? void 0 : t.left) };
46
+ }
47
+ const ze = {
48
+ span: {
49
+ text: { min: 1 / 4, max: 5 / 12 },
50
+ image: { min: 1 / 6, max: 1 / 3 },
51
+ listA: { min: 1 / 6, max: 1 / 4 },
52
+ listB: { min: 1 / 6, max: 1 / 4 }
53
+ },
54
+ breakChance: 0.25
55
+ };
56
+ function Ae(t, e, o, n, r = ze) {
57
+ const u = Fe(o), c = Math.max(1, Math.floor(e.columns)), s = [];
58
+ let d = 0, f = new Array(c).fill(!1);
59
+ const w = {};
60
+ for (const T of t) {
61
+ const m = w[T] ?? (w[T] = Ge(r.span[T] ?? r.span.text, c, u));
62
+ let p = Yt(f, m);
63
+ const v = f.some(Boolean);
64
+ (p.length === 0 || v && u() < r.breakChance) && (d += 1, f = new Array(c).fill(!1), p = Yt(f, m));
65
+ const A = p[Math.floor(u() * p.length)];
66
+ for (let z = Math.max(0, A - 1); z < Math.min(c, A + m + 1); z++) f[z] = !0;
67
+ s.push({ column: A, span: m, row: d });
68
+ }
69
+ const a = d + 1;
70
+ return {
71
+ seed: o,
72
+ grid: { ...e, columns: c },
73
+ placements: s.map(({ column: T, span: m, row: p }) => ({ column: T, span: m, top: K(e, p * n / a, n) }))
74
+ };
75
+ }
76
+ function so() {
77
+ return Math.floor(Math.random() * 2147483647);
78
+ }
79
+ function K(t, e, o = 1 / 0) {
80
+ const n = t.beat ?? 0, r = Math.max(0, o), u = n > 0 ? Math.round(e / n) * n : e, c = u <= r ? u : n > 0 ? Math.floor(r / n + 1e-9) * n : r;
81
+ return Math.round(Math.max(0, c) * 1e6) / 1e6;
82
+ }
83
+ function yt(t) {
84
+ return t.beat && t.beat > 0 ? t.beat : 8 / 1440;
85
+ }
86
+ function lt(t, e, o = 1 / 0) {
87
+ const n = t.beat ?? 0, r = yt(t), u = n > 0 ? Math.round(e / n) * n : e, c = u <= o ? u : n > 0 ? Math.floor(o / n + 1e-9) * n : o;
88
+ return Jt(Math.max(r, c));
89
+ }
90
+ function Ne(t, e) {
91
+ const o = (n, r) => Math.abs(n - r) < 1e-9;
92
+ return Math.floor(t.columns) === Math.floor(e.columns) && o(t.columnWidth, e.columnWidth) && o(t.gutter, e.gutter) && o(et(t), et(e)) && o(t.beat ?? 0, e.beat ?? 0);
93
+ }
94
+ function Te(t, e) {
95
+ const o = { ...e, columns: Math.max(1, Math.floor(e.columns)) };
96
+ if (Ne(t.grid, o)) return t;
97
+ const n = Math.max(1, Math.floor(t.grid.columns)), r = o.columns, u = (s) => n === r ? s : Math.round(s * r / n), c = t.placements.map((s) => {
98
+ const d = Math.min(r, Math.max(1, u(s.span))), f = Math.min(Math.max(0, u(s.column)), r - d), w = K(o, s.top);
99
+ return s.height === void 0 ? { column: f, span: d, top: w } : { column: f, span: d, top: w, height: lt(o, s.height) };
100
+ });
101
+ return { ...t, grid: o, placements: c };
102
+ }
103
+ function Jt(t) {
104
+ return Math.round(t * 1e6) / 1e6;
105
+ }
106
+ function Qt(t, e, o, n, r) {
107
+ return t.column < o.column + o.span && o.column < t.column + t.span && t.top < o.top + n + r - 1e-9 && o.top < t.top + e + r - 1e-9;
108
+ }
109
+ function Le(t, e, o, n, r) {
110
+ const u = t.placements[e];
111
+ return u ? Pt(t, e, { ...u, column: o, top: n }, r) : null;
112
+ }
113
+ function Be(t, e, o, n) {
114
+ if (!t.placements[e]) return null;
115
+ const { columns: r } = t.grid, u = Math.min(Math.max(0, o.column), r - 1), c = Math.min(Math.max(1, o.span), r - u), s = K(t.grid, o.top, n ? n.height - yt(t.grid) : 1 / 0), d = o.height === void 0 ? void 0 : lt(t.grid, o.height, n ? n.height - s : 1 / 0);
116
+ return Pt(t, e, d === void 0 ? { column: u, span: c, top: s } : { column: u, span: c, top: s, height: d }, n);
117
+ }
118
+ function Pt(t, e, o, n) {
119
+ const { columns: r } = t.grid, u = et(t.grid), c = Math.min(o.span, r);
120
+ if (c < 1 || o.column < 0 || o.column + c > r) return null;
121
+ const s = o.height ?? (n == null ? void 0 : n.heights[e]) ?? 0, d = {
122
+ column: o.column,
123
+ span: c,
124
+ top: K(t.grid, o.top, n ? n.height - s : 1 / 0),
125
+ ...o.height === void 0 ? {} : { height: o.height }
126
+ };
127
+ return n && t.placements.some((f, w) => w !== e && Qt(d, s, f, n.heights[w] ?? 0, u)) ? null : {
128
+ ...t,
129
+ edited: !0,
130
+ placements: t.placements.map((f, w) => w === e ? d : f)
131
+ };
132
+ }
133
+ function Ee(t, e) {
134
+ const { columns: o } = t.grid, n = et(t.grid), r = t.grid.beat ?? 0, u = e.height, c = t.placements.map((m, p) => e.heights[p] ?? 0), s = [...t.placements], d = s.map((m, p) => p).sort((m, p) => s[m].top - s[p].top || m - p), f = [], w = (m, p) => {
135
+ let { top: v } = m;
136
+ for (let A = !0, z = 0; A && z <= f.length; z++) {
137
+ A = !1;
138
+ for (const N of f) {
139
+ const k = s[N];
140
+ if (!Qt({ ...m, top: v }, p, k, c[N], n)) continue;
141
+ const S = k.top + c[N] + n, R = r > 0 ? Jt(Math.ceil(S / r - 1e-9) * r) : Math.ceil(S * 1e6 - 1e-6) / 1e6;
142
+ R <= v || (v = R, A = !0);
143
+ }
144
+ }
145
+ return v;
146
+ }, a = (m, p) => m + p > u + 1e-9;
147
+ let T = !1;
148
+ for (const m of d) {
149
+ const p = s[m];
150
+ let v = { column: p.column, top: w(p, c[m]) };
151
+ if (v.top !== p.top && a(v.top, c[m])) {
152
+ const A = Math.min(p.span, o), z = Array.from({ length: Math.max(0, o - A + 1) }, (k, S) => S).sort((k, S) => Math.abs(k - p.column) - Math.abs(S - p.column) || k - S);
153
+ let N = null;
154
+ for (const k of z) {
155
+ const S = w({ ...p, column: k }, c[m]);
156
+ !a(S, c[m]) && (!N || S < N.top - 1e-9) && (N = { column: k, top: S });
157
+ }
158
+ N && (v = N);
159
+ }
160
+ (v.column !== p.column || v.top !== p.top) && (s[m] = { ...s[m], ...v }, T = !0), f.push(m);
161
+ }
162
+ return T ? { ...t, placements: s } : t;
163
+ }
164
+ function Ge(t, e, o) {
165
+ const n = Math.max(1, Math.round(t.min * e)), r = Math.max(n, Math.round(t.max * e));
166
+ return Math.min(e, n + Math.floor(o() * (r - n + 1)));
167
+ }
168
+ function Yt(t, e) {
169
+ const o = [];
170
+ for (let n = 0; n + e <= t.length; n++) {
171
+ let r = !0;
172
+ for (let u = n; u < n + e; u++)
173
+ if (t[u]) {
174
+ r = !1;
175
+ break;
176
+ }
177
+ r && o.push(n);
178
+ }
179
+ return o;
180
+ }
181
+ function Fe(t) {
182
+ let e = t >>> 0;
183
+ return () => {
184
+ e = e + 1831565813 >>> 0;
185
+ let o = e;
186
+ return o = Math.imul(o ^ o >>> 15, o | 1), o ^= o + Math.imul(o ^ o >>> 7, o | 61), ((o ^ o >>> 14) >>> 0) / 4294967296;
187
+ };
188
+ }
189
+ const Y = 300, We = 3e3, te = ["slide down", "slide up", "fade", "scale", "none"], De = "slide down";
190
+ function Oe(t) {
191
+ const e = t.popupTransition;
192
+ return te.includes(e) ? e : De;
193
+ }
194
+ const He = ["burger", "plus", "icon", "text"], je = 24 / 1440, Ue = ["--cntrl-article-top", "--cntrl-article-left", "--cntrl-article-width", "--cntrl-viewport-height"], Ye = ["top", "right", "bottom", "left", "top-left", "top-right", "bottom-right", "bottom-left"], Ve = ["right", "left"];
195
+ function Vt(t, e) {
196
+ return { ...e, heights: e.heights.map((o, n) => {
197
+ var r;
198
+ return ((r = t.placements[n]) == null ? void 0 : r.height) ?? o;
199
+ }) };
200
+ }
201
+ function Xe(t, e) {
202
+ return t.column === e.column && t.span === e.span && t.top === e.top && t.height === e.height;
203
+ }
204
+ function Xt(t, e) {
205
+ return e.handle ? Be(t, e.index, e.placement, e.measure) : Le(t, e.index, e.placement.column, e.placement.top, e.measure);
206
+ }
207
+ function qe(t) {
208
+ return `
209
+ /* the element is the trigger alone, placed and sized on the page as any other element; the popup opens over the page */
210
+ .${t}-root {
211
+ position: relative;
212
+ width: 100%;
213
+ height: 100%;
214
+ box-sizing: border-box;
215
+ }
216
+ /* fills the element's box, its icon or text centred in it inside its padding */
217
+ .${t}-button {
218
+ all: unset;
219
+ box-sizing: border-box;
220
+ display: flex;
221
+ align-items: center;
222
+ justify-content: center;
223
+ width: 100%;
224
+ height: 100%;
225
+ cursor: pointer;
226
+ white-space: nowrap;
227
+ color: var(--${t}-trigger-color);
228
+ background-color: var(--${t}-trigger-bg);
229
+ }
230
+ /* an icon trigger's lines, as thick as a twelfth of it and a pixel at least, drawn in the trigger's colour */
231
+ .${t}-icon {
232
+ position: relative;
233
+ display: block;
234
+ flex: none;
235
+ width: var(--${t}-icon-size);
236
+ height: var(--${t}-icon-size);
237
+ --${t}-icon-stroke: max(1px, calc(var(--${t}-icon-size) / 12));
238
+ transition: transform ${Y}ms ease;
239
+ }
240
+ .${t}-icon-line {
241
+ position: absolute;
242
+ left: 0;
243
+ width: 100%;
244
+ height: var(--${t}-icon-stroke);
245
+ top: calc(50% - var(--${t}-icon-stroke) / 2);
246
+ background-color: currentColor;
247
+ transition: transform ${Y}ms ease, opacity ${Y}ms ease;
248
+ }
249
+ /* three lines, the outer two meeting in the middle and crossing as the popup opens, the middle one fading */
250
+ .${t}-icon-burger .${t}-icon-line:nth-child(1) { transform: translateY(calc(var(--${t}-icon-size) * -0.3)) rotate(0deg) scaleX(1); }
251
+ .${t}-icon-burger .${t}-icon-line:nth-child(3) { transform: translateY(calc(var(--${t}-icon-size) * 0.3)) rotate(0deg) scaleX(1); }
252
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(1) { transform: translateY(0) rotate(45deg) scaleX(1); }
253
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
254
+ .${t}-button-open .${t}-icon-burger .${t}-icon-line:nth-child(3) { transform: translateY(0) rotate(-45deg) scaleX(1); }
255
+ /* a plus, turned an eighth as the popup opens, into a cross */
256
+ .${t}-icon-plus .${t}-icon-line:nth-child(2) { transform: rotate(90deg); }
257
+ .${t}-button-open .${t}-icon-plus { transform: rotate(45deg); }
258
+ /* the user's image, fitted to the icon's size: an SVG tinted with the trigger's colour, anything else as it is */
259
+ .${t}-icon-picture {
260
+ display: block;
261
+ width: 100%;
262
+ height: 100%;
263
+ }
264
+ @media (prefers-reduced-motion: reduce) {
265
+ .${t}-icon,
266
+ .${t}-icon-line {
267
+ transition: none;
268
+ }
269
+ }
270
+ .${t}-button:focus-visible {
271
+ outline: 1px solid currentColor;
272
+ outline-offset: 2px;
273
+ }
274
+ /* the popup opens over the whole screen, out of the element's box (it is portalled out of it); in the editor, over
275
+ the whole article as it is drawn on the canvas */
276
+ .${t}-overlay {
277
+ position: fixed;
278
+ inset: 0;
279
+ z-index: 9997;
280
+ pointer-events: none;
281
+ overflow: hidden;
282
+ }
283
+ .${t}-overlay-editor {
284
+ inset: auto;
285
+ top: var(--cntrl-article-top, 0);
286
+ left: var(--cntrl-article-left, 0);
287
+ width: var(--cntrl-article-width, 100vw);
288
+ height: var(--cntrl-viewport-height, 100vh);
289
+ }
290
+ .${t}-overlay-active {
291
+ pointer-events: auto;
292
+ }
293
+ /* the trigger drawn again over the popup, where it is on the page, so that its cross shows above the popup and closes
294
+ it; the page's own trigger, under the overlay, is hidden meanwhile */
295
+ .${t}-overlay .${t}-close {
296
+ position: absolute;
297
+ z-index: 1;
298
+ }
299
+ /* on the canvas, where the popup is pinned open, it lets the blocks under it be taken */
300
+ .${t}-overlay .${t}-close-inert {
301
+ pointer-events: none;
302
+ }
303
+ .${t}-button-hidden {
304
+ opacity: 0;
305
+ }
306
+ .${t}-backdrop {
307
+ all: unset;
308
+ position: absolute;
309
+ inset: 0;
310
+ background-color: var(--${t}-overlay-color);
311
+ /* the page behind blurred, the blur fading in and out with the overlay's colour */
312
+ -webkit-backdrop-filter: var(--${t}-overlay-blur, none);
313
+ backdrop-filter: var(--${t}-overlay-blur, none);
314
+ opacity: 0;
315
+ transition: opacity ${Y}ms ease;
316
+ }
317
+ .${t}-card {
318
+ position: absolute;
319
+ box-sizing: border-box;
320
+ /* content reaching below the popup's bottom scrolls, within the popup alone */
321
+ overflow-x: hidden;
322
+ overflow-y: auto;
323
+ overscroll-behavior: contain;
324
+ background-color: var(--${t}-popup-bg);
325
+ opacity: 0;
326
+ transition: opacity ${Y}ms ease, transform ${Y}ms ease;
327
+ }
328
+ /* where the popup comes in from and goes back to, by its transition; it fades in and out with each, and 'none'
329
+ shows and hides the popup and its overlay at once */
330
+ .${t}-transition-slide-down .${t}-card {
331
+ transform: translateY(24px);
332
+ }
333
+ .${t}-transition-slide-up .${t}-card {
334
+ transform: translateY(-24px);
335
+ }
336
+ .${t}-transition-scale .${t}-card {
337
+ transform: scale(0.95);
338
+ }
339
+ .${t}-transition-none .${t}-backdrop,
340
+ .${t}-transition-none .${t}-card {
341
+ transition: none;
342
+ }
343
+ @media (prefers-reduced-motion: reduce) {
344
+ .${t}-overlay .${t}-card {
345
+ transform: none;
346
+ }
347
+ }
348
+ .${t}-overlay-active .${t}-backdrop,
349
+ .${t}-overlay-active .${t}-card {
350
+ opacity: 1;
351
+ transform: none;
352
+ }
353
+ /* one row, which every block shares: its column from the grid, its height from a spacer above it. The row is
354
+ as tall as the popup at least, and as tall as the lowest block reaches where that is further, the popup
355
+ scrolling down to it */
356
+ .${t}-grid {
357
+ position: relative;
358
+ display: grid;
359
+ grid-template-rows: auto;
360
+ min-height: 100%;
361
+ }
362
+ /* the grid the blocks snap to, drawn as the article's is while a block is moved or resized: a hairline at both
363
+ edges of every column, and one across every beat from the popup's top, or, with no beat, every vertical gap */
364
+ .${t}-guides {
365
+ position: absolute;
366
+ inset: 0;
367
+ z-index: 2;
368
+ display: grid;
369
+ grid-template-rows: minmax(0, 1fr);
370
+ pointer-events: none;
371
+ opacity: 0;
372
+ transition: opacity 200ms ease;
373
+ --${t}-guide-color: var(--cntrl-grid-color, rgba(255, 92, 2, 0.45));
374
+ }
375
+ .${t}-guides-shown {
376
+ opacity: 1;
377
+ }
378
+ .${t}-guides-beats {
379
+ background-image: repeating-linear-gradient(
380
+ to bottom,
381
+ var(--${t}-guide-color) 0 1px,
382
+ transparent 1px var(--${t}-beat)
383
+ );
384
+ }
385
+ .${t}-guide {
386
+ grid-row: 1;
387
+ box-shadow: inset 1px 0 var(--${t}-guide-color), inset -1px 0 var(--${t}-guide-color);
388
+ }
389
+ /* the block and, on the canvas, the handles it is resized by, which sit on its edges outside any scroller */
390
+ .${t}-frame {
391
+ position: relative;
392
+ display: flex;
393
+ flex-direction: column;
394
+ flex: none;
395
+ min-width: 0;
396
+ min-height: 0;
397
+ }
398
+ .${t}-slot {
399
+ display: flex;
400
+ flex-direction: column;
401
+ grid-row: 1;
402
+ min-width: 0;
403
+ min-height: 0;
404
+ pointer-events: none;
405
+ }
406
+ .${t}-spacer {
407
+ flex: none;
408
+ }
409
+ .${t}-block {
410
+ flex: none;
411
+ min-width: 0;
412
+ pointer-events: auto;
413
+ }
414
+ /* the text's box runs from the first line's cap height to the last line's baseline, where the browser can
415
+ trim it: a title lines up with the top of an image beside it, and the block is no taller than its text */
416
+ .${t}-block.${t}-block-text,
417
+ .${t}-block.${t}-block-listA,
418
+ .${t}-block.${t}-block-listB {
419
+ text-box: trim-both cap alphabetic;
420
+ }
421
+ .${t}-block-title {
422
+ color: var(--${t}-title-color);
423
+ }
424
+ .${t}-block-text {
425
+ color: var(--${t}-text-color);
426
+ }
427
+ .${t}-block-text a {
428
+ color: inherit;
429
+ }
430
+ .${t}-block-listA .${t}-block-text {
431
+ color: var(--${t}-list-a-color, var(--${t}-text-color));
432
+ }
433
+ .${t}-block-listB .${t}-block-text {
434
+ color: var(--${t}-list-b-color, var(--${t}-text-color));
435
+ }
436
+ .${t}-block-listA .${t}-block-text a,
437
+ .${t}-block-listB .${t}-block-text a {
438
+ text-decoration: none;
439
+ }
440
+ .${t}-block-listA .${t}-block-text a:hover,
441
+ .${t}-block-listB .${t}-block-text a:hover {
442
+ text-decoration: underline;
443
+ }
444
+ .${t}-images {
445
+ display: grid;
446
+ }
447
+ /* every image takes the same cell, so the block is as tall as its tallest image and keeps still as they change */
448
+ .${t}-image {
449
+ display: block;
450
+ grid-area: 1 / 1;
451
+ width: 100%;
452
+ height: auto;
453
+ object-fit: cover;
454
+ }
455
+ /* a block resized to a height: its images fill it, cut to it */
456
+ .${t}-block-sized .${t}-images {
457
+ height: 100%;
458
+ grid-template-rows: minmax(0, 100%);
459
+ }
460
+ .${t}-block-sized .${t}-image {
461
+ height: 100%;
462
+ }
463
+ .${t}-image {
464
+ transition: opacity 800ms ease-in-out;
465
+ }
466
+ .${t}-image-hidden {
467
+ opacity: 0;
468
+ }
469
+ @media (prefers-reduced-motion: reduce) {
470
+ .${t}-image {
471
+ transition: none;
472
+ }
473
+ }
474
+ .${t}-grid-editable .${t}-block {
475
+ cursor: grab;
476
+ touch-action: none;
477
+ user-select: none;
478
+ }
479
+ .${t}-grid-editable .${t}-block * {
480
+ pointer-events: none;
481
+ }
482
+ .${t}-slot-dragged {
483
+ z-index: 1;
484
+ }
485
+ .${t}-grid-editable .${t}-block-dragged {
486
+ cursor: grabbing;
487
+ outline: 1px solid #FF5C02;
488
+ outline-offset: 2px;
489
+ }
490
+ .${t}-grid-editable .${t}-frame:hover > .${t}-block:not(.${t}-block-dragged) {
491
+ outline: 1px solid rgba(255, 92, 2, 0.4);
492
+ outline-offset: 2px;
493
+ }
494
+ .${t}-grid-editable .${t}-block-invalid {
495
+ opacity: 0.5;
496
+ outline-style: dashed;
497
+ }
498
+ /* edges are a bar that grows from the block's edge as the pointer comes to it, as a structured block's do;
499
+ corners a small square */
500
+ .${t}-handle {
501
+ position: absolute;
502
+ z-index: 3;
503
+ pointer-events: auto;
504
+ touch-action: none;
505
+ }
506
+ .${t}-handle::after {
507
+ content: '';
508
+ position: absolute;
509
+ box-sizing: border-box;
510
+ opacity: 0;
511
+ transition: opacity 150ms ease, transform 150ms ease;
512
+ }
513
+ .${t}-handle-left,
514
+ .${t}-handle-right {
515
+ top: 0;
516
+ bottom: 0;
517
+ width: 10px;
518
+ cursor: ew-resize;
519
+ }
520
+ .${t}-handle-left { left: -5px; }
521
+ .${t}-handle-right { right: -5px; }
522
+ .${t}-handle-top,
523
+ .${t}-handle-bottom {
524
+ left: 0;
525
+ right: 0;
526
+ height: 10px;
527
+ cursor: ns-resize;
528
+ }
529
+ .${t}-handle-top { top: -5px; }
530
+ .${t}-handle-bottom { bottom: -5px; }
531
+ .${t}-handle-left::after,
532
+ .${t}-handle-right::after {
533
+ top: 0;
534
+ bottom: 0;
535
+ left: 3px;
536
+ width: 4px;
537
+ background-color: #FF5C02;
538
+ transform: scaleX(0.25);
539
+ }
540
+ .${t}-handle-top::after,
541
+ .${t}-handle-bottom::after {
542
+ left: 0;
543
+ right: 0;
544
+ top: 3px;
545
+ height: 4px;
546
+ background-color: #FF5C02;
547
+ transform: scaleY(0.25);
548
+ }
549
+ .${t}-handle-top-left,
550
+ .${t}-handle-top-right,
551
+ .${t}-handle-bottom-right,
552
+ .${t}-handle-bottom-left {
553
+ width: 12px;
554
+ height: 12px;
555
+ }
556
+ .${t}-handle-top-left { top: -6px; left: -6px; cursor: nwse-resize; }
557
+ .${t}-handle-bottom-right { bottom: -6px; right: -6px; cursor: nwse-resize; }
558
+ .${t}-handle-top-right { top: -6px; right: -6px; cursor: nesw-resize; }
559
+ .${t}-handle-bottom-left { bottom: -6px; left: -6px; cursor: nesw-resize; }
560
+ .${t}-handle-top-left::after,
561
+ .${t}-handle-top-right::after,
562
+ .${t}-handle-bottom-right::after,
563
+ .${t}-handle-bottom-left::after {
564
+ inset: 3px;
565
+ background-color: #ffffff;
566
+ border: 1px solid #FF5C02;
567
+ }
568
+ .${t}-frame:hover > .${t}-handle::after {
569
+ opacity: 0.6;
570
+ }
571
+ .${t}-handle:hover::after,
572
+ .${t}-handle-active::after {
573
+ opacity: 1;
574
+ transform: none;
575
+ }
576
+ `;
577
+ }
578
+ function tt(t, e, o, n) {
579
+ const r = (d) => t[`${e}${d}`] ?? (n ? t[`${n}${d}`] : void 0), u = (d) => {
580
+ const f = r(d);
581
+ return f === void 0 ? void 0 : qt(f, o);
582
+ }, c = r("FontSettings"), s = r("TextAppearance");
583
+ return {
584
+ fontFamily: ve(r("FontFamily")),
585
+ fontWeight: c == null ? void 0 : c.fontWeight,
586
+ fontStyle: c == null ? void 0 : c.fontStyle,
587
+ fontSize: u("FontSize"),
588
+ lineHeight: u("LineHeight"),
589
+ letterSpacing: u("LetterSpacing"),
590
+ wordSpacing: u("WordSpacing"),
591
+ textTransform: s == null ? void 0 : s.textTransform,
592
+ textDecoration: s == null ? void 0 : s.textDecoration,
593
+ fontVariant: s == null ? void 0 : s.fontVariant
594
+ };
595
+ }
596
+ function Mt(t) {
597
+ const e = t.type ?? "text";
598
+ return e === "list" ? "listA" : e;
599
+ }
600
+ function Ze(t, e, o, n) {
601
+ return t != null && t.grid && Array.isArray(t.placements) && t.placements.every((r) => typeof (r == null ? void 0 : r.top) == "number") ? Ke(Te(t, n), e) : Ae(e.map(Mt), n, 1, o);
602
+ }
603
+ function Ke(t, e) {
604
+ const o = (n, r) => n.height !== void 0 && e[r] && Mt(e[r]) !== "image";
605
+ return t.placements.some(o) ? {
606
+ ...t,
607
+ placements: t.placements.map((n, r) => {
608
+ if (!o(n, r)) return n;
609
+ const { height: u, ...c } = n;
610
+ return c;
611
+ })
612
+ } : t;
613
+ }
614
+ function Je(t, e) {
615
+ const o = (n, r) => Math.abs(n - r) < 1e-4;
616
+ return o(t.height, e.height) && t.heights.length === e.heights.length && t.heights.every((n, r) => o(n, e.heights[r]));
617
+ }
618
+ function wt(t, e) {
619
+ const { columns: o } = t.grid, n = t.placements[e];
620
+ if (!n) return { column: 0, span: Math.min(o, Math.max(1, Math.round(o / 4))), top: 0 };
621
+ const r = Math.min(n.span, o), u = { column: Math.min(n.column, o - r), span: r, top: n.top };
622
+ return typeof n.height == "number" ? { ...u, height: n.height } : u;
623
+ }
624
+ function Qe({
625
+ settings: t,
626
+ content: e = [],
627
+ isEditor: o,
628
+ isEditMode: n,
629
+ isPreviewMode: r,
630
+ layoutId: u,
631
+ portalId: c,
632
+ currentState: s,
633
+ unavailableStates: d = [],
634
+ onOpenChange: f,
635
+ onUpdateSettings: w
636
+ }) {
637
+ var Ot, Ht;
638
+ const { prefix: a } = $e(), T = Z(() => qe(a), [a]), [m, p] = j(!1), [v, A] = j(!1), [z, N] = j(!1), k = !!(o && !r), S = k && s === "open" && !d.includes("open"), R = S || !k && m, ct = Oe(t);
639
+ be(R && !k), U(() => {
640
+ f == null || f(R);
641
+ }, [R, f]), U(() => {
642
+ p(!1);
643
+ }, [u]), U(() => {
644
+ if (R) {
645
+ A(!0);
646
+ return;
647
+ }
648
+ N(!1);
649
+ const i = window.setTimeout(() => A(!1), ct === "none" ? 0 : Y);
650
+ return () => window.clearTimeout(i);
651
+ }, [R, ct]), U(() => {
652
+ if (!R || !v) return;
653
+ const i = Q.current;
654
+ i && getComputedStyle(i.querySelector("[role=dialog]") ?? i).opacity;
655
+ const l = requestAnimationFrame(() => N(!0));
656
+ return () => cancelAnimationFrame(l);
657
+ }, [R, v]), U(() => {
658
+ if (!R || k) return;
659
+ const i = (l) => {
660
+ l.key === "Escape" && p(!1);
661
+ };
662
+ return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
663
+ }, [R, k]);
664
+ const _ = (i) => qt(i ?? 0, o), kt = Ie(t), ot = (Ot = t.menuLayout) == null ? void 0 : Ot.grid, Ct = Ce(t, ot != null && ot.columnWidth ? ot : Zt), st = `min(100%, ${_(_e(t, Ct))})`, ut = _(t.popupOffset), ee = {
665
+ left: `calc(0px + ${ut})`,
666
+ center: `calc((100% - ${st}) / 2 + ${ut})`,
667
+ right: `calc(100% - ${st} + ${ut})`
668
+ }[Re(t)], { columns: It, columnWidth: Rt, gutter: _t, rowGap: St } = Ct, zt = Z(
669
+ () => ({ columns: It, columnWidth: Rt, gutter: _t, rowGap: St }),
670
+ [It, Rt, _t, St]
671
+ ), J = Z(
672
+ () => Ze(t.menuLayout, e, kt, zt),
673
+ [t.menuLayout, e, kt, zt]
674
+ ), [ht, oe] = j(null), pt = Z(() => ht ? Vt(J, ht) : null, [J, ht]), C = Z(() => pt ? Ee(J, pt) : J, [J, pt]), { columns: G, gutter: dt, columnWidth: mt } = C.grid, ne = G * mt + (G - 1) * dt, gt = mt > 0 ? {
675
+ gridTemplateColumns: `repeat(${G}, minmax(0, ${_(mt)}))`,
676
+ columnGap: _(dt),
677
+ width: `min(100%, ${_(ne)})`,
678
+ marginInline: "auto"
679
+ } : { gridTemplateColumns: `repeat(${G}, minmax(0, 1fr))`, columnGap: _(dt) }, At = t.triggerLabel || "Menu", nt = Se(t.triggerPadding), V = t.triggerType === "icon" && !t.triggerIcon ? "burger" : t.triggerType ?? "text", re = tt(t, "trigger", o), ie = tt(t, "title", o), ae = {
680
+ text: tt(t, "text", o),
681
+ listA: tt(t, "listA", o, "text"),
682
+ listB: tt(t, "listB", o, "text")
683
+ }, W = ((Ht = t.stateOverrides) == null ? void 0 : Ht.open) ?? {}, Nt = {
684
+ [`--${a}-trigger-bg`]: t.barBackgroundColor,
685
+ [`--${a}-trigger-color`]: (R ? W.triggerColor : void 0) ?? t.triggerColor,
686
+ [`--${a}-overlay-color`]: W.overlayColor ?? t.overlayColor,
687
+ [`--${a}-overlay-blur`]: t.overlayBlur ? `blur(${_(t.overlayBlur)})` : void 0,
688
+ [`--${a}-popup-bg`]: W.popupBackgroundColor ?? t.popupBackgroundColor,
689
+ [`--${a}-title-color`]: W.titleColor ?? t.titleColor,
690
+ [`--${a}-text-color`]: W.textColor ?? t.textColor,
691
+ [`--${a}-list-a-color`]: W.listAColor ?? t.listAColor,
692
+ [`--${a}-list-b-color`]: W.listBColor ?? t.listBColor
693
+ }, Tt = H(null), le = Z(() => {
694
+ const i = Tt.current;
695
+ if (!v || !o || !i) return;
696
+ const l = getComputedStyle(i);
697
+ return Object.fromEntries(
698
+ Ue.map((h) => [h, l.getPropertyValue(h).trim()]).filter(([, h]) => h)
699
+ );
700
+ }, [v, o]), Q = H(null), Lt = H(null), Bt = H(null), ft = H(null), P = H([]), [B, ce] = j(null), $t = H(null), X = (i) => {
701
+ $t.current = i, ce(i);
702
+ }, F = !!(S && n && w), se = B ? Xt(C, B) : null;
703
+ U(() => {
704
+ F || X(null);
705
+ }, [F]);
706
+ const [bt, Et] = j(null);
707
+ Ut(() => {
708
+ const i = Lt.current;
709
+ if (!v || !i) {
710
+ Et(null);
711
+ return;
712
+ }
713
+ const l = () => {
714
+ const y = Q.current;
715
+ if (!y) return;
716
+ const $ = y.getBoundingClientRect(), g = i.getBoundingClientRect(), M = { top: g.top - $.top, left: g.left - $.left, width: g.width, height: g.height };
717
+ Et((b) => b && b.top === M.top && b.left === M.left && b.width === M.width && b.height === M.height ? b : M);
718
+ };
719
+ l();
720
+ const h = new ResizeObserver(l);
721
+ return h.observe(i), window.addEventListener("resize", l), window.addEventListener("scroll", l, { capture: !0, passive: !0 }), () => {
722
+ h.disconnect(), window.removeEventListener("resize", l), window.removeEventListener("scroll", l, { capture: !0 });
723
+ };
724
+ }, [v]), Ut(() => {
725
+ const i = Bt.current, l = ft.current;
726
+ if (!v || !i || !l) return;
727
+ const h = () => {
728
+ var M;
729
+ const $ = (M = Q.current) == null ? void 0 : M.getBoundingClientRect().width;
730
+ if (!$) return;
731
+ const g = {
732
+ height: i.getBoundingClientRect().height / $,
733
+ heights: e.map((b, L) => {
734
+ var x;
735
+ return (((x = P.current[L]) == null ? void 0 : x.getBoundingClientRect().height) ?? 0) / $;
736
+ })
737
+ };
738
+ oe((b) => b && Je(b, g) ? b : g);
739
+ };
740
+ h();
741
+ const y = new ResizeObserver(h);
742
+ return y.observe(i), y.observe(l), P.current.slice(0, e.length).forEach(($) => $ && y.observe($)), () => y.disconnect();
743
+ }, [v, e]);
744
+ const Gt = () => {
745
+ const i = ft.current, l = i.getBoundingClientRect(), h = i.offsetWidth ? l.width / i.offsetWidth : 1, y = (parseFloat(getComputedStyle(i).columnGap) || 0) * h;
746
+ return { area: l, gap: y, pitch: (l.width + y) / G };
747
+ }, ue = (i, l, h) => {
748
+ var L, x;
749
+ if (!F || !C.placements[l] || i.button !== 0) return;
750
+ i.preventDefault(), i.stopPropagation(), i.currentTarget.setPointerCapture(i.pointerId);
751
+ const { area: y, pitch: $ } = Gt(), g = ((L = P.current[l]) == null ? void 0 : L.getBoundingClientRect()) ?? i.currentTarget.getBoundingClientRect(), M = ((x = Q.current) == null ? void 0 : x.getBoundingClientRect().width) || 1, b = wt(C, l);
752
+ X({
753
+ index: l,
754
+ pointerId: i.pointerId,
755
+ handle: h,
756
+ grabColumn: Math.min(Math.max(Math.floor((i.clientX - y.left) / $) - b.column, 0), b.span - 1),
757
+ grabY: i.clientY - g.top,
758
+ unit: M,
759
+ start: b,
760
+ placement: b,
761
+ measure: Vt(C, {
762
+ height: y.height / M,
763
+ heights: e.map((D, rt) => {
764
+ var E;
765
+ return (((E = P.current[rt]) == null ? void 0 : E.getBoundingClientRect().height) ?? 0) / M;
766
+ })
767
+ })
768
+ });
769
+ }, he = (i) => {
770
+ const l = $t.current;
771
+ if (!l || i.pointerId !== l.pointerId) return;
772
+ i.stopPropagation();
773
+ const { area: h, gap: y, pitch: $ } = Gt(), { start: g, measure: M, handle: b } = l, L = M.height;
774
+ if (!b) {
775
+ X({
776
+ ...l,
777
+ placement: {
778
+ ...g,
779
+ column: Math.min(Math.max(Math.floor((i.clientX - h.left) / $) - l.grabColumn, 0), G - g.span),
780
+ top: K(C.grid, (i.clientY - l.grabY - h.top) / l.unit, L - M.heights[l.index])
781
+ }
782
+ });
783
+ return;
784
+ }
785
+ const x = i.clientX - h.left, D = (i.clientY - h.top) / l.unit, rt = g.column + g.span;
786
+ let { column: E, span: it, top: O } = g, at = g.height;
787
+ if (b.includes("left") && (E = Math.min(Math.max(Math.round(x / $), 0), rt - 1), it = rt - E), b.includes("right") && (it = Math.min(Math.max(Math.round((x + y) / $), E + 1), G) - E), b.includes("top")) {
788
+ const jt = g.top + (g.height ?? M.heights[l.index] ?? 0);
789
+ O = K(C.grid, D, jt - yt(C.grid)), at = lt(C.grid, jt - O, L - O);
790
+ }
791
+ b.includes("bottom") && (at = lt(C.grid, D - O, L - O)), X({ ...l, placement: at === void 0 ? { column: E, span: it, top: O } : { column: E, span: it, top: O, height: at } });
792
+ }, pe = (i) => {
793
+ const l = $t.current;
794
+ if (!l || i.pointerId !== l.pointerId) return;
795
+ i.stopPropagation();
796
+ const h = Xt(C, l), y = h == null ? void 0 : h.placements[l.index];
797
+ h && y && !Xe(y, wt(C, l.index)) && (w == null || w({ ...t, menuLayout: h })), X(null);
798
+ }, de = (i, l) => {
799
+ i.stopPropagation();
800
+ const h = C.placements[l];
801
+ if (!F || !h || h.height === void 0) return;
802
+ const { height: y, ...$ } = h;
803
+ w == null || w({
804
+ ...t,
805
+ menuLayout: { ...C, edited: !0, placements: C.placements.map((g, M) => M === l ? $ : g) }
806
+ });
807
+ }, vt = () => p(!1), me = (i) => {
808
+ !k && i.target.closest("a") && vt();
809
+ }, ge = (i, l) => {
810
+ const h = Mt(i), y = (i.images ?? []).filter((x) => x == null ? void 0 : x.assetId), $ = (B == null ? void 0 : B.index) === l, g = $ ? B.placement : wt(C, l), M = g.height !== void 0, b = F && (!B || $), L = (x) => ({
811
+ onPointerDown: (D) => ue(D, l, x),
812
+ onPointerMove: he,
813
+ onPointerUp: pe,
814
+ onPointerCancel: () => X(null)
815
+ });
816
+ return /* @__PURE__ */ q(
817
+ "div",
818
+ {
819
+ className: `${a}-slot${$ ? ` ${a}-slot-dragged` : ""}`,
820
+ style: { gridColumn: `${g.column + 1} / span ${g.span}` },
821
+ children: [
822
+ /* @__PURE__ */ I("div", { className: `${a}-spacer`, style: { height: _(g.top) } }),
823
+ /* @__PURE__ */ q("div", { className: `${a}-frame`, children: [
824
+ /* @__PURE__ */ q(
825
+ "div",
826
+ {
827
+ ref: (x) => {
828
+ P.current[l] = x;
829
+ },
830
+ className: [
831
+ `${a}-block ${a}-block-${h}`,
832
+ M ? `${a}-block-sized` : "",
833
+ $ ? `${a}-block-dragged` : "",
834
+ $ && !se ? `${a}-block-invalid` : ""
835
+ ].filter(Boolean).join(" "),
836
+ style: M ? { height: _(g.height) } : void 0,
837
+ ...F ? L(null) : {},
838
+ children: [
839
+ i.title && h !== "image" ? /* @__PURE__ */ I("div", { className: `${a}-block-title`, style: { ...ie, marginBottom: _(t.titleGap) }, children: i.title }) : null,
840
+ h === "image" ? /* @__PURE__ */ I(Pe, { prefix: a, images: y, isRunning: R, radius: _(t.imageRadius) }) : /* @__PURE__ */ I("div", { className: `${a}-block-text`, style: ae[h], children: /* @__PURE__ */ I(xe, { content: Array.isArray(i.text) ? i.text : [] }) })
841
+ ]
842
+ }
843
+ ),
844
+ b ? (h === "image" ? Ye : Ve).map((x) => /* @__PURE__ */ I(
845
+ "div",
846
+ {
847
+ className: `${a}-handle ${a}-handle-${x}${$ && B.handle === x ? ` ${a}-handle-active` : ""}`,
848
+ "aria-hidden": !0,
849
+ ...L(x),
850
+ onDoubleClick: x.includes("top") || x.includes("bottom") ? (D) => de(D, l) : void 0
851
+ },
852
+ x
853
+ )) : null
854
+ ] })
855
+ ]
856
+ },
857
+ l
858
+ );
859
+ }, Ft = {
860
+ ...V === "text" ? re : void 0,
861
+ padding: [nt.top, nt.right, nt.bottom, nt.left].map((i) => _(i)).join(" "),
862
+ [`--${a}-icon-size`]: _(t.triggerIconSize ?? je)
863
+ }, Wt = V === "text" ? At : /* @__PURE__ */ I("span", { className: `${a}-icon ${a}-icon-${V}`, "aria-hidden": !0, children: V === "icon" ? /* @__PURE__ */ I(
864
+ we,
865
+ {
866
+ url: t.triggerIcon,
867
+ fill: `var(--${a}-trigger-color)`,
868
+ hoverFill: `var(--${a}-trigger-color)`,
869
+ className: `${a}-icon-picture`
870
+ }
871
+ ) : Array.from({ length: V === "burger" ? 3 : 2 }, (i, l) => /* @__PURE__ */ I("span", { className: `${a}-icon-line` }, l)) }), xt = C.grid.beat || et(C.grid), Dt = v ? /* @__PURE__ */ q(
872
+ "div",
873
+ {
874
+ ref: Q,
875
+ "data-selection": "none",
876
+ className: [`${a}-overlay`, `${a}-transition-${ct.replace(" ", "-")}`, o ? `${a}-overlay-editor` : "", z ? `${a}-overlay-active` : ""].filter(Boolean).join(" "),
877
+ style: { ...le, ...Nt },
878
+ "aria-hidden": !z,
879
+ children: [
880
+ /* @__PURE__ */ I(
881
+ "button",
882
+ {
883
+ type: "button",
884
+ className: `${a}-backdrop`,
885
+ "aria-label": "Close menu",
886
+ tabIndex: -1,
887
+ onClick: k ? void 0 : vt
888
+ }
889
+ ),
890
+ /* @__PURE__ */ I(
891
+ "div",
892
+ {
893
+ ref: Bt,
894
+ className: `${a}-card`,
895
+ role: "dialog",
896
+ "aria-modal": "true",
897
+ "aria-label": t.triggerLabel || "Menu",
898
+ onClick: me,
899
+ style: {
900
+ top: _(t.popupOffsetTop),
901
+ height: `${Kt(t)}%`,
902
+ left: ee,
903
+ width: st,
904
+ borderRadius: _(t.popupRadius)
905
+ },
906
+ children: /* @__PURE__ */ q(
907
+ "div",
908
+ {
909
+ ref: ft,
910
+ className: `${a}-grid${F ? ` ${a}-grid-editable` : ""}`,
911
+ style: gt,
912
+ children: [
913
+ e.map(ge),
914
+ F ? /* @__PURE__ */ I(
915
+ "div",
916
+ {
917
+ className: `${a}-guides${xt > 0 ? ` ${a}-guides-beats` : ""}${B ? ` ${a}-guides-shown` : ""}`,
918
+ style: {
919
+ gridTemplateColumns: gt.gridTemplateColumns,
920
+ columnGap: gt.columnGap,
921
+ [`--${a}-beat`]: xt > 0 ? _(xt) : void 0
922
+ },
923
+ "aria-hidden": !0,
924
+ children: Array.from({ length: G }, (i, l) => /* @__PURE__ */ I("div", { className: `${a}-guide` }, l))
925
+ }
926
+ ) : null
927
+ ]
928
+ }
929
+ )
930
+ }
931
+ ),
932
+ bt ? /* @__PURE__ */ I(
933
+ "button",
934
+ {
935
+ type: "button",
936
+ className: [
937
+ `${a}-button ${a}-close`,
938
+ z ? `${a}-button-open` : "",
939
+ k ? `${a}-close-inert` : ""
940
+ ].filter(Boolean).join(" "),
941
+ style: { ...Ft, ...bt },
942
+ "aria-label": "Close menu",
943
+ "aria-expanded": R,
944
+ tabIndex: z ? void 0 : -1,
945
+ onClick: k ? void 0 : vt,
946
+ children: Wt
947
+ }
948
+ ) : null
949
+ ]
950
+ }
951
+ ) : null;
952
+ return /* @__PURE__ */ q("div", { ref: Tt, className: `${a}-root`, style: Nt, "data-edit-mode": n ? "" : void 0, children: [
953
+ /* @__PURE__ */ I("style", { dangerouslySetInnerHTML: { __html: T } }),
954
+ /* @__PURE__ */ I(
955
+ "button",
956
+ {
957
+ ref: Lt,
958
+ type: "button",
959
+ className: [
960
+ `${a}-button`,
961
+ R ? `${a}-button-open` : "",
962
+ // the close button over the popup stands in for it while the popup shows
963
+ bt ? `${a}-button-hidden` : ""
964
+ ].filter(Boolean).join(" "),
965
+ style: Ft,
966
+ "aria-expanded": R,
967
+ "aria-label": V === "text" ? void 0 : At,
968
+ onClick: k ? void 0 : () => p((i) => !i),
969
+ children: Wt
970
+ }
971
+ ),
972
+ Dt && typeof document < "u" ? fe(Dt, (c ? document.getElementById(c) : null) ?? document.body) : null
973
+ ] });
974
+ }
975
+ function Pe({ prefix: t, images: e, isRunning: o, radius: n }) {
976
+ const [r, u] = j(0), c = e.length;
977
+ return U(() => {
978
+ if (!o || c < 2) {
979
+ u(0);
980
+ return;
981
+ }
982
+ const s = window.setInterval(() => u((d) => (d + 1) % c), We);
983
+ return () => window.clearInterval(s);
984
+ }, [o, c]), /* @__PURE__ */ I("div", { className: `${t}-images`, children: e.map((s, d) => /* @__PURE__ */ I(
985
+ "img",
986
+ {
987
+ className: `${t}-image${d === r % c ? "" : ` ${t}-image-hidden`}`,
988
+ src: s.assetId,
989
+ alt: s.name ?? "",
990
+ "aria-hidden": d !== r % c,
991
+ style: { borderRadius: n }
992
+ },
993
+ d
994
+ )) });
995
+ }
996
+ const uo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
997
+ __proto__: null,
998
+ POPUP_MENU_TRANSITIONS: te,
999
+ POPUP_MENU_TRIGGER_TYPES: He,
1000
+ PopupMenu: Qe
1001
+ }, Symbol.toStringTag, { value: "Module" }));
1002
+ export {
1003
+ Me as D,
1004
+ ke as P,
1005
+ K as a,
1006
+ lt as b,
1007
+ Ie as c,
1008
+ Kt as d,
1009
+ _e as e,
1010
+ Te as f,
1011
+ Ae as g,
1012
+ Se as h,
1013
+ Ne as i,
1014
+ Ce as j,
1015
+ Zt as k,
1016
+ so as l,
1017
+ Le as m,
1018
+ ze as n,
1019
+ ye as o,
1020
+ te as p,
1021
+ He as q,
1022
+ Be as r,
1023
+ Ee as s,
1024
+ Qe as t,
1025
+ uo as u
1026
+ };