@mobilon-dev/chotto 0.3.72 → 0.3.74

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,56 +1,62 @@
1
- import { defineComponent as He, inject as re, computed as m, unref as l, toRefs as Ge, ref as y, watch as ue, createElementBlock as i, openBlock as o, normalizeClass as B, createCommentVNode as p, createElementVNode as r, createVNode as O, withCtx as E, createTextVNode as h, toDisplayString as c, createBlock as L, Fragment as g, withDirectives as Z, vShow as ce, vModelText as Ke, Transition as de, renderList as me, nextTick as Qe } from "vue";
2
- import { useMessageActions as We } from "../../../hooks/messages/useMessageActions.js";
1
+ import { defineComponent as He, inject as re, computed as r, unref as l, toRefs as Ge, ref as g, watch as ce, createElementBlock as i, openBlock as n, normalizeClass as G, createCommentVNode as f, createElementVNode as o, createVNode as Y, withCtx as V, createTextVNode as h, toDisplayString as d, createBlock as $, Fragment as x, withDirectives as Z, vShow as de, vModelText as Ye, Transition as me, nextTick as Ze } from "vue";
2
+ import { useMessageActions as qe } from "../../../hooks/messages/useMessageActions.js";
3
3
  import "../../../node_modules/linkifyjs/dist/linkify.js";
4
4
  import "../../../node_modules/linkify-string/dist/linkify-string.js";
5
5
  import "../../../functions/parseMarkdown.js";
6
- import { useSubtextTooltip as Xe } from "../../../hooks/messages/useSubtextTooltip.js";
7
- import Ye from "../../1_atoms/ContextMenu/ContextMenu.vue.js";
6
+ import { useSubtextTooltip as ze } from "../../../hooks/messages/useSubtextTooltip.js";
7
+ import Je from "../../1_atoms/ContextMenu/ContextMenu.vue.js";
8
8
  import ve from "../../1_atoms/Tooltip/Tooltip.vue.js";
9
- import et from "./icons/IncomingCallIcon.vue.js";
10
- import tt from "./icons/OutgoingCallIcon.vue.js";
11
- const at = ["messageId"], st = ["src"], lt = {
9
+ import Ke from "./icons/IncomingCallIcon.vue.js";
10
+ import Qe from "./icons/OutgoingCallIcon.vue.js";
11
+ const Xe = ["messageId"], We = ["src"], et = {
12
12
  key: 1,
13
13
  class: "call-message__subtext"
14
- }, nt = { class: "call-message__content" }, ot = { class: "call-message__header-container" }, it = { class: "call-message__title-wrapper" }, rt = {
14
+ }, tt = { class: "call-message__content" }, at = { class: "call-message__header-container" }, st = { class: "call-message__title-wrapper" }, lt = {
15
15
  key: 0,
16
16
  class: "call-message__title"
17
- }, ut = {
17
+ }, nt = {
18
18
  key: 1,
19
19
  class: "call-message__title call-message__title--missed"
20
- }, ct = {
20
+ }, ot = {
21
21
  key: 0,
22
22
  class: "call-message__title"
23
- }, dt = {
23
+ }, ut = {
24
24
  key: 1,
25
25
  class: "call-message__title call-message__title--missed"
26
- }, mt = {
26
+ }, it = {
27
27
  key: 0,
28
28
  class: "call-message__missed-info"
29
- }, vt = {
29
+ }, rt = {
30
30
  key: 1,
31
31
  class: "call-message__audio-wrapper"
32
- }, pt = ["src"], ft = { class: "call-message__audio-progress" }, gt = { class: "call-message__audio-progress-bar" }, _t = ["max"], yt = { class: "call-message__audio-time" }, ht = { class: "call-message__info-container" }, Ct = { class: "call-message__actions" }, xt = { class: "call-message__time" }, bt = {
32
+ }, ct = ["src"], dt = { class: "call-message__audio-progress" }, mt = { class: "call-message__audio-progress-bar" }, vt = ["max"], pt = { class: "call-message__audio-time" }, _t = { class: "call-message__info-container" }, ft = { class: "call-message__actions" }, gt = { class: "call-message__time" }, yt = {
33
33
  key: 0,
34
34
  class: "call-message__expand-panel"
35
- }, kt = { class: "call-message__expand-inner" }, wt = {
35
+ }, Ct = { class: "call-message__expand-inner" }, ht = {
36
36
  key: 0,
37
37
  class: "call-message__expand-placeholder"
38
- }, Tt = {
39
- key: 0,
40
- class: "call-message__expand-plain"
41
- }, Mt = {
38
+ }, xt = ["innerHTML"], bt = {
42
39
  key: 1,
43
40
  class: "call-message__expand-plain"
44
- }, St = {
41
+ }, wt = {
45
42
  key: 0,
46
43
  class: "call-message__expand-placeholder"
47
- }, Ft = { class: "call-message__expand-close-wrap" }, pe = "Распознаем звонок, пожалуйста подождите...", Ut = /* @__PURE__ */ He({
44
+ }, kt = ["innerHTML"], Tt = { class: "call-message__expand-close-wrap" }, Mt = "RECOGNITION_READY", Nt = "SUMMARY_READY", $t = /* @__PURE__ */ He({
48
45
  __name: "CallMessage",
49
46
  props: {
50
47
  message: {
51
48
  type: Object,
52
49
  required: !0
53
50
  },
51
+ /**
52
+ * Позволяет переопределить действие кнопки "Перезвонить" снаружи (например, из feed).
53
+ * Если не задано, компонент эмитит событие `call`.
54
+ */
55
+ onCall: {
56
+ type: Function,
57
+ required: !1,
58
+ default: void 0
59
+ },
54
60
  applyStyle: {
55
61
  type: Function,
56
62
  default: () => null
@@ -61,100 +67,79 @@ const at = ["messageId"], st = ["src"], lt = {
61
67
  default: () => ({})
62
68
  }
63
69
  },
64
- emits: ["action", "reply"],
65
- setup(fe, { emit: ge }) {
66
- function q(e) {
67
- if (e == null) return null;
68
- if (typeof e == "object") return e;
69
- if (typeof e != "string") return null;
70
- const t = e.trim();
71
- if (!t) return null;
72
- try {
73
- return JSON.parse(t);
74
- } catch {
75
- return null;
76
- }
77
- }
78
- function _e(e) {
79
- if (!Number.isFinite(e) || e < 0) return "0:00";
80
- const t = Math.floor(e), a = Math.floor(t / 60), u = t % 60;
81
- return `${a}:${u.toString().padStart(2, "0")}`;
82
- }
83
- function ye(e) {
84
- return e === "2" ? "right" : "left";
85
- }
86
- function z(e) {
87
- const t = e.transcript;
88
- return t && typeof t == "object" && "replies" in t ? t : typeof t == "string" && t.trim() ? q(t) : null;
89
- }
90
- function he(e) {
91
- return e != null && e.length ? e.map((t) => {
92
- const a = typeof t.timecode == "number" ? t.timecode : Number(t.timecode);
93
- return {
94
- time: _e(a),
95
- text: t.text ?? "",
96
- position: ye(String(t.user ?? ""))
97
- };
98
- }) : [];
99
- }
100
- function Ce(e) {
101
- var a;
102
- if (e == null) return null;
103
- const t = String(e).trim();
104
- if (!t) return null;
105
- if (t.startsWith("{")) {
106
- const u = q(t);
107
- return ((a = u == null ? void 0 : u.summary) == null ? void 0 : a.trim()) || null;
108
- }
109
- return t;
110
- }
111
- function xe(e) {
112
- const t = e.callSummary;
113
- return t == null ? null : typeof t == "object" && t !== null && "summary" in t ? String(t.summary ?? "").trim() || null : typeof t == "string" ? Ce(t) : null;
114
- }
115
- const J = re("channels", void 0), H = re("selectedChat", void 0), be = m(() => {
116
- if (J)
117
- return l(J);
118
- }), ke = m(() => {
119
- if (H)
120
- return l(H);
121
- }), D = ge, T = fe, { message: s, applyStyle: we } = Ge(T), M = m(() => {
122
- const e = s.value;
70
+ emits: ["action", "reply", "call"],
71
+ setup(pe, { emit: _e }) {
72
+ const q = re("channels", void 0), z = re("selectedChat", void 0), fe = r(() => {
73
+ if (q)
74
+ return l(q);
75
+ }), ge = r(() => {
76
+ if (z)
77
+ return l(z);
78
+ }), M = _e, b = pe, { message: a, applyStyle: ye } = Ge(b), N = r(() => {
79
+ const e = a.value;
123
80
  return e.url ? e.url : typeof e.recordUrl == "string" ? e.recordUrl : void 0;
124
81
  }), {
125
- isOpenMenu: R,
126
- buttonMenuVisible: Te,
127
- showMenu: G,
128
- hideMenu: V,
129
- clickAction: Me
130
- } = We(T.message, D), _ = y(null), S = m(() => {
131
- var u;
132
- const e = s.value, t = e.transcript;
133
- if (t && typeof t == "object" && "dialog" in t && ((u = t.dialog) != null && u.length))
134
- return t.dialog;
135
- const a = z(e);
136
- return he(a == null ? void 0 : a.replies);
137
- }), K = m(() => {
138
- var u;
139
- if (S.value.length) return "";
140
- const e = s.value, t = e.transcript;
141
- if (t && typeof t == "object" && "text" in t && t.text)
142
- return t.text;
143
- const a = z(e);
144
- return (u = a == null ? void 0 : a.replies) != null && u.length ? a.replies.map((d) => d.text).filter(Boolean).join(`
145
- `) : "Текст недоступен";
146
- }), Q = m(() => S.value.length ? [] : K.value.split(/\r?\n+/g).map((e) => e.trim()).filter(Boolean)), W = m(() => {
147
- var t, a;
148
- const e = (t = s.value) == null ? void 0 : t.transcript;
149
- return e ? typeof e == "string" ? e.trim().length > 0 : !!(typeof e == "object" && ("dialog" in e && Array.isArray(e.dialog) && e.dialog.length || "text" in e && typeof e.text == "string" && e.text.trim() || "replies" in e && Array.isArray(e.replies) && ((a = e.replies) != null && a.length))) : !1;
150
- }), X = m(() => {
82
+ isOpenMenu: P,
83
+ buttonMenuVisible: Ce,
84
+ showMenu: J,
85
+ hideMenu: j,
86
+ clickAction: he
87
+ } = qe(b.message, M), p = g(null), I = r(() => {
88
+ var t;
89
+ const e = (t = a.value) == null ? void 0 : t.transcript;
90
+ return !e || typeof e != "object" ? null : e;
91
+ }), R = r(() => {
92
+ var t;
93
+ const e = (t = a.value) == null ? void 0 : t.summary;
94
+ return !e || typeof e != "object" ? null : e;
95
+ }), K = r(() => {
151
96
  var t;
152
- const e = (t = s.value) == null ? void 0 : t.callSummary;
153
- return e ? typeof e == "string" ? e.trim().length > 0 : typeof e == "object" && e !== null && "summary" in e ? String(e.summary ?? "").trim().length > 0 : !1 : !1;
154
- }), F = y({
97
+ const e = (t = I.value) == null ? void 0 : t.html;
98
+ return typeof e != "string" ? "" : e.trim();
99
+ }), Q = r(() => {
100
+ var t;
101
+ const e = (t = R.value) == null ? void 0 : t.html;
102
+ return typeof e != "string" ? "" : e.trim();
103
+ }), X = r(() => {
104
+ var e;
105
+ return ((e = I.value) == null ? void 0 : e.status) === Mt && K.value.length > 0;
106
+ }), W = r(() => {
107
+ var e;
108
+ return ((e = R.value) == null ? void 0 : e.status) === Nt && Q.value.length > 0;
109
+ }), E = g({
155
110
  text: !1,
156
111
  summary: !1
157
- }), Se = m(() => xe(s.value) ?? "Резюме недоступно"), n = y(null), b = y(void 0), v = y(!1), C = y(0), f = y(0), x = y(!1), N = y(0), P = [
112
+ }), S = r(() => {
113
+ var e, t;
114
+ return !!((e = I.value) != null && e.status) && !((t = a.value) != null && t.isMissedCall);
115
+ }), F = r(() => {
116
+ var e, t;
117
+ return !!((e = R.value) != null && e.status) && !((t = a.value) != null && t.isMissedCall);
118
+ }), xe = r(() => p.value === "text" ? S.value : p.value === "summary" ? F.value : !1), be = r(() => {
119
+ var e;
120
+ switch ((e = I.value) == null ? void 0 : e.status) {
121
+ case "RECOGNITION_PLANNED":
122
+ return "Распознаем звонок, пожалуйста подождите...";
123
+ case "RECOGNITION_ERROR":
124
+ return "Не удалось распознать звонок";
125
+ case "RECOGNITION_NOT_CONFIGURED":
126
+ return "Опция распознавания не включена";
127
+ default:
128
+ return "Текст звонка недоступен";
129
+ }
130
+ }), we = r(() => {
131
+ var e;
132
+ switch ((e = R.value) == null ? void 0 : e.status) {
133
+ case "SUMMARY_PLANNED":
134
+ return "Формируем резюме, пожалуйста подождите...";
135
+ case "SUMMARY_ERROR":
136
+ return "Не удалось сформировать резюме";
137
+ case "SUMMARY_NOT_CONFIGURED":
138
+ return "Опция формирования резюме не включена";
139
+ default:
140
+ return "Резюме недоступно";
141
+ }
142
+ }), s = g(null), w = g(void 0), m = g(!1), y = g(0), v = g(0), C = g(!1), O = g(0), B = [
158
143
  {
159
144
  text: "1.0x",
160
145
  speed: 1
@@ -171,69 +156,69 @@ const at = ["messageId"], st = ["src"], lt = {
171
156
  text: "2.0x",
172
157
  speed: 2
173
158
  }
174
- ], U = m(() => P[N.value] ?? P[0]), Fe = (e) => {
159
+ ], H = r(() => B[O.value] ?? B[0]), ke = (e) => {
175
160
  if (!e) return;
176
- const a = e.trim().match(/^(\d+):([0-5]\d)$/);
177
- if (!a) return;
178
- const u = Number(a[1]), d = Number(a[2]);
179
- if (!(Number.isNaN(u) || Number.isNaN(d)))
180
- return u * 60 + d;
181
- }, Y = () => {
161
+ const u = e.trim().match(/^(\d+):([0-5]\d)$/);
162
+ if (!u) return;
163
+ const _ = Number(u[1]), c = Number(u[2]);
164
+ if (!(Number.isNaN(_) || Number.isNaN(c)))
165
+ return _ * 60 + c;
166
+ }, ee = () => {
182
167
  var e;
183
- v.value = !1, f.value = 0, C.value = Fe((e = s.value) == null ? void 0 : e.callDuration) ?? 0, x.value = !1, N.value = 0;
168
+ m.value = !1, v.value = 0, y.value = ke((e = a.value) == null ? void 0 : e.callDuration) ?? 0, C.value = !1, O.value = 0;
184
169
  };
185
- Y(), ue(
186
- M,
170
+ ee(), ce(
171
+ N,
187
172
  (e, t) => {
188
- e !== t && (Y(), b.value = void 0, n.value && (n.value.pause(), n.value.currentTime = 0, n.value.removeAttribute("src"), n.value.load()));
173
+ e !== t && (ee(), w.value = void 0, s.value && (s.value.pause(), s.value.currentTime = 0, s.value.removeAttribute("src"), s.value.load()));
189
174
  }
190
175
  );
191
- const ee = (e) => {
192
- const t = Math.floor(e / 60), a = Math.floor(e % 60);
193
- return `${t.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}`;
194
- }, Ne = m(() => ee(f.value)), Ie = m(() => ee(C.value)), te = async () => {
195
- const e = M.value;
196
- if (!(!n.value || !e))
197
- if (v.value)
198
- n.value.pause(), v.value = !1;
176
+ const te = (e) => {
177
+ const t = Math.floor(e / 60), u = Math.floor(e % 60);
178
+ return `${t.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}`;
179
+ }, Te = r(() => te(v.value)), Me = r(() => te(y.value)), ae = async () => {
180
+ const e = N.value;
181
+ if (!(!s.value || !e))
182
+ if (m.value)
183
+ s.value.pause(), m.value = !1;
199
184
  else
200
185
  try {
201
- b.value || (b.value = e, await Qe(), n.value.load()), await n.value.play(), v.value = !0;
186
+ w.value || (w.value = e, await Ze(), s.value.load()), await s.value.play(), m.value = !0;
202
187
  } catch (t) {
203
- console.error("Не удалось воспроизвести запись звонка", t), v.value = !1;
188
+ console.error("Не удалось воспроизвести запись звонка", t), m.value = !1;
204
189
  }
205
- }, Ae = () => {
206
- N.value = (N.value + 1) % P.length, n.value && (n.value.playbackRate = U.value.speed);
190
+ }, Ne = () => {
191
+ O.value = (O.value + 1) % B.length, s.value && (s.value.playbackRate = H.value.speed);
207
192
  };
208
- ue(
209
- () => f.value,
193
+ ce(
194
+ () => v.value,
210
195
  () => {
211
- n.value && x.value && (n.value.duration !== 1 / 0 && !Number.isNaN(n.value.duration) && (n.value.currentTime = f.value), Math.abs(f.value - C.value) < 0.1 && (v.value = !1));
196
+ s.value && C.value && (s.value.duration !== 1 / 0 && !Number.isNaN(s.value.duration) && (s.value.currentTime = v.value), Math.abs(v.value - y.value) < 0.1 && (m.value = !1));
212
197
  }
213
198
  );
214
- const ae = () => {
215
- n.value && x.value && n.value.duration !== 1 / 0 && !Number.isNaN(n.value.duration) && (n.value.currentTime = f.value), x.value = !1;
216
- }, $e = () => {
217
- if (!n.value) return;
218
- const e = n.value;
219
- if (C.value = 0, f.value = e.currentTime || 0, e.duration === 1 / 0 || Number.isNaN(e.duration)) {
199
+ const se = () => {
200
+ s.value && C.value && s.value.duration !== 1 / 0 && !Number.isNaN(s.value.duration) && (s.value.currentTime = v.value), C.value = !1;
201
+ }, Ie = () => {
202
+ if (!s.value) return;
203
+ const e = s.value;
204
+ if (y.value = 0, v.value = e.currentTime || 0, e.duration === 1 / 0 || Number.isNaN(e.duration)) {
220
205
  e.currentTime = 1e101;
221
206
  const t = () => {
222
- n.value && (C.value = n.value.duration || 0, f.value = 0, n.value.currentTime = 0);
207
+ s.value && (y.value = s.value.duration || 0, v.value = 0, s.value.currentTime = 0);
223
208
  };
224
209
  e.addEventListener("timeupdate", t, { once: !0 });
225
210
  } else
226
- C.value = e.duration || 0;
227
- e.playbackRate = U.value.speed;
228
- }, je = () => {
229
- n.value && (x.value || (f.value = n.value.currentTime), n.value.ended && v.value && (v.value = !1));
211
+ y.value = e.duration || 0;
212
+ e.playbackRate = H.value.speed;
213
+ }, Re = () => {
214
+ s.value && (C.value || (v.value = s.value.currentTime), s.value.ended && m.value && (m.value = !1));
230
215
  }, Ee = () => {
231
- v.value = !1;
232
- }, Le = () => {
233
- console.error("Не удалось загрузить запись звонка"), v.value = !1, b.value = void 0, n.value && (n.value.pause(), n.value.currentTime = 0, n.value.removeAttribute("src"), n.value.load());
234
- }, I = m(() => {
216
+ m.value = !1;
217
+ }, Se = () => {
218
+ console.error("Не удалось загрузить запись звонка"), m.value = !1, w.value = void 0, s.value && (s.value.pause(), s.value.currentTime = 0, s.value.removeAttribute("src"), s.value.load());
219
+ }, A = r(() => {
235
220
  var e;
236
- switch ((e = s.value) == null ? void 0 : e.direction) {
221
+ switch ((e = a.value) == null ? void 0 : e.direction) {
237
222
  case "incoming":
238
223
  return "Входящий";
239
224
  case "outgoing":
@@ -241,10 +226,10 @@ const at = ["messageId"], st = ["src"], lt = {
241
226
  default:
242
227
  return "Звонок";
243
228
  }
244
- }), se = m(() => {
245
- var t, a;
246
- const e = (t = s.value) == null ? void 0 : t.isMissedCall;
247
- switch ((a = s.value) == null ? void 0 : a.direction) {
229
+ }), le = r(() => {
230
+ var t, u;
231
+ const e = (t = a.value) == null ? void 0 : t.isMissedCall;
232
+ switch ((u = a.value) == null ? void 0 : u.direction) {
248
233
  case "incoming":
249
234
  return e ? "#F84932" : "#00AC47";
250
235
  case "outgoing":
@@ -252,52 +237,58 @@ const at = ["messageId"], st = ["src"], lt = {
252
237
  default:
253
238
  return e ? "#5F5F5F" : "#00AC47";
254
239
  }
255
- }), De = m(() => {
240
+ }), Fe = r(() => {
256
241
  var e;
257
- return ((e = s.value) == null ? void 0 : e.direction) === "outgoing" ? "Без ответа" : "Пропущенный";
258
- }), le = m(() => {
259
- var A;
260
- const e = s.value, t = be.value, a = ke.value;
261
- if (!(e != null && e.dialogId) || !t || !a)
242
+ return ((e = a.value) == null ? void 0 : e.direction) === "outgoing" ? "Без ответа" : "Пропущенный";
243
+ }), ne = r(() => {
244
+ var D;
245
+ const e = a.value, t = fe.value, u = ge.value;
246
+ if (!(e != null && e.dialogId) || !t || !u)
262
247
  return null;
263
- const u = (A = a.dialogs) == null ? void 0 : A.find((k) => k.dialogId === e.dialogId);
264
- if (!(u != null && u.channelId))
248
+ const _ = (D = u.dialogs) == null ? void 0 : D.find((k) => k.dialogId === e.dialogId);
249
+ if (!(_ != null && _.channelId))
265
250
  return null;
266
- const d = t.find((k) => k.channelId === u.channelId);
267
- return (d == null ? void 0 : d.title) || null;
268
- }), Re = Xe(() => T.message, () => T.subtextTooltipData), Ve = {
251
+ const c = t.find((k) => k.channelId === _.channelId);
252
+ return (c == null ? void 0 : c.title) || null;
253
+ }), Oe = ze(() => b.message, () => b.subtextTooltipData), Ae = {
269
254
  message: "message"
270
255
  };
271
- function Pe(e, t) {
272
- const a = e.position;
256
+ function De(e, t) {
257
+ const u = e.position;
273
258
  switch (t) {
274
259
  case "message":
275
- return a === "left" ? "call-message__left" : "call-message__right";
260
+ return u === "left" ? "call-message__left" : "call-message__right";
276
261
  default:
277
262
  return "";
278
263
  }
279
264
  }
280
- const Ue = () => {
281
- alert("Перезвонить");
282
- }, Be = () => {
283
- const e = _.value === "text" ? null : "text";
284
- _.value = e, e === "text" && !W.value && !F.value.text && (F.value.text = !0, D("action", { action: "fetchTranscript", messageId: s.value.messageId }));
285
- }, Oe = () => {
286
- const e = _.value === "summary" ? null : "summary";
287
- _.value = e, e === "summary" && !X.value && !F.value.summary && (F.value.summary = !0, D("action", { action: "fetchCallSummary", messageId: s.value.messageId }));
288
- }, Ze = async () => {
289
- var t, a, u;
290
- const e = M.value;
265
+ const Le = () => {
266
+ if (typeof b.onCall == "function") {
267
+ b.onCall(a.value);
268
+ return;
269
+ }
270
+ M("call", { message: a.value });
271
+ }, Ue = () => {
272
+ if (!S.value) return;
273
+ const e = p.value === "text" ? null : "text";
274
+ p.value = e, e === "text" && !X.value && !E.value.text && (E.value.text = !0, M("action", { action: "fetchTranscript", messageId: a.value.messageId }));
275
+ }, Ve = () => {
276
+ if (!F.value) return;
277
+ const e = p.value === "summary" ? null : "summary";
278
+ p.value = e, e === "summary" && !W.value && !E.value.summary && (E.value.summary = !0, M("action", { action: "fetchCallSummary", messageId: a.value.messageId }));
279
+ }, $e = async () => {
280
+ var t, u, _;
281
+ const e = N.value;
291
282
  if (e)
292
283
  try {
293
- const d = await fetch(e, {
284
+ const c = await fetch(e, {
294
285
  headers: {
295
286
  Accept: "audio/*"
296
287
  }
297
288
  });
298
- if (!d.ok)
299
- throw new Error(`HTTP error! status: ${d.status}`);
300
- const A = d.headers.get("content-type") || "", k = await d.blob(), $ = ((a = (t = e.split(".").pop()) == null ? void 0 : t.split("?")[0]) == null ? void 0 : a.toLowerCase()) || "", ze = {
289
+ if (!c.ok)
290
+ throw new Error(`HTTP error! status: ${c.status}`);
291
+ const D = c.headers.get("content-type") || "", k = await c.blob(), L = ((u = (t = e.split(".").pop()) == null ? void 0 : t.split("?")[0]) == null ? void 0 : u.toLowerCase()) || "", je = {
301
292
  "audio/mpeg": "mp3",
302
293
  "audio/mp3": "mp3",
303
294
  "audio/wav": "wav",
@@ -308,265 +299,261 @@ const at = ["messageId"], st = ["src"], lt = {
308
299
  "audio/flac": "flac",
309
300
  "audio/m4a": "m4a",
310
301
  "audio/x-m4a": "m4a",
311
- "application/octet-stream": $ || "mp3"
312
- }, ne = $ && ["mp3", "wav", "ogg", "webm", "aac", "flac", "m4a"].includes($) ? $ : ze[A] || "mp3", oe = e.split("/"), j = decodeURIComponent(((u = oe[oe.length - 1]) == null ? void 0 : u.split("?")[0]) || ""), Je = j ? j.includes(".") ? j : `${j}.${ne}` : `call-${s.value.messageId}.${ne}`, ie = window.URL.createObjectURL(k), w = document.createElement("a");
313
- w.href = ie, w.download = Je, document.body.appendChild(w), w.click(), document.body.removeChild(w), window.URL.revokeObjectURL(ie);
314
- } catch (d) {
315
- console.error("Ошибка при скачивании аудио звонка:", d), e && window.open(e, "_blank");
302
+ "application/octet-stream": L || "mp3"
303
+ }, oe = L && ["mp3", "wav", "ogg", "webm", "aac", "flac", "m4a"].includes(L) ? L : je[D] || "mp3", ue = e.split("/"), U = decodeURIComponent(((_ = ue[ue.length - 1]) == null ? void 0 : _.split("?")[0]) || ""), Be = U ? U.includes(".") ? U : `${U}.${oe}` : `call-${a.value.messageId}.${oe}`, ie = window.URL.createObjectURL(k), T = document.createElement("a");
304
+ T.href = ie, T.download = Be, document.body.appendChild(T), T.click(), document.body.removeChild(T), window.URL.revokeObjectURL(ie);
305
+ } catch (c) {
306
+ console.error("Ошибка при скачивании аудио звонка:", c), e && window.open(e, "_blank");
316
307
  }
317
- }, qe = (e) => {
318
- e.action === "download" ? (Ze(), V()) : Me(e);
308
+ }, Pe = (e) => {
309
+ e.action === "download" ? ($e(), j()) : he(e);
319
310
  };
320
- return (e, t) => (o(), i("div", {
321
- class: B([
322
- Pe(l(s), Ve.message),
323
- l(we)(l(s))
311
+ return (e, t) => (n(), i("div", {
312
+ class: G([
313
+ De(l(a), Ae.message),
314
+ l(ye)(l(a))
324
315
  ]),
325
- messageId: l(s).messageId,
316
+ messageId: l(a).messageId,
326
317
  onMouseenter: t[5] || (t[5] = //@ts-ignore
327
- (...a) => l(G) && l(G)(...a)),
318
+ (...u) => l(J) && l(J)(...u)),
328
319
  onMouseleave: t[6] || (t[6] = //@ts-ignore
329
- (...a) => l(V) && l(V)(...a))
320
+ (...u) => l(j) && l(j)(...u))
330
321
  }, [
331
- l(s).avatar ? (o(), i("img", {
322
+ l(a).avatar ? (n(), i("img", {
332
323
  key: 0,
333
324
  class: "call-message__avatar",
334
- src: l(s).avatar,
325
+ src: l(a).avatar,
335
326
  height: "32",
336
327
  width: "32"
337
- }, null, 8, st)) : p("", !0),
338
- l(s).subText ? (o(), i("p", lt, [
339
- O(ve, {
340
- text: l(Re),
341
- position: l(s).position === "left" ? "right" : "left",
328
+ }, null, 8, We)) : f("", !0),
329
+ l(a).subText ? (n(), i("p", et, [
330
+ Y(ve, {
331
+ text: l(Oe),
332
+ position: l(a).position === "left" ? "right" : "left",
342
333
  offset: 8
343
334
  }, {
344
- default: E(() => [
345
- h(c(l(s).subText), 1)
335
+ default: V(() => [
336
+ h(d(l(a).subText), 1)
346
337
  ]),
347
338
  _: 1
348
339
  }, 8, ["text", "position"])
349
- ])) : p("", !0),
350
- r("div", nt, [
351
- r("div", ot, [
352
- r("div", it, [
353
- l(s).direction === "incoming" || !l(s).direction ? (o(), L(et, {
340
+ ])) : f("", !0),
341
+ o("div", tt, [
342
+ o("div", at, [
343
+ o("div", st, [
344
+ l(a).direction === "incoming" || !l(a).direction ? (n(), $(Ke, {
354
345
  key: 0,
355
346
  class: "call-message__direction-icon",
356
- color: se.value
357
- }, null, 8, ["color"])) : (o(), L(tt, {
347
+ color: le.value
348
+ }, null, 8, ["color"])) : (n(), $(Qe, {
358
349
  key: 1,
359
350
  class: "call-message__direction-icon",
360
- color: se.value
351
+ color: le.value
361
352
  }, null, 8, ["color"])),
362
- le.value ? (o(), L(ve, {
353
+ ne.value ? (n(), $(ve, {
363
354
  key: 2,
364
- text: le.value,
355
+ text: ne.value,
365
356
  position: "top",
366
357
  offset: 8
367
358
  }, {
368
- default: E(() => [
369
- l(s).isMissedCall ? (o(), i("span", ut, [
370
- h(c(I.value) + " ", 1),
371
- l(s).direction !== "incoming" ? (o(), i(g, { key: 0 }, [
359
+ default: V(() => [
360
+ l(a).isMissedCall ? (n(), i("span", nt, [
361
+ h(d(A.value) + " ", 1),
362
+ l(a).direction !== "incoming" ? (n(), i(x, { key: 0 }, [
372
363
  h(" звонок ")
373
- ], 64)) : (o(), i(g, { key: 1 }, [
364
+ ], 64)) : (n(), i(x, { key: 1 }, [
374
365
  h(" звонок ")
375
366
  ], 64))
376
- ])) : (o(), i("span", rt, c(I.value) + " звонок ", 1))
367
+ ])) : (n(), i("span", lt, d(A.value) + " звонок ", 1))
377
368
  ]),
378
369
  _: 1
379
- }, 8, ["text"])) : (o(), i(g, { key: 3 }, [
380
- l(s).isMissedCall ? (o(), i("span", dt, [
381
- h(c(I.value) + " ", 1),
382
- l(s).direction !== "incoming" ? (o(), i(g, { key: 0 }, [
370
+ }, 8, ["text"])) : (n(), i(x, { key: 3 }, [
371
+ l(a).isMissedCall ? (n(), i("span", ut, [
372
+ h(d(A.value) + " ", 1),
373
+ l(a).direction !== "incoming" ? (n(), i(x, { key: 0 }, [
383
374
  h(" звонок ")
384
- ], 64)) : (o(), i(g, { key: 1 }, [
375
+ ], 64)) : (n(), i(x, { key: 1 }, [
385
376
  h(" звонок ")
386
377
  ], 64))
387
- ])) : (o(), i("span", ct, c(I.value) + " звонок ", 1))
378
+ ])) : (n(), i("span", ot, d(A.value) + " звонок ", 1))
388
379
  ], 64))
389
380
  ]),
390
- l(s).isMissedCall ? (o(), i("p", mt, c(De.value) + ": " + c(l(s).callAttemptDuration), 1)) : p("", !0),
391
- M.value && !l(s).isMissedCall ? (o(), i("div", vt, [
392
- r("audio", {
381
+ l(a).isMissedCall ? (n(), i("p", it, d(Fe.value) + ": " + d(l(a).callAttemptDuration), 1)) : f("", !0),
382
+ N.value && !l(a).isMissedCall ? (n(), i("div", rt, [
383
+ o("audio", {
393
384
  ref_key: "player",
394
- ref: n,
395
- src: b.value,
385
+ ref: s,
386
+ src: w.value,
396
387
  type: "audio/webm",
397
- onLoadedmetadata: $e,
398
- onTimeupdate: je,
388
+ onLoadedmetadata: Ie,
389
+ onTimeupdate: Re,
399
390
  onEnded: Ee,
400
- onError: Le
401
- }, null, 40, pt),
402
- Z(r("button", {
391
+ onError: Se
392
+ }, null, 40, ct),
393
+ Z(o("button", {
403
394
  class: "call-message__audio-play",
404
395
  type: "button",
405
- onClick: te
396
+ onClick: ae
406
397
  }, [...t[7] || (t[7] = [
407
- r("div", { class: "call-message__audio-play-icon" }, [
408
- r("svg", {
398
+ o("div", { class: "call-message__audio-play-icon" }, [
399
+ o("svg", {
409
400
  width: "20",
410
401
  height: "23",
411
402
  viewBox: "0 0 20 23",
412
403
  fill: "none",
413
404
  xmlns: "http://www.w3.org/2000/svg"
414
405
  }, [
415
- r("path", {
406
+ o("path", {
416
407
  d: "M18.99 12.9934L3.0825 22.2234C1.7325 23.0059 0 22.0584 0 20.4809V2.02087C0 0.44587 1.73 -0.50413 3.0825 0.28087L18.99 9.51087C19.2971 9.68618 19.5524 9.93959 19.7299 10.2454C19.9075 10.5512 20.001 10.8985 20.001 11.2521C20.001 11.6057 19.9075 11.953 19.7299 12.2589C19.5524 12.5647 19.2971 12.8181 18.99 12.9934Z",
417
408
  fill: "#5F5F5F"
418
409
  })
419
410
  ])
420
411
  ], -1)
421
412
  ])], 512), [
422
- [ce, !v.value]
413
+ [de, !m.value]
423
414
  ]),
424
- Z(r("button", {
415
+ Z(o("button", {
425
416
  class: "call-message__audio-pause",
426
417
  type: "button",
427
- onClick: te
418
+ onClick: ae
428
419
  }, [...t[8] || (t[8] = [
429
- r("div", { class: "call-message__audio-pause-icon" }, [
430
- r("svg", {
420
+ o("div", { class: "call-message__audio-pause-icon" }, [
421
+ o("svg", {
431
422
  width: "20",
432
423
  height: "23",
433
424
  viewBox: "0 0 20 23",
434
425
  fill: "none",
435
426
  xmlns: "http://www.w3.org/2000/svg"
436
427
  }, [
437
- r("path", {
428
+ o("path", {
438
429
  d: "M3.75 0C4.74456 0 5.69839 0.395088 6.40165 1.09835C7.10491 1.80161 7.5 2.75544 7.5 3.75V18.75C7.5 19.7446 7.10491 20.6984 6.40165 21.4017C5.69839 22.1049 4.74456 22.5 3.75 22.5C2.75544 22.5 1.80161 22.1049 1.09835 21.4017C0.395088 20.6984 0 19.7446 0 18.75V3.75C0 2.75544 0.395088 1.80161 1.09835 1.09835C1.80161 0.395088 2.75544 0 3.75 0ZM16.25 0C17.2446 0 18.1984 0.395088 18.9017 1.09835C19.6049 1.80161 20 2.75544 20 3.75V18.75C20 19.7446 19.6049 20.6984 18.9017 21.4017C18.1984 22.1049 17.2446 22.5 16.25 22.5C15.2554 22.5 14.3016 22.1049 13.5983 21.4017C12.8951 20.6984 12.5 19.7446 12.5 18.75V3.75C12.5 2.75544 12.8951 1.80161 13.5983 1.09835C14.3016 0.395088 15.2554 0 16.25 0Z",
439
430
  fill: "#5F5F5F"
440
431
  })
441
432
  ])
442
433
  ], -1)
443
434
  ])], 512), [
444
- [ce, v.value]
435
+ [de, m.value]
445
436
  ]),
446
- r("div", ft, [
447
- r("div", gt, [
448
- Z(r("input", {
449
- "onUpdate:modelValue": t[0] || (t[0] = (a) => f.value = a),
437
+ o("div", dt, [
438
+ o("div", mt, [
439
+ Z(o("input", {
440
+ "onUpdate:modelValue": t[0] || (t[0] = (u) => v.value = u),
450
441
  class: "call-message__audio-slider",
451
442
  type: "range",
452
443
  min: 0,
453
- max: C.value,
444
+ max: y.value,
454
445
  step: "0.1",
455
- onMousedown: t[1] || (t[1] = (a) => x.value = !0),
456
- onMouseup: ae,
457
- onTouchstartPassive: t[2] || (t[2] = (a) => x.value = !0),
458
- onTouchendPassive: ae
459
- }, null, 40, _t), [
460
- [Ke, f.value]
446
+ onMousedown: t[1] || (t[1] = (u) => C.value = !0),
447
+ onMouseup: se,
448
+ onTouchstartPassive: t[2] || (t[2] = (u) => C.value = !0),
449
+ onTouchendPassive: se
450
+ }, null, 40, vt), [
451
+ [Ye, v.value]
461
452
  ]),
462
- r("button", {
453
+ o("button", {
463
454
  type: "button",
464
455
  class: "call-message__audio-speed-btn",
465
- onClick: Ae
466
- }, c(U.value.text), 1)
456
+ onClick: Ne
457
+ }, d(H.value.text), 1)
467
458
  ]),
468
- r("div", yt, [
469
- r("span", null, c(Ne.value), 1),
470
- r("span", null, c(Ie.value), 1)
459
+ o("div", pt, [
460
+ o("span", null, d(Te.value), 1),
461
+ o("span", null, d(Me.value), 1)
471
462
  ])
472
463
  ])
473
- ])) : p("", !0)
464
+ ])) : f("", !0)
474
465
  ]),
475
- r("div", ht, [
476
- r("div", Ct, [
477
- l(s).isMissedCall ? p("", !0) : (o(), i("button", {
478
- key: 0,
479
- class: B([
480
- "call-message__call-button",
481
- { "call-message__call-button--active": _.value === "text" }
482
- ]),
483
- type: "button",
484
- onClick: Be
485
- }, " Текст ", 2)),
486
- l(s).isMissedCall ? p("", !0) : (o(), i("button", {
487
- key: 1,
488
- class: B([
489
- "call-message__call-button",
490
- { "call-message__call-button--active": _.value === "summary" }
491
- ]),
492
- type: "button",
493
- onClick: Oe
494
- }, " Резюме ", 2)),
495
- r("button", {
466
+ o("div", _t, [
467
+ o("div", ft, [
468
+ !l(a).isMissedCall && (S.value || F.value) ? (n(), i(x, { key: 0 }, [
469
+ S.value ? (n(), i("button", {
470
+ key: 0,
471
+ class: G([
472
+ "call-message__call-button",
473
+ { "call-message__call-button--active": p.value === "text" }
474
+ ]),
475
+ type: "button",
476
+ onClick: Ue
477
+ }, " Текст ", 2)) : f("", !0),
478
+ F.value ? (n(), i("button", {
479
+ key: 1,
480
+ class: G([
481
+ "call-message__call-button",
482
+ { "call-message__call-button--active": p.value === "summary" }
483
+ ]),
484
+ type: "button",
485
+ onClick: Ve
486
+ }, " Резюме ", 2)) : f("", !0)
487
+ ], 64)) : f("", !0),
488
+ o("button", {
496
489
  class: "call-message__call-button",
497
490
  type: "button",
498
- onClick: Ue
491
+ onClick: Le
499
492
  }, " Перезвонить ")
500
493
  ]),
501
- r("span", xt, c(l(s).time), 1)
494
+ o("span", gt, d(l(a).time), 1)
502
495
  ]),
503
- O(de, { name: "call-message-expand" }, {
504
- default: E(() => [
505
- _.value ? (o(), i("div", bt, [
506
- r("div", kt, [
507
- _.value === "text" ? (o(), i(g, { key: 0 }, [
508
- W.value ? p("", !0) : (o(), i("p", wt, c(pe))),
509
- (o(!0), i(g, null, me(S.value, (a, u) => (o(), i("p", {
510
- key: `tr-${u}`,
511
- class: "call-message__expand-line"
512
- }, c(a.text), 1))), 128)),
513
- S.value.length ? p("", !0) : (o(), i(g, { key: 1 }, [
514
- (o(!0), i(g, null, me(Q.value, (a, u) => (o(), i("p", {
515
- key: `tr-fallback-${u}`,
516
- class: "call-message__expand-line"
517
- }, c(a), 1))), 128)),
518
- Q.value.length ? p("", !0) : (o(), i("p", Tt, c(K.value), 1))
519
- ], 64))
520
- ], 64)) : (o(), i("p", Mt, [
521
- X.value ? (o(), i(g, { key: 1 }, [
522
- h(c(Se.value), 1)
523
- ], 64)) : (o(), i("span", St, c(pe)))
496
+ Y(me, { name: "call-message-expand" }, {
497
+ default: V(() => [
498
+ xe.value ? (n(), i("div", yt, [
499
+ o("div", Ct, [
500
+ p.value === "text" ? (n(), i(x, { key: 0 }, [
501
+ X.value ? (n(), i("p", {
502
+ key: 1,
503
+ class: "call-message__expand-plain",
504
+ innerHTML: K.value
505
+ }, null, 8, xt)) : (n(), i("p", ht, d(be.value), 1))
506
+ ], 64)) : (n(), i("p", bt, [
507
+ W.value ? (n(), i("span", {
508
+ key: 1,
509
+ innerHTML: Q.value
510
+ }, null, 8, kt)) : (n(), i("span", wt, d(we.value), 1))
524
511
  ]))
525
512
  ]),
526
- r("div", Ft, [
527
- r("button", {
513
+ o("div", Tt, [
514
+ o("button", {
528
515
  type: "button",
529
516
  class: "call-message__expand-close",
530
- onClick: t[3] || (t[3] = (a) => _.value = null)
517
+ onClick: t[3] || (t[3] = (u) => p.value = null)
531
518
  }, " Закрыть ")
532
519
  ])
533
- ])) : p("", !0)
520
+ ])) : f("", !0)
534
521
  ]),
535
522
  _: 1
536
523
  }),
537
- l(Te) && l(s).actions ? (o(), i("button", {
524
+ l(Ce) && l(a).actions ? (n(), i("button", {
538
525
  key: 0,
539
526
  class: "call-message__menu-button",
540
- onClick: t[4] || (t[4] = (a) => R.value = !l(R))
527
+ onClick: t[4] || (t[4] = (u) => P.value = !l(P))
541
528
  }, [...t[9] || (t[9] = [
542
- r("svg", {
529
+ o("svg", {
543
530
  width: "4",
544
531
  height: "17",
545
532
  viewBox: "0 0 4 17",
546
533
  fill: "none",
547
534
  xmlns: "http://www.w3.org/2000/svg"
548
535
  }, [
549
- r("path", {
536
+ o("path", {
550
537
  d: "M3.75 14.375C3.75 14.8723 3.55246 15.3492 3.20083 15.7008C2.84919 16.0525 2.37228 16.25 1.875 16.25C1.37772 16.25 0.900805 16.0525 0.549175 15.7008C0.197544 15.3492 0 14.8723 0 14.375C0 13.8777 0.197544 13.4008 0.549175 13.0492C0.900805 12.6975 1.37772 12.5 1.875 12.5C2.37228 12.5 2.84919 12.6975 3.20083 13.0492C3.55246 13.4008 3.75 13.8777 3.75 14.375ZM3.75 8.125C3.75 8.62228 3.55246 9.09919 3.20083 9.45083C2.84919 9.80246 2.37228 10 1.875 10C1.37772 10 0.900805 9.80246 0.549175 9.45083C0.197544 9.09919 0 8.62228 0 8.125C0 7.62772 0.197544 7.15081 0.549175 6.79917C0.900805 6.44754 1.37772 6.25 1.875 6.25C2.37228 6.25 2.84919 6.44754 3.20083 6.79917C3.55246 7.15081 3.75 7.62772 3.75 8.125ZM3.75 1.875C3.75 2.37228 3.55246 2.84919 3.20083 3.20083C2.84919 3.55246 2.37228 3.75 1.875 3.75C1.37772 3.75 0.900805 3.55246 0.549175 3.20083C0.197544 2.84919 0 2.37228 0 1.875C0 1.37772 0.197544 0.900806 0.549175 0.549175C0.900805 0.197544 1.37772 0 1.875 0C2.37228 0 2.84919 0.197544 3.20083 0.549175C3.55246 0.900806 3.75 1.37772 3.75 1.875Z",
551
538
  fill: "#5F5F5F"
552
539
  })
553
540
  ], -1)
554
- ])])) : p("", !0),
555
- O(de, null, {
556
- default: E(() => [
557
- l(R) && l(s).actions ? (o(), L(Ye, {
541
+ ])])) : f("", !0),
542
+ Y(me, null, {
543
+ default: V(() => [
544
+ l(P) && l(a).actions ? (n(), $(Je, {
558
545
  key: 0,
559
546
  class: "call-message__context-menu",
560
- actions: l(s).actions,
561
- onClick: qe
562
- }, null, 8, ["actions"])) : p("", !0)
547
+ actions: l(a).actions,
548
+ onClick: Pe
549
+ }, null, 8, ["actions"])) : f("", !0)
563
550
  ]),
564
551
  _: 1
565
552
  })
566
553
  ])
567
- ], 42, at));
554
+ ], 42, Xe));
568
555
  }
569
556
  });
570
557
  export {
571
- Ut as default
558
+ $t as default
572
559
  };