@mobilon-dev/chotto 0.3.103 → 0.3.104

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.
@@ -1,7 +1,7 @@
1
1
  import t from "./ChatInput.vue2.js";
2
2
  /* empty css */
3
3
  import o from "../../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ o(t, [["__scopeId", "data-v-9692636b"]]);
4
+ const c = /* @__PURE__ */ o(t, [["__scopeId", "data-v-e49aac6c"]]);
5
5
  export {
6
- m as default
6
+ c as default
7
7
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as Be, inject as Ne, watch as p, ref as _, computed as x, provide as je, nextTick as b, unref as a, onMounted as Ke, onUnmounted as $e, createElementBlock as C, openBlock as S, createElementVNode as u, createVNode as z, normalizeClass as O, toDisplayString as U, createCommentVNode as V, Fragment as Ge, renderList as Oe, createBlock as Ue, renderSlot as le, withDirectives as Ve, withKeys as Ye, vModelText as Xe } from "vue";
2
- import { useImmediateDebouncedRef as Je } from "../../../hooks/useImmediateDebouncedRef.js";
3
- import { MAX_ATTACHED_FILES as ie, useMessageDraft as Qe, getDraftFiles as Ze, commitChatDraftToList as et } from "../../../hooks/useMessageDraft.js";
1
+ import { defineComponent as Ne, inject as je, watch as p, ref as S, computed as _, provide as $e, nextTick as b, unref as r, onMounted as Ge, onUnmounted as Oe, createElementBlock as C, openBlock as x, createElementVNode as f, createVNode as q, normalizeClass as O, toDisplayString as U, createCommentVNode as V, Fragment as Ue, renderList as Ve, createBlock as Ye, renderSlot as le, withDirectives as Xe, withKeys as Je, vModelText as Qe } from "vue";
2
+ import { useImmediateDebouncedRef as Ze } from "../../../hooks/useImmediateDebouncedRef.js";
3
+ import { MAX_ATTACHED_FILES as ie, useMessageDraft as et, getDraftFiles as tt, commitChatDraftToList as nt } from "../../../hooks/useMessageDraft.js";
4
4
  import "../../../hooks/useSearchModel.js";
5
5
  import "../../../hooks/useTheme.js";
6
- import { useEmojiNative as tt } from "../../../hooks/useEmojiNative.js";
6
+ import { useEmojiNative as lt } from "../../../hooks/useEmojiNative.js";
7
7
  /* empty css */
8
8
  /* empty css */
9
9
  import { t as h } from "../../../locale/useLocale.js";
@@ -11,19 +11,21 @@ import { t as h } from "../../../locale/useLocale.js";
11
11
  import "../../../node_modules/linkifyjs/dist/linkify.js";
12
12
  import "../../../node_modules/linkify-string/dist/linkify-string.js";
13
13
  import "../../../functions/parseMarkdown.js";
14
- import { textToAppleEmojiHtml as nt, textContainsEmoji as lt, previousGraphemeIndex as oe, nextGraphemeIndex as se, snapIndexToGrapheme as ae } from "../../../functions/renderAppleEmojis.js";
15
- import { hideEditPreview as it } from "../../../hooks/messages/useStartEdit.js";
16
- import ot from "./icons/SendIcon.vue.js";
14
+ import { textToAppleEmojiHtml as it, textContainsEmoji as ot, previousGraphemeIndex as oe, nextGraphemeIndex as se, snapIndexToGrapheme as ae } from "../../../functions/renderAppleEmojis.js";
15
+ import { useStartEdit as st, hideEditPreview as at } from "../../../hooks/messages/useStartEdit.js";
16
+ import { canStartEditLastSent as rt, isEditableLastSentCandidate as ut } from "../../../hooks/messages/canStartEditLastSent.js";
17
+ import { buildEditPayload as ct } from "../../../hooks/messages/buildEditPayload.js";
18
+ import dt from "./icons/SendIcon.vue.js";
17
19
  import re from "./icons/ArrowIcon.vue.js";
18
- import st from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
19
- import at from "../../2_chatinput_elements/FilePreview/FilePreview.vue.js";
20
- const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = { class: "chat-input__file-counter" }, ft = { class: "chat-input__file-chips-wrap" }, pt = ["aria-label"], ht = ["aria-label"], mt = { class: "chat-input__inline-buttons" }, vt = {
20
+ import ft from "../../2_chatinput_elements/TextFormatToolbar/TextFormatToolbar.vue.js";
21
+ import pt from "../../2_chatinput_elements/FilePreview/FilePreview.vue.js";
22
+ const ht = { class: "chat-input__container" }, mt = ["id"], vt = ["id"], gt = { class: "chat-input__file-counter" }, yt = { class: "chat-input__file-chips-wrap" }, St = ["aria-label"], _t = ["aria-label"], xt = { class: "chat-input__inline-buttons" }, It = {
21
23
  key: 0,
22
24
  class: "chat-input__input chat-input__disabled-placeholder"
23
- }, gt = {
25
+ }, bt = {
24
26
  key: 1,
25
27
  class: "chat-input__input-wrap"
26
- }, yt = ["innerHTML"], _t = ["disabled", "placeholder"], xt = ["disabled"], St = { class: "" }, It = { class: "chat-input__third-line" }, Y = 40, Kt = /* @__PURE__ */ Be({
28
+ }, Ct = ["innerHTML"], Ft = ["disabled", "placeholder"], Tt = ["disabled"], Et = { class: "" }, At = { class: "chat-input__third-line" }, Y = 40, Jt = /* @__PURE__ */ Ne({
27
29
  __name: "ChatInput",
28
30
  props: {
29
31
  state: {
@@ -54,11 +56,16 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
54
56
  type: Number,
55
57
  required: !1,
56
58
  default: ie
59
+ },
60
+ resolveEditLastSentMessage: {
61
+ type: Function,
62
+ required: !1,
63
+ default: null
57
64
  }
58
65
  },
59
66
  emits: ["send", "typing"],
60
- setup(E, { emit: ue }) {
61
- const H = ue, M = Ne("chatAppId"), { resetMessage: ce, getMessage: o, setMessageText: D, setForceSendMessage: de, resetEdit: fe, removeMessageFile: pe } = Qe(M), { isNative: he, emojiSrc: me } = tt(M);
67
+ setup(M, { emit: ue }) {
68
+ const H = ue, F = je("chatAppId"), { resetMessage: ce, getMessage: o, setMessageText: D, setForceSendMessage: de, resetEdit: fe, removeMessageFile: pe } = et(F), { startEdit: he } = st(F), { isNative: me, emojiSrc: ve } = lt(F);
62
69
  let X = o().id;
63
70
  p(
64
71
  () => o().id,
@@ -66,36 +73,36 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
66
73
  X = e;
67
74
  }
68
75
  );
69
- const l = _(), F = _(), R = _(), T = _(null), k = _(!1), ve = Je("", 2e3), B = _(!1), N = _(!1);
76
+ const l = S(), T = S(), L = S(), E = S(null), R = S(!1), ge = Ze("", 2e3), z = S(!1), B = S(!1);
70
77
  let m = null;
71
- const v = x(() => Ze(o()));
72
- function W() {
73
- const e = R.value;
78
+ const v = _(() => tt(o()));
79
+ function K() {
80
+ const e = L.value;
74
81
  if (!e) {
75
- B.value = !1, N.value = !1;
82
+ z.value = !1, B.value = !1;
76
83
  return;
77
84
  }
78
85
  const t = e.scrollWidth - e.clientWidth;
79
- B.value = e.scrollLeft > 1, N.value = t - e.scrollLeft > 1;
86
+ z.value = e.scrollLeft > 1, B.value = t - e.scrollLeft > 1;
80
87
  }
81
- function ge(e) {
88
+ function ye(e) {
82
89
  const t = e.firstElementChild;
83
90
  if (!t) return e.clientWidth;
84
91
  const n = parseFloat(getComputedStyle(e).gap) || 8;
85
92
  return t.offsetWidth + n;
86
93
  }
87
94
  function J(e) {
88
- const t = R.value;
95
+ const t = L.value;
89
96
  if (!t) return;
90
- const n = ge(t);
97
+ const n = ye(t);
91
98
  t.scrollBy({ left: e === "right" ? n : -n, behavior: "smooth" });
92
99
  }
93
100
  function Q() {
94
101
  m == null || m.disconnect();
95
- const e = R.value;
96
- e && (m = new ResizeObserver(() => W()), m.observe(e));
102
+ const e = L.value;
103
+ e && (m = new ResizeObserver(() => K()), m.observe(e));
97
104
  }
98
- function ye(e) {
105
+ function Se(e) {
99
106
  return e.preview ?? {
100
107
  isImage: !1,
101
108
  isVideo: !1,
@@ -104,18 +111,18 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
104
111
  fileSize: ""
105
112
  };
106
113
  }
107
- const _e = x(
108
- () => nt(o().text || "", T.value, me.value)
109
- ), A = x(
110
- () => !he.value && lt(o().text || "")
114
+ const _e = _(
115
+ () => it(o().text || "", E.value, ve.value)
116
+ ), A = _(
117
+ () => !me.value && ot(o().text || "")
111
118
  ), g = () => {
112
- if (!F.value || !l.value) return;
113
- const e = l.value, t = F.value, n = Math.max(0, e.offsetWidth - e.clientWidth);
119
+ if (!T.value || !l.value) return;
120
+ const e = l.value, t = T.value, n = Math.max(0, e.offsetWidth - e.clientWidth);
114
121
  t.style.right = n > 0 ? `${n}px` : "", t.scrollTop = e.scrollTop;
115
122
  };
116
123
  let w = 0;
117
- function j() {
118
- T.value = null;
124
+ function N() {
125
+ E.value = null;
119
126
  }
120
127
  function xe(e = "nearest") {
121
128
  const t = l.value;
@@ -123,99 +130,120 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
123
130
  const n = t.value, i = ae(n, t.selectionStart, e), s = ae(n, t.selectionEnd, e);
124
131
  (i !== t.selectionStart || s !== t.selectionEnd) && t.setSelectionRange(i, s);
125
132
  }
126
- function K() {
133
+ function j() {
127
134
  xe("nearest"), I();
128
135
  }
129
- function Se(e) {
130
- if (!A.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight" || e.altKey || e.metaKey || e.ctrlKey) return;
136
+ function Ie(e) {
137
+ var s, u, c;
138
+ const t = o(), n = l.value;
139
+ if (!rt({
140
+ key: e.key,
141
+ altKey: e.altKey,
142
+ metaKey: e.metaKey,
143
+ ctrlKey: e.ctrlKey,
144
+ shiftKey: e.shiftKey,
145
+ hasResolver: typeof a.resolveEditLastSentMessage == "function",
146
+ disabled: a.state === "disabled",
147
+ isRecording: t.isRecording,
148
+ draftText: t.text ?? "",
149
+ replyMessageId: (s = t.reply) == null ? void 0 : s.messageId,
150
+ editMessageId: (u = t.edit) == null ? void 0 : u.messageId,
151
+ textareaText: (n == null ? void 0 : n.value) ?? t.text ?? "",
152
+ selectionStart: (n == null ? void 0 : n.selectionStart) ?? 0
153
+ })) return !1;
154
+ const i = (c = a.resolveEditLastSentMessage) == null ? void 0 : c.call(a);
155
+ return ut(i) ? (e.preventDefault(), he(ct(i)), !0) : !1;
156
+ }
157
+ function be(e) {
158
+ if (Ie(e) || !A.value || e.key !== "ArrowLeft" && e.key !== "ArrowRight" || e.altKey || e.metaKey || e.ctrlKey) return;
131
159
  const t = l.value;
132
160
  if (!t) return;
133
161
  const n = t.value, i = t.selectionStart !== t.selectionEnd;
134
162
  if (e.shiftKey) {
135
- requestAnimationFrame(() => K());
163
+ requestAnimationFrame(() => j());
136
164
  return;
137
165
  }
138
166
  if (i) {
139
167
  e.preventDefault();
140
- const f = e.key === "ArrowLeft" ? t.selectionStart : t.selectionEnd, y = e.key === "ArrowLeft" ? oe(n, f) : se(n, f);
168
+ const c = e.key === "ArrowLeft" ? t.selectionStart : t.selectionEnd, y = e.key === "ArrowLeft" ? oe(n, c) : se(n, c);
141
169
  t.setSelectionRange(y, y), I();
142
170
  return;
143
171
  }
144
172
  e.preventDefault();
145
- const s = t.selectionStart, d = e.key === "ArrowLeft" ? oe(n, s) : se(n, s);
146
- t.setSelectionRange(d, d), I();
173
+ const s = t.selectionStart, u = e.key === "ArrowLeft" ? oe(n, s) : se(n, s);
174
+ t.setSelectionRange(u, u), I();
147
175
  }
148
176
  function I() {
149
177
  if (!A.value) {
150
- j();
178
+ N();
151
179
  return;
152
180
  }
153
181
  w && cancelAnimationFrame(w), w = requestAnimationFrame(() => {
154
- var d;
182
+ var u;
155
183
  w = 0;
156
184
  const e = l.value;
157
185
  if (!e) {
158
- j();
186
+ N();
159
187
  return;
160
188
  }
161
189
  const t = e.selectionStart, n = e.selectionEnd;
162
190
  if (t === n) {
163
- T.value !== null && (T.value = null, b(g));
191
+ E.value !== null && (E.value = null, b(g));
164
192
  return;
165
193
  }
166
- const i = T.value;
194
+ const i = E.value;
167
195
  if (i && i.start === t && i.end === n) return;
168
- const s = ((d = F.value) == null ? void 0 : d.scrollTop) ?? 0;
169
- T.value = { start: t, end: n }, b(() => {
170
- F.value && (F.value.scrollTop = s), g();
196
+ const s = ((u = T.value) == null ? void 0 : u.scrollTop) ?? 0;
197
+ E.value = { start: t, end: n }, b(() => {
198
+ T.value && (T.value.scrollTop = s), g();
171
199
  });
172
200
  });
173
201
  }
174
- function Ie(e) {
202
+ function Ce(e) {
175
203
  e.buttons && I();
176
204
  }
177
205
  function Z() {
178
206
  document.activeElement === l.value && I();
179
207
  }
180
- const c = E, ee = x(() => {
181
- const e = Number(c.maxAttachedFiles);
208
+ const a = M, ee = _(() => {
209
+ const e = Number(a.maxAttachedFiles);
182
210
  return Number.isFinite(e) && e > 0 ? Math.floor(e) : ie;
183
211
  });
184
- je("maxAttachedFiles", ee);
185
- const be = x(
212
+ $e("maxAttachedFiles", ee);
213
+ const Fe = _(
186
214
  () => h("component.ChatInput.FilesSelectedCount").replace("{count}", String(v.value.length)).replace("{max}", String(ee.value))
187
- ), Ce = x(() => !!(c.state == "disabled" || o().text == "" && !v.value.length || o().isRecording)), Fe = x(() => {
215
+ ), Te = _(() => !!(a.state == "disabled" || o().text == "" && !v.value.length || o().isRecording)), Ee = _(() => {
188
216
  var t;
189
- if (c.inputButtonColor)
190
- return c.inputButtonColor;
191
- if (!((t = c.selectedChannel) != null && t.channelId))
217
+ if (a.inputButtonColor)
218
+ return a.inputButtonColor;
219
+ if (!((t = a.selectedChannel) != null && t.channelId))
192
220
  return "#25D366";
193
- const e = c.selectedChannel.channelId.toLowerCase();
221
+ const e = a.selectedChannel.channelId.toLowerCase();
194
222
  return e.includes("whatsapp") || e.includes("waba") ? "#25D366" : e.includes("telegram") ? "#37AFE2" : e.includes("sms") ? "#6C757D" : e.includes("max") ? "#4B0082" : "#25D366";
195
- }), Te = x(() => {
223
+ }), Ae = _(() => {
196
224
  var t;
197
- if (!((t = c.selectedChannel) != null && t.channelId))
225
+ if (!((t = a.selectedChannel) != null && t.channelId))
198
226
  return h("component.ChatInput.InputPlaceholder");
199
- const e = c.selectedChannel.channelId.toLowerCase();
227
+ const e = a.selectedChannel.channelId.toLowerCase();
200
228
  return e.includes("whatsapp") || e.includes("waba") ? h("component.ChatInput.WhatsappInputPlaceholder") : e.includes("telegram") ? h("component.ChatInput.TelegramInputPlaceholder") : e.includes("sms") ? h("component.ChatInput.SmsInputPlaceholder") : e.includes("max") ? h("component.ChatInput.MaxInputPlaceholder") : h("component.ChatInput.InputPlaceholder");
201
229
  });
202
230
  p(
203
- () => ve.value,
231
+ () => ge.value,
204
232
  () => {
205
233
  H("typing");
206
234
  }
207
235
  );
208
236
  function te(e = !1) {
209
237
  b(() => {
210
- if (e && !k.value) return;
238
+ if (e && !R.value) return;
211
239
  const t = l.value;
212
- t && (L(t), e && (k.value = !1), q(t), requestAnimationFrame(() => q(t)));
240
+ t && (k(t), e && (R.value = !1), P(t), requestAnimationFrame(() => P(t)));
213
241
  });
214
242
  }
215
243
  p(
216
244
  () => o().edit,
217
245
  (e) => {
218
- (e == null ? void 0 : e.messageId) != null && (k.value = !0, te(!0));
246
+ (e == null ? void 0 : e.messageId) != null && (R.value = !0, te(!0));
219
247
  }
220
248
  ), p(
221
249
  () => o().reply,
@@ -223,10 +251,10 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
223
251
  (e == null ? void 0 : e.messageId) != null && te();
224
252
  }
225
253
  ), p(
226
- () => c.focusOnInputArea,
254
+ () => a.focusOnInputArea,
227
255
  () => {
228
- c.focusOnInputArea && b(() => {
229
- const e = a(l);
256
+ a.focusOnInputArea && b(() => {
257
+ const e = r(l);
230
258
  e == null || e.focus();
231
259
  });
232
260
  },
@@ -235,16 +263,16 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
235
263
  () => o().text,
236
264
  () => {
237
265
  const e = l.value;
238
- e && (L(e), k.value && (k.value = !1, q(e), requestAnimationFrame(() => q(e))));
266
+ e && (k(e), R.value && (R.value = !1, P(e), requestAnimationFrame(() => P(e))));
239
267
  },
240
268
  { immediate: !0, flush: "post" }
241
269
  ), p(
242
270
  () => o().id,
243
271
  () => {
244
272
  const e = l.value;
245
- e && (P(e), requestAnimationFrame(() => {
273
+ e && (W(e), requestAnimationFrame(() => {
246
274
  const t = l.value;
247
- t && L(t);
275
+ t && k(t);
248
276
  }));
249
277
  }
250
278
  ), p(A, (e) => {
@@ -252,39 +280,39 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
252
280
  const t = l.value;
253
281
  if (!t) return;
254
282
  const n = t.scrollTop;
255
- L(t), t.scrollTop = n, g(), requestAnimationFrame(g);
283
+ k(t), t.scrollTop = n, g(), requestAnimationFrame(g);
256
284
  });
257
285
  });
258
- function P(e) {
286
+ function W(e) {
259
287
  const t = o().inputHeight;
260
288
  e.style.height = (t || Y) + "px", (!t || t <= Y) && (e.style.overflowY = "hidden");
261
289
  }
262
- function Ae(e) {
290
+ function we(e) {
263
291
  const t = parseFloat(e.style.height);
264
292
  Number.isFinite(t) && (o().inputHeight = t);
265
293
  }
266
- function L(e) {
294
+ function k(e) {
267
295
  const t = o().text || "";
268
296
  if (e.value !== t || e.clientWidth === 0) {
269
- P(e);
297
+ W(e);
270
298
  return;
271
299
  }
272
300
  const n = e.scrollTop;
273
301
  e.style.height = "auto";
274
- const i = getComputedStyle(e), s = parseFloat(i.fontSize) || 16, d = parseFloat(i.lineHeight) || s * 1.4, f = Y, y = d * 11, G = e.scrollHeight, He = t.split(`
275
- `).length > 1, r = document.createElement("div");
276
- r.style.position = "absolute", r.style.visibility = "hidden", r.style.whiteSpace = "nowrap", r.style.font = i.font, r.style.fontSize = i.fontSize, r.style.fontFamily = i.fontFamily, r.style.fontWeight = i.fontWeight, r.style.letterSpacing = i.letterSpacing, r.textContent = t, document.body.appendChild(r);
277
- const De = r.offsetWidth;
278
- document.body.removeChild(r);
279
- const We = parseFloat(i.paddingLeft) || 0, Pe = parseFloat(i.paddingRight) || 0, qe = e.clientWidth - We - Pe, ze = De > qe, ne = He || ze;
280
- if (ne && G <= f + 1) {
281
- P(e);
302
+ const i = getComputedStyle(e), s = parseFloat(i.fontSize) || 16, u = parseFloat(i.lineHeight) || s * 1.4, c = Y, y = u * 11, G = e.scrollHeight, Ke = t.split(`
303
+ `).length > 1, d = document.createElement("div");
304
+ d.style.position = "absolute", d.style.visibility = "hidden", d.style.whiteSpace = "nowrap", d.style.font = i.font, d.style.fontSize = i.fontSize, d.style.fontFamily = i.fontFamily, d.style.fontWeight = i.fontWeight, d.style.letterSpacing = i.letterSpacing, d.textContent = t, document.body.appendChild(d);
305
+ const We = d.offsetWidth;
306
+ document.body.removeChild(d);
307
+ const Pe = parseFloat(i.paddingLeft) || 0, qe = parseFloat(i.paddingRight) || 0, ze = e.clientWidth - Pe - qe, Be = We > ze, ne = Ke || Be;
308
+ if (ne && G <= c + 1) {
309
+ W(e);
282
310
  return;
283
311
  }
284
- t.trim() && ne ? G <= y ? (e.style.height = G + "px", e.style.overflowY = "hidden") : (e.style.height = y + "px", e.style.overflowY = "auto", e.scrollTop = n) : (e.style.height = f + "px", e.style.overflowY = "hidden"), Ae(e), g(), requestAnimationFrame(g);
312
+ t.trim() && ne ? G <= y ? (e.style.height = G + "px", e.style.overflowY = "hidden") : (e.style.height = y + "px", e.style.overflowY = "auto", e.scrollTop = n) : (e.style.height = c + "px", e.style.overflowY = "hidden"), we(e), g(), requestAnimationFrame(g);
285
313
  }
286
- function q(e) {
287
- if (c.state === "disabled" || o().isRecording) return;
314
+ function P(e) {
315
+ if (a.state === "disabled" || o().isRecording) return;
288
316
  const t = e.value.length;
289
317
  e.focus(), e.setSelectionRange(t, t), e.scrollTop = e.scrollHeight, g();
290
318
  }
@@ -294,7 +322,7 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
294
322
  o().forceSend && ($(), de(!1));
295
323
  }
296
324
  );
297
- const we = (e) => {
325
+ const Me = (e) => {
298
326
  const t = e.target;
299
327
  H("typing", t.value), I();
300
328
  };
@@ -302,19 +330,19 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
302
330
  v,
303
331
  (e, t) => {
304
332
  b(() => {
305
- Q(), W();
306
- const n = R.value;
333
+ Q(), K();
334
+ const n = L.value;
307
335
  n && e.length > ((t == null ? void 0 : t.length) ?? 0) && n.scrollTo({ left: n.scrollWidth, behavior: "smooth" });
308
336
  });
309
337
  },
310
338
  { flush: "post" }
311
- ), Ke(() => {
339
+ ), Ge(() => {
312
340
  const e = l.value;
313
- e && (P(e), L(e)), Q(), W(), document.addEventListener("selectionchange", Z);
314
- }), $e(() => {
315
- et(X), document.removeEventListener("selectionchange", Z), m == null || m.disconnect(), w && cancelAnimationFrame(w);
341
+ e && (W(e), k(e)), Q(), K(), document.addEventListener("selectionchange", Z);
342
+ }), Oe(() => {
343
+ nt(X), document.removeEventListener("selectionchange", Z), m == null || m.disconnect(), w && cancelAnimationFrame(w);
316
344
  });
317
- const Ee = (e) => {
345
+ const Le = (e) => {
318
346
  if (e.shiftKey) {
319
347
  if (l.value instanceof HTMLTextAreaElement) {
320
348
  let t = l.value.selectionStart;
@@ -331,7 +359,7 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
331
359
  e.preventDefault();
332
360
  } else
333
361
  e.preventDefault(), $();
334
- }, Me = (e) => {
362
+ }, Re = (e) => {
335
363
  if (l.value) {
336
364
  const t = l.value.value;
337
365
  l.value.value = e.newText;
@@ -341,20 +369,20 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
341
369
  });
342
370
  }
343
371
  };
344
- function Re(e) {
372
+ function ke(e) {
345
373
  pe(e);
346
374
  }
347
- function ke() {
348
- fe(), D(""), it(M), l.value && l.value.focus();
375
+ function He() {
376
+ fe(), D(""), at(F), l.value && l.value.focus();
349
377
  }
350
- function Le() {
378
+ function De() {
351
379
  const e = o();
352
380
  return e.edit ? (e.text ?? "").trim() === (e.edit.text ?? "").trim() : !1;
353
381
  }
354
382
  const $ = () => {
355
- const e = _(o());
356
- if (e.value.edit && Le() && !v.value.length) {
357
- ke();
383
+ const e = S(o());
384
+ if (e.value.edit && De() && !v.value.length) {
385
+ He();
358
386
  return;
359
387
  }
360
388
  if (e.value.text != "" || v.value.length) {
@@ -368,122 +396,122 @@ const rt = { class: "chat-input__container" }, ut = ["id"], ct = ["id"], dt = {
368
396
  }, n = v.value;
369
397
  if (n.length) {
370
398
  const i = e.value.text.trim();
371
- n.forEach((s, d) => {
399
+ n.forEach((s, u) => {
372
400
  var y;
373
- const f = {
401
+ const c = {
374
402
  type: "message." + s.type,
375
403
  url: s.url,
376
404
  filename: s.name,
377
405
  size: (y = s.size) == null ? void 0 : y.toString(),
378
- text: d === 0 ? i : ""
406
+ text: u === 0 ? i : ""
379
407
  };
380
- d === 0 && (e.value.reply && (f.reply = e.value.reply), e.value.edit && (f.edit = e.value.edit)), H("send", f);
408
+ u === 0 && (e.value.reply && (c.reply = e.value.reply), e.value.edit && (c.edit = e.value.edit)), H("send", c);
381
409
  });
382
410
  } else
383
411
  t.type = "message.text", t.text = e.value.text.trim(), e.value.reply && (t.reply = e.value.reply), e.value.edit && (t.edit = e.value.edit), H("send", t);
384
412
  ce(), l.value && l.value.focus();
385
413
  }
386
414
  };
387
- return (e, t) => (S(), C("div", rt, [
388
- u("div", {
389
- id: "chat-input-reply-line-" + a(M),
415
+ return (e, t) => (x(), C("div", ht, [
416
+ f("div", {
417
+ id: "chat-input-reply-line-" + r(F),
390
418
  class: "chat-input__reply-line"
391
- }, null, 8, ut),
392
- u("div", {
393
- id: "chat-input-file-line-" + a(M),
419
+ }, null, 8, mt),
420
+ f("div", {
421
+ id: "chat-input-file-line-" + r(F),
394
422
  class: O(["chat-input__file-line", { "chat-input__file-line--visible": v.value.length > 0 }])
395
423
  }, [
396
- u("span", dt, [
397
- u("span", null, U(a(h)("component.ChatInput.FilesSelected")), 1),
398
- u("span", null, U(be.value), 1)
424
+ f("span", gt, [
425
+ f("span", null, U(r(h)("component.ChatInput.FilesSelected")), 1),
426
+ f("span", null, U(Fe.value), 1)
399
427
  ]),
400
- u("div", ft, [
401
- B.value ? (S(), C("button", {
428
+ f("div", yt, [
429
+ z.value ? (x(), C("button", {
402
430
  key: 0,
403
431
  type: "button",
404
432
  class: "chat-input__file-scroll chat-input__file-scroll--left",
405
- "aria-label": a(h)("component.ChatInput.FilesScrollLeft"),
433
+ "aria-label": r(h)("component.ChatInput.FilesScrollLeft"),
406
434
  onClick: t[0] || (t[0] = (n) => J("left"))
407
435
  }, [
408
- z(a(re))
409
- ], 8, pt)) : V("", !0),
410
- u("div", {
436
+ q(r(re))
437
+ ], 8, St)) : V("", !0),
438
+ f("div", {
411
439
  ref_key: "refFileChips",
412
- ref: R,
440
+ ref: L,
413
441
  class: "chat-input__file-chips",
414
- onScroll: W
442
+ onScroll: K
415
443
  }, [
416
- (S(!0), C(Ge, null, Oe(v.value, (n, i) => (S(), Ue(at, {
444
+ (x(!0), C(Ue, null, Ve(v.value, (n, i) => (x(), Ye(pt, {
417
445
  key: (n.url || n.name || "") + "-" + i,
418
- "file-info": ye(n),
419
- onReset: (s) => Re(i)
446
+ "file-info": Se(n),
447
+ onReset: (s) => ke(i)
420
448
  }, null, 8, ["file-info", "onReset"]))), 128))
421
449
  ], 544),
422
- N.value ? (S(), C("button", {
450
+ B.value ? (x(), C("button", {
423
451
  key: 1,
424
452
  type: "button",
425
453
  class: "chat-input__file-scroll chat-input__file-scroll--right",
426
- "aria-label": a(h)("component.ChatInput.FilesScrollRight"),
454
+ "aria-label": r(h)("component.ChatInput.FilesScrollRight"),
427
455
  onClick: t[1] || (t[1] = (n) => J("right"))
428
456
  }, [
429
- z(a(re))
430
- ], 8, ht)) : V("", !0)
457
+ q(r(re))
458
+ ], 8, _t)) : V("", !0)
431
459
  ])
432
- ], 10, ct),
433
- u("div", mt, [
460
+ ], 10, vt),
461
+ f("div", xt, [
434
462
  le(e.$slots, "inline-buttons", {}, void 0, !0)
435
463
  ]),
436
- E.disabledPlaceholder && (E.state == "disabled" || a(o)().isRecording) ? (S(), C("div", vt, U(E.disabledPlaceholder), 1)) : (S(), C("div", gt, [
437
- A.value ? (S(), C("div", {
464
+ M.disabledPlaceholder && (M.state == "disabled" || r(o)().isRecording) ? (x(), C("div", It, U(M.disabledPlaceholder), 1)) : (x(), C("div", bt, [
465
+ A.value ? (x(), C("div", {
438
466
  key: 0,
439
467
  ref_key: "refMirror",
440
- ref: F,
468
+ ref: T,
441
469
  class: "chat-input__input-mirror",
442
470
  "aria-hidden": "true",
443
471
  innerHTML: _e.value
444
- }, null, 8, yt)) : V("", !0),
445
- Ve(u("textarea", {
472
+ }, null, 8, Ct)) : V("", !0),
473
+ Xe(f("textarea", {
446
474
  ref_key: "refInput",
447
475
  ref: l,
448
- "onUpdate:modelValue": t[2] || (t[2] = (n) => a(o)().text = n),
476
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => r(o)().text = n),
449
477
  rows: "1",
450
- disabled: E.state == "disabled" || a(o)().isRecording,
478
+ disabled: M.state == "disabled" || r(o)().isRecording,
451
479
  class: O(["chat-input__input", { "chat-input__input--emoji-images": A.value }]),
452
- placeholder: Te.value,
480
+ placeholder: Ae.value,
453
481
  onKeydown: [
454
- Se,
455
- Ye(Ee, ["enter"])
482
+ be,
483
+ Je(Le, ["enter"])
456
484
  ],
457
- onInput: we,
485
+ onInput: Me,
458
486
  onScroll: g,
459
487
  onSelect: I,
460
- onMouseup: K,
461
- onKeyup: K,
462
- onMousemove: Ie,
463
- onBlur: j
464
- }, null, 42, _t), [
465
- [Xe, a(o)().text]
488
+ onMouseup: j,
489
+ onKeyup: j,
490
+ onMousemove: Ce,
491
+ onBlur: N
492
+ }, null, 42, Ft), [
493
+ [Qe, r(o)().text]
466
494
  ])
467
495
  ])),
468
- z(st, {
496
+ q(ft, {
469
497
  textarea: l.value,
470
- onFormatApplied: Me
498
+ onFormatApplied: Re
471
499
  }, null, 8, ["textarea"]),
472
- u("button", {
473
- class: O(["chat-input__button", { "chat-input__button-disabled": Ce.value }]),
474
- disabled: a(o)().isRecording,
500
+ f("button", {
501
+ class: O(["chat-input__button", { "chat-input__button-disabled": Te.value }]),
502
+ disabled: r(o)().isRecording,
475
503
  onClick: $
476
504
  }, [
477
- u("span", St, [
478
- z(a(ot), { color: Fe.value }, null, 8, ["color"])
505
+ f("span", Et, [
506
+ q(r(dt), { color: Ee.value }, null, 8, ["color"])
479
507
  ])
480
- ], 10, xt),
481
- u("div", It, [
508
+ ], 10, Tt),
509
+ f("div", At, [
482
510
  le(e.$slots, "buttons", {}, void 0, !0)
483
511
  ])
484
512
  ]));
485
513
  }
486
514
  });
487
515
  export {
488
- Kt as default
516
+ Jt as default
489
517
  };