@_solaris/messenger-widget 0.3.4 → 0.3.6

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/messenger.js CHANGED
@@ -1,4 +1,4 @@
1
- import { reactive as Se, openBlock as l, createElementBlock as c, createVNode as K, Transition as xe, withCtx as Te, withKeys as ae, withModifiers as X, createElementVNode as i, toDisplayString as b, createCommentVNode as y, normalizeStyle as G, normalizeClass as E, Fragment as M, renderList as D, resolveComponent as B, createBlock as L, createTextVNode as te, resolveDynamicComponent as Me, renderSlot as Oe, withDirectives as q, vModelText as J, vModelCheckbox as Ie, vModelSelect as Be, createStaticVNode as ue, markRaw as me } from "vue";
1
+ import { reactive as Se, openBlock as d, createElementBlock as c, normalizeStyle as z, toDisplayString as k, resolveComponent as I, createVNode as K, Transition as xe, withCtx as Te, Fragment as M, renderList as F, createElementVNode as i, withKeys as oe, withModifiers as Y, createCommentVNode as b, normalizeClass as E, createBlock as L, createTextVNode as te, resolveDynamicComponent as Me, renderSlot as Oe, withDirectives as W, vModelText as Z, vModelCheckbox as Ie, vModelSelect as Be, createStaticVNode as ae, markRaw as fe } from "vue";
2
2
  const Ee = [
3
3
  "connected",
4
4
  "message",
@@ -6,10 +6,10 @@ const Ee = [
6
6
  "conversation_updated",
7
7
  "config_updated",
8
8
  "action_status"
9
- ], fe = "/client", $e = 5 * 60 * 1e3, Le = 10 * 60 * 1e3, Re = 5 * 60 * 1e3;
10
- function Fe(t) {
9
+ ], _e = "/client", $e = 5 * 60 * 1e3, Ne = 10 * 60 * 1e3, Le = 5 * 60 * 1e3;
10
+ function Re(t) {
11
11
  const e = {
12
- baseUrl: De(t.baseUrl || ""),
12
+ baseUrl: Fe(t.baseUrl || ""),
13
13
  widgetId: t.widgetId || "",
14
14
  userId: t.userId || "",
15
15
  userHash: t.userHash || "",
@@ -36,9 +36,9 @@ function Fe(t) {
36
36
  }
37
37
  function o(h, f) {
38
38
  const p = e.listeners.get(h);
39
- p && p.forEach((C) => {
39
+ p && p.forEach((v) => {
40
40
  try {
41
- C(f);
41
+ v(f);
42
42
  } catch (T) {
43
43
  console.error("[transport] listener", h, T);
44
44
  }
@@ -55,33 +55,33 @@ function Fe(t) {
55
55
  };
56
56
  }
57
57
  async function a(h, f, p) {
58
- const C = await fetch(`${e.baseUrl}${fe}${f}`, {
58
+ const v = await fetch(`${e.baseUrl}${_e}${f}`, {
59
59
  method: h,
60
60
  headers: { "Content-Type": "application/json", ...s() },
61
61
  body: p !== void 0 ? JSON.stringify(p) : void 0
62
62
  });
63
- if (!C.ok) {
64
- const T = await d(C), O = new Error(
65
- `HTTP ${C.status} ${h} ${f} :: ${(T == null ? void 0 : T.error) || C.statusText}`
63
+ if (!v.ok) {
64
+ const T = await l(v), O = new Error(
65
+ `HTTP ${v.status} ${h} ${f} :: ${(T == null ? void 0 : T.error) || v.statusText}`
66
66
  );
67
- throw O.status = C.status, O.body = T, O;
67
+ throw O.status = v.status, O.body = T, O;
68
68
  }
69
- return C.status === 204 ? null : C.json();
69
+ return v.status === 204 ? null : v.json();
70
70
  }
71
- async function d(h) {
71
+ async function l(h) {
72
72
  try {
73
73
  return await h.json();
74
74
  } catch {
75
75
  return null;
76
76
  }
77
77
  }
78
- async function v() {
78
+ async function g() {
79
79
  const [h, f] = await Promise.all([
80
80
  // Public — no HMAC required.
81
81
  fetch(`${e.baseUrl}/widgets/${encodeURIComponent(e.widgetId)}/config`).then(async (p) => {
82
82
  if (!p.ok) {
83
- const C = await d(p);
84
- throw new Error(`HTTP ${p.status} GET /widgets/:id/config :: ${(C == null ? void 0 : C.error) || p.statusText}`);
83
+ const v = await l(p);
84
+ throw new Error(`HTTP ${p.status} GET /widgets/:id/config :: ${(v == null ? void 0 : v.error) || p.statusText}`);
85
85
  }
86
86
  return p.json();
87
87
  }),
@@ -96,11 +96,11 @@ function Fe(t) {
96
96
  customer: (f == null ? void 0 : f.customer) ?? null
97
97
  };
98
98
  }
99
- async function k() {
99
+ async function C() {
100
100
  const h = await a("GET", "/customers/me");
101
101
  return (h == null ? void 0 : h.customer) ?? null;
102
102
  }
103
- async function w(h) {
103
+ async function y(h) {
104
104
  const f = await a("PATCH", "/customers/me", h);
105
105
  return (f == null ? void 0 : f.customer) ?? null;
106
106
  }
@@ -108,26 +108,26 @@ function Fe(t) {
108
108
  const h = await a("GET", "/conversations");
109
109
  return (h == null ? void 0 : h.conversations) ?? [];
110
110
  }
111
- async function F(h = {}) {
111
+ async function N(h = {}) {
112
112
  return (await a("POST", "/conversations", h)).conversation;
113
113
  }
114
114
  async function A(h) {
115
115
  return (await a("GET", `/conversations/${encodeURIComponent(h)}`)).conversation;
116
116
  }
117
- async function U(h, f) {
117
+ async function D(h, f) {
118
118
  return (await a("PATCH", `/conversations/${encodeURIComponent(h)}`, f)).conversation;
119
119
  }
120
120
  async function x(h, f = {}) {
121
121
  const p = new URLSearchParams();
122
122
  f.before && p.set("before", f.before), f.since && p.set("since", f.since), f.limit && p.set("limit", String(f.limit));
123
- const C = p.toString() ? `?${p.toString()}` : "";
123
+ const v = p.toString() ? `?${p.toString()}` : "";
124
124
  return a(
125
125
  "GET",
126
- `/conversations/${encodeURIComponent(h)}/messages${C}`
126
+ `/conversations/${encodeURIComponent(h)}/messages${v}`
127
127
  );
128
128
  }
129
- async function j(h, f) {
130
- V();
129
+ async function U(h, f) {
130
+ q();
131
131
  const p = {
132
132
  client_msg_id: f.client_msg_id,
133
133
  type: "content",
@@ -142,7 +142,7 @@ function Fe(t) {
142
142
  );
143
143
  }
144
144
  async function P(h, f, p) {
145
- return V(), a(
145
+ return q(), a(
146
146
  "POST",
147
147
  `/messages/${encodeURIComponent(h)}/callbacks/${encodeURIComponent(f)}`,
148
148
  p ? { inputs: p } : {}
@@ -152,11 +152,11 @@ function Fe(t) {
152
152
  const f = (
153
153
  /** @type {File} */
154
154
  h.name || "attachment"
155
- ), p = h.type || "application/octet-stream", C = h.size || 0, T = (
155
+ ), p = h.type || "application/octet-stream", v = h.size || 0, T = (
156
156
  /** @type {import('./types.js').AttachmentUploadTicket} */
157
157
  await a("POST", "/attachments", {
158
158
  mime_type: p,
159
- size_bytes: C,
159
+ size_bytes: v,
160
160
  name: f
161
161
  })
162
162
  ), O = await fetch(T.upload_url, {
@@ -167,10 +167,10 @@ function Fe(t) {
167
167
  if (!O.ok)
168
168
  throw new Error(`HTTP ${O.status} PUT signed upload`);
169
169
  return {
170
- type: Ne(p),
170
+ type: De(p),
171
171
  path: T.path,
172
172
  mime_type: p,
173
- size_bytes: C
173
+ size_bytes: v
174
174
  };
175
175
  }
176
176
  async function H(h) {
@@ -179,57 +179,57 @@ function Fe(t) {
179
179
  `/attachments/sign?path=${encodeURIComponent(h)}`
180
180
  );
181
181
  }
182
- function Y() {
182
+ function J() {
183
183
  const h = new URLSearchParams({
184
184
  userId: e.userId,
185
185
  userHash: e.userHash,
186
186
  widgetId: e.widgetId
187
187
  }).toString();
188
- return `${e.baseUrl}${fe}/stream?${h}`;
188
+ return `${e.baseUrl}${_e}/stream?${h}`;
189
189
  }
190
- function z() {
190
+ function V() {
191
191
  if (!e.eventSource && !(typeof document < "u" && document.hidden))
192
192
  try {
193
- const h = new EventSource(Y());
193
+ const h = new EventSource(J());
194
194
  for (const f of Ee)
195
- h.addEventListener(f, (p) => Z(f, p.data));
195
+ h.addEventListener(f, (p) => Q(f, p.data));
196
196
  h.addEventListener("error", () => o("error", new Error("SSE error"))), e.eventSource = h, r("open");
197
197
  } catch (h) {
198
198
  console.error("[transport] SSE open failed", h), o("error", h);
199
199
  }
200
200
  }
201
- function Z(h, f) {
201
+ function Q(h, f) {
202
202
  try {
203
- const p = JSON.parse(f), C = p && typeof p == "object" && "data" in p ? p.data : p;
204
- o(h, C);
203
+ const p = JSON.parse(f), v = p && typeof p == "object" && "data" in p ? p.data : p;
204
+ o(h, v);
205
205
  } catch (p) {
206
206
  console.error("[transport] bad SSE payload", h, p);
207
207
  }
208
208
  }
209
- function W() {
209
+ function G() {
210
210
  e.eventSource && (e.eventSource.close(), e.eventSource = null), e.connection !== "paused" && r("idle");
211
211
  }
212
- function V() {
213
- clearTimeout(e.burstTimer), z(), e.panelOpen || (e.burstTimer = setTimeout(() => {
214
- e.panelOpen || W();
215
- }, Le));
212
+ function q() {
213
+ clearTimeout(e.burstTimer), V(), e.panelOpen || (e.burstTimer = setTimeout(() => {
214
+ e.panelOpen || G();
215
+ }, Ne));
216
216
  }
217
- function Q(h) {
218
- e.panelOpen = !!h, e.panelOpen ? (clearTimeout(e.burstTimer), z()) : V();
217
+ function X(h) {
218
+ e.panelOpen = !!h, e.panelOpen ? (clearTimeout(e.burstTimer), V()) : q();
219
219
  }
220
- async function de() {
220
+ async function ce() {
221
221
  try {
222
- const h = await S(), f = h.reduce((C, T) => {
222
+ const h = await S(), f = h.reduce((v, T) => {
223
223
  const O = T == null ? void 0 : T.last_message_at;
224
- return O && (!C || O > C) ? O : C;
224
+ return O && (!v || O > v) ? O : v;
225
225
  }, null);
226
- f && (!e.lastActivityAt || f > e.lastActivityAt) && (e.lastActivityAt = f, o("activity", { conversations: h, latestAt: f }), V());
226
+ f && (!e.lastActivityAt || f > e.lastActivityAt) && (e.lastActivityAt = f, o("activity", { conversations: h, latestAt: f }), q());
227
227
  } catch (h) {
228
228
  console.error("[transport] poll failed", h);
229
229
  }
230
230
  }
231
231
  function se() {
232
- u(), !(typeof document < "u" && document.hidden) && (e.pollTimer = setInterval(de, $e));
232
+ u(), !(typeof document < "u" && document.hidden) && (e.pollTimer = setInterval(ce, $e));
233
233
  }
234
234
  function u() {
235
235
  e.pollTimer && (clearInterval(e.pollTimer), e.pollTimer = null);
@@ -237,25 +237,25 @@ function Fe(t) {
237
237
  function m() {
238
238
  if (document.hidden)
239
239
  clearTimeout(e.hiddenGraceTimer), e.hiddenGraceTimer = setTimeout(() => {
240
- e.hiddenGraceTimer = null, document.hidden && (u(), W(), r("paused"));
241
- }, Re);
240
+ e.hiddenGraceTimer = null, document.hidden && (u(), G(), r("paused"));
241
+ }, Le);
242
242
  else {
243
243
  if (e.hiddenGraceTimer) {
244
244
  clearTimeout(e.hiddenGraceTimer), e.hiddenGraceTimer = null;
245
245
  return;
246
246
  }
247
- r("idle"), se(), e.panelOpen && z();
247
+ r("idle"), se(), e.panelOpen && V();
248
248
  }
249
249
  }
250
250
  async function _() {
251
251
  if (e.started) return e.lastBootstrap;
252
252
  e.started = !0;
253
- const h = await v();
253
+ const h = await g();
254
254
  e.lastBootstrap = h;
255
255
  try {
256
256
  const f = await S();
257
- e.lastActivityAt = f.reduce((p, C) => {
258
- const T = C == null ? void 0 : C.last_message_at;
257
+ e.lastActivityAt = f.reduce((p, v) => {
258
+ const T = v == null ? void 0 : v.last_message_at;
259
259
  return T && (!p || T > p) ? T : p;
260
260
  }, null);
261
261
  } catch (f) {
@@ -263,24 +263,24 @@ function Fe(t) {
263
263
  }
264
264
  return typeof document < "u" && (e.visibilityHandler = m, document.addEventListener("visibilitychange", e.visibilityHandler)), se(), h;
265
265
  }
266
- function g() {
267
- u(), clearTimeout(e.burstTimer), clearTimeout(e.hiddenGraceTimer), e.hiddenGraceTimer = null, W(), e.visibilityHandler && (document.removeEventListener("visibilitychange", e.visibilityHandler), e.visibilityHandler = null), e.started = !1;
266
+ function w() {
267
+ u(), clearTimeout(e.burstTimer), clearTimeout(e.hiddenGraceTimer), e.hiddenGraceTimer = null, G(), e.visibilityHandler && (document.removeEventListener("visibilitychange", e.visibilityHandler), e.visibilityHandler = null), e.started = !1;
268
268
  }
269
269
  return {
270
270
  on: n,
271
271
  start: _,
272
- stop: g,
273
- setPanelOpen: Q,
272
+ stop: w,
273
+ setPanelOpen: X,
274
274
  // REST
275
- bootstrap: v,
276
- getCustomer: k,
277
- patchCustomer: w,
275
+ bootstrap: g,
276
+ getCustomer: C,
277
+ patchCustomer: y,
278
278
  listConversations: S,
279
- createConversation: F,
279
+ createConversation: N,
280
280
  getConversation: A,
281
- patchConversation: U,
281
+ patchConversation: D,
282
282
  listMessages: x,
283
- postMessage: j,
283
+ postMessage: U,
284
284
  postCallback: P,
285
285
  uploadAttachment: R,
286
286
  signAttachment: H,
@@ -290,10 +290,10 @@ function Fe(t) {
290
290
  }
291
291
  };
292
292
  }
293
- function De(t) {
293
+ function Fe(t) {
294
294
  return t.endsWith("/") ? t.slice(0, -1) : t;
295
295
  }
296
- function Ne(t) {
296
+ function De(t) {
297
297
  return t.startsWith("image/") ? "image" : t.startsWith("video/") ? "video" : t.startsWith("audio/") ? "audio" : "file";
298
298
  }
299
299
  function je() {
@@ -344,29 +344,29 @@ function Ue(t) {
344
344
  e.connection = u;
345
345
  })), n.push(t.on("message", (u) => {
346
346
  const m = u == null ? void 0 : u.conversation_id, _ = u == null ? void 0 : u.message;
347
- !m || !(_ != null && _.id) || (z(m, _), _.client_msg_id && delete e.streamingByMsgId[_.client_msg_id], V(m, _.created_at));
347
+ !m || !(_ != null && _.id) || (V(m, _), _.client_msg_id && delete e.streamingByMsgId[_.client_msg_id], q(m, _.created_at));
348
348
  })), n.push(t.on("message_stream", (u) => {
349
349
  const m = u == null ? void 0 : u.message_id, _ = u == null ? void 0 : u.token;
350
350
  !m || typeof _ != "string" || (e.streamingByMsgId[m] = (e.streamingByMsgId[m] || "") + _);
351
351
  })), n.push(t.on("conversation_updated", (u) => {
352
352
  const m = u == null ? void 0 : u.conversation_id, _ = u == null ? void 0 : u.changes;
353
353
  if (!m || !_) return;
354
- const g = e.conversations.findIndex((h) => h.id === m);
355
- g !== -1 && (e.conversations[g] = { ...e.conversations[g], ..._ });
354
+ const w = e.conversations.findIndex((h) => h.id === m);
355
+ w !== -1 && (e.conversations[w] = { ...e.conversations[w], ..._ });
356
356
  })), n.push(t.on("config_updated", (u) => {
357
357
  u != null && u.config && (e.config = u.config);
358
358
  })), n.push(t.on("action_status", (u) => {
359
- const m = u == null ? void 0 : u.conversation_id, _ = u == null ? void 0 : u.action_id, g = u == null ? void 0 : u.action_name;
359
+ const m = u == null ? void 0 : u.conversation_id, _ = u == null ? void 0 : u.action_id, w = u == null ? void 0 : u.action_name;
360
360
  if (!m || !_) return;
361
361
  const h = e.runningActionsByConv[m] || {};
362
- u.state === "running" ? (h[_] = g || _, e.runningActionsByConv[m] = { ...h }) : u.state === "done" && (delete h[_], e.runningActionsByConv[m] = { ...h });
362
+ u.state === "running" ? (h[_] = w || _, e.runningActionsByConv[m] = { ...h }) : u.state === "done" && (delete h[_], e.runningActionsByConv[m] = { ...h });
363
363
  })), n.push(t.on("activity", (u) => {
364
364
  Array.isArray(u == null ? void 0 : u.conversations) && (e.conversations = u.conversations);
365
365
  }));
366
366
  async function o() {
367
367
  try {
368
368
  const u = new Promise(
369
- (_, g) => setTimeout(() => g(new Error("bootstrap timeout (15s) — check baseUrl, CORS, and network")), 15e3)
369
+ (_, w) => setTimeout(() => w(new Error("bootstrap timeout (15s) — check baseUrl, CORS, and network")), 15e3)
370
370
  ), m = await Promise.race([t.start(), u]);
371
371
  e.config = m.config, e.customer = m.customer, e.conversations = await Promise.race([t.listConversations(), u]), e.ready = !0;
372
372
  } catch (u) {
@@ -382,7 +382,7 @@ function Ue(t) {
382
382
  t.stop();
383
383
  }
384
384
  async function s(u) {
385
- const m = de(u);
385
+ const m = ce(u);
386
386
  if (!m) return e.customer;
387
387
  try {
388
388
  const _ = await t.patchCustomer(m);
@@ -393,56 +393,66 @@ function Ue(t) {
393
393
  return e.customer;
394
394
  }
395
395
  async function a(u = {}) {
396
- const m = await t.createConversation(u), _ = e.conversations.findIndex((g) => g.id === m.id);
396
+ const m = await t.createConversation(u), _ = e.conversations.findIndex((w) => w.id === m.id);
397
397
  return _ === -1 ? e.conversations = [m, ...e.conversations] : e.conversations[_] = m, m;
398
398
  }
399
- const d = 50;
400
- async function v(u) {
401
- if (e.messagesByConv[u]) return;
402
- const m = await t.listMessages(u, { limit: d });
403
- e.messagesByConv[u] = (m == null ? void 0 : m.messages) ?? [], w(u, {
404
- nextCursor: (m == null ? void 0 : m.next_cursor) ?? null,
405
- loading: !1,
406
- loaded: !0
407
- });
399
+ const l = 50;
400
+ async function g(u) {
401
+ const m = e.paginationByConv[u];
402
+ if (!(m != null && m.loaded || m != null && m.loading)) {
403
+ y(u, { nextCursor: null, loading: !0, loaded: !1 });
404
+ try {
405
+ const _ = await t.listMessages(u, { limit: l }), w = (_ == null ? void 0 : _.messages) ?? [], h = e.messagesByConv[u] || [], f = /* @__PURE__ */ new Set();
406
+ for (const v of w)
407
+ (v == null ? void 0 : v.id) != null && f.add(`id:${String(v.id)}`), v != null && v.client_msg_id && f.add(`c:${v.client_msg_id}`);
408
+ const p = h.filter((v) => !((v == null ? void 0 : v.id) != null && f.has(`id:${String(v.id)}`) || v != null && v.client_msg_id && f.has(`c:${v.client_msg_id}`)));
409
+ e.messagesByConv[u] = [...w, ...p].sort(X), y(u, {
410
+ nextCursor: (_ == null ? void 0 : _.next_cursor) ?? null,
411
+ loading: !1,
412
+ loaded: !0
413
+ });
414
+ } catch (_) {
415
+ console.error("[store] openConversation failed", _), y(u, { nextCursor: null, loading: !1, loaded: !1 });
416
+ }
417
+ }
408
418
  }
409
- async function k(u) {
419
+ async function C(u) {
410
420
  var h;
411
421
  const m = e.paginationByConv[u];
412
422
  if (!m || m.loading || !m.nextCursor) return;
413
- const g = (h = (e.messagesByConv[u] || []).find((f) => f == null ? void 0 : f.created_at)) == null ? void 0 : h.created_at;
414
- if (g) {
415
- w(u, { ...m, loading: !0 });
423
+ const w = (h = (e.messagesByConv[u] || []).find((f) => f == null ? void 0 : f.created_at)) == null ? void 0 : h.created_at;
424
+ if (w) {
425
+ y(u, { ...m, loading: !0 });
416
426
  try {
417
427
  const f = await t.listMessages(u, {
418
- before: g,
419
- limit: d
420
- }), p = (f == null ? void 0 : f.messages) ?? [], C = e.messagesByConv[u] || [], T = /* @__PURE__ */ new Set();
421
- for (const I of C)
422
- (I == null ? void 0 : I.id) != null && T.add(`id:${String(I.id)}`), I != null && I.client_msg_id && T.add(`c:${I.client_msg_id}`);
423
- const O = p.filter((I) => !((I == null ? void 0 : I.id) != null && T.has(`id:${String(I.id)}`) || I != null && I.client_msg_id && T.has(`c:${I.client_msg_id}`)));
424
- e.messagesByConv[u] = [...O, ...C], w(u, {
428
+ before: w,
429
+ limit: l
430
+ }), p = (f == null ? void 0 : f.messages) ?? [], v = e.messagesByConv[u] || [], T = /* @__PURE__ */ new Set();
431
+ for (const B of v)
432
+ (B == null ? void 0 : B.id) != null && T.add(`id:${String(B.id)}`), B != null && B.client_msg_id && T.add(`c:${B.client_msg_id}`);
433
+ const O = p.filter((B) => !((B == null ? void 0 : B.id) != null && T.has(`id:${String(B.id)}`) || B != null && B.client_msg_id && T.has(`c:${B.client_msg_id}`)));
434
+ e.messagesByConv[u] = [...O, ...v], y(u, {
425
435
  nextCursor: (f == null ? void 0 : f.next_cursor) ?? null,
426
436
  loading: !1,
427
437
  loaded: !0
428
438
  });
429
439
  } catch (f) {
430
- console.error("[store] loadMore failed", f), w(u, { ...m, loading: !1 });
440
+ console.error("[store] loadMore failed", f), y(u, { ...m, loading: !1 });
431
441
  }
432
442
  }
433
443
  }
434
- function w(u, m) {
444
+ function y(u, m) {
435
445
  e.paginationByConv = { ...e.paginationByConv, [u]: m };
436
446
  }
437
447
  async function S(u, m) {
438
- const _ = await t.patchConversation(u, m), g = e.conversations.findIndex((h) => h.id === u);
439
- g !== -1 && (e.conversations[g] = _);
448
+ const _ = await t.patchConversation(u, m), w = e.conversations.findIndex((h) => h.id === u);
449
+ w !== -1 && (e.conversations[w] = _);
440
450
  }
441
- async function F(u, m, { attachments: _, metadata: g } = {}) {
451
+ async function N(u, m, { attachments: _, metadata: w } = {}) {
442
452
  var O;
443
453
  const h = (m || "").trim(), f = Array.isArray(_) && _.length > 0;
444
454
  if (!u || !h && !f) return;
445
- const p = je(), C = se(u), T = {
455
+ const p = je(), v = se(u), T = {
446
456
  id: p,
447
457
  client_msg_id: p,
448
458
  conversation_id: u,
@@ -452,37 +462,37 @@ function Ue(t) {
452
462
  type: "user",
453
463
  id: ((O = e.customer) == null ? void 0 : O.external_id) || null
454
464
  },
455
- created_at: C,
465
+ created_at: v,
456
466
  // Local-only flag — UI may render dimmed until the SSE echo lands.
457
467
  _pending: !0,
458
468
  ...f ? { payload: { type: "content", attachments: _ } } : {},
459
- ...g && typeof g == "object" ? { metadata: g } : {}
469
+ ...w && typeof w == "object" ? { metadata: w } : {}
460
470
  };
461
- z(u, T);
471
+ V(u, T);
462
472
  try {
463
473
  await t.postMessage(u, {
464
474
  client_msg_id: p,
465
475
  text_md: h,
466
- created_at: C,
476
+ created_at: v,
467
477
  ...f ? { attachments: _ } : {},
468
- ...g && typeof g == "object" ? { metadata: g } : {}
478
+ ...w && typeof w == "object" ? { metadata: w } : {}
469
479
  });
470
- } catch (I) {
471
- console.error("[store] send failed", I), W(u, p, { _failed: !0, _pending: !1 });
480
+ } catch (B) {
481
+ console.error("[store] send failed", B), G(u, p, { _failed: !0, _pending: !1 });
472
482
  }
473
483
  }
474
484
  async function A(u, m, _) {
475
485
  u != null && (e.awaitingCallback[u] = !0);
476
486
  try {
477
487
  await t.postCallback(u, m, _);
478
- } catch (g) {
479
- console.error("[store] callback failed", g), u != null && delete e.awaitingCallback[u];
488
+ } catch (w) {
489
+ console.error("[store] callback failed", w), u != null && delete e.awaitingCallback[u];
480
490
  }
481
491
  }
482
- const U = /* @__PURE__ */ new Map();
492
+ const D = /* @__PURE__ */ new Map();
483
493
  async function x(u) {
484
494
  if (!u) return null;
485
- const m = U.get(u);
495
+ const m = D.get(u);
486
496
  if (m != null && m.url) {
487
497
  const _ = m.expires_at ? Date.parse(m.expires_at) : 0;
488
498
  if (!_ || _ - Date.now() > 6e4) return m.url;
@@ -490,15 +500,15 @@ function Ue(t) {
490
500
  try {
491
501
  const _ = await t.signAttachment(u);
492
502
  if (_ != null && _.signed_url)
493
- return U.set(u, { url: _.signed_url, expires_at: _.expires_at }), _.signed_url;
503
+ return D.set(u, { url: _.signed_url, expires_at: _.expires_at }), _.signed_url;
494
504
  } catch (_) {
495
505
  console.error("[store] sign attachment failed", _);
496
506
  }
497
507
  return null;
498
508
  }
499
- async function j(u, { rating: m, comment: _ } = {}) {
500
- const g = e.conversations.find((p) => p.id === u), f = {
501
- ...(g == null ? void 0 : g.metadata) || {},
509
+ async function U(u, { rating: m, comment: _ } = {}) {
510
+ const w = e.conversations.find((p) => p.id === u), f = {
511
+ ...(w == null ? void 0 : w.metadata) || {},
502
512
  feedback: {
503
513
  rating: m,
504
514
  comment: _ || null,
@@ -508,24 +518,24 @@ function Ue(t) {
508
518
  await S(u, { metadata: f });
509
519
  }
510
520
  function P(u) {
511
- var _, g;
521
+ var _, w;
512
522
  const m = e.messagesByConv[u] || [];
513
523
  for (let h = m.length - 1; h >= 0; h--) {
514
524
  const f = m[h];
515
- if ((f == null ? void 0 : f.type) === "action" && ((_ = f == null ? void 0 : f.payload) == null ? void 0 : _.type) === "action" && ((g = f == null ? void 0 : f.payload) == null ? void 0 : g.state) === "pending" && Array.isArray(f == null ? void 0 : f.callbacks) && f.callbacks.length > 0 && !e.awaitingCallback[f.id])
525
+ if ((f == null ? void 0 : f.type) === "action" && ((_ = f == null ? void 0 : f.payload) == null ? void 0 : _.type) === "action" && ((w = f == null ? void 0 : f.payload) == null ? void 0 : w.state) === "pending" && Array.isArray(f == null ? void 0 : f.callbacks) && f.callbacks.length > 0 && !e.awaitingCallback[f.id])
516
526
  return f;
517
527
  }
518
528
  return null;
519
529
  }
520
530
  function R(u) {
521
- var _, g, h;
531
+ var _, w, h;
522
532
  const m = e.messagesByConv[u] || [];
523
533
  for (let f = m.length - 1; f >= 0; f--) {
524
534
  const p = m[f];
525
- if (((_ = p == null ? void 0 : p.author) == null ? void 0 : _.type) === "user" || (p == null ? void 0 : p.type) === "action" && ((g = p == null ? void 0 : p.payload) == null ? void 0 : g.state) === "pending") return null;
526
- const C = (h = p == null ? void 0 : p.metadata) == null ? void 0 : h.form;
527
- if (C && Array.isArray(C.fields) && C.fields.length > 0)
528
- return { message: p, form: C };
535
+ if (((_ = p == null ? void 0 : p.author) == null ? void 0 : _.type) === "user" || (p == null ? void 0 : p.type) === "action" && ((w = p == null ? void 0 : p.payload) == null ? void 0 : w.state) === "pending") return null;
536
+ const v = (h = p == null ? void 0 : p.metadata) == null ? void 0 : h.form;
537
+ if (v && Array.isArray(v.fields) && v.fields.length > 0)
538
+ return { message: p, form: v };
529
539
  }
530
540
  return null;
531
541
  }
@@ -534,74 +544,74 @@ function Ue(t) {
534
544
  if (!m) return null;
535
545
  const _ = Object.keys(m);
536
546
  if (_.length === 0) return null;
537
- const g = _[0];
538
- return { id: g, payload: { name: m[g] } };
547
+ const w = _[0];
548
+ return { id: w, payload: { name: m[w] } };
539
549
  }
540
- function Y(u) {
541
- var _, g, h, f;
550
+ function J(u) {
551
+ var _, w, h, f;
542
552
  const m = e.messagesByConv[u] || [];
543
553
  for (let p = m.length - 1; p >= 0; p--) {
544
- const C = m[p];
545
- if (((_ = C == null ? void 0 : C.author) == null ? void 0 : _.type) === "user") return [];
546
- if ((C == null ? void 0 : C.type) === "action" && ((g = C == null ? void 0 : C.payload) == null ? void 0 : g.state) === "pending") return [];
547
- if (((h = C == null ? void 0 : C.author) == null ? void 0 : h.type) !== "agent_ia") continue;
548
- const T = (f = C == null ? void 0 : C.metadata) == null ? void 0 : f.suggested_replies;
554
+ const v = m[p];
555
+ if (((_ = v == null ? void 0 : v.author) == null ? void 0 : _.type) === "user") return [];
556
+ if ((v == null ? void 0 : v.type) === "action" && ((w = v == null ? void 0 : v.payload) == null ? void 0 : w.state) === "pending") return [];
557
+ if (((h = v == null ? void 0 : v.author) == null ? void 0 : h.type) !== "agent_ia") continue;
558
+ const T = (f = v == null ? void 0 : v.metadata) == null ? void 0 : f.suggested_replies;
549
559
  return Array.isArray(T) && T.length ? T.map((O) => {
550
560
  if (typeof O == "string") {
551
- const I = O.trim();
552
- return I ? { label: I, kind: null } : null;
561
+ const B = O.trim();
562
+ return B ? { label: B, kind: null } : null;
553
563
  }
554
564
  if (O && typeof O == "object" && typeof O.label == "string") {
555
- const I = O.label.trim();
556
- if (!I) return null;
565
+ const B = O.label.trim();
566
+ if (!B) return null;
557
567
  const Ae = O.kind === "cta" || O.kind === "choice" || O.kind === "followup" ? O.kind : null;
558
- return { label: I, kind: Ae };
568
+ return { label: B, kind: Ae };
559
569
  }
560
570
  return null;
561
571
  }).filter(Boolean).slice(0, 4) : [];
562
572
  }
563
573
  return [];
564
574
  }
565
- function z(u, m) {
575
+ function V(u, m) {
566
576
  var f;
567
577
  const _ = e.messagesByConv[u] || [];
568
- let g = -1;
569
- m != null && m.client_msg_id && (g = _.findIndex(
578
+ let w = -1;
579
+ m != null && m.client_msg_id && (w = _.findIndex(
570
580
  (p) => (p == null ? void 0 : p.client_msg_id) && p.client_msg_id === m.client_msg_id
571
- )), g === -1 && (m == null ? void 0 : m.id) !== void 0 && (m == null ? void 0 : m.id) !== null && (g = _.findIndex((p) => Z(p == null ? void 0 : p.id, m.id)));
581
+ )), w === -1 && (m == null ? void 0 : m.id) !== void 0 && (m == null ? void 0 : m.id) !== null && (w = _.findIndex((p) => Q(p == null ? void 0 : p.id, m.id)));
572
582
  let h;
573
- g === -1 ? h = [..._, m].sort(Q) : (h = _.slice(), h[g] = { ..._[g], ...m, _pending: !1, _failed: !1 }), e.messagesByConv[u] = h, (m == null ? void 0 : m.type) === "action" && ((f = m == null ? void 0 : m.payload) != null && f.state) && m.payload.state !== "pending" && (m == null ? void 0 : m.id) != null && e.awaitingCallback[m.id] && delete e.awaitingCallback[m.id];
583
+ w === -1 ? h = [..._, m].sort(X) : (h = _.slice(), h[w] = { ..._[w], ...m, _pending: !1, _failed: !1 }), e.messagesByConv[u] = h, (m == null ? void 0 : m.type) === "action" && ((f = m == null ? void 0 : m.payload) != null && f.state) && m.payload.state !== "pending" && (m == null ? void 0 : m.id) != null && e.awaitingCallback[m.id] && delete e.awaitingCallback[m.id];
574
584
  }
575
- function Z(u, m) {
585
+ function Q(u, m) {
576
586
  return u === m ? !0 : u == null || m == null ? !1 : String(u) === String(m);
577
587
  }
578
- function W(u, m, _) {
579
- const g = e.messagesByConv[u];
580
- if (!g) return;
581
- const h = g.findIndex((p) => p.id === m);
588
+ function G(u, m, _) {
589
+ const w = e.messagesByConv[u];
590
+ if (!w) return;
591
+ const h = w.findIndex((p) => p.id === m);
582
592
  if (h === -1) return;
583
- const f = g.slice();
584
- f[h] = { ...g[h], ..._ }, e.messagesByConv[u] = f;
593
+ const f = w.slice();
594
+ f[h] = { ...w[h], ..._ }, e.messagesByConv[u] = f;
585
595
  }
586
- function V(u, m) {
596
+ function q(u, m) {
587
597
  const _ = e.conversations.findIndex((h) => h.id === u);
588
598
  if (_ === -1) return;
589
- const g = e.conversations[_];
590
- if (m && (!g.last_message_at || m > g.last_message_at)) {
599
+ const w = e.conversations[_];
600
+ if (m && (!w.last_message_at || m > w.last_message_at)) {
591
601
  const h = e.conversations.slice();
592
- h[_] = { ...g, last_message_at: m }, h.sort(
602
+ h[_] = { ...w, last_message_at: m }, h.sort(
593
603
  (f, p) => (p.last_message_at || "").localeCompare(f.last_message_at || "")
594
604
  ), e.conversations = h;
595
605
  }
596
606
  }
597
- function Q(u, m) {
607
+ function X(u, m) {
598
608
  return (u.created_at || "").localeCompare(m.created_at || "");
599
609
  }
600
- function de(u) {
610
+ function ce(u) {
601
611
  if (!u || typeof u != "object") return null;
602
612
  const m = {}, _ = {};
603
- for (const [g, h] of Object.entries(u))
604
- h !== void 0 && (g === "name" || g === "email" ? h != null && String(h).trim() !== "" && (m[g] = h) : (g === "values" || g === "metadata") && h && typeof h == "object" ? Object.assign(_, h) : _[g] = h);
613
+ for (const [w, h] of Object.entries(u))
614
+ h !== void 0 && (w === "name" || w === "email" ? h != null && String(h).trim() !== "" && (m[w] = h) : (w === "values" || w === "metadata") && h && typeof h == "object" ? Object.assign(_, h) : _[w] = h);
605
615
  return Object.keys(_).length && (m.values = _), Object.keys(m).length ? m : null;
606
616
  }
607
617
  function se(u) {
@@ -609,8 +619,8 @@ function Ue(t) {
609
619
  let _ = "";
610
620
  for (const f of m)
611
621
  f != null && f.created_at && f.created_at > _ && (_ = f.created_at);
612
- const g = (/* @__PURE__ */ new Date()).toISOString();
613
- return !_ || g > _ ? g : new Date(Date.parse(_) + 1).toISOString();
622
+ const w = (/* @__PURE__ */ new Date()).toISOString();
623
+ return !_ || w > _ ? w : new Date(Date.parse(_) + 1).toISOString();
614
624
  }
615
625
  return {
616
626
  state: e,
@@ -618,22 +628,22 @@ function Ue(t) {
618
628
  destroy: r,
619
629
  applyCustomer: s,
620
630
  createConversation: a,
621
- openConversation: v,
622
- loadMore: k,
631
+ openConversation: g,
632
+ loadMore: C,
623
633
  patchConversation: S,
624
- send: F,
634
+ send: N,
625
635
  clickCallback: A,
626
636
  signAttachment: x,
627
- submitFeedback: j,
637
+ submitFeedback: U,
628
638
  getPendingApproval: P,
629
639
  getActionInFlight: H,
630
- getLatestSuggestions: Y,
640
+ getLatestSuggestions: J,
631
641
  getLatestForm: R,
632
642
  // Pass-through for panel open/close (controls SSE burst).
633
643
  setPanelOpen: t.setPanelOpen
634
644
  };
635
645
  }
636
- const N = {
646
+ const j = {
637
647
  w: "#ffffff",
638
648
  g50: "#F9F9F7",
639
649
  g100: "#F2F1EE",
@@ -649,14 +659,14 @@ const N = {
649
659
  green: "#22C55E",
650
660
  red: "#B91C1C",
651
661
  redBg: "#FDECEC"
652
- }, ce = ["#5B5FEF", "#7C3AED", "#DB2777", "#0891B2", "#D97706", "#059669"];
653
- function ye(t = "") {
654
- return t ? ce[t.charCodeAt(0) % ce.length] : ce[0];
655
- }
662
+ }, ue = ["#5B5FEF", "#7C3AED", "#DB2777", "#0891B2", "#D97706", "#059669"];
656
663
  function we(t = "") {
664
+ return t ? ue[t.charCodeAt(0) % ue.length] : ue[0];
665
+ }
666
+ function be(t = "") {
657
667
  return t.split(" ").map((e) => e[0] || "").join("").toUpperCase().slice(0, 2);
658
668
  }
659
- function be(t = /* @__PURE__ */ new Date()) {
669
+ function ke(t = /* @__PURE__ */ new Date()) {
660
670
  return t.toLocaleTimeString("fr-FR", { hour: "2-digit", minute: "2-digit" });
661
671
  }
662
672
  const Pe = `
@@ -665,21 +675,21 @@ const Pe = `
665
675
  .wm-root {
666
676
  --wm-f: 'Geist', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
667
677
  --wm-fm: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
668
- --wm-w: ${N.w};
669
- --wm-g50: ${N.g50};
670
- --wm-g100: ${N.g100};
671
- --wm-g150: ${N.g150};
672
- --wm-g200: ${N.g200};
673
- --wm-g300: ${N.g300};
674
- --wm-g400: ${N.g400};
675
- --wm-g500: ${N.g500};
676
- --wm-g700: ${N.g700};
677
- --wm-g900: ${N.g900};
678
- --wm-a: ${N.accent};
679
- --wm-al: ${N.accentLight};
680
- --wm-green: ${N.green};
681
- --wm-red: ${N.red};
682
- --wm-redBg: ${N.redBg};
678
+ --wm-w: ${j.w};
679
+ --wm-g50: ${j.g50};
680
+ --wm-g100: ${j.g100};
681
+ --wm-g150: ${j.g150};
682
+ --wm-g200: ${j.g200};
683
+ --wm-g300: ${j.g300};
684
+ --wm-g400: ${j.g400};
685
+ --wm-g500: ${j.g500};
686
+ --wm-g700: ${j.g700};
687
+ --wm-g900: ${j.g900};
688
+ --wm-a: ${j.accent};
689
+ --wm-al: ${j.accentLight};
690
+ --wm-green: ${j.green};
691
+ --wm-red: ${j.red};
692
+ --wm-redBg: ${j.redBg};
683
693
  --wm-sh1: 0 1px 3px rgba(0,0,0,.06);
684
694
  --wm-sh2: 0 4px 24px rgba(0,0,0,.09), 0 1px 4px rgba(0,0,0,.05);
685
695
  --wm-shPanel: 0 12px 40px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.06);
@@ -711,54 +721,136 @@ const Pe = `
711
721
  n[o] = r;
712
722
  return n;
713
723
  }, ze = {
724
+ name: "WmHumanAvatar",
725
+ props: {
726
+ name: { type: String, default: "" },
727
+ avatarUrl: { type: String, default: null },
728
+ size: { type: Number, default: 26 }
729
+ },
730
+ computed: {
731
+ bg() {
732
+ return this.avatarUrl ? "transparent" : we(this.name);
733
+ },
734
+ initials() {
735
+ return be(this.name);
736
+ }
737
+ }
738
+ }, Ve = ["src", "alt"];
739
+ function qe(t, e, n, o, r, s) {
740
+ return d(), c("div", {
741
+ class: "wm-huav",
742
+ style: z({
743
+ width: n.size + "px",
744
+ height: n.size + "px",
745
+ "--wm-avr": Math.round(n.size * 0.32) + "px",
746
+ background: s.bg
747
+ })
748
+ }, [
749
+ n.avatarUrl ? (d(), c("img", {
750
+ key: 0,
751
+ src: n.avatarUrl,
752
+ alt: n.name || ""
753
+ }, null, 8, Ve)) : (d(), c("span", {
754
+ key: 1,
755
+ style: z({ fontSize: n.size * 0.36 + "px" })
756
+ }, k(s.initials), 5))
757
+ ], 4);
758
+ }
759
+ const he = /* @__PURE__ */ $(ze, [["render", qe], ["__scopeId", "data-v-a772b179"]]), We = 2, Ke = 6, Ge = {
714
760
  name: "WmLauncher",
761
+ components: { HumanAvatar: he },
715
762
  props: {
716
763
  // Nombre de conversations non lues — pilote la pastille.
717
764
  unreadCount: { type: Number, default: 0 },
718
- // Aperçu du dernier message non lu à afficher en étiquette.
719
- // Chaîne vide => pas d'étiquette (launcher normal).
720
- peek: { type: String, default: "" }
765
+ // Notification cards to render. Each entry =
766
+ // `{ convId, senderName, senderAvatarUrl, preview, count, ts }`.
767
+ // Empty array => no card, plain launcher.
768
+ peeks: { type: Array, default: () => [] }
721
769
  },
722
- emits: ["open", "dismiss"]
723
- }, Ve = { class: "wm-launcherWrap" }, qe = { class: "wm-peek__text" }, We = ["aria-label"];
724
- function Ke(t, e, n, o, r, s) {
725
- return l(), c("div", Ve, [
770
+ emits: ["open", "dismiss"],
771
+ computed: {
772
+ behindCount() {
773
+ return Math.min(Math.max(this.peeks.length - 1, 0), We);
774
+ },
775
+ // Top padding the stack reserves for the ghost cards peeking out.
776
+ stackExtra() {
777
+ return this.behindCount * Ke;
778
+ }
779
+ }
780
+ }, Ye = { class: "wm-launcherWrap" }, Je = ["aria-label"], Xe = { class: "wm-peek__avatar" }, Ze = ["aria-label"], Qe = { class: "wm-peek__body" }, et = { class: "wm-peek__head" }, tt = { class: "wm-peek__name" }, nt = { class: "wm-peek__text" }, st = ["aria-label"];
781
+ function rt(t, e, n, o, r, s) {
782
+ const a = I("HumanAvatar");
783
+ return d(), c("div", Ye, [
726
784
  K(xe, { name: "wm-peek" }, {
727
785
  default: Te(() => [
728
- n.peek ? (l(), c("div", {
786
+ n.peeks.length ? (d(), c("div", {
729
787
  key: 0,
730
- class: "wm-peek",
731
- role: "button",
732
- tabindex: "0",
733
- "aria-label": "Ouvrir le messenger sur le dernier message",
734
- onClick: e[1] || (e[1] = (a) => t.$emit("open")),
735
- onKeydown: [
736
- e[2] || (e[2] = ae(X((a) => t.$emit("open"), ["prevent"]), ["enter"])),
737
- e[3] || (e[3] = ae(X((a) => t.$emit("open"), ["prevent"]), ["space"]))
738
- ]
788
+ class: "wm-peekStack",
789
+ style: z({ "--wm-stack-extra": s.stackExtra + "px" })
739
790
  }, [
740
- i("p", qe, b(n.peek), 1),
741
- i("button", {
742
- type: "button",
743
- class: "wm-peek__close",
744
- "aria-label": "Ignorer",
745
- onClick: e[0] || (e[0] = X((a) => t.$emit("dismiss"), ["stop"]))
746
- }, [...e[5] || (e[5] = [
747
- i("svg", {
748
- width: "11",
749
- height: "11",
750
- viewBox: "0 0 24 24",
751
- fill: "none",
752
- stroke: "currentColor",
753
- "stroke-width": "2.4",
754
- "stroke-linecap": "round",
755
- "stroke-linejoin": "round",
756
- "aria-hidden": "true"
757
- }, [
758
- i("path", { d: "M18 6L6 18M6 6l12 12" })
759
- ], -1)
760
- ])])
761
- ], 32)) : y("", !0)
791
+ (d(!0), c(M, null, F(s.behindCount, (l) => (d(), c("div", {
792
+ key: `behind-${l}`,
793
+ class: "wm-peek wm-peek--ghost",
794
+ style: z({ "--i": l }),
795
+ "aria-hidden": "true"
796
+ }, null, 4))), 128)),
797
+ i("div", {
798
+ class: "wm-peek wm-peek--top",
799
+ role: "button",
800
+ tabindex: "0",
801
+ "aria-label": `Ouvrir la conversation avec ${n.peeks[0].senderName || "l'agent"}`,
802
+ onClick: e[2] || (e[2] = (l) => t.$emit("open", n.peeks[0].convId)),
803
+ onKeydown: [
804
+ e[3] || (e[3] = oe(Y((l) => t.$emit("open", n.peeks[0].convId), ["prevent"]), ["enter"])),
805
+ e[4] || (e[4] = oe(Y((l) => t.$emit("open", n.peeks[0].convId), ["prevent"]), ["space"]))
806
+ ]
807
+ }, [
808
+ i("button", {
809
+ type: "button",
810
+ class: "wm-peek__close",
811
+ "aria-label": "Ignorer",
812
+ onClick: e[0] || (e[0] = Y((l) => t.$emit("dismiss", n.peeks[0].convId), ["stop"]))
813
+ }, [...e[6] || (e[6] = [
814
+ i("svg", {
815
+ width: "9",
816
+ height: "9",
817
+ viewBox: "0 0 24 24",
818
+ fill: "none",
819
+ stroke: "currentColor",
820
+ "stroke-width": "2.8",
821
+ "stroke-linecap": "round",
822
+ "stroke-linejoin": "round",
823
+ "aria-hidden": "true"
824
+ }, [
825
+ i("path", { d: "M18 6L6 18M6 6l12 12" })
826
+ ], -1)
827
+ ])]),
828
+ i("div", Xe, [
829
+ K(a, {
830
+ name: n.peeks[0].senderName,
831
+ "avatar-url": n.peeks[0].senderAvatarUrl,
832
+ size: 34
833
+ }, null, 8, ["name", "avatar-url"]),
834
+ n.peeks[0].count > 1 ? (d(), c("span", {
835
+ key: 0,
836
+ class: "wm-peek__avatarBadge",
837
+ "aria-label": `${n.peeks[0].count} messages non lus`
838
+ }, k(n.peeks[0].count > 9 ? "9+" : n.peeks[0].count), 9, Ze)) : b("", !0)
839
+ ]),
840
+ i("div", Qe, [
841
+ i("div", et, [
842
+ i("span", tt, k(n.peeks[0].senderName || "Agent"), 1),
843
+ e[7] || (e[7] = i("span", { class: "wm-peek__action" }, " vous a répondu", -1))
844
+ ]),
845
+ i("p", nt, k(n.peeks[0].preview), 1)
846
+ ]),
847
+ i("button", {
848
+ type: "button",
849
+ class: "wm-peek__open",
850
+ onClick: e[1] || (e[1] = Y((l) => t.$emit("open", n.peeks[0].convId), ["stop"]))
851
+ }, "Ouvrir")
852
+ ], 40, Je)
853
+ ], 4)) : b("", !0)
762
854
  ]),
763
855
  _: 1
764
856
  }),
@@ -766,9 +858,9 @@ function Ke(t, e, n, o, r, s) {
766
858
  type: "button",
767
859
  class: "wm-launcher",
768
860
  "aria-label": "Ouvrir le messenger",
769
- onClick: e[4] || (e[4] = (a) => t.$emit("open"))
861
+ onClick: e[5] || (e[5] = (l) => t.$emit("open"))
770
862
  }, [
771
- e[6] || (e[6] = i("svg", {
863
+ e[8] || (e[8] = i("svg", {
772
864
  width: "20",
773
865
  height: "20",
774
866
  viewBox: "0 0 24 24",
@@ -781,15 +873,15 @@ function Ke(t, e, n, o, r, s) {
781
873
  }, [
782
874
  i("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })
783
875
  ], -1)),
784
- n.unreadCount > 0 ? (l(), c("span", {
876
+ n.unreadCount > 0 ? (d(), c("span", {
785
877
  key: 0,
786
878
  class: "wm-launcher__badge",
787
879
  "aria-label": `${n.unreadCount} conversation${n.unreadCount > 1 ? "s" : ""} non lue${n.unreadCount > 1 ? "s" : ""}`
788
- }, b(n.unreadCount > 9 ? "9+" : n.unreadCount), 9, We)) : y("", !0)
880
+ }, k(n.unreadCount > 9 ? "9+" : n.unreadCount), 9, st)) : b("", !0)
789
881
  ])
790
882
  ]);
791
883
  }
792
- const Ge = /* @__PURE__ */ $(ze, [["render", Ke], ["__scopeId", "data-v-fabef371"]]), Ye = {
884
+ const it = /* @__PURE__ */ $(Ge, [["render", rt], ["__scopeId", "data-v-e7ea0209"]]), at = {
793
885
  name: "WmAIAvatar",
794
886
  props: {
795
887
  size: { type: Number, default: 26 },
@@ -801,20 +893,20 @@ const Ge = /* @__PURE__ */ $(ze, [["render", Ke], ["__scopeId", "data-v-fabef371
801
893
  // pour garder l'avatar pleinement arrondi.
802
894
  tail: { type: Boolean, default: !1 }
803
895
  }
804
- }, Je = {
896
+ }, ot = {
805
897
  key: 0,
806
898
  class: "wm-aiav__pulse"
807
- }, Xe = ["width", "height"];
808
- function Ze(t, e, n, o, r, s) {
809
- return l(), c("div", {
899
+ }, lt = ["width", "height"];
900
+ function dt(t, e, n, o, r, s) {
901
+ return d(), c("div", {
810
902
  class: E(["wm-aiav", { "wm-aiav--tail": n.tail }]),
811
- style: G({ width: n.size + "px", height: n.size + "px", "--wm-avr": n.size * 0.32 + "px" })
903
+ style: z({ width: n.size + "px", height: n.size + "px", "--wm-avr": n.size * 0.32 + "px" })
812
904
  }, [
813
- n.pulse ? (l(), c("div", Je)) : y("", !0),
905
+ n.pulse ? (d(), c("div", ot)) : b("", !0),
814
906
  i("div", {
815
907
  class: E(["wm-aiav__inner", { "wm-aiav__inner--glow": n.pulse }])
816
908
  }, [
817
- (l(), c("svg", {
909
+ (d(), c("svg", {
818
910
  width: n.size * 0.5,
819
911
  height: n.size * 0.5,
820
912
  viewBox: "0 0 24 24",
@@ -840,47 +932,11 @@ function Ze(t, e, n, o, r, s) {
840
932
  fill: "white",
841
933
  opacity: "0.38"
842
934
  }, null, -1)
843
- ])], 8, Xe))
935
+ ])], 8, lt))
844
936
  ], 2)
845
937
  ], 6);
846
938
  }
847
- const ne = /* @__PURE__ */ $(Ye, [["render", Ze], ["__scopeId", "data-v-8c924688"]]), Qe = {
848
- name: "WmHumanAvatar",
849
- props: {
850
- name: { type: String, default: "" },
851
- avatarUrl: { type: String, default: null },
852
- size: { type: Number, default: 26 }
853
- },
854
- computed: {
855
- bg() {
856
- return this.avatarUrl ? "transparent" : ye(this.name);
857
- },
858
- initials() {
859
- return we(this.name);
860
- }
861
- }
862
- }, et = ["src", "alt"];
863
- function tt(t, e, n, o, r, s) {
864
- return l(), c("div", {
865
- class: "wm-huav",
866
- style: G({
867
- width: n.size + "px",
868
- height: n.size + "px",
869
- "--wm-avr": Math.round(n.size * 0.32) + "px",
870
- background: s.bg
871
- })
872
- }, [
873
- n.avatarUrl ? (l(), c("img", {
874
- key: 0,
875
- src: n.avatarUrl,
876
- alt: n.name || ""
877
- }, null, 8, et)) : (l(), c("span", {
878
- key: 1,
879
- style: G({ fontSize: n.size * 0.36 + "px" })
880
- }, b(s.initials), 5))
881
- ], 4);
882
- }
883
- const ke = /* @__PURE__ */ $(Qe, [["render", tt], ["__scopeId", "data-v-a772b179"]]), nt = {
939
+ const ne = /* @__PURE__ */ $(at, [["render", dt], ["__scopeId", "data-v-8c924688"]]), ct = {
884
940
  name: "WmTeamAvatars",
885
941
  props: {
886
942
  members: { type: Array, default: () => [] },
@@ -896,43 +952,43 @@ const ke = /* @__PURE__ */ $(Qe, [["render", tt], ["__scopeId", "data-v-a772b179
896
952
  },
897
953
  methods: {
898
954
  colorFor(t) {
899
- return t.avatar_url ? "transparent" : ye(t.name || "");
955
+ return t.avatar_url ? "transparent" : we(t.name || "");
900
956
  },
901
957
  initialsFor(t) {
902
- return we(t.name || "");
958
+ return be(t.name || "");
903
959
  }
904
960
  }
905
- }, st = {
961
+ }, ut = {
906
962
  key: 0,
907
963
  class: "wm-team"
908
- }, rt = ["src", "alt"], it = { key: 1 }, at = {
964
+ }, ht = ["src", "alt"], mt = { key: 1 }, ft = {
909
965
  key: 0,
910
966
  class: "wm-team__label"
911
967
  };
912
- function ot(t, e, n, o, r, s) {
913
- return s.visible ? (l(), c("div", st, [
968
+ function _t(t, e, n, o, r, s) {
969
+ return s.visible ? (d(), c("div", ut, [
914
970
  i("div", {
915
971
  class: "wm-team__stack",
916
- style: G({ width: s.stackWidth + "px" })
972
+ style: z({ width: s.stackWidth + "px" })
917
973
  }, [
918
- (l(!0), c(M, null, D(n.members.slice(0, 3), (a, d) => (l(), c("div", {
919
- key: d,
974
+ (d(!0), c(M, null, F(n.members.slice(0, 3), (a, l) => (d(), c("div", {
975
+ key: l,
920
976
  class: "wm-team__pill",
921
- style: G({ left: d * 13 + "px", zIndex: 3 - d, background: s.colorFor(a) })
977
+ style: z({ left: l * 13 + "px", zIndex: 3 - l, background: s.colorFor(a) })
922
978
  }, [
923
- a.avatar_url ? (l(), c("img", {
979
+ a.avatar_url ? (d(), c("img", {
924
980
  key: 0,
925
981
  src: a.avatar_url,
926
982
  alt: a.name || ""
927
- }, null, 8, rt)) : (l(), c("span", it, b(s.initialsFor(a)), 1))
983
+ }, null, 8, ht)) : (d(), c("span", mt, k(s.initialsFor(a)), 1))
928
984
  ], 4))), 128))
929
985
  ], 4),
930
- n.responseLabel ? (l(), c("span", at, b(n.responseLabel), 1)) : y("", !0)
931
- ])) : y("", !0);
986
+ n.responseLabel ? (d(), c("span", ft, k(n.responseLabel), 1)) : b("", !0)
987
+ ])) : b("", !0);
932
988
  }
933
- const lt = /* @__PURE__ */ $(nt, [["render", ot], ["__scopeId", "data-v-3659b9c1"]]), dt = {
989
+ const pt = /* @__PURE__ */ $(ct, [["render", _t], ["__scopeId", "data-v-3659b9c1"]]), gt = {
934
990
  name: "WmHeader",
935
- components: { AIAvatar: ne, HumanAvatar: ke, TeamAvatars: lt },
991
+ components: { AIAvatar: ne, HumanAvatar: he, TeamAvatars: pt },
936
992
  props: {
937
993
  title: { type: String, default: "Nouvelle conversation" },
938
994
  escalated: { type: Boolean, default: !1 },
@@ -963,25 +1019,25 @@ const lt = /* @__PURE__ */ $(nt, [["render", ot], ["__scopeId", "data-v-3659b9c1
963
1019
  return this.escalated && this.agentName ? this.agentName : "En ligne";
964
1020
  }
965
1021
  }
966
- }, ct = { class: "wm-header" }, ut = {
1022
+ }, vt = { class: "wm-header" }, yt = {
967
1023
  key: 1,
968
1024
  style: { width: "30px", height: "30px", "flex-shrink": "0" }
969
- }, ht = { class: "wm-header__avatar" }, mt = { class: "wm-header__main" }, ft = { class: "wm-header__title" }, _t = {
1025
+ }, wt = { class: "wm-header__avatar" }, bt = { class: "wm-header__main" }, kt = { class: "wm-header__title" }, Ct = {
970
1026
  key: 0,
971
1027
  class: "wm-header__sub"
972
- }, pt = { class: "wm-header__status" }, vt = {
1028
+ }, At = { class: "wm-header__status" }, St = {
973
1029
  key: 3,
974
1030
  class: "wm-header__fill"
975
- }, gt = { class: "wm-header__actions" };
976
- function yt(t, e, n, o, r, s) {
977
- const a = B("HumanAvatar"), d = B("AIAvatar"), v = B("TeamAvatars");
978
- return l(), c("div", ct, [
979
- n.showBack ? (l(), c("button", {
1031
+ }, xt = { class: "wm-header__actions" };
1032
+ function Tt(t, e, n, o, r, s) {
1033
+ const a = I("HumanAvatar"), l = I("AIAvatar"), g = I("TeamAvatars");
1034
+ return d(), c("div", vt, [
1035
+ n.showBack ? (d(), c("button", {
980
1036
  key: 0,
981
1037
  type: "button",
982
1038
  class: "wm-header__icon",
983
1039
  "aria-label": "Retour à l'accueil",
984
- onClick: e[0] || (e[0] = (k) => t.$emit("back"))
1040
+ onClick: e[0] || (e[0] = (C) => t.$emit("back"))
985
1041
  }, [...e[3] || (e[3] = [
986
1042
  i("svg", {
987
1043
  width: "13",
@@ -996,42 +1052,42 @@ function yt(t, e, n, o, r, s) {
996
1052
  }, [
997
1053
  i("path", { d: "M19 12H5M12 5l-7 7 7 7" })
998
1054
  ], -1)
999
- ])])) : (l(), c("div", ut)),
1000
- n.showIdentity ? (l(), c(M, { key: 2 }, [
1001
- i("div", ht, [
1002
- n.escalated ? (l(), L(a, {
1055
+ ])])) : (d(), c("div", yt)),
1056
+ n.showIdentity ? (d(), c(M, { key: 2 }, [
1057
+ i("div", wt, [
1058
+ n.escalated ? (d(), L(a, {
1003
1059
  key: 0,
1004
1060
  name: n.agentName,
1005
1061
  "avatar-url": n.agentAvatarUrl,
1006
1062
  size: 34
1007
- }, null, 8, ["name", "avatar-url"])) : (l(), L(d, {
1063
+ }, null, 8, ["name", "avatar-url"])) : (d(), L(l, {
1008
1064
  key: 1,
1009
1065
  size: 34
1010
1066
  }))
1011
1067
  ]),
1012
- i("div", mt, [
1013
- i("div", ft, b(n.title), 1),
1014
- s.showPresence ? (l(), c("div", _t, [
1015
- s.hasTeam ? (l(), L(v, {
1068
+ i("div", bt, [
1069
+ i("div", kt, k(n.title), 1),
1070
+ s.showPresence ? (d(), c("div", Ct, [
1071
+ s.hasTeam ? (d(), L(g, {
1016
1072
  key: 0,
1017
1073
  members: n.teamMembers,
1018
1074
  "response-label": n.responseLabel
1019
- }, null, 8, ["members", "response-label"])) : y("", !0),
1020
- i("span", pt, [
1075
+ }, null, 8, ["members", "response-label"])) : b("", !0),
1076
+ i("span", At, [
1021
1077
  e[4] || (e[4] = i("span", { class: "wm-header__dot" }, null, -1)),
1022
- te(" " + b(s.statusText), 1)
1078
+ te(" " + k(s.statusText), 1)
1023
1079
  ])
1024
- ])) : y("", !0)
1080
+ ])) : b("", !0)
1025
1081
  ])
1026
- ], 64)) : (l(), c("div", vt)),
1027
- i("div", gt, [
1028
- n.showMore ? (l(), c("button", {
1082
+ ], 64)) : (d(), c("div", St)),
1083
+ i("div", xt, [
1084
+ n.showMore ? (d(), c("button", {
1029
1085
  key: 0,
1030
1086
  type: "button",
1031
1087
  class: E(["wm-header__icon", { "wm-header__icon--active": n.moreActive }]),
1032
1088
  "aria-label": "Plus d'options",
1033
1089
  title: "Plus d'options",
1034
- onClick: e[1] || (e[1] = (k) => t.$emit("more"))
1090
+ onClick: e[1] || (e[1] = (C) => t.$emit("more"))
1035
1091
  }, [...e[5] || (e[5] = [
1036
1092
  i("svg", {
1037
1093
  width: "13",
@@ -1056,14 +1112,14 @@ function yt(t, e, n, o, r, s) {
1056
1112
  r: "1.6"
1057
1113
  })
1058
1114
  ], -1)
1059
- ])], 2)) : y("", !0),
1060
- n.showClose ? (l(), c("button", {
1115
+ ])], 2)) : b("", !0),
1116
+ n.showClose ? (d(), c("button", {
1061
1117
  key: 1,
1062
1118
  type: "button",
1063
1119
  class: "wm-header__icon",
1064
1120
  "aria-label": "Fermer le widget",
1065
1121
  title: "Fermer le widget",
1066
- onClick: e[2] || (e[2] = (k) => t.$emit("close"))
1122
+ onClick: e[2] || (e[2] = (C) => t.$emit("close"))
1067
1123
  }, [...e[6] || (e[6] = [
1068
1124
  i("svg", {
1069
1125
  width: "13",
@@ -1078,17 +1134,17 @@ function yt(t, e, n, o, r, s) {
1078
1134
  }, [
1079
1135
  i("path", { d: "M18 6L6 18M6 6l12 12" })
1080
1136
  ], -1)
1081
- ])])) : y("", !0)
1137
+ ])])) : b("", !0)
1082
1138
  ])
1083
1139
  ]);
1084
1140
  }
1085
- const wt = /* @__PURE__ */ $(dt, [["render", yt], ["__scopeId", "data-v-b5f5f6a9"]]), _e = {
1141
+ const Mt = /* @__PURE__ */ $(gt, [["render", Tt], ["__scopeId", "data-v-b5f5f6a9"]]), pe = {
1086
1142
  book: "M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253",
1087
1143
  changelog: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2",
1088
1144
  status: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z",
1089
1145
  chat: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z",
1090
1146
  link: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"
1091
- }, bt = {
1147
+ }, Ot = {
1092
1148
  name: "WmOnboarding",
1093
1149
  components: { AIAvatar: ne },
1094
1150
  props: {
@@ -1110,15 +1166,30 @@ Je réponds en quelques secondes.`;
1110
1166
  },
1111
1167
  methods: {
1112
1168
  iconPath(t) {
1113
- return _e[t] || _e.link;
1169
+ return pe[t] || pe.link;
1170
+ },
1171
+ formatTs(t) {
1172
+ if (!t) return "";
1173
+ const e = new Date(t);
1174
+ if (Number.isNaN(e.getTime())) return "";
1175
+ const n = /* @__PURE__ */ new Date();
1176
+ if (e.toDateString() === n.toDateString()) {
1177
+ const s = String(e.getHours()).padStart(2, "0"), a = String(e.getMinutes()).padStart(2, "0");
1178
+ return `${s}h${a}`;
1179
+ }
1180
+ if (n.getTime() - e.getTime() < 7 * 864e5) {
1181
+ const s = e.toLocaleDateString("fr-FR", { weekday: "short" });
1182
+ return s.charAt(0).toUpperCase() + s.slice(1);
1183
+ }
1184
+ return e.toLocaleDateString("fr-FR", { day: "2-digit", month: "2-digit" });
1114
1185
  }
1115
1186
  }
1116
- }, kt = { class: "wm-onb" }, Ct = { class: "wm-onb__hero" }, At = { class: "wm-onb__title" }, St = { class: "wm-onb__sub" }, xt = {
1187
+ }, It = { class: "wm-onb" }, Bt = { class: "wm-onb__hero" }, Et = { class: "wm-onb__title" }, $t = { class: "wm-onb__sub" }, Nt = {
1117
1188
  key: 0,
1118
1189
  class: "wm-onb__section"
1119
- }, Tt = { class: "wm-onb__links" }, Mt = ["onClick"], Ot = { class: "wm-onb__link-icon" }, It = {
1120
- width: "14",
1121
- height: "14",
1190
+ }, Lt = { class: "wm-onb__grid" }, Rt = ["onClick"], Ft = { class: "wm-onb__card-icon" }, Dt = {
1191
+ width: "16",
1192
+ height: "16",
1122
1193
  viewBox: "0 0 24 24",
1123
1194
  fill: "none",
1124
1195
  stroke: "currentColor",
@@ -1126,110 +1197,104 @@ Je réponds en quelques secondes.`;
1126
1197
  "stroke-linecap": "round",
1127
1198
  "stroke-linejoin": "round",
1128
1199
  "aria-hidden": "true"
1129
- }, Bt = ["d"], Et = { class: "wm-onb__link-label" }, $t = {
1200
+ }, jt = ["d"], Ut = { class: "wm-onb__card-title" }, Pt = {
1201
+ key: 0,
1202
+ class: "wm-onb__card-sub"
1203
+ }, Ht = {
1130
1204
  key: 1,
1131
1205
  class: "wm-onb__section"
1132
- }, Lt = { class: "wm-onb__links" }, Rt = ["onClick"], Ft = {
1206
+ }, zt = { class: "wm-onb__list" }, Vt = ["onClick"], qt = { class: "wm-onb__thread-icon" }, Wt = {
1133
1207
  key: 0,
1134
- class: "wm-onb__resume-dot",
1208
+ class: "wm-onb__thread-dot",
1135
1209
  "aria-label": "Non lu"
1136
- }, Dt = { class: "wm-onb__resume-body" }, Nt = { class: "wm-onb__resume-title" }, jt = { class: "wm-onb__resume-preview" }, Ut = { class: "wm-onb__cta" }, Pt = ["disabled"];
1137
- function Ht(t, e, n, o, r, s) {
1138
- const a = B("AIAvatar");
1139
- return l(), c("div", kt, [
1140
- i("div", Ct, [
1210
+ }, Kt = { class: "wm-onb__thread-body" }, Gt = { class: "wm-onb__thread-title" }, Yt = { class: "wm-onb__thread-preview" }, Jt = { class: "wm-onb__thread-meta" }, Xt = {
1211
+ key: 0,
1212
+ class: "wm-onb__thread-time"
1213
+ }, Zt = { class: "wm-onb__cta" }, Qt = ["disabled"];
1214
+ function en(t, e, n, o, r, s) {
1215
+ const a = I("AIAvatar");
1216
+ return d(), c("div", It, [
1217
+ i("div", Bt, [
1141
1218
  K(a, {
1142
1219
  size: 56,
1143
1220
  pulse: !0
1144
1221
  }),
1145
- i("div", At, b(s.heroTitle), 1),
1146
- i("div", St, b(s.heroSub), 1)
1222
+ i("div", Et, k(s.heroTitle), 1),
1223
+ i("div", $t, k(s.heroSub), 1)
1147
1224
  ]),
1148
- n.quickLinks.length ? (l(), c("div", xt, [
1149
- e[3] || (e[3] = i("div", { class: "wm-onb__section-title" }, "Accès rapide", -1)),
1150
- i("div", Tt, [
1151
- (l(!0), c(M, null, D(n.quickLinks, (d, v) => (l(), c("button", {
1152
- key: v,
1225
+ n.quickLinks.length ? (d(), c("div", Nt, [
1226
+ e[2] || (e[2] = i("div", { class: "wm-onb__section-title" }, "Accès rapide", -1)),
1227
+ i("div", Lt, [
1228
+ (d(!0), c(M, null, F(n.quickLinks, (l, g) => (d(), c("button", {
1229
+ key: g,
1153
1230
  type: "button",
1154
- class: "wm-onb__link",
1155
- onClick: (k) => t.$emit("select", d)
1231
+ class: "wm-onb__card",
1232
+ onClick: (C) => t.$emit("select", l)
1156
1233
  }, [
1157
- i("span", Ot, [
1158
- (l(), c("svg", It, [
1234
+ i("span", Ft, [
1235
+ (d(), c("svg", Dt, [
1159
1236
  i("path", {
1160
- d: s.iconPath(d.icon)
1161
- }, null, 8, Bt)
1237
+ d: s.iconPath(l.icon)
1238
+ }, null, 8, jt)
1162
1239
  ]))
1163
1240
  ]),
1164
- i("span", Et, b(d.label), 1),
1165
- e[2] || (e[2] = i("svg", {
1166
- width: "13",
1167
- height: "13",
1168
- viewBox: "0 0 24 24",
1169
- fill: "none",
1170
- stroke: "currentColor",
1171
- "stroke-width": "1.8",
1172
- "stroke-linecap": "round",
1173
- "stroke-linejoin": "round",
1174
- class: "wm-onb__link-chev",
1175
- "aria-hidden": "true"
1176
- }, [
1177
- i("path", { d: "M9 18l6-6-6-6" })
1178
- ], -1))
1179
- ], 8, Mt))), 128))
1241
+ i("span", Ut, k(l.label), 1),
1242
+ l.description ? (d(), c("span", Pt, k(l.description), 1)) : b("", !0)
1243
+ ], 8, Rt))), 128))
1180
1244
  ])
1181
- ])) : y("", !0),
1182
- n.openThreads.length ? (l(), c("div", $t, [
1183
- e[7] || (e[7] = i("div", { class: "wm-onb__section-title" }, "Vos conversations", -1)),
1184
- i("div", Lt, [
1185
- (l(!0), c(M, null, D(n.openThreads, (d) => (l(), c("button", {
1186
- key: d.id,
1245
+ ])) : b("", !0),
1246
+ n.openThreads.length ? (d(), c("div", Ht, [
1247
+ e[6] || (e[6] = i("div", { class: "wm-onb__section-title" }, "Conversations récentes", -1)),
1248
+ i("div", zt, [
1249
+ (d(!0), c(M, null, F(n.openThreads, (l) => (d(), c("button", {
1250
+ key: l.id,
1187
1251
  type: "button",
1188
- class: "wm-onb__link wm-onb__resume",
1189
- onClick: (v) => t.$emit("resume", d)
1252
+ class: "wm-onb__thread",
1253
+ onClick: (g) => t.$emit("resume", l)
1190
1254
  }, [
1191
- i("span", {
1192
- class: E(["wm-onb__link-icon", { "wm-onb__resume-icon": d.unread }])
1193
- }, [
1194
- e[4] || (e[4] = i("svg", {
1195
- width: "14",
1196
- height: "14",
1255
+ i("span", qt, [
1256
+ e[3] || (e[3] = i("svg", {
1257
+ width: "18",
1258
+ height: "18",
1197
1259
  viewBox: "0 0 24 24",
1198
1260
  fill: "none",
1199
1261
  stroke: "currentColor",
1200
- "stroke-width": "1.7",
1262
+ "stroke-width": "1.8",
1201
1263
  "stroke-linecap": "round",
1202
1264
  "stroke-linejoin": "round",
1203
1265
  "aria-hidden": "true"
1204
1266
  }, [
1205
- i("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" })
1267
+ i("path", { d: "M12 5v14M5 12h14" })
1206
1268
  ], -1)),
1207
- d.unread ? (l(), c("span", Ft)) : y("", !0)
1208
- ], 2),
1209
- i("span", Dt, [
1210
- i("span", Nt, b(d.title), 1),
1211
- i("span", jt, b(d.preview), 1)
1269
+ l.unread ? (d(), c("span", Wt)) : b("", !0)
1212
1270
  ]),
1213
- e[5] || (e[5] = i("svg", {
1214
- width: "13",
1215
- height: "13",
1216
- viewBox: "0 0 24 24",
1217
- fill: "none",
1218
- stroke: "currentColor",
1219
- "stroke-width": "1.8",
1220
- "stroke-linecap": "round",
1221
- "stroke-linejoin": "round",
1222
- class: "wm-onb__link-chev",
1223
- "aria-hidden": "true"
1224
- }, [
1225
- i("path", { d: "M9 18l6-6-6-6" })
1226
- ], -1))
1227
- ], 8, Rt))), 128)),
1271
+ i("span", Kt, [
1272
+ i("span", Gt, k(l.title), 1),
1273
+ i("span", Yt, k(l.preview), 1)
1274
+ ]),
1275
+ i("span", Jt, [
1276
+ s.formatTs(l._ts) ? (d(), c("span", Xt, k(s.formatTs(l._ts)), 1)) : b("", !0),
1277
+ e[4] || (e[4] = i("svg", {
1278
+ width: "13",
1279
+ height: "13",
1280
+ viewBox: "0 0 24 24",
1281
+ fill: "none",
1282
+ stroke: "currentColor",
1283
+ "stroke-width": "1.8",
1284
+ "stroke-linecap": "round",
1285
+ "stroke-linejoin": "round",
1286
+ class: "wm-onb__thread-chev",
1287
+ "aria-hidden": "true"
1288
+ }, [
1289
+ i("path", { d: "M9 18l6-6-6-6" })
1290
+ ], -1))
1291
+ ])
1292
+ ], 8, Vt))), 128)),
1228
1293
  i("button", {
1229
1294
  type: "button",
1230
1295
  class: "wm-onb__viewAll",
1231
- onClick: e[0] || (e[0] = (d) => t.$emit("view-all"))
1232
- }, [...e[6] || (e[6] = [
1296
+ onClick: e[0] || (e[0] = (l) => t.$emit("view-all"))
1297
+ }, [...e[5] || (e[5] = [
1233
1298
  te(" Voir toutes les conversations ", -1),
1234
1299
  i("svg", {
1235
1300
  width: "12",
@@ -1246,22 +1311,22 @@ function Ht(t, e, n, o, r, s) {
1246
1311
  ], -1)
1247
1312
  ])])
1248
1313
  ])
1249
- ])) : y("", !0),
1250
- i("div", Ut, [
1314
+ ])) : b("", !0),
1315
+ i("div", Zt, [
1251
1316
  i("button", {
1252
1317
  type: "button",
1253
1318
  class: "wm-onb__startBtn",
1254
1319
  disabled: n.busy,
1255
- onClick: e[1] || (e[1] = (d) => t.$emit("start"))
1256
- }, b(n.busy ? "…" : "Commencer une conversation"), 9, Pt)
1320
+ onClick: e[1] || (e[1] = (l) => t.$emit("start"))
1321
+ }, k(n.busy ? "…" : "Commencer une conversation"), 9, Qt)
1257
1322
  ])
1258
1323
  ]);
1259
1324
  }
1260
- const zt = /* @__PURE__ */ $(bt, [["render", Ht], ["__scopeId", "data-v-13584fe8"]]);
1261
- function Vt(t) {
1325
+ const tn = /* @__PURE__ */ $(Ot, [["render", en], ["__scopeId", "data-v-770bfafa"]]);
1326
+ function nn(t) {
1262
1327
  return typeof t != "string" ? "" : t.replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(new RegExp("(?<!\\*)\\*([^*]+)\\*(?!\\*)", "g"), "$1").replace(/__([^_]+)__/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\s+/g, " ").trim();
1263
1328
  }
1264
- const qt = {
1329
+ const sn = {
1265
1330
  name: "WmActionResult",
1266
1331
  props: {
1267
1332
  state: { type: String, default: "success" },
@@ -1271,13 +1336,13 @@ const qt = {
1271
1336
  },
1272
1337
  computed: {
1273
1338
  detailText() {
1274
- return Vt(this.detail);
1339
+ return nn(this.detail);
1275
1340
  }
1276
1341
  }
1277
- }, Wt = {
1342
+ }, rn = {
1278
1343
  class: "wm-result__icon",
1279
1344
  "aria-hidden": "true"
1280
- }, Kt = {
1345
+ }, an = {
1281
1346
  key: 0,
1282
1347
  width: "11",
1283
1348
  height: "11",
@@ -1287,7 +1352,7 @@ const qt = {
1287
1352
  "stroke-width": "2.8",
1288
1353
  "stroke-linecap": "round",
1289
1354
  "stroke-linejoin": "round"
1290
- }, Gt = {
1355
+ }, on = {
1291
1356
  key: 1,
1292
1357
  width: "11",
1293
1358
  height: "11",
@@ -1297,7 +1362,7 @@ const qt = {
1297
1362
  "stroke-width": "2.6",
1298
1363
  "stroke-linecap": "round",
1299
1364
  "stroke-linejoin": "round"
1300
- }, Yt = {
1365
+ }, ln = {
1301
1366
  key: 2,
1302
1367
  width: "11",
1303
1368
  height: "11",
@@ -1307,7 +1372,7 @@ const qt = {
1307
1372
  "stroke-width": "2.4",
1308
1373
  "stroke-linecap": "round",
1309
1374
  "stroke-linejoin": "round"
1310
- }, Jt = {
1375
+ }, dn = {
1311
1376
  key: 3,
1312
1377
  width: "12",
1313
1378
  height: "12",
@@ -1317,24 +1382,24 @@ const qt = {
1317
1382
  "stroke-width": "2.2",
1318
1383
  "stroke-linecap": "round",
1319
1384
  "stroke-linejoin": "round"
1320
- }, Xt = { class: "wm-result__body" }, Zt = { class: "wm-result__label" }, Qt = { class: "wm-result__detail" };
1321
- function en(t, e, n, o, r, s) {
1322
- return l(), c("div", {
1385
+ }, cn = { class: "wm-result__body" }, un = { class: "wm-result__label" }, hn = { class: "wm-result__detail" };
1386
+ function mn(t, e, n, o, r, s) {
1387
+ return d(), c("div", {
1323
1388
  class: E(["wm-result", `wm-result--${n.state}`])
1324
1389
  }, [
1325
- i("span", Wt, [
1326
- n.state === "success" ? (l(), c("svg", Kt, [...e[0] || (e[0] = [
1390
+ i("span", rn, [
1391
+ n.state === "success" ? (d(), c("svg", an, [...e[0] || (e[0] = [
1327
1392
  i("path", { d: "M20 6L9 17l-5-5" }, null, -1)
1328
- ])])) : n.state === "rejected" ? (l(), c("svg", Gt, [...e[1] || (e[1] = [
1393
+ ])])) : n.state === "rejected" ? (d(), c("svg", on, [...e[1] || (e[1] = [
1329
1394
  i("path", { d: "M18 6L6 18M6 6l12 12" }, null, -1)
1330
- ])])) : n.state === "awaiting" ? (l(), c("svg", Yt, [...e[2] || (e[2] = [
1395
+ ])])) : n.state === "awaiting" ? (d(), c("svg", ln, [...e[2] || (e[2] = [
1331
1396
  i("circle", {
1332
1397
  cx: "12",
1333
1398
  cy: "12",
1334
1399
  r: "10"
1335
1400
  }, null, -1),
1336
1401
  i("polyline", { points: "12 7 12 12 15 14" }, null, -1)
1337
- ])])) : (l(), c("svg", Jt, [...e[3] || (e[3] = [
1402
+ ])])) : (d(), c("svg", dn, [...e[3] || (e[3] = [
1338
1403
  i("path", { d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" }, null, -1),
1339
1404
  i("line", {
1340
1405
  x1: "12",
@@ -1350,19 +1415,19 @@ function en(t, e, n, o, r, s) {
1350
1415
  }, null, -1)
1351
1416
  ])]))
1352
1417
  ]),
1353
- i("span", Xt, [
1354
- i("span", Zt, b(n.label), 1),
1355
- s.detailText ? (l(), c(M, { key: 0 }, [
1418
+ i("span", cn, [
1419
+ i("span", un, k(n.label), 1),
1420
+ s.detailText ? (d(), c(M, { key: 0 }, [
1356
1421
  e[4] || (e[4] = i("span", {
1357
1422
  class: "wm-result__sep",
1358
1423
  "aria-hidden": "true"
1359
1424
  }, " · ", -1)),
1360
- i("span", Qt, b(s.detailText), 1)
1361
- ], 64)) : y("", !0)
1425
+ i("span", hn, k(s.detailText), 1)
1426
+ ], 64)) : b("", !0)
1362
1427
  ])
1363
1428
  ], 2);
1364
1429
  }
1365
- const tn = /* @__PURE__ */ $(qt, [["render", en], ["__scopeId", "data-v-64a83fb8"]]), nn = {
1430
+ const fn = /* @__PURE__ */ $(sn, [["render", mn], ["__scopeId", "data-v-64a83fb8"]]), _n = {
1366
1431
  name: "WmArtifactFormResponse",
1367
1432
  props: {
1368
1433
  data: { type: Object, required: !0 }
@@ -1373,11 +1438,11 @@ const tn = /* @__PURE__ */ $(qt, [["render", en], ["__scopeId", "data-v-64a83fb8
1373
1438
  return Array.isArray((t = this.data) == null ? void 0 : t.fields) ? this.data.fields : [];
1374
1439
  }
1375
1440
  }
1376
- }, sn = { class: "wm-art wm-art--formResponse" }, rn = { class: "wm-art__head" }, an = { class: "wm-art__title" }, on = { class: "wm-art__body" }, ln = { class: "wm-art__fieldLabel" };
1377
- function dn(t, e, n, o, r, s) {
1378
- return l(), c("div", sn, [
1379
- i("div", rn, [
1380
- i("div", an, b(n.data.title || "Formulaire"), 1),
1441
+ }, pn = { class: "wm-art wm-art--formResponse" }, gn = { class: "wm-art__head" }, vn = { class: "wm-art__title" }, yn = { class: "wm-art__body" }, wn = { class: "wm-art__fieldLabel" };
1442
+ function bn(t, e, n, o, r, s) {
1443
+ return d(), c("div", pn, [
1444
+ i("div", gn, [
1445
+ i("div", vn, k(n.data.title || "Formulaire"), 1),
1381
1446
  e[0] || (e[0] = i("span", { class: "wm-art__badge wm-art__badge--success" }, [
1382
1447
  i("svg", {
1383
1448
  width: "11",
@@ -1395,20 +1460,20 @@ function dn(t, e, n, o, r, s) {
1395
1460
  te(" Envoyé ")
1396
1461
  ], -1))
1397
1462
  ]),
1398
- i("div", on, [
1399
- (l(!0), c(M, null, D(s.fields, (a, d) => (l(), c("div", {
1400
- key: d,
1463
+ i("div", yn, [
1464
+ (d(!0), c(M, null, F(s.fields, (a, l) => (d(), c("div", {
1465
+ key: l,
1401
1466
  class: "wm-art__field"
1402
1467
  }, [
1403
- i("div", ln, b(a.label), 1),
1468
+ i("div", wn, k(a.label), 1),
1404
1469
  i("div", {
1405
1470
  class: E(["wm-art__fieldValue", { "wm-art__fieldValue--multi": a.multiline }])
1406
- }, b(a.value), 3)
1471
+ }, k(a.value), 3)
1407
1472
  ]))), 128))
1408
1473
  ])
1409
1474
  ]);
1410
1475
  }
1411
- const cn = /* @__PURE__ */ $(nn, [["render", dn], ["__scopeId", "data-v-ca24a9c9"]]), un = {
1476
+ const kn = /* @__PURE__ */ $(_n, [["render", bn], ["__scopeId", "data-v-ca24a9c9"]]), Cn = {
1412
1477
  name: "WmArtifactInfoCard",
1413
1478
  props: {
1414
1479
  data: { type: Object, required: !0 }
@@ -1423,61 +1488,61 @@ const cn = /* @__PURE__ */ $(nn, [["render", dn], ["__scopeId", "data-v-ca24a9c9
1423
1488
  return !!((t = this.data) != null && t.body) || this.fields.length > 0;
1424
1489
  }
1425
1490
  }
1426
- }, hn = { class: "wm-art wm-art--infoCard" }, mn = {
1491
+ }, An = { class: "wm-art wm-art--infoCard" }, Sn = {
1427
1492
  key: 0,
1428
1493
  class: "wm-art__image"
1429
- }, fn = ["src", "alt"], _n = { class: "wm-art__head" }, pn = { class: "wm-art__headMain" }, vn = { class: "wm-art__title" }, gn = {
1494
+ }, xn = ["src", "alt"], Tn = { class: "wm-art__head" }, Mn = { class: "wm-art__headMain" }, On = { class: "wm-art__title" }, In = {
1430
1495
  key: 0,
1431
1496
  class: "wm-art__subtitle"
1432
- }, yn = {
1497
+ }, Bn = {
1433
1498
  key: 1,
1434
1499
  class: "wm-art__body"
1435
- }, wn = {
1500
+ }, En = {
1436
1501
  key: 0,
1437
1502
  class: "wm-art__text"
1438
- }, bn = { class: "wm-art__fieldLabel" };
1439
- function kn(t, e, n, o, r, s) {
1440
- return l(), c("div", hn, [
1441
- n.data.image_url ? (l(), c("figure", mn, [
1503
+ }, $n = { class: "wm-art__fieldLabel" };
1504
+ function Nn(t, e, n, o, r, s) {
1505
+ return d(), c("div", An, [
1506
+ n.data.image_url ? (d(), c("figure", Sn, [
1442
1507
  i("img", {
1443
1508
  src: n.data.image_url,
1444
1509
  alt: n.data.title || "",
1445
1510
  loading: "lazy"
1446
- }, null, 8, fn)
1447
- ])) : y("", !0),
1448
- i("div", _n, [
1449
- i("div", pn, [
1450
- i("div", vn, b(n.data.title), 1),
1451
- n.data.subtitle ? (l(), c("div", gn, b(n.data.subtitle), 1)) : y("", !0)
1511
+ }, null, 8, xn)
1512
+ ])) : b("", !0),
1513
+ i("div", Tn, [
1514
+ i("div", Mn, [
1515
+ i("div", On, k(n.data.title), 1),
1516
+ n.data.subtitle ? (d(), c("div", In, k(n.data.subtitle), 1)) : b("", !0)
1452
1517
  ]),
1453
- n.data.badge && n.data.badge.label ? (l(), c("span", {
1518
+ n.data.badge && n.data.badge.label ? (d(), c("span", {
1454
1519
  key: 0,
1455
1520
  class: E(["wm-art__badge", `wm-art__badge--${n.data.badge.tone || "neutral"}`])
1456
- }, b(n.data.badge.label), 3)) : y("", !0)
1521
+ }, k(n.data.badge.label), 3)) : b("", !0)
1457
1522
  ]),
1458
- s.hasBody ? (l(), c("div", yn, [
1459
- n.data.body ? (l(), c("div", wn, b(n.data.body), 1)) : y("", !0),
1460
- s.fields.length ? (l(!0), c(M, { key: 1 }, D(s.fields, (a, d) => (l(), c("div", {
1461
- key: d,
1523
+ s.hasBody ? (d(), c("div", Bn, [
1524
+ n.data.body ? (d(), c("div", En, k(n.data.body), 1)) : b("", !0),
1525
+ s.fields.length ? (d(!0), c(M, { key: 1 }, F(s.fields, (a, l) => (d(), c("div", {
1526
+ key: l,
1462
1527
  class: "wm-art__field"
1463
1528
  }, [
1464
- i("div", bn, b(a.label), 1),
1529
+ i("div", $n, k(a.label), 1),
1465
1530
  i("div", {
1466
1531
  class: E(["wm-art__fieldValue", { "wm-art__fieldValue--multi": a.multiline }])
1467
- }, b(a.value), 3)
1468
- ]))), 128)) : y("", !0)
1469
- ])) : y("", !0)
1532
+ }, k(a.value), 3)
1533
+ ]))), 128)) : b("", !0)
1534
+ ])) : b("", !0)
1470
1535
  ]);
1471
1536
  }
1472
- const Cn = /* @__PURE__ */ $(un, [["render", kn], ["__scopeId", "data-v-d7369333"]]);
1473
- function An(t) {
1537
+ const Ln = /* @__PURE__ */ $(Cn, [["render", Nn], ["__scopeId", "data-v-d7369333"]]);
1538
+ function Rn(t) {
1474
1539
  if (!t) return "";
1475
1540
  const e = new Date(t);
1476
1541
  if (Number.isNaN(e.getTime())) return t;
1477
1542
  const n = e.toLocaleDateString("fr-FR", { day: "numeric", month: "long", year: "numeric" }), o = e.toLocaleTimeString("fr-FR", { hour: "2-digit", minute: "2-digit" });
1478
1543
  return `${n} à ${o}`;
1479
1544
  }
1480
- const Sn = {
1545
+ const Fn = {
1481
1546
  name: "WmArtifactTicket",
1482
1547
  props: {
1483
1548
  data: { type: Object, required: !0 }
@@ -1489,7 +1554,7 @@ const Sn = {
1489
1554
  },
1490
1555
  formattedDate() {
1491
1556
  var t;
1492
- return An((t = this.data) == null ? void 0 : t.created_at);
1557
+ return Rn((t = this.data) == null ? void 0 : t.created_at);
1493
1558
  }
1494
1559
  },
1495
1560
  methods: {
@@ -1511,13 +1576,13 @@ const Sn = {
1511
1576
  return /high|haute|élev|elev|critic|critiq|urgent/.test(e) ? 3 : /low|basse|faible|minor/.test(e) ? 1 : 2;
1512
1577
  }
1513
1578
  }
1514
- }, xn = { class: "wm-art wm-art--ticket" }, Tn = { class: "wm-art__head wm-tk__head" }, Mn = { class: "wm-art__title wm-tk__title" }, On = { class: "wm-tk__sub" }, In = { class: "wm-tk__ref" }, Bn = {
1579
+ }, Dn = { class: "wm-art wm-art--ticket" }, jn = { class: "wm-art__head wm-tk__head" }, Un = { class: "wm-art__title wm-tk__title" }, Pn = { class: "wm-tk__sub" }, Hn = { class: "wm-tk__ref" }, zn = {
1515
1580
  key: 0,
1516
1581
  class: "wm-tk__text"
1517
- }, En = {
1582
+ }, Vn = {
1518
1583
  key: 0,
1519
1584
  class: "wm-art__body"
1520
- }, $n = { class: "wm-art__fieldLabel" }, Ln = ["data-level"], Rn = {
1585
+ }, qn = { class: "wm-art__fieldLabel" }, Wn = ["data-level"], Kn = {
1521
1586
  key: 1,
1522
1587
  class: "wm-tk__date",
1523
1588
  width: "12",
@@ -1529,16 +1594,16 @@ const Sn = {
1529
1594
  "stroke-linecap": "round",
1530
1595
  "stroke-linejoin": "round",
1531
1596
  "aria-hidden": "true"
1532
- }, Fn = {
1597
+ }, Gn = {
1533
1598
  key: 1,
1534
1599
  class: "wm-art__footer wm-tk__footer"
1535
1600
  };
1536
- function Dn(t, e, n, o, r, s) {
1537
- return l(), c("div", xn, [
1538
- i("div", Tn, [
1539
- i("div", Mn, b(n.data.title), 1),
1540
- i("div", On, [
1541
- i("div", In, [
1601
+ function Yn(t, e, n, o, r, s) {
1602
+ return d(), c("div", Dn, [
1603
+ i("div", jn, [
1604
+ i("div", Un, k(n.data.title), 1),
1605
+ i("div", Pn, [
1606
+ i("div", Hn, [
1542
1607
  e[0] || (e[0] = i("svg", {
1543
1608
  width: "11",
1544
1609
  height: "11",
@@ -1553,7 +1618,7 @@ function Dn(t, e, n, o, r, s) {
1553
1618
  i("path", { d: "M20 12a2 2 0 0 1 2-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v4a2 2 0 0 1 0 4v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 1-2-2z" }),
1554
1619
  i("path", { d: "M13 5v2M13 17v2M13 11v2" })
1555
1620
  ], -1)),
1556
- i("span", null, b(n.data.reference), 1)
1621
+ i("span", null, k(n.data.reference), 1)
1557
1622
  ]),
1558
1623
  i("span", {
1559
1624
  class: E(["wm-art__badge", "wm-tk__badge", `wm-art__badge--${n.data.status.tone || "neutral"}`])
@@ -1562,21 +1627,21 @@ function Dn(t, e, n, o, r, s) {
1562
1627
  class: "wm-tk__dot",
1563
1628
  "aria-hidden": "true"
1564
1629
  }, null, -1)),
1565
- te(" " + b(n.data.status.label), 1)
1630
+ te(" " + k(n.data.status.label), 1)
1566
1631
  ], 2)
1567
1632
  ]),
1568
- n.data.body ? (l(), c("div", Bn, b(n.data.body), 1)) : y("", !0)
1633
+ n.data.body ? (d(), c("div", zn, k(n.data.body), 1)) : b("", !0)
1569
1634
  ]),
1570
- s.fields.length ? (l(), c("div", En, [
1571
- (l(!0), c(M, null, D(s.fields, (a, d) => (l(), c("div", {
1572
- key: d,
1635
+ s.fields.length ? (d(), c("div", Vn, [
1636
+ (d(!0), c(M, null, F(s.fields, (a, l) => (d(), c("div", {
1637
+ key: l,
1573
1638
  class: "wm-art__field"
1574
1639
  }, [
1575
- i("div", $n, b(a.label), 1),
1640
+ i("div", qn, k(a.label), 1),
1576
1641
  i("div", {
1577
1642
  class: E(["wm-art__fieldValue", { "wm-art__fieldValue--multi": a.multiline }])
1578
1643
  }, [
1579
- s.isPriority(a.label) ? (l(), c("svg", {
1644
+ s.isPriority(a.label) ? (d(), c("svg", {
1580
1645
  key: 0,
1581
1646
  class: "wm-tk__prio",
1582
1647
  "data-level": s.priorityLevel(a.value),
@@ -1606,7 +1671,7 @@ function Dn(t, e, n, o, r, s) {
1606
1671
  height: "9",
1607
1672
  rx: "0.5"
1608
1673
  }, null, -1)
1609
- ])], 8, Ln)) : s.isDate(a.label) ? (l(), c("svg", Rn, [...e[3] || (e[3] = [
1674
+ ])], 8, Wn)) : s.isDate(a.label) ? (d(), c("svg", Kn, [...e[3] || (e[3] = [
1610
1675
  i("rect", {
1611
1676
  x: "3",
1612
1677
  y: "4",
@@ -1615,12 +1680,12 @@ function Dn(t, e, n, o, r, s) {
1615
1680
  rx: "2"
1616
1681
  }, null, -1),
1617
1682
  i("path", { d: "M16 2v4M8 2v4M3 10h18" }, null, -1)
1618
- ])])) : y("", !0),
1619
- i("span", null, b(a.value), 1)
1683
+ ])])) : b("", !0),
1684
+ i("span", null, k(a.value), 1)
1620
1685
  ], 2)
1621
1686
  ]))), 128))
1622
- ])) : y("", !0),
1623
- n.data.created_at ? (l(), c("div", Fn, [
1687
+ ])) : b("", !0),
1688
+ n.data.created_at ? (d(), c("div", Gn, [
1624
1689
  e[4] || (e[4] = i("svg", {
1625
1690
  width: "11",
1626
1691
  height: "11",
@@ -1641,15 +1706,15 @@ function Dn(t, e, n, o, r, s) {
1641
1706
  }),
1642
1707
  i("path", { d: "M16 2v4M8 2v4M3 10h18" })
1643
1708
  ], -1)),
1644
- i("span", null, b(s.formattedDate), 1)
1645
- ])) : y("", !0)
1709
+ i("span", null, k(s.formattedDate), 1)
1710
+ ])) : b("", !0)
1646
1711
  ]);
1647
1712
  }
1648
- const Nn = /* @__PURE__ */ $(Sn, [["render", Dn], ["__scopeId", "data-v-8b274eb7"]]), jn = {
1649
- form_response: cn,
1650
- info_card: Cn,
1651
- ticket: Nn
1652
- }, Un = {
1713
+ const Jn = /* @__PURE__ */ $(Fn, [["render", Yn], ["__scopeId", "data-v-8b274eb7"]]), Xn = {
1714
+ form_response: kn,
1715
+ info_card: Ln,
1716
+ ticket: Jn
1717
+ }, Zn = {
1653
1718
  name: "WmArtifactRenderer",
1654
1719
  props: {
1655
1720
  // Forme : { kind: string, data: any } (le `data` est validé
@@ -1660,17 +1725,17 @@ const Nn = /* @__PURE__ */ $(Sn, [["render", Dn], ["__scopeId", "data-v-8b274eb7
1660
1725
  component() {
1661
1726
  var e;
1662
1727
  const t = (e = this.artifact) == null ? void 0 : e.kind;
1663
- return t && jn[t] || null;
1728
+ return t && Xn[t] || null;
1664
1729
  }
1665
1730
  }
1666
1731
  };
1667
- function Pn(t, e, n, o, r, s) {
1668
- return s.component ? (l(), L(Me(s.component), {
1732
+ function Qn(t, e, n, o, r, s) {
1733
+ return s.component ? (d(), L(Me(s.component), {
1669
1734
  key: 0,
1670
1735
  data: n.artifact.data
1671
- }, null, 8, ["data"])) : y("", !0);
1736
+ }, null, 8, ["data"])) : b("", !0);
1672
1737
  }
1673
- const Hn = /* @__PURE__ */ $(Un, [["render", Pn]]), zn = {
1738
+ const es = /* @__PURE__ */ $(Zn, [["render", Qn]]), ts = {
1674
1739
  name: "WmAttachmentPreview",
1675
1740
  inject: {
1676
1741
  signAttachmentFn: { default: null }
@@ -1724,19 +1789,19 @@ const Hn = /* @__PURE__ */ $(Un, [["render", Pn]]), zn = {
1724
1789
  this.url || t.preventDefault();
1725
1790
  }
1726
1791
  }
1727
- }, Vn = ["href"], qn = ["src", "alt"], Wn = ["src"], Kn = ["src"], Gn = ["href", "download"], Yn = { class: "wm-att__main" }, Jn = { class: "wm-att__name" }, Xn = {
1792
+ }, ns = ["href"], ss = ["src", "alt"], rs = ["src"], is = ["src"], as = ["href", "download"], os = { class: "wm-att__main" }, ls = { class: "wm-att__name" }, ds = {
1728
1793
  key: 0,
1729
1794
  class: "wm-att__meta"
1730
- }, Zn = {
1795
+ }, cs = {
1731
1796
  key: 0,
1732
1797
  class: "wm-att__spin",
1733
1798
  "aria-hidden": "true"
1734
1799
  };
1735
- function Qn(t, e, n, o, r, s) {
1736
- return l(), c("div", {
1800
+ function us(t, e, n, o, r, s) {
1801
+ return d(), c("div", {
1737
1802
  class: E(["wm-att", ["wm-att--" + (s.kind || "file")]])
1738
1803
  }, [
1739
- s.kind === "image" && r.url ? (l(), c("a", {
1804
+ s.kind === "image" && r.url ? (d(), c("a", {
1740
1805
  key: 0,
1741
1806
  href: r.url,
1742
1807
  target: "_blank",
@@ -1747,18 +1812,18 @@ function Qn(t, e, n, o, r, s) {
1747
1812
  src: r.url,
1748
1813
  alt: s.displayName,
1749
1814
  loading: "lazy"
1750
- }, null, 8, qn)
1751
- ], 8, Vn)) : s.kind === "audio" && r.url ? (l(), c("audio", {
1815
+ }, null, 8, ss)
1816
+ ], 8, ns)) : s.kind === "audio" && r.url ? (d(), c("audio", {
1752
1817
  key: 1,
1753
1818
  src: r.url,
1754
1819
  controls: "",
1755
1820
  preload: "metadata"
1756
- }, null, 8, Wn)) : s.kind === "video" && r.url ? (l(), c("video", {
1821
+ }, null, 8, rs)) : s.kind === "video" && r.url ? (d(), c("video", {
1757
1822
  key: 2,
1758
1823
  src: r.url,
1759
1824
  controls: "",
1760
1825
  preload: "metadata"
1761
- }, null, 8, Kn)) : (l(), c("a", {
1826
+ }, null, 8, is)) : (d(), c("a", {
1762
1827
  key: 3,
1763
1828
  class: "wm-att__file",
1764
1829
  href: r.url || "#",
@@ -1783,78 +1848,78 @@ function Qn(t, e, n, o, r, s) {
1783
1848
  i("path", { d: "M14 2v6h6" })
1784
1849
  ])
1785
1850
  ], -1)),
1786
- i("span", Yn, [
1787
- i("span", Jn, b(s.displayName), 1),
1788
- s.sizeLabel ? (l(), c("span", Xn, b(s.sizeLabel), 1)) : y("", !0)
1851
+ i("span", os, [
1852
+ i("span", ls, k(s.displayName), 1),
1853
+ s.sizeLabel ? (d(), c("span", ds, k(s.sizeLabel), 1)) : b("", !0)
1789
1854
  ]),
1790
- r.loading ? (l(), c("span", Zn)) : y("", !0)
1791
- ], 8, Gn))
1855
+ r.loading ? (d(), c("span", cs)) : b("", !0)
1856
+ ], 8, as))
1792
1857
  ], 2);
1793
1858
  }
1794
- const es = /* @__PURE__ */ $(zn, [["render", Qn], ["__scopeId", "data-v-1cd1267b"]]);
1795
- function ts(t) {
1859
+ const hs = /* @__PURE__ */ $(ts, [["render", us], ["__scopeId", "data-v-1cd1267b"]]);
1860
+ function ms(t) {
1796
1861
  return String(t).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1797
1862
  }
1798
- function ns(t) {
1863
+ function fs(t) {
1799
1864
  return /^(https?:\/\/|mailto:|tel:)/i.test(String(t).trim());
1800
1865
  }
1801
- const pe = "";
1866
+ const ge = "";
1802
1867
  function re(t) {
1803
1868
  let e = t;
1804
1869
  const n = [];
1805
1870
  return e = e.replace(/`([^`\n]+)`/g, (o, r) => {
1806
1871
  const s = n.length;
1807
- return n.push(r), `${pe}CODE${s}${pe}`;
1808
- }), e = e.replace(/\[([^\]\n]+)\]\(([^)\s]+)\)/g, (o, r, s) => ns(s) ? `<a href="${s}" target="_blank" rel="noopener noreferrer">${r}</a>` : r), e = e.replace(/\*\*([^\n*][^\n]*?)\*\*/g, "<strong>$1</strong>"), e = e.replace(/__([^\n_][^\n]*?)__/g, "<u>$1</u>"), e = e.replace(/~~([^\n~][^\n]*?)~~/g, "<s>$1</s>"), e = e.replace(/(^|[^\w*])\*([^\n*]+?)\*(?!\w)/g, "$1<em>$2</em>"), e = e.replace(/(^|[^\w_])_([^\n_]+?)_(?!\w)/g, "$1<em>$2</em>"), e = e.replace(/CODE(\d+)/g, (o, r) => `<code class="wm-md-code">${n[+r]}</code>`), e;
1872
+ return n.push(r), `${ge}CODE${s}${ge}`;
1873
+ }), e = e.replace(/\[([^\]\n]+)\]\(([^)\s]+)\)/g, (o, r, s) => fs(s) ? `<a href="${s}" target="_blank" rel="noopener noreferrer">${r}</a>` : r), e = e.replace(/\*\*([^\n*][^\n]*?)\*\*/g, "<strong>$1</strong>"), e = e.replace(/__([^\n_][^\n]*?)__/g, "<u>$1</u>"), e = e.replace(/~~([^\n~][^\n]*?)~~/g, "<s>$1</s>"), e = e.replace(/(^|[^\w*])\*([^\n*]+?)\*(?!\w)/g, "$1<em>$2</em>"), e = e.replace(/(^|[^\w_])_([^\n_]+?)_(?!\w)/g, "$1<em>$2</em>"), e = e.replace(/CODE(\d+)/g, (o, r) => `<code class="wm-md-code">${n[+r]}</code>`), e;
1809
1874
  }
1810
- function ss(t) {
1875
+ function _s(t) {
1811
1876
  if (!t) return "";
1812
- const e = ts(t).split(`
1877
+ const e = ms(t).split(`
1813
1878
  `), n = [];
1814
1879
  let o = 0;
1815
1880
  for (; o < e.length; ) {
1816
1881
  const s = e[o];
1817
1882
  if (/^\s*```([\w-]*)\s*$/.exec(s)) {
1818
1883
  o++;
1819
- const k = [];
1884
+ const C = [];
1820
1885
  for (; o < e.length && !/^\s*```\s*$/.test(e[o]); )
1821
- k.push(e[o]), o++;
1886
+ C.push(e[o]), o++;
1822
1887
  o < e.length && o++, n.push({
1823
1888
  type: "block",
1824
- html: `<pre class="wm-md-pre"><code>${k.join(`
1889
+ html: `<pre class="wm-md-pre"><code>${C.join(`
1825
1890
  `)}</code></pre>`
1826
1891
  });
1827
1892
  continue;
1828
1893
  }
1829
1894
  if (/^\s*[-*]\s+/.test(s)) {
1830
- const k = [];
1895
+ const C = [];
1831
1896
  for (; o < e.length; ) {
1832
1897
  const S = /^\s*[-*]\s+(.*)$/.exec(e[o]);
1833
1898
  if (!S) break;
1834
- k.push(S[1]), o++;
1899
+ C.push(S[1]), o++;
1835
1900
  }
1836
- const w = k.map((S) => `<li>${re(S)}</li>`).join("");
1837
- n.push({ type: "block", html: `<ul class="wm-md-ul">${w}</ul>` });
1901
+ const y = C.map((S) => `<li>${re(S)}</li>`).join("");
1902
+ n.push({ type: "block", html: `<ul class="wm-md-ul">${y}</ul>` });
1838
1903
  continue;
1839
1904
  }
1840
- const d = /^\s*(\d+)\.\s+(.*)$/.exec(s);
1841
- if (d) {
1842
- const k = parseInt(d[1], 10), w = [d[2]];
1905
+ const l = /^\s*(\d+)\.\s+(.*)$/.exec(s);
1906
+ if (l) {
1907
+ const C = parseInt(l[1], 10), y = [l[2]];
1843
1908
  for (o++; o < e.length; ) {
1844
1909
  const A = /^\s*\d+\.\s+(.*)$/.exec(e[o]);
1845
1910
  if (!A) break;
1846
- w.push(A[1]), o++;
1911
+ y.push(A[1]), o++;
1847
1912
  }
1848
- const S = w.map((A) => `<li>${re(A)}</li>`).join(""), F = k !== 1 ? ` start="${k}"` : "";
1849
- n.push({ type: "block", html: `<ol class="wm-md-ol"${F}>${S}</ol>` });
1913
+ const S = y.map((A) => `<li>${re(A)}</li>`).join(""), N = C !== 1 ? ` start="${C}"` : "";
1914
+ n.push({ type: "block", html: `<ol class="wm-md-ol"${N}>${S}</ol>` });
1850
1915
  continue;
1851
1916
  }
1852
- const v = /^(#{1,6})\s+(.*)$/.exec(s);
1853
- if (v) {
1854
- const k = v[1].length;
1917
+ const g = /^(#{1,6})\s+(.*)$/.exec(s);
1918
+ if (g) {
1919
+ const C = g[1].length;
1855
1920
  n.push({
1856
1921
  type: "block",
1857
- html: `<h${k} class="wm-md-h wm-md-h${k}">${re(v[2])}</h${k}>`
1922
+ html: `<h${C} class="wm-md-h wm-md-h${C}">${re(g[2])}</h${C}>`
1858
1923
  }), o++;
1859
1924
  continue;
1860
1925
  }
@@ -1864,13 +1929,13 @@ function ss(t) {
1864
1929
  for (let s = 0; s < n.length; s++) {
1865
1930
  const a = n[s];
1866
1931
  r += a.html;
1867
- const d = n[s + 1];
1868
- d && a.type !== "block" && d.type !== "block" && (r += `
1932
+ const l = n[s + 1];
1933
+ l && a.type !== "block" && l.type !== "block" && (r += `
1869
1934
  `);
1870
1935
  }
1871
1936
  return r;
1872
1937
  }
1873
- const rs = {
1938
+ const ps = {
1874
1939
  name: "WmBubble",
1875
1940
  props: {
1876
1941
  role: { type: String, default: "ai" },
@@ -1879,41 +1944,41 @@ const rs = {
1879
1944
  },
1880
1945
  computed: {
1881
1946
  rendered() {
1882
- return ss(this.text);
1947
+ return _s(this.text);
1883
1948
  }
1884
1949
  }
1885
- }, is = ["innerHTML"];
1886
- function as(t, e, n, o, r, s) {
1887
- return l(), c("div", {
1950
+ }, gs = ["innerHTML"];
1951
+ function vs(t, e, n, o, r, s) {
1952
+ return d(), c("div", {
1888
1953
  class: E(["wm-bubble", "wm-bubble--" + n.role])
1889
1954
  }, [
1890
1955
  Oe(t.$slots, "default", {}, () => [
1891
- i("span", { innerHTML: s.rendered }, null, 8, is)
1956
+ i("span", { innerHTML: s.rendered }, null, 8, gs)
1892
1957
  ], !0)
1893
1958
  ], 2);
1894
1959
  }
1895
- const os = /* @__PURE__ */ $(rs, [["render", as], ["__scopeId", "data-v-5c9e9f2b"]]), ls = { name: "WmTyping" }, ds = { class: "wm-typing" };
1896
- function cs(t, e, n, o, r, s) {
1897
- return l(), c("div", ds, [...e[0] || (e[0] = [
1960
+ const ys = /* @__PURE__ */ $(ps, [["render", vs], ["__scopeId", "data-v-5c9e9f2b"]]), ws = { name: "WmTyping" }, bs = { class: "wm-typing" };
1961
+ function ks(t, e, n, o, r, s) {
1962
+ return d(), c("div", bs, [...e[0] || (e[0] = [
1898
1963
  i("span", { style: { "animation-delay": "0s" } }, null, -1),
1899
1964
  i("span", { style: { "animation-delay": "0.2s" } }, null, -1),
1900
1965
  i("span", { style: { "animation-delay": "0.4s" } }, null, -1)
1901
1966
  ])]);
1902
1967
  }
1903
- const us = /* @__PURE__ */ $(ls, [["render", cs], ["__scopeId", "data-v-df2447fd"]]);
1968
+ const Cs = /* @__PURE__ */ $(ws, [["render", ks], ["__scopeId", "data-v-df2447fd"]]);
1904
1969
  function ee(t) {
1905
1970
  return t ? t.client_msg_id || t.id : "";
1906
1971
  }
1907
- const hs = {
1972
+ const As = {
1908
1973
  transferred_to_human: "Conversation transférée à un humain",
1909
1974
  assigned: "{name} a rejoint la conversation",
1910
1975
  unassigned: "L'agent a quitté la conversation",
1911
1976
  resolved: "Conversation résolue",
1912
1977
  reopened: "Conversation rouverte",
1913
1978
  idle: "Conversation en pause"
1914
- }, ms = 80, fs = 200, _s = {
1979
+ }, Ss = 80, xs = 200, Ts = {
1915
1980
  name: "WmMessageList",
1916
- components: { AIAvatar: ne, HumanAvatar: ke, Bubble: os, Typing: us, ActionResult: tn, AttachmentPreview: es, ArtifactRenderer: Hn },
1981
+ components: { AIAvatar: ne, HumanAvatar: he, Bubble: ys, Typing: Cs, ActionResult: fn, AttachmentPreview: hs, ArtifactRenderer: es },
1917
1982
  props: {
1918
1983
  messages: { type: Array, default: () => [] },
1919
1984
  streamingActive: { type: Boolean, default: !1 },
@@ -1961,11 +2026,11 @@ const hs = {
1961
2026
  var n, o, r, s;
1962
2027
  const t = [];
1963
2028
  for (const a of this.messages) {
1964
- const d = this.roleOf(a);
1965
- if (d === "system") {
2029
+ const l = this.roleOf(a);
2030
+ if (l === "system") {
1966
2031
  if (((n = a == null ? void 0 : a.payload) == null ? void 0 : n.event) === "action_admin_pending") {
1967
- const w = t[t.length - 1];
1968
- w && w.role === "ai" ? w.messages.push(a) : t.push({
2032
+ const y = t[t.length - 1];
2033
+ y && y.role === "ai" ? y.messages.push(a) : t.push({
1969
2034
  key: `g-${ee(a)}`,
1970
2035
  role: "ai",
1971
2036
  agentName: "",
@@ -1977,17 +2042,17 @@ const hs = {
1977
2042
  }
1978
2043
  t.push({
1979
2044
  key: `sys-${ee(a)}`,
1980
- role: d,
2045
+ role: l,
1981
2046
  messages: [a],
1982
2047
  items: [],
1983
2048
  systemLabel: this.systemLabel(a)
1984
2049
  });
1985
2050
  continue;
1986
2051
  }
1987
- const v = t[t.length - 1];
1988
- v && v.role === d && (d === "ai" || v.agentName === (((o = a == null ? void 0 : a.author) == null ? void 0 : o.name) || "")) ? v.messages.push(a) : t.push({
2052
+ const g = t[t.length - 1];
2053
+ g && g.role === l && (l === "ai" || g.agentName === (((o = a == null ? void 0 : a.author) == null ? void 0 : o.name) || "")) ? g.messages.push(a) : t.push({
1989
2054
  key: `g-${ee(a)}`,
1990
- role: d,
2055
+ role: l,
1991
2056
  agentName: ((r = a == null ? void 0 : a.author) == null ? void 0 : r.name) || "",
1992
2057
  agentAvatarUrl: ((s = a == null ? void 0 : a.author) == null ? void 0 : s.avatar_url) || null,
1993
2058
  messages: [a],
@@ -1996,17 +2061,17 @@ const hs = {
1996
2061
  }
1997
2062
  for (const a of t) {
1998
2063
  if (a.role === "system") continue;
1999
- const d = [];
2000
- for (const v of a.messages)
2001
- for (const k of this.itemsOf(v)) d.push(k);
2002
- a.items = d;
2064
+ const l = [];
2065
+ for (const g of a.messages)
2066
+ for (const C of this.itemsOf(g)) l.push(C);
2067
+ a.items = l;
2003
2068
  }
2004
2069
  const e = [];
2005
2070
  for (const a of t) {
2006
2071
  if (a.role !== "system" && !a.items.length) continue;
2007
- const d = e[e.length - 1];
2008
- if (d && d.role !== "system" && d.role === a.role && (a.role === "ai" || d.agentName === a.agentName)) {
2009
- d.messages.push(...a.messages), d.items.push(...a.items);
2072
+ const l = e[e.length - 1];
2073
+ if (l && l.role !== "system" && l.role === a.role && (a.role === "ai" || l.agentName === a.agentName)) {
2074
+ l.messages.push(...a.messages), l.items.push(...a.items);
2010
2075
  continue;
2011
2076
  }
2012
2077
  e.push(a);
@@ -2049,11 +2114,11 @@ const hs = {
2049
2114
  methods: {
2050
2115
  messageKey: ee,
2051
2116
  isAtBottom(t) {
2052
- return t.scrollHeight - t.scrollTop - t.clientHeight <= ms;
2117
+ return t.scrollHeight - t.scrollTop - t.clientHeight <= Ss;
2053
2118
  },
2054
2119
  onScroll() {
2055
2120
  const t = this.$refs.scrollEl;
2056
- t && (this.loadingMore || !this.hasMore || this._pendingLoadMore || t.scrollTop <= fs && (this._pendingLoadMore = !0, this.$emit("load-more")));
2121
+ t && (this.loadingMore || !this.hasMore || this._pendingLoadMore || t.scrollTop <= xs && (this._pendingLoadMore = !0, this.$emit("load-more")));
2057
2122
  },
2058
2123
  // Capture pre-patch scroll state and restore it on the next tick.
2059
2124
  //
@@ -2101,11 +2166,11 @@ const hs = {
2101
2166
  }
2102
2167
  if (!r.anchor) return;
2103
2168
  const s = () => {
2104
- var k;
2169
+ var C;
2105
2170
  const a = r.anchor;
2106
- if (!((k = a.el) != null && k.isConnected)) return;
2107
- const v = a.el.getBoundingClientRect().top - t.getBoundingClientRect().top - a.relY;
2108
- Math.abs(v) > 0.5 && (t.scrollTop += v);
2171
+ if (!((C = a.el) != null && C.isConnected)) return;
2172
+ const g = a.el.getBoundingClientRect().top - t.getBoundingClientRect().top - a.relY;
2173
+ Math.abs(g) > 0.5 && (t.scrollTop += g);
2109
2174
  };
2110
2175
  s(), requestAnimationFrame(() => {
2111
2176
  s(), requestAnimationFrame(s);
@@ -2228,10 +2293,10 @@ const hs = {
2228
2293
  // adjacent à une `bubble`) : mon coin déborde le voisin et
2229
2294
  // doit garder son arrondi.
2230
2295
  cornersFor(t, e) {
2231
- var Y, z, Z;
2232
- const n = t.items, o = (Y = n[e]) == null ? void 0 : Y.kind, r = (z = n[e - 1]) == null ? void 0 : z.kind, s = (Z = n[e + 1]) == null ? void 0 : Z.kind, a = t.role === "user", d = 14, v = 4, k = r == null ? void 0 : r.bottom, w = s == null ? void 0 : s.top, S = this.widthByKey[this.rowKeyOf(t, e)], F = this.widthByKey[this.rowKeyOf(t, e - 1)], A = this.widthByKey[this.rowKeyOf(t, e + 1)], U = 0.5, x = (W, V, Q) => W != null && S != null ? W + U >= S : V === Q || V === "card" && Q === "bubble";
2233
- let j = d, P = d, R = d, H = d;
2234
- return a ? (k && (P = v), (w || !s) && (R = v), k && x(F, k, o == null ? void 0 : o.top) && (j = v), w && x(A, w, o == null ? void 0 : o.bottom) && (H = v)) : (k && (j = v), (w || !s) && (H = v), k && x(F, k, o == null ? void 0 : o.top) && (P = v), w && x(A, w, o == null ? void 0 : o.bottom) && (R = v)), { tl: j, tr: P, br: R, bl: H };
2296
+ var J, V, Q;
2297
+ const n = t.items, o = (J = n[e]) == null ? void 0 : J.kind, r = (V = n[e - 1]) == null ? void 0 : V.kind, s = (Q = n[e + 1]) == null ? void 0 : Q.kind, a = t.role === "user", l = 14, g = 4, C = r == null ? void 0 : r.bottom, y = s == null ? void 0 : s.top, S = this.widthByKey[this.rowKeyOf(t, e)], N = this.widthByKey[this.rowKeyOf(t, e - 1)], A = this.widthByKey[this.rowKeyOf(t, e + 1)], D = 0.5, x = (G, q, X) => G != null && S != null ? G + D >= S : q === X || q === "card" && X === "bubble";
2298
+ let U = l, P = l, R = l, H = l;
2299
+ return a ? (C && (P = g), (y || !s) && (R = g), C && x(N, C, o == null ? void 0 : o.top) && (U = g), y && x(A, y, o == null ? void 0 : o.bottom) && (H = g)) : (C && (U = g), (y || !s) && (H = g), C && x(N, C, o == null ? void 0 : o.top) && (P = g), y && x(A, y, o == null ? void 0 : o.bottom) && (R = g)), { tl: U, tr: P, br: R, bl: H };
2235
2300
  },
2236
2301
  // Inline style emitting the four corner CSS variables. Set on
2237
2302
  // `.wm-list__row` so they cascade to Bubble/ActionResult/
@@ -2272,10 +2337,10 @@ const hs = {
2272
2337
  for (const s of t.querySelectorAll(".wm-list__row[data-row-key]")) {
2273
2338
  const a = s.dataset.rowKey;
2274
2339
  if (!a) continue;
2275
- const d = s.querySelector(".wm-bubble, .wm-result, .wm-art, .wm-list__body");
2276
- if (!d) continue;
2277
- const v = d.getBoundingClientRect().width;
2278
- v > 0 && (e[a] = v);
2340
+ const l = s.querySelector(".wm-bubble, .wm-result, .wm-art, .wm-list__body");
2341
+ if (!l) continue;
2342
+ const g = l.getBoundingClientRect().width;
2343
+ g > 0 && (e[a] = g);
2279
2344
  }
2280
2345
  const n = this.widthByKey, o = Object.keys(n), r = Object.keys(e);
2281
2346
  if (o.length === r.length) {
@@ -2293,7 +2358,7 @@ const hs = {
2293
2358
  const e = t.items[t.items.length - 1], n = (e == null ? void 0 : e.message) || t.messages[t.messages.length - 1];
2294
2359
  if (!(n != null && n.created_at)) return "";
2295
2360
  try {
2296
- return be(new Date(n.created_at));
2361
+ return ke(new Date(n.created_at));
2297
2362
  } catch {
2298
2363
  return "";
2299
2364
  }
@@ -2326,9 +2391,9 @@ const hs = {
2326
2391
  return ((e = t == null ? void 0 : t.payload) == null ? void 0 : e.name) || (t == null ? void 0 : t.text_md) || "Action";
2327
2392
  },
2328
2393
  actionDetail(t) {
2329
- var n, o, r, s, a, d;
2394
+ var n, o, r, s, a, l;
2330
2395
  const e = t == null ? void 0 : t.payload;
2331
- return e ? e.state === "success" ? ((n = e.success) == null ? void 0 : n.summary) || ((r = (o = e.success) == null ? void 0 : o.metadata) == null ? void 0 : r.description) || "" : e.state === "rejected" ? ((s = e.rejected) == null ? void 0 : s.reason) || "Action annulée par l'utilisateur." : e.state === "failure" && (((a = e.failure) == null ? void 0 : a.summary) || ((d = e.failure) == null ? void 0 : d.error)) || "" : "";
2396
+ return e ? e.state === "success" ? ((n = e.success) == null ? void 0 : n.summary) || ((r = (o = e.success) == null ? void 0 : o.metadata) == null ? void 0 : r.description) || "" : e.state === "rejected" ? ((s = e.rejected) == null ? void 0 : s.reason) || "Action annulée par l'utilisateur." : e.state === "failure" && (((a = e.failure) == null ? void 0 : a.summary) || ((l = e.failure) == null ? void 0 : l.error)) || "" : "";
2332
2397
  },
2333
2398
  actionArtifact(t) {
2334
2399
  var n, o;
@@ -2337,7 +2402,7 @@ const hs = {
2337
2402
  },
2338
2403
  systemLabel(t) {
2339
2404
  var r, s, a;
2340
- const e = (r = t == null ? void 0 : t.payload) == null ? void 0 : r.event, n = hs[e] || (t == null ? void 0 : t.text_md) || "Mise à jour de la conversation", o = ((s = t == null ? void 0 : t.metadata) == null ? void 0 : s.agent_name) || ((a = t == null ? void 0 : t.author) == null ? void 0 : a.name) || "";
2405
+ const e = (r = t == null ? void 0 : t.payload) == null ? void 0 : r.event, n = As[e] || (t == null ? void 0 : t.text_md) || "Mise à jour de la conversation", o = ((s = t == null ? void 0 : t.metadata) == null ? void 0 : s.agent_name) || ((a = t == null ? void 0 : t.author) == null ? void 0 : a.name) || "";
2341
2406
  return n.replace("{name}", o || "Un agent");
2342
2407
  },
2343
2408
  scrollToBottom() {
@@ -2345,150 +2410,150 @@ const hs = {
2345
2410
  t && (t.scrollTop = t.scrollHeight);
2346
2411
  }
2347
2412
  }
2348
- }, ps = {
2413
+ }, Ms = {
2349
2414
  key: 0,
2350
2415
  class: "wm-list__loadMore",
2351
2416
  role: "status",
2352
2417
  "aria-live": "polite"
2353
- }, vs = {
2418
+ }, Os = {
2354
2419
  key: 1,
2355
2420
  class: "wm-list__historyEnd"
2356
- }, gs = {
2421
+ }, Is = {
2357
2422
  key: 2,
2358
2423
  class: "wm-list__sep"
2359
- }, ys = { class: "wm-list__sep-label" }, ws = {
2424
+ }, Bs = { class: "wm-list__sep-label" }, Es = {
2360
2425
  key: 0,
2361
2426
  class: "wm-list__sep wm-list__sep--unread"
2362
- }, bs = {
2427
+ }, $s = {
2363
2428
  key: 0,
2364
2429
  class: "wm-list__sysep"
2365
- }, ks = { class: "wm-list__sysep-label" }, Cs = ["data-row-key"], As = {
2430
+ }, Ns = { class: "wm-list__sysep-label" }, Ls = ["data-row-key"], Rs = {
2366
2431
  key: 0,
2367
2432
  class: "wm-list__avatarSlot"
2368
- }, Ss = {
2433
+ }, Fs = {
2369
2434
  key: 5,
2370
2435
  class: "wm-list__body"
2371
- }, xs = { key: 0 }, Ts = {
2436
+ }, Ds = { key: 0 }, js = {
2372
2437
  key: 1,
2373
2438
  "aria-hidden": "true"
2374
- }, Ms = { key: 2 }, Os = {
2439
+ }, Us = { key: 2 }, Ps = {
2375
2440
  key: 3,
2376
2441
  class: "wm-list__row wm-list__row--ai fade-up"
2377
- }, Is = { class: "wm-list__avatarSlot" };
2378
- function Bs(t, e, n, o, r, s) {
2379
- const a = B("AIAvatar"), d = B("HumanAvatar"), v = B("ActionResult"), k = B("ArtifactRenderer"), w = B("Bubble"), S = B("AttachmentPreview"), F = B("Typing");
2380
- return l(), c("div", {
2442
+ }, Hs = { class: "wm-list__avatarSlot" };
2443
+ function zs(t, e, n, o, r, s) {
2444
+ const a = I("AIAvatar"), l = I("HumanAvatar"), g = I("ActionResult"), C = I("ArtifactRenderer"), y = I("Bubble"), S = I("AttachmentPreview"), N = I("Typing");
2445
+ return d(), c("div", {
2381
2446
  ref: "scrollEl",
2382
2447
  class: E(["wm-list", { "wm-list--silent": r.silentFades }]),
2383
2448
  onScrollPassive: e[0] || (e[0] = (...A) => s.onScroll && s.onScroll(...A))
2384
2449
  }, [
2385
- n.loadingMore ? (l(), c("div", ps, [...e[1] || (e[1] = [
2450
+ n.loadingMore ? (d(), c("div", Ms, [...e[1] || (e[1] = [
2386
2451
  i("span", {
2387
2452
  class: "wm-list__loadMore-spinner",
2388
2453
  "aria-hidden": "true"
2389
2454
  }, null, -1),
2390
2455
  i("span", { class: "wm-list__loadMore-lbl" }, "Chargement de l'historique…", -1)
2391
- ])])) : s.historyExhausted ? (l(), c("div", vs, "Début de la conversation")) : y("", !0),
2392
- n.dateLabel ? (l(), c("div", gs, [
2456
+ ])])) : s.historyExhausted ? (d(), c("div", Os, "Début de la conversation")) : b("", !0),
2457
+ n.dateLabel ? (d(), c("div", Is, [
2393
2458
  e[2] || (e[2] = i("div", { class: "wm-list__line" }, null, -1)),
2394
- i("span", ys, b(n.dateLabel), 1),
2459
+ i("span", Bs, k(n.dateLabel), 1),
2395
2460
  e[3] || (e[3] = i("div", { class: "wm-list__line" }, null, -1))
2396
- ])) : y("", !0),
2397
- (l(!0), c(M, null, D(s.groups, (A, U) => (l(), c(M, {
2461
+ ])) : b("", !0),
2462
+ (d(!0), c(M, null, F(s.groups, (A, D) => (d(), c(M, {
2398
2463
  key: A.key
2399
2464
  }, [
2400
- A.key === s.unreadGroupKey ? (l(), c("div", ws, [...e[4] || (e[4] = [
2465
+ A.key === s.unreadGroupKey ? (d(), c("div", Es, [...e[4] || (e[4] = [
2401
2466
  i("div", { class: "wm-list__line wm-list__line--unread" }, null, -1),
2402
2467
  i("span", { class: "wm-list__sep-label wm-list__sep-label--unread" }, "Non lus", -1),
2403
2468
  i("div", { class: "wm-list__line wm-list__line--unread" }, null, -1)
2404
- ])])) : y("", !0),
2405
- A.role === "system" || A.items.length ? (l(), c("div", {
2469
+ ])])) : b("", !0),
2470
+ A.role === "system" || A.items.length ? (d(), c("div", {
2406
2471
  key: 1,
2407
2472
  class: E(["wm-list__group", "wm-list__group--" + A.role])
2408
2473
  }, [
2409
- A.role === "system" ? (l(), c("div", bs, [
2474
+ A.role === "system" ? (d(), c("div", $s, [
2410
2475
  e[5] || (e[5] = i("div", { class: "wm-list__line wm-list__line--strong" }, null, -1)),
2411
- i("span", ks, b(A.systemLabel), 1),
2476
+ i("span", Ns, k(A.systemLabel), 1),
2412
2477
  e[6] || (e[6] = i("div", { class: "wm-list__line wm-list__line--strong" }, null, -1))
2413
- ])) : (l(), c(M, { key: 1 }, [
2414
- (l(!0), c(M, null, D(A.items, (x, j) => (l(), c("div", {
2478
+ ])) : (d(), c(M, { key: 1 }, [
2479
+ (d(!0), c(M, null, F(A.items, (x, U) => (d(), c("div", {
2415
2480
  key: `${s.messageKey(x.message)}-${x.partKey}`,
2416
2481
  "data-row-key": `${s.messageKey(x.message)}-${x.partKey}`,
2417
2482
  class: E(["wm-list__row fade-up", ["wm-list__row--" + A.role, { "is-pending": x.message._pending, "is-failed": x.message._failed }]]),
2418
- style: G(s.cornersStyle(A, j))
2483
+ style: z(s.cornersStyle(A, U))
2419
2484
  }, [
2420
- A.role !== "user" ? (l(), c("div", As, [
2421
- j === A.items.length - 1 ? (l(), c(M, { key: 0 }, [
2422
- A.role === "ai" ? (l(), L(a, {
2485
+ A.role !== "user" ? (d(), c("div", Rs, [
2486
+ U === A.items.length - 1 ? (d(), c(M, { key: 0 }, [
2487
+ A.role === "ai" ? (d(), L(a, {
2423
2488
  key: 0,
2424
2489
  size: 26,
2425
2490
  tail: !0
2426
- })) : (l(), L(d, {
2491
+ })) : (d(), L(l, {
2427
2492
  key: 1,
2428
2493
  name: A.agentName,
2429
2494
  "avatar-url": A.agentAvatarUrl,
2430
2495
  size: 26
2431
2496
  }, null, 8, ["name", "avatar-url"]))
2432
- ], 64)) : y("", !0)
2433
- ])) : y("", !0),
2434
- x.renderAs === "action" ? (l(), L(v, {
2497
+ ], 64)) : b("", !0)
2498
+ ])) : b("", !0),
2499
+ x.renderAs === "action" ? (d(), L(g, {
2435
2500
  key: 1,
2436
2501
  state: x.message.payload.state,
2437
2502
  label: s.actionLabel(x.message),
2438
2503
  detail: s.actionDetail(x.message)
2439
- }, null, 8, ["state", "label", "detail"])) : x.renderAs === "admin-pending" ? (l(), L(v, {
2504
+ }, null, 8, ["state", "label", "detail"])) : x.renderAs === "admin-pending" ? (d(), L(g, {
2440
2505
  key: 2,
2441
2506
  state: "awaiting",
2442
2507
  label: "Demande d'approbation envoyée",
2443
2508
  detail: x.message.text_md || ""
2444
- }, null, 8, ["detail"])) : x.renderAs === "artifact-of-action" ? (l(), L(k, {
2509
+ }, null, 8, ["detail"])) : x.renderAs === "artifact-of-action" ? (d(), L(C, {
2445
2510
  key: 3,
2446
2511
  artifact: s.actionArtifact(x.message)
2447
- }, null, 8, ["artifact"])) : x.renderAs === "artifact" ? (l(), L(k, {
2512
+ }, null, 8, ["artifact"])) : x.renderAs === "artifact" ? (d(), L(C, {
2448
2513
  key: 4,
2449
2514
  artifact: s.artifactOf(x.message)
2450
- }, null, 8, ["artifact"])) : (l(), c("div", Ss, [
2451
- x.message.text_md ? (l(), L(w, {
2515
+ }, null, 8, ["artifact"])) : (d(), c("div", Fs, [
2516
+ x.message.text_md ? (d(), L(y, {
2452
2517
  key: 0,
2453
2518
  role: A.role,
2454
2519
  text: x.message.text_md
2455
- }, null, 8, ["role", "text"])) : y("", !0),
2456
- s.attachmentsOf(x.message).length ? (l(), c("div", {
2520
+ }, null, 8, ["role", "text"])) : b("", !0),
2521
+ s.attachmentsOf(x.message).length ? (d(), c("div", {
2457
2522
  key: 1,
2458
2523
  class: E(["wm-list__atts", { "wm-list__atts--align-end": A.role === "user" }])
2459
2524
  }, [
2460
- (l(!0), c(M, null, D(s.attachmentsOf(x.message), (P, R) => (l(), L(S, {
2525
+ (d(!0), c(M, null, F(s.attachmentsOf(x.message), (P, R) => (d(), L(S, {
2461
2526
  key: `${s.messageKey(x.message)}-att-${R}`,
2462
2527
  attachment: P
2463
2528
  }, null, 8, ["attachment"]))), 128))
2464
- ], 2)) : y("", !0)
2529
+ ], 2)) : b("", !0)
2465
2530
  ]))
2466
- ], 14, Cs))), 128)),
2467
- (A.role !== "user" || s.lastTimeOf(A)) && !s.hasTrailingOverlay(A) ? (l(), c("div", {
2531
+ ], 14, Ls))), 128)),
2532
+ (A.role !== "user" || s.lastTimeOf(A)) && !s.hasTrailingOverlay(A) ? (d(), c("div", {
2468
2533
  key: 0,
2469
2534
  class: E(["wm-list__meta", { "wm-list__meta--right": A.role === "user" }])
2470
2535
  }, [
2471
- A.role !== "user" ? (l(), c("span", xs, b(s.roleLabel(A)), 1)) : y("", !0),
2472
- A.role !== "user" && s.lastTimeOf(A) ? (l(), c("span", Ts, "·")) : y("", !0),
2473
- s.lastTimeOf(A) ? (l(), c("span", Ms, b(s.lastTimeOf(A)), 1)) : y("", !0)
2474
- ], 2)) : y("", !0)
2536
+ A.role !== "user" ? (d(), c("span", Ds, k(s.roleLabel(A)), 1)) : b("", !0),
2537
+ A.role !== "user" && s.lastTimeOf(A) ? (d(), c("span", js, "·")) : b("", !0),
2538
+ s.lastTimeOf(A) ? (d(), c("span", Us, k(s.lastTimeOf(A)), 1)) : b("", !0)
2539
+ ], 2)) : b("", !0)
2475
2540
  ], 64))
2476
- ], 2)) : y("", !0)
2541
+ ], 2)) : b("", !0)
2477
2542
  ], 64))), 128)),
2478
- n.streamingActive ? (l(), c("div", Os, [
2479
- i("div", Is, [
2543
+ n.streamingActive ? (d(), c("div", Ps, [
2544
+ i("div", Hs, [
2480
2545
  K(a, {
2481
2546
  size: 26,
2482
2547
  tail: !0
2483
2548
  })
2484
2549
  ]),
2485
- K(F)
2486
- ])) : y("", !0)
2550
+ K(N)
2551
+ ])) : b("", !0)
2487
2552
  ], 34);
2488
2553
  }
2489
- const Es = /* @__PURE__ */ $(_s, [["render", Bs], ["__scopeId", "data-v-54959b73"]]), oe = typeof navigator < "u" && !!navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia == "function", he = typeof window < "u" && typeof window.MediaRecorder < "u";
2490
- function $s() {
2491
- return he && [
2554
+ const Vs = /* @__PURE__ */ $(Ts, [["render", zs], ["__scopeId", "data-v-54959b73"]]), le = typeof navigator < "u" && !!navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia == "function", me = typeof window < "u" && typeof window.MediaRecorder < "u";
2555
+ function qs() {
2556
+ return me && [
2492
2557
  "video/webm;codecs=vp9,opus",
2493
2558
  "video/webm;codecs=vp8,opus",
2494
2559
  "video/webm",
@@ -2507,11 +2572,11 @@ function Ce({ audio: t }) {
2507
2572
  systemAudio: t ? "include" : "exclude"
2508
2573
  };
2509
2574
  }
2510
- function na(t) {
2575
+ function fa(t) {
2511
2576
  return t ? t.startsWith("image/") ? "image" : t.startsWith("video/") ? "video" : "file" : "file";
2512
2577
  }
2513
- async function Ls() {
2514
- if (!oe) return null;
2578
+ async function Ws() {
2579
+ if (!le) return null;
2515
2580
  let t;
2516
2581
  try {
2517
2582
  t = await navigator.mediaDevices.getDisplayMedia(Ce({ audio: !1 }));
@@ -2519,7 +2584,7 @@ async function Ls() {
2519
2584
  return (e == null ? void 0 : e.name) !== "NotAllowedError" && console.error("[media] screenshot picker", e), null;
2520
2585
  }
2521
2586
  try {
2522
- return await Rs(t);
2587
+ return await Ks(t);
2523
2588
  } catch (e) {
2524
2589
  return console.error("[media] screenshot capture", e), null;
2525
2590
  } finally {
@@ -2528,78 +2593,78 @@ async function Ls() {
2528
2593
  });
2529
2594
  }
2530
2595
  }
2531
- async function Rs(t) {
2596
+ async function Ks(t) {
2532
2597
  const e = document.createElement("video");
2533
- e.muted = !0, e.playsInline = !0, e.srcObject = t, await e.play(), await new Promise((d) => requestAnimationFrame(d));
2598
+ e.muted = !0, e.playsInline = !0, e.srcObject = t, await e.play(), await new Promise((l) => requestAnimationFrame(l));
2534
2599
  const n = e.videoWidth || 1280, o = e.videoHeight || 720, r = document.createElement("canvas");
2535
2600
  r.width = n, r.height = o, r.getContext("2d").drawImage(e, 0, 0, n, o);
2536
- const s = await new Promise((d, v) => {
2537
- r.toBlob((k) => k ? d(k) : v(new Error("toBlob failed")), "image/png");
2601
+ const s = await new Promise((l, g) => {
2602
+ r.toBlob((C) => C ? l(C) : g(new Error("toBlob failed")), "image/png");
2538
2603
  }), a = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
2539
2604
  return new File([s], `capture-${a}.png`, { type: "image/png" });
2540
2605
  }
2541
- async function Fs(t = {}) {
2542
- var k;
2543
- if (!oe || !he) return null;
2606
+ async function Gs(t = {}) {
2607
+ var C;
2608
+ if (!le || !me) return null;
2544
2609
  let e;
2545
2610
  try {
2546
2611
  e = await navigator.mediaDevices.getDisplayMedia(Ce({ audio: !0 }));
2547
- } catch (w) {
2548
- return (w == null ? void 0 : w.name) !== "NotAllowedError" && console.error("[media] record picker", w), null;
2612
+ } catch (y) {
2613
+ return (y == null ? void 0 : y.name) !== "NotAllowedError" && console.error("[media] record picker", y), null;
2549
2614
  }
2550
- const n = $s();
2615
+ const n = qs();
2551
2616
  let o;
2552
2617
  try {
2553
2618
  o = n ? new window.MediaRecorder(e, { mimeType: n }) : new window.MediaRecorder(e);
2554
- } catch (w) {
2555
- return console.error("[media] recorder init", w), e.getTracks().forEach((S) => {
2619
+ } catch (y) {
2620
+ return console.error("[media] recorder init", y), e.getTracks().forEach((S) => {
2556
2621
  S.stop();
2557
2622
  }), null;
2558
2623
  }
2559
2624
  const r = [];
2560
2625
  let s = null, a = !1;
2561
- o.addEventListener("dataavailable", (w) => {
2562
- w.data && w.data.size > 0 && r.push(w.data);
2626
+ o.addEventListener("dataavailable", (y) => {
2627
+ y.data && y.data.size > 0 && r.push(y.data);
2563
2628
  }), o.addEventListener("stop", () => {
2564
- var w, S;
2565
- if (s && clearInterval(s), e.getTracks().forEach((F) => {
2566
- F.stop();
2629
+ var y, S;
2630
+ if (s && clearInterval(s), e.getTracks().forEach((N) => {
2631
+ N.stop();
2567
2632
  }), r.length) {
2568
- const F = o.mimeType || n || "video/webm", A = new Blob(r, { type: F }), U = /mp4/.test(F) ? "mp4" : "webm", x = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), j = new File([A], `ecran-${x}.${U}`, { type: F });
2569
- (w = t.onfinalize) == null || w.call(t, j);
2633
+ const N = o.mimeType || n || "video/webm", A = new Blob(r, { type: N }), D = /mp4/.test(N) ? "mp4" : "webm", x = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), U = new File([A], `ecran-${x}.${D}`, { type: N });
2634
+ (y = t.onfinalize) == null || y.call(t, U);
2570
2635
  } else
2571
2636
  (S = t.oncancel) == null || S.call(t);
2572
- }), e.getVideoTracks().forEach((w) => {
2573
- w.addEventListener("ended", () => d(), { once: !0 });
2637
+ }), e.getVideoTracks().forEach((y) => {
2638
+ y.addEventListener("ended", () => l(), { once: !0 });
2574
2639
  });
2575
- function d() {
2640
+ function l() {
2576
2641
  if (!a && (a = !0, o.state !== "inactive"))
2577
2642
  try {
2578
2643
  o.stop();
2579
- } catch (w) {
2580
- console.error("[media] recorder stop", w);
2644
+ } catch (y) {
2645
+ console.error("[media] recorder stop", y);
2581
2646
  }
2582
2647
  }
2583
2648
  try {
2584
2649
  o.start(1e3);
2585
- } catch (w) {
2586
- return console.error("[media] recorder start", w), e.getTracks().forEach((S) => {
2650
+ } catch (y) {
2651
+ return console.error("[media] recorder start", y), e.getTracks().forEach((S) => {
2587
2652
  S.stop();
2588
2653
  }), null;
2589
2654
  }
2590
- (k = t.onstart) == null || k.call(t);
2591
- const v = Date.now();
2655
+ (C = t.onstart) == null || C.call(t);
2656
+ const g = Date.now();
2592
2657
  return s = setInterval(() => {
2593
- var w;
2594
- (w = t.ontick) == null || w.call(t, Date.now() - v);
2658
+ var y;
2659
+ (y = t.ontick) == null || y.call(t, Date.now() - g);
2595
2660
  }, 500), {
2596
- stop: d,
2661
+ stop: l,
2597
2662
  get state() {
2598
2663
  return o.state;
2599
2664
  }
2600
2665
  };
2601
2666
  }
2602
- const Ds = [
2667
+ const Ys = [
2603
2668
  {
2604
2669
  action: "file",
2605
2670
  label: "Joindre un fichier",
@@ -2615,7 +2680,7 @@ const Ds = [
2615
2680
  label: "Enregistrer l'écran",
2616
2681
  path: "M23 7l-7 5 7 5V7z M1 5a2 2 0 012-2h12a2 2 0 012 2v14a2 2 0 01-2 2H3a2 2 0 01-2-2V5z"
2617
2682
  }
2618
- ], Ns = {
2683
+ ], Js = {
2619
2684
  name: "WmComposer",
2620
2685
  props: {
2621
2686
  modelValue: { type: String, default: "" },
@@ -2638,9 +2703,9 @@ const Ds = [
2638
2703
  return !this.disabled && !!this.local.trim();
2639
2704
  },
2640
2705
  attachItems() {
2641
- return Ds.map((t) => ({
2706
+ return Ys.map((t) => ({
2642
2707
  ...t,
2643
- disabled: t.action === "screenshot" && !oe || t.action === "record" && (!oe || !he)
2708
+ disabled: t.action === "screenshot" && !le || t.action === "record" && (!le || !me)
2644
2709
  }));
2645
2710
  },
2646
2711
  recordingElapsedLabel() {
@@ -2710,13 +2775,13 @@ const Ds = [
2710
2775
  },
2711
2776
  async captureScreenshot() {
2712
2777
  if (this.disabled) return;
2713
- const t = await Ls();
2778
+ const t = await Ws();
2714
2779
  t && this.$emit("attach", t);
2715
2780
  },
2716
2781
  async startRecording() {
2717
2782
  if (this.recording || this.disabled) return;
2718
2783
  this.recordingElapsed = 0;
2719
- const t = await Fs({
2784
+ const t = await Gs({
2720
2785
  onstart: () => {
2721
2786
  this.recording = !0;
2722
2787
  },
@@ -2741,36 +2806,36 @@ const Ds = [
2741
2806
  }
2742
2807
  }
2743
2808
  }
2744
- }, js = { class: "wm-compose-wrap" }, Us = {
2809
+ }, Xs = { class: "wm-compose-wrap" }, Zs = {
2745
2810
  key: 0,
2746
2811
  class: "wm-rec"
2747
- }, Ps = { class: "wm-rec__lbl" }, Hs = {
2812
+ }, Qs = { class: "wm-rec__lbl" }, er = {
2748
2813
  key: 1,
2749
2814
  class: "wm-compose__menu",
2750
2815
  role: "menu"
2751
- }, zs = ["disabled", "onClick"], Vs = { class: "wm-compose__menuIcon" }, qs = {
2816
+ }, tr = ["disabled", "onClick"], nr = { class: "wm-compose__menuIcon" }, sr = {
2752
2817
  viewBox: "0 0 24 24",
2753
2818
  width: "14",
2754
2819
  height: "14",
2755
2820
  "aria-hidden": "true"
2756
- }, Ws = ["d"], Ks = ["placeholder", "disabled"], Gs = { class: "wm-compose__actions" }, Ys = ["title", "aria-label", "disabled"], Js = ["disabled"];
2757
- function Xs(t, e, n, o, r, s) {
2758
- return l(), c("div", js, [
2759
- r.recording ? (l(), c("div", Us, [
2821
+ }, rr = ["d"], ir = ["placeholder", "disabled"], ar = { class: "wm-compose__actions" }, or = ["title", "aria-label", "disabled"], lr = ["disabled"];
2822
+ function dr(t, e, n, o, r, s) {
2823
+ return d(), c("div", Xs, [
2824
+ r.recording ? (d(), c("div", Zs, [
2760
2825
  e[8] || (e[8] = i("span", {
2761
2826
  class: "wm-rec__dot",
2762
2827
  "aria-hidden": "true"
2763
2828
  }, null, -1)),
2764
- i("span", Ps, "Enregistrement · " + b(s.recordingElapsedLabel), 1),
2829
+ i("span", Qs, "Enregistrement · " + k(s.recordingElapsedLabel), 1),
2765
2830
  i("button", {
2766
2831
  type: "button",
2767
2832
  class: "wm-rec__stop",
2768
2833
  onClick: e[0] || (e[0] = (...a) => s.stopRecording && s.stopRecording(...a))
2769
2834
  }, "Arrêter")
2770
- ])) : y("", !0),
2835
+ ])) : b("", !0),
2771
2836
  i("form", {
2772
2837
  class: E(["wm-compose", { "has-attach": r.attachOpen }]),
2773
- onSubmit: e[7] || (e[7] = X((...a) => s.onSubmit && s.onSubmit(...a), ["prevent"]))
2838
+ onSubmit: e[7] || (e[7] = Y((...a) => s.onSubmit && s.onSubmit(...a), ["prevent"]))
2774
2839
  }, [
2775
2840
  i("input", {
2776
2841
  ref: "fileEl",
@@ -2779,21 +2844,21 @@ function Xs(t, e, n, o, r, s) {
2779
2844
  multiple: "",
2780
2845
  onChange: e[1] || (e[1] = (...a) => s.onFile && s.onFile(...a))
2781
2846
  }, null, 544),
2782
- r.attachOpen ? (l(), c("div", {
2847
+ r.attachOpen ? (d(), c("div", {
2783
2848
  key: 0,
2784
2849
  class: "wm-compose__overlay",
2785
2850
  onClick: e[2] || (e[2] = (a) => r.attachOpen = !1)
2786
- })) : y("", !0),
2787
- r.attachOpen ? (l(), c("div", Hs, [
2788
- (l(!0), c(M, null, D(s.attachItems, (a) => (l(), c("button", {
2851
+ })) : b("", !0),
2852
+ r.attachOpen ? (d(), c("div", er, [
2853
+ (d(!0), c(M, null, F(s.attachItems, (a) => (d(), c("button", {
2789
2854
  key: a.action,
2790
2855
  type: "button",
2791
2856
  class: "wm-compose__menuItem",
2792
2857
  disabled: a.disabled,
2793
- onClick: (d) => s.onAttachAction(a.action)
2858
+ onClick: (l) => s.onAttachAction(a.action)
2794
2859
  }, [
2795
- i("span", Vs, [
2796
- (l(), c("svg", qs, [
2860
+ i("span", nr, [
2861
+ (d(), c("svg", sr, [
2797
2862
  i("path", {
2798
2863
  d: a.path,
2799
2864
  stroke: "currentColor",
@@ -2801,13 +2866,13 @@ function Xs(t, e, n, o, r, s) {
2801
2866
  "stroke-linecap": "round",
2802
2867
  "stroke-linejoin": "round",
2803
2868
  fill: "none"
2804
- }, null, 8, Ws)
2869
+ }, null, 8, rr)
2805
2870
  ]))
2806
2871
  ]),
2807
- i("span", null, b(a.label), 1)
2808
- ], 8, zs))), 128))
2809
- ])) : y("", !0),
2810
- q(i("textarea", {
2872
+ i("span", null, k(a.label), 1)
2873
+ ], 8, tr))), 128))
2874
+ ])) : b("", !0),
2875
+ W(i("textarea", {
2811
2876
  ref: "inputEl",
2812
2877
  "onUpdate:modelValue": e[3] || (e[3] = (a) => r.local = a),
2813
2878
  class: "wm-compose__input",
@@ -2816,10 +2881,10 @@ function Xs(t, e, n, o, r, s) {
2816
2881
  disabled: n.disabled,
2817
2882
  onKeydown: e[4] || (e[4] = (...a) => s.onKeydown && s.onKeydown(...a)),
2818
2883
  onInput: e[5] || (e[5] = (...a) => s.autosize && s.autosize(...a))
2819
- }, null, 40, Ks), [
2820
- [J, r.local]
2884
+ }, null, 40, ir), [
2885
+ [Z, r.local]
2821
2886
  ]),
2822
- i("div", Gs, [
2887
+ i("div", ar, [
2823
2888
  i("button", {
2824
2889
  type: "button",
2825
2890
  class: E(["wm-compose__icon", { "is-open": r.attachOpen }]),
@@ -2841,7 +2906,7 @@ function Xs(t, e, n, o, r, s) {
2841
2906
  }, [
2842
2907
  i("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48" })
2843
2908
  ], -1)
2844
- ])], 10, Ys),
2909
+ ])], 10, or),
2845
2910
  i("button", {
2846
2911
  type: "submit",
2847
2912
  class: E(["wm-compose__send", { "is-empty": !s.canSend }]),
@@ -2861,12 +2926,12 @@ function Xs(t, e, n, o, r, s) {
2861
2926
  }, [
2862
2927
  i("path", { d: "M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z" })
2863
2928
  ], -1)
2864
- ])], 10, Js)
2929
+ ])], 10, lr)
2865
2930
  ])
2866
2931
  ], 34)
2867
2932
  ]);
2868
2933
  }
2869
- const Zs = /* @__PURE__ */ $(Ns, [["render", Xs], ["__scopeId", "data-v-14fa9ec0"]]), Qs = {
2934
+ const cr = /* @__PURE__ */ $(Js, [["render", dr], ["__scopeId", "data-v-14fa9ec0"]]), ur = {
2870
2935
  name: "WmSuggestionChips",
2871
2936
  props: {
2872
2937
  items: { type: Array, default: () => [] },
@@ -2883,22 +2948,22 @@ const Zs = /* @__PURE__ */ $(Ns, [["render", Xs], ["__scopeId", "data-v-14fa9ec0
2883
2948
  return this.items.map((t) => (t == null ? void 0 : t.label) || (t == null ? void 0 : t.text) || "").join("§");
2884
2949
  }
2885
2950
  }
2886
- }, er = ["onClick"];
2887
- function tr(t, e, n, o, r, s) {
2888
- return n.items.length ? (l(), c("div", {
2951
+ }, hr = ["onClick"];
2952
+ function mr(t, e, n, o, r, s) {
2953
+ return n.items.length ? (d(), c("div", {
2889
2954
  key: s.batchKey,
2890
2955
  class: "wm-chips"
2891
2956
  }, [
2892
- (l(!0), c(M, null, D(n.items, (a, d) => (l(), c("button", {
2893
- key: d,
2957
+ (d(!0), c(M, null, F(n.items, (a, l) => (d(), c("button", {
2958
+ key: l,
2894
2959
  type: "button",
2895
2960
  class: "wm-chip",
2896
- style: G({ animationDelay: n.baseDelay + d * n.stepDelay + "ms" }),
2897
- onClick: (v) => t.$emit("select", a)
2898
- }, b(a.label), 13, er))), 128))
2899
- ])) : y("", !0);
2961
+ style: z({ animationDelay: n.baseDelay + l * n.stepDelay + "ms" }),
2962
+ onClick: (g) => t.$emit("select", a)
2963
+ }, k(a.label), 13, hr))), 128))
2964
+ ])) : b("", !0);
2900
2965
  }
2901
- const nr = /* @__PURE__ */ $(Qs, [["render", tr], ["__scopeId", "data-v-55aa529d"]]), sr = {
2966
+ const fr = /* @__PURE__ */ $(ur, [["render", mr], ["__scopeId", "data-v-55aa529d"]]), _r = {
2902
2967
  name: "WmApprovalCard",
2903
2968
  components: { AIAvatar: ne },
2904
2969
  props: {
@@ -2931,41 +2996,41 @@ const nr = /* @__PURE__ */ $(Qs, [["render", tr], ["__scopeId", "data-v-55aa529d
2931
2996
  return ((t = this.rejectCallback) == null ? void 0 : t.label) || "Refuser";
2932
2997
  }
2933
2998
  }
2934
- }, rr = { class: "wm-approval" }, ir = { class: "wm-approval__head" }, ar = { class: "wm-approval__icon" }, or = { class: "wm-approval__main" }, lr = { class: "wm-approval__title" }, dr = {
2999
+ }, pr = { class: "wm-approval" }, gr = { class: "wm-approval__head" }, vr = { class: "wm-approval__icon" }, yr = { class: "wm-approval__main" }, wr = { class: "wm-approval__title" }, br = {
2935
3000
  key: 0,
2936
3001
  class: "wm-approval__detail"
2937
- }, cr = { class: "wm-approval__actions" };
2938
- function ur(t, e, n, o, r, s) {
2939
- const a = B("AIAvatar");
2940
- return l(), c("div", rr, [
2941
- i("div", ir, [
2942
- i("div", ar, [
3002
+ }, kr = { class: "wm-approval__actions" };
3003
+ function Cr(t, e, n, o, r, s) {
3004
+ const a = I("AIAvatar");
3005
+ return d(), c("div", pr, [
3006
+ i("div", gr, [
3007
+ i("div", vr, [
2943
3008
  K(a, { size: 24 })
2944
3009
  ]),
2945
- i("div", or, [
2946
- i("div", lr, b(n.action), 1),
2947
- n.detail ? (l(), c("div", dr, b(n.detail), 1)) : y("", !0)
3010
+ i("div", yr, [
3011
+ i("div", wr, k(n.action), 1),
3012
+ n.detail ? (d(), c("div", br, k(n.detail), 1)) : b("", !0)
2948
3013
  ])
2949
3014
  ]),
2950
- i("div", cr, [
2951
- s.rejectId ? (l(), c("button", {
3015
+ i("div", kr, [
3016
+ s.rejectId ? (d(), c("button", {
2952
3017
  key: 0,
2953
3018
  type: "button",
2954
3019
  class: "wm-approval__btn wm-approval__btn--neutral",
2955
- onClick: e[0] || (e[0] = (d) => t.$emit("callback", s.rejectId))
2956
- }, b(s.rejectLabel), 1)) : y("", !0),
2957
- s.approveId ? (l(), c("button", {
3020
+ onClick: e[0] || (e[0] = (l) => t.$emit("callback", s.rejectId))
3021
+ }, k(s.rejectLabel), 1)) : b("", !0),
3022
+ s.approveId ? (d(), c("button", {
2958
3023
  key: 1,
2959
3024
  type: "button",
2960
3025
  class: "wm-approval__btn wm-approval__btn--primary",
2961
- onClick: e[1] || (e[1] = (d) => t.$emit("callback", s.approveId))
2962
- }, b(s.approveLabel), 1)) : y("", !0)
3026
+ onClick: e[1] || (e[1] = (l) => t.$emit("callback", s.approveId))
3027
+ }, k(s.approveLabel), 1)) : b("", !0)
2963
3028
  ])
2964
3029
  ]);
2965
3030
  }
2966
- const hr = /* @__PURE__ */ $(sr, [["render", ur], ["__scopeId", "data-v-b1be139c"]]);
3031
+ const Ar = /* @__PURE__ */ $(_r, [["render", Cr], ["__scopeId", "data-v-b1be139c"]]);
2967
3032
  let ve = 0;
2968
- const mr = /* @__PURE__ */ new Set([
3033
+ const Sr = /* @__PURE__ */ new Set([
2969
3034
  "text",
2970
3035
  "textarea",
2971
3036
  "number",
@@ -2973,7 +3038,7 @@ const mr = /* @__PURE__ */ new Set([
2973
3038
  "select",
2974
3039
  "multiselect",
2975
3040
  "date"
2976
- ]), fr = {
3041
+ ]), xr = {
2977
3042
  name: "WmFormCard",
2978
3043
  components: { AIAvatar: ne },
2979
3044
  props: {
@@ -2996,7 +3061,7 @@ const mr = /* @__PURE__ */ new Set([
2996
3061
  // douteux.
2997
3062
  normalizedFields() {
2998
3063
  var e;
2999
- return (Array.isArray((e = this.form) == null ? void 0 : e.fields) ? this.form.fields : []).filter((n) => !(!(n != null && n.key) || !(n != null && n.label) || !mr.has(n == null ? void 0 : n.type) || (n.type === "select" || n.type === "multiselect") && (!Array.isArray(n.options) || n.options.length === 0)));
3064
+ return (Array.isArray((e = this.form) == null ? void 0 : e.fields) ? this.form.fields : []).filter((n) => !(!(n != null && n.key) || !(n != null && n.label) || !Sr.has(n == null ? void 0 : n.type) || (n.type === "select" || n.type === "multiselect") && (!Array.isArray(n.options) || n.options.length === 0)));
3000
3065
  }
3001
3066
  },
3002
3067
  created() {
@@ -3047,163 +3112,163 @@ const mr = /* @__PURE__ */ new Set([
3047
3112
  }
3048
3113
  }
3049
3114
  }
3050
- }, _r = { class: "wm-form" }, pr = { class: "wm-form__head" }, vr = { class: "wm-form__icon" }, gr = { class: "wm-form__main" }, yr = { class: "wm-form__title" }, wr = {
3115
+ }, Tr = { class: "wm-form" }, Mr = { class: "wm-form__head" }, Or = { class: "wm-form__icon" }, Ir = { class: "wm-form__main" }, Br = { class: "wm-form__title" }, Er = {
3051
3116
  key: 0,
3052
3117
  class: "wm-form__detail"
3053
- }, br = ["for"], kr = {
3118
+ }, $r = ["for"], Nr = {
3054
3119
  key: 0,
3055
3120
  class: "wm-form__req",
3056
3121
  "aria-hidden": "true"
3057
- }, Cr = ["id", "onUpdate:modelValue", "placeholder", "required", "disabled"], Ar = ["id", "onUpdate:modelValue", "placeholder", "required", "disabled"], Sr = ["id", "onUpdate:modelValue", "placeholder", "required", "disabled"], xr = ["id", "onUpdate:modelValue", "required", "disabled"], Tr = {
3122
+ }, Lr = ["id", "onUpdate:modelValue", "placeholder", "required", "disabled"], Rr = ["id", "onUpdate:modelValue", "placeholder", "required", "disabled"], Fr = ["id", "onUpdate:modelValue", "placeholder", "required", "disabled"], Dr = ["id", "onUpdate:modelValue", "required", "disabled"], jr = {
3058
3123
  key: 4,
3059
3124
  class: "wm-form__bool"
3060
- }, Mr = ["id", "onUpdate:modelValue", "disabled"], Or = ["id", "onUpdate:modelValue", "required", "disabled"], Ir = {
3125
+ }, Ur = ["id", "onUpdate:modelValue", "disabled"], Pr = ["id", "onUpdate:modelValue", "required", "disabled"], Hr = {
3061
3126
  value: "",
3062
3127
  disabled: ""
3063
- }, Br = ["value"], Er = {
3128
+ }, zr = ["value"], Vr = {
3064
3129
  key: 6,
3065
3130
  class: "wm-form__multi"
3066
- }, $r = ["value", "checked", "disabled", "onChange"], Lr = {
3131
+ }, qr = ["value", "checked", "disabled", "onChange"], Wr = {
3067
3132
  key: 0,
3068
3133
  class: "wm-form__err"
3069
- }, Rr = ["disabled"], Fr = {
3134
+ }, Kr = ["disabled"], Gr = {
3070
3135
  key: 0,
3071
3136
  class: "wm-form__spinner",
3072
3137
  "aria-hidden": "true"
3073
- }, Dr = {
3138
+ }, Yr = {
3074
3139
  key: 2,
3075
3140
  class: "wm-form__doneLbl"
3076
3141
  };
3077
- function Nr(t, e, n, o, r, s) {
3078
- const a = B("AIAvatar");
3079
- return l(), c("div", _r, [
3080
- i("div", pr, [
3081
- i("div", vr, [
3142
+ function Jr(t, e, n, o, r, s) {
3143
+ const a = I("AIAvatar");
3144
+ return d(), c("div", Tr, [
3145
+ i("div", Mr, [
3146
+ i("div", Or, [
3082
3147
  K(a, { size: 24 })
3083
3148
  ]),
3084
- i("div", gr, [
3085
- i("div", yr, b(n.form.title || "Formulaire"), 1),
3086
- n.form.description ? (l(), c("div", wr, b(n.form.description), 1)) : y("", !0)
3149
+ i("div", Ir, [
3150
+ i("div", Br, k(n.form.title || "Formulaire"), 1),
3151
+ n.form.description ? (d(), c("div", Er, k(n.form.description), 1)) : b("", !0)
3087
3152
  ])
3088
3153
  ]),
3089
3154
  i("form", {
3090
3155
  class: "wm-form__body",
3091
- onSubmit: e[0] || (e[0] = X((...d) => s.onSubmit && s.onSubmit(...d), ["prevent"]))
3156
+ onSubmit: e[0] || (e[0] = Y((...l) => s.onSubmit && s.onSubmit(...l), ["prevent"]))
3092
3157
  }, [
3093
- (l(!0), c(M, null, D(s.normalizedFields, (d) => (l(), c("div", {
3094
- key: d.key,
3158
+ (d(!0), c(M, null, F(s.normalizedFields, (l) => (d(), c("div", {
3159
+ key: l.key,
3095
3160
  class: "wm-form__field"
3096
3161
  }, [
3097
3162
  i("label", {
3098
- for: `wm-f-${r._uid}-${d.key}`,
3163
+ for: `wm-f-${r._uid}-${l.key}`,
3099
3164
  class: "wm-form__label"
3100
3165
  }, [
3101
- te(b(d.label), 1),
3102
- d.required ? (l(), c("span", kr, "*")) : y("", !0)
3103
- ], 8, br),
3104
- d.type === "text" ? q((l(), c("input", {
3166
+ te(k(l.label), 1),
3167
+ l.required ? (d(), c("span", Nr, "*")) : b("", !0)
3168
+ ], 8, $r),
3169
+ l.type === "text" ? W((d(), c("input", {
3105
3170
  key: 0,
3106
- id: `wm-f-${r._uid}-${d.key}`,
3107
- "onUpdate:modelValue": (v) => r.values[d.key] = v,
3171
+ id: `wm-f-${r._uid}-${l.key}`,
3172
+ "onUpdate:modelValue": (g) => r.values[l.key] = g,
3108
3173
  type: "text",
3109
3174
  class: "wm-form__input",
3110
- placeholder: d.placeholder || "",
3111
- required: d.required,
3175
+ placeholder: l.placeholder || "",
3176
+ required: l.required,
3112
3177
  disabled: n.readOnly || r.busy
3113
- }, null, 8, Cr)), [
3114
- [J, r.values[d.key]]
3115
- ]) : d.type === "textarea" ? q((l(), c("textarea", {
3178
+ }, null, 8, Lr)), [
3179
+ [Z, r.values[l.key]]
3180
+ ]) : l.type === "textarea" ? W((d(), c("textarea", {
3116
3181
  key: 1,
3117
- id: `wm-f-${r._uid}-${d.key}`,
3118
- "onUpdate:modelValue": (v) => r.values[d.key] = v,
3182
+ id: `wm-f-${r._uid}-${l.key}`,
3183
+ "onUpdate:modelValue": (g) => r.values[l.key] = g,
3119
3184
  class: "wm-form__textarea",
3120
3185
  rows: "3",
3121
- placeholder: d.placeholder || "",
3122
- required: d.required,
3186
+ placeholder: l.placeholder || "",
3187
+ required: l.required,
3123
3188
  disabled: n.readOnly || r.busy
3124
- }, null, 8, Ar)), [
3125
- [J, r.values[d.key]]
3126
- ]) : d.type === "number" ? q((l(), c("input", {
3189
+ }, null, 8, Rr)), [
3190
+ [Z, r.values[l.key]]
3191
+ ]) : l.type === "number" ? W((d(), c("input", {
3127
3192
  key: 2,
3128
- id: `wm-f-${r._uid}-${d.key}`,
3129
- "onUpdate:modelValue": (v) => r.values[d.key] = v,
3193
+ id: `wm-f-${r._uid}-${l.key}`,
3194
+ "onUpdate:modelValue": (g) => r.values[l.key] = g,
3130
3195
  type: "number",
3131
3196
  class: "wm-form__input",
3132
- placeholder: d.placeholder || "",
3133
- required: d.required,
3197
+ placeholder: l.placeholder || "",
3198
+ required: l.required,
3134
3199
  disabled: n.readOnly || r.busy
3135
- }, null, 8, Sr)), [
3200
+ }, null, 8, Fr)), [
3136
3201
  [
3137
- J,
3138
- r.values[d.key],
3202
+ Z,
3203
+ r.values[l.key],
3139
3204
  void 0,
3140
3205
  { number: !0 }
3141
3206
  ]
3142
- ]) : d.type === "date" ? q((l(), c("input", {
3207
+ ]) : l.type === "date" ? W((d(), c("input", {
3143
3208
  key: 3,
3144
- id: `wm-f-${r._uid}-${d.key}`,
3145
- "onUpdate:modelValue": (v) => r.values[d.key] = v,
3209
+ id: `wm-f-${r._uid}-${l.key}`,
3210
+ "onUpdate:modelValue": (g) => r.values[l.key] = g,
3146
3211
  type: "date",
3147
3212
  class: "wm-form__input",
3148
- required: d.required,
3213
+ required: l.required,
3149
3214
  disabled: n.readOnly || r.busy
3150
- }, null, 8, xr)), [
3151
- [J, r.values[d.key]]
3152
- ]) : d.type === "boolean" ? (l(), c("label", Tr, [
3153
- q(i("input", {
3154
- id: `wm-f-${r._uid}-${d.key}`,
3155
- "onUpdate:modelValue": (v) => r.values[d.key] = v,
3215
+ }, null, 8, Dr)), [
3216
+ [Z, r.values[l.key]]
3217
+ ]) : l.type === "boolean" ? (d(), c("label", jr, [
3218
+ W(i("input", {
3219
+ id: `wm-f-${r._uid}-${l.key}`,
3220
+ "onUpdate:modelValue": (g) => r.values[l.key] = g,
3156
3221
  type: "checkbox",
3157
3222
  disabled: n.readOnly || r.busy
3158
- }, null, 8, Mr), [
3159
- [Ie, r.values[d.key]]
3223
+ }, null, 8, Ur), [
3224
+ [Ie, r.values[l.key]]
3160
3225
  ]),
3161
- i("span", null, b(d.placeholder || "Oui"), 1)
3162
- ])) : d.type === "select" ? q((l(), c("select", {
3226
+ i("span", null, k(l.placeholder || "Oui"), 1)
3227
+ ])) : l.type === "select" ? W((d(), c("select", {
3163
3228
  key: 5,
3164
- id: `wm-f-${r._uid}-${d.key}`,
3165
- "onUpdate:modelValue": (v) => r.values[d.key] = v,
3229
+ id: `wm-f-${r._uid}-${l.key}`,
3230
+ "onUpdate:modelValue": (g) => r.values[l.key] = g,
3166
3231
  class: "wm-form__select",
3167
- required: d.required,
3232
+ required: l.required,
3168
3233
  disabled: n.readOnly || r.busy
3169
3234
  }, [
3170
- i("option", Ir, b(d.placeholder || "Choisir…"), 1),
3171
- (l(!0), c(M, null, D(d.options, (v) => (l(), c("option", {
3172
- key: v.value,
3173
- value: v.value
3174
- }, b(v.label), 9, Br))), 128))
3175
- ], 8, Or)), [
3176
- [Be, r.values[d.key]]
3177
- ]) : d.type === "multiselect" ? (l(), c("div", Er, [
3178
- (l(!0), c(M, null, D(d.options, (v) => (l(), c("label", {
3179
- key: v.value,
3235
+ i("option", Hr, k(l.placeholder || "Choisir…"), 1),
3236
+ (d(!0), c(M, null, F(l.options, (g) => (d(), c("option", {
3237
+ key: g.value,
3238
+ value: g.value
3239
+ }, k(g.label), 9, zr))), 128))
3240
+ ], 8, Pr)), [
3241
+ [Be, r.values[l.key]]
3242
+ ]) : l.type === "multiselect" ? (d(), c("div", Vr, [
3243
+ (d(!0), c(M, null, F(l.options, (g) => (d(), c("label", {
3244
+ key: g.value,
3180
3245
  class: "wm-form__multiItem"
3181
3246
  }, [
3182
3247
  i("input", {
3183
3248
  type: "checkbox",
3184
- value: v.value,
3185
- checked: Array.isArray(r.values[d.key]) && r.values[d.key].includes(v.value),
3249
+ value: g.value,
3250
+ checked: Array.isArray(r.values[l.key]) && r.values[l.key].includes(g.value),
3186
3251
  disabled: n.readOnly || r.busy,
3187
- onChange: (k) => s.toggleMulti(d.key, v.value, k.target.checked)
3188
- }, null, 40, $r),
3189
- i("span", null, b(v.label), 1)
3252
+ onChange: (C) => s.toggleMulti(l.key, g.value, C.target.checked)
3253
+ }, null, 40, qr),
3254
+ i("span", null, k(g.label), 1)
3190
3255
  ]))), 128))
3191
- ])) : y("", !0)
3256
+ ])) : b("", !0)
3192
3257
  ]))), 128)),
3193
- r.error ? (l(), c("div", Lr, b(r.error), 1)) : y("", !0),
3194
- n.readOnly ? (l(), c("div", Dr, "Réponse envoyée")) : (l(), c("button", {
3258
+ r.error ? (d(), c("div", Wr, k(r.error), 1)) : b("", !0),
3259
+ n.readOnly ? (d(), c("div", Yr, "Réponse envoyée")) : (d(), c("button", {
3195
3260
  key: 1,
3196
3261
  type: "submit",
3197
3262
  class: "wm-form__submit",
3198
3263
  disabled: r.busy
3199
3264
  }, [
3200
- r.busy ? (l(), c("span", Fr)) : y("", !0),
3201
- i("span", null, b(r.busy ? "Envoi…" : n.form.submit_label || "Envoyer"), 1)
3202
- ], 8, Rr))
3265
+ r.busy ? (d(), c("span", Gr)) : b("", !0),
3266
+ i("span", null, k(r.busy ? "Envoi…" : n.form.submit_label || "Envoyer"), 1)
3267
+ ], 8, Kr))
3203
3268
  ], 32)
3204
3269
  ]);
3205
3270
  }
3206
- const jr = /* @__PURE__ */ $(fr, [["render", Nr], ["__scopeId", "data-v-64b40f76"]]), Ur = {
3271
+ const Xr = /* @__PURE__ */ $(xr, [["render", Jr], ["__scopeId", "data-v-64b40f76"]]), Zr = {
3207
3272
  name: "WmFeedback",
3208
3273
  props: {
3209
3274
  busy: { type: Boolean, default: !1 },
@@ -3227,43 +3292,43 @@ const jr = /* @__PURE__ */ $(fr, [["render", Nr], ["__scopeId", "data-v-64b40f76
3227
3292
  !this.sel || this.busy || this.$emit("submit", { rating: this.sel });
3228
3293
  }
3229
3294
  }
3230
- }, Pr = { class: "wm-fb" }, Hr = { class: "wm-fb__row" }, zr = ["onClick"], Vr = { class: "wm-fb__emoji" }, qr = { class: "wm-fb__label" }, Wr = ["disabled"], Kr = {
3295
+ }, Qr = { class: "wm-fb" }, ei = { class: "wm-fb__row" }, ti = ["onClick"], ni = { class: "wm-fb__emoji" }, si = { class: "wm-fb__label" }, ri = ["disabled"], ii = {
3231
3296
  key: 1,
3232
3297
  class: "wm-fb__done"
3233
3298
  };
3234
- function Gr(t, e, n, o, r, s) {
3235
- return l(), c("div", Pr, [
3236
- n.done ? (l(), c("div", Kr, [...e[3] || (e[3] = [
3237
- ue('<div class="wm-fb__check" data-v-6f45ff3b><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-6f45ff3b><path d="M20 6L9 17l-5-5" data-v-6f45ff3b></path></svg></div><div class="wm-fb__doneTitle" data-v-6f45ff3b>Merci pour votre retour !</div><div class="wm-fb__doneSub" data-v-6f45ff3b>Votre avis a bien été pris en compte.</div>', 3)
3238
- ])])) : (l(), c(M, { key: 0 }, [
3299
+ function ai(t, e, n, o, r, s) {
3300
+ return d(), c("div", Qr, [
3301
+ n.done ? (d(), c("div", ii, [...e[3] || (e[3] = [
3302
+ ae('<div class="wm-fb__check" data-v-6f45ff3b><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-6f45ff3b><path d="M20 6L9 17l-5-5" data-v-6f45ff3b></path></svg></div><div class="wm-fb__doneTitle" data-v-6f45ff3b>Merci pour votre retour !</div><div class="wm-fb__doneSub" data-v-6f45ff3b>Votre avis a bien été pris en compte.</div>', 3)
3303
+ ])])) : (d(), c(M, { key: 0 }, [
3239
3304
  e[1] || (e[1] = i("div", { class: "wm-fb__title" }, "Comment s'est passée cette conversation ?", -1)),
3240
3305
  e[2] || (e[2] = i("div", { class: "wm-fb__sub" }, "Votre avis nous aide à améliorer l'assistant.", -1)),
3241
- i("div", Hr, [
3242
- (l(!0), c(M, null, D(r.options, (a) => (l(), c("button", {
3306
+ i("div", ei, [
3307
+ (d(!0), c(M, null, F(r.options, (a) => (d(), c("button", {
3243
3308
  key: a.v,
3244
3309
  type: "button",
3245
3310
  class: E(["wm-fb__opt", { "is-selected": r.sel === a.v }]),
3246
- onClick: (d) => r.sel = a.v
3311
+ onClick: (l) => r.sel = a.v
3247
3312
  }, [
3248
- i("span", Vr, b(a.e), 1),
3249
- i("span", qr, b(a.l), 1)
3250
- ], 10, zr))), 128))
3313
+ i("span", ni, k(a.e), 1),
3314
+ i("span", si, k(a.l), 1)
3315
+ ], 10, ti))), 128))
3251
3316
  ]),
3252
3317
  i("button", {
3253
3318
  type: "button",
3254
3319
  class: "wm-fb__send",
3255
3320
  disabled: !r.sel || n.busy,
3256
3321
  onClick: e[0] || (e[0] = (...a) => s.onSend && s.onSend(...a))
3257
- }, b(n.busy ? "Envoi…" : "Envoyer mon avis"), 9, Wr)
3322
+ }, k(n.busy ? "Envoi…" : "Envoyer mon avis"), 9, ri)
3258
3323
  ], 64))
3259
3324
  ]);
3260
3325
  }
3261
- const Yr = /* @__PURE__ */ $(Ur, [["render", Gr], ["__scopeId", "data-v-6f45ff3b"]]);
3262
- function Jr(t) {
3326
+ const oi = /* @__PURE__ */ $(Zr, [["render", ai], ["__scopeId", "data-v-6f45ff3b"]]);
3327
+ function li(t) {
3263
3328
  const e = new Date(t);
3264
3329
  return e.setHours(0, 0, 0, 0), e;
3265
3330
  }
3266
- const Xr = {
3331
+ const di = {
3267
3332
  name: "WmHistoryDrawer",
3268
3333
  props: {
3269
3334
  conversations: { type: Array, default: () => [] },
@@ -3297,7 +3362,7 @@ const Xr = {
3297
3362
  ) : this.normalized;
3298
3363
  },
3299
3364
  groups() {
3300
- const e = Jr(/* @__PURE__ */ new Date()).getTime(), n = e - 6 * 864e5, o = [], r = [], s = [];
3365
+ const e = li(/* @__PURE__ */ new Date()).getTime(), n = e - 6 * 864e5, o = [], r = [], s = [];
3301
3366
  for (const a of this.filtered) {
3302
3367
  if (!a.stamp) {
3303
3368
  s.push(a);
@@ -3315,29 +3380,29 @@ const Xr = {
3315
3380
  return this.filtered.length > 0;
3316
3381
  }
3317
3382
  }
3318
- }, Zr = { class: "wm-hd" }, Qr = {
3383
+ }, ci = { class: "wm-hd" }, ui = {
3319
3384
  class: "wm-hd__panel",
3320
3385
  role: "dialog",
3321
3386
  "aria-label": "Vos discussions"
3322
- }, ei = { class: "wm-hd__head" }, ti = { class: "wm-hd__top" }, ni = { class: "wm-hd__search" }, si = { class: "wm-hd__list" }, ri = {
3387
+ }, hi = { class: "wm-hd__head" }, mi = { class: "wm-hd__top" }, fi = { class: "wm-hd__search" }, _i = { class: "wm-hd__list" }, pi = {
3323
3388
  key: 0,
3324
3389
  class: "wm-hd__group"
3325
- }, ii = { class: "wm-hd__groupLabel" }, ai = { class: "wm-hd__rows" }, oi = ["onClick"], li = { class: "wm-hd__rowIcon" }, di = {
3390
+ }, gi = { class: "wm-hd__groupLabel" }, vi = { class: "wm-hd__rows" }, yi = ["onClick"], wi = { class: "wm-hd__rowIcon" }, bi = {
3326
3391
  key: 0,
3327
3392
  class: "wm-hd__rowDot",
3328
3393
  "aria-label": "Message non lu"
3329
- }, ci = { class: "wm-hd__rowBody" }, ui = { class: "wm-hd__rowTop" }, hi = { class: "wm-hd__rowTitle" }, mi = { class: "wm-hd__rowPreview" }, fi = {
3394
+ }, ki = { class: "wm-hd__rowBody" }, Ci = { class: "wm-hd__rowTop" }, Ai = { class: "wm-hd__rowTitle" }, Si = { class: "wm-hd__rowPreview" }, xi = {
3330
3395
  key: 0,
3331
3396
  class: "wm-hd__empty"
3332
3397
  };
3333
- function _i(t, e, n, o, r, s) {
3334
- return l(), c("div", Zr, [
3398
+ function Ti(t, e, n, o, r, s) {
3399
+ return d(), c("div", ci, [
3335
3400
  i("div", {
3336
3401
  class: "wm-hd__scrim",
3337
3402
  onClick: e[0] || (e[0] = (a) => t.$emit("close"))
3338
3403
  }),
3339
- i("aside", Qr, [
3340
- i("div", ei, [
3404
+ i("aside", ui, [
3405
+ i("div", hi, [
3341
3406
  e[5] || (e[5] = i("div", { class: "wm-hd__heading" }, [
3342
3407
  i("div", { class: "wm-hd__title" }, "Vos discussions"),
3343
3408
  i("div", { class: "wm-hd__sub" }, "Reprenez là où vous en étiez.")
@@ -3363,7 +3428,7 @@ function _i(t, e, n, o, r, s) {
3363
3428
  ], -1)
3364
3429
  ])])
3365
3430
  ]),
3366
- i("div", ti, [
3431
+ i("div", mi, [
3367
3432
  i("button", {
3368
3433
  type: "button",
3369
3434
  class: "wm-hd__new",
@@ -3386,7 +3451,7 @@ function _i(t, e, n, o, r, s) {
3386
3451
  ], -1),
3387
3452
  i("span", null, "Démarrer un nouveau fil", -1)
3388
3453
  ])]),
3389
- i("div", ni, [
3454
+ i("div", fi, [
3390
3455
  e[7] || (e[7] = i("span", { class: "wm-hd__searchIcon" }, [
3391
3456
  i("svg", {
3392
3457
  width: "12",
@@ -3402,33 +3467,33 @@ function _i(t, e, n, o, r, s) {
3402
3467
  i("path", { d: "M21 21l-4.35-4.35M11 17a6 6 0 100-12 6 6 0 000 12z" })
3403
3468
  ])
3404
3469
  ], -1)),
3405
- q(i("input", {
3470
+ W(i("input", {
3406
3471
  "onUpdate:modelValue": e[3] || (e[3] = (a) => r.query = a),
3407
3472
  type: "text",
3408
3473
  placeholder: "Rechercher dans vos messages",
3409
3474
  "aria-label": "Rechercher dans vos messages"
3410
3475
  }, null, 512), [
3411
- [J, r.query]
3476
+ [Z, r.query]
3412
3477
  ])
3413
3478
  ])
3414
3479
  ]),
3415
- i("div", si, [
3416
- (l(!0), c(M, null, D(s.groups, (a) => (l(), c(M, {
3480
+ i("div", _i, [
3481
+ (d(!0), c(M, null, F(s.groups, (a) => (d(), c(M, {
3417
3482
  key: a.key
3418
3483
  }, [
3419
- a.items.length ? (l(), c("div", ri, [
3420
- i("div", ii, b(a.label), 1),
3421
- i("div", ai, [
3422
- (l(!0), c(M, null, D(a.items, (d) => (l(), c("button", {
3423
- key: d.id,
3484
+ a.items.length ? (d(), c("div", pi, [
3485
+ i("div", gi, k(a.label), 1),
3486
+ i("div", vi, [
3487
+ (d(!0), c(M, null, F(a.items, (l) => (d(), c("button", {
3488
+ key: l.id,
3424
3489
  type: "button",
3425
3490
  class: E(["wm-hd__row", {
3426
- "wm-hd__row--active": d.id === n.activeId,
3427
- "wm-hd__row--unread": d.unread
3491
+ "wm-hd__row--active": l.id === n.activeId,
3492
+ "wm-hd__row--unread": l.unread
3428
3493
  }]),
3429
- onClick: (v) => t.$emit("pick", d)
3494
+ onClick: (g) => t.$emit("pick", l)
3430
3495
  }, [
3431
- i("div", li, [
3496
+ i("div", wi, [
3432
3497
  e[8] || (e[8] = i("svg", {
3433
3498
  width: "11",
3434
3499
  height: "11",
@@ -3442,66 +3507,78 @@ function _i(t, e, n, o, r, s) {
3442
3507
  opacity: "0.92"
3443
3508
  })
3444
3509
  ], -1)),
3445
- d.unread ? (l(), c("span", di)) : y("", !0)
3510
+ l.unread ? (d(), c("span", bi)) : b("", !0)
3446
3511
  ]),
3447
- i("div", ci, [
3448
- i("div", ui, [
3449
- i("span", hi, b(d.title), 1)
3512
+ i("div", ki, [
3513
+ i("div", Ci, [
3514
+ i("span", Ai, k(l.title), 1)
3450
3515
  ]),
3451
- i("div", mi, b(d.preview || "Aucun message"), 1)
3516
+ i("div", Si, k(l.preview || "Aucun message"), 1)
3452
3517
  ])
3453
- ], 10, oi))), 128))
3518
+ ], 10, yi))), 128))
3454
3519
  ])
3455
- ])) : y("", !0)
3520
+ ])) : b("", !0)
3456
3521
  ], 64))), 128)),
3457
- s.hasAny ? y("", !0) : (l(), c("div", fi, " Aucun fil pour le moment. "))
3522
+ s.hasAny ? b("", !0) : (d(), c("div", xi, " Aucun fil pour le moment. "))
3458
3523
  ])
3459
3524
  ])
3460
3525
  ]);
3461
3526
  }
3462
- const pi = /* @__PURE__ */ $(Xr, [["render", _i], ["__scopeId", "data-v-1259e822"]]), vi = {
3527
+ const Mi = /* @__PURE__ */ $(di, [["render", Ti], ["__scopeId", "data-v-1259e822"]]), Oi = {
3463
3528
  name: "WmMoreMenu",
3464
3529
  props: {
3465
3530
  canRename: { type: Boolean, default: !0 },
3466
3531
  canExport: { type: Boolean, default: !0 },
3467
- notifEnabled: { type: Boolean, default: !0 },
3532
+ soundEnabled: { type: Boolean, default: !0 },
3533
+ browserNotifEnabled: { type: Boolean, default: !1 },
3468
3534
  statusUrl: { type: String, default: "" },
3469
3535
  helpUrl: { type: String, default: "" }
3470
3536
  },
3471
- emits: ["close", "action", "notif-toggle"],
3537
+ emits: ["close", "action", "sound-toggle", "browser-notif-toggle"],
3472
3538
  data() {
3473
- return { notifOn: this.notifEnabled };
3539
+ return {
3540
+ soundOn: this.soundEnabled,
3541
+ browserNotifOn: this.browserNotifEnabled
3542
+ };
3474
3543
  },
3475
3544
  watch: {
3476
- notifEnabled(t) {
3477
- this.notifOn = !!t;
3545
+ // Parent reverts the toggle when permission is denied — sync the
3546
+ // local optimistic flip with the authoritative value.
3547
+ soundEnabled(t) {
3548
+ this.soundOn = !!t;
3549
+ },
3550
+ browserNotifEnabled(t) {
3551
+ this.browserNotifOn = !!t;
3478
3552
  }
3479
3553
  },
3480
3554
  methods: {
3481
3555
  emit(t) {
3482
3556
  this.$emit("action", t);
3483
3557
  },
3484
- toggleNotif() {
3485
- this.notifOn = !this.notifOn, this.$emit("notif-toggle", this.notifOn);
3558
+ toggleSound() {
3559
+ this.soundOn = !this.soundOn, this.$emit("sound-toggle", this.soundOn);
3560
+ },
3561
+ toggleBrowserNotif() {
3562
+ this.browserNotifOn = !this.browserNotifOn, this.$emit("browser-notif-toggle", this.browserNotifOn);
3486
3563
  }
3487
3564
  }
3488
- }, gi = { class: "wm-mm" }, yi = {
3565
+ }, Ii = { class: "wm-mm" }, Bi = {
3489
3566
  class: "wm-mm__pop",
3490
3567
  role: "menu"
3491
- }, wi = { class: "wm-mm__section" }, bi = { class: "wm-mm__section" }, ki = { class: "wm-mm__section" };
3492
- function Ci(t, e, n, o, r, s) {
3493
- return l(), c("div", gi, [
3568
+ }, Ei = { class: "wm-mm__section" }, $i = { class: "wm-mm__section" }, Ni = { class: "wm-mm__section" };
3569
+ function Li(t, e, n, o, r, s) {
3570
+ return d(), c("div", Ii, [
3494
3571
  i("div", {
3495
3572
  class: "wm-mm__scrim",
3496
3573
  onClick: e[0] || (e[0] = (a) => t.$emit("close"))
3497
3574
  }),
3498
- i("div", yi, [
3499
- i("div", wi, [
3575
+ i("div", Bi, [
3576
+ i("div", Ei, [
3500
3577
  i("button", {
3501
3578
  type: "button",
3502
3579
  class: "wm-mm__item",
3503
3580
  onClick: e[1] || (e[1] = (a) => s.emit("history"))
3504
- }, [...e[7] || (e[7] = [
3581
+ }, [...e[8] || (e[8] = [
3505
3582
  i("span", { class: "wm-mm__icon" }, [
3506
3583
  i("svg", {
3507
3584
  width: "12",
@@ -3519,31 +3596,43 @@ function Ci(t, e, n, o, r, s) {
3519
3596
  ], -1),
3520
3597
  i("span", { class: "wm-mm__label" }, "Historique des discussions", -1)
3521
3598
  ])]),
3522
- n.canRename ? (l(), c("button", {
3599
+ n.canRename ? (d(), c("button", {
3523
3600
  key: 0,
3524
3601
  type: "button",
3525
3602
  class: "wm-mm__item",
3526
3603
  onClick: e[2] || (e[2] = (a) => s.emit("rename"))
3527
- }, [...e[8] || (e[8] = [
3528
- ue('<span class="wm-mm__icon" data-v-3181ad1b><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-3181ad1b><path d="M12 20h9" data-v-3181ad1b></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z" data-v-3181ad1b></path></svg></span><span class="wm-mm__label" data-v-3181ad1b>Modifier le titre</span>', 2)
3529
- ])])) : y("", !0),
3530
- n.canExport ? (l(), c("button", {
3604
+ }, [...e[9] || (e[9] = [
3605
+ ae('<span class="wm-mm__icon" data-v-e300b2de><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-e300b2de><path d="M12 20h9" data-v-e300b2de></path><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z" data-v-e300b2de></path></svg></span><span class="wm-mm__label" data-v-e300b2de>Modifier le titre</span>', 2)
3606
+ ])])) : b("", !0),
3607
+ n.canExport ? (d(), c("button", {
3531
3608
  key: 1,
3532
3609
  type: "button",
3533
3610
  class: "wm-mm__item",
3534
3611
  onClick: e[3] || (e[3] = (a) => s.emit("export"))
3535
- }, [...e[9] || (e[9] = [
3536
- ue('<span class="wm-mm__icon" data-v-3181ad1b><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-3181ad1b><path d="M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8M16 6l-4-4-4 4M12 2v13" data-v-3181ad1b></path></svg></span><span class="wm-mm__label" data-v-3181ad1b>Exporter la transcription</span><span class="wm-mm__hint" data-v-3181ad1b>.txt</span>', 3)
3537
- ])])) : y("", !0)
3612
+ }, [...e[10] || (e[10] = [
3613
+ ae('<span class="wm-mm__icon" data-v-e300b2de><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-e300b2de><path d="M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8M16 6l-4-4-4 4M12 2v13" data-v-e300b2de></path></svg></span><span class="wm-mm__label" data-v-e300b2de>Exporter la transcription</span><span class="wm-mm__hint" data-v-e300b2de>.txt</span>', 3)
3614
+ ])])) : b("", !0)
3538
3615
  ]),
3539
- e[15] || (e[15] = i("div", { class: "wm-mm__sep" }, null, -1)),
3540
- i("div", bi, [
3616
+ e[18] || (e[18] = i("div", { class: "wm-mm__sep" }, null, -1)),
3617
+ i("div", $i, [
3541
3618
  i("button", {
3542
3619
  type: "button",
3543
3620
  class: "wm-mm__item",
3544
- onClick: e[4] || (e[4] = (...a) => s.toggleNotif && s.toggleNotif(...a))
3621
+ onClick: e[4] || (e[4] = (...a) => s.toggleSound && s.toggleSound(...a))
3545
3622
  }, [
3546
- e[11] || (e[11] = i("span", { class: "wm-mm__icon" }, [
3623
+ e[12] || (e[12] = ae('<span class="wm-mm__icon" data-v-e300b2de><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-v-e300b2de><path d="M11 5L6 9H2v6h4l5 4V5z" data-v-e300b2de></path><path d="M15.54 8.46a5 5 0 010 7.07M19.07 4.93a10 10 0 010 14.14" data-v-e300b2de></path></svg></span><span class="wm-mm__label" data-v-e300b2de>Son</span>', 2)),
3624
+ i("span", {
3625
+ class: E(["wm-mm__toggle", { "wm-mm__toggle--on": r.soundOn }])
3626
+ }, [...e[11] || (e[11] = [
3627
+ i("span", { class: "wm-mm__knob" }, null, -1)
3628
+ ])], 2)
3629
+ ]),
3630
+ i("button", {
3631
+ type: "button",
3632
+ class: "wm-mm__item",
3633
+ onClick: e[5] || (e[5] = (...a) => s.toggleBrowserNotif && s.toggleBrowserNotif(...a))
3634
+ }, [
3635
+ e[14] || (e[14] = i("span", { class: "wm-mm__icon" }, [
3547
3636
  i("svg", {
3548
3637
  width: "12",
3549
3638
  height: "12",
@@ -3558,22 +3647,22 @@ function Ci(t, e, n, o, r, s) {
3558
3647
  i("path", { d: "M15 17h5l-1.4-1.4A2 2 0 0118 14.2V11a6 6 0 10-12 0v3.2c0 .5-.2 1-.6 1.4L4 17h5m6 0a3 3 0 11-6 0" })
3559
3648
  ])
3560
3649
  ], -1)),
3561
- e[12] || (e[12] = i("span", { class: "wm-mm__label" }, "Notifications", -1)),
3650
+ e[15] || (e[15] = i("span", { class: "wm-mm__label" }, "Notifications navigateur", -1)),
3562
3651
  i("span", {
3563
- class: E(["wm-mm__toggle", { "wm-mm__toggle--on": r.notifOn }])
3564
- }, [...e[10] || (e[10] = [
3652
+ class: E(["wm-mm__toggle", { "wm-mm__toggle--on": r.browserNotifOn }])
3653
+ }, [...e[13] || (e[13] = [
3565
3654
  i("span", { class: "wm-mm__knob" }, null, -1)
3566
3655
  ])], 2)
3567
3656
  ])
3568
3657
  ]),
3569
- e[16] || (e[16] = i("div", { class: "wm-mm__sep" }, null, -1)),
3570
- i("div", ki, [
3571
- n.statusUrl ? (l(), c("button", {
3658
+ e[19] || (e[19] = i("div", { class: "wm-mm__sep" }, null, -1)),
3659
+ i("div", Ni, [
3660
+ n.statusUrl ? (d(), c("button", {
3572
3661
  key: 0,
3573
3662
  type: "button",
3574
3663
  class: "wm-mm__item",
3575
- onClick: e[5] || (e[5] = (a) => s.emit("status"))
3576
- }, [...e[13] || (e[13] = [
3664
+ onClick: e[6] || (e[6] = (a) => s.emit("status"))
3665
+ }, [...e[16] || (e[16] = [
3577
3666
  i("span", { class: "wm-mm__icon" }, [
3578
3667
  i("svg", {
3579
3668
  width: "12",
@@ -3590,13 +3679,13 @@ function Ci(t, e, n, o, r, s) {
3590
3679
  ])
3591
3680
  ], -1),
3592
3681
  i("span", { class: "wm-mm__label" }, "Statut des services", -1)
3593
- ])])) : y("", !0),
3594
- n.helpUrl ? (l(), c("button", {
3682
+ ])])) : b("", !0),
3683
+ n.helpUrl ? (d(), c("button", {
3595
3684
  key: 1,
3596
3685
  type: "button",
3597
3686
  class: "wm-mm__item",
3598
- onClick: e[6] || (e[6] = (a) => s.emit("help"))
3599
- }, [...e[14] || (e[14] = [
3687
+ onClick: e[7] || (e[7] = (a) => s.emit("help"))
3688
+ }, [...e[17] || (e[17] = [
3600
3689
  i("span", { class: "wm-mm__icon" }, [
3601
3690
  i("svg", {
3602
3691
  width: "12",
@@ -3613,12 +3702,12 @@ function Ci(t, e, n, o, r, s) {
3613
3702
  ])
3614
3703
  ], -1),
3615
3704
  i("span", { class: "wm-mm__label" }, "Centre d'aide", -1)
3616
- ])])) : y("", !0)
3705
+ ])])) : b("", !0)
3617
3706
  ])
3618
3707
  ])
3619
3708
  ]);
3620
3709
  }
3621
- const Ai = /* @__PURE__ */ $(vi, [["render", Ci], ["__scopeId", "data-v-3181ad1b"]]), Si = {
3710
+ const Ri = /* @__PURE__ */ $(Oi, [["render", Li], ["__scopeId", "data-v-e300b2de"]]), Fi = {
3622
3711
  name: "WmRenameDialog",
3623
3712
  props: {
3624
3713
  title: { type: String, default: "Modifier le titre" },
@@ -3652,20 +3741,20 @@ const Ai = /* @__PURE__ */ $(vi, [["render", Ci], ["__scopeId", "data-v-3181ad1b
3652
3741
  this.canSubmit && this.$emit("submit", this.value.trim());
3653
3742
  }
3654
3743
  }
3655
- }, xi = { class: "wm-dialog" }, Ti = {
3744
+ }, Di = { class: "wm-dialog" }, ji = {
3656
3745
  class: "wm-dialog__card",
3657
3746
  role: "dialog",
3658
3747
  "aria-modal": "true"
3659
- }, Mi = { class: "wm-dialog__head" }, Oi = { class: "wm-dialog__title" }, Ii = { class: "wm-dialog__body" }, Bi = ["placeholder"], Ei = { class: "wm-dialog__actions" }, $i = ["disabled"];
3660
- function Li(t, e, n, o, r, s) {
3661
- return l(), c("div", xi, [
3748
+ }, Ui = { class: "wm-dialog__head" }, Pi = { class: "wm-dialog__title" }, Hi = { class: "wm-dialog__body" }, zi = ["placeholder"], Vi = { class: "wm-dialog__actions" }, qi = ["disabled"];
3749
+ function Wi(t, e, n, o, r, s) {
3750
+ return d(), c("div", Di, [
3662
3751
  i("div", {
3663
3752
  class: "wm-dialog__scrim",
3664
3753
  onClick: e[0] || (e[0] = (a) => t.$emit("close"))
3665
3754
  }),
3666
- i("div", Ti, [
3667
- i("div", Mi, [
3668
- i("div", Oi, b(n.title), 1),
3755
+ i("div", ji, [
3756
+ i("div", Ui, [
3757
+ i("div", Pi, k(n.title), 1),
3669
3758
  i("button", {
3670
3759
  type: "button",
3671
3760
  class: "wm-dialog__close",
@@ -3687,8 +3776,8 @@ function Li(t, e, n, o, r, s) {
3687
3776
  ], -1)
3688
3777
  ])])
3689
3778
  ]),
3690
- i("div", Ii, [
3691
- q(i("input", {
3779
+ i("div", Hi, [
3780
+ W(i("input", {
3692
3781
  ref: "input",
3693
3782
  "onUpdate:modelValue": e[2] || (e[2] = (a) => r.value = a),
3694
3783
  type: "text",
@@ -3696,14 +3785,14 @@ function Li(t, e, n, o, r, s) {
3696
3785
  placeholder: n.placeholder,
3697
3786
  maxlength: 120,
3698
3787
  onKeydown: [
3699
- e[3] || (e[3] = ae(X((...a) => s.onSubmit && s.onSubmit(...a), ["prevent"]), ["enter"])),
3700
- e[4] || (e[4] = ae(X((a) => t.$emit("close"), ["prevent"]), ["esc"]))
3788
+ e[3] || (e[3] = oe(Y((...a) => s.onSubmit && s.onSubmit(...a), ["prevent"]), ["enter"])),
3789
+ e[4] || (e[4] = oe(Y((a) => t.$emit("close"), ["prevent"]), ["esc"]))
3701
3790
  ]
3702
- }, null, 40, Bi), [
3703
- [J, r.value]
3791
+ }, null, 40, zi), [
3792
+ [Z, r.value]
3704
3793
  ])
3705
3794
  ]),
3706
- i("div", Ei, [
3795
+ i("div", Vi, [
3707
3796
  i("button", {
3708
3797
  type: "button",
3709
3798
  class: "wm-dialog__btn",
@@ -3714,18 +3803,18 @@ function Li(t, e, n, o, r, s) {
3714
3803
  class: "wm-dialog__btn wm-dialog__btn--primary",
3715
3804
  disabled: !s.canSubmit,
3716
3805
  onClick: e[6] || (e[6] = (...a) => s.onSubmit && s.onSubmit(...a))
3717
- }, "Enregistrer", 8, $i)
3806
+ }, "Enregistrer", 8, qi)
3718
3807
  ])
3719
3808
  ])
3720
3809
  ]);
3721
3810
  }
3722
- const Ri = /* @__PURE__ */ $(Si, [["render", Li], ["__scopeId", "data-v-4f4b37c9"]]), ge = "ww-messenger-tokens";
3811
+ const Ki = /* @__PURE__ */ $(Fi, [["render", Wi], ["__scopeId", "data-v-4f4b37c9"]]), ye = "ww-messenger-tokens";
3723
3812
  function ie(t) {
3724
3813
  var n;
3725
3814
  const e = (n = t == null ? void 0 : t.author) == null ? void 0 : n.type;
3726
3815
  return e === "agent_ia" || e === "agent_human";
3727
3816
  }
3728
- function Fi(t, e) {
3817
+ function Gi(t, e) {
3729
3818
  if (!t || !e) return "";
3730
3819
  const n = Array.isArray(t.fields) ? t.fields : [], o = [];
3731
3820
  for (const r of n) {
@@ -3734,8 +3823,8 @@ function Fi(t, e) {
3734
3823
  if (s == null || s === "") continue;
3735
3824
  let a;
3736
3825
  if (Array.isArray(s)) {
3737
- if (a = s.map((d) => le(r, String(d))).join(", "), !a) continue;
3738
- } else typeof s == "boolean" ? a = s ? "Oui" : "Non" : a = le(r, String(s));
3826
+ if (a = s.map((l) => de(r, String(l))).join(", "), !a) continue;
3827
+ } else typeof s == "boolean" ? a = s ? "Oui" : "Non" : a = de(r, String(s));
3739
3828
  o.push(`${r.label} :
3740
3829
  ${a}`);
3741
3830
  }
@@ -3743,12 +3832,12 @@ ${a}`);
3743
3832
 
3744
3833
  `);
3745
3834
  }
3746
- function le(t, e) {
3835
+ function de(t, e) {
3747
3836
  if (!Array.isArray(t == null ? void 0 : t.options)) return e;
3748
3837
  const n = t.options.find((o) => (o == null ? void 0 : o.value) === e);
3749
3838
  return (n == null ? void 0 : n.label) || e;
3750
3839
  }
3751
- function Di(t, e) {
3840
+ function Yi(t, e) {
3752
3841
  const n = [], o = Array.isArray(t == null ? void 0 : t.fields) ? t.fields : [];
3753
3842
  for (const r of o) {
3754
3843
  if (!(r != null && r.key) || !(r != null && r.label)) continue;
@@ -3756,11 +3845,11 @@ function Di(t, e) {
3756
3845
  if (s == null || s === "") continue;
3757
3846
  let a;
3758
3847
  if (Array.isArray(s)) {
3759
- if (a = s.map((v) => le(r, String(v))).join(", "), !a) continue;
3760
- } else typeof s == "boolean" ? a = s ? "Oui" : "Non" : a = le(r, String(s));
3761
- const d = r.type === "textarea" || typeof a == "string" && (a.length > 60 || a.includes(`
3848
+ if (a = s.map((g) => de(r, String(g))).join(", "), !a) continue;
3849
+ } else typeof s == "boolean" ? a = s ? "Oui" : "Non" : a = de(r, String(s));
3850
+ const l = r.type === "textarea" || typeof a == "string" && (a.length > 60 || a.includes(`
3762
3851
  `));
3763
- n.push({ label: r.label, value: a, multiline: d });
3852
+ n.push({ label: r.label, value: a, multiline: l });
3764
3853
  }
3765
3854
  return {
3766
3855
  kind: "form_response",
@@ -3770,21 +3859,21 @@ function Di(t, e) {
3770
3859
  }
3771
3860
  };
3772
3861
  }
3773
- const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
3862
+ const Ji = 450, Xi = 50, Zi = 900, Qi = 12e3, ea = 300, ta = {
3774
3863
  name: "Messenger",
3775
3864
  components: {
3776
- Launcher: Ge,
3777
- Header: wt,
3778
- Onboarding: zt,
3779
- MessageList: Es,
3780
- Composer: Zs,
3781
- SuggestionChips: nr,
3782
- ApprovalCard: hr,
3783
- FormCard: jr,
3784
- Feedback: Yr,
3785
- HistoryDrawer: pi,
3786
- MoreMenu: Ai,
3787
- RenameDialog: Ri
3865
+ Launcher: it,
3866
+ Header: Mt,
3867
+ Onboarding: tn,
3868
+ MessageList: Vs,
3869
+ Composer: cr,
3870
+ SuggestionChips: fr,
3871
+ ApprovalCard: Ar,
3872
+ FormCard: Xr,
3873
+ Feedback: oi,
3874
+ HistoryDrawer: Mi,
3875
+ MoreMenu: Ri,
3876
+ RenameDialog: Ki
3788
3877
  },
3789
3878
  // Make signAttachment available to deep children (AttachmentPreview)
3790
3879
  // without prop drilling. The store may not exist yet at provide-time
@@ -3869,12 +3958,22 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
3869
3958
  // When true, force the onboarding screen even if conversations
3870
3959
  // exist (e.g. user tapped the "back to home" header button).
3871
3960
  showOnboarding: !1,
3872
- // Local UI preference; mirrors the toggle in MoreMenu.
3873
- notifEnabled: !0,
3874
- // True once the user has dismissed (×) the closed-launcher
3875
- // étiquette for the current unread batch. Reset automatically
3876
- // when a newer unread message arrives (see latestUnread watch).
3877
- labelDismissed: !1,
3961
+ // Local UI preferences ; mirror the two toggles in MoreMenu.
3962
+ // Sound : ON by default — no system permission needed, only the
3963
+ // browser's autoplay gesture rule applies (user has clicked the
3964
+ // launcher / composer well before the first agent reply lands).
3965
+ // Browser notif : default reflects the current `Notification.permission`
3966
+ // — pre-granted permissions stay on, otherwise we wait for the
3967
+ // user to toggle (which triggers the permission prompt).
3968
+ soundEnabled: !0,
3969
+ browserNotifEnabled: typeof Notification < "u" && Notification.permission === "granted",
3970
+ // convId → ISO ts of the unread batch the user has dismissed
3971
+ // (×) on the closed-launcher notification stack. A new message
3972
+ // on the same thread bumps the ts, which makes the comparison
3973
+ // in `launcherPeeks` fail and the card re-appears. Cleared
3974
+ // entries (conv no longer unread) are pruned by the
3975
+ // latestUnreads watcher.
3976
+ dismissedPeeks: {},
3878
3977
  // conversation_id → ISO timestamp of the newest message the user
3879
3978
  // has seen for that thread. Persisted to localStorage so the
3880
3979
  // unread dot in the history drawer survives reloads. The server
@@ -3971,8 +4070,23 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
3971
4070
  var o;
3972
4071
  const t = this.readState, e = this.readBootTs, n = ((o = this.s) == null ? void 0 : o.messagesByConv) || {};
3973
4072
  return this.allConversations.map((r) => {
3974
- const s = n[r.id] || [], a = this.convLastActivity(r, s), d = t[r.id] || e || "", v = this.lastMessageAuthorType(s), k = !!a && v !== "user" && (!d || a > d);
3975
- return { ...r, _preview: this.convPreview(r, s), _unread: k };
4073
+ var N;
4074
+ const s = n[r.id] || [], a = this.convLastActivity(r, s), l = t[r.id] || e || "", g = this.lastMessageAuthorType(s), C = !!a && g !== "user" && (!l || a > l);
4075
+ let y = 0, S = null;
4076
+ for (let A = s.length - 1; A >= 0; A--) {
4077
+ const D = s[A];
4078
+ if (D) {
4079
+ if (((N = D.author) == null ? void 0 : N.type) === "user" || l && D.created_at && D.created_at <= l) break;
4080
+ !S && D.author && (S = D.author), y++;
4081
+ }
4082
+ }
4083
+ return C && y === 0 && (y = 1), {
4084
+ ...r,
4085
+ _preview: this.convPreview(r, s),
4086
+ _unread: C,
4087
+ _unreadCount: y,
4088
+ _lastAuthor: S
4089
+ };
3976
4090
  });
3977
4091
  },
3978
4092
  // How many threads have an unseen agent/human message. Drives the
@@ -3995,26 +4109,35 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
3995
4109
  _ts: this.convLastActivity(n, t[n.id] || [])
3996
4110
  })).sort((n, o) => n._ts < o._ts ? 1 : n._ts > o._ts ? -1 : 0).slice(0, 5);
3997
4111
  },
3998
- // The unread thread with the freshest activity what the étiquette
3999
- // previews. `{ convId, preview, ts }` or null when nothing's unread.
4000
- latestUnread() {
4112
+ // Unread threads (one entry per conv with unseen agent/human
4113
+ // activity), freshest first. Each entry carries everything the
4114
+ // closed-launcher notification card needs: sender identity,
4115
+ // preview, and the count of unseen messages in that thread.
4116
+ latestUnreads() {
4001
4117
  var n;
4002
- const t = ((n = this.s) == null ? void 0 : n.messagesByConv) || {};
4003
- let e = null;
4118
+ const t = ((n = this.s) == null ? void 0 : n.messagesByConv) || {}, e = [];
4004
4119
  for (const o of this.drawerConversations) {
4005
4120
  if (!o._unread) continue;
4006
- const r = this.convLastActivity(o, t[o.id] || []);
4007
- (!e || r > e.ts) && (e = { convId: o.id, preview: o._preview, ts: r });
4121
+ const r = this.convLastActivity(o, t[o.id] || []), s = o._lastAuthor, a = !s || s.type === "agent_ai", l = (s == null ? void 0 : s.name) || (a ? this.agentName : "") || "", g = (s == null ? void 0 : s.avatar_url) || (a ? this.agentAvatarUrl : null);
4122
+ e.push({
4123
+ convId: o.id,
4124
+ preview: o._preview || "Vous avez un nouveau message",
4125
+ ts: r,
4126
+ count: o._unreadCount || 1,
4127
+ senderName: l,
4128
+ senderAvatarUrl: g
4129
+ });
4008
4130
  }
4009
- return e;
4131
+ return e.sort((o, r) => o.ts < r.ts ? 1 : o.ts > r.ts ? -1 : 0), e;
4010
4132
  },
4011
- // Text shown in the closed-launcher étiquette: the last unread
4012
- // message, only while the panel is closed and not dismissed. Empty
4013
- // string => plain launcher.
4014
- launcherPeek() {
4015
- if (this.isOpen || this.isEmbedded || this.labelDismissed) return "";
4016
- const t = this.latestUnread;
4017
- return t ? t.preview || "Vous avez un nouveau message" : "";
4133
+ // Notification cards shown in the closed-launcher stack: the unread
4134
+ // threads above, minus any the user has dismissed (×) for their
4135
+ // current batch. A dismissal is stamped against the conv's current
4136
+ // ts, so a fresh message (new ts) re-shows the card.
4137
+ launcherPeeks() {
4138
+ if (this.isOpen || this.isEmbedded) return [];
4139
+ const t = this.dismissedPeeks || {};
4140
+ return this.latestUnreads.filter((e) => t[e.convId] !== e.ts);
4018
4141
  },
4019
4142
  // True when the user is actively looking at a thread (panel open or
4020
4143
  // embedded, no history drawer overlay, a currentConv exists). Used as
@@ -4120,8 +4243,8 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4120
4243
  if (!t) return [];
4121
4244
  const e = this.revealedAt;
4122
4245
  return (this.s.messagesByConv[t.id] || []).filter((n) => {
4123
- var o, r, s, a, d;
4124
- return (n == null ? void 0 : n.type) === "action" && ((o = n == null ? void 0 : n.payload) == null ? void 0 : o.state) === "pending" || ie(n) && !(e[n.id] > 0) ? !1 : (n == null ? void 0 : n.type) === "action" || (n == null ? void 0 : n.type) === "system" || ((r = n == null ? void 0 : n.payload) == null ? void 0 : r.type) === "system" || Array.isArray((s = n == null ? void 0 : n.payload) == null ? void 0 : s.attachments) && n.payload.attachments.length || (a = n == null ? void 0 : n.metadata) != null && a.artifact || (d = n == null ? void 0 : n.metadata) != null && d.form ? !0 : typeof (n == null ? void 0 : n.text_md) == "string" && n.text_md.trim().length > 0;
4246
+ var o, r, s, a, l;
4247
+ return (n == null ? void 0 : n.type) === "action" && ((o = n == null ? void 0 : n.payload) == null ? void 0 : o.state) === "pending" || ie(n) && !(e[n.id] > 0) ? !1 : (n == null ? void 0 : n.type) === "action" || (n == null ? void 0 : n.type) === "system" || ((r = n == null ? void 0 : n.payload) == null ? void 0 : r.type) === "system" || Array.isArray((s = n == null ? void 0 : n.payload) == null ? void 0 : s.attachments) && n.payload.attachments.length || (a = n == null ? void 0 : n.metadata) != null && a.artifact || (l = n == null ? void 0 : n.metadata) != null && l.form ? !0 : typeof (n == null ? void 0 : n.text_md) == "string" && n.text_md.trim().length > 0;
4125
4248
  });
4126
4249
  },
4127
4250
  // True whenever we should show the "typing" indicator at the bottom
@@ -4163,14 +4286,14 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4163
4286
  return ((e = (t = this.pendingApproval) == null ? void 0 : t.payload) == null ? void 0 : e.name) || ((n = this.pendingApproval) == null ? void 0 : n.text_md) || "Confirmer l'action";
4164
4287
  },
4165
4288
  approvalDetail() {
4166
- var o, r, s, a, d, v;
4289
+ var o, r, s, a, l, g;
4167
4290
  const t = (s = (r = (o = this.pendingApproval) == null ? void 0 : o.payload) == null ? void 0 : r.pending) == null ? void 0 : s.user_explanation;
4168
4291
  if (typeof t == "string" && t.trim())
4169
4292
  return t.trim();
4170
- const e = (v = (d = (a = this.pendingApproval) == null ? void 0 : a.payload) == null ? void 0 : d.pending) == null ? void 0 : v.prepared_params;
4293
+ const e = (g = (l = (a = this.pendingApproval) == null ? void 0 : a.payload) == null ? void 0 : l.pending) == null ? void 0 : g.prepared_params;
4171
4294
  if (!e || typeof e != "object") return "";
4172
4295
  const n = Object.entries(e);
4173
- return n.length ? n.slice(0, 2).map(([k, w]) => `${k}: ${w}`).join(" · ") : "";
4296
+ return n.length ? n.slice(0, 2).map(([C, y]) => `${C}: ${y}`).join(" · ") : "";
4174
4297
  },
4175
4298
  actionInFlight() {
4176
4299
  var t, e;
@@ -4206,13 +4329,13 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4206
4329
  const t = this.currentConv;
4207
4330
  let e = /* @__PURE__ */ new Date();
4208
4331
  if (t) {
4209
- const a = ((r = (((o = (n = this.s) == null ? void 0 : n.messagesByConv) == null ? void 0 : o[t.id]) || []).find((d) => d == null ? void 0 : d.created_at)) == null ? void 0 : r.created_at) || t.created_at;
4332
+ const a = ((r = (((o = (n = this.s) == null ? void 0 : n.messagesByConv) == null ? void 0 : o[t.id]) || []).find((l) => l == null ? void 0 : l.created_at)) == null ? void 0 : r.created_at) || t.created_at;
4210
4333
  if (a) {
4211
- const d = new Date(a);
4212
- Number.isNaN(d.getTime()) || (e = d);
4334
+ const l = new Date(a);
4335
+ Number.isNaN(l.getTime()) || (e = l);
4213
4336
  }
4214
4337
  }
4215
- return `Aujourd'hui · ${be(e)}`;
4338
+ return `Aujourd'hui · ${ke(e)}`;
4216
4339
  },
4217
4340
  // Pagination state for the active conversation. Drives the
4218
4341
  // MessageList's scroll-up history loader. Defaults are safe (no
@@ -4228,17 +4351,20 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4228
4351
  }
4229
4352
  },
4230
4353
  watch: {
4231
- // Closed-launcher étiquette: a dismissal only silences the *current*
4232
- // unread batch. A fresh message (newer timestamp, or a different
4233
- // thread) re-expands it; everything read again clears the flag so
4234
- // it's primed for next time.
4235
- latestUnread: {
4236
- handler(t, e) {
4237
- if (!t) {
4238
- this.labelDismissed = !1;
4239
- return;
4240
- }
4241
- (!e || t.convId !== e.convId || t.ts > e.ts) && (this.labelDismissed = !1);
4354
+ // Prune `dismissedPeeks` entries for threads that are no longer
4355
+ // unread (user opened them, or a user reply cleared the unread
4356
+ // flag). Without this, the map would grow unbounded across a
4357
+ // session; the per-batch silencing semantics still come from the
4358
+ // ts comparison in `launcherPeeks`.
4359
+ latestUnreads: {
4360
+ handler(t) {
4361
+ const e = new Set(t.map((a) => a.convId)), n = this.dismissedPeeks || {}, o = Object.keys(n);
4362
+ if (!o.length) return;
4363
+ const r = {};
4364
+ let s = !1;
4365
+ for (const a of o)
4366
+ e.has(a) ? r[a] = n[a] : s = !0;
4367
+ s && (this.dismissedPeeks = r);
4242
4368
  },
4243
4369
  deep: !0
4244
4370
  },
@@ -4322,8 +4448,8 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4322
4448
  n[r.id] = e;
4323
4449
  continue;
4324
4450
  }
4325
- const a = typeof (r == null ? void 0 : r.text_md) == "string" && r.text_md.trim().length > 0, d = Array.isArray((o = r == null ? void 0 : r.payload) == null ? void 0 : o.attachments) && r.payload.attachments.length > 0;
4326
- if (!a && !d) {
4451
+ const a = typeof (r == null ? void 0 : r.text_md) == "string" && r.text_md.trim().length > 0, l = Array.isArray((o = r == null ? void 0 : r.payload) == null ? void 0 : o.attachments) && r.payload.attachments.length > 0;
4452
+ if (!a && !l) {
4327
4453
  n[r.id] = e;
4328
4454
  continue;
4329
4455
  }
@@ -4340,9 +4466,9 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4340
4466
  hasWidgetId: !!this.widgetId,
4341
4467
  hasUserId: !!this.userId,
4342
4468
  hasUserHash: !!this.userHash
4343
- }), typeof document < "u" && !document.getElementById(ge)) {
4469
+ }), typeof document < "u" && !document.getElementById(ye)) {
4344
4470
  const t = document.createElement("style");
4345
- t.id = ge, t.textContent = Pe, document.head.appendChild(t);
4471
+ t.id = ye, t.textContent = Pe, document.head.appendChild(t);
4346
4472
  }
4347
4473
  this.hydrateReadState(), await this.boot(), this.isEmbedded && this.store && await this.open();
4348
4474
  },
@@ -4408,11 +4534,11 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4408
4534
  for (let s = e.length - 1; s >= 0; s--) {
4409
4535
  const a = e[s];
4410
4536
  if (!a) continue;
4411
- const d = typeof a.text_md == "string" ? a.text_md.trim() : "";
4412
- if (d)
4413
- return (((n = a.author) == null ? void 0 : n.type) === "user" ? "Vous : " : "") + d.replace(/\s+/g, " ");
4414
- const v = (o = a.payload) == null ? void 0 : o.attachments;
4415
- if (Array.isArray(v) && v.length) return "📎 Pièce jointe";
4537
+ const l = typeof a.text_md == "string" ? a.text_md.trim() : "";
4538
+ if (l)
4539
+ return (((n = a.author) == null ? void 0 : n.type) === "user" ? "Vous : " : "") + l.replace(/\s+/g, " ");
4540
+ const g = (o = a.payload) == null ? void 0 : o.attachments;
4541
+ if (Array.isArray(g) && g.length) return "📎 Pièce jointe";
4416
4542
  }
4417
4543
  return (t == null ? void 0 : t.last_message_preview) || (t == null ? void 0 : t.preview) || ((r = t == null ? void 0 : t.metadata) == null ? void 0 : r.last_preview) || "";
4418
4544
  },
@@ -4484,17 +4610,17 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4484
4610
  // bounded by MIN/MAX_BETWEEN_MS.
4485
4611
  scheduleReveal(t) {
4486
4612
  const e = Date.now(), n = ((t == null ? void 0 : t.text_md) || "").length, o = Math.min(
4487
- Pi,
4488
- Math.max(Ui, n * ji)
4613
+ Qi,
4614
+ Math.max(Zi, n * Xi)
4489
4615
  ), s = Math.max(
4490
- e + Ni,
4491
- this.nextRevealAt + Hi
4616
+ e + Ji,
4617
+ this.nextRevealAt + ea
4492
4618
  ) + o;
4493
4619
  this.nextRevealAt = s;
4494
- const a = Math.max(0, s - e), d = t.id, v = setTimeout(() => {
4495
- this.revealedAt = { ...this.revealedAt, [d]: Date.now() }, this.revealTimers = this.revealTimers.filter((k) => k !== v);
4620
+ const a = Math.max(0, s - e), l = t.id, g = setTimeout(() => {
4621
+ this.revealedAt = { ...this.revealedAt, [l]: Date.now() }, this.revealTimers = this.revealTimers.filter((C) => C !== g);
4496
4622
  }, a);
4497
- this.revealTimers.push(v);
4623
+ this.revealTimers.push(g);
4498
4624
  },
4499
4625
  async boot() {
4500
4626
  if (!this.canBoot) {
@@ -4511,12 +4637,12 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4511
4637
  baseUrl: this.baseUrl,
4512
4638
  widgetId: this.widgetId,
4513
4639
  userId: this.userId
4514
- }), this.transport = me(Fe({
4640
+ }), this.transport = fe(Re({
4515
4641
  baseUrl: this.baseUrl,
4516
4642
  widgetId: this.widgetId,
4517
4643
  userId: this.userId,
4518
4644
  userHash: this.userHash
4519
- })), this.store = me(Ue(this.transport)), this.hydrateNotifPref(), this.setupNotifications(), await this.store.start(), this.customer && typeof this.customer == "object" && await this.store.applyCustomer(this.customer), console.log("[ww-messenger] boot done", {
4645
+ })), this.store = fe(Ue(this.transport)), this.hydrateNotifPref(), this.setupNotifications(), await this.store.start(), this.customer && typeof this.customer == "object" && await this.store.applyCustomer(this.customer), console.log("[ww-messenger] boot done", {
4520
4646
  ready: this.store.state.ready,
4521
4647
  error: this.store.state.error
4522
4648
  });
@@ -4527,17 +4653,26 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4527
4653
  async refresh() {
4528
4654
  this.store && this.store.destroy(), this.cancelReveals(), this.teardownNotifications(), this.revealedAt = {}, this.nextRevealAt = 0, this.convOpenedAt = 0, this.transport = null, this.store = null, this.isOpen = !1, this.draft = "", this.busy = !1, this.bootError = null, this.pendingAttachments = [], this.feedbackBusy = !1, this.feedbackDone = !1, this.historyOpen = !1, this.moreOpen = !1, this.renameDialogOpen = !1, this.draftConv = null, this.activeConvId = null, this.showOnboarding = !1, await this.boot(), this.isEmbedded && this.store && await this.open();
4529
4655
  },
4530
- // Opening straight from the étiquette: land on the unread thread it
4531
- // was previewing rather than whatever was last active.
4532
- async openFromPeek() {
4533
- var e, n;
4534
- const t = (e = this.latestUnread) == null ? void 0 : e.convId;
4535
- t && t !== ((n = this.currentConv) == null ? void 0 : n.id) && (this.draftConv = null, this.activeConvId = t, this.showOnboarding = !1), await this.open();
4656
+ // Opening straight from a notification card: land on that card's
4657
+ // thread rather than whatever was last active. Called with the
4658
+ // convId for the clicked card; falls back to the freshest unread
4659
+ // when invoked without an id (defensive).
4660
+ async openFromPeek(t) {
4661
+ var n, o;
4662
+ const e = t || ((n = this.latestUnreads[0]) == null ? void 0 : n.convId);
4663
+ e && e !== ((o = this.currentConv) == null ? void 0 : o.id) && (this.draftConv = null, this.activeConvId = e, this.showOnboarding = !1), await this.open();
4664
+ },
4665
+ // Stamp the dismissed batch ts for a single conv so its card
4666
+ // disappears from the stack until a fresher message arrives.
4667
+ dismissPeek(t) {
4668
+ const e = this.latestUnreads.find((n) => n.convId === t);
4669
+ e && (this.dismissedPeeks = { ...this.dismissedPeeks, [t]: e.ts });
4536
4670
  },
4537
4671
  async open() {
4538
4672
  this.isOpen = !0, this.store && this.store.setPanelOpen(!0);
4539
4673
  const t = this.currentConv;
4540
4674
  if (t && !t._draft) {
4675
+ this.activeConvId == null && (this.activeConvId = t.id);
4541
4676
  try {
4542
4677
  await this.store.openConversation(t.id);
4543
4678
  } catch (e) {
@@ -4610,14 +4745,28 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4610
4745
  async onDrawerNew() {
4611
4746
  this.historyOpen = !1, await this.startConv();
4612
4747
  },
4613
- async onNotifToggle(t) {
4614
- if (this.notifEnabled = !!t, this.persistNotifPref(), this.notifEnabled && typeof Notification < "u" && Notification.permission === "default")
4748
+ onSoundToggle(t) {
4749
+ this.soundEnabled = !!t, this.persistSoundPref();
4750
+ },
4751
+ async onBrowserNotifToggle(t) {
4752
+ if (typeof Notification > "u") {
4753
+ this.browserNotifEnabled = !1, this.persistBrowserNotifPref();
4754
+ return;
4755
+ }
4756
+ if (!t) {
4757
+ this.browserNotifEnabled = !1, this.persistBrowserNotifPref();
4758
+ return;
4759
+ }
4760
+ let e = Notification.permission;
4761
+ if (e === "default") {
4615
4762
  try {
4616
- const e = await Notification.requestPermission();
4617
- this.notifPermission = e;
4618
- } catch (e) {
4619
- console.warn("[ww-messenger] notif permission request failed", e);
4763
+ e = await Notification.requestPermission();
4764
+ } catch (n) {
4765
+ console.warn("[ww-messenger] notif permission request failed", n), e = "denied";
4620
4766
  }
4767
+ this.notifPermission = e;
4768
+ }
4769
+ this.browserNotifEnabled = e === "granted", this.persistBrowserNotifPref();
4621
4770
  },
4622
4771
  // ── Notifications (sound + browser push) ──────────────────────────
4623
4772
  setupNotifications() {
@@ -4640,33 +4789,45 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4640
4789
  this._audioCtx = null;
4641
4790
  }
4642
4791
  },
4643
- notifStorageKey() {
4644
- return `wm:notif:${this.widgetId || ""}:${this.userId || ""}`;
4792
+ soundStorageKey() {
4793
+ return `wm:notif:sound:${this.widgetId || ""}:${this.userId || ""}`;
4794
+ },
4795
+ browserNotifStorageKey() {
4796
+ return `wm:notif:browser:${this.widgetId || ""}:${this.userId || ""}`;
4645
4797
  },
4646
4798
  hydrateNotifPref() {
4647
4799
  try {
4648
4800
  if (typeof localStorage > "u") return;
4649
- const t = localStorage.getItem(this.notifStorageKey());
4650
- t === "0" ? this.notifEnabled = !1 : t === "1" && (this.notifEnabled = !0);
4801
+ const t = localStorage.getItem(this.soundStorageKey());
4802
+ t === "0" ? this.soundEnabled = !1 : t === "1" && (this.soundEnabled = !0);
4803
+ const e = localStorage.getItem(this.browserNotifStorageKey());
4804
+ e === "0" ? this.browserNotifEnabled = !1 : e === "1" && (this.browserNotifEnabled = typeof Notification < "u" && Notification.permission === "granted");
4651
4805
  } catch {
4652
4806
  }
4653
4807
  },
4654
- persistNotifPref() {
4808
+ persistSoundPref() {
4655
4809
  try {
4656
4810
  if (typeof localStorage > "u") return;
4657
- localStorage.setItem(this.notifStorageKey(), this.notifEnabled ? "1" : "0");
4811
+ localStorage.setItem(this.soundStorageKey(), this.soundEnabled ? "1" : "0");
4812
+ } catch {
4813
+ }
4814
+ },
4815
+ persistBrowserNotifPref() {
4816
+ try {
4817
+ if (typeof localStorage > "u") return;
4818
+ localStorage.setItem(this.browserNotifStorageKey(), this.browserNotifEnabled ? "1" : "0");
4658
4819
  } catch {
4659
4820
  }
4660
4821
  },
4661
4822
  onIncomingNotification(t) {
4662
4823
  var a;
4663
- if (!this.notifEnabled) return;
4824
+ if (!this.soundEnabled && !this.browserNotifEnabled) return;
4664
4825
  const e = t == null ? void 0 : t.conversation_id, n = t == null ? void 0 : t.message;
4665
4826
  if (!e || !n || !ie(n)) return;
4666
4827
  const o = n != null && n.created_at ? Date.parse(n.created_at) : NaN;
4667
4828
  if (Number.isFinite(o) && o < this.convOpenedAt - 1e3) return;
4668
4829
  const r = typeof document < "u" && document.hidden;
4669
- this.isOpen && !r && ((a = this.currentConv) == null ? void 0 : a.id) === e || (this.playNotificationSound(), this.showBrowserNotification(e, n));
4830
+ this.isOpen && !r && ((a = this.currentConv) == null ? void 0 : a.id) === e || (this.soundEnabled && this.playNotificationSound(), this.browserNotifEnabled && this.showBrowserNotification(e, n));
4670
4831
  },
4671
4832
  playNotificationSound() {
4672
4833
  if (typeof window > "u") return;
@@ -4688,27 +4849,27 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4688
4849
  showBrowserNotification(t, e) {
4689
4850
  var a;
4690
4851
  if (typeof Notification > "u" || Notification.permission !== "granted") return;
4691
- const n = this.allConversations.find((d) => d.id === t), o = (n == null ? void 0 : n.name) || ((a = this.widget) == null ? void 0 : a.name) || "Nouveau message", r = typeof (e == null ? void 0 : e.text_md) == "string" ? e.text_md.trim() : "", s = r ? r.slice(0, 140) : "Vous avez un nouveau message";
4852
+ const n = this.allConversations.find((l) => l.id === t), o = (n == null ? void 0 : n.name) || ((a = this.widget) == null ? void 0 : a.name) || "Nouveau message", r = typeof (e == null ? void 0 : e.text_md) == "string" ? e.text_md.trim() : "", s = r ? r.slice(0, 140) : "Vous avez un nouveau message";
4692
4853
  try {
4693
- const d = new Notification(o, {
4854
+ const l = new Notification(o, {
4694
4855
  body: s,
4695
4856
  tag: `wm-${t}`,
4696
4857
  renotify: !1,
4697
4858
  silent: !0
4698
4859
  });
4699
- d.onclick = () => {
4860
+ l.onclick = () => {
4700
4861
  try {
4701
4862
  window.focus();
4702
4863
  } catch {
4703
4864
  }
4704
4865
  this.draftConv = null, this.showOnboarding = !1, this.activeConvId = t, this.isOpen = !0, this.store && this.store.setPanelOpen(!0);
4705
4866
  try {
4706
- d.close();
4867
+ l.close();
4707
4868
  } catch {
4708
4869
  }
4709
4870
  };
4710
- } catch (d) {
4711
- console.warn("[ww-messenger] notification failed", d);
4871
+ } catch (l) {
4872
+ console.warn("[ww-messenger] notification failed", l);
4712
4873
  }
4713
4874
  },
4714
4875
  async onMoreAction(t) {
@@ -4754,7 +4915,7 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4754
4915
  }
4755
4916
  },
4756
4917
  exportCurrentConv() {
4757
- var r, s, a, d, v, k;
4918
+ var r, s, a, l, g, C;
4758
4919
  const t = this.currentConv;
4759
4920
  if (!t) return;
4760
4921
  const e = (((s = (r = this.s) == null ? void 0 : r.messagesByConv) == null ? void 0 : s[t.id]) || []).slice(), n = [
@@ -4762,18 +4923,18 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4762
4923
  t.created_at ? `Créée le : ${t.created_at}` : "",
4763
4924
  ""
4764
4925
  ];
4765
- for (const w of e) {
4766
- if (!w) continue;
4767
- const S = ((a = w.author) == null ? void 0 : a.name) || (((d = w.author) == null ? void 0 : d.type) === "user" ? "Vous" : ((v = w.author) == null ? void 0 : v.type) === "agent_human" ? "Agent" : ((k = w.author) == null ? void 0 : k.type) === "agent_ia" ? "Assistant IA" : "Système"), F = w.created_at ? new Date(w.created_at).toLocaleString("fr-FR") : "", A = (w.text_md || "").trim();
4768
- A && (n.push(`[${F}] ${S} :`), n.push(A), n.push(""));
4926
+ for (const y of e) {
4927
+ if (!y) continue;
4928
+ const S = ((a = y.author) == null ? void 0 : a.name) || (((l = y.author) == null ? void 0 : l.type) === "user" ? "Vous" : ((g = y.author) == null ? void 0 : g.type) === "agent_human" ? "Agent" : ((C = y.author) == null ? void 0 : C.type) === "agent_ia" ? "Assistant IA" : "Système"), N = y.created_at ? new Date(y.created_at).toLocaleString("fr-FR") : "", A = (y.text_md || "").trim();
4929
+ A && (n.push(`[${N}] ${S} :`), n.push(A), n.push(""));
4769
4930
  }
4770
4931
  const o = new Blob([n.join(`
4771
4932
  `)], { type: "text/plain;charset=utf-8" });
4772
4933
  try {
4773
- const w = URL.createObjectURL(o), S = document.createElement("a");
4774
- S.href = w, S.download = `${(t.name || "conversation").replace(/[^a-z0-9-_]+/gi, "_")}.txt`, document.body.appendChild(S), S.click(), document.body.removeChild(S), setTimeout(() => URL.revokeObjectURL(w), 1e3);
4775
- } catch (w) {
4776
- console.error("[ww-messenger] export failed", w);
4934
+ const y = URL.createObjectURL(o), S = document.createElement("a");
4935
+ S.href = y, S.download = `${(t.name || "conversation").replace(/[^a-z0-9-_]+/gi, "_")}.txt`, document.body.appendChild(S), S.click(), document.body.removeChild(S), setTimeout(() => URL.revokeObjectURL(y), 1e3);
4936
+ } catch (y) {
4937
+ console.error("[ww-messenger] export failed", y);
4777
4938
  }
4778
4939
  },
4779
4940
  async onSend(t) {
@@ -4799,12 +4960,12 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4799
4960
  async onFormSubmit({ values: t }) {
4800
4961
  const e = this.pendingForm;
4801
4962
  if (!(e != null && e.form)) return;
4802
- const n = Fi(e.form, t);
4963
+ const n = Gi(e.form, t);
4803
4964
  if (!n) return;
4804
4965
  let o = this.currentConv;
4805
4966
  o && (o._draft && (o = await this.ensureRealConv(), !o) || await this.store.send(o.id, n, {
4806
4967
  metadata: {
4807
- artifact: Di(e.form, t)
4968
+ artifact: Yi(e.form, t)
4808
4969
  }
4809
4970
  }));
4810
4971
  },
@@ -4848,54 +5009,54 @@ const Ni = 450, ji = 50, Ui = 900, Pi = 12e3, Hi = 300, zi = {
4848
5009
  }
4849
5010
  }
4850
5011
  }
4851
- }, Vi = {
5012
+ }, na = {
4852
5013
  key: 0,
4853
5014
  class: "wm-loading",
4854
5015
  "aria-busy": "true",
4855
5016
  "aria-live": "polite"
4856
- }, qi = {
5017
+ }, sa = {
4857
5018
  key: 0,
4858
5019
  class: "wm-state"
4859
- }, Wi = { class: "wm-state__err" }, Ki = { class: "wm-state__errSub" }, Gi = { class: "wm-bottom" }, Yi = {
5020
+ }, ra = { class: "wm-state__err" }, ia = { class: "wm-state__errSub" }, aa = { class: "wm-bottom" }, oa = {
4860
5021
  key: 0,
4861
5022
  ref: "floatEl",
4862
5023
  class: "wm-float"
4863
- }, Ji = {
5024
+ }, la = {
4864
5025
  key: 1,
4865
5026
  class: "wm-actionWait",
4866
5027
  role: "status",
4867
5028
  "aria-live": "polite"
4868
- }, Xi = { class: "wm-actionWait__lbl" }, Zi = {
5029
+ }, da = { class: "wm-actionWait__lbl" }, ca = {
4869
5030
  key: 2,
4870
5031
  class: "wm-attached"
4871
- }, Qi = ["onClick"];
4872
- function ea(t, e, n, o, r, s) {
4873
- const a = B("Launcher"), d = B("Header"), v = B("Onboarding"), k = B("MessageList"), w = B("ApprovalCard"), S = B("FormCard"), F = B("Feedback"), A = B("SuggestionChips"), U = B("Composer"), x = B("MoreMenu"), j = B("RenameDialog"), P = B("HistoryDrawer");
4874
- return l(), c("div", {
5032
+ }, ua = ["onClick"];
5033
+ function ha(t, e, n, o, r, s) {
5034
+ const a = I("Launcher"), l = I("Header"), g = I("Onboarding"), C = I("MessageList"), y = I("ApprovalCard"), S = I("FormCard"), N = I("Feedback"), A = I("SuggestionChips"), D = I("Composer"), x = I("MoreMenu"), U = I("RenameDialog"), P = I("HistoryDrawer");
5035
+ return d(), c("div", {
4875
5036
  class: E(["wm-root", `wm-root--${n.displayMode}`])
4876
5037
  }, [
4877
- !r.isOpen && !s.isEmbedded ? (l(), L(a, {
5038
+ !r.isOpen && !s.isEmbedded ? (d(), L(a, {
4878
5039
  key: 0,
4879
5040
  "unread-count": s.unreadCount,
4880
- peek: s.launcherPeek,
5041
+ peeks: s.launcherPeeks,
4881
5042
  onOpen: s.openFromPeek,
4882
- onDismiss: e[0] || (e[0] = (R) => r.labelDismissed = !0)
4883
- }, null, 8, ["unread-count", "peek", "onOpen"])) : y("", !0),
4884
- r.isOpen || s.isEmbedded ? (l(), c("section", {
5043
+ onDismiss: s.dismissPeek
5044
+ }, null, 8, ["unread-count", "peeks", "onOpen", "onDismiss"])) : b("", !0),
5045
+ r.isOpen || s.isEmbedded ? (d(), c("section", {
4885
5046
  key: 1,
4886
5047
  class: E(["wm-panel", `wm-panel--${n.displayMode}`]),
4887
- style: G(r.floatHeight ? { "--wm-float-h": r.floatHeight + "px" } : null),
5048
+ style: z(r.floatHeight ? { "--wm-float-h": r.floatHeight + "px" } : null),
4888
5049
  role: "dialog",
4889
5050
  "aria-label": "Messenger"
4890
5051
  }, [
4891
- !s.ready && !s.error ? (l(), c("div", Vi, [
4892
- s.isEmbedded ? y("", !0) : (l(), c("button", {
5052
+ !s.ready && !s.error ? (d(), c("div", na, [
5053
+ s.isEmbedded ? b("", !0) : (d(), c("button", {
4893
5054
  key: 0,
4894
5055
  type: "button",
4895
5056
  class: "wm-loading__close",
4896
5057
  "aria-label": "Réduire",
4897
- onClick: e[1] || (e[1] = (...R) => s.close && s.close(...R))
4898
- }, [...e[8] || (e[8] = [
5058
+ onClick: e[0] || (e[0] = (...R) => s.close && s.close(...R))
5059
+ }, [...e[7] || (e[7] = [
4899
5060
  i("svg", {
4900
5061
  width: "13",
4901
5062
  height: "13",
@@ -4910,12 +5071,12 @@ function ea(t, e, n, o, r, s) {
4910
5071
  i("path", { d: "M18 6L6 18M6 6l12 12" })
4911
5072
  ], -1)
4912
5073
  ])])),
4913
- e[9] || (e[9] = i("div", {
5074
+ e[8] || (e[8] = i("div", {
4914
5075
  class: "wm-loading__spinner",
4915
5076
  "aria-hidden": "true"
4916
5077
  }, null, -1))
4917
- ])) : (l(), c(M, { key: 1 }, [
4918
- K(d, {
5078
+ ])) : (d(), c(M, { key: 1 }, [
5079
+ K(l, {
4919
5080
  title: s.headerTitle,
4920
5081
  escalated: s.isEscalated,
4921
5082
  "agent-name": s.humanAgentName,
@@ -4930,9 +5091,9 @@ function ea(t, e, n, o, r, s) {
4930
5091
  onMore: s.toggleMore,
4931
5092
  onClose: s.close
4932
5093
  }, null, 8, ["title", "escalated", "agent-name", "agent-avatar-url", "team-members", "response-label", "show-identity", "show-back", "show-close", "more-active", "onBack", "onMore", "onClose"]),
4933
- s.error ? (l(), c("div", qi, [
4934
- i("div", Wi, [
4935
- e[11] || (e[11] = i("div", { class: "wm-state__errIcon" }, [
5094
+ s.error ? (d(), c("div", sa, [
5095
+ i("div", ra, [
5096
+ e[10] || (e[10] = i("div", { class: "wm-state__errIcon" }, [
4936
5097
  i("svg", {
4937
5098
  width: "14",
4938
5099
  height: "14",
@@ -4948,12 +5109,12 @@ function ea(t, e, n, o, r, s) {
4948
5109
  ])
4949
5110
  ], -1)),
4950
5111
  i("div", null, [
4951
- e[10] || (e[10] = i("div", { class: "wm-state__errTitle" }, "Connexion impossible", -1)),
4952
- i("div", Ki, b(s.error), 1)
5112
+ e[9] || (e[9] = i("div", { class: "wm-state__errTitle" }, "Connexion impossible", -1)),
5113
+ i("div", ia, k(s.error), 1)
4953
5114
  ])
4954
5115
  ])
4955
- ])) : s.currentConv ? (l(), c(M, { key: 2 }, [
4956
- K(k, {
5116
+ ])) : s.currentConv ? (d(), c(M, { key: 2 }, [
5117
+ K(C, {
4957
5118
  ref: "messageList",
4958
5119
  messages: s.displayedMessages,
4959
5120
  "streaming-active": s.streamingActive,
@@ -4965,40 +5126,40 @@ function ea(t, e, n, o, r, s) {
4965
5126
  "unread-boundary-ts": r.unreadBoundaryTs,
4966
5127
  onLoadMore: s.onLoadMore
4967
5128
  }, null, 8, ["messages", "streaming-active", "date-label", "conversation-id", "loading-more", "has-more", "unread-anchor-ts", "unread-boundary-ts", "onLoadMore"]),
4968
- i("div", Gi, [
4969
- s.floatVisible ? (l(), c("div", Yi, [
4970
- s.approvalReady ? (l(), L(w, {
5129
+ i("div", aa, [
5130
+ s.floatVisible ? (d(), c("div", oa, [
5131
+ s.approvalReady ? (d(), L(y, {
4971
5132
  key: 0,
4972
5133
  action: s.approvalTitle,
4973
5134
  detail: s.approvalDetail,
4974
5135
  callbacks: s.pendingApproval.callbacks,
4975
5136
  onCallback: s.onApprovalCallback
4976
- }, null, 8, ["action", "detail", "callbacks", "onCallback"])) : s.pendingForm ? (l(), L(S, {
5137
+ }, null, 8, ["action", "detail", "callbacks", "onCallback"])) : s.pendingForm ? (d(), L(S, {
4977
5138
  key: s.pendingForm.message && s.pendingForm.message.id,
4978
5139
  form: s.pendingForm.form,
4979
5140
  onSubmit: s.onFormSubmit
4980
- }, null, 8, ["form", "onSubmit"])) : s.showFeedback ? (l(), L(F, {
5141
+ }, null, 8, ["form", "onSubmit"])) : s.showFeedback ? (d(), L(N, {
4981
5142
  key: 2,
4982
5143
  busy: r.feedbackBusy,
4983
5144
  done: r.feedbackDone,
4984
5145
  onSubmit: s.onFeedback
4985
- }, null, 8, ["busy", "done", "onSubmit"])) : (l(), L(A, {
5146
+ }, null, 8, ["busy", "done", "onSubmit"])) : (d(), L(A, {
4986
5147
  key: 3,
4987
5148
  items: s.suggestions,
4988
5149
  onSelect: s.onSuggestion
4989
5150
  }, null, 8, ["items", "onSelect"]))
4990
- ], 512)) : y("", !0),
4991
- s.actionInFlight ? (l(), c("div", Ji, [
4992
- e[12] || (e[12] = i("span", {
5151
+ ], 512)) : b("", !0),
5152
+ s.actionInFlight ? (d(), c("div", la, [
5153
+ e[11] || (e[11] = i("span", {
4993
5154
  class: "wm-actionWait__spinner",
4994
5155
  "aria-hidden": "true"
4995
5156
  }, null, -1)),
4996
- i("span", Xi, b(s.actionInFlightName) + " en cours, veuillez patienter…", 1)
4997
- ])) : (l(), L(U, {
5157
+ i("span", da, k(s.actionInFlightName) + " en cours, veuillez patienter…", 1)
5158
+ ])) : (d(), L(D, {
4998
5159
  key: 2,
4999
5160
  ref: "composer",
5000
5161
  modelValue: r.draft,
5001
- "onUpdate:modelValue": e[3] || (e[3] = (R) => r.draft = R),
5162
+ "onUpdate:modelValue": e[2] || (e[2] = (R) => r.draft = R),
5002
5163
  placeholder: s.composerPlaceholder,
5003
5164
  disabled: !!s.pendingApproval,
5004
5165
  "attach-label": "Joindre un fichier",
@@ -5006,30 +5167,32 @@ function ea(t, e, n, o, r, s) {
5006
5167
  onAttach: s.onAttach
5007
5168
  }, null, 8, ["modelValue", "placeholder", "disabled", "onSend", "onAttach"]))
5008
5169
  ]),
5009
- r.moreOpen ? (l(), L(x, {
5170
+ r.moreOpen ? (d(), L(x, {
5010
5171
  key: 0,
5011
5172
  "can-rename": !!s.currentConv && !s.currentConv._draft,
5012
5173
  "can-export": !!s.currentConv && !s.currentConv._draft,
5013
- "notif-enabled": r.notifEnabled,
5174
+ "sound-enabled": r.soundEnabled,
5175
+ "browser-notif-enabled": r.browserNotifEnabled,
5014
5176
  "status-url": s.statusUrl,
5015
5177
  "help-url": s.helpUrl,
5016
- onClose: e[4] || (e[4] = (R) => r.moreOpen = !1),
5017
- onNotifToggle: s.onNotifToggle,
5178
+ onClose: e[3] || (e[3] = (R) => r.moreOpen = !1),
5179
+ onSoundToggle: s.onSoundToggle,
5180
+ onBrowserNotifToggle: s.onBrowserNotifToggle,
5018
5181
  onAction: s.onMoreAction
5019
- }, null, 8, ["can-rename", "can-export", "notif-enabled", "status-url", "help-url", "onNotifToggle", "onAction"])) : y("", !0),
5020
- r.renameDialogOpen && s.currentConv && !s.currentConv._draft ? (l(), L(j, {
5182
+ }, null, 8, ["can-rename", "can-export", "sound-enabled", "browser-notif-enabled", "status-url", "help-url", "onSoundToggle", "onBrowserNotifToggle", "onAction"])) : b("", !0),
5183
+ r.renameDialogOpen && s.currentConv && !s.currentConv._draft ? (d(), L(U, {
5021
5184
  key: 1,
5022
5185
  "initial-value": s.currentConv.name || "",
5023
5186
  title: "Modifier le titre de la conversation",
5024
- onClose: e[5] || (e[5] = (R) => r.renameDialogOpen = !1),
5187
+ onClose: e[4] || (e[4] = (R) => r.renameDialogOpen = !1),
5025
5188
  onSubmit: s.onRenameSubmit
5026
- }, null, 8, ["initial-value", "onSubmit"])) : y("", !0),
5027
- r.pendingAttachments.length ? (l(), c("div", Zi, [
5028
- (l(!0), c(M, null, D(r.pendingAttachments, (R, H) => (l(), c("div", {
5189
+ }, null, 8, ["initial-value", "onSubmit"])) : b("", !0),
5190
+ r.pendingAttachments.length ? (d(), c("div", ca, [
5191
+ (d(!0), c(M, null, F(r.pendingAttachments, (R, H) => (d(), c("div", {
5029
5192
  key: H,
5030
5193
  class: "wm-attached__chip"
5031
5194
  }, [
5032
- e[14] || (e[14] = i("svg", {
5195
+ e[13] || (e[13] = i("svg", {
5033
5196
  width: "11",
5034
5197
  height: "11",
5035
5198
  viewBox: "0 0 24 24",
@@ -5042,12 +5205,12 @@ function ea(t, e, n, o, r, s) {
5042
5205
  }, [
5043
5206
  i("path", { d: "M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48" })
5044
5207
  ], -1)),
5045
- i("span", null, b(R.name), 1),
5208
+ i("span", null, k(R.name), 1),
5046
5209
  i("button", {
5047
5210
  type: "button",
5048
5211
  "aria-label": "Retirer",
5049
- onClick: (Y) => r.pendingAttachments.splice(H, 1)
5050
- }, [...e[13] || (e[13] = [
5212
+ onClick: (J) => r.pendingAttachments.splice(H, 1)
5213
+ }, [...e[12] || (e[12] = [
5051
5214
  i("svg", {
5052
5215
  width: "10",
5053
5216
  height: "10",
@@ -5061,10 +5224,10 @@ function ea(t, e, n, o, r, s) {
5061
5224
  }, [
5062
5225
  i("path", { d: "M18 6L6 18M6 6l12 12" })
5063
5226
  ], -1)
5064
- ])], 8, Qi)
5227
+ ])], 8, ua)
5065
5228
  ]))), 128))
5066
- ])) : y("", !0)
5067
- ], 64)) : (l(), L(v, {
5229
+ ])) : b("", !0)
5230
+ ], 64)) : (d(), L(g, {
5068
5231
  key: 1,
5069
5232
  "welcome-message": s.widgetWelcomeMessage,
5070
5233
  "agent-name": s.agentName,
@@ -5074,73 +5237,75 @@ function ea(t, e, n, o, r, s) {
5074
5237
  onStart: s.startConv,
5075
5238
  onSelect: s.onQuickLink,
5076
5239
  onResume: s.onDrawerPick,
5077
- onViewAll: e[2] || (e[2] = (R) => r.historyOpen = !0)
5240
+ onViewAll: e[1] || (e[1] = (R) => r.historyOpen = !0)
5078
5241
  }, null, 8, ["welcome-message", "agent-name", "quick-links", "open-threads", "busy", "onStart", "onSelect", "onResume"])),
5079
- r.historyOpen ? (l(), L(P, {
5242
+ r.historyOpen ? (d(), L(P, {
5080
5243
  key: 3,
5081
5244
  conversations: s.drawerConversations,
5082
5245
  "active-id": s.currentConv ? s.currentConv.id : null,
5083
- onClose: e[6] || (e[6] = (R) => r.historyOpen = !1),
5246
+ onClose: e[5] || (e[5] = (R) => r.historyOpen = !1),
5084
5247
  onNew: s.onDrawerNew,
5085
5248
  onPick: s.onDrawerPick
5086
- }, null, 8, ["conversations", "active-id", "onNew", "onPick"])) : y("", !0),
5087
- r.moreOpen && !s.currentConv ? (l(), L(x, {
5249
+ }, null, 8, ["conversations", "active-id", "onNew", "onPick"])) : b("", !0),
5250
+ r.moreOpen && !s.currentConv ? (d(), L(x, {
5088
5251
  key: 4,
5089
5252
  "can-rename": !1,
5090
5253
  "can-export": !1,
5091
- "notif-enabled": r.notifEnabled,
5254
+ "sound-enabled": r.soundEnabled,
5255
+ "browser-notif-enabled": r.browserNotifEnabled,
5092
5256
  "status-url": s.statusUrl,
5093
5257
  "help-url": s.helpUrl,
5094
- onClose: e[7] || (e[7] = (R) => r.moreOpen = !1),
5095
- onNotifToggle: s.onNotifToggle,
5258
+ onClose: e[6] || (e[6] = (R) => r.moreOpen = !1),
5259
+ onSoundToggle: s.onSoundToggle,
5260
+ onBrowserNotifToggle: s.onBrowserNotifToggle,
5096
5261
  onAction: s.onMoreAction
5097
- }, null, 8, ["notif-enabled", "status-url", "help-url", "onNotifToggle", "onAction"])) : y("", !0)
5262
+ }, null, 8, ["sound-enabled", "browser-notif-enabled", "status-url", "help-url", "onSoundToggle", "onBrowserNotifToggle", "onAction"])) : b("", !0)
5098
5263
  ], 64))
5099
- ], 6)) : y("", !0)
5264
+ ], 6)) : b("", !0)
5100
5265
  ], 2);
5101
5266
  }
5102
- const sa = /* @__PURE__ */ $(zi, [["render", ea], ["__scopeId", "data-v-e5f17e35"]]), ra = "0.3.4";
5267
+ const _a = /* @__PURE__ */ $(ta, [["render", ha], ["__scopeId", "data-v-a000a0f5"]]), pa = "0.3.6";
5103
5268
  export {
5104
5269
  ne as AIAvatar,
5105
- ce as AVATAR_COLORS,
5106
- tn as ActionResult,
5107
- hr as ApprovalCard,
5108
- cn as ArtifactFormResponse,
5109
- Cn as ArtifactInfoCard,
5110
- Hn as ArtifactRenderer,
5111
- Nn as ArtifactTicket,
5112
- es as AttachmentPreview,
5113
- os as Bubble,
5114
- Zs as Composer,
5270
+ ue as AVATAR_COLORS,
5271
+ fn as ActionResult,
5272
+ Ar as ApprovalCard,
5273
+ kn as ArtifactFormResponse,
5274
+ Ln as ArtifactInfoCard,
5275
+ es as ArtifactRenderer,
5276
+ Jn as ArtifactTicket,
5277
+ hs as AttachmentPreview,
5278
+ ys as Bubble,
5279
+ cr as Composer,
5115
5280
  He as DEFAULT_BASE_URL,
5116
- Yr as Feedback,
5117
- jr as FormCard,
5118
- wt as Header,
5119
- pi as HistoryDrawer,
5120
- ke as HumanAvatar,
5121
- Ge as Launcher,
5122
- he as MEDIA_RECORDER_SUPPORTED,
5123
- Es as MessageList,
5124
- sa as Messenger,
5125
- Ai as MoreMenu,
5126
- zt as Onboarding,
5127
- oe as SCREEN_CAPTURE_SUPPORTED,
5128
- nr as SuggestionChips,
5129
- lt as TeamAvatars,
5130
- us as Typing,
5131
- ra as VERSION,
5132
- ye as avatarColor,
5133
- we as avatarInitials,
5134
- Ls as captureScreenshotFile,
5135
- N as colors,
5281
+ oi as Feedback,
5282
+ Xr as FormCard,
5283
+ Mt as Header,
5284
+ Mi as HistoryDrawer,
5285
+ he as HumanAvatar,
5286
+ it as Launcher,
5287
+ me as MEDIA_RECORDER_SUPPORTED,
5288
+ Vs as MessageList,
5289
+ _a as Messenger,
5290
+ Ri as MoreMenu,
5291
+ tn as Onboarding,
5292
+ le as SCREEN_CAPTURE_SUPPORTED,
5293
+ fr as SuggestionChips,
5294
+ pt as TeamAvatars,
5295
+ Cs as Typing,
5296
+ pa as VERSION,
5297
+ we as avatarColor,
5298
+ be as avatarInitials,
5299
+ Ws as captureScreenshotFile,
5300
+ j as colors,
5136
5301
  Ue as createStore,
5137
- Fe as createTransport,
5138
- sa as default,
5139
- be as formatTime,
5140
- na as guessAttachmentKind,
5141
- $s as pickRecorderMime,
5142
- ss as renderMarkdown,
5143
- Fs as startScreenRecording,
5302
+ Re as createTransport,
5303
+ _a as default,
5304
+ ke as formatTime,
5305
+ fa as guessAttachmentKind,
5306
+ qs as pickRecorderMime,
5307
+ _s as renderMarkdown,
5308
+ Gs as startScreenRecording,
5144
5309
  Pe as tokensCss,
5145
5310
  je as uuid,
5146
5311
  je as v4