laif-ds 0.1.76 → 0.1.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/_virtual/index.js +5 -3
  2. package/dist/_virtual/index2.js +5 -2
  3. package/dist/_virtual/index3.js +5 -5
  4. package/dist/_virtual/index4.js +2 -5
  5. package/dist/_virtual/index5.js +2 -5
  6. package/dist/_virtual/index7.js +3 -2
  7. package/dist/_virtual/prism-cpp.js +3 -0
  8. package/dist/_virtual/prism-cpp2.js +5 -0
  9. package/dist/_virtual/prism-java.js +3 -0
  10. package/dist/_virtual/prism-java2.js +5 -0
  11. package/dist/_virtual/prism-python.js +3 -0
  12. package/dist/_virtual/prism-python2.js +5 -0
  13. package/dist/_virtual/prism-rust.js +3 -0
  14. package/dist/_virtual/prism-rust2.js +5 -0
  15. package/dist/_virtual/prism-typescript.js +3 -0
  16. package/dist/_virtual/prism-typescript2.js +5 -0
  17. package/dist/_virtual/prism.js +3 -0
  18. package/dist/_virtual/prism2.js +5 -0
  19. package/dist/components/editor/context/toolbar-context.js +42 -0
  20. package/dist/components/editor/editor-hooks/use-modal.js +30 -0
  21. package/dist/components/editor/editor-hooks/use-update-toolbar.js +24 -0
  22. package/dist/components/editor/editor-ui/content-editable.js +26 -0
  23. package/dist/components/editor/plugins/actions/actions-plugin.js +7 -0
  24. package/dist/components/editor/plugins/actions/clear-editor-plugin.js +39 -0
  25. package/dist/components/editor/plugins/actions/counter-character-plugin.js +53 -0
  26. package/dist/components/editor/plugins/toolbar/block-format/block-format-data.js +52 -0
  27. package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +26 -0
  28. package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +26 -0
  29. package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +31 -0
  30. package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +26 -0
  31. package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +23 -0
  32. package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +24 -0
  33. package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +56 -0
  34. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +50 -0
  35. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +69 -0
  36. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +34 -0
  37. package/dist/components/editor/themes/editor-theme.js +112 -0
  38. package/dist/components/ui/app-editor.js +150 -0
  39. package/dist/components/ui/app-multiple-select-dropdown.js +2 -2
  40. package/dist/components/ui/button.js +25 -24
  41. package/dist/components/ui/calendar.js +9 -9
  42. package/dist/components/ui/dialog.js +43 -37
  43. package/dist/components/ui/sidebar.js +20 -19
  44. package/dist/index.d.ts +23 -1
  45. package/dist/index.js +48 -44
  46. package/dist/laif-ds.css +1 -0
  47. package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +159 -0
  48. package/dist/node_modules/@lexical/code/LexicalCode.prod.js +236 -0
  49. package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +46 -0
  50. package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +89 -0
  51. package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +108 -0
  52. package/dist/node_modules/@lexical/link/LexicalLink.prod.js +187 -0
  53. package/dist/node_modules/@lexical/list/LexicalList.prod.js +729 -0
  54. package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +367 -0
  55. package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +11 -0
  56. package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +17 -0
  57. package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +45 -0
  58. package/dist/node_modules/@lexical/react/LexicalComposerContext.prod.js +22 -0
  59. package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +55 -0
  60. package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +49 -0
  61. package/dist/node_modules/@lexical/react/LexicalHistoryPlugin.prod.js +15 -0
  62. package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +17 -0
  63. package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +16 -0
  64. package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +56 -0
  65. package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +21 -0
  66. package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +376 -0
  67. package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +107 -0
  68. package/dist/node_modules/@lexical/table/LexicalTable.prod.js +661 -0
  69. package/dist/node_modules/@lexical/text/LexicalText.prod.js +37 -0
  70. package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +102 -0
  71. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
  72. package/dist/node_modules/eventemitter3/index.js +1 -1
  73. package/dist/node_modules/eventemitter3/index2.js +1 -1
  74. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
  75. package/dist/node_modules/lexical/Lexical.prod.js +4901 -0
  76. package/dist/node_modules/prismjs/components/prism-c.js +77 -0
  77. package/dist/node_modules/prismjs/components/prism-clike.js +32 -0
  78. package/dist/node_modules/prismjs/components/prism-cpp.js +93 -0
  79. package/dist/node_modules/prismjs/components/prism-css.js +56 -0
  80. package/dist/node_modules/prismjs/components/prism-java.js +122 -0
  81. package/dist/node_modules/prismjs/components/prism-javascript.js +138 -0
  82. package/dist/node_modules/prismjs/components/prism-markdown.js +301 -0
  83. package/dist/node_modules/prismjs/components/prism-markup.js +174 -0
  84. package/dist/node_modules/prismjs/components/prism-objectivec.js +11 -0
  85. package/dist/node_modules/prismjs/components/prism-powershell.js +56 -0
  86. package/dist/node_modules/prismjs/components/prism-python.js +69 -0
  87. package/dist/node_modules/prismjs/components/prism-rust.js +124 -0
  88. package/dist/node_modules/prismjs/components/prism-sql.js +34 -0
  89. package/dist/node_modules/prismjs/components/prism-swift.js +114 -0
  90. package/dist/node_modules/prismjs/components/prism-typescript.js +53 -0
  91. package/dist/node_modules/prismjs/prism.js +1165 -0
  92. package/dist/node_modules/recharts/es6/util/Events.js +1 -1
  93. package/dist/node_modules/unified/lib/index.js +1 -1
  94. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  95. package/dist/styles.v3.css +1 -1
  96. package/package.json +12 -1
@@ -0,0 +1,729 @@
1
+ "use client";
2
+ import { removeClassNamesFromElement as ee, addClassNamesToElement as te, mergeRegister as re, $findMatchingParent as ne, $getNearestNodeOfType as ue, calculateZoomLevel as ge } from "../utils/LexicalUtils.prod.js";
3
+ import { ElementNode as se, isHTMLElement as S, $createTextNode as de, $isElementNode as v, $createParagraphNode as M, $isParagraphNode as he, $isRangeSelection as L, $applyNodeReplacement as ie, createCommand as D, TextNode as fe, $isTextNode as pe, $getSelection as P, INSERT_PARAGRAPH_COMMAND as me, COMMAND_PRIORITY_LOW as C, KEY_ARROW_LEFT_COMMAND as _e, KEY_SPACE_COMMAND as Ce, $getNearestNodeFromDOMNode as W, KEY_ESCAPE_COMMAND as ye, KEY_ARROW_UP_COMMAND as Te, KEY_ARROW_DOWN_COMMAND as Ne, $isRootOrShadowRoot as A, $isLeafNode as oe, $setPointFromCaret as B, $normalizeCaret as U, $getChildCaret as V, getNearestEditorFromDOMNode as Se } from "../../lexical/Lexical.prod.js";
4
+ import { getStyleObjectFromCSS as z } from "../selection/LexicalSelection.prod.js";
5
+ function y(n, ...e) {
6
+ const t = new URL("https://lexical.dev/docs/error"), r = new URLSearchParams();
7
+ r.append("code", n);
8
+ for (const s of e) r.append("v", s);
9
+ throw t.search = r.toString(), Error(`Minified Lexical error #${n}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
10
+ }
11
+ function R(n) {
12
+ let e = 1, t = n.getParent();
13
+ for (; t != null; ) {
14
+ if (g(t)) {
15
+ const r = t.getParent();
16
+ if (u(r)) {
17
+ e++, t = r.getParent();
18
+ continue;
19
+ }
20
+ y(40);
21
+ }
22
+ return e;
23
+ }
24
+ return e;
25
+ }
26
+ function w(n) {
27
+ let e = n.getParent();
28
+ u(e) || y(40);
29
+ let t = e;
30
+ for (; t !== null; ) t = t.getParent(), u(t) && (e = t);
31
+ return e;
32
+ }
33
+ function le(n) {
34
+ let e = [];
35
+ const t = n.getChildren().filter(g);
36
+ for (let r = 0; r < t.length; r++) {
37
+ const s = t[r], i = s.getFirstChild();
38
+ u(i) ? e = e.concat(le(i)) : e.push(s);
39
+ }
40
+ return e;
41
+ }
42
+ function T(n) {
43
+ return g(n) && u(n.getFirstChild());
44
+ }
45
+ function Y(n) {
46
+ return m().append(n);
47
+ }
48
+ function ae(n, e) {
49
+ return g(n) && (e.length === 0 || e.length === 1 && n.is(e[0]) && n.getChildrenSize() === 0);
50
+ }
51
+ function $(n) {
52
+ const e = P();
53
+ if (e !== null) {
54
+ let t = e.getNodes();
55
+ if (L(e)) {
56
+ const s = e.getStartEndPoints();
57
+ s === null && y(143);
58
+ const [i] = s, o = i.getNode(), a = o.getParent();
59
+ if (A(o)) {
60
+ const l = o.getFirstChild();
61
+ if (l) t = l.selectStart().getNodes();
62
+ else {
63
+ const c = M();
64
+ o.append(c), t = c.select().getNodes();
65
+ }
66
+ } else if (ae(o, t)) {
67
+ const l = p(n);
68
+ if (A(a)) {
69
+ o.replace(l);
70
+ const c = m();
71
+ v(o) && (c.setFormat(o.getFormatType()), c.setIndent(o.getIndent())), l.append(c);
72
+ } else if (g(o)) {
73
+ const c = o.getParentOrThrow();
74
+ N(l, c.getChildren()), c.replace(l);
75
+ }
76
+ return;
77
+ }
78
+ }
79
+ const r = /* @__PURE__ */ new Set();
80
+ for (let s = 0; s < t.length; s++) {
81
+ const i = t[s];
82
+ if (v(i) && i.isEmpty() && !g(i) && !r.has(i.getKey())) {
83
+ H(i, n);
84
+ continue;
85
+ }
86
+ let o = oe(i) ? i.getParent() : g(i) && i.isEmpty() ? i : null;
87
+ for (; o != null; ) {
88
+ const a = o.getKey();
89
+ if (u(o)) {
90
+ if (!r.has(a)) {
91
+ const l = p(n);
92
+ N(l, o.getChildren()), o.replace(l), r.add(a);
93
+ }
94
+ break;
95
+ }
96
+ {
97
+ const l = o.getParent();
98
+ if (A(l) && !r.has(a)) {
99
+ r.add(a), H(o, n);
100
+ break;
101
+ }
102
+ o = l;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ function N(n, e) {
109
+ n.splice(n.getChildrenSize(), 0, e);
110
+ }
111
+ function H(n, e) {
112
+ if (u(n)) return n;
113
+ const t = n.getPreviousSibling(), r = n.getNextSibling(), s = m();
114
+ let i;
115
+ if (N(s, n.getChildren()), u(t) && e === t.getListType()) t.append(s), u(r) && e === r.getListType() && (N(t, r.getChildren()), r.remove()), i = t;
116
+ else if (u(r) && e === r.getListType()) r.getFirstChildOrThrow().insertBefore(s), i = r;
117
+ else {
118
+ const o = p(e);
119
+ o.append(s), n.replace(o), i = o;
120
+ }
121
+ return s.setFormat(n.getFormatType()), s.setIndent(n.getIndent()), n.remove(), i;
122
+ }
123
+ function J(n, e) {
124
+ const t = n.getLastChild(), r = e.getFirstChild();
125
+ t && r && T(t) && T(r) && (J(t.getFirstChild(), r.getFirstChild()), r.remove());
126
+ const s = e.getChildren();
127
+ s.length > 0 && n.append(...s), e.remove();
128
+ }
129
+ function ve() {
130
+ const n = P();
131
+ if (L(n)) {
132
+ const e = /* @__PURE__ */ new Set(), t = n.getNodes(), r = n.anchor.getNode();
133
+ if (ae(r, t)) e.add(w(r));
134
+ else for (let s = 0; s < t.length; s++) {
135
+ const i = t[s];
136
+ if (oe(i)) {
137
+ const o = ue(i, O);
138
+ o != null && e.add(w(o));
139
+ }
140
+ }
141
+ for (const s of e) {
142
+ let i = s;
143
+ const o = le(s);
144
+ for (const a of o) {
145
+ const l = M().setTextStyle(n.style).setTextFormat(n.format);
146
+ N(l, a.getChildren()), i.insertAfter(l), i = l, a.__key === n.anchor.key && B(n.anchor, U(V(l, "next"))), a.__key === n.focus.key && B(n.focus, U(V(l, "next"))), a.remove();
147
+ }
148
+ s.remove();
149
+ }
150
+ }
151
+ }
152
+ function Le(n) {
153
+ const e = /* @__PURE__ */ new Set();
154
+ if (T(n) || e.has(n.getKey())) return;
155
+ const t = n.getParent(), r = n.getNextSibling(), s = n.getPreviousSibling();
156
+ if (T(r) && T(s)) {
157
+ const i = s.getFirstChild();
158
+ if (u(i)) {
159
+ i.append(n);
160
+ const o = r.getFirstChild();
161
+ u(o) && (N(i, o.getChildren()), r.remove(), e.add(r.getKey()));
162
+ }
163
+ } else if (T(r)) {
164
+ const i = r.getFirstChild();
165
+ if (u(i)) {
166
+ const o = i.getFirstChild();
167
+ o !== null && o.insertBefore(n);
168
+ }
169
+ } else if (T(s)) {
170
+ const i = s.getFirstChild();
171
+ u(i) && i.append(n);
172
+ } else if (u(t)) {
173
+ const i = m().setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle()), o = p(t.getListType()).setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle());
174
+ i.append(o), o.append(n), s ? s.insertAfter(i) : r ? r.insertBefore(i) : t.append(i);
175
+ }
176
+ }
177
+ function Oe(n) {
178
+ if (T(n)) return;
179
+ const e = n.getParent(), t = e ? e.getParent() : void 0;
180
+ if (u(t ? t.getParent() : void 0) && g(t) && u(e)) {
181
+ const r = e ? e.getFirstChild() : void 0, s = e ? e.getLastChild() : void 0;
182
+ if (n.is(r)) t.insertBefore(n), e.isEmpty() && t.remove();
183
+ else if (n.is(s)) t.insertAfter(n), e.isEmpty() && t.remove();
184
+ else {
185
+ const i = e.getListType(), o = m(), a = p(i);
186
+ o.append(a), n.getPreviousSiblings().forEach((d) => a.append(d));
187
+ const l = m(), c = p(i);
188
+ l.append(c), N(c, n.getNextSiblings()), t.insertBefore(o), t.insertAfter(l), t.replace(n);
189
+ }
190
+ }
191
+ }
192
+ function xe() {
193
+ const n = P();
194
+ if (!L(n) || !n.isCollapsed()) return !1;
195
+ const e = n.anchor.getNode();
196
+ if (!g(e) || e.getChildrenSize() !== 0) return !1;
197
+ const t = w(e), r = e.getParent();
198
+ u(r) || y(40);
199
+ const s = r.getParent();
200
+ let i;
201
+ if (A(s)) i = M(), t.insertAfter(i);
202
+ else {
203
+ if (!g(s)) return !1;
204
+ i = m(), s.insertAfter(i);
205
+ }
206
+ i.setTextStyle(n.style).setTextFormat(n.format).select();
207
+ const o = e.getNextSiblings();
208
+ if (o.length > 0) {
209
+ const a = p(r.getListType());
210
+ if (g(i)) {
211
+ const l = m();
212
+ l.append(a), i.insertAfter(l);
213
+ } else i.insertAfter(a);
214
+ a.append(...o);
215
+ }
216
+ return function(a) {
217
+ let l = a;
218
+ for (; l.getNextSibling() == null && l.getPreviousSibling() == null; ) {
219
+ const c = l.getParent();
220
+ if (c == null || !g(c) && !u(c)) break;
221
+ l = c;
222
+ }
223
+ l.remove();
224
+ }(e), !0;
225
+ }
226
+ function F(...n) {
227
+ const e = [];
228
+ for (const t of n) if (t && typeof t == "string") for (const [r] of t.matchAll(/\S+/g)) e.push(r);
229
+ return e;
230
+ }
231
+ class O extends se {
232
+ static getType() {
233
+ return "listitem";
234
+ }
235
+ static clone(e) {
236
+ return new O(e.__value, e.__checked, e.__key);
237
+ }
238
+ constructor(e, t, r) {
239
+ super(r), this.__value = e === void 0 ? 1 : e, this.__checked = t;
240
+ }
241
+ createDOM(e) {
242
+ const t = document.createElement("li");
243
+ return this.updateListItemDOM(null, t, e), t;
244
+ }
245
+ updateListItemDOM(e, t, r) {
246
+ const s = this.getParent();
247
+ u(s) && s.getListType() === "check" && function(a, l, c, d) {
248
+ u(l.getFirstChild()) ? (a.removeAttribute("role"), a.removeAttribute("tabIndex"), a.removeAttribute("aria-checked")) : (a.setAttribute("role", "checkbox"), a.setAttribute("tabIndex", "-1"), c && l.__checked === c.__checked || a.setAttribute("aria-checked", l.getChecked() ? "true" : "false"));
249
+ }(t, this, e), t.value = this.__value, function(a, l, c) {
250
+ const d = [], h = [], f = l.list, x = f ? f.listitem : void 0;
251
+ let _;
252
+ if (f && f.nested && (_ = f.nested.listitem), x !== void 0 && d.push(...F(x)), f) {
253
+ const k = c.getParent(), b = u(k) && k.getListType() === "check", I = c.getChecked();
254
+ b && !I || h.push(f.listitemUnchecked), b && I || h.push(f.listitemChecked), b && d.push(I ? f.listitemChecked : f.listitemUnchecked);
255
+ }
256
+ if (_ !== void 0) {
257
+ const k = F(_);
258
+ c.getChildren().some((b) => u(b)) ? d.push(...k) : h.push(...k);
259
+ }
260
+ h.length > 0 && ee(a, ...h), d.length > 0 && te(a, ...d);
261
+ }(t, r.theme, this);
262
+ const i = e ? e.__style : "", o = this.__style;
263
+ i !== o && (o === "" ? t.removeAttribute("style") : t.style.cssText = o), function(a, l, c) {
264
+ const d = z(l.__textStyle);
265
+ for (const h in d) a.style.setProperty(`--listitem-marker-${h}`, d[h]);
266
+ if (c) for (const h in z(c.__textStyle)) h in d || a.style.removeProperty(`--listitem-marker-${h}`);
267
+ }(t, this, e);
268
+ }
269
+ updateDOM(e, t, r) {
270
+ const s = t;
271
+ return this.updateListItemDOM(e, s, r), !1;
272
+ }
273
+ static transform() {
274
+ return (e) => {
275
+ if (g(e) || y(144), e.__checked == null) return;
276
+ const t = e.getParent();
277
+ u(t) && t.getListType() !== "check" && e.getChecked() != null && e.setChecked(void 0);
278
+ };
279
+ }
280
+ static importDOM() {
281
+ return { li: () => ({ conversion: ke, priority: 0 }) };
282
+ }
283
+ static importJSON(e) {
284
+ return m().updateFromJSON(e);
285
+ }
286
+ updateFromJSON(e) {
287
+ return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked);
288
+ }
289
+ exportDOM(e) {
290
+ const t = this.createDOM(e._config), r = this.getFormatType();
291
+ r && (t.style.textAlign = r);
292
+ const s = this.getDirection();
293
+ return s && (t.dir = s), { element: t };
294
+ }
295
+ exportJSON() {
296
+ return { ...super.exportJSON(), checked: this.getChecked(), value: this.getValue() };
297
+ }
298
+ append(...e) {
299
+ for (let t = 0; t < e.length; t++) {
300
+ const r = e[t];
301
+ if (v(r) && this.canMergeWith(r)) {
302
+ const s = r.getChildren();
303
+ this.append(...s), r.remove();
304
+ } else super.append(r);
305
+ }
306
+ return this;
307
+ }
308
+ replace(e, t) {
309
+ if (g(e)) return super.replace(e);
310
+ this.setIndent(0);
311
+ const r = this.getParentOrThrow();
312
+ if (!u(r)) return e;
313
+ if (r.__first === this.getKey()) r.insertBefore(e);
314
+ else if (r.__last === this.getKey()) r.insertAfter(e);
315
+ else {
316
+ const s = p(r.getListType());
317
+ let i = this.getNextSibling();
318
+ for (; i; ) {
319
+ const o = i;
320
+ i = i.getNextSibling(), s.append(o);
321
+ }
322
+ r.insertAfter(e), e.insertAfter(s);
323
+ }
324
+ return t && (v(e) || y(139), this.getChildren().forEach((s) => {
325
+ e.append(s);
326
+ })), this.remove(), r.getChildrenSize() === 0 && r.remove(), e;
327
+ }
328
+ insertAfter(e, t = !0) {
329
+ const r = this.getParentOrThrow();
330
+ if (u(r) || y(39), g(e)) return super.insertAfter(e, t);
331
+ const s = this.getNextSiblings();
332
+ if (r.insertAfter(e, t), s.length !== 0) {
333
+ const i = p(r.getListType());
334
+ s.forEach((o) => i.append(o)), e.insertAfter(i, t);
335
+ }
336
+ return e;
337
+ }
338
+ remove(e) {
339
+ const t = this.getPreviousSibling(), r = this.getNextSibling();
340
+ super.remove(e), t && r && T(t) && T(r) && (J(t.getFirstChild(), r.getFirstChild()), r.remove());
341
+ }
342
+ insertNewAfter(e, t = !0) {
343
+ const r = m().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked() && void 0);
344
+ return this.insertAfter(r, t), r;
345
+ }
346
+ collapseAtStart(e) {
347
+ const t = M();
348
+ this.getChildren().forEach((o) => t.append(o));
349
+ const r = this.getParentOrThrow(), s = r.getParentOrThrow(), i = g(s);
350
+ if (r.getChildrenSize() === 1) if (i) r.remove(), s.select();
351
+ else {
352
+ r.insertBefore(t), r.remove();
353
+ const o = e.anchor, a = e.focus, l = t.getKey();
354
+ o.type === "element" && o.getNode().is(this) && o.set(l, o.offset, "element"), a.type === "element" && a.getNode().is(this) && a.set(l, a.offset, "element");
355
+ }
356
+ else r.insertBefore(t), this.remove();
357
+ return !0;
358
+ }
359
+ getValue() {
360
+ return this.getLatest().__value;
361
+ }
362
+ setValue(e) {
363
+ const t = this.getWritable();
364
+ return t.__value = e, t;
365
+ }
366
+ getChecked() {
367
+ const e = this.getLatest();
368
+ let t;
369
+ const r = this.getParent();
370
+ return u(r) && (t = r.getListType()), t === "check" ? !!e.__checked : void 0;
371
+ }
372
+ setChecked(e) {
373
+ const t = this.getWritable();
374
+ return t.__checked = e, t;
375
+ }
376
+ toggleChecked() {
377
+ const e = this.getWritable();
378
+ return e.setChecked(!e.__checked);
379
+ }
380
+ getIndent() {
381
+ const e = this.getParent();
382
+ if (e === null || !this.isAttached()) return this.getLatest().__indent;
383
+ let t = e.getParentOrThrow(), r = 0;
384
+ for (; g(t); ) t = t.getParentOrThrow().getParentOrThrow(), r++;
385
+ return r;
386
+ }
387
+ setIndent(e) {
388
+ typeof e != "number" && y(117), (e = Math.floor(e)) >= 0 || y(199);
389
+ let t = this.getIndent();
390
+ for (; t !== e; ) t < e ? (Le(this), t++) : (Oe(this), t--);
391
+ return this;
392
+ }
393
+ canInsertAfter(e) {
394
+ return g(e);
395
+ }
396
+ canReplaceWith(e) {
397
+ return g(e);
398
+ }
399
+ canMergeWith(e) {
400
+ return g(e) || he(e);
401
+ }
402
+ extractWithChild(e, t) {
403
+ if (!L(t)) return !1;
404
+ const r = t.anchor.getNode(), s = t.focus.getNode();
405
+ return this.isParentOf(r) && this.isParentOf(s) && this.getTextContent().length === t.getTextContent().length;
406
+ }
407
+ isParentRequired() {
408
+ return !0;
409
+ }
410
+ createParentElementNode() {
411
+ return p("bullet");
412
+ }
413
+ canMergeWhenEmpty() {
414
+ return !0;
415
+ }
416
+ }
417
+ function ke(n) {
418
+ if (n.classList.contains("task-list-item")) {
419
+ for (const t of n.children) if (t.tagName === "INPUT") return be(t);
420
+ }
421
+ const e = n.getAttribute("aria-checked");
422
+ return { node: m(e === "true" || e !== "false" && void 0) };
423
+ }
424
+ function be(n) {
425
+ return n.getAttribute("type") !== "checkbox" ? { node: null } : { node: m(n.hasAttribute("checked")) };
426
+ }
427
+ function m(n) {
428
+ return ie(new O(void 0, n));
429
+ }
430
+ function g(n) {
431
+ return n instanceof O;
432
+ }
433
+ class E extends se {
434
+ static getType() {
435
+ return "list";
436
+ }
437
+ static clone(e) {
438
+ const t = e.__listType || j[e.__tag];
439
+ return new E(t, e.__start, e.__key);
440
+ }
441
+ constructor(e = "number", t = 1, r) {
442
+ super(r);
443
+ const s = j[e] || e;
444
+ this.__listType = s, this.__tag = s === "number" ? "ol" : "ul", this.__start = t;
445
+ }
446
+ getTag() {
447
+ return this.__tag;
448
+ }
449
+ setListType(e) {
450
+ const t = this.getWritable();
451
+ return t.__listType = e, t.__tag = e === "number" ? "ol" : "ul", t;
452
+ }
453
+ getListType() {
454
+ return this.__listType;
455
+ }
456
+ getStart() {
457
+ return this.__start;
458
+ }
459
+ setStart(e) {
460
+ const t = this.getWritable();
461
+ return t.__start = e, t;
462
+ }
463
+ createDOM(e, t) {
464
+ const r = this.__tag, s = document.createElement(r);
465
+ return this.__start !== 1 && s.setAttribute("start", String(this.__start)), s.__lexicalListType = this.__listType, G(s, e.theme, this), s;
466
+ }
467
+ updateDOM(e, t, r) {
468
+ return e.__tag !== this.__tag || (G(t, r.theme, this), !1);
469
+ }
470
+ static transform() {
471
+ return (e) => {
472
+ u(e) || y(163), function(t) {
473
+ const r = t.getNextSibling();
474
+ u(r) && t.getListType() === r.getListType() && J(t, r);
475
+ }(e), function(t) {
476
+ const r = t.getListType() !== "check";
477
+ let s = t.getStart();
478
+ for (const i of t.getChildren()) g(i) && (i.getValue() !== s && i.setValue(s), r && i.getLatest().__checked != null && i.setChecked(void 0), u(i.getFirstChild()) || s++);
479
+ }(e);
480
+ };
481
+ }
482
+ static importDOM() {
483
+ return { ol: () => ({ conversion: X, priority: 0 }), ul: () => ({ conversion: X, priority: 0 }) };
484
+ }
485
+ static importJSON(e) {
486
+ return p().updateFromJSON(e);
487
+ }
488
+ updateFromJSON(e) {
489
+ return super.updateFromJSON(e).setListType(e.listType).setStart(e.start);
490
+ }
491
+ exportDOM(e) {
492
+ const t = this.createDOM(e._config, e);
493
+ return S(t) && (this.__start !== 1 && t.setAttribute("start", String(this.__start)), this.__listType === "check" && t.setAttribute("__lexicalListType", "check")), { element: t };
494
+ }
495
+ exportJSON() {
496
+ return { ...super.exportJSON(), listType: this.getListType(), start: this.getStart(), tag: this.getTag() };
497
+ }
498
+ canBeEmpty() {
499
+ return !1;
500
+ }
501
+ canIndent() {
502
+ return !1;
503
+ }
504
+ splice(e, t, r) {
505
+ let s = r;
506
+ for (let i = 0; i < r.length; i++) {
507
+ const o = r[i];
508
+ g(o) || (s === r && (s = [...r]), s[i] = m().append(!v(o) || u(o) || o.isInline() ? o : de(o.getTextContent())));
509
+ }
510
+ return super.splice(e, t, s);
511
+ }
512
+ extractWithChild(e) {
513
+ return g(e);
514
+ }
515
+ }
516
+ function G(n, e, t) {
517
+ const r = [], s = [], i = e.list;
518
+ if (i !== void 0) {
519
+ const o = i[`${t.__tag}Depth`] || [], a = R(t) - 1, l = a % o.length, c = o[l], d = i[t.__tag];
520
+ let h;
521
+ const f = i.nested, x = i.checklist;
522
+ if (f !== void 0 && f.list && (h = f.list), d !== void 0 && r.push(d), x !== void 0 && t.__listType === "check" && r.push(x), c !== void 0) {
523
+ r.push(...F(c));
524
+ for (let _ = 0; _ < o.length; _++) _ !== l && s.push(t.__tag + _);
525
+ }
526
+ if (h !== void 0) {
527
+ const _ = F(h);
528
+ a > 1 ? r.push(..._) : s.push(..._);
529
+ }
530
+ }
531
+ s.length > 0 && ee(n, ...s), r.length > 0 && te(n, ...r);
532
+ }
533
+ function Pe(n) {
534
+ const e = [];
535
+ for (let t = 0; t < n.length; t++) {
536
+ const r = n[t];
537
+ if (g(r)) {
538
+ e.push(r);
539
+ const s = r.getChildren();
540
+ s.length > 1 && s.forEach((i) => {
541
+ u(i) && e.push(Y(i));
542
+ });
543
+ } else e.push(Y(r));
544
+ }
545
+ return e;
546
+ }
547
+ function X(n) {
548
+ const e = n.nodeName.toLowerCase();
549
+ let t = null;
550
+ return e === "ol" ? t = p("number", n.start) : e === "ul" && (t = function(r) {
551
+ if (r.getAttribute("__lexicallisttype") === "check" || r.classList.contains("contains-task-list")) return !0;
552
+ for (const s of r.childNodes) if (S(s) && s.hasAttribute("aria-checked")) return !0;
553
+ return !1;
554
+ }(n) ? p("check") : p("bullet")), { after: Pe, node: t };
555
+ }
556
+ const j = { ol: "number", ul: "bullet" };
557
+ function p(n = "number", e = 1) {
558
+ return ie(new E(n, e));
559
+ }
560
+ function u(n) {
561
+ return n instanceof E;
562
+ }
563
+ const Ee = D("INSERT_CHECK_LIST_COMMAND");
564
+ function we(n) {
565
+ return re(n.registerCommand(Ee, () => ($("check"), !0), C), n.registerCommand(Ne, (e) => Z(e, n, !1), C), n.registerCommand(Te, (e) => Z(e, n, !0), C), n.registerCommand(ye, () => {
566
+ if (K() != null) {
567
+ const e = n.getRootElement();
568
+ return e?.focus(), !0;
569
+ }
570
+ return !1;
571
+ }, C), n.registerCommand(Ce, (e) => {
572
+ const t = K();
573
+ return !(t == null || !n.isEditable()) && (n.update(() => {
574
+ const r = W(t);
575
+ g(r) && (e.preventDefault(), r.toggleChecked());
576
+ }), !0);
577
+ }, C), n.registerCommand(_e, (e) => n.getEditorState().read(() => {
578
+ const t = P();
579
+ if (L(t) && t.isCollapsed()) {
580
+ const { anchor: r } = t, s = r.type === "element";
581
+ if (s || r.offset === 0) {
582
+ const i = r.getNode(), o = ne(i, (a) => v(a) && !a.isInline());
583
+ if (g(o)) {
584
+ const a = o.getParent();
585
+ if (u(a) && a.getListType() === "check" && (s || o.getFirstDescendant() === i)) {
586
+ const l = n.getElementByKey(o.__key);
587
+ if (l != null && document.activeElement !== l) return l.focus(), e.preventDefault(), !0;
588
+ }
589
+ }
590
+ }
591
+ }
592
+ return !1;
593
+ }), C), n.registerRootListener((e, t) => {
594
+ e !== null && (e.addEventListener("click", q), e.addEventListener("pointerdown", Q)), t !== null && (t.removeEventListener("click", q), t.removeEventListener("pointerdown", Q));
595
+ }));
596
+ }
597
+ function ce(n, e) {
598
+ const t = n.target;
599
+ if (!S(t)) return;
600
+ const r = t.firstChild;
601
+ if (S(r) && (r.tagName === "UL" || r.tagName === "OL")) return;
602
+ const s = t.parentNode;
603
+ if (!s || s.__lexicalListType !== "check") return;
604
+ const i = t.getBoundingClientRect(), o = n.pageX / ge(t), a = window.getComputedStyle ? window.getComputedStyle(t, "::before") : { width: "0px" }, l = parseFloat(a.width);
605
+ (t.dir === "rtl" ? o < i.right && o > i.right - l : o > i.left && o < i.left + l) && e();
606
+ }
607
+ function q(n) {
608
+ ce(n, () => {
609
+ if (S(n.target)) {
610
+ const e = n.target, t = Se(e);
611
+ t != null && t.isEditable() && t.update(() => {
612
+ const r = W(e);
613
+ g(r) && (e.focus(), r.toggleChecked());
614
+ });
615
+ }
616
+ });
617
+ }
618
+ function Q(n) {
619
+ ce(n, () => {
620
+ n.preventDefault();
621
+ });
622
+ }
623
+ function K() {
624
+ const n = document.activeElement;
625
+ return S(n) && n.tagName === "LI" && n.parentNode != null && n.parentNode.__lexicalListType === "check" ? n : null;
626
+ }
627
+ function Z(n, e, t) {
628
+ const r = K();
629
+ return r != null && e.update(() => {
630
+ const s = W(r);
631
+ if (!g(s)) return;
632
+ const i = function(o, a) {
633
+ let l = a ? o.getPreviousSibling() : o.getNextSibling(), c = o;
634
+ for (; l == null && g(c); ) c = c.getParentOrThrow().getParent(), c != null && (l = a ? c.getPreviousSibling() : c.getNextSibling());
635
+ for (; g(l); ) {
636
+ const d = a ? l.getLastChild() : l.getFirstChild();
637
+ if (!u(d)) return l;
638
+ l = a ? d.getLastChild() : d.getFirstChild();
639
+ }
640
+ return null;
641
+ }(s, t);
642
+ if (i != null) {
643
+ i.selectStart();
644
+ const o = e.getElementByKey(i.__key);
645
+ o != null && (n.preventDefault(), setTimeout(() => {
646
+ o.focus();
647
+ }, 0));
648
+ }
649
+ }), !1;
650
+ }
651
+ const Ae = D("INSERT_UNORDERED_LIST_COMMAND"), Fe = D("INSERT_ORDERED_LIST_COMMAND"), Me = D("REMOVE_LIST_COMMAND");
652
+ function $e(n) {
653
+ return re(n.registerCommand(Fe, () => ($("number"), !0), C), n.registerCommand(Ae, () => ($("bullet"), !0), C), n.registerCommand(Me, () => (ve(), !0), C), n.registerCommand(me, () => xe(), C), n.registerNodeTransform(O, (e) => {
654
+ const t = e.getFirstChild();
655
+ if (t) {
656
+ if (pe(t)) {
657
+ const r = t.getStyle(), s = t.getFormat();
658
+ e.getTextStyle() !== r && e.setTextStyle(r), e.getTextFormat() !== s && e.setTextFormat(s);
659
+ }
660
+ } else {
661
+ const r = P();
662
+ L(r) && (r.style !== e.getTextStyle() || r.format !== e.getTextFormat()) && r.isCollapsed() && e.is(r.anchor.getNode()) && e.setTextStyle(r.style).setTextFormat(r.format);
663
+ }
664
+ }), n.registerNodeTransform(fe, (e) => {
665
+ const t = e.getParent();
666
+ if (g(t) && e.is(t.getFirstChild())) {
667
+ const r = e.getStyle(), s = e.getFormat();
668
+ r === t.getTextStyle() && s === t.getTextFormat() || t.setTextStyle(r).setTextFormat(s);
669
+ }
670
+ }));
671
+ }
672
+ function Ke(n) {
673
+ const e = (t) => {
674
+ const r = t.getParent();
675
+ if (u(t.getFirstChild()) || !u(r)) return;
676
+ const s = ne(t, (i) => g(i) && u(i.getParent()) && g(i.getPreviousSibling()));
677
+ if (s === null && t.getIndent() > 0) t.setIndent(0);
678
+ else if (g(s)) {
679
+ const i = s.getPreviousSibling();
680
+ if (g(i)) {
681
+ const o = function(l) {
682
+ let c = l, d = c.getFirstChild();
683
+ for (; u(d); ) {
684
+ const h = d.getLastChild();
685
+ if (!g(h)) break;
686
+ c = h, d = c.getFirstChild();
687
+ }
688
+ return c;
689
+ }(i), a = o.getParent();
690
+ if (u(a)) {
691
+ const l = R(a);
692
+ l + 1 < R(r) && t.setIndent(l);
693
+ }
694
+ }
695
+ }
696
+ };
697
+ return n.registerNodeTransform(E, (t) => {
698
+ const r = [t];
699
+ for (; r.length > 0; ) {
700
+ const s = r.shift();
701
+ if (u(s)) {
702
+ for (const i of s.getChildren()) if (g(i)) {
703
+ e(i);
704
+ const o = i.getFirstChild();
705
+ u(o) && r.push(o);
706
+ }
707
+ }
708
+ }
709
+ });
710
+ }
711
+ export {
712
+ m as $createListItemNode,
713
+ p as $createListNode,
714
+ R as $getListDepth,
715
+ xe as $handleListInsertParagraph,
716
+ $ as $insertList,
717
+ g as $isListItemNode,
718
+ u as $isListNode,
719
+ ve as $removeList,
720
+ Ee as INSERT_CHECK_LIST_COMMAND,
721
+ Fe as INSERT_ORDERED_LIST_COMMAND,
722
+ Ae as INSERT_UNORDERED_LIST_COMMAND,
723
+ O as ListItemNode,
724
+ E as ListNode,
725
+ Me as REMOVE_LIST_COMMAND,
726
+ we as registerCheckList,
727
+ $e as registerList,
728
+ Ke as registerListStrictIndentTransform
729
+ };