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