@cntrl-site/components 1.0.115-alpha.0 → 1.0.115-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.
@@ -1,19 +1,20 @@
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";
1
+ import { jsx as C, jsxs as q } from "react/jsx-runtime";
2
+ import { useMemo as Z, useState as U, useEffect as D, useRef as W, useLayoutEffect as Ut } from "react";
3
3
  import { createPortal as fe } from "react-dom";
4
4
  import { s as qt } from "./scalingValue-C9JH5L6O.mjs";
5
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 = {
6
+ import { i as be, E as ve } from "./EmbedMediaFrame-DwHeOAy5.mjs";
7
+ import { u as xe } from "./useLightboxScrollLock-VQ07s7EJ.mjs";
8
+ import { n as ye } from "./textStylesToCss-05Mn6I_2.mjs";
9
+ import { R as we } from "./RichTextRenderer-D52Xto59.mjs";
10
+ import { S as Me } from "./SvgImage-CwRq9-ec.mjs";
11
+ const ke = 60, Ce = 900 / 1440, Ie = ["left", "center", "right"], Zt = {
11
12
  columns: 12,
12
13
  columnWidth: 99 / 1440,
13
14
  gutter: 20 / 1440
14
15
  };
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));
16
+ function Se(t, e = Zt) {
17
+ const o = (s) => typeof s == "number" && Number.isFinite(s), n = (s, ...c) => c.find(o) ?? s, r = t.gridLayout ?? {}, u = Math.max(0, n(e.gutter, r.horizontalGap, t.gridGutter));
17
18
  return {
18
19
  columns: Math.max(1, Math.round(n(e.columns, r.columnsCount, t.gridColumns))),
19
20
  columnWidth: Math.max(0, n(e.columnWidth, r.entryWidth, t.gridColumnWidth)),
@@ -26,25 +27,25 @@ function et(t) {
26
27
  }
27
28
  function Kt(t) {
28
29
  const e = t.popupHeight;
29
- return Math.min(100, Math.max(0, typeof e == "number" && Number.isFinite(e) ? e : ye));
30
+ return Math.min(100, Math.max(0, typeof e == "number" && Number.isFinite(e) ? e : ke));
30
31
  }
31
- function Ie(t, e = Me) {
32
+ function _e(t, e = Ce) {
32
33
  return Kt(t) / 100 * e;
33
34
  }
34
- function Re(t) {
35
- return ke.includes(t.popupAlign) ? t.popupAlign : "center";
35
+ function ze(t) {
36
+ return Ie.includes(t.popupAlign) ? t.popupAlign : "center";
36
37
  }
37
- function _e(t, e) {
38
+ function Ae(t, e) {
38
39
  var r;
39
40
  const o = (r = t.gridLayout) == null ? void 0 : r.wrapperWidth, n = e.columns * e.columnWidth + (e.columns - 1) * e.gutter;
40
41
  return typeof o == "number" && Number.isFinite(o) && o > 0 ? Math.max(o, n) : n > 0 ? n : 1;
41
42
  }
42
- function Se(t) {
43
+ function Ne(t) {
43
44
  if (typeof t == "number") return { top: t, right: t, bottom: t, left: t };
44
45
  const e = (o) => typeof o == "number" && Number.isFinite(o) ? Math.max(0, o) : 0;
45
46
  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
  }
47
- const ze = {
48
+ const Re = {
48
49
  span: {
49
50
  text: { min: 1 / 4, max: 5 / 12 },
50
51
  image: { min: 1 / 6, max: 1 / 3 },
@@ -53,52 +54,52 @@ const ze = {
53
54
  },
54
55
  breakChance: 0.25
55
56
  };
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 });
57
+ function Te(t, e, o, n, r = Re) {
58
+ const u = De(o), s = Math.max(1, Math.floor(e.columns)), c = [];
59
+ let h = 0, d = new Array(s).fill(!1);
60
+ const g = {};
61
+ for (const z of t) {
62
+ const f = g[z] ?? (g[z] = We(r.span[z] ?? r.span.text, s, u));
63
+ let m = Yt(d, f);
64
+ const x = d.some(Boolean);
65
+ (m.length === 0 || x && u() < r.breakChance) && (h += 1, d = new Array(s).fill(!1), m = Yt(d, f));
66
+ const R = m[Math.floor(u() * m.length)];
67
+ for (let N = Math.max(0, R - 1); N < Math.min(s, R + f + 1); N++) d[N] = !0;
68
+ c.push({ column: R, span: f, row: h });
68
69
  }
69
- const a = d + 1;
70
+ const a = h + 1;
70
71
  return {
71
72
  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) }))
73
+ grid: { ...e, columns: s },
74
+ placements: c.map(({ column: z, span: f, row: m }) => ({ column: z, span: f, top: K(e, m * n / a, n) }))
74
75
  };
75
76
  }
76
- function so() {
77
+ function mo() {
77
78
  return Math.floor(Math.random() * 2147483647);
78
79
  }
79
80
  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;
81
+ const n = t.beat ?? 0, r = Math.max(0, o), u = n > 0 ? Math.round(e / n) * n : e, s = u <= r ? u : n > 0 ? Math.floor(r / n + 1e-9) * n : r;
82
+ return Math.round(Math.max(0, s) * 1e6) / 1e6;
82
83
  }
83
- function yt(t) {
84
+ function wt(t) {
84
85
  return t.beat && t.beat > 0 ? t.beat : 8 / 1440;
85
86
  }
86
87
  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));
88
+ const n = t.beat ?? 0, r = wt(t), u = n > 0 ? Math.round(e / n) * n : e, s = u <= o ? u : n > 0 ? Math.floor(o / n + 1e-9) * n : o;
89
+ return Jt(Math.max(r, s));
89
90
  }
90
- function Ne(t, e) {
91
+ function Le(t, e) {
91
92
  const o = (n, r) => Math.abs(n - r) < 1e-9;
92
93
  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
  }
94
- function Te(t, e) {
95
+ function Be(t, e) {
95
96
  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) };
97
+ if (Le(t.grid, o)) return t;
98
+ const n = Math.max(1, Math.floor(t.grid.columns)), r = o.columns, u = (c) => n === r ? c : Math.round(c * r / n), s = t.placements.map((c) => {
99
+ const h = Math.min(r, Math.max(1, u(c.span))), d = Math.min(Math.max(0, u(c.column)), r - h), g = K(o, c.top);
100
+ return c.height === void 0 ? { column: d, span: h, top: g } : { column: d, span: h, top: g, height: lt(o, c.height) };
100
101
  });
101
- return { ...t, grid: o, placements: c };
102
+ return { ...t, grid: o, placements: s };
102
103
  }
103
104
  function Jt(t) {
104
105
  return Math.round(t * 1e6) / 1e6;
@@ -106,62 +107,62 @@ function Jt(t) {
106
107
  function Qt(t, e, o, n, r) {
107
108
  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
  }
109
- function Le(t, e, o, n, r) {
110
+ function Ee(t, e, o, n, r) {
110
111
  const u = t.placements[e];
111
112
  return u ? Pt(t, e, { ...u, column: o, top: n }, r) : null;
112
113
  }
113
- function Be(t, e, o, n) {
114
+ function Fe(t, e, o, n) {
114
115
  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);
116
+ const { columns: r } = t.grid, u = Math.min(Math.max(0, o.column), r - 1), s = Math.min(Math.max(1, o.span), r - u), c = K(t.grid, o.top, n ? n.height - wt(t.grid) : 1 / 0), h = o.height === void 0 ? void 0 : lt(t.grid, o.height, n ? n.height - c : 1 / 0);
117
+ return Pt(t, e, h === void 0 ? { column: u, span: s, top: c } : { column: u, span: s, top: c, height: h }, n);
117
118
  }
118
119
  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 = {
120
+ const { columns: r } = t.grid, u = et(t.grid), s = Math.min(o.span, r);
121
+ if (s < 1 || o.column < 0 || o.column + s > r) return null;
122
+ const c = o.height ?? (n == null ? void 0 : n.heights[e]) ?? 0, h = {
122
123
  column: o.column,
123
- span: c,
124
- top: K(t.grid, o.top, n ? n.height - s : 1 / 0),
124
+ span: s,
125
+ top: K(t.grid, o.top, n ? n.height - c : 1 / 0),
125
126
  ...o.height === void 0 ? {} : { height: o.height }
126
127
  };
127
- return n && t.placements.some((f, w) => w !== e && Qt(d, s, f, n.heights[w] ?? 0, u)) ? null : {
128
+ return n && t.placements.some((d, g) => g !== e && Qt(h, c, d, n.heights[g] ?? 0, u)) ? null : {
128
129
  ...t,
129
130
  edited: !0,
130
- placements: t.placements.map((f, w) => w === e ? d : f)
131
+ placements: t.placements.map((d, g) => g === e ? h : d)
131
132
  };
132
133
  }
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);
134
+ function Ge(t, e) {
135
+ const { columns: o } = t.grid, n = et(t.grid), r = t.grid.beat ?? 0, u = e.height, s = t.placements.map((f, m) => e.heights[m] ?? 0), c = [...t.placements], h = c.map((f, m) => m).sort((f, m) => c[f].top - c[m].top || f - m), d = [], g = (f, m) => {
136
+ let { top: x } = f;
137
+ for (let R = !0, N = 0; R && N <= d.length; N++) {
138
+ R = !1;
139
+ for (const T of d) {
140
+ const k = c[T];
141
+ if (!Qt({ ...f, top: x }, m, k, s[T], n)) continue;
142
+ const A = k.top + s[T] + n, S = r > 0 ? Jt(Math.ceil(A / r - 1e-9) * r) : Math.ceil(A * 1e6 - 1e-6) / 1e6;
143
+ S <= x || (x = S, R = !0);
143
144
  }
144
145
  }
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 });
146
+ return x;
147
+ }, a = (f, m) => f + m > u + 1e-9;
148
+ let z = !1;
149
+ for (const f of h) {
150
+ const m = c[f];
151
+ let x = { column: m.column, top: g(m, s[f]) };
152
+ if (x.top !== m.top && a(x.top, s[f])) {
153
+ const R = Math.min(m.span, o), N = Array.from({ length: Math.max(0, o - R + 1) }, (k, A) => A).sort((k, A) => Math.abs(k - m.column) - Math.abs(A - m.column) || k - A);
154
+ let T = null;
155
+ for (const k of N) {
156
+ const A = g({ ...m, column: k }, s[f]);
157
+ !a(A, s[f]) && (!T || A < T.top - 1e-9) && (T = { column: k, top: A });
157
158
  }
158
- N && (v = N);
159
+ T && (x = T);
159
160
  }
160
- (v.column !== p.column || v.top !== p.top) && (s[m] = { ...s[m], ...v }, T = !0), f.push(m);
161
+ (x.column !== m.column || x.top !== m.top) && (c[f] = { ...c[f], ...x }, z = !0), d.push(f);
161
162
  }
162
- return T ? { ...t, placements: s } : t;
163
+ return z ? { ...t, placements: c } : t;
163
164
  }
164
- function Ge(t, e, o) {
165
+ function We(t, e, o) {
165
166
  const n = Math.max(1, Math.round(t.min * e)), r = Math.max(n, Math.round(t.max * e));
166
167
  return Math.min(e, n + Math.floor(o() * (r - n + 1)));
167
168
  }
@@ -178,7 +179,7 @@ function Yt(t, e) {
178
179
  }
179
180
  return o;
180
181
  }
181
- function Fe(t) {
182
+ function De(t) {
182
183
  let e = t >>> 0;
183
184
  return () => {
184
185
  e = e + 1831565813 >>> 0;
@@ -186,25 +187,25 @@ function Fe(t) {
186
187
  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
  };
188
189
  }
189
- const Y = 300, We = 3e3, te = ["slide down", "slide up", "fade", "scale", "none"], De = "slide down";
190
- function Oe(t) {
190
+ const Y = 300, Oe = 3e3, te = ["slide down", "slide up", "fade", "scale", "none"], He = "slide down";
191
+ function je(t) {
191
192
  const e = t.popupTransition;
192
- return te.includes(e) ? e : De;
193
+ return te.includes(e) ? e : He;
193
194
  }
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
+ const Ue = ["burger", "plus", "icon", "text"], Ye = 24 / 1440, Ve = ["--cntrl-article-top", "--cntrl-article-left", "--cntrl-article-width", "--cntrl-viewport-height"], Xe = ["top", "right", "bottom", "left", "top-left", "top-right", "bottom-right", "bottom-left"], qe = ["right", "left"];
195
196
  function Vt(t, e) {
196
197
  return { ...e, heights: e.heights.map((o, n) => {
197
198
  var r;
198
199
  return ((r = t.placements[n]) == null ? void 0 : r.height) ?? o;
199
200
  }) };
200
201
  }
201
- function Xe(t, e) {
202
+ function Ze(t, e) {
202
203
  return t.column === e.column && t.span === e.span && t.top === e.top && t.height === e.height;
203
204
  }
204
205
  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
+ return e.handle ? Fe(t, e.index, e.placement, e.measure) : Ee(t, e.index, e.placement.column, e.placement.top, e.measure);
206
207
  }
207
- function qe(t) {
208
+ function Ke(t) {
208
209
  return `
209
210
  /* the element is the trigger alone, placed and sized on the page as any other element; the popup opens over the page */
210
211
  .${t}-root {
@@ -576,191 +577,191 @@ function qe(t) {
576
577
  `;
577
578
  }
578
579
  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");
580
+ const r = (h) => t[`${e}${h}`] ?? (n ? t[`${n}${h}`] : void 0), u = (h) => {
581
+ const d = r(h);
582
+ return d === void 0 ? void 0 : qt(d, o);
583
+ }, s = r("FontSettings"), c = r("TextAppearance");
583
584
  return {
584
- fontFamily: ve(r("FontFamily")),
585
- fontWeight: c == null ? void 0 : c.fontWeight,
586
- fontStyle: c == null ? void 0 : c.fontStyle,
585
+ fontFamily: ye(r("FontFamily")),
586
+ fontWeight: s == null ? void 0 : s.fontWeight,
587
+ fontStyle: s == null ? void 0 : s.fontStyle,
587
588
  fontSize: u("FontSize"),
588
589
  lineHeight: u("LineHeight"),
589
590
  letterSpacing: u("LetterSpacing"),
590
591
  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
592
+ textTransform: c == null ? void 0 : c.textTransform,
593
+ textDecoration: c == null ? void 0 : c.textDecoration,
594
+ fontVariant: c == null ? void 0 : c.fontVariant
594
595
  };
595
596
  }
596
597
  function Mt(t) {
597
598
  const e = t.type ?? "text";
598
599
  return e === "list" ? "listA" : e;
599
600
  }
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);
601
+ function Je(t, e, o, n) {
602
+ return t != null && t.grid && Array.isArray(t.placements) && t.placements.every((r) => typeof (r == null ? void 0 : r.top) == "number") ? Qe(Be(t, n), e) : Te(e.map(Mt), n, 1, o);
602
603
  }
603
- function Ke(t, e) {
604
+ function Qe(t, e) {
604
605
  const o = (n, r) => n.height !== void 0 && e[r] && Mt(e[r]) !== "image";
605
606
  return t.placements.some(o) ? {
606
607
  ...t,
607
608
  placements: t.placements.map((n, r) => {
608
609
  if (!o(n, r)) return n;
609
- const { height: u, ...c } = n;
610
- return c;
610
+ const { height: u, ...s } = n;
611
+ return s;
611
612
  })
612
613
  } : t;
613
614
  }
614
- function Je(t, e) {
615
+ function Pe(t, e) {
615
616
  const o = (n, r) => Math.abs(n - r) < 1e-4;
616
617
  return o(t.height, e.height) && t.heights.length === e.heights.length && t.heights.every((n, r) => o(n, e.heights[r]));
617
618
  }
618
- function wt(t, e) {
619
+ function yt(t, e) {
619
620
  const { columns: o } = t.grid, n = t.placements[e];
620
621
  if (!n) return { column: 0, span: Math.min(o, Math.max(1, Math.round(o / 4))), top: 0 };
621
622
  const r = Math.min(n.span, o), u = { column: Math.min(n.column, o - r), span: r, top: n.top };
622
623
  return typeof n.height == "number" ? { ...u, height: n.height } : u;
623
624
  }
624
- function Qe({
625
+ function to({
625
626
  settings: t,
626
627
  content: e = [],
627
628
  isEditor: o,
628
629
  isEditMode: n,
629
630
  isPreviewMode: r,
630
631
  layoutId: u,
631
- portalId: c,
632
- currentState: s,
633
- unavailableStates: d = [],
634
- onOpenChange: f,
635
- onUpdateSettings: w
632
+ portalId: s,
633
+ currentState: c,
634
+ unavailableStates: h = [],
635
+ onOpenChange: d,
636
+ onUpdateSettings: g
636
637
  }) {
637
638
  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);
639
+ const { prefix: a } = $e(), z = Z(() => Ke(a), [a]), [f, m] = U(!1), [x, R] = U(!1), [N, T] = U(!1), k = !!(o && !r), A = k && c === "open" && !h.includes("open"), S = A || !k && f, ct = je(t);
640
+ xe(S && !k), D(() => {
641
+ d == null || d(S);
642
+ }, [S, d]), D(() => {
643
+ m(!1);
644
+ }, [u]), D(() => {
645
+ if (S) {
646
+ R(!0);
646
647
  return;
647
648
  }
648
- N(!1);
649
- const i = window.setTimeout(() => A(!1), ct === "none" ? 0 : Y);
649
+ T(!1);
650
+ const i = window.setTimeout(() => R(!1), ct === "none" ? 0 : Y);
650
651
  return () => window.clearTimeout(i);
651
- }, [R, ct]), U(() => {
652
- if (!R || !v) return;
652
+ }, [S, ct]), D(() => {
653
+ if (!S || !x) return;
653
654
  const i = Q.current;
654
655
  i && getComputedStyle(i.querySelector("[role=dialog]") ?? i).opacity;
655
- const l = requestAnimationFrame(() => N(!0));
656
+ const l = requestAnimationFrame(() => T(!0));
656
657
  return () => cancelAnimationFrame(l);
657
- }, [R, v]), U(() => {
658
- if (!R || k) return;
658
+ }, [S, x]), D(() => {
659
+ if (!S || k) return;
659
660
  const i = (l) => {
660
- l.key === "Escape" && p(!1);
661
+ l.key === "Escape" && m(!1);
661
662
  };
662
663
  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 = {
664
+ }, [S, k]);
665
+ const _ = (i) => qt(i ?? 0, o), kt = _e(t), ot = (Ot = t.menuLayout) == null ? void 0 : Ot.grid, Ct = Se(t, ot != null && ot.columnWidth ? ot : Zt), st = `min(100%, ${_(Ae(t, Ct))})`, ut = _(t.popupOffset), ee = {
665
666
  left: `calc(0px + ${ut})`,
666
667
  center: `calc((100% - ${st}) / 2 + ${ut})`,
667
668
  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]
669
+ }[ze(t)], { columns: It, columnWidth: St, gutter: _t, rowGap: zt } = Ct, At = Z(
670
+ () => ({ columns: It, columnWidth: St, gutter: _t, rowGap: zt }),
671
+ [It, St, _t, zt]
671
672
  ), 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)}))`,
673
+ () => Je(t.menuLayout, e, kt, At),
674
+ [t.menuLayout, e, kt, At]
675
+ ), [ht, oe] = U(null), pt = Z(() => ht ? Vt(J, ht) : null, [J, ht]), I = Z(() => pt ? Ge(J, pt) : J, [J, pt]), { columns: F, gutter: dt, columnWidth: mt } = I.grid, ne = F * mt + (F - 1) * dt, gt = mt > 0 ? {
676
+ gridTemplateColumns: `repeat(${F}, minmax(0, ${_(mt)}))`,
676
677
  columnGap: _(dt),
677
678
  width: `min(100%, ${_(ne)})`,
678
679
  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
+ } : { gridTemplateColumns: `repeat(${F}, minmax(0, 1fr))`, columnGap: _(dt) }, Nt = t.triggerLabel || "Menu", nt = Ne(t.triggerPadding), V = t.triggerType === "icon" && !t.triggerIcon ? "burger" : t.triggerType ?? "text", re = tt(t, "trigger", o), ie = tt(t, "title", o), ae = {
680
681
  text: tt(t, "text", o),
681
682
  listA: tt(t, "listA", o, "text"),
682
683
  listB: tt(t, "listB", o, "text")
683
- }, W = ((Ht = t.stateOverrides) == null ? void 0 : Ht.open) ?? {}, Nt = {
684
+ }, O = ((Ht = t.stateOverrides) == null ? void 0 : Ht.open) ?? {}, Rt = {
684
685
  [`--${a}-trigger-bg`]: t.barBackgroundColor,
685
- [`--${a}-trigger-color`]: (R ? W.triggerColor : void 0) ?? t.triggerColor,
686
- [`--${a}-overlay-color`]: W.overlayColor ?? t.overlayColor,
686
+ [`--${a}-trigger-color`]: (S ? O.triggerColor : void 0) ?? t.triggerColor,
687
+ [`--${a}-overlay-color`]: O.overlayColor ?? t.overlayColor,
687
688
  [`--${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(() => {
689
+ [`--${a}-popup-bg`]: O.popupBackgroundColor ?? t.popupBackgroundColor,
690
+ [`--${a}-title-color`]: O.titleColor ?? t.titleColor,
691
+ [`--${a}-text-color`]: O.textColor ?? t.textColor,
692
+ [`--${a}-list-a-color`]: O.listAColor ?? t.listAColor,
693
+ [`--${a}-list-b-color`]: O.listBColor ?? t.listBColor
694
+ }, Tt = W(null), le = Z(() => {
694
695
  const i = Tt.current;
695
- if (!v || !o || !i) return;
696
+ if (!x || !o || !i) return;
696
697
  const l = getComputedStyle(i);
697
698
  return Object.fromEntries(
698
- Ue.map((h) => [h, l.getPropertyValue(h).trim()]).filter(([, h]) => h)
699
+ Ve.map((p) => [p, l.getPropertyValue(p).trim()]).filter(([, p]) => p)
699
700
  );
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
+ }, [x, o]), Q = W(null), Lt = W(null), Bt = W(null), ft = W(null), P = W([]), [B, ce] = U(null), $t = W(null), X = (i) => {
701
702
  $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);
703
+ }, G = !!(A && n && g), se = B ? Xt(I, B) : null;
704
+ D(() => {
705
+ G || X(null);
706
+ }, [G]);
707
+ const [bt, Et] = U(null);
707
708
  Ut(() => {
708
709
  const i = Lt.current;
709
- if (!v || !i) {
710
+ if (!x || !i) {
710
711
  Et(null);
711
712
  return;
712
713
  }
713
714
  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);
715
+ const w = Q.current;
716
+ if (!w) return;
717
+ const b = w.getBoundingClientRect(), $ = i.getBoundingClientRect(), M = { top: $.top - b.top, left: $.left - b.left, width: $.width, height: $.height };
718
+ Et((v) => v && v.top === M.top && v.left === M.left && v.width === M.width && v.height === M.height ? v : M);
718
719
  };
719
720
  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 });
721
+ const p = new ResizeObserver(l);
722
+ return p.observe(i), window.addEventListener("resize", l), window.addEventListener("scroll", l, { capture: !0, passive: !0 }), () => {
723
+ p.disconnect(), window.removeEventListener("resize", l), window.removeEventListener("scroll", l, { capture: !0 });
723
724
  };
724
- }, [v]), Ut(() => {
725
+ }, [x]), Ut(() => {
725
726
  const i = Bt.current, l = ft.current;
726
- if (!v || !i || !l) return;
727
- const h = () => {
727
+ if (!x || !i || !l) return;
728
+ const p = () => {
728
729
  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) / $;
730
+ const b = (M = Q.current) == null ? void 0 : M.getBoundingClientRect().width;
731
+ if (!b) return;
732
+ const $ = {
733
+ height: i.getBoundingClientRect().height / b,
734
+ heights: e.map((v, L) => {
735
+ var y;
736
+ return (((y = P.current[L]) == null ? void 0 : y.getBoundingClientRect().height) ?? 0) / b;
736
737
  })
737
738
  };
738
- oe((b) => b && Je(b, g) ? b : g);
739
+ oe((v) => v && Pe(v, $) ? v : $);
739
740
  };
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;
741
+ p();
742
+ const w = new ResizeObserver(p);
743
+ return w.observe(i), w.observe(l), P.current.slice(0, e.length).forEach((b) => b && w.observe(b)), () => w.disconnect();
744
+ }, [x, e]);
745
+ const Ft = () => {
746
+ const i = ft.current, l = i.getBoundingClientRect(), p = i.offsetWidth ? l.width / i.offsetWidth : 1, w = (parseFloat(getComputedStyle(i).columnGap) || 0) * p;
747
+ return { area: l, gap: w, pitch: (l.width + w) / F };
748
+ }, ue = (i, l, p) => {
749
+ var L, y;
750
+ if (!G || !I.placements[l] || i.button !== 0) return;
750
751
  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
+ const { area: w, pitch: b } = Ft(), $ = ((L = P.current[l]) == null ? void 0 : L.getBoundingClientRect()) ?? i.currentTarget.getBoundingClientRect(), M = ((y = Q.current) == null ? void 0 : y.getBoundingClientRect().width) || 1, v = yt(I, l);
752
753
  X({
753
754
  index: l,
754
755
  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,
756
+ handle: p,
757
+ grabColumn: Math.min(Math.max(Math.floor((i.clientX - w.left) / b) - v.column, 0), v.span - 1),
758
+ grabY: i.clientY - $.top,
758
759
  unit: M,
759
- start: b,
760
- placement: b,
761
- measure: Vt(C, {
762
- height: y.height / M,
763
- heights: e.map((D, rt) => {
760
+ start: v,
761
+ placement: v,
762
+ measure: Vt(I, {
763
+ height: w.height / M,
764
+ heights: e.map((H, rt) => {
764
765
  var E;
765
766
  return (((E = P.current[rt]) == null ? void 0 : E.getBoundingClientRect().height) ?? 0) / M;
766
767
  })
@@ -770,45 +771,45 @@ function Qe({
770
771
  const l = $t.current;
771
772
  if (!l || i.pointerId !== l.pointerId) return;
772
773
  i.stopPropagation();
773
- const { area: h, gap: y, pitch: $ } = Gt(), { start: g, measure: M, handle: b } = l, L = M.height;
774
- if (!b) {
774
+ const { area: p, gap: w, pitch: b } = Ft(), { start: $, measure: M, handle: v } = l, L = M.height;
775
+ if (!v) {
775
776
  X({
776
777
  ...l,
777
778
  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])
779
+ ...$,
780
+ column: Math.min(Math.max(Math.floor((i.clientX - p.left) / b) - l.grabColumn, 0), F - $.span),
781
+ top: K(I.grid, (i.clientY - l.grabY - p.top) / l.unit, L - M.heights[l.index])
781
782
  }
782
783
  });
783
784
  return;
784
785
  }
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);
786
+ const y = i.clientX - p.left, H = (i.clientY - p.top) / l.unit, rt = $.column + $.span;
787
+ let { column: E, span: it, top: j } = $, at = $.height;
788
+ if (v.includes("left") && (E = Math.min(Math.max(Math.round(y / b), 0), rt - 1), it = rt - E), v.includes("right") && (it = Math.min(Math.max(Math.round((y + w) / b), E + 1), F) - E), v.includes("top")) {
789
+ const jt = $.top + ($.height ?? M.heights[l.index] ?? 0);
790
+ j = K(I.grid, H, jt - wt(I.grid)), at = lt(I.grid, jt - j, L - j);
790
791
  }
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
+ v.includes("bottom") && (at = lt(I.grid, H - j, L - j)), X({ ...l, placement: at === void 0 ? { column: E, span: it, top: j } : { column: E, span: it, top: j, height: at } });
792
793
  }, pe = (i) => {
793
794
  const l = $t.current;
794
795
  if (!l || i.pointerId !== l.pointerId) return;
795
796
  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);
797
+ const p = Xt(I, l), w = p == null ? void 0 : p.placements[l.index];
798
+ p && w && !Ze(w, yt(I, l.index)) && (g == null || g({ ...t, menuLayout: p })), X(null);
798
799
  }, de = (i, l) => {
799
800
  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({
801
+ const p = I.placements[l];
802
+ if (!G || !p || p.height === void 0) return;
803
+ const { height: w, ...b } = p;
804
+ g == null || g({
804
805
  ...t,
805
- menuLayout: { ...C, edited: !0, placements: C.placements.map((g, M) => M === l ? $ : g) }
806
+ menuLayout: { ...I, edited: !0, placements: I.placements.map(($, M) => M === l ? b : $) }
806
807
  });
807
- }, vt = () => p(!1), me = (i) => {
808
+ }, vt = () => m(!1), me = (i) => {
808
809
  !k && i.target.closest("a") && vt();
809
810
  }, 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),
811
+ const p = Mt(i), w = (i.images ?? []).filter((y) => y == null ? void 0 : y.assetId), b = (B == null ? void 0 : B.index) === l, $ = b ? B.placement : yt(I, l), M = $.height !== void 0, v = G && (!B || b), L = (y) => ({
812
+ onPointerDown: (H) => ue(H, l, y),
812
813
  onPointerMove: he,
813
814
  onPointerUp: pe,
814
815
  onPointerCancel: () => X(null)
@@ -816,68 +817,68 @@ function Qe({
816
817
  return /* @__PURE__ */ q(
817
818
  "div",
818
819
  {
819
- className: `${a}-slot${$ ? ` ${a}-slot-dragged` : ""}`,
820
- style: { gridColumn: `${g.column + 1} / span ${g.span}` },
820
+ className: `${a}-slot${b ? ` ${a}-slot-dragged` : ""}`,
821
+ style: { gridColumn: `${$.column + 1} / span ${$.span}` },
821
822
  children: [
822
- /* @__PURE__ */ I("div", { className: `${a}-spacer`, style: { height: _(g.top) } }),
823
+ /* @__PURE__ */ C("div", { className: `${a}-spacer`, style: { height: _($.top) } }),
823
824
  /* @__PURE__ */ q("div", { className: `${a}-frame`, children: [
824
825
  /* @__PURE__ */ q(
825
826
  "div",
826
827
  {
827
- ref: (x) => {
828
- P.current[l] = x;
828
+ ref: (y) => {
829
+ P.current[l] = y;
829
830
  },
830
831
  className: [
831
- `${a}-block ${a}-block-${h}`,
832
+ `${a}-block ${a}-block-${p}`,
832
833
  M ? `${a}-block-sized` : "",
833
- $ ? `${a}-block-dragged` : "",
834
- $ && !se ? `${a}-block-invalid` : ""
834
+ b ? `${a}-block-dragged` : "",
835
+ b && !se ? `${a}-block-invalid` : ""
835
836
  ].filter(Boolean).join(" "),
836
- style: M ? { height: _(g.height) } : void 0,
837
- ...F ? L(null) : {},
837
+ style: M ? { height: _($.height) } : void 0,
838
+ ...G ? L(null) : {},
838
839
  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 : [] }) })
840
+ i.title && p !== "image" ? /* @__PURE__ */ C("div", { className: `${a}-block-title`, style: { ...ie, marginBottom: _(t.titleGap) }, children: i.title }) : null,
841
+ p === "image" ? /* @__PURE__ */ C(oo, { prefix: a, images: w, isRunning: S, radius: _(t.imageRadius) }) : /* @__PURE__ */ C("div", { className: `${a}-block-text`, style: ae[p], children: /* @__PURE__ */ C(we, { content: Array.isArray(i.text) ? i.text : [] }) })
841
842
  ]
842
843
  }
843
844
  ),
844
- b ? (h === "image" ? Ye : Ve).map((x) => /* @__PURE__ */ I(
845
+ v ? (p === "image" ? Xe : qe).map((y) => /* @__PURE__ */ C(
845
846
  "div",
846
847
  {
847
- className: `${a}-handle ${a}-handle-${x}${$ && B.handle === x ? ` ${a}-handle-active` : ""}`,
848
+ className: `${a}-handle ${a}-handle-${y}${b && B.handle === y ? ` ${a}-handle-active` : ""}`,
848
849
  "aria-hidden": !0,
849
- ...L(x),
850
- onDoubleClick: x.includes("top") || x.includes("bottom") ? (D) => de(D, l) : void 0
850
+ ...L(y),
851
+ onDoubleClick: y.includes("top") || y.includes("bottom") ? (H) => de(H, l) : void 0
851
852
  },
852
- x
853
+ y
853
854
  )) : null
854
855
  ] })
855
856
  ]
856
857
  },
857
858
  l
858
859
  );
859
- }, Ft = {
860
+ }, Gt = {
860
861
  ...V === "text" ? re : void 0,
861
862
  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,
863
+ [`--${a}-icon-size`]: _(t.triggerIconSize ?? Ye)
864
+ }, Wt = V === "text" ? Nt : /* @__PURE__ */ C("span", { className: `${a}-icon ${a}-icon-${V}`, "aria-hidden": !0, children: V === "icon" ? /* @__PURE__ */ C(
865
+ Me,
865
866
  {
866
867
  url: t.triggerIcon,
867
868
  fill: `var(--${a}-trigger-color)`,
868
869
  hoverFill: `var(--${a}-trigger-color)`,
869
870
  className: `${a}-icon-picture`
870
871
  }
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
+ ) : Array.from({ length: V === "burger" ? 3 : 2 }, (i, l) => /* @__PURE__ */ C("span", { className: `${a}-icon-line` }, l)) }), xt = I.grid.beat || et(I.grid), Dt = x ? /* @__PURE__ */ q(
872
873
  "div",
873
874
  {
874
875
  ref: Q,
875
876
  "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,
877
+ className: [`${a}-overlay`, `${a}-transition-${ct.replace(" ", "-")}`, o ? `${a}-overlay-editor` : "", N ? `${a}-overlay-active` : ""].filter(Boolean).join(" "),
878
+ style: { ...le, ...Rt },
879
+ "aria-hidden": !N,
879
880
  children: [
880
- /* @__PURE__ */ I(
881
+ /* @__PURE__ */ C(
881
882
  "button",
882
883
  {
883
884
  type: "button",
@@ -887,7 +888,7 @@ function Qe({
887
888
  onClick: k ? void 0 : vt
888
889
  }
889
890
  ),
890
- /* @__PURE__ */ I(
891
+ /* @__PURE__ */ C(
891
892
  "div",
892
893
  {
893
894
  ref: Bt,
@@ -907,11 +908,11 @@ function Qe({
907
908
  "div",
908
909
  {
909
910
  ref: ft,
910
- className: `${a}-grid${F ? ` ${a}-grid-editable` : ""}`,
911
+ className: `${a}-grid${G ? ` ${a}-grid-editable` : ""}`,
911
912
  style: gt,
912
913
  children: [
913
914
  e.map(ge),
914
- F ? /* @__PURE__ */ I(
915
+ G ? /* @__PURE__ */ C(
915
916
  "div",
916
917
  {
917
918
  className: `${a}-guides${xt > 0 ? ` ${a}-guides-beats` : ""}${B ? ` ${a}-guides-shown` : ""}`,
@@ -921,7 +922,7 @@ function Qe({
921
922
  [`--${a}-beat`]: xt > 0 ? _(xt) : void 0
922
923
  },
923
924
  "aria-hidden": !0,
924
- children: Array.from({ length: G }, (i, l) => /* @__PURE__ */ I("div", { className: `${a}-guide` }, l))
925
+ children: Array.from({ length: F }, (i, l) => /* @__PURE__ */ C("div", { className: `${a}-guide` }, l))
925
926
  }
926
927
  ) : null
927
928
  ]
@@ -929,19 +930,19 @@ function Qe({
929
930
  )
930
931
  }
931
932
  ),
932
- bt ? /* @__PURE__ */ I(
933
+ bt ? /* @__PURE__ */ C(
933
934
  "button",
934
935
  {
935
936
  type: "button",
936
937
  className: [
937
938
  `${a}-button ${a}-close`,
938
- z ? `${a}-button-open` : "",
939
+ N ? `${a}-button-open` : "",
939
940
  k ? `${a}-close-inert` : ""
940
941
  ].filter(Boolean).join(" "),
941
- style: { ...Ft, ...bt },
942
+ style: { ...Gt, ...bt },
942
943
  "aria-label": "Close menu",
943
- "aria-expanded": R,
944
- tabIndex: z ? void 0 : -1,
944
+ "aria-expanded": S,
945
+ tabIndex: N ? void 0 : -1,
945
946
  onClick: k ? void 0 : vt,
946
947
  children: Wt
947
948
  }
@@ -949,78 +950,118 @@ function Qe({
949
950
  ]
950
951
  }
951
952
  ) : 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(
953
+ return /* @__PURE__ */ q("div", { ref: Tt, className: `${a}-root`, style: Rt, "data-edit-mode": n ? "" : void 0, children: [
954
+ /* @__PURE__ */ C("style", { dangerouslySetInnerHTML: { __html: z } }),
955
+ /* @__PURE__ */ C(
955
956
  "button",
956
957
  {
957
958
  ref: Lt,
958
959
  type: "button",
959
960
  className: [
960
961
  `${a}-button`,
961
- R ? `${a}-button-open` : "",
962
+ S ? `${a}-button-open` : "",
962
963
  // the close button over the popup stands in for it while the popup shows
963
964
  bt ? `${a}-button-hidden` : ""
964
965
  ].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),
966
+ style: Gt,
967
+ "aria-expanded": S,
968
+ "aria-label": V === "text" ? void 0 : Nt,
969
+ onClick: k ? void 0 : () => m((i) => !i),
969
970
  children: Wt
970
971
  }
971
972
  ),
972
- Dt && typeof document < "u" ? fe(Dt, (c ? document.getElementById(c) : null) ?? document.body) : null
973
+ Dt && typeof document < "u" ? fe(Dt, (s ? document.getElementById(s) : null) ?? document.body) : null
973
974
  ] });
974
975
  }
975
- function Pe({ prefix: t, images: e, isRunning: o, radius: n }) {
976
- const [r, u] = j(0), c = e.length;
977
- return U(() => {
976
+ function eo(t) {
977
+ return t.type === "video" ? !0 : t.type ? !1 : /\.(mp4|webm|ogg|mov)(\?|$)/i.test(t.name || t.assetId);
978
+ }
979
+ function oo({ prefix: t, images: e, isRunning: o, radius: n }) {
980
+ const [r, u] = U(0), s = W([]), c = e.length;
981
+ return D(() => {
978
982
  if (!o || c < 2) {
979
983
  u(0);
980
984
  return;
981
985
  }
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({
986
+ const h = window.setInterval(() => u((d) => (d + 1) % c), Oe);
987
+ return () => window.clearInterval(h);
988
+ }, [o, c]), D(() => {
989
+ s.current.slice(0, c).forEach((h, d) => {
990
+ var g;
991
+ h && (o && d === r % c ? (g = h.play()) == null || g.catch(() => {
992
+ }) : h.pause());
993
+ });
994
+ }, [o, r, c, e]), /* @__PURE__ */ C("div", { className: `${t}-images`, children: e.map((h, d) => {
995
+ const g = d === r % c, a = `${t}-image${g ? "" : ` ${t}-image-hidden`}`, z = { borderRadius: n };
996
+ return be(h) ? /* @__PURE__ */ C(
997
+ ve,
998
+ {
999
+ className: a,
1000
+ media: h,
1001
+ fit: "cover",
1002
+ lazy: !1,
1003
+ silentLoop: !0,
1004
+ "aria-hidden": !g,
1005
+ style: z
1006
+ },
1007
+ d
1008
+ ) : eo(h) ? /* @__PURE__ */ C(
1009
+ "video",
1010
+ {
1011
+ ref: (f) => {
1012
+ s.current[d] = f;
1013
+ },
1014
+ className: a,
1015
+ src: h.assetId,
1016
+ autoPlay: o && g,
1017
+ muted: !0,
1018
+ loop: !0,
1019
+ playsInline: !0,
1020
+ "aria-hidden": !g,
1021
+ style: z
1022
+ },
1023
+ d
1024
+ ) : /* @__PURE__ */ C(
1025
+ "img",
1026
+ {
1027
+ className: a,
1028
+ src: h.assetId,
1029
+ alt: h.name ?? "",
1030
+ "aria-hidden": !g,
1031
+ style: z
1032
+ },
1033
+ d
1034
+ );
1035
+ }) });
1036
+ }
1037
+ const go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
997
1038
  __proto__: null,
998
1039
  POPUP_MENU_TRANSITIONS: te,
999
- POPUP_MENU_TRIGGER_TYPES: He,
1000
- PopupMenu: Qe
1040
+ POPUP_MENU_TRIGGER_TYPES: Ue,
1041
+ PopupMenu: to
1001
1042
  }, Symbol.toStringTag, { value: "Module" }));
1002
1043
  export {
1003
- Me as D,
1004
- ke as P,
1044
+ Ce as D,
1045
+ Ie as P,
1005
1046
  K as a,
1006
1047
  lt as b,
1007
- Ie as c,
1048
+ _e as c,
1008
1049
  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,
1050
+ Ae as e,
1051
+ Be as f,
1052
+ Te as g,
1053
+ Ne as h,
1054
+ Le as i,
1055
+ Se as j,
1015
1056
  Zt as k,
1016
- so as l,
1017
- Le as m,
1018
- ze as n,
1019
- ye as o,
1057
+ mo as l,
1058
+ Ee as m,
1059
+ Re as n,
1060
+ ke as o,
1020
1061
  te as p,
1021
- He as q,
1022
- Be as r,
1023
- Ee as s,
1024
- Qe as t,
1025
- uo as u
1062
+ Ue as q,
1063
+ Fe as r,
1064
+ Ge as s,
1065
+ to as t,
1066
+ go as u
1026
1067
  };