@pstdio/ui 0.19.0 → 0.20.0

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 (101) hide show
  1. package/dist/{MermaidComponent-BPiVFNYK.js → MermaidComponent-AmAjWLPm.js} +3 -3
  2. package/dist/{MermaidComponent-BPiVFNYK.js.map → MermaidComponent-AmAjWLPm.js.map} +1 -1
  3. package/dist/browser-storage-DPtOQJx0.js +127 -0
  4. package/dist/browser-storage-DPtOQJx0.js.map +1 -0
  5. package/dist/chat-ui.js +19 -20
  6. package/dist/chat-ui.js.map +1 -1
  7. package/dist/components/data-table/data-table-header.d.ts +3 -1
  8. package/dist/components/data-table/edit-mode-data-table-body.d.ts +29 -0
  9. package/dist/components/data-table/edit-mode-data-table-cell.d.ts +15 -0
  10. package/dist/components/data-table/edit-mode-data-table-editors.d.ts +19 -0
  11. package/dist/components/data-table/edit-mode-data-table-header.d.ts +23 -0
  12. package/dist/components/data-table/edit-mode-data-table-selection.d.ts +12 -0
  13. package/dist/components/data-table/edit-mode-data-table.d.ts +2 -0
  14. package/dist/components/data-table/edit-mode-story.d.ts +5 -0
  15. package/dist/components/data-table/index.d.ts +1 -1
  16. package/dist/components/data-table/pagination-footer.d.ts +8 -5
  17. package/dist/components/data-table/types.d.ts +24 -0
  18. package/dist/components/rich-text/index.d.ts +2 -0
  19. package/dist/components/rich-text/markdown-editor/markdown-editor.d.ts +7 -0
  20. package/dist/components/rich-text/markdown-editor/markdown-table.story-fixture.d.ts +3 -0
  21. package/dist/components/rich-text/markdown-editor/plugins/MarkdownSectionNavigationPlugin.d.ts +8 -0
  22. package/dist/components/rich-text/markdown-editor/plugins/MarkdownSlashCommandPlugin.d.ts +1 -0
  23. package/dist/components/rich-text/markdown-editor/plugins/markdown-history-plugin.d.ts +1 -0
  24. package/dist/components/rich-text/markdown-editor/plugins/markdown-section-navigation.d.ts +20 -0
  25. package/dist/components/rich-text/rich-message/rich-message.d.ts +2 -0
  26. package/dist/components/rich-text/shared/markdown-ast.d.ts +6 -0
  27. package/dist/components/rich-text/shared/markdown-codec.d.ts +3 -0
  28. package/dist/components/rich-text/shared/markdown-export.d.ts +2 -0
  29. package/dist/components/rich-text/shared/markdown-import.d.ts +2 -0
  30. package/dist/components/rich-text/shared/markdown-inline.d.ts +5 -0
  31. package/dist/components/rich-text/shared/markdown-table.d.ts +41 -0
  32. package/dist/components/rich-text/shared/markdown-url-context.d.ts +9 -0
  33. package/dist/components/rich-text/shared/markdown-url.d.ts +3 -0
  34. package/dist/components/rich-text/shared/nodes/DataTableNode.d.ts +13 -11
  35. package/dist/components/rich-text/shared/nodes/MarkdownImageNode.d.ts +35 -0
  36. package/dist/components/rich-text/shared/nodes/MarkdownLinkNode.d.ts +18 -0
  37. package/dist/components/rich-text/shared/nodes/RawHtmlNode.d.ts +31 -0
  38. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/floating-toolbar-buttons.d.ts +4 -2
  39. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/resolve-block-type.d.ts +1 -1
  40. package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/utils/setFloatingElemPos.d.ts +1 -1
  41. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.d.ts +1 -0
  42. package/dist/components/rich-text/shared/transformers/markdown-transformers.d.ts +2 -3
  43. package/dist/data-table.js +723 -923
  44. package/dist/data-table.js.map +1 -1
  45. package/dist/diff.js +4 -4
  46. package/dist/edit-mode-data-table-4GMiDy75.js +775 -0
  47. package/dist/edit-mode-data-table-4GMiDy75.js.map +1 -0
  48. package/dist/editor-config-Dyh8n5A2.js +2416 -0
  49. package/dist/editor-config-Dyh8n5A2.js.map +1 -0
  50. package/dist/index.js +142 -144
  51. package/dist/index.js.map +1 -1
  52. package/dist/{kanban-renderer-toolbar-Bcj_N1qr.js → kanban-renderer-toolbar-BcUZvGyY.js} +359 -361
  53. package/dist/kanban-renderer-toolbar-BcUZvGyY.js.map +1 -0
  54. package/dist/kanban-renderer.js +28 -27
  55. package/dist/kanban-renderer.js.map +1 -1
  56. package/dist/{lazy-markdown-editor-DwhqQ-NN.js → lazy-markdown-editor-CWSREEhf.js} +2 -2
  57. package/dist/{lazy-markdown-editor-DwhqQ-NN.js.map → lazy-markdown-editor-CWSREEhf.js.map} +1 -1
  58. package/dist/{list-row-BtoVJpFs.js → list-row-B8L4TGsh.js} +2 -2
  59. package/dist/{list-row-BtoVJpFs.js.map → list-row-B8L4TGsh.js.map} +1 -1
  60. package/dist/{mermaid-renderer-DZo3qj6D.js → mermaid-renderer-H3IhLqnQ.js} +3 -3
  61. package/dist/{mermaid-renderer-DZo3qj6D.js.map → mermaid-renderer-H3IhLqnQ.js.map} +1 -1
  62. package/dist/mermaid.js +1 -1
  63. package/dist/number-input-WUfejtNx.js +343 -0
  64. package/dist/number-input-WUfejtNx.js.map +1 -0
  65. package/dist/param-editor-field-C8zRDStn.js +2845 -0
  66. package/dist/param-editor-field-C8zRDStn.js.map +1 -0
  67. package/dist/{param-editor-XRjSu6MT.js → param-editor-w3xH-t8A.js} +2 -2
  68. package/dist/{param-editor-XRjSu6MT.js.map → param-editor-w3xH-t8A.js.map} +1 -1
  69. package/dist/rich-message-jZ2oPQhU.js +658 -0
  70. package/dist/rich-message-jZ2oPQhU.js.map +1 -0
  71. package/dist/rich-text.js +182 -110
  72. package/dist/rich-text.js.map +1 -1
  73. package/dist/style.css +1 -1
  74. package/dist/theme/recipes/button.d.ts +11 -0
  75. package/dist/{theme-7PDdD9OD.js → theme-J8K8KbZi.js} +12 -1
  76. package/dist/theme-J8K8KbZi.js.map +1 -0
  77. package/dist/{theme-preference-DOzHx64J.js → theme-preference-DyymrYpR.js} +2 -2
  78. package/dist/{theme-preference-DOzHx64J.js.map → theme-preference-DyymrYpR.js.map} +1 -1
  79. package/dist/theme.js +1 -1
  80. package/dist/{tree-list-B2L0cTj2.js → tree-list-CC13pOYi.js} +2 -2
  81. package/dist/{tree-list-B2L0cTj2.js.map → tree-list-CC13pOYi.js.map} +1 -1
  82. package/package.json +9 -1
  83. package/dist/browser-storage-BinyFNJX.js +0 -40
  84. package/dist/browser-storage-BinyFNJX.js.map +0 -1
  85. package/dist/checkbox-B2zYVemL.js +0 -70
  86. package/dist/checkbox-B2zYVemL.js.map +0 -1
  87. package/dist/components/data-table/editable-cells-story.d.ts +0 -9
  88. package/dist/kanban-renderer-toolbar-Bcj_N1qr.js.map +0 -1
  89. package/dist/markdown-DDd2ESoH.js +0 -743
  90. package/dist/markdown-DDd2ESoH.js.map +0 -1
  91. package/dist/markdown-editor-CYVkzt8t.js +0 -741
  92. package/dist/markdown-editor-CYVkzt8t.js.map +0 -1
  93. package/dist/param-editor-field-B9lEPq8c.js +0 -3028
  94. package/dist/param-editor-field-B9lEPq8c.js.map +0 -1
  95. package/dist/resource-badge-CuItchgL.js +0 -98
  96. package/dist/resource-badge-CuItchgL.js.map +0 -1
  97. package/dist/rich-message--eRzjWYK.js +0 -730
  98. package/dist/rich-message--eRzjWYK.js.map +0 -1
  99. package/dist/scroll-area-BMbg1WcD.js +0 -91
  100. package/dist/scroll-area-BMbg1WcD.js.map +0 -1
  101. package/dist/theme-7PDdD9OD.js.map +0 -1
@@ -0,0 +1,2416 @@
1
+ import { LinkNode as St, $isLinkNode as he, $isAutoLinkNode as Te, TOGGLE_LINK_COMMAND as ht, $createLinkNode as Jt, AutoLinkNode as Gt, $createAutoLinkNode as $n } from "@lexical/link";
2
+ import { $isListNode as Be, $isListItemNode as Mn, $createListNode as On, $createListItemNode as An, REMOVE_LIST_COMMAND as Dn, INSERT_CHECK_LIST_COMMAND as Pn, INSERT_ORDERED_LIST_COMMAND as Un, INSERT_UNORDERED_LIST_COMMAND as Bn, ListNode as Fn, ListItemNode as zn } from "@lexical/list";
3
+ import { CHECK_LIST as Hn, TRANSFORMERS as qn, LINK as Kn } from "@lexical/markdown";
4
+ import { $isHeadingNode as Qt, $isQuoteNode as Wn, $createQuoteNode as Vt, $createHeadingNode as Yt, QuoteNode as jn, HeadingNode as Jn } from "@lexical/rich-text";
5
+ import { $isCodeNode as et, $createCodeNode as Xt, CodeNode as Zt, registerCodeHighlighting as Gn, CodeHighlightNode as Qn } from "@lexical/code";
6
+ import { jsx as o, jsxs as G, Fragment as en } from "react/jsx-runtime";
7
+ import { c as F } from "react/compiler-runtime";
8
+ import { chakra as Vn, Box as ce, Text as le, Image as Yn, IconButton as W, Stack as pt, Input as gt, Link as tn, Dialog as Ce, Field as Ve, Flex as tt, Button as Dt, Icon as Xn, Code as Pt } from "@chakra-ui/react";
9
+ import { DecoratorNode as Me, $getSelection as se, $getNodeByKey as He, $isRangeSelection as ee, $applyNodeReplacement as Oe, ElementNode as Zn, $isParagraphNode as ot, $isElementNode as nn, $isTextNode as _t, $isLineBreakNode as rn, $getRoot as on, $createParagraphNode as we, $createTextNode as Ee, $createLineBreakNode as er, SELECTION_CHANGE_COMMAND as lt, COMMAND_PRIORITY_CRITICAL as Tt, $nodesOfType as tr, createCommand as nr, FORMAT_TEXT_COMMAND as Ye, $isRootOrShadowRoot as rr, CLICK_COMMAND as ln, COMMAND_PRIORITY_HIGH as wt, COMMAND_PRIORITY_LOW as bt, KEY_ESCAPE_COMMAND as ir, $setSelection as or, HISTORY_MERGE_TAG as ut, $addUpdateTag as sn, KEY_DOWN_COMMAND as lr, REDO_COMMAND as an, UNDO_COMMAND as cn, HISTORY_PUSH_TAG as Ut, TextNode as kt } from "lexical";
10
+ import * as sr from "react";
11
+ import { createContext as ar, useContext as cr, useRef as me, useEffect as q, Suspense as un, lazy as ur, useState as B, useLayoutEffect as dr, Fragment as mr } from "react";
12
+ import { E as fr } from "./edit-mode-data-table-4GMiDy75.js";
13
+ import { AutoFocusPlugin as hr } from "@lexical/react/LexicalAutoFocusPlugin";
14
+ import { CheckListPlugin as pr } from "@lexical/react/LexicalCheckListPlugin";
15
+ import { LexicalComposer as gr } from "@lexical/react/LexicalComposer";
16
+ import { LexicalErrorBoundary as _r } from "@lexical/react/LexicalErrorBoundary";
17
+ import { HorizontalRulePlugin as br } from "@lexical/react/LexicalHorizontalRulePlugin";
18
+ import { ListPlugin as kr } from "@lexical/react/LexicalListPlugin";
19
+ import { MarkdownShortcutPlugin as yr } from "@lexical/react/LexicalMarkdownShortcutPlugin";
20
+ import { OnChangePlugin as xr } from "@lexical/react/LexicalOnChangePlugin";
21
+ import { RichTextPlugin as Cr } from "@lexical/react/LexicalRichTextPlugin";
22
+ import { TabIndentationPlugin as vr } from "@lexical/react/LexicalTabIndentationPlugin";
23
+ import { ContentEditable as Er } from "@lexical/react/LexicalContentEditable";
24
+ import { S as Sr, T as j } from "./browser-storage-DPtOQJx0.js";
25
+ import Tr from "dompurify";
26
+ import wr from "katex";
27
+ import { R as Nr } from "./number-input-WUfejtNx.js";
28
+ import { useLexicalComposerContext as fe } from "@lexical/react/LexicalComposerContext";
29
+ import { mergeRegister as st, $findMatchingParent as ae } from "@lexical/utils";
30
+ import { Check as dn, Copy as Lr, Code as Ir, Link as Rr, TextQuote as $r, List as Mr, ListOrdered as Or, ListTodo as Ar, X as Dr, Pencil as Pr, Trash2 as Ur, Table2 as Br, Image as Fr, Code2 as zr, Minus as Hr } from "lucide-react";
31
+ import * as qr from "react-dom";
32
+ import { createPortal as Nt } from "react-dom";
33
+ import { TreeView as Kr } from "@lexical/react/LexicalTreeView";
34
+ import { $createHorizontalRuleNode as Wr } from "@lexical/react/LexicalHorizontalRuleNode";
35
+ import { LexicalTypeaheadMenuPlugin as jr } from "@lexical/react/LexicalTypeaheadMenuPlugin";
36
+ import { HistoryPlugin as Jr } from "@lexical/react/LexicalHistoryPlugin";
37
+ import { fromMarkdown as Gr } from "mdast-util-from-markdown";
38
+ import { gfmFromMarkdown as Qr, gfmToMarkdown as Vr } from "mdast-util-gfm";
39
+ import { mathFromMarkdown as Yr, mathToMarkdown as Xr } from "mdast-util-math";
40
+ import { toMarkdown as Zr } from "mdast-util-to-markdown";
41
+ import { gfm as ei } from "micromark-extension-gfm";
42
+ import { math as ti } from "micromark-extension-math";
43
+ import { LinkPlugin as ni } from "@lexical/react/LexicalLinkPlugin";
44
+ import { $isAtNodeEnd as Bt, $setBlocksType as Xe } from "@lexical/selection";
45
+ const ri = Vn(Er);
46
+ function ii(t) {
47
+ const e = F(11), {
48
+ onRef: n,
49
+ fullWidth: r,
50
+ padding: i,
51
+ isRichMessage: l,
52
+ scrollable: s
53
+ } = t, m = r === void 0 ? !1 : r, a = l === void 0 ? !1 : l, d = s === void 0 ? !0 : s, c = m ? "100%" : "45rem", u = m ? "0" : "auto";
54
+ let f;
55
+ e[0] !== c || e[1] !== u ? (f = /* @__PURE__ */ o(ri, { "data-testid": "content-editable", height: "fit-content", minH: "100%", width: "100%", maxWidth: c, marginInline: u, textStyle: "paragraph/M/regular", fontSize: "calc(var(--chakra-font-sizes-md) * var(--rich-text-font-scale))", position: "relative", outline: "none" }), e[0] = c, e[1] = u, e[2] = f) : f = e[2];
56
+ let b;
57
+ e[3] !== n || e[4] !== i || e[5] !== f ? (b = /* @__PURE__ */ o(ce, { ref: n, width: "100%", minH: "100%", padding: i, children: f }), e[3] = n, e[4] = i, e[5] = f, e[6] = b) : b = e[6];
58
+ const k = b;
59
+ if (!d)
60
+ return k;
61
+ const x = a ? "true" : void 0;
62
+ let v;
63
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = {
64
+ width: "100%",
65
+ minH: "100%"
66
+ }, e[7] = v) : v = e[7];
67
+ let p;
68
+ return e[8] !== k || e[9] !== x ? (p = /* @__PURE__ */ o(Sr, { className: "rich-text", "data-rich-message": x, height: "100%", minH: "0", position: "relative", contentProps: v, children: k }), e[8] = k, e[9] = x, e[10] = p) : p = e[10], p;
69
+ }
70
+ class Ne extends Me {
71
+ __href;
72
+ __label;
73
+ static getType() {
74
+ return "reference-link";
75
+ }
76
+ static clone(e) {
77
+ return new Ne(e.__href, e.__label, e.__key);
78
+ }
79
+ constructor(e, n, r) {
80
+ super(r), this.__href = e, this.__label = n;
81
+ }
82
+ createDOM(e, n) {
83
+ return document.createElement("span");
84
+ }
85
+ updateDOM(e, n, r) {
86
+ return !1;
87
+ }
88
+ getTextContent() {
89
+ return `{{link('${this.__label ?? this.__href}')}}`;
90
+ }
91
+ exportJSON() {
92
+ return {
93
+ type: Ne.getType(),
94
+ version: 1,
95
+ href: this.__href,
96
+ label: this.__label
97
+ };
98
+ }
99
+ static importJSON(e) {
100
+ return Lt(e.href, e.label);
101
+ }
102
+ decorate(e, n) {
103
+ const r = this.__href, l = r.split("/").pop() || "unknown", s = /^https?:\/\//i.test(r), m = /^#?\$PROJECT\//i.test(r);
104
+ return /* @__PURE__ */ o(ce, { width: "fit-content", display: "inline-block", children: /* @__PURE__ */ o(Nr, { fileName: l, onSelect: () => {
105
+ if (s)
106
+ window.open(r, "_blank", "noopener,noreferrer");
107
+ else if (m) {
108
+ const a = r.replace(/^#?\$PROJECT\//i, ""), d = new CustomEvent("ui:open-project-file", {
109
+ detail: a
110
+ });
111
+ window.dispatchEvent(d);
112
+ } else
113
+ window.location.assign(r);
114
+ } }) });
115
+ }
116
+ }
117
+ function Lt(t, e) {
118
+ return new Ne(t, e);
119
+ }
120
+ function mn(t) {
121
+ return t instanceof Ne;
122
+ }
123
+ const Ft = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/, oi = {
124
+ dependencies: [Ne],
125
+ export: (t) => {
126
+ if (mn(t)) {
127
+ const e = t.__href, n = t.__label ?? e;
128
+ return n ? `{{link('${n}')}}` : `{{link('${e}')}}`;
129
+ }
130
+ return null;
131
+ },
132
+ regExp: Ft,
133
+ importRegExp: Ft,
134
+ replace: (t, e) => {
135
+ const n = e[2], i = /^(https?:\/\/|\/)/i.test(n) ? n : `#${n}`, l = n;
136
+ t.replace(Lt(i, l));
137
+ },
138
+ type: "text-match"
139
+ }, li = {
140
+ code: "rich-text__code",
141
+ codeHighlight: {
142
+ atrule: "rich-text__tokenAttr",
143
+ attr: "rich-text__tokenAttr",
144
+ boolean: "rich-text__tokenProperty",
145
+ builtin: "rich-text__tokenSelector",
146
+ cdata: "rich-text__tokenComment",
147
+ char: "rich-text__tokenSelector",
148
+ class: "rich-text__tokenFunction",
149
+ "class-name": "rich-text__tokenFunction",
150
+ comment: "rich-text__tokenComment",
151
+ constant: "rich-text__tokenProperty",
152
+ deleted: "rich-text__tokenProperty",
153
+ doctype: "rich-text__tokenComment",
154
+ entity: "rich-text__tokenOperator",
155
+ function: "rich-text__tokenFunction",
156
+ important: "rich-text__tokenVariable",
157
+ inserted: "rich-text__tokenSelector",
158
+ keyword: "rich-text__tokenAttr",
159
+ namespace: "rich-text__tokenVariable",
160
+ number: "rich-text__tokenProperty",
161
+ operator: "rich-text__tokenOperator",
162
+ prolog: "rich-text__tokenComment",
163
+ property: "rich-text__tokenProperty",
164
+ punctuation: "rich-text__tokenPunctuation",
165
+ regex: "rich-text__tokenVariable",
166
+ selector: "rich-text__tokenSelector",
167
+ string: "rich-text__tokenSelector",
168
+ symbol: "rich-text__tokenProperty",
169
+ tag: "rich-text__tokenProperty",
170
+ url: "rich-text__tokenOperator",
171
+ variable: "rich-text__tokenVariable"
172
+ },
173
+ embedBlock: {
174
+ base: "rich-text__embedBlock",
175
+ focus: "rich-text__embedBlockFocus"
176
+ },
177
+ list: {
178
+ checklist: "rich-text__checklist",
179
+ listitem: "rich-text__listItem",
180
+ listitemChecked: "rich-text__listItemChecked",
181
+ listitemUnchecked: "rich-text__listItemUnchecked",
182
+ nested: {
183
+ listitem: "rich-text__nestedListItem"
184
+ },
185
+ olDepth: ["rich-text__ol1", "rich-text__ol2", "rich-text__ol3", "rich-text__ol4", "rich-text__ol5"],
186
+ ol: "rich-text__ol",
187
+ ul: "rich-text__ul"
188
+ },
189
+ heading: {
190
+ h1: "rich-text__h1",
191
+ h2: "rich-text__h2",
192
+ h3: "rich-text__h3"
193
+ },
194
+ paragraph: "rich-text__p",
195
+ text: {
196
+ underline: "rich-text__textUnderline",
197
+ italic: "rich-text__textItalic",
198
+ code: "rich-text__textCode"
199
+ },
200
+ link: "rich-text__link",
201
+ quote: "rich-text__quote",
202
+ reference: "rich-text__reference",
203
+ table: "rich-text__table",
204
+ tableCell: "rich-text__tableCell",
205
+ tableRow: "rich-text__tableRow",
206
+ tableCellHeader: "rich-text__tableCellHeader",
207
+ layoutContainer: "rich-text__layoutContainer",
208
+ layoutItem: "rich-text__layoutItem",
209
+ draggableBlockDemo: {
210
+ row: "rich-text__row",
211
+ content: "rich-text__content"
212
+ }
213
+ }, si = {
214
+ extensions: [ei(), ti()],
215
+ mdastExtensions: [Qr(), Yr()]
216
+ }, ai = {
217
+ bullet: "-",
218
+ emphasis: "*",
219
+ extensions: [Vr(), Xr()],
220
+ fence: "`",
221
+ fences: !0,
222
+ listItemIndent: "one",
223
+ rule: "-",
224
+ strong: "*"
225
+ }, ci = (t) => t.match(/^ {0,3}(`{3,}|~{3,})/), ui = (t) => {
226
+ let e = null, n = "";
227
+ for (let r = 0; r < t.length; ) {
228
+ if (t[r] === "`") {
229
+ let l = r;
230
+ for (; t[l] === "`"; ) l += 1;
231
+ const s = l - r;
232
+ e === null ? e = s : e === s && (e = null), n += t.slice(r, l), r = l;
233
+ continue;
234
+ }
235
+ const i = t.slice(r, r + 2);
236
+ if (e === null && (i === "\\(" || i === "\\)")) {
237
+ n += "$", r += 2;
238
+ continue;
239
+ }
240
+ if (e === null && (i === "\\[" || i === "\\]")) {
241
+ n += "$$", r += 2;
242
+ continue;
243
+ }
244
+ n += t[r], r += 1;
245
+ }
246
+ return n;
247
+ }, di = (t) => {
248
+ let e = null;
249
+ const n = [];
250
+ for (const r of t.split(`
251
+ `)) {
252
+ if (e) {
253
+ n.push(r);
254
+ const s = r.match(/^ {0,3}(`+|~+)[ \t]*$/)?.[1];
255
+ s?.[0] === e.character && s.length >= e.length && (e = null);
256
+ continue;
257
+ }
258
+ const i = ci(r)?.[1];
259
+ if (i) {
260
+ e = {
261
+ character: i[0] ?? "`",
262
+ length: i.length
263
+ }, n.push(r);
264
+ continue;
265
+ }
266
+ const l = r.match(/^( {0,3})\\\[\s*(.*?)\s*\\\][ \t]*$/);
267
+ if (l) {
268
+ const s = l[1] ?? "";
269
+ n.push(`${s}$$`, l[2] ?? "", `${s}$$`);
270
+ continue;
271
+ }
272
+ if (/^ {0,3}\\\[[ \t]*$/.test(r)) {
273
+ n.push(r.replace("\\[", () => "$$"));
274
+ continue;
275
+ }
276
+ if (/^ {0,3}\\\][ \t]*$/.test(r)) {
277
+ n.push(r.replace("\\]", () => "$$"));
278
+ continue;
279
+ }
280
+ n.push(ui(r));
281
+ }
282
+ return n.join(`
283
+ `);
284
+ }, fn = (t) => Gr(di(t), si), hn = (t) => Zr(t, ai).trimEnd(), It = (t) => hn({
285
+ type: "root",
286
+ children: [t]
287
+ }), Fe = (t) => It({
288
+ type: "paragraph",
289
+ children: t
290
+ }), pn = (t) => {
291
+ const n = fn(t).children[0];
292
+ return n?.type === "paragraph" || n?.type === "heading" ? n.children : [];
293
+ }, mi = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]), fi = /^data:image\/(?:png|gif|jpeg|webp);base64,[a-z0-9+/=]+$/i, gn = /^[a-z][a-z\d+.-]*:/i, hi = (t) => {
294
+ if (t.startsWith("#") || t.startsWith("/") || t.startsWith("./") || t.startsWith("../") || !gn.test(t)) return !0;
295
+ try {
296
+ return mi.has(new URL(t).protocol);
297
+ } catch {
298
+ return !1;
299
+ }
300
+ }, pi = (t) => t.startsWith("https://") ? !0 : fi.test(t), at = (t, e, n) => {
301
+ const r = n ? n(t, e) : t;
302
+ return r === null ? null : e === "image" ? !gn.test(t) && !n ? null : pi(r) ? r : null : hi(r) ? r : null;
303
+ }, _n = ar(void 0), gi = (t) => {
304
+ const e = F(3), {
305
+ children: n,
306
+ resolver: r
307
+ } = t;
308
+ let i;
309
+ return e[0] !== n || e[1] !== r ? (i = /* @__PURE__ */ o(_n.Provider, { value: r, children: n }), e[0] = n, e[1] = r, e[2] = i) : i = e[2], i;
310
+ }, Rt = () => cr(_n), bn = (t) => {
311
+ const e = F(10), {
312
+ source: n,
313
+ alt: r,
314
+ title: i,
315
+ onLoad: l
316
+ } = t, s = Rt();
317
+ let m;
318
+ e[0] !== s || e[1] !== n ? (m = at(n, "image", s), e[0] = s, e[1] = n, e[2] = m) : m = e[2];
319
+ const a = m;
320
+ if (!a) {
321
+ const u = r || "Image";
322
+ let f;
323
+ return e[3] !== u ? (f = /* @__PURE__ */ o(ce, { as: "span", display: "inline-block", paddingX: "xs", paddingY: "2xs", background: "bg.muted", borderRadius: "sm", children: /* @__PURE__ */ o(le, { as: "span", textStyle: "label/S/regular", color: "fg.muted", children: u }) }), e[3] = u, e[4] = f) : f = e[4], f;
324
+ }
325
+ const d = i ?? void 0;
326
+ let c;
327
+ return e[5] !== r || e[6] !== l || e[7] !== a || e[8] !== d ? (c = /* @__PURE__ */ o(Yn, { src: a, alt: r, title: d, loading: "lazy", referrerPolicy: "no-referrer", onLoad: l }), e[5] = r, e[6] = l, e[7] = a, e[8] = d, e[9] = c) : c = e[9], c;
328
+ };
329
+ class qe extends Me {
330
+ __source;
331
+ __alt;
332
+ __title;
333
+ static getType() {
334
+ return "markdown-image";
335
+ }
336
+ static clone(e) {
337
+ return new qe(e.__source, e.__alt, e.__title, e.__key);
338
+ }
339
+ constructor(e, n, r = null, i) {
340
+ super(i), this.__source = e, this.__alt = n, this.__title = r;
341
+ }
342
+ createDOM() {
343
+ return document.createElement("span");
344
+ }
345
+ updateDOM() {
346
+ return !1;
347
+ }
348
+ isInline() {
349
+ return !0;
350
+ }
351
+ getSource() {
352
+ return this.__source;
353
+ }
354
+ getAlt() {
355
+ return this.__alt;
356
+ }
357
+ getTitle() {
358
+ return this.__title;
359
+ }
360
+ getTextContent() {
361
+ return this.__alt;
362
+ }
363
+ exportJSON() {
364
+ return {
365
+ type: "markdown-image",
366
+ version: 1,
367
+ source: this.__source,
368
+ alt: this.__alt,
369
+ title: this.__title
370
+ };
371
+ }
372
+ static importJSON(e) {
373
+ return nt(e.source, e.alt, e.title);
374
+ }
375
+ decorate(e) {
376
+ const n = () => {
377
+ if (!e.isEditable()) return;
378
+ let r = null;
379
+ e.getEditorState().read(() => {
380
+ const l = se(), s = He(this.getKey());
381
+ if (!ee(l) || !l.isCollapsed() || !s) return;
382
+ const d = s.getTopLevelElement()?.getNextSibling()?.getKey(), c = l.anchor.getNode().getTopLevelElement();
383
+ d && d === c?.getKey() && (r = d);
384
+ });
385
+ const i = r;
386
+ i && requestAnimationFrame(() => {
387
+ e.getElementByKey(i)?.scrollIntoView({
388
+ block: "end"
389
+ });
390
+ });
391
+ };
392
+ return /* @__PURE__ */ o(bn, { source: this.__source, alt: this.__alt, title: this.__title, onLoad: n });
393
+ }
394
+ }
395
+ const nt = (t, e, n = null) => Oe(new qe(t, e, n)), _i = (t) => t instanceof qe, yt = (t, e) => at(t, "link", e) ?? "about:blank";
396
+ class Ke extends St {
397
+ __source;
398
+ static getType() {
399
+ return "markdown-link";
400
+ }
401
+ static clone(e) {
402
+ return new Ke(e.__source, e.__url, {
403
+ rel: e.__rel,
404
+ target: e.__target,
405
+ title: e.__title
406
+ }, e.__key);
407
+ }
408
+ constructor(e = "", n, r, i) {
409
+ super(n ?? yt(e), r, i), this.__source = e;
410
+ }
411
+ getSource() {
412
+ return this.__source;
413
+ }
414
+ setURL(e) {
415
+ const n = this.getWritable();
416
+ return n.__source = e, n.__url = yt(e), n;
417
+ }
418
+ exportJSON() {
419
+ return {
420
+ ...super.exportJSON(),
421
+ source: this.__source,
422
+ type: "markdown-link",
423
+ version: 1
424
+ };
425
+ }
426
+ static importJSON(e) {
427
+ return xt(e.source, void 0, {
428
+ rel: e.rel,
429
+ target: e.target,
430
+ title: e.title
431
+ });
432
+ }
433
+ }
434
+ const xt = (t, e, n) => Oe(new Ke(t, yt(t, e), n)), bi = (t) => t instanceof Ke, kn = (t) => /^<!--[\s\S]*-->$/.test(t.trim()), ki = (t, e) => {
435
+ if (typeof document > "u") return null;
436
+ const n = Tr.sanitize(t, {
437
+ FORBID_TAGS: ["script", "style", "iframe", "object", "embed", "form", "input", "button", "textarea", "select"]
438
+ }), r = document.createElement("template");
439
+ r.innerHTML = n;
440
+ for (const i of r.content.querySelectorAll("[href], [src]")) {
441
+ const l = i.hasAttribute("href") ? "href" : "src", s = l === "href" ? "link" : "image", m = i.getAttribute(l) ?? "", a = at(m, s, e);
442
+ a ? i.setAttribute(l, a) : i.removeAttribute(l);
443
+ }
444
+ return r.content;
445
+ }, yn = (t) => {
446
+ const e = F(7), {
447
+ source: n,
448
+ display: r
449
+ } = t, i = Rt(), l = me(null);
450
+ let s;
451
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = (u) => {
452
+ l.current = u;
453
+ }, e[0] = s) : s = e[0];
454
+ const m = s;
455
+ let a, d;
456
+ if (e[1] !== i || e[2] !== n ? (a = () => {
457
+ const u = ki(n, i), f = l.current;
458
+ f && f.replaceChildren(u ? u.cloneNode(!0) : document.createTextNode(""));
459
+ }, d = [i, n], e[1] = i, e[2] = n, e[3] = a, e[4] = d) : (a = e[3], d = e[4]), q(a, d), kn(n))
460
+ return null;
461
+ if (r === "inline") {
462
+ let u;
463
+ return e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ o("span", { ref: m }), e[5] = u) : u = e[5], u;
464
+ }
465
+ let c;
466
+ return e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ o("div", { ref: m }), e[6] = c) : c = e[6], c;
467
+ };
468
+ class We extends Me {
469
+ __source;
470
+ __display;
471
+ static getType() {
472
+ return "raw-html";
473
+ }
474
+ static clone(e) {
475
+ return new We(e.__source, e.__display, e.__key);
476
+ }
477
+ constructor(e, n, r) {
478
+ super(r), this.__source = e, this.__display = n;
479
+ }
480
+ createDOM() {
481
+ return document.createElement(this.__display === "inline" ? "span" : "div");
482
+ }
483
+ updateDOM(e) {
484
+ return e.__display !== this.__display;
485
+ }
486
+ isInline() {
487
+ return this.__display === "inline";
488
+ }
489
+ getSource() {
490
+ return this.__source;
491
+ }
492
+ getDisplay() {
493
+ return this.__display;
494
+ }
495
+ getTextContent() {
496
+ return kn(this.__source) ? "" : this.__source;
497
+ }
498
+ exportJSON() {
499
+ return {
500
+ type: "raw-html",
501
+ version: 1,
502
+ source: this.__source,
503
+ display: this.__display
504
+ };
505
+ }
506
+ static importJSON(e) {
507
+ return $t(e.source, e.display);
508
+ }
509
+ decorate() {
510
+ return /* @__PURE__ */ o(yn, { source: this.__source, display: this.__display });
511
+ }
512
+ }
513
+ const $t = (t, e) => Oe(new We(t, e)), xn = (t) => t instanceof We, yi = sr.lazy(() => import("./EquationComponent-DeDYHvqY.js"));
514
+ function zt(t) {
515
+ let e = t.getAttribute("data-lexical-equation");
516
+ const n = t.getAttribute("data-lexical-inline") === "true";
517
+ return e = atob(e || ""), e ? {
518
+ node: Ae(e, n)
519
+ } : null;
520
+ }
521
+ class Ie extends Me {
522
+ __equation;
523
+ __inline;
524
+ static getType() {
525
+ return "equation";
526
+ }
527
+ static clone(e) {
528
+ return new Ie(e.__equation, e.__inline, e.__key);
529
+ }
530
+ constructor(e, n, r) {
531
+ super(r), this.__equation = e, this.__inline = n ?? !1;
532
+ }
533
+ static importJSON(e) {
534
+ return Ae(e.equation, e.inline);
535
+ }
536
+ exportJSON() {
537
+ return {
538
+ equation: this.getEquation(),
539
+ inline: this.__inline,
540
+ type: "equation",
541
+ version: 1
542
+ };
543
+ }
544
+ createDOM(e) {
545
+ const n = document.createElement(this.__inline ? "span" : "div");
546
+ return n.className = "editor-equation", n;
547
+ }
548
+ exportDOM() {
549
+ const e = document.createElement(this.__inline ? "span" : "div"), n = btoa(this.__equation);
550
+ return e.setAttribute("data-lexical-equation", n), e.setAttribute("data-lexical-inline", `${this.__inline}`), wr.render(this.__equation, e, {
551
+ displayMode: !this.__inline,
552
+ // true === block display //
553
+ errorColor: "#cc0000",
554
+ output: "html",
555
+ strict: "warn",
556
+ throwOnError: !1,
557
+ trust: !1
558
+ }), {
559
+ element: e
560
+ };
561
+ }
562
+ static importDOM() {
563
+ return {
564
+ div: (e) => e.hasAttribute("data-lexical-equation") ? {
565
+ conversion: zt,
566
+ priority: 2
567
+ } : null,
568
+ span: (e) => e.hasAttribute("data-lexical-equation") ? {
569
+ conversion: zt,
570
+ priority: 1
571
+ } : null
572
+ };
573
+ }
574
+ updateDOM(e) {
575
+ return this.__inline !== e.__inline;
576
+ }
577
+ getTextContent() {
578
+ return this.__equation;
579
+ }
580
+ getEquation() {
581
+ return this.__equation;
582
+ }
583
+ setEquation(e) {
584
+ const n = this.getWritable();
585
+ n.__equation = e;
586
+ }
587
+ isInline() {
588
+ return this.__inline;
589
+ }
590
+ decorate() {
591
+ return /* @__PURE__ */ o(un, { fallback: null, children: /* @__PURE__ */ o(yi, { equation: this.__equation, inline: this.__inline }) });
592
+ }
593
+ }
594
+ function Ae(t = "", e = !1) {
595
+ const n = new Ie(t, e);
596
+ return Oe(n);
597
+ }
598
+ function ct(t) {
599
+ return t instanceof Ie;
600
+ }
601
+ class De extends Zn {
602
+ static getType() {
603
+ return "hr";
604
+ }
605
+ static clone(e) {
606
+ return new De(e?.__key);
607
+ }
608
+ static importJSON(e) {
609
+ return Mt();
610
+ }
611
+ exportJSON() {
612
+ return {
613
+ ...super.exportJSON()
614
+ };
615
+ }
616
+ createDOM(e, n) {
617
+ const r = document.createElement("hr");
618
+ return r.style = "margin: 2rem 0;", r;
619
+ }
620
+ updateDOM(e, n, r) {
621
+ return !1;
622
+ }
623
+ decorate(e) {
624
+ return null;
625
+ }
626
+ }
627
+ function Mt() {
628
+ return new De();
629
+ }
630
+ function Cn(t) {
631
+ return t instanceof De;
632
+ }
633
+ const xi = ur(() => import("./MermaidComponent-AmAjWLPm.js"));
634
+ class Le extends Me {
635
+ __code;
636
+ static getType() {
637
+ return "mermaid";
638
+ }
639
+ static clone(e) {
640
+ return new Le(e.__code, e.__key);
641
+ }
642
+ constructor(e, n) {
643
+ super(n), this.__code = e;
644
+ }
645
+ createDOM() {
646
+ return document.createElement("div");
647
+ }
648
+ updateDOM() {
649
+ return !1;
650
+ }
651
+ static importJSON(e) {
652
+ return new Le(e.code);
653
+ }
654
+ exportJSON() {
655
+ return {
656
+ type: "mermaid",
657
+ code: this.__code,
658
+ version: 1
659
+ };
660
+ }
661
+ getTextContent() {
662
+ return `\`\`\`mermaid
663
+ ${this.__code}
664
+ \`\`\``;
665
+ }
666
+ getCode() {
667
+ return this.__code;
668
+ }
669
+ setCode(e) {
670
+ const n = this.getWritable();
671
+ n.__code = e;
672
+ }
673
+ decorate() {
674
+ return /* @__PURE__ */ o(un, { fallback: null, children: /* @__PURE__ */ o(xi, { code: this.__code, nodeKey: this.__key }) });
675
+ }
676
+ }
677
+ function Ci(t) {
678
+ return t instanceof Le;
679
+ }
680
+ function vi(t) {
681
+ return Oe(new Le(t));
682
+ }
683
+ const Ei = (t) => {
684
+ let e = t.hasFormat("code") ? {
685
+ type: "inlineCode",
686
+ value: t.getTextContent()
687
+ } : {
688
+ type: "text",
689
+ value: t.getTextContent()
690
+ };
691
+ return t.hasFormat("code") || (t.hasFormat("bold") && (e = {
692
+ type: "strong",
693
+ children: [e]
694
+ }), t.hasFormat("italic") && (e = {
695
+ type: "emphasis",
696
+ children: [e]
697
+ }), t.hasFormat("strikethrough") && (e = {
698
+ type: "delete",
699
+ children: [e]
700
+ })), t.hasFormat("underline") ? [{
701
+ type: "html",
702
+ value: "<ins>"
703
+ }, e, {
704
+ type: "html",
705
+ value: "</ins>"
706
+ }] : [e];
707
+ }, vn = (t) => {
708
+ if (_t(t)) return Ei(t);
709
+ if (rn(t)) return [{
710
+ type: "break"
711
+ }];
712
+ if (_i(t))
713
+ return [{
714
+ type: "image",
715
+ url: t.getSource(),
716
+ alt: t.getAlt(),
717
+ title: t.getTitle()
718
+ }];
719
+ if (ct(t) && t.isInline()) return [{
720
+ type: "inlineMath",
721
+ value: t.getEquation()
722
+ }];
723
+ if (xn(t)) return [{
724
+ type: "html",
725
+ value: t.getSource()
726
+ }];
727
+ if (mn(t)) return [{
728
+ type: "text",
729
+ value: t.getTextContent()
730
+ }];
731
+ if (he(t))
732
+ return [{
733
+ type: "link",
734
+ url: bi(t) ? t.getSource() : t.getURL(),
735
+ title: t.getTitle(),
736
+ children: rt(t)
737
+ }];
738
+ if (nn(t)) return rt(t);
739
+ const e = t.getTextContent();
740
+ return e ? [{
741
+ type: "text",
742
+ value: e
743
+ }] : [];
744
+ }, rt = (t) => t.getChildren().flatMap(vn), Ct = (t) => ({
745
+ type: "paragraph",
746
+ children: rt(t)
747
+ }), Si = (t) => {
748
+ const e = [], n = [];
749
+ for (const r of t.getChildren())
750
+ Be(r) ? (n.length && e.push({
751
+ type: "paragraph",
752
+ children: n.splice(0)
753
+ }), e.push(En(r))) : ot(r) ? (n.length && e.push({
754
+ type: "paragraph",
755
+ children: n.splice(0)
756
+ }), e.push(Ct(r))) : n.push(...vn(r));
757
+ return (n.length || e.length === 0) && e.unshift({
758
+ type: "paragraph",
759
+ children: n
760
+ }), {
761
+ type: "listItem",
762
+ checked: t.getChecked(),
763
+ spread: !1,
764
+ children: e
765
+ };
766
+ }, En = (t) => ({
767
+ type: "list",
768
+ ordered: t.getListType() === "number",
769
+ start: t.getListType() === "number" ? t.getStart() : null,
770
+ spread: !1,
771
+ children: t.getChildren().filter(Mn).map(Si)
772
+ }), Ht = (t) => ({
773
+ type: "tableCell",
774
+ children: pn(t)
775
+ }), Ti = (t) => {
776
+ const e = t.getTable();
777
+ return {
778
+ type: "table",
779
+ align: e.columns.map((n) => n.alignment),
780
+ children: [{
781
+ type: "tableRow",
782
+ children: e.columns.map((n) => Ht(n.label))
783
+ }, ...e.rows.map((n) => ({
784
+ type: "tableRow",
785
+ children: e.columns.map((r) => Ht(n.cells[r.id] ?? ""))
786
+ }))]
787
+ };
788
+ }, Sn = (t) => {
789
+ if (ot(t)) return Ct(t);
790
+ if (Qt(t))
791
+ return {
792
+ type: "heading",
793
+ depth: Number(t.getTag().slice(1)),
794
+ children: rt(t)
795
+ };
796
+ if (Wn(t))
797
+ return {
798
+ type: "blockquote",
799
+ children: t.getChildren().map(Sn).filter((n) => n !== null)
800
+ };
801
+ if (Be(t)) return En(t);
802
+ if (et(t))
803
+ return {
804
+ type: "code",
805
+ lang: t.getLanguage() || null,
806
+ meta: null,
807
+ value: t.getTextContent()
808
+ };
809
+ if (Ci(t)) return {
810
+ type: "code",
811
+ lang: "mermaid",
812
+ meta: null,
813
+ value: t.getCode()
814
+ };
815
+ if (ct(t)) return {
816
+ type: "math",
817
+ meta: null,
818
+ value: t.getEquation()
819
+ };
820
+ if (Cn(t)) return {
821
+ type: "thematicBreak"
822
+ };
823
+ if (Et(t)) return Ti(t);
824
+ if (xn(t)) return {
825
+ type: "html",
826
+ value: t.getSource()
827
+ };
828
+ if (nn(t)) return Ct(t);
829
+ const e = t.getTextContent();
830
+ return e ? {
831
+ type: "paragraph",
832
+ children: [{
833
+ type: "text",
834
+ value: e
835
+ }]
836
+ } : null;
837
+ }, wi = (t) => {
838
+ const e = {
839
+ type: "root",
840
+ children: t.getChildren().map(Sn).filter((n) => n !== null)
841
+ };
842
+ return hn(e);
843
+ }, Ni = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/g, Se = (t, e) => {
844
+ const n = Ee(t);
845
+ for (const r of e) n.toggleFormat(r);
846
+ return n;
847
+ }, Li = (t, e) => {
848
+ const n = [];
849
+ let r = 0;
850
+ for (const i of t.matchAll(Ni)) {
851
+ const l = i.index ?? 0;
852
+ l > r && n.push(Se(t.slice(r, l), e));
853
+ const s = i[2] ?? "", m = /^(?:https?:\/\/|\/)/i.test(s) ? s : `#${s}`;
854
+ n.push(Lt(m, s)), r = l + i[0].length;
855
+ }
856
+ return r < t.length && n.push(Se(t.slice(r), e)), n;
857
+ }, qt = (t, e) => e.definitions.get(t.identifier.toLowerCase());
858
+ function Ii(t, e, n) {
859
+ switch (t.type) {
860
+ case "text":
861
+ return Li(t.value, n);
862
+ case "strong":
863
+ return ve(t.children, e, /* @__PURE__ */ new Set([...n, "bold"]));
864
+ case "emphasis":
865
+ return ve(t.children, e, /* @__PURE__ */ new Set([...n, "italic"]));
866
+ case "delete":
867
+ return ve(t.children, e, /* @__PURE__ */ new Set([...n, "strikethrough"]));
868
+ case "inlineCode":
869
+ return [Se(t.value, /* @__PURE__ */ new Set([...n, "code"]))];
870
+ case "break":
871
+ return [er()];
872
+ case "link": {
873
+ const r = xt(t.url, e.resolver, {
874
+ title: t.title
875
+ });
876
+ return r.append(...ve(t.children, e, n)), [r];
877
+ }
878
+ case "linkReference": {
879
+ const r = qt(t, e);
880
+ if (!r) return [Se(Fe([t]), n)];
881
+ const i = xt(r.url, e.resolver, {
882
+ title: r.title
883
+ });
884
+ return i.append(...ve(t.children, e, n)), [i];
885
+ }
886
+ case "image":
887
+ return [nt(t.url, t.alt ?? "", t.title ?? null)];
888
+ case "imageReference": {
889
+ const r = qt(t, e);
890
+ return r ? [nt(r.url, t.alt ?? "", r.title ?? null)] : [Se(Fe([t]), n)];
891
+ }
892
+ case "inlineMath":
893
+ return [Ae(t.value, !0)];
894
+ case "html":
895
+ return [$t(t.value, "inline")];
896
+ default:
897
+ return [Se(Fe([t]), n)];
898
+ }
899
+ }
900
+ function ve(t, e, n = /* @__PURE__ */ new Set()) {
901
+ const r = [];
902
+ let i = 0;
903
+ for (const l of t) {
904
+ if (l.type === "html" && /^<(?:ins|u)>$/i.test(l.value.trim())) {
905
+ i += 1;
906
+ continue;
907
+ }
908
+ if (l.type === "html" && /^<\/(?:ins|u)>$/i.test(l.value.trim())) {
909
+ i = Math.max(i - 1, 0);
910
+ continue;
911
+ }
912
+ const s = new Set(n);
913
+ i > 0 && s.add("underline"), r.push(...Ii(l, e, s));
914
+ }
915
+ return r;
916
+ }
917
+ const Ri = (t, e) => {
918
+ e.tableIndex += 1;
919
+ const n = `table-${e.tableIndex}`, r = t.children[0], i = Math.max(r?.children.length ?? 0, 1), l = Array.from({
920
+ length: i
921
+ }, (m, a) => ({
922
+ id: `${n}-column-${a + 1}`,
923
+ label: r?.children[a] ? Fe(r.children[a].children) : "",
924
+ alignment: t.align?.[a] ?? null
925
+ })), s = t.children.slice(1).map((m, a) => ({
926
+ id: `${n}-row-${a + 1}`,
927
+ cells: Object.fromEntries(l.map((d, c) => [d.id, m.children[c] ? Fe(m.children[c].children) : ""]))
928
+ }));
929
+ return {
930
+ columns: l,
931
+ rows: s
932
+ };
933
+ }, $i = (t, e, n) => {
934
+ if (e.type !== "listItem") return;
935
+ const r = An(e.checked ?? void 0);
936
+ t.append(r);
937
+ for (const i of e.children)
938
+ i.type === "paragraph" ? r.append(...ve(i.children, n)) : i.type === "list" ? Ot(r, i, n) : r.append(Se(It(i), /* @__PURE__ */ new Set()));
939
+ }, Ot = (t, e, n) => {
940
+ switch (e.type) {
941
+ case "paragraph": {
942
+ const r = we();
943
+ r.append(...ve(e.children, n)), t.append(r);
944
+ break;
945
+ }
946
+ case "heading": {
947
+ const r = Yt(`h${e.depth}`);
948
+ r.append(...ve(e.children, n)), t.append(r);
949
+ break;
950
+ }
951
+ case "blockquote": {
952
+ const r = Vt();
953
+ t.append(r);
954
+ for (const i of e.children) Ot(r, i, n);
955
+ break;
956
+ }
957
+ case "list": {
958
+ const r = e.children.some((s) => s.checked !== null && s.checked !== void 0);
959
+ let i = "bullet";
960
+ e.ordered ? i = "number" : r && (i = "check");
961
+ const l = On(i, e.start ?? 1);
962
+ t.append(l);
963
+ for (const s of e.children) $i(l, s, n);
964
+ break;
965
+ }
966
+ case "code":
967
+ t.append(e.lang === "mermaid" ? vi(e.value) : Xt(e.lang ?? void 0).append(Ee(e.value)));
968
+ break;
969
+ case "math":
970
+ t.append(Ae(e.value, !1));
971
+ break;
972
+ case "thematicBreak":
973
+ t.append(Mt());
974
+ break;
975
+ case "table":
976
+ t.append(At(Ri(e, n)));
977
+ break;
978
+ case "html":
979
+ t.append($t(e.value, "block"));
980
+ break;
981
+ case "definition":
982
+ break;
983
+ default: {
984
+ const r = we();
985
+ r.append(Ee(It(e))), t.append(r);
986
+ }
987
+ }
988
+ }, Mi = (t, e) => {
989
+ const n = fn(t), i = {
990
+ definitions: new Map(n.children.filter((s) => s.type === "definition").map((s) => [s.identifier.toLowerCase(), s])),
991
+ resolver: e,
992
+ tableIndex: 0
993
+ }, l = on();
994
+ l.clear();
995
+ for (const s of n.children) Ot(l, s, i);
996
+ };
997
+ function dt(t) {
998
+ const e = se();
999
+ if (!ee(e))
1000
+ return null;
1001
+ const n = e.anchor.getNode(), r = et(n) ? n : ae(n, (l) => et(l));
1002
+ if (!et(r))
1003
+ return null;
1004
+ const i = t.getElementByKey(r.getKey());
1005
+ return i instanceof HTMLElement ? i : null;
1006
+ }
1007
+ function Oi(t) {
1008
+ return t instanceof HTMLElement ? t.closest(".rich-text__code") : null;
1009
+ }
1010
+ function Ai(t, e) {
1011
+ const n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
1012
+ return {
1013
+ top: r.top - n.top + 6,
1014
+ left: r.right - n.left - 30
1015
+ };
1016
+ }
1017
+ function Di(t) {
1018
+ const e = F(31), {
1019
+ anchorElem: n
1020
+ } = t, [r] = fe(), [i, l] = B(null), [s, m] = B(!1), a = me(null);
1021
+ let d, c;
1022
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = () => () => {
1023
+ a.current !== null && window.clearTimeout(a.current);
1024
+ }, c = [], e[0] = d, e[1] = c) : (d = e[0], c = e[1]), q(d, c);
1025
+ let u, f;
1026
+ e[2] !== r ? (u = () => {
1027
+ const E = r.getRootElement();
1028
+ if (!E)
1029
+ return;
1030
+ const R = (M) => {
1031
+ const D = Oi(M.target);
1032
+ l(D instanceof HTMLElement ? D : null);
1033
+ }, I = () => {
1034
+ r.getEditorState().read(() => {
1035
+ const M = dt(r);
1036
+ l(M);
1037
+ });
1038
+ };
1039
+ return E.addEventListener("pointermove", R), E.addEventListener("pointerleave", I), () => {
1040
+ E.removeEventListener("pointermove", R), E.removeEventListener("pointerleave", I);
1041
+ };
1042
+ }, f = [r], e[2] = r, e[3] = u, e[4] = f) : (u = e[3], f = e[4]), q(u, f);
1043
+ let b, k;
1044
+ if (e[5] !== r ? (b = () => st(r.registerUpdateListener((E) => {
1045
+ const {
1046
+ editorState: R
1047
+ } = E;
1048
+ R.read(() => {
1049
+ const I = dt(r);
1050
+ I && l(I);
1051
+ });
1052
+ }), r.registerCommand(lt, () => (r.getEditorState().read(() => {
1053
+ const E = dt(r);
1054
+ if (!E) {
1055
+ l(Pi);
1056
+ return;
1057
+ }
1058
+ l(E);
1059
+ }), !1), Tt)), k = [r], e[5] = r, e[6] = b, e[7] = k) : (b = e[6], k = e[7]), q(b, k), !n || !i)
1060
+ return null;
1061
+ let x;
1062
+ e[8] !== i || e[9] !== n ? (x = Ai(n, i), e[8] = i, e[9] = n, e[10] = x) : x = e[10];
1063
+ const v = x;
1064
+ let p;
1065
+ e[11] !== v.left || e[12] !== v.top ? (p = {
1066
+ position: "absolute",
1067
+ top: v.top,
1068
+ left: v.left
1069
+ }, e[11] = v.left, e[12] = v.top, e[13] = p) : p = e[13];
1070
+ const g = p, L = s ? "Copied" : "Copy code", _ = s ? "Copied" : "Copy code";
1071
+ let C;
1072
+ e[14] !== i.textContent ? (C = async () => {
1073
+ const E = i.textContent ?? "";
1074
+ try {
1075
+ await navigator.clipboard.writeText(E), m(!0), a.current !== null && window.clearTimeout(a.current), a.current = window.setTimeout(() => {
1076
+ m(!1);
1077
+ }, 1200);
1078
+ } catch {
1079
+ m(!1);
1080
+ }
1081
+ }, e[14] = i.textContent, e[15] = C) : C = e[15];
1082
+ let S;
1083
+ e[16] !== s ? (S = s ? /* @__PURE__ */ o(dn, { size: 14 }) : /* @__PURE__ */ o(Lr, { size: 14 }), e[16] = s, e[17] = S) : S = e[17];
1084
+ let h;
1085
+ e[18] !== _ || e[19] !== C || e[20] !== S ? (h = /* @__PURE__ */ o(W, { "aria-label": _, variant: "subtle", size: "xs", onClick: C, children: S }), e[18] = _, e[19] = C, e[20] = S, e[21] = h) : h = e[21];
1086
+ let y;
1087
+ e[22] !== h || e[23] !== L ? (y = /* @__PURE__ */ o(j, { content: L, children: h }), e[22] = h, e[23] = L, e[24] = y) : y = e[24];
1088
+ let N;
1089
+ e[25] !== g || e[26] !== y ? (N = /* @__PURE__ */ o("div", { className: "code-block-actions", style: g, children: y }), e[25] = g, e[26] = y, e[27] = N) : N = e[27];
1090
+ let T;
1091
+ return e[28] !== n || e[29] !== N ? (T = Nt(N, n), e[28] = n, e[29] = N, e[30] = T) : T = e[30], T;
1092
+ }
1093
+ function Pi(t) {
1094
+ return t?.matches(":hover") ? t : null;
1095
+ }
1096
+ function Ui(t) {
1097
+ return t.trim().toLowerCase() === "mermaid";
1098
+ }
1099
+ function Bi(t) {
1100
+ const e = t.getLanguage() ?? "plaintext";
1101
+ return Ui(e) ? (t.replace(new Le(t.getTextContent())), !0) : !1;
1102
+ }
1103
+ function Fi() {
1104
+ const t = F(3), [e] = fe();
1105
+ let n, r;
1106
+ return t[0] !== e ? (n = () => {
1107
+ e.update(zi);
1108
+ }, r = [e], t[0] = e, t[1] = n, t[2] = r) : (n = t[1], r = t[2]), q(n, r), null;
1109
+ }
1110
+ function zi() {
1111
+ const t = tr(Zt);
1112
+ for (const e of t)
1113
+ Bi(e);
1114
+ }
1115
+ function Hi() {
1116
+ const t = F(3), [e] = fe();
1117
+ let n, r;
1118
+ return t[0] !== e ? (n = () => Gn(e), r = [e], t[0] = e, t[1] = n, t[2] = r) : (n = t[1], r = t[2]), q(n, r), null;
1119
+ }
1120
+ const qi = {
1121
+ dependencies: [Ie],
1122
+ export: (t) => ct(t) && t.isInline() ? `\\( ${t.getEquation().trim()} \\)` : null,
1123
+ importRegExp: /\\\((.*?)\\\)/,
1124
+ regExp: /\\\((.*?)\\\)/,
1125
+ replace: (t, e) => {
1126
+ const n = Ae(e[1].trim(), !0);
1127
+ t.replace(n);
1128
+ },
1129
+ type: "text-match"
1130
+ }, Ki = {
1131
+ dependencies: [Ie],
1132
+ regExpStart: /\\\[/,
1133
+ regExpEnd: /\\]/,
1134
+ export: (t) => ct(t) && !t.isInline() ? `\\[ ${t.getEquation().trim()} \\]` : null,
1135
+ replace: (t, e, n, r, i) => i ? (t.append(Ae(i.join(" "), !1)), !0) : !1,
1136
+ type: "multiline-element"
1137
+ };
1138
+ function Wi() {
1139
+ return null;
1140
+ }
1141
+ const Tn = nr("TOGGLE_LINK_EDIT_MODE_COMMAND");
1142
+ function je(t) {
1143
+ const e = t.anchor, n = t.focus, r = t.anchor.getNode(), i = t.focus.getNode();
1144
+ return r === i ? r : t.isBackward() ? Bt(n) ? r : i : Bt(e) ? r : i;
1145
+ }
1146
+ const ji = 10, Ji = 5;
1147
+ function it(t, e, n, r = ji, i = Ji, l = "legacy", s = "anchor") {
1148
+ const m = n.parentElement;
1149
+ if (t === null || !m) {
1150
+ e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)";
1151
+ return;
1152
+ }
1153
+ const a = e.getBoundingClientRect(), d = n.getBoundingClientRect(), c = s === "viewport" ? new DOMRect(0, 0, document.documentElement.clientWidth, document.documentElement.clientHeight) : m.getBoundingClientRect();
1154
+ let u = l === "above" ? t.top - a.height - r : t.top - r, f = t.left - i;
1155
+ u < c.top && (u = l === "above" ? t.bottom + r : u + a.height + t.height + r * 2), f + a.width > c.right && (f = c.right - a.width - i), u + a.height > c.bottom && (u = t.top - a.height - Math.abs(r)), s === "anchor" && (u -= d.top, f -= d.left), e.style.opacity = "1", e.style.transform = `translate(${f}px, ${u}px)`;
1156
+ }
1157
+ function mt() {
1158
+ const t = F(1);
1159
+ let e;
1160
+ return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ o("span", { style: {
1161
+ display: "inline-flex",
1162
+ height: "1rem",
1163
+ margin: "0 0.25rem",
1164
+ borderLeft: "1px solid var(--chakra-colors-border-subtle)"
1165
+ } }), t[0] = e) : e = t[0], e;
1166
+ }
1167
+ function Gi(t) {
1168
+ const e = F(88), {
1169
+ editor: n,
1170
+ blockType: r,
1171
+ isBold: i,
1172
+ isItalic: l,
1173
+ isUnderline: s,
1174
+ isCode: m,
1175
+ isLink: a,
1176
+ formatHeading: d,
1177
+ formatList: c,
1178
+ formatQuote: u,
1179
+ insertLink: f
1180
+ } = t, b = i || void 0;
1181
+ let k;
1182
+ e[0] !== n ? (k = () => n.dispatchCommand(Ye, "bold"), e[0] = n, e[1] = k) : k = e[1];
1183
+ let x;
1184
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ o(le, { fontWeight: "bold", fontSize: ".75rem", children: "B" }), e[2] = x) : x = e[2];
1185
+ let v;
1186
+ e[3] !== b || e[4] !== k ? (v = /* @__PURE__ */ o(j, { content: "Bold", children: /* @__PURE__ */ o(W, { "data-active": b, onClick: k, variant: "ghost", "aria-label": "Bold", size: "xs", children: x }) }), e[3] = b, e[4] = k, e[5] = v) : v = e[5];
1187
+ const p = l || void 0;
1188
+ let g;
1189
+ e[6] !== n ? (g = () => n.dispatchCommand(Ye, "italic"), e[6] = n, e[7] = g) : g = e[7];
1190
+ let L;
1191
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ o(le, { fontStyle: "italic", fontSize: ".75rem", children: "I" }), e[8] = L) : L = e[8];
1192
+ let _;
1193
+ e[9] !== p || e[10] !== g ? (_ = /* @__PURE__ */ o(j, { content: "Italic", children: /* @__PURE__ */ o(W, { "data-active": p, onClick: g, variant: "ghost", "aria-label": "Italic", size: "xs", children: L }) }), e[9] = p, e[10] = g, e[11] = _) : _ = e[11];
1194
+ const C = s || void 0;
1195
+ let S;
1196
+ e[12] !== n ? (S = () => n.dispatchCommand(Ye, "underline"), e[12] = n, e[13] = S) : S = e[13];
1197
+ let h;
1198
+ e[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ o(le, { textDecoration: "underline", fontSize: ".75rem", children: "U" }), e[14] = h) : h = e[14];
1199
+ let y;
1200
+ e[15] !== C || e[16] !== S ? (y = /* @__PURE__ */ o(j, { content: "Underline", children: /* @__PURE__ */ o(W, { "data-active": C, onClick: S, variant: "ghost", "aria-label": "Underline", size: "xs", children: h }) }), e[15] = C, e[16] = S, e[17] = y) : y = e[17];
1201
+ let N;
1202
+ e[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ o(mt, {}), e[18] = N) : N = e[18];
1203
+ const T = r === "h1" || void 0;
1204
+ let E;
1205
+ e[19] !== d ? (E = () => d("h1"), e[19] = d, e[20] = E) : E = e[20];
1206
+ let R;
1207
+ e[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ o(le, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }), e[21] = R) : R = e[21];
1208
+ let I;
1209
+ e[22] !== T || e[23] !== E ? (I = /* @__PURE__ */ o(j, { content: "Heading 1", children: /* @__PURE__ */ o(W, { "data-active": T, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: E, children: R }) }), e[22] = T, e[23] = E, e[24] = I) : I = e[24];
1210
+ const M = r === "h2" || void 0;
1211
+ let D;
1212
+ e[25] !== d ? (D = () => d("h2"), e[25] = d, e[26] = D) : D = e[26];
1213
+ let z;
1214
+ e[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (z = /* @__PURE__ */ o(le, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }), e[27] = z) : z = e[27];
1215
+ let U;
1216
+ e[28] !== M || e[29] !== D ? (U = /* @__PURE__ */ o(j, { content: "Heading 2", children: /* @__PURE__ */ o(W, { "data-active": M, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: D, children: z }) }), e[28] = M, e[29] = D, e[30] = U) : U = e[30];
1217
+ const w = r === "h3" || void 0;
1218
+ let $;
1219
+ e[31] !== d ? ($ = () => d("h3"), e[31] = d, e[32] = $) : $ = e[32];
1220
+ let A;
1221
+ e[33] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ o(le, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }), e[33] = A) : A = e[33];
1222
+ let P;
1223
+ e[34] !== w || e[35] !== $ ? (P = /* @__PURE__ */ o(j, { content: "Heading 3", children: /* @__PURE__ */ o(W, { "data-active": w, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: $, children: A }) }), e[34] = w, e[35] = $, e[36] = P) : P = e[36];
1224
+ let O;
1225
+ e[37] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ o(mt, {}), e[37] = O) : O = e[37];
1226
+ const H = m || void 0;
1227
+ let K;
1228
+ e[38] !== n ? (K = () => n.dispatchCommand(Ye, "code"), e[38] = n, e[39] = K) : K = e[39];
1229
+ let Z;
1230
+ e[40] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ o(Ir, { size: 14 }), e[40] = Z) : Z = e[40];
1231
+ let J;
1232
+ e[41] !== H || e[42] !== K ? (J = /* @__PURE__ */ o(j, { content: "Inline Code", children: /* @__PURE__ */ o(W, { "data-active": H, onClick: K, variant: "ghost", "aria-label": "Inline Code", size: "xs", children: Z }) }), e[41] = H, e[42] = K, e[43] = J) : J = e[43];
1233
+ const pe = a ? "Remove Link" : "Insert Link", ge = a || void 0, _e = a ? "Remove Link" : "Insert Link";
1234
+ let te;
1235
+ e[44] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (te = /* @__PURE__ */ o(Rr, { size: 14 }), e[44] = te) : te = e[44];
1236
+ let ne;
1237
+ e[45] !== f || e[46] !== ge || e[47] !== _e ? (ne = /* @__PURE__ */ o(W, { "data-active": ge, variant: "ghost", "aria-label": _e, size: "xs", onClick: f, children: te }), e[45] = f, e[46] = ge, e[47] = _e, e[48] = ne) : ne = e[48];
1238
+ let Q;
1239
+ e[49] !== pe || e[50] !== ne ? (Q = /* @__PURE__ */ o(j, { content: pe, children: ne }), e[49] = pe, e[50] = ne, e[51] = Q) : Q = e[51];
1240
+ const ue = r === "quote" || void 0;
1241
+ let re;
1242
+ e[52] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (re = /* @__PURE__ */ o($r, { size: 14 }), e[52] = re) : re = e[52];
1243
+ let V;
1244
+ e[53] !== u || e[54] !== ue ? (V = /* @__PURE__ */ o(j, { content: "Quote", children: /* @__PURE__ */ o(W, { "data-active": ue, variant: "ghost", "aria-label": "Quote", size: "xs", onClick: u, children: re }) }), e[53] = u, e[54] = ue, e[55] = V) : V = e[55];
1245
+ let ie;
1246
+ e[56] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ie = /* @__PURE__ */ o(mt, {}), e[56] = ie) : ie = e[56];
1247
+ const de = r === "bullet" || void 0;
1248
+ let Y;
1249
+ e[57] !== c ? (Y = () => c("bullet"), e[57] = c, e[58] = Y) : Y = e[58];
1250
+ let oe;
1251
+ e[59] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (oe = /* @__PURE__ */ o(Mr, { size: 14 }), e[59] = oe) : oe = e[59];
1252
+ let X;
1253
+ e[60] !== de || e[61] !== Y ? (X = /* @__PURE__ */ o(j, { content: "Bulleted List", children: /* @__PURE__ */ o(W, { "data-active": de, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: Y, children: oe }) }), e[60] = de, e[61] = Y, e[62] = X) : X = e[62];
1254
+ const be = r === "number" || void 0;
1255
+ let ke;
1256
+ e[63] !== c ? (ke = () => c("number"), e[63] = c, e[64] = ke) : ke = e[64];
1257
+ let Pe;
1258
+ e[65] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Pe = /* @__PURE__ */ o(Or, { size: 14 }), e[65] = Pe) : Pe = e[65];
1259
+ let ye;
1260
+ e[66] !== be || e[67] !== ke ? (ye = /* @__PURE__ */ o(j, { content: "Numbered List", children: /* @__PURE__ */ o(W, { "data-active": be, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: ke, children: Pe }) }), e[66] = be, e[67] = ke, e[68] = ye) : ye = e[68];
1261
+ const Ue = r === "check" || void 0;
1262
+ let xe;
1263
+ e[69] !== c ? (xe = () => c("check"), e[69] = c, e[70] = xe) : xe = e[70];
1264
+ let Ge;
1265
+ e[71] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ge = /* @__PURE__ */ o(Ar, { size: 14 }), e[71] = Ge) : Ge = e[71];
1266
+ let Re;
1267
+ e[72] !== Ue || e[73] !== xe ? (Re = /* @__PURE__ */ o(j, { content: "Check List", children: /* @__PURE__ */ o(W, { "data-active": Ue, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: xe, children: Ge }) }), e[72] = Ue, e[73] = xe, e[74] = Re) : Re = e[74];
1268
+ let Qe;
1269
+ return e[75] !== y || e[76] !== I || e[77] !== U || e[78] !== P || e[79] !== J || e[80] !== v || e[81] !== Q || e[82] !== V || e[83] !== X || e[84] !== ye || e[85] !== Re || e[86] !== _ ? (Qe = /* @__PURE__ */ G(pt, { direction: "row", gap: "0.5", alignItems: "center", children: [
1270
+ v,
1271
+ _,
1272
+ y,
1273
+ N,
1274
+ I,
1275
+ U,
1276
+ P,
1277
+ O,
1278
+ J,
1279
+ Q,
1280
+ V,
1281
+ ie,
1282
+ X,
1283
+ ye,
1284
+ Re
1285
+ ] }), e[75] = y, e[76] = I, e[77] = U, e[78] = P, e[79] = J, e[80] = v, e[81] = Q, e[82] = V, e[83] = X, e[84] = ye, e[85] = Re, e[86] = _, e[87] = Qe) : Qe = e[87], Qe;
1286
+ }
1287
+ const Qi = {
1288
+ bullet: "Bulleted List",
1289
+ check: "Check List",
1290
+ code: "Code Block",
1291
+ h1: "Heading 1",
1292
+ h2: "Heading 2",
1293
+ h3: "Heading 3",
1294
+ h4: "Heading 4",
1295
+ h5: "Heading 5",
1296
+ h6: "Heading 6",
1297
+ number: "Numbered List",
1298
+ paragraph: "Normal",
1299
+ quote: "Quote"
1300
+ }, Vi = (t) => t in Qi ? t : null, Yi = (t) => (t.getKey() === "root" ? t : ae(t, (n) => {
1301
+ const r = n.getParent();
1302
+ return r !== null && rr(r);
1303
+ })) ?? t.getTopLevelElementOrThrow(), Xi = (t) => {
1304
+ const e = Yi(t);
1305
+ if (Be(e))
1306
+ return e.getListType();
1307
+ const n = ae(t, (i) => Be(i));
1308
+ if (n !== null && Be(n))
1309
+ return n.getListType();
1310
+ const r = Qt(e) ? e.getTag() : e.getType();
1311
+ return Vi(r);
1312
+ };
1313
+ function Zi(t) {
1314
+ const {
1315
+ hasSelection: e,
1316
+ isRangeSelection: n,
1317
+ isCollapsed: r,
1318
+ hasNativeSelection: i,
1319
+ hasNativeRange: l,
1320
+ isAnchorInsideEditor: s,
1321
+ isEditorEditable: m
1322
+ } = t;
1323
+ return e && n && !r && i && l && s && m;
1324
+ }
1325
+ const eo = -4;
1326
+ function to({
1327
+ editor: t,
1328
+ anchorElem: e,
1329
+ isToolbarActive: n,
1330
+ setIsToolbarActive: r
1331
+ }) {
1332
+ const i = me(null), [l, s] = B("paragraph"), [m, a] = B(!1), [d, c] = B(!1), [u, f] = B(!1), [b, k] = B(!1), [x, v] = B(!1), p = me(() => {
1333
+ }), g = (h) => {
1334
+ t.update(() => {
1335
+ const y = se();
1336
+ if (ee(y)) {
1337
+ if (l === h) {
1338
+ Xe(y, we);
1339
+ return;
1340
+ }
1341
+ Xe(y, () => Yt(h));
1342
+ }
1343
+ });
1344
+ }, L = (h) => {
1345
+ if (l === h) {
1346
+ t.dispatchCommand(Dn, void 0);
1347
+ return;
1348
+ }
1349
+ const y = {
1350
+ bullet: Bn,
1351
+ number: Un,
1352
+ check: Pn
1353
+ }[h];
1354
+ t.dispatchCommand(y, void 0);
1355
+ }, _ = () => {
1356
+ t.update(() => {
1357
+ const h = se();
1358
+ if (ee(h)) {
1359
+ if (l === "quote") {
1360
+ Xe(h, we);
1361
+ return;
1362
+ }
1363
+ Xe(h, Vt);
1364
+ }
1365
+ });
1366
+ }, C = () => {
1367
+ if (x) {
1368
+ t.dispatchCommand(ht, null);
1369
+ return;
1370
+ }
1371
+ t.dispatchCommand(Tn, !0);
1372
+ }, S = () => {
1373
+ const h = se();
1374
+ if (!ee(h)) return;
1375
+ a(h.hasFormat("bold")), c(h.hasFormat("italic")), f(h.hasFormat("underline")), k(h.hasFormat("code"));
1376
+ const y = je(h), N = ae(y, he), T = ae(y, Te);
1377
+ v(N !== null || T !== null);
1378
+ const E = Xi(h.anchor.getNode());
1379
+ E && s(E);
1380
+ };
1381
+ return p.current = () => {
1382
+ const h = se(), y = i.current, N = window.getSelection();
1383
+ if (y === null)
1384
+ return;
1385
+ const T = t.getRootElement(), E = N !== null, R = E && N.rangeCount > 0, I = !!T?.contains(E ? N.anchorNode : null);
1386
+ if (Zi({
1387
+ hasSelection: h !== null,
1388
+ isRangeSelection: ee(h),
1389
+ isCollapsed: ee(h) ? h.isCollapsed() : !1,
1390
+ hasNativeSelection: E,
1391
+ hasNativeRange: R,
1392
+ isAnchorInsideEditor: I,
1393
+ isEditorEditable: t.isEditable()
1394
+ }) && N) {
1395
+ const M = N.getRangeAt(0).getBoundingClientRect();
1396
+ if (M) {
1397
+ const D = new DOMRect(M.left, M.bottom, 0, 0);
1398
+ it(D, y, e, eo, void 0, "legacy", "viewport");
1399
+ }
1400
+ r(!0);
1401
+ } else
1402
+ T !== null && it(null, y, e, void 0, void 0, "legacy", "viewport"), r(!1);
1403
+ return S(), !0;
1404
+ }, q(() => {
1405
+ const h = e.parentElement, y = () => {
1406
+ t.getEditorState().read(() => {
1407
+ p.current();
1408
+ });
1409
+ };
1410
+ return window.addEventListener("resize", y), h && h.addEventListener("scroll", y), () => {
1411
+ window.removeEventListener("resize", y), h && h.removeEventListener("scroll", y);
1412
+ };
1413
+ }, [e, t]), q(() => st(t.registerUpdateListener(({
1414
+ editorState: h
1415
+ }) => {
1416
+ h.read(() => {
1417
+ p.current();
1418
+ });
1419
+ }), t.registerCommand(lt, (h) => (p.current(), !1), Tt), t.registerCommand(ln, (h) => {
1420
+ const y = se();
1421
+ return ee(y) && p.current(), !1;
1422
+ }, wt)), [t]), /* @__PURE__ */ o(ce, { ref: i, zIndex: "tooltip", className: `floating-text-format-toolbar ${n ? "active" : ""}`, children: /* @__PURE__ */ o(Gi, { editor: t, blockType: l, isBold: m, isItalic: d, isUnderline: u, isCode: b, isLink: x, formatHeading: g, formatList: L, formatQuote: _, insertLink: C }) });
1423
+ }
1424
+ function no(t) {
1425
+ const e = F(4), {
1426
+ anchorElem: n
1427
+ } = t, r = n === void 0 ? document.body : n, [i] = fe(), [l, s] = B(!1);
1428
+ let m;
1429
+ return e[0] !== r || e[1] !== i || e[2] !== l ? (m = Nt(/* @__PURE__ */ o(to, { editor: i, anchorElem: r, isToolbarActive: l, setIsToolbarActive: s }), document.body), e[0] = r, e[1] = i, e[2] = l, e[3] = m) : m = e[3], m;
1430
+ }
1431
+ function ro(t) {
1432
+ const e = F(32), {
1433
+ isActive: n,
1434
+ isLinkEditMode: r,
1435
+ editedLinkUrl: i,
1436
+ editedLinkUrlIsValid: l,
1437
+ linkUrl: s,
1438
+ href: m,
1439
+ inputRef: a,
1440
+ onEditedLinkUrlChange: d,
1441
+ onInputKeyDown: c,
1442
+ onClose: u,
1443
+ onSubmit: f,
1444
+ onEdit: b,
1445
+ onRemove: k
1446
+ } = t;
1447
+ if (!n)
1448
+ return null;
1449
+ if (r) {
1450
+ const C = !l;
1451
+ let S;
1452
+ e[0] !== d ? (S = (M) => {
1453
+ d(M.target.value);
1454
+ }, e[0] = d, e[1] = S) : S = e[1];
1455
+ let h;
1456
+ e[2] !== i || e[3] !== a || e[4] !== c || e[5] !== C || e[6] !== S ? (h = /* @__PURE__ */ o(gt, { ref: a, className: "link-editor-url-field", size: "sm", fontSize: "sm", value: i, placeholder: "https://", "aria-label": "Link URL", "aria-invalid": C, onChange: S, onKeyDown: c }), e[2] = i, e[3] = a, e[4] = c, e[5] = C, e[6] = S, e[7] = h) : h = e[7];
1457
+ let y;
1458
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ o(Dr, { size: 14 }), e[8] = y) : y = e[8];
1459
+ let N;
1460
+ e[9] !== u ? (N = /* @__PURE__ */ o(j, { content: "Cancel", children: /* @__PURE__ */ o(W, { variant: "ghost", size: "xs", "aria-label": "Cancel link edit", onMouseDown: Ze, onClick: u, children: y }) }), e[9] = u, e[10] = N) : N = e[10];
1461
+ const T = !l;
1462
+ let E;
1463
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ o(dn, { size: 14 }), e[11] = E) : E = e[11];
1464
+ let R;
1465
+ e[12] !== f || e[13] !== T ? (R = /* @__PURE__ */ o(j, { content: "Confirm", children: /* @__PURE__ */ o(W, { variant: "ghost", size: "xs", "aria-label": "Confirm link edit", disabled: T, onMouseDown: Ze, onClick: f, children: E }) }), e[12] = f, e[13] = T, e[14] = R) : R = e[14];
1466
+ let I;
1467
+ return e[15] !== h || e[16] !== N || e[17] !== R ? (I = /* @__PURE__ */ G(pt, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
1468
+ h,
1469
+ N,
1470
+ R
1471
+ ] }), e[15] = h, e[16] = N, e[17] = R, e[18] = I) : I = e[18], I;
1472
+ }
1473
+ let x;
1474
+ e[19] !== m || e[20] !== s ? (x = /* @__PURE__ */ o(tn, { href: m, target: "_blank", rel: "noopener noreferrer", className: "link-editor-url-field", fontSize: "sm", textDecoration: "underline", px: "2", truncate: !0, children: s }), e[19] = m, e[20] = s, e[21] = x) : x = e[21];
1475
+ let v;
1476
+ e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ o(Pr, { size: 14 }), e[22] = v) : v = e[22];
1477
+ let p;
1478
+ e[23] !== b ? (p = /* @__PURE__ */ o(j, { content: "Edit link", children: /* @__PURE__ */ o(W, { variant: "ghost", size: "xs", "aria-label": "Edit link", onMouseDown: Ze, onClick: b, children: v }) }), e[23] = b, e[24] = p) : p = e[24];
1479
+ let g;
1480
+ e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ o(Ur, { size: 14 }), e[25] = g) : g = e[25];
1481
+ let L;
1482
+ e[26] !== k ? (L = /* @__PURE__ */ o(j, { content: "Remove link", children: /* @__PURE__ */ o(W, { variant: "ghost", size: "xs", "aria-label": "Remove link", onMouseDown: Ze, onClick: k, children: g }) }), e[26] = k, e[27] = L) : L = e[27];
1483
+ let _;
1484
+ return e[28] !== x || e[29] !== p || e[30] !== L ? (_ = /* @__PURE__ */ G(pt, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
1485
+ x,
1486
+ p,
1487
+ L
1488
+ ] }), e[28] = x, e[29] = p, e[30] = L, e[31] = _) : _ = e[31], _;
1489
+ }
1490
+ function Ze(t) {
1491
+ t.preventDefault();
1492
+ }
1493
+ function io(t, e, n) {
1494
+ return t && e && n === "";
1495
+ }
1496
+ function oo(t) {
1497
+ const e = je(t), n = ae(e, he);
1498
+ return n ? n.getURL() : he(e) ? e.getURL() : "";
1499
+ }
1500
+ const wn = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
1501
+ function vt(t) {
1502
+ try {
1503
+ const e = new URL(t);
1504
+ if (!wn.has(e.protocol))
1505
+ return "about:blank";
1506
+ } catch {
1507
+ return t;
1508
+ }
1509
+ return t;
1510
+ }
1511
+ function Nn(t) {
1512
+ try {
1513
+ const e = new URL(t);
1514
+ return wn.has(e.protocol) ? e.protocol === "http:" || e.protocol === "https:" ? e.hostname !== "" : e.pathname.trim() !== "" : !1;
1515
+ } catch {
1516
+ return !1;
1517
+ }
1518
+ }
1519
+ const lo = 8;
1520
+ function so({
1521
+ editor: t,
1522
+ isLink: e,
1523
+ setIsLink: n,
1524
+ anchorElem: r,
1525
+ isLinkEditMode: i,
1526
+ setIsLinkEditMode: l
1527
+ }) {
1528
+ const s = me(null), m = me(null), a = me(() => {
1529
+ }), [d, c] = B(""), [u, f] = B("https://"), [b, k] = B(null), x = e || i, v = Nn(u);
1530
+ a.current = () => {
1531
+ const _ = se();
1532
+ if (ee(_)) {
1533
+ const T = oo(_);
1534
+ c(T), io(i, e, T) && g(), i && T !== "" && f(T);
1535
+ }
1536
+ const C = s.current, S = window.getSelection(), h = document.activeElement;
1537
+ if (C === null)
1538
+ return;
1539
+ const y = t.getRootElement(), N = S !== null && S.rangeCount > 0;
1540
+ if (_ !== null && S !== null && N && y?.contains(S.anchorNode) && t.isEditable()) {
1541
+ const T = S.getRangeAt(0).getBoundingClientRect(), E = new DOMRect(T.left, T.top, 0, T.height);
1542
+ it(E, C, r, lo, void 0, "above", "viewport"), k(_);
1543
+ } else C.contains(h) || (y !== null && it(null, C, r, void 0, void 0, "legacy", "viewport"), k(null), l(!1), c(""));
1544
+ }, q(() => {
1545
+ const _ = r.parentElement, C = () => {
1546
+ t.getEditorState().read(() => {
1547
+ a.current();
1548
+ });
1549
+ };
1550
+ return window.addEventListener("resize", C), _ && _.addEventListener("scroll", C), () => {
1551
+ window.removeEventListener("resize", C), _ && _.removeEventListener("scroll", C);
1552
+ };
1553
+ }, [r.parentElement, t]), q(() => st(t.registerUpdateListener(({
1554
+ editorState: _
1555
+ }) => {
1556
+ _.read(() => {
1557
+ a.current();
1558
+ });
1559
+ }), t.registerCommand(lt, () => (a.current(), !0), bt), t.registerCommand(ir, () => e ? (n(!1), !0) : !1, wt)), [t, n, e]), q(() => {
1560
+ t.getEditorState().read(() => {
1561
+ a.current();
1562
+ });
1563
+ }, [t]), dr(() => {
1564
+ x && t.getEditorState().read(() => {
1565
+ a.current();
1566
+ });
1567
+ }, [t, x]), q(() => {
1568
+ i && m.current && m.current.focus();
1569
+ }, [i]);
1570
+ const p = (_) => {
1571
+ _.key === "Enter" ? (_.preventDefault(), L()) : _.key === "Escape" && (_.preventDefault(), g());
1572
+ }, g = () => {
1573
+ f("https://"), l(!1);
1574
+ }, L = () => {
1575
+ b === null || !v || (t.update(() => {
1576
+ or(b);
1577
+ }), t.dispatchCommand(ht, vt(u)), t.update(() => {
1578
+ const _ = se();
1579
+ if (ee(_)) {
1580
+ const C = je(_).getParent();
1581
+ if (Te(C)) {
1582
+ const S = Jt(C.getURL(), {
1583
+ rel: C.__rel,
1584
+ target: C.__target,
1585
+ title: C.__title
1586
+ });
1587
+ C.replace(S, !0);
1588
+ }
1589
+ }
1590
+ }), g());
1591
+ };
1592
+ return /* @__PURE__ */ o(ce, { ref: s, zIndex: "tooltip", className: `link-editor ${x ? "active" : ""}`, children: /* @__PURE__ */ o(ro, { isActive: x, isLinkEditMode: i, editedLinkUrl: u, editedLinkUrlIsValid: v, linkUrl: d, href: vt(d), inputRef: m, onEditedLinkUrlChange: f, onInputKeyDown: p, onClose: g, onSubmit: L, onEdit: () => {
1593
+ f(d), l(!0);
1594
+ }, onRemove: () => {
1595
+ t.dispatchCommand(ht, null);
1596
+ } }) });
1597
+ }
1598
+ function ao(t, e, n, r) {
1599
+ const i = F(10), [l, s] = B(t), [m, a] = B(!1);
1600
+ let d, c;
1601
+ i[0] !== t || i[1] !== r ? (d = () => {
1602
+ const f = function() {
1603
+ const k = se();
1604
+ if (ee(k)) {
1605
+ const x = je(k), v = ae(x, he), p = ae(x, Te);
1606
+ if (!(v || p)) {
1607
+ a(!1);
1608
+ return;
1609
+ }
1610
+ const g = k.getNodes().filter(uo).find((L) => {
1611
+ const _ = ae(L, he), C = ae(L, Te), S = Te(C) && C.getIsUnlinked();
1612
+ return v && !v.is(_) || _ && !_.is(v) || p && !p.is(C) || C && (!C.is(p) || S);
1613
+ });
1614
+ a(!g);
1615
+ }
1616
+ };
1617
+ return st(t.registerUpdateListener((b) => {
1618
+ const {
1619
+ editorState: k
1620
+ } = b;
1621
+ k.read(() => {
1622
+ f();
1623
+ });
1624
+ }), t.registerCommand(lt, (b, k) => (f(), s(k), !1), Tt), t.registerCommand(ln, co, bt), t.registerCommand(Tn, (b) => (r(b), !0), bt));
1625
+ }, c = [t, r], i[0] = t, i[1] = r, i[2] = d, i[3] = c) : (d = i[2], c = i[3]), q(d, c);
1626
+ let u;
1627
+ return i[4] !== l || i[5] !== e || i[6] !== m || i[7] !== n || i[8] !== r ? (u = Nt(/* @__PURE__ */ o(so, { editor: l, isLink: m, anchorElem: e, setIsLink: a, isLinkEditMode: n, setIsLinkEditMode: r }), document.body), i[4] = l, i[5] = e, i[6] = m, i[7] = n, i[8] = r, i[9] = u) : u = i[9], u;
1628
+ }
1629
+ function co(t) {
1630
+ const e = se();
1631
+ if (ee(e)) {
1632
+ const n = je(e), r = ae(n, he);
1633
+ if (he(r) && (t.metaKey || t.ctrlKey))
1634
+ return window.open(vt(r.getURL()), "_blank", "noopener,noreferrer"), !0;
1635
+ }
1636
+ return !1;
1637
+ }
1638
+ function uo(t) {
1639
+ return !rn(t);
1640
+ }
1641
+ function mo(t) {
1642
+ const {
1643
+ anchorElem: e
1644
+ } = t, n = e === void 0 ? document.body : e, [r, i] = B(!1), [l] = fe();
1645
+ return ao(l, n, r, i);
1646
+ }
1647
+ function fo() {
1648
+ const t = F(1);
1649
+ let e;
1650
+ return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ o(ni, { validateUrl: Nn }), t[0] = e) : e = t[0], e;
1651
+ }
1652
+ function ho(t) {
1653
+ const e = F(4), {
1654
+ isEditable: n
1655
+ } = t, [r] = fe();
1656
+ let i, l;
1657
+ return e[0] !== r || e[1] !== n ? (i = () => {
1658
+ r.setEditable(n);
1659
+ }, l = [n, r], e[0] = r, e[1] = n, e[2] = i, e[3] = l) : (i = e[2], l = e[3]), q(i, l), null;
1660
+ }
1661
+ function po() {
1662
+ const t = F(2), [e] = fe();
1663
+ let n;
1664
+ return t[0] !== e ? (n = /* @__PURE__ */ o(ce, { fontSize: "xs", color: "fg.muted", padding: "4", children: /* @__PURE__ */ o(Kr, { treeTypeButtonClassName: "debug-treetype-button", timeTravelButtonClassName: "debug-timetravel-button", timeTravelPanelButtonClassName: "debug-timetravel-button", timeTravelPanelClassName: "debug-timetravel-panel", timeTravelPanelSliderClassName: "debug-timetravel-slider", viewClassName: "tree-view-output", editor: e }) }), t[0] = e, t[1] = n) : n = t[1], n;
1665
+ }
1666
+ const go = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/;
1667
+ function _o(t) {
1668
+ const e = t.match(go);
1669
+ return e ? {
1670
+ frontmatter: e[0],
1671
+ body: t.slice(e[0].length)
1672
+ } : {
1673
+ frontmatter: "",
1674
+ body: t
1675
+ };
1676
+ }
1677
+ const Kt = (t) => t.trim().replace(/\s+/g, " "), bo = (t, e) => {
1678
+ const n = t.map(Kt), r = /* @__PURE__ */ new Map(), i = [];
1679
+ for (const l of e) {
1680
+ const s = Kt(l.heading), m = l.occurrence ?? r.get(s) ?? 0;
1681
+ r.set(s, m + 1);
1682
+ let a = 0;
1683
+ for (const [d, c] of n.entries())
1684
+ if (c === s) {
1685
+ if (a === m) {
1686
+ i.push({
1687
+ id: l.id,
1688
+ headingIndex: d
1689
+ });
1690
+ break;
1691
+ }
1692
+ a += 1;
1693
+ }
1694
+ }
1695
+ return i.sort((l, s) => l.headingIndex - s.headingIndex);
1696
+ }, ko = (t, e) => {
1697
+ let r = t[0]?.id;
1698
+ for (const i of t) {
1699
+ if (i.top > e) break;
1700
+ r = i.id;
1701
+ }
1702
+ return r;
1703
+ }, yo = (t) => {
1704
+ let e = t.parentElement;
1705
+ for (; e; ) {
1706
+ const n = getComputedStyle(e).overflowY;
1707
+ if (["auto", "scroll", "overlay"].includes(n)) return e;
1708
+ e = e.parentElement;
1709
+ }
1710
+ return null;
1711
+ }, xo = (t) => {
1712
+ const {
1713
+ anchors: e,
1714
+ targetId: n,
1715
+ onActiveSectionChange: r
1716
+ } = t, [i] = fe(), l = me(r);
1717
+ return l.current = r, q(() => {
1718
+ let s = () => {
1719
+ };
1720
+ const m = requestAnimationFrame(() => {
1721
+ const a = i.getRootElement();
1722
+ if (!a) return;
1723
+ const d = Array.from(a.querySelectorAll("h1, h2, h3, h4, h5, h6")), u = bo(d.map((p) => p.textContent ?? ""), e).map((p) => ({
1724
+ id: p.id,
1725
+ element: d[p.headingIndex]
1726
+ }));
1727
+ for (const p of u) p.element.dataset.markdownSectionId = p.id;
1728
+ const f = u.find((p) => p.id === n);
1729
+ if (!f) {
1730
+ console.warn(`[markdown section] Unknown section id: ${n}`), l.current?.(null);
1731
+ return;
1732
+ }
1733
+ f.element.tabIndex = -1, f.element.scrollIntoView({
1734
+ block: "start"
1735
+ }), f.element.focus({
1736
+ preventScroll: !0
1737
+ });
1738
+ const b = yo(a);
1739
+ let k;
1740
+ const x = () => {
1741
+ const p = b?.getBoundingClientRect().top ?? 0, g = ko(u.map((L) => ({
1742
+ id: L.id,
1743
+ top: L.element.getBoundingClientRect().top - p
1744
+ })), 8);
1745
+ !g || g === k || (k = g, l.current?.(g));
1746
+ }, v = b ?? window;
1747
+ v.addEventListener("scroll", x, {
1748
+ passive: !0
1749
+ }), x(), s = () => {
1750
+ v.removeEventListener("scroll", x);
1751
+ };
1752
+ });
1753
+ return () => {
1754
+ cancelAnimationFrame(m), s();
1755
+ };
1756
+ }, [e, i, n]), null;
1757
+ }, Co = (t) => ({
1758
+ columns: [{
1759
+ id: `${t}-column-1`,
1760
+ label: "Column 1",
1761
+ alignment: null
1762
+ }, {
1763
+ id: `${t}-column-2`,
1764
+ label: "Column 2",
1765
+ alignment: null
1766
+ }],
1767
+ rows: [{
1768
+ id: `${t}-row-1`,
1769
+ cells: {
1770
+ [`${t}-column-1`]: "",
1771
+ [`${t}-column-2`]: ""
1772
+ }
1773
+ }]
1774
+ }), vo = [{
1775
+ id: "table",
1776
+ label: "Table",
1777
+ icon: Br
1778
+ }, {
1779
+ id: "image",
1780
+ label: "Image",
1781
+ icon: Fr
1782
+ }, {
1783
+ id: "code",
1784
+ label: "Code block",
1785
+ icon: zr
1786
+ }, {
1787
+ id: "divider",
1788
+ label: "Divider",
1789
+ icon: Hr
1790
+ }], Eo = (t) => {
1791
+ const e = /^\/([a-z ]*)$/i.exec(t);
1792
+ return e ? {
1793
+ leadOffset: 0,
1794
+ matchingString: e[1] ?? "",
1795
+ replaceableString: e[0]
1796
+ } : null;
1797
+ }, So = () => `table-${globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`}`, ft = (t, e) => {
1798
+ const n = t?.getParent();
1799
+ if (!ot(n)) return;
1800
+ n.replace(e);
1801
+ const r = we();
1802
+ e.insertAfter(r), r.select();
1803
+ }, To = (t) => {
1804
+ const e = F(18), {
1805
+ options: n,
1806
+ selectedIndex: r,
1807
+ onSelect: i,
1808
+ onHighlight: l
1809
+ } = t;
1810
+ let s, m;
1811
+ e[0] !== r ? (s = () => {
1812
+ document.getElementById(`slash-command-${r}`)?.scrollIntoView({
1813
+ block: "nearest"
1814
+ });
1815
+ }, m = [r], e[0] = r, e[1] = s, e[2] = m) : (s = e[1], m = e[2]), q(s, m);
1816
+ let a;
1817
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ o(le, { paddingX: "sm", paddingY: "2xs", color: "fg.muted", textStyle: "label/S/medium", children: "Insert" }), e[3] = a) : a = e[3];
1818
+ let d;
1819
+ e[4] !== n.length ? (d = n.length === 0 ? /* @__PURE__ */ o(le, { padding: "sm", color: "fg.muted", textStyle: "paragraph/S/regular", children: "No matching commands" }) : null, e[4] = n.length, e[5] = d) : d = e[5];
1820
+ let c;
1821
+ if (e[6] !== l || e[7] !== i || e[8] !== n || e[9] !== r) {
1822
+ let f;
1823
+ e[11] !== l || e[12] !== i || e[13] !== r ? (f = (b, k) => {
1824
+ const x = r === k;
1825
+ return /* @__PURE__ */ G(tt, { ref: b.setRefElement, id: `slash-command-${k}`, role: "option", "aria-selected": x, alignItems: "center", gap: "xs", paddingX: "sm", paddingY: "xs", cursor: "pointer", background: x ? "bg.active" : "transparent", _hover: {
1826
+ background: x ? "bg.active" : "bg.hover"
1827
+ }, onMouseEnter: () => l(k), onPointerDown: No, onClick: () => i(b, k), children: [
1828
+ /* @__PURE__ */ o(Xn, { as: b.icon, boxSize: "16px", flexShrink: 0 }),
1829
+ /* @__PURE__ */ o(le, { minWidth: "0", truncate: !0, textStyle: "label/M/medium", children: b.label })
1830
+ ] }, b.id);
1831
+ }, e[11] = l, e[12] = i, e[13] = r, e[14] = f) : f = e[14], c = n.map(f), e[6] = l, e[7] = i, e[8] = n, e[9] = r, e[10] = c;
1832
+ } else
1833
+ c = e[10];
1834
+ let u;
1835
+ return e[15] !== d || e[16] !== c ? (u = /* @__PURE__ */ G(ce, { role: "listbox", "aria-label": "Insert content", position: "absolute", zIndex: "popover", layerStyle: "modal", minWidth: "13rem", overflow: "hidden", paddingY: "2xs", children: [
1836
+ a,
1837
+ d,
1838
+ c
1839
+ ] }), e[15] = d, e[16] = c, e[17] = u) : u = e[17], u;
1840
+ }, wo = () => {
1841
+ const t = F(52), [e] = fe(), [n, r] = B(null), [i, l] = B(null), [s, m] = B(""), [a, d] = B("Image");
1842
+ let c;
1843
+ t[0] !== n ? (c = vo.filter((O) => !n || O.label.toLowerCase().includes(n.toLowerCase())).map(Io), t[0] = n, t[1] = c) : c = t[1];
1844
+ const u = c;
1845
+ let f;
1846
+ t[2] !== e || t[3] !== i ? (f = () => {
1847
+ i && e.update(() => {
1848
+ const O = He(i);
1849
+ if (_t(O)) {
1850
+ const H = O.getParent();
1851
+ O.remove(), H?.selectEnd();
1852
+ }
1853
+ }, {
1854
+ tag: ut
1855
+ }), l(null), setTimeout(() => e.focus(), 0);
1856
+ }, t[2] = e, t[3] = i, t[4] = f) : f = t[4];
1857
+ const b = f;
1858
+ let k;
1859
+ t[5] !== e || t[6] !== a || t[7] !== i || t[8] !== s ? (k = (O) => {
1860
+ O.preventDefault(), !(!i || !s.trim()) && (e.update(() => {
1861
+ const H = He(i);
1862
+ if (_t(H)) {
1863
+ const K = nt(s.trim(), a.trim() || "Image"), Z = H.getParent();
1864
+ if (H.replace(K), ot(Z)) {
1865
+ const J = we();
1866
+ Z.insertAfter(J), J.select();
1867
+ }
1868
+ }
1869
+ }, {
1870
+ tag: ut
1871
+ }), l(null), setTimeout(() => e.focus(), 0));
1872
+ }, t[5] = e, t[6] = a, t[7] = i, t[8] = s, t[9] = k) : k = t[9];
1873
+ const x = k;
1874
+ let v;
1875
+ t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = (O, H, K) => {
1876
+ if (O.id === "image") {
1877
+ m(""), d("Image"), l(H?.getKey() ?? null), K();
1878
+ return;
1879
+ }
1880
+ sn(ut), O.id === "table" && ft(H, At(Co(So()))), O.id === "code" && ft(H, Xt()), O.id === "divider" && ft(H, Wr()), K();
1881
+ }, t[10] = v) : v = t[10];
1882
+ let p;
1883
+ t[11] !== u ? (p = /* @__PURE__ */ o(jr, { onQueryChange: r, triggerFn: Eo, options: u, onSelectOption: v, menuRenderFn: Ro }), t[11] = u, t[12] = p) : p = t[12];
1884
+ const g = !!i;
1885
+ let L;
1886
+ t[13] !== e ? (L = () => e.getRootElement(), t[13] = e, t[14] = L) : L = t[14];
1887
+ let _;
1888
+ t[15] !== b || t[16] !== i ? (_ = (O) => {
1889
+ !O.open && i && b();
1890
+ }, t[15] = b, t[16] = i, t[17] = _) : _ = t[17];
1891
+ let C;
1892
+ t[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ o(Ce.Backdrop, {}), t[18] = C) : C = t[18];
1893
+ let S;
1894
+ t[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ o(Ce.Header, { children: /* @__PURE__ */ o(Ce.Title, { children: "Insert image" }) }), t[19] = S) : S = t[19];
1895
+ let h;
1896
+ t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ o(Ve.Label, { children: "Image URL" }), t[20] = h) : h = t[20];
1897
+ let y;
1898
+ t[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = (O) => m(O.target.value), t[21] = y) : y = t[21];
1899
+ let N;
1900
+ t[22] !== s ? (N = /* @__PURE__ */ G(Ve.Root, { required: !0, children: [
1901
+ h,
1902
+ /* @__PURE__ */ o(gt, { autoFocus: !0, value: s, onChange: y })
1903
+ ] }), t[22] = s, t[23] = N) : N = t[23];
1904
+ let T;
1905
+ t[24] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ o(Ve.Label, { children: "Alt text" }), t[24] = T) : T = t[24];
1906
+ let E;
1907
+ t[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = (O) => d(O.target.value), t[25] = E) : E = t[25];
1908
+ let R;
1909
+ t[26] !== a ? (R = /* @__PURE__ */ G(Ve.Root, { children: [
1910
+ T,
1911
+ /* @__PURE__ */ o(gt, { value: a, onChange: E })
1912
+ ] }), t[26] = a, t[27] = R) : R = t[27];
1913
+ let I;
1914
+ t[28] !== N || t[29] !== R ? (I = /* @__PURE__ */ o(Ce.Body, { children: /* @__PURE__ */ G(tt, { direction: "column", gap: "sm", children: [
1915
+ N,
1916
+ R
1917
+ ] }) }), t[28] = N, t[29] = R, t[30] = I) : I = t[30];
1918
+ let M;
1919
+ t[31] !== b ? (M = /* @__PURE__ */ o(Dt, { type: "button", variant: "ghost", onClick: b, children: "Cancel" }), t[31] = b, t[32] = M) : M = t[32];
1920
+ let D;
1921
+ t[33] !== s ? (D = s.trim(), t[33] = s, t[34] = D) : D = t[34];
1922
+ const z = !D;
1923
+ let U;
1924
+ t[35] !== z ? (U = /* @__PURE__ */ o(Dt, { type: "submit", variant: "primary", disabled: z, children: "Insert image" }), t[35] = z, t[36] = U) : U = t[36];
1925
+ let w;
1926
+ t[37] !== M || t[38] !== U ? (w = /* @__PURE__ */ G(Ce.Footer, { children: [
1927
+ M,
1928
+ U
1929
+ ] }), t[37] = M, t[38] = U, t[39] = w) : w = t[39];
1930
+ let $;
1931
+ t[40] !== x || t[41] !== I || t[42] !== w ? ($ = /* @__PURE__ */ o(Ce.Positioner, { children: /* @__PURE__ */ o(Ce.Content, { asChild: !0, children: /* @__PURE__ */ G("form", { onSubmit: x, children: [
1932
+ S,
1933
+ I,
1934
+ w
1935
+ ] }) }) }), t[40] = x, t[41] = I, t[42] = w, t[43] = $) : $ = t[43];
1936
+ let A;
1937
+ t[44] !== $ || t[45] !== g || t[46] !== L || t[47] !== _ ? (A = /* @__PURE__ */ G(Ce.Root, { open: g, finalFocusEl: L, onOpenChange: _, children: [
1938
+ C,
1939
+ $
1940
+ ] }), t[44] = $, t[45] = g, t[46] = L, t[47] = _, t[48] = A) : A = t[48];
1941
+ let P;
1942
+ return t[49] !== A || t[50] !== p ? (P = /* @__PURE__ */ G(en, { children: [
1943
+ p,
1944
+ A
1945
+ ] }), t[49] = A, t[50] = p, t[51] = P) : P = t[51], P;
1946
+ };
1947
+ function No(t) {
1948
+ return t.preventDefault();
1949
+ }
1950
+ function Lo() {
1951
+ }
1952
+ function Io(t) {
1953
+ return {
1954
+ ...t,
1955
+ key: t.id,
1956
+ setRefElement: Lo
1957
+ };
1958
+ }
1959
+ function Ro(t, e) {
1960
+ return t.current ? qr.createPortal(/* @__PURE__ */ o(To, { options: e.options, selectedIndex: e.selectedIndex, onHighlight: e.setHighlightedIndex, onSelect: (n, r) => {
1961
+ e.setHighlightedIndex(r), e.selectOptionAndCleanUp(n);
1962
+ } }), t.current) : null;
1963
+ }
1964
+ const $o = () => {
1965
+ const [t] = fe(), [e] = B(() => ({
1966
+ current: {
1967
+ editor: t,
1968
+ editorState: t.getEditorState()
1969
+ },
1970
+ redoStack: [],
1971
+ undoStack: []
1972
+ }));
1973
+ return q(() => {
1974
+ e.current = {
1975
+ editor: t,
1976
+ editorState: t.getEditorState()
1977
+ };
1978
+ }, [t, e]), q(() => t.registerCommand(lr, (n) => {
1979
+ const r = n.target;
1980
+ return r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || !n.ctrlKey && !n.metaKey || n.key.toLowerCase() !== "z" ? !1 : (n.preventDefault(), t.dispatchCommand(n.shiftKey ? an : cn, void 0), !0);
1981
+ }, wt), [t]), /* @__PURE__ */ o(Jr, { externalHistoryState: e });
1982
+ }, Wt = "markdown-initial-import";
1983
+ function Ln(t) {
1984
+ const e = F(70), {
1985
+ autoFocus: n,
1986
+ debug: r,
1987
+ defaultState: i,
1988
+ fullWidth: l,
1989
+ isEditable: s,
1990
+ padding: m,
1991
+ placeholder: a,
1992
+ scrollable: d,
1993
+ sectionNavigation: c,
1994
+ resolveMarkdownUrl: u,
1995
+ onActiveSectionChange: f,
1996
+ onChange: b
1997
+ } = t, k = n === void 0 ? !1 : n, x = r === void 0 ? !1 : r, v = i === void 0 ? "" : i, p = l === void 0 ? !1 : l, g = s === void 0 ? !1 : s, L = m === void 0 ? "sm" : m, _ = d === void 0 ? !0 : d;
1998
+ let C;
1999
+ e[0] !== v ? (C = _o(v), e[0] = v, e[1] = C) : C = e[1];
2000
+ const {
2001
+ frontmatter: S,
2002
+ body: h
2003
+ } = C, y = g && !!b, N = me(null), [T, E] = B(null);
2004
+ let R, I;
2005
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (R = () => {
2006
+ E(N.current);
2007
+ }, I = [], e[2] = R, e[3] = I) : (R = e[2], I = e[3]), q(R, I);
2008
+ let M;
2009
+ e[4] !== h || e[5] !== u ? (M = () => {
2010
+ sn(Wt), Mi(h, u);
2011
+ }, e[4] = h, e[5] = u, e[6] = M) : M = e[6];
2012
+ let D;
2013
+ e[7] !== g || e[8] !== M ? (D = {
2014
+ namespace: "MARKDOWN_EDITOR",
2015
+ nodes: Qo,
2016
+ editorState: M,
2017
+ onError: Mo,
2018
+ editable: g,
2019
+ theme: Xo
2020
+ }, e[7] = g, e[8] = M, e[9] = D) : D = e[9];
2021
+ const z = D, U = _ ? "100%" : "auto";
2022
+ let w;
2023
+ e[10] !== g ? (w = g ? /* @__PURE__ */ o(wo, {}) : null, e[10] = g, e[11] = w) : w = e[11];
2024
+ let $;
2025
+ e[12] !== f || e[13] !== c ? ($ = c ? /* @__PURE__ */ o(xo, { anchors: c.anchors, targetId: c.targetId, onActiveSectionChange: f }) : null, e[12] = f, e[13] = c, e[14] = $) : $ = e[14];
2026
+ let A;
2027
+ e[15] !== k ? (A = k ? /* @__PURE__ */ o(hr, {}) : null, e[15] = k, e[16] = A) : A = e[16];
2028
+ let P, O, H;
2029
+ e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ o($o, {}), O = /* @__PURE__ */ o(fo, {}), H = /* @__PURE__ */ o(kr, {}), e[17] = P, e[18] = O, e[19] = H) : (P = e[17], O = e[18], H = e[19]);
2030
+ let K;
2031
+ e[20] !== g ? (K = g ? /* @__PURE__ */ o(vr, { maxIndent: 7 }) : null, e[20] = g, e[21] = K) : K = e[21];
2032
+ let Z;
2033
+ e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ o(pr, {}), e[22] = Z) : Z = e[22];
2034
+ let J;
2035
+ e[23] !== g ? (J = g ? /* @__PURE__ */ o(yr, { transformers: Yo }) : null, e[23] = g, e[24] = J) : J = e[24];
2036
+ let pe, ge, _e;
2037
+ e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (pe = /* @__PURE__ */ o(br, {}), ge = /* @__PURE__ */ o(Hi, {}), _e = /* @__PURE__ */ o(Fi, {}), e[25] = pe, e[26] = ge, e[27] = _e) : (pe = e[25], ge = e[26], _e = e[27]);
2038
+ let te;
2039
+ e[28] !== T ? (te = /* @__PURE__ */ o(Di, { anchorElem: T }), e[28] = T, e[29] = te) : te = e[29];
2040
+ let ne;
2041
+ e[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ne = /* @__PURE__ */ o(Wi, {}), e[30] = ne) : ne = e[30];
2042
+ let Q;
2043
+ e[31] !== p || e[32] !== L || e[33] !== _ ? (Q = /* @__PURE__ */ o(ii, { fullWidth: p, padding: L, scrollable: _ }), e[31] = p, e[32] = L, e[33] = _, e[34] = Q) : Q = e[34];
2044
+ let ue;
2045
+ e[35] !== a ? (ue = a ? /* @__PURE__ */ o(tt, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ o(ce, { width: "100%", maxWidth: "45rem", color: "fg.muted", textStyle: "paragraph/M/regular", children: a }) }) : null, e[35] = a, e[36] = ue) : ue = e[36];
2046
+ let re;
2047
+ e[37] !== Q || e[38] !== ue ? (re = /* @__PURE__ */ o(Cr, { contentEditable: Q, placeholder: ue, ErrorBoundary: _r }), e[37] = Q, e[38] = ue, e[39] = re) : re = e[39];
2048
+ let V;
2049
+ e[40] !== T || e[41] !== g ? (V = g && T ? /* @__PURE__ */ G(en, { children: [
2050
+ /* @__PURE__ */ o(no, { anchorElem: T }),
2051
+ /* @__PURE__ */ o(mo, { anchorElem: T })
2052
+ ] }) : null, e[40] = T, e[41] = g, e[42] = V) : V = e[42];
2053
+ let ie;
2054
+ e[43] !== S || e[44] !== b || e[45] !== y ? (ie = y ? /* @__PURE__ */ o(xr, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (ke, Pe, ye) => {
2055
+ ye.has(Wt) || ke.read(() => {
2056
+ const Ue = on(), xe = wi(Ue);
2057
+ b?.(S + xe);
2058
+ });
2059
+ } }) : null, e[43] = S, e[44] = b, e[45] = y, e[46] = ie) : ie = e[46];
2060
+ let de;
2061
+ e[47] !== g ? (de = /* @__PURE__ */ o(ho, { isEditable: g }), e[47] = g, e[48] = de) : de = e[48];
2062
+ let Y;
2063
+ e[49] !== x ? (Y = x && /* @__PURE__ */ o(po, {}), e[49] = x, e[50] = Y) : Y = e[50];
2064
+ let oe;
2065
+ e[51] !== z || e[52] !== w || e[53] !== $ || e[54] !== A || e[55] !== K || e[56] !== J || e[57] !== te || e[58] !== re || e[59] !== V || e[60] !== ie || e[61] !== de || e[62] !== Y ? (oe = /* @__PURE__ */ G(gr, { initialConfig: z, children: [
2066
+ w,
2067
+ $,
2068
+ A,
2069
+ P,
2070
+ O,
2071
+ H,
2072
+ K,
2073
+ Z,
2074
+ J,
2075
+ pe,
2076
+ ge,
2077
+ _e,
2078
+ te,
2079
+ ne,
2080
+ re,
2081
+ V,
2082
+ ie,
2083
+ de,
2084
+ Y
2085
+ ] }), e[51] = z, e[52] = w, e[53] = $, e[54] = A, e[55] = K, e[56] = J, e[57] = te, e[58] = re, e[59] = V, e[60] = ie, e[61] = de, e[62] = Y, e[63] = oe) : oe = e[63];
2086
+ let X;
2087
+ e[64] !== u || e[65] !== oe ? (X = /* @__PURE__ */ o(gi, { resolver: u, children: oe }), e[64] = u, e[65] = oe, e[66] = X) : X = e[66];
2088
+ let be;
2089
+ return e[67] !== U || e[68] !== X ? (be = /* @__PURE__ */ o(tt, { ref: N, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: U, position: "relative", direction: "column", overflow: "visible", children: X }), e[67] = U, e[68] = X, e[69] = be) : be = e[69], be;
2090
+ }
2091
+ function Mo(t) {
2092
+ return console.error(t);
2093
+ }
2094
+ const zl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2095
+ __proto__: null,
2096
+ MarkdownEditor: Ln
2097
+ }, Symbol.toStringTag, { value: "Module" })), $e = (t) => {
2098
+ const e = F(5), {
2099
+ nodes: n
2100
+ } = t, r = Rt();
2101
+ let i;
2102
+ if (e[0] !== n || e[1] !== r) {
2103
+ let l;
2104
+ e[3] !== r ? (l = (s, m) => {
2105
+ const a = `${s.type}-${m}`;
2106
+ switch (s.type) {
2107
+ case "text":
2108
+ return /* @__PURE__ */ o(mr, { children: s.value }, a);
2109
+ case "strong":
2110
+ return /* @__PURE__ */ o(le, { as: "strong", fontWeight: "semibold", children: /* @__PURE__ */ o($e, { nodes: s.children }) }, a);
2111
+ case "emphasis":
2112
+ return /* @__PURE__ */ o(ce, { as: "em", children: /* @__PURE__ */ o($e, { nodes: s.children }) }, a);
2113
+ case "delete":
2114
+ return /* @__PURE__ */ o(ce, { as: "del", children: /* @__PURE__ */ o($e, { nodes: s.children }) }, a);
2115
+ case "inlineCode":
2116
+ return /* @__PURE__ */ o(Pt, { children: s.value }, a);
2117
+ case "break":
2118
+ return /* @__PURE__ */ o("br", {}, a);
2119
+ case "link": {
2120
+ const d = at(s.url, "link", r);
2121
+ return d ? /* @__PURE__ */ o(tn, { href: d, title: s.title ?? void 0, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ o($e, { nodes: s.children }) }, a) : /* @__PURE__ */ o($e, { nodes: s.children }, a);
2122
+ }
2123
+ case "image":
2124
+ return /* @__PURE__ */ o(bn, { source: s.url, alt: s.alt ?? "", title: s.title ?? null }, a);
2125
+ case "html":
2126
+ return /* @__PURE__ */ o(yn, { source: s.value, display: "inline" }, a);
2127
+ case "inlineMath":
2128
+ return /* @__PURE__ */ o(Pt, { children: s.value }, a);
2129
+ default:
2130
+ return null;
2131
+ }
2132
+ }, e[3] = r, e[4] = l) : l = e[4], i = n.map(l), e[0] = n, e[1] = r, e[2] = i;
2133
+ } else
2134
+ i = e[2];
2135
+ return i;
2136
+ }, In = (t) => {
2137
+ const e = F(4), {
2138
+ value: n
2139
+ } = t;
2140
+ let r;
2141
+ e[0] !== n ? (r = pn(n), e[0] = n, e[1] = r) : r = e[1];
2142
+ let i;
2143
+ return e[2] !== r ? (i = /* @__PURE__ */ o($e, { nodes: r }), e[2] = r, e[3] = i) : i = e[3], i;
2144
+ }, Oo = (t) => t.rows.map((e) => ({
2145
+ id: e.id,
2146
+ ...e.cells
2147
+ })), Ao = (t) => t.columns, Do = (t) => {
2148
+ const e = F(38), {
2149
+ editor: n,
2150
+ nodeKey: r,
2151
+ table: i
2152
+ } = t, [l, s] = B(!1), m = me(null);
2153
+ let a;
2154
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = () => {
2155
+ setTimeout(() => m.current?.focus(), 0);
2156
+ }, e[0] = a) : a = e[0];
2157
+ const d = a;
2158
+ let c;
2159
+ e[1] !== n || e[2] !== r ? (c = (w) => {
2160
+ n.update(() => {
2161
+ const $ = He(r);
2162
+ Et($) && $.setTable(w($.getTable()));
2163
+ }, {
2164
+ tag: Ut
2165
+ }), d();
2166
+ }, e[1] = n, e[2] = r, e[3] = c) : c = e[3];
2167
+ const u = c;
2168
+ let f;
2169
+ e[4] !== u ? (f = (w) => {
2170
+ u(($) => ({
2171
+ columns: w,
2172
+ rows: $.rows.map((A) => ({
2173
+ ...A,
2174
+ cells: Object.fromEntries(w.map((P) => [P.id, A.cells[P.id] ?? ""]))
2175
+ }))
2176
+ }));
2177
+ }, e[4] = u, e[5] = f) : f = e[5];
2178
+ const b = f;
2179
+ let k;
2180
+ e[6] !== u ? (k = (w) => {
2181
+ u(($) => ({
2182
+ ...$,
2183
+ rows: w.map((A, P) => ({
2184
+ id: String(A.id ?? $.rows[P]?.id ?? `row-${P + 1}`),
2185
+ cells: Object.fromEntries($.columns.map((O) => [O.id, String(A[O.id] ?? "")]))
2186
+ }))
2187
+ }));
2188
+ }, e[6] = u, e[7] = k) : k = e[7];
2189
+ const x = k;
2190
+ let v;
2191
+ e[8] !== n || e[9] !== r ? (v = () => {
2192
+ n.update(() => {
2193
+ const w = He(r);
2194
+ if (Et(w)) {
2195
+ const $ = we();
2196
+ w.replace($), $.select();
2197
+ }
2198
+ }, {
2199
+ tag: Ut
2200
+ }), setTimeout(() => n.focus(), 0);
2201
+ }, e[8] = n, e[9] = r, e[10] = v) : v = e[10];
2202
+ const p = v;
2203
+ let g;
2204
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = (w) => {
2205
+ w.target.closest("button, input, textarea, [contenteditable='true'], [role='menuitem']") || (w.preventDefault(), m.current?.focus());
2206
+ }, e[11] = g) : g = e[11];
2207
+ const L = g;
2208
+ let _;
2209
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = (w) => {
2210
+ w.currentTarget.contains(w.relatedTarget) || s(!1);
2211
+ }, e[12] = _) : _ = e[12];
2212
+ const C = _;
2213
+ let S;
2214
+ e[13] !== p || e[14] !== n || e[15] !== l ? (S = (w) => {
2215
+ const $ = w.target, A = $.matches("input, textarea") || $.isContentEditable;
2216
+ if ((w.ctrlKey || w.metaKey) && w.key.toLowerCase() === "z" && !A) {
2217
+ w.preventDefault(), w.stopPropagation(), n.dispatchCommand(w.shiftKey ? an : cn, void 0);
2218
+ return;
2219
+ }
2220
+ A || l && (w.key === "Delete" || w.key === "Backspace") && (w.preventDefault(), w.stopPropagation(), p());
2221
+ }, e[13] = p, e[14] = n, e[15] = l, e[16] = S) : S = e[16];
2222
+ const h = S, y = String(l), N = l ? "2px solid" : "none";
2223
+ let T;
2224
+ e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = () => s(!0), e[17] = T) : T = e[17];
2225
+ let E;
2226
+ e[18] !== i ? (E = Oo(i), e[18] = i, e[19] = E) : E = e[19];
2227
+ let R;
2228
+ e[20] !== i ? (R = Ao(i), e[20] = i, e[21] = R) : R = e[21];
2229
+ let I;
2230
+ e[22] !== b || e[23] !== x || e[24] !== R ? (I = {
2231
+ columns: R,
2232
+ onColumnsChange: b,
2233
+ onDataChange: x,
2234
+ renderHeader: Po,
2235
+ renderCell: Uo,
2236
+ renderCellEditor: Bo
2237
+ }, e[22] = b, e[23] = x, e[24] = R, e[25] = I) : I = e[25];
2238
+ let M;
2239
+ e[26] !== n ? (M = n.isEditable(), e[26] = n, e[27] = M) : M = e[27];
2240
+ const D = !M;
2241
+ let z;
2242
+ e[28] !== E || e[29] !== I || e[30] !== D ? (z = /* @__PURE__ */ o(fr, { data: E, editMode: I, fullWidth: !0, getRowId: Fo, initialPageSize: 30, isReadOnly: D }), e[28] = E, e[29] = I, e[30] = D, e[31] = z) : z = e[31];
2243
+ let U;
2244
+ return e[32] !== h || e[33] !== l || e[34] !== z || e[35] !== y || e[36] !== N ? (U = /* @__PURE__ */ o(ce, { ref: m, "data-testid": "markdown-table-node", "data-selected": y, "aria-label": "Markdown table", "aria-selected": l, tabIndex: 0, outline: N, outlineColor: "border.accent-light", outlineOffset: "2px", borderRadius: "sm", onFocus: T, onBlur: C, onClick: L, onKeyDownCapture: h, children: z }), e[32] = h, e[33] = l, e[34] = z, e[35] = y, e[36] = N, e[37] = U) : U = e[37], U;
2245
+ };
2246
+ class Je extends Me {
2247
+ __table;
2248
+ static getType() {
2249
+ return "data_table";
2250
+ }
2251
+ static clone(e) {
2252
+ return new Je(e.__table, e.__key);
2253
+ }
2254
+ constructor(e, n) {
2255
+ super(n), this.__table = e;
2256
+ }
2257
+ getTable() {
2258
+ return this.getLatest().__table;
2259
+ }
2260
+ setTable(e) {
2261
+ const n = this.getWritable();
2262
+ n.__table = e;
2263
+ }
2264
+ createDOM() {
2265
+ return document.createElement("div");
2266
+ }
2267
+ updateDOM() {
2268
+ return !1;
2269
+ }
2270
+ decorate(e) {
2271
+ return /* @__PURE__ */ o(Do, { editor: e, nodeKey: this.__key, table: this.__table });
2272
+ }
2273
+ exportJSON() {
2274
+ return {
2275
+ type: "data_table",
2276
+ version: 2,
2277
+ table: this.__table
2278
+ };
2279
+ }
2280
+ static importJSON(e) {
2281
+ return At(e.table);
2282
+ }
2283
+ getTextContent() {
2284
+ const e = this.__table.columns.map((i) => i.label).join(" | "), n = this.__table.columns.map(() => "---").join(" | "), r = this.__table.rows.map((i) => this.__table.columns.map((l) => i.cells[l.id] ?? "").join(" | "));
2285
+ return [e, n, ...r].join(`
2286
+ `);
2287
+ }
2288
+ }
2289
+ const At = (t) => Oe(new Je(t)), Et = (t) => t instanceof Je;
2290
+ function Po(t) {
2291
+ return /* @__PURE__ */ o(In, { value: t.label });
2292
+ }
2293
+ function Uo(t) {
2294
+ return /* @__PURE__ */ o(In, { value: String(t.value ?? "") });
2295
+ }
2296
+ function Bo(t) {
2297
+ const {
2298
+ value: e,
2299
+ onChange: n
2300
+ } = t;
2301
+ return /* @__PURE__ */ o(Ln, { autoFocus: !0, defaultState: e, fullWidth: !0, isEditable: !0, padding: "xs", scrollable: !1, onChange: n });
2302
+ }
2303
+ function Fo(t) {
2304
+ return String(t.id);
2305
+ }
2306
+ const zo = {
2307
+ dependencies: [De],
2308
+ export: (t) => Cn(t) ? "***" : null,
2309
+ regExp: /^(---|\*\*\*|___)\s?$/,
2310
+ replace: (t) => {
2311
+ const e = Mt();
2312
+ t.replace(e);
2313
+ },
2314
+ type: "element"
2315
+ }, Ho = {
2316
+ dependencies: [kt],
2317
+ export: (t, e) => {
2318
+ if (t instanceof kt) {
2319
+ let n = t.getTextContent();
2320
+ if (t.hasFormat("bold"))
2321
+ n = `**${n}**`;
2322
+ else if (t.hasFormat("italic"))
2323
+ n = `*${n}*`;
2324
+ else if (t.hasFormat("underline"))
2325
+ n = `<ins>${n}</ins>`;
2326
+ else
2327
+ return null;
2328
+ return n;
2329
+ }
2330
+ return null;
2331
+ },
2332
+ regExp: /<ins>(.*)<\/ins>/,
2333
+ importRegExp: /<ins>(.*)<\/ins>/,
2334
+ replace: (t, e) => {
2335
+ const n = Ee(e[1]);
2336
+ n.toggleFormat("underline"), t.replace(n);
2337
+ },
2338
+ type: "text-match"
2339
+ }, qo = {
2340
+ dependencies: [kt],
2341
+ export: (t, e) => null,
2342
+ regExp: /<u>(.*)<\/u>/,
2343
+ importRegExp: /<u>(.*)<\/u>/,
2344
+ replace: (t, e) => {
2345
+ const n = Ee(e[1]);
2346
+ n.toggleFormat("underline"), t.replace(n);
2347
+ },
2348
+ type: "text-match"
2349
+ }, jt = /https?:\/\/[^\s<>"']*[^\s<>"'.,:;"')\]}]/, ze = (t) => t.replace(/\\([*_`~\\])/g, "$1"), Ko = (t) => t.replace(/\\/g, "\\\\").replace(/"/g, '\\"'), Wo = (t) => t?.replace(/\\(["\\])/g, "$1"), Rn = (t, e, n) => {
2350
+ if (t !== e)
2351
+ return n;
2352
+ const r = e.replace(/([*_`~\\])/g, "\\$1");
2353
+ return n.replace(r, e);
2354
+ }, jo = {
2355
+ dependencies: [St],
2356
+ export: (t, e) => {
2357
+ if (!he(t) || Te(t))
2358
+ return null;
2359
+ const n = t.getTitle(), r = ze(t.getURL()), i = Rn(t.getTextContent(), r, e(t));
2360
+ return n != null ? `[${i}](${r} "${Ko(n)}")` : `[${i}](${r})`;
2361
+ },
2362
+ importRegExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,
2363
+ regExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,
2364
+ replace: (t, e) => {
2365
+ const [, n, r, i] = e, l = ze(r), s = Jt(l, {
2366
+ title: Wo(i)
2367
+ }), m = n.split("[").length - 1, a = n.split("]").length - 1;
2368
+ let d = n, c = "";
2369
+ if (m < a)
2370
+ return;
2371
+ if (m > a) {
2372
+ const b = n.split("[");
2373
+ c = `[${b[0]}`, d = b.slice(1).join("[");
2374
+ }
2375
+ const u = ze(d), f = Ee(u === l ? l : u);
2376
+ return f.setFormat(t.getFormat()), s.append(f), t.replace(s), c && s.insertBefore(Ee(c)), f;
2377
+ },
2378
+ trigger: ")",
2379
+ type: "text-match"
2380
+ }, Jo = {
2381
+ dependencies: [Gt],
2382
+ export: (t, e) => {
2383
+ if (!Te(t))
2384
+ return null;
2385
+ const n = ze(t.getURL());
2386
+ return Rn(t.getTextContent(), n, e(t));
2387
+ },
2388
+ regExp: jt,
2389
+ importRegExp: jt,
2390
+ replace: (t, e) => {
2391
+ const n = ze(e[0]), r = $n(n), i = Ee(n);
2392
+ i.setFormat(t.getFormat()), r.append(i), t.replace(r);
2393
+ },
2394
+ type: "text-match"
2395
+ }, Go = [zo, Ho, qo, jo, Jo], Qo = [jn, St, Gt, Ke, qe, We, Je, Jn, Fn, zn, Zt, Qn, Le, Ie, De, Ne], Vo = [Hn, ...qn.filter((t) => t !== Kn), ...Go, qi, Ki], Yo = [...Vo, oi], Xo = li;
2396
+ export {
2397
+ Ci as $,
2398
+ Hi as C,
2399
+ Wi as E,
2400
+ no as F,
2401
+ Fi as I,
2402
+ Ln as M,
2403
+ ho as T,
2404
+ Qo as a,
2405
+ Di as b,
2406
+ ii as c,
2407
+ po as d,
2408
+ Xo as e,
2409
+ wi as f,
2410
+ gi as g,
2411
+ Mi as i,
2412
+ zl as m,
2413
+ _o as s,
2414
+ li as t
2415
+ };
2416
+ //# sourceMappingURL=editor-config-Dyh8n5A2.js.map