@solibo/solibo-ui 0.5.6 → 0.5.8

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 (41) hide show
  1. package/dist/assets/index.css +1 -1
  2. package/dist/assets/index10.css +1 -1
  3. package/dist/assets/index15.css +1 -1
  4. package/dist/assets/index16.css +1 -1
  5. package/dist/assets/index18.css +1 -1
  6. package/dist/assets/index2.css +1 -1
  7. package/dist/assets/index21.css +1 -1
  8. package/dist/assets/index24.css +1 -1
  9. package/dist/assets/index29.css +1 -1
  10. package/dist/assets/index31.css +1 -1
  11. package/dist/assets/index35.css +1 -1
  12. package/dist/assets/index38.css +1 -1
  13. package/dist/assets/index39.css +1 -1
  14. package/dist/components/_avatar/index.cjs +1 -1
  15. package/dist/components/_avatar/index.js +7 -7
  16. package/dist/components/_card/index.cjs +1 -1
  17. package/dist/components/_card/index.js +29 -29
  18. package/dist/components/_croppable/index.cjs +1 -1
  19. package/dist/components/_croppable/index.js +110 -110
  20. package/dist/components/_editor/index.cjs +1 -1
  21. package/dist/components/_editor/index.js +1 -1
  22. package/dist/components/_sortable/index.cjs +1 -1
  23. package/dist/components/_sortable/index.cjs.map +1 -1
  24. package/dist/components/_sortable/index.js +27 -27
  25. package/dist/components/_sortable/index.js.map +1 -1
  26. package/dist/components/badge/index.cjs +1 -1
  27. package/dist/components/badge/index.js +9 -9
  28. package/dist/components/button/index.cjs +1 -1
  29. package/dist/components/button/index.js +14 -14
  30. package/dist/components/file/index.cjs +1 -1
  31. package/dist/components/file/index.js +16 -16
  32. package/dist/components/icon/index.cjs +1 -1
  33. package/dist/components/icon/index.js +22 -22
  34. package/dist/components/loading/index.cjs +1 -1
  35. package/dist/components/loading/index.js +7 -7
  36. package/dist/components/message/index.cjs +1 -1
  37. package/dist/components/message/index.js +6 -6
  38. package/dist/components/toggle/index.cjs +1 -1
  39. package/dist/components/toggle/index.js +8 -8
  40. package/dist/tokens.json +1 -1
  41. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { jsxs as J, jsx as y } from "react/jsx-runtime";
2
- import { t as rt } from "../../classix-DG18itHa.js";
3
- import { useRef as w, useState as Z, useEffect as U } from "react";
4
- import { Button as yt } from "../button/index.js";
5
- import { Figure as wt } from "../figure/index.js";
6
- import { Icon as xt } from "../icon/index.js";
7
- import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_1yvyu_14", At = "_media_1yvyu_22", Dt = "_overlay_1yvyu_33", Wt = "_viewport_1yvyu_41", Ht = "_draggable_1yvyu_53", St = "_dragging_1yvyu_57", Zt = "_inner_1yvyu_61", jt = "_standalone_1yvyu_77", M = {
1
+ import { jsxs as J, jsx as w } from "react/jsx-runtime";
2
+ import { t as ot } from "../../classix-DG18itHa.js";
3
+ import { useRef as x, useState as Z, useEffect as U } from "react";
4
+ import { Button as wt } from "../button/index.js";
5
+ import { Figure as xt } from "../figure/index.js";
6
+ import { Icon as yt } from "../icon/index.js";
7
+ import '../../assets/index18.css';const Yt = "_croppable_2wdo8_1", Xt = "_empty_2wdo8_14", At = "_media_2wdo8_22", Dt = "_overlay_2wdo8_33", Wt = "_viewport_2wdo8_41", Ht = "_draggable_2wdo8_53", St = "_dragging_2wdo8_57", Zt = "_inner_2wdo8_61", jt = "_standalone_2wdo8_77", M = {
8
8
  croppable: Yt,
9
9
  empty: Xt,
10
10
  media: At,
@@ -20,20 +20,20 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
20
20
  y: 0
21
21
  },
22
22
  zoom: 1
23
- }, bt = "Select image", P = 10, j = 0.1, Bt = 0.92, d = (u, p, _) => Math.min(_, Math.max(p, u)), Nt = (u) => new Promise((p, _) => {
24
- const h = URL.createObjectURL(u), s = new globalThis.Image();
23
+ }, bt = "Select image", P = 10, j = 0.1, Bt = 0.92, h = (u, p, _) => Math.min(_, Math.max(p, u)), Nt = (u) => new Promise((p, _) => {
24
+ const d = URL.createObjectURL(u), s = new globalThis.Image();
25
25
  s.onload = () => {
26
- URL.revokeObjectURL(h), p(s);
26
+ URL.revokeObjectURL(d), p(s);
27
27
  }, s.onerror = () => {
28
- URL.revokeObjectURL(h), _(new Error("croppable-image-load-failed"));
29
- }, s.src = h;
28
+ URL.revokeObjectURL(d), _(new Error("croppable-image-load-failed"));
29
+ }, s.src = d;
30
30
  }), $t = async ({
31
31
  file: u,
32
32
  fill: p,
33
33
  transform: _,
34
- viewport: h
34
+ viewport: d
35
35
  }) => {
36
- const s = await Nt(u), Y = h.width / s.naturalWidth, v = h.height / s.naturalHeight, x = Math.max(Y, v), k = s.naturalWidth * x, R = s.naturalHeight * x, C = p === "width" ? Math.max(j, Y / x) : p === "height" ? Math.max(j, v / x) : j, L = d(_.zoom, C, P), g = x * L, b = k * L, F = R * L, m = (h.width - b) / 2 + _.offset.x, T = (h.height - F) / 2 + _.offset.y, X = d((0 - m) / g, 0, s.naturalWidth), E = d((0 - T) / g, 0, s.naturalHeight), O = d(h.width / g, 1, Math.max(1, s.naturalWidth - X)), c = d(h.height / g, 1, Math.max(1, s.naturalHeight - E)), z = document.createElement("canvas"), a = z.getContext("2d");
36
+ const s = await Nt(u), Y = d.width / s.naturalWidth, R = d.height / s.naturalHeight, y = Math.max(Y, R), k = s.naturalWidth * y, L = s.naturalHeight * y, C = p === "width" ? Math.max(j, Y / y) : p === "height" ? Math.max(j, R / y) : j, T = h(_.zoom, C, P), g = y * T, b = k * T, F = L * T, m = (d.width - b) / 2 + _.offset.x, v = (d.height - F) / 2 + _.offset.y, X = h((0 - m) / g, 0, s.naturalWidth), E = h((0 - v) / g, 0, s.naturalHeight), O = h(d.width / g, 1, Math.max(1, s.naturalWidth - X)), c = h(d.height / g, 1, Math.max(1, s.naturalHeight - E)), z = document.createElement("canvas"), a = z.getContext("2d");
37
37
  if (!a)
38
38
  throw new Error("croppable-image-context-missing");
39
39
  z.width = Math.max(1, Math.round(O)), z.height = Math.max(1, Math.round(c)), a.drawImage(s, X, E, O, c, 0, 0, z.width, z.height);
@@ -50,16 +50,16 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
50
50
  children: u,
51
51
  fill: p = "none",
52
52
  height: _,
53
- image: h,
53
+ image: d,
54
54
  label: s,
55
55
  onCroppableChange: Y,
56
- onFileChange: v,
57
- onImageChange: x,
56
+ onFileChange: R,
57
+ onImageChange: y,
58
58
  onTransformChange: k,
59
- transform: R,
59
+ transform: L,
60
60
  standalone: C
61
61
  }) => {
62
- const L = w(null), g = w(null), b = w(null), F = w(null), m = w(x), T = w(null), X = w(null), E = w(null), O = w(/* @__PURE__ */ new Map()), c = w($), z = w(null), [a, A] = Z(null), [D, G] = Z(null), [ot, tt] = Z(!1), [zt, ct] = Z($), [q, it] = Z(null), [f, Mt] = Z({
62
+ const T = x(null), g = x(null), b = x(null), F = x(null), m = x(y), v = x(null), X = x(null), E = x(null), O = x(/* @__PURE__ */ new Map()), c = x($), z = x(null), [a, A] = Z(null), [D, G] = Z(null), [rt, tt] = Z(!1), [zt, ct] = Z($), [q, it] = Z(null), [f, Mt] = Z({
63
63
  width: 0,
64
64
  height: 0
65
65
  }), B = (() => {
@@ -74,13 +74,13 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
74
74
  height: n,
75
75
  minZoom: j
76
76
  };
77
- const r = t / a.width, e = n / a.height, o = Math.max(r, e), i = p === "width" ? r / o : p === "height" ? e / o : 0;
77
+ const o = t / a.width, e = n / a.height, r = Math.max(o, e), i = p === "width" ? o / r : p === "height" ? e / r : 0;
78
78
  return {
79
- width: a.width * o,
80
- height: a.height * o,
79
+ width: a.width * r,
80
+ height: a.height * r,
81
81
  minZoom: Math.max(j, i)
82
82
  };
83
- })(), W = B.minZoom, N = R ?? zt, H = d(N.zoom, W, P), K = D ?? h ?? null, st = !u && !!h && !D && !q, Q = !st, at = u ?? (K ? /* @__PURE__ */ y("img", { alt: "", draggable: !1, onLoad: (t) => {
83
+ })(), W = B.minZoom, N = L ?? zt, H = h(N.zoom, W, P), K = D ?? d ?? null, st = !u && !!d && !D && !q, Q = !st, at = u ?? (K ? /* @__PURE__ */ w("img", { alt: "", draggable: !1, onLoad: (t) => {
84
84
  const n = t.currentTarget;
85
85
  n.naturalWidth && n.naturalHeight && A({
86
86
  width: n.naturalWidth,
@@ -88,78 +88,78 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
88
88
  });
89
89
  }, src: K }) : null), S = at == null, et = (t, n) => {
90
90
  const {
91
- maxX: r,
91
+ maxX: o,
92
92
  maxY: e
93
93
  } = ut(n);
94
94
  return {
95
- x: d(t.x, -r, r),
96
- y: d(t.y, -e, e)
95
+ x: h(t.x, -o, o),
96
+ y: h(t.y, -e, e)
97
97
  };
98
98
  }, lt = (t, n) => {
99
- const r = z.current;
100
- if (!r) return null;
101
- const e = r.getBoundingClientRect(), o = t - e.left - e.width / 2, i = n - e.top - e.height / 2;
99
+ const o = z.current;
100
+ if (!o) return null;
101
+ const e = o.getBoundingClientRect(), r = t - e.left - e.width / 2, i = n - e.top - e.height / 2;
102
102
  return {
103
- x: o,
103
+ x: r,
104
104
  y: i
105
105
  };
106
- }, _t = (t, n, r, e) => {
107
- const o = d(n, W, P), i = d(r, W, P);
108
- if (o === 0) return t;
109
- const l = i / o;
106
+ }, _t = (t, n, o, e) => {
107
+ const r = h(n, W, P), i = h(o, W, P);
108
+ if (r === 0) return t;
109
+ const l = i / r;
110
110
  return {
111
111
  x: (1 - l) * e.x + l * t.x,
112
112
  y: (1 - l) * e.y + l * t.y
113
113
  };
114
- }, vt = (t, n, r) => {
115
- const e = c.current.zoom, o = d(t, W, P), i = c.current.offset, l = r ? _t(i, e, o, r) : n, I = et(l, o);
114
+ }, Rt = (t, n, o) => {
115
+ const e = c.current.zoom, r = h(t, W, P), i = c.current.offset, l = o ? _t(i, e, r, o) : n, I = et(l, r);
116
116
  c.current = {
117
- zoom: o,
117
+ zoom: r,
118
118
  offset: I
119
- }, R || ct({
120
- zoom: o,
119
+ }, L || ct({
120
+ zoom: r,
121
121
  offset: I
122
122
  }), k == null || k({
123
- zoom: o,
123
+ zoom: r,
124
124
  offset: I
125
125
  });
126
- }, V = (t, n, r) => {
126
+ }, V = (t, n, o) => {
127
127
  X.current = {
128
128
  zoom: t,
129
129
  offset: n,
130
- anchor: r ?? null
130
+ anchor: o ?? null
131
131
  }, g.current == null && (g.current = window.requestAnimationFrame(() => {
132
132
  g.current = null;
133
133
  const e = X.current;
134
134
  X.current = null;
135
- const o = (e == null ? void 0 : e.zoom) ?? c.current.zoom, i = (e == null ? void 0 : e.offset) ?? c.current.offset, l = (e == null ? void 0 : e.anchor) ?? null;
136
- vt(o, i, l);
135
+ const r = (e == null ? void 0 : e.zoom) ?? c.current.zoom, i = (e == null ? void 0 : e.offset) ?? c.current.offset, l = (e == null ? void 0 : e.anchor) ?? null;
136
+ Rt(r, i, l);
137
137
  }));
138
- }, Rt = (t) => {
138
+ }, Lt = (t) => {
139
139
  if (S || !Q) return;
140
- const n = t.ctrlKey ? 1e-3 : 25e-5, r = c.current.zoom * Math.exp(-t.deltaY * n), e = lt(t.clientX, t.clientY);
141
- V(r, c.current.offset, e);
140
+ const n = t.ctrlKey ? 1e-3 : 25e-5, o = c.current.zoom * Math.exp(-t.deltaY * n), e = lt(t.clientX, t.clientY);
141
+ V(o, c.current.offset, e);
142
142
  }, ut = (t) => {
143
- const n = f.width, r = f.height;
144
- if (!n || !r) return {
143
+ const n = f.width, o = f.height;
144
+ if (!n || !o) return {
145
145
  maxX: 0,
146
146
  maxY: 0
147
147
  };
148
- const e = d(t, W, P), o = B.width * e, i = B.height * e, l = Math.max(0, (o - n) / 2), I = Math.max(0, (i - r) / 2);
148
+ const e = h(t, W, P), r = B.width * e, i = B.height * e, l = Math.max(0, (r - n) / 2), I = Math.max(0, (i - o) / 2);
149
149
  return {
150
150
  maxX: l,
151
151
  maxY: I
152
152
  };
153
- }, Lt = (t) => {
154
- var o;
155
- const n = t.target, r = ((o = n.files) == null ? void 0 : o[0]) ?? null;
156
- if (T.current && (URL.revokeObjectURL(T.current), T.current = null), !r) {
157
- G(null), it(null), v == null || v(null), n.value = "";
153
+ }, Tt = (t) => {
154
+ var r;
155
+ const n = t.target, o = ((r = n.files) == null ? void 0 : r[0]) ?? null;
156
+ if (v.current && (URL.revokeObjectURL(v.current), v.current = null), !o) {
157
+ G(null), it(null), R == null || R(null), n.value = "";
158
158
  return;
159
159
  }
160
- const e = URL.createObjectURL(r);
161
- T.current = e, G(e), A(null), it(r), V($.zoom, $.offset), c.current = $, v == null || v(r), n.value = "";
162
- }, Tt = (t) => {
160
+ const e = URL.createObjectURL(o);
161
+ v.current = e, G(e), A(null), it(o), V($.zoom, $.offset), c.current = $, R == null || R(o), n.value = "";
162
+ }, vt = (t) => {
163
163
  if (!(S || !Q || t.pointerType === "mouse" && t.button !== 0)) {
164
164
  if (t.currentTarget.setPointerCapture(t.pointerId), t.pointerType === "touch") {
165
165
  const n = O.current;
@@ -167,13 +167,13 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
167
167
  x: t.clientX,
168
168
  y: t.clientY
169
169
  }), n.size === 2) {
170
- b.current = null, L.current = null, tt(!1);
171
- const [r, e] = Array.from(n.values());
172
- E.current = Math.hypot(r.x - e.x, r.y - e.y);
170
+ b.current = null, T.current = null, tt(!1);
171
+ const [o, e] = Array.from(n.values());
172
+ E.current = Math.hypot(o.x - e.x, o.y - e.y);
173
173
  return;
174
174
  }
175
175
  }
176
- L.current = t.pointerId, b.current = {
176
+ T.current = t.pointerId, b.current = {
177
177
  x: t.clientX,
178
178
  y: t.clientY,
179
179
  originX: c.current.offset.x,
@@ -183,13 +183,13 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
183
183
  }, Et = (t) => {
184
184
  if (S || !Q) return;
185
185
  if (t.pointerType === "touch") {
186
- const o = O.current;
187
- if (!o.has(t.pointerId)) return;
188
- if (o.set(t.pointerId, {
186
+ const r = O.current;
187
+ if (!r.has(t.pointerId)) return;
188
+ if (r.set(t.pointerId, {
189
189
  x: t.clientX,
190
190
  y: t.clientY
191
- }), o.size === 2) {
192
- const [i, l] = Array.from(o.values()), I = i.x - l.x, Ut = i.y - l.y, pt = Math.hypot(I, Ut), gt = {
191
+ }), r.size === 2) {
192
+ const [i, l] = Array.from(r.values()), I = i.x - l.x, Ut = i.y - l.y, pt = Math.hypot(I, Ut), gt = {
193
193
  x: (i.x + l.x) / 2,
194
194
  y: (i.y + l.y) / 2
195
195
  };
@@ -201,65 +201,65 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
201
201
  return;
202
202
  }
203
203
  }
204
- if (L.current !== t.pointerId || !b.current || !nt) return;
205
- const n = t.clientX - b.current.x, r = t.clientY - b.current.y, e = Math.abs(n) + Math.abs(r);
206
- !ot && e > 2 && tt(!0), !(e <= 1) && V(c.current.zoom, {
204
+ if (T.current !== t.pointerId || !b.current || !nt) return;
205
+ const n = t.clientX - b.current.x, o = t.clientY - b.current.y, e = Math.abs(n) + Math.abs(o);
206
+ !rt && e > 2 && tt(!0), !(e <= 1) && V(c.current.zoom, {
207
207
  x: b.current.originX + n,
208
- y: b.current.originY + r
208
+ y: b.current.originY + o
209
209
  });
210
- }, ht = (t) => {
211
- t.pointerType === "touch" && (O.current.delete(t.pointerId), O.current.size < 2 && (E.current = null)), L.current === t.pointerId && (L.current = null, b.current = null, tt(!1));
210
+ }, dt = (t) => {
211
+ t.pointerType === "touch" && (O.current.delete(t.pointerId), O.current.size < 2 && (E.current = null)), T.current === t.pointerId && (T.current = null, b.current = null, tt(!1));
212
212
  };
213
213
  U(() => {
214
- if (!R) return;
215
- const t = d(R.zoom, W, P);
214
+ if (!L) return;
215
+ const t = h(L.zoom, W, P);
216
216
  c.current = {
217
217
  zoom: t,
218
- offset: et(R.offset, t)
218
+ offset: et(L.offset, t)
219
219
  };
220
- }, [R, f.width, f.height, a == null ? void 0 : a.width, a == null ? void 0 : a.height]), U(() => () => {
221
- T.current && URL.revokeObjectURL(T.current);
220
+ }, [L, f.width, f.height, a == null ? void 0 : a.width, a == null ? void 0 : a.height]), U(() => () => {
221
+ v.current && URL.revokeObjectURL(v.current);
222
222
  }, []), U(() => {
223
223
  const t = z.current;
224
224
  if (!t) return;
225
225
  const n = () => {
226
- const o = t.getBoundingClientRect();
227
- Mt((i) => i.width === o.width && i.height === o.height ? i : {
228
- width: o.width,
229
- height: o.height
230
- }), Y && Y(o);
226
+ const r = t.getBoundingClientRect();
227
+ Mt((i) => i.width === r.width && i.height === r.height ? i : {
228
+ width: r.width,
229
+ height: r.height
230
+ }), Y && Y(r);
231
231
  };
232
232
  n();
233
- const r = () => n();
234
- if (window.addEventListener("scroll", r, !0), typeof ResizeObserver > "u") {
235
- const o = () => n();
236
- return window.addEventListener("resize", o), () => {
237
- window.removeEventListener("resize", o), window.removeEventListener("scroll", r, !0);
233
+ const o = () => n();
234
+ if (window.addEventListener("scroll", o, !0), typeof ResizeObserver > "u") {
235
+ const r = () => n();
236
+ return window.addEventListener("resize", r), () => {
237
+ window.removeEventListener("resize", r), window.removeEventListener("scroll", o, !0);
238
238
  };
239
239
  }
240
240
  const e = new ResizeObserver(() => n());
241
241
  return e.observe(t), () => {
242
- e.disconnect(), window.removeEventListener("scroll", r, !0);
242
+ e.disconnect(), window.removeEventListener("scroll", o, !0);
243
243
  };
244
244
  }, [Y]), U(() => {
245
- if (R) return;
245
+ if (L) return;
246
246
  const t = c.current.offset, n = et(t, H);
247
247
  t.x === n.x && t.y === n.y || (c.current = {
248
248
  zoom: c.current.zoom,
249
249
  offset: n
250
- }, ct((r) => ({
251
- ...r,
250
+ }, ct((o) => ({
251
+ ...o,
252
252
  offset: n
253
253
  })));
254
254
  }, [H, a, f.width, f.height]), U(() => {
255
255
  K || A(null);
256
256
  }, [K]), U(() => {
257
- m.current = x;
258
- }, [x]), U(() => {
259
- var r;
260
- if (!x) return;
257
+ m.current = y;
258
+ }, [y]), U(() => {
259
+ var o;
260
+ if (!y) return;
261
261
  if (!q || !f.width || !f.height || u) {
262
- (r = m.current) == null || r.call(m, null);
262
+ (o = m.current) == null || o.call(m, null);
263
263
  return;
264
264
  }
265
265
  let t = !0;
@@ -273,8 +273,8 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
273
273
  },
274
274
  viewport: f
275
275
  }).then((e) => {
276
- var o;
277
- t && ((o = m.current) == null || o.call(m, e));
276
+ var r;
277
+ t && ((r = m.current) == null || r.call(m, e));
278
278
  }).catch(() => {
279
279
  var e;
280
280
  t && ((e = m.current) == null || e.call(m, null));
@@ -286,17 +286,17 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
286
286
  }, [u, H, N.offset, p, q, f]), U(() => () => {
287
287
  g.current != null && (window.cancelAnimationFrame(g.current), g.current = null);
288
288
  }, []);
289
- const dt = ut(H), nt = !S && Q && (dt.maxX > 0 || dt.maxY > 0), mt = () => {
289
+ const ht = ut(H), nt = !S && Q && (ht.maxX > 0 || ht.maxY > 0), mt = () => {
290
290
  var t;
291
291
  return (t = F.current) == null ? void 0 : t.click();
292
292
  }, ft = (t) => {
293
293
  t.preventDefault(), t.stopPropagation(), mt();
294
294
  };
295
- return /* @__PURE__ */ J("div", { className: rt(M.croppable, C && M.standalone), onClick: () => {
295
+ return /* @__PURE__ */ J("div", { className: ot(M.croppable, C && M.standalone), onClick: () => {
296
296
  S && mt();
297
297
  }, "data-component": "croppable", children: [
298
- /* @__PURE__ */ y("input", { accept: "image/*", onChange: Lt, ref: F, type: "file" }),
299
- /* @__PURE__ */ y("div", { className: M.viewport, ref: z, onDragStart: (t) => t.preventDefault(), onPointerDown: Tt, onPointerMove: Et, onPointerUp: ht, onPointerCancel: ht, onWheel: Rt, style: {
298
+ /* @__PURE__ */ w("input", { accept: "image/*", onChange: Tt, ref: F, type: "file" }),
299
+ /* @__PURE__ */ w("div", { className: M.viewport, ref: z, onDragStart: (t) => t.preventDefault(), onPointerDown: vt, onPointerMove: Et, onPointerUp: dt, onPointerCancel: dt, onWheel: Lt, style: {
300
300
  "--croppable-height": `${_ ?? kt}px`,
301
301
  "--croppable-zoom": H,
302
302
  "--croppable-x": `${N.offset.x}px`,
@@ -306,13 +306,13 @@ import '../../assets/index18.css';const Yt = "_croppable_1yvyu_1", Xt = "_empty_
306
306
  "--croppable-image-height": `${B.height}px`
307
307
  } : null
308
308
  }, children: S ? /* @__PURE__ */ J("div", { className: M.empty, children: [
309
- /* @__PURE__ */ y(wt, { children: /* @__PURE__ */ y(xt, { name: "image", size: "large" }) }),
310
- /* @__PURE__ */ y(yt, { onClick: ft, children: s ?? bt })
311
- ] }) : /* @__PURE__ */ J("div", { className: rt(M.media, nt && M.draggable, nt && ot && M.dragging), children: [
312
- /* @__PURE__ */ y("div", { className: rt(M.inner), children: at }),
313
- st && /* @__PURE__ */ y("div", { className: M.overlay, children: /* @__PURE__ */ J("div", { className: M.empty, children: [
314
- /* @__PURE__ */ y(wt, { children: /* @__PURE__ */ y(xt, { name: "image", size: "large" }) }),
315
- /* @__PURE__ */ y(yt, { onClick: ft, children: s ?? bt })
309
+ /* @__PURE__ */ w(xt, { children: /* @__PURE__ */ w(yt, { name: "image", size: "large" }) }),
310
+ /* @__PURE__ */ w(wt, { onClick: ft, children: s ?? bt })
311
+ ] }) : /* @__PURE__ */ J("div", { className: ot(M.media, nt && M.draggable, nt && rt && M.dragging), children: [
312
+ /* @__PURE__ */ w("div", { className: ot(M.inner), children: at }),
313
+ st && /* @__PURE__ */ w("div", { className: M.overlay, children: /* @__PURE__ */ J("div", { className: M.empty, children: [
314
+ /* @__PURE__ */ w(xt, { children: /* @__PURE__ */ w(yt, { name: "image", size: "large" }) }),
315
+ /* @__PURE__ */ w(wt, { onClick: ft, children: s ?? bt })
316
316
  ] }) })
317
317
  ] }) })
318
318
  ] });
@@ -54,5 +54,5 @@ vulnerable to XSS attacks. Please remove it from \`allowedTags\`.
54
54
  Or, to disable this warning, add the \`allowVulnerableTags\` option
55
55
  and ensure you are accounting for this risk.
56
56
 
57
- `)});const o=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},Xt(e.allowedAttributes,function(_,O){a[O]=[];const N=[];_.forEach(function(q){typeof q=="string"&&q.indexOf("*")>=0?N.push(Sa(q).replace(/\\\*/g,".*")):a[O].push(q)}),N.length&&(l[O]=new RegExp("^("+N.join("|")+")$"))}));const f={},h={},c={};Xt(e.allowedClasses,function(_,O){if(a&&(Ye(a,O)||(a[O]=[]),a[O].push("class")),f[O]=_,Array.isArray(_)){const N=[];f[O]=[],c[O]=[],_.forEach(function(q){typeof q=="string"&&q.indexOf("*")>=0?N.push(Sa(q).replace(/\\\*/g,".*")):q instanceof RegExp?c[O].push(q):f[O].push(q)}),N.length&&(h[O]=new RegExp("^("+N.join("|")+")$"))}});const d={};let p;Xt(e.transformTags,function(_,O){let N;typeof _=="function"?N=_:typeof _=="string"&&(N=Gn.simpleTransform(_)),O==="*"?p=N:d[O]=N});let m,g,y,b,x,w,T=!1;I();const S=new w1.Parser({onopentag:function(_,O){if(e.onOpenTag&&e.onOpenTag(_,O),e.enforceHtmlBoundary&&_==="html"&&I(),x){w++;return}const N=new i(_,O);g.push(N);let q=!1;const R=!!N.text;let V;if(Ye(d,_)&&(V=d[_](_,O),N.attribs=O=V.attribs,V.text!==void 0&&(N.innerText=V.text),_!==V.tagName&&(N.name=_=V.tagName,b[m]=V.tagName)),p&&(V=p(_,O),N.attribs=O=V.attribs,_!==V.tagName&&(N.name=_=V.tagName,b[m]=V.tagName)),(!s(_)||e.disallowedTagsMode==="recursiveEscape"&&!N1(y)||e.nestingLimit!=null&&m>=e.nestingLimit)&&(q=!0,y[m]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&o.indexOf(_)!==-1&&(x=!0,w=1)),m++,q){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(N.innerText&&!R){const K=C(N.innerText);e.textFilter?r+=e.textFilter(K,_):r+=K,T=!0}return}u=r,r=""}r+="<"+_,_==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(N.innerText=""),q&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?Xt(O,function(K,J){r+=" "+J+'="'+C(K||"",!0)+'"'}):(!a||Ye(a,_)||a["*"])&&Xt(O,function(K,J){if(!I1.test(J)){delete N.attribs[J];return}if(K===""&&!e.allowedEmptyAttributes.includes(J)&&(e.nonBooleanAttributes.includes(J)||e.nonBooleanAttributes.includes("*"))){delete N.attribs[J];return}let Ie=!1;if(!a||Ye(a,_)&&a[_].indexOf(J)!==-1||a["*"]&&a["*"].indexOf(J)!==-1||Ye(l,_)&&l[_].test(J)||l["*"]&&l["*"].test(J))Ie=!0;else if(a&&a[_]){for(const H of a[_])if(S1(H)&&H.name&&H.name===J){Ie=!0;let Q="";if(H.multiple===!0){const we=K.split(" ");for(const ge of we)H.values.indexOf(ge)!==-1&&(Q===""?Q=ge:Q+=" "+ge)}else H.values.indexOf(K)>=0&&(Q=K);K=Q}}if(Ie){if(e.allowedSchemesAppliedToAttributes.indexOf(J)!==-1&&L(_,K)){delete N.attribs[J];return}if(_==="script"&&J==="src"){let H=!0;try{const Q=U(K);if(e.allowedScriptHostnames||e.allowedScriptDomains){const we=(e.allowedScriptHostnames||[]).find(function(me){return me===Q.url.hostname}),ge=(e.allowedScriptDomains||[]).find(function(me){return Q.url.hostname===me||Q.url.hostname.endsWith(`.${me}`)});H=we||ge}}catch{H=!1}if(!H){delete N.attribs[J];return}}if(_==="iframe"&&J==="src"){let H=!0;try{const Q=U(K);if(Q.isRelativeUrl)H=Ye(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const we=(e.allowedIframeHostnames||[]).find(function(me){return me===Q.url.hostname}),ge=(e.allowedIframeDomains||[]).find(function(me){return Q.url.hostname===me||Q.url.hostname.endsWith(`.${me}`)});H=we||ge}}catch{H=!1}if(!H){delete N.attribs[J];return}}if(J==="srcset")try{let H=T1(K);if(H.forEach(function(Q){L("srcset",Q.url)&&(Q.evil=!0)}),H=Ca(H,function(Q){return!Q.evil}),H.length)K=A1(Ca(H,function(Q){return!Q.evil})),N.attribs[J]=K;else{delete N.attribs[J];return}}catch{delete N.attribs[J];return}if(J==="class"){const H=f[_],Q=f["*"],we=h[_],ge=c[_],me=c["*"],d0=h["*"],Bs=[we,d0].concat(ge,me).filter(function(h0){return h0});if(H&&Q?K=B(K,Ta(H,Q),Bs):K=B(K,H||Q,Bs),!K.length){delete N.attribs[J];return}}if(J==="style"){if(e.parseStyleAttributes)try{const H=C1(_+" {"+K+"}",{map:!1}),Q=v(H,e.allowedStyles);if(K=k(Q),K.length===0){delete N.attribs[J];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+_+" {"+K+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete N.attribs[J];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+J,K&&K.length?r+='="'+C(K,!0)+'"':e.allowedEmptyAttributes.includes(J)&&(r+='=""')}else delete N.attribs[J]}),e.selfClosing.indexOf(_)!==-1?r+=" />":(r+=">",N.innerText&&!R&&!e.textFilter&&(r+=C(N.innerText),T=!0)),q&&(r=u+C(r),u=""),N.openingTagLength=r.length-N.tagPosition},ontext:function(_){if(x)return;const O=g[g.length-1];let N;if(O&&(N=O.tag,_=O.innerText!==void 0?O.innerText:_),e.disallowedTagsMode==="completelyDiscard"&&!s(N))_="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(N==="script"||N==="style"))r+=_;else if(!T){const q=C(_,!1);e.textFilter?r+=e.textFilter(q,N):r+=q}if(g.length){const q=g[g.length-1];q.text+=_}},onclosetag:function(_,O){if(e.onCloseTag&&e.onCloseTag(_,O),x)if(w--,!w)x=!1;else return;const N=g.pop();if(!N)return;if(N.tag!==_){g.push(N);return}x=e.enforceHtmlBoundary?_==="html":!1,m--;const q=y[m];if(q){if(delete y[m],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){N.updateParentNodeText();return}u=r,r=""}if(b[m]&&(_=b[m],delete b[m]),e.exclusiveFilter){const R=e.exclusiveFilter(N);if(R==="excludeTag"){q&&(r=u,u=""),r=r.substring(0,N.tagPosition)+r.substring(N.tagPosition+N.openingTagLength);return}else if(R){r=r.substring(0,N.tagPosition);return}}if(N.updateParentNodeMediaChildren(),N.updateParentNodeText(),e.selfClosing.indexOf(_)!==-1||O&&!s(_)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){q&&(r=u,u="");return}r+="</"+_+">",q&&(r=u+C(r),u=""),T=!1}},e.parser);if(S.write(n),S.end(),e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape"){const _=S.endIndex;if(_!=null&&_>=0&&_<n.length){const O=n.substring(_);r+=C(O)}else(_==null||_<0)&&n.length>0&&r===""&&(r=C(n))}return r;function I(){r="",m=0,g=[],y={},b={},x=!1,w=0}function C(_,O){return typeof _!="string"&&(_=_+""),e.parser.decodeEntities&&(_=_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),O&&(_=_.replace(/"/g,"&quot;"))),_=_.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),O&&(_=_.replace(/"/g,"&quot;")),_}function L(_,O){for(O=O.replace(/[\x00-\x20]+/g,"");;){const R=O.indexOf("<!--");if(R===-1)break;const V=O.indexOf("-->",R+4);if(V===-1)break;O=O.substring(0,R)+O.substring(V+3)}const N=O.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!N)return O.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const q=N[1].toLowerCase();return Ye(e.allowedSchemesByTag,_)?e.allowedSchemesByTag[_].indexOf(q)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(q)===-1}function U(_){if(_=_.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),_.startsWith("relative:"))throw new Error("relative: exploit attempt");let O="relative://relative-site";for(let R=0;R<100;R++)O+=`/${R}`;const N=new URL(_,O);return{isRelativeUrl:N&&N.hostname==="relative-site"&&N.protocol==="relative:",url:N}}function v(_,O){if(!O)return _;const N=_.nodes[0];let q;return O[N.selector]&&O["*"]?q=Ta(O[N.selector],O["*"]):q=O[N.selector]||O["*"],q&&(_.nodes[0].nodes=N.nodes.reduce(A(q),[])),_}function k(_){return _.nodes[0].nodes.reduce(function(O,N){return O.push(`${N.prop}:${N.value}${N.important?" !important":""}`),O},[]).join(";")}function A(_){return function(O,N){return Ye(_,N.prop)&&_[N.prop].some(function(R){return R.test(N.value)})&&O.push(N),O}}function B(_,O,N){return O?(_=_.split(/\s+/),_.filter(function(q){return O.indexOf(q)!==-1||N.some(function(R){return R.test(q)})}).join(" ")):_}}const P1={decodeEntities:!0};Gn.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};Gn.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,u){let i;if(t)for(i in e)u[i]=e[i];else u=e;return{tagName:n,attribs:u}}};const L1=ah(O1),f0=fn();class dr extends Cl{constructor(t,r,u,i,s){super(s);mn(this,"__src");mn(this,"__alt");mn(this,"__width");mn(this,"__height");this.__src=t,this.__alt=r,this.__width=u,this.__height=i}static getType(){return"image"}static clone(t){return new dr(t.__src,t.__alt,t.__width,t.__height,t.__key)}static importJSON(t){return zi({alt:t.alt,height:t.height,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:r=>{if(!(r instanceof HTMLImageElement))return null;const u=r.getAttribute("src")??"";if(!u)return null;const i=r.getAttribute("width"),s=r.getAttribute("height");return{node:zi({alt:r.getAttribute("alt")??"",height:s?Number(s):void 0,src:u,width:i?Number(i):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const r=this.getWritable();return r.__src=t,r}decorate(t){return W.jsx("img",{alt:this.__alt,height:this.__height,onClick:r=>{r.preventDefault(),t.dispatchCommand(f0,{key:this.getKey(),src:this.__src})},src:this.__src,width:this.__width})}}function zi({alt:n="",height:e,src:t,width:r}){return new dr(t,n,r,e)}function Ea(n){return n instanceof dr}const D1="_editor_nvulc_1",M1="_meta_nvulc_19",R1="_active_nvulc_27",B1="_bold_nvulc_39",F1="_italic_nvulc_43",j1="_link_nvulc_47",q1="_list_nvulc_53",U1="_paragraph_nvulc_54",Ue={editor:D1,meta:M1,active:R1,bold:B1,italic:F1,link:j1,list:q1,paragraph:U1},z1=()=>{const[n]=Ae(),[e,t]=z.useState(!1),[r,u]=z.useState(!1),[i,s]=z.useState(!1),[o,a]=z.useState(!1),[l,f]=z.useState(!1),[h,c]=z.useState(""),[d,p]=z.useState(null),[m,g]=z.useState(""),y=z.useRef(null),b=z.useRef(null),x=z.useRef(null),w=z.useRef(!1),T=R=>R.preventDefault(),S=z.useCallback(R=>{x.current=P(R)?R.clone():null},[]),I=z.useCallback(R=>{n.update(()=>{x.current&&ke(x.current)}),R(),x.current=null},[n]),C=R=>{w.current=!0,R.preventDefault()},L=()=>{if(w.current){w.current=!1;return}_()},U=z.useCallback(()=>{u(!1),c(""),p(null)},[]),v=z.useCallback(()=>{a(!1),g("")},[]),k=z.useCallback(R=>{u(!0),c((R==null?void 0:R.src)??""),p((R==null?void 0:R.key)??null),v(),setTimeout(()=>{var V;return(V=y.current)==null?void 0:V.focus()},0)},[v]),A=z.useCallback(R=>{n.getEditorState().read(()=>{S(j())}),a(!0),g(R),U(),setTimeout(()=>{var V;return(V=b.current)==null?void 0:V.focus()},0)},[U,n,S]),B=z.useCallback(()=>{I(()=>{n.dispatchCommand(nn,{url:m,target:"_blank"})}),v()},[v,n,m,I]),_=z.useCallback(()=>{const R=h.trim();if(!R){U();return}n.update(()=>{if(d){const V=ae(d);Ea(V)&&V.setSrc(R);return}fs([zi({src:R})])}),U()},[U,n,d,h]),O=z.useCallback(()=>{if(!d){U();return}n.update(()=>{const R=ae(d);if(Ea(R)){const V=R.getParent();Bt(V)&&V.getChildrenSize()===1?V.remove():R.remove()}}),U()},[U,n,d]),N=z.useCallback(()=>{I(()=>{n.dispatchCommand(nn,null)}),v()},[v,n,I]),q=z.useCallback(()=>{const R=j();if(!P(R)){if(Ee(R)){const ft=R.getNodes(),K=ft[0]??null,J=(K==null?void 0:K.getParent())??null;t(ft.some(H=>D(H)&&H.hasFormat("bold"))),s(ft.some(H=>D(H)&&H.hasFormat("italic"))),f(Z(J)||re(J)||Z(K)||re(K));const Ie=tt(K)?K:tt(J)?J:null;if(Ie){a(!0),g(Ie.getURL());return}a(!1),g(""),x.current=null;return}t(!1),s(!1),f(!1),a(!1),g(""),x.current=null;return}const[V]=R.getNodes(),Oe=(V==null?void 0:V.getParent())??null;if(t(R.hasFormat("bold")),s(R.hasFormat("italic")),f(Z(Oe)||re(Oe)),tt(Oe)){a(!0),g(Oe.getURL()),S(R);return}a(!1),g(""),x.current=null},[S]);return z.useEffect(()=>at(n.registerUpdateListener(({editorState:R})=>{R.read(()=>{q()})}),n.registerCommand(f0,R=>(k(R),!0),nt),n.registerCommand(du,()=>(n.getEditorState().read(()=>{q()}),!1),nt)),[n,k,q]),W.jsxs(m0.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[W.jsx(Ke.Button,{"aria-label":"Bold","data-active":e,onClick:()=>{n.dispatchCommand($e,"bold")},title:"Bold",variant:"minimal",children:W.jsx(Je.Icon,{name:"bold"})}),W.jsx(Ke.Button,{"aria-label":"Italic","data-active":i,onClick:()=>{n.dispatchCommand($e,"italic")},title:"Italic",variant:"minimal",children:W.jsx(Je.Icon,{name:"italic"})}),W.jsx(Ke.Button,{"aria-label":"List","data-active":l,onClick:()=>{l?n.dispatchCommand($l,void 0):n.dispatchCommand(Wl,void 0)},title:"List",variant:"minimal",children:W.jsx(Je.Icon,{name:"list"})}),W.jsx(Ke.Button,{"aria-label":"Link","data-active":o,onClick:()=>{o?N():(n.dispatchCommand(nn,{url:"https://"}),A("https://"))},title:"Link",variant:"minimal",children:W.jsx(Je.Icon,{name:"link"})}),W.jsx(Ke.Button,{"aria-label":"Image","data-active":r,onClick:()=>{r?U():k()},title:"Image",variant:"minimal",children:W.jsx(Je.Icon,{name:"image"})}),W.jsxs("div",{className:js.t(Ue.meta,o||r?Ue.active:""),children:[o&&W.jsxs(W.Fragment,{children:[W.jsx(qs.Input,{onBlur:()=>B(),onChange:R=>g(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),B())},ref:b,value:m}),W.jsx(Ke.Button,{"aria-label":"Apply link",onClick:()=>{B()},onMouseDown:T,variant:"minimal",children:W.jsx(Je.Icon,{name:"check",variant:"primary"})}),W.jsx(Ke.Button,{"aria-label":"Remove link",onClick:()=>N(),onMouseDown:T,variant:"minimal",children:W.jsx(Je.Icon,{name:"trash",variant:"danger"})})]}),r&&W.jsxs(W.Fragment,{children:[W.jsx(qs.Input,{className:js.t(Ue.active),onBlur:L,onChange:R=>c(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),w.current=!0,_())},ref:y,value:h}),W.jsx(Ke.Button,{"aria-label":"Apply image",onClick:()=>_(),onMouseDown:C,variant:"minimal",children:W.jsx(Je.Icon,{name:"check",variant:"primary"})}),W.jsx(Ke.Button,{"aria-label":"Remove image",onClick:()=>O(),onMouseDown:C,variant:"minimal",children:W.jsx(Je.Icon,{name:"trash",variant:"danger"})})]})]})]})},W1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,$1=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,H1=[n=>{const e=W1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=$1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function V1(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function G1({content:n=""}){const[e]=Ae();return z.useEffect(()=>{e.update(()=>{const r=new DOMParser().parseFromString(n,"text/html"),u=Ll(e,r);ie().clear().select(),fs(u),ke(null)})},[e,n]),null}const K1=({autofocus:n=!1,autolink:e=!1,content:t,inline:r=!1,onChange:u})=>{const i={namespace:"Editor",theme:{link:Ue.link,list:{ol:Ue.list,ul:Ue.list},paragraph:Ue.paragraph,text:{bold:Ue.bold,italic:Ue.italic}},onError(s){throw s},nodes:[ku,ur,hn,ir,dr]};return W.jsx("div",{className:Ue.editor,"data-component":"editor",children:W.jsxs(yd,{initialConfig:i,children:[!r&&W.jsx(z1,{}),W.jsx(sh,{contentEditable:W.jsx(Cd,{}),ErrorBoundary:Ad}),n&&W.jsx(ad,{}),e&&W.jsx(md,{matchers:H1}),W.jsx(Bd,{}),t&&W.jsx(G1,{content:t}),W.jsx(Fd,{validateUrl:V1}),W.jsx(jd,{}),u&&W.jsx(Ud,{onChange:(s,o)=>{s.read(()=>{const a=Dl(o,null),l=L1(a,{allowedTags:["a","b","br","i","img","li","ol","p","ul"]});u(l)})}})]})})};exports.Editor=K1;
57
+ `)});const o=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},Xt(e.allowedAttributes,function(_,O){a[O]=[];const N=[];_.forEach(function(q){typeof q=="string"&&q.indexOf("*")>=0?N.push(Sa(q).replace(/\\\*/g,".*")):a[O].push(q)}),N.length&&(l[O]=new RegExp("^("+N.join("|")+")$"))}));const f={},h={},c={};Xt(e.allowedClasses,function(_,O){if(a&&(Ye(a,O)||(a[O]=[]),a[O].push("class")),f[O]=_,Array.isArray(_)){const N=[];f[O]=[],c[O]=[],_.forEach(function(q){typeof q=="string"&&q.indexOf("*")>=0?N.push(Sa(q).replace(/\\\*/g,".*")):q instanceof RegExp?c[O].push(q):f[O].push(q)}),N.length&&(h[O]=new RegExp("^("+N.join("|")+")$"))}});const d={};let p;Xt(e.transformTags,function(_,O){let N;typeof _=="function"?N=_:typeof _=="string"&&(N=Gn.simpleTransform(_)),O==="*"?p=N:d[O]=N});let m,g,y,b,x,w,T=!1;I();const S=new w1.Parser({onopentag:function(_,O){if(e.onOpenTag&&e.onOpenTag(_,O),e.enforceHtmlBoundary&&_==="html"&&I(),x){w++;return}const N=new i(_,O);g.push(N);let q=!1;const R=!!N.text;let V;if(Ye(d,_)&&(V=d[_](_,O),N.attribs=O=V.attribs,V.text!==void 0&&(N.innerText=V.text),_!==V.tagName&&(N.name=_=V.tagName,b[m]=V.tagName)),p&&(V=p(_,O),N.attribs=O=V.attribs,_!==V.tagName&&(N.name=_=V.tagName,b[m]=V.tagName)),(!s(_)||e.disallowedTagsMode==="recursiveEscape"&&!N1(y)||e.nestingLimit!=null&&m>=e.nestingLimit)&&(q=!0,y[m]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&o.indexOf(_)!==-1&&(x=!0,w=1)),m++,q){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(N.innerText&&!R){const K=C(N.innerText);e.textFilter?r+=e.textFilter(K,_):r+=K,T=!0}return}u=r,r=""}r+="<"+_,_==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(N.innerText=""),q&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?Xt(O,function(K,J){r+=" "+J+'="'+C(K||"",!0)+'"'}):(!a||Ye(a,_)||a["*"])&&Xt(O,function(K,J){if(!I1.test(J)){delete N.attribs[J];return}if(K===""&&!e.allowedEmptyAttributes.includes(J)&&(e.nonBooleanAttributes.includes(J)||e.nonBooleanAttributes.includes("*"))){delete N.attribs[J];return}let Ie=!1;if(!a||Ye(a,_)&&a[_].indexOf(J)!==-1||a["*"]&&a["*"].indexOf(J)!==-1||Ye(l,_)&&l[_].test(J)||l["*"]&&l["*"].test(J))Ie=!0;else if(a&&a[_]){for(const H of a[_])if(S1(H)&&H.name&&H.name===J){Ie=!0;let Q="";if(H.multiple===!0){const we=K.split(" ");for(const ge of we)H.values.indexOf(ge)!==-1&&(Q===""?Q=ge:Q+=" "+ge)}else H.values.indexOf(K)>=0&&(Q=K);K=Q}}if(Ie){if(e.allowedSchemesAppliedToAttributes.indexOf(J)!==-1&&L(_,K)){delete N.attribs[J];return}if(_==="script"&&J==="src"){let H=!0;try{const Q=U(K);if(e.allowedScriptHostnames||e.allowedScriptDomains){const we=(e.allowedScriptHostnames||[]).find(function(me){return me===Q.url.hostname}),ge=(e.allowedScriptDomains||[]).find(function(me){return Q.url.hostname===me||Q.url.hostname.endsWith(`.${me}`)});H=we||ge}}catch{H=!1}if(!H){delete N.attribs[J];return}}if(_==="iframe"&&J==="src"){let H=!0;try{const Q=U(K);if(Q.isRelativeUrl)H=Ye(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const we=(e.allowedIframeHostnames||[]).find(function(me){return me===Q.url.hostname}),ge=(e.allowedIframeDomains||[]).find(function(me){return Q.url.hostname===me||Q.url.hostname.endsWith(`.${me}`)});H=we||ge}}catch{H=!1}if(!H){delete N.attribs[J];return}}if(J==="srcset")try{let H=T1(K);if(H.forEach(function(Q){L("srcset",Q.url)&&(Q.evil=!0)}),H=Ca(H,function(Q){return!Q.evil}),H.length)K=A1(Ca(H,function(Q){return!Q.evil})),N.attribs[J]=K;else{delete N.attribs[J];return}}catch{delete N.attribs[J];return}if(J==="class"){const H=f[_],Q=f["*"],we=h[_],ge=c[_],me=c["*"],d0=h["*"],Bs=[we,d0].concat(ge,me).filter(function(h0){return h0});if(H&&Q?K=B(K,Ta(H,Q),Bs):K=B(K,H||Q,Bs),!K.length){delete N.attribs[J];return}}if(J==="style"){if(e.parseStyleAttributes)try{const H=C1(_+" {"+K+"}",{map:!1}),Q=v(H,e.allowedStyles);if(K=k(Q),K.length===0){delete N.attribs[J];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+_+" {"+K+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete N.attribs[J];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+J,K&&K.length?r+='="'+C(K,!0)+'"':e.allowedEmptyAttributes.includes(J)&&(r+='=""')}else delete N.attribs[J]}),e.selfClosing.indexOf(_)!==-1?r+=" />":(r+=">",N.innerText&&!R&&!e.textFilter&&(r+=C(N.innerText),T=!0)),q&&(r=u+C(r),u=""),N.openingTagLength=r.length-N.tagPosition},ontext:function(_){if(x)return;const O=g[g.length-1];let N;if(O&&(N=O.tag,_=O.innerText!==void 0?O.innerText:_),e.disallowedTagsMode==="completelyDiscard"&&!s(N))_="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(N==="script"||N==="style"))r+=_;else if(!T){const q=C(_,!1);e.textFilter?r+=e.textFilter(q,N):r+=q}if(g.length){const q=g[g.length-1];q.text+=_}},onclosetag:function(_,O){if(e.onCloseTag&&e.onCloseTag(_,O),x)if(w--,!w)x=!1;else return;const N=g.pop();if(!N)return;if(N.tag!==_){g.push(N);return}x=e.enforceHtmlBoundary?_==="html":!1,m--;const q=y[m];if(q){if(delete y[m],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){N.updateParentNodeText();return}u=r,r=""}if(b[m]&&(_=b[m],delete b[m]),e.exclusiveFilter){const R=e.exclusiveFilter(N);if(R==="excludeTag"){q&&(r=u,u=""),r=r.substring(0,N.tagPosition)+r.substring(N.tagPosition+N.openingTagLength);return}else if(R){r=r.substring(0,N.tagPosition);return}}if(N.updateParentNodeMediaChildren(),N.updateParentNodeText(),e.selfClosing.indexOf(_)!==-1||O&&!s(_)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){q&&(r=u,u="");return}r+="</"+_+">",q&&(r=u+C(r),u=""),T=!1}},e.parser);if(S.write(n),S.end(),e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape"){const _=S.endIndex;if(_!=null&&_>=0&&_<n.length){const O=n.substring(_);r+=C(O)}else(_==null||_<0)&&n.length>0&&r===""&&(r=C(n))}return r;function I(){r="",m=0,g=[],y={},b={},x=!1,w=0}function C(_,O){return typeof _!="string"&&(_=_+""),e.parser.decodeEntities&&(_=_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),O&&(_=_.replace(/"/g,"&quot;"))),_=_.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),O&&(_=_.replace(/"/g,"&quot;")),_}function L(_,O){for(O=O.replace(/[\x00-\x20]+/g,"");;){const R=O.indexOf("<!--");if(R===-1)break;const V=O.indexOf("-->",R+4);if(V===-1)break;O=O.substring(0,R)+O.substring(V+3)}const N=O.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!N)return O.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const q=N[1].toLowerCase();return Ye(e.allowedSchemesByTag,_)?e.allowedSchemesByTag[_].indexOf(q)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(q)===-1}function U(_){if(_=_.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),_.startsWith("relative:"))throw new Error("relative: exploit attempt");let O="relative://relative-site";for(let R=0;R<100;R++)O+=`/${R}`;const N=new URL(_,O);return{isRelativeUrl:N&&N.hostname==="relative-site"&&N.protocol==="relative:",url:N}}function v(_,O){if(!O)return _;const N=_.nodes[0];let q;return O[N.selector]&&O["*"]?q=Ta(O[N.selector],O["*"]):q=O[N.selector]||O["*"],q&&(_.nodes[0].nodes=N.nodes.reduce(A(q),[])),_}function k(_){return _.nodes[0].nodes.reduce(function(O,N){return O.push(`${N.prop}:${N.value}${N.important?" !important":""}`),O},[]).join(";")}function A(_){return function(O,N){return Ye(_,N.prop)&&_[N.prop].some(function(R){return R.test(N.value)})&&O.push(N),O}}function B(_,O,N){return O?(_=_.split(/\s+/),_.filter(function(q){return O.indexOf(q)!==-1||N.some(function(R){return R.test(q)})}).join(" ")):_}}const P1={decodeEntities:!0};Gn.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};Gn.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,u){let i;if(t)for(i in e)u[i]=e[i];else u=e;return{tagName:n,attribs:u}}};const L1=ah(O1),f0=fn();class dr extends Cl{constructor(t,r,u,i,s){super(s);mn(this,"__src");mn(this,"__alt");mn(this,"__width");mn(this,"__height");this.__src=t,this.__alt=r,this.__width=u,this.__height=i}static getType(){return"image"}static clone(t){return new dr(t.__src,t.__alt,t.__width,t.__height,t.__key)}static importJSON(t){return zi({alt:t.alt,height:t.height,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:r=>{if(!(r instanceof HTMLImageElement))return null;const u=r.getAttribute("src")??"";if(!u)return null;const i=r.getAttribute("width"),s=r.getAttribute("height");return{node:zi({alt:r.getAttribute("alt")??"",height:s?Number(s):void 0,src:u,width:i?Number(i):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const r=this.getWritable();return r.__src=t,r}decorate(t){return W.jsx("img",{alt:this.__alt,height:this.__height,onClick:r=>{r.preventDefault(),t.dispatchCommand(f0,{key:this.getKey(),src:this.__src})},src:this.__src,width:this.__width})}}function zi({alt:n="",height:e,src:t,width:r}){return new dr(t,n,r,e)}function Ea(n){return n instanceof dr}const D1="_editor_11hrr_1",M1="_meta_11hrr_19",R1="_active_11hrr_27",B1="_bold_11hrr_39",F1="_italic_11hrr_43",j1="_link_11hrr_47",q1="_list_11hrr_53",U1="_paragraph_11hrr_54",Ue={editor:D1,meta:M1,active:R1,bold:B1,italic:F1,link:j1,list:q1,paragraph:U1},z1=()=>{const[n]=Ae(),[e,t]=z.useState(!1),[r,u]=z.useState(!1),[i,s]=z.useState(!1),[o,a]=z.useState(!1),[l,f]=z.useState(!1),[h,c]=z.useState(""),[d,p]=z.useState(null),[m,g]=z.useState(""),y=z.useRef(null),b=z.useRef(null),x=z.useRef(null),w=z.useRef(!1),T=R=>R.preventDefault(),S=z.useCallback(R=>{x.current=P(R)?R.clone():null},[]),I=z.useCallback(R=>{n.update(()=>{x.current&&ke(x.current)}),R(),x.current=null},[n]),C=R=>{w.current=!0,R.preventDefault()},L=()=>{if(w.current){w.current=!1;return}_()},U=z.useCallback(()=>{u(!1),c(""),p(null)},[]),v=z.useCallback(()=>{a(!1),g("")},[]),k=z.useCallback(R=>{u(!0),c((R==null?void 0:R.src)??""),p((R==null?void 0:R.key)??null),v(),setTimeout(()=>{var V;return(V=y.current)==null?void 0:V.focus()},0)},[v]),A=z.useCallback(R=>{n.getEditorState().read(()=>{S(j())}),a(!0),g(R),U(),setTimeout(()=>{var V;return(V=b.current)==null?void 0:V.focus()},0)},[U,n,S]),B=z.useCallback(()=>{I(()=>{n.dispatchCommand(nn,{url:m,target:"_blank"})}),v()},[v,n,m,I]),_=z.useCallback(()=>{const R=h.trim();if(!R){U();return}n.update(()=>{if(d){const V=ae(d);Ea(V)&&V.setSrc(R);return}fs([zi({src:R})])}),U()},[U,n,d,h]),O=z.useCallback(()=>{if(!d){U();return}n.update(()=>{const R=ae(d);if(Ea(R)){const V=R.getParent();Bt(V)&&V.getChildrenSize()===1?V.remove():R.remove()}}),U()},[U,n,d]),N=z.useCallback(()=>{I(()=>{n.dispatchCommand(nn,null)}),v()},[v,n,I]),q=z.useCallback(()=>{const R=j();if(!P(R)){if(Ee(R)){const ft=R.getNodes(),K=ft[0]??null,J=(K==null?void 0:K.getParent())??null;t(ft.some(H=>D(H)&&H.hasFormat("bold"))),s(ft.some(H=>D(H)&&H.hasFormat("italic"))),f(Z(J)||re(J)||Z(K)||re(K));const Ie=tt(K)?K:tt(J)?J:null;if(Ie){a(!0),g(Ie.getURL());return}a(!1),g(""),x.current=null;return}t(!1),s(!1),f(!1),a(!1),g(""),x.current=null;return}const[V]=R.getNodes(),Oe=(V==null?void 0:V.getParent())??null;if(t(R.hasFormat("bold")),s(R.hasFormat("italic")),f(Z(Oe)||re(Oe)),tt(Oe)){a(!0),g(Oe.getURL()),S(R);return}a(!1),g(""),x.current=null},[S]);return z.useEffect(()=>at(n.registerUpdateListener(({editorState:R})=>{R.read(()=>{q()})}),n.registerCommand(f0,R=>(k(R),!0),nt),n.registerCommand(du,()=>(n.getEditorState().read(()=>{q()}),!1),nt)),[n,k,q]),W.jsxs(m0.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[W.jsx(Ke.Button,{"aria-label":"Bold","data-active":e,onClick:()=>{n.dispatchCommand($e,"bold")},title:"Bold",variant:"minimal",children:W.jsx(Je.Icon,{name:"bold"})}),W.jsx(Ke.Button,{"aria-label":"Italic","data-active":i,onClick:()=>{n.dispatchCommand($e,"italic")},title:"Italic",variant:"minimal",children:W.jsx(Je.Icon,{name:"italic"})}),W.jsx(Ke.Button,{"aria-label":"List","data-active":l,onClick:()=>{l?n.dispatchCommand($l,void 0):n.dispatchCommand(Wl,void 0)},title:"List",variant:"minimal",children:W.jsx(Je.Icon,{name:"list"})}),W.jsx(Ke.Button,{"aria-label":"Link","data-active":o,onClick:()=>{o?N():(n.dispatchCommand(nn,{url:"https://"}),A("https://"))},title:"Link",variant:"minimal",children:W.jsx(Je.Icon,{name:"link"})}),W.jsx(Ke.Button,{"aria-label":"Image","data-active":r,onClick:()=>{r?U():k()},title:"Image",variant:"minimal",children:W.jsx(Je.Icon,{name:"image"})}),W.jsxs("div",{className:js.t(Ue.meta,o||r?Ue.active:""),children:[o&&W.jsxs(W.Fragment,{children:[W.jsx(qs.Input,{onBlur:()=>B(),onChange:R=>g(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),B())},ref:b,value:m}),W.jsx(Ke.Button,{"aria-label":"Apply link",onClick:()=>{B()},onMouseDown:T,variant:"minimal",children:W.jsx(Je.Icon,{name:"check",variant:"primary"})}),W.jsx(Ke.Button,{"aria-label":"Remove link",onClick:()=>N(),onMouseDown:T,variant:"minimal",children:W.jsx(Je.Icon,{name:"trash",variant:"danger"})})]}),r&&W.jsxs(W.Fragment,{children:[W.jsx(qs.Input,{className:js.t(Ue.active),onBlur:L,onChange:R=>c(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),w.current=!0,_())},ref:y,value:h}),W.jsx(Ke.Button,{"aria-label":"Apply image",onClick:()=>_(),onMouseDown:C,variant:"minimal",children:W.jsx(Je.Icon,{name:"check",variant:"primary"})}),W.jsx(Ke.Button,{"aria-label":"Remove image",onClick:()=>O(),onMouseDown:C,variant:"minimal",children:W.jsx(Je.Icon,{name:"trash",variant:"danger"})})]})]})]})},W1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,$1=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,H1=[n=>{const e=W1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=$1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function V1(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function G1({content:n=""}){const[e]=Ae();return z.useEffect(()=>{e.update(()=>{const r=new DOMParser().parseFromString(n,"text/html"),u=Ll(e,r);ie().clear().select(),fs(u),ke(null)})},[e,n]),null}const K1=({autofocus:n=!1,autolink:e=!1,content:t,inline:r=!1,onChange:u})=>{const i={namespace:"Editor",theme:{link:Ue.link,list:{ol:Ue.list,ul:Ue.list},paragraph:Ue.paragraph,text:{bold:Ue.bold,italic:Ue.italic}},onError(s){throw s},nodes:[ku,ur,hn,ir,dr]};return W.jsx("div",{className:Ue.editor,"data-component":"editor",children:W.jsxs(yd,{initialConfig:i,children:[!r&&W.jsx(z1,{}),W.jsx(sh,{contentEditable:W.jsx(Cd,{}),ErrorBoundary:Ad}),n&&W.jsx(ad,{}),e&&W.jsx(md,{matchers:H1}),W.jsx(Bd,{}),t&&W.jsx(G1,{content:t}),W.jsx(Fd,{validateUrl:V1}),W.jsx(jd,{}),u&&W.jsx(Ud,{onChange:(s,o)=>{s.read(()=>{const a=Dl(o,null),l=L1(a,{allowedTags:["a","b","br","i","img","li","ol","p","ul"]});u(l)})}})]})})};exports.Editor=K1;
58
58
  //# sourceMappingURL=index.cjs.map
@@ -11371,7 +11371,7 @@ function Ji({
11371
11371
  function Pa(n) {
11372
11372
  return n instanceof yr;
11373
11373
  }
11374
- const H1 = "_editor_nvulc_1", V1 = "_meta_nvulc_19", G1 = "_active_nvulc_27", K1 = "_bold_nvulc_39", J1 = "_italic_nvulc_43", X1 = "_link_nvulc_47", Z1 = "_list_nvulc_53", Q1 = "_paragraph_nvulc_54", $e = {
11374
+ const H1 = "_editor_11hrr_1", V1 = "_meta_11hrr_19", G1 = "_active_11hrr_27", K1 = "_bold_11hrr_39", J1 = "_italic_11hrr_43", X1 = "_link_11hrr_47", Z1 = "_list_11hrr_53", Q1 = "_paragraph_11hrr_54", $e = {
11375
11375
  editor: H1,
11376
11376
  meta: V1,
11377
11377
  active: G1,
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index24.css');const D=require("react/jsx-runtime"),y=require("../../classix-5H4IWnMA.cjs"),o=require("react"),A=require("../../icons-vqS7W0cD.cjs"),H=require("../list/index.cjs"),M="_sortable_scp0q_5",V="_dragging_scp0q_35",k="_dropping_scp0q_50",z="_columns_scp0q_63",B="_pseudo_scp0q_72",c={sortable:M,dragging:V,dropping:k,columns:z,pseudo:B,"target-above":"_target-above_scp0q_87","target-below":"_target-below_scp0q_88"};function N({children:h,className:T,columns:g=1,isRearranging:d=!1,onChangeOrder:f,...b}){const x=Number.isFinite(g)?Math.max(1,Math.floor(g)):1,S=o.useMemo(()=>o.Children.toArray(h),[h]),n=o.useRef(-1),[p,I]=o.useState({height:0,width:0}),[a,m]=o.useState(null),[E,q]=o.useState(null),$={...b.style,"--icon-svg":A.iconSVG("sort",!0),"--height":`${p.height}px`,"--width":x>1?`calc(${p.width}px - var(--utils-tokens-unit))`:`${p.width}px`},v=()=>{n.current=-1,m(null)};return o.useEffect(()=>{d||q(null)},[d]),D.jsx(H.List,{className:y.t(T,c.sortable,x>1&&c.columns),columns:g,ordered:!0,style:$,...b,"data-component":"sortable",children:S.map((_,t)=>{const j=o.isValidElement(_)?_.key:null;return D.jsx("li",{className:y.t(a!==null&&a>t-10&&a<t+10&&c.pseudo,a===t&&n.current<t&&c["target-below"],a===t&&n.current>t&&c["target-above"],n.current===t&&c.dragging,E===t&&d&&c.dropping),draggable:!d,onDragEnd:()=>v(),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move";const r=n.current;if(r<0||r===t)return;const s=e.currentTarget.getBoundingClientRect(),l=t===r+1?p.height:s.height,u=e.clientY>s.top+l/2?t+1:t,i=u>r?u-1:u;m(i)},onDragStart:e=>{n.current=t,I({height:e.currentTarget.offsetHeight,width:e.currentTarget.offsetWidth}),e.dataTransfer.setData("text/plain",""),e.dataTransfer.effectAllowed="move",m(t)},onDrop:e=>{e.preventDefault();const r=n.current,s=a;if(r<0||s===null||r===s)return;q(s);const l=S.slice(),[w]=l.splice(r,1);l.splice(s,0,w),f==null||f(l.map((u,i)=>({id:String(o.isValidElement(u)?u.props["data-id"]??`idx-${i}`:`idx-${i}`),weight:l.length-1-i}))),v()},"data-component":"sortable",children:_},j??t)})})}exports.Sortable=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index24.css');const y=require("react/jsx-runtime"),T=require("../../classix-5H4IWnMA.cjs"),o=require("react"),A=require("../../icons-vqS7W0cD.cjs"),H=require("../list/index.cjs"),M="_sortable_c1ptl_5",V="_dragging_c1ptl_35",z="_dropping_c1ptl_50",B="_columns_c1ptl_63",N="_pseudo_c1ptl_73",c={sortable:M,dragging:V,dropping:z,columns:B,pseudo:N,"target-above":"_target-above_c1ptl_88","target-below":"_target-below_c1ptl_89"};function k({children:h,className:I,columns:g=1,isRearranging:d=!1,onChangeOrder:f,...b}){const x=Number.isFinite(g)?Math.max(1,Math.floor(g)):1,v=o.useMemo(()=>o.Children.toArray(h),[h]),n=o.useRef(-1),[p,q]=o.useState({height:0,width:0}),[a,m]=o.useState(null),[E,S]=o.useState(null),$={...b.style,"--icon-svg":A.iconSVG("sort",!0),"--height":`calc(${p.height}px - var(--scale-16))`,"--width":x>1?`calc(${p.width}px - var(--scale-16))`:`${p.width}px`},w=()=>{n.current=-1,m(null)};return o.useEffect(()=>{d||S(null)},[d]),y.jsx(H.List,{className:T.t(I,c.sortable,x>1&&c.columns),columns:g,ordered:!0,style:$,...b,"data-component":"sortable",children:v.map((_,t)=>{const j=o.isValidElement(_)?_.key:null;return y.jsx("li",{className:T.t(a!==null&&a>t-10&&a<t+10&&c.pseudo,a===t&&n.current<t&&c["target-below"],a===t&&n.current>t&&c["target-above"],n.current===t&&c.dragging,E===t&&d&&c.dropping),draggable:!d,onDragEnd:()=>w(),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move";const r=n.current;if(r<0||r===t)return;const s=e.currentTarget.getBoundingClientRect(),l=t===r+1?p.height:s.height,u=e.clientY>s.top+l/2?t+1:t,i=u>r?u-1:u;m(i)},onDragStart:e=>{n.current=t,q({height:e.currentTarget.offsetHeight,width:e.currentTarget.offsetWidth}),e.dataTransfer.setData("text/plain",""),e.dataTransfer.effectAllowed="move",m(t)},onDrop:e=>{e.preventDefault();const r=n.current,s=a;if(r<0||s===null||r===s)return;S(s);const l=v.slice(),[D]=l.splice(r,1);l.splice(s,0,D),f==null||f(l.map((u,i)=>({id:String(o.isValidElement(u)?u.props["data-id"]??`idx-${i}`:`idx-${i}`),weight:l.length-1-i}))),w()},"data-component":"sortable",children:_},j??t)})})}exports.Sortable=k;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/_sortable/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { List } from '@/components/list';\n\nimport styles from './styles.module.css';\n\ntype SortItem = { id: string; weight: number };\n\ntype SortableProps = React.ComponentPropsWithoutRef<'ol'> & {\n columns?: number;\n isRearranging?: boolean;\n onChangeOrder: (order: SortItem[]) => void;\n};\n\ntype withVars = React.CSSProperties & {\n '--height'?: string;\n '--width'?: string;\n '--icon-svg'?: string;\n};\n\n/**\n * Children must provide a stable `data-id` for emits `{ id, weight }` and `key` (reconciliation).\n */\n\nexport function Sortable({\n children,\n className,\n columns = 1,\n isRearranging = false,\n onChangeOrder,\n ...props\n}: SortableProps) {\n const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n const arr = useMemo(() => React.Children.toArray(children), [children]);\n const drag = useRef(-1);\n const [zoneSize, setZoneSize] = useState({\n height: 0,\n width: 0,\n });\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n const [droppedAtIndex, setDroppedAtIndex] = useState<number | null>(null);\n const withVars: withVars = {\n ...props.style,\n '--icon-svg': iconSVG('sort', true),\n '--height': `${zoneSize.height}px`,\n '--width':\n cols > 1 ? `calc(${zoneSize.width}px - var(--utils-tokens-unit))` : `${zoneSize.width}px`,\n };\n\n const resetDragState = () => {\n drag.current = -1;\n setDropIndex(null);\n };\n\n useEffect(() => {\n if (!isRearranging) {\n setDroppedAtIndex(null);\n }\n }, [isRearranging]);\n\n return (\n <List\n className={cx(className, styles.sortable, cols > 1 && styles.columns)}\n columns={columns}\n ordered\n style={withVars}\n {...props}\n >\n {arr.map((child, i) => {\n const key = React.isValidElement(child) ? child.key : null;\n\n return (\n <li\n key={key ?? i}\n className={cx(\n dropIndex !== null && dropIndex > i - 10 && dropIndex < i + 10 && styles.pseudo,\n dropIndex === i && drag.current < i && styles['target-below'],\n dropIndex === i && drag.current > i && styles['target-above'],\n drag.current === i && styles.dragging,\n droppedAtIndex === i && isRearranging && styles.dropping\n )}\n draggable={!isRearranging}\n onDragEnd={() => resetDragState()}\n onDragOver={(e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n const from = drag.current;\n if (from < 0 || from === i) return;\n\n const rect = e.currentTarget.getBoundingClientRect();\n const itemHeight = i === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = e.clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? i + 1 : i;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n setDropIndex(nextDropIndex);\n }}\n onDragStart={(e) => {\n drag.current = i;\n setZoneSize({\n height: e.currentTarget.offsetHeight,\n width: e.currentTarget.offsetWidth,\n });\n e.dataTransfer.setData('text/plain', '');\n e.dataTransfer.effectAllowed = 'move';\n setDropIndex(i);\n }}\n onDrop={(e) => {\n e.preventDefault();\n const from = drag.current;\n const to = dropIndex;\n if (from < 0 || to === null || from === to) return;\n\n setDroppedAtIndex(to);\n const next = arr.slice();\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n onChangeOrder?.(\n next.map((c, idx) => ({\n id: String(\n React.isValidElement(c)\n ? ((c.props as { 'data-id'?: string })['data-id'] ?? `idx-${idx}`)\n : `idx-${idx}`\n ),\n\n weight: next.length - 1 - idx,\n }))\n );\n\n resetDragState();\n }}\n >\n {child}\n </li>\n );\n })}\n </List>\n );\n}\n"],"names":["Sortable","children","className","columns","isRearranging","onChangeOrder","props","cols","Number","isFinite","Math","max","floor","arr","useMemo","React","Children","toArray","drag","useRef","zoneSize","setZoneSize","useState","height","width","dropIndex","setDropIndex","droppedAtIndex","setDroppedAtIndex","withVars","style","iconSVG","resetDragState","current","useEffect","jsx","List","cx","styles","sortable","map","child","i","key","isValidElement","pseudo","dragging","dropping","e","preventDefault","dataTransfer","dropEffect","from","rect","currentTarget","getBoundingClientRect","itemHeight","rawIndex","clientY","top","nextDropIndex","offsetHeight","offsetWidth","setData","effectAllowed","to","next","slice","moved","splice","c","idx","id","String","weight","length"],"mappings":"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"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/_sortable/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { List } from '@/components/list';\n\nimport styles from './styles.module.css';\n\ntype SortItem = { id: string; weight: number };\n\ntype SortableProps = React.ComponentPropsWithoutRef<'ol'> & {\n columns?: number;\n isRearranging?: boolean;\n onChangeOrder: (order: SortItem[]) => void;\n};\n\ntype withVars = React.CSSProperties & {\n '--height'?: string;\n '--width'?: string;\n '--icon-svg'?: string;\n};\n\n/**\n * Children must provide a stable `data-id` for emits `{ id, weight }` and `key` (reconciliation).\n */\n\nexport function Sortable({\n children,\n className,\n columns = 1,\n isRearranging = false,\n onChangeOrder,\n ...props\n}: SortableProps) {\n const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n const arr = useMemo(() => React.Children.toArray(children), [children]);\n const drag = useRef(-1);\n const [zoneSize, setZoneSize] = useState({\n height: 0,\n width: 0,\n });\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n const [droppedAtIndex, setDroppedAtIndex] = useState<number | null>(null);\n const withVars: withVars = {\n ...props.style,\n '--icon-svg': iconSVG('sort', true),\n '--height': `calc(${zoneSize.height}px - var(--scale-16))`,\n '--width': cols > 1 ? `calc(${zoneSize.width}px - var(--scale-16))` : `${zoneSize.width}px`,\n };\n\n const resetDragState = () => {\n drag.current = -1;\n setDropIndex(null);\n };\n\n useEffect(() => {\n if (!isRearranging) {\n setDroppedAtIndex(null);\n }\n }, [isRearranging]);\n\n return (\n <List\n className={cx(className, styles.sortable, cols > 1 && styles.columns)}\n columns={columns}\n ordered\n style={withVars}\n {...props}\n >\n {arr.map((child, i) => {\n const key = React.isValidElement(child) ? child.key : null;\n\n return (\n <li\n key={key ?? i}\n className={cx(\n dropIndex !== null && dropIndex > i - 10 && dropIndex < i + 10 && styles.pseudo,\n dropIndex === i && drag.current < i && styles['target-below'],\n dropIndex === i && drag.current > i && styles['target-above'],\n drag.current === i && styles.dragging,\n droppedAtIndex === i && isRearranging && styles.dropping\n )}\n draggable={!isRearranging}\n onDragEnd={() => resetDragState()}\n onDragOver={(e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n const from = drag.current;\n if (from < 0 || from === i) return;\n\n const rect = e.currentTarget.getBoundingClientRect();\n const itemHeight = i === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = e.clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? i + 1 : i;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n setDropIndex(nextDropIndex);\n }}\n onDragStart={(e) => {\n drag.current = i;\n setZoneSize({\n height: e.currentTarget.offsetHeight,\n width: e.currentTarget.offsetWidth,\n });\n e.dataTransfer.setData('text/plain', '');\n e.dataTransfer.effectAllowed = 'move';\n setDropIndex(i);\n }}\n onDrop={(e) => {\n e.preventDefault();\n const from = drag.current;\n const to = dropIndex;\n if (from < 0 || to === null || from === to) return;\n\n setDroppedAtIndex(to);\n const next = arr.slice();\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n onChangeOrder?.(\n next.map((c, idx) => ({\n id: String(\n React.isValidElement(c)\n ? ((c.props as { 'data-id'?: string })['data-id'] ?? `idx-${idx}`)\n : `idx-${idx}`\n ),\n\n weight: next.length - 1 - idx,\n }))\n );\n\n resetDragState();\n }}\n >\n {child}\n </li>\n );\n })}\n </List>\n );\n}\n"],"names":["Sortable","children","className","columns","isRearranging","onChangeOrder","props","cols","Number","isFinite","Math","max","floor","arr","useMemo","React","Children","toArray","drag","useRef","zoneSize","setZoneSize","useState","height","width","dropIndex","setDropIndex","droppedAtIndex","setDroppedAtIndex","withVars","style","iconSVG","resetDragState","current","useEffect","jsx","List","cx","styles","sortable","map","child","i","key","isValidElement","pseudo","dragging","dropping","e","preventDefault","dataTransfer","dropEffect","from","rect","currentTarget","getBoundingClientRect","itemHeight","rawIndex","clientY","top","nextDropIndex","offsetHeight","offsetWidth","setData","effectAllowed","to","next","slice","moved","splice","c","idx","id","String","weight","length"],"mappings":"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"}