@pstdio/ui 0.21.0 → 0.22.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-BVMyKttu.js → MermaidComponent-D92GMhht.js} +3 -3
  2. package/dist/{MermaidComponent-BVMyKttu.js.map → MermaidComponent-D92GMhht.js.map} +1 -1
  3. package/dist/chat-ui.d.ts +2 -0
  4. package/dist/chat-ui.js +2 -2
  5. package/dist/components/data-table/build-columns.d.ts +1 -0
  6. package/dist/components/data-table/data-table-column-menu.d.ts +2 -0
  7. package/dist/components/data-table/data-table-row-display.d.ts +11 -0
  8. package/dist/components/data-table/data-table-table-parts.d.ts +1 -0
  9. package/dist/components/data-table/edit-mode-data-table-body.d.ts +1 -0
  10. package/dist/components/data-table/edit-mode-data-table-cell.d.ts +1 -0
  11. package/dist/components/data-table/edit-mode-data-table-header.d.ts +1 -0
  12. package/dist/components/diff-viewer/code-editor.d.ts +8 -2
  13. package/dist/components/kanban-renderer/collection-badge.d.ts +7 -0
  14. package/dist/components/kanban-renderer/index.d.ts +1 -1
  15. package/dist/components/kanban-renderer/kanban-renderer-helpers.d.ts +2 -1
  16. package/dist/components/kanban-renderer/types.d.ts +20 -1
  17. package/dist/components/list-row/list-row-content.d.ts +1 -0
  18. package/dist/components/param-editor/param-editor-presentation.d.ts +1 -1
  19. package/dist/components/param-editor/param-editor.types.d.ts +5 -193
  20. package/dist/components/rich-text/shared/markdown-ast.d.ts +1 -0
  21. package/dist/components/rich-text/shared/markdown-source-document.d.ts +7 -0
  22. package/dist/components/rich-text/shared/markdown-source-links.d.ts +11 -0
  23. package/dist/components/rich-text/shared/markdown-source-map.d.ts +10 -0
  24. package/dist/components/rich-text/utils/inferResourceType.d.ts +1 -1
  25. package/dist/components/tag-editor/tag-editor-row.d.ts +1 -1
  26. package/dist/components/tag-editor/tag-editor.types.d.ts +12 -0
  27. package/dist/components/tag-editor/tag-settings-panel.d.ts +1 -1
  28. package/dist/components/tree-list/tree-list-drag-provider.d.ts +13 -0
  29. package/dist/components/tree-list/tree-list-order.store.d.ts +4 -1
  30. package/dist/components/tree-list/tree-list-reorder.d.ts +14 -3
  31. package/dist/components/tree-list/tree-list-sortable.d.ts +2 -0
  32. package/dist/components/tree-list/tree-list-visibility-filter.d.ts +2 -2
  33. package/dist/components/tree-list/tree-list.d.ts +3 -0
  34. package/dist/components/tree-list/tree-list.types.d.ts +4 -0
  35. package/dist/data-table.d.ts +2 -0
  36. package/dist/data-table.js +806 -793
  37. package/dist/data-table.js.map +1 -1
  38. package/dist/diff.d.ts +2 -0
  39. package/dist/diff.js +529 -533
  40. package/dist/diff.js.map +1 -1
  41. package/dist/edit-mode-data-table-DGgRuSW3.js +846 -0
  42. package/dist/edit-mode-data-table-DGgRuSW3.js.map +1 -0
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.js +1516 -1413
  45. package/dist/index.js.map +1 -1
  46. package/dist/{kanban-renderer-toolbar-CpegGbwq.js → kanban-renderer-toolbar-Bl8xXdwU.js} +527 -469
  47. package/dist/kanban-renderer-toolbar-Bl8xXdwU.js.map +1 -0
  48. package/dist/kanban-renderer.d.ts +2 -0
  49. package/dist/kanban-renderer.js +21 -21
  50. package/dist/kanban-renderer.js.map +1 -1
  51. package/dist/lazy-markdown-editor-CCOchoJX.js +235 -0
  52. package/dist/lazy-markdown-editor-CCOchoJX.js.map +1 -0
  53. package/dist/list-row-DCgdza1i.js +812 -0
  54. package/dist/list-row-DCgdza1i.js.map +1 -0
  55. package/dist/markdown-CASvn1Z2.js +1643 -0
  56. package/dist/markdown-CASvn1Z2.js.map +1 -0
  57. package/dist/markdown-editor-C4GCyebp.js +1019 -0
  58. package/dist/markdown-editor-C4GCyebp.js.map +1 -0
  59. package/dist/{mermaid-renderer-H3IhLqnQ.js → mermaid-renderer-CVnuKs-A.js} +2 -2
  60. package/dist/{mermaid-renderer-H3IhLqnQ.js.map → mermaid-renderer-CVnuKs-A.js.map} +1 -1
  61. package/dist/mermaid.d.ts +2 -0
  62. package/dist/mermaid.js +1 -1
  63. package/dist/monaco-browser-CgvlArN7.js +21 -0
  64. package/dist/monaco-browser-CgvlArN7.js.map +1 -0
  65. package/dist/{param-editor-B8Ff9Nm8.js → param-editor-CkDq623X.js} +2 -2
  66. package/dist/{param-editor-B8Ff9Nm8.js.map → param-editor-CkDq623X.js.map} +1 -1
  67. package/dist/param-editor-field-DRgbnL7-.js +2809 -0
  68. package/dist/param-editor-field-DRgbnL7-.js.map +1 -0
  69. package/dist/rich-message-DARuDVOX.js +628 -0
  70. package/dist/{rich-message-DdFYRzTo.js.map → rich-message-DARuDVOX.js.map} +1 -1
  71. package/dist/rich-text.d.ts +2 -0
  72. package/dist/rich-text.js +48 -47
  73. package/dist/rich-text.js.map +1 -1
  74. package/dist/style.css +1 -1
  75. package/dist/terminal.d.ts +2 -0
  76. package/dist/theme/primitives/sizes.d.ts +9 -0
  77. package/dist/{theme-BH4fSst9.js → theme-B-l5_a6F.js} +69 -50
  78. package/dist/theme-B-l5_a6F.js.map +1 -0
  79. package/dist/theme-preference-Bpobguh4.js +114 -0
  80. package/dist/theme-preference-Bpobguh4.js.map +1 -0
  81. package/dist/theme.d.ts +2 -0
  82. package/dist/theme.js +1 -1
  83. package/dist/tree-list-AlO5ZmxQ.js +1262 -0
  84. package/dist/tree-list-AlO5ZmxQ.js.map +1 -0
  85. package/dist/utils/theme-preference.d.ts +4 -1
  86. package/dist/workspace-badge-BR_GgsAG.js +175 -0
  87. package/dist/workspace-badge-BR_GgsAG.js.map +1 -0
  88. package/package.json +5 -42
  89. package/dist/dialog-accept-shortcut-DAEBsoWW.js +0 -7
  90. package/dist/dialog-accept-shortcut-DAEBsoWW.js.map +0 -1
  91. package/dist/edit-mode-data-table-D6NeiDJx.js +0 -775
  92. package/dist/edit-mode-data-table-D6NeiDJx.js.map +0 -1
  93. package/dist/editor-config-D9OksZ93.js +0 -2416
  94. package/dist/editor-config-D9OksZ93.js.map +0 -1
  95. package/dist/kanban-renderer-toolbar-CpegGbwq.js.map +0 -1
  96. package/dist/lazy-markdown-editor-B7uP2ALS.js +0 -26
  97. package/dist/lazy-markdown-editor-B7uP2ALS.js.map +0 -1
  98. package/dist/list-row-9oxy-F0v.js +0 -796
  99. package/dist/list-row-9oxy-F0v.js.map +0 -1
  100. package/dist/monaco-browser-CO0NxK_Z.js +0 -19
  101. package/dist/monaco-browser-CO0NxK_Z.js.map +0 -1
  102. package/dist/number-input-WUfejtNx.js +0 -343
  103. package/dist/number-input-WUfejtNx.js.map +0 -1
  104. package/dist/param-editor-field-Cu4pto_a.js +0 -2845
  105. package/dist/param-editor-field-Cu4pto_a.js.map +0 -1
  106. package/dist/rich-message-DdFYRzTo.js +0 -658
  107. package/dist/theme-BH4fSst9.js.map +0 -1
  108. package/dist/theme-preference-DyymrYpR.js +0 -123
  109. package/dist/theme-preference-DyymrYpR.js.map +0 -1
  110. package/dist/tree-list-uV4UFj0x.js +0 -1116
  111. package/dist/tree-list-uV4UFj0x.js.map +0 -1
@@ -1,658 +0,0 @@
1
- import { jsx as l, jsxs as D, Fragment as Q } from "react/jsx-runtime";
2
- import { c as k } from "react/compiler-runtime";
3
- import { Tooltip as W, Text as H, Flex as X, Box as Z, Kbd as be } from "@chakra-ui/react";
4
- import { MarkNode as Se } from "@lexical/mark";
5
- import { LexicalComposer as re } from "@lexical/react/LexicalComposer";
6
- import { LexicalErrorBoundary as oe } from "@lexical/react/LexicalErrorBoundary";
7
- import { HistoryPlugin as Ce } from "@lexical/react/LexicalHistoryPlugin";
8
- import { OnChangePlugin as ie } from "@lexical/react/LexicalOnChangePlugin";
9
- import { RichTextPlugin as se } from "@lexical/react/LexicalRichTextPlugin";
10
- import { createCommand as le, ElementNode as Ie, isHTMLElement as Te, $createParagraphNode as q, COMMAND_PRIORITY_LOW as ce, $getSelection as Re, $isRangeSelection as Oe, $isElementNode as $e, KEY_DOWN_COMMAND as Me, COMMAND_PRIORITY_HIGH as ve, TextNode as Ne, $getRoot as ae } from "lexical";
11
- import { useEffect as J, useImperativeHandle as Pe, useState as Ae, forwardRef as Le, useRef as ke } from "react";
12
- import { t as we, c as de, T as ue, d as me, s as De, i as ee, e as Be, a as Fe, C as He, I as Je, E as Ke, f as Ue, g as Ge } from "./editor-config-D9OksZ93.js";
13
- import { useLexicalComposerContext as B } from "@lexical/react/LexicalComposerContext";
14
- import { $setBlocksType as We } from "@lexical/selection";
15
- import { addClassNamesToElement as fe, mergeRegister as Y } from "@lexical/utils";
16
- import { LexicalTypeaheadMenuPlugin as Ve } from "@lexical/react/LexicalTypeaheadMenuPlugin";
17
- import * as je from "react-dom";
18
- import { S as qe } from "./browser-storage-DPtOQJx0.js";
19
- import { ClickableLinkPlugin as Xe } from "@lexical/react/LexicalClickableLinkPlugin";
20
- import { HorizontalRulePlugin as Ye } from "@lexical/react/LexicalHorizontalRulePlugin";
21
- import { LinkPlugin as ze } from "@lexical/react/LexicalLinkPlugin";
22
- import { ListPlugin as Qe } from "@lexical/react/LexicalListPlugin";
23
- import { TabIndentationPlugin as Ze } from "@lexical/react/LexicalTabIndentationPlugin";
24
- const et = "INSERT_REFERENCE", tt = "INSERT_BLOCK", pe = le(et), nt = le(tt);
25
- function rt(r) {
26
- const e = V();
27
- return r.style !== null && e.setFormat(r.style.textAlign), {
28
- node: e
29
- };
30
- }
31
- class G extends Ie {
32
- static getType() {
33
- return "comment";
34
- }
35
- static clone(e) {
36
- return new G(e.__key);
37
- }
38
- createDOM(e) {
39
- const t = document.createElement("blockquote");
40
- return fe(t, e.theme.comment), t;
41
- }
42
- updateDOM() {
43
- return !1;
44
- }
45
- static importDOM() {
46
- return {
47
- blockquote: () => ({
48
- conversion: rt,
49
- priority: 0
50
- })
51
- };
52
- }
53
- exportDOM(e) {
54
- const {
55
- element: t
56
- } = super.exportDOM(e);
57
- if (t && Te(t)) {
58
- this.isEmpty() && t.append(document.createElement("br"));
59
- const n = this.getFormatType();
60
- t.style.textAlign = n;
61
- const o = this.getDirection();
62
- o && (t.dir = o);
63
- }
64
- return {
65
- element: t
66
- };
67
- }
68
- static importJSON(e) {
69
- const t = V();
70
- return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
71
- }
72
- exportJSON() {
73
- return {
74
- ...super.exportJSON(),
75
- type: "comment"
76
- };
77
- }
78
- getTextContent() {
79
- return `{{! ${super.getTextContent().replace(/([{}])/g, "\\$1")} }}`;
80
- }
81
- // mutation
82
- insertNewAfter(e, t) {
83
- const n = q(), o = this.getDirection();
84
- return n.setDirection(o), this.insertAfter(n, t), n;
85
- }
86
- collapseAtStart() {
87
- const e = q();
88
- return this.getChildren().forEach((n) => {
89
- e.append(n);
90
- }), this.replace(e), !0;
91
- }
92
- }
93
- function V() {
94
- return new G();
95
- }
96
- const ot = (r, e) => {
97
- const t = Re(), n = V();
98
- if (e) {
99
- e.getParent()?.replace(n, !0), e.remove(), n.selectEnd();
100
- return;
101
- }
102
- Oe(t) && We(t, V);
103
- };
104
- function it() {
105
- const r = k(3), [e] = B();
106
- let t, n;
107
- return r[0] !== e ? (t = () => Y(e.registerCommand(nt, st, ce)), n = [e], r[0] = e, r[1] = t, r[2] = n) : (t = r[1], n = r[2]), J(t, n), null;
108
- }
109
- function st(r) {
110
- const {
111
- optionId: e,
112
- nodeToReplace: t
113
- } = r;
114
- return ot(e, t), !1;
115
- }
116
- const lt = () => {
117
- const r = k(3), [e] = B();
118
- let t, n;
119
- r[0] !== e ? (t = () => Y(e.registerNodeTransform(G, (o) => {
120
- const s = o.getChildren().filter(ct);
121
- s.length > 0 && e.update(() => {
122
- s.forEach(at);
123
- });
124
- })), n = [e], r[0] = e, r[1] = t, r[2] = n) : (t = r[1], n = r[2]), J(t, n);
125
- };
126
- function ct(r) {
127
- return r.getType() === "comment";
128
- }
129
- function at(r) {
130
- r.replace(q(), !0);
131
- }
132
- function dt() {
133
- return lt(), it(), null;
134
- }
135
- const ut = (r) => {
136
- let e = "";
137
- const t = r.getChildren(), n = t.length;
138
- for (let o = 0; o < n; o++) {
139
- const i = t[o];
140
- e += i.getTextContent(), $e(i) && o !== n - 1 && !i.isInline() && (e += `
141
- `);
142
- }
143
- return e;
144
- }, mt = (r) => r.type !== "reference" ? null : `#${r.name ?? r.referenceId ?? ""}`, ft = (r) => r.type === "paragraph" && !!r.children?.length, ge = (r) => {
145
- if (r.type === "comment")
146
- return "";
147
- const e = mt(r);
148
- if (e !== null)
149
- return e;
150
- let t = typeof r.text == "string" ? r.text : "";
151
- const n = r.children;
152
- if (!Array.isArray(n)) return t;
153
- const o = n.length;
154
- for (let i = 0; i < o; i += 1) {
155
- const s = n[i];
156
- if (s.type === "comment") {
157
- i !== o - 1 && (t += `
158
- `);
159
- continue;
160
- }
161
- t += ge(s), ft(s) && (t += `
162
- `);
163
- }
164
- return t;
165
- }, he = (r) => {
166
- try {
167
- const e = JSON.parse(r);
168
- return ge(e.root ?? {});
169
- } catch {
170
- return "";
171
- }
172
- }, pt = {
173
- root: {
174
- direction: "ltr",
175
- format: "",
176
- indent: 0,
177
- type: "root",
178
- version: 1,
179
- children: [{
180
- type: "paragraph",
181
- version: 1,
182
- format: "",
183
- indent: 0,
184
- textFormat: void 0,
185
- direction: null,
186
- children: []
187
- }]
188
- }
189
- };
190
- function gt(r = "") {
191
- return r.trim() ? {
192
- root: {
193
- direction: "ltr",
194
- format: "",
195
- indent: 0,
196
- type: "root",
197
- version: 1,
198
- children: r.split(/\r?\n/).map((n) => ({
199
- type: "paragraph",
200
- version: 1,
201
- format: "",
202
- indent: 0,
203
- textFormat: void 0,
204
- direction: null,
205
- children: n ? [{
206
- type: "text",
207
- version: 1,
208
- text: n,
209
- format: "",
210
- detail: 0,
211
- mode: "normal",
212
- style: ""
213
- }] : []
214
- }))
215
- }
216
- } : JSON.parse(JSON.stringify(pt));
217
- }
218
- function ht(r) {
219
- const e = k(4), {
220
- editorRef: t,
221
- previousTextRef: n
222
- } = r, [o] = B();
223
- let i, s;
224
- return e[0] !== o || e[1] !== n ? (i = () => ({
225
- setEditorValue: (a) => {
226
- const d = o.parseEditorState(JSON.stringify(gt(a)));
227
- o.setEditorState(d), n.current = he(a), o.focus(void 0, {
228
- defaultSelection: "rootEnd"
229
- });
230
- }
231
- }), s = [o, n], e[0] = o, e[1] = n, e[2] = i, e[3] = s) : (i = e[2], s = e[3]), Pe(t, i, s), null;
232
- }
233
- const xt = (r) => r.key !== "Enter" ? !1 : !r.ctrlKey && !r.metaKey && !r.shiftKey && !r.altKey;
234
- function _t(r) {
235
- const e = k(4), {
236
- onSubmit: t
237
- } = r, [n] = B();
238
- let o, i;
239
- return e[0] !== n || e[1] !== t ? (o = () => n.registerCommand(Me, (s) => xt(s) ? (s.preventDefault(), t?.(), !0) : !1, ve), i = [n, t], e[0] = n, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), J(o, i), null;
240
- }
241
- const te = ["table", "connector"], Et = (r) => r.sort((n, o) => te.indexOf(n.group) - te.indexOf(o.group)).map((n, o) => ({
242
- ...n,
243
- index: o
244
- })).reduce((n, o) => {
245
- const i = n[o.group] ?? [];
246
- return i.push(o), n[o.group] = i, n;
247
- }, {});
248
- function ne(r) {
249
- const e = k(22), {
250
- id: t,
251
- isSelected: n,
252
- onClick: o,
253
- onMouseEnter: i,
254
- setRefElement: s,
255
- secondaryLabel: a,
256
- primaryLabel: d,
257
- tabIndex: h
258
- } = r, _ = h === void 0 ? -1 : h, u = n ? "bg.active" : "transparent", f = n ? "bg.active" : "bg.hover";
259
- let p;
260
- e[0] !== f ? (p = {
261
- bg: f
262
- }, e[0] = f, e[1] = p) : p = e[1];
263
- let m;
264
- e[2] !== d ? (m = /* @__PURE__ */ l(W.Trigger, { children: /* @__PURE__ */ l(H, { mt: "1px", lineClamp: 1, textOverflow: "ellipsis", textStyle: "label/M/regular", children: d }) }), e[2] = d, e[3] = m) : m = e[3];
265
- let x;
266
- e[4] !== d ? (x = /* @__PURE__ */ l(W.Positioner, { children: /* @__PURE__ */ l(W.Content, { children: d }) }), e[4] = d, e[5] = x) : x = e[5];
267
- let g;
268
- e[6] !== m || e[7] !== x ? (g = /* @__PURE__ */ D(W.Root, { children: [
269
- m,
270
- x
271
- ] }), e[6] = m, e[7] = x, e[8] = g) : g = e[8];
272
- let E;
273
- e[9] !== a ? (E = a && /* @__PURE__ */ l(H, { lineClamp: 2, textOverflow: "ellipsis", textStyle: "label/S/regular", color: "fg.muted", children: a }), e[9] = a, e[10] = E) : E = e[10];
274
- let S;
275
- return e[11] !== t || e[12] !== n || e[13] !== o || e[14] !== i || e[15] !== s || e[16] !== u || e[17] !== p || e[18] !== g || e[19] !== E || e[20] !== _ ? (S = /* @__PURE__ */ D(X, { direction: "column", cursor: "pointer", gap: "2xs", padding: "2xs", paddingX: "sm", bg: u, _hover: p, tabIndex: _, ref: s, role: "option", "aria-selected": n, id: t, onMouseEnter: i, onClick: o, children: [
276
- g,
277
- E
278
- ] }), e[11] = t, e[12] = n, e[13] = o, e[14] = i, e[15] = s, e[16] = u, e[17] = p, e[18] = g, e[19] = E, e[20] = _, e[21] = S) : S = e[21], S;
279
- }
280
- const yt = (r) => {
281
- const e = k(12), {
282
- options: t,
283
- selectedIndex: n,
284
- onSelectItem: o,
285
- onMouseEnterItem: i
286
- } = r, {
287
- table: s,
288
- connector: a
289
- } = Et(t), d = s === void 0 ? [] : s, h = a === void 0 ? [] : a, _ = [...d, ...h].length;
290
- let u, f;
291
- e[0] !== n ? (u = () => {
292
- document.getElementById(`typeahead-item-${n}`)?.scrollIntoView({
293
- behavior: "instant",
294
- block: "nearest"
295
- });
296
- }, f = [n], e[0] = n, e[1] = u, e[2] = f) : (u = e[1], f = e[2]), J(u, f);
297
- const p = qe, m = "1000", x = "absolute", g = "modal", E = "24rem", S = !1;
298
- let y;
299
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = {
300
- base: "100vw",
301
- md: "264px"
302
- }, e[3] = y) : y = e[3];
303
- let b;
304
- e[4] !== _ ? (b = !_ && /* @__PURE__ */ l(H, { children: "No results" }), e[4] = _, e[5] = b) : b = e[5];
305
- const I = !!d.length && /* @__PURE__ */ D(Q, { children: [
306
- /* @__PURE__ */ l(H, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Tables" }),
307
- /* @__PURE__ */ l(Z, { children: d.map((c) => /* @__PURE__ */ l(ne, { id: `typeahead-item-${c.index}`, isSelected: n === c.index, onClick: () => o(c, c.index), onMouseEnter: () => i(c.index), primaryLabel: c.name, secondaryLabel: c.description, setRefElement: c.setRefElement, tabIndex: -1 }, c.id)) })
308
- ] }), M = !!h.length && /* @__PURE__ */ D(Q, { children: [
309
- /* @__PURE__ */ l(H, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Data Sources" }),
310
- /* @__PURE__ */ l(Z, { children: h.map((c) => /* @__PURE__ */ l(ne, { id: `typeahead-item-${c.index}`, isSelected: n === c.index, onClick: () => o(c, c.index), onMouseEnter: () => i(c.index), primaryLabel: c.name, secondaryLabel: c.description, setRefElement: c.setRefElement, tabIndex: -1 }, c.id)) })
311
- ] });
312
- let C;
313
- return e[6] !== p || e[7] !== b || e[8] !== I || e[9] !== M || e[10] !== y ? (C = /* @__PURE__ */ D(p, { zIndex: m, position: x, layerStyle: g, maxHeight: E, showHorizontalScrollbar: S, minWidth: y, children: [
314
- b,
315
- I,
316
- M
317
- ] }), e[6] = p, e[7] = b, e[8] = I, e[9] = M, e[10] = y, e[11] = C) : C = e[11], C;
318
- }, bt = (r, e) => r.filter((t) => t.name.replace(/ /g, "_").toLowerCase().includes(e.toLowerCase()));
319
- function St(r, e = []) {
320
- const t = e.map((n, o) => ({
321
- id: n.resourceId,
322
- key: n.resourceId,
323
- index: o,
324
- group: n.resourceType,
325
- name: n.name,
326
- description: n.description,
327
- setRefElement: () => {
328
- }
329
- }));
330
- return r == null || r === "" ? t : bt(t, r);
331
- }
332
- const xe = "\\.\\-<>_:", z = ["#"].join(""), _e = `[^${z}${xe}\\s]`, Ct = `(?:[${xe}]|)`, Ee = 75, It = new RegExp(`(^|\\s|\\()([${z}]((?:${_e}${Ct}){0,${Ee}}))$`), Tt = new RegExp(`(^|\\s|\\()([${z}]((?:${_e}){0,${Ee}}))$`);
333
- function Rt(r, e) {
334
- let t = It.exec(r);
335
- if (t === null && (t = Tt.exec(r)), t !== null) {
336
- const n = t[1], o = t[3];
337
- if (o.length >= e)
338
- return {
339
- leadOffset: t.index + n.length,
340
- matchingString: o,
341
- replaceableString: t[2]
342
- };
343
- }
344
- return null;
345
- }
346
- const Ot = 20;
347
- function $t(r) {
348
- const e = k(9), {
349
- items: t
350
- } = r;
351
- let n;
352
- e[0] !== t ? (n = t === void 0 ? [] : t, e[0] = t, e[1] = n) : n = e[1];
353
- const o = n, [i, s] = Ae(null), [a] = B(), d = St(i, o);
354
- let h;
355
- e[2] !== a ? (h = (x, g, E) => {
356
- a.update(() => {
357
- g && (a.dispatchCommand(pe, {
358
- resourceId: x.id,
359
- resourceType: x.group,
360
- name: x.name,
361
- nodeToReplace: g
362
- }), E());
363
- });
364
- }, e[2] = a, e[3] = h) : h = e[3];
365
- const _ = h, u = vt;
366
- let f;
367
- e[4] !== d ? (f = d.slice(0, Ot), e[4] = d, e[5] = f) : f = e[5];
368
- const p = f;
369
- let m;
370
- return e[6] !== p || e[7] !== _ ? (m = /* @__PURE__ */ l(Ve, { onQueryChange: s, onSelectOption: _, triggerFn: u, options: p, menuRenderFn: Mt }), e[6] = p, e[7] = _, e[8] = m) : m = e[8], m;
371
- }
372
- function Mt(r, e) {
373
- const {
374
- options: t,
375
- selectedIndex: n,
376
- selectOptionAndCleanUp: o,
377
- setHighlightedIndex: i
378
- } = e;
379
- return r.current ? je.createPortal(/* @__PURE__ */ l(yt, { options: t, selectedIndex: n, onSelectItem: (s, a) => {
380
- i(a), o(s);
381
- }, onMouseEnterItem: (s) => {
382
- i(s);
383
- } }), r.current) : null;
384
- }
385
- function vt(r) {
386
- return Rt(r, 0);
387
- }
388
- class U extends Ne {
389
- __referenceId;
390
- __name;
391
- static getType() {
392
- return "reference";
393
- }
394
- static clone(e) {
395
- return new U(e.__referenceId, e.__name, e.__key);
396
- }
397
- constructor(e, t, n) {
398
- super(t, n), this.__referenceId = e, this.__name = t;
399
- }
400
- isKeyboardSelectable() {
401
- return !1;
402
- }
403
- canBeEmpty() {
404
- return !1;
405
- }
406
- canInsertTextAfter() {
407
- return !1;
408
- }
409
- canInsertTextBefore() {
410
- return !1;
411
- }
412
- createDOM(e) {
413
- const t = document.createElement("span");
414
- return fe(t, e.theme.reference), t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, t;
415
- }
416
- updateDOM(e, t) {
417
- return (e.__name !== this.__name || e.__referenceId !== this.__referenceId) && (t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`), !1;
418
- }
419
- exportDOM(e) {
420
- const t = document.createElement("span");
421
- return t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, {
422
- element: t
423
- };
424
- }
425
- static importDOM() {
426
- return {
427
- span: (e) => !e.hasAttribute("data-reference-id") || !e.hasAttribute("data-name") ? null : {
428
- conversion: Nt,
429
- priority: 1
430
- }
431
- };
432
- }
433
- static importJSON(e) {
434
- return new U(e.referenceId, e.name);
435
- }
436
- exportJSON() {
437
- return {
438
- ...super.exportJSON(),
439
- type: "reference",
440
- referenceId: this.__referenceId,
441
- name: this.__name
442
- };
443
- }
444
- getTextContent() {
445
- return `#${this.__name}`;
446
- }
447
- }
448
- function Nt(r) {
449
- const e = r.getAttribute("data-reference-id"), t = r.getAttribute("data-name");
450
- return !e || !t ? null : {
451
- node: ye(e, t)
452
- };
453
- }
454
- function ye(r, e) {
455
- return new U(r, e);
456
- }
457
- const Pt = (r, e, t) => {
458
- const n = ye(e, t);
459
- if (r) {
460
- r?.replace(n), r.remove(), n.selectEnd();
461
- return;
462
- }
463
- };
464
- function At(r) {
465
- const e = k(4), {
466
- onAddReference: t
467
- } = r, [n] = B();
468
- let o, i;
469
- return e[0] !== n || e[1] !== t ? (o = () => Y(n.registerCommand(pe, (s) => {
470
- const {
471
- resourceId: a,
472
- resourceType: d,
473
- name: h,
474
- nodeToReplace: _
475
- } = s;
476
- return n.update(() => {
477
- Pt(_, a, h);
478
- }), t?.(a, d), !0;
479
- }, ce)), i = [n, t], e[0] = n, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), J(o, i), null;
480
- }
481
- const Lt = {
482
- ...we,
483
- // Override paragraph class to remove margins specifically for prompt input
484
- paragraph: "rich-text__p rich-text__p--no-margin"
485
- }, kt = [G, Se, U], wt = (r, e) => {
486
- const t = k(39), {
487
- defaultState: n,
488
- debug: o,
489
- isEditable: i,
490
- placeholder: s
491
- } = r, a = o === void 0 ? !1 : o, d = i === void 0 ? !0 : i, {
492
- onChange: h,
493
- onError: _,
494
- onSubmit: u,
495
- references: f,
496
- onAddReference: p
497
- } = r, m = _ === void 0 ? Dt : _;
498
- let x;
499
- t[0] !== f ? (x = f === void 0 ? [] : f, t[0] = f, t[1] = x) : x = t[1];
500
- const g = x;
501
- let E;
502
- t[2] !== n || t[3] !== d || t[4] !== m ? (E = {
503
- namespace: "PROMPT_EDITOR",
504
- nodes: kt,
505
- editorState: n,
506
- editable: d,
507
- onError: m,
508
- theme: Lt
509
- }, t[2] = n, t[3] = d, t[4] = m, t[5] = E) : E = t[5];
510
- const S = E;
511
- let y;
512
- t[6] !== n ? (y = he(n), t[6] = n, t[7] = y) : y = t[7];
513
- const b = ke(y);
514
- let I;
515
- t[8] !== s ? (I = s ?? /* @__PURE__ */ D(H, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: [
516
- "Type your query here or press ",
517
- /* @__PURE__ */ l(be, { color: "fg.subtle", children: "#" }),
518
- " to add a reference."
519
- ] }), t[8] = s, t[9] = I) : I = t[9];
520
- const M = I;
521
- let C;
522
- t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ l(Ce, {}), t[10] = C) : C = t[10];
523
- let c;
524
- t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ l(de, { fullWidth: !0 }), t[11] = c) : c = t[11];
525
- let v;
526
- t[12] !== M ? (v = /* @__PURE__ */ l(se, { contentEditable: c, placeholder: M, ErrorBoundary: oe }), t[12] = M, t[13] = v) : v = t[13];
527
- let N;
528
- t[14] !== h ? (N = /* @__PURE__ */ l(ie, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (F) => {
529
- F.read(() => {
530
- const j = ae(), K = ut(j);
531
- K !== b.current && (b.current = K, h?.(K, F.toJSON()));
532
- });
533
- } }), t[14] = h, t[15] = N) : N = t[15];
534
- let P;
535
- t[16] !== e ? (P = /* @__PURE__ */ l(ht, { editorRef: e, previousTextRef: b }), t[16] = e, t[17] = P) : P = t[17];
536
- let A;
537
- t[18] !== d ? (A = /* @__PURE__ */ l(ue, { isEditable: d }), t[18] = d, t[19] = A) : A = t[19];
538
- let L;
539
- t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ l(dt, {}), t[20] = L) : L = t[20];
540
- let T;
541
- t[21] !== u ? (T = /* @__PURE__ */ l(_t, { onSubmit: u }), t[21] = u, t[22] = T) : T = t[22];
542
- let R;
543
- t[23] !== g ? (R = /* @__PURE__ */ l($t, { items: g }), t[23] = g, t[24] = R) : R = t[24];
544
- let O;
545
- t[25] !== p ? (O = /* @__PURE__ */ l(At, { onAddReference: p }), t[25] = p, t[26] = O) : O = t[26];
546
- let $;
547
- t[27] !== a ? ($ = a ? /* @__PURE__ */ l(me, {}) : "", t[27] = a, t[28] = $) : $ = t[28];
548
- let w;
549
- return t[29] !== S || t[30] !== v || t[31] !== N || t[32] !== P || t[33] !== A || t[34] !== T || t[35] !== R || t[36] !== O || t[37] !== $ ? (w = /* @__PURE__ */ l(X, { direction: "column", justifyContent: "space-between", width: "100%", position: "relative", children: /* @__PURE__ */ D(re, { initialConfig: S, children: [
550
- C,
551
- v,
552
- N,
553
- P,
554
- A,
555
- L,
556
- T,
557
- R,
558
- O,
559
- $
560
- ] }) }), t[29] = S, t[30] = v, t[31] = N, t[32] = P, t[33] = A, t[34] = T, t[35] = R, t[36] = O, t[37] = $, t[38] = w) : w = t[38], w;
561
- }, an = Le(wt);
562
- function Dt() {
563
- }
564
- function Bt(r) {
565
- const e = k(5), {
566
- value: t,
567
- onUpdate: n
568
- } = r, [o] = B();
569
- let i, s;
570
- return e[0] !== o || e[1] !== n || e[2] !== t ? (i = () => {
571
- o && o.update(() => n(t), {
572
- tag: "history-merge"
573
- });
574
- }, s = [t, o, n], e[0] = o, e[1] = n, e[2] = t, e[3] = i, e[4] = s) : (i = e[3], s = e[4]), J(i, s), null;
575
- }
576
- function dn(r) {
577
- const e = k(43), {
578
- debug: t,
579
- defaultState: n,
580
- fullWidth: o,
581
- isEditable: i,
582
- resolveMarkdownUrl: s,
583
- onChange: a
584
- } = r, d = t === void 0 ? !1 : t, h = n === void 0 ? "" : n, _ = o === void 0 ? !1 : o, u = i === void 0 ? !1 : i;
585
- let f;
586
- e[0] !== h ? (f = De(h), e[0] = h, e[1] = f) : f = e[1];
587
- const {
588
- frontmatter: p,
589
- body: m
590
- } = f, x = u && !!a;
591
- let g;
592
- e[2] !== m || e[3] !== s ? (g = () => {
593
- ee(m, s);
594
- }, e[2] = m, e[3] = s, e[4] = g) : g = e[4];
595
- let E;
596
- e[5] !== u || e[6] !== g ? (E = {
597
- namespace: "RICH_MESSAGE",
598
- nodes: Fe,
599
- editorState: g,
600
- onError: Ft,
601
- editable: u,
602
- theme: Be
603
- }, e[5] = u, e[6] = g, e[7] = E) : E = e[7];
604
- const S = E;
605
- let y;
606
- e[8] !== s ? (y = (F) => {
607
- ee(F, s);
608
- }, e[8] = s, e[9] = y) : y = e[9];
609
- let b;
610
- e[10] !== m || e[11] !== y ? (b = /* @__PURE__ */ l(Bt, { value: m, onUpdate: y }), e[10] = m, e[11] = y, e[12] = b) : b = e[12];
611
- let I, M, C;
612
- e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ l(ze, {}), I = /* @__PURE__ */ l(Xe, { newTab: !0 }), M = /* @__PURE__ */ l(Qe, {}), e[13] = I, e[14] = M, e[15] = C) : (I = e[13], M = e[14], C = e[15]);
613
- let c;
614
- e[16] !== u ? (c = u ? /* @__PURE__ */ l(Ze, { maxIndent: 7 }) : null, e[16] = u, e[17] = c) : c = e[17];
615
- let v, N, P, A;
616
- e[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ l(Ye, {}), N = /* @__PURE__ */ l(He, {}), P = /* @__PURE__ */ l(Je, {}), A = /* @__PURE__ */ l(Ke, {}), e[18] = v, e[19] = N, e[20] = P, e[21] = A) : (v = e[18], N = e[19], P = e[20], A = e[21]);
617
- let L;
618
- e[22] !== _ ? (L = /* @__PURE__ */ l(se, { contentEditable: /* @__PURE__ */ l(de, { fullWidth: _, isRichMessage: !0 }), ErrorBoundary: oe }), e[22] = _, e[23] = L) : L = e[23];
619
- let T;
620
- e[24] !== p || e[25] !== a || e[26] !== x ? (T = x ? /* @__PURE__ */ l(ie, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (F) => {
621
- F.read(() => {
622
- const j = ae(), K = Ue(j);
623
- a?.(p + K);
624
- });
625
- } }) : null, e[24] = p, e[25] = a, e[26] = x, e[27] = T) : T = e[27];
626
- let R;
627
- e[28] !== u ? (R = /* @__PURE__ */ l(ue, { isEditable: u }), e[28] = u, e[29] = R) : R = e[29];
628
- let O;
629
- e[30] !== d ? (O = d && /* @__PURE__ */ l(me, {}), e[30] = d, e[31] = O) : O = e[31];
630
- let $;
631
- e[32] !== S || e[33] !== c || e[34] !== L || e[35] !== T || e[36] !== R || e[37] !== O || e[38] !== b ? ($ = /* @__PURE__ */ D(re, { initialConfig: S, children: [
632
- b,
633
- C,
634
- I,
635
- M,
636
- c,
637
- v,
638
- N,
639
- P,
640
- A,
641
- L,
642
- T,
643
- R,
644
- O
645
- ] }), e[32] = S, e[33] = c, e[34] = L, e[35] = T, e[36] = R, e[37] = O, e[38] = b, e[39] = $) : $ = e[39];
646
- let w;
647
- return e[40] !== s || e[41] !== $ ? (w = /* @__PURE__ */ l(X, { className: "rich-text", "data-rich-message": "true", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "hidden", children: /* @__PURE__ */ l(Ge, { resolver: s, children: $ }) }), e[40] = s, e[41] = $, e[42] = w) : w = e[42], w;
648
- }
649
- function Ft(r) {
650
- return console.error(r);
651
- }
652
- export {
653
- an as P,
654
- dn as R,
655
- he as a,
656
- gt as g
657
- };
658
- //# sourceMappingURL=rich-message-DdFYRzTo.js.map