@deepagents/react-input 7.9.0 → 7.10.1
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.
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1000 -1005
- package/dist/browser.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/Composer.d.ts +4 -4
- package/dist/lib/Composer.d.ts.map +1 -1
- package/dist/lib/ComposerAttachments.d.ts +1 -1
- package/dist/lib/ComposerAttachments.d.ts.map +1 -1
- package/dist/lib/ComposerContext.d.ts +4 -3
- package/dist/lib/ComposerContext.d.ts.map +1 -1
- package/dist/lib/ComposerCore.d.ts +3 -8
- package/dist/lib/ComposerCore.d.ts.map +1 -1
- package/dist/lib/ComposerDraft.d.ts +1 -1
- package/dist/lib/ComposerDraft.d.ts.map +1 -1
- package/dist/lib/ComposerRegistry.d.ts +5 -5
- package/dist/lib/ComposerRegistry.d.ts.map +1 -1
- package/dist/lib/ComposerSlashCommands.d.ts +1 -1
- package/dist/lib/ComposerSlashCommands.d.ts.map +1 -1
- package/dist/lib/ComposerSuggestions.d.ts +1 -1
- package/dist/lib/ComposerSuggestions.d.ts.map +1 -1
- package/dist/lib/ComposerTokenText.d.ts +1 -1
- package/dist/lib/ComposerTokenText.d.ts.map +1 -1
- package/dist/lib/ComposerTriggers.d.ts.map +1 -1
- package/dist/lib/ComposerTypes.d.ts +1 -1
- package/dist/lib/ComposerTypes.d.ts.map +1 -1
- package/dist/lib/ComposerVisibility.d.ts +1 -1
- package/dist/lib/ComposerVisibility.d.ts.map +1 -1
- package/dist/lib/PersistedPromptText.d.ts.map +1 -1
- package/dist/lib/dictation/ComposerDictationContext.d.ts +2 -2
- package/dist/lib/dictation/ComposerDictationContext.d.ts.map +1 -1
- package/dist/lib/dictation/ComposerDictationParts.d.ts +2 -2
- package/dist/lib/dictation/ComposerDictationParts.d.ts.map +1 -1
- package/dist/lib/dictation/DictationError.d.ts.map +1 -1
- package/dist/lib/dictation/MicrophonePermission.d.ts.map +1 -1
- package/dist/lib/dictation/Recording.d.ts.map +1 -1
- package/dist/lib/dictation/useDictationController.d.ts +1 -1
- package/dist/lib/dictation/useDictationController.d.ts.map +1 -1
- package/dist/lib/persisted-prompt-selection.d.ts.map +1 -1
- package/dist/lib/tiptap/ComposerTiptapDomain.d.ts +9 -9
- package/dist/lib/tiptap/ComposerTiptapDomain.d.ts.map +1 -1
- package/dist/persisted-prompt.d.ts.map +1 -1
- package/package.json +9 -6
- package/src/styles.css +2 -18
package/dist/browser.js
CHANGED
|
@@ -4,24 +4,24 @@ import { Button as a } from "@base-ui/react/button";
|
|
|
4
4
|
import { EditorContent as o, useEditor as s } from "@tiptap/react";
|
|
5
5
|
import { useClock as c } from "@zukhruf/ui";
|
|
6
6
|
import { cn as l } from "cn";
|
|
7
|
-
import { Children as u, Fragment as d, createContext as f, isValidElement as p, startTransition as m, use as h, useActionState as g, useEffect as _,
|
|
8
|
-
import { Package as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import {
|
|
11
|
-
import { Extension as E, Mark as D, Node as O, mergeAttributes as k } from "@tiptap/core";
|
|
7
|
+
import { Children as u, Fragment as d, createContext as f, isValidElement as p, startTransition as m, use as h, useActionState as g, useEffect as _, useEffectEvent as v, useLayoutEffect as y, useMemo as b, useRef as x, useState as S, useSyncExternalStore as C } from "react";
|
|
8
|
+
import { Package as ee, X as te } from "lucide-react";
|
|
9
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
10
|
+
import { Extension as D, Mark as O, Node as k, mergeAttributes as A } from "@tiptap/core";
|
|
12
11
|
import ne from "@tiptap/extension-link";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import M from "@tiptap/
|
|
12
|
+
import { Placeholder as re } from "@tiptap/extensions";
|
|
13
|
+
import { Slice as j } from "@tiptap/pm/model";
|
|
14
|
+
import { Plugin as ie, TextSelection as M } from "@tiptap/pm/state";
|
|
15
|
+
import N from "@tiptap/starter-kit";
|
|
16
16
|
//#region src/lib/ComposerContext.ts
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
let t = h(
|
|
17
|
+
var P = f(null);
|
|
18
|
+
function F(e) {
|
|
19
|
+
let t = h(P);
|
|
20
20
|
if (!t) throw Error(`${e} must be used inside Composer.Root.`);
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
let t = i(9), n =
|
|
23
|
+
function I(e) {
|
|
24
|
+
let t = i(9), n = F(e === void 0 ? "useComposer" : e), r;
|
|
25
25
|
t[0] !== n.activePopup || t[1] !== n.disabled || t[2] !== n.meta || t[3] !== n.suggestions ? (r = {
|
|
26
26
|
...n.meta,
|
|
27
27
|
disabled: n.disabled,
|
|
@@ -37,10 +37,10 @@ function P(e) {
|
|
|
37
37
|
}
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/lib/ComposerAttachments.tsx
|
|
40
|
-
function
|
|
40
|
+
function L(e) {
|
|
41
41
|
let t = i(23), n, r;
|
|
42
42
|
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
43
|
-
let { state: a, attachedImages: o } =
|
|
43
|
+
let { state: a, attachedImages: o } = F("Composer.Attachments"), s = a.imageAttachments, c, u, d, f, p, m;
|
|
44
44
|
if (t[3] !== o || t[4] !== n || t[5] !== r || t[6] !== a.imageAttachments) {
|
|
45
45
|
m = Symbol.for("react.early_return_sentinel");
|
|
46
46
|
bb0: {
|
|
@@ -51,13 +51,13 @@ function F(e) {
|
|
|
51
51
|
m = null;
|
|
52
52
|
break bb0;
|
|
53
53
|
}
|
|
54
|
-
c = "list", u = "Attached files", t[15] === n ? d = t[16] : (d = l("flex flex-wrap gap-2", n), t[15] = n, t[16] = d), f = r, p = i.map(
|
|
54
|
+
c = "list", u = "Attached files", t[15] === n ? d = t[16] : (d = l("flex flex-wrap gap-2", n), t[15] = n, t[16] = d), f = r, p = i.map(R);
|
|
55
55
|
}
|
|
56
56
|
t[3] = o, t[4] = n, t[5] = r, t[6] = a.imageAttachments, t[7] = c, t[8] = u, t[9] = d, t[10] = f, t[11] = p, t[12] = m;
|
|
57
57
|
} else c = t[7], u = t[8], d = t[9], f = t[10], p = t[11], m = t[12];
|
|
58
58
|
if (m !== Symbol.for("react.early_return_sentinel")) return m;
|
|
59
59
|
let h;
|
|
60
|
-
return t[17] !== c || t[18] !== u || t[19] !== d || t[20] !== f || t[21] !== p ? (h = /* @__PURE__ */
|
|
60
|
+
return t[17] !== c || t[18] !== u || t[19] !== d || t[20] !== f || t[21] !== p ? (h = /* @__PURE__ */ T("div", {
|
|
61
61
|
role: c,
|
|
62
62
|
"aria-label": u,
|
|
63
63
|
className: d,
|
|
@@ -65,35 +65,35 @@ function F(e) {
|
|
|
65
65
|
children: p
|
|
66
66
|
}), t[17] = c, t[18] = u, t[19] = d, t[20] = f, t[21] = p, t[22] = h) : h = t[22], h;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
return /* @__PURE__ */
|
|
68
|
+
function R(e) {
|
|
69
|
+
return /* @__PURE__ */ T(z, { attachment: e }, e.id);
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
let t = i(18), { attachment: n } = e, { id: r, placeholder: o, media: s } = n, { attachedImages: c, disabled: l, actions: u } =
|
|
71
|
+
function z(e) {
|
|
72
|
+
let t = i(18), { attachment: n } = e, { id: r, placeholder: o, media: s } = n, { attachedImages: c, disabled: l, actions: u } = F("Composer.Attachments"), d;
|
|
73
73
|
t[0] !== c || t[1] !== r ? (d = c.get(r), t[0] = c, t[1] = r, t[2] = d) : d = t[2];
|
|
74
74
|
let f = d;
|
|
75
75
|
if (!f) return null;
|
|
76
76
|
let p;
|
|
77
|
-
t[3] !== f || t[4] !== s || t[5] !== o ? (p = s === "video" ? /* @__PURE__ */
|
|
77
|
+
t[3] !== f || t[4] !== s || t[5] !== o ? (p = s === "video" ? /* @__PURE__ */ T(H, {
|
|
78
78
|
placeholder: o,
|
|
79
79
|
file: f
|
|
80
|
-
}) : s === "audio" ? /* @__PURE__ */
|
|
80
|
+
}) : s === "audio" ? /* @__PURE__ */ T(W, {
|
|
81
81
|
placeholder: o,
|
|
82
82
|
file: f,
|
|
83
83
|
glyph: "♪"
|
|
84
|
-
}) : /* @__PURE__ */
|
|
84
|
+
}) : /* @__PURE__ */ T(V, {
|
|
85
85
|
placeholder: o,
|
|
86
86
|
file: f
|
|
87
87
|
}), t[3] = f, t[4] = s, t[5] = o, t[6] = p) : p = t[6];
|
|
88
88
|
let m = `Remove ${o}`, h;
|
|
89
89
|
t[7] !== u || t[8] !== r ? (h = () => u.removeImageAttachment(r), t[7] = u, t[8] = r, t[9] = h) : h = t[9];
|
|
90
90
|
let g;
|
|
91
|
-
t[10] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */
|
|
91
|
+
t[10] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ T(te, {
|
|
92
92
|
"aria-hidden": !0,
|
|
93
93
|
className: "size-3"
|
|
94
94
|
}), t[10] = g) : g = t[10];
|
|
95
95
|
let _;
|
|
96
|
-
t[11] !== l || t[12] !== m || t[13] !== h ? (_ = /* @__PURE__ */
|
|
96
|
+
t[11] !== l || t[12] !== m || t[13] !== h ? (_ = /* @__PURE__ */ T(a, {
|
|
97
97
|
type: "button",
|
|
98
98
|
"aria-label": m,
|
|
99
99
|
disabled: l,
|
|
@@ -102,26 +102,26 @@ function L(e) {
|
|
|
102
102
|
children: g
|
|
103
103
|
}), t[11] = l, t[12] = m, t[13] = h, t[14] = _) : _ = t[14];
|
|
104
104
|
let v;
|
|
105
|
-
return t[15] !== p || t[16] !== _ ? (v = /* @__PURE__ */
|
|
105
|
+
return t[15] !== p || t[16] !== _ ? (v = /* @__PURE__ */ E("div", {
|
|
106
106
|
role: "listitem",
|
|
107
107
|
className: "relative",
|
|
108
108
|
children: [p, _]
|
|
109
109
|
}), t[15] = p, t[16] = _, t[17] = v) : v = t[17], v;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
let t = i(3), [n, r] =
|
|
111
|
+
function B(e) {
|
|
112
|
+
let t = i(3), [n, r] = S(null), a, o;
|
|
113
113
|
return t[0] === e ? (a = t[1], o = t[2]) : (a = () => {
|
|
114
114
|
let t = URL.createObjectURL(e);
|
|
115
115
|
return r(t), () => URL.revokeObjectURL(t);
|
|
116
116
|
}, o = [e], t[0] = e, t[1] = a, t[2] = o), _(a, o), n;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
let t = i(5), { placeholder: n, file: r } = e, a =
|
|
120
|
-
return t[0] !== o || t[1] !== r || t[2] !== a || t[3] !== n ? (c = a === null ? null : a === o ? /* @__PURE__ */
|
|
118
|
+
function V(e) {
|
|
119
|
+
let t = i(5), { placeholder: n, file: r } = e, a = B(r), [o, s] = S(null), c;
|
|
120
|
+
return t[0] !== o || t[1] !== r || t[2] !== a || t[3] !== n ? (c = a === null ? null : a === o ? /* @__PURE__ */ T(W, {
|
|
121
121
|
placeholder: n,
|
|
122
122
|
file: r,
|
|
123
123
|
glyph: "🖼"
|
|
124
|
-
}) : /* @__PURE__ */
|
|
124
|
+
}) : /* @__PURE__ */ T("img", {
|
|
125
125
|
src: a,
|
|
126
126
|
alt: n,
|
|
127
127
|
title: r.name,
|
|
@@ -129,11 +129,11 @@ function z(e) {
|
|
|
129
129
|
onError: () => s(a)
|
|
130
130
|
}), t[0] = o, t[1] = r, t[2] = a, t[3] = n, t[4] = c) : c = t[4], c;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
let t = i(11), { placeholder: n, file: r } = e, a =
|
|
132
|
+
function H(e) {
|
|
133
|
+
let t = i(11), { placeholder: n, file: r } = e, a = B(r), [o, s] = S(null), c = a ?? void 0, l;
|
|
134
134
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = (e) => s(e.currentTarget.duration), t[0] = l) : l = t[0];
|
|
135
135
|
let u;
|
|
136
|
-
t[1] === c ? u = t[2] : (u = /* @__PURE__ */
|
|
136
|
+
t[1] === c ? u = t[2] : (u = /* @__PURE__ */ T("video", {
|
|
137
137
|
src: c,
|
|
138
138
|
muted: !0,
|
|
139
139
|
playsInline: !0,
|
|
@@ -142,18 +142,18 @@ function B(e) {
|
|
|
142
142
|
onLoadedMetadata: l
|
|
143
143
|
}), t[1] = c, t[2] = u);
|
|
144
144
|
let d;
|
|
145
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */
|
|
145
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ T("span", {
|
|
146
146
|
"aria-hidden": !0,
|
|
147
147
|
className: "pointer-events-none absolute inset-0 flex items-center justify-center text-lg text-white drop-shadow",
|
|
148
148
|
children: "▶"
|
|
149
149
|
}), t[3] = d) : d = t[3];
|
|
150
150
|
let f;
|
|
151
|
-
t[4] === o ? f = t[5] : (f = o !== null && Number.isFinite(o) ? /* @__PURE__ */
|
|
151
|
+
t[4] === o ? f = t[5] : (f = o !== null && Number.isFinite(o) ? /* @__PURE__ */ T("span", {
|
|
152
152
|
className: "absolute right-0.5 bottom-0.5 rounded bg-black/70 px-1 text-[10px] leading-4 text-white",
|
|
153
|
-
children:
|
|
153
|
+
children: U(o)
|
|
154
154
|
}) : null, t[4] = o, t[5] = f);
|
|
155
155
|
let p;
|
|
156
|
-
return t[6] !== r.name || t[7] !== n || t[8] !== u || t[9] !== f ? (p = /* @__PURE__ */
|
|
156
|
+
return t[6] !== r.name || t[7] !== n || t[8] !== u || t[9] !== f ? (p = /* @__PURE__ */ E("div", {
|
|
157
157
|
role: "img",
|
|
158
158
|
"aria-label": n,
|
|
159
159
|
title: r.name,
|
|
@@ -165,28 +165,28 @@ function B(e) {
|
|
|
165
165
|
]
|
|
166
166
|
}), t[6] = r.name, t[7] = n, t[8] = u, t[9] = f, t[10] = p) : p = t[10], p;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function U(e) {
|
|
169
169
|
let t = Math.round(e);
|
|
170
170
|
return `${Math.floor(t / 60)}:${String(t % 60).padStart(2, "0")}`;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function W(e) {
|
|
173
173
|
let t = i(12), { placeholder: n, file: r, glyph: a } = e, o;
|
|
174
|
-
t[0] === a ? o = t[1] : (o = /* @__PURE__ */
|
|
174
|
+
t[0] === a ? o = t[1] : (o = /* @__PURE__ */ E("span", {
|
|
175
175
|
"aria-hidden": !0,
|
|
176
176
|
children: [a, " "]
|
|
177
177
|
}), t[0] = a, t[1] = o);
|
|
178
178
|
let s = r.name || n, c;
|
|
179
|
-
t[2] !== o || t[3] !== s ? (c = /* @__PURE__ */
|
|
179
|
+
t[2] !== o || t[3] !== s ? (c = /* @__PURE__ */ E("span", {
|
|
180
180
|
className: "text-foreground truncate",
|
|
181
181
|
children: [o, s]
|
|
182
182
|
}), t[2] = o, t[3] = s, t[4] = c) : c = t[4];
|
|
183
183
|
let l = r.type || "file", u;
|
|
184
|
-
t[5] === l ? u = t[6] : (u = /* @__PURE__ */
|
|
184
|
+
t[5] === l ? u = t[6] : (u = /* @__PURE__ */ T("span", {
|
|
185
185
|
className: "truncate",
|
|
186
186
|
children: l
|
|
187
187
|
}), t[5] = l, t[6] = u);
|
|
188
188
|
let d;
|
|
189
|
-
return t[7] !== r.name || t[8] !== n || t[9] !== c || t[10] !== u ? (d = /* @__PURE__ */
|
|
189
|
+
return t[7] !== r.name || t[8] !== n || t[9] !== c || t[10] !== u ? (d = /* @__PURE__ */ E("div", {
|
|
190
190
|
role: "img",
|
|
191
191
|
"aria-label": n,
|
|
192
192
|
title: r.name,
|
|
@@ -196,15 +196,15 @@ function H(e) {
|
|
|
196
196
|
}
|
|
197
197
|
//#endregion
|
|
198
198
|
//#region src/lib/ComposerVisibility.ts
|
|
199
|
-
function
|
|
199
|
+
function G(e, t) {
|
|
200
200
|
return e === "hidden" ? !1 : e === "before-interaction" ? !t : e !== "after-interaction" || t;
|
|
201
201
|
}
|
|
202
202
|
//#endregion
|
|
203
203
|
//#region src/lib/ComposerSlashCommands.ts
|
|
204
|
-
function
|
|
205
|
-
let r =
|
|
204
|
+
function ae(e, t, n) {
|
|
205
|
+
let r = oe(e), i = t.filter((e) => se(e) && G(e.visibility, n));
|
|
206
206
|
return r ? i.map((e, t) => {
|
|
207
|
-
let n =
|
|
207
|
+
let n = le(r, e);
|
|
208
208
|
return n === null ? null : {
|
|
209
209
|
command: e,
|
|
210
210
|
rank: n,
|
|
@@ -212,52 +212,52 @@ function W(e, t, n) {
|
|
|
212
212
|
};
|
|
213
213
|
}).filter((e) => !!e).sort((e, t) => e.rank - t.rank || e.index - t.index).map((e) => e.command).slice(0, 10) : i.slice(0, 10);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function K(e, t) {
|
|
216
216
|
let n = e.toLowerCase();
|
|
217
|
-
return t.find((e) =>
|
|
217
|
+
return t.find((e) => se(e) && (e.value.toLowerCase() === n || ce(e).some((e) => e === n)));
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function oe(e) {
|
|
220
220
|
return e.slice(1).toLowerCase();
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function se(e) {
|
|
223
223
|
return e.availability !== "disabled";
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function ce(e) {
|
|
226
226
|
return (e.aliases ?? []).map((e) => e.toLowerCase());
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
let n = t.value.toLowerCase(), r =
|
|
228
|
+
function le(e, t) {
|
|
229
|
+
let n = t.value.toLowerCase(), r = ce(t), i = [t.label.toLowerCase(), ...(t.searchTerms ?? []).map((e) => e.toLowerCase())];
|
|
230
230
|
return n === e ? 0 : r.some((t) => t === e) ? 1 : n.startsWith(e) ? 2 : r.some((t) => t.startsWith(e)) ? 3 : i.some((t) => t.startsWith(e)) ? 4 : null;
|
|
231
231
|
}
|
|
232
232
|
//#endregion
|
|
233
233
|
//#region src/lib/ComposerTriggers.ts
|
|
234
234
|
function q(e) {
|
|
235
|
-
return e.map(
|
|
235
|
+
return e.map(RegExp.escape).join("|");
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function ue(e) {
|
|
238
238
|
return `(?:${q(e)})[A-Za-z0-9_:-]+`;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function de(e) {
|
|
241
241
|
return `(?:${q(e)})[^\\s]+`;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function fe(e, t) {
|
|
244
244
|
let n = [];
|
|
245
|
-
return t.length > 0 && n.push(
|
|
245
|
+
return t.length > 0 && n.push(de(t)), e.length > 0 && n.push(ue(e)), n.length > 0 ? new RegExp(n.join("|"), "g") : null;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function pe(e, t) {
|
|
248
248
|
return t.some((t) => e.startsWith(t));
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function J(e) {
|
|
251
251
|
return `${e.trigger}${e.value}`;
|
|
252
252
|
}
|
|
253
253
|
//#endregion
|
|
254
254
|
//#region src/lib/ComposerCore.ts
|
|
255
|
-
function
|
|
255
|
+
function me({ initialDraft: e, text: t = "", slashCommands: n = [], mentionCandidates: r = [], commandTriggers: i = [], remoteImageUrls: a = [], isTaskRunning: o = !1, queueSubmissions: s = !1 } = {}) {
|
|
256
256
|
let c = e?.text ?? t, l = r.flatMap((e) => {
|
|
257
|
-
let t =
|
|
257
|
+
let t = Fe("mention", J(e), c, { detail: e.detail });
|
|
258
258
|
return t ? [t] : [];
|
|
259
259
|
}), u = l.flatMap((e) => {
|
|
260
|
-
let t = r.find((t) =>
|
|
260
|
+
let t = r.find((t) => J(t) === e.label);
|
|
261
261
|
return t ? [{
|
|
262
262
|
id: e.id,
|
|
263
263
|
trigger: t.trigger,
|
|
@@ -266,13 +266,13 @@ function de({ initialDraft: e, text: t = "", slashCommands: n = [], mentionCandi
|
|
|
266
266
|
persistsAs: t.persistsAs
|
|
267
267
|
}] : [];
|
|
268
268
|
}), d = e?.remoteImages ?? (e?.remoteImageUrls ?? a).map((e, t) => ({
|
|
269
|
-
id:
|
|
269
|
+
id: $("remote-image", e, t),
|
|
270
270
|
url: e
|
|
271
271
|
}));
|
|
272
272
|
return {
|
|
273
273
|
text: c,
|
|
274
274
|
cursor: c.length,
|
|
275
|
-
elements:
|
|
275
|
+
elements: Z(e?.elements ?? [...Y(c, n, i), ...l]),
|
|
276
276
|
mentionBindings: e?.mentionBindings ?? u,
|
|
277
277
|
imageAttachments: [],
|
|
278
278
|
remoteImages: d,
|
|
@@ -288,47 +288,47 @@ function de({ initialDraft: e, text: t = "", slashCommands: n = [], mentionCandi
|
|
|
288
288
|
killBuffer: ""
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function he(e) {
|
|
292
292
|
return e.text.length === 0 && e.imageAttachments.length === 0 && e.remoteImages.length === 0 && e.pendingPastes.length === 0;
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
return
|
|
294
|
+
function ge(e, t, n) {
|
|
295
|
+
return ye(e, t, n);
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function _e(e, t) {
|
|
298
298
|
if (!t || t < 1) return null;
|
|
299
|
-
let n =
|
|
299
|
+
let n = He(e.prompt);
|
|
300
300
|
return n <= t ? null : `Prompt is too long after expanding pasted content (${n} chars; max ${t} chars).`;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
let r =
|
|
304
|
-
r = [...r.filter((e) => e.kind !== "slash-command"), ...
|
|
302
|
+
function ve(e, t, n) {
|
|
303
|
+
let r = ke(e.elements, e.text);
|
|
304
|
+
r = [...r.filter((e) => e.kind !== "slash-command"), ...Y(e.text, t, n)];
|
|
305
305
|
let i = e.mentionBindings.filter((e) => r.some((t) => t.id === e.id)), a = e.imageAttachments.filter((e) => r.some((t) => t.kind === "image" && t.label === e.placeholder)), o = e.pendingPastes.filter((e) => r.some((t) => t.kind === "paste" && t.label === e.placeholder));
|
|
306
306
|
return {
|
|
307
307
|
...e,
|
|
308
|
-
elements:
|
|
308
|
+
elements: Z(r),
|
|
309
309
|
mentionBindings: i,
|
|
310
|
-
imageAttachments:
|
|
310
|
+
imageAttachments: Be(a, e.remoteImages.length),
|
|
311
311
|
pendingPastes: o
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
let r = e.text.trim(), i =
|
|
314
|
+
function ye(e, t, n) {
|
|
315
|
+
let r = e.text.trim(), i = Te(e.text, r, e.elements), a = Ce(e.text, e.elements, e.pendingPastes), o = a.text, s = o.trim(), c = Te(o, s, a.elements), l = e.imageAttachments.filter((t) => e.text.includes(t.placeholder)), u = Ee(r, i), d = Je({
|
|
316
316
|
text: u.text,
|
|
317
317
|
elements: u.elements,
|
|
318
318
|
mentionBindings: e.mentionBindings
|
|
319
|
-
}), f =
|
|
319
|
+
}), f = Je({
|
|
320
320
|
text: s,
|
|
321
321
|
elements: c,
|
|
322
322
|
mentionBindings: e.mentionBindings
|
|
323
323
|
});
|
|
324
324
|
if (!s && l.length === 0 && e.remoteImages.length === 0) return null;
|
|
325
|
-
let p =
|
|
325
|
+
let p = pe(o, n) ? be(s, c, t, n) : null, m = p?.prompt === void 0 ? null : p.args ? `${p.prompt}\n\n${Je({
|
|
326
326
|
text: p.args,
|
|
327
327
|
elements: p.argsElements,
|
|
328
328
|
mentionBindings: e.mentionBindings
|
|
329
329
|
})}` : p.prompt, h = p?.prompt === void 0 ? null : p.args ? (() => {
|
|
330
|
-
let t =
|
|
331
|
-
return `${p.prompt}\n\n${
|
|
330
|
+
let t = Ee(p.args, p.argsElements);
|
|
331
|
+
return `${p.prompt}\n\n${Je({
|
|
332
332
|
text: t.text,
|
|
333
333
|
elements: t.elements,
|
|
334
334
|
mentionBindings: e.mentionBindings
|
|
@@ -377,16 +377,16 @@ function he(e, t, n) {
|
|
|
377
377
|
mentionBindings: e.mentionBindings
|
|
378
378
|
};
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function Y(e, t, n) {
|
|
381
381
|
let r = [];
|
|
382
382
|
if (n.length === 0) return r;
|
|
383
383
|
let i = e.matchAll(RegExp(`(^|\\s)((?:${q(n)})([A-Za-z0-9_:-]+))(?=\\s|$)`, "g"));
|
|
384
384
|
for (let e of i) {
|
|
385
|
-
let n =
|
|
385
|
+
let n = K(e[3], t);
|
|
386
386
|
if (!n) continue;
|
|
387
387
|
let i = e[2], a = e.index + e[1].length;
|
|
388
388
|
r.push({
|
|
389
|
-
id:
|
|
389
|
+
id: $("slash-command", i, a),
|
|
390
390
|
kind: "slash-command",
|
|
391
391
|
label: i,
|
|
392
392
|
range: {
|
|
@@ -398,10 +398,10 @@ function ge(e, t, n) {
|
|
|
398
398
|
}
|
|
399
399
|
return r;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function be(e, t, n, r) {
|
|
402
402
|
let i = e.match(RegExp(`^(?:${q(r)})([A-Za-z0-9_:-]+)(?:\\s+([\\s\\S]+))?$`));
|
|
403
403
|
if (!i) return null;
|
|
404
|
-
let a =
|
|
404
|
+
let a = K(i[1], n);
|
|
405
405
|
if (!a) return null;
|
|
406
406
|
let o = i[2] ?? "";
|
|
407
407
|
if (!o.trim()) return {
|
|
@@ -414,15 +414,15 @@ function Z(e, t, n, r) {
|
|
|
414
414
|
command: a.value,
|
|
415
415
|
prompt: a.expandsTo,
|
|
416
416
|
args: u,
|
|
417
|
-
argsElements:
|
|
417
|
+
argsElements: we(t, l, l + u.length)
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
|
-
function
|
|
420
|
+
function xe(e, t, n) {
|
|
421
421
|
if (n.length === 0) return null;
|
|
422
422
|
let r = e.match(RegExp(`^(?:${q(n)})([A-Za-z0-9_:-]+)(?:\\s+[\\s\\S]*)?$`));
|
|
423
|
-
return !r ||
|
|
423
|
+
return !r || K(r[1], t) || X(r[1]) ? null : r[1];
|
|
424
424
|
}
|
|
425
|
-
var
|
|
425
|
+
var Se = /* @__PURE__ */ new Set([
|
|
426
426
|
"Applications",
|
|
427
427
|
"Library",
|
|
428
428
|
"System",
|
|
@@ -441,10 +441,10 @@ var ve = /* @__PURE__ */ new Set([
|
|
|
441
441
|
"var",
|
|
442
442
|
"workspace"
|
|
443
443
|
]);
|
|
444
|
-
function
|
|
445
|
-
return
|
|
444
|
+
function X(e) {
|
|
445
|
+
return Se.has(e);
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function Ce(e, t, n) {
|
|
448
448
|
if (n.length === 0 || t.length === 0) return {
|
|
449
449
|
text: e,
|
|
450
450
|
elements: t
|
|
@@ -455,7 +455,7 @@ function be(e, t, n) {
|
|
|
455
455
|
t.push(e.content), r.set(e.placeholder, t);
|
|
456
456
|
}
|
|
457
457
|
let i = "", a = [], o = 0;
|
|
458
|
-
for (let n of
|
|
458
|
+
for (let n of Z(t)) {
|
|
459
459
|
let t = Math.min(n.range.start, e.length), s = Math.min(n.range.end, e.length);
|
|
460
460
|
if (t > s) continue;
|
|
461
461
|
t > o && (i += e.slice(o, t));
|
|
@@ -478,7 +478,7 @@ function be(e, t, n) {
|
|
|
478
478
|
elements: a
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function we(e, t, n) {
|
|
482
482
|
return e.filter((e) => e.range.end > t && e.range.start < n).map((e) => ({
|
|
483
483
|
...e,
|
|
484
484
|
range: {
|
|
@@ -487,7 +487,7 @@ function xe(e, t, n) {
|
|
|
487
487
|
}
|
|
488
488
|
})).filter((e) => e.range.start < e.range.end);
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function Te(e, t, n) {
|
|
491
491
|
let r = e.indexOf(t);
|
|
492
492
|
return r <= 0 ? n : n.filter((e) => e.range.end > r).map((e) => ({
|
|
493
493
|
...e,
|
|
@@ -497,13 +497,13 @@ function Se(e, t, n) {
|
|
|
497
497
|
}
|
|
498
498
|
}));
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
let n =
|
|
502
|
-
for (let t of n.toReversed()) e =
|
|
500
|
+
function Ee(e, t) {
|
|
501
|
+
let n = Z(t.filter((e) => e.kind === "image"));
|
|
502
|
+
for (let t of n.toReversed()) e = Oe(e, t.range, "");
|
|
503
503
|
let r = (e) => n.reduce((t, n) => t + Math.max(0, Math.min(e, n.range.end) - n.range.start), 0);
|
|
504
504
|
return {
|
|
505
505
|
text: e,
|
|
506
|
-
elements:
|
|
506
|
+
elements: Z(t.filter((e) => e.kind !== "image")).map((e) => ({
|
|
507
507
|
...e,
|
|
508
508
|
range: {
|
|
509
509
|
start: e.range.start - r(e.range.start),
|
|
@@ -512,25 +512,25 @@ function Ce(e, t) {
|
|
|
512
512
|
}))
|
|
513
513
|
};
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function De(e, t, n, r) {
|
|
516
516
|
return e < r && t > n;
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function Oe(e, t, n) {
|
|
519
519
|
return e.slice(0, t.start) + n + e.slice(t.end);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function ke(e, t) {
|
|
522
522
|
let n = /* @__PURE__ */ new Map();
|
|
523
|
-
return
|
|
524
|
-
let r =
|
|
523
|
+
return Z(e).map((e) => {
|
|
524
|
+
let r = Ae(t, e.label);
|
|
525
525
|
if (r.length === 0) return null;
|
|
526
|
-
let i = `${e.kind}:${e.label}`, a = n.get(i) ?? [], o =
|
|
526
|
+
let i = `${e.kind}:${e.label}`, a = n.get(i) ?? [], o = je(r, e, a) ?? Me(r, e, a) ?? Ne(r, e);
|
|
527
527
|
return n.set(i, [...a, o]), {
|
|
528
528
|
...e,
|
|
529
529
|
range: o
|
|
530
530
|
};
|
|
531
531
|
}).filter((e) => !!e);
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function Ae(e, t) {
|
|
534
534
|
if (!t) return [];
|
|
535
535
|
let n = [], r = e.indexOf(t);
|
|
536
536
|
for (; r !== -1;) n.push({
|
|
@@ -539,22 +539,22 @@ function De(e, t) {
|
|
|
539
539
|
}), r = e.indexOf(t, r + t.length);
|
|
540
540
|
return n;
|
|
541
541
|
}
|
|
542
|
-
function
|
|
543
|
-
return e.find((e) => e.start === t.range.start && e.end === t.range.end && !
|
|
542
|
+
function je(e, t, n) {
|
|
543
|
+
return e.find((e) => e.start === t.range.start && e.end === t.range.end && !Pe(e, n));
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
return
|
|
545
|
+
function Me(e, t, n) {
|
|
546
|
+
return Ne(e.filter((e) => !Pe(e, n)), t);
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function Ne(e, t) {
|
|
549
549
|
return [...e].sort((e, n) => Math.abs(e.start - t.range.start) - Math.abs(n.start - t.range.start) || e.start - n.start)[0];
|
|
550
550
|
}
|
|
551
|
-
function
|
|
552
|
-
return t.some((t) => e.start === t.start && e.end === t.end &&
|
|
551
|
+
function Pe(e, t) {
|
|
552
|
+
return t.some((t) => e.start === t.start && e.end === t.end && De(e.start, e.end, t.start, t.end));
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Fe(e, t, n, r = {}) {
|
|
555
555
|
let i = n.indexOf(t);
|
|
556
556
|
return i === -1 ? null : {
|
|
557
|
-
id:
|
|
557
|
+
id: $(e, t, i),
|
|
558
558
|
kind: e,
|
|
559
559
|
label: t,
|
|
560
560
|
range: {
|
|
@@ -564,95 +564,95 @@ function Me(e, t, n, r = {}) {
|
|
|
564
564
|
detail: r.detail
|
|
565
565
|
};
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function Z(e) {
|
|
568
568
|
return [...e].sort((e, t) => e.range.start - t.range.start);
|
|
569
569
|
}
|
|
570
|
-
var
|
|
570
|
+
var Ie = {
|
|
571
571
|
image: "Image",
|
|
572
572
|
video: "Video",
|
|
573
573
|
audio: "Audio"
|
|
574
574
|
};
|
|
575
|
-
function
|
|
575
|
+
function Le(e) {
|
|
576
576
|
let t = e.type.split("/")[0];
|
|
577
577
|
return t === "image" || t === "video" || t === "audio" ? t : null;
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function Re(e) {
|
|
580
580
|
return e === "video" || e === "audio" ? e : "image";
|
|
581
581
|
}
|
|
582
|
-
function
|
|
583
|
-
return `[${
|
|
582
|
+
function ze(e, t) {
|
|
583
|
+
return `[${Ie[e]} #${t}]`;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function Be(e, t) {
|
|
586
586
|
return e.map((e, n) => ({
|
|
587
587
|
...e,
|
|
588
|
-
placeholder:
|
|
588
|
+
placeholder: ze(e.media, t + n + 1)
|
|
589
589
|
}));
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function Ve(e, t) {
|
|
592
592
|
if (!t) return null;
|
|
593
593
|
let n = e.remoteImages.findIndex((e) => e.id === t);
|
|
594
594
|
return n === -1 ? null : n;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function He(e) {
|
|
597
597
|
return Array.from(e).length;
|
|
598
598
|
}
|
|
599
|
-
function
|
|
600
|
-
let t =
|
|
599
|
+
function Ue(e) {
|
|
600
|
+
let t = Ee(e.text, e.elements);
|
|
601
601
|
return {
|
|
602
602
|
text: t.text,
|
|
603
|
-
elements:
|
|
604
|
-
mentionBindings:
|
|
603
|
+
elements: rt(t.elements),
|
|
604
|
+
mentionBindings: it(e.mentionBindings),
|
|
605
605
|
remoteImages: e.remoteImages.map((e) => ({ ...e })),
|
|
606
|
-
pendingPastes:
|
|
606
|
+
pendingPastes: at(e.pendingPastes)
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
|
-
function
|
|
609
|
+
function We(e, t) {
|
|
610
610
|
return {
|
|
611
611
|
persistedPrompt: t,
|
|
612
612
|
remoteImages: e.remoteImages.map((e) => ({ ...e })),
|
|
613
|
-
pendingPastes:
|
|
613
|
+
pendingPastes: at(e.pendingPastes)
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
let n =
|
|
616
|
+
function Ge(e, t) {
|
|
617
|
+
let n = We(e, t);
|
|
618
618
|
return !n.persistedPrompt.trim() && n.remoteImages.length === 0 && n.pendingPastes.length === 0 ? e.history : [n, ...e.history].slice(0, 8);
|
|
619
619
|
}
|
|
620
|
-
function
|
|
621
|
-
let i =
|
|
622
|
-
return
|
|
620
|
+
function Ke({ text: e, slashCommands: t = [], commandTriggers: n = [], mentionCandidates: r = [] }) {
|
|
621
|
+
let i = Xe(e, r), a = et(i.text, i.elements, i.protectedRanges, t, r);
|
|
622
|
+
return Ue(ve(me({
|
|
623
623
|
initialDraft: {
|
|
624
624
|
text: i.text,
|
|
625
|
-
elements:
|
|
625
|
+
elements: Z([...i.elements, ...a.elements]),
|
|
626
626
|
mentionBindings: [...i.mentionBindings, ...a.mentionBindings]
|
|
627
627
|
},
|
|
628
628
|
slashCommands: t
|
|
629
629
|
}), t, n));
|
|
630
630
|
}
|
|
631
|
-
function
|
|
632
|
-
let r =
|
|
631
|
+
function qe({ source: e, slashCommands: t = [], mentionCandidates: n = [] }) {
|
|
632
|
+
let r = Ke({
|
|
633
633
|
text: e.persistedPrompt,
|
|
634
634
|
slashCommands: t,
|
|
635
635
|
mentionCandidates: n
|
|
636
636
|
}), i = [...e.pendingPastes.flatMap((e) => {
|
|
637
|
-
let t =
|
|
637
|
+
let t = Fe("paste", e.placeholder, r.text ?? "", { detail: `${He(e.content)} chars` });
|
|
638
638
|
return t ? [t] : [];
|
|
639
639
|
})];
|
|
640
640
|
return {
|
|
641
641
|
...r,
|
|
642
|
-
elements:
|
|
642
|
+
elements: Z([...r.elements ?? [], ...i]),
|
|
643
643
|
remoteImages: e.remoteImages.map((e) => ({ ...e })),
|
|
644
|
-
pendingPastes:
|
|
644
|
+
pendingPastes: at(e.pendingPastes)
|
|
645
645
|
};
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
let t = e.text ?? "", n =
|
|
649
|
-
for (let e of n) t =
|
|
647
|
+
function Je(e) {
|
|
648
|
+
let t = e.text ?? "", n = Z(e.elements ?? []).map((t) => nt(t, e)).filter((e) => !!e).sort((e, t) => t.range.start - e.range.start);
|
|
649
|
+
for (let e of n) t = Oe(t, e.range, e.text);
|
|
650
650
|
return t;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function Ye(e) {
|
|
653
653
|
return e.startsWith("composer-text-link://") ? decodeURIComponent(e.replace(/^composer-text-link:\/\//, "")) : e;
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function Xe(e, t) {
|
|
656
656
|
let n = [], i = [], a = [], o = "";
|
|
657
657
|
for (let s of r(e)) {
|
|
658
658
|
if (s.kind === "inline-code" || s.kind === "code-block") {
|
|
@@ -667,9 +667,9 @@ function Ke(e, t) {
|
|
|
667
667
|
o += s.source;
|
|
668
668
|
continue;
|
|
669
669
|
}
|
|
670
|
-
let e = s.label, r = s.href, c =
|
|
670
|
+
let e = s.label, r = s.href, c = Ye(r), l = Q(e, t), u = l ? J(l) : e, d = o.length;
|
|
671
671
|
if (o += u, l) {
|
|
672
|
-
let e =
|
|
672
|
+
let e = $("mention", u, d);
|
|
673
673
|
n.push({
|
|
674
674
|
id: e,
|
|
675
675
|
kind: "mention",
|
|
@@ -687,7 +687,7 @@ function Ke(e, t) {
|
|
|
687
687
|
persistsAs: l.persistsAs
|
|
688
688
|
});
|
|
689
689
|
} else n.push({
|
|
690
|
-
id:
|
|
690
|
+
id: $("link", u, d),
|
|
691
691
|
kind: "link",
|
|
692
692
|
label: u,
|
|
693
693
|
range: {
|
|
@@ -704,30 +704,30 @@ function Ke(e, t) {
|
|
|
704
704
|
protectedRanges: a
|
|
705
705
|
};
|
|
706
706
|
}
|
|
707
|
-
function
|
|
708
|
-
return t.find((t) =>
|
|
707
|
+
function Q(e, t) {
|
|
708
|
+
return t.find((t) => J(t) === e) ?? null;
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function Ze(e) {
|
|
711
711
|
return [...new Set(e.map((e) => e.trigger).filter(Boolean))].sort((e, t) => t.length - e.length);
|
|
712
712
|
}
|
|
713
|
-
function
|
|
714
|
-
let t =
|
|
715
|
-
return t.length === 0 ? null : RegExp(`(?:${t
|
|
713
|
+
function Qe(e) {
|
|
714
|
+
let t = Ze(e);
|
|
715
|
+
return t.length === 0 ? null : RegExp(`(?:${q(t)})[A-Za-z0-9_:-]+`, "g");
|
|
716
716
|
}
|
|
717
|
-
function
|
|
718
|
-
return
|
|
717
|
+
function $e(e, t) {
|
|
718
|
+
return Ze(t).find((t) => e.startsWith(t))?.length ?? 0;
|
|
719
719
|
}
|
|
720
|
-
function
|
|
720
|
+
function et(e, t, n, r, i) {
|
|
721
721
|
let a = [], o = [], s = [], c = (r, i) => {
|
|
722
722
|
let a = r + i.length;
|
|
723
|
-
return (r === 0 || /\s/.test(e[r - 1] ?? "")) && !
|
|
724
|
-
}, l = [...i].sort((e, t) =>
|
|
723
|
+
return (r === 0 || /\s/.test(e[r - 1] ?? "")) && !tt(r, i, t) && !s.some((e) => r < e.end && a > e.start) && !n.some((e) => r < e.end && a > e.start);
|
|
724
|
+
}, l = [...i].sort((e, t) => J(t).length - J(e).length);
|
|
725
725
|
for (let t of l) {
|
|
726
|
-
let n =
|
|
726
|
+
let n = J(t);
|
|
727
727
|
if (n) for (let r = e.indexOf(n); r !== -1; r = e.indexOf(n, r + n.length)) {
|
|
728
728
|
let i = r + n.length;
|
|
729
729
|
if (/[\w-]/.test(e[i] ?? "") || !c(r, n)) continue;
|
|
730
|
-
let l =
|
|
730
|
+
let l = $("mention", n, r);
|
|
731
731
|
s.push({
|
|
732
732
|
start: r,
|
|
733
733
|
end: i
|
|
@@ -749,16 +749,16 @@ function Ze(e, t, n, r, i) {
|
|
|
749
749
|
});
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
-
let u =
|
|
752
|
+
let u = Qe(r);
|
|
753
753
|
for (let t of u ? e.matchAll(u) : []) {
|
|
754
754
|
let e = t.index ?? 0, n = t[0];
|
|
755
755
|
if (!c(e, n)) continue;
|
|
756
|
-
let i =
|
|
756
|
+
let i = K(n.slice($e(n, r)), r);
|
|
757
757
|
i && (s.push({
|
|
758
758
|
start: e,
|
|
759
759
|
end: e + n.length
|
|
760
760
|
}), a.push({
|
|
761
|
-
id:
|
|
761
|
+
id: $("slash-command", n, e),
|
|
762
762
|
kind: "slash-command",
|
|
763
763
|
label: n,
|
|
764
764
|
range: {
|
|
@@ -773,11 +773,11 @@ function Ze(e, t, n, r, i) {
|
|
|
773
773
|
mentionBindings: o
|
|
774
774
|
};
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function tt(e, t, n) {
|
|
777
777
|
let r = e + t.length;
|
|
778
778
|
return n.some((t) => e < t.range.end && r > t.range.start);
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function nt(e, n) {
|
|
781
781
|
if (e.kind === "mention") {
|
|
782
782
|
let t = (n.mentionBindings ?? []).find((t) => t.id === e.id || `${t.trigger}${t.value}` === e.label);
|
|
783
783
|
return t ? {
|
|
@@ -790,7 +790,7 @@ function $e(e, n) {
|
|
|
790
790
|
text: t(e.label, e.detail)
|
|
791
791
|
} : null;
|
|
792
792
|
}
|
|
793
|
-
function
|
|
793
|
+
function rt(e) {
|
|
794
794
|
return e.map((e) => {
|
|
795
795
|
let t = {
|
|
796
796
|
...e,
|
|
@@ -802,13 +802,13 @@ function et(e) {
|
|
|
802
802
|
} : t;
|
|
803
803
|
});
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function it(e) {
|
|
806
806
|
return e.map((e) => ({ ...e }));
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function at(e) {
|
|
809
809
|
return e.map((e) => ({ ...e }));
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function ot(e, t, n, r = 1) {
|
|
812
812
|
if (t.length === 0) return null;
|
|
813
813
|
let i = t.toLowerCase(), a = e.map((e, t) => ({
|
|
814
814
|
index: t,
|
|
@@ -817,88 +817,88 @@ function rt(e, t, n, r = 1) {
|
|
|
817
817
|
if (a.length === 0) return null;
|
|
818
818
|
if (n === null) return a[0];
|
|
819
819
|
let o = a.findIndex((e) => e.index === n);
|
|
820
|
-
return o === -1 ? a[0] : a[
|
|
820
|
+
return o === -1 ? a[0] : a[ut(o + r, a.length)];
|
|
821
821
|
}
|
|
822
|
-
function
|
|
822
|
+
function st(e, t, n) {
|
|
823
823
|
return n === -1 ? t === 0 || !e.slice(0, t).includes("\n") : t === e.length || !e.slice(t).includes("\n");
|
|
824
824
|
}
|
|
825
|
-
function
|
|
826
|
-
let n =
|
|
827
|
-
for (; n > 0 &&
|
|
825
|
+
function ct(e, t) {
|
|
826
|
+
let n = dt(e, t);
|
|
827
|
+
for (; n > 0 && vt(mt(e, n));) n = ft(e, n);
|
|
828
828
|
if (n === 0) return 0;
|
|
829
|
-
let r =
|
|
830
|
-
if (r === "cjk") return
|
|
831
|
-
for (; n > 0 &&
|
|
829
|
+
let r = xt(mt(e, n));
|
|
830
|
+
if (r === "cjk") return ft(e, n);
|
|
831
|
+
for (; n > 0 && xt(mt(e, n)) === r;) n = ft(e, n);
|
|
832
832
|
return n;
|
|
833
833
|
}
|
|
834
|
-
function
|
|
835
|
-
let n =
|
|
836
|
-
for (; n < e.length &&
|
|
834
|
+
function lt(e, t) {
|
|
835
|
+
let n = dt(e, t);
|
|
836
|
+
for (; n < e.length && vt(ht(e, n));) n = pt(e, n);
|
|
837
837
|
if (n >= e.length) return e.length;
|
|
838
|
-
let r =
|
|
839
|
-
if (r === "cjk") return
|
|
840
|
-
for (; n < e.length &&
|
|
838
|
+
let r = xt(ht(e, n));
|
|
839
|
+
if (r === "cjk") return pt(e, n);
|
|
840
|
+
for (; n < e.length && xt(ht(e, n)) === r;) n = pt(e, n);
|
|
841
841
|
return n;
|
|
842
842
|
}
|
|
843
|
-
function
|
|
843
|
+
function ut(e, t) {
|
|
844
844
|
return (e % t + t) % t;
|
|
845
845
|
}
|
|
846
|
-
function
|
|
846
|
+
function $(e, t, n) {
|
|
847
847
|
return `${e}:${n}:${t}`;
|
|
848
848
|
}
|
|
849
|
-
function
|
|
849
|
+
function dt(e, t) {
|
|
850
850
|
let n = Math.max(0, Math.min(t, e.length));
|
|
851
|
-
return n > 0 && n < e.length &&
|
|
851
|
+
return n > 0 && n < e.length && _t(e.charCodeAt(n)) && --n, n;
|
|
852
852
|
}
|
|
853
|
-
function
|
|
853
|
+
function ft(e, t) {
|
|
854
854
|
let n = t - 1;
|
|
855
|
-
return n > 0 &&
|
|
855
|
+
return n > 0 && _t(e.charCodeAt(n)) ? n - 1 : Math.max(n, 0);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
let n = t + (
|
|
857
|
+
function pt(e, t) {
|
|
858
|
+
let n = t + (gt(e.charCodeAt(t)) ? 2 : 1);
|
|
859
859
|
return Math.min(n, e.length);
|
|
860
860
|
}
|
|
861
|
-
function
|
|
862
|
-
let n =
|
|
861
|
+
function mt(e, t) {
|
|
862
|
+
let n = ft(e, t);
|
|
863
863
|
return e.slice(n, t);
|
|
864
864
|
}
|
|
865
|
-
function
|
|
866
|
-
return e.slice(t,
|
|
865
|
+
function ht(e, t) {
|
|
866
|
+
return e.slice(t, pt(e, t));
|
|
867
867
|
}
|
|
868
|
-
function
|
|
868
|
+
function gt(e) {
|
|
869
869
|
return e >= 55296 && e <= 56319;
|
|
870
870
|
}
|
|
871
|
-
function
|
|
871
|
+
function _t(e) {
|
|
872
872
|
return e >= 56320 && e <= 57343;
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function vt(e) {
|
|
875
875
|
return /\s/u.test(e);
|
|
876
876
|
}
|
|
877
|
-
function
|
|
878
|
-
return !
|
|
877
|
+
function yt(e) {
|
|
878
|
+
return !bt(e) && /[\p{Letter}\p{Number}_]/u.test(e);
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function bt(e) {
|
|
881
881
|
return /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(e);
|
|
882
882
|
}
|
|
883
|
-
function
|
|
884
|
-
return
|
|
883
|
+
function xt(e) {
|
|
884
|
+
return bt(e) ? "cjk" : yt(e) ? "word" : "separator";
|
|
885
885
|
}
|
|
886
886
|
//#endregion
|
|
887
887
|
//#region src/lib/ComposerDraft.ts
|
|
888
|
-
var
|
|
889
|
-
function
|
|
890
|
-
let t = localStorage.getItem(`${
|
|
888
|
+
var St = "composer-draft:v1:";
|
|
889
|
+
function Ct(e) {
|
|
890
|
+
let t = localStorage.getItem(`${St}${e}`);
|
|
891
891
|
if (!t) return null;
|
|
892
892
|
try {
|
|
893
893
|
let e = JSON.parse(t);
|
|
894
|
-
return
|
|
894
|
+
return Et(e) ? e : null;
|
|
895
895
|
} catch {
|
|
896
896
|
return null;
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
function
|
|
900
|
-
let n = `${
|
|
901
|
-
if (!t ||
|
|
899
|
+
function wt(e, t) {
|
|
900
|
+
let n = `${St}${e}`;
|
|
901
|
+
if (!t || Tt(t)) {
|
|
902
902
|
localStorage.removeItem(n);
|
|
903
903
|
return;
|
|
904
904
|
}
|
|
@@ -906,35 +906,35 @@ function St(e, t) {
|
|
|
906
906
|
localStorage.setItem(n, JSON.stringify(t));
|
|
907
907
|
} catch {}
|
|
908
908
|
}
|
|
909
|
-
function
|
|
909
|
+
function Tt(e) {
|
|
910
910
|
return !e.persistedPrompt.trim() && e.remoteImages.length === 0 && e.pendingPastes.length === 0;
|
|
911
911
|
}
|
|
912
|
-
function
|
|
913
|
-
return
|
|
912
|
+
function Et(e) {
|
|
913
|
+
return Dt(e) && Object.keys(e).every((e) => [
|
|
914
914
|
"persistedPrompt",
|
|
915
915
|
"remoteImages",
|
|
916
916
|
"pendingPastes"
|
|
917
917
|
].includes(e)) && typeof e.persistedPrompt == "string" && Array.isArray(e.remoteImages) && Array.isArray(e.pendingPastes);
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function Dt(e) {
|
|
920
920
|
return typeof e == "object" && !!e;
|
|
921
921
|
}
|
|
922
922
|
//#endregion
|
|
923
923
|
//#region src/lib/ComposerRegistry.tsx
|
|
924
|
-
var
|
|
925
|
-
function
|
|
924
|
+
var Ot = Symbol.for("composer.registry.trigger"), kt = Symbol.for("composer.registry.command"), At = Symbol.for("composer.registry.mention");
|
|
925
|
+
function jt(e) {
|
|
926
926
|
return null;
|
|
927
927
|
}
|
|
928
|
-
|
|
929
|
-
function
|
|
928
|
+
jt.role = Ot;
|
|
929
|
+
function Mt(e) {
|
|
930
930
|
return null;
|
|
931
931
|
}
|
|
932
|
-
|
|
933
|
-
function
|
|
932
|
+
Mt.role = kt;
|
|
933
|
+
function Nt(e) {
|
|
934
934
|
return null;
|
|
935
935
|
}
|
|
936
|
-
|
|
937
|
-
function
|
|
936
|
+
Nt.role = At;
|
|
937
|
+
function Pt(e) {
|
|
938
938
|
let t = [], n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = !1, o = (e) => {
|
|
939
939
|
for (let s of u.toArray(e)) {
|
|
940
940
|
if (!p(s)) {
|
|
@@ -945,8 +945,8 @@ function Mt(e) {
|
|
|
945
945
|
p(s) && o(s.props.children);
|
|
946
946
|
continue;
|
|
947
947
|
}
|
|
948
|
-
if (
|
|
949
|
-
p(s) &&
|
|
948
|
+
if (zt(s.type, Ot)) {
|
|
949
|
+
p(s) && Lt(s.props, {
|
|
950
950
|
slashCommands: t,
|
|
951
951
|
mentionCandidates: n,
|
|
952
952
|
commandTriggers: r,
|
|
@@ -954,7 +954,7 @@ function Mt(e) {
|
|
|
954
954
|
});
|
|
955
955
|
continue;
|
|
956
956
|
}
|
|
957
|
-
if (
|
|
957
|
+
if (zt(s.type, kt) || zt(s.type, At)) throw Error("Composer.Command and Composer.Mention must be placed inside a <Composer.Trigger>.");
|
|
958
958
|
a = !0;
|
|
959
959
|
}
|
|
960
960
|
};
|
|
@@ -966,29 +966,29 @@ function Mt(e) {
|
|
|
966
966
|
hasLayoutChildren: a
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
|
-
function
|
|
969
|
+
function Ft(e) {
|
|
970
970
|
return JSON.stringify([
|
|
971
|
-
e.slashCommands.map(
|
|
972
|
-
e.mentionCandidates.map(
|
|
971
|
+
e.slashCommands.map(It),
|
|
972
|
+
e.mentionCandidates.map(It),
|
|
973
973
|
e.commandTriggers,
|
|
974
974
|
e.mentionTriggers
|
|
975
975
|
]);
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function It(e) {
|
|
978
978
|
let { icon: t, ...n } = e;
|
|
979
979
|
return n;
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function Lt(e, t) {
|
|
982
982
|
let { trigger: n } = e;
|
|
983
983
|
for (let r of u.toArray(e.children)) if (p(r)) {
|
|
984
984
|
if (r.type === d) {
|
|
985
|
-
p(r) &&
|
|
985
|
+
p(r) && Lt({
|
|
986
986
|
trigger: n,
|
|
987
987
|
children: r.props.children
|
|
988
988
|
}, t);
|
|
989
989
|
continue;
|
|
990
990
|
}
|
|
991
|
-
if (
|
|
991
|
+
if (zt(r.type, kt)) {
|
|
992
992
|
if (t.mentionTriggers.has(n)) throw Error(`Composer.Trigger "${n}" already holds mentions; a trigger carries either commands or mentions, not both.`);
|
|
993
993
|
t.commandTriggers.add(n), p(r) && t.slashCommands.push({
|
|
994
994
|
...r.props,
|
|
@@ -997,15 +997,15 @@ function Ft(e, t) {
|
|
|
997
997
|
});
|
|
998
998
|
continue;
|
|
999
999
|
}
|
|
1000
|
-
if (
|
|
1000
|
+
if (zt(r.type, At)) {
|
|
1001
1001
|
if (t.commandTriggers.has(n)) throw Error(`Composer.Trigger "${n}" already holds commands; a trigger carries either commands or mentions, not both.`);
|
|
1002
|
-
t.mentionTriggers.add(n), p(r) && t.mentionCandidates.push(
|
|
1002
|
+
t.mentionTriggers.add(n), p(r) && t.mentionCandidates.push(Rt(r.props, n));
|
|
1003
1003
|
continue;
|
|
1004
1004
|
}
|
|
1005
1005
|
throw Error(`<Composer.Trigger trigger="${n}"> accepts only <Composer.Command> and <Composer.Mention> children; wrap them in a fragment rather than a component, which the registry cannot see through.`);
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function Rt(e, t) {
|
|
1009
1009
|
return {
|
|
1010
1010
|
id: e.id,
|
|
1011
1011
|
trigger: t,
|
|
@@ -1019,40 +1019,40 @@ function It(e, t) {
|
|
|
1019
1019
|
visibility: e.visibility
|
|
1020
1020
|
};
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1022
|
+
function zt(e, t) {
|
|
1023
1023
|
return typeof e == "function" && "role" in e && e.role === t;
|
|
1024
1024
|
}
|
|
1025
1025
|
//#endregion
|
|
1026
1026
|
//#region src/lib/ComposerSuggestions.ts
|
|
1027
|
-
function
|
|
1028
|
-
return [...
|
|
1027
|
+
function Bt(e, t, n, r) {
|
|
1028
|
+
return [...ae(e.query, t.filter((t) => t.trigger === e.trigger), r), ...Vt(e.query, n.filter((t) => t.trigger === e.trigger), r)];
|
|
1029
1029
|
}
|
|
1030
|
-
function
|
|
1030
|
+
function Vt(e, t, n) {
|
|
1031
1031
|
let r = e.slice(1).toLowerCase();
|
|
1032
|
-
return t.filter((e) =>
|
|
1032
|
+
return t.filter((e) => G(e.visibility, n) && (e.label.toLowerCase().includes(r) || J(e).slice(1).toLowerCase().includes(r))).slice(0, 10);
|
|
1033
1033
|
}
|
|
1034
1034
|
//#endregion
|
|
1035
1035
|
//#region src/lib/dictation/ComposerDictationContext.ts
|
|
1036
|
-
var
|
|
1037
|
-
function
|
|
1036
|
+
var Ht = f(null);
|
|
1037
|
+
function Ut(e) {
|
|
1038
1038
|
let t = e === void 0 ? "useComposerDictation" : e;
|
|
1039
|
-
|
|
1040
|
-
let n = h(
|
|
1039
|
+
F(t);
|
|
1040
|
+
let n = h(Ht);
|
|
1041
1041
|
if (!n) throw Error(`${t} needs the dictation prop of Composer.Root.`);
|
|
1042
1042
|
return n;
|
|
1043
1043
|
}
|
|
1044
1044
|
//#endregion
|
|
1045
1045
|
//#region src/lib/dictation/ComposerDictationParts.tsx
|
|
1046
|
-
function
|
|
1046
|
+
function Wt(e, t) {
|
|
1047
1047
|
return typeof e == "function" ? (n) => e(n, t) : e;
|
|
1048
1048
|
}
|
|
1049
|
-
function
|
|
1049
|
+
function Gt(e) {
|
|
1050
1050
|
let t = i(15), n, r, o;
|
|
1051
1051
|
t[0] === e ? (n = t[1], r = t[2], o = t[3]) : ({render: o, disabled: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = o);
|
|
1052
|
-
let { disabled: s } =
|
|
1053
|
-
t[4] !== o || t[5] !== c ? (_ =
|
|
1052
|
+
let { disabled: s } = F("Composer.Dictate"), { state: c, start: l, stop: u } = Ut("Composer.Dictate"), d = c.status === "recording", f = (c.status === "idle" || c.status === "failed") && n !== !0 && !s, p = c.status, m = c.status === "finishing" ? c.end : void 0, h = !d && !f, g = d ? u : l, _;
|
|
1053
|
+
t[4] !== o || t[5] !== c ? (_ = Wt(o, c), t[4] = o, t[5] = c, t[6] = _) : _ = t[6];
|
|
1054
1054
|
let v;
|
|
1055
|
-
return t[7] !== r || t[8] !== d || t[9] !== c.status || t[10] !== m || t[11] !== h || t[12] !== g || t[13] !== _ ? (v = /* @__PURE__ */
|
|
1055
|
+
return t[7] !== r || t[8] !== d || t[9] !== c.status || t[10] !== m || t[11] !== h || t[12] !== g || t[13] !== _ ? (v = /* @__PURE__ */ T(a, {
|
|
1056
1056
|
...r,
|
|
1057
1057
|
"data-status": p,
|
|
1058
1058
|
"data-end": m,
|
|
@@ -1062,13 +1062,13 @@ function Ut(e) {
|
|
|
1062
1062
|
render: _
|
|
1063
1063
|
}), t[7] = r, t[8] = d, t[9] = c.status, t[10] = m, t[11] = h, t[12] = g, t[13] = _, t[14] = v) : v = t[14], v;
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function Kt(e) {
|
|
1066
1066
|
let t = i(13), n, r, o;
|
|
1067
1067
|
t[0] === e ? (n = t[1], r = t[2], o = t[3]) : ({render: o, disabled: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = o);
|
|
1068
|
-
let { state: s, cancel: c } =
|
|
1069
|
-
t[4] !== o || t[5] !== s ? (f =
|
|
1068
|
+
let { state: s, cancel: c } = Ut("Composer.CancelDictation"), l = s.status === "starting" || s.status === "recording" || s.status === "finishing", u = s.status, d = !l || n === !0, f;
|
|
1069
|
+
t[4] !== o || t[5] !== s ? (f = Wt(o, s), t[4] = o, t[5] = s, t[6] = f) : f = t[6];
|
|
1070
1070
|
let p;
|
|
1071
|
-
return t[7] !== c || t[8] !== r || t[9] !== s.status || t[10] !== d || t[11] !== f ? (p = /* @__PURE__ */
|
|
1071
|
+
return t[7] !== c || t[8] !== r || t[9] !== s.status || t[10] !== d || t[11] !== f ? (p = /* @__PURE__ */ T(a, {
|
|
1072
1072
|
...r,
|
|
1073
1073
|
"data-status": u,
|
|
1074
1074
|
disabled: d,
|
|
@@ -1078,12 +1078,12 @@ function Wt(e) {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
//#endregion
|
|
1080
1080
|
//#region src/lib/dictation/DictationError.ts
|
|
1081
|
-
var
|
|
1081
|
+
var qt = class extends Error {
|
|
1082
1082
|
code;
|
|
1083
1083
|
constructor(e, t) {
|
|
1084
1084
|
super(`Dictation failed: ${e}`, t), this.name = "DictationError", this.code = e;
|
|
1085
1085
|
}
|
|
1086
|
-
},
|
|
1086
|
+
}, Jt = class {
|
|
1087
1087
|
#e = "unknown";
|
|
1088
1088
|
subscribe = (e) => {
|
|
1089
1089
|
let t = new AbortController();
|
|
@@ -1100,11 +1100,11 @@ var Gt = class extends Error {
|
|
|
1100
1100
|
};
|
|
1101
1101
|
};
|
|
1102
1102
|
getSnapshot = () => this.#e;
|
|
1103
|
-
},
|
|
1103
|
+
}, Yt = /* @__PURE__ */ new Map([
|
|
1104
1104
|
["NotAllowedError", "permission-denied"],
|
|
1105
1105
|
["NotFoundError", "no-microphone"],
|
|
1106
1106
|
["NotReadableError", "microphone-in-use"]
|
|
1107
|
-
]),
|
|
1107
|
+
]), Xt = class e {
|
|
1108
1108
|
#e = { status: "starting" };
|
|
1109
1109
|
#t = /* @__PURE__ */ new Set();
|
|
1110
1110
|
#n;
|
|
@@ -1138,11 +1138,11 @@ var Gt = class extends Error {
|
|
|
1138
1138
|
try {
|
|
1139
1139
|
e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
1140
1140
|
} catch (e) {
|
|
1141
|
-
let t = e instanceof DOMException ?
|
|
1141
|
+
let t = e instanceof DOMException ? Yt.get(e.name) : void 0;
|
|
1142
1142
|
if (!t) throw e;
|
|
1143
1143
|
this.#i({
|
|
1144
1144
|
status: "failed",
|
|
1145
|
-
error: new
|
|
1145
|
+
error: new qt(t, { cause: e })
|
|
1146
1146
|
});
|
|
1147
1147
|
return;
|
|
1148
1148
|
}
|
|
@@ -1158,13 +1158,13 @@ var Gt = class extends Error {
|
|
|
1158
1158
|
}), t.addEventListener("error", (e) => {
|
|
1159
1159
|
this.#i({
|
|
1160
1160
|
status: "failed",
|
|
1161
|
-
error: new
|
|
1161
|
+
error: new qt("interrupted", { cause: e })
|
|
1162
1162
|
});
|
|
1163
1163
|
});
|
|
1164
1164
|
for (let t of e.getAudioTracks()) t.addEventListener("ended", () => {
|
|
1165
1165
|
this.#i({
|
|
1166
1166
|
status: "failed",
|
|
1167
|
-
error: new
|
|
1167
|
+
error: new qt("interrupted")
|
|
1168
1168
|
});
|
|
1169
1169
|
});
|
|
1170
1170
|
t.start(), this.#a({
|
|
@@ -1187,15 +1187,15 @@ var Gt = class extends Error {
|
|
|
1187
1187
|
this.#e = e;
|
|
1188
1188
|
for (let e of this.#t) e();
|
|
1189
1189
|
}
|
|
1190
|
-
},
|
|
1191
|
-
function
|
|
1192
|
-
let t = i(47), { dictation: n, disabled: r, insertTranscript: a, submitDraft: o } = e, s = "MediaRecorder" in globalThis && "mediaDevices" in navigator, c = n !== void 0, [l] =
|
|
1190
|
+
}, Zt = () => () => void 0, Qt = { status: "ended" }, $t = () => Qt, en = () => "unknown";
|
|
1191
|
+
function tn(e) {
|
|
1192
|
+
let t = i(47), { dictation: n, disabled: r, insertTranscript: a, submitDraft: o } = e, s = "MediaRecorder" in globalThis && "mediaDevices" in navigator, c = n !== void 0, [l] = S(nn), u = C(c && s ? l.subscribe : Zt, l.getSnapshot, en), [d, f] = S(null), p = C(d ? d.subscribe : Zt, d ? d.getSnapshot : $t, $t), [h, v] = S(0), [y, b] = S("insert"), ee = x("insert"), te = x(null), w;
|
|
1193
1193
|
t[0] !== n || t[1] !== a || t[2] !== o ? (w = {
|
|
1194
1194
|
dictation: n,
|
|
1195
1195
|
insertTranscript: a,
|
|
1196
1196
|
submitDraft: o
|
|
1197
1197
|
}, t[0] = n, t[1] = a, t[2] = o, t[3] = w) : w = t[3];
|
|
1198
|
-
let T =
|
|
1198
|
+
let T = x(w), E;
|
|
1199
1199
|
t[4] !== n || t[5] !== a || t[6] !== o ? (E = () => {
|
|
1200
1200
|
T.current = {
|
|
1201
1201
|
dictation: n,
|
|
@@ -1206,12 +1206,12 @@ function $t(e) {
|
|
|
1206
1206
|
let D, O;
|
|
1207
1207
|
t[8] === Symbol.for("react.memo_cache_sentinel") ? (D = async (e, t) => {
|
|
1208
1208
|
let n = new AbortController();
|
|
1209
|
-
|
|
1209
|
+
te.current = n;
|
|
1210
1210
|
try {
|
|
1211
1211
|
let { text: e } = await t.transcribe(t.clip, { signal: n.signal });
|
|
1212
1212
|
if (!n.signal.aborted) {
|
|
1213
1213
|
let t = e.trim();
|
|
1214
|
-
t && T.current.insertTranscript(t),
|
|
1214
|
+
t && T.current.insertTranscript(t), ee.current === "send" && T.current.submitDraft();
|
|
1215
1215
|
}
|
|
1216
1216
|
return {
|
|
1217
1217
|
attempt: t.attempt,
|
|
@@ -1224,27 +1224,27 @@ function $t(e) {
|
|
|
1224
1224
|
failure: null
|
|
1225
1225
|
} : {
|
|
1226
1226
|
attempt: t.attempt,
|
|
1227
|
-
failure: new
|
|
1227
|
+
failure: new qt("transcription-failed", { cause: r })
|
|
1228
1228
|
};
|
|
1229
1229
|
}
|
|
1230
1230
|
}, O = {
|
|
1231
1231
|
attempt: 0,
|
|
1232
1232
|
failure: null
|
|
1233
1233
|
}, t[8] = D, t[9] = O) : (D = t[8], O = t[9]);
|
|
1234
|
-
let [k,
|
|
1235
|
-
t[10] !== r || t[11] !== c || t[12] !== d ? (
|
|
1236
|
-
(r || !c) && (d?.cancel(),
|
|
1234
|
+
let [k, A, ne] = g(D, O), re, j;
|
|
1235
|
+
t[10] !== r || t[11] !== c || t[12] !== d ? (re = () => {
|
|
1236
|
+
(r || !c) && (d?.cancel(), te.current?.abort());
|
|
1237
1237
|
}, j = [
|
|
1238
1238
|
r,
|
|
1239
1239
|
c,
|
|
1240
1240
|
d
|
|
1241
|
-
], t[10] = r, t[11] = c, t[12] = d, t[13] =
|
|
1242
|
-
let
|
|
1243
|
-
if (t[15] === d ? (
|
|
1244
|
-
d?.cancel(),
|
|
1245
|
-
},
|
|
1241
|
+
], t[10] = r, t[11] = c, t[12] = d, t[13] = re, t[14] = j) : (re = t[13], j = t[14]), _(re, j);
|
|
1242
|
+
let ie, M;
|
|
1243
|
+
if (t[15] === d ? (ie = t[16], M = t[17]) : (ie = () => () => {
|
|
1244
|
+
d?.cancel(), te.current?.abort();
|
|
1245
|
+
}, M = [d], t[15] = d, t[16] = ie, t[17] = M), _(ie, M), !n) return null;
|
|
1246
1246
|
let N, P;
|
|
1247
|
-
if (t[18] !== h || t[19] !==
|
|
1247
|
+
if (t[18] !== h || t[19] !== y || t[20] !== k || t[21] !== u || t[22] !== p || t[23] !== ne) {
|
|
1248
1248
|
P = e(), N = P.status === "starting" || P.status === "recording" || P.status === "finishing";
|
|
1249
1249
|
function e() {
|
|
1250
1250
|
if (!s) return {
|
|
@@ -1256,14 +1256,14 @@ function $t(e) {
|
|
|
1256
1256
|
case "recording": return { status: "recording" };
|
|
1257
1257
|
case "stopping": return {
|
|
1258
1258
|
status: "finishing",
|
|
1259
|
-
end:
|
|
1259
|
+
end: y
|
|
1260
1260
|
};
|
|
1261
1261
|
case "ended":
|
|
1262
1262
|
case "failed":
|
|
1263
1263
|
}
|
|
1264
|
-
return
|
|
1264
|
+
return ne ? {
|
|
1265
1265
|
status: "finishing",
|
|
1266
|
-
end:
|
|
1266
|
+
end: y
|
|
1267
1267
|
} : u === "denied" ? {
|
|
1268
1268
|
status: "unavailable",
|
|
1269
1269
|
reason: "blocked"
|
|
@@ -1275,20 +1275,20 @@ function $t(e) {
|
|
|
1275
1275
|
error: k.failure
|
|
1276
1276
|
} : { status: "idle" };
|
|
1277
1277
|
}
|
|
1278
|
-
t[18] = h, t[19] =
|
|
1278
|
+
t[18] = h, t[19] = y, t[20] = k, t[21] = u, t[22] = p, t[23] = ne, t[24] = N, t[25] = P;
|
|
1279
1279
|
} else N = t[24], P = t[25];
|
|
1280
1280
|
let F;
|
|
1281
1281
|
t[26] === Symbol.for("react.memo_cache_sentinel") ? (F = function(e) {
|
|
1282
|
-
|
|
1282
|
+
ee.current = e, b(e);
|
|
1283
1283
|
}, t[26] = F) : F = t[26];
|
|
1284
1284
|
let I = F, L;
|
|
1285
1285
|
t[27] !== N || t[28] !== h || t[29] !== r || t[30] !== P ? (L = function() {
|
|
1286
1286
|
if (r || N || P.status === "unavailable") return;
|
|
1287
1287
|
let e = h + 1;
|
|
1288
|
-
v(e), I("insert"), f(
|
|
1288
|
+
v(e), I("insert"), f(Xt.start((t) => {
|
|
1289
1289
|
let n = T.current.dictation;
|
|
1290
1290
|
n && m(() => {
|
|
1291
|
-
|
|
1291
|
+
A({
|
|
1292
1292
|
clip: t,
|
|
1293
1293
|
attempt: e,
|
|
1294
1294
|
transcribe: n.transcribe
|
|
@@ -1302,7 +1302,7 @@ function $t(e) {
|
|
|
1302
1302
|
}, t[32] = d, t[33] = z);
|
|
1303
1303
|
let B = z, V;
|
|
1304
1304
|
t[34] === d ? V = t[35] : (V = function() {
|
|
1305
|
-
d?.cancel(),
|
|
1305
|
+
d?.cancel(), te.current?.abort();
|
|
1306
1306
|
}, t[34] = d, t[35] = V);
|
|
1307
1307
|
let H = V, U;
|
|
1308
1308
|
t[36] !== d || t[37] !== P ? (U = function() {
|
|
@@ -1320,40 +1320,44 @@ function $t(e) {
|
|
|
1320
1320
|
stop: B,
|
|
1321
1321
|
cancel: H
|
|
1322
1322
|
}, t[39] = H, t[40] = R, t[41] = P, t[42] = B, t[43] = G) : G = t[43];
|
|
1323
|
-
let
|
|
1324
|
-
return t[44] !== W || t[45] !== G ? (
|
|
1323
|
+
let ae;
|
|
1324
|
+
return t[44] !== W || t[45] !== G ? (ae = {
|
|
1325
1325
|
api: G,
|
|
1326
1326
|
endWithSend: W
|
|
1327
|
-
}, t[44] = W, t[45] = G, t[46] =
|
|
1327
|
+
}, t[44] = W, t[45] = G, t[46] = ae) : ae = t[46], ae;
|
|
1328
1328
|
}
|
|
1329
|
-
function
|
|
1330
|
-
return new
|
|
1329
|
+
function nn() {
|
|
1330
|
+
return new Jt();
|
|
1331
1331
|
}
|
|
1332
1332
|
//#endregion
|
|
1333
1333
|
//#region src/lib/tiptap/ComposerTiptapDomain.ts
|
|
1334
|
-
function
|
|
1334
|
+
function rn({ getPlaceholder: e, ...t }) {
|
|
1335
1335
|
return [
|
|
1336
|
-
|
|
1336
|
+
N.configure({ link: !1 }),
|
|
1337
1337
|
ne.configure({
|
|
1338
1338
|
autolink: !0,
|
|
1339
1339
|
linkOnPaste: !1,
|
|
1340
1340
|
openOnClick: !1,
|
|
1341
1341
|
HTMLAttributes: { "data-token": "link" }
|
|
1342
1342
|
}),
|
|
1343
|
-
an,
|
|
1344
|
-
on,
|
|
1345
1343
|
sn,
|
|
1346
|
-
cn
|
|
1344
|
+
cn,
|
|
1345
|
+
ln,
|
|
1346
|
+
re.configure({
|
|
1347
|
+
placeholder: e,
|
|
1348
|
+
showOnlyWhenEditable: !1
|
|
1349
|
+
}),
|
|
1350
|
+
un(t)
|
|
1347
1351
|
];
|
|
1348
1352
|
}
|
|
1349
|
-
var
|
|
1350
|
-
function
|
|
1353
|
+
var an = 1e3;
|
|
1354
|
+
function on(e, t) {
|
|
1351
1355
|
return {
|
|
1352
1356
|
default: t,
|
|
1353
1357
|
parseHTML: (n) => n.getAttribute(e) ?? t
|
|
1354
1358
|
};
|
|
1355
1359
|
}
|
|
1356
|
-
var
|
|
1360
|
+
var sn = O.create({
|
|
1357
1361
|
name: "composerSlashCommand",
|
|
1358
1362
|
inclusive: !1,
|
|
1359
1363
|
addAttributes() {
|
|
@@ -1368,14 +1372,14 @@ var an = D.create({
|
|
|
1368
1372
|
renderHTML({ HTMLAttributes: e }) {
|
|
1369
1373
|
return [
|
|
1370
1374
|
"span",
|
|
1371
|
-
|
|
1375
|
+
A(e, {
|
|
1372
1376
|
"data-token": "slash-command",
|
|
1373
1377
|
"data-composer-slash-command": e.value
|
|
1374
1378
|
}),
|
|
1375
1379
|
0
|
|
1376
1380
|
];
|
|
1377
1381
|
}
|
|
1378
|
-
}),
|
|
1382
|
+
}), cn = k.create({
|
|
1379
1383
|
name: "composerMention",
|
|
1380
1384
|
group: "inline",
|
|
1381
1385
|
inline: !0,
|
|
@@ -1383,12 +1387,12 @@ var an = D.create({
|
|
|
1383
1387
|
selectable: !0,
|
|
1384
1388
|
addAttributes() {
|
|
1385
1389
|
return {
|
|
1386
|
-
id:
|
|
1387
|
-
trigger:
|
|
1388
|
-
value:
|
|
1389
|
-
label:
|
|
1390
|
-
detail:
|
|
1391
|
-
persistsAs:
|
|
1390
|
+
id: on("id", null),
|
|
1391
|
+
trigger: on("trigger", ""),
|
|
1392
|
+
value: on("value", ""),
|
|
1393
|
+
label: on("label", ""),
|
|
1394
|
+
detail: on("detail", ""),
|
|
1395
|
+
persistsAs: on("persistsAs", null),
|
|
1392
1396
|
payload: {
|
|
1393
1397
|
default: null,
|
|
1394
1398
|
renderHTML: (e) => e.payload === null || e.payload === void 0 ? {} : { payload: JSON.stringify(e.payload) },
|
|
@@ -1411,7 +1415,7 @@ var an = D.create({
|
|
|
1411
1415
|
let n = e.attrs.label || `${e.attrs.trigger ?? ""}${e.attrs.value ?? ""}`;
|
|
1412
1416
|
return [
|
|
1413
1417
|
"span",
|
|
1414
|
-
|
|
1418
|
+
A(t, {
|
|
1415
1419
|
"data-token": "mention",
|
|
1416
1420
|
"data-composer-mention": e.attrs.value,
|
|
1417
1421
|
"data-composer-mention-trigger": e.attrs.trigger
|
|
@@ -1422,7 +1426,7 @@ var an = D.create({
|
|
|
1422
1426
|
renderText({ node: e }) {
|
|
1423
1427
|
return e.attrs.label || `${e.attrs.trigger ?? ""}${e.attrs.value ?? ""}`;
|
|
1424
1428
|
}
|
|
1425
|
-
}),
|
|
1429
|
+
}), ln = k.create({
|
|
1426
1430
|
name: "composerAtom",
|
|
1427
1431
|
group: "inline",
|
|
1428
1432
|
inline: !0,
|
|
@@ -1453,7 +1457,7 @@ var an = D.create({
|
|
|
1453
1457
|
let n = String(e.attrs.kind ?? "paste"), r = String(e.attrs.label ?? "");
|
|
1454
1458
|
return [
|
|
1455
1459
|
"span",
|
|
1456
|
-
|
|
1460
|
+
A(t, {
|
|
1457
1461
|
"data-token": n,
|
|
1458
1462
|
"data-composer-atom": n,
|
|
1459
1463
|
"data-composer-atom-detail": e.attrs.detail
|
|
@@ -1465,81 +1469,81 @@ var an = D.create({
|
|
|
1465
1469
|
return String(e.attrs.label ?? "");
|
|
1466
1470
|
}
|
|
1467
1471
|
});
|
|
1468
|
-
function
|
|
1469
|
-
return
|
|
1472
|
+
function un(e) {
|
|
1473
|
+
return D.create({
|
|
1470
1474
|
name: "composerClipboard",
|
|
1471
1475
|
addProseMirrorPlugins() {
|
|
1472
|
-
return [new
|
|
1476
|
+
return [new ie({ props: {
|
|
1473
1477
|
handlePaste(t, n) {
|
|
1474
1478
|
let r = n.clipboardData;
|
|
1475
1479
|
if (!r) return !1;
|
|
1476
|
-
let i = Array.from(r.files).find((e) =>
|
|
1477
|
-
if (i) return n.preventDefault(),
|
|
1478
|
-
let a = Array.from(r.files).find((e) =>
|
|
1479
|
-
if (a) return n.preventDefault(),
|
|
1480
|
-
let o =
|
|
1480
|
+
let i = Array.from(r.files).find((e) => Le(e) !== null);
|
|
1481
|
+
if (i) return n.preventDefault(), zn(t, e.getRemoteImageCount(), i, e.attachImageFile), !0;
|
|
1482
|
+
let a = Array.from(r.files).find((e) => Le(e) === null);
|
|
1483
|
+
if (a) return n.preventDefault(), Bn(t, a.name || "pasted-file", e.getMentionTrigger()), !0;
|
|
1484
|
+
let o = mr(yr(r.getData("text/uri-list")) || br(r.getData("DownloadURL")) || r.getData("text/plain") || r.getData("text")), s = o.trim();
|
|
1481
1485
|
if (!o) return !1;
|
|
1482
|
-
let c =
|
|
1486
|
+
let c = Mn(t);
|
|
1483
1487
|
if (c && xr(s)) {
|
|
1484
1488
|
n.preventDefault();
|
|
1485
1489
|
let e = Sr(s), r = t.state.schema.marks.link;
|
|
1486
|
-
return r ?
|
|
1490
|
+
return r ? Pn(t, c, e, r) : !1;
|
|
1487
1491
|
}
|
|
1488
|
-
return hr(s) && !s.includes("\n") ? (n.preventDefault(),
|
|
1492
|
+
return hr(s) && !s.includes("\n") ? (n.preventDefault(), Bn(t, s, e.getMentionTrigger()), !0) : xr(s) && !s.includes("\n") ? (n.preventDefault(), Ln(t, s, Sr(s))) : c && o && !o.includes("\n") && He(o) <= an ? (n.preventDefault(), Rn(t, o, c), !0) : He(o) > an ? (n.preventDefault(), jn(t, o), !0) : !1;
|
|
1489
1493
|
},
|
|
1490
1494
|
handleDrop(t, n) {
|
|
1491
1495
|
let r = n.dataTransfer;
|
|
1492
|
-
return r &&
|
|
1496
|
+
return r && dn(t, r, e.getRemoteImageCount(), e.getMentionTrigger(), e.attachImageFile) ? (n.preventDefault(), !0) : !1;
|
|
1493
1497
|
}
|
|
1494
1498
|
} })];
|
|
1495
1499
|
}
|
|
1496
1500
|
});
|
|
1497
1501
|
}
|
|
1498
|
-
function
|
|
1499
|
-
let a = Array.from(t.files).find((e) =>
|
|
1500
|
-
if (a) return
|
|
1501
|
-
let o = Array.from(t.files).find((e) =>
|
|
1502
|
-
if (o) return
|
|
1503
|
-
let s =
|
|
1504
|
-
return s ? hr(s) && !s.includes("\n") ? (
|
|
1502
|
+
function dn(e, t, n, r, i) {
|
|
1503
|
+
let a = Array.from(t.files).find((e) => Le(e) !== null);
|
|
1504
|
+
if (a) return zn(e, n, a, i), !0;
|
|
1505
|
+
let o = Array.from(t.files).find((e) => Le(e) === null);
|
|
1506
|
+
if (o) return Bn(e, o.name || "dropped-file", r), !0;
|
|
1507
|
+
let s = mr(yr(t.getData("text/uri-list")) || br(t.getData("DownloadURL")) || t.getData("text/plain")).trim();
|
|
1508
|
+
return s ? hr(s) && !s.includes("\n") ? (Bn(e, s, r), !0) : xr(s) && !s.includes("\n") ? (Ln(e, s, Sr(s)), !0) : !1 : !1;
|
|
1505
1509
|
}
|
|
1506
|
-
function
|
|
1507
|
-
return e ?
|
|
1510
|
+
function fn({ state: e, text: t, slashCommands: n, mentionCandidates: r, triggers: i }) {
|
|
1511
|
+
return e ? pn(me({
|
|
1508
1512
|
initialDraft: e,
|
|
1509
1513
|
slashCommands: n,
|
|
1510
1514
|
commandTriggers: i.commandTriggers,
|
|
1511
1515
|
mentionCandidates: r
|
|
1512
|
-
}), n, r, i) :
|
|
1516
|
+
}), n, r, i) : mn(t ?? "", n, r, i);
|
|
1513
1517
|
}
|
|
1514
|
-
function
|
|
1515
|
-
if (e.elements.length === 0) return
|
|
1518
|
+
function pn(e, t, n, r) {
|
|
1519
|
+
if (e.elements.length === 0) return mn(e.text, t, n, r);
|
|
1516
1520
|
let i = [], a = 0;
|
|
1517
|
-
for (let o of
|
|
1518
|
-
o.range.start > a && i.push(...
|
|
1521
|
+
for (let o of Z(e.elements)) {
|
|
1522
|
+
o.range.start > a && i.push(...hn(e.text.slice(a, o.range.start), t, n, r.commandTriggers, r.mentionTriggers));
|
|
1519
1523
|
let s = e.mentionBindings.find((e) => e.id === o.id || `${e.trigger}${e.value}` === o.label), c = e.pendingPastes.find((e) => e.placeholder === o.label);
|
|
1520
|
-
o.kind === "mention" && s ? i.push(
|
|
1524
|
+
o.kind === "mention" && s ? i.push(Tn(En(s, o, n))) : o.kind === "paste" && c ? i.push(Dn({
|
|
1521
1525
|
kind: "paste",
|
|
1522
1526
|
label: c.placeholder,
|
|
1523
|
-
detail: o.detail ?? `${
|
|
1527
|
+
detail: o.detail ?? `${He(c.content)} chars`,
|
|
1524
1528
|
content: c.content
|
|
1525
|
-
})) : o.kind === "rich-link" ? i.push(
|
|
1529
|
+
})) : o.kind === "rich-link" ? i.push(Dn({
|
|
1526
1530
|
kind: "rich-link",
|
|
1527
1531
|
label: o.label,
|
|
1528
1532
|
detail: o.detail ?? "",
|
|
1529
1533
|
href: o.detail ?? "",
|
|
1530
1534
|
metadata: o.metadata
|
|
1531
|
-
})) : o.kind === "link" ? i.push(
|
|
1535
|
+
})) : o.kind === "link" ? i.push(Cn(o.label, [wn(o.detail ?? "")])) : i.push(...hn(e.text.slice(o.range.start, o.range.end), t, n, r.commandTriggers, r.mentionTriggers)), a = o.range.end;
|
|
1532
1536
|
}
|
|
1533
|
-
return a < e.text.length && i.push(...
|
|
1537
|
+
return a < e.text.length && i.push(...hn(e.text.slice(a), t, n, r.commandTriggers, r.mentionTriggers)), xn(i);
|
|
1534
1538
|
}
|
|
1535
|
-
function
|
|
1536
|
-
let i =
|
|
1539
|
+
function mn(e, t, n, r) {
|
|
1540
|
+
let i = Ke({
|
|
1537
1541
|
text: e,
|
|
1538
1542
|
slashCommands: t,
|
|
1539
1543
|
commandTriggers: r.commandTriggers,
|
|
1540
1544
|
mentionCandidates: n
|
|
1541
1545
|
});
|
|
1542
|
-
return (i.elements?.length ?? 0) > 0 ?
|
|
1546
|
+
return (i.elements?.length ?? 0) > 0 ? pn(me({
|
|
1543
1547
|
initialDraft: i,
|
|
1544
1548
|
slashCommands: t,
|
|
1545
1549
|
commandTriggers: r.commandTriggers,
|
|
@@ -1548,39 +1552,39 @@ function fn(e, t, n, r) {
|
|
|
1548
1552
|
type: "doc",
|
|
1549
1553
|
content: e.split("\n").map((e) => ({
|
|
1550
1554
|
type: "paragraph",
|
|
1551
|
-
content:
|
|
1555
|
+
content: hn(e, t, n, r.commandTriggers, r.mentionTriggers)
|
|
1552
1556
|
}))
|
|
1553
1557
|
};
|
|
1554
1558
|
}
|
|
1555
|
-
function
|
|
1556
|
-
return r(e).flatMap((e) => e.kind === "inline-code" || e.kind === "code-block" || e.kind === "link" || e.kind === "skill-link" ? [
|
|
1559
|
+
function hn(e, t, n, i, a) {
|
|
1560
|
+
return r(e).flatMap((e) => e.kind === "inline-code" || e.kind === "code-block" || e.kind === "link" || e.kind === "skill-link" ? [Cn(e.source)] : gn(e.source, t, n, i, a));
|
|
1557
1561
|
}
|
|
1558
|
-
function
|
|
1559
|
-
let a = [], o =
|
|
1560
|
-
if (!o) return [
|
|
1562
|
+
function gn(e, t, n, r, i) {
|
|
1563
|
+
let a = [], o = fe(r, i);
|
|
1564
|
+
if (!o) return [Cn(e)];
|
|
1561
1565
|
let s = 0;
|
|
1562
1566
|
for (let r of e.matchAll(o)) {
|
|
1563
1567
|
let o = r.index ?? 0, c = r[0];
|
|
1564
1568
|
if (o === 0 || /\s/.test(e[o - 1] ?? "")) {
|
|
1565
|
-
if (o > s && a.push(
|
|
1566
|
-
let e = n.find((e) =>
|
|
1567
|
-
a.push(e ?
|
|
1569
|
+
if (o > s && a.push(Cn(e.slice(s, o))), pe(c, i)) {
|
|
1570
|
+
let e = n.find((e) => J(e) === c);
|
|
1571
|
+
a.push(e ? Tn(e) : Cn(c));
|
|
1568
1572
|
} else {
|
|
1569
|
-
let e =
|
|
1570
|
-
a.push(e ?
|
|
1573
|
+
let e = K(c.replace(/^\//, ""), t);
|
|
1574
|
+
a.push(e ? Cn(c, [{
|
|
1571
1575
|
type: "composerSlashCommand",
|
|
1572
1576
|
attrs: {
|
|
1573
1577
|
value: e.value,
|
|
1574
1578
|
detail: e.detail
|
|
1575
1579
|
}
|
|
1576
|
-
}]) :
|
|
1580
|
+
}]) : Cn(c));
|
|
1577
1581
|
}
|
|
1578
1582
|
s = o + c.length;
|
|
1579
1583
|
}
|
|
1580
1584
|
}
|
|
1581
|
-
return s < e.length && a.push(
|
|
1585
|
+
return s < e.length && a.push(Cn(e.slice(s))), a;
|
|
1582
1586
|
}
|
|
1583
|
-
function
|
|
1587
|
+
function _n(e, t, n, r, i, a) {
|
|
1584
1588
|
let o = {
|
|
1585
1589
|
text: "",
|
|
1586
1590
|
elements: [],
|
|
@@ -1588,8 +1592,8 @@ function hn(e, t, n, r, i, a) {
|
|
|
1588
1592
|
imageAttachments: [],
|
|
1589
1593
|
pendingPastes: []
|
|
1590
1594
|
};
|
|
1591
|
-
|
|
1592
|
-
let s =
|
|
1595
|
+
vn(e, o, n);
|
|
1596
|
+
let s = me({
|
|
1593
1597
|
text: o.text,
|
|
1594
1598
|
slashCommands: n,
|
|
1595
1599
|
isTaskRunning: r,
|
|
@@ -1598,22 +1602,22 @@ function hn(e, t, n, r, i, a) {
|
|
|
1598
1602
|
return {
|
|
1599
1603
|
...s,
|
|
1600
1604
|
cursor: a,
|
|
1601
|
-
elements:
|
|
1605
|
+
elements: pr([...s.elements, ...o.elements]),
|
|
1602
1606
|
mentionBindings: o.mentionBindings,
|
|
1603
1607
|
imageAttachments: o.imageAttachments,
|
|
1604
1608
|
remoteImages: t,
|
|
1605
1609
|
pendingPastes: o.pendingPastes
|
|
1606
1610
|
};
|
|
1607
1611
|
}
|
|
1608
|
-
function
|
|
1612
|
+
function vn(e, t, n) {
|
|
1609
1613
|
if (e.type === "doc") {
|
|
1610
1614
|
e.content?.forEach((e, r) => {
|
|
1611
|
-
r > 0 && t.text.length > 0 && (t.text += "\n"),
|
|
1615
|
+
r > 0 && t.text.length > 0 && (t.text += "\n"), vn(e, t, n);
|
|
1612
1616
|
});
|
|
1613
1617
|
return;
|
|
1614
1618
|
}
|
|
1615
1619
|
if (e.type === "paragraph") {
|
|
1616
|
-
e.content?.forEach((e) =>
|
|
1620
|
+
e.content?.forEach((e) => vn(e, t, n));
|
|
1617
1621
|
return;
|
|
1618
1622
|
}
|
|
1619
1623
|
if (e.type === "hardBreak") {
|
|
@@ -1624,7 +1628,7 @@ function gn(e, t, n) {
|
|
|
1624
1628
|
let r = e.text ?? "", i = t.text.length;
|
|
1625
1629
|
t.text += r;
|
|
1626
1630
|
for (let a of e.marks ?? []) if (a.type === "link" && a.attrs?.href && t.elements.push({
|
|
1627
|
-
id:
|
|
1631
|
+
id: $("link", r, i),
|
|
1628
1632
|
kind: "link",
|
|
1629
1633
|
label: r,
|
|
1630
1634
|
range: {
|
|
@@ -1633,10 +1637,10 @@ function gn(e, t, n) {
|
|
|
1633
1637
|
},
|
|
1634
1638
|
detail: String(a.attrs.href)
|
|
1635
1639
|
}), a.type === "composerSlashCommand") {
|
|
1636
|
-
let e =
|
|
1640
|
+
let e = K(r.replace(/^\//, ""), n);
|
|
1637
1641
|
if (!e) continue;
|
|
1638
1642
|
t.elements.push({
|
|
1639
|
-
id:
|
|
1643
|
+
id: $("slash-command", r, i),
|
|
1640
1644
|
kind: "slash-command",
|
|
1641
1645
|
label: r,
|
|
1642
1646
|
range: {
|
|
@@ -1649,7 +1653,7 @@ function gn(e, t, n) {
|
|
|
1649
1653
|
return;
|
|
1650
1654
|
}
|
|
1651
1655
|
if (e.type === "composerMention") {
|
|
1652
|
-
let n = String(e.attrs?.label ?? "") || `${String(e.attrs?.trigger ?? "")}${String(e.attrs?.value ?? "")}`, r = t.text.length, i = String(e.attrs?.id ??
|
|
1656
|
+
let n = String(e.attrs?.label ?? "") || `${String(e.attrs?.trigger ?? "")}${String(e.attrs?.value ?? "")}`, r = t.text.length, i = String(e.attrs?.id ?? $("mention", n, r));
|
|
1653
1657
|
t.text += n, t.elements.push({
|
|
1654
1658
|
id: i,
|
|
1655
1659
|
kind: "mention",
|
|
@@ -1671,11 +1675,11 @@ function gn(e, t, n) {
|
|
|
1671
1675
|
return;
|
|
1672
1676
|
}
|
|
1673
1677
|
if (e.type === "composerAtom") {
|
|
1674
|
-
let n = String(e.attrs?.label ?? ""), r =
|
|
1678
|
+
let n = String(e.attrs?.label ?? ""), r = bn(e.attrs?.kind), i = t.text.length, a = String(e.attrs?.attachmentId ?? "");
|
|
1675
1679
|
if (r === "image" && !a) return;
|
|
1676
|
-
let o = r === "image" ? a :
|
|
1680
|
+
let o = r === "image" ? a : $(r, n, i);
|
|
1677
1681
|
t.text += n;
|
|
1678
|
-
let s = r === "rich-link" ?
|
|
1682
|
+
let s = r === "rich-link" ? yn(e.attrs?.metadata) : void 0;
|
|
1679
1683
|
t.elements.push({
|
|
1680
1684
|
id: o,
|
|
1681
1685
|
kind: r,
|
|
@@ -1689,7 +1693,7 @@ function gn(e, t, n) {
|
|
|
1689
1693
|
}), r === "image" && t.imageAttachments.push({
|
|
1690
1694
|
id: o,
|
|
1691
1695
|
placeholder: n,
|
|
1692
|
-
media:
|
|
1696
|
+
media: Re(e.attrs?.media)
|
|
1693
1697
|
}), r === "paste" && t.pendingPastes.push({
|
|
1694
1698
|
id: o,
|
|
1695
1699
|
placeholder: n,
|
|
@@ -1697,7 +1701,7 @@ function gn(e, t, n) {
|
|
|
1697
1701
|
});
|
|
1698
1702
|
}
|
|
1699
1703
|
}
|
|
1700
|
-
function
|
|
1704
|
+
function yn(e) {
|
|
1701
1705
|
if (!e || typeof e != "object") return;
|
|
1702
1706
|
let t = {};
|
|
1703
1707
|
for (let n of [
|
|
@@ -1713,7 +1717,7 @@ function _n(e) {
|
|
|
1713
1717
|
}
|
|
1714
1718
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
1715
1719
|
}
|
|
1716
|
-
function
|
|
1720
|
+
function bn(e) {
|
|
1717
1721
|
switch (e) {
|
|
1718
1722
|
case "slash-command":
|
|
1719
1723
|
case "mention":
|
|
@@ -1724,7 +1728,7 @@ function vn(e) {
|
|
|
1724
1728
|
default: return "paste";
|
|
1725
1729
|
}
|
|
1726
1730
|
}
|
|
1727
|
-
function
|
|
1731
|
+
function xn(e) {
|
|
1728
1732
|
return {
|
|
1729
1733
|
type: "doc",
|
|
1730
1734
|
content: [{
|
|
@@ -1733,13 +1737,13 @@ function yn(e) {
|
|
|
1733
1737
|
}]
|
|
1734
1738
|
};
|
|
1735
1739
|
}
|
|
1736
|
-
function
|
|
1740
|
+
function Sn() {
|
|
1737
1741
|
return {
|
|
1738
1742
|
type: "doc",
|
|
1739
1743
|
content: [{ type: "paragraph" }]
|
|
1740
1744
|
};
|
|
1741
1745
|
}
|
|
1742
|
-
function
|
|
1746
|
+
function Cn(e, t) {
|
|
1743
1747
|
return t && t.length > 0 ? {
|
|
1744
1748
|
type: "text",
|
|
1745
1749
|
text: e,
|
|
@@ -1749,29 +1753,29 @@ function xn(e, t) {
|
|
|
1749
1753
|
text: e
|
|
1750
1754
|
};
|
|
1751
1755
|
}
|
|
1752
|
-
function
|
|
1756
|
+
function wn(e) {
|
|
1753
1757
|
return {
|
|
1754
1758
|
type: "link",
|
|
1755
1759
|
attrs: { href: e }
|
|
1756
1760
|
};
|
|
1757
1761
|
}
|
|
1758
|
-
function
|
|
1762
|
+
function Tn(e) {
|
|
1759
1763
|
return {
|
|
1760
1764
|
type: "composerMention",
|
|
1761
1765
|
attrs: {
|
|
1762
1766
|
id: e.id,
|
|
1763
1767
|
trigger: e.trigger,
|
|
1764
1768
|
value: e.value,
|
|
1765
|
-
label:
|
|
1769
|
+
label: J(e),
|
|
1766
1770
|
detail: e.detail,
|
|
1767
1771
|
payload: e.payload,
|
|
1768
1772
|
persistsAs: e.persistsAs
|
|
1769
1773
|
}
|
|
1770
1774
|
};
|
|
1771
1775
|
}
|
|
1772
|
-
function
|
|
1776
|
+
function En(e, t, n) {
|
|
1773
1777
|
let r = `${e.trigger}${e.value}`;
|
|
1774
|
-
return n.find((e) =>
|
|
1778
|
+
return n.find((e) => J(e) === t.label || J(e) === r) || {
|
|
1775
1779
|
id: e.id,
|
|
1776
1780
|
trigger: e.trigger,
|
|
1777
1781
|
value: e.value,
|
|
@@ -1781,7 +1785,7 @@ function wn(e, t, n) {
|
|
|
1781
1785
|
payload: e.payload
|
|
1782
1786
|
};
|
|
1783
1787
|
}
|
|
1784
|
-
function
|
|
1788
|
+
function Dn({ kind: e, label: t, detail: n = "", content: r = "", href: i = "", metadata: a }) {
|
|
1785
1789
|
return {
|
|
1786
1790
|
type: "composerAtom",
|
|
1787
1791
|
attrs: {
|
|
@@ -1794,7 +1798,7 @@ function Tn({ kind: e, label: t, detail: n = "", content: r = "", href: i = "",
|
|
|
1794
1798
|
}
|
|
1795
1799
|
};
|
|
1796
1800
|
}
|
|
1797
|
-
function
|
|
1801
|
+
function On(e, t, n = "image") {
|
|
1798
1802
|
return {
|
|
1799
1803
|
type: "composerAtom",
|
|
1800
1804
|
attrs: {
|
|
@@ -1805,12 +1809,12 @@ function En(e, t, n = "image") {
|
|
|
1805
1809
|
}
|
|
1806
1810
|
};
|
|
1807
1811
|
}
|
|
1808
|
-
function
|
|
1812
|
+
function kn(e, t) {
|
|
1809
1813
|
let { selection: n } = e.state;
|
|
1810
1814
|
if (!n.empty) return null;
|
|
1811
1815
|
let r = n.$from, i = r.parent.textBetween(0, r.parentOffset, void 0, ""), a = r.parent.textBetween(r.parentOffset, r.parent.content.size, void 0, ""), o = [...t.commandTriggers, ...t.mentionTriggers];
|
|
1812
1816
|
if (o.length === 0) return null;
|
|
1813
|
-
let s =
|
|
1817
|
+
let s = An(i, a, o);
|
|
1814
1818
|
if (!s) return null;
|
|
1815
1819
|
let c = o.find((e) => s.token.startsWith(e));
|
|
1816
1820
|
return !c || s.token.slice(c.length).includes(c) ? null : {
|
|
@@ -1820,7 +1824,7 @@ function Dn(e, t) {
|
|
|
1820
1824
|
to: n.from + s.tail.length
|
|
1821
1825
|
};
|
|
1822
1826
|
}
|
|
1823
|
-
function
|
|
1827
|
+
function An(e, t, n) {
|
|
1824
1828
|
let r = `(?:${q(n)})`, i = e.search(RegExp(`(?:^|\\s|\\ufffc)(${r}[^\\s\\ufffc]*)$`));
|
|
1825
1829
|
if (i === -1) return null;
|
|
1826
1830
|
let a = /[\s\ufffc]/.test(e[i] ?? "") ? i + 1 : i, o = t.match(/^[^\s\ufffc]*/)?.[0] ?? "";
|
|
@@ -1830,16 +1834,16 @@ function On(e, t, n) {
|
|
|
1830
1834
|
tail: o
|
|
1831
1835
|
};
|
|
1832
1836
|
}
|
|
1833
|
-
function
|
|
1834
|
-
let n =
|
|
1837
|
+
function jn(e, t) {
|
|
1838
|
+
let n = Gn(e.state.doc.toJSON(), He(t)), r = e.state.schema.nodes.composerAtom?.create({
|
|
1835
1839
|
kind: "paste",
|
|
1836
1840
|
label: n,
|
|
1837
|
-
detail: `${
|
|
1841
|
+
detail: `${He(t)} chars`,
|
|
1838
1842
|
content: t
|
|
1839
1843
|
});
|
|
1840
1844
|
r && e.dispatch(e.state.tr.replaceSelectionWith(r).scrollIntoView());
|
|
1841
1845
|
}
|
|
1842
|
-
function
|
|
1846
|
+
function Mn(e) {
|
|
1843
1847
|
let t = e.dom.ownerDocument.getSelection();
|
|
1844
1848
|
if (t && t.rangeCount > 0 && !t.isCollapsed) {
|
|
1845
1849
|
let n = t.getRangeAt(0);
|
|
@@ -1848,7 +1852,7 @@ function An(e) {
|
|
|
1848
1852
|
if (r !== i) return {
|
|
1849
1853
|
from: Math.min(r, i),
|
|
1850
1854
|
to: Math.max(r, i),
|
|
1851
|
-
selectedAtomLabels:
|
|
1855
|
+
selectedAtomLabels: Nn(n, e.dom),
|
|
1852
1856
|
selectedText: t.toString()
|
|
1853
1857
|
};
|
|
1854
1858
|
}
|
|
@@ -1858,14 +1862,14 @@ function An(e) {
|
|
|
1858
1862
|
to: e.state.selection.to
|
|
1859
1863
|
};
|
|
1860
1864
|
}
|
|
1861
|
-
function
|
|
1865
|
+
function Nn(e, t) {
|
|
1862
1866
|
return Array.from(t.querySelectorAll("[data-composer-atom]")).filter((t) => e.intersectsNode(t)).map((e) => e.textContent ?? "").filter(Boolean);
|
|
1863
1867
|
}
|
|
1864
|
-
function
|
|
1865
|
-
let i =
|
|
1866
|
-
return e.dispatch(s.setSelection(
|
|
1868
|
+
function Pn(e, t, n, r) {
|
|
1869
|
+
let i = Fn(e.state.doc, t), a = In(e.state.doc, i.from, i.to) || n, o = e.state.schema.text(a, [r.create({ href: n })]), s = e.state.tr.replaceWith(i.from, i.to, o), c = i.from + a.length;
|
|
1870
|
+
return e.dispatch(s.setSelection(M.create(s.doc, c)).scrollIntoView()), !0;
|
|
1867
1871
|
}
|
|
1868
|
-
function
|
|
1872
|
+
function Fn(e, t) {
|
|
1869
1873
|
if (!t.selectedText && !t.selectedAtomLabels?.length) return t;
|
|
1870
1874
|
let n = {
|
|
1871
1875
|
from: t.from,
|
|
@@ -1888,7 +1892,7 @@ function Nn(e, t) {
|
|
|
1888
1892
|
});
|
|
1889
1893
|
return n;
|
|
1890
1894
|
}
|
|
1891
|
-
function
|
|
1895
|
+
function In(e, t, n) {
|
|
1892
1896
|
let r = "";
|
|
1893
1897
|
return e.nodesBetween(t, n, (e, i) => {
|
|
1894
1898
|
if (e.isText) {
|
|
@@ -1898,26 +1902,26 @@ function Pn(e, t, n) {
|
|
|
1898
1902
|
return e.type.name === "composerMention" ? (r += String(e.attrs.label ?? ""), !1) : e.type.name === "composerAtom" ? (e.attrs.kind === "rich-link" && (r += String(e.attrs.label ?? "")), !1) : e.type.name === "hardBreak" ? (r += "\n", !1) : !0;
|
|
1899
1903
|
}), r.replace(/\n+/g, " ").trim();
|
|
1900
1904
|
}
|
|
1901
|
-
function
|
|
1905
|
+
function Ln(e, t, n) {
|
|
1902
1906
|
let r = e.state.schema.marks.link;
|
|
1903
1907
|
if (!r) return !1;
|
|
1904
1908
|
let { from: i, to: a } = e.state.selection, o = e.state.tr.insertText(t, i, a);
|
|
1905
1909
|
return o.addMark(i, i + t.length, r.create({ href: n })), e.dispatch(o.scrollIntoView()), !0;
|
|
1906
1910
|
}
|
|
1907
|
-
function
|
|
1911
|
+
function Rn(e, t, n) {
|
|
1908
1912
|
e.dispatch(e.state.tr.replaceWith(n.from, n.to, e.state.schema.text(t)).scrollIntoView());
|
|
1909
1913
|
}
|
|
1910
|
-
function
|
|
1914
|
+
function zn(e, t, n, r) {
|
|
1911
1915
|
let i = r(n);
|
|
1912
1916
|
if (i === null) return;
|
|
1913
|
-
let a = t +
|
|
1917
|
+
let a = t + Kn(e.state.doc.toJSON(), "image") + 1, o = Le(n) ?? "image", s = e.state.schema.nodeFromJSON(On(i, ze(o, a), o));
|
|
1914
1918
|
if (!s) return;
|
|
1915
1919
|
let c = e.state.tr.replaceSelectionWith(s);
|
|
1916
1920
|
c = c.insertText(" ", c.selection.from), e.dispatch(c.scrollIntoView());
|
|
1917
1921
|
}
|
|
1918
|
-
function
|
|
1922
|
+
function Bn(e, t, n) {
|
|
1919
1923
|
let r = gr(t), i = _r(r), a = `${n}${i}`, o = e.state.schema.nodes.composerMention?.create({
|
|
1920
|
-
id:
|
|
1924
|
+
id: $("mention", a, e.state.selection.from),
|
|
1921
1925
|
trigger: n,
|
|
1922
1926
|
value: i,
|
|
1923
1927
|
label: a,
|
|
@@ -1931,86 +1935,86 @@ function Rn(e, t, n) {
|
|
|
1931
1935
|
let s = e.state.tr.replaceSelectionWith(o);
|
|
1932
1936
|
s = s.insertText(" ", s.selection.from), e.dispatch(s.scrollIntoView());
|
|
1933
1937
|
}
|
|
1934
|
-
function
|
|
1938
|
+
function Vn(e, t) {
|
|
1935
1939
|
let n = 0;
|
|
1936
|
-
return
|
|
1940
|
+
return Hn(e, (e) => e.type !== "composerAtom" || e.attrs?.kind !== "image" ? e : (n += 1, {
|
|
1937
1941
|
...e,
|
|
1938
1942
|
attrs: {
|
|
1939
1943
|
...e.attrs,
|
|
1940
|
-
label:
|
|
1944
|
+
label: ze(Re(e.attrs?.media), t + n)
|
|
1941
1945
|
}
|
|
1942
1946
|
}));
|
|
1943
1947
|
}
|
|
1944
|
-
function
|
|
1948
|
+
function Hn(e, t) {
|
|
1945
1949
|
let n = t(e);
|
|
1946
1950
|
return {
|
|
1947
1951
|
...n,
|
|
1948
|
-
content: n.content?.map((e) =>
|
|
1952
|
+
content: n.content?.map((e) => Hn(e, t))
|
|
1949
1953
|
};
|
|
1950
1954
|
}
|
|
1951
|
-
function
|
|
1952
|
-
return
|
|
1955
|
+
function Un(e, t) {
|
|
1956
|
+
return Wn(e, (e) => e.type !== "composerAtom" || e.attrs?.kind !== "image" || e.attrs?.attachmentId !== t);
|
|
1953
1957
|
}
|
|
1954
|
-
function
|
|
1958
|
+
function Wn(e, t) {
|
|
1955
1959
|
return {
|
|
1956
1960
|
...e,
|
|
1957
|
-
content: e.content?.filter(t).map((e) =>
|
|
1961
|
+
content: e.content?.filter(t).map((e) => Wn(e, t))
|
|
1958
1962
|
};
|
|
1959
1963
|
}
|
|
1960
|
-
function
|
|
1964
|
+
function Gn(e, t) {
|
|
1961
1965
|
let n = `[Pasted Content ${t} chars]`, r = /* @__PURE__ */ new Set();
|
|
1962
|
-
if (
|
|
1966
|
+
if (qn(e, (e) => {
|
|
1963
1967
|
e.type === "composerAtom" && e.attrs?.kind === "paste" && r.add(String(e.attrs.label ?? ""));
|
|
1964
1968
|
}), !r.has(n)) return n;
|
|
1965
1969
|
let i = 2;
|
|
1966
1970
|
for (; r.has(`${n} #${i}`);) i += 1;
|
|
1967
1971
|
return `${n} #${i}`;
|
|
1968
1972
|
}
|
|
1969
|
-
function
|
|
1973
|
+
function Kn(e, t) {
|
|
1970
1974
|
let n = 0;
|
|
1971
|
-
return
|
|
1975
|
+
return qn(e, (e) => {
|
|
1972
1976
|
e.type === "composerAtom" && e.attrs?.kind === t && (n += 1);
|
|
1973
1977
|
}), n;
|
|
1974
1978
|
}
|
|
1975
|
-
function
|
|
1976
|
-
t(e), e.content?.forEach((e) =>
|
|
1979
|
+
function qn(e, t) {
|
|
1980
|
+
t(e), e.content?.forEach((e) => qn(e, t));
|
|
1977
1981
|
}
|
|
1978
|
-
function
|
|
1982
|
+
function Jn(e) {
|
|
1979
1983
|
let { selection: t } = e.state, n = t.from;
|
|
1980
|
-
return
|
|
1984
|
+
return rr(e, n, t.empty ? t.$from.end() : t.to);
|
|
1981
1985
|
}
|
|
1982
|
-
function
|
|
1983
|
-
let { selection: t } = e.state, n = t.empty ?
|
|
1984
|
-
return
|
|
1986
|
+
function Yn(e) {
|
|
1987
|
+
let { selection: t } = e.state, n = t.empty ? $n(e, t.from) : t.from, r = t.to;
|
|
1988
|
+
return rr(e, n, r);
|
|
1985
1989
|
}
|
|
1986
|
-
function
|
|
1990
|
+
function Xn(e) {
|
|
1987
1991
|
let { selection: t } = e.state;
|
|
1988
|
-
if (!t.empty) return
|
|
1989
|
-
let n = t.$from.parent.textBetween(0, t.$from.parentOffset, void 0,
|
|
1990
|
-
return
|
|
1992
|
+
if (!t.empty) return rr(e, t.from, t.to);
|
|
1993
|
+
let n = t.$from.parent.textBetween(0, t.$from.parentOffset, void 0, ir), r = ct(n, n.length);
|
|
1994
|
+
return rr(e, tr(t.$from.parent, t.$from.start(), r), t.from);
|
|
1991
1995
|
}
|
|
1992
|
-
function
|
|
1993
|
-
let t = e.state.selection.to, n =
|
|
1996
|
+
function Zn(e) {
|
|
1997
|
+
let t = e.state.selection.to, n = er(e, t), r = e.state.tr.setSelection(M.create(e.state.doc, n)).scrollIntoView();
|
|
1994
1998
|
e.view.dispatch(r), e.view.focus();
|
|
1995
1999
|
}
|
|
1996
|
-
function
|
|
1997
|
-
let { selection: n } = e.state, r = t === -1 ? n.from : n.to, i = e.state.doc.resolve(r), a = i.parent.textBetween(0, i.parent.content.size, void 0,
|
|
2000
|
+
function Qn(e, t) {
|
|
2001
|
+
let { selection: n } = e.state, r = t === -1 ? n.from : n.to, i = e.state.doc.resolve(r), a = i.parent.textBetween(0, i.parent.content.size, void 0, ir), o = i.parent.textBetween(0, i.parentOffset, void 0, ir).length, s = t === -1 ? ct(a, o) : lt(a, o), c = tr(i.parent, i.start(), s), l = e.state.tr.setSelection(M.create(e.state.doc, c)).scrollIntoView();
|
|
1998
2002
|
e.view.dispatch(l), e.view.focus();
|
|
1999
2003
|
}
|
|
2000
|
-
function
|
|
2004
|
+
function $n(e, t) {
|
|
2001
2005
|
let { selection: n } = e.state, r = n.$from.start();
|
|
2002
2006
|
return e.state.doc.nodesBetween(r, t, (e, t) => {
|
|
2003
2007
|
e.type.name === "hardBreak" && (r = t + e.nodeSize);
|
|
2004
2008
|
}), r;
|
|
2005
2009
|
}
|
|
2006
|
-
function
|
|
2010
|
+
function er(e, t) {
|
|
2007
2011
|
let n = e.state.doc.resolve(t).end();
|
|
2008
2012
|
return e.state.doc.nodesBetween(t, n, (e, r) => e.type.name === "hardBreak" && r >= t ? (n = r, !1) : !0), n;
|
|
2009
2013
|
}
|
|
2010
|
-
function
|
|
2014
|
+
function tr(e, t, n) {
|
|
2011
2015
|
let r = 0, i = t;
|
|
2012
2016
|
for (let t = 0; t < e.childCount; t += 1) {
|
|
2013
|
-
let a = e.child(t), o =
|
|
2017
|
+
let a = e.child(t), o = nr(a);
|
|
2014
2018
|
if (o === null) {
|
|
2015
2019
|
i += a.nodeSize;
|
|
2016
2020
|
continue;
|
|
@@ -2021,13 +2025,13 @@ function $n(e, t, n) {
|
|
|
2021
2025
|
}
|
|
2022
2026
|
return i;
|
|
2023
2027
|
}
|
|
2024
|
-
function
|
|
2025
|
-
return e.isText ? e.text ?? "" : e.type.name === "hardBreak" ? "\n" : e.type.name === "composerMention" || e.type.name === "composerAtom" ?
|
|
2028
|
+
function nr(e) {
|
|
2029
|
+
return e.isText ? e.text ?? "" : e.type.name === "hardBreak" ? "\n" : e.type.name === "composerMention" || e.type.name === "composerAtom" ? ir(e) : null;
|
|
2026
2030
|
}
|
|
2027
|
-
function
|
|
2031
|
+
function rr(e, t, n) {
|
|
2028
2032
|
if (n <= t) return null;
|
|
2029
2033
|
let r = e.state.doc.slice(t, n), i = {
|
|
2030
|
-
text: e.state.doc.textBetween(t, n, "\n",
|
|
2034
|
+
text: e.state.doc.textBetween(t, n, "\n", ir),
|
|
2031
2035
|
slice: r.toJSON()
|
|
2032
2036
|
};
|
|
2033
2037
|
return e.chain().focus().deleteRange({
|
|
@@ -2035,10 +2039,10 @@ function tr(e, t, n) {
|
|
|
2035
2039
|
to: n
|
|
2036
2040
|
}).run(), i;
|
|
2037
2041
|
}
|
|
2038
|
-
function
|
|
2042
|
+
function ir(e) {
|
|
2039
2043
|
return e.type.name === "composerMention" ? String(e.attrs.label ?? "") || `${String(e.attrs.trigger ?? "")}${String(e.attrs.value ?? "")}` : e.type.name === "composerAtom" ? String(e.attrs.label ?? "") : "";
|
|
2040
2044
|
}
|
|
2041
|
-
function
|
|
2045
|
+
function ar(e, t) {
|
|
2042
2046
|
let { selection: n } = e.state;
|
|
2043
2047
|
if (typeof t == "string") {
|
|
2044
2048
|
if (!n.empty) {
|
|
@@ -2048,55 +2052,49 @@ function rr(e, t) {
|
|
|
2048
2052
|
e.chain().focus().insertContent(t).run();
|
|
2049
2053
|
return;
|
|
2050
2054
|
}
|
|
2051
|
-
let r =
|
|
2055
|
+
let r = j.fromJSON(e.state.schema, t.slice);
|
|
2052
2056
|
e.view.dispatch(e.state.tr.replaceSelection(r).scrollIntoView()), e.view.focus();
|
|
2053
2057
|
}
|
|
2054
|
-
function
|
|
2058
|
+
function or(e, t) {
|
|
2055
2059
|
let { selection: n } = e.state;
|
|
2056
2060
|
if (!n.empty) return !1;
|
|
2057
2061
|
let r = n.$from, i = t === "Backspace" ? r.nodeBefore : r.nodeAfter;
|
|
2058
|
-
if (!i || !
|
|
2062
|
+
if (!i || !sr(i)) return !1;
|
|
2059
2063
|
let a = t === "Backspace" ? n.from - i.nodeSize : n.from, o = t === "Backspace" ? n.from : n.from + i.nodeSize;
|
|
2060
2064
|
return e.chain().focus().deleteRange({
|
|
2061
2065
|
from: a,
|
|
2062
2066
|
to: o
|
|
2063
2067
|
}).run(), !0;
|
|
2064
2068
|
}
|
|
2065
|
-
function
|
|
2069
|
+
function sr(e) {
|
|
2066
2070
|
return e.isAtom && (e.type.name === "composerMention" || e.type.name === "composerAtom");
|
|
2067
2071
|
}
|
|
2068
|
-
function
|
|
2072
|
+
function cr(e) {
|
|
2069
2073
|
try {
|
|
2070
2074
|
return e.state.doc.textBetween(0, e.state.selection.from, "\n", "").length;
|
|
2071
2075
|
} catch {
|
|
2072
2076
|
return 0;
|
|
2073
2077
|
}
|
|
2074
2078
|
}
|
|
2075
|
-
function sr(e) {
|
|
2076
|
-
return e.state.selection.empty && or(e) === 0;
|
|
2077
|
-
}
|
|
2078
|
-
function cr(e, t) {
|
|
2079
|
-
return ue(e.persistedPrompt, t) ? "ParseSlash" : e.action;
|
|
2080
|
-
}
|
|
2081
2079
|
function lr(e) {
|
|
2082
|
-
return e.
|
|
2080
|
+
return e.state.selection.empty && cr(e) === 0;
|
|
2083
2081
|
}
|
|
2084
|
-
function ur(e) {
|
|
2085
|
-
return e.
|
|
2082
|
+
function ur(e, t) {
|
|
2083
|
+
return pe(e.persistedPrompt, t) ? "ParseSlash" : e.action;
|
|
2086
2084
|
}
|
|
2087
2085
|
function dr(e) {
|
|
2088
|
-
return
|
|
2086
|
+
return e.key === "ArrowUp" || (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "p";
|
|
2089
2087
|
}
|
|
2090
2088
|
function fr(e) {
|
|
2091
|
-
|
|
2092
|
-
for (let n of e) t.set(`${n.kind}:${n.range.start}:${n.range.end}:${n.label}`, n);
|
|
2093
|
-
return dr([...t.values()]);
|
|
2089
|
+
return e.key === "ArrowDown" || (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "n";
|
|
2094
2090
|
}
|
|
2095
2091
|
function pr(e) {
|
|
2096
|
-
|
|
2092
|
+
let t = /* @__PURE__ */ new Map();
|
|
2093
|
+
for (let n of e) t.set(`${n.kind}:${n.range.start}:${n.range.end}:${n.label}`, n);
|
|
2094
|
+
return Z([...t.values()]);
|
|
2097
2095
|
}
|
|
2098
2096
|
function mr(e) {
|
|
2099
|
-
return
|
|
2097
|
+
return e.replace(/\r\n?/g, "\n");
|
|
2100
2098
|
}
|
|
2101
2099
|
function hr(e) {
|
|
2102
2100
|
return e.startsWith("file://") || e.startsWith("/") || e.startsWith("./") || e.startsWith("../") || /^[A-Za-z]:[\\/]/.test(e);
|
|
@@ -2104,15 +2102,16 @@ function hr(e) {
|
|
|
2104
2102
|
function gr(e) {
|
|
2105
2103
|
let t = e.trim();
|
|
2106
2104
|
if (!t.startsWith("file://")) return t;
|
|
2105
|
+
let n = URL.parse(t);
|
|
2106
|
+
if (!n) return t;
|
|
2107
2107
|
try {
|
|
2108
|
-
return
|
|
2108
|
+
return decodeURIComponent(n.pathname);
|
|
2109
2109
|
} catch {
|
|
2110
|
-
return
|
|
2110
|
+
return n.pathname;
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
2113
|
function _r(e) {
|
|
2114
|
-
|
|
2115
|
-
return t ? decodeURIComponent(t) : e;
|
|
2114
|
+
return e.replace(/[\\/]+$/, "").split(/[\\/]/).filter(Boolean).pop() ?? e;
|
|
2116
2115
|
}
|
|
2117
2116
|
function vr(e) {
|
|
2118
2117
|
return /[\\/]$/.test(e);
|
|
@@ -2133,139 +2132,135 @@ function xr(e) {
|
|
|
2133
2132
|
}
|
|
2134
2133
|
}
|
|
2135
2134
|
function Sr(e) {
|
|
2136
|
-
return
|
|
2137
|
-
}
|
|
2138
|
-
function Cr(e, t) {
|
|
2139
|
-
return (e % t + t) % t;
|
|
2140
|
-
}
|
|
2141
|
-
function wr(e, t, n) {
|
|
2142
|
-
return `${e}:${n}:${t}`;
|
|
2135
|
+
return Ye(e.trim());
|
|
2143
2136
|
}
|
|
2144
2137
|
//#endregion
|
|
2145
2138
|
//#region src/lib/Composer.tsx
|
|
2146
|
-
function
|
|
2139
|
+
function Cr(e) {
|
|
2147
2140
|
let t = i(3), n = e.draftKey ?? "", r;
|
|
2148
|
-
return t[0] !== e || t[1] !== n ? (r = /* @__PURE__ */
|
|
2141
|
+
return t[0] !== e || t[1] !== n ? (r = /* @__PURE__ */ T(Tr, { ...e }, n), t[0] = e, t[1] = n, t[2] = r) : r = t[2], r;
|
|
2149
2142
|
}
|
|
2150
|
-
function
|
|
2143
|
+
function wr(e) {
|
|
2151
2144
|
return typeof e == "object" && !!e && "then" in e && typeof e.then == "function";
|
|
2152
2145
|
}
|
|
2153
|
-
function
|
|
2154
|
-
let
|
|
2155
|
-
signature:
|
|
2156
|
-
slashCommands:
|
|
2157
|
-
mentionCandidates:
|
|
2158
|
-
commandTriggers:
|
|
2159
|
-
mentionTriggers:
|
|
2160
|
-
}), te =
|
|
2146
|
+
function Tr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r = !1, queueSubmissions: i = !1, hasInteracted: a = !1, maxExpandedTextChars: o, editorAriaLabel: u = "Rich prompt composer", className: d, children: f, dictation: p, validateSubmission: m, onSubmit: h, onStateChange: g }) {
|
|
2147
|
+
let y = c(), C = Pt(f), ee = x({
|
|
2148
|
+
signature: Ft(C),
|
|
2149
|
+
slashCommands: C.slashCommands,
|
|
2150
|
+
mentionCandidates: C.mentionCandidates,
|
|
2151
|
+
commandTriggers: C.commandTriggers,
|
|
2152
|
+
mentionTriggers: C.mentionTriggers
|
|
2153
|
+
}), te = Ft(C);
|
|
2161
2154
|
te !== ee.current.signature && (ee.current = {
|
|
2162
2155
|
signature: te,
|
|
2163
|
-
slashCommands:
|
|
2164
|
-
mentionCandidates:
|
|
2165
|
-
commandTriggers:
|
|
2166
|
-
mentionTriggers:
|
|
2156
|
+
slashCommands: C.slashCommands,
|
|
2157
|
+
mentionCandidates: C.mentionCandidates,
|
|
2158
|
+
commandTriggers: C.commandTriggers,
|
|
2159
|
+
mentionTriggers: C.mentionTriggers
|
|
2167
2160
|
});
|
|
2168
|
-
let { slashCommands:
|
|
2169
|
-
commandTriggers:
|
|
2170
|
-
mentionTriggers:
|
|
2171
|
-
}), [
|
|
2172
|
-
ne.current =
|
|
2173
|
-
let [re] =
|
|
2161
|
+
let { slashCommands: w, mentionCandidates: D, commandTriggers: O, mentionTriggers: k } = ee.current, A = b(() => ({
|
|
2162
|
+
commandTriggers: O,
|
|
2163
|
+
mentionTriggers: k
|
|
2164
|
+
}), [O, k]), ne = x(k);
|
|
2165
|
+
ne.current = k;
|
|
2166
|
+
let [re] = S(() => {
|
|
2174
2167
|
if (e) return e;
|
|
2175
2168
|
if (t === void 0) return;
|
|
2176
|
-
let n =
|
|
2177
|
-
return n ?
|
|
2169
|
+
let n = Ct(t);
|
|
2170
|
+
return n ? qe({
|
|
2178
2171
|
source: n,
|
|
2179
|
-
slashCommands:
|
|
2180
|
-
mentionCandidates:
|
|
2172
|
+
slashCommands: w,
|
|
2173
|
+
mentionCandidates: D
|
|
2181
2174
|
}) : void 0;
|
|
2182
|
-
}),
|
|
2175
|
+
}), j = x(re?.remoteImages ?? []), ie = x(fn({
|
|
2183
2176
|
state: re,
|
|
2184
|
-
slashCommands:
|
|
2185
|
-
mentionCandidates:
|
|
2186
|
-
triggers:
|
|
2187
|
-
})), M =
|
|
2177
|
+
slashCommands: w,
|
|
2178
|
+
mentionCandidates: D,
|
|
2179
|
+
triggers: A
|
|
2180
|
+
})), M = x(0), N = x(!0);
|
|
2188
2181
|
_(() => (N.current = !0, () => {
|
|
2189
2182
|
N.current = !1;
|
|
2190
2183
|
}), []);
|
|
2191
|
-
let [
|
|
2192
|
-
|
|
2184
|
+
let [F, I] = S(j.current), [L, R] = S(null), [z, B] = S(() => _n(ie.current, j.current, w, r, i, 0)), V = x(z), H = x(F), U = x(L), W = x(null), G = x(null), ae = x(void 0), K = x(null), oe = x(null), se = x(null), ce = v((e, t) => {
|
|
2185
|
+
g?.(e, t);
|
|
2186
|
+
}), le = x(m), q = x(h), ue = x(/* @__PURE__ */ new Map()), de = x(() => null), fe = x(() => void 0), pe = x(() => void 0), J = x(() => !1), [me, ve] = S(""), ye = x(me);
|
|
2187
|
+
ye.current = me;
|
|
2188
|
+
let Y = s({
|
|
2189
|
+
extensions: b(() => rn({
|
|
2190
|
+
getPlaceholder: () => ye.current,
|
|
2193
2191
|
getMentionTrigger: () => ne.current[0] ?? "@",
|
|
2194
|
-
getRemoteImageCount: () =>
|
|
2195
|
-
attachImageFile: (e) =>
|
|
2192
|
+
getRemoteImageCount: () => H.current.length,
|
|
2193
|
+
attachImageFile: (e) => de.current(e)
|
|
2196
2194
|
}), []),
|
|
2197
|
-
content:
|
|
2195
|
+
content: ie.current,
|
|
2198
2196
|
editable: !n,
|
|
2199
2197
|
editorProps: {
|
|
2200
2198
|
attributes: {
|
|
2201
2199
|
"data-slot": "composer-editor",
|
|
2202
2200
|
role: "textbox",
|
|
2203
2201
|
"aria-label": u,
|
|
2202
|
+
"aria-placeholder": me,
|
|
2204
2203
|
"aria-disabled": n ? "true" : "false",
|
|
2205
2204
|
dir: "auto",
|
|
2206
2205
|
spellcheck: "false"
|
|
2207
2206
|
},
|
|
2208
2207
|
handleKeyDown(e, t) {
|
|
2209
|
-
return
|
|
2208
|
+
return J.current(t);
|
|
2210
2209
|
}
|
|
2211
2210
|
},
|
|
2212
2211
|
immediatelyRender: !1,
|
|
2213
2212
|
onUpdate({ editor: e }) {
|
|
2214
|
-
|
|
2213
|
+
fe.current(e), pe.current(e);
|
|
2215
2214
|
},
|
|
2216
2215
|
onSelectionUpdate({ editor: e }) {
|
|
2217
|
-
|
|
2216
|
+
fe.current(e), pe.current(e);
|
|
2218
2217
|
}
|
|
2219
|
-
}),
|
|
2220
|
-
|
|
2218
|
+
}), be = b(() => L ? Bt(L, w, D, a) : [], [
|
|
2219
|
+
L,
|
|
2221
2220
|
a,
|
|
2222
|
-
E,
|
|
2223
|
-
T
|
|
2224
|
-
]), ge = v(() => pe(R, T, D), [
|
|
2225
2221
|
D,
|
|
2226
|
-
|
|
2227
|
-
|
|
2222
|
+
w
|
|
2223
|
+
]), Se = b(() => ge(z, w, O), [
|
|
2224
|
+
O,
|
|
2225
|
+
z,
|
|
2226
|
+
w
|
|
2228
2227
|
]);
|
|
2229
2228
|
_(() => {
|
|
2230
|
-
|
|
2231
|
-
}, [
|
|
2232
|
-
|
|
2233
|
-
}, [
|
|
2234
|
-
|
|
2235
|
-
}, [
|
|
2236
|
-
|
|
2229
|
+
V.current = z;
|
|
2230
|
+
}, [z]), _(() => {
|
|
2231
|
+
H.current = F;
|
|
2232
|
+
}, [F]), _(() => {
|
|
2233
|
+
U.current = L;
|
|
2234
|
+
}, [L]), _(() => {
|
|
2235
|
+
z.shortcutsOpen && (L || z.reverseSearch !== null || !he(z)) && B((e) => e.shortcutsOpen ? {
|
|
2237
2236
|
...e,
|
|
2238
2237
|
shortcutsOpen: !1
|
|
2239
2238
|
} : e);
|
|
2240
|
-
}, [
|
|
2241
|
-
|
|
2242
|
-
}, [g]), _(() => {
|
|
2243
|
-
q.current = m;
|
|
2239
|
+
}, [L, z]), _(() => {
|
|
2240
|
+
le.current = m;
|
|
2244
2241
|
}, [m]), _(() => {
|
|
2245
|
-
|
|
2242
|
+
q.current = h;
|
|
2246
2243
|
}, [h]), _(() => {
|
|
2247
|
-
|
|
2248
|
-
}, [n,
|
|
2249
|
-
|
|
2250
|
-
}, [X, u]), _(() => {
|
|
2251
|
-
se.current?.(R, ge), t !== void 0 && (ge ? St(t, Ve(R, ge.persistedPrompt)) : M.current === 0 && St(t, null));
|
|
2244
|
+
Y && (Y.setEditable(!n), n && R(null));
|
|
2245
|
+
}, [n, Y]), _(() => {
|
|
2246
|
+
ce(z, Se), t !== void 0 && (Se ? wt(t, We(z, Se.persistedPrompt)) : M.current === 0 && wt(t, null));
|
|
2252
2247
|
}, [
|
|
2253
|
-
|
|
2248
|
+
z,
|
|
2254
2249
|
t,
|
|
2255
|
-
|
|
2250
|
+
Se
|
|
2256
2251
|
]), _(() => {
|
|
2257
|
-
|
|
2252
|
+
B((e) => e.isTaskRunning === r && e.queueSubmissions === i ? e : {
|
|
2258
2253
|
...e,
|
|
2259
2254
|
isTaskRunning: r,
|
|
2260
2255
|
queueSubmissions: i
|
|
2261
2256
|
});
|
|
2262
|
-
}, [r, i]),
|
|
2257
|
+
}, [r, i]), fe.current = (e) => {
|
|
2263
2258
|
if (n) return;
|
|
2264
|
-
let t =
|
|
2265
|
-
|
|
2259
|
+
let t = _n(e.getJSON(), H.current, w, r, i, cr(e)), a = G.current, o = ae.current;
|
|
2260
|
+
G.current = null, ae.current = void 0, B((e) => {
|
|
2266
2261
|
let n = o === void 0 ? K.current : o;
|
|
2267
2262
|
K.current = n;
|
|
2268
|
-
let r = e.shortcutsOpen &&
|
|
2263
|
+
let r = e.shortcutsOpen && he(t);
|
|
2269
2264
|
return {
|
|
2270
2265
|
...t,
|
|
2271
2266
|
error: e.error,
|
|
@@ -2277,46 +2272,46 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2277
2272
|
selectedRemoteImageId: a
|
|
2278
2273
|
};
|
|
2279
2274
|
});
|
|
2280
|
-
},
|
|
2275
|
+
}, pe.current = (e) => {
|
|
2281
2276
|
if (n) {
|
|
2282
|
-
|
|
2277
|
+
R(null);
|
|
2283
2278
|
return;
|
|
2284
2279
|
}
|
|
2285
|
-
let t =
|
|
2280
|
+
let t = kn(e, A);
|
|
2286
2281
|
if (!t) {
|
|
2287
|
-
|
|
2282
|
+
R(null);
|
|
2288
2283
|
return;
|
|
2289
2284
|
}
|
|
2290
|
-
if (
|
|
2285
|
+
if (O.includes(t.trigger)) {
|
|
2291
2286
|
let e = {
|
|
2292
2287
|
trigger: t.trigger,
|
|
2293
2288
|
query: t.query,
|
|
2294
2289
|
selectedIndex: 0
|
|
2295
|
-
}, n =
|
|
2296
|
-
|
|
2290
|
+
}, n = Bt(e, w, D, a);
|
|
2291
|
+
R((t) => n.length === 0 ? null : {
|
|
2297
2292
|
...e,
|
|
2298
2293
|
selectedIndex: t?.trigger === e.trigger ? Math.min(t.selectedIndex, n.length - 1) : 0
|
|
2299
2294
|
});
|
|
2300
2295
|
return;
|
|
2301
2296
|
}
|
|
2302
|
-
|
|
2297
|
+
R((e) => {
|
|
2303
2298
|
let n = t.trigger, r = {
|
|
2304
2299
|
trigger: n,
|
|
2305
2300
|
query: t.query,
|
|
2306
2301
|
selectedIndex: e?.trigger === n ? e.selectedIndex : 0
|
|
2307
|
-
}, i =
|
|
2302
|
+
}, i = Bt(r, w, D, a);
|
|
2308
2303
|
return {
|
|
2309
2304
|
...r,
|
|
2310
2305
|
selectedIndex: e?.trigger === n ? Math.min(e.selectedIndex, Math.max(i.length - 1, 0)) : 0
|
|
2311
2306
|
};
|
|
2312
2307
|
});
|
|
2313
2308
|
};
|
|
2314
|
-
function
|
|
2315
|
-
|
|
2309
|
+
function X(e) {
|
|
2310
|
+
Y?.commands.setContent(e), Y && (fe.current(Y), pe.current(Y));
|
|
2316
2311
|
}
|
|
2317
|
-
function
|
|
2318
|
-
if (n || !
|
|
2319
|
-
let t =
|
|
2312
|
+
function Ce(e) {
|
|
2313
|
+
if (n || !Y) return;
|
|
2314
|
+
let t = kn(Y, A), r = [{
|
|
2320
2315
|
type: "text",
|
|
2321
2316
|
text: `${e.trigger}${e.value}`,
|
|
2322
2317
|
marks: [{
|
|
@@ -2330,168 +2325,168 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2330
2325
|
type: "text",
|
|
2331
2326
|
text: " "
|
|
2332
2327
|
}];
|
|
2333
|
-
t && t.trigger === e.trigger ?
|
|
2328
|
+
t && t.trigger === e.trigger ? Y.chain().focus().deleteRange({
|
|
2334
2329
|
from: t.from,
|
|
2335
2330
|
to: t.to
|
|
2336
|
-
}).insertContent(r).run() :
|
|
2331
|
+
}).insertContent(r).run() : Y.chain().focus().insertContent(r).run(), R(null);
|
|
2337
2332
|
}
|
|
2338
|
-
function
|
|
2339
|
-
let t =
|
|
2340
|
-
if (n || !
|
|
2341
|
-
let r =
|
|
2333
|
+
function we({ index: e = U.current?.selectedIndex ?? 0 } = {}) {
|
|
2334
|
+
let t = U.current;
|
|
2335
|
+
if (n || !Y || !t) return;
|
|
2336
|
+
let r = Bt(t, w, D, a), i = r[e] ?? r[0];
|
|
2342
2337
|
if (!i) return;
|
|
2343
2338
|
if (!i.atomic) {
|
|
2344
|
-
|
|
2339
|
+
Ce(i);
|
|
2345
2340
|
return;
|
|
2346
2341
|
}
|
|
2347
|
-
let o =
|
|
2342
|
+
let o = kn(Y, A), s = o?.trigger === t.trigger, c = Y.chain().focus();
|
|
2348
2343
|
s && o && c.deleteRange({
|
|
2349
2344
|
from: o.from,
|
|
2350
2345
|
to: o.to
|
|
2351
|
-
}), c.insertContent([
|
|
2346
|
+
}), c.insertContent([Tn(i), {
|
|
2352
2347
|
type: "text",
|
|
2353
2348
|
text: " "
|
|
2354
|
-
}]).run(),
|
|
2349
|
+
}]).run(), R(null);
|
|
2355
2350
|
}
|
|
2356
|
-
function
|
|
2357
|
-
if (n || !
|
|
2358
|
-
|
|
2359
|
-
let e =
|
|
2360
|
-
e &&
|
|
2351
|
+
function Te() {
|
|
2352
|
+
if (n || !Y) return;
|
|
2353
|
+
Y.commands.focus();
|
|
2354
|
+
let e = O[0];
|
|
2355
|
+
e && R((t) => t?.trigger === e ? null : {
|
|
2361
2356
|
trigger: e,
|
|
2362
2357
|
query: "",
|
|
2363
2358
|
selectedIndex: 0
|
|
2364
2359
|
});
|
|
2365
2360
|
}
|
|
2366
|
-
function
|
|
2367
|
-
return
|
|
2361
|
+
function Ee(e) {
|
|
2362
|
+
return he(e) && e.reverseSearch === null && U.current === null;
|
|
2368
2363
|
}
|
|
2369
|
-
function
|
|
2370
|
-
n ||
|
|
2364
|
+
function De() {
|
|
2365
|
+
n || B((e) => Ee(e) && !e.shortcutsOpen ? {
|
|
2371
2366
|
...e,
|
|
2372
2367
|
shortcutsOpen: !0,
|
|
2373
2368
|
selectedRemoteImageId: null,
|
|
2374
2369
|
error: null
|
|
2375
2370
|
} : e);
|
|
2376
2371
|
}
|
|
2377
|
-
function
|
|
2378
|
-
|
|
2372
|
+
function Oe() {
|
|
2373
|
+
B((e) => e.shortcutsOpen ? {
|
|
2379
2374
|
...e,
|
|
2380
2375
|
shortcutsOpen: !1
|
|
2381
2376
|
} : e);
|
|
2382
2377
|
}
|
|
2383
|
-
function
|
|
2384
|
-
n ||
|
|
2378
|
+
function ke() {
|
|
2379
|
+
n || B((e) => e.shortcutsOpen ? {
|
|
2385
2380
|
...e,
|
|
2386
2381
|
shortcutsOpen: !1
|
|
2387
|
-
} :
|
|
2382
|
+
} : Ee(e) ? {
|
|
2388
2383
|
...e,
|
|
2389
2384
|
shortcutsOpen: !0,
|
|
2390
2385
|
selectedRemoteImageId: null,
|
|
2391
2386
|
error: null
|
|
2392
2387
|
} : e);
|
|
2393
2388
|
}
|
|
2394
|
-
function
|
|
2395
|
-
n || !
|
|
2389
|
+
function Ae(e) {
|
|
2390
|
+
n || !Y || !e || Y.chain().focus().insertContent(e).run();
|
|
2396
2391
|
}
|
|
2397
|
-
function
|
|
2398
|
-
if (
|
|
2392
|
+
function je(e) {
|
|
2393
|
+
if (Le(e) === null) return B((t) => ({
|
|
2399
2394
|
...t,
|
|
2400
2395
|
error: `Only image, video, or audio files can be attached: ${e.name || "unnamed file"}`,
|
|
2401
2396
|
shortcutsOpen: !1
|
|
2402
|
-
})),
|
|
2397
|
+
})), R(null), null;
|
|
2403
2398
|
let t = crypto.randomUUID();
|
|
2404
|
-
return
|
|
2399
|
+
return ue.current.set(t, e), t;
|
|
2405
2400
|
}
|
|
2406
|
-
function
|
|
2407
|
-
let n =
|
|
2401
|
+
function Me(e, t) {
|
|
2402
|
+
let n = je(t);
|
|
2408
2403
|
if (n === null) return;
|
|
2409
|
-
let r =
|
|
2410
|
-
e.chain().focus().insertContent([
|
|
2404
|
+
let r = Q(), i = r.remoteImages.length + r.imageAttachments.length + 1, a = Le(t) ?? "image";
|
|
2405
|
+
e.chain().focus().insertContent([On(n, ze(a, i), a), {
|
|
2411
2406
|
type: "text",
|
|
2412
2407
|
text: " "
|
|
2413
2408
|
}]).run();
|
|
2414
2409
|
}
|
|
2415
|
-
function
|
|
2416
|
-
if (!(n || !
|
|
2410
|
+
function Ne(e) {
|
|
2411
|
+
if (!(n || !Y)) for (let t of e) Me(Y, t);
|
|
2417
2412
|
}
|
|
2418
|
-
function
|
|
2419
|
-
n || !
|
|
2413
|
+
function Pe(e) {
|
|
2414
|
+
n || !Y || (ue.current.delete(e), X(Vn(Un(Y.getJSON(), e), H.current.length)));
|
|
2420
2415
|
}
|
|
2421
|
-
function
|
|
2422
|
-
if (n || !
|
|
2423
|
-
let t = [...
|
|
2424
|
-
id:
|
|
2416
|
+
function Fe(e) {
|
|
2417
|
+
if (n || !Y) return;
|
|
2418
|
+
let t = [...H.current, {
|
|
2419
|
+
id: $("remote-image", e, y.Date.now()),
|
|
2425
2420
|
url: e
|
|
2426
2421
|
}];
|
|
2427
|
-
|
|
2422
|
+
H.current = t, I(t), X(Vn(Y.getJSON(), t.length));
|
|
2428
2423
|
}
|
|
2429
|
-
function
|
|
2430
|
-
return n || !
|
|
2424
|
+
function Z(e) {
|
|
2425
|
+
return n || !Y ? !1 : dn(Y.view, e, H.current.length, k[0] ?? "@", je);
|
|
2431
2426
|
}
|
|
2432
|
-
function
|
|
2427
|
+
function Ie(e) {
|
|
2433
2428
|
if (n) return;
|
|
2434
|
-
let t =
|
|
2435
|
-
t && (
|
|
2429
|
+
let t = H.current[e] ?? V.current.remoteImages[e];
|
|
2430
|
+
t && (G.current = t.id, B((e) => ({
|
|
2436
2431
|
...e,
|
|
2437
2432
|
selectedRemoteImageId: t.id,
|
|
2438
2433
|
shortcutsOpen: !1
|
|
2439
2434
|
})));
|
|
2440
2435
|
}
|
|
2441
|
-
function
|
|
2442
|
-
n || (
|
|
2436
|
+
function Re() {
|
|
2437
|
+
n || (G.current = null, B((e) => e.selectedRemoteImageId ? {
|
|
2443
2438
|
...e,
|
|
2444
2439
|
selectedRemoteImageId: null,
|
|
2445
2440
|
shortcutsOpen: !1
|
|
2446
2441
|
} : e));
|
|
2447
2442
|
}
|
|
2448
|
-
function
|
|
2449
|
-
return
|
|
2443
|
+
function Be(e) {
|
|
2444
|
+
return V.current.selectedRemoteImageId ? e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Escape" || (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a" ? (Re(), R(null), !0) : e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? (Re(), !0) : !1 : !1;
|
|
2450
2445
|
}
|
|
2451
|
-
function
|
|
2446
|
+
function Ke(e) {
|
|
2452
2447
|
if (n) return e.preventDefault(), !0;
|
|
2453
|
-
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a") return e.preventDefault(),
|
|
2454
|
-
let t =
|
|
2455
|
-
if (!
|
|
2456
|
-
let n =
|
|
2448
|
+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "a") return e.preventDefault(), Re(), R(null), Y?.commands.selectAll(), !0;
|
|
2449
|
+
let t = Q(), r = V.current.selectedRemoteImageId;
|
|
2450
|
+
if (!U.current && e.key === "ArrowUp") {
|
|
2451
|
+
let n = Ve({
|
|
2457
2452
|
...t,
|
|
2458
2453
|
selectedRemoteImageId: r
|
|
2459
2454
|
}, r);
|
|
2460
|
-
if (n !== null) return e.preventDefault(),
|
|
2461
|
-
if ((
|
|
2455
|
+
if (n !== null) return e.preventDefault(), Ie(Math.max(0, n - 1)), !0;
|
|
2456
|
+
if ((Y && lr(Y) || t.cursor === 0) && t.remoteImages.length > 0) return e.preventDefault(), Ie(t.remoteImages.length - 1), !0;
|
|
2462
2457
|
}
|
|
2463
|
-
if (!
|
|
2458
|
+
if (!U.current && r && e.key === "ArrowDown") {
|
|
2464
2459
|
e.preventDefault();
|
|
2465
|
-
let n =
|
|
2460
|
+
let n = Ve({
|
|
2466
2461
|
...t,
|
|
2467
2462
|
selectedRemoteImageId: r
|
|
2468
2463
|
}, r);
|
|
2469
|
-
return n !== null && n + 1 < t.remoteImages.length ?
|
|
2464
|
+
return n !== null && n + 1 < t.remoteImages.length ? Ie(n + 1) : Re(), !0;
|
|
2470
2465
|
}
|
|
2471
|
-
return !
|
|
2466
|
+
return !U.current && r && (e.key === "Backspace" || e.key === "Delete") ? (e.preventDefault(), Je(r), !0) : (Be(e), !1);
|
|
2472
2467
|
}
|
|
2473
|
-
function
|
|
2474
|
-
if (n || !
|
|
2475
|
-
let t =
|
|
2476
|
-
|
|
2468
|
+
function Je(e) {
|
|
2469
|
+
if (n || !Y) return;
|
|
2470
|
+
let t = Q(), r = t.remoteImages.findIndex((t) => t.id === e), i = t.remoteImages.filter((t) => t.id !== e), a = r === -1 ? null : i[r] ?? i[r - 1] ?? null;
|
|
2471
|
+
G.current = a?.id ?? null, H.current = i, I(i), X(Vn(Y.getJSON(), i.length)), B((e) => ({
|
|
2477
2472
|
...e,
|
|
2478
2473
|
remoteImages: i,
|
|
2479
2474
|
selectedRemoteImageId: a?.id ?? null,
|
|
2480
2475
|
shortcutsOpen: !1
|
|
2481
2476
|
}));
|
|
2482
2477
|
}
|
|
2483
|
-
function
|
|
2484
|
-
if (n || !
|
|
2485
|
-
let t =
|
|
2486
|
-
|
|
2478
|
+
function Ye(e) {
|
|
2479
|
+
if (n || !Y) return;
|
|
2480
|
+
let t = Gn(Y.getJSON(), He(e));
|
|
2481
|
+
Y.chain().focus().insertContent(Dn({
|
|
2487
2482
|
kind: "paste",
|
|
2488
2483
|
label: t,
|
|
2489
|
-
detail: `${
|
|
2484
|
+
detail: `${He(e)} chars`,
|
|
2490
2485
|
content: e
|
|
2491
2486
|
})).run();
|
|
2492
2487
|
}
|
|
2493
|
-
function
|
|
2494
|
-
n ||
|
|
2488
|
+
function Xe(e, t = e, r) {
|
|
2489
|
+
n || Y?.chain().focus().insertContent(Dn({
|
|
2495
2490
|
kind: "rich-link",
|
|
2496
2491
|
label: t,
|
|
2497
2492
|
detail: e,
|
|
@@ -2499,45 +2494,45 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2499
2494
|
metadata: r
|
|
2500
2495
|
})).run();
|
|
2501
2496
|
}
|
|
2502
|
-
function
|
|
2503
|
-
return
|
|
2504
|
-
...
|
|
2505
|
-
error:
|
|
2506
|
-
history:
|
|
2507
|
-
historyCursor: K.current ??
|
|
2508
|
-
killBuffer:
|
|
2509
|
-
reverseSearch:
|
|
2510
|
-
shortcutsOpen:
|
|
2511
|
-
selectedRemoteImageId:
|
|
2512
|
-
} :
|
|
2513
|
-
}
|
|
2514
|
-
function
|
|
2515
|
-
let t =
|
|
2516
|
-
return t ? (
|
|
2497
|
+
function Q() {
|
|
2498
|
+
return Y ? {
|
|
2499
|
+
..._n(Y.getJSON(), H.current, w, r, i, cr(Y)),
|
|
2500
|
+
error: V.current.error,
|
|
2501
|
+
history: V.current.history,
|
|
2502
|
+
historyCursor: K.current ?? V.current.historyCursor,
|
|
2503
|
+
killBuffer: V.current.killBuffer,
|
|
2504
|
+
reverseSearch: V.current.reverseSearch,
|
|
2505
|
+
shortcutsOpen: V.current.shortcutsOpen,
|
|
2506
|
+
selectedRemoteImageId: V.current.selectedRemoteImageId
|
|
2507
|
+
} : V.current;
|
|
2508
|
+
}
|
|
2509
|
+
function Ze(e) {
|
|
2510
|
+
let t = le.current?.(e);
|
|
2511
|
+
return t ? (B((e) => ({
|
|
2517
2512
|
...e,
|
|
2518
2513
|
error: t,
|
|
2519
2514
|
shortcutsOpen: !1
|
|
2520
|
-
})),
|
|
2515
|
+
})), R(null), !0) : !1;
|
|
2521
2516
|
}
|
|
2522
|
-
function
|
|
2523
|
-
let t =
|
|
2524
|
-
|
|
2517
|
+
function Qe(e) {
|
|
2518
|
+
let t = Q(), n = t.text.slice(0, t.cursor);
|
|
2519
|
+
Ae(n && !/\s$/.test(n) ? ` ${e}` : e);
|
|
2525
2520
|
}
|
|
2526
|
-
function
|
|
2527
|
-
|
|
2521
|
+
function $e() {
|
|
2522
|
+
_t?.endWithSend() || et();
|
|
2528
2523
|
}
|
|
2529
|
-
function
|
|
2524
|
+
function et() {
|
|
2530
2525
|
if (n) return;
|
|
2531
|
-
let e =
|
|
2526
|
+
let e = Q(), r = Y?.getJSON() ?? Sn(), i = e.isTaskRunning || e.queueSubmissions, a = i ? null : xe(e.text, w, O);
|
|
2532
2527
|
if (a) {
|
|
2533
|
-
|
|
2528
|
+
B((e) => ({
|
|
2534
2529
|
...e,
|
|
2535
2530
|
error: `Unrecognized command: /${a}`,
|
|
2536
2531
|
shortcutsOpen: !1
|
|
2537
|
-
})),
|
|
2532
|
+
})), R(null);
|
|
2538
2533
|
return;
|
|
2539
2534
|
}
|
|
2540
|
-
let s =
|
|
2535
|
+
let s = ge(e, w, O), c = s ?? {
|
|
2541
2536
|
mode: "submitted",
|
|
2542
2537
|
prompt: "",
|
|
2543
2538
|
persistedPrompt: "",
|
|
@@ -2549,24 +2544,24 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2549
2544
|
elements: [],
|
|
2550
2545
|
payloadElements: [],
|
|
2551
2546
|
mentionBindings: []
|
|
2552
|
-
}, l =
|
|
2547
|
+
}, l = _e(c, o);
|
|
2553
2548
|
if (l) {
|
|
2554
|
-
|
|
2549
|
+
B((e) => ({
|
|
2555
2550
|
...e,
|
|
2556
2551
|
error: l,
|
|
2557
2552
|
shortcutsOpen: !1
|
|
2558
|
-
})),
|
|
2553
|
+
})), R(null);
|
|
2559
2554
|
return;
|
|
2560
2555
|
}
|
|
2561
2556
|
let u = /* @__PURE__ */ new Map(), d = [];
|
|
2562
2557
|
for (let t of e.imageAttachments) {
|
|
2563
|
-
let e =
|
|
2558
|
+
let e = ue.current.get(t.id);
|
|
2564
2559
|
if (!e) {
|
|
2565
|
-
|
|
2560
|
+
B((e) => ({
|
|
2566
2561
|
...e,
|
|
2567
2562
|
error: `Attached image is no longer available: ${t.placeholder}`,
|
|
2568
2563
|
shortcutsOpen: !1
|
|
2569
|
-
})),
|
|
2564
|
+
})), R(null);
|
|
2570
2565
|
return;
|
|
2571
2566
|
}
|
|
2572
2567
|
u.set(t.id, e), d.push({
|
|
@@ -2581,31 +2576,31 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2581
2576
|
...c.items.filter((e) => e.type !== "remote_image")
|
|
2582
2577
|
], p = {
|
|
2583
2578
|
id: crypto.randomUUID(),
|
|
2584
|
-
at: new Date(
|
|
2579
|
+
at: new Date(y.Date.now()).toLocaleTimeString(),
|
|
2585
2580
|
mode: i ? "queued" : c.mode,
|
|
2586
2581
|
prompt: c.prompt,
|
|
2587
2582
|
persistedPrompt: c.persistedPrompt,
|
|
2588
|
-
action: i ?
|
|
2583
|
+
action: i ? ur(c, O) : c.action,
|
|
2589
2584
|
command: c.command,
|
|
2590
2585
|
args: c.args,
|
|
2591
2586
|
items: f
|
|
2592
2587
|
};
|
|
2593
|
-
if (
|
|
2594
|
-
for (let e of u.keys())
|
|
2595
|
-
let m =
|
|
2596
|
-
|
|
2597
|
-
t !== void 0 &&
|
|
2588
|
+
if (Ze(p)) return;
|
|
2589
|
+
for (let e of u.keys()) ue.current.delete(e);
|
|
2590
|
+
let m = We(e, c.persistedPrompt), h = q.current?.(p, { editableSource: m });
|
|
2591
|
+
wr(h) && (M.current += 1, h.then(() => {
|
|
2592
|
+
t !== void 0 && wt(t, null);
|
|
2598
2593
|
}).catch((e) => {
|
|
2599
|
-
for (let [e, t] of u)
|
|
2600
|
-
t !== void 0 &&
|
|
2594
|
+
for (let [e, t] of u) ue.current.set(e, t);
|
|
2595
|
+
t !== void 0 && wt(t, m), N.current && (X(r), Y?.commands.focus("end"), B((t) => ({
|
|
2601
2596
|
...t,
|
|
2602
2597
|
error: e instanceof Error ? e.message : "Could not send prompt"
|
|
2603
2598
|
})));
|
|
2604
2599
|
}).finally(() => {
|
|
2605
2600
|
--M.current;
|
|
2606
2601
|
}));
|
|
2607
|
-
let g = s ?
|
|
2608
|
-
K.current = null,
|
|
2602
|
+
let g = s ? Ge(e, c.historyPrompt) : e.history;
|
|
2603
|
+
K.current = null, H.current = [], I([]), R(null), X(Sn()), B((e) => ({
|
|
2609
2604
|
...e,
|
|
2610
2605
|
text: "",
|
|
2611
2606
|
cursor: 0,
|
|
@@ -2621,10 +2616,10 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2621
2616
|
historyCursor: null
|
|
2622
2617
|
}));
|
|
2623
2618
|
}
|
|
2624
|
-
function
|
|
2619
|
+
function tt() {
|
|
2625
2620
|
if (n) return;
|
|
2626
|
-
let e =
|
|
2627
|
-
K.current = null,
|
|
2621
|
+
let e = V.current.history, t = V.current.killBuffer;
|
|
2622
|
+
K.current = null, se.current = null, ue.current.clear(), H.current = j.current, I(j.current), R(null), X(ie.current), Y?.commands.focus("end"), B((n) => ({
|
|
2628
2623
|
...n,
|
|
2629
2624
|
history: e,
|
|
2630
2625
|
historyCursor: null,
|
|
@@ -2635,61 +2630,61 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2635
2630
|
shortcutsOpen: !1
|
|
2636
2631
|
}));
|
|
2637
2632
|
}
|
|
2638
|
-
function
|
|
2639
|
-
if (n || !
|
|
2640
|
-
let t =
|
|
2641
|
-
if (e > 0 && r === 0 &&
|
|
2642
|
-
|
|
2633
|
+
function nt(e) {
|
|
2634
|
+
if (n || !Y || V.current.history.length === 0) return;
|
|
2635
|
+
let t = V.current, r = K.current ?? t.historyCursor;
|
|
2636
|
+
if (e > 0 && r === 0 && oe.current) {
|
|
2637
|
+
it(oe.current, null), oe.current = null;
|
|
2643
2638
|
return;
|
|
2644
2639
|
}
|
|
2645
|
-
let i = r === null ? e < 0 ? 0 : t.history.length - 1 :
|
|
2646
|
-
r === null && (
|
|
2640
|
+
let i = r === null ? e < 0 ? 0 : t.history.length - 1 : ut(r + e, t.history.length);
|
|
2641
|
+
r === null && (oe.current = Ue(Q()));
|
|
2647
2642
|
let a = t.history[i];
|
|
2648
|
-
|
|
2643
|
+
rt(a, i);
|
|
2649
2644
|
}
|
|
2650
|
-
function
|
|
2651
|
-
|
|
2645
|
+
function rt(e, t) {
|
|
2646
|
+
it(qe({
|
|
2652
2647
|
source: e,
|
|
2653
|
-
slashCommands:
|
|
2654
|
-
mentionCandidates:
|
|
2648
|
+
slashCommands: w,
|
|
2649
|
+
mentionCandidates: D
|
|
2655
2650
|
}), t);
|
|
2656
2651
|
}
|
|
2657
|
-
function
|
|
2652
|
+
function it(e, t) {
|
|
2658
2653
|
let n = e.remoteImages ?? [];
|
|
2659
|
-
|
|
2660
|
-
...
|
|
2654
|
+
H.current = n, V.current = {
|
|
2655
|
+
...V.current,
|
|
2661
2656
|
historyCursor: t,
|
|
2662
2657
|
shortcutsOpen: !1
|
|
2663
|
-
}, K.current = t,
|
|
2658
|
+
}, K.current = t, ae.current = t, I(n), X(fn({
|
|
2664
2659
|
state: e,
|
|
2665
|
-
slashCommands:
|
|
2666
|
-
mentionCandidates:
|
|
2667
|
-
triggers:
|
|
2668
|
-
})),
|
|
2660
|
+
slashCommands: w,
|
|
2661
|
+
mentionCandidates: D,
|
|
2662
|
+
triggers: A
|
|
2663
|
+
})), Y?.commands.focus("end"), B((e) => ({
|
|
2669
2664
|
...e,
|
|
2670
2665
|
historyCursor: t,
|
|
2671
2666
|
shortcutsOpen: !1
|
|
2672
2667
|
}));
|
|
2673
2668
|
}
|
|
2674
|
-
function
|
|
2675
|
-
n || (
|
|
2669
|
+
function at() {
|
|
2670
|
+
n || (R(null), K.current = null, se.current = Q(), B((e) => ({
|
|
2676
2671
|
...e,
|
|
2677
2672
|
reverseSearch: "",
|
|
2678
2673
|
historyCursor: null,
|
|
2679
2674
|
shortcutsOpen: !1
|
|
2680
2675
|
})));
|
|
2681
2676
|
}
|
|
2682
|
-
function
|
|
2677
|
+
function ct(e) {
|
|
2683
2678
|
if (n) {
|
|
2684
2679
|
e.preventDefault();
|
|
2685
2680
|
return;
|
|
2686
2681
|
}
|
|
2687
2682
|
if (e.preventDefault(), e.key === "Escape") {
|
|
2688
|
-
|
|
2683
|
+
pt(null), se.current = null;
|
|
2689
2684
|
return;
|
|
2690
2685
|
}
|
|
2691
2686
|
if (e.key === "Enter") {
|
|
2692
|
-
|
|
2687
|
+
se.current = null, B((e) => ({
|
|
2693
2688
|
...e,
|
|
2694
2689
|
reverseSearch: null,
|
|
2695
2690
|
shortcutsOpen: !1
|
|
@@ -2697,47 +2692,47 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2697
2692
|
return;
|
|
2698
2693
|
}
|
|
2699
2694
|
if (e.key === "Backspace") {
|
|
2700
|
-
|
|
2695
|
+
lt((e) => e.slice(0, -1));
|
|
2701
2696
|
return;
|
|
2702
2697
|
}
|
|
2703
2698
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "r") {
|
|
2704
|
-
|
|
2699
|
+
dt(1);
|
|
2705
2700
|
return;
|
|
2706
2701
|
}
|
|
2707
2702
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "s") {
|
|
2708
|
-
|
|
2703
|
+
dt(-1);
|
|
2709
2704
|
return;
|
|
2710
2705
|
}
|
|
2711
|
-
e.key.length === 1 && !e.metaKey && !e.altKey && !e.ctrlKey &&
|
|
2706
|
+
e.key.length === 1 && !e.metaKey && !e.altKey && !e.ctrlKey && lt((t) => `${t}${e.key}`);
|
|
2712
2707
|
}
|
|
2713
|
-
function
|
|
2708
|
+
function lt(e) {
|
|
2714
2709
|
if (n) return;
|
|
2715
|
-
let t =
|
|
2716
|
-
if (!
|
|
2717
|
-
|
|
2710
|
+
let t = V.current, r = e(t.reverseSearch ?? ""), i = ot(t.history, r, null);
|
|
2711
|
+
if (!Y || !i) {
|
|
2712
|
+
pt(r);
|
|
2718
2713
|
return;
|
|
2719
2714
|
}
|
|
2720
|
-
|
|
2715
|
+
ft(i.entry, i.index, r);
|
|
2721
2716
|
}
|
|
2722
|
-
function
|
|
2723
|
-
if (n || !
|
|
2724
|
-
let t =
|
|
2725
|
-
i &&
|
|
2717
|
+
function dt(e) {
|
|
2718
|
+
if (n || !Y) return;
|
|
2719
|
+
let t = V.current, r = t.reverseSearch ?? "", i = ot(t.history, r, t.historyCursor, e);
|
|
2720
|
+
i && ft(i.entry, i.index, r);
|
|
2726
2721
|
}
|
|
2727
|
-
function
|
|
2728
|
-
let r =
|
|
2722
|
+
function ft(e, t, n) {
|
|
2723
|
+
let r = Y;
|
|
2729
2724
|
if (!r) return;
|
|
2730
|
-
let i =
|
|
2725
|
+
let i = qe({
|
|
2731
2726
|
source: e,
|
|
2732
|
-
slashCommands:
|
|
2733
|
-
mentionCandidates:
|
|
2727
|
+
slashCommands: w,
|
|
2728
|
+
mentionCandidates: D
|
|
2734
2729
|
}), a = i.remoteImages ?? [];
|
|
2735
|
-
|
|
2730
|
+
H.current = a, I(a), X(fn({
|
|
2736
2731
|
state: i,
|
|
2737
|
-
slashCommands:
|
|
2738
|
-
mentionCandidates:
|
|
2739
|
-
triggers:
|
|
2740
|
-
})), r.commands.focus("end"),
|
|
2732
|
+
slashCommands: w,
|
|
2733
|
+
mentionCandidates: D,
|
|
2734
|
+
triggers: A
|
|
2735
|
+
})), r.commands.focus("end"), B((e) => ({
|
|
2741
2736
|
...e,
|
|
2742
2737
|
historyCursor: t,
|
|
2743
2738
|
reverseSearch: n,
|
|
@@ -2745,11 +2740,11 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2745
2740
|
shortcutsOpen: !1
|
|
2746
2741
|
}));
|
|
2747
2742
|
}
|
|
2748
|
-
function
|
|
2743
|
+
function pt(e) {
|
|
2749
2744
|
if (n) return;
|
|
2750
|
-
let t =
|
|
2751
|
-
if (!t || !
|
|
2752
|
-
|
|
2745
|
+
let t = se.current;
|
|
2746
|
+
if (!t || !Y) {
|
|
2747
|
+
B((t) => ({
|
|
2753
2748
|
...t,
|
|
2754
2749
|
reverseSearch: e,
|
|
2755
2750
|
shortcutsOpen: !1
|
|
@@ -2758,347 +2753,347 @@ function Dr({ initialDraft: e, draftKey: t, disabled: n = !1, isTaskRunning: r =
|
|
|
2758
2753
|
}
|
|
2759
2754
|
let r = {
|
|
2760
2755
|
...t,
|
|
2761
|
-
history:
|
|
2762
|
-
killBuffer:
|
|
2756
|
+
history: V.current.history,
|
|
2757
|
+
killBuffer: V.current.killBuffer,
|
|
2763
2758
|
reverseSearch: e,
|
|
2764
2759
|
historyCursor: null,
|
|
2765
2760
|
selectedRemoteImageId: null,
|
|
2766
2761
|
shortcutsOpen: !1
|
|
2767
2762
|
};
|
|
2768
|
-
K.current = null,
|
|
2763
|
+
K.current = null, H.current = r.remoteImages, I(r.remoteImages), X(fn({
|
|
2769
2764
|
state: r,
|
|
2770
|
-
slashCommands:
|
|
2771
|
-
mentionCandidates:
|
|
2772
|
-
triggers:
|
|
2773
|
-
})),
|
|
2765
|
+
slashCommands: w,
|
|
2766
|
+
mentionCandidates: D,
|
|
2767
|
+
triggers: A
|
|
2768
|
+
})), Y.commands.focus("end"), B(r);
|
|
2774
2769
|
}
|
|
2775
|
-
|
|
2776
|
-
function
|
|
2770
|
+
J.current = n ? (e) => (e.preventDefault(), !0) : Ke, de.current = je;
|
|
2771
|
+
function mt(e) {
|
|
2777
2772
|
if (!(e.target instanceof Element) || !e.target.closest("[data-slot=\"composer-editor\"]")) return;
|
|
2778
2773
|
if (n) {
|
|
2779
2774
|
e.preventDefault();
|
|
2780
2775
|
return;
|
|
2781
2776
|
}
|
|
2782
|
-
if (!
|
|
2783
|
-
if (
|
|
2784
|
-
|
|
2777
|
+
if (!Y || Ke(e)) return;
|
|
2778
|
+
if (V.current.reverseSearch !== null) {
|
|
2779
|
+
ct(e);
|
|
2785
2780
|
return;
|
|
2786
2781
|
}
|
|
2787
|
-
if (
|
|
2788
|
-
e.preventDefault(),
|
|
2782
|
+
if (V.current.shortcutsOpen && e.key === "Escape") {
|
|
2783
|
+
e.preventDefault(), Oe();
|
|
2789
2784
|
return;
|
|
2790
2785
|
}
|
|
2791
|
-
if (e.key === "?" && !e.metaKey && !e.ctrlKey && !e.altKey &&
|
|
2792
|
-
e.preventDefault(),
|
|
2786
|
+
if (e.key === "?" && !e.metaKey && !e.ctrlKey && !e.altKey && Ee(Q())) {
|
|
2787
|
+
e.preventDefault(), ke();
|
|
2793
2788
|
return;
|
|
2794
2789
|
}
|
|
2795
|
-
if (
|
|
2796
|
-
e.preventDefault(),
|
|
2790
|
+
if (Jr(e)) {
|
|
2791
|
+
e.preventDefault(), Y.chain().focus().setHardBreak().run(), K.current = null, R(null);
|
|
2797
2792
|
return;
|
|
2798
2793
|
}
|
|
2799
|
-
if (
|
|
2800
|
-
if (
|
|
2801
|
-
e.preventDefault(),
|
|
2794
|
+
if (U.current) {
|
|
2795
|
+
if (dr(e) || fr(e)) {
|
|
2796
|
+
e.preventDefault(), gt(dr(e) ? -1 : 1);
|
|
2802
2797
|
return;
|
|
2803
2798
|
}
|
|
2804
2799
|
if (e.key === "Tab") {
|
|
2805
|
-
e.preventDefault(),
|
|
2800
|
+
e.preventDefault(), we();
|
|
2806
2801
|
return;
|
|
2807
2802
|
}
|
|
2808
2803
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
2809
|
-
if (e.preventDefault(),
|
|
2810
|
-
|
|
2804
|
+
if (e.preventDefault(), be.length === 0) {
|
|
2805
|
+
R(null), $e();
|
|
2811
2806
|
return;
|
|
2812
2807
|
}
|
|
2813
|
-
|
|
2808
|
+
we();
|
|
2814
2809
|
return;
|
|
2815
2810
|
}
|
|
2816
2811
|
if (e.key === "Escape") {
|
|
2817
|
-
e.preventDefault(),
|
|
2812
|
+
e.preventDefault(), R(null);
|
|
2818
2813
|
return;
|
|
2819
2814
|
}
|
|
2820
2815
|
}
|
|
2821
|
-
if (
|
|
2822
|
-
let t =
|
|
2823
|
-
t && (e.preventDefault(),
|
|
2816
|
+
if (Yr(e)) {
|
|
2817
|
+
let t = Xn(Y);
|
|
2818
|
+
t && (e.preventDefault(), W.current = t, B((e) => ({
|
|
2824
2819
|
...e,
|
|
2825
2820
|
killBuffer: t.text
|
|
2826
2821
|
}))), K.current = null;
|
|
2827
2822
|
return;
|
|
2828
2823
|
}
|
|
2829
|
-
let t =
|
|
2824
|
+
let t = Xr(e);
|
|
2830
2825
|
if (t !== null) {
|
|
2831
|
-
e.preventDefault(),
|
|
2826
|
+
e.preventDefault(), Qn(Y, t), K.current = null;
|
|
2832
2827
|
return;
|
|
2833
2828
|
}
|
|
2834
2829
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "e") {
|
|
2835
|
-
e.preventDefault(),
|
|
2830
|
+
e.preventDefault(), Zn(Y), K.current = null;
|
|
2836
2831
|
return;
|
|
2837
2832
|
}
|
|
2838
2833
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
2839
|
-
let t =
|
|
2840
|
-
t && (e.preventDefault(),
|
|
2834
|
+
let t = Jn(Y);
|
|
2835
|
+
t && (e.preventDefault(), W.current = t, B((e) => ({
|
|
2841
2836
|
...e,
|
|
2842
2837
|
killBuffer: t.text
|
|
2843
2838
|
})));
|
|
2844
2839
|
return;
|
|
2845
2840
|
}
|
|
2846
2841
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "u") {
|
|
2847
|
-
let t =
|
|
2848
|
-
t && (e.preventDefault(),
|
|
2842
|
+
let t = Yn(Y);
|
|
2843
|
+
t && (e.preventDefault(), W.current = t, B((e) => ({
|
|
2849
2844
|
...e,
|
|
2850
2845
|
killBuffer: t.text
|
|
2851
2846
|
})));
|
|
2852
2847
|
return;
|
|
2853
2848
|
}
|
|
2854
|
-
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "y" &&
|
|
2855
|
-
e.preventDefault(),
|
|
2849
|
+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "y" && V.current.killBuffer) {
|
|
2850
|
+
e.preventDefault(), ar(Y, W.current ?? V.current.killBuffer);
|
|
2856
2851
|
return;
|
|
2857
2852
|
}
|
|
2858
2853
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "r") {
|
|
2859
|
-
e.preventDefault(),
|
|
2854
|
+
e.preventDefault(), at();
|
|
2860
2855
|
return;
|
|
2861
2856
|
}
|
|
2862
|
-
if ((e.key === "Backspace" || e.key === "Delete") &&
|
|
2863
|
-
e.preventDefault(), K.current = null,
|
|
2857
|
+
if ((e.key === "Backspace" || e.key === "Delete") && Qr(Y)) {
|
|
2858
|
+
e.preventDefault(), K.current = null, R(null);
|
|
2864
2859
|
return;
|
|
2865
2860
|
}
|
|
2866
|
-
if ((e.key === "Backspace" || e.key === "Delete") &&
|
|
2861
|
+
if ((e.key === "Backspace" || e.key === "Delete") && or(Y, e.key)) {
|
|
2867
2862
|
e.preventDefault(), K.current = null;
|
|
2868
2863
|
return;
|
|
2869
2864
|
}
|
|
2870
2865
|
if ((e.key === "Backspace" || e.key === "Delete" || e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) && (K.current = null), e.key === "Enter" && !e.shiftKey && !e.altKey) {
|
|
2871
|
-
e.preventDefault(),
|
|
2866
|
+
e.preventDefault(), $e();
|
|
2872
2867
|
return;
|
|
2873
2868
|
}
|
|
2874
|
-
let r =
|
|
2875
|
-
if (r !== null && !
|
|
2876
|
-
let t =
|
|
2877
|
-
if (e.key === "ArrowUp" && (
|
|
2878
|
-
e.preventDefault(),
|
|
2869
|
+
let r = Zr(e);
|
|
2870
|
+
if (r !== null && !U.current) {
|
|
2871
|
+
let t = Q();
|
|
2872
|
+
if (e.key === "ArrowUp" && (lr(Y) || t.cursor === 0) && t.remoteImages.length > 0) {
|
|
2873
|
+
e.preventDefault(), Ie(t.remoteImages.length - 1);
|
|
2879
2874
|
return;
|
|
2880
2875
|
}
|
|
2881
|
-
|
|
2876
|
+
st(t.text, t.cursor, r) && (e.preventDefault(), nt(r));
|
|
2882
2877
|
}
|
|
2883
2878
|
}
|
|
2884
|
-
function
|
|
2879
|
+
function ht(e) {
|
|
2885
2880
|
if (n) {
|
|
2886
2881
|
e.preventDefault();
|
|
2887
2882
|
return;
|
|
2888
2883
|
}
|
|
2889
|
-
e.target instanceof Element && e.target.closest("[data-slot=\"composer-editor\"]") &&
|
|
2884
|
+
e.target instanceof Element && e.target.closest("[data-slot=\"composer-editor\"]") && Re();
|
|
2890
2885
|
}
|
|
2891
|
-
function
|
|
2892
|
-
n ||
|
|
2886
|
+
function gt(e) {
|
|
2887
|
+
n || R((t) => {
|
|
2893
2888
|
if (!t) return t;
|
|
2894
|
-
let n =
|
|
2889
|
+
let n = Bt(t, w, D, a).length;
|
|
2895
2890
|
return n === 0 ? t : {
|
|
2896
2891
|
...t,
|
|
2897
|
-
selectedIndex:
|
|
2892
|
+
selectedIndex: ut(t.selectedIndex + e, n)
|
|
2898
2893
|
};
|
|
2899
2894
|
});
|
|
2900
2895
|
}
|
|
2901
|
-
let
|
|
2896
|
+
let _t = tn({
|
|
2902
2897
|
dictation: p,
|
|
2903
2898
|
disabled: n,
|
|
2904
|
-
insertTranscript:
|
|
2905
|
-
submitDraft:
|
|
2899
|
+
insertTranscript: Qe,
|
|
2900
|
+
submitDraft: et
|
|
2906
2901
|
});
|
|
2907
|
-
return /* @__PURE__ */
|
|
2902
|
+
return /* @__PURE__ */ T(P, {
|
|
2908
2903
|
value: {
|
|
2909
|
-
state:
|
|
2904
|
+
state: z,
|
|
2910
2905
|
disabled: n,
|
|
2911
|
-
commandTriggers:
|
|
2912
|
-
activePopup:
|
|
2913
|
-
suggestions:
|
|
2914
|
-
attachedImages:
|
|
2906
|
+
commandTriggers: O,
|
|
2907
|
+
activePopup: L,
|
|
2908
|
+
suggestions: be,
|
|
2909
|
+
attachedImages: ue.current,
|
|
2910
|
+
setEditorPlaceholder: ve,
|
|
2915
2911
|
actions: {
|
|
2916
|
-
acceptSuggestion:
|
|
2917
|
-
toggleSlashMenu:
|
|
2918
|
-
insertText:
|
|
2919
|
-
attachImageFiles:
|
|
2920
|
-
removeImageAttachment:
|
|
2921
|
-
addRemoteImage:
|
|
2922
|
-
handleDrop:
|
|
2923
|
-
insertPaste:
|
|
2924
|
-
insertRichLink:
|
|
2925
|
-
openShortcuts:
|
|
2926
|
-
closeShortcuts:
|
|
2927
|
-
toggleShortcuts:
|
|
2928
|
-
submit:
|
|
2929
|
-
reset:
|
|
2912
|
+
acceptSuggestion: we,
|
|
2913
|
+
toggleSlashMenu: Te,
|
|
2914
|
+
insertText: Ae,
|
|
2915
|
+
attachImageFiles: Ne,
|
|
2916
|
+
removeImageAttachment: Pe,
|
|
2917
|
+
addRemoteImage: Fe,
|
|
2918
|
+
handleDrop: Z,
|
|
2919
|
+
insertPaste: Ye,
|
|
2920
|
+
insertRichLink: Xe,
|
|
2921
|
+
openShortcuts: De,
|
|
2922
|
+
closeShortcuts: Oe,
|
|
2923
|
+
toggleShortcuts: ke,
|
|
2924
|
+
submit: $e,
|
|
2925
|
+
reset: tt
|
|
2930
2926
|
},
|
|
2931
|
-
meta: { editor:
|
|
2927
|
+
meta: { editor: Y }
|
|
2932
2928
|
},
|
|
2933
|
-
children: /* @__PURE__ */
|
|
2934
|
-
value:
|
|
2935
|
-
children: /* @__PURE__ */
|
|
2929
|
+
children: /* @__PURE__ */ T(Ht, {
|
|
2930
|
+
value: _t?.api ?? null,
|
|
2931
|
+
children: /* @__PURE__ */ T("section", {
|
|
2936
2932
|
"data-slot": "composer",
|
|
2937
2933
|
className: l("border-border bg-card relative border font-[inherit]", d),
|
|
2938
|
-
children: /* @__PURE__ */
|
|
2939
|
-
onKeyDownCapture:
|
|
2940
|
-
onMouseDownCapture:
|
|
2941
|
-
children: [f,
|
|
2934
|
+
children: /* @__PURE__ */ E("div", {
|
|
2935
|
+
onKeyDownCapture: mt,
|
|
2936
|
+
onMouseDownCapture: ht,
|
|
2937
|
+
children: [f, C.hasLayoutChildren ? null : /* @__PURE__ */ T(Er, {})]
|
|
2942
2938
|
})
|
|
2943
2939
|
})
|
|
2944
2940
|
})
|
|
2945
2941
|
});
|
|
2946
2942
|
}
|
|
2947
|
-
function
|
|
2943
|
+
function Er() {
|
|
2948
2944
|
let e = i(2), t;
|
|
2949
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */
|
|
2945
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ T(Mr, {}), e[0] = t) : t = e[0];
|
|
2950
2946
|
let n;
|
|
2951
|
-
return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ w
|
|
2947
|
+
return e[1] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ E(w, { children: [
|
|
2952
2948
|
t,
|
|
2953
|
-
/* @__PURE__ */
|
|
2954
|
-
/* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ E(Dr, { children: [
|
|
2950
|
+
/* @__PURE__ */ T(kr, {}),
|
|
2951
|
+
/* @__PURE__ */ T(L, {}),
|
|
2952
|
+
/* @__PURE__ */ T(Ar, {}),
|
|
2953
|
+
/* @__PURE__ */ T(jr, {})
|
|
2958
2954
|
] }),
|
|
2959
|
-
/* @__PURE__ */
|
|
2960
|
-
/* @__PURE__ */
|
|
2955
|
+
/* @__PURE__ */ T(Ir, {}),
|
|
2956
|
+
/* @__PURE__ */ T(zr, {})
|
|
2961
2957
|
] }), e[1] = n) : n = e[1], n;
|
|
2962
2958
|
}
|
|
2963
|
-
function
|
|
2959
|
+
function Dr(e) {
|
|
2964
2960
|
let t = i(8), n, r;
|
|
2965
2961
|
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
2966
2962
|
let a;
|
|
2967
2963
|
t[3] === n ? a = t[4] : (a = l("space-y-2", n), t[3] = n, t[4] = a);
|
|
2968
2964
|
let o;
|
|
2969
|
-
return t[5] !== r || t[6] !== a ? (o = /* @__PURE__ */
|
|
2965
|
+
return t[5] !== r || t[6] !== a ? (o = /* @__PURE__ */ T("div", {
|
|
2970
2966
|
className: a,
|
|
2971
2967
|
...r
|
|
2972
2968
|
}), t[5] = r, t[6] = a, t[7] = o) : o = t[7], o;
|
|
2973
2969
|
}
|
|
2974
|
-
function
|
|
2970
|
+
function Or(e) {
|
|
2975
2971
|
let t = i(8), n, r;
|
|
2976
2972
|
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
2977
2973
|
let a;
|
|
2978
2974
|
t[3] === n ? a = t[4] : (a = l("flex flex-wrap items-center gap-1.5", n), t[3] = n, t[4] = a);
|
|
2979
2975
|
let o;
|
|
2980
|
-
return t[5] !== r || t[6] !== a ? (o = /* @__PURE__ */
|
|
2976
|
+
return t[5] !== r || t[6] !== a ? (o = /* @__PURE__ */ T("div", {
|
|
2981
2977
|
className: a,
|
|
2982
2978
|
...r
|
|
2983
2979
|
}), t[5] = r, t[6] = a, t[7] = o) : o = t[7], o;
|
|
2984
2980
|
}
|
|
2985
|
-
function
|
|
2981
|
+
function kr(e) {
|
|
2986
2982
|
let t = i(14), n, r;
|
|
2987
2983
|
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
2988
|
-
let { state: a } =
|
|
2984
|
+
let { state: a } = F("Composer.RemoteImages");
|
|
2989
2985
|
if (a.remoteImages.length === 0) return null;
|
|
2990
2986
|
let o;
|
|
2991
2987
|
t[3] === n ? o = t[4] : (o = l("border-border space-y-1 border-b pb-2 text-sm", n), t[3] = n, t[4] = o);
|
|
2992
2988
|
let s;
|
|
2993
2989
|
if (t[5] !== a.remoteImages || t[6] !== a.selectedRemoteImageId) {
|
|
2994
2990
|
let e;
|
|
2995
|
-
t[8] === a.selectedRemoteImageId ? e = t[9] : (e = (e, t) => /* @__PURE__ */
|
|
2991
|
+
t[8] === a.selectedRemoteImageId ? e = t[9] : (e = (e, t) => /* @__PURE__ */ E("div", {
|
|
2996
2992
|
className: l("flex h-6 items-center gap-2 rounded-sm px-2", a.selectedRemoteImageId === e.id ? "bg-primary text-primary-foreground" : "text-sky-500"),
|
|
2997
|
-
children: [/* @__PURE__ */
|
|
2993
|
+
children: [/* @__PURE__ */ E("span", {
|
|
2998
2994
|
className: "shrink-0",
|
|
2999
2995
|
children: [
|
|
3000
2996
|
"[Image #",
|
|
3001
2997
|
t + 1,
|
|
3002
2998
|
"]"
|
|
3003
2999
|
]
|
|
3004
|
-
}), /* @__PURE__ */
|
|
3000
|
+
}), /* @__PURE__ */ T("span", {
|
|
3005
3001
|
className: "truncate text-xs opacity-70",
|
|
3006
3002
|
children: e.url
|
|
3007
3003
|
})]
|
|
3008
3004
|
}, e.id), t[8] = a.selectedRemoteImageId, t[9] = e), s = a.remoteImages.map(e), t[5] = a.remoteImages, t[6] = a.selectedRemoteImageId, t[7] = s;
|
|
3009
3005
|
} else s = t[7];
|
|
3010
3006
|
let c;
|
|
3011
|
-
return t[10] !== r || t[11] !== o || t[12] !== s ? (c = /* @__PURE__ */
|
|
3007
|
+
return t[10] !== r || t[11] !== o || t[12] !== s ? (c = /* @__PURE__ */ T("div", {
|
|
3012
3008
|
className: o,
|
|
3013
3009
|
...r,
|
|
3014
3010
|
children: s
|
|
3015
3011
|
}), t[10] = r, t[11] = o, t[12] = s, t[13] = c) : c = t[13], c;
|
|
3016
3012
|
}
|
|
3017
|
-
function
|
|
3013
|
+
function Ar(e) {
|
|
3018
3014
|
let t = i(21), n, r, a, s;
|
|
3019
3015
|
t[0] === e ? (n = t[1], r = t[2], a = t[3], s = t[4]) : ({className: n, onDrop: r, placeholder: s, ...a} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = a, t[4] = s);
|
|
3020
|
-
let c = s === void 0 ? "Type a message or / for commands" : s, {
|
|
3021
|
-
t[5] !==
|
|
3022
|
-
|
|
3023
|
-
}, t[5] =
|
|
3024
|
-
let h;
|
|
3025
|
-
t[
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
}) : null, t[8] = c, t[9] = l.text.length, t[10] = h) : h = t[10];
|
|
3029
|
-
let g;
|
|
3030
|
-
t[11] === d.editor ? g = t[12] : (g = /* @__PURE__ */ C(o, { editor: d.editor }), t[11] = d.editor, t[12] = g);
|
|
3016
|
+
let c = s === void 0 ? "Type a message or / for commands" : s, { disabled: l, meta: u, actions: d, setEditorPlaceholder: f } = F("Composer.Editor"), p, m;
|
|
3017
|
+
t[5] !== c || t[6] !== f ? (p = () => {
|
|
3018
|
+
f(c);
|
|
3019
|
+
}, m = [c, f], t[5] = c, t[6] = f, t[7] = p, t[8] = m) : (p = t[7], m = t[8]), y(p, m);
|
|
3020
|
+
let h = l ? "" : void 0, g;
|
|
3021
|
+
t[9] !== d || t[10] !== r ? (g = (e) => {
|
|
3022
|
+
r?.(e), !e.defaultPrevented && d.handleDrop(e.dataTransfer) && e.preventDefault();
|
|
3023
|
+
}, t[9] = d, t[10] = r, t[11] = g) : g = t[11];
|
|
3031
3024
|
let _;
|
|
3032
|
-
|
|
3025
|
+
t[12] === u.editor ? _ = t[13] : (_ = /* @__PURE__ */ T(o, { editor: u.editor }), t[12] = u.editor, t[13] = _);
|
|
3026
|
+
let v;
|
|
3027
|
+
return t[14] !== n || t[15] !== l || t[16] !== a || t[17] !== h || t[18] !== g || t[19] !== _ ? (v = /* @__PURE__ */ T("div", {
|
|
3033
3028
|
"data-slot": "composer-frame",
|
|
3034
3029
|
className: n,
|
|
3035
|
-
"aria-disabled":
|
|
3036
|
-
"data-disabled":
|
|
3037
|
-
onDrop:
|
|
3030
|
+
"aria-disabled": l,
|
|
3031
|
+
"data-disabled": h,
|
|
3032
|
+
onDrop: g,
|
|
3038
3033
|
...a,
|
|
3039
|
-
children:
|
|
3040
|
-
}), t[
|
|
3034
|
+
children: _
|
|
3035
|
+
}), t[14] = n, t[15] = l, t[16] = a, t[17] = h, t[18] = g, t[19] = _, t[20] = v) : v = t[20], v;
|
|
3041
3036
|
}
|
|
3042
|
-
function
|
|
3037
|
+
function jr(e) {
|
|
3043
3038
|
let t = i(9), n, r;
|
|
3044
3039
|
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
3045
|
-
let { state: a } =
|
|
3040
|
+
let { state: a } = F("Composer.Error");
|
|
3046
3041
|
if (!a.error) return null;
|
|
3047
3042
|
let o;
|
|
3048
3043
|
t[3] === n ? o = t[4] : (o = l("border-primary/30 bg-primary/10 text-primary rounded-md border px-3 py-2 text-xs", n), t[3] = n, t[4] = o);
|
|
3049
3044
|
let s;
|
|
3050
|
-
return t[5] !== r || t[6] !== a.error || t[7] !== o ? (s = /* @__PURE__ */
|
|
3045
|
+
return t[5] !== r || t[6] !== a.error || t[7] !== o ? (s = /* @__PURE__ */ T("div", {
|
|
3051
3046
|
role: "alert",
|
|
3052
3047
|
className: o,
|
|
3053
3048
|
...r,
|
|
3054
3049
|
children: a.error
|
|
3055
3050
|
}), t[5] = r, t[6] = a.error, t[7] = o, t[8] = s) : s = t[8], s;
|
|
3056
3051
|
}
|
|
3057
|
-
function
|
|
3052
|
+
function Mr(e) {
|
|
3058
3053
|
let t = i(25), n, r;
|
|
3059
3054
|
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
3060
|
-
let { activePopup: a, suggestions: o, actions: s } =
|
|
3055
|
+
let { activePopup: a, suggestions: o, actions: s } = F("Composer.Popup"), { acceptSuggestion: c } = s;
|
|
3061
3056
|
if (!a) return null;
|
|
3062
3057
|
let u;
|
|
3063
|
-
t[3] === o ? u = t[4] : (u = o.some(
|
|
3058
|
+
t[3] === o ? u = t[4] : (u = o.some(Nr), t[3] = o, t[4] = u);
|
|
3064
3059
|
let d = u, f;
|
|
3065
3060
|
t[5] === n ? f = t[6] : (f = l("border-border bg-popover absolute inset-x-0 bottom-[calc(100%+0.5rem)] z-10 rounded-xl border shadow-lg", n), t[5] = n, t[6] = f);
|
|
3066
3061
|
let p;
|
|
3067
3062
|
if (t[7] !== c || t[8] !== a || t[9] !== o || t[10] !== d) {
|
|
3068
3063
|
let e;
|
|
3069
|
-
t[12] !== c || t[13] !== a || t[14] !== d ? (e = (e, t) => /* @__PURE__ */
|
|
3064
|
+
t[12] !== c || t[13] !== a || t[14] !== d ? (e = (e, t) => /* @__PURE__ */ T(Pr, {
|
|
3070
3065
|
selected: t === a.selectedIndex,
|
|
3071
3066
|
icon: d ? e.icon : null,
|
|
3072
|
-
token:
|
|
3067
|
+
token: J(e),
|
|
3073
3068
|
takesArgs: e.supportsArgs === !0,
|
|
3074
3069
|
description: e.detail,
|
|
3075
3070
|
onMouseDown: () => c({ index: t })
|
|
3076
3071
|
}, `item:${e.id}`), t[12] = c, t[13] = a, t[14] = d, t[15] = e) : e = t[15], p = o.map(e), t[7] = c, t[8] = a, t[9] = o, t[10] = d, t[11] = p;
|
|
3077
3072
|
} else p = t[11];
|
|
3078
3073
|
let m;
|
|
3079
|
-
t[16] === o.length ? m = t[17] : (m = o.length === 0 ? /* @__PURE__ */
|
|
3074
|
+
t[16] === o.length ? m = t[17] : (m = o.length === 0 ? /* @__PURE__ */ T("div", {
|
|
3080
3075
|
className: "text-muted-foreground px-2 py-1 text-[13px] leading-4",
|
|
3081
3076
|
children: "no matches"
|
|
3082
3077
|
}) : null, t[16] = o.length, t[17] = m);
|
|
3083
3078
|
let h;
|
|
3084
|
-
t[18] !== p || t[19] !== m ? (h = /* @__PURE__ */
|
|
3079
|
+
t[18] !== p || t[19] !== m ? (h = /* @__PURE__ */ E("div", {
|
|
3085
3080
|
className: "flex max-h-72 flex-col gap-1 overflow-y-auto p-1",
|
|
3086
3081
|
role: "listbox",
|
|
3087
3082
|
"aria-label": "Suggestions",
|
|
3088
3083
|
children: [p, m]
|
|
3089
3084
|
}), t[18] = p, t[19] = m, t[20] = h) : h = t[20];
|
|
3090
3085
|
let g;
|
|
3091
|
-
return t[21] !== r || t[22] !== f || t[23] !== h ? (g = /* @__PURE__ */
|
|
3086
|
+
return t[21] !== r || t[22] !== f || t[23] !== h ? (g = /* @__PURE__ */ T("div", {
|
|
3092
3087
|
className: f,
|
|
3093
3088
|
...r,
|
|
3094
3089
|
children: h
|
|
3095
3090
|
}), t[21] = r, t[22] = f, t[23] = h, t[24] = g) : g = t[24], g;
|
|
3096
3091
|
}
|
|
3097
|
-
function
|
|
3092
|
+
function Nr(e) {
|
|
3098
3093
|
return e.icon;
|
|
3099
3094
|
}
|
|
3100
|
-
function
|
|
3101
|
-
let t = i(23), { selected: n, icon: r, token: a, takesArgs: o, description: s, onMouseDown: c } = e, u =
|
|
3095
|
+
function Pr(e) {
|
|
3096
|
+
let t = i(23), { selected: n, icon: r, token: a, takesArgs: o, description: s, onMouseDown: c } = e, u = x(null), d, f;
|
|
3102
3097
|
t[0] === n ? (d = t[1], f = t[2]) : (d = () => {
|
|
3103
3098
|
n && u.current?.scrollIntoView({ block: "nearest" });
|
|
3104
3099
|
}, f = [n], t[0] = n, t[1] = d, t[2] = f), _(d, f);
|
|
@@ -3109,27 +3104,27 @@ function Ir(e) {
|
|
|
3109
3104
|
e.preventDefault(), c();
|
|
3110
3105
|
}, t[5] = c, t[6] = h);
|
|
3111
3106
|
let g;
|
|
3112
|
-
t[7] === r ? g = t[8] : (g = r === null ? null : /* @__PURE__ */
|
|
3107
|
+
t[7] === r ? g = t[8] : (g = r === null ? null : /* @__PURE__ */ T("span", {
|
|
3113
3108
|
className: "flex size-4 shrink-0 items-center justify-center",
|
|
3114
3109
|
children: r
|
|
3115
3110
|
}), t[7] = r, t[8] = g);
|
|
3116
3111
|
let v;
|
|
3117
|
-
t[9] === a ? v = t[10] : (v = /* @__PURE__ */
|
|
3112
|
+
t[9] === a ? v = t[10] : (v = /* @__PURE__ */ T("span", {
|
|
3118
3113
|
className: "truncate",
|
|
3119
3114
|
children: a
|
|
3120
3115
|
}), t[9] = a, t[10] = v);
|
|
3121
|
-
let
|
|
3122
|
-
t[11] === o ?
|
|
3116
|
+
let y;
|
|
3117
|
+
t[11] === o ? y = t[12] : (y = o ? /* @__PURE__ */ T("span", {
|
|
3123
3118
|
className: "text-muted-foreground shrink-0",
|
|
3124
3119
|
children: "args"
|
|
3125
|
-
}) : null, t[11] = o, t[12] =
|
|
3126
|
-
let
|
|
3127
|
-
t[13] === s ?
|
|
3120
|
+
}) : null, t[11] = o, t[12] = y);
|
|
3121
|
+
let b;
|
|
3122
|
+
t[13] === s ? b = t[14] : (b = /* @__PURE__ */ T("span", {
|
|
3128
3123
|
className: "text-muted-foreground truncate",
|
|
3129
3124
|
children: s
|
|
3130
|
-
}), t[13] = s, t[14] =
|
|
3125
|
+
}), t[13] = s, t[14] = b);
|
|
3131
3126
|
let S;
|
|
3132
|
-
return t[15] !== n || t[16] !== m || t[17] !== h || t[18] !== g || t[19] !== v || t[20] !==
|
|
3127
|
+
return t[15] !== n || t[16] !== m || t[17] !== h || t[18] !== g || t[19] !== v || t[20] !== y || t[21] !== b ? (S = /* @__PURE__ */ E("button", {
|
|
3133
3128
|
ref: u,
|
|
3134
3129
|
type: "button",
|
|
3135
3130
|
role: "option",
|
|
@@ -3139,12 +3134,12 @@ function Ir(e) {
|
|
|
3139
3134
|
children: [
|
|
3140
3135
|
g,
|
|
3141
3136
|
v,
|
|
3142
|
-
|
|
3143
|
-
|
|
3137
|
+
y,
|
|
3138
|
+
b
|
|
3144
3139
|
]
|
|
3145
|
-
}), t[15] = n, t[16] = m, t[17] = h, t[18] = g, t[19] = v, t[20] =
|
|
3140
|
+
}), t[15] = n, t[16] = m, t[17] = h, t[18] = g, t[19] = v, t[20] = y, t[21] = b, t[22] = S) : S = t[22], S;
|
|
3146
3141
|
}
|
|
3147
|
-
var
|
|
3142
|
+
var Fr = [
|
|
3148
3143
|
{
|
|
3149
3144
|
title: "Send",
|
|
3150
3145
|
items: [
|
|
@@ -3172,22 +3167,22 @@ var Lr = [
|
|
|
3172
3167
|
]
|
|
3173
3168
|
}
|
|
3174
3169
|
];
|
|
3175
|
-
function
|
|
3170
|
+
function Ir(e) {
|
|
3176
3171
|
let t = i(13), n, r;
|
|
3177
3172
|
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
3178
|
-
let { state: a, actions: o } =
|
|
3179
|
-
if (!a.shortcutsOpen || !
|
|
3173
|
+
let { state: a, actions: o } = F("Composer.Shortcuts"), { closeShortcuts: s } = o;
|
|
3174
|
+
if (!a.shortcutsOpen || !he(a)) return null;
|
|
3180
3175
|
let c;
|
|
3181
3176
|
t[3] === n ? c = t[4] : (c = l("border-border bg-popover border-t px-3 py-3 text-xs", n), t[3] = n, t[4] = c);
|
|
3182
3177
|
let u;
|
|
3183
|
-
t[5] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */
|
|
3178
|
+
t[5] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ T("div", {
|
|
3184
3179
|
className: "text-foreground font-medium",
|
|
3185
3180
|
children: "Keyboard shortcuts"
|
|
3186
3181
|
}), t[5] = u) : u = t[5];
|
|
3187
3182
|
let d;
|
|
3188
|
-
t[6] === s ? d = t[7] : (d = /* @__PURE__ */
|
|
3183
|
+
t[6] === s ? d = t[7] : (d = /* @__PURE__ */ E("div", {
|
|
3189
3184
|
className: "mb-3 flex items-center justify-between gap-3",
|
|
3190
|
-
children: [u, /* @__PURE__ */
|
|
3185
|
+
children: [u, /* @__PURE__ */ T("button", {
|
|
3191
3186
|
type: "button",
|
|
3192
3187
|
className: "text-muted-foreground hover:bg-muted hover:text-foreground rounded-sm px-2 py-1",
|
|
3193
3188
|
onClick: s,
|
|
@@ -3195,12 +3190,12 @@ function Rr(e) {
|
|
|
3195
3190
|
})]
|
|
3196
3191
|
}), t[6] = s, t[7] = d);
|
|
3197
3192
|
let f;
|
|
3198
|
-
t[8] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */
|
|
3193
|
+
t[8] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ T("div", {
|
|
3199
3194
|
className: "grid gap-3 sm:grid-cols-3",
|
|
3200
|
-
children:
|
|
3195
|
+
children: Fr.map(Lr)
|
|
3201
3196
|
}), t[8] = f) : f = t[8];
|
|
3202
3197
|
let p;
|
|
3203
|
-
return t[9] !== r || t[10] !== c || t[11] !== d ? (p = /* @__PURE__ */
|
|
3198
|
+
return t[9] !== r || t[10] !== c || t[11] !== d ? (p = /* @__PURE__ */ E("div", {
|
|
3204
3199
|
role: "dialog",
|
|
3205
3200
|
"aria-label": "Keyboard shortcuts",
|
|
3206
3201
|
className: c,
|
|
@@ -3208,52 +3203,52 @@ function Rr(e) {
|
|
|
3208
3203
|
children: [d, f]
|
|
3209
3204
|
}), t[9] = r, t[10] = c, t[11] = d, t[12] = p) : p = t[12], p;
|
|
3210
3205
|
}
|
|
3211
|
-
function
|
|
3212
|
-
return /* @__PURE__ */
|
|
3206
|
+
function Lr(e) {
|
|
3207
|
+
return /* @__PURE__ */ E("div", {
|
|
3213
3208
|
className: "space-y-2",
|
|
3214
|
-
children: [/* @__PURE__ */
|
|
3209
|
+
children: [/* @__PURE__ */ T("div", {
|
|
3215
3210
|
className: "text-muted-foreground text-[11px]",
|
|
3216
3211
|
children: e.title
|
|
3217
|
-
}), /* @__PURE__ */
|
|
3212
|
+
}), /* @__PURE__ */ T("div", {
|
|
3218
3213
|
className: "space-y-1",
|
|
3219
|
-
children: e.items.map(
|
|
3214
|
+
children: e.items.map(Rr)
|
|
3220
3215
|
})]
|
|
3221
3216
|
}, e.title);
|
|
3222
3217
|
}
|
|
3223
|
-
function
|
|
3218
|
+
function Rr(e) {
|
|
3224
3219
|
let [t, n] = e;
|
|
3225
|
-
return /* @__PURE__ */
|
|
3220
|
+
return /* @__PURE__ */ E("div", {
|
|
3226
3221
|
className: "flex items-center justify-between gap-2",
|
|
3227
|
-
children: [/* @__PURE__ */
|
|
3222
|
+
children: [/* @__PURE__ */ T("kbd", {
|
|
3228
3223
|
className: "border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]",
|
|
3229
3224
|
children: t
|
|
3230
|
-
}), /* @__PURE__ */
|
|
3225
|
+
}), /* @__PURE__ */ T("span", {
|
|
3231
3226
|
className: "text-muted-foreground text-right",
|
|
3232
3227
|
children: n
|
|
3233
3228
|
})]
|
|
3234
3229
|
}, `${t}-${n}`);
|
|
3235
3230
|
}
|
|
3236
|
-
function
|
|
3237
|
-
let t = i(
|
|
3231
|
+
function zr(e) {
|
|
3232
|
+
let t = i(29), n, r;
|
|
3238
3233
|
t[0] === e ? (n = t[1], r = t[2]) : ({className: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
3239
|
-
let { activePopup: a, state: o
|
|
3234
|
+
let { activePopup: a, state: o } = F("Composer.Footer");
|
|
3240
3235
|
if (o.reverseSearch !== null) {
|
|
3241
3236
|
let e;
|
|
3242
3237
|
t[3] === n ? e = t[4] : (e = l("border-border text-muted-foreground flex items-center gap-2 border-t px-3 py-2 text-[11px]", n), t[3] = n, t[4] = e);
|
|
3243
3238
|
let i, a;
|
|
3244
|
-
t[5] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */
|
|
3239
|
+
t[5] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ T("kbd", {
|
|
3245
3240
|
className: "border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]",
|
|
3246
3241
|
children: "Ctrl R"
|
|
3247
|
-
}), a = /* @__PURE__ */
|
|
3242
|
+
}), a = /* @__PURE__ */ T("span", { children: "reverse-i-search:" }), t[5] = i, t[6] = a) : (i = t[5], a = t[6]);
|
|
3248
3243
|
let s = o.reverseSearch || "_", c;
|
|
3249
|
-
t[7] === s ? c = t[8] : (c = /* @__PURE__ */
|
|
3244
|
+
t[7] === s ? c = t[8] : (c = /* @__PURE__ */ T("span", {
|
|
3250
3245
|
className: "text-foreground",
|
|
3251
3246
|
children: s
|
|
3252
3247
|
}), t[7] = s, t[8] = c);
|
|
3253
3248
|
let u, d, f, p;
|
|
3254
|
-
t[9] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */
|
|
3249
|
+
t[9] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ T("span", { children: "Ctrl R previous" }), d = /* @__PURE__ */ T("span", { children: "Ctrl S next" }), f = /* @__PURE__ */ T("span", { children: "Enter accept" }), p = /* @__PURE__ */ T("span", { children: "Esc cancel" }), t[9] = u, t[10] = d, t[11] = f, t[12] = p) : (u = t[9], d = t[10], f = t[11], p = t[12]);
|
|
3255
3250
|
let m;
|
|
3256
|
-
return t[13] !== r || t[14] !== e || t[15] !== c ? (m = /* @__PURE__ */
|
|
3251
|
+
return t[13] !== r || t[14] !== e || t[15] !== c ? (m = /* @__PURE__ */ E("div", {
|
|
3257
3252
|
className: e,
|
|
3258
3253
|
...r,
|
|
3259
3254
|
children: [
|
|
@@ -3267,8 +3262,8 @@ function Vr(e) {
|
|
|
3267
3262
|
]
|
|
3268
3263
|
}), t[13] = r, t[14] = e, t[15] = c, t[16] = m) : m = t[16], m;
|
|
3269
3264
|
}
|
|
3270
|
-
let
|
|
3271
|
-
t[17] !== a || t[18] !==
|
|
3265
|
+
let s;
|
|
3266
|
+
t[17] !== a || t[18] !== o.isTaskRunning || t[19] !== o.queueSubmissions ? (s = a ? [
|
|
3272
3267
|
["Enter", "insert"],
|
|
3273
3268
|
["Tab", "insert"],
|
|
3274
3269
|
["Esc", "dismiss"]
|
|
@@ -3284,35 +3279,35 @@ function Vr(e) {
|
|
|
3284
3279
|
["Ctrl W", "word kill"],
|
|
3285
3280
|
["Alt B/F", "word move"],
|
|
3286
3281
|
["Ctrl Y", "yank"]
|
|
3287
|
-
], t[17] = a, t[18] =
|
|
3288
|
-
let
|
|
3289
|
-
t[
|
|
3282
|
+
], t[17] = a, t[18] = o.isTaskRunning, t[19] = o.queueSubmissions, t[20] = s) : s = t[20];
|
|
3283
|
+
let c = s, u;
|
|
3284
|
+
t[21] === n ? u = t[22] : (u = l("border-border text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 border-t px-3 py-2 text-[11px]", n), t[21] = n, t[22] = u);
|
|
3285
|
+
let d;
|
|
3286
|
+
t[23] === c ? d = t[24] : (d = c.map(Br), t[23] = c, t[24] = d);
|
|
3290
3287
|
let f;
|
|
3291
|
-
t[
|
|
3292
|
-
|
|
3293
|
-
return t[26] !== r || t[27] !== d || t[28] !== f ? (p = /* @__PURE__ */ C("div", {
|
|
3294
|
-
className: d,
|
|
3288
|
+
return t[25] !== r || t[26] !== u || t[27] !== d ? (f = /* @__PURE__ */ T("div", {
|
|
3289
|
+
className: u,
|
|
3295
3290
|
...r,
|
|
3296
|
-
children:
|
|
3297
|
-
}), t[
|
|
3291
|
+
children: d
|
|
3292
|
+
}), t[25] = r, t[26] = u, t[27] = d, t[28] = f) : f = t[28], f;
|
|
3298
3293
|
}
|
|
3299
|
-
function
|
|
3294
|
+
function Br(e) {
|
|
3300
3295
|
let [t, n] = e;
|
|
3301
|
-
return /* @__PURE__ */
|
|
3296
|
+
return /* @__PURE__ */ E("span", {
|
|
3302
3297
|
className: "inline-flex items-center gap-1",
|
|
3303
|
-
children: [/* @__PURE__ */
|
|
3298
|
+
children: [/* @__PURE__ */ T("kbd", {
|
|
3304
3299
|
className: "border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]",
|
|
3305
3300
|
children: t
|
|
3306
3301
|
}), n]
|
|
3307
3302
|
}, `${t}-${n}`);
|
|
3308
3303
|
}
|
|
3309
|
-
function
|
|
3304
|
+
function Vr(e) {
|
|
3310
3305
|
let t = i(19), n, r, a, o;
|
|
3311
3306
|
t[0] === e ? (n = t[1], r = t[2], a = t[3], o = t[4]) : ({accept: a, multiple: o, disabled: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = a, t[4] = o);
|
|
3312
|
-
let s = a === void 0 ? "image/*,video/*,audio/*" : a, c = o === void 0 || o, { actions: l, disabled: u } =
|
|
3307
|
+
let s = a === void 0 ? "image/*,video/*,audio/*" : a, c = o === void 0 || o, { actions: l, disabled: u } = F("Composer.AttachFiles"), d = x(null), f;
|
|
3313
3308
|
t[5] === Symbol.for("react.memo_cache_sentinel") ? (f = () => d.current?.click(), t[5] = f) : f = t[5];
|
|
3314
3309
|
let p;
|
|
3315
|
-
t[6] !== n || t[7] !== r ? (p = /* @__PURE__ */
|
|
3310
|
+
t[6] !== n || t[7] !== r ? (p = /* @__PURE__ */ T(qr, {
|
|
3316
3311
|
action: f,
|
|
3317
3312
|
disabled: n,
|
|
3318
3313
|
...r
|
|
@@ -3323,7 +3318,7 @@ function Ur(e) {
|
|
|
3323
3318
|
t.files && l.attachImageFiles(t.files), t.value = "";
|
|
3324
3319
|
}, t[9] = l, t[10] = h);
|
|
3325
3320
|
let g;
|
|
3326
|
-
t[11] !== s || t[12] !== c || t[13] !== m || t[14] !== h ? (g = /* @__PURE__ */
|
|
3321
|
+
t[11] !== s || t[12] !== c || t[13] !== m || t[14] !== h ? (g = /* @__PURE__ */ T("input", {
|
|
3327
3322
|
ref: d,
|
|
3328
3323
|
type: "file",
|
|
3329
3324
|
accept: s,
|
|
@@ -3334,82 +3329,82 @@ function Ur(e) {
|
|
|
3334
3329
|
onChange: h
|
|
3335
3330
|
}), t[11] = s, t[12] = c, t[13] = m, t[14] = h, t[15] = g) : g = t[15];
|
|
3336
3331
|
let _;
|
|
3337
|
-
return t[16] !== p || t[17] !== g ? (_ = /* @__PURE__ */ w
|
|
3332
|
+
return t[16] !== p || t[17] !== g ? (_ = /* @__PURE__ */ E(w, { children: [p, g] }), t[16] = p, t[17] = g, t[18] = _) : _ = t[18], _;
|
|
3338
3333
|
}
|
|
3339
|
-
function
|
|
3334
|
+
function Hr(e) {
|
|
3340
3335
|
let t = i(9), n, r;
|
|
3341
3336
|
t[0] === e ? (n = t[1], r = t[2]) : ({url: r, ...n} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
3342
|
-
let { actions: a } =
|
|
3337
|
+
let { actions: a } = F("Composer.AddRemoteImage"), o;
|
|
3343
3338
|
t[3] !== a || t[4] !== r ? (o = () => a.addRemoteImage(r), t[3] = a, t[4] = r, t[5] = o) : o = t[5];
|
|
3344
3339
|
let s;
|
|
3345
|
-
return t[6] !== n || t[7] !== o ? (s = /* @__PURE__ */
|
|
3340
|
+
return t[6] !== n || t[7] !== o ? (s = /* @__PURE__ */ T(qr, {
|
|
3346
3341
|
action: o,
|
|
3347
3342
|
...n
|
|
3348
3343
|
}), t[6] = n, t[7] = o, t[8] = s) : s = t[8], s;
|
|
3349
3344
|
}
|
|
3350
|
-
function
|
|
3345
|
+
function Ur(e) {
|
|
3351
3346
|
let t = i(9), n, r;
|
|
3352
3347
|
t[0] === e ? (n = t[1], r = t[2]) : ({content: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r);
|
|
3353
|
-
let { actions: a } =
|
|
3348
|
+
let { actions: a } = F("Composer.InsertPaste"), o;
|
|
3354
3349
|
t[3] !== a || t[4] !== n ? (o = () => a.insertPaste(n), t[3] = a, t[4] = n, t[5] = o) : o = t[5];
|
|
3355
3350
|
let s;
|
|
3356
|
-
return t[6] !== r || t[7] !== o ? (s = /* @__PURE__ */
|
|
3351
|
+
return t[6] !== r || t[7] !== o ? (s = /* @__PURE__ */ T(qr, {
|
|
3357
3352
|
action: o,
|
|
3358
3353
|
...r
|
|
3359
3354
|
}), t[6] = r, t[7] = o, t[8] = s) : s = t[8], s;
|
|
3360
3355
|
}
|
|
3361
|
-
function
|
|
3356
|
+
function Wr(e) {
|
|
3362
3357
|
let t = i(13), n, r, a, o;
|
|
3363
3358
|
t[0] === e ? (n = t[1], r = t[2], a = t[3], o = t[4]) : ({href: n, label: r, metadata: a, ...o} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = a, t[4] = o);
|
|
3364
|
-
let { actions: s } =
|
|
3359
|
+
let { actions: s } = F("Composer.InsertRichLink"), c;
|
|
3365
3360
|
t[5] !== s || t[6] !== n || t[7] !== r || t[8] !== a ? (c = () => s.insertRichLink(n, r, a), t[5] = s, t[6] = n, t[7] = r, t[8] = a, t[9] = c) : c = t[9];
|
|
3366
3361
|
let l;
|
|
3367
|
-
return t[10] !== o || t[11] !== c ? (l = /* @__PURE__ */
|
|
3362
|
+
return t[10] !== o || t[11] !== c ? (l = /* @__PURE__ */ T(qr, {
|
|
3368
3363
|
action: c,
|
|
3369
3364
|
...o
|
|
3370
3365
|
}), t[10] = o, t[11] = c, t[12] = l) : l = t[12], l;
|
|
3371
3366
|
}
|
|
3372
|
-
function
|
|
3373
|
-
let t = i(3), { actions: n } =
|
|
3374
|
-
return t[0] !== n.submit || t[1] !== e ? (r = /* @__PURE__ */
|
|
3367
|
+
function Gr(e) {
|
|
3368
|
+
let t = i(3), { actions: n } = F("Composer.Submit"), r;
|
|
3369
|
+
return t[0] !== n.submit || t[1] !== e ? (r = /* @__PURE__ */ T(qr, {
|
|
3375
3370
|
action: n.submit,
|
|
3376
3371
|
...e
|
|
3377
3372
|
}), t[0] = n.submit, t[1] = e, t[2] = r) : r = t[2], r;
|
|
3378
3373
|
}
|
|
3379
|
-
function
|
|
3380
|
-
let t = i(3), { actions: n } =
|
|
3381
|
-
return t[0] !== n.reset || t[1] !== e ? (r = /* @__PURE__ */
|
|
3374
|
+
function Kr(e) {
|
|
3375
|
+
let t = i(3), { actions: n } = F("Composer.Reset"), r;
|
|
3376
|
+
return t[0] !== n.reset || t[1] !== e ? (r = /* @__PURE__ */ T(qr, {
|
|
3382
3377
|
action: n.reset,
|
|
3383
3378
|
...e
|
|
3384
3379
|
}), t[0] = n.reset, t[1] = e, t[2] = r) : r = t[2], r;
|
|
3385
3380
|
}
|
|
3386
|
-
function
|
|
3381
|
+
function qr(e) {
|
|
3387
3382
|
let t = i(12), n, r, o, s;
|
|
3388
3383
|
t[0] === e ? (n = t[1], r = t[2], o = t[3], s = t[4]) : ({action: n, onClick: o, disabled: r, ...s} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = o, t[4] = s);
|
|
3389
|
-
let { disabled: c } =
|
|
3384
|
+
let { disabled: c } = F("Composer.ActionTrigger"), l = c || r, u;
|
|
3390
3385
|
t[5] !== n || t[6] !== o ? (u = (e) => {
|
|
3391
3386
|
o?.(e), e.defaultPrevented || n();
|
|
3392
3387
|
}, t[5] = n, t[6] = o, t[7] = u) : u = t[7];
|
|
3393
3388
|
let d;
|
|
3394
|
-
return t[8] !== s || t[9] !== l || t[10] !== u ? (d = /* @__PURE__ */
|
|
3389
|
+
return t[8] !== s || t[9] !== l || t[10] !== u ? (d = /* @__PURE__ */ T(a, {
|
|
3395
3390
|
...s,
|
|
3396
3391
|
disabled: l,
|
|
3397
3392
|
onClick: u
|
|
3398
3393
|
}), t[8] = s, t[9] = l, t[10] = u, t[11] = d) : d = t[11], d;
|
|
3399
3394
|
}
|
|
3400
|
-
function
|
|
3395
|
+
function Jr(e) {
|
|
3401
3396
|
if (e.metaKey) return !1;
|
|
3402
3397
|
if (e.key === "Enter") return e.altKey && !e.ctrlKey;
|
|
3403
3398
|
let t = e.key.toLowerCase();
|
|
3404
3399
|
return e.ctrlKey && !e.altKey && (t === "j" || t === "m");
|
|
3405
3400
|
}
|
|
3406
|
-
function
|
|
3401
|
+
function Yr(e) {
|
|
3407
3402
|
if (e.metaKey) return !1;
|
|
3408
3403
|
if (e.key === "Backspace") return e.ctrlKey || e.altKey;
|
|
3409
3404
|
let t = e.key.toLowerCase();
|
|
3410
3405
|
return e.ctrlKey && !e.altKey && t === "w" || e.ctrlKey && e.altKey && t === "h";
|
|
3411
3406
|
}
|
|
3412
|
-
function
|
|
3407
|
+
function Xr(e) {
|
|
3413
3408
|
if (e.metaKey || e.shiftKey) return null;
|
|
3414
3409
|
if (e.key === "ArrowLeft" && (e.altKey || e.ctrlKey)) return -1;
|
|
3415
3410
|
if (e.key === "ArrowRight" && (e.altKey || e.ctrlKey)) return 1;
|
|
@@ -3417,55 +3412,55 @@ function Qr(e) {
|
|
|
3417
3412
|
let t = e.key.toLowerCase();
|
|
3418
3413
|
return t === "b" ? -1 : t === "f" ? 1 : null;
|
|
3419
3414
|
}
|
|
3420
|
-
function
|
|
3415
|
+
function Zr(e) {
|
|
3421
3416
|
if (e.key === "ArrowUp") return -1;
|
|
3422
3417
|
if (e.key === "ArrowDown") return 1;
|
|
3423
3418
|
if (e.metaKey || e.altKey || e.shiftKey || !e.ctrlKey) return null;
|
|
3424
3419
|
let t = e.key.toLowerCase();
|
|
3425
3420
|
return t === "p" ? -1 : t === "n" ? 1 : null;
|
|
3426
3421
|
}
|
|
3427
|
-
function
|
|
3422
|
+
function Qr(e) {
|
|
3428
3423
|
let { doc: t, selection: n } = e.state;
|
|
3429
|
-
return n.empty || n.from > 1 || n.to < t.content.size - 1 ? !1 : (e.commands.setContent(
|
|
3430
|
-
}
|
|
3431
|
-
var
|
|
3432
|
-
Root:
|
|
3433
|
-
Trigger:
|
|
3434
|
-
Command:
|
|
3435
|
-
Mention:
|
|
3436
|
-
Content:
|
|
3437
|
-
Toolbar:
|
|
3438
|
-
RemoteImages:
|
|
3439
|
-
Attachments:
|
|
3440
|
-
Editor:
|
|
3441
|
-
Error:
|
|
3442
|
-
Popup:
|
|
3443
|
-
Shortcuts:
|
|
3444
|
-
Footer:
|
|
3445
|
-
AttachFiles:
|
|
3446
|
-
AddRemoteImage:
|
|
3447
|
-
InsertPaste:
|
|
3448
|
-
InsertRichLink:
|
|
3449
|
-
Dictate:
|
|
3450
|
-
CancelDictation:
|
|
3451
|
-
Submit:
|
|
3452
|
-
Reset:
|
|
3424
|
+
return n.empty || n.from > 1 || n.to < t.content.size - 1 ? !1 : (e.commands.setContent(Sn(), { emitUpdate: !0 }), e.commands.focus("start"), e.commands.setTextSelection(1), !0);
|
|
3425
|
+
}
|
|
3426
|
+
var $r = {
|
|
3427
|
+
Root: Cr,
|
|
3428
|
+
Trigger: jt,
|
|
3429
|
+
Command: Mt,
|
|
3430
|
+
Mention: Nt,
|
|
3431
|
+
Content: Dr,
|
|
3432
|
+
Toolbar: Or,
|
|
3433
|
+
RemoteImages: kr,
|
|
3434
|
+
Attachments: L,
|
|
3435
|
+
Editor: Ar,
|
|
3436
|
+
Error: jr,
|
|
3437
|
+
Popup: Mr,
|
|
3438
|
+
Shortcuts: Ir,
|
|
3439
|
+
Footer: zr,
|
|
3440
|
+
AttachFiles: Vr,
|
|
3441
|
+
AddRemoteImage: Hr,
|
|
3442
|
+
InsertPaste: Ur,
|
|
3443
|
+
InsertRichLink: Wr,
|
|
3444
|
+
Dictate: Gt,
|
|
3445
|
+
CancelDictation: Kt,
|
|
3446
|
+
Submit: Gr,
|
|
3447
|
+
Reset: Kr
|
|
3453
3448
|
};
|
|
3454
3449
|
//#endregion
|
|
3455
3450
|
//#region src/lib/ComposerTokenText.tsx
|
|
3456
|
-
function
|
|
3451
|
+
function ei(e) {
|
|
3457
3452
|
let t = i(5), { text: n, elements: r } = e, a;
|
|
3458
|
-
t[0] !== r || t[1] !== n ? (a =
|
|
3453
|
+
t[0] !== r || t[1] !== n ? (a = ni(n, r).map(ti), t[0] = r, t[1] = n, t[2] = a) : a = t[2];
|
|
3459
3454
|
let o;
|
|
3460
|
-
return t[3] === a ? o = t[4] : (o = /* @__PURE__ */
|
|
3455
|
+
return t[3] === a ? o = t[4] : (o = /* @__PURE__ */ T(w, { children: a }), t[3] = a, t[4] = o), o;
|
|
3461
3456
|
}
|
|
3462
|
-
function
|
|
3463
|
-
return e.element ? /* @__PURE__ */
|
|
3457
|
+
function ti(e) {
|
|
3458
|
+
return e.element ? /* @__PURE__ */ T("span", {
|
|
3464
3459
|
"data-token": e.element.kind,
|
|
3465
3460
|
children: e.text
|
|
3466
|
-
}, `${e.start}-${e.end}-${e.element.id}`) : /* @__PURE__ */
|
|
3461
|
+
}, `${e.start}-${e.end}-${e.element.id}`) : /* @__PURE__ */ T("span", { children: e.text }, `${e.start}-${e.end}`);
|
|
3467
3462
|
}
|
|
3468
|
-
function
|
|
3463
|
+
function ni(e, t) {
|
|
3469
3464
|
let n = t.toSorted((e, t) => e.range.start - t.range.start).filter((t) => t.range.start >= 0 && t.range.end <= e.length && e.slice(t.range.start, t.range.end) === t.label), r = [], i = 0;
|
|
3470
3465
|
for (let t of n) t.range.start > i && r.push({
|
|
3471
3466
|
text: e.slice(i, t.range.start),
|
|
@@ -3489,7 +3484,7 @@ function ii(e, t) {
|
|
|
3489
3484
|
}
|
|
3490
3485
|
//#endregion
|
|
3491
3486
|
//#region src/lib/persisted-prompt-selection.ts
|
|
3492
|
-
function
|
|
3487
|
+
function ri(e, t) {
|
|
3493
3488
|
if (!t || t.isCollapsed || t.rangeCount === 0) return null;
|
|
3494
3489
|
let n = t.getRangeAt(0);
|
|
3495
3490
|
if (!e.contains(n.commonAncestorContainer)) return null;
|
|
@@ -3502,51 +3497,51 @@ function ai(e, t) {
|
|
|
3502
3497
|
}
|
|
3503
3498
|
//#endregion
|
|
3504
3499
|
//#region src/lib/PersistedPromptText.tsx
|
|
3505
|
-
function
|
|
3500
|
+
function ii(e) {
|
|
3506
3501
|
let t = i(6), { text: n } = e, a, o;
|
|
3507
3502
|
if (t[0] !== n) {
|
|
3508
3503
|
let e = r(n);
|
|
3509
|
-
a =
|
|
3504
|
+
a = si, o = e.map(ai), t[0] = n, t[1] = a, t[2] = o;
|
|
3510
3505
|
} else a = t[1], o = t[2];
|
|
3511
3506
|
let s;
|
|
3512
|
-
return t[3] !== a || t[4] !== o ? (s = /* @__PURE__ */
|
|
3507
|
+
return t[3] !== a || t[4] !== o ? (s = /* @__PURE__ */ T("span", {
|
|
3513
3508
|
onCopy: a,
|
|
3514
3509
|
children: o
|
|
3515
3510
|
}), t[3] = a, t[4] = o, t[5] = s) : s = t[5], s;
|
|
3516
3511
|
}
|
|
3517
|
-
function
|
|
3512
|
+
function ai(e) {
|
|
3518
3513
|
switch (e.kind) {
|
|
3519
3514
|
case "text": return e.value;
|
|
3520
|
-
case "inline-code": return /* @__PURE__ */
|
|
3515
|
+
case "inline-code": return /* @__PURE__ */ T("code", {
|
|
3521
3516
|
"data-persisted-source": e.source,
|
|
3522
3517
|
className: "bg-muted rounded px-1 py-0.5 font-mono text-[0.9em]",
|
|
3523
3518
|
children: e.value
|
|
3524
3519
|
}, e.start);
|
|
3525
|
-
case "code-block": return /* @__PURE__ */
|
|
3520
|
+
case "code-block": return /* @__PURE__ */ T("span", {
|
|
3526
3521
|
"data-persisted-source": e.source,
|
|
3527
3522
|
className: "bg-muted my-2 block overflow-x-auto rounded-md px-3 py-2",
|
|
3528
|
-
children: /* @__PURE__ */
|
|
3523
|
+
children: /* @__PURE__ */ T("code", {
|
|
3529
3524
|
className: "font-mono text-[0.9em]",
|
|
3530
3525
|
children: e.value
|
|
3531
3526
|
})
|
|
3532
3527
|
}, e.start);
|
|
3533
|
-
case "skill-link": return /* @__PURE__ */
|
|
3528
|
+
case "skill-link": return /* @__PURE__ */ T(oi, {
|
|
3534
3529
|
name: e.name,
|
|
3535
3530
|
source: e.source,
|
|
3536
3531
|
skillId: e.skillId,
|
|
3537
3532
|
title: e.href
|
|
3538
3533
|
}, e.start);
|
|
3539
|
-
case "standalone-skill": return /* @__PURE__ */
|
|
3534
|
+
case "standalone-skill": return /* @__PURE__ */ T(oi, {
|
|
3540
3535
|
name: e.name,
|
|
3541
3536
|
source: e.source
|
|
3542
3537
|
}, e.start);
|
|
3543
|
-
case "mention": return /* @__PURE__ */
|
|
3538
|
+
case "mention": return /* @__PURE__ */ T("span", {
|
|
3544
3539
|
"data-token": "mention",
|
|
3545
3540
|
"data-persisted-source": e.source,
|
|
3546
3541
|
className: "bg-foreground/10 rounded-sm px-0.5 font-medium",
|
|
3547
3542
|
children: e.label
|
|
3548
3543
|
}, e.start);
|
|
3549
|
-
case "link": return /^(?:https?:|mailto:)/.test(e.href) ? /* @__PURE__ */
|
|
3544
|
+
case "link": return /^(?:https?:|mailto:)/.test(e.href) ? /* @__PURE__ */ T("a", {
|
|
3550
3545
|
href: e.href,
|
|
3551
3546
|
"data-persisted-source": e.source,
|
|
3552
3547
|
className: "text-primary underline underline-offset-2",
|
|
@@ -3556,16 +3551,16 @@ function si(e) {
|
|
|
3556
3551
|
}, e.start) : e.source;
|
|
3557
3552
|
}
|
|
3558
3553
|
}
|
|
3559
|
-
function
|
|
3554
|
+
function oi(e) {
|
|
3560
3555
|
let t = i(9), { name: n, source: r, skillId: a, title: o } = e, s = a ? void 0 : n, c;
|
|
3561
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */
|
|
3556
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ T(ee, {
|
|
3562
3557
|
"aria-hidden": "true",
|
|
3563
3558
|
className: "size-3.5 self-center"
|
|
3564
3559
|
}), t[0] = c) : c = t[0];
|
|
3565
3560
|
let l;
|
|
3566
|
-
t[1] === n ? l = t[2] : (l = /* @__PURE__ */
|
|
3561
|
+
t[1] === n ? l = t[2] : (l = /* @__PURE__ */ T("span", { children: n }), t[1] = n, t[2] = l);
|
|
3567
3562
|
let u;
|
|
3568
|
-
return t[3] !== a || t[4] !== r || t[5] !== s || t[6] !== l || t[7] !== o ? (u = /* @__PURE__ */
|
|
3563
|
+
return t[3] !== a || t[4] !== r || t[5] !== s || t[6] !== l || t[7] !== o ? (u = /* @__PURE__ */ E("span", {
|
|
3569
3564
|
"data-skill-id": a,
|
|
3570
3565
|
"data-skill-name": s,
|
|
3571
3566
|
"data-persisted-source": r,
|
|
@@ -3574,11 +3569,11 @@ function ci(e) {
|
|
|
3574
3569
|
children: [c, l]
|
|
3575
3570
|
}), t[3] = a, t[4] = r, t[5] = s, t[6] = l, t[7] = o, t[8] = u) : u = t[8], u;
|
|
3576
3571
|
}
|
|
3577
|
-
function
|
|
3578
|
-
let t =
|
|
3572
|
+
function si(e) {
|
|
3573
|
+
let t = ri(e.currentTarget, window.getSelection());
|
|
3579
3574
|
t !== null && (e.clipboardData.setData("text/plain", t), e.preventDefault());
|
|
3580
3575
|
}
|
|
3581
3576
|
//#endregion
|
|
3582
|
-
export {
|
|
3577
|
+
export { $r as Composer, ei as ComposerTokenText, qt as DictationError, ii as PersistedPromptText, We as createComposerDraftSource, me as createComposerState, Ke as createDraftFromPersistedText, qe as createDraftFromSource, Ue as createDraftFromState, Je as createPersistedTextFromDraft, Ye as decodeComposerTextLinkHref, G as isVisibleInPhase, ge as prepareComposerPayload, Ge as pushComposerHistory, ri as reconstructPersistedPromptSelection, e as serializeMentionPromptLink, t as serializePersistedPromptLink, n as serializeSkillPromptLink, r as tokenizePersistedPrompt, I as useComposer, Ut as useComposerDictation };
|
|
3583
3578
|
|
|
3584
3579
|
//# sourceMappingURL=browser.js.map
|