@tempots/beatui 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { HeadingNode as ht, QuoteNode as bt, registerRichText as Pt, $createHeadingNode as V, $createQuoteNode as Be } from "@lexical/rich-text";
1
+ import { HeadingNode as ht, QuoteNode as bt, registerRichText as Pt, $createHeadingNode as W, $createQuoteNode as Be } from "@lexical/rich-text";
2
2
  import { ListNode as Bt, ListItemNode as $t, registerList as _e, registerCheckList as dt, INSERT_ORDERED_LIST_COMMAND as ke, insertList as Ae, INSERT_UNORDERED_LIST_COMMAND as Ee, INSERT_CHECK_LIST_COMMAND as yt, REMOVE_LIST_COMMAND as Ut, removeList as zt, $isListNode as jt } from "@lexical/list";
3
3
  import { INSERT_CHECK_LIST_COMMAND as Mi, INSERT_ORDERED_LIST_COMMAND as Li, INSERT_UNORDERED_LIST_COMMAND as _i, REMOVE_LIST_COMMAND as Ai } from "@lexical/list";
4
4
  import * as Ce from "@lexical/table";
@@ -10,14 +10,14 @@ import { HashtagNode as ze } from "@lexical/hashtag";
10
10
  import { MarkNode as oo, $wrapSelectionInMarkNode as no, $isMarkNode as pt, $getMarkIDs as io, $unwrapMarkNode as ro } from "@lexical/mark";
11
11
  import { OverflowNode as lo } from "@lexical/overflow";
12
12
  import * as ao from "lexical";
13
- import { $applyNodeReplacement as so, DecoratorNode as co, COMMAND_PRIORITY_LOW as K, TextNode as vt, KEY_ARROW_DOWN_COMMAND as uo, KEY_ARROW_UP_COMMAND as fo, KEY_ENTER_COMMAND as mo, KEY_ESCAPE_COMMAND as po, $getSelection as A, $isRangeSelection as R, $isTextNode as me, createCommand as je, $createParagraphNode as de, $getRoot as be, $insertNodes as go, CLICK_COMMAND as xt, $getNodeByKey as Ct, ParagraphNode as ho, $isElementNode as Te, $isRootNode as bo, createEditor as Ge, BLUR_COMMAND as Je, FORMAT_TEXT_COMMAND as te, INDENT_CONTENT_COMMAND as yo, OUTDENT_CONTENT_COMMAND as vo, UNDO_COMMAND as xo, REDO_COMMAND as Co, SELECTION_CHANGE_COMMAND as kt } from "lexical";
13
+ import { $applyNodeReplacement as so, DecoratorNode as co, COMMAND_PRIORITY_LOW as K, TextNode as xt, KEY_ARROW_DOWN_COMMAND as uo, KEY_ARROW_UP_COMMAND as fo, KEY_ENTER_COMMAND as mo, KEY_ESCAPE_COMMAND as po, $getSelection as A, $isRangeSelection as R, $isTextNode as me, createCommand as je, $createParagraphNode as de, $getRoot as be, $insertNodes as go, CLICK_COMMAND as vt, $getNodeByKey as Ct, ParagraphNode as ho, $isElementNode as Te, $isRootNode as bo, createEditor as Ge, BLUR_COMMAND as Je, FORMAT_TEXT_COMMAND as te, INDENT_CONTENT_COMMAND as yo, OUTDENT_CONTENT_COMMAND as xo, UNDO_COMMAND as vo, REDO_COMMAND as Co, SELECTION_CHANGE_COMMAND as kt } from "lexical";
14
14
  import { BLUR_COMMAND as Ii, CLEAR_EDITOR_COMMAND as Di, CLICK_COMMAND as Fi, COMMAND_PRIORITY_CRITICAL as Hi, COMMAND_PRIORITY_EDITOR as Pi, COMMAND_PRIORITY_HIGH as Bi, COMMAND_PRIORITY_LOW as $i, COMMAND_PRIORITY_NORMAL as Ui, COPY_COMMAND as zi, CUT_COMMAND as ji, DecoratorNode as Gi, ElementNode as Ji, FOCUS_COMMAND as Ki, FORMAT_ELEMENT_COMMAND as qi, FORMAT_TEXT_COMMAND as Yi, INDENT_CONTENT_COMMAND as Wi, INSERT_PARAGRAPH_COMMAND as Vi, KEY_ENTER_COMMAND as Zi, KEY_ESCAPE_COMMAND as Xi, KEY_TAB_COMMAND as Qi, OUTDENT_CONTENT_COMMAND as er, PASTE_COMMAND as tr, REDO_COMMAND as or, SELECTION_CHANGE_COMMAND as nr, TextNode as ir, UNDO_COMMAND as rr, createCommand as lr } from "lexical";
15
15
  import { registerPlainText as ko } from "@lexical/plain-text";
16
16
  import { createEmptyHistoryState as Eo, registerHistory as To } from "@lexical/history";
17
17
  import "@lexical/clipboard";
18
18
  import { $convertToMarkdownString as So, TRANSFORMERS as No, $convertFromMarkdownString as Oo } from "@lexical/markdown";
19
19
  import { $generateHtmlFromNodes as wo, $generateNodesFromDOM as Mo } from "@lexical/html";
20
- import { $setBlocksType as Y, $getSelectionStyleValueForProperty as ve, $patchStyleText as xe } from "@lexical/selection";
20
+ import { $setBlocksType as q, $getSelectionStyleValueForProperty as xe, $patchStyleText as ve } from "@lexical/selection";
21
21
  import { registerLexicalTextEntity as Lo } from "@lexical/text";
22
22
  import { mergeRegister as He, isHTMLElement as _o } from "@lexical/utils";
23
23
  import * as Ao from "@lexical/offset";
@@ -25,10 +25,10 @@ import * as Ie from "@lexical/dragon";
25
25
  import "@lexical/file";
26
26
  import { createBinding as Ro } from "@lexical/yjs";
27
27
  import "@lexical/headless";
28
- import { Use as ue, html as D, Task as Ke, attr as d, Value as U, WithElement as oe, OnDispose as ne, Ensure as Se, signal as z, on as X, prop as j, When as pe, style as W, aria as Pe, ForEach as Io, computedOf as Do } from "@tempots/dom";
28
+ import { Use as ue, html as D, Task as Ke, attr as f, Value as U, WithElement as oe, OnDispose as ne, Ensure as Se, signal as z, on as ee, prop as j, When as pe, style as Y, aria as Pe, ForEach as Io, computedOf as Do } from "@tempots/dom";
29
29
  import { L as qe } from "../link-portal-Cr2l9f3k.js";
30
30
  import { T as Ye } from "../theme-kQZEeusG.js";
31
- import { M as Et, a as le, b as Fo } from "../menu-B8yoDMRS.js";
31
+ import { M as Et, a as le, b as Fo } from "../menu-BkqFGcXg.js";
32
32
  import { B as ye, I as Z } from "../translations-B1_yyDUK.js";
33
33
  import { E as Ho, a as gt } from "../editor-toolbar-group-Crlu1QJw.js";
34
34
  import { delayedAnimationFrame as Po } from "@tempots/std";
@@ -144,8 +144,8 @@ async function Xe(e) {
144
144
  return ko(e);
145
145
  }
146
146
  async function Qe(e, t) {
147
- const l = Eo(), a = t?.delay ?? 300;
148
- return To(e, l, a);
147
+ const r = Eo(), l = t?.delay ?? 300;
148
+ return To(e, r, l);
149
149
  }
150
150
  async function et(e) {
151
151
  return () => {
@@ -182,103 +182,103 @@ async function ot(e) {
182
182
  K
183
183
  );
184
184
  }
185
- async function Zn(e, t, l) {
186
- const a = t?.trigger || "/";
187
- let i = !1, s = null, p = 0;
188
- const x = () => e.getEditorState().read(() => {
189
- const b = A();
190
- if (!R(b) || !b.isCollapsed())
185
+ async function Zn(e, t, r) {
186
+ const l = t?.trigger || "/";
187
+ let n = !1, s = null, g = 0;
188
+ const v = () => e.getEditorState().read(() => {
189
+ const y = A();
190
+ if (!R(y) || !y.isCollapsed())
191
191
  return !1;
192
- const v = b.anchor, S = v.getNode();
193
- if (!me(S))
192
+ const x = y.anchor, T = x.getNode();
193
+ if (!me(T))
194
194
  return !1;
195
- const M = S.getTextContent(), B = v.offset;
196
- if (B === 0 || M[B - 1] !== a)
195
+ const O = T.getTextContent(), I = x.offset;
196
+ if (I === 0 || O[I - 1] !== l)
197
197
  return !1;
198
- if (B === 1)
198
+ if (I === 1)
199
199
  return !0;
200
- const h = M[B - 2];
201
- return !!/\s/.test(h);
202
- }), w = () => s ? e.getEditorState().read(() => {
200
+ const b = O[I - 2];
201
+ return !!/\s/.test(b);
202
+ }), L = () => s ? e.getEditorState().read(() => {
203
203
  if (!s) return "";
204
- const b = s.getTextContent(), v = b.indexOf(a, p);
205
- if (v === -1) return "";
206
- const S = A();
207
- if (!R(S)) return "";
208
- const M = S.anchor;
209
- if (M.getNode().getKey() !== s.getKey())
204
+ const y = s.getTextContent(), x = y.indexOf(l, g);
205
+ if (x === -1) return "";
206
+ const T = A();
207
+ if (!R(T)) return "";
208
+ const O = T.anchor;
209
+ if (O.getNode().getKey() !== s.getKey())
210
210
  return "";
211
- const E = M.offset;
212
- return E <= v ? "" : b.slice(v + 1, E);
213
- }) : "", L = () => {
211
+ const k = O.offset;
212
+ return k <= x ? "" : y.slice(x + 1, k);
213
+ }) : "", M = () => {
214
214
  e.getEditorState().read(() => {
215
- const b = A();
216
- if (R(b)) {
217
- const v = b.anchor, S = v.getNode();
218
- if (me(S)) {
219
- s = S, p = v.offset - 1, i = !0;
220
- const M = {
215
+ const y = A();
216
+ if (R(y)) {
217
+ const x = y.anchor, T = x.getNode();
218
+ if (me(T)) {
219
+ s = T, g = x.offset - 1, n = !0;
220
+ const O = {
221
221
  isActive: !0,
222
222
  filterText: "",
223
223
  anchorNode: s,
224
- anchorOffset: p
224
+ anchorOffset: g
225
225
  };
226
- l?.onTrigger?.(M, N), l?.onUpdate?.(M, N);
226
+ r?.onTrigger?.(O, N), r?.onUpdate?.(O, N);
227
227
  }
228
228
  }
229
229
  });
230
- }, g = () => {
231
- i && (i = !1, s = null, p = 0, l?.onClose?.());
230
+ }, h = () => {
231
+ n && (n = !1, s = null, g = 0, r?.onClose?.());
232
232
  }, N = () => {
233
233
  s && e.update(() => {
234
234
  if (!s) return;
235
- const b = s.getTextContent(), v = b.indexOf(a, p);
236
- if (v === -1) return;
237
- const S = A();
238
- if (!R(S)) return;
239
- const M = S.anchor;
240
- if (M.getNode().getKey() !== s.getKey()) return;
241
- const E = M.offset, h = b.slice(0, v), _ = b.slice(E);
242
- s.setTextContent(h + _);
243
- const r = A();
244
- R(r) && (r.anchor.set(s.getKey(), v, "text"), r.focus.set(s.getKey(), v, "text"));
235
+ const y = s.getTextContent(), x = y.indexOf(l, g);
236
+ if (x === -1) return;
237
+ const T = A();
238
+ if (!R(T)) return;
239
+ const O = T.anchor;
240
+ if (O.getNode().getKey() !== s.getKey()) return;
241
+ const k = O.offset, b = y.slice(0, x), w = y.slice(k);
242
+ s.setTextContent(b + w);
243
+ const a = A();
244
+ R(a) && (a.anchor.set(s.getKey(), x, "text"), a.focus.set(s.getKey(), x, "text"));
245
245
  });
246
- }, y = () => {
247
- if (!i) return;
248
- const v = {
246
+ }, E = () => {
247
+ if (!n) return;
248
+ const x = {
249
249
  isActive: !0,
250
- filterText: w(),
250
+ filterText: L(),
251
251
  anchorNode: s,
252
- anchorOffset: p
252
+ anchorOffset: g
253
253
  };
254
- l?.onUpdate?.(v, N);
255
- }, f = e.registerMutationListener(
256
- vt,
257
- (b) => {
258
- if (!i && x()) {
259
- L();
254
+ r?.onUpdate?.(x, N);
255
+ }, m = e.registerMutationListener(
256
+ xt,
257
+ (y) => {
258
+ if (!n && v()) {
259
+ M();
260
260
  return;
261
261
  }
262
- i && (s && !b.has(s.getKey()) ? y() : g());
262
+ n && (s && !y.has(s.getKey()) ? E() : h());
263
263
  }
264
- ), k = He(
264
+ ), C = He(
265
265
  // Handle selection changes - deactivate if selection moves away
266
- e.registerUpdateListener(({ editorState: b }) => {
267
- b.read(() => {
268
- if (!i) return;
269
- const v = A();
270
- if (!R(v)) {
271
- g();
266
+ e.registerUpdateListener(({ editorState: y }) => {
267
+ y.read(() => {
268
+ if (!n) return;
269
+ const x = A();
270
+ if (!R(x)) {
271
+ h();
272
272
  return;
273
273
  }
274
- const S = v.anchor, M = S.getNode();
275
- if (!s || M.getKey() !== s.getKey()) {
276
- g();
274
+ const T = x.anchor, O = T.getNode();
275
+ if (!s || O.getKey() !== s.getKey()) {
276
+ h();
277
277
  return;
278
278
  }
279
- const E = s.getTextContent().indexOf(a, p);
280
- if (E === -1 || S.offset <= E) {
281
- g();
279
+ const k = s.getTextContent().indexOf(l, g);
280
+ if (k === -1 || T.offset <= k) {
281
+ h();
282
282
  return;
283
283
  }
284
284
  });
@@ -286,33 +286,33 @@ async function Zn(e, t, l) {
286
286
  // Prevent default arrow key behavior when palette is active
287
287
  e.registerCommand(
288
288
  uo,
289
- (b) => i ? (b.preventDefault(), !0) : !1,
289
+ (y) => n ? (y.preventDefault(), !0) : !1,
290
290
  K
291
291
  ),
292
292
  e.registerCommand(
293
293
  fo,
294
- (b) => i ? (b.preventDefault(), !0) : !1,
294
+ (y) => n ? (y.preventDefault(), !0) : !1,
295
295
  K
296
296
  ),
297
297
  // Prevent default enter behavior when palette is active
298
298
  e.registerCommand(
299
299
  mo,
300
- (b) => i ? (b?.preventDefault(), !0) : !1,
300
+ (y) => n ? (y?.preventDefault(), !0) : !1,
301
301
  K
302
302
  ),
303
303
  // Handle escape to close palette
304
304
  e.registerCommand(
305
305
  po,
306
- (b) => i ? (b?.preventDefault(), g(), !0) : !1,
306
+ (y) => n ? (y?.preventDefault(), h(), !0) : !1,
307
307
  K
308
308
  )
309
309
  );
310
310
  return () => {
311
- g(), f(), k();
311
+ h(), m(), C();
312
312
  };
313
313
  }
314
- function Xn(e, t, l) {
315
- l(), t.handler(e), e.focus();
314
+ function Xn(e, t, r) {
315
+ r(), t.handler(e), e.focus();
316
316
  }
317
317
  const Qn = je(
318
318
  "TOGGLE_SLASH_COMMAND_PALETTE"
@@ -326,10 +326,10 @@ function nt(e) {
326
326
  const t = A();
327
327
  if (!R(t)) return !1;
328
328
  if (t.focus.getNode() !== null) {
329
- const a = Ne();
330
- t.insertNodes([a]);
331
- const i = de();
332
- a.insertAfter(i), i.selectStart();
329
+ const l = Ne();
330
+ t.insertNodes([l]);
331
+ const n = de();
332
+ l.insertAfter(n), n.selectStart();
333
333
  }
334
334
  return !0;
335
335
  },
@@ -340,19 +340,19 @@ const Jo = {
340
340
  dependencies: [ge],
341
341
  export: (e) => jo(e) ? "---" : null,
342
342
  regExp: /^(---|\*\*\*|___)\s?$/,
343
- replace: (e, t, l, a) => {
344
- const i = Ne();
345
- if (a)
346
- e.replace(i);
343
+ replace: (e, t, r, l) => {
344
+ const n = Ne();
345
+ if (l)
346
+ e.replace(n);
347
347
  else {
348
- e.replace(i);
348
+ e.replace(n);
349
349
  const s = de();
350
- i.insertAfter(s), s.selectStart();
350
+ n.insertAfter(s), s.selectStart();
351
351
  }
352
352
  },
353
353
  type: "element"
354
354
  }, it = [...No, Jo];
355
- async function Q(e) {
355
+ async function X(e) {
356
356
  let t = "";
357
357
  return e.getEditorState().read(() => {
358
358
  t = So(it);
@@ -366,7 +366,7 @@ async function ae(e, t) {
366
366
  async function ti() {
367
367
  return it;
368
368
  }
369
- async function ee(e) {
369
+ async function Q(e) {
370
370
  let t = "";
371
371
  return e.getEditorState().read(() => {
372
372
  t = wo(e);
@@ -374,42 +374,42 @@ async function ee(e) {
374
374
  }
375
375
  async function se(e, t) {
376
376
  e.update(() => {
377
- const a = new DOMParser().parseFromString(t, "text/html"), i = Mo(e, a);
378
- be().clear(), go(i);
377
+ const l = new DOMParser().parseFromString(t, "text/html"), n = Mo(e, l);
378
+ be().clear(), go(n);
379
379
  });
380
380
  }
381
- async function oi(e, t, l) {
382
- let a, i, s;
381
+ async function oi(e, t, r) {
382
+ let l, n, s;
383
383
  switch (t) {
384
384
  case "markdown":
385
- a = await Q(e), i = "text/markdown", s = "md";
385
+ l = await X(e), n = "text/markdown", s = "md";
386
386
  break;
387
387
  case "html":
388
- a = await ee(e), i = "text/html", s = "html";
388
+ l = await Q(e), n = "text/html", s = "html";
389
389
  break;
390
390
  case "json":
391
- a = JSON.stringify(e.getEditorState().toJSON(), null, 2), i = "application/json", s = "json";
391
+ l = JSON.stringify(e.getEditorState().toJSON(), null, 2), n = "application/json", s = "json";
392
392
  break;
393
393
  }
394
- const p = new Blob([a], { type: i }), x = URL.createObjectURL(p), w = document.createElement("a");
395
- w.href = x, w.download = l ?? `document.${s}`, w.click(), URL.revokeObjectURL(x);
394
+ const g = new Blob([l], { type: n }), v = URL.createObjectURL(g), L = document.createElement("a");
395
+ L.href = v, L.download = r ?? `document.${s}`, L.click(), URL.revokeObjectURL(v);
396
396
  }
397
- async function ni(e, t, l) {
398
- const a = await new Promise((s, p) => {
399
- const x = new FileReader();
400
- x.onload = () => s(x.result), x.onerror = () => p(x.error), x.readAsText(t);
397
+ async function ni(e, t, r) {
398
+ const l = await new Promise((s, g) => {
399
+ const v = new FileReader();
400
+ v.onload = () => s(v.result), v.onerror = () => g(v.error), v.readAsText(t);
401
401
  });
402
- switch (l ?? Ko(t.name)) {
402
+ switch (r ?? Ko(t.name)) {
403
403
  case "markdown": {
404
- await ae(e, a);
404
+ await ae(e, l);
405
405
  break;
406
406
  }
407
407
  case "html": {
408
- await se(e, a);
408
+ await se(e, l);
409
409
  break;
410
410
  }
411
411
  case "json": {
412
- const s = e.parseEditorState(a);
412
+ const s = e.parseEditorState(l);
413
413
  e.setEditorState(s);
414
414
  break;
415
415
  }
@@ -423,10 +423,10 @@ async function rt(e, t) {
423
423
  typeof Ce.registerTablePlugin == "function" ? Ce.registerTablePlugin(e) : () => {
424
424
  };
425
425
  }
426
- async function ii(e, t = 3, l = 3) {
426
+ async function ii(e, t = 3, r = 3) {
427
427
  e.dispatchCommand(Ce.INSERT_TABLE_COMMAND, {
428
428
  rows: String(t),
429
- columns: String(l),
429
+ columns: String(r),
430
430
  includeHeaders: !0
431
431
  });
432
432
  }
@@ -443,33 +443,33 @@ function Yo(e) {
443
443
  return new ze(e);
444
444
  }
445
445
  async function ai(e, t) {
446
- const l = [], a = Lo(
446
+ const r = [], l = Lo(
447
447
  e,
448
- (i) => {
449
- const s = qo.exec(i);
448
+ (n) => {
449
+ const s = qo.exec(n);
450
450
  return s ? { start: s.index, end: s.index + s[0].length } : null;
451
451
  },
452
452
  ze,
453
453
  Yo
454
454
  );
455
- if (Array.isArray(a) ? l.push(...a) : typeof a == "function" && l.push(a), t?.onHashtagClick) {
456
- const i = e.registerCommand(
457
- xt,
455
+ if (Array.isArray(l) ? r.push(...l) : typeof l == "function" && r.push(l), t?.onHashtagClick) {
456
+ const n = e.registerCommand(
457
+ vt,
458
458
  (s) => {
459
- const p = s.target;
460
- if (p.classList.contains("bc-lexical-hashtag")) {
461
- const x = p.textContent;
462
- if (x)
463
- return t.onHashtagClick(x.replace("#", "")), !0;
459
+ const g = s.target;
460
+ if (g.classList.contains("bc-lexical-hashtag")) {
461
+ const v = g.textContent;
462
+ if (v)
463
+ return t.onHashtagClick(v.replace("#", "")), !0;
464
464
  }
465
465
  return !1;
466
466
  },
467
467
  K
468
468
  );
469
- l.push(i);
469
+ r.push(n);
470
470
  }
471
471
  return () => {
472
- l.forEach((i) => i());
472
+ r.forEach((n) => n());
473
473
  };
474
474
  }
475
475
  const Wo = /((https?:\/\/(www\.)?|www\.)[^\s<>]+)/g, Vo = /([a-zA-Z0-9._+-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/g, Zo = [
@@ -483,40 +483,40 @@ const Wo = /((https?:\/\/(www\.)?|www\.)[^\s<>]+)/g, Vo = /([a-zA-Z0-9._+-]+@[a-
483
483
  }
484
484
  ];
485
485
  async function si(e, t) {
486
- const l = t?.matchers ?? Zo;
487
- return e.registerMutationListener(vt, (a) => {
486
+ const r = t?.matchers ?? Zo;
487
+ return e.registerMutationListener(xt, (l) => {
488
488
  e.update(() => {
489
- for (const [i, s] of a) {
489
+ for (const [n, s] of l) {
490
490
  if (s !== "created" && s !== "updated") continue;
491
- const p = Ct(i);
492
- if (!p || !me(p)) continue;
493
- const x = p.getTextContent();
494
- for (const w of l) {
495
- const L = new RegExp(
496
- w.pattern.source,
497
- w.pattern.flags
491
+ const g = Ct(n);
492
+ if (!g || !me(g)) continue;
493
+ const v = g.getTextContent();
494
+ for (const L of r) {
495
+ const M = new RegExp(
496
+ L.pattern.source,
497
+ L.pattern.flags
498
498
  );
499
- let g;
500
- for (; (g = L.exec(x)) !== null; )
501
- w.urlTransformer(g[0]);
499
+ let h;
500
+ for (; (h = M.exec(v)) !== null; )
501
+ L.urlTransformer(h[0]);
502
502
  }
503
503
  }
504
504
  });
505
505
  });
506
506
  }
507
507
  async function ci(e, t) {
508
- const l = [];
509
- return t?.onMarkClick && l.push(
508
+ const r = [];
509
+ return t?.onMarkClick && r.push(
510
510
  e.registerCommand(
511
- xt,
512
- (a) => {
513
- const i = a.target;
514
- if (i.classList.contains("bc-lexical-mark")) {
515
- const s = i.dataset.markId;
511
+ vt,
512
+ (l) => {
513
+ const n = l.target;
514
+ if (n.classList.contains("bc-lexical-mark")) {
515
+ const s = n.dataset.markId;
516
516
  if (s)
517
517
  return t.onMarkClick(s, {
518
518
  id: s,
519
- type: i.dataset.markType || "annotation",
519
+ type: n.dataset.markType || "annotation",
520
520
  data: {}
521
521
  }), !0;
522
522
  }
@@ -524,32 +524,32 @@ async function ci(e, t) {
524
524
  },
525
525
  K
526
526
  )
527
- ), () => l.forEach((a) => a());
527
+ ), () => r.forEach((l) => l());
528
528
  }
529
- async function ui(e, t, l) {
529
+ async function ui(e, t, r) {
530
530
  e.update(() => {
531
- const a = A();
532
- R(a) && no(a, a.isBackward(), t);
531
+ const l = A();
532
+ R(l) && no(l, l.isBackward(), t);
533
533
  });
534
534
  }
535
535
  async function di(e, t) {
536
536
  e.update(() => {
537
- const a = be().getAllTextNodes().filter((i) => {
538
- const s = i.getParent();
539
- return pt(s) ? io(i, 0)?.includes(t) ?? !1 : !1;
537
+ const l = be().getAllTextNodes().filter((n) => {
538
+ const s = n.getParent();
539
+ return pt(s) ? io(n, 0)?.includes(t) ?? !1 : !1;
540
540
  });
541
- for (const i of a) {
542
- const s = i.getParent();
541
+ for (const n of l) {
542
+ const s = n.getParent();
543
543
  pt(s) && ro(s);
544
544
  }
545
545
  });
546
546
  }
547
547
  async function fi(e, t) {
548
- const { maxLength: l, onOverflow: a } = t;
549
- return e.registerUpdateListener(({ editorState: i }) => {
550
- i.read(() => {
551
- const x = be().getTextContent().length, w = x > l;
552
- a && a(w, x);
548
+ const { maxLength: r, onOverflow: l } = t;
549
+ return e.registerUpdateListener(({ editorState: n }) => {
550
+ n.read(() => {
551
+ const v = be().getTextContent().length, L = v > r;
552
+ l && l(L, v);
553
553
  });
554
554
  });
555
555
  }
@@ -558,16 +558,16 @@ async function lt(e) {
558
558
  };
559
559
  }
560
560
  async function at(e, t) {
561
- const l = t.docMap ?? /* @__PURE__ */ new Map(), a = t.id ?? "lexical", i = t.doc.getText(a), s = Ro(
561
+ const r = t.docMap ?? /* @__PURE__ */ new Map(), l = t.id ?? "lexical", n = t.doc.getText(l), s = Ro(
562
562
  e,
563
563
  t.provider,
564
- i,
564
+ n,
565
565
  t.doc,
566
- l
567
- ), p = e.registerUpdateListener(() => {
566
+ r
567
+ ), g = e.registerUpdateListener(() => {
568
568
  });
569
569
  return () => {
570
- p(), s && typeof s.destroy == "function" && s.destroy();
570
+ g(), s && typeof s.destroy == "function" && s.destroy();
571
571
  };
572
572
  }
573
573
  function mi(e) {
@@ -578,12 +578,12 @@ function mi(e) {
578
578
  focusOffset: 0
579
579
  };
580
580
  return e.getEditorState().read(() => {
581
- const l = A();
582
- R(l) && (t = {
583
- hasSelection: !l.isCollapsed(),
584
- selectedText: l.getTextContent(),
585
- anchorOffset: l.anchor.offset,
586
- focusOffset: l.focus.offset
581
+ const r = A();
582
+ R(r) && (t = {
583
+ hasSelection: !r.isCollapsed(),
584
+ selectedText: r.getTextContent(),
585
+ anchorOffset: r.anchor.offset,
586
+ focusOffset: r.focus.offset
587
587
  });
588
588
  }), t;
589
589
  }
@@ -602,78 +602,78 @@ function gi(e) {
602
602
  }
603
603
  function hi(e, t) {
604
604
  e.update(() => {
605
- const l = A();
606
- R(l) && l.insertText(t);
605
+ const r = A();
606
+ R(r) && r.insertText(t);
607
607
  }), e.focus();
608
608
  }
609
609
  async function bi() {
610
610
  return Ao;
611
611
  }
612
- function he(e, t, l) {
613
- const a = /* @__PURE__ */ new Map();
612
+ function he(e, t, r) {
613
+ const l = /* @__PURE__ */ new Map();
614
614
  if (e)
615
- for (const i of e.split(";")) {
616
- const s = i.trim();
615
+ for (const n of e.split(";")) {
616
+ const s = n.trim();
617
617
  if (!s) continue;
618
- const p = s.indexOf(":");
619
- if (p === -1) continue;
620
- const x = s.slice(0, p).trim(), w = s.slice(p + 1).trim();
621
- a.set(x, w);
618
+ const g = s.indexOf(":");
619
+ if (g === -1) continue;
620
+ const v = s.slice(0, g).trim(), L = s.slice(g + 1).trim();
621
+ l.set(v, L);
622
622
  }
623
- return l ? a.set(t, l) : a.delete(t), a.size === 0 ? "" : Array.from(a.entries()).map(([i, s]) => `${i}: ${s}`).join("; ");
623
+ return r ? l.set(t, r) : l.delete(t), l.size === 0 ? "" : Array.from(l.entries()).map(([n, s]) => `${n}: ${s}`).join("; ");
624
624
  }
625
625
  function ce(e, t) {
626
626
  if (!e) return "";
627
- const l = new RegExp(
627
+ const r = new RegExp(
628
628
  `(?:^|;)\\s*${t.replace(/-/g, "\\-")}:\\s*([^;]+)`
629
- ), a = e.match(l);
630
- return a ? a[1].trim() : "";
629
+ ), l = e.match(r);
630
+ return l ? l[1].trim() : "";
631
631
  }
632
632
  function Xo(e, t) {
633
- const l = e.getElementByKey(t);
634
- l && e.getEditorState().read(() => {
635
- const a = Ct(t);
636
- if (!Te(a) || bo(a)) return;
637
- const i = a.getStyle(), s = ce(i, "background-color");
638
- l.style.backgroundColor = s || "";
639
- const p = ce(i, "line-height");
640
- l.style.lineHeight = p || "";
633
+ const r = e.getElementByKey(t);
634
+ r && e.getEditorState().read(() => {
635
+ const l = Ct(t);
636
+ if (!Te(l) || bo(l)) return;
637
+ const n = l.getStyle(), s = ce(n, "background-color");
638
+ r.style.backgroundColor = s || "";
639
+ const g = ce(n, "line-height");
640
+ r.style.lineHeight = g || "";
641
641
  });
642
642
  }
643
643
  function st(e) {
644
644
  const t = e.registerUpdateListener(
645
- ({ dirtyElements: l }) => {
646
- if (l.size !== 0)
647
- for (const [a] of l)
648
- Xo(e, a);
645
+ ({ dirtyElements: r }) => {
646
+ if (r.size !== 0)
647
+ for (const [l] of r)
648
+ Xo(e, l);
649
649
  }
650
650
  );
651
651
  return e.getEditorState().read(() => {
652
- const l = be();
653
- for (const a of l.getChildren())
654
- if (Te(a)) {
655
- const i = a.getStyle();
656
- if (i) {
657
- const s = e.getElementByKey(a.getKey());
652
+ const r = be();
653
+ for (const l of r.getChildren())
654
+ if (Te(l)) {
655
+ const n = l.getStyle();
656
+ if (n) {
657
+ const s = e.getElementByKey(l.getKey());
658
658
  if (s) {
659
- const p = ce(i, "background-color");
660
- p && (s.style.backgroundColor = p);
661
- const x = ce(i, "line-height");
662
- x && (s.style.lineHeight = x);
659
+ const g = ce(n, "background-color");
660
+ g && (s.style.backgroundColor = g);
661
+ const v = ce(n, "line-height");
662
+ v && (s.style.lineHeight = v);
663
663
  }
664
664
  }
665
665
  }
666
666
  }), t;
667
667
  }
668
668
  function De(e, t) {
669
- const l = t.exportDOM(e);
670
- if (l.element && _o(l.element) && Te(t)) {
671
- const a = t.getStyle(), i = ce(a, "background-color");
672
- i && (l.element.style.backgroundColor = i);
673
- const s = ce(a, "line-height");
674
- s && (l.element.style.lineHeight = s);
669
+ const r = t.exportDOM(e);
670
+ if (r.element && _o(r.element) && Te(t)) {
671
+ const l = t.getStyle(), n = ce(l, "background-color");
672
+ n && (r.element.style.backgroundColor = n);
673
+ const s = ce(l, "line-height");
674
+ s && (r.element.style.lineHeight = s);
675
675
  }
676
- return l;
676
+ return r;
677
677
  }
678
678
  function we() {
679
679
  const e = /* @__PURE__ */ new Map();
@@ -681,33 +681,33 @@ function we() {
681
681
  }
682
682
  function Qo() {
683
683
  const e = (t) => () => ({
684
- conversion: (l) => {
685
- const a = t(l);
686
- if (a && Te(a)) {
687
- l.style?.textAlign && a.setFormat(l.style.textAlign);
688
- let i = "";
689
- l.style?.backgroundColor && (i = he(
690
- i,
684
+ conversion: (r) => {
685
+ const l = t(r);
686
+ if (l && Te(l)) {
687
+ r.style?.textAlign && l.setFormat(r.style.textAlign);
688
+ let n = "";
689
+ r.style?.backgroundColor && (n = he(
690
+ n,
691
691
  "background-color",
692
- l.style.backgroundColor
693
- )), l.style?.lineHeight && (i = he(
694
- i,
692
+ r.style.backgroundColor
693
+ )), r.style?.lineHeight && (n = he(
694
+ n,
695
695
  "line-height",
696
- l.style.lineHeight
697
- )), i && a.setStyle(i);
696
+ r.style.lineHeight
697
+ )), n && l.setStyle(n);
698
698
  }
699
- return { node: a };
699
+ return { node: l };
700
700
  },
701
701
  priority: 1
702
702
  });
703
703
  return {
704
704
  p: e(() => de()),
705
- h1: e(() => V("h1")),
706
- h2: e(() => V("h2")),
707
- h3: e(() => V("h3")),
708
- h4: e(() => V("h4")),
709
- h5: e(() => V("h5")),
710
- h6: e(() => V("h6"))
705
+ h1: e(() => W("h1")),
706
+ h2: e(() => W("h2")),
707
+ h3: e(() => W("h3")),
708
+ h4: e(() => W("h4")),
709
+ h5: e(() => W("h5")),
710
+ h6: e(() => W("h6"))
711
711
  };
712
712
  }
713
713
  const en = [
@@ -745,29 +745,29 @@ const en = [
745
745
  "code",
746
746
  "mark"
747
747
  ];
748
- function rn(e, t, l) {
748
+ function rn(e, t, r) {
749
749
  if (!me(t)) return;
750
- const a = e.fontWeight, i = e.textDecoration.split(" ");
751
- (a === "700" || a === "bold") && !t.hasFormat("bold") && t.toggleFormat("bold"), e.fontStyle === "italic" && !t.hasFormat("italic") && t.toggleFormat("italic"), i.includes("line-through") && !t.hasFormat("strikethrough") && t.toggleFormat("strikethrough"), i.includes("underline") && !t.hasFormat("underline") && t.toggleFormat("underline"), e.verticalAlign === "sub" && !t.hasFormat("subscript") && t.toggleFormat("subscript"), e.verticalAlign === "super" && !t.hasFormat("superscript") && t.toggleFormat("superscript"), l && !t.hasFormat(l) && t.toggleFormat(l);
750
+ const l = e.fontWeight, n = e.textDecoration.split(" ");
751
+ (l === "700" || l === "bold") && !t.hasFormat("bold") && t.toggleFormat("bold"), e.fontStyle === "italic" && !t.hasFormat("italic") && t.toggleFormat("italic"), n.includes("line-through") && !t.hasFormat("strikethrough") && t.toggleFormat("strikethrough"), n.includes("underline") && !t.hasFormat("underline") && t.toggleFormat("underline"), e.verticalAlign === "sub" && !t.hasFormat("subscript") && t.toggleFormat("subscript"), e.verticalAlign === "super" && !t.hasFormat("superscript") && t.toggleFormat("superscript"), r && !t.hasFormat(r) && t.toggleFormat(r);
752
752
  }
753
753
  function ln(e = en) {
754
754
  const t = {};
755
- for (const l of nn)
756
- t[l] = (a) => {
757
- const i = a.style, s = on[l], p = l === "b" ? i.fontWeight !== "normal" ? "bold" : void 0 : s;
755
+ for (const r of nn)
756
+ t[r] = (l) => {
757
+ const n = l.style, s = on[r], g = r === "b" ? n.fontWeight !== "normal" ? "bold" : void 0 : s;
758
758
  return {
759
759
  conversion: () => ({
760
760
  node: null,
761
- forChild: (x) => {
762
- if (!me(x)) return x;
763
- rn(i, x, p);
764
- let w = x.getStyle();
765
- for (const L of e) {
766
- if (tn.has(L)) continue;
767
- const g = i.getPropertyValue(L);
768
- g && (w = he(w, L, g));
761
+ forChild: (v) => {
762
+ if (!me(v)) return v;
763
+ rn(n, v, g);
764
+ let L = v.getStyle();
765
+ for (const M of e) {
766
+ if (tn.has(M)) continue;
767
+ const h = n.getPropertyValue(M);
768
+ h && (L = he(L, M, h));
769
769
  }
770
- return w && x.setStyle(w), x;
770
+ return L && v.setStyle(L), v;
771
771
  }
772
772
  }),
773
773
  priority: 1
@@ -782,11 +782,11 @@ function Me(e) {
782
782
  };
783
783
  }
784
784
  async function Le(e = {}) {
785
- const { nodes: t = [], plugins: l = [], onError: a } = e, s = (await Go()).createEditor({
785
+ const { nodes: t = [], plugins: r = [], onError: l } = e, s = (await Go()).createEditor({
786
786
  namespace: "BeatUIHeadless",
787
787
  nodes: t,
788
- onError: (p) => {
789
- a ? a(p, s) : console.error("[BeatUI Headless]", p);
788
+ onError: (g) => {
789
+ l ? l(g, s) : console.error("[BeatUI Headless]", g);
790
790
  },
791
791
  editable: !1,
792
792
  // Headless editors are typically not editable
@@ -795,79 +795,79 @@ async function Le(e = {}) {
795
795
  import: Me()
796
796
  }
797
797
  });
798
- if (l.length > 0)
799
- for (const p of l)
800
- p.register(s);
798
+ if (r.length > 0)
799
+ for (const g of r)
800
+ g.register(s);
801
801
  return s;
802
802
  }
803
803
  async function yi(e) {
804
804
  const t = await Le();
805
805
  return await ae(t, e), t.getEditorState().toJSON();
806
806
  }
807
- async function vi(e) {
808
- const t = await Le(), l = t.parseEditorState(JSON.stringify(e));
809
- return t.setEditorState(l), await Q(t);
810
- }
811
807
  async function xi(e) {
808
+ const t = await Le(), r = t.parseEditorState(JSON.stringify(e));
809
+ return t.setEditorState(r), await X(t);
810
+ }
811
+ async function vi(e) {
812
812
  const t = await Le();
813
813
  return await se(t, e), t.getEditorState().toJSON();
814
814
  }
815
815
  async function Ci(e) {
816
- const t = await Le(), l = t.parseEditorState(JSON.stringify(e));
817
- return t.setEditorState(l), await ee(t);
816
+ const t = await Le(), r = t.parseEditorState(JSON.stringify(e));
817
+ return t.setEditorState(r), await Q(t);
818
818
  }
819
819
  const an = (e) => {
820
820
  const {
821
821
  value: t,
822
- format: l,
823
- plugins: a,
824
- readOnly: i,
822
+ format: r,
823
+ plugins: l,
824
+ readOnly: n,
825
825
  placeholder: s,
826
- class: p,
827
- namespace: x = "BeatUILexical",
828
- heightMode: w = "auto",
829
- autoFocus: L = !1,
830
- onError: g,
826
+ class: g,
827
+ namespace: v = "BeatUILexical",
828
+ heightMode: L = "auto",
829
+ autoFocus: M = !1,
830
+ onError: h,
831
831
  onInput: N,
832
- onChange: y,
833
- onBlur: f,
834
- onReady: k
832
+ onChange: E,
833
+ onBlur: m,
834
+ onReady: C
835
835
  } = e;
836
836
  return ue(
837
837
  Ye,
838
- ({ appearance: b }) => D.div(
838
+ ({ appearance: y }) => D.div(
839
839
  // CSS injection via LinkPortal
840
840
  Ke(
841
841
  () => import("../styles-url-BIeImEjl.js"),
842
- ({ default: v }) => qe({ id: "beatui-lexical-css", href: v })
842
+ ({ default: x }) => qe({ id: "beatui-lexical-css", href: x })
843
843
  ),
844
- d.class("bc-lexical-editor-container"),
845
- w === "fixed" ? d.class("bc-lexical-editor-container--fixed") : null,
846
- d.class(p),
844
+ f.class("bc-lexical-editor-container"),
845
+ L === "fixed" ? f.class("bc-lexical-editor-container--fixed") : null,
846
+ f.class(g),
847
847
  // The editable surface
848
848
  D.div(
849
- d.class("bc-lexical-editor"),
850
- d.class(`bc-lexical-editor--${w}`),
851
- d.contenteditable(
849
+ f.class("bc-lexical-editor"),
850
+ f.class(`bc-lexical-editor--${L}`),
851
+ f.contenteditable(
852
852
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
853
- i != null ? U.map(i, (v) => !v) : !0
853
+ n != null ? U.map(n, (x) => !x) : !0
854
854
  ),
855
- i != null ? d.class(
855
+ n != null ? f.class(
856
856
  U.map(
857
- i,
858
- (v) => v ? "bc-lexical-editor--readonly" : ""
857
+ n,
858
+ (x) => x ? "bc-lexical-editor--readonly" : ""
859
859
  )
860
860
  ) : null,
861
- oe((v) => {
862
- let S = null;
863
- const M = [];
861
+ oe((x) => {
862
+ let T = null;
863
+ const O = [];
864
864
  return (async () => {
865
865
  try {
866
- const E = a ?? Ve("bare"), h = We(E), _ = U.get(
867
- l ?? "markdown"
868
- ), r = Ge({
869
- namespace: x,
870
- nodes: h,
866
+ const k = l ?? Ve("bare"), b = We(k), w = U.get(
867
+ r ?? "markdown"
868
+ ), a = Ge({
869
+ namespace: v,
870
+ nodes: b,
871
871
  theme: {
872
872
  // Lexical theme classNames map — these are applied to rendered nodes
873
873
  heading: {
@@ -904,135 +904,135 @@ const an = (e) => {
904
904
  mark: "bc-lexical-mark",
905
905
  paragraph: "bc-lexical-paragraph"
906
906
  },
907
- onError: (C) => {
908
- g ? g(C, r) : console.error("[BeatUI Lexical]", C);
907
+ onError: (u) => {
908
+ h ? h(u, a) : console.error("[BeatUI Lexical]", u);
909
909
  },
910
- editable: i ? !U.get(i) : !0,
910
+ editable: n ? !U.get(n) : !0,
911
911
  html: {
912
912
  export: we(),
913
913
  import: Me()
914
914
  }
915
915
  });
916
- S = r, r.setRootElement(v);
917
- const I = [];
918
- if (E.richText ? I.push(Ze(r)) : E.plainText && I.push(Xe(r)), E.history) {
919
- const C = typeof E.history == "object" ? E.history : void 0;
920
- I.push(Qe(r, C));
916
+ T = a, a.setRootElement(x);
917
+ const F = [];
918
+ if (k.richText ? F.push(Ze(a)) : k.plainText && F.push(Xe(a)), k.history) {
919
+ const u = typeof k.history == "object" ? k.history : void 0;
920
+ F.push(Qe(a, u));
921
921
  }
922
- if (E.clipboard && I.push(et(r)), E.list && I.push(tt(r)), E.link && I.push(ot(r)), E.yjs && I.push(
923
- at(r, E.yjs)
924
- ), E.dragon && I.push(lt(r)), E.table && I.push(rt(r)), (await Promise.all(I)).forEach((C) => {
925
- C && M.push(C);
926
- }), M.push(nt(r)), M.push(st(r)), t != null) {
927
- const C = U.get(
922
+ if (k.clipboard && F.push(et(a)), k.list && F.push(tt(a)), k.link && F.push(ot(a)), k.yjs && F.push(
923
+ at(a, k.yjs)
924
+ ), k.dragon && F.push(lt(a)), k.table && F.push(rt(a)), (await Promise.all(F)).forEach((u) => {
925
+ u && O.push(u);
926
+ }), O.push(nt(a)), O.push(st(a)), t != null) {
927
+ const u = U.get(
928
928
  t
929
929
  );
930
- if (C != null && (C !== "" || _ === "json" && typeof C == "object")) {
931
- if (_ === "markdown" && typeof C == "string")
932
- await ae(r, C);
933
- else if (_ === "html" && typeof C == "string")
934
- await se(r, C);
935
- else if (_ === "json" && typeof C == "object")
930
+ if (u != null && (u !== "" || w === "json" && typeof u == "object")) {
931
+ if (w === "markdown" && typeof u == "string")
932
+ await ae(a, u);
933
+ else if (w === "html" && typeof u == "string")
934
+ await se(a, u);
935
+ else if (w === "json" && typeof u == "object")
936
936
  try {
937
- const o = JSON.stringify(C), O = r.parseEditorState(o);
938
- r.setEditorState(O);
939
- } catch (o) {
937
+ const i = JSON.stringify(u), _ = a.parseEditorState(i);
938
+ a.setEditorState(_);
939
+ } catch (i) {
940
940
  console.error(
941
941
  "[BeatUI] Failed to parse JSON editor state:",
942
- o
943
- ), g && g(
944
- o instanceof Error ? o : new Error(String(o)),
945
- r
942
+ i
943
+ ), h && h(
944
+ i instanceof Error ? i : new Error(String(i)),
945
+ a
946
946
  );
947
947
  }
948
948
  }
949
949
  }
950
- if (M.push(
951
- r.registerUpdateListener(
952
- ({ editorState: C, dirtyElements: u, dirtyLeaves: o }) => {
953
- u.size === 0 && o.size === 0 || N && C.read(async () => {
954
- if (_ === "markdown") {
955
- const O = await Q(r);
956
- N(O, r);
957
- } else if (_ === "html") {
958
- const O = await ee(r);
959
- N(O, r);
960
- } else _ === "json" && N(
961
- C.toJSON(),
962
- r
950
+ if (O.push(
951
+ a.registerUpdateListener(
952
+ ({ editorState: u, dirtyElements: c, dirtyLeaves: i }) => {
953
+ c.size === 0 && i.size === 0 || N && u.read(async () => {
954
+ if (w === "markdown") {
955
+ const _ = await X(a);
956
+ N(_, a);
957
+ } else if (w === "html") {
958
+ const _ = await Q(a);
959
+ N(_, a);
960
+ } else w === "json" && N(
961
+ u.toJSON(),
962
+ a
963
963
  );
964
964
  });
965
965
  }
966
966
  )
967
- ), t != null && M.push(
968
- U.on(t, async (C) => {
969
- if (C != null) {
970
- if (_ === "markdown" && typeof C == "string") {
971
- const u = await Q(r);
972
- C !== u && await ae(r, C);
973
- } else if (_ === "html" && typeof C == "string") {
974
- const u = await ee(r);
975
- C !== u && await se(r, C);
976
- } else if (_ === "json" && typeof C == "object") {
977
- const u = JSON.stringify(
978
- r.getEditorState().toJSON()
979
- ), o = JSON.stringify(C);
980
- if (u !== o) {
981
- const O = r.parseEditorState(o);
982
- r.setEditorState(O);
967
+ ), t != null && O.push(
968
+ U.on(t, async (u) => {
969
+ if (u != null) {
970
+ if (w === "markdown" && typeof u == "string") {
971
+ const c = await X(a);
972
+ u !== c && await ae(a, u);
973
+ } else if (w === "html" && typeof u == "string") {
974
+ const c = await Q(a);
975
+ u !== c && await se(a, u);
976
+ } else if (w === "json" && typeof u == "object") {
977
+ const c = JSON.stringify(
978
+ a.getEditorState().toJSON()
979
+ ), i = JSON.stringify(u);
980
+ if (c !== i) {
981
+ const _ = a.parseEditorState(i);
982
+ a.setEditorState(_);
983
983
  }
984
984
  }
985
985
  }
986
986
  })
987
- ), i != null && M.push(
988
- U.on(i, (C) => {
989
- r.setEditable(!C);
987
+ ), n != null && O.push(
988
+ U.on(n, (u) => {
989
+ a.setEditable(!u);
990
990
  })
991
- ), M.push(
992
- r.registerCommand(
991
+ ), O.push(
992
+ a.registerCommand(
993
993
  // Use BLUR_COMMAND from lexical
994
994
  Je,
995
- () => (f && f(r), y && r.getEditorState().read(async () => {
996
- if (_ === "markdown") {
997
- const C = await Q(r);
998
- y(C, r);
999
- } else if (_ === "html") {
1000
- const C = await ee(r);
1001
- y(C, r);
1002
- } else _ === "json" && y(
1003
- r.getEditorState().toJSON(),
1004
- r
995
+ () => (m && m(a), E && a.getEditorState().read(async () => {
996
+ if (w === "markdown") {
997
+ const u = await X(a);
998
+ E(u, a);
999
+ } else if (w === "html") {
1000
+ const u = await Q(a);
1001
+ E(u, a);
1002
+ } else w === "json" && E(
1003
+ a.getEditorState().toJSON(),
1004
+ a
1005
1005
  );
1006
1006
  }), !1),
1007
1007
  K
1008
1008
  )
1009
- ), M.push(
1010
- b.on((C) => {
1011
- const u = r.getRootElement();
1012
- u && (u.dataset.theme = C);
1009
+ ), O.push(
1010
+ y.on((u) => {
1011
+ const c = a.getRootElement();
1012
+ c && (c.dataset.theme = u);
1013
1013
  })
1014
- ), L)
1015
- r.focus();
1014
+ ), M)
1015
+ a.focus();
1016
1016
  else {
1017
- const C = r.getRootElement();
1018
- C && C === document.activeElement && C.blur();
1017
+ const u = a.getRootElement();
1018
+ u && u === document.activeElement && u.blur();
1019
1019
  }
1020
- k && k(r);
1021
- } catch (E) {
1020
+ C && C(a);
1021
+ } catch (k) {
1022
1022
  console.error(
1023
1023
  "[BeatUI] Failed to initialize Lexical editor:",
1024
- E
1024
+ k
1025
1025
  );
1026
- const h = v;
1027
- h.textContent = "Failed to load Lexical editor.";
1026
+ const b = x;
1027
+ b.textContent = "Failed to load Lexical editor.";
1028
1028
  }
1029
1029
  })(), ne(() => {
1030
1030
  try {
1031
- M.forEach((E) => E());
1031
+ O.forEach((k) => k());
1032
1032
  } catch {
1033
1033
  }
1034
1034
  try {
1035
- S?.setRootElement(null);
1035
+ T?.setRootElement(null);
1036
1036
  } catch {
1037
1037
  }
1038
1038
  });
@@ -1041,80 +1041,80 @@ const an = (e) => {
1041
1041
  )
1042
1042
  );
1043
1043
  };
1044
- function St(e, t, l) {
1045
- const a = (f, k) => t.map(() => {
1046
- const b = e.value;
1047
- return b ? b.getEditorState().read(() => {
1048
- const v = A();
1049
- return R(v) ? f(v) : k;
1050
- }) : k;
1051
- }), i = (f) => {
1052
- const k = f.anchor.getNode();
1053
- return k.getKey() === "root" ? k : k.getTopLevelElementOrThrow();
1044
+ function St(e, t, r) {
1045
+ const l = (m, C) => t.map(() => {
1046
+ const y = e.value;
1047
+ return y ? y.getEditorState().read(() => {
1048
+ const x = A();
1049
+ return R(x) ? m(x) : C;
1050
+ }) : C;
1051
+ }), n = (m) => {
1052
+ const C = m.anchor.getNode();
1053
+ return C.getKey() === "root" ? C : C.getTopLevelElementOrThrow();
1054
1054
  };
1055
1055
  return {
1056
- withSelection: a,
1057
- getAnchorElement: i,
1058
- textFormatActive: (f) => a((k) => k.hasFormat(f), !1),
1059
- blockTypeActive: (f) => a((k) => i(k).getType() === f, !1),
1060
- listTypeActive: (f) => a((k) => {
1061
- const b = i(k).getParent();
1062
- return jt(b) && b.getListType() === f;
1056
+ withSelection: l,
1057
+ getAnchorElement: n,
1058
+ textFormatActive: (m) => l((C) => C.hasFormat(m), !1),
1059
+ blockTypeActive: (m) => l((C) => n(C).getType() === m, !1),
1060
+ listTypeActive: (m) => l((C) => {
1061
+ const y = n(C).getParent();
1062
+ return jt(y) && y.getListType() === m;
1063
1063
  }, !1),
1064
- headingActive: (f) => t.map(() => {
1065
- const k = e.value;
1066
- return k ? k.getEditorState().read(() => {
1067
- const b = A();
1068
- if (R(b)) {
1069
- const v = i(b);
1070
- if (v.getType() === "heading")
1071
- return k.getElementByKey(v.getKey())?.tagName === `H${f}`;
1064
+ headingActive: (m) => t.map(() => {
1065
+ const C = e.value;
1066
+ return C ? C.getEditorState().read(() => {
1067
+ const y = A();
1068
+ if (R(y)) {
1069
+ const x = n(y);
1070
+ if (x.getType() === "heading")
1071
+ return C.getElementByKey(x.getKey())?.tagName === `H${m}`;
1072
1072
  }
1073
1073
  return !1;
1074
1074
  }) : !1;
1075
1075
  }),
1076
- linkActive: () => a((f) => {
1077
- const k = f.anchor.getNode();
1078
- return k.getParent()?.getType() === "link" || k.getType() === "link";
1076
+ linkActive: () => l((m) => {
1077
+ const C = m.anchor.getNode();
1078
+ return C.getParent()?.getType() === "link" || C.getType() === "link";
1079
1079
  }, !1),
1080
- dispatch: (f, k) => () => {
1081
- const b = e.value;
1082
- b && (b.dispatchCommand(f, k), b.focus());
1080
+ dispatch: (m, C) => () => {
1081
+ const y = e.value;
1082
+ y && (y.dispatchCommand(m, C), y.focus());
1083
1083
  },
1084
- toggleBlock: (f, k) => () => {
1085
- const b = e.value;
1086
- b && (b.update(() => {
1087
- const v = A();
1088
- if (R(v)) {
1089
- const S = i(v);
1090
- Y(
1091
- v,
1092
- () => S.getType() === f ? de() : k()
1084
+ toggleBlock: (m, C) => () => {
1085
+ const y = e.value;
1086
+ y && (y.update(() => {
1087
+ const x = A();
1088
+ if (R(x)) {
1089
+ const T = n(x);
1090
+ q(
1091
+ x,
1092
+ () => T.getType() === m ? de() : C()
1093
1093
  );
1094
1094
  }
1095
- }), b.focus());
1095
+ }), y.focus());
1096
1096
  },
1097
1097
  toggleLink: () => {
1098
- const f = e.value;
1099
- f && (f.getEditorState().read(() => {
1100
- const k = A();
1101
- if (R(k)) {
1102
- const b = k.anchor.getNode();
1103
- if (b.getParent()?.getType() === "link" || b.getType() === "link")
1104
- f.dispatchCommand(Fe, null);
1098
+ const m = e.value;
1099
+ m && (m.getEditorState().read(() => {
1100
+ const C = A();
1101
+ if (R(C)) {
1102
+ const y = C.anchor.getNode();
1103
+ if (y.getParent()?.getType() === "link" || y.getType() === "link")
1104
+ m.dispatchCommand(Fe, null);
1105
1105
  else {
1106
- const M = prompt(l?.enterUrlMessage?.() ?? "Enter URL:");
1107
- M && f.dispatchCommand(Fe, M);
1106
+ const O = prompt(r?.enterUrlMessage?.() ?? "Enter URL:");
1107
+ O && m.dispatchCommand(Fe, O);
1108
1108
  }
1109
1109
  }
1110
- }), f.focus());
1110
+ }), m.focus());
1111
1111
  }
1112
1112
  };
1113
1113
  }
1114
1114
  function Nt(e, t) {
1115
- return (l) => (a) => Ho({
1116
- ...a,
1117
- display: l,
1115
+ return (r) => (l) => Ho({
1116
+ ...l,
1117
+ display: r,
1118
1118
  disabled: e,
1119
1119
  size: t
1120
1120
  });
@@ -1160,16 +1160,16 @@ function un() {
1160
1160
  function dn(e) {
1161
1161
  if (e.layout)
1162
1162
  return e.layout;
1163
- const { visibleGroups: t, hiddenGroups: l, customGroups: a } = e;
1164
- let i = un();
1165
- if ((t || l) && (i = i.filter((s) => {
1163
+ const { visibleGroups: t, hiddenGroups: r, customGroups: l } = e;
1164
+ let n = un();
1165
+ if ((t || r) && (n = n.filter((s) => {
1166
1166
  if ("separator" in s || "customGroup" in s) return !0;
1167
- const p = s.group;
1168
- return !(l?.includes(p) || t && !t.includes(p));
1169
- })), a && a.length > 0)
1170
- for (const s of a)
1171
- i.push({ customGroup: s.id });
1172
- return i;
1167
+ const g = s.group;
1168
+ return !(r?.includes(g) || t && !t.includes(g));
1169
+ })), l && l.length > 0)
1170
+ for (const s of l)
1171
+ n.push({ customGroup: s.id });
1172
+ return n;
1173
1173
  }
1174
1174
  const fn = [
1175
1175
  { value: "Arial", label: "Arial" },
@@ -1199,444 +1199,444 @@ const fn = [
1199
1199
  function gn({
1200
1200
  editor: e,
1201
1201
  stateUpdate: t,
1202
- toolbar: l = {},
1203
- readOnly: a = z(!1),
1204
- size: i = "sm"
1202
+ toolbar: r = {},
1203
+ readOnly: l = z(!1),
1204
+ size: n = "sm"
1205
1205
  }) {
1206
- const { maxHeadingLevel: s = 3 } = l, p = dn(l);
1206
+ const { maxHeadingLevel: s = 3 } = r, g = dn(r);
1207
1207
  return ue(
1208
1208
  ye,
1209
- (x) => Se(e, (w) => {
1210
- const L = w, g = x.$.lexical, {
1209
+ (v) => Se(e, (L) => {
1210
+ const M = L, h = v.$.lexical, {
1211
1211
  getAnchorElement: N,
1212
- textFormatActive: y,
1213
- blockTypeActive: f,
1214
- listTypeActive: k,
1215
- headingActive: b,
1216
- linkActive: v,
1217
- dispatch: S,
1218
- toggleBlock: M,
1219
- toggleLink: B
1220
- } = St(L, t, {
1221
- enterUrlMessage: () => x.value.lexical.enterUrl
1222
- }), h = Nt(a, i)(z(!0)), _ = () => {
1223
- const n = L.value;
1224
- n && (n.update(() => {
1225
- const m = A();
1226
- R(m) && Y(m, () => de());
1227
- }), n.focus());
1228
- }, r = (n) => {
1229
- const m = L.value;
1230
- m && (m.update(() => {
1212
+ textFormatActive: E,
1213
+ blockTypeActive: m,
1214
+ listTypeActive: C,
1215
+ headingActive: y,
1216
+ linkActive: x,
1217
+ dispatch: T,
1218
+ toggleBlock: O,
1219
+ toggleLink: I
1220
+ } = St(M, t, {
1221
+ enterUrlMessage: () => v.value.lexical.enterUrl
1222
+ }), b = Nt(l, n)(z(!0)), w = () => {
1223
+ const o = M.value;
1224
+ o && (o.update(() => {
1225
+ const p = A();
1226
+ R(p) && q(p, () => de());
1227
+ }), o.focus());
1228
+ }, a = (o) => {
1229
+ const p = M.value;
1230
+ p && (p.update(() => {
1231
1231
  const H = A();
1232
1232
  if (R(H)) {
1233
- const J = N(H), ie = `h${n}`, re = m.getElementByKey(J.getKey());
1234
- J.getType() === "heading" && re?.tagName === `H${n}` ? Y(H, () => de()) : Y(H, () => V(ie));
1233
+ const J = N(H), ie = `h${o}`, re = p.getElementByKey(J.getKey());
1234
+ J.getType() === "heading" && re?.tagName === `H${o}` ? q(H, () => de()) : q(H, () => W(ie));
1235
1235
  }
1236
- }), m.focus());
1237
- }, I = () => {
1238
- const n = L.value;
1239
- if (!n) return;
1240
- const m = n.getRootElement();
1241
- m && (m.focus(), document.execCommand("copy"));
1242
- }, T = () => {
1243
- const n = L.value;
1244
- if (!n) return;
1245
- const m = n.getRootElement();
1246
- m && (m.focus(), document.execCommand("cut"));
1247
- }, C = () => {
1248
- const n = L.value;
1249
- n && navigator.clipboard.readText().then((m) => {
1250
- n.update(() => {
1236
+ }), p.focus());
1237
+ }, F = () => {
1238
+ const o = M.value;
1239
+ if (!o) return;
1240
+ const p = o.getRootElement();
1241
+ p && (p.focus(), document.execCommand("copy"));
1242
+ }, S = () => {
1243
+ const o = M.value;
1244
+ if (!o) return;
1245
+ const p = o.getRootElement();
1246
+ p && (p.focus(), document.execCommand("cut"));
1247
+ }, u = () => {
1248
+ const o = M.value;
1249
+ o && navigator.clipboard.readText().then((p) => {
1250
+ o.update(() => {
1251
1251
  const H = A();
1252
- R(H) && H.insertText(m);
1253
- }), n.focus();
1252
+ R(H) && H.insertText(p);
1253
+ }), o.focus();
1254
1254
  }).catch(() => {
1255
1255
  });
1256
- }, u = () => {
1257
- const n = L.value;
1258
- n && (n.update(() => {
1259
- const m = A();
1260
- if (R(m))
1261
- for (const H of m.getNodes())
1256
+ }, c = () => {
1257
+ const o = M.value;
1258
+ o && (o.update(() => {
1259
+ const p = A();
1260
+ if (R(p))
1261
+ for (const H of p.getNodes())
1262
1262
  me(H) && (H.setFormat(0), H.setStyle(""));
1263
- }), n.focus());
1264
- }, o = () => {
1265
- const n = L.value;
1266
- n && (n.dispatchCommand($e, {
1263
+ }), o.focus());
1264
+ }, i = () => {
1265
+ const o = M.value;
1266
+ o && (o.dispatchCommand($e, {
1267
1267
  rows: "3",
1268
1268
  columns: "3",
1269
1269
  includeHeaders: !0
1270
- }), n.focus());
1271
- }, O = {
1270
+ }), o.focus());
1271
+ }, _ = {
1272
1272
  value: "",
1273
- label: x.value.lexical.defaultOption
1274
- }, q = [
1275
- O,
1276
- ...l.fontFamilies ?? fn
1277
- ], c = [
1278
- O,
1279
- ...l.fontSizes ?? mn
1280
- ], F = [
1281
- O,
1282
- ...l.lineHeights ?? pn
1273
+ label: v.value.lexical.defaultOption
1274
+ }, V = [
1275
+ _,
1276
+ ...r.fontFamilies ?? fn
1277
+ ], d = [
1278
+ _,
1279
+ ...r.fontSizes ?? mn
1280
+ ], B = [
1281
+ _,
1282
+ ...r.lineHeights ?? pn
1283
1283
  ], $ = t.map(() => {
1284
- const n = L.value;
1285
- return n ? n.getEditorState().read(() => {
1286
- const m = A();
1287
- return R(m) ? ve(m, "font-family", "") : "";
1284
+ const o = M.value;
1285
+ return o ? o.getEditorState().read(() => {
1286
+ const p = A();
1287
+ return R(p) ? xe(p, "font-family", "") : "";
1288
1288
  }) : "";
1289
1289
  }), G = t.map(() => {
1290
- const n = L.value;
1291
- return n ? n.getEditorState().read(() => {
1292
- const m = A();
1293
- return R(m) ? ve(m, "font-size", "") : "";
1290
+ const o = M.value;
1291
+ return o ? o.getEditorState().read(() => {
1292
+ const p = A();
1293
+ return R(p) ? xe(p, "font-size", "") : "";
1294
1294
  }) : "";
1295
- }), wt = (n) => {
1296
- const m = L.value;
1297
- m && (m.update(() => {
1295
+ }), wt = (o) => {
1296
+ const p = M.value;
1297
+ p && (p.update(() => {
1298
1298
  const H = A();
1299
- R(H) && xe(H, { "font-family": n || null });
1300
- }), m.focus());
1301
- }, Mt = (n) => {
1302
- const m = L.value;
1303
- m && (m.update(() => {
1299
+ R(H) && ve(H, { "font-family": o || null });
1300
+ }), p.focus());
1301
+ }, Mt = (o) => {
1302
+ const p = M.value;
1303
+ p && (p.update(() => {
1304
1304
  const H = A();
1305
- R(H) && xe(H, { "font-size": n || null });
1306
- }), m.focus());
1305
+ R(H) && ve(H, { "font-size": o || null });
1306
+ }), p.focus());
1307
1307
  }, Lt = t.map(() => {
1308
- const n = L.value;
1309
- return n ? n.getEditorState().read(() => {
1310
- const m = A();
1311
- return R(m) && ve(m, "color", "") || "#000000";
1308
+ const o = M.value;
1309
+ return o ? o.getEditorState().read(() => {
1310
+ const p = A();
1311
+ return R(p) && xe(p, "color", "") || "#000000";
1312
1312
  }) : "#000000";
1313
1313
  }), _t = t.map(() => {
1314
- const n = L.value;
1315
- return n ? n.getEditorState().read(() => {
1316
- const m = A();
1317
- return R(m) && ve(m, "background-color", "") || "#ffffff";
1314
+ const o = M.value;
1315
+ return o ? o.getEditorState().read(() => {
1316
+ const p = A();
1317
+ return R(p) && xe(p, "background-color", "") || "#ffffff";
1318
1318
  }) : "#ffffff";
1319
1319
  }), At = t.map(() => {
1320
- const n = L.value;
1321
- return n ? n.getEditorState().read(() => {
1322
- const m = A();
1323
- if (R(m)) {
1324
- const J = N(m).getStyle();
1320
+ const o = M.value;
1321
+ return o ? o.getEditorState().read(() => {
1322
+ const p = A();
1323
+ if (R(p)) {
1324
+ const J = N(p).getStyle();
1325
1325
  return ce(J, "background-color") || "#ffffff";
1326
1326
  }
1327
1327
  return "#ffffff";
1328
1328
  }) : "#ffffff";
1329
1329
  }), Rt = t.map(() => {
1330
- const n = L.value;
1331
- return n ? n.getEditorState().read(() => {
1332
- const m = A();
1333
- if (R(m)) {
1334
- const J = N(m).getStyle();
1330
+ const o = M.value;
1331
+ return o ? o.getEditorState().read(() => {
1332
+ const p = A();
1333
+ if (R(p)) {
1334
+ const J = N(p).getStyle();
1335
1335
  return ce(J, "line-height") || "";
1336
1336
  }
1337
1337
  return "";
1338
1338
  }) : "";
1339
- }), It = (n) => {
1340
- const m = L.value;
1341
- m && (m.update(() => {
1339
+ }), It = (o) => {
1340
+ const p = M.value;
1341
+ p && (p.update(() => {
1342
1342
  const H = A();
1343
- R(H) && xe(H, { color: n });
1344
- }), m.focus());
1345
- }, Dt = (n) => {
1346
- const m = L.value;
1347
- m && (m.update(() => {
1343
+ R(H) && ve(H, { color: o });
1344
+ }), p.focus());
1345
+ }, Dt = (o) => {
1346
+ const p = M.value;
1347
+ p && (p.update(() => {
1348
1348
  const H = A();
1349
- R(H) && xe(H, { "background-color": n });
1350
- }), m.focus());
1351
- }, Ft = (n) => {
1352
- const m = L.value;
1353
- m && (m.update(() => {
1349
+ R(H) && ve(H, { "background-color": o });
1350
+ }), p.focus());
1351
+ }, Ft = (o) => {
1352
+ const p = M.value;
1353
+ p && (p.update(() => {
1354
1354
  const H = A();
1355
1355
  if (R(H)) {
1356
1356
  const J = N(H), ie = J.getStyle(), re = he(
1357
1357
  ie,
1358
1358
  "background-color",
1359
- n
1359
+ o
1360
1360
  );
1361
1361
  J.setStyle(re);
1362
1362
  }
1363
- }), m.focus());
1364
- }, Ht = (n) => {
1365
- const m = L.value;
1366
- m && (m.update(() => {
1363
+ }), p.focus());
1364
+ }, Ht = (o) => {
1365
+ const p = M.value;
1366
+ p && (p.update(() => {
1367
1367
  const H = A();
1368
1368
  if (R(H)) {
1369
1369
  const J = N(H), ie = J.getStyle(), re = he(
1370
1370
  ie,
1371
1371
  "line-height",
1372
- n
1372
+ o
1373
1373
  );
1374
1374
  J.setStyle(re);
1375
1375
  }
1376
- }), m.focus());
1376
+ }), p.focus());
1377
1377
  }, P = /* @__PURE__ */ new Map();
1378
1378
  P.set(
1379
1379
  "bold",
1380
- () => h({
1381
- active: y("bold"),
1382
- onClick: S(te, "bold"),
1383
- label: g.map((n) => n.bold),
1380
+ () => b({
1381
+ active: E("bold"),
1382
+ onClick: T(te, "bold"),
1383
+ label: h.map((o) => o.bold),
1384
1384
  icon: "mdi:format-bold"
1385
1385
  })
1386
1386
  ), P.set(
1387
1387
  "italic",
1388
- () => h({
1389
- active: y("italic"),
1390
- onClick: S(te, "italic"),
1391
- label: g.map((n) => n.italic),
1388
+ () => b({
1389
+ active: E("italic"),
1390
+ onClick: T(te, "italic"),
1391
+ label: h.map((o) => o.italic),
1392
1392
  icon: "mdi:format-italic"
1393
1393
  })
1394
1394
  ), P.set(
1395
1395
  "underline",
1396
- () => h({
1397
- active: y("underline"),
1398
- onClick: S(te, "underline"),
1399
- label: g.map((n) => n.underline),
1396
+ () => b({
1397
+ active: E("underline"),
1398
+ onClick: T(te, "underline"),
1399
+ label: h.map((o) => o.underline),
1400
1400
  icon: "mdi:format-underline"
1401
1401
  })
1402
1402
  ), P.set(
1403
1403
  "strikethrough",
1404
- () => h({
1405
- active: y("strikethrough"),
1406
- onClick: S(te, "strikethrough"),
1407
- label: g.map((n) => n.strikethrough),
1404
+ () => b({
1405
+ active: E("strikethrough"),
1406
+ onClick: T(te, "strikethrough"),
1407
+ label: h.map((o) => o.strikethrough),
1408
1408
  icon: "mdi:format-strikethrough"
1409
1409
  })
1410
1410
  ), P.set(
1411
1411
  "code",
1412
- () => h({
1413
- active: y("code"),
1414
- onClick: S(te, "code"),
1415
- label: g.map((n) => n.code),
1412
+ () => b({
1413
+ active: E("code"),
1414
+ onClick: T(te, "code"),
1415
+ label: h.map((o) => o.code),
1416
1416
  icon: "mdi:code-tags"
1417
1417
  })
1418
1418
  ), P.set(
1419
1419
  "clear-formatting",
1420
- () => h({
1420
+ () => b({
1421
1421
  active: z(!1),
1422
- onClick: u,
1423
- label: g.map((n) => n.clearFormatting),
1422
+ onClick: c,
1423
+ label: h.map((o) => o.clearFormatting),
1424
1424
  icon: "mdi:format-clear"
1425
1425
  })
1426
1426
  ), P.set(
1427
1427
  "paragraph",
1428
- () => h({
1429
- active: f("paragraph"),
1430
- onClick: _,
1431
- label: g.map((n) => n.normal),
1428
+ () => b({
1429
+ active: m("paragraph"),
1430
+ onClick: w,
1431
+ label: h.map((o) => o.normal),
1432
1432
  icon: "mdi:format-paragraph"
1433
1433
  })
1434
1434
  );
1435
- for (let n = 1; n <= s; n++)
1435
+ for (let o = 1; o <= s; o++)
1436
1436
  P.set(
1437
- `heading-${n}`,
1438
- () => h({
1439
- active: b(n),
1440
- onClick: () => r(n),
1441
- label: g.map((m) => m.heading(n)),
1442
- icon: `mdi:format-header-${n}`
1437
+ `heading-${o}`,
1438
+ () => b({
1439
+ active: y(o),
1440
+ onClick: () => a(o),
1441
+ label: h.map((p) => p.heading(o)),
1442
+ icon: `mdi:format-header-${o}`
1443
1443
  })
1444
1444
  );
1445
1445
  P.set(
1446
1446
  "bullet-list",
1447
- () => h({
1448
- active: k("bullet"),
1449
- onClick: S(Ee, void 0),
1450
- label: g.map((n) => n.bulletList),
1447
+ () => b({
1448
+ active: C("bullet"),
1449
+ onClick: T(Ee, void 0),
1450
+ label: h.map((o) => o.bulletList),
1451
1451
  icon: "mdi:format-list-bulleted"
1452
1452
  })
1453
1453
  ), P.set(
1454
1454
  "ordered-list",
1455
- () => h({
1456
- active: k("number"),
1457
- onClick: S(ke, void 0),
1458
- label: g.map((n) => n.orderedList),
1455
+ () => b({
1456
+ active: C("number"),
1457
+ onClick: T(ke, void 0),
1458
+ label: h.map((o) => o.orderedList),
1459
1459
  icon: "mdi:format-list-numbered"
1460
1460
  })
1461
1461
  ), P.set(
1462
1462
  "check-list",
1463
- () => h({
1464
- active: k("check"),
1465
- onClick: S(yt, void 0),
1466
- label: g.map((n) => n.checkList),
1463
+ () => b({
1464
+ active: C("check"),
1465
+ onClick: T(yt, void 0),
1466
+ label: h.map((o) => o.checkList),
1467
1467
  icon: "mdi:format-list-checks"
1468
1468
  })
1469
1469
  ), P.set(
1470
1470
  "indent",
1471
- () => h({
1471
+ () => b({
1472
1472
  active: z(!1),
1473
- onClick: S(yo, void 0),
1474
- label: g.map((n) => n.indent),
1473
+ onClick: T(yo, void 0),
1474
+ label: h.map((o) => o.indent),
1475
1475
  icon: "mdi:format-indent-increase"
1476
1476
  })
1477
1477
  ), P.set(
1478
1478
  "outdent",
1479
- () => h({
1479
+ () => b({
1480
1480
  active: z(!1),
1481
- onClick: S(vo, void 0),
1482
- label: g.map((n) => n.outdent),
1481
+ onClick: T(xo, void 0),
1482
+ label: h.map((o) => o.outdent),
1483
1483
  icon: "mdi:format-indent-decrease"
1484
1484
  })
1485
1485
  ), P.set(
1486
1486
  "blockquote",
1487
- () => h({
1488
- active: f("quote"),
1489
- onClick: M("quote", Be),
1490
- label: g.map((n) => n.blockquote),
1487
+ () => b({
1488
+ active: m("quote"),
1489
+ onClick: O("quote", Be),
1490
+ label: h.map((o) => o.blockquote),
1491
1491
  icon: "mdi:format-quote-close"
1492
1492
  })
1493
1493
  ), P.set(
1494
1494
  "code-block",
1495
- () => h({
1496
- active: f("code"),
1497
- onClick: M("code", Ue),
1498
- label: g.map((n) => n.codeBlock),
1495
+ () => b({
1496
+ active: m("code"),
1497
+ onClick: O("code", Ue),
1498
+ label: h.map((o) => o.codeBlock),
1499
1499
  icon: "mdi:code-braces"
1500
1500
  })
1501
1501
  ), P.set(
1502
1502
  "horizontal-rule",
1503
- () => h({
1503
+ () => b({
1504
1504
  active: z(!1),
1505
- onClick: S(Oe, void 0),
1506
- label: g.map((n) => n.horizontalRule),
1505
+ onClick: T(Oe, void 0),
1506
+ label: h.map((o) => o.horizontalRule),
1507
1507
  icon: "mdi:minus"
1508
1508
  })
1509
1509
  ), P.set(
1510
1510
  "insert-table",
1511
- () => h({
1511
+ () => b({
1512
1512
  active: z(!1),
1513
- onClick: o,
1514
- label: g.map((n) => n.insertTable),
1513
+ onClick: i,
1514
+ label: h.map((o) => o.insertTable),
1515
1515
  icon: "mdi:table-plus"
1516
1516
  })
1517
1517
  ), P.set(
1518
1518
  "link",
1519
- () => h({
1520
- active: v(),
1521
- onClick: B,
1522
- label: g.map((n) => n.link),
1519
+ () => b({
1520
+ active: x(),
1521
+ onClick: I,
1522
+ label: h.map((o) => o.link),
1523
1523
  icon: "mdi:link"
1524
1524
  })
1525
1525
  ), P.set(
1526
1526
  "undo",
1527
- () => h({
1527
+ () => b({
1528
1528
  active: z(!1),
1529
- onClick: S(xo, void 0),
1530
- label: g.map((n) => n.undo),
1529
+ onClick: T(vo, void 0),
1530
+ label: h.map((o) => o.undo),
1531
1531
  icon: "mdi:undo"
1532
1532
  })
1533
1533
  ), P.set(
1534
1534
  "redo",
1535
- () => h({
1535
+ () => b({
1536
1536
  active: z(!1),
1537
- onClick: S(Co, void 0),
1538
- label: g.map((n) => n.redo),
1537
+ onClick: T(Co, void 0),
1538
+ label: h.map((o) => o.redo),
1539
1539
  icon: "mdi:redo"
1540
1540
  })
1541
1541
  ), P.set(
1542
1542
  "cut",
1543
- () => h({
1543
+ () => b({
1544
1544
  active: z(!1),
1545
- onClick: T,
1546
- label: g.map((n) => n.cut),
1545
+ onClick: S,
1546
+ label: h.map((o) => o.cut),
1547
1547
  icon: "mdi:content-cut"
1548
1548
  })
1549
1549
  ), P.set(
1550
1550
  "copy",
1551
- () => h({
1551
+ () => b({
1552
1552
  active: z(!1),
1553
- onClick: I,
1554
- label: g.map((n) => n.copy),
1553
+ onClick: F,
1554
+ label: h.map((o) => o.copy),
1555
1555
  icon: "mdi:content-copy"
1556
1556
  })
1557
1557
  ), P.set(
1558
1558
  "paste",
1559
- () => h({
1559
+ () => b({
1560
1560
  active: z(!1),
1561
- onClick: C,
1562
- label: g.map((n) => n.paste),
1561
+ onClick: u,
1562
+ label: h.map((o) => o.paste),
1563
1563
  icon: "mdi:content-paste"
1564
1564
  })
1565
1565
  ), P.set(
1566
1566
  "font-family",
1567
1567
  () => D.select(
1568
- d.class("bc-lexical-toolbar-select"),
1569
- d.title(g.map((n) => n.fontFamily)),
1570
- d.disabled(a),
1571
- X.change(
1572
- (n) => wt(n.target.value)
1568
+ f.class("bc-lexical-toolbar-select"),
1569
+ f.title(h.map((o) => o.fontFamily)),
1570
+ f.disabled(l),
1571
+ ee.change(
1572
+ (o) => wt(o.target.value)
1573
1573
  ),
1574
- ...q.map(
1575
- (n) => D.option(
1576
- d.value(n.value),
1577
- d.selected($.map((m) => m === n.value)),
1578
- n.label
1574
+ ...V.map(
1575
+ (o) => D.option(
1576
+ f.value(o.value),
1577
+ f.selected($.map((p) => p === o.value)),
1578
+ o.label
1579
1579
  )
1580
1580
  )
1581
1581
  )
1582
1582
  ), P.set(
1583
1583
  "font-size",
1584
1584
  () => D.select(
1585
- d.class("bc-lexical-toolbar-select"),
1586
- d.title(g.map((n) => n.fontSize)),
1587
- d.disabled(a),
1588
- X.change((n) => Mt(n.target.value)),
1589
- ...c.map(
1590
- (n) => D.option(
1591
- d.value(n.value),
1592
- d.selected(G.map((m) => m === n.value)),
1593
- n.label
1585
+ f.class("bc-lexical-toolbar-select"),
1586
+ f.title(h.map((o) => o.fontSize)),
1587
+ f.disabled(l),
1588
+ ee.change((o) => Mt(o.target.value)),
1589
+ ...d.map(
1590
+ (o) => D.option(
1591
+ f.value(o.value),
1592
+ f.selected(G.map((p) => p === o.value)),
1593
+ o.label
1594
1594
  )
1595
1595
  )
1596
1596
  )
1597
1597
  ), P.set(
1598
1598
  "line-height",
1599
1599
  () => D.select(
1600
- d.class("bc-lexical-toolbar-select"),
1601
- d.title(g.map((n) => n.lineHeight)),
1602
- d.disabled(a),
1603
- X.change(
1604
- (n) => Ht(n.target.value)
1600
+ f.class("bc-lexical-toolbar-select"),
1601
+ f.title(h.map((o) => o.lineHeight)),
1602
+ f.disabled(l),
1603
+ ee.change(
1604
+ (o) => Ht(o.target.value)
1605
1605
  ),
1606
- ...F.map(
1607
- (n) => D.option(
1608
- d.value(n.value),
1609
- d.selected(Rt.map((m) => m === n.value)),
1610
- n.label
1606
+ ...B.map(
1607
+ (o) => D.option(
1608
+ f.value(o.value),
1609
+ f.selected(Rt.map((p) => p === o.value)),
1610
+ o.label
1611
1611
  )
1612
1612
  )
1613
1613
  )
1614
1614
  ), P.set(
1615
1615
  "font-color",
1616
1616
  () => D.label(
1617
- d.class("bc-lexical-toolbar-color"),
1618
- d.title(g.map((n) => n.fontColor)),
1617
+ f.class("bc-lexical-toolbar-color"),
1618
+ f.title(h.map((o) => o.fontColor)),
1619
1619
  D.input(
1620
- d.type("color"),
1621
- d.value(Lt),
1622
- d.disabled(a),
1623
- X.input((n) => It(n.target.value))
1620
+ f.type("color"),
1621
+ f.value(Lt),
1622
+ f.disabled(l),
1623
+ ee.input((o) => It(o.target.value))
1624
1624
  ),
1625
- D.span(d.class("bc-lexical-toolbar-color-icon"), "A")
1625
+ D.span(f.class("bc-lexical-toolbar-color-icon"), "A")
1626
1626
  )
1627
1627
  ), P.set(
1628
1628
  "highlight-color",
1629
1629
  () => D.label(
1630
- d.class("bc-lexical-toolbar-color"),
1631
- d.title(g.map((n) => n.highlightColor)),
1630
+ f.class("bc-lexical-toolbar-color"),
1631
+ f.title(h.map((o) => o.highlightColor)),
1632
1632
  D.input(
1633
- d.type("color"),
1634
- d.value(_t),
1635
- d.disabled(a),
1636
- X.input((n) => Dt(n.target.value))
1633
+ f.type("color"),
1634
+ f.value(_t),
1635
+ f.disabled(l),
1636
+ ee.input((o) => Dt(o.target.value))
1637
1637
  ),
1638
1638
  D.span(
1639
- d.class(
1639
+ f.class(
1640
1640
  "bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--highlight"
1641
1641
  ),
1642
1642
  "A"
@@ -1645,16 +1645,16 @@ function gn({
1645
1645
  ), P.set(
1646
1646
  "background-color",
1647
1647
  () => D.label(
1648
- d.class("bc-lexical-toolbar-color"),
1649
- d.title(g.map((n) => n.backgroundColor)),
1648
+ f.class("bc-lexical-toolbar-color"),
1649
+ f.title(h.map((o) => o.backgroundColor)),
1650
1650
  D.input(
1651
- d.type("color"),
1652
- d.value(At),
1653
- d.disabled(a),
1654
- X.input((n) => Ft(n.target.value))
1651
+ f.type("color"),
1652
+ f.value(At),
1653
+ f.disabled(l),
1654
+ ee.input((o) => Ft(o.target.value))
1655
1655
  ),
1656
1656
  D.span(
1657
- d.class(
1657
+ f.class(
1658
1658
  "bc-lexical-toolbar-color-icon bc-lexical-toolbar-color-icon--bg"
1659
1659
  ),
1660
1660
  "■"
@@ -1662,297 +1662,297 @@ function gn({
1662
1662
  )
1663
1663
  );
1664
1664
  const ct = {
1665
- editor: L,
1665
+ editor: M,
1666
1666
  stateUpdate: t,
1667
- readOnly: a,
1668
- size: i,
1669
- button: (n) => h({
1670
- active: n.active ?? z(!1),
1671
- onClick: n.onClick,
1672
- label: n.label,
1673
- icon: n.icon
1667
+ readOnly: l,
1668
+ size: n,
1669
+ button: (o) => b({
1670
+ active: o.active ?? z(!1),
1671
+ onClick: o.onClick,
1672
+ label: o.label,
1673
+ icon: o.icon
1674
1674
  })
1675
- }, ut = (n) => {
1676
- if (n.type === "button") {
1677
- const m = n;
1675
+ }, ut = (o) => {
1676
+ if (o.type === "button") {
1677
+ const p = o;
1678
1678
  P.set(
1679
- n.id,
1680
- () => h({
1681
- active: m.active?.(ct) ?? z(!1),
1682
- onClick: () => m.onClick(L.value),
1683
- label: m.label,
1684
- icon: m.icon
1679
+ o.id,
1680
+ () => b({
1681
+ active: p.active?.(ct) ?? z(!1),
1682
+ onClick: () => p.onClick(M.value),
1683
+ label: p.label,
1684
+ icon: p.icon
1685
1685
  })
1686
1686
  );
1687
- } else if (n.type === "select") {
1688
- const m = n, H = m.resetOnSelect !== !1;
1687
+ } else if (o.type === "select") {
1688
+ const p = o, H = p.resetOnSelect !== !1;
1689
1689
  P.set(
1690
- n.id,
1690
+ o.id,
1691
1691
  () => D.select(
1692
- d.class("bc-lexical-toolbar-select"),
1693
- d.title(m.label),
1694
- d.disabled(a),
1695
- X.change((J) => {
1692
+ f.class("bc-lexical-toolbar-select"),
1693
+ f.title(p.label),
1694
+ f.disabled(l),
1695
+ ee.change((J) => {
1696
1696
  const ie = J.target, re = ie.value;
1697
- re !== "" && (m.onSelect(re, L.value), H && (ie.value = ""));
1697
+ re !== "" && (p.onSelect(re, M.value), H && (ie.value = ""));
1698
1698
  }),
1699
1699
  D.option(
1700
- d.value(""),
1701
- d.disabled(H),
1702
- d.selected(!0),
1703
- m.label
1700
+ f.value(""),
1701
+ f.disabled(H),
1702
+ f.selected(!0),
1703
+ p.label
1704
1704
  ),
1705
- ...m.options.map(
1706
- (J) => D.option(d.value(J.value), J.label)
1705
+ ...p.options.map(
1706
+ (J) => D.option(f.value(J.value), J.label)
1707
1707
  )
1708
1708
  )
1709
1709
  );
1710
- } else if (n.type === "custom") {
1711
- const m = n;
1712
- P.set(n.id, () => m.render(ct));
1710
+ } else if (o.type === "custom") {
1711
+ const p = o;
1712
+ P.set(o.id, () => p.render(ct));
1713
1713
  }
1714
1714
  };
1715
- if (l.customItems)
1716
- for (const n of l.customItems)
1717
- ut(n);
1718
- if (l.customGroups)
1719
- for (const n of l.customGroups)
1720
- for (const m of n.items)
1721
- ut(m);
1715
+ if (r.customItems)
1716
+ for (const o of r.customItems)
1717
+ ut(o);
1718
+ if (r.customGroups)
1719
+ for (const o of r.customGroups)
1720
+ for (const p of o.items)
1721
+ ut(p);
1722
1722
  return Bo(
1723
1723
  {},
1724
- d.class("bc-lexical-toolbar"),
1725
- ...hn(p, P, s, l.customGroups)
1724
+ f.class("bc-lexical-toolbar"),
1725
+ ...hn(g, P, s, r.customGroups)
1726
1726
  );
1727
1727
  })
1728
1728
  );
1729
1729
  }
1730
- function hn(e, t, l, a) {
1731
- const i = /* @__PURE__ */ new Map();
1732
- if (a)
1733
- for (const p of a)
1734
- i.set(p.id, p);
1730
+ function hn(e, t, r, l) {
1731
+ const n = /* @__PURE__ */ new Map();
1732
+ if (l)
1733
+ for (const g of l)
1734
+ n.set(g.id, g);
1735
1735
  const s = [];
1736
- for (const p of e) {
1737
- if ("separator" in p) {
1736
+ for (const g of e) {
1737
+ if ("separator" in g) {
1738
1738
  s.push($o());
1739
1739
  continue;
1740
1740
  }
1741
- if ("customGroup" in p) {
1742
- const g = i.get(p.customGroup);
1743
- if (!g) continue;
1741
+ if ("customGroup" in g) {
1742
+ const h = n.get(g.customGroup);
1743
+ if (!h) continue;
1744
1744
  const N = [];
1745
- for (const f of g.items) {
1746
- const k = t.get(f.id);
1747
- k && N.push(k());
1745
+ for (const m of h.items) {
1746
+ const C = t.get(m.id);
1747
+ C && N.push(C());
1748
1748
  }
1749
1749
  if (N.length === 0) continue;
1750
- const y = N.map(() => z(!0));
1751
- s.push(gt({ display: y }, ...N));
1750
+ const E = N.map(() => z(!0));
1751
+ s.push(gt({ display: E }, ...N));
1752
1752
  continue;
1753
1753
  }
1754
- let x = p.items ?? sn[p.group] ?? [];
1755
- p.group === "headings" && !p.items && (x = x.filter((g) => g.startsWith("heading-") ? parseInt(g.split("-")[1], 10) <= l : !0));
1756
- const w = [];
1757
- for (const g of x) {
1758
- const N = t.get(g);
1759
- N && w.push(N());
1754
+ let v = g.items ?? sn[g.group] ?? [];
1755
+ g.group === "headings" && !g.items && (v = v.filter((h) => h.startsWith("heading-") ? parseInt(h.split("-")[1], 10) <= r : !0));
1756
+ const L = [];
1757
+ for (const h of v) {
1758
+ const N = t.get(h);
1759
+ N && L.push(N());
1760
1760
  }
1761
- if (w.length === 0) continue;
1762
- const L = w.map(() => z(!0));
1763
- s.push(gt({ display: L }, ...w));
1761
+ if (L.length === 0) continue;
1762
+ const M = L.map(() => z(!0));
1763
+ s.push(gt({ display: M }, ...L));
1764
1764
  }
1765
1765
  return s;
1766
1766
  }
1767
1767
  function Ot({
1768
1768
  editor: e,
1769
1769
  stateUpdate: t,
1770
- readOnly: l = z(!1)
1770
+ readOnly: r = z(!1)
1771
1771
  }) {
1772
- const a = j(!1), i = j(0), s = j(0);
1773
- let p = null, x = null;
1774
- const w = j(!1), L = (E) => {
1775
- let h = null;
1776
- return E.getEditorState().read(() => {
1777
- const _ = A();
1778
- if (!R(_)) return;
1779
- let r = _.anchor.getNode();
1780
- for (; r; ) {
1781
- if (qt(r)) {
1782
- h = r;
1772
+ const l = j(!1), n = j(0), s = j(0);
1773
+ let g = null;
1774
+ const v = j(!1), L = (I) => {
1775
+ let k = null;
1776
+ return I.getEditorState().read(() => {
1777
+ const b = A();
1778
+ if (!R(b)) return;
1779
+ let w = b.anchor.getNode();
1780
+ for (; w; ) {
1781
+ if (qt(w)) {
1782
+ k = w;
1783
1783
  break;
1784
1784
  }
1785
- if (r = r.getParent(), !r || r.getKey() === "root") break;
1785
+ if (w = w.getParent(), !w || w.getKey() === "root") break;
1786
1786
  }
1787
- }), h;
1788
- }, g = (E, h) => {
1789
- const _ = E.getBoundingClientRect(), r = h.closest(".bc-lexical-editor-container"), I = r ? r.getBoundingClientRect() : h.getBoundingClientRect();
1790
- return i.value = _.top - I.top + 2, s.value = I.right - _.right + 2, !0;
1791
- }, N = () => {
1792
- const E = e.value;
1793
- if (!E) {
1794
- a.value = !1;
1787
+ }), k;
1788
+ }, M = (I, k) => {
1789
+ const b = I.getBoundingClientRect(), w = k.closest(".bc-lexical-editor-container"), a = w ? w.getBoundingClientRect() : k.getBoundingClientRect();
1790
+ return n.value = b.top - a.top + 2, s.value = a.right - b.right + 2, !0;
1791
+ }, h = () => {
1792
+ const I = e.value;
1793
+ if (!I) {
1794
+ l.value = !1;
1795
1795
  return;
1796
1796
  }
1797
- const h = L(E);
1798
- if (!h) {
1799
- w.value || (a.value = !1);
1797
+ const k = L(I);
1798
+ if (!k) {
1799
+ v.value || (l.value = !1);
1800
1800
  return;
1801
1801
  }
1802
- const _ = E.getElementByKey(h.getKey()), r = E.getRootElement();
1803
- _ && r ? (g(_, r), a.value = !0) : a.value = !1;
1802
+ const b = I.getElementByKey(k.getKey()), w = I.getRootElement();
1803
+ b && w ? (M(b, w), l.value = !0) : l.value = !1;
1804
1804
  };
1805
- t.onChange(N);
1806
- const y = (E) => () => {
1807
- const h = e.value;
1808
- h && (h.update(E), x?.(), h.focus());
1809
- }, f = y(() => ft(!1)), k = y(() => ft(!0)), b = y(
1805
+ t.onChange(h);
1806
+ const N = (I) => () => {
1807
+ const k = e.value;
1808
+ k && (k.update(I), g?.set(!1), k.focus());
1809
+ }, E = N(() => ft(!1)), m = N(() => ft(!0)), C = N(
1810
1810
  () => mt(!1)
1811
- ), v = y(
1811
+ ), y = N(
1812
1812
  () => mt(!0)
1813
- ), S = y(() => Yt()), M = y(() => Wt()), B = y(() => {
1814
- const E = A();
1815
- if (!R(E)) return;
1816
- const h = E.anchor.getNode(), _ = Vt(h);
1817
- if (!_) return;
1818
- Zt(_).remove();
1813
+ ), x = N(() => Yt()), T = N(() => Wt()), O = N(() => {
1814
+ const I = A();
1815
+ if (!R(I)) return;
1816
+ const k = I.anchor.getNode(), b = Vt(k);
1817
+ if (!b) return;
1818
+ Zt(b).remove();
1819
1819
  });
1820
1820
  return ue(
1821
1821
  ye,
1822
- (E) => Se(e, (h) => {
1823
- const _ = h, r = E.$.lexical, I = (o) => {
1824
- const O = _.value;
1825
- if (!O || l.value) return;
1826
- const q = O.getRootElement();
1827
- if (!q) return;
1828
- const F = o.target.closest("td, th");
1829
- F && q.contains(F) && (o.preventDefault(), g(F, q) && (a.value = !0), Po(() => {
1830
- p?.();
1822
+ (I) => Se(e, (k) => {
1823
+ const b = k, w = I.$.lexical, a = (c) => {
1824
+ const i = b.value;
1825
+ if (!i || r.value) return;
1826
+ const _ = i.getRootElement();
1827
+ if (!_) return;
1828
+ const d = c.target.closest("td, th");
1829
+ d && _.contains(d) && (c.preventDefault(), M(d, _) && (l.value = !0), Po(() => {
1830
+ g?.set(!0);
1831
1831
  }));
1832
- }, T = _.value?.getRootElement(), u = T?.closest(
1832
+ }, F = b.value?.getRootElement(), u = F?.closest(
1833
1833
  ".bc-lexical-editor-container"
1834
- ) ?? T ?? document;
1835
- return u.addEventListener("contextmenu", I), [
1834
+ ) ?? F ?? document;
1835
+ return u.addEventListener("contextmenu", a), [
1836
1836
  ne(() => {
1837
- u.removeEventListener("contextmenu", I);
1837
+ u.removeEventListener("contextmenu", a);
1838
1838
  }),
1839
1839
  pe(
1840
- a,
1840
+ l,
1841
1841
  () => D.div(
1842
- d.class("bc-table-cell-marker"),
1843
- W.position("absolute"),
1844
- W.top(i.map((o) => `${o}px`)),
1845
- W.right(s.map((o) => `${o}px`)),
1846
- W.zIndex("10"),
1842
+ f.class("bc-table-cell-marker"),
1843
+ Y.position("absolute"),
1844
+ Y.top(n.map((c) => `${c}px`)),
1845
+ Y.right(s.map((c) => `${c}px`)),
1846
+ Y.zIndex("10"),
1847
1847
  // Prevent mousedown from stealing focus from editor
1848
- oe((o) => {
1849
- o.addEventListener("mousedown", (O) => {
1850
- O.preventDefault();
1848
+ oe((c) => {
1849
+ c.addEventListener("mousedown", (i) => {
1850
+ i.preventDefault();
1851
1851
  });
1852
1852
  }),
1853
1853
  D.button(
1854
- d.class("bc-table-cell-marker__button"),
1855
- d.type("button"),
1856
- d.title(r.map((o) => o.tableActions)),
1857
- d.disabled(l),
1854
+ f.class("bc-table-cell-marker__button"),
1855
+ f.type("button"),
1856
+ f.title(w.map((c) => c.tableActions)),
1857
+ f.disabled(r),
1858
1858
  Z({ icon: "lucide:chevron-down", size: "xs" }),
1859
1859
  // Track menu open state via aria-expanded
1860
- oe((o) => {
1861
- const O = new MutationObserver(() => {
1862
- const q = o.getAttribute("aria-expanded") === "true";
1863
- w.value = q;
1860
+ oe((c) => {
1861
+ const i = new MutationObserver(() => {
1862
+ const _ = c.getAttribute("aria-expanded") === "true";
1863
+ v.value = _;
1864
1864
  });
1865
- return O.observe(o, {
1865
+ return i.observe(c, {
1866
1866
  attributes: !0,
1867
1867
  attributeFilter: ["aria-expanded"]
1868
- }), ne(() => O.disconnect());
1868
+ }), ne(() => i.disconnect());
1869
1869
  }),
1870
1870
  Et({
1871
1871
  items: () => [
1872
1872
  le({
1873
1873
  key: "insert-row-above",
1874
- content: r.map((o) => o.insertRowAbove),
1874
+ content: w.map((c) => c.insertRowAbove),
1875
1875
  before: Z({
1876
1876
  icon: "lucide:arrow-up",
1877
1877
  size: "sm"
1878
1878
  }),
1879
- onClick: f,
1880
- disabled: l
1879
+ onClick: E,
1880
+ disabled: r
1881
1881
  }),
1882
1882
  le({
1883
1883
  key: "insert-row-below",
1884
- content: r.map((o) => o.insertRowBelow),
1884
+ content: w.map((c) => c.insertRowBelow),
1885
1885
  before: Z({
1886
1886
  icon: "lucide:arrow-down",
1887
1887
  size: "sm"
1888
1888
  }),
1889
- onClick: k,
1890
- disabled: l
1889
+ onClick: m,
1890
+ disabled: r
1891
1891
  }),
1892
1892
  le({
1893
1893
  key: "insert-column-left",
1894
- content: r.map((o) => o.insertColumnLeft),
1894
+ content: w.map((c) => c.insertColumnLeft),
1895
1895
  before: Z({
1896
1896
  icon: "lucide:arrow-left",
1897
1897
  size: "sm"
1898
1898
  }),
1899
- onClick: b,
1900
- disabled: l
1899
+ onClick: C,
1900
+ disabled: r
1901
1901
  }),
1902
1902
  le({
1903
1903
  key: "insert-column-right",
1904
- content: r.map((o) => o.insertColumnRight),
1904
+ content: w.map((c) => c.insertColumnRight),
1905
1905
  before: Z({
1906
1906
  icon: "lucide:arrow-right",
1907
1907
  size: "sm"
1908
1908
  }),
1909
- onClick: v,
1910
- disabled: l
1909
+ onClick: y,
1910
+ disabled: r
1911
1911
  }),
1912
1912
  Fo(),
1913
1913
  le({
1914
1914
  key: "delete-row",
1915
- content: r.map((o) => o.deleteRow),
1915
+ content: w.map((c) => c.deleteRow),
1916
1916
  before: Z({
1917
1917
  icon: "lucide:trash-2",
1918
1918
  size: "sm"
1919
1919
  }),
1920
- onClick: S,
1921
- disabled: l
1920
+ onClick: x,
1921
+ disabled: r
1922
1922
  }),
1923
1923
  le({
1924
1924
  key: "delete-column",
1925
- content: r.map((o) => o.deleteColumn),
1925
+ content: w.map((c) => c.deleteColumn),
1926
1926
  before: Z({
1927
1927
  icon: "lucide:trash-2",
1928
1928
  size: "sm"
1929
1929
  }),
1930
- onClick: M,
1931
- disabled: l
1930
+ onClick: T,
1931
+ disabled: r
1932
1932
  }),
1933
1933
  le({
1934
1934
  key: "delete-table",
1935
- content: r.map((o) => o.deleteTable),
1935
+ content: w.map((c) => c.deleteTable),
1936
1936
  before: Z({
1937
1937
  icon: "lucide:trash-2",
1938
1938
  size: "sm"
1939
1939
  }),
1940
- onClick: B,
1941
- disabled: l
1940
+ onClick: O,
1941
+ disabled: r
1942
1942
  })
1943
1943
  ],
1944
1944
  placement: "bottom-end",
1945
- showOn: (o, O) => (p = o, x = O, X.click(() => {
1946
- w.value ? O() : (o(), w.value = !0);
1945
+ showOn: (c) => (g = c, ee.click(() => {
1946
+ c.set(!c.value);
1947
1947
  })),
1948
1948
  showDelay: 0,
1949
1949
  hideDelay: 0,
1950
1950
  mainAxisOffset: 4,
1951
1951
  onClose: () => {
1952
- const o = _.value;
1953
- o && o.focus();
1952
+ const c = b.value;
1953
+ c && c.focus();
1954
1954
  },
1955
- ariaLabel: r.map((o) => o.tableActions)
1955
+ ariaLabel: w.map((c) => c.tableActions)
1956
1956
  })
1957
1957
  )
1958
1958
  )
@@ -1964,75 +1964,75 @@ function Ot({
1964
1964
  const ki = (e) => {
1965
1965
  const {
1966
1966
  value: t,
1967
- format: l,
1968
- plugins: a,
1969
- readOnly: i,
1967
+ format: r,
1968
+ plugins: l,
1969
+ readOnly: n,
1970
1970
  placeholder: s,
1971
- class: p,
1972
- namespace: x = "BeatUILexical",
1973
- heightMode: w = "fixed",
1974
- toolbar: L,
1975
- autoFocus: g = !1,
1971
+ class: g,
1972
+ namespace: v = "BeatUILexical",
1973
+ heightMode: L = "fixed",
1974
+ toolbar: M,
1975
+ autoFocus: h = !1,
1976
1976
  onError: N,
1977
- onInput: y,
1978
- onChange: f,
1979
- onBlur: k,
1980
- onReady: b
1981
- } = e, v = j(null), S = j(0), M = (E) => typeof E == "object" && E !== null && "map" in E && typeof E.map == "function", B = i != null ? M(i) ? i : j(U.get(i)) : j(!1);
1977
+ onInput: E,
1978
+ onChange: m,
1979
+ onBlur: C,
1980
+ onReady: y
1981
+ } = e, x = j(null), T = j(0), O = (k) => typeof k == "object" && k !== null && "map" in k && typeof k.map == "function", I = n != null ? O(n) ? n : j(U.get(n)) : j(!1);
1982
1982
  return ue(
1983
1983
  Ye,
1984
- ({ appearance: E }) => D.div(
1984
+ ({ appearance: k }) => D.div(
1985
1985
  // CSS injection via LinkPortal
1986
1986
  Ke(
1987
1987
  () => import("../styles-url-BIeImEjl.js"),
1988
- ({ default: h }) => qe({ id: "beatui-lexical-css", href: h })
1988
+ ({ default: b }) => qe({ id: "beatui-lexical-css", href: b })
1989
1989
  ),
1990
- d.class("bc-lexical-editor-container"),
1991
- w === "fixed" ? d.class("bc-lexical-editor-container--fixed") : null,
1992
- d.class(p),
1990
+ f.class("bc-lexical-editor-container"),
1991
+ L === "fixed" ? f.class("bc-lexical-editor-container--fixed") : null,
1992
+ f.class(g),
1993
1993
  // Toolbar (hidden in readOnly mode)
1994
1994
  pe(
1995
- B.map((h) => !h),
1995
+ I.map((b) => !b),
1996
1996
  () => gn({
1997
- editor: v,
1998
- stateUpdate: S,
1999
- toolbar: L,
2000
- readOnly: B,
1997
+ editor: x,
1998
+ stateUpdate: T,
1999
+ toolbar: M,
2000
+ readOnly: I,
2001
2001
  size: "sm"
2002
2002
  })
2003
2003
  ),
2004
2004
  // Table context menu (appears when cursor is in a table cell)
2005
2005
  Ot({
2006
- editor: v,
2007
- stateUpdate: S,
2008
- readOnly: B
2006
+ editor: x,
2007
+ stateUpdate: T,
2008
+ readOnly: I
2009
2009
  }),
2010
2010
  // The editable surface
2011
2011
  D.div(
2012
- d.class("bc-lexical-editor"),
2013
- d.class(`bc-lexical-editor--${w}`),
2014
- d.contenteditable(
2015
- i != null ? (
2012
+ f.class("bc-lexical-editor"),
2013
+ f.class(`bc-lexical-editor--${L}`),
2014
+ f.contenteditable(
2015
+ n != null ? (
2016
2016
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2017
- U.map(i, (h) => !h)
2017
+ U.map(n, (b) => !b)
2018
2018
  ) : !0
2019
2019
  ),
2020
- i != null ? d.class(
2020
+ n != null ? f.class(
2021
2021
  U.map(
2022
- i,
2023
- (h) => h ? "bc-lexical-editor--readonly" : ""
2022
+ n,
2023
+ (b) => b ? "bc-lexical-editor--readonly" : ""
2024
2024
  )
2025
2025
  ) : null,
2026
- oe((h) => {
2027
- let _ = null;
2028
- const r = [];
2026
+ oe((b) => {
2027
+ let w = null;
2028
+ const a = [];
2029
2029
  return (async () => {
2030
2030
  try {
2031
- const T = a ?? Ve("docked"), C = We(T), u = U.get(
2032
- l ?? "markdown"
2033
- ), o = Ge({
2034
- namespace: x,
2035
- nodes: C,
2031
+ const S = l ?? Ve("docked"), u = We(S), c = U.get(
2032
+ r ?? "markdown"
2033
+ ), i = Ge({
2034
+ namespace: v,
2035
+ nodes: u,
2036
2036
  theme: {
2037
2037
  heading: {
2038
2038
  h1: "bc-lexical-h1",
@@ -2068,143 +2068,143 @@ const ki = (e) => {
2068
2068
  mark: "bc-lexical-mark",
2069
2069
  paragraph: "bc-lexical-paragraph"
2070
2070
  },
2071
- onError: (c) => {
2072
- N ? N(c, o) : console.error("[BeatUI Lexical]", c);
2071
+ onError: (d) => {
2072
+ N ? N(d, i) : console.error("[BeatUI Lexical]", d);
2073
2073
  },
2074
- editable: i ? !U.get(i) : !0,
2074
+ editable: n ? !U.get(n) : !0,
2075
2075
  html: {
2076
2076
  export: we(),
2077
2077
  import: Me()
2078
2078
  }
2079
2079
  });
2080
- _ = o, v.set(o), o.setRootElement(h);
2081
- const O = [];
2082
- if (T.richText ? O.push(Ze(o)) : T.plainText && O.push(Xe(o)), T.history) {
2083
- const c = typeof T.history == "object" ? T.history : void 0;
2084
- O.push(Qe(o, c));
2080
+ w = i, x.set(i), i.setRootElement(b);
2081
+ const _ = [];
2082
+ if (S.richText ? _.push(Ze(i)) : S.plainText && _.push(Xe(i)), S.history) {
2083
+ const d = typeof S.history == "object" ? S.history : void 0;
2084
+ _.push(Qe(i, d));
2085
2085
  }
2086
- if (T.clipboard && O.push(et(o)), T.list && O.push(tt(o)), T.link && O.push(ot(o)), T.yjs && O.push(
2087
- at(o, T.yjs)
2088
- ), T.dragon && O.push(lt(o)), T.table && O.push(rt(o)), (await Promise.all(O)).forEach((c) => {
2089
- c && r.push(c);
2090
- }), r.push(nt(o)), r.push(st(o)), r.push(
2091
- o.registerCommand(
2086
+ if (S.clipboard && _.push(et(i)), S.list && _.push(tt(i)), S.link && _.push(ot(i)), S.yjs && _.push(
2087
+ at(i, S.yjs)
2088
+ ), S.dragon && _.push(lt(i)), S.table && _.push(rt(i)), (await Promise.all(_)).forEach((d) => {
2089
+ d && a.push(d);
2090
+ }), a.push(nt(i)), a.push(st(i)), a.push(
2091
+ i.registerCommand(
2092
2092
  kt,
2093
- () => (S.set(S.value + 1), !1),
2093
+ () => (T.set(T.value + 1), !1),
2094
2094
  K
2095
2095
  )
2096
- ), r.push(
2097
- o.registerUpdateListener(
2098
- ({ editorState: c, dirtyElements: F, dirtyLeaves: $ }) => {
2099
- (F.size > 0 || $.size > 0) && S.set(S.value + 1), y && (F.size > 0 || $.size > 0) && c.read(async () => {
2100
- if (u === "markdown") {
2101
- const G = await Q(o);
2102
- y(G, o);
2103
- } else if (u === "html") {
2104
- const G = await ee(o);
2105
- y(G, o);
2106
- } else u === "json" && y(
2107
- c.toJSON(),
2108
- o
2096
+ ), a.push(
2097
+ i.registerUpdateListener(
2098
+ ({ editorState: d, dirtyElements: B, dirtyLeaves: $ }) => {
2099
+ (B.size > 0 || $.size > 0) && T.set(T.value + 1), E && (B.size > 0 || $.size > 0) && d.read(async () => {
2100
+ if (c === "markdown") {
2101
+ const G = await X(i);
2102
+ E(G, i);
2103
+ } else if (c === "html") {
2104
+ const G = await Q(i);
2105
+ E(G, i);
2106
+ } else c === "json" && E(
2107
+ d.toJSON(),
2108
+ i
2109
2109
  );
2110
2110
  });
2111
2111
  }
2112
2112
  )
2113
2113
  ), t != null) {
2114
- const c = U.get(
2114
+ const d = U.get(
2115
2115
  t
2116
2116
  );
2117
- if (c != null && (c !== "" || u === "json" && typeof c == "object")) {
2118
- if (u === "markdown" && typeof c == "string")
2119
- await ae(o, c);
2120
- else if (u === "html" && typeof c == "string")
2121
- await se(o, c);
2122
- else if (u === "json" && typeof c == "object")
2117
+ if (d != null && (d !== "" || c === "json" && typeof d == "object")) {
2118
+ if (c === "markdown" && typeof d == "string")
2119
+ await ae(i, d);
2120
+ else if (c === "html" && typeof d == "string")
2121
+ await se(i, d);
2122
+ else if (c === "json" && typeof d == "object")
2123
2123
  try {
2124
- const $ = JSON.stringify(c), G = o.parseEditorState($);
2125
- o.setEditorState(G);
2124
+ const $ = JSON.stringify(d), G = i.parseEditorState($);
2125
+ i.setEditorState(G);
2126
2126
  } catch ($) {
2127
2127
  console.error(
2128
2128
  "[BeatUI] Failed to parse JSON editor state:",
2129
2129
  $
2130
2130
  ), N && N(
2131
2131
  $ instanceof Error ? $ : new Error(String($)),
2132
- o
2132
+ i
2133
2133
  );
2134
2134
  }
2135
2135
  }
2136
2136
  }
2137
- if (t != null && r.push(
2138
- U.on(t, async (c) => {
2139
- if (c != null) {
2140
- if (u === "markdown" && typeof c == "string") {
2141
- const F = await Q(o);
2142
- c !== F && await ae(o, c);
2143
- } else if (u === "html" && typeof c == "string") {
2144
- const F = await ee(o);
2145
- c !== F && await se(o, c);
2146
- } else if (u === "json" && typeof c == "object") {
2147
- const F = JSON.stringify(
2148
- o.getEditorState().toJSON()
2149
- ), $ = JSON.stringify(c);
2150
- if (F !== $) {
2151
- const G = o.parseEditorState($);
2152
- o.setEditorState(G);
2137
+ if (t != null && a.push(
2138
+ U.on(t, async (d) => {
2139
+ if (d != null) {
2140
+ if (c === "markdown" && typeof d == "string") {
2141
+ const B = await X(i);
2142
+ d !== B && await ae(i, d);
2143
+ } else if (c === "html" && typeof d == "string") {
2144
+ const B = await Q(i);
2145
+ d !== B && await se(i, d);
2146
+ } else if (c === "json" && typeof d == "object") {
2147
+ const B = JSON.stringify(
2148
+ i.getEditorState().toJSON()
2149
+ ), $ = JSON.stringify(d);
2150
+ if (B !== $) {
2151
+ const G = i.parseEditorState($);
2152
+ i.setEditorState(G);
2153
2153
  }
2154
2154
  }
2155
2155
  }
2156
2156
  })
2157
- ), i != null && r.push(
2158
- U.on(i, (c) => {
2159
- o.setEditable(!c);
2157
+ ), n != null && a.push(
2158
+ U.on(n, (d) => {
2159
+ i.setEditable(!d);
2160
2160
  })
2161
- ), r.push(
2162
- o.registerCommand(
2161
+ ), a.push(
2162
+ i.registerCommand(
2163
2163
  Je,
2164
- () => (k && k(o), f && o.getEditorState().read(async () => {
2165
- if (u === "markdown") {
2166
- const c = await Q(o);
2167
- f(c, o);
2168
- } else if (u === "html") {
2169
- const c = await ee(o);
2170
- f(c, o);
2171
- } else u === "json" && f(
2172
- o.getEditorState().toJSON(),
2173
- o
2164
+ () => (C && C(i), m && i.getEditorState().read(async () => {
2165
+ if (c === "markdown") {
2166
+ const d = await X(i);
2167
+ m(d, i);
2168
+ } else if (c === "html") {
2169
+ const d = await Q(i);
2170
+ m(d, i);
2171
+ } else c === "json" && m(
2172
+ i.getEditorState().toJSON(),
2173
+ i
2174
2174
  );
2175
2175
  }), !1),
2176
2176
  K
2177
2177
  )
2178
- ), r.push(
2179
- E.on((c) => {
2180
- const F = o.getRootElement();
2181
- F && (F.dataset.theme = c);
2178
+ ), a.push(
2179
+ k.on((d) => {
2180
+ const B = i.getRootElement();
2181
+ B && (B.dataset.theme = d);
2182
2182
  })
2183
- ), g)
2184
- o.focus();
2183
+ ), h)
2184
+ i.focus();
2185
2185
  else {
2186
- const c = o.getRootElement();
2187
- c && c === document.activeElement && c.blur();
2186
+ const d = i.getRootElement();
2187
+ d && d === document.activeElement && d.blur();
2188
2188
  }
2189
- b && b(o);
2190
- } catch (T) {
2189
+ y && y(i);
2190
+ } catch (S) {
2191
2191
  console.error(
2192
2192
  "[BeatUI] Failed to initialize Lexical editor:",
2193
- T
2193
+ S
2194
2194
  );
2195
- const C = h;
2196
- C.textContent = "Failed to load Lexical editor.";
2195
+ const u = b;
2196
+ u.textContent = "Failed to load Lexical editor.";
2197
2197
  }
2198
2198
  })(), ne(() => {
2199
2199
  try {
2200
- r.forEach((T) => T());
2200
+ a.forEach((S) => S());
2201
2201
  } catch {
2202
2202
  }
2203
2203
  try {
2204
- _?.setRootElement(null);
2204
+ w?.setRootElement(null);
2205
2205
  } catch {
2206
2206
  }
2207
- v.set(null);
2207
+ x.set(null);
2208
2208
  });
2209
2209
  })
2210
2210
  )
@@ -2214,163 +2214,163 @@ const ki = (e) => {
2214
2214
  function bn({
2215
2215
  editor: e,
2216
2216
  stateUpdate: t,
2217
- groups: l = ["text-formatting"],
2218
- readOnly: a = z(!1),
2219
- size: i = "sm"
2217
+ groups: r = ["text-formatting"],
2218
+ readOnly: l = z(!1),
2219
+ size: n = "sm"
2220
2220
  }) {
2221
- const s = j(!1), p = j(0), x = j(0);
2221
+ const s = j(!1), g = j(0), v = j(0);
2222
2222
  return ue(
2223
2223
  ye,
2224
- (w) => Se(e, (L) => {
2225
- const g = L, N = w.$.lexical, y = (r) => l.includes(r), { textFormatActive: f, linkActive: k, dispatch: b, toggleLink: v } = St(g, t, {
2226
- enterUrlMessage: () => w.value.lexical.enterUrl
2227
- }), M = Nt(a, i)(z(!0)), B = () => {
2228
- const r = g.value;
2229
- if (!r) {
2224
+ (L) => Se(e, (M) => {
2225
+ const h = M, N = L.$.lexical, E = (a) => r.includes(a), { textFormatActive: m, linkActive: C, dispatch: y, toggleLink: x } = St(h, t, {
2226
+ enterUrlMessage: () => L.value.lexical.enterUrl
2227
+ }), O = Nt(l, n)(z(!0)), I = () => {
2228
+ const a = h.value;
2229
+ if (!a) {
2230
2230
  s.value = !1;
2231
2231
  return;
2232
2232
  }
2233
- const I = r.getRootElement();
2234
- if (!I) {
2233
+ const F = a.getRootElement();
2234
+ if (!F) {
2235
2235
  s.value = !1;
2236
2236
  return;
2237
2237
  }
2238
- const T = window.getSelection();
2239
- if (!T || T.rangeCount === 0 || T.isCollapsed) {
2238
+ const S = window.getSelection();
2239
+ if (!S || S.rangeCount === 0 || S.isCollapsed) {
2240
2240
  s.value = !1;
2241
2241
  return;
2242
2242
  }
2243
- const C = T.anchorNode;
2244
- if (C && !I.contains(C)) {
2243
+ const u = S.anchorNode;
2244
+ if (u && !F.contains(u)) {
2245
2245
  s.value = !1;
2246
2246
  return;
2247
2247
  }
2248
- const o = T.getRangeAt(0).getBoundingClientRect();
2249
- if (o.width === 0 && o.height === 0) {
2248
+ const i = S.getRangeAt(0).getBoundingClientRect();
2249
+ if (i.width === 0 && i.height === 0) {
2250
2250
  s.value = !1;
2251
2251
  return;
2252
2252
  }
2253
- const O = 40, q = 8;
2254
- let c = o.top - O - q;
2255
- const F = o.left + o.width / 2;
2256
- c < 0 && (c = o.bottom + q), p.value = c, x.value = F, s.value = !0;
2257
- }, E = t.onChange(B), h = () => {
2258
- B();
2253
+ const _ = 40, V = 8;
2254
+ let d = i.top - _ - V;
2255
+ const B = i.left + i.width / 2;
2256
+ d < 0 && (d = i.bottom + V), g.value = d, v.value = B, s.value = !0;
2257
+ }, k = t.onChange(I), b = () => {
2258
+ I();
2259
2259
  };
2260
- document.addEventListener("selectionchange", h);
2261
- const _ = D.div(
2262
- d.class("bc-floating-toolbar"),
2263
- W.position("fixed"),
2264
- W.top(p.map((r) => `${r}px`)),
2265
- W.left(x.map((r) => `${r}px`)),
2266
- W.transform("translateX(-50%)"),
2260
+ document.addEventListener("selectionchange", b);
2261
+ const w = D.div(
2262
+ f.class("bc-floating-toolbar"),
2263
+ Y.position("fixed"),
2264
+ Y.top(g.map((a) => `${a}px`)),
2265
+ Y.left(v.map((a) => `${a}px`)),
2266
+ Y.transform("translateX(-50%)"),
2267
2267
  // Escape key handler
2268
- oe((r) => {
2269
- const I = (C) => {
2270
- if (C.key === "Escape" && s.value) {
2268
+ oe((a) => {
2269
+ const F = (u) => {
2270
+ if (u.key === "Escape" && s.value) {
2271
2271
  s.value = !1;
2272
- const u = g.value;
2273
- u && u.focus();
2272
+ const c = h.value;
2273
+ c && c.focus();
2274
2274
  }
2275
- }, T = (C) => {
2276
- if (s.value && !r.contains(C.target)) {
2277
- const u = g.value;
2278
- if (u) {
2279
- const o = u.getRootElement();
2280
- if (o && o.contains(C.target))
2275
+ }, S = (u) => {
2276
+ if (s.value && !a.contains(u.target)) {
2277
+ const c = h.value;
2278
+ if (c) {
2279
+ const i = c.getRootElement();
2280
+ if (i && i.contains(u.target))
2281
2281
  return;
2282
2282
  }
2283
2283
  s.value = !1;
2284
2284
  }
2285
2285
  };
2286
- return document.addEventListener("keydown", I), document.addEventListener("mousedown", T), ne(() => {
2287
- E(), document.removeEventListener("keydown", I), document.removeEventListener("mousedown", T), document.removeEventListener(
2286
+ return document.addEventListener("keydown", F), document.addEventListener("mousedown", S), ne(() => {
2287
+ k(), document.removeEventListener("keydown", F), document.removeEventListener("mousedown", S), document.removeEventListener(
2288
2288
  "selectionchange",
2289
- h
2289
+ b
2290
2290
  );
2291
2291
  });
2292
2292
  }),
2293
- ...y("text-formatting") ? [
2294
- M({
2295
- active: f("bold"),
2296
- onClick: b(te, "bold"),
2297
- label: N.map((r) => r.bold),
2293
+ ...E("text-formatting") ? [
2294
+ O({
2295
+ active: m("bold"),
2296
+ onClick: y(te, "bold"),
2297
+ label: N.map((a) => a.bold),
2298
2298
  icon: "mdi:format-bold"
2299
2299
  }),
2300
- M({
2301
- active: f("italic"),
2302
- onClick: b(te, "italic"),
2303
- label: N.map((r) => r.italic),
2300
+ O({
2301
+ active: m("italic"),
2302
+ onClick: y(te, "italic"),
2303
+ label: N.map((a) => a.italic),
2304
2304
  icon: "mdi:format-italic"
2305
2305
  }),
2306
- M({
2307
- active: f("underline"),
2308
- onClick: b(te, "underline"),
2309
- label: N.map((r) => r.underline),
2306
+ O({
2307
+ active: m("underline"),
2308
+ onClick: y(te, "underline"),
2309
+ label: N.map((a) => a.underline),
2310
2310
  icon: "mdi:format-underline"
2311
2311
  }),
2312
- M({
2313
- active: f("strikethrough"),
2314
- onClick: b(te, "strikethrough"),
2315
- label: N.map((r) => r.strikethrough),
2312
+ O({
2313
+ active: m("strikethrough"),
2314
+ onClick: y(te, "strikethrough"),
2315
+ label: N.map((a) => a.strikethrough),
2316
2316
  icon: "mdi:format-strikethrough"
2317
2317
  }),
2318
- M({
2319
- active: f("code"),
2320
- onClick: b(te, "code"),
2321
- label: N.map((r) => r.code),
2318
+ O({
2319
+ active: m("code"),
2320
+ onClick: y(te, "code"),
2321
+ label: N.map((a) => a.code),
2322
2322
  icon: "mdi:code-tags"
2323
2323
  })
2324
2324
  ] : [],
2325
- ...y("links") ? [
2326
- M({
2327
- active: k(),
2328
- onClick: v,
2329
- label: N.map((r) => r.link),
2325
+ ...E("links") ? [
2326
+ O({
2327
+ active: C(),
2328
+ onClick: x,
2329
+ label: N.map((a) => a.link),
2330
2330
  icon: "mdi:link"
2331
2331
  })
2332
2332
  ] : [],
2333
- ...y("clipboard") ? [
2334
- M({
2333
+ ...E("clipboard") ? [
2334
+ O({
2335
2335
  active: z(!1),
2336
2336
  onClick: () => {
2337
- const r = g.value;
2338
- if (!r) return;
2339
- const I = r.getRootElement();
2340
- I && (I.focus(), document.execCommand("cut"));
2337
+ const a = h.value;
2338
+ if (!a) return;
2339
+ const F = a.getRootElement();
2340
+ F && (F.focus(), document.execCommand("cut"));
2341
2341
  },
2342
- label: N.map((r) => r.cut),
2342
+ label: N.map((a) => a.cut),
2343
2343
  icon: "mdi:content-cut"
2344
2344
  }),
2345
- M({
2345
+ O({
2346
2346
  active: z(!1),
2347
2347
  onClick: () => {
2348
- const r = g.value;
2349
- if (!r) return;
2350
- const I = r.getRootElement();
2351
- I && (I.focus(), document.execCommand("copy"));
2348
+ const a = h.value;
2349
+ if (!a) return;
2350
+ const F = a.getRootElement();
2351
+ F && (F.focus(), document.execCommand("copy"));
2352
2352
  },
2353
- label: N.map((r) => r.copy),
2353
+ label: N.map((a) => a.copy),
2354
2354
  icon: "mdi:content-copy"
2355
2355
  }),
2356
- M({
2356
+ O({
2357
2357
  active: z(!1),
2358
2358
  onClick: () => {
2359
- const r = g.value;
2360
- r && navigator.clipboard.readText().then((I) => {
2361
- r.update(() => {
2362
- const T = A();
2363
- R(T) && T.insertText(I);
2364
- }), r.focus();
2359
+ const a = h.value;
2360
+ a && navigator.clipboard.readText().then((F) => {
2361
+ a.update(() => {
2362
+ const S = A();
2363
+ R(S) && S.insertText(F);
2364
+ }), a.focus();
2365
2365
  }).catch(() => {
2366
2366
  });
2367
2367
  },
2368
- label: N.map((r) => r.paste),
2368
+ label: N.map((a) => a.paste),
2369
2369
  icon: "mdi:content-paste"
2370
2370
  })
2371
2371
  ] : []
2372
2372
  );
2373
- return pe(s, () => _);
2373
+ return pe(s, () => w);
2374
2374
  })
2375
2375
  );
2376
2376
  }
@@ -2385,7 +2385,7 @@ const Ei = [
2385
2385
  handler: (e) => {
2386
2386
  e.update(() => {
2387
2387
  const t = A();
2388
- R(t) && Y(t, () => V("h1"));
2388
+ R(t) && q(t, () => W("h1"));
2389
2389
  });
2390
2390
  }
2391
2391
  },
@@ -2399,7 +2399,7 @@ const Ei = [
2399
2399
  handler: (e) => {
2400
2400
  e.update(() => {
2401
2401
  const t = A();
2402
- R(t) && Y(t, () => V("h2"));
2402
+ R(t) && q(t, () => W("h2"));
2403
2403
  });
2404
2404
  }
2405
2405
  },
@@ -2413,7 +2413,7 @@ const Ei = [
2413
2413
  handler: (e) => {
2414
2414
  e.update(() => {
2415
2415
  const t = A();
2416
- R(t) && Y(t, () => V("h3"));
2416
+ R(t) && q(t, () => W("h3"));
2417
2417
  });
2418
2418
  }
2419
2419
  },
@@ -2449,7 +2449,7 @@ const Ei = [
2449
2449
  handler: (e) => {
2450
2450
  e.update(() => {
2451
2451
  const t = A();
2452
- R(t) && Y(t, () => Be());
2452
+ R(t) && q(t, () => Be());
2453
2453
  });
2454
2454
  }
2455
2455
  },
@@ -2463,7 +2463,7 @@ const Ei = [
2463
2463
  handler: (e) => {
2464
2464
  e.update(() => {
2465
2465
  const t = A();
2466
- R(t) && Y(t, () => Ue());
2466
+ R(t) && q(t, () => Ue());
2467
2467
  });
2468
2468
  }
2469
2469
  },
@@ -2497,108 +2497,108 @@ const Ei = [
2497
2497
  function Ti({
2498
2498
  commands: e,
2499
2499
  isVisible: t,
2500
- filterText: l,
2501
- position: a,
2502
- onSelect: i,
2500
+ filterText: r,
2501
+ position: l,
2502
+ onSelect: n,
2503
2503
  onClose: s
2504
2504
  }) {
2505
- const p = j(0), x = l.map((y) => {
2506
- const f = y.toLowerCase().trim();
2507
- return f ? e.filter((k) => [
2508
- k.label.toLowerCase(),
2509
- k.description?.toLowerCase() || "",
2510
- ...k.keywords?.map((v) => v.toLowerCase()) || []
2511
- ].join(" ").includes(f)) : e;
2505
+ const g = j(0), v = r.map((E) => {
2506
+ const m = E.toLowerCase().trim();
2507
+ return m ? e.filter((C) => [
2508
+ C.label.toLowerCase(),
2509
+ C.description?.toLowerCase() || "",
2510
+ ...C.keywords?.map((x) => x.toLowerCase()) || []
2511
+ ].join(" ").includes(m)) : e;
2512
2512
  });
2513
- x.onChange(() => {
2514
- p.value = 0;
2513
+ v.onChange(() => {
2514
+ g.value = 0;
2515
2515
  });
2516
- const w = (y) => {
2517
- const f = x.value;
2518
- if (y >= 0 && y < f.length) {
2519
- const k = f[y];
2520
- i(k);
2516
+ const L = (E) => {
2517
+ const m = v.value;
2518
+ if (E >= 0 && E < m.length) {
2519
+ const C = m[E];
2520
+ n(C);
2521
2521
  }
2522
- }, L = (y) => {
2522
+ }, M = (E) => {
2523
2523
  if (!t.value) return;
2524
- const k = x.value.length - 1;
2525
- switch (y.key) {
2524
+ const C = v.value.length - 1;
2525
+ switch (E.key) {
2526
2526
  case "ArrowDown":
2527
- y.preventDefault(), p.value = Math.min(p.value + 1, k);
2527
+ E.preventDefault(), g.value = Math.min(g.value + 1, C);
2528
2528
  break;
2529
2529
  case "ArrowUp":
2530
- y.preventDefault(), p.value = Math.max(p.value - 1, 0);
2530
+ E.preventDefault(), g.value = Math.max(g.value - 1, 0);
2531
2531
  break;
2532
2532
  case "Enter":
2533
- y.preventDefault(), w(p.value);
2533
+ E.preventDefault(), L(g.value);
2534
2534
  break;
2535
2535
  case "Escape":
2536
- y.preventDefault(), s();
2536
+ E.preventDefault(), s();
2537
2537
  break;
2538
2538
  }
2539
- }, g = (y, f) => {
2540
- const k = p.map((v) => v === f), b = `slash-cmd-${y.id}`;
2539
+ }, h = (E, m) => {
2540
+ const C = g.map((x) => x === m), y = `slash-cmd-${E.id}`;
2541
2541
  return D.div(
2542
- d.class("bc-slash-command-palette__item"),
2543
- d.id(b),
2544
- d.role("option"),
2542
+ f.class("bc-slash-command-palette__item"),
2543
+ f.id(y),
2544
+ f.role("option"),
2545
2545
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2546
- Pe.selected(k),
2546
+ Pe.selected(C),
2547
2547
  // Mouse hover handlers
2548
- oe((v) => {
2549
- const S = () => {
2550
- p.value = f;
2551
- }, M = () => {
2552
- w(f);
2548
+ oe((x) => {
2549
+ const T = () => {
2550
+ g.value = m;
2551
+ }, O = () => {
2552
+ L(m);
2553
2553
  };
2554
- return v.addEventListener("mouseenter", S), v.addEventListener("click", M), ne(() => {
2555
- v.removeEventListener("mouseenter", S), v.removeEventListener("click", M);
2554
+ return x.addEventListener("mouseenter", T), x.addEventListener("click", O), ne(() => {
2555
+ x.removeEventListener("mouseenter", T), x.removeEventListener("click", O);
2556
2556
  });
2557
2557
  }),
2558
2558
  // Icon
2559
- typeof y.icon == "string" ? D.div(
2560
- d.class("bc-slash-command-palette__icon"),
2561
- Z({ icon: y.icon, size: "sm" })
2562
- ) : y.icon,
2559
+ typeof E.icon == "string" ? D.div(
2560
+ f.class("bc-slash-command-palette__icon"),
2561
+ Z({ icon: E.icon, size: "sm" })
2562
+ ) : E.icon,
2563
2563
  // Label and description
2564
2564
  D.div(
2565
- d.class("bc-slash-command-palette__content"),
2566
- D.div(d.class("bc-slash-command-palette__label"), y.label),
2567
- y.description ? D.div(
2568
- d.class("bc-slash-command-palette__description"),
2569
- y.description
2565
+ f.class("bc-slash-command-palette__content"),
2566
+ D.div(f.class("bc-slash-command-palette__label"), E.label),
2567
+ E.description ? D.div(
2568
+ f.class("bc-slash-command-palette__description"),
2569
+ E.description
2570
2570
  ) : void 0
2571
2571
  ),
2572
2572
  // Category badge (optional)
2573
- y.category ? D.div(
2574
- d.class("bc-slash-command-palette__category"),
2575
- y.category
2573
+ E.category ? D.div(
2574
+ f.class("bc-slash-command-palette__category"),
2575
+ E.category
2576
2576
  ) : void 0
2577
2577
  );
2578
2578
  }, N = ue(
2579
2579
  ye,
2580
- (y) => D.div(
2581
- d.class("bc-slash-command-palette"),
2582
- d.role("listbox"),
2583
- Pe.label(y.$.lexical.map((f) => f.slashCommands)),
2584
- W.position("absolute"),
2585
- W.top(a.map((f) => `${f.top}px`)),
2586
- W.left(a.map((f) => `${f.left}px`)),
2587
- oe(() => (document.addEventListener("keydown", L), ne(() => {
2588
- document.removeEventListener("keydown", L);
2580
+ (E) => D.div(
2581
+ f.class("bc-slash-command-palette"),
2582
+ f.role("listbox"),
2583
+ Pe.label(E.$.lexical.map((m) => m.slashCommands)),
2584
+ Y.position("absolute"),
2585
+ Y.top(l.map((m) => `${m.top}px`)),
2586
+ Y.left(l.map((m) => `${m.left}px`)),
2587
+ oe(() => (document.addEventListener("keydown", M), ne(() => {
2588
+ document.removeEventListener("keydown", M);
2589
2589
  }))),
2590
2590
  // Empty state
2591
2591
  pe(
2592
- x.map((f) => f.length === 0),
2592
+ v.map((m) => m.length === 0),
2593
2593
  () => D.div(
2594
- d.class("bc-slash-command-palette__empty"),
2595
- y.$.lexical.map((f) => f.noCommandsFound)
2594
+ f.class("bc-slash-command-palette__empty"),
2595
+ E.$.lexical.map((m) => m.noCommandsFound)
2596
2596
  )
2597
2597
  ),
2598
2598
  // Command list using ForEach for proper Tempo dynamic list rendering
2599
- Io(x, (f, k) => {
2600
- const b = f.value;
2601
- return g(b, k.index);
2599
+ Io(v, (m, C) => {
2600
+ const y = m.value;
2601
+ return h(y, C.index);
2602
2602
  })
2603
2603
  )
2604
2604
  );
@@ -2612,7 +2612,7 @@ const yn = [
2612
2612
  handler: (e) => {
2613
2613
  e.update(() => {
2614
2614
  const t = A();
2615
- R(t) && Y(t, () => de());
2615
+ R(t) && q(t, () => de());
2616
2616
  });
2617
2617
  }
2618
2618
  },
@@ -2623,7 +2623,7 @@ const yn = [
2623
2623
  handler: (e) => {
2624
2624
  e.update(() => {
2625
2625
  const t = A();
2626
- R(t) && Y(t, () => V("h1"));
2626
+ R(t) && q(t, () => W("h1"));
2627
2627
  });
2628
2628
  }
2629
2629
  },
@@ -2634,7 +2634,7 @@ const yn = [
2634
2634
  handler: (e) => {
2635
2635
  e.update(() => {
2636
2636
  const t = A();
2637
- R(t) && Y(t, () => V("h2"));
2637
+ R(t) && q(t, () => W("h2"));
2638
2638
  });
2639
2639
  }
2640
2640
  },
@@ -2645,7 +2645,7 @@ const yn = [
2645
2645
  handler: (e) => {
2646
2646
  e.update(() => {
2647
2647
  const t = A();
2648
- R(t) && Y(t, () => V("h3"));
2648
+ R(t) && q(t, () => W("h3"));
2649
2649
  });
2650
2650
  }
2651
2651
  },
@@ -2672,7 +2672,7 @@ const yn = [
2672
2672
  handler: (e) => {
2673
2673
  e.update(() => {
2674
2674
  const t = A();
2675
- R(t) && Y(t, () => Be());
2675
+ R(t) && q(t, () => Be());
2676
2676
  });
2677
2677
  }
2678
2678
  },
@@ -2683,7 +2683,7 @@ const yn = [
2683
2683
  handler: (e) => {
2684
2684
  e.update(() => {
2685
2685
  const t = A();
2686
- R(t) && Y(t, () => Ue());
2686
+ R(t) && q(t, () => Ue());
2687
2687
  });
2688
2688
  }
2689
2689
  },
@@ -2708,128 +2708,126 @@ const yn = [
2708
2708
  }
2709
2709
  }
2710
2710
  ];
2711
- function vn({
2711
+ function xn({
2712
2712
  editor: e,
2713
2713
  stateUpdate: t,
2714
- readOnly: l = z(!1),
2715
- commands: a = yn
2714
+ readOnly: r = z(!1),
2715
+ commands: l = yn
2716
2716
  }) {
2717
- const i = j(!1), s = j(!1), p = j(0), x = j(0);
2717
+ const n = j(!1), s = j(!1), g = j(0), v = j(0);
2718
2718
  return ue(
2719
2719
  ye,
2720
- (w) => Se(e, (L) => {
2721
- const g = L;
2722
- let N = null, y = !1, f = null, k = null;
2723
- const b = 24, v = 4, S = 200, M = (u) => {
2724
- if (u === N && i.value) return;
2720
+ (L) => Se(e, (M) => {
2721
+ const h = M;
2722
+ let N = null, E = !1, m = null;
2723
+ const C = 24, y = 4, x = 200, T = (u) => {
2724
+ if (u === N && n.value) return;
2725
2725
  N = u;
2726
- const o = u.getBoundingClientRect();
2727
- p.value = o.top, x.value = o.left - b - v, i.value = !0;
2728
- }, B = () => {
2729
- f != null && (clearTimeout(f), f = null);
2730
- }, E = () => {
2731
- s.value || (B(), f = setTimeout(() => {
2732
- f = null, s.value || (i.value = !1, N = null);
2733
- }, S));
2734
- }, h = () => {
2735
- const u = g.value;
2726
+ const c = u.getBoundingClientRect();
2727
+ g.value = c.top, v.value = c.left - C - y, n.value = !0;
2728
+ }, O = () => {
2729
+ m != null && (clearTimeout(m), m = null);
2730
+ }, I = () => {
2731
+ s.value || (O(), m = setTimeout(() => {
2732
+ m = null, s.value || (n.value = !1, N = null);
2733
+ }, x));
2734
+ }, k = () => {
2735
+ const u = h.value;
2736
2736
  if (!u) return;
2737
- const o = u.getRootElement();
2738
- o && (I(o), u.getEditorState().read(() => {
2739
- const O = A();
2740
- if (R(O))
2737
+ const c = u.getRootElement();
2738
+ c && (a(c), u.getEditorState().read(() => {
2739
+ const i = A();
2740
+ if (R(i))
2741
2741
  try {
2742
- const c = O.anchor.getNode().getTopLevelElementOrThrow(), F = u.getElementByKey(c.getKey());
2743
- F && M(F);
2742
+ const V = i.anchor.getNode().getTopLevelElementOrThrow(), d = u.getElementByKey(V.getKey());
2743
+ d && T(d);
2744
2744
  } catch {
2745
2745
  }
2746
2746
  }));
2747
- }, _ = (u) => {
2747
+ }, b = (u) => {
2748
2748
  if (s.value) return;
2749
- const o = g.value;
2750
- if (!o) return;
2751
- const O = o.getRootElement();
2752
- if (O)
2753
- for (const q of Array.from(O.children)) {
2754
- const c = q.getBoundingClientRect();
2755
- if (u.clientY >= c.top && u.clientY <= c.bottom) {
2756
- B(), M(q);
2749
+ const c = h.value;
2750
+ if (!c) return;
2751
+ const i = c.getRootElement();
2752
+ if (i)
2753
+ for (const _ of Array.from(i.children)) {
2754
+ const V = _.getBoundingClientRect();
2755
+ if (u.clientY >= V.top && u.clientY <= V.bottom) {
2756
+ O(), T(_);
2757
2757
  return;
2758
2758
  }
2759
2759
  }
2760
- }, r = () => {
2761
- E();
2762
- }, I = (u) => {
2763
- y || (y = !0, u.addEventListener("mousemove", _), u.addEventListener("mouseleave", r));
2764
- }, T = t.onChange(h);
2760
+ }, w = () => {
2761
+ I();
2762
+ }, a = (u) => {
2763
+ E || (E = !0, u.addEventListener("mousemove", b), u.addEventListener("mouseleave", w));
2764
+ }, F = t.onChange(k);
2765
2765
  return [
2766
2766
  ne(() => {
2767
- T(), B();
2768
- const u = g.value;
2767
+ F(), O();
2768
+ const u = h.value;
2769
2769
  if (u) {
2770
- const o = u.getRootElement();
2771
- o && y && (o.removeEventListener("mousemove", _), o.removeEventListener("mouseleave", r));
2770
+ const c = u.getRootElement();
2771
+ c && E && (c.removeEventListener("mousemove", b), c.removeEventListener("mouseleave", w));
2772
2772
  }
2773
2773
  }),
2774
2774
  pe(
2775
- i,
2775
+ n,
2776
2776
  () => D.div(
2777
- d.class("bc-block-handle"),
2778
- W.position("fixed"),
2779
- W.top(p.map((u) => `${u}px`)),
2780
- W.left(x.map((u) => `${u}px`)),
2777
+ f.class("bc-block-handle"),
2778
+ Y.position("fixed"),
2779
+ Y.top(g.map((u) => `${u}px`)),
2780
+ Y.left(v.map((u) => `${u}px`)),
2781
2781
  // Cancel hide when mouse enters handle area
2782
- X.mouseenter(B),
2782
+ ee.mouseenter(O),
2783
2783
  // Schedule hide when mouse leaves handle (unless menu is open)
2784
- X.mouseleave(() => E()),
2784
+ ee.mouseleave(() => I()),
2785
2785
  // Prevent mousedown from stealing focus from editor
2786
2786
  oe((u) => {
2787
- u.addEventListener("mousedown", (o) => {
2788
- o.preventDefault();
2787
+ u.addEventListener("mousedown", (c) => {
2788
+ c.preventDefault();
2789
2789
  });
2790
2790
  }),
2791
2791
  D.button(
2792
- d.class("bc-block-handle__button"),
2793
- d.type("button"),
2794
- d.title(w.$.lexical.map((u) => u.changeBlockType)),
2795
- d.disabled(l),
2792
+ f.class("bc-block-handle__button"),
2793
+ f.type("button"),
2794
+ f.title(L.$.lexical.map((u) => u.changeBlockType)),
2795
+ f.disabled(r),
2796
2796
  Z({ icon: "mdi:drag-horizontal-variant", size: "sm" }),
2797
2797
  // Track menu open state via aria-expanded (set by Flyout)
2798
2798
  oe((u) => {
2799
- const o = new MutationObserver(() => {
2800
- const O = u.getAttribute("aria-expanded") === "true";
2801
- s.value = O;
2799
+ const c = new MutationObserver(() => {
2800
+ const i = u.getAttribute("aria-expanded") === "true";
2801
+ s.value = i;
2802
2802
  });
2803
- return o.observe(u, {
2803
+ return c.observe(u, {
2804
2804
  attributes: !0,
2805
2805
  attributeFilter: ["aria-expanded"]
2806
- }), ne(() => o.disconnect());
2806
+ }), ne(() => c.disconnect());
2807
2807
  }),
2808
2808
  // Block type menu (uses BeatUI Menu + MenuItem)
2809
2809
  Et({
2810
- items: () => a.map(
2810
+ items: () => l.map(
2811
2811
  (u) => le({
2812
2812
  key: u.id,
2813
2813
  content: u.label,
2814
2814
  before: Z({ icon: u.icon, size: "sm" }),
2815
2815
  onClick: () => {
2816
- const o = g.value;
2817
- o && (u.handler(o), k?.(), o.focus());
2816
+ const c = h.value;
2817
+ c && (u.handler(c), c.focus());
2818
2818
  }
2819
2819
  })
2820
2820
  ),
2821
2821
  placement: "bottom-start",
2822
- showOn: (u, o) => (k = o, X.click(() => {
2823
- s.value ? o() : (u(), s.value = !0);
2824
- })),
2822
+ showOn: "click",
2825
2823
  showDelay: 0,
2826
2824
  hideDelay: 0,
2827
2825
  mainAxisOffset: 4,
2828
2826
  onClose: () => {
2829
- const u = g.value;
2827
+ const u = h.value;
2830
2828
  u && u.focus();
2831
2829
  },
2832
- ariaLabel: w.value.lexical.blockTypes
2830
+ ariaLabel: L.value.lexical.blockTypes
2833
2831
  })
2834
2832
  )
2835
2833
  )
@@ -2841,77 +2839,77 @@ function vn({
2841
2839
  const Si = (e) => {
2842
2840
  const {
2843
2841
  value: t,
2844
- format: l,
2845
- plugins: a,
2846
- readOnly: i,
2842
+ format: r,
2843
+ plugins: l,
2844
+ readOnly: n,
2847
2845
  placeholder: s,
2848
- class: p,
2849
- namespace: x = "BeatUILexical",
2850
- heightMode: w = "auto",
2851
- floatingToolbarGroups: L,
2852
- autoFocus: g = !1,
2846
+ class: g,
2847
+ namespace: v = "BeatUILexical",
2848
+ heightMode: L = "auto",
2849
+ floatingToolbarGroups: M,
2850
+ autoFocus: h = !1,
2853
2851
  onError: N,
2854
- onInput: y,
2855
- onChange: f,
2856
- onBlur: k,
2857
- onReady: b
2858
- } = e, v = j(null), S = j(0), M = (E) => typeof E == "object" && E !== null && "map" in E && typeof E.map == "function", B = i != null ? M(i) ? i : j(U.get(i)) : j(!1);
2852
+ onInput: E,
2853
+ onChange: m,
2854
+ onBlur: C,
2855
+ onReady: y
2856
+ } = e, x = j(null), T = j(0), O = (k) => typeof k == "object" && k !== null && "map" in k && typeof k.map == "function", I = n != null ? O(n) ? n : j(U.get(n)) : j(!1);
2859
2857
  return ue(
2860
2858
  Ye,
2861
- ({ appearance: E }) => D.div(
2859
+ ({ appearance: k }) => D.div(
2862
2860
  // CSS injection via LinkPortal
2863
2861
  Ke(
2864
2862
  () => import("../styles-url-BIeImEjl.js"),
2865
- ({ default: h }) => qe({ id: "beatui-lexical-css", href: h })
2863
+ ({ default: b }) => qe({ id: "beatui-lexical-css", href: b })
2866
2864
  ),
2867
- d.class("bc-lexical-editor-container"),
2868
- w === "fixed" ? d.class("bc-lexical-editor-container--fixed") : null,
2869
- d.class(p),
2865
+ f.class("bc-lexical-editor-container"),
2866
+ L === "fixed" ? f.class("bc-lexical-editor-container--fixed") : null,
2867
+ f.class(g),
2870
2868
  // Floating toolbar (appears on text selection)
2871
2869
  bn({
2872
- editor: v,
2873
- stateUpdate: S,
2874
- groups: L ?? ["text-formatting", "links"],
2875
- readOnly: B
2870
+ editor: x,
2871
+ stateUpdate: T,
2872
+ groups: M ?? ["text-formatting", "links"],
2873
+ readOnly: I
2876
2874
  }),
2877
2875
  // Block handle (appears at the left of each block on hover/cursor)
2878
- vn({
2879
- editor: v,
2880
- stateUpdate: S,
2881
- readOnly: B
2876
+ xn({
2877
+ editor: x,
2878
+ stateUpdate: T,
2879
+ readOnly: I
2882
2880
  }),
2883
2881
  // Table context menu (appears when cursor is in a table cell)
2884
2882
  Ot({
2885
- editor: v,
2886
- stateUpdate: S,
2887
- readOnly: B
2883
+ editor: x,
2884
+ stateUpdate: T,
2885
+ readOnly: I
2888
2886
  }),
2889
2887
  // The editable surface
2890
2888
  D.div(
2891
- d.class("bc-lexical-editor"),
2892
- d.class(`bc-lexical-editor--${w}`),
2893
- d.contenteditable(
2894
- i != null ? (
2889
+ f.class("bc-lexical-editor"),
2890
+ f.class(`bc-lexical-editor--${L}`),
2891
+ f.contenteditable(
2892
+ n != null ? (
2895
2893
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2896
- U.map(i, (h) => !h)
2894
+ U.map(n, (b) => !b)
2897
2895
  ) : !0
2898
2896
  ),
2899
- i != null ? d.class(
2897
+ n != null ? f.class(
2900
2898
  U.map(
2901
- i,
2902
- (h) => h ? "bc-lexical-editor--readonly" : ""
2899
+ n,
2900
+ (b) => b ? "bc-lexical-editor--readonly" : ""
2903
2901
  )
2904
2902
  ) : null,
2905
- oe((h) => {
2906
- let _ = null;
2907
- const r = [];
2903
+ oe((b) => {
2904
+ let w = null;
2905
+ const a = [];
2908
2906
  return (async () => {
2909
2907
  try {
2910
- const T = a ?? Ve("contextual"), C = We(T), u = U.get(
2911
- l ?? "markdown"
2912
- ), o = Ge({
2913
- namespace: x,
2914
- nodes: C,
2908
+ const S = l ?? Ve("contextual"), u = We(S), c = U.get(
2909
+ r ?? "markdown"
2910
+ ), i = Ge({
2911
+ namespace: v,
2912
+ nodes: u,
2915
2913
  theme: {
2916
2914
  heading: {
2917
2915
  h1: "bc-lexical-h1",
@@ -2947,143 +2945,143 @@ const Si = (e) => {
2947
2945
  mark: "bc-lexical-mark",
2948
2946
  paragraph: "bc-lexical-paragraph"
2949
2947
  },
2950
- onError: (c) => {
2951
- N ? N(c, o) : console.error("[BeatUI Lexical]", c);
2948
+ onError: (d) => {
2949
+ N ? N(d, i) : console.error("[BeatUI Lexical]", d);
2952
2950
  },
2953
- editable: i ? !U.get(i) : !0,
2951
+ editable: n ? !U.get(n) : !0,
2954
2952
  html: {
2955
2953
  export: we(),
2956
2954
  import: Me()
2957
2955
  }
2958
2956
  });
2959
- _ = o, v.set(o), o.setRootElement(h);
2960
- const O = [];
2961
- if (T.richText ? O.push(Ze(o)) : T.plainText && O.push(Xe(o)), T.history) {
2962
- const c = typeof T.history == "object" ? T.history : void 0;
2963
- O.push(Qe(o, c));
2957
+ w = i, x.set(i), i.setRootElement(b);
2958
+ const _ = [];
2959
+ if (S.richText ? _.push(Ze(i)) : S.plainText && _.push(Xe(i)), S.history) {
2960
+ const d = typeof S.history == "object" ? S.history : void 0;
2961
+ _.push(Qe(i, d));
2964
2962
  }
2965
- if (T.clipboard && O.push(et(o)), T.list && O.push(tt(o)), T.link && O.push(ot(o)), T.yjs && O.push(
2966
- at(o, T.yjs)
2967
- ), T.dragon && O.push(lt(o)), T.table && O.push(rt(o)), (await Promise.all(O)).forEach((c) => {
2968
- c && r.push(c);
2969
- }), r.push(nt(o)), r.push(st(o)), r.push(
2970
- o.registerCommand(
2963
+ if (S.clipboard && _.push(et(i)), S.list && _.push(tt(i)), S.link && _.push(ot(i)), S.yjs && _.push(
2964
+ at(i, S.yjs)
2965
+ ), S.dragon && _.push(lt(i)), S.table && _.push(rt(i)), (await Promise.all(_)).forEach((d) => {
2966
+ d && a.push(d);
2967
+ }), a.push(nt(i)), a.push(st(i)), a.push(
2968
+ i.registerCommand(
2971
2969
  kt,
2972
- () => (S.set(S.value + 1), !1),
2970
+ () => (T.set(T.value + 1), !1),
2973
2971
  K
2974
2972
  )
2975
- ), r.push(
2976
- o.registerUpdateListener(
2977
- ({ editorState: c, dirtyElements: F, dirtyLeaves: $ }) => {
2978
- (F.size > 0 || $.size > 0) && S.set(S.value + 1), y && (F.size > 0 || $.size > 0) && c.read(async () => {
2979
- if (u === "markdown") {
2980
- const G = await Q(o);
2981
- y(G, o);
2982
- } else if (u === "html") {
2983
- const G = await ee(o);
2984
- y(G, o);
2985
- } else u === "json" && y(
2986
- c.toJSON(),
2987
- o
2973
+ ), a.push(
2974
+ i.registerUpdateListener(
2975
+ ({ editorState: d, dirtyElements: B, dirtyLeaves: $ }) => {
2976
+ (B.size > 0 || $.size > 0) && T.set(T.value + 1), E && (B.size > 0 || $.size > 0) && d.read(async () => {
2977
+ if (c === "markdown") {
2978
+ const G = await X(i);
2979
+ E(G, i);
2980
+ } else if (c === "html") {
2981
+ const G = await Q(i);
2982
+ E(G, i);
2983
+ } else c === "json" && E(
2984
+ d.toJSON(),
2985
+ i
2988
2986
  );
2989
2987
  });
2990
2988
  }
2991
2989
  )
2992
2990
  ), t != null) {
2993
- const c = U.get(
2991
+ const d = U.get(
2994
2992
  t
2995
2993
  );
2996
- if (c != null && (c !== "" || u === "json" && typeof c == "object")) {
2997
- if (u === "markdown" && typeof c == "string")
2998
- await ae(o, c);
2999
- else if (u === "html" && typeof c == "string")
3000
- await se(o, c);
3001
- else if (u === "json" && typeof c == "object")
2994
+ if (d != null && (d !== "" || c === "json" && typeof d == "object")) {
2995
+ if (c === "markdown" && typeof d == "string")
2996
+ await ae(i, d);
2997
+ else if (c === "html" && typeof d == "string")
2998
+ await se(i, d);
2999
+ else if (c === "json" && typeof d == "object")
3002
3000
  try {
3003
- const $ = JSON.stringify(c), G = o.parseEditorState($);
3004
- o.setEditorState(G);
3001
+ const $ = JSON.stringify(d), G = i.parseEditorState($);
3002
+ i.setEditorState(G);
3005
3003
  } catch ($) {
3006
3004
  console.error(
3007
3005
  "[BeatUI] Failed to parse JSON editor state:",
3008
3006
  $
3009
3007
  ), N && N(
3010
3008
  $ instanceof Error ? $ : new Error(String($)),
3011
- o
3009
+ i
3012
3010
  );
3013
3011
  }
3014
3012
  }
3015
3013
  }
3016
- if (t != null && r.push(
3017
- U.on(t, async (c) => {
3018
- if (c != null) {
3019
- if (u === "markdown" && typeof c == "string") {
3020
- const F = await Q(o);
3021
- c !== F && await ae(o, c);
3022
- } else if (u === "html" && typeof c == "string") {
3023
- const F = await ee(o);
3024
- c !== F && await se(o, c);
3025
- } else if (u === "json" && typeof c == "object") {
3026
- const F = JSON.stringify(
3027
- o.getEditorState().toJSON()
3028
- ), $ = JSON.stringify(c);
3029
- if (F !== $) {
3030
- const G = o.parseEditorState($);
3031
- o.setEditorState(G);
3014
+ if (t != null && a.push(
3015
+ U.on(t, async (d) => {
3016
+ if (d != null) {
3017
+ if (c === "markdown" && typeof d == "string") {
3018
+ const B = await X(i);
3019
+ d !== B && await ae(i, d);
3020
+ } else if (c === "html" && typeof d == "string") {
3021
+ const B = await Q(i);
3022
+ d !== B && await se(i, d);
3023
+ } else if (c === "json" && typeof d == "object") {
3024
+ const B = JSON.stringify(
3025
+ i.getEditorState().toJSON()
3026
+ ), $ = JSON.stringify(d);
3027
+ if (B !== $) {
3028
+ const G = i.parseEditorState($);
3029
+ i.setEditorState(G);
3032
3030
  }
3033
3031
  }
3034
3032
  }
3035
3033
  })
3036
- ), i != null && r.push(
3037
- U.on(i, (c) => {
3038
- o.setEditable(!c);
3034
+ ), n != null && a.push(
3035
+ U.on(n, (d) => {
3036
+ i.setEditable(!d);
3039
3037
  })
3040
- ), r.push(
3041
- o.registerCommand(
3038
+ ), a.push(
3039
+ i.registerCommand(
3042
3040
  Je,
3043
- () => (k && k(o), f && o.getEditorState().read(async () => {
3044
- if (u === "markdown") {
3045
- const c = await Q(o);
3046
- f(c, o);
3047
- } else if (u === "html") {
3048
- const c = await ee(o);
3049
- f(c, o);
3050
- } else u === "json" && f(
3051
- o.getEditorState().toJSON(),
3052
- o
3041
+ () => (C && C(i), m && i.getEditorState().read(async () => {
3042
+ if (c === "markdown") {
3043
+ const d = await X(i);
3044
+ m(d, i);
3045
+ } else if (c === "html") {
3046
+ const d = await Q(i);
3047
+ m(d, i);
3048
+ } else c === "json" && m(
3049
+ i.getEditorState().toJSON(),
3050
+ i
3053
3051
  );
3054
3052
  }), !1),
3055
3053
  K
3056
3054
  )
3057
- ), r.push(
3058
- E.on((c) => {
3059
- const F = o.getRootElement();
3060
- F && (F.dataset.theme = c);
3055
+ ), a.push(
3056
+ k.on((d) => {
3057
+ const B = i.getRootElement();
3058
+ B && (B.dataset.theme = d);
3061
3059
  })
3062
- ), g)
3063
- o.focus();
3060
+ ), h)
3061
+ i.focus();
3064
3062
  else {
3065
- const c = o.getRootElement();
3066
- c && c === document.activeElement && c.blur();
3063
+ const d = i.getRootElement();
3064
+ d && d === document.activeElement && d.blur();
3067
3065
  }
3068
- b && b(o);
3069
- } catch (T) {
3066
+ y && y(i);
3067
+ } catch (S) {
3070
3068
  console.error(
3071
3069
  "[BeatUI] Failed to initialize Lexical editor:",
3072
- T
3070
+ S
3073
3071
  );
3074
- const C = h;
3075
- C.textContent = "Failed to load Lexical editor.";
3072
+ const u = b;
3073
+ u.textContent = "Failed to load Lexical editor.";
3076
3074
  }
3077
3075
  })(), ne(() => {
3078
3076
  try {
3079
- r.forEach((T) => T());
3077
+ a.forEach((S) => S());
3080
3078
  } catch {
3081
3079
  }
3082
3080
  try {
3083
- _?.setRootElement(null);
3081
+ w?.setRootElement(null);
3084
3082
  } catch {
3085
3083
  }
3086
- v.set(null);
3084
+ x.set(null);
3087
3085
  });
3088
3086
  })
3089
3087
  )
@@ -3093,73 +3091,73 @@ const Si = (e) => {
3093
3091
  const {
3094
3092
  // InputOptions fields
3095
3093
  value: t,
3096
- before: l,
3097
- after: a,
3098
- onChange: i,
3094
+ before: r,
3095
+ after: l,
3096
+ onChange: n,
3099
3097
  onInput: s,
3100
- onBlur: p,
3101
- disabled: x,
3102
- hasError: w,
3103
- name: L,
3104
- placeholder: g,
3098
+ onBlur: g,
3099
+ disabled: v,
3100
+ hasError: L,
3101
+ name: M,
3102
+ placeholder: h,
3105
3103
  id: N,
3106
- required: y,
3107
- tabIndex: f,
3108
- size: k,
3109
- class: b,
3104
+ required: E,
3105
+ tabIndex: m,
3106
+ size: C,
3107
+ class: y,
3110
3108
  // LexicalEditorBaseOptions fields
3111
- namespace: v,
3112
- format: S,
3113
- plugins: M,
3114
- readOnly: B,
3115
- onError: E,
3116
- onReady: h,
3117
- marks: _,
3118
- autoFocus: r
3109
+ namespace: x,
3110
+ format: T,
3111
+ plugins: O,
3112
+ readOnly: I,
3113
+ onError: k,
3114
+ onReady: b,
3115
+ marks: w,
3116
+ autoFocus: a
3119
3117
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3120
- } = e, I = x != null && B != null ? Do(x, B)((T, C) => (T ?? !1) || (C ?? !1)) : x ?? B;
3118
+ } = e, F = v != null && I != null ? Do(v, I)((S, u) => (S ?? !1) || (u ?? !1)) : v ?? I;
3121
3119
  return Uo({
3122
- disabled: x,
3123
- hasError: w,
3124
- size: k,
3120
+ disabled: v,
3121
+ hasError: L,
3122
+ size: C,
3125
3123
  baseContainer: !0,
3126
3124
  growInput: !0,
3127
3125
  focusableSelector: "[contenteditable]",
3128
- before: l,
3129
- after: a,
3126
+ before: r,
3127
+ after: l,
3130
3128
  input: D.div(
3131
- d.class("bc-lexical-editor-input"),
3132
- d.name(L),
3133
- d.id(N),
3134
- y != null ? Pe.required(y) : null,
3135
- f != null ? d.tabindex(f) : null,
3136
- w != null ? d.class(
3129
+ f.class("bc-lexical-editor-input"),
3130
+ f.name(M),
3131
+ f.id(N),
3132
+ E != null ? Pe.required(E) : null,
3133
+ m != null ? f.tabindex(m) : null,
3134
+ L != null ? f.class(
3137
3135
  U.map(
3138
- w,
3139
- (T) => T ? "bc-lexical-editor-input--error" : ""
3136
+ L,
3137
+ (S) => S ? "bc-lexical-editor-input--error" : ""
3140
3138
  )
3141
3139
  ) : null,
3142
3140
  an({
3143
3141
  value: t,
3144
- format: S ?? "markdown",
3145
- plugins: M,
3146
- readOnly: I,
3147
- placeholder: g,
3148
- namespace: v,
3149
- class: b,
3150
- autoFocus: r,
3151
- onError: E,
3152
- onReady: h,
3153
- onInput: s ? (T, C) => {
3154
- s(T);
3142
+ format: T ?? "markdown",
3143
+ plugins: O,
3144
+ readOnly: F,
3145
+ placeholder: h,
3146
+ namespace: x,
3147
+ class: y,
3148
+ autoFocus: a,
3149
+ onError: k,
3150
+ onReady: b,
3151
+ onInput: s ? (S, u) => {
3152
+ s(S);
3155
3153
  } : void 0,
3156
- onChange: i ? (T, C) => {
3157
- i(
3158
- T
3154
+ onChange: n ? (S, u) => {
3155
+ n(
3156
+ S
3159
3157
  );
3160
3158
  } : void 0,
3161
- onBlur: p ? (T) => {
3162
- p();
3159
+ onBlur: g ? (S) => {
3160
+ g();
3163
3161
  } : void 0
3164
3162
  })
3165
3163
  )
@@ -3170,7 +3168,7 @@ export {
3170
3168
  jo as $isHorizontalRuleNode,
3171
3169
  Ii as BLUR_COMMAND,
3172
3170
  an as BareEditor,
3173
- vn as BlockHandle,
3171
+ xn as BlockHandle,
3174
3172
  Di as CLEAR_EDITOR_COMMAND,
3175
3173
  Fi as CLICK_COMMAND,
3176
3174
  Hi as COMMAND_PRIORITY_CRITICAL,
@@ -3223,22 +3221,22 @@ export {
3223
3221
  Le as createHeadlessEditor,
3224
3222
  Xn as executeSlashCommand,
3225
3223
  oi as exportEditorToFile,
3226
- ee as exportToHtml,
3227
- Q as exportToMarkdown,
3224
+ Q as exportToHtml,
3225
+ X as exportToMarkdown,
3228
3226
  pi as getCharacterCount,
3229
3227
  ti as getMarkdownTransformers,
3230
3228
  We as getNodesForPlugins,
3231
3229
  mi as getSelectionInfo,
3232
3230
  Tt as getTextContent,
3233
3231
  gi as getWordCount,
3234
- xi as htmlToLexicalJson,
3232
+ vi as htmlToLexicalJson,
3235
3233
  ni as importFileToEditor,
3236
3234
  se as importFromHtml,
3237
3235
  ae as importFromMarkdown,
3238
3236
  ii as insertTable,
3239
3237
  hi as insertTextAtCursor,
3240
3238
  Ci as lexicalJsonToHtml,
3241
- vi as lexicalJsonToMarkdown,
3239
+ xi as lexicalJsonToMarkdown,
3242
3240
  Go as loadLexicalCore,
3243
3241
  bi as loadOffsetUtils,
3244
3242
  yi as markdownToLexicalJson,