@pstdio/ui 0.4.0 → 0.5.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 (111) hide show
  1. package/dist/MermaidComponent-DwEDwpo2.js +124 -0
  2. package/dist/MermaidComponent-DwEDwpo2.js.map +1 -0
  3. package/dist/chat-ui.js +609 -505
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/chat-ui/components/chat-input-actions.d.ts +10 -0
  6. package/dist/components/chat-ui/components/chat-panel.d.ts +1 -0
  7. package/dist/components/chat-ui/tool-rendering/apply-patch-renderer.d.ts +2 -0
  8. package/dist/components/chat-ui/tool-rendering/default-renderers.d.ts +8 -7
  9. package/dist/components/chat-ui/tool-rendering/edit-renderer.d.ts +2 -0
  10. package/dist/components/chat-ui/tool-rendering/shared.d.ts +52 -0
  11. package/dist/components/chat-ui/tool-rendering/standard-renderers.d.ts +6 -0
  12. package/dist/components/chat-ui/tool-rendering/todo-write-renderer.d.ts +2 -0
  13. package/dist/components/menu-item.d.ts +2 -1
  14. package/dist/components/resource-context-menu.d.ts +20 -0
  15. package/dist/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.d.ts +2 -1
  16. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockActionsPlugin.d.ts +4 -0
  17. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.d.ts +2 -0
  18. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeHighlightingPlugin.d.ts +1 -0
  19. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/should-show-floating-toolbar.d.ts +11 -0
  20. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidComponent.d.ts +6 -0
  21. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.d.ts +23 -0
  22. package/dist/components/rich-text/shared/plugins/MermaidPlugin/index.d.ts +1 -0
  23. package/dist/components/rich-text/utils/markdown.d.ts +1 -0
  24. package/dist/components/session-indicator.d.ts +1 -1
  25. package/dist/components/sidebar-tree/sidebar-tree.types.d.ts +5 -1
  26. package/dist/components/tickets/tag-badge.d.ts +10 -0
  27. package/dist/components/tickets/tag-option-icon.d.ts +2 -0
  28. package/dist/components/tickets/ticket-board.d.ts +2 -0
  29. package/dist/components/tickets/ticket-card.d.ts +10 -0
  30. package/dist/components/tickets/ticket-grouping.d.ts +2 -2
  31. package/dist/components/tickets/ticket-list.d.ts +6 -1
  32. package/dist/components/tickets/tickets-workspace.d.ts +9 -3
  33. package/dist/components/tickets/types.d.ts +22 -5
  34. package/dist/components/tickets/workspace-helpers.d.ts +13 -0
  35. package/dist/get-file-type-icon-Bwqf1WXA.js +101 -0
  36. package/dist/get-file-type-icon-Bwqf1WXA.js.map +1 -0
  37. package/dist/index.d.ts +4 -2
  38. package/dist/index.js +1876 -1642
  39. package/dist/index.js.map +1 -1
  40. package/dist/rich-message-BVRk9BSD.js +1503 -0
  41. package/dist/rich-message-BVRk9BSD.js.map +1 -0
  42. package/dist/rich-text.js +414 -255
  43. package/dist/rich-text.js.map +1 -1
  44. package/dist/style.css +1 -1
  45. package/package.json +3 -1
  46. package/dist/components/attached-panel.utils.test.d.ts +0 -1
  47. package/dist/components/breadcrumb.stories.d.ts +0 -25
  48. package/dist/components/button.stories.d.ts +0 -18
  49. package/dist/components/chat-ui/components/ai-conversation.stories.d.ts +0 -6
  50. package/dist/components/chat-ui/components/ai-message.stories.d.ts +0 -6
  51. package/dist/components/chat-ui/components/ai-response.stories.d.ts +0 -7
  52. package/dist/components/chat-ui/components/attachment-list.stories.d.ts +0 -6
  53. package/dist/components/chat-ui/components/chat-input.stories.d.ts +0 -7
  54. package/dist/components/chat-ui/components/chat-panel-alerts.stories.d.ts +0 -9
  55. package/dist/components/chat-ui/components/chat-panel.stories.d.ts +0 -10
  56. package/dist/components/chat-ui/components/message-parts-renderer.stories.d.ts +0 -9
  57. package/dist/components/chat-ui/components/model-swap-separator.stories.d.ts +0 -6
  58. package/dist/components/chat-ui/components/tool-invocation-timeline.stories.d.ts +0 -6
  59. package/dist/components/chat-ui/components/workspace-hub.stories.d.ts +0 -6
  60. package/dist/components/checkbox.stories.d.ts +0 -15
  61. package/dist/components/column-file-browser.stories.d.ts +0 -15
  62. package/dist/components/data-table/data-table.stories.d.ts +0 -33
  63. package/dist/components/delete-confirmation-modal.stories.d.ts +0 -11
  64. package/dist/components/diff-bubble.stories.d.ts +0 -13
  65. package/dist/components/diff-drawer.stories.d.ts +0 -8
  66. package/dist/components/diff-view-adapter.test.d.ts +0 -1
  67. package/dist/components/drawer-inline.stories.d.ts +0 -8
  68. package/dist/components/empty-state.stories.d.ts +0 -34
  69. package/dist/components/file-selector.stories.d.ts +0 -17
  70. package/dist/components/folder-picker-dialog.stories.d.ts +0 -11
  71. package/dist/components/info-card.stories.d.ts +0 -41
  72. package/dist/components/item-section.stories.d.ts +0 -17
  73. package/dist/components/layout.stories.d.ts +0 -11
  74. package/dist/components/menu-item.stories.d.ts +0 -72
  75. package/dist/components/open-source-notices-screen.stories.d.ts +0 -12
  76. package/dist/components/param-editor-horizontal.stories.d.ts +0 -19
  77. package/dist/components/param-editor.stories.d.ts +0 -24
  78. package/dist/components/properties.stories.d.ts +0 -17
  79. package/dist/components/resource-badge.stories.d.ts +0 -7
  80. package/dist/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.stories.d.ts +0 -9
  81. package/dist/components/rich-text/markdown-editor/markdown-editor.stories.d.ts +0 -7
  82. package/dist/components/rich-text/prompt-input/prompt-input.stories.d.ts +0 -8
  83. package/dist/components/rich-text/rich-message/rich-message.stories.d.ts +0 -6
  84. package/dist/components/rich-text/shared/nodes/DataTableNode.stories.d.ts +0 -7
  85. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.d.ts +0 -21
  86. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.test.d.ts +0 -1
  87. package/dist/components/rich-text/shared/transformers/markdown-transformers.test.d.ts +0 -1
  88. package/dist/components/scroll-area.stories.d.ts +0 -7
  89. package/dist/components/searchable-menu.stories.d.ts +0 -8
  90. package/dist/components/session-indicator.stories.d.ts +0 -12
  91. package/dist/components/sidebar/sidebar.store.test.d.ts +0 -1
  92. package/dist/components/sidebar/sidebar.stories.d.ts +0 -11
  93. package/dist/components/sidebar-tree/sidebar-tree-searchable-action-menu.stories.d.ts +0 -6
  94. package/dist/components/sidebar-tree/sidebar-tree.stories.d.ts +0 -13
  95. package/dist/components/slider.stories.d.ts +0 -15
  96. package/dist/components/style-guide.stories.d.ts +0 -23
  97. package/dist/components/switch.stories.d.ts +0 -16
  98. package/dist/components/tickets/display-menu.stories.d.ts +0 -6
  99. package/dist/components/tickets/filter-menu.stories.d.ts +0 -6
  100. package/dist/components/tickets/ticket-board.stories.d.ts +0 -5
  101. package/dist/components/tickets/ticket-card.stories.d.ts +0 -18
  102. package/dist/components/tickets/ticket-grouping.test.d.ts +0 -1
  103. package/dist/components/tickets/ticket-list.stories.d.ts +0 -10
  104. package/dist/components/tickets/tickets-workspace.stories.d.ts +0 -10
  105. package/dist/components/tickets/use-workspace-store.test.d.ts +0 -1
  106. package/dist/components/toaster.stories.d.ts +0 -11
  107. package/dist/components/workspace-badge.stories.d.ts +0 -13
  108. package/dist/get-file-type-icon-CirIyuE8.js +0 -92
  109. package/dist/get-file-type-icon-CirIyuE8.js.map +0 -1
  110. package/dist/rich-message-Bad4GxH2.js +0 -1423
  111. package/dist/rich-message-Bad4GxH2.js.map +0 -1
package/dist/rich-text.js CHANGED
@@ -1,45 +1,146 @@
1
- import { jsx as t, jsxs as Z } from "react/jsx-runtime";
2
- import { c as Y } from "react/compiler-runtime";
3
- import { e as ae, a as se, I as ce, E as de, C as me, s as _e, b as ie, T as Se, c as Re } from "./rich-message-Bad4GxH2.js";
4
- import { D as Qt, d as Zt, R as Jt, P as eo, R as to, g as oo, f as no } from "./rich-message-Bad4GxH2.js";
5
- import { Stack as we, IconButton as D, Text as K, Box as fe, Flex as ne } from "@chakra-ui/react";
6
- import { LexicalCollaboration as ke } from "@lexical/react/LexicalCollaborationContext";
7
- import { CollaborationPluginV2__EXPERIMENTAL as Le } from "@lexical/react/LexicalCollaborationPlugin";
8
- import { LexicalComposer as ue } from "@lexical/react/LexicalComposer";
9
- import { LexicalErrorBoundary as pe } from "@lexical/react/LexicalErrorBoundary";
10
- import { HorizontalRulePlugin as he } from "@lexical/react/LexicalHorizontalRulePlugin";
11
- import { LinkPlugin as ge } from "@lexical/react/LexicalLinkPlugin";
12
- import { ListPlugin as be } from "@lexical/react/LexicalListPlugin";
13
- import { RichTextPlugin as ve } from "@lexical/react/LexicalRichTextPlugin";
14
- import { useState as k, useRef as J, useEffect as G } from "react";
15
- import { WebsocketProvider as Me } from "y-websocket";
16
- import * as Ie from "yjs";
17
- import { $isListNode as ee, REMOVE_LIST_COMMAND as Pe, INSERT_CHECK_LIST_COMMAND as Ne, INSERT_ORDERED_LIST_COMMAND as Ae, INSERT_UNORDERED_LIST_COMMAND as Be } from "@lexical/list";
18
- import { useLexicalComposerContext as Oe } from "@lexical/react/LexicalComposerContext";
19
- import { $isHeadingNode as He, $createHeadingNode as Fe } from "@lexical/rich-text";
20
- import { $setBlocksType as De } from "@lexical/selection";
21
- import { $findMatchingParent as xe, mergeRegister as ze } from "@lexical/utils";
22
- import { $isRootOrShadowRoot as $e, $getSelection as Q, $isRangeSelection as te, SELECTION_CHANGE_COMMAND as je, COMMAND_PRIORITY_CRITICAL as We, CLICK_COMMAND as Ue, COMMAND_PRIORITY_HIGH as qe, FORMAT_TEXT_COMMAND as oe, $createParagraphNode as Ke, $getRoot as Ve } from "lexical";
23
- import { List as Ge, ListOrdered as Ye, ListTodo as Xe } from "lucide-react";
24
- import { createPortal as Qe } from "react-dom";
25
- import { T as z } from "./get-file-type-icon-CirIyuE8.js";
26
- import { $convertFromMarkdownString as Ze, $convertToMarkdownString as Je } from "@lexical/markdown";
27
- import { AutoFocusPlugin as et } from "@lexical/react/LexicalAutoFocusPlugin";
28
- import { CheckListPlugin as tt } from "@lexical/react/LexicalCheckListPlugin";
29
- import { HistoryPlugin as ot } from "@lexical/react/LexicalHistoryPlugin";
30
- import { OnChangePlugin as nt } from "@lexical/react/LexicalOnChangePlugin";
31
- const it = 10, rt = 5;
32
- function re(o, e, i, l = it, c = rt) {
1
+ import { jsx as t, jsxs as ie } from "react/jsx-runtime";
2
+ import { c as ee } from "react/compiler-runtime";
3
+ import { e as he, a as ge, C as ve, I as Ce, E as be, b as xe, s as Fe, n as $e, c as fe, T as De, d as je } from "./rich-message-BVRk9BSD.js";
4
+ import { D as vo, f as Co, R as bo, P as xo, R as Eo, g as To, h as yo } from "./rich-message-BVRk9BSD.js";
5
+ import { IconButton as $, Stack as We, Text as Z, Box as Ee, Flex as de } from "@chakra-ui/react";
6
+ import { LexicalCollaboration as Ue } from "@lexical/react/LexicalCollaborationContext";
7
+ import { CollaborationPluginV2__EXPERIMENTAL as Ke } from "@lexical/react/LexicalCollaborationPlugin";
8
+ import { LexicalComposer as Te } from "@lexical/react/LexicalComposer";
9
+ import { LexicalErrorBoundary as ye } from "@lexical/react/LexicalErrorBoundary";
10
+ import { HorizontalRulePlugin as _e } from "@lexical/react/LexicalHorizontalRulePlugin";
11
+ import { LinkPlugin as Se } from "@lexical/react/LexicalLinkPlugin";
12
+ import { ListPlugin as Re } from "@lexical/react/LexicalListPlugin";
13
+ import { RichTextPlugin as we } from "@lexical/react/LexicalRichTextPlugin";
14
+ import { TabIndentationPlugin as ke } from "@lexical/react/LexicalTabIndentationPlugin";
15
+ import { useState as H, useRef as te, useEffect as G } from "react";
16
+ import { WebsocketProvider as qe } from "y-websocket";
17
+ import * as Ve from "yjs";
18
+ import { $isCodeNode as le, $createCodeNode as Ge } from "@lexical/code";
19
+ import { useLexicalComposerContext as Le } from "@lexical/react/LexicalComposerContext";
20
+ import { mergeRegister as Ie, $findMatchingParent as me } from "@lexical/utils";
21
+ import { SELECTION_CHANGE_COMMAND as Me, COMMAND_PRIORITY_CRITICAL as Ne, $getSelection as J, $isRangeSelection as Y, $isRootOrShadowRoot as Ye, CLICK_COMMAND as Xe, COMMAND_PRIORITY_HIGH as Qe, FORMAT_TEXT_COMMAND as re, $createParagraphNode as ue, $getRoot as Ze } from "lexical";
22
+ import { Check as Je, Copy as et, Code2 as tt, List as ot, ListOrdered as nt, ListTodo as it } from "lucide-react";
23
+ import { createPortal as Pe } from "react-dom";
24
+ import { T as D } from "./get-file-type-icon-Bwqf1WXA.js";
25
+ import { $isListNode as ae, REMOVE_LIST_COMMAND as lt, INSERT_CHECK_LIST_COMMAND as rt, INSERT_ORDERED_LIST_COMMAND as at, INSERT_UNORDERED_LIST_COMMAND as st } from "@lexical/list";
26
+ import { $isHeadingNode as ct, $createHeadingNode as dt } from "@lexical/rich-text";
27
+ import { $setBlocksType as ne } from "@lexical/selection";
28
+ import { $convertFromMarkdownString as mt, $convertToMarkdownString as ft } from "@lexical/markdown";
29
+ import { AutoFocusPlugin as ut } from "@lexical/react/LexicalAutoFocusPlugin";
30
+ import { CheckListPlugin as pt } from "@lexical/react/LexicalCheckListPlugin";
31
+ import { HistoryPlugin as ht } from "@lexical/react/LexicalHistoryPlugin";
32
+ import { OnChangePlugin as gt } from "@lexical/react/LexicalOnChangePlugin";
33
+ function se(o) {
34
+ const e = J();
35
+ if (!Y(e))
36
+ return null;
37
+ const i = e.anchor.getNode(), n = le(i) ? i : me(i, (a) => le(a));
38
+ if (!le(n))
39
+ return null;
40
+ const s = o.getElementByKey(n.getKey());
41
+ return s instanceof HTMLElement ? s : null;
42
+ }
43
+ function vt(o) {
44
+ return o instanceof HTMLElement ? o.closest(".rich-text__code") : null;
45
+ }
46
+ function Ct(o, e) {
47
+ const i = o.getBoundingClientRect(), n = e.getBoundingClientRect();
48
+ return {
49
+ top: n.top - i.top + 6,
50
+ left: n.right - i.left - 30
51
+ };
52
+ }
53
+ function Be(o) {
54
+ const e = ee(31), {
55
+ anchorElem: i
56
+ } = o, [n] = Le(), [s, a] = H(null), [m, d] = H(!1), c = te(null);
57
+ let v, C;
58
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = () => () => {
59
+ c.current !== null && window.clearTimeout(c.current);
60
+ }, C = [], e[0] = v, e[1] = C) : (v = e[0], C = e[1]), G(v, C);
61
+ let L, f;
62
+ e[2] !== n ? (L = () => {
63
+ const p = n.getRootElement();
64
+ if (!p)
65
+ return;
66
+ const S = (N) => {
67
+ const M = vt(N.target);
68
+ a(M instanceof HTMLElement ? M : null);
69
+ }, k = () => {
70
+ n.getEditorState().read(() => {
71
+ const N = se(n);
72
+ a(N);
73
+ });
74
+ };
75
+ return p.addEventListener("pointermove", S), p.addEventListener("pointerleave", k), () => {
76
+ p.removeEventListener("pointermove", S), p.removeEventListener("pointerleave", k);
77
+ };
78
+ }, f = [n], e[2] = n, e[3] = L, e[4] = f) : (L = e[3], f = e[4]), G(L, f);
79
+ let u, R;
80
+ if (e[5] !== n ? (u = () => Ie(n.registerUpdateListener((p) => {
81
+ const {
82
+ editorState: S
83
+ } = p;
84
+ S.read(() => {
85
+ const k = se(n);
86
+ k && a(k);
87
+ });
88
+ }), n.registerCommand(Me, () => (n.getEditorState().read(() => {
89
+ const p = se(n);
90
+ if (!p) {
91
+ a(bt);
92
+ return;
93
+ }
94
+ a(p);
95
+ }), !1), Ne)), R = [n], e[5] = n, e[6] = u, e[7] = R) : (u = e[6], R = e[7]), G(u, R), !i || !s)
96
+ return null;
97
+ let T;
98
+ e[8] !== s || e[9] !== i ? (T = Ct(i, s), e[8] = s, e[9] = i, e[10] = T) : T = e[10];
99
+ const I = T;
100
+ let E;
101
+ e[11] !== I.left || e[12] !== I.top ? (E = {
102
+ position: "absolute",
103
+ top: I.top,
104
+ left: I.left
105
+ }, e[11] = I.left, e[12] = I.top, e[13] = E) : E = e[13];
106
+ const l = E, r = m ? "Copied" : "Copy code", y = m ? "Copied" : "Copy code";
107
+ let b;
108
+ e[14] !== s.textContent ? (b = async () => {
109
+ const p = s.textContent ?? "";
110
+ try {
111
+ await navigator.clipboard.writeText(p), d(!0), c.current !== null && window.clearTimeout(c.current), c.current = window.setTimeout(() => {
112
+ d(!1);
113
+ }, 1200);
114
+ } catch {
115
+ d(!1);
116
+ }
117
+ }, e[14] = s.textContent, e[15] = b) : b = e[15];
118
+ let h;
119
+ e[16] !== m ? (h = m ? /* @__PURE__ */ t(Je, { size: 14 }) : /* @__PURE__ */ t(et, { size: 14 }), e[16] = m, e[17] = h) : h = e[17];
120
+ let g;
121
+ e[18] !== y || e[19] !== b || e[20] !== h ? (g = /* @__PURE__ */ t($, { "aria-label": y, variant: "surface", size: "xs", onClick: b, children: h }), e[18] = y, e[19] = b, e[20] = h, e[21] = g) : g = e[21];
122
+ let x;
123
+ e[22] !== g || e[23] !== r ? (x = /* @__PURE__ */ t(D, { content: r, children: g }), e[22] = g, e[23] = r, e[24] = x) : x = e[24];
124
+ let _;
125
+ e[25] !== l || e[26] !== x ? (_ = /* @__PURE__ */ t("div", { className: "code-block-actions", style: l, children: x }), e[25] = l, e[26] = x, e[27] = _) : _ = e[27];
126
+ let w;
127
+ return e[28] !== i || e[29] !== _ ? (w = Pe(_, i), e[28] = i, e[29] = _, e[30] = w) : w = e[30], w;
128
+ }
129
+ function bt(o) {
130
+ return o?.matches(":hover") ? o : null;
131
+ }
132
+ const xt = 10, Et = 5;
133
+ function pe(o, e, i, n = xt, s = Et) {
33
134
  const a = i.parentElement;
34
135
  if (o === null || !a) {
35
136
  e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)";
36
137
  return;
37
138
  }
38
- const f = e.getBoundingClientRect(), d = i.getBoundingClientRect(), s = a.getBoundingClientRect();
39
- let h = o.top - l, g = o.left - c;
40
- h < s.top && (h += f.height + o.height + l * 2), g + f.width > s.right && (g = s.right - f.width - c), h -= d.top, g -= d.left, e.style.opacity = "1", e.style.transform = `translate(${g}px, ${h}px)`;
139
+ const m = e.getBoundingClientRect(), d = i.getBoundingClientRect(), c = a.getBoundingClientRect();
140
+ let v = o.top - n, C = o.left - s;
141
+ v < c.top && (v += m.height + o.height + n * 2), C + m.width > c.right && (C = c.right - m.width - s), v -= d.top, C -= d.left, e.style.opacity = "1", e.style.transform = `translate(${C}px, ${v}px)`;
41
142
  }
42
- const lt = {
143
+ const Tt = {
43
144
  bullet: "Bulleted List",
44
145
  check: "Check List",
45
146
  code: "Code Block",
@@ -52,21 +153,34 @@ const lt = {
52
153
  number: "Numbered List",
53
154
  paragraph: "Normal",
54
155
  quote: "Quote"
55
- }, at = (o) => o in lt ? o : null, st = (o) => (o.getKey() === "root" ? o : xe(o, (i) => {
56
- const l = i.getParent();
57
- return l !== null && $e(l);
58
- })) ?? o.getTopLevelElementOrThrow(), ct = (o) => {
59
- const e = st(o);
60
- if (ee(e))
156
+ }, yt = (o) => o in Tt ? o : null, _t = (o) => (o.getKey() === "root" ? o : me(o, (i) => {
157
+ const n = i.getParent();
158
+ return n !== null && Ye(n);
159
+ })) ?? o.getTopLevelElementOrThrow(), St = (o) => {
160
+ const e = _t(o);
161
+ if (ae(e))
61
162
  return e.getListType();
62
- const i = xe(o, (c) => ee(c));
63
- if (i !== null && ee(i))
163
+ const i = me(o, (s) => ae(s));
164
+ if (i !== null && ae(i))
64
165
  return i.getListType();
65
- const l = He(e) ? e.getTag() : e.getType();
66
- return at(l);
67
- }, dt = -4;
68
- function le() {
69
- const o = Y(1);
166
+ const n = ct(e) ? e.getTag() : e.getType();
167
+ return yt(n);
168
+ };
169
+ function Rt(o) {
170
+ const {
171
+ hasSelection: e,
172
+ isRangeSelection: i,
173
+ isCollapsed: n,
174
+ hasNativeSelection: s,
175
+ hasNativeRange: a,
176
+ isAnchorInsideEditor: m,
177
+ isEditorEditable: d
178
+ } = o;
179
+ return e && i && !n && s && a && m && d;
180
+ }
181
+ const wt = -4;
182
+ function ce() {
183
+ const o = ee(1);
70
184
  let e;
71
185
  return o[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ t("span", { style: {
72
186
  display: "inline-flex",
@@ -75,106 +189,133 @@ function le() {
75
189
  borderLeft: "1px solid var(--chakra-colors-border-muted)"
76
190
  } }), o[0] = e) : e = o[0], e;
77
191
  }
78
- function mt({
192
+ function kt({
79
193
  editor: o,
80
194
  anchorElem: e,
81
195
  isToolbarActive: i,
82
- setIsToolbarActive: l
196
+ setIsToolbarActive: n
83
197
  }) {
84
- const c = J(null), [a, f] = k("paragraph"), [d, s] = k(!1), [h, g] = k(!1), [L, u] = k(!1), p = J(() => {
85
- }), R = (n) => {
198
+ const s = te(null), [a, m] = H("paragraph"), [d, c] = H(!1), [v, C] = H(!1), [L, f] = H(!1), u = te(() => {
199
+ }), R = (l) => {
86
200
  o.update(() => {
87
- const r = Q();
88
- De(r, a === n ? Ke : () => Fe(n));
201
+ const r = J();
202
+ if (Y(r)) {
203
+ if (a === l) {
204
+ ne(r, ue);
205
+ return;
206
+ }
207
+ ne(r, () => dt(l));
208
+ }
89
209
  });
90
- }, T = (n) => {
91
- if (a === n) {
92
- o.dispatchCommand(Pe, void 0);
210
+ }, T = (l) => {
211
+ if (a === l) {
212
+ o.dispatchCommand(lt, void 0);
93
213
  return;
94
214
  }
95
215
  const r = {
96
- bullet: Be,
97
- number: Ae,
98
- check: Ne
99
- }[n];
216
+ bullet: st,
217
+ number: at,
218
+ check: rt
219
+ }[l];
100
220
  o.dispatchCommand(r, void 0);
101
- }, W = () => {
102
- const n = Q();
103
- if (!te(n)) return;
104
- s(n.hasFormat("bold")), g(n.hasFormat("italic")), u(n.hasFormat("underline"));
105
- const r = ct(n.anchor.getNode());
106
- r && f(r);
221
+ }, I = () => {
222
+ o.update(() => {
223
+ const l = J();
224
+ if (Y(l)) {
225
+ if (a === "code") {
226
+ ne(l, ue);
227
+ return;
228
+ }
229
+ ne(l, () => Ge());
230
+ }
231
+ });
232
+ }, E = () => {
233
+ const l = J();
234
+ if (!Y(l)) return;
235
+ c(l.hasFormat("bold")), C(l.hasFormat("italic")), f(l.hasFormat("underline"));
236
+ const r = St(l.anchor.getNode());
237
+ r && m(r);
107
238
  };
108
- return p.current = () => {
109
- const n = Q(), r = c.current, m = window.getSelection();
239
+ return u.current = () => {
240
+ const l = J(), r = s.current, y = window.getSelection();
110
241
  if (r === null)
111
242
  return;
112
- const M = o.getRootElement();
113
- if (n !== null && te(n) && !n.isCollapsed() && m !== null && !m.isCollapsed && M?.contains(m.anchorNode) && o.isEditable()) {
114
- const b = m.getRangeAt(0).getBoundingClientRect();
115
- if (b) {
116
- const y = new DOMRect(b.left, b.bottom, 0, 0);
117
- re(y, r, e, dt);
243
+ const b = o.getRootElement(), h = y !== null, g = h && y.rangeCount > 0, x = !!b?.contains(h ? y.anchorNode : null);
244
+ if (Rt({
245
+ hasSelection: l !== null,
246
+ isRangeSelection: Y(l),
247
+ isCollapsed: Y(l) ? l.isCollapsed() : !1,
248
+ hasNativeSelection: h,
249
+ hasNativeRange: g,
250
+ isAnchorInsideEditor: x,
251
+ isEditorEditable: o.isEditable()
252
+ }) && y) {
253
+ const _ = y.getRangeAt(0).getBoundingClientRect();
254
+ if (_) {
255
+ const w = new DOMRect(_.left, _.bottom, 0, 0);
256
+ pe(w, r, e, wt);
118
257
  }
119
- l(!0);
258
+ n(!0);
120
259
  } else
121
- M !== null && re(null, r, e), l(!1);
122
- return W(), !0;
260
+ b !== null && pe(null, r, e), n(!1);
261
+ return E(), !0;
123
262
  }, G(() => {
124
- const n = e.parentElement, r = () => {
263
+ const l = e.parentElement, r = () => {
125
264
  o.getEditorState().read(() => {
126
- p.current();
265
+ u.current();
127
266
  });
128
267
  };
129
- return window.addEventListener("resize", r), n && n.addEventListener("scroll", r), () => {
130
- window.removeEventListener("resize", r), n && n.removeEventListener("scroll", r);
268
+ return window.addEventListener("resize", r), l && l.addEventListener("scroll", r), () => {
269
+ window.removeEventListener("resize", r), l && l.removeEventListener("scroll", r);
131
270
  };
132
- }, [e, o]), G(() => ze(o.registerUpdateListener(({
133
- editorState: n
271
+ }, [e, o]), G(() => Ie(o.registerUpdateListener(({
272
+ editorState: l
134
273
  }) => {
135
- n.read(() => {
136
- p.current();
274
+ l.read(() => {
275
+ u.current();
137
276
  });
138
- }), o.registerCommand(je, (n) => (p.current(), !1), We), o.registerCommand(Ue, (n) => {
139
- const r = Q();
140
- return te(r) && p.current(), !1;
141
- }, qe)), [o]), /* @__PURE__ */ t("div", { ref: c, className: `floating-text-format-toolbar ${i ? "active" : ""}`, children: /* @__PURE__ */ Z(we, { direction: "row", gap: "0.5", alignItems: "center", children: [
142
- /* @__PURE__ */ t(z, { content: "Bold", children: /* @__PURE__ */ t(D, { "data-active": d || void 0, onClick: () => {
143
- o.dispatchCommand(oe, "bold");
144
- }, variant: "ghost", "aria-label": "Bold", size: "xs", children: /* @__PURE__ */ t(K, { fontWeight: "bold", fontSize: ".75rem", children: "B" }) }) }),
145
- /* @__PURE__ */ t(z, { content: "Italic", children: /* @__PURE__ */ t(D, { "data-active": h || void 0, onClick: () => {
146
- o.dispatchCommand(oe, "italic");
147
- }, variant: "ghost", "aria-label": "Italic", size: "xs", children: /* @__PURE__ */ t(K, { fontStyle: "italic", fontSize: ".75rem", children: "I" }) }) }),
148
- /* @__PURE__ */ t(z, { content: "Underline", children: /* @__PURE__ */ t(D, { "data-active": L || void 0, onClick: () => {
149
- o.dispatchCommand(oe, "underline");
150
- }, variant: "ghost", "aria-label": "Underline", size: "xs", children: /* @__PURE__ */ t(K, { textDecoration: "underline", fontSize: ".75rem", children: "U" }) }) }),
151
- /* @__PURE__ */ t(le, {}),
152
- /* @__PURE__ */ t(z, { content: "Heading 1", children: /* @__PURE__ */ t(D, { "data-active": a === "h1" || void 0, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: () => {
277
+ }), o.registerCommand(Me, (l) => (u.current(), !1), Ne), o.registerCommand(Xe, (l) => {
278
+ const r = J();
279
+ return Y(r) && u.current(), !1;
280
+ }, Qe)), [o]), /* @__PURE__ */ t("div", { ref: s, className: `floating-text-format-toolbar ${i ? "active" : ""}`, children: /* @__PURE__ */ ie(We, { direction: "row", gap: "0.5", alignItems: "center", children: [
281
+ /* @__PURE__ */ t(D, { content: "Bold", children: /* @__PURE__ */ t($, { "data-active": d || void 0, onClick: () => {
282
+ o.dispatchCommand(re, "bold");
283
+ }, variant: "ghost", "aria-label": "Bold", size: "xs", children: /* @__PURE__ */ t(Z, { fontWeight: "bold", fontSize: ".75rem", children: "B" }) }) }),
284
+ /* @__PURE__ */ t(D, { content: "Italic", children: /* @__PURE__ */ t($, { "data-active": v || void 0, onClick: () => {
285
+ o.dispatchCommand(re, "italic");
286
+ }, variant: "ghost", "aria-label": "Italic", size: "xs", children: /* @__PURE__ */ t(Z, { fontStyle: "italic", fontSize: ".75rem", children: "I" }) }) }),
287
+ /* @__PURE__ */ t(D, { content: "Underline", children: /* @__PURE__ */ t($, { "data-active": L || void 0, onClick: () => {
288
+ o.dispatchCommand(re, "underline");
289
+ }, variant: "ghost", "aria-label": "Underline", size: "xs", children: /* @__PURE__ */ t(Z, { textDecoration: "underline", fontSize: ".75rem", children: "U" }) }) }),
290
+ /* @__PURE__ */ t(ce, {}),
291
+ /* @__PURE__ */ t(D, { content: "Heading 1", children: /* @__PURE__ */ t($, { "data-active": a === "h1" || void 0, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: () => {
153
292
  R("h1");
154
- }, children: /* @__PURE__ */ t(K, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }) }) }),
155
- /* @__PURE__ */ t(z, { content: "Heading 2", children: /* @__PURE__ */ t(D, { "data-active": a === "h2" || void 0, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: () => {
293
+ }, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }) }) }),
294
+ /* @__PURE__ */ t(D, { content: "Heading 2", children: /* @__PURE__ */ t($, { "data-active": a === "h2" || void 0, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: () => {
156
295
  R("h2");
157
- }, children: /* @__PURE__ */ t(K, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }) }) }),
158
- /* @__PURE__ */ t(z, { content: "Heading 3", children: /* @__PURE__ */ t(D, { "data-active": a === "h3" || void 0, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: () => {
296
+ }, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }) }) }),
297
+ /* @__PURE__ */ t(D, { content: "Heading 3", children: /* @__PURE__ */ t($, { "data-active": a === "h3" || void 0, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: () => {
159
298
  R("h3");
160
- }, children: /* @__PURE__ */ t(K, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }) }) }),
161
- /* @__PURE__ */ t(le, {}),
162
- /* @__PURE__ */ t(z, { content: "Bulleted List", children: /* @__PURE__ */ t(D, { "data-active": a === "bullet" || void 0, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: () => T("bullet"), children: /* @__PURE__ */ t(Ge, { size: 14 }) }) }),
163
- /* @__PURE__ */ t(z, { content: "Numbered List", children: /* @__PURE__ */ t(D, { "data-active": a === "number" || void 0, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: () => T("number"), children: /* @__PURE__ */ t(Ye, { size: 14 }) }) }),
164
- /* @__PURE__ */ t(z, { content: "Check List", children: /* @__PURE__ */ t(D, { "data-active": a === "check" || void 0, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: () => T("check"), children: /* @__PURE__ */ t(Xe, { size: 14 }) }) })
299
+ }, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }) }) }),
300
+ /* @__PURE__ */ t(ce, {}),
301
+ /* @__PURE__ */ t(D, { content: "Code Block", children: /* @__PURE__ */ t($, { "data-active": a === "code" || void 0, variant: "ghost", "aria-label": "Code Block", size: "xs", onClick: I, children: /* @__PURE__ */ t(tt, { size: 14 }) }) }),
302
+ /* @__PURE__ */ t(ce, {}),
303
+ /* @__PURE__ */ t(D, { content: "Bulleted List", children: /* @__PURE__ */ t($, { "data-active": a === "bullet" || void 0, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: () => T("bullet"), children: /* @__PURE__ */ t(ot, { size: 14 }) }) }),
304
+ /* @__PURE__ */ t(D, { content: "Numbered List", children: /* @__PURE__ */ t($, { "data-active": a === "number" || void 0, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: () => T("number"), children: /* @__PURE__ */ t(nt, { size: 14 }) }) }),
305
+ /* @__PURE__ */ t(D, { content: "Check List", children: /* @__PURE__ */ t($, { "data-active": a === "check" || void 0, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: () => T("check"), children: /* @__PURE__ */ t(it, { size: 14 }) }) })
165
306
  ] }) });
166
307
  }
167
- function Ce(o) {
168
- const e = Y(7), {
308
+ function Ae(o) {
309
+ const e = ee(7), {
169
310
  anchorElem: i
170
- } = o, l = i === void 0 ? document.body : i, [c] = Oe(), [a, f] = k(!1);
311
+ } = o, n = i === void 0 ? document.body : i, [s] = Le(), [a, m] = H(!1);
171
312
  let d;
172
- e[0] !== l || e[1] !== c || e[2] !== a ? (d = /* @__PURE__ */ t(mt, { editor: c, anchorElem: l, isToolbarActive: a, setIsToolbarActive: f }), e[0] = l, e[1] = c, e[2] = a, e[3] = d) : d = e[3];
173
- let s;
174
- return e[4] !== l || e[5] !== d ? (s = Qe(d, l), e[4] = l, e[5] = d, e[6] = s) : s = e[6], s;
313
+ e[0] !== n || e[1] !== s || e[2] !== a ? (d = /* @__PURE__ */ t(kt, { editor: s, anchorElem: n, isToolbarActive: a, setIsToolbarActive: m }), e[0] = n, e[1] = s, e[2] = a, e[3] = d) : d = e[3];
314
+ let c;
315
+ return e[4] !== n || e[5] !== d ? (c = Pe(d, n), e[4] = n, e[5] = d, e[6] = c) : c = e[6], c;
175
316
  }
176
- function ft() {
177
- const o = Y(1);
317
+ function Lt() {
318
+ const o = ee(1);
178
319
  let e;
179
320
  return o[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ t("style", { children: `
180
321
  .collaboration-cursor-container {
@@ -212,165 +353,183 @@ function ft() {
212
353
  }
213
354
  ` }), o[0] = e) : e = o[0], e;
214
355
  }
215
- function qt(o) {
216
- const e = Y(37), {
356
+ function mo(o) {
357
+ const e = ee(42), {
217
358
  roomId: i,
218
- wsUrl: l,
219
- wsParams: c,
359
+ wsUrl: n,
360
+ wsParams: s,
220
361
  userName: a,
221
- userColor: f,
362
+ userColor: m,
222
363
  placeholder: d
223
364
  } = o;
224
- let s;
225
- e[0] !== c ? (s = c === void 0 ? {} : c, e[0] = c, e[1] = s) : s = e[1];
226
- const h = s, g = a === void 0 ? "Anonymous" : a, L = f === void 0 ? "#30bced" : f, u = J(null), [p, R] = k(null), [T, W] = k(!1), [n] = k(pt);
227
- let r;
228
- e[2] !== n || e[3] !== i || e[4] !== h || e[5] !== l ? (r = () => {
229
- const F = new Me(l, i, n, {
230
- params: h,
365
+ let c;
366
+ e[0] !== s ? (c = s === void 0 ? {} : s, e[0] = s, e[1] = c) : c = e[1];
367
+ const v = c, C = a === void 0 ? "Anonymous" : a, L = m === void 0 ? "#30bced" : m, f = te(null), [u, R] = H(null), [T, I] = H(!1), [E] = H(Mt);
368
+ let l;
369
+ e[2] !== E || e[3] !== i || e[4] !== v || e[5] !== n ? (l = () => {
370
+ const q = new qe(n, i, E, {
371
+ params: v,
231
372
  connect: !1
232
373
  });
233
- return F.on("sync", (j) => {
234
- j && W(!0);
235
- }), F;
236
- }, e[2] = n, e[3] = i, e[4] = h, e[5] = l, e[6] = r) : r = e[6];
237
- const [m] = k(r);
238
- let M, b;
239
- e[7] !== m ? (M = () => (m.connect(), () => {
240
- m.disconnect();
241
- }), b = [m], e[7] = m, e[8] = M, e[9] = b) : (M = e[8], b = e[9]), G(M, b);
242
- let y, E;
243
- e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = () => {
244
- R(u.current);
245
- }, E = [], e[10] = y, e[11] = E) : (y = e[10], E = e[11]), G(y, E);
246
- let I;
247
- e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (I = {
374
+ return q.on("sync", (V) => {
375
+ V && I(!0);
376
+ }), q;
377
+ }, e[2] = E, e[3] = i, e[4] = v, e[5] = n, e[6] = l) : l = e[6];
378
+ const [r] = H(l);
379
+ let y, b;
380
+ e[7] !== r ? (y = () => (r.connect(), () => {
381
+ r.disconnect();
382
+ }), b = [r], e[7] = r, e[8] = y, e[9] = b) : (y = e[8], b = e[9]), G(y, b);
383
+ let h, g;
384
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = () => {
385
+ R(f.current);
386
+ }, g = [], e[10] = h, e[11] = g) : (h = e[10], g = e[11]), G(h, g);
387
+ let x;
388
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = {
248
389
  namespace: "COLLABORATIVE_EDITOR",
249
- nodes: se,
390
+ nodes: ge,
250
391
  editorState: null,
251
- onError: ut,
392
+ onError: It,
252
393
  editable: !0,
253
- theme: ae
254
- }, e[12] = I) : I = e[12];
255
- const V = I;
256
- let $;
257
- e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ t(ft, {}), e[13] = $) : $ = e[13];
258
- const w = m;
259
- let _;
260
- e[14] !== n || e[15] !== i || e[16] !== w || e[17] !== L || e[18] !== g ? (_ = /* @__PURE__ */ t(Le, { id: i, doc: n, provider: w, __shouldBootstrapUnsafe: !1, username: g, cursorColor: L }), e[14] = n, e[15] = i, e[16] = w, e[17] = L, e[18] = g, e[19] = _) : _ = e[19];
261
- let P, N, A, B, O;
262
- e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ t(ge, {}), N = /* @__PURE__ */ t(be, {}), A = /* @__PURE__ */ t(he, {}), B = /* @__PURE__ */ t(ce, {}), O = /* @__PURE__ */ t(de, {}), e[20] = P, e[21] = N, e[22] = A, e[23] = B, e[24] = O) : (P = e[20], N = e[21], A = e[22], B = e[23], O = e[24]);
263
- let H;
264
- e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (H = /* @__PURE__ */ t(me, { fullWidth: !1 }), e[25] = H) : H = e[25];
265
- let v;
266
- e[26] !== d || e[27] !== T ? (v = T && d ? /* @__PURE__ */ t(fe, { position: "absolute", top: "0", color: "fg.muted", pointerEvents: "none", userSelect: "none", textStyle: "paragraph/M/regular", children: d }) : null, e[26] = d, e[27] = T, e[28] = v) : v = e[28];
267
- let x;
268
- e[29] !== v ? (x = /* @__PURE__ */ t(ve, { contentEditable: H, placeholder: v, ErrorBoundary: pe }), e[29] = v, e[30] = x) : x = e[30];
269
- let C;
270
- e[31] !== p ? (C = p ? /* @__PURE__ */ t(Ce, { anchorElem: p }) : null, e[31] = p, e[32] = C) : C = e[32];
394
+ theme: he
395
+ }, e[12] = x) : x = e[12];
396
+ const _ = x;
397
+ let w;
398
+ e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ t(Lt, {}), e[13] = w) : w = e[13];
399
+ const p = r;
271
400
  let S;
272
- return e[33] !== _ || e[34] !== x || e[35] !== C ? (S = /* @__PURE__ */ Z(ne, { ref: u, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "visible", children: [
273
- $,
274
- /* @__PURE__ */ t(ue, { initialConfig: V, children: /* @__PURE__ */ Z(ke, { children: [
275
- _,
276
- P,
401
+ e[14] !== E || e[15] !== i || e[16] !== p || e[17] !== L || e[18] !== C ? (S = /* @__PURE__ */ t(Ke, { id: i, doc: E, provider: p, __shouldBootstrapUnsafe: !1, username: C, cursorColor: L }), e[14] = E, e[15] = i, e[16] = p, e[17] = L, e[18] = C, e[19] = S) : S = e[19];
402
+ let k, N, M, j, W, U;
403
+ e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ t(Se, {}), N = /* @__PURE__ */ t(Re, {}), M = /* @__PURE__ */ t(ke, { maxIndent: 7 }), j = /* @__PURE__ */ t(_e, {}), W = /* @__PURE__ */ t(ve, {}), U = /* @__PURE__ */ t(Ce, {}), e[20] = k, e[21] = N, e[22] = M, e[23] = j, e[24] = W, e[25] = U) : (k = e[20], N = e[21], M = e[22], j = e[23], W = e[24], U = e[25]);
404
+ let z;
405
+ e[26] !== u ? (z = /* @__PURE__ */ t(Be, { anchorElem: u }), e[26] = u, e[27] = z) : z = e[27];
406
+ let O;
407
+ e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ t(be, {}), e[28] = O) : O = e[28];
408
+ let K;
409
+ e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ t(xe, { fullWidth: !1 }), e[29] = K) : K = e[29];
410
+ let P;
411
+ e[30] !== d || e[31] !== T ? (P = T && d ? /* @__PURE__ */ t(Ee, { position: "absolute", top: "0", color: "fg.muted", pointerEvents: "none", userSelect: "none", textStyle: "paragraph/M/regular", children: d }) : null, e[30] = d, e[31] = T, e[32] = P) : P = e[32];
412
+ let B;
413
+ e[33] !== P ? (B = /* @__PURE__ */ t(we, { contentEditable: K, placeholder: P, ErrorBoundary: ye }), e[33] = P, e[34] = B) : B = e[34];
414
+ let A;
415
+ e[35] !== u ? (A = u ? /* @__PURE__ */ t(Ae, { anchorElem: u }) : null, e[35] = u, e[36] = A) : A = e[36];
416
+ let F;
417
+ return e[37] !== S || e[38] !== z || e[39] !== B || e[40] !== A ? (F = /* @__PURE__ */ ie(de, { ref: f, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "visible", children: [
418
+ w,
419
+ /* @__PURE__ */ t(Te, { initialConfig: _, children: /* @__PURE__ */ ie(Ue, { children: [
420
+ S,
421
+ k,
277
422
  N,
278
- A,
279
- B,
423
+ M,
424
+ j,
425
+ W,
426
+ U,
427
+ z,
280
428
  O,
281
- x,
282
- C
429
+ B,
430
+ A
283
431
  ] }) })
284
- ] }), e[33] = _, e[34] = x, e[35] = C, e[36] = S) : S = e[36], S;
432
+ ] }), e[37] = S, e[38] = z, e[39] = B, e[40] = A, e[41] = F) : F = e[41], F;
285
433
  }
286
- function ut(o) {
434
+ function It(o) {
287
435
  return console.error(o);
288
436
  }
289
- function pt() {
290
- return new Ie.Doc();
437
+ function Mt() {
438
+ return new Ve.Doc();
291
439
  }
292
- function Kt(o) {
293
- const e = Y(47), {
440
+ function fo(o) {
441
+ const e = ee(54), {
294
442
  autoFocus: i,
295
- debug: l,
296
- defaultState: c,
443
+ debug: n,
444
+ defaultState: s,
297
445
  isEditable: a,
298
- placeholder: f,
446
+ placeholder: m,
299
447
  scrollable: d,
300
- onChange: s
301
- } = o, h = i === void 0 ? !1 : i, g = l === void 0 ? !1 : l, L = c === void 0 ? "" : c, u = a === void 0 ? !1 : a, p = d === void 0 ? !0 : d;
448
+ onChange: c
449
+ } = o, v = i === void 0 ? !1 : i, C = n === void 0 ? !1 : n, L = s === void 0 ? "" : s, f = a === void 0 ? !1 : a, u = d === void 0 ? !0 : d;
302
450
  let R;
303
- e[0] !== L ? (R = _e(L), e[0] = L, e[1] = R) : R = e[1];
451
+ e[0] !== L ? (R = Fe(L), e[0] = L, e[1] = R) : R = e[1];
304
452
  const {
305
453
  frontmatter: T,
306
- body: W
307
- } = R, n = u && !!s, r = J(null), [m, M] = k(null);
308
- let b, y;
454
+ body: I
455
+ } = R, E = f && !!c, l = te(null), [r, y] = H(null);
456
+ let b, h;
309
457
  e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = () => {
310
- M(r.current);
311
- }, y = [], e[2] = b, e[3] = y) : (b = e[2], y = e[3]), G(b, y);
312
- let E;
313
- e[4] !== W ? (E = () => Ze(W, ie, void 0, !1), e[4] = W, e[5] = E) : E = e[5];
314
- let I;
315
- e[6] !== u || e[7] !== E ? (I = {
316
- namespace: "MARKDOWN_EDITOR",
317
- nodes: se,
318
- editorState: E,
319
- onError: ht,
320
- editable: u,
321
- theme: ae
322
- }, e[6] = u, e[7] = E, e[8] = I) : I = e[8];
323
- const V = I, $ = p ? "100%" : "auto";
324
- let w;
325
- e[9] !== h ? (w = h ? /* @__PURE__ */ t(et, {}) : null, e[9] = h, e[10] = w) : w = e[10];
326
- let _, P, N, A, B, O, H;
327
- e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ t(ot, {}), P = /* @__PURE__ */ t(ge, {}), N = /* @__PURE__ */ t(be, {}), A = /* @__PURE__ */ t(tt, {}), B = /* @__PURE__ */ t(he, {}), O = /* @__PURE__ */ t(ce, {}), H = /* @__PURE__ */ t(de, {}), e[11] = _, e[12] = P, e[13] = N, e[14] = A, e[15] = B, e[16] = O, e[17] = H) : (_ = e[11], P = e[12], N = e[13], A = e[14], B = e[15], O = e[16], H = e[17]);
328
- let v;
329
- e[18] !== p ? (v = /* @__PURE__ */ t(me, { fullWidth: !1, padding: "sm", scrollable: p }), e[18] = p, e[19] = v) : v = e[19];
458
+ y(l.current);
459
+ }, h = [], e[2] = b, e[3] = h) : (b = e[2], h = e[3]), G(b, h);
460
+ let g;
461
+ e[4] !== I ? (g = () => mt($e(I), fe, void 0, !1), e[4] = I, e[5] = g) : g = e[5];
330
462
  let x;
331
- e[20] !== f ? (x = f ? /* @__PURE__ */ t(ne, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ t(fe, { width: "100%", maxWidth: "720px", color: "fg.muted", textStyle: "paragraph/M/regular", children: f }) }) : null, e[20] = f, e[21] = x) : x = e[21];
332
- let C;
333
- e[22] !== v || e[23] !== x ? (C = /* @__PURE__ */ t(ve, { contentEditable: v, placeholder: x, ErrorBoundary: pe }), e[22] = v, e[23] = x, e[24] = C) : C = e[24];
334
- let S;
335
- e[25] !== m || e[26] !== u ? (S = u && m ? /* @__PURE__ */ t(Ce, { anchorElem: m }) : null, e[25] = m, e[26] = u, e[27] = S) : S = e[27];
463
+ e[6] !== f || e[7] !== g ? (x = {
464
+ namespace: "MARKDOWN_EDITOR",
465
+ nodes: ge,
466
+ editorState: g,
467
+ onError: Nt,
468
+ editable: f,
469
+ theme: he
470
+ }, e[6] = f, e[7] = g, e[8] = x) : x = e[8];
471
+ const _ = x, w = u ? "100%" : "auto";
472
+ let p;
473
+ e[9] !== v ? (p = v ? /* @__PURE__ */ t(ut, {}) : null, e[9] = v, e[10] = p) : p = e[10];
474
+ let S, k, N;
475
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ t(ht, {}), k = /* @__PURE__ */ t(Se, {}), N = /* @__PURE__ */ t(Re, {}), e[11] = S, e[12] = k, e[13] = N) : (S = e[11], k = e[12], N = e[13]);
476
+ let M;
477
+ e[14] !== f ? (M = f ? /* @__PURE__ */ t(ke, { maxIndent: 7 }) : null, e[14] = f, e[15] = M) : M = e[15];
478
+ let j, W, U, z;
479
+ e[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ t(pt, {}), W = /* @__PURE__ */ t(_e, {}), U = /* @__PURE__ */ t(ve, {}), z = /* @__PURE__ */ t(Ce, {}), e[16] = j, e[17] = W, e[18] = U, e[19] = z) : (j = e[16], W = e[17], U = e[18], z = e[19]);
480
+ let O;
481
+ e[20] !== r ? (O = /* @__PURE__ */ t(Be, { anchorElem: r }), e[20] = r, e[21] = O) : O = e[21];
482
+ let K;
483
+ e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ t(be, {}), e[22] = K) : K = e[22];
484
+ let P;
485
+ e[23] !== u ? (P = /* @__PURE__ */ t(xe, { fullWidth: !1, padding: "sm", scrollable: u }), e[23] = u, e[24] = P) : P = e[24];
486
+ let B;
487
+ e[25] !== m ? (B = m ? /* @__PURE__ */ t(de, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ t(Ee, { width: "100%", maxWidth: "720px", color: "fg.muted", textStyle: "paragraph/M/regular", children: m }) }) : null, e[25] = m, e[26] = B) : B = e[26];
488
+ let A;
489
+ e[27] !== P || e[28] !== B ? (A = /* @__PURE__ */ t(we, { contentEditable: P, placeholder: B, ErrorBoundary: ye }), e[27] = P, e[28] = B, e[29] = A) : A = e[29];
336
490
  let F;
337
- e[28] !== T || e[29] !== s || e[30] !== n ? (F = n ? /* @__PURE__ */ t(nt, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (Te) => {
338
- Te.read(() => {
339
- const ye = Ve(), Ee = Je(ie, ye);
340
- s?.(T + Ee);
341
- });
342
- } }) : null, e[28] = T, e[29] = s, e[30] = n, e[31] = F) : F = e[31];
343
- let j;
344
- e[32] !== u ? (j = /* @__PURE__ */ t(Se, { isEditable: u }), e[32] = u, e[33] = j) : j = e[33];
345
- let U;
346
- e[34] !== g ? (U = g && /* @__PURE__ */ t(Re, {}), e[34] = g, e[35] = U) : U = e[35];
491
+ e[30] !== r || e[31] !== f ? (F = f && r ? /* @__PURE__ */ t(Ae, { anchorElem: r }) : null, e[30] = r, e[31] = f, e[32] = F) : F = e[32];
347
492
  let q;
348
- e[36] !== V || e[37] !== w || e[38] !== C || e[39] !== S || e[40] !== F || e[41] !== j || e[42] !== U ? (q = /* @__PURE__ */ Z(ue, { initialConfig: V, children: [
349
- w,
350
- _,
351
- P,
493
+ e[33] !== T || e[34] !== c || e[35] !== E ? (q = E ? /* @__PURE__ */ t(gt, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (He) => {
494
+ He.read(() => {
495
+ const ze = Ze(), Oe = ft(fe, ze);
496
+ c?.(T + Oe);
497
+ });
498
+ } }) : null, e[33] = T, e[34] = c, e[35] = E, e[36] = q) : q = e[36];
499
+ let V;
500
+ e[37] !== f ? (V = /* @__PURE__ */ t(De, { isEditable: f }), e[37] = f, e[38] = V) : V = e[38];
501
+ let X;
502
+ e[39] !== C ? (X = C && /* @__PURE__ */ t(je, {}), e[39] = C, e[40] = X) : X = e[40];
503
+ let Q;
504
+ e[41] !== _ || e[42] !== p || e[43] !== M || e[44] !== O || e[45] !== A || e[46] !== F || e[47] !== q || e[48] !== V || e[49] !== X ? (Q = /* @__PURE__ */ ie(Te, { initialConfig: _, children: [
505
+ p,
506
+ S,
507
+ k,
352
508
  N,
353
- A,
354
- B,
509
+ M,
510
+ j,
511
+ W,
512
+ U,
513
+ z,
355
514
  O,
356
- H,
357
- C,
358
- S,
515
+ K,
516
+ A,
359
517
  F,
360
- j,
361
- U
362
- ] }), e[36] = V, e[37] = w, e[38] = C, e[39] = S, e[40] = F, e[41] = j, e[42] = U, e[43] = q) : q = e[43];
363
- let X;
364
- return e[44] !== $ || e[45] !== q ? (X = /* @__PURE__ */ t(ne, { ref: r, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: $, position: "relative", direction: "column", overflow: "visible", children: q }), e[44] = $, e[45] = q, e[46] = X) : X = e[46], X;
518
+ q,
519
+ V,
520
+ X
521
+ ] }), e[41] = _, e[42] = p, e[43] = M, e[44] = O, e[45] = A, e[46] = F, e[47] = q, e[48] = V, e[49] = X, e[50] = Q) : Q = e[50];
522
+ let oe;
523
+ return e[51] !== w || e[52] !== Q ? (oe = /* @__PURE__ */ t(de, { ref: l, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: w, position: "relative", direction: "column", overflow: "visible", children: Q }), e[51] = w, e[52] = Q, e[53] = oe) : oe = e[53], oe;
365
524
  }
366
- function ht(o) {
525
+ function Nt(o) {
367
526
  return console.error(o);
368
527
  }
369
- function Vt(o) {
528
+ function uo(o) {
370
529
  const e = o.toLowerCase().trim();
371
530
  return e ? e.startsWith("image/") ? "image" : e === "application/pdf" ? "pdf" : e === "text/markdown" ? "markdown" : e === "text/csv" || e === "text/tab-separated-values" ? "table" : e === "application/json" ? "json" : (e.startsWith("text/") || e.startsWith("application/"), "text") : "text";
372
531
  }
373
- const gt = {
532
+ const Pt = {
374
533
  csv: "text/csv",
375
534
  tsv: "text/tab-separated-values",
376
535
  json: "application/json",
@@ -394,21 +553,21 @@ const gt = {
394
553
  yml: "text/yaml",
395
554
  yaml: "text/yaml"
396
555
  };
397
- function Gt(o) {
556
+ function po(o) {
398
557
  const i = (o.split("?")[0]?.split("#")[0] ?? "").split(".").pop()?.toLowerCase();
399
- return i ? gt[i] ?? null : null;
558
+ return i ? Pt[i] ?? null : null;
400
559
  }
401
560
  export {
402
- qt as CollaborativeMarkdownEditor,
403
- Qt as DefaultRichTextCodeEditor,
404
- Zt as DefaultRichTextDataTable,
405
- Kt as MarkdownEditor,
406
- Jt as MarkdownPreview,
407
- eo as PromptEditor,
408
- to as RichMessage,
409
- oo as generateEditorStateFromString,
410
- no as getTextFromSerializedEditorState,
411
- Vt as inferResourceTypeFromMediaType,
412
- Gt as mediaTypeFromPath
561
+ mo as CollaborativeMarkdownEditor,
562
+ vo as DefaultRichTextCodeEditor,
563
+ Co as DefaultRichTextDataTable,
564
+ fo as MarkdownEditor,
565
+ bo as MarkdownPreview,
566
+ xo as PromptEditor,
567
+ Eo as RichMessage,
568
+ To as generateEditorStateFromString,
569
+ yo as getTextFromSerializedEditorState,
570
+ uo as inferResourceTypeFromMediaType,
571
+ po as mediaTypeFromPath
413
572
  };
414
573
  //# sourceMappingURL=rich-text.js.map