@solibo/solibo-ui 2.2.7 → 2.2.9

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,51 +1,51 @@
1
- import '../../assets/index43.css';var Ut = Object.defineProperty;
2
- var Bt = (a, n, e) => n in a ? Ut(a, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[n] = e;
3
- var z = (a, n, e) => Bt(a, typeof n != "symbol" ? n + "" : n, e);
4
- import { jsx as r, jsxs as y, Fragment as dt } from "react/jsx-runtime";
5
- import { $generateHtmlFromNodes as Wt, $generateNodesFromDOM as Ft } from "@lexical/html";
6
- import { TOGGLE_LINK_COMMAND as pt, $isLinkNode as rt, AutoLinkNode as Ht, LinkNode as zt } from "@lexical/link";
7
- import { $isListNode as bt, $isListItemNode as vt, REMOVE_LIST_COMMAND as Kt, INSERT_UNORDERED_LIST_COMMAND as jt, ListNode as Gt, ListItemNode as Zt } from "@lexical/list";
8
- import { AutoFocusPlugin as qt } from "@lexical/react/LexicalAutoFocusPlugin";
9
- import { AutoLinkPlugin as Vt } from "@lexical/react/LexicalAutoLinkPlugin";
10
- import { useLexicalComposerContext as Nt } from "@lexical/react/LexicalComposerContext";
11
- import { ContentEditable as Jt } from "@lexical/react/LexicalContentEditable";
12
- import { LexicalErrorBoundary as Yt } from "@lexical/react/LexicalErrorBoundary";
13
- import { LexicalExtensionComposer as Xt } from "@lexical/react/LexicalExtensionComposer";
14
- import { HistoryPlugin as Qt } from "@lexical/react/LexicalHistoryPlugin";
15
- import { LinkPlugin as te } from "@lexical/react/LexicalLinkPlugin";
16
- import { ListPlugin as ee } from "@lexical/react/LexicalListPlugin";
17
- import { OnChangePlugin as ie } from "@lexical/react/LexicalOnChangePlugin";
18
- import { RichTextPlugin as re } from "@lexical/react/LexicalRichTextPlugin";
19
- import ot from "classix";
20
- import { DecoratorNode as ne, $applyNodeReplacement as oe, createCommand as se, PASTE_COMMAND as le, $insertNodes as St, COMMAND_PRIORITY_HIGH as ae, $isRangeSelection as Dt, $setSelection as Ot, $getSelection as It, $isTextNode as nt, $createTextNode as ce, $getNodeByKey as kt, $isParagraphNode as ue, $isNodeSelection as de, COMMAND_PRIORITY_LOW as Mt, SELECTION_CHANGE_COMMAND as me, FORMAT_TEXT_COMMAND as Lt, defineExtension as _e, $getRoot as he } from "lexical";
21
- import { useEffect as st, useState as g, useRef as K, useCallback as h, useId as fe } from "react";
22
- import xt from "sanitize-html";
23
- import { File as ge } from "../file/index.js";
24
- import { mergeRegister as pe } from "@lexical/utils";
1
+ import '../../assets/index43.css';var Ot = Object.defineProperty;
2
+ var Pt = (s, r, e) => r in s ? Ot(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
3
+ var K = (s, r, e) => Pt(s, typeof r != "symbol" ? r + "" : r, e);
4
+ import { jsx as n, jsxs as B, Fragment as _t } from "react/jsx-runtime";
5
+ import { $generateHtmlFromNodes as $t, $generateNodesFromDOM as Rt } from "@lexical/html";
6
+ import { TOGGLE_LINK_COMMAND as ft, $isLinkNode as ot, AutoLinkNode as Ut, LinkNode as zt } from "@lexical/link";
7
+ import { $isListNode as pt, $isListItemNode as bt, REMOVE_LIST_COMMAND as Ht, INSERT_UNORDERED_LIST_COMMAND as Bt, ListNode as Ft, ListItemNode as Wt } from "@lexical/list";
8
+ import { AutoFocusPlugin as Kt } from "@lexical/react/LexicalAutoFocusPlugin";
9
+ import { AutoLinkPlugin as jt } from "@lexical/react/LexicalAutoLinkPlugin";
10
+ import { useLexicalComposerContext as At } from "@lexical/react/LexicalComposerContext";
11
+ import { ContentEditable as Gt } from "@lexical/react/LexicalContentEditable";
12
+ import { LexicalErrorBoundary as Zt } from "@lexical/react/LexicalErrorBoundary";
13
+ import { LexicalExtensionComposer as qt } from "@lexical/react/LexicalExtensionComposer";
14
+ import { HistoryPlugin as Yt } from "@lexical/react/LexicalHistoryPlugin";
15
+ import { LinkPlugin as Vt } from "@lexical/react/LexicalLinkPlugin";
16
+ import { ListPlugin as Jt } from "@lexical/react/LexicalListPlugin";
17
+ import { OnChangePlugin as Xt } from "@lexical/react/LexicalOnChangePlugin";
18
+ import { RichTextPlugin as Qt } from "@lexical/react/LexicalRichTextPlugin";
19
+ import lt from "classix";
20
+ import { DecoratorNode as te, $applyNodeReplacement as ee, createCommand as re, PASTE_COMMAND as ie, $insertNodes as Mt, COMMAND_PRIORITY_HIGH as ne, $isRangeSelection as vt, $setSelection as xt, $getSelection as Dt, $isTextNode as st, $createTextNode as oe, $getNodeByKey as It, $isParagraphNode as se, $isNodeSelection as le, COMMAND_PRIORITY_LOW as Et, SELECTION_CHANGE_COMMAND as ae, FORMAT_TEXT_COMMAND as kt, defineExtension as ce, $getRoot as ue } from "lexical";
21
+ import { useEffect as j, useRef as O, useState as f, useCallback as b, useId as de } from "react";
22
+ import wt from "sanitize-html";
25
23
  import { Button as L } from "../button/index.js";
26
- import { Icon as M } from "../icon/index.js";
27
- import { I as Tt } from "../../index-Dd20d_9U.js";
28
- import { Toolbar as be } from "../toolbar/index.js";
29
- const $t = se();
30
- class lt extends ne {
31
- constructor(e, s, m, _, o, f, p) {
32
- super(o);
33
- z(this, "__src");
34
- z(this, "__alt");
35
- z(this, "__width");
36
- z(this, "__height");
37
- z(this, "__soliboDocumentId");
38
- z(this, "__soliboDocumentSlot");
39
- this.__src = e, this.__alt = s, this.__width = m, this.__height = _, this.__soliboDocumentId = f, this.__soliboDocumentSlot = p;
24
+ import { File as me } from "../file/index.js";
25
+ import { mergeRegister as he } from "@lexical/utils";
26
+ import { Icon as y } from "../icon/index.js";
27
+ import { I as yt } from "../../index-Dd20d_9U.js";
28
+ import { Toolbar as _e } from "../toolbar/index.js";
29
+ const Tt = re();
30
+ class at extends te {
31
+ constructor(e, l, _, h, g, o, d) {
32
+ super(g);
33
+ K(this, "__src");
34
+ K(this, "__alt");
35
+ K(this, "__width");
36
+ K(this, "__height");
37
+ K(this, "__soliboDocumentId");
38
+ K(this, "__soliboDocumentSlot");
39
+ this.__src = e, this.__alt = l, this.__width = _, this.__height = h, this.__soliboDocumentId = o, this.__soliboDocumentSlot = d;
40
40
  }
41
41
  static getType() {
42
42
  return "image";
43
43
  }
44
44
  static clone(e) {
45
- return new lt(e.__src, e.__alt, e.__width, e.__height, e.__key, e.__soliboDocumentId, e.__soliboDocumentSlot);
45
+ return new at(e.__src, e.__alt, e.__width, e.__height, e.__key, e.__soliboDocumentId, e.__soliboDocumentSlot);
46
46
  }
47
47
  static importJSON(e) {
48
- return mt({
48
+ return gt({
49
49
  alt: e.alt,
50
50
  height: e.height,
51
51
  soliboDocumentId: e.soliboDocumentId,
@@ -74,21 +74,21 @@ class lt extends ne {
74
74
  return {
75
75
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
76
76
  img: (e) => ({
77
- conversion: (s) => {
78
- if (!(s instanceof HTMLImageElement))
77
+ conversion: (l) => {
78
+ if (!(l instanceof HTMLImageElement))
79
79
  return null;
80
- const m = s.getAttribute("src") ?? "";
81
- if (!m)
80
+ const _ = l.getAttribute("src") ?? "";
81
+ if (!_)
82
82
  return null;
83
- const _ = s.getAttribute("width"), o = s.getAttribute("height");
83
+ const h = l.getAttribute("width"), g = l.getAttribute("height");
84
84
  return {
85
- node: mt({
86
- alt: s.getAttribute("alt") ?? "",
87
- height: o ? Number(o) : void 0,
88
- soliboDocumentId: s.getAttribute("data-solibo-document-id") ?? void 0,
89
- soliboDocumentSlot: s.getAttribute("data-solibo-document-slot") ?? void 0,
90
- src: m,
91
- width: _ ? Number(_) : void 0
85
+ node: gt({
86
+ alt: l.getAttribute("alt") ?? "",
87
+ height: g ? Number(g) : void 0,
88
+ soliboDocumentId: l.getAttribute("data-solibo-document-id") ?? void 0,
89
+ soliboDocumentSlot: l.getAttribute("data-solibo-document-slot") ?? void 0,
90
+ src: _,
91
+ width: h ? Number(h) : void 0
92
92
  })
93
93
  };
94
94
  },
@@ -115,16 +115,16 @@ class lt extends ne {
115
115
  return this.__src;
116
116
  }
117
117
  setSrc(e) {
118
- const s = this.getWritable();
119
- return s.__src = e, s;
118
+ const l = this.getWritable();
119
+ return l.__src = e, l;
120
120
  }
121
121
  setWidth(e) {
122
- const s = this.getWritable();
123
- return s.__width = e, s.__height = void 0, s;
122
+ const l = this.getWritable();
123
+ return l.__width = e, l.__height = void 0, l;
124
124
  }
125
125
  decorate(e) {
126
- return /* @__PURE__ */ r("img", { alt: this.__alt, height: this.__height, "data-solibo-document-id": this.__soliboDocumentId, "data-solibo-document-slot": this.__soliboDocumentSlot, onClick: (s) => {
127
- s.preventDefault(), e.dispatchCommand($t, {
126
+ return /* @__PURE__ */ n("img", { alt: this.__alt, height: this.__height, "data-solibo-document-id": this.__soliboDocumentId, "data-solibo-document-slot": this.__soliboDocumentSlot, onClick: (l) => {
127
+ l.preventDefault(), e.dispatchCommand(Tt, {
128
128
  key: this.getKey(),
129
129
  soliboDocumentSlot: this.__soliboDocumentSlot,
130
130
  src: this.__src,
@@ -133,86 +133,135 @@ class lt extends ne {
133
133
  }, src: this.__src, width: this.__width });
134
134
  }
135
135
  }
136
- function mt({
137
- alt: a = "",
138
- height: n,
136
+ function gt({
137
+ alt: s = "",
138
+ height: r,
139
139
  soliboDocumentId: e,
140
- soliboDocumentSlot: s,
141
- src: m,
142
- width: _
140
+ soliboDocumentSlot: l,
141
+ src: _,
142
+ width: h
143
143
  }) {
144
- return oe(new lt(m, a, _, n, void 0, e, s));
144
+ return ee(new at(_, s, h, r, void 0, e, l));
145
145
  }
146
- function wt(a) {
147
- return a instanceof lt;
146
+ function Lt(s) {
147
+ return s instanceof at;
148
148
  }
149
- const ve = ({
150
- createImages: a
149
+ const ge = ({
150
+ createImages: s
151
151
  }) => {
152
- const [n] = Nt();
153
- return st(() => n.registerCommand(le, (e) => {
154
- var o;
152
+ const [r] = At();
153
+ return j(() => r.registerCommand(ie, (e) => {
154
+ var g;
155
155
  if (!("clipboardData" in e)) return !1;
156
- const s = e, m = Array.from(((o = s.clipboardData) == null ? void 0 : o.items) ?? []).flatMap((f) => {
157
- if (f.kind !== "file" || !f.type.startsWith("image/")) return [];
158
- const p = f.getAsFile();
159
- return p ? [p] : [];
156
+ const l = e, _ = Array.from(((g = l.clipboardData) == null ? void 0 : g.items) ?? []).flatMap((o) => {
157
+ if (o.kind !== "file" || !o.type.startsWith("image/")) return [];
158
+ const d = o.getAsFile();
159
+ return d ? [d] : [];
160
160
  });
161
- if (m.length === 0) return !1;
162
- s.preventDefault();
163
- const _ = a(m);
164
- return n.update(() => {
165
- St(_.map((f) => mt(f)));
161
+ if (_.length === 0) return !1;
162
+ l.preventDefault();
163
+ const h = s(_);
164
+ return r.update(() => {
165
+ Mt(h.map((o) => gt(o)));
166
166
  }), !0;
167
- }, ae), [a, n]), null;
168
- }, De = /(([^<>()[\]\\.,;:\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,}))/, Ie = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/, ke = [(a) => {
169
- const n = De.exec(a);
170
- return n != null && n.length ? {
171
- index: n.index,
172
- length: n[0].length,
173
- text: n[0],
174
- url: `mailto:${n[0]}`
167
+ }, ne), [s, r]), null;
168
+ }, fe = /(([^<>()[\]\\.,;:\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,}))/, pe = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/, be = [(s) => {
169
+ const r = fe.exec(s);
170
+ return r != null && r.length ? {
171
+ index: r.index,
172
+ length: r[0].length,
173
+ text: r[0],
174
+ url: `mailto:${r[0]}`
175
175
  } : null;
176
- }, (a) => {
177
- const n = Ie.exec(a);
178
- return n != null && n.length ? {
179
- index: n.index,
180
- length: n[0].length,
181
- text: n[0],
182
- url: n[0].startsWith("http") ? n[0] : `https://${n[0]}`
176
+ }, (s) => {
177
+ const r = pe.exec(s);
178
+ return r != null && r.length ? {
179
+ index: r.index,
180
+ length: r[0].length,
181
+ text: r[0],
182
+ url: r[0].startsWith("http") ? r[0] : `https://${r[0]}`
183
183
  } : null;
184
184
  }];
185
- function At(a) {
185
+ function Ct(s) {
186
186
  try {
187
- const n = new URL(a);
188
- return n.protocol === "http:" || n.protocol === "https:";
187
+ const r = new URL(s);
188
+ return r.protocol === "http:" || r.protocol === "https:";
189
189
  } catch {
190
190
  return !1;
191
191
  }
192
192
  }
193
- const Le = "_field_csex1_3", xe = "_editor_csex1_8", we = "_invalid_csex1_42", Ae = "_error_csex1_46", Ne = "_dragging_csex1_52", Se = "_content_csex1_56", Ce = "_files_csex1_71", Ee = "_placeholder_csex1_79", Me = "_fill_csex1_87", Te = "_meta_csex1_115", Oe = "_active_csex1_124", $e = "_submit_csex1_143", Re = "_bold_csex1_147", ye = "_italic_csex1_151", Pe = "_underline_csex1_155", Ue = "_link_csex1_159", Be = "_list_csex1_165", We = "_paragraph_csex1_166", d = {
194
- field: Le,
195
- editor: xe,
196
- invalid: we,
197
- error: Ae,
198
- dragging: Ne,
199
- content: Se,
200
- "has-files": "_has-files_csex1_67",
201
- files: Ce,
202
- placeholder: Ee,
203
- fill: Me,
204
- "fill-editor": "_fill-editor_csex1_95",
205
- meta: Te,
206
- active: Oe,
207
- "image-sizes": "_image-sizes_csex1_136",
208
- submit: $e,
209
- bold: Re,
210
- italic: ye,
193
+ const ve = "_field_1clme_3", De = "_editor_1clme_8", Ie = "_submit_1clme_26", ke = "_resizable_1clme_56", we = "_resized_1clme_60", Le = "_invalid_1clme_86", Ce = "_error_1clme_90", Ae = "_dragging_1clme_96", Me = "_content_1clme_100", Se = "_files_1clme_116", Ne = "_placeholder_1clme_125", Ee = "_fill_1clme_133", ye = "_meta_1clme_161", xe = "_active_1clme_170", Te = "_bold_1clme_202", Oe = "_italic_1clme_206", Pe = "_underline_1clme_210", $e = "_link_1clme_214", Re = "_list_1clme_220", Ue = "_paragraph_1clme_221", m = {
194
+ field: ve,
195
+ editor: De,
196
+ submit: Ie,
197
+ resizable: ke,
198
+ resized: we,
199
+ "resize-handle": "_resize-handle_1clme_64",
200
+ invalid: Le,
201
+ error: Ce,
202
+ dragging: Ae,
203
+ content: Me,
204
+ "has-files": "_has-files_1clme_112",
205
+ files: Se,
206
+ placeholder: Ne,
207
+ fill: Ee,
208
+ "fill-editor": "_fill-editor_1clme_141",
209
+ meta: ye,
210
+ active: xe,
211
+ "image-sizes": "_image-sizes_1clme_182",
212
+ bold: Te,
213
+ italic: Oe,
211
214
  underline: Pe,
212
- link: Ue,
213
- list: Be,
214
- paragraph: We
215
- }, Fe = [{
215
+ link: $e,
216
+ list: Re,
217
+ paragraph: Ue
218
+ };
219
+ function ze({
220
+ editableRef: s
221
+ }) {
222
+ const r = O(null), [e, l] = f(0), [_, h] = f(0);
223
+ j(() => {
224
+ const o = s.current;
225
+ if (!o) return;
226
+ const d = () => {
227
+ l(Math.round(o.getBoundingClientRect().height)), h(Math.round(parseFloat(getComputedStyle(o).minHeight) || 0));
228
+ };
229
+ if (d(), typeof ResizeObserver > "u") return;
230
+ const C = new ResizeObserver(d);
231
+ return C.observe(o), () => C.disconnect();
232
+ }, [s]);
233
+ const g = (o) => {
234
+ const d = s.current;
235
+ if (!d) return;
236
+ const C = parseFloat(getComputedStyle(d).minHeight) || 0;
237
+ d.style.height = `${Math.max(C, o)}px`;
238
+ };
239
+ return /* @__PURE__ */ n("div", { "aria-label": "Resize editor", "aria-orientation": "horizontal", "aria-valuemin": _, "aria-valuenow": e, "aria-valuetext": `${e} pixels`, className: m["resize-handle"], role: "separator", tabIndex: 0, onDoubleClick: () => {
240
+ var o;
241
+ return (o = s.current) == null ? void 0 : o.style.removeProperty("height");
242
+ }, onKeyDown: (o) => {
243
+ const d = s.current;
244
+ d && (o.key === "Home" ? (o.preventDefault(), d.style.removeProperty("height")) : (o.key === "ArrowUp" || o.key === "ArrowDown") && (o.preventDefault(), g(d.getBoundingClientRect().height + (o.key === "ArrowUp" ? 20 : -20))));
245
+ }, onPointerDown: (o) => {
246
+ const d = s.current;
247
+ o.button !== 0 || !d || (o.preventDefault(), o.currentTarget.focus({
248
+ preventScroll: !0
249
+ }), o.currentTarget.setPointerCapture(o.pointerId), r.current = {
250
+ pointerId: o.pointerId,
251
+ y: o.clientY,
252
+ height: d.getBoundingClientRect().height
253
+ });
254
+ }, onPointerMove: (o) => {
255
+ !r.current || r.current.pointerId !== o.pointerId || g(r.current.height + r.current.y - o.clientY);
256
+ }, onPointerUp: (o) => {
257
+ !r.current || r.current.pointerId !== o.pointerId || (r.current = null, o.currentTarget.releasePointerCapture(o.pointerId));
258
+ }, onLostPointerCapture: () => {
259
+ r.current = null;
260
+ }, onPointerCancel: () => {
261
+ r.current = null;
262
+ }, "data-component": "editorresizehandle" });
263
+ }
264
+ const He = [{
216
265
  label: "Small",
217
266
  width: 320
218
267
  }, {
@@ -224,347 +273,359 @@ const Le = "_field_csex1_3", xe = "_editor_csex1_8", we = "_invalid_csex1_42", A
224
273
  }, {
225
274
  label: "Original",
226
275
  width: void 0
227
- }], He = ({
228
- disabled: a = !1,
229
- isSubmitting: n = !1,
230
- onFilesSelected: e,
231
- onInlineImageRemove: s,
232
- onSubmit: m,
233
- submitLabel: _ = "Submit"
276
+ }], Be = ({
277
+ onFilesSelected: s,
278
+ onInlineImageRemove: r
234
279
  }) => {
235
- const [o] = Nt(), [f, p] = g(!1), [P, at] = g(!1), [ct, j] = g(!1), [ut, x] = g(!1), [N, b] = g(!1), [O, U] = g(!1), [Y, X] = g(""), [v, Q] = g(null), [G, $] = g(null), [_t, tt] = g(void 0), [B, S] = g(""), C = At(B.trim()), D = K(null), T = K(null), W = K(null), I = K(null), Z = K(!1), et = (t) => t.preventDefault(), q = h((t) => {
236
- I.current = Dt(t) ? t.clone() : null;
237
- }, []), V = h((t) => {
238
- o.update(() => {
239
- I.current && Ot(I.current), t();
240
- }), I.current = null;
241
- }, [o]), F = (t) => {
242
- Z.current = !0, t.preventDefault();
243
- }, i = () => {
244
- if (Z.current) {
245
- Z.current = !1;
280
+ const [e] = At(), [l, _] = f(!1), [h, g] = f(!1), [o, d] = f(!1), [C, Q] = f(!1), [F, N] = f(!1), [tt, A] = f(!1), [x, P] = f(""), [p, G] = f(null), [Z, $] = f(null), [ct, q] = f(void 0), [R, D] = f(""), ut = Ct(R.trim()), et = O(null), dt = O(null), U = O(null), T = O(null), Y = O(!1), rt = (t) => t.preventDefault(), V = b((t) => {
281
+ T.current = vt(t) ? t.clone() : null;
282
+ }, []), I = b((t) => {
283
+ e.update(() => {
284
+ T.current && xt(T.current), t();
285
+ }), T.current = null;
286
+ }, [e]), k = (t) => {
287
+ Y.current = !0, t.preventDefault();
288
+ }, z = () => {
289
+ if (Y.current) {
290
+ Y.current = !1;
246
291
  return;
247
292
  }
248
- ft();
249
- }, l = h(() => {
250
- at(!1), X(""), Q(null), $(null), tt(void 0);
251
- }, []), c = h(() => {
252
- b(!1), S("");
253
- }, []), w = h((t) => {
254
- at(!0), X((t == null ? void 0 : t.src) ?? ""), Q((t == null ? void 0 : t.key) ?? null), $((t == null ? void 0 : t.soliboDocumentSlot) ?? null), tt(t == null ? void 0 : t.width), c(), t != null && t.soliboDocumentSlot || setTimeout(() => {
255
- var u;
256
- return (u = T.current) == null ? void 0 : u.focus();
293
+ nt();
294
+ }, v = b(() => {
295
+ g(!1), P(""), G(null), $(null), q(void 0);
296
+ }, []), M = b(() => {
297
+ N(!1), D("");
298
+ }, []), mt = b((t) => {
299
+ g(!0), P((t == null ? void 0 : t.src) ?? ""), G((t == null ? void 0 : t.key) ?? null), $((t == null ? void 0 : t.soliboDocumentSlot) ?? null), q(t == null ? void 0 : t.width), M(), t != null && t.soliboDocumentSlot || setTimeout(() => {
300
+ var c;
301
+ return (c = dt.current) == null ? void 0 : c.focus();
257
302
  }, 0);
258
- }, [c]), it = h((t) => {
259
- o.getEditorState().read(() => {
260
- q(It());
261
- }), b(!0), S(t), l(), setTimeout(() => {
262
- var u;
263
- return (u = W.current) == null ? void 0 : u.focus();
303
+ }, [M]), ht = b((t) => {
304
+ e.getEditorState().read(() => {
305
+ V(Dt());
306
+ }), N(!0), D(t), v(), setTimeout(() => {
307
+ var c;
308
+ return (c = U.current) == null ? void 0 : c.focus();
264
309
  }, 0);
265
- }, [l, o, q]), ht = h(() => {
266
- const t = B.trim();
267
- At(t) && (V(() => {
268
- o.dispatchCommand(pt, {
310
+ }, [v, e, V]), it = b(() => {
311
+ const t = R.trim();
312
+ Ct(t) && (I(() => {
313
+ e.dispatchCommand(ft, {
269
314
  url: t,
270
315
  target: "_blank"
271
316
  });
272
- const u = It();
273
- if (!Dt(u)) return;
274
- const E = u.getNodes().at(-1) ?? null, H = (E == null ? void 0 : E.getParent()) ?? null, k = rt(E) ? E : rt(H) ? H : null;
275
- if (k) {
276
- const R = k.getLastChild();
277
- if (nt(R)) {
278
- const Ct = R.getTextContent(), Et = Ct.replace(/\s+$/, "");
279
- Et !== Ct && R.setTextContent(Et);
317
+ const c = Dt();
318
+ if (!vt(c)) return;
319
+ const E = c.getNodes().at(-1) ?? null, W = (E == null ? void 0 : E.getParent()) ?? null, w = ot(E) ? E : ot(W) ? W : null;
320
+ if (w) {
321
+ const H = w.getLastChild();
322
+ if (st(H)) {
323
+ const St = H.getTextContent(), Nt = St.replace(/\s+$/, "");
324
+ Nt !== St && H.setTextContent(Nt);
280
325
  }
281
- const J = k.getNextSibling();
282
- if (nt(J) && /^\s/.test(J.getTextContent())) {
283
- J.select(1, 1);
326
+ const X = w.getNextSibling();
327
+ if (st(X) && /^\s/.test(X.getTextContent())) {
328
+ X.select(1, 1);
284
329
  return;
285
330
  }
286
- const A = ce(" ");
287
- k.insertAfter(A), A.selectEnd();
331
+ const S = oe(" ");
332
+ w.insertAfter(S), S.selectEnd();
288
333
  }
289
- }), c());
290
- }, [c, o, B, V]), ft = h(() => {
291
- const t = Y.trim();
334
+ }), M());
335
+ }, [M, e, R, I]), nt = b(() => {
336
+ const t = x.trim();
292
337
  if (!t) {
293
- l();
338
+ v();
294
339
  return;
295
340
  }
296
- o.update(() => {
297
- if (v) {
298
- const u = kt(v);
299
- wt(u) && u.setSrc(t);
341
+ e.update(() => {
342
+ if (p) {
343
+ const c = It(p);
344
+ Lt(c) && c.setSrc(t);
300
345
  return;
301
346
  }
302
- St([mt({
347
+ Mt([gt({
303
348
  src: t
304
349
  })]);
305
- }), l();
306
- }, [l, o, v, Y]), Rt = h(() => {
307
- if (!v) {
308
- l();
350
+ }), v();
351
+ }, [v, e, p, x]), J = b(() => {
352
+ if (!p) {
353
+ v();
309
354
  return;
310
355
  }
311
- o.update(() => {
312
- const t = kt(v);
313
- if (wt(t)) {
314
- const u = t.getParent();
315
- ue(u) && u.getChildrenSize() === 1 ? u.remove() : t.remove(), G && (s == null || s(G));
356
+ e.update(() => {
357
+ const t = It(p);
358
+ if (Lt(t)) {
359
+ const c = t.getParent();
360
+ se(c) && c.getChildrenSize() === 1 ? c.remove() : t.remove(), Z && (r == null || r(Z));
316
361
  }
317
- }), l();
318
- }, [l, o, v, G, s]), yt = h((t) => {
319
- v && (o.update(() => {
320
- const u = kt(v);
321
- wt(u) && u.setWidth(t);
322
- }), tt(t));
323
- }, [o, v]), Pt = h(() => {
324
- V(() => {
325
- o.dispatchCommand(pt, null);
326
- }), c();
327
- }, [c, o, V]), gt = h(() => {
328
- const t = It();
329
- if (!Dt(t)) {
330
- if (de(t)) {
331
- const H = t.getNodes(), k = H[0] ?? null, R = (k == null ? void 0 : k.getParent()) ?? null;
332
- p(H.some((A) => nt(A) && A.hasFormat("bold"))), j(H.some((A) => nt(A) && A.hasFormat("italic"))), x(H.some((A) => nt(A) && A.hasFormat("underline"))), U(bt(R) || vt(R) || bt(k) || vt(k));
333
- const J = rt(k) ? k : rt(R) ? R : null;
334
- if (J) {
335
- b(!0), S(J.getURL());
362
+ }), v();
363
+ }, [v, e, p, Z, r]), i = b((t) => {
364
+ p && (e.update(() => {
365
+ const c = It(p);
366
+ Lt(c) && c.setWidth(t);
367
+ }), q(t));
368
+ }, [e, p]), a = b(() => {
369
+ I(() => {
370
+ e.dispatchCommand(ft, null);
371
+ }), M();
372
+ }, [M, e, I]), u = b(() => {
373
+ const t = Dt();
374
+ if (!vt(t)) {
375
+ if (le(t)) {
376
+ const W = t.getNodes(), w = W[0] ?? null, H = (w == null ? void 0 : w.getParent()) ?? null;
377
+ _(W.some((S) => st(S) && S.hasFormat("bold"))), d(W.some((S) => st(S) && S.hasFormat("italic"))), Q(W.some((S) => st(S) && S.hasFormat("underline"))), A(pt(H) || bt(H) || pt(w) || bt(w));
378
+ const X = ot(w) ? w : ot(H) ? H : null;
379
+ if (X) {
380
+ N(!0), D(X.getURL());
336
381
  return;
337
382
  }
338
- b(!1), S(""), I.current = null;
383
+ N(!1), D(""), T.current = null;
339
384
  return;
340
385
  }
341
- p(!1), j(!1), x(!1), U(!1), b(!1), S(""), I.current = null;
386
+ _(!1), d(!1), Q(!1), A(!1), N(!1), D(""), T.current = null;
342
387
  return;
343
388
  }
344
- const [u] = t.getNodes(), E = (u == null ? void 0 : u.getParent()) ?? null;
345
- if (p(t.hasFormat("bold")), j(t.hasFormat("italic")), x(t.hasFormat("underline")), U(bt(E) || vt(E)), rt(E)) {
346
- b(!0), S(E.getURL()), q(t);
389
+ const [c] = t.getNodes(), E = (c == null ? void 0 : c.getParent()) ?? null;
390
+ if (_(t.hasFormat("bold")), d(t.hasFormat("italic")), Q(t.hasFormat("underline")), A(pt(E) || bt(E)), ot(E)) {
391
+ N(!0), D(E.getURL()), V(t);
347
392
  return;
348
393
  }
349
- b(!1), S(""), I.current = null;
350
- }, [q]);
351
- return st(() => pe(o.registerUpdateListener(({
394
+ N(!1), D(""), T.current = null;
395
+ }, [V]);
396
+ return j(() => he(e.registerUpdateListener(({
352
397
  editorState: t
353
398
  }) => {
354
399
  t.read(() => {
355
- gt();
400
+ u();
356
401
  });
357
- }), o.registerCommand($t, (t) => (w(t), !0), Mt), o.registerCommand(me, () => (o.getEditorState().read(() => {
358
- gt();
359
- }), !1), Mt)), [o, w, gt]), /* @__PURE__ */ y(be, { variant: "editor", "data-component": "editortoolbar", children: [
360
- /* @__PURE__ */ r(L, { "aria-label": "Bold", "data-active": f, onClick: () => {
361
- o.dispatchCommand(Lt, "bold");
362
- }, title: "Bold", variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "TextB" }) }),
363
- /* @__PURE__ */ r(L, { "aria-label": "Italic", "data-active": ct, onClick: () => {
364
- o.dispatchCommand(Lt, "italic");
365
- }, title: "Italic", variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "TextItalic" }) }),
366
- /* @__PURE__ */ r(L, { "aria-label": "Underline", "data-active": ut, onClick: () => {
367
- o.dispatchCommand(Lt, "underline");
368
- }, title: "Underline", variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "TextUnderline" }) }),
369
- /* @__PURE__ */ r(L, { "aria-label": "List", "data-active": O, onClick: () => {
370
- O ? o.dispatchCommand(Kt, void 0) : o.dispatchCommand(jt, void 0);
371
- }, title: "List", variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "ListBullets" }) }),
372
- /* @__PURE__ */ r(L, { "aria-label": "Link", "data-active": N, onClick: () => {
373
- N ? it(B) : (o.dispatchCommand(pt, {
402
+ }), e.registerCommand(Tt, (t) => (mt(t), !0), Et), e.registerCommand(ae, () => (e.getEditorState().read(() => {
403
+ u();
404
+ }), !1), Et)), [e, mt, u]), /* @__PURE__ */ B(_e, { variant: "editor", "data-component": "editortoolbar", children: [
405
+ /* @__PURE__ */ n(L, { "aria-label": "Bold", "data-active": l, onClick: () => {
406
+ e.dispatchCommand(kt, "bold");
407
+ }, title: "Bold", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "TextB" }) }),
408
+ /* @__PURE__ */ n(L, { "aria-label": "Italic", "data-active": o, onClick: () => {
409
+ e.dispatchCommand(kt, "italic");
410
+ }, title: "Italic", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "TextItalic" }) }),
411
+ /* @__PURE__ */ n(L, { "aria-label": "Underline", "data-active": C, onClick: () => {
412
+ e.dispatchCommand(kt, "underline");
413
+ }, title: "Underline", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "TextUnderline" }) }),
414
+ /* @__PURE__ */ n(L, { "aria-label": "List", "data-active": tt, onClick: () => {
415
+ tt ? e.dispatchCommand(Ht, void 0) : e.dispatchCommand(Bt, void 0);
416
+ }, title: "List", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "ListBullets" }) }),
417
+ /* @__PURE__ */ n(L, { "aria-label": "Link", "data-active": F, onClick: () => {
418
+ F ? ht(R) : (e.dispatchCommand(ft, {
374
419
  url: "https://"
375
- }), it("https://"));
376
- }, title: "Link", variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "Link" }) }),
377
- e && /* @__PURE__ */ y(dt, { children: [
378
- /* @__PURE__ */ r("input", { hidden: !0, multiple: !0, onChange: (t) => {
379
- t.target.files && e(t.target.files), t.target.value = "";
380
- }, ref: D, type: "file" }),
381
- /* @__PURE__ */ r(L, { "aria-label": "Upload files", onClick: () => {
420
+ }), ht("https://"));
421
+ }, title: "Link", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Link" }) }),
422
+ s && /* @__PURE__ */ B(_t, { children: [
423
+ /* @__PURE__ */ n("input", { hidden: !0, multiple: !0, onChange: (t) => {
424
+ t.target.files && s(t.target.files), t.target.value = "";
425
+ }, ref: et, type: "file" }),
426
+ /* @__PURE__ */ n(L, { "aria-label": "Upload files", onClick: () => {
382
427
  var t;
383
- return (t = D.current) == null ? void 0 : t.click();
384
- }, title: "Upload files", variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "Paperclip" }) })
428
+ return (t = et.current) == null ? void 0 : t.click();
429
+ }, title: "Upload files", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Paperclip" }) })
385
430
  ] }),
386
- m && /* @__PURE__ */ r(L, { "aria-label": _, className: d.submit, "data-cy": "toolbar-submit-button", disabled: a, icon: "PaperPlaneTilt", isLoading: n, onClick: () => m(), variant: "primary", children: /* @__PURE__ */ r("span", { children: _ }) }),
387
- /* @__PURE__ */ y("div", { className: ot(d.meta, N || P ? d.active : ""), children: [
388
- N && /* @__PURE__ */ y(dt, { children: [
389
- /* @__PURE__ */ r(Tt, { "aria-invalid": !C, onBlur: () => ht(), onChange: (t) => S(t.target.value), onKeyDown: (t) => {
390
- t.key === "Enter" && (t.preventDefault(), ht());
391
- }, ref: W, value: B }),
392
- /* @__PURE__ */ r(L, { "aria-label": "Apply link", disabled: !C, onClick: () => {
393
- ht();
394
- }, onMouseDown: et, variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "Check" }) }),
395
- /* @__PURE__ */ r(L, { "aria-label": "Remove link", onClick: () => Pt(), onMouseDown: et, variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "Trash", variant: "danger" }) })
431
+ /* @__PURE__ */ B("div", { className: lt(m.meta, F || h ? m.active : ""), children: [
432
+ F && /* @__PURE__ */ B(_t, { children: [
433
+ /* @__PURE__ */ n(yt, { "aria-invalid": !ut, onBlur: () => it(), onChange: (t) => D(t.target.value), onKeyDown: (t) => {
434
+ t.key === "Enter" && (t.preventDefault(), it());
435
+ }, ref: U, value: R }),
436
+ /* @__PURE__ */ n(L, { "aria-label": "Apply link", disabled: !ut, onClick: () => {
437
+ it();
438
+ }, onMouseDown: rt, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Check" }) }),
439
+ /* @__PURE__ */ n(L, { "aria-label": "Remove link", onClick: () => a(), onMouseDown: rt, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Trash", variant: "danger" }) })
396
440
  ] }),
397
- P && /* @__PURE__ */ y(dt, { children: [
398
- !G && /* @__PURE__ */ y(dt, { children: [
399
- /* @__PURE__ */ r(Tt, { className: ot(d.active), onBlur: i, onChange: (t) => X(t.target.value), onKeyDown: (t) => {
400
- t.key === "Enter" && (t.preventDefault(), Z.current = !0, ft());
401
- }, ref: T, value: Y }),
402
- /* @__PURE__ */ r(L, { "aria-label": "Apply image", onClick: () => ft(), onMouseDown: F, variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "Check" }) })
441
+ h && /* @__PURE__ */ B(_t, { children: [
442
+ !Z && /* @__PURE__ */ B(_t, { children: [
443
+ /* @__PURE__ */ n(yt, { className: lt(m.active), onBlur: z, onChange: (t) => P(t.target.value), onKeyDown: (t) => {
444
+ t.key === "Enter" && (t.preventDefault(), Y.current = !0, nt());
445
+ }, ref: dt, value: x }),
446
+ /* @__PURE__ */ n(L, { "aria-label": "Apply image", onClick: () => nt(), onMouseDown: k, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Check" }) })
403
447
  ] }),
404
- /* @__PURE__ */ r("div", { className: d["image-sizes"], children: Fe.map(({
448
+ /* @__PURE__ */ n("div", { className: m["image-sizes"], children: He.map(({
405
449
  label: t,
406
- width: u
407
- }) => /* @__PURE__ */ r(L, { "aria-label": `${t} image`, "data-active": _t === u, onClick: () => yt(u), onMouseDown: et, variant: "tertiary", children: t }, t)) }),
408
- /* @__PURE__ */ r(L, { "aria-label": "Remove image", onClick: () => Rt(), onMouseDown: F, variant: "tertiary", children: /* @__PURE__ */ r(M, { name: "Trash", variant: "danger" }) })
450
+ width: c
451
+ }) => /* @__PURE__ */ n(L, { "aria-label": `${t} image`, "data-active": ct === c, onClick: () => i(c), onMouseDown: rt, variant: "tertiary", children: t }, t)) }),
452
+ /* @__PURE__ */ n(L, { "aria-label": "Remove image", onClick: () => J(), onMouseDown: k, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Trash", variant: "danger" }) })
409
453
  ] })
410
454
  ] })
411
455
  ] });
412
- }, ze = _e({
456
+ }, Fe = ce({
413
457
  name: "solibo-editor",
414
458
  namespace: "Editor",
415
- nodes: [Ht, zt, Gt, Zt, lt],
416
- onError(a) {
417
- throw a;
459
+ nodes: [Ut, zt, Ft, Wt, at],
460
+ onError(s) {
461
+ throw s;
418
462
  },
419
463
  theme: {
420
- link: d.link,
464
+ link: m.link,
421
465
  list: {
422
- ol: d.list,
423
- ul: d.list
466
+ ol: m.list,
467
+ ul: m.list
424
468
  },
425
- paragraph: d.paragraph,
469
+ paragraph: m.paragraph,
426
470
  text: {
427
- bold: d.bold,
428
- italic: d.italic,
429
- underline: d.underline
471
+ bold: m.bold,
472
+ italic: m.italic,
473
+ underline: m.underline
430
474
  }
431
475
  }
432
476
  });
433
- function Ke({
434
- autofocus: a,
435
- content: n = "",
477
+ function We({
478
+ autofocus: s,
479
+ content: r = "",
436
480
  lastEmittedContentRef: e
437
481
  }) {
438
- const [s] = Nt();
439
- return st(() => {
440
- e.current !== n && s.update(() => {
441
- const _ = new DOMParser().parseFromString(n, "text/html"), o = Ft(s, _), f = he();
442
- f.clear().select(), St(o), a ? f.selectEnd() : Ot(null);
482
+ const [l] = At();
483
+ return j(() => {
484
+ e.current !== r && l.update(() => {
485
+ const h = new DOMParser().parseFromString(r, "text/html"), g = Rt(l, h), o = ue();
486
+ o.clear().select(), Mt(g), s ? o.selectEnd() : xt(null);
443
487
  });
444
- }, [a, n, s, e]), null;
488
+ }, [s, r, l, e]), null;
445
489
  }
446
- const pi = ({
447
- autofocus: a = !1,
448
- autolink: n = !1,
490
+ const fr = ({
491
+ autofocus: s = !1,
492
+ autolink: r = !1,
449
493
  content: e,
450
- disabled: s = !1,
451
- errorMessage: m,
452
- fill: _ = !1,
453
- files: o,
454
- inline: f = !1,
455
- inlineImages: p,
456
- invalid: P = !1,
457
- isSubmitting: at = !1,
458
- maxRows: ct = 12,
459
- minRows: j = 1,
460
- onChange: ut,
461
- onFilesChange: x,
462
- onInlineImagesChange: N,
463
- onSubmit: b,
464
- onUpload: O,
465
- placeholder: U,
466
- required: Y = !1,
467
- submitLabel: X
494
+ disabled: l = !1,
495
+ errorMessage: _,
496
+ fill: h = !1,
497
+ files: g,
498
+ inline: o = !1,
499
+ inlineImages: d,
500
+ invalid: C = !1,
501
+ isSubmitting: Q = !1,
502
+ maxRows: F = 12,
503
+ minRows: N = 1,
504
+ onChange: tt,
505
+ onFilesChange: A,
506
+ onInlineImagesChange: x,
507
+ onSubmit: P,
508
+ onUpload: p,
509
+ placeholder: G,
510
+ required: Z = !1,
511
+ resizable: $ = !1,
512
+ submitLabel: ct = "Submit"
468
513
  }) => {
469
- const v = fe(), Q = K(void 0), [G, $] = g(!1), [_t, tt] = g([]), [B, S] = g([]), C = K(/* @__PURE__ */ new Map()), D = o ?? _t, T = p ?? B, W = (i) => {
470
- o === void 0 && tt(i), x == null || x(i);
471
- }, I = h((i) => {
472
- p === void 0 && S(i), N == null || N(i);
473
- }, [p, N]), Z = h((i) => {
474
- const l = i.map((c) => {
475
- const w = `pasted-${crypto.randomUUID()}`, it = URL.createObjectURL(c);
476
- return C.current.set(w, it), {
514
+ const q = de(), R = O(void 0), D = O(null), [ut, et] = f(!1), [dt, U] = f(!1), [T, Y] = f([]), [rt, V] = f([]), I = O(/* @__PURE__ */ new Map()), k = g ?? T, z = d ?? rt;
515
+ j(() => {
516
+ const i = D.current;
517
+ if (!i) return;
518
+ if (!$ || h) {
519
+ i.style.removeProperty("height"), et(!1);
520
+ return;
521
+ }
522
+ const a = () => et(i.style.height !== ""), u = new MutationObserver(a);
523
+ return u.observe(i, {
524
+ attributes: !0,
525
+ attributeFilter: ["style"]
526
+ }), a(), () => u.disconnect();
527
+ }, [h, $]);
528
+ const v = (i) => {
529
+ g === void 0 && Y(i), A == null || A(i);
530
+ }, M = b((i) => {
531
+ d === void 0 && V(i), x == null || x(i);
532
+ }, [d, x]), mt = b((i) => {
533
+ const a = i.map((u) => {
534
+ const t = `pasted-${crypto.randomUUID()}`, c = URL.createObjectURL(u);
535
+ return I.current.set(t, c), {
477
536
  image: {
478
- alt: c.name,
479
- soliboDocumentSlot: w,
480
- src: it
537
+ alt: u.name,
538
+ soliboDocumentSlot: t,
539
+ src: c
481
540
  },
482
541
  pending: {
483
- file: c,
484
- slot: w
542
+ file: u,
543
+ slot: t
485
544
  }
486
545
  };
487
546
  });
488
- return I([...T, ...l.map(({
489
- pending: c
490
- }) => c)]), l.map(({
491
- image: c
492
- }) => c);
493
- }, [T, I]), et = h((i) => {
494
- I(T.filter((c) => c.slot !== i));
495
- const l = C.current.get(i);
496
- l && URL.revokeObjectURL(l), C.current.delete(i);
497
- }, [T, I]);
498
- st(() => () => {
499
- C.current.forEach((i) => URL.revokeObjectURL(i)), C.current.clear();
500
- }, []), st(() => {
501
- const i = new Set(T.map((l) => l.slot));
502
- C.current.forEach((l, c) => {
503
- i.has(c) || (URL.revokeObjectURL(l), C.current.delete(c));
547
+ return M([...z, ...a.map(({
548
+ pending: u
549
+ }) => u)]), a.map(({
550
+ image: u
551
+ }) => u);
552
+ }, [z, M]), ht = b((i) => {
553
+ M(z.filter((u) => u.slot !== i));
554
+ const a = I.current.get(i);
555
+ a && URL.revokeObjectURL(a), I.current.delete(i);
556
+ }, [z, M]);
557
+ j(() => () => {
558
+ I.current.forEach((i) => URL.revokeObjectURL(i)), I.current.clear();
559
+ }, []), j(() => {
560
+ const i = new Set(z.map((a) => a.slot));
561
+ I.current.forEach((a, u) => {
562
+ i.has(u) || (URL.revokeObjectURL(a), I.current.delete(u));
504
563
  });
505
- }, [T]);
506
- const q = (i) => {
564
+ }, [z]);
565
+ const it = (i) => {
507
566
  if (typeof DataTransfer < "u") {
508
- const l = new DataTransfer();
509
- return i.forEach((c) => l.items.add(c)), l.files;
567
+ const a = new DataTransfer();
568
+ return i.forEach((u) => a.items.add(u)), a.files;
510
569
  }
511
570
  return Object.assign([...i], {
512
- item: (l) => i[l] ?? null
571
+ item: (a) => i[a] ?? null
513
572
  });
514
- }, V = async () => {
573
+ }, nt = async () => {
515
574
  try {
516
- D.length > 0 && await (O == null ? void 0 : O(q(D))), await (b == null ? void 0 : b()), D.length > 0 && W([]);
575
+ k.length > 0 && await (p == null ? void 0 : p(it(k))), await (P == null ? void 0 : P()), k.length > 0 && v([]);
517
576
  } catch {
518
577
  return;
519
578
  }
520
- }, F = (i) => {
579
+ }, J = (i) => {
521
580
  i.preventDefault(), i.stopPropagation();
522
581
  };
523
- return /* @__PURE__ */ y("div", { className: ot(d.field, _ && d.fill), "data-max-rows": ct, "data-min-rows": j, onDragEnter: (i) => {
524
- F(i), $(!!x);
582
+ return /* @__PURE__ */ B("div", { className: lt(m.field, h && m.fill), "data-max-rows": F, "data-min-rows": N, onDragEnter: (i) => {
583
+ J(i), U(!!A);
525
584
  }, onDragOver: (i) => {
526
- F(i), $(!!x);
585
+ J(i), U(!!A);
527
586
  }, onDragLeave: (i) => {
528
- F(i), $(!1);
587
+ J(i), U(!1);
529
588
  }, onDropCapture: (i) => {
530
- var c;
531
- const l = (c = i.dataTransfer) == null ? void 0 : c.files;
532
- l != null && l.length && (F(i), (x || O) && W([...D, ...Array.from(l)]), $(!1));
589
+ var u;
590
+ const a = (u = i.dataTransfer) == null ? void 0 : u.files;
591
+ a != null && a.length && (J(i), (A || p) && v([...k, ...Array.from(a)]), U(!1));
533
592
  }, onDrop: (i) => {
534
- i.preventDefault(), $(!1);
593
+ i.preventDefault(), U(!1);
535
594
  }, "data-component": "editor", children: [
536
- /* @__PURE__ */ r("div", { className: ot(d.editor, _ && d["fill-editor"], P && d.invalid, D.length > 0 && d["has-files"]), style: {
537
- "--editor-max-height": `calc(${ct * 1.25}em + (2 * var(--scale-8)))`,
538
- "--editor-min-height": `calc(${j * 1.25}em + (2 * var(--scale-8)))`
539
- }, children: /* @__PURE__ */ y(Xt, { contentEditable: null, extension: ze, children: [
540
- !f && /* @__PURE__ */ r(He, { disabled: s, isSubmitting: at, onInlineImageRemove: et, onFilesSelected: O || x ? (i) => {
541
- W([...D, ...Array.from(i)]);
542
- } : void 0, onSubmit: b ? () => void V() : void 0, submitLabel: X }),
543
- /* @__PURE__ */ r("div", { className: ot(d.content, G && d.dragging), children: /* @__PURE__ */ r(re, { contentEditable: /* @__PURE__ */ r(Jt, { "aria-placeholder": U ?? "", ariaErrorMessage: P && m ? v : void 0, ariaInvalid: P || void 0, ariaRequired: Y || void 0, placeholder: () => U ? /* @__PURE__ */ r("div", { className: d.placeholder, children: U }) : null }), ErrorBoundary: Yt }) }),
544
- D.length > 0 && /* @__PURE__ */ r("div", { "aria-label": "Files to upload", className: d.files, role: "region", children: D.map((i, l) => /* @__PURE__ */ r(ge, { deleteAccessibleLabel: `Remove ${i.name} from upload queue`, name: i.name, onDelete: () => W(D.filter((c, w) => w !== l)) }, `${i.name}-${i.size}-${i.lastModified}-${l}`)) }),
545
- a && /* @__PURE__ */ r(qt, {}),
546
- n && /* @__PURE__ */ r(Vt, { matchers: ke }),
547
- /* @__PURE__ */ r(Qt, {}),
548
- N && /* @__PURE__ */ r(ve, { createImages: Z }),
549
- e !== void 0 && /* @__PURE__ */ r(Ke, { autofocus: a, content: e, lastEmittedContentRef: Q }),
550
- /* @__PURE__ */ r(te, { validateUrl: At }),
551
- /* @__PURE__ */ r(ee, {}),
552
- ut && /* @__PURE__ */ r(ie, { onChange: (i, l) => {
595
+ $ === "top" && !h && /* @__PURE__ */ n(ze, { editableRef: D }),
596
+ /* @__PURE__ */ n("div", { className: lt(m.editor, h && m["fill-editor"], $ === !0 && !h && m.resizable, $ && !h && ut && m.resized, C && m.invalid, k.length > 0 && m["has-files"]), style: {
597
+ "--editor-max-height": `calc(${F * 1.25}em + (2 * var(--scale-8)))`,
598
+ "--editor-min-height": `calc(${N * 1.25}em + (2 * var(--scale-8)))`
599
+ }, children: /* @__PURE__ */ B(qt, { contentEditable: null, extension: Fe, children: [
600
+ !o && /* @__PURE__ */ n(Be, { onInlineImageRemove: ht, onFilesSelected: p || A ? (i) => {
601
+ v([...k, ...Array.from(i)]);
602
+ } : void 0 }),
603
+ /* @__PURE__ */ n("div", { className: lt(m.content, dt && m.dragging), children: /* @__PURE__ */ n(Qt, { contentEditable: /* @__PURE__ */ n(Gt, { ref: D, "aria-placeholder": G ?? "", ariaErrorMessage: C && _ ? q : void 0, ariaInvalid: C || void 0, ariaRequired: Z || void 0, placeholder: () => G ? /* @__PURE__ */ n("div", { className: m.placeholder, children: G }) : null }), ErrorBoundary: Zt }) }),
604
+ !o && P && /* @__PURE__ */ n("div", { className: m.submit, children: /* @__PURE__ */ n(L, { "aria-label": ct, "data-cy": "toolbar-submit-button", disabled: l, icon: "PaperPlaneTilt", isLoading: Q, onClick: () => void nt(), variant: "primary", children: /* @__PURE__ */ n("span", { children: ct }) }) }),
605
+ k.length > 0 && /* @__PURE__ */ n("div", { "aria-label": "Files to upload", className: m.files, role: "region", children: k.map((i, a) => /* @__PURE__ */ n(me, { deleteAccessibleLabel: `Remove ${i.name} from upload queue`, name: i.name, onDelete: () => v(k.filter((u, t) => t !== a)) }, `${i.name}-${i.size}-${i.lastModified}-${a}`)) }),
606
+ s && /* @__PURE__ */ n(Kt, {}),
607
+ r && /* @__PURE__ */ n(jt, { matchers: be }),
608
+ /* @__PURE__ */ n(Yt, {}),
609
+ x && /* @__PURE__ */ n(ge, { createImages: mt }),
610
+ e !== void 0 && /* @__PURE__ */ n(We, { autofocus: s, content: e, lastEmittedContentRef: R }),
611
+ /* @__PURE__ */ n(Vt, { validateUrl: Ct }),
612
+ /* @__PURE__ */ n(Jt, {}),
613
+ tt && /* @__PURE__ */ n(Xt, { onChange: (i, a) => {
553
614
  i.read(() => {
554
- const c = Wt(l, null), w = xt(c, {
615
+ const u = $t(a, null), t = wt(u, {
555
616
  allowedAttributes: {
556
- ...xt.defaults.allowedAttributes,
557
- img: [...xt.defaults.allowedAttributes.img ?? [], "data-solibo-document-id", "data-solibo-document-slot"]
617
+ ...wt.defaults.allowedAttributes,
618
+ img: [...wt.defaults.allowedAttributes.img ?? [], "data-solibo-document-id", "data-solibo-document-slot"]
558
619
  },
559
620
  allowedTags: ["a", "b", "br", "i", "img", "li", "ol", "p", "u", "ul"]
560
621
  });
561
- Q.current = w, ut(w);
622
+ R.current = t, tt(t);
562
623
  });
563
624
  } })
564
625
  ] }) }),
565
- P && m && /* @__PURE__ */ r("div", { className: d.error, id: v, children: m })
626
+ C && _ && /* @__PURE__ */ n("div", { className: m.error, id: q, children: _ })
566
627
  ] });
567
628
  };
568
629
  export {
569
- pi as Editor
630
+ fr as Editor
570
631
  };